needle-cloud 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import e from"node-fetch";import{File as t}from"@web-std/file";import n,{createHash as o,randomUUID as i}from"node:crypto";import{Command as a,Option as s}from"commander";import r,{existsSync as c,statSync as l,readFileSync as p,readdirSync as u,appendFileSync as d,mkdirSync as m,writeFileSync as f,lstatSync as h,readFile as g}from"fs";import{execFileSync as v}from"child_process";import x from"open";import b,{resolve as y,join as w,relative as _,sep as k,isAbsolute as S,dirname as j}from"path";import E from"ora";import{existsSync as T,mkdirSync as $,renameSync as O,realpathSync as R,statSync as A,rename as C,appendFileSync as N,openSync as I,readSync as P,closeSync as U,createReadStream as L,readdirSync as z,lstatSync as F,readFileSync as D,rmSync as q,writeFileSync as B,watch as M}from"node:fs";import{writeFile as W}from"node:fs/promises";import G,{homedir as H}from"node:os";import J,{resolve as V,join as K,relative as Y,isAbsolute as Z,win32 as X,posix as Q,sep as ee,extname as te}from"node:path";import ne from"util";import oe,{Readable as ie}from"stream";import ae from"http";import se from"https";import re from"url";import ce,{randomUUID as le}from"crypto";import pe from"net";import ue from"tls";import de from"assert";import me from"tty";import fe,{homedir as he,tmpdir as ge}from"os";import ve,{EventEmitter as xe}from"events";import be from"http2";import ye from"zlib";import{createInterface as we}from"node:readline/promises";import _e from"dotenv";import ke from"@logto/node";import{createInterface as Se}from"node:readline";import{Readable as je}from"node:stream";import{createGzip as Ee}from"node:zlib";import{Router as Te}from"express";import $e,{WebSocketServer as Oe}from"ws";import{execFile as Re,execFileSync as Ae}from"node:child_process";import{minimatch as Ce}from"minimatch";import Ne from"body-parser";const Ie="STRING",Pe="BOOLEAN",Ue="NUMBER",Le="ARRAY";function ze(e){return e.replace(/[-_](\w)/g,(e,t)=>t.toUpperCase())}function Fe(e){const t=e.match(/--[\w-]+/g);return t?t[t.length-1]:e.split(/[\s,]+/)[0]}function De(e){return ze(Fe(e).replace(/^--/,""))}function qe(e){return ze(e.replace(/[[\]<>]/g,"").replace(/\.\.\.$/,"").trim())}function Be(e,t){if(null==e)return e;switch(t){case Pe:{if("boolean"==typeof e)return e;const t=String(e).toLowerCase();return""===t||!["false","0","no","off"].includes(t)&&(!!["true","1","yes","on"].includes(t)||Boolean(e))}case Ue:{const t=Number(e);return Number.isNaN(t)?e:t}case Le:return Array.isArray(e)?e:String(e).split(",");case Ie:return Array.isArray(e)?e:String(e);default:return e}}const Me={error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),info:(...e)=>console.log(...e),debug:(...e)=>console.debug(...e),log:(...e)=>console.log(...e)};class We{constructor(e,t){this.name=e,this.description=null!=t?t:"",this.visible=!0,this.strictOptions=!0,this._aliases=[],this._helpTexts=[],this._action=void 0,this.options=[],this.args=[]}alias(e){return this._aliases.push(e),this}getAliases(){return[...this._aliases]}configure(e={}){return void 0!==e.visible&&(this.visible=!1!==e.visible),void 0!==e.strictOptions&&(this.strictOptions=!1!==e.strictOptions),this}hide(){return this.visible=!1,this}help(e){return e&&this._helpTexts.push(e),this}option(e,t,n={}){return this.options.push({synopsis:e,description:null!=t?t:"",name:De(e),validator:n.validator,default:n.default,required:!0===n.required,hidden:!0===n.hidden}),this}argument(e,t,n={}){return this.args.push({synopsis:e,description:null!=t?t:"",name:qe(e),validator:n.validator,default:n.default}),this}action(e){return this._action=e,this}isHelpCommand(){return!1}}class Ge{constructor(){this.STRING=Ie,this.BOOLEAN=Pe,this.NUMBER=Ue,this.ARRAY=Le,this._version=void 0,this._description=void 0,this._name="needle-cloud",this._commands=[],this._exitOverride=!1,this._testHooks=null}version(e){return this._version=e,this}description(e){return this._description=e,this}name(e){return this._name=e,this}command(e,t){const n=new We(e,t);return this._commands.push(n),n}getCommands(){return[...this._commands]}exitOverride(){return this._exitOverride=!0,this}async run(e){const t=this._build();try{return await t.parseAsync(null!=e?e:process.argv.slice(2),{from:"user"})}catch(t){var n,o,i;if(this._exitOverride)throw t;const a=null!=(n=null==(o=this._testHooks)?void 0:o.error)?n:e=>console.error(e);return a(`error: ${t instanceof Error&&t.message||String(t)}`),(null!=e?e:process.argv).includes("--verbose")&&t instanceof Error&&t.stack&&a(t.stack),null!=(i=this._testHooks)&&i.exit?this._testHooks.exit(1):process.exit(1)}}_build(){const e=new a(this._name);this._version&&e.version(this._version),this._description&&e.description(this._description),this._exitOverride&&e.exitOverride();const t=new Map,n=o=>{if(1===o.length)return e;const i=o.slice(0,-1).join(" ");let s=t.get(i);return s||(s=new a(o[o.length-2]),this._exitOverride&&s.exitOverride(),t.set(i,s),n(o.slice(0,-1)).addCommand(s)),s};for(const e of this._commands){const o=e.name.split(/\s+/),i=t.get(e.name),r=null!=i?i:new a(o[o.length-1]);t.set(e.name,r),r.description(e.description);for(const t of e._aliases)r.alias(t);for(const t of e._helpTexts)r.addHelpText("after","\n"+t);this._exitOverride&&r.exitOverride(),e.strictOptions||(r.allowUnknownOption(!0),r.allowExcessArguments(!0));for(const t of e.args)r.argument(t.synopsis,t.description);for(const t of e.options){let e=t.synopsis;t.validator&&!Fe(e).startsWith("--no-")&&(e=/[<[]/.test(e)?e.replace(/<([\w-]+)>/,"[$1]"):`${e} [value]`);const n=new s(e,t.description);t.hidden&&n.hideHelp(),t.required&&n.makeOptionMandatory(),r.addOption(n)}e._action&&r.action(async(...t)=>{var n;const o=null!=(n=t[e.args.length])?n:{},i={};e.args.forEach((e,n)=>{const o=t[n];i[e.name]=Be(void 0===o?e.default:o,e.validator)});const a={};for(const t of e.options){if(Fe(t.synopsis).startsWith("--no-")){const e=ze(Fe(t.synopsis).replace(/^--no-/,""));a[t.name]=!1===o[e];continue}const e=o[t.name];a[t.name]=Be(void 0===e?t.default:e,t.validator)}for(const[e,t]of Object.entries(o))e in a||(a[e]=t);await e._action({args:i,options:a,logger:Me,command:r})}),i||n(o).addCommand(r,{hidden:!e.visible})}return e}}function He(){return new Ge}var Je={program:He(),createProgram:He,STRING:Ie,BOOLEAN:Pe,NUMBER:Ue,ARRAY:Le};const Ve={status:"/v1/status",version:"/v1/version",api:"/v1/api",usage:{get:"/v1/usage"},affiliate:{get:"/v1/affiliate/get",link_clicked:"/v1/affiliate/link_clicked"},account:{public_key:"/v1/account/public_key",post_machine:"/v1/account/machine",connect:"/v1/account/connect",get_licenses:"/v1/account/get/licenses",set_license_active:"/v1/account/set_license_active",set_licenses_active:"/v1/account/set_licenses_active",buy_licenses:"/v1/account/buy_licenses",update_licenses:"/v1/account/update_licenses",preview_invitation:"/v1/account/preview_invitation",update_payment_method:"/v1/account/update_payment_method",get_billing:"/v1/account/get_billing",generate_invoice:"/v1/account/generate_invoice",resume_subscription:"/v1/account/resume_subscription",cancel_subscription:"/v1/account/cancel_subscription",start_billingportal_session:"/v1/account/start_billingportal_session",post_preferences:"/v1/account/preferences",get_preferences:"/v1/account/preferences"},payment:{info:"/v1/payment/info",create:"/v1/payment/create"},ai:{llmstxt:"/v1/ai/llmstxt",chat:"/v1/ai/chat",chat_personal:"/v1/ai/chat/personal",list_chats:"/v1/ai/chat/list",chat_image:"/v1/ai/chat/image",chat_tool_result:"/v1/ai/chat/tool-result",chat_stop:"/v1/ai/chat/stop",chat_file_edits:"/v1/ai/file-edits",chat_file_edit_undo:"/v1/ai/file-edits/undo",chat_enqueue:"/v1/ai/chat/enqueue",chat_enqueue_cancel:"/v1/ai/chat/enqueue/cancel",ask:"/v1/ai/ask",completions:"/v1/ai/completions",evaluate:"/v1/ai/evaluate",post_settings:"/v1/ai/chat/settings",ws:"/v1/ws",cli_ws:"/v1/cli/ws"},organizations:{get:"/v1/organizations/get",orgs_details:"/v1/organizations/details",licenses:"/v1/organizations/licenses",get_invitations:"/v1/organizations/get_invitations"},events:{get:"/v1/events/get",post:"/v1/events/post",list:"/v1/events/list"},reports:{get:"/v1/reports/get",post:"/v1/reports/post"},diagnostics:{download_failed:"/v1/diagnostics/download-failed"},questionnaire:{get:"/v1/questionnaires/get",post:"/v1/questionnaires/post"},roadmap:{get:"/v1/roadmap/get",post_vote:"/v1/roadmap/post"},tokens:{create:"/v1/tokens/create",delete:"/v1/tokens/delete",list:"/v1/tokens/list"},get:{stats:"/v1/get/stats",jobs:"/v1/list/jobs",deployments:"/v1/list/deployments",discounts:"/v1/get/discounts"},files:{entry:"/v1/files/:identifier/:version/",file:"/v1/files/:identifier/:version/*"},view:{get_analytics:"/v1/view/analytics",get_public_info:"/v1/view/public/info",post_version:"/v1/view/post_version"},content:{root:"/v1/content",download:"/v1/content/download",detail:"/v1/content/:identifier",update:"/v1/content/:identifier",delete:"/v1/content/:identifier",restore:"/v1/content/:identifier/restore",visits:"/v1/content/:identifier/visits",domains:"/v1/content/:identifier/domains",domain_item:"/v1/content/:identifier/domains/:hostname",domain_verify:"/v1/content/:identifier/domains/:hostname/verify"},analytics:{content_list:"/v1/analytics/content-list"},public:{content_list:"/v1/public/content",content_detail:"/v1/public/content/:identifier"},collections:{list:"/v1/collections/list",get:"/v1/collections/get",create:"/v1/collections/create",update:"/v1/collections/update",delete:"/v1/collections/delete",add_item:"/v1/collections/add-item",remove_item:"/v1/collections/remove-item",reorder_items:"/v1/collections/reorder-items"},projects:{create:"/v1/projects/create",list:"/v1/projects/list",head:"/v1/projects/head",push:"/v1/projects/push",pull:"/v1/projects/pull",delete:"/v1/projects/delete",restore:"/v1/projects/restore",archive:"/v1/projects/archive",unarchive:"/v1/projects/unarchive",clone:"/v1/projects/clone",update:"/v1/projects/update",blobs_check:"/v1/projects/blobs/check",blobs_upload:"/v1/projects/blobs/upload",blobs_complete:"/v1/projects/blobs/complete",blobs_download:"/v1/projects/blobs/download",revisions:"/v1/projects/revisions",revisions_update:"/v1/projects/revisions/update",deployments:"/v1/projects/deployments",promote:"/v1/projects/promote",promotions:"/v1/projects/promotions"},upload:{request:"/v1/upload/request",request_put_url:"/v1/upload/put",update_results:"/v1/upload/results",done:"/v1/upload/done",cancel:"/v1/upload/cancel",multipart_create:"/v1/upload/multipart/create",multipart_part_urls:"/v1/upload/multipart/part-urls",multipart_complete:"/v1/upload/multipart/complete",multipart_abort:"/v1/upload/multipart/abort"},jobs:{create:"/v1/jobs/create",get_id:"/v1/jobs/get_id",request_start:"/v1/jobs/request_start",presigned_url:"/v1/jobs/presigned-url",presigned_urls:"/v1/jobs/presigned-urls",download_urls:"/v1/jobs/download-urls",request_restart:"/v1/jobs/restart",delete:"/v1/jobs/delete",post_update:"/v1/jobs/update",post_results_stats:"/v1/jobs/results_stats",post_usage:"/v1/jobs/post_usage",get_status:"/v1/jobs/status",get_org:"/v1/jobs/org",query:"/v1/jobs/query",request_job_that_needs_stats:"/v1/jobs/job_needs_stats"},worker:{ping:"/v1/worker/ping",get_available_count:"/v1/worker/get_available_count",post_available_info:"/v1/worker/post_available_info",get_available_info:"/v1/worker/get_available_info"},local_projects:{get:{user:"/v1/local_projects/user",by_id:"/v1/local_projects/"},post:"/v1/local_projects"}};function Ke(e){const t={authorization:"Bearer "+e.authToken};return e.org&&(t["x-needle-cloud-org"]=e.org),e.roles&&(t.roles=e.roles.join(",")),e.roles_org&&(t.roles_org=e.roles_org.join(",")),t}const Ye={credentials:"omit"};function Ze(e,t){return function(){return e.apply(t,arguments)}}const{toString:Xe}=Object.prototype,{getPrototypeOf:Qe}=Object,{iterator:et,toStringTag:tt}=Symbol,nt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ot=(e,t)=>{let n=e;const o=[];for(;null!=n&&n!==Object.prototype;){if(-1!==o.indexOf(n))return!1;if(o.push(n),nt(n,t))return!0;n=Qe(n)}return!1},it=(at=Object.create(null),e=>{const t=Xe.call(e);return at[t]||(at[t]=t.slice(8,-1).toLowerCase())});var at;const st=e=>(e=e.toLowerCase(),t=>it(t)===e),rt=e=>t=>typeof t===e,{isArray:ct}=Array,lt=rt("undefined");function pt(e){return null!==e&&!lt(e)&&null!==e.constructor&&!lt(e.constructor)&&mt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ut=st("ArrayBuffer"),dt=rt("string"),mt=rt("function"),ft=rt("number"),ht=e=>null!==e&&"object"==typeof e,gt=e=>{if(!ht(e))return!1;const t=Qe(e);return!(null!==t&&t!==Object.prototype&&null!==Qe(t)||ot(e,tt)||ot(e,et))},vt=st("Date"),xt=st("File"),bt=st("Blob"),yt=st("FileList"),wt=st("Set"),_t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},kt=void 0!==_t.FormData?_t.FormData:void 0,St=st("URLSearchParams"),[jt,Et,Tt,$t]=["ReadableStream","Request","Response","Headers"].map(st);function Ot(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let o,i;if("object"!=typeof e&&(e=[e]),ct(e))for(o=0,i=e.length;o<i;o++)t.call(null,e[o],o,e);else{if(pt(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let s;for(o=0;o<a;o++)s=i[o],t.call(null,e[s],s,e)}}function Rt(e,t){if(pt(e))return null;t=t.toLowerCase();const n=Object.keys(e);let o,i=n.length;for(;i-- >0;)if(o=n[i],t===o.toLowerCase())return o;return null}const At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ct=e=>!lt(e)&&e!==At,Nt=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Qe(Uint8Array)),It=st("HTMLFormElement"),{propertyIsEnumerable:Pt}=Object.prototype,Ut=st("RegExp"),Lt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),o={};Ot(n,(n,i)=>{let a;!1!==(a=t(n,i,e))&&(o[i]=a||n)}),Object.defineProperties(e,o)},zt=st("AsyncFunction"),Ft=(Dt="function"==typeof setImmediate,qt=mt(At.postMessage),Dt?setImmediate:qt?(Bt=`axios@${Math.random()}`,Mt=[],At.addEventListener("message",({source:e,data:t})=>{e===At&&t===Bt&&Mt.length&&Mt.shift()()},!1),e=>{Mt.push(e),At.postMessage(Bt,"*")}):e=>setTimeout(e));var Dt,qt,Bt,Mt;const Wt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(At):"undefined"!=typeof process&&process.nextTick||Ft,Gt=e=>null!=e&&mt(e[et]);var Ht={isArray:ct,isArrayBuffer:ut,isBuffer:pt,isFormData:e=>{if(!e)return!1;if(kt&&e instanceof kt)return!0;const t=Qe(e);if(!t||t===Object.prototype)return!1;if(!mt(e.append))return!1;const n=it(e);return"formdata"===n||"object"===n&&mt(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ut(e.buffer),t},isString:dt,isNumber:ft,isBoolean:e=>!0===e||!1===e,isObject:ht,isPlainObject:gt,isEmptyObject:e=>{if(!ht(e)||pt(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:jt,isRequest:Et,isResponse:Tt,isHeaders:$t,isUndefined:lt,isDate:vt,isFile:xt,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:bt,isRegExp:Ut,isFunction:mt,isStream:e=>ht(e)&&mt(e.pipe),isURLSearchParams:St,isTypedArray:Nt,isFileList:yt,forEach:Ot,merge:function e(...t){const{caseless:n,skipUndefined:o}=Ct(this)&&this||{},i={},a=(t,a)=>{if("__proto__"===a||"constructor"===a||"prototype"===a)return;const s=n&&"string"==typeof a&&Rt(i,a)||a,r=nt(i,s)?i[s]:void 0;gt(r)&&gt(t)?i[s]=e(r,t):gt(t)?i[s]=e({},t):ct(t)?i[s]=t.slice():o&&lt(t)||(i[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||pt(n))continue;if(Ot(n,a),"object"!=typeof n||ct(n))continue;const o=Object.getOwnPropertySymbols(n);for(let e=0;e<o.length;e++){const t=o[e];Pt.call(n,t)&&a(n[t],t)}}return i},extend:(e,t,n,{allOwnKeys:o}={})=>(Ot(t,(t,o)=>{n&&mt(t)?Object.defineProperty(e,o,{__proto__:null,value:Ze(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,o)=>{e.prototype=Object.create(t.prototype,o),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,o)=>{let i,a,s;const r={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)s=i[a],o&&!o(s,e,t)||r[s]||(t[s]=e[s],r[s]=!0);e=!1!==n&&Qe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:it,kindOfTest:st,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length);const o=e.indexOf(t,n-=t.length);return-1!==o&&o===n},toArray:e=>{if(!e)return null;if(ct(e))return e;let t=e.length;if(!ft(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[et]).call(e);let o;for(;(o=n.next())&&!o.done;){const n=o.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const o=[];for(;null!==(n=e.exec(t));)o.push(n);return o},isHTMLForm:It,hasOwnProperty:nt,hasOwnProp:nt,hasOwnInPrototypeChain:ot,getSafeProp:(e,t)=>null!=e&&ot(e,t)?e[t]:void 0,reduceDescriptors:Lt,freezeMethods:e=>{Lt(e,(t,n)=>{if(mt(e)&&["arguments","caller","callee"].includes(n))return!1;mt(e[n])&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},o=e=>{e.forEach(e=>{n[e]=!0})};return ct(e)?o(e):o(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Rt,global:At,isContextDefined:Ct,isSpecCompliantForm:function(e){return!!(e&&mt(e.append)&&"FormData"===e[tt]&&e[et])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(ht(e)){if(t.has(e))return;if(pt(e))return e;if(!("toJSON"in e)){let o;if(t.add(e),wt(e)){o=[];for(const t of e){const e=n(t);!lt(e)&&o.push(e)}}else o=ct(e)?[]:{},Ot(e,(e,t)=>{const i=n(e);!lt(i)&&(o[t]=i)});return t.delete(e),o}}return e};return n(e)},isAsyncFn:zt,isThenable:e=>e&&(ht(e)||mt(e))&&mt(e.then)&&mt(e.catch),setImmediate:Ft,asap:Wt,isIterable:Gt,isSafeIterable:e=>null!=e&&ot(e,et)&&Gt(e)};const Jt=Ht.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Vt=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Kt=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Yt(e,t){return Ht.isArray(e)?e.map(e=>Yt(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function Zt(e){const t=Object.create(null);return Ht.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>Yt(e,Kt))(e)}),t}const Xt=Symbol("internals");function Qt(e){return e&&String(e).trim().toLowerCase()}function en(e){return!1===e||null==e?e:Ht.isArray(e)?e.map(en):(e=>Yt(e,Vt))(String(e))}const tn=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function nn(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}function on(e,t,n,o,i){return Ht.isFunction(o)?o.call(this,t,n):(i&&(t=n),Ht.isString(t)?Ht.isString(o)?-1!==t.indexOf(o):Ht.isRegExp(o)?o.test(t):void 0:void 0)}class an{constructor(e){e&&this.set(e)}set(e,t,n){const o=this;function i(e,t,n){const i=Qt(t);if(!i)return;const a=Ht.findKey(o,i);(!a||void 0===o[a]||!0===n||void 0===n&&!1!==o[a])&&(o[a||t]=en(e))}const a=(e,t)=>Ht.forEach(e,(e,n)=>i(e,n,t));if(Ht.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(Ht.isString(e)&&(e=e.trim())&&!(e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))(e))a((e=>{const t={};let n,o,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),o=e.substring(i+1).trim();const a=Ht.hasOwnProp(t,n);!n||a&&Ht.hasOwnProp(Jt,n)||("set-cookie"===n?a?t[n].push(o):t[n]=[o]:t[n]=a?t[n]+", "+o:o)}),t})(e),t);else if(Ht.isObject(e)&&Ht.isSafeIterable(e)){let n,o,i=Object.create(null);for(const t of e){if(!Ht.isArray(t))throw new TypeError("Object iterator must return a key-value pair");o=t[0],Ht.hasOwnProp(i,o)?(n=i[o],i[o]=Ht.isArray(n)?[...n,t[1]]:[n,t[1]]):i[o]=t[1]}a(i,t)}else null!=e&&i(t,e,n);return this}get(e,t){if(e=Qt(e)){const n=Ht.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let o;for(;o=n.exec(e);)t[o[1]]=o[2];return t}(e);if(Ht.isFunction(t))return t.call(this,e,n);if(Ht.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Qt(e)){const n=Ht.findKey(this,e);return!(!n||void 0===this[n]||t&&!on(0,this[n],n,t))}return!1}delete(e,t){const n=this;let o=!1;function i(e){if(e=Qt(e)){const i=Ht.findKey(n,e);!i||t&&!on(0,n[i],i,t)||(delete n[i],o=!0)}}return Ht.isArray(e)?e.forEach(i):i(e),o}clear(e){const t=Object.keys(this);let n=t.length,o=!1;for(;n--;){const i=t[n];e&&!on(0,this[i],i,e,!0)||(delete this[i],o=!0)}return o}normalize(e){const t=this,n={};return Ht.forEach(this,(o,i)=>{const a=Ht.findKey(n,i);if(a)return t[a]=en(o),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(i):String(i).trim();s!==i&&delete t[i],t[s]=en(o),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ht.forEach(this,(n,o)=>{null!=n&&!1!==n&&(t[o]=e&&Ht.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){const e=this.get("set-cookie");return Ht.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let o=0,i=!1,a=!1;function s(e){const i=nn(n.slice(o,e)),a=i.indexOf("=");if(a<1)return;const s=nn(i.slice(0,a));if(!tn.test(s))return;const r=s.toLowerCase();if("__proto__"===r||"constructor"===r||"prototype"===r)return;const c=nn(i.slice(a+1));t[r]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let o=1;o<t;o++){const i=e.charCodeAt(o);if(34===i)return e;if(92===i&&(o+=1,o>=t))return e;n+=e[o]}return n}(c)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);i?a?a=!1:92===t?a=!0:34===t&&(i=!1):34===t?i=!0:44!==t&&59!==t||(s(e),o=e+1)}return s(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Xt]=this[Xt]={accessors:{}}).accessors,n=this.prototype;function o(e){const o=Qt(e);t[o]||(function(e,t){const n=Ht.toCamelCase(" "+t);["get","set","has"].forEach(o=>{Object.defineProperty(e,o+n,{__proto__:null,value:function(e,n,i){return this[o].call(this,t,e,n,i)},configurable:!0})})}(n,e),t[o]=!0)}return Ht.isArray(e)?e.forEach(o):o(e),this}}an.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ht.reduceDescriptors(an.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Ht.freezeMethods(an);var sn=an;const rn="[REDACTED ****]";class cn extends Error{static from(e,t,n,o,i,a){let s=e.message;!s&&Ht.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map(e=>{try{return function(e){try{return String(e)}catch(e){return""}}(e&&e.message?e.message:e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const r=new cn(s,t||e.code,n,o,i);return Object.defineProperty(r,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),r.name=e.name,null!=e.status&&null==r.status&&(r.status=e.status),a&&Object.assign(r,a),r}constructor(e,t,n,o,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),o&&(this.request=o),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,t=e&&Ht.hasOwnProp(e,"redact")?e.redact:void 0,n=Ht.isArray(t)&&t.length>0?function(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),o=[],i=e=>{if(null===e||"object"!=typeof e)return e;if(Ht.isBuffer(e))return e;if(-1!==o.indexOf(e))return;let t;if(e instanceof sn&&(e=e.toJSON()),o.push(e),Ht.isArray(e))t=[],e.forEach((e,n)=>{const o=i(e);Ht.isUndefined(o)||(t[n]=o)});else{if(!Ht.isPlainObject(e)&&function(e){if(Ht.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(Ht.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return o.pop(),e;t=Object.create(null);for(const[o,a]of Object.entries(e)){const e=n.has(o.toLowerCase())?rn:i(a);Ht.isUndefined(e)||(t[o]=e)}}return o.pop(),t};return i(e)}(e,t):Ht.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}cn.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",cn.ERR_BAD_OPTION="ERR_BAD_OPTION",cn.ECONNABORTED="ECONNABORTED",cn.ETIMEDOUT="ETIMEDOUT",cn.ECONNREFUSED="ECONNREFUSED",cn.ERR_NETWORK="ERR_NETWORK",cn.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",cn.ERR_DEPRECATED="ERR_DEPRECATED",cn.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",cn.ERR_BAD_REQUEST="ERR_BAD_REQUEST",cn.ERR_CANCELED="ERR_CANCELED",cn.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",cn.ERR_INVALID_URL="ERR_INVALID_URL",cn.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var ln=cn,pn=oe.Stream,un=dn;function dn(){this.source=null,this.dataSize=0,this.maxDataSize=1048576,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}ne.inherits(dn,pn),dn.create=function(e,t){var n=new this;for(var o in t=t||{})n[o]=t[o];n.source=e;var i=e.emit;return e.emit=function(){return n._handleEmit(arguments),i.apply(e,arguments)},e.on("error",function(){}),n.pauseStream&&e.pause(),n},Object.defineProperty(dn.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}}),dn.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)},dn.prototype.resume=function(){this._released||this.release(),this.source.resume()},dn.prototype.pause=function(){this.source.pause()},dn.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]},dn.prototype.pipe=function(){var e=pn.prototype.pipe.apply(this,arguments);return this.resume(),e},dn.prototype._handleEmit=function(e){this._released?this.emit.apply(this,e):("data"===e[0]&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e))},dn.prototype._checkIfMaxDataSizeExceeded=function(){this._maxDataSizeExceeded||this.dataSize<=this.maxDataSize||(this._maxDataSizeExceeded=!0,this.emit("error",new Error("DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.")))};var mn=oe.Stream,fn=hn;function hn(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2097152,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}ne.inherits(hn,mn),hn.create=function(e){var t=new this;for(var n in e=e||{})t[n]=e[n];return t},hn.isStreamLike=function(e){return"function"!=typeof e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e&&!Buffer.isBuffer(e)},hn.prototype.append=function(e){if(hn.isStreamLike(e)){if(!(e instanceof un)){var t=un.create(e,{maxDataSize:Infinity,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=t}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this},hn.prototype.pipe=function(e,t){return mn.prototype.pipe.call(this,e,t),this.resume(),e},hn.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop)this._pendingNext=!0;else{this._insideLoop=!0;try{do{this._pendingNext=!1,this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=!1}}},hn.prototype._realGetNext=function(){var e=this._streams.shift();void 0!==e?"function"==typeof e?e(function(e){hn.isStreamLike(e)&&(e.on("data",this._checkDataSize.bind(this)),this._handleErrors(e)),this._pipeNext(e)}.bind(this)):this._pipeNext(e):this.end()},hn.prototype._pipeNext=function(e){if(this._currentStream=e,hn.isStreamLike(e))return e.on("end",this._getNext.bind(this)),void e.pipe(this,{end:!1});this.write(e),this._getNext()},hn.prototype._handleErrors=function(e){var t=this;e.on("error",function(e){t._emitError(e)})},hn.prototype.write=function(e){this.emit("data",e)},hn.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.pause&&this._currentStream.pause(),this.emit("pause"))},hn.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.resume&&this._currentStream.resume(),this.emit("resume")},hn.prototype.end=function(){this._reset(),this.emit("end")},hn.prototype.destroy=function(){this._reset(),this.emit("close")},hn.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null},hn.prototype._checkDataSize=function(){this._updateDataSize(),this.dataSize<=this.maxDataSize||this._emitError(new Error("DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded."))},hn.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach(function(t){t.dataSize&&(e.dataSize+=t.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)},hn.prototype._emitError=function(e){this._reset(),this.emit("error",e)};var gn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function vn(e){var t={exports:{}};return e(t,t.exports),t.exports}var xn={"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}},bn=vn(function(e,t){var n,o,i,a=b.extname,s=/^\s*([^;\s]*)(?:;|\s|$)/,r=/^text\//i;function c(e){if(!e||"string"!=typeof e)return!1;var t=s.exec(e),n=t&&xn[t[1].toLowerCase()];return n&&n.charset?n.charset:!(!t||!r.test(t[1]))&&"UTF-8"}t.charset=c,t.charsets={lookup:c},t.contentType=function(e){if(!e||"string"!=typeof e)return!1;var n=-1===e.indexOf("/")?t.lookup(e):e;if(!n)return!1;if(-1===n.indexOf("charset")){var o=t.charset(n);o&&(n+="; charset="+o.toLowerCase())}return n},t.extension=function(e){if(!e||"string"!=typeof e)return!1;var n=s.exec(e),o=n&&t.extensions[n[1].toLowerCase()];return!(!o||!o.length)&&o[0]},t.extensions=Object.create(null),t.lookup=function(e){if(!e||"string"!=typeof e)return!1;var n=a("x."+e).toLowerCase().substr(1);return n&&t.types[n]||!1},t.types=Object.create(null),n=t.extensions,o=t.types,i=["nginx","apache",void 0,"iana"],Object.keys(xn).forEach(function(e){var t=xn[e],a=t.extensions;if(a&&a.length){n[e]=a;for(var s=0;s<a.length;s++){var r=a[s];if(o[r]){var c=i.indexOf(xn[o[r]].source),l=i.indexOf(t.source);if("application/octet-stream"!==o[r]&&(c>l||c===l&&"application/"===o[r].substr(0,12)))continue}o[r]=e}}})}),yn=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)},wn=function(e){var t=!1;return yn(function(){t=!0}),function(n,o){t?e(n,o):yn(function(){e(n,o)})}},_n=function(e){Object.keys(e.jobs).forEach(kn.bind(e)),e.jobs={}};function kn(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}var Sn=function(e,t,n,o){var i=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[i]=function(e,t,n,o){return 2==e.length?e(n,wn(o)):e(n,t,wn(o))}(t,i,e[i],function(e,t){i in n.jobs&&(delete n.jobs[i],e?_n(n):n.results[i]=t,o(e,n.results))})},jn=function(e,t){var n=!Array.isArray(e),o={index:0,keyedList:n||t?Object.keys(e):null,jobs:{},results:n?{}:[],size:n?Object.keys(e).length:e.length};return t&&o.keyedList.sort(n?t:function(n,o){return t(e[n],e[o])}),o},En=function(e){Object.keys(this.jobs).length&&(this.index=this.size,_n(this),wn(e)(null,this.results))},Tn=function(e,t,n,o){var i=jn(e,n);return Sn(e,t,i,function n(a,s){a?o(a,s):(i.index++,i.index<(i.keyedList||e).length?Sn(e,t,i,n):o(null,i.results))}),En.bind(i,o)};function $n(e,t){return e<t?-1:e>t?1:0}Tn.ascending=$n,Tn.descending=function(e,t){return-1*$n(e,t)};var On=Object,Rn=Error,An=EvalError,Cn=RangeError,Nn=ReferenceError,In=SyntaxError,Pn=TypeError,Un=URIError,Ln=Math.abs,zn=Math.floor,Fn=Math.max,Dn=Math.min,qn=Math.pow,Bn=Math.round,Mn=Number.isNaN||function(e){return e!=e},Wn=Object.getOwnPropertyDescriptor;if(Wn)try{Wn([],"length")}catch(e){Wn=null}var Gn=Wn,Hn=Object.defineProperty||!1;if(Hn)try{Hn({},"a",{value:1})}catch(e){Hn=!1}var Jn,Vn=Hn,Kn=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(var o in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var a=Object.getOwnPropertyDescriptor(e,t);if(42!==a.value||!0!==a.enumerable)return!1}return!0},Yn="undefined"!=typeof Symbol&&Symbol,Zn="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null,Xn=On,Qn=Xn.getPrototypeOf||null,eo=Object.prototype.toString,to=Math.max,no=function(e,t){for(var n=[],o=0;o<e.length;o+=1)n[o]=e[o];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},oo=Function.prototype.bind||function(e){var t=this;if("function"!=typeof t||"[object Function]"!==eo.apply(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var n,o=function(e,t){for(var n=[],o=1,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n}(arguments),i=to(0,t.length-o.length),a=[],s=0;s<i;s++)a[s]="$"+s;if(n=Function("binder","return function ("+function(e,t){for(var n="",o=0;o<e.length;o+=1)n+=e[o],o+1<e.length&&(n+=",");return n}(a)+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof n){var i=t.apply(this,no(o,arguments));return Object(i)===i?i:this}return t.apply(e,no(o,arguments))}),t.prototype){var r=function(){};r.prototype=t.prototype,n.prototype=new r,r.prototype=null}return n},io=Function.prototype.call,ao=Function.prototype.apply,so="undefined"!=typeof Reflect&&Reflect&&Reflect.apply||oo.call(io,ao),ro=Pn,co=Gn;try{Jn=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var lo,po=!!Jn&&co&&co(Object.prototype,"__proto__"),uo=Object,mo=uo.getPrototypeOf,fo=po&&"function"==typeof po.get?function(e){if(e.length<1||"function"!=typeof e[0])throw new ro("a function is required");return so(oo,io,e)}([po.get]):"function"==typeof mo&&function(e){return mo(null==e?e:uo(e))},ho=Zn?function(e){return Zn(e)}:Qn?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return Qn(e)}:fo?function(e){return fo(e)}:null,go=oo.call(Function.prototype.call,Object.prototype.hasOwnProperty),vo=Rn,xo=An,bo=Cn,yo=Nn,wo=In,_o=Un,ko=Ln,So=zn,jo=Fn,Eo=Dn,To=qn,$o=Bn,Oo=Vn,Ro=go,Ao=Function,Co=function(e){try{return Ao('"use strict"; return ('+e+").constructor;")()}catch(e){}},No=function(){throw new ro},Io=co?function(){try{return No}catch(e){try{return co(arguments,"callee").get}catch(e){return No}}}():No,Po="function"==typeof Yn&&"function"==typeof Symbol&&"symbol"==typeof Yn("foo")&&"symbol"==typeof Symbol("bar")&&Kn(),Uo={},Lo="undefined"!=typeof Uint8Array&&ho?ho(Uint8Array):lo,zo={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?lo:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?lo:ArrayBuffer,"%ArrayIteratorPrototype%":Po&&ho?ho([][Symbol.iterator]()):lo,"%AsyncFromSyncIteratorPrototype%":lo,"%AsyncFunction%":Uo,"%AsyncGenerator%":Uo,"%AsyncGeneratorFunction%":Uo,"%AsyncIteratorPrototype%":Uo,"%Atomics%":"undefined"==typeof Atomics?lo:Atomics,"%BigInt%":"undefined"==typeof BigInt?lo:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?lo:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?lo:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?lo:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":vo,"%eval%":eval,"%EvalError%":xo,"%Float16Array%":"undefined"==typeof Float16Array?lo:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?lo:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?lo:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?lo:FinalizationRegistry,"%Function%":Ao,"%GeneratorFunction%":Uo,"%Int8Array%":"undefined"==typeof Int8Array?lo:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?lo:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?lo:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Po&&ho?ho(ho([][Symbol.iterator]())):lo,"%JSON%":"object"==typeof JSON?JSON:lo,"%Map%":"undefined"==typeof Map?lo:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&Po&&ho?ho((new Map)[Symbol.iterator]()):lo,"%Math%":Math,"%Number%":Number,"%Object%":Xn,"%Object.getOwnPropertyDescriptor%":co,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?lo:Promise,"%Proxy%":"undefined"==typeof Proxy?lo:Proxy,"%RangeError%":bo,"%ReferenceError%":yo,"%Reflect%":"undefined"==typeof Reflect?lo:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?lo:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&Po&&ho?ho((new Set)[Symbol.iterator]()):lo,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?lo:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Po&&ho?ho(""[Symbol.iterator]()):lo,"%Symbol%":Po?Symbol:lo,"%SyntaxError%":wo,"%ThrowTypeError%":Io,"%TypedArray%":Lo,"%TypeError%":ro,"%Uint8Array%":"undefined"==typeof Uint8Array?lo:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?lo:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?lo:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?lo:Uint32Array,"%URIError%":_o,"%WeakMap%":"undefined"==typeof WeakMap?lo:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?lo:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?lo:WeakSet,"%Function.prototype.call%":io,"%Function.prototype.apply%":ao,"%Object.defineProperty%":Oo,"%Object.getPrototypeOf%":Qn,"%Math.abs%":ko,"%Math.floor%":So,"%Math.max%":jo,"%Math.min%":Eo,"%Math.pow%":To,"%Math.round%":$o,"%Math.sign%":function(e){return Mn(e)||0===e?e:e<0?-1:1},"%Reflect.getPrototypeOf%":Zn};if(ho)try{null.error}catch(e){var Fo=ho(ho(e));zo["%Error.prototype%"]=Fo}var Do=function e(t){var n;if("%AsyncFunction%"===t)n=Co("async function () {}");else if("%GeneratorFunction%"===t)n=Co("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=Co("async function* () {}");else if("%AsyncGenerator%"===t){var o=e("%AsyncGeneratorFunction%");o&&(n=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&ho&&(n=ho(i.prototype))}return zo[t]=n,n},qo={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Bo=oo.call(io,Array.prototype.concat),Mo=oo.call(ao,Array.prototype.splice),Wo=oo.call(io,String.prototype.replace),Go=oo.call(io,String.prototype.slice),Ho=oo.call(io,RegExp.prototype.exec),Jo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Vo=/\\(\\)?/g,Ko=function(e,t){var n,o=e;if(Ro(qo,o)&&(o="%"+(n=qo[o])[0]+"%"),Ro(zo,o)){var i=zo[o];if(i===Uo&&(i=Do(o)),void 0===i&&!t)throw new ro("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:o,value:i}}throw new wo("intrinsic "+e+" does not exist!")},Yo=function(e,t){if("string"!=typeof e||0===e.length)throw new ro("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new ro('"allowMissing" argument must be a boolean');if(null===Ho(/^%?[^%]*%?$/,e))throw new wo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(e){var t=Go(e,0,1),n=Go(e,-1);if("%"===t&&"%"!==n)throw new wo("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new wo("invalid intrinsic syntax, expected opening `%`");var o=[];return Wo(e,Jo,function(e,t,n,i){o[o.length]=n?Wo(i,Vo,"$1"):t||e}),o}(e),o=n.length>0?n[0]:"",i=Ko("%"+o+"%",t),a=i.name,s=i.value,r=!1,c=i.alias;c&&(o=c[0],Mo(n,Bo([0,1],c)));for(var l=1,p=!0;l<n.length;l+=1){var u=n[l],d=Go(u,0,1),m=Go(u,-1);if(('"'===d||"'"===d||"`"===d||'"'===m||"'"===m||"`"===m)&&d!==m)throw new wo("property names with quotes must have matching quotes");if("constructor"!==u&&p||(r=!0),Ro(zo,a="%"+(o+="."+u)+"%"))s=zo[a];else if(null!=s){if(!(u in s)){if(!t)throw new ro("base intrinsic for "+e+" exists, but the property is not available.");return}if(co&&l+1>=n.length){var f=co(s,u);s=(p=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[u]}else p=Ro(s,u),s=s[u];p&&!r&&(zo[a]=s)}}return s}("%Object.defineProperty%",!0),Zo=Kn()&&Symbol.toStringTag?Symbol.toStringTag:null,Xo=function(e,t){return Object.keys(t).forEach(function(n){e[n]=e[n]||t[n]}),e},Qo=re.parse,ei=oe.Stream;function ti(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}function ni(e){if(!(this instanceof ni))return new ni(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],fn.call(this),e=e||{})this[t]=e[t]}ne.inherits(ni,fn),ni.LINE_BREAK="\r\n",ni.DEFAULT_CONTENT_TYPE="application/octet-stream",ni.prototype.append=function(e,t,n){"string"==typeof(n=n||{})&&(n={filename:n});var o=fn.prototype.append.bind(this);if("number"!=typeof t&&null!=t||(t=String(t)),Array.isArray(t))this._error(new Error("Arrays are not supported."));else{var i=this._multiPartHeader(e,t,n),a=this._multiPartFooter();o(i),o(t),o(a),this._trackLength(i,t,n)}},ni.prototype._trackLength=function(e,t,n){var o=0;null!=n.knownLength?o+=Number(n.knownLength):Buffer.isBuffer(t)?o=t.length:"string"==typeof t&&(o=Buffer.byteLength(t)),this._valueLength+=o,this._overheadLength+=Buffer.byteLength(e)+ni.LINE_BREAK.length,t&&(t.path||t.readable&&Ro(t,"httpVersion")||t instanceof ei)&&(n.knownLength||this._valuesToMeasure.push(t))},ni.prototype._lengthRetriever=function(e,t){Ro(e,"fd")?null!=e.end&&Infinity!=e.end&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):r.stat(e.path,function(n,o){n?t(n):t(null,o.size-(e.start?e.start:0))}):Ro(e,"httpVersion")?t(null,Number(e.headers["content-length"])):Ro(e,"httpModule")?(e.on("response",function(n){e.pause(),t(null,Number(n.headers["content-length"]))}),e.resume()):t("Unknown stream")},ni.prototype._multiPartHeader=function(e,t,n){if("string"==typeof n.header)return n.header;var o,i=this._getContentDisposition(t,n),a=this._getContentType(t,n),s="",r={"Content-Disposition":["form-data",'name="'+ti(e)+'"'].concat(i||[]),"Content-Type":[].concat(a||[])};for(var c in"object"==typeof n.header&&Xo(r,n.header),r)if(Ro(r,c)){if(null==(o=r[c]))continue;Array.isArray(o)||(o=[o]),o.length&&(s+=c+": "+o.join("; ")+ni.LINE_BREAK)}return"--"+this.getBoundary()+ni.LINE_BREAK+s+ni.LINE_BREAK},ni.prototype._getContentDisposition=function(e,t){var n;if("string"==typeof t.filepath?n=b.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?n=b.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&Ro(e,"httpVersion")&&(n=b.basename(e.client._httpMessage.path||"")),n)return'filename="'+ti(n)+'"'},ni.prototype._getContentType=function(e,t){var n=t.contentType;return!n&&e&&e.name&&(n=bn.lookup(e.name)),!n&&e&&e.path&&(n=bn.lookup(e.path)),!n&&e&&e.readable&&Ro(e,"httpVersion")&&(n=e.headers["content-type"]),n||!t.filepath&&!t.filename||(n=bn.lookup(t.filepath||t.filename)),!n&&e&&"object"==typeof e&&(n=ni.DEFAULT_CONTENT_TYPE),n},ni.prototype._multiPartFooter=function(){return function(e){var t=ni.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},ni.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+ni.LINE_BREAK},ni.prototype.getHeaders=function(e){var t,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)Ro(e,t)&&(n[t.toLowerCase()]=e[t]);return n},ni.prototype.setBoundary=function(e){if("string"!=typeof e)throw new TypeError("FormData boundary must be a string");this._boundary=e},ni.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},ni.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),n=0,o=this._streams.length;n<o;n++)"function"!=typeof this._streams[n]&&(e=Buffer.isBuffer(this._streams[n])?Buffer.concat([e,this._streams[n]]):Buffer.concat([e,Buffer.from(this._streams[n])]),"string"==typeof this._streams[n]&&this._streams[n].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(ni.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},ni.prototype._generateBoundary=function(){this._boundary="--------------------------"+ce.randomBytes(12).toString("hex")},ni.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},ni.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},ni.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?function(e,t,n){for(var o=jn(e);o.index<(o.keyedList||e).length;)Sn(e,t,o,function(e,t){e?n(e,t):0!==Object.keys(o.jobs).length||n(null,o.results)}),o.index++;En.bind(o,n)}(this._valuesToMeasure,this._lengthRetriever,function(n,o){n?e(n):(o.forEach(function(e){t+=e}),e(null,t))}):process.nextTick(e.bind(this,null,t))},ni.prototype.submit=function(e,t){var n,o,i={method:"post"};return"string"==typeof e?(e=Qo(e),o=Xo({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},i)):(o=Xo(e,i)).port||(o.port="https:"===o.protocol?443:80),o.headers=this.getHeaders(e.headers),n="https:"===o.protocol?se.request(o):ae.request(o),this.getLength(function(e,o){if(e&&"Unknown stream"!==e)this._error(e);else if(o&&n.setHeader("Content-Length",o),this.pipe(n),t){var i,a=function(e,o){return n.removeListener("error",a),n.removeListener("response",i),t.call(this,e,o)};i=a.bind(this,null),n.on("error",a),n.on("response",i)}}.bind(this)),n},ni.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},ni.prototype.toString=function(){return"[object FormData]"},function(e,t){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(void 0!==n&&"boolean"!=typeof n||void 0!==o&&"boolean"!=typeof o)throw new ro("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");!Zo||!n&&Ro(e,Zo)||(Yo?Yo(e,Zo,{configurable:!o,enumerable:!1,value:t,writable:!1}):e[Zo]=t)}(ni.prototype,"FormData");var oi=ni,ii={isBufferAvailable:()=>"undefined"!=typeof Buffer,from:e=>Buffer.from(e)};const ai=100;function si(e){return Ht.isPlainObject(e)||Ht.isArray(e)}function ri(e){return Ht.endsWith(e,"[]")?e.slice(0,-2):e}function ci(e,t,n){return e?e.concat(t).map(function(e,t){return e=ri(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const li=Ht.toFlatObject(Ht,{},null,function(e){return/^is[A-Z]/.test(e)});function pi(e,t,n){if(!Ht.isObject(e))throw new TypeError("target must be an object");t=t||new(oi||FormData);const o=(n=Ht.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Ht.isUndefined(t[e])})).metaTokens,i=n.visitor||m,a=n.dots,s=n.indexes,r=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?ai:n.maxDepth,l=r&&Ht.isSpecCompliantForm(t),p=[];if(!Ht.isFunction(i))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(Ht.isDate(e))return e.toISOString();if(Ht.isBoolean(e))return e.toString();if(!l&&Ht.isBlob(e))throw new ln("Blob is not supported. Use a Buffer instead.");if(Ht.isArrayBuffer(e)||Ht.isTypedArray(e)){if(l&&"function"==typeof r)return new r([e]);if(ii&&ii.isBufferAvailable())return ii.from(e);throw new ln("Blob is not supported. Use a Buffer instead.",ln.ERR_NOT_SUPPORT)}return e}function d(e){if(e>c)throw new ln("Object is too deeply nested ("+e+" levels). Max depth: "+c,ln.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(e,n,i){let r=e;if(Ht.isReactNative(t)&&Ht.isReactNativeBlob(e))return t.append(ci(i,n,a),u(e)),!1;if(e&&!i&&"object"==typeof e)if(Ht.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=function(e,t){if(Infinity===c)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,t){if(!Ht.isObject(t))return t;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(t),d(1+n.length-1),t})}(e);else if(Ht.isArray(e)&&function(e){return Ht.isArray(e)&&!e.some(si)}(e)||(Ht.isFileList(e)||Ht.endsWith(n,"[]"))&&(r=Ht.toArray(e)))return n=ri(n),r.forEach(function(e,o){!Ht.isUndefined(e)&&null!==e&&t.append(!0===s?ci([n],o,a):null===s?n:n+"[]",u(e))}),!1;return!!si(e)||(t.append(ci(i,n,a),u(e)),!1)}const f=Object.assign(li,{defaultVisitor:m,convertValue:u,isVisitable:si});if(!Ht.isObject(e))throw new TypeError("data must be an object");return function e(n,o,a=0){if(!Ht.isUndefined(n)){if(d(a),-1!==p.indexOf(n))throw new Error("Circular reference detected in "+o.join("."));p.push(n),Ht.forEach(n,function(n,s){!0===(!(Ht.isUndefined(n)||null===n)&&i.call(t,n,Ht.isString(s)?s.trim():s,o,f))&&e(n,o?o.concat(s):[s],a+1)}),p.pop()}}(e),t}function ui(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function di(e,t){this._pairs=[],e&&pi(e,this,t)}const mi=di.prototype;function fi(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function hi(e,t,n){if(!t)return e;e=e||"";const o=Ht.isFunction(n)?{serialize:n}:n,i=Ht.getSafeProp(o,"encode")||fi,a=Ht.getSafeProp(o,"serialize");let s;if(s=a?a(t,o):Ht.isURLSearchParams(t)?t.toString():new di(t,o).toString(i),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}mi.append=function(e,t){this._pairs.push([e,t])},mi.toString=function(e){const t=e?t=>e.call(this,t,ui):ui;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var gi=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ht.forEach(this.handlers,function(t){null!==t&&e(t)})}},vi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},xi=re.URLSearchParams;const bi="abcdefghijklmnopqrstuvwxyz",yi="0123456789",wi={DIGIT:yi,ALPHA:bi,ALPHA_DIGIT:bi+bi.toUpperCase()+yi};var _i={isNode:!0,classes:{URLSearchParams:xi,FormData:oi,Blob:"undefined"!=typeof Blob&&Blob||null},ALPHABET:wi,generateString:(e=16,t=wi.ALPHA_DIGIT)=>{let n="";const{length:o}=t,i=new Uint32Array(e);ce.randomFillSync(i);for(let a=0;a<e;a++)n+=t[i[a]%o];return n},protocols:["http","https","file","data"]};const ki="undefined"!=typeof window&&"undefined"!=typeof document,Si="object"==typeof navigator&&navigator||void 0,ji=ki&&(!Si||["ReactNative","NativeScript","NS"].indexOf(Si.product)<0);var Ei={__proto__:null,hasBrowserEnv:ki,hasStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,hasStandardBrowserEnv:ji,navigator:Si,origin:ki&&window.location.href||"http://localhost",..._i};const Ti=ai;function $i(e){if(e>Ti)throw new ln("FormData field is too deeply nested ("+e+" levels). Max depth: "+Ti,ln.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Oi(e){function t(e,n,o,i){$i(i);let a=e[i++];if("__proto__"===a)return!0;const s=Number.isFinite(+a),r=i>=e.length;return a=!a&&Ht.isArray(o)?o.length:a,r?(o[a]=Ht.hasOwnProp(o,a)?Ht.isArray(o[a])?o[a].concat(n):[o[a],n]:n,!s):(Ht.hasOwnProp(o,a)&&Ht.isObject(o[a])||(o[a]=[]),t(e,n,o[a],i)&&Ht.isArray(o[a])&&(o[a]=function(e){const t={},n=Object.keys(e);let o;const i=n.length;let a;for(o=0;o<i;o++)a=n[o],t[a]=e[a];return t}(o[a])),!s)}if(Ht.isFormData(e)&&Ht.isFunction(e.entries)){const n={};return Ht.forEachEntry(e,(e,o)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let o;for(;null!==(o=n.exec(e));)$i(t.length),t.push("[]"===o[0]?"":o[1]||o[0]);return t}(e),o,n,0)}),n}return null}const Ri=(e,t)=>null!=e&&Ht.hasOwnProp(e,t)?e[t]:void 0,Ai={transitional:vi,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",o=n.indexOf("application/json")>-1,i=Ht.isObject(e);if(i&&Ht.isHTMLForm(e)&&(e=new FormData(e)),Ht.isFormData(e))return o?JSON.stringify(Oi(e)):e;if(Ht.isArrayBuffer(e)||Ht.isBuffer(e)||Ht.isStream(e)||Ht.isFile(e)||Ht.isBlob(e)||Ht.isReadableStream(e))return e;if(Ht.isArrayBufferView(e))return e.buffer;if(Ht.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){const t=Ri(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return pi(e,new Ei.classes.URLSearchParams,{visitor:function(e,t,n,o){return Ei.isNode&&Ht.isBuffer(e)?(this.append(t,e.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((a=Ht.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ri(this,"env"),o=n&&n.FormData;return pi(a?{"files[]":e}:e,o&&new o,t)}}return i||o?(t.setContentType("application/json",!1),function(e,t,n){if(Ht.isString(e))try{return(0,JSON.parse)(e),Ht.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ri(this,"transitional")||Ai.transitional,n=t&&t.forcedJSONParsing,o=Ri(this,"responseType"),i="json"===o;if(Ht.isResponse(e)||Ht.isReadableStream(e))return e;if(e&&Ht.isString(e)&&(n&&!o||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,Ri(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw ln.from(e,ln.ERR_BAD_RESPONSE,this,null,Ri(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ei.classes.FormData,Blob:Ei.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ht.forEach(["delete","get","head","post","put","patch","query"],e=>{Ai.headers[e]={}});var Ci=Ai;function Ni(e,t){const n=this||Ci,o=t||n,i=sn.from(o.headers);let a=o.data;return Ht.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function Ii(e){return!(!e||!e.__CANCEL__)}var Pi=class extends ln{constructor(e,t,n){super(null==e?"canceled":e,ln.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Ui(e,t,n){const o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(new ln("Request failed with status code "+n.status,n.status>=400&&n.status<500?ln.ERR_BAD_REQUEST:ln.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const Li=/^https?:(?!\/\/)/i,zi=/[\t\n\r]/g;function Fi(e,t){if("string"==typeof e){const n=function(e){return function(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}(e).replace(zi,"")}(e);if(Li.test(n))throw new ln(`Invalid URL ${JSON.stringify(function(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${rn}@`),n=t.indexOf("#"),o=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${rn}`);return-1===n?o:`${o}#${i=t.slice(n+1),i?i.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${rn}`):i}`;var i}(n))}: missing "//" after protocol`,ln.ERR_INVALID_URL,t)}}function Di(e,t,n,o){Fi(t,o);let i=!function(e){return"string"==typeof e&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(i||!1===n)?(Fi(e,o),function(e,t){if(!t)return e;let n=e.length;for(;n>0&&47===e.charCodeAt(n-1);)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}var qi={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function Bi(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var Mi=1e3,Wi=60*Mi,Gi=60*Wi,Hi=24*Gi,Ji=7*Hi,Vi=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return n*Ji;case"days":case"day":case"d":return n*Hi;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Gi;case"minutes":case"minute":case"mins":case"min":case"m":return n*Wi;case"seconds":case"second":case"secs":case"sec":case"s":return n*Mi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=Hi?Ki(e,t,Hi,"day"):t>=Gi?Ki(e,t,Gi,"hour"):t>=Wi?Ki(e,t,Wi,"minute"):t>=Mi?Ki(e,t,Mi,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=Hi?Math.round(e/Hi)+"d":t>=Gi?Math.round(e/Gi)+"h":t>=Wi?Math.round(e/Wi)+"m":t>=Mi?Math.round(e/Mi)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Ki(e,t,n,o){var i=t>=1.5*n;return Math.round(e/n)+" "+o+(i?"s":"")}var Yi=function(e){function t(e){let o,i,a,s=null;function r(...e){if(!r.enabled)return;const n=r,i=Number(new Date);n.diff=i-(o||i),n.prev=o,n.curr=i,o=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(o,i)=>{if("%%"===o)return"%";a++;const s=t.formatters[i];return"function"==typeof s&&(o=s.call(n,e[a]),e.splice(a,1),a--),o}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return r.namespace=e,r.useColors=t.useColors(),r.color=t.selectColor(e),r.extend=n,r.destroy=t.destroy,Object.defineProperty(r,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,a=t.enabled(e)),a),set:e=>{s=e}}),"function"==typeof t.init&&t.init(r),r}function n(e,n){const o=t(this.namespace+(void 0===n?":":n)+e);return o.log=this.log,o}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(o),...t.skips.map(o).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const o=("string"==typeof e?e:"").split(/[\s,]+/),i=o.length;for(n=0;n<i;n++)o[n]&&("-"===(e=o[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,o;for(n=0,o=t.skips.length;n<o;n++)if(t.skips[n].test(e))return!1;for(n=0,o=t.names.length;n<o;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=Vi,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t},Zi=vn(function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(o++,"%c"===e&&(i=o))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Yi(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}),Xi=(e,t=process.argv)=>{const n=e.startsWith("-")?"":1===e.length?"-":"--",o=t.indexOf(n+e),i=t.indexOf("--");return-1!==o&&(-1===i||o<i)};const{env:Qi}=process;let ea;function ta(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function na(e,t){if(0===ea)return 0;if(Xi("color=16m")||Xi("color=full")||Xi("color=truecolor"))return 3;if(Xi("color=256"))return 2;if(e&&!t&&void 0===ea)return 0;const n=ea||0;if("dumb"===Qi.TERM)return n;if("win32"===process.platform){const e=fe.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Qi)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(e=>e in Qi)||"codeship"===Qi.CI_NAME?1:n;if("TEAMCITY_VERSION"in Qi)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Qi.TEAMCITY_VERSION)?1:0;if("truecolor"===Qi.COLORTERM)return 3;if("TERM_PROGRAM"in Qi){const e=parseInt((Qi.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Qi.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Qi.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Qi.TERM)||"COLORTERM"in Qi?1:n}Xi("no-color")||Xi("no-colors")||Xi("color=false")||Xi("color=never")?ea=0:(Xi("color")||Xi("colors")||Xi("color=true")||Xi("color=always"))&&(ea=1),"FORCE_COLOR"in Qi&&(ea="true"===Qi.FORCE_COLOR?1:"false"===Qi.FORCE_COLOR?0:0===Qi.FORCE_COLOR.length?1:Math.min(parseInt(Qi.FORCE_COLOR,10),3));var oa={supportsColor:function(e){return ta(na(e,e&&e.isTTY))},stdout:ta(na(!0,me.isatty(1))),stderr:ta(na(!0,me.isatty(2)))},ia=vn(function(e,t){t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let o=0;o<n.length;o++)e.inspectOpts[n[o]]=t.inspectOpts[n[o]]},t.log=function(...e){return process.stderr.write(ne.format(...e)+"\n")},t.formatArgs=function(n){const{namespace:o,useColors:i}=this;if(i){const t=this.color,i="[3"+(t<8?t:"8;5;"+t),a=` ${i};1m${o} `;n[0]=a+n[0].split("\n").join("\n"+a),n.push(i+"m+"+e.exports.humanize(this.diff)+"")}else n[0]=(t.inspectOpts.hideDate?"":(new Date).toISOString()+" ")+o+" "+n[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):me.isatty(process.stderr.fd)},t.destroy=ne.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{oa&&(oa.stderr||oa).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase());let o=process.env[t];return o=!!/^(yes|on|true|enabled)$/i.test(o)||!/^(no|off|false|disabled)$/i.test(o)&&("null"===o?null:Number(o)),e[n]=o,e},{}),e.exports=Yi(t);const{formatters:n}=e.exports;n.o=function(e){return this.inspectOpts.colors=this.useColors,ne.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},n.O=function(e){return this.inspectOpts.colors=this.useColors,ne.inspect(e,this.inspectOpts)}}),aa=vn(function(e){e.exports="undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Zi:ia}),sa=/*#__PURE__*/Object.defineProperty({default:function(e){return function(t,n){return new Promise((o,i)=>{e.call(this,t,n,(e,t)=>{e?i(e):o(t)})})}}},"__esModule",{value:!0}),ra=gn&&gn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const ca=ra(aa),la=ra(sa),pa=ca.default("agent-base");function ua(){const{stack:e}=new Error;return"string"==typeof e&&e.split("\n").some(e=>-1!==e.indexOf("(https.js:")||-1!==e.indexOf("node:https:"))}function da(e,t){return new da.Agent(e,t)}!function(e){e.Agent=class extends ve.EventEmitter{constructor(e,t){super();let n=t;"function"==typeof e?this.callback=e:e&&(n=e),this.timeout=null,n&&"number"==typeof n.timeout&&(this.timeout=n.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=Infinity,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return"number"==typeof this.explicitDefaultPort?this.explicitDefaultPort:ua()?443:80}set defaultPort(e){this.explicitDefaultPort=e}get protocol(){return"string"==typeof this.explicitProtocol?this.explicitProtocol:ua()?"https:":"http:"}set protocol(e){this.explicitProtocol=e}callback(e,t,n){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(e,t){const n=Object.assign({},t);"boolean"!=typeof n.secureEndpoint&&(n.secureEndpoint=ua()),null==n.host&&(n.host="localhost"),null==n.port&&(n.port=n.secureEndpoint?443:80),null==n.protocol&&(n.protocol=n.secureEndpoint?"https:":"http:"),n.host&&n.path&&delete n.path,delete n.agent,delete n.hostname,delete n._defaultAgent,delete n.defaultPort,delete n.createConnection,e._last=!0,e.shouldKeepAlive=!1;let o=!1,i=null;const a=n.timeout||this.timeout,s=t=>{e._hadError||(e.emit("error",t),e._hadError=!0)},r=()=>{i=null,o=!0;const e=new Error(`A "socket" was not created for HTTP request before ${a}ms`);e.code="ETIMEOUT",s(e)},c=e=>{o||(null!==i&&(clearTimeout(i),i=null),s(e))},l=t=>{if(o)return;if(null!=i&&(clearTimeout(i),i=null),a=t,Boolean(a)&&"function"==typeof a.addRequest)return pa("Callback returned another Agent instance %o",t.constructor.name),void t.addRequest(e,n);var a;if(t)return t.once("free",()=>{this.freeSocket(t,n)}),void e.onSocket(t);const r=new Error(`no Duplex stream was returned to agent-base for \`${e.method} ${e.path}\``);s(r)};if("function"==typeof this.callback){this.promisifiedCallback||(this.callback.length>=3?(pa("Converting legacy callback function to promise"),this.promisifiedCallback=la.default(this.callback)):this.promisifiedCallback=this.callback),"number"==typeof a&&a>0&&(i=setTimeout(r,a)),"port"in n&&"number"!=typeof n.port&&(n.port=Number(n.port));try{pa("Resolving socket for %o request: %o",n.protocol,`${e.method} ${e.path}`),Promise.resolve(this.promisifiedCallback(e,n)).then(l,c)}catch(e){Promise.reject(e).catch(c)}}else s(new Error("`callback` is not defined"))}freeSocket(e,t){pa("Freeing socket %o %o",e.constructor.name,t),e.destroy()}destroy(){pa("Destroying agent %o",this.constructor.name)}},e.prototype=e.Agent.prototype}(da||(da={}));var ma=da;const fa=(gn&&gn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(aa).default("https-proxy-agent:parse-proxy-response");var ha=/*#__PURE__*/Object.defineProperty({default:function(e){return new Promise((t,n)=>{let o=0;const i=[];function a(){const n=e.read();n?function(e){i.push(e),o+=e.length;const n=Buffer.concat(i,o);if(-1===n.indexOf("\r\n\r\n"))return fa("have not received end of HTTP headers yet..."),void a();const s=n.toString("ascii",0,n.indexOf("\r\n")),r=+s.split(" ")[1];fa("got proxy server response: %o",s),t({statusCode:r,buffered:n})}(n):e.once("readable",a)}function s(e){fa("onclose had error %o",e)}function r(){fa("onend")}e.on("error",function t(o){e.removeListener("end",r),e.removeListener("error",t),e.removeListener("close",s),e.removeListener("readable",a),fa("onerror %o",o),n(o)}),e.on("close",s),e.on("end",r),a()})}},"__esModule",{value:!0}),ga=gn&&gn.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(i,a){function s(e){try{c(o.next(e))}catch(e){a(e)}}function r(e){try{c(o.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,r)}c((o=o.apply(e,t||[])).next())})},va=gn&&gn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const xa=va(pe),ba=va(ue),ya=va(re),wa=va(de),_a=va(aa),ka=va(ha),Sa=_a.default("https-proxy-agent:agent");function ja(e){e.resume()}const Ea=(gn&&gn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(/*#__PURE__*/Object.defineProperty({default:class extends ma.Agent{constructor(e){let t;if(t="string"==typeof e?ya.default.parse(e):e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");Sa("creating new HttpsProxyAgent instance: %o",t),super(t);const n=Object.assign({},t);var o;this.secureProxy=t.secureProxy||"string"==typeof(o=n.protocol)&&/^https:?$/i.test(o),n.host=n.hostname||n.host,"string"==typeof n.port&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in n)&&(n.ALPNProtocols=["http 1.1"]),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(e,t){return ga(this,void 0,void 0,function*(){const{proxy:n,secureProxy:o}=this;let i;o?(Sa("Creating `tls.Socket`: %o",n),i=ba.default.connect(n)):(Sa("Creating `net.Socket`: %o",n),i=xa.default.connect(n));const a=Object.assign({},n.headers);let s=`CONNECT ${t.host}:${t.port} HTTP/1.1\r\n`;n.auth&&(a["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:r,port:c,secureEndpoint:l}=t;(function(e,t){return Boolean(!t&&80===e||t&&443===e)})(c,l)||(r+=`:${c}`),a.Host=r,a.Connection="close";for(const e of Object.keys(a))s+=`${e}: ${a[e]}\r\n`;const p=ka.default(i);i.write(`${s}\r\n`);const{statusCode:u,buffered:d}=yield p;if(200===u){if(e.once("socket",ja),t.secureEndpoint){Sa("Upgrading socket connection to TLS");const e=t.servername||t.host;return ba.default.connect(Object.assign(Object.assign({},function(e,...t){const n={};let o;for(o in e)t.includes(o)||(n[o]=e[o]);return n}(t,"host","hostname","path","port")),{socket:i,servername:e}))}return i}i.destroy();const m=new xa.default.Socket({writable:!1});return m.readable=!0,e.once("socket",e=>{Sa("replaying proxy buffer for failed request"),wa.default(e.listenerCount("data")>0),e.push(d),e.push(null)}),m})}}},"__esModule",{value:!0}));function Ta(e){return new Ea.default(e)}!function(e){e.HttpsProxyAgent=Ea.default,e.prototype=Ea.default.prototype}(Ta||(Ta={}));var $a,Oa,Ra,Aa,Ca=Ta,Na=function(){if(!$a){try{$a=aa("follow-redirects")}catch(e){}"function"!=typeof $a&&($a=function(){})}$a.apply(null,arguments)},Ia=re.URL,Pa=oe.Writable;Oa="undefined"!=typeof process,Ra="undefined"!=typeof window&&"undefined"!=typeof document,Aa=os(Error.captureStackTrace),Oa||!Ra&&Aa||console.warn("The follow-redirects package should be excluded from browser builds.");var Ua=!1;try{de(new Ia(""))}catch(e){Ua="ERR_INVALID_URL"===e.code}var La=["Authorization","Proxy-Authorization","Cookie"],za=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],Fa=["abort","aborted","connect","error","socket","timeout"],Da=Object.create(null);Fa.forEach(function(e){Da[e]=function(t,n,o){this._redirectable.emit(e,t,n,o)}});var qa=es("ERR_INVALID_URL","Invalid URL",TypeError),Ba=es("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Ma=es("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",Ba),Wa=es("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Ga=es("ERR_STREAM_WRITE_AFTER_END","write after end"),Ha=Pa.prototype.destroy||Ka;function Ja(e,t){Pa.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var n=this;this._onNativeResponse=function(e){try{n._processResponse(e)}catch(e){n.emit("error",e instanceof Ba?e:new Ba({cause:e}))}},this._headerFilter=new RegExp("^(?:"+La.concat(e.sensitiveHeaders).map(is).join("|")+")$","i"),this._performRequest()}function Va(e){var t={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(e).forEach(function(o){var i=o+":",a=n[i]=e[o],s=t[o]=Object.create(a);Object.defineProperties(s,{request:{value:function(e,o,a){return Ia&&e instanceof Ia?e=Xa(e):ns(e)?e=Xa(Ya(e)):(a=o,o=Za(e),e={protocol:i}),os(o)&&(a=o,o=null),(o=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,o)).nativeProtocols=n,ns(o.host)||ns(o.hostname)||(o.hostname="::1"),de.equal(o.protocol,i,"protocol mismatch"),Na("options",o),new Ja(o,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,n){var o=s.request(e,t,n);return o.end(),o},configurable:!0,enumerable:!0,writable:!0}})}),t}function Ka(){}function Ya(e){var t;if(Ua)t=new Ia(e);else if(!ns((t=Za(re.parse(e))).protocol))throw new qa({input:e});return t}function Za(e){if(/^\[/.test(e.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(e.hostname))throw new qa({input:e.href||e});if(/^\[/.test(e.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(e.host))throw new qa({input:e.href||e});return e}function Xa(e,t){var n=t||{};for(var o of za)n[o]=e[o];return n.hostname.startsWith("[")&&(n.hostname=n.hostname.slice(1,-1)),""!==n.port&&(n.port=Number(n.port)),n.path=n.search?n.pathname+n.search:n.pathname,n}function Qa(e,t){var n;for(var o in t)e.test(o)&&(n=t[o],delete t[o]);return null==n?void 0:String(n).trim()}function es(e,t,n){function o(n){os(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,n||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return o.prototype=new(n||Error),Object.defineProperties(o.prototype,{constructor:{value:o,enumerable:!1},name:{value:"Error ["+e+"]",enumerable:!1}}),o}function ts(e,t){for(var n of Fa)e.removeListener(n,Da[n]);e.on("error",Ka),e.destroy(t)}function ns(e){return"string"==typeof e||e instanceof String}function os(e){return"function"==typeof e}function is(e){return e.replace(/[\]\\/()*+?.$]/g,"\\$&")}(Ja.prototype=Object.create(Pa.prototype)).abort=function(){ts(this._currentRequest),this._currentRequest.abort(),this.emit("abort")},Ja.prototype.destroy=function(e){return ts(this._currentRequest,e),Ha.call(this,e),this},Ja.prototype.write=function(e,t,n){if(this._ending)throw new Ga;if(!(ns(e)||"object"==typeof(o=e)&&"length"in o))throw new TypeError("data should be a string, Buffer or Uint8Array");var o;os(t)&&(n=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,n)):(this.emit("error",new Wa),this.abort()):n&&n()},Ja.prototype.end=function(e,t,n){if(os(e)?(n=e,e=t=null):os(t)&&(n=t,t=null),e){var o=this,i=this._currentRequest;this.write(e,t,function(){o._ended=!0,i.end(null,null,n)}),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,n)},Ja.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},Ja.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},Ja.prototype.setTimeout=function(e,t){var n=this;function o(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function i(t){n._timeout&&clearTimeout(n._timeout),n._timeout=setTimeout(function(){n.emit("timeout"),a()},e),o(t)}function a(){n._timeout&&(clearTimeout(n._timeout),n._timeout=null),n.removeListener("abort",a),n.removeListener("error",a),n.removeListener("response",a),n.removeListener("close",a),t&&n.removeListener("timeout",t),n.socket||n._currentRequest.removeListener("socket",i)}return t&&this.on("timeout",t),this.socket?i(this.socket):this._currentRequest.once("socket",i),this.on("socket",o),this.on("abort",a),this.on("error",a),this.on("response",a),this.on("close",a),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(e){Ja.prototype[e]=function(t,n){return this._currentRequest[e](t,n)}}),["aborted","connection","socket"].forEach(function(e){Object.defineProperty(Ja.prototype,e,{get:function(){return this._currentRequest[e]}})}),Ja.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.sensitiveHeaders instanceof Array||(e.sensitiveHeaders=[]),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},Ja.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(!t)throw new TypeError("Unsupported protocol "+e);if(this._options.agents){var n=e.slice(0,-1);this._options.agent=this._options.agents[n]}var o=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var i of(o._redirectable=this,Fa))o.on(i,Da[i]);if(this._currentUrl=/^\//.test(this._options.path)?re.format(this._options):this._options.path,this._isRedirect){var a=0,s=this,r=this._requestBodyBuffers;!function e(t){if(o===s._currentRequest)if(t)s.emit("error",t);else if(a<r.length){var n=r[a++];o.finished||o.write(n.data,n.encoding,e)}else s._ended&&o.end()}()}},Ja.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var n,o=e.headers.location;if(!o||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(ts(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)throw new Ma;var i=this._options.beforeRedirect;i&&(n=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var a=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],Qa(/^content-/i,this._options.headers));var s=Qa(/^host$/i,this._options.headers),r=Ya(this._currentUrl),c=s||r.host,l=/^\w+:/.test(o)?this._currentUrl:re.format(Object.assign(r,{host:c})),p=function(e,t){return Ua?new Ia(e,t):Ya(re.resolve(t,e))}(o,l);Na("redirecting to",p.href),this._isRedirect=!0,Xa(p,this._options),(p.protocol!==r.protocol&&"https:"!==p.protocol||p.host!==c&&!function(e,t){de(ns(e)&&ns(t));var n=e.length-t.length-1;return n>0&&"."===e[n]&&e.endsWith(t)}(p.host,c))&&Qa(this._headerFilter,this._options.headers),os(i)&&(i(this._options,{headers:e.headers,statusCode:t},{url:l,method:a,headers:n}),this._sanitizeOptions(this._options)),this._performRequest()};var as=Va({http:ae,https:se});as.wrap=Va;const ss="1.19.0";function rs(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}const cs=/^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/,ls=["content-type","content-length"];function ps(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{ls.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}const us=Symbol("internals");var ds=class extends oe.Transform{constructor(e){super({readableHighWaterMark:(e=Ht.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(e,t)=>!Ht.isUndefined(t[e]))).chunkSize});const t=this[us]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",e=>{"progress"===e&&(t.isCaptured||(t.isCaptured=!0))})}_read(e){const t=this[us];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){const o=this[us],i=o.maxRate,a=this.readableHighWaterMark,s=o.timeWindow,r=i/(1e3/s),c=!1!==o.minChunkSize?Math.max(o.minChunkSize,.01*r):0,l=(e,t)=>{const n=Buffer.byteLength(e);o.bytesSeen+=n,o.bytes+=n,o.isCaptured&&this.emit("progress",o.bytesSeen),this.push(e)?process.nextTick(t):o.onReadCallback=()=>{o.onReadCallback=null,process.nextTick(t)}},p=(e,t)=>{const n=Buffer.byteLength(e);let p,u=null,d=a,m=0;if(i){const e=Date.now();(!o.ts||(m=e-o.ts)>=s)&&(o.ts=e,p=r-o.bytes,o.bytes=p<0?-p:0,m=0),p=r-o.bytes}if(i){if(p<=0)return setTimeout(()=>{t(null,e)},s-m);p<d&&(d=p)}d&&n>d&&n-d>c&&(u=e.subarray(d),e=e.subarray(0,d)),l(e,u?()=>{process.nextTick(t,null,u)}:t)};p(e,function e(t,o){if(t)return n(t);o?p(o,e):n(null)})}};const{asyncIterator:ms}=Symbol;var fs=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[ms]?yield*e[ms]():yield e};const hs=Ei.ALPHABET.ALPHA_DIGIT+"-_",gs="function"==typeof TextEncoder?new TextEncoder:new ne.TextEncoder,vs="\r\n",xs=gs.encode(vs);class bs{constructor(e,t){const{escapeName:n}=this.constructor,o=Ht.isString(t);let i=`Content-Disposition: form-data; name="${n(e)}"${!o&&t.name?`; filename="${n(t.name)}"`:""}${vs}`;o?t=gs.encode(String(t).replace(/\r?\n|\r\n?/g,vs)):i+=`Content-Type: ${String(t.type||"application/octet-stream").replace(/[\r\n]/g,"")}${vs}`,this.headers=gs.encode(i+vs),this.contentLength=o?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+2,this.name=e,this.value=t}async*encode(){yield this.headers;const{value:e}=this;Ht.isTypedArray(e)?yield e:yield*fs(e),yield xs}static escapeName(e){return String(e).replace(/[\r\n"]/g,e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e]))}}var ys=class extends oe.Transform{__transform(e,t,n){this.push(e),n()}_transform(e,t,n){if(0!==e.length&&(this._transform=this.__transform,120!==e[0])){const e=Buffer.alloc(2);e[0]=120,e[1]=156,this.push(e,t)}this.__transform(e,t,n)}},ws=(e,t)=>Ht.isAsyncFn(e)?function(...n){const o=n.pop();e.apply(this,n).then(e=>{try{t?o(null,...t(e)):o(null,e)}catch(e){o(e)}},o)}:e;const _s=new Set(["localhost","0.0.0.0"]),ks=e=>{const t=e.split(".");return 4===t.length&&"127"===t[0]&&t.every(e=>/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255)},Ss=e=>{if(/^0[xX][0-9a-fA-F]+$/.test(e)){const t=parseInt(e.slice(2),16);return Number.isFinite(t)?t:null}if(e.length>1&&/^0[0-7]+$/.test(e)){const t=parseInt(e,8);return Number.isFinite(t)?t:null}if(e.length>1&&/^0[0-9]+$/.test(e))return null;if(/^[0-9]+$/.test(e)){const t=parseInt(e,10);return Number.isFinite(t)?t:null}return null},js=e=>/^0{1,4}$/.test(e),Es=e=>!!e&&(!!_s.has(e)||!!ks(e)||!!(e=>{if("::"===e)return!0;const t=e.indexOf("::");if(-1!==t){if(t!==e.lastIndexOf("::"))return!1;const n=e.slice(0,t),o=e.slice(t+2),i=n?n.split(":"):[],a=o?o.split(":"):[];return i.length+a.length<8&&i.every(js)&&a.every(js)}const n=e.split(":");return 8===n.length&&n.every(js)})(e)||(e=>{if("::1"===e)return!0;const t=e.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i);if(t)return ks(t[1]);const n=e.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);if(n){const e=parseInt(n[1],16);return e>=32512&&e<=32767}const o=e.split(":");if(8===o.length){for(let e=0;e<7;e++)if(!/^0+$/.test(o[e]))return!1;return/^0*1$/.test(o[7])}return!1})(e)),Ts={http:80,https:443,ws:80,wss:443,ftp:21},$s=/^(?:::|(?:0{1,4}:){1,4}:|(?:0{1,4}:){5})ffff:(\d+\.\d+\.\d+\.\d+)$/i,Os=/^(?:::|(?:0{1,4}:){1,4}:|(?:0{1,4}:){5})ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i,Rs=e=>{if(!e)return e;"["===e.charAt(0)&&"]"===e.charAt(e.length-1)&&(e=e.slice(1,-1));const t=e.replace(/\.+$/,""),n=(e=>{if("string"!=typeof e||!e||-1!==e.indexOf(":"))return e;let t=e;if("["===t.charAt(0)&&"]"===t.charAt(t.length-1)&&(t=t.slice(1,-1)),t=t.replace(/\.+$/,""),!/^[0-9.xXa-fA-F]+$/.test(t))return e;const n=t.split(".");if(n.some(e=>""===e))return e;if(4===n.length){const t=n.map(Ss);return t.some(e=>null===e||e<0||e>255)?e:t.join(".")}if(n.length>4)return e;if(1===n.length)return e;const o=n.slice(0,-1),i=4-o.length,a=Ss(n[n.length-1]);if(null===a)return e;if(a<0||a>(1<<8*i)-1)return e;const s=new Array(i).fill(0);for(let e=i-1,t=a;e>=0;e--,t>>=8)s[e]=255&t;const r=o.map(Ss);return r.some(e=>null===e||e<0||e>255)?e:[...r,...s].join(".")})(t);return n!==t?n:(e=>{if("string"!=typeof e||-1===e.indexOf(":"))return e;const t=e.match($s);if(t)return t[1];const n=e.match(Os);if(n){const e=parseInt(n[1],16),t=parseInt(n[2],16);return`${e>>8}.${255&e}.${t>>8}.${255&t}`}return e})(t)},As=(e,t,n=3)=>{let o=0;const i=function(e,t){e=e||10;const n=new Array(e),o=new Array(e);let i,a=0,s=0;return t=void 0!==t?t:1e3,function(r){const c=Date.now(),l=o[s];i||(i=c),n[a]=r,o[a]=c;let p=s,u=0;for(;p!==a;)u+=n[p++],p%=e;if(a=(a+1)%e,a===s&&(s=(s+1)%e),c-i<t)return;const d=l&&c-l;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(n,a){let s,r,c=0,l=1e3/a;const p=(n,a=Date.now())=>{c=a,s=null,r&&(clearTimeout(r),r=null),(n=>{if(!n||"number"!=typeof n.loaded)return;const a=n.loaded,s=n.lengthComputable?n.total:void 0,r=Math.max(0,null!=s?Math.min(a,s):a),c=Math.max(0,r-o),l=i(c);o=Math.max(o,r),e({loaded:r,total:s,progress:s?r/s:void 0,bytes:c,rate:l||void 0,estimated:l&&s?(s-r)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})})(...n)};return[(...e)=>{const t=Date.now(),n=t-c;n>=l?p(e,t):(s=e,r||(r=setTimeout(()=>{r=null,p(s)},l-n)))},()=>s&&p(s)]}(0,n)},Cs=(e,t)=>{const n=null!=e;return[o=>t[0]({lengthComputable:n,total:e,loaded:o}),t[1]]},Ns=(e,t=Ht.asap)=>(...n)=>t(()=>e(...n)),Is=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Ps=(e,t,n)=>t+2<n&&Is(e.charCodeAt(t+1))&&Is(e.charCodeAt(t+2)),Us=e=>e<=57?e-48:(223&e)-55,Ls=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,zs=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},Fs=e=>{const t=e.length;let n=0,o=0,i=!1;for(let s=0;s<t;s++){let r=e.charCodeAt(s);37===r&&Ps(e,s,t)&&(r=16*Us(e.charCodeAt(s+1))+Us(e.charCodeAt(s+2)),s+=2),9!==(a=r)&&10!==a&&12!==a&&13!==a&&32!==a&&(61!==r?!Ls(r)||o>0?i=!0:n++:o++)}var a;return i||o>2||o>0&&(n+o)%4!=0||n%4==1?zs(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Ds=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const o=e.slice(5,n),i=e.slice(n+1);if(/;base64/i.test(o))return t(i);let a=0;for(let e=0,t=i.length;e<t;e++){const n=i.charCodeAt(e);if(37===n&&Ps(i,e,t))a+=1,e+=2;else if(n<128)a+=1;else if(n<2048)a+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=i.charCodeAt(e+1);t>=56320&&t<=57343?(a+=4,e++):a+=3}else a+=3}return a},qs={flush:ye.constants.Z_SYNC_FLUSH,finishFlush:ye.constants.Z_SYNC_FLUSH},Bs={flush:ye.constants.BROTLI_OPERATION_FLUSH,finishFlush:ye.constants.BROTLI_OPERATION_FLUSH},Ms={flush:ye.constants.ZSTD_e_flush,finishFlush:ye.constants.ZSTD_e_flush},Ws=Ht.isFunction(ye.createBrotliDecompress),Gs=Ht.isFunction(ye.createZstdDecompress),Hs="gzip, compress, deflate"+(Ws?", br":""),Js=Hs+(Gs?", zstd":""),Vs="undefined"!=typeof process&&process.nextTick?process.nextTick.bind(process):Ht.asap,{http:Ks,https:Ys}=as,Zs=/https:?/,Xs=Symbol("axios.http.socketListener"),Qs=Symbol("axios.http.currentReq"),er=Symbol("axios.http.installedTunnel"),tr=new Map,nr=new WeakMap,or={22:21,24:5},ir=Ei.protocols.map(e=>e+":"),ar=e=>{if(!Ht.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},sr=(e,[t,n])=>(e.on("end",n).on("error",n),t),rr=new class{constructor(){this.sessions=Object.create(null)}getSession(e,t){t=Object.assign({sessionTimeout:1e3},t);let n=this.sessions[e];if(n){let e=n.length;for(let o=0;o<e;o++){const[e,i]=n[o];if(!e.destroyed&&!e.closed&&ne.isDeepStrictEqual(i,t))return e}}const o=be.connect(e,t);let i,a;const s=()=>{if(i)return;i=!0,a&&(clearTimeout(a),a=null);let t=n,s=t.length,r=s;for(;r--;)if(t[r][0]===o)return 1===s?delete this.sessions[e]:t.splice(r,1),void(o.closed||o.close())},r=o.request,{sessionTimeout:c}=t;if(null!=c){let e=0;o.request=function(){const t=r.apply(this,arguments);return e++,a&&(clearTimeout(a),a=null),t.once("close",()=>{--e||(a=setTimeout(()=>{a=null,s()},c))}),t}}o.once("close",s);let l=[o,t];return n?n.push(l):n=this.sessions[e]=[l],o}};function cr(e,t,n){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.auth&&e.beforeRedirects.auth(e),e.beforeRedirects.sensitiveHeaders&&e.beforeRedirects.sensitiveHeaders(e,n),e.beforeRedirects.config&&e.beforeRedirects.config(e,t,n)}function lr(e,t,n,o,i,a){let s=t;const r=function(e,t,n){return Zs.test(e.protocol)?n||se.globalAgent:t||ae.globalAgent}(e,a,i);if(!s&&!1!==s&&!function(e,t=process.versions&&process.versions.node){if(!function(e=process.versions&&process.versions.node){if(!e)return!1;const[t,n]=e.split(".").map(e=>Number(e));return!(!Number.isInteger(t)||!Number.isInteger(n))&&(t>24||null!=or[t]&&n>=or[t])}(t))return!1;const n=e&&e.options;return Boolean(n&&Ht.hasOwnProp(n,"proxyEnv")&&null!=n.proxyEnv)}(r)){const e=function(e){var t=("string"==typeof e?function(e){try{return new URL(e)}catch{return null}}(e):e)||{},n=t.protocol,o=t.host,i=t.port;if("string"!=typeof o||!o||"string"!=typeof n)return"";if(n=n.split(":",1)[0],!function(e,t){var n=Bi("no_proxy").toLowerCase();return!n||"*"!==n&&n.split(/[,\s]/).every(function(n){if(!n)return!0;var o=n.match(/^(.+):(\d+)$/),i=o?o[1]:n,a=o?parseInt(o[2]):0;return!(!a||a===t)||(/^[.*]/.test(i)?("*"===i.charAt(0)&&(i=i.slice(1)),!e.endsWith(i)):e!==i)})}(o=o.replace(/:\d*$/,""),i=parseInt(i)||qi[n]||0))return"";var a=Bi(n+"_proxy")||Bi("all_proxy");return a&&-1===a.indexOf("://")&&(a=n+"://"+a),a}(n);e&&(function(e){let t;try{t=new URL(e)}catch(e){return!1}const n=(process.env.no_proxy||process.env.NO_PROXY||"").toLowerCase();if(!n)return!1;if("*"===n)return!0;const o=Number.parseInt(t.port,10)||Ts[t.protocol.split(":",1)[0]]||0,i=Rs(t.hostname.toLowerCase());return n.split(/[\s,]+/).some(e=>{if(!e)return!1;if("*"===e)return!0;let[t,n]=(e=>{let t=e,n=0;if("["===t.charAt(0)){const e=t.indexOf("]");if(-1!==e){const o=t.slice(1,e),i=t.slice(e+1);return":"===i.charAt(0)&&/^\d+$/.test(i.slice(1))&&(n=Number.parseInt(i.slice(1),10)),[o,n]}}const o=t.indexOf(":"),i=t.lastIndexOf(":");return-1!==o&&o===i&&/^\d+$/.test(t.slice(i+1))&&(n=Number.parseInt(t.slice(i+1),10),t=t.slice(0,i)),[t,n]})(e);return t=Rs(t),!!t&&(!n||n===o)&&("*"===t.charAt(0)&&(t=t.slice(1)),"."===t.charAt(0)?i.endsWith(t):i===t||Es(i)&&Es(t))})}(n)||(s=new URL(e)))}if(o&&e.headers)for(const t of Object.keys(e.headers))"proxy-authorization"===t.toLowerCase()&&delete e.headers[t];if(o&&e.agent&&e.agent[er]&&(e.agent=void 0),s){const t=s instanceof URL,o=e=>t||Ht.hasOwnProp(s,e)?s[e]:void 0,a=o("username"),r=o("password");let c=Ht.hasOwnProp(s,"auth")?s.auth:void 0;if(a&&(c=(a||"")+":"+(r||"")),c){const e="object"==typeof c,t=e&&Ht.hasOwnProp(c,"username")?c.username:void 0,n=e&&Ht.hasOwnProp(c,"password")?c.password:void 0;if(Boolean(t||n))c=(t||"")+":"+(n||"");else if(e)throw new ln("Invalid proxy authorization",ln.ERR_BAD_OPTION,{proxy:s})}if(Zs.test(e.protocol)){if(!(i instanceof Ca)){const t=o("hostname")||o("host"),n=o("port"),a=o("protocol"),s=a?a.includes(":")?a:`${a}:`:"http:",r=t&&t.includes(":")&&!t.startsWith("[")?`[${t}]`:t,l=new URL(`${s}//${r}${n?":"+n:""}`),p={protocol:l.protocol,hostname:l.hostname.replace(/^\[|\]$/g,""),port:l.port,auth:c&&"string"==typeof c?c:void 0};"https:"===l.protocol&&(p.ALPNProtocols=["http/1.1"]);const u=function(e,t){const n=e.protocol+"//"+e.hostname+":"+(e.port||"")+"#"+(e.auth||""),o=t?nr.get(t)||nr.set(t,new Map).get(t):tr;let i=o.get(n);if(i)return i;const a=t&&t.options?{...t.options,...e}:e;if(i=new Ca(a),t&&t.options){const e={...t.options},n=i.callback;i.callback=function(t,o){return n.call(this,t,{...e,...o})}}return i[er]=!0,o.set(n,i),i}(p,i);e.agent=u,e.agents&&(e.agents.https=u)}}else{if(c){const t=Buffer.from(c,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}let t=!1;for(const n of Object.keys(e.headers))if("host"===n.toLowerCase()){t=!0;break}t||(e.headers.host=e.hostname+(e.port?":"+e.port:""));const i=o("hostname")||o("host");e.hostname=i,e.host=i,e.port=o("port"),e.path=n;const a=o("protocol");a&&(e.protocol=a.includes(":")?a:`${a}:`)}}e.beforeRedirects.proxy=function(e){lr(e,t,e.href,!0,i,a)}}const pr="undefined"!=typeof process&&"process"===Ht.kindOf(process),ur=(e,t)=>(({address:e,family:t})=>{if(!Ht.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}})(Ht.isObject(e)?e:{address:e,family:t}),dr={request(e,t){const n=e.protocol+"//"+e.hostname+":"+(e.port||("https:"===e.protocol?443:80)),{http2Options:o,headers:i}=e,a=rr.getSession(n,o),{HTTP2_HEADER_SCHEME:s,HTTP2_HEADER_METHOD:r,HTTP2_HEADER_PATH:c,HTTP2_HEADER_STATUS:l}=be.constants,p={[s]:e.protocol.replace(":",""),[r]:e.method,[c]:e.path};Ht.forEach(i,(e,t)=>{":"!==t.charAt(0)&&(p[t]=e)});const u=a.request(p);return u.once("response",e=>{const n=u,o=(e=Object.assign({},e))[l];delete e[l],n.headers=e,n.statusCode=+o,t(n)}),u}};var mr,fr,hr=pr&&function(e){return t=async function(t,n,o){const i=t=>Ht.getSafeProp(e,t),a=i("transitional")||vi;let s=i("data"),r=i("lookup"),c=i("family"),l=i("httpVersion");void 0===l&&(l=1);let p=i("http2Options");const u=i("httpAgent"),d=i("httpsAgent"),m=i("proxy"),f=i("responseType"),h=i("responseEncoding"),g=i("socketPath"),v=i("method").toUpperCase(),x=i("maxRedirects"),b=i("maxBodyLength"),w=i("maxContentLength"),_=i("decompress");let k,S,j,E=!1;if(l=+l,Number.isNaN(l))throw TypeError(`Invalid protocol version: '${e.httpVersion}' is not a number`);if(1!==l&&2!==l)throw TypeError(`Unsupported protocol version '${l}'`);const T=2===l;if(r){const e=ws(r,e=>Ht.isArray(e)?e:[e]);r=(t,n,o)=>{e(t,n,(e,t,i)=>{if(e)return o(e);const a=Ht.isArray(t)?t.map(e=>ur(e)):[ur(t,i)];n.all?o(e,a):o(e,a[0].address,a[0].family)})}}const $=new xe;function O(t){try{$.emit("abort",!t||t.type?new Pi(null,e,S):t)}catch(e){}}function R(){j&&(clearTimeout(j),j=null)}$.once("abort",n);const A=()=>{R(),e.cancelToken&&e.cancelToken.unsubscribe(O),e.signal&&e.signal.removeEventListener("abort",O),$.removeAllListeners()};(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(O),e.signal&&(e.signal.aborted?O():e.signal.addEventListener("abort",O))),o((e,t)=>{if(k=!0,R(),t)return E=!0,void A();const{data:n}=e;if(n instanceof oe.Readable||n instanceof oe.Duplex){const e=oe.finished(n,()=>{e(),A()})}else A()});const C=Di(i("baseURL"),i("url"),i("allowAbsoluteUrls"),e),N=new URL(C,g?"http://localhost":Ei.hasBrowserEnv?Ei.origin:void 0),I=N.protocol||ir[0];if("data:"===I){if(w>-1){const t=function(e){return Ds(e,zs)}(String(i("url")||C||""));if(t>w)return n(new ln("maxContentLength size of "+w+" exceeded",ln.ERR_BAD_RESPONSE,e))}let o;if("GET"!==v)return Ui(t,n,{status:405,statusText:"method not allowed",headers:{},config:e});try{o=function(e,t,n){const o=n&&n.Blob||Ei.classes.Blob,i=rs(e);if(void 0===t&&o&&(t=!0),"data"===i){e=i.length?e.slice(i.length+1):e;const n=cs.exec(e);if(!n)throw new ln("Invalid URL",ln.ERR_INVALID_URL);const a=n[1],s=n[2],r=n[3]?"base64":"utf8",c=n[4];let l="";a?l=s?a+s:a:s&&(l="text/plain"+s);const p="base64"===r?Buffer.from(c,"base64"):Buffer.from(decodeURIComponent(c),r);if(t){if(!o)throw new ln("Blob is not supported",ln.ERR_NOT_SUPPORT);return new o([p],{type:l})}return p}throw new ln("Unsupported protocol "+i,ln.ERR_NOT_SUPPORT)}(i("url"),"blob"===f,{Blob:e.env&&e.env.Blob})}catch(t){throw ln.from(t,ln.ERR_BAD_REQUEST,e)}return"text"===f?(o=o.toString(h),h&&"utf8"!==h||(o=Ht.stripBOM(o))):"stream"===f&&(o=oe.Readable.from(o)),Ui(t,n,{data:o,status:200,statusText:"OK",headers:new sn,config:e})}if(-1===ir.indexOf(I))return n(new ln("Unsupported protocol "+I,ln.ERR_BAD_REQUEST,e));const P=sn.from(e.headers).normalize();P.set("User-Agent","axios/"+ss,!1);const{onUploadProgress:U,onDownloadProgress:L}=e,z=e.maxRate;let F,D;if(Ht.isSpecCompliantForm(s)){const e=P.getContentType(/boundary=([-_\w\d]{10,70})/i);s=((e,t,n)=>{const{tag:o="form-data-boundary",size:i=25,boundary:a=o+"-"+Ei.generateString(i,hs)}=n||{};if(!Ht.isFormData(e))throw new TypeError("FormData instance required");if(a.length<1||a.length>70)throw new Error("boundary must be 1-70 characters long");const s=gs.encode("--"+a+vs),r=gs.encode("--"+a+"--"+vs);let c=r.byteLength;const l=Array.from(e.entries()).map(([e,t])=>{const n=new bs(e,t);return c+=n.size,n});c+=s.byteLength*l.length,c=Ht.toFiniteNumber(c);const p={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(c)&&(p["Content-Length"]=c),t&&t(p),ie.from(async function*(){for(const e of l)yield s,yield*e.encode();yield r}())})(s,e=>{P.set(e)},{tag:`axios-${ss}-boundary`,boundary:e&&e[1]||void 0})}else if(Ht.isFormData(s)&&Ht.isFunction(s.getHeaders)&&s.getHeaders!==Object.prototype.getHeaders){if(ps(P,s.getHeaders(),i("formDataHeaderPolicy")),!P.hasContentLength())try{const e=await ne.promisify(s.getLength).call(s);Number.isFinite(e)&&e>=0&&P.setContentLength(e)}catch(e){}}else if(Ht.isBlob(s)||Ht.isFile(s))s.size&&P.setContentType(s.type||"application/octet-stream"),P.setContentLength(s.size||0),s=oe.Readable.from(fs(s));else if(s&&!Ht.isStream(s)){if(Buffer.isBuffer(s));else if(Ht.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else{if(!Ht.isString(s))return n(new ln("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",ln.ERR_BAD_REQUEST,e));s=Buffer.from(s,"utf-8")}if(P.setContentLength(s.length,!1),b>-1&&s.length>b)return n(new ln("Request body larger than maxBodyLength limit",ln.ERR_BAD_REQUEST,e))}const q=Ht.toFiniteNumber(P.getContentLength());let B;Ht.isArray(z)?(F=z[0],D=z[1]):F=D=z,s&&(U||F)&&(Ht.isStream(s)||(s=oe.Readable.from(s,{objectMode:!1})),s=oe.pipeline([s,new ds({maxRate:Ht.toFiniteNumber(F)})],Ht.noop),U&&s.on("progress",sr(s,Cs(q,As(Ns(U,Vs),!1,3)))));const M=i("auth");let W;M&&(B=(Ht.getSafeProp(M,"username")||"")+":"+(Ht.getSafeProp(M,"password")||"")),B||!N.username&&!N.password||(B=ar(N.username)+":"+ar(N.password)),B&&P.delete("authorization");try{W=hi(N.pathname+N.search,i("params"),i("paramsSerializer")).replace(/^\?/,"")}catch(t){return n(ln.from(t,ln.ERR_BAD_REQUEST,e,null,null,{url:i("url"),exists:!0}))}P.set("Accept-Encoding",Ht.hasOwnProp(a,"advertiseZstdAcceptEncoding")&&!0===a.advertiseZstdAcceptEncoding?Js:Hs,!1);const G=Object.assign(Object.create(null),{path:W,method:v,headers:Zt(P),agents:{http:u,https:d},auth:B,protocol:I,family:c,beforeRedirect:cr,beforeRedirects:Object.create(null),http2Options:p});if(!Ht.isUndefined(r)&&(G.lookup=r),g){if("string"!=typeof g)return n(new ln("socketPath must be a string",ln.ERR_BAD_OPTION_VALUE,e));const t=i("allowedSocketPaths");if(null!=t){const o=Array.isArray(t)?t:[t],i=y(g);if(!o.some(e=>"string"==typeof e&&y(e)===i))return n(new ln(`socketPath "${g}" is not permitted by allowedSocketPaths`,ln.ERR_BAD_OPTION_VALUE,e))}G.socketPath=g}else G.hostname=N.hostname.startsWith("[")?N.hostname.slice(1,-1):N.hostname,G.port=N.port,lr(G,m,I+"//"+N.hostname+(N.port?":"+N.port:"")+G.path,!1,d,u);let H,J=!1,V=!1;const K=Zs.test(G.protocol);if(null==G.agent&&(G.agent=K?d:u),T)H=dr;else{const t=i("transport");if(t)H=t;else if(0===x)H=K?se:ae,J=!0;else{V=!0,G.sensitiveHeaders=[],x&&(G.maxRedirects=x);const t=i("beforeRedirect");if(t&&(G.beforeRedirects.config=t),B){const e=N.origin,t=B;G.beforeRedirects.auth=function(n){try{new URL(n.href).origin===e&&(n.auth=t)}catch(e){}}}const o=i("sensitiveHeaders");if(null!=o){if(!Ht.isArray(o))return n(new ln("sensitiveHeaders must be an array of strings",ln.ERR_BAD_OPTION_VALUE,e));const t=new Set;for(const i of o){if(!Ht.isString(i))return n(new ln("sensitiveHeaders must be an array of strings",ln.ERR_BAD_OPTION_VALUE,e));t.add(i.toLowerCase())}t.size&&(G.sensitiveHeaders=Array.from(t),G.beforeRedirects.sensitiveHeaders=function(e,n){(function(e,t){if(!t)return!1;try{return new URL(t.url).origin===new URL(e.href).origin}catch(e){return!1}})(e,n)||function(e,t){e&&Object.keys(e).forEach(n=>{t.has(n.toLowerCase())&&delete e[n]})}(e.headers,t)})}H=K?Ys:Ks}}G.maxBodyLength=b>-1?b:Infinity,G.insecureHTTPParser=Boolean(i("insecureHTTPParser")),S=H.request(G,function(o){if(R(),S.destroyed)return;const i=[o],a=Ht.toFiniteNumber(o.headers["content-length"]);if(L||D){const e=new ds({maxRate:Ht.toFiniteNumber(D)});L&&e.on("progress",sr(e,Cs(a,As(Ns(L,Vs),!0,3)))),i.push(e)}let s=o;const r=o.req||S;if(!1!==_&&o.headers["content-encoding"])switch("HEAD"!==v&&204!==o.statusCode||delete o.headers["content-encoding"],(o.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":i.push(ye.createUnzip(qs)),delete o.headers["content-encoding"];break;case"deflate":i.push(new ys),i.push(ye.createUnzip(qs)),delete o.headers["content-encoding"];break;case"br":Ws&&(i.push(ye.createBrotliDecompress(Bs)),delete o.headers["content-encoding"]);break;case"zstd":Gs&&(i.push(ye.createZstdDecompress(Ms)),delete o.headers["content-encoding"])}s=i.length>1?oe.pipeline(i,Ht.noop):i[0];const c={status:o.statusCode,statusText:o.statusMessage,headers:new sn(o.headers),config:e,request:r};if("stream"===f){if(w>-1){const t=w,n=s;s=oe.Readable.from(async function*(){let o=0;for await(const i of n){if(o+=i.length,o>t)throw new ln("maxContentLength size of "+t+" exceeded",ln.ERR_BAD_RESPONSE,e,r);yield i}}(),{objectMode:!1})}c.data=s,Ui(t,n,c)}else{const o=[];let i=0;s.on("data",function(t){o.push(t),i+=t.length,w>-1&&i>w&&(E=!0,s.destroy(),O(new ln("maxContentLength size of "+w+" exceeded",ln.ERR_BAD_RESPONSE,e,r)))}),s.on("aborted",function(){if(E)return;const t=new ln("stream has been aborted",ln.ERR_BAD_RESPONSE,e,r,c);s.destroy(t),n(t)}),s.on("error",function(t){E||n(ln.from(t,null,e,r,c))}),s.on("end",function(){try{let e=1===o.length?o[0]:Buffer.concat(o);"arraybuffer"!==f&&(e=e.toString(h),h&&"utf8"!==h||(e=Ht.stripBOM(e))),c.data=e}catch(t){return n(ln.from(t,null,e,c.request,c))}Ui(t,n,c)})}$.once("abort",e=>{s.destroyed||(s.emit("error",e),s.destroy())})}),$.once("abort",e=>{S.close?S.close():S.destroy(e)}),S.on("error",function(t){n(ln.from(t,null,e,S))});const Y=new Set;if(S.on("socket",function(e){"function"==typeof e.setKeepAlive&&e.setKeepAlive(!0,6e4),e[Xs]||(e.on("error",function(t){const n=e[Qs];n&&!n.destroyed&&n.destroy(t)}),e[Xs]=!0),e[Qs]=S,Y.add(e)}),S.once("close",function(){R();for(const e of Y)e[Qs]===S&&(e[Qs]=null);Y.clear()}),i("timeout")){const t=parseInt(i("timeout"),10);if(Number.isNaN(t))return void O(new ln("error trying to parse `config.timeout` to int",ln.ERR_BAD_OPTION_VALUE,e,S));const n=function(){k||O(function(){const t=i("timeout");let n=t?"timeout of "+t+"ms exceeded":"timeout exceeded";const o=i("timeoutErrorMessage");return o&&(n=o),new ln(n,a.clarifyTimeoutError?ln.ETIMEDOUT:ln.ECONNABORTED,e,S)}())};J&&t>0&&(j=setTimeout(n,t)),S.setTimeout(t,n)}else S.setTimeout(0);if(Ht.isStream(s)){let t=!1,n=!1;s.on("end",()=>{t=!0}),s.once("error",e=>{n=!0,S.destroy(e)}),s.on("close",()=>{t||n||O(new Pi("Request stream has been aborted",e,S))});let o=s;if(b>-1&&!V){const t=b;let n=0;o=oe.pipeline([s,new oe.Transform({transform(o,i,a){if(n+=o.length,n>t)return a(new ln("Request body larger than maxBodyLength limit",ln.ERR_BAD_REQUEST,e,S));a(null,o)}})],Ht.noop),o.on("error",e=>{S.destroyed||S.destroy(e)})}o.pipe(S)}else s&&S.write(s),S.end()},new Promise((e,n)=>{let o,i;const a=(e,t)=>{i||(i=!0,o&&o(e,t))},s=e=>{a(e,!0),n(e)};t(t=>{a(t),e(t)},s,e=>o=e).catch(s)});var t},gr=Ei.hasStandardBrowserEnv?(mr=new URL(Ei.origin),fr=Ei.navigator&&/(msie|trident)/i.test(Ei.navigator.userAgent),e=>(e=new URL(e,Ei.origin),mr.protocol===e.protocol&&mr.host===e.host&&(fr||mr.port===e.port))):()=>!0,vr=Ei.hasStandardBrowserEnv?{write(e,t,n,o,i,a,s){if("undefined"==typeof document)return;const r=[`${e}=${encodeURIComponent(t)}`];Ht.isNumber(n)&&r.push(`expires=${new Date(n).toUTCString()}`),Ht.isString(o)&&r.push(`path=${o}`),Ht.isString(i)&&r.push(`domain=${i}`),!0===a&&r.push("secure"),Ht.isString(s)&&r.push(`SameSite=${s}`),document.cookie=r.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const o=t[n].replace(/^\s+/,""),i=o.indexOf("=");if(-1!==i&&o.slice(0,i)===e)try{return decodeURIComponent(o.slice(i+1))}catch(e){return o.slice(i+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const xr=e=>e instanceof sn?{...e}:e,br=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)):Object.keys(e);function yr(e,t){e=e||{},t=t||{};const n=Object.create(null);function o(e,t,n,o){return Ht.isPlainObject(e)&&Ht.isPlainObject(t)?Ht.merge.call({caseless:o},e,t):Ht.isPlainObject(t)?Ht.merge({},t):Ht.isArray(t)?t.slice():t}function i(e,t,n,i){return Ht.isUndefined(t)?Ht.isUndefined(e)?void 0:o(void 0,e,0,i):o(e,t,0,i)}function a(e,t){if(!Ht.isUndefined(t))return o(void 0,t)}function s(e,t){return Ht.isUndefined(t)?Ht.isUndefined(e)?void 0:o(void 0,e):o(void 0,t)}function r(n,i,a){return Ht.hasOwnProp(t,a)?o(n,i):Ht.hasOwnProp(e,a)?o(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:r,headers:(e,t,n)=>i(xr(e),xr(t),0,!0)};return Ht.forEach(br({...e,...t}),function(o){if("__proto__"===o||"constructor"===o||"prototype"===o)return;const a=Ht.hasOwnProp(c,o)?c[o]:i,s=a(Ht.hasOwnProp(e,o)?e[o]:void 0,Ht.hasOwnProp(t,o)?t[o]:void 0,o);Ht.isUndefined(s)&&a!==r||(n[o]=s)}),Ht.hasOwnProp(t,"validateStatus")&&Ht.isUndefined(t.validateStatus)&&!1===function(n){const o=Ht.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!Ht.isUndefined(o)){if(!Ht.isPlainObject(o))return;if(Ht.hasOwnProp(o,n))return o[n]}const i=Ht.hasOwnProp(e,"transitional")?e.transitional:void 0;if(Ht.isPlainObject(i)&&Ht.hasOwnProp(i,n))return i[n]}("validateStatusUndefinedResolves")&&(Ht.hasOwnProp(e,"validateStatus")?n.validateStatus=o(void 0,e.validateStatus):delete n.validateStatus),n}function wr(e){const t=yr({},e),n=e=>Ht.hasOwnProp(t,e)?t[e]:void 0,o=n("data");let i=n("withXSRFToken");const a=n("xsrfHeaderName"),s=n("xsrfCookieName");let r=n("headers");const c=n("auth"),l=n("baseURL"),p=n("allowAbsoluteUrls"),u=n("url");if(t.headers=r=sn.from(r),t.url=hi(Di(l,u,p,t),n("params"),n("paramsSerializer")),c){const t=Ht.getSafeProp(c,"username")||"",n=Ht.getSafeProp(c,"password")||"";try{r.set("Authorization","Basic "+btoa(t+":"+(n?(e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))(n):"")))}catch(t){throw ln.from(t,ln.ERR_BAD_OPTION_VALUE,e)}}if(Ht.isFormData(o)&&(Ei.hasStandardBrowserEnv||Ei.hasStandardBrowserWebWorkerEnv||Ht.isReactNative(o)?r.setContentType(void 0):Ht.isFunction(o.getHeaders)&&ps(r,o.getHeaders(),n("formDataHeaderPolicy"))),Ei.hasStandardBrowserEnv&&(Ht.isFunction(i)&&(i=i(t)),!0===i||null==i&&gr(t.url))){const e=a&&s&&vr.read(s);e&&r.set(a,e)}return t}var _r="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const o=wr(e);let i=o.data;const a=sn.from(o.headers).normalize();let s,r,c,l,p,{responseType:u,onUploadProgress:d,onDownloadProgress:m}=o;function f(){l&&l(),p&&p(),o.cancelToken&&o.cancelToken.unsubscribe(s),o.signal&&o.signal.removeEventListener("abort",s)}let h=new XMLHttpRequest;function g(){if(!h)return;const o=sn.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Ui(function(e){t(e),f()},function(e){n(e),f()},{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:o,config:e,request:h}),h=null}h.open(o.method.toUpperCase(),o.url,!0),h.timeout=o.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&h.responseURL.startsWith("file:"))&&setTimeout(g)},h.onabort=function(){h&&(n(new ln("Request aborted",ln.ECONNABORTED,e,h)),f(),h=null)},h.onerror=function(t){const o=new ln(t&&t.message?t.message:"Network Error",ln.ERR_NETWORK,e,h);o.event=t||null,n(o),f(),h=null},h.ontimeout=function(){let t=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";o.timeoutErrorMessage&&(t=o.timeoutErrorMessage),n(new ln(t,(o.transitional||vi).clarifyTimeoutError?ln.ETIMEDOUT:ln.ECONNABORTED,e,h)),f(),h=null},void 0===i&&a.setContentType(null),"setRequestHeader"in h&&Ht.forEach(Zt(a),function(e,t){h.setRequestHeader(t,e)}),Ht.isUndefined(o.withCredentials)||(h.withCredentials=!!o.withCredentials),u&&"json"!==u&&(h.responseType=o.responseType),m&&([c,p]=As(m,!0),h.addEventListener("progress",c)),d&&h.upload&&([r,l]=As(d),h.upload.addEventListener("progress",r),h.upload.addEventListener("loadend",l)),(o.cancelToken||o.signal)&&(s=t=>{h&&(n(!t||t.type?new Pi(null,e,h):t),h.abort(),f(),h=null)},o.cancelToken&&o.cancelToken.subscribe(s),o.signal&&(o.signal.aborted?s():o.signal.addEventListener("abort",s)));const v=rs(o.url);if(v&&!Ei.protocols.includes(v))return n(new ln("Unsupported protocol "+v+":",ln.ERR_BAD_REQUEST,e)),void f();h.send(i||null)})},kr=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let o=!1;const i=function(e){if(!o){o=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ln?t:new Pi(t instanceof Error?t.message:t))}};let a=t&&setTimeout(()=>{a=null,i(new ln(`timeout of ${t}ms exceeded`,ln.ETIMEDOUT))},t);const s=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>{o||(e.aborted?i.call(e):e.addEventListener("abort",i,{once:!0}))});const{signal:r}=n;return r.unsubscribe=()=>Ht.asap(s),r};const Sr=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let o,i=0;for(;i<n;)o=i+t,yield e.slice(i,o),i=o},jr=(e,t,n,o)=>{const i=async function*(e,t){for await(const n of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}}(e))yield*Sr(n,t)}(e,t);let a,s=0,r=e=>{a||(a=!0,o&&o(e))};return new ReadableStream({async pull(e){try{const{done:t,value:o}=await i.next();if(t)return r(),void e.close();if(n){let e=s+=o.byteLength;n(e)}e.enqueue(new Uint8Array(o))}catch(e){throw r(e),e}},cancel:e=>(r(e),i.return())},{highWaterMark:2})},{isFunction:Er}=Ht,Tr=e=>{if(!Ht.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},$r=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Or=e=>{const t=null!=Ht.global?Ht.global:globalThis,{ReadableStream:n,TextEncoder:o}=t;e=Ht.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:i,Request:a,Response:s}=e,r=i?Er(i):"function"==typeof fetch,c=Er(a),l=Er(s);if(!r)return!1;const p=r&&Er(n),u=r&&("function"==typeof o?(d=new o,e=>d.encode(e)):async e=>new Uint8Array(await new a(e).arrayBuffer()));var d;const m=c&&p&&$r(()=>{let e=!1;const t=new a(Ei.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),o=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!o}),f=l&&p&&$r(()=>Ht.isReadableStream(new s("").body)),h={stream:f&&(e=>e.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,n)=>{let o=t&&t[e];if(o)return o.call(t);throw new ln(`Response type '${e}' is not supported`,ln.ERR_NOT_SUPPORT,n)})});const g=async e=>{if(null==e)return 0;if(Ht.isBlob(e))return e.size;if(Ht.isSpecCompliantForm(e)){const t=new a(Ei.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Ht.isArrayBufferView(e)||Ht.isArrayBuffer(e)?e.byteLength:(Ht.isURLSearchParams(e)&&(e+=""),Ht.isString(e)?(await u(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:r,signal:l,cancelToken:u,timeout:d,onDownloadProgress:v,onUploadProgress:x,responseType:b,headers:y,withCredentials:w="same-origin",fetchOptions:_,maxContentLength:k,maxBodyLength:S}=wr(e);const j=Ht.isNumber(k)&&k>-1,E=Ht.isNumber(S)&&S>-1;let T=i||fetch;b=b?(b+"").toLowerCase():"text";let $=kr([l,u&&u.toAbortSignal()],d),O=null;const R=$&&$.unsubscribe&&(()=>{$.unsubscribe()});let A,C=null;const N=()=>new ln("Request body larger than maxBodyLength limit",ln.ERR_BAD_REQUEST,e,O);try{let i;const l=Ht.hasOwnProp(e,"auth")?e.auth:void 0;if(l&&(i={username:Ht.getSafeProp(l,"username")||"",password:Ht.getSafeProp(l,"password")||""}),(e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,Ei.origin);i||!e.username&&!e.password||(i={username:Tr(e.username),password:Tr(e.password)}),(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(i&&(y.delete("authorization"),y.set("Authorization","Basic "+btoa((e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))((i.username||"")+":"+(i.password||""))))),j&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Ds(-1===t?e:e.slice(0,t),Fs)}(t);if(n>k)throw new ln("maxContentLength size of "+k+" exceeded",ln.ERR_BAD_RESPONSE,e,O)}if(E&&"get"!==n&&"head"!==n){const e=await g(r);if("number"==typeof e&&isFinite(e)&&(A=e,e>S))throw N()}const u=E&&(Ht.isReadableStream(r)||Ht.isStream(r)),d=(e,t,n)=>jr(e,65536,e=>{if(E&&e>S)throw C=N();t&&t(e)},n);if(m&&"get"!==n&&"head"!==n&&(x||u)){if(A=null==A?await(async(e,t)=>{const n=Ht.toFiniteNumber(e.getContentLength());return null==n?g(t):n})(y,r):A,0!==A||u){let e,n=new a(t,{method:"POST",body:r,duplex:"half"});if(Ht.isFormData(r)&&(e=n.headers.get("content-type"))&&y.setContentType(e),n.body){const[e,t]=x&&Cs(A,As(Ns(x)))||[];r=d(n.body,e,t)}}}else if(u&&!c&&p&&"get"!==n&&"head"!==n)r=d(r);else if(u&&c&&!m&&"get"!==n&&"head"!==n)throw new ln("Stream request bodies are not supported by the current fetch implementation",ln.ERR_NOT_SUPPORT,e,O);Ht.isString(w)||(w=w?"include":"omit");const I=c&&"credentials"in a.prototype;if(Ht.isFormData(r)){const e=y.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&y.delete("content-type")}y.set("User-Agent","axios/"+ss,!1);const P={..._,signal:$,method:n.toUpperCase(),headers:Zt(y.normalize()),body:r,duplex:"half",credentials:I?w:void 0};O=c&&new a(t,P);let U=await(c?T(O,_):T(t,P));const L=sn.from(U.headers);if(j){const t=Ht.toFiniteNumber(L.getContentLength());if(null!=t&&t>k)throw new ln("maxContentLength size of "+k+" exceeded",ln.ERR_BAD_RESPONSE,e,O)}const z=f&&("stream"===b||"response"===b);if(f&&U.body&&(v||j||z&&R)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=U[e]});const n=Ht.toFiniteNumber(L.getContentLength()),[o,i]=v&&Cs(n,As(Ns(v),!0))||[];let a=0;U=new s(jr(U.body,65536,t=>{if(j&&(a=t,a>k))throw new ln("maxContentLength size of "+k+" exceeded",ln.ERR_BAD_RESPONSE,e,O);o&&o(t)},()=>{i&&i(),R&&R()}),t)}b=b||"text";let F=await h[Ht.findKey(h,b)||"text"](U,e);if(j&&!f&&!z){let t;if(null!=F&&("number"==typeof F.byteLength?t=F.byteLength:"number"==typeof F.size?t=F.size:"string"==typeof F&&(t="function"==typeof o?(new o).encode(F).byteLength:F.length)),"number"==typeof t&&t>k)throw new ln("maxContentLength size of "+k+" exceeded",ln.ERR_BAD_RESPONSE,e,O)}return!z&&R&&R(),await new Promise((t,n)=>{Ui(t,n,{data:F,headers:sn.from(U.headers),status:U.status,statusText:U.statusText,config:e,request:O})})}catch(t){if(R&&R(),$&&$.aborted&&$.reason instanceof ln){const n=$.reason;throw n.config=e,O&&(n.request=O),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(C)throw O&&!C.request&&(C.request=O),C;if(t instanceof ln)throw O&&!t.request&&(t.request=O),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new ln("Network Error",ln.ERR_NETWORK,e,O,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw ln.from(t,t&&t.code,e,O,t&&t.response)}}},Rr=new Map,Ar=e=>{let t=e&&e.env||{};const{fetch:n,Request:o,Response:i}=t,a=[o,i,n];let s,r,c=a.length,l=Rr;for(;c--;)s=a[c],r=l.get(s),void 0===r&&l.set(s,r=c?new Map:Or(t)),l=r;return r};Ar();const Cr={http:hr,xhr:_r,fetch:{get:Ar}};Ht.forEach(Cr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Nr=e=>`- ${e}`,Ir=e=>Ht.isFunction(e)||null===e||!1===e;var Pr=function(e,t){e=Ht.isArray(e)?e:[e];const{length:n}=e;let o,i;const a={};for(let s=0;s<n;s++){let n;if(o=e[s],i=o,!Ir(o)&&(i=Cr[(n=String(o)).toLowerCase()],void 0===i))throw new ln(`Unknown adapter '${n}'`);if(i&&(Ht.isFunction(i)||(i=i.get(t))))break;a[n||"#"+s]=i}if(!i){const e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Nr).join("\n"):" "+Nr(e[0]):"as no adapter specified";throw new ln("There is no suitable adapter to dispatch the request "+t,ln.ERR_NOT_SUPPORT)}return i};function Ur(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Pi(null,e)}function Lr(e){return Ur(e),e.headers=sn.from(e.headers),e.data=Ni.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Pr(e.adapter||Ci.adapter,e)(e).then(function(t){Ur(e),e.response=t;try{t.data=Ni.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=sn.from(t.headers),t},function(t){if(!Ii(t)&&(Ur(e),t&&t.response)){e.response=t.response;try{t.response.data=Ni.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=sn.from(t.response.headers)}return Promise.reject(t)})}const zr={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{zr[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Fr={};zr.transitional=function(e,t,n){function o(e,t){return"[Axios v"+ss+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,i,a)=>{if(!1===e)throw new ln(o(i," has been removed"+(t?" in "+t:"")),ln.ERR_DEPRECATED);return t&&!Fr[i]&&(Fr[i]=!0,console.warn(o(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,a)}},zr.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var Dr={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new ln("options must be an object",ln.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let i=o.length;for(;i-- >0;){const a=o[i],s=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(s){const t=e[a],n=void 0===t||s(t,a,e);if(!0!==n)throw new ln("option "+a+" must be "+n,ln.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new ln("Unknown option "+a,ln.ERR_BAD_OPTION)}},validators:zr};const qr=Dr.validators;class Br{constructor(e){this.defaults=e||{},this.interceptors={request:new gi,response:new gi}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),o=-1===t?-1:n.indexOf("\n",t+1),i=-1===o?"":n.slice(o+1);String(e.stack).endsWith(i)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=yr(this.defaults,t);const{transitional:n,paramsSerializer:o,headers:i}=t;void 0!==n&&Dr.assertOptions(n,{silentJSONParsing:qr.transitional(qr.boolean),forcedJSONParsing:qr.transitional(qr.boolean),clarifyTimeoutError:qr.transitional(qr.boolean),legacyInterceptorReqResOrdering:qr.transitional(qr.boolean),advertiseZstdAcceptEncoding:qr.transitional(qr.boolean),validateStatusUndefinedResolves:qr.transitional(qr.boolean)},!1),null!=o&&(Ht.isFunction(o)?t.paramsSerializer={serialize:o}:Dr.assertOptions(o,{encode:qr.function,serialize:qr.function},!0)),void 0!==t.allowAbsoluteUrls||(t.allowAbsoluteUrls=void 0===this.defaults.allowAbsoluteUrls||this.defaults.allowAbsoluteUrls),Dr.assertOptions(t,{baseUrl:qr.spelling("baseURL"),withXsrfToken:qr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&Ht.merge(i.common,i[t.method]);i&&Ht.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete i[e]}),t.headers=sn.concat(a,i);const s=[];let r=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;r=r&&e.synchronous;const n=t.transitional||vi;n&&n.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let p,u=0;if(!r){const e=[Lr.bind(this),void 0];for(e.unshift(...s),e.push(...c),p=e.length,l=Promise.resolve(t);u<p;)l=l.then(e[u++],e[u++]);return l}p=s.length;let d=t;for(;u<p;){const e=s[u++],t=s[u++];try{d=e?e(d):d}catch(e){if(!t){l=Promise.reject(e);break}try{const n=t.call(this,e);Ht.isThenable(n)&&(l=Promise.resolve(n).then(()=>Lr.call(this,d)))}catch(e){l=Promise.reject(e)}break}}if(!l)try{l=Lr.call(this,d)}catch(e){l=Promise.reject(e)}for(u=0,p=c.length;u<p;)l=l.then(c[u++],c[u++]);return l}getUri(e){return hi(Di((e=yr(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}Ht.forEach(["delete","get","head","options"],function(e){Br.prototype[e]=function(t,n){return this.request(yr(n||{},{method:e,url:t,data:n&&Ht.hasOwnProp(n,"data")?n.data:void 0}))}}),Ht.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,o,i){return this.request(yr(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:o}))}}Br.prototype[e]=t(),"query"!==e&&(Br.prototype[e+"Form"]=t(!0))});var Mr=Br;class Wr{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const o=new Promise(e=>{n.subscribe(e),t=e}).then(e);return o.cancel=function(){n.unsubscribe(t)},o},e(function(e,o,i){n.reason||(n.reason=new Pi(e,o,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Wr(function(t){e=t}),cancel:e}}}var Gr=Wr;const Hr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Hr).forEach(([e,t])=>{Hr[t]=e});var Jr=Hr;const Vr=function e(t){const n=new Mr(t),o=Ze(Mr.prototype.request,n);return Ht.extend(o,Mr.prototype,n,{allOwnKeys:!0}),Ht.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(yr(t,n))},o}(Ci);Vr.Axios=Mr,Vr.CanceledError=Pi,Vr.CancelToken=Gr,Vr.isCancel=Ii,Vr.VERSION=ss,Vr.toFormData=pi,Vr.AxiosError=ln,Vr.Cancel=Vr.CanceledError,Vr.all=function(e){return Promise.all(e)},Vr.spread=function(e){return function(t){return e.apply(null,t)}},Vr.isAxiosError=function(e){return Ht.isObject(e)&&!0===e.isAxiosError},Vr.mergeConfig=yr,Vr.AxiosHeaders=sn,Vr.formToJSON=e=>Oi(Ht.isHTMLForm(e)?new FormData(e):e),Vr.getAdapter=Pr,Vr.HttpStatusCode=Jr,Vr.default=Vr;var Kr=Vr;const{CanceledError:Yr}=Kr,Zr=/screenshot(\-\d+?)?\.needle\.(webp|png|jpg|jpeg)/;async function Xr(e,t){const n=t.baseUrl+Ve.jobs.post_update,o={...Ke(t),job_id:e.identifier,status:e.status},i={status_message:e.status_message,error:e.error,progress:e.progress},a=await fetch(n,{...Ye,method:"POST",headers:o,body:JSON.stringify(i)}).catch(e=>(console.error(e),null));return!!a&&a.ok}async function Qr(e,t){const n=t.baseUrl+Ve.jobs.get_status,o={...Ke(t),job_id:e,org:t.org},i=await fetch(n,{...Ye,method:"GET",headers:o}).catch(e=>(t.verbose?console.error("Failed to get job status",e):console.error("Failed to get job status",e.message),null));return i?i.ok?await i.json():(console.error("Failed to get status",i.status,await i.text()),{failed:!0,httpStatus:i.status}):{failed:!0}}function ec(e={}){var t,n;const o=null!=(t=e.maxAuthFailures)?t:2,i=null!=(n=e.maxTransientFailures)?n:10;let a=0,s=0;return{record(e){if(e&&!0!==e.failed)return a=0,s=0,null;const t=null==e?void 0:e.httpStatus;return 401===t||403===t?(a++,a>=o?{abort:!0,reason:`Not authorized to read the job status (HTTP ${t}). Your access token is invalid or expired — run \`needle-cloud login\` or pass a fresh --token.`}:null):(s++,s>=i?{abort:!0,reason:`Could not read the job status after ${s} attempts${t?` (last: HTTP ${t})`:""}. The job may still be running — check it in the Needle Cloud dashboard.`}:null)}}}const tc=6,nc=1e3,oc=15e3,ic=9e4,ac=new Set(["CERT_HAS_EXPIRED","UNABLE_TO_VERIFY_LEAF_SIGNATURE","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","ERR_TLS_CERT_ALTNAME_INVALID"]),sc=new Set([408,429]);function rc(e){var t;if(function(e){const t=null==e?void 0:e.name,n=null==e?void 0:e.code;return"CanceledError"===t||"AbortError"===t||"ERR_CANCELED"===n||"ABORT_ERR"===n}(e))return!1;const n=null==e||null==(t=e.response)?void 0:t.status;if("number"==typeof n&&n>0)return!!sc.has(n)||!(n>=400&&n<500);const o=function(e){var t,n;const o=null!=(t=null==e?void 0:e.code)?t:null==e||null==(n=e.cause)?void 0:n.code;return"string"==typeof o&&o.length?o:null}(e);return!o||!ac.has(o)}function cc(e,t={}){const{baseMs:n=nc,maxMs:o=oc,random:i=Math.random}=t,a=Math.max(1,Math.floor(e)),s=Math.min(o,n*2**(a-1))/2;return Math.max(1,Math.round(s+i()*s))}async function lc(e,t={}){const{maxAttempts:n=tc,budgetMs:o=ic,baseMs:i=nc,maxMs:a=oc,isRetryable:s=rc,sleep:r=pc,now:c=Date.now,random:l=Math.random,onRetry:p}=t,u=c();let d,m=0;for(;m<n;){m++;try{return{ok:!0,value:await e(m),attempts:m}}catch(e){if(d=e,!s(e))return{ok:!1,error:e,attempts:m,reason:"permanent"};if(m>=n)return{ok:!1,error:e,attempts:m,reason:"attempts-exhausted"};const t=cc(m,{baseMs:i,maxMs:a,random:l});if(c()-u+t>=o)return{ok:!1,error:e,attempts:m,reason:"budget-exhausted"};null==p||p({attempt:m,waitMs:t,error:e}),await r(t)}}return{ok:!1,error:d,attempts:m,reason:"attempts-exhausted"}}function pc(e){return new Promise(t=>setTimeout(t,e))}const uc=5242880,dc=1e4,mc=16777216,fc=67108864;var hc=vn(function(e,t){e.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],o=e[1],i=e[2],a=e[3];o=((o+=((i=((i+=((a=((a+=((n=((n+=(o&i|~o&a)+t[0]-680876936|0)<<7|n>>>25)+o|0)&o|~n&i)+t[1]-389564586|0)<<12|a>>>20)+n|0)&n|~a&o)+t[2]+606105819|0)<<17|i>>>15)+a|0)&a|~i&n)+t[3]-1044525330|0)<<22|o>>>10)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o&i|~o&a)+t[4]-176418897|0)<<7|n>>>25)+o|0)&o|~n&i)+t[5]+1200080426|0)<<12|a>>>20)+n|0)&n|~a&o)+t[6]-1473231341|0)<<17|i>>>15)+a|0)&a|~i&n)+t[7]-45705983|0)<<22|o>>>10)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o&i|~o&a)+t[8]+1770035416|0)<<7|n>>>25)+o|0)&o|~n&i)+t[9]-1958414417|0)<<12|a>>>20)+n|0)&n|~a&o)+t[10]-42063|0)<<17|i>>>15)+a|0)&a|~i&n)+t[11]-1990404162|0)<<22|o>>>10)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o&i|~o&a)+t[12]+1804603682|0)<<7|n>>>25)+o|0)&o|~n&i)+t[13]-40341101|0)<<12|a>>>20)+n|0)&n|~a&o)+t[14]-1502002290|0)<<17|i>>>15)+a|0)&a|~i&n)+t[15]+1236535329|0)<<22|o>>>10)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o&a|i&~a)+t[1]-165796510|0)<<5|n>>>27)+o|0)&i|o&~i)+t[6]-1069501632|0)<<9|a>>>23)+n|0)&o|n&~o)+t[11]+643717713|0)<<14|i>>>18)+a|0)&n|a&~n)+t[0]-373897302|0)<<20|o>>>12)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o&a|i&~a)+t[5]-701558691|0)<<5|n>>>27)+o|0)&i|o&~i)+t[10]+38016083|0)<<9|a>>>23)+n|0)&o|n&~o)+t[15]-660478335|0)<<14|i>>>18)+a|0)&n|a&~n)+t[4]-405537848|0)<<20|o>>>12)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o&a|i&~a)+t[9]+568446438|0)<<5|n>>>27)+o|0)&i|o&~i)+t[14]-1019803690|0)<<9|a>>>23)+n|0)&o|n&~o)+t[3]-187363961|0)<<14|i>>>18)+a|0)&n|a&~n)+t[8]+1163531501|0)<<20|o>>>12)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o&a|i&~a)+t[13]-1444681467|0)<<5|n>>>27)+o|0)&i|o&~i)+t[2]-51403784|0)<<9|a>>>23)+n|0)&o|n&~o)+t[7]+1735328473|0)<<14|i>>>18)+a|0)&n|a&~n)+t[12]-1926607734|0)<<20|o>>>12)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o^i^a)+t[5]-378558|0)<<4|n>>>28)+o|0)^o^i)+t[8]-2022574463|0)<<11|a>>>21)+n|0)^n^o)+t[11]+1839030562|0)<<16|i>>>16)+a|0)^a^n)+t[14]-35309556|0)<<23|o>>>9)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o^i^a)+t[1]-1530992060|0)<<4|n>>>28)+o|0)^o^i)+t[4]+1272893353|0)<<11|a>>>21)+n|0)^n^o)+t[7]-155497632|0)<<16|i>>>16)+a|0)^a^n)+t[10]-1094730640|0)<<23|o>>>9)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o^i^a)+t[13]+681279174|0)<<4|n>>>28)+o|0)^o^i)+t[0]-358537222|0)<<11|a>>>21)+n|0)^n^o)+t[3]-722521979|0)<<16|i>>>16)+a|0)^a^n)+t[6]+76029189|0)<<23|o>>>9)+i|0,o=((o+=((i=((i+=((a=((a+=((n=((n+=(o^i^a)+t[9]-640364487|0)<<4|n>>>28)+o|0)^o^i)+t[12]-421815835|0)<<11|a>>>21)+n|0)^n^o)+t[15]+530742520|0)<<16|i>>>16)+a|0)^a^n)+t[2]-995338651|0)<<23|o>>>9)+i|0,o=((o+=((a=((a+=(o^((n=((n+=(i^(o|~a))+t[0]-198630844|0)<<6|n>>>26)+o|0)|~i))+t[7]+1126891415|0)<<10|a>>>22)+n|0)^((i=((i+=(n^(a|~o))+t[14]-1416354905|0)<<15|i>>>17)+a|0)|~n))+t[5]-57434055|0)<<21|o>>>11)+i|0,o=((o+=((a=((a+=(o^((n=((n+=(i^(o|~a))+t[12]+1700485571|0)<<6|n>>>26)+o|0)|~i))+t[3]-1894986606|0)<<10|a>>>22)+n|0)^((i=((i+=(n^(a|~o))+t[10]-1051523|0)<<15|i>>>17)+a|0)|~n))+t[1]-2054922799|0)<<21|o>>>11)+i|0,o=((o+=((a=((a+=(o^((n=((n+=(i^(o|~a))+t[8]+1873313359|0)<<6|n>>>26)+o|0)|~i))+t[15]-30611744|0)<<10|a>>>22)+n|0)^((i=((i+=(n^(a|~o))+t[6]-1560198380|0)<<15|i>>>17)+a|0)|~n))+t[13]+1309151649|0)<<21|o>>>11)+i|0,o=((o+=((a=((a+=(o^((n=((n+=(i^(o|~a))+t[4]-145523070|0)<<6|n>>>26)+o|0)|~i))+t[11]-1120210379|0)<<10|a>>>22)+n|0)^((i=((i+=(n^(a|~o))+t[2]+718787259|0)<<15|i>>>17)+a|0)|~n))+t[9]-343485551|0)<<21|o>>>11)+i|0,e[0]=n+e[0]|0,e[1]=o+e[1]|0,e[2]=i+e[2]|0,e[3]=a+e[3]|0}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function a(e){var t,i,a,s,r,c,l=e.length,p=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=l;t+=64)n(p,o(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<i;t+=1)a[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(p,a),t=0;t<16;t+=1)a[t]=0;return s=(s=8*l).toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(s[2],16),c=parseInt(s[1],16)||0,a[14]=r,a[15]=c,n(p,a),p}function s(e){var n,o="";for(n=0;n<4;n+=1)o+=t[e>>8*n+4&15]+t[e>>8*n&15];return o}function r(e){var t;for(t=0;t<e.length;t+=1)e[t]=s(e[t]);return e.join("")}function c(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e){var t,n=[],o=e.length;for(t=0;t<o-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function p(){this.reset()}return r(a("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function e(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(t,n){var o,i,a,s,r=this.byteLength,c=e(t,r),l=r;return void 0!==n&&(l=e(n,r)),c>l?new ArrayBuffer(0):(o=l-c,i=new ArrayBuffer(o),a=new Uint8Array(i),s=new Uint8Array(this,c,o),a.set(s),i)}}(),p.prototype.append=function(e){return this.appendBinary(c(e)),this},p.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)n(this._hash,o(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},p.prototype.end=function(e){var t,n,o=this._buff,i=o.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)a[t>>2]|=o.charCodeAt(t)<<(t%4<<3);return this._finish(a,i),n=r(this._hash),e&&(n=l(n)),this.reset(),n},p.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},p.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},p.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},p.prototype._finish=function(e,t){var o,i,a,s=t;if(e[s>>2]|=128<<(s%4<<3),s>55)for(n(this._hash,e),s=0;s<16;s+=1)e[s]=0;o=(o=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(o[2],16),a=parseInt(o[1],16)||0,e[14]=i,e[15]=a,n(this._hash,e)},p.hash=function(e,t){return p.hashBinary(c(e),t)},p.hashBinary=function(e,t){var n=r(a(e));return t?l(n):n},(p.ArrayBuffer=function(){this.reset()}).prototype.append=function(e){var t,o,a,s,r=(o=this._buff.buffer,a=e,(s=new Uint8Array(o.byteLength+a.byteLength)).set(new Uint8Array(o)),s.set(new Uint8Array(a),o.byteLength),s),c=r.length;for(this._length+=e.byteLength,t=64;t<=c;t+=64)n(this._hash,i(r.subarray(t-64,t)));return this._buff=t-64<c?new Uint8Array(r.buffer.slice(t-64)):new Uint8Array(0),this},p.ArrayBuffer.prototype.end=function(e){var t,n,o=this._buff,i=o.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)a[t>>2]|=o[t]<<(t%4<<3);return this._finish(a,i),n=r(this._hash),e&&(n=l(n)),this.reset(),n},p.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.ArrayBuffer.prototype.getState=function(){var e=p.prototype.getState.call(this);return e.buff=String.fromCharCode.apply(null,new Uint8Array(e.buff)),e},p.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,o=e.length,i=new ArrayBuffer(o),a=new Uint8Array(i);for(n=0;n<o;n+=1)a[n]=e.charCodeAt(n);return a}(e.buff),p.prototype.setState.call(this,e)},p.ArrayBuffer.prototype.destroy=p.prototype.destroy,p.ArrayBuffer.prototype._finish=p.prototype._finish,p.ArrayBuffer.hash=function(e,t){var o=r(function(e){var t,o,a,s,r,c,l=e.length,p=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=l;t+=64)n(p,i(e.subarray(t-64,t)));for(o=(e=t-64<l?e.subarray(t-64):new Uint8Array(0)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<o;t+=1)a[t>>2]|=e[t]<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(p,a),t=0;t<16;t+=1)a[t]=0;return s=(s=8*l).toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(s[2],16),c=parseInt(s[1],16)||0,a[14]=r,a[15]=c,n(p,a),p}(new Uint8Array(e)));return t?l(o):o},p}()}),gc=hc;function vc(e,t=0){return wc(e,t,2).getUint16(0,!0)}function xc(e,t=0){return wc(e,t,4).getUint32(0,!0)}function bc(e,t=0,n=e.byteLength){const o=e.slice(t,t+n);return _c.decode(new Uint8Array(o))}function yc(e,t,n=0){if(e.length<t.length+n)return!1;for(const[o,i]of t.entries())if(null!==i&&i!==e[o+n])return!1;return!0}function wc(e,t,n){const o=e.slice(t,t+n);return new DataView(new Uint8Array(o).buffer)}const _c=new TextDecoder("utf8"),kc=[["db","application/vnd.sqlite3",[83,81,76,105,116,101,32,102,111,114,109,97,116,32,51,0]],["woff","font/woff",[119,79,70,70]],["woff2","font/woff2",[119,79,70,50]],["bmp","image/bmp",[66,77]],["gif","image/gif",[71,73,70,56,55,97]],["gif","image/gif",[71,73,70,56,57,97]],["heic","image/heic",[102,116,121,112,104,101,105],{offset:4}],["heic","image/heic",[102,116,121,112,109],{offset:4}],["ico","image/x-icon",[0,0,1,0]],["jpg","image/jpeg",[255,216,255]],["pdf","application/pdf",[37,80,68,70,45]],["png","image/png",[137,80,78,71,13,10,26,10]],["7z","application/x-7z-compressed",[55,122,188,175,39,28]],["rar","application/x-rar-compressed",[82,97,114,33,26,7,0]],["rar","application/x-rar-compressed",[82,97,114,33,26,7,1,0]],["rtf","application/rtf",[123,92,114,116,102,49]],["bz2","application/x-bzip2",[66,90,104]],["gz","application/gzip",[31,139]],["tar","application/x-tar",[117,115,116,97,114,0,48,48],{offset:257}],["tar","application/x-tar",[117,115,116,97,114,32,32,0],{offset:257}],["tif","image/tiff",[73,73,42,0]],["tiff","image/tiff",[77,77,0,42]],["zip","application/zip",[80,75,3,4],{exact:!1}],["zip","application/zip",[80,75,5,6]],["mp3","audio/mp3",[255,251]],["mp3","audio/mp3",[255,243]],["mp3","audio/mp3",[255,242]],["mp3","audio/mp3",[73,68,51]],["mp4","video/mp4",[102,116,121,112,105,115,111,109],{offset:4}],["avi","video/x-msvideo",[82,73,70,70,null,null,null,null,65,86,73,32]],["wav","audio/wav",[82,73,70,70,null,null,null,null,87,65,86,69]],["ogx","application/ogg",[79,103,103,83],{exact:!1},[["oga","audio/ogg",[127,70,76,65,67],{offset:28}],["ogg","audio/ogg",[1,118,111,114,98,105,115],{offset:28}],["ogm","video/ogg",[1,118,105,100,101,111,0],{offset:28}],["ogv","video/ogg",[128,116,104,101,111,114,97],{offset:28}]]],["webp","image/webp",[82,73,70,70,null,null,null,null,87,69,66,80]],["psd","image/vnd.adobe.photoshop",[56,66,80,83]],["flac","audio/x-flac",[102,76,97,67]],["wasm","application/wasm",[0,97,115,109]],["deb","application/x-deb",[33,60,97,114,99,104,62,10]],["exe","application/x-msdownload",[77,90]],["exe","application/x-msdownload",[90,77]],["class","application/java-vm",[202,254,186,190]]];function Sc(e){return e.flatMap(([e,t,n,o={},i=[]])=>[[e,t,n,o],...i])}function jc(e,t){const n=vc(e,26),o=bc(e,30,n),[i]=o.split("/"),a=o.endsWith(".xml");return"META-INF"===i?{ext:"jar",mime:"application/java-archive"}:"ppt"===i&&a?{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:"word"===i&&a?{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:"xl"===i&&a?{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}:"mimetype"===i?function(e,t){const n=xc(e,18),o=xc(e,22),i=vc(e,28);if(n===o){const o=bc(e,30+t+i,n);if("application/vnd.oasis.opendocument.presentation"===o)return{ext:"odp",mime:o};if("application/vnd.oasis.opendocument.spreadsheet"===o)return{ext:"ods",mime:o};if("application/vnd.oasis.opendocument.text"===o)return{ext:"odt",mime:o};if("application/epub+zip"===o)return{ext:"epub",mime:o}}}(e,n)??t:t}const Ec=function(e){return Sc(e).map(([e,t,n,{offset:o=0}={}])=>n.length+o).reduce((e,t)=>t>e?t:e,0)}(kc);function Tc(e,t){for(const[n,o,i,{exact:a=!0,offset:s=0}={},r=[]]of t)if(yc(e,i,s)){if("zip"===n&&!a)return jc(e.buffer,{ext:n,mime:o});if(!a&&r.length)for(const[t,n,o,{offset:i=0}={}]of r)if(yc(e,o,i))return{ext:t,mime:n};return{ext:n,mime:o}}}function $c(e,t,n=void 0){const o=function(e,t,n){let o=0;for(;;){let t=e.indexOf("\\",o);if(-1===t)break;o=t+1,e=e.replace("\\","/")}return e}(e).split("/").pop()||e,i=(null==n?void 0:n.type)||Rc(t,e),a=new File([t],o,{type:i});return a.path=e,a}const Oc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Rc(e,t=void 0){const n=function(e,{extra:t=!1,hint:n}={}){const o=new Uint8Array(e.slice(0,Ec));if(n){const e=function(e,{ext:t,mime:n}){return t||n?Sc(e).filter(e=>e[0]===t||e[1]===n):[]}(kc,n);if(e.length>0){const t=Tc(o,e);if(void 0!==t)return t}}return Tc(o,kc)||(t?function(e){return function(e){try{const t=bc(e);if(!function(e){for(let t=0;t<e.length;t++)try{const n=e.charCodeAt(t);if(65533===n||n<=8)return!1}catch{return!1}return!0}(t))return;try{return JSON.parse(t),{ext:"json",mime:"application/json"}}catch{return{ext:"txt",mime:"text/plain"}}}catch{return}}(e)}(e):void 0)}(e);if(n)return n.mime;const o=new Uint8Array(e).subarray(0,4);let i="";for(var a=0;a<o.length;a++)i+=o[a].toString(16);let s="unknown";switch(i){case"676c5446":s="model/gltf-binary";break;case"89504e47":s="image/png";break;case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":s="image/jpeg";break;default:s="unknown"}return"unknown"===s&&"string"==typeof t&&(s=function(e){const t=e.toLowerCase();let n="";return t.endsWith(".html")||t.endsWith(".html.gz")||t.endsWith(".html.br")?n="text/html":t.endsWith(".js")||t.endsWith(".js.gz")||t.endsWith(".js.br")||t.endsWith(".mjs")||t.endsWith(".mjs.gz")||t.endsWith(".mjs.br")||t.endsWith(".cjs")||t.endsWith(".cjs.gz")||t.endsWith(".cjs.br")?n="application/javascript":t.endsWith(".wasm")?n="application/wasm":t.endsWith(".css")||t.endsWith(".css.gz")||t.endsWith(".css.br")?n="text/css":t.endsWith(".json")?n="application/json":t.endsWith(".txt")?n="text/plain":t.endsWith(".md")?n="text/markdown":t.endsWith(".yaml")||t.endsWith(".yml")?n="application/yaml":t.endsWith(".bin")?n="application/octet-stream":t.endsWith(".png")?n="image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?n="image/jpeg":t.endsWith(".gif")?n="image/gif":t.endsWith(".webp")?n="image/webp":t.endsWith(".avif")?n="image/avif":t.endsWith(".bmp")?n="image/bmp":t.endsWith(".tiff")||t.endsWith(".tif")?n="image/tiff":t.endsWith(".ico")?n="image/x-icon":t.endsWith(".svg")?n="image/svg+xml":t.endsWith(".xml")?n="application/xml":t.endsWith(".hdr")?n="image/vnd.radiance":t.endsWith(".exr")?n="image/x-exr":t.endsWith(".ktx2")?n="image/ktx2":t.endsWith(".ktx")?n="image/ktx":t.endsWith(".dds")?n="image/vnd-ms.dds":t.endsWith(".ogg")?n="audio/ogg":t.endsWith(".mp3")?n="audio/mpeg":t.endsWith(".wav")?n="audio/wave":t.endsWith(".flac")?n="audio/flac":t.endsWith(".m4a")?n="audio/mp4":t.endsWith(".aac")?n="audio/aac":t.endsWith(".mp4")?n="video/mp4":t.endsWith(".webm")?n="video/webm":t.endsWith(".mov")?n="video/quicktime":t.endsWith(".woff2")?n="font/woff2":t.endsWith(".woff")?n="font/woff":t.endsWith(".ttf")?n="font/ttf":t.endsWith(".otf")?n="font/otf":t.endsWith(".zip")?n="application/zip":t.endsWith(".glb")?n="model/gltf-binary":t.endsWith(".gltf")?n="model/gltf+json":t.endsWith(".vrm")?n="model/gltf-binary":t.endsWith(".usdz")?n="model/vnd.usdz+zip":t.endsWith(".usda")?n="model/vnd.usd-usda":t.endsWith(".usdc")?n="model/vnd.usd-usdc":t.endsWith(".usd")?n="model/vnd.usd-usd":t.endsWith(".mtl")?n="model/mtl":t.endsWith(".obj")?n="model/obj":t.endsWith(".fbx")?n="model/vnd.autodesk.fbx":t.endsWith(".stl")?n="model/stl":t.endsWith(".mtlx")?n="application/materialx+xml":t.endsWith(".ply")?n="model/ply":t.endsWith(".dae")?n="model/vnd.collada+xml":t.endsWith(".3mf")?n="model/3mf":(t.endsWith(".splat")||t.endsWith(".spz")||t.endsWith(".ksplat")||t.endsWith(".sog")||t.endsWith(".sogs"))&&(n="application/octet-stream"),n}(t)),s}function Ac(e){return"string"==typeof e&&0!==e.length&&e.toLowerCase().endsWith(".exr")}function Cc(e){if("string"!=typeof e||0===e.length)return!1;const t=e.toLowerCase();return t.endsWith(".hdr")||t.endsWith(".hdri")}function Nc(e){return"string"==typeof e&&0!==e.length&&/\.pmrem(\d+x\d+)?\.ktx2$/i.test(e)}function Ic(e,t){const n=e.toLowerCase();return"application/gzip"===t||"application/brotli"===t?(n.endsWith(".html.gz")||n.endsWith(".html.br")?(t="text/html",e=e.substring(0,e.length-3)):n.endsWith(".js.gz")||n.endsWith(".js.br")||n.endsWith(".mjs.gz")||n.endsWith(".mjs.br")||n.endsWith(".cjs.gz")||n.endsWith(".cjs.br")?(t="application/javascript",e=e.substring(0,e.length-3)):n.endsWith(".css.gz")||n.endsWith(".css.br")?(t="text/css",e=e.substring(0,e.length-3)):n.endsWith(".json.gz")||n.endsWith(".json.br")?(t="text/json",e=e.substring(0,e.length-3)):n.endsWith(".txt.gz")||n.endsWith(".txt.br")?(t="text/plain",e=e.substring(0,e.length-3)):n.endsWith(".wasm.gz")||n.endsWith(".wasm.br")?(t="application/wasm",e=e.substring(0,e.length-3)):n.endsWith(".bin.gz")||n.endsWith(".bin.br")?(t="application/octet-stream",e=e.substring(0,e.length-3)):n.endsWith(".png.gz")||n.endsWith(".png.br")?(t="image/png",e=e.substring(0,e.length-3)):n.endsWith(".jpg.gz")||n.endsWith(".jpg.br")||n.endsWith(".jpeg.gz")||n.endsWith(".jpeg.br")?(t="image/jpeg",e=e.substring(0,e.length-3)):n.endsWith(".gif.gz")||n.endsWith(".gif.br")?(t="image/gif",e=e.substring(0,e.length-3)):n.endsWith(".webp.gz")||n.endsWith(".webp.br")?(t="image/webp",e=e.substring(0,e.length-3)):n.endsWith(".svg.gz")||n.endsWith(".svg.br")?(t="image/svg+xml",e=e.substring(0,e.length-3)):n.endsWith(".xml.gz")||n.endsWith(".xml.br")?(t="application/xml",e=e.substring(0,e.length-3)):n.endsWith(".ico.gz")||n.endsWith(".ico.br")?(t="image/x-icon",e=e.substring(0,e.length-3)):n.endsWith(".avif.gz")||n.endsWith(".avif.br")?(t="image/avif",e=e.substring(0,e.length-3)):n.endsWith(".bmp.gz")||n.endsWith(".bmp.br")?(t="image/bmp",e=e.substring(0,e.length-3)):n.endsWith(".tiff.gz")||n.endsWith(".tiff.br")||n.endsWith(".tif.gz")||n.endsWith(".tif.br")?(t="image/tiff",e=e.substring(0,e.length-3)):n.endsWith(".hdr.gz")||n.endsWith(".hdr.br")?(t="image/vnd.radiance",e=e.substring(0,e.length-3)):n.endsWith(".exr.gz")||n.endsWith(".exr.br")?(t="image/x-exr",e=e.substring(0,e.length-3)):n.endsWith(".ktx2.gz")||n.endsWith(".ktx2.br")?(t="image/ktx2",e=e.substring(0,e.length-3)):n.endsWith(".ktx.gz")||n.endsWith(".ktx.br")?(t="image/ktx",e=e.substring(0,e.length-3)):n.endsWith(".dds.gz")||n.endsWith(".dds.br")?(t="image/vnd-ms.dds",e=e.substring(0,e.length-3)):n.endsWith(".webm.gz")||n.endsWith(".webm.br")?(t="video/webm",e=e.substring(0,e.length-3)):n.endsWith(".mp4.gz")||n.endsWith(".mp4.br")?(t="video/mp4",e=e.substring(0,e.length-3)):n.endsWith(".mov.gz")||n.endsWith(".mov.br")?(t="video/quicktime",e=e.substring(0,e.length-3)):n.endsWith(".mp3.gz")||n.endsWith(".mp3.br")?(t="audio/mpeg",e=e.substring(0,e.length-3)):n.endsWith(".wav.gz")||n.endsWith(".wav.br")?(t="audio/wave",e=e.substring(0,e.length-3)):n.endsWith(".ogg.gz")||n.endsWith(".ogg.br")?(t="audio/ogg",e=e.substring(0,e.length-3)):n.endsWith(".flac.gz")||n.endsWith(".flac.br")?(t="audio/flac",e=e.substring(0,e.length-3)):n.endsWith(".m4a.gz")||n.endsWith(".m4a.br")?(t="audio/mp4",e=e.substring(0,e.length-3)):n.endsWith(".aac.gz")||n.endsWith(".aac.br")?(t="audio/aac",e=e.substring(0,e.length-3)):n.endsWith(".woff2.gz")||n.endsWith(".woff2.br")?(t="font/woff2",e=e.substring(0,e.length-3)):n.endsWith(".woff.gz")||n.endsWith(".woff.br")?(t="font/woff",e=e.substring(0,e.length-3)):n.endsWith(".ttf.gz")||n.endsWith(".ttf.br")?(t="font/ttf",e=e.substring(0,e.length-3)):n.endsWith(".otf.gz")||n.endsWith(".otf.br")?(t="font/otf",e=e.substring(0,e.length-3)):n.endsWith(".md.gz")||n.endsWith(".md.br")?(t="text/markdown",e=e.substring(0,e.length-3)):n.endsWith(".yaml.gz")||n.endsWith(".yaml.br")||n.endsWith(".yml.gz")||n.endsWith(".yml.br")?(t="application/yaml",e=e.substring(0,e.length-3)):n.endsWith(".zip.gz")||n.endsWith(".zip.br")?(t="application/zip",e=e.substring(0,e.length-3)):n.endsWith(".glb.gz")||n.endsWith(".glb.br")?(t="model/gltf-binary",e=e.substring(0,e.length-3)):n.endsWith(".gltf.gz")||n.endsWith(".gltf.br")?(t="model/gltf+json",e=e.substring(0,e.length-3)):n.endsWith(".vrm.gz")||n.endsWith(".vrm.br")?(t="model/gltf-binary",e=e.substring(0,e.length-3)):n.endsWith(".usdz.gz")||n.endsWith(".usdz.br")?(t="model/vnd.usdz+zip",e=e.substring(0,e.length-3)):n.endsWith(".usda.gz")||n.endsWith(".usda.br")?(t="model/vnd.usd-usda",e=e.substring(0,e.length-3)):n.endsWith(".usdc.gz")||n.endsWith(".usdc.br")?(t="model/vnd.usd-usdc",e=e.substring(0,e.length-3)):n.endsWith(".usd.gz")||n.endsWith(".usd.br")?(t="model/vnd.usd-usd",e=e.substring(0,e.length-3)):n.endsWith(".obj.gz")||n.endsWith(".obj.br")?(t="model/obj",e=e.substring(0,e.length-3)):n.endsWith(".mtl.gz")||n.endsWith(".mtl.br")?(t="model/mtl",e=e.substring(0,e.length-3)):n.endsWith(".stl.gz")||n.endsWith(".stl.br")?(t="model/stl",e=e.substring(0,e.length-3)):n.endsWith(".mtlx.gz")||n.endsWith(".mtlx.br")?(t="application/materialx+xml",e=e.substring(0,e.length-3)):n.endsWith(".ply.gz")||n.endsWith(".ply.br")?(t="model/ply",e=e.substring(0,e.length-3)):n.endsWith(".dae.gz")||n.endsWith(".dae.br")?(t="model/vnd.collada+xml",e=e.substring(0,e.length-3)):n.endsWith(".3mf.gz")||n.endsWith(".3mf.br")?(t="model/3mf",e=e.substring(0,e.length-3)):(n.endsWith(".splat.gz")||n.endsWith(".splat.br")||n.endsWith(".spz.gz")||n.endsWith(".spz.br")||n.endsWith(".ksplat.gz")||n.endsWith(".ksplat.br")||n.endsWith(".sog.gz")||n.endsWith(".sog.br")||n.endsWith(".sogs.gz")||n.endsWith(".sogs.br"))&&(t="application/octet-stream",e=e.substring(0,e.length-3)),{filename:e,mimetype:t}):null}function Pc(e,t=void 0,n=!0){const o=Math.abs(e);if(o>=1099511627776){let o=n?" TB":"";return(e/1099511627776).toFixed(void 0===t?2:t)+o}if(o>=1073741824){let o=n?" GB":"";return(e/1073741824).toFixed(void 0===t?2:t)+o}if(o>=1048576){let o=n?" MB":"";return(e/1048576).toFixed(void 0===t?1:t)+o}if(o>=1024){let o=n?" KB":"";return(e/1024).toFixed(void 0===t?0:t)+o}let i=n?" B":"";return e.toFixed(0)+i}function Uc(e){return e.split("/").reduce((e,t)=>("."===t||(".."===t?e.pop():null!=t&&t.length&&e.push(t)),e),[]).join("/")}const Lc=1179937895,zc=1313821514,Fc=12,Dc=8;function qc(e,t){let n=t;for(;n<e.length&&0!==e[n];)n++;return n>=e.length?null:new TextDecoder("latin1").decode(e.subarray(t,n))}async function Bc(e){return new Promise(t=>setTimeout(t,e))}function Mc(e,t,n=void 0){e instanceof Date&&(e=e.getTime()),t instanceof Date&&(t=t.getTime());let o=t-e,i=o>0;const a=!1!==(null==n?void 0:n.prefix),s=!1!==(null==n?void 0:n.suffix);let r="",c="";o<0&&(o=-o);const l=Math.floor(o/1e3),p=Math.floor(l/60),u=Math.floor(p/60),d=Math.floor(u/24);if(null!=(null==n?void 0:n.limitInDays)&&d>=n.limitInDays)return a&&(r="on "),`${r}${new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}${c}`;r=a?i?"":"in ":"",c=s&&i?" ago":"";const m=Math.floor(d/30),f=Math.floor(m/12);return 1===f?`${r}1 year${c}`:f>1?`${r}${Math.floor(f)} years${c}`:1===m?`${r}1 month${c}`:m>1?`${r}${Math.floor(m)} months${c}`:1===d?i&&null!=n&&n.allowSimple?"yesterday":`${r}1 day${c}`:d>1?`${r}${Math.floor(d)} days${c}`:1===u?`${r}1 hour${c}`:u>1?`${r}${Math.floor(u)} hours${c}`:1===p?`${r}1 minute${c}`:p>1?`${r}${Math.floor(p)} minutes${c}`:null!=n&&n.allowSimple&&l<10?"just now":`${r}${l.toFixed(0)} seconds${c}`}const Wc=/^image_(?<image_lod>\d+)_|^mesh_lod_(?<mesh_lod>\d+)_/;function Gc(e){return e.includes("\\u")?JSON.parse(`"${e}"`):decodeURIComponent(e)}function Hc(e){let t=null,n="";const o=e.filter(e=>"index.html"===e.name.toLowerCase()||"index.html.gz"===e.name.toLowerCase()||"index.html.br"===e.name.toLowerCase());if(1===o.length)return t=o[0],t;const i=e.filter(e=>e.name.toLowerCase().endsWith(".html")||e.name.toLowerCase().endsWith(".htm")||e.name.toLowerCase().endsWith(".html.gz")||e.name.toLowerCase().endsWith(".html.br"));if(1===i.length)return i[0];if(i.length>1){const e=new Map;for(const t of i){const n=t.path.split("/");let o=e.get(n.length);o||(o=[],e.set(n.length,o)),o.push(t)}const o=Array.from(e.keys()).sort((e,t)=>e-t);if(o.length>0)for(const n of o){const o=e.get(n);if(!o)continue;const i=o.find(e=>"index.html"===e.name.toLowerCase()||"index.html.gz"===e.name.toLowerCase()||"index.html.br"===e.name.toLowerCase());return i?(t=i,t):(t=o[0],t)}return n="Invalid upload: Multiple HTML files found but could not determine root.",console.error(n,i.map(e=>e.path||e.name)),{error:n}}const a=e.filter(e=>e.name.toLowerCase().endsWith(".glb")||e.name.toLowerCase().endsWith(".gltf")||e.name.toLowerCase().endsWith(".vrm"));if(a.length>1){const e=function(e){const t=new Array,n=/(mesh_lod|image)_\d_(.{1,50})/;for(const o of e){if(n.test(o.name))continue;const e=o.name.toLowerCase();(e.endsWith(".gltf")||e.endsWith(".vrm")||e.endsWith(".glb"))&&t.push(o)}return 1==t.length?t[0]:null!=(o=Kc(t)[0])?o:null;var o}(a);return e?(t=e,t):(n="Invalid upload: Multiple glb/glTF/vrm files found. This is currently not supported.",console.error(n,a.map(e=>e.path||e.name)),{error:n})}if(1===a.length)return t=a[0],t;const s=e.filter(e=>e.name.toLowerCase().endsWith(".usdz")||e.name.toLowerCase().endsWith(".usd")||e.name.toLowerCase().endsWith(".usda")||e.name.toLowerCase().endsWith(".usdc"));if(s.length>=1)return t=function(e){var t;const n=Kc(e),o=["usda","usdz","usd","usdc"];for(const e of o){const t=n.find(t=>t.name.toLowerCase().endsWith(`.${e}`));if(t)return t}return null!=(t=n[0])?t:null}(s),t;const r=e.filter(e=>e.name.toLowerCase().endsWith(".fbx"));if(r.length>1)return n="Invalid upload: Multiple fbx files found. This is currently not supported.",console.error(n,r),{error:n};if(1===r.length)return t=r[0],t;const c=e.filter(e=>e.name.toLowerCase().endsWith(".obj"));if(c.length>1)return n="Invalid upload: Multiple obj files found. This is currently not supported.",console.error(n,c),{error:n};if(1===c.length)return t=c[0],t;const l=e.filter(e=>e.name.toLowerCase().endsWith(".stl"));if(l.length>1)return n="Invalid upload: Multiple stl files found. This is currently not supported.",console.error(n,l),{error:n};if(1===l.length)return t=l[0],t;const p=e.filter(e=>{const t=e.name.toLowerCase();return t.endsWith(".ply")||t.endsWith(".splat")||t.endsWith(".spz")||t.endsWith(".ksplat")||t.endsWith(".sog")||t.endsWith(".sogs")});if(p.length>1)return n="Invalid upload: Multiple splat files found. Upload them as separate content items.",console.error(n,p.map(e=>e.path||e.name)),{error:n};if(1===p.length)return t=p[0],t;if(1===e.length&&!e[0].arrayBuffer&&e[0].path.toLowerCase().startsWith("http"))return t=e[0],t;const u=e.filter(e=>e.name.toLowerCase().endsWith("package.json"));if(1===u.length)return t=u[0],t;if(u.length>1)return n="Invalid upload: Multiple package.json files found. This is currently not supported.",console.error(n,u),{error:n};const d=e.filter(e=>e.name.toLowerCase().endsWith(".mtlx"));if(d.length>1)return n="Invalid upload: Multiple mtlx files found. This is currently not supported.",console.error(n,d),{error:n};if(1===d.length)return t=d[0],t;const m=e.filter(e=>{const t=e.name.toLowerCase();return Ac(t)||Cc(t)||Nc(t)});return m.length>1?(n="Invalid upload: Multiple HDRI files found. Upload them as separate content items.",console.error(n,m.map(e=>e.path||e.name)),{error:n}):1===m.length?(t=m[0],t):t||{error:"No supported file to upload found..."}}const Jc=new Set(["glb","gltf","vrm"]),Vc=new Set(["fbx","obj","stl","usd","usda","usdz"]);function Kc(e){let t=Infinity,n=[];for(const o of e){const e=o.path.split("/").length;e<t?(t=e,n=[o]):e===t&&n.push(o)}return n}class Yc{constructor(e,t){this.totalFiles=e,this.estimatedTotalSize=t,this.uploadedSize=0,this.startTime=Date.now(),this.lastUpdateTime=this.startTime,this.lastUploadedSize=0,this.speedEMA=null,this.emaFactor=.1,this.smoothedRemainingTime=null,this.recentSpeeds=new Array,this.maxRecentSpeeds=20,this.initialEstimateThreshold=.05}updateProgress(e){const t=Date.now(),n=(t-this.lastUpdateTime)/1e3,o=e-this.lastUploadedSize;if(this.uploadedSize=e,n>0&&o>0){this.recentSpeeds.push(o/n),this.recentSpeeds.length>this.maxRecentSpeeds&&this.recentSpeeds.shift();const e=this.recentSpeeds.reduce((e,t)=>e+t,0)/this.recentSpeeds.length;this.speedEMA=null===this.speedEMA?e:this.emaFactor*e+(1-this.emaFactor)*this.speedEMA}this.lastUpdateTime=t,this.lastUploadedSize=e;const i=this.uploadedSize/this.estimatedTotalSize,a=(t-this.startTime)/1e3,s=this.speedEMA&&this.speedEMA>0?this.speedEMA:this.uploadedSize/a;let r;if(r=s>0?(this.estimatedTotalSize-this.uploadedSize)/s:Infinity,i>=this.initialEstimateThreshold)if(null===this.smoothedRemainingTime)this.smoothedRemainingTime=r;else{const e=.1;this.smoothedRemainingTime=(1-e)*this.smoothedRemainingTime+e*r}else this.smoothedRemainingTime=a/i-a;return this.smoothedRemainingTime=Math.max(this.smoothedRemainingTime,(this.estimatedTotalSize-this.uploadedSize)/s),{progress:100*i,estimatedTimeRemaining:Math.round(this.smoothedRemainingTime),estimatedTimeRemainingString:this.smoothedRemainingTime>3?this.__formatTime(this.smoothedRemainingTime):"few seconds"}}__formatTime(e){if(!isFinite(e))return"Calculating...";if(e<60)return`${Math.round(e)}sec`;const t=Math.floor(e/60);if(t<60)return`${t}min`;const n=Math.floor(t/60);if(n<24)return`${n}h ${t%60}min`;const o=Math.floor(n/24);return o<=10?`${o}d`:"Calculating..."}}const Zc=15e3;function Xc(e,t,n={setTimeout:setTimeout,clearTimeout:clearTimeout}){return function(o,i){const a=e.call(this,o,i);if(!a||"function"!=typeof a.once)return a;const s=n.setTimeout(()=>{const e=new Error(`connect timeout: no connection within ${t/1e3}s`);e.code="ETIMEDOUT",a.destroy(e)},t),r=()=>n.clearTimeout(s);return a.once("connect",r),a.once("secureConnect",r),a.once("error",r),a.once("close",r),a}}let Qc;async function el(e={}){var t,n;if(!(null!=(t=e.isNode)?t:"undefined"!=typeof process&&null!=(n=process.versions)&&n.node))return{};if(Qc)return Qc;const[{default:o},{default:i}]=await Promise.all([import("node:http"),import("node:https")]),a=new o.Agent({keepAlive:!0}),s=new i.Agent({keepAlive:!0});for(const e of[a,s])e.createConnection=Xc(e.createConnection,Zc);return Qc={httpAgent:a,httpsAgent:s},Qc}async function tl(e){const t=await import("./pako.esm-01431bd2.js"),n=await e.arrayBuffer(),o=t.gzip(new Uint8Array(n)).buffer.slice(0);if(o.byteLength>51200&&o.byteLength>=n.byteLength){if(n.byteLength>0)return null}else if(!(o instanceof ArrayBuffer))return console.error("gzipCompress: Invalid ArrayBuffer"),{error:`Gzip compressing failed for "${e.name}" (unexpected result)`};return $c(`${"path"in e?e.path:e.name}.gz`,o,{type:"application/gzip"})}const nl=16777216;async function ol(e,t,n=void 0){const o=async function(e,t,n){var o,i,a,s,r,c,l,p,u,d,m,f,h,g,v,x,b,y,w,_;let{files:k,skipped:S}=function(e){const t=[];return{files:e.filter(e=>{const n=e.name||"";return!(!n||n.endsWith("/"))||(t.push({name:n,reason:"directory-entry"}),!1)}),skipped:t}}(t.files);for(const e of S)console.warn(`[upload] Skipping directory entry: "${e.name}"`);t.files=k;const j=(null==(o=n)?void 0:o.loglevel)||"none";if(!k.length)return"none"!=j&&console.error("No files to upload"),{success:!1,error:"No files to upload"};if(!t.entrypoint){const e=Hc(k);if(null==e)return{success:!1,error:"No entrypoint file found"};if("object"==typeof e&&"error"in e)return{success:!1,error:e.error};"info"===j&&console.log("Entrypoint: "+e.name),t.entrypoint=e}t.entrypoint&&!k.includes(t.entrypoint)&&k.push(t.entrypoint);const E=await async function(e){if(e.length>5e3)return{success:!1,error:"Too many files. Maximum filecount is 5000"};let t=0,n=0,o=0,i=0;for(let c=e.length-1;c>=0;c--){const l=e[c];if(t+=l.size,t>1073741824)return{success:!1,error:`Total file size exceeds limit of ${1024..toFixed(0)} MB. Please reduce the size of your upload.`};const p=l.name.toLocaleLowerCase();if(".ds_store"!==p){if(p.endsWith(".gltf")?o++:p.endsWith(".glb")?(r=p)&&Wc.test(r)||i++:p.endsWith(".vrm")&&n++,p.endsWith(".gltf")){var a;o+=1,console.log(`Found glTF file ${l.name}. Will check if all dependencies are available\n`,e);const t=await l.text(),n=t.matchAll(/"uri"\s*:\s*"(?<value>.*?)"/g);if(!n)continue;const i=JSON.parse(t);if("2.0"!==i.asset.version)return console.warn("⚠ glTF version is not 2.0. This is currently not supported."),{success:!1,error:`glTF version ${i.asset.version} is unsupported.Please use glTF 2.0.`};const r=null==(a=l.path)?void 0:a.split("/"),c=r.splice(0,r.length-1).join("/");for(const t of n){var s;const n=null==(s=t.groups)?void 0:s.value;if(n){let t=!1;if(n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.")){console.log(`✅ Found remote dependency ${n} `);break}if(n.startsWith("data:")){console.log(`✅ Found embedded dependency ${n} `);break}{const o=Uc(`${c}/${Gc(n)}`);console.log('❓ Check if local dependency exists "'+o+'"');for(const n of e){if(n.webkitRelativePath===o||n.name==o){t=!0,console.log(`✅ Found dependency in name or webkit: ${n.name} || ${n.webkitRelativePath} `);break}if(n.path===o){t=!0,console.log(`✅ Found dependency in path: ${n.path} `);break}}}if(!t)return console.warn("⚠ Missing dependency "+n,c),{success:!1,error:"Missing resource: "+n}}}}}else e.splice(c,1)}var r;return{success:!0,vrm_count:n,gltf_count:o,glb_count:i}}(k);if("error"in E)return{success:!1,error:E.error||"Failed to validate files"};if(null!=(i=t.entrypoint)&&i.name.endsWith(".htm")||null!=(a=t.entrypoint)&&a.name.endsWith(".html")||null!=(s=t.entrypoint)&&s.name.endsWith(".html.gz")||null!=(r=t.entrypoint)&&r.name.endsWith(".html.br"))n||(n={}),n.type="deployment";else if(E.vrm_count>10)return{success:!1,error:"Multiple model files found - this is not supported for asset uploads. Please upload a single model file only."};const T=await async function(e,t={}){const{raw:n=!1,loglevel:o="none",entrypoint:i=null}=t,a=(...e)=>{"none"!==o&&console.log(...e)};if(n)return"none"!==o&&console.warn("Raw upload - skipping gzip compression of files"),{files:e,entrypoint:i};const s=new Set(e.map(sl)),r=[];let c=i;for(const t of e){const n=sl(t),p=t.name.toLowerCase();if(!il.some(e=>p.endsWith(e))){r.push(t);continue}const u=al.find(e=>s.has(`${n}${e}`));if(u){var l;a(`Skipping gzip compression, using pre-compressed file: ${n}${u}`),i===t&&(c=null!=(l=e.find(e=>sl(e)===`${n}${u}`))?l:c);continue}a(`gZip compressing file: ${t.name}`);const d=await tl(t).catch(e=>({error:`Error compressing ${t.name}: ${e.message}`}));if(null===d){"none"!==o&&console.error(`Did not compress file: ${t.name}`),r.push(t);continue}if("error"in d)return{files:e,entrypoint:i,error:d.error};if(!d)return{files:e,entrypoint:i,error:`Failed to compress ${t.name}`};const m=i===t;r.push(d),m&&(c=d),a(`gZip compressed file: ${t.name} ${m?"(entrypoint)":""}`)}return{files:r,entrypoint:c}}(k,{raw:t.raw,loglevel:null!=(c=null==(l=n)?void 0:l.loglevel)?c:j,entrypoint:t.entrypoint});if(T.error)return{success:!1,error:T.error,status:500};k=T.files,t.files=k,t.entrypoint=T.entrypoint,k.sort((e,t)=>e.name.includes(".needle")&&!t.name.includes(".needle")?-1:!e.name.includes(".needle")&&t.name.includes(".needle")?1:0);const{baseUrl:$,authToken:O}=e,R="Bearer "+O,A={...Ke(e),triggered_by:t.triggered_by,filename:`${encodeURIComponent(t.entrypoint.name)}`,"total-files":k.length.toString(),"total-files-size":k.reduce((e,t)=>e+t.size,0).toString()};null!=(p=n)&&p.content_id&&(A.content_id=n.content_id),null!=(u=n)&&u.type&&(A.type=n.type),null!=(d=n)&&d.name&&(A.name=encodeURIComponent(n.name)),null!=(m=n)&&m.parent_job_id&&(A.parent_job_id=n.parent_job_id);const C={entrypoint:(null==(f=t.entrypoint)?void 0:f.path)||(null==(h=t.entrypoint)?void 0:h.name),files:[]};null!=(g=n)&&g.content_type&&(C.content_type=n.content_type);const N={outputs:[C],...t.metadata?{metadata:t.metadata}:{},...!1===(null==(v=n)?void 0:v.optimizations)?{optimizations:!1}:{},...!0===(null==(x=n)?void 0:x.verify)?{verify:!0}:{}},I=[];for(let e=0;e<k.length;e++){var P,U,L;const t=k[e];let o=t.path||t.webkitRelativePath||t.name;if(null!=(P=o)&&P.includes(":"))throw new Error(`Invalid filename: ${o}`);let i=await t.arrayBuffer();const a=t.size;let s=t.type;if(null!=(U=s)&&U.length&&"unknown"!==s.toLowerCase()||(s=Rc(i,o)),"deployment"===(null==(L=n)?void 0:L.type)){const e=Ic(o,s);e&&(o=e.filename,s=e.mimetype)}const r=function(e){let t="";for(let n=0;n<e.length;n+=3){const o=e.charCodeAt(n),i=n+1<e.length?e.charCodeAt(n+1):0,a=n+2<e.length?e.charCodeAt(n+2):0;t+=Oc[o>>2]+Oc[(3&o)<<4|i>>4]+(n+1<e.length?Oc[(15&i)<<2|a>>6]:"=")+(n+2<e.length?Oc[63&a]:"=")}return t}(gc.ArrayBuffer.hash(i,!0));I[e]=i,C.files[e]={filename:o,content_type:s,content_length:a,content_md5:r}}if("deployment"!==(null==(b=n)?void 0:b.type)){const e=t.entrypoint.name.toLowerCase();let o;if(e.endsWith(".glb")||e.endsWith(".gltf"))try{const n=I[k.indexOf(t.entrypoint)];o=function(e){return function(e){if(!e)return!1;const t=!e.nodes||0===e.nodes.length,n=!e.meshes||0===e.meshes.length,o=Array.isArray(e.materials)&&1===e.materials.length;return t&&n&&o}(e)?"material":"3d-asset"}(e.endsWith(".glb")?function(e){const t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.byteLength<Fc+Dc)throw new Error("Buffer too small to be a GLB");const n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==Lc)throw new Error("Not a GLB (magic mismatch)");const o=n.getUint32(Fc,!0);if(n.getUint32(Fc+4,!0)!==zc)throw new Error("First chunk is not JSON");const i=Fc+Dc,a=i+o;if(a>t.byteLength)throw new Error("JSON chunk exceeds buffer length");const s=t.subarray(i,a),r=(new TextDecoder).decode(s);return JSON.parse(r)}(n):JSON.parse((new TextDecoder).decode(n)))}catch(e){return{success:!1,error:`Failed to inspect "${t.entrypoint.name}": ${e.message}`}}else e.endsWith(".mtlx")?o="material":(Ac(e)||Cc(e)||Nc(e))&&(o="hdri");if(o){var z;if(null!=(z=n)&&z.content_type&&n.content_type!==o)return{success:!1,error:`Content type mismatch: "${t.entrypoint.name}" contains "${o}" but "${n.content_type}" was requested.`};C.content_type=o}}try{const e=await async function(e){var t,n,o,i,a;if(!e||"function"!=typeof e.slice||"number"!=typeof e.size)return null;const s=Math.min(e.size,65536);if(s<=0)return null;let r;try{const t=await e.slice(0,s).arrayBuffer();r=new Uint8Array(t)}catch{return null}return null!=(t=null!=(n=null!=(o=null!=(i=null!=(a=function(e){if(e.length<24)return null;if(137!==e[0]||80!==e[1]||78!==e[2]||71!==e[3])return null;if(13!==e[4]||10!==e[5]||26!==e[6]||10!==e[7])return null;const t=new DataView(e.buffer,e.byteOffset),n=t.getUint32(16,!1),o=t.getUint32(20,!1);return n&&o?{width:n,height:o}:null}(r))?a:function(e){if(e.length<28)return null;const t=[171,75,84,88,32,50,48,187,13,10,26,10];for(let n=0;n<t.length;n++)if(e[n]!==t[n])return null;const n=new DataView(e.buffer,e.byteOffset),o=n.getUint32(20,!0),i=n.getUint32(24,!0);return o&&i?{width:o,height:i}:null}(r))?i:function(e){if(e.length<16)return null;if(118!==e[0]||47!==e[1]||49!==e[2]||1!==e[3])return null;const t=new DataView(e.buffer,e.byteOffset);let n=8;for(;n<e.length;){const o=qc(e,n);if(null===o)return null;if(0===o.length)return null;n+=o.length+1;const i=qc(e,n);if(null===i)return null;if(n+=i.length+1,n+4>e.length)return null;const a=t.getInt32(n,!0);if(n+=4,a<0||n+a>e.length)return null;if("dataWindow"===o&&"box2i"===i&&16===a){const e=t.getInt32(n,!0),o=t.getInt32(n+4,!0),i=t.getInt32(n+8,!0)-e+1,a=t.getInt32(n+12,!0)-o+1;return i<=0||a<=0?null:{width:i,height:a}}n+=a}return null}(r))?o:function(e){if(e.length<30)return null;if(82!==e[0]||73!==e[1]||70!==e[2]||70!==e[3])return null;if(87!==e[8]||69!==e[9]||66!==e[10]||80!==e[11])return null;const t=String.fromCharCode(e[12],e[13],e[14],e[15]);if("VP8 "===t){const t=16383&(e[26]|e[27]<<8),n=16383&(e[28]|e[29]<<8);return t&&n?{width:t,height:n}:null}return"VP8L"===t?47!==e[20]?null:{width:1+(16383&(e[21]|e[22]<<8)),height:1+(16383&(e[22]>>6|e[23]<<2|(15&e[24])<<10))}:"VP8X"===t?{width:1+(e[24]|e[25]<<8|e[26]<<16),height:1+(e[27]|e[28]<<8|e[29]<<16)}:null}(r))?n:function(e){if(e.length<4)return null;if(255!==e[0]||216!==e[1])return null;let t=2;for(;t<e.length-8;){for(;t<e.length&&255===e[t];)t++;if(t>=e.length)return null;const n=e[t++];if(1===n||n>=208&&n<=217)continue;if(t+2>e.length)return null;const o=e[t]<<8|e[t+1];if(o<2||t+o>e.length)return null;if(n>=192&&n<=207&&196!==n&&200!==n&&204!==n){if(t+7>e.length)return null;const n=e[t+3]<<8|e[t+4],o=e[t+5]<<8|e[t+6];return o&&n?{width:o,height:n}:null}t+=o}return null}(r))?t:function(e){if(e.length<10)return null;if(35!==e[0]||63!==e[1])return null;const t=new TextDecoder("latin1").decode(e.subarray(0,Math.min(e.length,4096))).match(/[+-]Y\s+(\d+)\s+[+-]X\s+(\d+)/);if(!t)return null;const n=parseInt(t[1],10),o=parseInt(t[2],10);return o&&n?{width:o,height:n}:null}(r)}(t.entrypoint);e&&(C.width=e.width,C.height=e.height)}catch(e){"debug"===j&&console.warn("readImageResolution failed; uploading without dimensions",e)}const F=await fetch($+Ve.upload.request,{...Ye,method:"POST",headers:A,body:JSON.stringify(N)}).catch(e=>"fetch failed"==e.message||"Failed to fetch"==e.message?`Network error. Make sure you are connected to the internet and ${$} is reachable.`:(console.error("Failed to begin upload\n",e),null));if(null===F||"string"==typeof F)return{success:!1,error:F||"Failed to begin upload"};if(!F.ok){const e=await F.text();if(e.startsWith("{")){const t=JSON.parse(e);if("error"in t)return{success:!1,status:F.status,error:t.error}}return"none"!=j&&console.error("Failed to begin upload\n",F.status,e),{success:!1,status:F.status,error:`${e}`}}const D=await F.json();"debug"===j&&console.debug("BeginResponse",D);const q=k.reduce((e,t)=>e+t.size,0);var B;if("exists"===D.type)return"none"!=j&&console.log("Upload already exists",D.id),null!=(B=n)&&B.onStart&&n.onStart(D.id,D.content_id),{success:!0,uploadSkipped:!0,id:D.id,type:D.job_type,content_id:D.content_id,filesUploaded:k.length,totalSize:q,url:D.url,edit_url:D.edit_url};const M=t.entrypoint.webkitRelativePath||t.entrypoint.name;let W=0;null==(y=n)||null==(y=y.abort)||y.addEventListener("abort",async()=>{console.log("Upload aborted: Cancelling upload"),await fetch($+Ve.upload.cancel,{...Ye,method:"POST",headers:{authorization:R,id:D.id}})});let G=!1,H=Date.now();function J(t,n,o=!1){if(!o&&Date.now()-H<1e3)return!1;if(G&&"completed"!==n)return void("none"!=j&&console.warn("Invalid status update..."));H=Date.now();const i=Math.floor(W/q*100);return"debug"===j&&console.log("SET STATUS: "+n,t,i),Xr({identifier:D.id,status:n,status_message:t,progress:i},e),!0}null!=(w=n)&&w.onStart&&n.onStart(D.id,D.content_id);const V=Date.now(),K=new Yc(k.length,q/1024/1024),Y=new Array,Z=function(e){let t=0;for(const n of e)Number.isFinite(n)&&n>=0&&(t=Math.max(t,n));return t>=fc?2:t>=nl?4:10}(C.files.map(e=>e.content_length));"debug"===j&&console.debug(`Upload file concurrency: ${Z}`);let X=!1;const Q=[...k],ee=k.length,te=function(e,t=25e3){let n=!1;const o=setInterval(()=>{if(!n)try{const t=e();t&&"function"==typeof t.then&&t.catch(e=>{console.warn("[upload] heartbeat tick failed:",e)})}catch(e){console.warn("[upload] heartbeat tick threw:",e)}},t);return o&&"function"==typeof o.unref&&o.unref(),function(){n||(n=!0,clearInterval(o))}}(()=>J("Upload in progress","running",!0));try{var ne;for(let o=0;o<Q.length;o++){var oe;if(!(X||null!=(oe=n)&&null!=(oe=oe.abort)&&oe.aborted)){if(Y.length<Z){console.debug(`Uploading file ${o}/${k.length}: ${k[o].name}`);let i=0,a=0;const s=C.files[o],r=s.filename,c=I[o],l=s.content_length,p=s.content_type,u=k[o],d=u.name.endsWith(".gz")?"gzip":u.name.endsWith(".br")?"br":void 0,m=hl({uploadId:D.id,uploadRequestPUTUrl:D.request_put_url,entrypointPath:M,file:k[o],fileName:r,fileMd5:s.content_md5,fileBuffer:c,fileType:p,content_encoding:d,fileSize:l,fileIndex:o,fileNumber:o+1,fileCount:ee,loglevel:j,experimental:t.experimental,args:e,options:n,onProgress:e=>{var t;const s=e.progress||0;i=k[o].size*s;const c=i-a;if(a=i,W+=c,null!=(t=n)&&t.progress){const e=W/q,t=k.length,i=k[o].size,a=(Date.now()-V)/1e3,c=K.updateProgress(W/1024/1024);n.progress({uploadedBytes:W,totalBytes:q,progress01:e,fileName:k[o].name,fileSize:i,fileProgress01:s,fileIndex:o,totalFiles:t,estimatedTimeLeftDisplay:c.estimatedTimeRemainingString,estimatedTimeLeft:c.estimatedTimeRemaining,elapsedTime:a}),J(`Uploading file ${o+1}/${t} (${r}): ${(100*s).toFixed(0)}% of ${Pc(q)}. Finished in approx. ${c.estimatedTimeRemainingString}`,"running",!1)}}}).then(e=>{if(!0!==e)return e;for(let e=Y.length-1;e>=0;e--)Y[e]===m&&Y.splice(e,1);J(`Uploaded ${Pc(W)+" of "+Pc(q)} for ${k[o].name}`,"running")}).catch(e=>{var t;null!=(t=n)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),X=!0)});Y.push(m)}Y.length>=Z&&await Promise.race(Y)}}null!=(ne=n)&&null!=(ne=ne.abort)&&ne.aborted?console.debug("Upload aborted"):X&&console.debug("Upload failed"),await Promise.all(Y).catch(e=>{var t;null!=(t=n)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),X=!0)})}finally{te()}if(X)return await Xr({identifier:D.id,status:"failed",error:"Failed to upload files"},e),{success:!1,error:"Failed to upload files"};if(null!=(_=n)&&null!=(_=_.abort)&&_.aborted)return await Xr({identifier:D.id,status:"canceled",status_message:"Upload aborted",error:"Upload aborted"},e),{success:!1,error:"Upload aborted"};G=!0,console.log(`Upload Done: All files uploaded to ${D.id}`);const ie={...Ke(e),id:D.id};"none"!=j&&console.log("Completing upload - notify server");let ae=null;for(let e=0;e<5;e++){var se;await Bc(1e3*e);const t=AbortSignal.timeout(6e4+5e3*e);if(ae=await fetch($+Ve.upload.done,{...Ye,method:"POST",headers:ie,signal:t}).catch(t=>(console.error(`Failed to complete upload (${e+1} / 5)`,t.message),null)),!0===(null==(se=ae)?void 0:se.ok))break;if(ae&&ae.status>=400&&ae.status<500)break;var re;"none"!=j&&e<4&&console.warn(`Failed to complete upload (${(null==(re=ae)?void 0:re.status)||"no status"}): will retry in 1 second`)}if(!ae)return console.error("Failed to complete upload"),{success:!1,error:"Failed to complete upload"};if(!ae.ok){if(524===ae.status)return console.error("Failed to complete upload: Gateway Timeout"),{success:!1,error:"Failed to complete upload: Gateway Timeout"};{const e=await ae.text().catch(()=>"");return console.error(`Failed to complete upload (${ae.status}): ${e}`),{success:!1,error:`Failed to complete upload: ${e?e.substring(0,300):`status ${ae.status}`}`}}}"none"!=j&&console.log("Upload complete");const ce=await ae.json();return{success:!0,type:ce.type,uploadSkipped:!1,id:ce.id,content_id:ce.content_id,url:ce.url,edit_url:ce.edit_url,filesUploaded:k.length,totalSize:q}}(e,t,n);return await o.finally(()=>{})}const il=[".html",".js",".css"],al=[".gz",".br"];function sl(e){return"path"in e&&e.path?e.path:e.name}function rl(e){var t;const n=null==e||null==(t=e.config)?void 0:t.url;if(!n)return null;try{return new URL(n).host}catch{return null}}const cl=400,ll=255;function pl(e){const t="string"==typeof e?e:String(null!=e?e:"");return t.length<=ll?t:t.slice(0,ll-1)+"…"}const ul={ECONNRESET:"connection reset before the upload completed",ECONNREFUSED:"connection refused by the storage host",ECONNABORTED:"connection aborted — timed out or closed mid-request",ENOTFOUND:"DNS lookup failed for the storage host",EAI_AGAIN:"DNS lookup failed temporarily — resolver unavailable",ETIMEDOUT:"connection timed out",EPIPE:"connection closed while sending the file",EHOSTUNREACH:"storage host unreachable from this network",ENETUNREACH:"network unreachable",EPROTO:"TLS or protocol error",ERR_NETWORK:"network error — the request never reached the storage host",CERT_HAS_EXPIRED:"the TLS certificate for the storage host has expired",UNABLE_TO_VERIFY_LEAF_SIGNATURE:"the TLS certificate for the storage host could not be verified",DEPTH_ZERO_SELF_SIGNED_CERT:"a self-signed TLS certificate was presented for the storage host",SELF_SIGNED_CERT_IN_CHAIN:"a self-signed TLS certificate was presented for the storage host"};function dl(e){if(!e)return"unknown upload error";const t=[];try{const i=e.response,a=null==i?void 0:i.status,s=null==i?void 0:i.statusText;a&&t.push(`HTTP ${a}${s?" "+s:""}`);const r=null==i?void 0:i.data;if(null!=r){var n,o;let i;if("string"==typeof r)i=r;else try{i=JSON.stringify(r)}catch{i=String(r)}const a=null==(n=i.match(/<Code>([^<]+)<\/Code>/))?void 0:n[1],s=null==(o=i.match(/<Message>([^<]+)<\/Message>/))?void 0:o[1];if(a)t.push(`S3 ${a}${s?": "+s:""}`);else if(function(e){return/^\s*(<!DOCTYPE\s+html|<html[\s>])/i.test(e)}(i)){const n=rl(e);t.push("blocked by a network filter or proxy"+(n?` before it reached ${n}`:"")+" — ask your network administrator to allow this host")}else i&&t.push(i.slice(0,200))}let c=null;if(!i&&(c=function(e){var t,n;const o=null!=(t=null==e?void 0:e.code)?t:null==e||null==(n=e.cause)?void 0:n.code;return"string"==typeof o&&o.length?o:null}(e),c)){const n=ul[c];t.push(n?`${c} (${n})`:c);const o=rl(e);o&&t.push(`while uploading to ${o}`)}const l=e.message?String(e.message):"",p=a&&/^Request failed with status code \d+$/.test(l)||null!==c&&l.includes(c);l&&!p&&t.push(l)}catch{}return 0===t.length&&e.message&&t.push(String(e.message)),t.length?t.join(" — "):"unknown upload error"}const ml=12e4;function fl(e,t){let n=null,o=!1;const i=()=>{n&&(clearTimeout(n),n=null)};return{reset:()=>{o||(i(),n=setTimeout(()=>{o=!0,n=null,t()},e))},cancel:i}}async function hl(e){if(e.fileSize>=fc)return async function(e){const{uploadId:t,entrypointPath:n,file:o,fileName:i,fileMd5:a,fileType:s,content_encoding:r,fileSize:c,args:l,options:p,onProgress:u,partSize:d,concurrency:m,maxRetries:f,retryDelayMs:h,putPart:g}=e,{baseUrl:v}=l,x=()=>({...Ke(l),"Content-Type":"application/json",org:l.org,job_id:t}),b={...x(),filesize:c.toString()},y=JSON.stringify({filename:i,entrypoint:n,"content-type":s,"content-md5":a,"content-encoding":r,output_index:0});async function w(e,t,n){const o=await fetch(e,{...Ye,method:"POST",headers:t,body:JSON.stringify(n)});if(!o.ok)throw new Error(`${e} ${o.status}: ${await o.text().catch(()=>"")}`);return o.json()}return await async function(e){const{size:t,slice:n,partSize:o=mc,concurrency:i=4,maxRetries:a=5,retryDelayMs:s=1e3,createUpload:r,getPartUrls:c,putPart:l,completeUpload:p,abortUpload:u,onProgress:d,signal:m,checkCancelled:f}=e,h=async()=>{if(m&&m.aborted)return!0;if(f)try{return!!await f()}catch{return!1}return!1};if(await h())throw new Error("Upload aborted");const g=function(e,t=mc){if(!Number.isFinite(e)||e<=0)return[];let n=Math.max(t,uc,Math.ceil(e/dc));const o=[];let i=0,a=1;for(;i<e;){const t=Math.min(i+n,e);o.push({partNumber:a,start:i,end:t,size:t-i}),i=t,a++}return o}(t,o);if(0===g.length)throw new Error("Nothing to upload (size <= 0)");const{upload_id:v,key:x}=await r(),b=await c(v,x,g.map(e=>e.partNumber)),y=new Map(b.map(e=>[e.part_number,e.url])),w=[];let _=0,k=null;const S=async e=>{const t=y.get(e.partNumber);if(!t)throw new Error(`Missing presigned url for part ${e.partNumber}`);let o=!1;const i=await lc(async()=>{if(await h())throw o=!0,new Error("Upload aborted");try{const o=n(e.start,e.end),i=await l({url:t,payload:o,partNumber:e.partNumber,size:e.size,signal:m});if(!i)throw new Error(`No ETag returned for part ${e.partNumber}`);return i}catch(e){throw await h()&&(o=!0),e}},{maxAttempts:a+1,baseMs:s,isRetryable:e=>!o&&rc(e),...s>0?{}:{sleep:async()=>{}}});if(!i.ok)throw i.error||new Error(`Failed to upload part ${e.partNumber}`);w.push({part_number:e.partNumber,etag:i.value}),_+=e.size,d&&d(_)},j=[...g],E=Math.max(1,Math.min(i,g.length));if(await Promise.all(Array.from({length:E},()=>(async()=>{for(;j.length>0;){if(k||await h())return;const e=j.shift();if(!e)return;try{await S(e)}catch(e){return void(k=k||e)}}})())),k||await h())throw await u(v,x).catch(()=>{}),k||new Error("Upload aborted");return w.sort((e,t)=>e.part_number-t.part_number),await p(v,x,w),{ok:!0,key:x,upload_id:v,parts:g.length}}({size:c,partSize:d,concurrency:m,maxRetries:f,retryDelayMs:h,slice:(e,t)=>o.slice(e,t),signal:null==p?void 0:p.abort,onProgress:e=>{u&&u({loaded:e,total:c,progress:c?e/c:0})},createUpload:async()=>{const e=await fetch(v+Ve.upload.multipart_create,{...Ye,method:"POST",headers:b,body:y});if(!e.ok)throw new Error(`multipart/create ${e.status}: ${await e.text().catch(()=>"")}`);const t=await e.json();return{upload_id:t.upload_id,key:t.key}},getPartUrls:async(e,t,n)=>(await w(v+Ve.upload.multipart_part_urls,x(),{key:t,upload_id:e,part_numbers:n})).urls,putPart:g||(({url:e,payload:t,partNumber:n,signal:o})=>async function({url:e,payload:t,partNumber:n,contentType:o,signal:i}){const a=i,s=new AbortController;let r=!1;const c=()=>s.abort();a&&(a.aborted?s.abort():a.addEventListener("abort",c,{once:!0}));const l=fl(ml,()=>{r=!0,s.abort()});l.reset();try{var p,u;const n=await Kr.put(e,t,{...Ye,...await el(),withCredentials:!1,signal:s.signal,headers:{"Content-Type":o},onUploadProgress:()=>l.reset()});if(200!==n.status)throw new Error(dl({response:n}));const i=(null==(p=n.headers)?void 0:p.etag)||(null==(u=n.headers)?void 0:u.ETag);if(!i)throw new Error("part PUT returned no ETag (is the bucket's CORS exposeHeaders:etag set?)");return i}catch(e){if(null!=a&&a.aborted)throw e;if(r)throw new Error(`Part ${n} stalled: no progress for ${ml/1e3}s`);throw new Error(dl(e))}finally{l.cancel(),a&&a.removeEventListener("abort",c)}}({url:e,payload:t,partNumber:n,signal:o,contentType:s})),completeUpload:async(e,t,n)=>w(v+Ve.upload.multipart_complete,x(),{key:t,upload_id:e,parts:n}),abortUpload:async(e,t)=>{await fetch(v+Ve.upload.multipart_abort,{...Ye,method:"POST",headers:x(),body:JSON.stringify({key:t,upload_id:e})}).catch(()=>{})}}),!0}(e);const{uploadId:t,uploadRequestPUTUrl:n,entrypointPath:o,file:i,fileName:a,fileBuffer:s,fileMd5:r,fileSize:c,fileType:l,content_encoding:p,fileIndex:u,fileNumber:d,fileCount:m,loglevel:f,args:h,options:g,experimental:v}=e;"info"===f&&console.log(`Uploading file "${i.name}" type=${l} (${c}) ${i.type} with hash ${r}`);const x={...Ke(h),"Content-Type":"application/json",org:h.org,job_id:t,filesize:c.toString(),progress:(u/m*100).toFixed(0)},b={filename:a,entrypoint:o,"content-type":l,"content-md5":r,"content-encoding":p,output_index:0};"debug"===f&&console.debug("Requesting presigned URL with headers",x);const y=JSON.stringify(b);let w=null,_="";const k=await lc(async()=>{var e;if(null!=g&&null!=(e=g.abort)&&e.aborted)throw new Yr("Upload aborted");const t=await fetch(n,{...Ye,method:"POST",headers:x,body:y});if(!t.ok){const e=await t.text().catch(()=>"");throw _=e,{response:{status:t.status,statusText:t.statusText,data:e}}}return await t.json()},{baseMs:500,onRetry:({attempt:e,waitMs:t,error:n})=>{console.warn(`Failed to get presigned url for "${a}" "${l}": ${dl(n)}\n→ Retry #${e} in ${t}ms`)}});if(k.ok)w=k.value;else if(k.error instanceof Yr)throw k.error;if(null==w){const e=_||dl(k.error);throw new Error(`Failed to get presigned url for "${a}" "${l}" \n${e}`)}const S=w.presigned_url;var j=!1;let E=null;const T=[];let $=0;const O=await lc(async t=>{var n;if(null!=g&&null!=(n=g.abort)&&n.aborted)throw new Yr("Upload aborted");const o={"Content-Type":l,"Content-MD5":r};v&&(o["Content-Length"]=c.toString()),p&&(o["Content-Encoding"]=p),1===t&&"none"!=f&&console.log(`Uploading file ${d}/${m}: ${a}`),"debug"===f&&console.debug("PUT with headers",o);const i=new AbortController;let u=!1;const h=()=>i.abort();null!=g&&g.abort&&(g.abort.aborted?i.abort():g.abort.addEventListener("abort",h,{once:!0}));const x=fl(ml,()=>{u=!0,i.abort()});x.reset();try{const t=await Kr.put(S,s,{...Ye,...await el(),withCredentials:!1,signal:i.signal,headers:o,onUploadProgress:t=>{x.reset(),e.onProgress(t)}});if(200!==t.status)throw{response:t};return t}catch(e){var b;if(null!=g&&null!=(b=g.abort)&&b.aborted)throw new Yr("Upload aborted");if(u)throw E=`stalled: no upload progress for ${ml/1e3}s`,T.push(E),"none"!==f&&console.error(`Upload stalled (PUT) (${d}, ${a}) after ${ml/1e3}s with no progress`),new Error(E);throw E=dl(e),T.push(E),e instanceof Yr||("none"!==f&&console.error(`Failed to upload file (PUT) (${d}, ${a}) "${E}"`),"debug"===f&&(console.log(o,{fileSize:c}),e.response?console.debug(e.response):console.debug(e))),e}finally{x.cancel(),null!=g&&g.abort&&g.abort.removeEventListener("abort",h)}},{onRetry:({attempt:e,waitMs:t})=>{"none"!==f&&console.log(`Retry PUT #${e} for file ${a} in ${t}ms`)}});if($=O.attempts,O.ok)j=!0,"info"===f&&console.log(`Uploaded file ${d}/${m} "${a}" (${l}, ${Pc(c)})`);else if(O.error instanceof Yr)throw O.error;if(!j){var R;const e=null!=(R=function(e){if(!Array.isArray(e))return null;const t=[];for(const n of e){if("string"!=typeof n)continue;const e=n.trim();e&&!t.includes(e)&&t.push(e)}return t.length?t.join("; "):null}(T))?R:E,n=function(e,t,n){const o="string"==typeof t?t.trim():"",i="number"==typeof n&&n>1?` after ${n} attempts`:"";return o?`Failed to upload file ${e}${i}: ${o.length>cl?o.slice(0,cl)+"…":o}`:`Failed to upload file ${e}${i}`}(a,e,$);throw console.error(n),await Xr({identifier:t,status:"failed",status_message:pl(n),error:"Failed to upload file "+a},h),new Error(n)}return!0}async function gl(e,t,n){const o=e.baseUrl+Ve.jobs.presigned_url,i=await fetch(o,{...Ye,method:"POST",headers:{...Ke(e),job_id:t},body:JSON.stringify(n)}).catch(e=>(console.error(e),null));return i&&i.ok?await i.text():(console.error("Failed to get presigned download URL",null==i?void 0:i.status),null)}async function vl(e,t){const n=e.baseUrl+Ve.jobs.create,o={...Ke(e),"content-type":"application/json"},i={type:"ai-material",triggered_by:e.trigger_type,parameters:{...t}},a=await fetch(n,{...Ye,method:"POST",headers:o,body:JSON.stringify(i)});if(!a.ok){const e=await a.text();return console.error(`Failed to request texture generation (${a.status}): ${e}`),{error:e||`Request failed (${a.status})`}}return await a.json().catch(e=>(console.error(e),null))}async function xl(e,t={}){const n=new URL(e.baseUrl+Ve.content.root);t.content_type&&n.searchParams.set("content_type",t.content_type),t.content_format&&n.searchParams.set("content_format",t.content_format),t.search&&n.searchParams.set("search",t.search),t.tags&&n.searchParams.set("tags",t.tags),t.types&&n.searchParams.set("types",t.types),t.trash&&n.searchParams.set("trash","true"),t.is_public&&n.searchParams.set("is_public","true"),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.collection_id&&n.searchParams.set("collection_id",t.collection_id),t.offset&&n.searchParams.set("offset",String(t.offset));const o=Ke(e),i=await fetch(n,{...Ye,method:"GET",headers:o});if(!i.ok){const e=await i.text();throw new Error(`Failed to list content (${i.status}): ${e}`)}return await i.json()}async function bl(e,t){const n=`${e.baseUrl}${Ve.content.root}/${t}`,o=Ke(e),i=await fetch(n,{...Ye,method:"GET",headers:o});if(!i.ok){const e=await i.text();throw new Error(`Failed to get content (${i.status}): ${e}`)}return await i.json()}async function yl(e,t){const n=`${e.baseUrl}${Ve.content.root}/${t}`,o=Ke(e),i=await fetch(n,{...Ye,method:"DELETE",headers:o});if(!i.ok){const e=await i.text();throw new Error(`Failed to delete content (${i.status}): ${e}`)}return await i.json()}const wl={schema:{name:"load_needle_engine_skill",description:'Load the Needle Engine skill: authoritative coding guidelines, component patterns, the Unity/Blender-to-web export workflow, and reference docs. Load this BEFORE answering ANY Needle Engine coding or workflow question — do NOT answer from prior knowledge, which is frequently wrong about how Needle actually works (for example: the relationship between Unity C# scripts and TypeScript components, and what the editor export does — Needle does NOT auto-convert C# logic to TypeScript). ALWAYS load first when the user: shares or asks about Unity C# code (a MonoBehaviour, the Needle.Engine.* namespace) or Blender scripts in a Needle context; asks how a Unity or Blender component maps to, converts to, ports to, or works in Needle Engine or TypeScript; asks about components, lifecycle, serialization, XR, networking, deployment, or the export/codegen pipeline; or reports a Needle Engine bug or error. Do NOT load for greetings or small talk that contains no technical question — wait for the actual question first. Without arguments loads the main skill file. Use the "file" parameter to load specific reference files (e.g. "references/api.md", "references/components.md"). Call without arguments first to discover available references.',inputSchema:{type:"object",properties:{file:{type:"string",description:'File to load relative to the skill root, e.g. "references/api.md". Defaults to the main skill file.'}},additionalProperties:!1,required:[]}},async execute(e){const t=(null==e?void 0:e.file)||"SKILL.md";if(t.includes("..")||t.startsWith("/"))return{error:"Invalid file path."};try{const e="https://raw.githubusercontent.com/needle-tools/ai/main/providers/claude/plugin/skills/needle-engine/"+encodeURI(t),n=new AbortController,o=setTimeout(()=>n.abort(),5e3),i=await fetch(e,{signal:n.signal,redirect:"follow"});return clearTimeout(o),i.ok?{content:await i.text()}:{error:`Could not fetch '${t}' (HTTP ${i.status})`}}catch(e){return{error:`Error fetching skill: ${e.message}`}}}};function _l(e){let t,n=null,o="";for(const i of e.split("\n"))i.startsWith("event: ")?n=i.slice(7).trim():i.startsWith("data: ")?o=i.slice(6):i.startsWith("id: ")&&(t=parseInt(i.slice(4).trim(),10));if(!n)return null;let i=null;switch(n){case"delta":i={type:"delta",content:decodeURIComponent(o)};break;case"message":i={type:"message",content:decodeURIComponent(o)};break;case"status":i={type:"status",message:decodeURIComponent(o)};break;case"error":i={type:"error",message:decodeURIComponent(o)};break;case"notice":i={type:"notice",message:decodeURIComponent(o)};break;case"stopped":i={type:"stopped"};break;case"tool_call":i={type:"tool_call",...JSON.parse(o)};break;case"tool_result":i={type:"tool_result",...JSON.parse(o)};break;case"file_change":i={type:"file_change",...JSON.parse(o)};break;case"message_inserted":i={type:"message_inserted",...JSON.parse(o)};break;case"elicitation":i={type:"elicitation",...JSON.parse(o)};break;case"done":{const e=JSON.parse(o),{chat_url:t,...n}=e;i={type:"done",token_usage:n},t&&(i.chat_url=t);break}case"message_id":i={type:"message_id",message_id:decodeURIComponent(o)};break;case"chat_id":i={type:"chat_id",chat_id:decodeURIComponent(o)}}return i&&void 0!==t&&(i.id=t),i}function kl(e,t){const n=Ke(e);return null!=t&&t.personal&&(n["x-needle-ai-chat"]="personal"),null!=t&&t.instanceId&&(n["x-needle-instance-id"]=t.instanceId),n}function Sl(e,t){return t.stream?async function*(e,t){const n=new URL(e.baseUrl+Ve.ai.chat),o=kl(e,t);o["Content-Type"]="application/json";const i={type:"new_message",slug:t.slug,message:t.message,stream:!0,source:t.source,allow_file_edits:!0===t.allowFileEdits,file_edit_session_id:!0===t.allowFileEdits?t.fileEditSessionId:void 0,full_url:t.full_url,pathname:t.pathname,context:t.context,disabled_tools:t.disabled_tools},a=await fetch(n,{...Ye,method:"POST",headers:o,body:JSON.stringify(i)});if(!a.ok){const e=await a.text();throw new Error(`Failed to stream chat message (${a.status}): ${e}`)}if(!a.body)throw new Error("Response body is null — streaming not supported in this environment");yield*async function*(e){const t=e.getReader(),n=new TextDecoder;let o="";try{for(;;){const{done:e,value:i}=await t.read();if(e)break;o+=n.decode(i,{stream:!0});const a=o.split("\n\n");o=a.pop()||"";for(const e of a){const t=_l(e);t&&(yield t)}}if(o.trim()){const e=_l(o);e&&(yield e)}}finally{t.releaseLock()}}(a.body)}(e,t):async function(e,t){const n=new URL(e.baseUrl+Ve.ai.chat),o=kl(e,t);o["Content-Type"]="application/json";const i={type:"new_message",slug:t.slug,message:t.message,stream:!1,source:t.source,allow_file_edits:!0===t.allowFileEdits,file_edit_session_id:!0===t.allowFileEdits?t.fileEditSessionId:void 0,full_url:t.full_url,pathname:t.pathname,context:t.context,disabled_tools:t.disabled_tools},a=await fetch(n,{...Ye,method:"POST",headers:o,body:JSON.stringify(i)});if(!a.ok){const e=await a.text();throw new Error(`Failed to send chat message (${a.status}): ${e}`)}return await a.json()}(e,t)}const jl=200,El=["github.com","gitlab.com","bitbucket.org"],Tl=/[\w.+-]+@[\w-]+\.[\w.]+/;function $l(e){if(e)return Tl.test(e)?void 0:e}function Ol(e,t){return String(v("git",e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],...t?{cwd:t}:{}})||"").trim()}function Rl(e,t){try{return Ol(e,t)}catch{return""}}function Al(e){try{const t=Ol(["rev-parse","HEAD"],e);if(!t)return null;const n=Rl(["rev-parse","--abbrev-ref","HEAD"],e),o=Rl(["log","-1","--pretty=%s"],e),i=$l(Rl(["log","-1","--pretty=%an"],e)),a=Rl(["status","--porcelain"],e).length>0,s=Rl(["remote","get-url","origin"],e),r=t.slice(0,7),{repository:c,url:l}=function(e,t){if(!e)return{};const n=/^(?:https?:\/\/(?:[^@/]+@)?([^/]+)\/|git@([^:]+):)(.+?)(?:\.git)?$/.exec(e.trim());if(!n)return{};const o=(n[1]||n[2]||"").toLowerCase(),i=n[3];return i?El.includes(o)?{repository:i,url:`https://${o}/${i}/${"bitbucket.org"===o?"commits":"commit"}/${t}`}:{repository:i}:{}}(s,t),p={type:"git",id:t,label:`${n||r}@${r}${a?" (dirty)":""}`};return n&&(p.branch=n),i&&(p.author=i),o&&(p.message=o.slice(0,jl)),a&&(p.dirty=!0),c&&(p.repository=c),l&&(p.url=l),p}catch{return null}}function Cl(e){if("string"==typeof e)return e.trim()||void 0}const Nl=()=>"https://cloud.needle.tools/account",Il=()=>"https://cloud.needle.tools/edit";function Pl(e){return x(e)}const Ul=["node_modules",".git",".vscode",".vercel",".github",".idea"];function Ll(e,t,n=null,o="",i=0){if(null===n){if(i>0)throw new Error("result must be provided if level > 0. Did you forget to pass it?");n={files:[],total_size:0}}if(0===i){if(!c(t))throw new Error(`Directory or file "${t}" does not exist.`);if(l(t).isFile()){const e=$c(t,p(t));return e.path=e.name,n.files.push(e),n.entrypoint=e,n}}else if(i>20)throw new Error("Recursion depth too high. Are you sure you are providing the correct directory?");const a=u(t,{withFileTypes:!0});for(const i of a)if(0==i.isDirectory()){if("optimization"===e&&0==((s=(s=i.name).toLowerCase()).endsWith(".glb")||s.endsWith(".gltf")||s.endsWith(".vrm")||s.endsWith(".usdz")||s.endsWith(".usd")||s.endsWith(".fbx")))continue;const a=$c(o+i.name,p(t+"/"+i.name));if(n.files.push(a),n.total_size+=a.size,n.total_size>1073741824)throw new Error(`Collected filesize exceeds ${1024..toFixed(0)} MB. Are you sure you are providing the correct directory?`);if(n.files.length>1e4)throw new Error(`Too many files (${n.files.length}): The maximum filecount is 10,000.`)}var s;for(const s of a)if(s.isDirectory()){if(Ul.includes(s.name))continue;Ll(e,t+"/"+s.name,n,o+s.name+"/",i+1)}return n}const zl=new RegExp("\\beyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\b","g"),Fl=new RegExp("\\b[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\\b","gi"),Dl=new RegExp("(Authorization:\\s*)([^\\s,;\"']+(?:\\s+[^\\s,;\"']+)?)","gi"),ql=new RegExp("\\bBearer\\s+([A-Za-z0-9._\\-=]+)","g"),Bl=new RegExp("([?&]token=)([^&\\s\"'<>]+)","g"),Ml=new RegExp("<redacted:\\d+ch>","g");function Wl(e){if("string"!=typeof e)return e;if(0===e.length)return e;if(Ml.test(e)&&(Ml.lastIndex=0,!function(e){zl.lastIndex=0,Fl.lastIndex=0,Dl.lastIndex=0,ql.lastIndex=0,Bl.lastIndex=0;const t=zl.test(e)||Fl.test(e)||Dl.test(e)||ql.test(e)||Bl.test(e);return zl.lastIndex=0,Fl.lastIndex=0,Dl.lastIndex=0,ql.lastIndex=0,Bl.lastIndex=0,t}(e.replace(Ml,""))))return e;Ml.lastIndex=0;let t=e;return t=t.replace(Dl,(e,t,n)=>`${t}<redacted:${n.length}ch>`),t=t.replace(Bl,(e,t,n)=>`${t}<redacted:${n.length}ch>`),t=t.replace(ql,(e,t)=>`<redacted:${("Bearer "+t).length}ch>`),t=t.replace(zl,e=>`<redacted:${e.length}ch>`),t=t.replace(Fl,e=>`<redacted:${e.length}ch>`),t}const Gl=["cli.log","cli.prev.log"],Hl=J.join(G.homedir(),".needle","cli","logs");$(Hl,{recursive:!0});try{!function(e,t){const n={migrated:[],skipped:[]};if(!e||!t)return n;if(J.resolve(e)===J.resolve(t))return n;if(!T(e))return n;for(const o of Gl){const i=J.join(e,o);if(T(i))try{$(t,{recursive:!0});const e=J.join(t,o);if(T(e)){const e=J.join(t,o.replace(/\.log$/,"")+".legacy.log");O(i,e),n.skipped.push(o)}else O(i,e),n.migrated.push(o)}catch(e){console.error(`[needle-cloud] Failed to migrate legacy log ${o}: ${e instanceof Error?e.message:e}`)}}}(J.join(R(G.tmpdir()),"Needle","Cloud","logs"),Hl)}catch(e){console.error(`[needle-cloud] legacy log migration check failed: ${e instanceof Error?e.message:e}`)}const Jl=J.resolve(Hl,"cli.log");if(T(Jl)){const e=A(Jl),t=e.mtimeMs;if(Date.now()-t>432e5||e.size>52428800){const e=Kl();C(Jl,e,t=>{t?console.error(`Failed to rename log file: ${t.message}`):console.log(`Log file renamed to ${e}`)})}}function Vl(){return Jl}function Kl(){return J.resolve(Hl,"cli.prev.log")}function Yl(e,t){try{let n=Wl(String(null!=e?e:""));return n=`[${(new Date).toISOString()}] ${n}`,null!=t&&t.emptyLineBefore&&(n="\n"+n),N(Jl,n+"\n"),!0}catch(e){return console.error(`Failed to write to log file: ${e instanceof Error?e.message:e}`),!1}}async function Zl(e,t){return e=Wl(e),e=`[${(new Date).toISOString()}] ${e}`,null!=t&&t.emptyLineBefore&&(e="\n"+e),W(Jl,e+"\n",{flag:"a"}).then(()=>!0).catch(e=>(console.error(`Failed to write to log file: ${e.message}`),!1))}var Xl={__proto__:null,getLogFilePath:Vl,getPrevLogsFilePath:Kl,getPipelineLogFilePath:function(){return J.join(G.homedir(),".needle","optimization-pipeline","logs","pipeline.log")},writeToLogFileSync:Yl,writeToLogFile:Zl};function Ql(e,t,n){process.env.GITHUB_ACTIONS&&(process.env.GITHUB_OUTPUT?d(process.env.GITHUB_OUTPUT,`${e}=${t}\n`):null==n||n.logger.warn("GITHUB_OUTPUT environment variable is not set. Cannot set output variables."))}async function ep(e){var t;e.directory=b.resolve(e.directory);let{files:n,entrypoint:o}=Ll("deployment",e.directory);if(e.entrypoint&&(o=n.find(t=>t.path===e.entrypoint),!o))return process.exitCode=1,void E().fail(`Entrypoint "${e.entrypoint}" not found. Please make sure you provide a valid entrypoint.`);if(!o){const e=Hc(n);if("error"in e)return process.exitCode=1,Zl(`[Deployment] Error determining entrypoint: ${e.error}`),void E().fail(`Error: ${e.error}`);o=e}if(!(n.length>0&&o&&(o.name.toLowerCase().endsWith(".html")||o.name.toLowerCase().endsWith(".html.gz")||o.name.toLowerCase().endsWith(".html.br"))))return process.exitCode=1,Zl("[Deployment] Deployment is not valid: No .html file found."),void E().fail("Deployment is not valid: No .html file found.");if(!o)return process.exitCode=1,Zl("[Deployment] No entrypoint found. Please provide an index.html file in your project."),void E().fail("No entrypoint found. Please provide an index.html file in your project.");const i=null!=(t=e.endpoint)&&t.length?e.endpoint:"https://cloud.needle.tools/api";let a=e.name;a||(a=tp(e.directory)||void 0);let s=null==i?void 0:i.includes("localhost");const r=a?` of "${a}"`:"",c=E().start(`Begin deployment${r} ${s?"(local)":""} of ${n.length} files...`);c.spinner="earth",await Bc(50);let l=-1,p=null;const u=e.noProvenance?null:function(e=process.env,t,n){try{return function(e=process.env,t){try{if(Cl(e.NEEDLE_CLOUD_NO_PROVENANCE))return null;let n=Al(t);Cl(e.GITHUB_ACTIONS)&&(n=function(e,t){var n,o;const i=Cl(t.GITHUB_SHA),a=Cl(t.GITHUB_REF_NAME),s=Cl(t.GITHUB_REPOSITORY),r=null!=(n=Cl(t.GITHUB_SERVER_URL))?n:"https://github.com";if(!i&&!a)return e;const c={type:"git",...null!=e?e:{}};i&&(c.id=i),a&&(c.branch=a),s&&(c.repository=s),s&&i&&(c.url=`${r}/${s}/commit/${i}`);const l=String(null!=(o=c.id)?o:"").slice(0,7);return l&&(c.label=`${a||l}@${l}${c.dirty?" (dirty)":""}`),c}(n,e));const o=function(e=process.env){var t;if(!Cl(e.CI))return{type:"local"};if(!Cl(e.GITHUB_ACTIONS))return{type:"ci"};const n={type:"github-actions"},o=Cl(e.GITHUB_RUN_ID),i=Cl(e.GITHUB_REPOSITORY),a=null!=(t=Cl(e.GITHUB_SERVER_URL))?t:"https://github.com";o&&(n.id=o);const s=$l(Cl(e.GITHUB_ACTOR));return s&&(n.actor=s),Cl(e.GITHUB_EVENT_NAME)&&(n.event=Cl(e.GITHUB_EVENT_NAME)),o&&i&&(n.url=`${a}/${i}/actions/runs/${o}`),n}(e);return n||"local"!==o.type?{...n?{source:n}:{},runner:o,client:{name:"needle-cloud-cli"}}:null}catch(e){var n;return console.warn(`[provenance] Could not determine provenance: ${null!=(n=null==e?void 0:e.message)?n:e}`),null}}(e,t&&Al(t)?t:n)}catch(e){var o;return console.warn(`[provenance] Could not determine provenance: ${null!=(o=null==e?void 0:e.message)?o:e}`),null}}(process.env,e.directory);if(null!=u&&u.source){var d;const{label:e,author:t}=u.source;Zl(`[provenance] ${e}${t?` by ${t}`:""} (${null==(d=u.runner)?void 0:d.type})`)}Zl(`Deployment started${r} ${s?"(local)":""} of ${n.length} files...`);const m=await ol({baseUrl:i,authToken:e.token,org:e.org_id},{triggered_by:"cli",files:n,entrypoint:o,experimental:e.experimental,raw:e.raw,...u?{metadata:u}:{}},{name:a,type:"deployment",loglevel:e.verbose?"debug":"none",progress:e=>{if(e.fileIndex!==l){l=e.fileIndex;const t=e.totalBytes/1024/1024;c.text=`Uploading file ${e.fileIndex+1} of ${e.totalFiles} files: ${(e.uploadedBytes/1024/1024).toFixed(1)} / ${t.toFixed(1)} MB. Total progress: ${(100*e.progress01).toFixed(1)} %. Time passed: ${e.elapsedTime.toFixed(0)}sec. About ${e.estimatedTimeLeftDisplay} until complete.`}}}).catch(e=>(p=e instanceof Error?e.message:String(e),null));if(null!=m&&!0===m.success){c.succeed(`🚀 Deployment${r} successful (${m.content_id}/${m.id})`);let t="";t=m.url?m.url:"https://cloud.needle.tools/view/"+m.content_id+"/"+m.id,console.log("🔗 View the deployment at: "+t),e.open&&Pl(t);try{Ql("deployment_url",t,{logger:e.logger}),Ql("edit_id",m.content_id,{logger:e.logger})}catch(t){e.logger.error("Error writing output for CI: "+t)}}else{process.exitCode=1;const e=p||(null==m?void 0:m.error)||"Deployment failed";Zl(`[Deployment] Failed: ${e}`),c.fail(e)}}function tp(e,t=0){if(t>10)return null;const n=b.join(e,"needle.config.json");if(c(n)){const t=b.join(e,"package.json");if(c(t)){var o;const e=p(t,"utf8"),n=JSON.parse(e);if(null!=(o=n.name)&&o.length)return n.name}return b.basename(e)}const i=b.dirname(e);return i===e?null:tp(i,t+1)}async function np(e,t={}){const n=t.purposeLabel?` ${t.purposeLabel}`:"";if(!c(e.fileOrDirectory))return E().fail(`File not found: ${e.fileOrDirectory}`),{error:"File not found"};if(!e.token||e.token.length<=1||"string"!=typeof e.token||"true"===e.token)return{error:`Missing access token. Create a token at ${Nl()}`};if(void 0!==e.name&&e.name&&(e.name.length<=0||"true"===e.name||"false"===e.name))return{error:`Name is not valid: "${e.name}". Please provide a valid name`};e.fileOrDirectory=y(e.fileOrDirectory);const o=E(`Gathering files ${e.fileOrDirectory}`).start();let i=null;try{i=Ll("optimization",e.fileOrDirectory)}catch(t){return E().fail(`${t.message||`Failed to collect files in ${e.fileOrDirectory}`}`),{error:"Failed to collect files"}}o.text=`Uploading ${i.files.length} files${n}:\n- ${i.files.map(e=>e.path||e.name).join("\n -")}`;const a="https://cloud.needle.tools/api";e.verbose&&console.log("Using endpoint:",a);const s=function(e){var t,n;if(function(e){return e.some(e=>{let t=e.name.toLowerCase();return!!(t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".html.gz")||t.endsWith(".html.br"))||"mimetype"in e&&"text/html"===e.mimetype})}(e))return{kind:"deployment",contentType:void 0,uploadType:"deployment",canOptimize:!1,canConvertToGLB:!1};if(function(e){if(null==e||!e.length)return!1;const t=e.filter(e=>Ac(e.name)||Cc(e.name)||Nc(e.name));return 1===t.length&&Hc(e)===t[0]}(e))return{kind:"environment-texture",contentType:"hdri",uploadType:void 0,canOptimize:!1,canConvertToGLB:!1};const o=null!=(t=null==(n=e[0])||null==(n=n.name.split(".").pop())?void 0:n.toLowerCase())?t:"";return{kind:"asset",contentType:"3d-asset",uploadType:void 0,canOptimize:e.some(e=>{var t;const n=null==(t=e.name.split(".").pop())?void 0:t.toLowerCase();return null!=n&&Jc.has(n)}),canConvertToGLB:Vc.has(o)}}(i.files),r="asset"===s.kind?void 0:s.contentType,l=await ol({baseUrl:a,authToken:e.token,org:e.org_id},{triggered_by:"cli",files:i.files,entrypoint:i.entrypoint},{type:s.uploadType||"upload",name:e.name,content_type:r,...!1===t.optimizations?{optimizations:!1}:{},loglevel:e.verbose?"debug":"none",progress:e=>{o.text=`Uploading ${e.fileName} - finished in approx. ${e.estimatedTimeLeftDisplay}, ${100*e.progress01}%`}});if(0==l.success){const e=`${l.error||"Unknown error: could not start upload"}`;return o.fail(e),{error:e,noprint:!0}}const p=l.edit_url||`${Il()}/${l.content_id}?select_team=1`;return o.succeed(l.uploadSkipped?`Files have already been uploaded to ${p}`:`Uploaded ${i.files.length} files${n} to ${p}`),{res:l,editUrl:p}}async function op(e){if(!e.outDir)throw new Error("Output directory is required");const t=E("Downloading results...").start(),n=await async function(e){const t=await async function(e){if(!e.identifier)return null;const t={...Ke(e)},n={job_id:e.identifier,fields:e.fields,content_format:e.content_format},o=e.baseUrl+Ve.jobs.query,i=await fetch(o,{...Ye,method:"POST",headers:t,body:JSON.stringify(n)}).catch(e=>(console.error(e),null));if(null==i)return null;if(!i.ok)return console.error("Failed to get job",i.status,await i.text()),null;const a=await i.json().catch(e=>(console.error(e),null));return null==a?null:a.job}({baseUrl:e.baseUrl,authToken:e.authToken,org:e.org,identifier:e.identifier,fields:["results"],content_format:e.content_format});if(null==t||!t.results)return{error:`Job ${e.identifier} did not produce any result files`};const n=t.results;if(!n.bucket||!n.directory)return{error:`Job ${e.identifier} has incomplete result data`};const o=[];for(const t of n.files){if((i=t.filename).startsWith(".extras/")||i.startsWith(".extras\\")||i.endsWith("screenshot.needle.webp")||Zr.test(i)||i.endsWith(".needle.log"))continue;const a=`${n.directory}/${t.filename}`,s=await gl(e,e.identifier,{bucket:n.bucket,key:a});if(!s){console.error(`Failed to get presigned URL for: ${t.filename}`);continue}const r=await fetch(s).catch(e=>(console.error(e),null));if(!r||!r.ok){console.error(`Failed to download (${null==r?void 0:r.status} | ${null==r?void 0:r.statusText}): ${t.filename}`);continue}const c=await r.arrayBuffer().catch(e=>(console.error(e),null));if(!c)return{error:`Failed to read downloaded file: ${t.filename}`};o.push({filename:t.filename,data:c})}var i;return{files:o}}({baseUrl:e.baseUrl,authToken:e.authToken,org:e.org,identifier:e.identifier,content_format:e.content_format});if("error"in n)return t.fail(n.error),{error:n.error};const o=[];for(const i of n.files){t.text=`Downloading ${i.filename}`,c(e.outDir)||m(e.outDir,{recursive:!0});let a=i.filename;if(e.filename){const t=i.filename.substring(i.filename.lastIndexOf("."));if(1===n.files.length)a=e.filename.includes(".")?e.filename:e.filename+t;else{const t=i.filename.substring(i.filename.lastIndexOf(".")),n=i.filename.substring(0,i.filename.lastIndexOf("."));a=e.filename+"-"+n+t}}const s=e.outDir+"/"+a,r=s.split("/").slice(0,-1).join("/");c(r)||m(r,{recursive:!0}),e.verbose&&console.log(`Writing ${i.filename} (${(i.data.byteLength/1024).toFixed(2)} KB) to "${s}"`),f(s,Buffer.from(i.data)),o.push(s)}return t.succeed(`Downloaded ${o.length} ${1===o.length?"file":"files"}: ${o.join(", ")}`),e.verbose&&console.log("Downloaded files:\n",o),{success:!0,paths:o}}async function ip(e){const{token:t,org_id:n,slug:o,message:i,stream:a}=e;if(a){const e=Sl({baseUrl:"https://cloud.needle.tools/api",authToken:t,org:n},{slug:o,message:i,stream:!0,source:"cli"});for await(const t of e)switch(t.type){case"delta":process.stdout.write(t.content);break;case"message":break;case"status":process.stdout.write(`[${t.message}]\n`);break;case"error":return void E().fail(t.message);case"tool_call":process.stdout.write(`[tool: ${t.name}]\n`);break;case"done":process.stdout.write("\n")}}else{const e=E("Thinking...").start(),a=await Sl({baseUrl:"https://cloud.needle.tools/api",authToken:t,org:n},{slug:o,message:i,stream:!1,source:"cli"});e.stop(),console.log(a.content)}}async function ap(e,t=yl){if(!e.identifier)throw new Error("A content identifier is required");return t({baseUrl:e.endpoint,authToken:e.authToken,org:e.org},e.identifier)}async function sp(e){const t=new URL((e.endpoint||"https://cloud.needle.tools/api")+Ve.get.deployments);t.searchParams.append("offset",e.offset.toString()),t.searchParams.append("limit",e.limit.toString()),e.names&&t.searchParams.append("name",e.names.map(e=>e.trim()).join(","));const n=await fetch(t,{method:"GET",headers:{...Ke({authToken:e.authToken,org:e.org})}});return n.ok?await n.json():{status:n.status,error:await n.text()}}const rp=["#e06c75","#d19a66","#e5c07b","#98c379","#7ec8a4","#56b6c2","#61afef","#528bff","#c678dd","#e88de4","#be5046","#d4976c","#b5cea8","#4ec9b0","#9cdcfe","#c8ae9d"];function cp(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;const[n,o,i]=function(e){const t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,255&t]}(rp[Math.abs(t)%rp.length]);return`[38;2;${n};${o};${i}m${e}`}function lp(e){return`${e}`}const pp=8424,up="http://localhost:8424",dp=/^\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)\]\s?(.*)$/,mp=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2}):\s*(.*)$/,fp=[[/^\[MCP\]|^MCP (New session|websocket server|Request|SSE|Bridge)|^Unknown MCP/,"mcp"],[/^Needle Cloud connection:|^Cloud tool (request|result|error):/,"cloud"],[/^Denied:/,"denial"],[/^Local (server|token)|^Starting Needle CLI server|^Restarting auth server|^Server is running|^Running server uses different/,"server"],[/^OIDC:|^Sign in|^Sign out|^User logged in|^Logged in successfully|^Token refresh failed|^Failed to validate (login|logout)|^Getting access token|^No access token|^ERR: Missing NEEDLE_CLOUD_TOKEN|^Too many logins|^WARN: You do not have a default organization|^User signed in|^Error during sign in/,"auth"],[/^Settings(:| changed)/,"settings"],[/^\[Deployment\]|^Deployment started/,"deployment"],[/^\[generate-material\]/,"ai"],[/^Active project changed|^Error saving project info/,"project"]],hp=[[/^ERR:|^ERROR:|^Error\b|^Failed\b/,"error"],[/\bconnection: error\b|\bFailed to\b|\b(Token refresh failed)\b|\b(rejected|terminating|pong timeout)\b/i,"error"],[/^WARN:|^WARNING:|^Warning\b/,"warn"]];function gp(e){for(const[t,n]of fp)if(t.test(e))return n;return"general"}function vp(e){for(const[t,n]of hp)if(t.test(e))return n;return"info"}const xp=new RegExp("\\b([A-Z][A-Z0-9_]*(?:_KEY|_TOKEN|_SECRET|_PASSWORD))=([^\\s,;\"']+)","g"),bp=new RegExp("\\b(User(?:name)?:\\s*)([A-Za-z0-9._\\-]{1,64})","g"),yp=new RegExp("\\b[A-Za-z0-9._%+\\-]+@[A-Za-z0-9.\\-]+\\.[A-Za-z]{2,}\\b","g"),wp=52428800;function _p(e,t){if(!T(e))return null;if(t<=0)return"";const{size:n}=A(e);if(0===n)return"";const o=n>t?n-t:0,i=n-o,a=Buffer.allocUnsafe(i),s=I(e,"r");try{let e=0;for(;e<i;){const t=P(s,a,e,i-e,o+e);if(0===t)break;e+=t}}finally{U(s)}if(o>0){const e=a.indexOf(10);return-1===e?"":a.slice(e+1).toString("utf8")}return a.toString("utf8")}async function*kp(e){const t=Se({input:L(e,{encoding:"utf8"}),crlfDelay:Infinity});for await(const e of t)yield e}function Sp(e,t,n,o){var i,a;if(0===e.length)return[];const s=function(e){if("string"!=typeof e)return{ts:null,level:"info",source:"general",message:""};let t=null,n=e,o=e.match(dp);if(o)t=o[1],n=o[2];else if(o=e.match(mp),o){const e=new Date(`${o[1]}T${o[2]}`);Number.isNaN(e.getTime())||(t=e.toISOString(),n=o[3])}return{ts:t,level:vp(n),source:gp(n),message:n}}(e),r=null!=(i=null!=(a=s.ts)?a:n)?i:null,c=s.level,l=null!=t?t:s.source;return function(e){if("string"!=typeof e)return[e];if(e.length<=16384)return[e];const t=e.length,n=Math.max(1,16344),o=Math.ceil(t/n),i=[];for(let a=0;a<o;a++){const s=a*n,r=e.slice(s,s+n);i.push(`${r} [chunk ${a+1}/${o} of ${t} bytes]`)}return i}(function(e,t){if("string"!=typeof e)return e;if(0===e.length)return e;let n=Wl(e);return n=function(e,t){if(!t)return e;const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\\/g,"\\\\+"),o=new RegExp(n,"gi");return e.replace(o,"~")}(n,null==t?void 0:t.homeDir),n=function(e){return e.replace(xp,(e,t,n)=>`${t}=<redacted:${n.length}ch>`)}(n),n=function(e){return e.replace(bp,(e,t,n)=>`${t}<redacted:${n.length}ch>`)}(n),n=function(e){return e.replace(yp,e=>`<redacted:${e.length}ch>`)}(n),n}(s.message,o)).map(e=>({ts:r,level:c,source:l,message:e}))}const jp="https://haystack.needle.tools/api/ingest/logs",Ep="https://haystack.needle.tools";async function Tp(e){try{return await e.json()}catch{return null}}async function $p(e){try{return await e.text()}catch{return""}}function Op(e){const t=e instanceof Error?e.message:String(e),n=e&&"object"==typeof e?e.cause:void 0;let o=t;if(n){const e=n instanceof Error?n.message:String(n),t="object"==typeof n&&null!==n?n.code:void 0;o=t?`${e} (${t})`:e}return`Network error reaching ${jp}: ${o}`}var Rp,Ap={__proto__:null,HAYSTACK_RESOURCE:Ep,runSendLogs:async function(e,t){var n;let o=await t.getAccessToken();if(!o&&t.recoverAuth)try{t.stdout.write("Updating sign-in (your stored permissions need a one-time refresh)...\n"),o=await t.recoverAuth()}catch{o=null}if(!o)return{ok:!1,error:"Not signed in. Run `needle-cloud login` first, then retry."};const i={type:"meta",...t.meta,mode:e.mode,...e.note?{note:e.note}:{}},a=t.findActiveEditorLog(),s=function(e){const t=je.from(async function*(e){if(yield JSON.stringify(e.meta)+"\n",e.prevLogPath&&T(e.prevLogPath)){let t=null;for await(const n of kp(e.prevLogPath)){const o=Sp(n,null,t,e.redactOpts);for(const e of o)e.ts&&(t=e.ts),yield JSON.stringify(e)+"\n"}}if(e.cliLogPath&&T(e.cliLogPath)){let t=null;for await(const n of kp(e.cliLogPath)){const o=Sp(n,null,t,e.redactOpts);for(const e of o)e.ts&&(t=e.ts),yield JSON.stringify(e)+"\n"}}if(e.editor){var t,n;const o=null!=(t=e.editor.tailBytes)?t:wp,i=null!=(n=e.editor.paths)?n:e.editor.path?[e.editor.path]:[];for(const t of i){const n=_p(t,o);if(!n)continue;let i=null;try{i=A(t).mtime.toISOString()}catch{}for(const t of n.split("\n")){const n=Sp(t,e.editor.editor,i,e.redactOpts);for(const e of n)e.ts&&(i=e.ts),yield JSON.stringify(e)+"\n"}}}if(e.pipelineLogPath&&T(e.pipelineLogPath)){var o;const t=null!=(o=e.pipelineTailBytes)?o:wp,n=_p(e.pipelineLogPath,t);if(n){let t=null;try{t=A(e.pipelineLogPath).mtime.toISOString()}catch{}for(const o of n.split("\n")){const n=Sp(o,"gltf-build-pipeline",t,e.redactOpts);for(const e of n)e.ts&&(t=e.ts),yield JSON.stringify(e)+"\n"}}}}(e),{objectMode:!1});return t.pipe(Ee())}({meta:i,cliLogPath:t.paths.cliLogPath,prevLogPath:t.paths.prevLogPath,editor:a,pipelineLogPath:null!=(n=t.paths.pipelineLogPath)?n:null,redactOpts:{homeDir:t.paths.homeDir}});if(e.dryRun){const{gunzipSync:e}=await import("node:zlib"),n=[];for await(const e of s)n.push(e);const o=e(Buffer.concat(n)).toString("utf8");return t.stdout.write(o),{ok:!0}}let r,c;try{const e=[];for await(const t of s)e.push(t);r=Buffer.concat(e)}catch(e){return{ok:!1,error:`Failed to build upload payload: ${e instanceof Error?e.message:String(e)}`}}try{c=await t.fetch(jp,{method:"POST",body:r,headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/x-ndjson","Content-Encoding":"gzip"}})}catch(e){return{ok:!1,error:Op(e)}}if(401===c.status){const e=await $p(c);return{ok:!1,error:`401 Unauthorized from ${jp}: ${e&&e.length>0?e:"no reason given"} (try \`needle-cloud login\` if your sign-in expired; if you're already signed in, the server may not accept this token's issuer/audience)`}}if(429===c.status){const e=await $p(c);return{ok:!1,error:`429 Rate-limited: ${e&&e.length>0?e:"no reason given"}. You've hit the upload quota for this account; try again later.`}}if(413===c.status){const e=await Tp(c);return{ok:!0,refId:null==e?void 0:e.ref_id,truncated:!0}}if(!c.ok){const e=await $p(c);return(400===(l=c.status)||l>=500)&&await async function({token:e,fetch:t,baseMeta:n,status:o,bodyText:i}){const{gzipSync:a}=await import("node:zlib"),s={type:"meta",...n,mode:"crash",note:"send-logs upload error follow-up"},r={ts:(new Date).toISOString(),level:"error",source:"send-logs",message:`Upload failed: status=${o} body=${(null!=i?i:"").slice(0,1024)}`},c=JSON.stringify(s)+"\n"+JSON.stringify(r)+"\n",l=a(Buffer.from(c,"utf8"));await t(jp,{method:"POST",body:l,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/x-ndjson","Content-Encoding":"gzip"}})}({token:o,fetch:t.fetch,baseMeta:t.meta,status:c.status,bodyText:e}).catch(()=>{}),{ok:!1,error:`Server returned ${c.status}: ${e}`}}var l;const p=await Tp(c);return{ok:!0,refId:null==p?void 0:p.ref_id,truncated:Boolean(null==p?void 0:p.truncated)}}};const Cp={appId:"2stnsoa6a1b0gwc7lra55",appSecret:"seV1T6iKBKLlttjdk25I2px43ZCEHnPJ",endpoint:"https://auth.needle.tools",resources:["https://cloud.needle.tools/api",Ep],scopes:["openid","profile","email","roles","urn:logto:scope:organizations","urn:logto:scope:organization_roles","identities","custom_data","all","read","write","delete","upload","download","invite","editor","cli:logs:write"]},Np={getAccessToken:!0,fetchUserInfo:!0,resource:null==(Rp=Cp.resources)?void 0:Rp[0],resources:Cp.resources||[],scopes:Cp.scopes||[]};function Ip(e="default"){return null==e?`${up}/?signed-out=1`:"too-many-logins"===e?`${up}/?too-many-logins=1`:"error"===e?`${up}/?error=1`:`${up}/?signed-out=1`}var Pp;function Up(){zp.clear(),r.existsSync(qp)&&r.rmSync(qp,{recursive:!0}),r.existsSync(Bp)&&r.rmSync(Bp,{recursive:!0})}const Lp=process.argv.includes("--debug-auth"),zp=new Map;let Fp=null==(Pp=Cp.resources)?void 0:Pp[0];if(Fp)try{Fp=new URL(Fp).hostname}catch(e){Lp&&console.error("Invalid resource URL",Fp)}let Dp=Fp||"-";Dp=Dp.replace(/[^a-zA-Z0-9\.\-]/g,"");const qp=b.join(he(),".needle",".auth",Dp),Bp=`${ge()}/Needle/Cloud/.auth/${Dp}`;!function(){if(r.existsSync(Bp)){Lp&&console.debug("Migrating auth data from legacy location",Bp,"→",qp);try{r.existsSync(qp)||r.mkdirSync(qp,{recursive:!0,mode:448});for(const e of r.readdirSync(Bp)){const t=b.join(Bp,e),n=b.join(qp,e);r.statSync(t).isFile()&&!r.existsSync(n)&&(r.copyFileSync(t,n),r.chmodSync(n,384))}r.rmSync(Bp,{recursive:!0}),Lp&&console.debug("Legacy auth data migrated successfully")}catch(e){Lp&&console.error("Failed to migrate legacy auth data",e)}}}();const Mp={accessToken:`${qp}/accessToken`,refreshToken:`${qp}/refreshToken`,idToken:`${qp}/idToken`,signInSession:`${qp}/signInSession`};function Wp(e){return Mp[e]||`${qp}/${e}`}const Gp=new class{constructor(){this.basePath=qp}async setItem(e,t){Lp&&console.debug("\n- SET ITEM",e,t),r.existsSync(this.basePath)||r.mkdirSync(this.basePath,{recursive:!0,mode:448});const n=Wp(e);n&&r.writeFileSync(n,t,{mode:384}),zp.set(e,t)}async getItem(e){Lp&&console.debug("\n- GET ITEM",e);const t=zp.get(e);if(void 0===t){const t=Wp(e);if(t){if(r.existsSync(t)){const n=r.readFileSync(t,"utf8");return zp.set(e,n),n}}else console.error(`Unknown token name: ${e}`);return null}return String(t)}async removeItem(e){Lp&&console.debug("\n- REMOVE ITEM",e),zp.delete(e);const t=Wp(e);if(t&&r.existsSync(t)){try{const e=r.statSync(t).size;e>0&&r.writeFileSync(t,Buffer.alloc(e,0),{mode:384})}catch{}r.rmSync(t)}}};let Hp=null;function Jp(){return Hp||(Hp=new ke(Cp,{storage:Gp,navigate:()=>{}})),Hp}function Vp(){Hp=null}let Kp=Promise.resolve();function Yp(e){const t=Kp.then(e,e);return Kp=t.then(()=>{},()=>{}),t}async function Zp(e){return Xp(Jp(),e)}async function Xp(e,t){try{const n=await Yp(()=>e.getAccessToken(t));return null!=n?n:null}catch(e){return function(e){return Boolean(e)&&"object"==typeof e&&"not_authenticated"===e.code}(e)||(Zl(`Token refresh failed for resource ${t}: ${e instanceof Error?e.message:e}`),Qp(e)&&(Zl(`Token refresh: clearing dead grant for resource ${t}`),Up(),Hp=null)),null}}function Qp(e){return function(e){var t,n;if(!e||"object"!=typeof e)return!1;const o=e,i=e=>{if("string"!=typeof e)return!1;const t=e.replace(/^oidc\./,"");return"invalid_grant"===t||"invalid_target"===t};return i(o.code)||i(null==(t=o.data)?void 0:t.error)||i(null==(n=o.data)?void 0:n.code)}(e)}async function eu(){return Zp(Np.resource)}function tu(){return iu(Jp())}async function nu(e){var t;if(!e)return{status:401,error:"Not authenticated"};const n=null==(t=e.userInfo)?void 0:t.custom_data;return n?n.default_org?n.default_org:(console.warn("WARN: You do not have a default organization set. Please visit your Needle Cloud account settings and then try again."),Zl("WARN: You do not have a default organization set. Please visit your Needle Cloud account settings and then try again."),null):null}function ou(e){return new ke(Cp,{storage:Gp,navigate:t=>{if(null==e.navigate)throw new Error("Can not navigate");e.navigate(t)}})}function iu(e){return function(e,t){return Yp(()=>e.getContext(t))}(e,Np).then(t=>{const n=t;return n.client=e,n}).catch(async e=>{const t=e instanceof Error?e.message:String(e);return"oidc.invalid_token"==e.code||"oidc.invalid_grant"==e.code?(Zl(`OIDC: ${e.code} – token refresh failed, clearing stale tokens`),Up(),Hp=null,console.error("Session expired – please log in again: npx needle-cloud login")):e.code?(console.error(e.code),Zl(`OIDC: ${e.code} – ${t}`)):Zl(`OIDC: getContext failed – ${t}`),null})}var au={__proto__:null,resetSharedClient:Vp,tryGetFreshAccessTokenForResource:Zp,acquireAccessToken:Xp,shouldClearAuthOnError:Qp,tryGetFreshAccessToken:eu,tryGetUser:tu,tryGetDefaultOrgId:nu,createNodeClient:ou,getUserFromClient:iu};let su=null;function ru(e){var t;const n=null==(t=e.userInfo)?void 0:t.custom_data;if(!n)return[];const o=n.machines;return o?o.map(e=>e.name):[]}let cu=Date.now();async function lu(e){var t;const n=Date.now();n-cu>3e4&&"client"in e&&(cu=n,await e.client.fetchUserInfo().catch(console.error));const o=null==(t=e.userInfo)?void 0:t.custom_data;if(!o)return!1;if(su||await pu(),!su)return console.error("Failed to get machine id"),!0;const i=o.machines;if(!i)return!1;const a=i.some(e=>e.id===su);return a}async function pu(){return su||await import("node-machine-id").then(async e=>{const t=await e.default.machineId(!1);su=t}),su}function uu(){return fe.userInfo().username+"@"+fe.hostname()}async function du(e,t={signout:!1}){if(e.accessToken){const o={machine_id:await pu(),machine_name:uu(),platform:fe.platform(),arch:fe.arch()},i=await fetch("https://cloud.needle.tools/api"+Ve.account.post_machine,{method:"POST",headers:{Authorization:"Bearer "+e.accessToken,"Content-Type":"application/json"},body:JSON.stringify(o)}).catch(e=>{var t,n;const o=(null==e||null==(t=e.cause)?void 0:t.code)||(null==e||null==(n=e.cause)?void 0:n.message)||(null==e?void 0:e.message)||"connection refused";return console.error(`Failed to validate login: ${o} - Make sure https://cloud.needle.tools/api is reachable`),Zl(`Failed to validate login: "${o}" - Make sure https://cloud.needle.tools/api is reachable.`),{status:502,error:`Failed to validate login at 'https://cloud.needle.tools/api' (${o}) - make sure this URL is reachable.`}});if(!i)return!1;if("error"in i)return i;let a=!0;if(403===i.status){const e=await i.text();if(e.trimStart().startsWith("{")){const t=JSON.parse(e);t.logins&&(a=!1,Zl("Too many logins from different machines"),E().fail("You have reached the maximum number of allowed logins\n"),E().warn(`Please logout from one of the following machines:\n- ${t.logins.join("\n- ")}\n`))}}var n;return!!a||(t.signout&&(Up(),"client"in e&&(null==(n=e.client)||n.signOut(Ip("too-many-logins")))),!1)}return!0}let mu=null;function fu(){if(mu)return mu;{const e=vu();return mu=e,e}}const hu="projects.json";function gu(){const e=process.env.HOME||process.env.USERPROFILE||process.cwd(),t=w(e,".needle");return c(t)||m(t,{recursive:!0}),w(t,hu)}function vu(){const e=gu();if(!c(e))return{entries:[]};const t=p(e,"utf-8");try{const e=JSON.parse(t);return mu=e,e}catch(e){return console.error("Failed to parse project info file:",e),{entries:[]}}}const xu=JSON.parse(p(new URL("../package.json",import.meta.url),"utf-8"));function bu(){return xu.version}const yu=process.env.NEEDLE_SEARCH_ENDPOINT||"https://search.needle.tools",wu=process.env.NEEDLE_SEARCH_API_KEY||"da5737c00d6822c32a1b9e3b5dab094bfc17e205aef2f7f3e1a0fd4ebc77b79f",_u=[{name:"needle_cloud_me",description:"Get current Needle Cloud user information",inputSchema:{type:"object",properties:{},additionalProperties:!1,required:[]}},{name:"needle_search",description:"Search Needle Engine documentation, forum posts, and community discussions. Returns relevant content ranked by semantic similarity. Use this to find information about Needle Engine features, APIs, components, workflows, and troubleshooting.\n\nIMPORTANT: If search results seem irrelevant or low-quality (scores below 0.6, or results don't match the topic), retry with different search terms — up to 3 total attempts. Try varying your query: use specific class/method names, try shorter keyword-based queries, or rephrase the question. Do NOT guess or fabricate answers based on poor search results.",inputSchema:{type:"object",properties:{query:{type:"string",description:'What to search for, e.g. "how to add physics components" or "WebXR hand tracking" or "deploy to vercel"'},limit:{type:"number",description:"Maximum number of results to return (1-20, default 5)"}},additionalProperties:!1,required:["query"]}}],ku={needle_cloud_me:async function(e){try{const e=await tu(),t=null==e?void 0:e.userInfo;return t?JSON.stringify({id:t.sub,name:t.name||t.preferred_username,email:t.email,profile_picture:t.picture}):"No user is currently logged in."}catch(e){return"Error retrieving user: "+(e instanceof Error?e.message:String(e))}},needle_search:async function(t){const n=t.query;if(!n||"string"!=typeof n)return{content:[{type:"text",text:"Error: query parameter is required."}]};const o=Math.min(Math.max(Number(t.limit)||5,1),20),i=`${yu}/api/semantic-search?q=${encodeURIComponent(n)}&limit=${o}`,a={Accept:"application/json"};wu&&(a.Authorization=`Bearer ${wu}`);try{const t=await e(i,{headers:a,signal:AbortSignal.timeout(15e3)});if(!t.ok){const e=await t.text().catch(()=>"");return{content:[{type:"text",text:`Search API error (${t.status}): ${e}`}]}}const o=await t.json();if(!o.results||0===o.results.length)return{content:[{type:"text",text:`No results found for: "${n}"`}]};const s=o.results.map((e,t)=>`## [${t+1}] ${e.title} (score: ${e.score})\nSource: ${e.source}${e.url?` — ${e.url}`:""}\n\n`+e.content+(e.truncated?`\n\n> Content truncated (${e.content.length} of ${e.contentLength} chars shown).${e.url?` Full content: ${e.url}`:""}`:"")).join("\n\n---\n\n");return{content:[{type:"text",text:`Found ${o.results.length} results for "${n}" (${o.durationMs}ms):\n\n${s}`}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e instanceof Error?e.message:String(e)}`}]}}}},Su=new Map;function ju(e,t){const n=_u.findIndex(t=>t.name===e);if(-1!==n){_u.splice(n,1),delete ku[e];for(const t of Su.values())t.delete(e);t()}}function Eu(e,t,n,o){const i=_u.findIndex(t=>t.name===e.name);if(-1!==i){var a;const t=null==(a=[...Su.entries()].find(([,t])=>t.has(e.name)))?void 0:a[0];if(!t||t!==(null==n?void 0:n.source))throw new Error(`Tool "${e.name}" is already registered by ${null!=t?t:"the CLI"}.`);_u.splice(i,1)}if(_u.push(e),ku[e.name]=t,Tu.delete(e.name),null!=n&&n.source){const t=Su.get(n.source)||new Set;t.add(e.name),Su.set(n.source,t)}o()}const Tu=new Map;async function $u(e,t,n={}){const o=ku[e];if(!o){const t=Tu.get(e);if(t)return{isError:!0,content:[{type:"text",text:`This tool is currently unavailable because "${t}" disconnected. Please reconnect (e.g. reopen the browser tab) and try again. You should also call tools/list to refresh your available tools.`}]};throw new Error(`Tool "${e}" is not registered.`)}const i=await o(t,n);if("string"==typeof i)return{content:[{type:"text",text:i}]};if("object"==typeof i)return Array.isArray(i.content)?i:{content:[{type:"text",text:JSON.stringify(i)}]};throw new Error(`Invalid tool result type for tool "${e}".`)}const Ou=200,Ru=2e3,Au=new RegExp("^[A-Za-z0-9_./*?\\[\\]{},\\-]+$");function Cu({pattern:e,glob:t,root:n,maxResults:o}){if("string"!=typeof e)throw new Error("invalid pattern: must be a string");if(e.length>Ru)throw new Error(`invalid pattern: exceeds ${Ru} characters`);if(null!=t&&""!==t){if("string"!=typeof t)throw new Error("invalid glob: must be a string");if(t.length>Ou)throw new Error(`invalid glob: exceeds ${Ou} characters`);if(!Au.test(t))throw new Error("invalid glob: contains disallowed characters")}const i=["-rn"];return t&&i.push(`--include=${t}`),i.push(`--max-count=${o}`,"-E",e,n),i}const Nu=new Set;async function Iu(e,t=Re){const n={check:"typescript",diagnostics:[]};if(!e)return{...n,status:"unavailable",message:"No connected web project. Open your project in the editor first."};const o=V(e),i=K(o,"tsconfig.json"),a=K(o,"node_modules/typescript/lib/tsc.js");if(!T(i))return{...n,status:"unavailable",message:"The connected web project has no tsconfig.json."};if(!T(a))return{...n,status:"unavailable",message:"TypeScript is not installed in the connected web project. Install the project dependencies first."};if(Nu.has(o))return{...n,status:"error",message:"A check is already running for this project."};Nu.add(o);try{const e={...process.env};delete e.NODE_OPTIONS,delete e.NODE_PATH;const{error:s,stdout:r,stderr:c}=await new Promise(n=>{t(process.execPath,[a,"--project",i,"--noEmit","--incremental","false","--pretty","false"],{cwd:o,shell:!1,timeout:1e4,maxBuffer:262144,windowsHide:!0,encoding:"utf8",env:e},(e,t,o)=>n({error:e,stdout:t,stderr:o}))});if(s&&(s.killed||"number"!=typeof s.code))return{...n,status:"error",message:s.killed?"Type checking exceeded the 10 second limit.":`Could not finish type checking: ${s.code||s.message}`,output:String(c||r).slice(0,4e3)};const l=[],p=[];for(const e of String(r).split(/\r?\n/)){const t=/^(?:(.+)\((\d+),(\d+)\): )?error (TS\d+): (.*)$/.exec(e);t?l.push({...t[1]?{file:t[1],line:Number(t[2]),column:Number(t[3])}:{},code:t[4],severity:"error",message:t[5]}):e.trim()&&(/^\s/.test(e)&&l.length?l[l.length-1].message+="\n"+e:p.push(e))}const u=Boolean(c||p.length||s&&!l.length);return{check:"typescript",project:o,status:u?"error":l.length?"failed":"passed",diagnostics:l.slice(0,100),totalDiagnostics:l.length,truncated:l.length>100,...u?{message:"The compiler did not return a complete diagnostic result.",output:[c,...p].join("\n").slice(0,4e3)}:{}}}finally{Nu.delete(o)}}const Pu=new Set([".git","node_modules"]);function Uu(e){if(!e)return null;try{const t=R(e),n=o("sha256"),i=[t];let a=0;for(;i.length;){const e=i.pop(),o=z(e,{withFileTypes:!0}).sort((e,t)=>e.name.localeCompare(t.name));for(const s of o){if(++a>2e4)return null;const o=K(e,s.name),r=Y(t,o).replaceAll("\\","/");if(s.isDirectory()&&Pu.has(s.name)){n.update(`${r}\0excluded\n`);continue}const c=F(o,{bigint:!0});n.update(`${r}\0${c.mode}\0${c.size}\0${c.mtimeNs}\0${c.ctimeNs}\n`),s.isDirectory()&&i.push(o)}}return n.digest("hex")}catch{return null}}const Lu=(e,t)=>String(null!=e?e:"").slice(0,t),zu=1048576,Fu=104857600,Du=e=>o("sha256").update(e).digest("hex"),qu=new Set([".app",".bat",".cmd",".com",".desktop",".exe",".hta",".jar",".lnk",".msi",".ps1",".scr",".sh",".url",".vbs",".wsf"]);function Bu(e){try{const t=new RegExp(e,"i");return{test:e=>t.test(e),mode:"regex"}}catch{const t=e.toLowerCase();return{test:e=>e.toLowerCase().includes(t),mode:"literal"}}}const Mu=function(e,t=Iu,n=Date.now){let o,i=0;return Object.assign(async(a={})=>{var s,r,c,l;const p={status:"error",message:"Use mode check, results or error; file/code filters, nonnegative integer offset/index. No paths or commands can be selected."};if(!a||"object"!=typeof a||Array.isArray(a))return p;if(Object.keys(a).some(e=>!["mode","file","code","offset","index"].includes(e)))return p;const u=null!=(s=a.mode)?s:"check";if(!["check","results","error"].includes(u))return p;for(const e of[a.file,a.code])if(void 0!==e&&("string"!=typeof e||e.length>250))return p;for(const e of[a.offset,a.index])if(void 0!==e&&(!Number.isSafeInteger(e)||e<0))return p;const d=e();if(o&&o.project!==d&&(o=void 0),"check"===u){const e=i,a=Uu(d);o={project:d,result:await t(d),time:n(),revision:e,snapshot:a}}if(!o)return{status:"unavailable",message:"No saved check for this local project. Run files_check_project with mode check first."};const m=Uu(d),f=null===o.snapshot||null===m,h=o.result,g=null!=(r=h.diagnostics)?r:[],v=g.map((e,t)=>({...e,index:t})).filter(e=>{var t;return(!a.file||(null!=(t=e.file)?t:"").toLowerCase().includes(a.file.toLowerCase()))&&(!a.code||e.code===a.code)}),x=null!=(c=a.offset)?c:0,b="error"===u?v.filter(e=>{var t,n;return e.index===(null!=(t=a.index)?t:null==(n=v.at(-1))?void 0:n.index)}):v.slice(x,x+5);if("error"===u&&!b.length)return{status:"unavailable",message:"No matching error in the latest check. Use mode results to list available error indexes."};const y="error"===u?2e3:300;return{status:h.status,check:"typescript",checkedAt:new Date(o.time).toISOString(),cached:"check"!==u,stale:o.revision!==i||f||o.snapshot!==m,project:Lu(d,300),totalDiagnostics:null!=(l=h.totalDiagnostics)?l:g.length,retainedDiagnostics:g.length,matchingDiagnostics:v.length,truncated:Boolean(h.truncated),diagnostics:b.map(e=>({...e,...e.file?{file:Lu(e.file,300)}:{},message:Lu(e.message,y),messageTruncated:e.message.length>y})),..."error"!==u&&x+b.length<v.length?{nextOffset:x+b.length}:{},...h.message||f?{message:Lu([h.message,f?"Could not scan project files for changes; this check is marked stale.":null].filter(Boolean).join(" "),500)}:{},...h.output?{output:Lu(h.output,"error"===u?2e3:500),outputTruncated:h.output.length>("error"===u?2e3:500)}:{}}},{markStale(){i++}})}(()=>{var e;return null==(e=Vu())?void 0:e.web_location}),Wu=function(e,t=K(H(),".needle","cli","ai-checkpoints"),n=(()=>{})){let o=0n,a=!1;function s(t){if(!(t&&t.chatId&&t.sessionId&&t.turnId&&t.project))throw new Error("Local file edit approval is required.");const n=e();if(!n||V(n)!==V(t.project))throw new Error("The approved local project has changed.");return{root:R(n),grant:t}}function r(e,t,n){if("string"!=typeof t||!t||t.includes("\0")||Z(t)||X.isAbsolute(t)||Q.isAbsolute(t)||t.split(/[\\/]/).some(e=>!e||"."===e||".."===e||e.includes(":")))throw new Error("Path must be a file inside the selected local project.");const o=V(e,t);if(!o.startsWith(e+ee))throw new Error("Path escapes the selected local project.");let i=e;const a=Y(e,o).split(ee);for(let e=0;e<a.length;e++){if(i=K(i,a[e]),!T(i)){if(e!==a.length-1||!n)throw new Error("The file or its parent directory does not exist.");continue}const t=F(i);if(t.isSymbolicLink()||t.nlink>1)throw new Error("Symbolic links and hard links cannot be edited.");if(e<a.length-1&&!t.isDirectory())throw new Error("Parent path is not a directory.");if(e===a.length-1&&!t.isFile())throw new Error("Target is not a regular file.")}return o}function c(e,t){const n=`${e}.needle-ai-${i()}.tmp`;try{B(n,t,{flag:"wx",mode:384}),O(n,e)}finally{T(n)&&q(n)}}function l(){return T(t)?z(t).filter(e=>e.endsWith(".json")).reduce((e,n)=>e+A(K(t,n)).size,0):0}function p(e){if(!a){if(T(t))for(const e of z(t).filter(e=>/^[a-f0-9-]{36}\.json$/.test(e))){const n=JSON.parse(D(K(t,e),"utf8"));if(n.order&&/^\d+$/.test(n.order)){const e=BigInt(n.order);e>o&&(o=e)}}a=!0}const n=1000000n*BigInt(Date.now());o=n>o?n:o+1n,e.order=o.toString();const s=JSON.stringify(e);if(l()+Buffer.byteLength(s)>Fu)throw new Error("Checkpoint storage is full; no file was changed.");$(t,{recursive:!0,mode:448});const r=i(),c=K(t,`${r}.json`);return B(c,s,{flag:"wx",mode:384}),{id:r,file:c}}function u(e,t){if(e.byteLength>zu)throw new Error("File exceeds the 1 MiB edit limit.");if(!t||!/^[a-f0-9]{64}$/.test(t))throw new Error("Expected file SHA-256 hash is required before changing a file.");if(Du(e)!==t)throw new Error("The supplied expectedSha256 does not match this file. The file may have changed, or the hash may be incorrect. Run files_stat again and use its sha256 value.")}function d(e,t){try{const n=t=>{const n=r(e,t,!0);return T(n)?D(n):null},o=n(t.path),i=null===t.before?null:Du(Buffer.from(t.before,"base64"));if("rename"===t.operation){if(!t.newPath)return"conflicted";const e=n(t.newPath);if(null===o&&e&&Du(e)===t.afterSha256)return"applied";if(null===e&&o&&Du(o)===i)return"undone"}else if("delete"===t.operation){if(null===o)return"applied";if(o&&Du(o)===i)return"undone"}else{if(o&&Du(o)===t.afterSha256)return"applied";if(null===o&&null===t.before||o&&Du(o)===i)return"undone"}return"conflicted"}catch{return"conflicted"}}return{list(e){const{root:n,grant:o}=s(e);if(!T(t))return{changes:[],total:0};const i=z(t).filter(e=>/^[a-f0-9-]{36}\.json$/.test(e)).map(e=>({...JSON.parse(D(K(t,e),"utf8")),checkpointId:e.slice(0,-5)})).filter(e=>e.project===n&&e.chatId===o.chatId).sort((e,t)=>e.order&&t.order?BigInt(t.order)>BigInt(e.order)?1:BigInt(t.order)<BigInt(e.order)?-1:0:t.createdAt.localeCompare(e.createdAt));return{changes:i.slice(0,100).map(({path:e,checkpointId:t,turnId:o,createdAt:i,operation:a,newPath:s,...r})=>({path:e,checkpointId:t,turnId:o,createdAt:i,operation:null!=a?a:"write",...s?{newPath:s}:{},state:d(n,{...r,path:e,turnId:o,createdAt:i,operation:a,newPath:s})})),total:i.length}},stat(t){const n=e();if(!n)throw new Error("No connected local web project.");const o=r(R(n),t,!0);if(!T(o))return{path:t,exists:!1};const i=A(o).size;if(i>zu)throw new Error("File exceeds the 1 MiB edit limit.");return{path:t,exists:!0,sha256:Du(D(o)),size:i}},write(e,t){var o;const{root:i,grant:a}=s(t);if(!e||"string"!=typeof e.content)throw new Error("Text content is required.");const l=Buffer.from(e.content,"utf8");if(l.byteLength>zu||e.content.includes("\0"))throw new Error("Text file exceeds the 1 MiB limit or contains NUL.");const d=r(i,e.path,!0===e.create),m=T(d);if(!0===e.create&&m)throw new Error("File already exists.");if(!0!==e.create&&!m)throw new Error("File does not exist; use create.");const f=m?D(d):null;if(f&&u(f,e.expectedSha256),f&&Du(f)===Du(l))throw new Error("File already has this content; no edit was saved.");const h={project:i,path:Y(i,d),chatId:a.chatId,sessionId:a.sessionId,turnId:a.turnId,before:null!=(o=null==f?void 0:f.toString("base64"))?o:null,after:l.toString("base64"),afterSha256:Du(l),createdAt:(new Date).toISOString(),operation:"write"},g=p(h);try{if(r(i,e.path,!0===e.create),!0===e.create){if(T(d))throw new Error("The file was created since it was checked; check it again.")}else if(!T(d)||Du(D(d))!==e.expectedSha256)throw new Error("The file changed since it was read; check it again.");c(d,l)}catch(e){throw q(g.file),e}return n(),{path:e.path,checkpointId:g.id,turnId:a.turnId,afterSha256:h.afterSha256}},delete(e,t){const{root:o,grant:i}=s(t),a=r(o,null==e?void 0:e.path,!1),c=D(a);u(c,e.expectedSha256);const l=p({project:o,path:Y(o,a),chatId:i.chatId,sessionId:i.sessionId,turnId:i.turnId,before:c.toString("base64"),after:null,afterSha256:null,createdAt:(new Date).toISOString(),operation:"delete"});try{if(r(o,e.path,!1),Du(D(a))!==e.expectedSha256)throw new Error("The file changed since it was read; check it again.");q(a)}catch(e){throw q(l.file),e}return n(),{path:e.path,checkpointId:l.id,turnId:i.turnId,afterSha256:null}},rename(e,t){const{root:o,grant:i}=s(t),a=r(o,null==e?void 0:e.path,!1),c=r(o,null==e?void 0:e.newPath,!0);if(T(c))throw new Error("Destination file already exists.");const l=D(a);u(l,e.expectedSha256);const d={project:o,path:Y(o,a),newPath:Y(o,c),chatId:i.chatId,sessionId:i.sessionId,turnId:i.turnId,before:l.toString("base64"),after:l.toString("base64"),afterSha256:Du(l),createdAt:(new Date).toISOString(),operation:"rename"},m=p(d);try{if(r(o,e.path,!1),r(o,e.newPath,!0),T(c))throw new Error("Destination file already exists.");if(Du(D(a))!==e.expectedSha256)throw new Error("The file changed since it was read; check it again.");O(a,c)}catch(e){throw q(m.file),e}return n(),{path:e.newPath,checkpointId:m.id,turnId:i.turnId,afterSha256:d.afterSha256}},undo(e,o){const{root:i,grant:a}=s(o);if(!e||"string"!=typeof e.checkpointId||!/^[a-f0-9-]{36}$/.test(e.checkpointId))throw new Error("Invalid checkpoint ID.");const p=K(t,`${e.checkpointId}.json`),u=JSON.parse(D(p,"utf8"));if(u.project!==i||u.chatId!==a.chatId)throw new Error("Checkpoint belongs to another project or chat.");const d=r(i,u.path,!0);if("delete"===u.operation){var m;if(T(d))throw new Error("File changed after the AI edit; Undo would overwrite later work.");c(d,Buffer.from(null!=(m=u.before)?m:"","base64"))}else if("rename"===u.operation){if(!u.newPath)throw new Error("Invalid rename checkpoint.");const e=r(i,u.newPath,!1);if(T(d)||Du(D(e))!==u.afterSha256)throw new Error("File changed after the AI edit; Undo would overwrite later work.");O(e,d)}else{const e=D(d);if(Du(e)!==u.afterSha256)throw new Error("File changed after the AI edit; Undo would overwrite later work.");void 0===u.after&&(u.after=e.toString("base64"),function(e,t){const n=JSON.stringify(t);if(l()-A(e).size+Buffer.byteLength(n)>Fu)throw new Error("Checkpoint storage is full; no file was changed.");c(e,Buffer.from(n))}(p,u)),null===u.before?q(d):c(d,Buffer.from(u.before,"base64"))}return n(),{path:u.path,checkpointId:e.checkpointId,undone:!0}},redo(e,o){const{root:i,grant:a}=s(o);if(!e||"string"!=typeof e.checkpointId||!/^[a-f0-9-]{36}$/.test(e.checkpointId))throw new Error("Invalid checkpoint ID.");const l=K(t,`${e.checkpointId}.json`),p=JSON.parse(D(l,"utf8"));if(p.project!==i||p.chatId!==a.chatId)throw new Error("Checkpoint belongs to another project or chat.");const u=r(i,p.path,!0);if("delete"===p.operation){var d;if(!T(u)||Du(D(u))!==Du(Buffer.from(null!=(d=p.before)?d:"","base64")))throw new Error("File changed after Undo; Redo would overwrite later work.");r(i,p.path,!1),q(u)}else if("rename"===p.operation){var m;if(!p.newPath)throw new Error("Invalid rename checkpoint.");const e=r(i,p.newPath,!0);if(!T(u)||T(e)||Du(D(u))!==Du(Buffer.from(null!=(m=p.before)?m:"","base64")))throw new Error("File changed after Undo; Redo would overwrite later work.");r(i,p.path,!1),r(i,p.newPath,!0),O(u,e)}else{if("string"!=typeof p.after||null===p.afterSha256)throw new Error("This checkpoint cannot be redone.");const e=Buffer.from(p.after,"base64");if(Du(e)!==p.afterSha256)throw new Error("Checkpoint content is damaged; Redo was refused.");if(null===p.before?T(u):!T(u)||Du(D(u))!==Du(Buffer.from(p.before,"base64")))throw new Error("File changed after Undo; Redo would overwrite later work.");r(i,p.path,null===p.before),c(u,e)}return n(),{path:"rename"===p.operation?p.newPath:p.path,checkpointId:e.checkpointId,redone:!0}},undoTurn(e,n){const{root:o,grant:i}=s(n);if(!e||"string"!=typeof e.turnId||!e.turnId||e.turnId.length>255)throw new Error("Valid turn ID is required.");if(!T(t))throw new Error("No checkpoints found for this turn.");const a=z(t).filter(e=>/^[a-f0-9-]{36}\.json$/.test(e)).map(e=>({checkpoint:JSON.parse(D(K(t,e),"utf8")),checkpointId:e.slice(0,-5)})).filter(t=>t.checkpoint.project===o&&t.checkpoint.chatId===i.chatId&&t.checkpoint.turnId===e.turnId);if(!a.length)throw new Error("No checkpoints found for this turn.");if(a.some(e=>!e.checkpoint.order||!/^\d+$/.test(e.checkpoint.order)))throw new Error("Older checkpoints cannot be undone as a turn; use files_undo for each file.");a.sort((e,t)=>{const n=BigInt(e.checkpoint.order),o=BigInt(t.checkpoint.order);return n<o?1:n>o?-1:0});const c=new Map,l=e=>{const t=r(o,e,!0);return"win32"===process.platform?t.toLowerCase():t},p=e=>{var t;const n=r(o,e,!0),i=l(e);if(c.has(i))return null!=(t=c.get(i))?t:null;const a=T(n)?D(n):null;return c.set(i,a),a};for(const{checkpoint:e}of a){const t=null===e.before?null:Buffer.from(e.before,"base64");if("rename"===e.operation){if(!e.newPath)throw new Error("Invalid rename checkpoint.");const n=p(e.path),o=p(e.newPath);if(null!==n||null===o||Du(o)!==e.afterSha256)throw new Error("File changed after this turn; no file was undone.");c.set(l(e.path),t),c.set(l(e.newPath),null)}else if("delete"===e.operation){if(null!==p(e.path))throw new Error("File changed after this turn; no file was undone.");c.set(l(e.path),t)}else{const n=p(e.path);if(null===n||Du(n)!==e.afterSha256)throw new Error("File changed after this turn; no file was undone.");c.set(l(e.path),t)}}const u=[];try{for(const{checkpointId:e}of a)this.undo({checkpointId:e},n),u.push(e)}catch(e){const t=[];for(const e of[...u].reverse())try{this.redo({checkpointId:e},n)}catch(e){t.push(e)}if(t.length)throw new AggregateError([e,...t],"Turn Undo stopped and rollback failed; inspect the listed checkpoints before editing again.");throw new Error("Turn Undo stopped; earlier changes were rolled back.",{cause:e})}return{turnId:e.turnId,checkpointIds:u,undone:!0}}}}(()=>{var e;return null==(e=Vu())?void 0:e.web_location},void 0,()=>Mu.markStale()),Gu=function(e,t=x){return async function(n){const o=e(),i="web"===n.project?null==o?void 0:o.web_location:"editor"===n.project?null==o?void 0:o.project_location:null;if(!i)throw new Error("The selected local project is unavailable.");if("string"!=typeof n.path||!n.path.trim()||Z(n.path)||n.path.includes("\0"))throw new Error("Use a nonempty project-relative file path.");const a=R.native(i),s=V(a,n.path),r=Y(a,s);if(".."===r||r.startsWith(`..${ee}`)||Z(r))throw new Error("File path is outside the selected project.");const c=R.native(s),l=Y(a,c);if(".."===l||l.startsWith(`..${ee}`)||Z(l))throw new Error("File path is outside the selected project.");if(!A(c).isFile())throw new Error("The selected path is not a file.");if(qu.has(te(c).toLowerCase()))throw new Error("Opening executable file types is not supported.");return await t(c),{opened:!0,project:n.project,path:Y(a,c)}}}(Vu);function Hu(e){if(null==e||!e.editGrant)throw new Error("Local file edit approval is required.");return e.editGrant}function Ju(e={}){Eu({name:"files_editor_log_path",description:"Get the filepath to the editor log file on disk (this may be Unity or Blender)",inputSchema:{type:"object",properties:{},additionalProperties:!1,required:[]}},async e=>{const t={content:[]},n=fu();if(n){const e=null==n?void 0:n.entries.sort((e,t)=>t.last_accessed-e.last_accessed)[0];if(null!=e&&e.log_location){const n=l(e.log_location).mtime;t.content.push({type:"text",text:`${e.log_location} (last modified: ${n.toLocaleString()})`})}else{let n="No recent project with known log location known.";e&&(n+=" Recent project is "+(null==e?void 0:e.project_location)),t.content.push({type:"text",text:n})}}return t},{source:"cli"},()=>{}),Eu({name:"files_editor_project_path",description:"Get the filepath to the currently opened project in the editor (this may be Unity or Blender)",inputSchema:{type:"object",properties:{},additionalProperties:!1,required:[]}},async e=>{const t={content:[]},n=fu();if(n){const e=null==n?void 0:n.entries.sort((e,t)=>t.last_accessed-e.last_accessed)[0];t.content.push(null!=e&&e.project_location?{type:"text",text:e.project_location}:{type:"text",text:"No recent project with known project location known."})}return t},{source:"cli"},()=>{}),Eu({name:"files_editor_scene_path",description:"Get the filepath to the currently opened scene in the editor (Unity or Blender). Use this to find out which scene the user is working on.",inputSchema:{type:"object",properties:{},additionalProperties:!1,required:[]}},async e=>{const t={content:[]},n=fu();if(n){const e=null==n?void 0:n.entries.sort((e,t)=>t.last_accessed-e.last_accessed)[0];t.content.push(null!=e&&e.scene_location?{type:"text",text:e.scene_location}:{type:"text",text:"No recent project with known scene location known."})}return t},{source:"cli"},()=>{}),Eu({name:"files_web_project_path",description:"Get the filepath to the connected Needle Engine web project. Unity-generated web projects may validly live inside the Unity project's Library/Needle directory; do not treat that location alone as a misconfiguration. Use this directory as the web-project root.",inputSchema:{type:"object",properties:{},additionalProperties:!1,required:[]}},async e=>{const t={content:[]},n=fu();if(n){const e=null==n?void 0:n.entries.sort((e,t)=>t.last_accessed-e.last_accessed)[0];t.content.push(null!=e&&e.web_location?{type:"text",text:y(e.web_location)}:{type:"text",text:"No recent project with known web project location known."})}return t},{source:"cli"},()=>{}),Eu({name:"files_open",description:'Open an existing file in the connected local web or editor project using the operating system default app. Use a project-relative path and select project="web" or "editor". This affects the user desktop. It does not read file contents or edit files. Executable file types and paths outside the selected project are refused.',inputSchema:{type:"object",properties:{project:{type:"string",enum:["web","editor"]},path:{type:"string"}},required:["project","path"],additionalProperties:!1}},async e=>({content:[{type:"text",text:JSON.stringify(await Gu(e))}]}),{source:"cli"},()=>{}),Eu({name:"files_read",description:"Read a file from the user's local project on disk (editor project or web project). The path must be relative to the project root or an absolute path inside the project. Returns the file contents (or a portion if offset/limit are specified). Use 'filter' to search for specific terms within the file.",inputSchema:{type:"object",properties:{path:{type:"string",description:"File path (relative to project root, or absolute within the project)"},offset:{type:"number",description:"Line number to start reading from (1-based, default: 1). In filter mode: number of matches to skip."},limit:{type:"number",description:"Maximum number of lines to return (default: 200, max: 1000). In filter mode: max matches to return."},filter:{type:"string",description:'Regex to search for in the file (case-insensitive, e.g. "error|warning"). Falls back to a literal substring match if the pattern isn\'t valid regex. Returns matching lines with line numbers instead of sequential content.'}},additionalProperties:!1,required:["path"]}},async e=>{const t=Zu(e.path);if(!t)return{content:[{type:"text",text:"Error: path is outside the project directory."}]};try{const n=l(t.resolved).mtime.toISOString(),o=p(t.resolved,"utf-8").split("\n");if(e.filter){const i=Bu(e.filter),a=[];for(let e=0;e<o.length;e++)i.test(o[e])&&a.push(`${e+1}: ${o[e]}`);const s=a.length,r=Math.max(0,e.offset||0),c=Math.min(Math.max(e.limit||200,1),1e3),l=a.slice(r,r+c);return{content:[{type:"text",text:`File: ${t.resolved} (modified: ${n}) — filter="${e.filter}" (${i.mode}) → ${s} matches (showing ${r+1}-${r+l.length}) in ${o.length} lines\n`+l.join("\n")}]}}const i=Math.max(1,e.offset||1),a=Math.min(e.limit||200,1e3),s=o.slice(i-1,i-1+a),r=s.map((e,t)=>`${i+t}: ${e}`).join("\n");return{content:[{type:"text",text:`File: ${t.resolved} (${o.length} lines, modified: ${n}, showing ${i}-${i+s.length-1})\n`+r}]}}catch(e){return{content:[{type:"text",text:`Error reading file: ${e.message}`}]}}},{source:"cli"},()=>{}),Eu({name:"files_grep",description:"Search for a pattern in the user's local project files on disk (editor project and web project) using grep. Returns matching lines with file paths and line numbers. Note: runtime-only things (e.g. node-material shaders) have no source files — read those with the inspector_* tools instead.",inputSchema:{type:"object",properties:{pattern:{type:"string",description:"Search pattern (regular expression)"},glob:{type:"string",description:"File glob filter, e.g. '*.ts' or '*.cs' (optional)"},max_results:{type:"number",description:"Maximum number of matching lines to return (default: 50)"}},additionalProperties:!1,required:["pattern"]}},async e=>{const t=Yu();if(0===t.length)return{content:[{type:"text",text:"Error: no active project found."}]};const n=Math.min(e.max_results||50,200),o=[];try{Cu({pattern:e.pattern,glob:e.glob,root:".",maxResults:n})}catch(e){return{content:[{type:"text",text:`Error: ${e.message}`}]}}for(const a of t)try{const t=Cu({pattern:e.pattern,glob:e.glob,root:a,maxResults:n});let s="";try{s=v("grep",t,{encoding:"utf-8",maxBuffer:1048576,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch(e){if(1!==(null==e?void 0:e.status))throw e;var i;s=(null==(i=e.stdout)||null==i.toString?void 0:i.toString())||""}if(s.trim()){const e=s.trim().split("\n").map(e=>e.startsWith(a)?e.substring(a.length+1):e);o.push(...e)}}catch{}if(0===o.length){const n=t.length>0?`\nSearched in:\n${t.join("\n")}`:"\nNo project directories available to search.";return{content:[{type:"text",text:`No matches found for pattern: ${e.pattern}${n}`}]}}const a=o.slice(0,n);return{content:[{type:"text",text:`Found ${o.length} matches${o.length>n?` (showing first ${n})`:""}:\n`+a.join("\n")}]}},{source:"cli"},()=>{}),Eu({name:"files_list",description:"List files in the user's local project directories on disk matching an optional glob pattern. A list is shallow by default: files in subdirectories are NOT included. When checking whether a file exists anywhere below a folder, use recursive=true or provide its exact subdirectory in path. By default searches both the editor project (Unity/Blender) and the web project. Use the 'project' parameter to target a specific one. Results are prefixed with <web_project>/..., <unity>/..., or <blender>/... so you know which root each file belongs to. Do not conclude that a file is absent from a project based on a shallow listing.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Subdirectory to list (relative to the selected project root, default: root)"},pattern:{type:"string",description:"Glob pattern to filter files, e.g. '*.ts' or '*.glb'. Supports multiple patterns separated by '|', e.g. '*.gltf|*.glb' (optional)"},recursive:{type:"boolean",description:"Set true to include files in all subdirectories. Default false lists only files directly in path; use true before claiming a nested file is absent."},project:{type:"string",enum:["web","editor"],description:"Which project root to search: 'web' for the Needle Engine web project (use this for exported assets, source files, node_modules), 'editor' for the Unity/Blender project. Omit to search both."}},additionalProperties:!1,required:[]}},async e=>{const t=Vu();if(!t)return{content:[{type:"text",text:"Error: no active project found."}]};const n="blender"===t.editor?"<blender>":"unity"===t.editor?"<unity>":"<editor_project>",o=[];if(e.project&&"editor"!==e.project||!t.project_location||o.push({root:y(t.project_location),label:n}),e.project&&"web"!==e.project||!t.web_location||o.push({root:y(t.web_location),label:"<web_project>"}),0===o.length)return{content:[{type:"text",text:"Error: no active project found."}]};const i=[],a=[];for(const{root:t,label:n}of o){const o=e.path?Ku(e.path,t):t;if(o)try{var s;e.recursive||a.push(...u(o,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!e.name.startsWith(".")&&"node_modules"!==e.name).map(e=>`${n}/${_(t,w(o,e.name))}`));const r=Qu(o,t,null!=(s=e.recursive)&&s,e.pattern,0);i.push(...r.map(e=>({file:e,root:t,label:n})))}catch{}}const r=a.length>0?`\nShallow listing: subdirectories were not searched (${a.slice(0,12).join(", ")}${a.length>12?", ...":""}). To search nested files, call files_list with recursive=true or set path to the subdirectory.`:"";if(0===i.length)return{content:[{type:"text",text:`No files found directly in the selected path.${o.length>0?`\nSearched in:\n${o.map(e=>`${e.label} → ${e.root}`).join("\n")}`:"\nNo project directories available to search."}${r}`}]};const c=i.slice(0,500).map(e=>`${e.label}/${_(e.root,e.file)}`);return{content:[{type:"text",text:`Found ${i.length} files${i.length>500?" (showing first 500)":""}:\n`+c.join("\n")+r}]}},{source:"cli"},()=>{}),Eu({name:"files_read_editor_log",description:"Read or search the Unity or Blender editor log file. By default reads the last N lines. Use the 'filter' parameter to search for specific terms (e.g. error messages, warnings, component names) across the entire log.",inputSchema:{type:"object",properties:{lines:{type:"number",description:"Number of lines to read from the end of the log (default: 100, max: 500). Ignored when filter is set."},filter:{type:"string",description:'Regex to search for in the log (case-insensitive, e.g. "error|exception|warning"). Falls back to a literal substring match if the pattern isn\'t valid regex. Returns all matching lines from the entire log instead of just the tail.'},offset:{type:"number",description:"Number of matching results to skip from the start (default: 0). Only used with filter."},limit:{type:"number",description:"Maximum number of matching results to return (default: 200, max: 500). Only used with filter."}},additionalProperties:!1,required:[]}},async e=>{const t=Vu();var n;if(null==t||!t.log_location)return Zl(`read_editor_log: no editor log file known (project: ${null!=(n=null==t?void 0:t.project_location)?n:"none"})`),{content:[{type:"text",text:"Error: no editor log file known. Is a Unity or Blender project open?"}]};try{const n=p(t.log_location,"utf-8").split("\n");let o,i;if(e.filter){const t=Bu(e.filter);o=[];for(let e=0;e<n.length;e++)t.test(n[e])&&o.push(`L${e+1}: ${n[e]}`);const a=o.length,s=Math.max(0,e.offset||0),r=Math.min(Math.max(e.limit||200,1),500);o=o.slice(s,s+r),i=`filter="${e.filter}" (${t.mode}) → ${a} matches (showing ${s+1}-${s+o.length}) in ${n.length} total lines`}else{const t=Math.min(Math.max(e.lines||100,1),500);o=n.slice(-t),i=`last ${t} of ${n.length} lines`}const a="unity"===t.editor?function(e){const t=[],n=new Map;let o=!1,i=0;for(const a of e){if(/^\s+at\s/.test(a)||/^\s*(UnityEngine\.|System\.|Unity\.)/.test(a)||/^\s+\w+[\w.<>]+\s*\(/.test(a)){o||(o=!0,i=0),i++,i<=3?t.push(a):4===i&&t.push(" ... (stack trace truncated)");continue}if(o=!1,i=0,!a.trim())continue;const e=n.get(a)||0;if(n.set(a,e+1),0===e)t.push(a);else if(1===e)t.push(` [repeated ${e+1}x] ${a}`);else{const n=t.length-1;n>=0&&t[n].startsWith(" [repeated")&&(t[n]=` [repeated ${e+1}x] ${a}`)}}return t}(o):o,s=5e4;let r=a.join("\n"),c="";if(r.length>s){r=r.substring(r.length-s);const e=r.indexOf("\n");e>0&&(r=r.substring(e+1)),c=" (output truncated to last ~50KB)"}return{content:[{type:"text",text:`Editor log: ${t.log_location} (${i}, ${a.length} after processing, editor: ${t.editor})${c}:\n`+r}]}}catch(e){return{content:[{type:"text",text:`Error reading log: ${e.message}`}]}}},{source:"cli"},()=>{}),Eu({name:"files_read_gltf",description:"Read and summarize a glTF or GLB file from the user's local project on disk. Without a query, returns a structured summary including nodes, meshes, materials, animations, extensions, and compression/optimization hints. Use 'query' to drill into specific parts using JSON pointer paths. Use '*' as a wildcard for array indices or object keys. For GLB files, extracts the JSON chunk and skips binary data.",inputSchema:{type:"object",properties:{path:{type:"string",description:"File path to a .gltf or .glb file (relative to project root, or absolute path)"},query:{type:"string",description:"JSON pointer path to extract a specific part of the glTF, e.g. '/nodes/0', '/materials', '/extensions/NEEDLE_progressive', '/materials/*/extensions'. Use '*' as a wildcard for array indices or object keys."}},additionalProperties:!1,required:["path"]}},async e=>{let t=Zu(e.path);if(!t)return{content:[{type:"text",text:"Error: path is outside the project directory."}]};if(!c(t.resolved))return{content:[{type:"text",text:`Error: file not found: ${t.resolved}`}]};try{const n=function(e){const t=e.toLowerCase();if(t.endsWith(".gltf")){const t=p(e,"utf-8");return JSON.parse(t)}if(t.endsWith(".glb")){const t=p(e);if(t.length<20)return null;if(1179937895!==t.readUInt32LE(0))return null;const n=t.readUInt32LE(12);if(1313821514!==t.readUInt32LE(16))return null;const o=t.toString("utf-8",20,20+n);return JSON.parse(o)}return null}(t.resolved);if(!n)return{content:[{type:"text",text:"Error: could not parse glTF/GLB file."}]};const o=5e4;if(e.query){const i=Xu(n,e.query.replace(/^\//,"").split("/"));if(void 0===i)return{content:[{type:"text",text:`No data found at pointer: ${e.query}`}]};let a=JSON.stringify(i),s=!1;return a.length>o&&(a=a.substring(0,o),s=!0),{content:[{type:"text",text:`${e.query} in ${t.resolved}`+(s?` (truncated to ${o} chars)`:"")+"\n"+a}]}}let i=function(e,t){var n,o,i,a,s,r,c,l,p,u,d,m,f;const h=[`glTF: ${t}`];if(e.asset){const t=[];e.asset.version&&t.push(`v${e.asset.version}`),e.asset.generator&&t.push(e.asset.generator),h.push(`Asset: ${t.join(", ")}`)}if(null!=(n=e.extensionsUsed)&&n.length&&h.push(`Extensions used: ${e.extensionsUsed.join(", ")}`),null!=(o=e.extensionsRequired)&&o.length&&h.push(`Extensions required: ${e.extensionsRequired.join(", ")}`),null!=(i=e.scenes)&&i.length&&h.push(`Scenes: ${e.scenes.length}${void 0!==e.scene?` (default: ${e.scene})`:""}`),null!=(a=e.nodes)&&a.length){var g,v,x;h.push(`\nNodes (${e.nodes.length}):`);const t=null!=(g=null==(v=e.scenes)||null==(v=v[null!=(x=e.scene)?x:0])?void 0:v.nodes)?g:[],n=new Set,o=(t,i)=>{if(i>6||n.has(t))return;n.add(t);const a=e.nodes[t];if(!a)return;const s=" ".repeat(i),r=[];if(void 0!==a.mesh&&r.push(`mesh:${a.mesh}`),void 0!==a.camera&&r.push(`camera:${a.camera}`),void 0!==a.skin&&r.push(`skin:${a.skin}`),a.extensions&&r.push(`ext:[${Object.keys(a.extensions).join(",")}]`),h.push(`${s}- ${a.name||`node_${t}`}${r.length?` (${r.join(", ")})`:""}`),a.children)for(const e of a.children)o(e,i+1)};for(const e of t)o(e,1);n.size<e.nodes.length&&n.size>0&&h.push(` ... and ${e.nodes.length-n.size} more nodes`)}if(null!=(s=e.meshes)&&s.length){h.push(`\nMeshes (${e.meshes.length}):`);for(const t of e.meshes.slice(0,30)){var b,y;const e=null!=(b=null==(y=t.primitives)?void 0:y.length)?b:0;h.push(` - ${t.name||"(unnamed)"} (${e} primitive${1!==e?"s":""})`)}e.meshes.length>30&&h.push(` ... and ${e.meshes.length-30} more`)}if(null!=(r=e.materials)&&r.length){h.push(`\nMaterials (${e.materials.length}):`);for(const t of e.materials.slice(0,30)){const e=t.name||"(unnamed)",n=[];t.pbrMetallicRoughness&&n.push("PBR"),t.alphaMode&&"OPAQUE"!==t.alphaMode&&n.push(t.alphaMode),t.doubleSided&&n.push("doubleSided"),t.extensions&&n.push(`ext:[${Object.keys(t.extensions).join(",")}]`),h.push(` - ${e}${n.length?` (${n.join(", ")})`:""}`)}e.materials.length>30&&h.push(` ... and ${e.materials.length-30} more`)}if(null!=(c=e.textures)&&c.length&&h.push(`Textures: ${e.textures.length}`),null!=(l=e.images)&&l.length&&h.push(`Images: ${e.images.length}`),null!=(p=e.animations)&&p.length){h.push(`\nAnimations (${e.animations.length}):`);for(const t of e.animations.slice(0,20)){var w,_;const e=null!=(w=null==(_=t.channels)?void 0:_.length)?w:0;h.push(` - ${t.name||"(unnamed)"} (${e} channel${1!==e?"s":""})`)}e.animations.length>20&&h.push(` ... and ${e.animations.length-20} more`)}if(null!=(u=e.skins)&&u.length){h.push(`\nSkins (${e.skins.length}):`);for(const t of e.skins.slice(0,10)){var k,S;h.push(` - ${t.name||"(unnamed)"} (${null!=(k=null==(S=t.joints)?void 0:S.length)?k:0} joints)`)}}if(null!=(d=e.cameras)&&d.length){h.push(`\nCameras (${e.cameras.length}):`);for(const t of e.cameras)h.push(` - ${t.name||"(unnamed)"} (${t.type})`)}if(null!=(m=e.buffers)&&m.length){const t=e.buffers.reduce((e,t)=>e+(t.byteLength||0),0);h.push(`\nBuffers: ${e.buffers.length} (${(t/1024/1024).toFixed(1)} MB total)`)}return null!=(f=e.accessors)&&f.length&&h.push(`Accessors: ${e.accessors.length}`),h.join("\n")}(n,t.resolved);return i.length>o&&(i=i.substring(0,o)+"\n... (truncated)"),{content:[{type:"text",text:i}]}}catch(e){return{content:[{type:"text",text:`Error reading glTF: ${e.message}`}]}}},{source:"cli"},()=>{}),Eu(wl.schema,async e=>{const t=await wl.execute(e);return"error"in t?{content:[{type:"text",text:t.error}]}:{content:[{type:"text",text:t.content}]}},{source:"cli"},()=>{}),Eu({name:"files_stat",description:'Check one exact relative path in the connected local web project and read its SHA-256 hash and size. This does not search by basename or recurse: exists=false only means that exact path was not found. First locate a nested file with files_list(path="src", recursive=true), then pass the full relative path such as src/scripts/MyComponent.ts. Use the returned hash as expectedSha256 before replacing or deleting that file.',inputSchema:{type:"object",properties:{path:{type:"string"}},required:["path"],additionalProperties:!1}},async e=>({content:[{type:"text",text:JSON.stringify(Wu.stat(e.path))}]}),{source:"cli"},()=>{}),Eu({name:"files_write",description:"Create or replace a UTF-8 text file in the approved local web project. For an existing file, first call files_stat and pass its SHA-256 hash as expectedSha256. Creating a new file requires create=true. Automatically saves an undo checkpoint. Requires user approval for this project and chat session. A successful write only confirms that bytes were saved; run files_check_project with mode=check afterward before saying TypeScript errors are fixed.",inputSchema:{type:"object",properties:{path:{type:"string"},content:{type:"string"},create:{type:"boolean"},expectedSha256:{type:"string"}},required:["path","content"],additionalProperties:!1}},async(e,t)=>({content:[{type:"text",text:JSON.stringify(Wu.write(e,Hu(t)))}]}),{source:"cli"},()=>{}),Eu({name:"files_delete",description:"Delete a file in the approved local web project. First call files_stat and pass its SHA-256 hash as expectedSha256. Saves an undo checkpoint and refuses changed files.",inputSchema:{type:"object",properties:{path:{type:"string"},expectedSha256:{type:"string"}},required:["path","expectedSha256"],additionalProperties:!1}},async(e,t)=>({content:[{type:"text",text:JSON.stringify(Wu.delete(e,Hu(t)))}]}),{source:"cli"},()=>{}),Eu({name:"files_rename",description:"Rename a file within the approved local web project. First call files_stat and pass its SHA-256 hash as expectedSha256. The destination must not exist. Saves an undo checkpoint.",inputSchema:{type:"object",properties:{path:{type:"string"},newPath:{type:"string"},expectedSha256:{type:"string"}},required:["path","newPath","expectedSha256"],additionalProperties:!1}},async(e,t)=>({content:[{type:"text",text:JSON.stringify(Wu.rename(e,Hu(t)))}]}),{source:"cli"},()=>{}),Eu({name:"files_undo",description:"Undo one saved AI file edit in the approved local web project. Refuses to overwrite changes made after the edit. The checkpoint remains available for Redo.",inputSchema:{type:"object",properties:{checkpointId:{type:"string"}},required:["checkpointId"],additionalProperties:!1}},async(e,t)=>({content:[{type:"text",text:JSON.stringify(Wu.undo(e,Hu(t)))}]}),{source:"cli"},()=>{}),Eu({name:"files_redo",description:"Reapply one previously undone AI file edit from its checkpoint. Refuses to overwrite changes made after Undo. Requires active file-edit approval.",inputSchema:{type:"object",properties:{checkpointId:{type:"string"}},required:["checkpointId"],additionalProperties:!1}},async(e,t)=>({content:[{type:"text",text:JSON.stringify(Wu.redo(e,Hu(t)))}]}),{source:"cli"},()=>{}),Eu({name:"files_undo_turn",description:"Undo all AI file edits from one turn in reverse order. Use a turnId from files_list_changes. Checks every file for conflicts before changing anything; refuses changed files. Older checkpoints without turn ordering must be undone individually.",inputSchema:{type:"object",properties:{turnId:{type:"string"}},required:["turnId"],additionalProperties:!1}},async(e,t)=>({content:[{type:"text",text:JSON.stringify(Wu.undoTurn(e,Hu(t)))}]}),{source:"cli"},()=>{}),Eu({name:"files_list_changes",description:"List recent undo checkpoints for this chat and connected local web project. Requires active user approval. Returns filenames and checkpoint IDs, not file contents.",inputSchema:{type:"object",properties:{},required:[],additionalProperties:!1}},async(e,t)=>({content:[{type:"text",text:JSON.stringify(Wu.list(Hu(t)))}]}),{source:"cli"},()=>{}),Eu({name:"files_check_project",description:"Check the connected local web project for TypeScript errors without emitting files or applying fixes. Default mode check runs its installed compiler (10 second limit) and returns up to 5 short diagnostics. Use mode results with file/code filters and offset to browse the latest check without rerunning. Use mode error with an index for details; omit index for the last matching error. Results are timestamped snapshots, retained until another check or project change, or CLI exit. Local AI writes and changes to tracked local project files mark saved results stale; dependency files inside node_modules are excluded from the change scan. Retains at most 100 diagnostics. Reports current errors, not whether they predate edits. Not a linter or Unity/Blender compiler.",inputSchema:{type:"object",properties:{mode:{type:"string",enum:["check","results","error"],description:"Run a new check, browse cached results, or inspect one cached error."},file:{type:"string",maxLength:250,description:"Filter diagnostic filenames by case-insensitive substring; does not select a project or restrict compiler inputs."},code:{type:"string",maxLength:250,description:"Exact diagnostic code, e.g. TS2322."},offset:{type:"integer",minimum:0,description:"Offset within filtered results; 5 errors per page."},index:{type:"integer",minimum:0,description:"Diagnostic index from the latest check for mode error; defaults to the last matching error."}},additionalProperties:!1,required:[]}},async e=>{const t=await Mu(e);return{content:[{type:"text",text:JSON.stringify(t)}],isError:"error"===t.status||"unavailable"===t.status}},{source:"cli"},()=>{}),null!=e&&e.logToolCount&&Zl(`[MCP] registered ${_u.length} built-in tools: ${_u.map(e=>e.name).join(", ")}`)}function Vu(){var e;const t=fu();return null!=t&&null!=(e=t.entries)&&e.length?t.entries.sort((e,t)=>t.last_accessed-e.last_accessed)[0]:null}function Ku(e,t){const n=y(t,e),o=y(t);return n.startsWith(o+k)||n===o?n:null}function Yu(){const e=Vu();if(!e)return[];const t=[];return e.project_location&&t.push(y(e.project_location)),e.web_location&&t.push(y(e.web_location)),t}function Zu(e){const t=Yu();for(const n of t){const t=Ku(e,n);if(t&&c(t))return{resolved:t,root:n}}for(const n of t){const t=Ku(e,n);if(t)return{resolved:t,root:n}}const n=y(e);for(const e of t)if(n.startsWith(e+k)||n===e)return{resolved:n,root:e};return null}function Xu(e,t){if(0===t.length||null==e)return e;const[n,...o]=t;if("*"!==n)return Xu(e[/^\d+$/.test(n)?Number(n):n],o);if(Array.isArray(e)){const t=e.map(e=>Xu(e,o)).filter(e=>void 0!==e);return t.length>0?t:void 0}if("object"==typeof e){const t={};for(const n of Object.keys(e)){const i=Xu(e[n],o);void 0!==i&&(t[n]=i)}return Object.keys(t).length>0?t:void 0}}function Qu(e,t,n,o,i){if(i>10)return[];const a=[],s=u(e,{withFileTypes:!0}),r="node_modules"===(e.split("/").pop()||e.split("\\").pop()||"");for(const c of s){if(r){if(".needle"!==c.name&&".vite"!==c.name)continue}else{if("Library"===c.name)continue;if(c.name.startsWith(".")||"node_modules"===c.name){if(!n)continue;if(c.name.startsWith("."))continue}}const s=w(e,c.name);if(c.isDirectory())n&&a.push(...Qu(s,t,!0,o,i+1));else{if(o&&!o.split("|").map(e=>(e=e.trim()).startsWith(".")&&!e.startsWith("*.")?"*"+e:e).filter(Boolean).some(e=>Ce(c.name,e,{nocase:!0})))continue;a.push(s)}}return a}const ed="settings.json";function td(){return K(H(),".needle")}function nd(e){const t=K(null!=e?e:td(),ed);if(!T(t))return{};try{const e=JSON.parse(D(t,"utf-8"));return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}catch{return{}}}function od(e){return"disabled"===nd(e).remote_ai_tools}function id(e,t){if(!T(e))try{$(e,{recursive:!0})}catch{}let n=null,o=null;try{n=M(e,{persistent:!1},(e,n)=>{n&&n.toString()!==ed||(o&&clearTimeout(o),o=setTimeout(()=>{o=null;try{t()}catch{}},50))}),null==n.on||n.on("error",()=>{})}catch{}return()=>{o&&(clearTimeout(o),o=null);try{var e;null==(e=n)||e.close()}catch{}n=null}}var ad={__proto__:null,KNOWN_SETTINGS:{remote_ai_tools:{displayName:"Remote AI tools",default:"enabled",description:"Allow Needle Cloud AI chat to dispatch tool calls (file reads, search, etc.) to this machine.",command:"needle-cloud settings remote-ai-tools <true|false>"}},defaultSettingsDir:td,readSettings:nd,writeSetting:function(e,t,n){const o=nd(e);null===n?delete o[t]:o[t]=n,$(e,{recursive:!0}),B(K(e,ed),JSON.stringify(o,null,2)+"\n","utf-8")},areRemoteAiToolsDisabled:od,watchSettings:id};const sd=2e3,rd=6e4,cd=25e3,ld=1e4,pd=i();let ud=null,dd=null,md=null,fd=null,hd=sd,gd=!1,vd=!1;function xd(){ud||(od()?Zl("Needle Cloud connection: skipped (remote_ai_tools disabled in settings)"):(gd=!1,dd&&(clearTimeout(dd),dd=null),hd=sd,yd()))}function bd(e){gd=!0,wd(),dd&&(clearTimeout(dd),dd=null),ud?(Zl(`Needle Cloud connection: closing (reason: ${null!=e?e:"shutdown"})`),ud.close(1e3,null!=e?e:"shutdown"),ud=null):e&&Zl(`Needle Cloud connection: disconnect requested (reason: ${e}) — no active connection`)}async function yd(){let e=await eu();if(e||(e=function(){const e=Wp("accessToken");if(r.existsSync(e)){const t=r.readFileSync(e,"utf8");if(t){const e=JSON.parse(t),n=null==e?void 0:e["@https://cloud.needle.tools/api"];return null==n?void 0:n.token}}return null}(),e&&Zl("Needle Cloud connection: using cached token (refresh failed)")),!e)return vd||(Zl("Needle Cloud connection: skipped (not logged in)"),vd=!0),void _d(!0);vd=!1;const t="https://cloud.needle.tools/api".replace(/^http/,"ws")+"/v1/cli/ws?token="+encodeURIComponent(e)+"&instance="+encodeURIComponent(pd);Zl("Needle Cloud connection: connecting...");const n=`needle-cloud/${bu()} Node/${process.versions.node}`;ud=new $e(t,{headers:{"User-Agent":n,Origin:"cli://needle-cloud"}}),ud.on("open",()=>{hd=sd,Zl("Needle Cloud connection: established"),ud&&ud.readyState===$e.OPEN&&ud.send(JSON.stringify(function(){var e,t,n,o;const i=fu(),a=null==i||null==(e=i.entries)||null==(e=e.sort((e,t)=>t.last_accessed-e.last_accessed))?void 0:e[0];return{type:"presence",editor:null!=(t=null==a?void 0:a.editor)?t:"unknown",project:null!=(n=null==a?void 0:a.project_location)?n:null,scene:null!=(o=null==a?void 0:a.scene_location)?o:null,web_project:null!=a&&a.web_location?V(a.web_location):null,cli_version:bu()}}())),function(){if(!ud||ud.readyState!==$e.OPEN)return;try{Ju()}catch(e){Zl(`Needle Cloud connection: registerServerTools failed: ${e}`)}const e=_u.map(e=>e.name);var t;Zl(`Needle Cloud connection: sending ${e.length} tools: ${e.join(", ")}`),ud.send(JSON.stringify({type:"tools",tools:(t=_u,t.map(e=>{var t;return{name:e.name,description:e.description,inputSchema:e.inputSchema,capability:null!=(t=e.capability)?t:"local"}}))}))}(),wd(),md=setInterval(()=>{ud&&ud.readyState===$e.OPEN&&(ud.ping(),fd=setTimeout(()=>{Zl("Needle Cloud connection: pong timeout, terminating"),ud&&ud.terminate()},ld))},cd)}),ud.on("pong",()=>{fd&&(clearTimeout(fd),fd=null)}),ud.on("message",e=>{try{const n=JSON.parse(e.toString());var t;"execute_tool"===n.type&&n.requestId&&n.toolName&&async function(e,t,n,o){Zl(function(e,t,n){const o=Object.entries(t).slice(0,12).map(([e,t])=>`${e.slice(0,40)}:${"string"==typeof t?t.length+" chars":typeof t}`);return`Cloud tool request: ${e.slice(0,64)}(${o.join(", ")}) [${n.slice(0,64)}]`}(t,n,e));const i=Date.now();try{var a,s;const r=await $u(t,n,{editGrant:o});Zl(`Cloud tool result: ${t} → ${null!=(a=null==r||null==(s=r.content)?void 0:s.reduce((e,t)=>{var n;return e+((null==(n=t.text)?void 0:n.length)||0)},0))?a:0} chars in ${Date.now()-i}ms [${e}]`),ud&&ud.readyState===$e.OPEN&&ud.send(JSON.stringify({type:"tool_result",requestId:e,result:r}))}catch(n){const o=n instanceof Error?n.message:String(n);Zl(`Cloud tool error: ${t} → ${o} in ${Date.now()-i}ms [${e}]`),ud&&ud.readyState===$e.OPEN&&ud.send(JSON.stringify({type:"tool_result",requestId:e,error:o}))}}(n.requestId,n.toolName,null!=(t=n.args)?t:{},n.editGrant)}catch{}}),ud.on("close",(e,t)=>{const n=(null==t?void 0:t.toString())||"";Zl(`Needle Cloud connection: closed (code=${e}${n?" "+n:""})`),wd(),ud=null,gd||_d()}),ud.on("error",e=>{Zl(`Needle Cloud connection: error - ${e.message||"connection refused"} (is https://cloud.needle.tools/api reachable?)`)})}function wd(){md&&(clearInterval(md),md=null),fd&&(clearTimeout(fd),fd=null)}function _d(e=!1){gd||dd||(e||Zl(`Needle Cloud connection: reconnecting in ${hd/1e3}s`),dd=setTimeout(()=>{dd=null,yd()},hd),hd=Math.min(2*hd,rd))}const kd=e=>{const t=Te();return t.use("/:action",async(t,n,o)=>{const{action:i}=t.params,a=ou({navigate:e=>{n.redirect(e)}});switch(i){case"sign-in":e.invalid_login=!1,e.invalid_login_type=null,e.error=void 0,Zl("Sign in..."),await a.clearAllTokens(),Vp();try{await a.signIn(`${up}/auth-callback`)}catch(e){const t=null==e?void 0:e.cause,o=`Sign-in failed: ${null!=t&&t.code?`${t.code}${t.address?` (${t.address}:${t.port})`:""}`:(null==e?void 0:e.message)||"unknown error"}`;return Zl(o),console.error(o),n.status(502).send(o)}break;case"sign-out":{var s,r;const t=await tu(),n=(null==t||null==(s=t.userInfo)?void 0:s.sub)||(null==t||null==(r=t.claims)?void 0:r.sub),o=null==t?void 0:t.accessToken;Zl(`Sign out... (${n})`),n&&o&&await async function(e){return!e.accessToken||import("node-machine-id").then(async t=>{const n=await pu();return su=n,await fetch("https://cloud.needle.tools/api"+Ve.account.post_machine,{method:"POST",headers:{Authorization:"Bearer "+e.accessToken,"Content-Type":"application/json"},body:JSON.stringify({action:"logout",machine_id:n,machine_name:uu()})}).catch(e=>{Zl(`Failed to validate logout: ${e.message} - Make sure https://cloud.needle.tools/api is reachable`),console.error(`Failed to validate logout: ${e.message} - Make sure https://cloud.needle.tools/api is reachable`)}),!0})}({userId:n,accessToken:o}).catch(e=>{console.error(e),Zl(`Failed to validate logout: ${e}`)}),e.invalid_login=!1,e.invalid_login_type=null,e.error=void 0,console.log("User signed out"+(n?`: ${n}`:"")),await a.signOut(Ip()),Vp();break}case"auth-callback":if(t.url){const o=await a.handleSignInCallback(`${up}${t.originalUrl}`).catch(e=>({error:e}));if(Vp(),o&&"error"in o){Zl(`Error during sign in: ${o.error}`);const e=o.error instanceof Error?o.error.message:String(o.error);n.redirect(up+"?cancelled&message="+encodeURIComponent(e))}else{var c,l,p,u;const t=await tu();if(null!=t&&t.isAuthenticated){var d,m;e.invalid_login=!1,e.user_email=(null==(d=t.claims)?void 0:d.email)||(null==(m=t.userInfo)?void 0:m.email)||null,e.logged_in_machine_names=[...ru(t)];const o=await du(t,{signout:!0});if(!o)return e.invalid_login=!0,e.invalid_login_type="too-many-logins",n.redirect(Ip("too-many-logins"));if("object"==typeof o&&"error"in o)return e.invalid_login=!0,e.invalid_login_type="error",e.error=o.error,n.redirect(Ip("error"));Vp()}console.log(`User logged in: ${(null==t||null==(c=t.userInfo)?void 0:c.sub)||(null==t||null==(l=t.claims)?void 0:l.sub)}`),Zl(`User logged in: ${(null==t||null==(p=t.userInfo)?void 0:p.sub)||(null==t||null==(u=t.claims)?void 0:u.sub)}`),xd(),n.redirect(up)}}break;default:o()}}),t};function Sd(e){var t,n,o,i;if(!e)return"";let a=(null==(t=e.claims)?void 0:t.name)||(null==(n=e.userInfo)?void 0:n.name)||(null==(o=e.claims)?void 0:o.username)||"";var s;return(!a||a.length<=0)&&null!=(i=e.claims)&&i.email?function(e){return e?(e=(e=(e=(e=e.split("@")[0]).replace(/[^a-zA-Z0-9]/g," ")).replace(/\s+/g," ")).split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),e):e}(null==(s=e.claims)?void 0:s.email):a}async function jd(e,t=null){var n,o;if(!e)return{status:500,error:"User is not provided"};if(!e.isAuthenticated)return{status:403,error:"User is not authenticated"};const i=(null==(n=e.claims)?void 0:n.sub)||(null==(o=e.userInfo)?void 0:o.sub);t===i&&(t=null);let a=null;if(null==t)a=e.accessToken;else if(null!=t){var s;let n=null==e||null==(s=e.userInfo)||null==(s=s.organization_data)?void 0:s.find(e=>e.id===t);if(!n){var r;const o=t.toLowerCase();n=null==e||null==(r=e.userInfo)||null==(r=r.organization_data)?void 0:r.find(e=>e.name.toLowerCase()===o)}if(!n)return{status:403,error:`User is not part of team "${t}"`};t=n.id,a=await e.client.getOrganizationToken(n.id).catch(e=>{var o;return console.error(`Error getting organization token for "${null==(o=n)?void 0:o.name}" (${t}): ${e.message}`),null})}return a?{authToken:a,org:t}:{status:403,error:"No access token found"}}const Ed=function(){return async(e,t,n)=>{const o=await tu();Object.defineProperty(e,"user",{enumerable:!0,get:()=>o}),n()}},Td=`${up}/mcp`,$d="2025-06-18",Od={name:"Needle Cloud MCP",version:"1.0.0"};function Rd(e){return{jsonrpc:"2.0",id:e,result:{protocolVersion:$d,capabilities:{tools:{listChanged:!0}},serverInfo:Od}}}async function Ad(e,t){const n=!0===(null==t?void 0:t.proxy),{method:o,params:i,id:a}=e;if("initialize"===o)return Rd(null!=a?a:0);if("ping"===o)return{jsonrpc:"2.0",id:a,result:{}};if("notifications/initialized"===o||"notifications/cancelled"===o)return null;if("tools/list"===o){try{Ju()}catch{}let e=_u;if(n){const t=await async function(){try{var e,t;const n=await fetch(Td,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/list"}),signal:AbortSignal.timeout(2e3)});return n.ok&&null!=(e=null==(t=(await n.json()).result)?void 0:t.tools)?e:[]}catch{return[]}}();if(t.length>0){const n=new Set(_u.map(e=>e.name));e=[..._u,...t.filter(e=>!n.has(e.name))]}}return{jsonrpc:"2.0",id:a,result:{tools:e}}}if("tools/call"===o){const e=null==i?void 0:i.name;try{Ju()}catch{}try{return{jsonrpc:"2.0",id:a,result:await $u(e,(null==i?void 0:i.arguments)||{})}}catch(t){if(n)try{const t=await async function(e,t){const n=await fetch(Td,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:e,arguments:t}}),signal:AbortSignal.timeout(35e3)}),o=await n.json();if(o.error)throw new Error(o.error.message);return o.result}(e,(null==i?void 0:i.arguments)||{});return{jsonrpc:"2.0",id:a,result:t}}catch{}return{jsonrpc:"2.0",id:a,error:{code:-32603,message:`Tool execution failed: ${t.message}`}}}}return{jsonrpc:"2.0",id:null!=a?a:null,error:{code:-32601,message:`Method '${o}' not found`}}}function Cd(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let Nd=!1;const Id=Te(),Pd=new Set,Ud=new Map;let Ld=0;function zd(){const e=[];for(const[t,{connectedAt:n,userAgent:o}]of Ud)e.push({id:t,connectedAt:n,userAgent:o});return e}function Fd(e,t,n){if((t.headers.accept||"").includes("text/event-stream")){n.setHeader("Content-Type","text/event-stream"),n.setHeader("Cache-Control","no-cache"),n.setHeader("Connection","keep-alive"),n.setHeader("Access-Control-Allow-Origin","*"),n.setHeader("Access-Control-Expose-Headers","Mcp-Session-Id"),n.flushHeaders(),n.write(": connected\n\n");const o=t.headers["user-agent"]||"";return Ud.set(e,{id:e,client:n,connectedAt:Date.now(),userAgent:o}),console.log(`[MCP] SSE client connected (ID: ${e}) ${o}. Total clients: ${Ud.size}`),Zl(`MCP SSE client connected (ID: ${e}) ${o}. Total clients: ${Ud.size}`),t.on("close",()=>{console.log(`[MCP] SSE client disconnected (ID: ${e}): ${o}`),Zl(`MCP SSE client disconnected (ID: ${e}): ${o}`),Ud.delete(e)}),!0}return!1}function Dd(e){if(!Array.isArray(e))return console.error("Invalid input: paths should be an array of strings."),null;for(const t of e)if(!1!==c(t))try{const e=qd(t);if(e)return e}catch(e){}}function qd(e){const t=w(e,".git");if(c(t)){const e=function(e){const t=h(e);if(t.isDirectory())return w(e,"config");if(t.isFile()){const t=p(e,"utf-8").trim().match(/^gitdir:\s*(.+)$/);if(t){let n=t[1].trim();S(n)||(n=y(j(e),n));const o=w(n,"config");if(c(o))return o;const i=w(n,"commondir");if(c(i)){let e=p(i,"utf-8").trim();return S(e)||(e=y(n,e)),w(e,"config")}}}return null}(t);if(e&&c(e)){const t=function(e){const t=p(e,"utf-8"),n=/\[remote\s+"(?<name>.+?)"\].+?url\s*=\s*(?<url>.+?)$/gms,o=[];let i;for(;null!==(i=n.exec(t));)if(i.groups){const e=i.groups.name,t=i.groups.url.trim();t.length&&o.push({name:e,url:t})}const a=o.find(e=>"origin"===e.name)||o.find(e=>"upstream"===e.name)||o[0];return a?a.url:null}(e);if(t)return t}}const n=w(e,".plastic");if(c(n)){const e=w(n,"replicas.db");if(c(e)){const t=p(e,"utf-8").split("\n");for(const e of t){const t=e.split("=");if(2===t.length&&"repo"===t[0].trim()){const e=t[1].trim();if(e.length)return e}}}}const o=w(e,"..");return o===e?null:qd(o)}Id.get("/mcp",async(e,t)=>{if(Fd(Ld++,e,t))return;const n=function(e){const t=[..._u].sort((e,t)=>e.name.localeCompare(t.name)),n=t.map(e=>`\n <div class="tool">\n <span class="tool-name">${Cd(e.name)}</span>\n <span class="tool-desc">${Cd(function(e){const t=e.indexOf("\n");return-1===t?e:e.slice(0,t)}(e.description))}</span>\n </div>`).join("\n");return`<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <title>Needle MCP Server</title>\n <style>\n * { box-sizing: border-box; }\n body {\n background: #f0f4ef;\n font-family: system-ui, -apple-system, sans-serif;\n line-height: 1.6;\n padding: 20px 24px;\n max-width: 960px;\n margin: 0 auto;\n color: #1a1a1a;\n }\n header {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 8px;\n }\n h2 {\n margin-top: 1.2em;\n margin-bottom: 0.4em;\n }\n a { color: inherit; }\n img.logo {\n height: 2em;\n width: auto;\n }\n .badge {\n font-size: 0.75em;\n background: #d0d4cf;\n padding: 2px 8px;\n border-radius: 10px;\n vertical-align: middle;\n font-weight: normal;\n }\n .tools-info {\n color: #555;\n font-size: 0.9rem;\n margin-top: 0;\n margin-bottom: 10px;\n }\n\n /* Tool items */\n .tool {\n background: #fff;\n border: 1px solid #d8dcd7;\n border-radius: 6px;\n margin-bottom: 6px;\n padding: 10px 14px;\n display: flex;\n align-items: baseline;\n gap: 10px;\n }\n .tool-name {\n font-weight: 600;\n white-space: nowrap;\n }\n .tool-desc {\n color: #555;\n font-size: 0.9rem;\n }\n</style>\n</head>\n<body>\n <header>\n <img class="logo" src="https://cdn.needle.tools/static/branding/logo_needle.png" alt="Needle Logo" />\n <strong>Needle MCP Server</strong>\n </header>\n\n <p>The Needle MCP server is alive and running.</p>\n\n <h2>Usage</h2>\n <p><a href="https://fwd.needle.tools/mcp">Open Documentation</a></p>\n\n <h2>Available Tools <span class="badge">${t.length}</span></h2>\n <p class="tools-info">These tools are available to AI agents connected via the Model Context Protocol (MCP).</p>\n ${n}\n</body>\n</html>`}();t.status(200).header("Content-Type","text/html; charset=utf-8").send(n)}),Id.post("/mcp",async(e,t)=>{const n=e.headers.accept||"",o=e.headers["user-agent"]||"",{method:i,id:a}=e.body;console.log(`[MCP] Received request from ${o} (${i}) (ID: ${a})`),t.setHeader("Content-Type","application/json"),t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, Mcp-Session-Id"),t.setHeader("Access-Control-Expose-Headers","Mcp-Session-Id");try{if("initialize"===i&&n.includes("text/event-stream")){const n=void 0!==a?a:Ld++;if(Fd(n,e,t)){Nd=!0;const e=Rd(n);return void t.write(`data: ${JSON.stringify(e)}\n\n`)}}const r=await Ad(e.body);if("initialize"===i){Nd=!0;const e=le();Pd.add(e),t.setHeader("Mcp-Session-Id",e),console.log(`[MCP] New session created: ${e} for ${o}`),Zl(`MCP New session: ${e} for ${o}`)}if(null===r)return t.status(204).end();if(Zl(`MCP Request: ${i}`),"tools/list"===i){var s;const e=(null==(s=r.result)||null==(s=s.tools)?void 0:s.map(e=>e.name))||[];console.log(`[MCP] Sending tools/list: ${e.length} tools [${e.join(", ")}]`)}else{const e=JSON.stringify(r);console.log(`[MCP] Sending response for ${i}:`,e.length>500?e.substring(0,500)+" [...]":e)}t.json(r)}catch(e){console.error("[MCP] Error processing request:",e);const n={jsonrpc:"2.0",error:{code:-32603,message:"Internal server error",data:"development"===process.env.NODE_ENV?e.stack:void 0},id:a||null};t.json(n)}}),Id.options("/mcp",(e,t)=>{t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Allow-Methods","GET, POST, OPTIONS, DELETE"),t.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, Mcp-Session-Id"),t.setHeader("Access-Control-Expose-Headers","Mcp-Session-Id"),t.status(204).end()});let Bd=!1;function Md(e,t={}){Bd&&process.stdout.write(JSON.stringify({jsonrpc:"2.0",method:e,params:t})+"\n")}var Wd={__proto__:null,sendStdioNotification:Md,startStdio:function(){Bd=!0,process.stdin.resume();const e=Se({input:process.stdin,terminal:!1});e.on("line",async e=>{const t=e.trim();if(!t)return;let n;try{n=JSON.parse(t)}catch{return void process.stdout.write(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Parse error"}})+"\n")}const o=await Ad(n,{proxy:!0});null!==o&&process.stdout.write(JSON.stringify(o)+"\n")}),e.on("close",()=>{Bd=!1,process.exit(0)})}};let Gd=null;function Hd(){Gd&&clearTimeout(Gd),Gd=setTimeout(()=>{!function(e,t={}){if(0===Ud.size)return;const n=`data: ${JSON.stringify({jsonrpc:"2.0",method:"notifications/tools/list_changed",params:t})}\n\n`;for(const[e,{client:t}]of Ud)try{t.write(n)}catch(t){console.error(`[MCP] Error sending notification to client (${e}):`,t),Ud.delete(e)}}(),Md("notifications/tools/list_changed")},10)}const Jd=new Set(["https://cloud.needle.tools","https://needle.tools","https://engine.needle.tools","https://docs.needle.tools","chrome-extension://kjcepmifiddcepiocokclhibpkgcdomk","chrome-extension://jonplpbnhmanoekkgcepnedhghflblmo"]),Vd=new Set(["localhost","127.0.0.1","[::1]","::1"]);function Kd(e){if("string"!=typeof e||0===e.length)return!1;if(Jd.has(e))return!0;let t;try{t=new URL(e)}catch{return!1}if("/"!==t.pathname&&""!==t.pathname)return!1;if(""!==t.search||""!==t.hash)return!1;if("http:"!==t.protocol&&"https:"!==t.protocol)return!1;const n=t.hostname.toLowerCase();return!!Vd.has(n)||"::1"===n}const Yd="[MCP]",Zd=new Array,Xd="2026-09-30T17:42:00.756Z";var Qd={__proto__:null,BUILD_TIME:Xd};const{json:em}=Ne;function tm(e){const t=null==e?void 0:e.cause;return null!=t&&t.code?`${t.code}${t.address?` (${t.address}:${t.port})`:""}`:null!=t&&t.message?t.message:null!=e&&e.code?e.code:null!=e&&e.message&&"fetch failed"!==e.message?e.message:"connection refused or network unreachable"}async function nm(t={restart:!1}){const n=await e(up).catch(e=>({ok:!1})),o="/sign-in",a="/api/authenticated",s="/api/projects",r="/api/content",l={baseUrl:up,port:pp,isHost:!1,auth_endpoints:{"sign-in":`${up}${o}`,"sign-out":`${up}/sign-out`,"is-authenticated":`${up}${a}`}};let p=n.ok;if(p){var u;const m=await e(`${up}/api/info`).catch(()=>null);if(null!=m&&m.ok){const h=await m.json().catch(()=>null);null!=h&&h.api_endpoint&&"https://cloud.needle.tools/api"!==h.api_endpoint&&(Zl(`Running server uses different API endpoint (${h.api_endpoint} vs https://cloud.needle.tools/api), restarting...`),t||(t={}),t.restart=!0)}if(!0===(null==(u=t)?void 0:u.restart)){Zl("Restarting auth server...");const v=`${up}/restart`;t.ora&&(t.ora.text="Sending restart request to server");const x=new AbortController;setTimeout(()=>x.abort(),1e4);let b={};try{const _=w(he(),".needle","local-server-token"),k=JSON.parse((await import("fs")).readFileSync(_,"utf-8"));k.token&&(b={Authorization:`Bearer ${k.token}`})}catch{}const y=await e(v,{method:"post",signal:x.signal,headers:b}).catch(e=>({ok:!1,status:400,error:e}));if(y.ok)return await Bc(300),nm({restart:!1});console.error("Failed to restart server",y.status),Zl(`Failed to restart server: ${y.status}`)}}if(!p){process.title="Needle CLI server";const S=await import("express").catch(e=>{throw console.error("Error starting the auth server (express not found)",e),Zl("Error starting the auth server"),new Error("Failed to load express module")});if(!S)throw Zl("Error loading auth server module"),new Error("Failed to load express module");Zl(`Starting Needle CLI server ${bu()} (built ${Xd})... (Using api at https://cloud.needle.tools/api)`,{emptyLineBefore:!0}),l.isHost=!0;let j=null;const E={invalid_login:!1,invalid_login_type:null,user_email:null,logged_in_machine_names:[]};let O=S.default();O.use(em({limit:"10mb"}));const R=w(he(),".needle"),A=function(e,t){var n;const o=K(e,"local-server-token"),a=null!=(n=function(e){if(!T(e))return null;try{const t=D(e,"utf-8");if(0===t.length)return null;const n=JSON.parse(t);if(n&&"string"==typeof n.token&&n.token.length>0)return n.token}catch{}return null}(o))?n:i();$(e,{recursive:!0});const s=JSON.stringify({token:a,pid:process.pid,port:t},null,2);if(B(o,s,{encoding:"utf-8",mode:384}),"win32"===process.platform)try{const e=process.env.USERNAME||process.env.USER||"";e&&Ae("icacls",[o,"/inheritance:r","/grant:r",`${e}:(F)`],{stdio:"ignore",timeout:5e3})}catch{}return a}(R,pp);Zl(`Local token written to ${w(R,"local-server-token")}`);const C=function(e,t=5e3){const n=new Map,o=Math.max(1,Math.round(t/1e3));return(i,a)=>{const s=Date.now(),r=n.get(i);if(!r||s-r.lastLog>t){var c;const t=null!=(c=null==r?void 0:r.suppressed)?c:0;e(t>0?`${a} [+${t} similar in last ${o}s]`:a),n.set(i,{lastLog:s,suppressed:0})}else r.suppressed++}}(e=>Zl(`Denied: ${e}`),5e3);O.use(function(e){const t=null==e?void 0:e.onDenied;return(e,n,o)=>{var i,a;if("OPTIONS"===e.method)return o();const s=null==(i=e.headers)?void 0:i.origin,r=null==(a=e.headers)?void 0:a["sec-fetch-site"];if("none"===r||"same-origin"===r)return o();if(s){if(Kd(s))return o();if(t)try{var c,l,p,u;const n=null!=(c=null==(l=e.headers)?void 0:l["user-agent"])?c:"unknown",o=null!=(p=null!=(u=e.path)?u:e.url)?p:"?";t(`origin|${s}|${o}`,`denied origin=${s} path=${o} ua="${n}"`)}catch{}return n.status(403).send("Forbidden: origin not allowed")}return o()}}({onDenied:C}));const N=new Set(["/","/sign-in","/sign-out","/auth-callback","/api/info","/api/authenticated","/api/public_key","/mcp","/register"]),I="needle_local";O.use((e,t,n)=>{var o,i,a;if("OPTIONS"===e.method)return n();if(N.has(e.path))return n();if(e.path.startsWith("/mcp/"))return n();if(e.path.startsWith("/.well-known/"))return n();const s=null==(o=e.headers)?void 0:o.authorization;if(s){const e=s.split(" ");if(2===e.length&&"Bearer"===e[0]&&e[1]===A)return n()}if((null==(i=e.query)?void 0:i.token)===A)return n();const r=((null==(a=e.headers)?void 0:a.cookie)||"").split(";").map(e=>e.trim()).find(e=>e.startsWith(I+"="));if(r&&r.split("=")[1]===A)return n();try{var c,l;const t=null!=(c=null==(l=e.headers)?void 0:l["user-agent"])?c:"unknown";C(`token|${t}|${e.path}`,`path=${e.path} ua="${t}" — no valid token or cookie`)}catch{}return t.status(401).send("Unauthorized: token required")}),O.use(kd(E)),t.ora?(t.ora.start("Starting MCP server..."),t.ora.succeed(`MCP server available at ${up}/mcp`)):console.log(`\nMCP server available at ${up}/mcp .`),O.use(Id);const P="\n <title>Needle Cloud</title>\n <link rel=\"icon\" href=\"https://cdn.needle.tools/static/branding/favicon.ico\" type=\"image/x-icon\">\n <style>\n body { \n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;\n font-size: 18px;\n padding: 2rem;\n background: #f0f4ef;\n }\n a {\n color: rgb(120, 76, 223);\n }\n .main_panel {\n display: flex;\n flex-direction: column;\n gap: .5rem;\n justify-content: flex-start;\n align-items: center;\n width: min(80ch, 90vw);\n margin: 0 auto;\n\n height: 100%;\n\n & img.logo {\n height: 3rem;\n margin-bottom: 1rem;\n }\n }\n .secondary {\n color: rgba(0, 0, 0, .5);\n }\n .error-details {\n font-size: 12px;\n color: rgba(0, 0, 0, .5);\n }\n .error-details a {\n color: inherit;\n }\n </style>",U=`<div class="main_panel"><img class="logo" src="https://cdn.needle.tools/static/branding/logo_needle.png" alt="Needle Logo" title="Needle Logo (${bu()})"/>`,L="</div>";let z="";O.get("/",Ed(),async(e,t)=>{var n,i;if(null!=(n=e.user)&&n.isAuthenticated?t.cookie(I,A,{httpOnly:!0,sameSite:"strict",path:"/"}):t.clearCookie(I,{path:"/"}),t.set({"Content-Type":"text/html; charset=utf-8"}),t.write(P),null!=e.query.cancelled)return t.end("Login cancelled. You can close this window now."),void Zl("Login cancelled by user");if(null!=e.query["too-many-logins"]&&E.logged_in_machine_names.length){var a;const e=Nl();let n="<div>";return n+="<strong>You have reached the maximum number of allowed device logins!</strong><br/><br/>",n+=(null==(a=E.logged_in_machine_names)?void 0:a.map(e=>`• ${e}`).join("<br/>"))+"<br/><br/>",n+=`1) Go to <a href="${e}#device-logins" target="_blank">Needle Cloud device logins</a> and logout one of your devices.<br/>\n 2) Then <a href="${o}">sign-in on this machine</a>.<br/><br/>`,n+="</div>",t.status(406),t.end(U+n+L),void Zl(`Login failed: Too many logins from different machines: [${E.logged_in_machine_names.join(", ")}]`)}if(null!=e.query.error)return t.status(500),void t.end(`${U}\n <div>\n <strong>An error occurred</strong>: Please make sure <i>https://cloud.needle.tools/api</i> and <i>https://auth.needle.tools</i> are reachable and not blocked by your firewall or network. After that please try to <a href="${o}">sign-in</a> again.\n <br/><span class="error-details">If the issue persists, please contact support and include the log file: <a title="Link to local log file. Please copy this url and open it in your file explorer or terminal" href="file://${Vl()}" target="_blank">${Vl()}</a></span>\n </div>\n ${L}`);if(null!=(i=e.user)&&i.isAuthenticated){var s;if(!await lu(e.user)){if(E.invalid_login=!0,E.logged_in_machine_names=[...ru(e.user)],Up(),Zl("Cleared stored auth data"),"client"in e.user){const t=e.user;await t.client.clearAccessToken(),await t.client.clearAllTokens(),Zl("Cleared all tokens")}return t.end(`${U}<div>You have been logged out from this machine. You can close this window now or try to <a href="${o}">sign in</a> again</div>${L}`)}E.invalid_login=!1,t.end(`${U}\n <div>\n Hi ${Sd(e.user)} — you logged in successfully. You can close this window now.\n </div>\n ${L}`);const n=`Logged in successfully as ${Sd(e.user)} (${null==(s=e.user.userInfo)?void 0:s.sub})`;return void(z!==n&&(z=n,Zl(z)))}let r=`<span><a href="${o}">Sign in</a> to your Needle account</span>`;"1"===e.query["signed-out"]&&(r=`<span class="secondary">You have been signed out successfully.</span>${r}`),t.write(U+r+L),t.end()}),O.post("/restart",(e,n)=>{var o;t.ora&&(t.ora.text="Received restart event. This instance will close"),null==(o=j)||o.close(e=>{e&&console.error(e)}),setTimeout(()=>{process.exit(0)},100),n.status(200).end("Server is restarting"),Zl("Server is restarting\n")}),O.get("/api/logs",async(e,t)=>{const n=Vl();c(n)?g(n,"utf-8",(e,o)=>{if(e)return console.error(e),void t.status(500).end("Failed to read log file");t.set({"Content-Type":"text/plain; charset=utf-8"});const i=o.split("\n").filter(e=>e.length>0).reverse().join("\n");let a=`--- Needle CLI v${bu()} (built ${Xd}) Log File (newest first) ---\n${n}\n\n`;a+=i,t.status(200).end(a)}):t.status(404).end("Log file not found")}),O.get("/api/info",(e,t)=>{t.json({api_endpoint:"https://cloud.needle.tools/api",version:bu()})}),O.get(a,Ed(),async(e,t)=>{var n;if(!0===E.invalid_login){const e=om(E);return t.status(e.status).json(e)}E.invalid_login=!1,t.status(null!=(n=e.user)&&n.isAuthenticated?200:400).send()}),O.get("/api/user",Ed(),async(e,t)=>{var n;const o=e.user;if(null==o||!o.isAuthenticated){if(!0===E.invalid_login){const e=om(E);return t.status(e.status).json(e)}return t.status(401).json({error:"Not authenticated"})}if(E.invalid_login=!1,!await lu(o))return Up(),t.status(403).json({error:"You have been logged out from this machine"});if(null==o||!o.claims)return t.status(400).json({error:"User claims not found"});if(null==o||!o.userInfo)return t.status(400).json({error:"User info not found"});const i=null==o||null==(n=o.claims)?void 0:n.organization_roles,a=null==o?void 0:o.userInfo.custom_data,s={authenticated:o.isAuthenticated,id:o.userInfo.sub,name:Sd(o),email:o.claims.email||o.userInfo.email||"",profile_picture:o.userInfo.picture||"",default_org_id:(null==a?void 0:a.default_org)||"none",orgs:[]},r=["manage","owner","member","developer"];o.userInfo.organization_data&&(s.orgs=o.userInfo.organization_data.map(e=>{var t;const n={id:e.id,name:e.name,roles:(null==i?void 0:i.filter(t=>t.startsWith(e.id)).map(e=>e.split(":")[1]))||[],canWrite:!1};return n.canWrite=null==(t=n.roles)?void 0:t.some(e=>r.includes(e)),n}).sort((e,t)=>e.id===s.default_org_id?-1:t.id===s.default_org_id?1:e.name.localeCompare(t.name))),t.json(s)}),O.get("/api/license",Ed(),async(t,n)=>{var o,i,a;const s=null==(o=t.query.token)?void 0:o.toString(),r=null==(i=t.query.org)?void 0:i.toString();let c=null;if(s)c={authToken:s};else{const e=await tu();if(!e||!e.isAuthenticated)return n.status(401).json({error:"Not authenticated",code:"not_authenticated"});if(!await lu(e))return Up(),n.status(403).json({error:"Invalid login"});c=await jd(e,r||null).catch(e=>({status:500,error:e.message}))}if(!c)return n.status(500).json({error:"Failed to fetch licenses (Missing auth)"});if("error"in c)return n.status(c.status).json({error:c.error});const l=Ke(c),p=null==(a=t.query.integration)?void 0:a.toLocaleString(),u={...l,"x-needle":"cli","x-needle-integration":null!=p&&p.length?p:"unknown"},d=await e(`https://cloud.needle.tools/api${Ve.account.get_licenses}`,{method:"GET",headers:u}).catch(e=>{const t=tm(e);return console.error("Failed to fetch licenses:",t),Zl(`Failed to fetch licenses: "${t}" - is https://cloud.needle.tools/api reachable?`),null});if(!d)return n.status(502).json({error:"Failed to fetch licenses: upstream API unreachable"});if(d.ok){const e=await d.json();return void 0===e.can_use_editor&&(e.can_use_editor=!0),n.json(e)}return n.status(d.status).json({error:d.statusText})}),O.get("/api/deployments",Ed(),async(e,t)=>{var n;const o=await tu();if(!o||!o.isAuthenticated)return t.status(401).json({error:"Not authenticated"});const i=null==(n=e.query.org)?void 0:n.toString(),a=await jd(o,i).catch(e=>({status:500,error:e.message}));if("error"in a)return t.status(a.status).json({error:a.error});if(i&&!a.org)return t.status(400).json({error:"Organization not found"});const s=await sp({endpoint:"https://cloud.needle.tools/api",authToken:a.authToken,org:a.org||void 0,limit:20,offset:0,names:void 0}).catch(e=>(console.error("List Deployments error: "+e.message),{status:502,error:"Failed to list deployments: upstream API unreachable"}));if("error"in s)return t.status(s.status).json({error:s.error});for(const e of s.deployments)e.editUrl=`${Il()}/${e.id}`;const r={...s};return t.json(r)}),O.get(r,Ed(),async(e,t)=>{var n,o,i,a,s,r,c,l;const p=await tu();if(!p||!p.isAuthenticated)return t.status(401).json({error:"Not authenticated"});const u=(null==(n=e.query.org)?void 0:n.toString())||(null==(o=p.userInfo)||null==(o=o.custom_data)?void 0:o.default_org)||void 0,d=await jd(p,u).catch(e=>({status:500,error:e.message}));if("error"in d)return t.status(d.status).json({error:d.error});const m={content_type:(null==(i=e.query.content_type)?void 0:i.toString())||void 0,content_format:(null==(a=e.query.content_format)?void 0:a.toString())||void 0,search:(null==(s=e.query.search)?void 0:s.toString())||void 0,tags:(null==(r=e.query.tags)?void 0:r.toString())||void 0,types:(null==(c=e.query.types)?void 0:c.toString())||void 0,trash:"true"===e.query.trash||void 0,collection_id:(null==(l=e.query.collection_id)?void 0:l.toString())||void 0,limit:e.query.limit?parseInt(e.query.limit.toString()):void 0,page:e.query.page?parseInt(e.query.page.toString()):void 0,offset:e.query.offset?parseInt(e.query.offset.toString()):void 0},f=await xl({baseUrl:"https://cloud.needle.tools/api",authToken:d.authToken,org:d.org||void 0},m).catch(e=>(console.error("List content error: "+e.message),{status:502,error:"Failed to list content: upstream API unreachable"}));return"error"in f?t.status(f.status).json({error:f.error}):t.json(f)}),O.get(r+"/:identifier",Ed(),async(e,t)=>{var n,o;const i=await tu();if(!i||!i.isAuthenticated)return t.status(401).json({error:"Not authenticated"});const a=(null==(n=e.query.org)?void 0:n.toString())||(null==(o=i.userInfo)||null==(o=o.custom_data)?void 0:o.default_org)||void 0,s=await jd(i,a).catch(e=>({status:500,error:e.message}));if("error"in s)return t.status(s.status).json({error:s.error});const r=await bl({baseUrl:"https://cloud.needle.tools/api",authToken:s.authToken,org:s.org||void 0},e.params.identifier).catch(e=>(console.error("Get content error: "+e.message),{status:502,error:"Failed to get content: upstream API unreachable"}));return"error"in r?t.status(r.status).json({error:r.error}):t.json(r)}),O.get(s,Ed(),async(t,n)=>{const o=await tu();if(!o||!o.isAuthenticated)return n.status(401).json({error:"Not authenticated"});const i=`https://cloud.needle.tools/api${Ve.local_projects.get.user}`,a=await e(i,{method:"GET",headers:{Authorization:`Bearer ${o.accessToken}`}}).catch(e=>(console.error("Failed to fetch projects:",tm(e)),null));if(!a)return n.status(502).json({error:"Failed to fetch projects: upstream API unreachable"});if(!a.ok)return n.status(a.status).json({error:a.statusText});const s=await a.json().catch(e=>console.error(e));return n.json(s)}),O.get(s+"/:id",Ed(),async(t,n)=>{var o;const i=await tu();if(!i||!i.isAuthenticated)return n.status(401).json({error:"Not authenticated"});let a=null==(o=t.query.org)?void 0:o.toString();const s=await jd(i,a).catch(e=>({status:500,error:e.message}));if(!s)return n.status(500).json({error:"Failed to fetch projects"});if("error"in s)return n.status(s.status).json({error:s.error});const r=Ke(s),c=`https://cloud.needle.tools/api${Ve.local_projects.get.by_id}${encodeURIComponent(t.params.id)}`,l=await e(c,{method:"GET",headers:{...r}}).catch(e=>(console.error("Failed to fetch project:",tm(e)),null));if(!l)return n.status(502).json({error:"Failed to fetch project: upstream API unreachable. Please try again later or contact hi@needle.tools"});if(!l.ok)return n.status(l.status).json({error:l.statusText});const p=await l.json().catch(e=>(console.error(e),null));return p?n.json(p):n.status(500).json({error:"Failed to parse data. Please try again later or contact hi@needle.tools"})}),O.post("/api/projects",Ed(),async(t,n)=>{const o=await tu();if(!o||!o.isAuthenticated)return n.status(401).json({error:"Not authenticated"});const i="string"==typeof t.body?JSON.parse(t.body):t.body,a={machine_id:await pu(),project_id:i.project_id,project_name:i.project_name,scene_name:i.scene_name,web_project_path:i.web_project_path,editor_name:i.editor_name,editor_version:i.editor_version};if(!a.project_id||!a.project_name)return n.status(400).json({error:"Invalid request"});const s=`https://cloud.needle.tools/api${Ve.local_projects.post}`,r=await e(s,{method:"POST",headers:{Authorization:`Bearer ${o.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify(a)}).catch(e=>(console.error("Failed to upsert project:",tm(e)),null));return r?r.ok?n.send("OK"):n.status(r.status).json({error:r.statusText}):n.status(502).json({error:"Failed to upsert project: upstream API unreachable"})}),O.get("/api/public_key",Ed(),async(t,n)=>{var o,i;const a=await tu();if(!a||!a.isAuthenticated)return n.status(401).json({error:"Not authenticated"});const s=null==(o=t.query.org)?void 0:o.toString(),r=await jd(a,s).catch(e=>({error:e.message,status:500}));if(!r)return n.status(500).json({error:"Failed to fetch public key"});if("error"in r)return n.status(r.status).json({error:r.error});const c={project_id:(null==(i=t.query.project_id)?void 0:i.toString())||void 0,machine_id:await pu()},l=await e(`https://cloud.needle.tools/api${Ve.account.public_key}`,{method:"POST",headers:{...Ke(r),"Content-Type":"application/json"},body:JSON.stringify(c)}).catch(e=>(console.error("Failed to fetch public key:",tm(e)),null));if(!l)return n.status(502).json({error:"Failed to fetch public key: upstream API unreachable"});if(l.ok){const e=await l.json().catch(console.error);return null!=e&&e.public_key?n.json(e):n.status(500).json({error:"Failed to fetch public key"})}return n.status(l.status).json({error:l.statusText})}),O.get("/api/local_project_id",async(e,t)=>{const n=e.query.paths;if(!n)return t.status(400).json({error:"Missing paths"});let o=[];"string"==typeof n?o=n.split(",").map(e=>e.trim()).filter(e=>e.length>0):Array.isArray(n)&&(o=n.map(e=>e.toString().trim()).filter(e=>e.length>0));const i=Dd(o);return i?t.json({project_id:i}):t.status(404).json({error:"Project ID not found"})}),O.post("/api/project/info",Ed(),async(e,t)=>{(function(e){try{!function(e){var t,n,o,i;const a={last_accessed:Date.now(),editor:null!=(t=e.scene_path)&&t.endsWith(".unity")?"unity":null!=(n=e.scene_path)&&n.endsWith(".blend")?"blender":"unknown",editor_version:e.editor_version,editor_installation_path:e.editor_installation_path,log_location:e.editor_log_path,project_location:e.unity_project_path||e.blender_project_path||e.scene_path,scene_location:e.scene_path,web_location:e.web_project_path,needle_engine_integration_location:e.needle_sourcecode_location},s=gu();let r=vu();const c=r.entries.findIndex(e=>e.project_location===a.project_location),l=null==(o=r.entries[0])?void 0:o.project_location;-1!==c?r.entries[c]=a:r.entries.push(a),r.entries.sort((e,t)=>t.last_accessed-e.last_accessed),r.entries.length>30&&(r.entries=r.entries.slice(0,30));const p=null==(i=r.entries[0])?void 0:i.project_location;p&&p!==l&&Zl(`Active project changed: ${l||"(none)"} → ${p}`);try{mu=r;const e=JSON.stringify(r);f(s,e,"utf-8")}catch(e){console.error("Failed to save project info:",e)}}(e)}catch(e){Zl("Error saving project info: "+e)}})("string"==typeof e.body?JSON.parse(e.body):e.body),t.send("OK")});let F=null;const q=new Promise(e=>F=e);let M=!1;if(j=O.listen(pp,()=>{null==F||F()}),j.on("error",e=>{if("EADDRINUSE"===(null==e?void 0:e.code))return Zl(`License server port ${pp} already in use — a server is already running; not starting a second one.`),M=!0,l.isHost=!1,void(null==F||F());console.error("[needle] License server failed to start:",(null==e?void 0:e.message)||e),Zl(`License server failed to start: ${(null==e?void 0:e.message)||e}`),process.exit(1)}),function(e,t){e.on("connection",e=>{const n=e.remoteAddress;if(!function(e){if(!e)return!1;const t=e.includes("%")?e.slice(0,e.indexOf("%")):e;return"127.0.0.1"===t||"::1"===t||"::ffff:127.0.0.1"===t}(n)){try{null==t||t(`Local server: rejected non-loopback connection from ${n||"unknown"}`)}catch{}e.destroy()}})}(j,Zl),j.on("close",d),process.on("exit",d),process.on("SIGINT",()=>{d(),process.exit(0)}),await q.catch(e=>{console.error(e),Zl(`Error starting the auth server (promise failed): ${e.message}`)}),M)return l;function d(){Zl("Cleaning up auth server...")}(function(e,t){const n=new Oe({server:e,path:"/mcp/ws",verifyClient:({req:e},t)=>{var n;const o=null==(n=e.headers)?void 0:n.origin;if(o&&!Kd(o))return Zl(`${Yd} rejected WS upgrade: disallowed origin ${o}`),void t(!1,403,"Forbidden: origin not allowed");t(!0)}});Zl("MCP websocket server created.");let o=0,i=new Map;n.on("connection",e=>{const t=++o;Zd.push(e),console.log(`${Yd} client connected (#${t})`),Zl(`${Yd} client connected (#${t})`),e.on("close",()=>{const n=Zd.indexOf(e);-1!==n&&Zd.splice(n,1);const o=i.get(t);if(o){for(const e of o)ju(e,Hd);i.delete(t)}console.log(`${Yd} client disconnected (#${t})`),Zl(`${Yd} client disconnected (#${t})`)});const n=new Map;e.on("message",o=>{try{const a=o.toString(),s=JSON.parse(a);switch(s.command){default:console.log(`${Yd} Unknown command: ${s.command}`),Zl(`Unknown MCP websocket command received: ${s.command}`);break;case"get_connected_clients":!function(t,n){const o={clients:[...zd()],command:"mcp_server_response",messageId:"messageId"in t?t.messageId:void 0};e.send(JSON.stringify(o))}(s);break;case"register_tools":{const o=s.tools,a=s.source;if("cli"===a)throw new Error("The CLI tool source is reserved for built-in tools.");a&&function(e,t){const n=Su.get(e);if(n&&n.size>0){console.log(`[MCP] Removing ${n.size} tools registered from ${e}`);let o=!1;for(const t of n){const n=_u.findIndex(e=>e.name===t);-1!==n&&(_u.splice(n,1),delete ku[t],Tu.set(t,e),o=!0)}Su.delete(e),o&&t()}}(a,Hd);const r=a||"unknown";console.log(`${Yd} ${r} registered ${o.length} tool${1===o.length?"":"s"}`),Zl(`${Yd} ${r} registered ${o.length} tool${1===o.length?"":"s"}`);const c=i.get(t)||new Set;i.set(t,c);for(const t of o)Eu(t,async o=>{console.log(`Tool ${t.name} executed via WebSocket with args:`,o);const i=`${t.name}-${Date.now()}-${Math.random()}`;return await new Promise((a,s)=>{const r=setTimeout(()=>{n.has(i)&&(console.error(`${Yd} Tool execution timed out for tool: ${t.name}`),n.delete(i),s(new Error(`Tool execution timed out for tool: ${t.name}`)))},3e4);n.set(i,{resolve:e=>{a(e),clearTimeout(r)},reject:s}),e.send(JSON.stringify({command:"execute_tool",toolName:t.name,args:o,requestId:i}))})},{source:a},Hd),c.add(t.name);break}case"tool_result":{const e=s.requestId,t=s.result;if(console.log(`${Yd} Received tool result for requestId: ${e}`,t),n.has(e)){const o=n.get(e);null==o||o.resolve(t),n.delete(e)}else console.error(`${Yd} No pending tool execution found for requestId: ${e}`);break}}}catch(e){console.error(`${Yd} Error processing WebSocket message:`,e)}})})})(j),Ju({logToolCount:!0}),xd();const W=id(R,()=>{od()?(Zl("Settings changed: remote_ai_tools disabled — closing cloud connection"),bd("remote_ai_tools setting disabled")):(Zl("Settings changed: remote_ai_tools enabled — opening cloud connection"),xd())});process.on("exit",()=>{W(),bd("process exit")})}return l}function om(e){let t="";return t=e.error?e.error:e.logged_in_machine_names.length>0?`You're already authenticated on ${e.logged_in_machine_names.length} other machine(s)${e.user_email?` with ${e.user_email}`:""}. Please logout from other machines first on ${Nl()}. You're currently logged in on: ${e.logged_in_machine_names.join(", ")}`:"An unknown error occured.",{status:403,error:t}}async function im(e={headless:!1,silent:!1,clearAuthData:!1}){return!0===e.clearAuthData&&await Up(),sm("sign-in",{...e})}function am(e={}){return sm("sign-out",{...e})}function sm(t,n){return new Promise(async(o,i)=>{let a=!1;if("sign-in"==t){const e=await tu();if(null!=e&&e.isAuthenticated&&e.accessToken)return await du(e)?(a=!0,n.ora&&(n.ora.text=`Authorized as ${Sd(e)}`),"gotoAccountPage"in n&&!0===n.gotoAccountPage&&(n.ora&&(n.ora.text="Opening account page in the browser"),Pl(Nl()),await new Promise(e=>setTimeout(e,2e3))),o(e)):o(null);if(!0===n.headless)return o(null)}else if("sign-out"==t&&!0===n.headless){a=!0,Up();const t=await nm(),n=await e(t.auth_endpoints["sign-out"],{follow:2});return o(n.ok)}const s=await nm();switch(n.timeout||(n.timeout=6e5),"number"==typeof n.timeout&&n.timeout>0&&setTimeout(()=>{a||(n.ora&&n.ora.fail('Timeout "'+t+'"'),o(null))},n.timeout),t){case"sign-in":const e=s.auth_endpoints["sign-in"];setTimeout(()=>Pl(e),300),n.ora&&(n.ora.text=`Please authenticate in the browser: ${e}`),setTimeout(l,2e3);break;case"sign-out":Up(),Pl(s.auth_endpoints["sign-out"]),setTimeout(l,2e3)}let r=0;const c=10;function l(){e(s.auth_endpoints["is-authenticated"]).then(async e=>{if(200===e.status||400===e.status||403===e.status)switch(t){case"sign-in":if(200===e.status){const e=await tu();return e&&!await du(e)?o(null):(a=!0,n.ora&&e&&(n.ora.text="User is authenticated"),o(e))}if(403===e.status){n.ora&&n.ora.fail("Authentication failed");const t=await e.text();if(t.startsWith("{")){const e=JSON.parse(t);if("logged_in_machine_names"in e&&Array.isArray(e.logged_in_machine_names)){const t=e.logged_in_machine_names;E().fail(`You're already authenticated on ${t.length} other machine(s). Please logout from other machines first. You're currently logged in on: ${t.join(", ")}`)}}return o(null)}break;case"sign-out":if(400===e.status)return a=!0,Up(),n.ora&&(n.ora.text="User is signed-out"),o(!0)}else if(r++,r>c)return n.ora?n.ora.fail(`Failed to complete auth flow. Please try again. Make sure that port ${s.port} is not blocked`):n.silent||console.error(`Failed to complete auth flow. Please try again. Make sure that port ${s.port} is not blocked`),o(null);setTimeout(l,1e3)}).catch(e=>{r>=10&&console.debug("Error polling auth status: "+e.message)})}})}const rm=/token|secret|password|authorization|api[-_]?key|access[-_]?key|private[-_]?key|client[-_]?secret/i;function cm(e,t){return async function(n){const o=function(e,t){const n=[];if(e&&Object.keys(e).length>0&&n.push(`args=${lm(e)}`),t&&Object.keys(t).length>0){const e=Object.fromEntries(Object.entries(t).map(([e,t])=>rm.test(e)?[e,"<redacted>"]:[e,t]));n.push(`options=${lm(e)}`)}return n.join(" ")}(null==n?void 0:n.args,null==n?void 0:n.options);Zl(`CLI action: ${e}${o?" "+o:""}`);const i=Date.now();try{const o=await t(n);return Zl(`CLI action: ${e} succeeded in ${Date.now()-i}ms`),o}catch(t){const n=t instanceof Error?t.message:String(t);throw Yl(`CLI action: ${e} failed in ${Date.now()-i}ms: ${n}`),t}}}function lm(e){try{return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():"function"==typeof t?"<fn>":t)}catch{return"<unserializable>"}}globalThis.fetch||(globalThis.fetch=e),globalThis.File||(globalThis.File=t),globalThis.crypto||(globalThis.crypto=n.webcrypto),function(e={}){var t,n,o;const i=null!=(t=e.proc)?t:process,a=null!=(n=e.log)?n:Yl,s=null!=(o=e.error)?o:e=>console.error(e),r=(e,t)=>{const n=t instanceof Error&&t.message||String(t);try{const o=t instanceof Error&&t.stack?`\n${t.stack}`:"";a(`CLI crashed (${e}): ${n}${o}`)}catch{}try{s(`error: ${n}`)}catch{}try{i.exit(1)}catch{}};i.on("unhandledRejection",e=>r("unhandled rejection",e)),i.on("uncaughtException",e=>r("uncaught exception",e))}();const pm=process.argv.includes("--silent"),um=JSON.parse(p(new URL("../package.json",import.meta.url),"utf-8")),dm="The access token to use. Use the login command or get a token from https://cloud.needle.tools. You can pass the access token with your command or set the environment variable NEEDLE_CLOUD_TOKEN";async function mm(e,t=null,n=!0){let o,i=null==e?void 0:e.toString();var a;if(i||(_e.config(),process.env.NEEDLE_CLOUD_TOKEN&&(i=process.env.NEEDLE_CLOUD_TOKEN,null!=(a=i)&&a.length&&console.log("Using NEEDLE_CLOUD_TOKEN token from env"))),""===i||"true"===i){const e=(await import("node:readline")).createInterface({input:process.stdin}),t=10;let n,i="",a=!1;return new Promise(s=>{const r="Paste your https://cloud.needle.tools/team#token access token here:",c=E({text:r,interval:200,spinner:"moon"}).start();process.stdin.setRawMode(!0),process.stdin.on("data",l=>{const p=l.toString();""===p&&process.exit();const u="\n"===p||"\r"===p;if(!u&&"\n"!==p&&"\r"!==p){""===p||"\b"===p?i=i.slice(0,-1):i+=p;const e=i.replace(/./g,"*");c.text=`${r} ${e}`}clearTimeout(n),n=setTimeout(()=>{if(!a&&(u||i.trim().length>t)){process.stdin.setRawMode(!1),e.close(),a=!0;const t=i.trim();if(t.length>0){const e=t.slice(3,-3).replace(/./g,"*");c.succeed("Access token received: "+e)}else c.fail("No access token provided");s({accessToken:t,org_id:o})}},150)})})}if(!i){let e;await async function(){const e=await tu();return null==e?void 0:e.isAuthenticated}()||(e=pm?void 0:E("No access token found. Please sign in to authenticate...").start()),Zl("No access token provided, attempting login. Org: "+t);const a=im({headless:!n,ora:e,timeout:12e4}),d=await a;var s;if(d&&!await lu(d)?(null==(s=e)||s.fail("You are not logged in from this machine. Please login again."),await am({headless:!0}),process.exit(1)):e&&(Zl("User logged in via getAccessToken "+(null==d?void 0:d.isAuthenticated)),d?e.succeed("Logged in"):e.fail("Login failed")),null!=d&&d.isAuthenticated){var r;if(null==t){const e=await nu(d);"string"==typeof e&&(t=e)}else t===(null==(r=d.userInfo)?void 0:r.sub)&&(t=null);if(t){var c,l,p;if(o=null==(c=d.userInfo)||null==(c=c.organization_data)||null==(c=c.find(e=>e.id===t))?void 0:c.id,o||(t=null==(l=t.toString())?void 0:l.toLowerCase(),null!=o||(o=null==(p=d.userInfo)||null==(p=p.organization_data)||null==(p=p.find(e=>e.name.toLowerCase()===t))?void 0:p.id)),!o)throw new Error(`ERR: You (${Sd(d)}) are not a member of the team "${t}" or the team does not exist. Please check the team name/id and try again.`);i=await(null==d?void 0:d.client.getOrganizationToken(o)),Zl("Getting access token for org "+o+", "+i.substring(0,8)+"...")}else{var u;Zl("Getting access token for user "+(null==(u=d.userInfo)?void 0:u.sub)),i=null==d?void 0:d.accessToken}}}return i||(console.error("ERR: Missing NEEDLE_CLOUD_TOKEN token. Please provide the access token argument or set the environment variable NEEDLE_CLOUD_TOKEN. Get an access token for your team at https://cloud.needle.tools/team"),Zl("ERR: Missing NEEDLE_CLOUD_TOKEN token. Org: "+o),process.exit(403)),{accessToken:i,org_id:o}}function fm(e){return null!=e.org&&console.warn("Warning: --org is deprecated. Use --team instead."),e.team||e.org}const hm=Je.program;async function gm(){const{spawn:e}=await import("node:child_process");e(process.execPath,[process.argv[1],"start","--integration","cli-login"],{stdio:"inherit",env:{...process.env,NEEDLE_CLOUD_TOKEN:process.env.NEEDLE_CLOUD_TOKEN||""}}),await new Promise(e=>setTimeout(e,1e3))}hm.version(um.version).description("Command-line interface (CLI) for Needle Cloud"),hm.command("version","Print the CLI version").configure({visible:!1}).action(()=>{pm||console.log(`☁ Needle CLI — ${um.version}, Node ${process.version}`)}),hm.command("start","Starts the Needle Auth server").alias("start-server").configure({visible:!1,strictOptions:!1}).help("Start the local server for Needle Cloud. This is required to authenticate with Needle Cloud and access your account and data.").option("--restart <restart>","Restarts the server",{required:!1,validator:hm.BOOLEAN,default:!1}).option("--integration <integration>","Hint for the process which integration triggered this command",{required:!1,validator:hm.STRING}).action(async({options:e})=>{const t=e.integration,n=pm?void 0:E("Starting Needle License server "+(t?`(from ${t})`:"")).start();nm({ora:n,restart:e.restart}).catch(e=>{console.error("Failed to start server:",e),null==n||n.fail("Failed to start server: "+e.message),process.exit(1)}).then(e=>{null!=e&&e.baseUrl&&e.isHost?null==n||n.succeed(`Server started on ${e.baseUrl} (v${bu()}, built ${function(e){if("string"!=typeof Xd||0===Xd.length)return"unknown";const t=new Date(Xd);if(Number.isNaN(t.getTime()))return"unknown";const n=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}()})`):!1===(null==e?void 0:e.isHost)?(t||null==n||n.warn(`Server is running on ${e.baseUrl||e.port}`),process.exit(0)):(null==n||n.fail("Failed to start server"),process.exit(1))})}),hm.command("settings","Show current Needle CLI settings").action(async()=>{const{readSettings:e,KNOWN_SETTINGS:t}=await Promise.resolve().then(function(){return ad}),n=e();for(const[e,o]of Object.entries(t)){const t=n[e],i=void 0!==t?String(t):o.default;console.log(`\n ${"enabled"===i?"[x]":"[ ]"} ${o.displayName}: ${i}${void 0===t?" (default)":""}`),console.log(` ${o.description}`),console.log(` Change: ${o.command}`)}console.log("")}),hm.command("settings remote-ai-tools","Enable or disable cloud AI tool dispatch to this machine").help("When disabled, the CLI does NOT connect to the Needle Cloud AI tool dispatcher (wss://cloud.needle.tools/v1/cli/ws), so cloud-side AI chats cannot invoke tools (file reads, grep, etc.) on this machine. The local /mcp/ws endpoint used by Unity/Blender stays available. Setting persists in ~/.needle/settings.json.").argument("<enabled>","true to enable, false to disable",{validator:hm.BOOLEAN}).action(cm("settings remote-ai-tools",async({args:e})=>{const{writeSetting:t,defaultSettingsDir:n}=await Promise.resolve().then(function(){return ad}),o=e.enabled,i=n();o?(t(i,"remote_ai_tools",null),console.log("Remote AI tools enabled (default)."),Zl("Settings: remote_ai_tools set to enabled (default) via CLI command")):(t(i,"remote_ai_tools","disabled"),console.log("Remote AI tools disabled. The cloud AI chat will not be able to dispatch tools to this machine."),Zl("Settings: remote_ai_tools set to disabled via CLI command"))})),hm.command("mcp","Start MCP server for AI agents (stdio transport)").help('Start the Needle Cloud MCP server using stdio transport.\nThis is the standard way to connect AI agents (Claude Desktop, Cursor, VS Code, etc.).\n\nAdd to your MCP client config:\n{\n "mcpServers": {\n "needle": {\n "command": "npx",\n "args": ["-y", "needle-cloud", "mcp"]\n }\n }\n}').action(cm("mcp",async()=>{const{startStdio:e}=await Promise.resolve().then(function(){return Wd});e()})),hm.command("get-project-id","Gets the project id for a local project").configure({visible:!1,strictOptions:!1}).argument("<paths...>","The path to the local project (web project directory)").action(async({args:e})=>{const t=Dd(e.paths);t?console.log(`Found project ID: "${t}"`):console.log("No project ID found.")}),hm.command("send-logs","Upload CLI, editor, and optimization-pipeline logs to Needle (secrets and sensitive info redacted)").help("Stream the current and previous CLI log, the most recent editor log (Unity or Blender), and the optimization-pipeline log to Needle for support diagnosis. Before upload, tokens, Bearer/Authorization values, UUIDs, home-directory paths, email addresses, Username/User fields, and *_KEY / *_TOKEN / *_SECRET / *_PASSWORD env-var values are redacted (replaced with <redacted:Nch> so the length is preserved for debugging). Returns a reference ID to paste into your bug report. Requires sign-in; the upload is tagged with your Needle account.").option("--crash <crash>","Mark this upload as a crash report (uses the crash-mode daily quota)",{required:!1,validator:hm.BOOLEAN,default:!1}).option("--note <note>","One-line note attached to the upload",{required:!1}).option("--dry-run <dryRun>","Print the redacted payload without uploading",{required:!1,validator:hm.BOOLEAN,default:!1}).action(cm("send-logs",async({options:e})=>{var t,n,o,i,a,s,r;const{runSendLogs:c,HAYSTACK_RESOURCE:l}=await Promise.resolve().then(function(){return Ap}),{tryGetFreshAccessTokenForResource:p}=await Promise.resolve().then(function(){return au}),{findActiveEditorLog:u}=await import("./cli.send-logs.discovery-85daaa71.js"),{getLogFilePath:d,getPrevLogsFilePath:m,getPipelineLogFilePath:f}=await Promise.resolve().then(function(){return Xl}),{homedir:h,platform:g}=await import("os"),{existsSync:v}=await import("fs"),{BUILD_TIME:x}=await Promise.resolve().then(function(){return Qd}),{getNodeVersion:b,getNpmVersion:y,getArch:w,getOsRelease:_,getCpuCount:k,getTotalMemoryMb:S,getTzOffsetMinutes:j,isCi:T,isTty:$}=await import("./cli.runtime-465aa7a3.js"),O=null!=(t=null!=(n=null==(o=e.crash)||null==o.valueOf?void 0:o.valueOf())?n:e.crash)&&t?"crash":"normal",R=e.note,A=null!=(i=null!=(a=null==(s=e.dryRun)||null==s.valueOf?void 0:s.valueOf())?a:e.dryRun)&&i,C=d(),N=m(),I=f(),P={getAccessToken:()=>p(l),fetch:globalThis.fetch,paths:{cliLogPath:v(C)?C:null,prevLogPath:v(N)?N:null,pipelineLogPath:v(I)?I:null,homeDir:h()},meta:{cli_version:bu(),build_time:x,os:g(),os_release:_(),arch:w(),node_version:b(),npm_version:null!=(r=y())?r:"unknown",cpu_count:k(),total_memory_mb:S(),tz_offset_minutes:j(),is_ci:T(),is_tty:$()},findActiveEditorLog:u,stdout:process.stdout,stderr:process.stderr},U=A?"Building payload (dry-run)":"Uploading logs",L=pm?void 0:E(U).start();P.recoverAuth=async()=>{null==L||L.stop();try{await gm();const e=await im({clearAuthData:!0,silent:pm,ora:void 0});if(null==e||!e.isAuthenticated)return null}catch(e){return Zl(`send-logs: auto-recovery login failed: ${e instanceof Error?e.message:e}`),null}finally{null==L||L.start(U)}return await p(l)};const z=await c({mode:O,note:R,dryRun:A},P);z.ok?A?null==L||L.succeed("Dry-run payload printed above. Nothing was uploaded."):z.truncated?(null==L||L.warn(`Uploaded (truncated at server cap). Reference: ${z.refId}`),console.log(`Share ${z.refId} in your bug report.`)):(null==L||L.succeed(`Uploaded. Reference: ${z.refId}`),console.log(`Share ${z.refId} in your bug report.`)):(null==L||L.fail(z.error||"Upload failed"),process.exitCode=1)})),hm.command("login","Login to Needle Cloud").help("Login to Needle Cloud. If you are already logged in, this will refresh the access token.").option("--headless <headless>","The headless process will not open a browser window to login. If the user is not authorized then no auth flow can be started. Use this if you only want to **check** if the user is authenticated",{required:!1,validator:hm.BOOLEAN,default:!1}).option("--clear <clear>","Refresh the access token",{required:!1,validator:hm.BOOLEAN,default:!1}).action(async({options:e})=>{await gm();const t=e.headless.valueOf()||!1,n=e.clear.valueOf()||!1,o=pm?void 0:E("Login").start();await im({headless:t,silent:pm,clearAuthData:n,ora:o}).then(async e=>{null!=e&&e.isAuthenticated?null==o||o.succeed("Successfully logged in as "+Sd(e)):0==t?null!=e&&e.claims||null!=e&&e.userInfo?null==o||o.warn(`You (${Sd(e)}) are not authenticated...`):null==o||o.fail("Login failed"):pm||null==o||o.warn("Not logged in"),process.exit(null!=e&&e.isAuthenticated?0:1)})}),hm.command("logout","Logout of Needle Cloud").help("Logout of Needle Cloud (if you have logged in before).").option("--headless <headless>","Headless will not open a browser window to logout",{required:!1,validator:hm.BOOLEAN,default:!1}).action(async({options:e})=>{await gm();const t=e.headless.valueOf()||!1;await am({headless:t}).then(e=>{e?E("Logged out").succeed():E("Logout failed").fail(),process.exit(e?0:1)})}),hm.command("me","Prints your user information").help("Prints basic informaton about the logged in Needle Cloud account (your account)").action(async({})=>{const e=pm?void 0:E("Query user data").start(),t=await tu();if(null!=t&&t.isAuthenticated&&await lu(t)){const a=t.userInfo||t.claims;var n,o,i;a?(null==e||e.succeed(`You are logged in as ${Sd(t)}`),console.log(`- Name: ${Sd(t)}`),console.log(`- ID: ${a.sub}`),a.email&&console.log(`- Email: ${a.email}`),a.phone_number&&console.log(`- Phone: ${a.phone_number}`),null!=(n=t.userInfo)&&n.organization_data&&console.log(`- Teams [${null==(o=t.userInfo)?void 0:o.organization_data.length}]: ${null==(i=t.userInfo)?void 0:i.organization_data.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>e.name).join(", ")}`)):null==e||e.fail("Failed to get user data")}else null==e||e.warn("You are not logged in")}),hm.command("get-pro","Start license flow for Needle Engine PRO").configure({visible:!1,strictArgsCount:!1,strictOptions:!1}).option("--team <team>","The team to purchase the license for",{validator:hm.STRING}).option("--org <org>","Legacy alias for --team",{validator:hm.STRING,hidden:!0}).action(cm("get-pro",async({options:e})=>{var t;let n=(null==(t=fm(e))?void 0:t.toString())||null;const o=E().start("Start Needle Engine PRO purchase flow"),i=function(e){e=e||{};const t="undefined"!=typeof window?window.location:null;"current_page"===e.baseUrl&&(e.baseUrl=null==t?void 0:t.href);let n=e.pathname||(null==t?void 0:t.pathname),o=e.baseUrl||(null==t?void 0:t.href);if(!n||!o)return null;const i=new URL(n,o);return t&&(i.search=t.search),e.license||(e.license="needle-engine:pro"),i.searchParams.set("purchase_intent",e.license),e.account_id&&i.searchParams.set("account_id",e.account_id),e.return_url&&i.searchParams.set("return_url",e.return_url),e.checkout_if_possible&&i.searchParams.set("checkout_if_possible","true"),e.show_all_cards&&i.searchParams.set("show_all_cards","true"),e.affiliate_id&&i.searchParams.set("affiliate_id",e.affiliate_id),e.tracking_id&&i.searchParams.set("tracking_id",e.tracking_id),i}({baseUrl:"https://cloud.needle.tools",pathname:n?`/team/${n}`:"/account",account_id:n,license:"needle-engine:pro",return_url:null});if(!i)return void o.fail("Failed to get purchase url - please visit https://cloud.needle.tools");const a=i.toString();o.succeed(`Started Needle Engine PRO purchase flow: opening browser at ${a}`),Pl(a)}));const vm={account:{url:Nl}},xm=`"${Object.keys(vm).join('", "')}"`;hm.command("open",`Open a page in the default browser. Options are: ${xm}`).argument("<page>",`The page to open. Options are: ${xm}`,{validator:hm.STRING}).configure({strictOptions:!1,strictArgsCount:!1,visible:!1}).help("").action(async({args:e,logger:t})=>{const n=e.page.toString(),o=vm[n];o?"url"in o?Pl(o.url()):t.error(`Unknown argument: ${n}`):t.error(`Unknown argument: ${n}. Options are: ${xm}`)}),hm.command("list-deployments","Get a list of deployed websites").configure({visible:!1}).help("").option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id to authenticate for",{required:!1,validator:hm.STRING}).option("--org <org>","Legacy alias for --team",{required:!1,validator:hm.STRING,hidden:!0}).option("--endpoint <endpoint>","The needle cloud endpoint to use - e.g. https://cloud.needle.tools/api",{required:!1,validator:hm.STRING}).option("--limit <limit>","Limit the number of deployments to show (min: 0, max: 100)",{validator:hm.NUMBER,default:10}).option("--offset <offset>","The offset for deployments (default: 0, min: 0)",{validator:hm.NUMBER,default:0}).option("--format <format>","The output format. Options: cli (default), json",{validator:hm.STRING,default:"cli",hidden:!0}).option("--name","Filter by one or multiple deployment names (separated by ;)",{validator:hm.STRING}).action(async({options:e,logger:t})=>{var n,o,i;const{accessToken:a,org_id:s}=await mm(e.token,fm(e)),r=(null==(n=e.endpoint)?void 0:n.toString())||"https://cloud.needle.tools/api",c=e.limit.valueOf(),l=e.offset.valueOf(),p=(null==(o=e.format)?void 0:o.toString())||"cli",u=(null==(i=e.name)?void 0:i.toString())||void 0;if(c<0)return void t.error("The limit can not be negative");if(c>100)return void t.error("The limit can not be higher than 100");const d=E("Query deployments").start(),m=await sp({endpoint:r,authToken:a,org:s,limit:c,offset:l,names:null==u?void 0:u.split(";")}).catch(e=>{t.error(e)});if(m&&"error"in m)d.fail(m.error+" (status: "+m.status+")");else if(m){if("json"===p){d.succeed(`Found ${m.deployments.length} deployments`);const e=JSON.stringify(m.deployments);return void console.log(e)}m.deployments.length>0?(d.succeed(`Found ${m.deployments.length} deployments`),m.deployments.forEach((e,n)=>{t.info(`${n+c*l}: ${e.name} – ${e.url}`)})):d.warn("No deployments found"),process.exit(0)}else d.fail("Failed to query deployments"),process.exit(1)}),hm.command("list","List content items (3d assets, deployments, materials, etc.)").alias("list-content").help('List content items stored in Needle Cloud.\n\nUse --type to filter by content type (e.g. "material", "3d-asset", "deployment").\nUse --format to filter by output format (e.g. "glb", "textures").').option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id to authenticate for",{required:!1,validator:hm.STRING}).option("--org <org>","Legacy alias for --team",{required:!1,validator:hm.STRING,hidden:!0}).option("--endpoint <endpoint>","The needle cloud endpoint to use - e.g. https://cloud.needle.tools/api",{required:!1,validator:hm.STRING}).option("--type <type>","Filter by content type (e.g. material, 3d-asset, deployment)",{required:!1,validator:hm.STRING}).option("--format <format>","Filter by output format (e.g. glb, textures)",{required:!1,validator:hm.STRING}).option("--search <search>","Search by name, title or description",{required:!1,validator:hm.STRING}).option("--limit <limit>","Max number of items to show (default: 20, max: 100)",{validator:hm.NUMBER,default:20}).option("--offset <offset>","Offset for pagination (default: 0)",{validator:hm.NUMBER,default:0}).option("--output <output>","Output style: cli (default), json",{validator:hm.STRING,default:"cli"}).action(async({options:e,logger:t})=>{var n,o,i,a,s,r,c,l,p;const{accessToken:u,org_id:d}=await mm(e.token,fm(e)),m=(null==(n=e.endpoint)?void 0:n.toString())||"https://cloud.needle.tools/api",f=Math.min(null!=(o=null==(i=e.limit)?void 0:i.valueOf())?o:20,100),h=null!=(a=null==(s=e.offset)?void 0:s.valueOf())?a:0,g=(null==(r=e.output)?void 0:r.toString())||"cli",v=(null==(c=e.type)?void 0:c.toString())||void 0,x=(null==(l=e.format)?void 0:l.toString())||void 0,b=(null==(p=e.search)?void 0:p.toString())||void 0,y=E("Querying content...").start();try{const e=await xl({baseUrl:m,authToken:u,org:d},{content_type:v,content_format:x,search:b,limit:f,offset:h});if("json"===g)return y.succeed(`Found ${e.items.length} of ${e.total} items`),void console.log(JSON.stringify(e.items,null,2));0===e.items.length&&(y.warn("No content found"+(v?` (type: ${v})`:"")+(x?` (format: ${x})`:"")),process.exit(0)),y.succeed(`Found ${e.items.length} of ${e.total} items`);const n=e.items.map(e=>{var t;const n=e.title||"(untitled)";return{id:e.identifier,type:e.content_type||"?",formats:null!=(t=e.content_formats)&&t.length?e.content_formats.join(", "):"",name:n.length>20?n.slice(0,17)+"...":n,versions:String(e.version_count||0),date:e.created_at?Mc(new Date(e.created_at),new Date,{allowSimple:!0,limitInDays:2}):""}}),o={id:Math.max(2,...n.map(e=>e.id.length)),type:Math.max(4,...n.map(e=>e.type.length)),formats:Math.max(7,...n.map(e=>e.formats.length)),name:Math.max(4,...n.map(e=>e.name.length))},i=lp(` ${"ID".padEnd(o.id)} ${"TYPE".padEnd(o.type)} ${"FORMATS".padEnd(o.formats)} ${"NAME".padEnd(o.name)} ${"#".padStart(3)} AGE`);t.info(i);for(const e of n){const n=cp(e.type).padEnd(o.type+11),i=(e.formats?e.formats.split(", "):[]).map(e=>cp(e)).join(", ")+" ".repeat(Math.max(0,o.formats-e.formats.length));t.info(` ${lp(e.id.padEnd(o.id))} ${n} ${i} ${e.name.padEnd(o.name)} ${e.versions.padStart(3)} ${lp(e.date)}`)}e.total>h+f&&t.info(` ... ${e.total-h-f} more (use --offset ${h+f})`),process.exit(0)}catch(e){y.fail(e.message),process.exit(1)}}),hm.command("delete","Move a content item to the trash").help("Move a content item to the trash. This immediately frees total storage capacity but does not refund monthly usage. The item can be restored for 31 days if enough total storage is available.\n\nUsage:\n needle-cloud delete <identifier>").argument("<identifier>","Content item identifier",{validator:hm.STRING}).option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id to authenticate for",{required:!1,validator:hm.STRING}).option("--org <org>","Legacy alias for --team",{required:!1,validator:hm.STRING,hidden:!0}).option("--endpoint <endpoint>","The Needle Cloud endpoint to use - e.g. https://cloud.needle.tools/api",{required:!1,validator:hm.STRING}).action(async({args:e,options:t})=>{var n;const{accessToken:o,org_id:i}=await mm(t.token,fm(t)),a=(null==(n=t.endpoint)?void 0:n.toString())||"https://cloud.needle.tools/api",s=e.identifier.toString(),r=E(`Deleting content "${s}"...`).start();try{const e=await ap({identifier:s,endpoint:a,authToken:o,org:i});r.succeed(e.message||`Moved content "${s}" to the trash`),process.exit(0)}catch(e){r.fail(e.message),process.exit(1)}}),hm.command("download","Download a content item by identifier").help('Download files from a content item.\n\nUse --format to select which output format to download (e.g. "glb", "textures").\n\nUsage:\n needle-cloud download <identifier> [directory]\n needle-cloud download abc123 --format glb').argument("<identifier>","Content item identifier",{validator:hm.STRING}).argument("[directory]","Output directory (default: current directory)",{default:"."}).option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id to authenticate for",{required:!1,validator:hm.STRING}).option("--org <org>","Legacy alias for --team",{required:!1,validator:hm.STRING,hidden:!0}).option("--endpoint <endpoint>","The needle cloud endpoint to use - e.g. https://cloud.needle.tools/api",{required:!1,validator:hm.STRING}).option("--format <format>","Output format to download (e.g. glb, textures)",{required:!1,validator:hm.STRING}).option("--name <name>","Output filename (without extension)",{required:!1,validator:hm.STRING}).option("--verbose","Show detailed download info",{required:!1,validator:hm.BOOLEAN,default:!1}).action(async({args:e,options:t,logger:n})=>{var o,i,a,s,r,c;const{accessToken:l,org_id:p}=await mm(t.token,fm(t)),u=(null==(o=t.endpoint)?void 0:o.toString())||"https://cloud.needle.tools/api",d=e.identifier.toString(),m=(null==(i=e.directory)?void 0:i.toString())||".",f=(null==(a=t.name)?void 0:a.toString())||void 0,h=null!=(s=null==(r=t.verbose)?void 0:r.valueOf())&&s,g=(null==(c=t.format)?void 0:c.toString())||void 0,v=E("Looking up content...").start();try{var x;const e={baseUrl:u,authToken:l,org:p},t=await bl(e,d).catch(()=>null);if(!t)return void v.fail(`Content not found: "${d}". Use the exact content identifier (see list-content).`);const o=null==(x=t.versions)?void 0:x[0];if(!o)return void v.fail(`Content "${t.title||t.name}" has no versions`);let i=o.identifier;if(g){let e=!1;for(const n of t.versions){if(n.content_format===g){i=n.identifier,e=!0;break}const t=n.variants.find(e=>e.content_format===g);if(t){i=t.identifier,e=!0;break}}if(!e)return void v.fail(`No output with format "${g}" found for "${t.title||t.name}"`)}v.text=`Downloading "${t.title||t.name}"${g?` (format: ${g})`:""}...`,v.stop();const a=await op({baseUrl:u,authToken:l,org:p,identifier:i,outDir:m,filename:f,verbose:h,content_format:g});"error"in a&&n.error(a.error)}catch(e){v.fail(e.message)}}),hm.command("deploy","Deploy a website to Needle").help("").argument("<directory>","The directory to deploy",{validator:hm.STRING}).option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id to deploy to (not needed when using token/accesstoken)",{required:!1,validator:hm.STRING}).option("--org <org>","The organization name or id to deloy to (not needed when using token/accesstoken)",{required:!1,validator:hm.STRING,hidden:!0}).option("--name <name>","The project name. This name will also be used in your website URL",{required:!1,validator:hm.STRING}).option("--entrypoint <entrypoint>",'The entrypoint file to use (e.g. "index.html"). This is useful if you want to deploy a folder with multiple HTML files and you want to configure which file to load initially or if you have multiple model files in one folder',{required:!1,validator:hm.STRING,hidden:!0}).option("--endpoint <endpoint>","The needle cloud endpoint to use - e.g. https://cloud.needle.tools/api",{required:!1,validator:hm.STRING,hidden:!0}).option("--open","Open the deployment in the default browser",{default:!0,validator:hm.BOOLEAN}).option("--verbose <verbose>","Enables verbose output logs",{required:!1,validator:hm.BOOLEAN,default:!1,hidden:!0}).option("--experimental","Use the experimental upload API. Mostly used for debugging (default: false)",{required:!1,validator:hm.BOOLEAN,default:!1,hidden:!0}).option("--raw","Use raw to disallow modifications like gzip compression on upload",{required:!1,validator:hm.BOOLEAN,default:!1,hidden:!0}).option("--no-provenance","Do not record which commit and CI run this deployment came from",{required:!1,validator:hm.BOOLEAN,default:!1}).action(cm("deploy",async({args:e,options:t,logger:n})=>{var o,i,a,s;const r=t.open,{accessToken:c,org_id:l}=await mm(t.token,fm(t)),p=t.verbose.valueOf(),u=t.experimental.valueOf()||!1,d=t.raw.valueOf()||!1,m=(null==(o=t.noProvenance)?void 0:o.valueOf())||!1;await ep({logger:n,endpoint:(null==(i=t.endpoint)?void 0:i.toString())||void 0,token:c,org_id:l,directory:e.directory.toString(),name:(null==(a=t.name)?void 0:a.toString())||void 0,entrypoint:(null==(s=t.entrypoint)?void 0:s.toString())||void 0,open:r,verbose:p||!1,experimental:u||!1,raw:d||!1,noProvenance:m})})),hm.command("upload","Upload files or a folder to Needle Cloud").help("Uploads your files and returns the link to manage them on Needle Cloud. Processing jobs (asset optimization and related derived formats) are scheduled automatically in the background — this command does not wait for them; use `optimize` to upload and wait for the optimized result. Use --no-optimize to store the files exactly as uploaded, with no jobs scheduled.").option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id to upload the file to",{required:!1,validator:hm.STRING}).option("--org <org>","The organization name or id to upload the file to",{required:!1,validator:hm.STRING,hidden:!0}).argument("<path>","The full path to a file or directory that should be uploaded",{validator:hm.STRING}).option("--name <name>","The upload project name / unique identifier. This can also be the view id of previous uploads.",{required:!1,validator:hm.STRING}).option("--no-optimize","Do not schedule any processing jobs — store the files exactly as uploaded",{required:!1,validator:hm.BOOLEAN,default:!1}).option("--verbose <verbose>","Enables verbose output logs",{required:!1,validator:hm.BOOLEAN,default:!1}).action(cm("upload",async({args:e,options:t})=>{var n,o,i;const a=(null==(n=t.verbose)?void 0:n.valueOf())||!1,{accessToken:s,org_id:r}=await mm(t.token,fm(t));if(s!=t.token){const e=await tu();null!=e&&e.isAuthenticated?r||(E("Please provide an organization id to upload files...").fail(),process.exit(1)):(E("Please login to upload files...").fail(),process.exit(1))}const c=await async function(e){const t=await np({token:e.token,org_id:e.org_id,fileOrDirectory:e.fileOrDirectory,name:e.name,verbose:e.verbose},{optimizations:!e.noOptimize&&void 0});return"error"in t?t:(e.noOptimize&&E().info("No processing jobs were scheduled (--no-optimize)."),{success:!0,editUrl:t.editUrl})}({token:s,org_id:r,fileOrDirectory:e.path.toString(),name:(null==(o=t.name)?void 0:o.toString())||void 0,noOptimize:(null==(i=t.noOptimize)?void 0:i.valueOf())||!1,verbose:a}).catch(e=>{console.error(e),process.exit(1)});"error"in c&&(c.noprint||console.error(c.error),process.exit(1))})),hm.command("optimize","Optimize glTF, GLB, VRM, FBX, USD files").help("").option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id to upload the file to",{required:!1,validator:hm.STRING}).option("--org <org>","The organization name or id to upload the file to",{required:!1,validator:hm.STRING,hidden:!0}).argument("<path>","The full path to a file or directory that should be optimized",{validator:hm.STRING}).option("--outdir <outdir>","The output directory for the optimized file(s). If set your optimized asset files will automatically be downloaded to this directory.",{required:!1,validator:hm.STRING}).option("--name <name>","The optimization project name / unique identifier. This can also be the view id of previous uploads.",{required:!1,validator:hm.STRING}).option("--verbose <verbose>","Enables verbose output logs",{required:!1,validator:hm.BOOLEAN,default:!1}).option("--progressive","Use Needle progressive loading",{required:!1,validator:hm.BOOLEAN,default:!0}).option("--usecase <usecase>",'The use case for the optimization. This can be "product" (default) or "world".',{required:!1,validator:hm.STRING,default:"product"}).action(cm("optimize",async({args:e,options:t,logger:n})=>{var o,i,a,s;const r=t.verbose.valueOf(),{accessToken:p,org_id:u}=await mm(t.token,fm(t));if(p!=t.token){const e=await tu();null!=e&&e.isAuthenticated?u||(E("Please provide an organization id to optimize files...").fail(),process.exit(1)):(E("Please login to optimize files...").fail(),process.exit(1));const t=await async function(e,t){const n=e.baseUrl+Ve.account.get_licenses,o={...{...t},...Ke(e)},i=await fetch(n,{...Ye,method:"GET",headers:o}).catch(e=>(console.error(e),null));return i?i.ok?(await i.json()).licenses:(console.error(i.statusText,await i.text()),[]):[]}({baseUrl:"https://cloud.needle.tools/api",authToken:p,org:u},{type:"org",org_id:u});(!t||t.length<=0||!t.find(e=>"Needle Engine"===e.type&&("pro"===e.license||"enterprise"===e.license)))&&(E("Update to Needle PRO or Enterprise required to optimize files via CLI. Visit https://cloud.needle.tools/get-pro").fail(),process.exit(1))}const d=(null==(o=t.progressive)?void 0:o.valueOf())||!0,m=(null==(i=t.usecase)?void 0:i.toString())||"product",f=await async function(e){if(e.outDir){var t;if((null==(t=e.outDir)?void 0:t.length)<=0){const e="Output Directory is invalid";return E().fail(e),{error:e}}if(c(e.outDir)&&l(e.outDir).isFile()){const e="The output directory is a file - it must be a directory";return E().fail(e),{error:e}}}const n=await np({token:e.token,org_id:e.org_id,fileOrDirectory:e.fileOrDirectory,name:e.name,verbose:e.verbose},{purposeLabel:"for optimization"});if("error"in n)return n;{const t=n.res,i="https://cloud.needle.tools/api",a=await async function(e,t={progressive:!0}){const n=e.baseUrl+Ve.jobs.create,o={...Ke(e),"content-type":"application/json"},i={type:"optimization",job_id:e.id,triggered_by:e.trigger_type,parameters:{...t}},a=await fetch(n,{...Ye,method:"POST",headers:o,body:JSON.stringify(i)});if(!a.ok){const e=await a.text();return console.error(`Failed to request optimization (${a.status}): ${e} `),null}return await a.json().catch(e=>(console.error(e),null))}({baseUrl:i,authToken:e.token,org:e.org_id,id:t.id,trigger_type:"cli"},function(e){return e.progressive?{progressive:!0,usecase:e.usecase||"product"}:{progressive:!1}}(e));if(!a)return{error:"Failed to send optimization request"};if("error"in a){const e=`Failed to optimize: ${a.error}`;return console.error(e),{error:e}}{const t=a.job,n=E(`Optimization requested for ${t.name||t.identifier}`).start();let s=!1;n.color="gray";const r=ec();for(;;){if("completed"===a.job.status){var o;s=!0,n.succeed(`${null!=(o=a.message)?o:"Optimization completed"}`);break}let c=2e3;const l=await Qr(t.identifier,{baseUrl:i,authToken:e.token,org:a.job.org}),p=r.record(l);if(p)return n.fail(p.reason),{error:p.reason};if("new"!==(null==l?void 0:l.status)&&"pending"!==(null==l?void 0:l.status)||(n.text="Your asset is queued - waiting for optimization to start",n.color="yellow",c=2e3),"running"===(null==l?void 0:l.status))n.text=`Your asset is being optimized: ${l.progress?`${l.progress}%`:""} ${l.status_message?`— ${l.status_message}`:""}`,n.color="cyan",c=1e3;else if("stalled"===(null==l?void 0:l.status))c=2500;else{if("completed"===(null==l?void 0:l.status)){s=!0,n.succeed(`Your asset has finished optimizing: ${l.status_message}`);break}if("canceled"===(null==l?void 0:l.status))return n.fail(`Optimization cancelled: ${l.error}`),{error:l.error||"Optimization cancelled"};if("failed"===(null==l?void 0:l.status))return n.fail(`Optimization failed: ${l.error}`),console.error(`Optimization failed: ${l.error}`),{error:l.error||"Optimization failed"}}await Bc(c)}if(s){if(e.outDir){const n=await op({baseUrl:i,authToken:e.token,org:e.org_id,identifier:t.identifier,outDir:e.outDir,verbose:e.verbose});if("error"in n)return{error:n.error}}else E().succeed(`Asset successfully optimized: https://cloud.needle.tools/edit/${t.content_id} (To download optimized files, use the --outdir option)`);return{success:!0}}}}return{error:"Unknown error"}}({logger:n,token:p,org_id:u,fileOrDirectory:e.path.toString(),name:(null==(a=t.name)?void 0:a.toString())||void 0,progressive:d,usecase:m,outDir:(null==(s=t.outdir)?void 0:s.toString())||void 0,verbose:r||!1}).catch(e=>{console.error(e),process.exit(1)});Array.isArray(f)?process.exit(0):"error"in f&&(f.noprint||console.error(f.error),process.exit(1))})),hm.command("generate-material","Generate a PBR material from a text prompt").help("").argument("<prompt>","The text prompt describing the material to generate",{validator:hm.STRING}).option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id",{required:!1,validator:hm.STRING}).option("--org <org>","The organization name or id",{required:!1,validator:hm.STRING,hidden:!0}).option("--resolution <resolution>","The material texture resolution (256, 512, 1k, 2k, 4k)",{default:"512",required:!1,validator:hm.STRING}).option("--name <name>","Output filename",{required:!1,validator:hm.STRING}).option("--outdir <outdir>","Output directory to download the generated file(s) to. If not set, the job ID is printed instead.",{required:!1,validator:hm.STRING}).action(cm("generate-material",async({args:e,options:t,logger:n})=>{var o,i,a;const{accessToken:s,org_id:r}=await mm(t.token,fm(t)),c=e.prompt.toString(),l=null==(o=t.resolution)?void 0:o.toString(),p=null==(i=t.outdir)?void 0:i.toString(),u=null==(a=t.name)?void 0:a.toString(),d=await async function(e){if(!e.token||e.token.length<=1||"string"!=typeof e.token||"true"===e.token)return{error:`Missing access token. Create a token at ${Nl()}`};if(!e.prompt||e.prompt.length<=0)return{error:"A prompt is required"};const t="https://cloud.needle.tools/api";Zl(`[generate-material] Starting request to ${t}, prompt="${e.prompt}", resolution=${e.resolution||512}`,{emptyLineBefore:!0});const n=E("Requesting material generation...").start(),o=await Promise.race([vl({baseUrl:t,authToken:e.token,org:e.org_id,trigger_type:"cli"},{prompt:e.prompt,resolution:e.resolution||512}).catch(e=>({error:e.message||"Request failed"})),new Promise(e=>setTimeout(()=>e({error:"Request timed out after 30s. Please try again."}),3e4))]);if("error"in o)return Zl(`[generate-material] Request failed: ${o.error}`),n.fail(o.error),{error:o.error};const i=o.job;if(Zl(`[generate-material] Job created: ${i.identifier}, status=${i.status}`),"canceled"===i.status)return Zl(`[generate-material] Job canceled: ${i.status_message||"quota exceeded"}`),n.fail(i.status_message||"Material generation was canceled (quota exceeded)"),{error:i.status_message||"Quota exceeded"};n.succeed(`Material generation requested: ${i.identifier}`);const a=E("Waiting for material generation...").start();a.color="gray";const s=ec();for(;;){if("completed"===i.status){a.succeed("Material generation completed");break}let n=2e3;const o=await Qr(i.identifier,{baseUrl:t,authToken:e.token,org:i.org}),r=s.record(o);if(r)return a.fail(r.reason),{error:r.reason};if("new"===(null==o?void 0:o.status)||"pending"===(null==o?void 0:o.status))a.text="Your material is queued - waiting for generation to start",a.color="yellow",n=2e3;else if("running"===(null==o?void 0:o.status))a.text=`Generating material: ${o.progress?`${o.progress}%`:""} ${o.status_message?`— ${o.status_message}`:""}`,a.color="cyan",n=1e3;else{if("completed"===(null==o?void 0:o.status)){Zl(`[generate-material] Job completed: ${i.identifier}`),a.succeed(`Material generation completed: ${o.status_message||""}`);break}if("canceled"===(null==o?void 0:o.status))return Zl(`[generate-material] Job canceled: ${i.identifier}, error=${o.error}`),a.fail(`Material generation canceled: ${o.error||""}`),{error:o.error||"Material generation canceled"};if("failed"===(null==o?void 0:o.status))return Zl(`[generate-material] Job failed: ${i.identifier}, error=${o.error}`),a.fail(`Material generation failed: ${o.error||""}`),{error:o.error||"Material generation failed"}}await Bc(n)}if(e.outDir){const n=await op({baseUrl:t,authToken:e.token,org:e.org_id,identifier:i.identifier,outDir:e.outDir,filename:e.outputName});if("error"in n)return{error:n.error}}return{success:!0,identifier:i.identifier}}({logger:n,token:s,org_id:r,prompt:c,resolution:l,outputName:u,outDir:p});"error"in d&&(d.error&&n.error(d.error),process.exit(1)),!p&&d.identifier&&console.log(d.identifier),process.exit(0)})),hm.command("generate-3d","Generate a 3D model from a text prompt").help("").argument("<prompt>",'A description of the object to generate, e.g. "a weathered wooden crate with iron bands"',{validator:hm.STRING}).option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id",{required:!1,validator:hm.STRING}).option("--org <org>","The organization name or id",{required:!1,validator:hm.STRING,hidden:!0}).option("--quality <quality>","Quality tier: standard (default, includes physically based material maps) or draft (faster and cheaper, base color only)",{default:"standard",required:!1,validator:hm.STRING}).option("--face-count <faceCount>","Target polygon count (40000-1500000). Leave unset to let the generator choose.",{required:!1,validator:hm.NUMBER}).option("--name <name>","Output filename",{required:!1,validator:hm.STRING}).option("--outdir <outdir>","Output directory to download the generated file(s) to. If not set, the job ID is printed instead.",{required:!1,validator:hm.STRING}).action(cm("generate-3d",async({args:e,options:t,logger:n})=>{var o,i,a;const{accessToken:s,org_id:r}=await mm(t.token,fm(t)),c=e.prompt.toString(),l=null==(o=t.quality)?void 0:o.toString(),p=null!=t.faceCount?Number(t.faceCount):void 0,u=null==(i=t.outdir)?void 0:i.toString(),d=null==(a=t.name)?void 0:a.toString(),m=await async function(e){if(!e.token||e.token.length<=1||"string"!=typeof e.token||"true"===e.token)return{error:`Missing access token. Create a token at ${Nl()}`};if(!e.prompt||e.prompt.length<=0)return{error:"A prompt is required"};const t="https://cloud.needle.tools/api";Zl(`[generate-3d] Starting request to ${t}, prompt="${e.prompt}", quality=${e.quality||"draft"}`,{emptyLineBefore:!0});const n=E("Requesting 3D generation...").start(),o=await async function(e,t){var n;if(null!=(n=e.signal)&&n.aborted)return{error:"The 3D generation request was cancelled"};const o=e.baseUrl+Ve.jobs.create,i={...Ke(e),"content-type":"application/json"},a={type:"ai-3d-asset",triggered_by:e.trigger_type,parameters:{...t}},s=await fetch(o,{...Ye,method:"POST",headers:i,body:JSON.stringify(a),signal:e.signal}).catch(e=>function(e){return"AbortError"===(null==e?void 0:e.name)||"TimeoutError"===(null==e?void 0:e.name)}(e)?{__aborted:!0}:(console.error(`Failed to request 3D asset generation: ${null==e?void 0:e.message}`),{__failed:(null==e?void 0:e.message)||"Request failed"}));if("__aborted"in s)return{error:"The 3D generation request was cancelled"};if("__failed"in s)return{error:s.__failed};if(!s.ok){const e=await s.text();return console.error(`Failed to request 3D asset generation (${s.status}): ${e}`),{error:e||`Request failed (${s.status})`}}const r=await s.json().catch(e=>(console.error(e),null));return null!=r&&r.job?r:{error:"The server did not return a job"}}({baseUrl:t,authToken:e.token,org:e.org_id,trigger_type:"cli",signal:AbortSignal.timeout(3e4)},{prompt:e.prompt,...e.quality?{quality:e.quality}:{},...e.face_count?{face_count:e.face_count}:{}});if("error"in o)return Zl(`[generate-3d] Request failed: ${o.error}`),n.fail(o.error),{error:o.error};const i=o.job;if(Zl(`[generate-3d] Job created: ${i.identifier}, status=${i.status}`),"canceled"===i.status)return Zl(`[generate-3d] Job canceled: ${i.status_message||"quota exceeded"}`),n.fail(i.status_message||"3D generation was canceled (quota exceeded)"),{error:i.status_message||"Quota exceeded"};n.succeed(`3D generation requested: ${i.identifier}`);const a=E("Waiting for the 3D model...").start();a.color="gray";const s=ec();for(;;){if("completed"===i.status){a.succeed("3D generation completed");break}let n=2e3;const o=await Qr(i.identifier,{baseUrl:t,authToken:e.token,org:i.org}),r=s.record(o);if(r)return a.fail(r.reason),{error:r.reason};if("new"===(null==o?void 0:o.status)||"pending"===(null==o?void 0:o.status))a.text="Your model is queued - waiting for generation to start",a.color="yellow",n=2e3;else if("running"===(null==o?void 0:o.status))a.text=`Generating 3D model: ${o.progress?`${o.progress}%`:""} ${o.status_message?`— ${o.status_message}`:""}`,a.color="cyan",n=1e3;else{if("completed"===(null==o?void 0:o.status)){Zl(`[generate-3d] Job completed: ${i.identifier}`),a.succeed(`3D generation completed: ${o.status_message||""}`);break}if("canceled"===(null==o?void 0:o.status))return Zl(`[generate-3d] Job canceled: ${i.identifier}, error=${o.error}`),a.fail(`3D generation canceled: ${o.error||""}`),{error:o.error||"3D generation canceled"};if("failed"===(null==o?void 0:o.status))return Zl(`[generate-3d] Job failed: ${i.identifier}, error=${o.error}`),a.fail(`3D generation failed: ${o.error||""}`),{error:o.error||"3D generation failed"}}await Bc(n)}if(e.outDir){const n=await op({baseUrl:t,authToken:e.token,org:e.org_id,identifier:i.identifier,outDir:e.outDir,filename:e.outputName});if("error"in n)return{error:n.error}}return{success:!0,identifier:i.identifier}}({logger:n,token:s,org_id:r,prompt:c,quality:l,face_count:p,outputName:d,outDir:u});"error"in m&&(m.error&&n.error(m.error),process.exit(1)),!u&&m.identifier&&console.log(m.identifier),process.exit(0)})),hm.command("ask","Send a message to the Needle Cloud AI").help("Send a message to the Needle Cloud AI chat.\n\nWithout a message argument, starts an interactive session.\nBy default streams the response to the terminal. Use --no-stream for a single JSON response.\nUse --slug to continue an existing chat conversation.\nDefault slug is <your-user-id>-cli (persistent across sessions).").argument("[message...]","The message to send (omit for interactive mode)").option("--token <token>",dm,{validator:hm.STRING}).option("--team <team>","The team name or id to authenticate for",{required:!1,validator:hm.STRING}).option("--org <org>","Legacy alias for --team",{required:!1,validator:hm.STRING,hidden:!0}).option("--slug <slug>","Chat slug to continue an existing conversation",{required:!1,validator:hm.STRING}).option("--no-stream","Disable streaming (returns full response at once)",{required:!1,validator:hm.BOOLEAN,default:!1}).action(cm("ask",async({args:e,options:t})=>{var n,o;const{accessToken:i,org_id:a}=await mm(t.token,fm(t)),s=Array.isArray(e.message)?e.message:e.message?[e.message]:[],r=s.length?s.join(" "):void 0,c=(null==(n=t.slug)?void 0:n.toString())||void 0,l=(null==(o=t.noStream)?void 0:o.valueOf())||!1;await async function(e){const{token:t,org_id:n,message:o,slug:i,stream:a}=e,s=i||function(e){try{const t=e.split(".")[1],n=JSON.parse(Buffer.from(t,"base64url").toString());if(n.sub)return n.sub+"-cli"}catch{}return"cli-"+Math.random().toString(36).slice(2,10)}(t);await async function(e){const{token:t,org_id:n,slug:o,stream:i,initialMessage:a}=e,s=we({input:process.stdin,output:process.stdout});console.log(`Needle Cloud AI (chat: ${o})`),console.log('Type your message. Press Ctrl+C or type "exit" to quit.\n');try{for(a&&(console.log(`> ${a}`),await ip({token:t,org_id:n,slug:o,message:a,stream:i}),console.log(""));;){const e=(await s.question("> ")).trim();if(e){if("exit"===e||"quit"===e)break;await ip({token:t,org_id:n,slug:o,message:e,stream:i}),console.log("")}}}finally{s.close()}}({token:t,org_id:n,slug:s,stream:a,initialMessage:o})}({token:i,org_id:a,message:r,slug:c,stream:!l}),process.exit(0)}));export{fu as g,hm as p};