(t, e, n, i)
| 410 | ); |
| 411 | } |
| 412 | overwrite(t, e, n, i) { |
| 413 | if (typeof n != 'string') throw new TypeError('replacement content must be a string'); |
| 414 | for (; t < 0; ) t += this.original.length; |
| 415 | for (; e < 0; ) e += this.original.length; |
| 416 | if (e > this.original.length) throw new Error('end is out of bounds'); |
| 417 | if (t === e) |
| 418 | throw new Error( |
| 419 | 'Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead', |
| 420 | ); |
| 421 | (this._split(t), |
| 422 | this._split(e), |
| 423 | i === !0 && |
| 424 | (c.storeName || |
| 425 | (console.warn( |
| 426 | 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string', |
| 427 | ), |
| 428 | (c.storeName = !0)), |
| 429 | (i = { storeName: !0 }))); |
| 430 | const r = i !== void 0 ? i.storeName : !1, |
| 431 | s = i !== void 0 ? i.contentOnly : !1; |
| 432 | if (r) { |
| 433 | const a = this.original.slice(t, e); |
| 434 | Object.defineProperty(this.storedNames, a, { writable: !0, value: !0, enumerable: !0 }); |
| 435 | } |
| 436 | const h = this.byStart[t], |
| 437 | o = this.byEnd[e]; |
| 438 | if (h) { |
| 439 | let a = h; |
| 440 | for (; a !== o; ) { |
| 441 | if (a.next !== this.byStart[a.end]) |
| 442 | throw new Error('Cannot overwrite across a split point'); |
| 443 | ((a = a.next), a.edit('', !1)); |
| 444 | } |
| 445 | h.edit(n, r, s); |
| 446 | } else { |
| 447 | const a = new g(t, e, '').edit(n, r); |
| 448 | ((o.next = a), (a.previous = o)); |
| 449 | } |
| 450 | return this; |
| 451 | } |
| 452 | prepend(t) { |
| 453 | if (typeof t != 'string') throw new TypeError('outro content must be a string'); |
| 454 | return ((this.intro = t + this.intro), this); |
no test coverage detected