@spotlightjs/spotlight 2.6.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- "use strict";const Te=require("fs"),rt=require("os"),te=require("path"),Pe=require("child_process"),V=require("node:fs"),Ie=require("node:http"),I=require("node:path"),ue=require("node:zlib"),ot=require("node:os"),it=require("node:url"),st=require("node:module");var D=typeof document<"u"?document.currentScript:null;function $e(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const ie=$e(I),at=$e(ot);function lt(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var pe={exports:{}},C=String,De=function(){return{isColorSupported:!1,reset:C,bold:C,dim:C,italic:C,underline:C,inverse:C,hidden:C,strikethrough:C,black:C,red:C,green:C,yellow:C,blue:C,magenta:C,cyan:C,white:C,gray:C,bgBlack:C,bgRed:C,bgGreen:C,bgYellow:C,bgBlue:C,bgMagenta:C,bgCyan:C,bgWhite:C,blackBright:C,redBright:C,greenBright:C,yellowBright:C,blueBright:C,magentaBright:C,cyanBright:C,whiteBright:C,bgBlackBright:C,bgRedBright:C,bgGreenBright:C,bgYellowBright:C,bgBlueBright:C,bgMagentaBright:C,bgCyanBright:C,bgWhiteBright:C}};pe.exports=De();pe.exports.createColors=De;var ct=pe.exports,de={},ut=function(e){return e.map(function(t){return t&&typeof t=="object"?t.op.replace(/(.)/g,"\\$1"):/["\s]/.test(t)&&!/'/.test(t)?"'"+t.replace(/(['\\])/g,"\\$1")+"'":/["'\s]/.test(t)?'"'+t.replace(/(["\\$`!])/g,"\\$1")+'"':String(t).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")},Ue="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",Ce=new RegExp("^"+Ue+"$"),we="|&;()<> \\t",pt='"((\\\\"|[^"])*?)"',dt="'((\\\\'|[^'])*?)'",ft=/^#$/,Se="'",be='"',se="$",P="",ht=4294967296;for(var ye=0;ye<4;ye++)P+=(ht*Math.random()).toString(16);var gt=new RegExp("^"+P);function mt(o,e){for(var t=e.lastIndex,n=[],r;r=e.exec(o);)n.push(r),e.lastIndex===r.index&&(e.lastIndex+=1);return e.lastIndex=t,n}function _t(o,e,t){var n=typeof o=="function"?o(t):o[t];return typeof n>"u"&&t!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+P+JSON.stringify(n)+P:e+n}function Ct(o,e,t){t||(t={});var n=t.escape||"\\",r="(\\"+n+`['"`+we+`]|[^\\s'"`+we+"])+",i=new RegExp(["("+Ue+")","("+r+"|"+pt+"|"+dt+")+"].join("|"),"g"),a=mt(o,i);if(a.length===0)return[];e||(e={});var l=!1;return a.map(function(s){var c=s[0];if(!c||l)return;if(Ce.test(c))return{op:c};var f=!1,_=!1,h="",S=!1,w;function L(){w+=1;var A,R,B=c.charAt(w);if(B==="{"){if(w+=1,c.charAt(w)==="}")throw new Error("Bad substitution: "+c.slice(w-2,w+1));if(A=c.indexOf("}",w),A<0)throw new Error("Bad substitution: "+c.slice(w));R=c.slice(w,A),w=A}else if(/[*@#?$!_-]/.test(B))R=B,w+=1;else{var N=c.slice(w);A=N.match(/[^\w\d_]/),A?(R=N.slice(0,A.index),w+=A.index-1):(R=N,w=c.length)}return _t(e,"",R)}for(w=0;w<c.length;w++){var b=c.charAt(w);if(S=S||!f&&(b==="*"||b==="?"),_)h+=b,_=!1;else if(f)b===f?f=!1:f==Se?h+=b:b===n?(w+=1,b=c.charAt(w),b===be||b===n||b===se?h+=b:h+=n+b):b===se?h+=L():h+=b;else if(b===be||b===Se)f=b;else{if(Ce.test(b))return{op:c};if(ft.test(b)){l=!0;var q={comment:o.slice(s.index+w+1)};return h.length?[h,q]:[q]}else b===n?_=!0:b===se?h+=L():h+=b}}return S?{op:"glob",pattern:h}:h}).reduce(function(s,c){return typeof c>"u"?s:s.concat(c)},[])}var wt=function(e,t,n){var r=Ct(e,t,n);return typeof t!="function"?r:r.reduce(function(i,a){if(typeof a=="object")return i.concat(a);var l=a.split(RegExp("("+P+".*?"+P+")","g"));return l.length===1?i.concat(l[0]):i.concat(l.filter(Boolean).map(function(s){return gt.test(s)?JSON.parse(s.split(P)[1]):s}))},[])};de.quote=ut;de.parse=wt;var St={"/Applications/Atom.app/Contents/MacOS/Atom":"atom","/Applications/Atom Beta.app/Contents/MacOS/Atom Beta":"/Applications/Atom Beta.app/Contents/MacOS/Atom Beta","/Applications/Brackets.app/Contents/MacOS/Brackets":"brackets","/Applications/Sublime Text.app/Contents/MacOS/Sublime Text":"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text.app/Contents/MacOS/sublime_text":"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2":"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text":"/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl","/Applications/Visual Studio Code.app/Contents/MacOS/Electron":"code","/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron":"code-insiders","/Applications/VSCodium.app/Contents/MacOS/Electron":"codium","/Applications/Cursor.app/Contents/MacOS/Cursor":"cursor","/Applications/AppCode.app/Contents/MacOS/appcode":"/Applications/AppCode.app/Contents/MacOS/appcode","/Applications/CLion.app/Contents/MacOS/clion":"/Applications/CLion.app/Contents/MacOS/clion","/Applications/IntelliJ IDEA.app/Contents/MacOS/idea":"/Applications/IntelliJ IDEA.app/Contents/MacOS/idea","/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea":"/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea","/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea":"/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea","/Applications/PhpStorm.app/Contents/MacOS/phpstorm":"/Applications/PhpStorm.app/Contents/MacOS/phpstorm","/Applications/PyCharm.app/Contents/MacOS/pycharm":"/Applications/PyCharm.app/Contents/MacOS/pycharm","/Applications/PyCharm CE.app/Contents/MacOS/pycharm":"/Applications/PyCharm CE.app/Contents/MacOS/pycharm","/Applications/RubyMine.app/Contents/MacOS/rubymine":"/Applications/RubyMine.app/Contents/MacOS/rubymine","/Applications/WebStorm.app/Contents/MacOS/webstorm":"/Applications/WebStorm.app/Contents/MacOS/webstorm","/Applications/MacVim.app/Contents/MacOS/MacVim":"mvim","/Applications/GoLand.app/Contents/MacOS/goland":"/Applications/GoLand.app/Contents/MacOS/goland","/Applications/Rider.app/Contents/MacOS/rider":"/Applications/Rider.app/Contents/MacOS/rider","/Applications/Zed.app/Contents/MacOS/zed":"zed"},bt={atom:"atom",Brackets:"brackets","code-insiders":"code-insiders",code:"code",vscodium:"vscodium",codium:"codium",emacs:"emacs",gvim:"gvim",idea:"idea","idea.sh":"idea",phpstorm:"phpstorm","phpstorm.sh":"phpstorm",pycharm:"pycharm","pycharm.sh":"pycharm",rubymine:"rubymine","rubymine.sh":"rubymine",sublime_text:"subl",vim:"vim",webstorm:"webstorm","webstorm.sh":"webstorm",goland:"goland","goland.sh":"goland",rider:"rider","rider.sh":"rider"},yt=["Brackets.exe","Code.exe","Code - Insiders.exe","VSCodium.exe","atom.exe","sublime_text.exe","notepad++.exe","clion.exe","clion64.exe","idea.exe","idea64.exe","phpstorm.exe","phpstorm64.exe","pycharm.exe","pycharm64.exe","rubymine.exe","rubymine64.exe","webstorm.exe","webstorm64.exe","goland.exe","goland64.exe","rider.exe","rider64.exe"];const Et=te,At=de,ae=Pe,J=St,Ee=bt,xt=yt;var Ot=function(e){if(e)return At.parse(e);if(process.env.LAUNCH_EDITOR)return[process.env.LAUNCH_EDITOR];if(process.versions.webcontainer)return[process.env.EDITOR||"code"];try{if(process.platform==="darwin"){const t=ae.execSync("ps x -o comm=",{stdio:["pipe","pipe","ignore"]}).toString(),n=Object.keys(J),r=t.split(`
3
- `);for(let i=0;i<n.length;i++){const a=n[i];if(r.includes(a))return[J[a]];const l=a.replace("/Applications","");if(t.indexOf(l)!==-1){if(a!==J[a])return[J[a]];const s=r.find(c=>c.endsWith(l));if(s!==void 0)return[s]}}}else if(process.platform==="win32"){const n=ae.execSync('powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"',{stdio:["pipe","pipe","ignore"]}).toString().split(`\r
4
- `);for(let r=0;r<n.length;r++){const i=n[r].trim(),a=Et.basename(i);if(xt.indexOf(a)!==-1)return[i]}}else if(process.platform==="linux"){const t=ae.execSync("ps x --no-heading -o comm --sort=comm",{stdio:["pipe","pipe","ignore"]}).toString(),n=Object.keys(Ee);for(let r=0;r<n.length;r++){const i=n[r];if(t.indexOf(i)!==-1)return[Ee[i]]}}}catch{}return process.env.VISUAL?[process.env.VISUAL]:process.env.EDITOR?[process.env.EDITOR]:[null]};const Mt=te;var vt=function(e,t,n,r=1){switch(Mt.basename(e).replace(/\.(exe|cmd|bat)$/i,"")){case"atom":case"Atom":case"Atom Beta":case"subl":case"sublime":case"sublime_text":case"wstorm":case"charm":case"zed":return[`${t}:${n}:${r}`];case"notepad++":return["-n"+n,"-c"+r,t];case"vim":case"mvim":return[`+call cursor(${n}, ${r})`,t];case"joe":case"gvim":return[`+${n}`,t];case"emacs":case"emacsclient":return[`+${n}:${r}`,t];case"rmate":case"mate":case"mine":return["--line",n,t];case"code":case"Code":case"code-insiders":case"Code - Insiders":case"codium":case"cursor":case"vscodium":case"VSCodium":return["-r","-g",`${t}:${n}:${r}`];case"appcode":case"clion":case"clion64":case"idea":case"idea64":case"phpstorm":case"phpstorm64":case"pycharm":case"pycharm64":case"rubymine":case"rubymine64":case"webstorm":case"webstorm64":case"goland":case"goland64":case"rider":case"rider64":return["--line",n,"--column",r,t]}return process.env.LAUNCH_EDITOR?[t,n,r]:[t]};const Lt=Te,Rt=rt,Be=te,Ae=ct,xe=Pe,Tt=Ot,Pt=vt;function It(o){return(e,t)=>{console.log(),console.log(Ae.red("Could not open "+Be.basename(e)+" in the editor.")),t&&(t[t.length-1]!=="."&&(t+="."),console.log(Ae.red("The editor process exited with an error: "+t))),console.log(),o&&o(e,t)}}function $t(o){switch(o){case"vim":case"emacs":case"nano":return!0}return!1}const Oe=/:(\d+)(:(\d+))?$/;function Dt(o){const e=o.replace(Oe,""),t=o.match(Oe),n=t&&t[1],r=t&&t[3];return{fileName:e,lineNumber:n,columnNumber:r}}let T=null;function Ut(o,e,t){const n=Dt(o);let{fileName:r}=n;const{lineNumber:i,columnNumber:a}=n;if(!Lt.existsSync(r))return;typeof e=="function"&&(t=e,e=void 0),t=It(t);const[l,...s]=Tt(e);if(!l){t(r,null);return}if(process.platform==="linux"&&r.startsWith("/mnt/")&&/Microsoft/i.test(Rt.release())&&(r=Be.relative("",r)),i){const c=Pt(l,r,i,a);s.push.apply(s,c)}else s.push(r);if(T&&$t(l)&&T.kill("SIGKILL"),process.platform==="win32"){let c=function(h){return h.replace(/([&|<>,;=^])/g,"^$1")},f=function(h){return h.includes("^")?`^"${h}^"`:h.includes(" ")?`"${h}"`:h};const _=[l,...s.map(c)].map(f).join(" ");T=xe.exec(_,{stdio:"inherit",shell:!0})}else T=xe.spawn(l,s,{stdio:"inherit"});T.on("exit",function(c){T=null,c&&t(r,"(code "+c+")")}),T.on("error",function(c){let{code:f,message:_}=c;f==="ENOENT"&&(_=`${_} ('${l}' command does not exist in 'PATH')`),t(r,_)})}var Bt=Ut;const Nt=lt(Bt);var Ne={},je={};const Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");je.encode=function(o){if(0<=o&&o<Me.length)return Me[o];throw new TypeError("Must be between 0 and 63: "+o)};const jt=je,Ge=5,ke=1<<Ge,Gt=ke-1,kt=ke;function Ft(o){return o<0?(-o<<1)+1:(o<<1)+0}Ne.encode=function(e){let t="",n,r=Ft(e);do n=r&Gt,r>>>=Ge,r>0&&(n|=kt),t+=jt.encode(n);while(r>0);return t};var ne={};(function(o){function e(u,p,m){if(p in u)return u[p];if(arguments.length===3)return m;throw new Error('"'+p+'" is a required argument.')}o.getArg=e;const t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function r(u){const p=u.match(t);return p?{scheme:p[1],auth:p[2],host:p[3],port:p[4],path:p[5]}:null}o.urlParse=r;function i(u){let p="";return u.scheme&&(p+=u.scheme+":"),p+="//",u.auth&&(p+=u.auth+"@"),u.host&&(p+=u.host),u.port&&(p+=":"+u.port),u.path&&(p+=u.path),p}o.urlGenerate=i;const a=32;function l(u){const p=[];return function(m){for(let O=0;O<p.length;O++)if(p[O].input===m){const v=p[0];return p[0]=p[O],p[O]=v,p[0].result}const d=u(m);return p.unshift({input:m,result:d}),p.length>a&&p.pop(),d}}const s=l(function(p){let m=p;const d=r(p);if(d){if(!d.path)return p;m=d.path}const O=o.isAbsolute(m),v=[];let H=0,x=0;for(;;)if(H=x,x=m.indexOf("/",H),x===-1){v.push(m.slice(H));break}else for(v.push(m.slice(H,x));x<m.length&&m[x]==="/";)x++;let j=0;for(x=v.length-1;x>=0;x--){const oe=v[x];oe==="."?v.splice(x,1):oe===".."?j++:j>0&&(oe===""?(v.splice(x+1,j),j=0):(v.splice(x,2),j--))}return m=v.join("/"),m===""&&(m=O?"/":"."),d?(d.path=m,i(d)):m});o.normalize=s;function c(u,p){u===""&&(u="."),p===""&&(p=".");const m=r(p),d=r(u);if(d&&(u=d.path||"/"),m&&!m.scheme)return d&&(m.scheme=d.scheme),i(m);if(m||p.match(n))return p;if(d&&!d.host&&!d.path)return d.host=p,i(d);const O=p.charAt(0)==="/"?p:s(u.replace(/\/+$/,"")+"/"+p);return d?(d.path=O,i(d)):O}o.join=c,o.isAbsolute=function(u){return u.charAt(0)==="/"||t.test(u)};function f(u,p){u===""&&(u="."),u=u.replace(/\/$/,"");let m=0;for(;p.indexOf(u+"/")!==0;){const d=u.lastIndexOf("/");if(d<0||(u=u.slice(0,d),u.match(/^([^\/]+:\/)?\/*$/)))return p;++m}return Array(m+1).join("../")+p.substr(u.length+1)}o.relative=f;const _=function(){return!("__proto__"in Object.create(null))}();function h(u){return u}function S(u){return L(u)?"$"+u:u}o.toSetString=_?h:S;function w(u){return L(u)?u.slice(1):u}o.fromSetString=_?h:w;function L(u){if(!u)return!1;const p=u.length;if(p<9||u.charCodeAt(p-1)!==95||u.charCodeAt(p-2)!==95||u.charCodeAt(p-3)!==111||u.charCodeAt(p-4)!==116||u.charCodeAt(p-5)!==111||u.charCodeAt(p-6)!==114||u.charCodeAt(p-7)!==112||u.charCodeAt(p-8)!==95||u.charCodeAt(p-9)!==95)return!1;for(let m=p-10;m>=0;m--)if(u.charCodeAt(m)!==36)return!1;return!0}function b(u,p,m){let d=A(u.source,p.source);return d!==0||(d=u.originalLine-p.originalLine,d!==0)||(d=u.originalColumn-p.originalColumn,d!==0||m)||(d=u.generatedColumn-p.generatedColumn,d!==0)||(d=u.generatedLine-p.generatedLine,d!==0)?d:A(u.name,p.name)}o.compareByOriginalPositions=b;function q(u,p,m){let d=u.generatedLine-p.generatedLine;return d!==0||(d=u.generatedColumn-p.generatedColumn,d!==0||m)||(d=A(u.source,p.source),d!==0)||(d=u.originalLine-p.originalLine,d!==0)||(d=u.originalColumn-p.originalColumn,d!==0)?d:A(u.name,p.name)}o.compareByGeneratedPositionsDeflated=q;function A(u,p){return u===p?0:u===null?1:p===null?-1:u>p?1:-1}function R(u,p){let m=u.generatedLine-p.generatedLine;return m!==0||(m=u.generatedColumn-p.generatedColumn,m!==0)||(m=A(u.source,p.source),m!==0)||(m=u.originalLine-p.originalLine,m!==0)||(m=u.originalColumn-p.originalColumn,m!==0)?m:A(u.name,p.name)}o.compareByGeneratedPositionsInflated=R;function B(u){return JSON.parse(u.replace(/^\)]}'[^\n]*\n/,""))}o.parseSourceMapInput=B;function N(u,p,m){if(p=p||"",u&&(u[u.length-1]!=="/"&&p[0]!=="/"&&(u+="/"),p=u+p),m){const d=r(m);if(!d)throw new Error("sourceMapURL could not be parsed");if(d.path){const O=d.path.lastIndexOf("/");O>=0&&(d.path=d.path.substring(0,O+1))}p=c(i(d),p)}return s(p)}o.computeSourceURL=N})(ne);var fe={};let zt=class Fe{constructor(){this._array=[],this._set=new Map}static fromArray(e,t){const n=new Fe;for(let r=0,i=e.length;r<i;r++)n.add(e[r],t);return n}size(){return this._set.size}add(e,t){const n=this.has(e),r=this._array.length;(!n||t)&&this._array.push(e),n||this._set.set(e,r)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};fe.ArraySet=zt;var ze={};const We=ne;function Wt(o,e){const t=o.generatedLine,n=e.generatedLine,r=o.generatedColumn,i=e.generatedColumn;return n>t||n==t&&i>=r||We.compareByGeneratedPositionsInflated(o,e)<=0}let Vt=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){Wt(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(We.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};ze.MappingList=Vt;const G=Ne,y=ne,Q=fe.ArraySet,qt=ze.MappingList;class he{constructor(e){e||(e={}),this._file=y.getArg(e,"file",null),this._sourceRoot=y.getArg(e,"sourceRoot",null),this._skipValidation=y.getArg(e,"skipValidation",!1),this._sources=new Q,this._names=new Q,this._mappings=new qt,this._sourcesContents=null}static fromSourceMap(e){const t=e.sourceRoot,n=new he({file:e.file,sourceRoot:t});return e.eachMapping(function(r){const i={generated:{line:r.generatedLine,column:r.generatedColumn}};r.source!=null&&(i.source=r.source,t!=null&&(i.source=y.relative(t,i.source)),i.original={line:r.originalLine,column:r.originalColumn},r.name!=null&&(i.name=r.name)),n.addMapping(i)}),e.sources.forEach(function(r){let i=r;t!==null&&(i=y.relative(t,r)),n._sources.has(i)||n._sources.add(i);const a=e.sourceContentFor(r);a!=null&&n.setSourceContent(r,a)}),n}addMapping(e){const t=y.getArg(e,"generated"),n=y.getArg(e,"original",null);let r=y.getArg(e,"source",null),i=y.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,r,i),r!=null&&(r=String(r),this._sources.has(r)||this._sources.add(r)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:r,name:i})}setSourceContent(e,t){let n=e;this._sourceRoot!=null&&(n=y.relative(this._sourceRoot,n)),t!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[y.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[y.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(e,t,n){let r=t;if(t==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);r=e.file}const i=this._sourceRoot;i!=null&&(r=y.relative(i,r));const a=this._mappings.toArray().length>0?new Q:this._sources,l=new Q;this._mappings.unsortedForEach(function(s){if(s.source===r&&s.originalLine!=null){const _=e.originalPositionFor({line:s.originalLine,column:s.originalColumn});_.source!=null&&(s.source=_.source,n!=null&&(s.source=y.join(n,s.source)),i!=null&&(s.source=y.relative(i,s.source)),s.originalLine=_.line,s.originalColumn=_.column,_.name!=null&&(s.name=_.name))}const c=s.source;c!=null&&!a.has(c)&&a.add(c);const f=s.name;f!=null&&!l.has(f)&&l.add(f)},this),this._sources=a,this._names=l,e.sources.forEach(function(s){const c=e.sourceContentFor(s);c!=null&&(n!=null&&(s=y.join(n,s)),i!=null&&(s=y.relative(i,s)),this.setSourceContent(s,c))},this)}_validateMapping(e,t,n,r){if(t&&typeof t.line!="number"&&typeof t.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!n&&!r)){if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))}}_serializeMappings(){let e=0,t=1,n=0,r=0,i=0,a=0,l="",s,c,f,_;const h=this._mappings.toArray();for(let S=0,w=h.length;S<w;S++){if(c=h[S],s="",c.generatedLine!==t)for(e=0;c.generatedLine!==t;)s+=";",t++;else if(S>0){if(!y.compareByGeneratedPositionsInflated(c,h[S-1]))continue;s+=","}s+=G.encode(c.generatedColumn-e),e=c.generatedColumn,c.source!=null&&(_=this._sources.indexOf(c.source),s+=G.encode(_-a),a=_,s+=G.encode(c.originalLine-1-r),r=c.originalLine-1,s+=G.encode(c.originalColumn-n),n=c.originalColumn,c.name!=null&&(f=this._names.indexOf(c.name),s+=G.encode(f-i),i=f)),l+=s}return l}_generateSourcesContent(e,t){return e.map(function(n){if(!this._sourcesContents)return null;t!=null&&(n=y.relative(t,n));const r=y.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}}he.prototype._version=3;var re={},Ve={};(function(o){o.GREATEST_LOWER_BOUND=1,o.LEAST_UPPER_BOUND=2;function e(t,n,r,i,a,l){const s=Math.floor((n-t)/2)+t,c=a(r,i[s],!0);return c===0?s:c>0?n-s>1?e(s,n,r,i,a,l):l==o.LEAST_UPPER_BOUND?n<i.length?n:-1:s:s-t>1?e(t,s,r,i,a,l):l==o.LEAST_UPPER_BOUND?s:t<0?-1:t}o.search=function(n,r,i,a){if(r.length===0)return-1;let l=e(-1,r.length,n,r,i,a||o.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&i(r[l],r[l-1],!0)===0;)--l;return l}})(Ve);var z={exports:{}};const Ht=(function(){return typeof window<"u"&&this===window}).call();if(Ht){let o=null;z.exports=function(){if(typeof o=="string")return fetch(o).then(t=>t.arrayBuffer());if(o instanceof ArrayBuffer)return Promise.resolve(o);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},z.exports.initialize=e=>o=e}else{const o=Te,e=te;z.exports=function(){return new Promise((n,r)=>{const i=e.join(__dirname,"mappings.wasm");o.readFile(i,null,(a,l)=>{if(a){r(a);return}n(l.buffer)})})},z.exports.initialize=t=>{console.debug("SourceMapConsumer.initialize is a no-op when running in node.js")}}var qe=z.exports;const Jt=qe;function Qt(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let k=null;var Yt=function(){if(k)return k;const e=[];return k=Jt().then(t=>WebAssembly.instantiate(t,{env:{mapping_callback(n,r,i,a,l,s,c,f,_,h){const S=new Qt;S.generatedLine=n+1,S.generatedColumn=r,i&&(S.lastGeneratedColumn=a-1),l&&(S.source=s,S.originalLine=c+1,S.originalColumn=f,_&&(S.name=h)),e[e.length-1](S)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}})).then(t=>({exports:t.instance.exports,withMappingCallback:(n,r)=>{e.push(n);try{r()}finally{e.pop()}}})).then(null,t=>{throw k=null,t}),k};const g=ne,le=Ve,X=fe.ArraySet,Kt=qe,Xt=Yt,ge=Symbol("smcInternal");let E=class He{constructor(e,t){return e==ge?Promise.resolve(this):Zt(e,t)}static initialize(e){Kt.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return en(e,t)}static async with(e,t,n){const r=await new He(e,t);try{return await n(r)}finally{r.destroy()}}_parseMappings(e,t){throw new Error("Subclasses must implement _parseMappings")}eachMapping(e,t,n){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};E.prototype._version=3;E.GENERATED_ORDER=1;E.ORIGINAL_ORDER=2;E.GREATEST_LOWER_BOUND=1;E.LEAST_UPPER_BOUND=2;re.SourceMapConsumer=E;class U extends E{constructor(e,t){return super(ge).then(n=>{let r=e;typeof e=="string"&&(r=g.parseSourceMapInput(e));const i=g.getArg(r,"version");let a=g.getArg(r,"sources");const l=g.getArg(r,"names",[]);let s=g.getArg(r,"sourceRoot",null);const c=g.getArg(r,"sourcesContent",null),f=g.getArg(r,"mappings"),_=g.getArg(r,"file",null);if(i!=n._version)throw new Error("Unsupported version: "+i);return s&&(s=g.normalize(s)),a=a.map(String).map(g.normalize).map(function(h){return s&&g.isAbsolute(s)&&g.isAbsolute(h)?g.relative(s,h):h}),n._names=X.fromArray(l.map(String),!0),n._sources=X.fromArray(a,!0),n._absoluteSources=n._sources.toArray().map(function(h){return g.computeSourceURL(s,h,t)}),n.sourceRoot=s,n.sourcesContent=c,n._mappings=f,n._sourceMapURL=t,n.file=_,n._computedColumnSpans=!1,n._mappingsPtr=0,n._wasm=null,Xt().then(h=>(n._wasm=h,n))})}_findSourceIndex(e){let t=e;if(this.sourceRoot!=null&&(t=g.relative(this.sourceRoot,t)),this._sources.has(t))return this._sources.indexOf(t);for(let n=0;n<this._absoluteSources.length;++n)if(this._absoluteSources[n]==e)return n;return-1}static fromSourceMap(e,t){return new U(e.toString())}get sources(){return this._absoluteSources.slice()}_getMappingsPtr(){return this._mappingsPtr===0&&this._parseMappings(this._mappings,this.sourceRoot),this._mappingsPtr}_parseMappings(e,t){const n=e.length,r=this._wasm.exports.allocate_mappings(n),i=new Uint8Array(this._wasm.exports.memory.buffer,r,n);for(let l=0;l<n;l++)i[l]=e.charCodeAt(l);const a=this._wasm.exports.parse_mappings(r);if(!a){const l=this._wasm.exports.get_last_error();let s=`Error parsing mappings (code ${l}): `;switch(l){case 1:s+="the mappings contained a negative line, column, source index, or name index";break;case 2:s+="the mappings contained a number larger than 2**32";break;case 3:s+="reached EOF while in the middle of parsing a VLQ";break;case 4:s+="invalid base 64 character while parsing a VLQ";break;default:s+="unknown error code";break}throw new Error(s)}this._mappingsPtr=a}eachMapping(e,t,n){const r=t||null,i=n||E.GENERATED_ORDER,a=this.sourceRoot;this._wasm.withMappingCallback(l=>{l.source!==null&&(l.source=this._sources.at(l.source),l.source=g.computeSourceURL(a,l.source,this._sourceMapURL),l.name!==null&&(l.name=this._names.at(l.name))),e.call(r,l)},()=>{switch(i){case E.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case E.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}})}allGeneratedPositionsFor(e){let t=g.getArg(e,"source");const n=g.getArg(e,"line"),r=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(n<1)throw new Error("Line numbers must be >= 1");if(r<0)throw new Error("Column numbers must be >= 0");const i=[];return this._wasm.withMappingCallback(a=>{let l=a.lastGeneratedColumn;this._computedColumnSpans&&l===null&&(l=1/0),i.push({line:a.generatedLine,column:a.generatedColumn,lastColumn:l})},()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,n-1,"column"in e,r)}),i}destroy(){this._mappingsPtr!==0&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:g.getArg(e,"line"),generatedColumn:g.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let n=g.getArg(e,"bias",E.GREATEST_LOWER_BOUND);n==null&&(n=E.GREATEST_LOWER_BOUND);let r;if(this._wasm.withMappingCallback(i=>r=i,()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,n)}),r&&r.generatedLine===t.generatedLine){let i=g.getArg(r,"source",null);i!==null&&(i=this._sources.at(i),i=g.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));let a=g.getArg(r,"name",null);return a!==null&&(a=this._names.at(a)),{source:i,line:g.getArg(r,"originalLine",null),column:g.getArg(r,"originalColumn",null),name:a}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1}sourceContentFor(e,t){if(!this.sourcesContent)return null;const n=this._findSourceIndex(e);if(n>=0)return this.sourcesContent[n];let r=e;this.sourceRoot!=null&&(r=g.relative(this.sourceRoot,r));let i;if(this.sourceRoot!=null&&(i=g.urlParse(this.sourceRoot))){const a=r.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!i.path||i.path=="/")&&this._sources.has("/"+r))return this.sourcesContent[this._sources.indexOf("/"+r)]}if(t)return null;throw new Error('"'+r+'" is not in the SourceMap.')}generatedPositionFor(e){let t=g.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const n={source:t,originalLine:g.getArg(e,"line"),originalColumn:g.getArg(e,"column")};if(n.originalLine<1)throw new Error("Line numbers must be >= 1");if(n.originalColumn<0)throw new Error("Column numbers must be >= 0");let r=g.getArg(e,"bias",E.GREATEST_LOWER_BOUND);r==null&&(r=E.GREATEST_LOWER_BOUND);let i;if(this._wasm.withMappingCallback(a=>i=a,()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),n.source,n.originalLine-1,n.originalColumn,r)}),i&&i.source===n.source){let a=i.lastGeneratedColumn;return this._computedColumnSpans&&a===null&&(a=1/0),{line:g.getArg(i,"generatedLine",null),column:g.getArg(i,"generatedColumn",null),lastColumn:a}}return{line:null,column:null,lastColumn:null}}}U.prototype.consumer=E;re.BasicSourceMapConsumer=U;class Je extends E{constructor(e,t){return super(ge).then(n=>{let r=e;typeof e=="string"&&(r=g.parseSourceMapInput(e));const i=g.getArg(r,"version"),a=g.getArg(r,"sections");if(i!=n._version)throw new Error("Unsupported version: "+i);n._sources=new X,n._names=new X,n.__generatedMappings=null,n.__originalMappings=null,n.__generatedMappingsUnsorted=null,n.__originalMappingsUnsorted=null;let l={line:-1,column:0};return Promise.all(a.map(s=>{if(s.url)throw new Error("Support for url field in sections not implemented.");const c=g.getArg(s,"offset"),f=g.getArg(c,"line"),_=g.getArg(c,"column");if(f<l.line||f===l.line&&_<l.column)throw new Error("Section offsets must be ordered and non-overlapping.");return l=c,new E(g.getArg(s,"map"),t).then(S=>({generatedOffset:{generatedLine:f+1,generatedColumn:_+1},consumer:S}))})).then(s=>(n._sections=s,n))})}get _generatedMappings(){return this.__generatedMappings||this._sortGeneratedMappings(),this.__generatedMappings}get _originalMappings(){return this.__originalMappings||this._sortOriginalMappings(),this.__originalMappings}get _generatedMappingsUnsorted(){return this.__generatedMappingsUnsorted||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappingsUnsorted}get _originalMappingsUnsorted(){return this.__originalMappingsUnsorted||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappingsUnsorted}_sortGeneratedMappings(){const e=this._generatedMappingsUnsorted;e.sort(g.compareByGeneratedPositionsDeflated),this.__generatedMappings=e}_sortOriginalMappings(){const e=this._originalMappingsUnsorted;e.sort(g.compareByOriginalPositions),this.__originalMappings=e}get sources(){const e=[];for(let t=0;t<this._sections.length;t++)for(let n=0;n<this._sections[t].consumer.sources.length;n++)e.push(this._sections[t].consumer.sources[n]);return e}originalPositionFor(e){const t={generatedLine:g.getArg(e,"line"),generatedColumn:g.getArg(e,"column")},n=le.search(t,this._sections,function(i,a){const l=i.generatedLine-a.generatedOffset.generatedLine;return l||i.generatedColumn-a.generatedOffset.generatedColumn}),r=this._sections[n];return r?r.consumer.originalPositionFor({line:t.generatedLine-(r.generatedOffset.generatedLine-1),column:t.generatedColumn-(r.generatedOffset.generatedLine===t.generatedLine?r.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})}sourceContentFor(e,t){for(let n=0;n<this._sections.length;n++){const i=this._sections[n].consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){for(let t=0;t<this._sections.length;t++){const n=this._sections[t];if(n.consumer._findSourceIndex(g.getArg(e,"source"))===-1)continue;const r=n.consumer.generatedPositionFor(e);if(r)return{line:r.line+(n.generatedOffset.generatedLine-1),column:r.column+(n.generatedOffset.generatedLine===r.line?n.generatedOffset.generatedColumn-1:0)}}return{line:null,column:null}}_parseMappings(e,t){const n=this.__generatedMappingsUnsorted=[],r=this.__originalMappingsUnsorted=[];for(let i=0;i<this._sections.length;i++){const a=this._sections[i],l=[];a.consumer.eachMapping(s=>l.push(s));for(let s=0;s<l.length;s++){const c=l[s];let f=g.computeSourceURL(a.consumer.sourceRoot,null,this._sourceMapURL);this._sources.add(f),f=this._sources.indexOf(f);let _=null;c.name&&(this._names.add(c.name),_=this._names.indexOf(c.name));const h={source:f,generatedLine:c.generatedLine+(a.generatedOffset.generatedLine-1),generatedColumn:c.generatedColumn+(a.generatedOffset.generatedLine===c.generatedLine?a.generatedOffset.generatedColumn-1:0),originalLine:c.originalLine,originalColumn:c.originalColumn,name:_};n.push(h),typeof h.originalLine=="number"&&r.push(h)}}}eachMapping(e,t,n){const r=t||null,i=n||E.GENERATED_ORDER;let a;switch(i){case E.GENERATED_ORDER:a=this._generatedMappings;break;case E.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}const l=this.sourceRoot;a.map(function(s){let c=null;return s.source!==null&&(c=this._sources.at(s.source),c=g.computeSourceURL(l,c,this._sourceMapURL)),{source:c,generatedLine:s.generatedLine,generatedColumn:s.generatedColumn,originalLine:s.originalLine,originalColumn:s.originalColumn,name:s.name===null?null:this._names.at(s.name)}},this).forEach(e,r)}_findMapping(e,t,n,r,i,a){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return le.search(e,t,i,a)}allGeneratedPositionsFor(e){const t=g.getArg(e,"line"),n={source:g.getArg(e,"source"),originalLine:t,originalColumn:g.getArg(e,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];if(n.originalLine<1)throw new Error("Line numbers must be >= 1");if(n.originalColumn<0)throw new Error("Column numbers must be >= 0");const r=[];let i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",g.compareByOriginalPositions,le.LEAST_UPPER_BOUND);if(i>=0){let a=this._originalMappings[i];if(e.column===void 0){const l=a.originalLine;for(;a&&a.originalLine===l;){let s=a.lastGeneratedColumn;this._computedColumnSpans&&s===null&&(s=1/0),r.push({line:g.getArg(a,"generatedLine",null),column:g.getArg(a,"generatedColumn",null),lastColumn:s}),a=this._originalMappings[++i]}}else{const l=a.originalColumn;for(;a&&a.originalLine===t&&a.originalColumn==l;){let s=a.lastGeneratedColumn;this._computedColumnSpans&&s===null&&(s=1/0),r.push({line:g.getArg(a,"generatedLine",null),column:g.getArg(a,"generatedColumn",null),lastColumn:s}),a=this._originalMappings[++i]}}}return r}destroy(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.destroy()}}re.IndexedSourceMapConsumer=Je;function Zt(o,e){let t=o;typeof o=="string"&&(t=g.parseSourceMapInput(o));const n=t.sections!=null?new Je(t,e):new U(t,e);return Promise.resolve(n)}function en(o,e){return U.fromSourceMap(o,e)}var ve=re.SourceMapConsumer,tn=Object.defineProperty,nn=(o,e,t)=>e in o?tn(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,$=(o,e,t)=>nn(o,typeof e!="symbol"?e+"":e,t);const rn=8969,on="spotlight-by-sentry",sn="/contextlines";async function an(o){try{return(await fetch(o)).text()}catch{return}}function ln(o){try{return JSON.parse(o)}catch{return}}async function cn(o,e){const t=await new ve(o),n=t.originalPositionFor({line:e.lineno,column:e.colno,bias:ve.LEAST_UPPER_BOUND});if(n.source&&n.line&&n.column){e.lineno=n.line,e.colno=n.column;const r=new URL(e.filename).pathname.slice(1);e.filename=ie.resolve(ie.join(ie.dirname(r),n.source));const i=t.sourceContentFor(n.source),a=(i==null?void 0:i.split(at.EOL))??[];Qe(a,e)}return n}function Qe(o,e,t=5){const n=o.length,r=Math.max(Math.min(n-1,e.lineno-1),0);e.pre_context=o.slice(Math.max(0,r-t),r).map(i=>ce(i,0)),e.context_line=ce(o[Math.min(n-1,r)],e.colno||0),e.post_context=o.slice(Math.min(r+1,n),r+1+t).map(i=>ce(i,0))}function ce(o,e){let t=o;const n=t.length;if(n<=150)return t;e>n&&(e=n);let r=Math.max(e-60,0);r<5&&(r=0);let i=Math.min(r+140,n);return i>n-5&&(i=n),i===n&&(r=Math.max(i-140,0)),t=t.slice(r,i),r>0&&(t=`'{snip} ${t}`),i<n&&(t+=" {snip}"),t}function un(o){return!!o.filename&&!!o.lineno&&!!o.colno}function pn(o,e){if(o.method!=="PUT"){e.writeHead(405),e.end();return}let t="";o.on("data",n=>{t+=n}),o.on("end",async()=>{const n=ln(t);if(!n){e.writeHead(500),e.end();return}for(const i of n.frames??[]){if(!un(i)||i.filename.includes("/node_modules/"))continue;const{filename:a}=i;if(a.includes("://")){const l=await an(i.filename);if(!l)continue;const s=l.match(/\/\/# sourceMappingURL=data:application\/json;base64,(.*)/);if(s&&s[1]){const c=s[1],f=Buffer.from(c,"base64").toString("utf-8");await cn(f,i)}}else if(!a.includes(":"))try{const l=V.readFileSync(a,{encoding:"utf-8"}).split(/\r?\n/);Qe(l,i)}catch(l){if(l.code!=="ENOENT")throw l}}const r=JSON.stringify(n);e.writeHead(200,{"Content-Type":"application/json"}),e.end(r)})}const Y={info:o=>console.log("🔎 [Spotlight]",o),warn:o=>console.warn("🔎 [Spotlight]",o),error:o=>console.error("🔎 [Spotlight]",o),debug:o=>Ye&&console.debug("🔎 [Spotlight]",o)};let W,Ye=!1;function dn(o){W=o}function fn(o){Ye=o}const M={info:o=>(W||Y).info(o),warn:o=>(W||Y).warn(o),error:o=>(W||Y).error(o),debug:o=>(W||Y).debug(o)};class hn{constructor(e=100){$(this,"size"),$(this,"items"),$(this,"writePos",0),$(this,"head",0),$(this,"timeout",10),$(this,"readers",new Map),this.size=e,this.items=new Array(e)}put(e){const t=new Date().getTime();this.items[this.writePos%this.size]=[t,e],this.writePos+=1,this.head===this.writePos&&(this.head+=1);const n=t-this.timeout*1e3;let r;for(;this.head<this.writePos&&(r=this.items[this.head%this.size],!(r===void 0||r[0]>n));)this.head+=1}subscribe(e){const t=gn();return this.readers.set(t,e),setTimeout(()=>this.stream(t)),t}unsubscribe(e){this.readers.delete(e)}stream(e,t=this.head){const n=this.readers.get(e);if(!n)return;let r=t,i;for(;i=this.items[r%this.size],!(typeof i>"u"||r>=this.writePos);)n(i[1]),r+=1;setTimeout(()=>this.stream(e,r),500)}clear(){this.items=new Array(this.size),this.writePos=0,this.head=0,this.readers=new Map}}function gn(){let o=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16;return t=(o+t)%16|0,o=Math.floor(o/16),(e==="x"?t:t&3|8).toString(16)})}function Ke(){return{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"*","Access-Control-Allow-Methods":"GET,POST,PUT,OPTIONS,DELETE,PATCH"}}function F(o){return function(t,n,r,i){const a={...Ke(),...Xe()};for(const[l,s]of Object.entries(a))n.setHeader(l,s);if(t.method==="OPTIONS"){n.writeHead(204,{"Cache-Control":"no-cache"}),n.end();return}return o(t,n,r,i)}}function Xe(){return{"X-Powered-by":on}}function mn(o,e){return function(n,r,i,a){if(n.method==="GET"&&n.headers.accept&&n.headers.accept==="text/event-stream"&&i==="/stream"){r.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),r.flushHeaders(),r.write(`
5
- `);const l=o.subscribe(([s,c])=>{M.debug("🕊️ sending to Spotlight"),r.write(`event:${s}
6
- `);for(const f of c.split(`
7
- `))r.write(`data:${f}
2
+ "use strict";const Pe=require("fs"),ot=require("os"),te=require("path"),Ie=require("child_process"),q=require("node:fs"),$e=require("node:http"),I=require("node:path"),ue=require("node:zlib"),it=require("node:os"),st=require("node:url"),at=require("node:module");var U=typeof document<"u"?document.currentScript:null;function De(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const ie=De(I),lt=De(it);function ct(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var pe={exports:{}},C=String,Ue=function(){return{isColorSupported:!1,reset:C,bold:C,dim:C,italic:C,underline:C,inverse:C,hidden:C,strikethrough:C,black:C,red:C,green:C,yellow:C,blue:C,magenta:C,cyan:C,white:C,gray:C,bgBlack:C,bgRed:C,bgGreen:C,bgYellow:C,bgBlue:C,bgMagenta:C,bgCyan:C,bgWhite:C,blackBright:C,redBright:C,greenBright:C,yellowBright:C,blueBright:C,magentaBright:C,cyanBright:C,whiteBright:C,bgBlackBright:C,bgRedBright:C,bgGreenBright:C,bgYellowBright:C,bgBlueBright:C,bgMagentaBright:C,bgCyanBright:C,bgWhiteBright:C}};pe.exports=Ue();pe.exports.createColors=Ue;var ut=pe.exports,fe={},pt=function(e){return e.map(function(t){return t&&typeof t=="object"?t.op.replace(/(.)/g,"\\$1"):/["\s]/.test(t)&&!/'/.test(t)?"'"+t.replace(/(['\\])/g,"\\$1")+"'":/["'\s]/.test(t)?'"'+t.replace(/(["\\$`!])/g,"\\$1")+'"':String(t).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")},Be="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",Ce=new RegExp("^"+Be+"$"),we="|&;()<> \\t",ft='"((\\\\"|[^"])*?)"',dt="'((\\\\'|[^'])*?)'",ht=/^#$/,Se="'",be='"',se="$",P="",gt=4294967296;for(var ye=0;ye<4;ye++)P+=(gt*Math.random()).toString(16);var mt=new RegExp("^"+P);function _t(o,e){for(var t=e.lastIndex,n=[],r;r=e.exec(o);)n.push(r),e.lastIndex===r.index&&(e.lastIndex+=1);return e.lastIndex=t,n}function Ct(o,e,t){var n=typeof o=="function"?o(t):o[t];return typeof n>"u"&&t!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+P+JSON.stringify(n)+P:e+n}function wt(o,e,t){t||(t={});var n=t.escape||"\\",r="(\\"+n+`['"`+we+`]|[^\\s'"`+we+"])+",i=new RegExp(["("+Be+")","("+r+"|"+ft+"|"+dt+")+"].join("|"),"g"),a=_t(o,i);if(a.length===0)return[];e||(e={});var l=!1;return a.map(function(s){var c=s[0];if(!c||l)return;if(Ce.test(c))return{op:c};var d=!1,_=!1,h="",S=!1,w;function L(){w+=1;var E,R,N=c.charAt(w);if(N==="{"){if(w+=1,c.charAt(w)==="}")throw new Error("Bad substitution: "+c.slice(w-2,w+1));if(E=c.indexOf("}",w),E<0)throw new Error("Bad substitution: "+c.slice(w));R=c.slice(w,E),w=E}else if(/[*@#?$!_-]/.test(N))R=N,w+=1;else{var j=c.slice(w);E=j.match(/[^\w\d_]/),E?(R=j.slice(0,E.index),w+=E.index-1):(R=j,w=c.length)}return Ct(e,"",R)}for(w=0;w<c.length;w++){var b=c.charAt(w);if(S=S||!d&&(b==="*"||b==="?"),_)h+=b,_=!1;else if(d)b===d?d=!1:d==Se?h+=b:b===n?(w+=1,b=c.charAt(w),b===be||b===n||b===se?h+=b:h+=n+b):b===se?h+=L():h+=b;else if(b===be||b===Se)d=b;else{if(Ce.test(b))return{op:c};if(ht.test(b)){l=!0;var H={comment:o.slice(s.index+w+1)};return h.length?[h,H]:[H]}else b===n?_=!0:b===se?h+=L():h+=b}}return S?{op:"glob",pattern:h}:h}).reduce(function(s,c){return typeof c>"u"?s:s.concat(c)},[])}var St=function(e,t,n){var r=wt(e,t,n);return typeof t!="function"?r:r.reduce(function(i,a){if(typeof a=="object")return i.concat(a);var l=a.split(RegExp("("+P+".*?"+P+")","g"));return l.length===1?i.concat(l[0]):i.concat(l.filter(Boolean).map(function(s){return mt.test(s)?JSON.parse(s.split(P)[1]):s}))},[])};fe.quote=pt;fe.parse=St;var bt={"/Applications/Atom.app/Contents/MacOS/Atom":"atom","/Applications/Atom Beta.app/Contents/MacOS/Atom Beta":"/Applications/Atom Beta.app/Contents/MacOS/Atom Beta","/Applications/Brackets.app/Contents/MacOS/Brackets":"brackets","/Applications/Sublime Text.app/Contents/MacOS/Sublime Text":"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text.app/Contents/MacOS/sublime_text":"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2":"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl","/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text":"/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl","/Applications/Visual Studio Code.app/Contents/MacOS/Electron":"code","/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron":"code-insiders","/Applications/VSCodium.app/Contents/MacOS/Electron":"codium","/Applications/Cursor.app/Contents/MacOS/Cursor":"cursor","/Applications/AppCode.app/Contents/MacOS/appcode":"/Applications/AppCode.app/Contents/MacOS/appcode","/Applications/CLion.app/Contents/MacOS/clion":"/Applications/CLion.app/Contents/MacOS/clion","/Applications/IntelliJ IDEA.app/Contents/MacOS/idea":"/Applications/IntelliJ IDEA.app/Contents/MacOS/idea","/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea":"/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea","/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea":"/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea","/Applications/PhpStorm.app/Contents/MacOS/phpstorm":"/Applications/PhpStorm.app/Contents/MacOS/phpstorm","/Applications/PyCharm.app/Contents/MacOS/pycharm":"/Applications/PyCharm.app/Contents/MacOS/pycharm","/Applications/PyCharm CE.app/Contents/MacOS/pycharm":"/Applications/PyCharm CE.app/Contents/MacOS/pycharm","/Applications/RubyMine.app/Contents/MacOS/rubymine":"/Applications/RubyMine.app/Contents/MacOS/rubymine","/Applications/WebStorm.app/Contents/MacOS/webstorm":"/Applications/WebStorm.app/Contents/MacOS/webstorm","/Applications/MacVim.app/Contents/MacOS/MacVim":"mvim","/Applications/GoLand.app/Contents/MacOS/goland":"/Applications/GoLand.app/Contents/MacOS/goland","/Applications/Rider.app/Contents/MacOS/rider":"/Applications/Rider.app/Contents/MacOS/rider","/Applications/Zed.app/Contents/MacOS/zed":"zed"},yt={atom:"atom",Brackets:"brackets","code-insiders":"code-insiders",code:"code",vscodium:"vscodium",codium:"codium",emacs:"emacs",gvim:"gvim",idea:"idea","idea.sh":"idea",phpstorm:"phpstorm","phpstorm.sh":"phpstorm",pycharm:"pycharm","pycharm.sh":"pycharm",rubymine:"rubymine","rubymine.sh":"rubymine",sublime_text:"subl",vim:"vim",webstorm:"webstorm","webstorm.sh":"webstorm",goland:"goland","goland.sh":"goland",rider:"rider","rider.sh":"rider"},At=["Brackets.exe","Code.exe","Code - Insiders.exe","VSCodium.exe","atom.exe","sublime_text.exe","notepad++.exe","clion.exe","clion64.exe","idea.exe","idea64.exe","phpstorm.exe","phpstorm64.exe","pycharm.exe","pycharm64.exe","rubymine.exe","rubymine64.exe","webstorm.exe","webstorm64.exe","goland.exe","goland64.exe","rider.exe","rider64.exe"];const Et=te,xt=fe,ae=Ie,Q=bt,Ae=yt,Ot=At;var Mt=function(e){if(e)return xt.parse(e);if(process.env.LAUNCH_EDITOR)return[process.env.LAUNCH_EDITOR];if(process.versions.webcontainer)return[process.env.EDITOR||"code"];try{if(process.platform==="darwin"){const t=ae.execSync("ps x -o comm=",{stdio:["pipe","pipe","ignore"]}).toString(),n=Object.keys(Q),r=t.split(`
3
+ `);for(let i=0;i<n.length;i++){const a=n[i];if(r.includes(a))return[Q[a]];const l=a.replace("/Applications","");if(t.indexOf(l)!==-1){if(a!==Q[a])return[Q[a]];const s=r.find(c=>c.endsWith(l));if(s!==void 0)return[s]}}}else if(process.platform==="win32"){const n=ae.execSync('powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"',{stdio:["pipe","pipe","ignore"]}).toString().split(`\r
4
+ `);for(let r=0;r<n.length;r++){const i=n[r].trim(),a=Et.basename(i);if(Ot.indexOf(a)!==-1)return[i]}}else if(process.platform==="linux"){const t=ae.execSync("ps x --no-heading -o comm --sort=comm",{stdio:["pipe","pipe","ignore"]}).toString(),n=Object.keys(Ae);for(let r=0;r<n.length;r++){const i=n[r];if(t.indexOf(i)!==-1)return[Ae[i]]}}}catch{}return process.env.VISUAL?[process.env.VISUAL]:process.env.EDITOR?[process.env.EDITOR]:[null]};const vt=te;var Lt=function(e,t,n,r=1){switch(vt.basename(e).replace(/\.(exe|cmd|bat)$/i,"")){case"atom":case"Atom":case"Atom Beta":case"subl":case"sublime":case"sublime_text":case"wstorm":case"charm":case"zed":return[`${t}:${n}:${r}`];case"notepad++":return["-n"+n,"-c"+r,t];case"vim":case"mvim":return[`+call cursor(${n}, ${r})`,t];case"joe":case"gvim":return[`+${n}`,t];case"emacs":case"emacsclient":return[`+${n}:${r}`,t];case"rmate":case"mate":case"mine":return["--line",n,t];case"code":case"Code":case"code-insiders":case"Code - Insiders":case"codium":case"cursor":case"vscodium":case"VSCodium":return["-r","-g",`${t}:${n}:${r}`];case"appcode":case"clion":case"clion64":case"idea":case"idea64":case"phpstorm":case"phpstorm64":case"pycharm":case"pycharm64":case"rubymine":case"rubymine64":case"webstorm":case"webstorm64":case"goland":case"goland64":case"rider":case"rider64":return["--line",n,"--column",r,t]}return process.env.LAUNCH_EDITOR?[t,n,r]:[t]};const Rt=Pe,Tt=ot,Ne=te,Ee=ut,xe=Ie,Pt=Mt,It=Lt;function $t(o){return(e,t)=>{console.log(),console.log(Ee.red("Could not open "+Ne.basename(e)+" in the editor.")),t&&(t[t.length-1]!=="."&&(t+="."),console.log(Ee.red("The editor process exited with an error: "+t))),console.log(),o&&o(e,t)}}function Dt(o){switch(o){case"vim":case"emacs":case"nano":return!0}return!1}const Oe=/:(\d+)(:(\d+))?$/;function Ut(o){const e=o.replace(Oe,""),t=o.match(Oe),n=t&&t[1],r=t&&t[3];return{fileName:e,lineNumber:n,columnNumber:r}}let T=null;function Bt(o,e,t){const n=Ut(o);let{fileName:r}=n;const{lineNumber:i,columnNumber:a}=n;if(!Rt.existsSync(r))return;typeof e=="function"&&(t=e,e=void 0),t=$t(t);const[l,...s]=Pt(e);if(!l){t(r,null);return}if(process.platform==="linux"&&r.startsWith("/mnt/")&&/Microsoft/i.test(Tt.release())&&(r=Ne.relative("",r)),i){const c=It(l,r,i,a);s.push.apply(s,c)}else s.push(r);if(T&&Dt(l)&&T.kill("SIGKILL"),process.platform==="win32"){let c=function(h){return h.replace(/([&|<>,;=^])/g,"^$1")},d=function(h){return h.includes("^")?`^"${h}^"`:h.includes(" ")?`"${h}"`:h};const _=[l,...s.map(c)].map(d).join(" ");T=xe.exec(_,{stdio:"inherit",shell:!0})}else T=xe.spawn(l,s,{stdio:"inherit"});T.on("exit",function(c){T=null,c&&t(r,"(code "+c+")")}),T.on("error",function(c){let{code:d,message:_}=c;d==="ENOENT"&&(_=`${_} ('${l}' command does not exist in 'PATH')`),t(r,_)})}var Nt=Bt;const jt=ct(Nt);var je={},Ge={};const Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Ge.encode=function(o){if(0<=o&&o<Me.length)return Me[o];throw new TypeError("Must be between 0 and 63: "+o)};const Gt=Ge,ke=5,Fe=1<<ke,kt=Fe-1,Ft=Fe;function zt(o){return o<0?(-o<<1)+1:(o<<1)+0}je.encode=function(e){let t="",n,r=zt(e);do n=r&kt,r>>>=ke,r>0&&(n|=Ft),t+=Gt.encode(n);while(r>0);return t};var ne={};(function(o){function e(u,p,m){if(p in u)return u[p];if(arguments.length===3)return m;throw new Error('"'+p+'" is a required argument.')}o.getArg=e;const t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function r(u){const p=u.match(t);return p?{scheme:p[1],auth:p[2],host:p[3],port:p[4],path:p[5]}:null}o.urlParse=r;function i(u){let p="";return u.scheme&&(p+=u.scheme+":"),p+="//",u.auth&&(p+=u.auth+"@"),u.host&&(p+=u.host),u.port&&(p+=":"+u.port),u.path&&(p+=u.path),p}o.urlGenerate=i;const a=32;function l(u){const p=[];return function(m){for(let M=0;M<p.length;M++)if(p[M].input===m){const v=p[0];return p[0]=p[M],p[M]=v,p[0].result}const f=u(m);return p.unshift({input:m,result:f}),p.length>a&&p.pop(),f}}const s=l(function(p){let m=p;const f=r(p);if(f){if(!f.path)return p;m=f.path}const M=o.isAbsolute(m),v=[];let J=0,x=0;for(;;)if(J=x,x=m.indexOf("/",J),x===-1){v.push(m.slice(J));break}else for(v.push(m.slice(J,x));x<m.length&&m[x]==="/";)x++;let G=0;for(x=v.length-1;x>=0;x--){const oe=v[x];oe==="."?v.splice(x,1):oe===".."?G++:G>0&&(oe===""?(v.splice(x+1,G),G=0):(v.splice(x,2),G--))}return m=v.join("/"),m===""&&(m=M?"/":"."),f?(f.path=m,i(f)):m});o.normalize=s;function c(u,p){u===""&&(u="."),p===""&&(p=".");const m=r(p),f=r(u);if(f&&(u=f.path||"/"),m&&!m.scheme)return f&&(m.scheme=f.scheme),i(m);if(m||p.match(n))return p;if(f&&!f.host&&!f.path)return f.host=p,i(f);const M=p.charAt(0)==="/"?p:s(u.replace(/\/+$/,"")+"/"+p);return f?(f.path=M,i(f)):M}o.join=c,o.isAbsolute=function(u){return u.charAt(0)==="/"||t.test(u)};function d(u,p){u===""&&(u="."),u=u.replace(/\/$/,"");let m=0;for(;p.indexOf(u+"/")!==0;){const f=u.lastIndexOf("/");if(f<0||(u=u.slice(0,f),u.match(/^([^\/]+:\/)?\/*$/)))return p;++m}return Array(m+1).join("../")+p.substr(u.length+1)}o.relative=d;const _=function(){return!("__proto__"in Object.create(null))}();function h(u){return u}function S(u){return L(u)?"$"+u:u}o.toSetString=_?h:S;function w(u){return L(u)?u.slice(1):u}o.fromSetString=_?h:w;function L(u){if(!u)return!1;const p=u.length;if(p<9||u.charCodeAt(p-1)!==95||u.charCodeAt(p-2)!==95||u.charCodeAt(p-3)!==111||u.charCodeAt(p-4)!==116||u.charCodeAt(p-5)!==111||u.charCodeAt(p-6)!==114||u.charCodeAt(p-7)!==112||u.charCodeAt(p-8)!==95||u.charCodeAt(p-9)!==95)return!1;for(let m=p-10;m>=0;m--)if(u.charCodeAt(m)!==36)return!1;return!0}function b(u,p,m){let f=E(u.source,p.source);return f!==0||(f=u.originalLine-p.originalLine,f!==0)||(f=u.originalColumn-p.originalColumn,f!==0||m)||(f=u.generatedColumn-p.generatedColumn,f!==0)||(f=u.generatedLine-p.generatedLine,f!==0)?f:E(u.name,p.name)}o.compareByOriginalPositions=b;function H(u,p,m){let f=u.generatedLine-p.generatedLine;return f!==0||(f=u.generatedColumn-p.generatedColumn,f!==0||m)||(f=E(u.source,p.source),f!==0)||(f=u.originalLine-p.originalLine,f!==0)||(f=u.originalColumn-p.originalColumn,f!==0)?f:E(u.name,p.name)}o.compareByGeneratedPositionsDeflated=H;function E(u,p){return u===p?0:u===null?1:p===null?-1:u>p?1:-1}function R(u,p){let m=u.generatedLine-p.generatedLine;return m!==0||(m=u.generatedColumn-p.generatedColumn,m!==0)||(m=E(u.source,p.source),m!==0)||(m=u.originalLine-p.originalLine,m!==0)||(m=u.originalColumn-p.originalColumn,m!==0)?m:E(u.name,p.name)}o.compareByGeneratedPositionsInflated=R;function N(u){return JSON.parse(u.replace(/^\)]}'[^\n]*\n/,""))}o.parseSourceMapInput=N;function j(u,p,m){if(p=p||"",u&&(u[u.length-1]!=="/"&&p[0]!=="/"&&(u+="/"),p=u+p),m){const f=r(m);if(!f)throw new Error("sourceMapURL could not be parsed");if(f.path){const M=f.path.lastIndexOf("/");M>=0&&(f.path=f.path.substring(0,M+1))}p=c(i(f),p)}return s(p)}o.computeSourceURL=j})(ne);var de={};let Wt=class ze{constructor(){this._array=[],this._set=new Map}static fromArray(e,t){const n=new ze;for(let r=0,i=e.length;r<i;r++)n.add(e[r],t);return n}size(){return this._set.size}add(e,t){const n=this.has(e),r=this._array.length;(!n||t)&&this._array.push(e),n||this._set.set(e,r)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};de.ArraySet=Wt;var We={};const Ve=ne;function Vt(o,e){const t=o.generatedLine,n=e.generatedLine,r=o.generatedColumn,i=e.generatedColumn;return n>t||n==t&&i>=r||Ve.compareByGeneratedPositionsInflated(o,e)<=0}let qt=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){Vt(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(Ve.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};We.MappingList=qt;const k=je,y=ne,Y=de.ArraySet,Ht=We.MappingList;class he{constructor(e){e||(e={}),this._file=y.getArg(e,"file",null),this._sourceRoot=y.getArg(e,"sourceRoot",null),this._skipValidation=y.getArg(e,"skipValidation",!1),this._sources=new Y,this._names=new Y,this._mappings=new Ht,this._sourcesContents=null}static fromSourceMap(e){const t=e.sourceRoot,n=new he({file:e.file,sourceRoot:t});return e.eachMapping(function(r){const i={generated:{line:r.generatedLine,column:r.generatedColumn}};r.source!=null&&(i.source=r.source,t!=null&&(i.source=y.relative(t,i.source)),i.original={line:r.originalLine,column:r.originalColumn},r.name!=null&&(i.name=r.name)),n.addMapping(i)}),e.sources.forEach(function(r){let i=r;t!==null&&(i=y.relative(t,r)),n._sources.has(i)||n._sources.add(i);const a=e.sourceContentFor(r);a!=null&&n.setSourceContent(r,a)}),n}addMapping(e){const t=y.getArg(e,"generated"),n=y.getArg(e,"original",null);let r=y.getArg(e,"source",null),i=y.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,r,i),r!=null&&(r=String(r),this._sources.has(r)||this._sources.add(r)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:r,name:i})}setSourceContent(e,t){let n=e;this._sourceRoot!=null&&(n=y.relative(this._sourceRoot,n)),t!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[y.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[y.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(e,t,n){let r=t;if(t==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);r=e.file}const i=this._sourceRoot;i!=null&&(r=y.relative(i,r));const a=this._mappings.toArray().length>0?new Y:this._sources,l=new Y;this._mappings.unsortedForEach(function(s){if(s.source===r&&s.originalLine!=null){const _=e.originalPositionFor({line:s.originalLine,column:s.originalColumn});_.source!=null&&(s.source=_.source,n!=null&&(s.source=y.join(n,s.source)),i!=null&&(s.source=y.relative(i,s.source)),s.originalLine=_.line,s.originalColumn=_.column,_.name!=null&&(s.name=_.name))}const c=s.source;c!=null&&!a.has(c)&&a.add(c);const d=s.name;d!=null&&!l.has(d)&&l.add(d)},this),this._sources=a,this._names=l,e.sources.forEach(function(s){const c=e.sourceContentFor(s);c!=null&&(n!=null&&(s=y.join(n,s)),i!=null&&(s=y.relative(i,s)),this.setSourceContent(s,c))},this)}_validateMapping(e,t,n,r){if(t&&typeof t.line!="number"&&typeof t.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!n&&!r)){if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))}}_serializeMappings(){let e=0,t=1,n=0,r=0,i=0,a=0,l="",s,c,d,_;const h=this._mappings.toArray();for(let S=0,w=h.length;S<w;S++){if(c=h[S],s="",c.generatedLine!==t)for(e=0;c.generatedLine!==t;)s+=";",t++;else if(S>0){if(!y.compareByGeneratedPositionsInflated(c,h[S-1]))continue;s+=","}s+=k.encode(c.generatedColumn-e),e=c.generatedColumn,c.source!=null&&(_=this._sources.indexOf(c.source),s+=k.encode(_-a),a=_,s+=k.encode(c.originalLine-1-r),r=c.originalLine-1,s+=k.encode(c.originalColumn-n),n=c.originalColumn,c.name!=null&&(d=this._names.indexOf(c.name),s+=k.encode(d-i),i=d)),l+=s}return l}_generateSourcesContent(e,t){return e.map(function(n){if(!this._sourcesContents)return null;t!=null&&(n=y.relative(t,n));const r=y.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}}he.prototype._version=3;var re={},qe={};(function(o){o.GREATEST_LOWER_BOUND=1,o.LEAST_UPPER_BOUND=2;function e(t,n,r,i,a,l){const s=Math.floor((n-t)/2)+t,c=a(r,i[s],!0);return c===0?s:c>0?n-s>1?e(s,n,r,i,a,l):l==o.LEAST_UPPER_BOUND?n<i.length?n:-1:s:s-t>1?e(t,s,r,i,a,l):l==o.LEAST_UPPER_BOUND?s:t<0?-1:t}o.search=function(n,r,i,a){if(r.length===0)return-1;let l=e(-1,r.length,n,r,i,a||o.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&i(r[l],r[l-1],!0)===0;)--l;return l}})(qe);var W={exports:{}};const Jt=(function(){return typeof window<"u"&&this===window}).call();if(Jt){let o=null;W.exports=function(){if(typeof o=="string")return fetch(o).then(t=>t.arrayBuffer());if(o instanceof ArrayBuffer)return Promise.resolve(o);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},W.exports.initialize=e=>o=e}else{const o=Pe,e=te;W.exports=function(){return new Promise((n,r)=>{const i=e.join(__dirname,"mappings.wasm");o.readFile(i,null,(a,l)=>{if(a){r(a);return}n(l.buffer)})})},W.exports.initialize=t=>{console.debug("SourceMapConsumer.initialize is a no-op when running in node.js")}}var He=W.exports;const Qt=He;function Yt(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let F=null;var Kt=function(){if(F)return F;const e=[];return F=Qt().then(t=>WebAssembly.instantiate(t,{env:{mapping_callback(n,r,i,a,l,s,c,d,_,h){const S=new Yt;S.generatedLine=n+1,S.generatedColumn=r,i&&(S.lastGeneratedColumn=a-1),l&&(S.source=s,S.originalLine=c+1,S.originalColumn=d,_&&(S.name=h)),e[e.length-1](S)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}})).then(t=>({exports:t.instance.exports,withMappingCallback:(n,r)=>{e.push(n);try{r()}finally{e.pop()}}})).then(null,t=>{throw F=null,t}),F};const g=ne,le=qe,Z=de.ArraySet,Xt=He,Zt=Kt,ge=Symbol("smcInternal");let A=class Je{constructor(e,t){return e==ge?Promise.resolve(this):en(e,t)}static initialize(e){Xt.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return tn(e,t)}static async with(e,t,n){const r=await new Je(e,t);try{return await n(r)}finally{r.destroy()}}_parseMappings(e,t){throw new Error("Subclasses must implement _parseMappings")}eachMapping(e,t,n){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};A.prototype._version=3;A.GENERATED_ORDER=1;A.ORIGINAL_ORDER=2;A.GREATEST_LOWER_BOUND=1;A.LEAST_UPPER_BOUND=2;re.SourceMapConsumer=A;class B extends A{constructor(e,t){return super(ge).then(n=>{let r=e;typeof e=="string"&&(r=g.parseSourceMapInput(e));const i=g.getArg(r,"version");let a=g.getArg(r,"sources");const l=g.getArg(r,"names",[]);let s=g.getArg(r,"sourceRoot",null);const c=g.getArg(r,"sourcesContent",null),d=g.getArg(r,"mappings"),_=g.getArg(r,"file",null);if(i!=n._version)throw new Error("Unsupported version: "+i);return s&&(s=g.normalize(s)),a=a.map(String).map(g.normalize).map(function(h){return s&&g.isAbsolute(s)&&g.isAbsolute(h)?g.relative(s,h):h}),n._names=Z.fromArray(l.map(String),!0),n._sources=Z.fromArray(a,!0),n._absoluteSources=n._sources.toArray().map(function(h){return g.computeSourceURL(s,h,t)}),n.sourceRoot=s,n.sourcesContent=c,n._mappings=d,n._sourceMapURL=t,n.file=_,n._computedColumnSpans=!1,n._mappingsPtr=0,n._wasm=null,Zt().then(h=>(n._wasm=h,n))})}_findSourceIndex(e){let t=e;if(this.sourceRoot!=null&&(t=g.relative(this.sourceRoot,t)),this._sources.has(t))return this._sources.indexOf(t);for(let n=0;n<this._absoluteSources.length;++n)if(this._absoluteSources[n]==e)return n;return-1}static fromSourceMap(e,t){return new B(e.toString())}get sources(){return this._absoluteSources.slice()}_getMappingsPtr(){return this._mappingsPtr===0&&this._parseMappings(this._mappings,this.sourceRoot),this._mappingsPtr}_parseMappings(e,t){const n=e.length,r=this._wasm.exports.allocate_mappings(n),i=new Uint8Array(this._wasm.exports.memory.buffer,r,n);for(let l=0;l<n;l++)i[l]=e.charCodeAt(l);const a=this._wasm.exports.parse_mappings(r);if(!a){const l=this._wasm.exports.get_last_error();let s=`Error parsing mappings (code ${l}): `;switch(l){case 1:s+="the mappings contained a negative line, column, source index, or name index";break;case 2:s+="the mappings contained a number larger than 2**32";break;case 3:s+="reached EOF while in the middle of parsing a VLQ";break;case 4:s+="invalid base 64 character while parsing a VLQ";break;default:s+="unknown error code";break}throw new Error(s)}this._mappingsPtr=a}eachMapping(e,t,n){const r=t||null,i=n||A.GENERATED_ORDER,a=this.sourceRoot;this._wasm.withMappingCallback(l=>{l.source!==null&&(l.source=this._sources.at(l.source),l.source=g.computeSourceURL(a,l.source,this._sourceMapURL),l.name!==null&&(l.name=this._names.at(l.name))),e.call(r,l)},()=>{switch(i){case A.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case A.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}})}allGeneratedPositionsFor(e){let t=g.getArg(e,"source");const n=g.getArg(e,"line"),r=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(n<1)throw new Error("Line numbers must be >= 1");if(r<0)throw new Error("Column numbers must be >= 0");const i=[];return this._wasm.withMappingCallback(a=>{let l=a.lastGeneratedColumn;this._computedColumnSpans&&l===null&&(l=1/0),i.push({line:a.generatedLine,column:a.generatedColumn,lastColumn:l})},()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,n-1,"column"in e,r)}),i}destroy(){this._mappingsPtr!==0&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:g.getArg(e,"line"),generatedColumn:g.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let n=g.getArg(e,"bias",A.GREATEST_LOWER_BOUND);n==null&&(n=A.GREATEST_LOWER_BOUND);let r;if(this._wasm.withMappingCallback(i=>r=i,()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,n)}),r&&r.generatedLine===t.generatedLine){let i=g.getArg(r,"source",null);i!==null&&(i=this._sources.at(i),i=g.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));let a=g.getArg(r,"name",null);return a!==null&&(a=this._names.at(a)),{source:i,line:g.getArg(r,"originalLine",null),column:g.getArg(r,"originalColumn",null),name:a}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1}sourceContentFor(e,t){if(!this.sourcesContent)return null;const n=this._findSourceIndex(e);if(n>=0)return this.sourcesContent[n];let r=e;this.sourceRoot!=null&&(r=g.relative(this.sourceRoot,r));let i;if(this.sourceRoot!=null&&(i=g.urlParse(this.sourceRoot))){const a=r.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!i.path||i.path=="/")&&this._sources.has("/"+r))return this.sourcesContent[this._sources.indexOf("/"+r)]}if(t)return null;throw new Error('"'+r+'" is not in the SourceMap.')}generatedPositionFor(e){let t=g.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const n={source:t,originalLine:g.getArg(e,"line"),originalColumn:g.getArg(e,"column")};if(n.originalLine<1)throw new Error("Line numbers must be >= 1");if(n.originalColumn<0)throw new Error("Column numbers must be >= 0");let r=g.getArg(e,"bias",A.GREATEST_LOWER_BOUND);r==null&&(r=A.GREATEST_LOWER_BOUND);let i;if(this._wasm.withMappingCallback(a=>i=a,()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),n.source,n.originalLine-1,n.originalColumn,r)}),i&&i.source===n.source){let a=i.lastGeneratedColumn;return this._computedColumnSpans&&a===null&&(a=1/0),{line:g.getArg(i,"generatedLine",null),column:g.getArg(i,"generatedColumn",null),lastColumn:a}}return{line:null,column:null,lastColumn:null}}}B.prototype.consumer=A;re.BasicSourceMapConsumer=B;class Qe extends A{constructor(e,t){return super(ge).then(n=>{let r=e;typeof e=="string"&&(r=g.parseSourceMapInput(e));const i=g.getArg(r,"version"),a=g.getArg(r,"sections");if(i!=n._version)throw new Error("Unsupported version: "+i);n._sources=new Z,n._names=new Z,n.__generatedMappings=null,n.__originalMappings=null,n.__generatedMappingsUnsorted=null,n.__originalMappingsUnsorted=null;let l={line:-1,column:0};return Promise.all(a.map(s=>{if(s.url)throw new Error("Support for url field in sections not implemented.");const c=g.getArg(s,"offset"),d=g.getArg(c,"line"),_=g.getArg(c,"column");if(d<l.line||d===l.line&&_<l.column)throw new Error("Section offsets must be ordered and non-overlapping.");return l=c,new A(g.getArg(s,"map"),t).then(S=>({generatedOffset:{generatedLine:d+1,generatedColumn:_+1},consumer:S}))})).then(s=>(n._sections=s,n))})}get _generatedMappings(){return this.__generatedMappings||this._sortGeneratedMappings(),this.__generatedMappings}get _originalMappings(){return this.__originalMappings||this._sortOriginalMappings(),this.__originalMappings}get _generatedMappingsUnsorted(){return this.__generatedMappingsUnsorted||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappingsUnsorted}get _originalMappingsUnsorted(){return this.__originalMappingsUnsorted||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappingsUnsorted}_sortGeneratedMappings(){const e=this._generatedMappingsUnsorted;e.sort(g.compareByGeneratedPositionsDeflated),this.__generatedMappings=e}_sortOriginalMappings(){const e=this._originalMappingsUnsorted;e.sort(g.compareByOriginalPositions),this.__originalMappings=e}get sources(){const e=[];for(let t=0;t<this._sections.length;t++)for(let n=0;n<this._sections[t].consumer.sources.length;n++)e.push(this._sections[t].consumer.sources[n]);return e}originalPositionFor(e){const t={generatedLine:g.getArg(e,"line"),generatedColumn:g.getArg(e,"column")},n=le.search(t,this._sections,function(i,a){const l=i.generatedLine-a.generatedOffset.generatedLine;return l||i.generatedColumn-a.generatedOffset.generatedColumn}),r=this._sections[n];return r?r.consumer.originalPositionFor({line:t.generatedLine-(r.generatedOffset.generatedLine-1),column:t.generatedColumn-(r.generatedOffset.generatedLine===t.generatedLine?r.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})}sourceContentFor(e,t){for(let n=0;n<this._sections.length;n++){const i=this._sections[n].consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){for(let t=0;t<this._sections.length;t++){const n=this._sections[t];if(n.consumer._findSourceIndex(g.getArg(e,"source"))===-1)continue;const r=n.consumer.generatedPositionFor(e);if(r)return{line:r.line+(n.generatedOffset.generatedLine-1),column:r.column+(n.generatedOffset.generatedLine===r.line?n.generatedOffset.generatedColumn-1:0)}}return{line:null,column:null}}_parseMappings(e,t){const n=this.__generatedMappingsUnsorted=[],r=this.__originalMappingsUnsorted=[];for(let i=0;i<this._sections.length;i++){const a=this._sections[i],l=[];a.consumer.eachMapping(s=>l.push(s));for(let s=0;s<l.length;s++){const c=l[s];let d=g.computeSourceURL(a.consumer.sourceRoot,null,this._sourceMapURL);this._sources.add(d),d=this._sources.indexOf(d);let _=null;c.name&&(this._names.add(c.name),_=this._names.indexOf(c.name));const h={source:d,generatedLine:c.generatedLine+(a.generatedOffset.generatedLine-1),generatedColumn:c.generatedColumn+(a.generatedOffset.generatedLine===c.generatedLine?a.generatedOffset.generatedColumn-1:0),originalLine:c.originalLine,originalColumn:c.originalColumn,name:_};n.push(h),typeof h.originalLine=="number"&&r.push(h)}}}eachMapping(e,t,n){const r=t||null,i=n||A.GENERATED_ORDER;let a;switch(i){case A.GENERATED_ORDER:a=this._generatedMappings;break;case A.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}const l=this.sourceRoot;a.map(function(s){let c=null;return s.source!==null&&(c=this._sources.at(s.source),c=g.computeSourceURL(l,c,this._sourceMapURL)),{source:c,generatedLine:s.generatedLine,generatedColumn:s.generatedColumn,originalLine:s.originalLine,originalColumn:s.originalColumn,name:s.name===null?null:this._names.at(s.name)}},this).forEach(e,r)}_findMapping(e,t,n,r,i,a){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return le.search(e,t,i,a)}allGeneratedPositionsFor(e){const t=g.getArg(e,"line"),n={source:g.getArg(e,"source"),originalLine:t,originalColumn:g.getArg(e,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];if(n.originalLine<1)throw new Error("Line numbers must be >= 1");if(n.originalColumn<0)throw new Error("Column numbers must be >= 0");const r=[];let i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",g.compareByOriginalPositions,le.LEAST_UPPER_BOUND);if(i>=0){let a=this._originalMappings[i];if(e.column===void 0){const l=a.originalLine;for(;a&&a.originalLine===l;){let s=a.lastGeneratedColumn;this._computedColumnSpans&&s===null&&(s=1/0),r.push({line:g.getArg(a,"generatedLine",null),column:g.getArg(a,"generatedColumn",null),lastColumn:s}),a=this._originalMappings[++i]}}else{const l=a.originalColumn;for(;a&&a.originalLine===t&&a.originalColumn==l;){let s=a.lastGeneratedColumn;this._computedColumnSpans&&s===null&&(s=1/0),r.push({line:g.getArg(a,"generatedLine",null),column:g.getArg(a,"generatedColumn",null),lastColumn:s}),a=this._originalMappings[++i]}}}return r}destroy(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.destroy()}}re.IndexedSourceMapConsumer=Qe;function en(o,e){let t=o;typeof o=="string"&&(t=g.parseSourceMapInput(o));const n=t.sections!=null?new Qe(t,e):new B(t,e);return Promise.resolve(n)}function tn(o,e){return B.fromSourceMap(o,e)}var ve=re.SourceMapConsumer,nn=Object.defineProperty,rn=(o,e,t)=>e in o?nn(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,$=(o,e,t)=>rn(o,typeof e!="symbol"?e+"":e,t);const on=8969,sn="spotlight-by-sentry",an="/contextlines";async function ln(o){try{return(await fetch(o)).text()}catch{return}}function cn(o){try{return JSON.parse(o)}catch{return}}async function un(o,e){const t=await new ve(o),n=t.originalPositionFor({line:e.lineno,column:e.colno,bias:ve.LEAST_UPPER_BOUND});if(n.source&&n.line&&n.column){e.lineno=n.line,e.colno=n.column;const r=new URL(e.filename).pathname.slice(1);e.filename=ie.resolve(ie.join(ie.dirname(r),n.source));const i=t.sourceContentFor(n.source),a=(i==null?void 0:i.split(lt.EOL))??[];Ye(a,e)}return n}function Ye(o,e,t=5){const n=o.length,r=Math.max(Math.min(n-1,e.lineno-1),0);e.pre_context=o.slice(Math.max(0,r-t),r).map(i=>ce(i,0)),e.context_line=ce(o[Math.min(n-1,r)],e.colno||0),e.post_context=o.slice(Math.min(r+1,n),r+1+t).map(i=>ce(i,0))}function ce(o,e){let t=o;const n=t.length;if(n<=150)return t;e>n&&(e=n);let r=Math.max(e-60,0);r<5&&(r=0);let i=Math.min(r+140,n);return i>n-5&&(i=n),i===n&&(r=Math.max(i-140,0)),t=t.slice(r,i),r>0&&(t=`'{snip} ${t}`),i<n&&(t+=" {snip}"),t}function pn(o){return!!o.filename&&!!o.lineno&&!!o.colno}function fn(o,e){if(o.method!=="PUT"){e.writeHead(405),e.end();return}let t="";o.on("data",n=>{t+=n}),o.on("end",async()=>{const n=cn(t);if(!n){e.writeHead(500),e.end();return}for(const i of n.frames??[]){if(!pn(i)||i.filename.includes("/node_modules/"))continue;const{filename:a}=i;if(a.includes("://")){const l=await ln(i.filename);if(!l)continue;const s=l.match(/\/\/# sourceMappingURL=data:application\/json;base64,(.*)/);if(s&&s[1]){const c=s[1],d=Buffer.from(c,"base64").toString("utf-8");await un(d,i)}}else if(!a.includes(":"))try{const l=q.readFileSync(a,{encoding:"utf-8"}).split(/\r?\n/);Ye(l,i)}catch(l){if(l.code!=="ENOENT")throw l}}const r=JSON.stringify(n);e.writeHead(200,{"Content-Type":"application/json"}),e.end(r)})}const K={info:o=>console.log("🔎 [Spotlight]",o),warn:o=>console.warn("🔎 [Spotlight]",o),error:o=>console.error("🔎 [Spotlight]",o),debug:o=>Ke&&console.debug("🔎 [Spotlight]",o)};let V,Ke=!1;function dn(o){V=o}function hn(o){Ke=o}const O={info:o=>(V||K).info(o),warn:o=>(V||K).warn(o),error:o=>(V||K).error(o),debug:o=>(V||K).debug(o)};class gn{constructor(e=100){$(this,"size"),$(this,"items"),$(this,"writePos",0),$(this,"head",0),$(this,"timeout",10),$(this,"readers",new Map),this.size=e,this.items=new Array(e)}put(e){const t=new Date().getTime();this.items[this.writePos%this.size]=[t,e],this.writePos+=1,this.head===this.writePos&&(this.head+=1);const n=t-this.timeout*1e3;let r;for(;this.head<this.writePos&&(r=this.items[this.head%this.size],!(r===void 0||r[0]>n));)this.head+=1}subscribe(e){const t=mn();return this.readers.set(t,e),setTimeout(()=>this.stream(t)),t}unsubscribe(e){this.readers.delete(e)}stream(e,t=this.head){const n=this.readers.get(e);if(!n)return;let r=t,i;for(;i=this.items[r%this.size],!(typeof i>"u"||r>=this.writePos);)n(i[1]),r+=1;setTimeout(()=>this.stream(e,r),500)}clear(){this.items=new Array(this.size),this.writePos=0,this.head=0,this.readers=new Map}}function mn(){let o=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16;return t=(o+t)%16|0,o=Math.floor(o/16),(e==="x"?t:t&3|8).toString(16)})}function Xe(){return{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"*","Access-Control-Allow-Methods":"GET,POST,PUT,OPTIONS,DELETE,PATCH"}}function z(o){return function(t,n,r,i){const a={...Xe(),...Ze()};for(const[l,s]of Object.entries(a))n.setHeader(l,s);if(t.method==="OPTIONS"){n.writeHead(204,{"Cache-Control":"no-cache"}),n.end();return}return o(t,n,r,i)}}function Ze(){return{"X-Powered-by":sn}}function _n(o,e){return function(n,r,i,a){if(n.method==="GET"&&n.headers.accept&&n.headers.accept==="text/event-stream"&&i==="/stream"){r.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),r.flushHeaders(),r.write(`
5
+ `);const l=o.subscribe(([s,c])=>{O.debug("🕊️ sending to Spotlight"),r.write(`event:${s}
6
+ `);for(const d of c.split(`
7
+ `))r.write(`data:${d}
8
8
  `);r.write(`
9
- `)});n.on("close",()=>{o.unsubscribe(l),r.end()})}else if(n.method==="POST"){M.debug("📩 Received event");let l="",s=n;const c=n.headers["content-encoding"];c==="gzip"?s=n.pipe(ue.createGunzip()):c==="deflate"&&(s=n.pipe(ue.createInflate())),s.on("readable",()=>{let f;for(;(f=s.read())!==null;)l+=f}),s.on("end",()=>{var f,_;let h=(f=n.headers["content-type"])==null?void 0:f.split(";")[0].toLocaleLowerCase();if((_=a==null?void 0:a.get("sentry_client"))!=null&&_.startsWith("sentry.javascript.browser")&&n.headers.origin&&(h="application/x-sentry-envelope"),h?o.put([h,l]):M.warn("No content type, skipping payload..."),process.env.SPOTLIGHT_CAPTURE||e){const S=new Date().getTime(),w=`${(h==null?void 0:h.replace(/[^a-z0-9]/gi,"_"))||"no_content_type"}-${S}.txt`;e?e(l):(V.createWriteStream(w).write(l),M.info(`🗃️ Saved data to ${w}`))}r.writeHead(200,{"Cache-Control":"no-cache",Connection:"keep-alive"}),r.end()})}else{et(n,r);return}}}function _n(o){return function(t,n,r){let i=`${r||t.url}`;i==="/"&&(i="/src/index.html"),i=i.slice(1);const a=I.extname(i);let l="text/html";switch(a){case".js":l="text/javascript";break;case".css":l="text/css";break;case".json":l="application/json";break}Object.prototype.hasOwnProperty.call(o,i)?(n.writeHead(200,{"Content-Type":l}),n.end(o[i])):K(t,n)}}function Cn(o,e){e.writeHead(200,{"Content-Type":"text/plain",...Ke(),...Xe()}),e.end("OK")}function wn(o,e){o.method==="DELETE"?(e.writeHead(200,{"Content-Type":"text/plain"}),xn(),e.end("Cleared")):et(o,e)}function Sn(o=process.cwd()){return(e,t)=>{if(e.method!=="POST"){t.writeHead(405),t.end();return}let n="";e.on("data",r=>{n+=r}),e.on("end",()=>{const r=I.resolve(o,n);M.debug(`Launching editor for ${r}`),Nt(r,(i,a)=>{M.error(`Failed to launch editor for ${i}: ${a}`)}),t.writeHead(204),t.end()})}}function Ze(o){return(e,t)=>{t.writeHead(o),t.end()}}const K=Ze(404),et=Ze(405);function bn(o,e,t,n,r){t&&!n&&(n={"/src/index.html":V.readFileSync(I.join(t,"src/index.html")),"/assets/main.js":V.readFileSync(I.join(t,"assets/main.js"))});const i=[[/^\/health$/,Cn],[/^\/clear$/,F(wn)],[/^\/stream$|^\/api\/\d+\/envelope\/?$/,F(mn(o,r))],[/^\/open$/,F(Sn(t))],[RegExp(`^${sn}$`),F(pn)],[/^.+$/,n!=null?F(_n(n)):K]],a=Ie.createServer((c,f)=>{const _=c.url;if(!_)return K(c,f);const{pathname:h,searchParams:S}=new URL(_,`http://${c.headers.host||"localhost"}`),w=i.find(L=>L[0].test(h));return w?w[1](c,f,h,S):K(c,f)});return a.on("error",l),a.listen(e,()=>{s(e,t)}),a;function l(c){"code"in c&&c.code==="EADDRINUSE"&&(M.info(`Port ${e} in use, retrying...`),setTimeout(()=>{a.close(),a.listen(e),M.info(`Port ${e} in use, retrying...`)},5e3))}function s(c,f){M.info(`Sidecar listening on ${c}`),f&&M.info(`You can open: http://localhost:${c} to see the Spotlight overlay directly`)}}let Z;const tt=new hn,yn=o=>{if(typeof o=="string"){const e=Number(o);return/^\d+$/.test(o)&&e>0&&e<=65535}return o>0&&o<=65535};function En(o){return new Promise(e=>{const t={hostname:"localhost",port:o,path:"/health",method:"GET",timeout:2e3,headers:{Connection:"close"}},n=Ie.get(t,r=>{const i=r.headers["x-powered-by"];e(i==="spotlight-by-sentry")});n.on("error",()=>{e(!1)}),n.end()})}function An({port:o,logger:e,basePath:t,filesToServe:n,debug:r,incomingPayload:i}={}){let a=rn;e&&dn(e),(r||process.env.SPOTLIGHT_DEBUG)&&fn(!0),o&&!yn(o)?(M.info("Please provide a valid port."),process.exit(1)):o&&(a=typeof o=="string"?Number(o):o),En(a).then(l=>{l?M.info(`Sidecar is already running on port ${a}`):Z||(Z=bn(tt,a,t,n,i))})}function xn(){tt.clear()}function nt(){Z&&(M.info("Shutting down server..."),Z.close())}process.on("SIGINT",nt);process.on("SIGTERM",nt);const On=st.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:D&&D.tagName.toUpperCase()==="SCRIPT"&&D.src||new URL("spotlight.cjs",document.baseURI).href);let ee=null;try{ee=On("node:sea")}catch{ee={isSea:()=>!1}}const me=ee.isSea()?o=>Buffer.from(ee.getRawAsset(o)):(()=>{const o=I.join(it.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:D&&D.tagName.toUpperCase()==="SCRIPT"&&D.src||new URL("spotlight.cjs",document.baseURI).href),"../../dist/overlay/");return e=>V.readFileSync(I.join(o,e))})(),Le=process.stdout.columns;if(process.stdout.isTTY&&Le>34){const o=Uint8Array.from(ue.inflateRawSync(Buffer.from("bY7LCgMxFEK9L5MwDDSL9P//1DJMKGXowoUcUaFZOk8dU2Op9+qZVkYQoFsaEqA6PZxxma1AoMG+TiONTgcfAd741YxxVf8gCzCgWcYB7OSj9sjW7t2/eKxKAxkIYv8NqL3FpVY25CmjrBSuDw==","base64"))),e="\x1B[",t=`${e}38;5;`,n=`${t}96m`,r=`${t}61m`,i=`${e}1m`,a=`${e}0m`,l=`${a}
10
- `;let s=.22,c=0,f=0,_=0,h=26,S=0;for(let w of o)if(w===255)process.stdout.write(l),c=f=0,_++===5&&(s=s/-3),h=Math.round(h*(1+s)),S=Math.round(Math.random()*18);else{for(;w-->=0&&f<Le;)f<h-1?process.stdout.write(n):f===h-1?process.stdout.write(r):f===h+S&&process.stdout.write(`${a}${i}`),process.stdout.write(c?f>=35?"#":"s":" "),f++;c=!c}process.stdout.write(l)}const Mn=process.argv.length>=3?Number(process.argv[2]):void 0,vn="manifest.json",Re="src/index.html",Ln=process.cwd(),_e=Object.create(null),Rn=JSON.parse(me(vn));_e[Re]=me(Re);const Tn=Object.values(Rn);for(const o of Tn)_e[o.file]=me(o.file);An({port:Mn,basePath:Ln,filesToServe:_e});
9
+ `)});n.on("close",()=>{o.unsubscribe(l),r.end()})}else if(n.method==="POST"){O.debug("📩 Received event");let l="",s=n;const c=n.headers["content-encoding"];c==="gzip"?s=n.pipe(ue.createGunzip()):c==="deflate"&&(s=n.pipe(ue.createInflate())),s.on("readable",()=>{let d;for(;(d=s.read())!==null;)l+=d}),s.on("end",()=>{var d,_;let h=(d=n.headers["content-type"])==null?void 0:d.split(";")[0].toLocaleLowerCase();if((_=a==null?void 0:a.get("sentry_client"))!=null&&_.startsWith("sentry.javascript.browser")&&n.headers.origin&&(h="application/x-sentry-envelope"),h?o.put([h,l]):O.warn("No content type, skipping payload..."),process.env.SPOTLIGHT_CAPTURE||e){const S=new Date().getTime(),w=`${(h==null?void 0:h.replace(/[^a-z0-9]/gi,"_"))||"no_content_type"}-${S}.txt`;e?e(l):(q.createWriteStream(w).write(l),O.info(`🗃️ Saved data to ${w}`))}r.writeHead(200,{"Cache-Control":"no-cache",Connection:"keep-alive"}),r.end()})}else{tt(n,r);return}}}function Cn(o){return function(t,n,r){let i=`${r||t.url}`;i==="/"&&(i="/src/index.html"),i=i.slice(1);const a=I.extname(i);let l="text/html";switch(a){case".js":l="text/javascript";break;case".css":l="text/css";break;case".json":l="application/json";break}Object.prototype.hasOwnProperty.call(o,i)?(n.writeHead(200,{"Content-Type":l}),n.end(o[i])):X(t,n)}}function wn(o,e){e.writeHead(200,{"Content-Type":"text/plain",...Xe(),...Ze()}),e.end("OK")}function Sn(o,e){o.method==="DELETE"?(e.writeHead(200,{"Content-Type":"text/plain"}),On(),e.end("Cleared")):tt(o,e)}function bn(o=process.cwd()){return(e,t)=>{if(e.method!=="POST"){t.writeHead(405),t.end();return}let n="";e.on("data",r=>{n+=r}),e.on("end",()=>{const r=I.resolve(o,n);O.debug(`Launching editor for ${r}`),jt(r,(i,a)=>{O.error(`Failed to launch editor for ${i}: ${a}`)}),t.writeHead(204),t.end()})}}function et(o){return(e,t)=>{t.writeHead(o),t.end()}}const X=et(404),tt=et(405);function yn(o,e,t,n,r){t&&!n&&(n={"/src/index.html":q.readFileSync(I.join(t,"src/index.html")),"/assets/main.js":q.readFileSync(I.join(t,"assets/main.js"))});const i=[[/^\/health$/,wn],[/^\/clear$/,z(Sn)],[/^\/stream$|^\/api\/\d+\/envelope\/?$/,z(_n(o,r))],[/^\/open$/,z(bn(t))],[RegExp(`^${an}$`),z(fn)],[/^.+$/,n!=null?z(Cn(n)):X]],a=$e.createServer((c,d)=>{const _=c.url;if(!_)return X(c,d);const{pathname:h,searchParams:S}=new URL(_,`http://${c.headers.host||"localhost"}`),w=i.find(L=>L[0].test(h));return w?w[1](c,d,h,S):X(c,d)});return a.on("error",l),a.listen(e,()=>{s(e,t)}),a;function l(c){"code"in c&&c.code==="EADDRINUSE"&&(O.info(`Port ${e} in use, retrying...`),setTimeout(()=>{a.close(),a.listen(e),O.info(`Port ${e} in use, retrying...`)},5e3))}function s(c,d){O.info(`Sidecar listening on ${c}`),d&&O.info(`You can open: http://localhost:${c} to see the Spotlight overlay directly`)}}let D;const nt=new gn,An=o=>{if(typeof o=="string"){const e=Number(o);return/^\d+$/.test(o)&&e>0&&e<=65535}return o>0&&o<=65535};function En(o){return new Promise(e=>{const t={hostname:"localhost",port:o,path:"/health",method:"GET",timeout:2e3,headers:{Connection:"close"}},n=$e.get(t,r=>{const i=r.headers["x-powered-by"];e(i==="spotlight-by-sentry")});n.on("error",()=>{e(!1)}),n.end()})}function xn({port:o,logger:e,basePath:t,filesToServe:n,debug:r,incomingPayload:i}={}){let a=on;e&&dn(e),(r||process.env.SPOTLIGHT_DEBUG)&&hn(!0),o&&!An(o)?(O.info("Please provide a valid port."),process.exit(1)):o&&(a=typeof o=="string"?Number(o):o),En(a).then(l=>{l?O.info(`Sidecar is already running on port ${a}`):D||(D=yn(nt,a,t,n,i))})}function On(){nt.clear()}let Le=!1;function rt(){(Le||!D)&&(O.info("Bye."),process.exit(0)),D&&(Le=!0,O.info("Shutting down server gracefully..."),D.close(),D.closeAllConnections())}process.on("SIGINT",rt);process.on("SIGTERM",rt);const Mn=at.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:U&&U.tagName.toUpperCase()==="SCRIPT"&&U.src||new URL("spotlight.cjs",document.baseURI).href);let ee=null;try{ee=Mn("node:sea")}catch{ee={isSea:()=>!1}}const me=ee.isSea()?o=>Buffer.from(ee.getRawAsset(o)):(()=>{const o=I.join(st.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:U&&U.tagName.toUpperCase()==="SCRIPT"&&U.src||new URL("spotlight.cjs",document.baseURI).href),"../../dist/overlay/");return e=>q.readFileSync(I.join(o,e))})(),Re=process.stdout.columns;if(process.stdout.isTTY&&Re>34){const o=Uint8Array.from(ue.inflateRawSync(Buffer.from("bY7LCgMxFEK9L5MwDDSL9P//1DJMKGXowoUcUaFZOk8dU2Op9+qZVkYQoFsaEqA6PZxxma1AoMG+TiONTgcfAd741YxxVf8gCzCgWcYB7OSj9sjW7t2/eKxKAxkIYv8NqL3FpVY25CmjrBSuDw==","base64"))),e="\x1B[",t=`${e}38;5;`,n=`${t}96m`,r=`${t}61m`,i=`${e}1m`,a=`${e}0m`,l=`${a}
10
+ `;let s=.22,c=0,d=0,_=0,h=26,S=0;for(let w of o)if(w===255)process.stdout.write(l),c=d=0,_++===5&&(s=s/-3),h=Math.round(h*(1+s)),S=Math.round(Math.random()*18);else{for(;w-->=0&&d<Re;)d<h-1?process.stdout.write(n):d===h-1?process.stdout.write(r):d===h+S&&process.stdout.write(`${a}${i}`),process.stdout.write(c?d>=35?"#":"s":" "),d++;c=!c}process.stdout.write(l)}const vn=process.argv.length>=3?Number(process.argv[2]):void 0,Ln="manifest.json",Te="src/index.html",Rn=process.cwd(),_e=Object.create(null),Tn=JSON.parse(me(Ln));_e[Te]=me(Te);const Pn=Object.values(Tn);for(const o of Pn)_e[o.file]=me(o.file);xn({port:vn,basePath:Rn,filesToServe:_e});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotlightjs/spotlight",
3
3
  "description": "Spotlight - Sentry for development. Containing the overlay and the sidecar.",
