@cardstack/boxel-cli 0.2.0-unstable.446 → 0.2.0-unstable.448
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/dist/index.js +124 -108
- package/package.json +3 -3
- package/src/commands/file/read.ts +40 -5
- package/src/commands/file/write.ts +58 -10
- package/src/commands/realm/push.ts +23 -12
- package/src/commands/realm/sync.ts +10 -4
- package/src/lib/realm-sync-base.ts +212 -21
package/dist/index.js
CHANGED
|
@@ -1,130 +1,130 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`);let
|
|
4
|
-
`),s=s.replace(/\\r/g,"\r")),e[i]=s}return e}function Uu(r){r=r||{};let e=Ui(r);r.path=e;let t=G.configDotenv(r);if(!t.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw o.code="MISSING_DATA",o}let n=Di(r).split(","),i=n.length,s;for(let o=0;o<i;o++)try{let a=n[o].trim(),l=qu(t,a);s=G.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return G.parse(s)}function ju(r){console.log(`[dotenv@${Pr}][WARN] ${r}`)}function Xe(r){console.log(`[dotenv@${Pr}][DEBUG] ${r}`)}function Fi(r){console.log(`[dotenv@${Pr}] ${r}`)}function Di(r){return r&&r.DOTENV_KEY&&r.DOTENV_KEY.length>0?r.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function qu(r,e){let t;try{t=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let n=t.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=t.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${i.toUpperCase()}`,o=r.parsed[s];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:n}}function Ui(r){let e=null;if(r&&r.path&&r.path.length>0)if(Array.isArray(r.path))for(let t of r.path)Or.existsSync(t)&&(e=t.endsWith(".vault")?t:`${t}.vault`);else e=r.path.endsWith(".vault")?r.path:`${r.path}.vault`;else e=$t.resolve(process.cwd(),".env.vault");return Or.existsSync(e)?e:null}function Ni(r){return r[0]==="~"?$t.join(Mu.homedir(),r.slice(1)):r}function Gu(r){let e=!!(r&&r.debug),t=r&&"quiet"in r?r.quiet:!0;(e||!t)&&Fi("Loading env from encrypted .env.vault");let n=G._parseVault(r),i=process.env;return r&&r.processEnv!=null&&(i=r.processEnv),G.populate(i,n,r),{parsed:n}}function Hu(r){let e=$t.resolve(process.cwd(),".env"),t="utf8",n=!!(r&&r.debug),i=r&&"quiet"in r?r.quiet:!0;r&&r.encoding?t=r.encoding:n&&Xe("No encoding is specified. UTF-8 is used by default");let s=[e];if(r&&r.path)if(!Array.isArray(r.path))s=[Ni(r.path)];else{s=[];for(let c of r.path)s.push(Ni(c))}let o,a={};for(let c of s)try{let u=G.parse(Or.readFileSync(c,{encoding:t}));G.populate(a,u,r)}catch(u){n&&Xe(`Failed to load ${c} ${u.message}`),o=u}let l=process.env;if(r&&r.processEnv!=null&&(l=r.processEnv),G.populate(l,a,r),n||!i){let c=Object.keys(a).length,u=[];for(let f of s)try{let d=$t.relative(process.cwd(),f);u.push(d)}catch(d){n&&Xe(`Failed to load ${f} ${d.message}`),o=d}Fi(`injecting env (${c}) from ${u.join(",")}`)}return o?{parsed:a,error:o}:{parsed:a}}function Wu(r){if(Di(r).length===0)return G.configDotenv(r);let e=Ui(r);return e?G._configVault(r):(ju(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),G.configDotenv(r))}function Vu(r,e){let t=Buffer.from(e.slice(-64),"hex"),n=Buffer.from(r,"base64"),i=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{let o=Iu.createDecipheriv("aes-256-gcm",t,i);return o.setAuthTag(s),`${o.update(n)}${o.final()}`}catch(o){let a=o instanceof RangeError,l=o.message==="Invalid key length",c=o.message==="Unsupported state or unable to authenticate data";if(a||l){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(c){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw o}}function Bu(r,e,t={}){let n=!!(t&&t.debug),i=!!(t&&t.override);if(typeof e!="object"){let s=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw s.code="OBJECT_REQUIRED",s}for(let s of Object.keys(e))Object.prototype.hasOwnProperty.call(r,s)?(i===!0&&(r[s]=e[s]),n&&Xe(i===!0?`"${s}" is already defined and WAS overwritten`:`"${s}" is already defined and was NOT overwritten`)):r[s]=e[s]}var G={configDotenv:Hu,_configVault:Gu,_parseVault:Uu,config:Wu,decrypt:Vu,parse:Du,populate:Bu};Ee.exports.configDotenv=G.configDotenv;Ee.exports._configVault=G._configVault;Ee.exports._parseVault=G._parseVault;Ee.exports.config=G.config;Ee.exports.decrypt=G.decrypt;Ee.exports.parse=G.parse;Ee.exports.populate=G.populate;Ee.exports=G});var Gi=w((ib,qi)=>{var Pe={};process.env.DOTENV_CONFIG_ENCODING!=null&&(Pe.encoding=process.env.DOTENV_CONFIG_ENCODING);process.env.DOTENV_CONFIG_PATH!=null&&(Pe.path=process.env.DOTENV_CONFIG_PATH);process.env.DOTENV_CONFIG_QUIET!=null&&(Pe.quiet=process.env.DOTENV_CONFIG_QUIET);process.env.DOTENV_CONFIG_DEBUG!=null&&(Pe.debug=process.env.DOTENV_CONFIG_DEBUG);process.env.DOTENV_CONFIG_OVERRIDE!=null&&(Pe.override=process.env.DOTENV_CONFIG_OVERRIDE);process.env.DOTENV_CONFIG_DOTENV_KEY!=null&&(Pe.DOTENV_KEY=process.env.DOTENV_CONFIG_DOTENV_KEY);qi.exports=Pe});var Wi=w((sb,Hi)=>{var Yu=/^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;Hi.exports=function(e){let t=e.reduce(function(n,i){let s=i.match(Yu);return s&&(n[s[1]]=s[2]),n},{});return"quiet"in t||(t.quiet="true"),t}});var Ke=w(Ar=>{var St=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Tr=class extends St{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ar.CommanderError=St;Ar.InvalidArgumentError=Tr});var vt=w(Mr=>{var{InvalidArgumentError:Ju}=Ke(),Lr=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Ju(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function zu(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}Mr.Argument=Lr;Mr.humanReadableArgName=zu});var Fr=w(Nr=>{var{humanReadableArgName:Xu}=vt(),Ir=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),s=n.long&&e._findOption(n.long);!i&&!s?t.push(n):n.long&&!s?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(s=>!s.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>Xu(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function s(f,d){return t.formatItem(f,n,d,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(a),i),""]));let l=t.visibleArguments(e).map(f=>s(t.styleArgumentTerm(t.argumentTerm(f)),t.styleArgumentDescription(t.argumentDescription(f))));l.length>0&&(o=o.concat([t.styleTitle("Arguments:"),...l,""]));let c=t.visibleOptions(e).map(f=>s(t.styleOptionTerm(t.optionTerm(f)),t.styleOptionDescription(t.optionDescription(f))));if(c.length>0&&(o=o.concat([t.styleTitle("Options:"),...c,""])),t.showGlobalOptions){let f=t.visibleGlobalOptions(e).map(d=>s(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));f.length>0&&(o=o.concat([t.styleTitle("Global Options:"),...f,""]))}let u=t.visibleCommands(e).map(f=>s(t.styleSubcommandTerm(t.subcommandTerm(f)),t.styleSubcommandDescription(t.subcommandDescription(f))));return u.length>0&&(o=o.concat([t.styleTitle("Commands:"),...u,""])),o.join(`
|
|
5
|
-
`)}displayWidth(e){return
|
|
6
|
-
`+" ".repeat(t+
|
|
7
|
-
${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let
|
|
8
|
-
`)}};function
|
|
2
|
+
"use strict";var Up=Object.create;var Fn=Object.defineProperty;var Dp=Object.getOwnPropertyDescriptor;var qp=Object.getOwnPropertyNames;var Gp=Object.getPrototypeOf,Hp=Object.prototype.hasOwnProperty;var v=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Wp=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qp(e))!Hp.call(i,n)&&n!==t&&Fn(i,n,{get:()=>e[n],enumerable:!(r=Dp(e,n))||r.enumerable});return i};var T=(i,e,t)=>(t=i!=null?Up(Gp(i)):{},Wp(e||!i||!i.__esModule?Fn(t,"default",{value:i,enumerable:!0}):t,i));var Un=v((Ry,Vp)=>{Vp.exports={name:"dotenv",version:"16.6.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Wn=v(($y,we)=>{var Ai=require("fs"),$t=require("path"),Bp=require("os"),zp=require("crypto"),Yp=Un(),Li=Yp.version,Jp=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Xp(i){let e={},t=i.toString();t=t.replace(/\r\n?/mg,`
|
|
3
|
+
`);let r;for(;(r=Jp.exec(t))!=null;){let n=r[1],s=r[2]||"";s=s.trim();let o=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(s=s.replace(/\\n/g,`
|
|
4
|
+
`),s=s.replace(/\\r/g,"\r")),e[n]=s}return e}function Kp(i){i=i||{};let e=Hn(i);i.path=e;let t=H.configDotenv(i);if(!t.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw o.code="MISSING_DATA",o}let r=Gn(i).split(","),n=r.length,s;for(let o=0;o<n;o++)try{let a=r[o].trim(),c=Zp(t,a);s=H.decrypt(c.ciphertext,c.key);break}catch(a){if(o+1>=n)throw a}return H.parse(s)}function Qp(i){console.log(`[dotenv@${Li}][WARN] ${i}`)}function et(i){console.log(`[dotenv@${Li}][DEBUG] ${i}`)}function qn(i){console.log(`[dotenv@${Li}] ${i}`)}function Gn(i){return i&&i.DOTENV_KEY&&i.DOTENV_KEY.length>0?i.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Zp(i,e){let t;try{t=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let r=t.password;if(!r){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let n=t.searchParams.get("environment");if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${n.toUpperCase()}`,o=i.parsed[s];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:r}}function Hn(i){let e=null;if(i&&i.path&&i.path.length>0)if(Array.isArray(i.path))for(let t of i.path)Ai.existsSync(t)&&(e=t.endsWith(".vault")?t:`${t}.vault`);else e=i.path.endsWith(".vault")?i.path:`${i.path}.vault`;else e=$t.resolve(process.cwd(),".env.vault");return Ai.existsSync(e)?e:null}function Dn(i){return i[0]==="~"?$t.join(Bp.homedir(),i.slice(1)):i}function eu(i){let e=!!(i&&i.debug),t=i&&"quiet"in i?i.quiet:!0;(e||!t)&&qn("Loading env from encrypted .env.vault");let r=H._parseVault(i),n=process.env;return i&&i.processEnv!=null&&(n=i.processEnv),H.populate(n,r,i),{parsed:r}}function tu(i){let e=$t.resolve(process.cwd(),".env"),t="utf8",r=!!(i&&i.debug),n=i&&"quiet"in i?i.quiet:!0;i&&i.encoding?t=i.encoding:r&&et("No encoding is specified. UTF-8 is used by default");let s=[e];if(i&&i.path)if(!Array.isArray(i.path))s=[Dn(i.path)];else{s=[];for(let l of i.path)s.push(Dn(l))}let o,a={};for(let l of s)try{let p=H.parse(Ai.readFileSync(l,{encoding:t}));H.populate(a,p,i)}catch(p){r&&et(`Failed to load ${l} ${p.message}`),o=p}let c=process.env;if(i&&i.processEnv!=null&&(c=i.processEnv),H.populate(c,a,i),r||!n){let l=Object.keys(a).length,p=[];for(let u of s)try{let d=$t.relative(process.cwd(),u);p.push(d)}catch(d){r&&et(`Failed to load ${u} ${d.message}`),o=d}qn(`injecting env (${l}) from ${p.join(",")}`)}return o?{parsed:a,error:o}:{parsed:a}}function iu(i){if(Gn(i).length===0)return H.configDotenv(i);let e=Hn(i);return e?H._configVault(i):(Qp(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),H.configDotenv(i))}function ru(i,e){let t=Buffer.from(e.slice(-64),"hex"),r=Buffer.from(i,"base64"),n=r.subarray(0,12),s=r.subarray(-16);r=r.subarray(12,-16);try{let o=zp.createDecipheriv("aes-256-gcm",t,n);return o.setAuthTag(s),`${o.update(r)}${o.final()}`}catch(o){let a=o instanceof RangeError,c=o.message==="Invalid key length",l=o.message==="Unsupported state or unable to authenticate data";if(a||c){let p=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw p.code="INVALID_DOTENV_KEY",p}else if(l){let p=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw p.code="DECRYPTION_FAILED",p}else throw o}}function nu(i,e,t={}){let r=!!(t&&t.debug),n=!!(t&&t.override);if(typeof e!="object"){let s=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw s.code="OBJECT_REQUIRED",s}for(let s of Object.keys(e))Object.prototype.hasOwnProperty.call(i,s)?(n===!0&&(i[s]=e[s]),r&&et(n===!0?`"${s}" is already defined and WAS overwritten`:`"${s}" is already defined and was NOT overwritten`)):i[s]=e[s]}var H={configDotenv:tu,_configVault:eu,_parseVault:Kp,config:iu,decrypt:ru,parse:Xp,populate:nu};we.exports.configDotenv=H.configDotenv;we.exports._configVault=H._configVault;we.exports._parseVault=H._parseVault;we.exports.config=H.config;we.exports.decrypt=H.decrypt;we.exports.parse=H.parse;we.exports.populate=H.populate;we.exports=H});var Bn=v((ky,Vn)=>{var Ae={};process.env.DOTENV_CONFIG_ENCODING!=null&&(Ae.encoding=process.env.DOTENV_CONFIG_ENCODING);process.env.DOTENV_CONFIG_PATH!=null&&(Ae.path=process.env.DOTENV_CONFIG_PATH);process.env.DOTENV_CONFIG_QUIET!=null&&(Ae.quiet=process.env.DOTENV_CONFIG_QUIET);process.env.DOTENV_CONFIG_DEBUG!=null&&(Ae.debug=process.env.DOTENV_CONFIG_DEBUG);process.env.DOTENV_CONFIG_OVERRIDE!=null&&(Ae.override=process.env.DOTENV_CONFIG_OVERRIDE);process.env.DOTENV_CONFIG_DOTENV_KEY!=null&&(Ae.DOTENV_KEY=process.env.DOTENV_CONFIG_DOTENV_KEY);Vn.exports=Ae});var Yn=v((Sy,zn)=>{var su=/^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;zn.exports=function(e){let t=e.reduce(function(r,n){let s=n.match(su);return s&&(r[s[1]]=s[2]),r},{});return"quiet"in t||(t.quiet="true"),t}});var tt=v(Mi=>{var kt=class extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},ji=class extends kt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Mi.CommanderError=kt;Mi.InvalidArgumentError=ji});var St=v(Ni=>{var{InvalidArgumentError:ou}=tt(),Ii=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new ou(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function au(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}Ni.Argument=Ii;Ni.humanReadableArgName=au});var Di=v(Ui=>{var{humanReadableArgName:cu}=St(),Fi=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let r=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),r=e._getHelpOption();if(r&&!r.hidden){let n=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!n&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!n&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let n=r.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>cu(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,n)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,n)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,n)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,n)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let n=e.parent;n;n=n.parent)r=n.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),n=t.helpWidth??80;function s(u,d){return t.formatItem(u,r,d,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(a),n),""]));let c=t.visibleArguments(e).map(u=>s(t.styleArgumentTerm(t.argumentTerm(u)),t.styleArgumentDescription(t.argumentDescription(u))));c.length>0&&(o=o.concat([t.styleTitle("Arguments:"),...c,""]));let l=t.visibleOptions(e).map(u=>s(t.styleOptionTerm(t.optionTerm(u)),t.styleOptionDescription(t.optionDescription(u))));if(l.length>0&&(o=o.concat([t.styleTitle("Options:"),...l,""])),t.showGlobalOptions){let u=t.visibleGlobalOptions(e).map(d=>s(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));u.length>0&&(o=o.concat([t.styleTitle("Global Options:"),...u,""]))}let p=t.visibleCommands(e).map(u=>s(t.styleSubcommandTerm(t.subcommandTerm(u)),t.styleSubcommandDescription(t.subcommandDescription(u))));return p.length>0&&(o=o.concat([t.styleTitle("Commands:"),...p,""])),o.join(`
|
|
5
|
+
`)}displayWidth(e){return Jn(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,r,n){let o=" ".repeat(2);if(!r)return o+e;let a=e.padEnd(t+e.length-n.displayWidth(e)),c=2,p=(this.helpWidth??80)-t-c-2,u;return p<this.minWidthToWrap||n.preformatted(r)?u=r:u=n.boxWrap(r,p).replace(/\n/g,`
|
|
6
|
+
`+" ".repeat(t+c)),o+a+" ".repeat(c)+u.replace(/\n/g,`
|
|
7
|
+
${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let r=e.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,s=[];return r.forEach(o=>{let a=o.match(n);if(a===null){s.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(p=>{let u=this.displayWidth(p);if(l+u<=t){c.push(p),l+=u;return}s.push(c.join(""));let d=p.trimStart();c=[d],l=this.displayWidth(d)}),s.push(c.join(""))}),s.join(`
|
|
8
|
+
`)}};function Jn(i){let e=/\x1b\[\d*(;\d*)*m/g;return i.replace(e,"")}Ui.Help=Fi;Ui.stripColor=Jn});var Wi=v(Hi=>{var{InvalidArgumentError:lu}=tt(),qi=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let r=pu(e);this.short=r.shortFlag,this.long=r.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new lu(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Xn(this.name().replace(/^no-/,"")):Xn(this.name())}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Gi=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,r)=>{this.positiveOptions.has(r)&&this.dualOptions.add(r)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let n=this.negativeOptions.get(r).presetArg,s=n!==void 0?n:!1;return t.negate===(s===e)}};function Xn(i){return i.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function pu(i){let e,t,r=/^-[^-]$/,n=/^--[^-]/,s=i.split(/[ |,]+/).concat("guard");if(r.test(s[0])&&(e=s.shift()),n.test(s[0])&&(t=s.shift()),!e&&r.test(s[0])&&(e=s.shift()),!e&&n.test(s[0])&&(e=t,t=s.shift()),s[0].startsWith("-")){let o=s[0],a=`option creation failed due to '${o}' in option flags '${i}'`;throw/^-[^-][^-]/.test(o)?new Error(`${a}
|
|
9
9
|
- a short flag is a single dash and a single character
|
|
10
10
|
- either use a single dash and a single character (for a short flag)
|
|
11
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):
|
|
12
|
-
- too many short flags`):
|
|
11
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(o)?new Error(`${a}
|
|
12
|
+
- too many short flags`):n.test(o)?new Error(`${a}
|
|
13
13
|
- too many long flags`):new Error(`${a}
|
|
14
|
-
- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${
|
|
15
|
-
(Did you mean one of ${
|
|
16
|
-
(Did you mean ${
|
|
17
|
-
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new
|
|
18
|
-
Expecting one of '${
|
|
19
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=
|
|
20
|
-
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,
|
|
21
|
-
- if '${
|
|
14
|
+
- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${i}'.`);return{shortFlag:e,longFlag:t}}Hi.Option=qi;Hi.DualOptions=Gi});var Qn=v(Kn=>{function uu(i,e){if(Math.abs(i.length-e.length)>3)return Math.max(i.length,e.length);let t=[];for(let r=0;r<=i.length;r++)t[r]=[r];for(let r=0;r<=e.length;r++)t[0][r]=r;for(let r=1;r<=e.length;r++)for(let n=1;n<=i.length;n++){let s=1;i[n-1]===e[r-1]?s=0:s=1,t[n][r]=Math.min(t[n-1][r]+1,t[n][r-1]+1,t[n-1][r-1]+s),n>1&&r>1&&i[n-1]===e[r-2]&&i[n-2]===e[r-1]&&(t[n][r]=Math.min(t[n][r],t[n-2][r-2]+1))}return t[i.length][e.length]}function mu(i,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=i.startsWith("--");t&&(i=i.slice(2),e=e.map(o=>o.slice(2)));let r=[],n=3,s=.4;return e.forEach(o=>{if(o.length<=1)return;let a=uu(i,o),c=Math.max(i.length,o.length);(c-a)/c>s&&(a<n?(n=a,r=[o]):a===n&&r.push(o))}),r.sort((o,a)=>o.localeCompare(a)),t&&(r=r.map(o=>`--${o}`)),r.length>1?`
|
|
15
|
+
(Did you mean one of ${r.join(", ")}?)`:r.length===1?`
|
|
16
|
+
(Did you mean ${r[0]}?)`:""}Kn.suggestSimilar=mu});var is=v(Ji=>{var du=require("node:events").EventEmitter,Vi=require("node:child_process"),Ee=require("node:path"),_t=require("node:fs"),L=require("node:process"),{Argument:fu,humanReadableArgName:hu}=St(),{CommanderError:Bi}=tt(),{Help:gu,stripColor:xu}=Di(),{Option:Zn,DualOptions:vu}=Wi(),{suggestSimilar:es}=Qn(),zi=class i extends du{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>L.stdout.write(t),writeErr:t=>L.stderr.write(t),outputError:(t,r)=>r(t),getOutHelpWidth:()=>L.stdout.isTTY?L.stdout.columns:void 0,getErrHelpWidth:()=>L.stderr.isTTY?L.stderr.columns:void 0,getOutHasColors:()=>Yi()??(L.stdout.isTTY&&L.stdout.hasColors?.()),getErrHasColors:()=>Yi()??(L.stderr.isTTY&&L.stderr.hasColors?.()),stripColor:t=>xu(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let n=t,s=r;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(o);return n&&(c.description(n),c._executableHandler=!0),s.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(s.noHelp||s.hidden),c._executableFile=s.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),n?this:c}createCommand(e){return new i(e)}createHelp(){return Object.assign(new gu,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
17
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new fu(e,t)}argument(e,t,r,n){let s=this.createArgument(e,t);return typeof r=="function"?s.default(n).argParser(r):s.default(r),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,r,n]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",o=this.createCommand(r);return o.helpOption(!1),n&&o.arguments(n),s&&o.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
18
|
+
Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new Bi(e,t,r)),L.exit(e)}action(e){let t=r=>{let n=this.registeredArguments.length,s=r.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new Zn(e,t)}_callParseArg(e,t,r,n){try{return e.parseArg(t,r)}catch(s){if(s.code==="commander.invalidArgument"){let o=`${n} ${s.message}`;this.error(o,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let r=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'
|
|
19
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=n=>[n.name()].concat(n.aliases()),r=t(e).find(n=>this._findCommand(n));if(r){let n=t(this._findCommand(r)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),r=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(r,e.defaultValue,"default");let n=(s,o,a)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let c=this.getOptionValue(r);s!==null&&e.parseArg?s=this._callParseArg(e,s,c,o):s!==null&&e.variadic&&(s=e._concatValue(s,c)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(r,s,a)};return this.on("option:"+t,s=>{let o=`error: option '${e.flags}' argument '${s}' is invalid.`;n(s,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let o=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;n(s,o,"env")}),this}_optionEx(e,t,r,n,s){if(typeof t=="object"&&t instanceof Zn)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,r);if(o.makeOptionMandatory(!!e.mandatory),typeof n=="function")o.default(s).argParser(n);else if(n instanceof RegExp){let a=n;n=(c,l)=>{let p=a.exec(c);return p?p[0]:l},o.default(s).argParser(n)}else o.default(n);return this.addOption(o)}option(e,t,r,n){return this._optionEx({},e,t,r,n)}requiredOption(e,t,r,n){return this._optionEx({mandatory:!0},e,t,r,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(r=>{r.getOptionValueSource(e)!==void 0&&(t=r.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){L.versions?.electron&&(t.from="electron");let n=L.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(t.from="eval")}e===void 0&&(e=L.argv),this.rawArgs=e.slice();let r;switch(t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":L.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,t){this._prepareForParse();let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){this._prepareForParse();let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
20
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,r){if(_t.existsSync(e))return;let n=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${e}' does not exist
|
|
21
|
+
- if '${r}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
22
22
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
23
|
-
- ${
|
|
23
|
+
- ${n}`;throw new Error(s)}_executeSubCommand(e,t){t=t.slice();let r=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(p,u){let d=Ee.resolve(p,u);if(_t.existsSync(d))return d;if(n.includes(Ee.extname(u)))return;let f=n.find(x=>_t.existsSync(`${d}${x}`));if(f)return`${d}${f}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let p;try{p=_t.realpathSync(this._scriptPath)}catch{p=this._scriptPath}a=Ee.resolve(Ee.dirname(p),a)}if(a){let p=s(a,o);if(!p&&!e._executableFile&&this._scriptPath){let u=Ee.basename(this._scriptPath,Ee.extname(this._scriptPath));u!==this._name&&(p=s(a,`${u}-${e._name}`))}o=p||o}r=n.includes(Ee.extname(o));let c;L.platform!=="win32"?r?(t.unshift(o),t=ts(L.execArgv).concat(t),c=Vi.spawn(L.argv[0],t,{stdio:"inherit"})):c=Vi.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,e._name),t.unshift(o),t=ts(L.execArgv).concat(t),c=Vi.spawn(L.execPath,t,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{L.on(u,()=>{c.killed===!1&&c.exitCode===null&&c.kill(u)})});let l=this._exitCallback;c.on("close",p=>{p=p??1,l?l(new Bi(p,"commander.executeSubCommandAsync","(close)")):L.exit(p)}),c.on("error",p=>{if(p.code==="ENOENT")this._checkForMissingExecutable(o,a,e._name);else if(p.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)L.exit(1);else{let u=new Bi(1,"commander.executeSubCommandAsync","(error)");u.nestedError=p,l(u)}}),this.runningCommand=c}_dispatchSubcommand(e,t,r){let n=this._findCommand(e);n||this.help({error:!0}),n._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(r));else return n._parseCommand(t,r)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(r,n,s)=>{let o=n;if(n!==null&&r.parseArg){let a=`error: command-argument value '${n}' is invalid for argument '${r.name()}'.`;o=this._callParseArg(r,n,s,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((r,n)=>{let s=r.defaultValue;r.variadic?n<this.args.length?(s=this.args.slice(n),r.parseArg&&(s=s.reduce((o,a)=>e(r,a,o),r.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],r.parseArg&&(s=e(r,s,r.defaultValue))),t[n]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let r=e,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(o=>{n.push({hookedCommand:s,callback:o})})}),t==="postAction"&&n.reverse(),n.forEach(s=>{r=this._chainOrCall(r,()=>s.callback(s.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let n=e;return this._lifeCycleHooks[r]!==void 0&&this._lifeCycleHooks[r].forEach(s=>{n=this._chainOrCall(n,()=>s(this,t))}),n}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(s,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(r=>{let n=r.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(r=>r.conflictsWith.length>0).forEach(r=>{let n=e.find(s=>r.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(r,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],r=[],n=t,s=e.slice();function o(c){return c.length>1&&c[0]==="-"}let a=null;for(;s.length;){let c=s.shift();if(c==="--"){n===r&&n.push(c),n.push(...s);break}if(a&&!o(c)){this.emit(`option:${a.name()}`,c);continue}if(a=null,o(c)){let l=this._findOption(c);if(l){if(l.required){let p=s.shift();p===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,p)}else if(l.optional){let p=null;s.length>0&&!o(s[0])&&(p=s.shift()),this.emit(`option:${l.name()}`,p)}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(c.length>2&&c[0]==="-"&&c[1]!=="-"){let l=this._findOption(`-${c[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,c.slice(2)):(this.emit(`option:${l.name()}`),s.unshift(`-${c.slice(2)}`));continue}}if(/^--[^=]+=/.test(c)){let l=c.indexOf("="),p=this._findOption(c.slice(0,l));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,c.slice(l+1));continue}}if(o(c)&&(n=r),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(c)){t.push(c),s.length>0&&r.push(...s);break}else if(this._getHelpCommand()&&c===this._getHelpCommand().name()){t.push(c),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){r.push(c),s.length>0&&r.push(...s);break}}if(this._passThroughOptions){n.push(c),s.length>0&&n.push(...s);break}n.push(c)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let n=this.options[r].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
24
24
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
25
25
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
26
|
-
`),this.outputHelp({error:!0}));let
|
|
27
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let
|
|
28
|
-
Expecting one of '${
|
|
29
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(
|
|
26
|
+
`),this.outputHelp({error:!0}));let r=t||{},n=r.exitCode||1,s=r.code||"commander.error";this._exit(n,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in L.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,L.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new vu(this.options),t=r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter(r=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,r.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=o=>{let a=o.attributeName(),c=this.getOptionValue(a),l=this.options.find(u=>u.negate&&a===u.attributeName()),p=this.options.find(u=>!u.negate&&a===u.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:p||o},n=o=>{let a=r(o),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let o=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);n=n.concat(o),s=s.parent}while(s&&!s._enablePositionalOptions);t=es(e,n)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),t=es(e,n)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let n=this.createOption(t,r);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
27
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(r=>hu(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=Ee.basename(e,Ee.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let n=t.formatHelp(this,t);return r.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(e){e=e||{};let t=!!e.error,r,n,s;return t?(r=a=>this._outputConfiguration.writeErr(a),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(r=a=>this._outputConfiguration.writeOut(a),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a=>(n||(a=this._outputConfiguration.stripColor(a)),r(a)),hasColors:n,helpWidth:s}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let r=this._getOutputContext(e),n={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:r.error});if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=Number(L.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
28
|
+
Expecting one of '${r.join("', '")}'`);let n=`${e}Help`;return this.on(n,s=>{let o;typeof t=="function"?o=t({error:s.error,command:s.command}):o=t,o&&s.write(`${o}
|
|
29
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ts(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],n=s[4]),t&&n!=="0"?`${t}=${r}:${parseInt(n)+1}`:e})}function Yi(){if(L.env.NO_COLOR||L.env.FORCE_COLOR==="0"||L.env.FORCE_COLOR==="false")return!1;if(L.env.FORCE_COLOR||L.env.CLICOLOR_FORCE!==void 0)return!0}Ji.Command=zi;Ji.useColor=Yi});var Ct=v(ne=>{var{Argument:rs}=St(),{Command:Xi}=is(),{CommanderError:bu,InvalidArgumentError:ns}=tt(),{Help:yu}=Di(),{Option:ss}=Wi();ne.program=new Xi;ne.createCommand=i=>new Xi(i);ne.createOption=(i,e)=>new ss(i,e);ne.createArgument=(i,e)=>new rs(i,e);ne.Command=Xi;ne.Option=ss;ne.Argument=rs;ne.Help=yu;ne.CommanderError=bu;ne.InvalidArgumentError=ns;ne.InvalidOptionArgumentError=ns});var De=v((Ki,as)=>{var Ot=require("buffer"),he=Ot.Buffer;function os(i,e){for(var t in i)e[t]=i[t]}he.from&&he.alloc&&he.allocUnsafe&&he.allocUnsafeSlow?as.exports=Ot:(os(Ot,Ki),Ki.Buffer=Le);function Le(i,e,t){return he(i,e,t)}Le.prototype=Object.create(he.prototype);os(he,Le);Le.from=function(i,e,t){if(typeof i=="number")throw new TypeError("Argument must not be a number");return he(i,e,t)};Le.alloc=function(i,e,t){if(typeof i!="number")throw new TypeError("Argument must be a number");var r=he(i);return e!==void 0?typeof t=="string"?r.fill(e,t):r.fill(e):r.fill(0),r};Le.allocUnsafe=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return he(i)};Le.allocUnsafeSlow=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return Ot.SlowBuffer(i)}});var Qi=v((jy,cs)=>{var Tt=De().Buffer,wu=require("stream"),Eu=require("util");function Pt(i){if(this.buffer=null,this.writable=!0,this.readable=!0,!i)return this.buffer=Tt.alloc(0),this;if(typeof i.pipe=="function")return this.buffer=Tt.alloc(0),i.pipe(this),this;if(i.length||typeof i=="object")return this.buffer=i,this.writable=!1,process.nextTick(function(){this.emit("end",i),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof i+")")}Eu.inherits(Pt,wu);Pt.prototype.write=function(e){this.buffer=Tt.concat([this.buffer,Tt.from(e)]),this.emit("data",e)};Pt.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1};cs.exports=Pt});var ps=v((My,ls)=>{"use strict";function Zi(i){var e=(i/8|0)+(i%8===0?0:1);return e}var Ru={ES256:Zi(256),ES384:Zi(384),ES512:Zi(521)};function $u(i){var e=Ru[i];if(e)return e;throw new Error('Unknown algorithm "'+i+'"')}ls.exports=$u});var xs=v((Iy,gs)=>{"use strict";var At=De().Buffer,ms=ps(),Lt=128,ds=0,ku=32,Su=16,_u=2,fs=Su|ku|ds<<6,jt=_u|ds<<6;function Cu(i){return i.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function hs(i){if(At.isBuffer(i))return i;if(typeof i=="string")return At.from(i,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function Ou(i,e){i=hs(i);var t=ms(e),r=t+1,n=i.length,s=0;if(i[s++]!==fs)throw new Error('Could not find expected "seq"');var o=i[s++];if(o===(Lt|1)&&(o=i[s++]),n-s<o)throw new Error('"seq" specified length of "'+o+'", only "'+(n-s)+'" remaining');if(i[s++]!==jt)throw new Error('Could not find expected "int" for "r"');var a=i[s++];if(n-s-2<a)throw new Error('"r" specified length of "'+a+'", only "'+(n-s-2)+'" available');if(r<a)throw new Error('"r" specified length of "'+a+'", max of "'+r+'" is acceptable');var c=s;if(s+=a,i[s++]!==jt)throw new Error('Could not find expected "int" for "s"');var l=i[s++];if(n-s!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(n-s)+'"');if(r<l)throw new Error('"s" specified length of "'+l+'", max of "'+r+'" is acceptable');var p=s;if(s+=l,s!==n)throw new Error('Expected to consume entire buffer, but "'+(n-s)+'" bytes remain');var u=t-a,d=t-l,f=At.allocUnsafe(u+a+d+l);for(s=0;s<u;++s)f[s]=0;i.copy(f,s,c+Math.max(-u,0),c+a),s=t;for(var x=s;s<x+d;++s)f[s]=0;return i.copy(f,s,p+Math.max(-d,0),p+l),f=f.toString("base64"),f=Cu(f),f}function us(i,e,t){for(var r=0;e+r<t&&i[e+r]===0;)++r;var n=i[e+r]>=Lt;return n&&--r,r}function Tu(i,e){i=hs(i);var t=ms(e),r=i.length;if(r!==t*2)throw new TypeError('"'+e+'" signatures must be "'+t*2+'" bytes, saw "'+r+'"');var n=us(i,0,t),s=us(i,t,i.length),o=t-n,a=t-s,c=2+o+1+1+a,l=c<Lt,p=At.allocUnsafe((l?2:3)+c),u=0;return p[u++]=fs,l?p[u++]=c:(p[u++]=Lt|1,p[u++]=c&255),p[u++]=jt,p[u++]=o,n<0?(p[u++]=0,u+=i.copy(p,u,0,t)):u+=i.copy(p,u,n,t),p[u++]=jt,p[u++]=a,s<0?(p[u++]=0,i.copy(p,u,t)):i.copy(p,u,t+s),p}gs.exports={derToJose:Ou,joseToDer:Tu}});var bs=v((Ny,vs)=>{"use strict";var it=require("buffer").Buffer,er=require("buffer").SlowBuffer;vs.exports=Mt;function Mt(i,e){if(!it.isBuffer(i)||!it.isBuffer(e)||i.length!==e.length)return!1;for(var t=0,r=0;r<i.length;r++)t|=i[r]^e[r];return t===0}Mt.install=function(){it.prototype.equal=er.prototype.equal=function(e){return Mt(this,e)}};var Pu=it.prototype.equal,Au=er.prototype.equal;Mt.restore=function(){it.prototype.equal=Pu,er.prototype.equal=Au}});var nr=v((Fy,Cs)=>{var Ge=De().Buffer,se=require("crypto"),ws=xs(),ys=require("util"),Lu=`"%s" is not a valid algorithm.
|
|
30
30
|
Supported algorithms are:
|
|
31
|
-
"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,Ze="secret must be a string or buffer",Ue="key must be a string or a buffer",Sf="key must be a string, a buffer or an object",Zr=typeof ie.createPublicKey=="function";Zr&&(Ue+=" or a KeyObject",Ze+="or a KeyObject");function ws(r){if(!je.isBuffer(r)&&typeof r!="string"&&(!Zr||typeof r!="object"||typeof r.type!="string"||typeof r.asymmetricKeyType!="string"||typeof r.export!="function"))throw ce(Ue)}function Es(r){if(!je.isBuffer(r)&&typeof r!="string"&&typeof r!="object")throw ce(Sf)}function vf(r){if(!je.isBuffer(r)){if(typeof r=="string")return r;if(!Zr||typeof r!="object"||r.type!=="secret"||typeof r.export!="function")throw ce(Ze)}}function en(r){return r.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function bs(r){r=r.toString();var e=4-r.length%4;if(e!==4)for(var t=0;t<e;++t)r+="=";return r.replace(/\-/g,"+").replace(/_/g,"/")}function ce(r){var e=[].slice.call(arguments,1),t=gs.format.bind(gs,r).apply(null,e);return new TypeError(t)}function xf(r){return je.isBuffer(r)||typeof r=="string"}function et(r){return xf(r)||(r=JSON.stringify(r)),r}function Rs(r){return function(t,n){vf(n),t=et(t);var i=ie.createHmac("sha"+r,n),s=(i.update(t),i.digest("base64"));return en(s)}}var Qr,kf="timingSafeEqual"in ie?function(e,t){return e.byteLength!==t.byteLength?!1:ie.timingSafeEqual(e,t)}:function(e,t){return Qr||(Qr=hs()),Qr(e,t)};function _f(r){return function(t,n,i){var s=Rs(r)(t,i);return kf(je.from(n),je.from(s))}}function $s(r){return function(t,n){Es(n),t=et(t);var i=ie.createSign("RSA-SHA"+r),s=(i.update(t),i.sign(n,"base64"));return en(s)}}function Ss(r){return function(t,n,i){ws(i),t=et(t),n=bs(n);var s=ie.createVerify("RSA-SHA"+r);return s.update(t),s.verify(i,n,"base64")}}function Cf(r){return function(t,n){Es(n),t=et(t);var i=ie.createSign("RSA-SHA"+r),s=(i.update(t),i.sign({key:n,padding:ie.constants.RSA_PKCS1_PSS_PADDING,saltLength:ie.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return en(s)}}function Of(r){return function(t,n,i){ws(i),t=et(t),n=bs(n);var s=ie.createVerify("RSA-SHA"+r);return s.update(t),s.verify({key:i,padding:ie.constants.RSA_PKCS1_PSS_PADDING,saltLength:ie.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function Pf(r){var e=$s(r);return function(){var n=e.apply(null,arguments);return n=ys.derToJose(n,"ES"+r),n}}function Tf(r){var e=Ss(r);return function(n,i,s){i=ys.joseToDer(i,"ES"+r).toString("base64");var o=e(n,i,s);return o}}function Af(){return function(){return""}}function Lf(){return function(e,t){return t===""}}vs.exports=function(e){var t={hs:Rs,rs:$s,ps:Cf,es:Pf,none:Af},n={hs:_f,rs:Ss,ps:Of,es:Tf,none:Lf},i=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw ce($f,e);var s=(i[1]||i[3]).toLowerCase(),o=i[2];return{sign:t[s](o),verify:n[s](o)}}});var rn=w((wb,xs)=>{var Mf=require("buffer").Buffer;xs.exports=function(e){return typeof e=="string"?e:typeof e=="number"||Mf.isBuffer(e)?e.toString():JSON.stringify(e)}});var Ts=w((Eb,Ps)=>{var If=De().Buffer,ks=zr(),Nf=tn(),Ff=require("stream"),_s=rn(),nn=require("util");function Cs(r,e){return If.from(r,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Df(r,e,t){t=t||"utf8";var n=Cs(_s(r),"binary"),i=Cs(_s(e),t);return nn.format("%s.%s",n,i)}function Os(r){var e=r.header,t=r.payload,n=r.secret||r.privateKey,i=r.encoding,s=Nf(e.alg),o=Df(e,t,i),a=s.sign(o,n);return nn.format("%s.%s",o,a)}function Mt(r){var e=r.secret;if(e=e??r.privateKey,e=e??r.key,/^hs/i.test(r.header.alg)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var t=new ks(e);this.readable=!0,this.header=r.header,this.encoding=r.encoding,this.secret=this.privateKey=this.key=t,this.payload=new ks(r.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}nn.inherits(Mt,Ff);Mt.prototype.sign=function(){try{var e=Os({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}};Mt.sign=Os;Ps.exports=Mt});var qs=w((bb,js)=>{var Ls=De().Buffer,As=zr(),Uf=tn(),jf=require("stream"),Ms=rn(),qf=require("util"),Gf=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function Hf(r){return Object.prototype.toString.call(r)==="[object Object]"}function Wf(r){if(Hf(r))return r;try{return JSON.parse(r)}catch{return}}function Is(r){var e=r.split(".",1)[0];return Wf(Ls.from(e,"base64").toString("binary"))}function Vf(r){return r.split(".",2).join(".")}function Ns(r){return r.split(".")[2]}function Bf(r,e){e=e||"utf8";var t=r.split(".")[1];return Ls.from(t,"base64").toString(e)}function Fs(r){return Gf.test(r)&&!!Is(r)}function Ds(r,e,t){if(!e){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}r=Ms(r);var i=Ns(r),s=Vf(r),o=Uf(e);return o.verify(s,i,t)}function Us(r,e){if(e=e||{},r=Ms(r),!Fs(r))return null;var t=Is(r);if(!t)return null;var n=Bf(r);return(t.typ==="JWT"||e.json)&&(n=JSON.parse(n,e.encoding)),{header:t,payload:n,signature:Ns(r)}}function qe(r){r=r||{};var e=r.secret;if(e=e??r.publicKey,e=e??r.key,/^hs/i.test(r.algorithm)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var t=new As(e);this.readable=!0,this.algorithm=r.algorithm,this.encoding=r.encoding,this.secret=this.publicKey=this.key=t,this.signature=new As(r.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}qf.inherits(qe,jf);qe.prototype.verify=function(){try{var e=Ds(this.signature.buffer,this.algorithm,this.key.buffer),t=Us(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(n){this.readable=!1,this.emit("error",n),this.emit("close")}};qe.decode=Us;qe.isValid=Fs;qe.verify=Ds;js.exports=qe});var Nt=w(Se=>{var Gs=Ts(),It=qs(),Yf=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];Se.ALGORITHMS=Yf;Se.sign=Gs.sign;Se.verify=It.verify;Se.decode=It.decode;Se.isValid=It.isValid;Se.createSign=function(e){return new Gs(e)};Se.createVerify=function(e){return new It(e)}});var sn=w(($b,Hs)=>{var Jf=Nt();Hs.exports=function(r,e){e=e||{};var t=Jf.decode(r,e);if(!t)return null;var n=t.payload;if(typeof n=="string")try{var i=JSON.parse(n);i!==null&&typeof i=="object"&&(n=i)}catch{}return e.complete===!0?{header:t.header,payload:n,signature:t.signature}:n}});var tt=w((Sb,Ws)=>{var Ft=function(r,e){Error.call(this,r),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=r,e&&(this.inner=e)};Ft.prototype=Object.create(Error.prototype);Ft.prototype.constructor=Ft;Ws.exports=Ft});var on=w((vb,Bs)=>{var Vs=tt(),Dt=function(r,e){Vs.call(this,r),this.name="NotBeforeError",this.date=e};Dt.prototype=Object.create(Vs.prototype);Dt.prototype.constructor=Dt;Bs.exports=Dt});var an=w((xb,Js)=>{var Ys=tt(),Ut=function(r,e){Ys.call(this,r),this.name="TokenExpiredError",this.expiredAt=e};Ut.prototype=Object.create(Ys.prototype);Ut.prototype.constructor=Ut;Js.exports=Ut});var Xs=w((kb,zs)=>{var Ge=1e3,He=Ge*60,We=He*60,Ae=We*24,zf=Ae*7,Xf=Ae*365.25;zs.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return Kf(r);if(t==="number"&&isFinite(r))return e.long?Zf(r):Qf(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Kf(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*Xf;case"weeks":case"week":case"w":return t*zf;case"days":case"day":case"d":return t*Ae;case"hours":case"hour":case"hrs":case"hr":case"h":return t*We;case"minutes":case"minute":case"mins":case"min":case"m":return t*He;case"seconds":case"second":case"secs":case"sec":case"s":return t*Ge;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Qf(r){var e=Math.abs(r);return e>=Ae?Math.round(r/Ae)+"d":e>=We?Math.round(r/We)+"h":e>=He?Math.round(r/He)+"m":e>=Ge?Math.round(r/Ge)+"s":r+"ms"}function Zf(r){var e=Math.abs(r);return e>=Ae?jt(r,e,Ae,"day"):e>=We?jt(r,e,We,"hour"):e>=He?jt(r,e,He,"minute"):e>=Ge?jt(r,e,Ge,"second"):r+" ms"}function jt(r,e,t,n){var i=e>=t*1.5;return Math.round(r/t)+" "+n+(i?"s":"")}});var ln=w((_b,Ks)=>{var em=Xs();Ks.exports=function(r,e){var t=e||Math.floor(Date.now()/1e3);if(typeof r=="string"){var n=em(r);return typeof n>"u"?void 0:Math.floor(t+n/1e3)}else return typeof r=="number"?t+r:void 0}});var Ve=w((Cb,Qs)=>{"use strict";var tm="2.0.0",rm=Number.MAX_SAFE_INTEGER||9007199254740991,nm=16,im=250,sm=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Qs.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:nm,MAX_SAFE_BUILD_LENGTH:im,MAX_SAFE_INTEGER:rm,RELEASE_TYPES:sm,SEMVER_SPEC_VERSION:tm,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var rt=w((Ob,Zs)=>{"use strict";var om=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Zs.exports=om});var Be=w((he,eo)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:cn,MAX_SAFE_BUILD_LENGTH:am,MAX_LENGTH:lm}=Ve(),cm=rt();he=eo.exports={};var um=he.re=[],fm=he.safeRe=[],E=he.src=[],mm=he.safeSrc=[],b=he.t={},dm=0,un="[a-zA-Z0-9-]",pm=[["\\s",1],["\\d",lm],[un,am]],hm=r=>{for(let[e,t]of pm)r=r.split(`${e}*`).join(`${e}{0,${t}}`).split(`${e}+`).join(`${e}{1,${t}}`);return r},k=(r,e,t)=>{let n=hm(e),i=dm++;cm(r,i,e),b[r]=i,E[i]=e,mm[i]=n,um[i]=new RegExp(e,t?"g":void 0),fm[i]=new RegExp(n,t?"g":void 0)};k("NUMERICIDENTIFIER","0|[1-9]\\d*");k("NUMERICIDENTIFIERLOOSE","\\d+");k("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${un}*`);k("MAINVERSION",`(${E[b.NUMERICIDENTIFIER]})\\.(${E[b.NUMERICIDENTIFIER]})\\.(${E[b.NUMERICIDENTIFIER]})`);k("MAINVERSIONLOOSE",`(${E[b.NUMERICIDENTIFIERLOOSE]})\\.(${E[b.NUMERICIDENTIFIERLOOSE]})\\.(${E[b.NUMERICIDENTIFIERLOOSE]})`);k("PRERELEASEIDENTIFIER",`(?:${E[b.NONNUMERICIDENTIFIER]}|${E[b.NUMERICIDENTIFIER]})`);k("PRERELEASEIDENTIFIERLOOSE",`(?:${E[b.NONNUMERICIDENTIFIER]}|${E[b.NUMERICIDENTIFIERLOOSE]})`);k("PRERELEASE",`(?:-(${E[b.PRERELEASEIDENTIFIER]}(?:\\.${E[b.PRERELEASEIDENTIFIER]})*))`);k("PRERELEASELOOSE",`(?:-?(${E[b.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${E[b.PRERELEASEIDENTIFIERLOOSE]})*))`);k("BUILDIDENTIFIER",`${un}+`);k("BUILD",`(?:\\+(${E[b.BUILDIDENTIFIER]}(?:\\.${E[b.BUILDIDENTIFIER]})*))`);k("FULLPLAIN",`v?${E[b.MAINVERSION]}${E[b.PRERELEASE]}?${E[b.BUILD]}?`);k("FULL",`^${E[b.FULLPLAIN]}$`);k("LOOSEPLAIN",`[v=\\s]*${E[b.MAINVERSIONLOOSE]}${E[b.PRERELEASELOOSE]}?${E[b.BUILD]}?`);k("LOOSE",`^${E[b.LOOSEPLAIN]}$`);k("GTLT","((?:<|>)?=?)");k("XRANGEIDENTIFIERLOOSE",`${E[b.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);k("XRANGEIDENTIFIER",`${E[b.NUMERICIDENTIFIER]}|x|X|\\*`);k("XRANGEPLAIN",`[v=\\s]*(${E[b.XRANGEIDENTIFIER]})(?:\\.(${E[b.XRANGEIDENTIFIER]})(?:\\.(${E[b.XRANGEIDENTIFIER]})(?:${E[b.PRERELEASE]})?${E[b.BUILD]}?)?)?`);k("XRANGEPLAINLOOSE",`[v=\\s]*(${E[b.XRANGEIDENTIFIERLOOSE]})(?:\\.(${E[b.XRANGEIDENTIFIERLOOSE]})(?:\\.(${E[b.XRANGEIDENTIFIERLOOSE]})(?:${E[b.PRERELEASELOOSE]})?${E[b.BUILD]}?)?)?`);k("XRANGE",`^${E[b.GTLT]}\\s*${E[b.XRANGEPLAIN]}$`);k("XRANGELOOSE",`^${E[b.GTLT]}\\s*${E[b.XRANGEPLAINLOOSE]}$`);k("COERCEPLAIN",`(^|[^\\d])(\\d{1,${cn}})(?:\\.(\\d{1,${cn}}))?(?:\\.(\\d{1,${cn}}))?`);k("COERCE",`${E[b.COERCEPLAIN]}(?:$|[^\\d])`);k("COERCEFULL",E[b.COERCEPLAIN]+`(?:${E[b.PRERELEASE]})?(?:${E[b.BUILD]})?(?:$|[^\\d])`);k("COERCERTL",E[b.COERCE],!0);k("COERCERTLFULL",E[b.COERCEFULL],!0);k("LONETILDE","(?:~>?)");k("TILDETRIM",`(\\s*)${E[b.LONETILDE]}\\s+`,!0);he.tildeTrimReplace="$1~";k("TILDE",`^${E[b.LONETILDE]}${E[b.XRANGEPLAIN]}$`);k("TILDELOOSE",`^${E[b.LONETILDE]}${E[b.XRANGEPLAINLOOSE]}$`);k("LONECARET","(?:\\^)");k("CARETTRIM",`(\\s*)${E[b.LONECARET]}\\s+`,!0);he.caretTrimReplace="$1^";k("CARET",`^${E[b.LONECARET]}${E[b.XRANGEPLAIN]}$`);k("CARETLOOSE",`^${E[b.LONECARET]}${E[b.XRANGEPLAINLOOSE]}$`);k("COMPARATORLOOSE",`^${E[b.GTLT]}\\s*(${E[b.LOOSEPLAIN]})$|^$`);k("COMPARATOR",`^${E[b.GTLT]}\\s*(${E[b.FULLPLAIN]})$|^$`);k("COMPARATORTRIM",`(\\s*)${E[b.GTLT]}\\s*(${E[b.LOOSEPLAIN]}|${E[b.XRANGEPLAIN]})`,!0);he.comparatorTrimReplace="$1$2$3";k("HYPHENRANGE",`^\\s*(${E[b.XRANGEPLAIN]})\\s+-\\s+(${E[b.XRANGEPLAIN]})\\s*$`);k("HYPHENRANGELOOSE",`^\\s*(${E[b.XRANGEPLAINLOOSE]})\\s+-\\s+(${E[b.XRANGEPLAINLOOSE]})\\s*$`);k("STAR","(<|>)?=?\\s*\\*");k("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");k("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var qt=w((Pb,to)=>{"use strict";var gm=Object.freeze({loose:!0}),ym=Object.freeze({}),wm=r=>r?typeof r!="object"?gm:r:ym;to.exports=wm});var fn=w((Tb,io)=>{"use strict";var ro=/^[0-9]+$/,no=(r,e)=>{if(typeof r=="number"&&typeof e=="number")return r===e?0:r<e?-1:1;let t=ro.test(r),n=ro.test(e);return t&&n&&(r=+r,e=+e),r===e?0:t&&!n?-1:n&&!t?1:r<e?-1:1},Em=(r,e)=>no(e,r);io.exports={compareIdentifiers:no,rcompareIdentifiers:Em}});var Y=w((Ab,oo)=>{"use strict";var Gt=rt(),{MAX_LENGTH:so,MAX_SAFE_INTEGER:Ht}=Ve(),{safeRe:Wt,t:Vt}=Be(),bm=qt(),{compareIdentifiers:mn}=fn(),dn=class r{constructor(e,t){if(t=bm(t),e instanceof r){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>so)throw new TypeError(`version is longer than ${so} characters`);Gt("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let n=e.trim().match(t.loose?Wt[Vt.LOOSE]:Wt[Vt.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ht||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ht||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ht||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<Ht)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Gt("SemVer.compare",this.version,this.options,e),!(e instanceof r)){if(typeof e=="string"&&e===this.version)return 0;e=new r(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof r||(e=new r(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof r||(e=new r(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let n=this.prerelease[t],i=e.prerelease[t];if(Gt("prerelease compare",t,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return mn(n,i)}while(++t)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let t=0;do{let n=this.build[t],i=e.build[t];if(Gt("build compare",t,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return mn(n,i)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let i=`-${t}`.match(this.options.loose?Wt[Vt.PRERELEASELOOSE]:Wt[Vt.PRERELEASE]);if(!i||i[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(t===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(t){let s=[t,i];n===!1&&(s=[t]),mn(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};oo.exports=dn});var ve=w((Lb,lo)=>{"use strict";var ao=Y(),Rm=(r,e,t=!1)=>{if(r instanceof ao)return r;try{return new ao(r,e)}catch(n){if(!t)return null;throw n}};lo.exports=Rm});var uo=w((Mb,co)=>{"use strict";var $m=ve(),Sm=(r,e)=>{let t=$m(r,e);return t?t.version:null};co.exports=Sm});var mo=w((Ib,fo)=>{"use strict";var vm=ve(),xm=(r,e)=>{let t=vm(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};fo.exports=xm});var go=w((Nb,ho)=>{"use strict";var po=Y(),km=(r,e,t,n,i)=>{typeof t=="string"&&(i=n,n=t,t=void 0);try{return new po(r instanceof po?r.version:r,t).inc(e,n,i).version}catch{return null}};ho.exports=km});var Eo=w((Fb,wo)=>{"use strict";var yo=ve(),_m=(r,e)=>{let t=yo(r,null,!0),n=yo(e,null,!0),i=t.compare(n);if(i===0)return null;let s=i>0,o=s?t:n,a=s?n:t,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let u=l?"pre":"";return t.major!==n.major?u+"major":t.minor!==n.minor?u+"minor":t.patch!==n.patch?u+"patch":"prerelease"};wo.exports=_m});var Ro=w((Db,bo)=>{"use strict";var Cm=Y(),Om=(r,e)=>new Cm(r,e).major;bo.exports=Om});var So=w((Ub,$o)=>{"use strict";var Pm=Y(),Tm=(r,e)=>new Pm(r,e).minor;$o.exports=Tm});var xo=w((jb,vo)=>{"use strict";var Am=Y(),Lm=(r,e)=>new Am(r,e).patch;vo.exports=Lm});var _o=w((qb,ko)=>{"use strict";var Mm=ve(),Im=(r,e)=>{let t=Mm(r,e);return t&&t.prerelease.length?t.prerelease:null};ko.exports=Im});var se=w((Gb,Oo)=>{"use strict";var Co=Y(),Nm=(r,e,t)=>new Co(r,t).compare(new Co(e,t));Oo.exports=Nm});var To=w((Hb,Po)=>{"use strict";var Fm=se(),Dm=(r,e,t)=>Fm(e,r,t);Po.exports=Dm});var Lo=w((Wb,Ao)=>{"use strict";var Um=se(),jm=(r,e)=>Um(r,e,!0);Ao.exports=jm});var Bt=w((Vb,Io)=>{"use strict";var Mo=Y(),qm=(r,e,t)=>{let n=new Mo(r,t),i=new Mo(e,t);return n.compare(i)||n.compareBuild(i)};Io.exports=qm});var Fo=w((Bb,No)=>{"use strict";var Gm=Bt(),Hm=(r,e)=>r.sort((t,n)=>Gm(t,n,e));No.exports=Hm});var Uo=w((Yb,Do)=>{"use strict";var Wm=Bt(),Vm=(r,e)=>r.sort((t,n)=>Wm(n,t,e));Do.exports=Vm});var nt=w((Jb,jo)=>{"use strict";var Bm=se(),Ym=(r,e,t)=>Bm(r,e,t)>0;jo.exports=Ym});var Yt=w((zb,qo)=>{"use strict";var Jm=se(),zm=(r,e,t)=>Jm(r,e,t)<0;qo.exports=zm});var pn=w((Xb,Go)=>{"use strict";var Xm=se(),Km=(r,e,t)=>Xm(r,e,t)===0;Go.exports=Km});var hn=w((Kb,Ho)=>{"use strict";var Qm=se(),Zm=(r,e,t)=>Qm(r,e,t)!==0;Ho.exports=Zm});var Jt=w((Qb,Wo)=>{"use strict";var ed=se(),td=(r,e,t)=>ed(r,e,t)>=0;Wo.exports=td});var zt=w((Zb,Vo)=>{"use strict";var rd=se(),nd=(r,e,t)=>rd(r,e,t)<=0;Vo.exports=nd});var gn=w((eR,Bo)=>{"use strict";var id=pn(),sd=hn(),od=nt(),ad=Jt(),ld=Yt(),cd=zt(),ud=(r,e,t,n)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return id(r,t,n);case"!=":return sd(r,t,n);case">":return od(r,t,n);case">=":return ad(r,t,n);case"<":return ld(r,t,n);case"<=":return cd(r,t,n);default:throw new TypeError(`Invalid operator: ${e}`)}};Bo.exports=ud});var Jo=w((tR,Yo)=>{"use strict";var fd=Y(),md=ve(),{safeRe:Xt,t:Kt}=Be(),dd=(r,e)=>{if(r instanceof fd)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(e.includePrerelease?Xt[Kt.COERCEFULL]:Xt[Kt.COERCE]);else{let l=e.includePrerelease?Xt[Kt.COERCERTLFULL]:Xt[Kt.COERCERTL],c;for(;(c=l.exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||c.index+c[0].length!==t.index+t[0].length)&&(t=c),l.lastIndex=c.index+c[1].length+c[2].length;l.lastIndex=-1}if(t===null)return null;let n=t[2],i=t[3]||"0",s=t[4]||"0",o=e.includePrerelease&&t[5]?`-${t[5]}`:"",a=e.includePrerelease&&t[6]?`+${t[6]}`:"";return md(`${n}.${i}.${s}${o}${a}`,e)};Yo.exports=dd});var Xo=w((rR,zo)=>{"use strict";var pd=ve(),hd=Ve(),gd=Y(),yd=(r,e,t)=>{if(!hd.RELEASE_TYPES.includes(e))return null;let n=wd(r,t);return n&&Ed(n,e)},wd=(r,e)=>{let t=r instanceof gd?r.version:r;return pd(t,e)},Ed=(r,e)=>{if(bd(e))return r.version;switch(r.prerelease=[],e){case"major":r.minor=0,r.patch=0;break;case"minor":r.patch=0;break}return r.format()},bd=r=>r.startsWith("pre");zo.exports=yd});var Qo=w((nR,Ko)=>{"use strict";var yn=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,t)}return this}};Ko.exports=yn});var oe=w((iR,ra)=>{"use strict";var Rd=/\s+/g,wn=class r{constructor(e,t){if(t=Sd(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof En)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(Rd," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!ea(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Pd(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let n=0;n<t.length;n++)n>0&&(this.formatted+=" "),this.formatted+=t[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&Cd)|(this.options.loose&&Od))+":"+e,i=Zo.get(n);if(i)return i;let s=this.options.loose,o=s?K[z.HYPHENRANGELOOSE]:K[z.HYPHENRANGE];e=e.replace(o,jd(this.options.includePrerelease)),F("hyphen replace",e),e=e.replace(K[z.COMPARATORTRIM],xd),F("comparator trim",e),e=e.replace(K[z.TILDETRIM],kd),F("tilde trim",e),e=e.replace(K[z.CARETTRIM],_d),F("caret trim",e);let a=e.split(" ").map(f=>Td(f,this.options)).join(" ").split(/\s+/).map(f=>Ud(f,this.options));s&&(a=a.filter(f=>(F("loose invalid filter",f,this.options),!!f.match(K[z.COMPARATORLOOSE])))),F("range list",a);let l=new Map,c=a.map(f=>new En(f,this.options));for(let f of c){if(ea(f))return[f];l.set(f.value,f)}l.size>1&&l.has("")&&l.delete("");let u=[...l.values()];return Zo.set(n,u),u}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(n=>ta(n,t)&&e.set.some(i=>ta(i,t)&&n.every(s=>i.every(o=>s.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new vd(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(qd(this.set[t],e,this.options))return!0;return!1}};ra.exports=wn;var $d=Qo(),Zo=new $d,Sd=qt(),En=it(),F=rt(),vd=Y(),{safeRe:K,t:z,comparatorTrimReplace:xd,tildeTrimReplace:kd,caretTrimReplace:_d}=Be(),{FLAG_INCLUDE_PRERELEASE:Cd,FLAG_LOOSE:Od}=Ve(),ea=r=>r.value==="<0.0.0-0",Pd=r=>r.value==="",ta=(r,e)=>{let t=!0,n=r.slice(),i=n.pop();for(;t&&n.length;)t=n.every(s=>i.intersects(s,e)),i=n.pop();return t},Td=(r,e)=>(r=r.replace(K[z.BUILD],""),F("comp",r,e),r=Md(r,e),F("caret",r),r=Ad(r,e),F("tildes",r),r=Nd(r,e),F("xrange",r),r=Dd(r,e),F("stars",r),r),Q=r=>!r||r.toLowerCase()==="x"||r==="*",Ad=(r,e)=>r.trim().split(/\s+/).map(t=>Ld(t,e)).join(" "),Ld=(r,e)=>{let t=e.loose?K[z.TILDELOOSE]:K[z.TILDE];return r.replace(t,(n,i,s,o,a)=>{F("tilde",r,n,i,s,o,a);let l;return Q(i)?l="":Q(s)?l=`>=${i}.0.0 <${+i+1}.0.0-0`:Q(o)?l=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:a?(F("replaceTilde pr",a),l=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):l=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,F("tilde return",l),l})},Md=(r,e)=>r.trim().split(/\s+/).map(t=>Id(t,e)).join(" "),Id=(r,e)=>{F("caret",r,e);let t=e.loose?K[z.CARETLOOSE]:K[z.CARET],n=e.includePrerelease?"-0":"";return r.replace(t,(i,s,o,a,l)=>{F("caret",r,i,s,o,a,l);let c;return Q(s)?c="":Q(o)?c=`>=${s}.0.0${n} <${+s+1}.0.0-0`:Q(a)?s==="0"?c=`>=${s}.${o}.0${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${n} <${+s+1}.0.0-0`:l?(F("replaceCaret pr",l),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${l} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${l} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${l} <${+s+1}.0.0-0`):(F("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${n} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),F("caret return",c),c})},Nd=(r,e)=>(F("replaceXRanges",r,e),r.split(/\s+/).map(t=>Fd(t,e)).join(" ")),Fd=(r,e)=>{r=r.trim();let t=e.loose?K[z.XRANGELOOSE]:K[z.XRANGE];return r.replace(t,(n,i,s,o,a,l)=>{F("xRange",r,n,i,s,o,a,l);let c=Q(s),u=c||Q(o),f=u||Q(a),d=f;return i==="="&&d&&(i=""),l=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(u&&(o=0),a=0,i===">"?(i=">=",u?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",u?s=+s+1:o=+o+1),i==="<"&&(l="-0"),n=`${i+s}.${o}.${a}${l}`):u?n=`>=${s}.0.0${l} <${+s+1}.0.0-0`:f&&(n=`>=${s}.${o}.0${l} <${s}.${+o+1}.0-0`),F("xRange return",n),n})},Dd=(r,e)=>(F("replaceStars",r,e),r.trim().replace(K[z.STAR],"")),Ud=(r,e)=>(F("replaceGTE0",r,e),r.trim().replace(K[e.includePrerelease?z.GTE0PRE:z.GTE0],"")),jd=r=>(e,t,n,i,s,o,a,l,c,u,f,d)=>(Q(n)?t="":Q(i)?t=`>=${n}.0.0${r?"-0":""}`:Q(s)?t=`>=${n}.${i}.0${r?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,Q(c)?l="":Q(u)?l=`<${+c+1}.0.0-0`:Q(f)?l=`<${c}.${+u+1}.0-0`:d?l=`<=${c}.${u}.${f}-${d}`:r?l=`<${c}.${u}.${+f+1}-0`:l=`<=${l}`,`${t} ${l}`.trim()),qd=(r,e,t)=>{for(let n=0;n<r.length;n++)if(!r[n].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(let n=0;n<r.length;n++)if(F(r[n].semver),r[n].semver!==En.ANY&&r[n].semver.prerelease.length>0){let i=r[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var it=w((sR,la)=>{"use strict";var st=Symbol("SemVer ANY"),$n=class r{static get ANY(){return st}constructor(e,t){if(t=na(t),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Rn("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===st?this.value="":this.value=this.operator+this.semver.version,Rn("comp",this)}parse(e){let t=this.options.loose?ia[sa.COMPARATORLOOSE]:ia[sa.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new oa(n[2],this.options.loose):this.semver=st}toString(){return this.value}test(e){if(Rn("Comparator.test",e,this.options.loose),this.semver===st||e===st)return!0;if(typeof e=="string")try{e=new oa(e,this.options)}catch{return!1}return bn(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new aa(e.value,t).test(this.value):e.operator===""?e.value===""?!0:new aa(this.value,t).test(e.semver):(t=na(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||bn(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||bn(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};la.exports=$n;var na=qt(),{safeRe:ia,t:sa}=Be(),bn=gn(),Rn=rt(),oa=Y(),aa=oe()});var ot=w((oR,ca)=>{"use strict";var Gd=oe(),Hd=(r,e,t)=>{try{e=new Gd(e,t)}catch{return!1}return e.test(r)};ca.exports=Hd});var fa=w((aR,ua)=>{"use strict";var Wd=oe(),Vd=(r,e)=>new Wd(r,e).set.map(t=>t.map(n=>n.value).join(" ").trim().split(" "));ua.exports=Vd});var da=w((lR,ma)=>{"use strict";var Bd=Y(),Yd=oe(),Jd=(r,e,t)=>{let n=null,i=null,s=null;try{s=new Yd(e,t)}catch{return null}return r.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Bd(n,t))}),n};ma.exports=Jd});var ha=w((cR,pa)=>{"use strict";var zd=Y(),Xd=oe(),Kd=(r,e,t)=>{let n=null,i=null,s=null;try{s=new Xd(e,t)}catch{return null}return r.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new zd(n,t))}),n};pa.exports=Kd});var wa=w((uR,ya)=>{"use strict";var Sn=Y(),Qd=oe(),ga=nt(),Zd=(r,e)=>{r=new Qd(r,e);let t=new Sn("0.0.0");if(r.test(t)||(t=new Sn("0.0.0-0"),r.test(t)))return t;t=null;for(let n=0;n<r.set.length;++n){let i=r.set[n],s=null;i.forEach(o=>{let a=new Sn(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||ga(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!t||ga(t,s))&&(t=s)}return t&&r.test(t)?t:null};ya.exports=Zd});var ba=w((fR,Ea)=>{"use strict";var ep=oe(),tp=(r,e)=>{try{return new ep(r,e).range||"*"}catch{return null}};Ea.exports=tp});var Qt=w((mR,va)=>{"use strict";var rp=Y(),Sa=it(),{ANY:np}=Sa,ip=oe(),sp=ot(),Ra=nt(),$a=Yt(),op=zt(),ap=Jt(),lp=(r,e,t,n)=>{r=new rp(r,n),e=new ip(e,n);let i,s,o,a,l;switch(t){case">":i=Ra,s=op,o=$a,a=">",l=">=";break;case"<":i=$a,s=ap,o=Ra,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(sp(r,e,n))return!1;for(let c=0;c<e.set.length;++c){let u=e.set[c],f=null,d=null;if(u.forEach(p=>{p.semver===np&&(p=new Sa(">=0.0.0")),f=f||p,d=d||p,i(p.semver,f.semver,n)?f=p:o(p.semver,d.semver,n)&&(d=p)}),f.operator===a||f.operator===l||(!d.operator||d.operator===a)&&s(r,d.semver))return!1;if(d.operator===l&&o(r,d.semver))return!1}return!0};va.exports=lp});var ka=w((dR,xa)=>{"use strict";var cp=Qt(),up=(r,e,t)=>cp(r,e,">",t);xa.exports=up});var Ca=w((pR,_a)=>{"use strict";var fp=Qt(),mp=(r,e,t)=>fp(r,e,"<",t);_a.exports=mp});var Ta=w((hR,Pa)=>{"use strict";var Oa=oe(),dp=(r,e,t)=>(r=new Oa(r,t),e=new Oa(e,t),r.intersects(e,t));Pa.exports=dp});var La=w((gR,Aa)=>{"use strict";var pp=ot(),hp=se();Aa.exports=(r,e,t)=>{let n=[],i=null,s=null,o=r.sort((u,f)=>hp(u,f,t));for(let u of o)pp(u,e,t)?(s=u,i||(i=u)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);let a=[];for(let[u,f]of n)u===f?a.push(u):!f&&u===o[0]?a.push("*"):f?u===o[0]?a.push(`<=${f}`):a.push(`${u} - ${f}`):a.push(`>=${u}`);let l=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return l.length<c.length?l:e}});var Ua=w((yR,Da)=>{"use strict";var Ma=oe(),xn=it(),{ANY:vn}=xn,at=ot(),kn=se(),gp=(r,e,t={})=>{if(r===e)return!0;r=new Ma(r,t),e=new Ma(e,t);let n=!1;e:for(let i of r.set){for(let s of e.set){let o=wp(i,s,t);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},yp=[new xn(">=0.0.0-0")],Ia=[new xn(">=0.0.0")],wp=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===vn){if(e.length===1&&e[0].semver===vn)return!0;t.includePrerelease?r=yp:r=Ia}if(e.length===1&&e[0].semver===vn){if(t.includePrerelease)return!0;e=Ia}let n=new Set,i,s;for(let p of r)p.operator===">"||p.operator===">="?i=Na(i,p,t):p.operator==="<"||p.operator==="<="?s=Fa(s,p,t):n.add(p.semver);if(n.size>1)return null;let o;if(i&&s){if(o=kn(i.semver,s.semver,t),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let p of n){if(i&&!at(p,String(i),t)||s&&!at(p,String(s),t))return null;for(let y of e)if(!at(p,String(y),t))return!1;return!0}let a,l,c,u,f=s&&!t.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=i&&!t.includePrerelease&&i.semver.prerelease.length?i.semver:!1;f&&f.prerelease.length===1&&s.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let p of e){if(u=u||p.operator===">"||p.operator===">=",c=c||p.operator==="<"||p.operator==="<=",i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator===">"||p.operator===">="){if(a=Na(i,p,t),a===p&&a!==i)return!1}else if(i.operator===">="&&!at(i.semver,String(p),t))return!1}if(s){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator==="<"||p.operator==="<="){if(l=Fa(s,p,t),l===p&&l!==s)return!1}else if(s.operator==="<="&&!at(s.semver,String(p),t))return!1}if(!p.operator&&(s||i)&&o!==0)return!1}return!(i&&c&&!s&&o!==0||s&&u&&!i&&o!==0||d||f)},Na=(r,e,t)=>{if(!r)return e;let n=kn(r.semver,e.semver,t);return n>0?r:n<0||e.operator===">"&&r.operator===">="?e:r},Fa=(r,e,t)=>{if(!r)return e;let n=kn(r.semver,e.semver,t);return n<0?r:n>0||e.operator==="<"&&r.operator==="<="?e:r};Da.exports=gp});var Zt=w((wR,Ga)=>{"use strict";var _n=Be(),ja=Ve(),Ep=Y(),qa=fn(),bp=ve(),Rp=uo(),$p=mo(),Sp=go(),vp=Eo(),xp=Ro(),kp=So(),_p=xo(),Cp=_o(),Op=se(),Pp=To(),Tp=Lo(),Ap=Bt(),Lp=Fo(),Mp=Uo(),Ip=nt(),Np=Yt(),Fp=pn(),Dp=hn(),Up=Jt(),jp=zt(),qp=gn(),Gp=Jo(),Hp=Xo(),Wp=it(),Vp=oe(),Bp=ot(),Yp=fa(),Jp=da(),zp=ha(),Xp=wa(),Kp=ba(),Qp=Qt(),Zp=ka(),eh=Ca(),th=Ta(),rh=La(),nh=Ua();Ga.exports={parse:bp,valid:Rp,clean:$p,inc:Sp,diff:vp,major:xp,minor:kp,patch:_p,prerelease:Cp,compare:Op,rcompare:Pp,compareLoose:Tp,compareBuild:Ap,sort:Lp,rsort:Mp,gt:Ip,lt:Np,eq:Fp,neq:Dp,gte:Up,lte:jp,cmp:qp,coerce:Gp,truncate:Hp,Comparator:Wp,Range:Vp,satisfies:Bp,toComparators:Yp,maxSatisfying:Jp,minSatisfying:zp,minVersion:Xp,validRange:Kp,outside:Qp,gtr:Zp,ltr:eh,intersects:th,simplifyRange:rh,subset:nh,SemVer:Ep,re:_n.re,src:_n.src,tokens:_n.t,SEMVER_SPEC_VERSION:ja.SEMVER_SPEC_VERSION,RELEASE_TYPES:ja.RELEASE_TYPES,compareIdentifiers:qa.compareIdentifiers,rcompareIdentifiers:qa.rcompareIdentifiers}});var Wa=w((ER,Ha)=>{var ih=Zt();Ha.exports=ih.satisfies(process.version,">=15.7.0")});var Ba=w((bR,Va)=>{var sh=Zt();Va.exports=sh.satisfies(process.version,">=16.9.0")});var Cn=w((RR,Ya)=>{var oh=Wa(),ah=Ba(),lh={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},ch={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};Ya.exports=function(r,e){if(!r||!e)return;let t=e.asymmetricKeyType;if(!t)return;let n=lh[t];if(!n)throw new Error(`Unknown key type "${t}".`);if(!n.includes(r))throw new Error(`"alg" parameter for "${t}" key type must be one of: ${n.join(", ")}.`);if(oh)switch(t){case"ec":let i=e.asymmetricKeyDetails.namedCurve,s=ch[r];if(i!==s)throw new Error(`"alg" parameter "${r}" requires curve "${s}".`);break;case"rsa-pss":if(ah){let o=parseInt(r.slice(-3),10),{hashAlgorithm:a,mgf1HashAlgorithm:l,saltLength:c}=e.asymmetricKeyDetails;if(a!==`sha${o}`||l!==a)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${r}.`);if(c!==void 0&&c>o>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${r}.`)}break}}});var On=w(($R,Ja)=>{var uh=Zt();Ja.exports=uh.satisfies(process.version,"^6.12.0 || >=8.0.0")});var Ka=w((SR,Xa)=>{var N=tt(),fh=on(),za=an(),mh=sn(),dh=ln(),ph=Cn(),hh=On(),gh=Nt(),{KeyObject:yh,createSecretKey:wh,createPublicKey:Eh}=require("crypto"),Pn=["RS256","RS384","RS512"],bh=["ES256","ES384","ES512"],Tn=["RS256","RS384","RS512"],Rh=["HS256","HS384","HS512"];hh&&(Pn.splice(Pn.length,0,"PS256","PS384","PS512"),Tn.splice(Tn.length,0,"PS256","PS384","PS512"));Xa.exports=function(r,e,t,n){typeof t=="function"&&!n&&(n=t,t={}),t||(t={}),t=Object.assign({},t);let i;if(n?i=n:i=function(u,f){if(u)throw u;return f},t.clockTimestamp&&typeof t.clockTimestamp!="number")return i(new N("clockTimestamp must be a number"));if(t.nonce!==void 0&&(typeof t.nonce!="string"||t.nonce.trim()===""))return i(new N("nonce must be a non-empty string"));if(t.allowInvalidAsymmetricKeyTypes!==void 0&&typeof t.allowInvalidAsymmetricKeyTypes!="boolean")return i(new N("allowInvalidAsymmetricKeyTypes must be a boolean"));let s=t.clockTimestamp||Math.floor(Date.now()/1e3);if(!r)return i(new N("jwt must be provided"));if(typeof r!="string")return i(new N("jwt must be a string"));let o=r.split(".");if(o.length!==3)return i(new N("jwt malformed"));let a;try{a=mh(r,{complete:!0})}catch(u){return i(u)}if(!a)return i(new N("invalid token"));let l=a.header,c;if(typeof e=="function"){if(!n)return i(new N("verify must be called asynchronous if secret or public key is provided as a callback"));c=e}else c=function(u,f){return f(null,e)};return c(l,function(u,f){if(u)return i(new N("error in secret or public key callback: "+u.message));let d=o[2].trim()!=="";if(!d&&f)return i(new N("jwt signature is required"));if(d&&!f)return i(new N("secret or public key must be provided"));if(!d&&!t.algorithms)return i(new N('please specify "none" in "algorithms" to verify unsigned tokens'));if(f!=null&&!(f instanceof yh))try{f=Eh(f)}catch{try{f=wh(typeof f=="string"?Buffer.from(f):f)}catch{return i(new N("secretOrPublicKey is not valid key material"))}}if(t.algorithms||(f.type==="secret"?t.algorithms=Rh:["rsa","rsa-pss"].includes(f.asymmetricKeyType)?t.algorithms=Tn:f.asymmetricKeyType==="ec"?t.algorithms=bh:t.algorithms=Pn),t.algorithms.indexOf(a.header.alg)===-1)return i(new N("invalid algorithm"));if(l.alg.startsWith("HS")&&f.type!=="secret")return i(new N(`secretOrPublicKey must be a symmetric key when using ${l.alg}`));if(/^(?:RS|PS|ES)/.test(l.alg)&&f.type!=="public")return i(new N(`secretOrPublicKey must be an asymmetric key when using ${l.alg}`));if(!t.allowInvalidAsymmetricKeyTypes)try{ph(l.alg,f)}catch(R){return i(R)}let p;try{p=gh.verify(r,a.header.alg,f)}catch(R){return i(R)}if(!p)return i(new N("invalid signature"));let y=a.payload;if(typeof y.nbf<"u"&&!t.ignoreNotBefore){if(typeof y.nbf!="number")return i(new N("invalid nbf value"));if(y.nbf>s+(t.clockTolerance||0))return i(new fh("jwt not active",new Date(y.nbf*1e3)))}if(typeof y.exp<"u"&&!t.ignoreExpiration){if(typeof y.exp!="number")return i(new N("invalid exp value"));if(s>=y.exp+(t.clockTolerance||0))return i(new za("jwt expired",new Date(y.exp*1e3)))}if(t.audience){let R=Array.isArray(t.audience)?t.audience:[t.audience];if(!(Array.isArray(y.aud)?y.aud:[y.aud]).some(function($){return R.some(function(v){return v instanceof RegExp?v.test($):v===$})}))return i(new N("jwt audience invalid. expected: "+R.join(" or ")))}if(t.issuer&&(typeof t.issuer=="string"&&y.iss!==t.issuer||Array.isArray(t.issuer)&&t.issuer.indexOf(y.iss)===-1))return i(new N("jwt issuer invalid. expected: "+t.issuer));if(t.subject&&y.sub!==t.subject)return i(new N("jwt subject invalid. expected: "+t.subject));if(t.jwtid&&y.jti!==t.jwtid)return i(new N("jwt jwtid invalid. expected: "+t.jwtid));if(t.nonce&&y.nonce!==t.nonce)return i(new N("jwt nonce invalid. expected: "+t.nonce));if(t.maxAge){if(typeof y.iat!="number")return i(new N("iat required when maxAge is specified"));let R=dh(t.maxAge,y.iat);if(typeof R>"u")return i(new N('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(s>=R+(t.clockTolerance||0))return i(new za("maxAge exceeded",new Date(R*1e3)))}if(t.complete===!0){let R=a.signature;return i(null,{header:l,payload:y,signature:R})}return i(null,y)})}});var nl=w((vR,rl)=>{var Qa=1/0,el=9007199254740991,$h=17976931348623157e292,Za=NaN,Sh="[object Arguments]",vh="[object Function]",xh="[object GeneratorFunction]",kh="[object String]",_h="[object Symbol]",Ch=/^\s+|\s+$/g,Oh=/^[-+]0x[0-9a-f]+$/i,Ph=/^0b[01]+$/i,Th=/^0o[0-7]+$/i,Ah=/^(?:0|[1-9]\d*)$/,Lh=parseInt;function Mh(r,e){for(var t=-1,n=r?r.length:0,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}function Ih(r,e,t,n){for(var i=r.length,s=t+(n?1:-1);n?s--:++s<i;)if(e(r[s],s,r))return s;return-1}function Nh(r,e,t){if(e!==e)return Ih(r,Fh,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function Fh(r){return r!==r}function Dh(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}function Uh(r,e){return Mh(e,function(t){return r[t]})}function jh(r,e){return function(t){return r(e(t))}}var er=Object.prototype,Ln=er.hasOwnProperty,tr=er.toString,qh=er.propertyIsEnumerable,Gh=jh(Object.keys,Object),Hh=Math.max;function Wh(r,e){var t=tl(r)||zh(r)?Dh(r.length,String):[],n=t.length,i=!!n;for(var s in r)(e||Ln.call(r,s))&&!(i&&(s=="length"||Bh(s,n)))&&t.push(s);return t}function Vh(r){if(!Yh(r))return Gh(r);var e=[];for(var t in Object(r))Ln.call(r,t)&&t!="constructor"&&e.push(t);return e}function Bh(r,e){return e=e??el,!!e&&(typeof r=="number"||Ah.test(r))&&r>-1&&r%1==0&&r<e}function Yh(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||er;return r===t}function Jh(r,e,t,n){r=Mn(r)?r:sg(r),t=t&&!n?rg(t):0;var i=r.length;return t<0&&(t=Hh(i+t,0)),Zh(r)?t<=i&&r.indexOf(e,t)>-1:!!i&&Nh(r,e,t)>-1}function zh(r){return Xh(r)&&Ln.call(r,"callee")&&(!qh.call(r,"callee")||tr.call(r)==Sh)}var tl=Array.isArray;function Mn(r){return r!=null&&Qh(r.length)&&!Kh(r)}function Xh(r){return In(r)&&Mn(r)}function Kh(r){var e=An(r)?tr.call(r):"";return e==vh||e==xh}function Qh(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=el}function An(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function In(r){return!!r&&typeof r=="object"}function Zh(r){return typeof r=="string"||!tl(r)&&In(r)&&tr.call(r)==kh}function eg(r){return typeof r=="symbol"||In(r)&&tr.call(r)==_h}function tg(r){if(!r)return r===0?r:0;if(r=ng(r),r===Qa||r===-Qa){var e=r<0?-1:1;return e*$h}return r===r?r:0}function rg(r){var e=tg(r),t=e%1;return e===e?t?e-t:e:0}function ng(r){if(typeof r=="number")return r;if(eg(r))return Za;if(An(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=An(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(Ch,"");var t=Ph.test(r);return t||Th.test(r)?Lh(r.slice(2),t?2:8):Oh.test(r)?Za:+r}function ig(r){return Mn(r)?Wh(r):Vh(r)}function sg(r){return r?Uh(r,ig(r)):[]}rl.exports=Jh});var sl=w((xR,il)=>{var og="[object Boolean]",ag=Object.prototype,lg=ag.toString;function cg(r){return r===!0||r===!1||ug(r)&&lg.call(r)==og}function ug(r){return!!r&&typeof r=="object"}il.exports=cg});var ul=w((kR,cl)=>{var ol=1/0,fg=17976931348623157e292,al=NaN,mg="[object Symbol]",dg=/^\s+|\s+$/g,pg=/^[-+]0x[0-9a-f]+$/i,hg=/^0b[01]+$/i,gg=/^0o[0-7]+$/i,yg=parseInt,wg=Object.prototype,Eg=wg.toString;function bg(r){return typeof r=="number"&&r==vg(r)}function ll(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function Rg(r){return!!r&&typeof r=="object"}function $g(r){return typeof r=="symbol"||Rg(r)&&Eg.call(r)==mg}function Sg(r){if(!r)return r===0?r:0;if(r=xg(r),r===ol||r===-ol){var e=r<0?-1:1;return e*fg}return r===r?r:0}function vg(r){var e=Sg(r),t=e%1;return e===e?t?e-t:e:0}function xg(r){if(typeof r=="number")return r;if($g(r))return al;if(ll(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=ll(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(dg,"");var t=hg.test(r);return t||gg.test(r)?yg(r.slice(2),t?2:8):pg.test(r)?al:+r}cl.exports=bg});var ml=w((_R,fl)=>{var kg="[object Number]",_g=Object.prototype,Cg=_g.toString;function Og(r){return!!r&&typeof r=="object"}function Pg(r){return typeof r=="number"||Og(r)&&Cg.call(r)==kg}fl.exports=Pg});var gl=w((CR,hl)=>{var Tg="[object Object]";function Ag(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function Lg(r,e){return function(t){return r(e(t))}}var Mg=Function.prototype,dl=Object.prototype,pl=Mg.toString,Ig=dl.hasOwnProperty,Ng=pl.call(Object),Fg=dl.toString,Dg=Lg(Object.getPrototypeOf,Object);function Ug(r){return!!r&&typeof r=="object"}function jg(r){if(!Ug(r)||Fg.call(r)!=Tg||Ag(r))return!1;var e=Dg(r);if(e===null)return!0;var t=Ig.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&pl.call(t)==Ng}hl.exports=jg});var wl=w((OR,yl)=>{var qg="[object String]",Gg=Object.prototype,Hg=Gg.toString,Wg=Array.isArray;function Vg(r){return!!r&&typeof r=="object"}function Bg(r){return typeof r=="string"||!Wg(r)&&Vg(r)&&Hg.call(r)==qg}yl.exports=Bg});var Sl=w((PR,$l)=>{var Yg="Expected a function",El=1/0,Jg=17976931348623157e292,bl=NaN,zg="[object Symbol]",Xg=/^\s+|\s+$/g,Kg=/^[-+]0x[0-9a-f]+$/i,Qg=/^0b[01]+$/i,Zg=/^0o[0-7]+$/i,ey=parseInt,ty=Object.prototype,ry=ty.toString;function ny(r,e){var t;if(typeof e!="function")throw new TypeError(Yg);return r=ly(r),function(){return--r>0&&(t=e.apply(this,arguments)),r<=1&&(e=void 0),t}}function iy(r){return ny(2,r)}function Rl(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function sy(r){return!!r&&typeof r=="object"}function oy(r){return typeof r=="symbol"||sy(r)&&ry.call(r)==zg}function ay(r){if(!r)return r===0?r:0;if(r=cy(r),r===El||r===-El){var e=r<0?-1:1;return e*Jg}return r===r?r:0}function ly(r){var e=ay(r),t=e%1;return e===e?t?e-t:e:0}function cy(r){if(typeof r=="number")return r;if(oy(r))return bl;if(Rl(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Rl(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(Xg,"");var t=Qg.test(r);return t||Zg.test(r)?ey(r.slice(2),t?2:8):Kg.test(r)?bl:+r}$l.exports=iy});var Al=w((TR,Tl)=>{var vl=ln(),uy=On(),fy=Cn(),xl=Nt(),my=nl(),rr=sl(),kl=ul(),Nn=ml(),Cl=gl(),xe=wl(),dy=Sl(),{KeyObject:py,createSecretKey:hy,createPrivateKey:gy}=require("crypto"),Ol=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];uy&&Ol.splice(3,0,"PS256","PS384","PS512");var yy={expiresIn:{isValid:function(r){return kl(r)||xe(r)&&r},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(r){return kl(r)||xe(r)&&r},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(r){return xe(r)||Array.isArray(r)},message:'"audience" must be a string or array'},algorithm:{isValid:my.bind(null,Ol),message:'"algorithm" must be a valid string enum value'},header:{isValid:Cl,message:'"header" must be an object'},encoding:{isValid:xe,message:'"encoding" must be a string'},issuer:{isValid:xe,message:'"issuer" must be a string'},subject:{isValid:xe,message:'"subject" must be a string'},jwtid:{isValid:xe,message:'"jwtid" must be a string'},noTimestamp:{isValid:rr,message:'"noTimestamp" must be a boolean'},keyid:{isValid:xe,message:'"keyid" must be a string'},mutatePayload:{isValid:rr,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:rr,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:rr,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},wy={iat:{isValid:Nn,message:'"iat" should be a number of seconds'},exp:{isValid:Nn,message:'"exp" should be a number of seconds'},nbf:{isValid:Nn,message:'"nbf" should be a number of seconds'}};function Pl(r,e,t,n){if(!Cl(t))throw new Error('Expected "'+n+'" to be a plain object.');Object.keys(t).forEach(function(i){let s=r[i];if(!s){if(!e)throw new Error('"'+i+'" is not allowed in "'+n+'"');return}if(!s.isValid(t[i]))throw new Error(s.message)})}function Ey(r){return Pl(yy,!1,r,"options")}function by(r){return Pl(wy,!0,r,"payload")}var _l={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},Ry=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];Tl.exports=function(r,e,t,n){typeof t=="function"?(n=t,t={}):t=t||{};let i=typeof r=="object"&&!Buffer.isBuffer(r),s=Object.assign({alg:t.algorithm||"HS256",typ:i?"JWT":void 0,kid:t.keyid},t.header);function o(c){if(n)return n(c);throw c}if(!e&&t.algorithm!=="none")return o(new Error("secretOrPrivateKey must have a value"));if(e!=null&&!(e instanceof py))try{e=gy(e)}catch{try{e=hy(typeof e=="string"?Buffer.from(e):e)}catch{return o(new Error("secretOrPrivateKey is not valid key material"))}}if(s.alg.startsWith("HS")&&e.type!=="secret")return o(new Error(`secretOrPrivateKey must be a symmetric key when using ${s.alg}`));if(/^(?:RS|PS|ES)/.test(s.alg)){if(e.type!=="private")return o(new Error(`secretOrPrivateKey must be an asymmetric key when using ${s.alg}`));if(!t.allowInsecureKeySizes&&!s.alg.startsWith("ES")&&e.asymmetricKeyDetails!==void 0&&e.asymmetricKeyDetails.modulusLength<2048)return o(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`))}if(typeof r>"u")return o(new Error("payload is required"));if(i){try{by(r)}catch(c){return o(c)}t.mutatePayload||(r=Object.assign({},r))}else{let c=Ry.filter(function(u){return typeof t[u]<"u"});if(c.length>0)return o(new Error("invalid "+c.join(",")+" option for "+typeof r+" payload"))}if(typeof r.exp<"u"&&typeof t.expiresIn<"u")return o(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof r.nbf<"u"&&typeof t.notBefore<"u")return o(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{Ey(t)}catch(c){return o(c)}if(!t.allowInvalidAsymmetricKeyTypes)try{fy(s.alg,e)}catch(c){return o(c)}let a=r.iat||Math.floor(Date.now()/1e3);if(t.noTimestamp?delete r.iat:i&&(r.iat=a),typeof t.notBefore<"u"){try{r.nbf=vl(t.notBefore,a)}catch(c){return o(c)}if(typeof r.nbf>"u")return o(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof t.expiresIn<"u"&&typeof r=="object"){try{r.exp=vl(t.expiresIn,a)}catch(c){return o(c)}if(typeof r.exp>"u")return o(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(_l).forEach(function(c){let u=_l[c];if(typeof t[c]<"u"){if(typeof r[u]<"u")return o(new Error('Bad "options.'+c+'" option. The payload already has an "'+u+'" property.'));r[u]=t[c]}});let l=t.encoding||"utf8";if(typeof n=="function")n=n&&dy(n),xl.createSign({header:s,privateKey:e,payload:r,encoding:l}).once("error",n).once("done",function(c){if(!t.allowInsecureKeySizes&&/^(?:RS|PS)/.test(s.alg)&&c.length<256)return n(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`));n(null,c)});else{let c=xl.sign({header:s,payload:r,secret:e,encoding:l});if(!t.allowInsecureKeySizes&&/^(?:RS|PS)/.test(s.alg)&&c.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`);return c}}});var Fn=w((AR,Ll)=>{Ll.exports={decode:sn(),verify:Ka(),sign:Al(),JsonWebTokenError:tt(),NotBeforeError:on(),TokenExpiredError:an()}});var bc=w((uS,Ec)=>{function mc(r){return Array.isArray(r)?r:[r]}var ii="",dc=" ",ri="\\",ww=/^\s+$/,Ew=/(?:[^\\]|^)\\$/,bw=/^\\!/,Rw=/^\\#/,$w=/\r?\n/g,Sw=/^\.*\/|^\.+$/,ni="/",gc="node-ignore";typeof Symbol<"u"&&(gc=Symbol.for("node-ignore"));var pc=gc,vw=(r,e,t)=>Object.defineProperty(r,e,{value:t}),xw=/([0-z])-([0-z])/g,yc=()=>!1,kw=r=>r.replace(xw,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:ii),_w=r=>{let{length:e}=r;return r.slice(0,e-e%2)},Cw=[[/^\uFEFF/,()=>ii],[/((?:\\\\)*?)(\\?\s+)$/,(r,e,t)=>e+(t.indexOf("\\")===0?dc:ii)],[/(\\+?)\s/g,(r,e)=>{let{length:t}=e;return e.slice(0,t-t%2)+dc}],[/[\\$.|*+(){^]/g,r=>`\\${r}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(r,e,t)=>e+6<t.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(r,e,t)=>{let n=t.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>ri],[/\\\\/g,()=>ri],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(r,e,t,n,i)=>e===ri?`\\[${t}${_w(n)}${i}`:i==="]"&&n.length%2===0?`[${kw(t)}${n}]`:"[]"],[/(?:[^*])$/,r=>/\/$/.test(r)?`${r}$`:`${r}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(r,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],hc=Object.create(null),Ow=(r,e)=>{let t=hc[r];return t||(t=Cw.reduce((n,[i,s])=>n.replace(i,s.bind(r)),r),hc[r]=t),e?new RegExp(t,"i"):new RegExp(t)},ai=r=>typeof r=="string",Pw=r=>r&&ai(r)&&!ww.test(r)&&!Ew.test(r)&&r.indexOf("#")!==0,Tw=r=>r.split($w),si=class{constructor(e,t,n,i){this.origin=e,this.pattern=t,this.negative=n,this.regex=i}},Aw=(r,e)=>{let t=r,n=!1;r.indexOf("!")===0&&(n=!0,r=r.substr(1)),r=r.replace(bw,"!").replace(Rw,"#");let i=Ow(r,e);return new si(t,r,n,i)},Lw=(r,e)=>{throw new e(r)},$e=(r,e,t)=>ai(r)?r?$e.isNotRelative(r)?t(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:t("path must not be empty",TypeError):t(`path must be a string, but got \`${e}\``,TypeError),wc=r=>Sw.test(r);$e.isNotRelative=wc;$e.convert=r=>r;var oi=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){vw(this,pc,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[pc]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(Pw(e)){let t=Aw(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,mc(ai(e)?Tw(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,i=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(i===o&&n!==i||o&&!n&&!i&&!t)return;s.regex.test(e)&&(n=!o,i=o)}),{ignored:n,unignored:i}}_test(e,t,n,i){let s=e&&$e.convert(e);return $e(s,e,this._allowRelativePaths?yc:Lw),this._t(s,t,n,i)}_t(e,t,n,i){if(e in t)return t[e];if(i||(i=e.split(ni)),i.pop(),!i.length)return t[e]=this._testOne(e,n);let s=this._t(i.join(ni)+ni,t,n,i);return t[e]=s.ignored?s:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return mc(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},gr=r=>new oi(r),Mw=r=>$e(r&&$e.convert(r),r,yc);gr.isPathValid=Mw;gr.default=gr;Ec.exports=gr;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let r=t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/");$e.convert=r;let e=/^[a-z]:\//i;$e.isNotRelative=t=>e.test(t)||wc(t)}});(function(){ji().config(Object.assign({},Gi(),Wi()(process.argv)))})();var vu=require("fs"),xu=require("path");var $u=T(kt());var ue=T(require("fs")),Wn=T(require("path")),Ul=T(require("os")),jl=T(Fn());var $y=process.stdout.isTTY===!0&&!process.env.NO_COLOR,ke=r=>$y?r:"",S=ke("\x1B[32m"),A=ke("\x1B[33m"),_=ke("\x1B[36m"),ae=ke("\x1B[35m"),h=ke("\x1B[31m"),g=ke("\x1B[2m"),ee=ke("\x1B[1m"),m=ke("\x1B[0m");var Ml="app.boxel.realms";var Sy={"anthropic/claude-3.5-sonnet":"Anthropic: Claude 3.5 Sonnet","anthropic/claude-3.7-sonnet":"Anthropic: Claude 3.7 Sonnet","anthropic/claude-3.7-sonnet:thinking":"Anthropic: Claude 3.7 Sonnet (thinking)","anthropic/claude-haiku-4.5":"Anthropic: Claude Haiku 4.5","anthropic/claude-sonnet-4":"Anthropic: Claude Sonnet 4","anthropic/claude-sonnet-4.5":"Anthropic: Claude Sonnet 4.5","anthropic/claude-sonnet-4.6":"Anthropic: Claude Sonnet 4.6","anthropic/claude-opus-4.1":"Anthropic: Claude Opus 4.1","deepseek/deepseek-chat-v3-0324":"DeepSeek: DeepSeek V3 0324","google/gemini-2.5-pro":"Google: Gemini 2.5 Pro","google/gemini-2.5-flash-lite":"Google: Gemini 2.5 Flash Lite","google/gemini-2.5-flash":"Google: Gemini 2.5 Flash","meta-llama/llama-3.2-3b-instruct":"Meta: Llama 3.2 3B Instruct","openai/gpt-4.1-nano":"OpenAI: GPT-4.1 Nano","openai/gpt-4.1-mini":"OpenAI: GPT-4.1 Mini","openai/gpt-4.1":"OpenAI: GPT-4.1","openai/gpt-4o":"OpenAI: GPT-4o","openai/gpt-4o-mini":"OpenAI: GPT-4o-mini","openai/gpt-5-nano":"OpenAI: GPT-5 Nano","openai/gpt-5-mini":"OpenAI: GPT-5 Mini","openai/gpt-5":"OpenAI: GPT-5","openai/gpt-oss-20b":"OpenAI: GPT OSS 20B"},MR=Object.keys(Sy);function x(r){return r.endsWith("/")?r:`${r}/`}var Re=class extends Error{status;constructor(e,t){super(t),this.name="MatrixAuthError",this.status=e}};async function Il(r,e,t){let n=await fetch(new URL("_matrix/client/v3/login",r).href,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:{type:"m.id.user",user:e},password:t,type:"m.login.password"})}),i=await n.json();if(!n.ok)throw new Error(`Matrix login failed: ${n.status} ${JSON.stringify(i)}`);return{accessToken:i.access_token,deviceId:i.device_id,userId:i.user_id,matrixUrl:r}}async function vy(r){let e=await fetch(new URL(`_matrix/client/v3/user/${encodeURIComponent(r.userId)}/openid/request_token`,r.matrixUrl).href,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.accessToken}`},body:"{}"});if(!e.ok){let t=await e.text();throw e.status===401||e.status===403?new Re(e.status,`OpenID token request failed: ${e.status} ${t}`):new Error(`OpenID token request failed: ${e.status} ${t}`)}return await e.json()}async function Dn(r,e){let t=await vy(r),n=`${e.replace(/\/$/,"")}/_server-session`,i=await fetch(n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok){let o=await i.text();throw new Error(`Realm server session failed: ${i.status} ${o}`)}let s=i.headers.get("Authorization");if(!s)throw new Error("Realm server session response did not include an Authorization header");return s}async function Un(r,e){let t=`${r.replace(/\/$/,"")}/_realm-auth`,n=await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:e}});if(!n.ok){let i=await n.text();throw new Error(`Realm auth lookup failed: ${n.status} ${i}`)}return await n.json()}function jn(r){return new URL(`_matrix/client/v3/user/${encodeURIComponent(r.userId)}/account_data/${Ml}`,r.matrixUrl).href}async function nr(r){let e;try{e=await fetch(jn(r),{headers:{Authorization:`Bearer ${r.accessToken}`}})}catch{return[]}if(e.status===401||e.status===403){let t=await e.text();throw new Re(e.status,`Matrix account_data fetch failed: ${e.status} ${t}`)}if(!e.ok)return[];try{let t=await e.json();return Array.isArray(t.realms)?[...t.realms]:[]}catch{return[]}}async function Nl(r,e){let t=await nr(r);if(!t.includes(e)){t.push(e);let n=await fetch(jn(r),{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.accessToken}`},body:JSON.stringify({realms:t})});if(!n.ok){let i=await n.text();throw n.status===401||n.status===403?new Re(n.status,`Failed to update Matrix account data: ${n.status} ${i}`):new Error(`Failed to update Matrix account data: ${n.status} ${i}`)}}}async function Fl(r,e){let t=x(e),n=await nr(r),i=n.filter(o=>x(o)!==t);if(i.length===n.length)return!1;let s=await fetch(jn(r),{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.accessToken}`},body:JSON.stringify({realms:i})});if(!s.ok){let o=await s.text();throw s.status===401||s.status===403?new Re(s.status,`Failed to update Matrix account data: ${s.status} ${o}`):new Error(`Failed to update Matrix account data: ${s.status} ${o}`)}return!0}var qn=T(require("readline")),Dl=require("stream");function te(r){let e=qn.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{e.question(r,n=>{e.close(),t(n.trim())})})}function lt(r){let e=new Dl.Writable({write:(n,i,s)=>s()}),t=qn.createInterface({input:process.stdin,output:e,terminal:!0});return new Promise((n,i)=>{let s=process.stdin,o=s.readableFlowing;s.isTTY&&s.setRawMode(!0);let a=()=>{s.removeListener("data",l),s.isTTY&&s.setRawMode(!1),t.close(),o||s.pause()},l=u=>{try{let f=u.toString().split("\x1B[200~").join("").split("\x1B[201~").join("");for(let d of f)if(d===`
|
|
31
|
+
"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,rt="secret must be a string or buffer",qe="key must be a string or a buffer",ju="key must be a string, a buffer or an object",ir=typeof se.createPublicKey=="function";ir&&(qe+=" or a KeyObject",rt+="or a KeyObject");function Es(i){if(!Ge.isBuffer(i)&&typeof i!="string"&&(!ir||typeof i!="object"||typeof i.type!="string"||typeof i.asymmetricKeyType!="string"||typeof i.export!="function"))throw pe(qe)}function Rs(i){if(!Ge.isBuffer(i)&&typeof i!="string"&&typeof i!="object")throw pe(ju)}function Mu(i){if(!Ge.isBuffer(i)){if(typeof i=="string")return i;if(!ir||typeof i!="object"||i.type!=="secret"||typeof i.export!="function")throw pe(rt)}}function rr(i){return i.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function $s(i){i=i.toString();var e=4-i.length%4;if(e!==4)for(var t=0;t<e;++t)i+="=";return i.replace(/\-/g,"+").replace(/_/g,"/")}function pe(i){var e=[].slice.call(arguments,1),t=ys.format.bind(ys,i).apply(null,e);return new TypeError(t)}function Iu(i){return Ge.isBuffer(i)||typeof i=="string"}function nt(i){return Iu(i)||(i=JSON.stringify(i)),i}function ks(i){return function(t,r){Mu(r),t=nt(t);var n=se.createHmac("sha"+i,r),s=(n.update(t),n.digest("base64"));return rr(s)}}var tr,Nu="timingSafeEqual"in se?function(e,t){return e.byteLength!==t.byteLength?!1:se.timingSafeEqual(e,t)}:function(e,t){return tr||(tr=bs()),tr(e,t)};function Fu(i){return function(t,r,n){var s=ks(i)(t,n);return Nu(Ge.from(r),Ge.from(s))}}function Ss(i){return function(t,r){Rs(r),t=nt(t);var n=se.createSign("RSA-SHA"+i),s=(n.update(t),n.sign(r,"base64"));return rr(s)}}function _s(i){return function(t,r,n){Es(n),t=nt(t),r=$s(r);var s=se.createVerify("RSA-SHA"+i);return s.update(t),s.verify(n,r,"base64")}}function Uu(i){return function(t,r){Rs(r),t=nt(t);var n=se.createSign("RSA-SHA"+i),s=(n.update(t),n.sign({key:r,padding:se.constants.RSA_PKCS1_PSS_PADDING,saltLength:se.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return rr(s)}}function Du(i){return function(t,r,n){Es(n),t=nt(t),r=$s(r);var s=se.createVerify("RSA-SHA"+i);return s.update(t),s.verify({key:n,padding:se.constants.RSA_PKCS1_PSS_PADDING,saltLength:se.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function qu(i){var e=Ss(i);return function(){var r=e.apply(null,arguments);return r=ws.derToJose(r,"ES"+i),r}}function Gu(i){var e=_s(i);return function(r,n,s){n=ws.joseToDer(n,"ES"+i).toString("base64");var o=e(r,n,s);return o}}function Hu(){return function(){return""}}function Wu(){return function(e,t){return t===""}}Cs.exports=function(e){var t={hs:ks,rs:Ss,ps:Uu,es:qu,none:Hu},r={hs:Fu,rs:_s,ps:Du,es:Gu,none:Wu},n=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!n)throw pe(Lu,e);var s=(n[1]||n[3]).toLowerCase(),o=n[2];return{sign:t[s](o),verify:r[s](o)}}});var sr=v((Uy,Os)=>{var Vu=require("buffer").Buffer;Os.exports=function(e){return typeof e=="string"?e:typeof e=="number"||Vu.isBuffer(e)?e.toString():JSON.stringify(e)}});var Ms=v((Dy,js)=>{var Bu=De().Buffer,Ts=Qi(),zu=nr(),Yu=require("stream"),Ps=sr(),or=require("util");function As(i,e){return Bu.from(i,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ju(i,e,t){t=t||"utf8";var r=As(Ps(i),"binary"),n=As(Ps(e),t);return or.format("%s.%s",r,n)}function Ls(i){var e=i.header,t=i.payload,r=i.secret||i.privateKey,n=i.encoding,s=zu(e.alg),o=Ju(e,t,n),a=s.sign(o,r);return or.format("%s.%s",o,a)}function It(i){var e=i.secret;if(e=e??i.privateKey,e=e??i.key,/^hs/i.test(i.header.alg)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var t=new Ts(e);this.readable=!0,this.header=i.header,this.encoding=i.encoding,this.secret=this.privateKey=this.key=t,this.payload=new Ts(i.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}or.inherits(It,Yu);It.prototype.sign=function(){try{var e=Ls({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}};It.sign=Ls;js.exports=It});var Vs=v((qy,Ws)=>{var Ns=De().Buffer,Is=Qi(),Xu=nr(),Ku=require("stream"),Fs=sr(),Qu=require("util"),Zu=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function em(i){return Object.prototype.toString.call(i)==="[object Object]"}function tm(i){if(em(i))return i;try{return JSON.parse(i)}catch{return}}function Us(i){var e=i.split(".",1)[0];return tm(Ns.from(e,"base64").toString("binary"))}function im(i){return i.split(".",2).join(".")}function Ds(i){return i.split(".")[2]}function rm(i,e){e=e||"utf8";var t=i.split(".")[1];return Ns.from(t,"base64").toString(e)}function qs(i){return Zu.test(i)&&!!Us(i)}function Gs(i,e,t){if(!e){var r=new Error("Missing algorithm parameter for jws.verify");throw r.code="MISSING_ALGORITHM",r}i=Fs(i);var n=Ds(i),s=im(i),o=Xu(e);return o.verify(s,n,t)}function Hs(i,e){if(e=e||{},i=Fs(i),!qs(i))return null;var t=Us(i);if(!t)return null;var r=rm(i);return(t.typ==="JWT"||e.json)&&(r=JSON.parse(r,e.encoding)),{header:t,payload:r,signature:Ds(i)}}function He(i){i=i||{};var e=i.secret;if(e=e??i.publicKey,e=e??i.key,/^hs/i.test(i.algorithm)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var t=new Is(e);this.readable=!0,this.algorithm=i.algorithm,this.encoding=i.encoding,this.secret=this.publicKey=this.key=t,this.signature=new Is(i.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}Qu.inherits(He,Ku);He.prototype.verify=function(){try{var e=Gs(this.signature.buffer,this.algorithm,this.key.buffer),t=Hs(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}};He.decode=Hs;He.isValid=qs;He.verify=Gs;Ws.exports=He});var Ft=v(ke=>{var Bs=Ms(),Nt=Vs(),nm=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];ke.ALGORITHMS=nm;ke.sign=Bs.sign;ke.verify=Nt.verify;ke.decode=Nt.decode;ke.isValid=Nt.isValid;ke.createSign=function(e){return new Bs(e)};ke.createVerify=function(e){return new Nt(e)}});var ar=v((Hy,zs)=>{var sm=Ft();zs.exports=function(i,e){e=e||{};var t=sm.decode(i,e);if(!t)return null;var r=t.payload;if(typeof r=="string")try{var n=JSON.parse(r);n!==null&&typeof n=="object"&&(r=n)}catch{}return e.complete===!0?{header:t.header,payload:r,signature:t.signature}:r}});var st=v((Wy,Ys)=>{var Ut=function(i,e){Error.call(this,i),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=i,e&&(this.inner=e)};Ut.prototype=Object.create(Error.prototype);Ut.prototype.constructor=Ut;Ys.exports=Ut});var cr=v((Vy,Xs)=>{var Js=st(),Dt=function(i,e){Js.call(this,i),this.name="NotBeforeError",this.date=e};Dt.prototype=Object.create(Js.prototype);Dt.prototype.constructor=Dt;Xs.exports=Dt});var lr=v((By,Qs)=>{var Ks=st(),qt=function(i,e){Ks.call(this,i),this.name="TokenExpiredError",this.expiredAt=e};qt.prototype=Object.create(Ks.prototype);qt.prototype.constructor=qt;Qs.exports=qt});var eo=v((zy,Zs)=>{var We=1e3,Ve=We*60,Be=Ve*60,je=Be*24,om=je*7,am=je*365.25;Zs.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return cm(i);if(t==="number"&&isFinite(i))return e.long?pm(i):lm(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function cm(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*am;case"weeks":case"week":case"w":return t*om;case"days":case"day":case"d":return t*je;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Be;case"minutes":case"minute":case"mins":case"min":case"m":return t*Ve;case"seconds":case"second":case"secs":case"sec":case"s":return t*We;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function lm(i){var e=Math.abs(i);return e>=je?Math.round(i/je)+"d":e>=Be?Math.round(i/Be)+"h":e>=Ve?Math.round(i/Ve)+"m":e>=We?Math.round(i/We)+"s":i+"ms"}function pm(i){var e=Math.abs(i);return e>=je?Gt(i,e,je,"day"):e>=Be?Gt(i,e,Be,"hour"):e>=Ve?Gt(i,e,Ve,"minute"):e>=We?Gt(i,e,We,"second"):i+" ms"}function Gt(i,e,t,r){var n=e>=t*1.5;return Math.round(i/t)+" "+r+(n?"s":"")}});var pr=v((Yy,to)=>{var um=eo();to.exports=function(i,e){var t=e||Math.floor(Date.now()/1e3);if(typeof i=="string"){var r=um(i);return typeof r>"u"?void 0:Math.floor(t+r/1e3)}else return typeof i=="number"?t+i:void 0}});var ze=v((Jy,io)=>{"use strict";var mm="2.0.0",dm=Number.MAX_SAFE_INTEGER||9007199254740991,fm=16,hm=250,gm=["major","premajor","minor","preminor","patch","prepatch","prerelease"];io.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:fm,MAX_SAFE_BUILD_LENGTH:hm,MAX_SAFE_INTEGER:dm,RELEASE_TYPES:gm,SEMVER_SPEC_VERSION:mm,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var ot=v((Xy,ro)=>{"use strict";var xm=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...i)=>console.error("SEMVER",...i):()=>{};ro.exports=xm});var Ye=v((ge,no)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:ur,MAX_SAFE_BUILD_LENGTH:vm,MAX_LENGTH:bm}=ze(),ym=ot();ge=no.exports={};var wm=ge.re=[],Em=ge.safeRe=[],b=ge.src=[],Rm=ge.safeSrc=[],y=ge.t={},$m=0,mr="[a-zA-Z0-9-]",km=[["\\s",1],["\\d",bm],[mr,vm]],Sm=i=>{for(let[e,t]of km)i=i.split(`${e}*`).join(`${e}{0,${t}}`).split(`${e}+`).join(`${e}{1,${t}}`);return i},S=(i,e,t)=>{let r=Sm(e),n=$m++;ym(i,n,e),y[i]=n,b[n]=e,Rm[n]=r,wm[n]=new RegExp(e,t?"g":void 0),Em[n]=new RegExp(r,t?"g":void 0)};S("NUMERICIDENTIFIER","0|[1-9]\\d*");S("NUMERICIDENTIFIERLOOSE","\\d+");S("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${mr}*`);S("MAINVERSION",`(${b[y.NUMERICIDENTIFIER]})\\.(${b[y.NUMERICIDENTIFIER]})\\.(${b[y.NUMERICIDENTIFIER]})`);S("MAINVERSIONLOOSE",`(${b[y.NUMERICIDENTIFIERLOOSE]})\\.(${b[y.NUMERICIDENTIFIERLOOSE]})\\.(${b[y.NUMERICIDENTIFIERLOOSE]})`);S("PRERELEASEIDENTIFIER",`(?:${b[y.NONNUMERICIDENTIFIER]}|${b[y.NUMERICIDENTIFIER]})`);S("PRERELEASEIDENTIFIERLOOSE",`(?:${b[y.NONNUMERICIDENTIFIER]}|${b[y.NUMERICIDENTIFIERLOOSE]})`);S("PRERELEASE",`(?:-(${b[y.PRERELEASEIDENTIFIER]}(?:\\.${b[y.PRERELEASEIDENTIFIER]})*))`);S("PRERELEASELOOSE",`(?:-?(${b[y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[y.PRERELEASEIDENTIFIERLOOSE]})*))`);S("BUILDIDENTIFIER",`${mr}+`);S("BUILD",`(?:\\+(${b[y.BUILDIDENTIFIER]}(?:\\.${b[y.BUILDIDENTIFIER]})*))`);S("FULLPLAIN",`v?${b[y.MAINVERSION]}${b[y.PRERELEASE]}?${b[y.BUILD]}?`);S("FULL",`^${b[y.FULLPLAIN]}$`);S("LOOSEPLAIN",`[v=\\s]*${b[y.MAINVERSIONLOOSE]}${b[y.PRERELEASELOOSE]}?${b[y.BUILD]}?`);S("LOOSE",`^${b[y.LOOSEPLAIN]}$`);S("GTLT","((?:<|>)?=?)");S("XRANGEIDENTIFIERLOOSE",`${b[y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);S("XRANGEIDENTIFIER",`${b[y.NUMERICIDENTIFIER]}|x|X|\\*`);S("XRANGEPLAIN",`[v=\\s]*(${b[y.XRANGEIDENTIFIER]})(?:\\.(${b[y.XRANGEIDENTIFIER]})(?:\\.(${b[y.XRANGEIDENTIFIER]})(?:${b[y.PRERELEASE]})?${b[y.BUILD]}?)?)?`);S("XRANGEPLAINLOOSE",`[v=\\s]*(${b[y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[y.XRANGEIDENTIFIERLOOSE]})(?:${b[y.PRERELEASELOOSE]})?${b[y.BUILD]}?)?)?`);S("XRANGE",`^${b[y.GTLT]}\\s*${b[y.XRANGEPLAIN]}$`);S("XRANGELOOSE",`^${b[y.GTLT]}\\s*${b[y.XRANGEPLAINLOOSE]}$`);S("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ur}})(?:\\.(\\d{1,${ur}}))?(?:\\.(\\d{1,${ur}}))?`);S("COERCE",`${b[y.COERCEPLAIN]}(?:$|[^\\d])`);S("COERCEFULL",b[y.COERCEPLAIN]+`(?:${b[y.PRERELEASE]})?(?:${b[y.BUILD]})?(?:$|[^\\d])`);S("COERCERTL",b[y.COERCE],!0);S("COERCERTLFULL",b[y.COERCEFULL],!0);S("LONETILDE","(?:~>?)");S("TILDETRIM",`(\\s*)${b[y.LONETILDE]}\\s+`,!0);ge.tildeTrimReplace="$1~";S("TILDE",`^${b[y.LONETILDE]}${b[y.XRANGEPLAIN]}$`);S("TILDELOOSE",`^${b[y.LONETILDE]}${b[y.XRANGEPLAINLOOSE]}$`);S("LONECARET","(?:\\^)");S("CARETTRIM",`(\\s*)${b[y.LONECARET]}\\s+`,!0);ge.caretTrimReplace="$1^";S("CARET",`^${b[y.LONECARET]}${b[y.XRANGEPLAIN]}$`);S("CARETLOOSE",`^${b[y.LONECARET]}${b[y.XRANGEPLAINLOOSE]}$`);S("COMPARATORLOOSE",`^${b[y.GTLT]}\\s*(${b[y.LOOSEPLAIN]})$|^$`);S("COMPARATOR",`^${b[y.GTLT]}\\s*(${b[y.FULLPLAIN]})$|^$`);S("COMPARATORTRIM",`(\\s*)${b[y.GTLT]}\\s*(${b[y.LOOSEPLAIN]}|${b[y.XRANGEPLAIN]})`,!0);ge.comparatorTrimReplace="$1$2$3";S("HYPHENRANGE",`^\\s*(${b[y.XRANGEPLAIN]})\\s+-\\s+(${b[y.XRANGEPLAIN]})\\s*$`);S("HYPHENRANGELOOSE",`^\\s*(${b[y.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[y.XRANGEPLAINLOOSE]})\\s*$`);S("STAR","(<|>)?=?\\s*\\*");S("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");S("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ht=v((Ky,so)=>{"use strict";var _m=Object.freeze({loose:!0}),Cm=Object.freeze({}),Om=i=>i?typeof i!="object"?_m:i:Cm;so.exports=Om});var dr=v((Qy,co)=>{"use strict";var oo=/^[0-9]+$/,ao=(i,e)=>{if(typeof i=="number"&&typeof e=="number")return i===e?0:i<e?-1:1;let t=oo.test(i),r=oo.test(e);return t&&r&&(i=+i,e=+e),i===e?0:t&&!r?-1:r&&!t?1:i<e?-1:1},Tm=(i,e)=>ao(e,i);co.exports={compareIdentifiers:ao,rcompareIdentifiers:Tm}});var z=v((Zy,po)=>{"use strict";var Wt=ot(),{MAX_LENGTH:lo,MAX_SAFE_INTEGER:Vt}=ze(),{safeRe:Bt,t:zt}=Ye(),Pm=Ht(),{compareIdentifiers:fr}=dr(),hr=class i{constructor(e,t){if(t=Pm(t),e instanceof i){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>lo)throw new TypeError(`version is longer than ${lo} characters`);Wt("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Bt[zt.LOOSE]:Bt[zt.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Vt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Vt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Vt||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<Vt)return s}return n}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Wt("SemVer.compare",this.version,this.options,e),!(e instanceof i)){if(typeof e=="string"&&e===this.version)return 0;e=new i(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof i||(e=new i(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof i||(e=new i(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(Wt("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(r===void 0)return-1;if(r===n)continue;return fr(r,n)}while(++t)}compareBuild(e){e instanceof i||(e=new i(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(Wt("build compare",t,r,n),r===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(r===void 0)return-1;if(r===n)continue;return fr(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Bt[zt.PRERELEASELOOSE]:Bt[zt.PRERELEASE]);if(!n||n[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];r===!1&&(s=[t]),fr(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};po.exports=hr});var Se=v((ew,mo)=>{"use strict";var uo=z(),Am=(i,e,t=!1)=>{if(i instanceof uo)return i;try{return new uo(i,e)}catch(r){if(!t)return null;throw r}};mo.exports=Am});var ho=v((tw,fo)=>{"use strict";var Lm=Se(),jm=(i,e)=>{let t=Lm(i,e);return t?t.version:null};fo.exports=jm});var xo=v((iw,go)=>{"use strict";var Mm=Se(),Im=(i,e)=>{let t=Mm(i.trim().replace(/^[=v]+/,""),e);return t?t.version:null};go.exports=Im});var yo=v((rw,bo)=>{"use strict";var vo=z(),Nm=(i,e,t,r,n)=>{typeof t=="string"&&(n=r,r=t,t=void 0);try{return new vo(i instanceof vo?i.version:i,t).inc(e,r,n).version}catch{return null}};bo.exports=Nm});var Ro=v((nw,Eo)=>{"use strict";var wo=Se(),Fm=(i,e)=>{let t=wo(i,null,!0),r=wo(e,null,!0),n=t.compare(r);if(n===0)return null;let s=n>0,o=s?t:r,a=s?r:t,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let p=c?"pre":"";return t.major!==r.major?p+"major":t.minor!==r.minor?p+"minor":t.patch!==r.patch?p+"patch":"prerelease"};Eo.exports=Fm});var ko=v((sw,$o)=>{"use strict";var Um=z(),Dm=(i,e)=>new Um(i,e).major;$o.exports=Dm});var _o=v((ow,So)=>{"use strict";var qm=z(),Gm=(i,e)=>new qm(i,e).minor;So.exports=Gm});var Oo=v((aw,Co)=>{"use strict";var Hm=z(),Wm=(i,e)=>new Hm(i,e).patch;Co.exports=Wm});var Po=v((cw,To)=>{"use strict";var Vm=Se(),Bm=(i,e)=>{let t=Vm(i,e);return t&&t.prerelease.length?t.prerelease:null};To.exports=Bm});var oe=v((lw,Lo)=>{"use strict";var Ao=z(),zm=(i,e,t)=>new Ao(i,t).compare(new Ao(e,t));Lo.exports=zm});var Mo=v((pw,jo)=>{"use strict";var Ym=oe(),Jm=(i,e,t)=>Ym(e,i,t);jo.exports=Jm});var No=v((uw,Io)=>{"use strict";var Xm=oe(),Km=(i,e)=>Xm(i,e,!0);Io.exports=Km});var Yt=v((mw,Uo)=>{"use strict";var Fo=z(),Qm=(i,e,t)=>{let r=new Fo(i,t),n=new Fo(e,t);return r.compare(n)||r.compareBuild(n)};Uo.exports=Qm});var qo=v((dw,Do)=>{"use strict";var Zm=Yt(),ed=(i,e)=>i.sort((t,r)=>Zm(t,r,e));Do.exports=ed});var Ho=v((fw,Go)=>{"use strict";var td=Yt(),id=(i,e)=>i.sort((t,r)=>td(r,t,e));Go.exports=id});var at=v((hw,Wo)=>{"use strict";var rd=oe(),nd=(i,e,t)=>rd(i,e,t)>0;Wo.exports=nd});var Jt=v((gw,Vo)=>{"use strict";var sd=oe(),od=(i,e,t)=>sd(i,e,t)<0;Vo.exports=od});var gr=v((xw,Bo)=>{"use strict";var ad=oe(),cd=(i,e,t)=>ad(i,e,t)===0;Bo.exports=cd});var xr=v((vw,zo)=>{"use strict";var ld=oe(),pd=(i,e,t)=>ld(i,e,t)!==0;zo.exports=pd});var Xt=v((bw,Yo)=>{"use strict";var ud=oe(),md=(i,e,t)=>ud(i,e,t)>=0;Yo.exports=md});var Kt=v((yw,Jo)=>{"use strict";var dd=oe(),fd=(i,e,t)=>dd(i,e,t)<=0;Jo.exports=fd});var vr=v((ww,Xo)=>{"use strict";var hd=gr(),gd=xr(),xd=at(),vd=Xt(),bd=Jt(),yd=Kt(),wd=(i,e,t,r)=>{switch(e){case"===":return typeof i=="object"&&(i=i.version),typeof t=="object"&&(t=t.version),i===t;case"!==":return typeof i=="object"&&(i=i.version),typeof t=="object"&&(t=t.version),i!==t;case"":case"=":case"==":return hd(i,t,r);case"!=":return gd(i,t,r);case">":return xd(i,t,r);case">=":return vd(i,t,r);case"<":return bd(i,t,r);case"<=":return yd(i,t,r);default:throw new TypeError(`Invalid operator: ${e}`)}};Xo.exports=wd});var Qo=v((Ew,Ko)=>{"use strict";var Ed=z(),Rd=Se(),{safeRe:Qt,t:Zt}=Ye(),$d=(i,e)=>{if(i instanceof Ed)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;e=e||{};let t=null;if(!e.rtl)t=i.match(e.includePrerelease?Qt[Zt.COERCEFULL]:Qt[Zt.COERCE]);else{let c=e.includePrerelease?Qt[Zt.COERCERTLFULL]:Qt[Zt.COERCERTL],l;for(;(l=c.exec(i))&&(!t||t.index+t[0].length!==i.length);)(!t||l.index+l[0].length!==t.index+t[0].length)&&(t=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(t===null)return null;let r=t[2],n=t[3]||"0",s=t[4]||"0",o=e.includePrerelease&&t[5]?`-${t[5]}`:"",a=e.includePrerelease&&t[6]?`+${t[6]}`:"";return Rd(`${r}.${n}.${s}${o}${a}`,e)};Ko.exports=$d});var ea=v((Rw,Zo)=>{"use strict";var kd=Se(),Sd=ze(),_d=z(),Cd=(i,e,t)=>{if(!Sd.RELEASE_TYPES.includes(e))return null;let r=Od(i,t);return r&&Td(r,e)},Od=(i,e)=>{let t=i instanceof _d?i.version:i;return kd(t,e)},Td=(i,e)=>{if(Pd(e))return i.version;switch(i.prerelease=[],e){case"major":i.minor=0,i.patch=0;break;case"minor":i.patch=0;break}return i.format()},Pd=i=>i.startsWith("pre");Zo.exports=Cd});var ia=v(($w,ta)=>{"use strict";var br=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}};ta.exports=br});var ae=v((kw,oa)=>{"use strict";var Ad=/\s+/g,yr=class i{constructor(e,t){if(t=jd(t),e instanceof i)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new i(e.raw,t);if(e instanceof wr)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(Ad," "),this.set=this.raw.split("||").map(r=>this.parseRange(r.trim())).filter(r=>r.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter(n=>!na(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&qd(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let r=0;r<t.length;r++)r>0&&(this.formatted+=" "),this.formatted+=t[r].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let r=((this.options.includePrerelease&&Ud)|(this.options.loose&&Dd))+":"+e,n=ra.get(r);if(n)return n;let s=this.options.loose,o=s?K[J.HYPHENRANGELOOSE]:K[J.HYPHENRANGE];e=e.replace(o,Kd(this.options.includePrerelease)),N("hyphen replace",e),e=e.replace(K[J.COMPARATORTRIM],Id),N("comparator trim",e),e=e.replace(K[J.TILDETRIM],Nd),N("tilde trim",e),e=e.replace(K[J.CARETTRIM],Fd),N("caret trim",e);let a=e.split(" ").map(u=>Gd(u,this.options)).join(" ").split(/\s+/).map(u=>Xd(u,this.options));s&&(a=a.filter(u=>(N("loose invalid filter",u,this.options),!!u.match(K[J.COMPARATORLOOSE])))),N("range list",a);let c=new Map,l=a.map(u=>new wr(u,this.options));for(let u of l){if(na(u))return[u];c.set(u.value,u)}c.size>1&&c.has("")&&c.delete("");let p=[...c.values()];return ra.set(r,p),p}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Range is required");return this.set.some(r=>sa(r,t)&&e.set.some(n=>sa(n,t)&&r.every(s=>n.every(o=>s.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Md(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(Qd(this.set[t],e,this.options))return!0;return!1}};oa.exports=yr;var Ld=ia(),ra=new Ld,jd=Ht(),wr=ct(),N=ot(),Md=z(),{safeRe:K,t:J,comparatorTrimReplace:Id,tildeTrimReplace:Nd,caretTrimReplace:Fd}=Ye(),{FLAG_INCLUDE_PRERELEASE:Ud,FLAG_LOOSE:Dd}=ze(),na=i=>i.value==="<0.0.0-0",qd=i=>i.value==="",sa=(i,e)=>{let t=!0,r=i.slice(),n=r.pop();for(;t&&r.length;)t=r.every(s=>n.intersects(s,e)),n=r.pop();return t},Gd=(i,e)=>(i=i.replace(K[J.BUILD],""),N("comp",i,e),i=Vd(i,e),N("caret",i),i=Hd(i,e),N("tildes",i),i=zd(i,e),N("xrange",i),i=Jd(i,e),N("stars",i),i),Q=i=>!i||i.toLowerCase()==="x"||i==="*",Hd=(i,e)=>i.trim().split(/\s+/).map(t=>Wd(t,e)).join(" "),Wd=(i,e)=>{let t=e.loose?K[J.TILDELOOSE]:K[J.TILDE];return i.replace(t,(r,n,s,o,a)=>{N("tilde",i,r,n,s,o,a);let c;return Q(n)?c="":Q(s)?c=`>=${n}.0.0 <${+n+1}.0.0-0`:Q(o)?c=`>=${n}.${s}.0 <${n}.${+s+1}.0-0`:a?(N("replaceTilde pr",a),c=`>=${n}.${s}.${o}-${a} <${n}.${+s+1}.0-0`):c=`>=${n}.${s}.${o} <${n}.${+s+1}.0-0`,N("tilde return",c),c})},Vd=(i,e)=>i.trim().split(/\s+/).map(t=>Bd(t,e)).join(" "),Bd=(i,e)=>{N("caret",i,e);let t=e.loose?K[J.CARETLOOSE]:K[J.CARET],r=e.includePrerelease?"-0":"";return i.replace(t,(n,s,o,a,c)=>{N("caret",i,n,s,o,a,c);let l;return Q(s)?l="":Q(o)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:Q(a)?s==="0"?l=`>=${s}.${o}.0${r} <${s}.${+o+1}.0-0`:l=`>=${s}.${o}.0${r} <${+s+1}.0.0-0`:c?(N("replaceCaret pr",c),s==="0"?o==="0"?l=`>=${s}.${o}.${a}-${c} <${s}.${o}.${+a+1}-0`:l=`>=${s}.${o}.${a}-${c} <${s}.${+o+1}.0-0`:l=`>=${s}.${o}.${a}-${c} <${+s+1}.0.0-0`):(N("no pr"),s==="0"?o==="0"?l=`>=${s}.${o}.${a}${r} <${s}.${o}.${+a+1}-0`:l=`>=${s}.${o}.${a}${r} <${s}.${+o+1}.0-0`:l=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),N("caret return",l),l})},zd=(i,e)=>(N("replaceXRanges",i,e),i.split(/\s+/).map(t=>Yd(t,e)).join(" ")),Yd=(i,e)=>{i=i.trim();let t=e.loose?K[J.XRANGELOOSE]:K[J.XRANGE];return i.replace(t,(r,n,s,o,a,c)=>{N("xRange",i,r,n,s,o,a,c);let l=Q(s),p=l||Q(o),u=p||Q(a),d=u;return n==="="&&d&&(n=""),c=e.includePrerelease?"-0":"",l?n===">"||n==="<"?r="<0.0.0-0":r="*":n&&d?(p&&(o=0),a=0,n===">"?(n=">=",p?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",p?s=+s+1:o=+o+1),n==="<"&&(c="-0"),r=`${n+s}.${o}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:u&&(r=`>=${s}.${o}.0${c} <${s}.${+o+1}.0-0`),N("xRange return",r),r})},Jd=(i,e)=>(N("replaceStars",i,e),i.trim().replace(K[J.STAR],"")),Xd=(i,e)=>(N("replaceGTE0",i,e),i.trim().replace(K[e.includePrerelease?J.GTE0PRE:J.GTE0],"")),Kd=i=>(e,t,r,n,s,o,a,c,l,p,u,d)=>(Q(r)?t="":Q(n)?t=`>=${r}.0.0${i?"-0":""}`:Q(s)?t=`>=${r}.${n}.0${i?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${i?"-0":""}`,Q(l)?c="":Q(p)?c=`<${+l+1}.0.0-0`:Q(u)?c=`<${l}.${+p+1}.0-0`:d?c=`<=${l}.${p}.${u}-${d}`:i?c=`<${l}.${p}.${+u+1}-0`:c=`<=${c}`,`${t} ${c}`.trim()),Qd=(i,e,t)=>{for(let r=0;r<i.length;r++)if(!i[r].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(let r=0;r<i.length;r++)if(N(i[r].semver),i[r].semver!==wr.ANY&&i[r].semver.prerelease.length>0){let n=i[r].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var ct=v((Sw,ma)=>{"use strict";var lt=Symbol("SemVer ANY"),$r=class i{static get ANY(){return lt}constructor(e,t){if(t=aa(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Rr("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===lt?this.value="":this.value=this.operator+this.semver.version,Rr("comp",this)}parse(e){let t=this.options.loose?ca[la.COMPARATORLOOSE]:ca[la.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new pa(r[2],this.options.loose):this.semver=lt}toString(){return this.value}test(e){if(Rr("Comparator.test",e,this.options.loose),this.semver===lt||e===lt)return!0;if(typeof e=="string")try{e=new pa(e,this.options)}catch{return!1}return Er(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new ua(e.value,t).test(this.value):e.operator===""?e.value===""?!0:new ua(this.value,t).test(e.semver):(t=aa(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Er(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Er(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};ma.exports=$r;var aa=Ht(),{safeRe:ca,t:la}=Ye(),Er=vr(),Rr=ot(),pa=z(),ua=ae()});var pt=v((_w,da)=>{"use strict";var Zd=ae(),ef=(i,e,t)=>{try{e=new Zd(e,t)}catch{return!1}return e.test(i)};da.exports=ef});var ha=v((Cw,fa)=>{"use strict";var tf=ae(),rf=(i,e)=>new tf(i,e).set.map(t=>t.map(r=>r.value).join(" ").trim().split(" "));fa.exports=rf});var xa=v((Ow,ga)=>{"use strict";var nf=z(),sf=ae(),of=(i,e,t)=>{let r=null,n=null,s=null;try{s=new sf(e,t)}catch{return null}return i.forEach(o=>{s.test(o)&&(!r||n.compare(o)===-1)&&(r=o,n=new nf(r,t))}),r};ga.exports=of});var ba=v((Tw,va)=>{"use strict";var af=z(),cf=ae(),lf=(i,e,t)=>{let r=null,n=null,s=null;try{s=new cf(e,t)}catch{return null}return i.forEach(o=>{s.test(o)&&(!r||n.compare(o)===1)&&(r=o,n=new af(r,t))}),r};va.exports=lf});var Ea=v((Pw,wa)=>{"use strict";var kr=z(),pf=ae(),ya=at(),uf=(i,e)=>{i=new pf(i,e);let t=new kr("0.0.0");if(i.test(t)||(t=new kr("0.0.0-0"),i.test(t)))return t;t=null;for(let r=0;r<i.set.length;++r){let n=i.set[r],s=null;n.forEach(o=>{let a=new kr(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||ya(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!t||ya(t,s))&&(t=s)}return t&&i.test(t)?t:null};wa.exports=uf});var $a=v((Aw,Ra)=>{"use strict";var mf=ae(),df=(i,e)=>{try{return new mf(i,e).range||"*"}catch{return null}};Ra.exports=df});var ei=v((Lw,Ca)=>{"use strict";var ff=z(),_a=ct(),{ANY:hf}=_a,gf=ae(),xf=pt(),ka=at(),Sa=Jt(),vf=Kt(),bf=Xt(),yf=(i,e,t,r)=>{i=new ff(i,r),e=new gf(e,r);let n,s,o,a,c;switch(t){case">":n=ka,s=vf,o=Sa,a=">",c=">=";break;case"<":n=Sa,s=bf,o=ka,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(xf(i,e,r))return!1;for(let l=0;l<e.set.length;++l){let p=e.set[l],u=null,d=null;if(p.forEach(f=>{f.semver===hf&&(f=new _a(">=0.0.0")),u=u||f,d=d||f,n(f.semver,u.semver,r)?u=f:o(f.semver,d.semver,r)&&(d=f)}),u.operator===a||u.operator===c||(!d.operator||d.operator===a)&&s(i,d.semver))return!1;if(d.operator===c&&o(i,d.semver))return!1}return!0};Ca.exports=yf});var Ta=v((jw,Oa)=>{"use strict";var wf=ei(),Ef=(i,e,t)=>wf(i,e,">",t);Oa.exports=Ef});var Aa=v((Mw,Pa)=>{"use strict";var Rf=ei(),$f=(i,e,t)=>Rf(i,e,"<",t);Pa.exports=$f});var Ma=v((Iw,ja)=>{"use strict";var La=ae(),kf=(i,e,t)=>(i=new La(i,t),e=new La(e,t),i.intersects(e,t));ja.exports=kf});var Na=v((Nw,Ia)=>{"use strict";var Sf=pt(),_f=oe();Ia.exports=(i,e,t)=>{let r=[],n=null,s=null,o=i.sort((p,u)=>_f(p,u,t));for(let p of o)Sf(p,e,t)?(s=p,n||(n=p)):(s&&r.push([n,s]),s=null,n=null);n&&r.push([n,null]);let a=[];for(let[p,u]of r)p===u?a.push(p):!u&&p===o[0]?a.push("*"):u?p===o[0]?a.push(`<=${u}`):a.push(`${p} - ${u}`):a.push(`>=${p}`);let c=a.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return c.length<l.length?c:e}});var Ha=v((Fw,Ga)=>{"use strict";var Fa=ae(),_r=ct(),{ANY:Sr}=_r,ut=pt(),Cr=oe(),Cf=(i,e,t={})=>{if(i===e)return!0;i=new Fa(i,t),e=new Fa(e,t);let r=!1;e:for(let n of i.set){for(let s of e.set){let o=Tf(n,s,t);if(r=r||o!==null,o)continue e}if(r)return!1}return!0},Of=[new _r(">=0.0.0-0")],Ua=[new _r(">=0.0.0")],Tf=(i,e,t)=>{if(i===e)return!0;if(i.length===1&&i[0].semver===Sr){if(e.length===1&&e[0].semver===Sr)return!0;t.includePrerelease?i=Of:i=Ua}if(e.length===1&&e[0].semver===Sr){if(t.includePrerelease)return!0;e=Ua}let r=new Set,n,s;for(let f of i)f.operator===">"||f.operator===">="?n=Da(n,f,t):f.operator==="<"||f.operator==="<="?s=qa(s,f,t):r.add(f.semver);if(r.size>1)return null;let o;if(n&&s){if(o=Cr(n.semver,s.semver,t),o>0)return null;if(o===0&&(n.operator!==">="||s.operator!=="<="))return null}for(let f of r){if(n&&!ut(f,String(n),t)||s&&!ut(f,String(s),t))return null;for(let x of e)if(!ut(f,String(x),t))return!1;return!0}let a,c,l,p,u=s&&!t.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=n&&!t.includePrerelease&&n.semver.prerelease.length?n.semver:!1;u&&u.prerelease.length===1&&s.operator==="<"&&u.prerelease[0]===0&&(u=!1);for(let f of e){if(p=p||f.operator===">"||f.operator===">=",l=l||f.operator==="<"||f.operator==="<=",n){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator===">"||f.operator===">="){if(a=Da(n,f,t),a===f&&a!==n)return!1}else if(n.operator===">="&&!ut(n.semver,String(f),t))return!1}if(s){if(u&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===u.major&&f.semver.minor===u.minor&&f.semver.patch===u.patch&&(u=!1),f.operator==="<"||f.operator==="<="){if(c=qa(s,f,t),c===f&&c!==s)return!1}else if(s.operator==="<="&&!ut(s.semver,String(f),t))return!1}if(!f.operator&&(s||n)&&o!==0)return!1}return!(n&&l&&!s&&o!==0||s&&p&&!n&&o!==0||d||u)},Da=(i,e,t)=>{if(!i)return e;let r=Cr(i.semver,e.semver,t);return r>0?i:r<0||e.operator===">"&&i.operator===">="?e:i},qa=(i,e,t)=>{if(!i)return e;let r=Cr(i.semver,e.semver,t);return r<0?i:r>0||e.operator==="<"&&i.operator==="<="?e:i};Ga.exports=Cf});var ti=v((Uw,Ba)=>{"use strict";var Or=Ye(),Wa=ze(),Pf=z(),Va=dr(),Af=Se(),Lf=ho(),jf=xo(),Mf=yo(),If=Ro(),Nf=ko(),Ff=_o(),Uf=Oo(),Df=Po(),qf=oe(),Gf=Mo(),Hf=No(),Wf=Yt(),Vf=qo(),Bf=Ho(),zf=at(),Yf=Jt(),Jf=gr(),Xf=xr(),Kf=Xt(),Qf=Kt(),Zf=vr(),eh=Qo(),th=ea(),ih=ct(),rh=ae(),nh=pt(),sh=ha(),oh=xa(),ah=ba(),ch=Ea(),lh=$a(),ph=ei(),uh=Ta(),mh=Aa(),dh=Ma(),fh=Na(),hh=Ha();Ba.exports={parse:Af,valid:Lf,clean:jf,inc:Mf,diff:If,major:Nf,minor:Ff,patch:Uf,prerelease:Df,compare:qf,rcompare:Gf,compareLoose:Hf,compareBuild:Wf,sort:Vf,rsort:Bf,gt:zf,lt:Yf,eq:Jf,neq:Xf,gte:Kf,lte:Qf,cmp:Zf,coerce:eh,truncate:th,Comparator:ih,Range:rh,satisfies:nh,toComparators:sh,maxSatisfying:oh,minSatisfying:ah,minVersion:ch,validRange:lh,outside:ph,gtr:uh,ltr:mh,intersects:dh,simplifyRange:fh,subset:hh,SemVer:Pf,re:Or.re,src:Or.src,tokens:Or.t,SEMVER_SPEC_VERSION:Wa.SEMVER_SPEC_VERSION,RELEASE_TYPES:Wa.RELEASE_TYPES,compareIdentifiers:Va.compareIdentifiers,rcompareIdentifiers:Va.rcompareIdentifiers}});var Ya=v((Dw,za)=>{var gh=ti();za.exports=gh.satisfies(process.version,">=15.7.0")});var Xa=v((qw,Ja)=>{var xh=ti();Ja.exports=xh.satisfies(process.version,">=16.9.0")});var Tr=v((Gw,Ka)=>{var vh=Ya(),bh=Xa(),yh={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},wh={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};Ka.exports=function(i,e){if(!i||!e)return;let t=e.asymmetricKeyType;if(!t)return;let r=yh[t];if(!r)throw new Error(`Unknown key type "${t}".`);if(!r.includes(i))throw new Error(`"alg" parameter for "${t}" key type must be one of: ${r.join(", ")}.`);if(vh)switch(t){case"ec":let n=e.asymmetricKeyDetails.namedCurve,s=wh[i];if(n!==s)throw new Error(`"alg" parameter "${i}" requires curve "${s}".`);break;case"rsa-pss":if(bh){let o=parseInt(i.slice(-3),10),{hashAlgorithm:a,mgf1HashAlgorithm:c,saltLength:l}=e.asymmetricKeyDetails;if(a!==`sha${o}`||c!==a)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${i}.`);if(l!==void 0&&l>o>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${i}.`)}break}}});var Pr=v((Hw,Qa)=>{var Eh=ti();Qa.exports=Eh.satisfies(process.version,"^6.12.0 || >=8.0.0")});var tc=v((Ww,ec)=>{var I=st(),Rh=cr(),Za=lr(),$h=ar(),kh=pr(),Sh=Tr(),_h=Pr(),Ch=Ft(),{KeyObject:Oh,createSecretKey:Th,createPublicKey:Ph}=require("crypto"),Ar=["RS256","RS384","RS512"],Ah=["ES256","ES384","ES512"],Lr=["RS256","RS384","RS512"],Lh=["HS256","HS384","HS512"];_h&&(Ar.splice(Ar.length,0,"PS256","PS384","PS512"),Lr.splice(Lr.length,0,"PS256","PS384","PS512"));ec.exports=function(i,e,t,r){typeof t=="function"&&!r&&(r=t,t={}),t||(t={}),t=Object.assign({},t);let n;if(r?n=r:n=function(p,u){if(p)throw p;return u},t.clockTimestamp&&typeof t.clockTimestamp!="number")return n(new I("clockTimestamp must be a number"));if(t.nonce!==void 0&&(typeof t.nonce!="string"||t.nonce.trim()===""))return n(new I("nonce must be a non-empty string"));if(t.allowInvalidAsymmetricKeyTypes!==void 0&&typeof t.allowInvalidAsymmetricKeyTypes!="boolean")return n(new I("allowInvalidAsymmetricKeyTypes must be a boolean"));let s=t.clockTimestamp||Math.floor(Date.now()/1e3);if(!i)return n(new I("jwt must be provided"));if(typeof i!="string")return n(new I("jwt must be a string"));let o=i.split(".");if(o.length!==3)return n(new I("jwt malformed"));let a;try{a=$h(i,{complete:!0})}catch(p){return n(p)}if(!a)return n(new I("invalid token"));let c=a.header,l;if(typeof e=="function"){if(!r)return n(new I("verify must be called asynchronous if secret or public key is provided as a callback"));l=e}else l=function(p,u){return u(null,e)};return l(c,function(p,u){if(p)return n(new I("error in secret or public key callback: "+p.message));let d=o[2].trim()!=="";if(!d&&u)return n(new I("jwt signature is required"));if(d&&!u)return n(new I("secret or public key must be provided"));if(!d&&!t.algorithms)return n(new I('please specify "none" in "algorithms" to verify unsigned tokens'));if(u!=null&&!(u instanceof Oh))try{u=Ph(u)}catch{try{u=Th(typeof u=="string"?Buffer.from(u):u)}catch{return n(new I("secretOrPublicKey is not valid key material"))}}if(t.algorithms||(u.type==="secret"?t.algorithms=Lh:["rsa","rsa-pss"].includes(u.asymmetricKeyType)?t.algorithms=Lr:u.asymmetricKeyType==="ec"?t.algorithms=Ah:t.algorithms=Ar),t.algorithms.indexOf(a.header.alg)===-1)return n(new I("invalid algorithm"));if(c.alg.startsWith("HS")&&u.type!=="secret")return n(new I(`secretOrPublicKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)&&u.type!=="public")return n(new I(`secretOrPublicKey must be an asymmetric key when using ${c.alg}`));if(!t.allowInvalidAsymmetricKeyTypes)try{Sh(c.alg,u)}catch(w){return n(w)}let f;try{f=Ch.verify(i,a.header.alg,u)}catch(w){return n(w)}if(!f)return n(new I("invalid signature"));let x=a.payload;if(typeof x.nbf<"u"&&!t.ignoreNotBefore){if(typeof x.nbf!="number")return n(new I("invalid nbf value"));if(x.nbf>s+(t.clockTolerance||0))return n(new Rh("jwt not active",new Date(x.nbf*1e3)))}if(typeof x.exp<"u"&&!t.ignoreExpiration){if(typeof x.exp!="number")return n(new I("invalid exp value"));if(s>=x.exp+(t.clockTolerance||0))return n(new Za("jwt expired",new Date(x.exp*1e3)))}if(t.audience){let w=Array.isArray(t.audience)?t.audience:[t.audience];if(!(Array.isArray(x.aud)?x.aud:[x.aud]).some(function(E){return w.some(function($){return $ instanceof RegExp?$.test(E):$===E})}))return n(new I("jwt audience invalid. expected: "+w.join(" or ")))}if(t.issuer&&(typeof t.issuer=="string"&&x.iss!==t.issuer||Array.isArray(t.issuer)&&t.issuer.indexOf(x.iss)===-1))return n(new I("jwt issuer invalid. expected: "+t.issuer));if(t.subject&&x.sub!==t.subject)return n(new I("jwt subject invalid. expected: "+t.subject));if(t.jwtid&&x.jti!==t.jwtid)return n(new I("jwt jwtid invalid. expected: "+t.jwtid));if(t.nonce&&x.nonce!==t.nonce)return n(new I("jwt nonce invalid. expected: "+t.nonce));if(t.maxAge){if(typeof x.iat!="number")return n(new I("iat required when maxAge is specified"));let w=kh(t.maxAge,x.iat);if(typeof w>"u")return n(new I('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(s>=w+(t.clockTolerance||0))return n(new Za("maxAge exceeded",new Date(w*1e3)))}if(t.complete===!0){let w=a.signature;return n(null,{header:c,payload:x,signature:w})}return n(null,x)})}});var ac=v((Vw,oc)=>{var ic=1/0,nc=9007199254740991,jh=17976931348623157e292,rc=NaN,Mh="[object Arguments]",Ih="[object Function]",Nh="[object GeneratorFunction]",Fh="[object String]",Uh="[object Symbol]",Dh=/^\s+|\s+$/g,qh=/^[-+]0x[0-9a-f]+$/i,Gh=/^0b[01]+$/i,Hh=/^0o[0-7]+$/i,Wh=/^(?:0|[1-9]\d*)$/,Vh=parseInt;function Bh(i,e){for(var t=-1,r=i?i.length:0,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}function zh(i,e,t,r){for(var n=i.length,s=t+(r?1:-1);r?s--:++s<n;)if(e(i[s],s,i))return s;return-1}function Yh(i,e,t){if(e!==e)return zh(i,Jh,t);for(var r=t-1,n=i.length;++r<n;)if(i[r]===e)return r;return-1}function Jh(i){return i!==i}function Xh(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}function Kh(i,e){return Bh(e,function(t){return i[t]})}function Qh(i,e){return function(t){return i(e(t))}}var ii=Object.prototype,Mr=ii.hasOwnProperty,ri=ii.toString,Zh=ii.propertyIsEnumerable,eg=Qh(Object.keys,Object),tg=Math.max;function ig(i,e){var t=sc(i)||ag(i)?Xh(i.length,String):[],r=t.length,n=!!r;for(var s in i)(e||Mr.call(i,s))&&!(n&&(s=="length"||ng(s,r)))&&t.push(s);return t}function rg(i){if(!sg(i))return eg(i);var e=[];for(var t in Object(i))Mr.call(i,t)&&t!="constructor"&&e.push(t);return e}function ng(i,e){return e=e??nc,!!e&&(typeof i=="number"||Wh.test(i))&&i>-1&&i%1==0&&i<e}function sg(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||ii;return i===t}function og(i,e,t,r){i=Ir(i)?i:xg(i),t=t&&!r?fg(t):0;var n=i.length;return t<0&&(t=tg(n+t,0)),ug(i)?t<=n&&i.indexOf(e,t)>-1:!!n&&Yh(i,e,t)>-1}function ag(i){return cg(i)&&Mr.call(i,"callee")&&(!Zh.call(i,"callee")||ri.call(i)==Mh)}var sc=Array.isArray;function Ir(i){return i!=null&&pg(i.length)&&!lg(i)}function cg(i){return Nr(i)&&Ir(i)}function lg(i){var e=jr(i)?ri.call(i):"";return e==Ih||e==Nh}function pg(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=nc}function jr(i){var e=typeof i;return!!i&&(e=="object"||e=="function")}function Nr(i){return!!i&&typeof i=="object"}function ug(i){return typeof i=="string"||!sc(i)&&Nr(i)&&ri.call(i)==Fh}function mg(i){return typeof i=="symbol"||Nr(i)&&ri.call(i)==Uh}function dg(i){if(!i)return i===0?i:0;if(i=hg(i),i===ic||i===-ic){var e=i<0?-1:1;return e*jh}return i===i?i:0}function fg(i){var e=dg(i),t=e%1;return e===e?t?e-t:e:0}function hg(i){if(typeof i=="number")return i;if(mg(i))return rc;if(jr(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=jr(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=i.replace(Dh,"");var t=Gh.test(i);return t||Hh.test(i)?Vh(i.slice(2),t?2:8):qh.test(i)?rc:+i}function gg(i){return Ir(i)?ig(i):rg(i)}function xg(i){return i?Kh(i,gg(i)):[]}oc.exports=og});var lc=v((Bw,cc)=>{var vg="[object Boolean]",bg=Object.prototype,yg=bg.toString;function wg(i){return i===!0||i===!1||Eg(i)&&yg.call(i)==vg}function Eg(i){return!!i&&typeof i=="object"}cc.exports=wg});var fc=v((zw,dc)=>{var pc=1/0,Rg=17976931348623157e292,uc=NaN,$g="[object Symbol]",kg=/^\s+|\s+$/g,Sg=/^[-+]0x[0-9a-f]+$/i,_g=/^0b[01]+$/i,Cg=/^0o[0-7]+$/i,Og=parseInt,Tg=Object.prototype,Pg=Tg.toString;function Ag(i){return typeof i=="number"&&i==Ig(i)}function mc(i){var e=typeof i;return!!i&&(e=="object"||e=="function")}function Lg(i){return!!i&&typeof i=="object"}function jg(i){return typeof i=="symbol"||Lg(i)&&Pg.call(i)==$g}function Mg(i){if(!i)return i===0?i:0;if(i=Ng(i),i===pc||i===-pc){var e=i<0?-1:1;return e*Rg}return i===i?i:0}function Ig(i){var e=Mg(i),t=e%1;return e===e?t?e-t:e:0}function Ng(i){if(typeof i=="number")return i;if(jg(i))return uc;if(mc(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=mc(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=i.replace(kg,"");var t=_g.test(i);return t||Cg.test(i)?Og(i.slice(2),t?2:8):Sg.test(i)?uc:+i}dc.exports=Ag});var gc=v((Yw,hc)=>{var Fg="[object Number]",Ug=Object.prototype,Dg=Ug.toString;function qg(i){return!!i&&typeof i=="object"}function Gg(i){return typeof i=="number"||qg(i)&&Dg.call(i)==Fg}hc.exports=Gg});var yc=v((Jw,bc)=>{var Hg="[object Object]";function Wg(i){var e=!1;if(i!=null&&typeof i.toString!="function")try{e=!!(i+"")}catch{}return e}function Vg(i,e){return function(t){return i(e(t))}}var Bg=Function.prototype,xc=Object.prototype,vc=Bg.toString,zg=xc.hasOwnProperty,Yg=vc.call(Object),Jg=xc.toString,Xg=Vg(Object.getPrototypeOf,Object);function Kg(i){return!!i&&typeof i=="object"}function Qg(i){if(!Kg(i)||Jg.call(i)!=Hg||Wg(i))return!1;var e=Xg(i);if(e===null)return!0;var t=zg.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&vc.call(t)==Yg}bc.exports=Qg});var Ec=v((Xw,wc)=>{var Zg="[object String]",ex=Object.prototype,tx=ex.toString,ix=Array.isArray;function rx(i){return!!i&&typeof i=="object"}function nx(i){return typeof i=="string"||!ix(i)&&rx(i)&&tx.call(i)==Zg}wc.exports=nx});var _c=v((Kw,Sc)=>{var sx="Expected a function",Rc=1/0,ox=17976931348623157e292,$c=NaN,ax="[object Symbol]",cx=/^\s+|\s+$/g,lx=/^[-+]0x[0-9a-f]+$/i,px=/^0b[01]+$/i,ux=/^0o[0-7]+$/i,mx=parseInt,dx=Object.prototype,fx=dx.toString;function hx(i,e){var t;if(typeof e!="function")throw new TypeError(sx);return i=yx(i),function(){return--i>0&&(t=e.apply(this,arguments)),i<=1&&(e=void 0),t}}function gx(i){return hx(2,i)}function kc(i){var e=typeof i;return!!i&&(e=="object"||e=="function")}function xx(i){return!!i&&typeof i=="object"}function vx(i){return typeof i=="symbol"||xx(i)&&fx.call(i)==ax}function bx(i){if(!i)return i===0?i:0;if(i=wx(i),i===Rc||i===-Rc){var e=i<0?-1:1;return e*ox}return i===i?i:0}function yx(i){var e=bx(i),t=e%1;return e===e?t?e-t:e:0}function wx(i){if(typeof i=="number")return i;if(vx(i))return $c;if(kc(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=kc(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=i.replace(cx,"");var t=px.test(i);return t||ux.test(i)?mx(i.slice(2),t?2:8):lx.test(i)?$c:+i}Sc.exports=gx});var Ic=v((Qw,Mc)=>{var Cc=pr(),Ex=Pr(),Rx=Tr(),Oc=Ft(),$x=ac(),ni=lc(),Tc=fc(),Fr=gc(),Ac=yc(),_e=Ec(),kx=_c(),{KeyObject:Sx,createSecretKey:_x,createPrivateKey:Cx}=require("crypto"),Lc=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];Ex&&Lc.splice(3,0,"PS256","PS384","PS512");var Ox={expiresIn:{isValid:function(i){return Tc(i)||_e(i)&&i},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(i){return Tc(i)||_e(i)&&i},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(i){return _e(i)||Array.isArray(i)},message:'"audience" must be a string or array'},algorithm:{isValid:$x.bind(null,Lc),message:'"algorithm" must be a valid string enum value'},header:{isValid:Ac,message:'"header" must be an object'},encoding:{isValid:_e,message:'"encoding" must be a string'},issuer:{isValid:_e,message:'"issuer" must be a string'},subject:{isValid:_e,message:'"subject" must be a string'},jwtid:{isValid:_e,message:'"jwtid" must be a string'},noTimestamp:{isValid:ni,message:'"noTimestamp" must be a boolean'},keyid:{isValid:_e,message:'"keyid" must be a string'},mutatePayload:{isValid:ni,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:ni,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:ni,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},Tx={iat:{isValid:Fr,message:'"iat" should be a number of seconds'},exp:{isValid:Fr,message:'"exp" should be a number of seconds'},nbf:{isValid:Fr,message:'"nbf" should be a number of seconds'}};function jc(i,e,t,r){if(!Ac(t))throw new Error('Expected "'+r+'" to be a plain object.');Object.keys(t).forEach(function(n){let s=i[n];if(!s){if(!e)throw new Error('"'+n+'" is not allowed in "'+r+'"');return}if(!s.isValid(t[n]))throw new Error(s.message)})}function Px(i){return jc(Ox,!1,i,"options")}function Ax(i){return jc(Tx,!0,i,"payload")}var Pc={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},Lx=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];Mc.exports=function(i,e,t,r){typeof t=="function"?(r=t,t={}):t=t||{};let n=typeof i=="object"&&!Buffer.isBuffer(i),s=Object.assign({alg:t.algorithm||"HS256",typ:n?"JWT":void 0,kid:t.keyid},t.header);function o(l){if(r)return r(l);throw l}if(!e&&t.algorithm!=="none")return o(new Error("secretOrPrivateKey must have a value"));if(e!=null&&!(e instanceof Sx))try{e=Cx(e)}catch{try{e=_x(typeof e=="string"?Buffer.from(e):e)}catch{return o(new Error("secretOrPrivateKey is not valid key material"))}}if(s.alg.startsWith("HS")&&e.type!=="secret")return o(new Error(`secretOrPrivateKey must be a symmetric key when using ${s.alg}`));if(/^(?:RS|PS|ES)/.test(s.alg)){if(e.type!=="private")return o(new Error(`secretOrPrivateKey must be an asymmetric key when using ${s.alg}`));if(!t.allowInsecureKeySizes&&!s.alg.startsWith("ES")&&e.asymmetricKeyDetails!==void 0&&e.asymmetricKeyDetails.modulusLength<2048)return o(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`))}if(typeof i>"u")return o(new Error("payload is required"));if(n){try{Ax(i)}catch(l){return o(l)}t.mutatePayload||(i=Object.assign({},i))}else{let l=Lx.filter(function(p){return typeof t[p]<"u"});if(l.length>0)return o(new Error("invalid "+l.join(",")+" option for "+typeof i+" payload"))}if(typeof i.exp<"u"&&typeof t.expiresIn<"u")return o(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof i.nbf<"u"&&typeof t.notBefore<"u")return o(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{Px(t)}catch(l){return o(l)}if(!t.allowInvalidAsymmetricKeyTypes)try{Rx(s.alg,e)}catch(l){return o(l)}let a=i.iat||Math.floor(Date.now()/1e3);if(t.noTimestamp?delete i.iat:n&&(i.iat=a),typeof t.notBefore<"u"){try{i.nbf=Cc(t.notBefore,a)}catch(l){return o(l)}if(typeof i.nbf>"u")return o(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof t.expiresIn<"u"&&typeof i=="object"){try{i.exp=Cc(t.expiresIn,a)}catch(l){return o(l)}if(typeof i.exp>"u")return o(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(Pc).forEach(function(l){let p=Pc[l];if(typeof t[l]<"u"){if(typeof i[p]<"u")return o(new Error('Bad "options.'+l+'" option. The payload already has an "'+p+'" property.'));i[p]=t[l]}});let c=t.encoding||"utf8";if(typeof r=="function")r=r&&kx(r),Oc.createSign({header:s,privateKey:e,payload:i,encoding:c}).once("error",r).once("done",function(l){if(!t.allowInsecureKeySizes&&/^(?:RS|PS)/.test(s.alg)&&l.length<256)return r(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`));r(null,l)});else{let l=Oc.sign({header:s,payload:i,secret:e,encoding:c});if(!t.allowInsecureKeySizes&&/^(?:RS|PS)/.test(s.alg)&&l.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`);return l}}});var Ur=v((Zw,Nc)=>{Nc.exports={decode:ar(),verify:tc(),sign:Ic(),JsonWebTokenError:st(),NotBeforeError:cr(),TokenExpiredError:lr()}});var Zc=v((SE,cv)=>{cv.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}});var tl=v((_E,el)=>{el.exports=Zc()});var nl=v(ie=>{"use strict";var mi=tl(),lv=require("path").extname,il=/^\s*([^;\s]*)(?:;|\s|$)/,pv=/^text\//i;ie.charset=rl;ie.charsets={lookup:rl};ie.contentType=uv;ie.extension=mv;ie.extensions=Object.create(null);ie.lookup=dv;ie.types=Object.create(null);fv(ie.extensions,ie.types);function rl(i){if(!i||typeof i!="string")return!1;var e=il.exec(i),t=e&&mi[e[1].toLowerCase()];return t&&t.charset?t.charset:e&&pv.test(e[1])?"UTF-8":!1}function uv(i){if(!i||typeof i!="string")return!1;var e=i.indexOf("/")===-1?ie.lookup(i):i;if(!e)return!1;if(e.indexOf("charset")===-1){var t=ie.charset(e);t&&(e+="; charset="+t.toLowerCase())}return e}function mv(i){if(!i||typeof i!="string")return!1;var e=il.exec(i),t=e&&ie.extensions[e[1].toLowerCase()];return!t||!t.length?!1:t[0]}function dv(i){if(!i||typeof i!="string")return!1;var e=lv("x."+i).toLowerCase().substr(1);return e&&ie.types[e]||!1}function fv(i,e){var t=["nginx","apache",void 0,"iana"];Object.keys(mi).forEach(function(n){var s=mi[n],o=s.extensions;if(!(!o||!o.length)){i[n]=o;for(var a=0;a<o.length;a++){var c=o[a];if(e[c]){var l=t.indexOf(mi[e[c]].source),p=t.indexOf(s.source);if(e[c]!=="application/octet-stream"&&(l>p||l===p&&e[c].substr(0,12)==="application/"))continue}e[c]=n}}})}});var Pl=v((IR,Tl)=>{function Rl(i){return Array.isArray(i)?i:[i]}var cn="",$l=" ",on="\\",Uv=/^\s+$/,Dv=/(?:[^\\]|^)\\$/,qv=/^\\!/,Gv=/^\\#/,Hv=/\r?\n/g,Wv=/^\.*\/|^\.+$/,an="/",_l="node-ignore";typeof Symbol<"u"&&(_l=Symbol.for("node-ignore"));var kl=_l,Vv=(i,e,t)=>Object.defineProperty(i,e,{value:t}),Bv=/([0-z])-([0-z])/g,Cl=()=>!1,zv=i=>i.replace(Bv,(e,t,r)=>t.charCodeAt(0)<=r.charCodeAt(0)?e:cn),Yv=i=>{let{length:e}=i;return i.slice(0,e-e%2)},Jv=[[/^\uFEFF/,()=>cn],[/((?:\\\\)*?)(\\?\s+)$/,(i,e,t)=>e+(t.indexOf("\\")===0?$l:cn)],[/(\\+?)\s/g,(i,e)=>{let{length:t}=e;return e.slice(0,t-t%2)+$l}],[/[\\$.|*+(){^]/g,i=>`\\${i}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(i,e,t)=>e+6<t.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(i,e,t)=>{let r=t.replace(/\\\*/g,"[^\\/]*");return e+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>on],[/\\\\/g,()=>on],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(i,e,t,r,n)=>e===on?`\\[${t}${Yv(r)}${n}`:n==="]"&&r.length%2===0?`[${zv(t)}${r}]`:"[]"],[/(?:[^*])$/,i=>/\/$/.test(i)?`${i}$`:`${i}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(i,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],Sl=Object.create(null),Xv=(i,e)=>{let t=Sl[i];return t||(t=Jv.reduce((r,[n,s])=>r.replace(n,s.bind(i)),i),Sl[i]=t),e?new RegExp(t,"i"):new RegExp(t)},un=i=>typeof i=="string",Kv=i=>i&&un(i)&&!Uv.test(i)&&!Dv.test(i)&&i.indexOf("#")!==0,Qv=i=>i.split(Hv),ln=class{constructor(e,t,r,n){this.origin=e,this.pattern=t,this.negative=r,this.regex=n}},Zv=(i,e)=>{let t=i,r=!1;i.indexOf("!")===0&&(r=!0,i=i.substr(1)),i=i.replace(qv,"!").replace(Gv,"#");let n=Xv(i,e);return new ln(t,i,r,n)},eb=(i,e)=>{throw new e(i)},$e=(i,e,t)=>un(i)?i?$e.isNotRelative(i)?t(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:t("path must not be empty",TypeError):t(`path must be a string, but got \`${e}\``,TypeError),Ol=i=>Wv.test(i);$e.isNotRelative=Ol;$e.convert=i=>i;var pn=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:r=!1}={}){Vv(this,kl,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[kl]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(Kv(e)){let t=Zv(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,Rl(un(e)?Qv(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let r=!1,n=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(n===o&&r!==n||o&&!r&&!n&&!t)return;s.regex.test(e)&&(r=!o,n=o)}),{ignored:r,unignored:n}}_test(e,t,r,n){let s=e&&$e.convert(e);return $e(s,e,this._allowRelativePaths?Cl:eb),this._t(s,t,r,n)}_t(e,t,r,n){if(e in t)return t[e];if(n||(n=e.split(an)),n.pop(),!n.length)return t[e]=this._testOne(e,r);let s=this._t(n.join(an)+an,t,r,n);return t[e]=s.ignored?s:this._testOne(e,r)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return Rl(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},bi=i=>new pn(i),tb=i=>$e(i&&$e.convert(i),i,Cl);bi.isPathValid=tb;bi.default=bi;Tl.exports=bi;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let i=t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/");$e.convert=i;let e=/^[a-z]:\//i;$e.isNotRelative=t=>e.test(t)||Ol(t)}});(function(){Wn().config(Object.assign({},Bn(),Yn()(process.argv)))})();var Ip=require("fs"),Np=require("path");var jp=T(Ct());var ue=T(require("fs")),Br=T(require("path")),Hc=T(require("os")),Wc=T(Ur());var jx=process.stdout.isTTY===!0&&!process.env.NO_COLOR,Ce=i=>jx?i:"",R=Ce("\x1B[32m"),A=Ce("\x1B[33m"),_=Ce("\x1B[36m"),ce=Ce("\x1B[35m"),h=Ce("\x1B[31m"),g=Ce("\x1B[2m"),ee=Ce("\x1B[1m"),m=Ce("\x1B[0m");var Fc="app.boxel.realms";var Mx={"anthropic/claude-3.5-sonnet":"Anthropic: Claude 3.5 Sonnet","anthropic/claude-3.7-sonnet":"Anthropic: Claude 3.7 Sonnet","anthropic/claude-3.7-sonnet:thinking":"Anthropic: Claude 3.7 Sonnet (thinking)","anthropic/claude-haiku-4.5":"Anthropic: Claude Haiku 4.5","anthropic/claude-sonnet-4":"Anthropic: Claude Sonnet 4","anthropic/claude-sonnet-4.5":"Anthropic: Claude Sonnet 4.5","anthropic/claude-sonnet-4.6":"Anthropic: Claude Sonnet 4.6","anthropic/claude-opus-4.1":"Anthropic: Claude Opus 4.1","deepseek/deepseek-chat-v3-0324":"DeepSeek: DeepSeek V3 0324","google/gemini-2.5-pro":"Google: Gemini 2.5 Pro","google/gemini-2.5-flash-lite":"Google: Gemini 2.5 Flash Lite","google/gemini-2.5-flash":"Google: Gemini 2.5 Flash","meta-llama/llama-3.2-3b-instruct":"Meta: Llama 3.2 3B Instruct","openai/gpt-4.1-nano":"OpenAI: GPT-4.1 Nano","openai/gpt-4.1-mini":"OpenAI: GPT-4.1 Mini","openai/gpt-4.1":"OpenAI: GPT-4.1","openai/gpt-4o":"OpenAI: GPT-4o","openai/gpt-4o-mini":"OpenAI: GPT-4o-mini","openai/gpt-5-nano":"OpenAI: GPT-5 Nano","openai/gpt-5-mini":"OpenAI: GPT-5 Mini","openai/gpt-5":"OpenAI: GPT-5","openai/gpt-oss-20b":"OpenAI: GPT OSS 20B"},tE=Object.keys(Mx);function k(i){return i.endsWith("/")?i:`${i}/`}var Re=class extends Error{status;constructor(e,t){super(t),this.name="MatrixAuthError",this.status=e}};async function Uc(i,e,t){let r=await fetch(new URL("_matrix/client/v3/login",i).href,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:{type:"m.id.user",user:e},password:t,type:"m.login.password"})}),n=await r.json();if(!r.ok)throw new Error(`Matrix login failed: ${r.status} ${JSON.stringify(n)}`);return{accessToken:n.access_token,deviceId:n.device_id,userId:n.user_id,matrixUrl:i}}async function Ix(i){let e=await fetch(new URL(`_matrix/client/v3/user/${encodeURIComponent(i.userId)}/openid/request_token`,i.matrixUrl).href,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i.accessToken}`},body:"{}"});if(!e.ok){let t=await e.text();throw e.status===401||e.status===403?new Re(e.status,`OpenID token request failed: ${e.status} ${t}`):new Error(`OpenID token request failed: ${e.status} ${t}`)}return await e.json()}async function Dr(i,e){let t=await Ix(i),r=`${e.replace(/\/$/,"")}/_server-session`,n=await fetch(r,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let o=await n.text();throw new Error(`Realm server session failed: ${n.status} ${o}`)}let s=n.headers.get("Authorization");if(!s)throw new Error("Realm server session response did not include an Authorization header");return s}async function qr(i,e){let t=`${i.replace(/\/$/,"")}/_realm-auth`,r=await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:e}});if(!r.ok){let n=await r.text();throw new Error(`Realm auth lookup failed: ${r.status} ${n}`)}return await r.json()}function Gr(i){return new URL(`_matrix/client/v3/user/${encodeURIComponent(i.userId)}/account_data/${Fc}`,i.matrixUrl).href}async function si(i){let e;try{e=await fetch(Gr(i),{headers:{Authorization:`Bearer ${i.accessToken}`}})}catch{return[]}if(e.status===401||e.status===403){let t=await e.text();throw new Re(e.status,`Matrix account_data fetch failed: ${e.status} ${t}`)}if(!e.ok)return[];try{let t=await e.json();return Array.isArray(t.realms)?[...t.realms]:[]}catch{return[]}}async function Dc(i,e){let t=await si(i);if(!t.includes(e)){t.push(e);let r=await fetch(Gr(i),{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i.accessToken}`},body:JSON.stringify({realms:t})});if(!r.ok){let n=await r.text();throw r.status===401||r.status===403?new Re(r.status,`Failed to update Matrix account data: ${r.status} ${n}`):new Error(`Failed to update Matrix account data: ${r.status} ${n}`)}}}async function qc(i,e){let t=k(e),r=await si(i),n=r.filter(o=>k(o)!==t);if(n.length===r.length)return!1;let s=await fetch(Gr(i),{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i.accessToken}`},body:JSON.stringify({realms:n})});if(!s.ok){let o=await s.text();throw s.status===401||s.status===403?new Re(s.status,`Failed to update Matrix account data: ${s.status} ${o}`):new Error(`Failed to update Matrix account data: ${s.status} ${o}`)}return!0}var Hr=T(require("readline")),Gc=require("stream");function te(i){let e=Hr.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{e.question(i,r=>{e.close(),t(r.trim())})})}function mt(i){let e=new Gc.Writable({write:(r,n,s)=>s()}),t=Hr.createInterface({input:process.stdin,output:e,terminal:!0});return new Promise((r,n)=>{let s=process.stdin,o=s.readableFlowing;s.isTTY&&s.setRawMode(!0);let a=()=>{s.removeListener("data",c),s.isTTY&&s.setRawMode(!1),t.close(),o||s.pause()},c=p=>{try{let u=p.toString().split("\x1B[200~").join("").split("\x1B[201~").join("");for(let d of u)if(d===`
|
|
32
32
|
`||d==="\r"){a(),process.stdout.write(`
|
|
33
|
-
`),
|
|
34
|
-
${A}Stored Matrix session for ${
|
|
35
|
-
${ee}Active Profile:${m} ${
|
|
36
|
-
${A}No active profile and no environment variables set.${m}`),console.log(`Run ${_}boxel profile add${m} to create a profile.`))}},
|
|
37
|
-
Available profiles:`),await
|
|
38
|
-
${g}Commands:${m}`),console.log(` ${_}boxel profile list${m} List all profiles`),console.log(` ${_}boxel profile add${m} Add a new profile`),console.log(` ${_}boxel profile switch${m} Switch active profile`),console.log(` ${_}boxel profile remove${m} Remove a profile`),console.log(` ${_}boxel profile migrate${m} Import from .env file`)}}async function
|
|
33
|
+
`),r(l);return}else d===""?(a(),process.exit()):d==="\x7F"||d==="\b"?l.length>0&&(l=l.slice(0,-1),process.stdout.write("\b \b")):d>=" "&&(l+=d,process.stdout.write("*"))}catch(u){a(),n(u)}},l="";try{process.stdout.write(i),s.on("data",c),s.resume()}catch(p){a(),n(p)}})}async function xe(i){let e=process.env.BOXEL_REALM_SECRET_SEED;if(e)return e;if(i){if(!process.stdin.isTTY)throw new Error("Cannot prompt for realm secret seed: stdin is not a TTY. Set BOXEL_REALM_SECRET_SEED in the environment instead.");return mt("Realm secret seed: ")}}var Nx=Br.join(Hc.homedir(),".boxel-cli"),Fx="profiles.json",Ux=86400;function Dx(i,e=Ux){let t=i.replace(/^Bearer\s+/i,""),r=Wc.default.decode(t);if(!r?.exp)return!0;let n=Math.floor(Date.now()/1e3);return r.exp-n<e}var P="No active profile. Run `boxel profile add` to create one.";function oi(i){return i.endsWith(":stack.cards")?"staging":i.endsWith(":boxel.ai")?"production":i.endsWith(":localhost")?"local":"unknown"}function dt(i){let e=i.match(/^@([^:]+):/);return e?e[1]:i}function ai(i){let e=i.match(/:([^:]+)$/);return e?e[1]:"unknown"}function me(i){let e=dt(i),t=ai(i);return`${g}[${m}${_}${e}${m} ${g}\xB7${m} ${ce}${t}${m}${g}]${m}`}var Vr=class{config;configDir;profilesFile;matrixLoginFn;promptPasswordFn;isTtyFn;constructor(e,t){this.configDir=e||Nx,this.profilesFile=Br.join(this.configDir,Fx),this.config=this.loadConfig(),this.matrixLoginFn=t?.matrixLogin??Uc,this.promptPasswordFn=t?.promptPassword??mt,this.isTtyFn=t?.isTty??(()=>!!process.stdin.isTTY)}ensureConfigDir(){ue.existsSync(this.configDir)||ue.mkdirSync(this.configDir,{recursive:!0})}loadConfig(){let e={profiles:{},activeProfile:null};if(ue.existsSync(this.profilesFile))try{let t=ue.readFileSync(this.profilesFile,"utf-8"),r=JSON.parse(t);if(r&&typeof r=="object"&&!Array.isArray(r)){let n=r,s=n.profiles&&typeof n.profiles=="object"&&!Array.isArray(n.profiles)?n.profiles:null,o=n.activeProfile===null||typeof n.activeProfile=="string"?n.activeProfile:null;if(s)return{profiles:s,activeProfile:o}}}catch{}return e}saveConfig(){this.ensureConfigDir(),ue.writeFileSync(this.profilesFile,JSON.stringify(this.config,null,2),{mode:384});try{ue.chmodSync(this.profilesFile,384)}catch{}}listProfiles(){return Object.keys(this.config.profiles)}getProfile(e){return this.config.profiles[e]}getActiveProfileId(){return this.config.activeProfile}getActiveProfile(){let e=this.config.activeProfile;if(!e)return null;let t=this.config.profiles[e];return t?{id:e,profile:t}:null}resolveProfileSlots(e,t,r,n){let s=oi(e),o=dt(e);if(s==="unknown"&&(!r||!n))throw new Error(`Unknown domain in Matrix ID "${e}". You must provide explicit --matrix-url and --realm-server-url for non-standard domains.`);let a,c;s==="production"?(a="https://matrix.boxel.ai",c="https://app.boxel.ai/"):s==="local"?(a="http://localhost:8008",c="http://localhost:4201/"):(a="https://matrix-staging.stack.cards",c="https://realms-staging.stack.cards/");let l=ai(e);return{matrixUrl:r||a,realmServerUrl:n||c,displayName:t||`${o} \xB7 ${l}`,username:o}}async addProfileWithAuth(e,t,r,n){let s=this.resolveProfileSlots(e,r,t.matrixUrl,n),o=this.config.profiles[e],a=!!o&&(o.matrixUrl!==s.matrixUrl||o.realmServerUrl!==s.realmServerUrl),c={displayName:s.displayName,matrixUrl:s.matrixUrl,realmServerUrl:s.realmServerUrl,matrixAccessToken:t.accessToken,matrixUserId:t.userId,matrixDeviceId:t.deviceId,realmTokens:a?void 0:o?.realmTokens,realmServerToken:a?void 0:o?.realmServerToken};this.config.profiles[e]=c,this.config.activeProfile||(this.config.activeProfile=e),this.saveConfig()}async addProfile(e,t,r,n,s){let o=this.config.profiles[e],a=this.resolveProfileSlots(e,r??o?.displayName,n??o?.matrixUrl,s??o?.realmServerUrl),c=await this.matrixLoginFn(a.matrixUrl,a.username,t);if(c.userId!==e)throw new Error(`Matrix returned userId "${c.userId}" but profile was added as "${e}". Check the Matrix ID and try again.`);await this.addProfileWithAuth(e,c,a.displayName,a.realmServerUrl)}async removeProfile(e){if(!this.config.profiles[e])return!1;if(delete this.config.profiles[e],this.config.activeProfile===e){let t=Object.keys(this.config.profiles);this.config.activeProfile=t.length>0?t[0]:null}return this.saveConfig(),!0}switchProfile(e){return this.config.profiles[e]?(this.config.activeProfile=e,this.saveConfig(),!0):!1}updateDisplayName(e,t){return this.config.profiles[e]?(this.config.profiles[e].displayName=t,this.saveConfig(),!0):!1}updateUrls(e,t){let r=this.config.profiles[e];if(!r)return!1;let n=!1;return t.matrixUrl&&t.matrixUrl!==r.matrixUrl&&(r.matrixUrl=t.matrixUrl,n=!0),t.realmServerUrl&&t.realmServerUrl!==r.realmServerUrl&&(r.realmServerUrl=t.realmServerUrl,n=!0),n&&(r.realmTokens=void 0,r.realmServerToken=void 0,this.saveConfig()),n}setRealmToken(e,t){let r=this.getActiveProfile();r&&(r.profile.realmTokens||(r.profile.realmTokens={}),r.profile.realmTokens[e]=t,this.saveConfig())}getRealmToken(e){return this.getActiveProfile()?.profile.realmTokens?.[e]}setRealmServerToken(e){let t=this.getActiveProfile();t&&(t.profile.realmServerToken=e,this.saveConfig())}getRealmServerToken(){return this.getActiveProfile()?.profile.realmServerToken}getStoredMatrixAuth(e){let t=e??this.config.activeProfile??void 0,r=t?this.config.profiles[t]:void 0;if(!t||!r)throw new Error(P);if(!r.matrixAccessToken)throw new Error(`Profile "${t}" has no stored Matrix access token. Run \`boxel profile add\` to re-authenticate.`);return{accessToken:r.matrixAccessToken,userId:r.matrixUserId,deviceId:r.matrixDeviceId,matrixUrl:r.matrixUrl}}async reAuthenticate(e){let t=e??this.config.activeProfile??void 0,r=t?this.config.profiles[t]:void 0;if(!t||!r)throw new Error(P);if(!this.isTtyFn())throw new Error(`Stored Matrix token for "${t}" is no longer valid. Run \`boxel profile add -u ${t} -p <password>\` to re-authenticate.`);console.log(`
|
|
34
|
+
${A}Stored Matrix session for ${me(t)} has expired.${m}`);let n=await this.promptPasswordFn(`Password for ${t}: `);if(!n)throw new Error("Re-authentication cancelled: password is required.");let s=dt(t),o=await this.matrixLoginFn(r.matrixUrl,s,n);return await this.addProfileWithAuth(t,o,r.displayName,r.realmServerUrl),this.getStoredMatrixAuth(t)}async fetchRealmServerTokenWithReauth(){let e=this.getStoredMatrixAuth(),r=this.getActiveProfile().profile.realmServerUrl.replace(/\/$/,"");try{let n=await Dr(e,r);return this.setRealmServerToken(n),n}catch(n){if(!(n instanceof Re))throw n;let s=await this.reAuthenticate(),o=await Dr(s,r);return this.setRealmServerToken(o),o}}async getOrRefreshServerToken(){let e=this.getRealmServerToken();return e&&!Dx(e)?e:this.fetchRealmServerTokenWithReauth()}async refreshServerToken(){return this.fetchRealmServerTokenWithReauth()}findRealmTokenForUrl(e){let r=this.getActiveProfile()?.profile.realmTokens;if(r){for(let[n,s]of Object.entries(r))if(e.startsWith(n)&&s)return s}}async fetchAndStoreAllRealmTokens(){let e=await this.getOrRefreshServerToken(),r=this.getActiveProfile().profile.realmServerUrl.replace(/\/$/,""),n=await qr(r,e);for(let[s,o]of Object.entries(n))this.setRealmToken(s,o)}async getRealmTokenForUrl(e){let t=this.findRealmTokenForUrl(e);if(t)return t;try{await this.fetchAndStoreAllRealmTokens()}catch{return}return this.findRealmTokenForUrl(e)}buildHeaders(e,t,r){let n=e instanceof Request?new Headers(e.headers):new Headers,s=new Headers(t?.headers);for(let[o,a]of s)n.set(o,a);return n.has("Authorization")||n.set("Authorization",r),n}async authedRealmFetch(e,t){let r=e instanceof Request?e.url:e instanceof URL?e.href:e,n=await this.getRealmTokenForUrl(r);if(n){let c=this.buildHeaders(e,t,n),l=await fetch(e,{...t,headers:c});if(l.status!==401)return l}let s=this.getActiveProfile();if(s&&(s.profile.realmTokens={},s.profile.realmServerToken=void 0,this.saveConfig()),await this.fetchAndStoreAllRealmTokens(),n=this.findRealmTokenForUrl(r),!n)throw new Error(`No realm token available for ${r}. The realm may not be accessible.`);let o=this.buildHeaders(e,t,n);return await fetch(e,{...t,headers:o})}async authedRealmServerFetch(e,t){let r=await this.getOrRefreshServerToken(),n=this.buildHeaders(e,t,r),s=await fetch(e,{...t,headers:n});return s.status===401&&(r=await this.refreshServerToken(),n=this.buildHeaders(e,t,r),s=await fetch(e,{...t,headers:n})),s}async fetchAndStoreRealmToken(e,t){let n=this.getActiveProfile().profile.realmServerUrl.replace(/\/$/,""),o=(await qr(n,t))[e];return o&&this.setRealmToken(e,o),o}async withMatrixAuthRecovery(e){try{return await e(this.getStoredMatrixAuth())}catch(t){if(!(t instanceof Re))throw t;let r=await this.reAuthenticate();return e(r)}}async addToUserRealms(e){await this.withMatrixAuthRecovery(t=>Dc(t,e))}async removeFromUserRealms(e){return this.withMatrixAuthRecovery(t=>qc(t,e))}async getUserRealms(){return this.withMatrixAuthRecovery(e=>si(e))}async migrateFromEnv(){let e=process.env.MATRIX_URL,t=process.env.MATRIX_USERNAME,r=process.env.MATRIX_PASSWORD,n=process.env.REALM_SERVER_URL;if(!e||!t||!r||!n)return null;let o=e.includes("boxel.ai")?"boxel.ai":"stack.cards",a=`@${t}:${o}`,c=!this.config.profiles[a];return await this.addProfile(a,r,void 0,e,n),{profileId:a,created:c}}printStatus(){let e=this.getActiveProfile();e?(console.log(`
|
|
35
|
+
${ee}Active Profile:${m} ${me(e.id)}`),console.log(` ${g}Display Name:${m} ${e.profile.displayName}`),console.log(` ${g}Matrix URL:${m} ${e.profile.matrixUrl}`),console.log(` ${g}Realm Server:${m} ${e.profile.realmServerUrl}`)):(console.log(`
|
|
36
|
+
${A}No active profile and no environment variables set.${m}`),console.log(`Run ${_}boxel profile add${m} to create a profile.`))}},Wr=null;function C(){return Wr||(Wr=new Vr),Wr}var zr={staging:{domain:"stack.cards",matrixUrl:"https://matrix-staging.stack.cards",realmServerUrl:"https://realms-staging.stack.cards/"},production:{domain:"boxel.ai",matrixUrl:"https://matrix.boxel.ai",realmServerUrl:"https://app.boxel.ai/"},local:{domain:"localhost",matrixUrl:"http://localhost:8008",realmServerUrl:"http://localhost:4201/"}};function ci(i,e){let t=i.trim(),r;try{r=new URL(t)}catch{console.error(`${h}Error:${m} ${e} "${i}" is not a valid URL.`),process.exit(1)}return r.protocol!=="http:"&&r.protocol!=="https:"&&(console.error(`${h}Error:${m} ${e} "${i}" must use http:// or https://.`),process.exit(1)),t}function qx(i){return i.toLowerCase().replace(/\//g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Vc(){let i=process.env.BOXEL_ENVIRONMENT;if(!i||!i.trim())return null;let e=qx(i);return e||(console.error(`${h}Error:${m} BOXEL_ENVIRONMENT="${i}" contains no slug characters (expected letters, digits, or "-").`),process.exit(1)),{domain:`${e}.localhost`,matrixUrl:`http://matrix.${e}.localhost`,realmServerUrl:`http://realm-server.${e}.localhost/`}}async function zc(i,e,t){let r=C();switch(i){case"list":await Bc(r);break;case"add":{let n=t?.password||process.env.BOXEL_PASSWORD;if(t?.user&&n){let s=t.matrixUrl?ci(t.matrixUrl,"--matrix-url"):void 0,o=t.realmServerUrl?ci(t.realmServerUrl,"--realm-server-url"):void 0,p=!(oi(t.user)!=="unknown")&&(!s||!o)?Vc():null;p&&console.log(`${g}Using BOXEL_ENVIRONMENT=${process.env.BOXEL_ENVIRONMENT}${m}`),await Bx(r,t.user,n,t.name,s??p?.matrixUrl,o??p?.realmServerUrl)}else await Hx(r,Vc());break}case"switch":e||(console.error(`${h}Error:${m} Please specify a profile to switch to.`),console.log("Usage: boxel profile switch <profile-id>"),console.log(`
|
|
37
|
+
Available profiles:`),await Bc(r),process.exit(1)),await Wx(r,e);break;case"remove":e||(console.error(`${h}Error:${m} Please specify a profile to remove.`),process.exit(1)),await Vx(r,e);break;case"migrate":await zx(r);break;default:r.printStatus(),console.log(`
|
|
38
|
+
${g}Commands:${m}`),console.log(` ${_}boxel profile list${m} List all profiles`),console.log(` ${_}boxel profile add${m} Add a new profile`),console.log(` ${_}boxel profile switch${m} Switch active profile`),console.log(` ${_}boxel profile remove${m} Remove a profile`),console.log(` ${_}boxel profile migrate${m} Import from .env file`)}}async function Bc(i){let e=i.listProfiles(),t=i.getActiveProfileId();if(e.length===0){console.log(`
|
|
39
39
|
${A}No profiles configured.${m}`),console.log(`Run ${_}boxel profile add${m} to create one.`);return}console.log(`
|
|
40
40
|
${ee}Saved Profiles:${m}
|
|
41
|
-
`);for(let
|
|
42
|
-
Choice [1/2/3/4]: `);if(
|
|
41
|
+
`);for(let r of e){let n=i.getProfile(r),s=r===t,o=oi(r),a=s?`${R}\u2605${m} `:" ",c=ai(r),l=o==="production"?ce:_;console.log(`${a}${ee}${r}${m}`),console.log(` ${g}Name:${m} ${n.displayName}`),console.log(` ${g}Environment:${m} ${l}${c}${m}`),console.log(` ${g}Realm Server:${m} ${n.realmServerUrl}`),console.log("")}t&&console.log(`${g}\u2605 = active profile${m}`)}async function Gx(){console.log("Which environment?"),console.log(` ${_}1${m}) Staging (realms-staging.stack.cards)`),console.log(` ${ce}2${m}) Production (app.boxel.ai)`),console.log(` ${R}3${m}) Local (localhost:4201)`),console.log(` ${A}4${m}) Custom (enter your own URLs)`);let i=await te(`
|
|
42
|
+
Choice [1/2/3/4]: `);if(i==="4"){let e=await te("Matrix server URL: ");e||(console.error(`${h}Error:${m} Matrix server URL is required.`),process.exit(1));let t=ci(e,"Matrix server URL"),r=await te("Realm server URL: ");r||(console.error(`${h}Error:${m} Realm server URL is required.`),process.exit(1));let n=ci(r,"Realm server URL"),s=new URL(t).hostname||"custom";return{domain:await te(`Domain for Matrix ID [${s}]: `)||s,matrixUrl:t,realmServerUrl:n}}return i==="3"?{...zr.local}:i==="2"?{...zr.production}:{...zr.staging}}async function Hx(i,e){console.log(`
|
|
43
43
|
${ee}Add New Profile${m}
|
|
44
|
-
`);let t,n
|
|
45
|
-
Enter your Boxel username (without @ or domain)`),console.log(`${g}Example: ctse, aallen90${m}`);let s=await te("Username: ");s||(console.error(`${h}Error:${m} Username is required.`),process.exit(1));let o=`@${s}:${t}`;if(
|
|
46
|
-
${A}Profile ${o} already exists.${m}`),(await te("Overwrite? [y/N]: ")).toLowerCase()!=="y")){console.log("Cancelled.");return}let a=await
|
|
47
|
-
${
|
|
48
|
-
Available profiles:`);for(let s of t)console.log(` ${s}`);process.exit(1)}else if(
|
|
49
|
-
Matching profiles:`);for(let s of
|
|
44
|
+
`);let t,r,n;if(e)console.log(`${g}Using BOXEL_ENVIRONMENT=${process.env.BOXEL_ENVIRONMENT}${m}`),t=e.domain,r=e.matrixUrl,n=e.realmServerUrl;else{let u=await Gx();t=u.domain,r=u.matrixUrl,n=u.realmServerUrl}console.log(`
|
|
45
|
+
Enter your Boxel username (without @ or domain)`),console.log(`${g}Example: ctse, aallen90${m}`);let s=await te("Username: ");s||(console.error(`${h}Error:${m} Username is required.`),process.exit(1));let o=`@${s}:${t}`;if(i.getProfile(o)&&(console.log(`
|
|
46
|
+
${A}Profile ${o} already exists.${m}`),(await te("Overwrite? [y/N]: ")).toLowerCase()!=="y")){console.log("Cancelled.");return}let a=await mt("Password: ");a||(console.error(`${h}Error:${m} Password is required.`),process.exit(1));let c=`${s} \xB7 ${t}`,p=await te(`Display name [${c}]: `)||c;await i.addProfile(o,a,p,r,n),console.log(`
|
|
47
|
+
${R}\u2713${m} Profile created: ${me(o)}`),i.getActiveProfileId()===o?console.log(`${g}This profile is now active.${m}`):(await te("Switch to this profile now? [Y/n]: ")).toLowerCase()!=="n"&&(i.switchProfile(o),console.log(`${R}\u2713${m} Switched to ${me(o)}`))}async function Wx(i,e){let t=i.listProfiles(),r=e;if(!t.includes(e)){let n=t.filter(s=>{let o=dt(s);return s.includes(e)||o===e});if(n.length===0){console.error(`${h}Error:${m} Profile not found: ${e}`),console.log(`
|
|
48
|
+
Available profiles:`);for(let s of t)console.log(` ${s}`);process.exit(1)}else if(n.length===1)r=n[0];else{console.error(`${h}Error:${m} Ambiguous profile: ${e}`),console.log(`
|
|
49
|
+
Matching profiles:`);for(let s of n)console.log(` ${s}`);process.exit(1)}}i.switchProfile(r)?console.log(`${R}\u2713${m} Switched to ${me(r)}`):(console.error(`${h}Error:${m} Failed to switch profile.`),process.exit(1))}async function Vx(i,e){if(i.getProfile(e)||(console.error(`${h}Error:${m} Profile not found: ${e}`),process.exit(1)),(await te(`Remove profile ${e}? [y/N]: `)).toLowerCase()!=="y"){console.log("Cancelled.");return}if(await i.removeProfile(e)){console.log(`${R}\u2713${m} Profile removed.`);let n=i.getActiveProfileId();n&&console.log(`Active profile is now: ${me(n)}`)}else console.error(`${h}Error:${m} Failed to remove profile.`),process.exit(1)}async function Bx(i,e,t,r,n,s){(!e.startsWith("@")||!e.includes(":"))&&(console.error(`${h}Error:${m} Invalid Matrix ID format. Expected @user:domain`),process.exit(1));let o=!!i.getProfile(e);try{await i.addProfile(e,t,r,n,s)}catch(c){console.error(`${h}Error:${m} ${c instanceof Error?c.message:String(c)}`),process.exit(1)}if(o){(n||s)&&i.updateUrls(e,{matrixUrl:n,realmServerUrl:s})&&console.log(`${g}Updated server URLs and cleared cached realm tokens.${m}`),console.log(`${R}\u2713${m} Profile updated: ${me(e)}`);return}console.log(`${R}\u2713${m} Profile created: ${me(e)}`),i.getActiveProfileId()!==e&&console.log(`${g}Use 'boxel profile switch ${e}' to switch to this profile.${m}`)}async function zx(i){console.log(`
|
|
50
50
|
${ee}Migrate from .env${m}
|
|
51
|
-
`);let e=process.env.MATRIX_URL,t=process.env.MATRIX_USERNAME,
|
|
52
|
-
Required variables: MATRIX_URL, MATRIX_USERNAME, MATRIX_PASSWORD, REALM_SERVER_URL`);return}let s=await
|
|
53
|
-
${g}You can now remove credentials from .env if desired.${m}`)):(console.log(`${
|
|
54
|
-
${g}Use 'boxel profile add -u ${s.profileId} -p <password>' to update other fields.${m}`)):console.log(`${A}Migration failed.${m}`)}var
|
|
55
|
-
`)},warn(...
|
|
56
|
-
`)},error(...
|
|
57
|
-
`)},output(...
|
|
58
|
-
`)}};function
|
|
59
|
-
\u26A0\uFE0F Detected local realm directories at legacy local paths:`);let t=
|
|
51
|
+
`);let e=process.env.MATRIX_URL,t=process.env.MATRIX_USERNAME,r=process.env.MATRIX_PASSWORD,n=process.env.REALM_SERVER_URL;if(!e||!t||!r||!n){console.log(`${A}No complete credentials found in environment variables.${m}`),console.log(`
|
|
52
|
+
Required variables: MATRIX_URL, MATRIX_USERNAME, MATRIX_PASSWORD, REALM_SERVER_URL`);return}let s=await i.migrateFromEnv();s?s.created?(console.log(`${R}\u2713${m} Created profile: ${me(s.profileId)}`),console.log(`
|
|
53
|
+
${g}You can now remove credentials from .env if desired.${m}`)):(console.log(`${R}\u2713${m} Refreshed profile: ${me(s.profileId)}`),console.log(`
|
|
54
|
+
${g}Use 'boxel profile add -u ${s.profileId} -p <password>' to update other fields.${m}`)):console.log(`${A}Migration failed.${m}`)}var de=T(require("fs")),Me=T(require("path"));var Je=T(require("fs")),W=T(require("path"));var ft=!1,Yx=console.log.bind(console),Jx=console.info.bind(console),Xx=console.debug.bind(console);function pi(i){if(i!==ft)if(ft=i,ft){let e=()=>{};console.log=e,console.info=e,console.debug=e}else console.log=Yx,console.info=Jx,console.debug=Xx}function Yc(){return ft}var j={info(...i){ft||process.stderr.write(i.map(li).join(" ")+`
|
|
55
|
+
`)},warn(...i){process.stderr.write(i.map(li).join(" ")+`
|
|
56
|
+
`)},error(...i){process.stderr.write(i.map(li).join(" ")+`
|
|
57
|
+
`)},output(...i){process.stdout.write(i.map(li).join(" ")+`
|
|
58
|
+
`)}};function li(i){if(typeof i=="string")return i;if(i instanceof Error)return i.stack??i.message;try{return JSON.stringify(i)}catch{return String(i)}}var Jc=!1,Kx=new Set([".git","node_modules","dist",".boxel-history",".claude"]);function Qx(i){return Kx.has(i)}function Zx(i){return i==="stack.cards"||i.endsWith(".stack.cards")?"stack.cards":i==="boxel.ai"||i.endsWith(".boxel.ai")?"boxel.ai":i}function Yr(i){if(!i)return!1;let e;try{e=decodeURIComponent(i)}catch{return!1}return!(e==="."||e===".."||e.includes("/")||e.includes("\\")||e.includes("\0"))}function ev(i){let e;try{e=new URL(i)}catch{return null}let t=Zx(e.hostname);if(!Yr(t))return null;let r=e.pathname.replace(/^\/|\/$/g,"").split("/").filter(Boolean),n=r[0]??"unknown-owner",s=r[1]??r[0]??"workspace";return!Yr(n)||!Yr(s)?null:W.join(t,n,s)}function tv(i,e){let t=ev(i);return t===null?null:W.resolve(e,t)}function iv(i){let e;try{e=Je.readFileSync(i,"utf-8")}catch{return null}let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!="object"||t===null)return null;let r=t.realmUrl;return typeof r!="string"||r===""?null:{realmUrl:r}}function Xc(i,e){let t=W.join(i,".boxel-sync.json");Je.existsSync(t)&&e.push(t)}function ui(i){try{return Je.readdirSync(i,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!Qx(e.name)).map(e=>W.join(i,e.name))}catch{return[]}}function rv(i){let e=[],t=W.resolve(i);for(let r of ui(t))Xc(r,e);for(let r of ui(t))for(let n of ui(r))for(let s of ui(n))Xc(s,e);return e}function nv(i,e){let t=W.relative(i,e);return t===""?!0:t.startsWith("..")?!1:!W.isAbsolute(t)}function Jr(i){let e=W.resolve(i),t=rv(e),r=new Set,n=[];for(let s of t){if(r.has(s))continue;r.add(s);let o=iv(s);if(!o)continue;let a=tv(o.realmUrl,e);if(a===null||!nv(e,a))continue;let c=W.dirname(s);W.resolve(c)!==W.resolve(a)&&n.push({manifestPath:s,currentDir:c,expectedDir:a,realmUrl:o.realmUrl})}return n}function Kc(i){if(Jc||process.env.BOXEL_DISABLE_PATH_WARNING==="1"||Yc())return;let e=Jr(i);if(e.length===0)return;Jc=!0,console.warn(`
|
|
59
|
+
\u26A0\uFE0F Detected local realm directories at legacy local paths:`);let t=W.resolve(i);for(let r of e.slice(0,5)){let n=W.relative(t,r.currentDir)||".",s=W.relative(t,r.expectedDir)||".";console.warn(` - ${n} -> ${s}`)}e.length>5&&console.warn(` ...and ${e.length-5} more`),console.warn(`
|
|
60
60
|
Run to preview:`),console.warn(" boxel consolidate-workspaces . --dry-run"),console.warn("Then apply:"),console.warn(` boxel consolidate-workspaces .
|
|
61
|
-
`)}function
|
|
62
|
-
`);let
|
|
61
|
+
`)}function sv(i){de.existsSync(i)||de.mkdirSync(i,{recursive:!0})}function ov(i,e){try{de.renameSync(i,e)}catch(t){let r=t;if(r.code!=="EXDEV")throw r;de.cpSync(i,e,{recursive:!0}),de.rmSync(i,{recursive:!0,force:!0})}}async function av(i,e){let t=Me.resolve(i||"."),r=Jr(t);if(r.length===0){console.log(`No misplaced local realm paths found under ${t}`);return}console.log(`Found ${r.length} misplaced local realm path(s):
|
|
62
|
+
`);let n=0,s=0;for(let o of r){let a=Me.relative(t,o.currentDir)||".",c=Me.relative(t,o.expectedDir)||".";if(console.log(`- ${a} -> ${c}`),!e.dryRun){if(de.existsSync(o.expectedDir)){console.warn(" Skipping: target path already exists"),s+=1;continue}sv(Me.dirname(o.expectedDir));try{ov(o.currentDir,o.expectedDir),n+=1}catch(l){let p=l instanceof Error?l.message:String(l);console.warn(` Skipping: failed to move (${p})`),s+=1}}}if(e.dryRun){console.log(`
|
|
63
63
|
[DRY RUN] No directories moved.`);return}console.log(`
|
|
64
|
-
Moved ${
|
|
65
|
-
`)}async function
|
|
66
|
-
${g}${
|
|
67
|
-
${g}${t.filenames.length} file(s)${m}`)}})}var
|
|
64
|
+
Moved ${n} director${n===1?"y":"ies"}.`),s>0&&console.log(`Skipped ${s} due to existing target paths or move failures.`)}function Qc(i){i.command("consolidate-workspaces").description("Move local realm mirror directories into the canonical <root>/<domain>/<owner>/<realm> layout").argument("[root-dir]","Root directory to scan (default: current directory)").option("--dry-run","Preview without moving anything").action(async(e,t)=>{await av(e,t)})}function ht(i){if(i.trim()==="")return"Path must be a non-empty realm-relative file path.";if(/^[a-z][a-z0-9+.-]*:/i.test(i))return`Path "${i}" must be realm-relative \u2014 absolute URLs (with a scheme) are not accepted.`;if(i.startsWith("/"))return`Path "${i}" must be realm-relative \u2014 paths starting with "/" are not accepted.`;if(i.includes("\\"))return`Path "${i}" must not contain backslash characters.`;let e;try{e=decodeURIComponent(i)}catch{return`Path "${i}" contains an invalid percent-encoded escape.`}return e.split("/").some(r=>r==="..")?`Path "${i}" must not contain ".." segments \u2014 the path must stay inside the target realm.`:null}var di=require("fs");var Xr=require("fs");var ol=T(nl()),sl="application/octet-stream",hv={".gts":"text/typescript+glimmer",".ts":"text/typescript"};function gv(i){let e=i.lastIndexOf(".");if(e===-1)return sl;let t=i.slice(e).toLowerCase(),r=hv[t];if(r)return r;let n=(0,ol.lookup)(i);return n||sl}function ve(i){let e=gv(i);return e==="image/svg+xml"?!1:e.startsWith("image/")||e.startsWith("font/")||e==="application/pdf"||e==="application/vnd.ms-fontobject"}async function gt(i,e,t,r){let n=r?.profileManager??C();if(!n.getActiveProfile())return{ok:!1,error:P};let o=new URL(e,k(i)).href,a=typeof t!="string",c=ve(e);if(c!==a)return{ok:!1,error:`Path ${e} is ${c?"binary":"text"} by extension but content is ${a?"bytes":"a string"}. Refusing to write to avoid silent corruption.`};try{let l=await n.authedRealmFetch(o,{method:"POST",headers:a?{"Content-Type":"application/octet-stream"}:{Accept:"application/vnd.card+source","Content-Type":"application/vnd.card+source"},body:t});if(!l.ok){let p=await l.text().catch(()=>"(no body)");return{ok:!1,error:`HTTP ${l.status}: ${p.slice(0,300)}`}}return{ok:!0}}catch(l){return{ok:!1,error:l instanceof Error?l.message:String(l)}}}function Xe(i){process.stderr.write(i+`
|
|
65
|
+
`)}async function xv(){let i=[];for await(let e of process.stdin)i.push(e);return Buffer.concat(i).toString("utf-8")}function al(i){i.command("write").description("Write a file to a realm (reads content from STDIN or --file)").argument("<path>","Realm-relative file path (e.g., hello.gts, Cards/my-card.json)").requiredOption("--realm <realm-url>","The realm URL to write to").option("--file <filepath>","Read content from a local file instead of STDIN").option("--json","Output raw JSON response").action(async(e,t)=>{let r;if(t.file){let s=ve(t.file),o=ve(e);s!==o&&(Xe(`${h}Error:${m} source file ${t.file} is ${s?"binary":"text"} but destination path ${e} is ${o?"binary":"text"}. Refusing to write to avoid silent corruption \u2014 rename the destination to match.`),process.exit(1));try{r=s?(0,Xr.readFileSync)(t.file):(0,Xr.readFileSync)(t.file,"utf-8")}catch(a){Xe(`${h}Error:${m} Could not read file: ${a instanceof Error?a.message:String(a)}`),process.exit(1)}}else process.stdin.isTTY&&Xe(`${g}Reading from STDIN. Type or paste content, then press Enter followed by Ctrl+D to finish.${m}`),r=await xv(),Xe(`${g}Received ${r.length} bytes. Writing to realm...${m}`);let n;try{n=await gt(t.realm,e,r)}catch(s){Xe(`${h}Error:${m} ${s instanceof Error?s.message:String(s)}`),process.exit(1)}t.json?j.output(JSON.stringify(n,null,2)):n.ok?console.log(`${R}Written:${m} ${e} ${g}\u2192${m} ${t.realm}`):Xe(`${h}Error:${m} ${n.error}`),n.ok||process.exit(1)})}async function Kr(i,e,t,r){let n=r?.profileManager??C();if(!n.getActiveProfile())return{ok:!1,error:P};let o=`${k(i)}_lint`;try{let a=await n.authedRealmFetch(o,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/vnd.card+source","X-Filename":t,"X-HTTP-Method-Override":"QUERY"},body:e});if(!a.ok){let l=await a.text().catch(()=>"(no body)");return{ok:!1,error:`HTTP ${a.status}: ${l.slice(0,300)}`}}let c=await a.json();return{ok:!0,fixed:c.fixed,output:c.output,messages:c.messages}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}function cl(i){i.command("lint").description("Lint a file in a realm using the realm lint endpoint").argument("<path>","Realm-relative file path to lint (e.g., my-card.gts)").requiredOption("--realm <realm-url>","The realm URL to lint against").option("--file <local-filepath>","Read source from a local file instead of fetching from the realm").option("--json","Output raw JSON response").option("--fix","Write auto-fixed output back to the source").action(async(e,t)=>{let r=C();r.getActiveProfile()||(console.error(`${h}Error:${m} ${P}`),process.exit(1));let s;if(t.file)try{s=(0,di.readFileSync)(t.file,"utf-8")}catch(p){console.error(`${h}Error:${m} Could not read local file: ${p instanceof Error?p.message:String(p)}`),process.exit(1)}else{let p=new URL(e,k(t.realm)).href;try{let u=await r.authedRealmFetch(p,{method:"GET",headers:{Accept:"application/vnd.card+source"}});if(!u.ok){let d=await u.text().catch(()=>"(no body)");console.error(`${h}Error:${m} Could not read file from realm: HTTP ${u.status}: ${d.slice(0,300)}`),process.exit(1)}s=await u.text()}catch(u){console.error(`${h}Error:${m} ${u instanceof Error?u.message:String(u)}`),process.exit(1)}}let o;try{o=await Kr(t.realm,s,e,{profileManager:r})}catch(p){console.error(`${h}Error:${m} ${p instanceof Error?p.message:String(p)}`),process.exit(1)}if(t.json){j.output(JSON.stringify(o,null,2)),o.ok||process.exit(1);return}if(o.ok||(console.error(`${h}Error:${m} ${o.error}`),process.exit(1)),t.fix&&o.fixed&&o.output)if(t.file)(0,di.writeFileSync)(t.file,o.output,"utf-8"),console.log(`${R}Fixed:${m} ${t.file}`);else{let p=await gt(t.realm,e,o.output,{profileManager:r});p.ok||(console.error(`${h}Error:${m} Could not write fixed file: ${p.error}`),process.exit(1)),console.log(`${R}Fixed:${m} ${e} ${g}\u2192${m} ${t.realm}`)}let a=o.messages??[],c=a.filter(p=>p.severity===2),l=a.filter(p=>p.severity===1);if(a.length===0){console.log(`${g}No lint issues found.${m}`);return}for(let p of a){let u=p.severity===2?h:A,d=p.severity===2?"error":"warning",f=p.ruleId?` (${p.ruleId})`:"";console.log(`${u}${d}${m} ${p.line}:${p.column} ${p.message}${g}${f}${m}`)}console.log(`
|
|
66
|
+
${g}${c.length} error(s), ${l.length} warning(s)${m}`),c.length>0&&process.exit(1)})}async function Ne(i,e){let t=e?.profileManager??C();if(!t.getActiveProfile())return{filenames:[],error:P};let n=k(i),s=`${n}_mtimes`;try{let o=await t.authedRealmFetch(s,{method:"GET",headers:{Accept:"application/vnd.api+json"}});if(!o.ok){let p=await o.text().catch(()=>"(no body)");return{filenames:[],error:`_mtimes returned HTTP ${o.status}: ${p.slice(0,300)}`}}let a=await o.json(),c=a?.data?.attributes?.mtimes??a,l=[];for(let p of Object.keys(c)){if(!p.startsWith(n))continue;let u=p.slice(n.length);!u||u.endsWith("/")||l.push(u)}return{filenames:l.sort()}}catch(o){return{filenames:[],error:o instanceof Error?o.message:String(o)}}}function ll(i){i.command("list").alias("ls").description("List all files in a realm").requiredOption("--realm <realm-url>","The realm URL to list files from").option("--json","Output raw JSON response").action(async e=>{let t;try{t=await Ne(e.realm)}catch(r){console.error(`${h}Error:${m} ${r instanceof Error?r.message:String(r)}`),process.exit(1)}if(e.json)j.output(JSON.stringify(t,null,2)),t.error&&process.exit(1);else if(t.error)console.error(`${h}Error:${m} ${t.error}`),process.exit(1);else{for(let r of t.filenames)console.log(`${g}${r}${m}`);console.log(`
|
|
67
|
+
${g}${t.filenames.length} file(s)${m}`)}})}var Qr=[".gts",".gjs",".ts",".js"];async function vv(i,e){let t=e?.profileManager??C();if(!t.getActiveProfile())return fi(P);let n=k(i),s=Date.now(),o;if(e?.path){let u=e.path,d=ht(u);if(d)return fi(d);if(!Qr.some(f=>u.endsWith(f)))return fi(`Path "${u}" is not lintable \u2014 must end with one of ${Qr.join(", ")}`);o=[u]}else{let u=await Ne(n,{profileManager:t});if(u.error)return fi(`Failed to list realm files: ${u.error}`);o=u.filenames.filter(d=>Qr.some(f=>d.endsWith(f)))}if(o.length===0)return{status:"passed",filesChecked:0,filesWithErrors:0,errorCount:0,warningCount:0,durationMs:Date.now()-s,lintableFiles:[],violations:[]};let a=[],c=0,l=0,p=0;for(let u of o){let d;try{let w=new URL(u,n).href,M=await t.authedRealmFetch(w,{method:"GET",headers:{Accept:"application/vnd.card+source"}});if(!M.ok){let Z=await M.text().catch(()=>"(no body)");Zr(u,`HTTP ${M.status}: ${Z.slice(0,300)}`,a),c+=1,l+=1;continue}d=await M.text()}catch(w){Zr(u,w instanceof Error?w.message:String(w),a),c+=1,l+=1;continue}let f=await Kr(n,d,u,{profileManager:t});if(!f.ok){Zr(u,f.error??"lint failed",a),c+=1,l+=1;continue}let x=!1;for(let w of f.messages??[]){let M=w.severity===2?"error":"warning";a.push({rule:w.ruleId,file:u,line:w.line,column:w.column,message:w.message,severity:M}),M==="error"?(l+=1,x=!0):p+=1}x&&(c+=1)}return{status:l===0?"passed":"failed",filesChecked:o.length,filesWithErrors:c,errorCount:l,warningCount:p,durationMs:Date.now()-s,lintableFiles:o,violations:a}}function Zr(i,e,t){t.push({rule:"lint-error",file:i,line:0,column:0,message:e,severity:"error"})}function fi(i){return{status:"error",filesChecked:0,filesWithErrors:0,errorCount:0,warningCount:0,durationMs:0,lintableFiles:[],violations:[],errorMessage:i}}function pl(i){i.command("lint").description("Lint every lintable (.gts/.gjs/.ts/.js) file in a realm via the realm lint endpoint. Pass a realm-relative path to lint a single file.").argument("[path]","Optional realm-relative file path. When omitted, lints every lintable file in the realm.").requiredOption("--realm <realm-url>","The realm URL to lint against").option("--json","Output structured JSON result").action(async(e,t)=>{let r;try{r=await vv(t.realm,e?{path:e}:{})}catch(s){console.error(`${h}Error:${m} ${s instanceof Error?s.message:String(s)}`),process.exit(1)}if(t.json){j.output(JSON.stringify(r,null,2)),r.status!=="passed"&&process.exit(1);return}if(r.errorMessage&&(console.error(`${h}Error:${m} ${r.errorMessage}`),process.exit(1)),r.violations.length===0){console.log(`${g}No lint issues found (${r.filesChecked} file(s) checked).${m}`);return}let n;for(let s of r.violations){s.file!==n&&(n=s.file,console.log(`
|
|
68
68
|
${g}${s.file}${m}`));let o=s.severity==="error"?h:A,a=s.rule?` (${s.rule})`:"";console.log(` ${o}${s.severity}${m} ${s.line}:${s.column} ${s.message}${g}${a}${m}`)}console.log(`
|
|
69
|
-
${g}${
|
|
70
|
-
`)){let
|
|
69
|
+
${g}${r.errorCount} error(s), ${r.warningCount} warning(s) across ${r.filesChecked} file(s)${m}`),r.errorCount>0&&process.exit(1)})}var dl=require("node:child_process"),fe=require("node:fs"),fl=require("node:os"),Y=require("node:path");var hi=require("node:fs"),gi=require("node:path");function xt(i){let e=i;for(;;){let t=(0,gi.join)(e,"package.json");if((0,hi.existsSync)(t))try{if(JSON.parse((0,hi.readFileSync)(t,"utf8"))?.name==="@cardstack/boxel-cli")return e}catch{}let r=(0,gi.dirname)(e);if(r===e)throw new Error("Could not locate the @cardstack/boxel-cli package root walking up from "+i);e=r}}async function en(i,e,t){let r=t?.profileManager??C(),n=r.getActiveProfile();if(!n)return{ok:!1,error:P};let o=`${n.profile.realmServerUrl.replace(/\/$/,"")}/_federated-search`,a=(Array.isArray(i)?i:[i]).map(k);try{let c=await r.authedRealmServerFetch(o,{method:"QUERY",headers:{Accept:"application/vnd.card+json","Content-Type":"application/json"},body:JSON.stringify({realms:a,...e})});if(!c.ok){let p=await c.text();return{ok:!1,status:c.status,error:`HTTP ${c.status}: ${p.slice(0,300)}`}}let l=await c.json();return{ok:!0,status:c.status,data:l.data}}catch(c){return{ok:!1,status:0,error:c instanceof Error?c.message:String(c)}}}function ul(i){i.command("search").description("Federated search across realms using a JSON query").requiredOption("--realm <realm-url>","Realm URL to search (repeatable)",(e,t)=>(t.push(e),t),[]).requiredOption("--query <json>","JSON query object (as a string)").option("--json","Output raw JSON response").action(async e=>{e.realm.length===0&&(console.error(`${h}Error:${m} At least one --realm is required`),process.exit(1));let t;try{let n=JSON.parse(e.query);(typeof n!="object"||n===null||Array.isArray(n))&&(console.error(`${h}Error:${m} --query must be a JSON object, got ${Array.isArray(n)?"array":typeof n}`),process.exit(1)),t=n}catch(n){console.error(`${h}Error:${m} Invalid JSON in --query: ${n instanceof Error?n.message:String(n)}`),process.exit(1);return}let r;try{r=await en(e.realm,t)}catch(n){console.error(`${h}Error:${m} ${n instanceof Error?n.message:String(n)}`),process.exit(1);return}e.json?j.output(JSON.stringify(r,null,2)):r.ok?j.output(JSON.stringify(r.data??[],null,2)):(console.error(`${g}Status:${m} ${r.status??"(no status)"}`),console.error(`${h}Error:${m} ${r.error}`)),r.ok||process.exit(1)})}var bv={module:"https://cardstack.com/base/spec",name:"Spec"},rn=[".gts",".gjs",".ts"],vi=".json",hl=xt(__dirname),nn=(0,Y.resolve)(hl,".."),yv=(0,Y.join)(nn,"base"),vt=(0,Y.join)(nn,"host"),wv=(0,Y.join)(nn,"boxel-ui","addon","src"),Ev=(0,Y.join)(vt,"node_modules"),tn;async function Rv(i,e,t={}){let r=t.totalWaitMs??3e4,n=t.pollMs??250,s=Date.now()+r,o=await i();for(;e(o)&&Date.now()<s;)await new Promise(a=>setTimeout(a,n)),o=await i();return o}async function $v(i,e){let t=e?.profileManager??C();if(!t.getActiveProfile())return xi(P);let n=k(i),s=Date.now(),o=[],a=[];if(e?.path){let u=e.path,d=ht(u);if(d)return xi(d);if(rn.some(f=>u.endsWith(f)))o=[u];else if(u.endsWith(vi))a=[u];else return xi(`Path "${u}" is not parseable \u2014 must end with one of ${rn.join(", ")}, or ${vi}`)}else try{[o,a]=await Promise.all([kv(n,t),Sv(n,t)])}catch(u){return xi(`Failed to discover parseable files: ${u instanceof Error?u.message:String(u)}`)}let c=[...o,...a];if(c.length===0)return{status:"passed",filesChecked:0,filesWithErrors:0,errorCount:0,durationMs:Date.now()-s,parseableFiles:[],errors:[]};let l=[],p=new Set;if(o.length>0){let u=[];for(let d of o){let f=await ml(n,d,t);if(!f.ok){l.push({file:d,line:0,column:0,message:`Could not read ${d}: ${f.error}`}),p.add(d);continue}u.push({path:d,content:f.content})}if(u.length>0)try{let d=await Cv(u);for(let f of d)l.push(f),p.add(f.file)}catch(d){let f=u[0].path;l.push({file:f,line:0,column:0,message:`Glint check failed: ${d instanceof Error?d.message:String(d)}`}),p.add(f)}}for(let u of a){let d=await ml(n,u,t);if(!d.ok){l.push({file:u,line:0,column:0,message:`Could not read ${u}: ${d.error}`}),p.add(u);continue}let f=Ov(u,d.content);for(let x of f)l.push(x),p.add(x.file)}return{status:l.length===0?"passed":"failed",filesChecked:c.length,filesWithErrors:p.size,errorCount:l.length,durationMs:Date.now()-s,parseableFiles:c,errors:l}}async function kv(i,e){let t=`${i}_mtimes`,r=await e.authedRealmFetch(t,{method:"GET",headers:{Accept:"application/vnd.api+json"}});if(!r.ok){let a=await r.text().catch(()=>"(no body)");throw new Error(`_mtimes returned HTTP ${r.status}: ${a.slice(0,300)}`)}let n=await r.json(),s=n?.data?.attributes?.mtimes??n,o=[];for(let a of Object.keys(s)){if(!a.startsWith(i))continue;let c=a.slice(i.length);!c||c.endsWith("/")||rn.some(l=>c.endsWith(l))&&o.push(c)}return o.sort()}async function Sv(i,e){let t=await Rv(()=>en(i,{filter:{type:bv}},{profileManager:e}),s=>s.ok&&(s.data?.length??0)===0);if(!t.ok)return[];let r=[];for(let s of t.data??[]){let o=s.id;if(!o)continue;let a=s.attributes;if(!a||a.specType==="field")continue;let l=s.relationships,p=_v(l),u=new URL(o,i).href,d=[];for(let f of p){let x=new URL(f,u).href;x.startsWith(i)&&d.push(x.slice(i.length))}r.push({specId:o,exampleUrls:d})}let n=[];for(let s of r)for(let o of s.exampleUrls){let a=o.endsWith(vi)?o:`${o}${vi}`;n.includes(a)||n.push(a)}return n.sort()}function _v(i){if(!i)return[];let e=[];for(let t=0;;t++){let r=i[`linkedExamples.${t}`];if(!r?.links?.self)break;e.push(r.links.self)}if(e.length===0){let t=i.linkedExamples;t?.links?.self&&e.push(t.links.self)}return e}async function ml(i,e,t){try{let r=new URL(e,i).href,n=await t.authedRealmFetch(r,{method:"GET",headers:{Accept:"application/vnd.card+source"}});if(!n.ok){let s=await n.text().catch(()=>"(no body)");return{ok:!1,error:`HTTP ${n.status}: ${s.slice(0,300)}`}}return{ok:!0,content:await n.text()}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}}async function Cv(i){let e=(0,fe.mkdtempSync)((0,Y.join)((0,fl.tmpdir)(),"boxel-parse-"));try{for(let a of i){let c=ht(a.path);if(c)throw new Error(c);let l=(0,Y.join)(e,a.path),p=(0,Y.resolve)(l);if(!p.startsWith(e+"/"))throw new Error(`Path "${a.path}" resolves outside the parse workspace and was rejected.`);(0,fe.mkdirSync)((0,Y.dirname)(p),{recursive:!0}),(0,fe.writeFileSync)(p,a.content,"utf8")}if(!tn){let a={compilerOptions:{target:"es2022",allowJs:!0,moduleResolution:"bundler",allowSyntheticDefaultImports:!0,noEmit:!0,baseUrl:".",module:"es2022",strict:!0,experimentalDecorators:!0,skipLibCheck:!0,noUnusedLocals:!1,noUnusedParameters:!1,types:["qunit-dom","@cardstack/local-types"],paths:{"https://cardstack.com/base/*":[`${yv}/*`],"@cardstack/host/tests/*":[`${vt}/tests/*`],"@cardstack/host/*":[`${vt}/app/*`],"@cardstack/boxel-host/commands/*":[`${vt}/app/commands/*`],"@cardstack/boxel-ui/*":[`${wv}/*`],"*":[`${vt}/types/*`]}},include:["**/*.ts","**/*.gts","**/*.gjs"],exclude:["node_modules"]};tn=JSON.stringify(a,null,2)}(0,fe.writeFileSync)((0,Y.join)(e,"tsconfig.json"),tn,"utf8"),(0,fe.symlinkSync)(Ev,(0,Y.join)(e,"node_modules"));let t=(0,Y.join)(hl,"node_modules",".bin","ember-tsc"),{output:r,exitedWithError:n}=await new Promise((a,c)=>{let l=(0,dl.execFile)(t,["--noEmit","--project",(0,Y.join)(e,"tsconfig.json")],{cwd:e,timeout:12e4,maxBuffer:10485760},(p,u,d)=>{if(p&&!u&&!d){c(new Error(`ember-tsc execution failed: ${p.message}`));return}if(l.killed||p?.killed){c(new Error("ember-tsc was killed (timeout or signal)"));return}a({output:u+d,exitedWithError:!!p})})}),s=[],o=0;for(let a of r.split(`
|
|
70
|
+
`)){let c=a.match(/^(.+?)\((\d+),(\d+)\):\s*error\s+(TS\d+):\s*(.+)/);if(!c)continue;o++;let[,l,p,u,d,f]=c,x=(0,Y.resolve)(e,l);if(!x.startsWith(e)||d==="TS2353"&&f.includes("'scoped'"))continue;let w=x.slice(e.length+1),M=i.find(Z=>Z.path===w);M&&s.push({file:M.path,line:parseInt(p,10),column:parseInt(u,10),message:f})}if(n&&s.length===0&&o===0){let a=r.slice(0,500).trim();s.push({file:i[0]?.path??"unknown",line:0,column:0,message:`ember-tsc exited with errors but produced no TS diagnostics. Check the tsconfig paths and node_modules symlink. Output: ${a}`})}return s}finally{try{(0,fe.rmSync)(e,{recursive:!0,force:!0})}catch{}}}function Ov(i,e){let t;try{t=JSON.parse(e)}catch(r){let n=r instanceof Error?r.message:String(r);return[{file:i,line:0,column:0,message:`Invalid JSON: ${n}`}]}return typeof t!="object"||t===null||Array.isArray(t)?[{file:i,line:0,column:0,message:"Card document must be a JSON object"}]:Tv(i,t)}function Tv(i,e){let t=[],r=e.data;if(typeof r!="object"||r===null||Array.isArray(r))return t.push({file:i,line:0,column:0,message:'Card document must have a "data" object'}),t;let n=r;typeof n.type!="string"&&t.push({file:i,line:0,column:0,message:'Card document "data.type" must be a string'});let s=n.meta;if(typeof s!="object"||s===null)t.push({file:i,line:0,column:0,message:'Card document must have a "data.meta" object'});else{let o=s.adoptsFrom;typeof o!="object"||o===null?t.push({file:i,line:0,column:0,message:'Card document must have a "data.meta.adoptsFrom" object with "module" and "name"'}):(typeof o.module!="string"&&t.push({file:i,line:0,column:0,message:'"data.meta.adoptsFrom.module" must be a string'}),typeof o.name!="string"&&t.push({file:i,line:0,column:0,message:'"data.meta.adoptsFrom.name" must be a string'}))}return t}function xi(i){return{status:"error",filesChecked:0,filesWithErrors:0,errorCount:0,durationMs:0,parseableFiles:[],errors:[],errorMessage:i}}function gl(i){i.command("parse").description("Type-check every .gts / .gjs / .ts file in a realm with glint, plus validate the document structure of any .json files linked as Spec.linkedExamples. Pass a realm-relative path to parse a single file. Monorepo-only (relies on packages/base, packages/host, packages/boxel-ui, and @glint/ember-tsc resolvable from this CLI's location).").argument("[path]","Optional realm-relative file path. When omitted, parses every parseable file (gts/gjs/ts + Spec linkedExamples JSON) in the realm.").requiredOption("--realm <realm-url>","The realm URL to parse against").option("--json","Output structured JSON result").action(async(e,t)=>{let r;try{r=await $v(t.realm,e?{path:e}:{})}catch(s){console.error(`${h}Error:${m} ${s instanceof Error?s.message:String(s)}`),process.exit(1)}if(t.json){j.output(JSON.stringify(r,null,2)),r.status!=="passed"&&process.exit(1);return}if(r.errorMessage&&(console.error(`${h}Error:${m} ${r.errorMessage}`),process.exit(1)),r.errors.length===0){console.log(`${g}No parse errors (${r.filesChecked} file(s) checked).${m}`);return}let n;for(let s of r.errors)s.file!==n&&(n=s.file,console.log(`
|
|
71
71
|
${g}${s.file}${m}`)),console.log(` ${h}error${m} ${s.line}:${s.column} ${s.message}`);console.log(`
|
|
72
|
-
${g}${n.errorCount} error(s) across ${n.filesWithErrors} of ${n.filesChecked} file(s)${m}`),n.errorCount>0&&process.exit(1)})}async function uw(r,e,t){let n=t?.profileManager??C();if(!n.getActiveProfile())throw new Error("No active profile. Run `boxel profile add` to create one.");let s=new URL(e,x(r)).href,o;try{o=await n.authedRealmFetch(s,{method:"GET",headers:{Accept:"*/*"}})}catch(l){return{ok:!1,error:l instanceof Error?l.message:String(l)}}if(!o.ok){let l=await o.text().catch(()=>"(no body)");return{ok:!1,status:o.status,error:`HTTP ${o.status}: ${l.slice(0,300)}`}}let a=await o.text();return{ok:!0,status:o.status,content:a}}function oc(r){r.command("read-transpiled").description("Debugging tool ONLY for investigating runtime errors in .gts modules you've written. Use when an eval or instantiate error reports a line/column number \u2014 those line numbers refer to the transpiled output, not your .gts source, so fetching the transpiled output is how you locate the offending source construct. Never use the transpiled output as a reference for how to write code: do not copy its patterns (setComponentTemplate, precompileTemplate, wire-format templates, base64 CSS imports) into source. Always write idiomatic Ember / <template>-tag / CardDef source.").argument("<path>","Realm-relative module path. The .gts extension is optional \u2014 the realm accepts either form.").requiredOption("--realm <realm-url>","The realm URL to fetch from").option("--json","Output raw JSON response").action(async(e,t)=>{let n;try{n=await uw(t.realm,e)}catch(i){console.error(`${h}Error:${m} ${i instanceof Error?i.message:String(i)}`),process.exit(1)}t.json?M.output(JSON.stringify(n,null,2)):n.ok?M.output(n.content??""):(console.error(`${g}Status:${m} ${n.status??"(no status)"}`),console.error(`${h}Error:${m} ${n.error}`)),n.ok||process.exit(1)})}async function fw(r,e){let t=e?.profileManager??C();if(!t.getActiveProfile())return{ok:!1,error:P};let i=e?.cancelPending??!1,s=`${x(r)}_cancel-indexing-job`;try{let o=await t.authedRealmFetch(s,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({cancelPending:i})});if(!o.ok){let a=await o.text().catch(()=>"(no body)");return{ok:!1,error:`HTTP ${o.status}: ${a.slice(0,300)}`}}return{ok:!0}}catch(o){return{ok:!1,error:o instanceof Error?o.message:String(o)}}}function ac(r){r.command("cancel-indexing").description("Cancel running indexing jobs for a realm (use --cancel-pending to also cancel queued jobs)").requiredOption("--realm <realm-url>","URL of the realm to cancel indexing for").option("--cancel-pending","Also cancel queued/pending indexing jobs (default: cancel running only)").option("--json","Output raw JSON response").action(async e=>{let t=await fw(e.realm,{cancelPending:e.cancelPending});if(e.json)M.output(JSON.stringify(t,null,2)),t.ok||process.exit(1);else if(t.ok){let n=e.cancelPending?"running and pending":"running";console.log(`${S}Cancelled ${n} indexing jobs for ${e.realm}${m}`)}else console.error(`${h}Error:${m} ${t.error}`),process.exit(1)})}var mw=Object.freeze({a:"https://boxel-images.boxel.ai/icons/Letter-a.png",b:"https://boxel-images.boxel.ai/icons/Letter-b.png",c:"https://boxel-images.boxel.ai/icons/Letter-c.png",d:"https://boxel-images.boxel.ai/icons/Letter-d.png",e:"https://boxel-images.boxel.ai/icons/Letter-e.png",f:"https://boxel-images.boxel.ai/icons/Letter-f.png",g:"https://boxel-images.boxel.ai/icons/Letter-g.png",h:"https://boxel-images.boxel.ai/icons/Letter-h.png",i:"https://boxel-images.boxel.ai/icons/Letter-i.png",j:"https://boxel-images.boxel.ai/icons/Letter-j.png",k:"https://boxel-images.boxel.ai/icons/Letter-k.png",l:"https://boxel-images.boxel.ai/icons/Letter-l.png",m:"https://boxel-images.boxel.ai/icons/Letter-m.png",n:"https://boxel-images.boxel.ai/icons/Letter-n.png",o:"https://boxel-images.boxel.ai/icons/Letter-o.png",p:"https://boxel-images.boxel.ai/icons/Letter-p.png",q:"https://boxel-images.boxel.ai/icons/Letter-q.png",r:"https://boxel-images.boxel.ai/icons/Letter-r.png",s:"https://boxel-images.boxel.ai/icons/Letter-s.png",t:"https://boxel-images.boxel.ai/icons/Letter-t.png",u:"https://boxel-images.boxel.ai/icons/Letter-u.png",v:"https://boxel-images.boxel.ai/icons/Letter-v.png",w:"https://boxel-images.boxel.ai/icons/Letter-w.png",x:"https://boxel-images.boxel.ai/icons/Letter-x.png",y:"https://boxel-images.boxel.ai/icons/Letter-y.png",z:"https://boxel-images.boxel.ai/icons/letter-z.png"}),lc=Object.freeze(["https://boxel-images.boxel.ai/background-images/4k-arabic-teal.jpg","https://boxel-images.boxel.ai/background-images/4k-arrow-weave.jpg","https://boxel-images.boxel.ai/background-images/4k-atmosphere-curvature.jpg","https://boxel-images.boxel.ai/background-images/4k-brushed-slabs.jpg","https://boxel-images.boxel.ai/background-images/4k-coral-reefs.jpg","https://boxel-images.boxel.ai/background-images/4k-crescent-lake.jpg","https://boxel-images.boxel.ai/background-images/4k-curvilinear-stairs.jpg","https://boxel-images.boxel.ai/background-images/4k-desert-dunes.jpg","https://boxel-images.boxel.ai/background-images/4k-doodle-board.jpg","https://boxel-images.boxel.ai/background-images/4k-fallen-leaves.jpg","https://boxel-images.boxel.ai/background-images/4k-flowing-mesh.jpg","https://boxel-images.boxel.ai/background-images/4k-glass-reflection.jpg","https://boxel-images.boxel.ai/background-images/4k-glow-cells.jpg","https://boxel-images.boxel.ai/background-images/4k-granite-peaks.jpg","https://boxel-images.boxel.ai/background-images/4k-green-wormhole.jpg","https://boxel-images.boxel.ai/background-images/4k-joshua-dawn.jpg","https://boxel-images.boxel.ai/background-images/4k-lava-river.jpg","https://boxel-images.boxel.ai/background-images/4k-leaves-moss.jpg","https://boxel-images.boxel.ai/background-images/4k-light-streaks.jpg","https://boxel-images.boxel.ai/background-images/4k-lowres-glitch.jpg","https://boxel-images.boxel.ai/background-images/4k-marble-shimmer.jpg","https://boxel-images.boxel.ai/background-images/4k-metallic-leather.jpg","https://boxel-images.boxel.ai/background-images/4k-microscopic-crystals.jpg","https://boxel-images.boxel.ai/background-images/4k-moon-face.jpg","https://boxel-images.boxel.ai/background-images/4k-mountain-runway.jpg","https://boxel-images.boxel.ai/background-images/4k-origami-flock.jpg","https://boxel-images.boxel.ai/background-images/4k-paint-swirl.jpg","https://boxel-images.boxel.ai/background-images/4k-pastel-triangles.jpg","https://boxel-images.boxel.ai/background-images/4k-perforated-sheet.jpg","https://boxel-images.boxel.ai/background-images/4k-plastic-ripples.jpg","https://boxel-images.boxel.ai/background-images/4k-powder-puff.jpg","https://boxel-images.boxel.ai/background-images/4k-radiant-crystal.jpg","https://boxel-images.boxel.ai/background-images/4k-redrock-canyon.jpg","https://boxel-images.boxel.ai/background-images/4k-rock-portal.jpg","https://boxel-images.boxel.ai/background-images/4k-rolling-hills.jpg","https://boxel-images.boxel.ai/background-images/4k-sand-stone.jpg","https://boxel-images.boxel.ai/background-images/4k-silver-fur.jpg","https://boxel-images.boxel.ai/background-images/4k-spa-pool.jpg","https://boxel-images.boxel.ai/background-images/4k-stained-glass.jpg","https://boxel-images.boxel.ai/background-images/4k-stone-veins.jpg","https://boxel-images.boxel.ai/background-images/4k-tangerine-plains.jpg","https://boxel-images.boxel.ai/background-images/4k-techno-floor.jpg","https://boxel-images.boxel.ai/background-images/4k-thick-frost.jpg","https://boxel-images.boxel.ai/background-images/4k-water-surface.jpg","https://boxel-images.boxel.ai/background-images/4k-watercolor-splashes.jpg","https://boxel-images.boxel.ai/background-images/4k-wildflower-field.jpg","https://boxel-images.boxel.ai/background-images/4k-wood-grain.jpg"]);function ti(r){if(!r)return;let e=r.toLowerCase().replace(/[^a-z0-9]/g,"").replace(/^[0-9]+/,"");return mw[e.charAt(0)]}function cc(){let r=Math.floor(Math.random()*lc.length);return lc[r]}var dw=/^[a-z0-9-]+$/;function fc(r){r.command("create").description("Create a new realm on the realm server").argument("<realm-name>","realm name (lowercase, numbers, hyphens only)").argument("<display-name>","display name for the realm").option("--background <url>","background image URL").option("--icon <url>","icon image URL").action(async(e,t,n)=>{await gw(e,t,n)})}async function pw(r,e,t={}){let n=t.profileManager??C(),i=n.getActiveProfile();if(!i)throw new Error("No active profile. Run `boxel profile add` to create one.");let s=i.profile.realmServerUrl.replace(/\/$/,""),o={endpoint:r,name:e,backgroundURL:t.background??cc(),iconURL:t.icon??ti(e)??ti(r)},a=await n.authedRealmServerFetch(`${s}/_create-realm`,{method:"POST",headers:{"Content-Type":"application/vnd.api+json"},body:JSON.stringify({data:{type:"realm",attributes:o}})});if(!a.ok){let d;try{d=await a.text()}catch{d="server returned a non-serialized object body"}if(d.includes("[object Object]")&&(d="server returned a non-serialized object body"),d.includes("already exists")){let p=yw(d,s,r),y=await uc(n,p);try{await n.addToUserRealms(p)}catch{}return{realmUrl:p,created:!1,realmToken:y}}throw new Error(`Realm server returned ${a.status}: ${d}`)}let c=(await a.json())?.data?.id;if(typeof c!="string"||c.trim()==="")throw new Error(`Realm server response did not include a realm URL (data.id) for "${r}".`);let u=x(c),f=await uc(n,u);try{await n.addToUserRealms(u)}catch{}return t.waitForReady&&f&&await hw(u,f),{realmUrl:u,created:!0,realmToken:f}}async function uc(r,e){try{let t=await r.getOrRefreshServerToken();return await r.fetchAndStoreRealmToken(e,t)}catch{return}}async function hw(r,e){let t=new URL("_readiness-check",r).href,n=15e3,i=250,s=Date.now(),o;for(;Date.now()-s<n;){try{let a=await fetch(t,{headers:{Accept:"application/vnd.api+json",Authorization:e}});if(a.ok)return;o=`HTTP ${a.status}`}catch(a){o=a instanceof Error?a.message:String(a)}await new Promise(a=>setTimeout(a,i))}throw new Error(`Timed out waiting for realm ${r} to become ready${o?`: ${o}`:""}`)}async function gw(r,e,t){dw.test(r)||(console.error("Error: realm name must contain only lowercase letters, numbers, and hyphens"),process.exit(1));try{let n=await pw(r,e,t),i=n.created?"created":"already exists";console.log(`${S}Realm ${i}:${m} ${_}${n.realmUrl}${m}`)}catch(n){console.error(`Error: ${n instanceof Error?n.message:String(n)}`),process.exit(1)}}function yw(r,e,t){let n=r.match(/'(https?:\/\/[^']+)'/);if(n)return x(n[1]);throw new Error(`Could not determine realm URL from server error response for endpoint "${t}" on "${e}". The response did not include an explicit realm URL.`)}var wt=T(require("fs"));var xc=require("child_process"),X=T(require("fs/promises")),B=T(require("path"));var V=T(require("fs/promises")),W=T(require("path")),fi=T(bc());var li=class{value;next;constructor(e){this.value=e}},gt=class{#e;#t;#r;constructor(){this.clear()}enqueue(e){let t=new li(e);this.#e?(this.#t.next=t,this.#t=t):(this.#e=t,this.#t=t),this.#r++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#r--,this.#e||(this.#t=void 0),e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#r=0}get size(){return this.#r}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}*drain(){for(;this.#e;)yield this.dequeue()}};function ci(r){let e=!1;if(typeof r=="object"&&({concurrency:r,rejectOnClear:e=!1}=r),Rc(r),typeof e!="boolean")throw new TypeError("Expected `rejectOnClear` to be a boolean");let t=new gt,n=0,i=()=>{n<r&&t.size>0&&(n++,t.dequeue().run())},s=()=>{n--,i()},o=async(c,u,f)=>{let d=(async()=>c(...f))();u(d);try{await d}catch{}s()},a=(c,u,f,d)=>{let p={reject:f};new Promise(y=>{p.run=y,t.enqueue(p)}).then(o.bind(void 0,c,u,d)),n<r&&i()},l=(c,...u)=>new Promise((f,d)=>{a(c,f,d,u)});return Object.defineProperties(l,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){if(!e){t.clear();return}let c=AbortSignal.abort().reason;for(;t.size>0;)t.dequeue().reject(c)}},concurrency:{get:()=>r,set(c){Rc(c),r=c,queueMicrotask(()=>{for(;n<r&&t.size>0;)i()})}},map:{async value(c,u){let f=Array.from(c,(d,p)=>this(u,d,p));return Promise.all(f)}}}),l}function Rc(r){if(!((Number.isInteger(r)||r===Number.POSITIVE_INFINITY)&&r>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}var Iw=fi.default.default||fi.default,Nw=new Set([".realm.json"]),ui=1e4,Fw=3e3;function D(r){let e=r.replace(/\\/g,"/").replace(/^\/+/,"");return Nw.has(e)}async function $c(r){try{return await V.access(r),!0}catch{return!1}}function Sc(r){try{return decodeURIComponent(r)}catch{return r}}var yt={CardSource:"application/vnd.card+source",DirectoryListing:"application/vnd.api+json",Mtimes:"application/vnd.api+json"},Dw=10,vc=new Set(["node_modules"]),le=class{constructor(e,t){this.options=e;this.authenticator=t;this.normalizedRealmUrl=this.normalizeRealmUrl(e.realmUrl)}normalizedRealmUrl;ignoreCache=new Map;remoteLimit=ci(Dw);normalizeRealmUrl(e){try{let t=new URL(e),n=t.pathname;return(n.split("/").filter(Boolean).pop()||"").includes(".")?console.warn(`Warning: "${e}" looks like a file URL, not a realm URL.
|
|
73
|
-
Realm URLs should point to a directory (e.g., ${t.origin}${
|
|
74
|
-
Did you mean "${e}/"?`),t.href.replace(/\/+$/,"")+"/"}catch{throw new Error(`Invalid workspace URL: ${e}`)}}buildDirectoryUrl(e=""){if(!e)return this.normalizedRealmUrl;let t=e.replace(/^\/+|\/+$/g,"");return`${this.normalizedRealmUrl}${t}/`}buildFileUrl(e){let t=e.replace(/^\/+/,"");return`${this.normalizedRealmUrl}${t}`}async getRemoteFileList(e=""){let t=new Map;try{let n=this.buildDirectoryUrl(e),i=await this.remoteLimit(()=>this.authenticator.authedRealmFetch(n,{headers:{Accept:"application/vnd.api+json"}}));if(!i.ok){if(i.status===404)return t;throw i.status===401||i.status===403?new Error(`Authentication failed (${i.status}): Cannot access workspace. Check your Matrix credentials and workspace permissions.`):new Error(`Failed to get directory listing: ${i.status} ${i.statusText}`)}let s=await i.json();if(s.data&&s.data.relationships){let o=Object.entries(s.data.relationships),a=await Promise.all(o.map(([l,c])=>{let f=c.meta.kind==="file",d=e?W.posix.join(e,l):l;return f?this.shouldIgnoreRemoteFile(d)?[]:[[d,!0]]:(async()=>{let p=await this.getRemoteFileList(d);return Array.from(p.entries())})()}));for(let l of a)for(let[c,u]of l)t.set(c,u)}}catch(n){throw n instanceof Error&&(n.message.includes("Authentication failed")||n.message.includes("Cannot access workspace")||n.message.includes("401")||n.message.includes("403"))||console.error(`Error reading remote directory ${e}:`,n),n}return t}async getRemoteMtimes(){let e=new Map;try{let t=`${this.normalizedRealmUrl}_mtimes`,n=await this.authenticator.authedRealmFetch(t,{headers:{Accept:yt.Mtimes}});if(!n.ok){if(n.status===404)return console.log("Note: _mtimes endpoint not available, will upload all files"),e;throw new Error(`Failed to get mtimes: ${n.status} ${n.statusText}`)}let i=await n.json();if(i.data?.attributes?.mtimes){let s=Object.entries(i.data.attributes.mtimes);process.env.DEBUG&&(console.log(`Remote mtimes received: ${s.length} entries`),s.length>0&&console.log(`Sample: ${s[0][0]} = ${s[0][1]}`));for(let[o,a]of s){let l=o.replace(this.normalizedRealmUrl,""),c;try{c=decodeURIComponent(l)}catch{c=l}this.shouldIgnoreRemoteFile(c)||e.set(c,a)}}else process.env.DEBUG&&console.log("No mtimes in response:",JSON.stringify(i).slice(0,200))}catch(t){console.warn("Could not fetch remote mtimes, will upload all files:",t)}return e}async getLocalFileListWithMtimes(e=""){let t=new Map,n=W.join(this.options.localDir,e),i;try{i=await V.readdir(n,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return t;throw o}let s=await Promise.all(i.map(async o=>{let a=W.join(n,o.name),l=e?W.posix.join(e,o.name):o.name;if(o.isDirectory()&&vc.has(o.name))return[];if(await this.shouldIgnoreFile(l,a))return[];if(o.isFile()){let c=await V.stat(a);return[[l,{path:a,mtime:c.mtimeMs}]]}else if(o.isDirectory()){let c=await this.getLocalFileListWithMtimes(l);return Array.from(c.entries())}return[]}));for(let o of s)for(let[a,l]of o)t.set(a,l);return t}async getLocalFileList(e=""){let t=new Map,n=W.join(this.options.localDir,e),i;try{i=await V.readdir(n,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return t;throw o}let s=await Promise.all(i.map(async o=>{let a=W.join(n,o.name),l=e?W.posix.join(e,o.name):o.name;if(o.isDirectory()&&vc.has(o.name))return[];if(await this.shouldIgnoreFile(l,a))return[];if(o.isFile())return[[l,a]];if(o.isDirectory()){let c=await this.getLocalFileList(l);return Array.from(c.entries())}return[]}));for(let o of s)for(let[a,l]of o)t.set(a,l);return t}async uploadFile(e,t){if(D(e)){console.log(` Skipped (protected): ${e}`);return}if(console.log(`Uploading: ${e}`),this.options.dryRun){console.log(`[DRY RUN] Would upload ${e}`);return}let n=await V.readFile(t,"utf8"),i=this.buildFileUrl(e),s=await this.authenticator.authedRealmFetch(i,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8",Accept:yt.CardSource},body:n});if(!s.ok)throw new Error(`Failed to upload: ${s.status} ${s.statusText}`);console.log(` Uploaded: ${e}`)}async uploadFilesAtomic(e,t){let n=Array.from(e.entries()).filter(([c])=>!D(c));if(n.length===0)return{succeeded:[]};if(this.options.dryRun){for(let[c]of n)console.log(`[DRY RUN] Would upload ${c}`);return{succeeded:[]}}let i=await Promise.all(n.map(async([c,u])=>{let f=await V.readFile(u,"utf8");return{op:t.has(c)?"add":"update",href:this.buildFileUrl(c),data:{type:"source",attributes:{content:f},meta:{}}}})),s=this.options.waitForIndex?`${this.normalizedRealmUrl}_atomic?waitForIndex=true`:`${this.normalizedRealmUrl}_atomic`,o=await this.authenticator.authedRealmFetch(s,{method:"POST",headers:{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json"},body:JSON.stringify({"atomic:operations":i})});if(o.status===201){let c=await o.json(),u=new Map(n.map(([d])=>[this.buildFileUrl(d),d])),f=(c["atomic:results"]??[]).map(d=>d.data?.id).filter(d=>typeof d=="string").map(d=>Sc(d)).map(d=>u.get(d)??d);for(let d of f)console.log(` Uploaded: ${d}`);return{succeeded:f}}let a={};try{a=await o.json()}catch{}let l=(a.errors??[]).map(c=>{let f=(c.detail??"").match(/Resource (\S+) /),d=f?Sc(f[1]):"";return{path:new Map(n.map(([y])=>[this.buildFileUrl(y),y])).get(d)??d,status:c.status??o.status,title:c.title??"Error"}});return{succeeded:[],error:{status:o.status,perFile:l,message:`Atomic upload failed: ${o.status} ${o.statusText}`}}}async downloadFile(e,t){if(console.log(`Downloading: ${e}`),this.options.dryRun){console.log(`[DRY RUN] Would download ${e}`);return}let n=this.buildFileUrl(e),i=await this.authenticator.authedRealmFetch(n,{headers:{Accept:yt.CardSource}});if(!i.ok)throw new Error(`Failed to download: ${i.status} ${i.statusText}`);let s=await i.text(),o=W.dirname(t);await V.mkdir(o,{recursive:!0}),await V.writeFile(t,s,"utf8"),console.log(` Downloaded: ${e}`)}async deleteFile(e){if(D(e)){console.log(` Skipped (protected): ${e}`);return}if(console.log(`Deleting remote: ${e}`),this.options.dryRun){console.log(`[DRY RUN] Would delete ${e}`);return}let t=this.buildFileUrl(e),n=Date.now(),i;try{i=await this.authenticator.authedRealmFetch(t,{method:"DELETE",headers:{Accept:yt.CardSource},signal:AbortSignal.timeout(ui)})}catch(o){let a=Date.now()-n;if(console.error(` Delete request failed after ${a}ms: ${e}`),o instanceof Error&&(o.name==="TimeoutError"||o.name==="AbortError")){if(await this.verifyDeleteApplied(e)===!0){console.warn(` Delete response timed out after ${ui}ms, but ${e} is already gone on the realm; continuing`);return}throw new Error(`Timed out deleting ${e} after ${ui}ms`,{cause:o})}throw o}let s=Date.now()-n;if(console.log(` Delete response for ${e}: ${i.status} ${i.statusText} (${s}ms)`),!i.ok&&i.status!==404)throw new Error(`Failed to delete: ${i.status} ${i.statusText}`);console.log(` Deleted: ${e}`)}async verifyDeleteApplied(e){let t=this.buildFileUrl(e);try{let n=await this.authenticator.authedRealmFetch(t,{headers:{Accept:yt.CardSource},signal:AbortSignal.timeout(Fw)});return console.warn(` Delete-timeout probe for ${e}: ${n.status} ${n.statusText}`),n.status===404}catch(n){return console.warn(` Delete-timeout probe failed for ${e}:`,n),"unknown"}}async deleteLocalFile(e){if(console.log(`Deleting local: ${e}`),this.options.dryRun){console.log(`[DRY RUN] Would delete local file ${e}`);return}try{await V.unlink(e),console.log(` Deleted: ${e}`)}catch(t){if(t.code!=="ENOENT")throw t}}getIgnoreInstance(e){let t=this.ignoreCache.get(e);if(t)return t;let n=(async()=>{let i=Iw(),s=e,o=this.options.localDir;for(;s.startsWith(o);){let a=W.join(s,".gitignore");if(await $c(a))try{let u=await V.readFile(a,"utf8");i.add(u)}catch(u){console.warn(`Warning: Could not read .gitignore file at ${a}:`,u)}let l=W.join(s,".boxelignore");if(await $c(l))try{let u=await V.readFile(l,"utf8");i.add(u)}catch(u){console.warn(`Warning: Could not read .boxelignore file at ${l}:`,u)}let c=W.dirname(s);if(c===s)break;s=c}return i})();return this.ignoreCache.set(e,n),n}async shouldIgnoreFile(e,t){let n=W.basename(e);if(n===".boxel-sync.json"||n.startsWith("."))return!0;let i=W.dirname(t),s=await this.getIgnoreInstance(i),o=e.replace(/\\/g,"/");return s.ignores(o)}shouldIgnoreRemoteFile(e){return!!W.basename(e).startsWith(".")}};async function mi(r){try{return await X.access(r),!0}catch{return!1}}var j=class{workspaceDir;gitDir;constructor(e){this.workspaceDir=B.resolve(e),this.gitDir=B.join(this.workspaceDir,".boxel-history")}async init(){await mi(this.gitDir)||await X.mkdir(this.gitDir,{recursive:!0});let e=B.join(this.gitDir,".git");await mi(e)||(await this.git("init"),await this.git("config","user.email","boxel-cli@local"),await this.git("config","user.name","Boxel CLI"),await this.git("commit","--allow-empty","-m","[init] Initialize checkpoint history"))}async isInitialized(){return mi(B.join(this.gitDir,".git"))}async syncFilesToHistory(){let e=await this.getWorkspaceFiles(),t=new Set(e),n=await this.getHistoryFiles();await Promise.all(n.map(async i=>{if(!t.has(i)){let s=B.join(this.gitDir,i);try{await X.unlink(s)}catch(o){if(o.code!=="ENOENT")throw o}}})),await Promise.all(e.map(async i=>{let s=B.join(this.workspaceDir,i),o=B.join(this.gitDir,i),a=B.dirname(o);await X.mkdir(a,{recursive:!0}),await X.copyFile(s,o)}))}async getWorkspaceFiles(){let e=[],t=async(n,i="")=>{let s;try{s=await X.readdir(n,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return;throw o}await Promise.all(s.map(async o=>{if(o.name===".boxel-history"||o.name===".boxel-sync.json"||o.name==="node_modules"||o.name.startsWith("."))return;let a=i?`${i}/${o.name}`:o.name;o.isDirectory()?await t(B.join(n,o.name),a):e.push(a)}))};return await t(this.workspaceDir),e}async getHistoryFiles(){let e=[],t=async(n,i="")=>{let s;try{s=await X.readdir(n,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return;throw o}await Promise.all(s.map(async o=>{if(o.name===".git")return;let a=i?`${i}/${o.name}`:o.name;o.isDirectory()?await t(B.join(n,o.name),a):e.push(a)}))};return await t(this.gitDir),e}async detectCurrentChanges(){if(!await this.isInitialized())return(await this.getWorkspaceFiles()).map(i=>({file:i,status:"added"}));await this.syncFilesToHistory();let e=(await this.git("status","--porcelain")).replace(/\n+$/,"");if(!e)return[];let t=[];for(let n of e.split(`
|
|
75
|
-
`)){if(!
|
|
72
|
+
${g}${r.errorCount} error(s) across ${r.filesWithErrors} of ${r.filesChecked} file(s)${m}`),r.errorCount>0&&process.exit(1)})}async function Pv(i,e,t){let r=t?.profileManager??C();if(!r.getActiveProfile())throw new Error("No active profile. Run `boxel profile add` to create one.");let s=new URL(e,k(i)).href,o;try{o=await r.authedRealmFetch(s,{method:"GET",headers:{Accept:"*/*"}})}catch(c){return{ok:!1,error:c instanceof Error?c.message:String(c)}}if(!o.ok){let c=await o.text().catch(()=>"(no body)");return{ok:!1,status:o.status,error:`HTTP ${o.status}: ${c.slice(0,300)}`}}let a=await o.text();return{ok:!0,status:o.status,content:a}}function xl(i){i.command("read-transpiled").description("Debugging tool ONLY for investigating runtime errors in .gts modules you've written. Use when an eval or instantiate error reports a line/column number \u2014 those line numbers refer to the transpiled output, not your .gts source, so fetching the transpiled output is how you locate the offending source construct. Never use the transpiled output as a reference for how to write code: do not copy its patterns (setComponentTemplate, precompileTemplate, wire-format templates, base64 CSS imports) into source. Always write idiomatic Ember / <template>-tag / CardDef source.").argument("<path>","Realm-relative module path. The .gts extension is optional \u2014 the realm accepts either form.").requiredOption("--realm <realm-url>","The realm URL to fetch from").option("--json","Output raw JSON response").action(async(e,t)=>{let r;try{r=await Pv(t.realm,e)}catch(n){console.error(`${h}Error:${m} ${n instanceof Error?n.message:String(n)}`),process.exit(1)}t.json?j.output(JSON.stringify(r,null,2)):r.ok?j.output(r.content??""):(console.error(`${g}Status:${m} ${r.status??"(no status)"}`),console.error(`${h}Error:${m} ${r.error}`)),r.ok||process.exit(1)})}async function Av(i,e){let t=e?.profileManager??C();if(!t.getActiveProfile())return{ok:!1,error:P};let n=e?.cancelPending??!1,s=`${k(i)}_cancel-indexing-job`;try{let o=await t.authedRealmFetch(s,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({cancelPending:n})});if(!o.ok){let a=await o.text().catch(()=>"(no body)");return{ok:!1,error:`HTTP ${o.status}: ${a.slice(0,300)}`}}return{ok:!0}}catch(o){return{ok:!1,error:o instanceof Error?o.message:String(o)}}}function vl(i){i.command("cancel-indexing").description("Cancel running indexing jobs for a realm (use --cancel-pending to also cancel queued jobs)").requiredOption("--realm <realm-url>","URL of the realm to cancel indexing for").option("--cancel-pending","Also cancel queued/pending indexing jobs (default: cancel running only)").option("--json","Output raw JSON response").action(async e=>{let t=await Av(e.realm,{cancelPending:e.cancelPending});if(e.json)j.output(JSON.stringify(t,null,2)),t.ok||process.exit(1);else if(t.ok){let r=e.cancelPending?"running and pending":"running";console.log(`${R}Cancelled ${r} indexing jobs for ${e.realm}${m}`)}else console.error(`${h}Error:${m} ${t.error}`),process.exit(1)})}var Lv=Object.freeze({a:"https://boxel-images.boxel.ai/icons/Letter-a.png",b:"https://boxel-images.boxel.ai/icons/Letter-b.png",c:"https://boxel-images.boxel.ai/icons/Letter-c.png",d:"https://boxel-images.boxel.ai/icons/Letter-d.png",e:"https://boxel-images.boxel.ai/icons/Letter-e.png",f:"https://boxel-images.boxel.ai/icons/Letter-f.png",g:"https://boxel-images.boxel.ai/icons/Letter-g.png",h:"https://boxel-images.boxel.ai/icons/Letter-h.png",i:"https://boxel-images.boxel.ai/icons/Letter-i.png",j:"https://boxel-images.boxel.ai/icons/Letter-j.png",k:"https://boxel-images.boxel.ai/icons/Letter-k.png",l:"https://boxel-images.boxel.ai/icons/Letter-l.png",m:"https://boxel-images.boxel.ai/icons/Letter-m.png",n:"https://boxel-images.boxel.ai/icons/Letter-n.png",o:"https://boxel-images.boxel.ai/icons/Letter-o.png",p:"https://boxel-images.boxel.ai/icons/Letter-p.png",q:"https://boxel-images.boxel.ai/icons/Letter-q.png",r:"https://boxel-images.boxel.ai/icons/Letter-r.png",s:"https://boxel-images.boxel.ai/icons/Letter-s.png",t:"https://boxel-images.boxel.ai/icons/Letter-t.png",u:"https://boxel-images.boxel.ai/icons/Letter-u.png",v:"https://boxel-images.boxel.ai/icons/Letter-v.png",w:"https://boxel-images.boxel.ai/icons/Letter-w.png",x:"https://boxel-images.boxel.ai/icons/Letter-x.png",y:"https://boxel-images.boxel.ai/icons/Letter-y.png",z:"https://boxel-images.boxel.ai/icons/letter-z.png"}),bl=Object.freeze(["https://boxel-images.boxel.ai/background-images/4k-arabic-teal.jpg","https://boxel-images.boxel.ai/background-images/4k-arrow-weave.jpg","https://boxel-images.boxel.ai/background-images/4k-atmosphere-curvature.jpg","https://boxel-images.boxel.ai/background-images/4k-brushed-slabs.jpg","https://boxel-images.boxel.ai/background-images/4k-coral-reefs.jpg","https://boxel-images.boxel.ai/background-images/4k-crescent-lake.jpg","https://boxel-images.boxel.ai/background-images/4k-curvilinear-stairs.jpg","https://boxel-images.boxel.ai/background-images/4k-desert-dunes.jpg","https://boxel-images.boxel.ai/background-images/4k-doodle-board.jpg","https://boxel-images.boxel.ai/background-images/4k-fallen-leaves.jpg","https://boxel-images.boxel.ai/background-images/4k-flowing-mesh.jpg","https://boxel-images.boxel.ai/background-images/4k-glass-reflection.jpg","https://boxel-images.boxel.ai/background-images/4k-glow-cells.jpg","https://boxel-images.boxel.ai/background-images/4k-granite-peaks.jpg","https://boxel-images.boxel.ai/background-images/4k-green-wormhole.jpg","https://boxel-images.boxel.ai/background-images/4k-joshua-dawn.jpg","https://boxel-images.boxel.ai/background-images/4k-lava-river.jpg","https://boxel-images.boxel.ai/background-images/4k-leaves-moss.jpg","https://boxel-images.boxel.ai/background-images/4k-light-streaks.jpg","https://boxel-images.boxel.ai/background-images/4k-lowres-glitch.jpg","https://boxel-images.boxel.ai/background-images/4k-marble-shimmer.jpg","https://boxel-images.boxel.ai/background-images/4k-metallic-leather.jpg","https://boxel-images.boxel.ai/background-images/4k-microscopic-crystals.jpg","https://boxel-images.boxel.ai/background-images/4k-moon-face.jpg","https://boxel-images.boxel.ai/background-images/4k-mountain-runway.jpg","https://boxel-images.boxel.ai/background-images/4k-origami-flock.jpg","https://boxel-images.boxel.ai/background-images/4k-paint-swirl.jpg","https://boxel-images.boxel.ai/background-images/4k-pastel-triangles.jpg","https://boxel-images.boxel.ai/background-images/4k-perforated-sheet.jpg","https://boxel-images.boxel.ai/background-images/4k-plastic-ripples.jpg","https://boxel-images.boxel.ai/background-images/4k-powder-puff.jpg","https://boxel-images.boxel.ai/background-images/4k-radiant-crystal.jpg","https://boxel-images.boxel.ai/background-images/4k-redrock-canyon.jpg","https://boxel-images.boxel.ai/background-images/4k-rock-portal.jpg","https://boxel-images.boxel.ai/background-images/4k-rolling-hills.jpg","https://boxel-images.boxel.ai/background-images/4k-sand-stone.jpg","https://boxel-images.boxel.ai/background-images/4k-silver-fur.jpg","https://boxel-images.boxel.ai/background-images/4k-spa-pool.jpg","https://boxel-images.boxel.ai/background-images/4k-stained-glass.jpg","https://boxel-images.boxel.ai/background-images/4k-stone-veins.jpg","https://boxel-images.boxel.ai/background-images/4k-tangerine-plains.jpg","https://boxel-images.boxel.ai/background-images/4k-techno-floor.jpg","https://boxel-images.boxel.ai/background-images/4k-thick-frost.jpg","https://boxel-images.boxel.ai/background-images/4k-water-surface.jpg","https://boxel-images.boxel.ai/background-images/4k-watercolor-splashes.jpg","https://boxel-images.boxel.ai/background-images/4k-wildflower-field.jpg","https://boxel-images.boxel.ai/background-images/4k-wood-grain.jpg"]);function sn(i){if(!i)return;let e=i.toLowerCase().replace(/[^a-z0-9]/g,"").replace(/^[0-9]+/,"");return Lv[e.charAt(0)]}function yl(){let i=Math.floor(Math.random()*bl.length);return bl[i]}var jv=/^[a-z0-9-]+$/;function El(i){i.command("create").description("Create a new realm on the realm server").argument("<realm-name>","realm name (lowercase, numbers, hyphens only)").argument("<display-name>","display name for the realm").option("--background <url>","background image URL").option("--icon <url>","icon image URL").action(async(e,t,r)=>{await Nv(e,t,r)})}async function Mv(i,e,t={}){let r=t.profileManager??C(),n=r.getActiveProfile();if(!n)throw new Error("No active profile. Run `boxel profile add` to create one.");let s=n.profile.realmServerUrl.replace(/\/$/,""),o={endpoint:i,name:e,backgroundURL:t.background??yl(),iconURL:t.icon??sn(e)??sn(i)},a=await r.authedRealmServerFetch(`${s}/_create-realm`,{method:"POST",headers:{"Content-Type":"application/vnd.api+json"},body:JSON.stringify({data:{type:"realm",attributes:o}})});if(!a.ok){let d;try{d=await a.text()}catch{d="server returned a non-serialized object body"}if(d.includes("[object Object]")&&(d="server returned a non-serialized object body"),d.includes("already exists")){let f=Fv(d,s,i),x=await wl(r,f);try{await r.addToUserRealms(f)}catch{}return{realmUrl:f,created:!1,realmToken:x}}throw new Error(`Realm server returned ${a.status}: ${d}`)}let l=(await a.json())?.data?.id;if(typeof l!="string"||l.trim()==="")throw new Error(`Realm server response did not include a realm URL (data.id) for "${i}".`);let p=k(l),u=await wl(r,p);try{await r.addToUserRealms(p)}catch{}return t.waitForReady&&u&&await Iv(p,u),{realmUrl:p,created:!0,realmToken:u}}async function wl(i,e){try{let t=await i.getOrRefreshServerToken();return await i.fetchAndStoreRealmToken(e,t)}catch{return}}async function Iv(i,e){let t=new URL("_readiness-check",i).href,r=15e3,n=250,s=Date.now(),o;for(;Date.now()-s<r;){try{let a=await fetch(t,{headers:{Accept:"application/vnd.api+json",Authorization:e}});if(a.ok)return;o=`HTTP ${a.status}`}catch(a){o=a instanceof Error?a.message:String(a)}await new Promise(a=>setTimeout(a,n))}throw new Error(`Timed out waiting for realm ${i} to become ready${o?`: ${o}`:""}`)}async function Nv(i,e,t){jv.test(i)||(console.error("Error: realm name must contain only lowercase letters, numbers, and hyphens"),process.exit(1));try{let r=await Mv(i,e,t),n=r.created?"created":"already exists";console.log(`${R}Realm ${n}:${m} ${_}${r.realmUrl}${m}`)}catch(r){console.error(`Error: ${r instanceof Error?r.message:String(r)}`),process.exit(1)}}function Fv(i,e,t){let r=i.match(/'(https?:\/\/[^']+)'/);if(r)return k(r[1]);throw new Error(`Could not determine realm URL from server error response for endpoint "${t}" on "${e}". The response did not include an explicit realm URL.`)}var yt=T(require("fs"));var Nl=require("child_process"),X=T(require("fs/promises")),B=T(require("path"));var D=T(require("fs/promises")),V=T(require("path")),hn=T(Pl());var mn=class{value;next;constructor(e){this.value=e}},bt=class{#e;#t;#i;constructor(){this.clear()}enqueue(e){let t=new mn(e);this.#e?(this.#t.next=t,this.#t=t):(this.#e=t,this.#t=t),this.#i++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#i--,this.#e||(this.#t=void 0),e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#i=0}get size(){return this.#i}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}*drain(){for(;this.#e;)yield this.dequeue()}};function dn(i){let e=!1;if(typeof i=="object"&&({concurrency:i,rejectOnClear:e=!1}=i),Al(i),typeof e!="boolean")throw new TypeError("Expected `rejectOnClear` to be a boolean");let t=new bt,r=0,n=()=>{r<i&&t.size>0&&(r++,t.dequeue().run())},s=()=>{r--,n()},o=async(l,p,u)=>{let d=(async()=>l(...u))();p(d);try{await d}catch{}s()},a=(l,p,u,d)=>{let f={reject:u};new Promise(x=>{f.run=x,t.enqueue(f)}).then(o.bind(void 0,l,p,d)),r<i&&n()},c=(l,...p)=>new Promise((u,d)=>{a(l,u,d,p)});return Object.defineProperties(c,{activeCount:{get:()=>r},pendingCount:{get:()=>t.size},clearQueue:{value(){if(!e){t.clear();return}let l=AbortSignal.abort().reason;for(;t.size>0;)t.dequeue().reject(l)}},concurrency:{get:()=>i,set(l){Al(l),i=l,queueMicrotask(()=>{for(;r<i&&t.size>0;)n()})}},map:{async value(l,p){let u=Array.from(l,(d,f)=>this(p,d,f));return Promise.all(u)}}}),c}function Al(i){if(!((Number.isInteger(i)||i===Number.POSITIVE_INFINITY)&&i>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}var ib=hn.default.default||hn.default,rb=new Set([".realm.json"]),fn=1e4,nb=3e3;function F(i){let e=i.replace(/\\/g,"/").replace(/^\/+/,"");return rb.has(e)}async function Ll(i){try{return await D.access(i),!0}catch{return!1}}function jl(i){try{return decodeURIComponent(i)}catch{return i}}async function Ml(i,e){let t=await i.text().catch(()=>""),r=`Failed to upload ${e}: ${i.status} ${i.statusText}${t?` \u2014 ${t.slice(0,200)}`:""}`,n=new Error(r);throw n.status=i.status,n.body=t,n}var Ke={CardSource:"application/vnd.card+source",DirectoryListing:"application/vnd.api+json",Mtimes:"application/vnd.api+json",OctetStream:"application/octet-stream"},sb=10,Il=new Set(["node_modules"]),le=class{constructor(e,t){this.options=e;this.authenticator=t;this.normalizedRealmUrl=this.normalizeRealmUrl(e.realmUrl)}normalizedRealmUrl;ignoreCache=new Map;remoteLimit=dn(sb);normalizeRealmUrl(e){try{let t=new URL(e),r=t.pathname;return(r.split("/").filter(Boolean).pop()||"").includes(".")?console.warn(`Warning: "${e}" looks like a file URL, not a realm URL.
|
|
73
|
+
Realm URLs should point to a directory (e.g., ${t.origin}${r.replace(/\/[^/]*\.[^/]*$/,"/")})`):e.endsWith("/")||console.warn(`Warning: Realm URL should end with a trailing slash.
|
|
74
|
+
Did you mean "${e}/"?`),t.href.replace(/\/+$/,"")+"/"}catch{throw new Error(`Invalid workspace URL: ${e}`)}}buildDirectoryUrl(e=""){if(!e)return this.normalizedRealmUrl;let t=e.replace(/^\/+|\/+$/g,"");return`${this.normalizedRealmUrl}${t}/`}buildFileUrl(e){let t=e.replace(/^\/+/,"");return`${this.normalizedRealmUrl}${t}`}async getRemoteFileList(e=""){let t=new Map;try{let r=this.buildDirectoryUrl(e),n=await this.remoteLimit(()=>this.authenticator.authedRealmFetch(r,{headers:{Accept:"application/vnd.api+json"}}));if(!n.ok){if(n.status===404)return t;throw n.status===401||n.status===403?new Error(`Authentication failed (${n.status}): Cannot access workspace. Check your Matrix credentials and workspace permissions.`):new Error(`Failed to get directory listing: ${n.status} ${n.statusText}`)}let s=await n.json();if(s.data&&s.data.relationships){let o=Object.entries(s.data.relationships),a=await Promise.all(o.map(([c,l])=>{let u=l.meta.kind==="file",d=e?V.posix.join(e,c):c;return u?this.shouldIgnoreRemoteFile(d)?[]:[[d,!0]]:(async()=>{let f=await this.getRemoteFileList(d);return Array.from(f.entries())})()}));for(let c of a)for(let[l,p]of c)t.set(l,p)}}catch(r){throw r instanceof Error&&(r.message.includes("Authentication failed")||r.message.includes("Cannot access workspace")||r.message.includes("401")||r.message.includes("403"))||console.error(`Error reading remote directory ${e}:`,r),r}return t}async getRemoteMtimes(){let e=new Map;try{let t=`${this.normalizedRealmUrl}_mtimes`,r=await this.authenticator.authedRealmFetch(t,{headers:{Accept:Ke.Mtimes}});if(!r.ok){if(r.status===404)return console.log("Note: _mtimes endpoint not available, will upload all files"),e;throw new Error(`Failed to get mtimes: ${r.status} ${r.statusText}`)}let n=await r.json();if(n.data?.attributes?.mtimes){let s=Object.entries(n.data.attributes.mtimes);process.env.DEBUG&&(console.log(`Remote mtimes received: ${s.length} entries`),s.length>0&&console.log(`Sample: ${s[0][0]} = ${s[0][1]}`));for(let[o,a]of s){let c=o.replace(this.normalizedRealmUrl,""),l;try{l=decodeURIComponent(c)}catch{l=c}this.shouldIgnoreRemoteFile(l)||e.set(l,a)}}else process.env.DEBUG&&console.log("No mtimes in response:",JSON.stringify(n).slice(0,200))}catch(t){console.warn("Could not fetch remote mtimes, will upload all files:",t)}return e}async getLocalFileListWithMtimes(e=""){let t=new Map,r=V.join(this.options.localDir,e),n;try{n=await D.readdir(r,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return t;throw o}let s=await Promise.all(n.map(async o=>{let a=V.join(r,o.name),c=e?V.posix.join(e,o.name):o.name;if(o.isDirectory()&&Il.has(o.name))return[];if(await this.shouldIgnoreFile(c,a))return[];if(o.isFile()){let l=await D.stat(a);return[[c,{path:a,mtime:l.mtimeMs}]]}else if(o.isDirectory()){let l=await this.getLocalFileListWithMtimes(c);return Array.from(l.entries())}return[]}));for(let o of s)for(let[a,c]of o)t.set(a,c);return t}async getLocalFileList(e=""){let t=new Map,r=V.join(this.options.localDir,e),n;try{n=await D.readdir(r,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return t;throw o}let s=await Promise.all(n.map(async o=>{let a=V.join(r,o.name),c=e?V.posix.join(e,o.name):o.name;if(o.isDirectory()&&Il.has(o.name))return[];if(await this.shouldIgnoreFile(c,a))return[];if(o.isFile())return[[c,a]];if(o.isDirectory()){let l=await this.getLocalFileList(c);return Array.from(l.entries())}return[]}));for(let o of s)for(let[a,c]of o)t.set(a,c);return t}async uploadFile(e,t){if(F(e)){console.log(` Skipped (protected): ${e}`);return}if(console.log(`Uploading: ${e}`),this.options.dryRun){console.log(`[DRY RUN] Would upload ${e}`);return}if(ve(e)){await this.uploadBinaryFile(e,t),console.log(` Uploaded: ${e}`);return}let r=await D.readFile(t,"utf8"),n=this.buildFileUrl(e),s=await this.authenticator.authedRealmFetch(n,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8",Accept:Ke.CardSource},body:r});s.ok||await Ml(s,e),console.log(` Uploaded: ${e}`)}async uploadBinaryFile(e,t){let r=await D.readFile(t),n=this.buildFileUrl(e),s=await this.authenticator.authedRealmFetch(n,{method:"POST",headers:{"Content-Type":Ke.OctetStream},body:r});s.ok||await Ml(s,e)}async uploadFilesAtomic(e,t){let r=Array.from(e.entries()).filter(([l])=>!F(l));if(r.length===0)return{succeeded:[]};if(this.options.dryRun){for(let[l]of r)console.log(`[DRY RUN] Would upload ${l}`);return{succeeded:[]}}let n=[],s=[];for(let l of r)ve(l[0])?s.push(l):n.push(l);let[o,a]=await Promise.all([this.uploadBinaryBatch(s),this.uploadTextAtomic(n,t)]),c=[...a.succeeded,...o.succeeded];return a.fatal?{succeeded:c,error:{status:a.fatal.status,perFile:[...a.failed,...o.failed],message:a.fatal.message}}:o.failed.length>0?{succeeded:c,error:{status:o.failed[0].status,perFile:o.failed,message:`Binary upload failed for ${o.failed.length} file(s)`}}:{succeeded:c}}async uploadBinaryBatch(e){if(e.length===0)return{succeeded:[],failed:[]};let t=await Promise.allSettled(e.map(([s,o])=>this.remoteLimit(async()=>{try{return await this.uploadBinaryFile(s,o),console.log(` Uploaded: ${s}`),{relativePath:s,ok:!0}}catch(a){let c=a,l=typeof c?.status=="number"?c.status:500,p=a instanceof Error?a.message:String(a);return{relativePath:s,ok:!1,status:l,title:p}}}))),r=[],n=[];for(let s=0;s<t.length;s++){let o=t[s];o.status==="fulfilled"?o.value.ok?r.push(o.value.relativePath):n.push({path:o.value.relativePath,status:o.value.status,title:o.value.title}):n.push({path:e[s][0],status:500,title:String(o.reason)})}return{succeeded:r,failed:n}}async uploadTextAtomic(e,t){if(e.length===0)return{succeeded:[],failed:[]};let r=await Promise.all(e.map(async([l,p])=>{let u=await D.readFile(p,"utf8");return{op:t.has(l)?"add":"update",href:this.buildFileUrl(l),data:{type:"source",attributes:{content:u},meta:{}}}})),n=this.options.waitForIndex?`${this.normalizedRealmUrl}_atomic?waitForIndex=true`:`${this.normalizedRealmUrl}_atomic`,s=await this.authenticator.authedRealmFetch(n,{method:"POST",headers:{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json"},body:JSON.stringify({"atomic:operations":r})}),o=new Map(e.map(([l])=>[this.buildFileUrl(l),l]));if(s.status===201){let p=((await s.json())["atomic:results"]??[]).map(u=>u.data?.id).filter(u=>typeof u=="string").map(u=>jl(u)).map(u=>o.get(u)??u);for(let u of p)console.log(` Uploaded: ${u}`);return{succeeded:p,failed:[]}}let a={};try{a=await s.json()}catch{}let c=(a.errors??[]).map(l=>{let u=(l.detail??"").match(/Resource (\S+) /),d=u?jl(u[1]):"";return{path:o.get(d)??d,status:l.status??s.status,title:l.title??"Error"}});return{succeeded:[],failed:c,fatal:{status:s.status,message:`Atomic upload failed: ${s.status} ${s.statusText}`}}}async downloadFile(e,t){if(console.log(`Downloading: ${e}`),this.options.dryRun){console.log(`[DRY RUN] Would download ${e}`);return}let r=this.buildFileUrl(e),n=await this.authenticator.authedRealmFetch(r,{headers:{Accept:Ke.CardSource}});if(!n.ok)throw new Error(`Failed to download: ${n.status} ${n.statusText}`);let s=V.dirname(t);if(await D.mkdir(s,{recursive:!0}),ve(e)){let o=Buffer.from(await n.arrayBuffer());await D.writeFile(t,o)}else{let o=await n.text();await D.writeFile(t,o,"utf8")}console.log(` Downloaded: ${e}`)}async deleteFile(e){if(F(e)){console.log(` Skipped (protected): ${e}`);return}if(console.log(`Deleting remote: ${e}`),this.options.dryRun){console.log(`[DRY RUN] Would delete ${e}`);return}let t=this.buildFileUrl(e),r=Date.now(),n;try{n=await this.authenticator.authedRealmFetch(t,{method:"DELETE",headers:{Accept:Ke.CardSource},signal:AbortSignal.timeout(fn)})}catch(o){let a=Date.now()-r;if(console.error(` Delete request failed after ${a}ms: ${e}`),o instanceof Error&&(o.name==="TimeoutError"||o.name==="AbortError")){if(await this.verifyDeleteApplied(e)===!0){console.warn(` Delete response timed out after ${fn}ms, but ${e} is already gone on the realm; continuing`);return}throw new Error(`Timed out deleting ${e} after ${fn}ms`,{cause:o})}throw o}let s=Date.now()-r;if(console.log(` Delete response for ${e}: ${n.status} ${n.statusText} (${s}ms)`),!n.ok&&n.status!==404)throw new Error(`Failed to delete: ${n.status} ${n.statusText}`);console.log(` Deleted: ${e}`)}async verifyDeleteApplied(e){let t=this.buildFileUrl(e);try{let r=await this.authenticator.authedRealmFetch(t,{headers:{Accept:Ke.CardSource},signal:AbortSignal.timeout(nb)});return console.warn(` Delete-timeout probe for ${e}: ${r.status} ${r.statusText}`),r.status===404}catch(r){return console.warn(` Delete-timeout probe failed for ${e}:`,r),"unknown"}}async deleteLocalFile(e){if(console.log(`Deleting local: ${e}`),this.options.dryRun){console.log(`[DRY RUN] Would delete local file ${e}`);return}try{await D.unlink(e),console.log(` Deleted: ${e}`)}catch(t){if(t.code!=="ENOENT")throw t}}getIgnoreInstance(e){let t=this.ignoreCache.get(e);if(t)return t;let r=(async()=>{let n=ib(),s=e,o=this.options.localDir;for(;s.startsWith(o);){let a=V.join(s,".gitignore");if(await Ll(a))try{let p=await D.readFile(a,"utf8");n.add(p)}catch(p){console.warn(`Warning: Could not read .gitignore file at ${a}:`,p)}let c=V.join(s,".boxelignore");if(await Ll(c))try{let p=await D.readFile(c,"utf8");n.add(p)}catch(p){console.warn(`Warning: Could not read .boxelignore file at ${c}:`,p)}let l=V.dirname(s);if(l===s)break;s=l}return n})();return this.ignoreCache.set(e,r),r}async shouldIgnoreFile(e,t){let r=V.basename(e);if(r===".boxel-sync.json"||r.startsWith("."))return!0;let n=V.dirname(t),s=await this.getIgnoreInstance(n),o=e.replace(/\\/g,"/");return s.ignores(o)}shouldIgnoreRemoteFile(e){return!!V.basename(e).startsWith(".")}};async function gn(i){try{return await X.access(i),!0}catch{return!1}}var q=class{workspaceDir;gitDir;constructor(e){this.workspaceDir=B.resolve(e),this.gitDir=B.join(this.workspaceDir,".boxel-history")}async init(){await gn(this.gitDir)||await X.mkdir(this.gitDir,{recursive:!0});let e=B.join(this.gitDir,".git");await gn(e)||(await this.git("init"),await this.git("config","user.email","boxel-cli@local"),await this.git("config","user.name","Boxel CLI"),await this.git("commit","--allow-empty","-m","[init] Initialize checkpoint history"))}async isInitialized(){return gn(B.join(this.gitDir,".git"))}async syncFilesToHistory(){let e=await this.getWorkspaceFiles(),t=new Set(e),r=await this.getHistoryFiles();await Promise.all(r.map(async n=>{if(!t.has(n)){let s=B.join(this.gitDir,n);try{await X.unlink(s)}catch(o){if(o.code!=="ENOENT")throw o}}})),await Promise.all(e.map(async n=>{let s=B.join(this.workspaceDir,n),o=B.join(this.gitDir,n),a=B.dirname(o);await X.mkdir(a,{recursive:!0}),await X.copyFile(s,o)}))}async getWorkspaceFiles(){let e=[],t=async(r,n="")=>{let s;try{s=await X.readdir(r,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return;throw o}await Promise.all(s.map(async o=>{if(o.name===".boxel-history"||o.name===".boxel-sync.json"||o.name==="node_modules"||o.name.startsWith("."))return;let a=n?`${n}/${o.name}`:o.name;o.isDirectory()?await t(B.join(r,o.name),a):e.push(a)}))};return await t(this.workspaceDir),e}async getHistoryFiles(){let e=[],t=async(r,n="")=>{let s;try{s=await X.readdir(r,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return;throw o}await Promise.all(s.map(async o=>{if(o.name===".git")return;let a=n?`${n}/${o.name}`:o.name;o.isDirectory()?await t(B.join(r,o.name),a):e.push(a)}))};return await t(this.gitDir),e}async detectCurrentChanges(){if(!await this.isInitialized())return(await this.getWorkspaceFiles()).map(n=>({file:n,status:"added"}));await this.syncFilesToHistory();let e=(await this.git("status","--porcelain")).replace(/\n+$/,"");if(!e)return[];let t=[];for(let r of e.split(`
|
|
75
|
+
`)){if(!r)continue;let n=r.substring(0,2),s=r.substring(3);if(n.includes("R")){let o=s.indexOf(" -> ");if(o!==-1){let a=s.substring(0,o),c=s.substring(o+4);t.push({file:a,status:"deleted"}),t.push({file:c,status:"added"});continue}}n.includes("D")?t.push({file:s,status:"deleted"}):n.includes("A")||n.includes("C")||n==="??"?t.push({file:s,status:"added"}):(n.includes("M")||n.includes("U")||n.includes("T"))&&t.push({file:s,status:"modified"})}return t}async createCheckpoint(e,t,r){if(await this.isInitialized()||await this.init(),await this.syncFilesToHistory(),await this.git("add","-A"),!(await this.git("status","--porcelain")).trim())return null;let s=this.classifyChanges(t),{message:o,description:a}=r?{message:r,description:""}:this.generateCommitMessage(e,t,s),c=s?"[MAJOR]":"[minor]",l=`[${e}]`,p=`${c} ${l} ${o}${a?`
|
|
76
76
|
|
|
77
|
-
`+a:""}`;await this.git("commit","-m",
|
|
78
|
-
`)}}async getCheckpoints(e=50){if(!await this.isInitialized())return[];let
|
|
79
|
-
`).filter(o=>!(o.split("|")[2]??"").startsWith("[init]"));return Promise.all(s.map(o=>this.parseCheckpointLine(o,
|
|
80
|
-
`),
|
|
81
|
-
`).filter(Boolean)}async getDiff(e){return this.git("show","--format=",e)}async restore(e){let t=await this.getHistoryFiles();await Promise.all(t.map(async o=>{let a=B.join(this.gitDir,o);try{await X.unlink(a)}catch(
|
|
82
|
-
`).filter(
|
|
83
|
-
`).filter(Boolean))try{let
|
|
84
|
-
`).map(
|
|
77
|
+
`+a:""}`;await this.git("commit","-m",p);let u=(await this.git("rev-parse","HEAD")).trim(),d=u.substring(0,7);return{hash:u,shortHash:d,message:o,description:a,date:new Date,isMajor:s,filesChanged:t.length,insertions:0,deletions:0,source:e,isMilestone:!1}}classifyChanges(e){if(e.length>3)return!0;for(let t of e)if(t.status==="added"||t.status==="deleted"||t.file.endsWith(".gts"))return!0;return!1}generateCommitMessage(e,t,r){let n=e==="local"?"Push":e==="remote"?"Pull":"Manual";if(t.length===0)return{message:`${n}: No changes detected`,description:""};if(t.length===1){let u=t[0],d=u.status==="added"?"Add":u.status==="deleted"?"Delete":"Update";return{message:`${n}: ${d} ${u.file}`,description:""}}let s=t.filter(u=>u.status==="added"),o=t.filter(u=>u.status==="modified"),a=t.filter(u=>u.status==="deleted"),c=[];s.length>0&&c.push(`+${s.length}`),o.length>0&&c.push(`~${o.length}`),a.length>0&&c.push(`-${a.length}`);let l=`${n}: ${t.length} files (${c.join(", ")})`,p=[];return s.length>0&&(p.push("Added:"),s.forEach(u=>p.push(` + ${u.file}`))),o.length>0&&(p.push("Modified:"),o.forEach(u=>p.push(` ~ ${u.file}`))),a.length>0&&(p.push("Deleted:"),a.forEach(u=>p.push(` - ${u.file}`))),{message:l,description:p.join(`
|
|
78
|
+
`)}}async getCheckpoints(e=50){if(!await this.isInitialized())return[];let r=await this.git("log","--format=%H|%h|%s|%aI|%an",`-${e}`);if(!r.trim())return[];let n=await this.getAllMilestones(),s=r.trim().split(`
|
|
79
|
+
`).filter(o=>!(o.split("|")[2]??"").startsWith("[init]"));return Promise.all(s.map(o=>this.parseCheckpointLine(o,n)))}async parseCheckpointLine(e,t){let[r,n,s,o]=e.split("|"),a=s.includes("[MAJOR]"),c=s.includes("[local]")?"local":s.includes("[remote]")?"remote":"manual",l=s.replace(/\[(MAJOR|minor)\]\s*/i,"").replace(/\[(local|remote|manual)\]\s*/i,""),p=await this.getCommitStats(r),u=t.get(r),d=!!u;return{hash:r,shortHash:n,message:l,description:"",date:new Date(o),isMajor:a,source:c,isMilestone:d,milestoneName:u,...p}}async getCommitStats(e){try{let r=(await this.git("show","--stat","--format=",e)).trim().split(`
|
|
80
|
+
`),n=r[r.length-1]||"",s=n.match(/(\d+) files? changed/),o=n.match(/(\d+) insertions?/),a=n.match(/(\d+) deletions?/);return{filesChanged:s?parseInt(s[1]):0,insertions:o?parseInt(o[1]):0,deletions:a?parseInt(a[1]):0}}catch{return{filesChanged:0,insertions:0,deletions:0}}}async getChangedFiles(e){return(await this.git("show","--name-only","--format=",e)).trim().split(`
|
|
81
|
+
`).filter(Boolean)}async getDiff(e){return this.git("show","--format=",e)}async restore(e){let t=await this.getHistoryFiles();await Promise.all(t.map(async o=>{let a=B.join(this.gitDir,o);try{await X.unlink(a)}catch(c){if(c.code!=="ENOENT")throw c}})),await this.git("checkout",e,"--",".");let r=await this.getHistoryFiles(),n=new Set(r),s=await this.getWorkspaceFiles();await Promise.all(s.map(async o=>{if(!F(o)&&!n.has(o)){let a=B.join(this.workspaceDir,o);try{await X.unlink(a)}catch(c){if(c.code!=="ENOENT")throw c}}})),await Promise.all(r.map(async o=>{if(F(o))return;let a=B.join(this.gitDir,o),c=B.join(this.workspaceDir,o),l=B.dirname(c);await X.mkdir(l,{recursive:!0}),await X.copyFile(a,c)})),await this.git("checkout","HEAD","--",".")}async markMilestone(e,t){if(!await this.isInitialized())return null;let r;if(typeof e=="number"){let s=await this.getCheckpoints(e+1);if(e<1||e>s.length)return null;r=s[e-1].hash}else r=e;let n=`milestone/${t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-_.]/g,"")}`;try{return await this.git("tag","-a",n,r,"-m",`Milestone: ${t}`),{hash:r,name:t}}catch{return null}}async unmarkMilestone(e){if(!await this.isInitialized())return!1;let t;if(typeof e=="number"){let n=await this.getCheckpoints(e+1);if(e<1||e>n.length)return!1;t=n[e-1].hash}else t=e;let r=await this.getMilestoneTags(t);if(r.length===0)return!1;for(let n of r)try{await this.git("tag","-d",n)}catch{}return!0}async getMilestoneTags(e){try{return(await this.git("tag","--points-at",e)).trim().split(`
|
|
82
|
+
`).filter(r=>r.startsWith("milestone/")).filter(Boolean)}catch{return[]}}async getAllMilestones(){let e=new Map;try{let t=await this.git("tag","-l","milestone/*");for(let r of t.trim().split(`
|
|
83
|
+
`).filter(Boolean))try{let n=(await this.git("rev-list","-1",r)).trim(),s=r.replace("milestone/","").replace(/-/g," ");e.set(n,s)}catch{}}catch{}return e}async getMilestones(){if(!await this.isInitialized())return[];let e=await this.getAllMilestones();if(e.size===0)return[];let r=await this.git("log","--no-walk","--format=%H|%h|%s|%aI|%an",...e.keys());return r.trim()?Promise.all(r.trim().split(`
|
|
84
|
+
`).map(n=>this.parseCheckpointLine(n,e))):[]}git(...e){return new Promise((t,r)=>{let n=(0,Nl.spawn)("git",e,{cwd:this.gitDir}),s="",o="";n.stdout.on("data",a=>{s+=a.toString("utf-8")}),n.stderr.on("data",a=>{o+=a.toString("utf-8")}),n.on("error",a=>r(a)),n.on("close",a=>{if(a!==0&&!e.includes("status")){r(new Error(`git ${e.join(" ")} failed: ${o}`));return}t(s)})})}};function yi(i,e){let t=i.trim();if(t==="")return{kind:"none"};if(t.length===7){let n=e.filter(s=>s.shortHash===t);if(n.length===1)return{kind:"found",target:n[0]};if(n.length>1)return{kind:"ambiguous",matches:n}}if(/^\d+$/.test(t)){let n=parseInt(t,10);return n>=1&&n<=e.length?{kind:"found",target:e[n-1]}:{kind:"none"}}let r=e.filter(n=>n.hash.startsWith(t));return r.length===0?{kind:"none"}:r.length===1?{kind:"found",target:r[0]}:{kind:"ambiguous",matches:r}}var Fl=100;function wi(i){return i instanceof Error?i.message:String(i)}async function ob(i,e){if(!yt.existsSync(i))return{ok:!1,error:`Directory not found: ${i}`};try{let t=new q(i);if(!await t.isInitialized())return{ok:!0,checkpoints:[],truncated:!1};let r=await t.getCheckpoints(e+1),n=r.length>e;return{ok:!0,checkpoints:n?r.slice(0,e):r,truncated:n}}catch(t){return{ok:!1,error:`Failed to read checkpoint history: ${wi(t)}`}}}async function ab(i,e){if(!yt.existsSync(i))return{ok:!1,error:`Directory not found: ${i}`};let t=e.trim();if(!t)return{ok:!1,error:"--message must not be empty."};try{let r=new q(i);await r.isInitialized()||await r.init();let n=await r.detectCurrentChanges(),s=await r.createCheckpoint("manual",n,t);return s?{ok:!0,created:s}:{ok:!1,error:"No changes to checkpoint."}}catch(r){return{ok:!1,error:`Failed to create checkpoint: ${wi(r)}`}}}async function cb(i,e,t){if(!yt.existsSync(i))return{ok:!1,error:`Directory not found: ${i}`};try{let r=new q(i);if(!await r.isInitialized())return{ok:!1,error:"No checkpoint history found for this workspace. Checkpoints are created automatically during sync operations."};let n=await r.getCheckpoints(t),s=yi(e,n);if(s.kind==="none")return{ok:!1,error:`Checkpoint not found: ${e}. Use a number (1-${n.length}) or a commit hash.`};if(s.kind==="ambiguous"){let o=s.matches.slice(0,5).map(c=>c.shortHash).join(", "),a=s.matches.length>5?", \u2026":"";return{ok:!1,error:`Ambiguous reference: ${e} matches ${s.matches.length} checkpoints (${o}${a}). Use a longer prefix or full hash.`}}return{ok:!0,target:s.target}}catch(r){return{ok:!1,error:`Failed to read checkpoint history: ${wi(r)}`}}}async function lb(i,e){if(!yt.existsSync(i))return{ok:!1,error:`Directory not found: ${i}`};try{let t=new q(i);return await t.isInitialized()?(await t.restore(e),{ok:!0}):{ok:!1,error:"No checkpoint history found for this workspace."}}catch(t){return{ok:!1,error:`Failed to restore checkpoint: ${wi(t)}`}}}function pb(i){return i==="local"?`${R}LOCAL${m}`:i==="remote"?`${_}SERVER${m}`:`${ce}MANUAL${m}`}function Ul(i){let e=Date.now()-i.getTime(),t=Math.floor(e/6e4),r=Math.floor(t/60),n=Math.floor(r/24);return n>7?`${i.toLocaleDateString()} ${i.toLocaleTimeString()}`:n>0?`${n} day${n===1?"":"s"} ago`:r>0?`${r} hour${r===1?"":"s"} ago`:t>0?`${t} minute${t===1?"":"s"} ago`:"just now"}function ub(i,e,t){if(i.length===0){console.log("No checkpoints found.");return}console.log(`
|
|
85
85
|
${ee}Checkpoint History${m}
|
|
86
|
-
`);let
|
|
87
|
-
`)}),e&&console.log(`${g}Showing first ${t} checkpoints. Pass --limit <n> to see more.${m}`),console.log(`${g}Restore: boxel realm history <local-dir> -r <ref>${m}`)}function
|
|
88
|
-
${ee}Restoring to:${m} ${A}${o.shortHash}${m} - ${o.message}`),console.log(`${g}${
|
|
89
|
-
`);let
|
|
86
|
+
`);let r=String(i.length).length;i.forEach((n,s)=>{let o=s+1,a=`${g}${String(o).padStart(r," ")}${m}`,c=n.isMajor?`${A}[MAJOR]${m}`:`${g}[minor]${m}`,l=n.isMilestone?`${A}\u2B50${m} ${ce}[${n.milestoneName}]${m} `:"";console.log(`${a} ${A}${n.shortHash}${m} ${l}${pb(n.source)} ${c} ${n.message} ${g}(${n.filesChanged} files)${m}`),console.log(` ${g}${Ul(n.date)}${m}
|
|
87
|
+
`)}),e&&console.log(`${g}Showing first ${t} checkpoints. Pass --limit <n> to see more.${m}`),console.log(`${g}Restore: boxel realm history <local-dir> -r <ref>${m}`)}function mb(i){if(i===void 0)return Fl;if(!/^\d+$/.test(i))return null;let e=parseInt(i,10);return e>0?e:null}function Fe(i){console.error(`${h}Error:${m} ${i}`),process.exit(1)}function Dl(i){i.command("history").alias("hist").description("View, restore, or create local checkpoints stored under .boxel-history/").argument("<local-dir>","The local workspace directory").option("-r, --restore <ref>","Restore the workspace to a checkpoint (1-based index, short hash, or full hash)").option("-m, --message <message>","Create a manual checkpoint with the given message").option("-y, --yes","Skip the interactive confirmation prompt before --restore").option("--limit <n>",`Maximum number of checkpoints to list or consider for --restore (default: ${Fl})`).action(async(e,t)=>{t.restore!==void 0&&t.message!==void 0&&Fe("Only one of --restore or --message may be specified.");let r=mb(t.limit);if(r===null&&Fe("--limit must be a positive integer."),t.message!==void 0){let s=await ab(e,t.message);s.ok||Fe(s.error),console.log(`${R}\u2713${m} Checkpoint created: ${A}${s.created.shortHash}${m} ${s.created.message}`);return}if(t.restore!==void 0){let s=await cb(e,t.restore,r);s.ok||Fe(s.error);let o=s.target;if(!t.yes){process.stdin.isTTY||Fe("--restore overwrites local files. Pass --yes to confirm in non-interactive mode."),console.log(`
|
|
88
|
+
${ee}Restoring to:${m} ${A}${o.shortHash}${m} - ${o.message}`),console.log(`${g}${Ul(o.date)}${m}
|
|
89
|
+
`);let c=await te(`${A}This will overwrite current files. Continue? (y/N) ${m}`);if(!/^y/i.test(c)){console.log(`${g}Restore cancelled.${m}`);return}}let a=await lb(e,o.hash);a.ok||Fe(a.error),console.log(`${R}\u2713${m} Restored to ${A}${o.shortHash}${m} ${o.message}`),console.log(`${g}Run 'boxel realm sync <local-dir> <realm-url> --prefer-local' to push the restored state to the realm.${m}`);return}let n=await ob(e,r);n.ok||Fe(n.error),ub(n.checkpoints,n.truncated,r)})}var db="--all-accessible and --hidden are mutually exclusive";async function fb(i={}){if(i.allAccessible&&i.hidden)return{realms:[],error:db};let e=i.profileManager??C(),t=e.getActiveProfile();if(!t)return{realms:[],error:P};let r=t.profile.realmServerUrl.replace(/\/$/,""),n=await e.authedRealmServerFetch(`${r}/_realm-auth`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"}});if(!n.ok){let p=await n.text();return{realms:[],error:`Realm auth lookup failed: ${n.status} ${p}`}}let s=await n.json(),o=Object.keys(s).map(k),a;try{a=await e.getUserRealms()}catch(p){return{realms:[],error:`Failed to load UI realm list: ${p instanceof Error?p.message:String(p)}`}}let c=new Set(a.map(k)),l=o.map(p=>({url:p,hidden:!c.has(p)}));return i.allAccessible||(i.hidden?l=l.filter(p=>p.hidden):l=l.filter(p=>!p.hidden)),l.sort((p,u)=>p.url.localeCompare(u.url)),{realms:l}}function ql(i){i.command("list").alias("ls").description("List realms accessible to the active profile").option("--json","Output JSON").option("--all-accessible","Show all accessible realms, including hidden ones").option("--hidden","Show only realms not in the user's UI realm list").action(async e=>{let t;try{t=await fb({allAccessible:e.allAccessible,hidden:e.hidden})}catch(r){console.error(`${h}Error:${m} ${r instanceof Error?r.message:String(r)}`),process.exit(1)}if(e.json){console.log(JSON.stringify(t,null,2)),t.error&&process.exit(1);return}if(t.error&&(console.error(`${h}Error:${m} ${t.error}`),process.exit(1)),t.realms.length===0){console.log(`${g}No realms found.${m}`);return}console.log(`${ee}${t.realms.length} realm(s):${m}`);for(let r of t.realms){let n=r.hidden?` ${g}(hidden)${m}`:"";console.log(` ${_}${r.url}${m}${n}`)}})}var Ri=T(require("fs"));var xn=100;function $i(i){return i instanceof Error?i.message:String(i)}function hb(i){let e=Date.now()-i.getTime(),t=Math.floor(e/6e4),r=Math.floor(t/60),n=Math.floor(r/24);return n>7?`${i.toLocaleDateString()} ${i.toLocaleTimeString()}`:n>0?`${n} day${n===1?"":"s"} ago`:r>0?`${r} hour${r===1?"":"s"} ago`:t>0?`${t} minute${t===1?"":"s"} ago`:"just now"}async function Gl(i,e,t){try{let r=new q(i);if(!await r.isInitialized())return{ok:!1,error:"No checkpoint history found for this workspace. Checkpoints are created automatically during sync operations."};let n=await r.getCheckpoints(t),s=yi(e,n);if(s.kind==="none")return{ok:!1,error:`Checkpoint not found: ${e}. Use a number (1-${n.length}) or a commit hash.`};if(s.kind==="ambiguous"){let o=s.matches.slice(0,5).map(c=>c.shortHash).join(", "),a=s.matches.length>5?", \u2026":"";return{ok:!1,error:`Ambiguous reference: ${e} matches ${s.matches.length} checkpoints (${o}${a}). Use a longer prefix or full hash.`}}return{ok:!0,target:s.target}}catch(r){return{ok:!1,error:`Failed to read checkpoints: ${$i(r)}`}}}async function gb(i){if(!Ri.existsSync(i))return{ok:!1,error:`Directory not found: ${i}`};try{let e=new q(i);return await e.isInitialized()?{ok:!0,milestones:await e.getMilestones()}:{ok:!0,milestones:[]}}catch(e){return{ok:!1,error:`Failed to read milestones: ${$i(e)}`}}}async function xb(i,e,t,r){if(!Ri.existsSync(i))return{ok:!1,error:`Directory not found: ${i}`};let n=t.trim();if(!n)return{ok:!1,error:"--name must not be empty."};let s=await Gl(i,e,r);if(!s.ok)return s;try{let o=new q(i);if(!await o.markMilestone(s.target.hash,n))return{ok:!1,error:"Could not mark milestone. The checkpoint may already have one."};let l=(await o.getCheckpoints(r)).find(p=>p.hash===s.target.hash);return l?{ok:!0,marked:l}:{ok:!1,error:"Milestone created but checkpoint could not be re-read."}}catch(o){return{ok:!1,error:`Failed to mark milestone: ${$i(o)}`}}}async function vb(i,e,t){if(!Ri.existsSync(i))return{ok:!1,error:`Directory not found: ${i}`};let r=await Gl(i,e,t);if(!r.ok)return r;let n=r.target;if(!n.isMilestone)return{ok:!1,error:`Checkpoint ${n.shortHash} is not marked as a milestone.`};try{return{ok:!0,removed:await new q(i).unmarkMilestone(n.hash)}}catch(s){return{ok:!1,error:`Failed to remove milestone: ${$i(s)}`}}}async function bb(i,e={}){if(e.mark!==void 0&&e.remove!==void 0)return{ok:!1,error:"Only one of --mark or --remove may be specified."};if(e.limit!==void 0&&(!Number.isInteger(e.limit)||e.limit<=0))return{ok:!1,error:"limit must be a positive integer."};let t=e.limit??xn;if(e.mark!==void 0){if(e.name===void 0)return{ok:!1,error:"--name is required when using --mark."};let n=await xb(i,e.mark,e.name,t);return n.ok?{ok:!0,marked:n.marked}:{ok:!1,error:n.error}}if(e.remove!==void 0){let n=await vb(i,e.remove,t);return n.ok?{ok:!0,removed:n.removed}:{ok:!1,error:n.error}}let r=await gb(i);return r.ok?{ok:!0,milestones:r.milestones}:{ok:!1,error:r.error}}function yb(i,e){if(i.length===0){console.log(`
|
|
90
90
|
No milestones marked yet.
|
|
91
91
|
`),console.log(`Use ${_}boxel realm milestone <local-dir> --mark <ref> --name <name>${m} to mark a checkpoint.`),console.log(`Use ${_}boxel realm history <local-dir>${m} to see available checkpoints.
|
|
92
92
|
`);return}console.log(`
|
|
93
93
|
${ee}Milestones${m} ${g}(${e})${m}
|
|
94
|
-
`);for(let t of
|
|
95
|
-
${
|
|
96
|
-
Checkpoint created before deletion: ${
|
|
97
|
-
Deleting ${
|
|
98
|
-
Checkpoint created: ${
|
|
99
|
-
Checkpoint created: ${d.shortHash} ${p} ${d.message}`)}}console.log("Push completed")}};function Gc(r){r.command("push").description("Push local files to a Boxel realm").argument("<local-dir>","The local directory containing files to sync").argument("<realm-url>","The URL of the target realm (e.g., https://app.boxel.ai/demo/)").option("--delete","Delete remote files that do not exist locally").option("--dry-run","Show what would be done without making changes").option("--force","Upload all files, even if unchanged").option("--realm-secret-seed","Administrative auth: prompt for a realm secret seed and mint a JWT locally instead of using a Matrix profile (env: BOXEL_REALM_SECRET_SEED)").action(async(e,t,n)=>{let i=await ge(n.realmSecretSeed===!0);await dE(e,t,{delete:n.delete,dryRun:n.dryRun,force:n.force,realmSecretSeed:i})})}async function dE(r,e,t){let n;if(t.authenticator)n=t.authenticator;else{let i=ye({realmUrl:e,realmSecretSeed:t.realmSecretSeed,profileManager:t.profileManager});i.ok||(console.error(`Error: ${i.error}`),process.exit(1)),n=i.authenticator}await Je(r)||(console.error(`Local directory does not exist: ${r}`),process.exit(1));try{let i=new wi({realmUrl:e,localDir:r,deleteRemote:t.delete,dryRun:t.dryRun,force:t.force},n);await i.sync(),i.hasError?(console.log("Push did not complete successfully. View logs for details"),process.exit(2)):console.log("Push completed successfully")}catch(i){console.error("Push failed:",i),process.exit(1)}}async function Hc(r){let e=x(r.realmUrl.trim()),t=r.profileManager??C(),n=t.getActiveProfile();if(!n)return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:0,nextCount:0,error:P};let i;try{i=await t.getUserRealms()}catch(d){return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:0,nextCount:0,error:`Failed to load realm list: ${d instanceof Error?d.message:String(d)}`}}let s=i.map(x),o=s.length,a=s.filter(d=>d===e).length;if(a===0)return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:o,nextCount:o,notInList:!0,error:"Realm is not in app.boxel.realms. Nothing to remove."};let l=o-a;if(r.dryRun)return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:o,nextCount:l};let c=n.profile.realmServerUrl.replace(/\/$/,""),u;try{u=await t.authedRealmServerFetch(`${c}/_delete-realm`,{method:"DELETE",headers:{"Content-Type":"application/vnd.api+json"},body:JSON.stringify({data:{type:"realm",id:e}})})}catch(d){return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:o,nextCount:o,error:`Failed to reach realm server: ${d instanceof Error?d.message:String(d)}`}}if(!u.ok){let d=await pE(u),p=u.status===403?`You do not own this realm and cannot delete it on the server. Server returned 403: ${d}`:`Realm server returned ${u.status}: ${d}`;return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:o,nextCount:o,error:p}}let f;try{f=await t.removeFromUserRealms(e)}catch(d){return{realmUrl:e,removed:!1,serverDeleted:!0,unlinked:!1,previousCount:o,nextCount:o,error:`Server delete succeeded, but Matrix unlink failed: ${d instanceof Error?d.message:String(d)}`}}return f?{realmUrl:e,removed:!0,serverDeleted:!0,unlinked:f,previousCount:o,nextCount:l}:{realmUrl:e,removed:!1,serverDeleted:!0,unlinked:!1,previousCount:o,nextCount:o,error:"Server delete succeeded, but Matrix account_data did not contain the URL by the time we PUT (concurrent edit?). Server-side files are gone; please refresh and check your realm list."}}async function pE(r){try{return await r.text()}catch{return"<no response body>"}}function Wc(r){r.command("remove").description("Remove a realm \u2014 deletes server-side files and unlinks it from your realm list").argument("<realm-url>","realm URL to remove").option("-y, --yes","Skip the interactive confirmation prompt").option("--dry-run","Preview the change without writing to Matrix").action(async(e,t)=>{let n=x(e.trim()),i=await Hc({realmUrl:n,dryRun:!0});if(i.error&&!i.notInList&&(console.error(`${h}Error:${m} ${i.error}`),process.exit(1)),i.notInList&&(console.error(`${h}Error:${m} ${i.error}`),process.exit(1)),console.log(`Remove target: ${_}${i.realmUrl}${m}`),console.log(`${g}app.boxel.realms: ${i.previousCount} -> ${i.nextCount}${m}`),t.dryRun){console.log(`${g}[DRY RUN] No server delete or Matrix changes sent.${m}`);return}if(!t.yes){process.stdin.isTTY||(console.error(`${h}Error:${m} stdin is not a TTY. Pass --yes to confirm in non-interactive mode.`),process.exit(1));let o=await te("This will permanently delete the realm files, indexer state, and registry entry on the server. Proceed? (y/N) ");if(!/^y/i.test(o)){console.log(`${g}Cancelled.${m}`);return}}let s=await Hc({realmUrl:n});(s.error||!s.removed)&&(console.error(`${h}Error:${m} ${s.error??"Removal did not complete."}`),s.serverDeleted&&!s.unlinked&&console.error(`${g}The realm is gone, but your account_data still references ${s.realmUrl}.${m}`),process.exit(1)),console.log(`${S}Removed:${m} ${_}${s.realmUrl}${m}`)})}var ze=T(require("fs/promises")),Et=T(require("path"));function vr(r,e,t){let n=e.has(r),i=t?.files[r]!==void 0;return n&&i?e.get(r)===t.files[r]?"unchanged":"changed":n&&!i?"added":!n&&i?"deleted":"unchanged"}function xr(r,e,t){let n=e.has(r),i=t?.remoteMtimes?.[r]!==void 0,s=t?.files[r]!==void 0,o=i||s;return n&&i?e.get(r)===t.remoteMtimes[r]?"unchanged":"changed":n&&s?"changed":n&&!o?"added":!n&&o?"deleted":"unchanged"}function Vc(r,e,t){return r==="unchanged"&&e==="unchanged"?"noop":r==="changed"&&e==="unchanged"?"push":r==="unchanged"&&e==="changed"?"pull":r==="added"&&e==="unchanged"?"push":r==="unchanged"&&e==="added"?"pull":r==="changed"&&e==="changed"||r==="added"&&e==="added"||r==="changed"&&e==="added"||r==="added"&&e==="changed"?"conflict":r==="deleted"&&e==="unchanged"?t.deleteSync||t.preferLocal?"push-delete":"noop":r==="unchanged"&&e==="deleted"?t.deleteSync||t.preferRemote?"pull-delete":"noop":r==="deleted"&&e==="changed"||r==="changed"&&e==="deleted"?"conflict":r==="deleted"&&e==="deleted"?"noop":r==="added"&&e==="deleted"?"push":r==="deleted"&&e==="added"?"pull":"noop"}function Bc(r,e,t,n){let{localStatus:i,remoteStatus:s,relativePath:o}=r;if(!n)return null;switch(n){case"prefer-local":return i==="deleted"?"push-delete":"push";case"prefer-remote":return s==="deleted"?"pull-delete":"pull";case"prefer-newest":{if(i==="deleted"&&s==="changed")return"pull";if(i==="changed"&&s==="deleted")return"push";let a=e.get(o),l=t.get(o);return a&&l!==void 0?a.mtime>l*1e3?"push":"pull":"push"}}}var hE=new Set(["node_modules",".git",".boxel-history",".cache",".vscode","dist","build","tmp"]),gE=6;function yE(r,e){return r==="unchanged"&&e==="unchanged"||r==="deleted"&&e==="deleted"?null:r==="unchanged"&&e==="added"?"new-remote":r==="unchanged"&&e==="changed"?"modified-remote":r==="unchanged"&&e==="deleted"?"deleted-remote":r==="added"&&e==="unchanged"?"new-local":r==="changed"&&e==="unchanged"?"modified-local":r==="deleted"&&e==="unchanged"?"deleted-local":r==="changed"&&e==="changed"||r==="added"&&e==="added"||r==="changed"&&e==="added"||r==="added"&&e==="changed"||r==="changed"&&e==="deleted"||r==="deleted"&&e==="changed"?"conflict":r==="added"&&e==="deleted"?"new-local":r==="deleted"&&e==="added"?"new-remote":null}var Ei=class extends le{constructor(t,n,i){super(t,i);this.statusOptions=t;this.loadedManifest=n}changes=[];pulled=[];hasError=!1;error;remoteMtimes=new Map;async sync(){let t,n;try{[t,this.remoteMtimes,n]=await Promise.all([this.getLocalFileListWithMtimes(),this.getRemoteMtimes(),this.getRemoteFileList()])}catch(a){this.hasError=!0,this.error=a instanceof Error?`Failed to fetch realm state: ${a.message}`:`Failed to fetch realm state: ${String(a)}`;return}if(n&&this.remoteMtimes.size===0&&n.size>0)for(let[a]of n)this.remoteMtimes.set(a,0);let i=new Map;for(let[a,l]of t)i.set(a,l.path);let s=new Map;await Promise.all(Array.from(i.entries()).map(async([a,l])=>{D(a)||s.set(a,await re(l))}));let o=new Set;for(let a of i.keys())o.add(a);for(let a of this.remoteMtimes.keys())o.add(a);for(let a of Object.keys(this.loadedManifest.files))o.add(a);if(this.loadedManifest.remoteMtimes)for(let a of Object.keys(this.loadedManifest.remoteMtimes))o.add(a);for(let a of o){if(D(a))continue;let l=vr(a,s,this.loadedManifest),c=xr(a,this.remoteMtimes,this.loadedManifest),u=yE(l,c);u!==null&&this.changes.push({file:a,status:u})}this.changes.sort((a,l)=>a.file.localeCompare(l.file)),this.statusOptions.pull&&await this.performSafePull()}async performSafePull(){let t=this.changes.filter(i=>i.status==="new-remote"||i.status==="modified-remote");if(t.length===0)return;let n=[];for(let i of t){let s=Et.join(this.options.localDir,i.file);try{await this.downloadFile(i.file,s),this.pulled.push(i.file);let o=await re(s);this.loadedManifest.files[i.file]=o;let a=this.remoteMtimes.get(i.file);a!==void 0&&(this.loadedManifest.remoteMtimes=this.loadedManifest.remoteMtimes??{},this.loadedManifest.remoteMtimes[i.file]=a)}catch(o){this.hasError=!0;let a=o instanceof Error?o.message:String(o);n.push({file:i.file,message:a}),console.error(` ${h}\u2717 ${i.file}${m} (${a})`)}}n.length>0&&(this.error=`Failed to pull ${n.length} file(s): ${n.map(i=>`${i.file} (${i.message})`).join("; ")}`),this.pulled.length>0&&await _e(this.options.localDir,this.loadedManifest)}};async function Yc(r,e){let t={localDir:r,realmUrl:"",changes:[],pulled:[],inSync:!1,hasError:!1},n=Et.join(r,".boxel-sync.json");if(!await Je(n))return{...t,hasError:!0,error:`No .boxel-sync.json found in ${r}. Run: boxel realm sync ${r} <realm-url>`};let i=await we(r);if(!i)return{...t,hasError:!0,error:`Malformed .boxel-sync.json in ${r}`};let s;try{s=(await ze.stat(n)).mtimeMs}catch{}let o;if(e.authenticator)o=e.authenticator;else{let l=ye({realmUrl:i.realmUrl,realmSecretSeed:e.realmSecretSeed,profileManager:e.profileManager});if(!l.ok)return{...t,realmUrl:i.realmUrl,manifestMtime:s,hasError:!0,error:l.error};o=l.authenticator}let a=new Ei({realmUrl:i.realmUrl,localDir:r,pull:e.pull},i,o);return await a.sync(),{localDir:r,realmUrl:i.realmUrl,manifestMtime:s,changes:a.changes,pulled:a.pulled.slice().sort(),inSync:!a.hasError&&a.changes.length===0,hasError:a.hasError,error:a.error}}async function wE(r,e){let t=[];async function n(i,s){if(s>e)return;let o;try{o=await ze.readdir(i,{withFileTypes:!0})}catch{return}if(o.some(l=>l.isFile()&&l.name===".boxel-sync.json")){t.push(i);return}for(let l of o)l.isDirectory()&&(hE.has(l.name)||await n(Et.join(i,l.name),s+1))}return await n(r,0),t.sort(),t}async function EE(r,e){if(e.pull)return{rootDir:r,workspaces:[],hasError:!0,error:"Cannot use --pull with --all"};let t=process.env.BOXEL_STATUS_ALL_MAX_DEPTH,n=t!==void 0?Number(t):NaN,i=Number.isFinite(n)&&n>=0?n:gE,s=await wE(r,i),o=[],a=!1;for(let l of s){let c=Et.join(l,".boxel-sync.json"),u;try{u=await ze.readFile(c,"utf8")}catch{o.push({localDir:l,realmUrl:"",changes:[],pulled:[],inSync:!1,hasError:!0,skipped:"no-manifest"}),a=!0;continue}let f;try{f=JSON.parse(u)}catch{f=void 0}if(!yi(f)){o.push({localDir:l,realmUrl:"",changes:[],pulled:[],inSync:!1,hasError:!0,skipped:"malformed"}),a=!0;continue}let d=await Yc(l,{profileManager:e.profileManager,realmSecretSeed:e.realmSecretSeed,authenticator:e.authenticator}),p={...d};d.hasError&&(p.skipped="fetch-failed",a=!0),o.push(p)}return{rootDir:r,workspaces:o,hasError:a}}function bE(r){if(r.hasError&&r.error){console.error(`${h}Error:${m} ${r.error}`);return}if(console.log(`Realm: ${r.realmUrl}`),console.log(`Local: ${r.localDir}`),r.manifestMtime&&console.log(`${g}Manifest updated:${m} ${new Date(r.manifestMtime).toISOString()}`),console.log(""),r.changes.length===0){console.log(`${S}\u2713 In sync${m}`);return}let e={"new-remote":[],"modified-remote":[],"new-local":[],"modified-local":[],conflict:[],"deleted-local":[],"deleted-remote":[]};for(let t of r.changes)e[t.status].push(t.file);if(e["new-remote"].length>0){console.log(`${_}\u2193 New on remote (${e["new-remote"].length}):${m}`);for(let t of e["new-remote"])console.log(` + ${t}`);console.log("")}if(e["modified-remote"].length>0){console.log(`${_}\u2193 Modified on remote (${e["modified-remote"].length}):${m}`);for(let t of e["modified-remote"])console.log(` ~ ${t}`);console.log("")}if(e["new-local"].length>0){console.log(`${S}\u2191 New locally (${e["new-local"].length}):${m}`);for(let t of e["new-local"])console.log(` + ${t}`);console.log("")}if(e["modified-local"].length>0){console.log(`${S}\u2191 Modified locally (${e["modified-local"].length}):${m}`);for(let t of e["modified-local"])console.log(` ~ ${t}`);console.log("")}if(e.conflict.length>0){console.log(`${A}\u26A0 Conflicts (${e.conflict.length}):${m}`);for(let t of e.conflict)console.log(` ! ${t}`);console.log("")}if(e["deleted-local"].length>0){console.log(`${h}- Deleted locally (${e["deleted-local"].length}):${m}`);for(let t of e["deleted-local"])console.log(` - ${t}`);console.log("")}if(e["deleted-remote"].length>0){console.log(`${h}- Deleted on remote (${e["deleted-remote"].length}):${m}`);for(let t of e["deleted-remote"])console.log(` - ${t}`);console.log("")}if(r.pulled.length>0){console.log(`${_}Pulled ${r.pulled.length} file(s):${m}`);for(let t of r.pulled)console.log(` \u2713 ${t}`)}}function RE(r){if(r.error){console.error(`${h}Error:${m} ${r.error}`);return}if(r.workspaces.length===0){console.log(`No .boxel-sync.json directories found under ${r.rootDir}.`);return}for(let e of r.workspaces){if(e.skipped){console.log(`${A}${e.localDir}${m} [${e.skipped}]`),e.error&&console.log(` ${g}${e.error}${m}`),console.log("");continue}let t={newRemote:0,modRemote:0,newLocal:0,modLocal:0,conflict:0,delLocal:0,delRemote:0};for(let n of e.changes)n.status==="new-remote"?t.newRemote++:n.status==="modified-remote"?t.modRemote++:n.status==="new-local"?t.newLocal++:n.status==="modified-local"?t.modLocal++:n.status==="conflict"?t.conflict++:n.status==="deleted-local"?t.delLocal++:n.status==="deleted-remote"&&t.delRemote++;if(console.log(`${e.localDir} ${g}${e.realmUrl}${m}`),e.inSync)console.log(` ${S}\u2713 in sync${m}`);else{let n=[];t.newRemote>0&&n.push(`${_}\u2193+${t.newRemote}${m}`),t.modRemote>0&&n.push(`${_}\u2193~${t.modRemote}${m}`),t.newLocal>0&&n.push(`${S}\u2191+${t.newLocal}${m}`),t.modLocal>0&&n.push(`${S}\u2191~${t.modLocal}${m}`),t.conflict>0&&n.push(`${A}\u26A0${t.conflict}${m}`),t.delLocal>0&&n.push(`${h}-L${t.delLocal}${m}`),t.delRemote>0&&n.push(`${h}-R${t.delRemote}${m}`),console.log(` ${n.join(" ")}`)}console.log("")}}function Jc(r){r.command("status").aliases(["st"]).description("Show pending changes between a local sync dir and its realm").argument("[local-dir]","Local sync directory (defaults to current working directory)").option("--pull","Download safe remote changes and update manifest").option("--all","Recursively report all .boxel-sync.json dirs under the current directory").option("--realm-secret-seed","Administrative auth: prompt for a realm secret seed and mint a JWT locally instead of using a Matrix profile (env: BOXEL_REALM_SECRET_SEED)").action(async(e,t)=>{let n=await ge(t.realmSecretSeed===!0);if(t.all){t.pull&&(console.error(`${h}Error:${m} Cannot use --pull with --all`),process.exit(1));let s=await EE(e??process.cwd(),{all:!0,realmSecretSeed:n});RE(s),s.hasError&&process.exit(2);return}let i=await Yc(e??process.cwd(),{pull:t.pull,realmSecretSeed:n});bE(i),i.hasError&&process.exit(i.pulled.length>0?2:1)})}var Ri=T(require("path"));var $i=class extends le{constructor(t,n){super(t,n);this.syncOptions=t}hasError=!1;pushedFiles=[];pulledFiles=[];remoteDeletedFiles=[];localDeletedFiles=[];skippedConflicts=[];get conflictStrategy(){return this.syncOptions.preferLocal?"prefer-local":this.syncOptions.preferRemote?"prefer-remote":this.syncOptions.preferNewest?"prefer-newest":null}async sync(){console.log(`Starting sync between ${this.options.localDir} and ${this.options.realmUrl}`),console.log("Testing realm access...");let t;try{t=await this.getRemoteFileList("")}catch($){throw console.error("Failed to access realm:",$),new Error("Cannot proceed with sync: Authentication or access failed. Please check your credentials and realm permissions.")}console.log("Realm access verified");let[n,i,s]=await Promise.all([this.getLocalFileListWithMtimes(),this.getRemoteMtimes(),we(this.options.localDir)]),o=new Map;for(let[$,v]of n)o.set($,v.path);if(i.size===0&&t&&t.size>0){console.log("Remote mtimes unavailable, falling back to file listing for remote detection");for(let[$]of t)i.set($,0)}console.log(`Found ${o.size} local files`),console.log(`Found ${i.size} remote files`),s&&s.realmUrl!==this.normalizedRealmUrl&&console.warn(`${A}Warning:${m} Manifest realm URL (${s.realmUrl}) differs from target (${this.normalizedRealmUrl}). Treating as first sync.`);let a=s&&s.realmUrl===this.normalizedRealmUrl?s:null,l=new Map;await Promise.all(Array.from(o.entries()).map(async([$,v])=>{D($)||l.set($,await re(v))}));let c=new Set;for(let $ of o.keys())c.add($);for(let $ of i.keys())c.add($);if(a){for(let $ of Object.keys(a.files))c.add($);if(a.remoteMtimes)for(let $ of Object.keys(a.remoteMtimes))c.add($)}let u=[];for(let $ of c){if(D($))continue;let v=vr($,l,a),O=xr($,i,a),U=Vc(v,O,this.syncOptions);u.push({relativePath:$,localStatus:v,remoteStatus:O,action:U})}let f=[],d=[],p=[],y=[],R=[],I=0;for(let $ of u)switch($.action){case"push":f.push($.relativePath);break;case"pull":d.push($.relativePath);break;case"push-delete":p.push($.relativePath);break;case"pull-delete":y.push($.relativePath);break;case"conflict":R.push($);break;case"noop":I++;break}for(let $ of R)switch(Bc($,n,i,this.conflictStrategy)){case"push":f.push($.relativePath);break;case"pull":d.push($.relativePath);break;case"push-delete":p.push($.relativePath);break;case"pull-delete":y.push($.relativePath);break;case"noop":break;default:this.skippedConflicts.push($.relativePath);break}if(console.log(`
|
|
100
|
-
${g}Sync plan:${m}`),
|
|
101
|
-
Everything is up to date`),!this.options.dryRun&&!a&&this.skippedConflicts.length===0&&await this.writeManifest(
|
|
102
|
-
Pulling ${d.length} file(s)...`);let
|
|
103
|
-
Pushing ${
|
|
104
|
-
Deleting ${
|
|
105
|
-
Deleting ${
|
|
94
|
+
`);for(let t of i){let r=t.source==="local"?"\u2191":t.source==="remote"?"\u2193":"\u25CF",n=t.source==="local"?R:t.source==="remote"?_:ce;console.log(` ${A}\u2B50${m} ${A}${t.shortHash}${m} ${n}${r}${m} ${ce}[${t.milestoneName}]${m} ${t.message}`),console.log(` ${g}${hb(t.date)}${m}`)}console.log()}function wb(i){if(i===void 0)return xn;if(!/^\d+$/.test(i))return null;let e=parseInt(i,10);return e>0?e:null}function Ei(i){console.error(`${h}Error:${m} ${i}`),process.exit(1)}function Hl(i){i.command("milestone").description("List, mark, or remove milestones in the local .boxel-history/ checkpoint log").argument("<local-dir>","The local workspace directory").option("--mark <ref>","Mark a checkpoint as a milestone (1-based index, short hash, or full hash)").option("--name <name>","Name for the milestone (required with --mark)").option("--remove <ref>","Remove the milestone tag from a checkpoint (1-based index, short hash, or full hash)").option("--limit <n>",`Maximum number of checkpoints to consider for ref resolution (default: ${xn})`).option("--json","Output result as JSON").action(async(e,t)=>{t.mark!==void 0&&t.remove!==void 0&&Ei("Only one of --mark or --remove may be specified.");let r=wb(t.limit);r===null&&Ei("--limit must be a positive integer."),t.mark!==void 0&&t.name===void 0&&Ei("--name is required when using --mark.");let n=await bb(e,{mark:t.mark,name:t.name,remove:t.remove,limit:r});if(t.json){j.output(JSON.stringify(n,null,2)),n.ok||process.exit(1);return}if(n.ok||Ei(n.error),n.marked){let s=n.marked;console.log(`
|
|
95
|
+
${R}\u2713${m} ${A}\u2B50${m} Milestone created: ${ce}${s.milestoneName}${m}`),console.log(` Checkpoint: ${A}${s.shortHash}${m} ${s.message}`),console.log();return}if(n.removed!==void 0){console.log(`${R}\u2713${m} Milestone removed`);return}yb(n.milestones,e)})}async function vn(i,e={}){let t=k(i),r=e.profileManager??C(),n=r.getActiveProfile();if(!n)return{publishedRealmURL:t,unpublished:!1,error:P};let s=n.profile.realmServerUrl.replace(/\/$/,""),o;try{o=await r.authedRealmServerFetch(`${s}/_unpublish-realm`,{method:"POST",headers:{Accept:"application/vnd.api+json","Content-Type":"application/json"},body:JSON.stringify({publishedRealmURL:t})})}catch(l){return{publishedRealmURL:t,unpublished:!1,error:`Failed to reach realm server: ${l instanceof Error?l.message:String(l)}`}}if(o.ok)return{publishedRealmURL:t,unpublished:!0};let a=await Eb(o);return o.status===404||o.status===422&&/not found/i.test(a)?e.tolerateMissing?{publishedRealmURL:t,unpublished:!1,notFound:!0}:{publishedRealmURL:t,unpublished:!1,notFound:!0,error:`Published realm ${t} is not currently published`}:{publishedRealmURL:t,unpublished:!1,error:`Realm server returned ${o.status}: ${a.slice(0,500)}`}}async function Eb(i){try{return await i.text()}catch{return"<no response body>"}}function Wl(i){i.command("unpublish").description("Unpublish a published realm by its public-facing URL").argument("<published-realm-url>","URL of the published realm to remove").option("--tolerate-missing","Exit successfully when the realm is already unpublished").action(async(e,t)=>{let r=await vn(e,{tolerateMissing:t.tolerateMissing===!0});if(r.error&&(console.error(`${h}Error:${m} ${r.error}`),process.exit(1)),r.notFound){console.log(`Already unpublished: ${_}${r.publishedRealmURL}${m}`);return}console.log(`${R}Unpublished:${m} ${_}${r.publishedRealmURL}${m}`)})}var zl=3e5,Rb=1e3;async function $b(i,e,t={}){let r=t.profileManager??C(),n=r.getActiveProfile();if(!n)throw new Error(P);let s=k(i),o=k(e),a=n.profile.realmServerUrl.replace(/\/$/,""),c=await Vl(r,a,s,o);if((c.status===400||c.status===409)&&t.republish!==!1){let d=await Bl(c);console.log(`Publish returned ${c.status} (${d.slice(0,200)}). Unpublishing and retrying.`);let f=await vn(o,{profileManager:r,tolerateMissing:!0});if(!f.unpublished&&!f.notFound)throw new Error(`Conflict on publish; unpublish-then-retry also failed: ${f.error??"unknown"}`);c=await Vl(r,a,s,o)}if(c.status!==200&&c.status!==201&&c.status!==202){let d=await Bl(c);throw new Error(`Publish failed: HTTP ${c.status}: ${d.slice(0,1e3)}`)}let l=await c.json(),p=l?.data?.attributes;if(!p?.publishedRealmURL)throw new Error(`Publish response missing data.attributes.publishedRealmURL: ${JSON.stringify(l).slice(0,500)}`);let u={publishedRealmURL:k(p.publishedRealmURL),publishedRealmId:l.data.id,lastPublishedAt:p.lastPublishedAt,status:p.status};if(t.waitForReady!==!1){let d=t.timeoutMs??zl,f;try{let x=await r.getOrRefreshServerToken();f=await r.fetchAndStoreRealmToken(u.publishedRealmURL,x)}catch{}await kb(u.publishedRealmURL,f,d)}return u}async function Vl(i,e,t,r){return i.authedRealmServerFetch(`${e}/_publish-realm`,{method:"POST",headers:{Accept:"application/vnd.api+json","Content-Type":"application/json"},body:JSON.stringify({sourceRealmURL:t,publishedRealmURL:r})})}async function kb(i,e,t){let r=new URL("_readiness-check",i).href,n=Date.now(),s;for(;Date.now()-n<t;){try{let a={Accept:"application/vnd.api+json"};e&&(a.Authorization=e);let c=await fetch(r,{headers:a});if(c.ok)return;s=`HTTP ${c.status}`}catch(a){s=a instanceof Error?a.message:String(a)}let o=t-(Date.now()-n);if(o<=0)break;await new Promise(a=>setTimeout(a,Math.min(Rb,o)))}throw new Error(`Timed out after ${t}ms waiting for ${i} to pass readiness check${s?`: ${s}`:""}`)}async function Bl(i){try{return await i.text()}catch{return"<no response body>"}}function Sb(i){return{waitForReady:i.wait!==!1,timeoutMs:i.timeout,republish:i.republish!==!1}}function Yl(i){i.command("publish").description("Publish a source realm to a published-realm URL, polling readiness until ready").argument("<source-realm-url>","URL of the source realm to publish").argument("<published-realm-url>","Public-facing URL the published copy will serve at").option("--no-wait","Return as soon as the server accepts the publish").option("--timeout <ms>",`Readiness-poll timeout in milliseconds (default: ${zl})`,_b).option("--no-republish","Do not auto-unpublish + retry when the server returns 400/409").action(async(e,t,r)=>{try{let n=await $b(e,t,Sb(r));console.log(`${R}Published:${m} ${_}${n.publishedRealmURL}${m}`)}catch(n){console.error(`${h}Error:${m} ${n instanceof Error?n.message:String(n)}`),process.exit(1)}})}function _b(i){let e=Number.parseInt(i,10);if(!Number.isFinite(e)||e<0||String(e)!==i.trim())throw new Error("--timeout must be a non-negative integer (milliseconds).");return e}var Jl=T(Ur()),Xl="realm_server";function Cb(i){let{hostname:e}=new URL(i);if(e==="localhost"||e.endsWith(".localhost"))return"localhost";let t=e.split(".");return t.length<=2?e:t.slice(-2).join(".")}function Ob(i,e=Xl){return`@${e}:${Cb(i)}`}function Tb(i){return new URL(i).origin+"/"}function Pb(i){try{return new URL(i).href.replace(/\/+$/,"")+"/"}catch{throw new Error(`Invalid realm URL: ${i}`)}}var ki=class{#e;#t;#i;#n;#r=new Map;constructor(e){if(!e.seed)throw new Error("SeedAuthenticator requires a non-empty seed");this.#e=e.seed,this.#t=e.botUsername??Xl,this.#i=e.botUserId,this.#n=e.expiresIn??"7d"}buildClaims(e){let t=Pb(e);return{user:this.#i??Ob(t,this.#t),realm:t,sessionRoom:void 0,permissions:[],realmServerURL:Tb(t)}}mintTokenForRealm(e){let t=this.buildClaims(e),r=this.#r.get(t.realm);if(r)return r;let n=Jl.default.sign(t,this.#e,{expiresIn:this.#n});return this.#r.set(t.realm,n),n}#s(e){for(let s of this.#r.keys())if(e.startsWith(s))return s;let t=new URL(e),r=t.pathname.split("/").filter(Boolean),n=r.length>0?`/${r.slice(0,2).join("/")}/`:"/";return`${t.origin}${n}`}async authedRealmFetch(e,t){let r=e instanceof Request?e.url:e instanceof URL?e.href:e,n=this.#s(r),s=this.mintTokenForRealm(n),o=this.#o(e,t,s);return fetch(e,{...t,headers:o})}#o(e,t,r){let n=e instanceof Request?new Headers(e.headers):new Headers,s=new Headers(t?.headers);for(let[o,a]of s)n.set(o,a);return n.has("Authorization")||n.set("Authorization",r),n}registerRealmUrl(e){this.mintTokenForRealm(e)}};function be(i){if(i.realmSecretSeed)try{let t=new ki({seed:i.realmSecretSeed});return t.registerRealmUrl(i.realmUrl),{ok:!0,authenticator:t,mode:"seed"}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}let e=i.profileManager??C();return e.getActiveProfile()?{ok:!0,authenticator:e,mode:"profile"}:{ok:!1,error:P}}var Si=T(require("fs/promises")),Kl=T(require("path")),bn=class extends le{constructor(t,r){super(t,r);this.pullOptions=t}hasError=!1;downloadedFiles=[];async sync(){console.log(`Starting pull from ${this.options.realmUrl} to ${this.options.localDir}`),console.log("Testing realm access...");try{await this.getRemoteFileList("")}catch(c){throw console.error("Failed to access realm:",c),new Error("Cannot proceed with pull: Authentication or access failed. Please check your credentials and realm permissions.")}console.log("Realm access verified");let[t,r]=await Promise.all([this.getRemoteFileList(),this.getLocalFileList()]);if(console.log(`Found ${t.size} files in remote realm`),console.log(`Found ${r.size} files in local directory`),this.options.dryRun)try{await Si.access(this.options.localDir)}catch{console.log(`[DRY RUN] Would create directory: ${this.options.localDir}`)}else await Si.mkdir(this.options.localDir,{recursive:!0});let n=new Set;if(this.pullOptions.deleteLocal)for(let c of r.keys())t.has(c)||n.add(c);let s=new q(this.options.localDir);if(n.size>0&&!this.options.dryRun){let c=Array.from(n).map(p=>({file:p,status:"deleted"})),l=await s.createCheckpoint("remote",c,`Pre-delete checkpoint: ${n.size} files not on server`);l&&console.log(`
|
|
96
|
+
Checkpoint created before deletion: ${l.shortHash}`)}let o=await Promise.all(Array.from(t.keys()).map(c=>this.remoteLimit(async()=>{try{let l=Kl.join(this.options.localDir,c);return await this.downloadFile(c,l),c}catch(l){return this.hasError=!0,console.error(`Error downloading ${c}:`,l),null}})));this.downloadedFiles=o.filter(c=>c!==null);let a=[];if(n.size>0&&(console.log(`
|
|
97
|
+
Deleting ${n.size} local files that don't exist in realm...`),a=(await Promise.all(Array.from(n).map(async l=>{try{let p=r.get(l);return p?(await this.deleteLocalFile(p),console.log(` Deleted: ${l}`),l):null}catch(p){return this.hasError=!0,console.error(`Error deleting local file ${l}:`,p),null}}))).filter(l=>l!==null)),!this.options.dryRun&&this.downloadedFiles.length+a.length>0){let c=[...this.downloadedFiles.map(p=>({file:p,status:"modified"})),...a.map(p=>({file:p,status:"deleted"}))],l=await s.createCheckpoint("remote",c);if(l){let p=l.isMajor?"[MAJOR]":"[minor]";console.log(`
|
|
98
|
+
Checkpoint created: ${l.shortHash} ${p} ${l.message}`)}}console.log("Pull completed")}};function Ql(i){i.command("pull").description("Pull files from a Boxel realm to a local directory").argument("<realm-url>","The URL of the source realm (e.g., https://app.boxel.ai/demo/)").argument("<local-dir>","The local directory to sync files to").option("--delete","Delete local files that do not exist in the realm").option("--dry-run","Show what would be done without making changes").option("--realm-secret-seed","Administrative auth: prompt for a realm secret seed and mint a JWT locally instead of using a Matrix profile (env: BOXEL_REALM_SECRET_SEED)").action(async(e,t,r)=>{let n=await xe(r.realmSecretSeed===!0),s=await Ab(e,t,{delete:r.delete,dryRun:r.dryRun,realmSecretSeed:n});s.error&&(console.error(`Error: ${s.error}`),process.exit(s.files.length>0?2:1)),console.log("Pull completed successfully")})}async function Ab(i,e,t){let r;if(t.authenticator)r=t.authenticator;else{let n=be({realmUrl:i,realmSecretSeed:t.realmSecretSeed,profileManager:t.profileManager});if(!n.ok)return{files:[],error:n.error};r=n.authenticator}try{let n=new bn({realmUrl:i,localDir:e,deleteLocal:t.delete,dryRun:t.dryRun},r);return await n.sync(),n.hasError?{files:n.downloadedFiles.sort(),error:"Pull completed with errors. Some files may not have been downloaded."}:{files:n.downloadedFiles.sort()}}catch(n){return{files:[],error:`Pull failed: ${n instanceof Error?n.message:String(n)}`}}}var Ue=T(require("fs/promises")),yn=T(require("path")),Zl=T(require("crypto"));function wn(i){if(typeof i!="object"||i===null)return!1;let e=i;if(typeof e.realmUrl!="string"||typeof e.files!="object"||e.files===null)return!1;for(let t of Object.values(e.files))if(typeof t!="string")return!1;if(e.remoteMtimes!==void 0){if(typeof e.remoteMtimes!="object"||e.remoteMtimes===null)return!1;for(let t of Object.values(e.remoteMtimes))if(typeof t!="number")return!1}return!0}async function Qe(i){try{return await Ue.access(i),!0}catch{return!1}}async function re(i){let e=await Ue.readFile(i);return Zl.createHash("md5").update(e).digest("hex")}async function ye(i){let e=yn.join(i,".boxel-sync.json"),t;try{t=await Ue.readFile(e,"utf8")}catch(n){if(n.code==="ENOENT")return null;throw n}let r;try{r=JSON.parse(t)}catch{return null}return wn(r)?r:(console.warn("Warning: .boxel-sync.json is malformed or has an unexpected shape; falling back to a full upload."),null)}async function Oe(i,e){let t=yn.join(i,".boxel-sync.json");await Ue.writeFile(t,JSON.stringify(e,null,2))}var Lb=new Set(["index.json","realm.json"]),En=class extends le{constructor(t,r){super(t,r);this.pushOptions=t}hasError=!1;async sync(){console.log(`Starting push from ${this.options.localDir} to ${this.options.realmUrl}`),console.log("Testing realm access...");let t;try{t=await this.getRemoteFileList("")}catch(p){throw console.error("Failed to access realm:",p),new Error("Cannot proceed with push: Authentication or access failed. Please check your credentials and realm permissions.")}console.log("Realm access verified");let r=await this.getLocalFileList();console.log(`Found ${r.size} files in local directory`);let n=await ye(this.options.localDir),s={realmUrl:this.normalizedRealmUrl,files:{},remoteMtimes:{}},o=new Map,a=new Set;if(!this.pushOptions.force&&n!==null&&n.realmUrl===this.normalizedRealmUrl){console.log("Checking for changed files...");let p=0,[u,d]=await Promise.all([this.getRemoteMtimes(),Promise.all(Array.from(r.entries()).map(async([f,x])=>{if(F(f))return{relativePath:f,localPath:x,currentHash:"",protected:!0};let w=await re(x);return{relativePath:f,localPath:x,currentHash:w,protected:!1}}))]);for(let f of d){if(f.protected){p++;continue}let x=n.files[f.relativePath],w=n.remoteMtimes?.[f.relativePath],M=u.get(f.relativePath),Z=x!==f.currentHash,E=x!==void 0&&!t.has(f.relativePath),$=w!==void 0&&M!==void 0&&M!==w;Z||E||$?(o.set(f.relativePath,f.localPath),!Z&&(E||$)&&a.add(f.relativePath)):(p++,s.files[f.relativePath]=f.currentHash,w!==void 0&&(s.remoteMtimes[f.relativePath]=w))}if(p>0&&console.log(`Skipping ${p} unchanged files`),a.size>0){let f=Array.from(a),x=f.slice(0,5).join(", "),w=f.length>5?", ...":"";console.warn(`Warning: ${a.size} file(s) changed on the realm since your last push; your local versions will overwrite them: ${x}${w}`)}}else{this.pushOptions.force?console.log("Force mode: uploading all files"):console.log(n?"Realm URL changed, will upload all files":"No sync manifest found, will upload all files");for(let[p,u]of r)F(p)||o.set(p,u)}let l=!1;if(o.size===0)console.log("No files to upload - everything is up to date");else{console.log(`Uploading ${o.size} file(s) via /_atomic...`);let p=new Set,u=this.pushOptions.force||!n;for(let f of o.keys())if(u)t.has(f)||p.add(f);else{let x=n.files[f]!==void 0,w=x&&!t.has(f);(!x||w)&&p.add(f)}let d=await this.uploadFilesAtomic(o,p);if(d.succeeded.length>0){let f=await Promise.all(d.succeeded.map(async x=>({rel:x,hash:await re(o.get(x))})));for(let{rel:x,hash:w}of f)s.files[x]=w}if(d.error){l=!0,this.hasError=!0,console.error(d.error.message);for(let f of d.error.perFile){let x;f.status===409?x=`${f.path} was created on the realm concurrently \u2014 run with --force to overwrite.`:f.status===404?x=`${f.path} was removed from the realm concurrently \u2014 run with --force to re-create it from your local copy.`:x=`${f.path}: ${f.title}`,console.error(` ${x}`)}}}if(this.pushOptions.deleteRemote){let p=new Set(t.keys()),u=[];for(let d of p){if(F(d)){p.delete(d);continue}Lb.has(d)&&(p.delete(d),u.push(d))}for(let d of r.keys())p.delete(d);if(u.length>0&&console.log(`Skipping ${u.length} realm-managed remote artifact(s): ${u.join(", ")}`),p.size>0){let d=Array.from(p).sort();console.log(`Deleting ${d.length} remote files that don't exist locally: ${d.join(", ")}`);for(let f of d)try{await this.deleteFile(f)}catch(x){this.hasError=!0,console.error(`Error deleting ${f}:`,x)}}}if(!this.options.dryRun&&o.size>0)try{let p=await this.getRemoteMtimes();for(let u of Object.keys(s.files)){let d=p.get(u);d!==void 0&&(s.remoteMtimes[u]=d)}}catch(p){console.warn("Could not refresh remote mtimes after upload:",p)}if(s.remoteMtimes&&Object.keys(s.remoteMtimes).length===0&&delete s.remoteMtimes,this.options.dryRun||await Oe(this.options.localDir,s),!this.options.dryRun&&o.size>0&&!l){let p=new q(this.options.localDir),u=Array.from(o.keys()).map(f=>({file:f,status:"modified"})),d=await p.createCheckpoint("local",u);if(d){let f=d.isMajor?"[MAJOR]":"[minor]";console.log(`
|
|
99
|
+
Checkpoint created: ${d.shortHash} ${f} ${d.message}`)}}console.log("Push completed")}};function ep(i){i.command("push").description("Push local files to a Boxel realm").argument("<local-dir>","The local directory containing files to sync").argument("<realm-url>","The URL of the target realm (e.g., https://app.boxel.ai/demo/)").option("--delete","Delete remote files that do not exist locally").option("--dry-run","Show what would be done without making changes").option("--force","Upload all files, even if unchanged").option("--realm-secret-seed","Administrative auth: prompt for a realm secret seed and mint a JWT locally instead of using a Matrix profile (env: BOXEL_REALM_SECRET_SEED)").action(async(e,t,r)=>{let n=await xe(r.realmSecretSeed===!0);await jb(e,t,{delete:r.delete,dryRun:r.dryRun,force:r.force,realmSecretSeed:n})})}async function jb(i,e,t){let r;if(t.authenticator)r=t.authenticator;else{let n=be({realmUrl:e,realmSecretSeed:t.realmSecretSeed,profileManager:t.profileManager});n.ok||(console.error(`Error: ${n.error}`),process.exit(1)),r=n.authenticator}await Qe(i)||(console.error(`Local directory does not exist: ${i}`),process.exit(1));try{let n=new En({realmUrl:e,localDir:i,deleteRemote:t.delete,dryRun:t.dryRun,force:t.force},r);await n.sync(),n.hasError?(console.log("Push did not complete successfully. View logs for details"),process.exit(2)):console.log("Push completed successfully")}catch(n){console.error("Push failed:",n),process.exit(1)}}async function tp(i){let e=k(i.realmUrl.trim()),t=i.profileManager??C(),r=t.getActiveProfile();if(!r)return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:0,nextCount:0,error:P};let n;try{n=await t.getUserRealms()}catch(d){return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:0,nextCount:0,error:`Failed to load realm list: ${d instanceof Error?d.message:String(d)}`}}let s=n.map(k),o=s.length,a=s.filter(d=>d===e).length;if(a===0)return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:o,nextCount:o,notInList:!0,error:"Realm is not in app.boxel.realms. Nothing to remove."};let c=o-a;if(i.dryRun)return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:o,nextCount:c};let l=r.profile.realmServerUrl.replace(/\/$/,""),p;try{p=await t.authedRealmServerFetch(`${l}/_delete-realm`,{method:"DELETE",headers:{"Content-Type":"application/vnd.api+json"},body:JSON.stringify({data:{type:"realm",id:e}})})}catch(d){return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:o,nextCount:o,error:`Failed to reach realm server: ${d instanceof Error?d.message:String(d)}`}}if(!p.ok){let d=await Mb(p),f=p.status===403?`You do not own this realm and cannot delete it on the server. Server returned 403: ${d}`:`Realm server returned ${p.status}: ${d}`;return{realmUrl:e,removed:!1,serverDeleted:!1,unlinked:!1,previousCount:o,nextCount:o,error:f}}let u;try{u=await t.removeFromUserRealms(e)}catch(d){return{realmUrl:e,removed:!1,serverDeleted:!0,unlinked:!1,previousCount:o,nextCount:o,error:`Server delete succeeded, but Matrix unlink failed: ${d instanceof Error?d.message:String(d)}`}}return u?{realmUrl:e,removed:!0,serverDeleted:!0,unlinked:u,previousCount:o,nextCount:c}:{realmUrl:e,removed:!1,serverDeleted:!0,unlinked:!1,previousCount:o,nextCount:o,error:"Server delete succeeded, but Matrix account_data did not contain the URL by the time we PUT (concurrent edit?). Server-side files are gone; please refresh and check your realm list."}}async function Mb(i){try{return await i.text()}catch{return"<no response body>"}}function ip(i){i.command("remove").description("Remove a realm \u2014 deletes server-side files and unlinks it from your realm list").argument("<realm-url>","realm URL to remove").option("-y, --yes","Skip the interactive confirmation prompt").option("--dry-run","Preview the change without writing to Matrix").action(async(e,t)=>{let r=k(e.trim()),n=await tp({realmUrl:r,dryRun:!0});if(n.error&&!n.notInList&&(console.error(`${h}Error:${m} ${n.error}`),process.exit(1)),n.notInList&&(console.error(`${h}Error:${m} ${n.error}`),process.exit(1)),console.log(`Remove target: ${_}${n.realmUrl}${m}`),console.log(`${g}app.boxel.realms: ${n.previousCount} -> ${n.nextCount}${m}`),t.dryRun){console.log(`${g}[DRY RUN] No server delete or Matrix changes sent.${m}`);return}if(!t.yes){process.stdin.isTTY||(console.error(`${h}Error:${m} stdin is not a TTY. Pass --yes to confirm in non-interactive mode.`),process.exit(1));let o=await te("This will permanently delete the realm files, indexer state, and registry entry on the server. Proceed? (y/N) ");if(!/^y/i.test(o)){console.log(`${g}Cancelled.${m}`);return}}let s=await tp({realmUrl:r});(s.error||!s.removed)&&(console.error(`${h}Error:${m} ${s.error??"Removal did not complete."}`),s.serverDeleted&&!s.unlinked&&console.error(`${g}The realm is gone, but your account_data still references ${s.realmUrl}.${m}`),process.exit(1)),console.log(`${R}Removed:${m} ${_}${s.realmUrl}${m}`)})}var Ze=T(require("fs/promises")),wt=T(require("path"));function _i(i,e,t){let r=e.has(i),n=t?.files[i]!==void 0;return r&&n?e.get(i)===t.files[i]?"unchanged":"changed":r&&!n?"added":!r&&n?"deleted":"unchanged"}function Ci(i,e,t){let r=e.has(i),n=t?.remoteMtimes?.[i]!==void 0,s=t?.files[i]!==void 0,o=n||s;return r&&n?e.get(i)===t.remoteMtimes[i]?"unchanged":"changed":r&&s?"changed":r&&!o?"added":!r&&o?"deleted":"unchanged"}function rp(i,e,t){return i==="unchanged"&&e==="unchanged"?"noop":i==="changed"&&e==="unchanged"?"push":i==="unchanged"&&e==="changed"?"pull":i==="added"&&e==="unchanged"?"push":i==="unchanged"&&e==="added"?"pull":i==="changed"&&e==="changed"||i==="added"&&e==="added"||i==="changed"&&e==="added"||i==="added"&&e==="changed"?"conflict":i==="deleted"&&e==="unchanged"?t.deleteSync||t.preferLocal?"push-delete":"noop":i==="unchanged"&&e==="deleted"?t.deleteSync||t.preferRemote?"pull-delete":"noop":i==="deleted"&&e==="changed"||i==="changed"&&e==="deleted"?"conflict":i==="deleted"&&e==="deleted"?"noop":i==="added"&&e==="deleted"?"push":i==="deleted"&&e==="added"?"pull":"noop"}function np(i,e,t,r){let{localStatus:n,remoteStatus:s,relativePath:o}=i;if(!r)return null;switch(r){case"prefer-local":return n==="deleted"?"push-delete":"push";case"prefer-remote":return s==="deleted"?"pull-delete":"pull";case"prefer-newest":{if(n==="deleted"&&s==="changed")return"pull";if(n==="changed"&&s==="deleted")return"push";let a=e.get(o),c=t.get(o);return a&&c!==void 0?a.mtime>c*1e3?"push":"pull":"push"}}}var Ib=new Set(["node_modules",".git",".boxel-history",".cache",".vscode","dist","build","tmp"]),Nb=6;function Fb(i,e){return i==="unchanged"&&e==="unchanged"||i==="deleted"&&e==="deleted"?null:i==="unchanged"&&e==="added"?"new-remote":i==="unchanged"&&e==="changed"?"modified-remote":i==="unchanged"&&e==="deleted"?"deleted-remote":i==="added"&&e==="unchanged"?"new-local":i==="changed"&&e==="unchanged"?"modified-local":i==="deleted"&&e==="unchanged"?"deleted-local":i==="changed"&&e==="changed"||i==="added"&&e==="added"||i==="changed"&&e==="added"||i==="added"&&e==="changed"||i==="changed"&&e==="deleted"||i==="deleted"&&e==="changed"?"conflict":i==="added"&&e==="deleted"?"new-local":i==="deleted"&&e==="added"?"new-remote":null}var Rn=class extends le{constructor(t,r,n){super(t,n);this.statusOptions=t;this.loadedManifest=r}changes=[];pulled=[];hasError=!1;error;remoteMtimes=new Map;async sync(){let t,r;try{[t,this.remoteMtimes,r]=await Promise.all([this.getLocalFileListWithMtimes(),this.getRemoteMtimes(),this.getRemoteFileList()])}catch(a){this.hasError=!0,this.error=a instanceof Error?`Failed to fetch realm state: ${a.message}`:`Failed to fetch realm state: ${String(a)}`;return}if(r&&this.remoteMtimes.size===0&&r.size>0)for(let[a]of r)this.remoteMtimes.set(a,0);let n=new Map;for(let[a,c]of t)n.set(a,c.path);let s=new Map;await Promise.all(Array.from(n.entries()).map(async([a,c])=>{F(a)||s.set(a,await re(c))}));let o=new Set;for(let a of n.keys())o.add(a);for(let a of this.remoteMtimes.keys())o.add(a);for(let a of Object.keys(this.loadedManifest.files))o.add(a);if(this.loadedManifest.remoteMtimes)for(let a of Object.keys(this.loadedManifest.remoteMtimes))o.add(a);for(let a of o){if(F(a))continue;let c=_i(a,s,this.loadedManifest),l=Ci(a,this.remoteMtimes,this.loadedManifest),p=Fb(c,l);p!==null&&this.changes.push({file:a,status:p})}this.changes.sort((a,c)=>a.file.localeCompare(c.file)),this.statusOptions.pull&&await this.performSafePull()}async performSafePull(){let t=this.changes.filter(n=>n.status==="new-remote"||n.status==="modified-remote");if(t.length===0)return;let r=[];for(let n of t){let s=wt.join(this.options.localDir,n.file);try{await this.downloadFile(n.file,s),this.pulled.push(n.file);let o=await re(s);this.loadedManifest.files[n.file]=o;let a=this.remoteMtimes.get(n.file);a!==void 0&&(this.loadedManifest.remoteMtimes=this.loadedManifest.remoteMtimes??{},this.loadedManifest.remoteMtimes[n.file]=a)}catch(o){this.hasError=!0;let a=o instanceof Error?o.message:String(o);r.push({file:n.file,message:a}),console.error(` ${h}\u2717 ${n.file}${m} (${a})`)}}r.length>0&&(this.error=`Failed to pull ${r.length} file(s): ${r.map(n=>`${n.file} (${n.message})`).join("; ")}`),this.pulled.length>0&&await Oe(this.options.localDir,this.loadedManifest)}};async function sp(i,e){let t={localDir:i,realmUrl:"",changes:[],pulled:[],inSync:!1,hasError:!1},r=wt.join(i,".boxel-sync.json");if(!await Qe(r))return{...t,hasError:!0,error:`No .boxel-sync.json found in ${i}. Run: boxel realm sync ${i} <realm-url>`};let n=await ye(i);if(!n)return{...t,hasError:!0,error:`Malformed .boxel-sync.json in ${i}`};let s;try{s=(await Ze.stat(r)).mtimeMs}catch{}let o;if(e.authenticator)o=e.authenticator;else{let c=be({realmUrl:n.realmUrl,realmSecretSeed:e.realmSecretSeed,profileManager:e.profileManager});if(!c.ok)return{...t,realmUrl:n.realmUrl,manifestMtime:s,hasError:!0,error:c.error};o=c.authenticator}let a=new Rn({realmUrl:n.realmUrl,localDir:i,pull:e.pull},n,o);return await a.sync(),{localDir:i,realmUrl:n.realmUrl,manifestMtime:s,changes:a.changes,pulled:a.pulled.slice().sort(),inSync:!a.hasError&&a.changes.length===0,hasError:a.hasError,error:a.error}}async function Ub(i,e){let t=[];async function r(n,s){if(s>e)return;let o;try{o=await Ze.readdir(n,{withFileTypes:!0})}catch{return}if(o.some(c=>c.isFile()&&c.name===".boxel-sync.json")){t.push(n);return}for(let c of o)c.isDirectory()&&(Ib.has(c.name)||await r(wt.join(n,c.name),s+1))}return await r(i,0),t.sort(),t}async function Db(i,e){if(e.pull)return{rootDir:i,workspaces:[],hasError:!0,error:"Cannot use --pull with --all"};let t=process.env.BOXEL_STATUS_ALL_MAX_DEPTH,r=t!==void 0?Number(t):NaN,n=Number.isFinite(r)&&r>=0?r:Nb,s=await Ub(i,n),o=[],a=!1;for(let c of s){let l=wt.join(c,".boxel-sync.json"),p;try{p=await Ze.readFile(l,"utf8")}catch{o.push({localDir:c,realmUrl:"",changes:[],pulled:[],inSync:!1,hasError:!0,skipped:"no-manifest"}),a=!0;continue}let u;try{u=JSON.parse(p)}catch{u=void 0}if(!wn(u)){o.push({localDir:c,realmUrl:"",changes:[],pulled:[],inSync:!1,hasError:!0,skipped:"malformed"}),a=!0;continue}let d=await sp(c,{profileManager:e.profileManager,realmSecretSeed:e.realmSecretSeed,authenticator:e.authenticator}),f={...d};d.hasError&&(f.skipped="fetch-failed",a=!0),o.push(f)}return{rootDir:i,workspaces:o,hasError:a}}function qb(i){if(i.hasError&&i.error){console.error(`${h}Error:${m} ${i.error}`);return}if(console.log(`Realm: ${i.realmUrl}`),console.log(`Local: ${i.localDir}`),i.manifestMtime&&console.log(`${g}Manifest updated:${m} ${new Date(i.manifestMtime).toISOString()}`),console.log(""),i.changes.length===0){console.log(`${R}\u2713 In sync${m}`);return}let e={"new-remote":[],"modified-remote":[],"new-local":[],"modified-local":[],conflict:[],"deleted-local":[],"deleted-remote":[]};for(let t of i.changes)e[t.status].push(t.file);if(e["new-remote"].length>0){console.log(`${_}\u2193 New on remote (${e["new-remote"].length}):${m}`);for(let t of e["new-remote"])console.log(` + ${t}`);console.log("")}if(e["modified-remote"].length>0){console.log(`${_}\u2193 Modified on remote (${e["modified-remote"].length}):${m}`);for(let t of e["modified-remote"])console.log(` ~ ${t}`);console.log("")}if(e["new-local"].length>0){console.log(`${R}\u2191 New locally (${e["new-local"].length}):${m}`);for(let t of e["new-local"])console.log(` + ${t}`);console.log("")}if(e["modified-local"].length>0){console.log(`${R}\u2191 Modified locally (${e["modified-local"].length}):${m}`);for(let t of e["modified-local"])console.log(` ~ ${t}`);console.log("")}if(e.conflict.length>0){console.log(`${A}\u26A0 Conflicts (${e.conflict.length}):${m}`);for(let t of e.conflict)console.log(` ! ${t}`);console.log("")}if(e["deleted-local"].length>0){console.log(`${h}- Deleted locally (${e["deleted-local"].length}):${m}`);for(let t of e["deleted-local"])console.log(` - ${t}`);console.log("")}if(e["deleted-remote"].length>0){console.log(`${h}- Deleted on remote (${e["deleted-remote"].length}):${m}`);for(let t of e["deleted-remote"])console.log(` - ${t}`);console.log("")}if(i.pulled.length>0){console.log(`${_}Pulled ${i.pulled.length} file(s):${m}`);for(let t of i.pulled)console.log(` \u2713 ${t}`)}}function Gb(i){if(i.error){console.error(`${h}Error:${m} ${i.error}`);return}if(i.workspaces.length===0){console.log(`No .boxel-sync.json directories found under ${i.rootDir}.`);return}for(let e of i.workspaces){if(e.skipped){console.log(`${A}${e.localDir}${m} [${e.skipped}]`),e.error&&console.log(` ${g}${e.error}${m}`),console.log("");continue}let t={newRemote:0,modRemote:0,newLocal:0,modLocal:0,conflict:0,delLocal:0,delRemote:0};for(let r of e.changes)r.status==="new-remote"?t.newRemote++:r.status==="modified-remote"?t.modRemote++:r.status==="new-local"?t.newLocal++:r.status==="modified-local"?t.modLocal++:r.status==="conflict"?t.conflict++:r.status==="deleted-local"?t.delLocal++:r.status==="deleted-remote"&&t.delRemote++;if(console.log(`${e.localDir} ${g}${e.realmUrl}${m}`),e.inSync)console.log(` ${R}\u2713 in sync${m}`);else{let r=[];t.newRemote>0&&r.push(`${_}\u2193+${t.newRemote}${m}`),t.modRemote>0&&r.push(`${_}\u2193~${t.modRemote}${m}`),t.newLocal>0&&r.push(`${R}\u2191+${t.newLocal}${m}`),t.modLocal>0&&r.push(`${R}\u2191~${t.modLocal}${m}`),t.conflict>0&&r.push(`${A}\u26A0${t.conflict}${m}`),t.delLocal>0&&r.push(`${h}-L${t.delLocal}${m}`),t.delRemote>0&&r.push(`${h}-R${t.delRemote}${m}`),console.log(` ${r.join(" ")}`)}console.log("")}}function op(i){i.command("status").aliases(["st"]).description("Show pending changes between a local sync dir and its realm").argument("[local-dir]","Local sync directory (defaults to current working directory)").option("--pull","Download safe remote changes and update manifest").option("--all","Recursively report all .boxel-sync.json dirs under the current directory").option("--realm-secret-seed","Administrative auth: prompt for a realm secret seed and mint a JWT locally instead of using a Matrix profile (env: BOXEL_REALM_SECRET_SEED)").action(async(e,t)=>{let r=await xe(t.realmSecretSeed===!0);if(t.all){t.pull&&(console.error(`${h}Error:${m} Cannot use --pull with --all`),process.exit(1));let s=await Db(e??process.cwd(),{all:!0,realmSecretSeed:r});Gb(s),s.hasError&&process.exit(2);return}let n=await sp(e??process.cwd(),{pull:t.pull,realmSecretSeed:r});qb(n),n.hasError&&process.exit(n.pulled.length>0?2:1)})}var kn=T(require("path"));var Sn=class extends le{constructor(t,r){super(t,r);this.syncOptions=t}hasError=!1;pushedFiles=[];pulledFiles=[];remoteDeletedFiles=[];localDeletedFiles=[];skippedConflicts=[];get conflictStrategy(){return this.syncOptions.preferLocal?"prefer-local":this.syncOptions.preferRemote?"prefer-remote":this.syncOptions.preferNewest?"prefer-newest":null}async sync(){console.log(`Starting sync between ${this.options.localDir} and ${this.options.realmUrl}`),console.log("Testing realm access...");let t;try{t=await this.getRemoteFileList("")}catch(E){throw console.error("Failed to access realm:",E),new Error("Cannot proceed with sync: Authentication or access failed. Please check your credentials and realm permissions.")}console.log("Realm access verified");let[r,n,s]=await Promise.all([this.getLocalFileListWithMtimes(),this.getRemoteMtimes(),ye(this.options.localDir)]),o=new Map;for(let[E,$]of r)o.set(E,$.path);if(n.size===0&&t&&t.size>0){console.log("Remote mtimes unavailable, falling back to file listing for remote detection");for(let[E]of t)n.set(E,0)}console.log(`Found ${o.size} local files`),console.log(`Found ${n.size} remote files`),s&&s.realmUrl!==this.normalizedRealmUrl&&console.warn(`${A}Warning:${m} Manifest realm URL (${s.realmUrl}) differs from target (${this.normalizedRealmUrl}). Treating as first sync.`);let a=s&&s.realmUrl===this.normalizedRealmUrl?s:null,c=new Map;await Promise.all(Array.from(o.entries()).map(async([E,$])=>{F(E)||c.set(E,await re($))}));let l=new Set;for(let E of o.keys())l.add(E);for(let E of n.keys())l.add(E);if(a){for(let E of Object.keys(a.files))l.add(E);if(a.remoteMtimes)for(let E of Object.keys(a.remoteMtimes))l.add(E)}let p=[];for(let E of l){if(F(E))continue;let $=_i(E,c,a),O=Ci(E,n,a),U=rp($,O,this.syncOptions);p.push({relativePath:E,localStatus:$,remoteStatus:O,action:U})}let u=[],d=[],f=[],x=[],w=[],M=0;for(let E of p)switch(E.action){case"push":u.push(E.relativePath);break;case"pull":d.push(E.relativePath);break;case"push-delete":f.push(E.relativePath);break;case"pull-delete":x.push(E.relativePath);break;case"conflict":w.push(E);break;case"noop":M++;break}for(let E of w)switch(np(E,r,n,this.conflictStrategy)){case"push":u.push(E.relativePath);break;case"pull":d.push(E.relativePath);break;case"push-delete":f.push(E.relativePath);break;case"pull-delete":x.push(E.relativePath);break;case"noop":break;default:this.skippedConflicts.push(E.relativePath);break}if(console.log(`
|
|
100
|
+
${g}Sync plan:${m}`),u.length>0&&console.log(` ${R}\u2191 Push:${m} ${u.length} file(s)`),d.length>0&&console.log(` ${_}\u2193 Pull:${m} ${d.length} file(s)`),f.length>0&&console.log(` ${h}\u2191 Delete remote:${m} ${f.length} file(s)`),x.length>0&&console.log(` ${h}\u2193 Delete local:${m} ${x.length} file(s)`),this.skippedConflicts.length>0){console.log(` ${A}\u26A0 Conflicts skipped:${m} ${this.skippedConflicts.length} file(s)`);for(let E of this.skippedConflicts)console.log(` ${E}`);console.log(` ${g}Use --prefer-local, --prefer-remote, or --prefer-newest to resolve.${m}`)}if(M>0&&console.log(` ${g}Unchanged: ${M} file(s)${m}`),u.length+d.length+f.length+x.length===0){console.log(`
|
|
101
|
+
Everything is up to date`),!this.options.dryRun&&!a&&this.skippedConflicts.length===0&&await this.writeManifest(c,n);return}if(d.length>0){console.log(`
|
|
102
|
+
Pulling ${d.length} file(s)...`);let E=await Promise.all(d.map($=>this.remoteLimit(async()=>{try{let O=kn.join(this.options.localDir,$);return await this.downloadFile($,O),$}catch(O){return this.hasError=!0,console.error(`Error downloading ${$}:`,O),null}})));this.pulledFiles.push(...E.filter($=>$!==null))}if(u.length>0){console.log(`
|
|
103
|
+
Pushing ${u.length} file(s)...`);let E=new Map;for(let U of u){let Rt=o.get(U);Rt&&E.set(U,Rt)}let $=new Set;for(let U of E.keys()){let Rt=a?.files[U]!==void 0,Fp=n.has(U);!Rt&&!Fp&&$.add(U)}let O=await this.uploadFilesAtomic(E,$);if(this.pushedFiles.push(...O.succeeded),O.error){this.hasError=!0,console.error(O.error.message);for(let U of O.error.perFile)console.error(` ${U.path}: ${U.title}`)}}if(f.length>0){console.log(`
|
|
104
|
+
Deleting ${f.length} remote file(s)...`);let E=await Promise.all(f.map($=>this.remoteLimit(async()=>{try{return await this.deleteFile($),$}catch(O){return this.hasError=!0,console.error(`Error deleting remote ${$}:`,O),null}})));this.remoteDeletedFiles.push(...E.filter($=>$!==null))}if(x.length>0){console.log(`
|
|
105
|
+
Deleting ${x.length} local file(s)...`);let E=await Promise.all(x.map(async $=>{try{let O=o.get($);return O?(await this.deleteLocalFile(O),$):null}catch(O){return this.hasError=!0,console.error(`Error deleting local ${$}:`,O),null}}));this.localDeletedFiles.push(...E.filter($=>$!==null))}if(!this.options.dryRun){let E=new Map;if(a)for(let[O,U]of Object.entries(a.files))E.set(O,U);for(let[O,U]of c)E.set(O,U);for(let O of this.pushedFiles){let U=o.get(O);U&&E.set(O,await re(U))}for(let O of this.pulledFiles){let U=kn.join(this.options.localDir,O);E.set(O,await re(U))}for(let O of this.remoteDeletedFiles)E.delete(O);for(let O of this.localDeletedFiles)E.delete(O);let $=n;if(this.pushedFiles.length>0||this.remoteDeletedFiles.length>0)try{$=await this.getRemoteMtimes()}catch{console.warn("Could not refresh remote mtimes after sync")}await this.writeManifest(E,$)}if(!this.options.dryRun){let E=[...this.pushedFiles.map($=>({file:$,status:"modified"})),...this.pulledFiles.map($=>({file:$,status:"modified"})),...this.remoteDeletedFiles.map($=>({file:$,status:"deleted"})),...this.localDeletedFiles.map($=>({file:$,status:"deleted"}))];if(E.length>0){let O=await new q(this.options.localDir).createCheckpoint("local",E);if(O){let U=O.isMajor?"[MAJOR]":"[minor]";console.log(`
|
|
106
106
|
Checkpoint created: ${O.shortHash} ${U} ${O.message}`)}}}console.log(`
|
|
107
|
-
Sync completed`)}async writeManifest(t,
|
|
108
|
-
`),{ok:!0,staleOverwrote:
|
|
109
|
-
`),await
|
|
110
|
-
`)}let
|
|
111
|
-
${_}\u21C5 Watch stopped${m}`),
|
|
112
|
-
`)){if(!
|
|
113
|
-
${
|
|
114
|
-
`}catch{}return
|
|
107
|
+
Sync completed`)}async writeManifest(t,r){let n={realmUrl:this.normalizedRealmUrl,files:{},remoteMtimes:{}};for(let[s,o]of t){n.files[s]=o;let a=r.get(s);a!==void 0&&a!==0&&(n.remoteMtimes[s]=a)}n.remoteMtimes&&Object.keys(n.remoteMtimes).length===0&&delete n.remoteMtimes,await Oe(this.options.localDir,n)}};function ap(i){return i.command("sync").description("Bidirectional sync between a local directory and a Boxel realm").argument("<local-dir>","The local directory to sync").argument("<realm-url>","The URL of the target realm (e.g., https://app.boxel.ai/demo/)").option("--prefer-local","Resolve conflicts by keeping local version").option("--prefer-remote","Resolve conflicts by keeping remote version").option("--prefer-newest","Resolve conflicts by keeping newest version").option("--delete","Sync deletions both ways").option("--dry-run","Preview without making changes").option("--realm-secret-seed","Administrative auth: prompt for a realm secret seed and mint a JWT locally instead of using a Matrix profile (env: BOXEL_REALM_SECRET_SEED)").action(async(t,r,n)=>{let s=await xe(n.realmSecretSeed===!0),o=await Hb(t,r,{preferLocal:n.preferLocal,preferRemote:n.preferRemote,preferNewest:n.preferNewest,delete:n.delete,dryRun:n.dryRun,realmSecretSeed:s}),a=Array.isArray(o.pushed)&&o.pushed.length>0||Array.isArray(o.pulled)&&o.pulled.length>0||Array.isArray(o.remoteDeleted)&&o.remoteDeleted.length>0||Array.isArray(o.localDeleted)&&o.localDeleted.length>0;o.error&&(console.error(`Error: ${o.error}`),process.exit(a?2:1)),console.log("Sync completed successfully")})}async function Hb(i,e,t){let r;if(t.authenticator)r=t.authenticator;else{let o=be({realmUrl:e,realmSecretSeed:t.realmSecretSeed,profileManager:t.profileManager});if(!o.ok)return $n({error:o.error});r=o.authenticator}if([t.preferLocal,t.preferRemote,t.preferNewest].filter(Boolean).length>1)return $n({error:"Only one conflict strategy can be specified (--prefer-local, --prefer-remote, or --prefer-newest)."});if(!await Qe(i))return $n({error:`Local directory does not exist: ${i}`});let s;try{s=new Sn({realmUrl:e,localDir:i,preferLocal:t.preferLocal,preferRemote:t.preferRemote,preferNewest:t.preferNewest,deleteSync:t.delete,dryRun:t.dryRun,waitForIndex:t.waitForIndex},r),await s.sync()}catch(o){return{pushed:s?.pushedFiles.slice().sort()??[],pulled:s?.pulledFiles.slice().sort()??[],remoteDeleted:s?.remoteDeletedFiles.slice().sort()??[],localDeleted:s?.localDeletedFiles.slice().sort()??[],skippedConflicts:s?.skippedConflicts.slice().sort()??[],hasError:!0,error:`Sync failed: ${o instanceof Error?o.message:String(o)}`}}return{pushed:s.pushedFiles.slice().sort(),pulled:s.pulledFiles.slice().sort(),remoteDeleted:s.remoteDeletedFiles.slice().sort(),localDeleted:s.localDeletedFiles.slice().sort(),skippedConflicts:s.skippedConflicts.slice().sort(),hasError:s.hasError,error:s.hasError?Wb(s):void 0}}function Wb(i){return`Sync completed with errors. ${[`${i.pushedFiles.length} pushed`,`${i.pulledFiles.length} pulled`,`${i.remoteDeletedFiles.length} remote deleted`,`${i.localDeletedFiles.length} local deleted`,`${i.skippedConflicts.length} conflicts skipped`].join(", ")}.`}function $n(i){return{pushed:[],pulled:[],remoteDeleted:[],localDeleted:[],skippedConflicts:[],hasError:!0,...i}}var cp=T(Ct());function Vb(i){let e=Number.parseInt(i,10);if(!Number.isFinite(e)||e<0||String(e)!==i.trim())throw new cp.InvalidArgumentError("--timeout must be a non-negative integer (milliseconds).");return e}async function Bb(i,e={}){let t=e.timeoutMs??3e4;if(!Number.isFinite(t)||t<0)return{ready:!1,error:`Invalid timeoutMs: must be a finite, non-negative number (got ${e.timeoutMs}).`};let r=e.profileManager??C();if(!r.getActiveProfile())return{ready:!1,error:P};let s=`${k(i)}_readiness-check`,o=Date.now();for(;Date.now()-o<t;){try{if((await r.authedRealmFetch(s,{method:"GET",headers:{Accept:"application/vnd.api+json"}})).ok)return{ready:!0}}catch{}let a=t-(Date.now()-o);if(a<=0)break;await new Promise(c=>setTimeout(c,Math.min(1e3,a)))}return{ready:!1,error:`Realm not ready after ${t}ms: ${s}`}}function lp(i){i.command("wait-for-ready").description("Poll a realm readiness-check endpoint until it responds OK or the timeout is reached").requiredOption("--realm <realm-url>","The realm URL to check").option("--timeout <ms>","Timeout in milliseconds (default: 30000)",Vb).action(async e=>{let t;try{t=await Bb(e.realm,{timeoutMs:e.timeout})}catch(r){console.error(`${h}Error:${m} ${r instanceof Error?r.message:String(r)}`),process.exit(1)}t.ready?console.log(`${R}Realm is ready.${m}`):(console.error(`${h}Error:${m} ${t.error??"Realm not ready"}`),process.exit(1))})}var Ln=T(Ct()),bp=T(require("fs/promises")),Ti=T(require("path"));var Te=T(require("fs/promises")),pp=T(require("path")),zb=".boxel-watch.lock";function _n(i){return pp.join(i,zb)}function Cn(i){try{return process.kill(i,0),!0}catch(e){return e?.code==="EPERM"}}async function Yb(i){try{let e=await Te.readFile(_n(i),"utf8"),t=JSON.parse(e);return typeof t.pid!="number"||typeof t.startedAt!="string"||typeof t.realmUrl!="string"?null:t}catch{return null}}async function up(i,e){await Te.mkdir(i,{recursive:!0});let t=await Yb(i),r=!1;if(t&&Cn(t.pid))return{ok:!1,existing:t};t&&(r=!0);let n={pid:process.pid,startedAt:new Date().toISOString(),realmUrl:e};return await Te.writeFile(_n(i),JSON.stringify(n,null,2)+`
|
|
108
|
+
`),{ok:!0,staleOverwrote:r}}async function Oi(i){try{await Te.unlink(_n(i))}catch(e){if(e?.code!=="ENOENT")throw e}}var Pe=T(require("fs/promises")),mp=T(require("os")),On=T(require("path"));function dp(){return On.join(mp.homedir(),".boxel-cli")}function fp(){return On.join(dp(),"watch-processes.json")}async function hp(){try{let i=await Pe.readFile(fp(),"utf8"),e=JSON.parse(i);return Array.isArray(e?.processes)?{processes:e.processes.filter(r=>typeof r?.pid=="number"&&typeof r?.workspace=="string"&&typeof r?.startedAt=="string")}:{processes:[]}}catch{return{processes:[]}}}async function Tn(i){await Pe.mkdir(dp(),{recursive:!0});let e=fp(),t=`${e}.${process.pid}.tmp`;await Pe.writeFile(t,JSON.stringify(i,null,2)+`
|
|
109
|
+
`),await Pe.rename(t,e)}async function gp(){let i=await hp(),e=i.processes.filter(t=>Cn(t.pid));return e.length!==i.processes.length&&await Tn({processes:e}),{processes:e}}async function xp(i){let t=(await gp()).processes.filter(r=>r.pid!==process.pid);t.push({pid:process.pid,workspace:i,startedAt:new Date().toISOString()}),await Tn({processes:t})}async function vp(){let i=await hp(),e=i.processes.filter(t=>t.pid!==process.pid);e.length!==i.processes.length&&await Tn({processes:e})}async function Pn(){return(await gp()).processes}var An=class extends le{name;debounceMs;overwriteLocal;checkpointManager;lastKnownMtimes=new Map;pendingChanges=new Map;debounceTimer=null;isShutdown=!1;constructor(e,t,r){super({realmUrl:e.realmUrl,localDir:e.localDir},t),this.debounceMs=r.debounceMs,this.overwriteLocal=r.overwriteLocal??!1,this.checkpointManager=new q(e.localDir),this.name=Qb(this.normalizedRealmUrl)}async sync(){await this.poll(),await this.flushPending()}async getRemoteMtimes(){let e=`${this.normalizedRealmUrl}_mtimes`,t=await this.authenticator.authedRealmFetch(e,{headers:{Accept:"application/vnd.api+json"}});if(!t.ok)throw new Error(`_mtimes fetch failed for ${this.normalizedRealmUrl}: ${t.status} ${t.statusText}`);let r=await t.json(),n=new Map;for(let[s,o]of Object.entries(r.data?.attributes?.mtimes??{}))n.set(s.replace(this.normalizedRealmUrl,""),o);return n}get localDir(){return this.options.localDir}get realmUrl(){return this.normalizedRealmUrl}get pendingCount(){return this.pendingChanges.size}async initialize(){await this.getRemoteMtimes(),await this.checkpointManager.isInitialized()||await this.checkpointManager.init();let e=await ye(this.options.localDir);if(e&&e.realmUrl===this.normalizedRealmUrl&&e.remoteMtimes)for(let[t,r]of Object.entries(e.remoteMtimes))this.lastKnownMtimes.set(t,r)}async poll(){let e=await this.getRemoteMtimes(),t=!1;for(let[r,n]of e){if(F(r))continue;let s=this.lastKnownMtimes.get(r);s===void 0?this.recordPending(r,{status:"added",mtime:n})&&(t=!0):n>s&&this.recordPending(r,{status:"modified",mtime:n})&&(t=!0)}for(let r of this.lastKnownMtimes.keys())F(r)||e.has(r)||this.pendingChanges.get(r)?.status!=="deleted"&&(this.pendingChanges.set(r,{status:"deleted",mtime:0}),t=!0);return t}async flushPending(){if(this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingChanges.size===0)return{pulled:[],deleted:[],skipped:[],checkpoint:null};let e=new Map(this.pendingChanges);this.pendingChanges.clear();let t=[],r=[],n=[],s=[],o=null;if(!this.overwriteLocal){let l=await ye(this.options.localDir);l&&l.realmUrl===this.normalizedRealmUrl&&(o=l)}for(let[l,p]of e){let u=Ti.join(this.options.localDir,l);if(!this.overwriteLocal&&await this.localDivergesFromManifest(u,l,o,p.status)){n.push(l);continue}if(p.status==="deleted"){try{await bp.unlink(u)}catch(d){if(d.code!=="ENOENT")throw d}r.push(l),s.push({file:l,status:"deleted"})}else await this.downloadFile(l,u),t.push(l),s.push({file:l,status:p.status})}let a=new Set(n);for(let[l,p]of e)a.has(l)||(p.status==="deleted"?this.lastKnownMtimes.delete(l):this.lastKnownMtimes.set(l,p.mtime));let c=null;return s.length>0&&(await this.persistManifest(t,r),c=await this.checkpointManager.createCheckpoint("remote",s)),{pulled:t,deleted:r,skipped:n,checkpoint:c}}async localDivergesFromManifest(e,t,r,n){let s;try{s=await re(e)}catch(a){if(a.code!=="ENOENT")throw a;return n==="deleted"?!1:r?.files[t]!==void 0}let o=r?.files[t];return o===void 0?!0:s!==o}scheduleFlush(e){this.isShutdown||(this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(async()=>{this.debounceTimer=null;try{let t=await this.flushPending();e?.(t)}catch(t){console.error(`${h}[${this.name}] Error applying changes:${m}`,t)}},this.debounceMs))}shutdown(){this.isShutdown=!0,this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}recordPending(e,t){let r=this.pendingChanges.get(e);return r&&r.mtime===t.mtime?!1:(this.pendingChanges.set(e,t),!0)}async persistManifest(e,t){let r=await ye(this.options.localDir),n=r&&r.realmUrl===this.normalizedRealmUrl?r.files:null,s=n?{...n}:{};for(let c of t)delete s[c];for(let c of e){let l=Ti.join(this.options.localDir,c);try{s[c]=await re(l)}catch(p){if(p.code!=="ENOENT")throw p}}let o={};for(let[c,l]of this.lastKnownMtimes)l!==0&&(o[c]=l);let a={realmUrl:this.normalizedRealmUrl,files:s};Object.keys(o).length>0&&(a.remoteMtimes=o),await Oe(this.options.localDir,a)}};async function Jb(i,e={}){if(i.length===0)return{watchers:[],error:"No realms provided to watch."};let t=e.intervalMs??3e4,r=e.debounceMs??5e3,n=e.quiet??!1,s=e.overwriteLocal??!1;if(!Number.isFinite(t)||t<=0)return{watchers:[],error:"`intervalMs` must be a positive number."};if(!Number.isFinite(r)||r<0)return{watchers:[],error:"`debounceMs` must be a non-negative number."};let o;if(e.authenticator)o=e.authenticator;else{let f=be({realmUrl:i[0].realmUrl,realmSecretSeed:e.realmSecretSeed,profileManager:e.profileManager});if(!f.ok)return{watchers:[],error:f.error};o=f.authenticator}let a=[];for(let f of i){let x=await up(f.localDir,f.realmUrl);if(!x.ok){for(let w of a)await Oi(w);return{watchers:[],error:Xb(f.localDir,x.existing)}}x.staleOverwrote&&!n&&console.log(`${g}[${Pi()}] overwrote stale lock at ${f.localDir}${m}`),a.push(f.localDir)}let c=[];for(let f of i){let x=new An(f,o,{debounceMs:r,overwriteLocal:s});try{await x.initialize()}catch(w){for(let M of c)M.shutdown();for(let M of a)await Oi(M);return{watchers:[],error:`Failed to initialize watch on ${f.realmUrl}: ${w instanceof Error?w.message:String(w)}`}}c.push(x)}if(!n){console.log(`${_}\u21C5 Watching ${c.length} realm${c.length>1?"s":""}:${m}`);for(let f of c)console.log(` ${f.name} ${g}\u2192${m} ${f.localDir}`);console.log(` ${g}Interval: ${t/1e3}s, Debounce: ${r/1e3}s${m}`),console.log(` ${g}Press Ctrl+C to stop${m}
|
|
110
|
+
`)}let l=async()=>{await Promise.all(c.map(async f=>{try{await f.poll()&&(n||console.log(`${g}[${Pi()}]${m} [${f.name}] ${A}\u26A1 ${f.pendingCount} change(s) detected${m}`),f.scheduleFlush(w=>{n||Kb(f.name,w)}))}catch(x){console.error(`${h}[${f.name}] poll error:${m}`,x instanceof Error?x.message:x)}}))},p=!1,u=null,d=()=>{p||(u=setTimeout(async()=>{u=null,!p&&(await l(),d())},t))};try{await xp(i.map(f=>f.localDir).join(", "))}catch{}return await l(),d(),await new Promise(f=>{let x=null,w=null,M=async()=>{if(!p){p=!0,u!==null&&(clearTimeout(u),u=null);for(let Z of c)Z.shutdown();x&&process.off("SIGINT",x),w&&process.off("SIGTERM",w);for(let Z of a)try{await Oi(Z)}catch{}try{await vp()}catch{}f()}};if(e.signal){if(e.signal.aborted){M();return}e.signal.addEventListener("abort",()=>void M(),{once:!0})}else x=()=>{n||console.log(`
|
|
111
|
+
${_}\u21C5 Watch stopped${m}`),M()},w=x,process.on("SIGINT",x),process.on("SIGTERM",w)}),{watchers:c}}function Xb(i,e){return`A boxel realm watch process is already active for ${i} (pid ${e.pid}, started ${e.startedAt}). Stop it before starting a new one, or remove ${Ti.join(i,".boxel-watch.lock")} if it's stale.`}function Kb(i,e){let t=e.pulled.length+e.deleted.length;if(t>0&&(console.log(`${g}[${Pi()}]${m} [${i}] ${R}applied ${t} change(s)${m} (${e.pulled.length} pulled, ${e.deleted.length} deleted)`),e.checkpoint)){let r=e.checkpoint.isMajor?"[MAJOR]":"[minor]";console.log(` ${g}Checkpoint:${m} ${e.checkpoint.shortHash} ${r} ${e.checkpoint.message}`)}for(let r of e.skipped)console.log(`${g}[${Pi()}]${m} [${i}] ${A}\u26A0 skipped ${r}: local diverges from sync manifest (rerun with --overwrite-local to discard, or \`boxel realm sync\` to reconcile)${m}`)}function Qb(i){return i.replace(/\/$/,"").split("/").slice(-2).join("/")}function Pi(){return new Date().toLocaleTimeString()}function Zb(i){return e=>{let t=Number.parseFloat(e);if(!Number.isFinite(t)||t<=0)throw new Ln.InvalidArgumentError(`${i} must be a positive number.`);return t}}function ey(i){return e=>{let t=Number.parseFloat(e);if(!Number.isFinite(t)||t<0)throw new Ln.InvalidArgumentError(`${i} must be a non-negative number.`);return t}}function yp(i){i.command("start").description("Start watching a Boxel realm for server-side changes and pull them into a local directory").argument("<realm-url>","The URL of the realm to watch (e.g., https://app.boxel.ai/demo/)").argument("<local-dir>","The local directory to write changes into").option("-i, --interval <seconds>","Polling interval in seconds",Zb("--interval"),30).option("-d, --debounce <seconds>","Seconds to wait after a burst of changes before applying them",ey("--debounce"),5).option("--realm-secret-seed","Administrative auth: prompt for a realm secret seed and mint a JWT locally instead of using a Matrix profile (env: BOXEL_REALM_SECRET_SEED)").option("--overwrite-local","Overwrite local files when the remote changes. Default: skip + warn when the local copy diverges from the sync manifest.").action(async(e,t,r)=>{let n=await xe(r.realmSecretSeed===!0),s=await Jb([{realmUrl:e,localDir:t}],{intervalMs:r.interval*1e3,debounceMs:r.debounce*1e3,realmSecretSeed:n,overwriteLocal:r.overwriteLocal===!0});s.error&&(console.error(`${h}Error:${m} ${s.error}`),process.exit(1))})}var jn=require("child_process");var ty=200;function iy(i){return new Promise(e=>setTimeout(e,i))}function wp(i){try{if(process.platform==="win32")try{process.kill(i)}catch{(0,jn.execSync)(`taskkill /PID ${i} /F`,{stdio:"ignore"})}else process.kill(i,"SIGINT");return{ok:!0,alreadyGone:!1}}catch(e){return e?.code==="ESRCH"?{ok:!0,alreadyGone:!0}:{ok:!1,alreadyGone:!1}}}function ry(){if(process.platform==="win32")return[];let i;try{i=(0,jn.execSync)('ps aux | grep -E "(tsx[[:space:]].*src/index\\.ts[[:space:]]+realm[[:space:]]+watch[[:space:]]+start|[[:space:]]boxel[[:space:]]+realm[[:space:]]+watch[[:space:]]+start|node[[:space:]].*boxel[[:space:]]+realm[[:space:]]+watch[[:space:]]+start)" | grep -v grep | grep -v "[[:space:]]stop"',{encoding:"utf8"}).trim()}catch{return[]}if(!i)return[];let e=[],t=new Set;for(let r of i.split(`
|
|
112
|
+
`)){if(!r)continue;let n=r.trim().split(/\s+/),s=Number.parseInt(n[1]??"",10);if(!Number.isFinite(s)||t.has(s))continue;t.add(s);let o=".",a=r.match(/\bstart\s+\S+\s+(\S+)/);a&&a[1]&&!a[1].startsWith("-")&&(o=a[1]),e.push({pid:s,workspace:o})}return e}async function ny(){let i=[],e=[],t=new Set,r=await Pn();for(let n of r){if(n.pid===process.pid)continue;t.add(n.pid);let s=wp(n.pid),o={pid:n.pid,workspace:n.workspace};s.ok?i.push(o):e.push(o)}for(let n of ry()){if(n.pid===process.pid||t.has(n.pid))continue;t.add(n.pid);let s=wp(n.pid),o={pid:n.pid,workspace:n.workspace};s.ok?i.push(o):e.push(o)}return i.length>0&&(await iy(ty),await Pn()),{stopped:i,failed:e}}function sy(i){if(i.stopped.length===0&&i.failed.length===0){console.log("No running watch processes found.");return}for(let e of i.stopped)console.log(` ${g}\u21C5${m} Stopped: boxel realm watch ${e.workspace} (PID ${e.pid})`);for(let e of i.failed)console.log(` ${h}\xD7${m} Failed to stop: boxel realm watch ${e.workspace} (PID ${e.pid})`);if(i.stopped.length>0){let e=i.stopped.length>1?"es":"";console.log(`
|
|
113
|
+
${R}\u2713 Stopped ${i.stopped.length} process${e}${m}`)}}function Ep(i){i.command("stop").description("Stop all running boxel realm watch processes").action(async()=>{let e=await ny();sy(e)})}function Rp(i){let e=i.command("watch").description("Watch a Boxel realm; subcommands manage watch processes");yp(e),Ep(e)}function $p(i){let e=i.command("realm").description("Manage realms on the realm server");vl(e),El(e),Dl(e),ql(e),Hl(e),Yl(e),Ql(e),ep(e),ip(e);let t=ap(e);op(t),Wl(e),lp(e),Rp(e)}async function oy(i,e,t){let r=t?.profileManager??C();if(!r.getActiveProfile())return{ok:!1,error:P};if(F(e))return{ok:!1,error:`Cannot delete protected file: ${e}`};let s=new URL(e,k(i)).href,o;try{o=await r.authedRealmFetch(s,{method:"DELETE",headers:{Accept:"application/vnd.card+source"}})}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}if(!o.ok){let a=await o.text().catch(()=>"(no body)");return{ok:!1,error:`HTTP ${o.status}: ${a.slice(0,300)}`}}return{ok:!0}}function kp(i){i.command("delete").description("Delete a file from a realm").argument("<path>","Realm-relative file path to delete").requiredOption("--realm <realm-url>","The realm URL to delete from").option("--json","Output raw JSON response").action(async(e,t)=>{let r;try{r=await oy(t.realm,e)}catch(n){console.error(`${h}Error:${m} ${n instanceof Error?n.message:String(n)}`),process.exit(1)}t.json?j.output(JSON.stringify(r,null,2)):r.ok?console.log(`${g}Deleted:${m} ${e}`):console.error(`${h}Error:${m} ${r.error}`),r.ok||process.exit(1)})}async function Mn(i,e,t){let r=t?.profileManager??C();if(!r.getActiveProfile())return{ok:!1,error:P};let s=new URL(e,k(i)).href,o;try{o=await r.authedRealmFetch(s,{method:"GET",headers:{Accept:"application/vnd.card+source"}})}catch(c){return{ok:!1,error:c instanceof Error?c.message:String(c)}}if(!o.ok){let c=await o.text().catch(()=>"(no body)");return{ok:!1,status:o.status,error:`HTTP ${o.status}: ${c.slice(0,300)}`}}if(ve(e)){let c=new Uint8Array(await o.arrayBuffer());return{ok:!0,status:o.status,bytes:c}}let a=await o.text();return{ok:!0,status:o.status,content:a}}function Sp(i){i.command("read").description("Read a file from a realm").argument("<path>","Realm-relative file path (e.g., hello-world.json, Cards/my-card.gts)").requiredOption("--realm <realm-url>","The realm URL to read from").option("--json","Output raw JSON response").action(async(e,t)=>{let r;try{r=await Mn(t.realm,e)}catch(n){console.error(`${h}Error:${m} ${n instanceof Error?n.message:String(n)}`),process.exit(1)}if(t.json){let n={ok:r.ok,status:r.status,error:r.error};r.content!==void 0&&(n.content=r.content),r.bytes!==void 0&&(n.bytesBase64=Buffer.from(r.bytes.buffer,r.bytes.byteOffset,r.bytes.byteLength).toString("base64")),j.output(JSON.stringify(n,null,2))}else r.ok?r.bytes!==void 0?process.stdout.write(r.bytes):j.output(r.content??""):(console.error(`${g}Status:${m} ${r.status??"(no status)"}`),console.error(`${h}Error:${m} ${r.error}`));r.ok||process.exit(1)})}var In="// touched for re-index";async function ay(i,e,t){let r=t?.profileManager??C();if(!r.getActiveProfile())return{ok:!1,touched:[],skipped:[],error:P};let s;if(t?.all){if(e.length>0)return{ok:!1,touched:[],skipped:[],error:"Cannot pass file paths together with --all"};let c=await Ne(i,{profileManager:r});if(c.error)return{ok:!1,touched:[],skipped:[],error:c.error};s=c.filenames.filter(l=>(l.endsWith(".json")||l.endsWith(".gts"))&&!F(l))}else{if(e.length===0)return{ok:!1,touched:[],skipped:[],error:"No file paths provided. Pass paths or use --all."};s=e}let o=[],a=[];for(let c of s){if(!c.endsWith(".json")&&!c.endsWith(".gts")){a.push({path:c,reason:"unsupported extension"});continue}if(F(c)){a.push({path:c,reason:"protected file"});continue}let l=await Mn(i,c,{profileManager:r});if(!l.ok||l.content==null){a.push({path:c,reason:l.error??"read failed"});continue}if(t?.dryRun){o.push(c);continue}let p=c.endsWith(".json")?cy(l.content):py(l.content),u=await gt(i,c,p,{profileManager:r});if(!u.ok){a.push({path:c,reason:u.error??"write failed"});continue}o.push(c)}return{ok:a.length===0,touched:o,skipped:a}}function cy(i){try{let e=JSON.parse(i);if(e?.data)return e.data.meta={...e.data.meta??{},_touched:Date.now()},JSON.stringify(e,null,2)+`
|
|
114
|
+
`}catch{}return ly(i)}function ly(i){return i.endsWith(`
|
|
115
115
|
|
|
116
|
-
`)?
|
|
117
|
-
`}function
|
|
118
|
-
${
|
|
119
|
-
`;return
|
|
120
|
-
`:
|
|
121
|
-
`)?
|
|
122
|
-
`:
|
|
123
|
-
`+
|
|
124
|
-
`}function
|
|
125
|
-
${g}${s} ${
|
|
126
|
-
`)}),
|
|
127
|
-
`)}));let
|
|
116
|
+
`)?i.slice(0,-1):i+`
|
|
117
|
+
`}function py(i){let e=`
|
|
118
|
+
${In}
|
|
119
|
+
`;return i.endsWith(e)?i.slice(0,-e.length)+`
|
|
120
|
+
`:i.endsWith(`
|
|
121
|
+
`)?i+In+`
|
|
122
|
+
`:i+`
|
|
123
|
+
`+In+`
|
|
124
|
+
`}function _p(i){i.command("touch").description("Force realm re-indexing of one or more files by making a semantically-neutral edit. --all touches every .json/.gts in the realm without confirmation; use with care.").argument("[paths...]","Realm-relative file path(s) to touch (omit when using --all)").requiredOption("--realm <realm-url>","The realm URL to touch files in").option("--all","Touch every .json and .gts file in the realm").option("--dry-run","Print files that would be touched without writing").option("--json","Output raw JSON response").action(async(e,t)=>{let r;try{r=await ay(t.realm,e,{all:t.all,dryRun:t.dryRun})}catch(n){console.error(`${h}Error:${m} ${n instanceof Error?n.message:String(n)}`),process.exit(1)}if(t.json)console.log(JSON.stringify(r,null,2));else if(r.error)console.error(`${h}Error:${m} ${r.error}`);else{let n=t.dryRun?`${g}[dry-run]${m} `:"";for(let o of r.touched)console.log(`${n}${R}touched${m} ${o}`);for(let{path:o,reason:a}of r.skipped)console.log(`${h}skipped${m} ${o} ${g}(${a})${m}`);let s=t.dryRun?"would touch":"touched";console.log(`
|
|
125
|
+
${g}${s} ${r.touched.length} file(s)${r.skipped.length>0?`, skipped ${r.skipped.length}`:""}${m}`)}r.ok||process.exit(1)})}function Cp(i){let e=i.command("file").description("Read, write, and manage files in a realm");kp(e),ll(e),cl(e),Sp(e),_p(e),al(e)}async function uy(i,e,t){let r=t?.profileManager??C(),n=r.getActiveProfile();if(!n)throw new Error("No active profile. Run `boxel profile add` to create one.");let o=`${n.profile.realmServerUrl.replace(/\/$/,"")}/_run-command`,a={data:{type:"run-command",attributes:{realmURL:e,command:i,commandInput:t?.input??null}}},c;try{c=await r.authedRealmServerFetch(o,{method:"POST",headers:{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json"},body:JSON.stringify(a)})}catch(u){return{status:"error",error:`run-command fetch failed: ${u instanceof Error?u.message:String(u)}`}}if(!c.ok){let u=await c.text().catch(()=>"(no body)");return{status:"error",error:`run-command HTTP ${c.status}: ${u}`}}let l;try{l=await c.json()}catch{return{status:"error",error:`run-command response was not valid JSON (HTTP ${c.status})`}}let p=l.data?.attributes;return{status:p?.status??"error",result:p?.cardResultString??null,error:p?.error??null}}function Op(i){i.command("run-command").description("Execute a host command on the realm server via the prerenderer").argument("<command-specifier>","Command module path (e.g. @cardstack/boxel-host/commands/get-card-type-schema/default)").requiredOption("--realm <realm-url>","The realm URL context for the command").option("--input <json>","JSON string of command input").option("--json","Output raw JSON response").action(async(e,t)=>{let r;if(t.input)try{let s=JSON.parse(t.input);(typeof s!="object"||s===null||Array.isArray(s))&&(console.error(`${h}Error:${m} --input must be a JSON object, got ${Array.isArray(s)?"array":typeof s}`),process.exit(1)),r=s}catch{console.error(`${h}Error:${m} --input is not valid JSON: ${t.input}`),process.exit(1)}let n;try{n=await uy(e,t.realm,{input:r})}catch(s){console.error(`${h}Error:${m} ${s instanceof Error?s.message:String(s)}`),process.exit(1)}if(t.json)j.output(JSON.stringify(n,null,2));else{if(console.log(`${g}Status:${m} ${my(n.status)}${n.status}${m}`),n.result){console.log(`${g}Result:${m}`);try{j.output(JSON.stringify(JSON.parse(n.result),null,2))}catch{j.output(n.result)}}n.error&&console.error(`${h}Error:${m} ${n.error}`)}(n.status==="error"||n.status==="unusable")&&process.exit(1)})}function my(i){switch(i){case"ready":return R;case"error":return h;default:return _}}var Tp=require("node:child_process"),Et=require("node:fs"),Pp=require("node:http"),G=require("node:path");async function dy(){try{return(await import("@playwright/test")).chromium}catch(i){let e=i instanceof Error?i.message:String(i);throw new Error(`Could not load @playwright/test (${e}). \`boxel test\` is monorepo-only \u2014 install Playwright in the boxel-cli package via \`pnpm --filter @cardstack/boxel-cli install\` and run \`npx playwright install chromium\` once.`)}}async function fy(i,e){let t=e?.profileManager??C(),r=t.getActiveProfile();if(!r)return Nn(P);let n=k(i),s=k(e?.hostAppUrl??r.profile.realmServerUrl),o;try{let a=await Ne(n,{profileManager:t});if(a.error)return Nn(`Failed to discover test files: ${a.error}`);o=a.filenames.filter(c=>c.endsWith(".test.gts"))}catch(a){return Nn(`Failed to discover test files: ${a instanceof Error?a.message:String(a)}`)}if(o.length===0)return{status:"failed",passedCount:0,failedCount:0,skippedCount:0,durationMs:0,testFiles:[],failures:[],errorMessage:"No `*.test.gts` files found in the realm. Every implementation Issue must ship with at least one test file."};try{let{qunitResults:a,durationMs:c}=await hy({pm:t,targetRealm:n,hostAppUrl:s,hostDistDir:e?.hostDistDir,debug:e?.debug});return{...yy(a),durationMs:c,testFiles:o}}catch(a){let c=a instanceof Error?a.message:String(a);return{status:"error",passedCount:0,failedCount:0,skippedCount:0,durationMs:0,testFiles:o,failures:[],errorMessage:c}}}async function hy(i){let e=Date.now(),t,r;try{let n=i.hostDistDir??(0,G.join)(vy()??(0,G.join)((0,G.resolve)(xt(__dirname),".."),"host"),"dist");if(!Ap((0,G.join)(n,"tests","index.html")))throw new Error(`Host app dist not found at ${n}. Build the host app (e.g., \`pnpm --filter @cardstack/host build\`) or set TEST_HARNESS_HOST_DIST_PACKAGE_DIR.`);let{url:s,server:o,setHtml:a}=await xy(n);r=o;let c=gy({assetServerUrl:s,hostDistDir:n,realmProxyUrl:i.hostAppUrl});a(c),t=await(await dy()).launch({headless:!0});let p=await t.newPage();i.debug&&(p.on("console",w=>{process.stderr.write(`[browser ${w.type()}] ${w.text()}
|
|
126
|
+
`)}),p.on("pageerror",w=>{process.stderr.write(`[browser pageerror] ${w.message}
|
|
127
|
+
`)}));let u=i.pm.getRealmToken(i.targetRealm);if(u){let w=new URL(i.targetRealm).origin;await p.route(`${w}/**`,M=>{let Z={...M.request().headers(),Authorization:u};M.continue({headers:Z})})}let d=encodeURIComponent(i.targetRealm),f=`${s}?liveTest=true&realmURL=${d}&hidepassed`;return await p.goto(f,{waitUntil:"domcontentloaded"}),await p.waitForFunction(()=>window.__qunitResults?.runEnd!==null,null,{timeout:3e5}),{qunitResults:await p.evaluate(()=>window.__qunitResults),durationMs:Date.now()-e}}finally{t&&await t.close().catch(()=>{}),r&&r.close()}}function gy(i){let e=i.assetServerUrl.replace(/\/$/,""),t=i.realmProxyUrl.replace(/\/$/,""),r=(0,G.resolve)(i.hostDistDir,"tests","index.html"),n;try{n=(0,Et.readFileSync)(r,"utf8")}catch{throw new Error(`Could not read host test page at ${r}. Build the host app with test support.`)}let s=(n.match(/<meta[^>]+>/g)??[]).filter(l=>!l.includes("charset")&&!l.includes("viewport")).map(l=>{if(!l.includes("config/environment"))return l;let p=l.match(/content="([^"]+)"/);if(!p)return l;try{let u=JSON.parse(decodeURIComponent(p[1]));u.resolvedBaseRealmURL&&(u.resolvedBaseRealmURL=`${t}/base/`),u.resolvedSkillsRealmURL&&(u.resolvedSkillsRealmURL=`${t}/skills/`),u.resolvedOpenRouterRealmURL&&(u.resolvedOpenRouterRealmURL=`${t}/openrouter/`),u.realmServerURL&&(u.realmServerURL=`${t}/`);let d=encodeURIComponent(JSON.stringify(u));return l.replace(/content="[^"]+"/,`content="${d}"`)}catch{return l}}),o=(n.match(/<script[^>]*src="[^"]*"[^>]*><\/script>/g)??[]).filter(l=>!l.includes("testem.js")&&!l.includes("ember-cli-live-reload")).map(l=>l.replace(/src="\/([^"]*)"/g,`src="${e}/$1"`)),a=(n.match(/<link[^>]*rel="stylesheet"[^>]*>/g)??[]).map(l=>l.replace(/href="\/([^"]*)"/g,`href="${e}/$1"`)),c=(n.match(/<script type="module">[^]*?<\/script>/g)??[]).map(l=>l.replace(/from '\/([^']*)'/g,`from '${e}/$1'`));return`<!DOCTYPE html>
|
|
128
128
|
<html>
|
|
129
129
|
<head>
|
|
130
130
|
<meta charset="utf-8">
|
|
@@ -167,25 +167,41 @@ ${g}${s} ${n.touched.length} file(s)${n.skipped.length>0?`, skipped ${n.skipped.
|
|
|
167
167
|
})();
|
|
168
168
|
</script>
|
|
169
169
|
|
|
170
|
-
${
|
|
170
|
+
${c.join(`
|
|
171
171
|
`)}
|
|
172
172
|
${o.join(`
|
|
173
173
|
`)}
|
|
174
174
|
</body>
|
|
175
|
-
</html>`}async function
|
|
176
|
-
${h}FAIL${m} ${g}${
|
|
175
|
+
</html>`}async function xy(i){let e={".js":"application/javascript",".css":"text/css",".map":"application/json",".html":"text/html",".wasm":"application/wasm",".svg":"image/svg+xml",".png":"image/png",".woff2":"font/woff2",".woff":"font/woff",".ttf":"font/ttf"},t="",r=n=>{t=n};return new Promise((n,s)=>{let o=(0,Pp.createServer)((a,c)=>{let l=(a.url??"/").split("?")[0];if(l!=="/"){let p=(0,G.normalize)(l.slice(1));if(p.startsWith("..")||p.startsWith("/")){c.writeHead(403),c.end("Forbidden");return}let u=(0,G.resolve)(i,p);if(!u.startsWith((0,G.resolve)(i))){c.writeHead(403),c.end("Forbidden");return}try{let d=(0,Et.readFileSync)(u),f=u.match(/\.[^.]+$/)?.[0]??"",x=e[f]??"application/octet-stream";c.writeHead(200,{"Content-Type":x,"Access-Control-Allow-Origin":"*"}),c.end(d)}catch{c.writeHead(404),c.end("Not found")}return}c.writeHead(200,{"Content-Type":"text/html","Access-Control-Allow-Origin":"*"}),c.end(t)});o.on("error",s),o.listen(0,"127.0.0.1",()=>{let a=o.address();if(!a||typeof a=="string"){s(new Error("Failed to start test page server"));return}n({url:`http://127.0.0.1:${a.port}`,server:o,setHtml:r})})})}function Ap(i){try{return(0,Et.statSync)(i).isFile()}catch{return!1}}function vy(){let i=xt(__dirname),e=(0,G.resolve)(i,".."),t=(0,G.resolve)(e,".."),r=(0,G.join)(e,"host"),n=by(t),s=n&&n!==t?(0,G.resolve)(n,"packages","host"):void 0,o=[process.env.TEST_HARNESS_HOST_DIST_PACKAGE_DIR,r,s].filter(c=>!!c).map(c=>(0,G.resolve)(c)),a=new Set;for(let c of o)if(!a.has(c)&&(a.add(c),Ap((0,G.join)(c,"dist","index.html"))))return c}function by(i){let e=(0,Tp.spawnSync)("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:i,encoding:"utf8",stdio:["ignore","pipe","ignore"]});if(e.status!==0)return;let t=e.stdout.trim();if(t.endsWith(`${(0,G.join)(".git")}`))return(0,G.dirname)(t)}function yy(i){if(!i.runEnd)return{status:"error",passedCount:0,failedCount:0,skippedCount:0,failures:[],errorMessage:"QUnit did not complete \u2014 runEnd event was not received"};let e=0,t=0,r=0,n=[];for(let o of i.tests)if(o.status==="failed"){t+=1;let a=o.errors[0];n.push({testName:o.name,module:o.module||"default",message:a?.message??"Test failed",...a?.stack?{stackTrace:a.stack.slice(0,500)}:{}})}else o.status==="skipped"||o.status==="todo"?r+=1:e+=1;let s;return i.tests.length===0?s="error":t>0||e===0&&r>0?s="failed":s="passed",{status:s,passedCount:e,failedCount:t,skippedCount:r,failures:n}}function Nn(i){return{status:"error",passedCount:0,failedCount:0,skippedCount:0,durationMs:0,testFiles:[],failures:[],errorMessage:i}}function Lp(i){i.command("test").description("Run the realm's QUnit test suite (every `*.test.gts` file) in a headless Chromium driven against the host app. Monorepo-only: relies on the host app's compiled `dist/` being reachable from this CLI's location (or via TEST_HARNESS_HOST_DIST_PACKAGE_DIR).").requiredOption("--realm <realm-url>","The realm URL to test").option("--host-app-url <url>","Host app URL (compat proxy). Defaults to the active profile's realm-server URL.").option("--host-dist-dir <path>","Override the host app dist directory used to build the test page.").option("--debug","Stream browser console output to stderr").option("--json","Output structured JSON result").action(async e=>{let t;try{t=await fy(e.realm,{...e.hostAppUrl?{hostAppUrl:e.hostAppUrl}:{},...e.hostDistDir?{hostDistDir:e.hostDistDir}:{},...e.debug?{debug:!0}:{}})}catch(n){console.error(`${h}Error:${m} ${n instanceof Error?n.message:String(n)}`),process.exit(1)}if(e.json){j.output(JSON.stringify(t,null,2)),t.status!=="passed"&&process.exit(1);return}if(t.errorMessage&&console.error(`${h}Error:${m} ${t.errorMessage}`),t.testFiles.length===0){console.log(`${g}No .test.gts files found in the realm.${m}`),t.status!=="passed"&&process.exit(1);return}if(t.failures.length>0)for(let n of t.failures)console.log(`
|
|
176
|
+
${h}FAIL${m} ${g}${n.module}${m} \u203A ${n.testName}`),console.log(` ${n.message}`),n.stackTrace&&console.log(` ${g}${n.stackTrace.split(`
|
|
177
177
|
`).slice(0,3).join(`
|
|
178
|
-
`)}${m}`);let
|
|
179
|
-
${
|
|
178
|
+
`)}${m}`);let r=t.status==="passed"?R:t.status==="failed"?h:h;console.log(`
|
|
179
|
+
${r}${t.status}${m} ${g}\u2014${m} ${t.passedCount} passed, ${t.failedCount} failed${t.skippedCount>0?`, ${t.skippedCount} skipped`:""} ${g}(${t.durationMs}ms across ${t.testFiles.length} file(s))${m}`),t.status!=="passed"&&process.exit(1)})}function Mp(i){let e=new jp.Command;return e.name("boxel").description("CLI tools for Boxel workspace management").version(i).option("-q, --quiet","Suppress informational progress logs (info/log/debug). Errors and warnings, plus command result payloads (JSON, file contents), are still emitted. Use this when invoking the CLI from automation (e.g. the software factory test harness) to keep stdout focused on the result.").hook("preAction",t=>{(t.optsWithGlobals?.()??t.opts()).quiet&&pi(!0),Kc(process.cwd())}),e.command("profile").description("Manage saved profiles for different users/environments").argument("[subcommand]","list | add | switch | remove | migrate").argument("[arg]","Profile ID (for switch/remove)").option("-u, --user <matrixId>","Matrix user ID (e.g., @user:boxel.ai)").option("-p, --password <password>","Password (for add command)").option("-n, --name <displayName>","Display name (for add command)").option("-m, --matrix-url <url>","Matrix server URL (for add command with non-standard domains)").option("-r, --realm-server-url <url>","Realm server URL (for add command with non-standard domains)").addHelpText("after",`
|
|
180
180
|
Environment variables (for 'add'):
|
|
181
181
|
BOXEL_PASSWORD Password; preferred over -p to avoid shell history.
|
|
182
182
|
BOXEL_ENVIRONMENT An env-mode slug (e.g. a branch name), interpreted
|
|
183
183
|
like scripts/env-slug.sh: URLs are derived as
|
|
184
184
|
http://matrix.<slug>.localhost and
|
|
185
185
|
http://realm-server.<slug>.localhost/. Overridden
|
|
186
|
-
by --matrix-url / --realm-server-url if provided.`).action(async(t,n
|
|
186
|
+
by --matrix-url / --realm-server-url if provided.`).action(async(t,r,n)=>{n?.password&&console.warn('Warning: Supplying a password via -p/--password may expose it in shell history and process listings. For non-interactive usage, prefer the BOXEL_PASSWORD environment variable or use "boxel profile add" interactively.'),await zc(t,r,n)}),Cp(e),pl(e),gl(e),$p(e),Op(e),ul(e),Lp(e),xl(e),Qc(e),e}var wy=JSON.parse((0,Ip.readFileSync)((0,Np.resolve)(__dirname,"../package.json"),"utf-8"));process.argv.includes("--quiet")&&pi(!0);Mp(wy.version).parse();
|
|
187
187
|
/*! Bundled license information:
|
|
188
188
|
|
|
189
189
|
safe-buffer/index.js:
|
|
190
190
|
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
191
|
+
|
|
192
|
+
mime-db/index.js:
|
|
193
|
+
(*!
|
|
194
|
+
* mime-db
|
|
195
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
196
|
+
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
|
197
|
+
* MIT Licensed
|
|
198
|
+
*)
|
|
199
|
+
|
|
200
|
+
mime-types/index.js:
|
|
201
|
+
(*!
|
|
202
|
+
* mime-types
|
|
203
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
204
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
205
|
+
* MIT Licensed
|
|
206
|
+
*)
|
|
191
207
|
*/
|