UNPKG

@anoki/fse-ui

Version:

FSE UI components library

3 lines (2 loc) 2.44 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index.cjs705.js");var u,m;function y(){if(m)return u;m=1;let{existsSync:p,readFileSync:d}=s,{dirname:r,join:g}=s,{SourceMapConsumer:l,SourceMapGenerator:f}=s;function M(a){return Buffer?Buffer.from(a,"base64").toString():window.atob(a)}class o{constructor(t,e){if(e.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let i=e.map?e.map.prev:void 0,n=this.loadMap(e.from,i);!this.mapFile&&e.from&&(this.mapFile=e.from),this.mapFile&&(this.root=r(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new l(this.text)),this.consumerCache}decodeInline(t){let e=/^data:application\/json;charset=utf-?8;base64,/,i=/^data:application\/json;base64,/,n=/^data:application\/json;charset=utf-?8,/,b=/^data:application\/json,/,c=t.match(n)||t.match(b);if(c)return decodeURIComponent(t.substr(c[0].length));let h=t.match(e)||t.match(i);if(h)return M(t.substr(h[0].length));let S=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+S)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let e=t.match(/\/\*\s*# sourceMappingURL=/g);if(!e)return;let i=t.lastIndexOf(e.pop()),n=t.indexOf("*/",i);i>-1&&n>-1&&(this.annotation=this.getAnnotationURL(t.substring(i,n)))}loadFile(t){if(this.root=r(t),p(t))return this.mapFile=t,d(t,"utf-8").toString().trim()}loadMap(t,e){if(e===!1)return!1;if(e){if(typeof e=="string")return e;if(typeof e=="function"){let i=e(t);if(i){let n=this.loadFile(i);if(!n)throw new Error("Unable to load previous source map: "+i.toString());return n}}else{if(e instanceof l)return f.fromSourceMap(e).toString();if(e instanceof f)return e.toString();if(this.isMap(e))return JSON.stringify(e);throw new Error("Unsupported previous source map format: "+e.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let i=this.annotation;return t&&(i=g(r(t),i)),this.loadFile(i)}}}startWith(t,e){return t?t.substr(0,e.length)===e:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return u=o,o.default=o,u}exports.__require=y; //# sourceMappingURL=index.cjs706.js.map