=o}),this.layoutUp(n),this.layoutDown(i));break;case"right":this.layoutRight(this.center.children);break;case"left":this.layoutLeft(this.center.children);break;case"up":case"bottom":this.layoutUp(this.center.children);break;case"down":case"top":this.layoutDown(this.center.children);break;case"tipover":case"tipovertree":if(0>this.options.tipOverTreeStartLevel)throw"The tip-over level should be a positive integer.";this.tipOverTree(this.center.children,this.options.tipOverTreeStartLevel);break;case"undefined":case"none":}}}),k=_.extend({init:function(t){var e=this;if(_.fn.init.call(e),f.isUndefined(t))throw"No diagram specified.";this.diagram=t},layout:function(t){var e,n;return this.transferOptions(t),e=new w(this.diagram),this.graph=e.convert(),n=this.layoutComponents(),new i.LayoutState(this.diagram,n)},layoutComponents:function(){var t,e,n,i,o,r,s,a;if(!this.graph.isEmpty()&&(t=this.graph.getConnectedComponents(),!f.isEmpty(t))){for(e=new b(this.options),n=[],i=0;t.length>i;i++){if(o=t[i],r=this.getTree(o),!r)throw"Failed to find a spanning tree for the component.";s=r.root,a=r.tree,e.layout(a,s),n.push(a)}return this.gridLayoutComponents(n)}},getTree:function(t){var e,n,i,o,r,s=null;if(this.options.roots&&this.options.roots.length>0)for(e=0,n=t.nodes.length;n>e;e++)for(i=t.nodes[e],o=0;this.options.roots.length>o;o++)if(r=this.options.roots[o],r===i.associatedShape){s=i;break}if(!s&&(s=t.root(),!s))throw"Unable to find a root for the tree.";return this.getTreeForRoot(t,s)},getTreeForRoot:function(t,e){var n=t.getSpanningTree(e);return f.isUndefined(n)||n.isEmpty()?null:{tree:n,root:n.root}}}),C=_.extend({init:function(t){var e=this;if(_.fn.init.call(e),f.isUndefined(t))throw"Diagram is not specified.";this.diagram=t},layout:function(t){var e,n,o,r,s,a;if(this.transferOptions(t),e=new w(this.diagram),n=e.convert(t),!n.isEmpty()&&(o=n.getConnectedComponents(),!f.isEmpty(o))){for(r=0;o.length>r;r++)s=o[r],this.layoutGraph(s,t);return a=this.gridLayoutComponents(o),new i.LayoutState(this.diagram,a)}},_initRuntimeProperties:function(){var t,e;for(t=0;this.graph.nodes.length>t;t++)e=this.graph.nodes[t],e.layer=-1,e.downstreamLinkCount=0,e.upstreamLinkCount=0,e.isVirtual=!1,e.uBaryCenter=0,e.dBaryCenter=0,e.upstreamPriority=0,e.downstreamPriority=0,e.gridPosition=0},_prepare:function(t){var e,n,i,o,r,s,a,l,c,u,d,p=[],g=new h,m=0;for(f.forEach(t.nodes,function(t){0===t.incoming.length&&(g.set(t,0),p.push(t))});p.length>0;)for(r=p.shift(),e=0;r.outgoing.length>e;e++)i=r.outgoing[e],s=i.target,o=g.containsKey(s)?Math.max(g.get(r)+1,g.get(s)):g.get(r)+1,g.set(s,o),o>m&&(m=o),v(p,s)||p.push(s);for(a=g.keys(),a.sort(function(t,e){var n=g.get(t),i=g.get(e);return f.sign(i-n)}),l=0;a.length>l;++l)if(c=a[l],u=Number.MAX_VALUE,0!==c.outgoing.length){for(n=0;c.outgoing.length>n;++n)i=c.outgoing[n],u=Math.min(u,g.get(i.target));u>1&&g.set(c,u-1)}for(this.layers=[],e=0;m+1>e;e++)d=[],d.linksTo={},this.layers.push(d);for(g.forEach(function(t,e){t.layer=e,this.layers[e].push(t)},this),n=0;this.layers.length>n;n++)for(d=this.layers[n],e=0;d.length>e;e++)d[e].gridPosition=e},layoutGraph:function(t,e){if(f.isUndefined(t))throw"No graph given or graph analysis of the diagram failed.";f.isDefined(e)&&this.transferOptions(e),this.graph=t,t.setItemIndices();var n=t.makeAcyclic();this._initRuntimeProperties(),this._prepare(t,e),this._dummify(),this._optimizeCrossings(),this._swapPairs(),this.arrangeNodes(),this._moveThingsAround(),this._dedummify(),f.forEach(n,function(t){t.points&&t.points.reverse()})},setMinDist:function(t,e,n){var i=t.layer,o=t.layerIndex;this.minDistances[i][o]=n},getMinDist:function(t,e){var n,i=0,o=t.layerIndex,r=e.layerIndex,s=t.layer,a=Math.min(o,r),l=Math.max(o,r);for(n=a;l>n;++n)i+=this.minDistances[s][n];return i},placeLeftToRight:function(t){var e,n,i,o,r,s,a,l,c,u,d=new h;for(i=0;this.layers.length>i;++i)if(o=t[i]){for(e=0;o.length>e;e++)n=o[e],d.containsKey(n)||this.placeLeft(n,d,i);for(r=Number.POSITIVE_INFINITY,e=0;o.length>e;e++)n=o[e],s=this.rightSibling(n),s&&this.nodeLeftClass.get(s)!==i&&(r=Math.min(r,d.get(s)-d.get(n)-this.getMinDist(n,s)));if(r===Number.POSITIVE_INFINITY){for(a=[],e=0;o.length>e;e++)for(n=o[e],l=[],f.addRange(l,this.upNodes.get(n)),f.addRange(l,this.downNodes.get(n)),c=0;l.length>c;c++)u=l[c],this.nodeLeftClass.get(u)e;e++)n=o[e],d.set(n,d.get(n)+r)}return d},placeRightToLeft:function(t){var e,n,i,o,r,s,a,l,c,u,d=new h;for(i=0;this.layers.length>i;++i)if(o=t[i]){for(e=0;o.length>e;e++)n=o[e],d.containsKey(n)||this.placeRight(n,d,i);for(r=Number.NEGATIVE_INFINITY,e=0;o.length>e;e++)n=o[e],s=this.leftSibling(n),s&&this.nodeRightClass.get(s)!==i&&(r=Math.max(r,d.get(s)-d.get(n)+this.getMinDist(s,n)));if(r===Number.NEGATIVE_INFINITY){for(a=[],e=0;o.length>e;e++)for(n=o[e],l=[],f.addRange(l,this.upNodes.get(n)),f.addRange(l,this.downNodes.get(n)),c=0;l.length>c;c++)u=l[c],this.nodeRightClass.get(u)e;e++)n=o[e],d.set(n,d.get(n)+r)}return d},_getLeftWing:function(){var t={value:null},e=this.computeClasses(t,1);return this.nodeLeftClass=t.value,e},_getRightWing:function(){var t={value:null},e=this.computeClasses(t,-1);return this.nodeRightClass=t.value,e},computeClasses:function(t,e){var n,i,o,r,s,a,l,c,u,d=0,f=t.value=new h;for(n=0;this.layers.length>n;++n)for(d=n,i=this.layers[n],o=1===e?0:i.length-1;o>=0&&i.length>o;o+=e)if(r=i[o],f.containsKey(r))d=f.get(r);else if(f.set(r,d),r.isVirtual)for(s=this._nodesInLink(r),a=0;s.length>a;a++)l=s[a],f.set(l,d);for(c=[],u=0;this.layers.length>u;u++)c.push(null);return f.forEach(function(t,e){null===c[e]&&(c[e]=[]),c[e].push(t)}),c},_isVerticalLayout:function(){return"up"===this.options.subtype.toLowerCase()||"down"===this.options.subtype.toLowerCase()||"vertical"===this.options.subtype.toLowerCase()},_isHorizontalLayout:function(){return"right"===this.options.subtype.toLowerCase()||"left"===this.options.subtype.toLowerCase()||"horizontal"===this.options.subtype.toLowerCase()},_isIncreasingLayout:function(){return"right"===this.options.subtype.toLowerCase()||"down"===this.options.subtype.toLowerCase()},_moveThingsAround:function(){function t(t,e){var n,i,o=Number.MIN_VALUE;for(n=0;t.length>n;++n)i=t[n],o=e._isVerticalLayout()?Math.max(o,i.height):Math.max(o,i.width);return o}var e,n,i,o,r,s,a,l,c,u,d,p,g,m,v,y,_,w,x,b,k,C,S,T,A,D,P;for(n=0;this.layers.length>n;++n)o=this.layers[n],o.sort(this._gridPositionComparer);for(this.minDistances=[],n=0;this.layers.length>n;++n)for(o=this.layers[n],this.minDistances[n]=[],r=0;o.length>r;++r)i=o[r],i.layerIndex=r,this.minDistances[n][r]=this.options.nodeDistance,o.length-1>r&&(this.minDistances[n][r]+=this._isVerticalLayout()?(i.width+o[r+1].width)/2:(i.height+o[r+1].height)/2);for(this.downNodes=new h,this.upNodes=new h,f.forEach(this.graph.nodes,function(t){this.downNodes.set(t,[]),this.upNodes.set(t,[])},this),f.forEach(this.graph.links,function(t){var e=t.source,n=t.target,i=null,o=null;e.layer>n.layer?(i=t.source,o=t.target):(o=t.source,i=t.target),this.downNodes.get(o).push(i),this.upNodes.get(i).push(o)},this),this.downNodes.forEachValue(function(t){t.sort(this._gridPositionComparer)},this),this.upNodes.forEachValue(function(t){t.sort(this._gridPositionComparer)},this),n=0;this.layers.length-1>n;++n)for(o=this.layers[n],s=0;o.length-1>s;s++)if(a=o[s],a.isVirtual&&(l=this.downNodes.get(a)[0],l.isVirtual))for(r=s+1;o.length>r;++r)i=o[r],i.isVirtual&&(c=this.downNodes.get(i)[0],c.isVirtual&&l.gridPosition>c.gridPosition&&(u=l.gridPosition,l.gridPosition=c.gridPosition,c.gridPosition=u,d=l.layerIndex,p=c.layerIndex,this.layers[n+1][d]=c,this.layers[n+1][p]=l,l.layerIndex=p,c.layerIndex=d));for(g=this._getLeftWing(),m=this._getRightWing(),v=this.placeLeftToRight(g),y=this.placeRightToLeft(m),_=new h,f.forEach(this.graph.nodes,function(t){_.set(t,(v.get(t)+y.get(t))/2)}),w=new h,x=new h,n=0;this.layers.length>n;++n)for(o=this.layers[n],b=-1,k=-1,r=0;o.length>r;++r)i=o[r],w.set(i,0),x.set(i,!1),i.isVirtual&&(-1===b?b=r:b===r-1?b=r:(k=r,w.set(o[b],0),_.get(i)-_.get(o[b])===this.getMinDist(o[b],i)?x.set(o[b],!0):x.set(o[b],!1),b=r));for(C=[1,-1],f.forEach(C,function(t){var n,i,o,r,s,a,l,c=1===t?0:this.layers.length-1;for(n=c;n>=0&&this.layers.length>n;n+=t){if(i=this.layers[n],o=this._firstVirtualNode(i),r=null,s=null,-1!==o)for(r=i[o],s=[],e=0;o>e;e++)s.push(i[e]);else r=null,s=i;if(s.length>0){for(this._sequencer(_,null,r,t,s),e=0;s.length-1>e;++e)this.setMinDist(s[e],s[e+1],_.get(s[e+1])-_.get(s[e]));r&&this.setMinDist(s[s.length-1],r,_.get(r)-_.get(s[s.length-1]))}for(;r;){if(a=this.nextVirtualNode(i,r)){if(w.get(r)===t){for(o=r.layerIndex,l=a.layerIndex,s=[],e=o+1;l>e;e++)s.push(i[e]);s.length>0&&this._sequencer(_,r,a,t,s),x.set(r,!0)}}else{for(o=r.layerIndex,s=[],e=o+1;i.length>e;e++)s.push(i[e]);if(s.length>0){for(this._sequencer(_,r,null,t,s),e=0;s.length-1>e;++e)this.setMinDist(s[e],s[e+1],_.get(s[e+1])-_.get(s[e]));this.setMinDist(r,s[0],_.get(s[0])-_.get(r))}}r=a}this.adjustDirections(n,t,w,x)}},this),S=this._isIncreasingLayout()?0:this.layers.length-1,T=function(t,e){return e._isIncreasingLayout()?e.layers.length>t:t>=0},A=this._isIncreasingLayout()?1:-1,D=0,e=S;T(e,this);e+=A){for(o=this.layers[e],P=t(o,this),r=0;o.length>r;++r)i=o[r],this._isVerticalLayout()?(i.x=_.get(i),i.y=D+P/2):(i.x=D+P/2,i.y=_.get(i));D+=this.options.layerSeparation+P}},adjustDirections:function(t,e,n,i){var o,r,s,a,l,c,h,u,d,f,p,g,m,v;if(!(0>t+e||t+e>=this.layers.length))for(o=null,r=null,s=this.layers[t+e],a=0;s.length>a;++a)if(l=s[a],l.isVirtual&&(c=this.getNeighborOnLayer(l,t),c.isVirtual)){if(o){for(h=i.get(r),u=this.layers[t],d=r.layerIndex,f=c.layerIndex,p=d+1;f>p;++p)u[p].isVirtual&&(h=h&&i.get(u[p]));if(h)for(n.set(o,e),g=o.layerIndex,m=l.layerIndex,v=g+1;m>v;++v)s[v].isVirtual&&n.set(s[v],e)}o=l,r=c}},getNeighborOnLayer:function(t,e){var n=this.upNodes.get(t)[0];return n.layer===e?n:(n=this.downNodes.get(t)[0],n.layer===e?n:null)},_sequencer:function(t,e,n,i,o){if(1===o.length&&this._sequenceSingle(t,e,n,i,o[0]),o.length>1){var r=o.length,s=this.intDiv(r,2);this._sequencer(t,e,n,i,o.slice(0,s)),this._sequencer(t,e,n,i,o.slice(s)),this.combineSequences(t,e,n,i,o)}},_sequenceSingle:function(t,e,n,i,o){var r=-1===i?this.downNodes.get(o):this.upNodes.get(o),s=r.length;0!==s&&(s%2===1?t.set(o,t.get(r[this.intDiv(s,2)])):t.set(o,(t.get(r[this.intDiv(s,2)-1])+t.get(r[this.intDiv(s,2)]))/2),e&&t.set(o,Math.max(t.get(o),t.get(e)+this.getMinDist(e,o))),n&&t.set(o,Math.min(t.get(o),t.get(n)-this.getMinDist(o,n))))},combineSequences:function(t,e,n,i,o){var r,s,a,l,c,h,u,d,f,p,g=o.length,m=this.intDiv(g,2),v=[];for(r=0;m>r;++r){for(s=0,l=-1===i?this.downNodes.get(o[r]):this.upNodes.get(o[r]),a=0;l.length>a;++a)c=l[a],t.get(c)>=t.get(o[r])?s++:(s--,v.push({k:t.get(c)+this.getMinDist(o[r],o[m-1]),v:2}));v.push({k:t.get(o[r])+this.getMinDist(o[r],o[m-1]),v:s})}for(e&&v.push({k:t.get(e)+this.getMinDist(e,o[m-1]),v:Number.MAX_VALUE}),v.sort(this._positionDescendingComparer),u=[],r=m;g>r;++r){for(s=0,l=-1===i?this.downNodes.get(o[r]):this.upNodes.get(o[r]),a=0;l.length>a;++a)c=l[a],t.get(c)<=t.get(o[r])?s++:(s--,u.push({k:t.get(c)-this.getMinDist(o[r],o[m]),v:2}));u.push({k:t.get(o[r])-this.getMinDist(o[r],o[m]),v:s})}for(n&&u.push({k:t.get(n)-this.getMinDist(n,o[m]),v:Number.MAX_VALUE}),u.sort(this._positionAscendingComparer),d=0,f=0,p=this.getMinDist(o[m-1],o[m]);t.get(o[m])-t.get(o[m-1]) d){if(0===v.length){t.set(o[m-1],t.get(o[m])-p);break}h=v.shift(),d+=h.v,t.set(o[m-1],h.k),t.set(o[m-1],Math.max(t.get(o[m-1]),t.get(o[m])-p))}else{if(0===u.length){t.set(o[m],t.get(o[m-1])+p);break}h=u.shift(),f+=h.v,t.set(o[m],h.k),t.set(o[m],Math.min(t.get(o[m]),t.get(o[m-1])+p))}for(r=m-2;r>=0;r--)t.set(o[r],Math.min(t.get(o[r]),t.get(o[m-1])-this.getMinDist(o[r],o[m-1])));for(r=m+1;g>r;r++)t.set(o[r],Math.max(t.get(o[r]),t.get(o[m])+this.getMinDist(o[r],o[m])))},placeLeft:function(t,e,n){var i=Number.NEGATIVE_INFINITY;f.forEach(this._getComposite(t),function(t){var o=this.leftSibling(t);o&&this.nodeLeftClass.get(o)===this.nodeLeftClass.get(t)&&(e.containsKey(o)||this.placeLeft(o,e,n),i=Math.max(i,e.get(o)+this.getMinDist(o,t)))},this),i===Number.NEGATIVE_INFINITY&&(i=0),f.forEach(this._getComposite(t),function(t){e.set(t,i)})},placeRight:function(t,e,n){var i=Number.POSITIVE_INFINITY;f.forEach(this._getComposite(t),function(t){var o=this.rightSibling(t);o&&this.nodeRightClass.get(o)===this.nodeRightClass.get(t)&&(e.containsKey(o)||this.placeRight(o,e,n),i=Math.min(i,e.get(o)-this.getMinDist(t,o)))},this),i===Number.POSITIVE_INFINITY&&(i=0),f.forEach(this._getComposite(t),function(t){e.set(t,i)})},leftSibling:function(t){var e=this.layers[t.layer],n=t.layerIndex;return 0===n?null:e[n-1]},rightSibling:function(t){var e=this.layers[t.layer],n=t.layerIndex;return n===e.length-1?null:e[n+1]},_getComposite:function(t){return t.isVirtual?this._nodesInLink(t):[t]},arrangeNodes:function(){var t,e,n,i,o,r,s,a;for(e=0;this.layers.length>e;e++)for(i=this.layers[e],n=0;i.length>n;n++)o=i[n],o.upstreamPriority=o.upstreamLinkCount,o.downstreamPriority=o.downstreamLinkCount;for(r=2,s=0;r>s;s++){for(t=this.layers.length-1;t>=1;t--)this.layoutLayer(!1,t);for(t=0;this.layers.length-1>t;t++)this.layoutLayer(!0,t);
}for(a=Number.MAX_VALUE,e=0;this.layers.length>e;e++)for(i=this.layers[e],n=0;i.length>n;n++)o=i[n],a=Math.min(a,o.gridPosition);if(0>a)for(e=0;this.layers.length>e;e++)for(i=this.layers[e],n=0;i.length>n;n++)o=i[n],o.gridPosition=o.gridPosition-a},layoutLayer:function(t,e){var n,i,o,r;for(i=t?this.layers[n=e+1]:this.layers[n=e-1],o=[],r=0;i.length>r;r++)o.push(i[r]);o.sort(function(t,e){var n=(t.upstreamPriority+t.downstreamPriority)/2,i=(e.upstreamPriority+e.downstreamPriority)/2;return Math.abs(n-i)<1e-4?0:i>n?1:-1}),f.forEach(o,function(t){var e=t.gridPosition,n=this.calcBaryCenter(t),o=(t.upstreamPriority+t.downstreamPriority)/2;if(!(Math.abs(e-n)<1e-4||Math.abs(e-n)<.2501))if(n>e)for(;n>e&&this.moveRight(t,i,o);)e=t.gridPosition;else for(;e>n&&this.moveLeft(t,i,o);)e=t.gridPosition},this),n>0&&this.calcDownData(n-1),this.layers.length-1>n&&this.calcUpData(n+1)},moveRight:function(t,e,n){var i,o,r=f.indexOf(e,t);return r===e.length-1?(t.gridPosition=t.gridPosition+.5,!0):(i=e[r+1],o=(i.upstreamPriority+i.downstreamPriority)/2,i.gridPosition>t.gridPosition+1?(t.gridPosition=t.gridPosition+.5,!0):o>n||Math.abs(o-n)<1e-4?!1:this.moveRight(i,e,n)?(t.gridPosition=t.gridPosition+.5,!0):!1)},moveLeft:function(t,e,n){var i,o,r=f.indexOf(e,t);return 0===r?(t.gridPosition=t.gridPosition-.5,!0):(i=e[r-1],o=(i.upstreamPriority+i.downstreamPriority)/2,t.gridPosition-1>i.gridPosition?(t.gridPosition=t.gridPosition-.5,!0):o>n||Math.abs(o-n)<1e-4?!1:this.moveLeft(i,e,n)?(t.gridPosition=t.gridPosition-.5,!0):!1)},mapVirtualNode:function(t,e){this.nodeToLinkMap.set(t,e),this.linkToNodeMap.containsKey(e)||this.linkToNodeMap.set(e,[]),this.linkToNodeMap.get(e).push(t)},_nodesInLink:function(t){return this.linkToNodeMap.get(this.nodeToLinkMap.get(t))},_dummify:function(){var t,e,n,i,o,a,l,c,u,d,p,g,m,v,y,_,w,x,b,k;for(this.linkToNodeMap=new h,this.nodeToLinkMap=new h,u=this.graph.links.slice(0),d=this.layers,p=function(t,e,n){d[t].linksTo[e]=d[t].linksTo[e]||[],d[t].linksTo[e].push(n)},c=0;u.length>c;c++)if(g=u[c],m=g.source,v=g.target,y=m.layer,_=v.layer,w=m.gridPosition,x=v.gridPosition,b=(x-w)/Math.abs(_-y),k=m,y-_>1){for(l=y-1;l>_;l--){for(n=new r,n.x=m.x,n.y=m.y,n.width=m.width/100,n.height=m.height/100,t=d[l],e=(l-_)*b+w,e>t.length&&(e=t.length),w>=d[y].length-1&&x>=d[_].length-1?e=t.length:0===w&&0===x&&(e=0),n.layer=l,n.uBaryCenter=0,n.dBaryCenter=0,n.upstreamLinkCount=0,n.downstreamLinkCount=0,n.gridPosition=e,n.isVirtual=!0,f.insert(t,n,e),o=e+1;t.length>o;o++)i=t[o],i.gridPosition=i.gridPosition+1;a=new s(k,n),a.depthOfDumminess=0,p(l-1,l,a),k=n,this.graph._addNode(n),this.graph.addLink(a),n.index=this.graph.nodes.length-1,this.mapVirtualNode(n,g)}p(_-1,_,a),g.changeSource(k),g.depthOfDumminess=y-_-1}else if(-1>y-_){for(l=y+1;_>l;l++){for(n=new r,n.x=m.x,n.y=m.y,n.width=m.width/100,n.height=m.height/100,t=d[l],e=(l-y)*b+w,e>t.length&&(e=t.length),w>=d[y].length-1&&x>=d[_].length-1?e=t.length:0===w&&0===x&&(e=0),n.layer=l,n.uBaryCenter=0,n.dBaryCenter=0,n.upstreamLinkCount=0,n.downstreamLinkCount=0,n.gridPosition=e,n.isVirtual=!0,e&=e,f.insert(t,n,e),o=e+1;t.length>o;o++)i=t[o],i.gridPosition=i.gridPosition+1;a=new s(k,n),a.depthOfDumminess=0,p(l-1,l,a),k=n,this.graph._addNode(n),this.graph.addLink(a),n.index=this.graph.nodes.length-1,this.mapVirtualNode(n,g)}p(_-1,_,g),g.changeSource(k),g.depthOfDumminess=_-y-1}else p(y,_,g)},_dedummify:function(){for(var t,e,n,i,o,r,s,a,l=!0;l;)for(l=!1,t=0;this.graph.links.length>t;t++)if(e=this.graph.links[t],e.depthOfDumminess){for(n=[],n.unshift({x:e.target.x,y:e.target.y}),n.unshift({x:e.source.x,y:e.source.y}),i=e,o=e.depthOfDumminess,r=0;o>r;r++)s=i.source,a=s.incoming[0],n.unshift({x:a.source.x,y:a.source.y}),i=a;e.changeSource(i.source),e.depthOfDumminess=0,n.length>2?(n.splice(0,1),n.splice(n.length-1),e.points=n):e.points=[],l=!0;break}},_optimizeCrossings:function(){for(var t,e=-1,n=3,i=0;0!==e&&!(i++>n);){for(e=0,t=this.layers.length-1;t>=1;t--)e+=this.optimizeLayerCrossings(!1,t);for(t=0;this.layers.length-1>t;t++)e+=this.optimizeLayerCrossings(!0,t)}},calcUpData:function(t){var e,n,i,o,r,s,a,l,c;if(0!==t){for(e=this.layers[t],r=new u,s=this.layers[t-1],n=0;s.length>n;n++)r.add(s[n]);for(n=0;e.length>n;n++){for(a=e[n],l=0,c=0,i=0;a.incoming.length>i;i++)o=a.incoming[i],r.contains(o.source)&&(c++,l+=o.source.gridPosition);for(i=0;a.outgoing.length>i;i++)o=a.outgoing[i],r.contains(o.target)&&(c++,l+=o.target.gridPosition);c>0?(a.uBaryCenter=l/c,a.upstreamLinkCount=c):(a.uBaryCenter=n,a.upstreamLinkCount=0)}}},calcDownData:function(t){var e,n,i,o,r,s,a,l,c;if(t!==this.layers.length-1){for(e=this.layers[t],r=new u,s=this.layers[t+1],n=0;s.length>n;n++)r.add(s[n]);for(n=0;e.length>n;n++){for(a=e[n],l=0,c=0,i=0;a.incoming.length>i;i++)o=a.incoming[i],r.contains(o.source)&&(c++,l+=o.source.gridPosition);for(i=0;a.outgoing.length>i;i++)o=a.outgoing[i],r.contains(o.target)&&(c++,l+=o.target.gridPosition);c>0?(a.dBaryCenter=l/c,a.downstreamLinkCount=c):(a.dBaryCenter=n,a.downstreamLinkCount=0)}}},optimizeLayerCrossings:function(t,e){var n,i,o,r,s,a,l,c;for(i=t?this.layers[n=e+1]:this.layers[n=e-1],o=i.slice(0),t?this.calcUpData(n):this.calcDownData(n),r=this,i.sort(function(t,e){var n,i=r.calcBaryCenter(t),o=r.calcBaryCenter(e);return Math.abs(i-o)<1e-4?t.degree()===e.degree()?r.compareByIndex(t,e):t.degree()0?-1:0>n?1:r.compareByIndex(t,e))}),a=0,s=0;i.length>s;s++)i[s]!==o[s]&&a++;if(a>0)for(l=0,s=0;i.length>s;s++)c=i[s],c.gridPosition=l++;return a},_swapPairs:function(){for(var t,e,n,i,o,r,s,a,l,c,h,u,d,f,p,g,m,v=this.options.layeredIterations,y=0;;){if(y++>v)break;for(t=1>=y%4,e=y%4===1,n=t?0:this.layers.length-1;t?this.layers.length-1>=n:n>=0;n+=t?1:-1){for(i=this.layers[n],o=!1,r=!0,s=0,a=0;i.length-1>a;a++)l=0,c=0,h=0,r?(0!==n&&(l=this.countLinksCrossingBetweenTwoLayers(n-1,n)),n!==this.layers.length-1&&(c=this.countLinksCrossingBetweenTwoLayers(n,n+1)),t?l*=2:c*=2,h=l+c):h=s,0!==h&&(u=i[a],d=i[a+1],f=u.gridPosition,p=d.gridPosition,i[a]=d,i[a+1]=u,u.gridPosition=p,d.gridPosition=f,l=0,0!==n&&(l=this.countLinksCrossingBetweenTwoLayers(n-1,n)),c=0,n!==this.layers.length-1&&(c=this.countLinksCrossingBetweenTwoLayers(n,n+1)),t?l*=2:c*=2,g=l+c,m=!1,m=e?g>=h:g>h,m?(u=i[a],d=i[a+1],f=u.gridPosition,p=d.gridPosition,i[a]=d,i[a+1]=u,u.gridPosition=p,d.gridPosition=f,s=h,r=!1):(o=!0,r=!0));o&&(n!==this.layers.length-1&&this.calcUpData(n+1),0!==n&&this.calcDownData(n-1))}}},countLinksCrossingBetweenTwoLayers:function(t,e){var n,i,o,r,s,a,l,c,h,u,d,f,p=this.layers[t].linksTo[e],g=0,m=p.length;for(l=0;m>l;l++)for(n=p[l],c=l+1;m>c;c++)i=p[c],n.target.layer===e?(o=n.source,r=n.target):(o=n.target,r=n.source),i.target.layer===e?(s=i.source,a=i.target):(s=i.target,a=i.source),h=o.gridPosition,u=r.gridPosition,d=s.gridPosition,f=a.gridPosition,0>(h-d)*(u-f)&&g++;return g},calcBaryCenter:function(t){var e=t.upstreamLinkCount,n=t.downstreamLinkCount,i=t.uBaryCenter,o=t.dBaryCenter;return e>0&&n>0?(i+o)/2:e>0?i:n>0?o:0},_gridPositionComparer:function(t,e){return e.gridPosition>t.gridPosition?-1:t.gridPosition>e.gridPosition?1:0},_positionAscendingComparer:function(t,e){return e.k>t.k?-1:t.k>e.k?1:0},_positionDescendingComparer:function(t,e){return e.k>t.k?1:t.k>e.k?-1:0},_firstVirtualNode:function(t){for(var e=0;t.length>e;e++)if(t[e].isVirtual)return e;return-1},compareByIndex:function(t,e){var n=t.index,i=e.index;return i>n?1:n>i?-1:0},intDiv:function(t,e){return(t-t%e)/e},nextVirtualNode:function(t,e){var n,i=e.layerIndex;for(n=i+1;t.length>n;++n)if(t[n].isVirtual)return t[n];return null}}),S=n.Class.extend({init:function(t,e){if(f.isUndefined(t))throw"No diagram given";this.diagram=t,this.nodeMap=new h,this.linkMap=new h,this.capture(e?e:t)},capture:function(t){var e,n,o,r,s,a,l,h,u;if(t instanceof i.Graph){for(r=0;t.nodes.length>r;r++)e=t.nodes[r],o=e.associatedShape,this.nodeMap.set(o.visual.id,new c(e.x,e.y,e.width,e.height));for(r=0;t.links.length>r;r++)a=t.links[r],s=a.associatedConnection,this.linkMap.set(s.visual.id,a.points())}else if(t instanceof Array)for(n=t,r=0;n.length>r;r++)e=n[r],o=e.associatedShape,o&&this.nodeMap.set(o.visual.id,new c(e.x,e.y,e.width,e.height));else if(t.hasOwnProperty("links")&&t.hasOwnProperty("nodes")){for(n=t.nodes,l=t.links,r=0;n.length>r;r++)e=n[r],o=e.associatedShape,o&&this.nodeMap.set(o.visual.id,new c(e.x,e.y,e.width,e.height));for(r=0;l.length>r;r++)a=l[r],s=a.associatedConnection,s&&this.linkMap.set(s.visual.id,a.points)}else{for(h=this.diagram.shapes,u=this.diagram.connections,r=0;h.length>r;r++)o=h[r],this.nodeMap.set(o.visual.id,o.bounds());for(r=0;u.length>r;r++)s=u[r],this.linkMap.set(s.visual.id,s.points())}}});a(i,{init:function(t){n.init(t,i.ui)},SpringLayout:x,TreeLayout:k,GraphAdapter:w,LayeredLayout:C,LayoutBase:_,LayoutState:S})}(window.kendo.jQuery)},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.toolbar.min",["kendo.core.min","kendo.userevents.min","kendo.popup.min"],t)}(function(){return function(t,e){function n(){var t,e=this.options.anchor,n=e.outerWidth();k.wrap(this.element).addClass("k-split-wrapper"),t="border-box"!==this.element.css("box-sizing")?n-(this.element.outerWidth()-this.element.width()):n,this.element.css({fontFamily:e.css("font-family"),"min-width":t})}function i(t){t.target.is(".k-toggle-button")||t.target.toggleClass(F,"press"==t.type)}function o(e){return e=t(e),e.hasClass("km-actionsheet")?e.closest(".km-popup-wrapper"):e.addClass("km-widget km-actionsheet").wrap('').parent().wrap('').parent()}function r(t){t.preventDefault()}function s(e,n){var i="next"===n?t.fn.next:t.fn.prev,o="next"===n?t.fn.first:t.fn.last,r=i.call(e);return r.is(":kendoFocusable")||!r.length?r:r.find(":kendoFocusable").length?o.call(r.find(":kendoFocusable")):s(r,n)}var a,l,c,h,u,d,f,p,g,m,v,y,_,w,x,b,k=window.kendo,C=k.Class,S=k.ui.Widget,T=t.proxy,A=k.isFunction,D=k.keys,P="k-toolbar",M="k-button",E="k-overflow-button",B="k-toggle-button",I="k-button-group",z="k-split-button",L="k-separator",R="k-popup",O="k-toolbar-resizable",F="k-state-active",V="k-state-disabled",N="k-state-hidden",H="k-group-start",U="k-group-end",j="k-primary",G="k-icon",W="k-i-",q="k-button-icon",$="k-button-icontext",Y="k-list-container k-split-container",X="k-split-button-arrow",Q="k-overflow-anchor",K="k-overflow-container",Z="k-toolbar-first-visible",J="k-toolbar-last-visible",tt="click",et="toggle",nt="open",it="close",ot="overflowOpen",rt="overflowClose",st="never",at="auto",lt="always",ct="k-overflow-hidden",ht=k.attr("uid");k.toolbar={},a={overflowAnchor:'
',overflowContainer:''},k.toolbar.registerComponent=function(t,e,n){a[t]={toolbar:e,overflow:n}},l=k.Class.extend({addOverflowAttr:function(){this.element.attr(k.attr("overflow"),this.options.overflow||at)},addUidAttr:function(){this.element.attr(ht,this.options.uid)},addIdAttr:function(){this.options.id&&this.element.attr("id",this.options.id)},addOverflowIdAttr:function(){this.options.id&&this.element.attr("id",this.options.id+"_overflow")},attributes:function(){this.options.attributes&&this.element.attr(this.options.attributes)},show:function(){this.element.removeClass(N).show(),this.options.hidden=!1},hide:function(){this.element.addClass(N).hide(),this.options.hidden=!0},remove:function(){this.element.remove()},enable:function(t){t===e&&(t=!0),this.element.toggleClass(V,!t),this.options.enable=t},twin:function(){var t=this.element.attr(ht);return this.overflow?this.toolbar.element.find("["+ht+"='"+t+"']").data(this.options.type):this.toolbar.options.resizable?this.toolbar.popup.element.find("["+ht+"='"+t+"']").data(this.options.type):e}}),k.toolbar.Item=l,c=l.extend({init:function(n,i){var o=t(n.useButtonTag?' ':' ');this.element=o,this.options=n,this.toolbar=i,this.attributes(),n.primary&&o.addClass(j),n.togglable&&(o.addClass(B),this.toggle(n.selected)),n.url===e||n.useButtonTag||(o.attr("href",n.url),n.mobile&&o.attr(k.attr("role"),"button")),n.group&&(o.attr(k.attr("group"),n.group),this.group=this.toolbar.addToGroup(this,n.group)),!n.togglable&&n.click&&A(n.click)&&(this.clickHandler=n.click),n.togglable&&n.toggle&&A(n.toggle)&&(this.toggleHandler=n.toggle)},toggle:function(t,e){t=!!t,this.group&&t?this.group.select(this):this.group||this.select(t),e&&this.twin()&&this.twin().toggle(t)},getParentGroup:function(){return this.options.isChild?this.element.closest("."+I).data("buttonGroup"):e},_addGraphics:function(){var e,n,i,o=this.element,r=this.options.icon,s=this.options.spriteCssClass,a=this.options.imageUrl;(s||a||r)&&(e=!0,o.contents().not("span.k-sprite,span."+G+",img.k-image").each(function(n,i){(1==i.nodeType||3==i.nodeType&&t.trim(i.nodeValue).length>0)&&(e=!1)}),o.addClass(e?q:$)),r?(n=o.children("span."+G).first(),n[0]||(n=t(' ').prependTo(o)),n.addClass(W+r)):s?(n=o.children("span.k-sprite").first(),n[0]||(n=t(' ').prependTo(o)),n.addClass(s)):a&&(i=o.children("img.k-image").first(),i[0]||(i=t(' ').prependTo(o)),i.attr("src",a))}}),k.toolbar.Button=c,h=c.extend({init:function(t,e){c.fn.init.call(this,t,e);var n=this.element;n.addClass(M),this.addIdAttr(),t.align&&n.addClass("k-align-"+t.align),"overflow"!=t.showText&&t.text&&n.html(t.mobile?''+t.text+" ":t.text),t.hasIcon="overflow"!=t.showIcon&&(t.icon||t.spriteCssClass||t.imageUrl),t.hasIcon&&this._addGraphics(),this.addUidAttr(),this.addOverflowAttr(),this.enable(t.enable),t.hidden&&this.hide(),this.element.data({type:"button",button:this})},select:function(t){t===e&&(t=!1),this.element.toggleClass(F,t),this.options.selected=t}}),k.toolbar.ToolBarButton=h,u=c.extend({init:function(t,e){this.overflow=!0,c.fn.init.call(this,t,e);var n=this.element;"toolbar"!=t.showText&&t.text&&n.html(t.mobile?''+t.text+" ":''+t.text+" "),t.hasIcon="toolbar"!=t.showIcon&&(t.icon||t.spriteCssClass||t.imageUrl),t.hasIcon&&this._addGraphics(),t.isChild||this._wrap(),this.addOverflowIdAttr(),this.attributes(),this.addUidAttr(),this.addOverflowAttr(),this.enable(t.enable),n.addClass(E+" "+M),t.hidden&&this.hide(),this.element.data({type:"button",button:this})},_wrap:function(){this.element=this.element.wrap(" ").parent()},overflowHidden:function(){this.element.addClass(ct)},select:function(t){t===e&&(t=!1),this.options.isChild?this.element.toggleClass(F,t):this.element.find(".k-button").toggleClass(F,t),this.options.selected=t}}),k.toolbar.OverflowButton=u,k.toolbar.registerComponent("button",h,u),d=l.extend({createButtons:function(e){var n,i,o=this.options,r=o.buttons||[];for(i=0;r.length>i;i++)r[i].uid||(r[i].uid=k.guid()),n=new e(t.extend({mobile:o.mobile,isChild:!0,type:"button"},r[i]),this.toolbar),n.element.appendTo(this.element)},refresh:function(){this.element.children().filter(":not('."+N+"'):first").addClass(H),this.element.children().filter(":not('."+N+"'):last").addClass(U)}}),k.toolbar.ButtonGroup=d,f=d.extend({init:function(e,n){var i=this.element=t("
");this.options=e,this.toolbar=n,this.addIdAttr(),e.align&&i.addClass("k-align-"+e.align),this.createButtons(h),this.attributes(),this.addUidAttr(),this.addOverflowAttr(),this.refresh(),i.addClass(I),this.element.data({type:"buttonGroup",buttonGroup:this})}}),k.toolbar.ToolBarButtonGroup=f,p=d.extend({init:function(e,n){var i=this.element=t(" ");this.options=e,this.toolbar=n,this.overflow=!0,this.addOverflowIdAttr(),this.createButtons(u),this.attributes(),this.addUidAttr(),this.addOverflowAttr(),this.refresh(),i.addClass((e.mobile?"":I)+" k-overflow-group"),this.element.data({type:"buttonGroup",buttonGroup:this})},overflowHidden:function(){this.element.addClass(ct)}}),k.toolbar.OverflowButtonGroup=p,k.toolbar.registerComponent("buttonGroup",f,p),g=l.extend({init:function(e,n){var i=this.element=t('
');this.options=e,this.toolbar=n,this.mainButton=new h(e,n),this.arrowButton=t(' '),this.popupElement=t(''),this.mainButton.element.removeAttr("href tabindex").appendTo(i),this.arrowButton.appendTo(i),this.popupElement.appendTo(i),e.align&&i.addClass("k-align-"+e.align),e.id||(e.id=e.uid),i.attr("id",e.id+"_wrapper"),this.addOverflowAttr(),this.addUidAttr(),this.createMenuButtons(),this.createPopup(),this._navigatable(),this.mainButton.main=!0,i.data({type:"splitButton",splitButton:this,kendoPopup:this.popup})},_navigatable:function(){var e=this;e.popupElement.on("keydown","."+M,function(n){var i=t(n.target).parent();n.preventDefault(),n.keyCode===D.ESC||n.keyCode===D.TAB||n.altKey&&n.keyCode===D.UP?(e.toggle(),e.focus()):n.keyCode===D.DOWN?s(i,"next").focus():n.keyCode===D.UP?s(i,"prev").focus():(n.keyCode===D.SPACEBAR||n.keyCode===D.ENTER)&&e.toolbar.userEvents.trigger("tap",{target:t(n.target)})})},createMenuButtons:function(){var e,n,i=this.options,o=i.menuButtons;for(n=0;o.length>n;n++)e=new h(t.extend({mobile:i.mobile,type:"button",click:i.click},o[n]),this.toolbar),e.element.wrap(" ").parent().appendTo(this.popupElement)},createPopup:function(){var e=this.options,i=this.element;this.popupElement.attr("id",e.id+"_optionlist").attr(ht,e.rootUid),e.mobile&&(this.popupElement=o(this.popupElement)),this.popup=this.popupElement.kendoPopup({appendTo:e.mobile?t(e.mobile).children(".km-pane"):null,anchor:i,isRtl:this.toolbar._isRtl,copyAnchorStyles:!1,animation:e.animation,open:n,activate:function(){this.element.find(":kendoFocusable").first().focus()},close:function(){i.focus()}}).data("kendoPopup"),this.popup.element.on(tt,"a.k-button",r)},remove:function(){this.popup.element.off(tt,"a.k-button"),this.popup.destroy(),this.element.remove()},toggle:function(){this.popup.toggle()},enable:function(t){t===e&&(t=!0),this.mainButton.enable(t),this.options.enable=t},focus:function(){this.element.focus()}}),k.toolbar.ToolBarSplitButton=g,m=l.extend({init:function(e,n){var i,o,r=this.element=t(' '),s=e.menuButtons;for(this.options=e,this.toolbar=n,this.overflow=!0,this.mainButton=new u(t.extend({isChild:!0},e)),this.mainButton.element.appendTo(r),o=0;s.length>o;o++)i=new u(t.extend({mobile:e.mobile,isChild:!0},s[o]),this.toolbar),i.element.appendTo(r);this.addUidAttr(),this.addOverflowAttr(),this.mainButton.main=!0,r.data({type:"splitButton",splitButton:this})},overflowHidden:function(){this.element.addClass(ct)}}),k.toolbar.OverflowSplitButton=m,k.toolbar.registerComponent("splitButton",g,m),v=l.extend({init:function(e,n){var i=this.element=t("
");this.element=i,this.options=e,this.toolbar=n,this.attributes(),this.addIdAttr(),this.addUidAttr(),this.addOverflowAttr(),i.addClass(L),i.data({type:"separator",separator:this})}}),y=l.extend({init:function(e,n){var i=this.element=t(" ");this.element=i,this.options=e,this.toolbar=n,this.overflow=!0,this.attributes(),this.addUidAttr(),this.addOverflowIdAttr(),i.addClass(L),i.data({type:"separator",separator:this})},overflowHidden:function(){this.element.addClass(ct)}}),k.toolbar.registerComponent("separator",v,y),_=l.extend({init:function(e,n,i){var o=A(e)?e(n):e;o=o instanceof jQuery?o.wrap("
").parent():t("
").html(o),this.element=o,this.options=n,this.options.type="template",this.toolbar=i,this.attributes(),this.addUidAttr(),this.addIdAttr(),this.addOverflowAttr(),o.data({type:"template",template:this})}}),k.toolbar.TemplateItem=_,w=l.extend({init:function(e,n,i){var o=t(A(e)?e(n):e);o=o instanceof jQuery?o.wrap(" ").parent():t(" ").html(o),this.element=o,this.options=n,this.options.type="template",this.toolbar=i,this.overflow=!0,this.attributes(),this.addUidAttr(),this.addOverflowIdAttr(),this.addOverflowAttr(),o.data({type:"template",template:this})},overflowHidden:function(){this.element.addClass(ct)}}),k.toolbar.OverflowTemplateItem=w,x=C.extend({init:function(t){this.name=t,this.buttons=[]},add:function(t){this.buttons[this.buttons.length]=t},remove:function(e){var n=t.inArray(e,this.buttons);this.buttons.splice(n,1)},select:function(t){var e,n;for(n=0;this.buttons.length>n;n++)e=this.buttons[n],e.select(!1);t.select(!0),t.twin()&&t.twin().select(!0)}}),b=S.extend({init:function(e,n){var o,s=this;if(S.fn.init.call(s,e,n),n=s.options,e=s.wrapper=s.element,e.addClass(P+" k-widget"),this.uid=k.guid(),this._isRtl=k.support.isRtl(e),this._groups={},e.attr(ht,this.uid),s.isMobile="boolean"==typeof n.mobile?n.mobile:s.element.closest(".km-root")[0],s.animation=s.isMobile?{open:{effects:"fade"}}:{},s.isMobile&&(e.addClass("km-widget"),G="km-icon",W="km-",M="km-button",I="km-buttongroup km-widget",F="km-state-active",V="km-state-disabled"),n.resizable?(s._renderOverflow(),e.addClass(O),s.overflowUserEvents=new k.UserEvents(s.element,{threshold:5,allowSelection:!0,filter:"."+Q,tap:T(s._toggleOverflow,s)}),s._resizeHandler=k.onResize(function(){s.resize()})):s.popup={element:t([])},n.items&&n.items.length)for(o=0;n.items.length>o;o++)s.add(n.items[o]);s.userEvents=new k.UserEvents(document,{threshold:5,allowSelection:!0,filter:"["+ht+"="+this.uid+"] a."+M+", ["+ht+"="+this.uid+"] ."+E,tap:T(s._buttonClick,s),press:i,release:i}),s.element.on(tt,"a.k-button",r),s._navigatable(),n.resizable&&s.popup.element.on(tt,NaN,r),n.resizable&&this._toggleOverflowAnchor(),k.notify(s)},events:[tt,et,nt,it,ot,rt],options:{name:"ToolBar",items:[],resizable:!0,mobile:null},addToGroup:function(t,e){var n;return n=this._groups[e]?this._groups[e]:this._groups[e]=new x,n.add(t),n},destroy:function(){var e=this;e.element.find("."+z).each(function(e,n){t(n).data("kendoPopup").destroy()}),e.element.off(tt,"a.k-button"),e.userEvents.destroy(),e.options.resizable&&(k.unbindResize(e._resizeHandler),e.overflowUserEvents.destroy(),e.popup.element.off(tt,"a.k-button"),e.popup.destroy()),S.fn.destroy.call(e)},add:function(e){var n,i,o,r=a[e.type],s=e.template,l=this,c=l.isMobile?"":"k-item k-state-default",h=e.overflowTemplate;if(t.extend(e,{uid:k.guid(),animation:l.animation,mobile:l.isMobile,rootUid:l.uid}),e.menuButtons)for(o=0;e.menuButtons.length>o;o++)t.extend(e.menuButtons[o],{uid:k.guid()});s&&!h?e.overflow=st:e.overflow||(e.overflow=at),e.overflow!==st&&l.options.resizable&&(h?i=new w(h,e,l):r&&(i=new r.overflow(e,l),i.element.addClass(c)),i&&(e.overflow===at&&i.overflowHidden(),i.element.appendTo(l.popup.container),l.angular("compile",function(){return{elements:i.element.get()}}))),e.overflow!==lt&&(s?n=new _(s,e,l):r&&(n=new r.toolbar(e,l)),n&&(l.options.resizable?(n.element.appendTo(l.element).css("visibility","hidden"),l._shrink(l.element.innerWidth()),n.element.css("visibility","visible")):n.element.appendTo(l.element),l.angular("compile",function(){return{elements:n.element.get()}})))},_getItem:function(e){var n,i,o,r,s=this.options.resizable;return n=this.element.find(e),n.length||(n=t(".k-split-container[data-uid="+this.uid+"]").find(e)),r=n.length?n.data("type"):"",i=n.data(r),i?(i.main&&(n=n.parent("."+z),r="splitButton",i=n.data(r)),s&&(o=i.twin())):s&&(n=this.popup.element.find(e),r=n.length?n.data("type"):"",o=n.data(r),o&&o.main&&(n=n.parent("."+z),r="splitButton",o=n.data(r))),{type:r,toolbar:i,overflow:o}},remove:function(t){var e=this._getItem(t);e.toolbar&&e.toolbar.remove(),e.overflow&&e.overflow.remove(),this.resize(!0)},hide:function(t){var e=this._getItem(t);e.toolbar&&(e.toolbar.hide(),"button"===e.toolbar.options.type&&e.toolbar.options.isChild&&e.toolbar.getParentGroup().refresh()),e.overflow&&(e.overflow.hide(),"button"===e.overflow.options.type&&e.overflow.options.isChild&&e.overflow.getParentGroup().refresh()),this.resize(!0)},show:function(t){var e=this._getItem(t);e.toolbar?(e.toolbar.show(),"button"===e.toolbar.options.type&&e.toolbar.options.isChild&&e.toolbar.getParentGroup().refresh()):e.overflow&&(e.overflow.show(),"button"===e.overflow.options.type&&e.overflow.options.isChild&&e.overflow.getParentGroup().refresh()),this.resize(!0)},enable:function(t,n){var i=this._getItem(t);e===n&&(n=!0),i.toolbar&&i.toolbar.enable(n),i.overflow&&i.overflow.enable(n)},getSelectedFromGroup:function(t){return this.element.find("."+B+"[data-group='"+t+"']").filter("."+F)},toggle:function(n,i){var o=t(n),r=o.data("button");r.options.togglable&&(i===e&&(i=!0),r.toggle(i,!0))},_renderOverflow:function(){var e=this,n=a.overflowContainer,i=e._isRtl,r=i?"left":"right";e.overflowAnchor=t(a.overflowAnchor).addClass(M),e.element.append(e.overflowAnchor),e.isMobile?(e.overflowAnchor.append(' '),n=o(n)):e.overflowAnchor.append(' '),e.popup=new k.ui.Popup(n,{origin:"bottom "+r,position:"top "+r,anchor:e.overflowAnchor,isRtl:i,animation:e.animation,appendTo:e.isMobile?t(e.isMobile).children(".km-pane"):null,copyAnchorStyles:!1,open:function(n){var o=k.wrap(e.popup.element).addClass("k-overflow-wrapper");e.isMobile?e.popup.container.css("max-height",parseFloat(t(".km-content:visible").innerHeight())-15+"px"):o.css("margin-left",(i?-1:1)*((o.outerWidth()-o.width())/2+1)),e.trigger(ot)&&n.preventDefault()},activate:function(){this.element.find(":kendoFocusable").first().focus()},close:function(t){e.trigger(rt)&&t.preventDefault(),this.element.focus()}}),e.popup.element.on("keydown","."+M,function(n){var i,o=t(n.target),r=o.parent(),a=r.is("."+I)||r.is("."+z);n.preventDefault(),n.keyCode===D.ESC||n.keyCode===D.TAB||n.altKey&&n.keyCode===D.UP?(e._toggleOverflow(),e.overflowAnchor.focus()):n.keyCode===D.DOWN?(i=!a||a&&o.is(":last-child")?r:o,s(i,"next").focus()):n.keyCode===D.UP?(i=!a||a&&o.is(":first-child")?r:o,s(i,"prev").focus()):(n.keyCode===D.SPACEBAR||n.keyCode===D.ENTER)&&e.userEvents.trigger("tap",{target:t(n.target)})}),e.popup.container=e.isMobile?e.popup.element.find("."+K):e.popup.element,e.popup.container.attr(ht,this.uid)},_toggleOverflowAnchor:function(){this.overflowAnchor.css(this.popup.element.children(":not(."+ct+", ."+R+")").length>0?{visibility:"visible",width:""}:{visibility:"hidden",width:"1px"})},_buttonClick:function(n){var i,o,r,s,a,l,c=this,h=n.target.closest("."+X).length;return n.preventDefault(),h?(c._toggle(n),e):(o=t(n.target).closest("."+M,c.element),o.hasClass(Q)||(r=o.data("button"),!r&&c.popup&&(o=t(n.target).closest("."+E,c.popup.container),r=o.parent("li").data("button")),r&&r.options.enable&&(r.options.togglable?(a=A(r.toggleHandler)?r.toggleHandler:null,r.toggle(!r.options.selected,!0),l={target:o,group:r.options.group,checked:r.options.selected,id:r.options.id},a&&a.call(c,l),c.trigger(et,l)):(a=A(r.clickHandler)?r.clickHandler:null,l={sender:c,target:o,id:r.options.id},a&&a.call(c,l),c.trigger(tt,l)),r.options.url&&(window.location.href=r.options.url),o.hasClass(E)&&c.popup.close(),s=o.closest(".k-split-container"),s[0]&&(i=s.data("kendoPopup"),(i?i:s.parents(".km-popup-wrapper").data("kendoPopup")).close()))),e)},_navigatable:function(){var e=this;e.element.attr("tabindex",0).focus(function(){var e=t(this).find(":kendoFocusable:first");e.is("."+Q)&&(e=s(e,"next")),e[0].focus()}).on("keydown",T(e._keydown,e))},_keydown:function(n){var i,o,r,s,a,l=t(n.target),c=n.keyCode,h=this.element.children(":not(.k-separator):visible");return c===D.TAB&&(i=l.parentsUntil(this.element).last(),o=!1,r=!1,i.length||(i=l),i.is("."+Q)&&(n.shiftKey&&n.preventDefault(),h.last().is(":kendoFocusable")?h.last().focus():h.last().find(":kendoFocusable").last().focus()),n.shiftKey||h.index(i)!==h.length-1||(o=i.is("."+I)?l.is(":last-child"):!0),n.shiftKey&&1===h.index(i)&&(r=i.is("."+I)?l.is(":first-child"):!0),o&&"hidden"!==this.overflowAnchor.css("visibility")&&(n.preventDefault(),this.overflowAnchor.focus()),r&&(n.preventDefault(),this.wrapper.prev(":kendoFocusable").focus())),n.altKey&&c===D.DOWN?(s=t(document.activeElement).data("splitButton"),a=t(document.activeElement).is("."+Q),s?s.toggle():a&&this._toggleOverflow(),e):c!==D.SPACEBAR&&c!==D.ENTER||l.is("input, checkbox")?e:(n.preventDefault(),l.is("."+z)&&(l=l.children().first()),this.userEvents.trigger("tap",{target:l}),e)},_toggle:function(e){var n,i=t(e.target).closest("."+z).data("splitButton");e.preventDefault(),i.options.enable&&(n=i.popup.element.is(":visible")?this.trigger(it,{target:i.element}):this.trigger(nt,{target:i.element}),n||i.toggle())},_toggleOverflow:function(){this.popup.toggle()},_resize:function(t){var e=t.width;this.options.resizable&&(this.popup.close(),this._shrink(e),this._stretch(e),this._markVisibles(),this._toggleOverflowAnchor())},_childrenWidth:function(){var e=0;return this.element.children(":visible:not('."+N+"')").each(function(){e+=t(this).outerWidth(!0)}),Math.ceil(e)},_shrink:function(t){var e,n,i;if(t=0&&(e=n.eq(i),!(t>this._childrenWidth()));i--)this._hideItem(e)},_stretch:function(t){var e,n,i;if(t>this._childrenWidth())for(n=this.element.children(":hidden:not('."+N+"')"),i=0;n.length>i&&(e=n.eq(i),!(tli[data-uid='"+t.data("uid")+"']").removeClass(ct)},_showItem:function(t,e){return t.length&&e>this._childrenWidth()+t.outerWidth(!0)?(t.show(),this.popup&&this.popup.container.find(">li[data-uid='"+t.data("uid")+"']").addClass(ct),!0):!1},_markVisibles:function(){var t=this.popup.container.children(),e=this.element.children(":not(.k-overflow-anchor)"),n=t.filter(":not(.k-overflow-hidden)"),i=e.filter(":visible");t.add(e).removeClass(Z+" "+J),n.first().add(i.first()).addClass(Z),n.last().add(i.last()).addClass(J)}}),k.ui.plugin(b)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.calendar.min",["kendo.core.min"],t)}(function(){return function(t,e){function n(t,e,n,i){var o,r=t.getFullYear(),s=e.getFullYear(),a=n.getFullYear();return r-=r%i,o=r+(i-1),s>r&&(r=s),o>a&&(o=a),r+"-"+o}function i(t){for(var e,n=0,i=t.min,o=t.max,r=t.start,s=t.setter,l=t.build,c=t.cells||12,h=t.perRow||4,u=t.content||z,d=t.empty||L,f=t.html||'';c>n;n++)n>0&&n%h===0&&(f+=' '),r=new vt(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0),D(r,0),e=l(r,n,t.disableDates),f+=a(r,i,o)?u(e):d(e),s(r,1);return f+"
"}function o(t,e,n){var i=t.getFullYear(),o=e.getFullYear(),r=o,s=0;return n&&(o-=o%n,r=o-o%n+n-1),i>r?s=1:o>i&&(s=-1),s}function r(){var t=new vt;return new vt(t.getFullYear(),t.getMonth(),t.getDate())}function s(t,e,n){var i=r();return t&&(i=new vt(+t)),e>i?i=new vt(+e):i>n&&(i=new vt(+n)),i}function a(t,e,n){return+t>=+e&&+n>=+t}function l(t,e){return t.slice(e).concat(t.slice(0,e))}function c(t,e,n){e=e instanceof vt?e.getFullYear():t.getFullYear()+n*e,t.setFullYear(e)}function h(e){var n=t(this).hasClass("k-state-disabled");n||t(this).toggleClass(Q,st.indexOf(e.type)>-1||e.type==ot)}function u(t){t.preventDefault()}function d(t){return E(t).calendars.standard}function f(t){var n=yt[t.start],i=yt[t.depth],o=E(t.culture);t.format=P(t.format||o.calendars.standard.patterns.d),isNaN(n)&&(n=0,t.start=W),(i===e||i>n)&&(t.depth=W),t.dates||(t.dates=[])}function p(t){O&&t.find("*").attr("unselectable","on")}function g(t,e){for(var n=0,i=e.length;i>n;n++)if(t===+e[n])return!0;return!1}function m(t,e){return t?t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate():!1}function v(t,e){return t?t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth():!1;
}function y(e){return b.isFunction(e)?e:t.isArray(e)?_(e):t.noop}function _(e){var n,i,o,r,s,a=[],l=["su","mo","tu","we","th","fr","sa"];for(o=0;e.length>o;o++)r=e[o].toLowerCase(),s=t.inArray(r,l),s>-1&&a.push(s);return n="var found = date && $.inArray(date.getDay(),["+a+"]) > -1;if (found) { return true } else {return false}",i=Function("date",n)}function w(t,e){return t instanceof Date&&e instanceof Date&&(t=t.getTime(),e=e.getTime()),t===e}var x,b=window.kendo,k=b.support,C=b.ui,S=C.Widget,T=b.keys,A=b.parseDate,D=b.date.adjustDST,P=b._extractFormat,M=b.template,E=b.getCulture,B=b.support.transitions,I=B?B.css+"transform-origin":"",z=M('#=data.value# ',{useWithBlock:!1}),L=M(' ',{useWithBlock:!1}),R=b.support.browser,O=R.msie&&9>R.version,F=".kendoCalendar",V="click"+F,N="keydown"+F,H="id",U="min",j="left",G="slideIn",W="month",q="century",$="change",Y="navigate",X="value",Q="k-state-hover",K="k-state-disabled",Z="k-state-focused",J="k-other-month",tt=' class="'+J+'"',et="k-nav-today",nt="td:has(.k-link)",it="blur"+F,ot="focus",rt=ot+F,st=k.touch?"touchstart":"mouseenter",at=k.touch?"touchstart"+F:"mouseenter"+F,lt=k.touch?"touchend"+F+" touchmove"+F:"mouseleave"+F,ct=6e4,ht=864e5,ut="_prevArrow",dt="_nextArrow",ft="aria-disabled",pt="aria-selected",gt=t.proxy,mt=t.extend,vt=Date,yt={month:0,year:1,decade:2,century:3},_t=S.extend({init:function(e,n){var i,o,a=this;S.fn.init.call(a,e,n),e=a.wrapper=a.element,n=a.options,n.url=window.unescape(n.url),a.options.disableDates=y(a.options.disableDates),a._templates(),a._header(),a._footer(a.footer),o=e.addClass("k-widget k-calendar").on(at+" "+lt,nt,h).on(N,"table.k-content",gt(a._move,a)).on(V,nt,function(e){var n=e.currentTarget.firstChild,i=a._toDateObject(n);-1!=n.href.indexOf("#")&&e.preventDefault(),a.options.disableDates(i)||a._click(t(n))}).on("mouseup"+F,"table.k-content, .k-footer",function(){a._focusView(a.options.focusOnNav!==!1)}).attr(H),o&&(a._cellID=o+"_cell_selected"),f(n),i=A(n.value,n.format,n.culture),a._index=yt[n.start],a._current=new vt(+s(i,n.min,n.max)),a._addClassProxy=function(){if(a._active=!0,a._cell.hasClass(K)){var t=a._view.toDateString(r());a._cell=a._cellByDate(t)}a._cell.addClass(Z)},a._removeClassProxy=function(){a._active=!1,a._cell.removeClass(Z)},a.value(i),b.notify(a)},options:{name:"Calendar",value:null,min:new vt(1900,0,1),max:new vt(2099,11,31),dates:[],url:"",culture:"",footer:"",format:"",month:{},start:W,depth:W,animation:{horizontal:{effects:G,reverse:!0,duration:500,divisor:2},vertical:{effects:"zoomIn",duration:400}}},events:[$,Y],setOptions:function(t){var e=this;f(t),t.dates[0]||(t.dates=e.options.dates),t.disableDates=y(t.disableDates),S.fn.setOptions.call(e,t),e._templates(),e._footer(e.footer),e._index=yt[e.options.start],e.navigate()},destroy:function(){var t=this,e=t._today;t.element.off(F),t._title.off(F),t[ut].off(F),t[dt].off(F),b.destroy(t._table),e&&b.destroy(e.off(F)),S.fn.destroy.call(t)},current:function(){return this._current},view:function(){return this._view},focus:function(t){t=t||this._table,this._bindTable(t),t.focus()},min:function(t){return this._option(U,t)},max:function(t){return this._option("max",t)},navigateToPast:function(){this._navigate(ut,-1)},navigateToFuture:function(){this._navigate(dt,1)},navigateUp:function(){var t=this,e=t._index;t._title.hasClass(K)||t.navigate(t._current,++e)},navigateDown:function(t){var n=this,i=n._index,o=n.options.depth;if(t)return i===yt[o]?(w(n._value,n._current)&&w(n._value,t)||(n.value(t),n.trigger($)),e):(n.navigate(t,--i),e)},navigate:function(n,i){var o,r,a,l,c,h,u,d,f,g,m,v,y,_,w,b,k;i=isNaN(i)?yt[i]:i,o=this,r=o.options,a=r.culture,l=r.min,c=r.max,h=o._title,u=o._table,d=o._oldTable,f=o._value,g=o._current,m=n&&+n>+g,v=i!==e&&i!==o._index,n||(n=g),o._current=n=new vt(+s(n,l,c)),i===e?i=o._index:o._index=i,o._view=_=x.views[i],w=_.compare,b=i===yt[q],h.toggleClass(K,b).attr(ft,b),b=w(n,l)<1,o[ut].toggleClass(K,b).attr(ft,b),b=w(n,c)>-1,o[dt].toggleClass(K,b).attr(ft,b),u&&d&&d.data("animating")&&(d.kendoStop(!0,!0),u.kendoStop(!0,!0)),o._oldTable=u,(!u||o._changeView)&&(h.html(_.title(n,l,c,a)),o._table=y=t(_.content(mt({min:l,max:c,date:n,url:r.url,dates:r.dates,format:r.format,culture:a,disableDates:r.disableDates},o[_.name]))),p(y),k=u&&u.data("start")===y.data("start"),o._animate({from:u,to:y,vertical:v,future:m,replace:k}),o.trigger(Y),o._focus(n)),i===yt[r.depth]&&f&&!o.options.disableDates(f)&&o._class("k-state-selected",f),o._class(Z,n),!u&&o._cell&&o._cell.removeClass(Z),o._changeView=!0},value:function(t){var n=this,i=n._view,o=n.options,r=n._view,s=o.min,l=o.max;return t===e?n._value:(null===t&&(n._current=new Date(n._current.getFullYear(),n._current.getMonth(),n._current.getDate())),t=A(t,o.format,o.culture),null!==t&&(t=new vt(+t),a(t,s,l)||(t=null)),n.options.disableDates(t)?n._value===e&&(n._value=null):n._value=t,r&&null===t&&n._cell?n._cell.removeClass("k-state-selected"):(n._changeView=!t||i&&0!==i.compare(t,n._current),n.navigate(t)),e)},_move:function(e){var n,i,o,r,l=this,c=l.options,h=e.keyCode,u=l._view,d=l._index,f=l.options.min,p=l.options.max,g=new vt(+l._current),m=b.support.isRtl(l.wrapper),v=l.options.disableDates;return e.target===l._table[0]&&(l._active=!0),e.ctrlKey?h==T.RIGHT&&!m||h==T.LEFT&&m?(l.navigateToFuture(),i=!0):h==T.LEFT&&!m||h==T.RIGHT&&m?(l.navigateToPast(),i=!0):h==T.UP?(l.navigateUp(),i=!0):h==T.DOWN&&(l._click(t(l._cell[0].firstChild)),i=!0):(h==T.RIGHT&&!m||h==T.LEFT&&m?(n=1,i=!0):h==T.LEFT&&!m||h==T.RIGHT&&m?(n=-1,i=!0):h==T.UP?(n=0===d?-7:-4,i=!0):h==T.DOWN?(n=0===d?7:4,i=!0):h==T.ENTER?(l._click(t(l._cell[0].firstChild)),i=!0):h==T.HOME||h==T.END?(o=h==T.HOME?"first":"last",r=u[o](g),g=new vt(r.getFullYear(),r.getMonth(),r.getDate(),g.getHours(),g.getMinutes(),g.getSeconds(),g.getMilliseconds()),i=!0):h==T.PAGEUP?(i=!0,l.navigateToPast()):h==T.PAGEDOWN&&(i=!0,l.navigateToFuture()),(n||o)&&(o||u.setDate(g,n),v(g)&&(g=l._nextNavigatable(g,n)),a(g,f,p)&&l._focus(s(g,c.min,c.max)))),i&&e.preventDefault(),l._current},_nextNavigatable:function(t,e){var n=this,i=!0,o=n._view,r=n.options.min,s=n.options.max,l=n.options.disableDates,c=new Date(t.getTime());for(o.setDate(c,-e);i;){if(o.setDate(t,e),!a(t,r,s)){t=c;break}i=l(t)}return t},_animate:function(t){var e=this,n=t.from,i=t.to,o=e._active;n?n.parent().data("animating")?(n.off(F),n.parent().kendoStop(!0,!0).remove(),n.remove(),i.insertAfter(e.element[0].firstChild),e._focusView(o)):!n.is(":visible")||e.options.animation===!1||t.replace?(i.insertAfter(n),n.off(F).remove(),e._focusView(o)):e[t.vertical?"_vertical":"_horizontal"](n,i,t.future):(i.insertAfter(e.element[0].firstChild),e._bindTable(i))},_horizontal:function(t,e,n){var i=this,o=i._active,r=i.options.animation.horizontal,s=r.effects,a=t.outerWidth();s&&-1!=s.indexOf(G)&&(t.add(e).css({width:a}),t.wrap("
"),i._focusView(o,t),t.parent().css({position:"relative",width:2*a,"float":j,"margin-left":n?0:-a}),e[n?"insertAfter":"insertBefore"](t),mt(r,{effects:G+":"+(n?"right":j),complete:function(){t.off(F).remove(),i._oldTable=null,e.unwrap(),i._focusView(o)}}),t.parent().kendoStop(!0,!0).kendoAnimate(r))},_vertical:function(t,e){var n,i,o=this,r=o.options.animation.vertical,s=r.effects,a=o._active;s&&-1!=s.indexOf("zoom")&&(e.css({position:"absolute",top:t.prev().outerHeight(),left:0}).insertBefore(t),I&&(n=o._cellByDate(o._view.toDateString(o._current)),i=n.position(),i=i.left+parseInt(n.width()/2,10)+"px "+(i.top+parseInt(n.height()/2,10)+"px"),e.css(I,i)),t.kendoStop(!0,!0).kendoAnimate({effects:"fadeOut",duration:600,complete:function(){t.off(F).remove(),o._oldTable=null,e.css({position:"static",top:0,left:0}),o._focusView(a)}}),e.kendoStop(!0,!0).kendoAnimate(r))},_cellByDate:function(e){return this._table.find("td:not(."+J+")").filter(function(){return t(this.firstChild).attr(b.attr(X))===e})},_class:function(e,n){var i,o=this,r=o._cellID,s=o._cell,a=o._view.toDateString(n);s&&s.removeAttr(pt).removeAttr("aria-label").removeAttr(H),n&&(i=o.options.disableDates(n)),s=o._table.find("td:not(."+J+")").removeClass(e).filter(function(){return t(this.firstChild).attr(b.attr(X))===a}).attr(pt,!0),(e===Z&&!o._active&&o.options.focusOnNav!==!1||i)&&(e=""),s.addClass(e),s[0]&&(o._cell=s),r&&(s.attr(H,r),o._table.removeAttr("aria-activedescendant").attr("aria-activedescendant",r))},_bindTable:function(t){t.on(rt,this._addClassProxy).on(it,this._removeClassProxy)},_click:function(t){var e=this,n=e.options,i=new Date(+e._current),o=e._toDateObject(t);D(o,0),e.options.disableDates(o)&&(o=e._value),e._view.setDate(i,o),e.navigateDown(s(i,n.min,n.max))},_focus:function(t){var e=this,n=e._view;0!==n.compare(t,e._current)?e.navigate(t):(e._current=t,e._class(Z,t))},_focusView:function(t,e){t&&this.focus(e)},_footer:function(n){var i=this,o=r(),s=i.element,a=s.find(".k-footer");return n?(a[0]||(a=t('').appendTo(s)),i._today=a.show().find(".k-link").html(n(o)).attr("title",b.toString(o,"D",i.options.culture)),i._toggle(),e):(i._toggle(!1),a.hide(),e)},_header:function(){var t,e=this,n=e.element;n.find(".k-header")[0]||n.html(''),t=n.find(".k-link").on(at+" "+lt+" "+rt+" "+it,h).click(!1),e._title=t.eq(1).on(V,function(){e._active=e.options.focusOnNav!==!1,e.navigateUp()}),e[ut]=t.eq(0).on(V,function(){e._active=e.options.focusOnNav!==!1,e.navigateToPast()}),e[dt]=t.eq(2).on(V,function(){e._active=e.options.focusOnNav!==!1,e.navigateToFuture()})},_navigate:function(t,e){var n=this,i=n._index+1,o=new vt(+n._current);t=n[t],t.hasClass(K)||(i>3?o.setFullYear(o.getFullYear()+100*e):x.views[i].setDate(o,e),n.navigate(o))},_option:function(t,n){var i,o=this,r=o.options,s=o._value||o._current;return n===e?r[t]:(n=A(n,r.format,r.culture),n&&(r[t]=new vt(+n),i=t===U?n>s:s>n,(i||v(s,n))&&(i&&(o._value=null),o._changeView=!0),o._changeView||(o._changeView=!(!r.month.content&&!r.month.empty)),o.navigate(o._value),o._toggle()),e)},_toggle:function(t){var n=this,i=n.options,o=n.options.disableDates(r()),s=n._today;t===e&&(t=a(r(),i.min,i.max)),s&&(s.off(V),t&&!o?s.addClass(et).removeClass(K).on(V,gt(n._todayClick,n)):s.removeClass(et).addClass(K).on(V,u))},_todayClick:function(t){var e=this,n=yt[e.options.depth],i=e.options.disableDates,o=r();t.preventDefault(),i(o)||(0===e._view.compare(e._current,o)&&e._index==n&&(e._changeView=!1),e._value=o,e.navigate(o,n),e.trigger($))},_toDateObject:function(e){var n=t(e).attr(b.attr(X)).split("/");return n=new vt(n[0],n[1],n[2])},_templates:function(){var t=this,e=t.options,n=e.footer,i=e.month,o=i.content,r=i.empty;t.month={content:M(''+(o||"#=data.value#")+" ",{useWithBlock:!!o}),empty:M(''+(r||" ")+" ",{useWithBlock:!!r})},t.footer=n!==!1?M(n||'#= kendo.toString(data,"D","'+e.culture+'") #',{useWithBlock:!1}):null}});C.plugin(_t),x={firstDayOfMonth:function(t){return new vt(t.getFullYear(),t.getMonth(),1)},firstVisibleDay:function(t,e){e=e||b.culture().calendar;for(var n=e.firstDay,i=new vt(t.getFullYear(),t.getMonth(),0,t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());i.getDay()!=n;)x.setTime(i,-1*ht);return i},setTime:function(t,e){var n=t.getTimezoneOffset(),i=new vt(t.getTime()+e),o=i.getTimezoneOffset()-n;t.setTime(i.getTime()+o*ct)},views:[{name:W,title:function(t,e,n,i){return d(i).months.names[t.getMonth()]+" "+t.getFullYear()},content:function(t){for(var e=this,n=0,o=t.min,r=t.max,s=t.date,a=t.dates,c=t.format,h=t.culture,u=t.url,f=u&&a[0],p=d(h),m=p.firstDay,v=p.days,y=l(v.names,m),_=l(v.namesShort,m),w=x.firstVisibleDay(s,p),k=e.first(s),C=e.last(s),S=e.toDateString,T=new vt,A='';7>n;n++)A+=''+_[n]+" ";return T=new vt(T.getFullYear(),T.getMonth(),T.getDate()),D(T,0),T=+T,i({cells:42,perRow:7,html:A+=' ',start:w,min:new vt(o.getFullYear(),o.getMonth(),o.getDate()),max:new vt(r.getFullYear(),r.getMonth(),r.getDate()),content:t.content,empty:t.empty,setter:e.setDate,disableDates:t.disableDates,build:function(t,e,n){var i=[],o=t.getDay(),r="",s="#";return(k>t||t>C)&&i.push(J),n(t)&&i.push(K),+t===T&&i.push("k-today"),(0===o||6===o)&&i.push("k-weekend"),f&&g(+t,a)&&(s=u.replace("{0}",b.toString(t,c,h)),r=" k-action-link"),{date:t,dates:a,ns:b.ns,title:b.toString(t,"D",h),value:t.getDate(),dateString:S(t),cssClass:i[0]?' class="'+i.join(" ")+'"':"",linkClass:r,url:s}}})},first:function(t){return x.firstDayOfMonth(t)},last:function(t){var e=new vt(t.getFullYear(),t.getMonth()+1,0),n=x.firstDayOfMonth(t),i=Math.abs(e.getTimezoneOffset()-n.getTimezoneOffset());return i&&e.setHours(n.getHours()+i/60),e},compare:function(t,e){var n,i=t.getMonth(),o=t.getFullYear(),r=e.getMonth(),s=e.getFullYear();return n=o>s?1:s>o?-1:i==r?0:i>r?1:-1},setDate:function(t,e){var n=t.getHours();e instanceof vt?t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()):x.setTime(t,e*ht),D(t,n)},toDateString:function(t){return t.getFullYear()+"/"+t.getMonth()+"/"+t.getDate()}},{name:"year",title:function(t){return t.getFullYear()},content:function(t){var e=d(t.culture).months.namesAbbr,n=this.toDateString,o=t.min,r=t.max;return i({min:new vt(o.getFullYear(),o.getMonth(),1),max:new vt(r.getFullYear(),r.getMonth(),1),start:new vt(t.date.getFullYear(),0,1),setter:this.setDate,build:function(t){return{value:e[t.getMonth()],ns:b.ns,dateString:n(t),cssClass:""}}})},first:function(t){return new vt(t.getFullYear(),0,t.getDate())},last:function(t){return new vt(t.getFullYear(),11,t.getDate())},compare:function(t,e){return o(t,e)},setDate:function(t,e){var n,i=t.getHours();e instanceof vt?(n=e.getMonth(),t.setFullYear(e.getFullYear(),n,t.getDate()),n!==t.getMonth()&&t.setDate(0)):(n=t.getMonth()+e,t.setMonth(n),n>11&&(n-=12),n>0&&t.getMonth()!=n&&t.setDate(0)),D(t,i)},toDateString:function(t){return t.getFullYear()+"/"+t.getMonth()+"/1"}},{name:"decade",title:function(t,e,i){return n(t,e,i,10)},content:function(t){var e=t.date.getFullYear(),n=this.toDateString;return i({start:new vt(e-e%10-1,0,1),min:new vt(t.min.getFullYear(),0,1),max:new vt(t.max.getFullYear(),0,1),setter:this.setDate,build:function(t,e){return{value:t.getFullYear(),ns:b.ns,dateString:n(t),cssClass:0===e||11==e?tt:""}}})},first:function(t){var e=t.getFullYear();return new vt(e-e%10,t.getMonth(),t.getDate())},last:function(t){var e=t.getFullYear();return new vt(e-e%10+9,t.getMonth(),t.getDate())},compare:function(t,e){return o(t,e,10)},setDate:function(t,e){c(t,e,1)},toDateString:function(t){return t.getFullYear()+"/0/1"}},{name:q,title:function(t,e,i){return n(t,e,i,100)},content:function(t){var e=t.date.getFullYear(),n=t.min.getFullYear(),o=t.max.getFullYear(),r=this.toDateString,s=n,a=o;return s-=s%10,a-=a%10,10>a-s&&(a=s+9),i({start:new vt(e-e%100-10,0,1),min:new vt(s,0,1),max:new vt(a,0,1),setter:this.setDate,build:function(t,e){var i=t.getFullYear(),s=i+9;return n>i&&(i=n),s>o&&(s=o),{ns:b.ns,value:i+" - "+s,dateString:r(t),cssClass:0===e||11==e?tt:""}}})},first:function(t){var e=t.getFullYear();return new vt(e-e%100,t.getMonth(),t.getDate())},last:function(t){var e=t.getFullYear();return new vt(e-e%100+99,t.getMonth(),t.getDate())},compare:function(t,e){return o(t,e,100)},setDate:function(t,e){c(t,e,10)},toDateString:function(t){var e=t.getFullYear();return e-e%10+"/0/1"}}]},x.isEqualDatePart=m,x.makeUnselectable=p,x.restrictValue=s,x.isInRange=a,x.normalize=f,x.viewsEnum=yt,x.disabled=y,b.calendar=x}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.datepicker.min",["kendo.calendar.min","kendo.popup.min"],t)}(function(){return function(t,e){function n(e){var n=e.parseFormats,i=e.format;R.normalize(e),n=t.isArray(n)?n:[n],n.length||n.push("yyyy-MM-dd"),-1===t.inArray(i,n)&&n.splice(0,0,e.format),e.parseFormats=n}function i(t){t.preventDefault()}var o,r=window.kendo,s=r.ui,a=s.Widget,l=r.parseDate,c=r.keys,h=r.template,u=r._activeElement,d="
",f=" ",p=".kendoDatePicker",g="click"+p,m="open",v="close",y="change",_="disabled",w="readonly",x="k-state-default",b="k-state-focused",k="k-state-selected",C="k-state-disabled",S="k-state-hover",T="mouseenter"+p+" mouseleave"+p,A="mousedown"+p,D="id",P="min",M="max",E="month",B="aria-disabled",I="aria-expanded",z="aria-hidden",L="aria-readonly",R=r.calendar,O=R.isInRange,F=R.restrictValue,V=R.isEqualDatePart,N=t.extend,H=t.proxy,U=Date,j=function(e){var n,i=this,o=document.body,a=t(d).attr(z,"true").addClass("k-calendar-container").appendTo(o);i.options=e=e||{},n=e.id,n&&(n+="_dateview",a.attr(D,n),i._dateViewID=n),i.popup=new s.Popup(a,N(e.popup,e,{name:"Popup",isRtl:r.support.isRtl(e.anchor)})),i.div=a,i.value(e.value)};j.prototype={_calendar:function(){var e,n=this,o=n.calendar,a=n.options;o||(e=t(d).attr(D,r.guid()).appendTo(n.popup.element).on(A,i).on(g,"td:has(.k-link)",H(n._click,n)),n.calendar=o=new s.Calendar(e),n._setOptions(a),r.calendar.makeUnselectable(o.element),o.navigate(n._value||n._current,a.start),n.value(n._value))},_setOptions:function(t){this.calendar.setOptions({focusOnNav:!1,change:t.change,culture:t.culture,dates:t.dates,depth:t.depth,footer:t.footer,format:t.format,max:t.max,min:t.min,month:t.month,start:t.start,disableDates:t.disableDates})},setOptions:function(t){var e=this.options;this.options=N(e,t,{change:e.change,close:e.close,open:e.open}),this.calendar&&this._setOptions(this.options)},destroy:function(){this.popup.destroy()},open:function(){var t=this;t._calendar(),t.popup.open()},close:function(){this.popup.close()},min:function(t){this._option(P,t)},max:function(t){this._option(M,t)},toggle:function(){var t=this;t[t.popup.visible()?v:m]()},move:function(t){var e=this,n=t.keyCode,i=e.calendar,o=t.ctrlKey&&n==c.DOWN||n==c.ENTER,r=!1;if(t.altKey)n==c.DOWN?(e.open(),t.preventDefault(),r=!0):n==c.UP&&(e.close(),t.preventDefault(),r=!0);else if(e.popup.visible()){if(n==c.ESC||o&&i._cell.hasClass(k))return e.close(),t.preventDefault(),!0;e._current=i._move(t),r=!0}return r},current:function(t){this._current=t,this.calendar._focus(t)},value:function(t){var e=this,n=e.calendar,i=e.options,o=i.disableDates;o&&o(t)&&(t=null),e._value=t,e._current=new U(+F(t,i.min,i.max)),n&&n.value(t)},_click:function(t){-1!==t.currentTarget.className.indexOf(k)&&this.close()},_option:function(t,e){var n=this,i=n.calendar;n.options[t]=e,i&&i[t](e)}},j.normalize=n,r.DateView=j,o=a.extend({init:function(e,i){var o,s,c=this;a.fn.init.call(c,e,i),e=c.element,i=c.options,i.disableDates=r.calendar.disabled(i.disableDates),i.min=l(e.attr("min"))||l(i.min),i.max=l(e.attr("max"))||l(i.max),n(i),c._initialOptions=N({},i),c._wrapper(),c.dateView=new j(N({},i,{id:e.attr(D),anchor:c.wrapper,change:function(){c._change(this.value()),c.close()},close:function(t){c.trigger(v)?t.preventDefault():(e.attr(I,!1),s.attr(z,!0))},open:function(t){var n,i=c.options;c.trigger(m)?t.preventDefault():(c.element.val()!==c._oldText&&(n=l(e.val(),i.parseFormats,i.culture),c.dateView[n?"current":"value"](n)),e.attr(I,!0),s.attr(z,!1),c._updateARIA(n))}})),s=c.dateView.div,c._icon();try{e[0].setAttribute("type","text")}catch(h){e[0].type="text"}e.addClass("k-input").attr({role:"combobox","aria-expanded":!1,"aria-owns":c.dateView._dateViewID}),c._reset(),c._template(),o=e.is("[disabled]")||t(c.element).parents("fieldset").is(":disabled"),o?c.enable(!1):c.readonly(e.is("[readonly]")),c._old=c._update(i.value||c.element.val()),c._oldText=e.val(),r.notify(c)},events:[m,v,y],options:{name:"DatePicker",value:null,footer:"",format:"",culture:"",parseFormats:[],min:new Date(1900,0,1),max:new Date(2099,11,31),start:E,depth:E,animation:{},month:{},dates:[],ARIATemplate:'Current focused date is #=kendo.toString(data.current, "D")#'},setOptions:function(t){var e=this,i=e._value;a.fn.setOptions.call(e,t),t=e.options,t.min=l(t.min),t.max=l(t.max),n(t),e.dateView.setOptions(t),i&&(e.element.val(r.toString(i,t.format,t.culture)),e._updateARIA(i))},_editable:function(t){var e=this,n=e._dateIcon.off(p),o=e.element.off(p),r=e._inputWrapper.off(p),s=t.readonly,a=t.disable;s||a?(r.addClass(a?C:x).removeClass(a?x:C),o.attr(_,a).attr(w,s).attr(B,a).attr(L,s)):(r.addClass(x).removeClass(C).on(T,e._toggleHover),o.removeAttr(_).removeAttr(w).attr(B,!1).attr(L,!1).on("keydown"+p,H(e._keydown,e)).on("focusout"+p,H(e._blur,e)).on("focus"+p,function(){e._inputWrapper.addClass(b)}),n.on(g,H(e._click,e)).on(A,i))},readonly:function(t){this._editable({readonly:t===e?!0:t,disable:!1})},enable:function(t){this._editable({readonly:!1,disable:!(t=t===e?!0:t)})},destroy:function(){var t=this;a.fn.destroy.call(t),t.dateView.destroy(),t.element.off(p),t._dateIcon.off(p),t._inputWrapper.off(p),t._form&&t._form.off("reset",t._resetHandler)},open:function(){this.dateView.open()},close:function(){this.dateView.close()},min:function(t){return this._option(P,t)},max:function(t){return this._option(M,t)},value:function(t){var n=this;return t===e?n._value:(n._old=n._update(t),null===n._old&&n.element.val(""),n._oldText=n.element.val(),e)},_toggleHover:function(e){t(e.currentTarget).toggleClass(S,"mouseenter"===e.type)},_blur:function(){var t=this,e=t.element.val();t.close(),e!==t._oldText&&t._change(e),t._inputWrapper.removeClass(b)},_click:function(){var t=this,e=t.element;t.dateView.toggle(),r.support.touch||e[0]===u()||e.focus()},_change:function(t){var e,n,i,o=this,r=o.element.val();t=o._update(t),e=+o._old!=+t,n=e&&!o._typing,i=r!==o.element.val(),(n||i)&&o.element.trigger(y),e&&(o._old=t,o._oldText=o.element.val(),o.trigger(y)),o._typing=!1},_keydown:function(t){var e=this,n=e.dateView,i=e.element.val(),o=!1;n.popup.visible()||t.keyCode!=c.ENTER||i===e._oldText?(o=n.move(t),e._updateARIA(n._current),o||(e._typing=!0)):e._change(i)},_icon:function(){var e,n=this,i=n.element;e=i.next("span.k-select"),e[0]||(e=t('select ').insertAfter(i)),n._dateIcon=e.attr({role:"button","aria-controls":n.dateView._dateViewID})},_option:function(t,n){var i=this,o=i.options;return n===e?o[t]:(n=l(n,o.parseFormats,o.culture),n&&(o[t]=new U(+n),i.dateView[t](n)),e)},_update:function(t){var e,n=this,i=n.options,o=i.min,s=i.max,a=n._value,c=l(t,i.parseFormats,i.culture),h=null===c&&null===a||c instanceof Date&&a instanceof Date;return i.disableDates(c)&&(c=null,n._old||(t=null)),+c===+a&&h?(e=r.toString(c,i.format,i.culture),e!==t&&n.element.val(null===c?t:e),c):(null!==c&&V(c,o)?c=F(c,o,s):O(c,o,s)||(c=null),n._value=c,n.dateView.value(c),n.element.val(c?r.toString(c,i.format,i.culture):t),n._updateARIA(c),c)},_wrapper:function(){var e,n=this,i=n.element;e=i.parents(".k-datepicker"),e[0]||(e=i.wrap(f).parent().addClass("k-picker-wrap k-state-default"),e=e.wrap(f).parent()),e[0].style.cssText=i[0].style.cssText,i.css({width:"100%",height:i[0].style.height}),n.wrapper=e.addClass("k-widget k-datepicker k-header").addClass(i[0].className),n._inputWrapper=t(e[0].firstChild)},_reset:function(){var e=this,n=e.element,i=n.attr("form"),o=i?t("#"+i):n.closest("form");o[0]&&(e._resetHandler=function(){e.value(n[0].defaultValue),e.max(e._initialOptions.max),e.min(e._initialOptions.min)},e._form=o.on("reset",e._resetHandler))},_template:function(){this._ariaTemplate=h(this.options.ARIATemplate)},_updateARIA:function(t){var e,n=this,i=n.dateView.calendar;n.element.removeAttr("aria-activedescendant"),i&&(e=i._cell,e.attr("aria-label",n._ariaTemplate({current:t||i.current()})),n.element.attr("aria-activedescendant",e.attr("id")))}}),s.plugin(o)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.numerictextbox.min",["kendo.core.min","kendo.userevents.min"],t)}(function(){return function(t,e){function n(t,e){return''+e+" "}var i=window.kendo,o=i.caret,r=i.keys,s=i.ui,a=s.Widget,l=i._activeElement,c=i._extractFormat,h=i.parseFloat,u=i.support.placeholder,d=i.getCulture,f=i._round,p="change",g="disabled",m="readonly",v="k-input",y="spin",_=".kendoNumericTextBox",w="touchend",x="mouseleave"+_,b="mouseenter"+_+" "+x,k="k-state-default",C="k-state-focused",S="k-state-hover",T="focus",A=".",D="k-state-selected",P="k-state-disabled",M="aria-disabled",E="aria-readonly",B=/^(-)?(\d*)$/,I=null,z=t.proxy,L=t.extend,R=a.extend({init:function(n,o){var r,s,l,h,u,d=this,f=o&&o.step!==e;a.fn.init.call(d,n,o),o=d.options,n=d.element.on("focusout"+_,z(d._focusout,d)).attr("role","spinbutton"),o.placeholder=o.placeholder||n.attr("placeholder"),d._initialOptions=L({},o),d._reset(),d._wrapper(),d._arrows(),d._input(),i.support.mobileOS?d._text.on(w+_+" "+T+_,function(){d._toggleText(!1),n.focus()}):d._text.on(T+_,z(d._click,d)),r=d.min(n.attr("min")),s=d.max(n.attr("max")),l=d._parse(n.attr("step")),o.min===I&&r!==I&&(o.min=r),o.max===I&&s!==I&&(o.max=s),f||l===I||(o.step=l),n.attr("aria-valuemin",o.min).attr("aria-valuemax",o.max),o.format=c(o.format),h=o.value,d.value(h!==I?h:n.val()),u=n.is("[disabled]")||t(d.element).parents("fieldset").is(":disabled"),u?d.enable(!1):d.readonly(n.is("[readonly]")),i.notify(d)},options:{name:"NumericTextBox",decimals:I,min:I,max:I,value:I,step:1,culture:"",format:"n",spinners:!0,placeholder:"",upArrowText:"Increase value",downArrowText:"Decrease value"},events:[p,y],_editable:function(t){var e=this,n=e.element,i=t.disable,o=t.readonly,r=e._text.add(n),s=e._inputWrapper.off(b);e._toggleText(!0),e._upArrowEventHandler.unbind("press"),e._downArrowEventHandler.unbind("press"),n.off("keydown"+_).off("keypress"+_).off("paste"+_),o||i?(s.addClass(i?P:k).removeClass(i?k:P),r.attr(g,i).attr(m,o).attr(M,i).attr(E,o)):(s.addClass(k).removeClass(P).on(b,e._toggleHover),r.removeAttr(g).removeAttr(m).attr(M,!1).attr(E,!1),e._upArrowEventHandler.bind("press",function(t){t.preventDefault(),e._spin(1),e._upArrow.addClass(D)}),e._downArrowEventHandler.bind("press",function(t){t.preventDefault(),e._spin(-1),e._downArrow.addClass(D)}),e.element.on("keydown"+_,z(e._keydown,e)).on("keypress"+_,z(e._keypress,e)).on("paste"+_,z(e._paste,e)))},readonly:function(t){this._editable({readonly:t===e?!0:t,disable:!1})},enable:function(t){this._editable({readonly:!1,disable:!(t=t===e?!0:t)})},destroy:function(){var t=this;t.element.add(t._text).add(t._upArrow).add(t._downArrow).add(t._inputWrapper).off(_),t._upArrowEventHandler.destroy(),t._downArrowEventHandler.destroy(),t._form&&t._form.off("reset",t._resetHandler),a.fn.destroy.call(t)},min:function(t){return this._option("min",t)},max:function(t){return this._option("max",t)},step:function(t){return this._option("step",t)},value:function(t){var n,i=this;return t===e?i._value:(t=i._parse(t),n=i._adjust(t),t===n&&(i._update(t),i._old=i._value),e)},focus:function(){this._focusin()},_adjust:function(t){var e=this,n=e.options,i=n.min,o=n.max;return t===I?t:(i!==I&&i>t?t=i:o!==I&&t>o&&(t=o),t)},_arrows:function(){var e,o=this,r=function(){clearTimeout(o._spinning),e.removeClass(D)},s=o.options,a=s.spinners,l=o.element;e=l.siblings(".k-icon"),e[0]||(e=t(n("n",s.upArrowText)+n("s",s.downArrowText)).insertAfter(l),e.wrapAll(' ')),a||(e.parent().toggle(a),o._inputWrapper.addClass("k-expand-padding")),o._upArrow=e.eq(0),o._upArrowEventHandler=new i.UserEvents(o._upArrow,{release:r}),o._downArrow=e.eq(1),o._downArrowEventHandler=new i.UserEvents(o._downArrow,{release:r})},_blur:function(){var t=this;t._toggleText(!0),t._change(t.element.val())},_click:function(t){var e=this;clearTimeout(e._focusing),e._focusing=setTimeout(function(){var n,i,r,s=t.target,a=o(s)[0],l=s.value.substring(0,a),c=e._format(e.options.format),h=c[","],u=0;h&&(i=RegExp("\\"+h,"g"),r=RegExp("([\\d\\"+h+"]+)(\\"+c[A]+")?(\\d+)?")),r&&(n=r.exec(l)),n&&(u=n[0].replace(i,"").length,-1!=l.indexOf("(")&&0>e._value&&u++),e._focusin(),o(e.element[0],u)})},_change:function(t){var e=this;e._update(t),t=e._value,e._old!=t&&(e._old=t,e._typing||e.element.trigger(p),e.trigger(p)),e._typing=!1},_culture:function(t){return t||d(this.options.culture)},_focusin:function(){var t=this;t._inputWrapper.addClass(C),t._toggleText(!1),t.element[0].focus()},_focusout:function(){var t=this;clearTimeout(t._focusing),t._inputWrapper.removeClass(C).removeClass(S),t._blur()},_format:function(t,e){var n=this._culture(e).numberFormat;return t=t.toLowerCase(),t.indexOf("c")>-1?n=n.currency:t.indexOf("p")>-1&&(n=n.percent),n},_input:function(){var e,n=this,i="k-formatted-value",o=n.element.addClass(v).show()[0],r=o.accessKey,s=n.wrapper;e=s.find(A+i),e[0]||(e=t(' ').insertBefore(o).addClass(i));try{o.setAttribute("type","text")}catch(a){o.type="text"}e[0].tabIndex=o.tabIndex,e[0].style.cssText=o.style.cssText,e[0].title=o.title,e.prop("placeholder",n.options.placeholder),r&&(e.attr("accesskey",r),o.accessKey=""),n._text=e.addClass(o.className)},_keydown:function(t){var e=this,n=t.keyCode;e._key=n,n==r.DOWN?e._step(-1):n==r.UP?e._step(1):n==r.ENTER?e._change(e.element.val()):e._typing=!0},_keypress:function(t){var e,n,i,s,a,l,c,h,u,d,f;0===t.which||t.metaKey||t.ctrlKey||t.keyCode===r.BACKSPACE||t.keyCode===r.ENTER||(e=this,n=e.options.min,i=e.element,s=o(i),a=s[0],l=s[1],c=String.fromCharCode(t.which),h=e._format(e.options.format),u=e._key===r.NUMPAD_DOT,d=i.val(),u&&(c=h[A]),d=d.substring(0,a)+c+d.substring(l),f=e._numericRegex(h).test(d),f&&u?(i.val(d),o(i,a+c.length),t.preventDefault()):(null!==n&&n>=0&&"-"===d.charAt(0)||!f)&&t.preventDefault(),e._key=0)},_numericRegex:function(t){var e=this,n=t[A],i=e.options.decimals;return n===A&&(n="\\"+n),i===I&&(i=t.decimals),0===i?B:(e._separator!==n&&(e._separator=n,e._floatRegExp=RegExp("^(-)?(((\\d+("+n+"\\d*)?)|("+n+"\\d*)))?$")),e._floatRegExp)},_paste:function(t){var e=this,n=t.target,i=n.value;setTimeout(function(){e._parse(n.value)===I&&e._update(i)})},_option:function(t,n){var i=this,o=i.options;return n===e?o[t]:(n=i._parse(n),(n||"step"!==t)&&(o[t]=n,i.element.attr("aria-value"+t,n).attr(t,n)),e)},_spin:function(t,e){var n=this;e=e||500,clearTimeout(n._spinning),n._spinning=setTimeout(function(){n._spin(t,50)},e),n._step(t)},_step:function(t){var e=this,n=e.element,i=e._parse(n.val())||0;l()!=n[0]&&e._focusin(),i+=e.options.step*t,e._update(e._adjust(i)),e._typing=!1,e.trigger(y)},_toggleHover:function(e){t(e.currentTarget).toggleClass(S,"mouseenter"===e.type)},_toggleText:function(t){var e=this;e._text.toggle(t),e.element.toggle(!t)},_parse:function(t,e){return h(t,this._culture(e),this.options.format)},_update:function(t){var e,n=this,o=n.options,r=o.format,s=o.decimals,a=n._culture(),l=n._format(r,a);s===I&&(s=l.decimals),t=n._parse(t,a),e=t!==I,e&&(t=parseFloat(f(t,s))),n._value=t=n._adjust(t),n._placeholder(i.toString(t,r,a)),e?(t=""+t,-1!==t.indexOf("e")&&(t=f(+t,s)),t=t.replace(A,l[A])):t="",n.element.val(t).attr("aria-valuenow",t)},_placeholder:function(t){this._text.val(t),u||t||this._text.val(this.options.placeholder)},_wrapper:function(){var e,n=this,i=n.element,o=i[0];e=i.parents(".k-numerictextbox"),e.is("span.k-numerictextbox")||(e=i.hide().wrap(' ').parent(),
e=e.wrap(" ").parent()),e[0].style.cssText=o.style.cssText,o.style.width="",n.wrapper=e.addClass("k-widget k-numerictextbox").addClass(o.className).css("display",""),n._inputWrapper=t(e[0].firstChild)},_reset:function(){var e=this,n=e.element,i=n.attr("form"),o=i?t("#"+i):n.closest("form");o[0]&&(e._resetHandler=function(){setTimeout(function(){e.value(n[0].value),e.max(e._initialOptions.max),e.min(e._initialOptions.min)})},e._form=o.on("reset",e._resetHandler))}});s.plugin(R)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.validator.min",["kendo.core.min"],t)}(function(){return function(t,e){function n(e){var n,i=l.ui.validator.ruleResolvers||{},o={};for(n in i)t.extend(!0,o,i[n].resolve(e));return o}function i(t){return t.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function o(t){return t=(t+"").split("."),t.length>1?t[1].length:0}function r(e){return t(t.parseHTML?t.parseHTML(e):e)}function s(e,n){var i,o,r,s,a=t();for(r=0,s=e.length;s>r;r++)i=e[r],d.test(i.className)&&(o=i.getAttribute(l.attr("for")),o===n&&(a=a.add(i)));return a}var a,l=window.kendo,c=l.ui.Widget,h=".kendoValidator",u="k-invalid-msg",d=RegExp(u,"i"),f="k-invalid",p="k-valid",g=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,m=/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,v=":input:not(:button,[type=submit],[type=reset],[disabled],[readonly])",y=":checkbox:not([disabled],[readonly])",_="[type=number],[type=range]",w="blur",x="name",b="form",k="novalidate",C=t.proxy,S=function(t,e){return"string"==typeof e&&(e=RegExp("^(?:"+e+")$")),e.test(t)},T=function(t,e,n){var i=t.val();return t.filter(e).length&&""!==i?S(i,n):!0},A=function(t,e){return t.length?null!=t[0].attributes[e]:!1};l.ui.validator||(l.ui.validator={rules:{},messages:{}}),a=c.extend({init:function(e,i){var o=this,r=n(e),s="["+l.attr("validate")+"!=false]";i=i||{},i.rules=t.extend({},l.ui.validator.rules,r.rules,i.rules),i.messages=t.extend({},l.ui.validator.messages,r.messages,i.messages),c.fn.init.call(o,e,i),o._errorTemplate=l.template(o.options.errorTemplate),o.element.is(b)&&o.element.attr(k,k),o._inputSelector=v+s,o._checkboxSelector=y+s,o._errors={},o._attachEvents(),o._isValidated=!1},events:["validate","change"],options:{name:"Validator",errorTemplate:' #=message# ',messages:{required:"{0} is required",pattern:"{0} is not valid",min:"{0} should be greater than or equal to {1}",max:"{0} should be smaller than or equal to {1}",step:"{0} is not valid",email:"{0} is not valid email",url:"{0} is not valid URL",date:"{0} is not valid date",dateCompare:"End date should be greater than or equal to the start date"},rules:{required:function(t){var e=t.filter("[type=checkbox]").length&&!t.is(":checked"),n=t.val();return!(A(t,"required")&&(""===n||!n||e))},pattern:function(t){return t.filter("[type=text],[type=email],[type=url],[type=tel],[type=search],[type=password]").filter("[pattern]").length&&""!==t.val()?S(t.val(),t.attr("pattern")):!0},min:function(t){if(t.filter(_+",["+l.attr("type")+"=number]").filter("[min]").length&&""!==t.val()){var e=parseFloat(t.attr("min"))||0,n=l.parseFloat(t.val());return n>=e}return!0},max:function(t){if(t.filter(_+",["+l.attr("type")+"=number]").filter("[max]").length&&""!==t.val()){var e=parseFloat(t.attr("max"))||0,n=l.parseFloat(t.val());return e>=n}return!0},step:function(t){if(t.filter(_+",["+l.attr("type")+"=number]").filter("[step]").length&&""!==t.val()){var e,n=parseFloat(t.attr("min"))||0,i=parseFloat(t.attr("step"))||1,r=parseFloat(t.val()),s=o(i);return s?(e=Math.pow(10,s),Math.floor((r-n)*e)%(i*e)/Math.pow(100,s)===0):(r-n)%i===0}return!0},email:function(t){return T(t,"[type=email],["+l.attr("type")+"=email]",g)},url:function(t){return T(t,"[type=url],["+l.attr("type")+"=url]",m)},date:function(t){return t.filter("[type^=date],["+l.attr("type")+"=date]").length&&""!==t.val()?null!==l.parseDate(t.val(),t.attr(l.attr("format"))):!0}},validateOnBlur:!0},destroy:function(){c.fn.destroy.call(this),this.element.off(h)},value:function(){return this._isValidated?0===this.errors().length:!1},_submit:function(t){return this.validate()?!0:(t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault(),!1)},_checkElement:function(t){var e=this.value();this.validateInput(t),this.value()!==e&&this.trigger("change")},_attachEvents:function(){var e=this;e.element.is(b)&&e.element.on("submit"+h,C(e._submit,e)),e.options.validateOnBlur&&(e.element.is(v)?(e.element.on(w+h,function(){e._checkElement(e.element)}),e.element.is(y)&&e.element.on("click"+h,function(){e._checkElement(e.element)})):(e.element.on(w+h,e._inputSelector,function(){e._checkElement(t(this))}),e.element.on("click"+h,e._checkboxSelector,function(){e._checkElement(t(this))})))},validate:function(){var t,e,n,i,o=!1,r=this.value();if(this._errors={},this.element.is(v))o=this.validateInput(this.element);else{for(i=!1,t=this.element.find(this._inputSelector),e=0,n=t.length;n>e;e++)this.validateInput(t.eq(e))||(i=!0);o=!i}return this.trigger("validate",{valid:o}),r!==o&&this.trigger("change"),o},validateInput:function(e){var n,o,s,a,c,h,d,g,m,v;return e=t(e),this._isValidated=!0,n=this,o=n._errorTemplate,s=n._checkValidity(e),a=s.valid,c="."+u,h=e.attr(x)||"",d=n._findMessageContainer(h).add(e.next(c).filter(function(){var e=t(this);return e.filter("["+l.attr("for")+"]").length?e.attr(l.attr("for"))===h:!0})).hide(),e.removeAttr("aria-invalid"),a?delete n._errors[h]:(g=n._extractMessage(e,s.key),n._errors[h]=g,m=r(o({message:i(g)})),v=d.attr("id"),n._decorateMessageContainer(m,h),v&&m.attr("id",v),d.replaceWith(m).length||m.insertAfter(e),m.show(),e.attr("aria-invalid",!0)),e.toggleClass(f,!a),e.toggleClass(p,a),a},hideMessages:function(){var t=this,e="."+u,n=t.element;n.is(v)?n.next(e).hide():n.find(e).hide()},_findMessageContainer:function(e){var n,i,o,r=l.ui.validator.messageLocators,a=t();for(i=0,o=this.element.length;o>i;i++)a=a.add(s(this.element[i].getElementsByTagName("*"),e));for(n in r)a=a.add(r[n].locate(this.element,e));return a},_decorateMessageContainer:function(t,e){var n,i=l.ui.validator.messageLocators;t.addClass(u).attr(l.attr("for"),e||"");for(n in i)i[n].decorate(t,e);t.attr("role","alert")},_extractMessage:function(t,e){var n=this,i=n.options.messages[e],o=t.attr(x);return i=l.isFunction(i)?i(t):i,l.format(t.attr(l.attr(e+"-msg"))||t.attr("validationMessage")||t.attr("title")||i||"",o,t.attr(e))},_checkValidity:function(t){var e,n=this.options.rules;for(e in n)if(!n[e].call(this,t))return{valid:!1,key:e};return{valid:!0}},errors:function(){var t,e=[],n=this._errors;for(t in n)e.push(n[t]);return e}}),l.ui.plugin(a)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.editable.min",["kendo.datepicker.min","kendo.numerictextbox.min","kendo.validator.min","kendo.binder.min"],t)}(function(){return function(t,e){function n(e){return e=null!=e?e:"",e.type||t.type(e)||"string"}function i(e){e.find(":input:not(:button, ["+a.attr("role")+"=upload], ["+a.attr("skip")+"], [type=file]), select").each(function(){var e=a.attr("bind"),n=this.getAttribute(e)||"",i="checkbox"===this.type||"radio"===this.type?"checked:":"value:",o=this.name;-1===n.indexOf(i)&&o&&(n+=(n.length?",":"")+i+o,t(this).attr(e,n))})}function o(t){var e,i,o=(t.model.fields||t.model)[t.field],r=n(o),s=o?o.validation:{},l=a.attr("type"),c=a.attr("bind"),h={name:t.field};for(e in s)i=s[e],p(e,y)>=0?h[l]=e:d(i)||(h[e]=f(i)?i.value||e:i),h[a.attr(e+"-msg")]=i.message;return p(r,y)>=0&&(h[l]=r),h[c]=("boolean"===r?"checked:":"value:")+t.field,h}function r(t){var e,n,i,o,r,s;if(t&&t.length)for(s=[],e=0,n=t.length;n>e;e++)i=t[e],r=i.text||i.value||i,o=null==i.value?i.text||i:i.value,s[e]={text:r,value:o};return s}function s(t,e){var n,i,o=t?t.validation||{}:{};for(n in o)i=o[n],f(i)&&i.value&&(i=i.value),d(i)&&(e[n]=i)}var a=window.kendo,l=a.ui,c=l.Widget,h=t.extend,u=a.support.browser.msie&&9>a.support.browser.version,d=a.isFunction,f=t.isPlainObject,p=t.inArray,g=/("|\%|'|\[|\]|\$|\.|\,|\:|\;|\+|\*|\&|\!|\#|\(|\)|<|>|\=|\?|\@|\^|\{|\}|\~|\/|\||`)/g,m='',v="change",y=["url","email","number","date","boolean"],_={number:function(e,n){var i=o(n);t(' ').attr(i).appendTo(e).kendoNumericTextBox({format:n.format}),t(" ').hide().appendTo(e)},date:function(e,n){var i=o(n),r=n.format;r&&(r=a._extractFormat(r)),i[a.attr("format")]=r,t(' ').attr(i).appendTo(e).kendoDatePicker({format:n.format}),t(" ').hide().appendTo(e)},string:function(e,n){var i=o(n);t(' ').attr(i).appendTo(e)},"boolean":function(e,n){var i=o(n);t(' ').attr(i).appendTo(e)},values:function(e,n){var i=o(n),s=a.stringify(r(n.values));t(" ').attr(i).appendTo(e),t(" ').hide().appendTo(e)}},w=c.extend({init:function(e,n){var i=this;n.target&&(n.$angular=n.target.options.$angular),c.fn.init.call(i,e,n),i._validateProxy=t.proxy(i._validate,i),i.refresh()},events:[v],options:{name:"Editable",editors:_,clearContainer:!0,errorTemplate:m},editor:function(t,e){var i=this,o=i.options.editors,r=f(t),s=r?t.field:t,l=i.options.model||{},c=r&&t.values,u=c?"values":n(e),d=r&&t.editor,p=d?t.editor:o[u],m=i.element.find("["+a.attr("container-for")+"="+s.replace(g,"\\$1")+"]");p=p?p:o.string,d&&"string"==typeof t.editor&&(p=function(e){e.append(t.editor)}),m=m.length?m:i.element,p(m,h(!0,{},r?t:{field:s},{model:l}))},_validate:function(e){var n,i=this,o=e.value,r=i._validationEventInProgress,s={},l=a.attr("bind"),c=e.field.replace(g,"\\$1"),h=RegExp("(value|checked)\\s*:\\s*"+c+"\\s*(,|$)");s[e.field]=e.value,n=t(":input["+l+'*="'+c+'"]',i.element).filter("["+a.attr("validate")+"!='false']").filter(function(){return h.test(t(this).attr(l))}),n.length>1&&(n=n.filter(function(){var e=t(this);return!e.is(":radio")||e.val()==o}));try{i._validationEventInProgress=!0,(!i.validatable.validateInput(n)||!r&&i.trigger(v,{values:s}))&&e.preventDefault()}finally{i._validationEventInProgress=!1}},end:function(){return this.validatable.validate()},destroy:function(){var t=this;t.angular("cleanup",function(){return{elements:t.element}}),c.fn.destroy.call(t),t.options.model.unbind("set",t._validateProxy),a.unbind(t.element),t.validatable&&t.validatable.destroy(),a.destroy(t.element),t.element.removeData("kendoValidator"),t.element.is("["+a.attr("role")+"=editable]")&&t.element.removeAttr(a.attr("role"))},refresh:function(){var n,o,r,l,c,h,d,p,g=this,m=g.options.fields||[],v=g.options.clearContainer?g.element.empty():g.element,y=g.options.model||{},_={};for(t.isArray(m)||(m=[m]),n=0,o=m.length;o>n;n++)r=m[n],l=f(r),c=l?r.field:r,h=(y.fields||y)[c],s(h,_),g.editor(r,h);if(g.options.target&&g.angular("compile",function(){return{elements:v,data:v.map(function(){return{dataItem:y}})}}),!o){d=y.fields||y;for(c in d)s(d[c],_)}i(v),g.validatable&&g.validatable.destroy(),a.bind(v,g.options.model),g.options.model.unbind("set",g._validateProxy),g.options.model.bind("set",g._validateProxy),g.validatable=new a.ui.Validator(v,{validateOnBlur:!1,errorTemplate:g.options.errorTemplate||e,rules:_}),p=v.find(":kendoFocusable").eq(0).focus(),u&&p.focus()}});l.plugin(w)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.window.min",["kendo.draganddrop.min"],t)}(function(){return function(t,e){function n(t){return e!==t}function i(t,e,n){return Math.max(Math.min(parseInt(t,10),n===1/0?n:parseInt(n,10)),parseInt(e,10))}function o(t,e){return function(){var n=this,i=n.wrapper,o=i[0].style,r=n.options;return r.isMaximized||r.isMinimized?n:(n.restoreOptions={width:o.width,height:o.height},i.children(k).hide().end().children(x).find(W).parent().hide().eq(0).before(J.action({name:"Restore"})),e.call(n),"maximize"==t?n.wrapper.children(x).find(Y).parent().hide():n.wrapper.children(x).find(Y).parent().show(),n)}}function r(){return!this.type||this.type.toLowerCase().indexOf("script")>=0}function s(t){var e=this;e.owner=t,e._draggable=new h(t.wrapper,{filter:">"+k,group:t.wrapper.id+"-resizing",dragstart:f(e.dragstart,e),drag:f(e.drag,e),dragend:f(e.dragend,e)}),e._draggable.userEvents.bind("press",f(e.addOverlay,e)),e._draggable.userEvents.bind("release",f(e.removeOverlay,e))}function a(t,e){var n=this;n.owner=t,n._draggable=new h(t.wrapper,{filter:e,group:t.wrapper.id+"-moving",dragstart:f(n.dragstart,n),drag:f(n.drag,n),dragend:f(n.dragend,n),dragcancel:f(n.dragcancel,n)}),n._draggable.userEvents.stopPropagation=!1}var l=window.kendo,c=l.ui.Widget,h=l.ui.Draggable,u=t.isPlainObject,d=l._activeElement,f=t.proxy,p=t.extend,g=t.each,m=l.template,v="body",y=".kendoWindow",_=".k-window",w=".k-window-title",x=w+"bar",b=".k-window-content",k=".k-resize-handle",C=".k-overlay",S="k-content-frame",T="k-loading",A="k-state-hover",D="k-state-focused",P="k-window-maximized",M=":visible",E="hidden",B="cursor",I="open",z="activate",L="deactivate",R="close",O="refresh",F="resize",V="resizeEnd",N="dragstart",H="dragend",U="error",j="overflow",G="zIndex",W=".k-window-actions .k-i-minimize,.k-window-actions .k-i-maximize",q=".k-i-pin",$=".k-i-unpin",Y=q+","+$,X=".k-window-titlebar .k-window-action",Q=".k-window-titlebar .k-i-refresh",K=l.isLocalUrl,Z=c.extend({init:function(i,o){var s,a,h,d,p,g,m,v=this,k={},C=!1,S=o&&o.actions&&!o.actions.length;c.fn.init.call(v,i,o),o=v.options,d=o.position,i=v.element,p=o.content,S&&(o.actions=[]),v.appendTo=t(o.appendTo),p&&!u(p)&&(p=o.content={url:p}),i.find("script").filter(r).remove(),i.parent().is(v.appendTo)||d.top!==e&&d.left!==e||(i.is(M)?(k=i.offset(),C=!0):(a=i.css("visibility"),h=i.css("display"),i.css({visibility:E,display:""}),k=i.offset(),i.css({visibility:a,display:h})),d.top===e&&(d.top=k.top),d.left===e&&(d.left=k.left)),n(o.visible)&&null!==o.visible||(o.visible=i.is(M)),s=v.wrapper=i.closest(_),i.is(".k-content")&&s[0]||(i.addClass("k-window-content k-content"),v._createWindow(i,o),s=v.wrapper=i.closest(_),v._dimensions()),v._position(),o.pinned&&v.pin(!0),p&&v.refresh(p),o.visible&&v.toFront(),g=s.children(b),v._tabindex(g),o.visible&&o.modal&&v._overlay(s.is(M)).css({opacity:.5}),s.on("mouseenter"+y,X,f(v._buttonEnter,v)).on("mouseleave"+y,X,f(v._buttonLeave,v)).on("click"+y,"> "+X,f(v._windowActionHandler,v)),g.on("keydown"+y,f(v._keydown,v)).on("focus"+y,f(v._focus,v)).on("blur"+y,f(v._blur,v)),this._resizable(),this._draggable(),m=i.attr("id"),m&&(m+="_wnd_title",s.children(x).children(w).attr("id",m),g.attr({role:"dialog","aria-labelledby":m})),s.add(s.children(".k-resize-handle,"+x)).on("mousedown"+y,f(v.toFront,v)),v.touchScroller=l.touchScroller(i),v._resizeHandler=f(v._onDocumentResize,v),v._marker=l.guid().substring(0,8),t(window).on("resize"+y+v._marker,v._resizeHandler),o.visible&&(v.trigger(I),v.trigger(z)),l.notify(v)},_buttonEnter:function(e){t(e.currentTarget).addClass(A)},_buttonLeave:function(e){t(e.currentTarget).removeClass(A)},_focus:function(){this.wrapper.addClass(D)},_blur:function(){this.wrapper.removeClass(D)},_dimensions:function(){var t,e,n=this.wrapper,o=this.options,r=o.width,s=o.height,a=o.maxHeight,l=["minWidth","minHeight","maxWidth","maxHeight"];for(this.title(o.title),t=0;l.length>t;t++)e=o[l[t]],e&&e!=1/0&&n.css(l[t],e);a&&a!=1/0&&this.element.css("maxHeight",a),r&&n.width((""+r).indexOf("%")>0?r:i(r,o.minWidth,o.maxWidth)),s&&n.height((""+s).indexOf("%")>0?s:i(s,o.minHeight,o.maxHeight)),o.visible||n.hide()},_position:function(){var t=this.wrapper,e=this.options.position;0===e.top&&(e.top=""+e.top),0===e.left&&(e.left=""+e.left),t.css({top:e.top||"",left:e.left||""})},_animationOptions:function(t){var e=this.options.animation,n={open:{effects:{}},close:{hide:!0,effects:{}}};return e&&e[t]||n[t]},_resize:function(){l.resize(this.element.children())},_resizable:function(){var e=this.options.resizable,n=this.wrapper;this.resizing&&(n.off("dblclick"+y).children(k).remove(),this.resizing.destroy(),this.resizing=null),e&&(n.on("dblclick"+y,x,f(function(e){t(e.target).closest(".k-window-action").length||this.toggleMaximization()},this)),g("n e s w se sw ne nw".split(" "),function(t,e){n.append(J.resizeHandle(e))}),this.resizing=new s(this)),n=null},_draggable:function(){var t=this.options.draggable;this.dragging&&(this.dragging.destroy(),this.dragging=null),t&&(this.dragging=new a(this,t.dragHandle||x))},_actions:function(){var e=this.options.actions,n=this.wrapper.children(x),i=n.find(".k-window-actions");e=t.map(e,function(t){return{name:t}}),i.html(l.render(J.action,e))},setOptions:function(t){var n,i;c.fn.setOptions.call(this,t),n=this.options.scrollable!==!1,this.restore(),this._dimensions(),this._position(),this._resizable(),this._draggable(),this._actions(),e!==t.modal&&(i=this.options.visible!==!1,this._overlay(t.modal&&i)),this.element.css(j,n?"":"hidden")},events:[I,z,L,R,O,F,V,N,H,U],options:{name:"Window",animation:{open:{effects:{zoom:{direction:"in"},fade:{direction:"in"}},duration:350},close:{effects:{zoom:{direction:"out",properties:{scale:.7}},fade:{direction:"out"}},duration:350,hide:!0}},title:"",actions:["Close"],autoFocus:!0,modal:!1,resizable:!0,draggable:!0,minWidth:90,minHeight:50,maxWidth:1/0,maxHeight:1/0,pinned:!1,scrollable:!0,position:{},content:null,visible:null,height:null,width:null,appendTo:"body"},_closable:function(){return t.inArray("close",t.map(this.options.actions,function(t){return t.toLowerCase()}))>-1},_keydown:function(t){var e,n,o,r,s,a,c=this,h=c.options,u=l.keys,d=t.keyCode,f=c.wrapper,p=10,g=c.options.isMaximized;t.target!=t.currentTarget||c._closing||(d==u.ESC&&c._closable()&&c._close(!1),!h.draggable||t.ctrlKey||g||(e=l.getOffset(f),d==u.UP?n=f.css("top",e.top-p):d==u.DOWN?n=f.css("top",e.top+p):d==u.LEFT?n=f.css("left",e.left-p):d==u.RIGHT&&(n=f.css("left",e.left+p))),h.resizable&&t.ctrlKey&&!g&&(d==u.UP?(n=!0,r=f.height()-p):d==u.DOWN&&(n=!0,r=f.height()+p),d==u.LEFT?(n=!0,o=f.width()-p):d==u.RIGHT&&(n=!0,o=f.width()+p),n&&(s=i(o,h.minWidth,h.maxWidth),a=i(r,h.minHeight,h.maxHeight),isNaN(s)||(f.width(s),c.options.width=s+"px"),isNaN(a)||(f.height(a),c.options.height=a+"px"),c.resize())),n&&t.preventDefault())},_overlay:function(e){var n=this.appendTo.children(C),i=this.wrapper;return n.length||(n=t("
")),n.insertBefore(i[0]).toggle(e).css(G,parseInt(i.css(G),10)-1),n},_actionForIcon:function(t){var e=/\bk-i-\w+\b/.exec(t[0].className)[0];return{"k-i-close":"_close","k-i-maximize":"maximize","k-i-minimize":"minimize","k-i-restore":"restore","k-i-refresh":"refresh","k-i-pin":"pin","k-i-unpin":"unpin"}[e]},_windowActionHandler:function(n){var i,o;if(!this._closing)return i=t(n.target).closest(".k-window-action").find(".k-icon"),o=this._actionForIcon(i),o?(n.preventDefault(),this[o](),!1):e},_modals:function(){var e=this,n=t(_).filter(function(){var n=t(this),i=e._object(n),o=i&&i.options;return o&&o.modal&&o.visible&&o.appendTo===e.options.appendTo&&n.is(M)}).sort(function(e,n){return+t(e).css("zIndex")-+t(n).css("zIndex")});return e=null,n},_object:function(t){var n=t.children(b),i=l.widgetInstance(n);return i instanceof Z?i:e},center:function(){var e,n,i=this,o=i.options.position,r=i.wrapper,s=t(window),a=0,l=0;return i.options.isMaximized?i:(i.options.pinned||(a=s.scrollTop(),l=s.scrollLeft()),n=l+Math.max(0,(s.width()-r.width())/2),e=a+Math.max(0,(s.height()-r.height()-parseInt(r.css("paddingTop"),10))/2),r.css({left:n,top:e}),o.top=e,o.left=n,i)},title:function(t){var e,n=this,i=n.wrapper,o=n.options,r=i.children(x),s=r.children(w);return arguments.length?(t===!1?(i.addClass("k-window-titleless"),r.remove()):(r.length?s.html(t):(i.prepend(J.titlebar(o)),n._actions(),r=i.children(x)),e=r.outerHeight(),i.css("padding-top",e),r.css("margin-top",-e)),n.options.title=t,n):s.html()},content:function(t,e){var i=this.wrapper.children(b),o=i.children(".km-scroll-container");return i=o[0]?o:i,n(t)?(this.angular("cleanup",function(){return{elements:i.children()}}),l.destroy(this.element.children()),i.empty().html(t),this.angular("compile",function(){var t,n=[];for(t=i.length;--t>=0;)n.push({dataItem:e});return{elements:i.children(),data:n}}),this):i.html()},open:function(){var e,n,i=this,o=i.wrapper,r=i.options,s=this._animationOptions("open"),a=o.children(b),c=t(document);return i.trigger(I)||(i._closing&&o.kendoStop(!0,!0),i._closing=!1,i.toFront(),r.autoFocus&&i.element.focus(),r.visible=!0,r.modal&&(e=i._overlay(!1),e.kendoStop(!0,!0),s.duration&&l.effects.Fade?(n=l.fx(e).fadeIn(),n.duration(s.duration||0),n.endValue(.5),n.play()):e.css("opacity",.5),e.show()),o.is(M)||(a.css(j,E),o.show().kendoStop().kendoAnimate({effects:s.effects,duration:s.duration,complete:f(this._activate,this)}))),r.isMaximized&&(i._documentScrollTop=c.scrollTop(),i._documentScrollLeft=c.scrollLeft(),t("html, body").css(j,E)),i},_activate:function(){var t=this.options.scrollable!==!1;this.options.autoFocus&&this.element.focus(),this.element.css(j,t?"":"hidden"),this.trigger(z)},_removeOverlay:function(n){var i,o=this._modals(),r=this.options,s=r.modal&&!o.length,a=r.modal?this._overlay(!0):t(e),c=this._animationOptions("close");s?!n&&c.duration&&l.effects.Fade?(i=l.fx(a).fadeOut(),i.duration(c.duration||0),i.startValue(.5),i.play()):this._overlay(!1).remove():o.length&&this._object(o.last())._overlay(!0)},_close:function(e){var n=this,i=n.wrapper,o=n.options,r=this._animationOptions("open"),s=this._animationOptions("close"),a=t(document);if(i.is(M)&&!n.trigger(R,{userTriggered:!e})){if(n._closing)return;n._closing=!0,o.visible=!1,t(_).each(function(e,n){var o=t(n).children(b);n!=i&&o.find("> ."+S).length>0&&o.children(C).remove()}),this._removeOverlay(),i.kendoStop().kendoAnimate({effects:s.effects||r.effects,reverse:s.reverse===!0,duration:s.duration,complete:f(this._deactivate,this)})}n.options.isMaximized&&(t("html, body").css(j,""),n._documentScrollTop&&n._documentScrollTop>0&&a.scrollTop(n._documentScrollTop),n._documentScrollLeft&&n._documentScrollLeft>0&&a.scrollLeft(n._documentScrollLeft))},_deactivate:function(){var t,e=this;e.wrapper.hide().css("opacity",""),e.trigger(L),e.options.modal&&(t=e._object(e._modals().last()),t&&t.toFront())},close:function(){return this._close(!0),this},_actionable:function(e){return t(e).is(X+","+X+" .k-icon,:input,a")},_shouldFocus:function(e){var n=d(),i=this.element;return this.options.autoFocus&&!t(n).is(i)&&!this._actionable(e)&&(!i.find(n).length||!i.find(e).length)},toFront:function(e){var n,i,o=this,r=o.wrapper,s=r[0],a=+r.css(G),l=a,c=e&&e.target||null;return t(_).each(function(e,n){var i=t(n),o=i.css(G),r=i.children(b);isNaN(o)||(a=Math.max(+o,a)),n!=s&&r.find("> ."+S).length>0&&r.append(J.overlay)}),(!r[0].style.zIndex||a>l)&&r.css(G,a+2),o.element.find("> .k-overlay").remove(),o._shouldFocus(c)&&(o.element.focus(),n=t(window).scrollTop(),i=parseInt(r.position().top,10),i>0&&n>i&&(n>0?t(window).scrollTop(i):r.css("top",n))),r=null,o},toggleMaximization:function(){return this._closing?this:this[this.options.isMaximized?"restore":"maximize"]()},restore:function(){var e=this,n=e.options,i=n.minHeight,o=e.restoreOptions,r=t(document);return n.isMaximized||n.isMinimized?(i&&i!=1/0&&e.wrapper.css("min-height",i),e.wrapper.css({position:n.pinned?"fixed":"absolute",left:o.left,top:o.top,width:o.width,height:o.height}).removeClass(P).find(".k-window-content,.k-resize-handle").show().end().find(".k-window-titlebar .k-i-restore").parent().remove().end().end().find(W).parent().show().end().end().find(Y).parent().show(),e.options.width=o.width,e.options.height=o.height,t("html, body").css(j,""),this._documentScrollTop&&this._documentScrollTop>0&&r.scrollTop(this._documentScrollTop),this._documentScrollLeft&&this._documentScrollLeft>0&&r.scrollLeft(this._documentScrollLeft),n.isMaximized=n.isMinimized=!1,e.resize(),e):e},maximize:o("maximize",function(){var e=this,n=e.wrapper,i=n.position(),o=t(document);p(e.restoreOptions,{left:i.left,top:i.top}),n.css({left:0,top:0,position:"fixed"}).addClass(P),this._documentScrollTop=o.scrollTop(),this._documentScrollLeft=o.scrollLeft(),t("html, body").css(j,E),e.options.isMaximized=!0,e._onDocumentResize()}),minimize:o("minimize",function(){var t=this;t.wrapper.css({height:"",minHeight:""}),t.element.hide(),t.options.isMinimized=!0}),pin:function(e){var n=this,i=t(window),o=n.wrapper,r=parseInt(o.css("top"),10),s=parseInt(o.css("left"),10);(e||!n.options.pinned&&!n.options.isMaximized)&&(o.css({position:"fixed",top:r-i.scrollTop(),left:s-i.scrollLeft()}),o.children(x).find(q).addClass("k-i-unpin").removeClass("k-i-pin"),n.options.pinned=!0)},unpin:function(){var e=this,n=t(window),i=e.wrapper,o=parseInt(i.css("top"),10),r=parseInt(i.css("left"),10);e.options.pinned&&!e.options.isMaximized&&(i.css({position:"",top:o+n.scrollTop(),left:r+n.scrollLeft()}),i.children(x).find($).addClass("k-i-pin").removeClass("k-i-unpin"),e.options.pinned=!1)},_onDocumentResize:function(){var e,n,i=this,o=i.wrapper,r=t(window),s=l.support.zoomLevel();i.options.isMaximized&&(e=r.width()/s,n=r.height()/s-parseInt(o.css("padding-top"),10),o.css({width:e,height:n}),i.options.width=e,i.options.height=n,i.resize())},refresh:function(e){var i,o,r,s=this,a=s.options,l=t(s.element);return u(e)||(e={url:e}),e=p({},a.content,e),o=n(a.iframe)?a.iframe:e.iframe,r=e.url,r?(n(o)||(o=!K(r)),o?(i=l.find("."+S)[0],i?i.src=r||i.src:l.html(J.contentFrame(p({},a,{content:e}))),l.find("."+S).unbind("load"+y).on("load"+y,f(this._triggerRefresh,this))):s._ajaxRequest(e)):(e.template&&s.content(m(e.template)({})),s.trigger(O)),l.toggleClass("k-window-iframecontent",!!o),s},_triggerRefresh:function(){this.trigger(O)},_ajaxComplete:function(){clearTimeout(this._loadingIconTimeout),this.wrapper.find(Q).removeClass(T)},_ajaxError:function(t,e){this.trigger(U,{status:e,xhr:t})},_ajaxSuccess:function(t){return function(e){var n=e;t&&(n=m(t)(e||{})),this.content(n,e),this.element.prop("scrollTop",0),this.trigger(O)}},_showLoading:function(){this.wrapper.find(Q).addClass(T)},_ajaxRequest:function(e){this._loadingIconTimeout=setTimeout(f(this._showLoading,this),100),t.ajax(p({type:"GET",dataType:"html",cache:!1,error:f(this._ajaxError,this),complete:f(this._ajaxComplete,this),success:f(this._ajaxSuccess(e.template),this)},e))},_destroy:function(){this.resizing&&this.resizing.destroy(),this.dragging&&this.dragging.destroy(),this.wrapper.off(y).children(b).off(y).end().find(".k-resize-handle,.k-window-titlebar").off(y),t(window).off("resize"+y+this._marker),clearTimeout(this._loadingIconTimeout),c.fn.destroy.call(this),this.unbind(e),l.destroy(this.wrapper),this._removeOverlay(!0)},destroy:function(){this._destroy(),this.wrapper.empty().remove(),this.wrapper=this.appendTo=this.element=t()},_createWindow:function(){var e,n,i=this.element,o=this.options,r=l.support.isRtl(i);o.scrollable===!1&&i.attr("style","overflow:hidden;"),n=t(J.wrapper(o)),e=i.find("iframe:not(.k-content)").map(function(){var t=this.getAttribute("src");return this.src="",t}),n.toggleClass("k-rtl",r).appendTo(this.appendTo).append(i).find("iframe:not(.k-content)").each(function(t){this.src=e[t]}),n.find(".k-window-title").css(r?"left":"right",n.find(".k-window-actions").outerWidth()+10),i.css("visibility","").show(),i.find("[data-role=editor]").each(function(){var e=t(this).data("kendoEditor");e&&e.refresh()}),n=i=null}}),J={wrapper:m("
"),action:m("#= name # "),titlebar:m(""),overlay:"
",contentFrame:m(""),resizeHandle:m("
")};s.prototype={addOverlay:function(){this.owner.wrapper.append(J.overlay)},removeOverlay:function(){this.owner.wrapper.find(C).remove()},dragstart:function(e){var n=this,i=n.owner,o=i.wrapper;n.elementPadding=parseInt(o.css("padding-top"),10),n.initialPosition=l.getOffset(o,"position"),n.resizeDirection=e.currentTarget.prop("className").replace("k-resize-handle k-resize-",""),n.initialSize={width:o.width(),height:o.height()},n.containerOffset=l.getOffset(i.appendTo,"position"),o.children(k).not(e.currentTarget).hide(),t(v).css(B,e.currentTarget.css(B))},drag:function(t){var e,n,o,r,s=this,a=s.owner,l=a.wrapper,c=a.options,h=s.resizeDirection,u=s.containerOffset,d=s.initialPosition,f=s.initialSize,p=Math.max(t.x.location,u.left),g=Math.max(t.y.location,u.top);h.indexOf("e")>=0?(e=p-d.left,l.width(i(e,c.minWidth,c.maxWidth))):h.indexOf("w")>=0&&(r=d.left+f.width,e=i(r-p,c.minWidth,c.maxWidth),l.css({left:r-e-u.left,width:e})),h.indexOf("s")>=0?(n=g-d.top-s.elementPadding,l.height(i(n,c.minHeight,c.maxHeight))):h.indexOf("n")>=0&&(o=d.top+f.height,n=i(o-g,c.minHeight,c.maxHeight),l.css({top:o-n-u.top,height:n})),e&&(a.options.width=e+"px"),n&&(a.options.height=n+"px"),a.resize()},dragend:function(e){var n=this,i=n.owner,o=i.wrapper;return o.children(k).not(e.currentTarget).show(),t(v).css(B,""),i.touchScroller&&i.touchScroller.reset(),
27==e.keyCode&&o.css(n.initialPosition).css(n.initialSize),i.trigger(V),!1},destroy:function(){this._draggable&&this._draggable.destroy(),this._draggable=this.owner=null}},a.prototype={dragstart:function(e){var n=this.owner,i=n.element,o=i.find(".k-window-actions"),r=l.getOffset(n.appendTo);n.trigger(N),n.initialWindowPosition=l.getOffset(n.wrapper,"position"),n.startPosition={left:e.x.client-n.initialWindowPosition.left,top:e.y.client-n.initialWindowPosition.top},n.minLeftPosition=o.length>0?o.outerWidth()+parseInt(o.css("right"),10)-i.outerWidth():20-i.outerWidth(),n.minLeftPosition-=r.left,n.minTopPosition=-r.top,n.wrapper.append(J.overlay).children(k).hide(),t(v).css(B,e.currentTarget.css(B))},drag:function(e){var n=this.owner,i=n.options.position,o=Math.max(e.y.client-n.startPosition.top,n.minTopPosition),r=Math.max(e.x.client-n.startPosition.left,n.minLeftPosition),s={left:r,top:o};t(n.wrapper).css(s),i.top=o,i.left=r},_finishDrag:function(){var e=this.owner;e.wrapper.children(k).toggle(!e.options.isMinimized).end().find(C).remove(),t(v).css(B,"")},dragcancel:function(t){this._finishDrag(),t.currentTarget.closest(_).css(this.owner.initialWindowPosition)},dragend:function(){return this._finishDrag(),this.owner.trigger(H),!1},destroy:function(){this._draggable&&this._draggable.destroy(),this._draggable=this.owner=null}},l.ui.plugin(Z)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.list.min",["kendo.data.min","kendo.popup.min"],t)}(function(){return function(t,e){function n(t,n){return t!==e&&""!==t&&null!==t&&("boolean"===n?t=!!t:"number"===n?t=+t:"string"===n&&(t=""+t)),t}function i(t,e){var n,i,o,r,s=e.length,a=t.length,l=[],c=[];if(a)for(o=0;a>o;o++){for(n=t[o],i=!1,r=0;s>r;r++)if(n===e[r]){i=!0,l.push({index:o,item:n});break}i||c.push(n)}return{changed:l,unchanged:c}}function o(e,n){var i,r=!1;return e.filters&&(i=t.grep(e.filters,function(t){return r=o(t,n),t.filters?t.filters.length:t.field!=n}),r||e.filters.length===i.length||(r=!0),e.filters=i),r}var r,s,a=window.kendo,l=a.ui,c=l.Widget,h=a.keys,u=a.support,d=a.htmlEncode,f=a._activeElement,p=a.data.ObservableArray,g="id",m="change",v="k-state-focused",y="k-state-hover",_="k-loading",w="open",x="close",b="cascade",k="select",C="selected",S="requestStart",T="requestEnd",A="width",D=t.extend,P=t.proxy,M=t.isArray,E=u.browser,B=E.msie&&9>E.version,I=/"/g,z={ComboBox:"DropDownList",DropDownList:"ComboBox"},L=a.ui.DataBoundWidget.extend({init:function(e,n){var i,o=this,r=o.ns;c.fn.init.call(o,e,n),e=o.element,n=o.options,o._isSelect=e.is(k),o._isSelect&&o.element[0].length&&(n.dataSource||(n.dataTextField=n.dataTextField||"text",n.dataValueField=n.dataValueField||"value")),o.ul=t('').attr({tabIndex:-1,"aria-hidden":!0}),o.list=t("
").append(o.ul).on("mousedown"+r,P(o._listMousedown,o)),i=e.attr(g),i&&(o.list.attr(g,i+"-list"),o.ul.attr(g,i+"_listbox")),o._header(),o._accessors(),o._initValue()},options:{valuePrimitive:!1,headerTemplate:""},setOptions:function(t){c.fn.setOptions.call(this,t),t&&t.enable!==e&&(t.enabled=t.enable)},focus:function(){this._focused.focus()},readonly:function(t){this._editable({readonly:t===e?!0:t,disable:!1})},enable:function(t){this._editable({readonly:!1,disable:!(t=t===e?!0:t)})},_listOptions:function(e){var n=this,i=n.options,o=i.virtual,r=P(n._listBound,n);return o="object"==typeof o?o:{},e=t.extend({autoBind:!1,selectable:!0,dataSource:n.dataSource,click:P(n._click,n),change:P(n._listChange,n),activate:P(n._activateItem,n),deactivate:P(n._deactivateItem,n),dataBinding:function(){n.trigger("dataBinding"),n._angularItems("cleanup")},dataBound:r,listBound:r,height:i.height,dataValueField:i.dataValueField,dataTextField:i.dataTextField,groupTemplate:i.groupTemplate,fixedGroupTemplate:i.fixedGroupTemplate,template:i.template},e,o),e.template||(e.template="#:"+a.expr(e.dataTextField,"data")+"#"),e},_initList:function(){var t=this,e=t._listOptions({selectedItemChange:P(t._listChange,t)});t.listView=t.options.virtual?new a.ui.VirtualList(t.ul,e):new a.ui.StaticList(t.ul,e),t._setListValue()},_setListValue:function(t){t=t||this.options.value,t!==e&&this.listView.value(t).done(P(this._updateSelectionState,this))},_updateSelectionState:t.noop,_listMousedown:function(t){this.filterInput&&this.filterInput[0]===t.target||t.preventDefault()},_filterSource:function(t,e){var n=this,i=n.options,r=n.dataSource,s=D({},r.filter()||{}),a=o(s,i.dataTextField);(t||a)&&n.trigger("filtering",{filter:t})||(s={filters:s.filters||[],logic:"and"},t&&s.filters.push(t),n._cascading&&this.listView.setDSFilter(s),e?r.read({filter:s}):r.filter(s))},_header:function(){var e,n=this,i=n.options.headerTemplate;t.isFunction(i)&&(i=i({})),i&&(n.list.prepend(i),e=n.ul.prev(),n.header=e[0]?e:null,n.header&&n.angular("compile",function(){return{elements:n.header}}))},_initValue:function(){var t=this,e=t.options.value;null!==e?t.element.val(e):(e=t._accessor(),t.options.value=e),t._old=e},_ignoreCase:function(){var t,e=this,n=e.dataSource.reader.model;n&&n.fields&&(t=n.fields[e.options.dataTextField],t&&t.type&&"string"!==t.type&&(e.options.ignoreCase=!1))},_focus:function(t){return this.listView.focus(t)},current:function(t){return this._focus(t)},items:function(){return this.ul[0].children},destroy:function(){var t=this,e=t.ns;c.fn.destroy.call(t),t._unbindDataSource(),t.listView.destroy(),t.list.off(e),t.popup.destroy(),t._form&&t._form.off("reset",t._resetHandler)},dataItem:function(n){var i=this;if(n===e)return i.listView.selectedDataItems()[0];if("number"!=typeof n){if(i.options.virtual)return i.dataSource.getByUid(t(n).data("uid"));n=t(i.items()).index(n)}return i.dataSource.flatView()[n]},_activateItem:function(){var t=this.listView.focus();t&&this._focused.add(this.filterInput).attr("aria-activedescendant",t.attr("id"))},_deactivateItem:function(){this._focused.add(this.filterInput).removeAttr("aria-activedescendant")},_accessors:function(){var t=this,e=t.element,n=t.options,i=a.getter,o=e.attr(a.attr("text-field")),r=e.attr(a.attr("value-field"));!n.dataTextField&&o&&(n.dataTextField=o),!n.dataValueField&&r&&(n.dataValueField=r),t._text=i(n.dataTextField),t._value=i(n.dataValueField)},_aria:function(t){var n=this,i=n.options,o=n._focused.add(n.filterInput);i.suggest!==e&&o.attr("aria-autocomplete",i.suggest?"both":"list"),t=t?t+" "+n.ul[0].id:n.ul[0].id,o.attr("aria-owns",t),n.ul.attr("aria-live",i.filter&&"none"!==i.filter?"polite":"off")},_blur:function(){var t=this;t._change(),t.close()},_change:function(){var t,i=this,o=i.selectedIndex,r=i.options.value,s=i.value();i._isSelect&&!i.listView.bound()&&r&&(s=r),s!==n(i._old,typeof s)?t=!0:o!==e&&o!==i._oldIndex&&(t=!0),t&&(i._old=s,i._oldIndex=o,i._typing||i.element.trigger(m),i.trigger(m)),i.typing=!1},_data:function(){return this.dataSource.view()},_enable:function(){var t=this,n=t.options,i=t.element.is("[disabled]");n.enable!==e&&(n.enabled=n.enable),!n.enabled||i?t.enable(!1):t.readonly(t.element.is("[readonly]"))},_dataValue:function(t){var n=this._value(t);return n===e&&(n=this._text(t)),n},_offsetHeight:function(){var e=0,n=this.listView.content.prevAll(":visible");return n.each(function(){var n=t(this);e+=n.hasClass("k-list-filter")?n.children().outerHeight():n.outerHeight()}),e},_height:function(t){var n,i,o=this,r=o.list,s=o.options.height,a=o.popup.visible();if(t){if(i=r.add(r.parent(".k-animation-container")).show(),!r.is(":visible"))return i.hide(),e;s=o.listView.content[0].scrollHeight>s?s:"auto",i.height(s),"auto"!==s&&(n=o._offsetHeight(),n&&(s-=n)),o.listView.content.height(s),a||i.hide()}return s},_adjustListWidth:function(){var t,e,n=this.list,i=n[0].style.width,o=this.wrapper;if(n.data(A)||!i)return t=window.getComputedStyle?window.getComputedStyle(o[0],null):0,e=parseFloat(t&&t.width)||o.outerWidth(),t&&E.msie&&(e+=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth)),i="border-box"!==n.css("box-sizing")?e-(n.outerWidth()-n.width()):e,n.css({fontFamily:o.css("font-family"),width:i}).data(A,i),!0},_openHandler:function(t){this._adjustListWidth(),this.trigger(w)?t.preventDefault():(this._focused.attr("aria-expanded",!0),this.ul.attr("aria-hidden",!1))},_closeHandler:function(t){this.trigger(x)?t.preventDefault():(this._focused.attr("aria-expanded",!1),this.ul.attr("aria-hidden",!0))},_focusItem:function(){var t=this.listView,n=t.focus(),i=t.select();i=i[i.length-1],i===e&&this.options.highlightFirst&&!n&&(i=0),i!==e?t.focus(i):t.scrollToIndex(0)},_calculateGroupPadding:function(t){var e=this.ul.children(".k-first:first"),n=this.listView.content.prev(".k-group-header"),i=0;n[0]&&"none"!==n[0].style.display&&("auto"!==t&&(i=a.support.scrollbar()),i+=parseFloat(e.css("border-right-width"),10)+parseFloat(e.children(".k-group").css("padding-right"),10),n.css("padding-right",i))},_calculatePopupHeight:function(t){var e=this._height(this.dataSource.flatView().length||t);this._calculateGroupPadding(e)},_resizePopup:function(t){this.options.virtual||(this.popup.element.is(":visible")?this._calculatePopupHeight(t):this.popup.one("open",function(t){return P(function(){this._calculatePopupHeight(t)},this)}.call(this,t)))},_popup:function(){var t=this;t.popup=new l.Popup(t.list,D({},t.options.popup,{anchor:t.wrapper,open:P(t._openHandler,t),close:P(t._closeHandler,t),animation:t.options.animation,isRtl:u.isRtl(t.wrapper)}))},_makeUnselectable:function(){B&&this.list.find("*").not(".k-textbox").attr("unselectable","on")},_toggleHover:function(e){t(e.currentTarget).toggleClass(y,"mouseenter"===e.type)},_toggle:function(t,n){var i=this,o=u.mobileOS&&(u.touch||u.MSPointers||u.pointers);t=t!==e?t:!i.popup.visible(),n||o||i._focused[0]===f()||(i._prevent=!0,i._focused.focus(),i._prevent=!1),i[t?w:x]()},_triggerCascade:function(){var t=this;t._cascadeTriggered&&t._old===t.value()&&t._oldIndex===t.selectedIndex||(t._cascadeTriggered=!0,t.trigger(b,{userTriggered:t._userTriggered}))},_triggerChange:function(){this._valueBeforeCascade!==this.value()&&this.trigger(m)},_unbindDataSource:function(){var t=this;t.dataSource.unbind(S,t._requestStartHandler).unbind(T,t._requestEndHandler).unbind("error",t._errorHandler)}});D(L,{inArray:function(t,e){var n,i,o=e.children;if(!t||t.parentNode!==e)return-1;for(n=0,i=o.length;i>n;n++)if(t===o[n])return n;return-1},unifyType:n}),a.ui.List=L,l.Select=L.extend({init:function(t,e){L.fn.init.call(this,t,e),this._initial=this.element.val()},setDataSource:function(t){var e,n=this;n.options.dataSource=t,n._dataSource(),n.listView.bound()&&(n._initialIndex=null),n.listView.setDataSource(n.dataSource),n.options.autoBind&&n.dataSource.fetch(),e=n._parentWidget(),e&&n._cascadeSelect(e)},close:function(){this.popup.close()},select:function(t){var n=this;return t===e?n.selectedIndex:(n._select(t),n._old=n._accessor(),n._oldIndex=n.selectedIndex,e)},search:function(t){var e,n,i,o,r,s;t="string"==typeof t?t:this.text(),e=this,n=t.length,i=e.options,o=i.ignoreCase,r=i.filter,s=i.dataTextField,clearTimeout(e._typingTimeout),(!n||n>=i.minLength)&&(e._state="filter","none"===r?e._filter(t):(e._open=!0,e._filterSource({value:o?t.toLowerCase():t,field:s,operator:r,ignoreCase:o})))},_accessor:function(t,e){return this[this._isSelect?"_accessorSelect":"_accessorInput"](t,e)},_accessorInput:function(t){var n=this.element[0];return t===e?n.value:(null===t&&(t=""),n.value=t,e)},_accessorSelect:function(t,n){var i,o=this.element[0],r=o.selectedIndex;return t===e?(r>-1&&(i=o.options[r]),i&&(t=i.value),t||""):(r>-1&&(o.options[r].removeAttribute(C),o.options[r].selected=!1),n===e&&(n=-1),null!==t&&""!==t&&-1==n?this._custom(t):(t?o.value=t:o.selectedIndex=n,o.selectedIndex>-1&&(i=o.options[o.selectedIndex]),i&&i.setAttribute(C,C)),e)},_custom:function(e){var n=this,i=n.element,o=n._customOption;o||(o=t(" "),n._customOption=o,i.append(o)),o.text(e),o[0].setAttribute(C,C),o[0].selected=!0},_hideBusy:function(){var t=this;clearTimeout(t._busy),t._arrow.removeClass(_),t._focused.attr("aria-busy",!1),t._busy=null},_showBusy:function(){var t=this;t._request=!0,t._busy||(t._busy=setTimeout(function(){t._arrow&&(t._focused.attr("aria-busy",!0),t._arrow.addClass(_))},100))},_requestEnd:function(){this._request=!1,this._hideBusy()},_dataSource:function(){var e,n=this,i=n.element,o=n.options,r=o.dataSource||{};r=t.isArray(r)?{data:r}:r,n._isSelect&&(e=i[0].selectedIndex,e>-1&&(o.index=e),r.select=i,r.fields=[{field:o.dataTextField},{field:o.dataValueField}]),n.dataSource?n._unbindDataSource():(n._requestStartHandler=P(n._showBusy,n),n._requestEndHandler=P(n._requestEnd,n),n._errorHandler=P(n._hideBusy,n)),n.dataSource=a.data.DataSource.create(r).bind(S,n._requestStartHandler).bind(T,n._requestEndHandler).bind("error",n._errorHandler)},_firstItem:function(){this.listView.focusFirst()},_lastItem:function(){this.listView.focusLast()},_nextItem:function(){this.listView.focusNext()},_prevItem:function(){this.listView.focusPrev()},_move:function(t){var n,i,o,r,s=this,a=t.keyCode,l=a===h.DOWN;if(a===h.UP||l){if(t.altKey)s.toggle(l);else{if(!s.listView.bound())return s._fetch||(s.dataSource.one(m,function(){s._fetch=!1,s._move(t)}),s._fetch=!0,s._filterSource()),t.preventDefault(),!0;if(o=s._focus(),s._fetch||o&&!o.hasClass("k-state-selected")||(l?(s._nextItem(),s._focus()||s._lastItem()):(s._prevItem(),s._focus()||s._firstItem())),s.trigger(k,{item:s._focus()}))return s._focus(o),e;s._select(s._focus(),!0),s.popup.visible()||s._blur()}t.preventDefault(),i=!0}else if(a===h.ENTER||a===h.TAB){if(s.popup.visible()&&t.preventDefault(),o=s._focus(),n=s.dataItem(),s.popup.visible()||n&&s.text()===s._text(n)||(o=null),r=s.filterInput&&s.filterInput[0]===f(),o){if(s.trigger(k,{item:o}))return;s._select(o)}else s.input&&(s._accessor(s.input.val()),s.listView.value(s.input.val()));s._focusElement&&s._focusElement(s.wrapper),r&&a===h.TAB?s.wrapper.focusout():s._blur(),s.close(),i=!0}else a===h.ESC&&(s.popup.visible()&&t.preventDefault(),s.close(),i=!0);return i},_fetchData:function(){var t=this,e=!!t.dataSource.view().length;t._request||t.options.cascadeFrom||t.listView.bound()||t._fetch||e||(t._fetch=!0,t.dataSource.fetch().done(function(){t._fetch=!1}))},_options:function(t,n,i){var o,r,s,a,l=this,c=l.element,h=t.length,u="",f=0;for(n&&(u=n);h>f;f++)o="",s!==e&&(o+=d(s)),o+=" ",u+=o;c.html(u),i!==e&&(c[0].value=i,c[0].value&&!i&&(c[0].selectedIndex=-1))},_reset:function(){var e=this,n=e.element,i=n.attr("form"),o=i?t("#"+i):n.closest("form");o[0]&&(e._resetHandler=function(){setTimeout(function(){e.value(e._initial)})},e._form=o.on("reset",e._resetHandler))},_parentWidget:function(){var e=this.options.name,n=t("#"+this.options.cascadeFrom),i=n.data("kendo"+e);return i||(i=n.data("kendo"+z[e])),i},_cascade:function(){var t,e,n=this,i=n.options,o=i.cascadeFrom;if(o){if(e=n._parentWidget(),!e)return;i.autoBind=!1,t=P(function(t){var n=this.value();this._userTriggered=t.userTriggered,this.listView.bound()&&this._clearSelection(e,!0),this._cascadeSelect(e,n)},n),e.first(b,t),e._focused.bind("focus",function(){e.unbind(b,t),e.first(m,t)}),e._focused.bind("focusout",function(){e.unbind(m,t),e.first(b,t)}),e.listView.bound()?n._cascadeSelect(e):e.value()||n.enable(!1)}},_cascadeChange:function(t){var e=this,n=e._accessor();e._userTriggered?e._clearSelection(t,!0):n?(n!==e.listView.value()[0]&&e.value(n),e.dataSource.view()[0]&&-1!==e.selectedIndex||e._clearSelection(t,!0)):e.dataSource.flatView().length&&e.select(e.options.index),e.enable(),e._triggerCascade(),e._triggerChange(),e._userTriggered=!1},_cascadeSelect:function(t,n){var i,r,s,a=this,l=t.dataItem(),c=l?t._value(l):null,h=a.options.cascadeFromField||t.options.dataValueField;a._valueBeforeCascade=n!==e?n:a.value(),c||0===c?(i=a.dataSource.filter()||{},o(i,h),r=i.filters||[],r.push({field:h,operator:"eq",value:c}),s=function(){a.unbind("dataBound",s),a._cascadeChange(t)},a.first("dataBound",s),a._cascading=!0,a._filterSource({field:h,operator:"eq",value:c}),a._cascading=!1):(a.enable(!1),a._clearSelection(t),a._triggerCascade(),a._triggerChange(),a._userTriggered=!1)}}),r=".StaticList",s=a.ui.DataBoundWidget.extend({init:function(e,n){c.fn.init.call(this,e,n),this.element.attr("role","listbox").on("click"+r,"li",P(this._click,this)).on("mouseenter"+r,"li",function(){t(this).addClass(y)}).on("mouseleave"+r,"li",function(){t(this).removeClass(y)}),this.content=this.element.wrap("
").parent(),this.header=this.content.before('').prev(),this.bound(!1),this._optionID=a.guid(),this._selectedIndices=[],this._view=[],this._dataItems=[],this._values=[];var i=this.options.value;i&&(this._values=t.isArray(i)?i.slice(0):[i]),this._getter(),this._templates(),this.setDataSource(this.options.dataSource),this._onScroll=P(function(){var t=this;clearTimeout(t._scrollId),t._scrollId=setTimeout(function(){t._renderHeader()},50)},this)},options:{name:"StaticList",dataValueField:null,valuePrimitive:!1,selectable:!0,template:null,groupTemplate:null,fixedGroupTemplate:null},events:["click",m,"activate","deactivate","dataBinding","dataBound","selectedItemChange"],setDataSource:function(e){var n,i=this,o=e||{};o=t.isArray(o)?{data:o}:o,o=a.data.DataSource.create(o),i.dataSource?(i.dataSource.unbind(m,i._refreshHandler),n=i.value(),i.value([]),i.bound(!1),i.value(n)):i._refreshHandler=P(i.refresh,i),i.setDSFilter(o.filter()),i.dataSource=o.bind(m,i._refreshHandler),i._fixedHeader()},skip:function(){return this.dataSource.skip()},setOptions:function(t){c.fn.setOptions.call(this,t),this._getter(),this._templates(),this._render()},destroy:function(){this.element.off(r),this._refreshHandler&&this.dataSource.unbind(m,this._refreshHandler),clearTimeout(this._scrollId),c.fn.destroy.call(this)},scrollToIndex:function(t){var e=this.element[0].children[t];e&&this.scroll(e)},scroll:function(t){if(t){t[0]&&(t=t[0]);var e=this.content[0],n=t.offsetTop,i=t.offsetHeight,o=e.scrollTop,r=e.clientHeight,s=n+i;o>n?o=n:s>o+r&&(o=s-r),e.scrollTop=o}},selectedDataItems:function(t){return t===e?this._dataItems.slice():(this._dataItems=t,this._values=this._getValues(t),e)},_getValues:function(e){var n=this._valueGetter;return t.map(e,function(t){return n(t)})},focusNext:function(){var t=this.focus();t=t?t.next():0,this.focus(t)},focusPrev:function(){var t=this.focus();t=t?t.prev():this.element[0].children.length-1,this.focus(t)},focusFirst:function(){this.focus(this.element[0].children[0])},focusLast:function(){this.focus(this.element[0].children[this.element[0].children.length-1])},focus:function(n){var i,o=this,r=o._optionID;return n===e?o._current:(n=o._get(n),n=n[n.length-1],n=t(this.element[0].children[n]),o._current&&(o._current.removeClass(v).removeAttr("aria-selected").removeAttr(g),o.trigger("deactivate")),i=!!n[0],i&&(n.addClass(v),o.scroll(n),n.attr("id",r)),o._current=i?n:null,o.trigger("activate"),e)},focusIndex:function(){return this.focus()?this.focus().index():e},skipUpdate:function(t){this._skipUpdate=t},select:function(n){var i,o,r=this,s=r.options.selectable,a="multiple"!==s&&s!==!1,l=r._selectedIndices,c=[],h=[];if(n===e)return l.slice();if(n=r._get(n),1===n.length&&-1===n[0]&&(n=[]),o=r.isFiltered(),!o||a||!r._deselectFiltered(n)){if(a&&!o&&-1!==t.inArray(n[n.length-1],l))return r._dataItems.length&&r._view.length&&(r._dataItems=[r._view[l[0]].item]),e;i=r._deselect(n),h=i.removed,n=i.indices,n.length&&(a&&(n=[n[n.length-1]]),c=r._select(n)),(c.length||h.length)&&(r._valueComparer=null,r.trigger(m,{added:c,removed:h}))}},removeAt:function(t){return this._selectedIndices.splice(t,1),this._values.splice(t,1),this._valueComparer=null,{position:t,dataItem:this._dataItems.splice(t,1)[0]}},setValue:function(e){e=t.isArray(e)||e instanceof p?e.slice(0):[e],this._values=e,this._valueComparer=null},value:function(n){var i,o=this,r=o._valueDeferred;return n===e?o._values.slice():(o.setValue(n),r&&"resolved"!==r.state()||(o._valueDeferred=r=t.Deferred()),o.bound()&&(i=o._valueIndices(o._values),"multiple"===o.options.selectable&&o.select(-1),o.select(i),r.resolve()),o._skipUpdate=!1,r)},items:function(){return this.element.children(".k-item")},_click:function(e){e.isDefaultPrevented()||this.trigger("click",{item:t(e.currentTarget)})||this.select(e.currentTarget)},_valueExpr:function(t,e){var i,o,r=this,s=0,a=[];if(!r._valueComparer||r._valueType!==t){for(r._valueType=t;e.length>s;s++)a.push(n(e[s],t));i="for (var idx = 0; idx < "+a.length+"; idx++) { if (current === values[idx]) { return idx; }} return -1;",o=Function("current","values",i),r._valueComparer=function(t){return o(t,a)}}return r._valueComparer},_dataItemPosition:function(t,e){var n=this._valueGetter(t),i=this._valueExpr(typeof n,e);return i(n)},_getter:function(){this._valueGetter=a.getter(this.options.dataValueField)},_deselect:function(e){var n,i,o,r=this,s=r.element[0].children,a=r.options.selectable,l=r._selectedIndices,c=r._dataItems,h=r._values,u=[],d=0,f=0;if(e=e.slice(),a!==!0&&e.length){if("multiple"===a)for(;e.length>d;d++)if(i=e[d],t(s[i]).hasClass("k-state-selected"))for(n=0;l.length>n;n++)if(o=l[n],o===i){t(s[o]).removeClass("k-state-selected"),u.push({position:n+f,dataItem:c.splice(n,1)[0]}),l.splice(n,1),e.splice(d,1),h.splice(n,1),f+=1,d-=1,n-=1;break}}else{for(;l.length>d;d++)t(s[l[d]]).removeClass("k-state-selected"),u.push({position:d,dataItem:c[d]});r._values=[],r._dataItems=[],r._selectedIndices=[]}return{indices:e,removed:u}},_deselectFiltered:function(e){for(var n,i,o,r=this.element[0].children,s=[],a=0;e.length>a;a++)i=e[a],n=this._view[i].item,o=this._dataItemPosition(n,this._values),o>-1&&(s.push(this.removeAt(o)),t(r[i]).removeClass("k-state-selected"));return s.length?(this.trigger(m,{added:[],removed:s}),!0):!1},_select:function(e){var n,i,o=this,r=o.element[0].children,s=o._view,a=[],l=0;for(-1!==e[e.length-1]&&o.focus(e);e.length>l;l++)i=e[l],n=s[i],-1!==i&&n&&(n=n.item,o._selectedIndices.push(i),o._dataItems.push(n),o._values.push(o._valueGetter(n)),t(r[i]).addClass("k-state-selected").attr("aria-selected",!0),a.push({dataItem:n}));return a},_get:function(n){return"number"==typeof n?n=[n]:M(n)||(n=t(n).data("offset-index"),n===e&&(n=-1),n=[n]),n},_template:function(){var t=this,e=t.options,n=e.template;return n?(n=a.template(n),n=function(t){return''+n(t)+" "}):n=a.template('${'+a.expr(e.dataTextField,"data")+"} ",{useWithBlock:!1}),n},_templates:function(){var t,e,n={template:this.options.template,groupTemplate:this.options.groupTemplate,fixedGroupTemplate:this.options.fixedGroupTemplate};for(e in n)t=n[e],t&&"function"!=typeof t&&(n[e]=a.template(t));this.templates=n},_normalizeIndices:function(t){for(var n=[],i=0;t.length>i;i++)t[i]!==e&&n.push(t[i]);return n},_valueIndices:function(t,e){var n,i=this._view,o=0;if(e=e?e.slice():[],!t.length)return[];for(;i.length>o;o++)n=this._dataItemPosition(i[o].item,t),-1!==n&&(e[n]=o);return this._normalizeIndices(e)},_firstVisibleItem:function(){for(var e=this.element[0],n=this.content[0],i=n.scrollTop,o=t(e.children[0]).height(),r=Math.floor(i/o)||0,s=e.children[r]||e.lastChild,a=i>s.offsetTop;s;)if(a){if(s.offsetTop+o>i||!s.nextSibling)break;s=s.nextSibling}else{if(i>=s.offsetTop||!s.previousSibling)break;s=s.previousSibling}return this._view[t(s).data("offset-index")]},_fixedHeader:function(){this.isGrouped()&&this.templates.fixedGroupTemplate?(this.header.show(),this.content.scroll(this._onScroll)):(this.header.hide(),this.content.off("scroll",this._onScroll))},_renderHeader:function(){var t,e=this.templates.fixedGroupTemplate;e&&(t=this._firstVisibleItem(),t&&this.header.html(e(t.group)))},_renderItem:function(t){var e='',e+=this.templates.template(n),i&&t.newGroup&&(e+=''+this.templates.groupTemplate(t.group)+"
"),e+" "},_render:function(){var t,e,n,i,o="",r=0,s=0,a=[],l=this.dataSource.view(),c=this.value(),h=this.isGrouped();if(h)for(r=0;l.length>r;r++)for(e=l[r],n=!0,i=0;e.items.length>i;i++)t={selected:this._selected(e.items[i],c),item:e.items[i],group:e.value,newGroup:n,index:s},a[s]=t,s+=1,o+=this._renderItem(t),n=!1;else for(r=0;l.length>r;r++)t={selected:this._selected(l[r],c),item:l[r],index:r},a[r]=t,o+=this._renderItem(t);this._view=a,this.element[0].innerHTML=o,h&&a.length&&this._renderHeader()},_selected:function(t,e){var n=!this.isFiltered()||"multiple"===this.options.selectable;return n&&-1!==this._dataItemPosition(t,e)},setDSFilter:function(t){this._lastDSFilter=D({},t)},isFiltered:function(){return this._lastDSFilter||this.setDSFilter(this.dataSource.filter()),!a.data.Query.compareFilters(this.dataSource.filter(),this._lastDSFilter)},refresh:function(t){var e,n=this,o=t&&t.action,r=n.options.skipUpdateOnBind,s="itemchange"===o;n.trigger("dataBinding"),n._fixedHeader(),n._render(),n.bound(!0),s||"remove"===o?(e=i(n._dataItems,t.items),e.changed.length&&(s?n.trigger("selectedItemChange",{items:e.changed}):n.value(n._getValues(e.unchanged)))):n.isFiltered()||n._skipUpdate?(n.focus(0),n._skipUpdate&&(n._skipUpdate=!1,n._selectedIndices=n._valueIndices(n._values,n._selectedIndices))):r||o&&"add"!==o||n.value(n._values),n._valueDeferred&&n._valueDeferred.resolve(),n.trigger("dataBound")},bound:function(t){return t===e?this._bound:(this._bound=t,e)},isGrouped:function(){return(this.dataSource.group()||[]).length}}),l.plugin(s)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.dropdownlist.min",["kendo.list.min","kendo.mobile.scroller.min"],t)}(function(){return function(t,e){function n(t,e,n){for(var i,o=0,r=e.length-1;r>o;++o)i=e[o],i in t||(t[i]={}),t=t[i];t[e[r]]=n}function i(t,e){return t>=e&&(t-=e),t}function o(t,e){for(var n=0;t.length>n;n++)if(t.charAt(n)!==e)return!1;return!0}var r=window.kendo,s=r.ui,a=s.Select,l=r.support,c=r._activeElement,h=r.data.ObservableObject,u=r.keys,d=".kendoDropDownList",f="disabled",p="readonly",g="change",m="k-state-focused",v="k-state-default",y="k-state-disabled",_="aria-disabled",w="aria-readonly",x="mouseenter"+d+" mouseleave"+d,b="tabindex",k="filter",C="accept",S="The `optionLabel` option is not valid due to missing fields. Define a custom optionLabel as shown here http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#configuration-optionLabel",T=t.proxy,A=a.extend({init:function(n,i){var o,s,l,c=this,h=i&&i.index;c.ns=d,i=t.isArray(i)?{dataSource:i}:i,a.fn.init.call(c,n,i),i=c.options,n=c.element.on("focus"+d,T(c._focusHandler,c)),c._focusInputHandler=t.proxy(c._focusInput,c),c.optionLabel=t(),c._optionLabel(),c._inputTemplate(),c._reset(),c._prev="",c._word="",c._wrapper(),c._tabindex(),c.wrapper.data(b,c.wrapper.attr(b)),c._span(),c._popup(),c._mobile(),c._dataSource(),c._ignoreCase(),c._filterHeader(),c._aria(),c._enable(),c._oldIndex=c.selectedIndex=-1,h!==e&&(i.index=h),c._initialIndex=i.index,c._initList(),c._cascade(),i.autoBind?c.dataSource.fetch():-1===c.selectedIndex&&(s=i.text||"",s||(o=i.optionLabel,o&&0===i.index?s=o:c._isSelect&&(s=n.children(":selected").text())),c._textAccessor(s)),l=t(c.element).parents("fieldset").is(":disabled"),l&&c.enable(!1),c.listView.bind("click",function(t){t.preventDefault()}),r.notify(c)},options:{name:"DropDownList",enabled:!0,autoBind:!0,index:0,text:null,value:null,delay:500,height:200,dataTextField:"",dataValueField:"",optionLabel:"",cascadeFrom:"",cascadeFromField:"",ignoreCase:!0,animation:{},filter:"none",minLength:1,virtual:!1,template:null,valueTemplate:null,optionLabelTemplate:null,groupTemplate:"#:data#",fixedGroupTemplate:"#:data#"},events:["open","close",g,"select","filtering","dataBinding","dataBound","cascade"],setOptions:function(t){a.fn.setOptions.call(this,t),this.listView.setOptions(this._listOptions(t)),this._optionLabel(),this._inputTemplate(),this._accessors(),this._filterHeader(),this._enable(),this._aria(),!this.value()&&this.hasOptionLabel()&&this.select(0)},destroy:function(){var t=this;a.fn.destroy.call(t),t.wrapper.off(d),t.element.off(d),t._inputWrapper.off(d),t._arrow.off(),t._arrow=null,t.optionLabel.off()},open:function(){var t=this;t.popup.visible()||(t.listView.bound()&&t._state!==C?t._allowOpening()&&(t.popup.one("activate",t._focusInputHandler),t.popup.open(),t._focusItem()):(t._open=!0,t._state="rebind",t.filterInput&&(t.filterInput.val(""),t._prev=""),t._filterSource()))},_focusInput:function(){this._focusElement(this.filterInput)},_allowOpening:function(){return this.hasOptionLabel()||this.filterInput||this.dataSource.view().length},toggle:function(t){this._toggle(t,!0)},current:function(t){var n;return t===e?(n=this.listView.focus(),!n&&0===this.selectedIndex&&this.hasOptionLabel()?this.optionLabel:n):(this._focus(t),e)},dataItem:function(n){var i=this,o=null;if(null===n)return n;if(n===e)o=i.listView.selectedDataItems()[0];else{if("number"!=typeof n){if(i.options.virtual)return i.dataSource.getByUid(t(n).data("uid"));n=n.hasClass("k-list-optionlabel")?-1:t(i.items()).index(n)}else i.hasOptionLabel()&&(n-=1);o=i.dataSource.flatView()[n]}return o||(o=i._optionLabelDataItem()),o},refresh:function(){this.listView.refresh()},text:function(t){var n,i,o=this,r=o.options.ignoreCase;return t=null===t?"":t,t===e?o._textAccessor():("string"==typeof t&&(i=r?t.toLowerCase():t,o._select(function(t){return t=o._text(t),r&&(t=(t+"").toLowerCase()),t===i}),n=o.dataItem(),n&&(t=n)),o._textAccessor(t),e)},value:function(t){var n=this,i=n.listView,o=n.dataSource;return t===e?(t=n._accessor()||n.listView.value()[0],t===e||null===t?"":t):(t&&(n._initialIndex=null),n._request&&n.options.cascadeFrom&&n.listView.bound()?(n._valueSetter&&o.unbind(g,n._valueSetter),n._valueSetter=T(function(){n.value(t)},n),o.one(g,n._valueSetter),e):(i.bound()&&i.isFiltered()?(i.bound(!1),n._filterSource()):n._fetchData(),i.value(t).done(function(){-1===n.selectedIndex&&n.text()&&(n.text(""),n._accessor("",-1)),n._old=n._accessor(),n._oldIndex=n.selectedIndex}),e))},hasOptionLabel:function(){return this.optionLabel&&!!this.optionLabel[0]},_optionLabel:function(){var n=this,i=n.options,o=i.optionLabel,s=i.optionLabelTemplate;return o?(s||(s="#:",s+="string"==typeof o?"data":r.expr(i.dataTextField,"data"),s+="#"),"function"!=typeof s&&(s=r.template(s)),n.optionLabelTemplate=s,n.hasOptionLabel()||(n.optionLabel=t('
').prependTo(n.list)),n.optionLabel.html(s(o)).off().click(T(n._click,n)).on(x,n._toggleHover),n.angular("compile",function(){return{elements:n.optionLabel}}),e):(n.optionLabel.off().remove(),n.optionLabel=t(),e)},_optionLabelText:function(){var t=this.options.optionLabel;return"string"==typeof t?t:this._text(t)},_optionLabelDataItem:function(){var e=this,n=e.options.optionLabel;return e.hasOptionLabel()?t.isPlainObject(n)?new h(n):e._assignInstance(e._optionLabelText(),""):null},_listBound:function(){var t,e,n=this,i=n._initialIndex,o=n.options.optionLabel,r=n._state===k,s=n.dataSource.flatView(),a=s.length;n._angularItems("compile"),n._presetValue=!1,n._resizePopup(!0),n.popup.position(),n._isSelect&&(e=n.value(),a?o&&(o=n._option("",n._optionLabelText())):e&&(o=n._option(e,n.text())),n._options(s,o,e)),n._makeUnselectable(),r||(n._open&&n.toggle(n._allowOpening()),n._open=!1,n._fetch||(a?(!n.listView.value().length&&i>-1&&null!==i&&n.select(i),n._initialIndex=null,
t=n.listView.selectedDataItems()[0],t&&n.text()!==n._text(t)&&n._selectValue(t)):n._textAccessor()!==n._optionLabelText()&&(n.listView.value(""),n._selectValue(null),n._oldIndex=n.selectedIndex))),n._hideBusy(),n.trigger("dataBound")},_listChange:function(){this._selectValue(this.listView.selectedDataItems()[0]),(this._presetValue||this._old&&-1===this._oldIndex)&&(this._oldIndex=this.selectedIndex)},_focusHandler:function(){this.wrapper.focus()},_focusinHandler:function(){this._inputWrapper.addClass(m),this._prevent=!1},_focusoutHandler:function(){var t=this,e=t._state===k,n=window.self!==window.top,i=t._focus();t._prevent||(clearTimeout(t._typingTimeout),e&&i&&!t.trigger("select",{item:i})&&t._select(i,!t.dataSource.view().length),l.mobileOS.ios&&n?t._change():t._blur(),t._inputWrapper.removeClass(m),t._prevent=!0,t._open=!1,t.element.blur())},_wrapperMousedown:function(){this._prevent=!!this.filterInput},_wrapperClick:function(t){t.preventDefault(),this.popup.unbind("activate",this._focusInputHandler),this._focused=this.wrapper,this._toggle()},_editable:function(t){var e=this,n=e.element,i=t.disable,o=t.readonly,r=e.wrapper.add(e.filterInput).off(d),s=e._inputWrapper.off(x);o||i?i?(r.removeAttr(b),s.addClass(y).removeClass(v)):(s.addClass(v).removeClass(y),r.on("focusin"+d,T(e._focusinHandler,e)).on("focusout"+d,T(e._focusoutHandler,e))):(n.removeAttr(f).removeAttr(p),s.addClass(v).removeClass(y).on(x,e._toggleHover),r.attr(b,r.data(b)).attr(_,!1).attr(w,!1).on("keydown"+d,T(e._keydown,e)).on("focusin"+d,T(e._focusinHandler,e)).on("focusout"+d,T(e._focusoutHandler,e)).on("mousedown"+d,T(e._wrapperMousedown,e)),e.wrapper.on("click"+d,T(e._wrapperClick,e)),e.filterInput||r.on("keypress"+d,T(e._keypress,e))),n.attr(f,i).attr(p,o),r.attr(_,i).attr(w,o)},_option:function(t,e){return''+e+" "},_keydown:function(t){var n,i,o=this,r=t.keyCode,s=t.altKey,a=o.popup.visible();if(o.filterInput&&(n=o.filterInput[0]===c()),r===u.LEFT?(r=u.UP,i=!0):r===u.RIGHT&&(r=u.DOWN,i=!0),!i||!n){if(t.keyCode=r,(s&&r===u.UP||r===u.ESC)&&o._focusElement(o.wrapper),r===u.ENTER&&o._typingTimeout&&o.filterInput&&a)return t.preventDefault(),e;i=o._move(t),i||(a&&o.filterInput||(r===u.HOME?(i=!0,o._firstItem()):r===u.END&&(i=!0,o._lastItem()),i&&(o._select(o._focus()),t.preventDefault())),s||i||!o.filterInput||o._search())}},_matchText:function(t,n){var i=this.options.ignoreCase;return t===e||null===t?!1:(t+="",i&&(t=t.toLowerCase()),0===t.indexOf(n))},_shuffleData:function(t,e){var n=this._optionLabelDataItem();return n&&(t=[n].concat(t)),t.slice(e).concat(t.slice(0,e))},_selectNext:function(){var t,e,n,r=this,s=r.dataSource.flatView().toJSON(),a=s.length+(r.hasOptionLabel()?1:0),l=o(r._word,r._last),c=r.selectedIndex;for(-1===c?c=0:(c+=l?1:0,c=i(c,a)),s=r._shuffleData(s,c),n=0;a>n&&(e=r._text(s[n]),!l||!r._matchText(e,r._last))&&!r._matchText(e,r._word);n++);n!==a&&(t=r._focus(),r._select(i(c+n,a)),r.trigger("select",{item:r._focus()})&&r._select(t),r.popup.visible()||r._change())},_keypress:function(t){var e,n=this;0!==t.which&&t.keyCode!==r.keys.ENTER&&(e=String.fromCharCode(t.charCode||t.keyCode),n.options.ignoreCase&&(e=e.toLowerCase())," "===e&&t.preventDefault(),n._word+=e,n._last=e,n._search())},_popupOpen:function(){var t=this.popup;t.wrapper=r.wrap(t.element),t.element.closest(".km-root")[0]&&(t.wrapper.addClass("km-popup km-widget"),this.wrapper.addClass("km-widget"))},_popup:function(){a.fn._popup.call(this),this.popup.one("open",T(this._popupOpen,this))},_click:function(n){var i=n.item||t(n.currentTarget);return n.preventDefault(),this.trigger("select",{item:i})?(this.close(),e):(this._userTriggered=!0,this._select(i),this._focusElement(this.wrapper),this._blur(),e)},_focusElement:function(t){var e=c(),n=this.wrapper,i=this.filterInput,o=t===i?n:i,r=l.mobileOS&&(l.touch||l.MSPointers||l.pointers);i&&i[0]===t[0]&&r||i&&o[0]===e&&(this._prevent=!0,this._focused=t.focus())},_filter:function(t){var e,n;t&&(e=this,n=e.options.ignoreCase,n&&(t=t.toLowerCase()),e._select(function(n){return e._matchText(e._text(n),t)}))},_search:function(){var t=this,n=t.dataSource;if(clearTimeout(t._typingTimeout),"none"!==t.options.filter)t._typingTimeout=setTimeout(function(){var e=t.filterInput.val();t._prev!==e&&(t._prev=e,t.search(e)),t._typingTimeout=null},t.options.delay);else{if(t._typingTimeout=setTimeout(function(){t._word=""},t.options.delay),!t.listView.bound())return n.fetch().done(function(){t._selectNext()}),e;t._selectNext()}},_get:function(e){var n,i,o,r="function"==typeof e,s=r?t():t(e);if(this.hasOptionLabel()&&("number"==typeof e?e>-1&&(e-=1):s.hasClass("k-list-optionlabel")&&(e=-1)),r){for(n=this.dataSource.flatView(),o=0;n.length>o;o++)if(e(n[o])){e=o,i=!0;break}i||(e=-1)}return e},_firstItem:function(){this.hasOptionLabel()?this._focus(this.optionLabel):this.listView.focusFirst()},_lastItem:function(){this._resetOptionLabel(),this.listView.focusLast()},_nextItem:function(){this.optionLabel.hasClass("k-state-focused")?(this._resetOptionLabel(),this.listView.focusFirst()):this.listView.focusNext()},_prevItem:function(){this.optionLabel.hasClass("k-state-focused")||(this.listView.focusPrev(),this.listView.focus()||this._focus(this.optionLabel))},_focusItem:function(){var t=this.listView,n=t.focus(),i=t.select();i=i[i.length-1],i===e&&this.options.highlightFirst&&!n&&(i=0),i!==e?t.focus(i):this.options.optionLabel?(this._focus(this.optionLabel),this._select(this.optionLabel)):t.scrollToIndex(0)},_resetOptionLabel:function(t){this.optionLabel.removeClass("k-state-focused"+(t||"")).removeAttr("id")},_focus:function(t){var n=this.listView,i=this.optionLabel;return t===e?(t=n.focus(),!t&&i.hasClass("k-state-focused")&&(t=i),t):(this._resetOptionLabel(),t=this._get(t),n.focus(t),-1===t&&(i.addClass("k-state-focused").attr("id",n._optionID),this._focused.add(this.filterInput).removeAttr("aria-activedescendant").attr("aria-activedescendant",n._optionID)),e)},_select:function(t,e){var n=this;t=n._get(t),n.listView.select(t),e||n._state!==k||(n._state=C),-1===t&&n._selectValue(null)},_selectValue:function(t){var n=this,i=n.options.optionLabel,o=n.listView.select(),r="",s="";o=o[o.length-1],o===e&&(o=-1),this._resetOptionLabel(" k-state-selected"),t?(s=t,r=n._dataValue(t),i&&(o+=1)):i&&(n._focus(n.optionLabel.addClass("k-state-selected")),s=n._optionLabelText(),r="string"==typeof i?"":n._value(i),o=0),n.selectedIndex=o,null===r&&(r=""),n._textAccessor(s),n._accessor(r,o),n._triggerCascade()},_mobile:function(){var t=this,e=t.popup,n=l.mobileOS,i=e.element.parents(".km-root").eq(0);i.length&&n&&(e.options.animation.open.effects=n.android||n.meego?"fadeIn":n.ios||n.wp?"slideIn:up":e.options.animation.open.effects)},_filterHeader:function(){var e,n=this.options,i="none"!==n.filter;this.filterInput&&(this.filterInput.off(d).parent().remove(),this.filterInput=null),i&&(e='select ',this.filterInput=t(' ').attr({placeholder:this.element.attr("placeholder"),role:"listbox","aria-haspopup":!0,"aria-expanded":!1}),this.list.prepend(t(' ').append(this.filterInput.add(e))))},_span:function(){var e,n=this,i=n.wrapper,o="span.k-input";e=i.find(o),e[0]||(i.append(' select ').append(n.element),e=i.find(o)),n.span=e,n._inputWrapper=t(i[0].firstChild),n._arrow=i.find(".k-icon")},_wrapper:function(){var t,e=this,n=e.element,i=n[0];t=n.parent(),t.is("span.k-widget")||(t=n.wrap(" ").parent(),t[0].style.cssText=i.style.cssText,t[0].title=i.title),n.hide(),e._focused=e.wrapper=t.addClass("k-widget k-dropdown k-header").addClass(i.className).css("display","").attr({accesskey:n.attr("accesskey"),unselectable:"on",role:"listbox","aria-haspopup":!0,"aria-expanded":!1})},_clearSelection:function(t){this.select(t.value()?0:-1)},_inputTemplate:function(){var e=this,n=e.options.valueTemplate;if(n=n?r.template(n):t.proxy(r.template("#:this._text(data)#",{useWithBlock:!1}),e),e.valueTemplate=n,e.hasOptionLabel())try{e.valueTemplate(e._optionLabelDataItem())}catch(i){throw Error(S)}},_textAccessor:function(n){var i,o=null,r=this.valueTemplate,s=this.options,a=s.optionLabel,l=this.span;if(n===e)return l.text();t.isPlainObject(n)||n instanceof h?o=n:a&&this._optionLabelText()===n&&(o=a,r=this.optionLabelTemplate),o||(o=this._assignInstance(n,this._accessor())),i=function(){return{elements:l.get(),data:[{dataItem:o}]}},this.angular("cleanup",i);try{l.html(r(o))}catch(c){l.html("")}this.angular("compile",i)},_preselect:function(t,e){t||e||(e=this._optionLabelText()),this._accessor(t),this._textAccessor(e),this._old=this._accessor(),this._oldIndex=this.selectedIndex,this.listView.setValue(t),this._initialIndex=null,this._presetValue=!0},_assignInstance:function(t,e){var i=this.options.dataTextField,o={};return i?(n(o,i.split("."),t),n(o,this.options.dataValueField.split("."),e),o=new h(o)):o=t,o}});s.plugin(A)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("dataviz/diagram/dom.min",["kendo.data.min","kendo.draganddrop.min","kendo.toolbar.min","kendo.editable.min","kendo.window.min","kendo.dropdownlist.min","kendo.dataviz.core.min","kendo.dataviz.themes.min","dataviz/diagram/svg.min","dataviz/diagram/services.min","dataviz/diagram/layout.min"],t)}(function(){!function(t,e){function n(t){var e=t.originalEvent,n=0;return e.wheelDelta?(n=-e.wheelDelta/40,n=n>0?yt.ceil(n):yt.floor(n)):e.detail&&(n=e.detail),n}function i(t){return t.options.name.toLowerCase()===Mt.toLowerCase()}function o(t,e){var n,o,r,s,a=Lt,l=e.connectors;for(o=0;l.length>o;o++)r=l[o],i(r)||(s=t.distanceTo(r.position()),a>s&&(a=s,n=r));return n}function r(t,e){var n,i,o,r=[],s=t.drawingContainer().children,a=s.length;for(n=0;e.length>n;n++)for(i=e[n],o=0;a>o;o++)if(s[o]==i.drawingContainer()){r.push(o);break}return r}function s(t){var e={};return t=t||{},ft(t.text)&&null!==t.text&&(e.text=t.text),ft(t.x)&&null!==t.x&&(e.x=t.x),ft(t.y)&&null!==t.y&&(e.y=t.y),ft(t.width)&&null!==t.width&&(e.width=t.width),ft(t.height)&&null!==t.height&&(e.height=t.height),ft(t.type)&&null!==t.type&&(e.type=t.type),e}function a(t){var e={};return t=t||{},ft(t.text)&&null!==t.text&&(e.content=t.text),ft(t.type)&&null!==t.type&&(e.type=t.type),ft(t.from)&&null!==t.from&&(e.from=t.from),ft(t.fromConnector)&&null!==t.fromConnector&&(e.fromConnector=t.fromConnector),ft(t.fromX)&&null!==t.fromX&&(e.fromX=t.fromX),ft(t.fromY)&&null!==t.fromY&&(e.fromY=t.fromY),ft(t.to)&&null!==t.to&&(e.to=t.to),ft(t.toConnector)&&null!==t.toConnector&&(e.toConnector=t.toConnector),ft(t.toX)&&null!==t.toX&&(e.toX=t.toX),ft(t.toY)&&null!==t.toY&&(e.toY=t.toY),e}function l(e,n){var i,o=this.dataSource.reader.model;o&&(i=o.fn.fields.text?"text":o.idField,t(" ").appendTo(e).kendoDropDownList({dataValueField:o.idField,dataTextField:i,dataSource:this.dataSource.data().toJSON(),optionLabel:" ",valuePrimitive:!0}))}function c(t){this.dataItem=t,this.callbacks=[]}function h(){this.items={}}function u(t){var e=t;return t instanceof kendo.data.Model&&(e=t.toJSON(),e[t.idField]=t._defaultId),e}function d(t){var e,n,i=[],o=[];for(n=0;t.length>n;n++)e=t[n],e instanceof w?o.push(e):i.push(e);return{shapes:o,connections:i}}function f(t,e){return t.reader.model?new t.reader.model(e):new kendo.data.ObservableObject(e)}function p(t,e){ft(e[t])&&e.set(t,null)}function g(t,e,n){var i,o;for(o=0;n.length>o;o++)i=n[o],e&&!ft(e[i])&&(e[i]=t[i])}function m(t){var e=t.drawingContainer().clippedBBox(null);(0!==e.origin.x||0!==e.origin.y)&&t.position(-e.origin.x,-e.origin.y)}var v,y,_,w,x,b,k,C,S,T,A,D,P=kendo.dataviz,M=kendo.drawing,E=kendo.geometry,B=P.diagram,I=kendo.ui.Widget,z=kendo.Class,L=t.proxy,R=kendo.deepExtend,O=t.extend,F=kendo.data.HierarchicalDataSource,V=B.Canvas,N=B.Group,H=B.Rectangle,U=B.Circle,j=B.CompositeTransform,G=B.Rect,W=B.Path,q=B.DeleteShapeUnit,$=B.DeleteConnectionUnit,Y=B.TextBlock,X=B.Image,Q=B.Point,K=B.Intersect,Z=B.ConnectionEditAdorner,J=B.UndoRedoService,tt=B.ToolService,et=B.Selector,nt=B.ResizingAdorner,it=B.ConnectorsAdorner,ot=B.Cursors,rt=B.Utils,st=kendo.Observable,at=B.ToBackUnit,lt=B.ToFrontUnit,ct=B.PolylineRouter,ht=B.CascadingRouter,ut=rt.isUndefined,dt=rt.isDefined,ft=kendo.util.defined,pt=t.isArray,gt=kendo.isFunction,mt=rt.isString,vt=t.isPlainObject,yt=Math,_t=".kendoDiagram",wt="cascading",xt="itemBoundsChange",bt="change",kt="click",Ct="drag",St="dragEnd",Tt="dragStart",At="mouseEnter",Dt="mouseLeave",Pt="error",Mt="Auto",Et="Top",Bt="Right",It="Left",zt="Bottom",Lt=9007199254740992,Rt="select",Ot="itemRotate",Ft="pan",Vt="zoomStart",Nt="zoomEnd",Ht="none",Ut=600,jt=600,Gt="rectangle",Wt=100,qt=100,$t=20,Yt=20,Xt=0,Qt="Yellow",Kt=Number.MAX_VALUE,Zt=-Number.MAX_VALUE,Jt="absolute",te="transformed",ee="rotated",ne="transparent",ie="width",oe="height",re="x",se="y",ae="DOMMouseScroll"+_t+" mousewheel"+_t,le=.05,ce=5,he=' #=text# ',ue=5;B.DefaultConnectors=[{name:Et},{name:zt},{name:It},{name:Bt},{name:Mt,position:function(t){return t.getPosition("center")}}],v={cancel:{text:"Cancel",imageClass:"k-cancel",className:"k-diagram-cancel",iconClass:"k-icon"},update:{text:"Update",imageClass:"k-update",className:"k-diagram-update",iconClass:"k-icon"}},B.shapeDefaults=function(t){var e={type:Gt,path:"",autoSize:!0,visual:null,x:Xt,y:Xt,minWidth:$t,minHeight:Yt,width:Wt,height:qt,hover:{},editable:{connect:!0,tools:[]},connectors:B.DefaultConnectors,rotation:{angle:0}};return rt.simpleExtend(e,t),e},y=st.extend({init:function(t){var e=this;e.dataItem=(t||{}).dataItem,st.fn.init.call(e),e.options=R({id:B.randomId()},e.options,t),e.isSelected=!1,e.visual=new N({id:e.options.id,autoSize:e.options.autoSize}),e.id=e.options.id,e._template()},options:{hover:{},cursor:ot.grip,content:{align:"center middle"},selectable:!0,serializable:!0,enable:!0},_getCursor:function(t){return this.adorner?this.adorner._getCursor(t):this.options.cursor},visible:function(t){return ut(t)?this.visual.visible():(this.visual.visible(t),e)},bounds:function(){},refresh:function(){this.visual.redraw()},position:function(t){this.options.x=t.x,this.options.y=t.y,this.visual.position(t)},toString:function(){return this.options.id},serialize:function(){var t=R({},{options:this.options});return this.dataItem&&(t.dataItem=""+this.dataItem),t},_content:function(t){var n,i,o;return t!==e&&(n=this.options,B.Utils.isString(t)?n.content.text=t:R(n.content,t),i=n.content,o=this._contentVisual,o?this._updateContentVisual(i):this._createContentVisual(i)),this.options.content.text},_createContentVisual:function(t){t.text&&(this._contentVisual=new Y(t),this._contentVisual._includeInBBox=!1,this.visual.append(this._contentVisual))},_updateContentVisual:function(t){this._contentVisual.redraw(t)},_hitTest:function(t){var e=this.bounds();return this.visible()&&e.contains(t)&&this.options.enable},_template:function(){var t,e,n=this;n.options.content.template&&(t=n.dataItem||{},e=kendo.template(n.options.content.template,{paramName:"dataItem"}),n.options.content.text=e(t))},_canSelect:function(){return this.options.selectable!==!1},toJSON:function(){return{id:this.options.id}}}),_=z.extend({init:function(t,e){this.options=R({},this.options,e),this.connections=[],this.shape=t},options:{width:7,height:7,fill:{color:Qt},hover:{}},position:function(){return this.options.position?this.options.position(this.shape):this.shape.getPosition(this.options.name)},toJSON:function(){return{shapeId:""+this.shape,connector:this.options.name}}}),_.parse=function(t,e){var n,i,o=e.split(":"),r=o[0],s=o[1]||Mt;for(n=0;t.shapes.length>n;n++)if(i=t.shapes[n],i.options.id==r)return i.getConnector(s.trim())},w=y.extend({init:function(t,e){var n=this;y.fn.init.call(n,t),this.diagram=e,this.updateOptionsFromModel(),t=n.options,n.connectors=[],n.type=t.type,n.createShapeVisual(),n.updateBounds(),n.content(n.content()),n._createConnectors()},options:B.shapeDefaults(),_setOptionsFromModel:function(t){var e=s(t||this.dataItem);this.options=R({},this.options,e),this.redrawVisual(),this.options.content&&(this._template(),this.content(this.options.content))},updateOptionsFromModel:function(t,e){var n,i;this.diagram&&this.diagram._isEditable&&(n=s(t||this.dataItem),t&&e?P.inArray(e,["x","y","width","height"])?(i=this.bounds(),i[e]=t[e],this.bounds(i)):(this.options.visual?this.redrawVisual():n.type&&(this.options=R({},this.options,n),this.redrawVisual()),this.options.content&&(this._template(),this.content(this.options.content))):this.options=R({},this.options,n))},redrawVisual:function(){this.visual.clear(),this._contentVisual=null,this.options.dataItem=this.dataItem,this.createShapeVisual(),this.updateBounds()},updateModel:function(t){var e,n,i=this.diagram;i&&i._isEditable&&(e=this._bounds,n=this.dataItem,n&&(i._suspendModelRefresh(),ft(n.x)&&e.x!==n.x&&n.set("x",e.x),ft(n.y)&&e.y!==n.y&&n.set("y",e.y),ft(n.width)&&e.width!==n.width&&n.set("width",e.width),ft(n.height)&&e.height!==n.height&&n.set("height",e.height),this.dataItem=n,i._resumeModelRefresh(),t&&i._syncShapeChanges()))},updateBounds:function(){var t=this.visual._measure(!0),e=this.options;this.bounds(new G(e.x,e.y,t.width,t.height)),this._rotate(),this._alignContent()},content:function(t){var e=this._content(t);return this._alignContent(),e},_alignContent:function(){var t,e,n,i,o,r=this.options.content||{},s=this._contentVisual;s&&r.align&&(t=this.visual._measure(),e=new B.RectAlign(t),n=s.drawingElement.bbox(null),i=new G(0,0,n.width(),n.height()),o=e.align(i,r.align),s.position(o.topLeft()))},_createConnectors:function(){var t,e,n=this.options,i=n.connectors.length,o=n.connectorDefaults;for(e=0;i>e;e++)t=new _(this,R({},o,n.connectors[e])),this.connectors.push(t)},bounds:function(t){var e,n;if(t)if(mt(t))switch(t){case te:e=this._transformedBounds();break;case Jt:e=this._transformedBounds(),n=this.diagram._pan,e.x+=n.x,e.y+=n.y;break;case ee:e=this._rotatedBounds();break;default:e=this._bounds}else this._setBounds(t),this._triggerBoundsChange(),this.diagram&&this.diagram._layouting||this.refreshConnections();else e=this._bounds;return e},_setBounds:function(t){var e=this.options,n=t.topLeft(),i=e.x=n.x,o=e.y=n.y,r=e.width=yt.max(t.width,e.minWidth),s=e.height=yt.max(t.height,e.minHeight);this._bounds=new G(i,o,r,s),this.visual.redraw({x:i,y:o,width:r,height:s})},position:function(t){return t?(this.bounds(new G(t.x,t.y,this._bounds.width,this._bounds.height)),e):this._bounds.topLeft()},clone:function(){var t=this.serialize();return t.options.id=B.randomId(),this.diagram&&this.diagram._isEditable&&ft(this.dataItem)&&(t.options.dataItem=u(this.dataItem)),new w(t.options)},select:function(t){var n,i,o=this.diagram;return ut(t)&&(t=!0),this._canSelect()&&this.isSelected!=t?(n=[],i=[],this.isSelected=t,this.isSelected?(o._selectedItems.push(this),n.push(this)):(rt.remove(o._selectedItems,this),i.push(this)),o._internalSelection||o._selectionChanged(n,i),!0):e},rotate:function(t,n,i){var o,r,s,a,l=this.visual.rotate();return t!==e&&(i!==!1&&this.diagram&&this.diagram.undoRedoService&&t!==l.angle&&this.diagram.undoRedoService.add(new B.RotateUnit(this.diagram._resizingAdorner,[this],[l.angle]),!1),o=this.bounds(),r=new Q(o.width/2,o.height/2),n&&(s=t-l.angle,a=o.center().rotate(n,360-s).minus(r),this._rotationOffset=this._rotationOffset.plus(a.minus(o.topLeft())),this.position(a)),this.visual.rotate(t,r),this.options.rotation.angle=t,this.diagram&&this.diagram._connectorsAdorner&&this.diagram._connectorsAdorner.refresh(),this.refreshConnections(),this.diagram&&this.diagram.trigger(Ot,{item:this})),l},connections:function(t){var e,n,i,o,r,s,a,l=[];for(e=0;this.connectors.length>e;e++)for(r=this.connectors[e],o=r.connections,n=0,o;o.length>n;n++)i=o[n],"out"==t?(s=i.source(),s.shape&&s.shape==this&&l.push(i)):"in"==t?(a=i.target(),a.shape&&a.shape==this&&l.push(i)):l.push(i);return l},refreshConnections:function(){t.each(this.connections(),function(){this.refresh()})},getConnector:function(t){var e,n;if(!mt(t))return t instanceof Q?o(t,this):this.connectors.length?this.connectors[0]:null;for(t=t.toLocaleLowerCase(),e=0;this.connectors.length>e;e++)if(n=this.connectors[e],n.options.name.toLocaleLowerCase()==t)return n},getPosition:function(t){var e=this.bounds(),n=t.charAt(0).toLowerCase()+t.slice(1);return gt(e[n])?this._transformPoint(e[n]()):e.center()},redraw:function(t){var e,n;t&&(e=this.options,this.shapeVisual.redraw(this._visualOptions(t)),this._diffNumericOptions(t,[ie,oe,re,se])&&(this.bounds(new G(e.x,e.y,e.width,e.height)),n=!0),t.connectors&&(e.connectors=t.connectors,this._updateConnectors()),e=R(e,t),(t.rotation||n)&&this._rotate(),e.content&&this.content(e.content))},_updateConnectors:function(){var t,e,n,i,o=this.connections();for(this.connectors=[],this._createConnectors(),i=0;o.length>i;i++)t=o[i],e=t.source(),n=t.target(),e.shape&&e.shape===this?t.source(this.getConnector(e.options.name)||null):n.shape&&n.shape===this&&t.target(this.getConnector(n.options.name)||null),t.updateModel()},_diffNumericOptions:B.diffNumericOptions,_visualOptions:function(t){return{data:t.path,source:t.source,hover:t.hover,fill:t.fill,stroke:t.stroke}},_triggerBoundsChange:function(){this.diagram&&this.diagram.trigger(xt,{item:this,bounds:this._bounds.clone()})},_transformPoint:function(t){var e=this.rotate(),n=this.bounds(),i=n.topLeft();return e.angle&&t.rotate(e.center().plus(i),360-e.angle),t},_transformedBounds:function(){var t=this.bounds(),e=t.topLeft(),n=t.bottomRight();return G.fromPoints(this.diagram.modelToView(e),this.diagram.modelToView(n))},_rotatedBounds:function(){var t=this.bounds().rotatedBounds(this.rotate().angle),e=t.topLeft(),n=t.bottomRight();return G.fromPoints(e,n)},_rotate:function(){var t=this.options.rotation;t&&t.angle&&this.rotate(t.angle),this._rotationOffset=new Q},_hover:function(t){var e=this.options,n=e.hover,i=e.stroke,o=e.fill;t&&dt(n.stroke)&&(i=R({},i,n.stroke)),t&&dt(n.fill)&&(o=n.fill),this.shapeVisual.redraw({stroke:i,fill:o}),e.editable&&e.editable.connect&&this.diagram._showConnectors(this,t)},_hitTest:function(t){if(this.visible()){var e,n=this.bounds(),i=this.rotate().angle;if(t.isEmpty&&!t.isEmpty())return K.rects(t,n,i?i:0);if(e=t.clone().rotate(n.center(),i),n.contains(e))return this}},toJSON:function(){return{shapeId:this.options.id}},createShapeVisual:function(){var t,e=this.options,n=this._visualOptions(e),i=e.visual,o=(e.type+"").toLocaleLowerCase();n.width=e.width,n.height=e.height,gt(i)?t=i.call(this,e):n.data?(t=new W(n),m(t)):t="rectangle"==o?new H(n):"circle"==o?new U(n):"text"==o?new Y(n):"image"==o?new X(n):new W(n),this.shapeVisual=t,this.visual.append(this.shapeVisual)}}),x=y.extend({init:function(t,e,n){var i=this;y.fn.init.call(i,n),this.updateOptionsFromModel(),this._initRouter(),i.path=new B.Polyline(i.options),i.path.fill(ne),i.visual.append(i.path),i._sourcePoint=i._targetPoint=new Q,i._setSource(t),i._setTarget(e),i.content(i.options.content),i.definers=[],ft(n)&&n.points&&i.points(n.points)},options:{hover:{stroke:{}},startCap:Ht,endCap:Ht,points:[],selectable:!0,fromConnector:Mt,toConenctor:Mt},_setOptionsFromModel:function(t){this.updateOptionsFromModel(t||this.dataItem)},updateOptionsFromModel:function(t){var e,n,i,o;this.diagram&&this.diagram._isEditable&&(e=this.diagram._dataMap,n=a(t||this.dataItem),t?(ft(n.from)?(i=e[n.from],i&&ft(n.fromConnector)&&(i=i.getConnector(n.fromConnector)),this.source(i)):ft(n.fromX)&&ft(n.fromY)&&this.source(new Q(n.fromX,n.fromY)),ft(n.to)?(o=e[n.to],o&&ft(n.toConnector)&&(o=o.getConnector(n.toConnector)),this.target(o)):ft(n.toX)&&ft(n.toY)&&this.target(new Q(n.toX,n.toY)),ft(n.type)&&this.type()!==n.type&&(this.points([]),this.type(n.type)),this.dataItem=t,this._template(),this.redraw(this.options)):this.options=R({},n,this.options))},updateModel:function(t){if(this.diagram&&this.diagram._isEditable&&this.diagram.connectionsDataSource){var e=this.diagram.connectionsDataSource.getByUid(this.dataItem.uid);e&&(this.diagram._suspendModelRefresh(),ft(this.options.fromX)&&null!==this.options.fromX?(p("from",e),p("fromConnector",e),e.set("fromX",this.options.fromX),e.set("fromY",this.options.fromY)):(e.set("from",this.options.from),ft(e.fromConnector)&&e.set("fromConnector",this.sourceConnector?this.sourceConnector.options.name:null),p("fromX",e),p("fromY",e)),ft(this.options.toX)&&null!==this.options.toX?(p("to",e),p("toConnector",e),e.set("toX",this.options.toX),e.set("toY",this.options.toY)):(e.set("to",this.options.to),ft(e.toConnector)&&e.set("toConnector",this.targetConnector?this.targetConnector.options.name:null),p("toX",e),p("toY",e)),ft(this.options.type)&&ft(e.type)&&e.set("type",this.options.type),this.dataItem=e,this.diagram._resumeModelRefresh(),t&&this.diagram._syncConnectionChanges())}},sourcePoint:function(){return this._resolvedSourceConnector?this._resolvedSourceConnector.position():this._sourcePoint},_setSource:function(t){var n,i=t instanceof w,o=this.options.fromConnector||Mt;(!i||t.getConnector(o))&&(t!==e&&(this.from=t),this._removeFromSourceConnector(),null===t?this.sourceConnector&&(this._sourcePoint=(this._resolvedSourceConnector||this.sourceConnector).position(),this._clearSourceConnector(),this._setFromOptions(null,this._sourcePoint)):t instanceof _?(n=t.shape.dataItem,n&&this._setFromOptions(n.id),this.sourceConnector=t,this.sourceConnector.connections.push(this)):t instanceof Q?(this._setFromOptions(null,t),this._sourcePoint=t,this.sourceConnector&&this._clearSourceConnector()):i&&(n=t.dataItem,n&&this._setFromOptions(n.id),this.sourceConnector=t.getConnector(o),this.sourceConnector.connections.push(this)))},source:function(t,e){return dt(t)&&(e&&this.diagram&&this.diagram.undoRedoService.addCompositeItem(new B.ConnectionEditUnit(this,t)),this._setSource(t),this.refresh()),this.sourceConnector?this.sourceConnector:this._sourcePoint},_setFromOptions:function(t,e){this.options.from=t,e?(this.options.fromX=e.x,this.options.fromY=e.y):(this.options.fromX=null,this.options.fromY=null)},sourceDefiner:function(t){if(!t)return this._sourceDefiner||(this._sourceDefiner=new B.PathDefiner(this.sourcePoint(),null,null)),this._sourceDefiner;if(!(t instanceof B.PathDefiner))throw"The sourceDefiner needs to be a PathDefiner.";t.left=null,this._sourceDefiner=t,this.source(t.point)},targetPoint:function(){return this._resolvedTargetConnector?this._resolvedTargetConnector.position():this._targetPoint},_setTarget:function(t){var n,i=t instanceof w,o=this.options.toConnector||Mt;(!i||t.getConnector(o))&&(t!==e&&(this.to=t),this._removeFromTargetConnector(),null===t?this.targetConnector&&(this._targetPoint=(this._resolvedTargetConnector||this.targetConnector).position(),this._clearTargetConnector(),this._setToOptions(null,this._targetPoint)):t instanceof _?(n=t.shape.dataItem,n&&this._setToOptions(n.id),this.targetConnector=t,this.targetConnector.connections.push(this)):t instanceof Q?(this._setToOptions(null,t),this._targetPoint=t,this.targetConnector&&this._clearTargetConnector()):i&&(n=t.dataItem,n&&this._setToOptions(n.id),this.targetConnector=t.getConnector(o),this.targetConnector.connections.push(this)))},target:function(t,n){return dt(t)&&(n&&this.diagram&&this.diagram.undoRedoService.addCompositeItem(new B.ConnectionEditUnit(this,e,t)),this._setTarget(t),this.refresh()),this.targetConnector?this.targetConnector:this._targetPoint},_setToOptions:function(t,e){this.options.to=t,e?(this.options.toX=e.x,this.options.toY=e.y):(this.options.toX=null,this.options.toY=null)},targetDefiner:function(t){if(!t)return this._targetDefiner||(this._targetDefiner=new B.PathDefiner(this.targetPoint(),null,null)),this._targetDefiner;if(!(t instanceof B.PathDefiner))throw"The sourceDefiner needs to be a PathDefiner.";t.right=null,this._targetDefiner=t,this.target(t.point)},_updateConnectors:function(){this._updateConnector(this.source(),"source"),this._updateConnector(this.target(),"target")},_updateConnector:function(t,e){var n,i,o,r,s=this,a=s.diagram;t instanceof _&&!a.getShapeById(t.shape.id)?(n=t.shape.dataItem,i=t.options.name,o=function(){var o=a._dataMap[n.id];t=o.getConnector(i),s[e](t,!1),s.updateModel()},a._dataMap[n.id]?o():(r=a._inactiveShapeItems.getByUid(n.uid),r&&a._deferredConnectionUpdates.push(r.onActivate(o)))):s[e](t,!1)},content:function(t){var e=this._content(t);return ft(t)&&this._alignContent(),e},_createContentVisual:function(t){var e;return gt(t.visual)?e=t.visual.call(this,t):t.text&&(e=new Y(t)),e&&(this._contentVisual=e,e._includeInBBox=!1,this.visual.append(e)),e},_updateContentVisual:function(t){gt(t.visual)?(this.visual.remove(this._contentVisual),this._createContentVisual(t)):this._contentVisual.redraw(t)},_alignContent:function(){var t,e,n,i,o,r,s,a,l,c,h,u,d,f,p,g;if(this._contentVisual){for(t=ue,e=this.allPoints(),n=yt.floor(e.length/2),i=n-1;i>0&&e[i].equals(e[n]);)i--,n++;o=e[n],r=e[i],s=this._contentVisual._measure(),a=s.width,l=s.height,c=e.length%2===0,h=r.distanceTo(o),c&&e.length>2&&h>0&&(r.y===o.y&&a>h||r.x===o.x&&l>h)&&(c=!1,t=0),c?(d=kendo.util.deg(yt.atan2(o.y-r.y,o.x-r.x)),u=new Q((o.x-r.x)/2+r.x,(o.y-r.y)/2+r.y),90===yt.abs(d)?(u.x+=t,u.y-=l/2):d%180===0?(u.x-=a/2,u.y-=l+t):-90>d||d>0&&90>d?u.y-=l:(0>d||d>90)&&(u.x-=a,u.y-=l)):(f=yt.floor(e.length/2),u=e[f].clone(),r=e[f-1],o=e[f+1],p=u.x>=r.x&&u.x>=o.x?t:-s.width-t,g=u.y>=r.y&&u.y>=o.y?t:-s.height-t,u.x+=p,u.y+=g),this._contentVisual.position(u)}},select:function(t){var n,i,o=this.diagram;return this._canSelect()&&this.isSelected!==t?(this.isSelected=t,n=[],i=[],this.isSelected?(this.adorner=new Z(this,this.options.selection),o._adorn(this.adorner,!0),o._selectedItems.push(this),n.push(this)):this.adorner&&(o._adorn(this.adorner,!1),rt.remove(o._selectedItems,this),this.adorner=e,i.push(this)),this.adorner&&this.adorner.refresh(),o._internalSelection||o._selectionChanged(n,i),!0):e},bounds:function(t){return!t||mt(t)?this._bounds:(this._bounds=t,e)},type:function(t){var n=this.options;return t?(t!==n.type&&(n.type=t,this._initRouter(),this.refresh()),e):n.type},_initRouter:function(){var t=(this.options.type||"").toLowerCase();this._router=t==wt?new ht(this):new ct(this)},points:function(t){var e,n,i,o;if(!t){if(i=[],dt(this.definers))for(o=0;this.definers.length>o;o++)i.push(this.definers[o].point);return i}for(this.definers=[],e=0;t.length>e;e++)if(n=t[e],n instanceof B.Point)this.definers.push(new B.PathDefiner(n));else{if(!n.hasOwnProperty("x")||!n.hasOwnProperty("y"))throw"A Connection point needs to be a Point or an object with x and y properties.";this.definers.push(new B.PathDefiner(new Q(n.x,n.y)))}},allPoints:function(){var t,e=[this.sourcePoint()];if(this.definers)for(t=0;this.definers.length>t;t++)e.push(this.definers[t].point);return e.push(this.targetPoint()),e},refresh:function(){this._resolveConnectors(),this._refreshPath(),this._alignContent(),this.adorner&&this.adorner.refresh()},_resolveConnectors:function(){var t,e,n,r,s=this,a=s.source(),l=s.target();a instanceof Q?t=a:a instanceof _&&(i(a)?n=a.shape:(s._resolvedSourceConnector=a,t=a.position())),l instanceof Q?e=l:l instanceof _&&(i(l)?r=l.shape:(s._resolvedTargetConnector=l,e=l.position())),t?r&&(s._resolvedTargetConnector=o(t,r)):n&&(e?s._resolvedSourceConnector=o(e,n):r&&this._resolveAutoConnectors(n,r))},_resolveAutoConnectors:function(t,e){var n,o,r,s,a,l,c,h,u,d,f,p,g=Lt,m=Lt,v=t.connectors;for(d=0;v.length>d;d++)if(h=v[d],!i(h))for(s=h.position(),n=e.connectors,f=0;n.length>f;f++)u=n[f],i(u)||(a=u.position(),p=yt.round(s.distanceTo(a)),g>p&&this.diagram&&this._testRoutePoints(s,a,h,u)&&(g=p,o=h,r=u),m>p&&(l=h,c=u,m=p));o&&(l=o,c=r),this._resolvedSourceConnector=l,
this._resolvedTargetConnector=c},_testRoutePoints:function(t,e,n,i){var o,r,s,a,l,c=this._router,h=!0;if(c instanceof ht)for(o=c.routePoints(t,e,n,i),o.unshift(t),o.push(e),l=1;o.length>l;l++)if(r=o[l-1],s=o[l],a=new G(yt.min(r.x,s.x),yt.min(r.y,s.y),yt.abs(r.x-s.x),yt.abs(r.y-s.y)),a.width>0&&(a.x++,a.width-=2),a.height>0&&(a.y++,a.height-=2),!a.isEmpty()&&this.diagram._shapesQuadTree.hitTestRect(a)){h=!1;break}return h},redraw:function(t){if(t){this.options=R({},this.options,t);var e=this.options.points;ft(e)&&e.length>0&&(this.points(e),this._refreshPath()),(t&&t.content||t.text)&&this.content(t.content),this.path.redraw({fill:t.fill,stroke:t.stroke,startCap:t.startCap,endCap:t.endCap})}},clone:function(){var t=this.serialize();return this.diagram&&this.diagram._isEditable&&ft(this.dataItem)&&(t.options.dataItem=u(this.dataItem)),new x(this.from,this.to,t.options)},serialize:function(){var t=this.from.toJSON?this.from.toJSON:""+this.from,e=this.to.toJSON?this.to.toJSON:""+this.to,n=R({},{options:this.options,from:t,to:e});return ft(this.dataItem)&&(n.dataItem=""+this.dataItem),n.options.points=this.points(),n},_hitTest:function(t){if(this.visible()){var e=new Q(t.x,t.y),n=this.sourcePoint(),i=this.targetPoint();if(t.isEmpty&&!t.isEmpty()&&t.contains(n)&&t.contains(i))return this;if(this._router.hitTest(e))return this}},_hover:function(t){var e=(this.options.stroke||{}).color;t&&dt(this.options.hover.stroke.color)&&(e=this.options.hover.stroke.color),this.path.redraw({stroke:{color:e}})},_refreshPath:function(){ft(this.path)&&(this._drawPath(),this.bounds(this._router.getBounds()))},_drawPath:function(){var t,e,n;this._router&&this._router.route(),t=this.sourcePoint(),e=this.targetPoint(),n=this.points(),this.path.redraw({points:[t].concat(n,[e])})},_clearSourceConnector:function(){this.sourceConnector=e,this._resolvedSourceConnector=e},_clearTargetConnector:function(){this.targetConnector=e,this._resolvedTargetConnector=e},_removeFromSourceConnector:function(){this.sourceConnector&&rt.remove(this.sourceConnector.connections,this)},_removeFromTargetConnector:function(){this.targetConnector&&rt.remove(this.targetConnector.connections,this)},toJSON:function(){var t,e,n,i=this;return i.from&&i.from.toJSON?t=i.from.toJSON():(n=i._sourcePoint,t={x:n.x,y:n.y}),i.to&&i.to.toJSON?e=i.to.toJSON():(n=i._targetPoint,e={x:n.x,y:n.y}),{from:t,to:e}}}),b=I.extend({init:function(t,e){var n=this;kendo.destroy(t),I.fn.init.call(n,t,e),n._initTheme(),n._initElements(),n._extendLayoutOptions(n.options),n._initDefaults(e),n._initCanvas(),n.mainLayer=new N({id:"main-layer"}),n.canvas.append(n.mainLayer),n._shapesQuadTree=new D(n),n._pan=new Q,n._adorners=[],n.adornerLayer=new N({id:"adorner-layer"}),n.canvas.append(n.adornerLayer),n._createHandlers(),n._initialize(),n._fetchFreshData(),n._createGlobalToolBar(),n._resizingAdorner=new nt(n,{editable:n.options.editable}),n._connectorsAdorner=new it(n),n._adorn(n._resizingAdorner,!0),n._adorn(n._connectorsAdorner,!0),n.selector=new et(n),n._clipboard=[],n.pauseMouseHandlers=!1,n._createOptionElements(),n.zoom(n.options.zoom),n.canvas.draw()},options:{name:"Diagram",theme:"default",layout:"",zoomRate:.1,zoom:1,zoomMin:0,zoomMax:2,dataSource:{},draggable:!0,template:"",autoBind:!0,editable:{rotate:{},resize:{},text:!0,tools:[],drag:{snap:{size:10,angle:10}},remove:!0},pannable:{key:"ctrl"},selectable:{key:"none"},tooltip:{enabled:!0,format:"{0}"},copy:{enabled:!0,offsetX:20,offsetY:20},shapeDefaults:B.shapeDefaults({undoable:!0}),connectionDefaults:{editable:{tools:[]},type:wt},shapes:[],connections:[]},events:[Nt,Vt,Ft,Rt,Ot,xt,bt,kt,At,Dt,"toolBarClick","save","cancel","edit","remove","add","dataBound",Tt,Ct,St],items:function(){return t()},_createGlobalToolBar:function(){var t,e=this.options.editable;e&&(t=e.tools,!this._isEditable||t===!1||t&&0!==t.length||(t=["createShape","undo","redo","rotateClockwise","rotateAnticlockwise"]),t&&t.length&&(this.toolBar=new k(this,{tools:t||{},click:L(this._toolBarClick,this),modal:!1}),this.toolBar.element.css({textAlign:"left"}),this.element.prepend(this.toolBar.element),this._resize()))},createShape:function(){var t,e,n,i,o,r;(this.editor&&this.editor.end()||!this.editor)&&(t=this.dataSource,e=t.view()||[],n=e.length,i=f(t,{}),o=this._createShape(i,{}),this.trigger("add",{shape:o})||(t.insert(n,i),r=this._inactiveShapeItems.getByUid(i.uid),r.element=o,this.edit(o)))},_createShape:function(t,e){e=R({},this.options.shapeDefaults,e),e.dataItem=t;var n=new w(e,this);return n},createConnection:function(){var t,e,n,i,o;(this.editor&&this.editor.end()||!this.editor)&&(t=this.connectionsDataSource,e=t.view()||[],n=e.length,i=f(t,{}),o=this._createConnection(i),this.trigger("add",{connection:o})||(this._connectionsDataMap[i.uid]=o,t.insert(n,i),this.addConnection(o,!1),this.edit(o)))},_createConnection:function(t,e,n){var i,o=R({},this.options.connectionDefaults);return o.dataItem=t,i=new x(e||new Q,n||new Q,o)},editModel:function(t,e){var n,i,o,r;if(this.cancelEdit(),o=this.options.editable,"shape"==e)n=o.shapeEditors,i=o.shapeTemplate;else{if("connection"!=e)return;r=L(l,this),n=R({},{from:r,to:r},o.connectionEditors),i=o.connectionTemplate}this.editor=new S(this.element,{update:L(this._update,this),cancel:L(this._cancel,this),model:t,type:e,target:this,editors:n,template:i}),this.trigger("edit",this._editArgs())},edit:function(t){if(t.dataItem){var e=t instanceof w?"shape":"connection";this.editModel(t.dataItem,e)}},cancelEdit:function(){this.editor&&(this._getEditDataSource().cancelChanges(this.editor.model),this._destroyEditor())},saveEdit:function(){this.editor&&this.editor.end()&&!this.trigger("save",this._editArgs())&&this._getEditDataSource().sync()},_update:function(){this.editor&&this.editor.end()&&!this.trigger("save",this._editArgs())&&(this._getEditDataSource().sync(),this._destroyEditor())},_cancel:function(){var t,e;this.editor&&!this.trigger("cancel",this._editArgs())&&(t=this.editor.model,this._getEditDataSource().cancelChanges(t),e=this._connectionsDataMap[t.uid]||this._dataMap[t.id],e&&e._setOptionsFromModel(t),this._destroyEditor())},_getEditDataSource:function(){return"shape"===this.editor.options.type?this.dataSource:this.connectionsDataSource},_editArgs:function(){var t={container:this.editor.wrapper};return t[this.editor.options.type]=this.editor.model,t},_destroyEditor:function(){this.editor&&(this.editor.close(),this.editor=null)},_initElements:function(){this.wrapper=this.element.empty().css("position","relative").attr("tabindex",0).addClass("k-widget k-diagram"),this.scrollable=t("
").appendTo(this.element)},_initDefaults:function(t){var e=this.options,n=e.editable,i=e.shapeDefaults,o=e.connectionDefaults,r=(t||{}).shapeDefaults;n===!1?(i.editable=!1,o.editable=!1):(g(n,i.editable,["drag","remove","connect"]),g(n,o.editable,["drag","remove"])),r&&r.connectors&&(e.shapeDefaults.connectors=r.connectors)},_initCanvas:function(){var e=t("
").appendTo(this.scrollable)[0],n=this.viewport();this.canvas=new V(e,{width:n.width||Ut,height:n.height||jt})},_createHandlers:function(){var t=this,e=t.element;e.on(ae,L(t._wheel,t)),kendo.support.touch||kendo.support.mobileOS?(t._userEvents=new kendo.UserEvents(e,{multiTouch:!0,tap:L(t._tap,t)}),t._userEvents.bind(["gesturestart","gesturechange","gestureend"],{gesturestart:L(t._gestureStart,t),gesturechange:L(t._gestureChange,t),gestureend:L(t._gestureEnd,t)}),t.toolService=new tt(t),t.options.pannable!==!1&&t.scroller.enable()):(t.toolService=new tt(t),this.scroller.wrapper.on("mousemove"+_t,L(t._mouseMove,t)).on("mouseup"+_t,L(t._mouseUp,t)).on("mousedown"+_t,L(t._mouseDown,t)).on("mouseover"+_t,L(t._mouseover,t)).on("mouseout"+_t,L(t._mouseout,t)),e.on("keydown"+_t,L(t._keydown,t))),this._syncHandler=L(t._syncChanges,t),t._resizeHandler=L(t.resize,t,!1),kendo.onResize(t._resizeHandler),this.bind(Vt,L(t._destroyToolBar,t)),this.bind(Ft,L(t._destroyToolBar,t))},_tap:function(t){var e,n=this.toolService,i=this._caculateMobilePosition(t);n._updateHoveredItem(i),n.hoveredItem&&(e=n.hoveredItem,this.options.selectable!==!1&&(this._destroyToolBar(),e.isSelected?e.select(!1):this.select(e,{addToSelection:!0}),this._createToolBar()),this.trigger("click",{item:e,point:i}))},_caculateMobilePosition:function(t){return this.documentToModel(Q(t.x.location,t.y.location))},_gestureStart:function(t){var e,n;this._destroyToolBar(),this.scroller.disable(),e=this.documentToModel(new Q(t.center.x,t.center.y)),n={point:e,zoom:this.zoom()},this.trigger(Vt,n)||(this._gesture=t,this._initialCenter=e)},_gestureChange:function(t){var e,n,i=this._gesture,o=this._initialCenter,r=this.documentToView(new Q(t.center.x,t.center.y)),s=t.distance/i.distance,a=this._zoom,l=!1;yt.abs(s-1)>=le&&(this._zoom=a=this._getValidZoom(a*s),this.options.zoom=a,this._gesture=t,l=!0),e=o.times(a),n=r.minus(e),(l||this._pan.distanceTo(n)>=ce)&&(this._panTransform(n),this._updateAdorners()),t.preventDefault()},_gestureEnd:function(){this.options.pannable!==!1&&this.scroller.enable(),this.trigger(Nt,{point:this._initialCenter,zoom:this.zoom()})},_resize:function(){var t=this.viewport();this.canvas&&this.canvas.size(t),this.scrollable&&this.toolBar&&this.scrollable.height(t.height)},_mouseover:function(t){var e=t.target._kendoNode;e&&e.srcElement._hover&&e.srcElement._hover(!0,e.srcElement)},_mouseout:function(t){var e=t.target._kendoNode;e&&e.srcElement._hover&&e.srcElement._hover(!1,e.srcElement)},_initTheme:function(){var t=this,e=P.ui.themes||{},n=((t.options||{}).theme||"").toLowerCase(),i=(e[n]||{}).diagram;t.options=R({},i,t.options),t.options.editable===!0&&R(t.options,{editable:(i||{}).editable})},_createOptionElements:function(){var t=this.options,e=t.shapes.length;e&&this._createShapes(),t.connections.length&&this._createConnections(),e&&t.layout&&this.layout(t.layout)},_createShapes:function(){var t,e,n=this,i=n.options,o=i.shapes;for(e=0;o.length>e;e++)t=o[e],n.addShape(t)},_createConnections:function(){var t,e,n,i,o=this,r=o.options,s=r.connectionDefaults,a=r.connections;for(i=0;a.length>i;i++)t=a[i],e=o._findConnectionTarget(t.from),n=o._findConnectionTarget(t.to),o.connect(e,n,R({},s,t))},_findConnectionTarget:function(t){var e,n=this,i=mt(t)?t:t.shapeId||t.id;return i?(e=n.getShapeById(i),t.connector&&(e=e.getConnector(t.connector))):e=new Q(t.x||0,t.y||0),e},destroy:function(){var t=this;I.fn.destroy.call(t),this._userEvents&&this._userEvents.destroy(),kendo.unbindResize(t._resizeHandler),t.clear(),t.element.off(_t),t.scroller.wrapper.off(_t),t.canvas.destroy(!0),t.canvas=e,t._destroyEditor(),t.destroyScroller(),t._destroyGlobalToolBar(),t._destroyToolBar()},destroyScroller:function(){var t=this.scroller;t&&(t.destroy(),t.element.remove(),this.scroller=null)},save:function(){var t,e,n,i={shapes:[],connections:[]};for(t=0;this.shapes.length>t;t++)n=this.shapes[t],n.options.serializable&&i.shapes.push(n.options);for(t=0;this.connections.length>t;t++)e=this.connections[t],i.connections.push(R({},e.options,e.toJSON()));return i},focus:function(){if(!this.element.is(kendo._activeElement())){var t,e=this.element,n=e[0],i=[],o=[],r=document.documentElement;do n=n.parentNode,n.scrollHeight>n.clientHeight&&(i.push(n),o.push(n.scrollTop));while(n!=r);for(e.focus(),t=0;i.length>t;t++)i[t].scrollTop=o[t]}},load:function(t){this.clear(),this.setOptions(t),this._createShapes(),this._createConnections()},setOptions:function(t){R(this.options,t)},clear:function(){var t=this;t.select(!1),t.mainLayer.clear(),t._shapesQuadTree.clear(),t._initialize()},connect:function(t,e,n){var i,o;return this.connectionsDataSource&&this._isEditable?(o=this.connectionsDataSource.add({}),i=this._connectionsDataMap[o.uid],i.source(t),i.target(e),i.redraw(n),i.updateModel()):(i=new x(t,e,R({},this.options.connectionDefaults,n)),this.addConnection(i)),i},connected:function(t,e){var n,i;for(n=0;this.connections.length>n;n++)if(i=this.connections[n],i.from==t&&i.to==e)return!0;return!1},addConnection:function(t,e){return e!==!1&&this.undoRedoService.add(new B.AddConnectionUnit(t,this),!1),t.diagram=this,t._setOptionsFromModel(),t.refresh(),this.mainLayer.append(t.visual),this.connections.push(t),this.trigger(bt,{added:[t],removed:[]}),t},_addConnection:function(t,e){var n,i=this.connectionsDataSource;if(i&&this._isEditable){if(n=f(i,u(t.dataItem)),t.dataItem=n,t.updateModel(),!this.trigger("add",{connection:t}))return this._connectionsDataMap[n.uid]=t,i.add(n),this.addConnection(t,e),t._updateConnectors(),t}else if(!this.trigger("add",{connection:t}))return this.addConnection(t,e),t._updateConnectors(),t},addShape:function(t,e){var n,i=this.options.shapeDefaults;if(t instanceof w)n=t;else{if(t instanceof kendo.Class)return;i=R({},i,t||{}),n=new w(i,this)}return e!==!1&&this.undoRedoService.add(new B.AddShapeUnit(n,this),!1),this.shapes.push(n),n.diagram!==this&&(this._shapesQuadTree.insert(n),n.diagram=this),this.mainLayer.append(n.visual),this.trigger(bt,{added:[n],removed:[]}),n},_addShape:function(t,e){var n,i,o=this,r=o.dataSource;if(r&&this._isEditable){if(n=f(r,u(t.dataItem)),t.dataItem=n,t.updateModel(),!this.trigger("add",{shape:t}))return this.dataSource.add(n),i=this._inactiveShapeItems.getByUid(n.uid),i.element=t,i.undoable=e,t}else if(!this.trigger("add",{shape:t}))return this.addShape(t,e)},remove:function(t,e){var n,i,o,r;for(t=pt(t)?t.slice(0):[t],n=d(t),i=n.shapes,o=n.connections,ft(e)||(e=!0),e&&this.undoRedoService.begin(),this._suspendModelRefresh(),r=i.length-1;r>=0;r--)this._removeItem(i[r],e,o);for(r=o.length-1;r>=0;r--)this._removeItem(o[r],e);this._resumeModelRefresh(),e&&this.undoRedoService.commit(!1),this.trigger(bt,{added:[],removed:t})},_removeShapeDataItem:function(t){this._isEditable&&(this.dataSource.remove(t.dataItem),delete this._dataMap[t.dataItem.id])},_removeConnectionDataItem:function(t){this._isEditable&&(this.connectionsDataSource.remove(t.dataItem),delete this._connectionsDataMap[t.dataItem.uid])},_triggerRemove:function(t){var e,n,i,o,r=[];for(o=0;t.length>o;o++)e=t[o],i=e.options.editable,n=e instanceof w?{shape:e}:{connection:e},i&&i.remove!==!1&&!this.trigger("remove",n)&&r.push(e);return r},undo:function(){this.undoRedoService.undo()},redo:function(){this.undoRedoService.redo()},select:function(t,e){if(!dt(t))return this._selectedItems;e=R({addToSelection:!1},e);var n,i,o=e.addToSelection,r=[],s=[];for(o||this.deselect(),this._internalSelection=!0,t instanceof Array?r=t:t instanceof y&&(r=[t]),n=0;r.length>n;n++)i=r[n],i.select(!0)&&s.push(i);this._selectionChanged(s,[]),this._internalSelection=!1},selectAll:function(){this.select(this.shapes.concat(this.connections))},selectArea:function(t){var e,n,i,o;if(this._internalSelection=!0,o=[],t instanceof G)for(n=this.shapes.concat(this.connections),e=0;n.length>e;e++)i=n[e],t&&!i._hitTest(t)||!i.options.enable||i.select(!0)&&o.push(i);this._selectionChanged(o,[]),this._internalSelection=!1},deselect:function(t){this._internalSelection=!0;var e,n,i=[],o=[];for(t instanceof Array?o=t:t instanceof y?o.push(t):dt(t)||(o=this._selectedItems.slice(0)),n=0;o.length>n;n++)e=o[n],e.select(!1)&&i.push(e);this._selectionChanged([],i),this._internalSelection=!1},toFront:function(t,e){var n,i,o;t||(t=this._selectedItems.slice()),n=this._getDiagramItems(t),!ft(e)||e?(i=r(this.mainLayer,n.visuals),o=new lt(this,t,i),this.undoRedoService.add(o)):(this.mainLayer.toFront(n.visuals),this._fixOrdering(n,!0))},toBack:function(t,e){var n,i,o;t||(t=this._selectedItems.slice()),n=this._getDiagramItems(t),!ft(e)||e?(i=r(this.mainLayer,n.visuals),o=new at(this,t,i),this.undoRedoService.add(o)):(this.mainLayer.toBack(n.visuals),this._fixOrdering(n,!1))},bringIntoView:function(t,e){var n,i,o,r,s=this.viewport(),a=new B.RectAlign(s);0!==s.width&&0!==s.height&&(e=R({animate:!1,align:"center middle"},e),"none"==e.align&&(e.align="center middle"),t instanceof y?i=t.bounds(te):pt(t)?i=this.boundingBox(t):t instanceof G&&(i=t.clone()),o=i.clone(),i.zoom(this._zoom),(i.width>s.width||i.height>s.height)&&(this._zoom=this._getValidZoom(yt.min(s.width/o.width,s.height/o.height)),i=o.clone().zoom(this._zoom)),this._zoomMainLayer(),n=i.clone(),a.align(i,e.align),r=i.topLeft().minus(n.topLeft()),this.pan(r.times(-1),e.animate))},alignShapes:function(t){var e,n,i,o,r,s,a;if(ut(t)&&(t="Left"),e=this.select(),0!==e.length){switch(t.toLowerCase()){case"left":case"top":n=Kt;break;case"right":case"bottom":n=Zt}for(o=0;e.length>o;o++)if(i=e[o],i instanceof w)switch(t.toLowerCase()){case"left":n=yt.min(n,i.options.x);break;case"top":n=yt.min(n,i.options.y);break;case"right":n=yt.max(n,i.options.x);break;case"bottom":n=yt.max(n,i.options.y)}for(r=[],s=[],o=0;e.length>o;o++)if(i=e[o],i instanceof w)switch(s.push(i),r.push(i.bounds()),t.toLowerCase()){case"left":case"right":i.position(new Q(n,i.options.y));break;case"top":case"bottom":i.position(new Q(i.options.x,n))}a=new B.TransformUnit(s,r),this.undoRedoService.add(a,!1)}},zoom:function(t,e){var n,i,o,r;return t&&(n=e?e.point:new B.Point(0,0),t=this._zoom=this._getValidZoom(t),ut(n)||(n=new B.Point(yt.round(n.x),yt.round(n.y)),i=n.times(t),o=this.modelToView(n),r=o.minus(i),this._storePan(new B.Point(yt.round(r.x),yt.round(r.y)))),e&&(e.zoom=t),this._panTransform(),this._updateAdorners()),this._zoom},_getPan:function(t){var e=this.canvas;return e.translate||(t=t.plus(this._pan)),t},pan:function(t,e){var n,i;t instanceof Q&&(n=this,i=n.scroller,t=n._getPan(t),t=t.times(-1),e?i.animatedScrollTo(t.x,t.y,function(){n._updateAdorners()}):(i.scrollTo(t.x,t.y),n._updateAdorners()))},viewport:function(){var t=this.element,e=t.width(),n=t.height();return this.toolBar&&(n-=this.toolBar.element.outerHeight()),new G(0,0,e,n)},copy:function(){var t,e;if(this.options.copy.enabled)for(this._clipboard=[],this._copyOffset=1,t=0;this._selectedItems.length>t;t++)e=this._selectedItems[t],this._clipboard.push(e)},cut:function(){var t,e;if(this.options.copy.enabled){for(this._clipboard=[],this._copyOffset=0,t=0;this._selectedItems.length>t;t++)e=this._selectedItems[t],this._clipboard.push(e);this.remove(this._clipboard,!0)}},paste:function(){var t,e,n,i,o,r,s,a;if(this._clipboard.length>0){for(i={},o=d(this._clipboard),r=o.connections,s=o.shapes,a={x:this._copyOffset*this.options.copy.offsetX,y:this._copyOffset*this.options.copy.offsetY},this.deselect(),n=0;s.length>n;n++)t=s[n],e=t.clone(),i[t.id]=e,e.position(new Q(t.options.x+a.x,t.options.y+a.y)),e.diagram=this,e=this._addShape(e),e&&e.select();for(n=0;r.length>n;n++)t=r[n],e=this._addConnection(t.clone()),e&&(this._updateCopiedConnection(e,t,"source",i,a),this._updateCopiedConnection(e,t,"target",i,a),e.select(!0),e.updateModel());this._syncChanges(),this._copyOffset+=1}},_updateCopiedConnection:function(t,e,n,i,o){var r,s,a,l=e[n](),c=this;l instanceof _&&i[l.shape.id]?(a=i[l.shape.id],c.getShapeById(a.id)?t[n](a.getConnector(l.options.name)):(s=c._inactiveShapeItems.getByUid(a.dataItem.uid),s&&(r=function(e){a=c._dataMap[e.id],t[n](a.getConnector(l.options.name)),t.updateModel()},c._deferredConnectionUpdates.push(s.onActivate(r))))):t[n](new Q(e[n+"Point"]().x+o.x,e[n+"Point"]().y+o.y))},boundingBox:function(t,e){var n,i,o,r=G.empty(),s=dt(t)?this._getDiagramItems(t):{shapes:this.shapes};if(s.shapes.length>0)for(i=s.shapes[0],r=i.bounds(ee),o=1;s.shapes.length>o;o++)i=s.shapes[o],n=i.bounds(ee),e===!0&&(n.x-=i._rotationOffset.x,n.y-=i._rotationOffset.y),r=r.union(n);return r},_containerOffset:function(){var t=this.element.offset();return this.toolBar&&(t.top+=this.toolBar.element.outerHeight()),t},documentToView:function(t){var e=this._containerOffset();return new Q(t.x-e.left,t.y-e.top)},viewToDocument:function(t){var e=this._containerOffset();return new Q(t.x+e.left,t.y+e.top)},viewToModel:function(t){return this._transformWithMatrix(t,this._matrixInvert)},modelToView:function(t){return this._transformWithMatrix(t,this._matrix)},modelToLayer:function(t){return this._transformWithMatrix(t,this._layerMatrix)},layerToModel:function(t){return this._transformWithMatrix(t,this._layerMatrixInvert)},documentToModel:function(t){var e=this.documentToView(t);return this.canvas.translate||(e.x=e.x+this.scroller.scrollLeft,e.y=e.y+this.scroller.scrollTop),this.viewToModel(e)},modelToDocument:function(t){return this.viewToDocument(this.modelToView(t))},_transformWithMatrix:function(t,e){var n,i,o=t;return t instanceof Q?e&&(o=e.apply(t)):(n=this._transformWithMatrix(t.topLeft(),e),i=this._transformWithMatrix(t.bottomRight(),e),o=G.fromPoints(n,i)),o},setDataSource:function(t){this.options.dataSource=t,this._dataSource(),this.options.autoBind&&this.dataSource.fetch()},setConnectionsDataSource:function(t){this.options.connectionsDataSource=t,this._connectionDataSource(),this.options.autoBind&&this.connectionsDataSource.fetch()},layout:function(t){var e,n,i,o,r;switch(this._layouting=!0,ut(t)&&(t=this.options.layout),e=ut(t)||ut(t.type)?"Tree":t.type,e.toLowerCase()){case"tree":n=new B.TreeLayout(this);break;case"layered":n=new B.LayeredLayout(this);break;case"forcedirected":case"force":case"spring":case"springembedder":n=new B.SpringLayout(this);break;default:throw"Layout algorithm '"+e+"' is not supported."}i=new B.LayoutState(this),o=n.layout(t),o&&(r=new B.LayoutUndoUnit(i,o,t?t.animate:null),this.undoRedoService.add(r)),this._layouting=!1,this._redrawConnections()},getShapeById:function(t){var e;return(e=rt.first(this.shapes,function(e){return e.visual.id===t}))?e:e=rt.first(this.connections,function(e){return e.visual.id===t})},_extendLayoutOptions:function(t){t.layout&&(t.layout=R(B.LayoutBase.fn.defaultOptions||{},t.layout))},_selectionChanged:function(t,e){(t.length||e.length)&&this.trigger(Rt,{selected:t,deselected:e})},_getValidZoom:function(t){return yt.min(yt.max(t,this.options.zoomMin),this.options.zoomMax)},_panTransform:function(t){var e=this,n=t||e._pan;e.canvas.translate?(e.scroller.scrollTo(n.x,n.y),e._zoomMainLayer()):(e._storePan(n),e._transformMainLayer())},_finishPan:function(){this.trigger(Ft,{total:this._pan,delta:Number.NaN})},_storePan:function(t){this._pan=t,this._storeViewMatrix()},_zoomMainLayer:function(){var t=this._zoom,e=new j(0,0,t,t);e.render(this.mainLayer),this._storeLayerMatrix(e),this._storeViewMatrix()},_transformMainLayer:function(){var t=this._pan,e=this._zoom,n=new j(t.x,t.y,e,e);n.render(this.mainLayer),this._storeLayerMatrix(n),this._storeViewMatrix()},_storeLayerMatrix:function(t){this._layerMatrix=t.toMatrix(),this._layerMatrixInvert=t.invert().toMatrix()},_storeViewMatrix:function(){var t=this._pan,e=this._zoom,n=new j(t.x,t.y,e,e);this._matrix=n.toMatrix(),this._matrixInvert=n.invert().toMatrix()},_toIndex:function(t,e){var n=this._getDiagramItems(t);this.mainLayer.toIndex(n.visuals,e),this._fixOrdering(n,!1)},_fixOrdering:function(t,e){var n,i,o=e?this.shapes.length-1:0,r=e?this.connections.length-1:0;for(n=0;t.shapes.length>n;n++)i=t.shapes[n],rt.remove(this.shapes,i),rt.insert(this.shapes,i,o);for(n=0;t.cons.length>n;n++)i=t.cons[n],rt.remove(this.connections,i),rt.insert(this.connections,i,r)},_getDiagramItems:function(t){var e,n,i={},o=t;for(i.visuals=[],i.shapes=[],i.cons=[],t?pt(t)||(o=[t]):o=this._selectedItems.slice(),e=0;o.length>e;e++)n=o[e],n instanceof w?(i.shapes.push(n),i.visuals.push(n.visual)):n instanceof x&&(i.cons.push(n),i.visuals.push(n.visual));return i},_removeItem:function(t,e,n){t.select(!1),t instanceof w?(this._removeShapeDataItem(t),this._removeShape(t,e,n)):t instanceof x&&(this._removeConnectionDataItem(t),this._removeConnection(t,e)),this.mainLayer.remove(t.visual)},_removeShape:function(t,e,n){var i,o,r,s,a=[],l=[];for(this.toolService._removeHover(),e&&this.undoRedoService.addCompositeItem(new q(t)),rt.remove(this.shapes,t),this._shapesQuadTree.remove(t),i=0;t.connectors.length>i;i++)for(r=t.connectors[i],s=0;r.connections.length>s;s++)o=r.connections[s],n&&P.inArray(o,n)||(o.sourceConnector==r?a.push(o):o.targetConnector==r&&l.push(o));for(i=0;a.length>i;i++)a[i].source(null,e),a[i].updateModel();for(i=0;l.length>i;i++)l[i].target(null,e),l[i].updateModel()},_removeConnection:function(t,e){t.sourceConnector&&rt.remove(t.sourceConnector.connections,t),t.targetConnector&&rt.remove(t.targetConnector.connections,t),e&&this.undoRedoService.addCompositeItem(new $(t)),rt.remove(this.connections,t)},_removeDataItems:function(t,e){var n,i,o,r;for(t=pt(t)?t:[t];t.length;)if(n=t.shift(),o=this._dataMap[n.uid],o&&(this._removeShapeConnections(o),this._removeItem(o,!1),delete this._dataMap[n.uid],e&&n.hasChildren&&n.loaded()))for(i=n.children.data(),r=0;i.length>r;r++)t.push(i[r])},_removeShapeConnections:function(t){var e,n=t.connections();if(n)for(e=0;n.length>e;e++)this._removeItem(n[e],!1)},_addDataItem:function(t,e){var n,i;if(ft(t))return(n=this._dataMap[t.id])?n:(i=R({},this.options.shapeDefaults),i.dataItem=t,n=new w(i,this),this.addShape(n,e!==!1),this._dataMap[t.id]=n,n)},_addDataItemByUid:function(t){var e,n;if(ft(t))return(e=this._dataMap[t.uid])?e:(n=R({},this.options.shapeDefaults),n.dataItem=t,e=new w(n,this),this.addShape(e),this._dataMap[t.uid]=e,e)},_addDataItems:function(t,e){var n,i,o,r,s;for(i=0;t.length>i;i++)n=t[i],o=this._addDataItemByUid(n),r=this._addDataItemByUid(e),r&&!this.connected(r,o)&&(s=this.connect(r,o))},_refreshSource:function(t){var e,n,i=this,o=t.node,r=t.action,s=t.items,a=i.options;if(!t.field){if("remove"==r)this._removeDataItems(t.items,!0);else for(r&&"itemloaded"!==r||this._bindingRoots||(this._bindingRoots=!0,n=!0),r||o||i.clear(),this._addDataItems(s,o),e=0;s.length>e;e++)s[e].load();a.layout&&(n||"remove"==r||"add"==r)&&i.layout(a.layout),n&&(this.trigger("dataBound"),this._bindingRoots=!1)}},_mouseDown:function(t){var e=this._calculatePosition(t);1==t.which&&this.toolService.start(e,this._meta(t))&&(this._destroyToolBar(),t.preventDefault())},_addItem:function(t){t instanceof w?this.addShape(t):t instanceof x&&this.addConnection(t)},_mouseUp:function(t){var e=this._calculatePosition(t);1==t.which&&this.toolService.end(e,this._meta(t))&&(this._createToolBar(),t.preventDefault())},_createToolBar:function(){var t,e,n,i,o,r,s,a,l,c=this.toolService.diagram;this.singleToolBar||1!==c.select().length||(t=c.select()[0],t&&t.options.editable!==!1&&(e=t.options.editable,n=e.tools,this._isEditable&&0===n.length&&(t instanceof w?n=["edit","rotateClockwise","rotateAnticlockwise"]:t instanceof x&&(n=["edit"]),e&&e.remove!==!1&&n.push("delete")),n&&n.length&&(i=20,this.singleToolBar=new k(c,{tools:n,click:L(this._toolBarClick,this),modal:!0}),r=this.singleToolBar._popup.element.outerWidth(),s=this.singleToolBar._popup.element.outerHeight(),t instanceof w?(a=this.modelToView(t.bounds(ee)),o=Q(a.x,a.y).minus(Q((r-a.width)/2,s+i))):t instanceof x&&(l=this.modelToView(t.bounds()),o=Q(l.x,l.y).minus(Q((r-l.width-20)/2,s+i))),o?(this.canvas.translate||(o=o.minus(Q(this.scroller.scrollLeft,this.scroller.scrollTop))),o=this.viewToDocument(o),o=Q(yt.max(o.x,0),yt.max(o.y,0)),this.singleToolBar.showAt(o)):this._destroyToolBar())))},_toolBarClick:function(t){this.trigger("toolBarClick",t),this._destroyToolBar()},_mouseMove:function(t){if(!this.pauseMouseHandlers){var e=this._calculatePosition(t);0!==t.which&&1!=t.which||!this.toolService.move(e,this._meta(t))||t.preventDefault()}},_keydown:function(t){this.toolService.keyDown(t.keyCode,this._meta(t))&&t.preventDefault()},_wheel:function(t){var e=n(t),i=this._calculatePosition(t),o=R(this._meta(t),{delta:e});this.toolService.wheel(i,o)&&t.preventDefault()},_meta:function(t){return{ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,shiftKey:t.shiftKey}},_calculatePosition:function(t){var n=t.pageX===e?t.originalEvent:t,i=new Q(n.pageX,n.pageY),o=this.documentToModel(i);return o},_normalizePointZoom:function(t){return t.times(1/this.zoom())},_initialize:function(){this.shapes=[],this._selectedItems=[],this.connections=[],this._dataMap={},this._connectionsDataMap={},this._inactiveShapeItems=new h,this._deferredConnectionUpdates=[],this.undoRedoService=new J({undone:this._syncHandler,redone:this._syncHandler}),this.id=B.randomId()},_fetchFreshData:function(){var t=this;t._dataSource(),t._isEditable&&t._connectionDataSource(),t.options.autoBind&&(t._isEditable?(this._loadingShapes=!0,this._loadingConnections=!0,t.dataSource.fetch(),t.connectionsDataSource.fetch()):t.dataSource.fetch())},_dataSource:function(){var t,e;ft(this.options.connectionsDataSource)?(this._isEditable=!0,t=this.options.dataSource||{},e=pt(t)?{data:t}:t,this.dataSource&&this._shapesRefreshHandler?this.dataSource.unbind("change",this._shapesRefreshHandler).unbind("requestStart",this._shapesRequestStartHandler).unbind("error",this._shapesErrorHandler):(this._shapesRefreshHandler=L(this._refreshShapes,this),this._shapesRequestStartHandler=L(this._shapesRequestStart,this),this._shapesErrorHandler=L(this._error,this)),this.dataSource=kendo.data.DataSource.create(e).bind("change",this._shapesRefreshHandler).bind("requestStart",this._shapesRequestStartHandler).bind("error",this._shapesErrorHandler)):(this._treeDataSource(),this._isEditable=!1)},_connectionDataSource:function(){var t,e=this.options.connectionsDataSource;e&&(t=pt(e)?{data:e}:e,this.connectionsDataSource&&this._connectionsRefreshHandler?this.connectionsDataSource.unbind("change",this._connectionsRefreshHandler).unbind("requestStart",this._connectionsRequestStartHandler).unbind("error",this._connectionsErrorHandler):(this._connectionsRefreshHandler=L(this._refreshConnections,this),this._connectionsRequestStartHandler=L(this._connectionsRequestStart,this),this._connectionsErrorHandler=L(this._connectionsError,this)),this.connectionsDataSource=kendo.data.DataSource.create(t).bind("change",this._connectionsRefreshHandler).bind("requestStart",this._connectionsRequestStartHandler).bind("error",this._connectionsErrorHandler))},_shapesRequestStart:function(t){"read"==t.type&&(this._loadingShapes=!0)},_connectionsRequestStart:function(t){"read"==t.type&&(this._loadingConnections=!0)},_error:function(){this._loadingShapes=!1},_connectionsError:function(){this._loadingConnections=!1},_refreshShapes:function(t){"remove"===t.action?this._shouldRefresh()&&this._removeShapes(t.items):"itemchange"===t.action?this._shouldRefresh()&&this._updateShapes(t.items,t.field):"add"===t.action?this._inactiveShapeItems.add(t.items):"sync"===t.action?this._syncShapes(t.items):this.refresh()},_shouldRefresh:function(){return!this._suspended},_suspendModelRefresh:function(){this._suspended=(this._suspended||0)+1},_resumeModelRefresh:function(){this._suspended=yt.max((this._suspended||0)-1,0)},refresh:function(){this._loadingShapes=!1,this._loadingConnections||this._rebindShapesAndConnections()},_rebindShapesAndConnections:function(){this.clear(),this._addShapes(this.dataSource.view()),this.connectionsDataSource&&this._addConnections(this.connectionsDataSource.view(),!1),this.options.layout?this.layout(this.options.layout):this._redrawConnections(),this.trigger("dataBound")},refreshConnections:function(){this._loadingConnections=!1,this._loadingShapes||this._rebindShapesAndConnections()},_redrawConnections:function(){var t,e=this.connections;for(t=0;e.length>t;t++)e[t].refresh()},_removeShapes:function(t){var e,n,i=this._dataMap;for(n=0;t.length>n;n++)e=t[n],i[e.id]&&(this.remove(i[e.id],!1),i[e.id]=null)},_syncShapes:function(){var t=this,e=t._inactiveShapeItems;e.forEach(function(n){var i=n.dataItem,o=n.element;i.isNew()||(o?(o._setOptionsFromModel(),t.addShape(o,n.undoable),t._dataMap[i.id]=o):t._addDataItem(i),n.activate(),e.remove(i))})},_updateShapes:function(t,e){var n,i,o;for(n=0;t.length>n;n++)i=t[n],o=this._dataMap[i.id],o&&o.updateOptionsFromModel(i,e)},_addShapes:function(t){for(var e=0;t.length>e;e++)this._addDataItem(t[e],!1)},_refreshConnections:function(t){"remove"===t.action?this._shouldRefresh()&&this._removeConnections(t.items):"add"===t.action?this._addConnections(t.items):"sync"===t.action||("itemchange"===t.action?this._shouldRefresh()&&this._updateConnections(t.items):this.refreshConnections());
},_removeConnections:function(t){for(var e=0;t.length>e;e++)this.remove(this._connectionsDataMap[t[e].uid],!1),this._connectionsDataMap[t[e].uid]=null},_updateConnections:function(t){var e,n,i;for(e=0;t.length>e;e++)n=t[e],i=this._connectionsDataMap[n.uid],i.updateOptionsFromModel(n)},_addConnections:function(t,e){var n,i,o=t.length;for(n=0;o>n;n++)i=t[n],this._addConnectionDataItem(i,e)},_addConnectionDataItem:function(t,e){var n,i,o,r;this._connectionsDataMap[t.uid]||(n=this._validateConnector(t.from),ft(n)&&null!==n||(n=new Q(t.fromX,t.fromY)),i=this._validateConnector(t.to),ft(i)&&null!==i||(i=new Q(t.toX,t.toY)),ft(n)&&ft(i)&&(o=R({},this.options.connectionDefaults),o.dataItem=t,r=new x(n,i,o),this._connectionsDataMap[t.uid]=r,this.addConnection(r,e)))},_validateConnector:function(t){var e;return ft(t)&&null!==t&&(e=this._dataMap[t]),e},_treeDataSource:function(){var t=this,e=t.options,n=e.dataSource;n=pt(n)?{data:n}:n,n.fields||(n.fields=[{field:"text"},{field:"url"},{field:"spriteCssClass"},{field:"imageUrl"}]),t.dataSource&&t._refreshHandler&&t._unbindDataSource(),t._refreshHandler=L(t._refreshSource,t),t._errorHandler=L(t._error,t),t.dataSource=F.create(n).bind(bt,t._refreshHandler).bind(Pt,t._errorHandler)},_unbindDataSource:function(){var t=this;t.dataSource.unbind(bt,t._refreshHandler).unbind(Pt,t._errorHandler)},_adorn:function(t,n){n!==e&&t&&(n?(this._adorners.push(t),this.adornerLayer.append(t.visual)):(rt.remove(this._adorners,t),this.adornerLayer.remove(t.visual)))},_showConnectors:function(t,e){e?this._connectorsAdorner.show(t):this._connectorsAdorner.destroy()},_updateAdorners:function(){var t,e,n=this._adorners;for(t=0;n.length>t;t++)e=n[t],e.refreshBounds&&e.refreshBounds(),e.refresh()},_refresh:function(){for(var t=0;this.connections.length>t;t++)this.connections[t].refresh()},_destroyToolBar:function(){this.singleToolBar&&(this.singleToolBar.hide(),this.singleToolBar.destroy(),this.singleToolBar=null)},_destroyGlobalToolBar:function(){this.toolBar&&(this.toolBar.hide(),this.toolBar.destroy(),this.toolBar=null)},exportDOMVisual:function(){var t=this.canvas._viewBox,e=E.transform().translate(-t.x,-t.y),n=new E.Rect([0,0],[t.width,t.height]),i=M.Path.fromRect(n),o=new M.Group({transform:e}),r=new M.Group({clip:i}),s=this.canvas.drawingElement.children[0];return r.append(o),o.children.push(s),r},exportVisual:function(){var t=E.transform().scale(1/this._zoom),e=new M.Group({transform:t}),n=this.mainLayer.drawingElement;return e.children.push(n),e},_syncChanges:function(){this._syncShapeChanges(),this._syncConnectionChanges()},_syncShapeChanges:function(){this.dataSource&&this._isEditable&&this.dataSource.sync()},_syncConnectionChanges:function(){var e=this;e.connectionsDataSource&&e._isEditable&&(t.when.apply(t,e._deferredConnectionUpdates).then(function(){e.connectionsDataSource.sync()}),e.deferredConnectionUpdates=[])}}),P.ExportMixin.extend(b.fn,!0),kendo.PDFMixin&&kendo.PDFMixin.extend(b.fn),k=kendo.Observable.extend({init:function(t,e){kendo.Observable.fn.init.call(this),this.diagram=t,this.options=R({},this.options,e),this._tools=[],this.createToolBar(),this.createTools(),this.appendTools(),this.options.modal&&this.createPopup(),this.bind(this.events,e)},events:["click"],createPopup:function(){this.container=t("
").append(this.element),this._popup=this.container.kendoPopup({}).getKendoPopup()},appendTools:function(){var t,e;for(t=0;this._tools.length>t;t++)e=this._tools[t],(e.buttons&&e.buttons.length||!ft(e.buttons))&&this._toolBar.add(e)},createToolBar:function(){this.element=t("
"),this._toolBar=this.element.kendoToolBar({click:L(this.click,this),resizable:!1}).getKendoToolBar(),this.element.css("border","none")},createTools:function(){for(var t=0;this.options.tools.length>t;t++)this.createTool(this.options.tools[t])},createTool:function(t){var e=(vt(t)?t.name:t)+"Tool";this[e]?this[e](t):this._tools.push(t)},showAt:function(t){this._popup&&this._popup.open(t.x,t.y)},hide:function(){this._popup&&this._popup.close()},newGroup:function(){return{type:"buttonGroup",buttons:[]}},editTool:function(){this._tools.push({spriteCssClass:"k-icon k-i-pencil",showText:"overflow",type:"button",text:"Edit",attributes:this._setAttributes({action:"edit"})})},deleteTool:function(){this._tools.push({spriteCssClass:"k-icon k-i-close",showText:"overflow",type:"button",text:"Delete",attributes:this._setAttributes({action:"delete"})})},rotateAnticlockwiseTool:function(t){this._appendGroup("rotate"),this._rotateGroup.buttons.push({spriteCssClass:"k-icon k-i-rotateccw",showText:"overflow",text:"RotateAnticlockwise",group:"rotate",attributes:this._setAttributes({action:"rotateAnticlockwise",step:t.step})})},rotateClockwiseTool:function(t){this._appendGroup("rotate"),this._rotateGroup.buttons.push({spriteCssClass:"k-icon k-i-rotatecw",attributes:this._setAttributes({action:"rotateClockwise",step:t.step}),showText:"overflow",text:"RotateClockwise",group:"rotate"})},createShapeTool:function(){this._appendGroup("create"),this._createGroup.buttons.push({spriteCssClass:"k-icon k-i-shape",showText:"overflow",text:"CreateShape",group:"create",attributes:this._setAttributes({action:"createShape"})})},createConnectionTool:function(){this._appendGroup("create"),this._createGroup.buttons.push({spriteCssClass:"k-icon k-i-connector",showText:"overflow",text:"CreateConnection",group:"create",attributes:this._setAttributes({action:"createConnection"})})},undoTool:function(){this._appendGroup("history"),this._historyGroup.buttons.push({spriteCssClass:"k-icon k-i-undo",showText:"overflow",text:"Undo",group:"history",attributes:this._setAttributes({action:"undo"})})},redoTool:function(){this._appendGroup("history"),this._historyGroup.buttons.push({spriteCssClass:"k-icon k-i-redo",showText:"overflow",text:"Redo",group:"history",attributes:this._setAttributes({action:"redo"})})},_appendGroup:function(t){var e="_"+t+"Group";this[e]||(this[e]=this.newGroup(),this._tools.push(this[e]))},_setAttributes:function(t){var e={};return t.action&&(e[kendo.attr("action")]=t.action),t.step&&(e[kendo.attr("step")]=t.step),e},_getAttributes:function(t){var e,n={},i=t.attr(kendo.attr("action"));return i&&(n.action=i),e=t.attr(kendo.attr("step")),e&&(n.step=e),n},click:function(e){var n=this._getAttributes(t(e.target)),i=n.action;i&&this[i](n),this.trigger("click",this.eventData(i))},eventData:function(t){var e=this.selectedElements(),n=[],i=[];return e instanceof w?n.push(e):i.push(e),{shapes:n,connections:i,action:t}},"delete":function(){var t=this.diagram,e=t._triggerRemove(this.selectedElements());e.length&&(this.diagram.remove(e,!0),this.diagram._syncChanges())},edit:function(){this.diagram.edit(this.selectedElements()[0])},rotateClockwise:function(t){var e=parseFloat(t.step||90);this._rotate(e)},rotateAnticlockwise:function(t){var e=parseFloat(t.step||90);this._rotate(-e)},_rotate:function(t){var e=this.diagram._resizingAdorner;e.angle(e.angle()+t),e.rotate()},selectedElements:function(){return this.diagram.select()},createShape:function(){this.diagram.createShape()},createConnection:function(){this.diagram.createConnection()},undo:function(){this.diagram.undo()},redo:function(){this.diagram.redo()},destroy:function(){this.diagram=null,this.element=null,this.options=null,this._toolBar&&this._toolBar.destroy(),this._popup&&this._popup.destroy()}}),C=kendo.Observable.extend({init:function(t,e){kendo.Observable.fn.init.call(this),this.options=O(!0,{},this.options,e),this.element=t,this.model=this.options.model,this.fields=this._getFields(),this._initContainer(),this.createEditable()},options:{editors:{}},_initContainer:function(){this.wrapper=this.element},createEditable:function(){var t=this.options;this.editable=new kendo.ui.Editable(this.wrapper,{fields:this.fields,target:t.target,clearContainer:!1,model:this.model})},_isEditable:function(t){return this.model.editable&&this.model.editable(t)},_getFields:function(){var t,e,n,i=[],o=this.model.fields;for(t in o)e={},this._isEditable(t)&&(n=this.options.editors[t],n&&(e.editor=n),e.field=t,i.push(e));return i},end:function(){return this.editable.end()},destroy:function(){this.editable.destroy(),this.editable.element.find("["+kendo.attr("container-for")+"]").empty(),this.model=this.wrapper=this.element=this.columns=this.editable=null}}),S=C.extend({init:function(t,e){C.fn.init.call(this,t,e),this.bind(this.events,this.options),this.open()},events:["update","cancel"],options:{window:{modal:!0,resizable:!1,draggable:!0,title:"Edit",visible:!1}},_initContainer:function(){var e,n=this;this.wrapper=t('').attr(kendo.attr("uid"),this.model.uid),e="",this.options.template?(e+=this._renderTemplate(),this.fields=[]):e+=this._renderFields(),e+=this._renderButtons(),this.wrapper.append(t('
').append(e)),this.window=new kendo.ui.Window(this.wrapper.appendTo(this.element),this.options.window),this.window.bind("close",function(t){t.userTriggered&&(t.sender.element.focus(),n._cancelClick(t))}),this._attachButtonEvents()},_renderTemplate:function(){var t=this.options.template;return"string"==typeof t&&(t=window.unescape(t)),t=kendo.template(t)(this.model)},_renderFields:function(){var t,e,n="";for(t=0;this.fields.length>t;t++)e=this.fields[t],n+=''+(e.field||"")+"
",this._isEditable(e.field)&&(n+="
');return n},_renderButtons:function(){var t='';return t+=this._createButton("update"),t+=this._createButton("cancel"),t+="
"},_createButton:function(t){return kendo.template(he)(v[t])},_attachButtonEvents:function(){this._cancelClickHandler=L(this._cancelClick,this),this.window.element.on(kt+_t,"a.k-diagram-cancel",this._cancelClickHandler),this._updateClickHandler=L(this._updateClick,this),this.window.element.on(kt+_t,"a.k-diagram-update",this._updateClickHandler)},_updateClick:function(t){t.preventDefault(),this.trigger("update")},_cancelClick:function(t){t.preventDefault(),this.trigger("cancel")},open:function(){this.window.center().open()},close:function(){this.window.bind("deactivate",L(this.destroy,this)).close()},destroy:function(){this.window.close().destroy(),this.window.element.off(kt+_t,"a.k-diagram-cancel",this._cancelClickHandler),this.window.element.off(kt+_t,"a.k-diagram-update",this._updateClickHandler),this._cancelClickHandler=null,this._editUpdateClickHandler=null,this.window=null,C.fn.destroy.call(this)}}),c.fn=c.prototype={onActivate:function(e){var n=t.Deferred();return this.callbacks.push({callback:e,deferred:n}),n},activate:function(){var t,e,n=this.callbacks;for(e=0;n.length>e;e++)t=this.callbacks[e],t.callback(this.dataItem),t.deferred.resolve();this.callbacks=[]}},h.fn=h.prototype={add:function(t){for(var e=0;t.length>e;e++)this.items[t[e].uid]=new c(t[e])},forEach:function(t){for(var e in this.items)t(this.items[e])},getByUid:function(t){return this.items[t]},remove:function(t){delete this.items[t.uid]}},T=z.extend({init:function(){this.shapes=[]},_add:function(t,e){this.shapes.push({bounds:e,shape:t}),t._quadNode=this},insert:function(t,e){this._add(t,e)},remove:function(t){var e,n=this.shapes,i=n.length;for(e=0;i>e;e++)if(n[e].shape===t){n.splice(e,1);break}},hitTestRect:function(t){var e,n=this.shapes,i=n.length;for(e=0;i>e;e++)if(this._testRect(n[e].shape,t))return!0},_testRect:function(t,e){var n,i=t.rotate().angle,o=t.bounds();return n=i?K.rects(e,o,-i):o.overlaps(e)}}),A=T.extend({init:function(t){T.fn.init.call(this),this.children=[],this.rect=t},inBounds:function(t){var e=this.rect,n=e.bottomRight(),i=t.bottomRight(),o=t.x>=e.x&&t.y>=e.y&&n.x>=i.x&&n.y>=i.y;return o},overlapsBounds:function(t){return this.rect.overlaps(t)},insert:function(t,e){var n,i=!1,o=this.children,r=o.length;if(this.inBounds(e)){if(!r&&4>this.shapes.length)this._add(t,e);else{for(r||this._initChildren(),n=0;o.length>n;n++)if(o[n].insert(t,e)){i=!0;break}i||this._add(t,e)}i=!0}return i},_initChildren:function(){var t,e,n=this.rect,i=this.children,o=this.shapes,r=n.center(),s=n.width/2,a=n.height/2;for(i.push(new A(new G(n.x,n.y,s,a)),new A(new G(r.x,n.y,s,a)),new A(new G(n.x,r.y,s,a)),new A(new G(r.x,r.y,s,a))),e=o.length-1;e>=0;e--)for(t=0;i.length>t;t++)if(i[t].insert(o[e].shape,o[e].bounds)){o.splice(e,1);break}},hitTestRect:function(t){var e,n=this.children,i=n.length,o=!1;if(this.overlapsBounds(t))if(T.fn.hitTestRect.call(this,t))o=!0;else for(e=0;i>e;e++)if(n[e].hitTestRect(t)){o=!0;break}return o}}),D=z.extend({ROOT_SIZE:1e3,init:function(t){var e=L(this._boundsChange,this);t.bind(xt,e),t.bind(Ot,e),this.initRoots()},initRoots:function(){this.rootMap={},this.root=new T},clear:function(){this.initRoots()},_boundsChange:function(t){t.item._quadNode&&t.item._quadNode.remove(t.item),this.insert(t.item)},insert:function(t){var e=t.bounds(ee),n=this.ROOT_SIZE,i=this.getSectors(e),o=i[0][0],r=i[1][0];this.inRoot(i)?this.root.insert(t,e):(this.rootMap[o]||(this.rootMap[o]={}),this.rootMap[o][r]||(this.rootMap[o][r]=new A(new G(o*n,r*n,n,n))),this.rootMap[o][r].insert(t,e))},remove:function(t){t._quadNode&&t._quadNode.remove(t)},inRoot:function(t){return t[0].length>1||t[1].length>1},getSectors:function(t){var e,n,i=this.ROOT_SIZE,o=t.bottomRight(),r=yt.floor(o.x/i),s=yt.floor(o.y/i),a=[[],[]];for(e=yt.floor(t.x/i);r>=e;e++)a[0].push(e);for(n=yt.floor(t.y/i);s>=n;n++)a[1].push(n);return a},hitTestRect:function(t){var e,n,i,o,r,s=this.getSectors(t);if(this.root.hitTestRect(t))return!0;for(e=0;s[0].length>e;e++)for(i=s[0][e],n=0;s[1].length>n;n++)if(o=s[1][n],r=(this.rootMap[i]||{})[o],r&&r.hitTestRect(t))return!0;return!1}}),P.ui.plugin(b),R(B,{Shape:w,Connection:x,Connector:_,DiagramToolBar:k,QuadNode:A,QuadRoot:T,ShapesQuadTree:D,PopupEditor:S})}(window.kendo.jQuery)},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.dataviz.diagram.min",["kendo.data.min","kendo.draganddrop.min","kendo.userevents.min","kendo.mobile.scroller.min","kendo.drawing.min","dataviz/diagram/utils.min","dataviz/diagram/math.min","dataviz/diagram/svg.min","dataviz/diagram/services.min","dataviz/diagram/layout.min","dataviz/diagram/dom.min"],t)}(function(){},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.dataviz.treemap.min",["kendo.data.min","kendo.userevents.min","kendo.dataviz.themes.min"],t)}(function(){return function(t,e){function n(t,e){if(null===e)return e;var n=b(t,!0);return n(e)}function i(t){return typeof t!==E}function o(t,e,n){var i,o,l=a(t),c=a(e),h=u(t)-u(e)<0,d=[];for(d.push(t),i=0;n>i;i++)o={r:r(l.r,c.r,i,n,h),g:r(l.g,c.g,i,n,h),b:r(l.b,c.b,i,n,h)},d.push(s(o));return d.push(e),d}function r(t,e,n,i,o){var r,s=f.min(f.abs(t),f.abs(e)),a=f.max(f.abs(t),f.abs(e)),l=(a-s)/(i+1),c=l*(n+1);return r=o?s+c:a-c}function s(t){return"#"+l(t.r)+l(t.g)+l(t.b)}function a(t){t=t.replace("#","");var e=c(t);return{r:h(e.r),g:h(e.g),b:h(e.b)}}function l(t){var e=f.round(t).toString(16).toUpperCase();return 1===e.length&&(e="0"+e),e}function c(t){var e=t.length,n={};return 3===e?(n.r=t[0],n.g=t[1],n.b=t[2]):(n.r=t.substring(0,2),n.g=t.substring(2,4),n.b=t.substring(4,6)),n}function h(t){return parseInt(t.toString(16),16)}function u(t){var e=0;return t&&(t=a(t),e=f.sqrt(.241*t.r*t.r+.691*t.g*t.g+.068*t.b*t.b)),e}function d(t){var e=f.pow(10,4);return f.round(t*e)/e}var f=Math,p=t.proxy,g=t.isArray,m=window.kendo,v=m.Class,y=m.ui.Widget,_=m.template,w=m.deepExtend,x=m.data.HierarchicalDataSource,b=m.getter,k=m.dataviz,C=".kendoTreeMap",S="change",T="dataBound",A="itemCreated",D=Number.MAX_VALUE,P="mouseover"+C,M="mouseleave"+C,E="undefined",B=y.extend({init:function(e,n){m.destroy(e),t(e).empty(),y.fn.init.call(this,e,n),this.wrapper=this.element,this._initTheme(this.options),this.element.addClass("k-widget k-treemap"),this._setLayout(),this._originalOptions=w({},this.options),this._initDataSource(),this._attachEvents(),m.notify(this,k.ui)},options:{name:"TreeMap",theme:"default",autoBind:!0,textField:"text",valueField:"value",colorField:"color"},events:[T,A],_initTheme:function(t){var e=this,n=k.ui.themes||{},i=((t||{}).theme||"").toLowerCase(),o=(n[i]||{}).treeMap;e.options=w({},o,t)},_attachEvents:function(){this.element.on(P,p(this._mouseover,this)).on(M,p(this._mouseleave,this)),this._resizeHandler=p(this.resize,this,!1),m.onResize(this._resizeHandler)},_setLayout:function(){"horizontal"===this.options.type?(this._layout=new L(!1),this._view=new R(this,this.options)):"vertical"===this.options.type?(this._layout=new L(!0),this._view=new R(this,this.options)):(this._layout=new I,this._view=new z(this,this.options))},_initDataSource:function(){var t=this,e=t.options,n=e.dataSource;t._dataChangeHandler=p(t._onDataChange,t),t.dataSource=x.create(n).bind(S,t._dataChangeHandler),n&&t.options.autoBind&&t.dataSource.fetch()},setDataSource:function(t){var e=this;e.dataSource.unbind(S,e._dataChangeHandler),e.dataSource=t.bind(S,e._dataChangeHandler),t&&e.options.autoBind&&e.dataSource.fetch()},_onDataChange:function(t){var e,n,i,o,r=t.node,s=t.items,a=this.options;if(r){if(s.length){for(i=this._getByUid(r.uid),i.children=[],s=new m.data.Query(s)._sortForGrouping(a.valueField,"desc"),n=0;s.length>n;n++)e=s[n],i.children.push(this._wrapItem(e));o=this._view.htmlSize(i),this._layout.compute(i.children,i.coord,o),this._setColors(i.children),this._view.render(i)}}else this._cleanItems(),this.element.empty(),e=this._wrapItem(s[0]),this._layout.createRoot(e,this.element.outerWidth(),this.element.outerHeight(),"vertical"===this.options.type),this._view.createRoot(e),this._root=e,this._colorIdx=0;for(n=0;s.length>n;n++)s[n].load();r&&this.trigger(T,{node:r})},_cleanItems:function(){var t=this;t.angular("cleanup",function(){return{elements:t.element.find(".k-leaf div,.k-treemap-title,.k-treemap-title-vertical")}})},_setColors:function(t){var e,n,r,s,a=this.options.colors,l=this._colorIdx,c=a[l%a.length];for(g(c)&&(e=o(c[0],c[1],t.length)),r=!1,s=0;t.length>s;s++)n=t[s],i(n.color)||(n.color=e?e[s]:c),n.dataItem.hasChildren||(r=!0);r&&this._colorIdx++},_contentSize:function(t){this.view.renderHeight(t)},_wrapItem:function(t){var e={};return i(this.options.valueField)&&(e.value=n(this.options.valueField,t)),i(this.options.colorField)&&(e.color=n(this.options.colorField,t)),i(this.options.textField)&&(e.text=n(this.options.textField,t)),e.level=t.level(),e.dataItem=t,e},_getByUid:function(t){for(var e,n=[this._root];n.length;){if(e=n.pop(),e.dataItem.uid===t)return e;e.children&&(n=n.concat(e.children))}},dataItem:function(e){var n=t(e).attr(m.attr("uid")),i=this.dataSource;return i&&i.getByUid(n)},findByUid:function(t){return this.element.find(".k-treemap-tile["+m.attr("uid")+"='"+t+"']")},_mouseover:function(e){var n=t(e.target);n.hasClass("k-leaf")&&(this._removeActiveState(),n.removeClass("k-state-hover").addClass("k-state-hover"))},_removeActiveState:function(){this.element.find(".k-state-hover").removeClass("k-state-hover")},_mouseleave:function(){this._removeActiveState()},destroy:function(){y.fn.destroy.call(this),this.element.off(C),this.dataSource&&this.dataSource.unbind(S,this._dataChangeHandler),this._root=null,m.unbindResize(this._resizeHandler),m.destroy(this.element)},items:function(){return t()},getSize:function(){return m.dimensions(this.element)},_resize:function(){var t,e,n=this._root;n&&(t=this.element,e=t.children(),n.coord.width=t.outerWidth(),n.coord.height=t.outerHeight(),e.css({width:n.coord.width,height:n.coord.height}),this._resizeItems(n,e))},_resizeItems:function(t,e){var n,i,o,r;if(t.children&&t.children.length)for(n=e.children(".k-treemap-wrap").children(),this._layout.compute(t.children,t.coord,{text:this._view.titleSize(t,e)}),r=0;t.children.length>r;r++)i=t.children[r],o=n.filter("["+m.attr("uid")+"='"+i.dataItem.uid+"']"),this._view.setItemSize(i,o),this._resizeItems(i,o)},setOptions:function(t){var n=t.dataSource;t.dataSource=e,this._originalOptions=w(this._originalOptions,t),this.options=w({},this._originalOptions),this._setLayout(),this._initTheme(this.options),y.fn._setEvents.call(this,t),n&&this.setDataSource(x.create(n)),this.options.autoBind&&this.dataSource.fetch()}}),I=v.extend({createRoot:function(t,e,n){t.coord={width:e,height:n,top:0,left:0}},leaf:function(t){return!t.children},layoutChildren:function(t,e){var n,i,o,r,s=e.width*e.height,a=0,l=[];for(n=0;t.length>n;n++)l[n]=parseFloat(t[n].value),a+=l[n];for(n=0;l.length>n;n++)t[n].area=s*l[n]/a;i=this.layoutHorizontal()?e.height:e.width,o=[t[0]],r=t.slice(1),this.squarify(r,o,i,e)},squarify:function(t,e,n,i){this.computeDim(t,e,n,i)},computeDim:function(t,n,i,o){var r,s,a;return t.length+n.length==1?(r=1==t.length?t:n,this.layoutLast(r,i,o),e):(t.length>=2&&0===n.length&&(n=[t[0]],t=t.slice(1)),0===t.length?(n.length>0&&this.layoutRow(n,i,o),e):(s=t[0],this.worstAspectRatio(n,i)>=this.worstAspectRatio([s].concat(n),i)?this.computeDim(t.slice(1),n.concat([s]),i,o):(a=this.layoutRow(n,i,o),this.computeDim(t,[],a.dim,a)),e))},layoutLast:function(t,e,n){t[0].coord=n},layoutRow:function(t,e,n){return this.layoutHorizontal()?this.layoutV(t,e,n):this.layoutH(t,e,n)},orientation:"h",layoutVertical:function(){return"v"===this.orientation},layoutHorizontal:function(){return"h"===this.orientation},layoutChange:function(){this.orientation=this.layoutVertical()?"h":"v"},worstAspectRatio:function(t,e){var n,i,o,r,s;if(!t||0===t.length)return D;for(n=0,i=0,o=D,r=0;t.length>r;r++)s=t[r].area,n+=s,o=s>o?o:s,i=i>s?i:s;return f.max(e*e*i/(n*n),n*n/(e*e*o))},compute:function(t,e,n){if(e.width>=e.height&&this.layoutHorizontal()||this.layoutChange(),t&&t.length>0){var i={width:e.width,height:e.height-n.text,top:0,left:0};this.layoutChildren(t,i)}},layoutV:function(t,e,n){var i,o,r,s=this._totalArea(t),a=0;for(e=d(s/e),i=0;t.length>i;i++)o=d(t[i].area/e),t[i].coord={height:o,width:e,top:n.top+a,left:n.left},a+=o;return r={height:n.height,width:n.width-e,top:n.top,left:n.left+e},r.dim=f.min(r.width,r.height),r.dim!=r.height&&this.layoutChange(),r},layoutH:function(t,e,n){var i,o,r=this._totalArea(t),s=d(r/e),a=n.top,l=0;for(i=0;t.length>i;i++)t[i].coord={height:s,width:d(t[i].area/s),top:a,left:n.left+l},l+=t[i].coord.width;return o={height:n.height-s,width:n.width,top:n.top+s,left:n.left},o.dim=f.min(o.width,o.height),o.dim!=o.width&&this.layoutChange(),o},_totalArea:function(t){var e,n=0;for(e=0;t.length>e;e++)n+=t[e].area;return n}}),z=v.extend({init:function(e,n){this.options=w({},this.options,n),this.treeMap=e,this.element=t(e.element),this.offset=0},titleSize:function(t,e){var n=e.children(".k-treemap-title");return n.height()},htmlSize:function(t){var e,n,i=this._getByUid(t.dataItem.uid),o={text:0};return t.children&&(this._clean(i),e=this._getText(t),e&&(n=this._createTitle(t),i.append(n),this._compile(n,t.dataItem),o.text=n.height()),i.append(this._createWrap()),this.offset=(i.outerWidth()-i.innerWidth())/2),o},_compile:function(t,e){this.treeMap.angular("compile",function(){return{elements:t,data:[{dataItem:e}]}})},_getByUid:function(t){return this.element.find(".k-treemap-tile["+m.attr("uid")+"='"+t+"']")},render:function(t){var e,n,i,o,r=this._getByUid(t.dataItem.uid),s=t.children;if(s)for(e=r.find(".k-treemap-wrap"),n=0;s.length>n;n++)i=s[n],o=this._createLeaf(i),e.append(o),this._compile(o.children(),i.dataItem),this.treeMap.trigger(A,{element:o})},createRoot:function(t){var e=this._createLeaf(t);this.element.append(e),this._compile(e.children(),t.dataItem),this.treeMap.trigger(A,{element:e})},_clean:function(t){this.treeMap.angular("cleanup",function(){return{elements:t.children(":not(.k-treemap-wrap)")}}),t.css("background-color",""),t.removeClass("k-leaf"),t.removeClass("k-inverse"),t.empty()},_createLeaf:function(e){return this._createTile(e).css("background-color",e.color).addClass("k-leaf").toggleClass("k-inverse",this._tileColorBrightness(e)>180).append(t("
").html(this._getText(e)))},_createTile:function(e){var n=t("
");return this.setItemSize(e,n),i(e.dataItem)&&i(e.dataItem.uid)&&n.attr(m.attr("uid"),e.dataItem.uid),n},_itemCoordinates:function(t){var e={width:t.coord.width,height:t.coord.height,left:t.coord.left,top:t.coord.top};return e.width+=e.left&&this.offset?2*this.offset:this.offset,e.height+=e.top?2*this.offset:this.offset,e},setItemSize:function(t,e){var n=this._itemCoordinates(t);e.css({width:n.width,height:n.height,left:n.left,top:n.top})},_getText:function(t){var e=t.text;return this.options.template&&(e=this._renderTemplate(t)),e},_renderTemplate:function(t){var e=_(this.options.template);return e({dataItem:t.dataItem,text:t.text})},_createTitle:function(e){return t("
").append(t("
").html(this._getText(e)))},_createWrap:function(){return t("
")},_tileColorBrightness:function(t){return u(t.color)}}),L=v.extend({createRoot:function(t,e,n,i){t.coord={width:e,height:n,top:0,left:0},t.vertical=i},init:function(t){this.vertical=t,this.quotient=t?1:0},compute:function(t,e,n){var i,o,r;t.length>0&&(i=e.width,o=e.height,this.vertical?o-=n.text:i-=n.text,r={width:i,height:o,top:0,left:0},this.layoutChildren(t,r))},layoutChildren:function(t,e){var n,i,o=e.width*e.height,r=0,s=[];for(n=0;t.length>n;n++)i=t[n],s[n]=parseFloat(t[n].value),r+=s[n],i.vertical=this.vertical;for(n=0;s.length>n;n++)t[n].area=o*s[n]/r;this.sliceAndDice(t,e)},sliceAndDice:function(t,e){var n=this._totalArea(t);t[0].level%2===this.quotient?this.layoutHorizontal(t,e,n):this.layoutVertical(t,e,n)},layoutHorizontal:function(t,e,n){var i,o,r,s=0;for(i=0;t.length>i;i++)o=t[i],r=o.area/(n/e.width),o.coord={height:e.height,width:r,top:e.top,left:e.left+s},s+=r},layoutVertical:function(t,e,n){var i,o,r,s=0;for(i=0;t.length>i;i++)o=t[i],r=o.area/(n/e.height),o.coord={height:r,width:e.width,top:e.top+s,left:e.left},s+=r},_totalArea:function(t){var e,n=0;for(e=0;t.length>e;e++)n+=t[e].area;return n}}),R=z.extend({htmlSize:function(t){var e,n,i=this._getByUid(t.dataItem.uid),o={text:0,offset:0};return t.children&&(this._clean(i),e=this._getText(t),e&&(n=this._createTitle(t),i.append(n),this._compile(n,t.dataItem),o.text=t.vertical?n.height():n.width()),i.append(this._createWrap()),this.offset=(i.outerWidth()-i.innerWidth())/2),o},titleSize:function(t,e){var n;return n=t.vertical?e.children(".k-treemap-title").height():e.children(".k-treemap-title-vertical").width()},_createTitle:function(e){var n;return n=t(e.vertical?"
":"
"),n.append(t("
").html(this._getText(e)))}});k.ui.plugin(B)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.angular.min",["kendo.core.min"],t)}(function(){return function(t,e,n){"use strict";function i(t){var e=C;try{return C=function(t){return t()},t()}finally{C=e}}function o(e,i,o,c,h,m){function v(){var n,m,v,y,_,k,C;return o.kRebind&&(n=t(t(i)[0].cloneNode(!0))),S=r(e,i,o,c,b).options,i.is("select")&&!function(e){if(e.length>0){var n=t(e[0]);!/\S/.test(n.text())&&/^\?/.test(n.val())&&n.remove()}}(i[0].options),m=b.call(i,A=S).data(c),l(m,e,o,c,h),e.$emit("kendoWidgetCreated",m),v=f(e,m),o.kRebind&&g(m,e,i,n,o.kRebind,v,o),o.kNgDisabled&&(y=o.kNgDisabled,_=e.$eval(y),_&&m.enable(!_),s(m,e,i,y)),o.kNgReadonly&&(k=o.kNgReadonly,C=e.$eval(k),C&&m.readonly(C),a(m,e,i,k)),o.kNgModel&&d(m,e,o.kNgModel),w&&u(m,e,i,w,x),m&&p(m,i),m}var y,_,w,x,b,k,S,T,D,P,M,E,B,I;if(!(i instanceof jQuery))throw Error("The Kendo UI directives require jQuery to be available before AngularJS. Please include jquery before angular in the document.");if(y=o.kNgDelay,_=e.$eval(y),m=m||[],w=m[0],x=m[1],b=t(i)[c],!b)return window.console.error("Could not find: "+c),null;if(k=r(e,i,o,c,b),S=k.options,k.unresolved.length){for(T=[],D=0,P=k.unresolved.length;P>D;D++)M=k.unresolved[D],E=t.Deferred(function(t){var i=e.$watch(M.path,function(e){e!==n&&(i(),t.resolve())})}).promise(),T.push(E);return t.when.apply(null,T).then(v),n}return y&&!_?(B=e.$root||e,I=function(){var t=e.$watch(y,function(e){e!==n&&(t(),i.removeAttr(o.$attr.kNgDelay),y=null,C(v))})},/^\$(digest|apply)$/.test(B.$$phase)?I():e.$apply(I),n):v()}function r(i,o,r,s,a){function l(t,o){var r=e.copy(i.$eval(o));r===n?p.push({option:t,path:o}):c[t]=r}var c,h,u,d,f=s.replace(/^kendo/,""),p=[],g=r.kOptions||r.options,m=i.$eval(g);return g&&m===n&&p.push({option:"options",path:g}),c=e.extend({},r.defaultOptions,m),h=a.widget.prototype.options,u=a.widget.prototype.events,t.each(r,function(t,e){var n,i,o,r;"source"!==t&&"kDataSource"!==t&&"kScopeField"!==t&&"scopeField"!==t&&(n="data"+t.charAt(0).toUpperCase()+t.slice(1),0===t.indexOf("on")&&(i=t.replace(/^on./,function(t){return t.charAt(2).toLowerCase()}),u.indexOf(i)>-1&&(c[i]=e)),h.hasOwnProperty(n)?l(n,e):h.hasOwnProperty(t)&&!M[t]?l(t,e):P[t]||(o=t.match(/^k(On)?([A-Z].*)/),o&&(r=o[2].charAt(0).toLowerCase()+o[2].slice(1),o[1]&&"kOnLabel"!=t?c[r]=e:("kOnLabel"==t&&(r="onLabel"),l(r,e)))))}),d=r.kDataSource||r.source,d&&(c.dataSource=D(i,o,f,d)),c.$angular=[i],{options:c,unresolved:p}}function s(t,e,i,o){return kendo.ui.PanelBar&&t instanceof kendo.ui.PanelBar||kendo.ui.Menu&&t instanceof kendo.ui.Menu?(T.warn("k-ng-disabled specified on a widget that does not have the enable() method: "+t.options.name),n):(e.$watch(o,function(e,n){e!=n&&t.enable(!e)}),n)}function a(t,e,i,o){return"function"!=typeof t.readonly?(T.warn("k-ng-readonly specified on a widget that does not have the readonly() method: "+t.options.name),n):(e.$watch(o,function(e,n){e!=n&&t.readonly(e)}),n)}function l(t,e,n,i,o){if(n[o]){var r=k(n[o]).assign;if(!r)throw Error(o+" attribute used but expression in it is not assignable: "+n[i]);r(e,t)}}function c(t){return/checkbox|radio/i.test(t.attr("type"))?t.prop("checked"):t.val()}function h(t){return E.test(t[0].tagName)}function u(t,e,i,o,r){var s,a,l,u;t.value&&(s=h(i)?function(){return c(i)}:function(){return t.value()},o.$render=function(){var i=o.$viewValue;i===n&&(i=o.$modelValue),i===n&&(i=null),setTimeout(function(){if(t){var n=e[t.element.attr("k-ng-model")];n&&(i=n),t.options.autoBind!==!1||t.listView.bound()?t.value(i):i&&t.value(i)}},0)},a=!1,h(i)&&i.on("change",function(){a=!0}),l=function(t){return function(){var n;a||(t&&r&&(n=r.$pristine),o.$setViewValue(s()),t&&(o.$setPristine(),n&&r.$setPristine()),y(e))}},t.first("change",l(!1)),kendo.ui.AutoComplete&&t instanceof kendo.ui.AutoComplete||t.first("dataBound",l(!0)),u=s(),isNaN(o.$viewValue)||u==o.$viewValue||(o.$isEmpty(o.$viewValue)?null!=u&&""!==u&&u!=o.$viewValue&&o.$setViewValue(u):t.value(o.$viewValue)),o.$setPristine())}function d(e,i,o){var r,s,a,l,c,h,u,d,f;return"function"!=typeof e.value?(T.warn("k-ng-model specified on a widget that does not have the value() method: "+e.options.name),n):(r=t(e.element).parents("form"),s=i[r.attr("name")],a=k(o),l=a.assign,c=!1,h=kendo.ui.MultiSelect&&e instanceof kendo.ui.MultiSelect,u=function(t){return h?t.length:0},d=u(a(i)),e.$angular_setLogicValue(a(i)),f=function(t,i){t===n&&(t=null),c||t==i&&u(t)==d||(d=u(t),e.$angular_setLogicValue(t))},h?i.$watchCollection(o,f):i.$watch(o,f),e.first("change",function(){c=!0,s&&s.$pristine&&s.$setDirty(),y(i,function(){l(i,e.$angular_getLogicValue()),d=u(a(i))}),c=!1}),n)}function f(t,e){var n=t.$on("$destroy",function(){n(),e&&(e.element&&(e=v(e.element),e&&e.destroy()),e=null)});return n}function p(e,n){function i(){s.disconnect()}function o(){s.observe(t(n)[0],{attributes:!0})}var r,s;window.MutationObserver&&e.wrapper&&(r=[].slice.call(t(n)[0].classList),s=new MutationObserver(function(n){i(),e&&(n.forEach(function(n){var i,o=t(e.wrapper)[0];switch(n.attributeName){case"class":i=[].slice.call(n.target.classList),i.forEach(function(t){r.indexOf(t)<0&&(o.classList.add(t),kendo.ui.ComboBox&&e instanceof kendo.ui.ComboBox&&e.input[0].classList.add(t));
}),r.forEach(function(t){i.indexOf(t)<0&&(o.classList.remove(t),kendo.ui.ComboBox&&e instanceof kendo.ui.ComboBox&&e.input[0].classList.remove(t))}),r=i;break;case"disabled":"function"!=typeof e.enable||e.element.attr("readonly")||e.enable(!t(n.target).attr("disabled"));break;case"readonly":"function"!=typeof e.readonly||e.element.attr("disabled")||e.readonly(!!t(n.target).attr("readonly"))}}),o())}),o(),e.first("destroy",i))}function g(e,n,i,o,r,s,a){var l=n.$watch(r,function(r,c){var h,u,d,f,p;e._muteRebind||r===c||(l(),h=R[e.options.name],h&&h.forEach(function(e){var i=n.$eval(a["k"+e]);i&&o.append(t(i).attr(kendo.toHyphens("k"+e),""))}),u=t(e.wrapper)[0],d=t(e.element)[0],f="Upload"===e.options.name,f&&(i=t(d)),p=i.injector().get("$compile"),e._destroy(),s&&s(),e=null,d&&(u&&u.parentNode.replaceChild(d,u),t(i).replaceWith(o)),p(o)(n))},!0);y(n)}function m(t,n){function i(t,e){x.directive(t,["directiveFactory",function(n){return n.create(e,t)}])}var o,r,s,a,l=n?"Mobile":"";l+=t.fn.options.name,o=l,r="kendo"+l.charAt(0)+l.substr(1).toLowerCase(),l="kendo"+l,s=l.replace(/([A-Z])/g,"-$1"),-1==I.indexOf(l.replace("kendo",""))&&(a=l===r?[l]:[l,r],e.forEach(a,function(t){x.directive(t,function(){return{restrict:"E",replace:!0,template:function(t,e){var n=B[o]||"div",i=e.kScopeField||e.scopeField;return"<"+n+" "+s+(i?'="'+i+'"':"")+">"+t.html()+""+n+">"}}})})),z.indexOf(l.replace("kendo",""))>-1||(i(l,l),r!=l&&i(r,l))}function v(e){return e=t(e),kendo.widgetInstance(e,kendo.ui)||kendo.widgetInstance(e,kendo.mobile.ui)||kendo.widgetInstance(e,kendo.dataviz.ui)}function y(t,e){var n=t.$root||t,i=/^\$(digest|apply)$/.test(n.$$phase);e?i?e():n.$apply(e):i||n.$digest()}function _(e,n){e.$destroy(),n&&t(n).removeData("$scope").removeData("$$kendoScope").removeData("$isolateScope").removeData("$isolateScopeNoTemplate").removeClass("ng-scope")}function w(n,i,o){var r,s,a;if(t.isArray(n))return e.forEach(n,function(t){w(t,i,o)});if("string"==typeof n){for(r=n.split("."),s=kendo;s&&r.length>0;)s=s[r.shift()];if(!s)return L.push([n,i,o]),!1;n=s.prototype}return a=n[i],n[i]=function(){var t=this,e=arguments;return o.apply({self:t,next:function(){return a.apply(t,arguments.length>0?arguments:e)}},e)},!0}var x,b,k,C,S,T,A,D,P,M,E,B,I,z,L,R;e&&e.injector&&(x=e.module("kendo.directives",[]),b=e.injector(["ng"]),k=b.get("$parse"),C=b.get("$timeout"),T=b.get("$log"),D=function(){var t={TreeList:"TreeListDataSource",TreeView:"HierarchicalDataSource",Scheduler:"SchedulerDataSource",PanelBar:"$PLAIN",Menu:"$PLAIN",ContextMenu:"$PLAIN"},e=function(t,e){return"$PLAIN"==e?t:kendo.data[e].create(t)};return function(n,i,o,r){var s=t[o]||"DataSource",a=n.$eval(r),l=e(a,s);return n.$watch(r,function(t){var n,o=v(i);o&&"function"==typeof o.setDataSource&&t!==a&&(n=e(t,s),o.setDataSource(n),a=t)}),l}}(),P={kDataSource:!0,kOptions:!0,kRebind:!0,kNgModel:!0,kNgDelay:!0},M={name:!0,title:!0,style:!0},E=/^(input|select|textarea)$/i,x.factory("directiveFactory",["$compile",function(e){var n,i,r=!1;return S=e,i=function(e,i){return{restrict:"AC",require:["?ngModel","^?form"],scope:!1,controller:["$scope","$attrs","$element",function(t,e){var n=this;n.template=function(t,n){e[t]=kendo.stringify(n)},t.$on("$destroy",function(){n.template=null,n=null})}],link:function(s,a,l,c){var h,u=t(a),d=e.replace(/([A-Z])/g,"-$1");u.attr(d,u.attr("data-"+d)),u[0].removeAttribute("data-"+d),h=o(s,a,l,e,i,c),h&&(n&&clearTimeout(n),n=setTimeout(function(){s.$emit("kendoRendered"),r||(r=!0,t("form").each(function(){var e=t(this).controller("form");e&&e.$setPristine()}))}))}}},{create:i}}]),B={Editor:"textarea",NumericTextBox:"input",DatePicker:"input",DateTimePicker:"input",TimePicker:"input",AutoComplete:"input",ColorPicker:"input",MaskedTextBox:"input",MultiSelect:"input",Upload:"input",Validator:"form",Button:"button",MobileButton:"a",MobileBackButton:"a",MobileDetailButton:"a",ListView:"ul",MobileListView:"ul",TreeView:"ul",Menu:"ul",ContextMenu:"ul",ActionSheet:"ul"},I=["MobileView","MobileDrawer","MobileLayout","MobileSplitView","MobilePane","MobileModalView"],z=["MobileApplication","MobileView","MobileModalView","MobileLayout","MobileActionSheet","MobileDrawer","MobileSplitView","MobilePane","MobileScrollView","MobilePopOver"],e.forEach(["MobileNavBar","MobileButton","MobileBackButton","MobileDetailButton","MobileTabStrip","MobileScrollView","MobileScroller"],function(t){z.push(t),t="kendo"+t,x.directive(t,function(){return{restrict:"A",link:function(e,n,i){o(e,n,i,t,t)}}})}),L=[],kendo.onWidgetRegistered(function(e){L=t.grep(L,function(t){return!w.apply(null,t)}),m(e.widget,"Mobile"==e.prefix)}),w(["ui.Widget","mobile.ui.Widget"],"angular",function(o,r){var s,a=this.self;return"init"==o?(!r&&A&&(r=A),A=null,r&&r.$angular&&(a.$angular_scope=r.$angular[0],a.$angular_init(a.element,r)),n):(s=a.$angular_scope,s&&i(function(){var i,l,c=r(),h=c.elements,u=c.data;if(h.length>0)switch(o){case"cleanup":e.forEach(h,function(e){var n=t(e).data("$$kendoScope");n&&n!==s&&n.$$kendoScope&&_(n,e)});break;case"compile":i=a.element.injector(),l=i?i.get("$compile"):S,e.forEach(h,function(e,i){var o,r;c.scopeFrom?o=c.scopeFrom:(r=u&&u[i],r!==n?(o=t.extend(s.$new(),r),o.$$kendoScope=!0):o=s),t(e).data("$$kendoScope",o),l(e)(o)}),y(s)}}),n)}),w("ui.Widget","$angular_getLogicValue",function(){return this.self.value()}),w("ui.Widget","$angular_setLogicValue",function(t){this.self.value(t)}),w("ui.Select","$angular_getLogicValue",function(){var t=this.self.dataItem(),e=this.self.options.dataValueField;return t?this.self.options.valuePrimitive?e?t[e]:t:t.toJSON():null}),w("ui.Select","$angular_setLogicValue",function(t){var e=this.self,i=e.options,o=i.dataValueField,r=i.text||"";t===n&&(t=""),o&&!i.valuePrimitive&&t&&(r=t[i.dataTextField]||"",t=t[o||i.dataTextField]),e.options.autoBind!==!1||e.listView.bound()?e.value(t):!r&&t&&i.valuePrimitive?e.value(t):e._preselect(t,r)}),w("ui.MultiSelect","$angular_getLogicValue",function(){var e=this.self.dataItems().slice(0),n=this.self.options.dataValueField;return n&&this.self.options.valuePrimitive&&(e=t.map(e,function(t){return t[n]})),e}),w("ui.MultiSelect","$angular_setLogicValue",function(e){var n,i,o,r;null==e&&(e=[]),n=this.self,i=n.options,o=i.dataValueField,r=e,o&&!i.valuePrimitive&&(e=t.map(e,function(t){return t[o]})),i.autoBind!==!1||i.valuePrimitive||n.listView.bound()?n.value(e):n._preselect(r,e)}),w("ui.AutoComplete","$angular_getLogicValue",function(){var t,e,n,i,o,r=this.self.options,s=this.self.value().split(r.separator),a=r.valuePrimitive,l=this.self.dataSource.data(),c=[];for(t=0,e=l.length;e>t;t++)for(n=l[t],i=r.dataTextField?n[r.dataTextField]:n,o=0;s.length>o;o++)if(i===s[o]){c.push(a?i:n.toJSON());break}return c}),w("ui.AutoComplete","$angular_setLogicValue",function(e){null==e&&(e=[]);var i=this.self,o=i.options.dataTextField;o&&!i.options.valuePrimitive&&(e=e.length!==n?t.map(e,function(t){return t[o]}):e[o]),i.value(e)}),w("ui.Widget","$angular_init",function(e,n){var i,o,r,s,a=this.self;if(n&&!t.isArray(n))for(i=a.$angular_scope,o=a.events.length;--o>=0;)r=a.events[o],s=n[r],s&&"string"==typeof s&&(n[r]=a.$angular_makeEventHandler(r,i,s))}),w("ui.Widget","$angular_makeEventHandler",function(t,e,n){return n=k(n),function(t){y(e,function(){n(e,{kendoEvent:t})})}}),w(["ui.Grid","ui.ListView","ui.TreeView"],"$angular_makeEventHandler",function(t,n,i){return"change"!=t?this.next():(i=k(i),function(t){var o,r,s,a,l,c,h,u,d,f=t.sender,p=f.options,g={kendoEvent:t};for(e.isString(p.selectable)&&(o=-1!==p.selectable.indexOf("cell"),r=-1!==p.selectable.indexOf("multiple")),s=g.selected=this.select(),a=g.data=[],l=g.columns=[],h=0;s.length>h;h++)u=o?s[h].parentNode:s[h],d=f.dataItem(u),o?(e.element.inArray(d,a)<0&&a.push(d),c=e.element(s[h]).index(),e.element.inArray(c,l)<0&&l.push(c)):a.push(d);r||(g.dataItem=g.data=a[0],g.angularDataItem=kendo.proxyModelSetters(g.dataItem),g.selected=s[0]),y(n,function(){i(n,g)})})}),w("ui.Grid","$angular_init",function(i,o){if(this.next(),o.columns){var r=t.extend({},kendo.Template,o.templateSettings);e.forEach(o.columns,function(t){!t.field||t.template||t.format||t.values||t.encoded!==n&&!t.encoded||(t.template="#: "+kendo.expr(t.field,r.paramName)+"# ")})}}),w("mobile.ui.ButtonGroup","value",function(t){var e=this.self;return null!=t&&(e.select(e.element.children("li.km-button").eq(t)),e.trigger("change"),e.trigger("select",{index:e.selectedIndex})),e.selectedIndex}),w("mobile.ui.ButtonGroup","_select",function(){this.next(),this.self.trigger("change")}),x.directive("kendoMobileApplication",function(){return{terminal:!0,link:function(t,e,n){o(t,e,n,"kendoMobileApplication","kendoMobileApplication")}}}).directive("kendoMobileView",function(){return{scope:!0,link:{pre:function(t,e,n){n.defaultOptions=t.viewOptions,n._instance=o(t,e,n,"kendoMobileView","kendoMobileView")},post:function(t,e,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileDrawer",function(){return{scope:!0,link:{pre:function(t,e,n){n.defaultOptions=t.viewOptions,n._instance=o(t,e,n,"kendoMobileDrawer","kendoMobileDrawer")},post:function(t,e,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileModalView",function(){return{scope:!0,link:{pre:function(t,e,n){n.defaultOptions=t.viewOptions,n._instance=o(t,e,n,"kendoMobileModalView","kendoMobileModalView")},post:function(t,e,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileSplitView",function(){return{terminal:!0,link:{pre:function(t,e,n){n.defaultOptions=t.viewOptions,n._instance=o(t,e,n,"kendoMobileSplitView","kendoMobileSplitView")},post:function(t,e,n){n._instance._layout()}}}}).directive("kendoMobilePane",function(){return{terminal:!0,link:{pre:function(t,e,n){n.defaultOptions=t.viewOptions,o(t,e,n,"kendoMobilePane","kendoMobilePane")}}}}).directive("kendoMobileLayout",function(){return{link:{pre:function(t,e,n){o(t,e,n,"kendoMobileLayout","kendoMobileLayout")}}}}).directive("kendoMobileActionSheet",function(){return{restrict:"A",link:function(e,n,i){n.find("a[k-action]").each(function(){t(this).attr("data-"+kendo.ns+"action",t(this).attr("k-action"))}),o(e,n,i,"kendoMobileActionSheet","kendoMobileActionSheet")}}}).directive("kendoMobilePopOver",function(){return{terminal:!0,link:{pre:function(t,e,n){n.defaultOptions=t.viewOptions,o(t,e,n,"kendoMobilePopOver","kendoMobilePopOver")}}}}).directive("kendoViewTitle",function(){return{restrict:"E",replace:!0,template:function(t){return""+t.html()+" "}}}).directive("kendoMobileHeader",function(){return{restrict:"E",link:function(t,e){e.addClass("km-header").attr("data-role","header")}}}).directive("kendoMobileFooter",function(){return{restrict:"E",link:function(t,e){e.addClass("km-footer").attr("data-role","footer")}}}).directive("kendoMobileScrollViewPage",function(){return{restrict:"E",replace:!0,template:function(t){return""+t.html()+"
"}}}),e.forEach(["align","icon","rel","transition","actionsheetContext"],function(t){var e="k"+t.slice(0,1).toUpperCase()+t.slice(1);x.directive(e,function(){return{restrict:"A",priority:2,link:function(n,i,o){i.attr(kendo.attr(kendo.toHyphens(t)),n.$eval(o[e]))}}})}),R={TreeMap:["Template"],MobileListView:["HeaderTemplate","Template"],MobileScrollView:["EmptyTemplate","Template"],Grid:["AltRowTemplate","DetailTemplate","RowTemplate"],ListView:["EditTemplate","Template","AltTemplate"],Pager:["SelectTemplate","LinkTemplate"],PivotGrid:["ColumnHeaderTemplate","DataCellTemplate","RowHeaderTemplate"],Scheduler:["AllDayEventTemplate","DateHeaderTemplate","EventTemplate","MajorTimeHeaderTemplate","MinorTimeHeaderTemplate"],TreeView:["Template"],Validator:["ErrorTemplate"]},function(){var t={};e.forEach(R,function(n,i){e.forEach(n,function(e){t[e]||(t[e]=[]),t[e].push("?^^kendo"+i)})}),e.forEach(t,function(t,e){var n="k"+e,i=kendo.toHyphens(n);x.directive(n,function(){return{restrict:"A",require:t,terminal:!0,compile:function(e,o){if(""===o[n]){e.removeAttr(i);var r=e[0].outerHTML;return function(o,s,a,l){for(var c;!c&&l.length;)c=l.shift();c?(c.template(n,r),e.remove()):T.warn(i+" without a matching parent widget found. It can be one of the following: "+t.join(", "))}}}}})})}())}(window.kendo.jQuery,window.angular),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.webcomponents.min",["kendo.core.min"],t)}(function(){return function(t,e,n){function i(t,e){var i=t.getAttribute(e);return null===i?i=n:"null"===i?i=null:"true"===i?i=!0:"false"===i?i=!1:p.test(i)?i=parseFloat(i):d.test(i)&&!f.test(i)&&(i=Function("return ("+i+")")()),i}function o(t,e){var n={};return Object.keys(e).concat("dataSource").forEach(function(e){t.hasAttribute(kendo.toHyphens(e))&&(n[e]=i(t,kendo.toHyphens(e)))}),n}function r(t){var e={};return Object.keys(t).forEach(function(n){"_"!=n[0]&&(e[n]=t[n])}),e}function s(t,e){var n=document.createEvent("CustomEvent");n.initCustomEvent(t,!1,!0,r(e)),this.dispatchEvent(n),n.defaultPrevented&&e.preventDefault()}function a(t,e){var n,i=Object.keys(e);for(n=0;i.length>=n;n++)if("function"==typeof e[i[n]])t[i[n]]||(t[i[n]]=e[i[n]].bind(t.widget));else{if("options"===i[n])continue;t[i[n]]=t[i[n]]||e[i[n]]}}function l(e,n){var i=n.prototype.options,r=Object.create(HTMLElement.prototype);Object.defineProperty(r,"options",{get:function(){return this.widget.options},set:function(n){var i,o,r,s=this.widget;n=t.extend(!0,{},s.options,n),i=t(s.wrapper)[0],o=t(s.element)[0],s._destroy(),r=document.createElement(c[e]||"div"),i&&o&&(i.parentNode.replaceChild(o,i),t(o).replaceWith(r)),s.value&&(n.value=s.value()),s.init(r,n),this.bindEvents()}}),r.bindEvents=function(){n.prototype.events.forEach(function(t){this.widget.bind(t,s.bind(this,t)),this.hasAttribute(h+t)&&this.bind(t,function(e){window[this.getAttribute(h+t)].call(this,e)}.bind(this))}.bind(this))},r.attachedCallback=function(){var r,s=this,l=document.createElement(c[e]||"div");t(l).append(s.childNodes),t(l).attr("class",t(s).attr("class")),t(l).attr("style",t(s).attr("style")),s.appendChild(l),s.widget=new n(l,o(s,i)),r=s.widget;do a(s,r);while(r=Object.getPrototypeOf(r));this.bindEvents()},r.detachedCallback=function(){kendo.destroy(this.element)},kendo.webComponents.push("kendo-"+e),document.registerElement("kendo-"+e,{prototype:r})}var c,h,u,d,f,p;kendo.support.customElements&&!kendo.webComponents.length&&(!e||1!=e.version.major&&!e.injector)&&(c={editor:"textarea",numerictextbox:"input",datepicker:"input",datetimepicker:"input",timepicker:"input",autocomplete:"input",colorpicker:"input",maskedtextbox:"input",dropdownlist:"select",multiselect:"select",upload:"input",validator:"form",button:"button",mobilebutton:"a",mobilebackbutton:"a",mobiledetailbutton:"a",listview:"ul",mobilelistview:"ul",treeview:"ul",menu:"ul",contextmenu:"ul",actionsheet:"ul"},h="on-",u=[],kendo.onWidgetRegistered(function(t){var e=t.prefix+t.widget.prototype.options.name.toLowerCase();-1===u.indexOf(e)&&(u.push(e),l(e,t.widget))}),d=/^\s*(?:\{(?:.|\r\n|\n)*\}|\[(?:.|\r\n|\n)*\])\s*$/,f=/^\{(\d+)(:[^\}]+)?\}|^\[[A-Za-z_]*\]$/,p=/^(\+|-?)\d+(\.?)\d*$/)}(window.kendo.jQuery,window.angular),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.angular2.min",["kendo.core.min","kendo.webcomponents.min"],t)}(function(){!function(t,e){var n,i;e&&e.register&&(n=this&&this.__decorate||function(t,e,n,i){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(t,e,n,i);switch(arguments.length){case 2:return t.reduceRight(function(t,e){return e&&e(t)||t},e);case 3:return t.reduceRight(function(t,i){return void(i&&i(e,n))},void 0);case 4:return t.reduceRight(function(t,i){return i&&i(e,n,t)||t},i)}},i=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},e.register("kendo/angular2",["angular2/angular2"],function(e){var o,r;return{setters:[function(t){o=t}],execute:function(){r=function(){function e(t,e){var n=this;this.elementRef=e,this.onChange=function(t){},this.onTouched=function(){},this.element=e.nativeElement,this.element.addEventListener("change",function(){n.onChange(n.element.value())}),this.element.addEventListener("spin",function(){n.onChange(n.element.value())}),t.valueAccessor=this,this.cd=t,t.valueAccessor=this}return e.prototype.writeValue=function(t){this.element.value(t)},e.prototype.registerOnChange=function(t){this.onChange=t},e.prototype.registerOnTouched=function(t){this.onTouched=t},e=n([o.Directive({selector:t.webComponents.join(",")}),i("design:paramtypes",[o.NgControl,o.ElementRef])],e)}(),e("KendoValueAccessor",r)}}}))}(window.kendo,window.System)},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()}),function(t,define){define("kendo.dataviz.min",["kendo.core.min","kendo.fx.min","kendo.router.min","kendo.view.min","kendo.data.odata.min","kendo.data.xml.min","kendo.data.min","kendo.data.signalr.min","kendo.binder.min","kendo.userevents.min","kendo.draganddrop.min","kendo.mobile.scroller.min","kendo.popup.min","kendo.tooltip.min","kendo.drawing.min","kendo.dataviz.core.min","kendo.dataviz.themes.min","kendo.dataviz.chart.min","kendo.dataviz.chart.polar.min","kendo.dataviz.chart.funnel.min","kendo.dataviz.gauge.min","kendo.dataviz.barcode.min","kendo.dataviz.qrcode.min","kendo.dataviz.stock.min","kendo.dataviz.sparkline.min","kendo.dataviz.map.min","kendo.dataviz.diagram.min","kendo.dataviz.treemap.min","kendo.angular.min","kendo.webcomponents.min","kendo.angular2.min"],t)}(function(){"bundle all"},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()});
//# sourceMappingURL=kendo.dataviz.min.js.map