import{_ as H}from"./ncode-block.vue-bvtirmea.js";import{bh as P}from"./er2hcepb.js";import{k as U,l as X,b as Y,x as j,Q as W,M as S}from"./vendor/json-editor-vue-gv8v06ez.js";function g(){}g.prototype={diff:function(e,r){var t,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=u.callback;typeof u=="function"&&(o=u,u={});var i=this;function f(v){return v=i.postProcess(v,u),o?(setTimeout(function(){o(v)},0),!0):v}e=this.castInput(e,u),r=this.castInput(r,u),e=this.removeEmpty(this.tokenize(e,u)),r=this.removeEmpty(this.tokenize(r,u));var l=r.length,s=e.length,a=1,c=l+s;u.maxEditLength!=null&&(c=Math.min(c,u.maxEditLength));var p=(t=u.timeout)!==null&&t!==void 0?t:1/0,d=Date.now()+p,m=[{oldPos:-1,lastComponent:void 0}],h=this.extractCommon(m[0],r,e,0,u);if(m[0].oldPos+1>=s&&h+1>=l)return f(F(i,m[0].lastComponent,r,e,i.useLongestToken));var y=-1/0,T=1/0;function x(){for(var v=Math.max(y,-a);v<=Math.min(T,a);v+=2){var C=void 0,w=m[v-1],E=m[v+1];w&&(m[v-1]=void 0);var _=!1;if(E){var M=E.oldPos-v;_=E&&0<=M&&M=s&&h+1>=l)return f(F(i,C.lastComponent,r,e,i.useLongestToken));m[v]=C,C.oldPos+1>=s&&(T=Math.min(T,v-1)),h+1>=l&&(y=Math.max(y,v+1))}a++}if(o)(function v(){setTimeout(function(){if(a>c||Date.now()>d)return o();x()||v()},0)})();else for(;a<=c&&Date.now()<=d;){var z=x();if(z)return z}},addToPath:function(e,r,t,u,o){var i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===r&&i.removed===t?{oldPos:e.oldPos+u,lastComponent:{count:i.count+1,added:r,removed:t,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+u,lastComponent:{count:1,added:r,removed:t,previousComponent:i}}},extractCommon:function(e,r,t,u,o){for(var i=r.length,f=t.length,l=e.oldPos,s=l-u,a=0;s+1d.length?h:d}),c.value=n.join(p)}else c.value=n.join(r.slice(s,s+c.count));s+=c.count,c.added||(a+=c.count)}}return o}function V(n,e){var r;for(r=0;re.length&&(r=n.length-e.length);var t=e.length;n.length0&&e[i]!=e[o];)o=u[o];e[i]==e[o]&&o++}o=0;for(var f=r;f0&&n[f]!=e[o];)o=u[o];n[f]==e[o]&&o++}return o}var O="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",K=new RegExp("[".concat(O,"]+|\\s+|[^").concat(O,"]"),"ug"),k=new g;k.equals=function(n,e,r){return r.ignoreCase&&(n=n.toLowerCase(),e=e.toLowerCase()),n.trim()===e.trim()};k.tokenize=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(e.intlSegmenter){if(e.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(e.intlSegmenter.segment(n),function(o){return o.segment})}else r=n.match(K)||[];var t=[],u=null;return r.forEach(function(o){/\s/.test(o)?u==null?t.push(o):t.push(t.pop()+o):/\s/.test(u)?t[t.length-1]==u?t.push(t.pop()+o):t.push(u+o):t.push(o),u=o}),t};k.join=function(n){return n.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};k.postProcess=function(n,e){if(!n||e.oneChangePerToken)return n;var r=null,t=null,u=null;return n.forEach(function(o){o.added?t=o:o.removed?u=o:((t||u)&&G(r,u,t,o),r=o,t=null,u=null)}),(t||u)&&G(r,u,t,null),n};function G(n,e,r,t){if(e&&r){var u=e.value.match(/^\s*/)[0],o=e.value.match(/\s*$/)[0],i=r.value.match(/^\s*/)[0],f=r.value.match(/\s*$/)[0];if(n){var l=V(u,i);n.value=N(n.value,i,l),e.value=L(e.value,l),r.value=L(r.value,l)}if(t){var s=Q(o,f);t.value=q(t.value,f,s),e.value=I(e.value,s),r.value=I(r.value,s)}}else if(r)n&&(r.value=r.value.replace(/^\s*/,"")),t&&(t.value=t.value.replace(/^\s*/,""));else if(n&&t){var a=t.value.match(/^\s*/)[0],c=e.value.match(/^\s*/)[0],p=e.value.match(/\s*$/)[0],d=V(a,c);e.value=L(e.value,d);var m=Q(L(a,d),p);e.value=I(e.value,m),t.value=q(t.value,a,m),n.value=N(n.value,a,a.slice(0,a.length-m.length))}else if(t){var h=t.value.match(/^\s*/)[0],y=e.value.match(/\s*$/)[0],T=Z(y,h);e.value=I(e.value,T)}else if(n){var x=n.value.match(/\s*$/)[0],z=e.value.match(/^\s*/)[0],v=Z(x,z);e.value=L(e.value,v)}}var ee=new g;ee.tokenize=function(n){var e=new RegExp("(\\r?\\n)|[".concat(O,"]+|[^\\S\\n\\r]+|[^").concat(O,"]"),"ug");return n.match(e)||[]};var $=new g;$.tokenize=function(n,e){e.stripTrailingCr&&(n=n.replace(/\r\n/g,` `));var r=[],t=n.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(var u=0;u"u"?r:i}:t;return typeof n=="string"?n:JSON.stringify(A(n,null,null,u),u," ")};D.equals=function(n,e,r){return g.prototype.equals.call(D,n.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function A(n,e,r,t,u){e=e||[],r=r||[],t&&(n=t(u,n));var o;for(o=0;or(e.from,e.to));function u(f){let l=0;return f.replace(/class="shiki/,'class="shiki diff').replace(/class="line"/g,s=>(l++,t.value.added.includes(l-1)?'class="line line-added"':t.value.removed.includes(l-1)?'class="line line-removed"':s))}const o=Y();j(i);function i(){const f=P(o);f&&f.querySelector(".line-added,.line-removed")?.scrollIntoView()}return(f,l)=>{const s=H;return W(),S(s,{ref_key:"elRef",ref:o,code:t.value.result,lang:f.lang,"transform-rendered":u,onLoaded:i},null,8,["code","lang"])}}});export{le as _};