@cyberskill/shared 1.201.0 → 1.201.1

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.
Files changed (49) hide show
  1. package/dist/magic-string.es-D_iPNVbJ.cjs +10 -0
  2. package/dist/magic-string.es-cELbkQ5L.js +901 -0
  3. package/dist/{path.constant-Y6ImOuVK.cjs → path.constant-BT9ilH7U.cjs} +2 -2
  4. package/dist/{path.constant-CFKXX6cG.js → path.constant-C43rx8PK.js} +58 -59
  5. package/dist/src/config/vitest/vitest.unit.cjs +1 -1
  6. package/dist/src/config/vitest/vitest.unit.js +1 -1
  7. package/dist/src/config/vitest/vitest.unit.setup.cjs +1 -1
  8. package/dist/src/config/vitest/vitest.unit.setup.js +1 -1
  9. package/dist/src/node/cli/cli.util.cjs +1 -1
  10. package/dist/src/node/cli/cli.util.js +15 -15
  11. package/dist/src/node/command/command.util.cjs +1 -1
  12. package/dist/src/node/command/command.util.js +1 -1
  13. package/dist/src/node/command/index.cjs +1 -1
  14. package/dist/src/node/command/index.js +1 -1
  15. package/dist/src/node/mongo/mongo.util.cjs +1 -1
  16. package/dist/src/node/mongo/mongo.util.js +1 -1
  17. package/dist/src/node/package/index.cjs +1 -1
  18. package/dist/src/node/package/index.js +1 -1
  19. package/dist/src/node/package/package.util.cjs +1 -1
  20. package/dist/src/node/package/package.util.js +1 -1
  21. package/dist/src/node/path/index.cjs +1 -1
  22. package/dist/src/node/path/index.js +20 -21
  23. package/dist/src/node/path/path.constant.cjs +1 -1
  24. package/dist/src/node/path/path.constant.d.ts +0 -1
  25. package/dist/src/node/path/path.constant.js +25 -26
  26. package/dist/src/node/upload/upload.util.cjs +1 -1
  27. package/dist/src/node/upload/upload.util.js +1 -1
  28. package/dist/src/react/apollo-client/apollo-client.util.cjs +1 -1
  29. package/dist/src/react/apollo-client/apollo-client.util.js +29 -29
  30. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -0
  31. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +3 -0
  32. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.component.js +20 -0
  33. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs +1 -0
  34. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts +6 -0
  35. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js +6 -0
  36. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -0
  37. package/dist/src/react/apollo-client-nextjs/{apollo-client.util.d.ts → apollo-client-nextjs.util.d.ts} +1 -1
  38. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.util.js +24 -0
  39. package/dist/src/react/apollo-client-nextjs/index.cjs +1 -1
  40. package/dist/src/react/apollo-client-nextjs/index.d.ts +2 -2
  41. package/dist/src/react/apollo-client-nextjs/index.js +4 -4
  42. package/package.json +7 -5
  43. package/dist/magic-string.es-CyLHbrL2.js +0 -871
  44. package/dist/magic-string.es-hjygV5wN.cjs +0 -10
  45. package/dist/src/react/apollo-client-nextjs/apollo-client.component.cjs +0 -1
  46. package/dist/src/react/apollo-client-nextjs/apollo-client.component.d.ts +0 -3
  47. package/dist/src/react/apollo-client-nextjs/apollo-client.component.js +0 -33
  48. package/dist/src/react/apollo-client-nextjs/apollo-client.util.cjs +0 -1
  49. package/dist/src/react/apollo-client-nextjs/apollo-client.util.js +0 -31
