class ${diff(e,n,t={}){let s;typeof t=="function"?(s=t,t={}):"callback"in t&&(s=t.callback);const o=this.castInput(e,t),i=this.castInput(n,t),f=this.removeEmpty(this.tokenize(o,t)),r=this.removeEmpty(this.tokenize(i,t));return this.diffWithOptionsObj(f,r,t,s)}diffWithOptionsObj(e,n,t,s){var o;const i=c=>{if(c=this.postProcess(c,t),s){setTimeout(function(){s(c)},0);return}else return c},f=n.length,r=e.length;let u=1,a=f+r;t.maxEditLength!=null&&(a=Math.min(a,t.maxEditLength));const g=(o=t.timeout)!==null&&o!==void 0?o:1/0,w=Date.now()+g,h=[{oldPos:-1,lastComponent:void 0}];let d=this.extractCommon(h[0],n,e,0,t);if(h[0].oldPos+1>=r&&d+1>=f)return i(this.buildValues(h[0].lastComponent,n,e));let E=-1/0,L=1/0;const T=()=>{for(let c=Math.max(E,-u);c<=Math.min(L,u);c+=2){let m;const C=h[c-1],P=h[c+1];C&&(h[c-1]=void 0);let S=!1;if(P){const A=P.oldPos-c;S=P&&0<=A&&A<f}const j=C&&C.oldPos+1<r;if(!S&&!j){h[c]=void 0;continue}if(!j||S&&C.oldPos<P.oldPos?m=this.addToPath(P,!0,!1,0,t):m=this.addToPath(C,!1,!0,1,t),d=this.extractCommon(m,n,e,c,t),m.oldPos+1>=r&&d+1>=f)return i(this.buildValues(m.lastComponent,n,e))||!0;h[c]=m,m.oldPos+1>=r&&(L=Math.min(L,c-1)),d+1>=f&&(E=Math.max(E,c+1))}u++};if(s)(function c(){setTimeout(function(){if(u>a||Date.now()>w)return s(void 0);T()||c()},0)})();else for(;u<=a&&Date.now()<=w;){const c=T();if(c)return c}}addToPath(e,n,t,s,o){const i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===t?{oldPos:e.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:t,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:t,previousComponent:i}}}extractCommon(e,n,t,s,o){const i=n.length,f=t.length;let r=e.oldPos,u=r-s,a=0;for(;u+1<i&&r+1<f&&this.equals(t[r+1],n[u+1],o);)u++,r++,a++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return a&&!o.oneChangePerToken&&(e.lastComponent={count:a,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=r,u}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){const s=[];let o;for(;e;)s.push(e),o=e.previousComponent,delete e.previousComponent,e=o;s.reverse();const i=s.length;let f=0,r=0,u=0;for(;f<i;f++){const a=s[f];if(a.removed)a.value=this.join(t.slice(u,u+a.count)),u+=a.count;else{if(!a.added&&this.useLongestToken){let g=n.slice(r,r+a.count);g=g.map(function(w,h){const d=t[u+h];return d.length>w.length?d:w}),a.value=this.join(g)}else a.value=this.join(n.slice(r,r+a.count));r+=a.count,a.added||(u+=a.count)}}return s}}function I(l,e){let n;for(n=0;n<l.length&&n<e.length;n++)if(l[n]!=e[n])return l.slice(0,n);return l.slice(0,n)}function k(l,e){let n;if(!l||!e||l[l.length-1]!=e[e.length-1])return"";for(n=0;n<l.length&&n<e.length;n++)if(l[l.length-(n+1)]!=e[e.length-(n+1)])return l.slice(-n);return l.slice(-n)}function y(l,e,n){if(l.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(l)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);return n+l.slice(e.length)}function D(l,e,n){if(!e)return l+n;if(l.slice(-e.length)!=e)throw Error(`string ${JSON.stringify(l)} doesn't end with suffix ${JSON.stringify(e)}; this is a bug`);return l.slice(0,-e.length)+n}function p(l,e){return y(l,e,"")}function W(l,e){return D(l,e,"")}function z(l,e){return e.slice(0,M(l,e))}function M(l,e){let n=0;l.length>e.length&&(n=l.length-e.length);let t=e.length;l.length<e.length&&(t=l.length);const s=Array(t);let o=0;s[0]=0;for(let i=1;i<t;i++){for(e[i]==e[o]?s[i]=s[o]:s[i]=o;o>0&&e[i]!=e[o];)o=s[o];e[i]==e[o]&&o++}o=0;for(let i=n;i<l.length;i++){for(;o>0&&l[i]!=e[o];)o=s[o];l[i]==e[o]&&o++}return o}function q(l,e){const n=[];for(const t of Array.from(e.segment(l))){const s=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(s)?n[n.length-1]+=s:n.push(s)}return n}function O(l,e){if(e)return x(l,e)[1];let n;for(n=l.length-1;n>=0&&l[n].match(/\s/);n--);return l.substring(n+1)}function v(l,e){if(e)return x(l,e)[0];const n=l.match(/^\s*/);return n?n[0]:""}function x(l,e){if(!e)return[v(l),O(l)];if(e.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=q(l,e),t=n[0],s=n[n.length-1],o=/\s/.test(t)?t:"",i=/\s/.test(s)?s:"";return[o,i]}const F="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",J=new RegExp(`[${F}]+|\\s+|[^${F}]`,"ug");class V extends ${equals(e,n,t){return t.ignoreCase&&(e=e.toLowerCase(),n=n.toLowerCase()),e.trim()===n.trim()}tokenize(e,n={}){let t;if(n.intlSegmenter){const i=n.intlSegmenter;if(i.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');t=q(e,i)}else t=e.match(J)||[];const s=[];let o=null;return t.forEach(i=>{/\s/.test(i)?o==null?s.push(i):s.push(s.pop()+i):o!=null&&/\s/.test(o)?s[s.length-1]==o?s.push(s.pop()+i):s.push(o+i):s.push(i),o=i}),s}join(e){return e.map((n,t)=>t==0?n:n.replace(/^\s+/,"")).join("")}postProcess(e,n){if(!e||n.oneChangePerToken)return e;let t=null,s=null,o=null;return e.forEach(i=>{i.added?s=i:i.removed?o=i:((s||o)&&N(t,o,s,i,n.intlSegmenter),t=i,s=null,o=null)}),(s||o)&&N(t,o,s,null,n.intlSegmenter),e}}const R=new V;function b(l,e,n){return R.diff(l,e,n)}function N(l,e,n,t,s){if(e&&n){const[o,i]=x(e.value,s),[f,r]=x(n.value,s);if(l){const u=I(o,f);l.value=D(l.value,f,u),e.value=p(e.value,u),n.value=p(n.value,u)}if(t){const u=k(i,r);t.value=y(t.value,r,u),e.value=W(e.value,u),n.value=W(n.value,u)}}else if(n){if(l){const o=v(n.value,s);n.value=n.value.substring(o.length)}if(t){const o=v(t.value,s);t.value=t.value.substring(o.length)}}else if(l&&t){const o=v(t.value,s),[i,f]=x(e.value,s),r=I(o,i);e.value=p(e.value,r);const u=k(p(o,r),f);e.value=W(e.value,u),t.value=y(t.value,o,u),l.value=D(l.value,o,o.slice(0,o.length-u.length))}else if(t){const o=v(t.value,s),i=O(e.value,s),f=z(i,o);e.value=W(e.value,f)}else if(l){const o=O(l.value,s),i=v(e.value,s),f=z(o,i);e.value=p(e.value,f)}}class _ extends ${constructor(){super(...arguments),this.tokenize=Z}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
`))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
`))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
`)&&(e=e.slice(0,-1)),n.endsWith(`
`)&&(n=n.slice(0,-1))),super.equals(e,n,t)}}const B=new _;function G(l,e,n){return B.diff(l,e,n)}function Z(l,e){e.stripTrailingCr&&(l=l.replace(/\r\n/g,`
`));const n=[],t=l.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let s=0;s<t.length;s++){const o=t[s];s%2&&!e.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}export{G as a,b as d};