@shopify/cli
Version:
A CLI tool to build for the Shopify platform
2 lines (1 loc) • 25.5 kB
JavaScript
import{a as B,c as C,g}from"./chunk-VPRTJUIN.js";var oe=C(re=>{g();var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");re.encode=function(s){if(0<=s&&s<te.length)return te[s];throw new TypeError("Must be between 0 and 63: "+s)}});var U=C(le=>{g();var Ae=oe(),se=5,ie=1<<se,Oe=ie-1,xe=ie;function ve(s){return s<0?(-s<<1)+1:(s<<1)+0}le.encode=function(e){let n="",t,r=ve(e);do t=r&Oe,r>>>=se,r>0&&(t|=xe),n+=Ae.encode(t);while(r>0);return n}});var ce=C((ln,ue)=>{"use strict";g();ue.exports=typeof URL=="function"?URL:B("url").URL});var M=C(S=>{g();var b=ce();function Me(s,e,n){if(e in s)return s[e];if(arguments.length===3)return n;throw new Error('"'+e+'" is a required argument.')}S.getArg=Me;var fe=(function(){return!("__proto__"in Object.create(null))})();function he(s){return s}function Ie(s){return de(s)?"$"+s:s}S.toSetString=fe?he:Ie;function Re(s){return de(s)?s.slice(1):s}S.fromSetString=fe?he:Re;function de(s){if(!s)return!1;let e=s.length;if(e<9||s.charCodeAt(e-1)!==95||s.charCodeAt(e-2)!==95||s.charCodeAt(e-3)!==111||s.charCodeAt(e-4)!==116||s.charCodeAt(e-5)!==111||s.charCodeAt(e-6)!==114||s.charCodeAt(e-7)!==112||s.charCodeAt(e-8)!==95||s.charCodeAt(e-9)!==95)return!1;for(let n=e-10;n>=0;n--)if(s.charCodeAt(n)!==36)return!1;return!0}function ae(s,e){return s===e?0:s===null?1:e===null?-1:s>e?1:-1}function Ne(s,e){let n=s.generatedLine-e.generatedLine;return n!==0||(n=s.generatedColumn-e.generatedColumn,n!==0)||(n=ae(s.source,e.source),n!==0)||(n=s.originalLine-e.originalLine,n!==0)||(n=s.originalColumn-e.originalColumn,n!==0)?n:ae(s.name,e.name)}S.compareByGeneratedPositionsInflated=Ne;function Te(s){return JSON.parse(s.replace(/^\)]}'[^\n]*\n/,""))}S.parseSourceMapInput=Te;var k="http:",x=`${k}//host`;function z(s){return e=>{let n=L(e),t=F(e),r=new b(e,t);s(r);let o=r.toString();return n==="absolute"?o:n==="scheme-relative"?o.slice(k.length):n==="path-absolute"?o.slice(x.length):V(t,o)}}function y(s,e){return new b(s,e).toString()}function Pe(s,e){let n=0;do{let t=s+n++;if(e.indexOf(t)===-1)return t}while(!0)}function F(s){let e=s.split("..").length-1,n=Pe("p",s),t=`${x}/`;for(let r=0;r<e;r++)t+=`${n}/`;return t}var Ge=/^[A-Za-z0-9\+\-\.]+:/;function L(s){return s[0]==="/"?s[1]==="/"?"scheme-relative":"path-absolute":Ge.test(s)?"absolute":"path-relative"}function V(s,e){typeof s=="string"&&(s=new b(s)),typeof e=="string"&&(e=new b(e));let n=e.pathname.split("/"),t=s.pathname.split("/");for(t.length>0&&!t[t.length-1]&&t.pop();n.length>0&&t.length>0&&n[0]===t[0];)n.shift(),t.shift();return t.map(()=>"..").concat(n).join("/")+e.search+e.hash}var qe=z(s=>{s.pathname=s.pathname.replace(/\/?$/,"/")}),De=z(s=>{s.href=new b(".",s.toString()).toString()}),v=z(s=>{});S.normalize=v;function W(s,e){let n=L(e),t=L(s);if(s=qe(s),n==="absolute")return y(e,void 0);if(t==="absolute")return y(e,s);if(n==="scheme-relative")return v(e);if(t==="scheme-relative")return y(e,y(s,x)).slice(k.length);if(n==="path-absolute")return v(e);if(t==="path-absolute")return y(e,y(s,x)).slice(x.length);let r=F(e+s),o=y(e,y(s,r));return V(r,o)}S.join=W;function je(s,e){let n=Be(s,e);return typeof n=="string"?n:v(e)}S.relative=je;function Be(s,e){if(L(s)!==L(e))return null;let t=F(s+e),r=new b(s,t),o=new b(e,t);try{new b("",o.toString())}catch{return null}return o.protocol!==r.protocol||o.user!==r.user||o.password!==r.password||o.hostname!==r.hostname||o.port!==r.port?null:V(r,o)}function Ue(s,e,n){s&&L(e)==="path-absolute"&&(e=e.replace(/^\//,""));let t=v(e||"");return s&&(t=W(s,t)),n&&(t=W(De(n),t)),t}S.computeSourceURL=Ue});var Q=C(ge=>{g();var $=class s{constructor(){this._array=[],this._set=new Map}static fromArray(e,n){let t=new s;for(let r=0,o=e.length;r<o;r++)t.add(e[r],n);return t}size(){return this._set.size}add(e,n){let t=this.has(e),r=this._array.length;(!t||n)&&this._array.push(e),t||this._set.set(e,r)}has(e){return this._set.has(e)}indexOf(e){let n=this._set.get(e);if(n>=0)return n;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()}};ge.ArraySet=$});var pe=C(_e=>{g();var me=M();function We(s,e){let n=s.generatedLine,t=e.generatedLine,r=s.generatedColumn,o=e.generatedColumn;return t>n||t==n&&o>=r||me.compareByGeneratedPositionsInflated(s,e)<=0}var J=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,n){this._array.forEach(e,n)}add(e){We(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(me.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};_e.MappingList=J});var K=C(Ce=>{g();var I=U(),m=M(),T=Q().ArraySet,ke=pe().MappingList,P=class s{constructor(e){e||(e={}),this._file=m.getArg(e,"file",null),this._sourceRoot=m.getArg(e,"sourceRoot",null),this._skipValidation=m.getArg(e,"skipValidation",!1),this._sources=new T,this._names=new T,this._mappings=new ke,this._sourcesContents=null}static fromSourceMap(e){let n=e.sourceRoot,t=new s({file:e.file,sourceRoot:n});return e.eachMapping(function(r){let o={generated:{line:r.generatedLine,column:r.generatedColumn}};r.source!=null&&(o.source=r.source,n!=null&&(o.source=m.relative(n,o.source)),o.original={line:r.originalLine,column:r.originalColumn},r.name!=null&&(o.name=r.name)),t.addMapping(o)}),e.sources.forEach(function(r){let o=r;n!=null&&(o=m.relative(n,r)),t._sources.has(o)||t._sources.add(o);let i=e.sourceContentFor(r);i!=null&&t.setSourceContent(r,i)}),t}addMapping(e){let n=m.getArg(e,"generated"),t=m.getArg(e,"original",null),r=m.getArg(e,"source",null),o=m.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,t,r,o),r!=null&&(r=String(r),this._sources.has(r)||this._sources.add(r)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:t&&t.line,originalColumn:t&&t.column,source:r,name:o})}setSourceContent(e,n){let t=e;this._sourceRoot!=null&&(t=m.relative(this._sourceRoot,t)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[m.toSetString(t)]=n):this._sourcesContents&&(delete this._sourcesContents[m.toSetString(t)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(e,n,t){let r=n;if(n==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}let o=this._sourceRoot;o!=null&&(r=m.relative(o,r));let i=this._mappings.toArray().length>0?new T:this._sources,c=new T;this._mappings.unsortedForEach(function(u){if(u.source===r&&u.originalLine!=null){let d=e.originalPositionFor({line:u.originalLine,column:u.originalColumn});d.source!=null&&(u.source=d.source,t!=null&&(u.source=m.join(t,u.source)),o!=null&&(u.source=m.relative(o,u.source)),u.originalLine=d.line,u.originalColumn=d.column,d.name!=null&&(u.name=d.name))}let f=u.source;f!=null&&!i.has(f)&&i.add(f);let l=u.name;l!=null&&!c.has(l)&&c.add(l)},this),this._sources=i,this._names=c,e.sources.forEach(function(u){let f=e.sourceContentFor(u);f!=null&&(t!=null&&(u=m.join(t,u)),o!=null&&(u=m.relative(o,u)),this.setSourceContent(u,f))},this)}_validateMapping(e,n,t,r){if(n&&typeof n.line!="number"&&typeof n.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&&!n&&!t&&!r)){if(!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&t))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:t,original:n,name:r}))}}_serializeMappings(){let e=0,n=1,t=0,r=0,o=0,i=0,c="",u,f,l,d,p=this._mappings.toArray();for(let a=0,w=p.length;a<w;a++){if(f=p[a],u="",f.generatedLine!==n)for(e=0;f.generatedLine!==n;)u+=";",n++;else if(a>0){if(!m.compareByGeneratedPositionsInflated(f,p[a-1]))continue;u+=","}u+=I.encode(f.generatedColumn-e),e=f.generatedColumn,f.source!=null&&(d=this._sources.indexOf(f.source),u+=I.encode(d-i),i=d,u+=I.encode(f.originalLine-1-r),r=f.originalLine-1,u+=I.encode(f.originalColumn-t),t=f.originalColumn,f.name!=null&&(l=this._names.indexOf(f.name),u+=I.encode(l-o),o=l)),c+=u}return c}_generateSourcesContent(e,n){return e.map(function(t){if(!this._sourcesContents)return null;n!=null&&(t=m.relative(n,t));let r=m.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)}toJSON(){let 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())}};P.prototype._version=3;Ce.SourceMapGenerator=P});var we=C(E=>{g();E.GREATEST_LOWER_BOUND=1;E.LEAST_UPPER_BOUND=2;function X(s,e,n,t,r,o){let i=Math.floor((e-s)/2)+s,c=r(n,t[i],!0);return c===0?i:c>0?e-i>1?X(i,e,n,t,r,o):o===E.LEAST_UPPER_BOUND?e<t.length?e:-1:i:i-s>1?X(s,i,n,t,r,o):o==E.LEAST_UPPER_BOUND?i:s<0?-1:s}E.search=function(e,n,t,r){if(n.length===0)return-1;let o=X(-1,n.length,e,n,t,r||E.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&t(n[o],n[o-1],!0)===0;)--o;return o}});var Y=C((wn,Z)=>{"use strict";g();var ze=B("fs"),Fe=B("path");Z.exports=function(){return new Promise((e,n)=>{let t=Fe.join(__dirname,"mappings.wasm");ze.readFile(t,null,(r,o)=>{if(r){n(r);return}e(o.buffer)})})};Z.exports.initialize=s=>{console.debug("SourceMapConsumer.initialize is a no-op when running in node.js")}});var ye=C((yn,Se)=>{g();var Ve=Y();function $e(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}var R=null;Se.exports=function(){if(R)return R;let e=[];return R=Ve().then(n=>WebAssembly.instantiate(n,{env:{mapping_callback(t,r,o,i,c,u,f,l,d,p){let a=new $e;a.generatedLine=t+1,a.generatedColumn=r,o&&(a.lastGeneratedColumn=i-1),c&&(a.source=u,a.originalLine=f+1,a.originalColumn=l,d&&(a.name=p)),e[e.length-1](a)},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(n=>({exports:n.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}})).then(null,n=>{throw R=null,n}),R}});var be=C(q=>{g();var h=M(),Qe=we(),H=Q().ArraySet,En=U(),Je=Y(),Ke=ye(),ee=Symbol("smcInternal"),_=class s{constructor(e,n){return e==ee?Promise.resolve(this):Xe(e,n)}static initialize(e){Je.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,n){return Ze(e,n)}static async with(e,n,t){let r=await new s(e,n);try{return await t(r)}finally{r.destroy()}}eachMapping(e,n,t){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};_.prototype._version=3;_.GENERATED_ORDER=1;_.ORIGINAL_ORDER=2;_.GREATEST_LOWER_BOUND=1;_.LEAST_UPPER_BOUND=2;q.SourceMapConsumer=_;var A=class s extends _{constructor(e,n){return super(ee).then(t=>{let r=e;typeof e=="string"&&(r=h.parseSourceMapInput(e));let o=h.getArg(r,"version"),i=h.getArg(r,"sources").map(String),c=h.getArg(r,"names",[]),u=h.getArg(r,"sourceRoot",null),f=h.getArg(r,"sourcesContent",null),l=h.getArg(r,"mappings"),d=h.getArg(r,"file",null),p=h.getArg(r,"x_google_ignoreList",null);if(o!=t._version)throw new Error("Unsupported version: "+o);return t._sourceLookupCache=new Map,t._names=H.fromArray(c.map(String),!0),t._sources=H.fromArray(i,!0),t._absoluteSources=H.fromArray(t._sources.toArray().map(function(a){return h.computeSourceURL(u,a,n)}),!0),t.sourceRoot=u,t.sourcesContent=f,t._mappings=l,t._sourceMapURL=n,t.file=d,t.x_google_ignoreList=p,t._computedColumnSpans=!1,t._mappingsPtr=0,t._wasm=null,Ke().then(a=>(t._wasm=a,t))})}_findSourceIndex(e){let n=this._sourceLookupCache.get(e);if(typeof n=="number")return n;let t=h.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(t)){let o=this._absoluteSources.indexOf(t);return this._sourceLookupCache.set(e,o),o}let r=h.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(r)){let o=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,o),o}return-1}static fromSourceMap(e,n){return new s(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return this._mappingsPtr===0&&this._parseMappings(),this._mappingsPtr}_parseMappings(){let e=this._mappings,n=e.length,t=this._wasm.exports.allocate_mappings(n)>>>0,r=new Uint8Array(this._wasm.exports.memory.buffer,t,n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);let o=this._wasm.exports.parse_mappings(t);if(!o){let i=this._wasm.exports.get_last_error(),c=`Error parsing mappings (code ${i}): `;switch(i){case 1:c+="the mappings contained a negative line, column, source index, or name index";break;case 2:c+="the mappings contained a number larger than 2**32";break;case 3:c+="reached EOF while in the middle of parsing a VLQ";break;case 4:c+="invalid base 64 character while parsing a VLQ";break;default:c+="unknown error code";break}throw new Error(c)}this._mappingsPtr=o}eachMapping(e,n,t){let r=n||null,o=t||_.GENERATED_ORDER;this._wasm.withMappingCallback(i=>{i.source!==null&&(i.source=this._absoluteSources.at(i.source),i.name!==null&&(i.name=this._names.at(i.name))),this._computedColumnSpans&&i.lastGeneratedColumn===null&&(i.lastGeneratedColumn=1/0),e.call(r,i)},()=>{switch(o){case _.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case _.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}})}allGeneratedPositionsFor(e){let n=h.getArg(e,"source"),t=h.getArg(e,"line"),r=e.column||0;if(n=this._findSourceIndex(n),n<0)return[];if(t<1)throw new Error("Line numbers must be >= 1");if(r<0)throw new Error("Column numbers must be >= 0");let o=[];return this._wasm.withMappingCallback(i=>{let c=i.lastGeneratedColumn;this._computedColumnSpans&&c===null&&(c=1/0),o.push({line:i.generatedLine,column:i.generatedColumn,lastColumn:c})},()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),n,t-1,"column"in e,r)}),o}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){let n={generatedLine:h.getArg(e,"line"),generatedColumn:h.getArg(e,"column")};if(n.generatedLine<1)throw new Error("Line numbers must be >= 1");if(n.generatedColumn<0)throw new Error("Column numbers must be >= 0");let t=h.getArg(e,"bias",_.GREATEST_LOWER_BOUND);t==null&&(t=_.GREATEST_LOWER_BOUND);let r;if(this._wasm.withMappingCallback(o=>r=o,()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),n.generatedLine-1,n.generatedColumn,t)}),r&&r.generatedLine===n.generatedLine){let o=h.getArg(r,"source",null);o!==null&&(o=this._absoluteSources.at(o));let i=h.getArg(r,"name",null);return i!==null&&(i=this._names.at(i)),{source:o,line:h.getArg(r,"originalLine",null),column:h.getArg(r,"originalColumn",null),name:i}}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,n){if(!this.sourcesContent)return null;let t=this._findSourceIndex(e);if(t>=0)return this.sourcesContent[t];if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let n=h.getArg(e,"source");if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};let t={source:n,originalLine:h.getArg(e,"line"),originalColumn:h.getArg(e,"column")};if(t.originalLine<1)throw new Error("Line numbers must be >= 1");if(t.originalColumn<0)throw new Error("Column numbers must be >= 0");let r=h.getArg(e,"bias",_.GREATEST_LOWER_BOUND);r==null&&(r=_.GREATEST_LOWER_BOUND);let o;if(this._wasm.withMappingCallback(i=>o=i,()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),t.source,t.originalLine-1,t.originalColumn,r)}),o&&o.source===t.source){let i=o.lastGeneratedColumn;return this._computedColumnSpans&&i===null&&(i=1/0),{line:h.getArg(o,"generatedLine",null),column:h.getArg(o,"generatedColumn",null),lastColumn:i}}return{line:null,column:null,lastColumn:null}}};A.prototype.consumer=_;q.BasicSourceMapConsumer=A;var G=class extends _{constructor(e,n){return super(ee).then(t=>{let r=e;typeof e=="string"&&(r=h.parseSourceMapInput(e));let o=h.getArg(r,"version"),i=h.getArg(r,"sections");if(o!=t._version)throw new Error("Unsupported version: "+o);let c={line:-1,column:0};return Promise.all(i.map(u=>{if(u.url)throw new Error("Support for url field in sections not implemented.");let f=h.getArg(u,"offset"),l=h.getArg(f,"line"),d=h.getArg(f,"column");if(l<c.line||l===c.line&&d<c.column)throw new Error("Section offsets must be ordered and non-overlapping.");return c=f,new _(h.getArg(u,"map"),n).then(a=>({generatedOffset:{generatedLine:l+1,generatedColumn:d+1},consumer:a}))})).then(u=>(t._sections=u,t))})}get sources(){let e=[];for(let n=0;n<this._sections.length;n++)for(let t=0;t<this._sections[n].consumer.sources.length;t++)e.push(this._sections[n].consumer.sources[t]);return e}originalPositionFor(e){let n={generatedLine:h.getArg(e,"line"),generatedColumn:h.getArg(e,"column")},t=Qe.search(n,this._sections,function(o,i){let c=o.generatedLine-i.generatedOffset.generatedLine;return c||o.generatedColumn-(i.generatedOffset.generatedColumn-1)}),r=this._sections[t];return r?r.consumer.originalPositionFor({line:n.generatedLine-(r.generatedOffset.generatedLine-1),column:n.generatedColumn-(r.generatedOffset.generatedLine===n.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,n){for(let t=0;t<this._sections.length;t++){let o=this._sections[t].consumer.sourceContentFor(e,!0);if(o)return o}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')}_findSectionIndex(e){for(let n=0;n<this._sections.length;n++){let{consumer:t}=this._sections[n];if(t._findSourceIndex(e)!==-1)return n}return-1}generatedPositionFor(e){let n=this._findSectionIndex(h.getArg(e,"source")),t=n>=0?this._sections[n]:null,r=n>=0&&n+1<this._sections.length?this._sections[n+1]:null,o=t&&t.consumer.generatedPositionFor(e);if(o&&o.line!==null){let i=t.generatedOffset.generatedLine-1,c=t.generatedOffset.generatedColumn-1;return o.line===1&&(o.column+=c,typeof o.lastColumn=="number"&&(o.lastColumn+=c)),o.lastColumn===1/0&&r&&o.line===r.generatedOffset.generatedLine&&(o.lastColumn=r.generatedOffset.generatedColumn-2),o.line+=i,o}return{line:null,column:null,lastColumn:null}}allGeneratedPositionsFor(e){let n=this._findSectionIndex(h.getArg(e,"source")),t=n>=0?this._sections[n]:null,r=n>=0&&n+1<this._sections.length?this._sections[n+1]:null;return t?t.consumer.allGeneratedPositionsFor(e).map(o=>{let i=t.generatedOffset.generatedLine-1,c=t.generatedOffset.generatedColumn-1;return o.line===1&&(o.column+=c,typeof o.lastColumn=="number"&&(o.lastColumn+=c)),o.lastColumn===1/0&&r&&o.line===r.generatedOffset.generatedLine&&(o.lastColumn=r.generatedOffset.generatedColumn-2),o.line+=i,o}):[]}eachMapping(e,n,t){this._sections.forEach((r,o)=>{let i=o+1<this._sections.length?this._sections[o+1]:null,{generatedOffset:c}=r,u=c.generatedLine-1,f=c.generatedColumn-1;r.consumer.eachMapping(function(l){l.generatedLine===1&&(l.generatedColumn+=f,typeof l.lastGeneratedColumn=="number"&&(l.lastGeneratedColumn+=f)),l.lastGeneratedColumn===1/0&&i&&l.generatedLine===i.generatedOffset.generatedLine&&(l.lastGeneratedColumn=i.generatedOffset.generatedColumn-2),l.generatedLine+=u,e.call(this,l)},n,t)})}computeColumnSpans(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.computeColumnSpans()}destroy(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.destroy()}};q.IndexedSourceMapConsumer=G;function Xe(s,e){let n=s;typeof s=="string"&&(n=h.parseSourceMapInput(s));let t=n.sections!=null?new G(n,e):new A(n,e);return Promise.resolve(t)}function Ze(s,e){return A.fromSourceMap(s,e)}});var Le=C(Ee=>{g();var Ye=K().SourceMapGenerator,D=M(),He=/(\r?\n)/,en=10,O="$$$isSourceNode$$$",ne=class s{constructor(e,n,t,r,o){this.children=[],this.sourceContents={},this.line=e??null,this.column=n??null,this.source=t??null,this.name=o??null,this[O]=!0,r!=null&&this.add(r)}static fromStringWithSourceMap(e,n,t){let r=new s,o=e.split(He),i=0,c=function(){let a=N(),w=N()||"";return a+w;function N(){return i<o.length?o[i++]:void 0}},u=1,f=0,l=null,d;return n.eachMapping(function(a){if(l!==null)if(u<a.generatedLine)p(l,c()),u++,f=0;else{d=o[i]||"";let w=d.substr(0,a.generatedColumn-f);o[i]=d.substr(a.generatedColumn-f),f=a.generatedColumn,p(l,w),l=a;return}for(;u<a.generatedLine;)r.add(c()),u++;f<a.generatedColumn&&(d=o[i]||"",r.add(d.substr(0,a.generatedColumn)),o[i]=d.substr(a.generatedColumn),f=a.generatedColumn),l=a},this),i<o.length&&(l&&p(l,c()),r.add(o.splice(i).join(""))),n.sources.forEach(function(a){let w=n.sourceContentFor(a);w!=null&&(t!=null&&(a=D.join(t,a)),r.setSourceContent(a,w))}),r;function p(a,w){if(a===null||a.source===void 0)r.add(w);else{let N=t?D.join(t,a.source):a.source;r.add(new s(a.originalLine,a.originalColumn,N,w,a.name))}}}add(e){if(Array.isArray(e))e.forEach(function(n){this.add(n)},this);else if(e[O]||typeof e=="string")e&&this.children.push(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this}prepend(e){if(Array.isArray(e))for(let n=e.length-1;n>=0;n--)this.prepend(e[n]);else if(e[O]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this}walk(e){let n;for(let t=0,r=this.children.length;t<r;t++)n=this.children[t],n[O]?n.walk(e):n!==""&&e(n,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let n,t,r=this.children.length;if(r>0){for(n=[],t=0;t<r-1;t++)n.push(this.children[t]),n.push(e);n.push(this.children[t]),this.children=n}return this}replaceRight(e,n){let t=this.children[this.children.length-1];return t[O]?t.replaceRight(e,n):typeof t=="string"?this.children[this.children.length-1]=t.replace(e,n):this.children.push("".replace(e,n)),this}setSourceContent(e,n){this.sourceContents[D.toSetString(e)]=n}walkSourceContents(e){for(let t=0,r=this.children.length;t<r;t++)this.children[t][O]&&this.children[t].walkSourceContents(e);let n=Object.keys(this.sourceContents);for(let t=0,r=n.length;t<r;t++)e(D.fromSetString(n[t]),this.sourceContents[n[t]])}toString(){let e="";return this.walk(function(n){e+=n}),e}toStringWithSourceMap(e){let n={code:"",line:1,column:0},t=new Ye(e),r=!1,o=null,i=null,c=null,u=null;return this.walk(function(f,l){n.code+=f,l.source!==null&&l.line!==null&&l.column!==null?((o!==l.source||i!==l.line||c!==l.column||u!==l.name)&&t.addMapping({source:l.source,original:{line:l.line,column:l.column},generated:{line:n.line,column:n.column},name:l.name}),o=l.source,i=l.line,c=l.column,u=l.name,r=!0):r&&(t.addMapping({generated:{line:n.line,column:n.column}}),o=null,r=!1);for(let d=0,p=f.length;d<p;d++)f.charCodeAt(d)===en?(n.line++,n.column=0,d+1===p?(o=null,r=!1):r&&t.addMapping({source:l.source,original:{line:l.line,column:l.column},generated:{line:n.line,column:n.column},name:l.name})):n.column++}),this.walkSourceContents(function(f,l){t.setSourceContent(f,l)}),{code:n.code,map:t}}};Ee.SourceNode=ne});var nn=C(j=>{g();j.SourceMapGenerator=K().SourceMapGenerator;j.SourceMapConsumer=be().SourceMapConsumer;j.SourceNode=Le().SourceNode});export default nn();