You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2 lines
2.8 KiB

var domdiff=function(){"use strict";function g(r,e,n,f,t,o){for(var i=("selectedIndex"in e),a=i;f<t;){var u=r(n[f],1);if(e.insertBefore(u,o),i&&a&&u.selected){a=!a;var c=e.selectedIndex;e.selectedIndex=c<0?f:l.call(e.querySelectorAll("option"),u)}f++}}function p(r,e){return r==e}function k(r){return r}function y(r,e,n,f,t,o,i){var a=o-t;if(a<1)return-1;for(;a<=n-e;){for(var u=e,c=t;u<n&&c<o&&i(r[u],f[c]);)u++,c++;if(c===o)return e;e=u+1}return-1}function A(r,e,n,f,t){return n<f?r(e[n],0):0<n?r(e[n-1],-0).nextSibling:t}function m(r,e,n,f){for(;n<f;)t(r(e[n++],-1))}function w(r,e,n,f,t,o,i,a,u,c,l,v,s){!function(r,e,n,f,t,o,i,a,u){for(var c=[],l=r.length,v=i,s=0;s<l;)switch(r[s++]){case 0:t++,v++;break;case 1:c.push(f[t]),g(e,n,f,t++,t,v<a?e(o[v],0):u);break;case-1:v++}for(s=0;s<l;)switch(r[s++]){case 0:i++;break;case-1:-1<c.indexOf(o[i])?i++:m(e,o,i++,i)}}(function(r,e,n,f,t,o,i){var a,u,c,l,v,s,d,h=n+o,b=[];r:for(a=0;a<=h;a++){if(50<a)return null;for(d=a-1,v=a?b[a-1]:[0,0],s=b[a]=[],u=-a;u<=a;u+=2){for(c=(l=u===-a||u!==a&&v[d+u-1]<v[d+u+1]?v[d+u+1]:v[d+u-1]+1)-u;l<o&&c<n&&i(f[t+l],r[e+c]);)l++,c++;if(l===o&&c===n)break r;s[a+u]=l}}var x=Array(a/2+h/2),g=x.length-1;for(a=b.length-1;0<=a;a--){for(;0<l&&0<c&&i(f[t+l-1],r[e+c-1]);)x[g--]=0,l--,c--;if(!a)break;d=a-1,v=a?b[a-1]:[0,0],(u=l-c)===-a||u!==a&&v[d+u-1]<v[d+u+1]?(c--,x[g--]=1):(l--,x[g--]=-1)}return x}(n,f,o,i,a,c,v)||function(r,e,n,f,t,o,i,a){var u=0,c=f<a?f:a,l=Array(c++),v=Array(c);v[0]=-1;for(var s=1;s<c;s++)v[s]=i;for(var d=t.slice(o,i),h=e;h<n;h++){var b=d.indexOf(r[h]);if(-1<b){var x=b+o;-1<(u=I(v,c,x))&&(v[u]=x,l[u]={newi:h,oldi:x,prev:l[u-1]})}}for(u=--c,--i;v[u]>i;)--u;c=a+f-u;var g=Array(c),p=l[u];for(--n;p;){for(var k=p.newi,y=p.oldi;k<n;)g[--c]=1,--n;for(;y<i;)g[--c]=-1,--i;g[--c]=0,--n,--i,p=p.prev}for(;e<=n;)g[--c]=1,--n;for(;o<=i;)g[--c]=-1,--i;return g}(n,f,t,o,i,a,u,c),r,e,n,f,i,a,l,s)}var l=[].indexOf,I=function(r,e,n){for(var f=1,t=e;f<t;){var o=(f+t)/2>>>0;n<r[o]?t=o:f=1+o}return f},t=function(r){return(r.remove||function(){var r=this.parentNode;r&&r.removeChild(this)}
/*! (c) 2018 Andrea Giammarchi (ISC) */).call(r)};return function(r,e,n,f){for(var t=(f=f||{}).compare||p,o=f.node||k,i=null==f.before?null:o(f.before,0),a=e.length,u=a,c=0,l=n.length,v=0;c<u&&v<l&&t(e[c],n[v]);)c++,v++;for(;c<u&&v<l&&t(e[u-1],n[l-1]);)u--,l--;var s=c===u,d=v===l;if(s&&d)return n;if(s&&v<l)return g(o,r,n,v,l,A(o,e,c,a,i)),n;if(d&&c<u)return m(o,e,c,u),n;var h=u-c,b=l-v,x=-1;if(h<b){if(-1<(x=y(n,v,l,e,c,u,t)))return g(o,r,n,v,x,o(e[c],0)),g(o,r,n,x+h,l,A(o,e,u,a,i)),n}else if(b<h&&-1<(x=y(e,c,u,n,v,l,t)))return m(o,e,c,x),m(o,e,x+b,u),n;return h<2||b<2?(g(o,r,n,v,l,o(e[c],0)),m(o,e,c,u)):h==b&&function(r,e,n,f,t,o){for(;f<t&&o(n[f],r[e-1]);)f++,e--;return 0===e}(n,l,e,c,u,t)?g(o,r,n,v,l,A(o,e,u,a,i)):w(o,r,n,v,l,b,e,c,u,h,a,t,i),n}}();