4
- "version": "2.6.2",
4
+ "version": "2.7.0",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "files": [
@@ -36,8 +36,8 @@
36
36
  "macho-unsign": "^2.0.6",
37
37
  "portable-executable-signature": "^2.0.6",
38
38
  "postject": "1.0.0-alpha.6",
39
- "@spotlightjs/sidecar": "1.9.1",
40
- "@spotlightjs/overlay": "2.7.1"
39
+ "@spotlightjs/overlay": "2.8.0",
40
+ "@spotlightjs/sidecar": "1.9.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^18.19.55",
@@ -54,7 +54,7 @@
54
54
  "scripts": {
55
55
  "start": "./bin/run.js",
56
56
  "dev": "vite build --watch",
57
- "build": "vite build && vite build --config vite.overlay.config.ts && vite build --config vite.binary.config.ts && ./bin/build.js && tsc",
57
+ "build": "vite build && vite build --config vite.overlay.config.ts && vite build --config vite.binary.config.ts && ./build.js && tsc",
58
58
  "build:watch": "vite build --watch",
59
59
  "yalc:publish": "yalc publish --push --sig --private",
60
60
  "clean": "rimraf dist"
package/bin/build.js DELETED
@@ -1,144 +0,0 @@
1
- #!/usr/bin/env node
2
- import { execFile as execFileCb } from 'node:child_process';
3
- import { createWriteStream } from 'node:fs';
4
- import { copyFile, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
5
- import { tmpdir } from 'node:os';
6
- import { join } from 'node:path';
7
- import { Readable } from 'node:stream';
8
- import { finished } from 'node:stream/promises';
9
- import { promisify } from 'node:util';
10
-
11
- import { unsign } from 'macho-unsign';
12
- import { signatureSet } from 'portable-executable-signature';
13
- import { inject } from 'postject';
14
-
15
- const execFile = promisify(execFileCb);
16
-
17
- const DIST_DIR = './dist';
18
- const ASSETS_DIR = join(DIST_DIR, 'overlay');
19
- const MANIFEST_NAME = 'manifest.json';
20
- const MANIFEST_PATH = join(ASSETS_DIR, MANIFEST_NAME);
21
- const ENTRY_POINT_NAME = 'src/index.html';
22
- const SEA_CONFIG_PATH = join(DIST_DIR, 'sea-config.json');
23
- const SPOTLIGHT_BLOB_PATH = join(DIST_DIR, 'spotlight.blob');
24
- const NODE_VERSION = '22.11.0';
25
- const PLATFORMS = (process.env.BUILD_PLATFORMS || `${process.platform}-${process.arch}`).split(',').map(p => p.trim());
26
- const manifest = JSON.parse(await readFile(MANIFEST_PATH));
27
- const seaConfig = {
28
- main: join(DIST_DIR, 'spotlight.cjs'),
29
- output: SPOTLIGHT_BLOB_PATH,
30
- disableExperimentalSEAWarning: true,
31
- useSnapshot: false,
32
- useCodeCache: false, // We do cross-compiling so disable this
33
- assets: {
34
- [MANIFEST_NAME]: MANIFEST_PATH,
35
- [ENTRY_POINT_NAME]: join(ASSETS_DIR, ENTRY_POINT_NAME),
36
- ...Object.fromEntries(Object.values(manifest).map(entry => [entry.file, join(ASSETS_DIR, entry.file)])),
37
- },
38
- };
39
-
40
- async function run(cmd, ...args) {
41
- let output;
42
- try {
43
- output = await execFile(cmd, args, { encoding: 'utf8' });
44
- } catch (err) {
45
- console.error(`Failed to \`run ${cmd} ${args.join(' ')}\``);
46
- console.error(err.stdout);
47
- console.error(err.stderr);
48
- process.exit(err.code);
49
- }
50
- if (output.stdout.trim()) {
51
- console.log(output.stdout);
52
- } else {
53
- console.log(`> ${[cmd, ...args].join(' ')}`);
54
- }
55
- return output.stdout;
56
- }
57
-
58
- async function getNodeBinary(platform, targetPath = DIST_DIR) {
59
- const suffix = platform.startsWith('win') ? 'zip' : 'tar.xz';
60
- const remoteArchiveName = `node-v${NODE_VERSION}-${platform}.${suffix}`;
61
- const url = `https://nodejs.org/dist/v${NODE_VERSION}/${remoteArchiveName}`;
62
- const resp = await fetch(url);
63
- if (!resp.ok) throw new Error(`Failed to fetch ${url}`);
64
- const tmpDir = await mkdtemp(join(tmpdir(), remoteArchiveName));
65
- const stream = createWriteStream(join(tmpDir, remoteArchiveName));
66
- await finished(Readable.fromWeb(resp.body).pipe(stream));
67
- let sourceFile;
68
- let targetFile;
69
- if (platform.startsWith('win')) {
70
- await run('unzip', '-qq', stream.path, '-d', tmpDir);
71
- sourceFile = join(tmpDir, `node-v${NODE_VERSION}-${platform}`, 'node.exe');
72
- targetFile = join(targetPath, `spotlight-${platform}.exe`);
73
- const data = await readFile(sourceFile);
74
- const unsigned = signatureSet(data, null);
75
- await writeFile(targetFile, Buffer.from(unsigned));
76
- console.log('Signature removed from Win PE binary', targetFile);
77
- } else {
78
- await run('tar', '-xf', stream.path, '-C', tmpDir);
79
- sourceFile = join(tmpDir, `node-v${NODE_VERSION}-${platform}`, 'bin', 'node');
80
- targetFile = join(targetPath, `spotlight-${platform}`);
81
- }
82
-
83
- if (platform.startsWith('darwin')) {
84
- const unsigned = unsign(await readFile(sourceFile));
85
- await writeFile(targetFile, Buffer.from(unsigned));
86
- console.log('Signature removed from macOS binary', targetFile);
87
- } else {
88
- await copyFile(sourceFile, targetFile);
89
- }
90
-
91
- await rm(tmpDir, { recursive: true });
92
- return targetFile;
93
- }
94
-
95
- await writeFile(SEA_CONFIG_PATH, JSON.stringify(seaConfig));
96
- await run(process.execPath, '--experimental-sea-config', SEA_CONFIG_PATH);
97
- await Promise.all(
98
- PLATFORMS.map(async platform => {
99
- const nodeBinary = await getNodeBinary(platform);
100
- console.log('Injecting spotlight blob into node executable...');
101
- await inject(nodeBinary, 'NODE_SEA_BLOB', await readFile(SPOTLIGHT_BLOB_PATH), {
102
- sentinelFuse: 'NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2',
103
- machoSegmentName: platform.startsWith('darwin') ? 'NODE_SEA' : undefined,
104
- });
105
- console.log('Created executable', nodeBinary);
106
- await run('chmod', '+x', nodeBinary);
107
- if (platform.startsWith('darwin')) {
108
- const { APPLE_TEAM_ID, APPLE_CERT_PATH, APPLE_CERT_PASSWORD, APPLE_API_KEY_PATH } = process.env;
109
- if (!APPLE_TEAM_ID || !APPLE_CERT_PATH || !APPLE_CERT_PASSWORD) {
110
- console.warn(
111
- "Missing required environment variables for macOS signing, you won't be able to use this binary until you sign it yourself.",
112
- );
113
- console.info({ APPLE_TEAM_ID, APPLE_CERT_PATH, APPLE_CERT_PASSWORD });
114
- return;
115
- }
116
- console.log(`Signing ${nodeBinary}...`);
117
- await run(
118
- 'rcodesign',
119
- 'sign',
120
- '--team-name',
121
- APPLE_TEAM_ID,
122
- '--p12-file',
123
- APPLE_CERT_PATH,
124
- '--p12-password',
125
- APPLE_CERT_PASSWORD,
126
- '--for-notarization',
127
- '-e',
128
- join(import.meta.dirname, 'entitlements.plist'),
129
- nodeBinary,
130
- );
131
- if (!APPLE_API_KEY_PATH) {
132
- console.warn(
133
- "Missing required environment variable for macOS notarization, you won't be able to notarize this binary which will annoy people trying to run it.",
134
- );
135
- console.info({ APPLE_API_KEY_PATH });
136
- return;
137
- }
138
- const zipFile = `${nodeBinary}.zip`;
139
- await run('zip', zipFile, nodeBinary);
140
- await run('rcodesign', 'notary-submit', '--api-key-file', APPLE_API_KEY_PATH, '--wait', zipFile);
141
- await rm(zipFile);
142
- }
143
- }),
144
- );
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <!-- This file should be the same as https://github.com/nodejs/node/blob/main/tools/osx-entitlements.plist -->
4
- <plist version="1.0">
5
- <dict>
6
- <key>com.apple.security.cs.allow-jit</key>
7
- <true/>
8
- <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
9
- <true/>
10
- <key>com.apple.security.cs.disable-executable-page-protection</key>
11
- <true/>
12
- <key>com.apple.security.cs.allow-dyld-environment-variables</key>
13
- <true/>
14
- <key>com.apple.security.cs.disable-library-validation</key>
15
- <true/>
16
- <key>com.apple.security.get-task-allow</key>
17
- <true/>
18
- </dict>
19
- </plist>
@@ -1 +0,0 @@
1
- {"main":"dist/spotlight.cjs","output":"dist/spotlight.blob","disableExperimentalSEAWarning":true,"useSnapshot":false,"useCodeCache":false,"assets":{"manifest.json":"dist/overlay/manifest.json","src/index.html":"dist/overlay/src/index.html","assets/main.js":"dist/overlay/assets/main.js"}}
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file