window.RangeArrayUtils={complementary:function(e,t,n){if(!e)return e;var r=this.getRangeObject(e);if(!t||t.length==0)return this.parse([r],n);var s=this.union(t);var a={};if(s[0][0]>r.start){a.start=r.start}else if(r.end>s[0][1]){a.start=s[0][1];s.shift()}else{return[]}var i=[];while(s.length>0){if(s[0][0]>=r.end){a.end=r.end;i.push(Object.clone(a));return this.parse(i,n)}else if(r.end<=s[0][1]){a.end=s[0][0];i.push(Object.clone(a));return this.parse(i,n)}else{a.end=s[0][0];i.push(Object.clone(a));a.start=s[0][1];s.shift()}}a.end=r.end;i.push(Object.clone(a));return this.parse(i,n)},union:function(e,t){if(!e||e.length==0)return e;var n=Array.clone(e);for(var r=0;r0){var i=n.shift();if(this.isIntersection(a,i)){a.end=Math.max(a.end,i.end)}else{s.push(Object.clone(a));a=i}}if(!i){s.push(Object.clone(a))}else if(this.isIntersection(a,i)){a.end=Math.max(a.end,i.end);s.push(Object.clone(a))}else{s.push(Object.clone(i))}return this.parse(s,t)},isIntersection:function(e,t){var n=typeOf(e=="array")?e:this.getRangeObject(e);var r=typeOf(t=="array")?t:this.getRangeObject(t);if(n.start>r.end)return false;if(r.start>n.end)return false;return true},parse:function(e,t){var n=[];for(var r=0;r