15 lines
443 KiB
JavaScript
15 lines
443 KiB
JavaScript
function Column(t,e,i,n,r,s){this.clearShapes=function(){_.each(this.shapes,function(t){this.canvas.remove(t)}),this.shapes=[]},this.updateShapes=function(t){if(this.columnBounds=this.getColumnBounds(this.bounds),this.labelBounds=this.getLabelBounds(this.columnBounds),this.hintBounds=this.getHintBounds(this.columnBounds),this.fillBounds=this.getFillBounds(this.columnBounds),this.handleBounds=this.getHandleBounds(this.columnBounds,this.fillBounds),t&&(this.updateRect("boundsRect",{left:this.columnBounds.left,top:this.columnBounds.top,width:this.columnBounds.width,height:this.columnBounds.height,stroke:this.strokeColor,fill:this.emptyColor}),this.updateRect("hintRect",{left:this.hintBounds.left,top:this.hintBounds.top,width:this.hintBounds.width,height:this.hintBounds.height,stroke:this.strokeColor}),this.hintRect.setGradient("fill",{x1:0,y1:0,x2:0,y2:this.hintRect.height,colorStops:this.decimateHints(this.steps,this.scale)}),this.updateRect("labelRect",{left:this.labelBounds.left,top:this.labelBounds.top,width:this.labelBounds.width,height:this.labelBounds.height,fill:this.strokeColor}),this.updateText("label",this.name,{left:this.fillBounds.left+this.fillBounds.width/2,top:this.labelBounds.top+this.labelBounds.height/2,fontSize:this.labelFontSize,originX:"center",originY:"center"})),this.updateRect("fillRect",{left:this.fillBounds.left,top:this.fillBounds.top,width:this.fillBounds.width,height:this.fillBounds.height,fill:this.getFillColor()}),this.updateRect("handleRect",{left:this.handleBounds.left,top:this.handleBounds.top,width:this.handleBounds.width,height:this.handleBounds.height,fill:this.getHandleColor()}),t&&goog.math.Range.containsPoint(this.range,0)){var e=this.getPosFromValue(0),i=[this.bounds.left,e,this.bounds.left+this.tickLength,e];this.updateLine("baseline",i,{stroke:this.tickColor})}this.canvas.renderAll()},this.updateRect=function(t,e){if(t in this)this[t].set(e);else{var i=new fabric.Rect(e);this.canvas.add(i),this.shapes.push(i),this[t]=i}},this.updateText=function(t,e,i){if(t in this)this[t].set(i);else{var e=new fabric.Text(e,i);this.canvas.add(e),this.shapes.push(e),this[t]=e}},this.updateLine=function(t,e,i){if(t in this)this[t].set(i);else{var n=new fabric.Line(e,i);this.canvas.add(n),this.shapes.push(n),this[t]=n}},this.decimateHints=function(t,e){var i=this.groupHints(t),n={};return _.each(i,function(i,r){var s=0;e.getLength()>0&&(s=Math.max(0,i-e.start)/e.getLength());var o=255-Math.min(255,Math.round(255*s)),a=tinycolor({r:o,g:o,b:o}),h=a.toHexString();n[r/t]=h}),n},this.groupHints=function(t){for(var e=this.range.getLength()/t,i=[],n=0;t>n;++n){var r=this.range.end-e*n,s=r-e,o=0;_.each(this.hints,function(t){t.sample>s&&t.sample<=r&&(o+=t.count)}),i.push(o)}return i},this.setClampedValue=function(t,e){this.value=goog.math.clamp(t,this.range.start,this.range.end),this.updateShapes(e),this.onValueChanged&&e&&this.onValueChanged(this.name,this.value)},this.setHints=function(t,e){this.hints=t,this.scale=e,this.updateShapes(!0)},this.getLabelBounds=function(t){return new goog.math.Rect(t.left,t.top+t.height,t.width,this.labelSize)},this.getColumnBounds=function(t){return new goog.math.Rect(t.left+this.tickLength,t.top,t.width-this.tickLength,t.height-this.labelSize)},this.getHintBounds=function(t){return new goog.math.Rect(t.left+t.width-this.hintSize,t.top,this.hintSize,t.height)},this.getFillBounds=function(t){var e=this.getPosFromValue(0),i=this.getPosFromValue(this.value);return new goog.math.Rect(t.left,Math.min(e,i),t.width-this.hintSize,Math.abs(e-i))},this.getHandleBounds=function(t,e){var i=new goog.math.Rect(e.left,this.getPosFromValue(this.value)-this.handleSize/2,e.width,this.handleSize);return i.intersection(t),i},this.valueColorAdjust=function(t,e){var i=tinycolor(t),n=this.value>=0?this.range.end:this.range.start,r=(this.range.start+this.range.end)/2,s=(this.value-r)/(n-r),o=100*Math.max(0,1-s+e);return i.desaturate(o).toHexString()},this.getFillColor=function(){var t=this.value>=0?this.fillColorPos:this.fillColorNeg;return this.valueColorAdjust(t,this.desatOffset)},this.getHandleColor=function(){var t=this.value>=0?this.handleColorPos:this.handleColorNeg;return this.valueColorAdjust(t,this.desatOffset)},this.mouseDown=function(t){this.isGrabbing(t)&&this.stateTransition(this.State.DRAG,t)},this.mouseUp=function(t){this.stateTransition(this.isHovering(t)?this.State.HOVER:this.State.NORMAL,t)},this.mouseMove=function(t){switch(this.state){case this.State.NORMAL:this.isHovering(t)&&this.stateTransition(this.State.HOVER,t);break;case this.State.HOVER:this.isHovering(t)||this.stateTransition(this.State.NORMAL,t)}this.stateUpdate(t)},this.mouseOut=function(t){this.mouseUp(t)},this.mouseDoubleClick=function(t){this.isContained(t)&&this.setClampedValue(this.getValueFromPos(t.y),!0)},this.getValueFromPos=function(t){var e=1-(t-this.columnBounds.top)/this.columnBounds.height;return this.range.start+this.range.getLength()*e},this.getPosFromValue=function(t){var e=1-(t-this.range.start)/this.range.getLength();return goog.math.clamp(this.columnBounds.top+this.columnBounds.height*e,this.columnBounds.top,this.columnBounds.top+this.columnBounds.height)},this.isHovering=function(t){return this.isGrabbing(t)},this.isGrabbing=function(t){return this.handleBounds.contains(t)},this.isContained=function(t){return this.columnBounds.contains(t)},this.stateUpdate=function(t){switch(this.state){case this.State.DRAG:this.setClampedValue(this.getValueFromPos(t.y)+this.dragDelta,!1)}},this.stateTransition=function(t,e){if(t!=this.state){switch(this.state){case this.State.DRAG:this.setClampedValue(this.getValueFromPos(e.y)+this.dragDelta,!0);case this.State.HOVER:t==this.State.NORMAL&&(this.canvas.contextContainer.canvas.style.cursor="default")}switch(t){case this.State.DRAG:this.dragDelta=this.value-this.getValueFromPos(e.y);case this.State.HOVER:this.canvas.contextContainer.canvas.style.cursor="ns-resize"}this.state=t}},this.State={NORMAL:0,HOVER:1,DRAG:2},this.handleSize=10,this.desatOffset=-.3,this.hintSize=10,this.labelFontSize=15,this.labelSize=20,this.tickLength=5,this.emptyColor="#eeeeec",this.strokeColor="#d3d7cf",this.tickColor="#888a85",this.fillColorNeg="#3465a4",this.fillColorPos="#cc0000",this.handleColorNeg="#204a87",this.handleColorPos="#a40000",this.canvas=t,this.shapes=[],this.name=e,this.value=i.value,this.hints=i.hints,this.steps=i.steps,this.scale=n,this.range=r,this.bounds=s,this.state=this.State.NORMAL,this.updateShapes(!0)}function Grapher(t,e,i,n,r){this.setColumns=function(t){this.clearColumns();var e=0;if(!n){var i={};_.each(t,function(t,e){i[e]=t.hints||[]}),e=this.getGlobalScale(i)}var r=this.getGraphBounds(this.getCanvasBounds()),s=0,o=this;_.each(t,function(t,i){n&&(e=o.getLocalScale(t.hints));var a=o.getColumnBounds(r,s);o.columns.push(new Column(o.canvas,i,t,e,o.range,a)),o.indexMap[i]=s++})},this.clearColumns=function(){_.each(this.columns,function(t){t.clearShapes()}),this.columns=[],this.indexMap={}},this.setColumnHints=function(t){var e=0;this.useLocalScale||(e=this.getGlobalScale(t));var i=this;_.each(t,function(t,n){var r=i.getColumnIndex(n);console.assert(r>=0),i.useLocalScale&&(e=i.getLocalScale(t)),i.columns[r].setHints(t,e)})},this.setUseLocalScale=function(t){t!=this.useLocalScale&&(this.useLocalScale=t,this.invalidateHints())},this.setUseRelativeScale=function(t){t!=this.useRelativeScale&&(this.useRelativeScale=t,this.invalidateHints())},this.invalidateHints=function(){var t={};_.each(this.columns,function(e){t[e.name]=e.hints}),this.setColumnHints(t)},this.setValueChangedListener=function(t){_.each(this.columns,function(e){e.onValueChanged=t})},this.getLocalScale=function(t){var e=_.pluck(t,"count"),i=this.useRelativeScale?_.min(e):0;return new goog.math.Range(i,_.max(e))},this.getGlobalScale=function(t){var e=this,i=null;return _.each(t,function(t){var n=e.getLocalScale(t);i?i.includeRange(n):i=n}),i},this.getColumnCount=function(){return this.columns.length},this.getColumnIndex=function(t){return console.assert(t in this.indexMap),this.indexMap[t]},this.getColumnName=function(t){return this.columns[t].name},this.getColumnNames=function(){return _.pluck(this.columns,"name")},this.getCanvasBounds=function(){return new goog.math.Rect(0,0,this.canvas.width-1,this.canvas.height-1)},this.getGraphBounds=function(){return this.getCanvasBounds()},this.getColumnBounds=function(t,e){var i=this.columnWidth+2*this.padding;return new goog.math.Rect(t.left+i*e+this.padding,t.top,this.columnWidth,t.height)},this.getMousePos=function(t){var e=t.target.getBoundingClientRect();return new goog.math.Coordinate(t.clientX-e.left,t.clientY-e.top)},this.mouseDown=function(t){var e=this.grapher.getMousePos(t);_.each(this.grapher.columns,function(t){t.mouseDown(e)})},this.mouseUp=function(t){var e=this.grapher.getMousePos(t);_.each(this.grapher.columns,function(t){t.mouseUp(e)})},this.mouseMove=function(t){var e=this.grapher.getMousePos(t);_.each(this.grapher.columns,function(t){t.mouseMove(e)})},this.mouseOut=function(t){var e=this.grapher.getMousePos(t);_.each(this.grapher.columns,function(t){t.mouseOut(e)})},this.mouseDoubleClick=function(t){var e=this.grapher.getMousePos(t);_.each(this.grapher.columns,function(t){t.mouseDoubleClick(e)})},this.useLocalScale=n,this.useRelativeScale=r,this.columnWidth=i,this.canvas=new fabric.StaticCanvas(t),this.range=new goog.math.Range(e.min,e.max),this.padding=10,this.indexMap={},this.columns=[];var s=this.canvas.contextContainer.canvas;s.addEventListener("mousedown",this.mouseDown,!1),s.addEventListener("mouseup",this.mouseUp,!1),s.addEventListener("mousemove",this.mouseMove,!1),s.addEventListener("mouseout",this.mouseOut,!1),s.addEventListener("dblclick",this.mouseDoubleClick,!1),s.grapher=this}(function(){var t=this,e=t._,i={},n=Array.prototype,r=Object.prototype,s=Function.prototype,o=n.push,a=n.slice,h=n.concat,l=r.toString,c=r.hasOwnProperty,u=n.forEach,f=n.map,d=n.reduce,p=n.reduceRight,g=n.filter,v=n.every,m=n.some,y=n.indexOf,b=n.lastIndexOf,x=Array.isArray,_=Object.keys,w=s.bind,C=function(t){return t instanceof C?t:this instanceof C?void(this._wrapped=t):new C(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=C),exports._=C):t._=C,C.VERSION="1.6.0";var S=C.each=C.forEach=function(t,e,n){if(null==t)return t;if(u&&t.forEach===u)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,s=t.length;s>r;r++)if(e.call(n,t[r],r,t)===i)return}else for(var o=C.keys(t),r=0,s=o.length;s>r;r++)if(e.call(n,t[o[r]],o[r],t)===i)return;return t};C.map=C.collect=function(t,e,i){var n=[];return null==t?n:f&&t.map===f?t.map(e,i):(S(t,function(t,r,s){n.push(e.call(i,t,r,s))}),n)};var T="Reduce of empty array with no initial value";C.reduce=C.foldl=C.inject=function(t,e,i,n){var r=arguments.length>2;if(null==t&&(t=[]),d&&t.reduce===d)return n&&(e=C.bind(e,n)),r?t.reduce(e,i):t.reduce(e);if(S(t,function(t,s,o){r?i=e.call(n,i,t,s,o):(i=t,r=!0)}),!r)throw new TypeError(T);return i},C.reduceRight=C.foldr=function(t,e,i,n){var r=arguments.length>2;if(null==t&&(t=[]),p&&t.reduceRight===p)return n&&(e=C.bind(e,n)),r?t.reduceRight(e,i):t.reduceRight(e);var s=t.length;if(s!==+s){var o=C.keys(t);s=o.length}if(S(t,function(a,h,l){h=o?o[--s]:--s,r?i=e.call(n,i,t[h],h,l):(i=t[h],r=!0)}),!r)throw new TypeError(T);return i},C.find=C.detect=function(t,e,i){var n;return k(t,function(t,r,s){return e.call(i,t,r,s)?(n=t,!0):void 0}),n},C.filter=C.select=function(t,e,i){var n=[];return null==t?n:g&&t.filter===g?t.filter(e,i):(S(t,function(t,r,s){e.call(i,t,r,s)&&n.push(t)}),n)},C.reject=function(t,e,i){return C.filter(t,function(t,n,r){return!e.call(i,t,n,r)},i)},C.every=C.all=function(t,e,n){e||(e=C.identity);var r=!0;return null==t?r:v&&t.every===v?t.every(e,n):(S(t,function(t,s,o){return(r=r&&e.call(n,t,s,o))?void 0:i}),!!r)};var k=C.some=C.any=function(t,e,n){e||(e=C.identity);var r=!1;return null==t?r:m&&t.some===m?t.some(e,n):(S(t,function(t,s,o){return r||(r=e.call(n,t,s,o))?i:void 0}),!!r)};C.contains=C.include=function(t,e){return null==t?!1:y&&t.indexOf===y?-1!=t.indexOf(e):k(t,function(t){return t===e})},C.invoke=function(t,e){var i=a.call(arguments,2),n=C.isFunction(e);return C.map(t,function(t){return(n?e:t[e]).apply(t,i)})},C.pluck=function(t,e){return C.map(t,C.property(e))},C.where=function(t,e){return C.filter(t,C.matches(e))},C.findWhere=function(t,e){return C.find(t,C.matches(e))},C.max=function(t,e,i){if(!e&&C.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);var n=-1/0,r=-1/0;return S(t,function(t,s,o){var a=e?e.call(i,t,s,o):t;a>r&&(n=t,r=a)}),n},C.min=function(t,e,i){if(!e&&C.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);var n=1/0,r=1/0;return S(t,function(t,s,o){var a=e?e.call(i,t,s,o):t;r>a&&(n=t,r=a)}),n},C.shuffle=function(t){var e,i=0,n=[];return S(t,function(t){e=C.random(i++),n[i-1]=n[e],n[e]=t}),n},C.sample=function(t,e,i){return null==e||i?(t.length!==+t.length&&(t=C.values(t)),t[C.random(t.length-1)]):C.shuffle(t).slice(0,Math.max(0,e))};var O=function(t){return null==t?C.identity:C.isFunction(t)?t:C.property(t)};C.sortBy=function(t,e,i){return e=O(e),C.pluck(C.map(t,function(t,n,r){return{value:t,index:n,criteria:e.call(i,t,n,r)}}).sort(function(t,e){var i=t.criteria,n=e.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(n>i||void 0===n)return-1}return t.index-e.index}),"value")};var E=function(t){return function(e,i,n){var r={};return i=O(i),S(e,function(s,o){var a=i.call(n,s,o,e);t(r,a,s)}),r}};C.groupBy=E(function(t,e,i){C.has(t,e)?t[e].push(i):t[e]=[i]}),C.indexBy=E(function(t,e,i){t[e]=i}),C.countBy=E(function(t,e){C.has(t,e)?t[e]++:t[e]=1}),C.sortedIndex=function(t,e,i,n){i=O(i);for(var r=i.call(n,e),s=0,o=t.length;o>s;){var a=s+o>>>1;i.call(n,t[a])<r?s=a+1:o=a}return s},C.toArray=function(t){return t?C.isArray(t)?a.call(t):t.length===+t.length?C.map(t,C.identity):C.values(t):[]},C.size=function(t){return null==t?0:t.length===+t.length?t.length:C.keys(t).length},C.first=C.head=C.take=function(t,e,i){return null==t?void 0:null==e||i?t[0]:0>e?[]:a.call(t,0,e)},C.initial=function(t,e,i){return a.call(t,0,t.length-(null==e||i?1:e))},C.last=function(t,e,i){return null==t?void 0:null==e||i?t[t.length-1]:a.call(t,Math.max(t.length-e,0))},C.rest=C.tail=C.drop=function(t,e,i){return a.call(t,null==e||i?1:e)},C.compact=function(t){return C.filter(t,C.identity)};var A=function(t,e,i){return e&&C.every(t,C.isArray)?h.apply(i,t):(S(t,function(t){C.isArray(t)||C.isArguments(t)?e?o.apply(i,t):A(t,e,i):i.push(t)}),i)};C.flatten=function(t,e){return A(t,e,[])},C.without=function(t){return C.difference(t,a.call(arguments,1))},C.partition=function(t,e){var i=[],n=[];return S(t,function(t){(e(t)?i:n).push(t)}),[i,n]},C.uniq=C.unique=function(t,e,i,n){C.isFunction(e)&&(n=i,i=e,e=!1);var r=i?C.map(t,i,n):t,s=[],o=[];return S(r,function(i,n){(e?n&&o[o.length-1]===i:C.contains(o,i))||(o.push(i),s.push(t[n]))}),s},C.union=function(){return C.uniq(C.flatten(arguments,!0))},C.intersection=function(t){var e=a.call(arguments,1);return C.filter(C.uniq(t),function(t){return C.every(e,function(e){return C.contains(e,t)})})},C.difference=function(t){var e=h.apply(n,a.call(arguments,1));return C.filter(t,function(t){return!C.contains(e,t)})},C.zip=function(){for(var t=C.max(C.pluck(arguments,"length").concat(0)),e=new Array(t),i=0;t>i;i++)e[i]=C.pluck(arguments,""+i);return e},C.object=function(t,e){if(null==t)return{};for(var i={},n=0,r=t.length;r>n;n++)e?i[t[n]]=e[n]:i[t[n][0]]=t[n][1];return i},C.indexOf=function(t,e,i){if(null==t)return-1;var n=0,r=t.length;if(i){if("number"!=typeof i)return n=C.sortedIndex(t,e),t[n]===e?n:-1;n=0>i?Math.max(0,r+i):i}if(y&&t.indexOf===y)return t.indexOf(e,i);for(;r>n;n++)if(t[n]===e)return n;return-1},C.lastIndexOf=function(t,e,i){if(null==t)return-1;var n=null!=i;if(b&&t.lastIndexOf===b)return n?t.lastIndexOf(e,i):t.lastIndexOf(e);for(var r=n?i:t.length;r--;)if(t[r]===e)return r;return-1},C.range=function(t,e,i){arguments.length<=1&&(e=t||0,t=0),i=arguments[2]||1;for(var n=Math.max(Math.ceil((e-t)/i),0),r=0,s=new Array(n);n>r;)s[r++]=t,t+=i;return s};var P=function(){};C.bind=function(t,e){var i,n;if(w&&t.bind===w)return w.apply(t,a.call(arguments,1));if(!C.isFunction(t))throw new TypeError;return i=a.call(arguments,2),n=function(){if(!(this instanceof n))return t.apply(e,i.concat(a.call(arguments)));P.prototype=t.prototype;var r=new P;P.prototype=null;var s=t.apply(r,i.concat(a.call(arguments)));return Object(s)===s?s:r}},C.partial=function(t){var e=a.call(arguments,1);return function(){for(var i=0,n=e.slice(),r=0,s=n.length;s>r;r++)n[r]===C&&(n[r]=arguments[i++]);for(;i<arguments.length;)n.push(arguments[i++]);return t.apply(this,n)}},C.bindAll=function(t){var e=a.call(arguments,1);if(0===e.length)throw new Error("bindAll must be passed function names");return S(e,function(e){t[e]=C.bind(t[e],t)}),t},C.memoize=function(t,e){var i={};return e||(e=C.identity),function(){var n=e.apply(this,arguments);return C.has(i,n)?i[n]:i[n]=t.apply(this,arguments)}},C.delay=function(t,e){var i=a.call(arguments,2);return setTimeout(function(){return t.apply(null,i)},e)},C.defer=function(t){return C.delay.apply(C,[t,1].concat(a.call(arguments,1)))},C.throttle=function(t,e,i){var n,r,s,o=null,a=0;i||(i={});var h=function(){a=i.leading===!1?0:C.now(),o=null,s=t.apply(n,r),n=r=null};return function(){var l=C.now();a||i.leading!==!1||(a=l);var c=e-(l-a);return n=this,r=arguments,0>=c?(clearTimeout(o),o=null,a=l,s=t.apply(n,r),n=r=null):o||i.trailing===!1||(o=setTimeout(h,c)),s}},C.debounce=function(t,e,i){var n,r,s,o,a,h=function(){var l=C.now()-o;e>l?n=setTimeout(h,e-l):(n=null,i||(a=t.apply(s,r),s=r=null))};return function(){s=this,r=arguments,o=C.now();var l=i&&!n;return n||(n=setTimeout(h,e)),l&&(a=t.apply(s,r),s=r=null),a}},C.once=function(t){var e,i=!1;return function(){return i?e:(i=!0,e=t.apply(this,arguments),t=null,e)}},C.wrap=function(t,e){return C.partial(e,t)},C.compose=function(){var t=arguments;return function(){for(var e=arguments,i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},C.after=function(t,e){return function(){return--t<1?e.apply(this,arguments):void 0}},C.keys=function(t){if(!C.isObject(t))return[];if(_)return _(t);var e=[];for(var i in t)C.has(t,i)&&e.push(i);return e},C.values=function(t){for(var e=C.keys(t),i=e.length,n=new Array(i),r=0;i>r;r++)n[r]=t[e[r]];return n},C.pairs=function(t){for(var e=C.keys(t),i=e.length,n=new Array(i),r=0;i>r;r++)n[r]=[e[r],t[e[r]]];return n},C.invert=function(t){for(var e={},i=C.keys(t),n=0,r=i.length;r>n;n++)e[t[i[n]]]=i[n];return e},C.functions=C.methods=function(t){var e=[];for(var i in t)C.isFunction(t[i])&&e.push(i);return e.sort()},C.extend=function(t){return S(a.call(arguments,1),function(e){if(e)for(var i in e)t[i]=e[i]}),t},C.pick=function(t){var e={},i=h.apply(n,a.call(arguments,1));return S(i,function(i){i in t&&(e[i]=t[i])}),e},C.omit=function(t){var e={},i=h.apply(n,a.call(arguments,1));for(var r in t)C.contains(i,r)||(e[r]=t[r]);return e},C.defaults=function(t){return S(a.call(arguments,1),function(e){if(e)for(var i in e)void 0===t[i]&&(t[i]=e[i])}),t},C.clone=function(t){return C.isObject(t)?C.isArray(t)?t.slice():C.extend({},t):t},C.tap=function(t,e){return e(t),t};var j=function(t,e,i,n){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof C&&(t=t._wrapped),e instanceof C&&(e=e._wrapped);var r=l.call(t);if(r!=l.call(e))return!1;switch(r){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var s=i.length;s--;)if(i[s]==t)return n[s]==e;var o=t.constructor,a=e.constructor;if(o!==a&&!(C.isFunction(o)&&o instanceof o&&C.isFunction(a)&&a instanceof a)&&"constructor"in t&&"constructor"in e)return!1;i.push(t),n.push(e);var h=0,c=!0;if("[object Array]"==r){if(h=t.length,c=h==e.length)for(;h--&&(c=j(t[h],e[h],i,n)););}else{for(var u in t)if(C.has(t,u)&&(h++,!(c=C.has(e,u)&&j(t[u],e[u],i,n))))break;if(c){for(u in e)if(C.has(e,u)&&!h--)break;c=!h}}return i.pop(),n.pop(),c};C.isEqual=function(t,e){return j(t,e,[],[])},C.isEmpty=function(t){if(null==t)return!0;if(C.isArray(t)||C.isString(t))return 0===t.length;for(var e in t)if(C.has(t,e))return!1;return!0},C.isElement=function(t){return!(!t||1!==t.nodeType)},C.isArray=x||function(t){return"[object Array]"==l.call(t)},C.isObject=function(t){return t===Object(t)},S(["Arguments","Function","String","Number","Date","RegExp"],function(t){C["is"+t]=function(e){return l.call(e)=="[object "+t+"]"}}),C.isArguments(arguments)||(C.isArguments=function(t){return!(!t||!C.has(t,"callee"))}),"function"!=typeof/./&&(C.isFunction=function(t){return"function"==typeof t}),C.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},C.isNaN=function(t){return C.isNumber(t)&&t!=+t},C.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==l.call(t)},C.isNull=function(t){return null===t},C.isUndefined=function(t){return void 0===t},C.has=function(t,e){return c.call(t,e)},C.noConflict=function(){return t._=e,this},C.identity=function(t){return t},C.constant=function(t){return function(){return t}},C.property=function(t){return function(e){return e[t]}},C.matches=function(t){return function(e){if(e===t)return!0;for(var i in t)if(t[i]!==e[i])return!1;return!0}},C.times=function(t,e,i){for(var n=Array(Math.max(0,t)),r=0;t>r;r++)n[r]=e.call(i,r);return n},C.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},C.now=Date.now||function(){return(new Date).getTime()};var D={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};D.unescape=C.invert(D.escape);var L={escape:new RegExp("["+C.keys(D.escape).join("")+"]","g"),unescape:new RegExp("("+C.keys(D.unescape).join("|")+")","g")};C.each(["escape","unescape"],function(t){C[t]=function(e){return null==e?"":(""+e).replace(L[t],function(e){return D[t][e]})}}),C.result=function(t,e){if(null==t)return void 0;var i=t[e];return C.isFunction(i)?i.call(t):i},C.mixin=function(t){S(C.functions(t),function(e){var i=C[e]=t[e];C.prototype[e]=function(){var t=[this._wrapped];return o.apply(t,arguments),$.call(this,i.apply(C,t))}})};var I=0;C.uniqueId=function(t){var e=++I+"";return t?t+e:e},C.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var M=/(.)^/,N={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},R=/\\|'|\r|\n|\t|\u2028|\u2029/g;C.template=function(t,e,i){var n;i=C.defaults({},i,C.templateSettings);var r=new RegExp([(i.escape||M).source,(i.interpolate||M).source,(i.evaluate||M).source].join("|")+"|$","g"),s=0,o="__p+='";t.replace(r,function(e,i,n,r,a){return o+=t.slice(s,a).replace(R,function(t){return"\\"+N[t]}),i&&(o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),n&&(o+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),r&&(o+="';\n"+r+"\n__p+='"),s=a+e.length,e}),o+="';\n",i.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{n=new Function(i.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(e)return n(e,C);var h=function(t){return n.call(this,t,C)};return h.source="function("+(i.variable||"obj")+"){\n"+o+"}",h},C.chain=function(t){return C(t).chain()};var $=function(t){return this._chain?C(t).chain():t};C.mixin(C),S(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=n[t];C.prototype[t]=function(){var i=this._wrapped;return e.apply(i,arguments),"shift"!=t&&"splice"!=t||0!==i.length||delete i[0],$.call(this,i)}}),S(["concat","join","slice"],function(t){var e=n[t];C.prototype[t]=function(){return $.call(this,e.apply(this._wrapped,arguments))}}),C.extend(C.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return C})}).call(this);var Handlebars=function(){var t=function(){"use strict";function t(t){this.string=t}var e;return t.prototype.toString=function(){return""+this.string},e=t}(),e=function(t){"use strict";function e(t){return a[t]||"&"}function i(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function n(t){return t instanceof o?t.toString():t||0===t?(t=""+t,l.test(t)?t.replace(h,e):t):""}function r(t){return t||0===t?f(t)&&0===t.length?!0:!1:!0}var s={},o=t,a={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},h=/[&<>"'`]/g,l=/[&<>"'`]/;s.extend=i;var c=Object.prototype.toString;s.toString=c;var u=function(t){return"function"==typeof t};u(/x/)&&(u=function(t){return"function"==typeof t&&"[object Function]"===c.call(t)});var u;s.isFunction=u;var f=Array.isArray||function(t){return t&&"object"==typeof t?"[object Array]"===c.call(t):!1};return s.isArray=f,s.escapeExpression=n,s.isEmpty=r,s}(t),i=function(){"use strict";function t(t,e){var n;e&&e.firstLine&&(n=e.firstLine,t+=" - "+n+":"+e.firstColumn);for(var r=Error.prototype.constructor.call(this,t),s=0;s<i.length;s++)this[i[s]]=r[i[s]];n&&(this.lineNumber=n,this.column=e.firstColumn)}var e,i=["description","fileName","lineNumber","message","name","number","stack"];return t.prototype=new Error,e=t}(),n=function(t,e){"use strict";function i(t,e){this.helpers=t||{},this.partials=e||{},n(this)}function n(t){t.registerHelper("helperMissing",function(t){if(2===arguments.length)return void 0;throw new a("Missing helper: '"+t+"'")}),t.registerHelper("blockHelperMissing",function(e,i){var n=i.inverse||function(){},r=i.fn;return f(e)&&(e=e.call(this)),e===!0?r(this):e===!1||null==e?n(this):u(e)?e.length>0?t.helpers.each(e,i):n(this):r(e)}),t.registerHelper("each",function(t,e){var i,n=e.fn,r=e.inverse,s=0,o="";if(f(t)&&(t=t.call(this)),e.data&&(i=v(e.data)),t&&"object"==typeof t)if(u(t))for(var a=t.length;a>s;s++)i&&(i.index=s,i.first=0===s,i.last=s===t.length-1),o+=n(t[s],{data:i});else for(var h in t)t.hasOwnProperty(h)&&(i&&(i.key=h,i.index=s,i.first=0===s),o+=n(t[h],{data:i}),s++);return 0===s&&(o=r(this)),o}),t.registerHelper("if",function(t,e){return f(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||o.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,i){return t.helpers["if"].call(this,e,{fn:i.inverse,inverse:i.fn,hash:i.hash})}),t.registerHelper("with",function(t,e){return f(t)&&(t=t.call(this)),o.isEmpty(t)?void 0:e.fn(t)}),t.registerHelper("log",function(e,i){var n=i.data&&null!=i.data.level?parseInt(i.data.level,10):1;t.log(n,e)})}function r(t,e){g.log(t,e)}var s={},o=t,a=e,h="1.3.0";s.VERSION=h;var l=4;s.COMPILER_REVISION=l;var c={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};s.REVISION_CHANGES=c;var u=o.isArray,f=o.isFunction,d=o.toString,p="[object Object]";s.HandlebarsEnvironment=i,i.prototype={constructor:i,logger:g,log:r,registerHelper:function(t,e,i){if(d.call(t)===p){if(i||e)throw new a("Arg not supported with multiple helpers");o.extend(this.helpers,t)}else i&&(e.not=i),this.helpers[t]=e},registerPartial:function(t,e){d.call(t)===p?o.extend(this.partials,t):this.partials[t]=e}};var g={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(t,e){if(g.level<=t){var i=g.methodMap[t];"undefined"!=typeof console&&console[i]&&console[i].call(console,e)}}};s.logger=g,s.log=r;var v=function(t){var e={};return o.extend(e,t),e};return s.createFrame=v,s}(e,i),r=function(t,e,i){"use strict";function n(t){var e=t&&t[0]||1,i=f;if(e!==i){if(i>e){var n=d[i],r=d[e];throw new u("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+n+") or downgrade your runtime to an older version ("+r+").")}throw new u("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}}function r(t,e){if(!e)throw new u("No environment passed to template");var i=function(t,i,n,r,s,o){var a=e.VM.invokePartial.apply(this,arguments);if(null!=a)return a;if(e.compile){var h={helpers:r,partials:s,data:o};return s[i]=e.compile(t,{data:void 0!==o},e),s[i](n,h)}throw new u("The partial "+i+" could not be compiled when running in runtime-only mode")},n={escapeExpression:c.escapeExpression,invokePartial:i,programs:[],program:function(t,e,i){var n=this.programs[t];return i?n=o(t,e,i):n||(n=this.programs[t]=o(t,e)),n},merge:function(t,e){var i=t||e;return t&&e&&t!==e&&(i={},c.extend(i,e),c.extend(i,t)),i},programWithDepth:e.VM.programWithDepth,noop:e.VM.noop,compilerInfo:null};return function(i,r){r=r||{};var s,o,a=r.partial?r:e;r.partial||(s=r.helpers,o=r.partials);var h=t.call(n,a,i,s,o,r.data);return r.partial||e.VM.checkRevision(n.compilerInfo),h}}function s(t,e,i){var n=Array.prototype.slice.call(arguments,3),r=function(t,r){return r=r||{},e.apply(this,[t,r.data||i].concat(n))};return r.program=t,r.depth=n.length,r}function o(t,e,i){var n=function(t,n){return n=n||{},e(t,n.data||i)};return n.program=t,n.depth=0,n}function a(t,e,i,n,r,s){var o={partial:!0,helpers:n,partials:r,data:s};if(void 0===t)throw new u("The partial "+e+" could not be found");return t instanceof Function?t(i,o):void 0}function h(){return""}var l={},c=t,u=e,f=i.COMPILER_REVISION,d=i.REVISION_CHANGES;return l.checkRevision=n,l.template=r,l.programWithDepth=s,l.program=o,l.invokePartial=a,l.noop=h,l}(e,i,n),s=function(t,e,i,n,r){"use strict";var s,o=t,a=e,h=i,l=n,c=r,u=function(){var t=new o.HandlebarsEnvironment;return l.extend(t,o),t.SafeString=a,t.Exception=h,t.Utils=l,t.VM=c,t.template=function(e){return c.template(e,t)},t},f=u();return f.create=u,s=f}(n,t,i,e,r),o=function(t){"use strict";function e(t){t=t||{},this.firstLine=t.first_line,this.firstColumn=t.first_column,this.lastColumn=t.last_column,this.lastLine=t.last_line}var i,n=t,r={ProgramNode:function(t,i,n,s){var o,a;3===arguments.length?(s=n,n=null):2===arguments.length&&(s=i,i=null),e.call(this,s),this.type="program",this.statements=t,this.strip={},n?(a=n[0],a?(o={first_line:a.firstLine,last_line:a.lastLine,last_column:a.lastColumn,first_column:a.firstColumn},this.inverse=new r.ProgramNode(n,i,o)):this.inverse=new r.ProgramNode(n,i),this.strip.right=i.left):i&&(this.strip.left=i.right)},MustacheNode:function(t,i,n,s,o){if(e.call(this,o),this.type="mustache",this.strip=s,null!=n&&n.charAt){var a=n.charAt(3)||n.charAt(2);this.escaped="{"!==a&&"&"!==a}else this.escaped=!!n;this.sexpr=t instanceof r.SexprNode?t:new r.SexprNode(t,i),this.sexpr.isRoot=!0,this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(t,i,n){e.call(this,n),this.type="sexpr",this.hash=i;var r=this.id=t[0],s=this.params=t.slice(1),o=this.eligibleHelper=r.isSimple;this.isHelper=o&&(s.length||i)},PartialNode:function(t,i,n,r){e.call(this,r),this.type="partial",this.partialName=t,this.context=i,this.strip=n},BlockNode:function(t,i,r,s,o){if(e.call(this,o),t.sexpr.id.original!==s.path.original)throw new n(t.sexpr.id.original+" doesn't match "+s.path.original,this);this.type="block",this.mustache=t,this.program=i,this.inverse=r,this.strip={left:t.strip.left,right:s.strip.right},(i||r).strip.left=t.strip.right,(r||i).strip.right=s.strip.left,r&&!i&&(this.isInverse=!0)},ContentNode:function(t,i){e.call(this,i),this.type="content",this.string=t},HashNode:function(t,i){e.call(this,i),this.type="hash",this.pairs=t},IdNode:function(t,i){e.call(this,i),this.type="ID";for(var r="",s=[],o=0,a=0,h=t.length;h>a;a++){var l=t[a].part;if(r+=(t[a].separator||"")+l,".."===l||"."===l||"this"===l){if(s.length>0)throw new n("Invalid path: "+r,this);".."===l?o++:this.isScoped=!0
|
|
}else s.push(l)}this.original=r,this.parts=s,this.string=s.join("."),this.depth=o,this.isSimple=1===t.length&&!this.isScoped&&0===o,this.stringModeValue=this.string},PartialNameNode:function(t,i){e.call(this,i),this.type="PARTIAL_NAME",this.name=t.original},DataNode:function(t,i){e.call(this,i),this.type="DATA",this.id=t},StringNode:function(t,i){e.call(this,i),this.type="STRING",this.original=this.string=this.stringModeValue=t},IntegerNode:function(t,i){e.call(this,i),this.type="INTEGER",this.original=this.integer=t,this.stringModeValue=Number(t)},BooleanNode:function(t,i){e.call(this,i),this.type="BOOLEAN",this.bool=t,this.stringModeValue="true"===t},CommentNode:function(t,i){e.call(this,i),this.type="comment",this.comment=t}};return i=r}(i),a=function(){"use strict";var t,e=function(){function t(t,e){return{left:"~"===t.charAt(2),right:"~"===e.charAt(0)||"~"===e.charAt(1)}}function e(){this.yy={}}var i={trace:function(){},yy:{},symbols_:{error:2,root:3,statements:4,EOF:5,program:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,sexpr:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,CLOSE_UNESCAPED:24,OPEN_PARTIAL:25,partialName:26,partial_option0:27,sexpr_repetition0:28,sexpr_option0:29,dataName:30,param:31,STRING:32,INTEGER:33,BOOLEAN:34,OPEN_SEXPR:35,CLOSE_SEXPR:36,hash:37,hash_repetition_plus0:38,hashSegment:39,ID:40,EQUALS:41,DATA:42,pathSegments:43,SEP:44,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"},productions_:[0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]],performAction:function(e,i,n,r,s,o){var a=o.length-1;switch(s){case 1:return new r.ProgramNode(o[a-1],this._$);case 2:return new r.ProgramNode([],this._$);case 3:this.$=new r.ProgramNode([],o[a-1],o[a],this._$);break;case 4:this.$=new r.ProgramNode(o[a-2],o[a-1],o[a],this._$);break;case 5:this.$=new r.ProgramNode(o[a-1],o[a],[],this._$);break;case 6:this.$=new r.ProgramNode(o[a],this._$);break;case 7:this.$=new r.ProgramNode([],this._$);break;case 8:this.$=new r.ProgramNode([],this._$);break;case 9:this.$=[o[a]];break;case 10:o[a-1].push(o[a]),this.$=o[a-1];break;case 11:this.$=new r.BlockNode(o[a-2],o[a-1].inverse,o[a-1],o[a],this._$);break;case 12:this.$=new r.BlockNode(o[a-2],o[a-1],o[a-1].inverse,o[a],this._$);break;case 13:this.$=o[a];break;case 14:this.$=o[a];break;case 15:this.$=new r.ContentNode(o[a],this._$);break;case 16:this.$=new r.CommentNode(o[a],this._$);break;case 17:this.$=new r.MustacheNode(o[a-1],null,o[a-2],t(o[a-2],o[a]),this._$);break;case 18:this.$=new r.MustacheNode(o[a-1],null,o[a-2],t(o[a-2],o[a]),this._$);break;case 19:this.$={path:o[a-1],strip:t(o[a-2],o[a])};break;case 20:this.$=new r.MustacheNode(o[a-1],null,o[a-2],t(o[a-2],o[a]),this._$);break;case 21:this.$=new r.MustacheNode(o[a-1],null,o[a-2],t(o[a-2],o[a]),this._$);break;case 22:this.$=new r.PartialNode(o[a-2],o[a-1],t(o[a-3],o[a]),this._$);break;case 23:this.$=t(o[a-1],o[a]);break;case 24:this.$=new r.SexprNode([o[a-2]].concat(o[a-1]),o[a],this._$);break;case 25:this.$=new r.SexprNode([o[a]],null,this._$);break;case 26:this.$=o[a];break;case 27:this.$=new r.StringNode(o[a],this._$);break;case 28:this.$=new r.IntegerNode(o[a],this._$);break;case 29:this.$=new r.BooleanNode(o[a],this._$);break;case 30:this.$=o[a];break;case 31:o[a-1].isHelper=!0,this.$=o[a-1];break;case 32:this.$=new r.HashNode(o[a],this._$);break;case 33:this.$=[o[a-2],o[a]];break;case 34:this.$=new r.PartialNameNode(o[a],this._$);break;case 35:this.$=new r.PartialNameNode(new r.StringNode(o[a],this._$),this._$);break;case 36:this.$=new r.PartialNameNode(new r.IntegerNode(o[a],this._$));break;case 37:this.$=new r.DataNode(o[a],this._$);break;case 38:this.$=new r.IdNode(o[a],this._$);break;case 39:o[a-2].push({part:o[a],separator:o[a-1]}),this.$=o[a-2];break;case 40:this.$=[{part:o[a]}];break;case 43:this.$=[];break;case 44:o[a-1].push(o[a]);break;case 47:this.$=[o[a]];break;case 48:o[a-1].push(o[a])}},table:[{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}],defaultActions:{3:[2,2],16:[2,1],50:[2,42]},parseError:function(t){throw new Error(t)},parse:function(t){function e(){var t;return t=i.lexer.lex()||1,"number"!=typeof t&&(t=i.symbols_[t]||t),t}var i=this,n=[0],r=[null],s=[],o=this.table,a="",h=0,l=0,c=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var u=this.lexer.yylloc;s.push(u);var f=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var d,p,g,v,m,y,b,x,_,w={};;){if(g=n[n.length-1],this.defaultActions[g]?v=this.defaultActions[g]:((null===d||"undefined"==typeof d)&&(d=e()),v=o[g]&&o[g][d]),"undefined"==typeof v||!v.length||!v[0]){var C="";if(!c){_=[];for(y in o[g])this.terminals_[y]&&y>2&&_.push("'"+this.terminals_[y]+"'");C=this.lexer.showPosition?"Parse error on line "+(h+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[d]||d)+"'":"Parse error on line "+(h+1)+": Unexpected "+(1==d?"end of input":"'"+(this.terminals_[d]||d)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[d]||d,line:this.lexer.yylineno,loc:u,expected:_})}}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+g+", token: "+d);switch(v[0]){case 1:n.push(d),r.push(this.lexer.yytext),s.push(this.lexer.yylloc),n.push(v[1]),d=null,p?(d=p,p=null):(l=this.lexer.yyleng,a=this.lexer.yytext,h=this.lexer.yylineno,u=this.lexer.yylloc,c>0&&c--);break;case 2:if(b=this.productions_[v[1]][1],w.$=r[r.length-b],w._$={first_line:s[s.length-(b||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(b||1)].first_column,last_column:s[s.length-1].last_column},f&&(w._$.range=[s[s.length-(b||1)].range[0],s[s.length-1].range[1]]),m=this.performAction.call(w,a,l,h,this.yy,v[1],r,s),"undefined"!=typeof m)return m;b&&(n=n.slice(0,-1*b*2),r=r.slice(0,-1*b),s=s.slice(0,-1*b)),n.push(this.productions_[v[1]][0]),r.push(w.$),s.push(w._$),x=o[n[n.length-2]][n[n.length-1]],n.push(x);break;case 3:return!0}}return!0}},n=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===n.length?this.yylloc.first_column:0)+n[n.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,i,n,r;this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),o=0;o<s.length&&(i=this._input.match(this.rules[s[o]]),!i||e&&!(i[0].length>e[0].length)||(e=i,n=o,this.options.flex));o++);return e?(r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,s[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t?t:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return"undefined"!=typeof t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return t.options={},t.performAction=function(t,e,i){function n(t,i){return e.yytext=e.yytext.substr(t,e.yyleng-i)}switch(i){case 0:if("\\\\"===e.yytext.slice(-2)?(n(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(n(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 14;break;case 1:return 14;case 2:return this.popState(),14;case 3:return n(0,4),this.popState(),15;case 4:return 35;case 5:return 36;case 6:return 25;case 7:return 16;case 8:return 20;case 9:return 19;case 10:return 19;case 11:return 23;case 12:return 22;case 13:this.popState(),this.begin("com");break;case 14:return n(3,5),this.popState(),15;case 15:return 22;case 16:return 41;case 17:return 40;case 18:return 40;case 19:return 44;case 20:break;case 21:return this.popState(),24;case 22:return this.popState(),18;case 23:return e.yytext=n(1,2).replace(/\\"/g,'"'),32;case 24:return e.yytext=n(1,2).replace(/\\'/g,"'"),32;case 25:return 42;case 26:return 34;case 27:return 34;case 28:return 33;case 29:return 40;case 30:return e.yytext=n(1,2),40;case 31:return"INVALID";case 32:return 5}},t.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],t.conditions={mu:{rules:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[3],inclusive:!1},INITIAL:{rules:[0,1,32],inclusive:!0}},t}();return i.lexer=n,e.prototype=i,i.Parser=e,new e}();return t=e}(),h=function(t,e){"use strict";function i(t){return t.constructor===s.ProgramNode?t:(r.yy=s,r.parse(t))}var n={},r=t,s=e;return n.parser=r,n.parse=i,n}(a,o),l=function(t){"use strict";function e(){}function i(t,e,i){if(null==t||"string"!=typeof t&&t.constructor!==i.AST.ProgramNode)throw new s("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);e=e||{},"data"in e||(e.data=!0);var n=i.parse(t),r=(new i.Compiler).compile(n,e);return(new i.JavaScriptCompiler).compile(r,e)}function n(t,e,i){function n(){var n=i.parse(t),r=(new i.Compiler).compile(n,e),s=(new i.JavaScriptCompiler).compile(r,e,void 0,!0);return i.template(s)}if(null==t||"string"!=typeof t&&t.constructor!==i.AST.ProgramNode)throw new s("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);e=e||{},"data"in e||(e.data=!0);var r;return function(t,e){return r||(r=n()),r.call(this,t,e)}}var r={},s=t;return r.Compiler=e,e.prototype={compiler:e,disassemble:function(){for(var t,e,i,n=this.opcodes,r=[],s=0,o=n.length;o>s;s++)if(t=n[s],"DECLARE"===t.opcode)r.push("DECLARE "+t.name+"="+t.value);else{e=[];for(var a=0;a<t.args.length;a++)i=t.args[a],"string"==typeof i&&(i='"'+i.replace("\n","\\n")+'"'),e.push(i);r.push(t.opcode+" "+e.join(" "))}return r.join("\n")},equals:function(t){var e=this.opcodes.length;if(t.opcodes.length!==e)return!1;for(var i=0;e>i;i++){var n=this.opcodes[i],r=t.opcodes[i];if(n.opcode!==r.opcode||n.args.length!==r.args.length)return!1;for(var s=0;s<n.args.length;s++)if(n.args[s]!==r.args[s])return!1}if(e=this.children.length,t.children.length!==e)return!1;for(i=0;e>i;i++)if(!this.children[i].equals(t.children[i]))return!1;return!0},guid:0,compile:function(t,e){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=e;var i=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0},i)for(var n in i)this.options.knownHelpers[n]=i[n];return this.accept(t)},accept:function(t){var e,i=t.strip||{};return i.left&&this.opcode("strip"),e=this[t.type](t),i.right&&this.opcode("strip"),e},program:function(t){for(var e=t.statements,i=0,n=e.length;n>i;i++)this.accept(e[i]);return this.isSimple=1===n,this.depths.list=this.depths.list.sort(function(t,e){return t-e}),this},compileProgram:function(t){var e,i=(new this.compiler).compile(t,this.options),n=this.guid++;this.usePartial=this.usePartial||i.usePartial,this.children[n]=i;for(var r=0,s=i.depths.list.length;s>r;r++)e=i.depths.list[r],2>e||this.addDepth(e-1);return n},block:function(t){var e=t.mustache,i=t.program,n=t.inverse;i&&(i=this.compileProgram(i)),n&&(n=this.compileProgram(n));var r=e.sexpr,s=this.classifySexpr(r);"helper"===s?this.helperSexpr(r,i,n):"simple"===s?(this.simpleSexpr(r),this.opcode("pushProgram",i),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousSexpr(r,i,n),this.opcode("pushProgram",i),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(t){var e,i,n=t.pairs;this.opcode("pushHash");for(var r=0,s=n.length;s>r;r++)e=n[r],i=e[1],this.options.stringParams?(i.depth&&this.addDepth(i.depth),this.opcode("getContext",i.depth||0),this.opcode("pushStringParam",i.stringModeValue,i.type),"sexpr"===i.type&&this.sexpr(i)):this.accept(i),this.opcode("assignToHash",e[0]);this.opcode("popHash")},partial:function(t){var e=t.partialName;this.usePartial=!0,t.context?this.ID(t.context):this.opcode("push","depth0"),this.opcode("invokePartial",e.name),this.opcode("append")},content:function(t){this.opcode("appendContent",t.string)},mustache:function(t){this.sexpr(t.sexpr),this.opcode(t.escaped&&!this.options.noEscape?"appendEscaped":"append")},ambiguousSexpr:function(t,e,i){var n=t.id,r=n.parts[0],s=null!=e||null!=i;this.opcode("getContext",n.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),this.opcode("invokeAmbiguous",r,s)},simpleSexpr:function(t){var e=t.id;"DATA"===e.type?this.DATA(e):e.parts.length?this.ID(e):(this.addDepth(e.depth),this.opcode("getContext",e.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,i){var n=this.setupFullMustacheParams(t,e,i),r=t.id.parts[0];if(this.options.knownHelpers[r])this.opcode("invokeKnownHelper",n.length,r);else{if(this.options.knownHelpersOnly)throw new s("You specified knownHelpersOnly, but used the unknown helper "+r,t);this.opcode("invokeHelper",n.length,r,t.isRoot)}},sexpr:function(t){var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ID:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0];e?this.opcode("lookupOnContext",t.parts[0]):this.opcode("pushContext");for(var i=1,n=t.parts.length;n>i;i++)this.opcode("lookup",t.parts[i])},DATA:function(t){if(this.options.data=!0,t.id.isScoped||t.id.depth)throw new s("Scoped data references are not supported: "+t.original,t);this.opcode("lookupData");for(var e=t.id.parts,i=0,n=e.length;n>i;i++)this.opcode("lookup",e[i])},STRING:function(t){this.opcode("pushString",t.string)},INTEGER:function(t){this.opcode("pushLiteral",t.integer)},BOOLEAN:function(t){this.opcode("pushLiteral",t.bool)},comment:function(){},opcode:function(t){this.opcodes.push({opcode:t,args:[].slice.call(arguments,1)})},declare:function(t,e){this.opcodes.push({opcode:"DECLARE",name:t,value:e})},addDepth:function(t){0!==t&&(this.depths[t]||(this.depths[t]=!0,this.depths.list.push(t)))},classifySexpr:function(t){var e=t.isHelper,i=t.eligibleHelper,n=this.options;if(i&&!e){var r=t.id.parts[0];n.knownHelpers[r]?e=!0:n.knownHelpersOnly&&(i=!1)}return e?"helper":i?"ambiguous":"simple"},pushParams:function(t){for(var e,i=t.length;i--;)e=t[i],this.options.stringParams?(e.depth&&this.addDepth(e.depth),this.opcode("getContext",e.depth||0),this.opcode("pushStringParam",e.stringModeValue,e.type),"sexpr"===e.type&&this.sexpr(e)):this[e.type](e)},setupFullMustacheParams:function(t,e,i){var n=t.params;return this.pushParams(n),this.opcode("pushProgram",e),this.opcode("pushProgram",i),t.hash?this.hash(t.hash):this.opcode("emptyHash"),n}},r.precompile=i,r.compile=n,r}(i),c=function(t,e){"use strict";function i(t){this.value=t}function n(){}var r,s=t.COMPILER_REVISION,o=t.REVISION_CHANGES,a=t.log,h=e;n.prototype={nameLookup:function(t,e){var i,r;return 0===t.indexOf("depth")&&(i=!0),r=/^[0-9]+$/.test(e)?t+"["+e+"]":n.isValidJavaScriptVariableName(e)?t+"."+e:t+"['"+e+"']",i?"("+t+" && "+r+")":r},compilerInfo:function(){var t=s,e=o[t];return"this.compilerInfo = ["+t+",'"+e+"'];\n"},appendToBuffer:function(t){return this.environment.isSimple?"return "+t+";":{appendToBuffer:!0,content:t,toString:function(){return"buffer += "+t+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(t,e,i,n){this.environment=t,this.options=e||{},a("debug",this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!i,this.context=i||{programs:[],environments:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(t,e);var r,s=t.opcodes;this.i=0;for(var o=s.length;this.i<o;this.i++)r=s[this.i],"DECLARE"===r.opcode?this[r.name]=r.value:this[r.opcode].apply(this,r.args),r.opcode!==this.stripNext&&(this.stripNext=!1);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new h("Compile completed with content left on stack");return this.createFunctionContext(n)},preamble:function(){var t=[];if(this.isChild)t.push("");else{var e=this.namespace,i="helpers = this.merge(helpers, "+e+".helpers);";this.environment.usePartial&&(i=i+" partials = this.merge(partials, "+e+".partials);"),this.options.data&&(i+=" data = data || {};"),t.push(i)}t.push(this.environment.isSimple?"":", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=t},createFunctionContext:function(t){var e=this.stackVars.concat(this.registers.list);if(e.length>0&&(this.source[1]=this.source[1]+", "+e.join(", ")),!this.isChild)for(var i in this.context.aliases)this.context.aliases.hasOwnProperty(i)&&(this.source[1]=this.source[1]+", "+i+"="+this.context.aliases[i]);this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.pushSource("return buffer;");for(var n=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"],r=0,s=this.environment.depths.list.length;s>r;r++)n.push("depth"+this.environment.depths.list[r]);var o=this.mergeSource();if(this.isChild||(o=this.compilerInfo()+o),t)return n.push(o),Function.apply(this,n);var h="function "+(this.name||"")+"("+n.join(",")+") {\n "+o+"}";return a("debug",h+"\n\n"),h},mergeSource:function(){for(var t,e="",i=0,n=this.source.length;n>i;i++){var r=this.source[i];r.appendToBuffer?t=t?t+"\n + "+r.content:r.content:(t&&(e+="buffer += "+t+";\n ",t=void 0),e+=r+"\n ")}return e},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var t=["depth0"];this.setupParams(0,t),this.replaceStack(function(e){return t.splice(1,0,e),"blockHelperMissing.call("+t.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var t=["depth0"];this.setupParams(0,t);var e=this.topStack();t.splice(1,0,e),this.pushSource("if (!"+this.lastHelper+") { "+e+" = blockHelperMissing.call("+t.join(", ")+"); }")},appendContent:function(t){this.pendingContent&&(t=this.pendingContent+t),this.stripNext&&(t=t.replace(/^\s+/,"")),this.pendingContent=t},strip:function(){this.pendingContent&&(this.pendingContent=this.pendingContent.replace(/\s+$/,"")),this.stripNext="strip"},append:function(){this.flushInline();var t=this.popStack();this.pushSource("if("+t+" || "+t+" === 0) { "+this.appendToBuffer(t)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(t){this.lastContext!==t&&(this.lastContext=t)},lookupOnContext:function(t){this.push(this.nameLookup("depth"+this.lastContext,t,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(t){return"typeof "+t+" === functionType ? "+t+".apply(depth0) : "+t})},lookup:function(t){this.replaceStack(function(e){return e+" == null || "+e+" === false ? "+e+" : "+this.nameLookup(e,t,"context")})},lookupData:function(){this.pushStackLiteral("data")},pushStringParam:function(t,e){this.pushStackLiteral("depth"+this.lastContext),this.pushString(e),"sexpr"!==e&&("string"==typeof t?this.pushString(t):this.pushStackLiteral(t))},emptyHash:function(){this.pushStackLiteral("{}"),this.options.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[]}},popHash:function(){var t=this.hash;this.hash=this.hashes.pop(),this.options.stringParams&&(this.push("{"+t.contexts.join(",")+"}"),this.push("{"+t.types.join(",")+"}")),this.push("{\n "+t.values.join(",\n ")+"\n }")},pushString:function(t){this.pushStackLiteral(this.quotedString(t))},push:function(t){return this.inlineStack.push(t),t},pushLiteral:function(t){this.pushStackLiteral(t)},pushProgram:function(t){this.pushStackLiteral(null!=t?this.programExpression(t):null)},invokeHelper:function(t,e,i){this.context.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var n=this.lastHelper=this.setupHelper(t,e,!0),r=this.nameLookup("depth"+this.lastContext,e,"context"),s="helper = "+n.name+" || "+r;n.paramsInit&&(s+=","+n.paramsInit),this.push("("+s+",helper ? helper.call("+n.callParams+") : helperMissing.call("+n.helperMissingParams+"))"),i||this.flushInline()},invokeKnownHelper:function(t,e){var i=this.setupHelper(t,e);this.push(i.name+".call("+i.callParams+")")},invokeAmbiguous:function(t,e){this.context.aliases.functionType='"function"',this.useRegister("helper"),this.emptyHash();var i=this.setupHelper(0,t,e),n=this.lastHelper=this.nameLookup("helpers",t,"helper"),r=this.nameLookup("depth"+this.lastContext,t,"context"),s=this.nextStack();i.paramsInit&&this.pushSource(i.paramsInit),this.pushSource("if (helper = "+n+") { "+s+" = helper.call("+i.callParams+"); }"),this.pushSource("else { helper = "+r+"; "+s+" = typeof helper === functionType ? helper.call("+i.callParams+") : helper; }")},invokePartial:function(t){var e=[this.nameLookup("partials",t,"partial"),"'"+t+"'",this.popStack(),"helpers","partials"];this.options.data&&e.push("data"),this.context.aliases.self="this",this.push("self.invokePartial("+e.join(", ")+")")},assignToHash:function(t){var e,i,n=this.popStack();this.options.stringParams&&(i=this.popStack(),e=this.popStack());var r=this.hash;e&&r.contexts.push("'"+t+"': "+e),i&&r.types.push("'"+t+"': "+i),r.values.push("'"+t+"': ("+n+")")},compiler:n,compileChildren:function(t,e){for(var i,n,r=t.children,s=0,o=r.length;o>s;s++){i=r[s],n=new this.compiler;var a=this.matchExistingProgram(i);null==a?(this.context.programs.push(""),a=this.context.programs.length,i.index=a,i.name="program"+a,this.context.programs[a]=n.compile(i,e,this.context),this.context.environments[a]=i):(i.index=a,i.name="program"+a)}},matchExistingProgram:function(t){for(var e=0,i=this.context.environments.length;i>e;e++){var n=this.context.environments[e];if(n&&n.equals(t))return e}},programExpression:function(t){if(this.context.aliases.self="this",null==t)return"self.noop";for(var e,i=this.environment.children[t],n=i.depths.list,r=[i.index,i.name,"data"],s=0,o=n.length;o>s;s++)e=n[s],r.push(1===e?"depth0":"depth"+(e-1));return(0===n.length?"self.program(":"self.programWithDepth(")+r.join(", ")+")"},register:function(t,e){this.useRegister(t),this.pushSource(t+" = "+e+";")},useRegister:function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},pushStackLiteral:function(t){return this.push(new i(t))},pushSource:function(t){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),t&&this.source.push(t)},pushStack:function(t){this.flushInline();var e=this.incrStack();return t&&this.pushSource(e+" = "+t+";"),this.compileStack.push(e),e},replaceStack:function(t){var e,n,r,s="",o=this.isInline();if(o){var a=this.popStack(!0);if(a instanceof i)e=a.value,r=!0;else{n=!this.stackSlot;var h=n?this.incrStack():this.topStackName();s="("+this.push(h)+" = "+a+"),",e=this.topStack()}}else e=this.topStack();var l=t.call(this,e);return o?(r||this.popStack(),n&&this.stackSlot--,this.push("("+s+l+")")):(/^stack/.test(e)||(e=this.nextStack()),this.pushSource(e+" = ("+s+l+");")),e
|
|
},nextStack:function(){return this.pushStack()},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;if(t.length){this.inlineStack=[];for(var e=0,n=t.length;n>e;e++){var r=t[e];r instanceof i?this.compileStack.push(r):this.pushStack(r)}}},isInline:function(){return this.inlineStack.length},popStack:function(t){var e=this.isInline(),n=(e?this.inlineStack:this.compileStack).pop();if(!t&&n instanceof i)return n.value;if(!e){if(!this.stackSlot)throw new h("Invalid stack pop");this.stackSlot--}return n},topStack:function(t){var e=this.isInline()?this.inlineStack:this.compileStack,n=e[e.length-1];return!t&&n instanceof i?n.value:n},quotedString:function(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},setupHelper:function(t,e,i){var n=[],r=this.setupParams(t,n,i),s=this.nameLookup("helpers",e,"helper");return{params:n,paramsInit:r,name:s,callParams:["depth0"].concat(n).join(", "),helperMissingParams:i&&["depth0",this.quotedString(e)].concat(n).join(", ")}},setupOptions:function(t,e){var i,n,r,s=[],o=[],a=[];s.push("hash:"+this.popStack()),this.options.stringParams&&(s.push("hashTypes:"+this.popStack()),s.push("hashContexts:"+this.popStack())),n=this.popStack(),r=this.popStack(),(r||n)&&(r||(this.context.aliases.self="this",r="self.noop"),n||(this.context.aliases.self="this",n="self.noop"),s.push("inverse:"+n),s.push("fn:"+r));for(var h=0;t>h;h++)i=this.popStack(),e.push(i),this.options.stringParams&&(a.push(this.popStack()),o.push(this.popStack()));return this.options.stringParams&&(s.push("contexts:["+o.join(",")+"]"),s.push("types:["+a.join(",")+"]")),this.options.data&&s.push("data:data"),s},setupParams:function(t,e,i){var n="{"+this.setupOptions(t,e).join(",")+"}";return i?(this.useRegister("options"),e.push("options"),"options="+n):(e.push(n),"")}};for(var l="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),c=n.RESERVED_WORDS={},u=0,f=l.length;f>u;u++)c[l[u]]=!0;return n.isValidJavaScriptVariableName=function(t){return!n.RESERVED_WORDS[t]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(t)?!0:!1},r=n}(n,i),u=function(t,e,i,n,r){"use strict";var s,o=t,a=e,h=i.parser,l=i.parse,c=n.Compiler,u=n.compile,f=n.precompile,d=r,p=o.create,g=function(){var t=p();return t.compile=function(e,i){return u(e,i,t)},t.precompile=function(e,i){return f(e,i,t)},t.AST=a,t.Compiler=c,t.JavaScriptCompiler=d,t.Parser=h,t.parse=l,t};return o=g(),o.create=g,s=o}(s,o,h,l,c);return u}(),COMPILED=!1,goog=goog||{};if(goog.global=this,goog.global.CLOSURE_UNCOMPILED_DEFINES,goog.global.CLOSURE_DEFINES,goog.isDef=function(t){return void 0!==t},goog.exportPath_=function(t,e,i){var n=t.split("."),r=i||goog.global;n[0]in r||!r.execScript||r.execScript("var "+n[0]);for(var s;n.length&&(s=n.shift());)!n.length&&goog.isDef(e)?r[s]=e:r=r[s]?r[s]:r[s]={}},goog.define=function(t,e){var i=e;COMPILED||(goog.global.CLOSURE_UNCOMPILED_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES,t)?i=goog.global.CLOSURE_UNCOMPILED_DEFINES[t]:goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,t)&&(i=goog.global.CLOSURE_DEFINES[t])),goog.exportPath_(t,i)},goog.DEBUG=!0,goog.define("goog.LOCALE","en"),goog.define("goog.TRUSTED_SITE",!0),goog.define("goog.STRICT_MODE_COMPATIBLE",!1),goog.provide=function(t){if(!COMPILED){if(goog.isProvided_(t))throw Error('Namespace "'+t+'" already declared.');delete goog.implicitNamespaces_[t];for(var e=t;(e=e.substring(0,e.lastIndexOf(".")))&&!goog.getObjectByName(e);)goog.implicitNamespaces_[e]=!0}goog.exportPath_(t)},goog.module=function(t){if(!goog.isString(t)||!t)throw Error("Invalid module identifier");if(!goog.isInModuleLoader_())throw Error("Module "+t+" has been loaded incorrectly.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");if(goog.moduleLoaderState_.moduleName=t,!COMPILED){if(goog.isProvided_(t))throw Error('Namespace "'+t+'" already declared.');delete goog.implicitNamespaces_[t]}},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return null!=goog.moduleLoaderState_},goog.module.declareTestMethods=function(){if(!goog.isInModuleLoader_())throw new Error("goog.module.declareTestMethods must be called from within a goog.module");goog.moduleLoaderState_.declareTestMethods=!0},goog.setTestOnly=function(t){if(COMPILED&&!goog.DEBUG)throw t=t||"",Error("Importing test-only code into non-debug environment"+(t?": "+t:"."))},goog.forwardDeclare=function(){},COMPILED||(goog.isProvided_=function(t){return t in goog.loadedModules_||!goog.implicitNamespaces_[t]&&goog.isDefAndNotNull(goog.getObjectByName(t))},goog.implicitNamespaces_={"goog.module":!0}),goog.getObjectByName=function(t,e){for(var i,n=t.split("."),r=e||goog.global;i=n.shift();){if(!goog.isDefAndNotNull(r[i]))return null;r=r[i]}return r},goog.globalize=function(t,e){var i=e||goog.global;for(var n in t)i[n]=t[n]},goog.addDependency=function(t,e,i,n){if(goog.DEPENDENCIES_ENABLED){for(var r,s,o=t.replace(/\\/g,"/"),a=goog.dependencies_,h=0;r=e[h];h++)a.nameToPath[r]=o,a.pathIsModule[o]=!!n;for(var l=0;s=i[l];l++)o in a.requires||(a.requires[o]={}),a.requires[o][s]=!0}},goog.define("goog.ENABLE_DEBUG_LOADER",!0),goog.logToConsole_=function(t){goog.global.console&&goog.global.console.error(t)},goog.require=function(t){if(!COMPILED){if(goog.isProvided_(t))return goog.isInModuleLoader_()?t in goog.loadedModules_?goog.loadedModules_[t]:goog.getObjectByName(t):null;if(goog.ENABLE_DEBUG_LOADER){var e=goog.getPathFromDeps_(t);if(e)return goog.included_[e]=!0,goog.writeScripts_(),null}var i="goog.require could not find: "+t;throw goog.logToConsole_(i),Error(i)}},goog.basePath="",goog.global.CLOSURE_BASE_PATH,goog.global.CLOSURE_NO_DEPS,goog.global.CLOSURE_IMPORT_SCRIPT,goog.nullFunction=function(){},goog.identityFunction=function(t){return t},goog.abstractMethod=function(){throw Error("unimplemented abstract method")},goog.addSingletonGetter=function(t){t.getInstance=function(){return t.instance_?t.instance_:(goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=t),t.instance_=new t)}},goog.instantiatedSingletons_=[],goog.define("goog.LOAD_MODULE_USING_EVAL",!0),goog.loadedModules_={},goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER,goog.DEPENDENCIES_ENABLED&&(goog.included_={},goog.dependencies_={pathIsModule:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var t=goog.global.document;return"undefined"!=typeof t&&"write"in t},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)return void(goog.basePath=goog.global.CLOSURE_BASE_PATH);if(goog.inHtmlDocument_())for(var t=goog.global.document,e=t.getElementsByTagName("script"),i=e.length-1;i>=0;--i){var n=e[i].src,r=n.lastIndexOf("?"),s=-1==r?n.length:r;if("base.js"==n.substr(s-7,7))return void(goog.basePath=n.substr(0,s-7))}},goog.importScript_=function(t,e){var i=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;i(t,e)&&(goog.dependencies_.written[t]=!0)},goog.IS_OLD_IE_=goog.global.document&&goog.global.document.all&&!goog.global.atob,goog.importModule_=function(t){var e='goog.retrieveAndExecModule_("'+t+'");';goog.importScript_("",e)&&(goog.dependencies_.written[t]=!0)},goog.queuedModules_=[],goog.retrieveAndExecModule_=function(t){var e=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_,i=null,n=new goog.global.XMLHttpRequest;if(n.onload=function(){i=this.responseText},n.open("get",t,!1),n.send(),i=n.responseText,null==i)throw new Error("load of "+t+"failed");var r=goog.wrapModule_(t,i),s=goog.IS_OLD_IE_;s?goog.queuedModules_.push(r):e(t,r),goog.dependencies_.written[t]=!0},goog.wrapModule_=function(t,e){return goog.LOAD_MODULE_USING_EVAL&&goog.isDef(goog.global.JSON)?"goog.loadModule("+goog.global.JSON.stringify(e+"\n//# sourceURL="+t+"\n")+");":'goog.loadModule(function(exports) {"use strict";'+e+"\n;return exports});\n//# sourceURL="+t+"\n"},goog.loadQueuedModules_=function(){var t=goog.queuedModules_.length;if(t>0){var e=goog.queuedModules_;goog.queuedModules_=[];for(var i=0;t>i;i++){var n=e[i];goog.globalEval(n)}}},goog.loadModule=function(t){try{goog.moduleLoaderState_={moduleName:void 0,declareTestMethods:!1};var e;if(goog.isFunction(t))e=t.call(goog.global,{});else{if(!goog.isString(t))throw Error("Invalid module definition");e=goog.loadModuleFromSource_.call(goog.global,t)}Object.seal&&Object.seal(e);var i=goog.moduleLoaderState_.moduleName;if(!goog.isString(i)||!i)throw Error('Invalid module name "'+i+'"');if(goog.loadedModules_[i]=e,goog.moduleLoaderState_.declareTestMethods)for(var n in e)(0===n.indexOf("test",0)||"tearDown"==n||"setup"==n)&&(goog.global[n]=e[n])}finally{goog.moduleLoaderState_=null}},goog.loadModuleFromSource_=function(){"use strict";var exports={};return eval(arguments[0]),exports},goog.writeScriptTag_=function(t,e){if(goog.inHtmlDocument_()){var i=goog.global.document;if("complete"==i.readyState){var n=/\bdeps.js$/.test(t);if(n)return!1;throw Error('Cannot write "'+t+'" after document load')}var r=goog.IS_OLD_IE_;if(void 0===e)if(r){var s=" onreadystatechange='goog.onScriptLoad_(this, "+ ++goog.lastNonModuleScriptIndex_+")' ";i.write('<script type="text/javascript" src="'+t+'"'+s+"></script>")}else i.write('<script type="text/javascript" src="'+t+'"></script>');else i.write('<script type="text/javascript">'+e+"</script>");return!0}return!1},goog.lastNonModuleScriptIndex_=0,goog.onScriptLoad_=function(t,e){return"complete"==t.readyState&&goog.lastNonModuleScriptIndex_==e&&goog.loadQueuedModules_(),!0},goog.writeScripts_=function(){function t(r){if(!(r in n.written)){if(r in n.visited)return void(r in i||(i[r]=!0,e.push(r)));if(n.visited[r]=!0,r in n.requires)for(var s in n.requires[r])if(!goog.isProvided_(s)){if(!(s in n.nameToPath))throw Error("Undefined nameToPath for "+s);t(n.nameToPath[s])}r in i||(i[r]=!0,e.push(r))}}var e=[],i={},n=goog.dependencies_;for(var r in goog.included_)n.written[r]||t(r);for(var s=0;s<e.length;s++){var r=e[s];goog.dependencies_.written[r]=!0}var o=goog.moduleLoaderState_;goog.moduleLoaderState_=null;for(var a=!1,s=0;s<e.length;s++){var r=e[s];if(!r)throw goog.moduleLoaderState_=o,Error("Undefined script input");n.pathIsModule[r]?(a=!0,goog.importModule_(goog.basePath+r)):goog.importScript_(goog.basePath+r)}goog.moduleLoaderState_=o},goog.getPathFromDeps_=function(t){return t in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[t]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js")),goog.typeOf=function(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var i=Object.prototype.toString.call(t);if("[object Window]"==i)return"object";if("[object Array]"==i||"number"==typeof t.length&&"undefined"!=typeof t.splice&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==i||"undefined"!=typeof t.call&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&"undefined"==typeof t.call)return"object";return e},goog.isNull=function(t){return null===t},goog.isDefAndNotNull=function(t){return null!=t},goog.isArray=function(t){return"array"==goog.typeOf(t)},goog.isArrayLike=function(t){var e=goog.typeOf(t);return"array"==e||"object"==e&&"number"==typeof t.length},goog.isDateLike=function(t){return goog.isObject(t)&&"function"==typeof t.getFullYear},goog.isString=function(t){return"string"==typeof t},goog.isBoolean=function(t){return"boolean"==typeof t},goog.isNumber=function(t){return"number"==typeof t},goog.isFunction=function(t){return"function"==goog.typeOf(t)},goog.isObject=function(t){var e=typeof t;return"object"==e&&null!=t||"function"==e},goog.getUid=function(t){return t[goog.UID_PROPERTY_]||(t[goog.UID_PROPERTY_]=++goog.uidCounter_)},goog.hasUid=function(t){return!!t[goog.UID_PROPERTY_]},goog.removeUid=function(t){"removeAttribute"in t&&t.removeAttribute(goog.UID_PROPERTY_);try{delete t[goog.UID_PROPERTY_]}catch(e){}},goog.UID_PROPERTY_="closure_uid_"+(1e9*Math.random()>>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(t){var e=goog.typeOf(t);if("object"==e||"array"==e){if(t.clone)return t.clone();var i="array"==e?[]:{};for(var n in t)i[n]=goog.cloneObject(t[n]);return i}return t},goog.bindNative_=function(t){return t.call.apply(t.bind,arguments)},goog.bindJs_=function(t,e){if(!t)throw new Error;if(arguments.length>2){var i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),t.apply(e,n)}}return function(){return t.apply(e,arguments)}},goog.bind=function(){return goog.bind=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bindNative_:goog.bindJs_,goog.bind.apply(null,arguments)},goog.partial=function(t){var e=Array.prototype.slice.call(arguments,1);return function(){var i=e.slice();return i.push.apply(i,arguments),t.apply(this,i)}},goog.mixin=function(t,e){for(var i in e)t[i]=e[i]},goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date},goog.globalEval=function(t){if(goog.global.execScript)goog.global.execScript(t,"JavaScript");else{if(!goog.global.eval)throw Error("goog.globalEval not available");if(null==goog.evalWorksForGlobals_&&(goog.global.eval("var _et_ = 1;"),"undefined"!=typeof goog.global._et_?(delete goog.global._et_,goog.evalWorksForGlobals_=!0):goog.evalWorksForGlobals_=!1),goog.evalWorksForGlobals_)goog.global.eval(t);else{var e=goog.global.document,i=e.createElement("script");i.type="text/javascript",i.defer=!1,i.appendChild(e.createTextNode(t)),e.body.appendChild(i),e.body.removeChild(i)}}},goog.evalWorksForGlobals_=null,goog.cssNameMapping_,goog.cssNameMappingStyle_,goog.getCssName=function(t,e){var i,n=function(t){return goog.cssNameMapping_[t]||t},r=function(t){for(var e=t.split("-"),i=[],r=0;r<e.length;r++)i.push(n(e[r]));return i.join("-")};return i=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?n:r:function(t){return t},e?t+"-"+i(e):i(t)},goog.setCssNameMapping=function(t,e){goog.cssNameMapping_=t,goog.cssNameMappingStyle_=e},goog.global.CLOSURE_CSS_NAME_MAPPING,!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING),goog.getMsg=function(t,e){return e&&(t=t.replace(/\{\$([^}]+)}/g,function(t,i){return i in e?e[i]:t})),t},goog.getMsgWithFallback=function(t){return t},goog.exportSymbol=function(t,e,i){goog.exportPath_(t,e,i)},goog.exportProperty=function(t,e,i){t[e]=i},goog.inherits=function(t,e){function i(){}i.prototype=e.prototype,t.superClass_=e.prototype,t.prototype=new i,t.prototype.constructor=t,t.base=function(t,i){var n=Array.prototype.slice.call(arguments,2);return e.prototype[i].apply(t,n)}},goog.base=function(t,e){var i=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||goog.DEBUG&&!i)throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(i.superClass_)return i.superClass_.constructor.apply(t,Array.prototype.slice.call(arguments,1));for(var n=Array.prototype.slice.call(arguments,2),r=!1,s=t.constructor;s;s=s.superClass_&&s.superClass_.constructor)if(s.prototype[e]===i)r=!0;else if(r)return s.prototype[e].apply(t,n);if(t[e]===i)return t.constructor.prototype[e].apply(t,n);throw Error("goog.base called from a method of one name to a method of a different name")},goog.scope=function(t){t.call(goog.global)},COMPILED||(goog.global.COMPILED=COMPILED),goog.defineClass=function(t,e){var i=e.constructor,n=e.statics;i&&i!=Object.prototype.constructor||(i=function(){throw Error("cannot instantiate an interface (no constructor defined).")});var r=goog.defineClass.createSealingConstructor_(i,t);return t&&goog.inherits(r,t),delete e.constructor,delete e.statics,goog.defineClass.applyProperties_(r.prototype,e),null!=n&&(n instanceof Function?n(r):goog.defineClass.applyProperties_(r,n)),r},goog.defineClass.ClassDescriptor,goog.define("goog.defineClass.SEAL_CLASS_INSTANCES",goog.DEBUG),goog.defineClass.createSealingConstructor_=function(t,e){if(goog.defineClass.SEAL_CLASS_INSTANCES&&Object.seal instanceof Function){if(e&&e.prototype&&e.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_])return t;var i=function(){var e=t.apply(this,arguments)||this;return e[goog.UID_PROPERTY_]=e[goog.UID_PROPERTY_],this.constructor===i&&Object.seal(e),e};return i}return t},goog.defineClass.OBJECT_PROTOTYPE_FIELDS_=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],goog.defineClass.applyProperties_=function(t,e){var i;for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);for(var n=0;n<goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;n++)i=goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[n],Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},goog.tagUnsealableClass=function(t){!COMPILED&&goog.defineClass.SEAL_CLASS_INSTANCES&&(t.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]=!0)},goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_="goog_defineClass_legacy_unsealable",!function(t,e){"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,function(t,e){function i(t){var e=t.length,i=Z.type(t);return"function"===i||Z.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===i||0===e||"number"==typeof e&&e>0&&e-1 in t}function n(t,e,i){if(Z.isFunction(e))return Z.grep(t,function(t,n){return!!e.call(t,n,t)!==i});if(e.nodeType)return Z.grep(t,function(t){return t===e!==i});if("string"==typeof e){if(ae.test(e))return Z.filter(e,t,i);e=Z.filter(e,t)}return Z.grep(t,function(t){return V.call(e,t)>=0!==i})}function r(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function s(t){var e=pe[t]={};return Z.each(t.match(de)||[],function(t,i){e[i]=!0}),e}function o(){J.removeEventListener("DOMContentLoaded",o,!1),t.removeEventListener("load",o,!1),Z.ready()}function a(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=Z.expando+Math.random()}function h(t,e,i){var n;if(void 0===i&&1===t.nodeType)if(n="data-"+e.replace(xe,"-$1").toLowerCase(),i=t.getAttribute(n),"string"==typeof i){try{i="true"===i?!0:"false"===i?!1:"null"===i?null:+i+""===i?+i:be.test(i)?Z.parseJSON(i):i}catch(r){}ye.set(t,e,i)}else i=void 0;return i}function l(){return!0}function c(){return!1}function u(){try{return J.activeElement}catch(t){}}function f(t,e){return Z.nodeName(t,"table")&&Z.nodeName(11!==e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}function d(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function p(t){var e=Ne.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function g(t,e){for(var i=0,n=t.length;n>i;i++)me.set(t[i],"globalEval",!e||me.get(e[i],"globalEval"))}function v(t,e){var i,n,r,s,o,a,h,l;if(1===e.nodeType){if(me.hasData(t)&&(s=me.access(t),o=me.set(e,s),l=s.events)){delete o.handle,o.events={};for(r in l)for(i=0,n=l[r].length;n>i;i++)Z.event.add(e,r,l[r][i])}ye.hasData(t)&&(a=ye.access(t),h=Z.extend({},a),ye.set(e,h))}}function m(t,e){var i=t.getElementsByTagName?t.getElementsByTagName(e||"*"):t.querySelectorAll?t.querySelectorAll(e||"*"):[];return void 0===e||e&&Z.nodeName(t,e)?Z.merge([t],i):i}function y(t,e){var i=e.nodeName.toLowerCase();"input"===i&&Se.test(t.type)?e.checked=t.checked:("input"===i||"textarea"===i)&&(e.defaultValue=t.defaultValue)}function b(e,i){var n,r=Z(i.createElement(e)).appendTo(i.body),s=t.getDefaultComputedStyle&&(n=t.getDefaultComputedStyle(r[0]))?n.display:Z.css(r[0],"display");return r.detach(),s}function x(t){var e=J,i=Be[t];return i||(i=b(t,e),"none"!==i&&i||(Fe=(Fe||Z("<iframe frameborder='0' width='0' height='0'/>")).appendTo(e.documentElement),e=Fe[0].contentDocument,e.write(),e.close(),i=b(t,e),Fe.detach()),Be[t]=i),i}function _(t,e,i){var n,r,s,o,a=t.style;return i=i||Ge(t),i&&(o=i.getPropertyValue(e)||i[e]),i&&(""!==o||Z.contains(t.ownerDocument,t)||(o=Z.style(t,e)),We.test(o)&&He.test(e)&&(n=a.width,r=a.minWidth,s=a.maxWidth,a.minWidth=a.maxWidth=a.width=o,o=i.width,a.width=n,a.minWidth=r,a.maxWidth=s)),void 0!==o?o+"":o}function w(t,e){return{get:function(){return t()?void delete this.get:(this.get=e).apply(this,arguments)}}}function C(t,e){if(e in t)return e;for(var i=e[0].toUpperCase()+e.slice(1),n=e,r=Ye.length;r--;)if(e=Ye[r]+i,e in t)return e;return n}function S(t,e,i){var n=Ue.exec(e);return n?Math.max(0,n[1]-(i||0))+(n[2]||"px"):e}function T(t,e,i,n,r){for(var s=i===(n?"border":"content")?4:"width"===e?1:0,o=0;4>s;s+=2)"margin"===i&&(o+=Z.css(t,i+we[s],!0,r)),n?("content"===i&&(o-=Z.css(t,"padding"+we[s],!0,r)),"margin"!==i&&(o-=Z.css(t,"border"+we[s]+"Width",!0,r))):(o+=Z.css(t,"padding"+we[s],!0,r),"padding"!==i&&(o+=Z.css(t,"border"+we[s]+"Width",!0,r)));return o}function k(t,e,i){var n=!0,r="width"===e?t.offsetWidth:t.offsetHeight,s=Ge(t),o="border-box"===Z.css(t,"boxSizing",!1,s);if(0>=r||null==r){if(r=_(t,e,s),(0>r||null==r)&&(r=t.style[e]),We.test(r))return r;n=o&&(K.boxSizingReliable()||r===t.style[e]),r=parseFloat(r)||0}return r+T(t,e,i||(o?"border":"content"),n,s)+"px"}function O(t,e){for(var i,n,r,s=[],o=0,a=t.length;a>o;o++)n=t[o],n.style&&(s[o]=me.get(n,"olddisplay"),i=n.style.display,e?(s[o]||"none"!==i||(n.style.display=""),""===n.style.display&&Ce(n)&&(s[o]=me.access(n,"olddisplay",x(n.nodeName)))):(r=Ce(n),"none"===i&&r||me.set(n,"olddisplay",r?i:Z.css(n,"display"))));for(o=0;a>o;o++)n=t[o],n.style&&(e&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=e?s[o]||"":"none"));return t}function E(t,e,i,n,r){return new E.prototype.init(t,e,i,n,r)}function A(){return setTimeout(function(){Ke=void 0}),Ke=Z.now()}function P(t,e){var i,n=0,r={height:t};for(e=e?1:0;4>n;n+=2-e)i=we[n],r["margin"+i]=r["padding"+i]=t;return e&&(r.opacity=r.width=t),r}function j(t,e,i){for(var n,r=(ii[e]||[]).concat(ii["*"]),s=0,o=r.length;o>s;s++)if(n=r[s].call(i,e,t))return n}function D(t,e,i){var n,r,s,o,a,h,l,c,u=this,f={},d=t.style,p=t.nodeType&&Ce(t),g=me.get(t,"fxshow");i.queue||(a=Z._queueHooks(t,"fx"),null==a.unqueued&&(a.unqueued=0,h=a.empty.fire,a.empty.fire=function(){a.unqueued||h()}),a.unqueued++,u.always(function(){u.always(function(){a.unqueued--,Z.queue(t,"fx").length||a.empty.fire()})})),1===t.nodeType&&("height"in e||"width"in e)&&(i.overflow=[d.overflow,d.overflowX,d.overflowY],l=Z.css(t,"display"),c="none"===l?me.get(t,"olddisplay")||x(t.nodeName):l,"inline"===c&&"none"===Z.css(t,"float")&&(d.display="inline-block")),i.overflow&&(d.overflow="hidden",u.always(function(){d.overflow=i.overflow[0],d.overflowX=i.overflow[1],d.overflowY=i.overflow[2]}));for(n in e)if(r=e[n],Qe.exec(r)){if(delete e[n],s=s||"toggle"===r,r===(p?"hide":"show")){if("show"!==r||!g||void 0===g[n])continue;p=!0}f[n]=g&&g[n]||Z.style(t,n)}else l=void 0;if(Z.isEmptyObject(f))"inline"===("none"===l?x(t.nodeName):l)&&(d.display=l);else{g?"hidden"in g&&(p=g.hidden):g=me.access(t,"fxshow",{}),s&&(g.hidden=!p),p?Z(t).show():u.done(function(){Z(t).hide()}),u.done(function(){var e;me.remove(t,"fxshow");for(e in f)Z.style(t,e,f[e])});for(n in f)o=j(p?g[n]:0,n,u),n in g||(g[n]=o.start,p&&(o.end=o.start,o.start="width"===n||"height"===n?1:0))}}function L(t,e){var i,n,r,s,o;for(i in t)if(n=Z.camelCase(i),r=e[n],s=t[i],Z.isArray(s)&&(r=s[1],s=t[i]=s[0]),i!==n&&(t[n]=s,delete t[i]),o=Z.cssHooks[n],o&&"expand"in o){s=o.expand(s),delete t[n];for(i in s)i in t||(t[i]=s[i],e[i]=r)}else e[n]=r}function I(t,e,i){var n,r,s=0,o=ei.length,a=Z.Deferred().always(function(){delete h.elem}),h=function(){if(r)return!1;for(var e=Ke||A(),i=Math.max(0,l.startTime+l.duration-e),n=i/l.duration||0,s=1-n,o=0,h=l.tweens.length;h>o;o++)l.tweens[o].run(s);return a.notifyWith(t,[l,s,i]),1>s&&h?i:(a.resolveWith(t,[l]),!1)},l=a.promise({elem:t,props:Z.extend({},e),opts:Z.extend(!0,{specialEasing:{}},i),originalProperties:e,originalOptions:i,startTime:Ke||A(),duration:i.duration,tweens:[],createTween:function(e,i){var n=Z.Tween(t,l.opts,e,i,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var i=0,n=e?l.tweens.length:0;if(r)return this;for(r=!0;n>i;i++)l.tweens[i].run(1);return e?a.resolveWith(t,[l,e]):a.rejectWith(t,[l,e]),this}}),c=l.props;for(L(c,l.opts.specialEasing);o>s;s++)if(n=ei[s].call(l,t,c,l.opts))return n;return Z.map(c,j,l),Z.isFunction(l.opts.start)&&l.opts.start.call(t,l),Z.fx.timer(Z.extend(h,{elem:t,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function M(t){return function(e,i){"string"!=typeof e&&(i=e,e="*");var n,r=0,s=e.toLowerCase().match(de)||[];if(Z.isFunction(i))for(;n=s[r++];)"+"===n[0]?(n=n.slice(1)||"*",(t[n]=t[n]||[]).unshift(i)):(t[n]=t[n]||[]).push(i)}}function N(t,e,i,n){function r(a){var h;return s[a]=!0,Z.each(t[a]||[],function(t,a){var l=a(e,i,n);return"string"!=typeof l||o||s[l]?o?!(h=l):void 0:(e.dataTypes.unshift(l),r(l),!1)}),h}var s={},o=t===_i;return r(e.dataTypes[0])||!s["*"]&&r("*")}function R(t,e){var i,n,r=Z.ajaxSettings.flatOptions||{};for(i in e)void 0!==e[i]&&((r[i]?t:n||(n={}))[i]=e[i]);return n&&Z.extend(!0,t,n),t}function $(t,e,i){for(var n,r,s,o,a=t.contents,h=t.dataTypes;"*"===h[0];)h.shift(),void 0===n&&(n=t.mimeType||e.getResponseHeader("Content-Type"));if(n)for(r in a)if(a[r]&&a[r].test(n)){h.unshift(r);break}if(h[0]in i)s=h[0];else{for(r in i){if(!h[0]||t.converters[r+" "+h[0]]){s=r;break}o||(o=r)}s=s||o}return s?(s!==h[0]&&h.unshift(s),i[s]):void 0}function F(t,e,i,n){var r,s,o,a,h,l={},c=t.dataTypes.slice();if(c[1])for(o in t.converters)l[o.toLowerCase()]=t.converters[o];for(s=c.shift();s;)if(t.responseFields[s]&&(i[t.responseFields[s]]=e),!h&&n&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),h=s,s=c.shift())if("*"===s)s=h;else if("*"!==h&&h!==s){if(o=l[h+" "+s]||l["* "+s],!o)for(r in l)if(a=r.split(" "),a[1]===s&&(o=l[h+" "+a[0]]||l["* "+a[0]])){o===!0?o=l[r]:l[r]!==!0&&(s=a[0],c.unshift(a[1]));break}if(o!==!0)if(o&&t["throws"])e=o(e);else try{e=o(e)}catch(u){return{state:"parsererror",error:o?u:"No conversion from "+h+" to "+s}}}return{state:"success",data:e}}function B(t,e,i,n){var r;if(Z.isArray(e))Z.each(e,function(e,r){i||Ti.test(t)?n(t,r):B(t+"["+("object"==typeof r?e:"")+"]",r,i,n)});else if(i||"object"!==Z.type(e))n(t,e);else for(r in e)B(t+"["+r+"]",e[r],i,n)}function H(t){return Z.isWindow(t)?t:9===t.nodeType&&t.defaultView}var W=[],G=W.slice,X=W.concat,U=W.push,V=W.indexOf,z={},q=z.toString,Y=z.hasOwnProperty,K={},J=t.document,Q="2.1.1",Z=function(t,e){return new Z.fn.init(t,e)},te=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ee=/^-ms-/,ie=/-([\da-z])/gi,ne=function(t,e){return e.toUpperCase()};Z.fn=Z.prototype={jquery:Q,constructor:Z,selector:"",length:0,toArray:function(){return G.call(this)},get:function(t){return null!=t?0>t?this[t+this.length]:this[t]:G.call(this)},pushStack:function(t){var e=Z.merge(this.constructor(),t);return e.prevObject=this,e.context=this.context,e},each:function(t,e){return Z.each(this,t,e)},map:function(t){return this.pushStack(Z.map(this,function(e,i){return t.call(e,i,e)}))},slice:function(){return this.pushStack(G.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,i=+t+(0>t?e:0);return this.pushStack(i>=0&&e>i?[this[i]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:U,sort:W.sort,splice:W.splice},Z.extend=Z.fn.extend=function(){var t,e,i,n,r,s,o=arguments[0]||{},a=1,h=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[a]||{},a++),"object"==typeof o||Z.isFunction(o)||(o={}),a===h&&(o=this,a--);h>a;a++)if(null!=(t=arguments[a]))for(e in t)i=o[e],n=t[e],o!==n&&(l&&n&&(Z.isPlainObject(n)||(r=Z.isArray(n)))?(r?(r=!1,s=i&&Z.isArray(i)?i:[]):s=i&&Z.isPlainObject(i)?i:{},o[e]=Z.extend(l,s,n)):void 0!==n&&(o[e]=n));return o},Z.extend({expando:"jQuery"+(Q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isFunction:function(t){return"function"===Z.type(t)},isArray:Array.isArray,isWindow:function(t){return null!=t&&t===t.window},isNumeric:function(t){return!Z.isArray(t)&&t-parseFloat(t)>=0},isPlainObject:function(t){return"object"!==Z.type(t)||t.nodeType||Z.isWindow(t)?!1:t.constructor&&!Y.call(t.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},type:function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?z[q.call(t)]||"object":typeof t},globalEval:function(t){var e,i=eval;t=Z.trim(t),t&&(1===t.indexOf("use strict")?(e=J.createElement("script"),e.text=t,J.head.appendChild(e).parentNode.removeChild(e)):i(t))},camelCase:function(t){return t.replace(ee,"ms-").replace(ie,ne)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e,n){var r,s=0,o=t.length,a=i(t);if(n){if(a)for(;o>s&&(r=e.apply(t[s],n),r!==!1);s++);else for(s in t)if(r=e.apply(t[s],n),r===!1)break}else if(a)for(;o>s&&(r=e.call(t[s],s,t[s]),r!==!1);s++);else for(s in t)if(r=e.call(t[s],s,t[s]),r===!1)break;return t},trim:function(t){return null==t?"":(t+"").replace(te,"")},makeArray:function(t,e){var n=e||[];return null!=t&&(i(Object(t))?Z.merge(n,"string"==typeof t?[t]:t):U.call(n,t)),n},inArray:function(t,e,i){return null==e?-1:V.call(e,t,i)},merge:function(t,e){for(var i=+e.length,n=0,r=t.length;i>n;n++)t[r++]=e[n];return t.length=r,t},grep:function(t,e,i){for(var n,r=[],s=0,o=t.length,a=!i;o>s;s++)n=!e(t[s],s),n!==a&&r.push(t[s]);return r},map:function(t,e,n){var r,s=0,o=t.length,a=i(t),h=[];if(a)for(;o>s;s++)r=e(t[s],s,n),null!=r&&h.push(r);else for(s in t)r=e(t[s],s,n),null!=r&&h.push(r);return X.apply([],h)},guid:1,proxy:function(t,e){var i,n,r;return"string"==typeof e&&(i=t[e],e=t,t=i),Z.isFunction(t)?(n=G.call(arguments,2),r=function(){return t.apply(e||this,n.concat(G.call(arguments)))},r.guid=t.guid=t.guid||Z.guid++,r):void 0},now:Date.now,support:K}),Z.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){z["[object "+e+"]"]=e.toLowerCase()});var re=function(t){function e(t,e,i,n){var r,s,o,a,h,l,u,d,p,g;if((e?e.ownerDocument||e:B)!==D&&j(e),e=e||D,i=i||[],!t||"string"!=typeof t)return i;if(1!==(a=e.nodeType)&&9!==a)return[];if(I&&!n){if(r=ye.exec(t))if(o=r[1]){if(9===a){if(s=e.getElementById(o),!s||!s.parentNode)return i;if(s.id===o)return i.push(s),i}else if(e.ownerDocument&&(s=e.ownerDocument.getElementById(o))&&$(e,s)&&s.id===o)return i.push(s),i}else{if(r[2])return Z.apply(i,e.getElementsByTagName(t)),i;if((o=r[3])&&_.getElementsByClassName&&e.getElementsByClassName)return Z.apply(i,e.getElementsByClassName(o)),i}if(_.qsa&&(!M||!M.test(t))){if(d=u=F,p=e,g=9===a&&t,1===a&&"object"!==e.nodeName.toLowerCase()){for(l=T(t),(u=e.getAttribute("id"))?d=u.replace(xe,"\\$&"):e.setAttribute("id",d),d="[id='"+d+"'] ",h=l.length;h--;)l[h]=d+f(l[h]);p=be.test(t)&&c(e.parentNode)||e,g=l.join(",")}if(g)try{return Z.apply(i,p.querySelectorAll(g)),i}catch(v){}finally{u||e.removeAttribute("id")
|
|
}}}return O(t.replace(he,"$1"),e,i,n)}function i(){function t(i,n){return e.push(i+" ")>w.cacheLength&&delete t[e.shift()],t[i+" "]=n}var e=[];return t}function n(t){return t[F]=!0,t}function r(t){var e=D.createElement("div");try{return!!t(e)}catch(i){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function s(t,e){for(var i=t.split("|"),n=t.length;n--;)w.attrHandle[i[n]]=e}function o(t,e){var i=e&&t,n=i&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||q)-(~t.sourceIndex||q);if(n)return n;if(i)for(;i=i.nextSibling;)if(i===e)return-1;return t?1:-1}function a(t){return function(e){var i=e.nodeName.toLowerCase();return"input"===i&&e.type===t}}function h(t){return function(e){var i=e.nodeName.toLowerCase();return("input"===i||"button"===i)&&e.type===t}}function l(t){return n(function(e){return e=+e,n(function(i,n){for(var r,s=t([],i.length,e),o=s.length;o--;)i[r=s[o]]&&(i[r]=!(n[r]=i[r]))})})}function c(t){return t&&typeof t.getElementsByTagName!==z&&t}function u(){}function f(t){for(var e=0,i=t.length,n="";i>e;e++)n+=t[e].value;return n}function d(t,e,i){var n=e.dir,r=i&&"parentNode"===n,s=W++;return e.first?function(e,i,s){for(;e=e[n];)if(1===e.nodeType||r)return t(e,i,s)}:function(e,i,o){var a,h,l=[H,s];if(o){for(;e=e[n];)if((1===e.nodeType||r)&&t(e,i,o))return!0}else for(;e=e[n];)if(1===e.nodeType||r){if(h=e[F]||(e[F]={}),(a=h[n])&&a[0]===H&&a[1]===s)return l[2]=a[2];if(h[n]=l,l[2]=t(e,i,o))return!0}}}function p(t){return t.length>1?function(e,i,n){for(var r=t.length;r--;)if(!t[r](e,i,n))return!1;return!0}:t[0]}function g(t,i,n){for(var r=0,s=i.length;s>r;r++)e(t,i[r],n);return n}function v(t,e,i,n,r){for(var s,o=[],a=0,h=t.length,l=null!=e;h>a;a++)(s=t[a])&&(!i||i(s,n,r))&&(o.push(s),l&&e.push(a));return o}function m(t,e,i,r,s,o){return r&&!r[F]&&(r=m(r)),s&&!s[F]&&(s=m(s,o)),n(function(n,o,a,h){var l,c,u,f=[],d=[],p=o.length,m=n||g(e||"*",a.nodeType?[a]:a,[]),y=!t||!n&&e?m:v(m,f,t,a,h),b=i?s||(n?t:p||r)?[]:o:y;if(i&&i(y,b,a,h),r)for(l=v(b,d),r(l,[],a,h),c=l.length;c--;)(u=l[c])&&(b[d[c]]=!(y[d[c]]=u));if(n){if(s||t){if(s){for(l=[],c=b.length;c--;)(u=b[c])&&l.push(y[c]=u);s(null,b=[],l,h)}for(c=b.length;c--;)(u=b[c])&&(l=s?ee.call(n,u):f[c])>-1&&(n[l]=!(o[l]=u))}}else b=v(b===o?b.splice(p,b.length):b),s?s(null,o,b,h):Z.apply(o,b)})}function y(t){for(var e,i,n,r=t.length,s=w.relative[t[0].type],o=s||w.relative[" "],a=s?1:0,h=d(function(t){return t===e},o,!0),l=d(function(t){return ee.call(e,t)>-1},o,!0),c=[function(t,i,n){return!s&&(n||i!==E)||((e=i).nodeType?h(t,i,n):l(t,i,n))}];r>a;a++)if(i=w.relative[t[a].type])c=[d(p(c),i)];else{if(i=w.filter[t[a].type].apply(null,t[a].matches),i[F]){for(n=++a;r>n&&!w.relative[t[n].type];n++);return m(a>1&&p(c),a>1&&f(t.slice(0,a-1).concat({value:" "===t[a-2].type?"*":""})).replace(he,"$1"),i,n>a&&y(t.slice(a,n)),r>n&&y(t=t.slice(n)),r>n&&f(t))}c.push(i)}return p(c)}function b(t,i){var r=i.length>0,s=t.length>0,o=function(n,o,a,h,l){var c,u,f,d=0,p="0",g=n&&[],m=[],y=E,b=n||s&&w.find.TAG("*",l),x=H+=null==y?1:Math.random()||.1,_=b.length;for(l&&(E=o!==D&&o);p!==_&&null!=(c=b[p]);p++){if(s&&c){for(u=0;f=t[u++];)if(f(c,o,a)){h.push(c);break}l&&(H=x)}r&&((c=!f&&c)&&d--,n&&g.push(c))}if(d+=p,r&&p!==d){for(u=0;f=i[u++];)f(g,m,o,a);if(n){if(d>0)for(;p--;)g[p]||m[p]||(m[p]=J.call(h));m=v(m)}Z.apply(h,m),l&&!n&&m.length>0&&d+i.length>1&&e.uniqueSort(h)}return l&&(H=x,E=y),g};return r?n(o):o}var x,_,w,C,S,T,k,O,E,A,P,j,D,L,I,M,N,R,$,F="sizzle"+-new Date,B=t.document,H=0,W=0,G=i(),X=i(),U=i(),V=function(t,e){return t===e&&(P=!0),0},z="undefined",q=1<<31,Y={}.hasOwnProperty,K=[],J=K.pop,Q=K.push,Z=K.push,te=K.slice,ee=K.indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(this[e]===t)return e;return-1},ie="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",se=re.replace("w","w#"),oe="\\["+ne+"*("+re+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+se+"))|)"+ne+"*\\]",ae=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+oe+")*)|.*)\\)|)",he=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),le=new RegExp("^"+ne+"*,"+ne+"*"),ce=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),ue=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(ae),de=new RegExp("^"+se+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re.replace("w","w*")+")"),ATTR:new RegExp("^"+oe),PSEUDO:new RegExp("^"+ae),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+ie+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},ge=/^(?:input|select|textarea|button)$/i,ve=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,be=/[+~]/,xe=/'|\\/g,_e=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(t,e,i){var n="0x"+e-65536;return n!==n||i?e:0>n?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320)};try{Z.apply(K=te.call(B.childNodes),B.childNodes),K[B.childNodes.length].nodeType}catch(Ce){Z={apply:K.length?function(t,e){Q.apply(t,te.call(e))}:function(t,e){for(var i=t.length,n=0;t[i++]=e[n++];);t.length=i-1}}}_=e.support={},S=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return e?"HTML"!==e.nodeName:!1},j=e.setDocument=function(t){var e,i=t?t.ownerDocument||t:B,n=i.defaultView;return i!==D&&9===i.nodeType&&i.documentElement?(D=i,L=i.documentElement,I=!S(i),n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",function(){j()},!1):n.attachEvent&&n.attachEvent("onunload",function(){j()})),_.attributes=r(function(t){return t.className="i",!t.getAttribute("className")}),_.getElementsByTagName=r(function(t){return t.appendChild(i.createComment("")),!t.getElementsByTagName("*").length}),_.getElementsByClassName=me.test(i.getElementsByClassName)&&r(function(t){return t.innerHTML="<div class='a'></div><div class='a i'></div>",t.firstChild.className="i",2===t.getElementsByClassName("i").length}),_.getById=r(function(t){return L.appendChild(t).id=F,!i.getElementsByName||!i.getElementsByName(F).length}),_.getById?(w.find.ID=function(t,e){if(typeof e.getElementById!==z&&I){var i=e.getElementById(t);return i&&i.parentNode?[i]:[]}},w.filter.ID=function(t){var e=t.replace(_e,we);return function(t){return t.getAttribute("id")===e}}):(delete w.find.ID,w.filter.ID=function(t){var e=t.replace(_e,we);return function(t){var i=typeof t.getAttributeNode!==z&&t.getAttributeNode("id");return i&&i.value===e}}),w.find.TAG=_.getElementsByTagName?function(t,e){return typeof e.getElementsByTagName!==z?e.getElementsByTagName(t):void 0}:function(t,e){var i,n=[],r=0,s=e.getElementsByTagName(t);if("*"===t){for(;i=s[r++];)1===i.nodeType&&n.push(i);return n}return s},w.find.CLASS=_.getElementsByClassName&&function(t,e){return typeof e.getElementsByClassName!==z&&I?e.getElementsByClassName(t):void 0},N=[],M=[],(_.qsa=me.test(i.querySelectorAll))&&(r(function(t){t.innerHTML="<select msallowclip=''><option selected=''></option></select>",t.querySelectorAll("[msallowclip^='']").length&&M.push("[*^$]="+ne+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||M.push("\\["+ne+"*(?:value|"+ie+")"),t.querySelectorAll(":checked").length||M.push(":checked")}),r(function(t){var e=i.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&M.push("name"+ne+"*[*^$|!~]?="),t.querySelectorAll(":enabled").length||M.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),M.push(",.*:")})),(_.matchesSelector=me.test(R=L.matches||L.webkitMatchesSelector||L.mozMatchesSelector||L.oMatchesSelector||L.msMatchesSelector))&&r(function(t){_.disconnectedMatch=R.call(t,"div"),R.call(t,"[s!='']:x"),N.push("!=",ae)}),M=M.length&&new RegExp(M.join("|")),N=N.length&&new RegExp(N.join("|")),e=me.test(L.compareDocumentPosition),$=e||me.test(L.contains)?function(t,e){var i=9===t.nodeType?t.documentElement:t,n=e&&e.parentNode;return t===n||!(!n||1!==n.nodeType||!(i.contains?i.contains(n):t.compareDocumentPosition&&16&t.compareDocumentPosition(n)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},V=e?function(t,e){if(t===e)return P=!0,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n?n:(n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1,1&n||!_.sortDetached&&e.compareDocumentPosition(t)===n?t===i||t.ownerDocument===B&&$(B,t)?-1:e===i||e.ownerDocument===B&&$(B,e)?1:A?ee.call(A,t)-ee.call(A,e):0:4&n?-1:1)}:function(t,e){if(t===e)return P=!0,0;var n,r=0,s=t.parentNode,a=e.parentNode,h=[t],l=[e];if(!s||!a)return t===i?-1:e===i?1:s?-1:a?1:A?ee.call(A,t)-ee.call(A,e):0;if(s===a)return o(t,e);for(n=t;n=n.parentNode;)h.unshift(n);for(n=e;n=n.parentNode;)l.unshift(n);for(;h[r]===l[r];)r++;return r?o(h[r],l[r]):h[r]===B?-1:l[r]===B?1:0},i):D},e.matches=function(t,i){return e(t,null,null,i)},e.matchesSelector=function(t,i){if((t.ownerDocument||t)!==D&&j(t),i=i.replace(ue,"='$1']"),!(!_.matchesSelector||!I||N&&N.test(i)||M&&M.test(i)))try{var n=R.call(t,i);if(n||_.disconnectedMatch||t.document&&11!==t.document.nodeType)return n}catch(r){}return e(i,D,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==D&&j(t),$(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==D&&j(t);var i=w.attrHandle[e.toLowerCase()],n=i&&Y.call(w.attrHandle,e.toLowerCase())?i(t,e,!I):void 0;return void 0!==n?n:_.attributes||!I?t.getAttribute(e):(n=t.getAttributeNode(e))&&n.specified?n.value:null},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,i=[],n=0,r=0;if(P=!_.detectDuplicates,A=!_.sortStable&&t.slice(0),t.sort(V),P){for(;e=t[r++];)e===t[r]&&(n=i.push(r));for(;n--;)t.splice(i[n],1)}return A=null,t},C=e.getText=function(t){var e,i="",n=0,r=t.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)i+=C(t)}else if(3===r||4===r)return t.nodeValue}else for(;e=t[n++];)i+=C(e);return i},w=e.selectors={cacheLength:50,createPseudo:n,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(_e,we),t[3]=(t[3]||t[4]||t[5]||"").replace(_e,we),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,i=!t[6]&&t[2];return pe.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":i&&fe.test(i)&&(e=T(i,!0))&&(e=i.indexOf(")",i.length-e)-i.length)&&(t[0]=t[0].slice(0,e),t[2]=i.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(_e,we).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=G[t+" "];return e||(e=new RegExp("(^|"+ne+")"+t+"("+ne+"|$)"))&&G(t,function(t){return e.test("string"==typeof t.className&&t.className||typeof t.getAttribute!==z&&t.getAttribute("class")||"")})},ATTR:function(t,i,n){return function(r){var s=e.attr(r,t);return null==s?"!="===i:i?(s+="","="===i?s===n:"!="===i?s!==n:"^="===i?n&&0===s.indexOf(n):"*="===i?n&&s.indexOf(n)>-1:"$="===i?n&&s.slice(-n.length)===n:"~="===i?(" "+s+" ").indexOf(n)>-1:"|="===i?s===n||s.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(t,e,i,n,r){var s="nth"!==t.slice(0,3),o="last"!==t.slice(-4),a="of-type"===e;return 1===n&&0===r?function(t){return!!t.parentNode}:function(e,i,h){var l,c,u,f,d,p,g=s!==o?"nextSibling":"previousSibling",v=e.parentNode,m=a&&e.nodeName.toLowerCase(),y=!h&&!a;if(v){if(s){for(;g;){for(u=e;u=u[g];)if(a?u.nodeName.toLowerCase()===m:1===u.nodeType)return!1;p=g="only"===t&&!p&&"nextSibling"}return!0}if(p=[o?v.firstChild:v.lastChild],o&&y){for(c=v[F]||(v[F]={}),l=c[t]||[],d=l[0]===H&&l[1],f=l[0]===H&&l[2],u=d&&v.childNodes[d];u=++d&&u&&u[g]||(f=d=0)||p.pop();)if(1===u.nodeType&&++f&&u===e){c[t]=[H,d,f];break}}else if(y&&(l=(e[F]||(e[F]={}))[t])&&l[0]===H)f=l[1];else for(;(u=++d&&u&&u[g]||(f=d=0)||p.pop())&&((a?u.nodeName.toLowerCase()!==m:1!==u.nodeType)||!++f||(y&&((u[F]||(u[F]={}))[t]=[H,f]),u!==e)););return f-=r,f===n||f%n===0&&f/n>=0}}},PSEUDO:function(t,i){var r,s=w.pseudos[t]||w.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return s[F]?s(i):s.length>1?(r=[t,t,"",i],w.setFilters.hasOwnProperty(t.toLowerCase())?n(function(t,e){for(var n,r=s(t,i),o=r.length;o--;)n=ee.call(t,r[o]),t[n]=!(e[n]=r[o])}):function(t){return s(t,0,r)}):s}},pseudos:{not:n(function(t){var e=[],i=[],r=k(t.replace(he,"$1"));return r[F]?n(function(t,e,i,n){for(var s,o=r(t,null,n,[]),a=t.length;a--;)(s=o[a])&&(t[a]=!(e[a]=s))}):function(t,n,s){return e[0]=t,r(e,null,s,i),!i.pop()}}),has:n(function(t){return function(i){return e(t,i).length>0}}),contains:n(function(t){return function(e){return(e.textContent||e.innerText||C(e)).indexOf(t)>-1}}),lang:n(function(t){return de.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(_e,we).toLowerCase(),function(e){var i;do if(i=I?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return i=i.toLowerCase(),i===t||0===i.indexOf(t+"-");while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var i=t.location&&t.location.hash;return i&&i.slice(1)===e.id},root:function(t){return t===L},focus:function(t){return t===D.activeElement&&(!D.hasFocus||D.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,t.selected===!0},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!w.pseudos.empty(t)},header:function(t){return ve.test(t.nodeName)},input:function(t){return ge.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:l(function(){return[0]}),last:l(function(t,e){return[e-1]}),eq:l(function(t,e,i){return[0>i?i+e:i]}),even:l(function(t,e){for(var i=0;e>i;i+=2)t.push(i);return t}),odd:l(function(t,e){for(var i=1;e>i;i+=2)t.push(i);return t}),lt:l(function(t,e,i){for(var n=0>i?i+e:i;--n>=0;)t.push(n);return t}),gt:l(function(t,e,i){for(var n=0>i?i+e:i;++n<e;)t.push(n);return t})}},w.pseudos.nth=w.pseudos.eq;for(x in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[x]=a(x);for(x in{submit:!0,reset:!0})w.pseudos[x]=h(x);return u.prototype=w.filters=w.pseudos,w.setFilters=new u,T=e.tokenize=function(t,i){var n,r,s,o,a,h,l,c=X[t+" "];if(c)return i?0:c.slice(0);for(a=t,h=[],l=w.preFilter;a;){(!n||(r=le.exec(a)))&&(r&&(a=a.slice(r[0].length)||a),h.push(s=[])),n=!1,(r=ce.exec(a))&&(n=r.shift(),s.push({value:n,type:r[0].replace(he," ")}),a=a.slice(n.length));for(o in w.filter)!(r=pe[o].exec(a))||l[o]&&!(r=l[o](r))||(n=r.shift(),s.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return i?a.length:a?e.error(t):X(t,h).slice(0)},k=e.compile=function(t,e){var i,n=[],r=[],s=U[t+" "];if(!s){for(e||(e=T(t)),i=e.length;i--;)s=y(e[i]),s[F]?n.push(s):r.push(s);s=U(t,b(r,n)),s.selector=t}return s},O=e.select=function(t,e,i,n){var r,s,o,a,h,l="function"==typeof t&&t,u=!n&&T(t=l.selector||t);if(i=i||[],1===u.length){if(s=u[0]=u[0].slice(0),s.length>2&&"ID"===(o=s[0]).type&&_.getById&&9===e.nodeType&&I&&w.relative[s[1].type]){if(e=(w.find.ID(o.matches[0].replace(_e,we),e)||[])[0],!e)return i;l&&(e=e.parentNode),t=t.slice(s.shift().value.length)}for(r=pe.needsContext.test(t)?0:s.length;r--&&(o=s[r],!w.relative[a=o.type]);)if((h=w.find[a])&&(n=h(o.matches[0].replace(_e,we),be.test(s[0].type)&&c(e.parentNode)||e))){if(s.splice(r,1),t=n.length&&f(s),!t)return Z.apply(i,n),i;break}}return(l||k(t,u))(n,e,!I,i,be.test(t)&&c(e.parentNode)||e),i},_.sortStable=F.split("").sort(V).join("")===F,_.detectDuplicates=!!P,j(),_.sortDetached=r(function(t){return 1&t.compareDocumentPosition(D.createElement("div"))}),r(function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")})||s("type|href|height|width",function(t,e,i){return i?void 0:t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),_.attributes&&r(function(t){return t.innerHTML="<input/>",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||s("value",function(t,e,i){return i||"input"!==t.nodeName.toLowerCase()?void 0:t.defaultValue}),r(function(t){return null==t.getAttribute("disabled")})||s(ie,function(t,e,i){var n;return i?void 0:t[e]===!0?e.toLowerCase():(n=t.getAttributeNode(e))&&n.specified?n.value:null}),e}(t);Z.find=re,Z.expr=re.selectors,Z.expr[":"]=Z.expr.pseudos,Z.unique=re.uniqueSort,Z.text=re.getText,Z.isXMLDoc=re.isXML,Z.contains=re.contains;var se=Z.expr.match.needsContext,oe=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ae=/^.[^:#\[\.,]*$/;Z.filter=function(t,e,i){var n=e[0];return i&&(t=":not("+t+")"),1===e.length&&1===n.nodeType?Z.find.matchesSelector(n,t)?[n]:[]:Z.find.matches(t,Z.grep(e,function(t){return 1===t.nodeType}))},Z.fn.extend({find:function(t){var e,i=this.length,n=[],r=this;if("string"!=typeof t)return this.pushStack(Z(t).filter(function(){for(e=0;i>e;e++)if(Z.contains(r[e],this))return!0}));for(e=0;i>e;e++)Z.find(t,r[e],n);return n=this.pushStack(i>1?Z.unique(n):n),n.selector=this.selector?this.selector+" "+t:t,n},filter:function(t){return this.pushStack(n(this,t||[],!1))},not:function(t){return this.pushStack(n(this,t||[],!0))},is:function(t){return!!n(this,"string"==typeof t&&se.test(t)?Z(t):t||[],!1).length}});var he,le=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ce=Z.fn.init=function(t,e){var i,n;if(!t)return this;if("string"==typeof t){if(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:le.exec(t),!i||!i[1]&&e)return!e||e.jquery?(e||he).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof Z?e[0]:e,Z.merge(this,Z.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:J,!0)),oe.test(i[1])&&Z.isPlainObject(e))for(i in e)Z.isFunction(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return n=J.getElementById(i[2]),n&&n.parentNode&&(this.length=1,this[0]=n),this.context=J,this.selector=t,this}return t.nodeType?(this.context=this[0]=t,this.length=1,this):Z.isFunction(t)?"undefined"!=typeof he.ready?he.ready(t):t(Z):(void 0!==t.selector&&(this.selector=t.selector,this.context=t.context),Z.makeArray(t,this))};ce.prototype=Z.fn,he=Z(J);var ue=/^(?:parents|prev(?:Until|All))/,fe={children:!0,contents:!0,next:!0,prev:!0};Z.extend({dir:function(t,e,i){for(var n=[],r=void 0!==i;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(r&&Z(t).is(i))break;n.push(t)}return n},sibling:function(t,e){for(var i=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&i.push(t);return i}}),Z.fn.extend({has:function(t){var e=Z(t,this),i=e.length;return this.filter(function(){for(var t=0;i>t;t++)if(Z.contains(this,e[t]))return!0})},closest:function(t,e){for(var i,n=0,r=this.length,s=[],o=se.test(t)||"string"!=typeof t?Z(t,e||this.context):0;r>n;n++)for(i=this[n];i&&i!==e;i=i.parentNode)if(i.nodeType<11&&(o?o.index(i)>-1:1===i.nodeType&&Z.find.matchesSelector(i,t))){s.push(i);break}return this.pushStack(s.length>1?Z.unique(s):s)},index:function(t){return t?"string"==typeof t?V.call(Z(t),this[0]):V.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(Z.unique(Z.merge(this.get(),Z(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),Z.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return Z.dir(t,"parentNode")},parentsUntil:function(t,e,i){return Z.dir(t,"parentNode",i)},next:function(t){return r(t,"nextSibling")},prev:function(t){return r(t,"previousSibling")},nextAll:function(t){return Z.dir(t,"nextSibling")},prevAll:function(t){return Z.dir(t,"previousSibling")},nextUntil:function(t,e,i){return Z.dir(t,"nextSibling",i)},prevUntil:function(t,e,i){return Z.dir(t,"previousSibling",i)},siblings:function(t){return Z.sibling((t.parentNode||{}).firstChild,t)},children:function(t){return Z.sibling(t.firstChild)},contents:function(t){return t.contentDocument||Z.merge([],t.childNodes)}},function(t,e){Z.fn[t]=function(i,n){var r=Z.map(this,e,i);return"Until"!==t.slice(-5)&&(n=i),n&&"string"==typeof n&&(r=Z.filter(n,r)),this.length>1&&(fe[t]||Z.unique(r),ue.test(t)&&r.reverse()),this.pushStack(r)}});var de=/\S+/g,pe={};Z.Callbacks=function(t){t="string"==typeof t?pe[t]||s(t):Z.extend({},t);var e,i,n,r,o,a,h=[],l=!t.once&&[],c=function(s){for(e=t.memory&&s,i=!0,a=r||0,r=0,o=h.length,n=!0;h&&o>a;a++)if(h[a].apply(s[0],s[1])===!1&&t.stopOnFalse){e=!1;break}n=!1,h&&(l?l.length&&c(l.shift()):e?h=[]:u.disable())},u={add:function(){if(h){var i=h.length;!function s(e){Z.each(e,function(e,i){var n=Z.type(i);"function"===n?t.unique&&u.has(i)||h.push(i):i&&i.length&&"string"!==n&&s(i)})}(arguments),n?o=h.length:e&&(r=i,c(e))}return this},remove:function(){return h&&Z.each(arguments,function(t,e){for(var i;(i=Z.inArray(e,h,i))>-1;)h.splice(i,1),n&&(o>=i&&o--,a>=i&&a--)}),this},has:function(t){return t?Z.inArray(t,h)>-1:!(!h||!h.length)},empty:function(){return h=[],o=0,this},disable:function(){return h=l=e=void 0,this},disabled:function(){return!h},lock:function(){return l=void 0,e||u.disable(),this},locked:function(){return!l},fireWith:function(t,e){return!h||i&&!l||(e=e||[],e=[t,e.slice?e.slice():e],n?l.push(e):c(e)),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!i}};return u},Z.extend({Deferred:function(t){var e=[["resolve","done",Z.Callbacks("once memory"),"resolved"],["reject","fail",Z.Callbacks("once memory"),"rejected"],["notify","progress",Z.Callbacks("memory")]],i="pending",n={state:function(){return i},always:function(){return r.done(arguments).fail(arguments),this},then:function(){var t=arguments;return Z.Deferred(function(i){Z.each(e,function(e,s){var o=Z.isFunction(t[e])&&t[e];r[s[1]](function(){var t=o&&o.apply(this,arguments);t&&Z.isFunction(t.promise)?t.promise().done(i.resolve).fail(i.reject).progress(i.notify):i[s[0]+"With"](this===n?i.promise():this,o?[t]:arguments)})}),t=null}).promise()},promise:function(t){return null!=t?Z.extend(t,n):n}},r={};return n.pipe=n.then,Z.each(e,function(t,s){var o=s[2],a=s[3];n[s[1]]=o.add,a&&o.add(function(){i=a},e[1^t][2].disable,e[2][2].lock),r[s[0]]=function(){return r[s[0]+"With"](this===r?n:this,arguments),this},r[s[0]+"With"]=o.fireWith}),n.promise(r),t&&t.call(r,r),r},when:function(t){var e,i,n,r=0,s=G.call(arguments),o=s.length,a=1!==o||t&&Z.isFunction(t.promise)?o:0,h=1===a?t:Z.Deferred(),l=function(t,i,n){return function(r){i[t]=this,n[t]=arguments.length>1?G.call(arguments):r,n===e?h.notifyWith(i,n):--a||h.resolveWith(i,n)}};if(o>1)for(e=new Array(o),i=new Array(o),n=new Array(o);o>r;r++)s[r]&&Z.isFunction(s[r].promise)?s[r].promise().done(l(r,n,s)).fail(h.reject).progress(l(r,i,e)):--a;return a||h.resolveWith(n,s),h.promise()}});var ge;Z.fn.ready=function(t){return Z.ready.promise().done(t),this},Z.extend({isReady:!1,readyWait:1,holdReady:function(t){t?Z.readyWait++:Z.ready(!0)},ready:function(t){(t===!0?--Z.readyWait:Z.isReady)||(Z.isReady=!0,t!==!0&&--Z.readyWait>0||(ge.resolveWith(J,[Z]),Z.fn.triggerHandler&&(Z(J).triggerHandler("ready"),Z(J).off("ready"))))}}),Z.ready.promise=function(e){return ge||(ge=Z.Deferred(),"complete"===J.readyState?setTimeout(Z.ready):(J.addEventListener("DOMContentLoaded",o,!1),t.addEventListener("load",o,!1))),ge.promise(e)},Z.ready.promise();var ve=Z.access=function(t,e,i,n,r,s,o){var a=0,h=t.length,l=null==i;if("object"===Z.type(i)){r=!0;for(a in i)Z.access(t,e,a,i[a],!0,s,o)}else if(void 0!==n&&(r=!0,Z.isFunction(n)||(o=!0),l&&(o?(e.call(t,n),e=null):(l=e,e=function(t,e,i){return l.call(Z(t),i)})),e))for(;h>a;a++)e(t[a],i,o?n:n.call(t[a],a,e(t[a],i)));return r?t:l?e.call(t):h?e(t[0],i):s};Z.acceptData=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType},a.uid=1,a.accepts=Z.acceptData,a.prototype={key:function(t){if(!a.accepts(t))return 0;var e={},i=t[this.expando];if(!i){i=a.uid++;try{e[this.expando]={value:i},Object.defineProperties(t,e)}catch(n){e[this.expando]=i,Z.extend(t,e)}}return this.cache[i]||(this.cache[i]={}),i},set:function(t,e,i){var n,r=this.key(t),s=this.cache[r];if("string"==typeof e)s[e]=i;else if(Z.isEmptyObject(s))Z.extend(this.cache[r],e);else for(n in e)s[n]=e[n];return s},get:function(t,e){var i=this.cache[this.key(t)];return void 0===e?i:i[e]},access:function(t,e,i){var n;return void 0===e||e&&"string"==typeof e&&void 0===i?(n=this.get(t,e),void 0!==n?n:this.get(t,Z.camelCase(e))):(this.set(t,e,i),void 0!==i?i:e)},remove:function(t,e){var i,n,r,s=this.key(t),o=this.cache[s];if(void 0===e)this.cache[s]={};else{Z.isArray(e)?n=e.concat(e.map(Z.camelCase)):(r=Z.camelCase(e),e in o?n=[e,r]:(n=r,n=n in o?[n]:n.match(de)||[])),i=n.length;for(;i--;)delete o[n[i]]}},hasData:function(t){return!Z.isEmptyObject(this.cache[t[this.expando]]||{})},discard:function(t){t[this.expando]&&delete this.cache[t[this.expando]]}};var me=new a,ye=new a,be=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,xe=/([A-Z])/g;Z.extend({hasData:function(t){return ye.hasData(t)||me.hasData(t)},data:function(t,e,i){return ye.access(t,e,i)},removeData:function(t,e){ye.remove(t,e)},_data:function(t,e,i){return me.access(t,e,i)},_removeData:function(t,e){me.remove(t,e)}}),Z.fn.extend({data:function(t,e){var i,n,r,s=this[0],o=s&&s.attributes;if(void 0===t){if(this.length&&(r=ye.get(s),1===s.nodeType&&!me.get(s,"hasDataAttrs"))){for(i=o.length;i--;)o[i]&&(n=o[i].name,0===n.indexOf("data-")&&(n=Z.camelCase(n.slice(5)),h(s,n,r[n])));me.set(s,"hasDataAttrs",!0)}return r}return"object"==typeof t?this.each(function(){ye.set(this,t)}):ve(this,function(e){var i,n=Z.camelCase(t);if(s&&void 0===e){if(i=ye.get(s,t),void 0!==i)return i;if(i=ye.get(s,n),void 0!==i)return i;if(i=h(s,n,void 0),void 0!==i)return i}else this.each(function(){var i=ye.get(this,n);ye.set(this,n,e),-1!==t.indexOf("-")&&void 0!==i&&ye.set(this,t,e)})},null,e,arguments.length>1,null,!0)},removeData:function(t){return this.each(function(){ye.remove(this,t)})}}),Z.extend({queue:function(t,e,i){var n;return t?(e=(e||"fx")+"queue",n=me.get(t,e),i&&(!n||Z.isArray(i)?n=me.access(t,e,Z.makeArray(i)):n.push(i)),n||[]):void 0},dequeue:function(t,e){e=e||"fx";var i=Z.queue(t,e),n=i.length,r=i.shift(),s=Z._queueHooks(t,e),o=function(){Z.dequeue(t,e)};"inprogress"===r&&(r=i.shift(),n--),r&&("fx"===e&&i.unshift("inprogress"),delete s.stop,r.call(t,o,s)),!n&&s&&s.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return me.get(t,i)||me.access(t,i,{empty:Z.Callbacks("once memory").add(function(){me.remove(t,[e+"queue",i])})})}}),Z.fn.extend({queue:function(t,e){var i=2;return"string"!=typeof t&&(e=t,t="fx",i--),arguments.length<i?Z.queue(this[0],t):void 0===e?this:this.each(function(){var i=Z.queue(this,t,e);Z._queueHooks(this,t),"fx"===t&&"inprogress"!==i[0]&&Z.dequeue(this,t)})},dequeue:function(t){return this.each(function(){Z.dequeue(this,t)})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var i,n=1,r=Z.Deferred(),s=this,o=this.length,a=function(){--n||r.resolveWith(s,[s])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";o--;)i=me.get(s[o],t+"queueHooks"),i&&i.empty&&(n++,i.empty.add(a));return a(),r.promise(e)}});var _e=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,we=["Top","Right","Bottom","Left"],Ce=function(t,e){return t=e||t,"none"===Z.css(t,"display")||!Z.contains(t.ownerDocument,t)},Se=/^(?:checkbox|radio)$/i;!function(){var t=J.createDocumentFragment(),e=t.appendChild(J.createElement("div")),i=J.createElement("input");i.setAttribute("type","radio"),i.setAttribute("checked","checked"),i.setAttribute("name","t"),e.appendChild(i),K.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",K.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Te="undefined";K.focusinBubbles="onfocusin"in t;var ke=/^key/,Oe=/^(?:mouse|pointer|contextmenu)|click/,Ee=/^(?:focusinfocus|focusoutblur)$/,Ae=/^([^.]*)(?:\.(.+)|)$/;Z.event={global:{},add:function(t,e,i,n,r){var s,o,a,h,l,c,u,f,d,p,g,v=me.get(t);if(v)for(i.handler&&(s=i,i=s.handler,r=s.selector),i.guid||(i.guid=Z.guid++),(h=v.events)||(h=v.events={}),(o=v.handle)||(o=v.handle=function(e){return typeof Z!==Te&&Z.event.triggered!==e.type?Z.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(de)||[""],l=e.length;l--;)a=Ae.exec(e[l])||[],d=g=a[1],p=(a[2]||"").split(".").sort(),d&&(u=Z.event.special[d]||{},d=(r?u.delegateType:u.bindType)||d,u=Z.event.special[d]||{},c=Z.extend({type:d,origType:g,data:n,handler:i,guid:i.guid,selector:r,needsContext:r&&Z.expr.match.needsContext.test(r),namespace:p.join(".")},s),(f=h[d])||(f=h[d]=[],f.delegateCount=0,u.setup&&u.setup.call(t,n,p,o)!==!1||t.addEventListener&&t.addEventListener(d,o,!1)),u.add&&(u.add.call(t,c),c.handler.guid||(c.handler.guid=i.guid)),r?f.splice(f.delegateCount++,0,c):f.push(c),Z.event.global[d]=!0)},remove:function(t,e,i,n,r){var s,o,a,h,l,c,u,f,d,p,g,v=me.hasData(t)&&me.get(t);if(v&&(h=v.events)){for(e=(e||"").match(de)||[""],l=e.length;l--;)if(a=Ae.exec(e[l])||[],d=g=a[1],p=(a[2]||"").split(".").sort(),d){for(u=Z.event.special[d]||{},d=(n?u.delegateType:u.bindType)||d,f=h[d]||[],a=a[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=f.length;s--;)c=f[s],!r&&g!==c.origType||i&&i.guid!==c.guid||a&&!a.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(f.splice(s,1),c.selector&&f.delegateCount--,u.remove&&u.remove.call(t,c));o&&!f.length&&(u.teardown&&u.teardown.call(t,p,v.handle)!==!1||Z.removeEvent(t,d,v.handle),delete h[d])}else for(d in h)Z.event.remove(t,d+e[l],i,n,!0);Z.isEmptyObject(h)&&(delete v.handle,me.remove(t,"events"))}},trigger:function(e,i,n,r){var s,o,a,h,l,c,u,f=[n||J],d=Y.call(e,"type")?e.type:e,p=Y.call(e,"namespace")?e.namespace.split("."):[];if(o=a=n=n||J,3!==n.nodeType&&8!==n.nodeType&&!Ee.test(d+Z.event.triggered)&&(d.indexOf(".")>=0&&(p=d.split("."),d=p.shift(),p.sort()),l=d.indexOf(":")<0&&"on"+d,e=e[Z.expando]?e:new Z.Event(d,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),i=null==i?[e]:Z.makeArray(i,[e]),u=Z.event.special[d]||{},r||!u.trigger||u.trigger.apply(n,i)!==!1)){if(!r&&!u.noBubble&&!Z.isWindow(n)){for(h=u.delegateType||d,Ee.test(h+d)||(o=o.parentNode);o;o=o.parentNode)f.push(o),a=o;a===(n.ownerDocument||J)&&f.push(a.defaultView||a.parentWindow||t)}for(s=0;(o=f[s++])&&!e.isPropagationStopped();)e.type=s>1?h:u.bindType||d,c=(me.get(o,"events")||{})[e.type]&&me.get(o,"handle"),c&&c.apply(o,i),c=l&&o[l],c&&c.apply&&Z.acceptData(o)&&(e.result=c.apply(o,i),e.result===!1&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||u._default&&u._default.apply(f.pop(),i)!==!1||!Z.acceptData(n)||l&&Z.isFunction(n[d])&&!Z.isWindow(n)&&(a=n[l],a&&(n[l]=null),Z.event.triggered=d,n[d](),Z.event.triggered=void 0,a&&(n[l]=a)),e.result}},dispatch:function(t){t=Z.event.fix(t);var e,i,n,r,s,o=[],a=G.call(arguments),h=(me.get(this,"events")||{})[t.type]||[],l=Z.event.special[t.type]||{};if(a[0]=t,t.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,t)!==!1){for(o=Z.event.handlers.call(this,t,h),e=0;(r=o[e++])&&!t.isPropagationStopped();)for(t.currentTarget=r.elem,i=0;(s=r.handlers[i++])&&!t.isImmediatePropagationStopped();)(!t.namespace_re||t.namespace_re.test(s.namespace))&&(t.handleObj=s,t.data=s.data,n=((Z.event.special[s.origType]||{}).handle||s.handler).apply(r.elem,a),void 0!==n&&(t.result=n)===!1&&(t.preventDefault(),t.stopPropagation()));
|
|
return l.postDispatch&&l.postDispatch.call(this,t),t.result}},handlers:function(t,e){var i,n,r,s,o=[],a=e.delegateCount,h=t.target;if(a&&h.nodeType&&(!t.button||"click"!==t.type))for(;h!==this;h=h.parentNode||this)if(h.disabled!==!0||"click"!==t.type){for(n=[],i=0;a>i;i++)s=e[i],r=s.selector+" ",void 0===n[r]&&(n[r]=s.needsContext?Z(r,this).index(h)>=0:Z.find(r,this,null,[h]).length),n[r]&&n.push(s);n.length&&o.push({elem:h,handlers:n})}return a<e.length&&o.push({elem:this,handlers:e.slice(a)}),o},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){return null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode),t}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,e){var i,n,r,s=e.button;return null==t.pageX&&null!=e.clientX&&(i=t.target.ownerDocument||J,n=i.documentElement,r=i.body,t.pageX=e.clientX+(n&&n.scrollLeft||r&&r.scrollLeft||0)-(n&&n.clientLeft||r&&r.clientLeft||0),t.pageY=e.clientY+(n&&n.scrollTop||r&&r.scrollTop||0)-(n&&n.clientTop||r&&r.clientTop||0)),t.which||void 0===s||(t.which=1&s?1:2&s?3:4&s?2:0),t}},fix:function(t){if(t[Z.expando])return t;var e,i,n,r=t.type,s=t,o=this.fixHooks[r];for(o||(this.fixHooks[r]=o=Oe.test(r)?this.mouseHooks:ke.test(r)?this.keyHooks:{}),n=o.props?this.props.concat(o.props):this.props,t=new Z.Event(s),e=n.length;e--;)i=n[e],t[i]=s[i];return t.target||(t.target=J),3===t.target.nodeType&&(t.target=t.target.parentNode),o.filter?o.filter(t,s):t},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==u()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===u()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&Z.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(t){return Z.nodeName(t.target,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}},simulate:function(t,e,i,n){var r=Z.extend(new Z.Event,i,{type:t,isSimulated:!0,originalEvent:{}});n?Z.event.trigger(r,null,e):Z.event.dispatch.call(e,r),r.isDefaultPrevented()&&i.preventDefault()}},Z.removeEvent=function(t,e,i){t.removeEventListener&&t.removeEventListener(e,i,!1)},Z.Event=function(t,e){return this instanceof Z.Event?(t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&t.returnValue===!1?l:c):this.type=t,e&&Z.extend(this,e),this.timeStamp=t&&t.timeStamp||Z.now(),void(this[Z.expando]=!0)):new Z.Event(t,e)},Z.Event.prototype={isDefaultPrevented:c,isPropagationStopped:c,isImmediatePropagationStopped:c,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=l,t&&t.preventDefault&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=l,t&&t.stopPropagation&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=l,t&&t.stopImmediatePropagation&&t.stopImmediatePropagation(),this.stopPropagation()}},Z.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(t,e){Z.event.special[t]={delegateType:e,bindType:e,handle:function(t){var i,n=this,r=t.relatedTarget,s=t.handleObj;return(!r||r!==n&&!Z.contains(n,r))&&(t.type=s.origType,i=s.handler.apply(this,arguments),t.type=e),i}}}),K.focusinBubbles||Z.each({focus:"focusin",blur:"focusout"},function(t,e){var i=function(t){Z.event.simulate(e,t.target,Z.event.fix(t),!0)};Z.event.special[e]={setup:function(){var n=this.ownerDocument||this,r=me.access(n,e);r||n.addEventListener(t,i,!0),me.access(n,e,(r||0)+1)},teardown:function(){var n=this.ownerDocument||this,r=me.access(n,e)-1;r?me.access(n,e,r):(n.removeEventListener(t,i,!0),me.remove(n,e))}}}),Z.fn.extend({on:function(t,e,i,n,r){var s,o;if("object"==typeof t){"string"!=typeof e&&(i=i||e,e=void 0);for(o in t)this.on(o,e,i,t[o],r);return this}if(null==i&&null==n?(n=e,i=e=void 0):null==n&&("string"==typeof e?(n=i,i=void 0):(n=i,i=e,e=void 0)),n===!1)n=c;else if(!n)return this;return 1===r&&(s=n,n=function(t){return Z().off(t),s.apply(this,arguments)},n.guid=s.guid||(s.guid=Z.guid++)),this.each(function(){Z.event.add(this,t,n,i,e)})},one:function(t,e,i,n){return this.on(t,e,i,n,1)},off:function(t,e,i){var n,r;if(t&&t.preventDefault&&t.handleObj)return n=t.handleObj,Z(t.delegateTarget).off(n.namespace?n.origType+"."+n.namespace:n.origType,n.selector,n.handler),this;if("object"==typeof t){for(r in t)this.off(r,e,t[r]);return this}return(e===!1||"function"==typeof e)&&(i=e,e=void 0),i===!1&&(i=c),this.each(function(){Z.event.remove(this,t,i,e)})},trigger:function(t,e){return this.each(function(){Z.event.trigger(t,e,this)})},triggerHandler:function(t,e){var i=this[0];return i?Z.event.trigger(t,e,i,!0):void 0}});var Pe=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,je=/<([\w:]+)/,De=/<|&#?\w+;/,Le=/<(?:script|style|link)/i,Ie=/checked\s*(?:[^=]|=\s*.checked.)/i,Me=/^$|\/(?:java|ecma)script/i,Ne=/^true\/(.*)/,Re=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,$e={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$e.optgroup=$e.option,$e.tbody=$e.tfoot=$e.colgroup=$e.caption=$e.thead,$e.th=$e.td,Z.extend({clone:function(t,e,i){var n,r,s,o,a=t.cloneNode(!0),h=Z.contains(t.ownerDocument,t);if(!(K.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||Z.isXMLDoc(t)))for(o=m(a),s=m(t),n=0,r=s.length;r>n;n++)y(s[n],o[n]);if(e)if(i)for(s=s||m(t),o=o||m(a),n=0,r=s.length;r>n;n++)v(s[n],o[n]);else v(t,a);return o=m(a,"script"),o.length>0&&g(o,!h&&m(t,"script")),a},buildFragment:function(t,e,i,n){for(var r,s,o,a,h,l,c=e.createDocumentFragment(),u=[],f=0,d=t.length;d>f;f++)if(r=t[f],r||0===r)if("object"===Z.type(r))Z.merge(u,r.nodeType?[r]:r);else if(De.test(r)){for(s=s||c.appendChild(e.createElement("div")),o=(je.exec(r)||["",""])[1].toLowerCase(),a=$e[o]||$e._default,s.innerHTML=a[1]+r.replace(Pe,"<$1></$2>")+a[2],l=a[0];l--;)s=s.lastChild;Z.merge(u,s.childNodes),s=c.firstChild,s.textContent=""}else u.push(e.createTextNode(r));for(c.textContent="",f=0;r=u[f++];)if((!n||-1===Z.inArray(r,n))&&(h=Z.contains(r.ownerDocument,r),s=m(c.appendChild(r),"script"),h&&g(s),i))for(l=0;r=s[l++];)Me.test(r.type||"")&&i.push(r);return c},cleanData:function(t){for(var e,i,n,r,s=Z.event.special,o=0;void 0!==(i=t[o]);o++){if(Z.acceptData(i)&&(r=i[me.expando],r&&(e=me.cache[r]))){if(e.events)for(n in e.events)s[n]?Z.event.remove(i,n):Z.removeEvent(i,n,e.handle);me.cache[r]&&delete me.cache[r]}delete ye.cache[i[ye.expando]]}}}),Z.fn.extend({text:function(t){return ve(this,function(t){return void 0===t?Z.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=t)})},null,t,arguments.length)},append:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=f(this,t);e.appendChild(t)}})},prepend:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=f(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},remove:function(t,e){for(var i,n=t?Z.filter(t,this):this,r=0;null!=(i=n[r]);r++)e||1!==i.nodeType||Z.cleanData(m(i)),i.parentNode&&(e&&Z.contains(i.ownerDocument,i)&&g(m(i,"script")),i.parentNode.removeChild(i));return this},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(Z.cleanData(m(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null==t?!1:t,e=null==e?t:e,this.map(function(){return Z.clone(this,t,e)})},html:function(t){return ve(this,function(t){var e=this[0]||{},i=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Le.test(t)&&!$e[(je.exec(t)||["",""])[1].toLowerCase()]){t=t.replace(Pe,"<$1></$2>");try{for(;n>i;i++)e=this[i]||{},1===e.nodeType&&(Z.cleanData(m(e,!1)),e.innerHTML=t);e=0}catch(r){}}e&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(){var t=arguments[0];return this.domManip(arguments,function(e){t=this.parentNode,Z.cleanData(m(this)),t&&t.replaceChild(e,this)}),t&&(t.length||t.nodeType)?this:this.remove()},detach:function(t){return this.remove(t,!0)},domManip:function(t,e){t=X.apply([],t);var i,n,r,s,o,a,h=0,l=this.length,c=this,u=l-1,f=t[0],g=Z.isFunction(f);if(g||l>1&&"string"==typeof f&&!K.checkClone&&Ie.test(f))return this.each(function(i){var n=c.eq(i);g&&(t[0]=f.call(this,i,n.html())),n.domManip(t,e)});if(l&&(i=Z.buildFragment(t,this[0].ownerDocument,!1,this),n=i.firstChild,1===i.childNodes.length&&(i=n),n)){for(r=Z.map(m(i,"script"),d),s=r.length;l>h;h++)o=i,h!==u&&(o=Z.clone(o,!0,!0),s&&Z.merge(r,m(o,"script"))),e.call(this[h],o,h);if(s)for(a=r[r.length-1].ownerDocument,Z.map(r,p),h=0;s>h;h++)o=r[h],Me.test(o.type||"")&&!me.access(o,"globalEval")&&Z.contains(a,o)&&(o.src?Z._evalUrl&&Z._evalUrl(o.src):Z.globalEval(o.textContent.replace(Re,"")))}return this}}),Z.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){Z.fn[t]=function(t){for(var i,n=[],r=Z(t),s=r.length-1,o=0;s>=o;o++)i=o===s?this:this.clone(!0),Z(r[o])[e](i),U.apply(n,i.get());return this.pushStack(n)}});var Fe,Be={},He=/^margin/,We=new RegExp("^("+_e+")(?!px)[a-z%]+$","i"),Ge=function(t){return t.ownerDocument.defaultView.getComputedStyle(t,null)};!function(){function e(){o.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",o.innerHTML="",r.appendChild(s);var e=t.getComputedStyle(o,null);i="1%"!==e.top,n="4px"===e.width,r.removeChild(s)}var i,n,r=J.documentElement,s=J.createElement("div"),o=J.createElement("div");o.style&&(o.style.backgroundClip="content-box",o.cloneNode(!0).style.backgroundClip="",K.clearCloneStyle="content-box"===o.style.backgroundClip,s.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",s.appendChild(o),t.getComputedStyle&&Z.extend(K,{pixelPosition:function(){return e(),i},boxSizingReliable:function(){return null==n&&e(),n},reliableMarginRight:function(){var e,i=o.appendChild(J.createElement("div"));return i.style.cssText=o.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",o.style.width="1px",r.appendChild(s),e=!parseFloat(t.getComputedStyle(i,null).marginRight),r.removeChild(s),e}}))}(),Z.swap=function(t,e,i,n){var r,s,o={};for(s in e)o[s]=t.style[s],t.style[s]=e[s];r=i.apply(t,n||[]);for(s in e)t.style[s]=o[s];return r};var Xe=/^(none|table(?!-c[ea]).+)/,Ue=new RegExp("^("+_e+")(.*)$","i"),Ve=new RegExp("^([+-])=("+_e+")","i"),ze={position:"absolute",visibility:"hidden",display:"block"},qe={letterSpacing:"0",fontWeight:"400"},Ye=["Webkit","O","Moz","ms"];Z.extend({cssHooks:{opacity:{get:function(t,e){if(e){var i=_(t,"opacity");return""===i?"1":i}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(t,e,i,n){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var r,s,o,a=Z.camelCase(e),h=t.style;return e=Z.cssProps[a]||(Z.cssProps[a]=C(h,a)),o=Z.cssHooks[e]||Z.cssHooks[a],void 0===i?o&&"get"in o&&void 0!==(r=o.get(t,!1,n))?r:h[e]:(s=typeof i,"string"===s&&(r=Ve.exec(i))&&(i=(r[1]+1)*r[2]+parseFloat(Z.css(t,e)),s="number"),void(null!=i&&i===i&&("number"!==s||Z.cssNumber[a]||(i+="px"),K.clearCloneStyle||""!==i||0!==e.indexOf("background")||(h[e]="inherit"),o&&"set"in o&&void 0===(i=o.set(t,i,n))||(h[e]=i))))}},css:function(t,e,i,n){var r,s,o,a=Z.camelCase(e);return e=Z.cssProps[a]||(Z.cssProps[a]=C(t.style,a)),o=Z.cssHooks[e]||Z.cssHooks[a],o&&"get"in o&&(r=o.get(t,!0,i)),void 0===r&&(r=_(t,e,n)),"normal"===r&&e in qe&&(r=qe[e]),""===i||i?(s=parseFloat(r),i===!0||Z.isNumeric(s)?s||0:r):r}}),Z.each(["height","width"],function(t,e){Z.cssHooks[e]={get:function(t,i,n){return i?Xe.test(Z.css(t,"display"))&&0===t.offsetWidth?Z.swap(t,ze,function(){return k(t,e,n)}):k(t,e,n):void 0},set:function(t,i,n){var r=n&&Ge(t);return S(t,i,n?T(t,e,n,"border-box"===Z.css(t,"boxSizing",!1,r),r):0)}}}),Z.cssHooks.marginRight=w(K.reliableMarginRight,function(t,e){return e?Z.swap(t,{display:"inline-block"},_,[t,"marginRight"]):void 0}),Z.each({margin:"",padding:"",border:"Width"},function(t,e){Z.cssHooks[t+e]={expand:function(i){for(var n=0,r={},s="string"==typeof i?i.split(" "):[i];4>n;n++)r[t+we[n]+e]=s[n]||s[n-2]||s[0];return r}},He.test(t)||(Z.cssHooks[t+e].set=S)}),Z.fn.extend({css:function(t,e){return ve(this,function(t,e,i){var n,r,s={},o=0;if(Z.isArray(e)){for(n=Ge(t),r=e.length;r>o;o++)s[e[o]]=Z.css(t,e[o],!1,n);return s}return void 0!==i?Z.style(t,e,i):Z.css(t,e)},t,e,arguments.length>1)},show:function(){return O(this,!0)},hide:function(){return O(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Ce(this)?Z(this).show():Z(this).hide()})}}),Z.Tween=E,E.prototype={constructor:E,init:function(t,e,i,n,r,s){this.elem=t,this.prop=i,this.easing=r||"swing",this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=s||(Z.cssNumber[i]?"":"px")},cur:function(){var t=E.propHooks[this.prop];return t&&t.get?t.get(this):E.propHooks._default.get(this)},run:function(t){var e,i=E.propHooks[this.prop];return this.pos=e=this.options.duration?Z.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):E.propHooks._default.set(this),this}},E.prototype.init.prototype=E.prototype,E.propHooks={_default:{get:function(t){var e;return null==t.elem[t.prop]||t.elem.style&&null!=t.elem.style[t.prop]?(e=Z.css(t.elem,t.prop,""),e&&"auto"!==e?e:0):t.elem[t.prop]},set:function(t){Z.fx.step[t.prop]?Z.fx.step[t.prop](t):t.elem.style&&(null!=t.elem.style[Z.cssProps[t.prop]]||Z.cssHooks[t.prop])?Z.style(t.elem,t.prop,t.now+t.unit):t.elem[t.prop]=t.now}}},E.propHooks.scrollTop=E.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},Z.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2}},Z.fx=E.prototype.init,Z.fx.step={};var Ke,Je,Qe=/^(?:toggle|show|hide)$/,Ze=new RegExp("^(?:([+-])=|)("+_e+")([a-z%]*)$","i"),ti=/queueHooks$/,ei=[D],ii={"*":[function(t,e){var i=this.createTween(t,e),n=i.cur(),r=Ze.exec(e),s=r&&r[3]||(Z.cssNumber[t]?"":"px"),o=(Z.cssNumber[t]||"px"!==s&&+n)&&Ze.exec(Z.css(i.elem,t)),a=1,h=20;if(o&&o[3]!==s){s=s||o[3],r=r||[],o=+n||1;do a=a||".5",o/=a,Z.style(i.elem,t,o+s);while(a!==(a=i.cur()/n)&&1!==a&&--h)}return r&&(o=i.start=+o||+n||0,i.unit=s,i.end=r[1]?o+(r[1]+1)*r[2]:+r[2]),i}]};Z.Animation=Z.extend(I,{tweener:function(t,e){Z.isFunction(t)?(e=t,t=["*"]):t=t.split(" ");for(var i,n=0,r=t.length;r>n;n++)i=t[n],ii[i]=ii[i]||[],ii[i].unshift(e)},prefilter:function(t,e){e?ei.unshift(t):ei.push(t)}}),Z.speed=function(t,e,i){var n=t&&"object"==typeof t?Z.extend({},t):{complete:i||!i&&e||Z.isFunction(t)&&t,duration:t,easing:i&&e||e&&!Z.isFunction(e)&&e};return n.duration=Z.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in Z.fx.speeds?Z.fx.speeds[n.duration]:Z.fx.speeds._default,(null==n.queue||n.queue===!0)&&(n.queue="fx"),n.old=n.complete,n.complete=function(){Z.isFunction(n.old)&&n.old.call(this),n.queue&&Z.dequeue(this,n.queue)},n},Z.fn.extend({fadeTo:function(t,e,i,n){return this.filter(Ce).css("opacity",0).show().end().animate({opacity:e},t,i,n)},animate:function(t,e,i,n){var r=Z.isEmptyObject(t),s=Z.speed(e,i,n),o=function(){var e=I(this,Z.extend({},t),s);(r||me.get(this,"finish"))&&e.stop(!0)};return o.finish=o,r||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(t,e,i){var n=function(t){var e=t.stop;delete t.stop,e(i)};return"string"!=typeof t&&(i=e,e=t,t=void 0),e&&t!==!1&&this.queue(t||"fx",[]),this.each(function(){var e=!0,r=null!=t&&t+"queueHooks",s=Z.timers,o=me.get(this);if(r)o[r]&&o[r].stop&&n(o[r]);else for(r in o)o[r]&&o[r].stop&&ti.test(r)&&n(o[r]);for(r=s.length;r--;)s[r].elem!==this||null!=t&&s[r].queue!==t||(s[r].anim.stop(i),e=!1,s.splice(r,1));(e||!i)&&Z.dequeue(this,t)})},finish:function(t){return t!==!1&&(t=t||"fx"),this.each(function(){var e,i=me.get(this),n=i[t+"queue"],r=i[t+"queueHooks"],s=Z.timers,o=n?n.length:0;for(i.finish=!0,Z.queue(this,t,[]),r&&r.stop&&r.stop.call(this,!0),e=s.length;e--;)s[e].elem===this&&s[e].queue===t&&(s[e].anim.stop(!0),s.splice(e,1));for(e=0;o>e;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete i.finish})}}),Z.each(["toggle","show","hide"],function(t,e){var i=Z.fn[e];Z.fn[e]=function(t,n,r){return null==t||"boolean"==typeof t?i.apply(this,arguments):this.animate(P(e,!0),t,n,r)}}),Z.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){Z.fn[t]=function(t,i,n){return this.animate(e,t,i,n)}}),Z.timers=[],Z.fx.tick=function(){var t,e=0,i=Z.timers;for(Ke=Z.now();e<i.length;e++)t=i[e],t()||i[e]!==t||i.splice(e--,1);i.length||Z.fx.stop(),Ke=void 0},Z.fx.timer=function(t){Z.timers.push(t),t()?Z.fx.start():Z.timers.pop()},Z.fx.interval=13,Z.fx.start=function(){Je||(Je=setInterval(Z.fx.tick,Z.fx.interval))},Z.fx.stop=function(){clearInterval(Je),Je=null},Z.fx.speeds={slow:600,fast:200,_default:400},Z.fn.delay=function(t,e){return t=Z.fx?Z.fx.speeds[t]||t:t,e=e||"fx",this.queue(e,function(e,i){var n=setTimeout(e,t);i.stop=function(){clearTimeout(n)}})},function(){var t=J.createElement("input"),e=J.createElement("select"),i=e.appendChild(J.createElement("option"));t.type="checkbox",K.checkOn=""!==t.value,K.optSelected=i.selected,e.disabled=!0,K.optDisabled=!i.disabled,t=J.createElement("input"),t.value="t",t.type="radio",K.radioValue="t"===t.value}();var ni,ri,si=Z.expr.attrHandle;Z.fn.extend({attr:function(t,e){return ve(this,Z.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){Z.removeAttr(this,t)})}}),Z.extend({attr:function(t,e,i){var n,r,s=t.nodeType;return t&&3!==s&&8!==s&&2!==s?typeof t.getAttribute===Te?Z.prop(t,e,i):(1===s&&Z.isXMLDoc(t)||(e=e.toLowerCase(),n=Z.attrHooks[e]||(Z.expr.match.bool.test(e)?ri:ni)),void 0===i?n&&"get"in n&&null!==(r=n.get(t,e))?r:(r=Z.find.attr(t,e),null==r?void 0:r):null!==i?n&&"set"in n&&void 0!==(r=n.set(t,i,e))?r:(t.setAttribute(e,i+""),i):void Z.removeAttr(t,e)):void 0},removeAttr:function(t,e){var i,n,r=0,s=e&&e.match(de);if(s&&1===t.nodeType)for(;i=s[r++];)n=Z.propFix[i]||i,Z.expr.match.bool.test(i)&&(t[n]=!1),t.removeAttribute(i)},attrHooks:{type:{set:function(t,e){if(!K.radioValue&&"radio"===e&&Z.nodeName(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}}}),ri={set:function(t,e,i){return e===!1?Z.removeAttr(t,i):t.setAttribute(i,i),i}},Z.each(Z.expr.match.bool.source.match(/\w+/g),function(t,e){var i=si[e]||Z.find.attr;si[e]=function(t,e,n){var r,s;return n||(s=si[e],si[e]=r,r=null!=i(t,e,n)?e.toLowerCase():null,si[e]=s),r}});var oi=/^(?:input|select|textarea|button)$/i;Z.fn.extend({prop:function(t,e){return ve(this,Z.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[Z.propFix[t]||t]})}}),Z.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(t,e,i){var n,r,s,o=t.nodeType;return t&&3!==o&&8!==o&&2!==o?(s=1!==o||!Z.isXMLDoc(t),s&&(e=Z.propFix[e]||e,r=Z.propHooks[e]),void 0!==i?r&&"set"in r&&void 0!==(n=r.set(t,i,e))?n:t[e]=i:r&&"get"in r&&null!==(n=r.get(t,e))?n:t[e]):void 0},propHooks:{tabIndex:{get:function(t){return t.hasAttribute("tabindex")||oi.test(t.nodeName)||t.href?t.tabIndex:-1}}}}),K.optSelected||(Z.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null}}),Z.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){Z.propFix[this.toLowerCase()]=this});var ai=/[\t\r\n\f]/g;Z.fn.extend({addClass:function(t){var e,i,n,r,s,o,a="string"==typeof t&&t,h=0,l=this.length;if(Z.isFunction(t))return this.each(function(e){Z(this).addClass(t.call(this,e,this.className))});if(a)for(e=(t||"").match(de)||[];l>h;h++)if(i=this[h],n=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(ai," "):" ")){for(s=0;r=e[s++];)n.indexOf(" "+r+" ")<0&&(n+=r+" ");o=Z.trim(n),i.className!==o&&(i.className=o)}return this},removeClass:function(t){var e,i,n,r,s,o,a=0===arguments.length||"string"==typeof t&&t,h=0,l=this.length;if(Z.isFunction(t))return this.each(function(e){Z(this).removeClass(t.call(this,e,this.className))});if(a)for(e=(t||"").match(de)||[];l>h;h++)if(i=this[h],n=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(ai," "):"")){for(s=0;r=e[s++];)for(;n.indexOf(" "+r+" ")>=0;)n=n.replace(" "+r+" "," ");o=t?Z.trim(n):"",i.className!==o&&(i.className=o)}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):this.each(Z.isFunction(t)?function(i){Z(this).toggleClass(t.call(this,i,this.className,e),e)}:function(){if("string"===i)for(var e,n=0,r=Z(this),s=t.match(de)||[];e=s[n++];)r.hasClass(e)?r.removeClass(e):r.addClass(e);else(i===Te||"boolean"===i)&&(this.className&&me.set(this,"__className__",this.className),this.className=this.className||t===!1?"":me.get(this,"__className__")||"")})},hasClass:function(t){for(var e=" "+t+" ",i=0,n=this.length;n>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(ai," ").indexOf(e)>=0)return!0;return!1}});var hi=/\r/g;Z.fn.extend({val:function(t){var e,i,n,r=this[0];return arguments.length?(n=Z.isFunction(t),this.each(function(i){var r;1===this.nodeType&&(r=n?t.call(this,i,Z(this).val()):t,null==r?r="":"number"==typeof r?r+="":Z.isArray(r)&&(r=Z.map(r,function(t){return null==t?"":t+""})),e=Z.valHooks[this.type]||Z.valHooks[this.nodeName.toLowerCase()],e&&"set"in e&&void 0!==e.set(this,r,"value")||(this.value=r))})):r?(e=Z.valHooks[r.type]||Z.valHooks[r.nodeName.toLowerCase()],e&&"get"in e&&void 0!==(i=e.get(r,"value"))?i:(i=r.value,"string"==typeof i?i.replace(hi,""):null==i?"":i)):void 0}}),Z.extend({valHooks:{option:{get:function(t){var e=Z.find.attr(t,"value");return null!=e?e:Z.trim(Z.text(t))}},select:{get:function(t){for(var e,i,n=t.options,r=t.selectedIndex,s="select-one"===t.type||0>r,o=s?null:[],a=s?r+1:n.length,h=0>r?a:s?r:0;a>h;h++)if(i=n[h],!(!i.selected&&h!==r||(K.optDisabled?i.disabled:null!==i.getAttribute("disabled"))||i.parentNode.disabled&&Z.nodeName(i.parentNode,"optgroup"))){if(e=Z(i).val(),s)return e;o.push(e)}return o},set:function(t,e){for(var i,n,r=t.options,s=Z.makeArray(e),o=r.length;o--;)n=r[o],(n.selected=Z.inArray(n.value,s)>=0)&&(i=!0);return i||(t.selectedIndex=-1),s}}}}),Z.each(["radio","checkbox"],function(){Z.valHooks[this]={set:function(t,e){return Z.isArray(e)?t.checked=Z.inArray(Z(t).val(),e)>=0:void 0}},K.checkOn||(Z.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})}),Z.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){Z.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),Z.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)},bind:function(t,e,i){return this.on(t,null,e,i)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,i,n){return this.on(e,t,i,n)},undelegate:function(t,e,i){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",i)}});var li=Z.now(),ci=/\?/;Z.parseJSON=function(t){return JSON.parse(t+"")},Z.parseXML=function(t){var e,i;if(!t||"string"!=typeof t)return null;try{i=new DOMParser,e=i.parseFromString(t,"text/xml")}catch(n){e=void 0}return(!e||e.getElementsByTagName("parsererror").length)&&Z.error("Invalid XML: "+t),e};var ui,fi,di=/#.*$/,pi=/([?&])_=[^&]*/,gi=/^(.*?):[ \t]*([^\r\n]*)$/gm,vi=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,mi=/^(?:GET|HEAD)$/,yi=/^\/\//,bi=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,xi={},_i={},wi="*/".concat("*");try{fi=location.href}catch(Ci){fi=J.createElement("a"),fi.href="",fi=fi.href}ui=bi.exec(fi.toLowerCase())||[],Z.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fi,type:"GET",isLocal:vi.test(ui[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":wi,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":Z.parseJSON,"text xml":Z.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?R(R(t,Z.ajaxSettings),e):R(Z.ajaxSettings,t)},ajaxPrefilter:M(xi),ajaxTransport:M(_i),ajax:function(t,e){function i(t,e,i,o){var h,c,m,y,x,w=e;2!==b&&(b=2,a&&clearTimeout(a),n=void 0,s=o||"",_.readyState=t>0?4:0,h=t>=200&&300>t||304===t,i&&(y=$(u,_,i)),y=F(u,y,_,h),h?(u.ifModified&&(x=_.getResponseHeader("Last-Modified"),x&&(Z.lastModified[r]=x),x=_.getResponseHeader("etag"),x&&(Z.etag[r]=x)),204===t||"HEAD"===u.type?w="nocontent":304===t?w="notmodified":(w=y.state,c=y.data,m=y.error,h=!m)):(m=w,(t||!w)&&(w="error",0>t&&(t=0))),_.status=t,_.statusText=(e||w)+"",h?p.resolveWith(f,[c,w,_]):p.rejectWith(f,[_,w,m]),_.statusCode(v),v=void 0,l&&d.trigger(h?"ajaxSuccess":"ajaxError",[_,u,h?c:m]),g.fireWith(f,[_,w]),l&&(d.trigger("ajaxComplete",[_,u]),--Z.active||Z.event.trigger("ajaxStop")))}"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,r,s,o,a,h,l,c,u=Z.ajaxSetup({},e),f=u.context||u,d=u.context&&(f.nodeType||f.jquery)?Z(f):Z.event,p=Z.Deferred(),g=Z.Callbacks("once memory"),v=u.statusCode||{},m={},y={},b=0,x="canceled",_={readyState:0,getResponseHeader:function(t){var e;if(2===b){if(!o)for(o={};e=gi.exec(s);)o[e[1].toLowerCase()]=e[2];e=o[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(t,e){var i=t.toLowerCase();return b||(t=y[i]=y[i]||t,m[t]=e),this},overrideMimeType:function(t){return b||(u.mimeType=t),this},statusCode:function(t){var e;if(t)if(2>b)for(e in t)v[e]=[v[e],t[e]];else _.always(t[_.status]);return this},abort:function(t){var e=t||x;return n&&n.abort(e),i(0,e),this}};if(p.promise(_).complete=g.add,_.success=_.done,_.error=_.fail,u.url=((t||u.url||fi)+"").replace(di,"").replace(yi,ui[1]+"//"),u.type=e.method||e.type||u.method||u.type,u.dataTypes=Z.trim(u.dataType||"*").toLowerCase().match(de)||[""],null==u.crossDomain&&(h=bi.exec(u.url.toLowerCase()),u.crossDomain=!(!h||h[1]===ui[1]&&h[2]===ui[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ui[3]||("http:"===ui[1]?"80":"443")))),u.data&&u.processData&&"string"!=typeof u.data&&(u.data=Z.param(u.data,u.traditional)),N(xi,u,e,_),2===b)return _;l=u.global,l&&0===Z.active++&&Z.event.trigger("ajaxStart"),u.type=u.type.toUpperCase(),u.hasContent=!mi.test(u.type),r=u.url,u.hasContent||(u.data&&(r=u.url+=(ci.test(r)?"&":"?")+u.data,delete u.data),u.cache===!1&&(u.url=pi.test(r)?r.replace(pi,"$1_="+li++):r+(ci.test(r)?"&":"?")+"_="+li++)),u.ifModified&&(Z.lastModified[r]&&_.setRequestHeader("If-Modified-Since",Z.lastModified[r]),Z.etag[r]&&_.setRequestHeader("If-None-Match",Z.etag[r])),(u.data&&u.hasContent&&u.contentType!==!1||e.contentType)&&_.setRequestHeader("Content-Type",u.contentType),_.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+wi+"; q=0.01":""):u.accepts["*"]);for(c in u.headers)_.setRequestHeader(c,u.headers[c]);if(u.beforeSend&&(u.beforeSend.call(f,_,u)===!1||2===b))return _.abort();x="abort";for(c in{success:1,error:1,complete:1})_[c](u[c]);if(n=N(_i,u,e,_)){_.readyState=1,l&&d.trigger("ajaxSend",[_,u]),u.async&&u.timeout>0&&(a=setTimeout(function(){_.abort("timeout")},u.timeout));try{b=1,n.send(m,i)}catch(w){if(!(2>b))throw w;i(-1,w)}}else i(-1,"No Transport");return _},getJSON:function(t,e,i){return Z.get(t,e,i,"json")},getScript:function(t,e){return Z.get(t,void 0,e,"script")}}),Z.each(["get","post"],function(t,e){Z[e]=function(t,i,n,r){return Z.isFunction(i)&&(r=r||n,n=i,i=void 0),Z.ajax({url:t,type:e,dataType:r,data:i,success:n})}}),Z.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){Z.fn[e]=function(t){return this.on(e,t)}}),Z._evalUrl=function(t){return Z.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},Z.fn.extend({wrapAll:function(t){var e;return Z.isFunction(t)?this.each(function(e){Z(this).wrapAll(t.call(this,e))}):(this[0]&&(e=Z(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this)},wrapInner:function(t){return this.each(Z.isFunction(t)?function(e){Z(this).wrapInner(t.call(this,e))}:function(){var e=Z(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=Z.isFunction(t);return this.each(function(i){Z(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(){return this.parent().each(function(){Z.nodeName(this,"body")||Z(this).replaceWith(this.childNodes)}).end()}}),Z.expr.filters.hidden=function(t){return t.offsetWidth<=0&&t.offsetHeight<=0},Z.expr.filters.visible=function(t){return!Z.expr.filters.hidden(t)};var Si=/%20/g,Ti=/\[\]$/,ki=/\r?\n/g,Oi=/^(?:submit|button|image|reset|file)$/i,Ei=/^(?:input|select|textarea|keygen)/i;Z.param=function(t,e){var i,n=[],r=function(t,e){e=Z.isFunction(e)?e():null==e?"":e,n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(void 0===e&&(e=Z.ajaxSettings&&Z.ajaxSettings.traditional),Z.isArray(t)||t.jquery&&!Z.isPlainObject(t))Z.each(t,function(){r(this.name,this.value)});else for(i in t)B(i,t[i],e,r);return n.join("&").replace(Si,"+")},Z.fn.extend({serialize:function(){return Z.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=Z.prop(this,"elements");return t?Z.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!Z(this).is(":disabled")&&Ei.test(this.nodeName)&&!Oi.test(t)&&(this.checked||!Se.test(t))}).map(function(t,e){var i=Z(this).val();return null==i?null:Z.isArray(i)?Z.map(i,function(t){return{name:e.name,value:t.replace(ki,"\r\n")}}):{name:e.name,value:i.replace(ki,"\r\n")}}).get()}}),Z.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(t){}};var Ai=0,Pi={},ji={0:200,1223:204},Di=Z.ajaxSettings.xhr();t.ActiveXObject&&Z(t).on("unload",function(){for(var t in Pi)Pi[t]()}),K.cors=!!Di&&"withCredentials"in Di,K.ajax=Di=!!Di,Z.ajaxTransport(function(t){var e;return K.cors||Di&&!t.crossDomain?{send:function(i,n){var r,s=t.xhr(),o=++Ai;if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(r in t.xhrFields)s[r]=t.xhrFields[r];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");
|
|
for(r in i)s.setRequestHeader(r,i[r]);e=function(t){return function(){e&&(delete Pi[o],e=s.onload=s.onerror=null,"abort"===t?s.abort():"error"===t?n(s.status,s.statusText):n(ji[s.status]||s.status,s.statusText,"string"==typeof s.responseText?{text:s.responseText}:void 0,s.getAllResponseHeaders()))}},s.onload=e(),s.onerror=e("error"),e=Pi[o]=e("abort");try{s.send(t.hasContent&&t.data||null)}catch(a){if(e)throw a}},abort:function(){e&&e()}}:void 0}),Z.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(t){return Z.globalEval(t),t}}}),Z.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),Z.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,r){e=Z("<script>").prop({async:!0,charset:t.scriptCharset,src:t.url}).on("load error",i=function(t){e.remove(),i=null,t&&r("error"===t.type?404:200,t.type)}),J.head.appendChild(e[0])},abort:function(){i&&i()}}}});var Li=[],Ii=/(=)\?(?=&|$)|\?\?/;Z.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Li.pop()||Z.expando+"_"+li++;return this[t]=!0,t}}),Z.ajaxPrefilter("json jsonp",function(e,i,n){var r,s,o,a=e.jsonp!==!1&&(Ii.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ii.test(e.data)&&"data");return a||"jsonp"===e.dataTypes[0]?(r=e.jsonpCallback=Z.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ii,"$1"+r):e.jsonp!==!1&&(e.url+=(ci.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||Z.error(r+" was not called"),o[0]},e.dataTypes[0]="json",s=t[r],t[r]=function(){o=arguments},n.always(function(){t[r]=s,e[r]&&(e.jsonpCallback=i.jsonpCallback,Li.push(r)),o&&Z.isFunction(s)&&s(o[0]),o=s=void 0}),"script"):void 0}),Z.parseHTML=function(t,e,i){if(!t||"string"!=typeof t)return null;"boolean"==typeof e&&(i=e,e=!1),e=e||J;var n=oe.exec(t),r=!i&&[];return n?[e.createElement(n[1])]:(n=Z.buildFragment([t],e,r),r&&r.length&&Z(r).remove(),Z.merge([],n.childNodes))};var Mi=Z.fn.load;Z.fn.load=function(t,e,i){if("string"!=typeof t&&Mi)return Mi.apply(this,arguments);var n,r,s,o=this,a=t.indexOf(" ");return a>=0&&(n=Z.trim(t.slice(a)),t=t.slice(0,a)),Z.isFunction(e)?(i=e,e=void 0):e&&"object"==typeof e&&(r="POST"),o.length>0&&Z.ajax({url:t,type:r,dataType:"html",data:e}).done(function(t){s=arguments,o.html(n?Z("<div>").append(Z.parseHTML(t)).find(n):t)}).complete(i&&function(t,e){o.each(i,s||[t.responseText,e,t])}),this},Z.expr.filters.animated=function(t){return Z.grep(Z.timers,function(e){return t===e.elem}).length};var Ni=t.document.documentElement;Z.offset={setOffset:function(t,e,i){var n,r,s,o,a,h,l,c=Z.css(t,"position"),u=Z(t),f={};"static"===c&&(t.style.position="relative"),a=u.offset(),s=Z.css(t,"top"),h=Z.css(t,"left"),l=("absolute"===c||"fixed"===c)&&(s+h).indexOf("auto")>-1,l?(n=u.position(),o=n.top,r=n.left):(o=parseFloat(s)||0,r=parseFloat(h)||0),Z.isFunction(e)&&(e=e.call(t,i,a)),null!=e.top&&(f.top=e.top-a.top+o),null!=e.left&&(f.left=e.left-a.left+r),"using"in e?e.using.call(t,f):u.css(f)}},Z.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){Z.offset.setOffset(this,t,e)});var e,i,n=this[0],r={top:0,left:0},s=n&&n.ownerDocument;return s?(e=s.documentElement,Z.contains(e,n)?(typeof n.getBoundingClientRect!==Te&&(r=n.getBoundingClientRect()),i=H(s),{top:r.top+i.pageYOffset-e.clientTop,left:r.left+i.pageXOffset-e.clientLeft}):r):void 0},position:function(){if(this[0]){var t,e,i=this[0],n={top:0,left:0};return"fixed"===Z.css(i,"position")?e=i.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),Z.nodeName(t[0],"html")||(n=t.offset()),n.top+=Z.css(t[0],"borderTopWidth",!0),n.left+=Z.css(t[0],"borderLeftWidth",!0)),{top:e.top-n.top-Z.css(i,"marginTop",!0),left:e.left-n.left-Z.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||Ni;t&&!Z.nodeName(t,"html")&&"static"===Z.css(t,"position");)t=t.offsetParent;return t||Ni})}}),Z.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,i){var n="pageYOffset"===i;Z.fn[e]=function(r){return ve(this,function(e,r,s){var o=H(e);return void 0===s?o?o[i]:e[r]:void(o?o.scrollTo(n?t.pageXOffset:s,n?s:t.pageYOffset):e[r]=s)},e,r,arguments.length,null)}}),Z.each(["top","left"],function(t,e){Z.cssHooks[e]=w(K.pixelPosition,function(t,i){return i?(i=_(t,e),We.test(i)?Z(t).position()[e]+"px":i):void 0})}),Z.each({Height:"height",Width:"width"},function(t,e){Z.each({padding:"inner"+t,content:e,"":"outer"+t},function(i,n){Z.fn[n]=function(n,r){var s=arguments.length&&(i||"boolean"!=typeof n),o=i||(n===!0||r===!0?"margin":"border");return ve(this,function(e,i,n){var r;return Z.isWindow(e)?e.document.documentElement["client"+t]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+t],r["scroll"+t],e.body["offset"+t],r["offset"+t],r["client"+t])):void 0===n?Z.css(e,i,o):Z.style(e,i,n,o)},e,s?n:void 0,s,null)}})}),Z.fn.size=function(){return this.length},Z.fn.andSelf=Z.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return Z});var Ri=t.jQuery,$i=t.$;return Z.noConflict=function(e){return t.$===Z&&(t.$=$i),e&&t.jQuery===Z&&(t.jQuery=Ri),Z},typeof e===Te&&(t.jQuery=t.$=Z),Z}),"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]};return!1}t.fn.emulateTransitionEnd=function(e){var i=!1,n=this;t(this).one("bsTransitionEnd",function(){i=!0});var r=function(){i||t(n).trigger(t.support.transition.end)};return setTimeout(r,e),this},t(function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){return t(e.target).is(this)?e.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),r=i.data("bs.alert");r||i.data("bs.alert",r=new n(this)),"string"==typeof e&&r[e].call(i)})}var i='[data-dismiss="alert"]',n=function(e){t(e).on("click",i,this.close)};n.VERSION="3.2.0",n.prototype.close=function(e){function i(){s.detach().trigger("closed.bs.alert").remove()}var n=t(this),r=n.attr("data-target");r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));var s=t(r);e&&e.preventDefault(),s.length||(s=n.hasClass("alert")?n:n.parent()),s.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(s.removeClass("in"),t.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",i).emulateTransitionEnd(150):i())};var r=t.fn.alert;t.fn.alert=e,t.fn.alert.Constructor=n,t.fn.alert.noConflict=function(){return t.fn.alert=r,this},t(document).on("click.bs.alert.data-api",i,n.prototype.close)}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),r=n.data("bs.button"),s="object"==typeof e&&e;r||n.data("bs.button",r=new i(this,s)),"toggle"==e?r.toggle():e&&r.setState(e)})}var i=function(e,n){this.$element=t(e),this.options=t.extend({},i.DEFAULTS,n),this.isLoading=!1};i.VERSION="3.2.0",i.DEFAULTS={loadingText:"loading..."},i.prototype.setState=function(e){var i="disabled",n=this.$element,r=n.is("input")?"val":"html",s=n.data();e+="Text",null==s.resetText&&n.data("resetText",n[r]()),n[r](null==s[e]?this.options[e]:s[e]),setTimeout(t.proxy(function(){"loadingText"==e?(this.isLoading=!0,n.addClass(i).attr(i,i)):this.isLoading&&(this.isLoading=!1,n.removeClass(i).removeAttr(i))},this),0)},i.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")&&(i.prop("checked")&&this.$element.hasClass("active")?t=!1:e.find(".active").removeClass("active")),t&&i.prop("checked",!this.$element.hasClass("active")).trigger("change")}t&&this.$element.toggleClass("active")};var n=t.fn.button;t.fn.button=e,t.fn.button.Constructor=i,t.fn.button.noConflict=function(){return t.fn.button=n,this},t(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(i){var n=t(i.target);n.hasClass("btn")||(n=n.closest(".btn")),e.call(n,"toggle"),i.preventDefault()})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),r=n.data("bs.carousel"),s=t.extend({},i.DEFAULTS,n.data(),"object"==typeof e&&e),o="string"==typeof e?e:s.slide;r||n.data("bs.carousel",r=new i(this,s)),"number"==typeof e?r.to(e):o?r[o]():s.interval&&r.pause().cycle()})}var i=function(e,i){this.$element=t(e).on("keydown.bs.carousel",t.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",t.proxy(this.pause,this)).on("mouseleave.bs.carousel",t.proxy(this.cycle,this))};i.VERSION="3.2.0",i.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},i.prototype.keydown=function(t){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()},i.prototype.cycle=function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},i.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},i.prototype.to=function(e){var i=this,n=this.getItemIndex(this.$active=this.$element.find(".item.active"));return e>this.$items.length-1||0>e?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){i.to(e)}):n==e?this.pause().cycle():this.slide(e>n?"next":"prev",t(this.$items[e]))},i.prototype.pause=function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},i.prototype.next=function(){return this.sliding?void 0:this.slide("next")},i.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},i.prototype.slide=function(e,i){var n=this.$element.find(".item.active"),r=i||n[e](),s=this.interval,o="next"==e?"left":"right",a="next"==e?"first":"last",h=this;if(!r.length){if(!this.options.wrap)return;r=this.$element.find(".item")[a]()}if(r.hasClass("active"))return this.sliding=!1;var l=r[0],c=t.Event("slide.bs.carousel",{relatedTarget:l,direction:o});if(this.$element.trigger(c),!c.isDefaultPrevented()){if(this.sliding=!0,s&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var u=t(this.$indicators.children()[this.getItemIndex(r)]);u&&u.addClass("active")}var f=t.Event("slid.bs.carousel",{relatedTarget:l,direction:o});return t.support.transition&&this.$element.hasClass("slide")?(r.addClass(e),r[0].offsetWidth,n.addClass(o),r.addClass(o),n.one("bsTransitionEnd",function(){r.removeClass([e,o].join(" ")).addClass("active"),n.removeClass(["active",o].join(" ")),h.sliding=!1,setTimeout(function(){h.$element.trigger(f)},0)}).emulateTransitionEnd(1e3*n.css("transition-duration").slice(0,-1))):(n.removeClass("active"),r.addClass("active"),this.sliding=!1,this.$element.trigger(f)),s&&this.cycle(),this}};var n=t.fn.carousel;t.fn.carousel=e,t.fn.carousel.Constructor=i,t.fn.carousel.noConflict=function(){return t.fn.carousel=n,this},t(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(i){var n,r=t(this),s=t(r.attr("data-target")||(n=r.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var o=t.extend({},s.data(),r.data()),a=r.attr("data-slide-to");a&&(o.interval=!1),e.call(s,o),a&&s.data("bs.carousel").to(a),i.preventDefault()}}),t(window).on("load",function(){t('[data-ride="carousel"]').each(function(){var i=t(this);e.call(i,i.data())})})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),r=n.data("bs.collapse"),s=t.extend({},i.DEFAULTS,n.data(),"object"==typeof e&&e);!r&&s.toggle&&"show"==e&&(e=!e),r||n.data("bs.collapse",r=new i(this,s)),"string"==typeof e&&r[e]()})}var i=function(e,n){this.$element=t(e),this.options=t.extend({},i.DEFAULTS,n),this.transitioning=null,this.options.parent&&(this.$parent=t(this.options.parent)),this.options.toggle&&this.toggle()};i.VERSION="3.2.0",i.DEFAULTS={toggle:!0},i.prototype.dimension=function(){var t=this.$element.hasClass("width");return t?"width":"height"},i.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var i=t.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){var n=this.$parent&&this.$parent.find("> .panel > .in");if(n&&n.length){var r=n.data("bs.collapse");if(r&&r.transitioning)return;e.call(n,"hide"),r||n.data("bs.collapse",null)}var s=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[s](0),this.transitioning=1;var o=function(){this.$element.removeClass("collapsing").addClass("collapse in")[s](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return o.call(this);var a=t.camelCase(["scroll",s].join("-"));this.$element.one("bsTransitionEnd",t.proxy(o,this)).emulateTransitionEnd(350)[s](this.$element[0][a])}}},i.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var i=this.dimension();this.$element[i](this.$element[i]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var n=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return t.support.transition?void this.$element[i](0).one("bsTransitionEnd",t.proxy(n,this)).emulateTransitionEnd(350):n.call(this)}}},i.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var n=t.fn.collapse;t.fn.collapse=e,t.fn.collapse.Constructor=i,t.fn.collapse.noConflict=function(){return t.fn.collapse=n,this},t(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(i){var n,r=t(this),s=r.attr("data-target")||i.preventDefault()||(n=r.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""),o=t(s),a=o.data("bs.collapse"),h=a?"toggle":r.data(),l=r.attr("data-parent"),c=l&&t(l);a&&a.transitioning||(c&&c.find('[data-toggle="collapse"][data-parent="'+l+'"]').not(r).addClass("collapsed"),r[o.hasClass("in")?"addClass":"removeClass"]("collapsed")),e.call(o,h)})}(jQuery),+function(t){"use strict";function e(e){e&&3===e.which||(t(r).remove(),t(s).each(function(){var n=i(t(this)),r={relatedTarget:this};n.hasClass("open")&&(n.trigger(e=t.Event("hide.bs.dropdown",r)),e.isDefaultPrevented()||n.removeClass("open").trigger("hidden.bs.dropdown",r))}))}function i(e){var i=e.attr("data-target");i||(i=e.attr("href"),i=i&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,""));var n=i&&t(i);return n&&n.length?n:e.parent()}function n(e){return this.each(function(){var i=t(this),n=i.data("bs.dropdown");n||i.data("bs.dropdown",n=new o(this)),"string"==typeof e&&n[e].call(i)})}var r=".dropdown-backdrop",s='[data-toggle="dropdown"]',o=function(e){t(e).on("click.bs.dropdown",this.toggle)};o.VERSION="3.2.0",o.prototype.toggle=function(n){var r=t(this);if(!r.is(".disabled, :disabled")){var s=i(r),o=s.hasClass("open");if(e(),!o){"ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&t('<div class="dropdown-backdrop"/>').insertAfter(t(this)).on("click",e);var a={relatedTarget:this};if(s.trigger(n=t.Event("show.bs.dropdown",a)),n.isDefaultPrevented())return;r.trigger("focus"),s.toggleClass("open").trigger("shown.bs.dropdown",a)}return!1}},o.prototype.keydown=function(e){if(/(38|40|27)/.test(e.keyCode)){var n=t(this);if(e.preventDefault(),e.stopPropagation(),!n.is(".disabled, :disabled")){var r=i(n),o=r.hasClass("open");if(!o||o&&27==e.keyCode)return 27==e.which&&r.find(s).trigger("focus"),n.trigger("click");var a=" li:not(.divider):visible a",h=r.find('[role="menu"]'+a+', [role="listbox"]'+a);if(h.length){var l=h.index(h.filter(":focus"));38==e.keyCode&&l>0&&l--,40==e.keyCode&&l<h.length-1&&l++,~l||(l=0),h.eq(l).trigger("focus")}}}};var a=t.fn.dropdown;t.fn.dropdown=n,t.fn.dropdown.Constructor=o,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=a,this},t(document).on("click.bs.dropdown.data-api",e).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",s,o.prototype.toggle).on("keydown.bs.dropdown.data-api",s+', [role="menu"], [role="listbox"]',o.prototype.keydown)}(jQuery),+function(t){"use strict";function e(e,n){return this.each(function(){var r=t(this),s=r.data("bs.modal"),o=t.extend({},i.DEFAULTS,r.data(),"object"==typeof e&&e);s||r.data("bs.modal",s=new i(this,o)),"string"==typeof e?s[e](n):o.show&&s.show(n)})}var i=function(e,i){this.options=i,this.$body=t(document.body),this.$element=t(e),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,t.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};i.VERSION="3.2.0",i.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},i.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},i.prototype.show=function(e){var i=this,n=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',t.proxy(this.hide,this)),this.backdrop(function(){var n=t.support.transition&&i.$element.hasClass("fade");i.$element.parent().length||i.$element.appendTo(i.$body),i.$element.show().scrollTop(0),n&&i.$element[0].offsetWidth,i.$element.addClass("in").attr("aria-hidden",!1),i.enforceFocus();var r=t.Event("shown.bs.modal",{relatedTarget:e});n?i.$element.find(".modal-dialog").one("bsTransitionEnd",function(){i.$element.trigger("focus").trigger(r)}).emulateTransitionEnd(300):i.$element.trigger("focus").trigger(r)}))},i.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),t(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),t.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",t.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},i.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy(function(t){this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},i.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",t.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},i.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$element.trigger("hidden.bs.modal")})},i.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},i.prototype.backdrop=function(e){var i=this,n=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var r=t.support.transition&&n;if(this.$backdrop=t('<div class="modal-backdrop '+n+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",t.proxy(function(t){t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;r?this.$backdrop.one("bsTransitionEnd",e).emulateTransitionEnd(150):e()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var s=function(){i.removeBackdrop(),e&&e()};t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",s).emulateTransitionEnd(150):s()}else e&&e()},i.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},i.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",t+this.scrollbarWidth)},i.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},i.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var n=t.fn.modal;t.fn.modal=e,t.fn.modal.Constructor=i,t.fn.modal.noConflict=function(){return t.fn.modal=n,this},t(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(i){var n=t(this),r=n.attr("href"),s=t(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),o=s.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(r)&&r},s.data(),n.data());n.is("a")&&i.preventDefault(),s.one("show.bs.modal",function(t){t.isDefaultPrevented()||s.one("hidden.bs.modal",function(){n.is(":visible")&&n.trigger("focus")})}),e.call(s,o,this)})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),r=n.data("bs.tooltip"),s="object"==typeof e&&e;(r||"destroy"!=e)&&(r||n.data("bs.tooltip",r=new i(this,s)),"string"==typeof e&&r[e]())})}var i=function(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",t,e)};i.VERSION="3.2.0",i.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},i.prototype.init=function(e,i,n){this.enabled=!0,this.type=e,this.$element=t(i),this.options=this.getOptions(n),this.$viewport=this.options.viewport&&t(this.options.viewport.selector||this.options.viewport);for(var r=this.options.trigger.split(" "),s=r.length;s--;){var o=r[s];if("click"==o)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=o){var a="hover"==o?"mouseenter":"focusin",h="hover"==o?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(h+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},i.prototype.getDelegateOptions=function(){var e={},i=this.getDefaults();return this._options&&t.each(this._options,function(t,n){i[t]!=n&&(e[t]=n)}),e},i.prototype.enter=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),clearTimeout(i.timeout),i.hoverState="in",i.options.delay&&i.options.delay.show?void(i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)):i.show()},i.prototype.leave=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),clearTimeout(i.timeout),i.hoverState="out",i.options.delay&&i.options.delay.hide?void(i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)):i.hide()},i.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var i=t.contains(document.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!i)return;var n=this,r=this.tip(),s=this.getUID(this.type);this.setContent(),r.attr("id",s),this.$element.attr("aria-describedby",s),this.options.animation&&r.addClass("fade");var o="function"==typeof this.options.placement?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,h=a.test(o);h&&(o=o.replace(a,"")||"top"),r.detach().css({top:0,left:0,display:"block"}).addClass(o).data("bs."+this.type,this),this.options.container?r.appendTo(this.options.container):r.insertAfter(this.$element);var l=this.getPosition(),c=r[0].offsetWidth,u=r[0].offsetHeight;if(h){var f=o,d=this.$element.parent(),p=this.getPosition(d);o="bottom"==o&&l.top+l.height+u-p.scroll>p.height?"top":"top"==o&&l.top-p.scroll-u<0?"bottom":"right"==o&&l.right+c>p.width?"left":"left"==o&&l.left-c<p.left?"right":o,r.removeClass(f).addClass(o)}var g=this.getCalculatedOffset(o,l,c,u);this.applyPlacement(g,o);var v=function(){n.$element.trigger("shown.bs."+n.type),n.hoverState=null};t.support.transition&&this.$tip.hasClass("fade")?r.one("bsTransitionEnd",v).emulateTransitionEnd(150):v()}},i.prototype.applyPlacement=function(e,i){var n=this.tip(),r=n[0].offsetWidth,s=n[0].offsetHeight,o=parseInt(n.css("margin-top"),10),a=parseInt(n.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(a)&&(a=0),e.top=e.top+o,e.left=e.left+a,t.offset.setOffset(n[0],t.extend({using:function(t){n.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),n.addClass("in");var h=n[0].offsetWidth,l=n[0].offsetHeight;"top"==i&&l!=s&&(e.top=e.top+s-l);var c=this.getViewportAdjustedDelta(i,e,h,l);c.left?e.left+=c.left:e.top+=c.top;var u=c.left?2*c.left-r+h:2*c.top-s+l,f=c.left?"left":"top",d=c.left?"offsetWidth":"offsetHeight";n.offset(e),this.replaceArrow(u,n[0][d],f)},i.prototype.replaceArrow=function(t,e,i){this.arrow().css(i,t?50*(1-t/e)+"%":"")},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},i.prototype.hide=function(){function e(){"in"!=i.hoverState&&n.detach(),i.$element.trigger("hidden.bs."+i.type)}var i=this,n=this.tip(),r=t.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(r),r.isDefaultPrevented()?void 0:(n.removeClass("in"),t.support.transition&&this.$tip.hasClass("fade")?n.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),this.hoverState=null,this)},i.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},i.prototype.hasContent=function(){return this.getTitle()},i.prototype.getPosition=function(e){e=e||this.$element;var i=e[0],n="BODY"==i.tagName;return t.extend({},"function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,{scroll:n?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop(),width:n?t(window).width():e.outerWidth(),height:n?t(window).height():e.outerHeight()},n?{top:0,left:0}:e.offset())},i.prototype.getCalculatedOffset=function(t,e,i,n){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-n,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-n/2,left:e.left-i}:{top:e.top+e.height/2-n/2,left:e.left+e.width}},i.prototype.getViewportAdjustedDelta=function(t,e,i,n){var r={top:0,left:0};if(!this.$viewport)return r;var s=this.options.viewport&&this.options.viewport.padding||0,o=this.getPosition(this.$viewport);if(/right|left/.test(t)){var a=e.top-s-o.scroll,h=e.top+s-o.scroll+n;a<o.top?r.top=o.top-a:h>o.top+o.height&&(r.top=o.top+o.height-h)}else{var l=e.left-s,c=e.left+s+i;l<o.left?r.left=o.left-l:c>o.width&&(r.left=o.left+o.width-c)}return r},i.prototype.getTitle=function(){var t,e=this.$element,i=this.options;return t=e.attr("data-original-title")||("function"==typeof i.title?i.title.call(e[0]):i.title)},i.prototype.getUID=function(t){do t+=~~(1e6*Math.random());while(document.getElementById(t));return t},i.prototype.tip=function(){return this.$tip=this.$tip||t(this.options.template)},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},i.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},i.prototype.enable=function(){this.enabled=!0},i.prototype.disable=function(){this.enabled=!1},i.prototype.toggleEnabled=function(){this.enabled=!this.enabled},i.prototype.toggle=function(e){var i=this;e&&(i=t(e.currentTarget).data("bs."+this.type),i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i))),i.tip().hasClass("in")?i.leave(i):i.enter(i)},i.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var n=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=i,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=n,this}}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),r=n.data("bs.popover"),s="object"==typeof e&&e;(r||"destroy"!=e)&&(r||n.data("bs.popover",r=new i(this,s)),"string"==typeof e&&r[e]())})}var i=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");i.VERSION="3.2.0",i.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),i.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),i.prototype.constructor=i,i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content").empty()[this.options.html?"string"==typeof i?"html":"append":"text"](i),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},i.prototype.hasContent=function(){return this.getTitle()||this.getContent()},i.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},i.prototype.tip=function(){return this.$tip||(this.$tip=t(this.options.template)),this.$tip};var n=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=i,t.fn.popover.noConflict=function(){return t.fn.popover=n,this}}(jQuery),+function(t){"use strict";function e(i,n){var r=t.proxy(this.process,this);this.$body=t("body"),this.$scrollElement=t(t(i).is("body")?window:i),this.options=t.extend({},e.DEFAULTS,n),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",r),this.refresh(),this.process()}function i(i){return this.each(function(){var n=t(this),r=n.data("bs.scrollspy"),s="object"==typeof i&&i;r||n.data("bs.scrollspy",r=new e(this,s)),"string"==typeof i&&r[i]()})}e.VERSION="3.2.0",e.DEFAULTS={offset:10},e.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},e.prototype.refresh=function(){var e="offset",i=0;
|
|
t.isWindow(this.$scrollElement[0])||(e="position",i=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var n=this;this.$body.find(this.selector).map(function(){var n=t(this),r=n.data("target")||n.attr("href"),s=/^#./.test(r)&&t(r);return s&&s.length&&s.is(":visible")&&[[s[e]().top+i,r]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){n.offsets.push(this[0]),n.targets.push(this[1])})},e.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),n=this.options.offset+i-this.$scrollElement.height(),r=this.offsets,s=this.targets,o=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),e>=n)return o!=(t=s[s.length-1])&&this.activate(t);if(o&&e<=r[0])return o!=(t=s[0])&&this.activate(t);for(t=r.length;t--;)o!=s[t]&&e>=r[t]&&(!r[t+1]||e<=r[t+1])&&this.activate(s[t])},e.prototype.activate=function(e){this.activeTarget=e,t(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var i=this.selector+'[data-target="'+e+'"],'+this.selector+'[href="'+e+'"]',n=t(i).parents("li").addClass("active");n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate.bs.scrollspy")};var n=t.fn.scrollspy;t.fn.scrollspy=i,t.fn.scrollspy.Constructor=e,t.fn.scrollspy.noConflict=function(){return t.fn.scrollspy=n,this},t(window).on("load.bs.scrollspy.data-api",function(){t('[data-spy="scroll"]').each(function(){var e=t(this);i.call(e,e.data())})})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),r=n.data("bs.tab");r||n.data("bs.tab",r=new i(this)),"string"==typeof e&&r[e]()})}var i=function(e){this.element=t(e)};i.VERSION="3.2.0",i.prototype.show=function(){var e=this.element,i=e.closest("ul:not(.dropdown-menu)"),n=e.data("target");if(n||(n=e.attr("href"),n=n&&n.replace(/.*(?=#[^\s]*$)/,"")),!e.parent("li").hasClass("active")){var r=i.find(".active:last a")[0],s=t.Event("show.bs.tab",{relatedTarget:r});if(e.trigger(s),!s.isDefaultPrevented()){var o=t(n);this.activate(e.closest("li"),i),this.activate(o,o.parent(),function(){e.trigger({type:"shown.bs.tab",relatedTarget:r})})}}},i.prototype.activate=function(e,i,n){function r(){s.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),e.addClass("active"),o?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu")&&e.closest("li.dropdown").addClass("active"),n&&n()}var s=i.find("> .active"),o=n&&t.support.transition&&s.hasClass("fade");o?s.one("bsTransitionEnd",r).emulateTransitionEnd(150):r(),s.removeClass("in")};var n=t.fn.tab;t.fn.tab=e,t.fn.tab.Constructor=i,t.fn.tab.noConflict=function(){return t.fn.tab=n,this},t(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(i){i.preventDefault(),e.call(t(this),"show")})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),r=n.data("bs.affix"),s="object"==typeof e&&e;r||n.data("bs.affix",r=new i(this,s)),"string"==typeof e&&r[e]()})}var i=function(e,n){this.options=t.extend({},i.DEFAULTS,n),this.$target=t(this.options.target).on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.2.0",i.RESET="affix affix-top affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},i.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=t(document).height(),n=this.$target.scrollTop(),r=this.$element.offset(),s=this.options.offset,o=s.top,a=s.bottom;"object"!=typeof s&&(a=o=s),"function"==typeof o&&(o=s.top(this.$element)),"function"==typeof a&&(a=s.bottom(this.$element));var h=null!=this.unpin&&n+this.unpin<=r.top?!1:null!=a&&r.top+this.$element.height()>=e-a?"bottom":null!=o&&o>=n?"top":!1;if(this.affixed!==h){null!=this.unpin&&this.$element.css("top","");var l="affix"+(h?"-"+h:""),c=t.Event(l+".bs.affix");this.$element.trigger(c),c.isDefaultPrevented()||(this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(l).trigger(t.Event(l.replace("affix","affixed"))),"bottom"==h&&this.$element.offset({top:e-this.$element.height()-a}))}}};var n=t.fn.affix;t.fn.affix=e,t.fn.affix.Constructor=i,t.fn.affix.noConflict=function(){return t.fn.affix=n,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var i=t(this),n=i.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),e.call(i,n)})})}(jQuery);var fabric=fabric||{version:"1.4.11"};"undefined"!=typeof exports&&(exports.fabric=fabric),"undefined"!=typeof document&&"undefined"!=typeof window?(fabric.document=document,fabric.window=window):(fabric.document=require("jsdom").jsdom("<!DOCTYPE html><html><head></head><body></body></html>"),fabric.window=fabric.document.createWindow()),fabric.isTouchSupported="ontouchstart"in fabric.document.documentElement,fabric.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,fabric.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width"],fabric.DPI=96,function(){function t(t,e){this.__eventListeners[t]&&(e?fabric.util.removeFromArray(this.__eventListeners[t],e):this.__eventListeners[t].length=0)}function e(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this}function i(e,i){if(this.__eventListeners){if(0===arguments.length)this.__eventListeners={};else if(1===arguments.length&&"object"==typeof arguments[0])for(var n in e)t.call(this,n,e[n]);else t.call(this,e,i);return this}}function n(t,e){if(this.__eventListeners){var i=this.__eventListeners[t];if(i){for(var n=0,r=i.length;r>n;n++)i[n].call(this,e||{});return this}}}fabric.Observable={observe:e,stopObserving:i,fire:n,on:e,off:i,trigger:n}}(),fabric.Collection={add:function(){this._objects.push.apply(this._objects,arguments);for(var t=0,e=arguments.length;e>t;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.renderAll(),this},insertAt:function(t,e,i){var n=this.getObjects();return i?n[e]=t:n.splice(e,0,t),this._onObjectAdded(t),this.renderOnAddRemove&&this.renderAll(),this},remove:function(){for(var t,e=this.getObjects(),i=0,n=arguments.length;n>i;i++)t=e.indexOf(arguments[i]),-1!==t&&(e.splice(t,1),this._onObjectRemoved(arguments[i]));return this.renderOnAddRemove&&this.renderAll(),this},forEachObject:function(t,e){for(var i=this.getObjects(),n=i.length;n--;)t.call(e,i[n],n,i);return this},getObjects:function(t){return"undefined"==typeof t?this._objects:this._objects.filter(function(e){return e.type===t})},item:function(t){return this.getObjects()[t]},isEmpty:function(){return 0===this.getObjects().length},size:function(){return this.getObjects().length},contains:function(t){return this.getObjects().indexOf(t)>-1},complexity:function(){return this.getObjects().reduce(function(t,e){return t+=e.complexity?e.complexity():0},0)}},function(t){var e=Math.sqrt,i=Math.atan2,n=Math.PI/180;fabric.util={removeFromArray:function(t,e){var i=t.indexOf(e);return-1!==i&&t.splice(i,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*n},radiansToDegrees:function(t){return t/n},rotatePoint:function(t,e,i){var n=Math.sin(i),r=Math.cos(i);t.subtractEquals(e);var s=t.x*r-t.y*n,o=t.x*n+t.y*r;return new fabric.Point(s,o).addEquals(e)},transformPoint:function(t,e,i){return i?new fabric.Point(e[0]*t.x+e[1]*t.y,e[2]*t.x+e[3]*t.y):new fabric.Point(e[0]*t.x+e[1]*t.y+e[4],e[2]*t.x+e[3]*t.y+e[5])},invertTransform:function(t){var e=t.slice(),i=1/(t[0]*t[3]-t[1]*t[2]);e=[i*t[3],-i*t[1],-i*t[2],i*t[0],0,0];var n=fabric.util.transformPoint({x:t[4],y:t[5]},e);return e[4]=-n.x,e[5]=-n.y,e},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t){var e=/\D{0,2}$/.exec(t),i=parseFloat(t);switch(e[0]){case"mm":return i*fabric.DPI/25.4;case"cm":return i*fabric.DPI/2.54;case"in":return i*fabric.DPI;case"pt":return i*fabric.DPI/72;case"pc":return i*fabric.DPI/72*12;default:return i}},falseFunction:function(){return!1},getKlass:function(t,e){return t=fabric.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),fabric.util.resolveNamespace(e)[t]},resolveNamespace:function(e){if(!e)return fabric;for(var i=e.split("."),n=i.length,r=t||fabric.window,s=0;n>s;++s)r=r[i[s]];return r},loadImage:function(t,e,i,n){if(!t)return void(e&&e.call(i,t));var r=fabric.util.createImage();r.onload=function(){e&&e.call(i,r),r=r.onload=r.onerror=null},r.onerror=function(){fabric.log("Error loading "+r.src),e&&e.call(i,null,!0),r=r.onload=r.onerror=null},0!==t.indexOf("data")&&"undefined"!=typeof n&&(r.crossOrigin=n),r.src=t},enlivenObjects:function(t,e,i,n){function r(){++o===a&&e&&e(s)}t=t||[];var s=[],o=0,a=t.length;return a?void t.forEach(function(t,e){if(!t||!t.type)return void r();var o=fabric.util.getKlass(t.type,i);o.async?o.fromObject(t,function(i,o){o||(s[e]=i,n&&n(t,s[e])),r()}):(s[e]=o.fromObject(t),n&&n(t,s[e]),r())}):void(e&&e(s))},groupSVGElements:function(t,e,i){var n;return n=new fabric.PathGroup(t,e),"undefined"!=typeof i&&n.setSourcePath(i),n},populateWithProperties:function(t,e,i){if(i&&"[object Array]"===Object.prototype.toString.call(i))for(var n=0,r=i.length;r>n;n++)i[n]in t&&(e[i[n]]=t[i[n]])},drawDashedLine:function(t,n,r,s,o,a){var h=s-n,l=o-r,c=e(h*h+l*l),u=i(l,h),f=a.length,d=0,p=!0;for(t.save(),t.translate(n,r),t.moveTo(0,0),t.rotate(u),n=0;c>n;)n+=a[d++%f],n>c&&(n=c),t[p?"lineTo":"moveTo"](n,0),p=!p;t.restore()},createCanvasElement:function(t){return t||(t=fabric.document.createElement("canvas")),!t.getContext&&"undefined"!=typeof G_vmlCanvasManager&&G_vmlCanvasManager.initElement(t),t},createImage:function(){return fabric.isLikelyNode?new(require("canvas").Image):fabric.document.createElement("img")},createAccessors:function(t){for(var e=t.prototype,i=e.stateProperties.length;i--;){var n=e.stateProperties[i],r=n.charAt(0).toUpperCase()+n.slice(1),s="set"+r,o="get"+r;e[o]||(e[o]=function(t){return new Function('return this.get("'+t+'")')}(n)),e[s]||(e[s]=function(t){return new Function("value",'return this.set("'+t+'", value)')}(n))}},clipContext:function(t,e){e.save(),e.beginPath(),t.clipTo(e),e.clip()},multiplyTransformMatrices:function(t,e){for(var i=[[t[0],t[2],t[4]],[t[1],t[3],t[5]],[0,0,1]],n=[[e[0],e[2],e[4]],[e[1],e[3],e[5]],[0,0,1]],r=[],s=0;3>s;s++){r[s]=[];for(var o=0;3>o;o++){for(var a=0,h=0;3>h;h++)a+=i[s][h]*n[h][o];r[s][o]=a}}return[r[0][0],r[1][0],r[0][1],r[1][1],r[0][2],r[1][2]]},getFunctionBody:function(t){return(String(t).match(/function[^{]*\{([\s\S]*)\}/)||{})[1]},isTransparent:function(t,e,i,n){n>0&&(e>n?e-=n:e=0,i>n?i-=n:i=0);for(var r=!0,s=t.getImageData(e,i,2*n||1,2*n||1),o=3,a=s.data.length;a>o;o+=4){var h=s.data[o];if(r=0>=h,r===!1)break}return s=null,r}}}("undefined"!=typeof exports?exports:this),function(){function t(t,r,o,a,h,l,c){var u=s.call(arguments);if(n[u])return n[u];var f=Math.PI,d=c*(f/180),p=Math.sin(d),g=Math.cos(d),v=0,m=0;o=Math.abs(o),a=Math.abs(a);var y=-g*t-p*r,b=-g*r+p*t,x=o*o,_=a*a,w=b*b,C=y*y,S=4*x*_-x*w-_*C,T=0;if(0>S){var k=Math.sqrt(1-.25*S/(x*_));o*=k,a*=k}else T=(h===l?-.5:.5)*Math.sqrt(S/(x*w+_*C));var O=T*o*b/a,E=-T*a*y/o,A=g*O-p*E+t/2,P=p*O+g*E+r/2,j=i(1,0,(y-O)/o,(b-E)/a),D=i((y-O)/o,(b-E)/a,(-y-O)/o,(-b-E)/a);0===l&&D>0?D-=2*f:1===l&&0>D&&(D+=2*f);for(var L=Math.ceil(Math.abs(D/(.5*f))),I=[],M=D/L,N=8/3*Math.sin(M/4)*Math.sin(M/4)/Math.sin(M/2),R=j+M,$=0;L>$;$++)I[$]=e(j,R,g,p,o,a,A,P,N,v,m),v=I[$][4],m=I[$][5],j+=M,R+=M;return n[u]=I,I}function e(t,e,i,n,o,a,h,l,c,u,f){var d=s.call(arguments);if(r[d])return r[d];var p=Math.cos(t),g=Math.sin(t),v=Math.cos(e),m=Math.sin(e),y=i*o*v-n*a*m+h,b=n*o*v+i*a*m+l,x=u+c*(-i*o*g-n*a*p),_=f+c*(-n*o*g+i*a*p),w=y+c*(i*o*m+n*a*v),C=b+c*(n*o*m-i*a*v);return r[d]=[x,_,w,C,y,b],r[d]}function i(t,e,i,n){var r=Math.atan2(e,t),s=Math.atan2(n,i);return s>=r?s-r:2*Math.PI-(r-s)}var n={},r={},s=Array.prototype.join;fabric.util.drawArc=function(e,i,n,r){for(var s=r[0],o=r[1],a=r[2],h=r[3],l=r[4],c=r[5],u=r[6],f=[[],[],[],[]],d=t(c-i,u-n,s,o,h,l,a),p=0;p<d.length;p++)f[p][0]=d[p][0]+i,f[p][1]=d[p][1]+n,f[p][2]=d[p][2]+i,f[p][3]=d[p][3]+n,f[p][4]=d[p][4]+i,f[p][5]=d[p][5]+n,e.bezierCurveTo.apply(e,f[p])}}(),function(){function t(t,e){for(var i=r.call(arguments,2),n=[],s=0,o=t.length;o>s;s++)n[s]=i.length?t[s][e].apply(t[s],i):t[s][e].call(t[s]);return n}function e(t,e){return n(t,e,function(t,e){return t>=e})}function i(t,e){return n(t,e,function(t,e){return e>t})}function n(t,e,i){if(t&&0!==t.length){var n=t.length-1,r=e?t[n][e]:t[n];if(e)for(;n--;)i(t[n][e],r)&&(r=t[n][e]);else for(;n--;)i(t[n],r)&&(r=t[n]);return r}}var r=Array.prototype.slice;Array.prototype.indexOf||(Array.prototype.indexOf=function(t){if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if(0===i)return-1;var n=0;if(arguments.length>0&&(n=Number(arguments[1]),n!==n?n=0:0!==n&&n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&(n=(n>0||-1)*Math.floor(Math.abs(n)))),n>=i)return-1;for(var r=n>=0?n:Math.max(i-Math.abs(n),0);i>r;r++)if(r in e&&e[r]===t)return r;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){for(var i=0,n=this.length>>>0;n>i;i++)i in this&&t.call(e,this[i],i,this)}),Array.prototype.map||(Array.prototype.map=function(t,e){for(var i=[],n=0,r=this.length>>>0;r>n;n++)n in this&&(i[n]=t.call(e,this[n],n,this));return i}),Array.prototype.every||(Array.prototype.every=function(t,e){for(var i=0,n=this.length>>>0;n>i;i++)if(i in this&&!t.call(e,this[i],i,this))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t,e){for(var i=0,n=this.length>>>0;n>i;i++)if(i in this&&t.call(e,this[i],i,this))return!0;return!1}),Array.prototype.filter||(Array.prototype.filter=function(t,e){for(var i,n=[],r=0,s=this.length>>>0;s>r;r++)r in this&&(i=this[r],t.call(e,i,r,this)&&n.push(i));return n}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var e,i=this.length>>>0,n=0;if(arguments.length>1)e=arguments[1];else for(;;){if(n in this){e=this[n++];break}if(++n>=i)throw new TypeError}for(;i>n;n++)n in this&&(e=t.call(null,e,this[n],n,this));return e}),fabric.util.array={invoke:t,min:i,max:e}}(),function(){function t(t,e){for(var i in e)t[i]=e[i];return t}function e(e){return t({},e)}fabric.util.object={extend:t,clone:e}}(),function(){function t(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})}function e(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())}function i(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")}),fabric.util.string={camelize:t,capitalize:e,escapeXml:i}}(),function(){var t=Array.prototype.slice,e=Function.prototype.apply,i=function(){};Function.prototype.bind||(Function.prototype.bind=function(n){var r,s=this,o=t.call(arguments,1);return r=o.length?function(){return e.call(s,this instanceof i?this:n,o.concat(t.call(arguments)))}:function(){return e.call(s,this instanceof i?this:n,arguments)},i.prototype=this.prototype,r.prototype=new i,r})}(),function(){function t(){}function e(t){var e=this.constructor.superclass.prototype[t];return arguments.length>1?e.apply(this,n.call(arguments,1)):e.call(this)}function i(){function i(){this.initialize.apply(this,arguments)}var s=null,a=n.call(arguments,0);"function"==typeof a[0]&&(s=a.shift()),i.superclass=s,i.subclasses=[],s&&(t.prototype=s.prototype,i.prototype=new t,s.subclasses.push(i));for(var h=0,l=a.length;l>h;h++)o(i,a[h],s);return i.prototype.initialize||(i.prototype.initialize=r),i.prototype.constructor=i,i.prototype.callSuper=e,i}var n=Array.prototype.slice,r=function(){},s=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),o=function(t,e,i){for(var n in e)t.prototype[n]=n in t.prototype&&"function"==typeof t.prototype[n]&&(e[n]+"").indexOf("callSuper")>-1?function(t){return function(){var n=this.constructor.superclass;this.constructor.superclass=i;var r=e[t].apply(this,arguments);return this.constructor.superclass=n,"initialize"!==t?r:void 0}}(n):e[n],s&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};fabric.util.createClass=i}(),function(){function t(t){var e,i,n=Array.prototype.slice.call(arguments,1),r=n.length;for(i=0;r>i;i++)if(e=typeof t[n[i]],!/^(?:function|object|unknown)$/.test(e))return!1;return!0}function e(t,e){return{handler:e,wrappedHandler:i(t,e)}}function i(t,e){return function(i){e.call(o(t),i||fabric.window.event)}}function n(t,e){return function(i){if(g[t]&&g[t][e])for(var n=g[t][e],r=0,s=n.length;s>r;r++)n[r].call(this,i||fabric.window.event)}}function r(t,e){t||(t=fabric.window.event);var i=t.target||(typeof t.srcElement!==h?t.srcElement:null),n=fabric.util.getScrollLeftTop(i,e);return{x:v(t)+n.left,y:m(t)+n.top}}function s(t,e,i){var n="touchend"===t.type?"changedTouches":"touches";return t[n]&&t[n][0]?t[n][0][e]-(t[n][0][e]-t[n][0][i])||t[i]:t[i]}var o,a,h="unknown",l=function(){var t=0;return function(e){return e.__uniqueID||(e.__uniqueID="uniqueID__"+t++)}}();!function(){var t={};o=function(e){return t[e]},a=function(e,i){t[e]=i}}();var c,u,f=t(fabric.document.documentElement,"addEventListener","removeEventListener")&&t(fabric.window,"addEventListener","removeEventListener"),d=t(fabric.document.documentElement,"attachEvent","detachEvent")&&t(fabric.window,"attachEvent","detachEvent"),p={},g={};f?(c=function(t,e,i){t.addEventListener(e,i,!1)},u=function(t,e,i){t.removeEventListener(e,i,!1)}):d?(c=function(t,i,n){var r=l(t);a(r,t),p[r]||(p[r]={}),p[r][i]||(p[r][i]=[]);var s=e(r,n);p[r][i].push(s),t.attachEvent("on"+i,s.wrappedHandler)},u=function(t,e,i){var n,r=l(t);if(p[r]&&p[r][e])for(var s=0,o=p[r][e].length;o>s;s++)n=p[r][e][s],n&&n.handler===i&&(t.detachEvent("on"+e,n.wrappedHandler),p[r][e][s]=null)}):(c=function(t,e,i){var r=l(t);if(g[r]||(g[r]={}),!g[r][e]){g[r][e]=[];var s=t["on"+e];s&&g[r][e].push(s),t["on"+e]=n(r,e)}g[r][e].push(i)},u=function(t,e,i){var n=l(t);if(g[n]&&g[n][e])for(var r=g[n][e],s=0,o=r.length;o>s;s++)r[s]===i&&r.splice(s,1)}),fabric.util.addListener=c,fabric.util.removeListener=u;var v=function(t){return typeof t.clientX!==h?t.clientX:0},m=function(t){return typeof t.clientY!==h?t.clientY:0};fabric.isTouchSupported&&(v=function(t){return s(t,"pageX","clientX")},m=function(t){return s(t,"pageY","clientY")}),fabric.util.getPointer=r,fabric.util.object.extend(fabric.util,fabric.Observable)}(),function(){function t(t,e){var i=t.style;if(!i)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?s(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var n in e)if("opacity"===n)s(t,e[n]);else{var r="float"===n||"cssFloat"===n?"undefined"==typeof i.styleFloat?"cssFloat":"styleFloat":n;i[r]=e[n]}return t}var e=fabric.document.createElement("div"),i="string"==typeof e.style.opacity,n="string"==typeof e.style.filter,r=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,s=function(t){return t};i?s=function(t,e){return t.style.opacity=e,t}:n&&(s=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),r.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(r,e)):i.filter+=" alpha(opacity="+100*e+")",t}),fabric.util.setStyle=t}(),function(){function t(t){return"string"==typeof t?fabric.document.getElementById(t):t}function e(t,e){var i=fabric.document.createElement(t);for(var n in e)"class"===n?i.className=e[n]:"for"===n?i.htmlFor=e[n]:i.setAttribute(n,e[n]);return i}function i(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)}function n(t,i,n){return"string"==typeof i&&(i=e(i,n)),t.parentNode&&t.parentNode.replaceChild(i,t),i.appendChild(t),i}function r(t,e){var i,n,r=0,s=0,o=fabric.document.documentElement,a=fabric.document.body||{scrollLeft:0,scrollTop:0};for(n=t;t&&t.parentNode&&!i;)t=t.parentNode,t!==fabric.document&&"fixed"===fabric.util.getElementStyle(t,"position")&&(i=t),t!==fabric.document&&n!==e&&"absolute"===fabric.util.getElementStyle(t,"position")?(r=0,s=0):t===fabric.document?(r=a.scrollLeft||o.scrollLeft||0,s=a.scrollTop||o.scrollTop||0):(r+=t.scrollLeft||0,s+=t.scrollTop||0);return{left:r,top:s}}function s(t){var e,i,n=t&&t.ownerDocument,r={left:0,top:0},s={left:0,top:0},o={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!n)return{left:0,top:0};for(var a in o)s[o[a]]+=parseInt(c(t,a),10)||0;return e=n.documentElement,"undefined"!=typeof t.getBoundingClientRect&&(r=t.getBoundingClientRect()),i=fabric.util.getScrollLeftTop(t,null),{left:r.left+i.left-(e.clientLeft||0)+s.left,top:r.top+i.top-(e.clientTop||0)+s.top}}var o,a=Array.prototype.slice,h=function(t){return a.call(t,0)};try{o=h(fabric.document.childNodes)instanceof Array}catch(l){}o||(h=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e});var c;c=fabric.document.defaultView&&fabric.document.defaultView.getComputedStyle?function(t,e){return fabric.document.defaultView.getComputedStyle(t,null)[e]}:function(t,e){var i=t.style[e];return!i&&t.currentStyle&&(i=t.currentStyle[e]),i},function(){function t(t){return"undefined"!=typeof t.onselectstart&&(t.onselectstart=fabric.util.falseFunction),n?t.style[n]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t}function e(t){return"undefined"!=typeof t.onselectstart&&(t.onselectstart=null),n?t.style[n]="":"string"==typeof t.unselectable&&(t.unselectable=""),t}var i=fabric.document.documentElement.style,n="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"";fabric.util.makeElementUnselectable=t,fabric.util.makeElementSelectable=e}(),function(){function t(t,e){var i=fabric.document.getElementsByTagName("head")[0],n=fabric.document.createElement("script"),r=!0;n.onload=n.onreadystatechange=function(t){if(r){if("string"==typeof this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)return;r=!1,e(t||fabric.window.event),n=n.onload=n.onreadystatechange=null}},n.src=t,i.appendChild(n)}fabric.util.getScript=t}(),fabric.util.getById=t,fabric.util.toArray=h,fabric.util.makeElement=e,fabric.util.addClass=i,fabric.util.wrapElement=n,fabric.util.getScrollLeftTop=r,fabric.util.getElementOffset=s,fabric.util.getElementStyle=c}(),function(){function t(t,e){return t+(/\?/.test(t)?"&":"?")+e}function e(){}function i(i,r){r||(r={});var s,o=r.method?r.method.toUpperCase():"GET",a=r.onComplete||function(){},h=n();return h.onreadystatechange=function(){4===h.readyState&&(a(h),h.onreadystatechange=e)},"GET"===o&&(s=null,"string"==typeof r.parameters&&(i=t(i,r.parameters))),h.open(o,i,!0),("POST"===o||"PUT"===o)&&h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(s),h}var n=function(){for(var t=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")},function(){return new XMLHttpRequest}],e=t.length;e--;)try{var i=t[e]();if(i)return t[e]}catch(n){}}();fabric.util.request=i}(),fabric.log=function(){},fabric.warn=function(){},"undefined"!=typeof console&&["log","warn"].forEach(function(t){"undefined"!=typeof console[t]&&console[t].apply&&(fabric[t]=function(){return console[t].apply(console,arguments)})}),function(){function t(t){e(function(i){t||(t={});var n,r=i||+new Date,s=t.duration||500,o=r+s,a=t.onChange||function(){},h=t.abort||function(){return!1},l=t.easing||function(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},c="startValue"in t?t.startValue:0,u="endValue"in t?t.endValue:100,f=t.byValue||u-c;t.onStart&&t.onStart(),function d(i){n=i||+new Date;var u=n>o?s:n-r;return h()?void(t.onComplete&&t.onComplete()):(a(l(u,c,f,s)),n>o?void(t.onComplete&&t.onComplete()):void e(d))}(r)})}function e(){return i.apply(fabric.window,arguments)}var i=fabric.window.requestAnimationFrame||fabric.window.webkitRequestAnimationFrame||fabric.window.mozRequestAnimationFrame||fabric.window.oRequestAnimationFrame||fabric.window.msRequestAnimationFrame||function(t){fabric.window.setTimeout(t,1e3/60)};fabric.util.animate=t,fabric.util.requestAnimFrame=e}(),function(){function t(t,e,i,n){return t<Math.abs(e)?(t=e,n=i/4):n=i/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:i,s:n}}function e(t,e,i){return t.a*Math.pow(2,10*(e-=1))*Math.sin(2*(e*i-t.s)*Math.PI/t.p)}function i(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e}function n(t,e,i,n){return t/=n/2,1>t?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e}function r(t,e,i,n){return i*(t/=n)*t*t*t+e}function s(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e}function o(t,e,i,n){return t/=n/2,1>t?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e}function a(t,e,i,n){return i*(t/=n)*t*t*t*t+e}function h(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e}function l(t,e,i,n){return t/=n/2,1>t?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e}function c(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e}function u(t,e,i,n){return i*Math.sin(t/n*(Math.PI/2))+e}function f(t,e,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+e}function d(t,e,i,n){return 0===t?e:i*Math.pow(2,10*(t/n-1))+e}function p(t,e,i,n){return t===n?e+i:i*(-Math.pow(2,-10*t/n)+1)+e}function g(t,e,i,n){return 0===t?e:t===n?e+i:(t/=n/2,1>t?i/2*Math.pow(2,10*(t-1))+e:i/2*(-Math.pow(2,-10*--t)+2)+e)}function v(t,e,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e}function m(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e}function y(t,e,i,n){return t/=n/2,1>t?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e}function b(i,n,r,s){var o=1.70158,a=0,h=r;if(0===i)return n;if(i/=s,1===i)return n+r;a||(a=.3*s);var l=t(h,r,a,o);return-e(l,i,s)+n}function x(e,i,n,r){var s=1.70158,o=0,a=n;if(0===e)return i;if(e/=r,1===e)return i+n;o||(o=.3*r);var h=t(a,n,o,s);return h.a*Math.pow(2,-10*e)*Math.sin(2*(e*r-h.s)*Math.PI/h.p)+h.c+i}function _(i,n,r,s){var o=1.70158,a=0,h=r;if(0===i)return n;if(i/=s/2,2===i)return n+r;a||(a=.3*s*1.5);var l=t(h,r,a,o);return 1>i?-.5*e(l,i,s)+n:l.a*Math.pow(2,-10*(i-=1))*Math.sin(2*(i*s-l.s)*Math.PI/l.p)*.5+l.c+n}function w(t,e,i,n,r){return void 0===r&&(r=1.70158),i*(t/=n)*t*((r+1)*t-r)+e}function C(t,e,i,n,r){return void 0===r&&(r=1.70158),i*((t=t/n-1)*t*((r+1)*t+r)+1)+e}function S(t,e,i,n,r){return void 0===r&&(r=1.70158),t/=n/2,1>t?i/2*t*t*(((r*=1.525)+1)*t-r)+e:i/2*((t-=2)*t*(((r*=1.525)+1)*t+r)+2)+e}function T(t,e,i,n){return i-k(n-t,0,i,n)+e}function k(t,e,i,n){return(t/=n)<1/2.75?7.5625*i*t*t+e:2/2.75>t?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:2.5/2.75>t?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e}function O(t,e,i,n){return n/2>t?.5*T(2*t,0,i,n)+e:.5*k(2*t-n,0,i,n)+.5*i+e}fabric.util.ease={easeInQuad:function(t,e,i,n){return i*(t/=n)*t+e},easeOutQuad:function(t,e,i,n){return-i*(t/=n)*(t-2)+e},easeInOutQuad:function(t,e,i,n){return t/=n/2,1>t?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,n){return i*(t/=n)*t*t+e},easeOutCubic:i,easeInOutCubic:n,easeInQuart:r,easeOutQuart:s,easeInOutQuart:o,easeInQuint:a,easeOutQuint:h,easeInOutQuint:l,easeInSine:c,easeOutSine:u,easeInOutSine:f,easeInExpo:d,easeOutExpo:p,easeInOutExpo:g,easeInCirc:v,easeOutCirc:m,easeInOutCirc:y,easeInElastic:b,easeOutElastic:x,easeInOutElastic:_,easeInBack:w,easeOutBack:C,easeInOutBack:S,easeInBounce:T,easeOutBounce:k,easeInOutBounce:O}}(),function(t){"use strict";function e(t){return t in w?w[t]:t}function i(t,e,i){var n,r="[object Array]"===Object.prototype.toString.call(e);return"fill"!==t&&"stroke"!==t||"none"!==e?"fillRule"===t?e="evenodd"===e?"destination-over":e:"strokeDashArray"===t?e=e.replace(/,/g," ").split(/\s+/).map(function(t){return parseInt(t)}):"transformMatrix"===t?e=i&&i.transformMatrix?_(i.transformMatrix,g.parseTransformAttribute(e)):g.parseTransformAttribute(e):"visible"===t?(e="none"===e||"hidden"===e?!1:!0,i&&i.visible===!1&&(e=!1)):"originX"===t?e="start"===e?"left":"end"===e?"right":"center":n=r?e.map(x):x(e):e="",!r&&isNaN(n)?e:n}function n(t){for(var e in C)if(t[e]&&"undefined"!=typeof t[C[e]]&&0!==t[e].indexOf("url(")){var i=new g.Color(t[e]);t[e]=i.setAlpha(b(i.getAlpha()*t[C[e]],2)).toRgba()}return t}function r(t,e){var i=t.match(/(normal|italic)?\s*(normal|small-caps)?\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\s*(\d+)px(?:\/(normal|[\d\.]+))?\s+(.*)/);if(i){var n=i[1],r=i[3],s=i[4],o=i[5],a=i[6];n&&(e.fontStyle=n),r&&(e.fontWeight=isNaN(parseFloat(r))?r:parseFloat(r)),s&&(e.fontSize=parseFloat(s)),a&&(e.fontFamily=a),o&&(e.lineHeight="normal"===o?1:o)}}function s(t,n){var s,o;t.replace(/;$/,"").split(";").forEach(function(t){var a=t.split(":");s=e(a[0].trim().toLowerCase()),o=i(s,a[1].trim()),"font"===s?r(o,n):n[s]=o})}function o(t,n){var s,o;for(var a in t)"undefined"!=typeof t[a]&&(s=e(a.toLowerCase()),o=i(s,t[a]),"font"===s?r(o,n):n[s]=o)}function a(t){var e={};for(var i in g.cssRules)if(h(t,i.split(" ")))for(var n in g.cssRules[i])e[n]=g.cssRules[i][n];return e}function h(t,e){var i,n=!0;return i=c(t,e.pop()),i&&e.length&&(n=l(t,e)),i&&n&&0===e.length}function l(t,e){for(var i,n=!0;t.parentNode&&1===t.parentNode.nodeType&&e.length;)n&&(i=e.pop()),t=t.parentNode,n=c(t,i);return 0===e.length}function c(t,e){var i,n=t.nodeName,r=t.getAttribute("class"),s=t.getAttribute("id");if(i=new RegExp("^"+n,"i"),e=e.replace(i,""),s&&e.length&&(i=new RegExp("#"+s+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")),r&&e.length){r=r.split(" ");for(var o=r.length;o--;)i=new RegExp("\\."+r[o]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")}return 0===e.length}function u(t){for(var e=t.getElementsByTagName("use");e.length;){for(var i,n=e[0],r=n.getAttribute("xlink:href").substr(1),s=n.getAttribute("x")||0,o=n.getAttribute("y")||0,a=t.getElementById(r).cloneNode(!0),h=(n.getAttribute("transform")||"")+" translate("+s+", "+o+")",l=0,c=n.attributes,u=c.length;u>l;l++){var f=c.item(l);"x"!==f.nodeName&&"y"!==f.nodeName&&"xlink:href"!==f.nodeName&&("transform"===f.nodeName?h=h+" "+f.nodeValue:a.setAttribute(f.nodeName,f.nodeValue))}a.setAttribute("transform",h),a.removeAttribute("id"),i=n.parentNode,i.replaceChild(a,n)}}function f(t,e){if(e[3]=e[0]=e[0]>e[3]?e[3]:e[0],1!==e[0]||1!==e[3]||0!==e[4]||0!==e[5]){for(var i=t.ownerDocument.createElement("g");null!=t.firstChild;)i.appendChild(t.firstChild);i.setAttribute("transform","matrix("+e[0]+" "+e[1]+" "+e[2]+" "+e[3]+" "+e[4]+" "+e[5]+")"),t.appendChild(i)}}function d(t){var e=t.objects,i=t.options;return e=e.map(function(t){return g[m(t.type)].fromObject(t)}),{objects:e,options:i}}function p(t,e,i){e[i]&&e[i].toSVG&&t.push('<pattern x="0" y="0" id="',i,'Pattern" ','width="',e[i].source.width,'" height="',e[i].source.height,'" patternUnits="userSpaceOnUse">','<image x="0" y="0" ','width="',e[i].source.width,'" height="',e[i].source.height,'" xlink:href="',e[i].source.src,'"></image></pattern>')}var g=t.fabric||(t.fabric={}),v=g.util.object.extend,m=g.util.string.capitalize,y=g.util.object.clone,b=g.util.toFixed,x=g.util.parseUnit,_=g.util.multiplyTransformMatrices,w={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","stroke-dasharray":"strokeDashArray","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"originX"},C={stroke:"strokeOpacity",fill:"fillOpacity"};
|
|
g.parseTransformAttribute=function(){function t(t,e){var i=e[0];t[0]=Math.cos(i),t[1]=Math.sin(i),t[2]=-Math.sin(i),t[3]=Math.cos(i)}function e(t,e){var i=e[0],n=2===e.length?e[1]:e[0];t[0]=i,t[3]=n}function i(t,e){t[2]=e[0]}function n(t,e){t[1]=e[0]}function r(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}var s=[1,0,0,1,0,0],o="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:e[-+]?\\d+)?)",a="(?:\\s+,?\\s*|,\\s*)",h="(?:(skewX)\\s*\\(\\s*("+o+")\\s*\\))",l="(?:(skewY)\\s*\\(\\s*("+o+")\\s*\\))",c="(?:(rotate)\\s*\\(\\s*("+o+")(?:"+a+"("+o+")"+a+"("+o+"))?\\s*\\))",u="(?:(scale)\\s*\\(\\s*("+o+")(?:"+a+"("+o+"))?\\s*\\))",f="(?:(translate)\\s*\\(\\s*("+o+")(?:"+a+"("+o+"))?\\s*\\))",d="(?:(matrix)\\s*\\(\\s*("+o+")"+a+"("+o+")"+a+"("+o+")"+a+"("+o+")"+a+"("+o+")"+a+"("+o+")\\s*\\))",p="(?:"+d+"|"+f+"|"+u+"|"+c+"|"+h+"|"+l+")",v="(?:"+p+"(?:"+a+p+")*)",m="^\\s*(?:"+v+"?)\\s*$",y=new RegExp(m),b=new RegExp(p,"g");return function(o){var a=s.concat(),h=[];if(!o||o&&!y.test(o))return a;o.replace(b,function(o){var l=new RegExp(p).exec(o).filter(function(t){return""!==t&&null!=t}),c=l[1],u=l.slice(2).map(parseFloat);switch(c){case"translate":r(a,u);break;case"rotate":u[0]=g.util.degreesToRadians(u[0]),t(a,u);break;case"scale":e(a,u);break;case"skewX":i(a,u);break;case"skewY":n(a,u);break;case"matrix":a=u}h.push(a.concat()),a=s.concat()});for(var l=h[0];h.length>1;)h.shift(),l=g.util.multiplyTransformMatrices(l,h[0]);return l}}(),g.parseSVGDocument=function(){function t(t,e){for(;t&&(t=t.parentNode);)if(e.test(t.nodeName))return!0;return!1}var e=/^(path|circle|polygon|polyline|ellipse|rect|line|image|text)$/,i="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:e[-+]?\\d+)?)",n=new RegExp("^\\s*("+i+"+)\\s*,?\\s*("+i+"+)\\s*,?\\s*("+i+"+)\\s*,?\\s*("+i+"+)\\s*$");return function(i,r,s){if(i){var o=new Date;u(i);var a,h,l=i.getAttribute("viewBox"),c=x(i.getAttribute("width")),d=x(i.getAttribute("height"));if(l&&(l=l.match(n))){var p=parseFloat(l[1]),v=parseFloat(l[2]),m=1,b=1;a=parseFloat(l[3]),h=parseFloat(l[4]),c&&c!==a&&(m=c/a),d&&d!==h&&(b=d/h),f(i,[m,0,0,b,m*-p,b*-v])}var _=g.util.toArray(i.getElementsByTagName("*"));if(0===_.length&&g.isLikelyNode){_=i.selectNodes('//*[name(.)!="svg"]');for(var w=[],C=0,S=_.length;S>C;C++)w[C]=_[C];_=w}var T=_.filter(function(i){return e.test(i.tagName)&&!t(i,/^(?:pattern|defs)$/)});if(!T||T&&!T.length)return void(r&&r([],{}));var k={width:c?c:a,height:d?d:h,widthAttr:c,heightAttr:d};g.gradientDefs=g.getGradientDefs(i),g.cssRules=g.getCSSRules(i),g.parseElements(T,function(t){g.documentParsingTime=new Date-o,r&&r(t,k)},y(k),s)}}}();var S={has:function(t,e){e(!1)},get:function(){},set:function(){}};v(g,{getGradientDefs:function(t){var e,i,n,r,s=t.getElementsByTagName("linearGradient"),o=t.getElementsByTagName("radialGradient"),a=0,h=[],l={},c={};for(h.length=s.length+o.length,i=s.length;i--;)h[a++]=s[i];for(i=o.length;i--;)h[a++]=o[i];for(;a--;)e=h[a],r=e.getAttribute("xlink:href"),n=e.getAttribute("id"),r&&(c[n]=r.substr(1)),l[n]=e;for(n in c){var u=l[c[n]].cloneNode(!0);for(e=l[n];u.firstChild;)e.appendChild(u.firstChild)}return l},parseAttributes:function(t,r){if(t){var s,o={};t.parentNode&&/^symbol|[g|a]$/i.test(t.parentNode.nodeName)&&(o=g.parseAttributes(t.parentNode,r));var h=r.reduce(function(n,r){return s=t.getAttribute(r),s&&(r=e(r),s=i(r,s,o),n[r]=s),n},{});return h=v(h,v(a(t),g.parseStyleAttribute(t))),n(v(o,h))}},parseElements:function(t,e,i,n){new g.ElementsParser(t,e,i,n).parse()},parseStyleAttribute:function(t){var e={},i=t.getAttribute("style");return i?("string"==typeof i?s(i,e):o(i,e),e):e},parsePointsAttribute:function(t){if(!t)return null;t=t.replace(/,/g," ").trim(),t=t.split(/\s+/);var e,i,n=[];for(e=0,i=t.length;i>e;e+=2)n.push({x:parseFloat(t[e]),y:parseFloat(t[e+1])});return n},getCSSRules:function(t){for(var n,r=t.getElementsByTagName("style"),s={},o=0,a=r.length;a>o;o++){var h=r[0].textContent;h=h.replace(/\/\*[\s\S]*?\*\//g,""),n=h.match(/[^{]*\{[\s\S]*?\}/g),n=n.map(function(t){return t.trim()}),n.forEach(function(t){for(var n=t.match(/([\s\S]*?)\s*\{([^}]*)\}/),r={},o=n[2].trim(),a=o.replace(/;$/,"").split(/\s*;\s*/),h=0,l=a.length;l>h;h++){var c=a[h].split(/\s*:\s*/),u=e(c[0]),f=i(u,c[1],c[0]);r[u]=f}t=n[1],t.split(",").forEach(function(t){s[t.trim()]=g.util.object.clone(r)})})}return s},loadSVGFromURL:function(t,e,i){function n(n){var r=n.responseXML;r&&!r.documentElement&&g.window.ActiveXObject&&n.responseText&&(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n.responseText.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,""))),r&&r.documentElement&&g.parseSVGDocument(r.documentElement,function(i,n){S.set(t,{objects:g.util.array.invoke(i,"toObject"),options:n}),e(i,n)},i)}t=t.replace(/^\n\s*/,"").trim(),S.has(t,function(i){i?S.get(t,function(t){var i=d(t);e(i.objects,i.options)}):new g.util.request(t,{method:"get",onComplete:n})})},loadSVGFromString:function(t,e,i){t=t.trim();var n;if("undefined"!=typeof DOMParser){var r=new DOMParser;r&&r.parseFromString&&(n=r.parseFromString(t,"text/xml"))}else g.window.ActiveXObject&&(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,"")));g.parseSVGDocument(n.documentElement,function(t,i){e(t,i)},i)},createSVGFontFacesMarkup:function(t){for(var e="",i=0,n=t.length;n>i;i++)"text"===t[i].type&&t[i].path&&(e+=["@font-face {","font-family: ",t[i].fontFamily,"; ","src: url('",t[i].path,"')","}"].join(""));return e&&(e=['<style type="text/css">',"<![CDATA[",e,"]]>","</style>"].join("")),e},createSVGRefElementsMarkup:function(t){var e=[];return p(e,t,"backgroundColor"),p(e,t,"overlayColor"),e.join("")}})}("undefined"!=typeof exports?exports:this),fabric.ElementsParser=function(t,e,i,n){this.elements=t,this.callback=e,this.options=i,this.reviver=n},fabric.ElementsParser.prototype.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},fabric.ElementsParser.prototype.createObjects=function(){for(var t=0,e=this.elements.length;e>t;t++)(function(t,e){setTimeout(function(){t.createObject(t.elements[e],e)},0)})(this,t)},fabric.ElementsParser.prototype.createObject=function(t,e){var i=fabric[fabric.util.string.capitalize(t.tagName)];if(i&&i.fromElement)try{this._createObject(i,t,e)}catch(n){fabric.log(n)}else this.checkIfDone()},fabric.ElementsParser.prototype._createObject=function(t,e,i){if(t.async)t.fromElement(e,this.createCallback(i,e),this.options);else{var n=t.fromElement(e,this.options);this.resolveGradient(n,"fill"),this.resolveGradient(n,"stroke"),this.reviver&&this.reviver(e,n),this.instances[i]=n,this.checkIfDone()}},fabric.ElementsParser.prototype.createCallback=function(t,e){var i=this;return function(n){i.resolveGradient(n,"fill"),i.resolveGradient(n,"stroke"),i.reviver&&i.reviver(e,n),i.instances[t]=n,i.checkIfDone()}},fabric.ElementsParser.prototype.resolveGradient=function(t,e){var i=t.get(e);if(/^url\(/.test(i)){var n=i.slice(5,i.length-1);fabric.gradientDefs[n]&&t.set(e,fabric.Gradient.fromElement(fabric.gradientDefs[n],t))}},fabric.ElementsParser.prototype.checkIfDone=function(){0===--this.numElements&&(this.instances=this.instances.filter(function(t){return null!=t}),this.callback(this.instances))},function(t){"use strict";function e(t,e){this.x=t,this.y=e}var i=t.fabric||(t.fabric={});return i.Point?void i.warn("fabric.Point is already defined"):(i.Point=e,void(e.prototype={constructor:e,add:function(t){return new e(this.x+t.x,this.y+t.y)},addEquals:function(t){return this.x+=t.x,this.y+=t.y,this},scalarAdd:function(t){return new e(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new e(this.x-t.x,this.y-t.y)},subtractEquals:function(t){return this.x-=t.x,this.y-=t.y,this},scalarSubtract:function(t){return new e(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new e(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new e(this.x/t,this.y/t)},divideEquals:function(t){return this.x/=t,this.y/=t,this},eq:function(t){return this.x===t.x&&this.y===t.y},lt:function(t){return this.x<t.x&&this.y<t.y},lte:function(t){return this.x<=t.x&&this.y<=t.y},gt:function(t){return this.x>t.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,i){return new e(this.x+(t.x-this.x)*i,this.y+(t.y-this.y)*i)},distanceFrom:function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},midPointFrom:function(t){return new e(this.x+(t.x-this.x)/2,this.y+(t.y-this.y)/2)},min:function(t){return new e(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new e(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){this.x=t,this.y=e},setFromPoint:function(t){this.x=t.x,this.y=t.y},swap:function(t){var e=this.x,i=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=i}}))}("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){this.status=t,this.points=[]}var i=t.fabric||(t.fabric={});return i.Intersection?void i.warn("fabric.Intersection is already defined"):(i.Intersection=e,i.Intersection.prototype={appendPoint:function(t){this.points.push(t)},appendPoints:function(t){this.points=this.points.concat(t)}},i.Intersection.intersectLineLine=function(t,n,r,s){var o,a=(s.x-r.x)*(t.y-r.y)-(s.y-r.y)*(t.x-r.x),h=(n.x-t.x)*(t.y-r.y)-(n.y-t.y)*(t.x-r.x),l=(s.y-r.y)*(n.x-t.x)-(s.x-r.x)*(n.y-t.y);if(0!==l){var c=a/l,u=h/l;c>=0&&1>=c&&u>=0&&1>=u?(o=new e("Intersection"),o.points.push(new i.Point(t.x+c*(n.x-t.x),t.y+c*(n.y-t.y)))):o=new e}else o=new e(0===a||0===h?"Coincident":"Parallel");return o},i.Intersection.intersectLinePolygon=function(t,i,n){for(var r=new e,s=n.length,o=0;s>o;o++){var a=n[o],h=n[(o+1)%s],l=e.intersectLineLine(t,i,a,h);r.appendPoints(l.points)}return r.points.length>0&&(r.status="Intersection"),r},i.Intersection.intersectPolygonPolygon=function(t,i){for(var n=new e,r=t.length,s=0;r>s;s++){var o=t[s],a=t[(s+1)%r],h=e.intersectLinePolygon(o,a,i);n.appendPoints(h.points)}return n.points.length>0&&(n.status="Intersection"),n},i.Intersection.intersectPolygonRectangle=function(t,n,r){var s=n.min(r),o=n.max(r),a=new i.Point(o.x,s.y),h=new i.Point(s.x,o.y),l=e.intersectLinePolygon(s,a,t),c=e.intersectLinePolygon(a,o,t),u=e.intersectLinePolygon(o,h,t),f=e.intersectLinePolygon(h,s,t),d=new e;return d.appendPoints(l.points),d.appendPoints(c.points),d.appendPoints(u.points),d.appendPoints(f.points),d.points.length>0&&(d.status="Intersection"),d},void 0)}("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function i(t,e,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?t+6*(e-t)*i:.5>i?e:2/3>i?t+(e-t)*(2/3-i)*6:t}var n=t.fabric||(t.fabric={});return n.Color?void n.warn("fabric.Color is already defined."):(n.Color=e,n.Color.prototype={_tryParsingColor:function(t){var i;return t in e.colorNameMap&&(t=e.colorNameMap[t]),"transparent"===t?void this.setSource([255,255,255,0]):(i=e.sourceFromHex(t),i||(i=e.sourceFromRgb(t)),i||(i=e.sourceFromHsl(t)),i&&this.setSource(i),void 0)},_rgbToHsl:function(t,e,i){t/=255,e/=255,i/=255;var r,s,o,a=n.util.array.max([t,e,i]),h=n.util.array.min([t,e,i]);if(o=(a+h)/2,a===h)r=s=0;else{var l=a-h;switch(s=o>.5?l/(2-a-h):l/(a+h),a){case t:r=(e-i)/l+(i>e?6:0);break;case e:r=(i-t)/l+2;break;case i:r=(t-e)/l+4}r/=6}return[Math.round(360*r),Math.round(100*s),Math.round(100*o)]},getSource:function(){return this._source},setSource:function(t){this._source=t},toRgb:function(){var t=this.getSource();return"rgb("+t[0]+","+t[1]+","+t[2]+")"},toRgba:function(){var t=this.getSource();return"rgba("+t[0]+","+t[1]+","+t[2]+","+t[3]+")"},toHsl:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsl("+e[0]+","+e[1]+"%,"+e[2]+"%)"},toHsla:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsla("+e[0]+","+e[1]+"%,"+e[2]+"%,"+t[3]+")"},toHex:function(){var t,e,i,n=this.getSource();return t=n[0].toString(16),t=1===t.length?"0"+t:t,e=n[1].toString(16),e=1===e.length?"0"+e:e,i=n[2].toString(16),i=1===i.length?"0"+i:i,t.toUpperCase()+e.toUpperCase()+i.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(t){var e=this.getSource();return e[3]=t,this.setSource(e),this},toGrayscale:function(){var t=this.getSource(),e=parseInt((.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),10),i=t[3];return this.setSource([e,e,e,i]),this},toBlackWhite:function(t){var e=this.getSource(),i=(.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),n=e[3];return t=t||127,i=Number(i)<Number(t)?0:255,this.setSource([i,i,i,n]),this},overlayWith:function(t){t instanceof e||(t=new e(t));for(var i=[],n=this.getAlpha(),r=.5,s=this.getSource(),o=t.getSource(),a=0;3>a;a++)i.push(Math.round(s[a]*(1-r)+o[a]*r));return i[3]=n,this.setSource(i),this}},n.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/,n.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/,n.Color.reHex=/^#?([0-9a-f]{6}|[0-9a-f]{3})$/i,n.Color.colorNameMap={aqua:"#00FFFF",black:"#000000",blue:"#0000FF",fuchsia:"#FF00FF",gray:"#808080",green:"#008000",lime:"#00FF00",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#FFA500",purple:"#800080",red:"#FF0000",silver:"#C0C0C0",teal:"#008080",white:"#FFFFFF",yellow:"#FFFF00"},n.Color.fromRgb=function(t){return e.fromSource(e.sourceFromRgb(t))},n.Color.sourceFromRgb=function(t){var i=t.match(e.reRGBa);if(i){var n=parseInt(i[1],10)/(/%$/.test(i[1])?100:1)*(/%$/.test(i[1])?255:1),r=parseInt(i[2],10)/(/%$/.test(i[2])?100:1)*(/%$/.test(i[2])?255:1),s=parseInt(i[3],10)/(/%$/.test(i[3])?100:1)*(/%$/.test(i[3])?255:1);return[parseInt(n,10),parseInt(r,10),parseInt(s,10),i[4]?parseFloat(i[4]):1]}},n.Color.fromRgba=e.fromRgb,n.Color.fromHsl=function(t){return e.fromSource(e.sourceFromHsl(t))},n.Color.sourceFromHsl=function(t){var n=t.match(e.reHSLa);if(n){var r,s,o,a=(parseFloat(n[1])%360+360)%360/360,h=parseFloat(n[2])/(/%$/.test(n[2])?100:1),l=parseFloat(n[3])/(/%$/.test(n[3])?100:1);if(0===h)r=s=o=l;else{var c=.5>=l?l*(h+1):l+h-l*h,u=2*l-c;r=i(u,c,a+1/3),s=i(u,c,a),o=i(u,c,a-1/3)}return[Math.round(255*r),Math.round(255*s),Math.round(255*o),n[4]?parseFloat(n[4]):1]}},n.Color.fromHsla=e.fromHsl,n.Color.fromHex=function(t){return e.fromSource(e.sourceFromHex(t))},n.Color.sourceFromHex=function(t){if(t.match(e.reHex)){var i=t.slice(t.indexOf("#")+1),n=3===i.length,r=n?i.charAt(0)+i.charAt(0):i.substring(0,2),s=n?i.charAt(1)+i.charAt(1):i.substring(2,4),o=n?i.charAt(2)+i.charAt(2):i.substring(4,6);return[parseInt(r,16),parseInt(s,16),parseInt(o,16),1]}},n.Color.fromSource=function(t){var i=new e;return i.setSource(t),i},void 0)}("undefined"!=typeof exports?exports:this),function(){function t(t){var e,i,n,r=t.getAttribute("style"),s=t.getAttribute("offset");if(s=parseFloat(s)/(/%$/.test(s)?100:1),r){var o=r.split(/\s*;\s*/);""===o[o.length-1]&&o.pop();for(var a=o.length;a--;){var h=o[a].split(/\s*:\s*/),l=h[0].trim(),c=h[1].trim();"stop-color"===l?e=c:"stop-opacity"===l&&(n=c)}}return e||(e=t.getAttribute("stop-color")||"rgb(0,0,0)"),n||(n=t.getAttribute("stop-opacity")),e=new fabric.Color(e),i=e.getAlpha(),n=isNaN(parseFloat(n))?1:parseFloat(n),n*=i,{offset:s,color:e.toRgb(),opacity:n}}function e(t){return{x1:t.getAttribute("x1")||0,y1:t.getAttribute("y1")||0,x2:t.getAttribute("x2")||"100%",y2:t.getAttribute("y2")||0}}function i(t){return{x1:t.getAttribute("fx")||t.getAttribute("cx")||"50%",y1:t.getAttribute("fy")||t.getAttribute("cy")||"50%",r1:0,x2:t.getAttribute("cx")||"50%",y2:t.getAttribute("cy")||"50%",r2:t.getAttribute("r")||"50%"}}function n(t,e){for(var i in e)if("string"==typeof e[i]&&/^\d+%$/.test(e[i])){var n=parseFloat(e[i],10);"x1"===i||"x2"===i||"r2"===i?e[i]=fabric.util.toFixed(t.width*n/100,2)+t.left:("y1"===i||"y2"===i)&&(e[i]=fabric.util.toFixed(t.height*n/100,2)+t.top)}}function r(t,e){for(var i in e)"x1"===i||"x2"===i||"r2"===i?e[i]=fabric.util.toFixed((e[i]-t.fill.origX)/t.width*100,2)+"%":("y1"===i||"y2"===i)&&(e[i]=fabric.util.toFixed((e[i]-t.fill.origY)/t.height*100,2)+"%")}fabric.Gradient=fabric.util.createClass({origX:0,origY:0,initialize:function(t){t||(t={});var e={};this.id=fabric.Object.__uid++,this.type=t.type||"linear",e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},"radial"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.gradientUnits=t.gradientUnits||"objectBoundingBox",this.colorStops=t.colorStops.slice(),t.gradientTransform&&(this.gradientTransform=t.gradientTransform),this.origX=t.left||this.origX,this.origY=t.top||this.origY},addColorStop:function(t){for(var e in t){var i=new fabric.Color(t[e]);this.colorStops.push({offset:e,color:i.toRgb(),opacity:i.getAlpha()})}return this},toObject:function(){return{type:this.type,coords:this.coords,gradientUnits:this.gradientUnits,colorStops:this.colorStops}},toSVG:function(t,e){var i,n,s=fabric.util.object.clone(this.coords);this.colorStops.sort(function(t,e){return t.offset-e.offset}),e&&"userSpaceOnUse"===this.gradientUnits?(s.x1+=t.width/2,s.y1+=t.height/2,s.x2+=t.width/2,s.y2+=t.height/2):"objectBoundingBox"===this.gradientUnits&&r(t,s),n='id="SVGID_'+this.id+'" gradientUnits="'+this.gradientUnits+'"',this.gradientTransform&&(n+=' gradientTransform="matrix('+this.gradientTransform.join(" ")+')" '),"linear"===this.type?i=["<linearGradient ",n,' x1="',s.x1,'" y1="',s.y1,'" x2="',s.x2,'" y2="',s.y2,'">\n']:"radial"===this.type&&(i=["<radialGradient ",n,' cx="',s.x2,'" cy="',s.y2,'" r="',s.r2,'" fx="',s.x1,'" fy="',s.y1,'">\n']);for(var o=0;o<this.colorStops.length;o++)i.push("<stop ",'offset="',100*this.colorStops[o].offset+"%",'" style="stop-color:',this.colorStops[o].color,null!=this.colorStops[o].opacity?";stop-opacity: "+this.colorStops[o].opacity:";",'"/>\n');return i.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),i.join("")},toLive:function(t){var e;if(this.type){"linear"===this.type?e=t.createLinearGradient(this.coords.x1,this.coords.y1,this.coords.x2,this.coords.y2):"radial"===this.type&&(e=t.createRadialGradient(this.coords.x1,this.coords.y1,this.coords.r1,this.coords.x2,this.coords.y2,this.coords.r2));for(var i=0,n=this.colorStops.length;n>i;i++){var r=this.colorStops[i].color,s=this.colorStops[i].opacity,o=this.colorStops[i].offset;"undefined"!=typeof s&&(r=new fabric.Color(r).setAlpha(s).toRgba()),e.addColorStop(parseFloat(o),r)}return e}}}),fabric.util.object.extend(fabric.Gradient,{fromElement:function(r,s){var o=r.getElementsByTagName("stop"),a="linearGradient"===r.nodeName?"linear":"radial",h=r.getAttribute("gradientUnits")||"objectBoundingBox",l=r.getAttribute("gradientTransform"),c=[],u={};"linear"===a?u=e(r):"radial"===a&&(u=i(r));for(var f=o.length;f--;)c.push(t(o[f]));n(s,u);var d=new fabric.Gradient({type:a,coords:u,gradientUnits:h,colorStops:c});return l&&(d.gradientTransform=fabric.parseTransformAttribute(l)),d},forObject:function(t,e){return e||(e={}),n(t,e),new fabric.Gradient(e)}})}(),fabric.Pattern=fabric.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,initialize:function(t){if(t||(t={}),this.id=fabric.Object.__uid++,t.source)if("string"==typeof t.source)if("undefined"!=typeof fabric.util.getFunctionBody(t.source))this.source=new Function(fabric.util.getFunctionBody(t.source));else{var e=this;this.source=fabric.util.createImage(),fabric.util.loadImage(t.source,function(t){e.source=t})}else this.source=t.source;t.repeat&&(this.repeat=t.repeat),t.offsetX&&(this.offsetX=t.offsetX),t.offsetY&&(this.offsetY=t.offsetY)},toObject:function(){var t;return"function"==typeof this.source?t=String(this.source):"string"==typeof this.source.src&&(t=this.source.src),{source:t,repeat:this.repeat,offsetX:this.offsetX,offsetY:this.offsetY}},toSVG:function(t){var e="function"==typeof this.source?this.source():this.source,i=e.width/t.getWidth(),n=e.height/t.getHeight(),r="";return e.src?r=e.src:e.toDataURL&&(r=e.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+this.offsetX+'" y="'+this.offsetY+'" width="'+i+'" height="'+n+'"><image x="0" y="0" width="'+e.width+'" height="'+e.height+'" xlink:href="'+r+'"></image></pattern>'},toLive:function(t){var e="function"==typeof this.source?this.source():this.source;if(!e)return"";if("undefined"!=typeof e.src){if(!e.complete)return"";if(0===e.naturalWidth||0===e.naturalHeight)return""}return t.createPattern(e,this.repeat)}}),function(t){"use strict";var e=t.fabric||(t.fabric={});return e.Shadow?void e.warn("fabric.Shadow is already defined."):(e.Shadow=e.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,initialize:function(t){"string"==typeof t&&(t=this._parseShadow(t));for(var i in t)this[i]=t[i];this.id=e.Object.__uid++},_parseShadow:function(t){var i=t.trim(),n=e.Shadow.reOffsetsAndBlur.exec(i)||[],r=i.replace(e.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)";return{color:r.trim(),offsetX:parseInt(n[1],10)||0,offsetY:parseInt(n[2],10)||0,blur:parseInt(n[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(t){var e="SourceAlpha";return t&&(t.fill===this.color||t.stroke===this.color)&&(e="SourceGraphic"),'<filter id="SVGID_'+this.id+'" y="-40%" height="180%"><feGaussianBlur in="'+e+'" stdDeviation="'+(this.blur?this.blur/3:0)+'"></feGaussianBlur><feOffset dx="'+this.offsetX+'" dy="'+this.offsetY+'"></feOffset><feMerge><feMergeNode></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter>'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY};var t={},i=e.Shadow.prototype;return this.color!==i.color&&(t.color=this.color),this.blur!==i.blur&&(t.blur=this.blur),this.offsetX!==i.offsetX&&(t.offsetX=this.offsetX),this.offsetY!==i.offsetY&&(t.offsetY=this.offsetY),t}}),void(e.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:px)?(?:\s?|$))?(-?\d+(?:px)?(?:\s?|$))?(\d+(?:px)?)?(?:\s?|$)(?:$|\s)/))}("undefined"!=typeof exports?exports:this),function(){"use strict";if(fabric.StaticCanvas)return void fabric.warn("fabric.StaticCanvas is already defined.");var t=fabric.util.object.extend,e=fabric.util.getElementOffset,i=fabric.util.removeFromArray,n=new Error("Could not initialize `canvas` element");fabric.StaticCanvas=fabric.util.createClass({initialize:function(t,e){e||(e={}),this._initStatic(t,e),fabric.StaticCanvas.activeInstance=this},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!0,renderOnAddRemove:!0,clipTo:null,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:[1,0,0,1,0,0],onBeforeScaleRotate:function(){},_initStatic:function(t,e){this._objects=[],this._createLowerCanvas(t),this._initOptions(e),this._setImageSmoothing(),e.overlayImage&&this.setOverlayImage(e.overlayImage,this.renderAll.bind(this)),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,this.renderAll.bind(this)),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,this.renderAll.bind(this)),e.overlayColor&&this.setOverlayColor(e.overlayColor,this.renderAll.bind(this)),this.calcOffset()},calcOffset:function(){return this._offset=e(this.lowerCanvasEl),this},setOverlayImage:function(t,e,i){return this.__setBgOverlayImage("overlayImage",t,e,i)},setBackgroundImage:function(t,e,i){return this.__setBgOverlayImage("backgroundImage",t,e,i)},setOverlayColor:function(t,e){return this.__setBgOverlayColor("overlayColor",t,e)},setBackgroundColor:function(t,e){return this.__setBgOverlayColor("backgroundColor",t,e)},_setImageSmoothing:function(){var t=this.getContext();t.imageSmoothingEnabled=this.imageSmoothingEnabled,t.webkitImageSmoothingEnabled=this.imageSmoothingEnabled,t.mozImageSmoothingEnabled=this.imageSmoothingEnabled,t.msImageSmoothingEnabled=this.imageSmoothingEnabled,t.oImageSmoothingEnabled=this.imageSmoothingEnabled},__setBgOverlayImage:function(t,e,i,n){return"string"==typeof e?fabric.util.loadImage(e,function(e){this[t]=new fabric.Image(e,n),i&&i()},this):(this[t]=e,i&&i()),this},__setBgOverlayColor:function(t,e,i){if(e&&e.source){var n=this;fabric.util.loadImage(e.source,function(r){n[t]=new fabric.Pattern({source:r,repeat:e.repeat,offsetX:e.offsetX,offsetY:e.offsetY}),i&&i()})}else this[t]=e,i&&i();return this},_createCanvasElement:function(){var t=fabric.document.createElement("canvas");if(t.style||(t.style={}),!t)throw n;return this._initCanvasElement(t),t},_initCanvasElement:function(t){if(fabric.util.createCanvasElement(t),"undefined"==typeof t.getContext)throw n},_initOptions:function(t){for(var e in t)this[e]=t[e];this.width=this.width||parseInt(this.lowerCanvasEl.width,10)||0,this.height=this.height||parseInt(this.lowerCanvasEl.height,10)||0,this.lowerCanvasEl.style&&(this.lowerCanvasEl.width=this.width,this.lowerCanvasEl.height=this.height,this.lowerCanvasEl.style.width=this.width+"px",this.lowerCanvasEl.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){this.lowerCanvasEl=fabric.util.getById(t)||this._createCanvasElement(),this._initCanvasElement(this.lowerCanvasEl),fabric.util.addClass(this.lowerCanvasEl,"lower-canvas"),this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var i;e=e||{};for(var n in t)i=t[n],e.cssOnly||(this._setBackstoreDimension(n,t[n]),i+="px"),e.backstoreOnly||this._setCssDimension(n,i);return e.cssOnly||this.renderAll(),this.calcOffset(),this},_setBackstoreDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.upperCanvasEl&&(this.upperCanvasEl[t]=e),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this[t]=e,this},_setCssDimension:function(t,e){return this.lowerCanvasEl.style[t]=e,this.upperCanvasEl&&(this.upperCanvasEl.style[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e),this},getZoom:function(){return Math.sqrt(this.viewportTransform[0]*this.viewportTransform[3])},setViewportTransform:function(t){this.viewportTransform=t,this.renderAll();for(var e=0,i=this._objects.length;i>e;e++)this._objects[e].setCoords();return this},zoomToPoint:function(t,e){var i=t;t=fabric.util.transformPoint(t,fabric.util.invertTransform(this.viewportTransform)),this.viewportTransform[0]=e,this.viewportTransform[3]=e;var n=fabric.util.transformPoint(t,this.viewportTransform);this.viewportTransform[4]+=i.x-n.x,this.viewportTransform[5]+=i.y-n.y,this.renderAll();for(var r=0,s=this._objects.length;s>r;r++)this._objects[r].setCoords();return this},setZoom:function(t){return this.zoomToPoint(new fabric.Point(0,0),t),this},absolutePan:function(t){this.viewportTransform[4]=-t.x,this.viewportTransform[5]=-t.y,this.renderAll();for(var e=0,i=this._objects.length;i>e;e++)this._objects[e].setCoords();return this},relativePan:function(t){return this.absolutePan(new fabric.Point(-t.x-this.viewportTransform[4],-t.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},getActiveObject:function(){return null},getActiveGroup:function(){return null},_draw:function(t,e){if(e){t.save();var i=this.viewportTransform;t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e.render(t),t.restore(),this.controlsAboveOverlay||e._renderControls(t)}},_onObjectAdded:function(t){this.stateful&&t.setupState(),t.canvas=this,t.setCoords(),this.fire("object:added",{target:t}),t.fire("added")},_onObjectRemoved:function(t){this.getActiveObject()===t&&(this.fire("before:selection:cleared",{target:t}),this._discardActiveObject(),this.fire("selection:cleared")),this.fire("object:removed",{target:t}),t.fire("removed")},clearContext:function(t){return t.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this._objects.length=0,this.discardActiveGroup&&this.discardActiveGroup(),this.discardActiveObject&&this.discardActiveObject(),this.clearContext(this.contextContainer),this.contextTop&&this.clearContext(this.contextTop),this.fire("canvas:cleared"),this.renderAll(),this},renderAll:function(t){var e=this[t===!0&&this.interactive?"contextTop":"contextContainer"],i=this.getActiveGroup();return this.contextTop&&this.selection&&!this._groupSelector&&this.clearContext(this.contextTop),t||this.clearContext(e),this.fire("before:render"),this.clipTo&&fabric.util.clipContext(this,e),this._renderBackground(e),this._renderObjects(e,i),this._renderActiveGroup(e,i),this.clipTo&&e.restore(),this._renderOverlay(e),this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),this.fire("after:render"),this},_renderObjects:function(t,e){var i,n;if(e)for(i=0,n=this._objects.length;n>i;++i)this._objects[i]&&!e.contains(this._objects[i])&&this._draw(t,this._objects[i]);else for(i=0,n=this._objects.length;n>i;++i)this._draw(t,this._objects[i])},_renderActiveGroup:function(t,e){if(e){var i=[];this.forEachObject(function(t){e.contains(t)&&i.push(t)}),e._set("objects",i),this._draw(t,e)}},_renderBackground:function(t){this.backgroundColor&&(t.fillStyle=this.backgroundColor.toLive?this.backgroundColor.toLive(t):this.backgroundColor,t.fillRect(this.backgroundColor.offsetX||0,this.backgroundColor.offsetY||0,this.width,this.height)),this.backgroundImage&&this._draw(t,this.backgroundImage)},_renderOverlay:function(t){this.overlayColor&&(t.fillStyle=this.overlayColor.toLive?this.overlayColor.toLive(t):this.overlayColor,t.fillRect(this.overlayColor.offsetX||0,this.overlayColor.offsetY||0,this.width,this.height)),this.overlayImage&&this._draw(t,this.overlayImage)},renderTop:function(){var t=this.contextTop||this.contextContainer;this.clearContext(t),this.selection&&this._groupSelector&&this._drawSelection();var e=this.getActiveGroup();return e&&e.render(t),this._renderOverlay(t),this.fire("after:render"),this},getCenter:function(){return{top:this.getHeight()/2,left:this.getWidth()/2}},centerObjectH:function(t){return this._centerObject(t,new fabric.Point(this.getCenter().left,t.getCenterPoint().y)),this.renderAll(),this},centerObjectV:function(t){return this._centerObject(t,new fabric.Point(t.getCenterPoint().x,this.getCenter().top)),this.renderAll(),this},centerObject:function(t){var e=this.getCenter();return this._centerObject(t,new fabric.Point(e.left,e.top)),this.renderAll(),this},_centerObject:function(t,e){return t.setPositionByOrigin(e,"center","center"),this},toDatalessJSON:function(t){return this.toDatalessObject(t)},toObject:function(t){return this._toObjectMethod("toObject",t)},toDatalessObject:function(t){return this._toObjectMethod("toDatalessObject",t)},_toObjectMethod:function(e,i){var n=this.getActiveGroup();n&&this.discardActiveGroup();var r={objects:this._toObjects(e,i)};return t(r,this.__serializeBgOverlay()),fabric.util.populateWithProperties(this,r,i),n&&(this.setActiveGroup(new fabric.Group(n.getObjects(),{originX:"center",originY:"center"})),n.forEachObject(function(t){t.set("active",!0)}),this._currentTransform&&(this._currentTransform.target=this.getActiveGroup())),r},_toObjects:function(t,e){return this.getObjects().map(function(i){return this._toObject(i,t,e)},this)},_toObject:function(t,e,i){var n;this.includeDefaultValues||(n=t.includeDefaultValues,t.includeDefaultValues=!1);var r=t[e](i);return this.includeDefaultValues||(t.includeDefaultValues=n),r},__serializeBgOverlay:function(){var t={background:this.backgroundColor&&this.backgroundColor.toObject?this.backgroundColor.toObject():this.backgroundColor};return this.overlayColor&&(t.overlay=this.overlayColor.toObject?this.overlayColor.toObject():this.overlayColor),this.backgroundImage&&(t.backgroundImage=this.backgroundImage.toObject()),this.overlayImage&&(t.overlayImage=this.overlayImage.toObject()),t
|
|
},toSVG:function(t,e){t||(t={});var i=[];return this._setSVGPreamble(i,t),this._setSVGHeader(i,t),this._setSVGBgOverlayColor(i,"backgroundColor"),this._setSVGBgOverlayImage(i,"backgroundImage"),this._setSVGObjects(i,e),this._setSVGBgOverlayColor(i,"overlayColor"),this._setSVGBgOverlayImage(i,"overlayImage"),i.push("</svg>"),i.join("")},_setSVGPreamble:function(t,e){e.suppressPreamble||t.push('<?xml version="1.0" encoding="',e.encoding||"UTF-8",'" standalone="no" ?>','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ','"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')},_setSVGHeader:function(t,e){t.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',e.viewBox?e.viewBox.width:this.width,'" ','height="',e.viewBox?e.viewBox.height:this.height,'" ',this.backgroundColor&&!this.backgroundColor.toLive?'style="background-color: '+this.backgroundColor+'" ':null,e.viewBox?'viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':null,'xml:space="preserve">',"<desc>Created with Fabric.js ",fabric.version,"</desc>","<defs>",fabric.createSVGFontFacesMarkup(this.getObjects()),fabric.createSVGRefElementsMarkup(this),"</defs>")},_setSVGObjects:function(t,e){var i=this.getActiveGroup();i&&this.discardActiveGroup();for(var n=0,r=this.getObjects(),s=r.length;s>n;n++)t.push(r[n].toSVG(e));i&&(this.setActiveGroup(new fabric.Group(i.getObjects())),i.forEachObject(function(t){t.set("active",!0)}))},_setSVGBgOverlayImage:function(t,e){this[e]&&this[e].toSVG&&t.push(this[e].toSVG())},_setSVGBgOverlayColor:function(t,e){this[e]&&this[e].source?t.push('<rect x="',this[e].offsetX,'" y="',this[e].offsetY,'" ','width="',"repeat-y"===this[e].repeat||"no-repeat"===this[e].repeat?this[e].source.width:this.width,'" height="',"repeat-x"===this[e].repeat||"no-repeat"===this[e].repeat?this[e].source.height:this.height,'" fill="url(#'+e+'Pattern)"',"></rect>"):this[e]&&"overlayColor"===e&&t.push('<rect x="0" y="0" ','width="',this.width,'" height="',this.height,'" fill="',this[e],'"',"></rect>")},sendToBack:function(t){return i(this._objects,t),this._objects.unshift(t),this.renderAll&&this.renderAll()},bringToFront:function(t){return i(this._objects,t),this._objects.push(t),this.renderAll&&this.renderAll()},sendBackwards:function(t,e){var n=this._objects.indexOf(t);if(0!==n){var r=this._findNewLowerIndex(t,n,e);i(this._objects,t),this._objects.splice(r,0,t),this.renderAll&&this.renderAll()}return this},_findNewLowerIndex:function(t,e,i){var n;if(i){n=e;for(var r=e-1;r>=0;--r){var s=t.intersectsWithObject(this._objects[r])||t.isContainedWithinObject(this._objects[r])||this._objects[r].isContainedWithinObject(t);if(s){n=r;break}}}else n=e-1;return n},bringForward:function(t,e){var n=this._objects.indexOf(t);if(n!==this._objects.length-1){var r=this._findNewUpperIndex(t,n,e);i(this._objects,t),this._objects.splice(r,0,t),this.renderAll&&this.renderAll()}return this},_findNewUpperIndex:function(t,e,i){var n;if(i){n=e;for(var r=e+1;r<this._objects.length;++r){var s=t.intersectsWithObject(this._objects[r])||t.isContainedWithinObject(this._objects[r])||this._objects[r].isContainedWithinObject(t);if(s){n=r;break}}}else n=e+1;return n},moveTo:function(t,e){return i(this._objects,t),this._objects.splice(e,0,t),this.renderAll&&this.renderAll()},dispose:function(){return this.clear(),this.interactive&&this.removeListeners(),this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this.getObjects().length+" }>"}}),t(fabric.StaticCanvas.prototype,fabric.Observable),t(fabric.StaticCanvas.prototype,fabric.Collection),t(fabric.StaticCanvas.prototype,fabric.DataURLExporter),t(fabric.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=fabric.util.createCanvasElement();if(!e||!e.getContext)return null;var i=e.getContext("2d");if(!i)return null;switch(t){case"getImageData":return"undefined"!=typeof i.getImageData;case"setLineDash":return"undefined"!=typeof i.setLineDash;case"toDataURL":return"undefined"!=typeof e.toDataURL;case"toDataURLWithQuality":try{return e.toDataURL("image/jpeg",0),!0}catch(n){}return!1;default:return null}}}),fabric.StaticCanvas.prototype.toJSON=fabric.StaticCanvas.prototype.toObject}(),fabric.BaseBrush=fabric.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",setShadow:function(t){return this.shadow=new fabric.Shadow(t),this},_setBrushStyles:function(){var t=this.canvas.contextTop;t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.lineJoin=this.strokeLineJoin},_setShadow:function(){if(this.shadow){var t=this.canvas.contextTop;t.shadowColor=this.shadow.color,t.shadowBlur=this.shadow.blur,t.shadowOffsetX=this.shadow.offsetX,t.shadowOffsetY=this.shadow.offsetY}},_resetShadow:function(){var t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0}}),function(){var t=fabric.util.array.min,e=fabric.util.array.max;fabric.PencilBrush=fabric.util.createClass(fabric.BaseBrush,{initialize:function(t){this.canvas=t,this._points=[]},onMouseDown:function(t){this._prepareForDrawing(t),this._captureDrawingPath(t),this._render()},onMouseMove:function(t){this._captureDrawingPath(t),this.canvas.clearContext(this.canvas.contextTop),this._render()},onMouseUp:function(){this._finalizeAndAddPath()},_prepareForDrawing:function(t){var e=new fabric.Point(t.x,t.y);this._reset(),this._addPoint(e),this.canvas.contextTop.moveTo(e.x,e.y)},_addPoint:function(t){this._points.push(t)},_reset:function(){this._points.length=0,this._setBrushStyles(),this._setShadow()},_captureDrawingPath:function(t){var e=new fabric.Point(t.x,t.y);this._addPoint(e)},_render:function(){var t=this.canvas.contextTop,e=this.canvas.viewportTransform,i=this._points[0],n=this._points[1];t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t.beginPath(),2===this._points.length&&i.x===n.x&&i.y===n.y&&(i.x-=.5,n.x+=.5),t.moveTo(i.x,i.y);for(var r=1,s=this._points.length;s>r;r++){var o=i.midPointFrom(n);t.quadraticCurveTo(i.x,i.y,o.x,o.y),i=this._points[r],n=this._points[r+1]}t.lineTo(i.x,i.y),t.stroke(),t.restore()},_getSVGPathData:function(){return this.box=this.getPathBoundingBox(this._points),this.convertPointsToSVGPath(this._points,this.box.minX,this.box.minY)},getPathBoundingBox:function(i){for(var n=[],r=[],s=i[0],o=i[1],a=s,h=1,l=i.length;l>h;h++){var c=s.midPointFrom(o);n.push(a.x),n.push(c.x),r.push(a.y),r.push(c.y),s=i[h],o=i[h+1],a=c}return n.push(s.x),r.push(s.y),{minX:t(n),minY:t(r),maxX:e(n),maxY:e(r)}},convertPointsToSVGPath:function(t,e,i){var n=[],r=new fabric.Point(t[0].x-e,t[0].y-i),s=new fabric.Point(t[1].x-e,t[1].y-i);n.push("M ",t[0].x-e," ",t[0].y-i," ");for(var o=1,a=t.length;a>o;o++){var h=r.midPointFrom(s);n.push("Q ",r.x," ",r.y," ",h.x," ",h.y," "),r=new fabric.Point(t[o].x-e,t[o].y-i),o+1<t.length&&(s=new fabric.Point(t[o+1].x-e,t[o+1].y-i))}return n.push("L ",r.x," ",r.y," "),n},createPath:function(t){var e=new fabric.Path(t);return e.fill=null,e.stroke=this.color,e.strokeWidth=this.width,e.strokeLineCap=this.strokeLineCap,e.strokeLineJoin=this.strokeLineJoin,this.shadow&&(this.shadow.affectStroke=!0,e.setShadow(this.shadow)),e},_finalizeAndAddPath:function(){var t=this.canvas.contextTop;t.closePath();var e=this._getSVGPathData().join("");if("M 0 0 Q 0 0 0 0 L 0 0"===e)return void this.canvas.renderAll();var i=this.box.minX+(this.box.maxX-this.box.minX)/2,n=this.box.minY+(this.box.maxY-this.box.minY)/2;this.canvas.contextTop.arc(i,n,3,0,2*Math.PI,!1);var r=this.createPath(e);r.set({left:i,top:n,originX:"center",originY:"center"}),this.canvas.add(r),r.setCoords(),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderAll(),this.canvas.fire("path:created",{path:r})}})}(),fabric.CircleBrush=fabric.util.createClass(fabric.BaseBrush,{width:10,initialize:function(t){this.canvas=t,this.points=[]},drawDot:function(t){var e=this.addPoint(t),i=this.canvas.contextTop,n=this.canvas.viewportTransform;i.save(),i.transform(n[0],n[1],n[2],n[3],n[4],n[5]),i.fillStyle=e.fill,i.beginPath(),i.arc(e.x,e.y,e.radius,0,2*Math.PI,!1),i.closePath(),i.fill(),i.restore()},onMouseDown:function(t){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(t)},onMouseMove:function(t){this.drawDot(t)},onMouseUp:function(){var t=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var e=[],i=0,n=this.points.length;n>i;i++){var r=this.points[i],s=new fabric.Circle({radius:r.radius,left:r.x,top:r.y,originX:"center",originY:"center",fill:r.fill});this.shadow&&s.setShadow(this.shadow),e.push(s)}var o=new fabric.Group(e,{originX:"center",originY:"center"});o.canvas=this.canvas,this.canvas.add(o),this.canvas.fire("path:created",{path:o}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.renderAll()},addPoint:function(t){var e=new fabric.Point(t.x,t.y),i=fabric.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,n=new fabric.Color(this.color).setAlpha(fabric.util.getRandomInt(0,100)/100).toRgba();return e.radius=i,e.fill=n,this.points.push(e),e}}),fabric.SprayBrush=fabric.util.createClass(fabric.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(t){this.canvas=t,this.sprayChunks=[]},onMouseDown:function(t){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(t),this.render()},onMouseMove:function(t){this.addSprayChunk(t),this.render()},onMouseUp:function(){var t=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var e=[],i=0,n=this.sprayChunks.length;n>i;i++)for(var r=this.sprayChunks[i],s=0,o=r.length;o>s;s++){var a=new fabric.Rect({width:r[s].width,height:r[s].width,left:r[s].x+1,top:r[s].y+1,originX:"center",originY:"center",fill:this.color});this.shadow&&a.setShadow(this.shadow),e.push(a)}this.optimizeOverlapping&&(e=this._getOptimizedRects(e));var h=new fabric.Group(e,{originX:"center",originY:"center"});h.canvas=this.canvas,this.canvas.add(h),this.canvas.fire("path:created",{path:h}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.renderAll()},_getOptimizedRects:function(t){for(var e,i={},n=0,r=t.length;r>n;n++)e=t[n].left+""+t[n].top,i[e]||(i[e]=t[n]);var s=[];for(e in i)s.push(i[e]);return s},render:function(){var t=this.canvas.contextTop;t.fillStyle=this.color;var e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]);for(var i=0,n=this.sprayChunkPoints.length;n>i;i++){var r=this.sprayChunkPoints[i];"undefined"!=typeof r.opacity&&(t.globalAlpha=r.opacity),t.fillRect(r.x,r.y,r.width,r.width)}t.restore()},addSprayChunk:function(t){this.sprayChunkPoints=[];for(var e,i,n,r=this.width/2,s=0;s<this.density;s++){e=fabric.util.getRandomInt(t.x-r,t.x+r),i=fabric.util.getRandomInt(t.y-r,t.y+r),n=this.dotWidthVariance?fabric.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var o=new fabric.Point(e,i);o.width=n,this.randomOpacity&&(o.opacity=fabric.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(o)}this.sprayChunks.push(this.sprayChunkPoints)}}),fabric.PatternBrush=fabric.util.createClass(fabric.PencilBrush,{getPatternSrc:function(){var t=20,e=5,i=fabric.document.createElement("canvas"),n=i.getContext("2d");return i.width=i.height=t+e,n.fillStyle=this.color,n.beginPath(),n.arc(t/2,t/2,t/2,0,2*Math.PI,!1),n.closePath(),n.fill(),i},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(){return this.canvas.contextTop.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(){this.callSuper("_setBrushStyles"),this.canvas.contextTop.strokeStyle=this.getPattern()},createPath:function(t){var e=this.callSuper("createPath",t);return e.stroke=new fabric.Pattern({source:this.source||this.getPatternSrcFunction()}),e}}),function(){var t=fabric.util.getPointer,e=fabric.util.degreesToRadians,i=fabric.util.radiansToDegrees,n=Math.atan2,r=Math.abs,s=.5;fabric.Canvas=fabric.util.createClass(fabric.StaticCanvas,{initialize:function(t,e){e||(e={}),this._initStatic(t,e),this._initInteractive(),this._createCacheCanvas(),fabric.Canvas.activeInstance=this},uniScaleTransform:!1,centeredScaling:!1,centeredRotation:!1,interactive:!0,selection:!0,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",rotationCursor:"crosshair",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this.freeDrawingBrush=fabric.PencilBrush&&new fabric.PencilBrush(this),this.calcOffset()},_resetCurrentTransform:function(t){var e=this._currentTransform;e.target.set({scaleX:e.original.scaleX,scaleY:e.original.scaleY,left:e.original.left,top:e.original.top}),this._shouldCenterTransform(t,e.target)?"rotate"===e.action?this._setOriginToCenter(e.target):("center"!==e.originX&&(e.mouseXSign="right"===e.originX?-1:1),"center"!==e.originY&&(e.mouseYSign="bottom"===e.originY?-1:1),e.originX="center",e.originY="center"):(e.originX=e.original.originX,e.originY=e.original.originY)},containsPoint:function(t,e){var i=this.getPointer(t,!0),n=this._normalizePointer(e,i);return e.containsPoint(n)||e._findTargetCorner(i)},_normalizePointer:function(t,e){var i,n=this.getActiveGroup(),r=e.x,s=e.y,o=n&&"group"!==t.type&&n.contains(t);return o&&(i=new fabric.Point(n.left,n.top),i=fabric.util.transformPoint(i,this.viewportTransform,!0),r-=i.x,s-=i.y),{x:r,y:s}},isTargetTransparent:function(t,e,i){var n=t.hasBorders,r=t.transparentCorners;t.hasBorders=t.transparentCorners=!1,this._draw(this.contextCache,t),t.hasBorders=n,t.transparentCorners=r;var s=fabric.util.isTransparent(this.contextCache,e,i,this.targetFindTolerance);return this.clearContext(this.contextCache),s},_shouldClearSelection:function(t,e){var i=this.getActiveGroup(),n=this.getActiveObject();return!e||e&&i&&!i.contains(e)&&i!==e&&!t.shiftKey||e&&!e.evented||e&&!e.selectable&&n&&n!==e},_shouldCenterTransform:function(t,e){if(e){var i,n=this._currentTransform;return"scale"===n.action||"scaleX"===n.action||"scaleY"===n.action?i=this.centeredScaling||e.centeredScaling:"rotate"===n.action&&(i=this.centeredRotation||e.centeredRotation),i?!t.altKey:t.altKey}},_getOriginFromCorner:function(t,e){var i={x:t.originX,y:t.originY};return"ml"===e||"tl"===e||"bl"===e?i.x="right":("mr"===e||"tr"===e||"br"===e)&&(i.x="left"),"tl"===e||"mt"===e||"tr"===e?i.y="bottom":("bl"===e||"mb"===e||"br"===e)&&(i.y="top"),i},_getActionFromCorner:function(t,e){var i="drag";return e&&(i="ml"===e||"mr"===e?"scaleX":"mt"===e||"mb"===e?"scaleY":"mtr"===e?"rotate":"scale"),i},_setupCurrentTransform:function(t,i){if(i){var n=this.getPointer(t),r=i._findTargetCorner(this.getPointer(t,!0)),s=this._getActionFromCorner(i,r),o=this._getOriginFromCorner(i,r);this._currentTransform={target:i,action:s,scaleX:i.scaleX,scaleY:i.scaleY,offsetX:n.x-i.left,offsetY:n.y-i.top,originX:o.x,originY:o.y,ex:n.x,ey:n.y,left:i.left,top:i.top,theta:e(i.angle),width:i.width*i.scaleX,mouseXSign:1,mouseYSign:1},this._currentTransform.original={left:i.left,top:i.top,scaleX:i.scaleX,scaleY:i.scaleY,originX:o.x,originY:o.y},this._resetCurrentTransform(t)}},_translateObject:function(t,e){var i=this._currentTransform.target;i.get("lockMovementX")||i.set("left",t-this._currentTransform.offsetX),i.get("lockMovementY")||i.set("top",e-this._currentTransform.offsetY)},_scaleObject:function(t,e,i){var n=this._currentTransform,r=n.target,s=r.get("lockScalingX"),o=r.get("lockScalingY"),a=r.get("lockScalingFlip");if(!s||!o){var h=r.translateToOriginPoint(r.getCenterPoint(),n.originX,n.originY),l=r.toLocalPoint(new fabric.Point(t,e),n.originX,n.originY);this._setLocalMouse(l,n),this._setObjectScale(l,n,s,o,i,a),r.setPositionByOrigin(h,n.originX,n.originY)}},_setObjectScale:function(t,e,i,n,r,s){var o=e.target,a=!1,h=!1;e.newScaleX=t.x/(o.width+o.strokeWidth),e.newScaleY=t.y/(o.height+o.strokeWidth),s&&e.newScaleX<=0&&e.newScaleX<o.scaleX&&(a=!0),s&&e.newScaleY<=0&&e.newScaleY<o.scaleY&&(h=!0),"equally"!==r||i||n?r?"x"!==r||o.get("lockUniScaling")?"y"===r&&!o.get("lockUniScaling")&&(h||n||o.set("scaleY",e.newScaleY)):a||i||o.set("scaleX",e.newScaleX):(a||i||o.set("scaleX",e.newScaleX),h||n||o.set("scaleY",e.newScaleY)):a||h||this._scaleObjectEqually(t,o,e),a||h||this._flipObject(e)},_scaleObjectEqually:function(t,e,i){var n=t.y+t.x,r=(e.height+e.strokeWidth)*i.original.scaleY+(e.width+e.strokeWidth)*i.original.scaleX;i.newScaleX=i.original.scaleX*n/r,i.newScaleY=i.original.scaleY*n/r,e.set("scaleX",i.newScaleX),e.set("scaleY",i.newScaleY)},_flipObject:function(t){t.newScaleX<0&&("left"===t.originX?t.originX="right":"right"===t.originX&&(t.originX="left")),t.newScaleY<0&&("top"===t.originY?t.originY="bottom":"bottom"===t.originY&&(t.originY="top"))},_setLocalMouse:function(t,e){var i=e.target;"right"===e.originX?t.x*=-1:"center"===e.originX&&(t.x*=2*e.mouseXSign,t.x<0&&(e.mouseXSign=-e.mouseXSign)),"bottom"===e.originY?t.y*=-1:"center"===e.originY&&(t.y*=2*e.mouseYSign,t.y<0&&(e.mouseYSign=-e.mouseYSign)),r(t.x)>i.padding?t.x<0?t.x+=i.padding:t.x-=i.padding:t.x=0,r(t.y)>i.padding?t.y<0?t.y+=i.padding:t.y-=i.padding:t.y=0},_rotateObject:function(t,e){var r=this._currentTransform;if(!r.target.get("lockRotation")){var s=n(r.ey-r.top,r.ex-r.left),o=n(e-r.top,t-r.left),a=i(o-s+r.theta);0>a&&(a=360+a),r.target.angle=a}},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.setAngle(0)},_drawSelection:function(){var t=this.contextTop,e=this._groupSelector,i=e.left,n=e.top,o=r(i),a=r(n);if(t.fillStyle=this.selectionColor,t.fillRect(e.ex-(i>0?0:-i),e.ey-(n>0?0:-n),o,a),t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,this.selectionDashArray.length>1){var h=e.ex+s-(i>0?0:o),l=e.ey+s-(n>0?0:a);t.beginPath(),fabric.util.drawDashedLine(t,h,l,h+o,l,this.selectionDashArray),fabric.util.drawDashedLine(t,h,l+a-1,h+o,l+a-1,this.selectionDashArray),fabric.util.drawDashedLine(t,h,l,h,l+a,this.selectionDashArray),fabric.util.drawDashedLine(t,h+o-1,l,h+o-1,l+a,this.selectionDashArray),t.closePath(),t.stroke()}else t.strokeRect(e.ex+s-(i>0?0:o),e.ey+s-(n>0?0:a),o,a)},_isLastRenderedObject:function(t){return this.controlsAboveOverlay&&this.lastRenderedObjectWithControlsAboveOverlay&&this.lastRenderedObjectWithControlsAboveOverlay.visible&&this.containsPoint(t,this.lastRenderedObjectWithControlsAboveOverlay)&&this.lastRenderedObjectWithControlsAboveOverlay._findTargetCorner(this.getPointer(t,!0))},findTarget:function(t,e){if(!this.skipTargetFind){if(this._isLastRenderedObject(t))return this.lastRenderedObjectWithControlsAboveOverlay;var i=this.getActiveGroup();if(i&&!e&&this.containsPoint(t,i))return i;var n=this._searchPossibleTargets(t);return this._fireOverOutEvents(n),n}},_fireOverOutEvents:function(t){t?this._hoveredTarget!==t&&(this.fire("mouse:over",{target:t}),t.fire("mouseover"),this._hoveredTarget&&(this.fire("mouse:out",{target:this._hoveredTarget}),this._hoveredTarget.fire("mouseout")),this._hoveredTarget=t):this._hoveredTarget&&(this.fire("mouse:out",{target:this._hoveredTarget}),this._hoveredTarget.fire("mouseout"),this._hoveredTarget=null)},_checkTarget:function(t,e,i){if(e&&e.visible&&e.evented&&this.containsPoint(t,e)){if(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing)return!0;var n=this.isTargetTransparent(e,i.x,i.y);if(!n)return!0}},_searchPossibleTargets:function(t){for(var e,i=this.getPointer(t,!0),n=this._objects.length;n--;)if(this._checkTarget(t,this._objects[n],i)){this.relatedTarget=this._objects[n],e=this._objects[n];break}return e},getPointer:function(e,i,n){n||(n=this.upperCanvasEl);var r,s=t(e,n),o=n.getBoundingClientRect();return this.calcOffset(),s.x=s.x-this._offset.left,s.y=s.y-this._offset.top,i||(s=fabric.util.transformPoint(s,fabric.util.invertTransform(this.viewportTransform))),r=0===o.width||0===o.height?{width:1,height:1}:{width:n.width/o.width,height:n.height/o.height},{x:s.x*r.width,y:s.y*r.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,"");this.upperCanvasEl=this._createCanvasElement(),fabric.util.addClass(this.upperCanvasEl,"upper-canvas "+t),this.wrapperEl.appendChild(this.upperCanvasEl),this._copyCanvasStyle(this.lowerCanvasEl,this.upperCanvasEl),this._applyCanvasStyle(this.upperCanvasEl),this.contextTop=this.upperCanvasEl.getContext("2d")},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=fabric.util.wrapElement(this.lowerCanvasEl,"div",{"class":this.containerClass}),fabric.util.setStyle(this.wrapperEl,{width:this.getWidth()+"px",height:this.getHeight()+"px",position:"relative"}),fabric.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.getWidth()||t.width,i=this.getHeight()||t.height;fabric.util.setStyle(t,{position:"absolute",width:e+"px",height:i+"px",left:0,top:0}),t.width=e,t.height=i,fabric.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},_setActiveObject:function(t){this._activeObject&&this._activeObject.set("active",!1),this._activeObject=t,t.set("active",!0)},setActiveObject:function(t,e){return this._setActiveObject(t),this.renderAll(),this.fire("object:selected",{target:t,e:e}),t.fire("selected",{e:e}),this},getActiveObject:function(){return this._activeObject},_discardActiveObject:function(){this._activeObject&&this._activeObject.set("active",!1),this._activeObject=null},discardActiveObject:function(t){return this._discardActiveObject(),this.renderAll(),this.fire("selection:cleared",{e:t}),this},_setActiveGroup:function(t){this._activeGroup=t,t&&t.set("active",!0)},setActiveGroup:function(t,e){return this._setActiveGroup(t),t&&(this.fire("object:selected",{target:t,e:e}),t.fire("selected",{e:e})),this},getActiveGroup:function(){return this._activeGroup},_discardActiveGroup:function(){var t=this.getActiveGroup();t&&t.destroy(),this.setActiveGroup(null)},discardActiveGroup:function(t){return this._discardActiveGroup(),this.fire("selection:cleared",{e:t}),this},deactivateAll:function(){for(var t=this.getObjects(),e=0,i=t.length;i>e;e++)t[e].set("active",!1);return this._discardActiveGroup(),this._discardActiveObject(),this},deactivateAllWithDispatch:function(t){var e=this.getActiveGroup()||this.getActiveObject();return e&&this.fire("before:selection:cleared",{target:e,e:t}),this.deactivateAll(),e&&this.fire("selection:cleared",{e:t}),this},drawControls:function(t){var e=this.getActiveGroup();e?this._drawGroupControls(t,e):this._drawObjectsControls(t)},_drawGroupControls:function(t,e){e._renderControls(t)},_drawObjectsControls:function(t){for(var e=0,i=this._objects.length;i>e;++e)this._objects[e]&&this._objects[e].active&&(this._objects[e]._renderControls(t),this.lastRenderedObjectWithControlsAboveOverlay=this._objects[e])}});for(var o in fabric.StaticCanvas)"prototype"!==o&&(fabric.Canvas[o]=fabric.StaticCanvas[o]);fabric.isTouchSupported&&(fabric.Canvas.prototype._setCursorFromEvent=function(){}),fabric.Element=fabric.Canvas}(),function(){var t={mt:0,tr:1,mr:2,br:3,mb:4,bl:5,ml:6,tl:7},e=fabric.util.addListener,i=fabric.util.removeListener;fabric.util.object.extend(fabric.Canvas.prototype,{cursorMap:["n-resize","ne-resize","e-resize","se-resize","s-resize","sw-resize","w-resize","nw-resize"],_initEventListeners:function(){this._bindEvents(),e(fabric.window,"resize",this._onResize),e(this.upperCanvasEl,"mousedown",this._onMouseDown),e(this.upperCanvasEl,"mousemove",this._onMouseMove),e(this.upperCanvasEl,"mousewheel",this._onMouseWheel),e(this.upperCanvasEl,"touchstart",this._onMouseDown),e(this.upperCanvasEl,"touchmove",this._onMouseMove),"undefined"!=typeof Event&&"add"in Event&&(Event.add(this.upperCanvasEl,"gesture",this._onGesture),Event.add(this.upperCanvasEl,"drag",this._onDrag),Event.add(this.upperCanvasEl,"orientation",this._onOrientationChange),Event.add(this.upperCanvasEl,"shake",this._onShake))},_bindEvents:function(){this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this)},removeListeners:function(){i(fabric.window,"resize",this._onResize),i(this.upperCanvasEl,"mousedown",this._onMouseDown),i(this.upperCanvasEl,"mousemove",this._onMouseMove),i(this.upperCanvasEl,"mousewheel",this._onMouseWheel),i(this.upperCanvasEl,"touchstart",this._onMouseDown),i(this.upperCanvasEl,"touchmove",this._onMouseMove),"undefined"!=typeof Event&&"remove"in Event&&(Event.remove(this.upperCanvasEl,"gesture",this._onGesture),Event.remove(this.upperCanvasEl,"drag",this._onDrag),Event.remove(this.upperCanvasEl,"orientation",this._onOrientationChange),Event.remove(this.upperCanvasEl,"shake",this._onShake))},_onGesture:function(t,e){this.__onTransformGesture&&this.__onTransformGesture(t,e)},_onDrag:function(t,e){this.__onDrag&&this.__onDrag(t,e)},_onMouseWheel:function(t,e){this.__onMouseWheel&&this.__onMouseWheel(t,e)},_onOrientationChange:function(t,e){this.__onOrientationChange&&this.__onOrientationChange(t,e)},_onShake:function(t,e){this.__onShake&&this.__onShake(t,e)},_onMouseDown:function(t){this.__onMouseDown(t),e(fabric.document,"touchend",this._onMouseUp),e(fabric.document,"touchmove",this._onMouseMove),i(this.upperCanvasEl,"mousemove",this._onMouseMove),i(this.upperCanvasEl,"touchmove",this._onMouseMove),"touchstart"===t.type?i(this.upperCanvasEl,"mousedown",this._onMouseDown):(e(fabric.document,"mouseup",this._onMouseUp),e(fabric.document,"mousemove",this._onMouseMove))},_onMouseUp:function(t){if(this.__onMouseUp(t),i(fabric.document,"mouseup",this._onMouseUp),i(fabric.document,"touchend",this._onMouseUp),i(fabric.document,"mousemove",this._onMouseMove),i(fabric.document,"touchmove",this._onMouseMove),e(this.upperCanvasEl,"mousemove",this._onMouseMove),e(this.upperCanvasEl,"touchmove",this._onMouseMove),"touchend"===t.type){var n=this;setTimeout(function(){e(n.upperCanvasEl,"mousedown",n._onMouseDown)},400)}},_onMouseMove:function(t){!this.allowTouchScrolling&&t.preventDefault&&t.preventDefault(),this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t,e){var i=this.getActiveGroup()||this.getActiveObject();return!!(t&&(t.isMoving||t!==i)||!t&&i||!t&&!i&&!this._groupSelector||e&&this._previousPointer&&this.selection&&(e.x!==this._previousPointer.x||e.y!==this._previousPointer.y))},__onMouseUp:function(t){var e;if(this.isDrawingMode&&this._isCurrentlyDrawing)return void this._onMouseUpInDrawingMode(t);this._currentTransform?(this._finalizeCurrentTransform(),e=this._currentTransform.target):e=this.findTarget(t,!0);var i=this._shouldRender(e,this.getPointer(t));this._maybeGroupObjects(t),e&&(e.isMoving=!1),i&&this.renderAll(),this._handleCursorAndEvent(t,e)},_handleCursorAndEvent:function(t,e){this._setCursorFromEvent(t,e);var i=this;setTimeout(function(){i._setCursorFromEvent(t,e)},50),this.fire("mouse:up",{target:e,e:t}),e&&e.fire("mouseup",{e:t})},_finalizeCurrentTransform:function(){var t=this._currentTransform,e=t.target;e._scaling&&(e._scaling=!1),e.setCoords(),this.stateful&&e.hasStateChanged()&&(this.fire("object:modified",{target:e}),e.fire("modified")),this._restoreOriginXY(e)},_restoreOriginXY:function(t){if(this._previousOriginX&&this._previousOriginY){var e=t.translateToOriginPoint(t.getCenterPoint(),this._previousOriginX,this._previousOriginY);t.originX=this._previousOriginX,t.originY=this._previousOriginY,t.left=e.x,t.top=e.y,this._previousOriginX=null,this._previousOriginY=null}},_onMouseDownInDrawingMode:function(t){this._isCurrentlyDrawing=!0,this.discardActiveObject(t).renderAll(),this.clipTo&&fabric.util.clipContext(this,this.contextTop);var e=fabric.util.invertTransform(this.viewportTransform),i=fabric.util.transformPoint(this.getPointer(t,!0),e);this.freeDrawingBrush.onMouseDown(i),this.fire("mouse:down",{e:t})},_onMouseMoveInDrawingMode:function(t){if(this._isCurrentlyDrawing){var e=fabric.util.invertTransform(this.viewportTransform),i=fabric.util.transformPoint(this.getPointer(t,!0),e);this.freeDrawingBrush.onMouseMove(i)}this.setCursor(this.freeDrawingCursor),this.fire("mouse:move",{e:t})},_onMouseUpInDrawingMode:function(t){this._isCurrentlyDrawing=!1,this.clipTo&&this.contextTop.restore(),this.freeDrawingBrush.onMouseUp(),this.fire("mouse:up",{e:t})},__onMouseDown:function(t){var e="which"in t?1===t.which:1===t.button;if(e||fabric.isTouchSupported){if(this.isDrawingMode)return void this._onMouseDownInDrawingMode(t);if(!this._currentTransform){var i=this.findTarget(t),n=this.getPointer(t,!0);this._previousPointer=n;var r=this._shouldRender(i,n),s=this._shouldGroup(t,i);this._shouldClearSelection(t,i)?this._clearSelection(t,i,n):s&&(this._handleGrouping(t,i),i=this.getActiveGroup()),i&&i.selectable&&!s&&(this._beforeTransform(t,i),this._setupCurrentTransform(t,i)),r&&this.renderAll(),this.fire("mouse:down",{target:i,e:t}),i&&i.fire("mousedown",{e:t})}}},_beforeTransform:function(t,e){var i;this.stateful&&e.saveState(),(i=e._findTargetCorner(this.getPointer(t)))&&this.onBeforeScaleRotate(e),e!==this.getActiveGroup()&&e!==this.getActiveObject()&&(this.deactivateAll(),this.setActiveObject(e,t))},_clearSelection:function(t,e,i){this.deactivateAllWithDispatch(t),e&&e.selectable?this.setActiveObject(e,t):this.selection&&(this._groupSelector={ex:i.x,ey:i.y,top:0,left:0})},_setOriginToCenter:function(t){this._previousOriginX=this._currentTransform.target.originX,this._previousOriginY=this._currentTransform.target.originY;var e=t.getCenterPoint();t.originX="center",t.originY="center",t.left=e.x,t.top=e.y,this._currentTransform.left=t.left,this._currentTransform.top=t.top},_setCenterToOrigin:function(t){var e=t.translateToOriginPoint(t.getCenterPoint(),this._previousOriginX,this._previousOriginY);t.originX=this._previousOriginX,t.originY=this._previousOriginY,t.left=e.x,t.top=e.y,this._previousOriginX=null,this._previousOriginY=null},__onMouseMove:function(t){var e,i;if(this.isDrawingMode)return void this._onMouseMoveInDrawingMode(t);var n=this._groupSelector;n?(i=this.getPointer(t,!0),n.left=i.x-n.ex,n.top=i.y-n.ey,this.renderTop()):this._currentTransform?this._transformObject(t):(e=this.findTarget(t),!e||e&&!e.selectable?this.setCursor(this.defaultCursor):this._setCursorFromEvent(t,e)),this.fire("mouse:move",{target:e,e:t}),e&&e.fire("mousemove",{e:t})},_transformObject:function(t){var e=this.getPointer(t),i=this._currentTransform;i.reset=!1,i.target.isMoving=!0,this._beforeScaleTransform(t,i),this._performTransformAction(t,i,e),this.renderAll()},_performTransformAction:function(t,e,i){var n=i.x,r=i.y,s=e.target,o=e.action;"rotate"===o?(this._rotateObject(n,r),this._fire("rotating",s,t)):"scale"===o?(this._onScale(t,e,n,r),this._fire("scaling",s,t)):"scaleX"===o?(this._scaleObject(n,r,"x"),this._fire("scaling",s,t)):"scaleY"===o?(this._scaleObject(n,r,"y"),this._fire("scaling",s,t)):(this._translateObject(n,r),this._fire("moving",s,t),this.setCursor(this.moveCursor))
|
|
},_fire:function(t,e,i){this.fire("object:"+t,{target:e,e:i}),e.fire(t,{e:i})},_beforeScaleTransform:function(t,e){if("scale"===e.action||"scaleX"===e.action||"scaleY"===e.action){var i=this._shouldCenterTransform(t,e.target);(i&&("center"!==e.originX||"center"!==e.originY)||!i&&"center"===e.originX&&"center"===e.originY)&&(this._resetCurrentTransform(t),e.reset=!0)}},_onScale:function(t,e,i,n){!t.shiftKey&&!this.uniScaleTransform||e.target.get("lockUniScaling")?(!e.reset&&"scale"===e.currentAction&&this._resetCurrentTransform(t,e.target),e.currentAction="scaleEqually",this._scaleObject(i,n,"equally")):(e.currentAction="scale",this._scaleObject(i,n))},_setCursorFromEvent:function(t,e){if(!e||!e.selectable)return this.setCursor(this.defaultCursor),!1;var i=this.getActiveGroup(),n=e._findTargetCorner&&(!i||!i.contains(e))&&e._findTargetCorner(this.getPointer(t,!0));return n?this._setCornerCursor(n,e):this.setCursor(e.hoverCursor||this.hoverCursor),!0},_setCornerCursor:function(e,i){if(e in t)this.setCursor(this._getRotatedCornerCursor(e,i));else{if("mtr"!==e||!i.hasRotatingPoint)return this.setCursor(this.defaultCursor),!1;this.setCursor(this.rotationCursor)}},_getRotatedCornerCursor:function(e,i){var n=Math.round(i.getAngle()%360/45);return 0>n&&(n+=8),n+=t[e],n%=8,this.cursorMap[n]}})}(),function(){var t=Math.min,e=Math.max;fabric.util.object.extend(fabric.Canvas.prototype,{_shouldGroup:function(t,e){var i=this.getActiveObject();return t.shiftKey&&(this.getActiveGroup()||i&&i!==e)&&this.selection},_handleGrouping:function(t,e){(e!==this.getActiveGroup()||(e=this.findTarget(t,!0),e&&!e.isType("group")))&&(this.getActiveGroup()?this._updateActiveGroup(e,t):this._createActiveGroup(e,t),this._activeGroup&&this._activeGroup.saveCoords())},_updateActiveGroup:function(t,e){var i=this.getActiveGroup();if(i.contains(t)){if(i.removeWithUpdate(t),this._resetObjectTransform(i),t.set("active",!1),1===i.size())return this.discardActiveGroup(e),void this.setActiveObject(i.item(0))}else i.addWithUpdate(t),this._resetObjectTransform(i);this.fire("selection:created",{target:i,e:e}),i.set("active",!0)},_createActiveGroup:function(t,e){if(this._activeObject&&t!==this._activeObject){var i=this._createGroup(t);i.addWithUpdate(),this.setActiveGroup(i),this._activeObject=null,this.fire("selection:created",{target:i,e:e})}t.set("active",!0)},_createGroup:function(t){var e=this.getObjects(),i=e.indexOf(this._activeObject)<e.indexOf(t),n=i?[this._activeObject,t]:[t,this._activeObject];return new fabric.Group(n,{originX:"center",originY:"center",canvas:this})},_groupSelectedObjects:function(t){var e=this._collectObjects();1===e.length?this.setActiveObject(e[0],t):e.length>1&&(e=new fabric.Group(e.reverse(),{originX:"center",originY:"center",canvas:this}),e.addWithUpdate(),this.setActiveGroup(e,t),e.saveCoords(),this.fire("selection:created",{target:e}),this.renderAll())},_collectObjects:function(){for(var i,n=[],r=this._groupSelector.ex,s=this._groupSelector.ey,o=r+this._groupSelector.left,a=s+this._groupSelector.top,h=new fabric.Point(t(r,o),t(s,a)),l=new fabric.Point(e(r,o),e(s,a)),c=r===o&&s===a,u=this._objects.length;u--&&(i=this._objects[u],!(i&&i.selectable&&i.visible&&(i.intersectsWithRect(h,l)||i.isContainedWithinRect(h,l)||i.containsPoint(h)||i.containsPoint(l))&&(i.set("active",!0),n.push(i),c))););return n},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t);var e=this.getActiveGroup();e&&(e.setObjectsCoords().setCoords(),e.isMoving=!1,this.setCursor(this.defaultCursor)),this._groupSelector=null,this._currentTransform=null}})}(),fabric.util.object.extend(fabric.StaticCanvas.prototype,{toDataURL:function(t){t||(t={});var e=t.format||"png",i=t.quality||1,n=t.multiplier||1,r={left:t.left,top:t.top,width:t.width,height:t.height};return 1!==n?this.__toDataURLWithMultiplier(e,i,r,n):this.__toDataURL(e,i,r)},__toDataURL:function(t,e,i){this.renderAll(!0);var n=this.upperCanvasEl||this.lowerCanvasEl,r=this.__getCroppedCanvas(n,i);"jpg"===t&&(t="jpeg");var s=fabric.StaticCanvas.supports("toDataURLWithQuality")?(r||n).toDataURL("image/"+t,e):(r||n).toDataURL("image/"+t);return this.contextTop&&this.clearContext(this.contextTop),this.renderAll(),r&&(r=null),s},__getCroppedCanvas:function(t,e){var i,n,r="left"in e||"top"in e||"width"in e||"height"in e;return r&&(i=fabric.util.createCanvasElement(),n=i.getContext("2d"),i.width=e.width||this.width,i.height=e.height||this.height,n.drawImage(t,-e.left||0,-e.top||0)),i},__toDataURLWithMultiplier:function(t,e,i,n){var r=this.getWidth(),s=this.getHeight(),o=r*n,a=s*n,h=this.getActiveObject(),l=this.getActiveGroup(),c=this.contextTop||this.contextContainer;n>1&&this.setWidth(o).setHeight(a),c.scale(n,n),i.left&&(i.left*=n),i.top&&(i.top*=n),i.width?i.width*=n:1>n&&(i.width=o),i.height?i.height*=n:1>n&&(i.height=a),l?this._tempRemoveBordersControlsFromGroup(l):h&&this.deactivateAll&&this.deactivateAll(),this.renderAll(!0);var u=this.__toDataURL(t,e,i);return this.width=r,this.height=s,c.scale(1/n,1/n),this.setWidth(r).setHeight(s),l?this._restoreBordersControlsOnGroup(l):h&&this.setActiveObject&&this.setActiveObject(h),this.contextTop&&this.clearContext(this.contextTop),this.renderAll(),u},toDataURLWithMultiplier:function(t,e,i){return this.toDataURL({format:t,multiplier:e,quality:i})},_tempRemoveBordersControlsFromGroup:function(t){t.origHasControls=t.hasControls,t.origBorderColor=t.borderColor,t.hasControls=!0,t.borderColor="rgba(0,0,0,0)",t.forEachObject(function(t){t.origBorderColor=t.borderColor,t.borderColor="rgba(0,0,0,0)"})},_restoreBordersControlsOnGroup:function(t){t.hideControls=t.origHideControls,t.borderColor=t.origBorderColor,t.forEachObject(function(t){t.borderColor=t.origBorderColor,delete t.origBorderColor})}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{loadFromDatalessJSON:function(t,e,i){return this.loadFromJSON(t,e,i)},loadFromJSON:function(t,e,i){if(t){var n="string"==typeof t?JSON.parse(t):t;this.clear();var r=this;return this._enlivenObjects(n.objects,function(){r._setBgOverlay(n,e)},i),this}},_setBgOverlay:function(t,e){var i=this,n={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(!(t.backgroundImage||t.overlayImage||t.background||t.overlay))return void(e&&e());var r=function(){n.backgroundImage&&n.overlayImage&&n.backgroundColor&&n.overlayColor&&(i.renderAll(),e&&e())};this.__setBgOverlay("backgroundImage",t.backgroundImage,n,r),this.__setBgOverlay("overlayImage",t.overlayImage,n,r),this.__setBgOverlay("backgroundColor",t.background,n,r),this.__setBgOverlay("overlayColor",t.overlay,n,r),r()},__setBgOverlay:function(t,e,i,n){var r=this;return e?void("backgroundImage"===t||"overlayImage"===t?fabric.Image.fromObject(e,function(e){r[t]=e,i[t]=!0,n&&n()}):this["set"+fabric.util.string.capitalize(t,!0)](e,function(){i[t]=!0,n&&n()})):void(i[t]=!0)},_enlivenObjects:function(t,e,i){var n=this;if(!t||0===t.length)return void(e&&e());var r=this.renderOnAddRemove;this.renderOnAddRemove=!1,fabric.util.enlivenObjects(t,function(t){t.forEach(function(t,e){n.insertAt(t,e,!0)}),n.renderOnAddRemove=r,e&&e()},null,i)},_toDataURL:function(t,e){this.clone(function(i){e(i.toDataURL(t))})},_toDataURLWithMultiplier:function(t,e,i){this.clone(function(n){i(n.toDataURLWithMultiplier(t,e))})},clone:function(t,e){var i=JSON.stringify(this.toJSON(e));this.cloneWithoutData(function(e){e.loadFromJSON(i,function(){t&&t(e)})})},cloneWithoutData:function(t){var e=fabric.document.createElement("canvas");e.width=this.getWidth(),e.height=this.getHeight();var i=new fabric.Canvas(e);i.clipTo=this.clipTo,this.backgroundImage?(i.setBackgroundImage(this.backgroundImage.src,function(){i.renderAll(),t&&t(i)}),i.backgroundImageOpacity=this.backgroundImageOpacity,i.backgroundImageStretch=this.backgroundImageStretch):t&&t(i)}}),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.toFixed,r=e.util.string.capitalize,s=e.util.degreesToRadians,o=e.StaticCanvas.supports("setLineDash");e.Object||(e.Object=e.util.createClass({type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,cornerSize:12,transparentCorners:!0,hoverCursor:null,padding:0,borderColor:"rgba(102,153,255,0.75)",cornerColor:"rgba(102,153,255,0.5)",centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"source-over",backgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:10,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,transformMatrix:null,minScaleLimit:.01,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,hasRotatingPoint:!0,rotatingPointOffset:40,perPixelTargetFind:!1,includeDefaultValues:!0,clipTo:null,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockUniScaling:!1,lockScalingFlip:!1,stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeLineJoin strokeMiterLimit angle opacity fill fillRule shadow clipTo visible backgroundColor".split(" "),initialize:function(t){t&&this.setOptions(t)},_initGradient:function(t){t.fill&&t.fill.colorStops&&!(t.fill instanceof e.Gradient)&&this.set("fill",new e.Gradient(t.fill))},_initPattern:function(t){t.fill&&t.fill.source&&!(t.fill instanceof e.Pattern)&&this.set("fill",new e.Pattern(t.fill)),t.stroke&&t.stroke.source&&!(t.stroke instanceof e.Pattern)&&this.set("stroke",new e.Pattern(t.stroke))},_initClipping:function(t){if(t.clipTo&&"string"==typeof t.clipTo){var i=e.util.getFunctionBody(t.clipTo);"undefined"!=typeof i&&(this.clipTo=new Function("ctx",i))}},setOptions:function(t){for(var e in t)this.set(e,t[e]);this._initGradient(t),this._initPattern(t),this._initClipping(t)},transform:function(t,e){this.group&&this.group.transform(t,e),t.globalAlpha=this.opacity;var i=e?this._getLeftTopCoords():this.getCenterPoint();t.translate(i.x,i.y),t.rotate(s(this.angle)),t.scale(this.scaleX*(this.flipX?-1:1),this.scaleY*(this.flipY?-1:1))},toObject:function(t){var i=e.Object.NUM_FRACTION_DIGITS,r={type:this.type,originX:this.originX,originY:this.originY,left:n(this.left,i),top:n(this.top,i),width:n(this.width,i),height:n(this.height,i),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:n(this.strokeWidth,i),strokeDashArray:this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeLineJoin:this.strokeLineJoin,strokeMiterLimit:n(this.strokeMiterLimit,i),scaleX:n(this.scaleX,i),scaleY:n(this.scaleY,i),angle:n(this.getAngle(),i),flipX:this.flipX,flipY:this.flipY,opacity:n(this.opacity,i),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,clipTo:this.clipTo&&String(this.clipTo),backgroundColor:this.backgroundColor};return this.includeDefaultValues||(r=this._removeDefaultValues(r)),e.util.populateWithProperties(this,r,t),r},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(t){var i=e.util.getKlass(t.type).prototype,n=i.stateProperties;return n.forEach(function(e){t[e]===i[e]&&delete t[e]}),t},toString:function(){return"#<fabric."+r(this.type)+">"},get:function(t){return this[t]},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):"function"==typeof e&&"clipTo"!==t?this._set(t,e(this.get(t))):this._set(t,e),this},_set:function(t,i){var r="scaleX"===t||"scaleY"===t;return r&&(i=this._constrainScale(i)),"scaleX"===t&&0>i?(this.flipX=!this.flipX,i*=-1):"scaleY"===t&&0>i?(this.flipY=!this.flipY,i*=-1):"width"===t||"height"===t?this.minScaleLimit=n(Math.min(.1,1/Math.max(this.width,this.height)),2):"shadow"===t&&i&&!(i instanceof e.Shadow)&&(i=new e.Shadow(i)),this[t]=i,this},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},setSourcePath:function(t){return this.sourcePath=t,this},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:[1,0,0,1,0,0]},render:function(t,i){if(0!==this.width&&0!==this.height&&this.visible){if(t.save(),this._setupFillRule(t),this._transform(t,i),this._setStrokeStyles(t),this._setFillStyles(t),this.group&&"path-group"===this.group.type){t.translate(-this.group.width/2,-this.group.height/2);var n=this.transformMatrix;n&&t.transform.apply(t,n)}t.globalAlpha=this.group?t.globalAlpha*this.opacity:this.opacity,this._setShadow(t),this.clipTo&&e.util.clipContext(this,t),this._render(t,i),this.clipTo&&t.restore(),this._removeShadow(t),this._restoreFillRule(t),t.restore()}},_transform:function(t,e){var i=this.transformMatrix;i&&!this.group&&t.setTransform.apply(t,i),e||this.transform(t)},_setStrokeStyles:function(t){this.stroke&&(t.lineWidth=this.strokeWidth,t.lineCap=this.strokeLineCap,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,t.strokeStyle=this.stroke.toLive?this.stroke.toLive(t):this.stroke)},_setFillStyles:function(t){this.fill&&(t.fillStyle=this.fill.toLive?this.fill.toLive(t):this.fill)},_renderControls:function(t,i){var n=this.getViewportTransform();if(t.save(),this.active&&!i){var r;this.group&&(r=e.util.transformPoint(this.group.getCenterPoint(),n),t.translate(r.x,r.y),t.rotate(s(this.group.angle))),r=e.util.transformPoint(this.getCenterPoint(),n,null!=this.group),this.group&&(r.x*=this.group.scaleX,r.y*=this.group.scaleY),t.translate(r.x,r.y),t.rotate(s(this.angle)),this.drawBorders(t),this.drawControls(t)}t.restore()},_setShadow:function(t){this.shadow&&(t.shadowColor=this.shadow.color,t.shadowBlur=this.shadow.blur,t.shadowOffsetX=this.shadow.offsetX,t.shadowOffsetY=this.shadow.offsetY)},_removeShadow:function(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_renderFill:function(t){if(this.fill){if(t.save(),this.fill.toLive&&t.translate(-this.width/2+this.fill.offsetX||0,-this.height/2+this.fill.offsetY||0),this.fill.gradientTransform){var e=this.fill.gradientTransform;t.transform.apply(t,e)}"destination-over"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore(),this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t)}},_renderStroke:function(t){if(this.stroke&&0!==this.strokeWidth){if(t.save(),this.strokeDashArray)1&this.strokeDashArray.length&&this.strokeDashArray.push.apply(this.strokeDashArray,this.strokeDashArray),o?(t.setLineDash(this.strokeDashArray),this._stroke&&this._stroke(t)):this._renderDashedStroke&&this._renderDashedStroke(t),t.stroke();else{if(this.stroke.gradientTransform){var e=this.stroke.gradientTransform;t.transform.apply(t,e)}this._stroke?this._stroke(t):t.stroke()}this._removeShadow(t),t.restore()}},clone:function(t,i){return this.constructor.fromObject?this.constructor.fromObject(this.toObject(i),t):new e.Object(this.toObject(i))},cloneAsImage:function(t){var i=this.toDataURL();return e.util.loadImage(i,function(i){t&&t(new e.Image(i))}),this},toDataURL:function(t){t||(t={});var i=e.util.createCanvasElement(),n=this.getBoundingRect();i.width=n.width,i.height=n.height,e.util.wrapElement(i,"div");var r=new e.Canvas(i);"jpg"===t.format&&(t.format="jpeg"),"jpeg"===t.format&&(r.backgroundColor="#fff");var s={active:this.get("active"),left:this.getLeft(),top:this.getTop()};this.set("active",!1),this.setPositionByOrigin(new e.Point(i.width/2,i.height/2),"center","center");var o=this.canvas;r.add(this);var a=r.toDataURL(t);return this.set(s).setCoords(),this.canvas=o,r.dispose(),r=null,a},isType:function(t){return this.type===t},complexity:function(){return 0},toJSON:function(t){return this.toObject(t)},setGradient:function(t,i){i||(i={});var n={colorStops:[]};n.type=i.type||(i.r1||i.r2?"radial":"linear"),n.coords={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},(i.r1||i.r2)&&(n.coords.r1=i.r1,n.coords.r2=i.r2);for(var r in i.colorStops){var s=new e.Color(i.colorStops[r]);n.colorStops.push({offset:r,color:s.toRgb(),opacity:s.getAlpha()})}return this.set(t,e.Gradient.forObject(this,n))},setPatternFill:function(t){return this.set("fill",new e.Pattern(t))},setShadow:function(t){return this.set("shadow",t?new e.Shadow(t):null)},setColor:function(t){return this.set("fill",t),this},setAngle:function(t){var e=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return e&&this._setOriginToCenter(),this.set("angle",t),e&&this._resetOrigin(),this},centerH:function(){return this.canvas.centerObjectH(this),this},centerV:function(){return this.canvas.centerObjectV(this),this},center:function(){return this.canvas.centerObject(this),this},remove:function(){return this.canvas.remove(this),this},getLocalPointer:function(t,e){e=e||this.canvas.getPointer(t);var i=this.translateToOriginPoint(this.getCenterPoint(),"left","top");return{x:e.x-i.x,y:e.y-i.y}},_setupFillRule:function(t){this.fillRule&&(this._prevFillRule=t.globalCompositeOperation,t.globalCompositeOperation=this.fillRule)},_restoreFillRule:function(t){this.fillRule&&this._prevFillRule&&(t.globalCompositeOperation=this._prevFillRule)}}),e.util.createAccessors(e.Object),e.Object.prototype.rotate=e.Object.prototype.setAngle,i(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object.__uid=0)}("undefined"!=typeof exports?exports:this),function(){var t=fabric.util.degreesToRadians;fabric.util.object.extend(fabric.Object.prototype,{translateToCenterPoint:function(e,i,n){var r=e.x,s=e.y,o=this.stroke?this.strokeWidth:0;return"left"===i?r=e.x+(this.getWidth()+o*this.scaleX)/2:"right"===i&&(r=e.x-(this.getWidth()+o*this.scaleX)/2),"top"===n?s=e.y+(this.getHeight()+o*this.scaleY)/2:"bottom"===n&&(s=e.y-(this.getHeight()+o*this.scaleY)/2),fabric.util.rotatePoint(new fabric.Point(r,s),e,t(this.angle))},translateToOriginPoint:function(e,i,n){var r=e.x,s=e.y,o=this.stroke?this.strokeWidth:0;return"left"===i?r=e.x-(this.getWidth()+o*this.scaleX)/2:"right"===i&&(r=e.x+(this.getWidth()+o*this.scaleX)/2),"top"===n?s=e.y-(this.getHeight()+o*this.scaleY)/2:"bottom"===n&&(s=e.y+(this.getHeight()+o*this.scaleY)/2),fabric.util.rotatePoint(new fabric.Point(r,s),e,t(this.angle))},getCenterPoint:function(){var t=new fabric.Point(this.left,this.top);return this.translateToCenterPoint(t,this.originX,this.originY)},getPointByOrigin:function(t,e){var i=this.getCenterPoint();return this.translateToOriginPoint(i,t,e)},toLocalPoint:function(e,i,n){var r,s,o=this.getCenterPoint(),a=this.stroke?this.strokeWidth:0;return i&&n?(r="left"===i?o.x-(this.getWidth()+a*this.scaleX)/2:"right"===i?o.x+(this.getWidth()+a*this.scaleX)/2:o.x,s="top"===n?o.y-(this.getHeight()+a*this.scaleY)/2:"bottom"===n?o.y+(this.getHeight()+a*this.scaleY)/2:o.y):(r=this.left,s=this.top),fabric.util.rotatePoint(new fabric.Point(e.x,e.y),o,-t(this.angle)).subtractEquals(new fabric.Point(r,s))},setPositionByOrigin:function(t,e,i){var n=this.translateToCenterPoint(t,e,i),r=this.translateToOriginPoint(n,this.originX,this.originY);this.set("left",r.x),this.set("top",r.y)},adjustPosition:function(e){var i=t(this.angle),n=this.getWidth()/2,r=Math.cos(i)*n,s=Math.sin(i)*n,o=this.getWidth(),a=Math.cos(i)*o,h=Math.sin(i)*o;"center"===this.originX&&"left"===e||"right"===this.originX&&"center"===e?(this.left-=r,this.top-=s):"left"===this.originX&&"center"===e||"center"===this.originX&&"right"===e?(this.left+=r,this.top+=s):"left"===this.originX&&"right"===e?(this.left+=a,this.top+=h):"right"===this.originX&&"left"===e&&(this.left-=a,this.top-=h),this.setCoords(),this.originX=e},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var t=this.getCenterPoint();this.originX="center",this.originY="center",this.left=t.x,this.top=t.y},_resetOrigin:function(){var t=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=t.x,this.top=t.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","center")}})}(),function(){var t=fabric.util.degreesToRadians;fabric.util.object.extend(fabric.Object.prototype,{oCoords:null,intersectsWithRect:function(t,e){var i=this.oCoords,n=new fabric.Point(i.tl.x,i.tl.y),r=new fabric.Point(i.tr.x,i.tr.y),s=new fabric.Point(i.bl.x,i.bl.y),o=new fabric.Point(i.br.x,i.br.y),a=fabric.Intersection.intersectPolygonRectangle([n,r,o,s],t,e);return"Intersection"===a.status},intersectsWithObject:function(t){function e(t){return{tl:new fabric.Point(t.tl.x,t.tl.y),tr:new fabric.Point(t.tr.x,t.tr.y),bl:new fabric.Point(t.bl.x,t.bl.y),br:new fabric.Point(t.br.x,t.br.y)}}var i=e(this.oCoords),n=e(t.oCoords),r=fabric.Intersection.intersectPolygonPolygon([i.tl,i.tr,i.br,i.bl],[n.tl,n.tr,n.br,n.bl]);return"Intersection"===r.status},isContainedWithinObject:function(t){var e=t.getBoundingRect(),i=new fabric.Point(e.left,e.top),n=new fabric.Point(e.left+e.width,e.top+e.height);return this.isContainedWithinRect(i,n)},isContainedWithinRect:function(t,e){var i=this.getBoundingRect();return i.left>=t.x&&i.left+i.width<=e.x&&i.top>=t.y&&i.top+i.height<=e.y},containsPoint:function(t){var e=this._getImageLines(this.oCoords),i=this._findCrossPoints(t,e);return 0!==i&&i%2===1},_getImageLines:function(t){return{topline:{o:t.tl,d:t.tr},rightline:{o:t.tr,d:t.br},bottomline:{o:t.br,d:t.bl},leftline:{o:t.bl,d:t.tl}}},_findCrossPoints:function(t,e){var i,n,r,s,o,a,h,l=0;for(var c in e)if(h=e[c],!(h.o.y<t.y&&h.d.y<t.y||h.o.y>=t.y&&h.d.y>=t.y||(h.o.x===h.d.x&&h.o.x>=t.x?(o=h.o.x,a=t.y):(i=0,n=(h.d.y-h.o.y)/(h.d.x-h.o.x),r=t.y-i*t.x,s=h.o.y-n*h.o.x,o=-(r-s)/(i-n),a=r+i*o),o>=t.x&&(l+=1),2!==l)))break;return l},getBoundingRectWidth:function(){return this.getBoundingRect().width},getBoundingRectHeight:function(){return this.getBoundingRect().height},getBoundingRect:function(){this.oCoords||this.setCoords();var t=[this.oCoords.tl.x,this.oCoords.tr.x,this.oCoords.br.x,this.oCoords.bl.x],e=fabric.util.array.min(t),i=fabric.util.array.max(t),n=Math.abs(e-i),r=[this.oCoords.tl.y,this.oCoords.tr.y,this.oCoords.br.y,this.oCoords.bl.y],s=fabric.util.array.min(r),o=fabric.util.array.max(r),a=Math.abs(s-o);return{left:e,top:s,width:n,height:a}},getWidth:function(){return this.width*this.scaleX},getHeight:function(){return this.height*this.scaleY},_constrainScale:function(t){return Math.abs(t)<this.minScaleLimit?0>t?-this.minScaleLimit:this.minScaleLimit:t},scale:function(t){return t=this._constrainScale(t),0>t&&(this.flipX=!this.flipX,this.flipY=!this.flipY,t*=-1),this.scaleX=t,this.scaleY=t,this.setCoords(),this},scaleToWidth:function(t){var e=this.getBoundingRectWidth()/this.getWidth();return this.scale(t/this.width/e)},scaleToHeight:function(t){var e=this.getBoundingRectHeight()/this.getHeight();return this.scale(t/this.height/e)},setCoords:function(){var e=this.strokeWidth>1?this.strokeWidth:0,i=t(this.angle),n=this.getViewportTransform(),r=function(t){return fabric.util.transformPoint(t,n)},s=this.width,o=this.height,a="round"===this.strokeLineCap||"square"===this.strokeLineCap,h="line"===this.type&&1===this.width,l="line"===this.type&&1===this.height,c=a&&l||"line"!==this.type,u=a&&h||"line"!==this.type;h?s=e:l&&(o=e),c&&(s+=e),u&&(o+=e),this.currentWidth=s*this.scaleX,this.currentHeight=o*this.scaleY,this.currentWidth<0&&(this.currentWidth=Math.abs(this.currentWidth));var f=Math.sqrt(Math.pow(this.currentWidth/2,2)+Math.pow(this.currentHeight/2,2)),d=Math.atan(isFinite(this.currentHeight/this.currentWidth)?this.currentHeight/this.currentWidth:0),p=Math.cos(d+i)*f,g=Math.sin(d+i)*f,v=Math.sin(i),m=Math.cos(i),y=this.getCenterPoint(),b=new fabric.Point(this.currentWidth,this.currentHeight),x=new fabric.Point(y.x-p,y.y-g),_=new fabric.Point(x.x+b.x*m,x.y+b.x*v),w=new fabric.Point(x.x-b.y*v,x.y+b.y*m),C=new fabric.Point(x.x+b.x/2*m,x.y+b.x/2*v),S=r(x),T=r(_),k=r(new fabric.Point(_.x-b.y*v,_.y+b.y*m)),O=r(w),E=r(new fabric.Point(x.x-b.y/2*v,x.y+b.y/2*m)),A=r(C),P=r(new fabric.Point(_.x-b.y/2*v,_.y+b.y/2*m)),j=r(new fabric.Point(w.x+b.x/2*m,w.y+b.x/2*v)),D=r(new fabric.Point(C.x,C.y)),L=Math.cos(d+i)*this.padding*Math.sqrt(2),I=Math.sin(d+i)*this.padding*Math.sqrt(2);return S=S.add(new fabric.Point(-L,-I)),T=T.add(new fabric.Point(I,-L)),k=k.add(new fabric.Point(L,I)),O=O.add(new fabric.Point(-I,L)),E=E.add(new fabric.Point((-L-I)/2,(-I+L)/2)),A=A.add(new fabric.Point((I-L)/2,-(I+L)/2)),P=P.add(new fabric.Point((I+L)/2,(I-L)/2)),j=j.add(new fabric.Point((L-I)/2,(L+I)/2)),D=D.add(new fabric.Point((I-L)/2,-(I+L)/2)),this.oCoords={tl:S,tr:T,br:k,bl:O,ml:E,mt:A,mr:P,mb:j,mtr:D},this._setCornerCoords&&this._setCornerCoords(),this}})}(),fabric.util.object.extend(fabric.Object.prototype,{sendToBack:function(){return this.group?fabric.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?fabric.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?fabric.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?fabric.StaticCanvas.prototype.bringForward.call(this.group,this,t):this.canvas.bringForward(this,t),this},moveTo:function(t){return this.group?fabric.StaticCanvas.prototype.moveTo.call(this.group,this,t):this.canvas.moveTo(this,t),this}}),fabric.util.object.extend(fabric.Object.prototype,{getSvgStyles:function(){var t=this.fill?this.fill.toLive?"url(#SVGID_"+this.fill.id+")":this.fill:"none",e="destination-over"===this.fillRule?"evenodd":this.fillRule,i=this.stroke?this.stroke.toLive?"url(#SVGID_"+this.stroke.id+")":this.stroke:"none",n=this.strokeWidth?this.strokeWidth:"0",r=this.strokeDashArray?this.strokeDashArray.join(" "):"",s=this.strokeLineCap?this.strokeLineCap:"butt",o=this.strokeLineJoin?this.strokeLineJoin:"miter",a=this.strokeMiterLimit?this.strokeMiterLimit:"4",h="undefined"!=typeof this.opacity?this.opacity:"1",l=this.visible?"":" visibility: hidden;",c=this.shadow&&"text"!==this.type?"filter: url(#SVGID_"+this.shadow.id+");":"";return["stroke: ",i,"; ","stroke-width: ",n,"; ","stroke-dasharray: ",r,"; ","stroke-linecap: ",s,"; ","stroke-linejoin: ",o,"; ","stroke-miterlimit: ",a,"; ","fill: ",t,"; ","fill-rule: ",e,"; ","opacity: ",h,";",c,l].join("")},getSvgTransform:function(){if(this.group)return"";var t=fabric.util.toFixed,e=this.getAngle(),i=this.getViewportTransform(),n=fabric.util.transformPoint(this.getCenterPoint(),i),r=fabric.Object.NUM_FRACTION_DIGITS,s="path-group"===this.type?"":"translate("+t(n.x,r)+" "+t(n.y,r)+")",o=0!==e?" rotate("+t(e,r)+")":"",a=1===this.scaleX&&1===this.scaleY&&1===i[0]&&1===i[3]?"":" scale("+t(this.scaleX*i[0],r)+" "+t(this.scaleY*i[3],r)+")",h="path-group"===this.type?this.width*i[0]:0,l=this.flipX?" matrix(-1 0 0 1 "+h+" 0) ":"",c="path-group"===this.type?this.height*i[3]:0,u=this.flipY?" matrix(1 0 0 -1 0 "+c+")":"";return[s,o,a,l,u].join("")},getSvgTransformMatrix:function(){return this.transformMatrix?" matrix("+this.transformMatrix.join(" ")+")":""},_createBaseSVGMarkup:function(){var t=[];return this.fill&&this.fill.toLive&&t.push(this.fill.toSVG(this,!1)),this.stroke&&this.stroke.toLive&&t.push(this.stroke.toSVG(this,!1)),this.shadow&&t.push(this.shadow.toSVG(this)),t}}),fabric.util.object.extend(fabric.Object.prototype,{hasStateChanged:function(){return this.stateProperties.some(function(t){return this.get(t)!==this.originalState[t]},this)},saveState:function(t){return this.stateProperties.forEach(function(t){this.originalState[t]=this.get(t)},this),t&&t.stateProperties&&t.stateProperties.forEach(function(t){this.originalState[t]=this.get(t)},this),this},setupState:function(){return this.originalState={},this.saveState(),this}}),function(){var t=fabric.util.degreesToRadians,e=function(){return"undefined"!=typeof G_vmlCanvasManager};fabric.util.object.extend(fabric.Object.prototype,{_controlsVisibility:null,_findTargetCorner:function(t){if(!this.hasControls||!this.active)return!1;var e,i,n=t.x,r=t.y;for(var s in this.oCoords)if(this.isControlVisible(s)&&("mtr"!==s||this.hasRotatingPoint)&&(!this.get("lockUniScaling")||"mt"!==s&&"mr"!==s&&"mb"!==s&&"ml"!==s)&&(i=this._getImageLines(this.oCoords[s].corner),e=this._findCrossPoints({x:n,y:r},i),0!==e&&e%2===1))return this.__corner=s,s;return!1},_setCornerCoords:function(){var e=this.oCoords,i=t(this.angle),n=t(45-this.angle),r=Math.sqrt(2*Math.pow(this.cornerSize,2))/2,s=r*Math.cos(n),o=r*Math.sin(n),a=Math.sin(i),h=Math.cos(i);e.tl.corner={tl:{x:e.tl.x-o,y:e.tl.y-s},tr:{x:e.tl.x+s,y:e.tl.y-o},bl:{x:e.tl.x-s,y:e.tl.y+o},br:{x:e.tl.x+o,y:e.tl.y+s}},e.tr.corner={tl:{x:e.tr.x-o,y:e.tr.y-s},tr:{x:e.tr.x+s,y:e.tr.y-o},br:{x:e.tr.x+o,y:e.tr.y+s},bl:{x:e.tr.x-s,y:e.tr.y+o}},e.bl.corner={tl:{x:e.bl.x-o,y:e.bl.y-s},bl:{x:e.bl.x-s,y:e.bl.y+o},br:{x:e.bl.x+o,y:e.bl.y+s},tr:{x:e.bl.x+s,y:e.bl.y-o}},e.br.corner={tr:{x:e.br.x+s,y:e.br.y-o},bl:{x:e.br.x-s,y:e.br.y+o},br:{x:e.br.x+o,y:e.br.y+s},tl:{x:e.br.x-o,y:e.br.y-s}},e.ml.corner={tl:{x:e.ml.x-o,y:e.ml.y-s},tr:{x:e.ml.x+s,y:e.ml.y-o},bl:{x:e.ml.x-s,y:e.ml.y+o},br:{x:e.ml.x+o,y:e.ml.y+s}},e.mt.corner={tl:{x:e.mt.x-o,y:e.mt.y-s},tr:{x:e.mt.x+s,y:e.mt.y-o},bl:{x:e.mt.x-s,y:e.mt.y+o},br:{x:e.mt.x+o,y:e.mt.y+s}},e.mr.corner={tl:{x:e.mr.x-o,y:e.mr.y-s},tr:{x:e.mr.x+s,y:e.mr.y-o},bl:{x:e.mr.x-s,y:e.mr.y+o},br:{x:e.mr.x+o,y:e.mr.y+s}},e.mb.corner={tl:{x:e.mb.x-o,y:e.mb.y-s},tr:{x:e.mb.x+s,y:e.mb.y-o},bl:{x:e.mb.x-s,y:e.mb.y+o},br:{x:e.mb.x+o,y:e.mb.y+s}},e.mtr.corner={tl:{x:e.mtr.x-o+a*this.rotatingPointOffset,y:e.mtr.y-s-h*this.rotatingPointOffset},tr:{x:e.mtr.x+s+a*this.rotatingPointOffset,y:e.mtr.y-o-h*this.rotatingPointOffset},bl:{x:e.mtr.x-s+a*this.rotatingPointOffset,y:e.mtr.y+o-h*this.rotatingPointOffset},br:{x:e.mtr.x+o+a*this.rotatingPointOffset,y:e.mtr.y+s-h*this.rotatingPointOffset}}},drawBorders:function(t){if(!this.hasBorders)return this;var e=this.padding,i=2*e,n=this.getViewportTransform();t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,t.strokeStyle=this.borderColor;var r=1/this._constrainScale(this.scaleX),s=1/this._constrainScale(this.scaleY);t.lineWidth=1/this.borderScaleFactor;var o=this.getWidth(),a=this.getHeight(),h=this.strokeWidth>1?this.strokeWidth:0,l="round"===this.strokeLineCap||"square"===this.strokeLineCap,c="line"===this.type&&1===this.width,u="line"===this.type&&1===this.height,f=l&&u||"line"!==this.type,d=l&&c||"line"!==this.type;c?o=h/r:u&&(a=h/s),f&&(o+=h/r),d&&(a+=h/s);var p=fabric.util.transformPoint(new fabric.Point(o,a),n,!0),g=p.x,v=p.y;if(this.group&&(g*=this.group.scaleX,v*=this.group.scaleY),t.strokeRect(~~(-(g/2)-e)-.5,~~(-(v/2)-e)-.5,~~(g+i)+1,~~(v+i)+1),this.hasRotatingPoint&&this.isControlVisible("mtr")&&!this.get("lockRotation")&&this.hasControls){var m=(-v-2*e)/2;t.beginPath(),t.moveTo(0,m),t.lineTo(0,m-this.rotatingPointOffset),t.closePath(),t.stroke()}return t.restore(),this},drawControls:function(t){if(!this.hasControls)return this;var e=this.cornerSize,i=e/2,n=this.getViewportTransform(),r=this.strokeWidth>1?this.strokeWidth:0,s=this.width,o=this.height,a="round"===this.strokeLineCap||"square"===this.strokeLineCap,h="line"===this.type&&1===this.width,l="line"===this.type&&1===this.height,c=a&&l||"line"!==this.type,u=a&&h||"line"!==this.type;h?s=r:l&&(o=r),c&&(s+=r),u&&(o+=r),s*=this.scaleX,o*=this.scaleY;var f=fabric.util.transformPoint(new fabric.Point(s,o),n,!0),d=f.x,p=f.y,g=-(d/2),v=-(p/2),m=this.padding,y=i,b=i-e,x=this.transparentCorners?"strokeRect":"fillRect";return t.save(),t.lineWidth=1,t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,t.strokeStyle=t.fillStyle=this.cornerColor,this._drawControl("tl",t,x,g-y-m,v-y-m),this._drawControl("tr",t,x,g+d-y+m,v-y-m),this._drawControl("bl",t,x,g-y-m,v+p+b+m),this._drawControl("br",t,x,g+d+b+m,v+p+b+m),this.get("lockUniScaling")||(this._drawControl("mt",t,x,g+d/2-y,v-y-m),this._drawControl("mb",t,x,g+d/2-y,v+p+b+m),this._drawControl("mr",t,x,g+d+b+m,v+p/2-y),this._drawControl("ml",t,x,g-y-m,v+p/2-y)),this.hasRotatingPoint&&this._drawControl("mtr",t,x,g+d/2-y,v-this.rotatingPointOffset-this.cornerSize/2-m),t.restore(),this
|
|
},_drawControl:function(t,i,n,r,s){var o=this.cornerSize;this.isControlVisible(t)&&(e()||this.transparentCorners||i.clearRect(r,s,o,o),i[n](r,s,o,o))},isControlVisible:function(t){return this._getControlsVisibility()[t]},setControlVisible:function(t,e){return this._getControlsVisibility()[t]=e,this},setControlsVisibility:function(t){t||(t={});for(var e in t)this.setControlVisible(e,t[e]);return this},_getControlsVisibility:function(){return this._controlsVisibility||(this._controlsVisibility={tl:!0,tr:!0,br:!0,bl:!0,ml:!0,mt:!0,mr:!0,mb:!0,mtr:!0}),this._controlsVisibility}})}(),fabric.util.object.extend(fabric.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){e=e||{};var i=function(){},n=e.onComplete||i,r=e.onChange||i,s=this;return fabric.util.animate({startValue:t.get("left"),endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(e){t.set("left",e),s.renderAll(),r()},onComplete:function(){t.setCoords(),n()}}),this},fxCenterObjectV:function(t,e){e=e||{};var i=function(){},n=e.onComplete||i,r=e.onChange||i,s=this;return fabric.util.animate({startValue:t.get("top"),endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(e){t.set("top",e),s.renderAll(),r()},onComplete:function(){t.setCoords(),n()}}),this},fxRemove:function(t,e){e=e||{};var i=function(){},n=e.onComplete||i,r=e.onChange||i,s=this;return fabric.util.animate({startValue:t.get("opacity"),endValue:0,duration:this.FX_DURATION,onStart:function(){t.set("active",!1)},onChange:function(e){t.set("opacity",e),s.renderAll(),r()},onComplete:function(){s.remove(t),n()}}),this}}),fabric.util.object.extend(fabric.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var t,e,i=[];for(t in arguments[0])i.push(t);for(var n=0,r=i.length;r>n;n++)t=i[n],e=n!==r-1,this._animate(t,arguments[0][t],arguments[1],e)}else this._animate.apply(this,arguments);return this},_animate:function(t,e,i,n){var r,s=this;e=e.toString(),i=i?fabric.util.object.clone(i):{},~t.indexOf(".")&&(r=t.split("."));var o=r?this.get(r[0])[r[1]]:this.get(t);"from"in i||(i.from=o),e=~e.indexOf("=")?o+parseFloat(e.replace("=","")):parseFloat(e),fabric.util.animate({startValue:i.from,endValue:e,byValue:i.by,easing:i.easing,duration:i.duration,abort:i.abort&&function(){return i.abort.call(s)},onChange:function(e){r?s[r[0]][r[1]]=e:s.set(t,e),n||i.onChange&&i.onChange()},onComplete:function(){n||(s.setCoords(),i.onComplete&&i.onComplete())}})}}),function(t){"use strict";function e(t,e){var i=t.origin,n=t.axis1,r=t.axis2,s=t.dimension,o=e.nearest,a=e.center,h=e.farthest;return function(){switch(this.get(i)){case o:return Math.min(this.get(n),this.get(r));case a:return Math.min(this.get(n),this.get(r))+.5*this.get(s);case h:return Math.max(this.get(n),this.get(r))}}}var i=t.fabric||(t.fabric={}),n=i.util.object.extend,r={x1:1,x2:1,y1:1,y2:1},s=i.StaticCanvas.supports("setLineDash");return i.Line?void i.warn("fabric.Line is already defined"):(i.Line=i.util.createClass(i.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,initialize:function(t,e){e=e||{},t||(t=[0,0,0,0]),this.callSuper("initialize",e),this.set("x1",t[0]),this.set("y1",t[1]),this.set("x2",t[2]),this.set("y2",t[3]),this._setWidthHeight(e)},_setWidthHeight:function(t){t||(t={}),this.width=Math.abs(this.x2-this.x1)||1,this.height=Math.abs(this.y2-this.y1)||1,this.left="left"in t?t.left:this._getLeftToOriginX(),this.top="top"in t?t.top:this._getTopToOriginY()},_set:function(t,e){return this[t]=e,"undefined"!=typeof r[t]&&this._setWidthHeight(),this},_getLeftToOriginX:e({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:e({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(t,e){if(t.beginPath(),e){var i=this.getCenterPoint();t.translate(i.x,i.y)}if(!this.strokeDashArray||this.strokeDashArray&&s){var n=this.x1<=this.x2?-1:1,r=this.y1<=this.y2?-1:1;t.moveTo(1===this.width?0:n*this.width/2,1===this.height?0:r*this.height/2),t.lineTo(1===this.width?0:-1*n*this.width/2,1===this.height?0:-1*r*this.height/2)}t.lineWidth=this.strokeWidth;var o=t.strokeStyle;t.strokeStyle=this.stroke||t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=o},_renderDashedStroke:function(t){var e=this.x1<=this.x2?-1:1,n=this.y1<=this.y2?-1:1,r=1===this.width?0:e*this.width/2,s=1===this.height?0:n*this.height/2;t.beginPath(),i.util.drawDashedLine(t,r,s,-r,-s,this.strokeDashArray),t.closePath()},toObject:function(t){return n(this.callSuper("toObject",t),{x1:this.get("x1"),y1:this.get("y1"),x2:this.get("x2"),y2:this.get("y2")})},toSVG:function(t){var e=this._createBaseSVGMarkup(),i="";if(!this.group){var n=-this.width/2-(this.x1>this.x2?this.x2:this.x1),r=-this.height/2-(this.y1>this.y2?this.y2:this.y1);i="translate("+n+", "+r+") "}return e.push("<line ",'x1="',this.x1,'" y1="',this.y1,'" x2="',this.x2,'" y2="',this.y2,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),i,this.getSvgTransformMatrix(),'"/>\n'),t?t(e.join("")):e.join("")},complexity:function(){return 1}}),i.Line.ATTRIBUTE_NAMES=i.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),i.Line.fromElement=function(t,e){var r=i.parseAttributes(t,i.Line.ATTRIBUTE_NAMES),s=[r.x1||0,r.y1||0,r.x2||0,r.y2||0];return new i.Line(s,n(r,e))},i.Line.fromObject=function(t){var e=[t.x1,t.y1,t.x2,t.y2];return new i.Line(e,t)},void 0)}("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){return"radius"in t&&t.radius>0}var i=t.fabric||(t.fabric={}),n=2*Math.PI,r=i.util.object.extend;return i.Circle?void i.warn("fabric.Circle is already defined."):(i.Circle=i.util.createClass(i.Object,{type:"circle",radius:0,initialize:function(t){t=t||{},this.callSuper("initialize",t),this.set("radius",t.radius||0)},_set:function(t,e){return this.callSuper("_set",t,e),"radius"===t&&this.setRadius(e),this},toObject:function(t){return r(this.callSuper("toObject",t),{radius:this.get("radius")})},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=0,n=0;return this.group&&(i=this.left+this.radius,n=this.top+this.radius),e.push("<circle ",'cx="'+i+'" cy="'+n+'" ','r="',this.radius,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform()," ",this.getSvgTransformMatrix(),'"/>\n'),t?t(e.join("")):e.join("")},_render:function(t,e){t.beginPath(),t.arc(e?this.left+this.radius:0,e?this.top+this.radius:0,this.radius,0,n,!1),this._renderFill(t),this._renderStroke(t)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(t){this.radius=t,this.set("width",2*t).set("height",2*t)},complexity:function(){return 1}}),i.Circle.ATTRIBUTE_NAMES=i.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),i.Circle.fromElement=function(t,n){n||(n={});var s=i.parseAttributes(t,i.Circle.ATTRIBUTE_NAMES);if(!e(s))throw new Error("value of `r` attribute is required and can not be negative");s.left=s.left||0,s.top=s.top||0;var o=new i.Circle(r(s,n));return o.left-=o.radius,o.top-=o.radius,o},i.Circle.fromObject=function(t){return new i.Circle(t)},void 0)}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={});return e.Triangle?void e.warn("fabric.Triangle is already defined"):(e.Triangle=e.util.createClass(e.Object,{type:"triangle",initialize:function(t){t=t||{},this.callSuper("initialize",t),this.set("width",t.width||100).set("height",t.height||100)},_render:function(t){var e=this.width/2,i=this.height/2;t.beginPath(),t.moveTo(-e,i),t.lineTo(0,-i),t.lineTo(e,i),t.closePath(),this._renderFill(t),this._renderStroke(t)},_renderDashedStroke:function(t){var i=this.width/2,n=this.height/2;t.beginPath(),e.util.drawDashedLine(t,-i,n,0,-n,this.strokeDashArray),e.util.drawDashedLine(t,0,-n,i,n,this.strokeDashArray),e.util.drawDashedLine(t,i,n,-i,n,this.strokeDashArray),t.closePath()},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=this.width/2,n=this.height/2,r=[-i+" "+n,"0 "+-n,i+" "+n].join(",");return e.push("<polygon ",'points="',r,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),'"/>'),t?t(e.join("")):e.join("")},complexity:function(){return 1}}),void(e.Triangle.fromObject=function(t){return new e.Triangle(t)}))}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=2*Math.PI,n=e.util.object.extend;return e.Ellipse?void e.warn("fabric.Ellipse is already defined."):(e.Ellipse=e.util.createClass(e.Object,{type:"ellipse",rx:0,ry:0,initialize:function(t){t=t||{},this.callSuper("initialize",t),this.set("rx",t.rx||0),this.set("ry",t.ry||0),this.set("width",2*this.get("rx")),this.set("height",2*this.get("ry"))},toObject:function(t){return n(this.callSuper("toObject",t),{rx:this.get("rx"),ry:this.get("ry")})},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=0,n=0;return this.group&&(i=this.left+this.rx,n=this.top+this.ry),e.push("<ellipse ",'cx="',i,'" cy="',n,'" ','rx="',this.rx,'" ry="',this.ry,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"/>\n'),t?t(e.join("")):e.join("")},_render:function(t,e){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(e?this.left+this.rx:0,e?(this.top+this.ry)*this.rx/this.ry:0,this.rx,0,i,!1),t.restore(),this._renderFill(t),this._renderStroke(t)},complexity:function(){return 1}}),e.Ellipse.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),e.Ellipse.fromElement=function(t,i){i||(i={});var r=e.parseAttributes(t,e.Ellipse.ATTRIBUTE_NAMES);r.left=r.left||0,r.top=r.top||0;var s=new e.Ellipse(n(r,i));return s.top-=s.ry,s.left-=s.rx,s},e.Ellipse.fromObject=function(t){return new e.Ellipse(t)},void 0)}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;if(e.Rect)return void console.warn("fabric.Rect is already defined");var n=e.Object.prototype.stateProperties.concat();n.push("rx","ry","x","y"),e.Rect=e.util.createClass(e.Object,{stateProperties:n,type:"rect",rx:0,ry:0,strokeDashArray:null,initialize:function(t){t=t||{},this.callSuper("initialize",t),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(t,e){if(1===this.width&&1===this.height)return void t.fillRect(0,0,1,1);var i=this.rx?Math.min(this.rx,this.width/2):0,n=this.ry?Math.min(this.ry,this.height/2):0,r=this.width,s=this.height,o=e?this.left:0,a=e?this.top:0,h=0!==i||0!==n,l=.4477152502;t.beginPath(),e||t.translate(-this.width/2,-this.height/2),t.moveTo(o+i,a),t.lineTo(o+r-i,a),h&&t.bezierCurveTo(o+r-l*i,a,o+r,a+l*n,o+r,a+n),t.lineTo(o+r,a+s-n),h&&t.bezierCurveTo(o+r,a+s-l*n,o+r-l*i,a+s,o+r-i,a+s),t.lineTo(o+i,a+s),h&&t.bezierCurveTo(o+l*i,a+s,o,a+s-l*n,o,a+s-n),t.lineTo(o,a+n),h&&t.bezierCurveTo(o,a+l*n,o+l*i,a,o+i,a),t.closePath(),this._renderFill(t),this._renderStroke(t)},_renderDashedStroke:function(t){var i=-this.width/2,n=-this.height/2,r=this.width,s=this.height;t.beginPath(),e.util.drawDashedLine(t,i,n,i+r,n,this.strokeDashArray),e.util.drawDashedLine(t,i+r,n,i+r,n+s,this.strokeDashArray),e.util.drawDashedLine(t,i+r,n+s,i,n+s,this.strokeDashArray),e.util.drawDashedLine(t,i,n+s,i,n,this.strokeDashArray),t.closePath()},toObject:function(t){var e=i(this.callSuper("toObject",t),{rx:this.get("rx")||0,ry:this.get("ry")||0});return this.includeDefaultValues||this._removeDefaultValues(e),e},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=this.left,n=this.top;return this.group||(i=-this.width/2,n=-this.height/2),e.push("<rect ",'x="',i,'" y="',n,'" rx="',this.get("rx"),'" ry="',this.get("ry"),'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"/>\n'),t?t(e.join("")):e.join("")},complexity:function(){return 1}}),e.Rect.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),e.Rect.fromElement=function(t,n){if(!t)return null;n=n||{};var r=e.parseAttributes(t,e.Rect.ATTRIBUTE_NAMES);return r.left=r.left||0,r.top=r.top||0,new e.Rect(i(n?e.util.object.clone(n):{},r))},e.Rect.fromObject=function(t){return new e.Rect(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.toFixed;return e.Polyline?void e.warn("fabric.Polyline is already defined"):(e.Polyline=e.util.createClass(e.Object,{type:"polyline",points:null,initialize:function(t,e,i){e=e||{},this.set("points",t),this.callSuper("initialize",e),this._calcDimensions(i)},_calcDimensions:function(t){return e.Polygon.prototype._calcDimensions.call(this,t)},toObject:function(t){return e.Polygon.prototype.toObject.call(this,t)},toSVG:function(t){for(var e=[],n=this._createBaseSVGMarkup(),r=0,s=this.points.length;s>r;r++)e.push(i(this.points[r].x,2),",",i(this.points[r].y,2)," ");return n.push("<polyline ",'points="',e.join(""),'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform()," ",this.getSvgTransformMatrix(),'"/>\n'),t?t(n.join("")):n.join("")},_render:function(t){var e;t.beginPath(),t.moveTo(this.points[0].x,this.points[0].y);for(var i=0,n=this.points.length;n>i;i++)e=this.points[i],t.lineTo(e.x,e.y);this._renderFill(t),this._renderStroke(t)},_renderDashedStroke:function(t){var i,n;t.beginPath();for(var r=0,s=this.points.length;s>r;r++)i=this.points[r],n=this.points[r+1]||i,e.util.drawDashedLine(t,i.x,i.y,n.x,n.y,this.strokeDashArray)},complexity:function(){return this.get("points").length}}),e.Polyline.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polyline.fromElement=function(t,i){if(!t)return null;i||(i={});var n=e.parsePointsAttribute(t.getAttribute("points")),r=e.parseAttributes(t,e.Polyline.ATTRIBUTE_NAMES);return null===n?null:new e.Polyline(n,e.util.object.extend(r,i),!0)},e.Polyline.fromObject=function(t){var i=t.points;return new e.Polyline(i,t,!0)},void 0)}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.array.min,r=e.util.array.max,s=e.util.toFixed;return e.Polygon?void e.warn("fabric.Polygon is already defined"):(e.Polygon=e.util.createClass(e.Object,{type:"polygon",points:null,initialize:function(t,e,i){e=e||{},this.points=t,this.callSuper("initialize",e),this._calcDimensions(i)},_calcDimensions:function(t){var e=this.points,i=n(e,"x"),s=n(e,"y"),o=r(e,"x"),a=r(e,"y");if(this.width=o-i||1,this.height=a-s||1,this.minX=i,this.minY=s,!t){var h=this.width/2+this.minX,l=this.height/2+this.minY;this.points.forEach(function(t){t.x-=h,t.y-=l},this)}},toObject:function(t){return i(this.callSuper("toObject",t),{points:this.points.concat()})},toSVG:function(t){for(var e=[],i=this._createBaseSVGMarkup(),n=0,r=this.points.length;r>n;n++)e.push(s(this.points[n].x,2),",",s(this.points[n].y,2)," ");return i.push("<polygon ",'points="',e.join(""),'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform()," ",this.getSvgTransformMatrix(),'"/>\n'),t?t(i.join("")):i.join("")},_render:function(t){var e;t.beginPath(),t.moveTo(this.points[0].x,this.points[0].y);for(var i=0,n=this.points.length;n>i;i++)e=this.points[i],t.lineTo(e.x,e.y);this._renderFill(t),(this.stroke||this.strokeDashArray)&&(t.closePath(),this._renderStroke(t))},_renderDashedStroke:function(t){var i,n;t.beginPath();for(var r=0,s=this.points.length;s>r;r++)i=this.points[r],n=this.points[r+1]||this.points[0],e.util.drawDashedLine(t,i.x,i.y,n.x,n.y,this.strokeDashArray);t.closePath()},complexity:function(){return this.points.length}}),e.Polygon.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polygon.fromElement=function(t,n){if(!t)return null;n||(n={});var r=e.parsePointsAttribute(t.getAttribute("points")),s=e.parseAttributes(t,e.Polygon.ATTRIBUTE_NAMES);return null===r?null:new e.Polygon(r,i(s,n),!0)},e.Polygon.fromObject=function(t){return new e.Polygon(t.points,t,!0)},void 0)}("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){return"H"===t[0]?t[1]:t[t.length-2]}function i(t){return"V"===t[0]?t[1]:t[t.length-1]}var n=t.fabric||(t.fabric={}),r=n.util.array.min,s=n.util.array.max,o=n.util.object.extend,a=Object.prototype.toString,h=n.util.drawArc,l={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},c={m:"l",M:"L"};return n.Path?void n.warn("fabric.Path is already defined"):(n.Path=n.util.createClass(n.Object,{type:"path",path:null,initialize:function(t,e){if(e=e||{},this.setOptions(e),!t)throw new Error("`path` argument is required");var i="[object Array]"===a.call(t);this.path=i?t:t.match&&t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi),this.path&&(i||(this.path=this._parsePath()),this._initializePath(e),e.sourcePath&&this.setSourcePath(e.sourcePath))},_initializePath:function(t){var e="width"in t&&null!=t.width,i="height"in t&&null!=t.width,n="left"in t,r="top"in t,s=n?this.left:0,a=r?this.top:0;e&&i?(r||(this.top=this.height/2),n||(this.left=this.width/2)):(o(this,this._parseDimensions()),e&&(this.width=t.width),i&&(this.height=t.height)),this.pathOffset=this.pathOffset||this._calculatePathOffset(s,a)},_calculatePathOffset:function(t,e){return{x:this.left-t-this.width/2,y:this.top-e-this.height/2}},_render:function(t,e){var i,n,r,s,o,a=null,l=0,c=0,u=0,f=0,d=0,p=0,g=-(this.width/2+this.pathOffset.x),v=-(this.height/2+this.pathOffset.y);e&&(g+=this.width/2,v+=this.height/2);for(var m=0,y=this.path.length;y>m;++m){switch(i=this.path[m],i[0]){case"l":u+=i[1],f+=i[2],t.lineTo(u+g,f+v);break;case"L":u=i[1],f=i[2],t.lineTo(u+g,f+v);break;case"h":u+=i[1],t.lineTo(u+g,f+v);break;case"H":u=i[1],t.lineTo(u+g,f+v);break;case"v":f+=i[1],t.lineTo(u+g,f+v);break;case"V":f=i[1],t.lineTo(u+g,f+v);break;case"m":u+=i[1],f+=i[2],l=u,c=f,t.moveTo(u+g,f+v);break;case"M":u=i[1],f=i[2],l=u,c=f,t.moveTo(u+g,f+v);break;case"c":n=u+i[5],r=f+i[6],d=u+i[3],p=f+i[4],t.bezierCurveTo(u+i[1]+g,f+i[2]+v,d+g,p+v,n+g,r+v),u=n,f=r;break;case"C":u=i[5],f=i[6],d=i[3],p=i[4],t.bezierCurveTo(i[1]+g,i[2]+v,d+g,p+v,u+g,f+v);break;case"s":n=u+i[3],r=f+i[4],d=d?2*u-d:u,p=p?2*f-p:f,t.bezierCurveTo(d+g,p+v,u+i[1]+g,f+i[2]+v,n+g,r+v),d=u+i[1],p=f+i[2],u=n,f=r;break;case"S":n=i[3],r=i[4],d=2*u-d,p=2*f-p,t.bezierCurveTo(d+g,p+v,i[1]+g,i[2]+v,n+g,r+v),u=n,f=r,d=i[1],p=i[2];break;case"q":n=u+i[3],r=f+i[4],d=u+i[1],p=f+i[2],t.quadraticCurveTo(d+g,p+v,n+g,r+v),u=n,f=r;break;case"Q":n=i[3],r=i[4],t.quadraticCurveTo(i[1]+g,i[2]+v,n+g,r+v),u=n,f=r,d=i[1],p=i[2];break;case"t":n=u+i[1],r=f+i[2],null===a[0].match(/[QqTt]/)?(d=u,p=f):"t"===a[0]?(d=2*u-s,p=2*f-o):"q"===a[0]&&(d=2*u-d,p=2*f-p),s=d,o=p,t.quadraticCurveTo(d+g,p+v,n+g,r+v),u=n,f=r,d=u+i[1],p=f+i[2];break;case"T":n=i[1],r=i[2],d=2*u-d,p=2*f-p,t.quadraticCurveTo(d+g,p+v,n+g,r+v),u=n,f=r;break;case"a":h(t,u+g,f+v,[i[1],i[2],i[3],i[4],i[5],i[6]+u+g,i[7]+f+v]),u+=i[6],f+=i[7];break;case"A":h(t,u+g,f+v,[i[1],i[2],i[3],i[4],i[5],i[6]+g,i[7]+v]),u=i[6],f=i[7];break;case"z":case"Z":u=l,f=c,t.closePath()}a=i}},render:function(t,e){if(this.visible){t.save(),e&&t.translate(-this.width/2,-this.height/2);var i=this.transformMatrix;i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e||this.transform(t),this._setStrokeStyles(t),this._setFillStyles(t),this._setShadow(t),this.clipTo&&n.util.clipContext(this,t),t.beginPath(),t.globalAlpha=this.group?t.globalAlpha*this.opacity:this.opacity,this._render(t,e),this._renderFill(t),this._renderStroke(t),this.clipTo&&t.restore(),this._removeShadow(t),t.restore()}},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(t){var e=o(this.callSuper("toObject",t),{path:this.path.map(function(t){return t.slice()}),pathOffset:this.pathOffset});return this.sourcePath&&(e.sourcePath=this.sourcePath),this.transformMatrix&&(e.transformMatrix=this.transformMatrix),e},toDatalessObject:function(t){var e=this.toObject(t);return this.sourcePath&&(e.path=this.sourcePath),delete e.sourcePath,e},toSVG:function(t){for(var e=[],i=this._createBaseSVGMarkup(),n=0,r=this.path.length;r>n;n++)e.push(this.path[n].join(" "));var s=e.join(" ");return i.push("<path ",'d="',s,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'" stroke-linecap="round" ',"/>\n"),t?t(i.join("")):i.join("")},complexity:function(){return this.path.length},_parsePath:function(){for(var t,e,i,n,r,s=[],o=[],a=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,h=0,u=this.path.length;u>h;h++){for(t=this.path[h],n=t.slice(1).trim(),o.length=0;i=a.exec(n);)o.push(i[0]);r=[t.charAt(0)];for(var f=0,d=o.length;d>f;f++)e=parseFloat(o[f]),isNaN(e)||r.push(e);var p=r[0],g=l[p.toLowerCase()],v=c[p]||p;if(r.length-1>g)for(var m=1,y=r.length;y>m;m+=g)s.push([p].concat(r.slice(m,m+g))),p=v;else s.push(r)}return s},_parseDimensions:function(){var t=[],e=[],i={};this.path.forEach(function(n,r){this._getCoordsFromCommand(n,r,t,e,i)},this);var n=r(t),o=r(e),a=s(t),h=s(e),l=a-n,c=h-o,u={left:this.left+(n+l/2),top:this.top+(o+c/2),width:l,height:c};return u},_getCoordsFromCommand:function(t,n,r,s,o){var a=!1;"H"!==t[0]&&(o.x=e(0===n?t:this.path[n-1])),"V"!==t[0]&&(o.y=i(0===n?t:this.path[n-1])),t[0]===t[0].toLowerCase()&&(a=!0);var h,l=this._getXY(t,a,o);h=parseInt(l.x,10),isNaN(h)||r.push(h),h=parseInt(l.y,10),isNaN(h)||s.push(h)},_getXY:function(t,n,r){var s=n?r.x+e(t):"V"===t[0]?r.x:e(t),o=n?r.y+i(t):"H"===t[0]?r.y:i(t);return{x:s,y:o}}}),n.Path.fromObject=function(t,e){"string"==typeof t.path?n.loadSVGFromURL(t.path,function(i){var r=i[0],s=t.path;delete t.path,n.util.object.extend(r,t),r.setSourcePath(s),e(r)}):e(new n.Path(t.path,t))},n.Path.ATTRIBUTE_NAMES=n.SHARED_ATTRIBUTES.concat(["d"]),n.Path.fromElement=function(t,e,i){var r=n.parseAttributes(t,n.Path.ATTRIBUTE_NAMES);e&&e(new n.Path(r.d,o(r,i)))},n.Path.async=!0,void 0)}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.array.invoke,r=e.Object.prototype.toObject;return e.PathGroup?void e.warn("fabric.PathGroup is already defined"):(e.PathGroup=e.util.createClass(e.Path,{type:"path-group",fill:"",initialize:function(t,e){e=e||{},this.paths=t||[];for(var i=this.paths.length;i--;)this.paths[i].group=this;this.setOptions(e),e.widthAttr&&(this.scaleX=e.widthAttr/e.width),e.heightAttr&&(this.scaleY=e.heightAttr/e.height),this.setCoords(),e.sourcePath&&this.setSourcePath(e.sourcePath)},render:function(t){if(this.visible){t.save();var i=this.transformMatrix;i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this.transform(t),this._setShadow(t),this.clipTo&&e.util.clipContext(this,t);for(var n=0,r=this.paths.length;r>n;++n)this.paths[n].render(t,!0);this.clipTo&&t.restore(),this._removeShadow(t),t.restore()}},_set:function(t,e){if("fill"===t&&e&&this.isSameColor())for(var i=this.paths.length;i--;)this.paths[i]._set(t,e);return this.callSuper("_set",t,e)},toObject:function(t){var e=i(r.call(this,t),{paths:n(this.getObjects(),"toObject",t)});return this.sourcePath&&(e.sourcePath=this.sourcePath),e},toDatalessObject:function(t){var e=this.toObject(t);return this.sourcePath&&(e.paths=this.sourcePath),e},toSVG:function(t){for(var e=this.getObjects(),i="translate("+this.left+" "+this.top+")",n=["<g ",'style="',this.getSvgStyles(),'" ','transform="',i,this.getSvgTransform(),'" ',">\n"],r=0,s=e.length;s>r;r++)n.push(e[r].toSVG(t));return n.push("</g>\n"),t?t(n.join("")):n.join("")},toString:function(){return"#<fabric.PathGroup ("+this.complexity()+"): { top: "+this.top+", left: "+this.left+" }>"},isSameColor:function(){var t=(this.getObjects()[0].get("fill")||"").toLowerCase();return this.getObjects().every(function(e){return(e.get("fill")||"").toLowerCase()===t})},complexity:function(){return this.paths.reduce(function(t,e){return t+(e&&e.complexity?e.complexity():0)},0)},getObjects:function(){return this.paths}}),e.PathGroup.fromObject=function(t,i){"string"==typeof t.paths?e.loadSVGFromURL(t.paths,function(n){var r=t.paths;delete t.paths;var s=e.util.groupSVGElements(n,t,r);i(s)}):e.util.enlivenObjects(t.paths,function(n){delete t.paths,i(new e.PathGroup(n,t))})},e.PathGroup.async=!0,void 0)}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.array.min,r=e.util.array.max,s=e.util.array.invoke;if(!e.Group){var o={lockMovementX:!0,lockMovementY:!0,lockRotation:!0,lockScalingX:!0,lockScalingY:!0,lockUniScaling:!0};e.Group=e.util.createClass(e.Object,e.Collection,{type:"group",initialize:function(t,e){e=e||{},this._objects=t||[];for(var n=this._objects.length;n--;)this._objects[n].group=this;this.originalState={},this.callSuper("initialize"),this._calcBounds(),this._updateObjectsCoords(),e&&i(this,e),this._setOpacityIfSame(),this.setCoords(),this.saveCoords()},_updateObjectsCoords:function(){this.forEachObject(this._updateObjectCoords,this)},_updateObjectCoords:function(t){var e=t.getLeft(),i=t.getTop();t.set({originalLeft:e,originalTop:i,left:e-this.left,top:i-this.top}),t.setCoords(),t.__origHasControls=t.hasControls,t.hasControls=!1},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(t){return this._restoreObjectsState(),t&&(this._objects.push(t),t.group=this),this.forEachObject(this._setObjectActive,this),this._calcBounds(),this._updateObjectsCoords(),this},_setObjectActive:function(t){t.set("active",!0),t.group=this},removeWithUpdate:function(t){return this._moveFlippedObject(t),this._restoreObjectsState(),this.forEachObject(this._setObjectActive,this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this},_onObjectAdded:function(t){t.group=this},_onObjectRemoved:function(t){delete t.group,t.set("active",!1)},delegatedProperties:{fill:!0,opacity:!0,fontFamily:!0,fontWeight:!0,fontSize:!0,fontStyle:!0,lineHeight:!0,textDecoration:!0,textAlign:!0,backgroundColor:!0},_set:function(t,e){if(t in this.delegatedProperties){var i=this._objects.length;for(this[t]=e;i--;)this._objects[i].set(t,e)}else this[t]=e},toObject:function(t){return i(this.callSuper("toObject",t),{objects:s(this._objects,"toObject",t)})},render:function(t){if(this.visible){t.save(),this.clipTo&&e.util.clipContext(this,t);for(var i=0,n=this._objects.length;n>i;i++)this._renderObject(this._objects[i],t);this.clipTo&&t.restore(),t.restore()}},_renderControls:function(t,e){this.callSuper("_renderControls",t,e);for(var i=0,n=this._objects.length;n>i;i++)this._objects[i]._renderControls(t)},_renderObject:function(t,e){var i=t.hasRotatingPoint;t.visible&&(t.hasRotatingPoint=!1,t.render(e),t.hasRotatingPoint=i)},_restoreObjectsState:function(){return this._objects.forEach(this._restoreObjectState,this),this},_moveFlippedObject:function(t){var e=t.get("originX"),i=t.get("originY"),n=t.getCenterPoint();t.set({originX:"center",originY:"center",left:n.x,top:n.y}),this._toggleFlipping(t);var r=t.getPointByOrigin(e,i);return t.set({originX:e,originY:i,left:r.x,top:r.y}),this},_toggleFlipping:function(t){this.flipX&&(t.toggle("flipX"),t.set("left",-t.get("left")),t.setAngle(-t.getAngle())),this.flipY&&(t.toggle("flipY"),t.set("top",-t.get("top")),t.setAngle(-t.getAngle()))},_restoreObjectState:function(t){return this._setObjectPosition(t),t.setCoords(),t.hasControls=t.__origHasControls,delete t.__origHasControls,t.set("active",!1),t.setCoords(),delete t.group,this},_setObjectPosition:function(t){var e=this.getLeft(),i=this.getTop(),n=this._getRotatedLeftTop(t);t.set({angle:t.getAngle()+this.getAngle(),left:e+n.left,top:i+n.top,scaleX:t.get("scaleX")*this.get("scaleX"),scaleY:t.get("scaleY")*this.get("scaleY")})},_getRotatedLeftTop:function(t){var e=this.getAngle()*(Math.PI/180);return{left:-Math.sin(e)*t.getTop()*this.get("scaleY")+Math.cos(e)*t.getLeft()*this.get("scaleX"),top:Math.cos(e)*t.getTop()*this.get("scaleY")+Math.sin(e)*t.getLeft()*this.get("scaleX")}},destroy:function(){return this._objects.forEach(this._moveFlippedObject,this),this._restoreObjectsState()},saveCoords:function(){return this._originalLeft=this.get("left"),this._originalTop=this.get("top"),this},hasMoved:function(){return this._originalLeft!==this.get("left")||this._originalTop!==this.get("top")},setObjectsCoords:function(){return this.forEachObject(function(t){t.setCoords()}),this},_setOpacityIfSame:function(){var t=this.getObjects(),e=t[0]?t[0].get("opacity"):1,i=t.every(function(t){return t.get("opacity")===e});i&&(this.opacity=e)},_calcBounds:function(t){for(var e,i=[],n=[],r=0,s=this._objects.length;s>r;++r){e=this._objects[r],e.setCoords();for(var o in e.oCoords)i.push(e.oCoords[o].x),n.push(e.oCoords[o].y)}this.set(this._getBounds(i,n,t))},_getBounds:function(t,i,s){var o=e.util.invertTransform(this.getViewportTransform()),a=e.util.transformPoint(new e.Point(n(t),n(i)),o),h=e.util.transformPoint(new e.Point(r(t),r(i)),o),l={width:h.x-a.x||0,height:h.y-a.y||0};return s||(l.left=(a.x+h.x)/2||0,l.top=(a.y+h.y)/2||0),l},toSVG:function(t){for(var e=["<g ",'transform="',this.getSvgTransform(),'">\n'],i=0,n=this._objects.length;n>i;i++)e.push(this._objects[i].toSVG(t));return e.push("</g>\n"),t?t(e.join("")):e.join("")},get:function(t){if(t in o){if(this[t])return this[t];for(var e=0,i=this._objects.length;i>e;e++)if(this._objects[e][t])return!0;return!1}return t in this.delegatedProperties?this._objects[0]&&this._objects[0].get(t):this[t]}}),e.Group.fromObject=function(t,i){e.util.enlivenObjects(t.objects,function(n){delete t.objects,i&&i(new e.Group(n,t))})},e.Group.async=!0}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=fabric.util.object.extend;return t.fabric||(t.fabric={}),t.fabric.Image?void fabric.warn("fabric.Image is already defined."):(fabric.Image=fabric.util.createClass(fabric.Object,{type:"image",crossOrigin:"",initialize:function(t,e){e||(e={}),this.filters=[],this.callSuper("initialize",e),this._initElement(t,e),this._initConfig(e),e.filters&&(this.filters=e.filters,this.applyFilters())},getElement:function(){return this._element},setElement:function(t,e){return this._element=t,this._originalElement=t,this._initConfig(),0!==this.filters.length&&this.applyFilters(e),this},setCrossOrigin:function(t){return this.crossOrigin=t,this._element.crossOrigin=t,this},getOriginalSize:function(){var t=this.getElement();return{width:t.width,height:t.height}},_stroke:function(t){t.save(),this._setStrokeStyles(t),t.beginPath(),t.strokeRect(-this.width/2,-this.height/2,this.width,this.height),t.closePath(),t.restore()},_renderDashedStroke:function(t){var e=-this.width/2,i=-this.height/2,n=this.width,r=this.height;t.save(),this._setStrokeStyles(t),t.beginPath(),fabric.util.drawDashedLine(t,e,i,e+n,i,this.strokeDashArray),fabric.util.drawDashedLine(t,e+n,i,e+n,i+r,this.strokeDashArray),fabric.util.drawDashedLine(t,e+n,i+r,e,i+r,this.strokeDashArray),fabric.util.drawDashedLine(t,e,i+r,e,i,this.strokeDashArray),t.closePath(),t.restore()},toObject:function(t){return e(this.callSuper("toObject",t),{src:this._originalElement.src||this._originalElement._src,filters:this.filters.map(function(t){return t&&t.toObject()}),crossOrigin:this.crossOrigin})},toSVG:function(t){var e=[],i=-this.width/2,n=-this.height/2;if(this.group&&(i=this.left,n=this.top),e.push('<g transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'">\n','<image xlink:href="',this.getSvgSrc(),'" x="',i,'" y="',n,'" style="',this.getSvgStyles(),'" width="',this.width,'" height="',this.height,'" preserveAspectRatio="none"',"></image>\n"),this.stroke||this.strokeDashArray){var r=this.fill;this.fill=null,e.push("<rect ",'x="',i,'" y="',n,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'),this.fill=r}return e.push("</g>\n"),t?t(e.join("")):e.join("")},getSrc:function(){return this.getElement()?this.getElement().src||this.getElement()._src:void 0},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},clone:function(t,e){this.constructor.fromObject(this.toObject(e),t)
|
|
},applyFilters:function(t){if(this._originalElement){if(0===this.filters.length)return this._element=this._originalElement,void(t&&t());var e=this._originalElement,i=fabric.util.createCanvasElement(),n=fabric.util.createImage(),r=this;return i.width=e.width,i.height=e.height,i.getContext("2d").drawImage(e,0,0,e.width,e.height),this.filters.forEach(function(t){t&&t.applyTo(i)}),n.width=e.width,n.height=e.height,fabric.isLikelyNode?(n.src=i.toBuffer(void 0,fabric.Image.pngCompression),r._element=n,t&&t()):(n.onload=function(){r._element=n,t&&t(),n.onload=i=e=null},n.src=i.toDataURL("image/png")),this}},_render:function(t,e){this._element&&t.drawImage(this._element,e?this.left:-this.width/2,e?this.top:-this.height/2,this.width,this.height),this._renderStroke(t)},_resetWidthHeight:function(){var t=this.getElement();this.set("width",t.width),this.set("height",t.height)},_initElement:function(t){this.setElement(fabric.util.getById(t)),fabric.util.addClass(this.getElement(),fabric.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t),this._element&&this.crossOrigin&&(this._element.crossOrigin=this.crossOrigin)},_initFilters:function(t,e){t.filters&&t.filters.length?fabric.util.enlivenObjects(t.filters,function(t){e&&e(t)},"fabric.Image.filters"):e&&e()},_setWidthHeight:function(t){this.width="width"in t?t.width:this.getElement()?this.getElement().width||0:0,this.height="height"in t?t.height:this.getElement()?this.getElement().height||0:0},complexity:function(){return 1}}),fabric.Image.CSS_CANVAS="canvas-img",fabric.Image.prototype.getSvgSrc=fabric.Image.prototype.getSrc,fabric.Image.fromObject=function(t,e){fabric.util.loadImage(t.src,function(i){fabric.Image.prototype._initFilters.call(t,t,function(n){t.filters=n||[];var r=new fabric.Image(i,t);e&&e(r)})},null,t.crossOrigin)},fabric.Image.fromURL=function(t,e,i){fabric.util.loadImage(t,function(t){e(new fabric.Image(t,i))},null,i&&i.crossOrigin)},fabric.Image.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("x y width height xlink:href".split(" ")),fabric.Image.fromElement=function(t,i,n){var r=fabric.parseAttributes(t,fabric.Image.ATTRIBUTE_NAMES);fabric.Image.fromURL(r["xlink:href"],i,e(n?fabric.util.object.clone(n):{},r))},fabric.Image.async=!0,fabric.Image.pngCompression=1,void 0)}("undefined"!=typeof exports?exports:this),fabric.util.object.extend(fabric.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.getAngle()%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.setAngle(this._getAngleValueForStraighten()),this},fxStraighten:function(t){t=t||{};var e=function(){},i=t.onComplete||e,n=t.onChange||e,r=this;return fabric.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){r.setAngle(t),n()},onComplete:function(){r.setCoords(),i()},onStart:function(){r.set("active",!1)}}),this}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.renderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.renderAll.bind(this)}),this}}),fabric.Image.filters=fabric.Image.filters||{},fabric.Image.filters.BaseFilter=fabric.util.createClass({type:"BaseFilter",toObject:function(){return{type:this.type}},toJSON:function(){return this.toObject()}}),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.Brightness=e.util.createClass(e.Image.filters.BaseFilter,{type:"Brightness",initialize:function(t){t=t||{},this.brightness=t.brightness||0},applyTo:function(t){for(var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,r=this.brightness,s=0,o=n.length;o>s;s+=4)n[s]+=r,n[s+1]+=r,n[s+2]+=r;e.putImageData(i,0,0)},toObject:function(){return i(this.callSuper("toObject"),{brightness:this.brightness})}}),e.Image.filters.Brightness.fromObject=function(t){return new e.Image.filters.Brightness(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.Convolute=e.util.createClass(e.Image.filters.BaseFilter,{type:"Convolute",initialize:function(t){t=t||{},this.opaque=t.opaque,this.matrix=t.matrix||[0,0,0,0,1,0,0,0,0];var i=e.util.createCanvasElement();this.tmpCtx=i.getContext("2d")},_createImageData:function(t,e){return this.tmpCtx.createImageData(t,e)},applyTo:function(t){for(var e=this.matrix,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=Math.round(Math.sqrt(e.length)),s=Math.floor(r/2),o=n.data,a=n.width,h=n.height,l=a,c=h,u=this._createImageData(l,c),f=u.data,d=this.opaque?1:0,p=0;c>p;p++)for(var g=0;l>g;g++){for(var v=p,m=g,y=4*(p*l+g),b=0,x=0,_=0,w=0,C=0;r>C;C++)for(var S=0;r>S;S++){var T=v+C-s,k=m+S-s;if(!(0>T||T>h||0>k||k>a)){var O=4*(T*a+k),E=e[C*r+S];b+=o[O]*E,x+=o[O+1]*E,_+=o[O+2]*E,w+=o[O+3]*E}}f[y]=b,f[y+1]=x,f[y+2]=_,f[y+3]=w+d*(255-w)}i.putImageData(u,0,0)},toObject:function(){return i(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),e.Image.filters.Convolute.fromObject=function(t){return new e.Image.filters.Convolute(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.GradientTransparency=e.util.createClass(e.Image.filters.BaseFilter,{type:"GradientTransparency",initialize:function(t){t=t||{},this.threshold=t.threshold||100},applyTo:function(t){for(var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,r=this.threshold,s=n.length,o=0,a=n.length;a>o;o+=4)n[o+3]=r+255*(s-o)/s;e.putImageData(i,0,0)},toObject:function(){return i(this.callSuper("toObject"),{threshold:this.threshold})}}),e.Image.filters.GradientTransparency.fromObject=function(t){return new e.Image.filters.GradientTransparency(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Image.filters.Grayscale=e.util.createClass(e.Image.filters.BaseFilter,{type:"Grayscale",applyTo:function(t){for(var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,s=n.width*n.height*4,o=0;s>o;)e=(r[o]+r[o+1]+r[o+2])/3,r[o]=e,r[o+1]=e,r[o+2]=e,o+=4;i.putImageData(n,0,0)}}),e.Image.filters.Grayscale.fromObject=function(){return new e.Image.filters.Grayscale}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Image.filters.Invert=e.util.createClass(e.Image.filters.BaseFilter,{type:"Invert",applyTo:function(t){var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,s=r.length;for(e=0;s>e;e+=4)r[e]=255-r[e],r[e+1]=255-r[e+1],r[e+2]=255-r[e+2];i.putImageData(n,0,0)}}),e.Image.filters.Invert.fromObject=function(){return new e.Image.filters.Invert}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.Mask=e.util.createClass(e.Image.filters.BaseFilter,{type:"Mask",initialize:function(t){t=t||{},this.mask=t.mask,this.channel=[0,1,2,3].indexOf(t.channel)>-1?t.channel:0},applyTo:function(t){if(this.mask){var i,n=t.getContext("2d"),r=n.getImageData(0,0,t.width,t.height),s=r.data,o=this.mask.getElement(),a=e.util.createCanvasElement(),h=this.channel,l=r.width*r.height*4;a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0,o.width,o.height);var c=a.getContext("2d").getImageData(0,0,o.width,o.height),u=c.data;for(i=0;l>i;i+=4)s[i+3]=u[i+h];n.putImageData(r,0,0)}},toObject:function(){return i(this.callSuper("toObject"),{mask:this.mask.toObject(),channel:this.channel})}}),e.Image.filters.Mask.fromObject=function(t,i){e.util.loadImage(t.mask.src,function(n){t.mask=new e.Image(n,t.mask),i&&i(new e.Image.filters.Mask(t))})},e.Image.filters.Mask.async=!0}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.Noise=e.util.createClass(e.Image.filters.BaseFilter,{type:"Noise",initialize:function(t){t=t||{},this.noise=t.noise||0},applyTo:function(t){for(var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,s=this.noise,o=0,a=r.length;a>o;o+=4)e=(.5-Math.random())*s,r[o]+=e,r[o+1]+=e,r[o+2]+=e;i.putImageData(n,0,0)},toObject:function(){return i(this.callSuper("toObject"),{noise:this.noise})}}),e.Image.filters.Noise.fromObject=function(t){return new e.Image.filters.Noise(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.Pixelate=e.util.createClass(e.Image.filters.BaseFilter,{type:"Pixelate",initialize:function(t){t=t||{},this.blocksize=t.blocksize||4},applyTo:function(t){var e,i,n,r,s,o,a,h=t.getContext("2d"),l=h.getImageData(0,0,t.width,t.height),c=l.data,u=l.height,f=l.width;for(i=0;u>i;i+=this.blocksize)for(n=0;f>n;n+=this.blocksize){e=4*i*f+4*n,r=c[e],s=c[e+1],o=c[e+2],a=c[e+3];for(var d=i,p=i+this.blocksize;p>d;d++)for(var g=n,v=n+this.blocksize;v>g;g++)e=4*d*f+4*g,c[e]=r,c[e+1]=s,c[e+2]=o,c[e+3]=a}h.putImageData(l,0,0)},toObject:function(){return i(this.callSuper("toObject"),{blocksize:this.blocksize})}}),e.Image.filters.Pixelate.fromObject=function(t){return new e.Image.filters.Pixelate(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.RemoveWhite=e.util.createClass(e.Image.filters.BaseFilter,{type:"RemoveWhite",initialize:function(t){t=t||{},this.threshold=t.threshold||30,this.distance=t.distance||20},applyTo:function(t){for(var e,i,n,r=t.getContext("2d"),s=r.getImageData(0,0,t.width,t.height),o=s.data,a=this.threshold,h=this.distance,l=255-a,c=Math.abs,u=0,f=o.length;f>u;u+=4)e=o[u],i=o[u+1],n=o[u+2],e>l&&i>l&&n>l&&c(e-i)<h&&c(e-n)<h&&c(i-n)<h&&(o[u+3]=1);r.putImageData(s,0,0)},toObject:function(){return i(this.callSuper("toObject"),{threshold:this.threshold,distance:this.distance})}}),e.Image.filters.RemoveWhite.fromObject=function(t){return new e.Image.filters.RemoveWhite(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Image.filters.Sepia=e.util.createClass(e.Image.filters.BaseFilter,{type:"Sepia",applyTo:function(t){var e,i,n=t.getContext("2d"),r=n.getImageData(0,0,t.width,t.height),s=r.data,o=s.length;for(e=0;o>e;e+=4)i=.3*s[e]+.59*s[e+1]+.11*s[e+2],s[e]=i+100,s[e+1]=i+50,s[e+2]=i+255;n.putImageData(r,0,0)}}),e.Image.filters.Sepia.fromObject=function(){return new e.Image.filters.Sepia}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Image.filters.Sepia2=e.util.createClass(e.Image.filters.BaseFilter,{type:"Sepia2",applyTo:function(t){var e,i,n,r,s=t.getContext("2d"),o=s.getImageData(0,0,t.width,t.height),a=o.data,h=a.length;for(e=0;h>e;e+=4)i=a[e],n=a[e+1],r=a[e+2],a[e]=(.393*i+.769*n+.189*r)/1.351,a[e+1]=(.349*i+.686*n+.168*r)/1.203,a[e+2]=(.272*i+.534*n+.131*r)/2.14;s.putImageData(o,0,0)}}),e.Image.filters.Sepia2.fromObject=function(){return new e.Image.filters.Sepia2}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.Tint=e.util.createClass(e.Image.filters.BaseFilter,{type:"Tint",initialize:function(t){t=t||{},this.color=t.color||"#000000",this.opacity="undefined"!=typeof t.opacity?t.opacity:new e.Color(this.color).getAlpha()},applyTo:function(t){var i,n,r,s,o,a,h,l,c,u=t.getContext("2d"),f=u.getImageData(0,0,t.width,t.height),d=f.data,p=d.length;for(c=new e.Color(this.color).getSource(),n=c[0]*this.opacity,r=c[1]*this.opacity,s=c[2]*this.opacity,l=1-this.opacity,i=0;p>i;i+=4)o=d[i],a=d[i+1],h=d[i+2],d[i]=n+o*l,d[i+1]=r+a*l,d[i+2]=s+h*l;u.putImageData(f,0,0)},toObject:function(){return i(this.callSuper("toObject"),{color:this.color,opacity:this.opacity})}}),e.Image.filters.Tint.fromObject=function(t){return new e.Image.filters.Tint(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Image.filters.Multiply=e.util.createClass(e.Image.filters.BaseFilter,{type:"Multiply",initialize:function(t){t=t||{},this.color=t.color||"#000000"},applyTo:function(t){var i,n,r=t.getContext("2d"),s=r.getImageData(0,0,t.width,t.height),o=s.data,a=o.length;for(n=new e.Color(this.color).getSource(),i=0;a>i;i+=4)o[i]*=n[0]/255,o[i+1]*=n[1]/255,o[i+2]*=n[2]/255;r.putImageData(s,0,0)},toObject:function(){return i(this.callSuper("toObject"),{color:this.color})}}),e.Image.filters.Multiply.fromObject=function(t){return new e.Image.filters.Multiply(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric;e.Image.filters.Blend=e.util.createClass({type:"Blend",initialize:function(t){t=t||{},this.color=t.color||"#000",this.image=t.image||!1,this.mode=t.mode||"multiply",this.alpha=t.alpha||1},applyTo:function(t){var i,n,r,s,o,a,h,l=t.getContext("2d"),c=l.getImageData(0,0,t.width,t.height),u=c.data,f=!1;if(this.image){f=!0;var d=e.util.createCanvasElement();d.width=this.image.width,d.height=this.image.height;var p=new e.StaticCanvas(d);p.add(this.image);var g=p.getContext("2d");h=g.getImageData(0,0,p.width,p.height).data}else h=new e.Color(this.color).getSource(),i=h[0]*this.alpha,n=h[1]*this.alpha,r=h[2]*this.alpha;for(var v=0,m=u.length;m>v;v+=4)switch(s=u[v],o=u[v+1],a=u[v+2],f&&(i=h[v]*this.alpha,n=h[v+1]*this.alpha,r=h[v+2]*this.alpha),this.mode){case"multiply":u[v]=s*i/255,u[v+1]=o*n/255,u[v+2]=a*r/255;break;case"screen":u[v]=1-(1-s)*(1-i),u[v+1]=1-(1-o)*(1-n),u[v+2]=1-(1-a)*(1-r);break;case"add":u[v]=Math.min(255,s+i),u[v+1]=Math.min(255,o+n),u[v+2]=Math.min(255,a+r);break;case"diff":case"difference":u[v]=Math.abs(s-i),u[v+1]=Math.abs(o-n),u[v+2]=Math.abs(a-r);break;case"subtract":var y=s-i,b=o-n,x=a-r;u[v]=0>y?0:y,u[v+1]=0>b?0:b,u[v+2]=0>x?0:x;break;case"darken":u[v]=Math.min(s,i),u[v+1]=Math.min(o,n),u[v+2]=Math.min(a,r);break;case"lighten":u[v]=Math.max(s,i),u[v+1]=Math.max(o,n),u[v+2]=Math.max(a,r)}l.putImageData(c,0,0)}}),e.Image.filters.Blend.fromObject=function(t){return new e.Image.filters.Blend(t)}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.object.clone,r=e.util.toFixed,s=e.StaticCanvas.supports("setLineDash");if(e.Text)return void e.warn("fabric.Text is already defined");var o=e.Object.prototype.stateProperties.concat();o.push("fontFamily","fontWeight","fontSize","text","textDecoration","textAlign","fontStyle","lineHeight","textBackgroundColor","useNative","path"),e.Text=e.util.createClass(e.Object,{_dimensionAffectingProps:{fontSize:!0,fontWeight:!0,fontFamily:!0,textDecoration:!0,fontStyle:!0,lineHeight:!0,stroke:!0,strokeWidth:!0,text:!0},_reNewline:/\r?\n/,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",textDecoration:"",textAlign:"left",fontStyle:"",lineHeight:1.3,textBackgroundColor:"",path:null,useNative:!0,stateProperties:o,stroke:null,shadow:null,initialize:function(t,e){e=e||{},this.text=t,this.__skipDimension=!0,this.setOptions(e),this.__skipDimension=!1,this._initDimensions()},_initDimensions:function(){if(!this.__skipDimension){var t=e.util.createCanvasElement();this._render(t.getContext("2d"))}},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_render:function(t){"undefined"==typeof Cufon||this.useNative===!0?this._renderViaNative(t):this._renderViaCufon(t)},_renderViaNative:function(t){var i=this.text.split(this._reNewline);this._setTextStyles(t),this.width=this._getTextWidth(t,i),this.height=this._getTextHeight(t,i),this.clipTo&&e.util.clipContext(this,t),this._renderTextBackground(t,i),this._translateForTextAlign(t),this._renderText(t,i),"left"!==this.textAlign&&"justify"!==this.textAlign&&t.restore(),this._renderTextDecoration(t,i),this.clipTo&&t.restore(),this._setBoundaries(t,i),this._totalLineHeight=0},_renderText:function(t,e){t.save(),this._setShadow(t),this._setupFillRule(t),this._renderTextFill(t,e),this._renderTextStroke(t,e),this._restoreFillRule(t),this._removeShadow(t),t.restore()},_translateForTextAlign:function(t){"left"!==this.textAlign&&"justify"!==this.textAlign&&(t.save(),t.translate("center"===this.textAlign?this.width/2:this.width,0))},_setBoundaries:function(t,e){this._boundaries=[];for(var i=0,n=e.length;n>i;i++){var r=this._getLineWidth(t,e[i]),s=this._getLineLeftOffset(r);this._boundaries.push({height:this.fontSize*this.lineHeight,width:r,left:s})}},_setTextStyles:function(t){this._setFillStyles(t),this._setStrokeStyles(t),t.textBaseline="alphabetic",this.skipTextAlign||(t.textAlign=this.textAlign),t.font=this._getFontDeclaration()},_getTextHeight:function(t,e){return this.fontSize*e.length*this.lineHeight},_getTextWidth:function(t,e){for(var i=t.measureText(e[0]||"|").width,n=1,r=e.length;r>n;n++){var s=t.measureText(e[n]).width;s>i&&(i=s)}return i},_renderChars:function(t,e,i,n,r){e[t](i,n,r)},_renderTextLine:function(t,e,i,n,r,s){if(r-=this.fontSize/4,"justify"!==this.textAlign)return void this._renderChars(t,e,i,n,r,s);var o=e.measureText(i).width,a=this.width;if(a>o)for(var h=i.split(/\s+/),l=e.measureText(i.replace(/\s+/g,"")).width,c=a-l,u=h.length-1,f=c/u,d=0,p=0,g=h.length;g>p;p++)this._renderChars(t,e,h[p],n+d,r,s),d+=e.measureText(h[p]).width+f;else this._renderChars(t,e,i,n,r,s)},_getLeftOffset:function(){return e.isLikelyNode?0:-this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextFill:function(t,e){if(this.fill||this._skipFillStrokeCheck){this._boundaries=[];for(var i=0,n=0,r=e.length;r>n;n++){var s=this._getHeightOfLine(t,n,e);i+=s,this._renderTextLine("fillText",t,e[n],this._getLeftOffset(),this._getTopOffset()+i,n)}}},_renderTextStroke:function(t,e){if(this.stroke&&0!==this.strokeWidth||this._skipFillStrokeCheck){var i=0;t.save(),this.strokeDashArray&&(1&this.strokeDashArray.length&&this.strokeDashArray.push.apply(this.strokeDashArray,this.strokeDashArray),s&&t.setLineDash(this.strokeDashArray)),t.beginPath();for(var n=0,r=e.length;r>n;n++){var o=this._getHeightOfLine(t,n,e);i+=o,this._renderTextLine("strokeText",t,e[n],this._getLeftOffset(),this._getTopOffset()+i,n)}t.closePath(),t.restore()}},_getHeightOfLine:function(){return this.fontSize*this.lineHeight},_renderTextBackground:function(t,e){this._renderTextBoxBackground(t),this._renderTextLinesBackground(t,e)},_renderTextBoxBackground:function(t){this.backgroundColor&&(t.save(),t.fillStyle=this.backgroundColor,t.fillRect(this._getLeftOffset(),this._getTopOffset(),this.width,this.height),t.restore())},_renderTextLinesBackground:function(t,e){if(this.textBackgroundColor){t.save(),t.fillStyle=this.textBackgroundColor;for(var i=0,n=e.length;n>i;i++)if(""!==e[i]){var r=this._getLineWidth(t,e[i]),s=this._getLineLeftOffset(r);t.fillRect(this._getLeftOffset()+s,this._getTopOffset()+i*this.fontSize*this.lineHeight,r,this.fontSize*this.lineHeight)}t.restore()}},_getLineLeftOffset:function(t){return"center"===this.textAlign?(this.width-t)/2:"right"===this.textAlign?this.width-t:0},_getLineWidth:function(t,e){return"justify"===this.textAlign?this.width:t.measureText(e).width},_renderTextDecoration:function(t,e){function i(i){for(var s=0,o=e.length;o>s;s++){var a=r._getLineWidth(t,e[s]),h=r._getLineLeftOffset(a);t.fillRect(r._getLeftOffset()+h,~~(i+s*r._getHeightOfLine(t,s,e)-n),a,1)}}if(this.textDecoration){var n=this._getTextHeight(t,e)/2,r=this;this.textDecoration.indexOf("underline")>-1&&i(this.fontSize*this.lineHeight),this.textDecoration.indexOf("line-through")>-1&&i(this.fontSize*this.lineHeight-this.fontSize/2),this.textDecoration.indexOf("overline")>-1&&i(this.fontSize*this.lineHeight-this.fontSize)}},_getFontDeclaration:function(){return[e.isLikelyNode?this.fontWeight:this.fontStyle,e.isLikelyNode?this.fontStyle:this.fontWeight,this.fontSize+"px",e.isLikelyNode?'"'+this.fontFamily+'"':this.fontFamily].join(" ")},render:function(t,e){if(this.visible){t.save(),this._transform(t,e);var i=this.transformMatrix,n=this.group&&"path-group"===this.group.type;n&&t.translate(-this.group.width/2,-this.group.height/2),i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),n&&t.translate(this.left,this.top),this._render(t),t.restore()}},toObject:function(t){var e=i(this.callSuper("toObject",t),{text:this.text,fontSize:this.fontSize,fontWeight:this.fontWeight,fontFamily:this.fontFamily,fontStyle:this.fontStyle,lineHeight:this.lineHeight,textDecoration:this.textDecoration,textAlign:this.textAlign,path:this.path,textBackgroundColor:this.textBackgroundColor,useNative:this.useNative});return this.includeDefaultValues||this._removeDefaultValues(e),e},toSVG:function(t){var e=[],i=this.text.split(this._reNewline),n=this._getSVGLeftTopOffsets(i),r=this._getSVGTextAndBg(n.lineTop,n.textLeft,i),s=this._getSVGShadows(n.lineTop,i);return n.textTop+=this._fontAscent?this._fontAscent/5*this.lineHeight:0,this._wrapSVGTextAndBg(e,r,s,n),t?t(e.join("")):e.join("")},_getSVGLeftTopOffsets:function(t){var e=this.useNative?this.fontSize*this.lineHeight:-this._fontAscent-this._fontAscent/5*this.lineHeight,i=-(this.width/2),n=this.useNative?this.fontSize-1:this.height/2-t.length*this.fontSize-this._totalLineHeight;return{textLeft:i+(this.group?this.left:0),textTop:n+(this.group?this.top:0),lineTop:e}},_wrapSVGTextAndBg:function(t,e,i,n){t.push('<g transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'">\n',e.textBgRects.join(""),"<text ",this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",this.textDecoration?'text-decoration="'+this.textDecoration+'" ':"",'style="',this.getSvgStyles(),'" ','transform="translate(',r(n.textLeft,2)," ",r(n.textTop,2),')">',i.join(""),e.textSpans.join(""),"</text>\n","</g>\n")},_getSVGShadows:function(t,i){var n,s,o=[],a=1;if(!this.shadow||!this._boundaries)return o;for(n=0,s=i.length;s>n;n++)if(""!==i[n]){var h=this._boundaries&&this._boundaries[n]?this._boundaries[n].left:0;o.push('<tspan x="',r(h+a+this.shadow.offsetX,2),0===n||this.useNative?'" y':'" dy','="',r(this.useNative?t*n-this.height/2+this.shadow.offsetY:t+(0===n?this.shadow.offsetY:0),2),'" ',this._getFillAttributes(this.shadow.color),">",e.util.string.escapeXml(i[n]),"</tspan>"),a=1}else a++;return o},_getSVGTextAndBg:function(t,e,i){var n=[],r=[],s=1;this._setSVGBg(r);for(var o=0,a=i.length;a>o;o++)""!==i[o]?(this._setSVGTextLineText(i[o],o,n,t,s,r),s=1):s++,this.textBackgroundColor&&this._boundaries&&this._setSVGTextLineBg(r,o,e,t);return{textSpans:n,textBgRects:r}},_setSVGTextLineText:function(t,i,n,s,o){var a=this._boundaries&&this._boundaries[i]?r(this._boundaries[i].left,2):0;n.push('<tspan x="',a,'" ',0===i||this.useNative?"y":"dy",'="',r(this.useNative?s*i-this.height/2:s*o,2),'" ',this._getFillAttributes(this.fill),">",e.util.string.escapeXml(t),"</tspan>")},_setSVGTextLineBg:function(t,e,i,n){t.push("<rect ",this._getFillAttributes(this.textBackgroundColor),' x="',r(i+this._boundaries[e].left,2),'" y="',r(n*e-this.height/2,2),'" width="',r(this._boundaries[e].width,2),'" height="',r(this._boundaries[e].height,2),'"></rect>\n')},_setSVGBg:function(t){this.backgroundColor&&this._boundaries&&t.push("<rect ",this._getFillAttributes(this.backgroundColor),' x="',r(-this.width/2,2),'" y="',r(-this.height/2,2),'" width="',r(this.width,2),'" height="',r(this.height,2),'"></rect>')},_getFillAttributes:function(t){var i=t&&"string"==typeof t?new e.Color(t):"";return i&&i.getSource()&&1!==i.getAlpha()?'opacity="'+i.getAlpha()+'" fill="'+i.setAlpha(1).toRgb()+'"':'fill="'+t+'"'},_set:function(t,e){"fontFamily"===t&&this.path&&(this.path=this.path.replace(/(.*?)([^\/]*)(\.font\.js)/,"$1"+e+"$3")),this.callSuper("_set",t,e),t in this._dimensionAffectingProps&&(this._initDimensions(),this.setCoords())},complexity:function(){return 1}}),e.Text.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size text-decoration text-anchor".split(" ")),e.Text.DEFAULT_SVG_FONT_SIZE=16,e.Text.fromElement=function(t,i){if(!t)return null;var n=e.parseAttributes(t,e.Text.ATTRIBUTE_NAMES);i=e.util.object.extend(i?e.util.object.clone(i):{},n),"dx"in n&&(i.left+=n.dx),"dy"in n&&(i.top+=n.dy),"fontSize"in i||(i.fontSize=e.Text.DEFAULT_SVG_FONT_SIZE),i.originX||(i.originX="left");var r=new e.Text(t.textContent,i),s=0;return"left"===r.originX&&(s=r.getWidth()/2),"right"===r.originX&&(s=-r.getWidth()/2),r.set({left:r.getLeft()+s,top:r.getTop()-r.getHeight()/2}),r},e.Text.fromObject=function(t){return new e.Text(t.text,n(t))},e.util.createAccessors(e.Text)}("undefined"!=typeof exports?exports:this),function(){var t=fabric.util.object.clone;fabric.IText=fabric.util.createClass(fabric.Text,fabric.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"#333",cursorDelay:1e3,cursorDuration:600,styles:null,caching:!0,_skipFillStrokeCheck:!0,_reSpace:/\s|\n/,_fontSizeFraction:4,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,_charWidthsCache:{},initialize:function(t,e){this.styles=e?e.styles||{}:{},this.callSuper("initialize",t,e),this.initBehavior(),fabric.IText.instances.push(this),this.__lineWidths={},this.__lineHeights={},this.__lineOffsets={}},isEmptyStyles:function(){if(!this.styles)return!0;var t=this.styles;for(var e in t)for(var i in t[e])for(var n in t[e][i])return!1;return!0},setSelectionStart:function(t){this.selectionStart!==t&&(this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})),this.selectionStart=t,this.hiddenTextarea&&(this.hiddenTextarea.selectionStart=t)},setSelectionEnd:function(t){this.selectionEnd!==t&&(this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})),this.selectionEnd=t,this.hiddenTextarea&&(this.hiddenTextarea.selectionEnd=t)},getSelectionStyles:function(t,e){if(2===arguments.length){for(var i=[],n=t;e>n;n++)i.push(this.getSelectionStyles(n));return i}var r=this.get2DCursorLocation(t);return this.styles[r.lineIndex]?this.styles[r.lineIndex][r.charIndex]||{}:{}},setSelectionStyles:function(t){if(this.selectionStart===this.selectionEnd)this._extendStyles(this.selectionStart,t);else for(var e=this.selectionStart;e<this.selectionEnd;e++)this._extendStyles(e,t);return this},_extendStyles:function(t,e){var i=this.get2DCursorLocation(t);this.styles[i.lineIndex]||(this.styles[i.lineIndex]={}),this.styles[i.lineIndex][i.charIndex]||(this.styles[i.lineIndex][i.charIndex]={}),fabric.util.object.extend(this.styles[i.lineIndex][i.charIndex],e)},_render:function(t){this.callSuper("_render",t),this.ctx=t,this.isEditing&&this.renderCursorOrSelection()},renderCursorOrSelection:function(){if(this.active){var t,e=this.text.split("");this.selectionStart===this.selectionEnd?(t=this._getCursorBoundaries(e,"cursor"),this.renderCursor(t)):(t=this._getCursorBoundaries(e,"selection"),this.renderSelection(e,t))}},get2DCursorLocation:function(t){"undefined"==typeof t&&(t=this.selectionStart);var e=this.text.slice(0,t),i=e.split(this._reNewline);return{lineIndex:i.length-1,charIndex:i[i.length-1].length}},getCurrentCharStyle:function(t,e){var i=this.styles[t]&&this.styles[t][0===e?0:e-1];return{fontSize:i&&i.fontSize||this.fontSize,fill:i&&i.fill||this.fill,textBackgroundColor:i&&i.textBackgroundColor||this.textBackgroundColor,textDecoration:i&&i.textDecoration||this.textDecoration,fontFamily:i&&i.fontFamily||this.fontFamily,fontWeight:i&&i.fontWeight||this.fontWeight,fontStyle:i&&i.fontStyle||this.fontStyle,stroke:i&&i.stroke||this.stroke,strokeWidth:i&&i.strokeWidth||this.strokeWidth}},getCurrentCharFontSize:function(t,e){return this.styles[t]&&this.styles[t][0===e?0:e-1]&&this.styles[t][0===e?0:e-1].fontSize||this.fontSize},getCurrentCharColor:function(t,e){return this.styles[t]&&this.styles[t][0===e?0:e-1]&&this.styles[t][0===e?0:e-1].fill||this.cursorColor},_getCursorBoundaries:function(t,e){var i=this.get2DCursorLocation(),n=this.text.split(this._reNewline),r=Math.round(this._getLeftOffset()),s=-this.height/2,o=this._getCursorBoundariesOffsets(t,e,i,n);return{left:r,top:s,leftOffset:o.left+o.lineLeft,topOffset:o.top}},_getCursorBoundariesOffsets:function(t,e,i,n){for(var r=0,s=0,o=0,a=0,h="cursor"===e?this._getHeightOfLine(this.ctx,0)-this.getCurrentCharFontSize(i.lineIndex,i.charIndex):0,l=0;l<this.selectionStart;l++){if("\n"===t[l]){a=0;var c=s+("cursor"===e?1:0);h+=this._getCachedLineHeight(c),s++,o=0}else a+=this._getWidthOfChar(this.ctx,t[l],s,o),o++;r=this._getCachedLineOffset(s,n)}return this._clearCache(),{top:h,left:a,lineLeft:r}},_clearCache:function(){this.__lineWidths={},this.__lineHeights={},this.__lineOffsets={}},_getCachedLineHeight:function(t){return this.__lineHeights[t]||(this.__lineHeights[t]=this._getHeightOfLine(this.ctx,t))},_getCachedLineWidth:function(t,e){return this.__lineWidths[t]||(this.__lineWidths[t]=this._getWidthOfLine(this.ctx,t,e))},_getCachedLineOffset:function(t,e){var i=this._getCachedLineWidth(t,e);return this.__lineOffsets[t]||(this.__lineOffsets[t]=this._getLineLeftOffset(i))},renderCursor:function(t){var e=this.ctx;e.save();var i=this.get2DCursorLocation(),n=i.lineIndex,r=i.charIndex,s=this.getCurrentCharFontSize(n,r),o=0===n&&0===r?this._getCachedLineOffset(n,this.text.split(this._reNewline)):t.leftOffset;e.fillStyle=this.getCurrentCharColor(n,r),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+o,t.top+t.topOffset,this.cursorWidth/this.scaleX,s),e.restore()},renderSelection:function(t,e){var i=this.ctx;i.save(),i.fillStyle=this.selectionColor;for(var n=this.get2DCursorLocation(this.selectionStart),r=this.get2DCursorLocation(this.selectionEnd),s=n.lineIndex,o=r.lineIndex,a=this.text.split(this._reNewline),h=s;o>=h;h++){var l=this._getCachedLineOffset(h,a)||0,c=this._getCachedLineHeight(h),u=0;if(h===s)for(var f=0,d=a[h].length;d>f;f++)f>=n.charIndex&&(h!==o||f<r.charIndex)&&(u+=this._getWidthOfChar(i,a[h][f],h,f)),f<n.charIndex&&(l+=this._getWidthOfChar(i,a[h][f],h,f));else if(h>s&&o>h)u+=this._getCachedLineWidth(h,a)||5;else if(h===o)for(var p=0,g=r.charIndex;g>p;p++)u+=this._getWidthOfChar(i,a[h][p],h,p);i.fillRect(e.left+l,e.top+e.topOffset,u,c),e.topOffset+=c}i.restore()},_renderChars:function(t,e,i,n,r,s){if(this.isEmptyStyles())return this._renderCharsFast(t,e,i,n,r);this.skipTextAlign=!0,n-="center"===this.textAlign?this.width/2:"right"===this.textAlign?this.width:0;var o,a=this.text.split(this._reNewline),h=this._getWidthOfLine(e,s,a),l=this._getHeightOfLine(e,s,a),c=this._getLineLeftOffset(h),u=i.split(""),f="";n+=c||0,e.save();for(var d=0,p=u.length;p>=d;d++){o=o||this.getCurrentCharStyle(s,d);var g=this.getCurrentCharStyle(s,d+1);(this._hasStyleChanged(o,g)||d===p)&&(this._renderChar(t,e,s,d-1,f,n,r,l),f="",o=g),f+=u[d]}e.restore()},_renderCharsFast:function(t,e,i,n,r){this.skipTextAlign=!1,"fillText"===t&&this.fill&&this.callSuper("_renderChars",t,e,i,n,r),"strokeText"===t&&this.stroke&&this.callSuper("_renderChars",t,e,i,n,r)},_renderChar:function(t,e,i,n,r,s,o,a){var h,l,c;if(this.styles&&this.styles[i]&&(h=this.styles[i][n])){var u=h.stroke||this.stroke,f=h.fill||this.fill;e.save(),l=this._applyCharStylesGetWidth(e,r,i,n,h),c=this._getHeightOfChar(e,r,i,n),f&&e.fillText(r,s,o),u&&e.strokeText(r,s,o),this._renderCharDecoration(e,h,s,o,l,a,c),e.restore(),e.translate(l,0)}else"strokeText"===t&&this.stroke&&e[t](r,s,o),"fillText"===t&&this.fill&&e[t](r,s,o),l=this._applyCharStylesGetWidth(e,r,i,n),this._renderCharDecoration(e,null,s,o,l,a),e.translate(e.measureText(r).width,0)},_hasStyleChanged:function(t,e){return t.fill!==e.fill||t.fontSize!==e.fontSize||t.textBackgroundColor!==e.textBackgroundColor||t.textDecoration!==e.textDecoration||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth
|
|
},_renderCharDecoration:function(t,e,i,n,r,s,o){var a=e?e.textDecoration||this.textDecoration:this.textDecoration,h=(e?e.fontSize:null)||this.fontSize;a&&(a.indexOf("underline")>-1&&this._renderCharDecorationAtOffset(t,i,n+this.fontSize/this._fontSizeFraction,r,0,this.fontSize/20),a.indexOf("line-through")>-1&&this._renderCharDecorationAtOffset(t,i,n+this.fontSize/this._fontSizeFraction,r,o/2,h/20),a.indexOf("overline")>-1&&this._renderCharDecorationAtOffset(t,i,n,r,s-this.fontSize/this._fontSizeFraction,this.fontSize/20))},_renderCharDecorationAtOffset:function(t,e,i,n,r,s){t.fillRect(e,i-r,n,s)},_renderTextLine:function(t,e,i,n,r,s){r+=this.fontSize/4,this.callSuper("_renderTextLine",t,e,i,n,r,s)},_renderTextDecoration:function(t,e){return this.isEmptyStyles()?this.callSuper("_renderTextDecoration",t,e):void 0},_renderTextLinesBackground:function(t,e){if(this.textBackgroundColor||this.styles){t.save(),this.textBackgroundColor&&(t.fillStyle=this.textBackgroundColor);for(var i=0,n=this.fontSize/this._fontSizeFraction,r=0,s=e.length;s>r;r++){var o=this._getHeightOfLine(t,r,e);if(""!==e[r]){var a=this._getWidthOfLine(t,r,e),h=this._getLineLeftOffset(a);if(this.textBackgroundColor&&(t.fillStyle=this.textBackgroundColor,t.fillRect(this._getLeftOffset()+h,this._getTopOffset()+i+n,a,o)),this.styles[r])for(var l=0,c=e[r].length;c>l;l++)if(this.styles[r]&&this.styles[r][l]&&this.styles[r][l].textBackgroundColor){var u=e[r][l];t.fillStyle=this.styles[r][l].textBackgroundColor,t.fillRect(this._getLeftOffset()+h+this._getWidthOfCharsAt(t,r,l,e),this._getTopOffset()+i+n,this._getWidthOfChar(t,u,r,l,e)+1,o)}i+=o}else i+=o}t.restore()}},_getCacheProp:function(t,e){return t+e.fontFamily+e.fontSize+e.fontWeight+e.fontStyle+e.shadow},_applyCharStylesGetWidth:function(e,i,n,r,s){var o=s||this.styles[n]&&this.styles[n][r];o=o?t(o):{},this._applyFontStyles(o);var a=this._getCacheProp(i,o);if(this.isEmptyStyles()&&this._charWidthsCache[a]&&this.caching)return this._charWidthsCache[a];"string"==typeof o.shadow&&(o.shadow=new fabric.Shadow(o.shadow));var h=o.fill||this.fill;return e.fillStyle=h.toLive?h.toLive(e):h,o.stroke&&(e.strokeStyle=o.stroke&&o.stroke.toLive?o.stroke.toLive(e):o.stroke),e.lineWidth=o.strokeWidth||this.strokeWidth,e.font=this._getFontDeclaration.call(o),this._setShadow.call(o,e),this.caching?(this._charWidthsCache[a]||(this._charWidthsCache[a]=e.measureText(i).width),this._charWidthsCache[a]):e.measureText(i).width},_applyFontStyles:function(t){t.fontFamily||(t.fontFamily=this.fontFamily),t.fontSize||(t.fontSize=this.fontSize),t.fontWeight||(t.fontWeight=this.fontWeight),t.fontStyle||(t.fontStyle=this.fontStyle)},_getStyleDeclaration:function(e,i){return this.styles[e]&&this.styles[e][i]?t(this.styles[e][i]):{}},_getWidthOfChar:function(t,e,i,n){var r=this._getStyleDeclaration(i,n);this._applyFontStyles(r);var s=this._getCacheProp(e,r);if(this._charWidthsCache[s]&&this.caching)return this._charWidthsCache[s];if(t){t.save();var o=this._applyCharStylesGetWidth(t,e,i,n);return t.restore(),o}},_getHeightOfChar:function(t,e,i,n){return this.styles[i]&&this.styles[i][n]?this.styles[i][n].fontSize||this.fontSize:this.fontSize},_getWidthOfCharAt:function(t,e,i,n){n=n||this.text.split(this._reNewline);var r=n[e].split("")[i];return this._getWidthOfChar(t,r,e,i)},_getHeightOfCharAt:function(t,e,i,n){n=n||this.text.split(this._reNewline);var r=n[e].split("")[i];return this._getHeightOfChar(t,r,e,i)},_getWidthOfCharsAt:function(t,e,i,n){for(var r=0,s=0;i>s;s++)r+=this._getWidthOfCharAt(t,e,s,n);return r},_getWidthOfLine:function(t,e,i){return this._getWidthOfCharsAt(t,e,i[e].length,i)},_getTextWidth:function(t,e){if(this.isEmptyStyles())return this.callSuper("_getTextWidth",t,e);for(var i=this._getWidthOfLine(t,0,e),n=1,r=e.length;r>n;n++){var s=this._getWidthOfLine(t,n,e);s>i&&(i=s)}return i},_getHeightOfLine:function(t,e,i){i=i||this.text.split(this._reNewline);for(var n=this._getHeightOfChar(t,i[e][0],e,0),r=i[e],s=r.split(""),o=1,a=s.length;a>o;o++){var h=this._getHeightOfChar(t,s[o],e,o);h>n&&(n=h)}return n*this.lineHeight},_getTextHeight:function(t,e){for(var i=0,n=0,r=e.length;r>n;n++)i+=this._getHeightOfLine(t,n,e);return i},_getTopOffset:function(){var t=fabric.Text.prototype._getTopOffset.call(this);return t-this.fontSize/this._fontSizeFraction},_renderTextBoxBackground:function(t){this.backgroundColor&&(t.save(),t.fillStyle=this.backgroundColor,t.fillRect(this._getLeftOffset(),this._getTopOffset()+this.fontSize/this._fontSizeFraction,this.width,this.height),t.restore())},toObject:function(e){return fabric.util.object.extend(this.callSuper("toObject",e),{styles:t(this.styles)})}}),fabric.IText.fromObject=function(e){return new fabric.IText(e.text,t(e))},fabric.IText.instances=[]}(),function(){var t=fabric.util.object.clone;fabric.util.object.extend(fabric.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation()},initSelectedHandler:function(){this.on("selected",function(){var t=this;setTimeout(function(){t.selected=!0},100)})},initAddedHandler:function(){this.on("added",function(){this.canvas&&!this.canvas._hasITextHandlers&&(this.canvas._hasITextHandlers=!0,this._initCanvasHandlers())})},_initCanvasHandlers:function(){this.canvas.on("selection:cleared",function(){fabric.IText.prototype.exitEditingOnOthers.call()}),this.canvas.on("mouse:up",function(){fabric.IText.instances.forEach(function(t){t.__isMousedown=!1})}),this.canvas.on("object:selected",function(t){fabric.IText.prototype.exitEditingOnOthers.call(t.target)})},_tick:function(){if(!this._abortCursorAnimation){var t=this;this.animate("_currentCursorOpacity",1,{duration:this.cursorDuration,onComplete:function(){t._onTickComplete()},onChange:function(){t.canvas&&t.canvas.renderAll()},abort:function(){return t._abortCursorAnimation}})}},_onTickComplete:function(){if(!this._abortCursorAnimation){var t=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){t.animate("_currentCursorOpacity",0,{duration:this.cursorDuration/2,onComplete:function(){t._tick()},onChange:function(){t.canvas&&t.canvas.renderAll()},abort:function(){return t._abortCursorAnimation}})},100)}},initDelayedCursor:function(t){var e=this,i=t?0:this.cursorDelay;t&&(this._abortCursorAnimation=!0,clearTimeout(this._cursorTimeout1),this._currentCursorOpacity=1,this.canvas&&this.canvas.renderAll()),this._cursorTimeout2&&clearTimeout(this._cursorTimeout2),this._cursorTimeout2=setTimeout(function(){e._abortCursorAnimation=!1,e._tick()},i)},abortCursorAnimation:function(){this._abortCursorAnimation=!0,clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,this.canvas&&this.canvas.renderAll();var t=this;setTimeout(function(){t._abortCursorAnimation=!1},10)},selectAll:function(){this.selectionStart=0,this.selectionEnd=this.text.length,this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},getSelectedText:function(){return this.text.slice(this.selectionStart,this.selectionEnd)},findWordBoundaryLeft:function(t){var e=0,i=t-1;if(this._reSpace.test(this.text.charAt(i)))for(;this._reSpace.test(this.text.charAt(i));)e++,i--;for(;/\S/.test(this.text.charAt(i))&&i>-1;)e++,i--;return t-e},findWordBoundaryRight:function(t){var e=0,i=t;if(this._reSpace.test(this.text.charAt(i)))for(;this._reSpace.test(this.text.charAt(i));)e++,i++;for(;/\S/.test(this.text.charAt(i))&&i<this.text.length;)e++,i++;return t+e},findLineBoundaryLeft:function(t){for(var e=0,i=t-1;!/\n/.test(this.text.charAt(i))&&i>-1;)e++,i--;return t-e},findLineBoundaryRight:function(t){for(var e=0,i=t;!/\n/.test(this.text.charAt(i))&&i<this.text.length;)e++,i++;return t+e},getNumNewLinesInSelectedText:function(){for(var t=this.getSelectedText(),e=0,i=0,n=t.split(""),r=n.length;r>i;i++)"\n"===n[i]&&e++;return e},searchWordBoundary:function(t,e){for(var i=this._reSpace.test(this.text.charAt(t))?t-1:t,n=this.text.charAt(i),r=/[ \n\.,;!\?\-]/;!r.test(n)&&i>0&&i<this.text.length;)i+=e,n=this.text.charAt(i);return r.test(n)&&"\n"!==n&&(i+=1===e?0:1),i},selectWord:function(t){var e=this.searchWordBoundary(t,-1),i=this.searchWordBoundary(t,1);this.setSelectionStart(e),this.setSelectionEnd(i),this.initDelayedCursor(!0)},selectLine:function(t){var e=this.findLineBoundaryLeft(t),i=this.findLineBoundaryRight(t);this.setSelectionStart(e),this.setSelectionEnd(i),this.initDelayedCursor(!0)},enterEditing:function(){return!this.isEditing&&this.editable?(this.exitEditingOnOthers(),this.isEditing=!0,this.initHiddenTextarea(),this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._tick(),this.canvas&&this.canvas.renderAll(),this.fire("editing:entered"),this.canvas&&this.canvas.fire("text:editing:entered",{target:this}),this):void 0},exitEditingOnOthers:function(){fabric.IText.instances.forEach(function(t){t.selected=!1,t.isEditing&&t.exitEditing()},this)},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},_updateTextarea:function(){this.hiddenTextarea&&(this.hiddenTextarea.value=this.text,this.hiddenTextarea.selectionStart=this.selectionStart)},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.overCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){return this.selected=!1,this.isEditing=!1,this.selectable=!0,this.selectionEnd=this.selectionStart,this.hiddenTextarea&&this.canvas&&this.hiddenTextarea.parentNode.removeChild(this.hiddenTextarea),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this.fire("editing:exited"),this.canvas&&this.canvas.fire("text:editing:exited",{target:this}),this},_removeExtraneousStyles:function(){var t=this.text.split(this._reNewline);for(var e in this.styles)t[e]||delete this.styles[e]},_removeCharsFromTo:function(t,e){for(var i=e;i!==t;){var n=this.get2DCursorLocation(i).charIndex;i--;var r=this.get2DCursorLocation(i).charIndex,s=r>n;s?this.removeStyleObject(s,i+1):this.removeStyleObject(0===this.get2DCursorLocation(i).charIndex,i)}this.text=this.text.slice(0,t)+this.text.slice(e)},insertChars:function(t){var e="\n"===this.text.slice(this.selectionStart,this.selectionStart+1);this.text=this.text.slice(0,this.selectionStart)+t+this.text.slice(this.selectionEnd),this.selectionStart===this.selectionEnd&&this.insertStyleObjects(t,e,this.copiedStyles),this.selectionStart+=t.length,this.selectionEnd=this.selectionStart,this.canvas&&this.canvas.renderAll().renderAll(),this.setCoords(),this.fire("changed"),this.canvas&&this.canvas.fire("text:changed",{target:this})},insertNewlineStyleObject:function(e,i,n){this.shiftLineStyles(e,1),this.styles[e+1]||(this.styles[e+1]={});var r=this.styles[e][i-1],s={};if(n)s[0]=t(r),this.styles[e+1]=s;else{for(var o in this.styles[e])parseInt(o,10)>=i&&(s[parseInt(o,10)-i]=this.styles[e][o],delete this.styles[e][o]);this.styles[e+1]=s}},insertCharStyleObject:function(e,i,n){var r=this.styles[e],s=t(r);0===i&&!n&&(i=1);for(var o in s){var a=parseInt(o,10);a>=i&&(r[a+1]=s[a])}this.styles[e][i]=n||t(r[i-1])},insertStyleObjects:function(t,e,i){if(!this.isEmptyStyles()){var n=this.get2DCursorLocation(),r=n.lineIndex,s=n.charIndex;this.styles[r]||(this.styles[r]={}),"\n"===t?this.insertNewlineStyleObject(r,s,e):i?this._insertStyles(i):this.insertCharStyleObject(r,s)}},_insertStyles:function(t){for(var e=0,i=t.length;i>e;e++){var n=this.get2DCursorLocation(this.selectionStart+e),r=n.lineIndex,s=n.charIndex;this.insertCharStyleObject(r,s,t[e])}},shiftLineStyles:function(e,i){var n=t(this.styles);for(var r in this.styles){var s=parseInt(r,10);s>e&&(this.styles[s+i]=n[s])}},removeStyleObject:function(e,i){var n=this.get2DCursorLocation(i),r=n.lineIndex,s=n.charIndex;if(e){var o=this.text.split(this._reNewline),a=o[r-1],h=a?a.length:0;this.styles[r-1]||(this.styles[r-1]={});for(s in this.styles[r])this.styles[r-1][parseInt(s,10)+h]=this.styles[r][s];this.shiftLineStyles(r,-1)}else{var l=this.styles[r];if(l){var c=this.selectionStart===this.selectionEnd?-1:0;delete l[s+c]}var u=t(l);for(var f in u){var d=parseInt(f,10);d>=s&&0!==d&&(l[d-1]=u[d],delete l[d])}}},insertNewline:function(){this.insertChars("\n")}})}(),fabric.util.object.extend(fabric.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown.bind(this))},onMouseDown:function(t){this.__newClickTime=+new Date;var e=this.canvas.getPointer(t.e);this.isTripleClick(e)?(this.fire("tripleclick",t),this._stopEvent(t.e)):this.isDoubleClick(e)&&(this.fire("dblclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected},isDoubleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y&&this.__lastIsEditing},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initSelectedHandler(),this.initMousedownHandler(),this.initMousemoveHandler(),this.initMouseupHandler(),this.initClicks()},initClicks:function(){this.on("dblclick",function(t){this.selectWord(this.getSelectionStartFromPointer(t.e))}),this.on("tripleclick",function(t){this.selectLine(this.getSelectionStartFromPointer(t.e))})},initMousedownHandler:function(){this.on("mousedown",function(t){var e=this.canvas.getPointer(t.e);this.__mousedownX=e.x,this.__mousedownY=e.y,this.__isMousedown=!0,this.hiddenTextarea&&this.canvas&&this.canvas.wrapperEl.appendChild(this.hiddenTextarea),this.selected&&this.setCursorByClick(t.e),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.initDelayedCursor(!0))})},initMousemoveHandler:function(){this.on("mousemove",function(t){if(this.__isMousedown&&this.isEditing){var e=this.getSelectionStartFromPointer(t.e);e>=this.__selectionStartOnMouseDown?(this.setSelectionStart(this.__selectionStartOnMouseDown),this.setSelectionEnd(e)):(this.setSelectionStart(e),this.setSelectionEnd(this.__selectionStartOnMouseDown))}})},_isObjectMoved:function(t){var e=this.canvas.getPointer(t);return this.__mousedownX!==e.x||this.__mousedownY!==e.y},initMouseupHandler:function(){this.on("mouseup",function(t){this.__isMousedown=!1,this._isObjectMoved(t.e)||(this.__lastSelected&&(this.enterEditing(),this.initDelayedCursor(!0)),this.selected=!0)})},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t);t.shiftKey?e<this.selectionStart?(this.setSelectionEnd(this.selectionStart),this.setSelectionStart(e)):this.setSelectionEnd(e):(this.setSelectionStart(e),this.setSelectionEnd(e))},_getLocalRotatedPointer:function(t){var e=this.canvas.getPointer(t),i=new fabric.Point(e.x,e.y),n=new fabric.Point(this.left,this.top),r=fabric.util.rotatePoint(i,n,fabric.util.degreesToRadians(-this.angle));return this.getLocalPointer(t,r)},getSelectionStartFromPointer:function(t){for(var e,i=this._getLocalRotatedPointer(t),n=this.text.split(this._reNewline),r=0,s=0,o=0,a=0,h=0,l=n.length;l>h;h++){o+=this._getHeightOfLine(this.ctx,h)*this.scaleY;var c=this._getWidthOfLine(this.ctx,h,n),u=this._getLineLeftOffset(c);s=u*this.scaleX,this.flipX&&(n[h]=n[h].split("").reverse().join(""));for(var f=0,d=n[h].length;d>f;f++){var p=n[h][f];r=s,s+=this._getWidthOfChar(this.ctx,p,h,this.flipX?d-f:f)*this.scaleX;{if(!(o<=i.y||s<=i.x))return this._getNewSelectionStartFromOffset(i,r,s,a+h,d);a++}}if(i.y<o)return this._getNewSelectionStartFromOffset(i,r,s,a+h,d)}return"undefined"==typeof e?this.text.length:void 0},_getNewSelectionStartFromOffset:function(t,e,i,n,r){var s=t.x-e,o=i-t.x,a=o>s?0:1,h=n+a;return this.flipX&&(h=r-h),h>this.text.length&&(h=this.text.length),h}}),fabric.util.object.extend(fabric.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=fabric.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.style.cssText="position: absolute; top: 0; left: -9999px",fabric.document.body.appendChild(this.hiddenTextarea),fabric.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),fabric.util.addListener(this.hiddenTextarea,"keypress",this.onKeyPress.bind(this)),fabric.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),fabric.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(fabric.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},_keysMap:{8:"removeChars",13:"insertNewline",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown",46:"forwardDelete"},_ctrlKeysMap:{65:"selectAll",88:"cut"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(t){if(this.isEditing){if(t.keyCode in this._keysMap&&0===t.charCode)this[this._keysMap[t.keyCode]](t);else{if(!(t.keyCode in this._ctrlKeysMap&&(t.ctrlKey||t.metaKey)))return;this[this._ctrlKeysMap[t.keyCode]](t)}t.stopPropagation(),this.canvas&&this.canvas.renderAll()}},forwardDelete:function(t){this.selectionStart===this.selectionEnd&&this.moveCursorRight(t),this.removeChars(t)},copy:function(t){var e=this.getSelectedText(),i=this._getClipboardData(t);i&&i.setData("text",e),this.copiedText=e,this.copiedStyles=this.getSelectionStyles(this.selectionStart,this.selectionEnd)},paste:function(t){var e=null,i=this._getClipboardData(t);e=i?i.getData("text"):this.copiedText,e&&this.insertChars(e)},cut:function(t){this.selectionStart!==this.selectionEnd&&(this.copy(),this.removeChars(t))},_getClipboardData:function(t){return t&&(t.clipboardData||fabric.window.clipboardData)},onKeyPress:function(t){!this.isEditing||t.metaKey||t.ctrlKey||t.keyCode in this._keysMap&&0===t.charCode||(this.insertChars(String.fromCharCode(t.which)),t.stopPropagation())},getDownCursorOffset:function(t,e){var i,n,r=e?this.selectionEnd:this.selectionStart,s=this.text.split(this._reNewline),o=this.text.slice(0,r),a=this.text.slice(r),h=o.slice(o.lastIndexOf("\n")+1),l=a.match(/(.*)\n?/)[1],c=(a.match(/.*\n(.*)\n?/)||{})[1]||"",u=this.get2DCursorLocation(r);if(u.lineIndex===s.length-1||t.metaKey)return this.text.length-r;var f=this._getWidthOfLine(this.ctx,u.lineIndex,s);n=this._getLineLeftOffset(f);for(var d=n,p=u.lineIndex,g=0,v=h.length;v>g;g++)i=h[g],d+=this._getWidthOfChar(this.ctx,i,p,g);var m=this._getIndexOnNextLine(u,c,d,s);return l.length+1+m},_getIndexOnNextLine:function(t,e,i,n){for(var r,s=t.lineIndex+1,o=this._getWidthOfLine(this.ctx,s,n),a=this._getLineLeftOffset(o),h=a,l=0,c=0,u=e.length;u>c;c++){var f=e[c],d=this._getWidthOfChar(this.ctx,f,s,c);if(h+=d,h>i){r=!0;var p=h-d,g=h,v=Math.abs(p-i),m=Math.abs(g-i);l=v>m?c+1:c;break}}return r||(l=e.length),l},moveCursorDown:function(t){this.abortCursorAnimation(),this._currentCursorOpacity=1;var e=this.getDownCursorOffset(t,"right"===this._selectionDirection);t.shiftKey?this.moveCursorDownWithShift(e):this.moveCursorDownWithoutShift(e),this.initDelayedCursor()},moveCursorDownWithoutShift:function(t){this._selectionDirection="right",this.selectionStart+=t,this.selectionStart>this.text.length&&(this.selectionStart=this.text.length),this.selectionEnd=this.selectionStart},moveCursorDownWithShift:function(t){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?(this.selectionStart+=t,void(this._selectionDirection="left")):(this._selectionDirection="right",this.selectionEnd+=t,this.selectionEnd>this.text.length&&(this.selectionEnd=this.text.length),void 0)},getUpCursorOffset:function(t,e){var i=e?this.selectionEnd:this.selectionStart,n=this.get2DCursorLocation(i);if(0===n.lineIndex||t.metaKey)return i;for(var r,s=this.text.slice(0,i),o=s.slice(s.lastIndexOf("\n")+1),a=(s.match(/\n?(.*)\n.*$/)||{})[1]||"",h=this.text.split(this._reNewline),l=this._getWidthOfLine(this.ctx,n.lineIndex,h),c=this._getLineLeftOffset(l),u=c,f=n.lineIndex,d=0,p=o.length;p>d;d++)r=o[d],u+=this._getWidthOfChar(this.ctx,r,f,d);var g=this._getIndexOnPrevLine(n,a,u,h);return a.length-g+o.length},_getIndexOnPrevLine:function(t,e,i,n){for(var r,s=t.lineIndex-1,o=this._getWidthOfLine(this.ctx,s,n),a=this._getLineLeftOffset(o),h=a,l=0,c=0,u=e.length;u>c;c++){var f=e[c],d=this._getWidthOfChar(this.ctx,f,s,c);if(h+=d,h>i){r=!0;var p=h-d,g=h,v=Math.abs(p-i),m=Math.abs(g-i);l=v>m?c:c-1;break}}return r||(l=e.length-1),l},moveCursorUp:function(t){this.abortCursorAnimation(),this._currentCursorOpacity=1;var e=this.getUpCursorOffset(t,"right"===this._selectionDirection);t.shiftKey?this.moveCursorUpWithShift(e):this.moveCursorUpWithoutShift(e),this.initDelayedCursor()},moveCursorUpWithShift:function(t){if(this.selectionStart===this.selectionEnd)this.selectionStart-=t;else{if("right"===this._selectionDirection)return this.selectionEnd-=t,void(this._selectionDirection="right");this.selectionStart-=t}this.selectionStart<0&&(this.selectionStart=0),this._selectionDirection="left"},moveCursorUpWithoutShift:function(t){this.selectionStart===this.selectionEnd&&(this.selectionStart-=t),this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd=this.selectionStart,this._selectionDirection="left"},moveCursorLeft:function(t){(0!==this.selectionStart||0!==this.selectionEnd)&&(this.abortCursorAnimation(),this._currentCursorOpacity=1,t.shiftKey?this.moveCursorLeftWithShift(t):this.moveCursorLeftWithoutShift(t),this.initDelayedCursor())},_move:function(t,e,i){t.altKey?this[e]=this["findWordBoundary"+i](this[e]):t.metaKey?this[e]=this["findLineBoundary"+i](this[e]):this[e]+="Left"===i?-1:1},_moveLeft:function(t,e){this._move(t,e,"Left")},_moveRight:function(t,e){this._move(t,e,"Right")},moveCursorLeftWithoutShift:function(t){this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this._moveLeft(t,"selectionStart"),this.selectionEnd=this.selectionStart},moveCursorLeftWithShift:function(t){"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):(this._selectionDirection="left",this._moveLeft(t,"selectionStart"),"\n"===this.text.charAt(this.selectionStart)&&this.selectionStart--,this.selectionStart<0&&(this.selectionStart=0))},moveCursorRight:function(t){this.selectionStart>=this.text.length&&this.selectionEnd>=this.text.length||(this.abortCursorAnimation(),this._currentCursorOpacity=1,t.shiftKey?this.moveCursorRightWithShift(t):this.moveCursorRightWithoutShift(t),this.initDelayedCursor())},moveCursorRightWithShift:function(t){"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):(this._selectionDirection="right",this._moveRight(t,"selectionEnd"),"\n"===this.text.charAt(this.selectionEnd-1)&&this.selectionEnd++,this.selectionEnd>this.text.length&&(this.selectionEnd=this.text.length))},moveCursorRightWithoutShift:function(t){this._selectionDirection="right",this.selectionStart===this.selectionEnd?(this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):(this.selectionEnd+=this.getNumNewLinesInSelectedText(),this.selectionEnd>this.text.length&&(this.selectionEnd=this.text.length),this.selectionStart=this.selectionEnd)},removeChars:function(t){this.selectionStart===this.selectionEnd?this._removeCharsNearCursor(t):this._removeCharsFromTo(this.selectionStart,this.selectionEnd),this.selectionEnd=this.selectionStart,this._removeExtraneousStyles(),this.canvas&&this.canvas.renderAll().renderAll(),this.setCoords(),this.fire("changed"),this.canvas&&this.canvas.fire("text:changed",{target:this})},_removeCharsNearCursor:function(t){if(0!==this.selectionStart)if(t.metaKey){var e=this.findLineBoundaryLeft(this.selectionStart);this._removeCharsFromTo(e,this.selectionStart),this.selectionStart=e}else if(t.altKey){var i=this.findWordBoundaryLeft(this.selectionStart);this._removeCharsFromTo(i,this.selectionStart),this.selectionStart=i}else{var n="\n"===this.text.slice(this.selectionStart-1,this.selectionStart);this.removeStyleObject(n),this.selectionStart--,this.text=this.text.slice(0,this.selectionStart)+this.text.slice(this.selectionStart+1)}}}),fabric.util.object.extend(fabric.IText.prototype,{_setSVGTextLineText:function(t,e,i,n,r,s){this.styles[e]?this._setSVGTextLineChars(t,e,i,n,r,s):this.callSuper("_setSVGTextLineText",t,e,i,n,r)},_setSVGTextLineChars:function(t,e,i,n,r,s){for(var o=0===e||this.useNative?"y":"dy",a=t.split(""),h=0,l=this._getSVGLineLeftOffset(e),c=this._getSVGLineTopOffset(e),u=this._getHeightOfLine(this.ctx,e),f=0,d=a.length;d>f;f++){var p=this.styles[e][f]||{};i.push(this._createTextCharSpan(a[f],p,l,c,o,h));var g=this._getWidthOfChar(this.ctx,a[f],e,f);p.textBackgroundColor&&s.push(this._createTextCharBg(p,l,c,u,g,h)),h+=g}},_getSVGLineLeftOffset:function(t){return this._boundaries&&this._boundaries[t]?fabric.util.toFixed(this._boundaries[t].left,2):0},_getSVGLineTopOffset:function(t){for(var e=0,i=0;t>=i;i++)e+=this._getHeightOfLine(this.ctx,i);return e-this.height/2},_createTextCharBg:function(t,e,i,n,r,s){return['<rect fill="',t.textBackgroundColor,'" transform="translate(',-this.width/2," ",-this.height+n,")",'" x="',e+s,'" y="',i+n,'" width="',r,'" height="',n,'"></rect>'].join("")},_createTextCharSpan:function(t,e,i,n,r,s){var o=this.getSvgStyles.call(fabric.util.object.extend({visible:!0,fill:this.fill,stroke:this.stroke,type:"text"},e));return['<tspan x="',i+s,'" ',r,'="',n,'" ',e.fontFamily?'font-family="'+e.fontFamily.replace(/"/g,"'")+'" ':"",e.fontSize?'font-size="'+e.fontSize+'" ':"",e.fontStyle?'font-style="'+e.fontStyle+'" ':"",e.fontWeight?'font-weight="'+e.fontWeight+'" ':"",e.textDecoration?'text-decoration="'+e.textDecoration+'" ':"",'style="',o,'">',fabric.util.string.escapeXml(t),"</tspan>"].join("")}}),function(){function request(t,e,i){var n=URL.parse(t);n.port||(n.port=0===n.protocol.indexOf("https:")?443:80);var r=443===n.port?HTTPS:HTTP,s=r.request({hostname:n.hostname,port:n.port,path:n.path,method:"GET"},function(t){var n="";e&&t.setEncoding(e),t.on("end",function(){i(n)}),t.on("data",function(e){200===t.statusCode&&(n+=e)})});s.on("error",function(t){fabric.log(t.errno===process.ECONNREFUSED?"ECONNREFUSED: connection refused to "+n.hostname+":"+n.port:t.message)}),s.end()}function requestFs(t,e){var i=require("fs");i.readFile(t,function(t,i){if(t)throw fabric.log(t),t;e(i)})}if("undefined"==typeof document||"undefined"==typeof window){var DOMParser=require("xmldom").DOMParser,URL=require("url"),HTTP=require("http"),HTTPS=require("https"),Canvas=require("canvas"),Image=require("canvas").Image;fabric.util.loadImage=function(t,e,i){function n(n){r.src=new Buffer(n,"binary"),r._src=t,e&&e.call(i,r)}var r=new Image;t&&(t instanceof Buffer||0===t.indexOf("data"))?(r.src=r._src=t,e&&e.call(i,r)):t&&0!==t.indexOf("http")?requestFs(t,n):t?request(t,"binary",n):e&&e.call(i,t)},fabric.loadSVGFromURL=function(t,e,i){t=t.replace(/^\n\s*/,"").replace(/\?.*$/,"").trim(),0!==t.indexOf("http")?requestFs(t,function(t){fabric.loadSVGFromString(t.toString(),e,i)}):request(t,"",function(t){fabric.loadSVGFromString(t,e,i)})},fabric.loadSVGFromString=function(t,e,i){var n=(new DOMParser).parseFromString(t);fabric.parseSVGDocument(n.documentElement,function(t,i){e&&e(t,i)},i)},fabric.util.getScript=function(url,callback){request(url,"",function(body){eval(body),callback&&callback()})},fabric.Image.fromObject=function(t,e){fabric.util.loadImage(t.src,function(i){var n=new fabric.Image(i);n._initConfig(t),n._initFilters(t,function(t){n.filters=t||[],e&&e(n)})})},fabric.createCanvasForNode=function(t,e,i,n){n=n||i;var r=fabric.document.createElement("canvas"),s=new Canvas(t||600,e||600,n);r.style={},r.width=s.width,r.height=s.height;var o=fabric.Canvas||fabric.StaticCanvas,a=new o(r,i);return a.contextContainer=s.getContext("2d"),a.nodeCanvas=s,a.Font=Canvas.Font,a},fabric.StaticCanvas.prototype.createPNGStream=function(){return this.nodeCanvas.createPNGStream()},fabric.StaticCanvas.prototype.createJPEGStream=function(t){return this.nodeCanvas.createJPEGStream(t)};var origSetWidth=fabric.StaticCanvas.prototype.setWidth;fabric.StaticCanvas.prototype.setWidth=function(t,e){return origSetWidth.call(this,t,e),this.nodeCanvas.width=t,this},fabric.Canvas&&(fabric.Canvas.prototype.setWidth=fabric.StaticCanvas.prototype.setWidth);var origSetHeight=fabric.StaticCanvas.prototype.setHeight;fabric.StaticCanvas.prototype.setHeight=function(t,e){return origSetHeight.call(this,t,e),this.nodeCanvas.height=t,this},fabric.Canvas&&(fabric.Canvas.prototype.setHeight=fabric.StaticCanvas.prototype.setHeight)}}(),!function(t){"use strict";function e(e,n){var r=arguments,e=r[0],n=r[1];[].shift.apply(r);var s,o=this.each(function(){var o=t(this);if(o.is("select")){var a=o.data("selectpicker"),h="object"==typeof e&&e;if(a){if(h)for(var l in h)h.hasOwnProperty(l)&&(a.options[l]=h[l])}else{var c=t.extend({},i.DEFAULTS,t.fn.selectpicker.defaults,o.data(),h);o.data("selectpicker",a=new i(this,c,n))}"string"==typeof e&&(s=a[e]instanceof Function?a[e].apply(a,r):a.options[e])}});return"undefined"!=typeof s?s:o}t.expr[":"].icontains=function(e,i,n){return t(e).text().toUpperCase().indexOf(n[3].toUpperCase())>=0};var i=function(e,n,r){r&&(r.stopPropagation(),r.preventDefault()),this.$element=t(e),this.$newElement=null,this.$button=null,this.$menu=null,this.$lis=null,this.options=n,null===this.options.title&&(this.options.title=this.$element.attr("title")),this.val=i.prototype.val,this.render=i.prototype.render,this.refresh=i.prototype.refresh,this.setStyle=i.prototype.setStyle,this.selectAll=i.prototype.selectAll,this.deselectAll=i.prototype.deselectAll,this.destroy=i.prototype.remove,this.remove=i.prototype.remove,this.show=i.prototype.show,this.hide=i.prototype.hide,this.init()};i.VERSION="1.6.2",i.DEFAULTS={noneSelectedText:"Nothing selected",noneResultsText:"No results match",countSelectedText:"{0} of {1} selected",maxOptionsText:["Limit reached ({n} {var} max)","Group limit reached ({n} {var} max)",["items","item"]],multipleSeparator:", ",style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",width:!1,container:!1,hideDisabled:!1,showSubtext:!1,showIcon:!0,showContent:!0,dropupAuto:!0,header:!1,liveSearch:!1,actionsBox:!1,iconBase:"glyphicon",tickIcon:"glyphicon-ok",maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1},i.prototype={constructor:i,init:function(){var e=this,i=this.$element.attr("id");this.$element.hide(),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),this.$newElement=this.createView(),this.$element.after(this.$newElement),this.$menu=this.$newElement.find("> .dropdown-menu"),this.$button=this.$newElement.find("> button"),this.$searchbox=this.$newElement.find("input"),this.options.dropdownAlignRight&&this.$menu.addClass("pull-right"),"undefined"!=typeof i&&(this.$button.attr("data-id",i),t('label[for="'+i+'"]').click(function(t){t.preventDefault(),e.$button.focus()
|
|
})),this.checkDisabled(),this.clickListener(),this.options.liveSearch&&this.liveSearchListener(),this.render(),this.liHeight(),this.setStyle(),this.setWidth(),this.options.container&&this.selectPosition(),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile()},createDropdown:function(){var e=this.multiple?" show-tick":"",i=this.$element.parent().hasClass("input-group")?" input-group-btn":"",n=this.autofocus?" autofocus":"",r=this.options.header?'<div class="popover-title"><button type="button" class="close" aria-hidden="true">×</button>'+this.options.header+"</div>":"",s=this.options.liveSearch?'<div class="bootstrap-select-searchbox"><input type="text" class="input-block-level form-control" autocomplete="off" /></div>':"",o=this.options.actionsBox?'<div class="bs-actionsbox"><div class="btn-group btn-block"><button class="actions-btn bs-select-all btn btn-sm btn-default">Select All</button><button class="actions-btn bs-deselect-all btn btn-sm btn-default">Deselect All</button></div></div>':"",a='<div class="btn-group bootstrap-select'+e+i+'"><button type="button" class="btn dropdown-toggle selectpicker" data-toggle="dropdown"'+n+'><span class="filter-option pull-left"></span> <span class="caret"></span></button><div class="dropdown-menu open">'+r+s+o+'<ul class="dropdown-menu inner selectpicker" role="menu"></ul></div></div>';return t(a)},createView:function(){var t=this.createDropdown(),e=this.createLi();return t.find("ul").append(e),t},reloadLi:function(){this.destroyLi();var t=this.createLi();this.$menu.find("ul").append(t)},destroyLi:function(){this.$menu.find("li").remove()},createLi:function(){var e=this,i=[],n="",r=0;return this.$element.find("option").each(function(){var n=t(this),s=n.attr("class")||"",o=n.attr("style")||"",a=n.data("content")?n.data("content"):n.html(),h="undefined"!=typeof n.data("subtext")?'<small class="muted text-muted">'+n.data("subtext")+"</small>":"",l="undefined"!=typeof n.data("icon")?'<i class="'+e.options.iconBase+" "+n.data("icon")+'"></i> ':"";if(""!==l&&(n.is(":disabled")||n.parent().is(":disabled"))&&(l="<span>"+l+"</span>"),n.data("content")||(a=l+'<span class="text">'+a+h+"</span>"),e.options.hideDisabled&&(n.is(":disabled")||n.parent().is(":disabled")))i.push('<a style="min-height: 0; padding: 0"></a>');else if(n.parent().is("optgroup")&&n.data("divider")!==!0)if(0===n.index()){var c=n.parent().attr("label"),u="undefined"!=typeof n.parent().data("subtext")?'<small class="muted text-muted">'+n.parent().data("subtext")+"</small>":"",f=n.parent().data("icon")?'<i class="'+e.options.iconBase+" "+n.parent().data("icon")+'"></i> ':"";c=f+'<span class="text">'+c+u+"</span>",r+=1,i.push(0!==n[0].index?'<div class="div-contain"><div class="divider"></div></div><dt>'+c+"</dt>"+e.createA(a,"opt "+s,o,r):"<dt>"+c+"</dt>"+e.createA(a,"opt "+s,o,r))}else i.push(e.createA(a,"opt "+s,o,r));else i.push(n.data("divider")===!0?'<div class="div-contain"><div class="divider"></div></div>':t(this).data("hidden")===!0?"<a></a>":e.createA(a,s,o))}),t.each(i,function(t,e){var i="<a></a>"===e?'class="hide is-hidden"':"";n+='<li rel="'+t+'"'+i+">"+e+"</li>"}),this.multiple||0!==this.$element.find("option:selected").length||this.options.title||this.$element.find("option").eq(0).prop("selected",!0).attr("selected","selected"),t(n)},createA:function(t,e,i,n){return'<a tabindex="0" class="'+e+'" style="'+i+'"'+("undefined"!=typeof n?'data-optgroup="'+n+'"':"")+">"+t+'<i class="'+this.options.iconBase+" "+this.options.tickIcon+' icon-ok check-mark"></i></a>'},render:function(e){var i=this;e!==!1&&this.$element.find("option").each(function(e){i.setDisabled(e,t(this).is(":disabled")||t(this).parent().is(":disabled")),i.setSelected(e,t(this).is(":selected"))}),this.tabIndex();var n=this.$element.find("option:selected").map(function(){var e,n=t(this),r=n.data("icon")&&i.options.showIcon?'<i class="'+i.options.iconBase+" "+n.data("icon")+'"></i> ':"";return e=i.options.showSubtext&&n.attr("data-subtext")&&!i.multiple?' <small class="muted text-muted">'+n.data("subtext")+"</small>":"",n.data("content")&&i.options.showContent?n.data("content"):"undefined"!=typeof n.attr("title")?n.attr("title"):r+n.html()+e}).toArray(),r=this.multiple?n.join(this.options.multipleSeparator):n[0];if(this.multiple&&this.options.selectedTextFormat.indexOf("count")>-1){var s=this.options.selectedTextFormat.split(">"),o=this.options.hideDisabled?":not([disabled])":"";(s.length>1&&n.length>s[1]||1==s.length&&n.length>=2)&&(r=this.options.countSelectedText.replace("{0}",n.length).replace("{1}",this.$element.find('option:not([data-divider="true"], [data-hidden="true"])'+o).length))}this.options.title=this.$element.attr("title"),"static"==this.options.selectedTextFormat&&(r=this.options.title),r||(r="undefined"!=typeof this.options.title?this.options.title:this.options.noneSelectedText),this.$button.attr("title",t.trim(t("<div/>").html(r).text()).replace(/\s\s+/g," ")),this.$newElement.find(".filter-option").html(r)},setStyle:function(t,e){this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|validate\[.*\]/gi,""));var i=t?t:this.options.style;"add"==e?this.$button.addClass(i):"remove"==e?this.$button.removeClass(i):(this.$button.removeClass(this.options.style),this.$button.addClass(i))},liHeight:function(){if(this.options.size!==!1){var t=this.$menu.parent().clone().find("> .dropdown-toggle").prop("autofocus",!1).end().appendTo("body"),e=t.addClass("open").find("> .dropdown-menu"),i=e.find("li > a").outerHeight(),n=this.options.header?e.find(".popover-title").outerHeight():0,r=this.options.liveSearch?e.find(".bootstrap-select-searchbox").outerHeight():0,s=this.options.actionsBox?e.find(".bs-actionsbox").outerHeight():0;t.remove(),this.$newElement.data("liHeight",i).data("headerHeight",n).data("searchHeight",r).data("actionsHeight",s)}},setSize:function(){var e,i,n,r=this,s=this.$menu,o=s.find(".inner"),a=this.$newElement.outerHeight(),h=this.$newElement.data("liHeight"),l=this.$newElement.data("headerHeight"),c=this.$newElement.data("searchHeight"),u=this.$newElement.data("actionsHeight"),f=s.find("li .divider").outerHeight(!0),d=parseInt(s.css("padding-top"))+parseInt(s.css("padding-bottom"))+parseInt(s.css("border-top-width"))+parseInt(s.css("border-bottom-width")),p=this.options.hideDisabled?":not(.disabled)":"",g=t(window),v=d+parseInt(s.css("margin-top"))+parseInt(s.css("margin-bottom"))+2,m=function(){i=r.$newElement.offset().top-g.scrollTop(),n=g.height()-i-a};if(m(),this.options.header&&s.css("padding-top",0),"auto"==this.options.size){var y=function(){var t,a=r.$lis.not(".hide");m(),e=n-v,r.options.dropupAuto&&r.$newElement.toggleClass("dropup",i>n&&e-v<s.height()),r.$newElement.hasClass("dropup")&&(e=i-v),t=a.length+a.find("dt").length>3?3*h+v-2:0,s.css({"max-height":e+"px",overflow:"hidden","min-height":t+l+c+u+"px"}),o.css({"max-height":e-l-c-u-d+"px","overflow-y":"auto","min-height":Math.max(t-d,0)+"px"})};y(),this.$searchbox.off("input.getSize propertychange.getSize").on("input.getSize propertychange.getSize",y),t(window).off("resize.getSize").on("resize.getSize",y),t(window).off("scroll.getSize").on("scroll.getSize",y)}else if(this.options.size&&"auto"!=this.options.size&&s.find("li"+p).length>this.options.size){var b=s.find("li"+p+" > *").not(".div-contain").slice(0,this.options.size).last().parent().index(),x=s.find("li").slice(0,b+1).find(".div-contain").length;e=h*this.options.size+x*f+d,r.options.dropupAuto&&this.$newElement.toggleClass("dropup",i>n&&e<s.height()),s.css({"max-height":e+l+c+u+"px",overflow:"hidden"}),o.css({"max-height":e-d+"px","overflow-y":"auto"})}},setWidth:function(){if("auto"==this.options.width){this.$menu.css("min-width","0");var t=this.$newElement.clone().appendTo("body"),e=t.find("> .dropdown-menu").css("width"),i=t.css("width","auto").find("> button").css("width");t.remove(),this.$newElement.css("width",Math.max(parseInt(e),parseInt(i))+"px")}else"fit"==this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width",""));this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement.removeClass("fit-width")},selectPosition:function(){var e,i,n=this,r="<div />",s=t(r),o=function(t){s.addClass(t.attr("class").replace(/form-control/gi,"")).toggleClass("dropup",t.hasClass("dropup")),e=t.offset(),i=t.hasClass("dropup")?0:t[0].offsetHeight,s.css({top:e.top+i,left:e.left,width:t[0].offsetWidth,position:"absolute"})};this.$newElement.on("click",function(){n.isDisabled()||(o(t(this)),s.appendTo(n.options.container),s.toggleClass("open",!t(this).hasClass("open")),s.append(n.$menu))}),t(window).resize(function(){o(n.$newElement)}),t(window).on("scroll",function(){o(n.$newElement)}),t("html").on("click",function(e){t(e.target).closest(n.$newElement).length<1&&s.removeClass("open")})},setSelected:function(e,i){null==this.$lis&&(this.$lis=this.$menu.find("li")),t(this.$lis[e]).toggleClass("selected",i)},setDisabled:function(e,i){null==this.$lis&&(this.$lis=this.$menu.find("li")),i?t(this.$lis[e]).addClass("disabled").find("a").attr("href","#").attr("tabindex",-1):t(this.$lis[e]).removeClass("disabled").find("a").removeAttr("href").attr("tabindex",0)},isDisabled:function(){return this.$element.is(":disabled")},checkDisabled:function(){var t=this;this.isDisabled()?this.$button.addClass("disabled").attr("tabindex",-1):(this.$button.hasClass("disabled")&&this.$button.removeClass("disabled"),-1==this.$button.attr("tabindex")&&(this.$element.data("tabindex")||this.$button.removeAttr("tabindex"))),this.$button.click(function(){return!t.isDisabled()})},tabIndex:function(){this.$element.is("[tabindex]")&&(this.$element.data("tabindex",this.$element.attr("tabindex")),this.$button.attr("tabindex",this.$element.data("tabindex")))},clickListener:function(){var e=this;this.$newElement.on("touchstart.dropdown",".dropdown-menu",function(t){t.stopPropagation()}),this.$newElement.on("click",function(){e.setSize(),e.options.liveSearch||e.multiple||setTimeout(function(){e.$menu.find(".selected a").focus()},10)}),this.$menu.on("click","li a",function(i){var n=t(this).parent().index(),r=e.$element.val(),s=e.$element.prop("selectedIndex");if(e.multiple&&i.stopPropagation(),i.preventDefault(),!e.isDisabled()&&!t(this).parent().hasClass("disabled")){var o=e.$element.find("option"),a=o.eq(n),h=a.prop("selected"),l=a.parent("optgroup"),c=e.options.maxOptions,u=l.data("maxOptions")||!1;if(e.multiple){if(a.prop("selected",!h),e.setSelected(n,!h),t(this).blur(),c!==!1||u!==!1){var f=c<o.filter(":selected").length,d=u<l.find("option:selected").length,p=e.options.maxOptionsText,g=p[0].replace("{n}",c),v=p[1].replace("{n}",u),m=t('<div class="notify"></div>');if(c&&f||u&&d)if(c&&1==c)o.prop("selected",!1),a.prop("selected",!0),e.$menu.find(".selected").removeClass("selected"),e.setSelected(n,!0);else if(u&&1==u){l.find("option:selected").prop("selected",!1),a.prop("selected",!0);var y=t(this).data("optgroup");e.$menu.find(".selected").has('a[data-optgroup="'+y+'"]').removeClass("selected"),e.setSelected(n,!0)}else p[2]&&(g=g.replace("{var}",p[2][c>1?0:1]),v=v.replace("{var}",p[2][u>1?0:1])),a.prop("selected",!1),e.$menu.append(m),c&&f&&(m.append(t("<div>"+g+"</div>")),e.$element.trigger("maxReached.bs.select")),u&&d&&(m.append(t("<div>"+v+"</div>")),e.$element.trigger("maxReachedGrp.bs.select")),setTimeout(function(){e.setSelected(n,!1)},10),m.delay(750).fadeOut(300,function(){t(this).remove()})}}else o.prop("selected",!1),a.prop("selected",!0),e.$menu.find(".selected").removeClass("selected"),e.setSelected(n,!0);e.multiple?e.options.liveSearch&&e.$searchbox.focus():e.$button.focus(),(r!=e.$element.val()&&e.multiple||s!=e.$element.prop("selectedIndex")&&!e.multiple)&&e.$element.change()}}),this.$menu.on("click","li.disabled a, li dt, li .div-contain, .popover-title, .popover-title :not(.close)",function(t){t.target==this&&(t.preventDefault(),t.stopPropagation(),e.options.liveSearch?e.$searchbox.focus():e.$button.focus())}),this.$menu.on("click",".popover-title .close",function(){e.$button.focus()}),this.$searchbox.on("click",function(t){t.stopPropagation()}),this.$menu.on("click",".actions-btn",function(i){e.options.liveSearch?e.$searchbox.focus():e.$button.focus(),i.preventDefault(),i.stopPropagation(),t(this).is(".bs-select-all")?e.selectAll():e.deselectAll(),e.$element.change()}),this.$element.change(function(){e.render(!1)})},liveSearchListener:function(){var e=this,i=t('<li class="no-results"></li>');this.$newElement.on("click.dropdown.data-api",function(){e.$menu.find(".active").removeClass("active"),e.$searchbox.val()&&(e.$searchbox.val(""),e.$lis.not(".is-hidden").removeClass("hide"),i.parent().length&&i.remove()),e.multiple||e.$menu.find(".selected").addClass("active"),setTimeout(function(){e.$searchbox.focus()},10)}),this.$searchbox.on("input propertychange",function(){e.$searchbox.val()?(e.$lis.not(".is-hidden").removeClass("hide").find("a").not(":icontains("+e.$searchbox.val()+")").parent().addClass("hide"),e.$menu.find("li").filter(":visible:not(.no-results)").length?i.parent().length&&i.remove():(i.parent().length&&i.remove(),i.html(e.options.noneResultsText+' "'+e.$searchbox.val()+'"').show(),e.$menu.find("li").last().after(i))):(e.$lis.not(".is-hidden").removeClass("hide"),i.parent().length&&i.remove()),e.$menu.find("li.active").removeClass("active"),e.$menu.find("li").filter(":visible:not(.divider)").eq(0).addClass("active").find("a").focus(),t(this).focus()}),this.$menu.on("mouseenter","a",function(i){e.$menu.find(".active").removeClass("active"),t(i.currentTarget).parent().not(".disabled").addClass("active")}),this.$menu.on("mouseleave","a",function(){e.$menu.find(".active").removeClass("active")})},val:function(t){return"undefined"!=typeof t?(this.$element.val(t),this.render(),this.$element):this.$element.val()},selectAll:function(){null==this.$lis&&(this.$lis=this.$menu.find("li")),this.$element.find("option:enabled").prop("selected",!0),t(this.$lis).not(".disabled").addClass("selected"),this.render(!1)},deselectAll:function(){null==this.$lis&&(this.$lis=this.$menu.find("li")),this.$element.find("option:enabled").prop("selected",!1),t(this.$lis).not(".disabled").removeClass("selected"),this.render(!1)},keydown:function(e){var i,n,r,s,o,a,h,l,c,u,f,d,p={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"};if(i=t(this),r=i.parent(),i.is("input")&&(r=i.parent().parent()),u=r.data("this"),u.options.liveSearch&&(r=i.parent().parent()),u.options.container&&(r=u.$menu),n=t("[role=menu] li:not(.divider) a",r),d=u.$menu.parent().hasClass("open"),!d&&/([0-9]|[A-z])/.test(String.fromCharCode(e.keyCode))&&(u.options.container?u.$newElement.trigger("click"):(u.setSize(),u.$menu.parent().addClass("open"),d=!0),u.$searchbox.focus()),u.options.liveSearch&&(/(^9$|27)/.test(e.keyCode.toString(10))&&d&&0===u.$menu.find(".active").length&&(e.preventDefault(),u.$menu.parent().removeClass("open"),u.$button.focus()),n=t("[role=menu] li:not(.divider):visible",r),i.val()||/(38|40)/.test(e.keyCode.toString(10))||0===n.filter(".active").length&&(n=u.$newElement.find("li").filter(":icontains("+p[e.keyCode]+")"))),n.length){if(/(38|40)/.test(e.keyCode.toString(10)))s=n.index(n.filter(":focus")),a=n.parent(":not(.disabled):visible").first().index(),h=n.parent(":not(.disabled):visible").last().index(),o=n.eq(s).parent().nextAll(":not(.disabled):visible").eq(0).index(),l=n.eq(s).parent().prevAll(":not(.disabled):visible").eq(0).index(),c=n.eq(o).parent().prevAll(":not(.disabled):visible").eq(0).index(),u.options.liveSearch&&(n.each(function(e){t(this).is(":not(.disabled)")&&t(this).data("index",e)}),s=n.index(n.filter(".active")),a=n.filter(":not(.disabled):visible").first().data("index"),h=n.filter(":not(.disabled):visible").last().data("index"),o=n.eq(s).nextAll(":not(.disabled):visible").eq(0).data("index"),l=n.eq(s).prevAll(":not(.disabled):visible").eq(0).data("index"),c=n.eq(o).prevAll(":not(.disabled):visible").eq(0).data("index")),f=i.data("prevIndex"),38==e.keyCode&&(u.options.liveSearch&&(s-=1),s!=c&&s>l&&(s=l),a>s&&(s=a),s==f&&(s=h)),40==e.keyCode&&(u.options.liveSearch&&(s+=1),-1==s&&(s=0),s!=c&&o>s&&(s=o),s>h&&(s=h),s==f&&(s=a)),i.data("prevIndex",s),u.options.liveSearch?(e.preventDefault(),i.is(".dropdown-toggle")||(n.removeClass("active"),n.eq(s).addClass("active").find("a").focus(),i.focus())):n.eq(s).focus();else if(!i.is("input")){var g,v,m=[];n.each(function(){t(this).parent().is(":not(.disabled)")&&t.trim(t(this).text().toLowerCase()).substring(0,1)==p[e.keyCode]&&m.push(t(this).parent().index())}),g=t(document).data("keycount"),g++,t(document).data("keycount",g),v=t.trim(t(":focus").text().toLowerCase()).substring(0,1),v!=p[e.keyCode]?(g=1,t(document).data("keycount",g)):g>=m.length&&(t(document).data("keycount",0),g>m.length&&(g=1)),n.eq(m[g-1]).focus()}(/(13|32)/.test(e.keyCode.toString(10))||u.options.selectOnTab&&/(^9$)/.test(e.keyCode.toString(10)))&&d&&(/(32)/.test(e.keyCode.toString(10))||e.preventDefault(),u.options.liveSearch?/(32)/.test(e.keyCode.toString(10))||(u.$menu.find(".active a").click(),i.focus()):t(":focus").click(),t(document).data("keycount",0)),(/(^9$|27)/.test(e.keyCode.toString(10))&&d&&(u.multiple||u.options.liveSearch)||/(27)/.test(e.keyCode.toString(10))&&!d)&&(u.$menu.parent().removeClass("open"),u.$button.focus())}},mobile:function(){this.$element.addClass("mobile-device").appendTo(this.$newElement),this.options.container&&this.$menu.hide()},refresh:function(){this.$lis=null,this.reloadLi(),this.render(),this.setWidth(),this.setStyle(),this.checkDisabled(),this.liHeight()},update:function(){this.reloadLi(),this.setWidth(),this.setStyle(),this.checkDisabled(),this.liHeight()},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()}};var n=t.fn.selectpicker;t.fn.selectpicker=e,t.fn.selectpicker.Constructor=i,t.fn.selectpicker.noConflict=function(){return t.fn.selectpicker=n,this},t(document).data("keycount",0).on("keydown",".bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input",i.prototype.keydown).on("focusin.modal",".bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input",function(t){t.stopPropagation()})}(jQuery),function(){function t(t){var i={r:0,g:0,b:0},r=1,o=!1,a=!1;return"string"==typeof t&&(t=D(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(i=e(t.r,t.g,t.b),o=!0,a="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=A(t.s),t.v=A(t.v),i=s(t.h,t.s,t.v),o=!0,a="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=A(t.s),t.l=A(t.l),i=n(t.h,t.s,t.l),o=!0,a="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=w(r),{ok:o,format:t.format||a,r:$(255,F(i.r,0)),g:$(255,F(i.g,0)),b:$(255,F(i.b,0)),a:r}}function e(t,e,i){return{r:255*C(t,255),g:255*C(e,255),b:255*C(i,255)}}function i(t,e,i){t=C(t,255),e=C(e,255),i=C(i,255);var n,r,s=F(t,e,i),o=$(t,e,i),a=(s+o)/2;if(s==o)n=r=0;else{var h=s-o;switch(r=a>.5?h/(2-s-o):h/(s+o),s){case t:n=(e-i)/h+(i>e?6:0);break;case e:n=(i-t)/h+2;break;case i:n=(t-e)/h+4}n/=6}return{h:n,s:r,l:a}}function n(t,e,i){function n(t,e,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?t+6*(e-t)*i:.5>i?e:2/3>i?t+(e-t)*(2/3-i)*6:t}var r,s,o;if(t=C(t,360),e=C(e,100),i=C(i,100),0===e)r=s=o=i;else{var a=.5>i?i*(1+e):i+e-i*e,h=2*i-a;r=n(h,a,t+1/3),s=n(h,a,t),o=n(h,a,t-1/3)}return{r:255*r,g:255*s,b:255*o}}function r(t,e,i){t=C(t,255),e=C(e,255),i=C(i,255);var n,r,s=F(t,e,i),o=$(t,e,i),a=s,h=s-o;if(r=0===s?0:h/s,s==o)n=0;else{switch(s){case t:n=(e-i)/h+(i>e?6:0);break;case e:n=(i-t)/h+2;break;case i:n=(t-e)/h+4}n/=6}return{h:n,s:r,v:a}}function s(t,e,i){t=6*C(t,360),e=C(e,100),i=C(i,100);var n=N.floor(t),r=t-n,s=i*(1-e),o=i*(1-r*e),a=i*(1-(1-r)*e),h=n%6,l=[i,o,s,s,a,i][h],c=[a,i,i,o,s,s][h],u=[s,s,a,i,i,o][h];return{r:255*l,g:255*c,b:255*u}}function o(t,e,i,n){var r=[E(R(t).toString(16)),E(R(e).toString(16)),E(R(i).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function a(t,e,i,n){var r=[E(P(n)),E(R(t).toString(16)),E(R(e).toString(16)),E(R(i).toString(16))];return r.join("")}function h(t,e){e=0===e?0:e||10;var i=H(t).toHsl();return i.s-=e/100,i.s=S(i.s),H(i)}function l(t,e){e=0===e?0:e||10;var i=H(t).toHsl();return i.s+=e/100,i.s=S(i.s),H(i)}function c(t){return H(t).desaturate(100)}function u(t,e){e=0===e?0:e||10;var i=H(t).toHsl();return i.l+=e/100,i.l=S(i.l),H(i)}function f(t,e){e=0===e?0:e||10;var i=H(t).toRgb();return i.r=F(0,$(255,i.r-R(255*-(e/100)))),i.g=F(0,$(255,i.g-R(255*-(e/100)))),i.b=F(0,$(255,i.b-R(255*-(e/100)))),H(i)}function d(t,e){e=0===e?0:e||10;var i=H(t).toHsl();return i.l-=e/100,i.l=S(i.l),H(i)}function p(t,e){var i=H(t).toHsl(),n=(R(i.h)+e)%360;return i.h=0>n?360+n:n,H(i)}function g(t){var e=H(t).toHsl();return e.h=(e.h+180)%360,H(e)}function v(t){var e=H(t).toHsl(),i=e.h;return[H(t),H({h:(i+120)%360,s:e.s,l:e.l}),H({h:(i+240)%360,s:e.s,l:e.l})]}function m(t){var e=H(t).toHsl(),i=e.h;return[H(t),H({h:(i+90)%360,s:e.s,l:e.l}),H({h:(i+180)%360,s:e.s,l:e.l}),H({h:(i+270)%360,s:e.s,l:e.l})]}function y(t){var e=H(t).toHsl(),i=e.h;return[H(t),H({h:(i+72)%360,s:e.s,l:e.l}),H({h:(i+216)%360,s:e.s,l:e.l})]}function b(t,e,i){e=e||6,i=i||30;var n=H(t).toHsl(),r=360/i,s=[H(t)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(H(n));return s}function x(t,e){e=e||6;for(var i=H(t).toHsv(),n=i.h,r=i.s,s=i.v,o=[],a=1/e;e--;)o.push(H({h:n,s:r,v:s})),s=(s+a)%1;return o}function _(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}function w(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function C(t,e){k(t)&&(t="100%");var i=O(t);return t=$(e,F(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),N.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function S(t){return $(1,F(0,t))}function T(t){return parseInt(t,16)}function k(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function O(t){return"string"==typeof t&&-1!=t.indexOf("%")}function E(t){return 1==t.length?"0"+t:""+t}function A(t){return 1>=t&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function j(t){return T(t)/255}function D(t){t=t.replace(L,"").replace(I,"").toLowerCase();var e=!1;if(W[t])t=W[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=X.rgb.exec(t))?{r:i[1],g:i[2],b:i[3]}:(i=X.rgba.exec(t))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=X.hsl.exec(t))?{h:i[1],s:i[2],l:i[3]}:(i=X.hsla.exec(t))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=X.hsv.exec(t))?{h:i[1],s:i[2],v:i[3]}:(i=X.hex8.exec(t))?{a:j(i[1]),r:T(i[2]),g:T(i[3]),b:T(i[4]),format:e?"name":"hex8"}:(i=X.hex6.exec(t))?{r:T(i[1]),g:T(i[2]),b:T(i[3]),format:e?"name":"hex"}:(i=X.hex3.exec(t))?{r:T(i[1]+""+i[1]),g:T(i[2]+""+i[2]),b:T(i[3]+""+i[3]),format:e?"name":"hex"}:!1}var L=/^[\s,#]+/,I=/\s+$/,M=0,N=Math,R=N.round,$=N.min,F=N.max,B=N.random,H=function U(e,i){if(e=e?e:"",i=i||{},e instanceof U)return e;if(!(this instanceof U))return new U(e,i);var n=t(e);this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=R(100*this._a)/100,this._format=i.format||n.format,this._gradientType=i.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=n.ok,this._tc_id=M++};H.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},setAlpha:function(t){return this._a=w(t),this._roundA=R(100*this._a)/100,this},toHsv:function(){var t=r(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=r(this._r,this._g,this._b),e=R(360*t.h),i=R(100*t.s),n=R(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=R(360*t.h),n=R(100*t.s),r=R(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return o(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return a(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(100*C(this._r,255))+"%",g:R(100*C(this._g,255))+"%",b:R(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+R(100*C(this._r,255))+"%, "+R(100*C(this._g,255))+"%, "+R(100*C(this._b,255))+"%)":"rgba("+R(100*C(this._r,255))+"%, "+R(100*C(this._g,255))+"%, "+R(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:G[o(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var e="#"+a(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var r=H(t);i=r.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0,r=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return r?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),("hex"===t||"hex6"===t)&&(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(u,arguments)},brighten:function(){return this._applyModification(f,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(l,arguments)},greyscale:function(){return this._applyModification(c,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(b,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(v,arguments)},tetrad:function(){return this._applyCombination(m,arguments)}},H.fromRatio=function(t,e){if("object"==typeof t){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]="a"===n?t[n]:A(t[n]));t=i}return H(t,e)},H.equals=function(t,e){return t&&e?H(t).toRgbString()==H(e).toRgbString():!1},H.random=function(){return H.fromRatio({r:B(),g:B(),b:B()})},H.mix=function(t,e,i){i=0===i?0:i||50;var n,r=H(t).toRgb(),s=H(e).toRgb(),o=i/100,a=2*o-1,h=s.a-r.a;n=a*h==-1?a:(a+h)/(1+a*h),n=(n+1)/2;var l=1-n,c={r:s.r*n+r.r*l,g:s.g*n+r.g*l,b:s.b*n+r.b*l,a:s.a*o+r.a*(1-o)};return H(c)},H.readability=function(t,e){var i=H(t),n=H(e),r=i.toRgb(),s=n.toRgb(),o=i.getBrightness(),a=n.getBrightness(),h=Math.max(r.r,s.r)-Math.min(r.r,s.r)+Math.max(r.g,s.g)-Math.min(r.g,s.g)+Math.max(r.b,s.b)-Math.min(r.b,s.b);return{brightness:Math.abs(o-a),color:h}},H.isReadable=function(t,e){var i=H.readability(t,e);return i.brightness>125&&i.color>500},H.mostReadable=function(t,e){for(var i=null,n=0,r=!1,s=0;s<e.length;s++){var o=H.readability(t,e[s]),a=o.brightness>125&&o.color>500,h=3*(o.brightness/125)+o.color/500;(a&&!r||a&&r&&h>n||!a&&!r&&h>n)&&(r=a,n=h,i=H(e[s]))}return i};var W=H.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},G=H.hexNames=_(W),X=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",i="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",r="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}
|
|
}();"undefined"!=typeof module&&module.exports?module.exports=H:"function"==typeof define&&define.amd?define(function(){return H}):window.tinycolor=H}(),function(){function t(t,e){s.searchParams[t]=e;var i={searchParams:s.searchParams,searchRange:s.searchRange,minScore:s.minScore,hintSteps:s.hintSteps,maxResults:s.maxResults};$.getJSON("/node/search",i,function(t){var e={};for(var i in t.columns)e[i]=t.columns[i].hints;s.grapher.setColumnHints(e),r(t.items,t.count)})}function e(){for(var e=$("#keywordsToSearch").val()||[],i={},n=0,o=e.length;o>n;++n)i[e[n]]=1;var a={searchParams:i,searchRange:{min:-1,max:1},minScore:parseFloat($("#minScore").val()),hintSteps:parseInt($("#hintSteps").val()),maxResults:parseInt($("#maxResults").val())};$.getJSON("/node/search",a,function(i){s.searchParams=a.searchParams,s.searchRange=a.searchRange,s.minScore=a.minScore,s.hintSteps=a.hintSteps,s.maxResults=a.maxResults,s.grapher=new Grapher("grapher",s.searchRange,150,!0,!0),s.grapher.setColumns(i.columns),s.grapher.setValueChangedListener(t),r(i.items,i.count),$("#query").text(e.join(", ")),$("#useLocalScale").click(function(){var t=$("#useLocalScale").is(":checked");s.grapher.setUseLocalScale(t)}),$("#useRelativeScale").click(function(){var t=$("#useRelativeScale").is(":checked");s.grapher.setUseRelativeScale(t)}),$("#input").fadeOut(function(){$("#output").fadeIn()})})}function i(){$("#learnKeyword").prop("disabled",!0),$("#learnError").slideUp(function(){var t={keyword:$("#keywordToLearn").val(),params:s.searchParams};$.getJSON("/node/addKeyword",t,function(t){t.success?$("#learnDialog").modal("hide"):$("#learnError").slideDown(function(){$("#learnKeyword").prop("disabled",!1)})})})}function n(){$("#forgetKeyword").prop("disabled",!0),$("#forgetError").slideUp(function(){var t={keyword:$("#keywordToForget").val()};$.getJSON("/node/removeKeyword",t,function(t){t.success?$("#forgetDialog").modal("hide"):$("#forgetError").slideDown(function(){$("#forgetKeyword").prop("disabled",!1)})})})}function r(t,e){var i=String(t.length);t.length<e&&(i+=" of "+e),$("#count").text(i);var n=Handlebars.compile($("#template").html());$("#results").empty(),$("#results").append(n({results:t}))}var s={};$(document).on({ajaxStart:function(){$("#spinner").show()},ajaxStop:function(){$("#spinner").hide()},ready:function(){$("#keywordsToSearch").selectpicker(),$.getJSON("/node/getKeywords",function(t){$("#searchKeywords").click(e);for(var r=0,s=t.length;s>r;++r)$("#keywordsToSearch").append($("<option></option>",{value:t[r],text:t[r]}));$("#keywordsToSearch").selectpicker("refresh"),$("#keywordsToSearch").change(function(){$("#searchKeywords").prop("disabled",!$(this).val())}),$("#forgetKeyword").click(n),$("#forgetDialog").on("show.bs.modal",function(){$("#forgetError").hide(),$.getJSON("/node/getKeywords",function(t){$("#forgetKeyword").prop("disabled",0===t.length),$("#keywordToForget").empty();for(var e=0,i=t.length;i>e;++e)$("#keywordToForget").append($("<option></option>",{value:t[e],text:t[e]}))})}),$("#learnKeyword").click(i),$("#keywordToLearn").bind("input",function(){$("#learnKeyword").prop("disabled",!$(this).val())}),$("#learnDialog").on("show.bs.modal",function(){$("#learnKeyword").prop("disabled",!0),$("#keywordToLearn").val(""),$("#learnError").hide()})})}})}(window.hscd=window.hscd||{}),goog.require("goog.math"),goog.require("goog.math.Coordinate"),goog.require("goog.math.Range"),goog.require("goog.math.Rect"); |