jivamai 0.1.4-dev.edce8f4 → 0.1.4

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,131 @@
1
+ "use strict";var td=Object.defineProperty;var rd=(e,t,r)=>t in e?td(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var re=(e,t,r)=>rd(e,typeof t!="symbol"?t+"":t,r);const $=require("electron"),fe=require("child_process"),F=require("fs"),ne=require("os"),D=require("path"),We=require("url"),Nr=require("zlib"),ni=require("events"),nd=require("constants"),Jr=require("stream"),Fs=require("util"),Fl=require("assert"),Xr=require("crypto"),Ll=require("tty"),id=require("http");var xi=typeof document<"u"?document.currentScript:null;function Ls(){switch(process.platform){case"win32":{const e=process.env.APPDATA??D.join(ne.homedir(),"AppData","Roaming");return D.join(e,"jiva-nodejs","Config","config.json")}case"darwin":return D.join(ne.homedir(),"Library","Preferences","jiva-nodejs","config.json");default:return D.join(process.env.XDG_CONFIG_HOME??D.join(ne.homedir(),".config"),"jiva-nodejs","config.json")}}const Bn=Ls();function be(){try{if(F.existsSync(Bn)){const e=F.readFileSync(Bn,"utf-8");return JSON.parse(e)}return null}catch(e){return console.error("[ConfigManager] Failed to read config:",e),null}}function Yt(e){try{const t=D.dirname(Bn);return F.existsSync(t)||F.mkdirSync(t,{recursive:!0}),F.writeFileSync(Bn,JSON.stringify(e,null,2),"utf-8"),!0}catch(t){return console.error("[ConfigManager] Failed to write config:",t),!1}}const Hn=D.join(ne.homedir(),".jiva"),Fi=D.join(Hn,"jiva-directive.md"),Li=D.join(Hn,"conversations");function sd(e=5){try{return F.existsSync(Li)?F.readdirSync(Li).filter(r=>r.endsWith(".json")).map(r=>{const n=D.join(Li,r);try{const i=F.statSync(n),s=JSON.parse(F.readFileSync(n,"utf-8")),o=Array.isArray(s.messages)?s.messages.length:0;let a=s.summary??s.title??"";if(!a&&Array.isArray(s.messages)){const l=s.messages.find(u=>u.role==="user");l!=null&&l.content&&(a=String(l.content).slice(0,60).replace(/\n/g," "),String(l.content).length>60&&(a+="..."))}return a=a||"Untitled conversation",{stat:i,title:a,messageCount:o}}catch{return null}}).filter(Boolean).sort((r,n)=>n.stat.mtimeMs-r.stat.mtimeMs).slice(0,e).map(({stat:r,title:n,messageCount:i})=>{const s=new Date(r.mtimeMs);return{date:`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")} ${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`,title:n,messageCount:i}}):[]}catch{return[]}}function od(e){var E;const t=new Date,r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],n=["January","February","March","April","May","June","July","August","September","October","November","December"],i=r[t.getDay()],s=n[t.getMonth()],o=t.getDate(),a=t.getFullYear(),l=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),c=`${l}:${u}`;let f="UTC";try{f=((E=Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(t).find(C=>C.type==="timeZoneName"))==null?void 0:E.value)??"UTC"}catch{const C=-t.getTimezoneOffset(),A=C>=0?"+":"-",R=String(Math.floor(Math.abs(C)/60)).padStart(2,"0"),L=String(Math.abs(C)%60).padStart(2,"0");f=`UTC${A}${R}:${L}`}const h=t.toISOString(),p=sd(5);let w;p.length===0?w="_No previous sessions found._":w=`| Date | Title | Messages |
2
+ |------|-------|----------|
3
+ ${p.map(A=>`| ${A.date} | "${A.title}" | ${A.messageCount} |`).join(`
4
+ `)}`;const y=`# Jiva Operating Context
5
+
6
+ ## Current Date & Time
7
+ - Date: ${i}, ${s} ${o}, ${a}
8
+ - Time: ${c} ${f}
9
+ - ISO: ${h}
10
+
11
+ ## Important
12
+ - Always use the date above when referencing "today", "current year", or "recent" events
13
+ - Do NOT rely on training data for the current date — use only what is stated above
14
+ - When performing web searches, always use the year ${a} for current events
15
+
16
+ ## Recent Session Activity
17
+ ${w}
18
+ `;return e!=null&&e.trim()?e.trim()+`
19
+
20
+ ---
21
+
22
+ `+y:y}function ks(e){const t=od(e);try{F.existsSync(Hn)||F.mkdirSync(Hn,{recursive:!0}),F.writeFileSync(Fi,t,"utf-8"),console.log(`[DirectiveManager] Wrote directive to ${Fi}`)}catch(r){console.warn("[DirectiveManager] Failed to write directive:",r)}return{path:Fi,content:t}}const ki=D.join(ne.homedir(),".jiva","personas");function ad(e,t){return e==="chat"||t.includes("chat")?"MessageSquare":e==="research"||t.includes("research")?"Search":e==="developer"||e==="code-reviewer"||t.includes("code")?"Code2":e==="engineering-manager"||t.includes("management")?"Layers":e==="tester"||t.includes("testing")?"FlaskConical":e==="data-analyst"||t.includes("data")?"BarChart3":"Bot"}function ld(){const e=[];if(!F.existsSync(ki))return e;try{const t=F.readdirSync(ki,{withFileTypes:!0});for(const r of t){if(!r.isDirectory()||r.name==="skills")continue;const n=D.join(ki,r.name),i=D.join(n,".jiva-plugin","plugin.json");let s={};if(F.existsSync(i))try{const u=F.readFileSync(i,"utf-8");s=JSON.parse(u)}catch{}const o=r.name,a=s.tags??[],l=["chat","research"];e.push({name:o,displayName:(s.name??o).replace(/-/g," ").replace(/\b\w/g,u=>u.toUpperCase()),description:s.description??`${o} persona`,tags:a,icon:ad(o,a),isBuiltIn:l.includes(o),dirPath:n})}}catch(t){console.error("[PersonaManager] Failed to list personas:",t)}return e.sort((t,r)=>t.isBuiltIn&&!r.isBuiltIn?-1:!t.isBuiltIn&&r.isBuiltIn?1:t.name.localeCompare(r.name))}function cd(e){const{execSync:t}=require("child_process");try{return t(`jiva persona activate ${e}`,{timeout:1e4,stdio:"ignore"}),!0}catch{const r=D.join(ne.homedir(),".jiva","active-persona.txt");try{return F.writeFileSync(r,e,"utf-8"),!0}catch{return!1}}}function ud(){try{const e=Ls();if(F.existsSync(e)){const r=JSON.parse(F.readFileSync(e,"utf-8"));if(r.activePersona)return r.activePersona}const t=D.join(ne.homedir(),".jiva","active-persona.txt");if(F.existsSync(t))return F.readFileSync(t,"utf-8").trim()}catch{}return null}const fd="https://hcomegrnonxmjupvvyus.supabase.co",dd="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imhjb21lZ3Jub254bWp1cHZ2eXVzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzgxNTQwMjcsImV4cCI6MjA5MzczMDAyN30.sBBOTrPsdCZk75HDEzJaIv5Mz-bE3HTuJQ-1LcJ45nk",hd="https://jiva-hdjcuspt2a-uc.a.run.app";async function kl(e,t){const r=await fetch(`${fd}${e}`,{method:"POST",headers:{"Content-Type":"application/json",apikey:dd},body:JSON.stringify(t)}),n=await r.json();if(!r.ok){const i=n.error_description??n.error??n.message??"Auth failed";throw new Error(i)}return n}async function pd(e,t){const r=await kl("/auth/v1/token?grant_type=password",{email:e,password:t});return{userId:r.user.id,email:r.user.email,accessToken:r.access_token,refreshToken:r.refresh_token}}async function md(e,t){const r=await kl("/auth/v1/signup",{email:e,password:t}),n=r.user??r;return{userId:n.id,email:n.email,accessToken:r.access_token??"",refreshToken:r.refresh_token??""}}async function gd(e,t){const r=await fetch(`${hd}/api/session`,{method:"POST",headers:{"Content-Type":"application/json","x-tenant-id":e,"x-session-id":t},body:JSON.stringify({})});if(!r.ok){const n=await r.text();throw new Error(`Cloud session init failed: ${n}`)}}const wn="https://jiva-hdjcuspt2a-uc.a.run.app";class yd{constructor(){re(this,"userId",null);re(this,"sessionId",null);re(this,"_active",!1);re(this,"_abortController",null);re(this,"_readyPromise",null);re(this,"_readyResolve",null);re(this,"_readyReject",null)}startInit(){this._active||this._readyPromise||(this._readyPromise=new Promise((t,r)=>{this._readyResolve=t,this._readyReject=r}))}configure(t,r){var n;this.userId=t,this.sessionId=r,this._active=!0,(n=this._readyResolve)==null||n.call(this),this._readyResolve=null,this._readyReject=null}waitUntilReady(t){return this._active?Promise.resolve():this._readyPromise?Promise.race([this._readyPromise,new Promise((r,n)=>setTimeout(()=>n(new Error(`Cloud runner not ready after ${t}ms`)),t))]):Promise.reject(new Error("Cloud runner init not started"))}isActive(){return this._active}isInitializing(){return!this._active&&this._readyPromise!==null}deactivate(){var t;this._active=!1,this.userId=null,this.sessionId=null,(t=this._readyReject)==null||t.call(this,new Error("Cloud session deactivated")),this._readyPromise=null,this._readyResolve=null,this._readyReject=null}stop(){var t;(t=this._abortController)==null||t.abort()}get headers(){return{"Content-Type":"application/json","x-tenant-id":this.userId??"dev-tenant","x-session-id":this.sessionId??"default-session"}}async chat(t,r,n,i){if(!this._active)throw new Error("CloudRunner not configured");const s=Date.now();r("planning"),this._abortController=new AbortController;const{signal:o}=this._abortController;try{return{...await this._streamChat(t,r,i,o),durationMs:Date.now()-s}}catch(a){return a.name==="AbortError"?{content:"",iterations:0,toolsUsed:[],plan:null,durationMs:Date.now()-s}:(console.warn("[CloudRunner] SSE failed, falling back to non-streaming:",a),{...await this._nonStreamChat(t,r,o),durationMs:Date.now()-s})}finally{this._abortController=null,r("done")}}async _streamChat(t,r,n,i){const s=await fetch(`${wn}/api/chat/stream`,{method:"POST",headers:{...this.headers,Accept:"text/event-stream"},body:JSON.stringify({message:t}),signal:i});if(!s.ok||!s.body)throw new Error(`SSE request failed: ${s.status}`);const o=s.body.getReader(),a=new TextDecoder;let l="",u="",c=0;const f=[];let h=null,p=null;e:for(;;){const{done:w,value:y}=await o.read();if(w)break;l+=a.decode(y,{stream:!0});const E=l.split(`
23
+ `);l=E.pop()??"";for(const C of E){if(C.startsWith("event: ")){p=C.slice(7).trim();continue}if(!C.startsWith("data: "))continue;const A=C.slice(6).trim();if(!A||A==="[DONE]")continue;let R;try{R=JSON.parse(A)}catch{continue}const L=p??R.type;if(p=null,L==="status"){const Q=R.message;Q&&(r("executing"),n==null||n({timestamp:new Date().toISOString(),level:"info",tag:"cloud",message:`Tool: ${Q}`}))}else if(L==="response")u=R.content??R.response??"",c=R.iterations??0,Array.isArray(R.toolsUsed)&&f.push(...R.toolsUsed),R.plan&&(h=R.plan);else{if(L==="error")throw new Error(R.message??"Stream error");if(L==="done")break e}}}return{content:u,iterations:c,toolsUsed:f,plan:h}}async _nonStreamChat(t,r,n){r("executing");const i=await fetch(`${wn}/api/chat`,{method:"POST",headers:this.headers,body:JSON.stringify({message:t}),signal:n});if(!i.ok){const o=await i.text();throw new Error(`Cloud chat failed (${i.status}): ${o}`)}const s=await i.json();return{content:s.response??"",iterations:s.iterations??0,toolsUsed:Array.isArray(s.toolsUsed)?s.toolsUsed:[],plan:s.plan??null}}async resetConversation(){if(this._active)try{await fetch(`${wn}/api/chat/history`,{method:"DELETE",headers:this.headers})}catch(t){console.error("[CloudRunner] resetConversation failed:",t)}}async stopMessage(){try{await fetch(`${wn}/api/chat/stop`,{method:"POST",headers:this.headers})}catch{}this.stop()}}const vd=new Set(["txt","md","markdown","rst","log","js","jsx","ts","tsx","mjs","cjs","py","rb","go","rs","java","kt","swift","c","cpp","cc","h","hpp","cs","css","scss","sass","less","html","htm","xml","svg","xhtml","json","jsonc","yaml","yml","toml","ini","cfg","conf","sh","bash","zsh","fish","ps1","bat","cmd","sql","graphql","gql","proto","env","editorconfig","gitignore","gitattributes","dockerfile","makefile","cmake","gradle","r","jl","scala","clj","ex","exs","erl","hs","lua","pl","vue","svelte","astro","lock","mod","sum"]),Ul={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp"},wd={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",cs:"csharp",c:"c",cpp:"cpp",h:"c",hpp:"cpp",css:"css",scss:"scss",sass:"sass",less:"less",html:"html",htm:"html",xml:"xml",svg:"xml",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",toml:"toml",sh:"bash",bash:"bash",zsh:"bash",fish:"fish",ps1:"powershell",sql:"sql",graphql:"graphql",gql:"graphql",proto:"protobuf",md:"markdown",markdown:"markdown",rst:"rst",r:"r",jl:"julia",scala:"scala",lua:"lua",vue:"vue",svelte:"svelte"};function Ed(e){const t=e.toLowerCase().replace(/^\./,"");return vd.has(t)?"text":t in Ul?"image":t==="pdf"?"pdf":t==="docx"?"docx":"unsupported"}function _d(e){const t=D.basename(e),r=D.extname(e).toLowerCase().replace(/^\./,""),n=Ed(r);try{switch(n){case"text":return Sd(e,t,r);case"pdf":return Cd(e,t);case"docx":return Td(e,t);case"image":return Pd(e,t,r);default:return{name:t,category:"unsupported",markdown:"",error:`File type .${r} is not supported`}}}catch(i){return{name:t,category:n,markdown:"",error:i instanceof Error?i.message:"Failed to read file"}}}function Sd(e,t,r){if(F.statSync(e).size>2*1024*1024)return{name:t,category:"text",markdown:"",error:"File is too large (max 2 MB for text files)"};const i=F.readFileSync(e,"utf-8"),o=`\`\`\`${wd[r]??r}
24
+ ${i}
25
+ \`\`\``;return{name:t,category:"text",markdown:o}}function Cd(e,t){if(F.statSync(e).size>10*1024*1024)return{name:t,category:"pdf",markdown:"",error:"PDF is too large (max 10 MB)"};const n=F.readFileSync(e),i=Ad(n);if(!i.trim())return{name:t,category:"pdf",markdown:"",error:"Could not extract text from PDF (may be a scanned/image-only PDF)"};const s=`**[PDF: ${t}]**
26
+
27
+ ${i}`;return{name:t,category:"pdf",markdown:s}}function Ad(e){const t=e.toString("latin1"),r=[],n=/<<[^>]*\/Filter\s*\/FlateDecode[^>]*>>\s*stream\r?\n([\s\S]*?)\r?\nendstream/g;let i;for(;(i=n.exec(t))!==null;)try{const o=Buffer.from(i[1],"latin1"),a=Nr.inflateSync(o).toString("latin1");r.push(...Uo(a))}catch{}const s=/BT([\s\S]*?)ET/g;for(;(i=s.exec(t))!==null;)r.push(...Uo(i[1]));return[...new Set(r)].join(" ").replace(/\s+/g," ").trim()}function Uo(e){const t=[],r=/BT([\s\S]*?)ET/g;let n;for(;(n=r.exec(e))!==null;){const i=n[1],s=/\(([^)\\]*(?:\\.[^)\\]*)*)\)/g;let o;for(;(o=s.exec(i))!==null;){const u=o[1].replace(/\\n/g,`
28
+ `).replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\\(/g,"(").replace(/\\\)/g,")").replace(/\\\\/g,"\\").replace(/[^\x20-\x7E\n\r\t]/g,"").trim();u.length>0&&t.push(u)}const a=/<([0-9A-Fa-f\s]+)>/g;for(;(o=a.exec(i))!==null;){const l=o[1].replace(/\s/g,"");if(l.length%2!==0)continue;let u="";for(let c=0;c<l.length;c+=2){const f=parseInt(l.slice(c,c+2),16);f>=32&&f<=126&&(u+=String.fromCharCode(f))}u.trim().length>0&&t.push(u.trim())}}return t}function Td(e,t){if(F.statSync(e).size>10*1024*1024)return{name:t,category:"docx",markdown:"",error:"DOCX is too large (max 10 MB)"};const n=F.readFileSync(e),i=bd(n,"word/document.xml");if(!i)return{name:t,category:"docx",markdown:"",error:"Could not extract content from DOCX file"};const s=Id(i.toString("utf-8"));if(!s.trim())return{name:t,category:"docx",markdown:"",error:"DOCX appears to be empty"};const o=`**[DOCX: ${t}]**
29
+
30
+ ${s}`;return{name:t,category:"docx",markdown:o}}function bd(e,t){let r=0;for(;r<e.length-30;){if(e.readUInt32LE(r)!==67324752){r++;continue}const n=e.readUInt16LE(r+8),i=e.readUInt32LE(r+18),s=e.readUInt32LE(r+22),o=e.readUInt16LE(r+26),a=e.readUInt16LE(r+28),l=e.slice(r+30,r+30+o).toString("utf-8"),u=r+30+o+a,c=u+i;if(l===t){const f=e.slice(u,c);if(n===0)return f;if(n===8)try{return Nr.inflateRawSync(f)}catch{try{return Nr.inflateSync(f)}catch{return null}}return null}i===0&&s===0?r=u:r=c}return null}function Id(e){const t=[],r=/<w:p[ >]([\s\S]*?)<\/w:p>/g;let n;for(;(n=r.exec(e))!==null;){const i=[],s=/<w:t[^>]*>([^<]*)<\/w:t>/g;let o;for(;(o=s.exec(n[1]))!==null;)i.push(o[1]);const a=i.join("").trim();a&&t.push(a)}return t.join(`
31
+
32
+ `)}function Pd(e,t,r){if(F.statSync(e).size>20*1024*1024)return{name:t,category:"image",markdown:"",error:"Image is too large (max 20 MB)"};const i=Ul[r.toLowerCase()]??"image/png";return{name:t,category:"image",markdown:e,mimeType:i}}const $t=new yd;function Od(e,t,r){$.ipcMain.handle("setup:check",()=>{var w;let s=!1,o;try{fe.execSync("npm --version",{timeout:3e3}),s=!0;try{o=fe.execSync("node --version",{timeout:3e3}).toString().trim().replace(/^v/,"")}catch{}}catch{}let a=!1,l;if(s){try{const y=fe.execSync("npm root -g",{timeout:5e3}).toString().trim(),E=D.join(y,"jiva-core","package.json");F.existsSync(E)&&(l=JSON.parse(F.readFileSync(E,"utf-8")).version,a=!0)}catch{}if(!a){const y=D.join(ne.homedir(),".npm-global","lib","node_modules","jiva-core","package.json");if(F.existsSync(y))try{l=JSON.parse(F.readFileSync(y,"utf-8")).version,a=!0}catch{}}if(!a&&process.platform==="win32"){const y=[D.join(process.env.APPDATA??"","npm","node_modules","jiva-core","package.json"),D.join(process.env.LOCALAPPDATA??"","npm","node_modules","jiva-core","package.json")];for(const E of y)if(F.existsSync(E))try{l=JSON.parse(F.readFileSync(E,"utf-8")).version,a=!0;break}catch{}}}const u=[Ls(),D.join(ne.homedir(),".jiva","config.json")];let c=!1,f="";for(const y of u)if(F.existsSync(y))try{const E=JSON.parse(F.readFileSync(y,"utf-8")),C=((w=E==null?void 0:E.models)==null?void 0:w.reasoning)??{};if(((C==null?void 0:C.apiKey)??(E==null?void 0:E.apiKey)??"").length>0){c=!0,f=y;break}}catch{}let h=!1,p;try{const y=D.join(__dirname,"..","package.json");if(p=JSON.parse(F.readFileSync(y,"utf-8")).jivaCompatibleVersion,p&&l){const[C,A]=p.split(".").map(Number),[R,L]=l.split(".").map(Number);(C!==R||A!==L)&&(h=!0)}}catch{}return{nodejs:{ok:s,version:o},jivaCore:{ok:a,version:l},config:{ok:c,path:f||u[0]},platform:process.platform,jivaVersionMismatch:h,requiredJivaVersion:p}}),e.on("status-changed",(s,o)=>{const a=r(),l=s==="ready"||s==="busy"?"running":s;a==null||a.webContents.send("jiva:server:status-changed",l,o)}),$.ipcMain.handle("jiva:server:start",async()=>{try{return(e.getStatus()==="stopped"||e.getStatus()==="error")&&await e.initialize(),{success:!0,status:e.getStatus()}}catch(s){const o=s instanceof Error?s.message:String(s);return console.error("[IPC] jiva:server:start failed:",o),{success:!1,error:o}}}),$.ipcMain.handle("jiva:server:stop",async()=>{try{return await e.cleanup(),{success:!0}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}),$.ipcMain.handle("jiva:server:restart",async()=>{try{return await e.cleanup(),await e.initialize(),{success:!0,status:e.getStatus()}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}),$.ipcMain.handle("jiva:server:status",()=>{const s=e.getStatus();return{status:s==="ready"||s==="busy"?"running":s,port:0}}),$.ipcMain.handle("jiva:send-message",async(s,o,a,l)=>{const u=s.sender,f=u.getURL().includes("mode=cloud");try{if(f){$t.isActive()||await $t.waitUntilReady(3e4);const p=await $t.chat(o,w=>{u.send("jiva:phase-update",w)},l,w=>{u.send("jiva:jiva-log",w)});return{success:!0,result:p,conversationId:p.conversationId}}(e.getStatus()==="stopped"||e.getStatus()==="error")&&await e.initialize();const h=await e.chat(o,p=>{u.send("jiva:phase-update",p)},l,p=>{u.send("jiva:jiva-log",p)});return{success:!0,result:h,conversationId:h.conversationId}}catch(h){return{success:!1,error:h instanceof Error?h.message:String(h)}}}),$.ipcMain.handle("jiva:stop-message",()=>(e.stop(),{success:!0})),$.ipcMain.handle("jiva:reset-conversation",()=>(e.resetConversation(),{success:!0})),$.ipcMain.handle("jiva:load-conversation",async(s,o)=>{try{return(e.getStatus()==="stopped"||e.getStatus()==="error")&&await e.initialize(),await e.loadConversation(o),{success:!0}}catch(a){return{success:!1,error:a instanceof Error?a.message:String(a)}}}),$.ipcMain.handle("config:read",()=>be()),$.ipcMain.handle("config:write",(s,o)=>Yt(o)),$.ipcMain.handle("personas:list",()=>ld()),$.ipcMain.handle("personas:activate",async(s,o)=>{const a=cd(o);if(a)try{await e.switchPersona(o)}catch(l){console.error("[IPC] Failed to switch persona:",l)}return{success:a}}),$.ipcMain.handle("personas:active",()=>ud()),$.ipcMain.handle("conversations:list",()=>{const s=D.join(ne.homedir(),".jiva","conversations");try{return F.existsSync(s)?F.readdirSync(s).filter(a=>a.endsWith(".json")).map(a=>{var c,f,h;const l=D.join(s,a),u=F.statSync(l);try{const p=JSON.parse(F.readFileSync(l,"utf-8"));let w=((c=p.metadata)==null?void 0:c.title)??p.summary??p.title??"";if(!w&&Array.isArray(p.messages)){const y=p.messages.find(E=>E.role==="user");if(y!=null&&y.content){const E=typeof y.content=="string"?y.content:Array.isArray(y.content)?y.content.filter(C=>C.type==="text").map(C=>C.text??"").join(""):"";w=E.slice(0,60).replace(/\n/g," "),E.length>60&&(w+="...")}}return w=w||"Untitled",{id:a.replace(".json",""),summary:w,messageCount:((f=p.messages)==null?void 0:f.length)??0,lastModified:u.mtimeMs,type:((h=p.metadata)==null?void 0:h.type)??"chat"}}catch{return null}}).filter(Boolean).sort((a,l)=>l.lastModified-a.lastModified):[]}catch{return[]}}),$.ipcMain.handle("conversations:load",(s,o)=>{const a=D.join(ne.homedir(),".jiva","conversations",`${o}.json`);try{return F.existsSync(a)?JSON.parse(F.readFileSync(a,"utf-8")):null}catch{return null}}),$.ipcMain.handle("mcp:list-status",()=>{try{const s=e.getMCPServerStatus(),o=be(),a=(o==null?void 0:o.mcpServers)??{},l=new Map(s.map(c=>[c.name,c])),u=Object.entries(a).map(([c,f])=>{const h=l.get(c);return{name:c,enabled:f.enabled??!0,connected:(h==null?void 0:h.connected)??!1,toolCount:(h==null?void 0:h.toolCount)??0,command:f.command??"",args:f.args??[],env:f.env??{},url:f.url,type:f.command?"stdio":"http",error:h==null?void 0:h.error}});for(const c of s)a[c.name]||u.push({name:c.name,enabled:c.enabled,connected:c.connected,toolCount:c.toolCount,command:"",args:[],env:{},url:void 0,type:"stdio"});return u}catch{return[]}}),$.ipcMain.handle("mcp:get-tools",()=>{try{return e.getMCPTools()}catch{return{}}}),$.ipcMain.handle("mcp:add-server",async(s,o,a)=>{try{const l=be();if(!l)return{success:!1,error:"Config not found"};const u={enabled:a.enabled??!0};return a.type==="stdio"?(u.command=a.command??"",u.args=a.args??[],a.env&&Object.keys(a.env).length>0&&(u.env=a.env)):(u.url=a.url??"",a.env&&Object.keys(a.env).length>0&&(u.env=a.env)),l.mcpServers={...l.mcpServers??{},[o]:u},Yt(l),(e.getStatus()==="ready"||e.getStatus()==="busy")&&await e.addMCPServer(o,u),{success:!0}}catch(l){return{success:!1,error:l instanceof Error?l.message:String(l)}}}),$.ipcMain.handle("mcp:remove-server",async(s,o)=>{try{const a=be();return a!=null&&a.mcpServers&&(delete a.mcpServers[o],Yt(a)),(e.getStatus()==="ready"||e.getStatus()==="busy")&&await e.removeMCPServer(o),{success:!0}}catch(a){return{success:!1,error:a instanceof Error?a.message:String(a)}}}),$.ipcMain.handle("mcp:toggle-server",async(s,o,a)=>{var l;try{const u=be();return(l=u==null?void 0:u.mcpServers)!=null&&l[o]&&(u.mcpServers[o].enabled=a,Yt(u)),(e.getStatus()==="ready"||e.getStatus()==="busy")&&await e.toggleMCPServer(o,a),{success:!0}}catch(u){return{success:!1,error:u instanceof Error?u.message:String(u)}}}),$.ipcMain.handle("mcp:reconnect-server",async(s,o)=>{try{return await e.reconnectMCPServer(o),{success:!0}}catch(a){return{success:!1,error:a instanceof Error?a.message:String(a)}}}),$.ipcMain.handle("workspace:get-dir",()=>{const s=be();return(s==null?void 0:s.workspaceDir)??ne.homedir()}),$.ipcMain.handle("workspace:set-dir",(s,o)=>{try{const a=be()??{models:{reasoning:null}};return Yt({...a,workspaceDir:o}),{success:!0}}catch(a){return{success:!1,error:a instanceof Error?a.message:String(a)}}}),$.ipcMain.handle("workspace:pick-dir",async()=>{const s=r(),o=await $.dialog.showOpenDialog(s,{properties:["openDirectory"],title:"Select Workspace Directory"});return o.canceled||o.filePaths.length===0?null:o.filePaths[0]}),$.ipcMain.handle("workspace:list-files",(s,o)=>{try{const a=ne.homedir(),l=D.resolve(o),u=D.resolve(a);return!l.startsWith(u)&&l!==u?[]:F.existsSync(l)?F.readdirSync(l,{withFileTypes:!0}).filter(f=>!f.name.startsWith(".")).map(f=>{const h=D.join(l,f.name),p=F.statSync(h);return{name:f.name,path:h,isDirectory:f.isDirectory(),size:p.size,modified:p.mtimeMs}}):[]}catch{return[]}}),$.ipcMain.handle("workspace:read-file",(s,o)=>{try{const a=ne.homedir(),l=D.resolve(o),u=D.resolve(a);return!l.startsWith(u)||!F.existsSync(l)?null:F.statSync(l).size>512*1024?"[File too large to preview — open in an external editor]":F.readFileSync(l,"utf-8")}catch{return null}}),$.ipcMain.handle("workspace:open-external",(s,o)=>{$.shell.showItemInFolder(o)}),$.ipcMain.handle("file:pick-attachments",async(s,o)=>{const a=r(),l=["png","jpg","jpeg","gif","webp","bmp"],u=["pdf","docx"],c=["txt","md","markdown","rst","log","js","jsx","ts","tsx","mjs","cjs","py","rb","go","rs","java","kt","swift","c","cpp","cc","h","hpp","cs","css","scss","sass","less","html","htm","xml","svg","json","jsonc","yaml","yml","toml","ini","cfg","conf","sh","bash","zsh","ps1","bat","sql","graphql","proto","env","dockerfile","makefile","vue","svelte","astro","r","lua","scala"],h=[{name:"All Supported Files",extensions:o?[...l,...u,...c]:[...u,...c]},{name:"Documents",extensions:u},{name:"Text & Code",extensions:c}];o&&h.push({name:"Images",extensions:l});const p=await $.dialog.showOpenDialog(a,{title:"Attach Files",properties:["openFile","multiSelections"],filters:h});return p.canceled||p.filePaths.length===0?[]:p.filePaths}),$.ipcMain.handle("file:convert-attachment",(s,o)=>{const a=ne.homedir();if(!D.resolve(o).startsWith(D.resolve(a)))return{name:D.basename(o),category:"unsupported",markdown:"",error:"Access denied: file is outside home directory"};const u=_d(o);if(u.category==="image"&&!u.error)try{const c=be(),f=(c==null?void 0:c.workspaceDir)??a,h=D.join(f,".jiva","uploads");F.mkdirSync(h,{recursive:!0});const p=D.join(h,D.basename(o));F.copyFileSync(o,p),u.markdown=p}catch(c){u.error=`Failed to save image to workspace: ${c instanceof Error?c.message:String(c)}`}return u}),$.ipcMain.handle("file:describe-image",async(s,o)=>{try{const a=D.extname(o).toLowerCase().replace(/^\./,""),u={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp"}[a]??"image/png",c=F.readFileSync(o).toString("base64"),f=`data:${u};base64,${c}`;return{success:!0,description:await e.describeImage(f)}}catch(a){return{success:!1,error:a instanceof Error?a.message:String(a)}}}),$.ipcMain.handle("window:minimize",()=>{var s;(s=r())==null||s.minimize()}),$.ipcMain.handle("window:maximize",()=>{const s=r();s!=null&&s.isMaximized()?s.unmaximize():s==null||s.maximize()}),$.ipcMain.handle("window:close",()=>{var s;(s=r())==null||s.close()}),$.ipcMain.handle("window:isMaximized",()=>{var s;return((s=r())==null?void 0:s.isMaximized())??!1}),$.ipcMain.handle("code:send-message",async(s,o,a)=>{const l=r();try{if(!t.isReady()){const c=be(),f=(c==null?void 0:c.workspaceDir)??ne.homedir();await t.initialize(f)}return{success:!0,...await t.chat(o,c=>{l==null||l.webContents.send("jiva:code-log",c)},a)}}catch(u){return{success:!1,error:u instanceof Error?u.message:String(u)}}}),$.ipcMain.handle("code:stop-message",()=>(t.stop(),{success:!0})),$.ipcMain.handle("code:reset-session",async()=>{try{return await t.cleanup(),{success:!0}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}),$.ipcMain.handle("git:is-repo",(s,o)=>{try{return fe.execFileSync("git",["rev-parse","--is-inside-work-tree"],{cwd:o,timeout:3e3}),!0}catch{return!1}}),$.ipcMain.handle("git:status",(s,o)=>{try{return fe.execFileSync("git",["status","--porcelain"],{cwd:o,timeout:5e3}).toString().split(`
33
+ `).filter(Boolean).map(l=>({status:l.slice(0,2).trim(),file:l.slice(3).trim()}))}catch{return[]}}),$.ipcMain.handle("git:diff-file",(s,o,a,l)=>{try{if(l==="??"){const u=D.join(o,a);try{const f=F.readFileSync(u,"utf-8").split(`
34
+ `);f[f.length-1]===""&&f.pop();const h=f.map(p=>`+${p}`).join(`
35
+ `);return`--- /dev/null
36
+ +++ b/${a}
37
+ @@ -0,0 +1,${f.length} @@
38
+ ${h}`}catch{return null}}if(l==="A")try{const u=fe.execFileSync("git",["diff","--cached","--",a],{cwd:o,timeout:5e3}).toString();if(u.trim())return u}catch{}try{const u=fe.execFileSync("git",["diff","HEAD","--",a],{cwd:o,timeout:5e3}).toString();if(u.trim())return u}catch{}try{const u=fe.execFileSync("git",["diff","--cached","--",a],{cwd:o,timeout:5e3}).toString();if(u.trim())return u}catch{}try{const u=fe.execFileSync("git",["diff","--",a],{cwd:o,timeout:5e3}).toString();if(u.trim())return u}catch{}return null}catch{return null}}),$.ipcMain.handle("git:init-repo",(s,o)=>{try{return fe.execFileSync("git",["init"],{cwd:o,timeout:1e4}),{success:!0}}catch(a){return{success:!1,error:a instanceof Error?a.message:String(a)}}}),$.ipcMain.handle("git:branch-info",(s,o)=>{try{const a=fe.execFileSync("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:o,timeout:3e3}).toString().trim();let l=0,u=0;try{const c=fe.execFileSync("git",["rev-parse","--abbrev-ref","--symbolic-full-name","@{u}"],{cwd:o,timeout:3e3}).toString().trim();if(c){const f=fe.execFileSync("git",["rev-list","--left-right","--count",`${c}...HEAD`],{cwd:o,timeout:3e3}).toString().trim().split(" ");u=parseInt(f[0])||0,l=parseInt(f[1])||0}}catch{}return{branch:a,ahead:l,behind:u}}catch{return null}}),$.ipcMain.handle("code:init",async(s,o,a,l)=>{try{return await t.initialize(o,a,l),{success:!0}}catch(u){return{success:!1,error:u instanceof Error?u.message:String(u)}}}),$.ipcMain.handle("code:list-mcp-for-code",()=>{try{const s=be(),o=(s==null?void 0:s.mcpServers)??{};return Object.entries(o).map(([a,l])=>({name:a,enabled:l.enabled??!0,codeMode:l.codeMode===!0,command:l.command??"",url:l.url}))}catch{return[]}}),$.ipcMain.handle("code:get-conversation-id",()=>t.getConversationId());const n=D.join(ne.homedir(),".jiva","jivam-mcp-selections.json");function i(){try{if(F.existsSync(n))return JSON.parse(F.readFileSync(n,"utf-8"))}catch{}return{}}$.ipcMain.handle("code:get-mcp-selection",(s,o)=>i()[o]??[]),$.ipcMain.handle("code:set-mcp-selection",(s,o,a)=>{try{const l=i();return l[o]=a,F.mkdirSync(D.dirname(n),{recursive:!0}),F.writeFileSync(n,JSON.stringify(l,null,2)),{success:!0}}catch(l){return{success:!1,error:l instanceof Error?l.message:String(l)}}}),$.ipcMain.handle("directive:get",()=>{const s=be();return(s==null?void 0:s.userDirective)??""}),$.ipcMain.handle("directive:set",(s,o)=>{const a=be()??{models:{reasoning:null}};return Yt({...a,userDirective:o}),ks(o||void 0),{success:!0}}),$.ipcMain.handle("cloud:sign-in",async(s,o,a)=>{try{const l=await pd(o,a);return{userId:l.userId,email:l.email}}catch(l){return{error:l instanceof Error?l.message:String(l)}}}),$.ipcMain.handle("cloud:sign-up",async(s,o,a)=>{try{const l=await md(o,a);return{userId:l.userId,email:l.email}}catch(l){return{error:l instanceof Error?l.message:String(l)}}}),$.ipcMain.handle("cloud:sign-out",async()=>{$t.deactivate()}),$.ipcMain.handle("cloud:init",async(s,o,a)=>{$t.startInit();try{return await gd(o,a),$t.configure(o,a),{success:!0}}catch(l){return $t.deactivate(),{success:!1,error:l instanceof Error?l.message:String(l)}}})}let Ui=null;function Rd(e){const t=/^---\s*\n([\s\S]*?)\n---/.exec(e);if(!t)return{};const r={};for(const n of t[1].split(`
39
+ `)){const i=n.indexOf(":");if(i===-1)continue;const s=n.slice(0,i).trim(),o=n.slice(i+1).trim().replace(/^["']|["']$/g,"");s&&(r[s]=o)}return r}async function Dd(){if(Ui!==null)return Ui;const e=[D.join(ne.homedir(),".claude","skills"),D.join(ne.homedir(),".jiva","skills")],t=[];for(const r of e){if(!F.existsSync(r))continue;let n;try{n=F.readdirSync(r,{withFileTypes:!0})}catch{continue}for(const i of n){if(!i.isDirectory())continue;const s=D.join(r,i.name),o=D.join(s,"SKILL.md");if(F.existsSync(o))try{const a=F.readFileSync(o,"utf-8"),l=Rd(a),u=l.name??i.name,c=l.description??"";t.push({name:u,description:c,dir:s})}catch{}}}return Ui=t,t}async function Nd(e,t,r){const n="You are a task coordinator. Structure the following request for a coding agent. Respond only with valid JSON, no markdown fences.",i=t.length>0?t.map(l=>`- ${l.name} (${l.dir}): ${l.description}`).join(`
40
+ `):"(none available)",s=`Task:
41
+ ${e}
42
+
43
+ Available skills:
44
+ ${i}
45
+
46
+ Respond with JSON:
47
+ {"structured_prompt":"clear restatement of the task","relevant_skills":["skill_name_if_applicable"],"notes":"optional clarifications"}`;let o=e;const a=[];try{const l=await r(n,s);if(l){const u=l.trim().replace(/^```json\s*|\s*```$/g,""),c=JSON.parse(u);typeof c.structured_prompt=="string"&&c.structured_prompt&&(o=c.structured_prompt),Array.isArray(c.relevant_skills)&&a.push(...c.relevant_skills.filter(f=>typeof f=="string"))}}catch{}if(a.length>0){const l=a.map(u=>t.find(c=>c.name===u)).filter(u=>u!==void 0);if(l.length>0){const u=l.map(c=>`- ${c.name}: ${c.dir}
48
+ Read SKILL.md in that directory for full usage instructions.`).join(`
49
+ `);o=`${o}
50
+
51
+ Relevant skill(s) available:
52
+ ${u}`}}return o}async function $d(e,t,r){const n="You are evaluating whether an AI agent fully completed a task. Respond only with valid JSON, no markdown fences.",i=`Original request:
53
+ ${e}
54
+
55
+ Agent response summary:
56
+ ${t.slice(0,1500)}
57
+
58
+ Respond with JSON:
59
+ {"satisfied":true,"refinement":"what to try differently, empty string if satisfied"}`;try{const s=await r(n,i);if(s){const o=s.trim().replace(/^```json\s*|\s*```$/g,""),a=JSON.parse(o);return{satisfied:a.satisfied===!0,refinement:typeof a.refinement=="string"?a.refinement:""}}}catch{}return{satisfied:!0,refinement:""}}const Mo=3;async function Ml(e,t,r){const n=await Dd(),i=await Nd(e,n,t);let s=i,o=null;for(let a=1;a<=Mo&&(o=await r(s),a!==Mo);a++){const l=await $d(e,o.content,t);if(l.satisfied)break;const u=o.content.slice(0,500);s=`${i}
60
+
61
+ [Previous attempt summary: ${u}]
62
+
63
+ [Try a different approach: ${l.refinement}]`}return o}function xd(){try{const t=fe.execSync("npm root -g",{timeout:5e3}).toString().trim(),r=D.join(t,"jiva-core","package.json");if(F.existsSync(r)){const i=JSON.parse(F.readFileSync(r,"utf-8")).main??"dist/index.js";return D.join(t,"jiva-core",i)}}catch{}const e=D.join(ne.homedir(),".npm-global","lib","node_modules","jiva-core","dist","index.js");if(F.existsSync(e))return e;throw new Error("Could not find jiva-core. Please run: npm install -g jiva-core")}const Fd=/^(\d{4}-\d{2}-\d{2}T[\d:.Z]+)\s+\[(INFO|WARN|ERROR)\]\s+\[(\w+)\]\s+(.+)$/;function jl(e){const t=Fd.exec(e.trim());return t?{timestamp:t[1],level:t[2].toLowerCase(),tag:t[3],message:t[4]}:null}class Ld extends ni.EventEmitter{constructor(){super(...arguments);re(this,"agent",null);re(this,"orchestrator",null);re(this,"workspace",null);re(this,"conversationManager",null);re(this,"mcpManager",null);re(this,"ready",!1);re(this,"deepRun",!1);re(this,"maxIterations",50)}isReady(){return this.ready}getConversationId(){return this.conversationManager?this.conversationManager.currentConversationId??null:null}async initialize(r,n,i){var G,q;this.deepRun=(i==null?void 0:i.deepRun)??!1,this.maxIterations=(i==null?void 0:i.maxIterations)??50;const s=xd();console.log(`[CodeRunner] Loading jiva-core from: ${s}`);const o=await import(We.pathToFileURL(s).href),{configManager:a,ModelOrchestrator:l,WorkspaceManager:u,ConversationManager:c,CodeAgent:f,MCPServerManager:h,createKrutrimModel:p,createLocalProvider:w}=o;a.validateConfig();const y=a.getReasoningModel(),C=p({endpoint:y.endpoint,apiKey:y.apiKey,model:y.defaultModel,type:"reasoning",useHarmonyFormat:y.useHarmonyFormat}),A=l;this.orchestrator=new A({reasoningModel:C});const{path:R}=ks((G=be())==null?void 0:G.userDirective),L=u;this.workspace=new L({workspaceDir:r,directivePath:R}),await this.workspace.initialize();const ee=await w(),Y=c;this.conversationManager=new Y(ee,this.orchestrator),this.mcpManager=null;const ue=n&&n.length>0?n:null;if(ue&&h){const H=h,X=new H,O=((q=be())==null?void 0:q.mcpServers)??{},I={};for(const x of ue)O[x]&&(I[x]=O[x]);await X.initialize(I),this.mcpManager=X,console.log(`[CodeRunner] MCP servers loaded: ${ue.join(", ")}`)}const v=f;this.agent=new v({orchestrator:this.orchestrator,workspace:this.workspace,conversationManager:this.conversationManager,maxIterations:this.maxIterations,...this.mcpManager&&ue?{mcpManager:this.mcpManager,mcpServerNames:ue}:{}}),this.ready=!0,console.log(`[CodeRunner] Initialized (maxIterations=${this.maxIterations}, deepRun=${this.deepRun})`)}makeCompleter(){const r=this.orchestrator;return async(n,i)=>{for(const s of["complete","generateResponse","generate","chat","invoke"])if(typeof r[s]=="function")try{return(await r[s].bind(r)([{role:"system",content:n},{role:"user",content:i}])).content??null}catch{}return null}}async chat(r,n,i){return(i==null?void 0:i.deepRun)??this.deepRun?Ml(r,this.makeCompleter(),o=>this.runChat(o,n)):this.runChat(r,n)}async runChat(r,n){if(!this.agent)throw new Error("CodeRunner not initialized");const i=this.agent,s=process.stdout.write.bind(process.stdout),o=process.stderr.write.bind(process.stderr),a=l=>{const u=typeof l=="string"?l:Buffer.from(l).toString();for(const c of u.split(`
64
+ `)){const f=jl(c);f&&n(f)}};process.stdout.write=(l,...u)=>(a(l),s(l,...u)),process.stderr.write=(l,...u)=>(a(l),o(l,...u));try{const l=await i.chat(r);return{content:l.content,toolsUsed:l.toolsUsed??[],iterations:l.iterations??0}}finally{process.stdout.write=s,process.stderr.write=o}}stop(){this.agent&&this.agent.stop()}async cleanup(){if(this.agent)try{await this.agent.cleanup()}catch(r){console.warn("[CodeRunner] Cleanup error:",r)}if(this.mcpManager)try{await this.mcpManager.cleanup()}catch{}this.agent=null,this.orchestrator=null,this.workspace=null,this.conversationManager=null,this.mcpManager=null,this.ready=!1}}function kd(){try{const t=fe.execSync("npm root -g",{timeout:5e3}).toString().trim(),r=D.join(t,"jiva-core","package.json");if(F.existsSync(r)){const i=JSON.parse(F.readFileSync(r,"utf-8")).main??"dist/index.js";return D.join(t,"jiva-core",i)}}catch{}if(process.platform==="win32"){const t=[D.join(process.env.APPDATA??"","npm","node_modules","jiva-core","dist","index.js"),D.join(process.env.LOCALAPPDATA??"","npm","node_modules","jiva-core","dist","index.js"),"C:\\Program Files\\nodejs\\node_modules\\jiva-core\\dist\\index.js"];for(const r of t)if(F.existsSync(r))return r}const e="/Users/abidev/.npm-global/lib/node_modules/jiva-core/dist/index.js";if(F.existsSync(e))return e;throw new Error("Could not find jiva-core. Please ensure it is installed globally: npm install -g jiva-core")}class Ud extends ni.EventEmitter{constructor(){super(...arguments);re(this,"status","stopped");re(this,"agent",null);re(this,"orchestrator",null);re(this,"mcpManager",null);re(this,"workspace",null);re(this,"conversationManager",null);re(this,"personaManager",null);re(this,"jivaLogger",null);re(this,"currentPersona",null);re(this,"currentConversationId",null)}getStatus(){return this.status}getCurrentConversationId(){return this.currentConversationId}async initialize(r){var n;this.setStatus("initializing");try{const i=kd();console.log(`[JivaRunner] Loading jiva-core from: ${i}`);const s=await import(We.pathToFileURL(i).href),{configManager:o,MCPServerManager:a,WorkspaceManager:l,ConversationManager:u,ModelOrchestrator:c,DualAgent:f,createKrutrimModel:h,LogLevel:p,logger:w,createLocalProvider:y}=s;if(!o.isConfigured())throw new Error("Jiva is not configured. Please run: jiva setup");o.validateConfig();const E=o.getReasoningModel(),C=o.getMultimodalModel(),A=h,R=A({endpoint:E.endpoint,apiKey:E.apiKey,model:E.defaultModel,type:"reasoning",useHarmonyFormat:E.useHarmonyFormat});let L;if(C)try{L=A({endpoint:C.endpoint,apiKey:C.apiKey,model:C.defaultModel,type:"multimodal"})}catch{console.warn("[JivaRunner] Failed to create multimodal model, continuing without vision")}const Q=c;this.orchestrator=new Q({reasoningModel:R,multimodalModel:L});const ee=o.getMCPServers(),Y=ne.platform()==="win32"?"C:\\Users":"/Users";ee.filesystem||(ee.filesystem={command:"npx",args:["-y","@modelcontextprotocol/server-filesystem",Y],enabled:!0});const ue=a;this.mcpManager=new ue,await this.mcpManager.initialize(ee);const{path:v}=ks((n=be())==null?void 0:n.userDirective),G=process.cwd(),q=l;this.workspace=new q({workspaceDir:G,directivePath:v}),await this.workspace.initialize();const X=await y(),O=u;this.conversationManager=new O(X,this.orchestrator);const I=D.dirname(i),x=D.dirname(I),b=D.join(x,"dist","personas","persona-manager.js"),{PersonaManager:k}=await import(We.pathToFileURL(b).href);this.personaManager=new k,await this.personaManager.initialize(r??o.getActivePersona()??void 0);const N=this.personaManager.getPersonaMCPServers();for(const[z,W]of Object.entries(N))try{await this.mcpManager.addServer(z,W)}catch(Z){console.warn(`[JivaRunner] Failed to add persona MCP server '${z}':`,Z)}const B=f;this.agent=new B({orchestrator:this.orchestrator,mcpManager:this.mcpManager,workspace:this.workspace,conversationManager:this.conversationManager,personaManager:this.personaManager,maxSubtasks:20,maxIterations:10,autoSave:!0,condensingThreshold:30}),this.jivaLogger=w,this.currentPersona=r??null,this.setStatus("ready"),console.log("[JivaRunner] Initialized successfully")}catch(i){const s=i instanceof Error?i.message:String(i);throw console.error("[JivaRunner] Initialization failed:",s),this.setStatus("error",s),i}}makeCompleter(){const r=this.orchestrator;return async(n,i)=>{for(const s of["complete","generateResponse","generate","chat","invoke"])if(typeof r[s]=="function")try{return(await r[s].bind(r)([{role:"system",content:n},{role:"user",content:i}])).content??null}catch{}return null}}hookLogger(r){const n=this.jivaLogger;if(!n)return()=>{};const i=(o,a,l)=>{const u=o.toLowerCase();r({timestamp:new Date().toISOString(),level:u==="warn"||u==="error"?u:"info",tag:a,message:l})};if(typeof n.on=="function"){const o=(...a)=>{if(a.length>=3&&typeof a[0]=="string")i(a[0],a[1]??"jiva",a[2]);else if(a.length>=2&&typeof a[0]=="string")i("info","jiva",a[1]);else if(a.length>=1&&typeof a[0]=="object"){const l=a[0];i(String(l.level??"info"),String(l.tag??l.name??"jiva"),String(l.message??l.msg??""))}};try{return n.on("log",o),()=>{typeof n.off=="function"?n.off("log",o):typeof n.removeListener=="function"&&n.removeListener("log",o)}}catch{}}for(const o of["addTransport","addHandler","addSink"]){if(typeof n[o]!="function")continue;const a=o.replace("add","remove"),l={write:u=>{i(String(u.level??"info"),String(u.tag??u.name??"jiva"),String(u.message??u.msg??""))},log:u=>{i(String(u.level??"info"),String(u.tag??u.name??"jiva"),String(u.message??u.msg??""))}};try{return n[o](l),()=>{if(typeof n[a]=="function")try{n[a](l)}catch{}}}catch{}}const s=process.stdout.write.bind(process.stdout);return process.stdout.write=(o,...a)=>{const l=typeof o=="string"?o:Buffer.from(o).toString();for(const u of l.split(`
65
+ `)){const c=jl(u);if(c){r(c);continue}const f=/(?:tool(?:\s+call)?|calling|executing)[:\s]+([^\s(]+)/i.exec(u.trim());f&&r({timestamp:new Date().toISOString(),level:"info",tag:"jiva",message:`Tool: ${f[1]}`})}return s(o,...a)},()=>{process.stdout.write=s}}async runChat(r,n,i){var u,c,f;const s=i?this.hookLogger(i):null,o=this.agent;let a;try{a=await o.chat(r)}finally{s==null||s()}if(i&&((u=a.toolsUsed)!=null&&u.length))for(const h of a.toolsUsed)i({timestamp:new Date().toISOString(),level:"info",tag:"jiva",message:`Tool: ${h}`});let l=null;try{l=((f=(c=this.conversationManager).getCurrentConversationId)==null?void 0:f.call(c))??null}catch{}if(!l)try{l=await this.agent.saveConversation()}catch{}return l&&(this.currentConversationId=l),{content:a.content,iterations:a.iterations,toolsUsed:a.toolsUsed??[],plan:a.plan?{subtasks:a.plan.subtasks??[],reasoning:a.plan.reasoning}:null,durationMs:Date.now()-n,conversationId:this.currentConversationId??void 0}}async chat(r,n,i,s){if(!this.agent)throw new Error("JivaRunner not initialized. Call initialize() first.");if(this.status==="busy")throw new Error("Agent is already processing a request.");this.setStatus("busy");const o=Date.now();n("planning");const a=setTimeout(()=>n("executing"),5e3),l=setTimeout(()=>n("synthesizing"),2e4);try{let u;return i!=null&&i.deepRun?u=await Ml(r,this.makeCompleter(),c=>this.runChat(c,o,s)):u=await this.runChat(r,o,s),clearTimeout(a),clearTimeout(l),n("done"),this.setStatus("ready"),u}catch(u){throw clearTimeout(a),clearTimeout(l),this.setStatus("ready"),u}}async loadConversation(r){if(!this.agent)throw new Error("JivaRunner not initialized. Call initialize() first.");await this.agent.loadConversation(r),this.currentConversationId=r,console.log(`[JivaRunner] Loaded conversation: ${r}`)}async switchPersona(r){this.agent&&await this.cleanup(),await this.initialize(r)}resetConversation(){this.agent&&this.agent.resetConversation(),this.currentConversationId=null}getMCPTools(){var r,n;if(!this.mcpManager)return{};try{const i=((n=(r=this.mcpManager).getAllTools)==null?void 0:n.call(r))??[],s={};for(const o of i){const a=o.name.split("__"),l=a.length>1?a[0]:"unknown",u=a.length>1?a.slice(1).join("__"):o.name;s[l]||(s[l]=[]),s[l].push({name:u,description:o.description??""})}return s}catch{return{}}}async addMCPServer(r,n){if(!this.mcpManager)throw new Error("MCP manager not initialized");await this.mcpManager.addServer(r,n)}async removeMCPServer(r){if(!this.mcpManager)throw new Error("MCP manager not initialized");const n=this.mcpManager;n.removeServer?await n.removeServer(r):n.disableServer&&await n.disableServer(r)}getMCPServerStatus(){var r,n;if(!this.mcpManager)return[];try{return(((n=(r=this.mcpManager).getServerStatus)==null?void 0:n.call(r))??[]).map(s=>({...s,error:s.error??s.lastError}))}catch{return[]}}async reconnectMCPServer(r){var l,u,c;if(!this.mcpManager)throw new Error("MCP manager not initialized");const n=this.mcpManager;if(typeof n.reconnectServer=="function"){await n.reconnectServer(r);return}if(!this.getMCPServerStatus().find(f=>f.name===r))throw new Error(`MCP server "${r}" not found`);const o=((c=(u=(l=this.mcpManager).getServerStatus)==null?void 0:u.call(l))==null?void 0:c.find(f=>f.name===r))??{};await this.removeMCPServer(r);const a=o.url!=null?{type:"http",url:o.url,env:o.env,enabled:!0}:{type:"stdio",command:o.command,args:o.args,env:o.env,enabled:!0};await this.addMCPServer(r,a)}async toggleMCPServer(r,n){if(!this.mcpManager)throw new Error("MCP manager not initialized");const i=this.mcpManager;n&&i.enableServer?await i.enableServer(r):!n&&i.disableServer&&await i.disableServer(r)}async describeImage(r){var o;if(!this.orchestrator)throw new Error("JivaRunner not initialized. Call initialize() first.");const n=be();if(!((o=n==null?void 0:n.models)!=null&&o.multimodal))throw new Error("No multimodal (vision) model is configured. Enable it in Settings → Models.");return(await this.orchestrator.chat({messages:[{role:"user",content:[{type:"image_url",image_url:{url:r}},{type:"text",text:"Describe this image in detail, including all visible content, text, charts, diagrams, and any notable elements."}]}]})).content}async cleanup(){try{this.agent&&(await this.agent.cleanup(),this.agent=null),this.mcpManager&&(await this.mcpManager.cleanup(),this.mcpManager=null)}catch(r){console.warn("[JivaRunner] Cleanup error:",r)}this.orchestrator=null,this.workspace=null,this.conversationManager=null,this.personaManager=null,this.currentConversationId=null,this.setStatus("stopped")}stop(){this.agent&&this.agent.stop()}setStatus(r,n){this.status=r,this.emit("status-changed",r,{error:n})}}var De=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Xe={},qt={},xe={};xe.fromCallback=function(e){return Object.defineProperty(function(...t){if(typeof t[t.length-1]=="function")e.apply(this,t);else return new Promise((r,n)=>{t.push((i,s)=>i!=null?n(i):r(s)),e.apply(this,t)})},"name",{value:e.name})};xe.fromPromise=function(e){return Object.defineProperty(function(...t){const r=t[t.length-1];if(typeof r!="function")return e.apply(this,t);t.pop(),e.apply(this,t).then(n=>r(null,n),r)},"name",{value:e.name})};var mt=nd,Md=process.cwd,kn=null,jd=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return kn||(kn=Md.call(process)),kn};try{process.cwd()}catch{}if(typeof process.chdir=="function"){var jo=process.chdir;process.chdir=function(e){kn=null,jo.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,jo)}var Bd=Hd;function Hd(e){mt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=n(e.chmod),e.fchmod=n(e.fchmod),e.lchmod=n(e.lchmod),e.chownSync=o(e.chownSync),e.fchownSync=o(e.fchownSync),e.lchownSync=o(e.lchownSync),e.chmodSync=i(e.chmodSync),e.fchmodSync=i(e.fchmodSync),e.lchmodSync=i(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=l(e.statSync),e.fstatSync=l(e.fstatSync),e.lstatSync=l(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(c,f,h){h&&process.nextTick(h)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(c,f,h,p){p&&process.nextTick(p)},e.lchownSync=function(){}),jd==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(c){function f(h,p,w){var y=Date.now(),E=0;c(h,p,function C(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){e.stat(p,function(R,L){R&&R.code==="ENOENT"?c(h,p,C):w(A)})},E),E<100&&(E+=10);return}w&&w(A)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,c),f}(e.rename)),e.read=typeof e.read!="function"?e.read:function(c){function f(h,p,w,y,E,C){var A;if(C&&typeof C=="function"){var R=0;A=function(L,Q,ee){if(L&&L.code==="EAGAIN"&&R<10)return R++,c.call(e,h,p,w,y,E,A);C.apply(this,arguments)}}return c.call(e,h,p,w,y,E,A)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,c),f}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(c){return function(f,h,p,w,y){for(var E=0;;)try{return c.call(e,f,h,p,w,y)}catch(C){if(C.code==="EAGAIN"&&E<10){E++;continue}throw C}}}(e.readSync);function t(c){c.lchmod=function(f,h,p){c.open(f,mt.O_WRONLY|mt.O_SYMLINK,h,function(w,y){if(w){p&&p(w);return}c.fchmod(y,h,function(E){c.close(y,function(C){p&&p(E||C)})})})},c.lchmodSync=function(f,h){var p=c.openSync(f,mt.O_WRONLY|mt.O_SYMLINK,h),w=!0,y;try{y=c.fchmodSync(p,h),w=!1}finally{if(w)try{c.closeSync(p)}catch{}else c.closeSync(p)}return y}}function r(c){mt.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(f,h,p,w){c.open(f,mt.O_SYMLINK,function(y,E){if(y){w&&w(y);return}c.futimes(E,h,p,function(C){c.close(E,function(A){w&&w(C||A)})})})},c.lutimesSync=function(f,h,p){var w=c.openSync(f,mt.O_SYMLINK),y,E=!0;try{y=c.futimesSync(w,h,p),E=!1}finally{if(E)try{c.closeSync(w)}catch{}else c.closeSync(w)}return y}):c.futimes&&(c.lutimes=function(f,h,p,w){w&&process.nextTick(w)},c.lutimesSync=function(){})}function n(c){return c&&function(f,h,p){return c.call(e,f,h,function(w){u(w)&&(w=null),p&&p.apply(this,arguments)})}}function i(c){return c&&function(f,h){try{return c.call(e,f,h)}catch(p){if(!u(p))throw p}}}function s(c){return c&&function(f,h,p,w){return c.call(e,f,h,p,function(y){u(y)&&(y=null),w&&w.apply(this,arguments)})}}function o(c){return c&&function(f,h,p){try{return c.call(e,f,h,p)}catch(w){if(!u(w))throw w}}}function a(c){return c&&function(f,h,p){typeof h=="function"&&(p=h,h=null);function w(y,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),p&&p.apply(this,arguments)}return h?c.call(e,f,h,w):c.call(e,f,w)}}function l(c){return c&&function(f,h){var p=h?c.call(e,f,h):c.call(e,f);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function u(c){if(!c||c.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(c.code==="EINVAL"||c.code==="EPERM"))}}var Bo=Jr.Stream,qd=Gd;function Gd(e){return{ReadStream:t,WriteStream:r};function t(n,i){if(!(this instanceof t))return new t(n,i);Bo.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),a=0,l=o.length;a<l;a++){var u=o[a];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}e.open(this.path,this.flags,this.mode,function(c,f){if(c){s.emit("error",c),s.readable=!1;return}s.fd=f,s.emit("open",f),s._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Bo.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,a=s.length;o<a;o++){var l=s[o];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}var Wd=Vd,zd=Object.getPrototypeOf||function(e){return e.__proto__};function Vd(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:zd(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}var ae=F,Yd=Bd,Jd=qd,Xd=Wd,En=Fs,_e,qn;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_e=Symbol.for("graceful-fs.queue"),qn=Symbol.for("graceful-fs.previous")):(_e="___graceful-fs.queue",qn="___graceful-fs.previous");function Kd(){}function Bl(e,t){Object.defineProperty(e,_e,{get:function(){return t}})}var jt=Kd;En.debuglog?jt=En.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(jt=function(){var e=En.format.apply(En,arguments);e="GFS4: "+e.split(/\n/).join(`
66
+ GFS4: `),console.error(e)});if(!ae[_e]){var Qd=De[_e]||[];Bl(ae,Qd),ae.close=function(e){function t(r,n){return e.call(ae,r,function(i){i||Ho(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(t,qn,{value:e}),t}(ae.close),ae.closeSync=function(e){function t(r){e.apply(ae,arguments),Ho()}return Object.defineProperty(t,qn,{value:e}),t}(ae.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){jt(ae[_e]),Fl.equal(ae[_e].length,0)})}De[_e]||Bl(De,ae[_e]);var Fe=Us(Xd(ae));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ae.__patched&&(Fe=Us(ae),ae.__patched=!0);function Us(e){Yd(e),e.gracefulify=Us,e.createReadStream=Q,e.createWriteStream=ee;var t=e.readFile;e.readFile=r;function r(v,G,q){return typeof G=="function"&&(q=G,G=null),H(v,G,q);function H(X,O,I,x){return t(X,O,function(b){b&&(b.code==="EMFILE"||b.code==="ENFILE")?Jt([H,[X,O,I],b,x||Date.now(),Date.now()]):typeof I=="function"&&I.apply(this,arguments)})}}var n=e.writeFile;e.writeFile=i;function i(v,G,q,H){return typeof q=="function"&&(H=q,q=null),X(v,G,q,H);function X(O,I,x,b,k){return n(O,I,x,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?Jt([X,[O,I,x,b],N,k||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var s=e.appendFile;s&&(e.appendFile=o);function o(v,G,q,H){return typeof q=="function"&&(H=q,q=null),X(v,G,q,H);function X(O,I,x,b,k){return s(O,I,x,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?Jt([X,[O,I,x,b],N,k||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=l);function l(v,G,q,H){return typeof q=="function"&&(H=q,q=0),X(v,G,q,H);function X(O,I,x,b,k){return a(O,I,x,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?Jt([X,[O,I,x,b],N,k||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var u=e.readdir;e.readdir=f;var c=/^v[0-5]\./;function f(v,G,q){typeof G=="function"&&(q=G,G=null);var H=c.test(process.version)?function(I,x,b,k){return u(I,X(I,x,b,k))}:function(I,x,b,k){return u(I,x,X(I,x,b,k))};return H(v,G,q);function X(O,I,x,b){return function(k,N){k&&(k.code==="EMFILE"||k.code==="ENFILE")?Jt([H,[O,I,x],k,b||Date.now(),Date.now()]):(N&&N.sort&&N.sort(),typeof x=="function"&&x.call(this,k,N))}}}if(process.version.substr(0,4)==="v0.8"){var h=Jd(e);C=h.ReadStream,R=h.WriteStream}var p=e.ReadStream;p&&(C.prototype=Object.create(p.prototype),C.prototype.open=A);var w=e.WriteStream;w&&(R.prototype=Object.create(w.prototype),R.prototype.open=L),Object.defineProperty(e,"ReadStream",{get:function(){return C},set:function(v){C=v},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return R},set:function(v){R=v},enumerable:!0,configurable:!0});var y=C;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(v){y=v},enumerable:!0,configurable:!0});var E=R;Object.defineProperty(e,"FileWriteStream",{get:function(){return E},set:function(v){E=v},enumerable:!0,configurable:!0});function C(v,G){return this instanceof C?(p.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function A(){var v=this;ue(v.path,v.flags,v.mode,function(G,q){G?(v.autoClose&&v.destroy(),v.emit("error",G)):(v.fd=q,v.emit("open",q),v.read())})}function R(v,G){return this instanceof R?(w.apply(this,arguments),this):R.apply(Object.create(R.prototype),arguments)}function L(){var v=this;ue(v.path,v.flags,v.mode,function(G,q){G?(v.destroy(),v.emit("error",G)):(v.fd=q,v.emit("open",q))})}function Q(v,G){return new e.ReadStream(v,G)}function ee(v,G){return new e.WriteStream(v,G)}var Y=e.open;e.open=ue;function ue(v,G,q,H){return typeof q=="function"&&(H=q,q=null),X(v,G,q,H);function X(O,I,x,b,k){return Y(O,I,x,function(N,B){N&&(N.code==="EMFILE"||N.code==="ENFILE")?Jt([X,[O,I,x,b],N,k||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}return e}function Jt(e){jt("ENQUEUE",e[0].name,e[1]),ae[_e].push(e),Ms()}var _n;function Ho(){for(var e=Date.now(),t=0;t<ae[_e].length;++t)ae[_e][t].length>2&&(ae[_e][t][3]=e,ae[_e][t][4]=e);Ms()}function Ms(){if(clearTimeout(_n),_n=void 0,ae[_e].length!==0){var e=ae[_e].shift(),t=e[0],r=e[1],n=e[2],i=e[3],s=e[4];if(i===void 0)jt("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-i>=6e4){jt("TIMEOUT",t.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);a>=u?(jt("RETRY",t.name,r),t.apply(null,r.concat([i]))):ae[_e].push(e)}_n===void 0&&(_n=setTimeout(Ms,0))}}(function(e){const t=xe.fromCallback,r=Fe,n=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(i=>typeof r[i]=="function");Object.assign(e,r),n.forEach(i=>{e[i]=t(r[i])}),e.exists=function(i,s){return typeof s=="function"?r.exists(i,s):new Promise(o=>r.exists(i,o))},e.read=function(i,s,o,a,l,u){return typeof u=="function"?r.read(i,s,o,a,l,u):new Promise((c,f)=>{r.read(i,s,o,a,l,(h,p,w)=>{if(h)return f(h);c({bytesRead:p,buffer:w})})})},e.write=function(i,s,...o){return typeof o[o.length-1]=="function"?r.write(i,s,...o):new Promise((a,l)=>{r.write(i,s,...o,(u,c,f)=>{if(u)return l(u);a({bytesWritten:c,buffer:f})})})},typeof r.writev=="function"&&(e.writev=function(i,s,...o){return typeof o[o.length-1]=="function"?r.writev(i,s,...o):new Promise((a,l)=>{r.writev(i,s,...o,(u,c,f)=>{if(u)return l(u);a({bytesWritten:c,buffers:f})})})}),typeof r.realpath.native=="function"?e.realpath.native=t(r.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")})(qt);var js={},Hl={};const Zd=D;Hl.checkPath=function(t){if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(Zd.parse(t).root,""))){const n=new Error(`Path contains invalid characters: ${t}`);throw n.code="EINVAL",n}};const ql=qt,{checkPath:Gl}=Hl,Wl=e=>{const t={mode:511};return typeof e=="number"?e:{...t,...e}.mode};js.makeDir=async(e,t)=>(Gl(e),ql.mkdir(e,{mode:Wl(t),recursive:!0}));js.makeDirSync=(e,t)=>(Gl(e),ql.mkdirSync(e,{mode:Wl(t),recursive:!0}));const eh=xe.fromPromise,{makeDir:th,makeDirSync:Mi}=js,ji=eh(th);var ot={mkdirs:ji,mkdirsSync:Mi,mkdirp:ji,mkdirpSync:Mi,ensureDir:ji,ensureDirSync:Mi};const rh=xe.fromPromise,zl=qt;function nh(e){return zl.access(e).then(()=>!0).catch(()=>!1)}var Gt={pathExists:rh(nh),pathExistsSync:zl.existsSync};const or=Fe;function ih(e,t,r,n){or.open(e,"r+",(i,s)=>{if(i)return n(i);or.futimes(s,t,r,o=>{or.close(s,a=>{n&&n(o||a)})})})}function sh(e,t,r){const n=or.openSync(e,"r+");return or.futimesSync(n,t,r),or.closeSync(n)}var Vl={utimesMillis:ih,utimesMillisSync:sh};const lr=qt,ve=D,oh=Fs;function ah(e,t,r){const n=r.dereference?i=>lr.stat(i,{bigint:!0}):i=>lr.lstat(i,{bigint:!0});return Promise.all([n(e),n(t).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}function lh(e,t,r){let n;const i=r.dereference?o=>lr.statSync(o,{bigint:!0}):o=>lr.lstatSync(o,{bigint:!0}),s=i(e);try{n=i(t)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}function ch(e,t,r,n,i){oh.callbackify(ah)(e,t,n,(s,o)=>{if(s)return i(s);const{srcStat:a,destStat:l}=o;if(l){if(Kr(a,l)){const u=ve.basename(e),c=ve.basename(t);return r==="move"&&u!==c&&u.toLowerCase()===c.toLowerCase()?i(null,{srcStat:a,destStat:l,isChangingCase:!0}):i(new Error("Source and destination must not be the same."))}if(a.isDirectory()&&!l.isDirectory())return i(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!a.isDirectory()&&l.isDirectory())return i(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return a.isDirectory()&&Bs(e,t)?i(new Error(ii(e,t,r))):i(null,{srcStat:a,destStat:l})})}function uh(e,t,r,n){const{srcStat:i,destStat:s}=lh(e,t,n);if(s){if(Kr(i,s)){const o=ve.basename(e),a=ve.basename(t);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(i.isDirectory()&&Bs(e,t))throw new Error(ii(e,t,r));return{srcStat:i,destStat:s}}function Yl(e,t,r,n,i){const s=ve.resolve(ve.dirname(e)),o=ve.resolve(ve.dirname(r));if(o===s||o===ve.parse(o).root)return i();lr.stat(o,{bigint:!0},(a,l)=>a?a.code==="ENOENT"?i():i(a):Kr(t,l)?i(new Error(ii(e,r,n))):Yl(e,t,o,n,i))}function Jl(e,t,r,n){const i=ve.resolve(ve.dirname(e)),s=ve.resolve(ve.dirname(r));if(s===i||s===ve.parse(s).root)return;let o;try{o=lr.statSync(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(Kr(t,o))throw new Error(ii(e,r,n));return Jl(e,t,s,n)}function Kr(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Bs(e,t){const r=ve.resolve(e).split(ve.sep).filter(i=>i),n=ve.resolve(t).split(ve.sep).filter(i=>i);return r.reduce((i,s,o)=>i&&n[o]===s,!0)}function ii(e,t,r){return`Cannot ${r} '${e}' to a subdirectory of itself, '${t}'.`}var dr={checkPaths:ch,checkPathsSync:uh,checkParentPaths:Yl,checkParentPathsSync:Jl,isSrcSubdir:Bs,areIdentical:Kr};const Me=Fe,$r=D,fh=ot.mkdirs,dh=Gt.pathExists,hh=Vl.utimesMillis,xr=dr;function ph(e,t,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
67
+
68
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001"),xr.checkPaths(e,t,"copy",r,(i,s)=>{if(i)return n(i);const{srcStat:o,destStat:a}=s;xr.checkParentPaths(e,o,t,"copy",l=>l?n(l):r.filter?Xl(qo,a,e,t,r,n):qo(a,e,t,r,n))})}function qo(e,t,r,n,i){const s=$r.dirname(r);dh(s,(o,a)=>{if(o)return i(o);if(a)return Gn(e,t,r,n,i);fh(s,l=>l?i(l):Gn(e,t,r,n,i))})}function Xl(e,t,r,n,i,s){Promise.resolve(i.filter(r,n)).then(o=>o?e(t,r,n,i,s):s(),o=>s(o))}function mh(e,t,r,n,i){return n.filter?Xl(Gn,e,t,r,n,i):Gn(e,t,r,n,i)}function Gn(e,t,r,n,i){(n.dereference?Me.stat:Me.lstat)(t,(o,a)=>o?i(o):a.isDirectory()?Sh(a,e,t,r,n,i):a.isFile()||a.isCharacterDevice()||a.isBlockDevice()?gh(a,e,t,r,n,i):a.isSymbolicLink()?Th(e,t,r,n,i):a.isSocket()?i(new Error(`Cannot copy a socket file: ${t}`)):a.isFIFO()?i(new Error(`Cannot copy a FIFO pipe: ${t}`)):i(new Error(`Unknown file: ${t}`)))}function gh(e,t,r,n,i,s){return t?yh(e,r,n,i,s):Kl(e,r,n,i,s)}function yh(e,t,r,n,i){if(n.overwrite)Me.unlink(r,s=>s?i(s):Kl(e,t,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function Kl(e,t,r,n,i){Me.copyFile(t,r,s=>s?i(s):n.preserveTimestamps?vh(e.mode,t,r,i):si(r,e.mode,i))}function vh(e,t,r,n){return wh(e)?Eh(r,e,i=>i?n(i):Go(e,t,r,n)):Go(e,t,r,n)}function wh(e){return(e&128)===0}function Eh(e,t,r){return si(e,t|128,r)}function Go(e,t,r,n){_h(t,r,i=>i?n(i):si(r,e,n))}function si(e,t,r){return Me.chmod(e,t,r)}function _h(e,t,r){Me.stat(e,(n,i)=>n?r(n):hh(t,i.atime,i.mtime,r))}function Sh(e,t,r,n,i,s){return t?Ql(r,n,i,s):Ch(e.mode,r,n,i,s)}function Ch(e,t,r,n,i){Me.mkdir(r,s=>{if(s)return i(s);Ql(t,r,n,o=>o?i(o):si(r,e,i))})}function Ql(e,t,r,n){Me.readdir(e,(i,s)=>i?n(i):Zl(s,e,t,r,n))}function Zl(e,t,r,n,i){const s=e.pop();return s?Ah(e,s,t,r,n,i):i()}function Ah(e,t,r,n,i,s){const o=$r.join(r,t),a=$r.join(n,t);xr.checkPaths(o,a,"copy",i,(l,u)=>{if(l)return s(l);const{destStat:c}=u;mh(c,o,a,i,f=>f?s(f):Zl(e,r,n,i,s))})}function Th(e,t,r,n,i){Me.readlink(t,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=$r.resolve(process.cwd(),o)),e)Me.readlink(r,(a,l)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Me.symlink(o,r,i):i(a):(n.dereference&&(l=$r.resolve(process.cwd(),l)),xr.isSrcSubdir(o,l)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${l}'.`)):e.isDirectory()&&xr.isSrcSubdir(l,o)?i(new Error(`Cannot overwrite '${l}' with '${o}'.`)):bh(o,r,i)));else return Me.symlink(o,r,i)})}function bh(e,t,r){Me.unlink(t,n=>n?r(n):Me.symlink(e,t,r))}var Ih=ph;const Ie=Fe,Fr=D,Ph=ot.mkdirsSync,Oh=Vl.utimesMillisSync,Lr=dr;function Rh(e,t,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
69
+
70
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");const{srcStat:n,destStat:i}=Lr.checkPathsSync(e,t,"copy",r);return Lr.checkParentPathsSync(e,n,t,"copy"),Dh(i,e,t,r)}function Dh(e,t,r,n){if(n.filter&&!n.filter(t,r))return;const i=Fr.dirname(r);return Ie.existsSync(i)||Ph(i),ec(e,t,r,n)}function Nh(e,t,r,n){if(!(n.filter&&!n.filter(t,r)))return ec(e,t,r,n)}function ec(e,t,r,n){const s=(n.dereference?Ie.statSync:Ie.lstatSync)(t);if(s.isDirectory())return Mh(s,e,t,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return $h(s,e,t,r,n);if(s.isSymbolicLink())return Hh(e,t,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${t}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${t}`):new Error(`Unknown file: ${t}`)}function $h(e,t,r,n,i){return t?xh(e,r,n,i):tc(e,r,n,i)}function xh(e,t,r,n){if(n.overwrite)return Ie.unlinkSync(r),tc(e,t,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function tc(e,t,r,n){return Ie.copyFileSync(t,r),n.preserveTimestamps&&Fh(e.mode,t,r),Hs(r,e.mode)}function Fh(e,t,r){return Lh(e)&&kh(r,e),Uh(t,r)}function Lh(e){return(e&128)===0}function kh(e,t){return Hs(e,t|128)}function Hs(e,t){return Ie.chmodSync(e,t)}function Uh(e,t){const r=Ie.statSync(e);return Oh(t,r.atime,r.mtime)}function Mh(e,t,r,n,i){return t?rc(r,n,i):jh(e.mode,r,n,i)}function jh(e,t,r,n){return Ie.mkdirSync(r),rc(t,r,n),Hs(r,e)}function rc(e,t,r){Ie.readdirSync(e).forEach(n=>Bh(n,e,t,r))}function Bh(e,t,r,n){const i=Fr.join(t,e),s=Fr.join(r,e),{destStat:o}=Lr.checkPathsSync(i,s,"copy",n);return Nh(o,i,s,n)}function Hh(e,t,r,n){let i=Ie.readlinkSync(t);if(n.dereference&&(i=Fr.resolve(process.cwd(),i)),e){let s;try{s=Ie.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Ie.symlinkSync(i,r);throw o}if(n.dereference&&(s=Fr.resolve(process.cwd(),s)),Lr.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Ie.statSync(r).isDirectory()&&Lr.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return qh(i,r)}else return Ie.symlinkSync(i,r)}function qh(e,t){return Ie.unlinkSync(t),Ie.symlinkSync(e,t)}var Gh=Rh;const Wh=xe.fromCallback;var qs={copy:Wh(Ih),copySync:Gh};const Wo=Fe,nc=D,te=Fl,kr=process.platform==="win32";function ic(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{e[r]=e[r]||Wo[r],r=r+"Sync",e[r]=e[r]||Wo[r]}),e.maxBusyTries=e.maxBusyTries||3}function Gs(e,t,r){let n=0;typeof t=="function"&&(r=t,t={}),te(e,"rimraf: missing path"),te.strictEqual(typeof e,"string","rimraf: path should be a string"),te.strictEqual(typeof r,"function","rimraf: callback function required"),te(t,"rimraf: invalid options argument provided"),te.strictEqual(typeof t,"object","rimraf: options should be object"),ic(t),zo(e,t,function i(s){if(s){if((s.code==="EBUSY"||s.code==="ENOTEMPTY"||s.code==="EPERM")&&n<t.maxBusyTries){n++;const o=n*100;return setTimeout(()=>zo(e,t,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function zo(e,t,r){te(e),te(t),te(typeof r=="function"),t.lstat(e,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&kr)return Vo(e,t,n,r);if(i&&i.isDirectory())return Un(e,t,n,r);t.unlink(e,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return kr?Vo(e,t,s,r):Un(e,t,s,r);if(s.code==="EISDIR")return Un(e,t,s,r)}return r(s)})})}function Vo(e,t,r,n){te(e),te(t),te(typeof n=="function"),t.chmod(e,438,i=>{i?n(i.code==="ENOENT"?null:r):t.stat(e,(s,o)=>{s?n(s.code==="ENOENT"?null:r):o.isDirectory()?Un(e,t,r,n):t.unlink(e,n)})})}function Yo(e,t,r){let n;te(e),te(t);try{t.chmodSync(e,438)}catch(i){if(i.code==="ENOENT")return;throw r}try{n=t.statSync(e)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?Mn(e,t,r):t.unlinkSync(e)}function Un(e,t,r,n){te(e),te(t),te(typeof n=="function"),t.rmdir(e,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?zh(e,t,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function zh(e,t,r){te(e),te(t),te(typeof r=="function"),t.readdir(e,(n,i)=>{if(n)return r(n);let s=i.length,o;if(s===0)return t.rmdir(e,r);i.forEach(a=>{Gs(nc.join(e,a),t,l=>{if(!o){if(l)return r(o=l);--s===0&&t.rmdir(e,r)}})})})}function sc(e,t){let r;t=t||{},ic(t),te(e,"rimraf: missing path"),te.strictEqual(typeof e,"string","rimraf: path should be a string"),te(t,"rimraf: missing options"),te.strictEqual(typeof t,"object","rimraf: options should be object");try{r=t.lstatSync(e)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&kr&&Yo(e,t,n)}try{r&&r.isDirectory()?Mn(e,t,null):t.unlinkSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return kr?Yo(e,t,n):Mn(e,t,n);if(n.code!=="EISDIR")throw n;Mn(e,t,n)}}function Mn(e,t,r){te(e),te(t);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")Vh(e,t);else if(n.code!=="ENOENT")throw n}}function Vh(e,t){if(te(e),te(t),t.readdirSync(e).forEach(r=>sc(nc.join(e,r),t)),kr){const r=Date.now();do try{return t.rmdirSync(e,t)}catch{}while(Date.now()-r<500)}else return t.rmdirSync(e,t)}var Yh=Gs;Gs.sync=sc;const Wn=Fe,Jh=xe.fromCallback,oc=Yh;function Xh(e,t){if(Wn.rm)return Wn.rm(e,{recursive:!0,force:!0},t);oc(e,t)}function Kh(e){if(Wn.rmSync)return Wn.rmSync(e,{recursive:!0,force:!0});oc.sync(e)}var oi={remove:Jh(Xh),removeSync:Kh};const Qh=xe.fromPromise,ac=qt,lc=D,cc=ot,uc=oi,Jo=Qh(async function(t){let r;try{r=await ac.readdir(t)}catch{return cc.mkdirs(t)}return Promise.all(r.map(n=>uc.remove(lc.join(t,n))))});function Xo(e){let t;try{t=ac.readdirSync(e)}catch{return cc.mkdirsSync(e)}t.forEach(r=>{r=lc.join(e,r),uc.removeSync(r)})}var Zh={emptyDirSync:Xo,emptydirSync:Xo,emptyDir:Jo,emptydir:Jo};const ep=xe.fromCallback,fc=D,vt=Fe,dc=ot;function tp(e,t){function r(){vt.writeFile(e,"",n=>{if(n)return t(n);t()})}vt.stat(e,(n,i)=>{if(!n&&i.isFile())return t();const s=fc.dirname(e);vt.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?dc.mkdirs(s,l=>{if(l)return t(l);r()}):t(o);a.isDirectory()?r():vt.readdir(s,l=>{if(l)return t(l)})})})}function rp(e){let t;try{t=vt.statSync(e)}catch{}if(t&&t.isFile())return;const r=fc.dirname(e);try{vt.statSync(r).isDirectory()||vt.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")dc.mkdirsSync(r);else throw n}vt.writeFileSync(e,"")}var np={createFile:ep(tp),createFileSync:rp};const ip=xe.fromCallback,hc=D,yt=Fe,pc=ot,sp=Gt.pathExists,{areIdentical:mc}=dr;function op(e,t,r){function n(i,s){yt.link(i,s,o=>{if(o)return r(o);r(null)})}yt.lstat(t,(i,s)=>{yt.lstat(e,(o,a)=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);if(s&&mc(a,s))return r(null);const l=hc.dirname(t);sp(l,(u,c)=>{if(u)return r(u);if(c)return n(e,t);pc.mkdirs(l,f=>{if(f)return r(f);n(e,t)})})})})}function ap(e,t){let r;try{r=yt.lstatSync(t)}catch{}try{const s=yt.lstatSync(e);if(r&&mc(s,r))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}const n=hc.dirname(t);return yt.existsSync(n)||pc.mkdirsSync(n),yt.linkSync(e,t)}var lp={createLink:ip(op),createLinkSync:ap};const wt=D,Pr=Fe,cp=Gt.pathExists;function up(e,t,r){if(wt.isAbsolute(e))return Pr.lstat(e,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:e,toDst:e}));{const n=wt.dirname(t),i=wt.join(n,e);return cp(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:e}):Pr.lstat(e,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:e,toDst:wt.relative(n,e)})))}}function fp(e,t){let r;if(wt.isAbsolute(e)){if(r=Pr.existsSync(e),!r)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{const n=wt.dirname(t),i=wt.join(n,e);if(r=Pr.existsSync(i),r)return{toCwd:i,toDst:e};if(r=Pr.existsSync(e),!r)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:wt.relative(n,e)}}}var dp={symlinkPaths:up,symlinkPathsSync:fp};const gc=Fe;function hp(e,t,r){if(r=typeof t=="function"?t:r,t=typeof t=="function"?!1:t,t)return r(null,t);gc.lstat(e,(n,i)=>{if(n)return r(null,"file");t=i&&i.isDirectory()?"dir":"file",r(null,t)})}function pp(e,t){let r;if(t)return t;try{r=gc.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}var mp={symlinkType:hp,symlinkTypeSync:pp};const gp=xe.fromCallback,yc=D,Ke=qt,vc=ot,yp=vc.mkdirs,vp=vc.mkdirsSync,wc=dp,wp=wc.symlinkPaths,Ep=wc.symlinkPathsSync,Ec=mp,_p=Ec.symlinkType,Sp=Ec.symlinkTypeSync,Cp=Gt.pathExists,{areIdentical:_c}=dr;function Ap(e,t,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,Ke.lstat(t,(i,s)=>{!i&&s.isSymbolicLink()?Promise.all([Ke.stat(e),Ke.stat(t)]).then(([o,a])=>{if(_c(o,a))return n(null);Ko(e,t,r,n)}):Ko(e,t,r,n)})}function Ko(e,t,r,n){wp(e,t,(i,s)=>{if(i)return n(i);e=s.toDst,_p(s.toCwd,r,(o,a)=>{if(o)return n(o);const l=yc.dirname(t);Cp(l,(u,c)=>{if(u)return n(u);if(c)return Ke.symlink(e,t,a,n);yp(l,f=>{if(f)return n(f);Ke.symlink(e,t,a,n)})})})})}function Tp(e,t,r){let n;try{n=Ke.lstatSync(t)}catch{}if(n&&n.isSymbolicLink()){const a=Ke.statSync(e),l=Ke.statSync(t);if(_c(a,l))return}const i=Ep(e,t);e=i.toDst,r=Sp(i.toCwd,r);const s=yc.dirname(t);return Ke.existsSync(s)||vp(s),Ke.symlinkSync(e,t,r)}var bp={createSymlink:gp(Ap),createSymlinkSync:Tp};const{createFile:Qo,createFileSync:Zo}=np,{createLink:ea,createLinkSync:ta}=lp,{createSymlink:ra,createSymlinkSync:na}=bp;var Ip={createFile:Qo,createFileSync:Zo,ensureFile:Qo,ensureFileSync:Zo,createLink:ea,createLinkSync:ta,ensureLink:ea,ensureLinkSync:ta,createSymlink:ra,createSymlinkSync:na,ensureSymlink:ra,ensureSymlinkSync:na};function Pp(e,{EOL:t=`
71
+ `,finalEOL:r=!0,replacer:n=null,spaces:i}={}){const s=r?t:"",o=JSON.stringify(e,n,i);if(o===void 0)throw new TypeError(`Converting ${typeof e} value to JSON is not supported`);return o.replace(/\n/g,t)+s}function Op(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}var Ws={stringify:Pp,stripBom:Op};let cr;try{cr=Fe}catch{cr=F}const ai=xe,{stringify:Sc,stripBom:Cc}=Ws;async function Rp(e,t={}){typeof t=="string"&&(t={encoding:t});const r=t.fs||cr,n="throws"in t?t.throws:!0;let i=await ai.fromCallback(r.readFile)(e,t);i=Cc(i);let s;try{s=JSON.parse(i,t?t.reviver:null)}catch(o){if(n)throw o.message=`${e}: ${o.message}`,o;return null}return s}const Dp=ai.fromPromise(Rp);function Np(e,t={}){typeof t=="string"&&(t={encoding:t});const r=t.fs||cr,n="throws"in t?t.throws:!0;try{let i=r.readFileSync(e,t);return i=Cc(i),JSON.parse(i,t.reviver)}catch(i){if(n)throw i.message=`${e}: ${i.message}`,i;return null}}async function $p(e,t,r={}){const n=r.fs||cr,i=Sc(t,r);await ai.fromCallback(n.writeFile)(e,i,r)}const xp=ai.fromPromise($p);function Fp(e,t,r={}){const n=r.fs||cr,i=Sc(t,r);return n.writeFileSync(e,i,r)}var Lp={readFile:Dp,readFileSync:Np,writeFile:xp,writeFileSync:Fp};const Sn=Lp;var kp={readJson:Sn.readFile,readJsonSync:Sn.readFileSync,writeJson:Sn.writeFile,writeJsonSync:Sn.writeFileSync};const Up=xe.fromCallback,Or=Fe,Ac=D,Tc=ot,Mp=Gt.pathExists;function jp(e,t,r,n){typeof r=="function"&&(n=r,r="utf8");const i=Ac.dirname(e);Mp(i,(s,o)=>{if(s)return n(s);if(o)return Or.writeFile(e,t,r,n);Tc.mkdirs(i,a=>{if(a)return n(a);Or.writeFile(e,t,r,n)})})}function Bp(e,...t){const r=Ac.dirname(e);if(Or.existsSync(r))return Or.writeFileSync(e,...t);Tc.mkdirsSync(r),Or.writeFileSync(e,...t)}var zs={outputFile:Up(jp),outputFileSync:Bp};const{stringify:Hp}=Ws,{outputFile:qp}=zs;async function Gp(e,t,r={}){const n=Hp(t,r);await qp(e,n,r)}var Wp=Gp;const{stringify:zp}=Ws,{outputFileSync:Vp}=zs;function Yp(e,t,r){const n=zp(t,r);Vp(e,n,r)}var Jp=Yp;const Xp=xe.fromPromise,$e=kp;$e.outputJson=Xp(Wp);$e.outputJsonSync=Jp;$e.outputJSON=$e.outputJson;$e.outputJSONSync=$e.outputJsonSync;$e.writeJSON=$e.writeJson;$e.writeJSONSync=$e.writeJsonSync;$e.readJSON=$e.readJson;$e.readJSONSync=$e.readJsonSync;var Kp=$e;const Qp=Fe,ws=D,Zp=qs.copy,bc=oi.remove,em=ot.mkdirp,tm=Gt.pathExists,ia=dr;function rm(e,t,r,n){typeof r=="function"&&(n=r,r={}),r=r||{};const i=r.overwrite||r.clobber||!1;ia.checkPaths(e,t,"move",r,(s,o)=>{if(s)return n(s);const{srcStat:a,isChangingCase:l=!1}=o;ia.checkParentPaths(e,a,t,"move",u=>{if(u)return n(u);if(nm(t))return sa(e,t,i,l,n);em(ws.dirname(t),c=>c?n(c):sa(e,t,i,l,n))})})}function nm(e){const t=ws.dirname(e);return ws.parse(t).root===t}function sa(e,t,r,n,i){if(n)return Bi(e,t,r,i);if(r)return bc(t,s=>s?i(s):Bi(e,t,r,i));tm(t,(s,o)=>s?i(s):o?i(new Error("dest already exists.")):Bi(e,t,r,i))}function Bi(e,t,r,n){Qp.rename(e,t,i=>i?i.code!=="EXDEV"?n(i):im(e,t,r,n):n())}function im(e,t,r,n){Zp(e,t,{overwrite:r,errorOnExist:!0},s=>s?n(s):bc(e,n))}var sm=rm;const Ic=Fe,Es=D,om=qs.copySync,Pc=oi.removeSync,am=ot.mkdirpSync,oa=dr;function lm(e,t,r){r=r||{};const n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=oa.checkPathsSync(e,t,"move",r);return oa.checkParentPathsSync(e,i,t,"move"),cm(t)||am(Es.dirname(t)),um(e,t,n,s)}function cm(e){const t=Es.dirname(e);return Es.parse(t).root===t}function um(e,t,r,n){if(n)return Hi(e,t,r);if(r)return Pc(t),Hi(e,t,r);if(Ic.existsSync(t))throw new Error("dest already exists.");return Hi(e,t,r)}function Hi(e,t,r){try{Ic.renameSync(e,t)}catch(n){if(n.code!=="EXDEV")throw n;return fm(e,t,r)}}function fm(e,t,r){return om(e,t,{overwrite:r,errorOnExist:!0}),Pc(e)}var dm=lm;const hm=xe.fromCallback;var pm={move:hm(sm),moveSync:dm},bt={...qt,...qs,...Zh,...Ip,...Kp,...ot,...pm,...zs,...Gt,...oi},Wt={},_t={},me={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.CancellationError=St.CancellationToken=void 0;const mm=ni;class gm extends mm.EventEmitter{get cancelled(){return this._cancelled||this._parent!=null&&this._parent.cancelled}set parent(t){this.removeParentCancelHandler(),this._parent=t,this.parentCancelHandler=()=>this.cancel(),this._parent.onCancel(this.parentCancelHandler)}constructor(t){super(),this.parentCancelHandler=null,this._parent=null,this._cancelled=!1,t!=null&&(this.parent=t)}cancel(){this._cancelled=!0,this.emit("cancel")}onCancel(t){this.cancelled?t():this.once("cancel",t)}createPromise(t){if(this.cancelled)return Promise.reject(new _s);const r=()=>{if(n!=null)try{this.removeListener("cancel",n),n=null}catch{}};let n=null;return new Promise((i,s)=>{let o=null;if(n=()=>{try{o!=null&&(o(),o=null)}finally{s(new _s)}},this.cancelled){n();return}this.onCancel(n),t(i,s,a=>{o=a})}).then(i=>(r(),i)).catch(i=>{throw r(),i})}removeParentCancelHandler(){const t=this._parent;t!=null&&this.parentCancelHandler!=null&&(t.removeListener("cancel",this.parentCancelHandler),this.parentCancelHandler=null)}dispose(){try{this.removeParentCancelHandler()}finally{this.removeAllListeners(),this._parent=null}}}St.CancellationToken=gm;class _s extends Error{constructor(){super("cancelled")}}St.CancellationError=_s;var hr={};Object.defineProperty(hr,"__esModule",{value:!0});hr.newError=ym;function ym(e,t){const r=new Error(e);return r.code=t,r}var Ne={},Ss={exports:{}},Cn={exports:{}},qi,aa;function vm(){if(aa)return qi;aa=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,s=n*365.25;qi=function(c,f){f=f||{};var h=typeof c;if(h==="string"&&c.length>0)return o(c);if(h==="number"&&isFinite(c))return f.long?l(c):a(c);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(c))};function o(c){if(c=String(c),!(c.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(c);if(f){var h=parseFloat(f[1]),p=(f[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return h*s;case"weeks":case"week":case"w":return h*i;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*r;case"minutes":case"minute":case"mins":case"min":case"m":return h*t;case"seconds":case"second":case"secs":case"sec":case"s":return h*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function a(c){var f=Math.abs(c);return f>=n?Math.round(c/n)+"d":f>=r?Math.round(c/r)+"h":f>=t?Math.round(c/t)+"m":f>=e?Math.round(c/e)+"s":c+"ms"}function l(c){var f=Math.abs(c);return f>=n?u(c,f,n,"day"):f>=r?u(c,f,r,"hour"):f>=t?u(c,f,t,"minute"):f>=e?u(c,f,e,"second"):c+" ms"}function u(c,f,h,p){var w=f>=h*1.5;return Math.round(c/h)+" "+p+(w?"s":"")}return qi}var Gi,la;function Oc(){if(la)return Gi;la=1;function e(t){n.debug=n,n.default=n,n.coerce=u,n.disable=a,n.enable=s,n.enabled=l,n.humanize=vm(),n.destroy=c,Object.keys(t).forEach(f=>{n[f]=t[f]}),n.names=[],n.skips=[],n.formatters={};function r(f){let h=0;for(let p=0;p<f.length;p++)h=(h<<5)-h+f.charCodeAt(p),h|=0;return n.colors[Math.abs(h)%n.colors.length]}n.selectColor=r;function n(f){let h,p=null,w,y;function E(...C){if(!E.enabled)return;const A=E,R=Number(new Date),L=R-(h||R);A.diff=L,A.prev=h,A.curr=R,h=R,C[0]=n.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let Q=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(Y,ue)=>{if(Y==="%%")return"%";Q++;const v=n.formatters[ue];if(typeof v=="function"){const G=C[Q];Y=v.call(A,G),C.splice(Q,1),Q--}return Y}),n.formatArgs.call(A,C),(A.log||n.log).apply(A,C)}return E.namespace=f,E.useColors=n.useColors(),E.color=n.selectColor(f),E.extend=i,E.destroy=n.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(w!==n.namespaces&&(w=n.namespaces,y=n.enabled(f)),y),set:C=>{p=C}}),typeof n.init=="function"&&n.init(E),E}function i(f,h){const p=n(this.namespace+(typeof h>"u"?":":h)+f);return p.log=this.log,p}function s(f){n.save(f),n.namespaces=f,n.names=[],n.skips=[];const h=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of h)p[0]==="-"?n.skips.push(p.slice(1)):n.names.push(p)}function o(f,h){let p=0,w=0,y=-1,E=0;for(;p<f.length;)if(w<h.length&&(h[w]===f[p]||h[w]==="*"))h[w]==="*"?(y=w,E=p,w++):(p++,w++);else if(y!==-1)w=y+1,E++,p=E;else return!1;for(;w<h.length&&h[w]==="*";)w++;return w===h.length}function a(){const f=[...n.names,...n.skips.map(h=>"-"+h)].join(",");return n.enable(""),f}function l(f){for(const h of n.skips)if(o(f,h))return!1;for(const h of n.names)if(o(f,h))return!0;return!1}function u(f){return f instanceof Error?f.stack||f.message:f}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return Gi=e,Gi}var ca;function wm(){return ca||(ca=1,function(e,t){t.formatArgs=n,t.save=i,t.load=s,t.useColors=r,t.storage=o(),t.destroy=(()=>{let l=!1;return()=>{l||(l=!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"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let c=0,f=0;l[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(c++,h==="%c"&&(f=c))}),l.splice(f,0,u)}t.log=console.debug||console.log||(()=>{});function i(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function s(){let l;try{l=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l}function o(){try{return localStorage}catch{}}e.exports=Oc()(t);const{formatters:a}=e.exports;a.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(Cn,Cn.exports)),Cn.exports}var An={exports:{}},Wi,ua;function Em(){return ua||(ua=1,Wi=(e,t=process.argv)=>{const r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}),Wi}var zi,fa;function _m(){if(fa)return zi;fa=1;const e=ne,t=Ll,r=Em(),{env:n}=process;let i;r("no-color")||r("no-colors")||r("color=false")||r("color=never")?i=0:(r("color")||r("colors")||r("color=true")||r("color=always"))&&(i=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?i=1:n.FORCE_COLOR==="false"?i=0:i=n.FORCE_COLOR.length===0?1:Math.min(parseInt(n.FORCE_COLOR,10),3));function s(l){return l===0?!1:{level:l,hasBasic:!0,has256:l>=2,has16m:l>=3}}function o(l,u){if(i===0)return 0;if(r("color=16m")||r("color=full")||r("color=truecolor"))return 3;if(r("color=256"))return 2;if(l&&!u&&i===void 0)return 0;const c=i||0;if(n.TERM==="dumb")return c;if(process.platform==="win32"){const f=e.release().split(".");return Number(f[0])>=10&&Number(f[2])>=10586?Number(f[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(f=>f in n)||n.CI_NAME==="codeship"?1:c;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if(n.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in n){const f=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return f>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:c}function a(l){const u=o(l,l&&l.isTTY);return s(u)}return zi={supportsColor:a,stdout:s(o(!0,t.isatty(1))),stderr:s(o(!0,t.isatty(2)))},zi}var da;function Sm(){return da||(da=1,function(e,t){const r=Ll,n=Fs;t.init=c,t.log=a,t.formatArgs=s,t.save=l,t.load=u,t.useColors=i,t.destroy=n.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{const h=_m();h&&(h.stderr||h).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{}t.inspectOpts=Object.keys(process.env).filter(h=>/^debug_/i.test(h)).reduce((h,p)=>{const w=p.substring(6).toLowerCase().replace(/_([a-z])/g,(E,C)=>C.toUpperCase());let y=process.env[p];return/^(yes|on|true|enabled)$/i.test(y)?y=!0:/^(no|off|false|disabled)$/i.test(y)?y=!1:y==="null"?y=null:y=Number(y),h[w]=y,h},{});function i(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)}function s(h){const{namespace:p,useColors:w}=this;if(w){const y=this.color,E="\x1B[3"+(y<8?y:"8;5;"+y),C=` ${E};1m${p} \x1B[0m`;h[0]=C+h[0].split(`
72
+ `).join(`
73
+ `+C),h.push(E+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else h[0]=o()+p+" "+h[0]}function o(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function a(...h){return process.stderr.write(n.formatWithOptions(t.inspectOpts,...h)+`
74
+ `)}function l(h){h?process.env.DEBUG=h:delete process.env.DEBUG}function u(){return process.env.DEBUG}function c(h){h.inspectOpts={};const p=Object.keys(t.inspectOpts);for(let w=0;w<p.length;w++)h.inspectOpts[p[w]]=t.inspectOpts[p[w]]}e.exports=Oc()(t);const{formatters:f}=e.exports;f.o=function(h){return this.inspectOpts.colors=this.useColors,n.inspect(h,this.inspectOpts).split(`
75
+ `).map(p=>p.trim()).join(" ")},f.O=function(h){return this.inspectOpts.colors=this.useColors,n.inspect(h,this.inspectOpts)}}(An,An.exports)),An.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ss.exports=wm():Ss.exports=Sm();var Cm=Ss.exports,Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.ProgressCallbackTransform=void 0;const Am=Jr;class Tm extends Am.Transform{constructor(t,r,n){super(),this.total=t,this.cancellationToken=r,this.onProgress=n,this.start=Date.now(),this.transferred=0,this.delta=0,this.nextUpdate=this.start+1e3}_transform(t,r,n){if(this.cancellationToken.cancelled){n(new Error("cancelled"),null);return}this.transferred+=t.length,this.delta+=t.length;const i=Date.now();i>=this.nextUpdate&&this.transferred!==this.total&&(this.nextUpdate=i+1e3,this.onProgress({total:this.total,delta:this.delta,transferred:this.transferred,percent:this.transferred/this.total*100,bytesPerSecond:Math.round(this.transferred/((i-this.start)/1e3))}),this.delta=0),n(null,t)}_flush(t){if(this.cancellationToken.cancelled){t(new Error("cancelled"));return}this.onProgress({total:this.total,delta:this.delta,transferred:this.total,percent:100,bytesPerSecond:Math.round(this.transferred/((Date.now()-this.start)/1e3))}),this.delta=0,t(null)}}Qr.ProgressCallbackTransform=Tm;Object.defineProperty(Ne,"__esModule",{value:!0});Ne.DigestTransform=Ne.HttpExecutor=Ne.HttpError=void 0;Ne.createHttpError=As;Ne.parseJson=$m;Ne.configureRequestOptionsFromUrl=Dc;Ne.configureRequestUrl=Ys;Ne.safeGetHeader=ar;Ne.configureRequestOptions=zn;Ne.safeStringifyJson=Vn;const bm=Xr,Im=Cm,Pm=F,Om=Jr,Cs=We,Rm=St,ha=hr,Dm=Qr,xt=(0,Im.default)("electron-builder");function As(e,t=null){return new Vs(e.statusCode||-1,`${e.statusCode} ${e.statusMessage}`+(t==null?"":`
76
+ `+JSON.stringify(t,null," "))+`
77
+ Headers: `+Vn(e.headers),t)}const Nm=new Map([[429,"Too many requests"],[400,"Bad request"],[403,"Forbidden"],[404,"Not found"],[405,"Method not allowed"],[406,"Not acceptable"],[408,"Request timeout"],[413,"Request entity too large"],[500,"Internal server error"],[502,"Bad gateway"],[503,"Service unavailable"],[504,"Gateway timeout"],[505,"HTTP version not supported"]]);class Vs extends Error{constructor(t,r=`HTTP error: ${Nm.get(t)||t}`,n=null){super(r),this.statusCode=t,this.description=n,this.name="HttpError",this.code=`HTTP_ERROR_${t}`}isServerError(){return this.statusCode>=500&&this.statusCode<=599}}Ne.HttpError=Vs;function $m(e){return e.then(t=>t==null||t.length===0?null:JSON.parse(t))}class tr{constructor(){this.maxRedirects=10}request(t,r=new Rm.CancellationToken,n){zn(t);const i=n==null?void 0:JSON.stringify(n),s=i?Buffer.from(i):void 0;if(s!=null){xt(i);const{headers:o,...a}=t;t={method:"post",headers:{"Content-Type":"application/json","Content-Length":s.length,...o},...a}}return this.doApiRequest(t,r,o=>o.end(s))}doApiRequest(t,r,n,i=0){return xt.enabled&&xt(`Request: ${Vn(t)}`),r.createPromise((s,o,a)=>{const l=this.createRequest(t,u=>{try{this.handleResponse(u,t,r,s,o,i,n)}catch(c){o(c)}});this.addErrorAndTimeoutHandlers(l,o,t.timeout),this.addRedirectHandlers(l,t,o,i,u=>{this.doApiRequest(u,r,n,i).then(s).catch(o)}),n(l,o),a(()=>l.abort())})}addRedirectHandlers(t,r,n,i,s){}addErrorAndTimeoutHandlers(t,r,n=60*1e3){this.addTimeOutHandler(t,r,n),t.on("error",r),t.on("aborted",()=>{r(new Error("Request has been aborted by the server"))})}handleResponse(t,r,n,i,s,o,a){var l;if(xt.enabled&&xt(`Response: ${t.statusCode} ${t.statusMessage}, request options: ${Vn(r)}`),t.statusCode===404){s(As(t,`method: ${r.method||"GET"} url: ${r.protocol||"https:"}//${r.hostname}${r.port?`:${r.port}`:""}${r.path}
78
+
79
+ Please double check that your authentication token is correct. Due to security reasons, actual status maybe not reported, but 404.
80
+ `));return}else if(t.statusCode===204){i();return}const u=(l=t.statusCode)!==null&&l!==void 0?l:0,c=u>=300&&u<400,f=ar(t,"location");if(c&&f!=null){if(o>this.maxRedirects){s(this.createMaxRedirectError());return}this.doApiRequest(tr.prepareRedirectUrlOptions(f,r),n,a,o).then(i).catch(s);return}t.setEncoding("utf8");let h="";t.on("error",s),t.on("data",p=>h+=p),t.on("end",()=>{try{if(t.statusCode!=null&&t.statusCode>=400){const p=ar(t,"content-type"),w=p!=null&&(Array.isArray(p)?p.find(y=>y.includes("json"))!=null:p.includes("json"));s(As(t,`method: ${r.method||"GET"} url: ${r.protocol||"https:"}//${r.hostname}${r.port?`:${r.port}`:""}${r.path}
81
+
82
+ Data:
83
+ ${w?JSON.stringify(JSON.parse(h)):h}
84
+ `))}else i(h.length===0?null:h)}catch(p){s(p)}})}async downloadToBuffer(t,r){return await r.cancellationToken.createPromise((n,i,s)=>{const o=[],a={headers:r.headers||void 0,redirect:"manual"};Ys(t,a),zn(a),this.doDownload(a,{destination:null,options:r,onCancel:s,callback:l=>{l==null?n(Buffer.concat(o)):i(l)},responseHandler:(l,u)=>{let c=0;l.on("data",f=>{if(c+=f.length,c>524288e3){u(new Error("Maximum allowed size is 500 MB"));return}o.push(f)}),l.on("end",()=>{u(null)})}},0)})}doDownload(t,r,n){const i=this.createRequest(t,s=>{if(s.statusCode>=400){r.callback(new Error(`Cannot download "${t.protocol||"https:"}//${t.hostname}${t.path}", status ${s.statusCode}: ${s.statusMessage}`));return}s.on("error",r.callback);const o=ar(s,"location");if(o!=null){n<this.maxRedirects?this.doDownload(tr.prepareRedirectUrlOptions(o,t),r,n++):r.callback(this.createMaxRedirectError());return}r.responseHandler==null?Fm(r,s):r.responseHandler(s,r.callback)});this.addErrorAndTimeoutHandlers(i,r.callback,t.timeout),this.addRedirectHandlers(i,t,r.callback,n,s=>{this.doDownload(s,r,n++)}),i.end()}createMaxRedirectError(){return new Error(`Too many redirects (> ${this.maxRedirects})`)}addTimeOutHandler(t,r,n){t.on("socket",i=>{i.setTimeout(n,()=>{t.abort(),r(new Error("Request timed out"))})})}static prepareRedirectUrlOptions(t,r){const n=Dc(t,{...r}),i=n.headers;if(i!=null&&i.authorization){const s=tr.reconstructOriginalUrl(r),o=Rc(t,r);tr.isCrossOriginRedirect(s,o)&&(xt.enabled&&xt(`Given the cross-origin redirect (from ${s.host} to ${o.host}), the Authorization header will be stripped out.`),delete i.authorization)}return n}static reconstructOriginalUrl(t){const r=t.protocol||"https:";if(!t.hostname)throw new Error("Missing hostname in request options");const n=t.hostname,i=t.port?`:${t.port}`:"",s=t.path||"/";return new Cs.URL(`${r}//${n}${i}${s}`)}static isCrossOriginRedirect(t,r){if(t.hostname.toLowerCase()!==r.hostname.toLowerCase())return!0;if(t.protocol==="http:"&&["80",""].includes(t.port)&&r.protocol==="https:"&&["443",""].includes(r.port))return!1;if(t.protocol!==r.protocol)return!0;const n=t.port,i=r.port;return n!==i}static retryOnServerError(t,r=3){for(let n=0;;n++)try{return t()}catch(i){if(n<r&&(i instanceof Vs&&i.isServerError()||i.code==="EPIPE"))continue;throw i}}}Ne.HttpExecutor=tr;function Rc(e,t){try{return new Cs.URL(e)}catch{const r=t.hostname,n=t.protocol||"https:",i=t.port?`:${t.port}`:"",s=`${n}//${r}${i}`;return new Cs.URL(e,s)}}function Dc(e,t){const r=zn(t),n=Rc(e,t);return Ys(n,r),r}function Ys(e,t){t.protocol=e.protocol,t.hostname=e.hostname,e.port?t.port=e.port:t.port&&delete t.port,t.path=e.pathname+e.search}class Ts extends Om.Transform{get actual(){return this._actual}constructor(t,r="sha512",n="base64"){super(),this.expected=t,this.algorithm=r,this.encoding=n,this._actual=null,this.isValidateOnEnd=!0,this.digester=(0,bm.createHash)(r)}_transform(t,r,n){this.digester.update(t),n(null,t)}_flush(t){if(this._actual=this.digester.digest(this.encoding),this.isValidateOnEnd)try{this.validate()}catch(r){t(r);return}t(null)}validate(){if(this._actual==null)throw(0,ha.newError)("Not finished yet","ERR_STREAM_NOT_FINISHED");if(this._actual!==this.expected)throw(0,ha.newError)(`${this.algorithm} checksum mismatch, expected ${this.expected}, got ${this._actual}`,"ERR_CHECKSUM_MISMATCH");return null}}Ne.DigestTransform=Ts;function xm(e,t,r){return e!=null&&t!=null&&e!==t?(r(new Error(`checksum mismatch: expected ${t} but got ${e} (X-Checksum-Sha2 header)`)),!1):!0}function ar(e,t){const r=e.headers[t];return r==null?null:Array.isArray(r)?r.length===0?null:r[r.length-1]:r}function Fm(e,t){if(!xm(ar(t,"X-Checksum-Sha2"),e.options.sha2,e.callback))return;const r=[];if(e.options.onProgress!=null){const o=ar(t,"content-length");o!=null&&r.push(new Dm.ProgressCallbackTransform(parseInt(o,10),e.options.cancellationToken,e.options.onProgress))}const n=e.options.sha512;n!=null?r.push(new Ts(n,"sha512",n.length===128&&!n.includes("+")&&!n.includes("Z")&&!n.includes("=")?"hex":"base64")):e.options.sha2!=null&&r.push(new Ts(e.options.sha2,"sha256","hex"));const i=(0,Pm.createWriteStream)(e.destination);r.push(i);let s=t;for(const o of r)o.on("error",a=>{i.close(),e.options.cancellationToken.cancelled||e.callback(a)}),s=s.pipe(o);i.on("finish",()=>{i.close(e.callback)})}function zn(e,t,r){r!=null&&(e.method=r),e.headers={...e.headers};const n=e.headers;return t!=null&&(n.authorization=t.startsWith("Basic")||t.startsWith("Bearer")?t:`token ${t}`),n["User-Agent"]==null&&(n["User-Agent"]="electron-builder"),(r==null||r==="GET"||n["Cache-Control"]==null)&&(n["Cache-Control"]="no-cache"),e.protocol==null&&process.versions.electron!=null&&(e.protocol="https:"),e}function Vn(e,t){return JSON.stringify(e,(r,n)=>r.endsWith("Authorization")||r.endsWith("authorization")||r.endsWith("Password")||r.endsWith("PASSWORD")||r.endsWith("Token")||r.includes("password")||r.includes("token")||t!=null&&t.has(r)?"<stripped sensitive data>":n,2)}var li={};Object.defineProperty(li,"__esModule",{value:!0});li.MemoLazy=void 0;class Lm{constructor(t,r){this.selector=t,this.creator=r,this.selected=void 0,this._value=void 0}get hasValue(){return this._value!==void 0}get value(){const t=this.selector();if(this._value!==void 0&&Nc(this.selected,t))return this._value;this.selected=t;const r=this.creator(t);return this.value=r,r}set value(t){this._value=t}}li.MemoLazy=Lm;function Nc(e,t){if(typeof e=="object"&&e!==null&&(typeof t=="object"&&t!==null)){const i=Object.keys(e),s=Object.keys(t);return i.length===s.length&&i.every(o=>Nc(e[o],t[o]))}return e===t}var Zr={};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.githubUrl=km;Zr.githubTagPrefix=Um;Zr.getS3LikeProviderBaseUrl=Mm;function km(e,t="github.com"){return`${e.protocol||"https"}://${e.host||t}`}function Um(e){var t;return e.tagNamePrefix?e.tagNamePrefix:!((t=e.vPrefixedTagName)!==null&&t!==void 0)||t?"v":""}function Mm(e){const t=e.provider;if(t==="s3")return jm(e);if(t==="spaces")return Bm(e);throw new Error(`Not supported provider: ${t}`)}function jm(e){let t;if(e.accelerate==!0)t=`https://${e.bucket}.s3-accelerate.amazonaws.com`;else if(e.endpoint!=null)t=`${e.endpoint}/${e.bucket}`;else if(e.bucket.includes(".")){if(e.region==null)throw new Error(`Bucket name "${e.bucket}" includes a dot, but S3 region is missing`);e.region==="us-east-1"?t=`https://s3.amazonaws.com/${e.bucket}`:t=`https://s3-${e.region}.amazonaws.com/${e.bucket}`}else e.region==="cn-north-1"?t=`https://${e.bucket}.s3.${e.region}.amazonaws.com.cn`:t=`https://${e.bucket}.s3.amazonaws.com`;return $c(t,e.path)}function $c(e,t){return t!=null&&t.length>0&&(t.startsWith("/")||(e+="/"),e+=t),e}function Bm(e){if(e.name==null)throw new Error("name is missing");if(e.region==null)throw new Error("region is missing");return $c(`https://${e.name}.${e.region}.digitaloceanspaces.com`,e.path)}var Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.retry=xc;const Hm=St;async function xc(e,t){var r;const{retries:n,interval:i,backoff:s=0,attempt:o=0,shouldRetry:a,cancellationToken:l=new Hm.CancellationToken}=t;try{return await e()}catch(u){if(await Promise.resolve((r=a==null?void 0:a(u))!==null&&r!==void 0?r:!0)&&n>0&&!l.cancelled)return await new Promise(c=>setTimeout(c,i+s*o)),await xc(e,{...t,retries:n-1,attempt:o+1});throw u}}var Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.parseDn=qm;function qm(e){let t=!1,r=null,n="",i=0;e=e.trim();const s=new Map;for(let o=0;o<=e.length;o++){if(o===e.length){r!==null&&s.set(r,n);break}const a=e[o];if(t){if(a==='"'){t=!1;continue}}else{if(a==='"'){t=!0;continue}if(a==="\\"){o++;const l=parseInt(e.slice(o,o+2),16);Number.isNaN(l)?n+=e[o]:(o++,n+=String.fromCharCode(l));continue}if(r===null&&a==="="){r=n,n="";continue}if(a===","||a===";"||a==="+"){r!==null&&s.set(r,n),r=null,n="";continue}}if(a===" "&&!t){if(n.length===0)continue;if(o>i){let l=o;for(;e[l]===" ";)l++;i=l}if(i>=e.length||e[i]===","||e[i]===";"||r===null&&e[i]==="="||r!==null&&e[i]==="+"){o=i-1;continue}}n+=a}return s}var ur={};Object.defineProperty(ur,"__esModule",{value:!0});ur.nil=ur.UUID=void 0;const Fc=Xr,Lc=hr,Gm="options.name must be either a string or a Buffer",pa=(0,Fc.randomBytes)(16);pa[0]=pa[0]|1;const jn={},J=[];for(let e=0;e<256;e++){const t=(e+256).toString(16).substr(1);jn[t]=e,J[e]=t}class Ht{constructor(t){this.ascii=null,this.binary=null;const r=Ht.check(t);if(!r)throw new Error("not a UUID");this.version=r.version,r.format==="ascii"?this.ascii=t:this.binary=t}static v5(t,r){return Wm(t,"sha1",80,r)}toString(){return this.ascii==null&&(this.ascii=zm(this.binary)),this.ascii}inspect(){return`UUID v${this.version} ${this.toString()}`}static check(t,r=0){if(typeof t=="string")return t=t.toLowerCase(),/^[a-f0-9]{8}(-[a-f0-9]{4}){3}-([a-f0-9]{12})$/.test(t)?t==="00000000-0000-0000-0000-000000000000"?{version:void 0,variant:"nil",format:"ascii"}:{version:(jn[t[14]+t[15]]&240)>>4,variant:ma((jn[t[19]+t[20]]&224)>>5),format:"ascii"}:!1;if(Buffer.isBuffer(t)){if(t.length<r+16)return!1;let n=0;for(;n<16&&t[r+n]===0;n++);return n===16?{version:void 0,variant:"nil",format:"binary"}:{version:(t[r+6]&240)>>4,variant:ma((t[r+8]&224)>>5),format:"binary"}}throw(0,Lc.newError)("Unknown type of uuid","ERR_UNKNOWN_UUID_TYPE")}static parse(t){const r=Buffer.allocUnsafe(16);let n=0;for(let i=0;i<16;i++)r[i]=jn[t[n++]+t[n++]],(i===3||i===5||i===7||i===9)&&(n+=1);return r}}ur.UUID=Ht;Ht.OID=Ht.parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8");function ma(e){switch(e){case 0:case 1:case 3:return"ncs";case 4:case 5:return"rfc4122";case 6:return"microsoft";default:return"future"}}var Rr;(function(e){e[e.ASCII=0]="ASCII",e[e.BINARY=1]="BINARY",e[e.OBJECT=2]="OBJECT"})(Rr||(Rr={}));function Wm(e,t,r,n,i=Rr.ASCII){const s=(0,Fc.createHash)(t);if(typeof e!="string"&&!Buffer.isBuffer(e))throw(0,Lc.newError)(Gm,"ERR_INVALID_UUID_NAME");s.update(n),s.update(e);const a=s.digest();let l;switch(i){case Rr.BINARY:a[6]=a[6]&15|r,a[8]=a[8]&63|128,l=a;break;case Rr.OBJECT:a[6]=a[6]&15|r,a[8]=a[8]&63|128,l=new Ht(a);break;default:l=J[a[0]]+J[a[1]]+J[a[2]]+J[a[3]]+"-"+J[a[4]]+J[a[5]]+"-"+J[a[6]&15|r]+J[a[7]]+"-"+J[a[8]&63|128]+J[a[9]]+"-"+J[a[10]]+J[a[11]]+J[a[12]]+J[a[13]]+J[a[14]]+J[a[15]];break}return l}function zm(e){return J[e[0]]+J[e[1]]+J[e[2]]+J[e[3]]+"-"+J[e[4]]+J[e[5]]+"-"+J[e[6]]+J[e[7]]+"-"+J[e[8]]+J[e[9]]+"-"+J[e[10]]+J[e[11]]+J[e[12]]+J[e[13]]+J[e[14]]+J[e[15]]}ur.nil=new Ht("00000000-0000-0000-0000-000000000000");var en={},kc={};(function(e){(function(t){t.parser=function(m,d){return new n(m,d)},t.SAXParser=n,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function n(m,d){if(!(this instanceof n))return new n(m,d);var T=this;s(T),T.q=T.c="",T.bufferCheckPosition=t.MAX_BUFFER_LENGTH,T.opt=d||{},T.opt.lowercase=T.opt.lowercase||T.opt.lowercasetags,T.looseCase=T.opt.lowercase?"toLowerCase":"toUpperCase",T.tags=[],T.closed=T.closedRoot=T.sawRoot=!1,T.tag=T.error=null,T.strict=!!m,T.noscript=!!(m||T.opt.noscript),T.state=v.BEGIN,T.strictEntities=T.opt.strictEntities,T.ENTITIES=T.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),T.attribList=[],T.opt.xmlns&&(T.ns=Object.create(y)),T.opt.unquotedAttributeValues===void 0&&(T.opt.unquotedAttributeValues=!m),T.trackPosition=T.opt.position!==!1,T.trackPosition&&(T.position=T.line=T.column=0),q(T,"onready")}Object.create||(Object.create=function(m){function d(){}d.prototype=m;var T=new d;return T}),Object.keys||(Object.keys=function(m){var d=[];for(var T in m)m.hasOwnProperty(T)&&d.push(T);return d});function i(m){for(var d=Math.max(t.MAX_BUFFER_LENGTH,10),T=0,S=0,K=r.length;S<K;S++){var ie=m[r[S]].length;if(ie>d)switch(r[S]){case"textNode":X(m);break;case"cdata":H(m,"oncdata",m.cdata),m.cdata="";break;case"script":H(m,"onscript",m.script),m.script="";break;default:I(m,"Max buffer length exceeded: "+r[S])}T=Math.max(T,ie)}var le=t.MAX_BUFFER_LENGTH-T;m.bufferCheckPosition=le+m.position}function s(m){for(var d=0,T=r.length;d<T;d++)m[r[d]]=""}function o(m){X(m),m.cdata!==""&&(H(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(H(m,"onscript",m.script),m.script="")}n.prototype={end:function(){x(this)},write:rt,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){o(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}a||(a=function(){});var l=t.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function u(m,d){return new c(m,d)}function c(m,d){if(!(this instanceof c))return new c(m,d);a.apply(this),this._parser=new n(m,d),this.writable=!0,this.readable=!0;var T=this;this._parser.onend=function(){T.emit("end")},this._parser.onerror=function(S){T.emit("error",S),T._parser.error=null},this._decoder=null,l.forEach(function(S){Object.defineProperty(T,"on"+S,{get:function(){return T._parser["on"+S]},set:function(K){if(!K)return T.removeAllListeners(S),T._parser["on"+S]=K,K;T.on(S,K)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(a.prototype,{constructor:{value:c}}),c.prototype.write=function(m){return typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(m)&&(this._decoder||(this._decoder=new TextDecoder("utf8")),m=this._decoder.decode(m,{stream:!0})),this._parser.write(m.toString()),this.emit("data",m),!0},c.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoder){var d=this._decoder.decode();d&&(this._parser.write(d),this.emit("data",d))}return this._parser.end(),!0},c.prototype.on=function(m,d){var T=this;return!T._parser["on"+m]&&l.indexOf(m)!==-1&&(T._parser["on"+m]=function(){var S=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);S.splice(0,0,m),T.emit.apply(T,S)}),a.prototype.on.call(T,m,d)};var f="[CDATA[",h="DOCTYPE",p="http://www.w3.org/XML/1998/namespace",w="http://www.w3.org/2000/xmlns/",y={xml:p,xmlns:w},E=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,C=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,A=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,R=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function L(m){return m===" "||m===`
85
+ `||m==="\r"||m===" "}function Q(m){return m==='"'||m==="'"}function ee(m){return m===">"||L(m)}function Y(m,d){return m.test(d)}function ue(m,d){return!Y(m,d)}var v=0;t.STATE={BEGIN:v++,BEGIN_WHITESPACE:v++,TEXT:v++,TEXT_ENTITY:v++,OPEN_WAKA:v++,SGML_DECL:v++,SGML_DECL_QUOTED:v++,DOCTYPE:v++,DOCTYPE_QUOTED:v++,DOCTYPE_DTD:v++,DOCTYPE_DTD_QUOTED:v++,COMMENT_STARTING:v++,COMMENT:v++,COMMENT_ENDING:v++,COMMENT_ENDED:v++,CDATA:v++,CDATA_ENDING:v++,CDATA_ENDING_2:v++,PROC_INST:v++,PROC_INST_BODY:v++,PROC_INST_ENDING:v++,OPEN_TAG:v++,OPEN_TAG_SLASH:v++,ATTRIB:v++,ATTRIB_NAME:v++,ATTRIB_NAME_SAW_WHITE:v++,ATTRIB_VALUE:v++,ATTRIB_VALUE_QUOTED:v++,ATTRIB_VALUE_CLOSED:v++,ATTRIB_VALUE_UNQUOTED:v++,ATTRIB_VALUE_ENTITY_Q:v++,ATTRIB_VALUE_ENTITY_U:v++,CLOSE_TAG:v++,CLOSE_TAG_SAW_WHITE:v++,SCRIPT:v++,SCRIPT_ENDING:v++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var d=t.ENTITIES[m],T=typeof d=="number"?String.fromCharCode(d):d;t.ENTITIES[m]=T});for(var G in t.STATE)t.STATE[t.STATE[G]]=G;v=t.STATE;function q(m,d,T){m[d]&&m[d](T)}function H(m,d,T){m.textNode&&X(m),q(m,d,T)}function X(m){m.textNode=O(m.opt,m.textNode),m.textNode&&q(m,"ontext",m.textNode),m.textNode=""}function O(m,d){return m.trim&&(d=d.trim()),m.normalize&&(d=d.replace(/\s+/g," ")),d}function I(m,d){return X(m),m.trackPosition&&(d+=`
86
+ Line: `+m.line+`
87
+ Column: `+m.column+`
88
+ Char: `+m.c),d=new Error(d),m.error=d,q(m,"onerror",d),m}function x(m){return m.sawRoot&&!m.closedRoot&&b(m,"Unclosed root tag"),m.state!==v.BEGIN&&m.state!==v.BEGIN_WHITESPACE&&m.state!==v.TEXT&&I(m,"Unexpected end"),X(m),m.c="",m.closed=!0,q(m,"onend"),n.call(m,m.strict,m.opt),m}function b(m,d){if(typeof m!="object"||!(m instanceof n))throw new Error("bad call to strictFail");m.strict&&I(m,d)}function k(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var d=m.tags[m.tags.length-1]||m,T=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(T.ns=d.ns),m.attribList.length=0,H(m,"onopentagstart",T)}function N(m,d){var T=m.indexOf(":"),S=T<0?["",m]:m.split(":"),K=S[0],ie=S[1];return d&&m==="xmlns"&&(K="xmlns",ie=""),{prefix:K,local:ie}}function B(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var d=N(m.attribName,!0),T=d.prefix,S=d.local;if(T==="xmlns")if(S==="xml"&&m.attribValue!==p)b(m,"xml: prefix must be bound to "+p+`
89
+ Actual: `+m.attribValue);else if(S==="xmlns"&&m.attribValue!==w)b(m,"xmlns: prefix must be bound to "+w+`
90
+ Actual: `+m.attribValue);else{var K=m.tag,ie=m.tags[m.tags.length-1]||m;K.ns===ie.ns&&(K.ns=Object.create(ie.ns)),K.ns[S]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,H(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function z(m,d){if(m.opt.xmlns){var T=m.tag,S=N(m.tagName);T.prefix=S.prefix,T.local=S.local,T.uri=T.ns[S.prefix]||"",T.prefix&&!T.uri&&(b(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),T.uri=S.prefix);var K=m.tags[m.tags.length-1]||m;T.ns&&K.ns!==T.ns&&Object.keys(T.ns).forEach(function(un){H(m,"onopennamespace",{prefix:un,uri:T.ns[un]})});for(var ie=0,le=m.attribList.length;ie<le;ie++){var we=m.attribList[ie],Ce=we[0],ft=we[1],pe=N(Ce,!0),ze=pe.prefix,bi=pe.local,cn=ze===""?"":T.ns[ze]||"",yr={name:Ce,value:ft,prefix:ze,local:bi,uri:cn};ze&&ze!=="xmlns"&&!cn&&(b(m,"Unbound namespace prefix: "+JSON.stringify(ze)),yr.uri=ze),m.tag.attributes[Ce]=yr,H(m,"onattribute",yr)}m.attribList.length=0}m.tag.isSelfClosing=!!d,m.sawRoot=!0,m.tags.push(m.tag),H(m,"onopentag",m.tag),d||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=v.SCRIPT:m.state=v.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function W(m){if(!m.tagName){b(m,"Weird empty close tag."),m.textNode+="</>",m.state=v.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=v.SCRIPT;return}H(m,"onscript",m.script),m.script=""}var d=m.tags.length,T=m.tagName;m.strict||(T=T[m.looseCase]());for(var S=T;d--;){var K=m.tags[d];if(K.name!==S)b(m,"Unexpected close tag");else break}if(d<0){b(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=v.TEXT;return}m.tagName=T;for(var ie=m.tags.length;ie-- >d;){var le=m.tag=m.tags.pop();m.tagName=m.tag.name,H(m,"onclosetag",m.tagName);var we={};for(var Ce in le.ns)we[Ce]=le.ns[Ce];var ft=m.tags[m.tags.length-1]||m;m.opt.xmlns&&le.ns!==ft.ns&&Object.keys(le.ns).forEach(function(pe){var ze=le.ns[pe];H(m,"onclosenamespace",{prefix:pe,uri:ze})})}d===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=v.TEXT}function Z(m){var d=m.entity,T=d.toLowerCase(),S,K="";return m.ENTITIES[d]?m.ENTITIES[d]:m.ENTITIES[T]?m.ENTITIES[T]:(d=T,d.charAt(0)==="#"&&(d.charAt(1)==="x"?(d=d.slice(2),S=parseInt(d,16),K=S.toString(16)):(d=d.slice(1),S=parseInt(d,10),K=S.toString(10))),d=d.replace(/^0+/,""),isNaN(S)||K.toLowerCase()!==d||S<0||S>1114111?(b(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(S))}function ge(m,d){d==="<"?(m.state=v.OPEN_WAKA,m.startTagPosition=m.position):L(d)||(b(m,"Non-whitespace before first tag."),m.textNode=d,m.state=v.TEXT)}function j(m,d){var T="";return d<m.length&&(T=m.charAt(d)),T}function rt(m){var d=this;if(this.error)throw this.error;if(d.closed)return I(d,"Cannot write after close. Assign an onready handler.");if(m===null)return x(d);typeof m=="object"&&(m=m.toString());for(var T=0,S="";S=j(m,T++),d.c=S,!!S;)switch(d.trackPosition&&(d.position++,S===`
91
+ `?(d.line++,d.column=0):d.column++),d.state){case v.BEGIN:if(d.state=v.BEGIN_WHITESPACE,S==="\uFEFF")continue;ge(d,S);continue;case v.BEGIN_WHITESPACE:ge(d,S);continue;case v.TEXT:if(d.sawRoot&&!d.closedRoot){for(var ie=T-1;S&&S!=="<"&&S!=="&";)S=j(m,T++),S&&d.trackPosition&&(d.position++,S===`
92
+ `?(d.line++,d.column=0):d.column++);d.textNode+=m.substring(ie,T-1)}S==="<"&&!(d.sawRoot&&d.closedRoot&&!d.strict)?(d.state=v.OPEN_WAKA,d.startTagPosition=d.position):(!L(S)&&(!d.sawRoot||d.closedRoot)&&b(d,"Text data outside of root node."),S==="&"?d.state=v.TEXT_ENTITY:d.textNode+=S);continue;case v.SCRIPT:S==="<"?d.state=v.SCRIPT_ENDING:d.script+=S;continue;case v.SCRIPT_ENDING:S==="/"?d.state=v.CLOSE_TAG:(d.script+="<"+S,d.state=v.SCRIPT);continue;case v.OPEN_WAKA:if(S==="!")d.state=v.SGML_DECL,d.sgmlDecl="";else if(!L(S))if(Y(E,S))d.state=v.OPEN_TAG,d.tagName=S;else if(S==="/")d.state=v.CLOSE_TAG,d.tagName="";else if(S==="?")d.state=v.PROC_INST,d.procInstName=d.procInstBody="";else{if(b(d,"Unencoded <"),d.startTagPosition+1<d.position){var K=d.position-d.startTagPosition;S=new Array(K).join(" ")+S}d.textNode+="<"+S,d.state=v.TEXT}continue;case v.SGML_DECL:if(d.sgmlDecl+S==="--"){d.state=v.COMMENT,d.comment="",d.sgmlDecl="";continue}d.doctype&&d.doctype!==!0&&d.sgmlDecl?(d.state=v.DOCTYPE_DTD,d.doctype+="<!"+d.sgmlDecl+S,d.sgmlDecl=""):(d.sgmlDecl+S).toUpperCase()===f?(H(d,"onopencdata"),d.state=v.CDATA,d.sgmlDecl="",d.cdata=""):(d.sgmlDecl+S).toUpperCase()===h?(d.state=v.DOCTYPE,(d.doctype||d.sawRoot)&&b(d,"Inappropriately located doctype declaration"),d.doctype="",d.sgmlDecl=""):S===">"?(H(d,"onsgmldeclaration",d.sgmlDecl),d.sgmlDecl="",d.state=v.TEXT):(Q(S)&&(d.state=v.SGML_DECL_QUOTED),d.sgmlDecl+=S);continue;case v.SGML_DECL_QUOTED:S===d.q&&(d.state=v.SGML_DECL,d.q=""),d.sgmlDecl+=S;continue;case v.DOCTYPE:S===">"?(d.state=v.TEXT,H(d,"ondoctype",d.doctype),d.doctype=!0):(d.doctype+=S,S==="["?d.state=v.DOCTYPE_DTD:Q(S)&&(d.state=v.DOCTYPE_QUOTED,d.q=S));continue;case v.DOCTYPE_QUOTED:d.doctype+=S,S===d.q&&(d.q="",d.state=v.DOCTYPE);continue;case v.DOCTYPE_DTD:S==="]"?(d.doctype+=S,d.state=v.DOCTYPE):S==="<"?(d.state=v.OPEN_WAKA,d.startTagPosition=d.position):Q(S)?(d.doctype+=S,d.state=v.DOCTYPE_DTD_QUOTED,d.q=S):d.doctype+=S;continue;case v.DOCTYPE_DTD_QUOTED:d.doctype+=S,S===d.q&&(d.state=v.DOCTYPE_DTD,d.q="");continue;case v.COMMENT:S==="-"?d.state=v.COMMENT_ENDING:d.comment+=S;continue;case v.COMMENT_ENDING:S==="-"?(d.state=v.COMMENT_ENDED,d.comment=O(d.opt,d.comment),d.comment&&H(d,"oncomment",d.comment),d.comment=""):(d.comment+="-"+S,d.state=v.COMMENT);continue;case v.COMMENT_ENDED:S!==">"?(b(d,"Malformed comment"),d.comment+="--"+S,d.state=v.COMMENT):d.doctype&&d.doctype!==!0?d.state=v.DOCTYPE_DTD:d.state=v.TEXT;continue;case v.CDATA:for(var ie=T-1;S&&S!=="]";)S=j(m,T++),S&&d.trackPosition&&(d.position++,S===`
93
+ `?(d.line++,d.column=0):d.column++);d.cdata+=m.substring(ie,T-1),S==="]"&&(d.state=v.CDATA_ENDING);continue;case v.CDATA_ENDING:S==="]"?d.state=v.CDATA_ENDING_2:(d.cdata+="]"+S,d.state=v.CDATA);continue;case v.CDATA_ENDING_2:S===">"?(d.cdata&&H(d,"oncdata",d.cdata),H(d,"onclosecdata"),d.cdata="",d.state=v.TEXT):S==="]"?d.cdata+="]":(d.cdata+="]]"+S,d.state=v.CDATA);continue;case v.PROC_INST:S==="?"?d.state=v.PROC_INST_ENDING:L(S)?d.state=v.PROC_INST_BODY:d.procInstName+=S;continue;case v.PROC_INST_BODY:if(!d.procInstBody&&L(S))continue;S==="?"?d.state=v.PROC_INST_ENDING:d.procInstBody+=S;continue;case v.PROC_INST_ENDING:S===">"?(H(d,"onprocessinginstruction",{name:d.procInstName,body:d.procInstBody}),d.procInstName=d.procInstBody="",d.state=v.TEXT):(d.procInstBody+="?"+S,d.state=v.PROC_INST_BODY);continue;case v.OPEN_TAG:Y(C,S)?d.tagName+=S:(k(d),S===">"?z(d):S==="/"?d.state=v.OPEN_TAG_SLASH:(L(S)||b(d,"Invalid character in tag name"),d.state=v.ATTRIB));continue;case v.OPEN_TAG_SLASH:S===">"?(z(d,!0),W(d)):(b(d,"Forward-slash in opening tag not followed by >"),d.state=v.ATTRIB);continue;case v.ATTRIB:if(L(S))continue;S===">"?z(d):S==="/"?d.state=v.OPEN_TAG_SLASH:Y(E,S)?(d.attribName=S,d.attribValue="",d.state=v.ATTRIB_NAME):b(d,"Invalid attribute name");continue;case v.ATTRIB_NAME:S==="="?d.state=v.ATTRIB_VALUE:S===">"?(b(d,"Attribute without value"),d.attribValue=d.attribName,B(d),z(d)):L(S)?d.state=v.ATTRIB_NAME_SAW_WHITE:Y(C,S)?d.attribName+=S:b(d,"Invalid attribute name");continue;case v.ATTRIB_NAME_SAW_WHITE:if(S==="=")d.state=v.ATTRIB_VALUE;else{if(L(S))continue;b(d,"Attribute without value"),d.tag.attributes[d.attribName]="",d.attribValue="",H(d,"onattribute",{name:d.attribName,value:""}),d.attribName="",S===">"?z(d):Y(E,S)?(d.attribName=S,d.state=v.ATTRIB_NAME):(b(d,"Invalid attribute name"),d.state=v.ATTRIB)}continue;case v.ATTRIB_VALUE:if(L(S))continue;Q(S)?(d.q=S,d.state=v.ATTRIB_VALUE_QUOTED):(d.opt.unquotedAttributeValues||I(d,"Unquoted attribute value"),d.state=v.ATTRIB_VALUE_UNQUOTED,d.attribValue=S);continue;case v.ATTRIB_VALUE_QUOTED:if(S!==d.q){S==="&"?d.state=v.ATTRIB_VALUE_ENTITY_Q:d.attribValue+=S;continue}B(d),d.q="",d.state=v.ATTRIB_VALUE_CLOSED;continue;case v.ATTRIB_VALUE_CLOSED:L(S)?d.state=v.ATTRIB:S===">"?z(d):S==="/"?d.state=v.OPEN_TAG_SLASH:Y(E,S)?(b(d,"No whitespace between attributes"),d.attribName=S,d.attribValue="",d.state=v.ATTRIB_NAME):b(d,"Invalid attribute name");continue;case v.ATTRIB_VALUE_UNQUOTED:if(!ee(S)){S==="&"?d.state=v.ATTRIB_VALUE_ENTITY_U:d.attribValue+=S;continue}B(d),S===">"?z(d):d.state=v.ATTRIB;continue;case v.CLOSE_TAG:if(d.tagName)S===">"?W(d):Y(C,S)?d.tagName+=S:d.script?(d.script+="</"+d.tagName+S,d.tagName="",d.state=v.SCRIPT):(L(S)||b(d,"Invalid tagname in closing tag"),d.state=v.CLOSE_TAG_SAW_WHITE);else{if(L(S))continue;ue(E,S)?d.script?(d.script+="</"+S,d.state=v.SCRIPT):b(d,"Invalid tagname in closing tag."):d.tagName=S}continue;case v.CLOSE_TAG_SAW_WHITE:if(L(S))continue;S===">"?W(d):b(d,"Invalid characters in closing tag");continue;case v.TEXT_ENTITY:case v.ATTRIB_VALUE_ENTITY_Q:case v.ATTRIB_VALUE_ENTITY_U:var le,we;switch(d.state){case v.TEXT_ENTITY:le=v.TEXT,we="textNode";break;case v.ATTRIB_VALUE_ENTITY_Q:le=v.ATTRIB_VALUE_QUOTED,we="attribValue";break;case v.ATTRIB_VALUE_ENTITY_U:le=v.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(S===";"){var Ce=Z(d);d.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(Ce)?(d.entity="",d.state=le,d.write(Ce)):(d[we]+=Ce,d.entity="",d.state=le)}else Y(d.entity.length?R:A,S)?d.entity+=S:(b(d,"Invalid character in entity name"),d[we]+="&"+d.entity+S,d.entity="",d.state=le);continue;default:throw new Error(d,"Unknown state: "+d.state)}return d.position>=d.bufferCheckPosition&&i(d),d}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,d=Math.floor,T=function(){var S=16384,K=[],ie,le,we=-1,Ce=arguments.length;if(!Ce)return"";for(var ft="";++we<Ce;){var pe=Number(arguments[we]);if(!isFinite(pe)||pe<0||pe>1114111||d(pe)!==pe)throw RangeError("Invalid code point: "+pe);pe<=65535?K.push(pe):(pe-=65536,ie=(pe>>10)+55296,le=pe%1024+56320,K.push(ie,le)),(we+1===Ce||K.length>S)&&(ft+=m.apply(null,K),K.length=0)}return ft};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:T,configurable:!0,writable:!0}):String.fromCodePoint=T}()})(e)})(kc);Object.defineProperty(en,"__esModule",{value:!0});en.XElement=void 0;en.parseXml=Xm;const Vm=kc,Tn=hr;class Uc{constructor(t){if(this.name=t,this.value="",this.attributes=null,this.isCData=!1,this.elements=null,!t)throw(0,Tn.newError)("Element name cannot be empty","ERR_XML_ELEMENT_NAME_EMPTY");if(!Jm(t))throw(0,Tn.newError)(`Invalid element name: ${t}`,"ERR_XML_ELEMENT_INVALID_NAME")}attribute(t){const r=this.attributes===null?null:this.attributes[t];if(r==null)throw(0,Tn.newError)(`No attribute "${t}"`,"ERR_XML_MISSED_ATTRIBUTE");return r}removeAttribute(t){this.attributes!==null&&delete this.attributes[t]}element(t,r=!1,n=null){const i=this.elementOrNull(t,r);if(i===null)throw(0,Tn.newError)(n||`No element "${t}"`,"ERR_XML_MISSED_ELEMENT");return i}elementOrNull(t,r=!1){if(this.elements===null)return null;for(const n of this.elements)if(ga(n,t,r))return n;return null}getElements(t,r=!1){return this.elements===null?[]:this.elements.filter(n=>ga(n,t,r))}elementValueOrEmpty(t,r=!1){const n=this.elementOrNull(t,r);return n===null?"":n.value}}en.XElement=Uc;const Ym=new RegExp(/^[A-Za-z_][:A-Za-z0-9_-]*$/i);function Jm(e){return Ym.test(e)}function ga(e,t,r){const n=e.name;return n===t||r===!0&&n.length===t.length&&n.toLowerCase()===t.toLowerCase()}function Xm(e){let t=null;const r=Vm.parser(!0,{}),n=[];return r.onopentag=i=>{const s=new Uc(i.name);if(s.attributes=i.attributes,t===null)t=s;else{const o=n[n.length-1];o.elements==null&&(o.elements=[]),o.elements.push(s)}n.push(s)},r.onclosetag=()=>{n.pop()},r.ontext=i=>{n.length>0&&(n[n.length-1].value=i)},r.oncdata=i=>{const s=n[n.length-1];s.value=i,s.isCData=!0},r.onerror=i=>{throw i},r.write(e),t}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CURRENT_APP_PACKAGE_FILE_NAME=e.CURRENT_APP_INSTALLER_FILE_NAME=e.XElement=e.parseXml=e.UUID=e.parseDn=e.retry=e.githubTagPrefix=e.githubUrl=e.getS3LikeProviderBaseUrl=e.ProgressCallbackTransform=e.MemoLazy=e.safeStringifyJson=e.safeGetHeader=e.parseJson=e.HttpExecutor=e.HttpError=e.DigestTransform=e.createHttpError=e.configureRequestUrl=e.configureRequestOptionsFromUrl=e.configureRequestOptions=e.newError=e.CancellationToken=e.CancellationError=void 0,e.asArray=f;var t=St;Object.defineProperty(e,"CancellationError",{enumerable:!0,get:function(){return t.CancellationError}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return t.CancellationToken}});var r=hr;Object.defineProperty(e,"newError",{enumerable:!0,get:function(){return r.newError}});var n=Ne;Object.defineProperty(e,"configureRequestOptions",{enumerable:!0,get:function(){return n.configureRequestOptions}}),Object.defineProperty(e,"configureRequestOptionsFromUrl",{enumerable:!0,get:function(){return n.configureRequestOptionsFromUrl}}),Object.defineProperty(e,"configureRequestUrl",{enumerable:!0,get:function(){return n.configureRequestUrl}}),Object.defineProperty(e,"createHttpError",{enumerable:!0,get:function(){return n.createHttpError}}),Object.defineProperty(e,"DigestTransform",{enumerable:!0,get:function(){return n.DigestTransform}}),Object.defineProperty(e,"HttpError",{enumerable:!0,get:function(){return n.HttpError}}),Object.defineProperty(e,"HttpExecutor",{enumerable:!0,get:function(){return n.HttpExecutor}}),Object.defineProperty(e,"parseJson",{enumerable:!0,get:function(){return n.parseJson}}),Object.defineProperty(e,"safeGetHeader",{enumerable:!0,get:function(){return n.safeGetHeader}}),Object.defineProperty(e,"safeStringifyJson",{enumerable:!0,get:function(){return n.safeStringifyJson}});var i=li;Object.defineProperty(e,"MemoLazy",{enumerable:!0,get:function(){return i.MemoLazy}});var s=Qr;Object.defineProperty(e,"ProgressCallbackTransform",{enumerable:!0,get:function(){return s.ProgressCallbackTransform}});var o=Zr;Object.defineProperty(e,"getS3LikeProviderBaseUrl",{enumerable:!0,get:function(){return o.getS3LikeProviderBaseUrl}}),Object.defineProperty(e,"githubUrl",{enumerable:!0,get:function(){return o.githubUrl}}),Object.defineProperty(e,"githubTagPrefix",{enumerable:!0,get:function(){return o.githubTagPrefix}});var a=Js;Object.defineProperty(e,"retry",{enumerable:!0,get:function(){return a.retry}});var l=Xs;Object.defineProperty(e,"parseDn",{enumerable:!0,get:function(){return l.parseDn}});var u=ur;Object.defineProperty(e,"UUID",{enumerable:!0,get:function(){return u.UUID}});var c=en;Object.defineProperty(e,"parseXml",{enumerable:!0,get:function(){return c.parseXml}}),Object.defineProperty(e,"XElement",{enumerable:!0,get:function(){return c.XElement}}),e.CURRENT_APP_INSTALLER_FILE_NAME="installer.exe",e.CURRENT_APP_PACKAGE_FILE_NAME="package.7z";function f(h){return h==null?[]:Array.isArray(h)?h:[h]}})(me);var Se={},Ks={},Qe={};function Mc(e){return typeof e>"u"||e===null}function Km(e){return typeof e=="object"&&e!==null}function Qm(e){return Array.isArray(e)?e:Mc(e)?[]:[e]}function Zm(e,t){var r,n,i,s;if(t)for(s=Object.keys(t),r=0,n=s.length;r<n;r+=1)i=s[r],e[i]=t[i];return e}function eg(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function tg(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}Qe.isNothing=Mc;Qe.isObject=Km;Qe.toArray=Qm;Qe.repeat=eg;Qe.isNegativeZero=tg;Qe.extend=Zm;function jc(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
94
+
95
+ `+e.mark.snippet),n+" "+r):n}function Ur(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=jc(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Ur.prototype=Object.create(Error.prototype);Ur.prototype.constructor=Ur;Ur.prototype.toString=function(t){return this.name+": "+jc(this,t)};var tn=Ur,br=Qe;function Vi(e,t,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-t>a&&(s=" ... ",t=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+e.slice(t,r).replace(/\t/g,"→")+o,pos:n-t+s.length}}function Yi(e,t){return br.repeat(" ",t-e.length)+e}function rg(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;s=r.exec(e.buffer);)i.push(s.index),n.push(s.index+s[0].length),e.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var a="",l,u,c=Math.min(e.line+t.linesAfter,i.length).toString().length,f=t.maxLength-(t.indent+c+3);for(l=1;l<=t.linesBefore&&!(o-l<0);l++)u=Vi(e.buffer,n[o-l],i[o-l],e.position-(n[o]-n[o-l]),f),a=br.repeat(" ",t.indent)+Yi((e.line-l+1).toString(),c)+" | "+u.str+`
96
+ `+a;for(u=Vi(e.buffer,n[o],i[o],e.position,f),a+=br.repeat(" ",t.indent)+Yi((e.line+1).toString(),c)+" | "+u.str+`
97
+ `,a+=br.repeat("-",t.indent+c+3+u.pos)+`^
98
+ `,l=1;l<=t.linesAfter&&!(o+l>=i.length);l++)u=Vi(e.buffer,n[o+l],i[o+l],e.position-(n[o]-n[o+l]),f),a+=br.repeat(" ",t.indent)+Yi((e.line+l+1).toString(),c)+" | "+u.str+`
99
+ `;return a.replace(/\n$/,"")}var ng=rg,ya=tn,ig=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],sg=["scalar","sequence","mapping"];function og(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function ag(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(ig.indexOf(r)===-1)throw new ya('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=og(t.styleAliases||null),sg.indexOf(this.kind)===-1)throw new ya('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Le=ag,Sr=tn,Ji=Le;function va(e,t){var r=[];return e[t].forEach(function(n){var i=r.length;r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),r[i]=n}),r}function lg(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function n(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(n);return e}function bs(e){return this.extend(e)}bs.prototype.extend=function(t){var r=[],n=[];if(t instanceof Ji)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new Sr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Ji))throw new Sr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new Sr("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new Sr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof Ji))throw new Sr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(bs.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=va(i,"implicit"),i.compiledExplicit=va(i,"explicit"),i.compiledTypeMap=lg(i.compiledImplicit,i.compiledExplicit),i};var Bc=bs,cg=Le,Hc=new cg("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),ug=Le,qc=new ug("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),fg=Le,Gc=new fg("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),dg=Bc,Wc=new dg({explicit:[Hc,qc,Gc]}),hg=Le;function pg(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function mg(){return null}function gg(e){return e===null}var zc=new hg("tag:yaml.org,2002:null",{kind:"scalar",resolve:pg,construct:mg,predicate:gg,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),yg=Le;function vg(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function wg(e){return e==="true"||e==="True"||e==="TRUE"}function Eg(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Vc=new yg("tag:yaml.org,2002:bool",{kind:"scalar",resolve:vg,construct:wg,predicate:Eg,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"}),_g=Qe,Sg=Le;function Cg(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Ag(e){return 48<=e&&e<=55}function Tg(e){return 48<=e&&e<=57}function bg(e){if(e===null)return!1;var t=e.length,r=0,n=!1,i;if(!t)return!1;if(i=e[r],(i==="-"||i==="+")&&(i=e[++r]),i==="0"){if(r+1===t)return!0;if(i=e[++r],i==="b"){for(r++;r<t;r++)if(i=e[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(r++;r<t;r++)if(i=e[r],i!=="_"){if(!Cg(e.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<t;r++)if(i=e[r],i!=="_"){if(!Ag(e.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<t;r++)if(i=e[r],i!=="_"){if(!Tg(e.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}function Ig(e){var t=e,r=1,n;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),n=t[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),t=t.slice(1),n=t[0]),t==="0")return 0;if(n==="0"){if(t[1]==="b")return r*parseInt(t.slice(2),2);if(t[1]==="x")return r*parseInt(t.slice(2),16);if(t[1]==="o")return r*parseInt(t.slice(2),8)}return r*parseInt(t,10)}function Pg(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!_g.isNegativeZero(e)}var Yc=new Sg("tag:yaml.org,2002:int",{kind:"scalar",resolve:bg,construct:Ig,predicate:Pg,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Jc=Qe,Og=Le,Rg=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Dg(e){return!(e===null||!Rg.test(e)||e[e.length-1]==="_")}function Ng(e){var t,r;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}var $g=/^[-+]?[0-9]+e/;function xg(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Jc.isNegativeZero(e))return"-0.0";return r=e.toString(10),$g.test(r)?r.replace("e",".e"):r}function Fg(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Jc.isNegativeZero(e))}var Xc=new Og("tag:yaml.org,2002:float",{kind:"scalar",resolve:Dg,construct:Ng,predicate:Fg,represent:xg,defaultStyle:"lowercase"}),Kc=Wc.extend({implicit:[zc,Vc,Yc,Xc]}),Qc=Kc,Lg=Le,Zc=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),eu=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function kg(e){return e===null?!1:Zc.exec(e)!==null||eu.exec(e)!==null}function Ug(e){var t,r,n,i,s,o,a,l=0,u=null,c,f,h;if(t=Zc.exec(e),t===null&&(t=eu.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(r,n,i));if(s=+t[4],o=+t[5],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(c=+t[10],f=+(t[11]||0),u=(c*60+f)*6e4,t[9]==="-"&&(u=-u)),h=new Date(Date.UTC(r,n,i,s,o,a,l)),u&&h.setTime(h.getTime()-u),h}function Mg(e){return e.toISOString()}var tu=new Lg("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:kg,construct:Ug,instanceOf:Date,represent:Mg}),jg=Le;function Bg(e){return e==="<<"||e===null}var ru=new jg("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Bg}),Hg=Le,Qs=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
100
+ \r`;function qg(e){if(e===null)return!1;var t,r,n=0,i=e.length,s=Qs;for(r=0;r<i;r++)if(t=s.indexOf(e.charAt(r)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}function Gg(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,s=Qs,o=0,a=[];for(t=0;t<i;t++)t%4===0&&t&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(t));return r=i%4*6,r===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):r===18?(a.push(o>>10&255),a.push(o>>2&255)):r===12&&a.push(o>>4&255),new Uint8Array(a)}function Wg(e){var t="",r=0,n,i,s=e.length,o=Qs;for(n=0;n<s;n++)n%3===0&&n&&(t+=o[r>>18&63],t+=o[r>>12&63],t+=o[r>>6&63],t+=o[r&63]),r=(r<<8)+e[n];return i=s%3,i===0?(t+=o[r>>18&63],t+=o[r>>12&63],t+=o[r>>6&63],t+=o[r&63]):i===2?(t+=o[r>>10&63],t+=o[r>>4&63],t+=o[r<<2&63],t+=o[64]):i===1&&(t+=o[r>>2&63],t+=o[r<<4&63],t+=o[64],t+=o[64]),t}function zg(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var nu=new Hg("tag:yaml.org,2002:binary",{kind:"scalar",resolve:qg,construct:Gg,predicate:zg,represent:Wg}),Vg=Le,Yg=Object.prototype.hasOwnProperty,Jg=Object.prototype.toString;function Xg(e){if(e===null)return!0;var t=[],r,n,i,s,o,a=e;for(r=0,n=a.length;r<n;r+=1){if(i=a[r],o=!1,Jg.call(i)!=="[object Object]")return!1;for(s in i)if(Yg.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(t.indexOf(s)===-1)t.push(s);else return!1}return!0}function Kg(e){return e!==null?e:[]}var iu=new Vg("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Xg,construct:Kg}),Qg=Le,Zg=Object.prototype.toString;function e0(e){if(e===null)return!0;var t,r,n,i,s,o=e;for(s=new Array(o.length),t=0,r=o.length;t<r;t+=1){if(n=o[t],Zg.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[t]=[i[0],n[i[0]]]}return!0}function t0(e){if(e===null)return[];var t,r,n,i,s,o=e;for(s=new Array(o.length),t=0,r=o.length;t<r;t+=1)n=o[t],i=Object.keys(n),s[t]=[i[0],n[i[0]]];return s}var su=new Qg("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:e0,construct:t0}),r0=Le,n0=Object.prototype.hasOwnProperty;function i0(e){if(e===null)return!0;var t,r=e;for(t in r)if(n0.call(r,t)&&r[t]!==null)return!1;return!0}function s0(e){return e!==null?e:{}}var ou=new r0("tag:yaml.org,2002:set",{kind:"mapping",resolve:i0,construct:s0}),Zs=Qc.extend({implicit:[tu,ru],explicit:[nu,iu,su,ou]}),kt=Qe,au=tn,o0=ng,a0=Zs,Ct=Object.prototype.hasOwnProperty,Yn=1,lu=2,cu=3,Jn=4,Xi=1,l0=2,wa=3,c0=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,u0=/[\x85\u2028\u2029]/,f0=/[,\[\]\{\}]/,uu=/^(?:!|!!|![a-z\-]+!)$/i,fu=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ea(e){return Object.prototype.toString.call(e)}function st(e){return e===10||e===13}function Bt(e){return e===9||e===32}function je(e){return e===9||e===32||e===10||e===13}function rr(e){return e===44||e===91||e===93||e===123||e===125}function d0(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function h0(e){return e===120?2:e===117?4:e===85?8:0}function p0(e){return 48<=e&&e<=57?e-48:-1}function _a(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
101
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"…":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function m0(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function du(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[t]=r}var hu=new Array(256),pu=new Array(256);for(var Xt=0;Xt<256;Xt++)hu[Xt]=_a(Xt)?1:0,pu[Xt]=_a(Xt);function g0(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||a0,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function mu(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=o0(r),new au(t,r)}function M(e,t){throw mu(e,t)}function Xn(e,t){e.onWarning&&e.onWarning.call(null,mu(e,t))}var Sa={YAML:function(t,r,n){var i,s,o;t.version!==null&&M(t,"duplication of %YAML directive"),n.length!==1&&M(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&M(t,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&M(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=o<2,o!==1&&o!==2&&Xn(t,"unsupported YAML version of the document")},TAG:function(t,r,n){var i,s;n.length!==2&&M(t,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],uu.test(i)||M(t,"ill-formed tag handle (first argument) of the TAG directive"),Ct.call(t.tagMap,i)&&M(t,'there is a previously declared suffix for "'+i+'" tag handle'),fu.test(s)||M(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{M(t,"tag prefix is malformed: "+s)}t.tagMap[i]=s}};function Et(e,t,r,n){var i,s,o,a;if(t<r){if(a=e.input.slice(t,r),n)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||M(e,"expected valid JSON character");else c0.test(a)&&M(e,"the stream contains non-printable characters");e.result+=a}}function Ca(e,t,r,n){var i,s,o,a;for(kt.isObject(r)||M(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),o=0,a=i.length;o<a;o+=1)s=i[o],Ct.call(t,s)||(du(t,s,r[s]),n[s]=!0)}function nr(e,t,r,n,i,s,o,a,l){var u,c;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),u=0,c=i.length;u<c;u+=1)Array.isArray(i[u])&&M(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Ea(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&Ea(i)==="[object Object]"&&(i="[object Object]"),i=String(i),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(u=0,c=s.length;u<c;u+=1)Ca(e,t,s[u],r);else Ca(e,t,s,r);else!e.json&&!Ct.call(r,i)&&Ct.call(t,i)&&(e.line=o||e.line,e.lineStart=a||e.lineStart,e.position=l||e.position,M(e,"duplicated mapping key")),du(t,i,s),delete r[i];return t}function eo(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):M(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function de(e,t,r){for(var n=0,i=e.input.charCodeAt(e.position);i!==0;){for(;Bt(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(st(i))for(eo(e),i=e.input.charCodeAt(e.position),n++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return r!==-1&&n!==0&&e.lineIndent<r&&Xn(e,"deficient indentation"),n}function ci(e){var t=e.position,r;return r=e.input.charCodeAt(t),!!((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)&&(t+=3,r=e.input.charCodeAt(t),r===0||je(r)))}function to(e,t){t===1?e.result+=" ":t>1&&(e.result+=kt.repeat(`
102
+ `,t-1))}function y0(e,t,r){var n,i,s,o,a,l,u,c,f=e.kind,h=e.result,p;if(p=e.input.charCodeAt(e.position),je(p)||rr(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=e.input.charCodeAt(e.position+1),je(i)||r&&rr(i)))return!1;for(e.kind="scalar",e.result="",s=o=e.position,a=!1;p!==0;){if(p===58){if(i=e.input.charCodeAt(e.position+1),je(i)||r&&rr(i))break}else if(p===35){if(n=e.input.charCodeAt(e.position-1),je(n))break}else{if(e.position===e.lineStart&&ci(e)||r&&rr(p))break;if(st(p))if(l=e.line,u=e.lineStart,c=e.lineIndent,de(e,!1,-1),e.lineIndent>=t){a=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=l,e.lineStart=u,e.lineIndent=c;break}}a&&(Et(e,s,o,!1),to(e,e.line-l),s=o=e.position,a=!1),Bt(p)||(o=e.position+1),p=e.input.charCodeAt(++e.position)}return Et(e,s,o,!1),e.result?!0:(e.kind=f,e.result=h,!1)}function v0(e,t){var r,n,i;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(Et(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,i=e.position;else return!0;else st(r)?(Et(e,n,i,!0),to(e,de(e,!1,t)),n=i=e.position):e.position===e.lineStart&&ci(e)?M(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);M(e,"unexpected end of the stream within a single quoted scalar")}function w0(e,t){var r,n,i,s,o,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return Et(e,r,e.position,!0),e.position++,!0;if(a===92){if(Et(e,r,e.position,!0),a=e.input.charCodeAt(++e.position),st(a))de(e,!1,t);else if(a<256&&hu[a])e.result+=pu[a],e.position++;else if((o=h0(a))>0){for(i=o,s=0;i>0;i--)a=e.input.charCodeAt(++e.position),(o=d0(a))>=0?s=(s<<4)+o:M(e,"expected hexadecimal character");e.result+=m0(s),e.position++}else M(e,"unknown escape sequence");r=n=e.position}else st(a)?(Et(e,r,n,!0),to(e,de(e,!1,t)),r=n=e.position):e.position===e.lineStart&&ci(e)?M(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}M(e,"unexpected end of the stream within a double quoted scalar")}function E0(e,t){var r=!0,n,i,s,o=e.tag,a,l=e.anchor,u,c,f,h,p,w=Object.create(null),y,E,C,A;if(A=e.input.charCodeAt(e.position),A===91)c=93,p=!1,a=[];else if(A===123)c=125,p=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),A=e.input.charCodeAt(++e.position);A!==0;){if(de(e,!0,t),A=e.input.charCodeAt(e.position),A===c)return e.position++,e.tag=o,e.anchor=l,e.kind=p?"mapping":"sequence",e.result=a,!0;r?A===44&&M(e,"expected the node content, but found ','"):M(e,"missed comma between flow collection entries"),E=y=C=null,f=h=!1,A===63&&(u=e.input.charCodeAt(e.position+1),je(u)&&(f=h=!0,e.position++,de(e,!0,t))),n=e.line,i=e.lineStart,s=e.position,fr(e,t,Yn,!1,!0),E=e.tag,y=e.result,de(e,!0,t),A=e.input.charCodeAt(e.position),(h||e.line===n)&&A===58&&(f=!0,A=e.input.charCodeAt(++e.position),de(e,!0,t),fr(e,t,Yn,!1,!0),C=e.result),p?nr(e,a,w,E,y,C,n,i,s):f?a.push(nr(e,null,w,E,y,C,n,i,s)):a.push(y),de(e,!0,t),A=e.input.charCodeAt(e.position),A===44?(r=!0,A=e.input.charCodeAt(++e.position)):r=!1}M(e,"unexpected end of the stream within a flow collection")}function _0(e,t){var r,n,i=Xi,s=!1,o=!1,a=t,l=0,u=!1,c,f;if(f=e.input.charCodeAt(e.position),f===124)n=!1;else if(f===62)n=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Xi===i?i=f===43?wa:l0:M(e,"repeat of a chomping mode identifier");else if((c=p0(f))>=0)c===0?M(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?M(e,"repeat of an indentation width identifier"):(a=t+c-1,o=!0);else break;if(Bt(f)){do f=e.input.charCodeAt(++e.position);while(Bt(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!st(f)&&f!==0)}for(;f!==0;){for(eo(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!o||e.lineIndent<a)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>a&&(a=e.lineIndent),st(f)){l++;continue}if(e.lineIndent<a){i===wa?e.result+=kt.repeat(`
103
+ `,s?1+l:l):i===Xi&&s&&(e.result+=`
104
+ `);break}for(n?Bt(f)?(u=!0,e.result+=kt.repeat(`
105
+ `,s?1+l:l)):u?(u=!1,e.result+=kt.repeat(`
106
+ `,l+1)):l===0?s&&(e.result+=" "):e.result+=kt.repeat(`
107
+ `,l):e.result+=kt.repeat(`
108
+ `,s?1+l:l),s=!0,o=!0,l=0,r=e.position;!st(f)&&f!==0;)f=e.input.charCodeAt(++e.position);Et(e,r,e.position,!1)}return!0}function Aa(e,t){var r,n=e.tag,i=e.anchor,s=[],o,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,M(e,"tab characters must not be used in indentation")),!(l!==45||(o=e.input.charCodeAt(e.position+1),!je(o))));){if(a=!0,e.position++,de(e,!0,-1)&&e.lineIndent<=t){s.push(null),l=e.input.charCodeAt(e.position);continue}if(r=e.line,fr(e,t,cu,!1,!0),s.push(e.result),de(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&l!==0)M(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return a?(e.tag=n,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function S0(e,t,r){var n,i,s,o,a,l,u=e.tag,c=e.anchor,f={},h=Object.create(null),p=null,w=null,y=null,E=!1,C=!1,A;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),A=e.input.charCodeAt(e.position);A!==0;){if(!E&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,M(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),s=e.line,(A===63||A===58)&&je(n))A===63?(E&&(nr(e,f,h,p,w,null,o,a,l),p=w=y=null),C=!0,E=!0,i=!0):E?(E=!1,i=!0):M(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,A=n;else{if(o=e.line,a=e.lineStart,l=e.position,!fr(e,r,lu,!1,!0))break;if(e.line===s){for(A=e.input.charCodeAt(e.position);Bt(A);)A=e.input.charCodeAt(++e.position);if(A===58)A=e.input.charCodeAt(++e.position),je(A)||M(e,"a whitespace character is expected after the key-value separator within a block mapping"),E&&(nr(e,f,h,p,w,null,o,a,l),p=w=y=null),C=!0,E=!1,i=!1,p=e.tag,w=e.result;else if(C)M(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=c,!0}else if(C)M(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=c,!0}if((e.line===s||e.lineIndent>t)&&(E&&(o=e.line,a=e.lineStart,l=e.position),fr(e,t,Jn,!0,i)&&(E?w=e.result:y=e.result),E||(nr(e,f,h,p,w,y,o,a,l),p=w=y=null),de(e,!0,-1),A=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&A!==0)M(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return E&&nr(e,f,h,p,w,null,o,a,l),C&&(e.tag=u,e.anchor=c,e.kind="mapping",e.result=f),C}function C0(e){var t,r=!1,n=!1,i,s,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&M(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(r=!0,o=e.input.charCodeAt(++e.position)):o===33?(n=!0,i="!!",o=e.input.charCodeAt(++e.position)):i="!",t=e.position,r){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(s=e.input.slice(t,e.position),o=e.input.charCodeAt(++e.position)):M(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!je(o);)o===33&&(n?M(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),uu.test(i)||M(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),o=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),f0.test(s)&&M(e,"tag suffix cannot contain flow indicator characters")}s&&!fu.test(s)&&M(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{M(e,"tag name is malformed: "+s)}return r?e.tag=s:Ct.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:M(e,'undeclared tag handle "'+i+'"'),!0}function A0(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&M(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!je(r)&&!rr(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&M(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function T0(e){var t,r,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!je(n)&&!rr(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&M(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),Ct.call(e.anchorMap,r)||M(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],de(e,!0,-1),!0}function fr(e,t,r,n,i){var s,o,a,l=1,u=!1,c=!1,f,h,p,w,y,E;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=a=Jn===r||cu===r,n&&de(e,!0,-1)&&(u=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;C0(e)||A0(e);)de(e,!0,-1)?(u=!0,a=s,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):a=!1;if(a&&(a=u||i),(l===1||Jn===r)&&(Yn===r||lu===r?y=t:y=t+1,E=e.position-e.lineStart,l===1?a&&(Aa(e,E)||S0(e,E,y))||E0(e,y)?c=!0:(o&&_0(e,y)||v0(e,y)||w0(e,y)?c=!0:T0(e)?(c=!0,(e.tag!==null||e.anchor!==null)&&M(e,"alias node should not have any properties")):y0(e,y,Yn===r)&&(c=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(c=a&&Aa(e,E))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&M(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,h=e.implicitTypes.length;f<h;f+=1)if(w=e.implicitTypes[f],w.resolve(e.result)){e.result=w.construct(e.result),e.tag=w.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Ct.call(e.typeMap[e.kind||"fallback"],e.tag))w=e.typeMap[e.kind||"fallback"][e.tag];else for(w=null,p=e.typeMap.multi[e.kind||"fallback"],f=0,h=p.length;f<h;f+=1)if(e.tag.slice(0,p[f].tag.length)===p[f].tag){w=p[f];break}w||M(e,"unknown tag !<"+e.tag+">"),e.result!==null&&w.kind!==e.kind&&M(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+w.kind+'", not "'+e.kind+'"'),w.resolve(e.result,e.tag)?(e.result=w.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):M(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||c}function b0(e){var t=e.position,r,n,i,s=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(de(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(s=!0,o=e.input.charCodeAt(++e.position),r=e.position;o!==0&&!je(o);)o=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),i=[],n.length<1&&M(e,"directive name must not be less than one character in length");o!==0;){for(;Bt(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!st(o));break}if(st(o))break;for(r=e.position;o!==0&&!je(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}o!==0&&eo(e),Ct.call(Sa,n)?Sa[n](e,n,i):Xn(e,'unknown document directive "'+n+'"')}if(de(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,de(e,!0,-1)):s&&M(e,"directives end mark is expected"),fr(e,e.lineIndent-1,Jn,!1,!0),de(e,!0,-1),e.checkLineBreaks&&u0.test(e.input.slice(t,e.position))&&Xn(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&ci(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,de(e,!0,-1));return}if(e.position<e.length-1)M(e,"end of the stream or a document separator is expected");else return}function gu(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
109
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new g0(e,t),n=e.indexOf("\0");for(n!==-1&&(r.position=n,M(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)b0(r);return r.documents}function I0(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var n=gu(e,r);if(typeof t!="function")return n;for(var i=0,s=n.length;i<s;i+=1)t(n[i])}function P0(e,t){var r=gu(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new au("expected a single document in the stream, but found more")}}Ks.loadAll=I0;Ks.load=P0;var yu={},ui=Qe,rn=tn,O0=Zs,vu=Object.prototype.toString,wu=Object.prototype.hasOwnProperty,ro=65279,R0=9,Mr=10,D0=13,N0=32,$0=33,x0=34,Is=35,F0=37,L0=38,k0=39,U0=42,Eu=44,M0=45,Kn=58,j0=61,B0=62,H0=63,q0=64,_u=91,Su=93,G0=96,Cu=123,W0=124,Au=125,Pe={};Pe[0]="\\0";Pe[7]="\\a";Pe[8]="\\b";Pe[9]="\\t";Pe[10]="\\n";Pe[11]="\\v";Pe[12]="\\f";Pe[13]="\\r";Pe[27]="\\e";Pe[34]='\\"';Pe[92]="\\\\";Pe[133]="\\N";Pe[160]="\\_";Pe[8232]="\\L";Pe[8233]="\\P";var z0=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],V0=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Y0(e,t){var r,n,i,s,o,a,l;if(t===null)return{};for(r={},n=Object.keys(t),i=0,s=n.length;i<s;i+=1)o=n[i],a=String(t[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=e.compiledTypeMap.fallback[o],l&&wu.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}function J0(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else if(e<=4294967295)r="U",n=8;else throw new rn("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+ui.repeat("0",n-t.length)+t}var X0=1,jr=2;function K0(e){this.schema=e.schema||O0,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=ui.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Y0(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?jr:X0,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ta(e,t){for(var r=ui.repeat(" ",t),n=0,i=-1,s="",o,a=e.length;n<a;)i=e.indexOf(`
110
+ `,n),i===-1?(o=e.slice(n),n=a):(o=e.slice(n,i+1),n=i+1),o.length&&o!==`
111
+ `&&(s+=r),s+=o;return s}function Ps(e,t){return`
112
+ `+ui.repeat(" ",e.indent*t)}function Q0(e,t){var r,n,i;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(i=e.implicitTypes[r],i.resolve(t))return!0;return!1}function Qn(e){return e===N0||e===R0}function Br(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ro||65536<=e&&e<=1114111}function ba(e){return Br(e)&&e!==ro&&e!==D0&&e!==Mr}function Ia(e,t,r){var n=ba(e),i=n&&!Qn(e);return(r?n:n&&e!==Eu&&e!==_u&&e!==Su&&e!==Cu&&e!==Au)&&e!==Is&&!(t===Kn&&!i)||ba(t)&&!Qn(t)&&e===Is||t===Kn&&i}function Z0(e){return Br(e)&&e!==ro&&!Qn(e)&&e!==M0&&e!==H0&&e!==Kn&&e!==Eu&&e!==_u&&e!==Su&&e!==Cu&&e!==Au&&e!==Is&&e!==L0&&e!==U0&&e!==$0&&e!==W0&&e!==j0&&e!==B0&&e!==k0&&e!==x0&&e!==F0&&e!==q0&&e!==G0}function ey(e){return!Qn(e)&&e!==Kn}function Ir(e,t){var r=e.charCodeAt(t),n;return r>=55296&&r<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function Tu(e){var t=/^\n* /;return t.test(e)}var bu=1,Os=2,Iu=3,Pu=4,er=5;function ty(e,t,r,n,i,s,o,a){var l,u=0,c=null,f=!1,h=!1,p=n!==-1,w=-1,y=Z0(Ir(e,0))&&ey(Ir(e,e.length-1));if(t||o)for(l=0;l<e.length;u>=65536?l+=2:l++){if(u=Ir(e,l),!Br(u))return er;y=y&&Ia(u,c,a),c=u}else{for(l=0;l<e.length;u>=65536?l+=2:l++){if(u=Ir(e,l),u===Mr)f=!0,p&&(h=h||l-w-1>n&&e[w+1]!==" ",w=l);else if(!Br(u))return er;y=y&&Ia(u,c,a),c=u}h=h||p&&l-w-1>n&&e[w+1]!==" "}return!f&&!h?y&&!o&&!i(e)?bu:s===jr?er:Os:r>9&&Tu(e)?er:o?s===jr?er:Os:h?Pu:Iu}function ry(e,t,r,n,i){e.dump=function(){if(t.length===0)return e.quotingType===jr?'""':"''";if(!e.noCompatMode&&(z0.indexOf(t)!==-1||V0.test(t)))return e.quotingType===jr?'"'+t+'"':"'"+t+"'";var s=e.indent*Math.max(1,r),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),a=n||e.flowLevel>-1&&r>=e.flowLevel;function l(u){return Q0(e,u)}switch(ty(t,a,e.indent,o,l,e.quotingType,e.forceQuotes&&!n,i)){case bu:return t;case Os:return"'"+t.replace(/'/g,"''")+"'";case Iu:return"|"+Pa(t,e.indent)+Oa(Ta(t,s));case Pu:return">"+Pa(t,e.indent)+Oa(Ta(ny(t,o),s));case er:return'"'+iy(t)+'"';default:throw new rn("impossible error: invalid scalar style")}}()}function Pa(e,t){var r=Tu(e)?String(t):"",n=e[e.length-1]===`
113
+ `,i=n&&(e[e.length-2]===`
114
+ `||e===`
115
+ `),s=i?"+":n?"":"-";return r+s+`
116
+ `}function Oa(e){return e[e.length-1]===`
117
+ `?e.slice(0,-1):e}function ny(e,t){for(var r=/(\n+)([^\n]*)/g,n=function(){var u=e.indexOf(`
118
+ `);return u=u!==-1?u:e.length,r.lastIndex=u,Ra(e.slice(0,u),t)}(),i=e[0]===`
119
+ `||e[0]===" ",s,o;o=r.exec(e);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
120
+ `:"")+Ra(l,t),i=s}return n}function Ra(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,i=0,s,o=0,a=0,l="";n=r.exec(e);)a=n.index,a-i>t&&(s=o>i?o:a,l+=`
121
+ `+e.slice(i,s),i=s+1),o=a;return l+=`
122
+ `,e.length-i>t&&o>i?l+=e.slice(i,o)+`
123
+ `+e.slice(o+1):l+=e.slice(i),l.slice(1)}function iy(e){for(var t="",r=0,n,i=0;i<e.length;r>=65536?i+=2:i++)r=Ir(e,i),n=Pe[r],!n&&Br(r)?(t+=e[i],r>=65536&&(t+=e[i+1])):t+=n||J0(r);return t}function sy(e,t,r){var n="",i=e.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],e.replacer&&(a=e.replacer.call(r,String(s),a)),(ut(e,t,a,!1,!1)||typeof a>"u"&&ut(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function Da(e,t,r,n){var i="",s=e.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],e.replacer&&(l=e.replacer.call(r,String(o),l)),(ut(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&ut(e,t+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Ps(e,t)),e.dump&&Mr===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function oy(e,t,r){var n="",i=e.tag,s=Object.keys(r),o,a,l,u,c;for(o=0,a=s.length;o<a;o+=1)c="",n!==""&&(c+=", "),e.condenseFlow&&(c+='"'),l=s[o],u=r[l],e.replacer&&(u=e.replacer.call(r,l,u)),ut(e,t,l,!1,!1)&&(e.dump.length>1024&&(c+="? "),c+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ut(e,t,u,!1,!1)&&(c+=e.dump,n+=c));e.tag=i,e.dump="{"+n+"}"}function ay(e,t,r,n){var i="",s=e.tag,o=Object.keys(r),a,l,u,c,f,h;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new rn("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)h="",(!n||i!=="")&&(h+=Ps(e,t)),u=o[a],c=r[u],e.replacer&&(c=e.replacer.call(r,u,c)),ut(e,t+1,u,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&Mr===e.dump.charCodeAt(0)?h+="?":h+="? "),h+=e.dump,f&&(h+=Ps(e,t)),ut(e,t+1,c,!0,f)&&(e.dump&&Mr===e.dump.charCodeAt(0)?h+=":":h+=": ",h+=e.dump,i+=h));e.tag=s,e.dump=i||"{}"}function Na(e,t,r){var n,i,s,o,a,l;for(i=r?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(r?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(l=e.styleMap[a.tag]||a.defaultStyle,vu.call(a.represent)==="[object Function]")n=a.represent(t,l);else if(wu.call(a.represent,l))n=a.represent[l](t,l);else throw new rn("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}function ut(e,t,r,n,i,s,o){e.tag=null,e.dump=r,Na(e,r,!1)||Na(e,r,!0);var a=vu.call(e.dump),l=n,u;n&&(n=e.flowLevel<0||e.flowLevel>t);var c=a==="[object Object]"||a==="[object Array]",f,h;if(c&&(f=e.duplicates.indexOf(r),h=f!==-1),(e.tag!==null&&e.tag!=="?"||h||e.indent!==2&&t>0)&&(i=!1),h&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(c&&h&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),a==="[object Object]")n&&Object.keys(e.dump).length!==0?(ay(e,t,e.dump,i),h&&(e.dump="&ref_"+f+e.dump)):(oy(e,t,e.dump),h&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?Da(e,t-1,e.dump,i):Da(e,t,e.dump,i),h&&(e.dump="&ref_"+f+e.dump)):(sy(e,t,e.dump),h&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&ry(e,e.dump,t,s,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new rn("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function ly(e,t){var r=[],n=[],i,s;for(Rs(e,r,n),i=0,s=n.length;i<s;i+=1)t.duplicates.push(r[n[i]]);t.usedDuplicates=new Array(s)}function Rs(e,t,r){var n,i,s;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(t.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)Rs(e[i],t,r);else for(n=Object.keys(e),i=0,s=n.length;i<s;i+=1)Rs(e[n[i]],t,r)}function cy(e,t){t=t||{};var r=new K0(t);r.noRefs||ly(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),ut(r,0,n,!0,!0)?r.dump+`
124
+ `:""}yu.dump=cy;var Ou=Ks,uy=yu;function no(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}Se.Type=Le;Se.Schema=Bc;Se.FAILSAFE_SCHEMA=Wc;Se.JSON_SCHEMA=Kc;Se.CORE_SCHEMA=Qc;Se.DEFAULT_SCHEMA=Zs;Se.load=Ou.load;Se.loadAll=Ou.loadAll;Se.dump=uy.dump;Se.YAMLException=tn;Se.types={binary:nu,float:Xc,map:Gc,null:zc,pairs:su,set:ou,timestamp:tu,bool:Vc,int:Yc,merge:ru,omap:iu,seq:qc,str:Hc};Se.safeLoad=no("safeLoad","load");Se.safeLoadAll=no("safeLoadAll","loadAll");Se.safeDump=no("safeDump","dump");var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.Lazy=void 0;class fy{constructor(t){this._value=null,this.creator=t}get hasValue(){return this.creator==null}get value(){if(this.creator==null)return this._value;const t=this.creator();return this.value=t,t}set value(t){this._value=t,this.creator=null}}fi.Lazy=fy;var Ds={exports:{}};const dy="2.0.0",Ru=256,hy=Number.MAX_SAFE_INTEGER||9007199254740991,py=16,my=Ru-6,gy=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var di={MAX_LENGTH:Ru,MAX_SAFE_COMPONENT_LENGTH:py,MAX_SAFE_BUILD_LENGTH:my,MAX_SAFE_INTEGER:hy,RELEASE_TYPES:gy,SEMVER_SPEC_VERSION:dy,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const yy=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var hi=yy;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=di,s=hi;t=e.exports={};const o=t.re=[],a=t.safeRe=[],l=t.src=[],u=t.safeSrc=[],c=t.t={};let f=0;const h="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",i],[h,n]],w=E=>{for(const[C,A]of p)E=E.split(`${C}*`).join(`${C}{0,${A}}`).split(`${C}+`).join(`${C}{1,${A}}`);return E},y=(E,C,A)=>{const R=w(C),L=f++;s(E,L,C),c[E]=L,l[L]=C,u[L]=R,o[L]=new RegExp(C,A?"g":void 0),a[L]=new RegExp(R,A?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),y("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${l[c.NONNUMERICIDENTIFIER]}|${l[c.NUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NONNUMERICIDENTIFIER]}|${l[c.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${h}+`),y("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),y("FULL",`^${l[c.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),y("LOOSE",`^${l[c.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),y("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),y("COERCE",`${l[c.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",l[c.COERCEPLAIN]+`(?:${l[c.PRERELEASE]})?(?:${l[c.BUILD]})?(?:$|[^\\d])`),y("COERCERTL",l[c.COERCE],!0),y("COERCERTLFULL",l[c.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",y("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",y("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Ds,Ds.exports);var nn=Ds.exports;const vy=Object.freeze({loose:!0}),wy=Object.freeze({}),Ey=e=>e?typeof e!="object"?vy:e:wy;var io=Ey;const $a=/^[0-9]+$/,Du=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;const r=$a.test(e),n=$a.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},_y=(e,t)=>Du(t,e);var Nu={compareIdentifiers:Du,rcompareIdentifiers:_y};const bn=hi,{MAX_LENGTH:xa,MAX_SAFE_INTEGER:In}=di,{safeRe:Pn,t:On}=nn,Sy=io,{compareIdentifiers:Ki}=Nu;let Cy=class it{constructor(t,r){if(r=Sy(r),t instanceof it){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>xa)throw new TypeError(`version is longer than ${xa} characters`);bn("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?Pn[On.LOOSE]:Pn[On.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>In||this.major<0)throw new TypeError("Invalid major version");if(this.minor>In||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>In||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s<In)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(bn("SemVer.compare",this.version,this.options,t),!(t instanceof it)){if(typeof t=="string"&&t===this.version)return 0;t=new it(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof it||(t=new it(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof it||(t=new it(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],i=t.prerelease[r];if(bn("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Ki(n,i)}while(++r)}compareBuild(t){t instanceof it||(t=new it(t,this.options));let r=0;do{const n=this.build[r],i=t.build[r];if(bn("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Ki(n,i)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){const i=`-${r}`.match(this.options.loose?Pn[On.PRERELEASELOOSE]:Pn[On.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Ki(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var ke=Cy;const Fa=ke,Ay=(e,t,r=!1)=>{if(e instanceof Fa)return e;try{return new Fa(e,t)}catch(n){if(!r)return null;throw n}};var pr=Ay;const Ty=pr,by=(e,t)=>{const r=Ty(e,t);return r?r.version:null};var Iy=by;const Py=pr,Oy=(e,t)=>{const r=Py(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var Ry=Oy;const La=ke,Dy=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new La(e instanceof La?e.version:e,r).inc(t,n,i).version}catch{return null}};var Ny=Dy;const ka=pr,$y=(e,t)=>{const r=ka(e,null,!0),n=ka(t,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,o=s?r:n,a=s?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}const c=l?"pre":"";return r.major!==n.major?c+"major":r.minor!==n.minor?c+"minor":r.patch!==n.patch?c+"patch":"prerelease"};var xy=$y;const Fy=ke,Ly=(e,t)=>new Fy(e,t).major;var ky=Ly;const Uy=ke,My=(e,t)=>new Uy(e,t).minor;var jy=My;const By=ke,Hy=(e,t)=>new By(e,t).patch;var qy=Hy;const Gy=pr,Wy=(e,t)=>{const r=Gy(e,t);return r&&r.prerelease.length?r.prerelease:null};var zy=Wy;const Ua=ke,Vy=(e,t,r)=>new Ua(e,r).compare(new Ua(t,r));var Ze=Vy;const Yy=Ze,Jy=(e,t,r)=>Yy(t,e,r);var Xy=Jy;const Ky=Ze,Qy=(e,t)=>Ky(e,t,!0);var Zy=Qy;const Ma=ke,ev=(e,t,r)=>{const n=new Ma(e,r),i=new Ma(t,r);return n.compare(i)||n.compareBuild(i)};var so=ev;const tv=so,rv=(e,t)=>e.sort((r,n)=>tv(r,n,t));var nv=rv;const iv=so,sv=(e,t)=>e.sort((r,n)=>iv(n,r,t));var ov=sv;const av=Ze,lv=(e,t,r)=>av(e,t,r)>0;var pi=lv;const cv=Ze,uv=(e,t,r)=>cv(e,t,r)<0;var oo=uv;const fv=Ze,dv=(e,t,r)=>fv(e,t,r)===0;var $u=dv;const hv=Ze,pv=(e,t,r)=>hv(e,t,r)!==0;var xu=pv;const mv=Ze,gv=(e,t,r)=>mv(e,t,r)>=0;var ao=gv;const yv=Ze,vv=(e,t,r)=>yv(e,t,r)<=0;var lo=vv;const wv=$u,Ev=xu,_v=pi,Sv=ao,Cv=oo,Av=lo,Tv=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return wv(e,r,n);case"!=":return Ev(e,r,n);case">":return _v(e,r,n);case">=":return Sv(e,r,n);case"<":return Cv(e,r,n);case"<=":return Av(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var Fu=Tv;const bv=ke,Iv=pr,{safeRe:Rn,t:Dn}=nn,Pv=(e,t)=>{if(e instanceof bv)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Rn[Dn.COERCEFULL]:Rn[Dn.COERCE]);else{const l=t.includePrerelease?Rn[Dn.COERCERTLFULL]:Rn[Dn.COERCERTL];let u;for(;(u=l.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),l.lastIndex=u.index+u[1].length+u[2].length;l.lastIndex=-1}if(r===null)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Iv(`${n}.${i}.${s}${o}${a}`,t)};var Ov=Pv;class Rv{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}}var Dv=Rv,Qi,ja;function et(){if(ja)return Qi;ja=1;const e=/\s+/g;class t{constructor(I,x){if(x=i(x),I instanceof t)return I.loose===!!x.loose&&I.includePrerelease===!!x.includePrerelease?I:new t(I.raw,x);if(I instanceof s)return this.raw=I.value,this.set=[[I]],this.formatted=void 0,this;if(this.options=x,this.loose=!!x.loose,this.includePrerelease=!!x.includePrerelease,this.raw=I.trim().replace(e," "),this.set=this.raw.split("||").map(b=>this.parseRange(b.trim())).filter(b=>b.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const b=this.set[0];if(this.set=this.set.filter(k=>!y(k[0])),this.set.length===0)this.set=[b];else if(this.set.length>1){for(const k of this.set)if(k.length===1&&E(k[0])){this.set=[k];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let I=0;I<this.set.length;I++){I>0&&(this.formatted+="||");const x=this.set[I];for(let b=0;b<x.length;b++)b>0&&(this.formatted+=" "),this.formatted+=x[b].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(I){const b=((this.options.includePrerelease&&p)|(this.options.loose&&w))+":"+I,k=n.get(b);if(k)return k;const N=this.options.loose,B=N?l[u.HYPHENRANGELOOSE]:l[u.HYPHENRANGE];I=I.replace(B,H(this.options.includePrerelease)),o("hyphen replace",I),I=I.replace(l[u.COMPARATORTRIM],c),o("comparator trim",I),I=I.replace(l[u.TILDETRIM],f),o("tilde trim",I),I=I.replace(l[u.CARETTRIM],h),o("caret trim",I);let z=I.split(" ").map(j=>A(j,this.options)).join(" ").split(/\s+/).map(j=>q(j,this.options));N&&(z=z.filter(j=>(o("loose invalid filter",j,this.options),!!j.match(l[u.COMPARATORLOOSE])))),o("range list",z);const W=new Map,Z=z.map(j=>new s(j,this.options));for(const j of Z){if(y(j))return[j];W.set(j.value,j)}W.size>1&&W.has("")&&W.delete("");const ge=[...W.values()];return n.set(b,ge),ge}intersects(I,x){if(!(I instanceof t))throw new TypeError("a Range is required");return this.set.some(b=>C(b,x)&&I.set.some(k=>C(k,x)&&b.every(N=>k.every(B=>N.intersects(B,x)))))}test(I){if(!I)return!1;if(typeof I=="string")try{I=new a(I,this.options)}catch{return!1}for(let x=0;x<this.set.length;x++)if(X(this.set[x],I,this.options))return!0;return!1}}Qi=t;const r=Dv,n=new r,i=io,s=mi(),o=hi,a=ke,{safeRe:l,t:u,comparatorTrimReplace:c,tildeTrimReplace:f,caretTrimReplace:h}=nn,{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:w}=di,y=O=>O.value==="<0.0.0-0",E=O=>O.value==="",C=(O,I)=>{let x=!0;const b=O.slice();let k=b.pop();for(;x&&b.length;)x=b.every(N=>k.intersects(N,I)),k=b.pop();return x},A=(O,I)=>(O=O.replace(l[u.BUILD],""),o("comp",O,I),O=ee(O,I),o("caret",O),O=L(O,I),o("tildes",O),O=ue(O,I),o("xrange",O),O=G(O,I),o("stars",O),O),R=O=>!O||O.toLowerCase()==="x"||O==="*",L=(O,I)=>O.trim().split(/\s+/).map(x=>Q(x,I)).join(" "),Q=(O,I)=>{const x=I.loose?l[u.TILDELOOSE]:l[u.TILDE];return O.replace(x,(b,k,N,B,z)=>{o("tilde",O,b,k,N,B,z);let W;return R(k)?W="":R(N)?W=`>=${k}.0.0 <${+k+1}.0.0-0`:R(B)?W=`>=${k}.${N}.0 <${k}.${+N+1}.0-0`:z?(o("replaceTilde pr",z),W=`>=${k}.${N}.${B}-${z} <${k}.${+N+1}.0-0`):W=`>=${k}.${N}.${B} <${k}.${+N+1}.0-0`,o("tilde return",W),W})},ee=(O,I)=>O.trim().split(/\s+/).map(x=>Y(x,I)).join(" "),Y=(O,I)=>{o("caret",O,I);const x=I.loose?l[u.CARETLOOSE]:l[u.CARET],b=I.includePrerelease?"-0":"";return O.replace(x,(k,N,B,z,W)=>{o("caret",O,k,N,B,z,W);let Z;return R(N)?Z="":R(B)?Z=`>=${N}.0.0${b} <${+N+1}.0.0-0`:R(z)?N==="0"?Z=`>=${N}.${B}.0${b} <${N}.${+B+1}.0-0`:Z=`>=${N}.${B}.0${b} <${+N+1}.0.0-0`:W?(o("replaceCaret pr",W),N==="0"?B==="0"?Z=`>=${N}.${B}.${z}-${W} <${N}.${B}.${+z+1}-0`:Z=`>=${N}.${B}.${z}-${W} <${N}.${+B+1}.0-0`:Z=`>=${N}.${B}.${z}-${W} <${+N+1}.0.0-0`):(o("no pr"),N==="0"?B==="0"?Z=`>=${N}.${B}.${z}${b} <${N}.${B}.${+z+1}-0`:Z=`>=${N}.${B}.${z}${b} <${N}.${+B+1}.0-0`:Z=`>=${N}.${B}.${z} <${+N+1}.0.0-0`),o("caret return",Z),Z})},ue=(O,I)=>(o("replaceXRanges",O,I),O.split(/\s+/).map(x=>v(x,I)).join(" ")),v=(O,I)=>{O=O.trim();const x=I.loose?l[u.XRANGELOOSE]:l[u.XRANGE];return O.replace(x,(b,k,N,B,z,W)=>{o("xRange",O,b,k,N,B,z,W);const Z=R(N),ge=Z||R(B),j=ge||R(z),rt=j;return k==="="&&rt&&(k=""),W=I.includePrerelease?"-0":"",Z?k===">"||k==="<"?b="<0.0.0-0":b="*":k&&rt?(ge&&(B=0),z=0,k===">"?(k=">=",ge?(N=+N+1,B=0,z=0):(B=+B+1,z=0)):k==="<="&&(k="<",ge?N=+N+1:B=+B+1),k==="<"&&(W="-0"),b=`${k+N}.${B}.${z}${W}`):ge?b=`>=${N}.0.0${W} <${+N+1}.0.0-0`:j&&(b=`>=${N}.${B}.0${W} <${N}.${+B+1}.0-0`),o("xRange return",b),b})},G=(O,I)=>(o("replaceStars",O,I),O.trim().replace(l[u.STAR],"")),q=(O,I)=>(o("replaceGTE0",O,I),O.trim().replace(l[I.includePrerelease?u.GTE0PRE:u.GTE0],"")),H=O=>(I,x,b,k,N,B,z,W,Z,ge,j,rt)=>(R(b)?x="":R(k)?x=`>=${b}.0.0${O?"-0":""}`:R(N)?x=`>=${b}.${k}.0${O?"-0":""}`:B?x=`>=${x}`:x=`>=${x}${O?"-0":""}`,R(Z)?W="":R(ge)?W=`<${+Z+1}.0.0-0`:R(j)?W=`<${Z}.${+ge+1}.0-0`:rt?W=`<=${Z}.${ge}.${j}-${rt}`:O?W=`<${Z}.${ge}.${+j+1}-0`:W=`<=${W}`,`${x} ${W}`.trim()),X=(O,I,x)=>{for(let b=0;b<O.length;b++)if(!O[b].test(I))return!1;if(I.prerelease.length&&!x.includePrerelease){for(let b=0;b<O.length;b++)if(o(O[b].semver),O[b].semver!==s.ANY&&O[b].semver.prerelease.length>0){const k=O[b].semver;if(k.major===I.major&&k.minor===I.minor&&k.patch===I.patch)return!0}return!1}return!0};return Qi}var Zi,Ba;function mi(){if(Ba)return Zi;Ba=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(c,f){if(f=r(f),c instanceof t){if(c.loose===!!f.loose)return c;c=c.value}c=c.trim().split(/\s+/).join(" "),o("comparator",c,f),this.options=f,this.loose=!!f.loose,this.parse(c),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(c){const f=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],h=c.match(f);if(!h)throw new TypeError(`Invalid comparator: ${c}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new a(h[2],this.options.loose):this.semver=e}toString(){return this.value}test(c){if(o("Comparator.test",c,this.options.loose),this.semver===e||c===e)return!0;if(typeof c=="string")try{c=new a(c,this.options)}catch{return!1}return s(c,this.operator,this.semver,this.options)}intersects(c,f){if(!(c instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(c.value,f).test(this.value):c.operator===""?c.value===""?!0:new l(this.value,f).test(c.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||c.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||c.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&c.operator.startsWith(">")||this.operator.startsWith("<")&&c.operator.startsWith("<")||this.semver.version===c.semver.version&&this.operator.includes("=")&&c.operator.includes("=")||s(this.semver,"<",c.semver,f)&&this.operator.startsWith(">")&&c.operator.startsWith("<")||s(this.semver,">",c.semver,f)&&this.operator.startsWith("<")&&c.operator.startsWith(">")))}}Zi=t;const r=io,{safeRe:n,t:i}=nn,s=Fu,o=hi,a=ke,l=et();return Zi}const Nv=et(),$v=(e,t,r)=>{try{t=new Nv(t,r)}catch{return!1}return t.test(e)};var gi=$v;const xv=et(),Fv=(e,t)=>new xv(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var Lv=Fv;const kv=ke,Uv=et(),Mv=(e,t,r)=>{let n=null,i=null,s=null;try{s=new Uv(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new kv(n,r))}),n};var jv=Mv;const Bv=ke,Hv=et(),qv=(e,t,r)=>{let n=null,i=null,s=null;try{s=new Hv(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new Bv(n,r))}),n};var Gv=qv;const es=ke,Wv=et(),Ha=pi,zv=(e,t)=>{e=new Wv(e,t);let r=new es("0.0.0");if(e.test(r)||(r=new es("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n<e.set.length;++n){const i=e.set[n];let s=null;i.forEach(o=>{const a=new es(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Ha(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||Ha(r,s))&&(r=s)}return r&&e.test(r)?r:null};var Vv=zv;const Yv=et(),Jv=(e,t)=>{try{return new Yv(e,t).range||"*"}catch{return null}};var Xv=Jv;const Kv=ke,Lu=mi(),{ANY:Qv}=Lu,Zv=et(),ew=gi,qa=pi,Ga=oo,tw=lo,rw=ao,nw=(e,t,r,n)=>{e=new Kv(e,n),t=new Zv(t,n);let i,s,o,a,l;switch(r){case">":i=qa,s=tw,o=Ga,a=">",l=">=";break;case"<":i=Ga,s=rw,o=qa,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ew(e,t,n))return!1;for(let u=0;u<t.set.length;++u){const c=t.set[u];let f=null,h=null;if(c.forEach(p=>{p.semver===Qv&&(p=new Lu(">=0.0.0")),f=f||p,h=h||p,i(p.semver,f.semver,n)?f=p:o(p.semver,h.semver,n)&&(h=p)}),f.operator===a||f.operator===l||(!h.operator||h.operator===a)&&s(e,h.semver))return!1;if(h.operator===l&&o(e,h.semver))return!1}return!0};var co=nw;const iw=co,sw=(e,t,r)=>iw(e,t,">",r);var ow=sw;const aw=co,lw=(e,t,r)=>aw(e,t,"<",r);var cw=lw;const Wa=et(),uw=(e,t,r)=>(e=new Wa(e,r),t=new Wa(t,r),e.intersects(t,r));var fw=uw;const dw=gi,hw=Ze;var pw=(e,t,r)=>{const n=[];let i=null,s=null;const o=e.sort((c,f)=>hw(c,f,r));for(const c of o)dw(c,t,r)?(s=c,i||(i=c)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const a=[];for(const[c,f]of n)c===f?a.push(c):!f&&c===o[0]?a.push("*"):f?c===o[0]?a.push(`<=${f}`):a.push(`${c} - ${f}`):a.push(`>=${c}`);const l=a.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return l.length<u.length?l:t};const za=et(),uo=mi(),{ANY:ts}=uo,Cr=gi,fo=Ze,mw=(e,t,r={})=>{if(e===t)return!0;e=new za(e,r),t=new za(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const o=yw(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},gw=[new uo(">=0.0.0-0")],Va=[new uo(">=0.0.0")],yw=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===ts){if(t.length===1&&t[0].semver===ts)return!0;r.includePrerelease?e=gw:e=Va}if(t.length===1&&t[0].semver===ts){if(r.includePrerelease)return!0;t=Va}const n=new Set;let i,s;for(const p of e)p.operator===">"||p.operator===">="?i=Ya(i,p,r):p.operator==="<"||p.operator==="<="?s=Ja(s,p,r):n.add(p.semver);if(n.size>1)return null;let o;if(i&&s){if(o=fo(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const p of n){if(i&&!Cr(p,String(i),r)||s&&!Cr(p,String(s),r))return null;for(const w of t)if(!Cr(p,String(w),r))return!1;return!0}let a,l,u,c,f=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,h=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;f&&f.prerelease.length===1&&s.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(const p of t){if(c=c||p.operator===">"||p.operator===">=",u=u||p.operator==="<"||p.operator==="<=",i){if(h&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===h.major&&p.semver.minor===h.minor&&p.semver.patch===h.patch&&(h=!1),p.operator===">"||p.operator===">="){if(a=Ya(i,p,r),a===p&&a!==i)return!1}else if(i.operator===">="&&!Cr(i.semver,String(p),r))return!1}if(s){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator==="<"||p.operator==="<="){if(l=Ja(s,p,r),l===p&&l!==s)return!1}else if(s.operator==="<="&&!Cr(s.semver,String(p),r))return!1}if(!p.operator&&(s||i)&&o!==0)return!1}return!(i&&u&&!s&&o!==0||s&&c&&!i&&o!==0||h||f)},Ya=(e,t,r)=>{if(!e)return t;const n=fo(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Ja=(e,t,r)=>{if(!e)return t;const n=fo(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var vw=mw;const rs=nn,Xa=di,ww=ke,Ka=Nu,Ew=pr,_w=Iy,Sw=Ry,Cw=Ny,Aw=xy,Tw=ky,bw=jy,Iw=qy,Pw=zy,Ow=Ze,Rw=Xy,Dw=Zy,Nw=so,$w=nv,xw=ov,Fw=pi,Lw=oo,kw=$u,Uw=xu,Mw=ao,jw=lo,Bw=Fu,Hw=Ov,qw=mi(),Gw=et(),Ww=gi,zw=Lv,Vw=jv,Yw=Gv,Jw=Vv,Xw=Xv,Kw=co,Qw=ow,Zw=cw,eE=fw,tE=pw,rE=vw;var ku={parse:Ew,valid:_w,clean:Sw,inc:Cw,diff:Aw,major:Tw,minor:bw,patch:Iw,prerelease:Pw,compare:Ow,rcompare:Rw,compareLoose:Dw,compareBuild:Nw,sort:$w,rsort:xw,gt:Fw,lt:Lw,eq:kw,neq:Uw,gte:Mw,lte:jw,cmp:Bw,coerce:Hw,Comparator:qw,Range:Gw,satisfies:Ww,toComparators:zw,maxSatisfying:Vw,minSatisfying:Yw,minVersion:Jw,validRange:Xw,outside:Kw,gtr:Qw,ltr:Zw,intersects:eE,simplifyRange:tE,subset:rE,SemVer:ww,re:rs.re,src:rs.src,tokens:rs.t,SEMVER_SPEC_VERSION:Xa.SEMVER_SPEC_VERSION,RELEASE_TYPES:Xa.RELEASE_TYPES,compareIdentifiers:Ka.compareIdentifiers,rcompareIdentifiers:Ka.rcompareIdentifiers},sn={},Zn={exports:{}};Zn.exports;(function(e,t){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Function]",w="[object GeneratorFunction]",y="[object Map]",E="[object Number]",C="[object Null]",A="[object Object]",R="[object Promise]",L="[object Proxy]",Q="[object RegExp]",ee="[object Set]",Y="[object String]",ue="[object Symbol]",v="[object Undefined]",G="[object WeakMap]",q="[object ArrayBuffer]",H="[object DataView]",X="[object Float32Array]",O="[object Float64Array]",I="[object Int8Array]",x="[object Int16Array]",b="[object Int32Array]",k="[object Uint8Array]",N="[object Uint8ClampedArray]",B="[object Uint16Array]",z="[object Uint32Array]",W=/[\\^$.*+?()[\]{}|]/g,Z=/^\[object .+?Constructor\]$/,ge=/^(?:0|[1-9]\d*)$/,j={};j[X]=j[O]=j[I]=j[x]=j[b]=j[k]=j[N]=j[B]=j[z]=!0,j[a]=j[l]=j[q]=j[c]=j[H]=j[f]=j[h]=j[p]=j[y]=j[E]=j[A]=j[Q]=j[ee]=j[Y]=j[G]=!1;var rt=typeof De=="object"&&De&&De.Object===Object&&De,m=typeof self=="object"&&self&&self.Object===Object&&self,d=rt||m||Function("return this")(),T=t&&!t.nodeType&&t,S=T&&!0&&e&&!e.nodeType&&e,K=S&&S.exports===T,ie=K&&rt.process,le=function(){try{return ie&&ie.binding&&ie.binding("util")}catch{}}(),we=le&&le.isTypedArray;function Ce(g,_){for(var P=-1,U=g==null?0:g.length,se=0,V=[];++P<U;){var ce=g[P];_(ce,P,g)&&(V[se++]=ce)}return V}function ft(g,_){for(var P=-1,U=_.length,se=g.length;++P<U;)g[se+P]=_[P];return g}function pe(g,_){for(var P=-1,U=g==null?0:g.length;++P<U;)if(_(g[P],P,g))return!0;return!1}function ze(g,_){for(var P=-1,U=Array(g);++P<g;)U[P]=_(P);return U}function bi(g){return function(_){return g(_)}}function cn(g,_){return g.has(_)}function yr(g,_){return g==null?void 0:g[_]}function un(g){var _=-1,P=Array(g.size);return g.forEach(function(U,se){P[++_]=[se,U]}),P}function Qu(g,_){return function(P){return g(_(P))}}function Zu(g){var _=-1,P=Array(g.size);return g.forEach(function(U){P[++_]=U}),P}var ef=Array.prototype,tf=Function.prototype,fn=Object.prototype,Ii=d["__core-js_shared__"],Eo=tf.toString,nt=fn.hasOwnProperty,_o=function(){var g=/[^.]+$/.exec(Ii&&Ii.keys&&Ii.keys.IE_PROTO||"");return g?"Symbol(src)_1."+g:""}(),So=fn.toString,rf=RegExp("^"+Eo.call(nt).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Co=K?d.Buffer:void 0,dn=d.Symbol,Ao=d.Uint8Array,To=fn.propertyIsEnumerable,nf=ef.splice,Pt=dn?dn.toStringTag:void 0,bo=Object.getOwnPropertySymbols,sf=Co?Co.isBuffer:void 0,of=Qu(Object.keys,Object),Pi=Vt(d,"DataView"),vr=Vt(d,"Map"),Oi=Vt(d,"Promise"),Ri=Vt(d,"Set"),Di=Vt(d,"WeakMap"),wr=Vt(Object,"create"),af=Dt(Pi),lf=Dt(vr),cf=Dt(Oi),uf=Dt(Ri),ff=Dt(Di),Io=dn?dn.prototype:void 0,Ni=Io?Io.valueOf:void 0;function Ot(g){var _=-1,P=g==null?0:g.length;for(this.clear();++_<P;){var U=g[_];this.set(U[0],U[1])}}function df(){this.__data__=wr?wr(null):{},this.size=0}function hf(g){var _=this.has(g)&&delete this.__data__[g];return this.size-=_?1:0,_}function pf(g){var _=this.__data__;if(wr){var P=_[g];return P===n?void 0:P}return nt.call(_,g)?_[g]:void 0}function mf(g){var _=this.__data__;return wr?_[g]!==void 0:nt.call(_,g)}function gf(g,_){var P=this.__data__;return this.size+=this.has(g)?0:1,P[g]=wr&&_===void 0?n:_,this}Ot.prototype.clear=df,Ot.prototype.delete=hf,Ot.prototype.get=pf,Ot.prototype.has=mf,Ot.prototype.set=gf;function at(g){var _=-1,P=g==null?0:g.length;for(this.clear();++_<P;){var U=g[_];this.set(U[0],U[1])}}function yf(){this.__data__=[],this.size=0}function vf(g){var _=this.__data__,P=pn(_,g);if(P<0)return!1;var U=_.length-1;return P==U?_.pop():nf.call(_,P,1),--this.size,!0}function wf(g){var _=this.__data__,P=pn(_,g);return P<0?void 0:_[P][1]}function Ef(g){return pn(this.__data__,g)>-1}function _f(g,_){var P=this.__data__,U=pn(P,g);return U<0?(++this.size,P.push([g,_])):P[U][1]=_,this}at.prototype.clear=yf,at.prototype.delete=vf,at.prototype.get=wf,at.prototype.has=Ef,at.prototype.set=_f;function Rt(g){var _=-1,P=g==null?0:g.length;for(this.clear();++_<P;){var U=g[_];this.set(U[0],U[1])}}function Sf(){this.size=0,this.__data__={hash:new Ot,map:new(vr||at),string:new Ot}}function Cf(g){var _=mn(this,g).delete(g);return this.size-=_?1:0,_}function Af(g){return mn(this,g).get(g)}function Tf(g){return mn(this,g).has(g)}function bf(g,_){var P=mn(this,g),U=P.size;return P.set(g,_),this.size+=P.size==U?0:1,this}Rt.prototype.clear=Sf,Rt.prototype.delete=Cf,Rt.prototype.get=Af,Rt.prototype.has=Tf,Rt.prototype.set=bf;function hn(g){var _=-1,P=g==null?0:g.length;for(this.__data__=new Rt;++_<P;)this.add(g[_])}function If(g){return this.__data__.set(g,n),this}function Pf(g){return this.__data__.has(g)}hn.prototype.add=hn.prototype.push=If,hn.prototype.has=Pf;function dt(g){var _=this.__data__=new at(g);this.size=_.size}function Of(){this.__data__=new at,this.size=0}function Rf(g){var _=this.__data__,P=_.delete(g);return this.size=_.size,P}function Df(g){return this.__data__.get(g)}function Nf(g){return this.__data__.has(g)}function $f(g,_){var P=this.__data__;if(P instanceof at){var U=P.__data__;if(!vr||U.length<r-1)return U.push([g,_]),this.size=++P.size,this;P=this.__data__=new Rt(U)}return P.set(g,_),this.size=P.size,this}dt.prototype.clear=Of,dt.prototype.delete=Rf,dt.prototype.get=Df,dt.prototype.has=Nf,dt.prototype.set=$f;function xf(g,_){var P=gn(g),U=!P&&Jf(g),se=!P&&!U&&$i(g),V=!P&&!U&&!se&&Lo(g),ce=P||U||se||V,ye=ce?ze(g.length,String):[],Ee=ye.length;for(var oe in g)nt.call(g,oe)&&!(ce&&(oe=="length"||se&&(oe=="offset"||oe=="parent")||V&&(oe=="buffer"||oe=="byteLength"||oe=="byteOffset")||Gf(oe,Ee)))&&ye.push(oe);return ye}function pn(g,_){for(var P=g.length;P--;)if(No(g[P][0],_))return P;return-1}function Ff(g,_,P){var U=_(g);return gn(g)?U:ft(U,P(g))}function Er(g){return g==null?g===void 0?v:C:Pt&&Pt in Object(g)?Hf(g):Yf(g)}function Po(g){return _r(g)&&Er(g)==a}function Oo(g,_,P,U,se){return g===_?!0:g==null||_==null||!_r(g)&&!_r(_)?g!==g&&_!==_:Lf(g,_,P,U,Oo,se)}function Lf(g,_,P,U,se,V){var ce=gn(g),ye=gn(_),Ee=ce?l:ht(g),oe=ye?l:ht(_);Ee=Ee==a?A:Ee,oe=oe==a?A:oe;var Be=Ee==A,Ve=oe==A,Ae=Ee==oe;if(Ae&&$i(g)){if(!$i(_))return!1;ce=!0,Be=!1}if(Ae&&!Be)return V||(V=new dt),ce||Lo(g)?Ro(g,_,P,U,se,V):jf(g,_,Ee,P,U,se,V);if(!(P&i)){var qe=Be&&nt.call(g,"__wrapped__"),Ge=Ve&&nt.call(_,"__wrapped__");if(qe||Ge){var pt=qe?g.value():g,lt=Ge?_.value():_;return V||(V=new dt),se(pt,lt,P,U,V)}}return Ae?(V||(V=new dt),Bf(g,_,P,U,se,V)):!1}function kf(g){if(!Fo(g)||zf(g))return!1;var _=$o(g)?rf:Z;return _.test(Dt(g))}function Uf(g){return _r(g)&&xo(g.length)&&!!j[Er(g)]}function Mf(g){if(!Vf(g))return of(g);var _=[];for(var P in Object(g))nt.call(g,P)&&P!="constructor"&&_.push(P);return _}function Ro(g,_,P,U,se,V){var ce=P&i,ye=g.length,Ee=_.length;if(ye!=Ee&&!(ce&&Ee>ye))return!1;var oe=V.get(g);if(oe&&V.get(_))return oe==_;var Be=-1,Ve=!0,Ae=P&s?new hn:void 0;for(V.set(g,_),V.set(_,g);++Be<ye;){var qe=g[Be],Ge=_[Be];if(U)var pt=ce?U(Ge,qe,Be,_,g,V):U(qe,Ge,Be,g,_,V);if(pt!==void 0){if(pt)continue;Ve=!1;break}if(Ae){if(!pe(_,function(lt,Nt){if(!cn(Ae,Nt)&&(qe===lt||se(qe,lt,P,U,V)))return Ae.push(Nt)})){Ve=!1;break}}else if(!(qe===Ge||se(qe,Ge,P,U,V))){Ve=!1;break}}return V.delete(g),V.delete(_),Ve}function jf(g,_,P,U,se,V,ce){switch(P){case H:if(g.byteLength!=_.byteLength||g.byteOffset!=_.byteOffset)return!1;g=g.buffer,_=_.buffer;case q:return!(g.byteLength!=_.byteLength||!V(new Ao(g),new Ao(_)));case c:case f:case E:return No(+g,+_);case h:return g.name==_.name&&g.message==_.message;case Q:case Y:return g==_+"";case y:var ye=un;case ee:var Ee=U&i;if(ye||(ye=Zu),g.size!=_.size&&!Ee)return!1;var oe=ce.get(g);if(oe)return oe==_;U|=s,ce.set(g,_);var Be=Ro(ye(g),ye(_),U,se,V,ce);return ce.delete(g),Be;case ue:if(Ni)return Ni.call(g)==Ni.call(_)}return!1}function Bf(g,_,P,U,se,V){var ce=P&i,ye=Do(g),Ee=ye.length,oe=Do(_),Be=oe.length;if(Ee!=Be&&!ce)return!1;for(var Ve=Ee;Ve--;){var Ae=ye[Ve];if(!(ce?Ae in _:nt.call(_,Ae)))return!1}var qe=V.get(g);if(qe&&V.get(_))return qe==_;var Ge=!0;V.set(g,_),V.set(_,g);for(var pt=ce;++Ve<Ee;){Ae=ye[Ve];var lt=g[Ae],Nt=_[Ae];if(U)var ko=ce?U(Nt,lt,Ae,_,g,V):U(lt,Nt,Ae,g,_,V);if(!(ko===void 0?lt===Nt||se(lt,Nt,P,U,V):ko)){Ge=!1;break}pt||(pt=Ae=="constructor")}if(Ge&&!pt){var yn=g.constructor,vn=_.constructor;yn!=vn&&"constructor"in g&&"constructor"in _&&!(typeof yn=="function"&&yn instanceof yn&&typeof vn=="function"&&vn instanceof vn)&&(Ge=!1)}return V.delete(g),V.delete(_),Ge}function Do(g){return Ff(g,Qf,qf)}function mn(g,_){var P=g.__data__;return Wf(_)?P[typeof _=="string"?"string":"hash"]:P.map}function Vt(g,_){var P=yr(g,_);return kf(P)?P:void 0}function Hf(g){var _=nt.call(g,Pt),P=g[Pt];try{g[Pt]=void 0;var U=!0}catch{}var se=So.call(g);return U&&(_?g[Pt]=P:delete g[Pt]),se}var qf=bo?function(g){return g==null?[]:(g=Object(g),Ce(bo(g),function(_){return To.call(g,_)}))}:Zf,ht=Er;(Pi&&ht(new Pi(new ArrayBuffer(1)))!=H||vr&&ht(new vr)!=y||Oi&&ht(Oi.resolve())!=R||Ri&&ht(new Ri)!=ee||Di&&ht(new Di)!=G)&&(ht=function(g){var _=Er(g),P=_==A?g.constructor:void 0,U=P?Dt(P):"";if(U)switch(U){case af:return H;case lf:return y;case cf:return R;case uf:return ee;case ff:return G}return _});function Gf(g,_){return _=_??o,!!_&&(typeof g=="number"||ge.test(g))&&g>-1&&g%1==0&&g<_}function Wf(g){var _=typeof g;return _=="string"||_=="number"||_=="symbol"||_=="boolean"?g!=="__proto__":g===null}function zf(g){return!!_o&&_o in g}function Vf(g){var _=g&&g.constructor,P=typeof _=="function"&&_.prototype||fn;return g===P}function Yf(g){return So.call(g)}function Dt(g){if(g!=null){try{return Eo.call(g)}catch{}try{return g+""}catch{}}return""}function No(g,_){return g===_||g!==g&&_!==_}var Jf=Po(function(){return arguments}())?Po:function(g){return _r(g)&&nt.call(g,"callee")&&!To.call(g,"callee")},gn=Array.isArray;function Xf(g){return g!=null&&xo(g.length)&&!$o(g)}var $i=sf||ed;function Kf(g,_){return Oo(g,_)}function $o(g){if(!Fo(g))return!1;var _=Er(g);return _==p||_==w||_==u||_==L}function xo(g){return typeof g=="number"&&g>-1&&g%1==0&&g<=o}function Fo(g){var _=typeof g;return g!=null&&(_=="object"||_=="function")}function _r(g){return g!=null&&typeof g=="object"}var Lo=we?bi(we):Uf;function Qf(g){return Xf(g)?xf(g):Mf(g)}function Zf(){return[]}function ed(){return!1}e.exports=Kf})(Zn,Zn.exports);var nE=Zn.exports;Object.defineProperty(sn,"__esModule",{value:!0});sn.DownloadedUpdateHelper=void 0;sn.createTempUpdateFile=lE;const iE=Xr,sE=F,Qa=nE,Ft=bt,Dr=D;class oE{constructor(t){this.cacheDir=t,this._file=null,this._packageFile=null,this.versionInfo=null,this.fileInfo=null,this._downloadedFileInfo=null}get downloadedFileInfo(){return this._downloadedFileInfo}get file(){return this._file}get packageFile(){return this._packageFile}get cacheDirForPendingUpdate(){return Dr.join(this.cacheDir,"pending")}async validateDownloadedPath(t,r,n,i){if(this.versionInfo!=null&&this.file===t&&this.fileInfo!=null)return Qa(this.versionInfo,r)&&Qa(this.fileInfo.info,n.info)&&await(0,Ft.pathExists)(t)?t:null;const s=await this.getValidCachedUpdateFile(n,i);return s===null?null:(i.info(`Update has already been downloaded to ${t}).`),this._file=s,s)}async setDownloadedFile(t,r,n,i,s,o){this._file=t,this._packageFile=r,this.versionInfo=n,this.fileInfo=i,this._downloadedFileInfo={fileName:s,sha512:i.info.sha512,isAdminRightsRequired:i.info.isAdminRightsRequired===!0},o&&await(0,Ft.outputJson)(this.getUpdateInfoFile(),this._downloadedFileInfo)}async clear(){this._file=null,this._packageFile=null,this.versionInfo=null,this.fileInfo=null,await this.cleanCacheDirForPendingUpdate()}async cleanCacheDirForPendingUpdate(){try{await(0,Ft.emptyDir)(this.cacheDirForPendingUpdate)}catch{}}async getValidCachedUpdateFile(t,r){const n=this.getUpdateInfoFile();if(!await(0,Ft.pathExists)(n))return null;let s;try{s=await(0,Ft.readJson)(n)}catch(u){let c="No cached update info available";return u.code!=="ENOENT"&&(await this.cleanCacheDirForPendingUpdate(),c+=` (error on read: ${u.message})`),r.info(c),null}if(!((s==null?void 0:s.fileName)!==null))return r.warn("Cached update info is corrupted: no fileName, directory for cached update will be cleaned"),await this.cleanCacheDirForPendingUpdate(),null;if(t.info.sha512!==s.sha512)return r.info(`Cached update sha512 checksum doesn't match the latest available update. New update must be downloaded. Cached: ${s.sha512}, expected: ${t.info.sha512}. Directory for cached update will be cleaned`),await this.cleanCacheDirForPendingUpdate(),null;const a=Dr.join(this.cacheDirForPendingUpdate,s.fileName);if(!await(0,Ft.pathExists)(a))return r.info("Cached update file doesn't exist"),null;const l=await aE(a);return t.info.sha512!==l?(r.warn(`Sha512 checksum doesn't match the latest available update. New update must be downloaded. Cached: ${l}, expected: ${t.info.sha512}`),await this.cleanCacheDirForPendingUpdate(),null):(this._downloadedFileInfo=s,a)}getUpdateInfoFile(){return Dr.join(this.cacheDirForPendingUpdate,"update-info.json")}}sn.DownloadedUpdateHelper=oE;function aE(e,t="sha512",r="base64",n){return new Promise((i,s)=>{const o=(0,iE.createHash)(t);o.on("error",s).setEncoding(r),(0,sE.createReadStream)(e,{...n,highWaterMark:1024*1024}).on("error",s).on("end",()=>{o.end(),i(o.read())}).pipe(o,{end:!1})})}async function lE(e,t,r){let n=0,i=Dr.join(t,e);for(let s=0;s<3;s++)try{return await(0,Ft.unlink)(i),i}catch(o){if(o.code==="ENOENT")return i;r.warn(`Error on remove temp update file: ${o}`),i=Dr.join(t,`${n++}-${e}`)}return i}var yi={},ho={};Object.defineProperty(ho,"__esModule",{value:!0});ho.getAppCacheDir=uE;const ns=D,cE=ne;function uE(){const e=(0,cE.homedir)();let t;return process.platform==="win32"?t=process.env.LOCALAPPDATA||ns.join(e,"AppData","Local"):process.platform==="darwin"?t=ns.join(e,"Library","Caches"):t=process.env.XDG_CACHE_HOME||ns.join(e,".cache"),t}Object.defineProperty(yi,"__esModule",{value:!0});yi.ElectronAppAdapter=void 0;const Za=D,fE=ho;class dE{constructor(t=$.app){this.app=t}whenReady(){return this.app.whenReady()}get version(){return this.app.getVersion()}get name(){return this.app.getName()}get isPackaged(){return this.app.isPackaged===!0}get appUpdateConfigPath(){return this.isPackaged?Za.join(process.resourcesPath,"app-update.yml"):Za.join(this.app.getAppPath(),"dev-app-update.yml")}get userDataPath(){return this.app.getPath("userData")}get baseCachePath(){return(0,fE.getAppCacheDir)()}quit(){this.app.quit()}relaunch(){this.app.relaunch()}onQuit(t){this.app.once("quit",(r,n)=>t(n))}}yi.ElectronAppAdapter=dE;var Uu={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ElectronHttpExecutor=e.NET_SESSION_NAME=void 0,e.getNetSession=r;const t=me;e.NET_SESSION_NAME="electron-updater";function r(){return $.session.fromPartition(e.NET_SESSION_NAME,{cache:!1})}class n extends t.HttpExecutor{constructor(s){super(),this.proxyLoginCallback=s,this.cachedSession=null}async download(s,o,a){return await a.cancellationToken.createPromise((l,u,c)=>{const f={headers:a.headers||void 0,redirect:"manual"};(0,t.configureRequestUrl)(s,f),(0,t.configureRequestOptions)(f),this.doDownload(f,{destination:o,options:a,onCancel:c,callback:h=>{h==null?l(o):u(h)},responseHandler:null},0)})}createRequest(s,o){s.headers&&s.headers.Host&&(s.host=s.headers.Host,delete s.headers.Host),this.cachedSession==null&&(this.cachedSession=r());const a=$.net.request({...s,session:this.cachedSession});return a.on("response",o),this.proxyLoginCallback!=null&&a.on("login",this.proxyLoginCallback),a}addRedirectHandlers(s,o,a,l,u){s.on("redirect",(c,f,h)=>{s.abort(),l>this.maxRedirects?a(this.createMaxRedirectError()):u(t.HttpExecutor.prepareRedirectUrlOptions(h,o))})}}e.ElectronHttpExecutor=n})(Uu);var on={},tt={};Object.defineProperty(tt,"__esModule",{value:!0});tt.newBaseUrl=hE;tt.newUrlFromBase=pE;tt.getChannelFilename=mE;const Mu=We;function hE(e){const t=new Mu.URL(e);return t.pathname.endsWith("/")||(t.pathname+="/"),t}function pE(e,t,r=!1){const n=new Mu.URL(e,t),i=t.search;return i!=null&&i.length!==0?n.search=i:r&&(n.search=`noCache=${Date.now().toString(32)}`),n}function mE(e){return`${e}.yml`}var he={},gE="[object Symbol]",ju=/[\\^$.*+?()[\]{}|]/g,yE=RegExp(ju.source),vE=typeof De=="object"&&De&&De.Object===Object&&De,wE=typeof self=="object"&&self&&self.Object===Object&&self,EE=vE||wE||Function("return this")(),_E=Object.prototype,SE=_E.toString,el=EE.Symbol,tl=el?el.prototype:void 0,rl=tl?tl.toString:void 0;function CE(e){if(typeof e=="string")return e;if(TE(e))return rl?rl.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function AE(e){return!!e&&typeof e=="object"}function TE(e){return typeof e=="symbol"||AE(e)&&SE.call(e)==gE}function bE(e){return e==null?"":CE(e)}function IE(e){return e=bE(e),e&&yE.test(e)?e.replace(ju,"\\$&"):e}var Bu=IE;Object.defineProperty(he,"__esModule",{value:!0});he.Provider=void 0;he.findFile=NE;he.parseUpdateInfo=$E;he.getFileList=Hu;he.resolveFiles=xE;const At=me,PE=Se,OE=We,ei=tt,RE=Bu;class DE{constructor(t){this.runtimeOptions=t,this.requestHeaders=null,this.executor=t.executor}getBlockMapFiles(t,r,n,i=null){const s=(0,ei.newUrlFromBase)(`${t.pathname}.blockmap`,t);return[(0,ei.newUrlFromBase)(`${t.pathname.replace(new RegExp(RE(n),"g"),r)}.blockmap`,i?new OE.URL(i):t),s]}get isUseMultipleRangeRequest(){return this.runtimeOptions.isUseMultipleRangeRequest!==!1}getChannelFilePrefix(){if(this.runtimeOptions.platform==="linux"){const t=process.env.TEST_UPDATER_ARCH||process.arch;return"-linux"+(t==="x64"?"":`-${t}`)}else return this.runtimeOptions.platform==="darwin"?"-mac":""}getDefaultChannelName(){return this.getCustomChannelName("latest")}getCustomChannelName(t){return`${t}${this.getChannelFilePrefix()}`}get fileExtraDownloadHeaders(){return null}setRequestHeaders(t){this.requestHeaders=t}httpRequest(t,r,n){return this.executor.request(this.createRequestOptions(t,r),n)}createRequestOptions(t,r){const n={};return this.requestHeaders==null?r!=null&&(n.headers=r):n.headers=r==null?this.requestHeaders:{...this.requestHeaders,...r},(0,At.configureRequestUrl)(t,n),n}}he.Provider=DE;function NE(e,t,r){var n;if(e.length===0)throw(0,At.newError)("No files provided","ERR_UPDATER_NO_FILES_PROVIDED");const i=e.filter(o=>o.url.pathname.toLowerCase().endsWith(`.${t.toLowerCase()}`)),s=(n=i.find(o=>[o.url.pathname,o.info.url].some(a=>a.includes(process.arch))))!==null&&n!==void 0?n:i.shift();return s||(r==null?e[0]:e.find(o=>!r.some(a=>o.url.pathname.toLowerCase().endsWith(`.${a.toLowerCase()}`))))}function $E(e,t,r){if(e==null)throw(0,At.newError)(`Cannot parse update info from ${t} in the latest release artifacts (${r}): rawData: null`,"ERR_UPDATER_INVALID_UPDATE_INFO");let n;try{n=(0,PE.load)(e)}catch(i){throw(0,At.newError)(`Cannot parse update info from ${t} in the latest release artifacts (${r}): ${i.stack||i.message}, rawData: ${e}`,"ERR_UPDATER_INVALID_UPDATE_INFO")}return n}function Hu(e){const t=e.files;if(t!=null&&t.length>0)return t;if(e.path!=null)return[{url:e.path,sha2:e.sha2,sha512:e.sha512}];throw(0,At.newError)(`No files provided: ${(0,At.safeStringifyJson)(e)}`,"ERR_UPDATER_NO_FILES_PROVIDED")}function xE(e,t,r=n=>n){const i=Hu(e).map(a=>{if(a.sha2==null&&a.sha512==null)throw(0,At.newError)(`Update info doesn't contain nor sha256 neither sha512 checksum: ${(0,At.safeStringifyJson)(a)}`,"ERR_UPDATER_NO_CHECKSUM");return{url:(0,ei.newUrlFromBase)(r(a.url),t),info:a}}),s=e.packages,o=s==null?null:s[process.arch]||s.ia32;return o!=null&&(i[0].packageInfo={...o,path:(0,ei.newUrlFromBase)(r(o.path),t).href}),i}Object.defineProperty(on,"__esModule",{value:!0});on.GenericProvider=void 0;const nl=me,is=tt,ss=he;class FE extends ss.Provider{constructor(t,r,n){super(n),this.configuration=t,this.updater=r,this.baseUrl=(0,is.newBaseUrl)(this.configuration.url)}get channel(){const t=this.updater.channel||this.configuration.channel;return t==null?this.getDefaultChannelName():this.getCustomChannelName(t)}async getLatestVersion(){const t=(0,is.getChannelFilename)(this.channel),r=(0,is.newUrlFromBase)(t,this.baseUrl,this.updater.isAddNoCacheQuery);for(let n=0;;n++)try{return(0,ss.parseUpdateInfo)(await this.httpRequest(r),t,r)}catch(i){if(i instanceof nl.HttpError&&i.statusCode===404)throw(0,nl.newError)(`Cannot find channel "${t}" update info: ${i.stack||i.message}`,"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");if(i.code==="ECONNREFUSED"&&n<3){await new Promise((s,o)=>{try{setTimeout(s,1e3*n)}catch(a){o(a)}});continue}throw i}}resolveFiles(t){return(0,ss.resolveFiles)(t,this.baseUrl)}}on.GenericProvider=FE;var vi={},wi={};Object.defineProperty(wi,"__esModule",{value:!0});wi.BitbucketProvider=void 0;const il=me,os=tt,as=he;class LE extends as.Provider{constructor(t,r,n){super({...n,isUseMultipleRangeRequest:!1}),this.configuration=t,this.updater=r;const{owner:i,slug:s}=t;this.baseUrl=(0,os.newBaseUrl)(`https://api.bitbucket.org/2.0/repositories/${i}/${s}/downloads`)}get channel(){return this.updater.channel||this.configuration.channel||"latest"}async getLatestVersion(){const t=new il.CancellationToken,r=(0,os.getChannelFilename)(this.getCustomChannelName(this.channel)),n=(0,os.newUrlFromBase)(r,this.baseUrl,this.updater.isAddNoCacheQuery);try{const i=await this.httpRequest(n,void 0,t);return(0,as.parseUpdateInfo)(i,r,n)}catch(i){throw(0,il.newError)(`Unable to find latest version on ${this.toString()}, please ensure release exists: ${i.stack||i.message}`,"ERR_UPDATER_LATEST_VERSION_NOT_FOUND")}}resolveFiles(t){return(0,as.resolveFiles)(t,this.baseUrl)}toString(){const{owner:t,slug:r}=this.configuration;return`Bitbucket (owner: ${t}, slug: ${r}, channel: ${this.channel})`}}wi.BitbucketProvider=LE;var Tt={};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.GitHubProvider=Tt.BaseGitHubProvider=void 0;Tt.computeReleaseNotes=Gu;const ct=me,Ut=ku,kE=We,ir=tt,Ns=he,ls=/\/tag\/([^/]+)$/;class qu extends Ns.Provider{constructor(t,r,n){super({...n,isUseMultipleRangeRequest:!1}),this.options=t,this.baseUrl=(0,ir.newBaseUrl)((0,ct.githubUrl)(t,r));const i=r==="github.com"?"api.github.com":r;this.baseApiUrl=(0,ir.newBaseUrl)((0,ct.githubUrl)(t,i))}computeGithubBasePath(t){const r=this.options.host;return r&&!["github.com","api.github.com"].includes(r)?`/api/v3${t}`:t}}Tt.BaseGitHubProvider=qu;class UE extends qu{constructor(t,r,n){super(t,"github.com",n),this.options=t,this.updater=r}get channel(){const t=this.updater.channel||this.options.channel;return t==null?this.getDefaultChannelName():this.getCustomChannelName(t)}async getLatestVersion(){var t,r,n,i,s;const o=new ct.CancellationToken,a=await this.httpRequest((0,ir.newUrlFromBase)(`${this.basePath}.atom`,this.baseUrl),{accept:"application/xml, application/atom+xml, text/xml, */*"},o),l=(0,ct.parseXml)(a);let u=l.element("entry",!1,"No published versions on GitHub"),c=null;try{if(this.updater.allowPrerelease){const E=((t=this.updater)===null||t===void 0?void 0:t.channel)||((r=Ut.prerelease(this.updater.currentVersion))===null||r===void 0?void 0:r[0])||null;if(E===null)c=ls.exec(u.element("link").attribute("href"))[1];else for(const C of l.getElements("entry")){const A=ls.exec(C.element("link").attribute("href"));if(A===null)continue;const R=A[1],L=((n=Ut.prerelease(R))===null||n===void 0?void 0:n[0])||null,Q=!E||["alpha","beta"].includes(E),ee=L!==null&&!["alpha","beta"].includes(String(L));if(Q&&!ee&&!(E==="beta"&&L==="alpha")){c=R;break}if(L&&L===E){c=R;break}}}else{c=await this.getLatestTagName(o);for(const E of l.getElements("entry"))if(ls.exec(E.element("link").attribute("href"))[1]===c){u=E;break}}}catch(E){throw(0,ct.newError)(`Cannot parse releases feed: ${E.stack||E.message},
125
+ XML:
126
+ ${a}`,"ERR_UPDATER_INVALID_RELEASE_FEED")}if(c==null)throw(0,ct.newError)("No published versions on GitHub","ERR_UPDATER_NO_PUBLISHED_VERSIONS");let f,h="",p="";const w=async E=>{h=(0,ir.getChannelFilename)(E),p=(0,ir.newUrlFromBase)(this.getBaseDownloadPath(String(c),h),this.baseUrl);const C=this.createRequestOptions(p);try{return await this.executor.request(C,o)}catch(A){throw A instanceof ct.HttpError&&A.statusCode===404?(0,ct.newError)(`Cannot find ${h} in the latest release artifacts (${p}): ${A.stack||A.message}`,"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND"):A}};try{let E=this.channel;this.updater.allowPrerelease&&(!((i=Ut.prerelease(c))===null||i===void 0)&&i[0])&&(E=this.getCustomChannelName(String((s=Ut.prerelease(c))===null||s===void 0?void 0:s[0]))),f=await w(E)}catch(E){if(this.updater.allowPrerelease)f=await w(this.getDefaultChannelName());else throw E}const y=(0,Ns.parseUpdateInfo)(f,h,p);return y.releaseName==null&&(y.releaseName=u.elementValueOrEmpty("title")),y.releaseNotes==null&&(y.releaseNotes=Gu(this.updater.currentVersion,this.updater.fullChangelog,l,u)),{tag:c,...y}}async getLatestTagName(t){const r=this.options,n=r.host==null||r.host==="github.com"?(0,ir.newUrlFromBase)(`${this.basePath}/latest`,this.baseUrl):new kE.URL(`${this.computeGithubBasePath(`/repos/${r.owner}/${r.repo}/releases`)}/latest`,this.baseApiUrl);try{const i=await this.httpRequest(n,{Accept:"application/json"},t);return i==null?null:JSON.parse(i).tag_name}catch(i){throw(0,ct.newError)(`Unable to find latest version on GitHub (${n}), please ensure a production release exists: ${i.stack||i.message}`,"ERR_UPDATER_LATEST_VERSION_NOT_FOUND")}}get basePath(){return`/${this.options.owner}/${this.options.repo}/releases`}resolveFiles(t){return(0,Ns.resolveFiles)(t,this.baseUrl,r=>this.getBaseDownloadPath(t.tag,r.replace(/ /g,"-")))}getBaseDownloadPath(t,r){return`${this.basePath}/download/${t}/${r}`}}Tt.GitHubProvider=UE;function sl(e){const t=e.elementValueOrEmpty("content");return t==="No content."?"":t}function Gu(e,t,r,n){if(!t)return sl(n);const i=[];for(const s of r.getElements("entry")){const o=/\/tag\/v?([^/]+)$/.exec(s.element("link").attribute("href"))[1];Ut.valid(o)&&Ut.lt(e,o)&&i.push({version:o,note:sl(s)})}return i.sort((s,o)=>Ut.rcompare(s.version,o.version))}var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.GitLabProvider=void 0;const Oe=me,cs=We,ME=Bu,Nn=tt,us=he;class jE extends us.Provider{normalizeFilename(t){return t.replace(/ |_/g,"-")}constructor(t,r,n){super({...n,isUseMultipleRangeRequest:!1}),this.options=t,this.updater=r,this.cachedLatestVersion=null;const s=t.host||"gitlab.com";this.baseApiUrl=(0,Nn.newBaseUrl)(`https://${s}/api/v4`)}get channel(){const t=this.updater.channel||this.options.channel;return t==null?this.getDefaultChannelName():this.getCustomChannelName(t)}async getLatestVersion(){const t=new Oe.CancellationToken,r=(0,Nn.newUrlFromBase)(`projects/${this.options.projectId}/releases/permalink/latest`,this.baseApiUrl);let n;try{const h={"Content-Type":"application/json",...this.setAuthHeaderForToken(this.options.token||null)},p=await this.httpRequest(r,h,t);if(!p)throw(0,Oe.newError)("No latest release found","ERR_UPDATER_NO_PUBLISHED_VERSIONS");n=JSON.parse(p)}catch(h){throw(0,Oe.newError)(`Unable to find latest release on GitLab (${r}): ${h.stack||h.message}`,"ERR_UPDATER_LATEST_VERSION_NOT_FOUND")}const i=n.tag_name;let s=null,o="",a=null;const l=async h=>{o=(0,Nn.getChannelFilename)(h);const p=n.assets.links.find(y=>y.name===o);if(!p)throw(0,Oe.newError)(`Cannot find ${o} in the latest release assets`,"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");a=new cs.URL(p.direct_asset_url);const w=this.options.token?{"PRIVATE-TOKEN":this.options.token}:void 0;try{const y=await this.httpRequest(a,w,t);if(!y)throw(0,Oe.newError)(`Empty response from ${a}`,"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");return y}catch(y){throw y instanceof Oe.HttpError&&y.statusCode===404?(0,Oe.newError)(`Cannot find ${o} in the latest release artifacts (${a}): ${y.stack||y.message}`,"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND"):y}};try{s=await l(this.channel)}catch(h){if(this.channel!==this.getDefaultChannelName())s=await l(this.getDefaultChannelName());else throw h}if(!s)throw(0,Oe.newError)(`Unable to parse channel data from ${o}`,"ERR_UPDATER_INVALID_UPDATE_INFO");const u=(0,us.parseUpdateInfo)(s,o,a);u.releaseName==null&&(u.releaseName=n.name),u.releaseNotes==null&&(u.releaseNotes=n.description||null);const c=new Map;for(const h of n.assets.links)c.set(this.normalizeFilename(h.name),h.direct_asset_url);const f={tag:i,assets:c,...u};return this.cachedLatestVersion=f,f}convertAssetsToMap(t){const r=new Map;for(const n of t.links)r.set(this.normalizeFilename(n.name),n.direct_asset_url);return r}findBlockMapInAssets(t,r){const n=[`${r}.blockmap`,`${this.normalizeFilename(r)}.blockmap`];for(const i of n){const s=t.get(i);if(s)return new cs.URL(s)}return null}async fetchReleaseInfoByVersion(t){const r=new Oe.CancellationToken,n=[`v${t}`,t];for(const i of n){const s=(0,Nn.newUrlFromBase)(`projects/${this.options.projectId}/releases/${encodeURIComponent(i)}`,this.baseApiUrl);try{const o={"Content-Type":"application/json",...this.setAuthHeaderForToken(this.options.token||null)},a=await this.httpRequest(s,o,r);if(a)return JSON.parse(a)}catch(o){if(o instanceof Oe.HttpError&&o.statusCode===404)continue;throw(0,Oe.newError)(`Unable to find release ${i} on GitLab (${s}): ${o.stack||o.message}`,"ERR_UPDATER_RELEASE_NOT_FOUND")}}throw(0,Oe.newError)(`Unable to find release with version ${t} (tried: ${n.join(", ")}) on GitLab`,"ERR_UPDATER_RELEASE_NOT_FOUND")}setAuthHeaderForToken(t){const r={};return t!=null&&(t.startsWith("Bearer")?r.authorization=t:r["PRIVATE-TOKEN"]=t),r}async getVersionInfoForBlockMap(t){if(this.cachedLatestVersion&&this.cachedLatestVersion.version===t)return this.cachedLatestVersion.assets;const r=await this.fetchReleaseInfoByVersion(t);return r&&r.assets?this.convertAssetsToMap(r.assets):null}async findBlockMapUrlsFromAssets(t,r,n){let i=null,s=null;const o=await this.getVersionInfoForBlockMap(r);o&&(i=this.findBlockMapInAssets(o,n));const a=await this.getVersionInfoForBlockMap(t);if(a){const l=n.replace(new RegExp(ME(r),"g"),t);s=this.findBlockMapInAssets(a,l)}return[s,i]}async getBlockMapFiles(t,r,n,i=null){if(this.options.uploadTarget==="project_upload"){const s=t.pathname.split("/").pop()||"",[o,a]=await this.findBlockMapUrlsFromAssets(r,n,s);if(!a)throw(0,Oe.newError)(`Cannot find blockmap file for ${n} in GitLab assets`,"ERR_UPDATER_BLOCKMAP_FILE_NOT_FOUND");if(!o)throw(0,Oe.newError)(`Cannot find blockmap file for ${r} in GitLab assets`,"ERR_UPDATER_BLOCKMAP_FILE_NOT_FOUND");return[o,a]}else return super.getBlockMapFiles(t,r,n,i)}resolveFiles(t){return(0,us.getFileList)(t).map(r=>{const i=[r.url,this.normalizeFilename(r.url)].find(o=>t.assets.has(o)),s=i?t.assets.get(i):void 0;if(!s)throw(0,Oe.newError)(`Cannot find asset "${r.url}" in GitLab release assets. Available assets: ${Array.from(t.assets.keys()).join(", ")}`,"ERR_UPDATER_ASSET_NOT_FOUND");return{url:new cs.URL(s),info:r}})}toString(){return`GitLab (projectId: ${this.options.projectId}, channel: ${this.channel})`}}Ei.GitLabProvider=jE;var _i={};Object.defineProperty(_i,"__esModule",{value:!0});_i.KeygenProvider=void 0;const ol=me,fs=tt,ds=he;class BE extends ds.Provider{constructor(t,r,n){super({...n,isUseMultipleRangeRequest:!1}),this.configuration=t,this.updater=r,this.defaultHostname="api.keygen.sh";const i=this.configuration.host||this.defaultHostname;this.baseUrl=(0,fs.newBaseUrl)(`https://${i}/v1/accounts/${this.configuration.account}/artifacts?product=${this.configuration.product}`)}get channel(){return this.updater.channel||this.configuration.channel||"stable"}async getLatestVersion(){const t=new ol.CancellationToken,r=(0,fs.getChannelFilename)(this.getCustomChannelName(this.channel)),n=(0,fs.newUrlFromBase)(r,this.baseUrl,this.updater.isAddNoCacheQuery);try{const i=await this.httpRequest(n,{Accept:"application/vnd.api+json","Keygen-Version":"1.1"},t);return(0,ds.parseUpdateInfo)(i,r,n)}catch(i){throw(0,ol.newError)(`Unable to find latest version on ${this.toString()}, please ensure release exists: ${i.stack||i.message}`,"ERR_UPDATER_LATEST_VERSION_NOT_FOUND")}}resolveFiles(t){return(0,ds.resolveFiles)(t,this.baseUrl)}toString(){const{account:t,product:r,platform:n}=this.configuration;return`Keygen (account: ${t}, product: ${r}, platform: ${n}, channel: ${this.channel})`}}_i.KeygenProvider=BE;var Si={};Object.defineProperty(Si,"__esModule",{value:!0});Si.PrivateGitHubProvider=void 0;const Kt=me,HE=Se,qE=D,al=We,ll=tt,GE=Tt,WE=he;class zE extends GE.BaseGitHubProvider{constructor(t,r,n,i){super(t,"api.github.com",i),this.updater=r,this.token=n}createRequestOptions(t,r){const n=super.createRequestOptions(t,r);return n.redirect="manual",n}async getLatestVersion(){const t=new Kt.CancellationToken,r=(0,ll.getChannelFilename)(this.getDefaultChannelName()),n=await this.getLatestVersionInfo(t),i=n.assets.find(a=>a.name===r);if(i==null)throw(0,Kt.newError)(`Cannot find ${r} in the release ${n.html_url||n.name}`,"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");const s=new al.URL(i.url);let o;try{o=(0,HE.load)(await this.httpRequest(s,this.configureHeaders("application/octet-stream"),t))}catch(a){throw a instanceof Kt.HttpError&&a.statusCode===404?(0,Kt.newError)(`Cannot find ${r} in the latest release artifacts (${s}): ${a.stack||a.message}`,"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND"):a}return o.assets=n.assets,o}get fileExtraDownloadHeaders(){return this.configureHeaders("application/octet-stream")}configureHeaders(t){return{accept:t,authorization:`token ${this.token}`}}async getLatestVersionInfo(t){const r=this.updater.allowPrerelease;let n=this.basePath;r||(n=`${n}/latest`);const i=(0,ll.newUrlFromBase)(n,this.baseUrl);try{const s=JSON.parse(await this.httpRequest(i,this.configureHeaders("application/vnd.github.v3+json"),t));return r?s.find(o=>o.prerelease)||s[0]:s}catch(s){throw(0,Kt.newError)(`Unable to find latest version on GitHub (${i}), please ensure a production release exists: ${s.stack||s.message}`,"ERR_UPDATER_LATEST_VERSION_NOT_FOUND")}}get basePath(){return this.computeGithubBasePath(`/repos/${this.options.owner}/${this.options.repo}/releases`)}resolveFiles(t){return(0,WE.getFileList)(t).map(r=>{const n=qE.posix.basename(r.url).replace(/ /g,"-"),i=t.assets.find(s=>s!=null&&s.name===n);if(i==null)throw(0,Kt.newError)(`Cannot find asset "${n}" in: ${JSON.stringify(t.assets,null,2)}`,"ERR_UPDATER_ASSET_NOT_FOUND");return{url:new al.URL(i.url),info:r}})}}Si.PrivateGitHubProvider=zE;Object.defineProperty(vi,"__esModule",{value:!0});vi.isUrlProbablySupportMultiRangeRequests=Wu;vi.createClient=QE;const $n=me,VE=wi,cl=on,YE=Tt,JE=Ei,XE=_i,KE=Si;function Wu(e){return!e.includes("s3.amazonaws.com")}function QE(e,t,r){if(typeof e=="string")throw(0,$n.newError)("Please pass PublishConfiguration object","ERR_UPDATER_INVALID_PROVIDER_CONFIGURATION");const n=e.provider;switch(n){case"github":{const i=e,s=(i.private?process.env.GH_TOKEN||process.env.GITHUB_TOKEN:null)||i.token;return s==null?new YE.GitHubProvider(i,t,r):new KE.PrivateGitHubProvider(i,t,s,r)}case"bitbucket":return new VE.BitbucketProvider(e,t,r);case"gitlab":return new JE.GitLabProvider(e,t,r);case"keygen":return new XE.KeygenProvider(e,t,r);case"s3":case"spaces":return new cl.GenericProvider({provider:"generic",url:(0,$n.getS3LikeProviderBaseUrl)(e),channel:e.channel||null},t,{...r,isUseMultipleRangeRequest:!1});case"generic":{const i=e;return new cl.GenericProvider(i,t,{...r,isUseMultipleRangeRequest:i.useMultipleRangeRequest!==!1&&Wu(i.url)})}case"custom":{const i=e,s=i.updateProvider;if(!s)throw(0,$n.newError)("Custom provider not specified","ERR_UPDATER_INVALID_PROVIDER_CONFIGURATION");return new s(i,t,r)}default:throw(0,$n.newError)(`Unsupported provider: ${n}`,"ERR_UPDATER_UNSUPPORTED_PROVIDER")}}var Ci={},an={},mr={},zt={};Object.defineProperty(zt,"__esModule",{value:!0});zt.OperationKind=void 0;zt.computeOperations=ZE;var Mt;(function(e){e[e.COPY=0]="COPY",e[e.DOWNLOAD=1]="DOWNLOAD"})(Mt||(zt.OperationKind=Mt={}));function ZE(e,t,r){const n=fl(e.files),i=fl(t.files);let s=null;const o=t.files[0],a=[],l=o.name,u=n.get(l);if(u==null)throw new Error(`no file ${l} in old blockmap`);const c=i.get(l);let f=0;const{checksumToOffset:h,checksumToOldSize:p}=t_(n.get(l),u.offset,r);let w=o.offset;for(let y=0;y<c.checksums.length;w+=c.sizes[y],y++){const E=c.sizes[y],C=c.checksums[y];let A=h.get(C);A!=null&&p.get(C)!==E&&(r.warn(`Checksum ("${C}") matches, but size differs (old: ${p.get(C)}, new: ${E})`),A=void 0),A===void 0?(f++,s!=null&&s.kind===Mt.DOWNLOAD&&s.end===w?s.end+=E:(s={kind:Mt.DOWNLOAD,start:w,end:w+E},ul(s,a,C,y))):s!=null&&s.kind===Mt.COPY&&s.end===A?s.end+=E:(s={kind:Mt.COPY,start:A,end:A+E},ul(s,a,C,y))}return f>0&&r.info(`File${o.name==="file"?"":" "+o.name} has ${f} changed blocks`),a}const e_=process.env.DIFFERENTIAL_DOWNLOAD_PLAN_BUILDER_VALIDATE_RANGES==="true";function ul(e,t,r,n){if(e_&&t.length!==0){const i=t[t.length-1];if(i.kind===e.kind&&e.start<i.end&&e.start>i.start){const s=[i.start,i.end,e.start,e.end].reduce((o,a)=>o<a?o:a);throw new Error(`operation (block index: ${n}, checksum: ${r}, kind: ${Mt[e.kind]}) overlaps previous operation (checksum: ${r}):
127
+ abs: ${i.start} until ${i.end} and ${e.start} until ${e.end}
128
+ rel: ${i.start-s} until ${i.end-s} and ${e.start-s} until ${e.end-s}`)}}t.push(e)}function t_(e,t,r){const n=new Map,i=new Map;let s=t;for(let o=0;o<e.checksums.length;o++){const a=e.checksums[o],l=e.sizes[o],u=i.get(a);if(u===void 0)n.set(a,s),i.set(a,l);else if(r.debug!=null){const c=u===l?"(same size)":`(size: ${u}, this size: ${l})`;r.debug(`${a} duplicated in blockmap ${c}, it doesn't lead to broken differential downloader, just corresponding block will be skipped)`)}s+=l}return{checksumToOffset:n,checksumToOldSize:i}}function fl(e){const t=new Map;for(const r of e)t.set(r.name,r);return t}Object.defineProperty(mr,"__esModule",{value:!0});mr.DataSplitter=void 0;mr.copyData=zu;const xn=me,r_=F,n_=Jr,i_=zt,dl=Buffer.from(`\r
129
+ \r
130
+ `);var gt;(function(e){e[e.INIT=0]="INIT",e[e.HEADER=1]="HEADER",e[e.BODY=2]="BODY"})(gt||(gt={}));function zu(e,t,r,n,i){const s=(0,r_.createReadStream)("",{fd:r,autoClose:!1,start:e.start,end:e.end-1});s.on("error",n),s.once("end",i),s.pipe(t,{end:!1})}class s_ extends n_.Writable{constructor(t,r,n,i,s,o,a,l){super(),this.out=t,this.options=r,this.partIndexToTaskIndex=n,this.partIndexToLength=s,this.finishHandler=o,this.grandTotalBytes=a,this.onProgress=l,this.start=Date.now(),this.nextUpdate=this.start+1e3,this.transferred=0,this.delta=0,this.partIndex=-1,this.headerListBuffer=null,this.readState=gt.INIT,this.ignoreByteCount=0,this.remainingPartDataCount=0,this.actualPartLength=0,this.boundaryLength=i.length+4,this.ignoreByteCount=this.boundaryLength-2}get isFinished(){return this.partIndex===this.partIndexToLength.length}_write(t,r,n){if(this.isFinished){console.error(`Trailing ignored data: ${t.length} bytes`);return}this.handleData(t).then(()=>{if(this.onProgress){const i=Date.now();(i>=this.nextUpdate||this.transferred===this.grandTotalBytes)&&this.grandTotalBytes&&(i-this.start)/1e3&&(this.nextUpdate=i+1e3,this.onProgress({total:this.grandTotalBytes,delta:this.delta,transferred:this.transferred,percent:this.transferred/this.grandTotalBytes*100,bytesPerSecond:Math.round(this.transferred/((i-this.start)/1e3))}),this.delta=0)}n()}).catch(n)}async handleData(t){let r=0;if(this.ignoreByteCount!==0&&this.remainingPartDataCount!==0)throw(0,xn.newError)("Internal error","ERR_DATA_SPLITTER_BYTE_COUNT_MISMATCH");if(this.ignoreByteCount>0){const n=Math.min(this.ignoreByteCount,t.length);this.ignoreByteCount-=n,r=n}else if(this.remainingPartDataCount>0){const n=Math.min(this.remainingPartDataCount,t.length);this.remainingPartDataCount-=n,await this.processPartData(t,0,n),r=n}if(r!==t.length){if(this.readState===gt.HEADER){const n=this.searchHeaderListEnd(t,r);if(n===-1)return;r=n,this.readState=gt.BODY,this.headerListBuffer=null}for(;;){if(this.readState===gt.BODY)this.readState=gt.INIT;else{this.partIndex++;let o=this.partIndexToTaskIndex.get(this.partIndex);if(o==null)if(this.isFinished)o=this.options.end;else throw(0,xn.newError)("taskIndex is null","ERR_DATA_SPLITTER_TASK_INDEX_IS_NULL");const a=this.partIndex===0?this.options.start:this.partIndexToTaskIndex.get(this.partIndex-1)+1;if(a<o)await this.copyExistingData(a,o);else if(a>o)throw(0,xn.newError)("prevTaskIndex must be < taskIndex","ERR_DATA_SPLITTER_TASK_INDEX_ASSERT_FAILED");if(this.isFinished){this.onPartEnd(),this.finishHandler();return}if(r=this.searchHeaderListEnd(t,r),r===-1){this.readState=gt.HEADER;return}}const n=this.partIndexToLength[this.partIndex],i=r+n,s=Math.min(i,t.length);if(await this.processPartStarted(t,r,s),this.remainingPartDataCount=n-(s-r),this.remainingPartDataCount>0)return;if(r=i+this.boundaryLength,r>=t.length){this.ignoreByteCount=this.boundaryLength-(t.length-i);return}}}}copyExistingData(t,r){return new Promise((n,i)=>{const s=()=>{if(t===r){n();return}const o=this.options.tasks[t];if(o.kind!==i_.OperationKind.COPY){i(new Error("Task kind must be COPY"));return}zu(o,this.out,this.options.oldFileFd,i,()=>{t++,s()})};s()})}searchHeaderListEnd(t,r){const n=t.indexOf(dl,r);if(n!==-1)return n+dl.length;const i=r===0?t:t.slice(r);return this.headerListBuffer==null?this.headerListBuffer=i:this.headerListBuffer=Buffer.concat([this.headerListBuffer,i]),-1}onPartEnd(){const t=this.partIndexToLength[this.partIndex-1];if(this.actualPartLength!==t)throw(0,xn.newError)(`Expected length: ${t} differs from actual: ${this.actualPartLength}`,"ERR_DATA_SPLITTER_LENGTH_MISMATCH");this.actualPartLength=0}processPartStarted(t,r,n){return this.partIndex!==0&&this.onPartEnd(),this.processPartData(t,r,n)}processPartData(t,r,n){this.actualPartLength+=n-r,this.transferred+=n-r,this.delta+=n-r;const i=this.out;return i.write(r===0&&t.length===n?t:t.slice(r,n))?Promise.resolve():new Promise((s,o)=>{i.on("error",o),i.once("drain",()=>{i.removeListener("error",o),s()})})}}mr.DataSplitter=s_;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.executeTasksUsingMultipleRangeRequests=o_;Ai.checkIsRangesSupported=xs;const $s=me,hl=mr,pl=zt;function o_(e,t,r,n,i){const s=o=>{if(o>=t.length){e.fileMetadataBuffer!=null&&r.write(e.fileMetadataBuffer),r.end();return}const a=o+1e3;a_(e,{tasks:t,start:o,end:Math.min(t.length,a),oldFileFd:n},r,()=>s(a),i)};return s}function a_(e,t,r,n,i){let s="bytes=",o=0,a=0;const l=new Map,u=[];for(let h=t.start;h<t.end;h++){const p=t.tasks[h];p.kind===pl.OperationKind.DOWNLOAD&&(s+=`${p.start}-${p.end-1}, `,l.set(o,h),o++,u.push(p.end-p.start),a+=p.end-p.start)}if(o<=1){const h=p=>{if(p>=t.end){n();return}const w=t.tasks[p++];if(w.kind===pl.OperationKind.COPY)(0,hl.copyData)(w,r,t.oldFileFd,i,()=>h(p));else{const y=e.createRequestOptions();y.headers.Range=`bytes=${w.start}-${w.end-1}`;const E=e.httpExecutor.createRequest(y,C=>{C.on("error",i),xs(C,i)&&(C.pipe(r,{end:!1}),C.once("end",()=>h(p)))});e.httpExecutor.addErrorAndTimeoutHandlers(E,i),E.end()}};h(t.start);return}const c=e.createRequestOptions();c.headers.Range=s.substring(0,s.length-2);const f=e.httpExecutor.createRequest(c,h=>{if(!xs(h,i))return;const p=(0,$s.safeGetHeader)(h,"content-type"),w=/^multipart\/.+?\s*;\s*boundary=(?:"([^"]+)"|([^\s";]+))\s*$/i.exec(p);if(w==null){i(new Error(`Content-Type "multipart/byteranges" is expected, but got "${p}"`));return}const y=new hl.DataSplitter(r,t,l,w[1]||w[2],u,n,a,e.options.onProgress);y.on("error",i),h.pipe(y),h.on("end",()=>{setTimeout(()=>{f.abort(),i(new Error("Response ends without calling any handlers"))},1e4)})});e.httpExecutor.addErrorAndTimeoutHandlers(f,i),f.end()}function xs(e,t){if(e.statusCode>=400)return t((0,$s.createHttpError)(e)),!1;if(e.statusCode!==206){const r=(0,$s.safeGetHeader)(e,"accept-ranges");if(r==null||r==="none")return t(new Error(`Server doesn't support Accept-Ranges (response code ${e.statusCode})`)),!1}return!0}var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.ProgressDifferentialDownloadCallbackTransform=void 0;const l_=Jr;var sr;(function(e){e[e.COPY=0]="COPY",e[e.DOWNLOAD=1]="DOWNLOAD"})(sr||(sr={}));class c_ extends l_.Transform{constructor(t,r,n){super(),this.progressDifferentialDownloadInfo=t,this.cancellationToken=r,this.onProgress=n,this.start=Date.now(),this.transferred=0,this.delta=0,this.expectedBytes=0,this.index=0,this.operationType=sr.COPY,this.nextUpdate=this.start+1e3}_transform(t,r,n){if(this.cancellationToken.cancelled){n(new Error("cancelled"),null);return}if(this.operationType==sr.COPY){n(null,t);return}this.transferred+=t.length,this.delta+=t.length;const i=Date.now();i>=this.nextUpdate&&this.transferred!==this.expectedBytes&&this.transferred!==this.progressDifferentialDownloadInfo.grandTotal&&(this.nextUpdate=i+1e3,this.onProgress({total:this.progressDifferentialDownloadInfo.grandTotal,delta:this.delta,transferred:this.transferred,percent:this.transferred/this.progressDifferentialDownloadInfo.grandTotal*100,bytesPerSecond:Math.round(this.transferred/((i-this.start)/1e3))}),this.delta=0),n(null,t)}beginFileCopy(){this.operationType=sr.COPY}beginRangeDownload(){this.operationType=sr.DOWNLOAD,this.expectedBytes+=this.progressDifferentialDownloadInfo.expectedByteCounts[this.index++]}endRangeDownload(){this.transferred!==this.progressDifferentialDownloadInfo.grandTotal&&this.onProgress({total:this.progressDifferentialDownloadInfo.grandTotal,delta:this.delta,transferred:this.transferred,percent:this.transferred/this.progressDifferentialDownloadInfo.grandTotal*100,bytesPerSecond:Math.round(this.transferred/((Date.now()-this.start)/1e3))})}_flush(t){if(this.cancellationToken.cancelled){t(new Error("cancelled"));return}this.onProgress({total:this.progressDifferentialDownloadInfo.grandTotal,delta:this.delta,transferred:this.transferred,percent:100,bytesPerSecond:Math.round(this.transferred/((Date.now()-this.start)/1e3))}),this.delta=0,this.transferred=0,t(null)}}Ti.ProgressDifferentialDownloadCallbackTransform=c_;Object.defineProperty(an,"__esModule",{value:!0});an.DifferentialDownloader=void 0;const Ar=me,hs=bt,u_=F,f_=mr,d_=We,Fn=zt,ml=Ai,h_=Ti;class p_{constructor(t,r,n){this.blockAwareFileInfo=t,this.httpExecutor=r,this.options=n,this.fileMetadataBuffer=null,this.logger=n.logger}createRequestOptions(){const t={headers:{...this.options.requestHeaders,accept:"*/*"}};return(0,Ar.configureRequestUrl)(this.options.newUrl,t),(0,Ar.configureRequestOptions)(t),t}doDownload(t,r){if(t.version!==r.version)throw new Error(`version is different (${t.version} - ${r.version}), full download is required`);const n=this.logger,i=(0,Fn.computeOperations)(t,r,n);n.debug!=null&&n.debug(JSON.stringify(i,null,2));let s=0,o=0;for(const l of i){const u=l.end-l.start;l.kind===Fn.OperationKind.DOWNLOAD?s+=u:o+=u}const a=this.blockAwareFileInfo.size;if(s+o+(this.fileMetadataBuffer==null?0:this.fileMetadataBuffer.length)!==a)throw new Error(`Internal error, size mismatch: downloadSize: ${s}, copySize: ${o}, newSize: ${a}`);return n.info(`Full: ${gl(a)}, To download: ${gl(s)} (${Math.round(s/(a/100))}%)`),this.downloadFile(i)}downloadFile(t){const r=[],n=()=>Promise.all(r.map(i=>(0,hs.close)(i.descriptor).catch(s=>{this.logger.error(`cannot close file "${i.path}": ${s}`)})));return this.doDownloadFile(t,r).then(n).catch(i=>n().catch(s=>{try{this.logger.error(`cannot close files: ${s}`)}catch(o){try{console.error(o)}catch{}}throw i}).then(()=>{throw i}))}async doDownloadFile(t,r){const n=await(0,hs.open)(this.options.oldFile,"r");r.push({descriptor:n,path:this.options.oldFile});const i=await(0,hs.open)(this.options.newFile,"w");r.push({descriptor:i,path:this.options.newFile});const s=(0,u_.createWriteStream)(this.options.newFile,{fd:i});await new Promise((o,a)=>{const l=[];let u;if(!this.options.isUseMultipleRangeRequest&&this.options.onProgress){const C=[];let A=0;for(const L of t)L.kind===Fn.OperationKind.DOWNLOAD&&(C.push(L.end-L.start),A+=L.end-L.start);const R={expectedByteCounts:C,grandTotal:A};u=new h_.ProgressDifferentialDownloadCallbackTransform(R,this.options.cancellationToken,this.options.onProgress),l.push(u)}const c=new Ar.DigestTransform(this.blockAwareFileInfo.sha512);c.isValidateOnEnd=!1,l.push(c),s.on("finish",()=>{s.close(()=>{r.splice(1,1);try{c.validate()}catch(C){a(C);return}o(void 0)})}),l.push(s);let f=null;for(const C of l)C.on("error",a),f==null?f=C:f=f.pipe(C);const h=l[0];let p;if(this.options.isUseMultipleRangeRequest){p=(0,ml.executeTasksUsingMultipleRangeRequests)(this,t,h,n,a),p(0);return}let w=0,y=null;this.logger.info(`Differential download: ${this.options.newUrl}`);const E=this.createRequestOptions();E.redirect="manual",p=C=>{var A,R;if(C>=t.length){this.fileMetadataBuffer!=null&&h.write(this.fileMetadataBuffer),h.end();return}const L=t[C++];if(L.kind===Fn.OperationKind.COPY){u&&u.beginFileCopy(),(0,f_.copyData)(L,h,n,a,()=>p(C));return}const Q=`bytes=${L.start}-${L.end-1}`;E.headers.range=Q,(R=(A=this.logger)===null||A===void 0?void 0:A.debug)===null||R===void 0||R.call(A,`download range: ${Q}`),u&&u.beginRangeDownload();const ee=this.httpExecutor.createRequest(E,Y=>{Y.on("error",a),Y.on("aborted",()=>{a(new Error("response has been aborted by the server"))}),Y.statusCode>=400&&a((0,Ar.createHttpError)(Y)),Y.pipe(h,{end:!1}),Y.once("end",()=>{u&&u.endRangeDownload(),++w===100?(w=0,setTimeout(()=>p(C),1e3)):p(C)})});ee.on("redirect",(Y,ue,v)=>{this.logger.info(`Redirect to ${m_(v)}`),y=v,(0,Ar.configureRequestUrl)(new d_.URL(y),E),ee.followRedirect()}),this.httpExecutor.addErrorAndTimeoutHandlers(ee,a),ee.end()},p(0)})}async readRemoteBytes(t,r){const n=Buffer.allocUnsafe(r+1-t),i=this.createRequestOptions();i.headers.range=`bytes=${t}-${r}`;let s=0;if(await this.request(i,o=>{o.copy(n,s),s+=o.length}),s!==n.length)throw new Error(`Received data length ${s} is not equal to expected ${n.length}`);return n}request(t,r){return new Promise((n,i)=>{const s=this.httpExecutor.createRequest(t,o=>{(0,ml.checkIsRangesSupported)(o,i)&&(o.on("error",i),o.on("aborted",()=>{i(new Error("response has been aborted by the server"))}),o.on("data",r),o.on("end",()=>n()))});this.httpExecutor.addErrorAndTimeoutHandlers(s,i),s.end()})}}an.DifferentialDownloader=p_;function gl(e,t=" KB"){return new Intl.NumberFormat("en").format((e/1024).toFixed(2))+t}function m_(e){const t=e.indexOf("?");return t<0?e:e.substring(0,t)}Object.defineProperty(Ci,"__esModule",{value:!0});Ci.GenericDifferentialDownloader=void 0;const g_=an;class y_ extends g_.DifferentialDownloader{download(t,r){return this.doDownload(t,r)}}Ci.GenericDifferentialDownloader=y_;var It={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UpdaterSignal=e.UPDATE_DOWNLOADED=e.DOWNLOAD_PROGRESS=e.CancellationToken=void 0,e.addHandler=n;const t=me;Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return t.CancellationToken}}),e.DOWNLOAD_PROGRESS="download-progress",e.UPDATE_DOWNLOADED="update-downloaded";class r{constructor(s){this.emitter=s}login(s){n(this.emitter,"login",s)}progress(s){n(this.emitter,e.DOWNLOAD_PROGRESS,s)}updateDownloaded(s){n(this.emitter,e.UPDATE_DOWNLOADED,s)}updateCancelled(s){n(this.emitter,"update-cancelled",s)}}e.UpdaterSignal=r;function n(i,s,o){i.on(s,o)}})(It);Object.defineProperty(_t,"__esModule",{value:!0});_t.NoOpLogger=_t.AppUpdater=void 0;const Re=me,v_=Xr,w_=ne,E_=ni,Ye=bt,__=Se,ps=fi,Je=D,Lt=ku,yl=sn,S_=yi,vl=Uu,C_=on,ms=vi,gs=Nr,A_=Ci,Qt=It;class po extends E_.EventEmitter{get channel(){return this._channel}set channel(t){if(this._channel!=null){if(typeof t!="string")throw(0,Re.newError)(`Channel must be a string, but got: ${t}`,"ERR_UPDATER_INVALID_CHANNEL");if(t.length===0)throw(0,Re.newError)("Channel must be not an empty string","ERR_UPDATER_INVALID_CHANNEL")}this._channel=t,this.allowDowngrade=!0}addAuthHeader(t){this.requestHeaders=Object.assign({},this.requestHeaders,{authorization:t})}get netSession(){return(0,vl.getNetSession)()}get logger(){return this._logger}set logger(t){this._logger=t??new Vu}set updateConfigPath(t){this.clientPromise=null,this._appUpdateConfigPath=t,this.configOnDisk=new ps.Lazy(()=>this.loadUpdateConfig())}get isUpdateSupported(){return this._isUpdateSupported}set isUpdateSupported(t){t&&(this._isUpdateSupported=t)}get isUserWithinRollout(){return this._isUserWithinRollout}set isUserWithinRollout(t){t&&(this._isUserWithinRollout=t)}constructor(t,r){super(),this.autoDownload=!0,this.autoInstallOnAppQuit=!0,this.autoRunAppAfterInstall=!0,this.allowPrerelease=!1,this.fullChangelog=!1,this.allowDowngrade=!1,this.disableWebInstaller=!1,this.disableDifferentialDownload=!1,this.forceDevUpdateConfig=!1,this.previousBlockmapBaseUrlOverride=null,this._channel=null,this.downloadedUpdateHelper=null,this.requestHeaders=null,this._logger=console,this.signals=new Qt.UpdaterSignal(this),this._appUpdateConfigPath=null,this._isUpdateSupported=s=>this.checkIfUpdateSupported(s),this._isUserWithinRollout=s=>this.isStagingMatch(s),this.clientPromise=null,this.stagingUserIdPromise=new ps.Lazy(()=>this.getOrCreateStagingUserId()),this.configOnDisk=new ps.Lazy(()=>this.loadUpdateConfig()),this.checkForUpdatesPromise=null,this.downloadPromise=null,this.updateInfoAndProvider=null,this._testOnlyOptions=null,this.on("error",s=>{this._logger.error(`Error: ${s.stack||s.message}`)}),r==null?(this.app=new S_.ElectronAppAdapter,this.httpExecutor=new vl.ElectronHttpExecutor((s,o)=>this.emit("login",s,o))):(this.app=r,this.httpExecutor=null);const n=this.app.version,i=(0,Lt.parse)(n);if(i==null)throw(0,Re.newError)(`App version is not a valid semver version: "${n}"`,"ERR_UPDATER_INVALID_VERSION");this.currentVersion=i,this.allowPrerelease=T_(i),t!=null&&(this.setFeedURL(t),typeof t!="string"&&t.requestHeaders&&(this.requestHeaders=t.requestHeaders))}getFeedURL(){return"Deprecated. Do not use it."}setFeedURL(t){const r=this.createProviderRuntimeOptions();let n;typeof t=="string"?n=new C_.GenericProvider({provider:"generic",url:t},this,{...r,isUseMultipleRangeRequest:(0,ms.isUrlProbablySupportMultiRangeRequests)(t)}):n=(0,ms.createClient)(t,this,r),this.clientPromise=Promise.resolve(n)}checkForUpdates(){if(!this.isUpdaterActive())return Promise.resolve(null);let t=this.checkForUpdatesPromise;if(t!=null)return this._logger.info("Checking for update (already in progress)"),t;const r=()=>this.checkForUpdatesPromise=null;return this._logger.info("Checking for update"),t=this.doCheckForUpdates().then(n=>(r(),n)).catch(n=>{throw r(),this.emit("error",n,`Cannot check for updates: ${(n.stack||n).toString()}`),n}),this.checkForUpdatesPromise=t,t}isUpdaterActive(){return this.app.isPackaged||this.forceDevUpdateConfig?!0:(this._logger.info("Skip checkForUpdates because application is not packed and dev update config is not forced"),!1)}checkForUpdatesAndNotify(t){return this.checkForUpdates().then(r=>r!=null&&r.downloadPromise?(r.downloadPromise.then(()=>{const n=po.formatDownloadNotification(r.updateInfo.version,this.app.name,t);new $.Notification(n).show()}),r):(this._logger.debug!=null&&this._logger.debug("checkForUpdatesAndNotify called, downloadPromise is null"),r))}static formatDownloadNotification(t,r,n){return n==null&&(n={title:"A new update is ready to install",body:"{appName} version {version} has been downloaded and will be automatically installed on exit"}),n={title:n.title.replace("{appName}",r).replace("{version}",t),body:n.body.replace("{appName}",r).replace("{version}",t)},n}async isStagingMatch(t){const r=t.stagingPercentage;let n=r;if(n==null)return!0;if(n=parseInt(n,10),isNaN(n))return this._logger.warn(`Staging percentage is NaN: ${r}`),!0;n=n/100;const i=await this.stagingUserIdPromise.value,o=Re.UUID.parse(i).readUInt32BE(12)/4294967295;return this._logger.info(`Staging percentage: ${n}, percentage: ${o}, user id: ${i}`),o<n}computeFinalHeaders(t){return this.requestHeaders!=null&&Object.assign(t,this.requestHeaders),t}async isUpdateAvailable(t){const r=(0,Lt.parse)(t.version);if(r==null)throw(0,Re.newError)(`This file could not be downloaded, or the latest version (from update server) does not have a valid semver version: "${t.version}"`,"ERR_UPDATER_INVALID_VERSION");const n=this.currentVersion;if((0,Lt.eq)(r,n)||!await Promise.resolve(this.isUpdateSupported(t))||!await Promise.resolve(this.isUserWithinRollout(t)))return!1;const s=(0,Lt.gt)(r,n),o=(0,Lt.lt)(r,n);return s?!0:this.allowDowngrade&&o}checkIfUpdateSupported(t){const r=t==null?void 0:t.minimumSystemVersion,n=(0,w_.release)();if(r)try{if((0,Lt.lt)(n,r))return this._logger.info(`Current OS version ${n} is less than the minimum OS version required ${r} for version ${n}`),!1}catch(i){this._logger.warn(`Failed to compare current OS version(${n}) with minimum OS version(${r}): ${(i.message||i).toString()}`)}return!0}async getUpdateInfoAndProvider(){await this.app.whenReady(),this.clientPromise==null&&(this.clientPromise=this.configOnDisk.value.then(n=>(0,ms.createClient)(n,this,this.createProviderRuntimeOptions())));const t=await this.clientPromise,r=await this.stagingUserIdPromise.value;return t.setRequestHeaders(this.computeFinalHeaders({"x-user-staging-id":r})),{info:await t.getLatestVersion(),provider:t}}createProviderRuntimeOptions(){return{isUseMultipleRangeRequest:!0,platform:this._testOnlyOptions==null?process.platform:this._testOnlyOptions.platform,executor:this.httpExecutor}}async doCheckForUpdates(){this.emit("checking-for-update");const t=await this.getUpdateInfoAndProvider(),r=t.info;if(!await this.isUpdateAvailable(r))return this._logger.info(`Update for version ${this.currentVersion.format()} is not available (latest version: ${r.version}, downgrade is ${this.allowDowngrade?"allowed":"disallowed"}).`),this.emit("update-not-available",r),{isUpdateAvailable:!1,versionInfo:r,updateInfo:r};this.updateInfoAndProvider=t,this.onUpdateAvailable(r);const n=new Re.CancellationToken;return{isUpdateAvailable:!0,versionInfo:r,updateInfo:r,cancellationToken:n,downloadPromise:this.autoDownload?this.downloadUpdate(n):null}}onUpdateAvailable(t){this._logger.info(`Found version ${t.version} (url: ${(0,Re.asArray)(t.files).map(r=>r.url).join(", ")})`),this.emit("update-available",t)}downloadUpdate(t=new Re.CancellationToken){const r=this.updateInfoAndProvider;if(r==null){const i=new Error("Please check update first");return this.dispatchError(i),Promise.reject(i)}if(this.downloadPromise!=null)return this._logger.info("Downloading update (already in progress)"),this.downloadPromise;this._logger.info(`Downloading update from ${(0,Re.asArray)(r.info.files).map(i=>i.url).join(", ")}`);const n=i=>{if(!(i instanceof Re.CancellationError))try{this.dispatchError(i)}catch(s){this._logger.warn(`Cannot dispatch error event: ${s.stack||s}`)}return i};return this.downloadPromise=this.doDownloadUpdate({updateInfoAndProvider:r,requestHeaders:this.computeRequestHeaders(r.provider),cancellationToken:t,disableWebInstaller:this.disableWebInstaller,disableDifferentialDownload:this.disableDifferentialDownload}).catch(i=>{throw n(i)}).finally(()=>{this.downloadPromise=null}),this.downloadPromise}dispatchError(t){this.emit("error",t,(t.stack||t).toString())}dispatchUpdateDownloaded(t){this.emit(Qt.UPDATE_DOWNLOADED,t)}async loadUpdateConfig(){return this._appUpdateConfigPath==null&&(this._appUpdateConfigPath=this.app.appUpdateConfigPath),(0,__.load)(await(0,Ye.readFile)(this._appUpdateConfigPath,"utf-8"))}computeRequestHeaders(t){const r=t.fileExtraDownloadHeaders;if(r!=null){const n=this.requestHeaders;return n==null?r:{...r,...n}}return this.computeFinalHeaders({accept:"*/*"})}async getOrCreateStagingUserId(){const t=Je.join(this.app.userDataPath,".updaterId");try{const n=await(0,Ye.readFile)(t,"utf-8");if(Re.UUID.check(n))return n;this._logger.warn(`Staging user id file exists, but content was invalid: ${n}`)}catch(n){n.code!=="ENOENT"&&this._logger.warn(`Couldn't read staging user ID, creating a blank one: ${n}`)}const r=Re.UUID.v5((0,v_.randomBytes)(4096),Re.UUID.OID);this._logger.info(`Generated new staging user ID: ${r}`);try{await(0,Ye.outputFile)(t,r)}catch(n){this._logger.warn(`Couldn't write out staging user ID: ${n}`)}return r}get isAddNoCacheQuery(){const t=this.requestHeaders;if(t==null)return!0;for(const r of Object.keys(t)){const n=r.toLowerCase();if(n==="authorization"||n==="private-token")return!1}return!0}async getOrCreateDownloadHelper(){let t=this.downloadedUpdateHelper;if(t==null){const r=(await this.configOnDisk.value).updaterCacheDirName,n=this._logger;r==null&&n.error("updaterCacheDirName is not specified in app-update.yml Was app build using at least electron-builder 20.34.0?");const i=Je.join(this.app.baseCachePath,r||this.app.name);n.debug!=null&&n.debug(`updater cache dir: ${i}`),t=new yl.DownloadedUpdateHelper(i),this.downloadedUpdateHelper=t}return t}async executeDownload(t){const r=t.fileInfo,n={headers:t.downloadUpdateOptions.requestHeaders,cancellationToken:t.downloadUpdateOptions.cancellationToken,sha2:r.info.sha2,sha512:r.info.sha512};this.listenerCount(Qt.DOWNLOAD_PROGRESS)>0&&(n.onProgress=A=>this.emit(Qt.DOWNLOAD_PROGRESS,A));const i=t.downloadUpdateOptions.updateInfoAndProvider.info,s=i.version,o=r.packageInfo;function a(){const A=decodeURIComponent(t.fileInfo.url.pathname);return A.toLowerCase().endsWith(`.${t.fileExtension.toLowerCase()}`)?Je.basename(A):t.fileInfo.info.url}const l=await this.getOrCreateDownloadHelper(),u=l.cacheDirForPendingUpdate;await(0,Ye.mkdir)(u,{recursive:!0});const c=a();let f=Je.join(u,c);const h=o==null?null:Je.join(u,`package-${s}${Je.extname(o.path)||".7z"}`),p=async A=>{await l.setDownloadedFile(f,h,i,r,c,A),await t.done({...i,downloadedFile:f});const R=Je.join(u,"current.blockmap");return await(0,Ye.pathExists)(R)&&await(0,Ye.copyFile)(R,Je.join(l.cacheDir,"current.blockmap")),h==null?[f]:[f,h]},w=this._logger,y=await l.validateDownloadedPath(f,i,r,w);if(y!=null)return f=y,await p(!1);const E=async()=>(await l.clear().catch(()=>{}),await(0,Ye.unlink)(f).catch(()=>{})),C=await(0,yl.createTempUpdateFile)(`temp-${c}`,u,w);try{await t.task(C,n,h,E),await(0,Re.retry)(()=>(0,Ye.rename)(C,f),{retries:60,interval:500,shouldRetry:A=>A instanceof Error&&/^EBUSY:/.test(A.message)?!0:(w.warn(`Cannot rename temp file to final file: ${A.message||A.stack}`),!1)})}catch(A){throw await E(),A instanceof Re.CancellationError&&(w.info("cancelled"),this.emit("update-cancelled",i)),A}return w.info(`New version ${s} has been downloaded to ${f}`),await p(!0)}async differentialDownloadInstaller(t,r,n,i,s){try{if(this._testOnlyOptions!=null&&!this._testOnlyOptions.isUseDifferentialDownload)return!0;const o=r.updateInfoAndProvider.provider,a=await o.getBlockMapFiles(t.url,this.app.version,r.updateInfoAndProvider.info.version,this.previousBlockmapBaseUrlOverride);this._logger.info(`Download block maps (old: "${a[0]}", new: ${a[1]})`);const l=async w=>{const y=await this.httpExecutor.downloadToBuffer(w,{headers:r.requestHeaders,cancellationToken:r.cancellationToken});if(y==null||y.length===0)throw new Error(`Blockmap "${w.href}" is empty`);try{return JSON.parse((0,gs.gunzipSync)(y).toString())}catch(E){throw new Error(`Cannot parse blockmap "${w.href}", error: ${E}`)}},u={newUrl:t.url,oldFile:Je.join(this.downloadedUpdateHelper.cacheDir,s),logger:this._logger,newFile:n,isUseMultipleRangeRequest:o.isUseMultipleRangeRequest,requestHeaders:r.requestHeaders,cancellationToken:r.cancellationToken};this.listenerCount(Qt.DOWNLOAD_PROGRESS)>0&&(u.onProgress=w=>this.emit(Qt.DOWNLOAD_PROGRESS,w));const c=async(w,y)=>{const E=Je.join(y,"current.blockmap");await(0,Ye.outputFile)(E,(0,gs.gzipSync)(JSON.stringify(w)))},f=async w=>{const y=Je.join(w,"current.blockmap");try{if(await(0,Ye.pathExists)(y))return JSON.parse((0,gs.gunzipSync)(await(0,Ye.readFile)(y)).toString())}catch(E){this._logger.warn(`Cannot parse blockmap "${y}", error: ${E}`)}return null},h=await l(a[1]);await c(h,this.downloadedUpdateHelper.cacheDirForPendingUpdate);let p=await f(this.downloadedUpdateHelper.cacheDir);return p==null&&(p=await l(a[0])),await new A_.GenericDifferentialDownloader(t.info,this.httpExecutor,u).download(p,h),!1}catch(o){if(this._logger.error(`Cannot download differentially, fallback to full download: ${o.stack||o}`),this._testOnlyOptions!=null)throw o;return!0}}}_t.AppUpdater=po;function T_(e){const t=(0,Lt.prerelease)(e);return t!=null&&t.length>0}class Vu{info(t){}warn(t){}error(t){}}_t.NoOpLogger=Vu;Object.defineProperty(Wt,"__esModule",{value:!0});Wt.BaseUpdater=void 0;const wl=fe,b_=_t;class I_ extends b_.AppUpdater{constructor(t,r){super(t,r),this.quitAndInstallCalled=!1,this.quitHandlerAdded=!1}quitAndInstall(t=!1,r=!1){this._logger.info("Install on explicit quitAndInstall"),this.install(t,t?r:this.autoRunAppAfterInstall)?setImmediate(()=>{$.autoUpdater.emit("before-quit-for-update"),this.app.quit()}):this.quitAndInstallCalled=!1}executeDownload(t){return super.executeDownload({...t,done:r=>(this.dispatchUpdateDownloaded(r),this.addQuitHandler(),Promise.resolve())})}get installerPath(){return this.downloadedUpdateHelper==null?null:this.downloadedUpdateHelper.file}install(t=!1,r=!1){if(this.quitAndInstallCalled)return this._logger.warn("install call ignored: quitAndInstallCalled is set to true"),!1;const n=this.downloadedUpdateHelper,i=this.installerPath,s=n==null?null:n.downloadedFileInfo;if(i==null||s==null)return this.dispatchError(new Error("No update filepath provided, can't quit and install")),!1;this.quitAndInstallCalled=!0;try{return this._logger.info(`Install: isSilent: ${t}, isForceRunAfter: ${r}`),this.doInstall({isSilent:t,isForceRunAfter:r,isAdminRightsRequired:s.isAdminRightsRequired})}catch(o){return this.dispatchError(o),!1}}addQuitHandler(){this.quitHandlerAdded||!this.autoInstallOnAppQuit||(this.quitHandlerAdded=!0,this.app.onQuit(t=>{if(this.quitAndInstallCalled){this._logger.info("Update installer has already been triggered. Quitting application.");return}if(!this.autoInstallOnAppQuit){this._logger.info("Update will not be installed on quit because autoInstallOnAppQuit is set to false.");return}if(t!==0){this._logger.info(`Update will be not installed on quit because application is quitting with exit code ${t}`);return}this._logger.info("Auto install update on quit"),this.install(!0,!1)}))}spawnSyncLog(t,r=[],n={}){this._logger.info(`Executing: ${t} with args: ${r}`);const i=(0,wl.spawnSync)(t,r,{env:{...process.env,...n},encoding:"utf-8",shell:!0}),{error:s,status:o,stdout:a,stderr:l}=i;if(s!=null)throw this._logger.error(l),s;if(o!=null&&o!==0)throw this._logger.error(l),new Error(`Command ${t} exited with code ${o}`);return a.trim()}async spawnLog(t,r=[],n=void 0,i="ignore"){return this._logger.info(`Executing: ${t} with args: ${r}`),new Promise((s,o)=>{try{const a={stdio:i,env:n,detached:!0},l=(0,wl.spawn)(t,r,a);l.on("error",u=>{o(u)}),l.unref(),l.pid!==void 0&&s(!0)}catch(a){o(a)}})}}Wt.BaseUpdater=I_;var Hr={},ln={};Object.defineProperty(ln,"__esModule",{value:!0});ln.FileWithEmbeddedBlockMapDifferentialDownloader=void 0;const Zt=bt,P_=an,O_=Nr;class R_ extends P_.DifferentialDownloader{async download(){const t=this.blockAwareFileInfo,r=t.size,n=r-(t.blockMapSize+4);this.fileMetadataBuffer=await this.readRemoteBytes(n,r-1);const i=Yu(this.fileMetadataBuffer.slice(0,this.fileMetadataBuffer.length-4));await this.doDownload(await D_(this.options.oldFile),i)}}ln.FileWithEmbeddedBlockMapDifferentialDownloader=R_;function Yu(e){return JSON.parse((0,O_.inflateRawSync)(e).toString())}async function D_(e){const t=await(0,Zt.open)(e,"r");try{const r=(await(0,Zt.fstat)(t)).size,n=Buffer.allocUnsafe(4);await(0,Zt.read)(t,n,0,n.length,r-n.length);const i=Buffer.allocUnsafe(n.readUInt32BE(0));return await(0,Zt.read)(t,i,0,i.length,r-n.length-i.length),await(0,Zt.close)(t),Yu(i)}catch(r){throw await(0,Zt.close)(t),r}}Object.defineProperty(Hr,"__esModule",{value:!0});Hr.AppImageUpdater=void 0;const El=me,_l=fe,N_=bt,$_=F,Tr=D,x_=Wt,F_=ln,L_=he,Sl=It;class k_ extends x_.BaseUpdater{constructor(t,r){super(t,r)}isUpdaterActive(){return process.env.APPIMAGE==null&&!this.forceDevUpdateConfig?(process.env.SNAP==null?this._logger.warn("APPIMAGE env is not defined, current application is not an AppImage"):this._logger.info("SNAP env is defined, updater is disabled"),!1):super.isUpdaterActive()}doDownloadUpdate(t){const r=t.updateInfoAndProvider.provider,n=(0,L_.findFile)(r.resolveFiles(t.updateInfoAndProvider.info),"AppImage",["rpm","deb","pacman"]);return this.executeDownload({fileExtension:"AppImage",fileInfo:n,downloadUpdateOptions:t,task:async(i,s)=>{const o=process.env.APPIMAGE;if(o==null)throw(0,El.newError)("APPIMAGE env is not defined","ERR_UPDATER_OLD_FILE_NOT_FOUND");(t.disableDifferentialDownload||await this.downloadDifferential(n,o,i,r,t))&&await this.httpExecutor.download(n.url,i,s),await(0,N_.chmod)(i,493)}})}async downloadDifferential(t,r,n,i,s){try{const o={newUrl:t.url,oldFile:r,logger:this._logger,newFile:n,isUseMultipleRangeRequest:i.isUseMultipleRangeRequest,requestHeaders:s.requestHeaders,cancellationToken:s.cancellationToken};return this.listenerCount(Sl.DOWNLOAD_PROGRESS)>0&&(o.onProgress=a=>this.emit(Sl.DOWNLOAD_PROGRESS,a)),await new F_.FileWithEmbeddedBlockMapDifferentialDownloader(t.info,this.httpExecutor,o).download(),!1}catch(o){return this._logger.error(`Cannot download differentially, fallback to full download: ${o.stack||o}`),process.platform==="linux"}}doInstall(t){const r=process.env.APPIMAGE;if(r==null)throw(0,El.newError)("APPIMAGE env is not defined","ERR_UPDATER_OLD_FILE_NOT_FOUND");(0,$_.unlinkSync)(r);let n;const i=Tr.basename(r),s=this.installerPath;if(s==null)return this.dispatchError(new Error("No update filepath provided, can't quit and install")),!1;Tr.basename(s)===i||!/\d+\.\d+\.\d+/.test(i)?n=r:n=Tr.join(Tr.dirname(r),Tr.basename(s)),(0,_l.execFileSync)("mv",["-f",s,n]),n!==r&&this.emit("appimage-filename-updated",n);const o={...process.env,APPIMAGE_SILENT_INSTALL:"true"};return t.isForceRunAfter?this.spawnLog(n,[],o):(o.APPIMAGE_EXIT_AFTER_INSTALL="true",(0,_l.execFileSync)(n,[],{env:o})),!0}}Hr.AppImageUpdater=k_;var qr={},gr={};Object.defineProperty(gr,"__esModule",{value:!0});gr.LinuxUpdater=void 0;const U_=Wt;class M_ extends U_.BaseUpdater{constructor(t,r){super(t,r)}isRunningAsRoot(){var t;return((t=process.getuid)===null||t===void 0?void 0:t.call(process))===0}get installerPath(){var t,r;return(r=(t=super.installerPath)===null||t===void 0?void 0:t.replace(/\\/g,"\\\\").replace(/ /g,"\\ "))!==null&&r!==void 0?r:null}runCommandWithSudoIfNeeded(t){if(this.isRunningAsRoot())return this._logger.info("Running as root, no need to use sudo"),this.spawnSyncLog(t[0],t.slice(1));const{name:r}=this.app,n=`"${r} would like to update"`,i=this.sudoWithArgs(n);this._logger.info(`Running as non-root user, using sudo to install: ${i}`);let s='"';return(/pkexec/i.test(i[0])||i[0]==="sudo")&&(s=""),this.spawnSyncLog(i[0],[...i.length>1?i.slice(1):[],`${s}/bin/bash`,"-c",`'${t.join(" ")}'${s}`])}sudoWithArgs(t){const r=this.determineSudoCommand(),n=[r];return/kdesudo/i.test(r)?(n.push("--comment",t),n.push("-c")):/gksudo/i.test(r)?n.push("--message",t):/pkexec/i.test(r)&&n.push("--disable-internal-agent"),n}hasCommand(t){try{return this.spawnSyncLog("command",["-v",t]),!0}catch{return!1}}determineSudoCommand(){const t=["gksudo","kdesudo","pkexec","beesu"];for(const r of t)if(this.hasCommand(r))return r;return"sudo"}detectPackageManager(t){var r;const n=(r=process.env.ELECTRON_BUILDER_LINUX_PACKAGE_MANAGER)===null||r===void 0?void 0:r.trim();if(n)return n;for(const i of t)if(this.hasCommand(i))return i;return this._logger.warn(`No package manager found in the list: ${t.join(", ")}. Defaulting to the first one: ${t[0]}`),t[0]}}gr.LinuxUpdater=M_;Object.defineProperty(qr,"__esModule",{value:!0});qr.DebUpdater=void 0;const j_=he,Cl=It,B_=gr;class mo extends B_.LinuxUpdater{constructor(t,r){super(t,r)}doDownloadUpdate(t){const r=t.updateInfoAndProvider.provider,n=(0,j_.findFile)(r.resolveFiles(t.updateInfoAndProvider.info),"deb",["AppImage","rpm","pacman"]);return this.executeDownload({fileExtension:"deb",fileInfo:n,downloadUpdateOptions:t,task:async(i,s)=>{this.listenerCount(Cl.DOWNLOAD_PROGRESS)>0&&(s.onProgress=o=>this.emit(Cl.DOWNLOAD_PROGRESS,o)),await this.httpExecutor.download(n.url,i,s)}})}doInstall(t){const r=this.installerPath;if(r==null)return this.dispatchError(new Error("No update filepath provided, can't quit and install")),!1;if(!this.hasCommand("dpkg")&&!this.hasCommand("apt"))return this.dispatchError(new Error("Neither dpkg nor apt command found. Cannot install .deb package.")),!1;const n=["dpkg","apt"],i=this.detectPackageManager(n);try{mo.installWithCommandRunner(i,r,this.runCommandWithSudoIfNeeded.bind(this),this._logger)}catch(s){return this.dispatchError(s),!1}return t.isForceRunAfter&&this.app.relaunch(),!0}static installWithCommandRunner(t,r,n,i){var s;if(t==="dpkg")try{n(["dpkg","-i",r])}catch(o){i.warn((s=o.message)!==null&&s!==void 0?s:o),i.warn("dpkg installation failed, trying to fix broken dependencies with apt-get"),n(["apt-get","install","-f","-y"])}else if(t==="apt")i.warn("Using apt to install a local .deb. This may fail for unsigned packages unless properly configured."),n(["apt","install","-y","--allow-unauthenticated","--allow-downgrades","--allow-change-held-packages",r]);else throw new Error(`Package manager ${t} not supported`)}}qr.DebUpdater=mo;var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.PacmanUpdater=void 0;const Al=It,H_=he,q_=gr;class go extends q_.LinuxUpdater{constructor(t,r){super(t,r)}doDownloadUpdate(t){const r=t.updateInfoAndProvider.provider,n=(0,H_.findFile)(r.resolveFiles(t.updateInfoAndProvider.info),"pacman",["AppImage","deb","rpm"]);return this.executeDownload({fileExtension:"pacman",fileInfo:n,downloadUpdateOptions:t,task:async(i,s)=>{this.listenerCount(Al.DOWNLOAD_PROGRESS)>0&&(s.onProgress=o=>this.emit(Al.DOWNLOAD_PROGRESS,o)),await this.httpExecutor.download(n.url,i,s)}})}doInstall(t){const r=this.installerPath;if(r==null)return this.dispatchError(new Error("No update filepath provided, can't quit and install")),!1;try{go.installWithCommandRunner(r,this.runCommandWithSudoIfNeeded.bind(this),this._logger)}catch(n){return this.dispatchError(n),!1}return t.isForceRunAfter&&this.app.relaunch(),!0}static installWithCommandRunner(t,r,n){var i;try{r(["pacman","-U","--noconfirm",t])}catch(s){n.warn((i=s.message)!==null&&i!==void 0?i:s),n.warn("pacman installation failed, attempting to update package database and retry");try{r(["pacman","-Sy","--noconfirm"]),r(["pacman","-U","--noconfirm",t])}catch(o){throw n.error("Retry after pacman -Sy failed"),o}}}}Gr.PacmanUpdater=go;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.RpmUpdater=void 0;const Tl=It,G_=he,W_=gr;class yo extends W_.LinuxUpdater{constructor(t,r){super(t,r)}doDownloadUpdate(t){const r=t.updateInfoAndProvider.provider,n=(0,G_.findFile)(r.resolveFiles(t.updateInfoAndProvider.info),"rpm",["AppImage","deb","pacman"]);return this.executeDownload({fileExtension:"rpm",fileInfo:n,downloadUpdateOptions:t,task:async(i,s)=>{this.listenerCount(Tl.DOWNLOAD_PROGRESS)>0&&(s.onProgress=o=>this.emit(Tl.DOWNLOAD_PROGRESS,o)),await this.httpExecutor.download(n.url,i,s)}})}doInstall(t){const r=this.installerPath;if(r==null)return this.dispatchError(new Error("No update filepath provided, can't quit and install")),!1;const n=["zypper","dnf","yum","rpm"],i=this.detectPackageManager(n);try{yo.installWithCommandRunner(i,r,this.runCommandWithSudoIfNeeded.bind(this),this._logger)}catch(s){return this.dispatchError(s),!1}return t.isForceRunAfter&&this.app.relaunch(),!0}static installWithCommandRunner(t,r,n,i){if(t==="zypper")return n(["zypper","--non-interactive","--no-refresh","install","--allow-unsigned-rpm","-f",r]);if(t==="dnf")return n(["dnf","install","--nogpgcheck","-y",r]);if(t==="yum")return n(["yum","install","--nogpgcheck","-y",r]);if(t==="rpm")return i.warn("Installing with rpm only (no dependency resolution)."),n(["rpm","-Uvh","--replacepkgs","--replacefiles","--nodeps",r]);throw new Error(`Package manager ${t} not supported`)}}Wr.RpmUpdater=yo;var zr={};Object.defineProperty(zr,"__esModule",{value:!0});zr.MacUpdater=void 0;const bl=me,ys=bt,z_=F,Il=D,V_=id,Y_=_t,J_=he,Pl=fe,Ol=Xr;class X_ extends Y_.AppUpdater{constructor(t,r){super(t,r),this.nativeUpdater=$.autoUpdater,this.squirrelDownloadedUpdate=!1,this.nativeUpdater.on("error",n=>{this._logger.warn(n),this.emit("error",n)}),this.nativeUpdater.on("update-downloaded",()=>{this.squirrelDownloadedUpdate=!0,this.debug("nativeUpdater.update-downloaded")})}debug(t){this._logger.debug!=null&&this._logger.debug(t)}closeServerIfExists(){this.server&&(this.debug("Closing proxy server"),this.server.close(t=>{t&&this.debug("proxy server wasn't already open, probably attempted closing again as a safety check before quit")}))}async doDownloadUpdate(t){let r=t.updateInfoAndProvider.provider.resolveFiles(t.updateInfoAndProvider.info);const n=this._logger,i="sysctl.proc_translated";let s=!1;try{this.debug("Checking for macOS Rosetta environment"),s=(0,Pl.execFileSync)("sysctl",[i],{encoding:"utf8"}).includes(`${i}: 1`),n.info(`Checked for macOS Rosetta environment (isRosetta=${s})`)}catch(f){n.warn(`sysctl shell command to check for macOS Rosetta environment failed: ${f}`)}let o=!1;try{this.debug("Checking for arm64 in uname");const h=(0,Pl.execFileSync)("uname",["-a"],{encoding:"utf8"}).includes("ARM");n.info(`Checked 'uname -a': arm64=${h}`),o=o||h}catch(f){n.warn(`uname shell command to check for arm64 failed: ${f}`)}o=o||process.arch==="arm64"||s;const a=f=>{var h;return f.url.pathname.includes("arm64")||((h=f.info.url)===null||h===void 0?void 0:h.includes("arm64"))};o&&r.some(a)?r=r.filter(f=>o===a(f)):r=r.filter(f=>!a(f));const l=(0,J_.findFile)(r,"zip",["pkg","dmg"]);if(l==null)throw(0,bl.newError)(`ZIP file not provided: ${(0,bl.safeStringifyJson)(r)}`,"ERR_UPDATER_ZIP_FILE_NOT_FOUND");const u=t.updateInfoAndProvider.provider,c="update.zip";return this.executeDownload({fileExtension:"zip",fileInfo:l,downloadUpdateOptions:t,task:async(f,h)=>{const p=Il.join(this.downloadedUpdateHelper.cacheDir,c),w=()=>(0,ys.pathExistsSync)(p)?!t.disableDifferentialDownload:(n.info("Unable to locate previous update.zip for differential download (is this first install?), falling back to full download"),!1);let y=!0;w()&&(y=await this.differentialDownloadInstaller(l,t,f,u,c)),y&&await this.httpExecutor.download(l.url,f,h)},done:async f=>{if(!t.disableDifferentialDownload)try{const h=Il.join(this.downloadedUpdateHelper.cacheDir,c);await(0,ys.copyFile)(f.downloadedFile,h)}catch(h){this._logger.warn(`Unable to copy file for caching for future differential downloads: ${h.message}`)}return this.updateDownloaded(l,f)}})}async updateDownloaded(t,r){var n;const i=r.downloadedFile,s=(n=t.info.size)!==null&&n!==void 0?n:(await(0,ys.stat)(i)).size,o=this._logger,a=`fileToProxy=${t.url.href}`;this.closeServerIfExists(),this.debug(`Creating proxy server for native Squirrel.Mac (${a})`),this.server=(0,V_.createServer)(),this.debug(`Proxy server for native Squirrel.Mac is created (${a})`),this.server.on("close",()=>{o.info(`Proxy server for native Squirrel.Mac is closed (${a})`)});const l=u=>{const c=u.address();return typeof c=="string"?c:`http://127.0.0.1:${c==null?void 0:c.port}`};return await new Promise((u,c)=>{const f=(0,Ol.randomBytes)(64).toString("base64").replace(/\//g,"_").replace(/\+/g,"-"),h=Buffer.from(`autoupdater:${f}`,"ascii"),p=`/${(0,Ol.randomBytes)(64).toString("hex")}.zip`;this.server.on("request",(w,y)=>{const E=w.url;if(o.info(`${E} requested`),E==="/"){if(!w.headers.authorization||w.headers.authorization.indexOf("Basic ")===-1){y.statusCode=401,y.statusMessage="Invalid Authentication Credentials",y.end(),o.warn("No authenthication info");return}const R=w.headers.authorization.split(" ")[1],L=Buffer.from(R,"base64").toString("ascii"),[Q,ee]=L.split(":");if(Q!=="autoupdater"||ee!==f){y.statusCode=401,y.statusMessage="Invalid Authentication Credentials",y.end(),o.warn("Invalid authenthication credentials");return}const Y=Buffer.from(`{ "url": "${l(this.server)}${p}" }`);y.writeHead(200,{"Content-Type":"application/json","Content-Length":Y.length}),y.end(Y);return}if(!E.startsWith(p)){o.warn(`${E} requested, but not supported`),y.writeHead(404),y.end();return}o.info(`${p} requested by Squirrel.Mac, pipe ${i}`);let C=!1;y.on("finish",()=>{C||(this.nativeUpdater.removeListener("error",c),u([]))});const A=(0,z_.createReadStream)(i);A.on("error",R=>{try{y.end()}catch(L){o.warn(`cannot end response: ${L}`)}C=!0,this.nativeUpdater.removeListener("error",c),c(new Error(`Cannot pipe "${i}": ${R}`))}),y.writeHead(200,{"Content-Type":"application/zip","Content-Length":s}),A.pipe(y)}),this.debug(`Proxy server for native Squirrel.Mac is starting to listen (${a})`),this.server.listen(0,"127.0.0.1",()=>{this.debug(`Proxy server for native Squirrel.Mac is listening (address=${l(this.server)}, ${a})`),this.nativeUpdater.setFeedURL({url:l(this.server),headers:{"Cache-Control":"no-cache",Authorization:`Basic ${h.toString("base64")}`}}),this.dispatchUpdateDownloaded(r),this.autoInstallOnAppQuit?(this.nativeUpdater.once("error",c),this.nativeUpdater.checkForUpdates()):u([])})})}handleUpdateDownloaded(){this.autoRunAppAfterInstall?this.nativeUpdater.quitAndInstall():this.app.quit(),this.closeServerIfExists()}quitAndInstall(){this.squirrelDownloadedUpdate?this.handleUpdateDownloaded():(this.nativeUpdater.on("update-downloaded",()=>this.handleUpdateDownloaded()),this.autoInstallOnAppQuit||this.nativeUpdater.checkForUpdates())}}zr.MacUpdater=X_;var Vr={},vo={};Object.defineProperty(vo,"__esModule",{value:!0});vo.verifySignature=Q_;const Rl=me,Ju=fe,K_=ne,Dl=D;function Xu(e,t){return['set "PSModulePath=" & chcp 65001 >NUL & powershell.exe',["-NoProfile","-NonInteractive","-InputFormat","None","-Command",e],{shell:!0,timeout:t}]}function Q_(e,t,r){return new Promise((n,i)=>{const s=t.replace(/'/g,"''");r.info(`Verifying signature ${s}`),(0,Ju.execFile)(...Xu(`"Get-AuthenticodeSignature -LiteralPath '${s}' | ConvertTo-Json -Compress"`,20*1e3),(o,a,l)=>{var u;try{if(o!=null||l){vs(r,o,l,i),n(null);return}const c=Z_(a);if(c.Status===0){try{const w=Dl.normalize(c.Path),y=Dl.normalize(t);if(r.info(`LiteralPath: ${w}. Update Path: ${y}`),w!==y){vs(r,new Error(`LiteralPath of ${w} is different than ${y}`),l,i),n(null);return}}catch(w){r.warn(`Unable to verify LiteralPath of update asset due to missing data.Path. Skipping this step of validation. Message: ${(u=w.message)!==null&&u!==void 0?u:w.stack}`)}const h=(0,Rl.parseDn)(c.SignerCertificate.Subject);let p=!1;for(const w of e){const y=(0,Rl.parseDn)(w);if(y.size?p=Array.from(y.keys()).every(C=>y.get(C)===h.get(C)):w===h.get("CN")&&(r.warn(`Signature validated using only CN ${w}. Please add your full Distinguished Name (DN) to publisherNames configuration`),p=!0),p){n(null);return}}}const f=`publisherNames: ${e.join(" | ")}, raw info: `+JSON.stringify(c,(h,p)=>h==="RawData"?void 0:p,2);r.warn(`Sign verification failed, installer signed with incorrect certificate: ${f}`),n(f)}catch(c){vs(r,c,null,i),n(null);return}})})}function Z_(e){const t=JSON.parse(e);delete t.PrivateKey,delete t.IsOSBinary,delete t.SignatureType;const r=t.SignerCertificate;return r!=null&&(delete r.Archived,delete r.Extensions,delete r.Handle,delete r.HasPrivateKey,delete r.SubjectName),t}function vs(e,t,r,n){if(eS()){e.warn(`Cannot execute Get-AuthenticodeSignature: ${t||r}. Ignoring signature validation due to unsupported powershell version. Please upgrade to powershell 3 or higher.`);return}try{(0,Ju.execFileSync)(...Xu("ConvertTo-Json test",10*1e3))}catch(i){e.warn(`Cannot execute ConvertTo-Json: ${i.message}. Ignoring signature validation due to unsupported powershell version. Please upgrade to powershell 3 or higher.`);return}t!=null&&n(t),r&&n(new Error(`Cannot execute Get-AuthenticodeSignature, stderr: ${r}. Failing signature validation due to unknown stderr.`))}function eS(){const e=K_.release();return e.startsWith("6.")&&!e.startsWith("6.3")}Object.defineProperty(Vr,"__esModule",{value:!0});Vr.NsisUpdater=void 0;const Ln=me,Nl=D,tS=Wt,rS=ln,$l=It,nS=he,iS=bt,sS=vo,xl=We;class oS extends tS.BaseUpdater{constructor(t,r){super(t,r),this._verifyUpdateCodeSignature=(n,i)=>(0,sS.verifySignature)(n,i,this._logger)}get verifyUpdateCodeSignature(){return this._verifyUpdateCodeSignature}set verifyUpdateCodeSignature(t){t&&(this._verifyUpdateCodeSignature=t)}doDownloadUpdate(t){const r=t.updateInfoAndProvider.provider,n=(0,nS.findFile)(r.resolveFiles(t.updateInfoAndProvider.info),"exe");return this.executeDownload({fileExtension:"exe",downloadUpdateOptions:t,fileInfo:n,task:async(i,s,o,a)=>{const l=n.packageInfo,u=l!=null&&o!=null;if(u&&t.disableWebInstaller)throw(0,Ln.newError)(`Unable to download new version ${t.updateInfoAndProvider.info.version}. Web Installers are disabled`,"ERR_UPDATER_WEB_INSTALLER_DISABLED");!u&&!t.disableWebInstaller&&this._logger.warn("disableWebInstaller is set to false, you should set it to true if you do not plan on using a web installer. This will default to true in a future version."),(u||t.disableDifferentialDownload||await this.differentialDownloadInstaller(n,t,i,r,Ln.CURRENT_APP_INSTALLER_FILE_NAME))&&await this.httpExecutor.download(n.url,i,s);const c=await this.verifySignature(i);if(c!=null)throw await a(),(0,Ln.newError)(`New version ${t.updateInfoAndProvider.info.version} is not signed by the application owner: ${c}`,"ERR_UPDATER_INVALID_SIGNATURE");if(u&&await this.differentialDownloadWebPackage(t,l,o,r))try{await this.httpExecutor.download(new xl.URL(l.path),o,{headers:t.requestHeaders,cancellationToken:t.cancellationToken,sha512:l.sha512})}catch(f){try{await(0,iS.unlink)(o)}catch{}throw f}}})}async verifySignature(t){let r;try{if(r=(await this.configOnDisk.value).publisherName,r==null)return null}catch(n){if(n.code==="ENOENT")return null;throw n}return await this._verifyUpdateCodeSignature(Array.isArray(r)?r:[r],t)}doInstall(t){const r=this.installerPath;if(r==null)return this.dispatchError(new Error("No update filepath provided, can't quit and install")),!1;const n=["--updated"];t.isSilent&&n.push("/S"),t.isForceRunAfter&&n.push("--force-run"),this.installDirectory&&n.push(`/D=${this.installDirectory}`);const i=this.downloadedUpdateHelper==null?null:this.downloadedUpdateHelper.packageFile;i!=null&&n.push(`--package-file=${i}`);const s=()=>{this.spawnLog(Nl.join(process.resourcesPath,"elevate.exe"),[r].concat(n)).catch(o=>this.dispatchError(o))};return t.isAdminRightsRequired?(this._logger.info("isAdminRightsRequired is set to true, run installer using elevate.exe"),s(),!0):(this.spawnLog(r,n).catch(o=>{const a=o.code;this._logger.info(`Cannot run installer: error code: ${a}, error message: "${o.message}", will be executed again using elevate if EACCES, and will try to use electron.shell.openItem if ENOENT`),a==="UNKNOWN"||a==="EACCES"?s():a==="ENOENT"?$.shell.openPath(r).catch(l=>this.dispatchError(l)):this.dispatchError(o)}),!0)}async differentialDownloadWebPackage(t,r,n,i){if(r.blockMapSize==null)return!0;try{const s={newUrl:new xl.URL(r.path),oldFile:Nl.join(this.downloadedUpdateHelper.cacheDir,Ln.CURRENT_APP_PACKAGE_FILE_NAME),logger:this._logger,newFile:n,requestHeaders:this.requestHeaders,isUseMultipleRangeRequest:i.isUseMultipleRangeRequest,cancellationToken:t.cancellationToken};this.listenerCount($l.DOWNLOAD_PROGRESS)>0&&(s.onProgress=o=>this.emit($l.DOWNLOAD_PROGRESS,o)),await new rS.FileWithEmbeddedBlockMapDifferentialDownloader(r,this.httpExecutor,s).download()}catch(s){return this._logger.error(`Cannot download differentially, fallback to full download: ${s.stack||s}`),process.platform==="win32"}return!1}}Vr.NsisUpdater=oS;(function(e){var t=De&&De.__createBinding||(Object.create?function(E,C,A,R){R===void 0&&(R=A);var L=Object.getOwnPropertyDescriptor(C,A);(!L||("get"in L?!C.__esModule:L.writable||L.configurable))&&(L={enumerable:!0,get:function(){return C[A]}}),Object.defineProperty(E,R,L)}:function(E,C,A,R){R===void 0&&(R=A),E[R]=C[A]}),r=De&&De.__exportStar||function(E,C){for(var A in E)A!=="default"&&!Object.prototype.hasOwnProperty.call(C,A)&&t(C,E,A)};Object.defineProperty(e,"__esModule",{value:!0}),e.NsisUpdater=e.MacUpdater=e.RpmUpdater=e.PacmanUpdater=e.DebUpdater=e.AppImageUpdater=e.Provider=e.NoOpLogger=e.AppUpdater=e.BaseUpdater=void 0;const n=bt,i=D;var s=Wt;Object.defineProperty(e,"BaseUpdater",{enumerable:!0,get:function(){return s.BaseUpdater}});var o=_t;Object.defineProperty(e,"AppUpdater",{enumerable:!0,get:function(){return o.AppUpdater}}),Object.defineProperty(e,"NoOpLogger",{enumerable:!0,get:function(){return o.NoOpLogger}});var a=he;Object.defineProperty(e,"Provider",{enumerable:!0,get:function(){return a.Provider}});var l=Hr;Object.defineProperty(e,"AppImageUpdater",{enumerable:!0,get:function(){return l.AppImageUpdater}});var u=qr;Object.defineProperty(e,"DebUpdater",{enumerable:!0,get:function(){return u.DebUpdater}});var c=Gr;Object.defineProperty(e,"PacmanUpdater",{enumerable:!0,get:function(){return c.PacmanUpdater}});var f=Wr;Object.defineProperty(e,"RpmUpdater",{enumerable:!0,get:function(){return f.RpmUpdater}});var h=zr;Object.defineProperty(e,"MacUpdater",{enumerable:!0,get:function(){return h.MacUpdater}});var p=Vr;Object.defineProperty(e,"NsisUpdater",{enumerable:!0,get:function(){return p.NsisUpdater}}),r(It,e);let w;function y(){if(process.platform==="win32")w=new Vr.NsisUpdater;else if(process.platform==="darwin")w=new zr.MacUpdater;else{w=new Hr.AppImageUpdater;try{const E=i.join(process.resourcesPath,"package-type");if(!(0,n.existsSync)(E))return w;switch((0,n.readFileSync)(E).toString().trim()){case"deb":w=new qr.DebUpdater;break;case"rpm":w=new Wr.RpmUpdater;break;case"pacman":w=new Gr.PacmanUpdater;break;default:break}}catch(E){console.warn("Unable to detect 'package-type' for autoUpdater (rpm/deb/pacman support). If you'd like to expand support, please consider contributing to electron-builder",E.message)}}return w}Object.defineProperty(e,"autoUpdater",{enumerable:!0,get:()=>w||y()})})(Xe);let He=null;function aS(e){He=e,Xe.autoUpdater.autoDownload=!0,Xe.autoUpdater.autoInstallOnAppQuit=!0,Xe.autoUpdater.on("update-available",t=>{He==null||He.webContents.send("updater:available",{version:t.version,releaseNotes:t.releaseNotes??null})}),Xe.autoUpdater.on("update-not-available",()=>{}),Xe.autoUpdater.on("download-progress",t=>{He==null||He.webContents.send("updater:progress",Math.round(t.percent))}),Xe.autoUpdater.on("update-downloaded",()=>{He==null||He.webContents.send("updater:ready")}),Xe.autoUpdater.on("error",t=>{console.error("[updater] Error:",t.message),He==null||He.webContents.send("updater:error",t.message)}),$.ipcMain.handle("updater:check",async()=>{try{await Xe.autoUpdater.checkForUpdates()}catch(t){console.error("[updater] checkForUpdates failed:",t)}}),$.ipcMain.handle("updater:quit-and-install",()=>{Xe.autoUpdater.quitAndInstall(!1,!0)})}function lS(){Xe.autoUpdater.checkForUpdates().catch(e=>{console.error("[updater] background check failed:",e)})}function cS(){if(process.platform==="win32")return;try{const s=process.env.SHELL??"/bin/zsh",o=fe.execSync(`${s} -l -c 'echo $PATH'`,{timeout:3e3}).toString().trim();if(o){process.env.PATH=o;return}}catch{}const e=ne.homedir(),t=["/usr/local/bin","/opt/homebrew/bin","/opt/local/bin",`${e}/.npm-global/bin`,"/usr/local/opt/node/bin"];try{const s=D.join(e,".nvm","versions","node");if(F.existsSync(s)){const o=F.readdirSync(s).sort().reverse()[0];o&&t.push(D.join(s,o,"bin"))}}catch{}const r=process.env.PATH??"",n=new Set(r.split(":").filter(Boolean)),i=t.filter(s=>!n.has(s));i.length&&(process.env.PATH=[...i,r].join(":"))}cS();const wo=D.dirname(We.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:xi&&xi.tagName.toUpperCase()==="SCRIPT"&&xi.src||new URL("main.js",document.baseURI).href));process.env.DIST=D.join(wo,"../dist");process.env.VITE_PUBLIC=$.app.isPackaged?process.env.DIST:D.join(process.env.DIST,"../public");let Te,Ue=null,ti=null,ri=null;const Yr=process.env.VITE_DEV_SERVER_URL;function uS(){const e=process.platform==="darwin",t=!!Yr,r=[...e?[{label:$.app.name,submenu:[{role:"about"},{type:"separator"},{role:"services"},{type:"separator"},{role:"hide"},{role:"hideOthers"},{role:"unhide"},{type:"separator"},{role:"quit"}]}]:[],{label:"Edit",submenu:[{role:"undo"},{role:"redo"},{type:"separator"},{role:"cut"},{role:"copy"},{role:"paste"},...e?[{role:"pasteAndMatchStyle"},{role:"delete"},{role:"selectAll"}]:[{role:"delete"},{type:"separator"},{role:"selectAll"}]]},{label:"View",submenu:[...t?[{role:"reload"},{role:"forceReload"},{role:"toggleDevTools"},{type:"separator"}]:[],{role:"resetZoom"},{role:"zoomIn"},{role:"zoomOut"},{type:"separator"},{role:"togglefullscreen"}]},{label:"Window",submenu:[{role:"minimize"},{role:"zoom"},...e?[{type:"separator"},{role:"front"}]:[{role:"close"}]]}];$.Menu.setApplicationMenu($.Menu.buildFromTemplate(r))}function Ku(){return Te=new $.BrowserWindow({width:1280,height:800,minWidth:900,minHeight:600,titleBarStyle:"hiddenInset",trafficLightPosition:{x:18,y:18},vibrancy:"under-window",visualEffectState:"active",backgroundColor:"#F5F3FF",show:!1,webPreferences:{preload:D.join(wo,"preload.js"),contextIsolation:!0,nodeIntegration:!1,sandbox:!1}}),Te.once("ready-to-show",()=>{Te==null||Te.show()}),$.nativeTheme.on("updated",()=>{Te==null||Te.webContents.send("native-theme-changed",$.nativeTheme.shouldUseDarkColors)}),Yr?(Te.loadURL(Yr),Te.webContents.openDevTools({mode:"detach"})):Te.loadFile(D.join(process.env.DIST,"index.html")),Te.on("closed",()=>{Te=null}),Te}function fS(){return Ue&&!Ue.isDestroyed()?(Ue.focus(),Ue):(Ue=new $.BrowserWindow({width:1100,height:780,minWidth:780,minHeight:560,titleBarStyle:"hiddenInset",trafficLightPosition:{x:18,y:18},vibrancy:"under-window",visualEffectState:"active",backgroundColor:"#F5F3FF",title:"Jivam Cloud",show:!1,webPreferences:{preload:D.join(wo,"preload.js"),contextIsolation:!0,nodeIntegration:!1,sandbox:!1}}),Ue.once("ready-to-show",()=>Ue==null?void 0:Ue.show()),Ue.on("closed",()=>{Ue=null}),Yr?Ue.loadURL(`${Yr}?mode=cloud`):Ue.loadFile(D.join(process.env.DIST,"index.html"),{query:{mode:"cloud"}}),Ue)}function dS(){return ti=new Ud,ti}function hS(){return ri=new Ld,ri}$.app.on("window-all-closed",()=>{process.platform!=="darwin"&&($.app.quit(),Te=null)});$.app.on("before-quit",async()=>{ti&&await ti.cleanup(),ri&&await ri.cleanup()});$.app.on("activate",()=>{$.BrowserWindow.getAllWindows().length===0&&Ku()});$.app.whenReady().then(()=>{$.app.name="Jivam";const e=dS(),t=hS();Od(e,t,()=>Te),uS(),$.ipcMain.handle("cloud:open-window",()=>{fS()});const r=Ku();$.app.isPackaged&&r.webContents.once("did-finish-load",()=>{aS(r),setTimeout(lS,5e3)})});
131
+ //# sourceMappingURL=main.js.map