@spotlightjs/spotlight 2.4.2 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ {
2
+ "src/index.html": {
3
+ "file": "assets/main.js",
4
+ "name": "main",
5
+ "src": "src/index.html",
6
+ "isEntry": true
7
+ }
8
+ }
@@ -16,9 +16,8 @@
16
16
  width: 100%;
17
17
  }
18
18
  </style>
19
- <script type="module" crossorigin src="/assets/main-06174f4b.js"></script>
19
+ <script type="module" crossorigin src="/assets/main.js"></script>
20
20
  </head>
21
21
  <body>
22
-
23
22
  </body>
24
23
  </html>
@@ -0,0 +1 @@
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
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ "use strict";const Te=require("fs"),nt=require("os"),Z=require("path"),Pe=require("child_process"),W=require("node:fs"),Ie=require("node:http"),I=require("node:path"),ce=require("node:zlib"),rt=require("node:os"),ot=require("node:sea"),it=require("node:url");var re=typeof document<"u"?document.currentScript:null;function ue(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 oe=ue(I),st=ue(rt),Ce=ue(ot);function at(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var pe={exports:{}},C=String,$e=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=$e();pe.exports.createColors=$e;var lt=pe.exports,de={},ct=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(" ")},De="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",we=new RegExp("^"+De+"$"),Se="|&;()<> \\t",ut='"((\\\\"|[^"])*?)"',pt="'((\\\\'|[^'])*?)'",dt=/^#$/,be="'",ye='"',ie="$",P="",ft=4294967296;for(var Ee=0;Ee<4;Ee++)P+=(ft*Math.random()).toString(16);var ht=new RegExp("^"+P);function gt(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 mt(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 _t(o,e,t){t||(t={});var n=t.escape||"\\",r="(\\"+n+`['"`+Se+`]|[^\\s'"`+Se+"])+",i=new RegExp(["("+De+")","("+r+"|"+ut+"|"+pt+")+"].join("|"),"g"),a=gt(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(we.test(c))return{op:c};var g=!1,_=!1,f="",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 U=c.slice(w);A=U.match(/[^\w\d_]/),A?(R=U.slice(0,A.index),w+=A.index-1):(R=U,w=c.length)}return mt(e,"",R)}for(w=0;w<c.length;w++){var b=c.charAt(w);if(S=S||!g&&(b==="*"||b==="?"),_)f+=b,_=!1;else if(g)b===g?g=!1:g==be?f+=b:b===n?(w+=1,b=c.charAt(w),b===ye||b===n||b===ie?f+=b:f+=n+b):b===ie?f+=L():f+=b;else if(b===ye||b===be)g=b;else{if(we.test(b))return{op:c};if(dt.test(b)){l=!0;var V={comment:o.slice(s.index+w+1)};return f.length?[f,V]:[V]}else b===n?_=!0:b===ie?f+=L():f+=b}}return S?{op:"glob",pattern:f}:f}).reduce(function(s,c){return typeof c>"u"?s:s.concat(c)},[])}var Ct=function(e,t,n){var r=_t(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 ht.test(s)?JSON.parse(s.split(P)[1]):s}))},[])};de.quote=ct;de.parse=Ct;var wt={"/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"},St={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"},bt=["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 yt=Z,Et=de,se=Pe,J=wt,Ae=St,At=bt;var xt=function(e){if(e)return Et.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=se.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=se.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=yt.basename(i);if(At.indexOf(a)!==-1)return[i]}}else if(process.platform==="linux"){const t=se.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 Ot=Z;var Mt=function(e,t,n,r=1){switch(Ot.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 vt=Te,Lt=nt,Be=Z,xe=lt,Oe=Pe,Rt=xt,Tt=Mt;function Pt(o){return(e,t)=>{console.log(),console.log(xe.red("Could not open "+Be.basename(e)+" in the editor.")),t&&(t[t.length-1]!=="."&&(t+="."),console.log(xe.red("The editor process exited with an error: "+t))),console.log(),o&&o(e,t)}}function It(o){switch(o){case"vim":case"emacs":case"nano":return!0}return!1}const Me=/:(\d+)(:(\d+))?$/;function $t(o){const e=o.replace(Me,""),t=o.match(Me),n=t&&t[1],r=t&&t[3];return{fileName:e,lineNumber:n,columnNumber:r}}let T=null;function Dt(o,e,t){const n=$t(o);let{fileName:r}=n;const{lineNumber:i,columnNumber:a}=n;if(!vt.existsSync(r))return;typeof e=="function"&&(t=e,e=void 0),t=Pt(t);const[l,...s]=Rt(e);if(!l){t(r,null);return}if(process.platform==="linux"&&r.startsWith("/mnt/")&&/Microsoft/i.test(Lt.release())&&(r=Be.relative("",r)),i){const c=Tt(l,r,i,a);s.push.apply(s,c)}else s.push(r);if(T&&It(l)&&T.kill("SIGKILL"),process.platform==="win32"){let c=function(f){return f.replace(/([&|<>,;=^])/g,"^$1")},g=function(f){return f.includes("^")?`^"${f}^"`:f.includes(" ")?`"${f}"`:f};const _=[l,...s.map(c)].map(g).join(" ");T=Oe.exec(_,{stdio:"inherit",shell:!0})}else T=Oe.spawn(l,s,{stdio:"inherit"});T.on("exit",function(c){T=null,c&&t(r,"(code "+c+")")}),T.on("error",function(c){let{code:g,message:_}=c;g==="ENOENT"&&(_=`${_} ('${l}' command does not exist in 'PATH')`),t(r,_)})}var Bt=Dt;const Ut=at(Bt);var Ue={},Ne={};const ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Ne.encode=function(o){if(0<=o&&o<ve.length)return ve[o];throw new TypeError("Must be between 0 and 63: "+o)};const Nt=Ne,je=5,Ge=1<<je,jt=Ge-1,Gt=Ge;function kt(o){return o<0?(-o<<1)+1:(o<<1)+0}Ue.encode=function(e){let t="",n,r=kt(e);do n=r&jt,r>>>=je,r>0&&(n|=Gt),t+=Nt.encode(n);while(r>0);return t};var ee={};(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 N=0;for(x=v.length-1;x>=0;x--){const ne=v[x];ne==="."?v.splice(x,1):ne===".."?N++:N>0&&(ne===""?(v.splice(x+1,N),N=0):(v.splice(x,2),N--))}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 g(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=g;const _=function(){return!("__proto__"in Object.create(null))}();function f(u){return u}function S(u){return L(u)?"$"+u:u}o.toSetString=_?f:S;function w(u){return L(u)?u.slice(1):u}o.fromSetString=_?f: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 V(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=V;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 U(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=U})(ee);var fe={};let Ft=class ke{constructor(){this._array=[],this._set=new Map}static fromArray(e,t){const n=new ke;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=Ft;var Fe={};const ze=ee;function zt(o,e){const t=o.generatedLine,n=e.generatedLine,r=o.generatedColumn,i=e.generatedColumn;return n>t||n==t&&i>=r||ze.compareByGeneratedPositionsInflated(o,e)<=0}let Wt=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){zt(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(ze.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};Fe.MappingList=Wt;const j=Ue,y=ee,Q=fe.ArraySet,Vt=Fe.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 Vt,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 g=s.name;g!=null&&!l.has(g)&&l.add(g)},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,g,_;const f=this._mappings.toArray();for(let S=0,w=f.length;S<w;S++){if(c=f[S],s="",c.generatedLine!==t)for(e=0;c.generatedLine!==t;)s+=";",t++;else if(S>0){if(!y.compareByGeneratedPositionsInflated(c,f[S-1]))continue;s+=","}s+=j.encode(c.generatedColumn-e),e=c.generatedColumn,c.source!=null&&(_=this._sources.indexOf(c.source),s+=j.encode(_-a),a=_,s+=j.encode(c.originalLine-1-r),r=c.originalLine-1,s+=j.encode(c.originalColumn-n),n=c.originalColumn,c.name!=null&&(g=this._names.indexOf(c.name),s+=j.encode(g-i),i=g)),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 te={},We={};(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}})(We);var F={exports:{}};const Ht=(function(){return typeof window<"u"&&this===window}).call();if(Ht){let o=null;F.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")},F.exports.initialize=e=>o=e}else{const o=Te,e=Z;F.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)})})},F.exports.initialize=t=>{console.debug("SourceMapConsumer.initialize is a no-op when running in node.js")}}var Ve=F.exports;const Jt=Ve;function Qt(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let G=null;var qt=function(){if(G)return G;const e=[];return G=Jt().then(t=>WebAssembly.instantiate(t,{env:{mapping_callback(n,r,i,a,l,s,c,g,_,f){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=g,_&&(S.name=f)),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 G=null,t}),G};const h=ee,ae=We,K=fe.ArraySet,Yt=Ve,Kt=qt,ge=Symbol("smcInternal");let E=class He{constructor(e,t){return e==ge?Promise.resolve(this):Xt(e,t)}static initialize(e){Yt.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return Zt(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;te.SourceMapConsumer=E;class D extends E{constructor(e,t){return super(ge).then(n=>{let r=e;typeof e=="string"&&(r=h.parseSourceMapInput(e));const i=h.getArg(r,"version");let a=h.getArg(r,"sources");const l=h.getArg(r,"names",[]);let s=h.getArg(r,"sourceRoot",null);const c=h.getArg(r,"sourcesContent",null),g=h.getArg(r,"mappings"),_=h.getArg(r,"file",null);if(i!=n._version)throw new Error("Unsupported version: "+i);return s&&(s=h.normalize(s)),a=a.map(String).map(h.normalize).map(function(f){return s&&h.isAbsolute(s)&&h.isAbsolute(f)?h.relative(s,f):f}),n._names=K.fromArray(l.map(String),!0),n._sources=K.fromArray(a,!0),n._absoluteSources=n._sources.toArray().map(function(f){return h.computeSourceURL(s,f,t)}),n.sourceRoot=s,n.sourcesContent=c,n._mappings=g,n._sourceMapURL=t,n.file=_,n._computedColumnSpans=!1,n._mappingsPtr=0,n._wasm=null,Kt().then(f=>(n._wasm=f,n))})}_findSourceIndex(e){let t=e;if(this.sourceRoot!=null&&(t=h.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 D(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=h.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=h.getArg(e,"source");const n=h.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:h.getArg(e,"line"),generatedColumn:h.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=h.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=h.getArg(r,"source",null);i!==null&&(i=this._sources.at(i),i=h.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));let a=h.getArg(r,"name",null);return a!==null&&(a=this._names.at(a)),{source:i,line:h.getArg(r,"originalLine",null),column:h.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=h.relative(this.sourceRoot,r));let i;if(this.sourceRoot!=null&&(i=h.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=h.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const n={source:t,originalLine:h.getArg(e,"line"),originalColumn:h.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=h.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:h.getArg(i,"generatedLine",null),column:h.getArg(i,"generatedColumn",null),lastColumn:a}}return{line:null,column:null,lastColumn:null}}}D.prototype.consumer=E;te.BasicSourceMapConsumer=D;class Je extends E{constructor(e,t){return super(ge).then(n=>{let r=e;typeof e=="string"&&(r=h.parseSourceMapInput(e));const i=h.getArg(r,"version"),a=h.getArg(r,"sections");if(i!=n._version)throw new Error("Unsupported version: "+i);n._sources=new K,n._names=new K,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=h.getArg(s,"offset"),g=h.getArg(c,"line"),_=h.getArg(c,"column");if(g<l.line||g===l.line&&_<l.column)throw new Error("Section offsets must be ordered and non-overlapping.");return l=c,new E(h.getArg(s,"map"),t).then(S=>({generatedOffset:{generatedLine:g+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(h.compareByGeneratedPositionsDeflated),this.__generatedMappings=e}_sortOriginalMappings(){const e=this._originalMappingsUnsorted;e.sort(h.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:h.getArg(e,"line"),generatedColumn:h.getArg(e,"column")},n=ae.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(h.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 g=h.computeSourceURL(a.consumer.sourceRoot,null,this._sourceMapURL);this._sources.add(g),g=this._sources.indexOf(g);let _=null;c.name&&(this._names.add(c.name),_=this._names.indexOf(c.name));const f={source:g,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(f),typeof f.originalLine=="number"&&r.push(f)}}}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=h.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 ae.search(e,t,i,a)}allGeneratedPositionsFor(e){const t=h.getArg(e,"line"),n={source:h.getArg(e,"source"),originalLine:t,originalColumn:h.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",h.compareByOriginalPositions,ae.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:h.getArg(a,"generatedLine",null),column:h.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:h.getArg(a,"generatedLine",null),column:h.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()}}te.IndexedSourceMapConsumer=Je;function Xt(o,e){let t=o;typeof o=="string"&&(t=h.parseSourceMapInput(o));const n=t.sections!=null?new Je(t,e):new D(t,e);return Promise.resolve(n)}function Zt(o,e){return D.fromSourceMap(o,e)}var Le=te.SourceMapConsumer,en=Object.defineProperty,tn=(o,e,t)=>e in o?en(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,$=(o,e,t)=>tn(o,typeof e!="symbol"?e+"":e,t);const nn=8969,rn="spotlight-by-sentry",on="/contextlines";async function sn(o){try{return(await fetch(o)).text()}catch{return}}function an(o){try{return JSON.parse(o)}catch{return}}async function ln(o,e){const t=await new Le(o),n=t.originalPositionFor({line:e.lineno,column:e.colno,bias:Le.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=oe.resolve(oe.join(oe.dirname(r),n.source));const i=t.sourceContentFor(n.source),a=(i==null?void 0:i.split(st.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=>le(i,0)),e.context_line=le(o[Math.min(n-1,r)],e.colno||0),e.post_context=o.slice(Math.min(r+1,n),r+1+t).map(i=>le(i,0))}function le(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 cn(o){return!!o.filename&&!!o.lineno&&!!o.colno}function un(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=an(t);if(!n){e.writeHead(500),e.end();return}for(const i of n.frames??[]){if(!cn(i)||i.filename.includes("/node_modules/"))continue;const{filename:a}=i;if(a.includes("://")){const l=await sn(i.filename);if(!l)continue;const s=l.match(/\/\/# sourceMappingURL=data:application\/json;base64,(.*)/);if(s&&s[1]){const c=s[1],g=Buffer.from(c,"base64").toString("utf-8");await ln(g,i)}}else if(!a.includes(":"))try{const l=W.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 q={info:o=>console.log("🔎 [Spotlight]",o),warn:o=>console.warn("🔎 [Spotlight]",o),error:o=>console.error("🔎 [Spotlight]",o),debug:o=>qe&&console.debug("🔎 [Spotlight]",o)};let z,qe=!1;function pn(o){z=o}function dn(o){qe=o}const M={info:o=>(z||q).info(o),warn:o=>(z||q).warn(o),error:o=>(z||q).error(o),debug:o=>(z||q).debug(o)};class fn{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=hn();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 hn(){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 Ye(){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 k(o){return function(t,n,r,i){const a={...Ye(),...Ke()};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 Ke(){return{"X-Powered-by":rn}}function gn(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 g of c.split(`
7
+ `))r.write(`data:${g}
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(ce.createGunzip()):c==="deflate"&&(s=n.pipe(ce.createInflate())),s.on("readable",()=>{let g;for(;(g=s.read())!==null;)l+=g}),s.on("end",()=>{var g,_;let f=(g=n.headers["content-type"])==null?void 0:g.split(";")[0].toLocaleLowerCase();if((_=a==null?void 0:a.get("sentry_client"))!=null&&_.startsWith("sentry.javascript.browser")&&n.headers.origin&&(f="application/x-sentry-envelope"),f?o.put([f,l]):M.warn("No content type, skipping payload..."),process.env.SPOTLIGHT_CAPTURE||e){const S=new Date().getTime(),w=`${(f==null?void 0:f.replace(/[^a-z0-9]/gi,"_"))||"no_content_type"}-${S}.txt`;e?e(l):(W.createWriteStream(w).write(l),M.info(`🗃️ Saved data to ${w}`))}r.writeHead(200,{"Cache-Control":"no-cache",Connection:"keep-alive"}),r.end()})}else{Ze(n,r);return}}}function mn(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])):Y(t,n)}}function _n(o,e){e.writeHead(200,{"Content-Type":"text/plain",...Ye(),...Ke()}),e.end("OK")}function Cn(o,e){o.method==="DELETE"?(e.writeHead(200,{"Content-Type":"text/plain"}),An(),e.end("Cleared")):Ze(o,e)}function wn(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}`),Ut(r,(i,a)=>{M.error(`Failed to launch editor for ${i}: ${a}`)}),t.writeHead(204),t.end()})}}function Xe(o){return(e,t)=>{t.writeHead(o),t.end()}}const Y=Xe(404),Ze=Xe(405);function Sn(o,e,t,n,r){t&&!n&&(n={"/src/index.html":W.readFileSync(I.join(t,"src/index.html")),"/assets/main.js":W.readFileSync(I.join(t,"assets/main.js"))});const i=[[/^\/health$/,_n],[/^\/clear$/,k(Cn)],[/^\/stream$|^\/api\/\d+\/envelope\/?$/,k(gn(o,r))],[/^\/open$/,k(wn(t))],[RegExp(`^${on}$`),k(un)],[/^.+$/,n!=null?k(mn(n)):Y]],a=Ie.createServer((c,g)=>{const _=c.url;if(!_)return Y(c,g);const{pathname:f,searchParams:S}=new URL(_,`http://${c.headers.host||"localhost"}`),w=i.find(L=>L[0].test(f));return w?w[1](c,g,f,S):Y(c,g)});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,g){M.info(`Sidecar listening on ${c}`),g&&M.info(`You can open: http://localhost:${c} to see the Spotlight overlay directly`)}}let X;const et=new fn,bn=o=>{if(typeof o=="string"){const e=Number(o);return/^\d+$/.test(o)&&e>0&&e<=65535}return o>0&&o<=65535};function yn(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 En({port:o,logger:e,basePath:t,filesToServe:n,debug:r,incomingPayload:i}={}){let a=nn;e&&pn(e),(r||process.env.SPOTLIGHT_DEBUG)&&dn(!0),o&&!bn(o)?(M.info("Please provide a valid port."),process.exit(1)):o&&(a=typeof o=="string"?Number(o):o),yn(a).then(l=>{l?M.info(`Sidecar is already running on port ${a}`):X||(X=Sn(et,a,t,n,i))})}function An(){et.clear()}function tt(){X&&(M.info("Shutting down server..."),X.close())}process.on("SIGINT",tt);process.on("SIGTERM",tt);if(process.stdout.isTTY){const o=Uint8Array.from(ce.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,g=0,_=0,f=26,S=0;for(let w of o)if(w===255)process.stdout.write(l),c=g=0,_++===5&&(s=s/-3),f=Math.round(f*(1+s)),S=Math.round(Math.random()*18);else{for(;w-->=0;)g<f-1?process.stdout.write(n):g===f-1?process.stdout.write(r):g===f+S&&process.stdout.write(`${a}${i}`),process.stdout.write(c?g>=35?"#":"s":" "),g++;c=!c}process.stdout.write(l)}const me=Ce.isSea()?o=>Buffer.from(Ce.getRawAsset(o)):(()=>{const o=I.join(it.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:re&&re.tagName.toUpperCase()==="SCRIPT"&&re.src||new URL("spotlight.cjs",document.baseURI).href),"../../dist/overlay/");return e=>W.readFileSync(I.join(o,e))})(),xn=process.argv.length>=3?Number(process.argv[2]):void 0,On="manifest.json",Re="src/index.html",Mn=process.cwd(),_e=Object.create(null),vn=JSON.parse(me(On));_e[Re]=me(Re);const Ln=Object.values(vn);for(const o of Ln)_e[o.file]=me(o.file);En({port:xn,basePath:Mn,filesToServe:_e});
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("node:crypto"),g=require("import-meta-resolve"),h=require("@spotlightjs/sidecar");var u=typeof document<"u"?document.currentScript:null;const v="@spotlightjs/spotlight",S=7;function a({server:t,module:r=v}={}){const e=g.resolve(r,typeof document>"u"?require("url").pathToFileURL(__filename).href:u&&u.src||new URL("vite-plugin.cjs",document.baseURI).href).slice(S).split("?",1)[0];return t&&t.config.server.fs.allow.push(e),e}const y=new Set(["importPath","integrationNames","port"]);function p(t){const r=Object.fromEntries(Object.entries(t).filter(([i,l])=>!i.startsWith("_")&&!y.has(i)));let e=JSON.stringify({...r,showTriggerButton:t.showTriggerButton!==!1,injectImmediately:t.injectImmediately!==!1});const n=JSON.stringify({sidecarUrl:t.sidecarUrl,openLastError:!0});return e=`{integrations: [${(t.integrationNames||["sentry"]).map(i=>`Spotlight.${i}(${n})`).join(", ")}], ${e.slice(1)}`,[`import * as Spotlight from ${JSON.stringify("/@fs"+(t.importPath||a()))};`,`Spotlight.init(${e});`,"window.createErrorOverlay=function createErrorOverlay(err) { Spotlight.openSpotlight(); };"].join(`
2
- `)}async function O(t,r="http://localhost:8969/stream"){var c;if(!t.errors){console.log(t);return}const e=t.errors[0],n=(c=t.pluginCode)==null?void 0:c.split(`
3
- `),o=e.location.lineText,i=n==null?void 0:n.indexOf(o),l=f.randomBytes(16).toString("hex"),s=new Date,m=[{event_id:l,sent_at:s.toISOString()},{type:"event"},{event_id:l,level:"error",platform:"javascript",environment:"development",tags:{runtime:"vite"},timestamp:s.getTime(),exception:{values:[{type:"Error",mechanism:{type:"instrument",handled:!1},value:e.text,stacktrace:{frames:[e?{filename:e.location.file,lineno:e.location.line,colno:e.location.column,context_line:o,pre_context:n==null?void 0:n.slice(0,i),post_context:i!=null&&i>-1?n==null?void 0:n.slice(i+1):void 0}:{filename:t.id}]}}]}}].map(d=>JSON.stringify(d)).join(`
4
- `);return await fetch(r,{method:"POST",body:m,headers:{"Content-Type":"application/x-sentry-envelope"}})}function _(t={}){let r;return{name:"spotlight",apply:"serve",transform(e,n){if(n.endsWith("vite/dist/client/client.mjs"))return`${p({...t,importPath:r})}${e}`},configureServer(e){return h.setupSidecar({port:t.port}),r=a({server:e}),()=>e.middlewares.use(async function(o,i,l,s){if(await O(o),l.headersSent)return s(o)})}}}exports.buildClientInit=p;exports.default=_;exports.getSpotlightClientModulePath=a;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("node:crypto"),S=require("import-meta-resolve"),v=require("@spotlightjs/sidecar");var a=typeof document<"u"?document.currentScript:null;const y="@spotlightjs/spotlight",O=7;function c({server:t,module:r=y}={}){const e=S.resolve(r,typeof document>"u"?require("url").pathToFileURL(__filename).href:a&&a.tagName.toUpperCase()==="SCRIPT"&&a.src||new URL("vite-plugin.cjs",document.baseURI).href).slice(O).split("?",1)[0];return t&&t.config.server.fs.allow.push(e),e}const _=new Set(["importPath","integrationNames","port"]);function m(t){const r=Object.fromEntries(Object.entries(t).filter(([i])=>!i.startsWith("_")&&!_.has(i)));let e=JSON.stringify({...r,showTriggerButton:t.showTriggerButton!==!1,injectImmediately:t.injectImmediately!==!1});const n=JSON.stringify({openLastError:!0});return e=`{integrations: [${(t.integrationNames||["sentry"]).map(i=>`Spotlight.${i}(${n})`).join(", ")}], ${e.slice(1)}`,[`import * as Spotlight from ${JSON.stringify("/@fs"+(t.importPath||c()))};`,`Spotlight.init(${e});`,"window.createErrorOverlay=function createErrorOverlay(err) { Spotlight.openSpotlight(); };"].join(`
2
+ `)}async function w(t,r="http://localhost:8969/stream"){var u;if(!t.errors){console.log(t);return}const e=t.errors[0],n=(u=t.pluginCode)==null?void 0:u.split(`
3
+ `),o=e.location.lineText,i=n==null?void 0:n.indexOf(o),s=h.randomBytes(16).toString("hex"),l=new Date,d=new URL(r);let p=r;d.pathname.endsWith("/stream")||(p=new URL("/stream",r).href);const f=[{event_id:s,sent_at:l.toISOString()},{type:"event"},{event_id:s,level:"error",platform:"javascript",environment:"development",tags:{runtime:"vite"},timestamp:l.getTime(),exception:{values:[{type:"Error",mechanism:{type:"instrument",handled:!1},value:e.text,stacktrace:{frames:[e?{filename:e.location.file,lineno:e.location.line,colno:e.location.column,context_line:o,pre_context:n==null?void 0:n.slice(0,i),post_context:i!=null&&i>-1?n==null?void 0:n.slice(i+1):void 0}:{filename:t.id}]}}]}}].map(g=>JSON.stringify(g)).join(`
4
+ `);return await fetch(p,{method:"POST",body:f,headers:{"Content-Type":"application/x-sentry-envelope"}})}function T(t={}){let r;return{name:"spotlight",apply:"serve",transform(e,n){if(n.endsWith("vite/dist/client/client.mjs"))return`${m({...t,importPath:r})}${e}`},configureServer(e){return v.setupSidecar({port:t.port}),r=c({server:e}),()=>e.middlewares.use(async function(o,i,s,l){if(await w(o,t.sidecarUrl),s.headersSent)return l(o)})}}}exports.buildClientInit=m;exports.default=T;exports.getSpotlightClientModulePath=c;
@@ -1,49 +1,52 @@
1
- import { randomBytes as f } from "node:crypto";
2
- import { resolve as g } from "import-meta-resolve";
3
- import { setupSidecar as h } from "@spotlightjs/sidecar";
4
- const u = "@spotlightjs/spotlight", d = 7;
5
- function c({
1
+ import { randomBytes as g } from "node:crypto";
2
+ import { resolve as u } from "import-meta-resolve";
3
+ import { setupSidecar as d } from "@spotlightjs/sidecar";
4
+ const S = "@spotlightjs/spotlight", v = 7;
5
+ function p({
6
6
  server: t,
7
- module: r = u
7
+ module: r = S
8
8
  } = {}) {
9
- const e = g(r, import.meta.url).slice(d).split("?", 1)[0];
9
+ const e = u(r, import.meta.url).slice(v).split("?", 1)[0];
10
10
  return t && t.config.server.fs.allow.push(e), e;
11
11
  }
12
- const v = /* @__PURE__ */ new Set(["importPath", "integrationNames", "port"]);
13
- function S(t) {
12
+ const y = /* @__PURE__ */ new Set(["importPath", "integrationNames", "port"]);
13
+ function O(t) {
14
14
  const r = Object.fromEntries(
15
- Object.entries(t).filter(([i, l]) => !i.startsWith("_") && !v.has(i))
15
+ Object.entries(t).filter(([i]) => !i.startsWith("_") && !y.has(i))
16
16
  );
17
17
  let e = JSON.stringify({
18
18
  ...r,
19
19
  showTriggerButton: t.showTriggerButton !== !1,
20
20
  injectImmediately: t.injectImmediately !== !1
21
21
  });
22
- const n = JSON.stringify({ sidecarUrl: t.sidecarUrl, openLastError: !0 });
22
+ const n = JSON.stringify({ openLastError: !0 });
23
23
  return e = `{integrations: [${(t.integrationNames || ["sentry"]).map((i) => `Spotlight.${i}(${n})`).join(", ")}], ${e.slice(1)}`, [
24
- `import * as Spotlight from ${JSON.stringify("/@fs" + (t.importPath || c()))};`,
24
+ `import * as Spotlight from ${JSON.stringify("/@fs" + (t.importPath || p()))};`,
25
25
  `Spotlight.init(${e});`,
26
26
  "window.createErrorOverlay=function createErrorOverlay(err) { Spotlight.openSpotlight(); };"
27
27
  ].join(`
28
28
  `);
29
29
  }
30
- async function y(t, r = "http://localhost:8969/stream") {
31
- var a;
30
+ async function w(t, r = "http://localhost:8969/stream") {
31
+ var c;
32
32
  if (!t.errors) {
33
33
  console.log(t);
34
34
  return;
35
35
  }
36
- const e = t.errors[0], n = (a = t.pluginCode) == null ? void 0 : a.split(`
37
- `), o = e.location.lineText, i = n == null ? void 0 : n.indexOf(o), l = f(16).toString("hex"), s = /* @__PURE__ */ new Date(), p = [
38
- { event_id: l, sent_at: s.toISOString() },
36
+ const e = t.errors[0], n = (c = t.pluginCode) == null ? void 0 : c.split(`
37
+ `), o = e.location.lineText, i = n == null ? void 0 : n.indexOf(o), s = g(16).toString("hex"), a = /* @__PURE__ */ new Date(), m = new URL(r);
38
+ let l = r;
39
+ m.pathname.endsWith("/stream") || (l = new URL("/stream", r).href);
40
+ const f = [
41
+ { event_id: s, sent_at: a.toISOString() },
39
42
  { type: "event" },
40
43
  {
41
- event_id: l,
44
+ event_id: s,
42
45
  level: "error",
43
46
  platform: "javascript",
44
47
  environment: "development",
45
48
  tags: { runtime: "vite" },
46
- timestamp: s.getTime(),
49
+ timestamp: a.getTime(),
47
50
  exception: {
48
51
  values: [
49
52
  {
@@ -71,33 +74,33 @@ async function y(t, r = "http://localhost:8969/stream") {
71
74
  ]
72
75
  }
73
76
  }
74
- ].map((m) => JSON.stringify(m)).join(`
77
+ ].map((h) => JSON.stringify(h)).join(`
75
78
  `);
76
- return await fetch(r, {
79
+ return await fetch(l, {
77
80
  method: "POST",
78
- body: p,
81
+ body: f,
79
82
  headers: { "Content-Type": "application/x-sentry-envelope" }
80
83
  });
81
84
  }
82
- function w(t = {}) {
85
+ function _(t = {}) {
83
86
  let r;
84
87
  return {
85
88
  name: "spotlight",
86
89
  apply: "serve",
87
90
  transform(e, n) {
88
91
  if (n.endsWith("vite/dist/client/client.mjs"))
89
- return `${S({ ...t, importPath: r })}${e}`;
92
+ return `${O({ ...t, importPath: r })}${e}`;
90
93
  },
91
94
  configureServer(e) {
92
- return h({ port: t.port }), r = c({ server: e }), () => e.middlewares.use(async function(o, i, l, s) {
93
- if (await y(o), l.headersSent)
94
- return s(o);
95
+ return d({ port: t.port }), r = p({ server: e }), () => e.middlewares.use(async function(o, i, s, a) {
96
+ if (await w(o, t.sidecarUrl), s.headersSent)
97
+ return a(o);
95
98
  });
96
99
  }
97
100
  };
98
101
  }
99
102
  export {
100
- S as buildClientInit,
101
- w as default,
102
- c as getSpotlightClientModulePath
103
+ O as buildClientInit,
104
+ _ as default,
105
+ p as getSpotlightClientModulePath
103
106
  };
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.4.2",
4
+ "version": "2.6.0",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "files": [
@@ -33,13 +33,16 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "import-meta-resolve": "^4.1.0",
36
- "@spotlightjs/overlay": "2.5.2",
37
- "@spotlightjs/sidecar": "1.8.0"
36
+ "macho-unsign": "^2.0.6",
37
+ "portable-executable-signature": "^2.0.6",
38
+ "postject": "1.0.0-alpha.6",
39
+ "@spotlightjs/overlay": "2.7.0",
40
+ "@spotlightjs/sidecar": "1.9.0"
38
41
  },
39
42
  "devDependencies": {
40
- "@types/node": "^18",
41
- "typescript": "^5.0.2",
42
- "vite": "^4.5.3",
43
+ "@types/node": "^18.19.55",
44
+ "typescript": "^5.6.2",
45
+ "vite": "^5.4.11",
43
46
  "@spotlightjs/tsconfig": "1.0.0"
44
47
  },
45
48
  "volta": {
@@ -51,7 +54,7 @@
51
54
  "scripts": {
52
55
  "start": "./bin/run.js",
53
56
  "dev": "vite build --watch",
54
- "build": "vite build && vite build --config vite.overlay.config.ts && tsc",
57
+ "build": "vite build && vite build --config vite.overlay.config.ts && vite build --config vite.binary.config.ts && ./bin/build.js && tsc",
55
58
  "build:watch": "vite build --watch",
56
59
  "yalc:publish": "yalc publish --push --sig --private",
57
60
  "clean": "rimraf dist"