@@ -0,0 +1,10 @@
1
+ "use strict";var yt=Object.defineProperty,xt=Object.defineProperties;var Et=Object.getOwnPropertyDescriptors;var st=Object.getOwnPropertySymbols;var kt=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable;var ot=(m,t,e)=>t in m?yt(m,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):m[t]=e,ht=(m,t)=>{for(var e in t||(t={}))kt.call(t,e)&&ot(m,e,t[e]);if(st)for(var e of st(t))Lt.call(t,e)&&ot(m,e,t[e]);return m},lt=(m,t)=>xt(m,Et(t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var B={exports:{}},_t=B.exports,ut;function Ot(){return ut||(ut=1,function(m,t){(function(e,n,r,s){n(t,m)})(_t,function(e,n){Object.getOwnPropertyDescriptors||(Object.getOwnPropertyDescriptors=function(h){return Reflect.ownKeys(h).reduce(function(o,i){return Object.defineProperty(o,i,Object.getOwnPropertyDescriptor(h,i)),o},{})});var r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,a=(h,o)=>{for(var i in o)r(h,i,{get:o[i],enumerable:!0})},d=(h,o,i,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of u(o))!c.call(h,f)&&f!==i&&r(h,f,{get:()=>o[f],enumerable:!(l=s(o,f))||l.enumerable});return h},I=h=>d(r({},"__esModule",{value:!0}),h),j={};a(j,{decode:()=>wt,decodeGeneratedRanges:()=>gt,decodeOriginalScopes:()=>ft,encode:()=>Ct,encodeGeneratedRanges:()=>pt,encodeOriginalScopes:()=>dt}),n.exports=I(j);var P=44,W=59,Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Q=new Uint8Array(64),X=new Uint8Array(128);for(let h=0;h<Y.length;h++){const o=Y.charCodeAt(h);Q[h]=o,X[o]=h}function S(h,o){let i=0,l=0,f=0;do{const v=h.next();f=X[v],i|=(f&31)<<l,l+=5}while(f&32);const g=i&1;return i>>>=1,g&&(i=-2147483648|-i),o+i}function w(h,o,i){let l=o-i;l=l<0?-l<<1|1:l<<1;do{let f=l&31;l>>>=5,l>0&&(f|=32),h.write(Q[f])}while(l>0);return o}function R(h,o){return h.pos>=o?!1:h.peek()!==P}var Z=1024*16,V=typeof TextDecoder!="undefined"?new TextDecoder:typeof Buffer!="undefined"?{decode(h){return Buffer.from(h.buffer,h.byteOffset,h.byteLength).toString()}}:{decode(h){let o="";for(let i=0;i<h.length;i++)o+=String.fromCharCode(h[i]);return o}},z=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Z)}write(h){const{buffer:o}=this;o[this.pos++]=h,this.pos===Z&&(this.out+=V.decode(o),this.pos=0)}flush(){const{buffer:h,out:o,pos:i}=this;return i>0?o+V.decode(h.subarray(0,i)):o}},F=class{constructor(h){this.pos=0,this.buffer=h}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(h){const{buffer:o,pos:i}=this,l=o.indexOf(h,i);return l===-1?o.length:l}},tt=[];function ft(h){const{length:o}=h,i=new F(h),l=[],f=[];let g=0;for(;i.pos<o;i.pos++){g=S(i,g);const v=S(i,0);if(!R(i,o)){const k=f.pop();k[2]=g,k[3]=v;continue}const b=S(i,0),C=S(i,0)&1?[g,v,0,0,b,S(i,0)]:[g,v,0,0,b];let E=tt;if(R(i,o)){E=[];do{const k=S(i,0);E.push(k)}while(R(i,o))}C.vars=E,l.push(C),f.push(C)}return l}function dt(h){const o=new z;for(let i=0;i<h.length;)i=et(h,i,o,[0]);return o.flush()}function et(h,o,i,l){const f=h[o],{0:g,1:v,2:b,3:x,4:y,vars:C}=f;o>0&&i.write(P),l[0]=w(i,g,l[0]),w(i,v,0),w(i,y,0);const E=f.length===6?1:0;w(i,E,0),f.length===6&&w(i,f[5],0);for(const k of C)w(i,k,0);for(o++;o<h.length;){const k=h[o],{0:p,1:L}=k;if(p>b||p===b&&L>=x)break;o=et(h,o,i,l)}return i.write(P),l[0]=w(i,b,l[0]),w(i,x,0),o}function gt(h){const{length:o}=h,i=new F(h),l=[],f=[];let g=0,v=0,b=0,x=0,y=0,C=0,E=0,k=0;do{const p=i.indexOf(";");let L=0;for(;i.pos<p;i.pos++){if(L=S(i,L),!R(i,p)){const _=f.pop();_[2]=g,_[3]=L;continue}const O=S(i,0),q=O&1,$=O&2,M=O&4;let rt=null,H=tt,N;if(q){const _=S(i,v);b=S(i,v===_?b:0),v=_,N=[g,L,0,0,_,b]}else N=[g,L,0,0];if(N.isScope=!!M,$){const _=x,A=y;x=S(i,x);const U=_===x;y=S(i,U?y:0),C=S(i,U&&A===y?C:0),rt=[x,y,C]}if(N.callsite=rt,R(i,p)){H=[];do{E=g,k=L;const _=S(i,0);let A;if(_<-1){A=[[S(i,0)]];for(let U=-1;U>_;U--){const St=E;E=S(i,E),k=S(i,E===St?k:0);const vt=S(i,0);A.push([vt,E,k])}}else A=[[_]];H.push(A)}while(R(i,p))}N.bindings=H,l.push(N),f.push(N)}g++,i.pos=p+1}while(i.pos<o);return l}function pt(h){if(h.length===0)return"";const o=new z;for(let i=0;i<h.length;)i=nt(h,i,o,[0,0,0,0,0,0,0]);return o.flush()}function nt(h,o,i,l){const f=h[o],{0:g,1:v,2:b,3:x,isScope:y,callsite:C,bindings:E}=f;l[0]<g?(it(i,l[0],g),l[0]=g,l[1]=0):o>0&&i.write(P),l[1]=w(i,f[1],l[1]);const k=(f.length===6?1:0)|(C?2:0)|(y?4:0);if(w(i,k,0),f.length===6){const{4:p,5:L}=f;p!==l[2]&&(l[3]=0),l[2]=w(i,p,l[2]),l[3]=w(i,L,l[3])}if(C){const{0:p,1:L,2:O}=f.callsite;p!==l[4]?(l[5]=0,l[6]=0):L!==l[5]&&(l[6]=0),l[4]=w(i,p,l[4]),l[5]=w(i,L,l[5]),l[6]=w(i,O,l[6])}if(E)for(const p of E){p.length>1&&w(i,-p.length,0);const L=p[0][0];w(i,L,0);let O=g,q=v;for(let $=1;$<p.length;$++){const M=p[$];O=w(i,M[1],O),q=w(i,M[2],q),w(i,M[0],0)}}for(o++;o<h.length;){const p=h[o],{0:L,1:O}=p;if(L>b||L===b&&O>=x)break;o=nt(h,o,i,l)}return l[0]<b?(it(i,l[0],b),l[0]=b,l[1]=0):i.write(P),l[1]=w(i,x,l[1]),o}function it(h,o,i){do h.write(W);while(++o<i)}function wt(h){const{length:o}=h,i=new F(h),l=[];let f=0,g=0,v=0,b=0,x=0;do{const y=i.indexOf(";"),C=[];let E=!0,k=0;for(f=0;i.pos<y;){let p;f=S(i,f),f<k&&(E=!1),k=f,R(i,y)?(g=S(i,g),v=S(i,v),b=S(i,b),R(i,y)?(x=S(i,x),p=[f,g,v,b,x]):p=[f,g,v,b]):p=[f],C.push(p),i.pos++}E||mt(C),l.push(C),i.pos=y+1}while(i.pos<=o);return l}function mt(h){h.sort(bt)}function bt(h,o){return h[0]-o[0]}function Ct(h){const o=new z;let i=0,l=0,f=0,g=0;for(let v=0;v<h.length;v++){const b=h[v];if(v>0&&o.write(W),b.length===0)continue;let x=0;for(let y=0;y<b.length;y++){const C=b[y];y>0&&o.write(P),x=w(o,C[0],x),C.length!==1&&(i=w(o,C[1],i),l=w(o,C[2],l),f=w(o,C[3],f),C.length!==4&&(g=w(o,C[4],g)))}}return o.flush()}})}(B,B.exports)),B.exports}var Rt=Ot();class J{constructor(t){this.bits=t instanceof J?t.bits.slice():[]}add(t){this.bits[t>>5]|=1<<(t&31)}has(t){return!!(this.bits[t>>5]&1<<(t&31))}}class G{constructor(t,e,n){this.start=t,this.end=e,this.original=n,this.intro="",this.outro="",this.content=n,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(t){this.outro+=t}appendRight(t){this.intro=this.intro+t}clone(){const t=new G(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t}contains(t){return this.start<t&&t<this.end}eachNext(t){let e=this;for(;e;)t(e),e=e.next}eachPrevious(t){let e=this;for(;e;)t(e),e=e.previous}edit(t,e,n){return this.content=t,n||(this.intro="",this.outro=""),this.storeName=e,this.edited=!0,this}prependLeft(t){this.outro=t+this.outro}prependRight(t){this.intro=t+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(t){const e=t-this.start,n=this.original.slice(0,e),r=this.original.slice(e);this.original=n;const s=new G(t,this.end,r);return s.outro=this.outro,this.outro="",this.end=t,this.edited?(s.edit("",!1),this.content=""):this.content=n,s.next=this.next,s.next&&(s.next.previous=s),s.previous=this,this.next=s,s}toString(){return this.intro+this.content+this.outro}trimEnd(t){if(this.outro=this.outro.replace(t,""),this.outro.length)return!0;const e=this.content.replace(t,"");if(e.length)return e!==this.content&&(this.split(this.start+e.length).edit("",void 0,!0),this.edited&&this.edit(e,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(t,""),this.intro.length)return!0}trimStart(t){if(this.intro=this.intro.replace(t,""),this.intro.length)return!0;const e=this.content.replace(t,"");if(e.length){if(e!==this.content){const n=this.split(this.end-e.length);this.edited&&n.edit(e,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(t,""),this.outro.length)return!0}}function It(){return typeof globalThis!="undefined"&&typeof globalThis.btoa=="function"?m=>globalThis.btoa(unescape(encodeURIComponent(m))):typeof Buffer=="function"?m=>Buffer.from(m,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}const Nt=It();class ct{constructor(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=Rt.encode(t.mappings),typeof t.x_google_ignoreList!="undefined"&&(this.x_google_ignoreList=t.x_google_ignoreList),typeof t.debugId!="undefined"&&(this.debugId=t.debugId)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+Nt(this.toString())}}function jt(m){const t=m.split(`
2
+ `),e=t.filter(s=>/^\t+/.test(s)),n=t.filter(s=>/^ {2,}/.test(s));if(e.length===0&&n.length===0)return null;if(e.length>=n.length)return" ";const r=n.reduce((s,u)=>{const c=/^ +/.exec(u)[0].length;return Math.min(c,s)},1/0);return new Array(r+1).join(" ")}function Pt(m,t){const e=m.split(/[/\\]/),n=t.split(/[/\\]/);for(e.pop();e[0]===n[0];)e.shift(),n.shift();if(e.length){let r=e.length;for(;r--;)e[r]=".."}return e.concat(n).join("/")}const At=Object.prototype.toString;function Tt(m){return At.call(m)==="[object Object]"}function at(m){const t=m.split(`
3
+ `),e=[];for(let n=0,r=0;n<t.length;n++)e.push(r),r+=t[n].length+1;return function(r){let s=0,u=e.length;for(;s<u;){const d=s+u>>1;r<e[d]?u=d:s=d+1}const c=s-1,a=r-e[c];return{line:c,column:a}}}const $t=/\w/;class Mt{constructor(t){this.hires=t,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(t,e,n,r){if(e.length){const s=e.length-1;let u=e.indexOf(`
4
+ `,0),c=-1;for(;u>=0&&s>u;){const d=[this.generatedCodeColumn,t,n.line,n.column];r>=0&&d.push(r),this.rawSegments.push(d),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,c=u,u=e.indexOf(`
5
+ `,u+1)}const a=[this.generatedCodeColumn,t,n.line,n.column];r>=0&&a.push(r),this.rawSegments.push(a),this.advance(e.slice(c+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(e));this.pending=null}addUneditedChunk(t,e,n,r,s){let u=e.start,c=!0,a=!1;for(;u<e.end;){if(n[u]===`
6
+ `)r.line+=1,r.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,c=!0,a=!1;else{if(this.hires||c||s.has(u)){const d=[this.generatedCodeColumn,t,r.line,r.column];this.hires==="boundary"?$t.test(n[u])?a||(this.rawSegments.push(d),a=!0):(this.rawSegments.push(d),a=!1):this.rawSegments.push(d)}r.column+=1,this.generatedCodeColumn+=1,c=!1}u+=1}this.pending=null}advance(t){if(!t)return;const e=t.split(`
7
+ `);if(e.length>1){for(let n=0;n<e.length-1;n++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=e[e.length-1].length}}const D=`
8
+ `,T={insertLeft:!1,insertRight:!1,storeName:!1};class K{constructor(t,e={}){const n=new G(0,t.length,t);Object.defineProperties(this,{original:{writable:!0,value:t},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:n},lastChunk:{writable:!0,value:n},lastSearchedChunk:{writable:!0,value:n},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:e.filename},indentExclusionRanges:{writable:!0,value:e.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new J},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:e.ignoreList},offset:{writable:!0,value:e.offset||0}}),this.byStart[0]=n,this.byEnd[t.length]=n}addSourcemapLocation(t){this.sourcemapLocations.add(t)}append(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.outro+=t,this}appendLeft(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byEnd[t];return n?n.appendLeft(e):this.intro+=e,this}appendRight(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byStart[t];return n?n.appendRight(e):this.outro+=e,this}clone(){const t=new K(this.original,{filename:this.filename,offset:this.offset});let e=this.firstChunk,n=t.firstChunk=t.lastSearchedChunk=e.clone();for(;e;){t.byStart[n.start]=n,t.byEnd[n.end]=n;const r=e.next,s=r&&r.clone();s&&(n.next=s,s.previous=n,n=s),e=r}return t.lastChunk=n,this.indentExclusionRanges&&(t.indentExclusionRanges=this.indentExclusionRanges.slice()),t.sourcemapLocations=new J(this.sourcemapLocations),t.intro=this.intro,t.outro=this.outro,t}generateDecodedMap(t){t=t||{};const e=0,n=Object.keys(this.storedNames),r=new Mt(t.hires),s=at(this.original);return this.intro&&r.advance(this.intro),this.firstChunk.eachNext(u=>{const c=s(u.start);u.intro.length&&r.advance(u.intro),u.edited?r.addEdit(e,u.content,c,u.storeName?n.indexOf(u.original):-1):r.addUneditedChunk(e,u,this.original,c,this.sourcemapLocations),u.outro.length&&r.advance(u.outro)}),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:[t.source?Pt(t.file||"",t.source):t.file||""],sourcesContent:t.includeContent?[this.original]:void 0,names:n,mappings:r.raw,x_google_ignoreList:this.ignoreList?[e]:void 0}}generateMap(t){return new ct(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=jt(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(t,e){const n=/^[^\r\n]/gm;if(Tt(t)&&(e=t,t=void 0),t===void 0&&(this._ensureindentStr(),t=this.indentStr||" "),t==="")return this;e=e||{};const r={};e.exclude&&(typeof e.exclude[0]=="number"?[e.exclude]:e.exclude).forEach(I=>{for(let j=I[0];j<I[1];j+=1)r[j]=!0});let s=e.indentStart!==!1;const u=d=>s?`${t}${d}`:(s=!0,d);this.intro=this.intro.replace(n,u);let c=0,a=this.firstChunk;for(;a;){const d=a.end;if(a.edited)r[c]||(a.content=a.content.replace(n,u),a.content.length&&(s=a.content[a.content.length-1]===`
9
+ `));else for(c=a.start;c<d;){if(!r[c]){const I=this.original[c];I===`
10
+ `?s=!0:I!=="\r"&&s&&(s=!1,c===a.start||(this._splitChunk(a,c),a=a.next),a.prependRight(t))}c+=1}c=a.end,a=a.next}return this.outro=this.outro.replace(n,u),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,e){return T.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),T.insertLeft=!0),this.appendLeft(t,e)}insertRight(t,e){return T.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),T.insertRight=!0),this.prependRight(t,e)}move(t,e,n){if(t=t+this.offset,e=e+this.offset,n=n+this.offset,n>=t&&n<=e)throw new Error("Cannot move a selection inside itself");this._split(t),this._split(e),this._split(n);const r=this.byStart[t],s=this.byEnd[e],u=r.previous,c=s.next,a=this.byStart[n];if(!a&&s===this.lastChunk)return this;const d=a?a.previous:this.lastChunk;return u&&(u.next=c),c&&(c.previous=u),d&&(d.next=r),a&&(a.previous=s),r.previous||(this.firstChunk=s.next),s.next||(this.lastChunk=r.previous,this.lastChunk.next=null),r.previous=d,s.next=a||null,d||(this.firstChunk=r),a||(this.lastChunk=s),this}overwrite(t,e,n,r){return r=r||{},this.update(t,e,n,lt(ht({},r),{overwrite:!r.contentOnly}))}update(t,e,n,r){if(t=t+this.offset,e=e+this.offset,typeof n!="string")throw new TypeError("replacement content must be a string");if(this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(e>this.original.length)throw new Error("end is out of bounds");if(t===e)throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");this._split(t),this._split(e),r===!0&&(T.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),T.storeName=!0),r={storeName:!0});const s=r!==void 0?r.storeName:!1,u=r!==void 0?r.overwrite:!1;if(s){const d=this.original.slice(t,e);Object.defineProperty(this.storedNames,d,{writable:!0,value:!0,enumerable:!0})}const c=this.byStart[t],a=this.byEnd[e];if(c){let d=c;for(;d!==a;){if(d.next!==this.byStart[d.end])throw new Error("Cannot overwrite across a split point");d=d.next,d.edit("",!1)}c.edit(n,s,!u)}else{const d=new G(t,e,"").edit(n,s);a.next=d,d.previous=a}return this}prepend(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.intro=t+this.intro,this}prependLeft(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byEnd[t];return n?n.prependLeft(e):this.intro=e+this.intro,this}prependRight(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byStart[t];return n?n.prependRight(e):this.outro=e+this.outro,this}remove(t,e){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t),this._split(e);let n=this.byStart[t];for(;n;)n.intro="",n.outro="",n.edit(""),n=e>n.end?this.byStart[n.end]:null;return this}reset(t,e){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t),this._split(e);let n=this.byStart[t];for(;n;)n.reset(),n=e>n.end?this.byStart[n.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let t=this.lastChunk;do{if(t.outro.length)return t.outro[t.outro.length-1];if(t.content.length)return t.content[t.content.length-1];if(t.intro.length)return t.intro[t.intro.length-1]}while(t=t.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let t=this.outro.lastIndexOf(D);if(t!==-1)return this.outro.substr(t+1);let e=this.outro,n=this.lastChunk;do{if(n.outro.length>0){if(t=n.outro.lastIndexOf(D),t!==-1)return n.outro.substr(t+1)+e;e=n.outro+e}if(n.content.length>0){if(t=n.content.lastIndexOf(D),t!==-1)return n.content.substr(t+1)+e;e=n.content+e}if(n.intro.length>0){if(t=n.intro.lastIndexOf(D),t!==-1)return n.intro.substr(t+1)+e;e=n.intro+e}}while(n=n.previous);return t=this.intro.lastIndexOf(D),t!==-1?this.intro.substr(t+1)+e:this.intro+e}slice(t=0,e=this.original.length-this.offset){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}let n="",r=this.firstChunk;for(;r&&(r.start>t||r.end<=t);){if(r.start<e&&r.end>=e)return n;r=r.next}if(r&&r.edited&&r.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);const s=r;for(;r;){r.intro&&(s!==r||r.start===t)&&(n+=r.intro);const u=r.start<e&&r.end>=e;if(u&&r.edited&&r.end!==e)throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);const c=s===r?t-r.start:0,a=u?r.content.length+e-r.end:r.content.length;if(n+=r.content.slice(c,a),r.outro&&(!u||r.end===e)&&(n+=r.outro),u)break;r=r.next}return n}snip(t,e){const n=this.clone();return n.remove(0,t),n.remove(e,n.original.length),n}_split(t){if(this.byStart[t]||this.byEnd[t])return;let e=this.lastSearchedChunk;const n=t>e.end;for(;e;){if(e.contains(t))return this._splitChunk(e,t);e=n?this.byStart[e.end]:this.byEnd[e.start]}}_splitChunk(t,e){if(t.edited&&t.content.length){const r=at(this.original)(e);throw new Error(`Cannot split a chunk that has already been edited (${r.line}:${r.column} – "${t.original}")`)}const n=t.split(e);return this.byEnd[e]=t,this.byStart[e]=n,this.byEnd[n.end]=n,t===this.lastChunk&&(this.lastChunk=n),this.lastSearchedChunk=t,!0}toString(){let t=this.intro,e=this.firstChunk;for(;e;)t+=e.toString(),e=e.next;return t+this.outro}isEmpty(){let t=this.firstChunk;do if(t.intro.length&&t.intro.trim()||t.content.length&&t.content.trim()||t.outro.length&&t.outro.trim())return!1;while(t=t.next);return!0}length(){let t=this.firstChunk,e=0;do e+=t.intro.length+t.content.length+t.outro.length;while(t=t.next);return e}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){const e=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(e,""),this.outro.length)return!0;let n=this.lastChunk;do{const r=n.end,s=n.trimEnd(e);if(n.end!==r&&(this.lastChunk===n&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),s)return!0;n=n.previous}while(n);return!1}trimEnd(t){return this.trimEndAborted(t),this}trimStartAborted(t){const e=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(e,""),this.intro.length)return!0;let n=this.firstChunk;do{const r=n.end,s=n.trimStart(e);if(n.end!==r&&(n===this.lastChunk&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),s)return!0;n=n.next}while(n);return!1}trimStart(t){return this.trimStartAborted(t),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,e){function n(s,u){return typeof e=="string"?e.replace(/\$(\$|&|\d+)/g,(c,a)=>a==="$"?"$":a==="&"?s[0]:+a<s.length?s[+a]:`$${a}`):e(...s,s.index,u,s.groups)}function r(s,u){let c;const a=[];for(;c=s.exec(u);)a.push(c);return a}if(t.global)r(t,this.original).forEach(u=>{if(u.index!=null){const c=n(u,this.original);c!==u[0]&&this.overwrite(u.index,u.index+u[0].length,c)}});else{const s=this.original.match(t);if(s&&s.index!=null){const u=n(s,this.original);u!==s[0]&&this.overwrite(s.index,s.index+s[0].length,u)}}return this}_replaceString(t,e){const{original:n}=this,r=n.indexOf(t);return r!==-1&&this.overwrite(r,r+t.length,e),this}replace(t,e){return typeof t=="string"?this._replaceString(t,e):this._replaceRegexp(t,e)}_replaceAllString(t,e){const{original:n}=this,r=t.length;for(let s=n.indexOf(t);s!==-1;s=n.indexOf(t,s+r))n.slice(s,s+r)!==e&&this.overwrite(s,s+r,e);return this}replaceAll(t,e){if(typeof t=="string")return this._replaceAllString(t,e);if(!t.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(t,e)}}exports.SourceMap=ct;exports.default=K;