22 lines
690 KiB
JavaScript
22 lines
690 KiB
JavaScript
!function(window){function getMetaKeyCode(t){var e=4096,n=8192,i=16384,r=0;return"string"==typeof t?t.toLowerCase().split(/\+\s*/).forEach(function(t){switch(t){case"ctrl":case"cmd":r|=e;break;case"alt":r|=n;break;case"shift":r|=i;break;default:r|=keymap[t]}}):((t.ctrlKey||t.metaKey)&&(r|=e),t.altKey&&(r|=n),t.shiftKey&&(r|=i),r|=t.keyCode),r}function updateCircle(t,e,n){var i=e.getStyle("padding-left"),r=e.getStyle("padding-right"),o=e.getStyle("padding-top"),a=e.getStyle("padding-bottom"),s=Math.max(n.width,n.height),l={x:n.x-i,y:n.y-o,width:s+i+r,height:s+o+a},u=e.isSelected()?"selected-":"";return s=Math.max(l.width,l.height),t.setPosition(l.x,l.y).setSize(s,s).setRadius(s/2).fill(e.getData("background")||e.getStyle(u+"background")||e.getStyle("background")).stroke(e.getStyle(u+"stroke"||e.getStyle("stroke")),e.getStyle(u+"stroke-width")),new kity.Box(l)}function asc(t,e){return t.getIndex()-e.getIndex()}function desc(t,e){return-asc(t,e)}function canArrange(t){var e=t.getSelectedNode();return e&&e.parent&&e.parent.children.length>1}!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 n(t){var e=t.length,n=Z.type(t);return"function"===n||Z.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t}function i(t,e,n){if(Z.isFunction(e))return Z.grep(t,function(t,i){return!!e.call(t,i,t)!==n});if(e.nodeType)return Z.grep(t,function(t){return t===e!==n});if("string"==typeof e){if(se.test(e))return Z.filter(e,t,n);e=Z.filter(e,t)}return Z.grep(t,function(t){return q.call(e,t)>=0!==n})}function r(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function o(t){var e=pe[t]={};return Z.each(t.match(fe)||[],function(t,n){e[n]=!0}),e}function a(){Q.removeEventListener("DOMContentLoaded",a,!1),t.removeEventListener("load",a,!1),Z.ready()}function s(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=Z.expando+Math.random()}function l(t,e,n){var i;if(void 0===n&&1===t.nodeType)if(i="data-"+e.replace(be,"-$1").toLowerCase(),n=t.getAttribute(i),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:_e.test(n)?Z.parseJSON(n):n}catch(r){}ye.set(t,e,n)}else n=void 0;return n}function u(){return!0}function c(){return!1}function h(){try{return Q.activeElement}catch(t){}}function d(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 f(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function p(t){var e=Be.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function g(t,e){for(var n=0,i=t.length;i>n;n++)ve.set(t[n],"globalEval",!e||ve.get(e[n],"globalEval"))}function m(t,e){var n,i,r,o,a,s,l,u;if(1===e.nodeType){if(ve.hasData(t)&&(o=ve.access(t),a=ve.set(e,o),u=o.events)){delete a.handle,a.events={};for(r in u)for(n=0,i=u[r].length;i>n;n++)Z.event.add(e,r,u[r][n])}ye.hasData(t)&&(s=ye.access(t),l=Z.extend({},s),ye.set(e,l))}}function v(t,e){var n=t.getElementsByTagName?t.getElementsByTagName(e||"*"):t.querySelectorAll?t.querySelectorAll(e||"*"):[];return void 0===e||e&&Z.nodeName(t,e)?Z.merge([t],n):n}function y(t,e){var n=e.nodeName.toLowerCase();"input"===n&&Ce.test(t.type)?e.checked=t.checked:("input"===n||"textarea"===n)&&(e.defaultValue=t.defaultValue)}function _(e,n){var i,r=Z(n.createElement(e)).appendTo(n.body),o=t.getDefaultComputedStyle&&(i=t.getDefaultComputedStyle(r[0]))?i.display:Z.css(r[0],"display");return r.detach(),o}function b(t){var e=Q,n=Ve[t];return n||(n=_(t,e),"none"!==n&&n||(He=(He||Z("<iframe frameborder='0' width='0' height='0'/>")).appendTo(e.documentElement),e=He[0].contentDocument,e.write(),e.close(),n=_(t,e),He.detach()),Ve[t]=n),n}function x(t,e,n){var i,r,o,a,s=t.style;return n=n||je(t),n&&(a=n.getPropertyValue(e)||n[e]),n&&(""!==a||Z.contains(t.ownerDocument,t)||(a=Z.style(t,e)),Fe.test(a)&&ze.test(e)&&(i=s.width,r=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=i,s.minWidth=r,s.maxWidth=o)),void 0!==a?a+"":a}function w(t,e){return{get:function(){return t()?void delete this.get:(this.get=e).apply(this,arguments)}}}function k(t,e){if(e in t)return e;for(var n=e[0].toUpperCase()+e.slice(1),i=e,r=Xe.length;r--;)if(e=Xe[r]+n,e in t)return e;return i}function C(t,e,n){var i=Ke.exec(e);return i?Math.max(0,i[1]-(n||0))+(i[2]||"px"):e}function S(t,e,n,i,r){for(var o=n===(i?"border":"content")?4:"width"===e?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=Z.css(t,n+we[o],!0,r)),i?("content"===n&&(a-=Z.css(t,"padding"+we[o],!0,r)),"margin"!==n&&(a-=Z.css(t,"border"+we[o]+"Width",!0,r))):(a+=Z.css(t,"padding"+we[o],!0,r),"padding"!==n&&(a+=Z.css(t,"border"+we[o]+"Width",!0,r)));return a}function T(t,e,n){var i=!0,r="width"===e?t.offsetWidth:t.offsetHeight,o=je(t),a="border-box"===Z.css(t,"boxSizing",!1,o);if(0>=r||null==r){if(r=x(t,e,o),(0>r||null==r)&&(r=t.style[e]),Fe.test(r))return r;i=a&&(Y.boxSizingReliable()||r===t.style[e]),r=parseFloat(r)||0}return r+S(t,e,n||(a?"border":"content"),i,o)+"px"}function M(t,e){for(var n,i,r,o=[],a=0,s=t.length;s>a;a++)i=t[a],i.style&&(o[a]=ve.get(i,"olddisplay"),n=i.style.display,e?(o[a]||"none"!==n||(i.style.display=""),""===i.style.display&&ke(i)&&(o[a]=ve.access(i,"olddisplay",b(i.nodeName)))):(r=ke(i),"none"===n&&r||ve.set(i,"olddisplay",r?n:Z.css(i,"display"))));for(a=0;s>a;a++)i=t[a],i.style&&(e&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=e?o[a]||"":"none"));return t}function L(t,e,n,i,r){return new L.prototype.init(t,e,n,i,r)}function E(){return setTimeout(function(){Ye=void 0}),Ye=Z.now()}function N(t,e){var n,i=0,r={height:t};for(e=e?1:0;4>i;i+=2-e)n=we[i],r["margin"+n]=r["padding"+n]=t;return e&&(r.opacity=r.width=t),r}function P(t,e,n){for(var i,r=(nn[e]||[]).concat(nn["*"]),o=0,a=r.length;a>o;o++)if(i=r[o].call(n,e,t))return i}function A(t,e,n){var i,r,o,a,s,l,u,c,h=this,d={},f=t.style,p=t.nodeType&&ke(t),g=ve.get(t,"fxshow");n.queue||(s=Z._queueHooks(t,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,h.always(function(){h.always(function(){s.unqueued--,Z.queue(t,"fx").length||s.empty.fire()})})),1===t.nodeType&&("height"in e||"width"in e)&&(n.overflow=[f.overflow,f.overflowX,f.overflowY],u=Z.css(t,"display"),c="none"===u?ve.get(t,"olddisplay")||b(t.nodeName):u,"inline"===c&&"none"===Z.css(t,"float")&&(f.display="inline-block")),n.overflow&&(f.overflow="hidden",h.always(function(){f.overflow=n.overflow[0],f.overflowX=n.overflow[1],f.overflowY=n.overflow[2]}));for(i in e)if(r=e[i],Je.exec(r)){if(delete e[i],o=o||"toggle"===r,r===(p?"hide":"show")){if("show"!==r||!g||void 0===g[i])continue;p=!0}d[i]=g&&g[i]||Z.style(t,i)}else u=void 0;if(Z.isEmptyObject(d))"inline"===("none"===u?b(t.nodeName):u)&&(f.display=u);else{g?"hidden"in g&&(p=g.hidden):g=ve.access(t,"fxshow",{}),o&&(g.hidden=!p),p?Z(t).show():h.done(function(){Z(t).hide()}),h.done(function(){var e;ve.remove(t,"fxshow");for(e in d)Z.style(t,e,d[e])});for(i in d)a=P(p?g[i]:0,i,h),i in g||(g[i]=a.start,p&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}}function O(t,e){var n,i,r,o,a;for(n in t)if(i=Z.camelCase(n),r=e[i],o=t[n],Z.isArray(o)&&(r=o[1],o=t[n]=o[0]),n!==i&&(t[i]=o,delete t[n]),a=Z.cssHooks[i],a&&"expand"in a){o=a.expand(o),delete t[i];for(n in o)n in t||(t[n]=o[n],e[n]=r)}else e[i]=r}function D(t,e,n){var i,r,o=0,a=en.length,s=Z.Deferred().always(function(){delete l.elem}),l=function(){if(r)return!1;for(var e=Ye||E(),n=Math.max(0,u.startTime+u.duration-e),i=n/u.duration||0,o=1-i,a=0,l=u.tweens.length;l>a;a++)u.tweens[a].run(o);return s.notifyWith(t,[u,o,n]),1>o&&l?n:(s.resolveWith(t,[u]),!1)},u=s.promise({elem:t,props:Z.extend({},e),opts:Z.extend(!0,{specialEasing:{}},n),originalProperties:e,originalOptions:n,startTime:Ye||E(),duration:n.duration,tweens:[],createTween:function(e,n){var i=Z.Tween(t,u.opts,e,n,u.opts.specialEasing[e]||u.opts.easing);return u.tweens.push(i),i},stop:function(e){var n=0,i=e?u.tweens.length:0;if(r)return this;for(r=!0;i>n;n++)u.tweens[n].run(1);return e?s.resolveWith(t,[u,e]):s.rejectWith(t,[u,e]),this}}),c=u.props;for(O(c,u.opts.specialEasing);a>o;o++)if(i=en[o].call(u,t,c,u.opts))return i;return Z.map(c,P,u),Z.isFunction(u.opts.start)&&u.opts.start.call(t,u),Z.fx.timer(Z.extend(l,{elem:t,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function I(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var i,r=0,o=e.toLowerCase().match(fe)||[];if(Z.isFunction(n))for(;i=o[r++];)"+"===i[0]?(i=i.slice(1)||"*",(t[i]=t[i]||[]).unshift(n)):(t[i]=t[i]||[]).push(n)}}function B(t,e,n,i){function r(s){var l;return o[s]=!0,Z.each(t[s]||[],function(t,s){var u=s(e,n,i);return"string"!=typeof u||a||o[u]?a?!(l=u):void 0:(e.dataTypes.unshift(u),r(u),!1)}),l}var o={},a=t===wn;return r(e.dataTypes[0])||!o["*"]&&r("*")}function R(t,e){var n,i,r=Z.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((r[n]?t:i||(i={}))[n]=e[n]);return i&&Z.extend(!0,t,i),t}function W(t,e,n){for(var i,r,o,a,s=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"));if(i)for(r in s)if(s[r]&&s[r].test(i)){l.unshift(r);break}if(l[0]in n)o=l[0];else{for(r in n){if(!l[0]||t.converters[r+" "+l[0]]){o=r;break}a||(a=r)}o=o||a}return o?(o!==l[0]&&l.unshift(o),n[o]):void 0}function H(t,e,n,i){var r,o,a,s,l,u={},c=t.dataTypes.slice();if(c[1])for(a in t.converters)u[a.toLowerCase()]=t.converters[a];for(o=c.shift();o;)if(t.responseFields[o]&&(n[t.responseFields[o]]=e),!l&&i&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(r in u)if(s=r.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[r]:u[r]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&t["throws"])e=a(e);else try{e=a(e)}catch(h){return{state:"parsererror",error:a?h:"No conversion from "+l+" to "+o}}}return{state:"success",data:e}}function V(t,e,n,i){var r;if(Z.isArray(e))Z.each(e,function(e,r){n||Tn.test(t)?i(t,r):V(t+"["+("object"==typeof r?e:"")+"]",r,n,i)});else if(n||"object"!==Z.type(e))i(t,e);else for(r in e)V(t+"["+r+"]",e[r],n,i)}function z(t){return Z.isWindow(t)?t:9===t.nodeType&&t.defaultView}var F=[],j=F.slice,U=F.concat,K=F.push,q=F.indexOf,$={},G=$.toString,X=$.hasOwnProperty,Y={},Q=t.document,J="2.1.1",Z=function(t,e){return new Z.fn.init(t,e)},te=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ee=/^-ms-/,ne=/-([\da-z])/gi,ie=function(t,e){return e.toUpperCase()};Z.fn=Z.prototype={jquery:J,constructor:Z,selector:"",length:0,toArray:function(){return j.call(this)},get:function(t){return null!=t?0>t?this[t+this.length]:this[t]:j.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,n){return t.call(e,n,e)}))},slice:function(){return this.pushStack(j.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,n=+t+(0>t?e:0);return this.pushStack(n>=0&&e>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:K,sort:F.sort,splice:F.splice},Z.extend=Z.fn.extend=function(){var t,e,n,i,r,o,a=arguments[0]||{},s=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[s]||{},s++),"object"==typeof a||Z.isFunction(a)||(a={}),s===l&&(a=this,s--);l>s;s++)if(null!=(t=arguments[s]))for(e in t)n=a[e],i=t[e],a!==i&&(u&&i&&(Z.isPlainObject(i)||(r=Z.isArray(i)))?(r?(r=!1,o=n&&Z.isArray(n)?n:[]):o=n&&Z.isPlainObject(n)?n:{},a[e]=Z.extend(u,o,i)):void 0!==i&&(a[e]=i));return a},Z.extend({expando:"jQuery"+(J+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&&!X.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?$[G.call(t)]||"object":typeof t},globalEval:function(t){var e,n=eval;t=Z.trim(t),t&&(1===t.indexOf("use strict")?(e=Q.createElement("script"),e.text=t,Q.head.appendChild(e).parentNode.removeChild(e)):n(t))},camelCase:function(t){return t.replace(ee,"ms-").replace(ne,ie)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e,i){var r,o=0,a=t.length,s=n(t);if(i){if(s)for(;a>o&&(r=e.apply(t[o],i),r!==!1);o++);else for(o in t)if(r=e.apply(t[o],i),r===!1)break}else if(s)for(;a>o&&(r=e.call(t[o],o,t[o]),r!==!1);o++);else for(o in t)if(r=e.call(t[o],o,t[o]),r===!1)break;return t},trim:function(t){return null==t?"":(t+"").replace(te,"")},makeArray:function(t,e){var i=e||[];return null!=t&&(n(Object(t))?Z.merge(i,"string"==typeof t?[t]:t):K.call(i,t)),i},inArray:function(t,e,n){return null==e?-1:q.call(e,t,n)},merge:function(t,e){for(var n=+e.length,i=0,r=t.length;n>i;i++)t[r++]=e[i];return t.length=r,t},grep:function(t,e,n){for(var i,r=[],o=0,a=t.length,s=!n;a>o;o++)i=!e(t[o],o),i!==s&&r.push(t[o]);return r},map:function(t,e,i){var r,o=0,a=t.length,s=n(t),l=[];if(s)for(;a>o;o++)r=e(t[o],o,i),null!=r&&l.push(r);else for(o in t)r=e(t[o],o,i),null!=r&&l.push(r);return U.apply([],l)},guid:1,proxy:function(t,e){var n,i,r;return"string"==typeof e&&(n=t[e],e=t,t=n),Z.isFunction(t)?(i=j.call(arguments,2),r=function(){return t.apply(e||this,i.concat(j.call(arguments)))},r.guid=t.guid=t.guid||Z.guid++,r):void 0},now:Date.now,support:Y}),Z.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){$["[object "+e+"]"]=e.toLowerCase()});var re=function(t){function e(t,e,n,i){var r,o,a,s,l,u,h,f,p,g;if((e?e.ownerDocument||e:V)!==A&&P(e),e=e||A,n=n||[],!t||"string"!=typeof t)return n;if(1!==(s=e.nodeType)&&9!==s)return[];if(D&&!i){if(r=ye.exec(t))if(a=r[1]){if(9===s){if(o=e.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(e.ownerDocument&&(o=e.ownerDocument.getElementById(a))&&W(e,o)&&o.id===a)return n.push(o),n}else{if(r[2])return Z.apply(n,e.getElementsByTagName(t)),n;if((a=r[3])&&x.getElementsByClassName&&e.getElementsByClassName)return Z.apply(n,e.getElementsByClassName(a)),n}if(x.qsa&&(!I||!I.test(t))){if(f=h=H,p=e,g=9===s&&t,1===s&&"object"!==e.nodeName.toLowerCase()){for(u=S(t),(h=e.getAttribute("id"))?f=h.replace(be,"\\$&"):e.setAttribute("id",f),f="[id='"+f+"'] ",l=u.length;l--;)u[l]=f+d(u[l]);p=_e.test(t)&&c(e.parentNode)||e,g=u.join(",")}if(g)try{return Z.apply(n,p.querySelectorAll(g)),n}catch(m){}finally{h||e.removeAttribute("id")}}}return M(t.replace(le,"$1"),e,n,i)}function n(){function t(n,i){return e.push(n+" ")>w.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function i(t){return t[H]=!0,t}function r(t){var e=A.createElement("div");try{return!!t(e)}catch(n){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function o(t,e){for(var n=t.split("|"),i=t.length;i--;)w.attrHandle[n[i]]=e}function a(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||G)-(~t.sourceIndex||G);if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function s(t){return function(e){var n=e.nodeName.toLowerCase();return"input"===n&&e.type===t}}function l(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function u(t){return i(function(e){return e=+e,i(function(n,i){for(var r,o=t([],n.length,e),a=o.length;a--;)n[r=o[a]]&&(n[r]=!(i[r]=n[r]))})})}function c(t){return t&&typeof t.getElementsByTagName!==$&&t}function h(){}function d(t){for(var e=0,n=t.length,i="";n>e;e++)i+=t[e].value;return i}function f(t,e,n){var i=e.dir,r=n&&"parentNode"===i,o=F++;return e.first?function(e,n,o){for(;e=e[i];)if(1===e.nodeType||r)return t(e,n,o)}:function(e,n,a){var s,l,u=[z,o];if(a){for(;e=e[i];)if((1===e.nodeType||r)&&t(e,n,a))return!0}else for(;e=e[i];)if(1===e.nodeType||r){if(l=e[H]||(e[H]={}),(s=l[i])&&s[0]===z&&s[1]===o)return u[2]=s[2];if(l[i]=u,u[2]=t(e,n,a))return!0}}}function p(t){return t.length>1?function(e,n,i){for(var r=t.length;r--;)if(!t[r](e,n,i))return!1;return!0}:t[0]}function g(t,n,i){for(var r=0,o=n.length;o>r;r++)e(t,n[r],i);return i}function m(t,e,n,i,r){for(var o,a=[],s=0,l=t.length,u=null!=e;l>s;s++)(o=t[s])&&(!n||n(o,i,r))&&(a.push(o),u&&e.push(s));return a}function v(t,e,n,r,o,a){return r&&!r[H]&&(r=v(r)),o&&!o[H]&&(o=v(o,a)),i(function(i,a,s,l){var u,c,h,d=[],f=[],p=a.length,v=i||g(e||"*",s.nodeType?[s]:s,[]),y=!t||!i&&e?v:m(v,d,t,s,l),_=n?o||(i?t:p||r)?[]:a:y;if(n&&n(y,_,s,l),r)for(u=m(_,f),r(u,[],s,l),c=u.length;c--;)(h=u[c])&&(_[f[c]]=!(y[f[c]]=h));if(i){if(o||t){if(o){for(u=[],c=_.length;c--;)(h=_[c])&&u.push(y[c]=h);o(null,_=[],u,l)}for(c=_.length;c--;)(h=_[c])&&(u=o?ee.call(i,h):d[c])>-1&&(i[u]=!(a[u]=h))}}else _=m(_===a?_.splice(p,_.length):_),o?o(null,a,_,l):Z.apply(a,_)})}function y(t){for(var e,n,i,r=t.length,o=w.relative[t[0].type],a=o||w.relative[" "],s=o?1:0,l=f(function(t){return t===e},a,!0),u=f(function(t){return ee.call(e,t)>-1},a,!0),c=[function(t,n,i){return!o&&(i||n!==L)||((e=n).nodeType?l(t,n,i):u(t,n,i))}];r>s;s++)if(n=w.relative[t[s].type])c=[f(p(c),n)];else{if(n=w.filter[t[s].type].apply(null,t[s].matches),n[H]){for(i=++s;r>i&&!w.relative[t[i].type];i++);return v(s>1&&p(c),s>1&&d(t.slice(0,s-1).concat({value:" "===t[s-2].type?"*":""})).replace(le,"$1"),n,i>s&&y(t.slice(s,i)),r>i&&y(t=t.slice(i)),r>i&&d(t))}c.push(n)}return p(c)}function _(t,n){var r=n.length>0,o=t.length>0,a=function(i,a,s,l,u){var c,h,d,f=0,p="0",g=i&&[],v=[],y=L,_=i||o&&w.find.TAG("*",u),b=z+=null==y?1:Math.random()||.1,x=_.length;for(u&&(L=a!==A&&a);p!==x&&null!=(c=_[p]);p++){if(o&&c){for(h=0;d=t[h++];)if(d(c,a,s)){l.push(c);break}u&&(z=b)}r&&((c=!d&&c)&&f--,i&&g.push(c))}if(f+=p,r&&p!==f){for(h=0;d=n[h++];)d(g,v,a,s);if(i){if(f>0)for(;p--;)g[p]||v[p]||(v[p]=Q.call(l));v=m(v)}Z.apply(l,v),u&&!i&&v.length>0&&f+n.length>1&&e.uniqueSort(l)}return u&&(z=b,L=y),g};return r?i(a):a}var b,x,w,k,C,S,T,M,L,E,N,P,A,O,D,I,B,R,W,H="sizzle"+-new Date,V=t.document,z=0,F=0,j=n(),U=n(),K=n(),q=function(t,e){return t===e&&(N=!0),0},$="undefined",G=1<<31,X={}.hasOwnProperty,Y=[],Q=Y.pop,J=Y.push,Z=Y.push,te=Y.slice,ee=Y.indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(this[e]===t)return e;return-1},ne="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ie="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",oe=re.replace("w","w#"),ae="\\["+ie+"*("+re+")(?:"+ie+"*([*^$|!~]?=)"+ie+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+oe+"))|)"+ie+"*\\]",se=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ae+")*)|.*)\\)|)",le=new RegExp("^"+ie+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ie+"+$","g"),ue=new RegExp("^"+ie+"*,"+ie+"*"),ce=new RegExp("^"+ie+"*([>+~]|"+ie+")"+ie+"*"),he=new RegExp("="+ie+"*([^\\]'\"]*?)"+ie+"*\\]","g"),de=new RegExp(se),fe=new RegExp("^"+oe+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re.replace("w","w*")+")"),ATTR:new RegExp("^"+ae),PSEUDO:new RegExp("^"+se),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ie+"*(even|odd|(([+-]|)(\\d*)n|)"+ie+"*(?:([+-]|)"+ie+"*(\\d+)|))"+ie+"*\\)|)","i"),bool:new RegExp("^(?:"+ne+")$","i"),needsContext:new RegExp("^"+ie+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ie+"*((?:-\\d)?\\d*)"+ie+"*\\)|)(?=[^-]|$)","i")},ge=/^(?:input|select|textarea|button)$/i,me=/^h\d$/i,ve=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_e=/[+~]/,be=/'|\\/g,xe=new RegExp("\\\\([\\da-f]{1,6}"+ie+"?|("+ie+")|.)","ig"),we=function(t,e,n){var i="0x"+e-65536;return i!==i||n?e:0>i?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)};try{Z.apply(Y=te.call(V.childNodes),V.childNodes),Y[V.childNodes.length].nodeType}catch(ke){Z={apply:Y.length?function(t,e){J.apply(t,te.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}x=e.support={},C=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return e?"HTML"!==e.nodeName:!1},P=e.setDocument=function(t){var e,n=t?t.ownerDocument||t:V,i=n.defaultView;return n!==A&&9===n.nodeType&&n.documentElement?(A=n,O=n.documentElement,D=!C(n),i&&i!==i.top&&(i.addEventListener?i.addEventListener("unload",function(){P()},!1):i.attachEvent&&i.attachEvent("onunload",function(){P()})),x.attributes=r(function(t){return t.className="i",!t.getAttribute("className")}),x.getElementsByTagName=r(function(t){return t.appendChild(n.createComment("")),!t.getElementsByTagName("*").length}),x.getElementsByClassName=ve.test(n.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}),x.getById=r(function(t){return O.appendChild(t).id=H,!n.getElementsByName||!n.getElementsByName(H).length}),x.getById?(w.find.ID=function(t,e){if(typeof e.getElementById!==$&&D){var n=e.getElementById(t);return n&&n.parentNode?[n]:[]}},w.filter.ID=function(t){var e=t.replace(xe,we);return function(t){return t.getAttribute("id")===e}}):(delete w.find.ID,w.filter.ID=function(t){var e=t.replace(xe,we);return function(t){var n=typeof t.getAttributeNode!==$&&t.getAttributeNode("id");return n&&n.value===e}}),w.find.TAG=x.getElementsByTagName?function(t,e){return typeof e.getElementsByTagName!==$?e.getElementsByTagName(t):void 0}:function(t,e){var n,i=[],r=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},w.find.CLASS=x.getElementsByClassName&&function(t,e){return typeof e.getElementsByClassName!==$&&D?e.getElementsByClassName(t):void 0},B=[],I=[],(x.qsa=ve.test(n.querySelectorAll))&&(r(function(t){t.innerHTML="<select msallowclip=''><option selected=''></option></select>",t.querySelectorAll("[msallowclip^='']").length&&I.push("[*^$]="+ie+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||I.push("\\["+ie+"*(?:value|"+ne+")"),t.querySelectorAll(":checked").length||I.push(":checked")}),r(function(t){var e=n.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&I.push("name"+ie+"*[*^$|!~]?="),t.querySelectorAll(":enabled").length||I.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),I.push(",.*:")})),(x.matchesSelector=ve.test(R=O.matches||O.webkitMatchesSelector||O.mozMatchesSelector||O.oMatchesSelector||O.msMatchesSelector))&&r(function(t){x.disconnectedMatch=R.call(t,"div"),R.call(t,"[s!='']:x"),B.push("!=",se)}),I=I.length&&new RegExp(I.join("|")),B=B.length&&new RegExp(B.join("|")),e=ve.test(O.compareDocumentPosition),W=e||ve.test(O.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},q=e?function(t,e){if(t===e)return N=!0,0;var i=!t.compareDocumentPosition-!e.compareDocumentPosition;return i?i:(i=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1,1&i||!x.sortDetached&&e.compareDocumentPosition(t)===i?t===n||t.ownerDocument===V&&W(V,t)?-1:e===n||e.ownerDocument===V&&W(V,e)?1:E?ee.call(E,t)-ee.call(E,e):0:4&i?-1:1)}:function(t,e){if(t===e)return N=!0,0;var i,r=0,o=t.parentNode,s=e.parentNode,l=[t],u=[e];if(!o||!s)return t===n?-1:e===n?1:o?-1:s?1:E?ee.call(E,t)-ee.call(E,e):0;if(o===s)return a(t,e);for(i=t;i=i.parentNode;)l.unshift(i);for(i=e;i=i.parentNode;)u.unshift(i);for(;l[r]===u[r];)r++;return r?a(l[r],u[r]):l[r]===V?-1:u[r]===V?1:0},n):A},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==A&&P(t),n=n.replace(he,"='$1']"),!(!x.matchesSelector||!D||B&&B.test(n)||I&&I.test(n)))try{var i=R.call(t,n);if(i||x.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(r){}return e(n,A,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==A&&P(t),W(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==A&&P(t);var n=w.attrHandle[e.toLowerCase()],i=n&&X.call(w.attrHandle,e.toLowerCase())?n(t,e,!D):void 0;return void 0!==i?i:x.attributes||!D?t.getAttribute(e):(i=t.getAttributeNode(e))&&i.specified?i.value:null},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,n=[],i=0,r=0;if(N=!x.detectDuplicates,E=!x.sortStable&&t.slice(0),t.sort(q),N){for(;e=t[r++];)e===t[r]&&(i=n.push(r));for(;i--;)t.splice(n[i],1)}return E=null,t},k=e.getText=function(t){var e,n="",i=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)n+=k(t)}else if(3===r||4===r)return t.nodeValue}else for(;e=t[i++];)n+=k(e);return n},w=e.selectors={cacheLength:50,createPseudo:i,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(xe,we),t[3]=(t[3]||t[4]||t[5]||"").replace(xe,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,n=!t[6]&&t[2];return pe.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&de.test(n)&&(e=S(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(xe,we).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=j[t+" "];return e||(e=new RegExp("(^|"+ie+")"+t+"("+ie+"|$)"))&&j(t,function(t){return e.test("string"==typeof t.className&&t.className||typeof t.getAttribute!==$&&t.getAttribute("class")||"")})},ATTR:function(t,n,i){return function(r){var o=e.attr(r,t);return null==o?"!="===n:n?(o+="","="===n?o===i:"!="===n?o!==i:"^="===n?i&&0===o.indexOf(i):"*="===n?i&&o.indexOf(i)>-1:"$="===n?i&&o.slice(-i.length)===i:"~="===n?(" "+o+" ").indexOf(i)>-1:"|="===n?o===i||o.slice(0,i.length+1)===i+"-":!1):!0}},CHILD:function(t,e,n,i,r){var o="nth"!==t.slice(0,3),a="last"!==t.slice(-4),s="of-type"===e;return 1===i&&0===r?function(t){return!!t.parentNode}:function(e,n,l){var u,c,h,d,f,p,g=o!==a?"nextSibling":"previousSibling",m=e.parentNode,v=s&&e.nodeName.toLowerCase(),y=!l&&!s;if(m){if(o){for(;g;){for(h=e;h=h[g];)if(s?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;p=g="only"===t&&!p&&"nextSibling"}return!0}if(p=[a?m.firstChild:m.lastChild],a&&y){for(c=m[H]||(m[H]={}),u=c[t]||[],f=u[0]===z&&u[1],d=u[0]===z&&u[2],h=f&&m.childNodes[f];h=++f&&h&&h[g]||(d=f=0)||p.pop();)if(1===h.nodeType&&++d&&h===e){c[t]=[z,f,d];break}}else if(y&&(u=(e[H]||(e[H]={}))[t])&&u[0]===z)d=u[1];else for(;(h=++f&&h&&h[g]||(d=f=0)||p.pop())&&((s?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++d||(y&&((h[H]||(h[H]={}))[t]=[z,d]),h!==e)););return d-=r,d===i||d%i===0&&d/i>=0}}},PSEUDO:function(t,n){var r,o=w.pseudos[t]||w.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return o[H]?o(n):o.length>1?(r=[t,t,"",n],w.setFilters.hasOwnProperty(t.toLowerCase())?i(function(t,e){for(var i,r=o(t,n),a=r.length;a--;)i=ee.call(t,r[a]),t[i]=!(e[i]=r[a])}):function(t){return o(t,0,r)}):o}},pseudos:{not:i(function(t){var e=[],n=[],r=T(t.replace(le,"$1"));return r[H]?i(function(t,e,n,i){for(var o,a=r(t,null,i,[]),s=t.length;s--;)(o=a[s])&&(t[s]=!(e[s]=o))}):function(t,i,o){return e[0]=t,r(e,null,o,n),!n.pop()}}),has:i(function(t){return function(n){return e(t,n).length>0}}),contains:i(function(t){return function(e){return(e.textContent||e.innerText||k(e)).indexOf(t)>-1}}),lang:i(function(t){return fe.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(xe,we).toLowerCase(),function(e){var n;do if(n=D?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return n=n.toLowerCase(),n===t||0===n.indexOf(t+"-");while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===O},focus:function(t){return t===A.activeElement&&(!A.hasFocus||A.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 me.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:u(function(){return[0]}),last:u(function(t,e){return[e-1]}),eq:u(function(t,e,n){return[0>n?n+e:n]}),even:u(function(t,e){for(var n=0;e>n;n+=2)t.push(n);return t}),odd:u(function(t,e){for(var n=1;e>n;n+=2)t.push(n);return t}),lt:u(function(t,e,n){for(var i=0>n?n+e:n;--i>=0;)t.push(i);return t}),gt:u(function(t,e,n){for(var i=0>n?n+e:n;++i<e;)t.push(i);return t})}},w.pseudos.nth=w.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[b]=s(b);for(b in{submit:!0,reset:!0})w.pseudos[b]=l(b);return h.prototype=w.filters=w.pseudos,w.setFilters=new h,S=e.tokenize=function(t,n){var i,r,o,a,s,l,u,c=U[t+" "];if(c)return n?0:c.slice(0);for(s=t,l=[],u=w.preFilter;s;){(!i||(r=ue.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(o=[])),i=!1,(r=ce.exec(s))&&(i=r.shift(),o.push({value:i,type:r[0].replace(le," ")}),s=s.slice(i.length));for(a in w.filter)!(r=pe[a].exec(s))||u[a]&&!(r=u[a](r))||(i=r.shift(),o.push({value:i,type:a,matches:r}),s=s.slice(i.length));if(!i)break}return n?s.length:s?e.error(t):U(t,l).slice(0)},T=e.compile=function(t,e){var n,i=[],r=[],o=K[t+" "];if(!o){for(e||(e=S(t)),n=e.length;n--;)o=y(e[n]),o[H]?i.push(o):r.push(o);o=K(t,_(r,i)),o.selector=t}return o},M=e.select=function(t,e,n,i){var r,o,a,s,l,u="function"==typeof t&&t,h=!i&&S(t=u.selector||t);if(n=n||[],1===h.length){if(o=h[0]=h[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&x.getById&&9===e.nodeType&&D&&w.relative[o[1].type]){if(e=(w.find.ID(a.matches[0].replace(xe,we),e)||[])[0],!e)return n;u&&(e=e.parentNode),t=t.slice(o.shift().value.length)}for(r=pe.needsContext.test(t)?0:o.length;r--&&(a=o[r],!w.relative[s=a.type]);)if((l=w.find[s])&&(i=l(a.matches[0].replace(xe,we),_e.test(o[0].type)&&c(e.parentNode)||e))){if(o.splice(r,1),t=i.length&&d(o),!t)return Z.apply(n,i),n;break}}return(u||T(t,h))(i,e,!D,n,_e.test(t)&&c(e.parentNode)||e),n},x.sortStable=H.split("").sort(q).join("")===H,x.detectDuplicates=!!N,P(),x.sortDetached=r(function(t){return 1&t.compareDocumentPosition(A.createElement("div"))}),r(function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")})||o("type|href|height|width",function(t,e,n){return n?void 0:t.getAttribute(e,"type"===e.toLowerCase()?1:2)
|
||
}),x.attributes&&r(function(t){return t.innerHTML="<input/>",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||o("value",function(t,e,n){return n||"input"!==t.nodeName.toLowerCase()?void 0:t.defaultValue}),r(function(t){return null==t.getAttribute("disabled")})||o(ne,function(t,e,n){var i;return n?void 0:t[e]===!0?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.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 oe=Z.expr.match.needsContext,ae=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,se=/^.[^:#\[\.,]*$/;Z.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?Z.find.matchesSelector(i,t)?[i]:[]:Z.find.matches(t,Z.grep(e,function(t){return 1===t.nodeType}))},Z.fn.extend({find:function(t){var e,n=this.length,i=[],r=this;if("string"!=typeof t)return this.pushStack(Z(t).filter(function(){for(e=0;n>e;e++)if(Z.contains(r[e],this))return!0}));for(e=0;n>e;e++)Z.find(t,r[e],i);return i=this.pushStack(n>1?Z.unique(i):i),i.selector=this.selector?this.selector+" "+t:t,i},filter:function(t){return this.pushStack(i(this,t||[],!1))},not:function(t){return this.pushStack(i(this,t||[],!0))},is:function(t){return!!i(this,"string"==typeof t&&oe.test(t)?Z(t):t||[],!1).length}});var le,ue=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ce=Z.fn.init=function(t,e){var n,i;if(!t)return this;if("string"==typeof t){if(n="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:ue.exec(t),!n||!n[1]&&e)return!e||e.jquery?(e||le).find(t):this.constructor(e).find(t);if(n[1]){if(e=e instanceof Z?e[0]:e,Z.merge(this,Z.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:Q,!0)),ae.test(n[1])&&Z.isPlainObject(e))for(n in e)Z.isFunction(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}return i=Q.getElementById(n[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=Q,this.selector=t,this}return t.nodeType?(this.context=this[0]=t,this.length=1,this):Z.isFunction(t)?"undefined"!=typeof le.ready?le.ready(t):t(Z):(void 0!==t.selector&&(this.selector=t.selector,this.context=t.context),Z.makeArray(t,this))};ce.prototype=Z.fn,le=Z(Q);var he=/^(?:parents|prev(?:Until|All))/,de={children:!0,contents:!0,next:!0,prev:!0};Z.extend({dir:function(t,e,n){for(var i=[],r=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(r&&Z(t).is(n))break;i.push(t)}return i},sibling:function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n}}),Z.fn.extend({has:function(t){var e=Z(t,this),n=e.length;return this.filter(function(){for(var t=0;n>t;t++)if(Z.contains(this,e[t]))return!0})},closest:function(t,e){for(var n,i=0,r=this.length,o=[],a=oe.test(t)||"string"!=typeof t?Z(t,e||this.context):0;r>i;i++)for(n=this[i];n&&n!==e;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&Z.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?Z.unique(o):o)},index:function(t){return t?"string"==typeof t?q.call(Z(t),this[0]):q.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,n){return Z.dir(t,"parentNode",n)},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,n){return Z.dir(t,"nextSibling",n)},prevUntil:function(t,e,n){return Z.dir(t,"previousSibling",n)},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(n,i){var r=Z.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=Z.filter(i,r)),this.length>1&&(de[t]||Z.unique(r),he.test(t)&&r.reverse()),this.pushStack(r)}});var fe=/\S+/g,pe={};Z.Callbacks=function(t){t="string"==typeof t?pe[t]||o(t):Z.extend({},t);var e,n,i,r,a,s,l=[],u=!t.once&&[],c=function(o){for(e=t.memory&&o,n=!0,s=r||0,r=0,a=l.length,i=!0;l&&a>s;s++)if(l[s].apply(o[0],o[1])===!1&&t.stopOnFalse){e=!1;break}i=!1,l&&(u?u.length&&c(u.shift()):e?l=[]:h.disable())},h={add:function(){if(l){var n=l.length;!function o(e){Z.each(e,function(e,n){var i=Z.type(n);"function"===i?t.unique&&h.has(n)||l.push(n):n&&n.length&&"string"!==i&&o(n)})}(arguments),i?a=l.length:e&&(r=n,c(e))}return this},remove:function(){return l&&Z.each(arguments,function(t,e){for(var n;(n=Z.inArray(e,l,n))>-1;)l.splice(n,1),i&&(a>=n&&a--,s>=n&&s--)}),this},has:function(t){return t?Z.inArray(t,l)>-1:!(!l||!l.length)},empty:function(){return l=[],a=0,this},disable:function(){return l=u=e=void 0,this},disabled:function(){return!l},lock:function(){return u=void 0,e||h.disable(),this},locked:function(){return!u},fireWith:function(t,e){return!l||n&&!u||(e=e||[],e=[t,e.slice?e.slice():e],i?u.push(e):c(e)),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!n}};return h},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")]],n="pending",i={state:function(){return n},always:function(){return r.done(arguments).fail(arguments),this},then:function(){var t=arguments;return Z.Deferred(function(n){Z.each(e,function(e,o){var a=Z.isFunction(t[e])&&t[e];r[o[1]](function(){var t=a&&a.apply(this,arguments);t&&Z.isFunction(t.promise)?t.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o[0]+"With"](this===i?n.promise():this,a?[t]:arguments)})}),t=null}).promise()},promise:function(t){return null!=t?Z.extend(t,i):i}},r={};return i.pipe=i.then,Z.each(e,function(t,o){var a=o[2],s=o[3];i[o[1]]=a.add,s&&a.add(function(){n=s},e[1^t][2].disable,e[2][2].lock),r[o[0]]=function(){return r[o[0]+"With"](this===r?i:this,arguments),this},r[o[0]+"With"]=a.fireWith}),i.promise(r),t&&t.call(r,r),r},when:function(t){var e,n,i,r=0,o=j.call(arguments),a=o.length,s=1!==a||t&&Z.isFunction(t.promise)?a:0,l=1===s?t:Z.Deferred(),u=function(t,n,i){return function(r){n[t]=this,i[t]=arguments.length>1?j.call(arguments):r,i===e?l.notifyWith(n,i):--s||l.resolveWith(n,i)}};if(a>1)for(e=new Array(a),n=new Array(a),i=new Array(a);a>r;r++)o[r]&&Z.isFunction(o[r].promise)?o[r].promise().done(u(r,i,o)).fail(l.reject).progress(u(r,n,e)):--s;return s||l.resolveWith(i,o),l.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(Q,[Z]),Z.fn.triggerHandler&&(Z(Q).triggerHandler("ready"),Z(Q).off("ready"))))}}),Z.ready.promise=function(e){return ge||(ge=Z.Deferred(),"complete"===Q.readyState?setTimeout(Z.ready):(Q.addEventListener("DOMContentLoaded",a,!1),t.addEventListener("load",a,!1))),ge.promise(e)},Z.ready.promise();var me=Z.access=function(t,e,n,i,r,o,a){var s=0,l=t.length,u=null==n;if("object"===Z.type(n)){r=!0;for(s in n)Z.access(t,e,s,n[s],!0,o,a)}else if(void 0!==i&&(r=!0,Z.isFunction(i)||(a=!0),u&&(a?(e.call(t,i),e=null):(u=e,e=function(t,e,n){return u.call(Z(t),n)})),e))for(;l>s;s++)e(t[s],n,a?i:i.call(t[s],s,e(t[s],n)));return r?t:u?e.call(t):l?e(t[0],n):o};Z.acceptData=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType},s.uid=1,s.accepts=Z.acceptData,s.prototype={key:function(t){if(!s.accepts(t))return 0;var e={},n=t[this.expando];if(!n){n=s.uid++;try{e[this.expando]={value:n},Object.defineProperties(t,e)}catch(i){e[this.expando]=n,Z.extend(t,e)}}return this.cache[n]||(this.cache[n]={}),n},set:function(t,e,n){var i,r=this.key(t),o=this.cache[r];if("string"==typeof e)o[e]=n;else if(Z.isEmptyObject(o))Z.extend(this.cache[r],e);else for(i in e)o[i]=e[i];return o},get:function(t,e){var n=this.cache[this.key(t)];return void 0===e?n:n[e]},access:function(t,e,n){var i;return void 0===e||e&&"string"==typeof e&&void 0===n?(i=this.get(t,e),void 0!==i?i:this.get(t,Z.camelCase(e))):(this.set(t,e,n),void 0!==n?n:e)},remove:function(t,e){var n,i,r,o=this.key(t),a=this.cache[o];if(void 0===e)this.cache[o]={};else{Z.isArray(e)?i=e.concat(e.map(Z.camelCase)):(r=Z.camelCase(e),e in a?i=[e,r]:(i=r,i=i in a?[i]:i.match(fe)||[])),n=i.length;for(;n--;)delete a[i[n]]}},hasData:function(t){return!Z.isEmptyObject(this.cache[t[this.expando]]||{})},discard:function(t){t[this.expando]&&delete this.cache[t[this.expando]]}};var ve=new s,ye=new s,_e=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,be=/([A-Z])/g;Z.extend({hasData:function(t){return ye.hasData(t)||ve.hasData(t)},data:function(t,e,n){return ye.access(t,e,n)},removeData:function(t,e){ye.remove(t,e)},_data:function(t,e,n){return ve.access(t,e,n)},_removeData:function(t,e){ve.remove(t,e)}}),Z.fn.extend({data:function(t,e){var n,i,r,o=this[0],a=o&&o.attributes;if(void 0===t){if(this.length&&(r=ye.get(o),1===o.nodeType&&!ve.get(o,"hasDataAttrs"))){for(n=a.length;n--;)a[n]&&(i=a[n].name,0===i.indexOf("data-")&&(i=Z.camelCase(i.slice(5)),l(o,i,r[i])));ve.set(o,"hasDataAttrs",!0)}return r}return"object"==typeof t?this.each(function(){ye.set(this,t)}):me(this,function(e){var n,i=Z.camelCase(t);if(o&&void 0===e){if(n=ye.get(o,t),void 0!==n)return n;if(n=ye.get(o,i),void 0!==n)return n;if(n=l(o,i,void 0),void 0!==n)return n}else this.each(function(){var n=ye.get(this,i);ye.set(this,i,e),-1!==t.indexOf("-")&&void 0!==n&&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,n){var i;return t?(e=(e||"fx")+"queue",i=ve.get(t,e),n&&(!i||Z.isArray(n)?i=ve.access(t,e,Z.makeArray(n)):i.push(n)),i||[]):void 0},dequeue:function(t,e){e=e||"fx";var n=Z.queue(t,e),i=n.length,r=n.shift(),o=Z._queueHooks(t,e),a=function(){Z.dequeue(t,e)};"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===e&&n.unshift("inprogress"),delete o.stop,r.call(t,a,o)),!i&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return ve.get(t,n)||ve.access(t,n,{empty:Z.Callbacks("once memory").add(function(){ve.remove(t,[e+"queue",n])})})}}),Z.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length<n?Z.queue(this[0],t):void 0===e?this:this.each(function(){var n=Z.queue(this,t,e);Z._queueHooks(this,t),"fx"===t&&"inprogress"!==n[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 n,i=1,r=Z.Deferred(),o=this,a=this.length,s=function(){--i||r.resolveWith(o,[o])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";a--;)n=ve.get(o[a],t+"queueHooks"),n&&n.empty&&(i++,n.empty.add(s));return s(),r.promise(e)}});var xe=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,we=["Top","Right","Bottom","Left"],ke=function(t,e){return t=e||t,"none"===Z.css(t,"display")||!Z.contains(t.ownerDocument,t)},Ce=/^(?:checkbox|radio)$/i;!function(){var t=Q.createDocumentFragment(),e=t.appendChild(Q.createElement("div")),n=Q.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),Y.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",Y.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Se="undefined";Y.focusinBubbles="onfocusin"in t;var Te=/^key/,Me=/^(?:mouse|pointer|contextmenu)|click/,Le=/^(?:focusinfocus|focusoutblur)$/,Ee=/^([^.]*)(?:\.(.+)|)$/;Z.event={global:{},add:function(t,e,n,i,r){var o,a,s,l,u,c,h,d,f,p,g,m=ve.get(t);if(m)for(n.handler&&(o=n,n=o.handler,r=o.selector),n.guid||(n.guid=Z.guid++),(l=m.events)||(l=m.events={}),(a=m.handle)||(a=m.handle=function(e){return typeof Z!==Se&&Z.event.triggered!==e.type?Z.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(fe)||[""],u=e.length;u--;)s=Ee.exec(e[u])||[],f=g=s[1],p=(s[2]||"").split(".").sort(),f&&(h=Z.event.special[f]||{},f=(r?h.delegateType:h.bindType)||f,h=Z.event.special[f]||{},c=Z.extend({type:f,origType:g,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&Z.expr.match.needsContext.test(r),namespace:p.join(".")},o),(d=l[f])||(d=l[f]=[],d.delegateCount=0,h.setup&&h.setup.call(t,i,p,a)!==!1||t.addEventListener&&t.addEventListener(f,a,!1)),h.add&&(h.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),r?d.splice(d.delegateCount++,0,c):d.push(c),Z.event.global[f]=!0)},remove:function(t,e,n,i,r){var o,a,s,l,u,c,h,d,f,p,g,m=ve.hasData(t)&&ve.get(t);if(m&&(l=m.events)){for(e=(e||"").match(fe)||[""],u=e.length;u--;)if(s=Ee.exec(e[u])||[],f=g=s[1],p=(s[2]||"").split(".").sort(),f){for(h=Z.event.special[f]||{},f=(i?h.delegateType:h.bindType)||f,d=l[f]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=d.length;o--;)c=d[o],!r&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||i&&i!==c.selector&&("**"!==i||!c.selector)||(d.splice(o,1),c.selector&&d.delegateCount--,h.remove&&h.remove.call(t,c));a&&!d.length&&(h.teardown&&h.teardown.call(t,p,m.handle)!==!1||Z.removeEvent(t,f,m.handle),delete l[f])}else for(f in l)Z.event.remove(t,f+e[u],n,i,!0);Z.isEmptyObject(l)&&(delete m.handle,ve.remove(t,"events"))}},trigger:function(e,n,i,r){var o,a,s,l,u,c,h,d=[i||Q],f=X.call(e,"type")?e.type:e,p=X.call(e,"namespace")?e.namespace.split("."):[];if(a=s=i=i||Q,3!==i.nodeType&&8!==i.nodeType&&!Le.test(f+Z.event.triggered)&&(f.indexOf(".")>=0&&(p=f.split("."),f=p.shift(),p.sort()),u=f.indexOf(":")<0&&"on"+f,e=e[Z.expando]?e:new Z.Event(f,"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=i),n=null==n?[e]:Z.makeArray(n,[e]),h=Z.event.special[f]||{},r||!h.trigger||h.trigger.apply(i,n)!==!1)){if(!r&&!h.noBubble&&!Z.isWindow(i)){for(l=h.delegateType||f,Le.test(l+f)||(a=a.parentNode);a;a=a.parentNode)d.push(a),s=a;s===(i.ownerDocument||Q)&&d.push(s.defaultView||s.parentWindow||t)}for(o=0;(a=d[o++])&&!e.isPropagationStopped();)e.type=o>1?l:h.bindType||f,c=(ve.get(a,"events")||{})[e.type]&&ve.get(a,"handle"),c&&c.apply(a,n),c=u&&a[u],c&&c.apply&&Z.acceptData(a)&&(e.result=c.apply(a,n),e.result===!1&&e.preventDefault());return e.type=f,r||e.isDefaultPrevented()||h._default&&h._default.apply(d.pop(),n)!==!1||!Z.acceptData(i)||u&&Z.isFunction(i[f])&&!Z.isWindow(i)&&(s=i[u],s&&(i[u]=null),Z.event.triggered=f,i[f](),Z.event.triggered=void 0,s&&(i[u]=s)),e.result}},dispatch:function(t){t=Z.event.fix(t);var e,n,i,r,o,a=[],s=j.call(arguments),l=(ve.get(this,"events")||{})[t.type]||[],u=Z.event.special[t.type]||{};if(s[0]=t,t.delegateTarget=this,!u.preDispatch||u.preDispatch.call(this,t)!==!1){for(a=Z.event.handlers.call(this,t,l),e=0;(r=a[e++])&&!t.isPropagationStopped();)for(t.currentTarget=r.elem,n=0;(o=r.handlers[n++])&&!t.isImmediatePropagationStopped();)(!t.namespace_re||t.namespace_re.test(o.namespace))&&(t.handleObj=o,t.data=o.data,i=((Z.event.special[o.origType]||{}).handle||o.handler).apply(r.elem,s),void 0!==i&&(t.result=i)===!1&&(t.preventDefault(),t.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,t),t.result}},handlers:function(t,e){var n,i,r,o,a=[],s=e.delegateCount,l=t.target;if(s&&l.nodeType&&(!t.button||"click"!==t.type))for(;l!==this;l=l.parentNode||this)if(l.disabled!==!0||"click"!==t.type){for(i=[],n=0;s>n;n++)o=e[n],r=o.selector+" ",void 0===i[r]&&(i[r]=o.needsContext?Z(r,this).index(l)>=0:Z.find(r,this,null,[l]).length),i[r]&&i.push(o);i.length&&a.push({elem:l,handlers:i})}return s<e.length&&a.push({elem:this,handlers:e.slice(s)}),a},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 n,i,r,o=e.button;return null==t.pageX&&null!=e.clientX&&(n=t.target.ownerDocument||Q,i=n.documentElement,r=n.body,t.pageX=e.clientX+(i&&i.scrollLeft||r&&r.scrollLeft||0)-(i&&i.clientLeft||r&&r.clientLeft||0),t.pageY=e.clientY+(i&&i.scrollTop||r&&r.scrollTop||0)-(i&&i.clientTop||r&&r.clientTop||0)),t.which||void 0===o||(t.which=1&o?1:2&o?3:4&o?2:0),t}},fix:function(t){if(t[Z.expando])return t;var e,n,i,r=t.type,o=t,a=this.fixHooks[r];for(a||(this.fixHooks[r]=a=Me.test(r)?this.mouseHooks:Te.test(r)?this.keyHooks:{}),i=a.props?this.props.concat(a.props):this.props,t=new Z.Event(o),e=i.length;e--;)n=i[e],t[n]=o[n];return t.target||(t.target=Q),3===t.target.nodeType&&(t.target=t.target.parentNode),a.filter?a.filter(t,o):t},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==h()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===h()&&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,n,i){var r=Z.extend(new Z.Event,n,{type:t,isSimulated:!0,originalEvent:{}});i?Z.event.trigger(r,null,e):Z.event.dispatch.call(e,r),r.isDefaultPrevented()&&n.preventDefault()}},Z.removeEvent=function(t,e,n){t.removeEventListener&&t.removeEventListener(e,n,!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?u: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=u,t&&t.preventDefault&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=u,t&&t.stopPropagation&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=u,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 n,i=this,r=t.relatedTarget,o=t.handleObj;return(!r||r!==i&&!Z.contains(i,r))&&(t.type=o.origType,n=o.handler.apply(this,arguments),t.type=e),n}}}),Y.focusinBubbles||Z.each({focus:"focusin",blur:"focusout"},function(t,e){var n=function(t){Z.event.simulate(e,t.target,Z.event.fix(t),!0)};Z.event.special[e]={setup:function(){var i=this.ownerDocument||this,r=ve.access(i,e);r||i.addEventListener(t,n,!0),ve.access(i,e,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this,r=ve.access(i,e)-1;r?ve.access(i,e,r):(i.removeEventListener(t,n,!0),ve.remove(i,e))}}}),Z.fn.extend({on:function(t,e,n,i,r){var o,a;if("object"==typeof t){"string"!=typeof e&&(n=n||e,e=void 0);for(a in t)this.on(a,e,n,t[a],r);return this}if(null==n&&null==i?(i=e,n=e=void 0):null==i&&("string"==typeof e?(i=n,n=void 0):(i=n,n=e,e=void 0)),i===!1)i=c;else if(!i)return this;return 1===r&&(o=i,i=function(t){return Z().off(t),o.apply(this,arguments)},i.guid=o.guid||(o.guid=Z.guid++)),this.each(function(){Z.event.add(this,t,i,n,e)})},one:function(t,e,n,i){return this.on(t,e,n,i,1)},off:function(t,e,n){var i,r;if(t&&t.preventDefault&&t.handleObj)return i=t.handleObj,Z(t.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof t){for(r in t)this.off(r,e,t[r]);return this}return(e===!1||"function"==typeof e)&&(n=e,e=void 0),n===!1&&(n=c),this.each(function(){Z.event.remove(this,t,n,e)})},trigger:function(t,e){return this.each(function(){Z.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];return n?Z.event.trigger(t,e,n,!0):void 0}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Pe=/<([\w:]+)/,Ae=/<|&#?\w+;/,Oe=/<(?:script|style|link)/i,De=/checked\s*(?:[^=]|=\s*.checked.)/i,Ie=/^$|\/(?:java|ecma)script/i,Be=/^true\/(.*)/,Re=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,We={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,"",""]};We.optgroup=We.option,We.tbody=We.tfoot=We.colgroup=We.caption=We.thead,We.th=We.td,Z.extend({clone:function(t,e,n){var i,r,o,a,s=t.cloneNode(!0),l=Z.contains(t.ownerDocument,t);if(!(Y.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||Z.isXMLDoc(t)))for(a=v(s),o=v(t),i=0,r=o.length;r>i;i++)y(o[i],a[i]);if(e)if(n)for(o=o||v(t),a=a||v(s),i=0,r=o.length;r>i;i++)m(o[i],a[i]);else m(t,s);return a=v(s,"script"),a.length>0&&g(a,!l&&v(t,"script")),s},buildFragment:function(t,e,n,i){for(var r,o,a,s,l,u,c=e.createDocumentFragment(),h=[],d=0,f=t.length;f>d;d++)if(r=t[d],r||0===r)if("object"===Z.type(r))Z.merge(h,r.nodeType?[r]:r);else if(Ae.test(r)){for(o=o||c.appendChild(e.createElement("div")),a=(Pe.exec(r)||["",""])[1].toLowerCase(),s=We[a]||We._default,o.innerHTML=s[1]+r.replace(Ne,"<$1></$2>")+s[2],u=s[0];u--;)o=o.lastChild;Z.merge(h,o.childNodes),o=c.firstChild,o.textContent=""}else h.push(e.createTextNode(r));for(c.textContent="",d=0;r=h[d++];)if((!i||-1===Z.inArray(r,i))&&(l=Z.contains(r.ownerDocument,r),o=v(c.appendChild(r),"script"),l&&g(o),n))for(u=0;r=o[u++];)Ie.test(r.type||"")&&n.push(r);return c},cleanData:function(t){for(var e,n,i,r,o=Z.event.special,a=0;void 0!==(n=t[a]);a++){if(Z.acceptData(n)&&(r=n[ve.expando],r&&(e=ve.cache[r]))){if(e.events)for(i in e.events)o[i]?Z.event.remove(n,i):Z.removeEvent(n,i,e.handle);ve.cache[r]&&delete ve.cache[r]}delete ye.cache[n[ye.expando]]}}}),Z.fn.extend({text:function(t){return me(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=d(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=d(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 n,i=t?Z.filter(t,this):this,r=0;null!=(n=i[r]);r++)e||1!==n.nodeType||Z.cleanData(v(n)),n.parentNode&&(e&&Z.contains(n.ownerDocument,n)&&g(v(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(Z.cleanData(v(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 me(this,function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Oe.test(t)&&!We[(Pe.exec(t)||["",""])[1].toLowerCase()]){t=t.replace(Ne,"<$1></$2>");try{for(;i>n;n++)e=this[n]||{},1===e.nodeType&&(Z.cleanData(v(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(v(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=U.apply([],t);var n,i,r,o,a,s,l=0,u=this.length,c=this,h=u-1,d=t[0],g=Z.isFunction(d);if(g||u>1&&"string"==typeof d&&!Y.checkClone&&De.test(d))return this.each(function(n){var i=c.eq(n);g&&(t[0]=d.call(this,n,i.html())),i.domManip(t,e)});if(u&&(n=Z.buildFragment(t,this[0].ownerDocument,!1,this),i=n.firstChild,1===n.childNodes.length&&(n=i),i)){for(r=Z.map(v(n,"script"),f),o=r.length;u>l;l++)a=n,l!==h&&(a=Z.clone(a,!0,!0),o&&Z.merge(r,v(a,"script"))),e.call(this[l],a,l);if(o)for(s=r[r.length-1].ownerDocument,Z.map(r,p),l=0;o>l;l++)a=r[l],Ie.test(a.type||"")&&!ve.access(a,"globalEval")&&Z.contains(s,a)&&(a.src?Z._evalUrl&&Z._evalUrl(a.src):Z.globalEval(a.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 n,i=[],r=Z(t),o=r.length-1,a=0;o>=a;a++)n=a===o?this:this.clone(!0),Z(r[a])[e](n),K.apply(i,n.get());return this.pushStack(i)}});var He,Ve={},ze=/^margin/,Fe=new RegExp("^("+xe+")(?!px)[a-z%]+$","i"),je=function(t){return t.ownerDocument.defaultView.getComputedStyle(t,null)};!function(){function e(){a.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",a.innerHTML="",r.appendChild(o);var e=t.getComputedStyle(a,null);n="1%"!==e.top,i="4px"===e.width,r.removeChild(o)}var n,i,r=Q.documentElement,o=Q.createElement("div"),a=Q.createElement("div");a.style&&(a.style.backgroundClip="content-box",a.cloneNode(!0).style.backgroundClip="",Y.clearCloneStyle="content-box"===a.style.backgroundClip,o.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",o.appendChild(a),t.getComputedStyle&&Z.extend(Y,{pixelPosition:function(){return e(),n},boxSizingReliable:function(){return null==i&&e(),i},reliableMarginRight:function(){var e,n=a.appendChild(Q.createElement("div"));return n.style.cssText=a.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",n.style.marginRight=n.style.width="0",a.style.width="1px",r.appendChild(o),e=!parseFloat(t.getComputedStyle(n,null).marginRight),r.removeChild(o),e}}))}(),Z.swap=function(t,e,n,i){var r,o,a={};for(o in e)a[o]=t.style[o],t.style[o]=e[o];r=n.apply(t,i||[]);for(o in e)t.style[o]=a[o];return r};var Ue=/^(none|table(?!-c[ea]).+)/,Ke=new RegExp("^("+xe+")(.*)$","i"),qe=new RegExp("^([+-])=("+xe+")","i"),$e={position:"absolute",visibility:"hidden",display:"block"},Ge={letterSpacing:"0",fontWeight:"400"},Xe=["Webkit","O","Moz","ms"];Z.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=x(t,"opacity");return""===n?"1":n}}}},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,n,i){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var r,o,a,s=Z.camelCase(e),l=t.style;return e=Z.cssProps[s]||(Z.cssProps[s]=k(l,s)),a=Z.cssHooks[e]||Z.cssHooks[s],void 0===n?a&&"get"in a&&void 0!==(r=a.get(t,!1,i))?r:l[e]:(o=typeof n,"string"===o&&(r=qe.exec(n))&&(n=(r[1]+1)*r[2]+parseFloat(Z.css(t,e)),o="number"),null!=n&&n===n&&("number"!==o||Z.cssNumber[s]||(n+="px"),Y.clearCloneStyle||""!==n||0!==e.indexOf("background")||(l[e]="inherit"),a&&"set"in a&&void 0===(n=a.set(t,n,i))||(l[e]=n)),void 0)}},css:function(t,e,n,i){var r,o,a,s=Z.camelCase(e);return e=Z.cssProps[s]||(Z.cssProps[s]=k(t.style,s)),a=Z.cssHooks[e]||Z.cssHooks[s],a&&"get"in a&&(r=a.get(t,!0,n)),void 0===r&&(r=x(t,e,i)),"normal"===r&&e in Ge&&(r=Ge[e]),""===n||n?(o=parseFloat(r),n===!0||Z.isNumeric(o)?o||0:r):r}}),Z.each(["height","width"],function(t,e){Z.cssHooks[e]={get:function(t,n,i){return n?Ue.test(Z.css(t,"display"))&&0===t.offsetWidth?Z.swap(t,$e,function(){return T(t,e,i)}):T(t,e,i):void 0},set:function(t,n,i){var r=i&&je(t);return C(t,n,i?S(t,e,i,"border-box"===Z.css(t,"boxSizing",!1,r),r):0)}}}),Z.cssHooks.marginRight=w(Y.reliableMarginRight,function(t,e){return e?Z.swap(t,{display:"inline-block"},x,[t,"marginRight"]):void 0}),Z.each({margin:"",padding:"",border:"Width"},function(t,e){Z.cssHooks[t+e]={expand:function(n){for(var i=0,r={},o="string"==typeof n?n.split(" "):[n];4>i;i++)r[t+we[i]+e]=o[i]||o[i-2]||o[0];return r}},ze.test(t)||(Z.cssHooks[t+e].set=C)}),Z.fn.extend({css:function(t,e){return me(this,function(t,e,n){var i,r,o={},a=0;if(Z.isArray(e)){for(i=je(t),r=e.length;r>a;a++)o[e[a]]=Z.css(t,e[a],!1,i);return o}return void 0!==n?Z.style(t,e,n):Z.css(t,e)},t,e,arguments.length>1)},show:function(){return M(this,!0)},hide:function(){return M(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){ke(this)?Z(this).show():Z(this).hide()})}}),Z.Tween=L,L.prototype={constructor:L,init:function(t,e,n,i,r,o){this.elem=t,this.prop=n,this.easing=r||"swing",this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=o||(Z.cssNumber[n]?"":"px")},cur:function(){var t=L.propHooks[this.prop];return t&&t.get?t.get(this):L.propHooks._default.get(this)},run:function(t){var e,n=L.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),n&&n.set?n.set(this):L.propHooks._default.set(this),this}},L.prototype.init.prototype=L.prototype,L.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}}},L.propHooks.scrollTop=L.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=L.prototype.init,Z.fx.step={};var Ye,Qe,Je=/^(?:toggle|show|hide)$/,Ze=new RegExp("^(?:([+-])=|)("+xe+")([a-z%]*)$","i"),tn=/queueHooks$/,en=[A],nn={"*":[function(t,e){var n=this.createTween(t,e),i=n.cur(),r=Ze.exec(e),o=r&&r[3]||(Z.cssNumber[t]?"":"px"),a=(Z.cssNumber[t]||"px"!==o&&+i)&&Ze.exec(Z.css(n.elem,t)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],r=r||[],a=+i||1;do s=s||".5",a/=s,Z.style(n.elem,t,a+o);while(s!==(s=n.cur()/i)&&1!==s&&--l)}return r&&(a=n.start=+a||+i||0,n.unit=o,n.end=r[1]?a+(r[1]+1)*r[2]:+r[2]),n}]};Z.Animation=Z.extend(D,{tweener:function(t,e){Z.isFunction(t)?(e=t,t=["*"]):t=t.split(" ");for(var n,i=0,r=t.length;r>i;i++)n=t[i],nn[n]=nn[n]||[],nn[n].unshift(e)},prefilter:function(t,e){e?en.unshift(t):en.push(t)}}),Z.speed=function(t,e,n){var i=t&&"object"==typeof t?Z.extend({},t):{complete:n||!n&&e||Z.isFunction(t)&&t,duration:t,easing:n&&e||e&&!Z.isFunction(e)&&e};return i.duration=Z.fx.off?0:"number"==typeof i.duration?i.duration:i.duration in Z.fx.speeds?Z.fx.speeds[i.duration]:Z.fx.speeds._default,(null==i.queue||i.queue===!0)&&(i.queue="fx"),i.old=i.complete,i.complete=function(){Z.isFunction(i.old)&&i.old.call(this),i.queue&&Z.dequeue(this,i.queue)},i},Z.fn.extend({fadeTo:function(t,e,n,i){return this.filter(ke).css("opacity",0).show().end().animate({opacity:e},t,n,i)},animate:function(t,e,n,i){var r=Z.isEmptyObject(t),o=Z.speed(e,n,i),a=function(){var e=D(this,Z.extend({},t),o);
|
||
(r||ve.get(this,"finish"))&&e.stop(!0)};return a.finish=a,r||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(t,e,n){var i=function(t){var e=t.stop;delete t.stop,e(n)};return"string"!=typeof t&&(n=e,e=t,t=void 0),e&&t!==!1&&this.queue(t||"fx",[]),this.each(function(){var e=!0,r=null!=t&&t+"queueHooks",o=Z.timers,a=ve.get(this);if(r)a[r]&&a[r].stop&&i(a[r]);else for(r in a)a[r]&&a[r].stop&&tn.test(r)&&i(a[r]);for(r=o.length;r--;)o[r].elem!==this||null!=t&&o[r].queue!==t||(o[r].anim.stop(n),e=!1,o.splice(r,1));(e||!n)&&Z.dequeue(this,t)})},finish:function(t){return t!==!1&&(t=t||"fx"),this.each(function(){var e,n=ve.get(this),i=n[t+"queue"],r=n[t+"queueHooks"],o=Z.timers,a=i?i.length:0;for(n.finish=!0,Z.queue(this,t,[]),r&&r.stop&&r.stop.call(this,!0),e=o.length;e--;)o[e].elem===this&&o[e].queue===t&&(o[e].anim.stop(!0),o.splice(e,1));for(e=0;a>e;e++)i[e]&&i[e].finish&&i[e].finish.call(this);delete n.finish})}}),Z.each(["toggle","show","hide"],function(t,e){var n=Z.fn[e];Z.fn[e]=function(t,i,r){return null==t||"boolean"==typeof t?n.apply(this,arguments):this.animate(N(e,!0),t,i,r)}}),Z.each({slideDown:N("show"),slideUp:N("hide"),slideToggle:N("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){Z.fn[t]=function(t,n,i){return this.animate(e,t,n,i)}}),Z.timers=[],Z.fx.tick=function(){var t,e=0,n=Z.timers;for(Ye=Z.now();e<n.length;e++)t=n[e],t()||n[e]!==t||n.splice(e--,1);n.length||Z.fx.stop(),Ye=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(){Qe||(Qe=setInterval(Z.fx.tick,Z.fx.interval))},Z.fx.stop=function(){clearInterval(Qe),Qe=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,n){var i=setTimeout(e,t);n.stop=function(){clearTimeout(i)}})},function(){var t=Q.createElement("input"),e=Q.createElement("select"),n=e.appendChild(Q.createElement("option"));t.type="checkbox",Y.checkOn=""!==t.value,Y.optSelected=n.selected,e.disabled=!0,Y.optDisabled=!n.disabled,t=Q.createElement("input"),t.value="t",t.type="radio",Y.radioValue="t"===t.value}();var rn,on,an=Z.expr.attrHandle;Z.fn.extend({attr:function(t,e){return me(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,n){var i,r,o=t.nodeType;if(t&&3!==o&&8!==o&&2!==o)return typeof t.getAttribute===Se?Z.prop(t,e,n):(1===o&&Z.isXMLDoc(t)||(e=e.toLowerCase(),i=Z.attrHooks[e]||(Z.expr.match.bool.test(e)?on:rn)),void 0===n?i&&"get"in i&&null!==(r=i.get(t,e))?r:(r=Z.find.attr(t,e),null==r?void 0:r):null!==n?i&&"set"in i&&void 0!==(r=i.set(t,n,e))?r:(t.setAttribute(e,n+""),n):void Z.removeAttr(t,e))},removeAttr:function(t,e){var n,i,r=0,o=e&&e.match(fe);if(o&&1===t.nodeType)for(;n=o[r++];)i=Z.propFix[n]||n,Z.expr.match.bool.test(n)&&(t[i]=!1),t.removeAttribute(n)},attrHooks:{type:{set:function(t,e){if(!Y.radioValue&&"radio"===e&&Z.nodeName(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}}}),on={set:function(t,e,n){return e===!1?Z.removeAttr(t,n):t.setAttribute(n,n),n}},Z.each(Z.expr.match.bool.source.match(/\w+/g),function(t,e){var n=an[e]||Z.find.attr;an[e]=function(t,e,i){var r,o;return i||(o=an[e],an[e]=r,r=null!=n(t,e,i)?e.toLowerCase():null,an[e]=o),r}});var sn=/^(?:input|select|textarea|button)$/i;Z.fn.extend({prop:function(t,e){return me(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,n){var i,r,o,a=t.nodeType;if(t&&3!==a&&8!==a&&2!==a)return o=1!==a||!Z.isXMLDoc(t),o&&(e=Z.propFix[e]||e,r=Z.propHooks[e]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:t[e]=n:r&&"get"in r&&null!==(i=r.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){return t.hasAttribute("tabindex")||sn.test(t.nodeName)||t.href?t.tabIndex:-1}}}}),Y.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 ln=/[\t\r\n\f]/g;Z.fn.extend({addClass:function(t){var e,n,i,r,o,a,s="string"==typeof t&&t,l=0,u=this.length;if(Z.isFunction(t))return this.each(function(e){Z(this).addClass(t.call(this,e,this.className))});if(s)for(e=(t||"").match(fe)||[];u>l;l++)if(n=this[l],i=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(ln," "):" ")){for(o=0;r=e[o++];)i.indexOf(" "+r+" ")<0&&(i+=r+" ");a=Z.trim(i),n.className!==a&&(n.className=a)}return this},removeClass:function(t){var e,n,i,r,o,a,s=0===arguments.length||"string"==typeof t&&t,l=0,u=this.length;if(Z.isFunction(t))return this.each(function(e){Z(this).removeClass(t.call(this,e,this.className))});if(s)for(e=(t||"").match(fe)||[];u>l;l++)if(n=this[l],i=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(ln," "):"")){for(o=0;r=e[o++];)for(;i.indexOf(" "+r+" ")>=0;)i=i.replace(" "+r+" "," ");a=t?Z.trim(i):"",n.className!==a&&(n.className=a)}return this},toggleClass:function(t,e){var n=typeof t;return"boolean"==typeof e&&"string"===n?e?this.addClass(t):this.removeClass(t):this.each(Z.isFunction(t)?function(n){Z(this).toggleClass(t.call(this,n,this.className,e),e)}:function(){if("string"===n)for(var e,i=0,r=Z(this),o=t.match(fe)||[];e=o[i++];)r.hasClass(e)?r.removeClass(e):r.addClass(e);else(n===Se||"boolean"===n)&&(this.className&&ve.set(this,"__className__",this.className),this.className=this.className||t===!1?"":ve.get(this,"__className__")||"")})},hasClass:function(t){for(var e=" "+t+" ",n=0,i=this.length;i>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(ln," ").indexOf(e)>=0)return!0;return!1}});var un=/\r/g;Z.fn.extend({val:function(t){var e,n,i,r=this[0];{if(arguments.length)return i=Z.isFunction(t),this.each(function(n){var r;1===this.nodeType&&(r=i?t.call(this,n,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))});if(r)return e=Z.valHooks[r.type]||Z.valHooks[r.nodeName.toLowerCase()],e&&"get"in e&&void 0!==(n=e.get(r,"value"))?n:(n=r.value,"string"==typeof n?n.replace(un,""):null==n?"":n)}}}),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,n,i=t.options,r=t.selectedIndex,o="select-one"===t.type||0>r,a=o?null:[],s=o?r+1:i.length,l=0>r?s:o?r:0;s>l;l++)if(n=i[l],!(!n.selected&&l!==r||(Y.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&Z.nodeName(n.parentNode,"optgroup"))){if(e=Z(n).val(),o)return e;a.push(e)}return a},set:function(t,e){for(var n,i,r=t.options,o=Z.makeArray(e),a=r.length;a--;)i=r[a],(i.selected=Z.inArray(i.value,o)>=0)&&(n=!0);return n||(t.selectedIndex=-1),o}}}}),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}},Y.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,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}}),Z.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)},bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,i){return this.on(e,t,n,i)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)}});var cn=Z.now(),hn=/\?/;Z.parseJSON=function(t){return JSON.parse(t+"")},Z.parseXML=function(t){var e,n;if(!t||"string"!=typeof t)return null;try{n=new DOMParser,e=n.parseFromString(t,"text/xml")}catch(i){e=void 0}return(!e||e.getElementsByTagName("parsererror").length)&&Z.error("Invalid XML: "+t),e};var dn,fn,pn=/#.*$/,gn=/([?&])_=[^&]*/,mn=/^(.*?):[ \t]*([^\r\n]*)$/gm,vn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,yn=/^(?:GET|HEAD)$/,_n=/^\/\//,bn=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,xn={},wn={},kn="*/".concat("*");try{fn=location.href}catch(Cn){fn=Q.createElement("a"),fn.href="",fn=fn.href}dn=bn.exec(fn.toLowerCase())||[],Z.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fn,type:"GET",isLocal:vn.test(dn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":kn,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:I(xn),ajaxTransport:I(wn),ajax:function(t,e){function n(t,e,n,a){var l,c,v,y,b,w=e;2!==_&&(_=2,s&&clearTimeout(s),i=void 0,o=a||"",x.readyState=t>0?4:0,l=t>=200&&300>t||304===t,n&&(y=W(h,x,n)),y=H(h,y,x,l),l?(h.ifModified&&(b=x.getResponseHeader("Last-Modified"),b&&(Z.lastModified[r]=b),b=x.getResponseHeader("etag"),b&&(Z.etag[r]=b)),204===t||"HEAD"===h.type?w="nocontent":304===t?w="notmodified":(w=y.state,c=y.data,v=y.error,l=!v)):(v=w,(t||!w)&&(w="error",0>t&&(t=0))),x.status=t,x.statusText=(e||w)+"",l?p.resolveWith(d,[c,w,x]):p.rejectWith(d,[x,w,v]),x.statusCode(m),m=void 0,u&&f.trigger(l?"ajaxSuccess":"ajaxError",[x,h,l?c:v]),g.fireWith(d,[x,w]),u&&(f.trigger("ajaxComplete",[x,h]),--Z.active||Z.event.trigger("ajaxStop")))}"object"==typeof t&&(e=t,t=void 0),e=e||{};var i,r,o,a,s,l,u,c,h=Z.ajaxSetup({},e),d=h.context||h,f=h.context&&(d.nodeType||d.jquery)?Z(d):Z.event,p=Z.Deferred(),g=Z.Callbacks("once memory"),m=h.statusCode||{},v={},y={},_=0,b="canceled",x={readyState:0,getResponseHeader:function(t){var e;if(2===_){if(!a)for(a={};e=mn.exec(o);)a[e[1].toLowerCase()]=e[2];e=a[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===_?o:null},setRequestHeader:function(t,e){var n=t.toLowerCase();return _||(t=y[n]=y[n]||t,v[t]=e),this},overrideMimeType:function(t){return _||(h.mimeType=t),this},statusCode:function(t){var e;if(t)if(2>_)for(e in t)m[e]=[m[e],t[e]];else x.always(t[x.status]);return this},abort:function(t){var e=t||b;return i&&i.abort(e),n(0,e),this}};if(p.promise(x).complete=g.add,x.success=x.done,x.error=x.fail,h.url=((t||h.url||fn)+"").replace(pn,"").replace(_n,dn[1]+"//"),h.type=e.method||e.type||h.method||h.type,h.dataTypes=Z.trim(h.dataType||"*").toLowerCase().match(fe)||[""],null==h.crossDomain&&(l=bn.exec(h.url.toLowerCase()),h.crossDomain=!(!l||l[1]===dn[1]&&l[2]===dn[2]&&(l[3]||("http:"===l[1]?"80":"443"))===(dn[3]||("http:"===dn[1]?"80":"443")))),h.data&&h.processData&&"string"!=typeof h.data&&(h.data=Z.param(h.data,h.traditional)),B(xn,h,e,x),2===_)return x;u=h.global,u&&0===Z.active++&&Z.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!yn.test(h.type),r=h.url,h.hasContent||(h.data&&(r=h.url+=(hn.test(r)?"&":"?")+h.data,delete h.data),h.cache===!1&&(h.url=gn.test(r)?r.replace(gn,"$1_="+cn++):r+(hn.test(r)?"&":"?")+"_="+cn++)),h.ifModified&&(Z.lastModified[r]&&x.setRequestHeader("If-Modified-Since",Z.lastModified[r]),Z.etag[r]&&x.setRequestHeader("If-None-Match",Z.etag[r])),(h.data&&h.hasContent&&h.contentType!==!1||e.contentType)&&x.setRequestHeader("Content-Type",h.contentType),x.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+kn+"; q=0.01":""):h.accepts["*"]);for(c in h.headers)x.setRequestHeader(c,h.headers[c]);if(h.beforeSend&&(h.beforeSend.call(d,x,h)===!1||2===_))return x.abort();b="abort";for(c in{success:1,error:1,complete:1})x[c](h[c]);if(i=B(wn,h,e,x)){x.readyState=1,u&&f.trigger("ajaxSend",[x,h]),h.async&&h.timeout>0&&(s=setTimeout(function(){x.abort("timeout")},h.timeout));try{_=1,i.send(v,n)}catch(w){if(!(2>_))throw w;n(-1,w)}}else n(-1,"No Transport");return x},getJSON:function(t,e,n){return Z.get(t,e,n,"json")},getScript:function(t,e){return Z.get(t,void 0,e,"script")}}),Z.each(["get","post"],function(t,e){Z[e]=function(t,n,i,r){return Z.isFunction(n)&&(r=r||i,i=n,n=void 0),Z.ajax({url:t,type:e,dataType:r,data:n,success:i})}}),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),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=Z.isFunction(t);return this.each(function(n){Z(this).wrapAll(e?t.call(this,n):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 Sn=/%20/g,Tn=/\[\]$/,Mn=/\r?\n/g,Ln=/^(?:submit|button|image|reset|file)$/i,En=/^(?:input|select|textarea|keygen)/i;Z.param=function(t,e){var n,i=[],r=function(t,e){e=Z.isFunction(e)?e():null==e?"":e,i[i.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(n in t)V(n,t[n],e,r);return i.join("&").replace(Sn,"+")},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")&&En.test(this.nodeName)&&!Ln.test(t)&&(this.checked||!Ce.test(t))}).map(function(t,e){var n=Z(this).val();return null==n?null:Z.isArray(n)?Z.map(n,function(t){return{name:e.name,value:t.replace(Mn,"\r\n")}}):{name:e.name,value:n.replace(Mn,"\r\n")}}).get()}}),Z.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(t){}};var Nn=0,Pn={},An={0:200,1223:204},On=Z.ajaxSettings.xhr();t.ActiveXObject&&Z(t).on("unload",function(){for(var t in Pn)Pn[t]()}),Y.cors=!!On&&"withCredentials"in On,Y.ajax=On=!!On,Z.ajaxTransport(function(t){var e;return Y.cors||On&&!t.crossDomain?{send:function(n,i){var r,o=t.xhr(),a=++Nn;if(o.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(r in t.xhrFields)o[r]=t.xhrFields[r];t.mimeType&&o.overrideMimeType&&o.overrideMimeType(t.mimeType),t.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(r in n)o.setRequestHeader(r,n[r]);e=function(t){return function(){e&&(delete Pn[a],e=o.onload=o.onerror=null,"abort"===t?o.abort():"error"===t?i(o.status,o.statusText):i(An[o.status]||o.status,o.statusText,"string"==typeof o.responseText?{text:o.responseText}:void 0,o.getAllResponseHeaders()))}},o.onload=e(),o.onerror=e("error"),e=Pn[a]=e("abort");try{o.send(t.hasContent&&t.data||null)}catch(s){if(e)throw s}},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,n;return{send:function(i,r){e=Z("<script>").prop({async:!0,charset:t.scriptCharset,src:t.url}).on("load error",n=function(t){e.remove(),n=null,t&&r("error"===t.type?404:200,t.type)}),Q.head.appendChild(e[0])},abort:function(){n&&n()}}}});var Dn=[],In=/(=)\?(?=&|$)|\?\?/;Z.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Dn.pop()||Z.expando+"_"+cn++;return this[t]=!0,t}}),Z.ajaxPrefilter("json jsonp",function(e,n,i){var r,o,a,s=e.jsonp!==!1&&(In.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&In.test(e.data)&&"data");return s||"jsonp"===e.dataTypes[0]?(r=e.jsonpCallback=Z.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(In,"$1"+r):e.jsonp!==!1&&(e.url+=(hn.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return a||Z.error(r+" was not called"),a[0]},e.dataTypes[0]="json",o=t[r],t[r]=function(){a=arguments},i.always(function(){t[r]=o,e[r]&&(e.jsonpCallback=n.jsonpCallback,Dn.push(r)),a&&Z.isFunction(o)&&o(a[0]),a=o=void 0}),"script"):void 0}),Z.parseHTML=function(t,e,n){if(!t||"string"!=typeof t)return null;"boolean"==typeof e&&(n=e,e=!1),e=e||Q;var i=ae.exec(t),r=!n&&[];return i?[e.createElement(i[1])]:(i=Z.buildFragment([t],e,r),r&&r.length&&Z(r).remove(),Z.merge([],i.childNodes))};var Bn=Z.fn.load;Z.fn.load=function(t,e,n){if("string"!=typeof t&&Bn)return Bn.apply(this,arguments);var i,r,o,a=this,s=t.indexOf(" ");return s>=0&&(i=Z.trim(t.slice(s)),t=t.slice(0,s)),Z.isFunction(e)?(n=e,e=void 0):e&&"object"==typeof e&&(r="POST"),a.length>0&&Z.ajax({url:t,type:r,dataType:"html",data:e}).done(function(t){o=arguments,a.html(i?Z("<div>").append(Z.parseHTML(t)).find(i):t)}).complete(n&&function(t,e){a.each(n,o||[t.responseText,e,t])}),this},Z.expr.filters.animated=function(t){return Z.grep(Z.timers,function(e){return t===e.elem}).length};var Rn=t.document.documentElement;Z.offset={setOffset:function(t,e,n){var i,r,o,a,s,l,u,c=Z.css(t,"position"),h=Z(t),d={};"static"===c&&(t.style.position="relative"),s=h.offset(),o=Z.css(t,"top"),l=Z.css(t,"left"),u=("absolute"===c||"fixed"===c)&&(o+l).indexOf("auto")>-1,u?(i=h.position(),a=i.top,r=i.left):(a=parseFloat(o)||0,r=parseFloat(l)||0),Z.isFunction(e)&&(e=e.call(t,n,s)),null!=e.top&&(d.top=e.top-s.top+a),null!=e.left&&(d.left=e.left-s.left+r),"using"in e?e.using.call(t,d):h.css(d)}},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,n,i=this[0],r={top:0,left:0},o=i&&i.ownerDocument;if(o)return e=o.documentElement,Z.contains(e,i)?(typeof i.getBoundingClientRect!==Se&&(r=i.getBoundingClientRect()),n=z(o),{top:r.top+n.pageYOffset-e.clientTop,left:r.left+n.pageXOffset-e.clientLeft}):r},position:function(){if(this[0]){var t,e,n=this[0],i={top:0,left:0};return"fixed"===Z.css(n,"position")?e=n.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),Z.nodeName(t[0],"html")||(i=t.offset()),i.top+=Z.css(t[0],"borderTopWidth",!0),i.left+=Z.css(t[0],"borderLeftWidth",!0)),{top:e.top-i.top-Z.css(n,"marginTop",!0),left:e.left-i.left-Z.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||Rn;t&&!Z.nodeName(t,"html")&&"static"===Z.css(t,"position");)t=t.offsetParent;return t||Rn})}}),Z.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var i="pageYOffset"===n;Z.fn[e]=function(r){return me(this,function(e,r,o){var a=z(e);return void 0===o?a?a[n]:e[r]:void(a?a.scrollTo(i?t.pageXOffset:o,i?o:t.pageYOffset):e[r]=o)},e,r,arguments.length,null)}}),Z.each(["top","left"],function(t,e){Z.cssHooks[e]=w(Y.pixelPosition,function(t,n){return n?(n=x(t,e),Fe.test(n)?Z(t).position()[e]+"px":n):void 0})}),Z.each({Height:"height",Width:"width"},function(t,e){Z.each({padding:"inner"+t,content:e,"":"outer"+t},function(n,i){Z.fn[i]=function(i,r){var o=arguments.length&&(n||"boolean"!=typeof i),a=n||(i===!0||r===!0?"margin":"border");return me(this,function(e,n,i){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===i?Z.css(e,n,a):Z.style(e,n,i,a)},e,o?i:void 0,o,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 Wn=t.jQuery,Hn=t.$;return Z.noConflict=function(e){return t.$===Z&&(t.$=Hn),e&&t.jQuery===Z&&(t.jQuery=Wn),Z},typeof e===Se&&(t.jQuery=t.$=Z),Z}),function(){var t,e,n,i;!function(){var r={},o={};t=function(t,e,n){r[t]={deps:e,callback:n}},i=n=e=function(t){function n(e){if("."!==e.charAt(0))return e;for(var n=e.split("/"),i=t.split("/").slice(0,-1),r=0,o=n.length;o>r;r++){var a=n[r];if(".."===a)i.pop();else{if("."===a)continue;i.push(a)}}return i.join("/")}if(i._eak_seen=r,o[t])return o[t];if(o[t]={},!r[t])throw new Error("Could not find module "+t);for(var a,s=r[t],l=s.deps,u=s.callback,c=[],h=0,d=l.length;d>h;h++)c.push("exports"===l[h]?a={}:e(n(l[h])));var f=u.apply(this,c);return o[t]=a||f}}(),t("promise/all",["./utils","exports"],function(t,e){"use strict";function n(t){var e=this;if(!i(t))throw new TypeError("You must pass an array to all.");return new e(function(e,n){function i(t){return function(e){o(t,e)}}function o(t,n){s[t]=n,0===--l&&e(s)}var a,s=[],l=t.length;0===l&&e([]);for(var u=0;u<t.length;u++)a=t[u],a&&r(a.then)?a.then(i(u),n):o(u,a)})}var i=t.isArray,r=t.isFunction;e.all=n}),t("promise/asap",["exports"],function(t){"use strict";function e(){return function(){process.nextTick(r)}}function n(){var t=0,e=new l(r),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function i(){return function(){u.setTimeout(r,1)}}function r(){for(var t=0;t<c.length;t++){var e=c[t],n=e[0],i=e[1];n(i)}c=[]}function o(t,e){var n=c.push([t,e]);1===n&&a()}var a,s="undefined"!=typeof window?window:{},l=s.MutationObserver||s.WebKitMutationObserver,u="undefined"!=typeof global?global:void 0===this?window:this,c=[];a="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?e():l?n():i(),t.asap=o}),t("promise/config",["exports"],function(t){"use strict";function e(t,e){return 2!==arguments.length?n[t]:void(n[t]=e)}var n={instrument:!1};t.config=n,t.configure=e}),t("promise/polyfill",["./promise","./utils","exports"],function(t,e,n){"use strict";function i(){var t;t="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;"Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),o(e)}();t.Promise=r}var r=t.Promise,o=e.isFunction;n.polyfill=i}),t("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(t,e,n,i,r,o,a,s){"use strict";function l(t){if(!x(t))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof l))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],u(t,this)}function u(t,e){function n(t){p(e,t)}function i(t){m(e,t)}try{t(n,i)}catch(r){i(r)}}function c(t,e,n,i){var r,o,a,s,l=x(n);if(l)try{r=n(i),a=!0}catch(u){s=!0,o=u}else r=i,a=!0;f(e,r)||(l&&a?p(e,r):s?m(e,o):t===E?p(e,r):t===N&&m(e,r))}function h(t,e,n,i){var r=t._subscribers,o=r.length;r[o]=e,r[o+E]=n,r[o+N]=i}function d(t,e){for(var n,i,r=t._subscribers,o=t._detail,a=0;a<r.length;a+=3)n=r[a],i=r[a+e],c(e,n,i,o);t._subscribers=null}function f(t,e){var n,i=null;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(b(e)&&(i=e.then,x(i)))return i.call(e,function(i){return n?!0:(n=!0,void(e!==i?p(t,i):g(t,i)))},function(e){return n?!0:(n=!0,void m(t,e))}),!0}catch(r){return n?!0:(m(t,r),!0)}return!1}function p(t,e){t===e?g(t,e):f(t,e)||g(t,e)}function g(t,e){t._state===M&&(t._state=L,t._detail=e,_.async(v,t))}function m(t,e){t._state===M&&(t._state=L,t._detail=e,_.async(y,t))}function v(t){d(t,t._state=E)}function y(t){d(t,t._state=N)}var _=t.config,b=(t.configure,e.objectOrFunction),x=e.isFunction,w=(e.now,n.all),k=i.race,C=r.resolve,S=o.reject,T=a.asap;_.async=T;var M=void 0,L=0,E=1,N=2;l.prototype={constructor:l,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(t,e){var n=this,i=new this.constructor(function(){});if(this._state){var r=arguments;_.async(function(){c(n._state,i,r[n._state-1],n._detail)})}else h(this,i,t,e);return i},"catch":function(t){return this.then(null,t)}},l.all=w,l.race=k,l.resolve=C,l.reject=S,s.Promise=l}),t("promise/race",["./utils","exports"],function(t,e){"use strict";function n(t){var e=this;if(!i(t))throw new TypeError("You must pass an array to race.");return new e(function(e,n){for(var i,r=0;r<t.length;r++)i=t[r],i&&"function"==typeof i.then?i.then(e,n):e(i)})}var i=t.isArray;e.race=n}),t("promise/reject",["exports"],function(t){"use strict";function e(t){var e=this;return new e(function(e,n){n(t)})}t.reject=e}),t("promise/resolve",["exports"],function(t){"use strict";function e(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=this;return new e(function(e){e(t)})}t.resolve=e}),t("promise/utils",["exports"],function(t){"use strict";function e(t){return n(t)||"object"==typeof t&&null!==t}function n(t){return"function"==typeof t}function i(t){return"[object Array]"===Object.prototype.toString.call(t)}var r=Date.now||function(){return(new Date).getTime()};t.objectOrFunction=e,t.isFunction=n,t.isArray=i,t.now=r}),e("promise/polyfill").polyfill()}(),window.jQuery&&function(t){t.extend({xml2json:function(e,n){function i(e,a){if(!e)return null;{var s="",l=null,u=null;e.nodeType,r(e.localName||e.nodeName),e.text||e.nodeValue||""}e.childNodes&&e.childNodes.length>0&&t.each(e.childNodes,function(t,e){var n=e.nodeType,a=r(e.localName||e.nodeName),u=e.text||e.nodeValue||"";if(8!=n)if(3!=n&&4!=n&&a)l=l||{},l[a]?(l[a].length||(l[a]=o(l[a])),l[a]=o(l[a]),l[a][l[a].length]=i(e,!0),l[a].length=l[a].length):l[a]=i(e);else{if(u.match(/^\s+$/))return;s+=u.replace(/^\s+/,"").replace(/\s+$/,"")}}),e.attributes&&e.attributes.length>0&&(u={},l=l||{},t.each(e.attributes,function(t,e){var n=r(e.name),i=e.value;u[n]=i,l[n]?(l[cnn]=o(l[cnn]),l[n][l[n].length]=i,l[n].length=l[n].length):l[n]=i})),l&&(l=t.extend(""!=s?new String(s):{},l||{}),s=l.text?[l.text||""].concat([s]):s,s&&(l.text=s),s="");var c=l||s;return n&&(s&&(c={}),s=c.text||s||"",s&&(c.text=s),a||(c=o(c))),c}if(!e)return{};var r=function(t){return String(t||"").replace(/-/g,"_")},o=function(e){return t.isArray(e)||(e=[e]),e.length=e.length,e};if("string"==typeof e&&(e=t.text2xml(e)),e.nodeType){if(3==e.nodeType||4==e.nodeType)return e.nodeValue;var a=9==e.nodeType?e.documentElement:e,s=i(a,!0);return e=null,a=null,s}},text2xml:function(e){return t.parseXML(e)}})}(jQuery),function(t,e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(t.jQuery)}(this,function(t){function e(t){if(t in h.style)return t;for(var e=["Moz","Webkit","O","ms"],n=t.charAt(0).toUpperCase()+t.substr(1),i=0;i<e.length;++i){var r=e[i]+n;if(r in h.style)return r}}function n(){return h.style[d.transform]="",h.style[d.transform]="rotateY(90deg)",""!==h.style[d.transform]}function i(t){return"string"==typeof t&&this.parse(t),this}function r(t,e,n){e===!0?t.queue(n):e?t.queue(e,n):t.each(function(){n.call(this)})}function o(e){var n=[];return t.each(e,function(e){e=t.camelCase(e),e=t.transit.propertyMap[e]||t.cssProps[e]||e,e=l(e),d[e]&&(e=l(d[e])),-1===t.inArray(e,n)&&n.push(e)}),n}function a(e,n,i,r){var a=o(e);t.cssEase[i]&&(i=t.cssEase[i]);var s=""+c(n)+" "+i;parseInt(r,10)>0&&(s+=" "+c(r));var l=[];return t.each(a,function(t,e){l.push(e+" "+s)}),l.join(", ")}function s(e,n){n||(t.cssNumber[e]=!0),t.transit.propertyMap[e]=d.transform,t.cssHooks[e]={get:function(n){var i=t(n).css("transit:transform");return i.get(e)},set:function(n,i){var r=t(n).css("transit:transform");r.setFromString(e,i),t(n).css({"transit:transform":r})}}}function l(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function u(t,e){return"string"!=typeof t||t.match(/^[\-0-9\.]+$/)?""+t+e:t}function c(e){var n=e;return"string"!=typeof n||n.match(/^[\-0-9\.]+/)||(n=t.fx.speeds[n]||t.fx.speeds._default),u(n,"ms")}t.transit={version:"0.9.12",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:!0,useTransitionEnd:!1};var h=document.createElement("div"),d={},f=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;d.transition=e("transition"),d.transitionDelay=e("transitionDelay"),d.transform=e("transform"),d.transformOrigin=e("transformOrigin"),d.filter=e("Filter"),d.transform3d=n();var p={transition:"transitionend",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"},g=d.transitionEnd=p[d.transition]||null;for(var m in d)d.hasOwnProperty(m)&&"undefined"==typeof t.support[m]&&(t.support[m]=d[m]);return h=null,t.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeInCubic:"cubic-bezier(.550,.055,.675,.190)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"},t.cssHooks["transit:transform"]={get:function(e){return t(e).data("transform")||new i},set:function(e,n){var r=n;r instanceof i||(r=new i(r)),e.style[d.transform]="WebkitTransform"!==d.transform||f?r.toString():r.toString(!0),t(e).data("transform",r)}},t.cssHooks.transform={set:t.cssHooks["transit:transform"].set},t.cssHooks.filter={get:function(t){return t.style[d.filter]},set:function(t,e){t.style[d.filter]=e}},t.fn.jquery<"1.8"&&(t.cssHooks.transformOrigin={get:function(t){return t.style[d.transformOrigin]},set:function(t,e){t.style[d.transformOrigin]=e}},t.cssHooks.transition={get:function(t){return t.style[d.transition]},set:function(t,e){t.style[d.transition]=e}}),s("scale"),s("scaleX"),s("scaleY"),s("translate"),s("rotate"),s("rotateX"),s("rotateY"),s("rotate3d"),s("perspective"),s("skewX"),s("skewY"),s("x",!0),s("y",!0),i.prototype={setFromString:function(t,e){var n="string"==typeof e?e.split(","):e.constructor===Array?e:[e];n.unshift(t),i.prototype.set.apply(this,n)},set:function(t){var e=Array.prototype.slice.apply(arguments,[1]);
|
||
this.setter[t]?this.setter[t].apply(this,e):this[t]=e.join(",")},get:function(t){return this.getter[t]?this.getter[t].apply(this):this[t]||0},setter:{rotate:function(t){this.rotate=u(t,"deg")},rotateX:function(t){this.rotateX=u(t,"deg")},rotateY:function(t){this.rotateY=u(t,"deg")},scale:function(t,e){void 0===e&&(e=t),this.scale=t+","+e},skewX:function(t){this.skewX=u(t,"deg")},skewY:function(t){this.skewY=u(t,"deg")},perspective:function(t){this.perspective=u(t,"px")},x:function(t){this.set("translate",t,null)},y:function(t){this.set("translate",null,t)},translate:function(t,e){void 0===this._translateX&&(this._translateX=0),void 0===this._translateY&&(this._translateY=0),null!==t&&void 0!==t&&(this._translateX=u(t,"px")),null!==e&&void 0!==e&&(this._translateY=u(e,"px")),this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var t=(this.scale||"1,1").split(",");return t[0]&&(t[0]=parseFloat(t[0])),t[1]&&(t[1]=parseFloat(t[1])),t[0]===t[1]?t[0]:t},rotate3d:function(){for(var t=(this.rotate3d||"0,0,0,0deg").split(","),e=0;3>=e;++e)t[e]&&(t[e]=parseFloat(t[e]));return t[3]&&(t[3]=u(t[3],"deg")),t}},parse:function(t){var e=this;t.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,n,i){e.setFromString(n,i)})},toString:function(t){var e=[];for(var n in this)if(this.hasOwnProperty(n)){if(!d.transform3d&&("rotateX"===n||"rotateY"===n||"perspective"===n||"transformOrigin"===n))continue;"_"!==n[0]&&e.push(t&&"scale"===n?n+"3d("+this[n]+",1)":t&&"translate"===n?n+"3d("+this[n]+",0)":n+"("+this[n]+")")}return e.join(" ")}},t.fn.transition=t.fn.transit=function(e,n,i,o){var s=this,l=0,u=!0,h=t.extend(!0,{},e);"function"==typeof n&&(o=n,n=void 0),"object"==typeof n&&(i=n.easing,l=n.delay||0,u="undefined"==typeof n.queue?!0:n.queue,o=n.complete,n=n.duration),"function"==typeof i&&(o=i,i=void 0),"undefined"!=typeof h.easing&&(i=h.easing,delete h.easing),"undefined"!=typeof h.duration&&(n=h.duration,delete h.duration),"undefined"!=typeof h.complete&&(o=h.complete,delete h.complete),"undefined"!=typeof h.queue&&(u=h.queue,delete h.queue),"undefined"!=typeof h.delay&&(l=h.delay,delete h.delay),"undefined"==typeof n&&(n=t.fx.speeds._default),"undefined"==typeof i&&(i=t.cssEase._default),n=c(n);var f=a(h,n,i,l),p=t.transit.enabled&&d.transition,m=p?parseInt(n,10)+parseInt(l,10):0;if(0===m){var v=function(t){s.css(h),o&&o.apply(s),t&&t()};return r(s,u,v),s}var y={},_=function(e){var n=!1,i=function(){n&&s.unbind(g,i),m>0&&s.each(function(){this.style[d.transition]=y[this]||null}),"function"==typeof o&&o.apply(s),"function"==typeof e&&e()};m>0&&g&&t.transit.useTransitionEnd?(n=!0,s.bind(g,i)):window.setTimeout(i,m),s.each(function(){m>0&&(this.style[d.transition]=f),t(this).css(h)})},b=function(t){this.offsetWidth,_(t)};return r(s,u,b),this},t.transit.getTransitionValue=a,t}),function(t){t.ajaxTransport("+*",function(t,e,n){return window.FormData&&(t.dataType&&("blob"===t.dataType||"arraybuffer"===t.dataType)||t.data&&(window.Blob&&t.data instanceof Blob||window.ArrayBuffer&&t.data instanceof ArrayBuffer))?{send:function(e,n){var i,r=new XMLHttpRequest,o=t.url||window.location.href,a=t.type||"GET",s=t.dataType||"text",l=t.data||null,u=t.async||!0;r.addEventListener("load",function(){var t,e={};t=r.status>=200&&r.status<300||304===r.status,t?e[s]=r.response:e.text=String.fromCharCode.apply(null,new Uint8Array(r.response)),n(r.status,r.statusText,e,r.getAllResponseHeaders())}),r.open(a,o,u),r.responseType=s;for(i in e)e.hasOwnProperty(i)&&r.setRequestHeader(i,e[i]);r.send(l)},abort:function(){n.abort()}}:void 0})}(window.jQuery),function(t){function e(){var t=-1,e=this;e.append=function(n){var i,r=e.table;for(i=0;i<n.length;i++)t=t>>>8^r[255&(t^n[i])]},e.get=function(){return~t}}function n(t,e,n){return t.slice?t.slice(e,e+n):t.webkitSlice?t.webkitSlice(e,e+n):t.mozSlice?t.mozSlice(e,e+n):t.msSlice?t.msSlice(e,e+n):void 0}function i(t,e){var n,i;return n=new ArrayBuffer(t),i=new Uint8Array(n),e&&i.set(e,0),{buffer:n,array:i,view:new DataView(n)}}function r(){}function o(t){function e(e,n){var o=new Blob([t],{type:"text/plain"});i=new s(o),i.init(function(){r.size=i.size,e()},n)}function n(t,e,n,r){i.readUint8Array(t,e,n,r)}var i,r=this;r.size=0,r.init=e,r.readUint8Array=n}function a(e){function n(t){for(var n=e.length;"="==e.charAt(n-1);)n--;o=e.indexOf(",")+1,a.size=Math.floor(.75*(n-o)),t()}function r(n,r,a){var s,l=i(r),u=4*Math.floor(n/3),c=4*Math.ceil((n+r)/3),h=t.atob(e.substring(u+o,c+o)),d=n-3*Math.floor(u/4);for(s=d;d+r>s;s++)l.array[s-d]=h.charCodeAt(s);a(l.array)}var o,a=this;a.size=0,a.init=n,a.readUint8Array=r}function s(t){function e(e){this.size=t.size,e()}function i(e,i,r,o){var a=new FileReader;a.onload=function(t){r(new Uint8Array(t.target.result))},a.onerror=o,a.readAsArrayBuffer(n(t,e,i))}var r=this;r.size=0,r.init=e,r.readUint8Array=i}function l(t){function e(e,n){var i;r.data?e():(i=new XMLHttpRequest,i.addEventListener("load",function(){r.size||(r.size=Number(i.getResponseHeader("Content-Length"))),r.data=new Uint8Array(i.response),e()},!1),i.addEventListener("error",n,!1),i.open("GET",t),i.responseType="arraybuffer",i.send())}function n(e,n){var i=new XMLHttpRequest;i.addEventListener("load",function(){r.size=Number(i.getResponseHeader("Content-Length")),e()},!1),i.addEventListener("error",n,!1),i.open("HEAD",t),i.send()}function i(t,n,i,o){e(function(){i(new Uint8Array(r.data.subarray(t,t+n)))},o)}var r=this;r.size=0,r.init=n,r.readUint8Array=i}function u(t){function e(e,n){var i=new XMLHttpRequest;i.addEventListener("load",function(){r.size=Number(i.getResponseHeader("Content-Length")),"bytes"==i.getResponseHeader("Accept-Ranges")?e():n(W)},!1),i.addEventListener("error",n,!1),i.open("HEAD",t),i.send()}function n(e,n,i,r){var o=new XMLHttpRequest;o.open("GET",t),o.responseType="arraybuffer",o.setRequestHeader("Range","bytes="+e+"-"+(e+n-1)),o.addEventListener("load",function(){i(o.response)},!1),o.addEventListener("error",r,!1),o.send()}function i(t,e,i,r){n(t,e,function(t){i(new Uint8Array(t))},r)}var r=this;r.size=0,r.init=e,r.readUint8Array=i}function c(){}function h(){function t(t){i=new Blob([],{type:"text/plain"}),t()}function e(t,e){i=new Blob([i,E?t:t.buffer],{type:"text/plain"}),e()}function n(t,e){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.onerror=e,n.readAsText(i)}var i,r=this;r.init=t,r.writeUint8Array=e,r.getData=n}function d(e){function n(t){a+="data:"+(e||"")+";base64,",t()}function i(e,n){var i,r=s.length,o=s;for(s="",i=0;i<3*Math.floor((r+e.length)/3)-r;i++)o+=String.fromCharCode(e[i]);for(;i<e.length;i++)s+=String.fromCharCode(e[i]);o.length>2?a+=t.btoa(o):s=o,n()}function r(e){e(a+t.btoa(s))}var o=this,a="",s="";o.init=n,o.writeUint8Array=i,o.getData=r}function f(t,e){function n(e,n){t.createWriter(function(t){o=t,e()},n)}function i(t,n,i){var r=new Blob([E?t:t.buffer],{type:e});o.onwrite=function(){o.onwrite=null,n()},o.onerror=i,o.write(r)}function r(e){t.file(e)}var o,a=this;a.init=n,a.writeUint8Array=i,a.getData=r}function p(t){function e(e){r=new Blob([],{type:t}),e()}function n(e,n){r=new Blob([r,E?e:e.buffer],{type:t}),n()}function i(t){t(r)}var r,o=this;o.init=e,o.writeUint8Array=n,o.getData=i}function g(t,e,n,i,r,o,a,s,l,u){function c(){t.removeEventListener("message",h,!1),s(p)}function h(t){var e=t.data,i=e.data;e.onappend&&(p+=i.length,n.writeUint8Array(i,function(){o(!1,i),d()},u)),e.onflush&&(i?(p+=i.length,n.writeUint8Array(i,function(){o(!1,i),c()},u)):c()),e.progress&&a&&a(f+e.current,r)}function d(){f=g*H,r>f?e.readUint8Array(i+f,Math.min(H,r-f),function(e){t.postMessage({append:!0,data:e}),g++,a&&a(f,r),o(!0,e)},l):t.postMessage({flush:!0})}var f,p,g=0;p=0,t.addEventListener("message",h,!1),d()}function m(t,e,n,i,r,o,a,s,l,u){function c(){var p;h=d*H,r>h?e.readUint8Array(i+h,Math.min(H,r-h),function(e){var s=t.append(e,function(){a&&a(i+h,r)});f+=s.length,o(!0,e),n.writeUint8Array(s,function(){o(!1,s),d++,setTimeout(c,1)},u),a&&a(h,r)},l):(p=t.flush(),p?(f+=p.length,n.writeUint8Array(p,function(){o(!1,p),s(f)},u)):s(f))}var h,d=0,f=0;c()}function v(n,i,r,o,a,s,l,u,c){function h(t,e){a&&!t&&p.append(e)}function d(t){s(t,p.get())}var f,p=new e;return t.zip.useWebWorkers?(f=new Worker(t.zip.inflateJSPath||V),g(f,n,i,r,o,h,l,d,u,c)):m(new t.zip.Inflater,n,i,r,o,h,l,d,u,c),f}function y(n,i,r,o,a,s,l){function u(t,e){t&&f.append(e)}function c(t){o(t,f.get())}function h(){d.removeEventListener("message",h,!1),g(d,n,i,0,n.size,u,a,c,s,l)}var d,f=new e;return t.zip.useWebWorkers?(d=new Worker(t.zip.workerScriptsPath+z),d.addEventListener("message",h,!1),d.postMessage({init:!0,level:r})):m(new t.zip.Deflater,n,i,0,n.size,u,a,c,s,l),d}function _(t,n,i,r,o,a,s,l,u){function c(){var e=h*H;r>e?t.readUint8Array(i+e,Math.min(H,r-e),function(t){o&&d.append(t),s&&s(e,r,t),n.writeUint8Array(t,function(){h++,c()},u)},l):a(r,d.get())}var h=0,d=new e;c()}function b(t){var e,n,i="",r=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];for(e=0;e<t.length;e++)n=255&t.charCodeAt(e),i+=n>127?r[n-128]:String.fromCharCode(n);return i}function x(t){var e=[],n=0,i=0,r=0,o=0,a=0;for(t+="";n<t.length;)r=t.charCodeAt(n),128>r?(e[i++]=String.fromCharCode(r),n++):r>191&&224>r?(o=t.charCodeAt(n+1),e[i++]=String.fromCharCode((31&r)<<6|63&o),n+=2):(o=t.charCodeAt(n+1),a=t.charCodeAt(n+2),e[i++]=String.fromCharCode((15&r)<<12|(63&o)<<6|63&a),n+=3);return e.join("")}function w(t){var e,n="";for(e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return n}function k(t){var e=(4294901760&t)>>16,n=65535&t;try{return new Date(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(i){}}function C(t,e,n,i,r){return t.version=e.view.getUint16(n,!0),t.bitFlag=e.view.getUint16(n+2,!0),t.compressionMethod=e.view.getUint16(n+4,!0),t.lastModDateRaw=e.view.getUint32(n+6,!0),t.lastModDate=k(t.lastModDateRaw),1===(1&t.bitFlag)?void r(P):((i||8!=(8&t.bitFlag))&&(t.crc32=e.view.getUint32(n+10,!0),t.compressedSize=e.view.getUint32(n+14,!0),t.uncompressedSize=e.view.getUint32(n+18,!0)),4294967295===t.compressedSize||4294967295===t.uncompressedSize?void r(A):(t.filenameLength=e.view.getUint16(n+22,!0),void(t.extraFieldLength=e.view.getUint16(n+24,!0))))}function S(t,e){function n(){}function r(n,o){t.readUint8Array(t.size-n,n,function(t){var a=i(t.length,t).view;try{1347093766!=a.getUint32(0)?r(n+1,o):o(a)}catch(s){e(O)}},function(){e(O)})}return n.prototype.getData=function(n,r,o,a){function s(t,e){d&&d.terminate(),d=null,t&&t(e)}function l(t){var e=i(4);return e.view.setUint32(0,t),f.crc32==e.view.getUint32(0)}function u(t,e){a&&!l(e)?c():n.getData(function(t){s(r,t)})}function c(){s(e,B)}function h(){s(e,I)}var d,f=this;t.readUint8Array(f.offset,30,function(r){var s,l=i(r.length,r);return 1347093252!=l.view.getUint32(0)?void e(N):(C(f,l,4,!1,function(t){e(t)}),s=f.offset+30+f.filenameLength+f.extraFieldLength,void n.init(function(){0===f.compressionMethod?_(t,n,s,f.compressedSize,a,u,o,c,h):d=v(t,n,s,f.compressedSize,a,u,o,c,h)},h))},c)},{getEntries:function(o){return t.size<22?void e(N):void r(22,function(r){var a,s;a=r.getUint32(16,!0),s=r.getUint16(8,!0),t.readUint8Array(a,t.size-a,function(t){var r,a,l,u,c=0,h=[],d=i(t.length,t);for(r=0;s>r;r++){if(a=new n,1347092738!=d.view.getUint32(c))return void e(N);C(a,d,c+6,!0,function(t){e(t)}),a.commentLength=d.view.getUint16(c+32,!0),a.directory=16==(16&d.view.getUint8(c+38)),a.offset=d.view.getUint32(c+42,!0),l=w(d.array.subarray(c+46,c+46+a.filenameLength)),a.filename=2048===(2048&a.bitFlag)?x(l):b(l),a.directory||"/"!=a.filename.charAt(a.filename.length-1)||(a.directory=!0),u=w(d.array.subarray(c+46+a.filenameLength+a.extraFieldLength,c+46+a.filenameLength+a.extraFieldLength+a.commentLength)),a.comment=2048===(2048&a.bitFlag)?x(u):b(u),h.push(a),c+=46+a.filenameLength+a.extraFieldLength+a.commentLength}o(h)},function(){e(O)})})},close:function(t){t&&t()}}}function T(t){var e,n,i,r=[],o=0,a=0,s=t.length;for(e=0;s>e;e++)n=t.charCodeAt(e),i=null,128>n?a++:i=n>127&&2048>n?String.fromCharCode(n>>6|192)+String.fromCharCode(63&n|128):String.fromCharCode(n>>12|224)+String.fromCharCode(n>>6&63|128)+String.fromCharCode(63&n|128),null!=i&&(a>o&&(r+=t.slice(o,a)),r+=i,o=a=e+1);return a>o&&(r+=t.slice(o,s)),r}function M(t){var e,n=[];for(e=0;e<t.length;e++)n.push(t.charCodeAt(e));return n}function L(t,e,n){function r(t,e){s&&s.terminate(),s=null,t&&t(e)}function o(){r(e,D)}function a(){r(e,B)}var s,l=[],u=[],c=0;return{add:function(e,h,d,f,p){function g(r){var a;w=p.lastModDate||new Date,b=i(26),l[e]={headerArray:b.array,directory:p.directory,filename:x,offset:c,comment:M(T(p.comment||""))},b.view.setUint32(0,335546376),p.version&&b.view.setUint8(0,p.version),n||0==p.level||p.directory||b.view.setUint16(4,2048),b.view.setUint16(6,(w.getHours()<<6|w.getMinutes())<<5|w.getSeconds()/2,!0),b.view.setUint16(8,(w.getFullYear()-1980<<4|w.getMonth()+1)<<5|w.getDate(),!0),b.view.setUint16(22,x.length,!0),a=i(30+x.length),a.view.setUint32(0,1347093252),a.array.set(b.array,4),a.array.set(x,30),c+=a.array.length,t.writeUint8Array(a.array,r,o)}function m(e,n){var a=i(16);c+=e||0,a.view.setUint32(0,1347094280),"undefined"!=typeof n&&(b.view.setUint32(10,n,!0),a.view.setUint32(4,n,!0)),h&&(a.view.setUint32(8,e,!0),b.view.setUint32(14,e,!0),a.view.setUint32(12,h.size,!0),b.view.setUint32(18,h.size,!0)),t.writeUint8Array(a.array,function(){c+=16,r(d)},o)}function v(){if(p=p||{},e=e.trim(),p.directory&&"/"!=e.charAt(e.length-1)&&(e+="/"),l[e])throw R;x=M(T(e)),u.push(e),g(function(){h?n||0==p.level?_(h,t,0,h.size,!0,m,f,a,o):s=y(h,t,p.level,m,f,a,o):m()},o)}var b,x,w;h?h.init(v,a):v()},close:function(e){var n,a=0,s=0;u.forEach(function(t){var e=l[t];a+=46+e.filename.length+e.comment.length}),n=i(a+22),u.forEach(function(t){var e=l[t];n.view.setUint32(s,1347092738),n.view.setUint16(s+4,5120),n.array.set(e.headerArray,s+6),n.view.setUint16(s+32,e.comment.length,!0),e.directory&&n.view.setUint8(s+38,16),n.view.setUint32(s+42,e.offset,!0),n.array.set(e.filename,s+46),n.array.set(e.comment,s+46+e.filename.length),s+=46+e.filename.length+e.comment.length}),n.view.setUint32(s,1347093766),n.view.setUint16(s+8,u.length,!0),n.view.setUint16(s+10,u.length,!0),n.view.setUint32(s+12,a,!0),n.view.setUint32(s+16,c,!0),t.writeUint8Array(n.array,function(){r(function(){t.getData(e)})},o)}}}var E,N="File format is not recognized.",P="File contains encrypted entry.",A="File is using Zip64 (4gb+ file size).",O="Error while reading zip file.",D="Error while writing zip file.",I="Error while writing file data.",B="Error while reading file data.",R="File already exists.",W="HTTP Range not supported.",H=524288,V="inflate.js",z="deflate.js";try{E=0==new Blob([i(0).view]).size}catch(F){}e.prototype.table=function(){var t,e,n,i=[];for(t=0;256>t;t++){for(n=t,e=0;8>e;e++)1&n?n=n>>>1^3988292384:n>>>=1;i[t]=n}return i}(),o.prototype=new r,o.prototype.constructor=o,a.prototype=new r,a.prototype.constructor=a,s.prototype=new r,s.prototype.constructor=s,l.prototype=new r,l.prototype.constructor=l,u.prototype=new r,u.prototype.constructor=u,c.prototype.getData=function(t){t(this.data)},h.prototype=new c,h.prototype.constructor=h,d.prototype=new c,d.prototype.constructor=d,f.prototype=new c,f.prototype.constructor=f,p.prototype=new c,p.prototype.constructor=p,t.zip={Reader:r,Writer:c,BlobReader:s,HttpReader:l,HttpRangeReader:u,Data64URIReader:a,TextReader:o,BlobWriter:p,FileWriter:f,Data64URIWriter:d,TextWriter:h,createReader:function(t,e,n){t.init(function(){e(S(t,n))},n)},createWriter:function(t,e,n,i){t.init(function(){e(L(t,n,i))},n)},workerScriptsPath:"",inflateJSPath:"",useWebWorkers:!0}}(this),!function(t,e){"use strict";var n,i,r=t,o=r.document,a=r.navigator,s=r.setTimeout,l=r.encodeURIComponent,u=r.ActiveXObject,c=r.Error,h=r.Number.parseInt||r.parseInt,d=r.Number.parseFloat||r.parseFloat,f=r.Number.isNaN||r.isNaN,p=r.Math.round,g=r.Date.now,m=r.Object.keys,v=r.Object.defineProperty,y=r.Object.prototype.hasOwnProperty,_=r.Array.prototype.slice,b=function(){var t=function(t){return t};if("function"==typeof r.wrap&&"function"==typeof r.unwrap)try{var e=o.createElement("div"),n=r.unwrap(e);1===e.nodeType&&n&&1===n.nodeType&&(t=r.unwrap)}catch(i){}return t}(),x=function(t){return _.call(t,0)},w=function(){var t,n,i,r,o,a,s=x(arguments),l=s[0]||{};for(t=1,n=s.length;n>t;t++)if(null!=(i=s[t]))for(r in i)y.call(i,r)&&(o=l[r],a=i[r],l!==a&&a!==e&&(l[r]=a));return l},k=function(t){var e,n,i,r;if("object"!=typeof t||null==t)e=t;else if("number"==typeof t.length)for(e=[],n=0,i=t.length;i>n;n++)y.call(t,n)&&(e[n]=k(t[n]));else{e={};for(r in t)y.call(t,r)&&(e[r]=k(t[r]))}return e},C=function(t,e){for(var n={},i=0,r=e.length;r>i;i++)e[i]in t&&(n[e[i]]=t[e[i]]);return n},S=function(t,e){var n={};for(var i in t)-1===e.indexOf(i)&&(n[i]=t[i]);return n},T=function(t){if(t)for(var e in t)y.call(t,e)&&delete t[e];return t},M=function(t,e){if(t&&1===t.nodeType&&t.ownerDocument&&e&&(1===e.nodeType&&e.ownerDocument&&e.ownerDocument===t.ownerDocument||9===e.nodeType&&!e.ownerDocument&&e===t.ownerDocument))do{if(t===e)return!0;t=t.parentNode}while(t);return!1},L=function(t){var e;return"string"==typeof t&&t&&(e=t.split("#")[0].split("?")[0],e=t.slice(0,t.lastIndexOf("/")+1)),e},E=function(t){var e,n;return"string"==typeof t&&t&&(n=t.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),n&&n[1]?e=n[1]:(n=t.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),n&&n[1]&&(e=n[1]))),e},N=function(){var t,e;try{throw new c}catch(n){e=n}return e&&(t=e.sourceURL||e.fileName||E(e.stack)),t},P=function(){var t,n,i;if(o.currentScript&&(t=o.currentScript.src))return t;if(n=o.getElementsByTagName("script"),1===n.length)return n[0].src||e;if("readyState"in n[0])for(i=n.length;i--;)if("interactive"===n[i].readyState&&(t=n[i].src))return t;return"loading"===o.readyState&&(t=n[n.length-1].src)?t:(t=N())?t:e},A=function(){var t,n,i,r=o.getElementsByTagName("script");for(t=r.length;t--;){if(!(i=r[t].src)){n=null;break}if(i=L(i),null==n)n=i;else if(n!==i){n=null;break}}return n||e},O=function(){var t=L(P())||A()||"";return t+"ZeroClipboard.swf"},D={bridge:null,version:"0.0.0",pluginType:"unknown",disabled:null,outdated:null,unavailable:null,deactivated:null,overdue:null,ready:null},I="11.0.0",B={},R={},W=null,H={ready:"Flash communication is established",error:{"flash-disabled":"Flash is disabled or not installed","flash-outdated":"Flash is too outdated to support ZeroClipboard","flash-unavailable":"Flash is unable to communicate bidirectionally with JavaScript","flash-deactivated":"Flash is too outdated for your browser and/or is configured as click-to-activate","flash-overdue":"Flash communication was established but NOT within the acceptable time limit"}},V={swfPath:O(),trustedDomains:t.location.host?[t.location.host]:[],cacheBust:!0,forceEnhancedClipboard:!1,flashLoadTimeout:3e4,autoActivate:!0,bubbleEvents:!0,containerId:"global-zeroclipboard-html-bridge",containerClass:"global-zeroclipboard-container",swfObjectId:"global-zeroclipboard-flash-bridge",hoverClass:"zeroclipboard-is-hover",activeClass:"zeroclipboard-is-active",forceHandCursor:!1,title:null,zIndex:999999999},z=function(t){if("object"==typeof t&&null!==t)for(var e in t)if(y.call(t,e))if(/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(e))V[e]=t[e];else if(null==D.bridge)if("containerId"===e||"swfObjectId"===e){if(!ne(t[e]))throw new Error("The specified `"+e+"` value is not valid as an HTML4 Element ID");V[e]=t[e]}else V[e]=t[e];return"string"==typeof t&&t?y.call(V,t)?V[t]:void 0:k(V)},F=function(){return{browser:C(a,["userAgent","platform","appName"]),flash:S(D,["bridge"]),zeroclipboard:{version:Pe.version,config:Pe.config()}}},j=function(){return!!(D.disabled||D.outdated||D.unavailable||D.deactivated)},U=function(t,e){var n,i,r,o={};if("string"==typeof t&&t)r=t.toLowerCase().split(/\s+/);else if("object"==typeof t&&t&&"undefined"==typeof e)for(n in t)y.call(t,n)&&"string"==typeof n&&n&&"function"==typeof t[n]&&Pe.on(n,t[n]);if(r&&r.length){for(n=0,i=r.length;i>n;n++)t=r[n].replace(/^on/,""),o[t]=!0,B[t]||(B[t]=[]),B[t].push(e);if(o.ready&&D.ready&&Pe.emit({type:"ready"}),o.error){var a=["disabled","outdated","unavailable","deactivated","overdue"];for(n=0,i=a.length;i>n;n++)if(D[a[n]]===!0){Pe.emit({type:"error",name:"flash-"+a[n]});break}}}return Pe},K=function(t,e){var n,i,r,o,a;if(0===arguments.length)o=m(B);else if("string"==typeof t&&t)o=t.split(/\s+/);else if("object"==typeof t&&t&&"undefined"==typeof e)for(n in t)y.call(t,n)&&"string"==typeof n&&n&&"function"==typeof t[n]&&Pe.off(n,t[n]);if(o&&o.length)for(n=0,i=o.length;i>n;n++)if(t=o[n].toLowerCase().replace(/^on/,""),a=B[t],a&&a.length)if(e)for(r=a.indexOf(e);-1!==r;)a.splice(r,1),r=a.indexOf(e,r);else a.length=0;return Pe},q=function(t){var e;return e="string"==typeof t&&t?k(B[t])||null:k(B)},$=function(t){var e,n,i;return t=ie(t),t&&!ue(t)?"ready"===t.type&&D.overdue===!0?Pe.emit({type:"error",name:"flash-overdue"}):(e=w({},t),le.call(this,e),"copy"===t.type&&(i=ge(R),n=i.data,W=i.formatMap),n):void 0},G=function(){if("boolean"!=typeof D.ready&&(D.ready=!1),!Pe.isFlashUnusable()&&null===D.bridge){var t=V.flashLoadTimeout;"number"==typeof t&&t>=0&&s(function(){"boolean"!=typeof D.deactivated&&(D.deactivated=!0),D.deactivated===!0&&Pe.emit({type:"error",name:"flash-deactivated"})},t),D.overdue=!1,fe()}},X=function(){Pe.clearData(),Pe.blur(),Pe.emit("destroy"),pe(),Pe.off()},Y=function(t,e){var n;if("object"==typeof t&&t&&"undefined"==typeof e)n=t,Pe.clearData();else{if("string"!=typeof t||!t)return;n={},n[t]=e}for(var i in n)"string"==typeof i&&i&&y.call(n,i)&&"string"==typeof n[i]&&n[i]&&(R[i]=n[i])},Q=function(t){"undefined"==typeof t?(T(R),W=null):"string"==typeof t&&y.call(R,t)&&delete R[t]},J=function(t){return"undefined"==typeof t?k(R):"string"==typeof t&&y.call(R,t)?R[t]:void 0},Z=function(t){if(t&&1===t.nodeType){n&&(ke(n,V.activeClass),n!==t&&ke(n,V.hoverClass)),n=t,we(t,V.hoverClass);var e=t.getAttribute("title")||V.title;if("string"==typeof e&&e){var i=de(D.bridge);i&&i.setAttribute("title",e)}var r=V.forceHandCursor===!0||"pointer"===Ce(t,"cursor");Le(r),Me()}},te=function(){var t=de(D.bridge);t&&(t.removeAttribute("title"),t.style.left="0px",t.style.top="-9999px",t.style.width="1px",t.style.top="1px"),n&&(ke(n,V.hoverClass),ke(n,V.activeClass),n=null)},ee=function(){return n||null},ne=function(t){return"string"==typeof t&&t&&/^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(t)},ie=function(t){var e;if("string"==typeof t&&t?(e=t,t={}):"object"==typeof t&&t&&"string"==typeof t.type&&t.type&&(e=t.type),e){!t.target&&/^(copy|aftercopy|_click)$/.test(e.toLowerCase())&&(t.target=i),w(t,{type:e.toLowerCase(),target:t.target||n||null,relatedTarget:t.relatedTarget||null,currentTarget:D&&D.bridge||null,timeStamp:t.timeStamp||g()||null});var r=H[t.type];return"error"===t.type&&t.name&&r&&(r=r[t.name]),r&&(t.message=r),"ready"===t.type&&w(t,{target:null,version:D.version}),"error"===t.type&&(/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(t.name)&&w(t,{target:null,minimumVersion:I}),/^flash-(outdated|unavailable|deactivated|overdue)$/.test(t.name)&&w(t,{version:D.version})),"copy"===t.type&&(t.clipboardData={setData:Pe.setData,clearData:Pe.clearData}),"aftercopy"===t.type&&(t=me(t,W)),t.target&&!t.relatedTarget&&(t.relatedTarget=re(t.target)),t=oe(t)}},re=function(t){var e=t&&t.getAttribute&&t.getAttribute("data-clipboard-target");return e?o.getElementById(e):null},oe=function(t){if(t&&/^_(?:click|mouse(?:over|out|down|up|move))$/.test(t.type)){var n=t.target,i="_mouseover"===t.type&&t.relatedTarget?t.relatedTarget:e,a="_mouseout"===t.type&&t.relatedTarget?t.relatedTarget:e,s=Te(n),l=r.screenLeft||r.screenX||0,u=r.screenTop||r.screenY||0,c=o.body.scrollLeft+o.documentElement.scrollLeft,h=o.body.scrollTop+o.documentElement.scrollTop,d=s.left+("number"==typeof t._stageX?t._stageX:0),f=s.top+("number"==typeof t._stageY?t._stageY:0),p=d-c,g=f-h,m=l+p,v=u+g,y="number"==typeof t.movementX?t.movementX:0,_="number"==typeof t.movementY?t.movementY:0;delete t._stageX,delete t._stageY,w(t,{srcElement:n,fromElement:i,toElement:a,screenX:m,screenY:v,pageX:d,pageY:f,clientX:p,clientY:g,x:p,y:g,movementX:y,movementY:_,offsetX:0,offsetY:0,layerX:0,layerY:0})}return t},ae=function(t){var e=t&&"string"==typeof t.type&&t.type||"";return!/^(?:(?:before)?copy|destroy)$/.test(e)},se=function(t,e,n,i){i?s(function(){t.apply(e,n)},0):t.apply(e,n)},le=function(t){if("object"==typeof t&&t&&t.type){var e=ae(t),n=B["*"]||[],i=B[t.type]||[],o=n.concat(i);if(o&&o.length){var a,s,l,u,c,h=this;for(a=0,s=o.length;s>a;a++)l=o[a],u=h,"string"==typeof l&&"function"==typeof r[l]&&(l=r[l]),"object"==typeof l&&l&&"function"==typeof l.handleEvent&&(u=l,l=l.handleEvent),"function"==typeof l&&(c=w({},t),se(l,u,[c],e))}return this}},ue=function(t){var e=t.target||n||null,r="swf"===t._source;delete t._source;var o=["flash-disabled","flash-outdated","flash-unavailable","flash-deactivated","flash-overdue"];switch(t.type){case"error":-1!==o.indexOf(t.name)&&w(D,{disabled:"flash-disabled"===t.name,outdated:"flash-outdated"===t.name,unavailable:"flash-unavailable"===t.name,deactivated:"flash-deactivated"===t.name,overdue:"flash-overdue"===t.name,ready:!1});break;case"ready":var a=D.deactivated===!0;w(D,{disabled:!1,outdated:!1,unavailable:!1,deactivated:!1,overdue:a,ready:!a});break;case"beforecopy":i=e;break;case"copy":var s,l,u=t.relatedTarget;!R["text/html"]&&!R["text/plain"]&&u&&(l=u.value||u.outerHTML||u.innerHTML)&&(s=u.value||u.textContent||u.innerText)?(t.clipboardData.clearData(),t.clipboardData.setData("text/plain",s),l!==s&&t.clipboardData.setData("text/html",l)):!R["text/plain"]&&t.target&&(s=t.target.getAttribute("data-clipboard-text"))&&(t.clipboardData.clearData(),t.clipboardData.setData("text/plain",s));break;case"aftercopy":Pe.clearData(),e&&e!==xe()&&e.focus&&e.focus();break;case"_mouseover":Pe.focus(e),V.bubbleEvents===!0&&r&&(e&&e!==t.relatedTarget&&!M(t.relatedTarget,e)&&ce(w({},t,{type:"mouseenter",bubbles:!1,cancelable:!1})),ce(w({},t,{type:"mouseover"})));break;case"_mouseout":Pe.blur(),V.bubbleEvents===!0&&r&&(e&&e!==t.relatedTarget&&!M(t.relatedTarget,e)&&ce(w({},t,{type:"mouseleave",bubbles:!1,cancelable:!1})),ce(w({},t,{type:"mouseout"})));break;case"_mousedown":we(e,V.activeClass),V.bubbleEvents===!0&&r&&ce(w({},t,{type:t.type.slice(1)}));break;case"_mouseup":ke(e,V.activeClass),V.bubbleEvents===!0&&r&&ce(w({},t,{type:t.type.slice(1)}));break;case"_click":i=null,V.bubbleEvents===!0&&r&&ce(w({},t,{type:t.type.slice(1)}));break;case"_mousemove":V.bubbleEvents===!0&&r&&ce(w({},t,{type:t.type.slice(1)}))}return/^_(?:click|mouse(?:over|out|down|up|move))$/.test(t.type)?!0:void 0},ce=function(t){if(t&&"string"==typeof t.type&&t){var e,n=t.target||null,i=n&&n.ownerDocument||o,a={view:i.defaultView||r,canBubble:!0,cancelable:!0,detail:"click"===t.type?1:0,button:"number"==typeof t.which?t.which-1:"number"==typeof t.button?t.button:i.createEvent?0:1},s=w(a,t);n&&i.createEvent&&n.dispatchEvent&&(s=[s.type,s.canBubble,s.cancelable,s.view,s.detail,s.screenX,s.screenY,s.clientX,s.clientY,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.button,s.relatedTarget],e=i.createEvent("MouseEvents"),e.initMouseEvent&&(e.initMouseEvent.apply(e,s),e._source="js",n.dispatchEvent(e)))}},he=function(){var t=o.createElement("div");return t.id=V.containerId,t.className=V.containerClass,t.style.position="absolute",t.style.left="0px",t.style.top="-9999px",t.style.width="1px",t.style.height="1px",t.style.zIndex=""+Ee(V.zIndex),t},de=function(t){for(var e=t&&t.parentNode;e&&"OBJECT"===e.nodeName&&e.parentNode;)e=e.parentNode;return e||null},fe=function(){var t,e=D.bridge,n=de(e);if(!e){var i=be(r.location.host,V),a="never"===i?"none":"all",s=ye(V),l=V.swfPath+ve(V.swfPath,V);n=he();var u=o.createElement("div");n.appendChild(u),o.body.appendChild(n);var c=o.createElement("div"),h="activex"===D.pluginType;c.innerHTML='<object id="'+V.swfObjectId+'" name="'+V.swfObjectId+'" width="100%" height="100%" '+(h?'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"':'type="application/x-shockwave-flash" data="'+l+'"')+">"+(h?'<param name="movie" value="'+l+'"/>':"")+'<param name="allowScriptAccess" value="'+i+'"/><param name="allowNetworking" value="'+a+'"/><param name="menu" value="false"/><param name="wmode" value="transparent"/><param name="flashvars" value="'+s+'"/></object>',e=c.firstChild,c=null,b(e).ZeroClipboard=Pe,n.replaceChild(e,u)}return e||(e=o[V.swfObjectId],e&&(t=e.length)&&(e=e[t-1]),!e&&n&&(e=n.firstChild)),D.bridge=e||null,e},pe=function(){var t=D.bridge;if(t){var e=de(t);e&&("activex"===D.pluginType&&"readyState"in t?(t.style.display="none",function n(){if(4===t.readyState){for(var i in t)"function"==typeof t[i]&&(t[i]=null);t.parentNode&&t.parentNode.removeChild(t),e.parentNode&&e.parentNode.removeChild(e)}else s(n,10)}()):(t.parentNode&&t.parentNode.removeChild(t),e.parentNode&&e.parentNode.removeChild(e))),D.ready=null,D.bridge=null,D.deactivated=null}},ge=function(t){var e={},n={};if("object"==typeof t&&t){for(var i in t)if(i&&y.call(t,i)&&"string"==typeof t[i]&&t[i])switch(i.toLowerCase()){case"text/plain":case"text":case"air:text":case"flash:text":e.text=t[i],n.text=i;break;case"text/html":case"html":case"air:html":case"flash:html":e.html=t[i],n.html=i;break;case"application/rtf":case"text/rtf":case"rtf":case"richtext":case"air:rtf":case"flash:rtf":e.rtf=t[i],n.rtf=i}return{data:e,formatMap:n}}},me=function(t,e){if("object"!=typeof t||!t||"object"!=typeof e||!e)return t;var n={};for(var i in t)if(y.call(t,i)){if("success"!==i&&"data"!==i){n[i]=t[i];continue}n[i]={};var r=t[i];for(var o in r)o&&y.call(r,o)&&y.call(e,o)&&(n[i][e[o]]=r[o])}return n},ve=function(t,e){var n=null==e||e&&e.cacheBust===!0;return n?(-1===t.indexOf("?")?"?":"&")+"noCache="+g():""},ye=function(t){var e,n,i,o,a="",s=[];if(t.trustedDomains&&("string"==typeof t.trustedDomains?o=[t.trustedDomains]:"object"==typeof t.trustedDomains&&"length"in t.trustedDomains&&(o=t.trustedDomains)),o&&o.length)for(e=0,n=o.length;n>e;e++)if(y.call(o,e)&&o[e]&&"string"==typeof o[e]){if(i=_e(o[e]),!i)continue;if("*"===i){s.length=0,s.push(i);break}s.push.apply(s,[i,"//"+i,r.location.protocol+"//"+i])}return s.length&&(a+="trustedOrigins="+l(s.join(","))),t.forceEnhancedClipboard===!0&&(a+=(a?"&":"")+"forceEnhancedClipboard=true"),"string"==typeof t.swfObjectId&&t.swfObjectId&&(a+=(a?"&":"")+"swfObjectId="+l(t.swfObjectId)),a},_e=function(t){if(null==t||""===t)return null;if(t=t.replace(/^\s+|\s+$/g,""),""===t)return null;var e=t.indexOf("//");t=-1===e?t:t.slice(e+2);var n=t.indexOf("/");return t=-1===n?t:-1===e||0===n?null:t.slice(0,n),t&&".swf"===t.slice(-4).toLowerCase()?null:t||null},be=function(){var t=function(t){var e,n,i,r=[];if("string"==typeof t&&(t=[t]),"object"!=typeof t||!t||"number"!=typeof t.length)return r;for(e=0,n=t.length;n>e;e++)if(y.call(t,e)&&(i=_e(t[e]))){if("*"===i){r.length=0,r.push("*");break}-1===r.indexOf(i)&&r.push(i)}return r};return function(e,n){var i=_e(n.swfPath);null===i&&(i=e);var r=t(n.trustedDomains),o=r.length;if(o>0){if(1===o&&"*"===r[0])return"always";if(-1!==r.indexOf(e))return 1===o&&e===i?"sameDomain":"always"}return"never"}}(),xe=function(){try{return o.activeElement}catch(t){return null}},we=function(t,e){if(!t||1!==t.nodeType)return t;if(t.classList)return t.classList.contains(e)||t.classList.add(e),t;
|
||
if(e&&"string"==typeof e){var n=(e||"").split(/\s+/);if(1===t.nodeType)if(t.className){for(var i=" "+t.className+" ",r=t.className,o=0,a=n.length;a>o;o++)i.indexOf(" "+n[o]+" ")<0&&(r+=" "+n[o]);t.className=r.replace(/^\s+|\s+$/g,"")}else t.className=e}return t},ke=function(t,e){if(!t||1!==t.nodeType)return t;if(t.classList)return t.classList.contains(e)&&t.classList.remove(e),t;if("string"==typeof e&&e){var n=e.split(/\s+/);if(1===t.nodeType&&t.className){for(var i=(" "+t.className+" ").replace(/[\n\t]/g," "),r=0,o=n.length;o>r;r++)i=i.replace(" "+n[r]+" "," ");t.className=i.replace(/^\s+|\s+$/g,"")}}return t},Ce=function(t,e){var n=r.getComputedStyle(t,null).getPropertyValue(e);return"cursor"!==e||n&&"auto"!==n||"A"!==t.nodeName?n:"pointer"},Se=function(){var t,e,n,i=1;return"function"==typeof o.body.getBoundingClientRect&&(t=o.body.getBoundingClientRect(),e=t.right-t.left,n=o.body.offsetWidth,i=p(e/n*100)/100),i},Te=function(t){var e={left:0,top:0,width:0,height:0};if(t.getBoundingClientRect){var n,i,a,s=t.getBoundingClientRect();"pageXOffset"in r&&"pageYOffset"in r?(n=r.pageXOffset,i=r.pageYOffset):(a=Se(),n=p(o.documentElement.scrollLeft/a),i=p(o.documentElement.scrollTop/a));var l=o.documentElement.clientLeft||0,u=o.documentElement.clientTop||0;e.left=s.left+n-l,e.top=s.top+i-u,e.width="width"in s?s.width:s.right-s.left,e.height="height"in s?s.height:s.bottom-s.top}return e},Me=function(){var t;if(n&&(t=de(D.bridge))){var e=Te(n);w(t.style,{width:e.width+"px",height:e.height+"px",top:e.top+"px",left:e.left+"px",zIndex:""+Ee(V.zIndex)})}},Le=function(t){D.ready===!0&&(D.bridge&&"function"==typeof D.bridge.setHandCursor?D.bridge.setHandCursor(t):D.ready=!1)},Ee=function(t){if(/^(?:auto|inherit)$/.test(t))return t;var e;return"number"!=typeof t||f(t)?"string"==typeof t&&(e=Ee(h(t,10))):e=t,"number"==typeof e?e:"auto"},Ne=function(t){function e(t){var e=t.match(/[\d]+/g);return e.length=3,e.join(".")}function n(t){return!!t&&(t=t.toLowerCase())&&(/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(t)||"chrome.plugin"===t.slice(-13))}function i(t){t&&(l=!0,t.version&&(h=e(t.version)),!h&&t.description&&(h=e(t.description)),t.filename&&(c=n(t.filename)))}var r,o,s,l=!1,u=!1,c=!1,h="";if(a.plugins&&a.plugins.length)r=a.plugins["Shockwave Flash"],i(r),a.plugins["Shockwave Flash 2.0"]&&(l=!0,h="2.0.0.11");else if(a.mimeTypes&&a.mimeTypes.length)s=a.mimeTypes["application/x-shockwave-flash"],r=s&&s.enabledPlugin,i(r);else if("undefined"!=typeof t){u=!0;try{o=new t("ShockwaveFlash.ShockwaveFlash.7"),l=!0,h=e(o.GetVariable("$version"))}catch(f){try{o=new t("ShockwaveFlash.ShockwaveFlash.6"),l=!0,h="6.0.21"}catch(p){try{o=new t("ShockwaveFlash.ShockwaveFlash"),l=!0,h=e(o.GetVariable("$version"))}catch(g){u=!1}}}}D.disabled=l!==!0,D.outdated=h&&d(h)<d(I),D.version=h||"0.0.0",D.pluginType=c?"pepper":u?"activex":l?"netscape":"unknown"};Ne(u);var Pe=function(){return this instanceof Pe?void("function"==typeof Pe._createClient&&Pe._createClient.apply(this,x(arguments))):new Pe};v(Pe,"version",{value:"2.1.6",writable:!1,configurable:!0,enumerable:!0}),Pe.config=function(){return z.apply(this,x(arguments))},Pe.state=function(){return F.apply(this,x(arguments))},Pe.isFlashUnusable=function(){return j.apply(this,x(arguments))},Pe.on=function(){return U.apply(this,x(arguments))},Pe.off=function(){return K.apply(this,x(arguments))},Pe.handlers=function(){return q.apply(this,x(arguments))},Pe.emit=function(){return $.apply(this,x(arguments))},Pe.create=function(){return G.apply(this,x(arguments))},Pe.destroy=function(){return X.apply(this,x(arguments))},Pe.setData=function(){return Y.apply(this,x(arguments))},Pe.clearData=function(){return Q.apply(this,x(arguments))},Pe.getData=function(){return J.apply(this,x(arguments))},Pe.focus=Pe.activate=function(){return Z.apply(this,x(arguments))},Pe.blur=Pe.deactivate=function(){return te.apply(this,x(arguments))},Pe.activeElement=function(){return ee.apply(this,x(arguments))};var Ae=0,Oe={},De=0,Ie={},Be={};w(V,{autoActivate:!0});var Re=function(t){var e=this;e.id=""+Ae++,Oe[e.id]={instance:e,elements:[],handlers:{}},t&&e.clip(t),Pe.on("*",function(t){return e.emit(t)}),Pe.on("destroy",function(){e.destroy()}),Pe.create()},We=function(t,e){var n,i,r,o={},a=Oe[this.id]&&Oe[this.id].handlers;if("string"==typeof t&&t)r=t.toLowerCase().split(/\s+/);else if("object"==typeof t&&t&&"undefined"==typeof e)for(n in t)y.call(t,n)&&"string"==typeof n&&n&&"function"==typeof t[n]&&this.on(n,t[n]);if(r&&r.length){for(n=0,i=r.length;i>n;n++)t=r[n].replace(/^on/,""),o[t]=!0,a[t]||(a[t]=[]),a[t].push(e);if(o.ready&&D.ready&&this.emit({type:"ready",client:this}),o.error){var s=["disabled","outdated","unavailable","deactivated","overdue"];for(n=0,i=s.length;i>n;n++)if(D[s[n]]){this.emit({type:"error",name:"flash-"+s[n],client:this});break}}}return this},He=function(t,e){var n,i,r,o,a,s=Oe[this.id]&&Oe[this.id].handlers;if(0===arguments.length)o=m(s);else if("string"==typeof t&&t)o=t.split(/\s+/);else if("object"==typeof t&&t&&"undefined"==typeof e)for(n in t)y.call(t,n)&&"string"==typeof n&&n&&"function"==typeof t[n]&&this.off(n,t[n]);if(o&&o.length)for(n=0,i=o.length;i>n;n++)if(t=o[n].toLowerCase().replace(/^on/,""),a=s[t],a&&a.length)if(e)for(r=a.indexOf(e);-1!==r;)a.splice(r,1),r=a.indexOf(e,r);else a.length=0;return this},Ve=function(t){var e=null,n=Oe[this.id]&&Oe[this.id].handlers;return n&&(e="string"==typeof t&&t?n[t]?n[t].slice(0):[]:k(n)),e},ze=function(t){if(qe.call(this,t)){"object"==typeof t&&t&&"string"==typeof t.type&&t.type&&(t=w({},t));var e=w({},ie(t),{client:this});$e.call(this,e)}return this},Fe=function(t){t=Ge(t);for(var e=0;e<t.length;e++)if(y.call(t,e)&&t[e]&&1===t[e].nodeType){t[e].zcClippingId?-1===Ie[t[e].zcClippingId].indexOf(this.id)&&Ie[t[e].zcClippingId].push(this.id):(t[e].zcClippingId="zcClippingId_"+De++,Ie[t[e].zcClippingId]=[this.id],V.autoActivate===!0&&Xe(t[e]));var n=Oe[this.id]&&Oe[this.id].elements;-1===n.indexOf(t[e])&&n.push(t[e])}return this},je=function(t){var e=Oe[this.id];if(!e)return this;var n,i=e.elements;t="undefined"==typeof t?i.slice(0):Ge(t);for(var r=t.length;r--;)if(y.call(t,r)&&t[r]&&1===t[r].nodeType){for(n=0;-1!==(n=i.indexOf(t[r],n));)i.splice(n,1);var o=Ie[t[r].zcClippingId];if(o){for(n=0;-1!==(n=o.indexOf(this.id,n));)o.splice(n,1);0===o.length&&(V.autoActivate===!0&&Ye(t[r]),delete t[r].zcClippingId)}}return this},Ue=function(){var t=Oe[this.id];return t&&t.elements?t.elements.slice(0):[]},Ke=function(){this.unclip(),this.off(),delete Oe[this.id]},qe=function(t){if(!t||!t.type)return!1;if(t.client&&t.client!==this)return!1;var e=Oe[this.id]&&Oe[this.id].elements,n=!!e&&e.length>0,i=!t.target||n&&-1!==e.indexOf(t.target),r=t.relatedTarget&&n&&-1!==e.indexOf(t.relatedTarget),o=t.client&&t.client===this;return i||r||o?!0:!1},$e=function(t){if("object"==typeof t&&t&&t.type){var e=ae(t),n=Oe[this.id]&&Oe[this.id].handlers["*"]||[],i=Oe[this.id]&&Oe[this.id].handlers[t.type]||[],o=n.concat(i);if(o&&o.length){var a,s,l,u,c,h=this;for(a=0,s=o.length;s>a;a++)l=o[a],u=h,"string"==typeof l&&"function"==typeof r[l]&&(l=r[l]),"object"==typeof l&&l&&"function"==typeof l.handleEvent&&(u=l,l=l.handleEvent),"function"==typeof l&&(c=w({},t),se(l,u,[c],e))}return this}},Ge=function(t){return"string"==typeof t&&(t=[]),"number"!=typeof t.length?[t]:t},Xe=function(t){if(t&&1===t.nodeType){var e=function(t){(t||(t=r.event))&&("js"!==t._source&&(t.stopImmediatePropagation(),t.preventDefault()),delete t._source)},n=function(n){(n||(n=r.event))&&(e(n),Pe.focus(t))};t.addEventListener("mouseover",n,!1),t.addEventListener("mouseout",e,!1),t.addEventListener("mouseenter",e,!1),t.addEventListener("mouseleave",e,!1),t.addEventListener("mousemove",e,!1),Be[t.zcClippingId]={mouseover:n,mouseout:e,mouseenter:e,mouseleave:e,mousemove:e}}},Ye=function(t){if(t&&1===t.nodeType){var e=Be[t.zcClippingId];if("object"==typeof e&&e){for(var n,i,r=["move","leave","enter","out","over"],o=0,a=r.length;a>o;o++)n="mouse"+r[o],i=e[n],"function"==typeof i&&t.removeEventListener(n,i,!1);delete Be[t.zcClippingId]}}};Pe._createClient=function(){Re.apply(this,x(arguments))},Pe.prototype.on=function(){return We.apply(this,x(arguments))},Pe.prototype.off=function(){return He.apply(this,x(arguments))},Pe.prototype.handlers=function(){return Ve.apply(this,x(arguments))},Pe.prototype.emit=function(){return ze.apply(this,x(arguments))},Pe.prototype.clip=function(){return Fe.apply(this,x(arguments))},Pe.prototype.unclip=function(){return je.apply(this,x(arguments))},Pe.prototype.elements=function(){return Ue.apply(this,x(arguments))},Pe.prototype.destroy=function(){return Ke.apply(this,x(arguments))},Pe.prototype.setText=function(t){return Pe.setData("text/plain",t),this},Pe.prototype.setHtml=function(t){return Pe.setData("text/html",t),this},Pe.prototype.setRichText=function(t){return Pe.setData("application/rtf",t),this},Pe.prototype.setData=function(){return Pe.setData.apply(this,x(arguments)),this},Pe.prototype.clearData=function(){return Pe.clearData.apply(this,x(arguments)),this},Pe.prototype.getData=function(){return Pe.getData.apply(this,x(arguments))},"function"==typeof define&&define.amd?define(function(){return Pe}):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports?module.exports=Pe:t.ZeroClipboard=Pe}(function(){return this||window}()),function(){function t(t){this.mode=u.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,n=this.data.length;n>e;e++){var i=[],r=this.data.charCodeAt(e);r>65536?(i[0]=240|(1835008&r)>>>18,i[1]=128|(258048&r)>>>12,i[2]=128|(4032&r)>>>6,i[3]=128|63&r):r>2048?(i[0]=224|(61440&r)>>>12,i[1]=128|(4032&r)>>>6,i[2]=128|63&r):r>128?(i[0]=192|(1984&r)>>>6,i[1]=128|63&r):i[0]=r,this.parsedData.push(i)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function e(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function n(t,e){if(void 0==t.length)throw new Error(t.length+"/"+e);for(var n=0;n<t.length&&0==t[n];)n++;this.num=new Array(t.length-n+e);for(var i=0;i<t.length-n;i++)this.num[i]=t[i+n]}function i(t,e){this.totalCount=t,this.dataCount=e}function r(){this.buffer=[],this.length=0}function o(){return"undefined"!=typeof CanvasRenderingContext2D}function a(){var t=!1,e=navigator.userAgent;return/android/i.test(e)&&(t=!0,aMat=e.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(t=parseFloat(aMat[1]))),t}function s(t,e){for(var n=1,i=l(t),r=0,o=g.length;o>=r;r++){var a=0;switch(e){case c.L:a=g[r][0];break;case c.M:a=g[r][1];break;case c.Q:a=g[r][2];break;case c.H:a=g[r][3]}if(a>=i)break;n++}if(n>g.length)throw new Error("Too long data");return n}function l(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=t?3:0)}t.prototype={getLength:function(){return this.parsedData.length},write:function(t){for(var e=0,n=this.parsedData.length;n>e;e++)t.put(this.parsedData[e],8)}},e.prototype={addData:function(e){var n=new t(e);this.dataList.push(n),this.dataCache=null},isDark:function(t,e){if(0>t||this.moduleCount<=t||0>e||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,n){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++){this.modules[i]=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[i][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,n),this.typeNumber>=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=e.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,n)},setupPositionProbePattern:function(t,e){for(var n=-1;7>=n;n++)if(!(-1>=t+n||this.moduleCount<=t+n))for(var i=-1;7>=i;i++)-1>=e+i||this.moduleCount<=e+i||(this.modules[t+n][e+i]=n>=0&&6>=n&&(0==i||6==i)||i>=0&&6>=i&&(0==n||6==n)||n>=2&&4>=n&&i>=2&&4>=i?!0:!1)},getBestMaskPattern:function(){for(var t=0,e=0,n=0;8>n;n++){this.makeImpl(!0,n);var i=d.getLostPoint(this);(0==n||t>i)&&(t=i,e=n)}return e},createMovieClip:function(t,e,n){var i=t.createEmptyMovieClip(e,n),r=1;this.make();for(var o=0;o<this.modules.length;o++)for(var a=o*r,s=0;s<this.modules[o].length;s++){var l=s*r,u=this.modules[o][s];u&&(i.beginFill(0,100),i.moveTo(l,a),i.lineTo(l+r,a),i.lineTo(l+r,a+r),i.lineTo(l,a+r),i.endFill())}return i},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0)},setupPositionAdjustPattern:function(){for(var t=d.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var n=0;n<t.length;n++){var i=t[e],r=t[n];if(null==this.modules[i][r])for(var o=-2;2>=o;o++)for(var a=-2;2>=a;a++)this.modules[i+o][r+a]=-2==o||2==o||-2==a||2==a||0==o&&0==a?!0:!1}},setupTypeNumber:function(t){for(var e=d.getBCHTypeNumber(this.typeNumber),n=0;18>n;n++){var i=!t&&1==(e>>n&1);this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=i}for(var n=0;18>n;n++){var i=!t&&1==(e>>n&1);this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=i}},setupTypeInfo:function(t,e){for(var n=this.errorCorrectLevel<<3|e,i=d.getBCHTypeInfo(n),r=0;15>r;r++){var o=!t&&1==(i>>r&1);6>r?this.modules[r][8]=o:8>r?this.modules[r+1][8]=o:this.modules[this.moduleCount-15+r][8]=o}for(var r=0;15>r;r++){var o=!t&&1==(i>>r&1);8>r?this.modules[8][this.moduleCount-r-1]=o:9>r?this.modules[8][15-r-1+1]=o:this.modules[8][15-r-1]=o}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var n=-1,i=this.moduleCount-1,r=7,o=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;2>s;s++)if(null==this.modules[i][a-s]){var l=!1;o<t.length&&(l=1==(t[o]>>>r&1));var u=d.getMask(e,i,a-s);u&&(l=!l),this.modules[i][a-s]=l,r--,-1==r&&(o++,r=7)}if(i+=n,0>i||this.moduleCount<=i){i-=n,n=-n;break}}}},e.PAD0=236,e.PAD1=17,e.createData=function(t,n,o){for(var a=i.getRSBlocks(t,n),s=new r,l=0;l<o.length;l++){var u=o[l];s.put(u.mode,4),s.put(u.getLength(),d.getLengthInBits(u.mode,t)),u.write(s)}for(var c=0,l=0;l<a.length;l++)c+=a[l].dataCount;if(s.getLengthInBits()>8*c)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+8*c+")");for(s.getLengthInBits()+4<=8*c&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;;){if(s.getLengthInBits()>=8*c)break;if(s.put(e.PAD0,8),s.getLengthInBits()>=8*c)break;s.put(e.PAD1,8)}return e.createBytes(s,a)},e.createBytes=function(t,e){for(var i=0,r=0,o=0,a=new Array(e.length),s=new Array(e.length),l=0;l<e.length;l++){var u=e[l].dataCount,c=e[l].totalCount-u;r=Math.max(r,u),o=Math.max(o,c),a[l]=new Array(u);for(var h=0;h<a[l].length;h++)a[l][h]=255&t.buffer[h+i];i+=u;var f=d.getErrorCorrectPolynomial(c),p=new n(a[l],f.getLength()-1),g=p.mod(f);s[l]=new Array(f.getLength()-1);for(var h=0;h<s[l].length;h++){var m=h+g.getLength()-s[l].length;s[l][h]=m>=0?g.get(m):0}}for(var v=0,h=0;h<e.length;h++)v+=e[h].totalCount;for(var y=new Array(v),_=0,h=0;r>h;h++)for(var l=0;l<e.length;l++)h<a[l].length&&(y[_++]=a[l][h]);for(var h=0;o>h;h++)for(var l=0;l<e.length;l++)h<s[l].length&&(y[_++]=s[l][h]);return y};for(var u={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},c={L:1,M:0,Q:3,H:2},h={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},d={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;d.getBCHDigit(e)-d.getBCHDigit(d.G15)>=0;)e^=d.G15<<d.getBCHDigit(e)-d.getBCHDigit(d.G15);return(t<<10|e)^d.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;d.getBCHDigit(e)-d.getBCHDigit(d.G18)>=0;)e^=d.G18<<d.getBCHDigit(e)-d.getBCHDigit(d.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},getPatternPosition:function(t){return d.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,n){switch(t){case h.PATTERN000:return(e+n)%2==0;case h.PATTERN001:return e%2==0;case h.PATTERN010:return n%3==0;case h.PATTERN011:return(e+n)%3==0;case h.PATTERN100:return(Math.floor(e/2)+Math.floor(n/3))%2==0;case h.PATTERN101:return e*n%2+e*n%3==0;case h.PATTERN110:return(e*n%2+e*n%3)%2==0;case h.PATTERN111:return(e*n%3+(e+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new n([1],0),i=0;t>i;i++)e=e.multiply(new n([1,f.gexp(i)],0));return e},getLengthInBits:function(t,e){if(e>=1&&10>e)switch(t){case u.MODE_NUMBER:return 10;case u.MODE_ALPHA_NUM:return 9;case u.MODE_8BIT_BYTE:return 8;case u.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(27>e)switch(t){case u.MODE_NUMBER:return 12;case u.MODE_ALPHA_NUM:return 11;case u.MODE_8BIT_BYTE:return 16;case u.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(41>e))throw new Error("type:"+e);switch(t){case u.MODE_NUMBER:return 14;case u.MODE_ALPHA_NUM:return 13;case u.MODE_8BIT_BYTE:return 16;case u.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},getLostPoint:function(t){for(var e=t.getModuleCount(),n=0,i=0;e>i;i++)for(var r=0;e>r;r++){for(var o=0,a=t.isDark(i,r),s=-1;1>=s;s++)if(!(0>i+s||i+s>=e))for(var l=-1;1>=l;l++)0>r+l||r+l>=e||(0!=s||0!=l)&&a==t.isDark(i+s,r+l)&&o++;o>5&&(n+=3+o-5)}for(var i=0;e-1>i;i++)for(var r=0;e-1>r;r++){var u=0;t.isDark(i,r)&&u++,t.isDark(i+1,r)&&u++,t.isDark(i,r+1)&&u++,t.isDark(i+1,r+1)&&u++,(0==u||4==u)&&(n+=3)}for(var i=0;e>i;i++)for(var r=0;e-6>r;r++)t.isDark(i,r)&&!t.isDark(i,r+1)&&t.isDark(i,r+2)&&t.isDark(i,r+3)&&t.isDark(i,r+4)&&!t.isDark(i,r+5)&&t.isDark(i,r+6)&&(n+=40);for(var r=0;e>r;r++)for(var i=0;e-6>i;i++)t.isDark(i,r)&&!t.isDark(i+1,r)&&t.isDark(i+2,r)&&t.isDark(i+3,r)&&t.isDark(i+4,r)&&!t.isDark(i+5,r)&&t.isDark(i+6,r)&&(n+=40);for(var c=0,r=0;e>r;r++)for(var i=0;e>i;i++)t.isDark(i,r)&&c++;var h=Math.abs(100*c/e/e-50)/5;return n+=10*h}},f={glog:function(t){if(1>t)throw new Error("glog("+t+")");return f.LOG_TABLE[t]},gexp:function(t){for(;0>t;)t+=255;for(;t>=256;)t-=255;return f.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},p=0;8>p;p++)f.EXP_TABLE[p]=1<<p;for(var p=8;256>p;p++)f.EXP_TABLE[p]=f.EXP_TABLE[p-4]^f.EXP_TABLE[p-5]^f.EXP_TABLE[p-6]^f.EXP_TABLE[p-8];for(var p=0;255>p;p++)f.LOG_TABLE[f.EXP_TABLE[p]]=p;n.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),i=0;i<this.getLength();i++)for(var r=0;r<t.getLength();r++)e[i+r]^=f.gexp(f.glog(this.get(i))+f.glog(t.get(r)));return new n(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=f.glog(this.get(0))-f.glog(t.get(0)),i=new Array(this.getLength()),r=0;r<this.getLength();r++)i[r]=this.get(r);for(var r=0;r<t.getLength();r++)i[r]^=f.gexp(f.glog(t.get(r))+e);return new n(i,0).mod(t)}},i.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],i.getRSBlocks=function(t,e){var n=i.getRsBlockTable(t,e);if(void 0==n)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var r=n.length/3,o=[],a=0;r>a;a++)for(var s=n[3*a+0],l=n[3*a+1],u=n[3*a+2],c=0;s>c;c++)o.push(new i(l,u));return o},i.getRsBlockTable=function(t,e){switch(e){case c.L:return i.RS_BLOCK_TABLE[4*(t-1)+0];case c.M:return i.RS_BLOCK_TABLE[4*(t-1)+1];case c.Q:return i.RS_BLOCK_TABLE[4*(t-1)+2];case c.H:return i.RS_BLOCK_TABLE[4*(t-1)+3];default:return void 0}},r.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var n=0;e>n;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var g=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],m=function(){var t=function(t,e){this._el=t,this._htOption=e};return t.prototype.draw=function(t){function e(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg",t);for(var i in e)e.hasOwnProperty(i)&&n.setAttribute(i,e[i]);return n}{var n=this._htOption,i=this._el,r=t.getModuleCount();Math.floor(n.width/r),Math.floor(n.height/r)}this.clear();var o=e("svg",{viewBox:"0 0 "+String(r)+" "+String(r),width:"100%",height:"100%",fill:n.colorLight});o.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),i.appendChild(o),o.appendChild(e("rect",{fill:n.colorDark,width:"1",height:"1",id:"template"}));for(var a=0;r>a;a++)for(var s=0;r>s;s++)if(t.isDark(a,s)){var l=e("use",{x:String(a),y:String(s)});l.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),o.appendChild(l)}},t.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},t}(),v="svg"===document.documentElement.tagName.toLowerCase(),y=v?m:o()?function(){function t(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function e(t,e){var n=this;if(n._fFail=e,n._fSuccess=t,null===n._bSupportDataURI){var i=document.createElement("img"),r=function(){n._bSupportDataURI=!1,n._fFail&&_fFail.call(n)},o=function(){n._bSupportDataURI=!0,n._fSuccess&&n._fSuccess.call(n)};return i.onabort=r,i.onerror=r,i.onload=o,void(i.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==")}n._bSupportDataURI===!0&&n._fSuccess?n._fSuccess.call(n):n._bSupportDataURI===!1&&n._fFail&&n._fFail.call(n)}if(this._android&&this._android<=2.1){var n=1/window.devicePixelRatio,i=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(t,e,r,o,a,s,l,u){if("nodeName"in t&&/img/i.test(t.nodeName))for(var c=arguments.length-1;c>=1;c--)arguments[c]=arguments[c]*n;else"undefined"==typeof u&&(arguments[1]*=n,arguments[2]*=n,arguments[3]*=n,arguments[4]*=n);i.apply(this,arguments)}}var r=function(t,e){this._bIsPainted=!1,this._android=a(),this._htOption=e,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=e.width,this._elCanvas.height=e.height,t.appendChild(this._elCanvas),this._el=t,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.alt="Scan me!",this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return r.prototype.draw=function(t){var e=this._elImage,n=this._oContext,i=this._htOption,r=t.getModuleCount(),o=i.width/r,a=i.height/r,s=Math.round(o),l=Math.round(a);e.style.display="none",this.clear();for(var u=0;r>u;u++)for(var c=0;r>c;c++){var h=t.isDark(u,c),d=c*o,f=u*a;n.strokeStyle=h?i.colorDark:i.colorLight,n.lineWidth=1,n.fillStyle=h?i.colorDark:i.colorLight,n.fillRect(d,f,o,a),n.strokeRect(Math.floor(d)+.5,Math.floor(f)+.5,s,l),n.strokeRect(Math.ceil(d)-.5,Math.ceil(f)-.5,s,l)}this._bIsPainted=!0},r.prototype.makeImage=function(){this._bIsPainted&&e.call(this,t)},r.prototype.isPainted=function(){return this._bIsPainted},r.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},r.prototype.round=function(t){return t?Math.floor(1e3*t)/1e3:t},r}():function(){var t=function(t,e){this._el=t,this._htOption=e};return t.prototype.draw=function(t){for(var e=this._htOption,n=this._el,i=t.getModuleCount(),r=Math.floor(e.width/i),o=Math.floor(e.height/i),a=['<table style="border:0;border-collapse:collapse;">'],s=0;i>s;s++){a.push("<tr>");for(var l=0;i>l;l++)a.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+r+"px;height:"+o+"px;background-color:"+(t.isDark(s,l)?e.colorDark:e.colorLight)+';"></td>');a.push("</tr>")}a.push("</table>"),n.innerHTML=a.join("");var u=n.childNodes[0],c=(e.width-u.offsetWidth)/2,h=(e.height-u.offsetHeight)/2;c>0&&h>0&&(u.style.margin=h+"px "+c+"px")},t.prototype.clear=function(){this._el.innerHTML=""},t}();window.QRCode=function(t,e){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:c.H},"string"==typeof e&&(e={text:e}),e)for(var n in e)this._htOption[n]=e[n];"string"==typeof t&&(t=document.getElementById(t)),this._android=a(),this._el=t,this._oQRCode=null,this._oDrawing=new y(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(t){this._oQRCode=new e(s(t,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(t),this._oQRCode.make(),this._el.title=t,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=c}();var jhtmls="undefined"==typeof exports?jhtmls||{}:exports;void function(t){"use strict";function e(t){return String(t).replace(/["<>& ]/g,function(t){return"&"+r[t]+";"})}function n(t){var e=[];return e.push("with(this){"),e.push(t.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,function(t){return['!#{unescape("',escape(t),'")}'].join("")}).replace(/[\r\n]+/g,"\n").replace(/^\n+|\s+$/gm,"").replace(/^([ \w\t_$]*([^&\^?|\n\w\/'"{}\[\]+\-():; \t=\.$_]|:\/\/).*$|^(?!\s*(else|do|try|finally|void|typeof\s[\w$_]*)\s*$)[^'":;{}()\n|=&\/^?]+$)\s?/gm,function(t){return t=t.replace(/&none;/g,"").replace(/["'\\]/g,"\\$&").replace(/\n/g,"\\n").replace(/(!?#)\{(.*?)\}|(!?\$)([a-z_]+\w*(?:\.[a-z_]+\w*)*)/g,function(t,e,n,i,r){if(i&&(e=i,n=r),!n)return"";n=n.replace(/\\n/g,"\n").replace(/\\([\\'"])/g,"$1");var o=/^[a-z$][\w+$]+$/i.test(n)&&!/^(true|false|NaN|null|this)$/.test(n);return["',",o?["typeof ",n,"==='undefined'?'':"].join(""):"","#"===e||"$"===e?"_encode_":"","(",n,"),'"].join("")}),t=["'",t,"'"].join("").replace(/^'',|,''$/g,""),t?["_output_.push(",t,");"].join(""):""})),e.push("}"),new Function("_output_","_encode_","helper","jhtmls",e.join(""))}function i(i,r,o){"function"==typeof i&&(i=String(i).replace(/^[^\{]*\{\s*\/\*!?[ \f\t\v]*\n?|[ \f\t\v]*\*\/[;|\s]*\}$/g,""));var a=n(i),s=function(n,i){i=i||t;var r=[];return a.call(n,r,e,i,t),r.join("")};return arguments.length<=1?s:s(r,o)}var r={'"':"quot","<":"lt",">":"gt","&":"amp"," ":"nbsp"};t.render=i}(jhtmls),function(){function use(t){_p.r([moduleMapping[t]])}var _p={r:function(t){if(_p[t].inited)return _p[t].value;if("function"!=typeof _p[t].value)return _p[t].inited=!0,_p[t].value;var e={exports:{}},n=_p[t].value(null,e.exports,e);if(_p[t].inited=!0,_p[t].value=n,void 0!==n)return n;for(var i in e.exports)if(e.exports.hasOwnProperty(i))return _p[t].inited=!0,_p[t].value=e.exports,e.exports}};_p[0]={value:function(){function t(t){var e=i[t.clazz];return e?new e(t):null}var e={},n=_p.r(4),i=_p.r(11);return n.extend(e,{parse:function(e){var i=[];return n.isArray(e)?(n.each(e,function(e,n){i.push(t(n))}),i):t(e)}}),e}},_p[1]={value:function(){var t=_p.r(11);t.___register({ALLOW_FOCUS:!0}),t.___register({Widget:_p.r(60),Icon:_p.r(42),Label:_p.r(48),Button:_p.r(37),ToggleButton:_p.r(59),Buttonset:_p.r(36),Separator:_p.r(56),Item:_p.r(46),Input:_p.r(45),InputButton:_p.r(43),Mask:_p.r(49),ColorPicker:_p.r(38),Tabs:_p.r(58),SpinButton:_p.r(57),Container:_p.r(39),Panel:_p.r(51),PPanel:_p.r(54),LabelPanel:_p.r(47),Menu:_p.r(50),InputMenu:_p.r(44),ButtonMenu:_p.r(34),DropPanel:_p.r(41),Popup:_p.r(53),PopupMenu:_p.r(52),SelectMenu:_p.r(55),Dialog:_p.r(40),Utils:_p.r(13),Creator:_p.r(0)}),t.__export()
|
||
}},_p[2]={value:function(){var t=_p.r(11);t.___register({TablePicker:_p.r(17)})}},_p[3]={value:function(){return jhtmls}},_p[4]={value:function(){return window.jQuery}},_p[5]={value:function(require,exports){function Class(){}function checkBaseConstructorCall(t,e){var n=t.toString();if(!/this\.callBase/.test(n))throw new Error(e+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function inherit(constructor,BaseClass,classname){var KityClass=eval("(function "+classname+"( __inherit__flag ) {if( __inherit__flag != KITY_INHERIT_FLAG ) {KityClass.__KityConstructor.apply(this, arguments);}this.__KityClassName = KityClass.__KityClassName;})||0");KityClass.__KityConstructor=constructor,KityClass.prototype=new BaseClass(KITY_INHERIT_FLAG);for(var methodName in BaseClass.prototype)BaseClass.prototype.hasOwnProperty(methodName)&&0!==methodName.indexOf("__Kity")&&(KityClass.prototype[methodName]=BaseClass.prototype[methodName]);return KityClass.prototype.constructor=KityClass,KityClass}function mixin(t,e){if(!1==e instanceof Array)return t;var n,i,r,o=e.length;for(t.__KityMixins={constructor:[]},n=0;o>n;n++){i=e[n].prototype;for(r in i)!1!==i.hasOwnProperty(r)&&0!==r.indexOf("__Kity")&&("constructor"===r?t.__KityMixins.constructor.push(i[r]):t.prototype[r]=t.__KityMixins[r]=i[r])}return t}function extend(t,e){e.__KityClassName&&(e=e.prototype);for(var n in e)if(e.hasOwnProperty(n)&&n.indexOf("__Kity")&&"constructor"!=n){var i=t.prototype[n]=e[n];i.__KityMethodClass=t,i.__KityMethodName=n}return t}Function.prototype.bind=Function.prototype.bind||function(t){var e=Array.prototype.slice.call(arguments,1);return this.apply(t,e)},Class.__KityClassName="Class",Class.prototype.base=function(t){var e=arguments.callee.caller,n=e.__KityMethodClass.__KityBaseClass.prototype[t];return n.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callBase=function(){var t=arguments.callee.caller,e=t.__KityMethodClass.__KityBaseClass.prototype[t.__KityMethodName];return e.apply(this,arguments)},Class.prototype.mixin=function(t){var e=arguments.callee.caller,n=e.__KityMethodClass.__KityMixins;if(!n)return this;var i=n[t];return i.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callMixin=function(){var t=arguments.callee.caller,e=t.__KityMethodName,n=t.__KityMethodClass.__KityMixins;if(!n)return this;var i=n[e];if("constructor"==e){for(var r=0,o=i.length;o>r;r++)i[r].call(this);return this}return i.apply(this,arguments)},Class.prototype.pipe=function(t){return"function"==typeof t&&t.call(this,this),this},Class.prototype.getType=function(){return this.__KityClassName},Class.prototype.getClass=function(){return this.constructor};var KITY_INHERIT_FLAG="__KITY_INHERIT_FLAG_"+ +new Date;Class.prototype._accessProperty=function(){return this._propertyRawData||(this._propertyRawData={})},exports.createClass=function(t,e){var n,i,r;return 1===arguments.length&&(e=arguments[0],t="AnonymousClass"),r=e.base||Class,e.hasOwnProperty("constructor")?(n=e.constructor,r!=Class&&checkBaseConstructorCall(n,t)):n=function(){this.callBase.apply(this,arguments),this.callMixin.apply(this,arguments)},i=inherit(n,r,t),i=mixin(i,e.mixins),i.__KityClassName=n.__KityClassName=t,i.__KityBaseClass=n.__KityBaseClass=r,i.__KityMethodName=n.__KityMethodName="constructor",i.__KityMethodClass=n.__KityMethodClass=i,delete e.mixins,delete e.constructor,delete e.base,i=extend(i,e)},exports.extendClass=extend}},_p[6]={value:function(){var t=_p.r(4),e="__fui__marker__"+ +new Date;return{isElement:function(t){return 1===t.nodeType},getMarker:function(){return e},getRect:function(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,bottom:e.bottom,left:e.left,right:e.right}},getBound:function(e){var n=0,i=0;return"body"===e.tagName.toLowerCase()?(i=t(this.getView(e)),n=i.width(),i=i.height(),{top:0,left:0,bottom:i,right:n,width:n,height:i}):this.getRect(e)},getView:function(t){return t.ownerDocument.defaultView||t.ownerDocument.parentWindow}}}},_p[7]={value:function(){var t=_p.r(3),e=_p.r(4),n={forEach:function(t,n){e.each(t,function(t,e){n.call(null,t,e)})}};return{compile:function(i,r){return i=e.trim(i),0===i.length?"":t.render(i,r,n)}}}},_p[8]={value:function(){function t(t){this.__options=e.extend({},i,t),this.__started=!1,this.__point={x:0,y:0},this.__location={x:0,y:0},this.__range={top:0,left:0,bottom:0,right:0}}var e=_p.r(4),n=_p.r(6),i={handler:null,target:null,axis:"all",range:null};return e.extend(t.prototype,{bind:function(t){if(t&&(this.__options.target=t),!this.__options.target)throw new Error("target unset");this.__target=this.__options.target,this.__handler=this.__options.handler,this.__rangeNode=this.__options.range,this.__initOptions(),this.__initEnv(),this.__initEvent()},__initEvent:function(){var t=this.__handler,i=this;e(t).on("mousedown",function(e){if(1===e.which){var r=n.getRect(t);e.preventDefault(),i.__started=!0,i.__point={x:e.clientX,y:e.clientY},i.__location={x:r.left,y:r.top},i.__range=i.__getRange()}}),e(t.ownerDocument).on("mousemove",function(t){if(i.__started){var e=t.clientX,n=t.clientY;i.__allowAxisX&&i.__xMove(e),i.__allowAxisY&&i.__yMove(n)}}).on("mouseup",function(){i.__started=!1})},__xMove:function(t){var e=t-this.__point.x;e=this.__location.x+e,e<this.__range.left?e=this.__range.left:e>this.__range.right&&(e=this.__range.right),this.__target.style.left=e+"px"},__yMove:function(t){var e=t-this.__point.y;e=this.__location.y+e,e<this.__range.top?e=this.__range.top:e>this.__range.bottom&&(e=this.__range.bottom),this.__target.style.top=e+"px"},__initEnv:function(){var t=e(this.__handler);t.css("cursor","move")},__initOptions:function(){this.__handler||(this.__handler=this.__target),this.__rangeNode||(this.__rangeNode=this.__options.target.ownerDocument.body),this.__allowAxisX="y"!==this.__options.axis,this.__allowAxisY="x"!==this.__options.axis},__getRange:function(){var t=this.__rangeNode,i=n.getRect(this.__target);return"body"===t.tagName.toLowerCase()?(t=e(this.__rangeNode.ownerDocument),t={top:0,left:0,bottom:t.height(),right:t.width()}):t=n.getRect(t),{top:t.top,left:t.left,bottom:t.bottom-i.height,right:t.right-i.width}}}),function(e){return new t(e)}}},_p[9]={value:function(){function t(i){var r=!1,o=!1,a=null;return 1===arguments.length?e(i):(n.each([].slice.call(arguments,1),function(e,s){for(var l in s)a=s[l],s.hasOwnProperty(l)&&(r=n.isPlainObject(a),o=n.isArray(a),r||o?r?(n.isPlainObject(i[l])||(i[l]={}),i[l]=t(i[l],a)):o&&(i[l]=t(a)):i[l]=s[l])}),i)}function e(i){var r=null;return n.isPlainObject(i)?t({},i):n.isArray(i)?(r=[],n.each(i,function(t,i){r.push(n.isPlainObject(i)||n.isArray(i)?e(i):i)}),r):i}var n=_p.r(4);return t}},_p[10]={value:function(){return{isContainer:function(t){return"container"===t.__widgetType}}}},_p[11]={value:function(){var t={};return{widgets:t,__export:function(){window.FUI=this},___register:function(t,e){if("string"==typeof t)this[t]=e;else{e=t;for(var n in e)e.hasOwnProperty(n)&&(this[n]=e[n])}},__registerInstance:function(e){t[e.getId()]=e}}}},_p[12]={value:function(){var t=_p.r(11);return{classPrefix:"fui-",layout:{TOP:"top",LEFT:"left",BOTTOM:"bottom",RIGHT:"right",CENTER:"center",MIDDLE:"middle",LEFT_TOP:"left-top",RIGHT_TOP:"right-top",LEFT_BOTTOM:"left-bottom",RIGHT_BOTTOM:"right-bottom"},allowFocus:!!t.ALLOW_FOCUS,control:{input:1,textarea:1,button:1,select:1,option:1,object:1,embed:1}}}},_p[13]={value:function(){var t=_p.r(4),e={Tpl:_p.r(7),Widget:_p.r(10),createDraggable:_p.r(8)};return t.extend(e,_p.r(6),_p.r(5))}},_p[14]={value:function(){return'<div unselectable="on" class="fui-t-picker"></div>\n'}},_p[15]={value:function(){return'<div unselectable="on" class="fui-table-picker"></div>\n'}},_p[16]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(14);return _p.r(13).createClass("TPicker",{base:_p.r(60),constructor:function(e){var n={row:10,col:10};e=t.extend({},n,e),this.callBase(e)},__initOptions:function(){this.callBase(),this.widgetName="TPicker",this.__tpl=n,this.__backplane=null},__render:function(){this.callBase(),this.__backplane=this.__createBackplane(),this.__element.appendChild(this.__backplane)},__initEvent:function(){var e=this,n={};this.callBase(),t(this.__backplane).delegate("td","mousemove",function(t){n=t.target.getAttribute("data-index").split(","),n={row:parseInt(n[0],10),col:parseInt(n[1],10)},e.__update(n.row,n.col)}),t(this.__backplane).on("click",function(){e.__select(n.row,n.col)})},__select:function(t,e){this.trigger("pickerselect",{row:t,col:e})},__update:function(t,n){for(var i=null,r=this.__options.row,o=this.__options.col,a=e.classPrefix+"table-picker-hoverin",s=0;r>s;s++){i=this.__backplane.rows[s];for(var l=0;o>l;l++)i.cells[l].className=t>=s&&n>=l?a:""}this.trigger("pickerhover",{row:t,col:n})},__createBackplane:function(){for(var n=[],i=null,r=0,o=this.__options.row;o>r;r++){i=[];for(var a=0,s=this.__options.col;s>a;a++)i.push('<td data-index="'+r+","+a+'"></td>');n.push("<tr>"+i.join("")+"</tr>")}return n=t("<table><tbody>"+n.join("")+"</tbody></table>"),n.addClass(e.classPrefix+"t-picker-table"),n[0]}})}},_p[17]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(15),i=_p.r(48),r=_p.r(16),o=_p.r(37),a=_p.r(54),s=_p.r(49);return _p.r(13).createClass("TablePicker",{base:_p.r(60),constructor:function(e){var n={button:null,row:10,col:10};e=t.extend({},n,e),this.callBase(e)},open:function(){this.__panelWidget.show(),this.__maskWidget.show()},close:function(){this.__panelWidget.hide(),this.__maskWidget.hide()},appendTo:function(t){t.appendChild(this.__buttonWidget.getElement())},getButton:function(){return this.__buttonWidget},__initOptions:function(){this.callBase(),this.widgetName="TablePicker",this.__tpl=n,this.__pickerWidget=null,this.__labelWidget=null,this.__buttonWidget=null,this.__panelWidget=null,this.__maskWidget=null},__render:function(){this.callBase(),this.__pickerWidget=new r(this.__options),this.__labelWidget=new i({text:"插入表格"}),this.__buttonWidget=new o(this.__options.button),this.__panelWidget=new a({className:e.classPrefix+"table-picker-panel",column:!0,resize:"none"}),this.__maskWidget=new s,this.__panelWidget.appendWidget(this.__labelWidget),this.__panelWidget.appendWidget(this.__pickerWidget),this.__panelWidget.positionTo(this.__buttonWidget)},__initEvent:function(){var t=this;this.callBase(),this.__buttonWidget.on("btnclick",function(){t.open()}),this.__maskWidget.on("maskclick",function(){t.close()}),this.__pickerWidget.on("pickerhover",function(e,n){var i=n.row+1,r=n.col+1;t.__labelWidget.setText(i+"x"+r+" 表格")}).on("pickerselect",function(e,n){var i=n.row+1,r=n.col+1;t.close(),t.trigger("pickerselect",{row:i,col:r})})},__createBackplane:function(){for(var n=[],i=null,r=0,o=this.__options.row;o>r;r++){i=[];for(var a=0,s=this.__options.col;s>a;a++)i.push('<td data-index="'+r+","+a+'"></td>');n.push("<tr>"+i.join("")+"</tr>")}return n=t("<table><tbody>"+n.join("")+"</tbody></table>"),n.addClass(e.classPrefix+"t-picker-table"),n[0]}})}},_p[18]={value:function(){return'<div unselectable="on" class="fui-button-menu"></div>\n'}},_p[19]={value:function(){return'<div unselectable="on" class="fui-button"></div>\n'}},_p[20]={value:function(){return'<div unselectable="on" class="fui-colorpicker-container">\n<div unselectable="on" class="fui-colorpicker-toolbar">\n<div unselectable="on" class="fui-colorpicker-preview"></div>\n<div unselectable="on" class="fui-colorpicker-clear">$clearText</div>\n</div>\n<div unselectable="on" class="fui-colorpicker-title">$commonText</div>\n<div unselectable="on" class="fui-colorpicker-commoncolor">\nhelper.forEach( commonColor, function ( index, colors ) {\n<div unselectable="on" class="fui-colorpicker-colors fui-colorpicker-colors-line$index">\nhelper.forEach( colors, function( i, color ) {\n<span unselectable="on" class="fui-colorpicker-item" style="background-color: $color; border-color: #{color.toLowerCase() == \'#ffffff\' ? \'#eeeeee\': color};" data-color="$color"></span>\n});\n</div>\n} );\n</div>\n<div unselectable="on" class="fui-colorpicker-title">$standardText</div>\n<div unselectable="on" class="fui-colorpicker-standardcolor fui-colorpicker-colors">\nhelper.forEach( standardColor, function ( i, color ) {\n<span unselectable="on" class="fui-colorpicker-item" style="background-color: $color; border-color: $color;" data-color="$color"></span>\n} );\n</div>\n</div>\n'}},_p[21]={value:function(){return'<div unselectable="on" class="fui-dialog-wrap">\n<div unselectable="on" class="fui-dialog-head">\n<h1 unselectable="on" class="fui-dialog-caption">$caption</h1>\n</div>\n<div unselectable="on" class="fui-dialog-body"></div>\n<div unselectable="on" class="fui-dialog-foot"></div>\n</div>\n'}},_p[22]={value:function(){return"<div unselectable=\"on\" class=\"fui-drop-panel\" #{ text ? 'title=\"' + m.text + '\"' : '' }></div>\n"}},_p[23]={value:function(){return'<div unselectable="on" class="fui-icon" >\nif ( this.img ) {\n<img unselectable="on" src="#{this.img}" >\n}\n</div>\n'}},_p[24]={value:function(){return'<div unselectable="on" class="fui-input-button"></div>\n'}},_p[25]={value:function(){return'<div unselectable="on" class="fui-input-menu"></div>\n'}},_p[26]={value:function(){return'<input unselectable="on" class="fui-input" autocomplete="off" !#{ value ? \'value="\' + value + \'"\' : \'\'}>\n'}},_p[27]={value:function(){return"<div unselectable=\"on\" class=\"fui-item!#{ selected ? ' fui-item-selected': '' }\" ></div>\n"}},_p[28]={value:function(){return'<div unselectable="on" class="fui-label">$text</div>\n'}},_p[29]={value:function(){return'<div unselectable="on" class="fui-mask" style="background-color: $bgcolor; opacity: $opacity;"></div>\n'}},_p[30]={value:function(){return'<div unselectable="on" class="fui-panel"></div>\n'}},_p[31]={value:function(){return'<div unselectable="on" class="fui-separator"></div>\n'}},_p[32]={value:function(){return'<div unselectable="on" class="fui-spin-button"></div>\n'}},_p[33]={value:function(){return'<div unselectable="on" class="fui-tabs">\n<div unselectable="on" class="fui-tabs-button-wrap"></div>\n<div unselectable="on" class="fui-tabs-panel-wrap"></div>\n</div>\n'}},_p[34]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(18),i=_p.r(37),r=_p.r(50),o=_p.r(49),a=e.layout;return _p.r(13).createClass("ButtonMenu",{base:_p.r(60),constructor:function(e){var n={menu:null,mask:null,buttons:[],selected:-1,layout:a.RIGHT};e=t.extend({},n,e),this.callBase(e)},open:function(){this.__openState=!0,this.__maskWidget.show(),this.__menuWidget.show(),this.addClass(e.classPrefix+"button-active")},close:function(){this.__openState=!1,this.__maskWidget.hide(),this.__menuWidget.hide(),this.removeClass(e.classPrefix+"button-active")},isOpen:function(){return!!this.__openState},getSelected:function(){return this.__menuWidget.getSelected()},getSelectedItem:function(){return this.__menuWidget.getSelectedItem()},getValue:function(){return this.getSelectedItem().getValue()},__render:function(){this.callBase(),this.__initButtons(),this.__menuWidget=new r(this.__options.menu),this.__maskWidget=new o(this.__options.mask),this.__menuWidget.positionTo(this.__element),this.__menuWidget.appendTo(this.__element.ownerDocument.body)},__initOptions:function(){this.callBase(),this.widgetName="ButtonMenu",this.__tpl=n,this.__buttonWidgets=null,this.__menuWidget=null,this.__maskWidget=null,this.__openState=!1,-1!==this.__options.selected&&(this.__options.menu.selected=this.__options.selected)},__initButtons:function(){var n=[],r=this.__element,o=null,s=this.__options.buttons.length-1;this.__options.layout===a.TOP||this.__options.layout===a.LEFT?(o=new i(this.__options.buttons[s]),o.appendTo(r)):s=-1,t.each(this.__options.buttons,function(t,e){if(s!==t){var a=new i(e);a.appendTo(r),n.push(a)}else n.push(o)}),this.addClass(e.classPrefix+"layout-"+this.__options.layout),n[n.length-1].addClass(e.classPrefix+"open-btn"),this.__buttonWidgets=n},__initEvent:function(){var e=this.__buttonWidgets[this.__buttonWidgets.length-1],n=this;this.callBase(),e.on("click",function(){n.open()}),this.__maskWidget.on("maskclick",function(){n.close()}),this.__menuWidget.on("select",function(t,e){t.stopPropagation(),n.close(),n.trigger("select",e)}).on("change",function(t,e){n.trigger("change",e)}),this.on("btnclick",function(e){e.stopPropagation();var n=t.inArray(e.widget,this.__buttonWidgets);n>-1&&n<this.__buttonWidgets.length-1&&this.trigger("buttonclick",{button:this.__buttonWidgets[n]})})}})}},_p[35]={value:function(){var t=_p.r(4),e=_p.r(25),n=_p.r(43),i=_p.r(50),r=_p.r(49),o=_p.r(13);return _p.r(13).createClass("InputMenu",{base:_p.r(60),constructor:function(t){var n=o.getMarker();this.callBase(n);var i={input:null,menu:null,mask:null};this.__extendOptions(i,t),this.widgetName="InputMenu",this.__tpl=e,this.__lastTime=0,this.__lastSelect=null,this.__inputWidget=null,this.__menuWidget=null,this.__maskWidget=null,this.__menuState=!1,t!==n&&this.__render()},select:function(t){this.__menuWidget.select(t)},setValue:function(t){return this.__inputWidget.setValue(t),this},getValue:function(){return this.__inputWidget.getValue()},__render:function(){return this.__rendered?this:(this.__inputWidget=new n(this.__options.input),this.__menuWidget=new i(this.__options.menu),this.__maskWidget=new r(this.__options.mask),this.callBase(),this.__inputWidget.appendTo(this.__element),this.__menuWidget.positionTo(this.__inputWidget),void this.__initInputMenuEvent())},open:function(){this.__maskWidget.show(),this.__menuWidget.show()},close:function(){this.__maskWidget.hide(),this.__menuWidget.hide()},__initInputMenuEvent:function(){var t=this;this.on("buttonclick",function(){this.__menuState||(this.__appendMenu(),this.__menuState=!0),this.__inputWidget.unfocus(),this.open()}),this.on("keypress",function(){this.__lastTime=new Date}),this.on("keyup",function(t){8!==t.keyCode&&13!==t.keyCode&&new Date-this.__lastTime<500&&this.__update()}),this.on("inputcomplete",function(){this.__inputWidget.selectRange(99999999),this.__inputComplete()}),this.__menuWidget.on("select",function(e,n){e.stopPropagation(),t.setValue(n.value),t.trigger("select",n),t.close()}),this.__menuWidget.on("change",function(e,n){e.stopPropagation(),t.trigger("change",n)}),this.__inputWidget.on("select change",function(t){t.stopPropagation()}),this.__maskWidget.on("maskclick",function(){t.close()}),this.on("select",function(t,e){this.__lastSelect=e})},__update:function(){var e=this.getValue(),n=e.toLowerCase(),i=this.__getItemValues(),r=null;e&&(t.each(i,function(t,e){return 0===e.toLowerCase().indexOf(n)?(r=e,!1):void 0}),r&&(this.__inputWidget.setValue(r),this.__inputWidget.selectRange(e.length)))},__getItemValues:function(){var e=[];return t.each(this.__menuWidget.getWidgets(),function(t,n){e.push(n.getValue())}),e},__inputComplete:function(){var e=this.__getItemValues(),n=-1,i=this.getValue(),r=this.__lastSelect;t.each(e,function(t,e){return e===i?(n=t,!1):void 0}),this.trigger("select",{index:n,value:i}),r&&r.value===i||this.trigger("change",{from:r||{index:-1,value:null},to:{index:n,value:i}})},__appendMenu:function(){this.__menuWidget.appendTo(this.__inputWidget.getElement().ownerDocument.body)}})}},_p[36]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(59);return _p.r(13).createClass("Buttonset",{base:_p.r(51),constructor:function(e){var n={selected:-1};e=t.extend({},n,e),this.callBase(e)},getButtons:function(){return this.getWidgets()},getButton:function(t){return this.getWidgets()[t]||null},getValue:function(){return this.__currentIndex>-1?this.__widgets[this.__currentIndex].getValue():null},getSelectedIndex:function(){return this.__currentIndex},appendButton:function(){return this.appendWidget.apply(this,arguments)},insertButton:function(){return this.insertWidget.apply(this,arguments)},select:function(e){return this.__options.disabled?this:(e instanceof n&&(e=t.inArray(e,this.__widgets)),0>e?this.clearSelect():(e=this.__widgets[e],this.__pressButton(e),this))},selectByValue:function(t){var e=this.__widgets.map(function(t){return t.getValue()});return this.select(e.indexOf(t))},clearSelect:function(){return this.__pressButton(null),this},removeButton:function(){return this.removeWidget.apply(this,arguments)},insertWidget:function(t,e){var n=this.callBase(t,e);return null===n?n:(t<=this.__currentIndex&&this.__currentIndex++,t<=this.__prevIndex&&this.__prevIndex++,n)},removeWidget:function(t){var e=t;return"number"!=typeof e&&(e=this.indexOf(t)),t=this.callBase(t),e===this.__currentIndex?this.__currentIndex=-1:e<this.__currentIndex&&this.__currentIndex--,e===this.__prevIndex?this.__prevIndex=-1:e<this.__prevIndex&&this.__prevIndex--,t},__initOptions:function(){this.callBase(),this.widgetName="Buttonset",this.__currentIndex=this.__options.selected,this.__prevIndex=-1},__render:function(){return this.callBase(),t(this.__element).addClass(e.classPrefix+"buttonset"),this.__initButtons(),this},__initButtons:function(){var e=this,i=null;t.each(this.__options.buttons,function(r,o){i=new n(t.extend({},o,{pressed:r===e.__options.selected,preventDefault:!0})),i.__on("click",function(){e.isDisabled()||e.__pressButton(this)}),i.__on("change",function(t){t.stopPropagation()}),e.appendButton(i)})},__pressButton:function(e){this.__prevIndex=this.__currentIndex,this.__currentIndex=this.indexOf(e),this.__currentIndex!==this.__prevIndex&&(e&&e.press(),t.each(this.__widgets,function(t,n){n!==e&&n.bounce()}),this.trigger("change",{currentIndex:this.__currentIndex,prevIndex:this.__prevIndex}))},__valid:function(t){return t instanceof n}})}},_p[37]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(19),i=_p.r(42),r=_p.r(48);return _p.r(13).createClass("Button",{base:_p.r(60),constructor:function(e){var n={label:null,text:null,icon:null,layout:"right"};e=t.extend({},n,e),this.callBase(e)},getLabel:function(){return this.__labelWidget.getText()},setLabel:function(t){return this.__labelWidget.setText(t)},getLabelWidget:function(){return this.__labelWidget},getIconWidget:function(){return this.__iconWidget},__render:function(){switch(this.callBase(),this.__iconWidget=new i(this.__options.icon),this.__labelWidget=new r(this.__options.label),this.__options.layout){case"left":case"top":this.__element.appendChild(this.__labelWidget.getElement()),this.__element.appendChild(this.__iconWidget.getElement());break;case"right":case"bottom":default:this.__element.appendChild(this.__iconWidget.getElement()),this.__element.appendChild(this.__labelWidget.getElement())}t(this.__element).addClass(e.classPrefix+"button-layout-"+this.__options.layout)},__initOptions:function(){this.callBase(),this.widgetName="Button",this.__tpl=n,this.__iconWidget=null,this.__labelWidget=null,"object"!=typeof this.__options.label&&(this.__options.label={text:this.__options.label}),"object"!=typeof this.__options.icon&&(this.__options.icon={img:this.__options.icon})},__initEvent:function(){this.callBase(),this.on("click",function(){this.__trigger("btnclick")})}})}},_p[38]={value:function(){var t=_p.r(13),e=_p.r(12),n=_p.r(49),i=_p.r(20),r=_p.r(4);return t.createClass("ColorPicker",{base:_p.r(54),constructor:function(t){var e={clearText:"",commonText:"",commonColor:[["#ffffff","#000000","#eeece1","#1f497d","#4f81bd","#c0504d","#9bbb59","#8064a2","#4bacc6","#f79646"],["#f2f2f2","#808080","#ddd8c2","#c6d9f1","#dbe5f1","#f2dbdb","#eaf1dd","#e5dfec","#daeef3","#fde9d9"],["#d9d9d9","#595959","#c4bc96","#8db3e2","#b8cce4","#e5b8b7","#d6e3bc","#ccc0d9","#b6dde8","#fbd4b4"],["#bfbfbf","#404040","#938953","#548dd4","#95b3d7","#d99594","#c2d69b","#b2a1c7","#92cddc","#fabf8f"],["#a6a6a6","#262626","#4a442a","#17365d","#365f91","#943634","#76923c","#5f497a","#31849b","#e36c0a"],["#7f7f7f","#0d0d0d","#1c1a10","#0f243e","#243f60","#622423","#4e6128","#3f3151","#205867","#974706"]],standardText:"",standardColor:["#c00000","#ff0000","#ffc000","#ffff00","#92d050","#00b050","#00b0f0","#0070c0","#002060","#7030a0"]};t=r.extend({},e,t),this.callBase(t)},show:function(){return this.__inDoc||(this.__inDoc=!0,this.appendTo(this.__element.ownerDocument.body)),this.__maskWidget.show(),this.callBase(),this},hide:function(){return this.callBase(),this.__maskWidget.hide(),this},attachTo:function(t){var e=this;t.on("click",function(){e.appendTo(t.getElement().ownerDocument.body),e.positionTo(t),e.show()})},__initOptions:function(){this.callBase(),this.widgetName="ColorPicker",this.__contentElement=null,this.__maskWidget=null,this.__inDoc=!1},__render:function(){this.callBase(),r(this.__element).addClass(e.classPrefix+"colorpicker");var o=t.Tpl.compile(i,this.__options);this.__contentElement.appendChild(r(o)[0]),this.__previewElement=r(this.__contentElement).find("."+e.classPrefix+"colorpicker-preview"),this.__clearElement=r(this.__contentElement).find("."+e.classPrefix+"colorpicker-clear"),this.__maskWidget=new n(this.__options.mask)},__initEvent:function(){var t=this;this.callBase(),this.on("click",function(n){var i,o=r(n.target);o.hasClass(e.classPrefix+"colorpicker-item")?(i=o.attr("data-color"),t.trigger("selectcolor",i),t.hide()):o.hasClass(e.classPrefix+"colorpicker-clear")&&(t.trigger("selectcolor",""),t.hide())}),this.on("mouseover",function(n){var i,o=r(n.target);o.hasClass(e.classPrefix+"colorpicker-item")&&(i=o.attr("data-color"),r(t.__element).find("."+e.classPrefix+"colorpicker-preview").css({"background-color":i,"border-color":i}))}),this.__maskWidget.on("click",function(){t.hide()})}})}},_p[39]={value:function(){var t=_p.r(13),e=_p.r(12),n=_p.r(60),i=_p.r(0),r=_p.r(4);return t.createClass("Container",{base:n,constructor:function(t){var e={column:!1,widgets:null};t=r.extend({},e,t),this.callBase(t)},indexOf:function(t){return r.inArray(t,this.__widgets)},disable:function(){this.callBase(),r.each(this.__widgets,function(t,e){e.disable()})},enable:function(){this.callBase(),r.each(this.__widgets,function(t,e){e.enable()})},getWidgets:function(){return this.__widgets},getWidget:function(t){return this.__widgets[t]||null},getWidgetByValue:function(t){var e=null;return r.each(this.__widgets,function(n,i){return i.getValue()===t?(e=i,!1):void 0}),e},appendWidget:function(t){return this.__valid(t)?(this.__options.disabled&&t.disable(),this.__widgets.push(t),t.appendTo(this.__contentElement),this.__options.column?(this.__widgets.length>0&&this.__widgets.length%this.__options.column===0&&this.__contentElement.appendChild(r('<span class="fui-column"></span>')[0]),r(t.getElement()).addClass(e.classPrefix+"panel-column-widget"),t):t):null},appendWidgets:function(t){var e=this,n=t;return r.isArray(t)||(n=arguments),r.each(n,function(t,n){e.appendWidget(n)}),this},insertWidget:function(t,n){var i=null;return 0===this.__widgets.length?this.appendWidget(n):this.__valid(n)?(this.__options.disabled&&n.disable(),i=this.__widgets[t],this.__widgets.splice(t,0,n),this.__contentElement.insertBefore(n.getElement(),i.getElement()),this.__options.column===!1?n:(this.__contentElement.insertBefore(r('<span class="fui-column"></span>')[0],i.getElement()),r(n.getElement()).addClass(e.classPrefix+"panel-column-widget"),n)):null},insertWidgets:function(t,e){var n=this,i=e;return r.isArray(e)||(i=[].slice.call(arguments,1)),r.each(i,function(e,i){n.insertWidget(t,i),t++}),this},getContentElement:function(){return this.__contentElement},removeWidget:function(t){return"number"==typeof t?t=this.__widgets.splice(t,1)[0]:this.__widgets.splice(this.indexOf(t),1),this.__contentElement.removeChild(t.getElement()),r(t.getElement()).removeClass(e.classPrefix+"panel-column-widget"),t},__initOptions:function(){this.widgetName="Container",this.__widgets=[],this.__contentElement=null,this.__options.column-=0},__render:function(){return this.callBase(),this.__contentElement=this.__element,r(this.__element).addClass(e.classPrefix+"container"),this.__options.column&&r(this.__element).addClass(e.classPrefix+"container-column"),this},__appendChild:function(t){return this.appendWidget(t)},__initWidgets:function(){if(this.__options.widgets){var t=i.parse(this.__options.widgets),e=this;r.isArray(t)||(t=[t]),r.each(t,function(t,n){e.appendWidget(n)})}},__valid:function(t){return t instanceof n}})}},_p[40]={value:function(){var t=_p.r(13),e=_p.r(12),n=_p.r(60),i=_p.r(49),r=_p.r(21),o=_p.r(37),a=e.layout,s=_p.r(4),l={CANCEL:"cancel",OK:"ok"};return t.createClass("Dialog",{base:_p.r(54),constructor:function(t){var n={layout:a.CENTER,caption:null,resize:"height",draggable:!0,closeButton:!0,mask:{color:"#000",opacity:.2},prompt:!1,buttons:[{className:e.classPrefix+"xdialog-ok-btn",action:"ok",label:km.getLang("dialog.confirm")},{className:e.classPrefix+"xdialog-cancel-btn",action:"cancel",label:km.getLang("dialog.cancel")}]};t=s.extend({},n,t),this.callBase(t)},open:function(){return this.__fire("open",function(){this.show()}),this},close:function(){return this.__fire("close",function(){this.hide()}),this},getButtons:function(){return this.__buttons},getButton:function(t){return this.__buttons[t]},appendTo:function(t){return this.callBase(t),this.__maskWidget.appendTo(t),this.__inDoc=!0,this},show:function(){return this.__target||(this.__target=this.__element.ownerDocument.body),this.__inDoc||this.appendTo(this.__element.ownerDocument.body),this.__maskWidget.show(),this.callBase(),this.__openState=!0,this},hide:function(){return this.callBase(),this.__maskWidget.hide(),this.__openState=!1,this},toggle:function(){return this.isOpen()?this.close():this.open(),this},isOpen:function(){return this.__openState},getHeadElement:function(){return this.__headElement},getBodyElement:function(){return this.getContentElement()},getFootElement:function(){return this.__footElement},__initOptions:function(){this.callBase(),this.widgetName="Dialog",this.__target=this.__options.target,this.__layout=this.__options.layout,this.__inDoc=!1,this.__hinting=!1,this.__openState=!1,this.__headElement=null,this.__bodyElement=null,this.__footElement=null,this.__maskWidget=null,this.__buttons=[],this.__target instanceof n&&(this.__target=this.__target.getElement())},__render:function(){this.callBase(),this.__innerTpl=t.Tpl.compile(r,this.__options),this.__contentElement.appendChild(s(this.__innerTpl)[0]),s(this.__element).addClass(e.classPrefix+"dialog"),this.__headElement=s(".fui-dialog-head",this.__contentElement)[0],this.__bodyElement=s(".fui-dialog-body",this.__contentElement)[0],this.__footElement=s(".fui-dialog-foot",this.__contentElement)[0],this.__maskWidget=new i(this.__options.mask),this.__contentElement=this.__bodyElement,this.__options.draggable&&this.__initDraggable(),this.__options.closeButton&&this.__initCloseButton(),this.__initButtons(),this.__initMaskLint()},__action:function(t){switch(t){case l.OK:this.__triggerHandler(t)!==!1&&this.close();break;case l.CANCEL:this.__triggerHandler(t),this.close()}},__initButtons:function(){var t=this,e=null,n=this.__footElement;s.each(this.__options.buttons,function(i,r){e=new o(r),e.appendTo(n),t.__buttons.push(e)})},__initEvent:function(){var t=this;this.callBase(),s([this.__footElement,this.__headElement]).on("btnclick",function(e,n){t.__action(n.getOptions().action,n)}),this.__options.prompt&&s(this.__element).on("keydown",function(e){switch(e.keyCode){case 13:t.__action(l.OK);break;case 27:t.__action(l.CANCEL)}})},__initDraggable:function(){t.createDraggable({handler:this.__headElement,target:this.__element}).bind()},__initCloseButton:function(){var t=new o({className:"fui-close-button",action:"cancel",icon:{className:"fui-close-button-icon"}});t.appendTo(this.__headElement)},__initMaskLint:function(){var t=this;this.__maskWidget.on("click",function(){t.__hint()})},__hint:function(){if(!this.__hinting){this.__hinting=!0;var t=s(this.__element),n=this,i=[e.classPrefix+"mask-hint",e.classPrefix+"mask-animate"];t.addClass(i.join(" ")),window.setTimeout(function(){t.removeClass(i[0]),window.setTimeout(function(){t.removeClass(i[1]),n.__hinting=!1},200)},200)}}})}},_p[41]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(22),i=_p.r(37),r=_p.r(51),o=_p.r(54),a=_p.r(49);return _p.r(13).createClass("DropPanel",{base:_p.r(60),constructor:function(e){var n={button:null,panel:null,width:null,height:null};
|
||
e=t.extend({},n,e),this.callBase(e)},disable:function(){this.callBase()},enable:function(){this.callBase()},open:function(){this.__popupWidget.appendWidget(this.__panelWidget),this.__maskWidget.show(),this.__popupWidget.show();var e=t(this.__popupWidget.getElement());e.css("top",parseInt(e.css("top"))-t(this.__element).outerHeight()),e.css("min-width",t(this.__element).outerWidth()),e.css("min-height",t(this.__element).height())},close:function(){this.__maskWidget.hide(),this.__popupWidget.hide(),this.__panelWidget.appendTo(this.__contentElement)},getPanelElement:function(){return this.__panelWidget.getElement()},appendWidget:function(t){this.__panelWidget.appendWidget(t)},getWidgets:function(){return this.__panelWidget.getWidgets()},getWidget:function(t){return this.__panelWidget.getWidget(t)},appendWidgets:function(){return this.__panelWidget.appendWidgets.apply(this,arguments),this},insertWidget:function(t,e){this.__panelWidget.insertWidget(t,e)},insertWidgets:function(){return this.__panelWidget.insertWidgets.apply(this,arguments),this},removeWidget:function(t){return this.__panelWidget.removeWidget(t)},__render:function(){this.__initOptions(),this.__buttonWidget=new i(this.__options.button),this.__panelWidget=new r(this.__options.content),this.__popupWidget=new o,this.__maskWidget=new a(this.__options.mask),this.callBase(),this.__popupWidget.positionTo(this.__element),t(this.__popupWidget.getElement()).addClass(e.classPrefix+"drop-panel-popup");var n=t('<div class="'+e.classPrefix+'drop-panel-content"></div>').append(this.__panelWidget.getElement());this.__contentElement=n[0],t(this.__element).append(n).append(this.__buttonWidget.getElement()),this.__initDropPanelEvent()},__initOptions:function(){this.widgetName="DropPanel",this.__tpl=n,this.__buttonWidget=null,this.__popupWidget=null,this.__panelWidget=null,this.__contentElement=null,this.__maskWidget=null,this.__popupState=!1,"object"!=typeof this.__options.button&&(this.__options.input={icon:this.__options.button})},__initDropPanelEvent:function(){var t=this;this.__buttonWidget.on("click",function(){t.__popupState||(t.__appendPopup(),t.__popupState=!0),t.trigger("buttonclick"),t.open()}),this.__panelWidget.on("click",function(){t.trigger("panelclick")}),this.__maskWidget.on("maskclick",function(){t.close()})},__appendPopup:function(){this.__popupWidget.appendTo(this.__element.ownerDocument.body)}})}},_p[42]={value:function(){var t=_p.r(4),e=_p.r(23);return _p.r(13).createClass("Icon",{base:_p.r(60),constructor:function(e){var n={img:null};e=t.extend({},n,e),this.callBase(e)},getValue:function(){return this.__options.value||this.__options.img},setImage:function(t){return this.__options.img===t?this:(this.__image&&(this.__image.src=t),void this.trigger("iconchange",{prevImage:this.__prevIcon,currentImage:this.__currentIcon}))},getImage:function(){return this.__currentIcon},__initOptions:function(){this.callBase(),this.widgetName="Icon",this.__tpl=e,this.__prevIcon=null,this.__currentIcon=this.__options.img,this.__image=null},__render:function(){this.__options.__width=this.__options.width,this.__options.__height=this.__options.height,this.__options.width=null,this.__options.height=null,this.callBase(),this.__options.img&&(this.__image=t("img",this.__element)[0],null!==this.__options.__width&&(this.__image.width=this.__options.__width),null!==this.__options.__height&&(this.__image.height=this.__options.__height))}})}},_p[43]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(24),i=_p.r(37),r=_p.r(45);return _p.r(13).createClass("InputButton",{base:_p.r(60),constructor:function(e){var n={button:null,input:null,placeholder:null,layout:"right"};e=t.extend({},n,e),this.callBase(e)},getValue:function(){return this.__inputWidget.getValue()},setValue:function(t){return this.__inputWidget.setValue(t),this},reset:function(){this.__inputWidget.reset()},selectAll:function(){return this.__inputWidget.selectAll(),this},selectRange:function(t,e){return this.__inputWidget.selectRange(t,e),this},focus:function(){return this.__inputWidget.focus(),this},unfocus:function(){return this.__inputWidget.unfocus(),this},__initOptions:function(){this.callBase(),this.widgetName="InputButton",this.__tpl=n,this.__inputWidget=null,this.__buttonWidget=null,"object"!=typeof this.__options.input&&(this.__options.input={placeholder:this.__options.input}),this.__options.input=t.extend({},this.__options.input,{placeholder:this.__options.placeholder}),"object"!=typeof this.__options.button&&(this.__options.button={icon:this.__options.button})},__render:function(){var n=this;switch(this.callBase(),this.__buttonWidget=new i(this.__options.button),this.__inputWidget=new r(this.__options.input),this.__options.layout){case"left":case"top":this.__buttonWidget.appendTo(this.__element),this.__inputWidget.appendTo(this.__element);break;case"right":case"bottom":default:this.__inputWidget.appendTo(this.__element),this.__buttonWidget.appendTo(this.__element)}t(this.__element).addClass(e.classPrefix+"layout-"+this.__options.layout),this.__buttonWidget.on("click",function(){n.trigger("buttonclick")})}})}},_p[44]={value:function(){var t=_p.r(4),e=_p.r(25),n=_p.r(43),i=_p.r(50),r=_p.r(49);return _p.r(13).createClass("InputMenu",{base:_p.r(60),constructor:function(e){var n={input:null,menu:null,mask:null,selected:-1};e=t.extend({},n,e),this.callBase(e)},select:function(t){this.__menuWidget.select(t)},selectByValue:function(t){return this.__selectBy("values",t)},selectByLabel:function(t){return this.__selectBy("labels",t)},clearSelect:function(){return this.__lastSelect=-1,this.__menuWidget.clearSelect(),this.__inputWidget.reset(),this},setValue:function(){return this},getValue:function(){return this.__menuWidget.getSelectedItem().getValue()},open:function(){this.__maskWidget.show(),this.__menuWidget.show()},close:function(){this.__maskWidget.hide(),this.__menuWidget.hide()},__render:function(){this.__inputWidget=new n(this.__options.input),this.__menuWidget=new i(this.__options.menu),this.__maskWidget=new r(this.__options.mask),this.callBase(),this.__inputWidget.appendTo(this.__element),this.__menuWidget.positionTo(this.__inputWidget),this.__initInputValue()},__selectBy:function(e,n){var i=this.__getItemValues()[e],r=-1;return t.each(i,function(t,e){return n===e?(r=t,!1):void 0}),-1!==r?(this.select(r),this.__menuWidget.getSelectedItem()):null},__initInputValue:function(){var t=this.__menuWidget.getItem(this.__options.selected);t&&this.__inputWidget.setValue(t.getLabel())},__initEvent:function(){var t=this;this.callBase(),this.on("buttonclick",function(){this.__menuState||(this.__appendMenu(),this.__menuState=!0),this.__inputWidget.unfocus(),this.open()}),this.on("keypress",function(){this.__lastTime=new Date}),this.on("keyup",function(t){8!==t.keyCode&&13!==t.keyCode&&new Date-this.__lastTime<500&&this.__update()}),this.on("inputcomplete",function(){this.__inputWidget.selectRange(99999999),this.__inputComplete()}),this.__menuWidget.on("select",function(e,n){e.stopPropagation(),t.__inputWidget.setValue(n.label),t.trigger("select",n),t.close()}),this.__menuWidget.on("menuitemclick",function(e,n){t.trigger("itemclick",n)}),this.__menuWidget.on("change",function(e,n){e.stopPropagation(),t.trigger("change",n)}),this.__inputWidget.on("select change",function(t){t.stopPropagation()}),this.__maskWidget.on("maskclick",function(){t.close()}),this.on("select",function(t,e){this.__lastSelect=e})},__update:function(){var e=this.__inputWidget.getValue(),n=e.toLowerCase(),i=this.__getItemValues().labels,r=null;e&&(t.each(i,function(t,e){return 0===e.toLowerCase().indexOf(n)?(r=e,!1):void 0}),r&&(this.__inputWidget.setValue(r),this.__inputWidget.selectRange(e.length)))},__getItemValues:function(){var e=[],n=[];return t.each(this.__menuWidget.getWidgets(),function(t,i){n.push(i.getLabel()),e.push(i.getValue())}),{labels:n,values:e}},__inputComplete:function(){var e=this.__getItemValues(),n=e.labels,i=-1,r=this.__inputWidget.getValue(),o=this.__lastSelect;t.each(n,function(t,e){return e===r?(i=t,!1):void 0}),this.trigger("select",{index:i,label:r,value:e.values[i]}),o&&o.value===r||this.trigger("change",{from:o||{index:-1,label:null,value:null},to:{index:i,label:r,value:e.values[i]}})},__appendMenu:function(){this.__menuWidget.appendTo(this.__inputWidget.getElement().ownerDocument.body)},__initOptions:function(){this.callBase(),this.widgetName="InputMenu",this.__tpl=e,this.__lastTime=0,this.__lastSelect=null,this.__inputWidget=null,this.__menuWidget=null,this.__maskWidget=null,this.__menuState=!1,-1!==this.__options.selected&&(this.__options.menu.selected=this.__options.selected)}})}},_p[45]={value:function(){var t=_p.r(12),e=_p.r(4),n=_p.r(26);return _p.r(13).createClass("Input",{base:_p.r(60),constructor:function(t){var n={placeholder:null};t=e.extend({},n,t),this.callBase(t)},getValue:function(){return this.__element.value},setValue:function(t){return this.__element.value=t,this},disable:function(){this.callBase(),this.__element.disabled=!0},enable:function(){this.__element.disabled=!1,this.callBase()},reset:function(){return this.__element.value=this.__options.value||"",this},selectAll:function(){this.__element.select()},selectRange:function(t,e){t||(t=0),e||(e=1e9),this.__element.setSelectionRange(t,e)},focus:function(){return this.__element.focus(),this},unfocus:function(){return this.__element.blur(),this},__initOptions:function(){this.callBase(),this.widgetName="Input",this.__tpl=n,this.__allow_focus=!0},__render:function(){this.callBase(),this.__element.removeAttribute("unselectable"),this.__options.placeholder&&this.__element.setAttribute("placeholder",this.__options.placeholder),this.addClass(t.classPrefix+"selectable")},__initEvent:function(){this.callBase(),this.on("keydown",function(t){13===t.keyCode&&this.trigger("inputcomplete",{value:this.getValue()})})}})}},_p[46]={value:function(){var t=_p.r(13),e=_p.r(27),n=_p.r(42),i=_p.r(48),r=_p.r(12),o=_p.r(4);return t.createClass("Item",{base:_p.r(60),constructor:function(t){var e={label:"",icon:null,selected:!1,textAlign:"left"};t=o.extend({},e,t),this.callBase(t)},getValue:function(){return this.__options.value||this.__labelWidget.getValue()||this.__iconWidget.getValue()||null},select:function(){return this.__update(!0),this},unselect:function(){return this.__update(!1),this},isSelected:function(){return this.__selectState},setLabel:function(t){return this.__labelWidget.setText(t),this},getLabel:function(){return this.__labelWidget.getText()},setIcon:function(t){return this.__iconWidget.setImage(t),this},getIcon:function(){return this.__iconWidget.getImage()},__render:function(){this.callBase(),this.__iconWidget=new n(this.__options.icon),this.__labelWidget=new i(this.__options.label),this.__iconWidget.appendTo(this.__element),this.__labelWidget.appendTo(this.__element)},__update:function(t){var e=t?"addClass":"removeClass";return t=!!t,o(this.__element)[e](r.classPrefix+"item-selected"),this.__selectState=t,this.trigger(t?"itemselect":"itemunselect"),this},__initEvent:function(){this.callBase(),this.on("click",function(){this.trigger("itemclick")})},__initOptions:function(){this.callBase(),this.widgetName="Item",this.__tpl=e,this.__iconWidget=null,this.__labelWidget=null,this.__selectState=this.__options.selected,"object"!=typeof this.__options.label&&(this.__options.label={text:this.__options.label}),this.__options.label.textAlign||(this.__options.label.textAlign=this.__options.textAlign),"object"!=typeof this.__options.icon&&(this.__options.icon={img:this.__options.icon})}})}},_p[47]={value:function(){var t=_p.r(13),e=_p.r(12),n=_p.r(48),i=_p.r(4);return t.createClass("LabelPanel",{base:_p.r(51),constructor:function(t){var e={layout:"bottom"};t=i.extend({},e,t),this.callBase(t)},disable:function(){this.callBase(),this.__labelWidget.disable()},enable:function(){this.callBase(),this.__labelWidget.enable()},__render:function(){var t=null,r=this.__options,o=this.__element,a=e.classPrefix,s="fui-label-panel-content",l=null;return this.__labelWidget=new n(r.label),this.callBase(),l=this.__contentElement,i(o).addClass(a+"label-panel"),i(o).addClass(a+"layout-"+r.layout),t=i('<div class="'+s+'"></div>'),l.appendChild(this.__labelWidget.getElement()),l.appendChild(t[0]),this.__contentElement=t[0],this},__initOptions:function(){var t=this.__options.label;this.callBase(),this.widgetName="LabelPanel",this.__labelWidget=null,"object"!=typeof t&&(this.__options.label={text:t}),this.__options.label.className||(this.__options.label.className=""),this.__options.label.className+=" fui-label-panel-label"}})}},_p[48]={value:function(){var t=_p.r(13),e=_p.r(28),n=_p.r(4);return t.createClass("Label",{base:_p.r(60),constructor:function(t){var e={text:"",textAlign:"center"};t=n.extend({},e,t),this.callBase(t)},getValue:function(){return this.__options.text},setText:function(t){var e=this.__options.text;return this.__options.text=t,n(this.__element).text(t),this.trigger("labelchange",{currentText:t,prevText:e}),this},getText:function(){return this.__options.text},__allowShowTitle:function(){return!1},__initOptions:function(){this.callBase(),this.widgetName="Label",this.__tpl=e,this.__options.text=this.__options.text.toString()}})}},_p[49]={value:function(){function t(){r(window).on("resize",function(){r.each(a,function(t,e){e&&!e.isHide()&&e.__resize()})})}var e=_p.r(13),n=_p.r(29),i=_p.r(60),r=_p.r(4),o=!1,a=[];return e.createClass("Mask",{base:_p.r(60),constructor:function(t){var e={bgcolor:"#000",opacity:0,inner:!0,target:null,scroll:!1,hide:!0};t=r.extend({},e,t),this.callBase(t)},maskTo:function(t){return t&&(this.__target=t),this},show:function(){var t=null;this.__target||(this.__target=this.__element.ownerDocument.body),t=this.__target.ownerDocument.documentElement,r.contains(t,this.__element)||this.appendTo(this.__target.ownerDocument.body),this.callBase(),this.__position(),this.__resize(),this.__hideState=!1},hide:function(){this.callBase(),this.__hideState=!0},isHide:function(){return this.__hideState},__initOptions:function(){this.callBase(),this.widgetName="Mask",this.__tpl=n,this.__cacheId=a.length,this.__hideState=!0,a.push(this),this.__target=this.__options.target,this.__target instanceof i&&(this.__target=this.__target.getElement())},__render:function(){this.callBase(),this.__initMaskEvent(),o||(o=!0,t())},__initMaskEvent:function(){this.on("mousewheel",function(t){var e=t.originalEvent;t.preventDefault(),t.stopPropagation(),this.trigger("scroll",{delta:e.wheelDelta||e.deltaY||e.detail})}),this.on("click",function(t){t.stopPropagation(),t.target===this.__element&&this.trigger("maskclick")})},__resize:function(){var t=null;this.__targetIsBody()?(t=r(e.getView(this.__target)),t={width:t.width(),height:t.height()}):t=e.getRect(this.__target),this.__element.style.width=t.width+"px",this.__element.style.height=t.height+"px"},__position:function(){var t=null,n=null;this.__targetIsBody()?t={top:0,left:0}:(n=e.getRect(this.__target),t={top:n.top,left:n.left}),r(this.__element).css("top",t.top+"px").css("left",t.left+"px")},__targetIsBody:function(){return"body"===this.__target.tagName.toLowerCase()}})}},_p[50]={value:function(){var t=_p.r(13),e=_p.r(46),n=_p.r(12),i=_p.r(4);return t.createClass("Menu",{base:_p.r(54),constructor:function(t){var e={column:!0,selected:-1,textAlign:"left",items:[]};t=i.extend({},e,t),this.callBase(t)},select:function(t){var e=this.__widgets[t];return e?(this.__selectItem(e),this):this},clearSelect:function(){var t=this.getSelectedItem();t&&t.unselect(),this.__currentSelect=-1,this.__prevSelect=-1},getItems:function(){return this.getWidgets.apply(this,arguments)},getItem:function(){return this.getWidget.apply(this,arguments)},appendItem:function(){return this.appendWidget.apply(this,arguments)},insertItem:function(){return this.insertWidget.apply(this,arguments)},removeItem:function(){return this.removeWidget.apply(this,arguments)},clearItems:function(){for(;this.getItems().length;)this.removeItem(0);return this},getSelected:function(){return this.__currentSelect},getSelectedItem:function(){return this.getItem(this.__currentSelect)},insertWidget:function(t,e){var n=this.callBase(t,e);return null===n?n:(t<=this.__currentSelect&&this.__currentSelect++,t<=this.__prevSelect&&this.__prevSelect++,n)},removeWidget:function(t){var e=t;return"number"!=typeof e&&(e=this.indexOf(t)),t=this.callBase(t),e===this.__currentSelect?this.__currentSelect=-1:e<this.__currentSelect&&this.__currentSelect--,e===this.__prevSelect?this.__prevSelect=-1:e<this.__prevSelect&&this.__prevSelect--,t},__initOptions:function(){this.callBase(),this.__prevSelect=-1,this.__currentSelect=this.__options.selected,this.widgetName="Menu"},__render:function(){var t=this,r=this.__options.textAlign,o=this.__options.selected;this.callBase(),i(this.__element).addClass(n.classPrefix+"menu"),i.each(this.__options.items,function(n,i){"object"!=typeof i&&(i={label:i}),i.selected=n===o,i.textAlign=r,t.appendItem(new e(i))})},__initEvent:function(){this.callBase(),this.on("itemclick",function(t){this.__selectItem(t.widget,!0)})},__selectItem:function(t,e){var n=null;if(this.__currentSelect>-1&&this.__widgets[this.__currentSelect].unselect(),this.__prevSelect=this.__currentSelect,this.__currentSelect=this.indexOf(t),t.select(),n={index:this.__currentSelect,label:t.getLabel(),value:t.getValue()},e&&this.trigger("menuitemclick",n),this.trigger("select",n),this.__prevSelect!==this.__currentSelect){var i=this.__widgets[this.__prevSelect]||null;this.trigger("change",{from:{index:this.__prevSelect,label:i&&i.getLabel(),value:i&&i.getValue()},to:{index:this.__currentSelect,label:t.getLabel(),value:t.getValue()}})}},__valid:function(t){return t instanceof e}})}},_p[51]={value:function(){var t=_p.r(13),e=_p.r(30),n=_p.r(4);return t.createClass("Panel",{base:_p.r(39),constructor:function(t){var e={};t=n.extend({},e,t),this.callBase(t)},__render:function(){var t=null;this.callBase(),t=n('<div class="fui-panel-content"></div>'),this.__contentElement.appendChild(t[0]),this.__contentElement=t[0]},__initOptions:function(){this.callBase(),this.widgetName="Panel",this.__tpl=e}})}},_p[52]={value:function(){var t=_p.r(13),e=_p.r(12),n=_p.r(4),i=_p.r(50);return t.createClass("PopupMenu",{base:_p.r(53),constructor:function(t){this.callBase(n.extend({menu:{}},t))},getMenuWidget:function(){return this.__menuWidget},__initOptions:function(){this.callBase(),this.widgetName="PopupMenu"},__render:function(){this.callBase(),this.__menuWidget=new i,this.appendWidget(this.__menuWidget),n(this.__element).addClass(e.classPrefix+"popup-menu")}})}},_p[53]={value:function(){var t=_p.r(13),e=_p.r(12),n=_p.r(60),i=_p.r(49),r=_p.r(4);return t.createClass("Popup",{base:_p.r(54),constructor:function(t){var e={mask:{}};t=r.extend({},e,t),this.callBase(t)},open:function(){return this.__fire("open",function(){this.show()}),this},close:function(){return this.__fire("close",function(){this.hide()}),this},show:function(){return this.__target||(this.__target=this.__element.ownerDocument.body),this.__inDoc||(this.__inDoc=!0,this.appendTo(this.__element.ownerDocument.body)),this.__maskWidget.show(),this.callBase(),this.__openState=!0,this},hide:function(){return this.callBase(),this.__maskWidget.hide(),this.__openState=!1,this},toggle:function(){return this.isOpen()?this.close():this.open(),this},isOpen:function(){return this.__openState},__initOptions:function(){this.callBase(),this.widgetName="Popup",this.__target=this.__options.target,this.__layout=this.__options.layout,this.__inDoc=!1,this.__openState=!1,this.__maskWidget=null,this.__target instanceof n&&(this.__target=this.__target.getElement())},__render:function(){this.callBase(),r(this.__element).addClass(e.classPrefix+"popup"),this.__maskWidget=new i(this.__options.mask),this.__options.draggable&&this.__initDraggable(),this.__initMaskEvent()},__initMaskEvent:function(){var t=this;this.__maskWidget.on("click",function(){t.close()})}})}},_p[54]={value:function(){var t=_p.r(13),e=_p.r(12),n=_p.r(60),i=e.layout,r=_p.r(4);return t.createClass("PPanel",{base:_p.r(51),constructor:function(t){var e={layout:i.BOTTOM,target:null,bound:null,diff:10,hide:!0,resize:"all",iframe:!1};t=r.extend({},e,t),this.callBase(t)},positionTo:function(t,e){return t instanceof n&&(t=t.getElement()),this.__target=t,e&&(this.__layout=e),this},show:function(){var e=null;return this.__target?(this.__options.bound||(this.__options.bound=this.__target.ownerDocument.body),e=this.__target.ownerDocument.documentElement,r.contains(e,this.__element)||this.__target.ownerDocument.body.appendChild(this.__element),r.contains(e,this.__target)&&(this.callBase(t.getMarker()),this.__position(),this.__resize()),this):this.callBase()},__initOptions:function(){this.callBase(),this.widgetName="PPanel",this.__target=this.__options.target,this.__layout=this.__options.layout,this.__height_resized=!1},__render:function(){this.callBase(),this.__options.iframe&&r('<iframe class="fui-ppanel-cover" frameborder="0"></iframe>').appendTo(this.__element),r(this.__element).addClass(e.classPrefix+"ppanel")},__position:function(){var t=null,n=e.classPrefix+"ppanel-position";r(this.__element).addClass(n),t=this.__getLocation(),r(this.__element).css("top",t.top+"px").css("left",t.left+"px")},__resize:function(){var e=t.getBound(this.__target);switch(this.__options.resize){case"all":this.__resizeWidth(e),this.__resizeHeight();break;case"width":this.__resizeWidth(e);break;case"height":this.__resizeHeight()}},__resizeWidth:function(t){if(this.__target){var e=r(this.__element),n=e.outerWidth(),i=e.outerHeight(),o=t.width-n-i;this.__element.style.minWidth=o+"px"}},__resizeHeight:function(){var e=null,n=null,i=0;n=t.getRect(this.__element),n.height=this.__element.scrollHeight,n.bottom=n.top+n.height,e=this.__getBoundRect(),i=n.bottom-e.bottom,i>0?(this.__height_resized=!0,i=n.height-i-this.__options.diff,r(this.__element).css("height",i+"px")):this.__height_resized&&(this.__element.style.height=null)},__getLocation:function(){var e=t.getBound(this.__target);switch(this.__layout){case i.CENTER:case i.MIDDLE:return this.__getCenterLayout(e);case i.LEFT:case i.RIGHT:case i.BOTTOM:case i.TOP:return this.__getOuterLayout(e);default:return this.__getInnerLayout(e)}return location},__getCenterLayout:function(e){var n={top:0,left:0},i=t.getRect(this.__element),r=0;return r=e.height-i.height,r>0&&(n.top=e.top+r/2),r=e.width-i.width,r>0&&(n.left=e.left+r/2),n},__getOuterLayout:function(e){var n={top:0,left:0},r=t.getRect(this.__element);switch(this.__layout){case i.TOP:n.left=e.left,n.top=e.top-r.height;break;case i.LEFT:n.top=e.top,n.left=e.left-r.width;break;case i.RIGHT:n.top=e.top,n.left=e.right;break;case i.BOTTOM:default:n.left=e.left,n.top=e.bottom}return n},__getInnerLayout:function(e){var n={top:0,left:0},r=e,o=t.getRect(this.__element);switch(this.__layout){case i.LEFT_TOP:n.top=r.top,n.left=r.left;break;case i.RIGHT_TOP:n.top=r.top,n.left=r.left+r.width-o.width;break;case i.LEFT_BOTTOM:n.top=r.top+r.height-o.height,n.left=r.left;break;case i.RIGHT_BOTTOM:n.top=r.top+r.height-o.height,n.left=r.left+r.width-o.width}return this.__correctionLocation(n)},__getBoundRect:function(){var e=-1,n=-1,i=null;return"body"===this.__options.bound.tagName.toLowerCase()?(i=t.getView(this.__options.bound),e=r(i).width(),n=r(i).height(),{top:0,left:0,right:e,bottom:n,width:e,height:n}):t.getRect(this.__options.bound)},__correctionLocation:function(e){var n=t.getRect(this.__element),r=t.getRect(this.__target),o=this.__getBoundRect();switch(this.__layout){case i.LEFT_TOP:case i.LEFT_BOTTOM:e.left+n.width>o.right&&(e.left+=r.width-n.width);break;case i.RIGHT_TOP:case i.RIGHT_BOTTOM:e.left<o.left&&(e.left=r.left)}return e}})}},_p[55]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(51),i=_p.r(54),r=_p.r(37),o=_p.r(0),a=_p.r(49);return _p.r(13).createClass("SelectMenu",{base:n,constructor:function(e){var n={bed:{className:"fui-select-menu-bed"},button:{className:"fui-select-menu-btn"},events:["btnclick"],selected:-1};e=t.extend({},n,e),this.callBase(e)},show:function(){this.__widgetMenu.show(),this.__mask.show()},hide:function(){this.__widgetMenu.hide(),this.__mask.hide()},getValue:function(){var t=this.__widgets[this.__selected];return t?t.getValue():null},getSelected:function(){return this.__widgets[this.__selected]},select:function(t){var e=this.__widgets[t],n="fui-select-menu-selected",i=this.__selected,r=this.__widgets[this.__selected],o=this.__bed.getElement();return e?(r&&r.removeClass(n),o.innerHTML="",o.appendChild(e.cloneElement()),e.addClass(n),this.__selected=t,this.trigger("select",{index:t,widget:e}),this.__selected!==i&&this.trigger("change",{from:{index:i,widget:r},to:{index:t,widget:e}}),this):this},selectByWidget:function(t){return this.select(this.indexOf(t))},selectByValue:function(e){var n=-1;return t.each(this.__widgets,function(t,i){return i.getValue()===e?(n=t,!1):void 0}),this.select(n)},__render:function(){this.__bed=new n(this.__options.bed),this.__dropBtn=new r(this.__options.button),this.__widgetMenu=new i({className:"fui-select-menu-container",layout:e.layout.LEFT_TOP,column:this.__column}),this.__mask=new a;var s=this.__initWidgets();this.callBase(),t(this.__element).addClass(e.classPrefix+"select-menu"),this.appendWidgets([this.__bed,this.__dropBtn,this.__mask,this.__widgetMenu]),this.__widgets=[],this.__oldContentElement=this.__contentElement,this.__contentElement=this.__widgetMenu,this.appendWidgets(s),this.__widgetMenu.positionTo(this.getElement()),t.isNumeric(this.__options.selected)?-1!=this.__options.selected&&this.select(this.__options.selected):this.__bed.appendWidget(o.parse(this.__options.selected))},__initWidgets:function(){var e=[];if(this.__options.widgets)return t.each(this.__options.widgets,function(t,n){e.push(o.parse(n))}),e},__initEvent:function(){this.callBase();var t=this;this.__dropBtn.on("btnclick",function(){t.show()}),this.__mask.on("click",function(){t.hide()}),this.__widgetMenu.on(this.__options.events.join(" "),function(e){var n=e.target;if(n!==t.__oldContentElement&&n!==t.getElement)return e.stopPropagation(),t.selectByWidget(e.widget),t.hide(),!1})},__initOptions:function(){this.callBase(),this.widgetName="SelectMenu",this.__bed=null,this.__dropBtn=null,this.__widgetMenu=null,this.__mask=null,this.__widgets=[],this.__selected=-1,this.__oldContentElement=null,this.__column=this.__options.column,delete this.__options.column}})}},_p[56]={value:function(){var t=_p.r(13),e=_p.r(31),n=_p.r(4);return t.createClass("Separator",{base:_p.r(60),constructor:function(t){var e={width:1,height:"100%",bgcolor:"#e1e1e1"};t=n.extend({},e,t),this.callBase(t)},__initOptions:function(){this.callBase(),this.widgetName="Separator",this.__tpl=e}})}},_p[57]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(32),i=_p.r(37),r=_p.r(45),o=_p.r(51);return _p.r(13).createClass("SpinButton",{base:_p.r(60),constructor:function(e){var n={suffix:null,selected:-1,items:[]};e=t.extend({},n,e),this.callBase(e)},getValue:function(){return this.__options.items[this.__currentSelected]||null},setValue:function(){},select:function(t){this.__update(t)},selectByValue:function(e){e+="",this.__update(t.inArray(e,this.__options.items))},__render:function(){this.callBase(),this.__buttons=[new i({className:e.classPrefix+"spin-up-btn"}),new i({className:e.classPrefix+"spin-down-btn"})],this.__inputWidget=new r,this.__panelWidget=new o({column:!0}),this.__inputWidget.appendTo(this.__element),this.__panelWidget.appendWidget(this.__buttons[0]),this.__panelWidget.appendWidget(this.__buttons[1]),this.__panelWidget.appendTo(this.__element),this.__initSelected(this.__options.selected)},__initEvent:function(){var t=this;this.callBase(),this.__buttons[0].on("btnclick",function(){t.__update(t.__currentSelected-1)}),this.__buttons[1].on("btnclick",function(){t.__update(t.__currentSelected+1)})},__initSelected:function(t){this.__update(t,!1)},__update:function(t,e){var n=-1,i=null,r=null;0>t||t>=this.__options.items.length||(n=this.__currentSelected,this.__currentSelected=t,r=this.__options.items[this.__currentSelected],i=r+" "+(this.__options.suffix||""),this.__inputWidget.setValue(i),e!==!1&&this.trigger("change",{from:this.__options.items[n]||null,to:r}))},__initOptions:function(){var e=this.__options.items;this.callBase(),this.widgetName="SpinButton",this.__tpl=n,this.__buttons=[],this.__panelWidget=null,this.__inputWidget=null,this.__currentSelected=-1,t.each(e,function(t,n){e[t]=n+""})}})}},_p[58]={value:function(){var t=_p.r(4),e=_p.r(12),n=_p.r(33),i=_p.r(37),r=_p.r(51);return _p.r(13).createClass("Tabs",{base:_p.r(60),constructor:function(e){var n={selected:0,buttons:[],panels:[]};e=t.extend({},n,e),this.callBase(e)},getButtons:function(){return this.__btns},getButton:function(t){return this.getButtons()[t]||null},getButtonByValue:function(e){var n=null;return t.each(this.__btns,function(t,i){return i.getValue()===e?(n=i,!1):void 0}),n},getPanels:function(){return this.__panels},getPanel:function(t){return this.getPanels()[t]||null},getPanelByValue:function(e){var n=null;return t.each(this.__panels,function(t,i){return i.getValue()===e?(n=i,!1):void 0}),n},getSelectedIndex:function(){return this.__selected},getSelected:function(){var t=this.getSelectedIndex();return{button:this.getButton(t),panel:this.getPanel(t)}},appendTab:function(t){return t.panels=t.panels||[],this.__renderByOptions(t)},removeTab:function(t){if(0>t)return null;var e=this.__btns.splice(t,1),n=this.__panels.splice(t,1);return e.length?(e=e[0],n=n[0],e.remove(),n.remove(),{button:e,panel:n}):null},select:function(t){var e=null;return this.__selectItem(t)?(e=this.__getInfo(t),this.trigger("tabsselect",e),this.__prevSelected!==this.__selected&&this.trigger("tabschange",{from:this.__getInfo(this.__prevSelected),to:e}),this):this},getIndexByButton:function(e){return t.inArray(e,this.__btns)},appendButtonTo:function(e){t.each(this.__btns,function(t,n){n.appendTo(e)})},appendPanelTo:function(e){t.each(this.__panels,function(t,n){n.appendTo(e)})},__render:function(){this.callBase(),this.__btnWrap=t(".fui-tabs-button-wrap",this.__element)[0],this.__panelWrap=t(".fui-tabs-panel-wrap",this.__element)[0],this.__renderByOptions(this.__options),this.__selectItem(this.__options.selected)},__renderByOptions:function(e){var n=this,o=[],a=this.__btns,s=this.__panels,l=this.__btnWrap,u=this.__panelWrap;return t.each(e.buttons,function(t,c){var h=null,d=null;"object"!=typeof c&&(c={label:c}),h=new i(c),h.on("click",function(){n.select(n.getIndexByButton(this))}),c=e.panels[t]||{},c.hide=!0,d=new r(c),a.push(h),s.push(d),o.push({button:h,panel:d}),h.appendTo(l),d.appendTo(u)}),o},__initOptions:function(){this.callBase(),this.widgetName="Tabs",this.__tpl=n,this.__btns=[],this.__panels=[],this.__prevSelected=-1,this.__selected=-1,this.__btnWrap=null,this.__panelWrap=null,null===this.__options.panels&&(this.__options.panels=[],this.__options.panels.length=this.__options.buttons.length)},__selectItem:function(t){var n=this.getButton(t),i=this.getButton(this.__selected),r=e.classPrefix+"selected";return n?(i&&(i.removeClass(r),this.getPanel(this.__selected).hide()),n.addClass(r),this.getPanel(t).show(),this.__prevSelected=this.__selected,this.__selected=t,!0):!1},__getInfo:function(t){return{index:t,button:this.getButton(t),panel:this.getPanel(t)}}})}},_p[59]={value:function(){var t=_p.r(4),e=_p.r(12);return _p.r(13).createClass("ToggleButton",{base:_p.r(37),constructor:function(e){var n={pressed:!1};e=t.extend({},n,e),this.callBase(e)},isPressed:function(){return this.__state},press:function(){var n=e.classPrefix+"button-pressed";t(this.__element).addClass(n),this.__updateState(!0)},bounce:function(){var n=e.classPrefix+"button-pressed";t(this.__element).removeClass(n),this.__updateState(!1)},toggle:function(){this.__state?this.bounce():this.press()},__initOptions:function(){this.callBase(),this.widgetName="ToggleButton",this.__state=!1},__render:function(){return this.callBase(),t(this.__element).addClass(e.classPrefix+"toggle-button"),this.__initButtonState(),this
|
||
},__initButtonState:function(){this.__options.pressed&&(t(this.__element).addClass(e.classPrefix+"button-pressed"),this.__state=!0)},__initEvent:function(){this.callBase(),this.on("click",function(){this.toggle()})},__updateState:function(t){t=!!t,this.__state=t,this.trigger("change",t,!t)}})}},_p[60]={value:function(){function t(){return e+ ++n}var e="_fui_",n=0,i=_p.r(12),r=_p.r(11),o=_p.r(4),a=_p.r(13),s=a.createClass("Widget",{constructor:function(t){var e={id:null,className:"",disabled:!1,preventDefault:!1,text:"",value:null,hide:!1,width:null,height:null};this.__widgetType="widget",this.__tpl="",this.__compiledTpl="",this.__options={},this.__element=null,this.__allow_focus=!!i.allowFocus,this.widgetName="Widget",this.__extendOptions(e,t),this.__initOptions(),this.__render(),this.__initEvent(),this.__initWidgets&&this.__initWidgets()},getId:function(){return this.id},getValue:function(){return this.__options.value},getOptions:function(){return this.__options},setValue:function(t){return this.__options.value=t,this},show:function(){return this.__show(),this},hide:function(){return this.__hide(),this},addClass:function(t){return o(this.__element).addClass(t),this},removeClass:function(t){return o(this.__element).removeClass(t),this},setStyle:function(){return o.fn.css.apply(o(this.__element),arguments),this},getStyle:function(){return o.fn.css.apply(o(this.__element),arguments)},isDisabled:function(){return this.__options.disabled},enable:function(){return this.__options.disabled=!1,o(this.__element).removeClass(i.classPrefix+"disabled"),this},disable:function(){return this.__options.disabled=!0,o(this.__element).addClass(i.classPrefix+"disabled"),this},cloneElement:function(){return this.__element.cloneNode(!0)},getElement:function(){return this.__element},appendTo:function(t){if(a.isElement(t))t.appendChild(this.__element);else{if(!(t instanceof s))throw new Error("TypeError: Widget.appendTo()");t.__appendChild(this)}return this},remove:function(){var t=this.__element.parentNode;return t&&t.removeChild(this.__element),this},off:function(t,e){return o(this.__element).off(e&&e.__fui_listener),this},on:function(t,e){return this.__options.preventDefault||this.__on(t,e),this},__initOptions:function(){},__render:function(){var t=null,e=this.__tpl,n=this.__options,s=null;return this.id=this.__id(),r.__registerInstance(this),this.__compiledTpl=a.Tpl.compile(e,n),this.__element=o(this.__compiledTpl)[0],this.__element.setAttribute("id",this.id),t=o(this.__element),n.disabled&&t.addClass(i.classPrefix+"disabled"),t.addClass(i.classPrefix+"widget"),s=n.className,s.length>0&&t.addClass(o.isArray(s)?s.join(" "):s),this.__initBasicEnv(),n.hide&&this.__hide(),n.style&&this.setStyle(n.style),this},__appendChild:function(t){return this.__element.appendChild(t.getElement())},__initEvent:function(){this.on("mousedown",function(t){var e=t.target.tagName.toLowerCase();i.control[e]||this.__allowFocus()?t.stopPropagation():t.preventDefault()})},__on:function(t,e){var n=this;return e.__fui_listener=function(t,i){for(var r=[],o=0,a=arguments.length;a>o;o++)1!==o&&r.push(arguments[o]);return t.widget=i,n.isDisabled()?void 0:e.apply(n,r)},o(this.__element).on(t,e.__fui_listener),this},trigger:function(){return this.__options.preventDefault||this.__trigger.apply(this,arguments),this},__allowShowTitle:function(){return!0},__allowFocus:function(){return!!this.__allow_focus},__trigger:function(t){var e=[].slice.call(arguments,1);return o(this.__element).trigger(t,[this].concat(e)),this},__triggerHandler:function(t){var e=[this].concat([].slice.call(arguments,1));return o(this.__element).triggerHandler(t,e)},__fire:function(t,e){var n={cancel:!1};return/^(before|after)/.test(t)?this:(this.__trigger("before"+t,n),n.cancel===!0?this:(n=e.call(this,t),this.__trigger(t),this.__trigger("after"+t,n),this))},__extendOptions:function(){var t=[{},this.__options],e=[!0];t=t.concat([].slice.call(arguments,0));for(var n=0,i=t.length;i>n;n++)"string"!=typeof t[n]&&e.push(t[n]);this.__options=o.extend.apply(o,e)},__hide:function(){o(this.__element).addClass(i.classPrefix+"hide")},__show:function(){o(this.__element).removeClass(i.classPrefix+"hide")},__initBasicEnv:function(){this.__options.text&&this.__allowShowTitle()&&this.__element.setAttribute("title",this.__options.text),this.__options.width&&(this.__element.style.width=this.__options.width+"px"),this.__options.height&&(this.__element.style.height=this.__options.height+"px"),this.widgetName&&this.__element.setAttribute("rule",this.widgetName)},__id:function(){return this.__options.id||t()}});return s}},_p[61]={value:function(){_p.r(1),_p.r(2)}};var moduleMapping={"fui.export":61};use("fui.export")}(),function(t){function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t}function n(){Error.apply(this,arguments)}function i(t){if(Error.call(this,t),"object"==typeof t)for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);else this.detail=t}function r(t,e){this.id=t,this.username=e}function o(t){this.content=t,this.type=t instanceof Blob?u.file.TYPE_BLOB:"string"==typeof t?u.file.TYPE_TEXT:"object"==typeof t?u.file.TYPE_JSON:u.file.TYPE_UNKNOWN}function a(t){this.setPath(t),this.isDir=!1,this.data=null,this.size=0,this.createTime=new Date,this.modifyTime=new Date}function s(t,e,n){this.user=t,this.file=e,this.access=n||0}function l(t,e,n){this.path=t,this.method=e,this.user=n,this.dupPolicy=u.file.DUP_FAIL,this.newPath=null,this.acl=null,this.extra=null,this.dataType=u.file.TYPE_TEXT}var u={version:"1.0"};u.provider={},u.file={},u.user={};var c={},h=null,d=function(){return new t.resolve(null)},f={check:d,login:d,logout:d,init:d,current:d};e(n,Error),e(i,Error),u.AuthError=n,u.FileRequestError=i,a.prototype.setPath=function(t){u.file.anlysisPath(t,this)},u.file.anlysisPath=function(t,e){e=e||{};for(var n=t.split("/");"/"==n[0]||""===n[0];)n.shift();for(;"/"==n[n.length-1]||""===n[n.length-1];)n.pop();if(e.filename=n.pop()||null,e.parentPath=n.length?"/"+n.join("/")+"/":e.filename?"/":null,e.filename){var i=e.filename.split(".");e.extension=i.length>1?"."+i.pop():null,e.name=i.join("."),e.path=e.parentPath+e.filename}else e.path="/";return e},u.user.User=r,u.file.Data=o,u.file.File=a,u.file.Acl=s,u.file.FileRequest=l,u.file.TYPE_TEXT="text",u.file.TYPE_JSON="json",u.file.TYPE_BLOB="blob",u.file.TYPE_UNKNOWN="unknown",u.file.METHOD_READ="read",u.file.METHOD_WRITE="write",u.file.METHOD_LIST="list",u.file.METHOD_MOVE="move",u.file.METHOD_DELETE="delete",u.file.METHOD_MKDIR="mkdir",u.file.METHOD_ACL_READ="readAcl",u.file.METHOD_ACL_WRITE="writeAcl",u.file.DUP_OVERWRITE="overwrite",u.file.DUP_FAIL="fail",u.file.DUP_RENAME="rename",u.file.ACCESS_PUBLIC=1,u.file.ACCESS_READ=2,u.file.ACCESS_WRITE=4,u.file.ACCESS_CREATE=8,u.file.ACCESS_DELETE=16,u.file.ACCESS_ACL_READ=32,u.file.ACCESS_ACL_WRITE=64,u.file.ACCESS_ALL=65534,u.provider.register=function(t,e){if(c[t]=e,h||(h=e),"function"!=typeof e.handle)throw new Error("Not implement: provider.handle()")},u.provider.use=function(t){h=c[t]},u.provider.init=function(t,e){var n=c[t];return n&&"function"==typeof n.init?n.init.call(n,e):null},u.user.impl=function(t){f=t},["check","login","logout","init","current"].forEach(function(t){u.user[t]=function(){return f[t].apply(f,arguments)}}),["read","write","list","move","delete","mkdir","readAcl","writeAcl"].forEach(function(e){u.file[e]=function(n){return u.user.check().then(function(i){var r=n.provider?c[n.provider]:h,o=new l(n.path,e,i);"read"==e&&(o.dataType=n.dataType||u.file.TYPE_TEXT),"write"==e&&(o.dupPolicy=n.ondup,o.data=new u.file.Data(n.content),delete n.ondup),"move"==e&&(o.dupPolicy=n.ondup,o.newPath=n.newPath,delete n.newPath),"writeAcl"==e&&(o.acl=n.acl,delete n.acl),delete n.provider,delete n.path,o.extra=n;var a=r.handle(o);return t.resolve(a)})}}),window.fio=u}(Promise),function(){function t(t){this.tokens=[],this.tokens.links={},this.options=t||u.defaults,this.rules=c.normal,this.options.gfm&&(this.rules=this.options.tables?c.tables:c.gfm)}function e(t,e){if(this.options=e||u.defaults,this.links=t,this.rules=h.normal,this.renderer=this.options.renderer||new n,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.rules=this.options.breaks?h.breaks:h.gfm:this.options.pedantic&&(this.rules=h.pedantic)}function n(t){this.options=t||{}}function i(t){this.tokens=[],this.token=null,this.options=t||u.defaults,this.options.renderer=this.options.renderer||new n,this.renderer=this.options.renderer,this.renderer.options=this.options}function r(t,e){return t.replace(e?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function o(t){return t.replace(/&([#\w]+);/g,function(t,e){return e=e.toLowerCase(),"colon"===e?":":"#"===e.charAt(0)?String.fromCharCode("x"===e.charAt(1)?parseInt(e.substring(2),16):+e.substring(1)):""})}function a(t,e){return t=t.source,e=e||"",function n(i,r){return i?(r=r.source||r,r=r.replace(/(^|[^\[])\^/g,"$1"),t=t.replace(i,r),n):new RegExp(t,e)}}function s(){}function l(t){for(var e,n,i=1;i<arguments.length;i++){e=arguments[i];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}function u(e,n,o){if(o||"function"==typeof n){o||(o=n,n=null),n=l({},u.defaults,n||{});var a,s,c=n.highlight,h=0;try{a=t.lex(e,n)}catch(d){return o(d)}s=a.length;var f=function(t){if(t)return n.highlight=c,o(t);var e;try{e=i.parse(a,n)}catch(r){t=r}return n.highlight=c,t?o(t):o(null,e)};if(!c||c.length<3)return f();if(delete n.highlight,!s)return f();for(;h<a.length;h++)!function(t){return"code"!==t.type?--s||f():c(t.text,t.lang,function(e,n){return e?f(e):null==n||n===t.text?--s||f():(t.text=n,t.escaped=!0,void(--s||f()))})}(a[h])}else try{return n&&(n=l({},u.defaults,n)),i.parse(t.lex(e,n),n)}catch(d){if(d.message+="\nPlease report this to https://github.com/chjj/marked.",(n||u.defaults).silent)return"<p>An error occured:</p><pre>"+r(d.message+"",!0)+"</pre>";throw d}}var c={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:s,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:s,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:s,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};c.bullet=/(?:[*+-]|\d+\.)/,c.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,c.item=a(c.item,"gm")(/bull/g,c.bullet)(),c.list=a(c.list)(/bull/g,c.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+c.def.source+")")(),c.blockquote=a(c.blockquote)("def",c.def)(),c._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",c.html=a(c.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,c._tag)(),c.paragraph=a(c.paragraph)("hr",c.hr)("heading",c.heading)("lheading",c.lheading)("blockquote",c.blockquote)("tag","<"+c._tag)("def",c.def)(),c.normal=l({},c),c.gfm=l({},c.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/}),c.gfm.paragraph=a(c.paragraph)("(?!","(?!"+c.gfm.fences.source.replace("\\1","\\2")+"|"+c.list.source.replace("\\1","\\3")+"|")(),c.tables=l({},c.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=c,t.lex=function(e,n){var i=new t(n);return i.lex(e)},t.prototype.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(t,!0)},t.prototype.token=function(t,e,n){for(var i,r,o,a,s,l,u,h,d,t=t.replace(/^ +$/gm,"");t;)if((o=this.rules.newline.exec(t))&&(t=t.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(t))t=t.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]});else if(o=this.rules.heading.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(e&&(o=this.rules.nptable.exec(t))){for(t=t.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},h=0;h<l.align.length;h++)l.align[h]=/^ *-+: *$/.test(l.align[h])?"right":/^ *:-+: *$/.test(l.align[h])?"center":/^ *:-+ *$/.test(l.align[h])?"left":null;for(h=0;h<l.cells.length;h++)l.cells[h]=l.cells[h].split(/ *\| */);this.tokens.push(l)}else if(o=this.rules.lheading.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"heading",depth:"="===o[2]?1:2,text:o[1]});else if(o=this.rules.hr.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"hr"});else if(o=this.rules.blockquote.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"blockquote_start"}),o=o[0].replace(/^ *> ?/gm,""),this.token(o,e,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(t)){for(t=t.substring(o[0].length),a=o[2],this.tokens.push({type:"list_start",ordered:a.length>1}),o=o[0].match(this.rules.item),i=!1,d=o.length,h=0;d>h;h++)l=o[h],u=l.length,l=l.replace(/^ *([*+-]|\d+\.) +/,""),~l.indexOf("\n ")&&(u-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+u+"}","gm"),"")),this.options.smartLists&&h!==d-1&&(s=c.bullet.exec(o[h+1])[0],a===s||a.length>1&&s.length>1||(t=o.slice(h+1).join("\n")+t,h=d-1)),r=i||/\n\n(?!\s*$)/.test(l),h!==d-1&&(i="\n"===l.charAt(l.length-1),r||(r=i)),this.tokens.push({type:r?"loose_item_start":"list_item_start"}),this.token(l,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(t))t=t.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:"pre"===o[1]||"script"===o[1]||"style"===o[1],text:o[0]});else if(!n&&e&&(o=this.rules.def.exec(t)))t=t.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(e&&(o=this.rules.table.exec(t))){for(t=t.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},h=0;h<l.align.length;h++)l.align[h]=/^ *-+: *$/.test(l.align[h])?"right":/^ *:-+: *$/.test(l.align[h])?"center":/^ *:-+ *$/.test(l.align[h])?"left":null;for(h=0;h<l.cells.length;h++)l.cells[h]=l.cells[h].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(e&&(o=this.rules.paragraph.exec(t)))t=t.substring(o[0].length),this.tokens.push({type:"paragraph",text:"\n"===o[1].charAt(o[1].length-1)?o[1].slice(0,-1):o[1]});else if(o=this.rules.text.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"text",text:o[0]});else if(t)throw new Error("Infinite loop on byte: "+t.charCodeAt(0));return this.tokens};var h={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:s,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:s,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};h._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,h._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,h.link=a(h.link)("inside",h._inside)("href",h._href)(),h.reflink=a(h.reflink)("inside",h._inside)(),h.normal=l({},h),h.pedantic=l({},h.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),h.gfm=l({},h.normal,{escape:a(h.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:a(h.text)("]|","~]|")("|","|https?://|")()}),h.breaks=l({},h.gfm,{br:a(h.br)("{2,}","*")(),text:a(h.gfm.text)("{2,}","*")()}),e.rules=h,e.output=function(t,n,i){var r=new e(n,i);return r.output(t)},e.prototype.output=function(t){for(var e,n,i,o,a="";t;)if(o=this.rules.escape.exec(t))t=t.substring(o[0].length),a+=o[1];else if(o=this.rules.autolink.exec(t))t=t.substring(o[0].length),"@"===o[2]?(n=this.mangle(":"===o[1].charAt(6)?o[1].substring(7):o[1]),i=this.mangle("mailto:")+n):(n=r(o[1]),i=n),a+=this.renderer.link(i,null,n);else if(this.inLink||!(o=this.rules.url.exec(t))){if(o=this.rules.tag.exec(t))!this.inLink&&/^<a /i.test(o[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(o[0])&&(this.inLink=!1),t=t.substring(o[0].length),a+=this.options.sanitize?r(o[0]):o[0];else if(o=this.rules.link.exec(t))t=t.substring(o[0].length),this.inLink=!0,a+=this.outputLink(o,{href:o[2],title:o[3]}),this.inLink=!1;else if((o=this.rules.reflink.exec(t))||(o=this.rules.nolink.exec(t))){if(t=t.substring(o[0].length),e=(o[2]||o[1]).replace(/\s+/g," "),e=this.links[e.toLowerCase()],!e||!e.href){a+=o[0].charAt(0),t=o[0].substring(1)+t;continue}this.inLink=!0,a+=this.outputLink(o,e),this.inLink=!1}else if(o=this.rules.strong.exec(t))t=t.substring(o[0].length),a+=this.renderer.strong(this.output(o[2]||o[1]));else if(o=this.rules.em.exec(t))t=t.substring(o[0].length),a+=this.renderer.em(this.output(o[2]||o[1]));else if(o=this.rules.code.exec(t))t=t.substring(o[0].length),a+=this.renderer.codespan(r(o[2],!0));else if(o=this.rules.br.exec(t))t=t.substring(o[0].length),a+=this.renderer.br();else if(o=this.rules.del.exec(t))t=t.substring(o[0].length),a+=this.renderer.del(this.output(o[1]));else if(o=this.rules.text.exec(t))t=t.substring(o[0].length),a+=r(this.smartypants(o[0]));else if(t)throw new Error("Infinite loop on byte: "+t.charCodeAt(0))}else t=t.substring(o[0].length),n=r(o[1]),i=n,a+=this.renderer.link(i,null,n);return a},e.prototype.outputLink=function(t,e){var n=r(e.href),i=e.title?r(e.title):null;return"!"!==t[0].charAt(0)?this.renderer.link(n,i,this.output(t[1])):this.renderer.image(n,i,r(t[1]))},e.prototype.smartypants=function(t){return this.options.smartypants?t.replace(/--/g,"—").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):t},e.prototype.mangle=function(t){for(var e,n="",i=t.length,r=0;i>r;r++)e=t.charCodeAt(r),Math.random()>.5&&(e="x"+e.toString(16)),n+="&#"+e+";";return n},n.prototype.code=function(t,e,n){if(this.options.highlight){var i=this.options.highlight(t,e);null!=i&&i!==t&&(n=!0,t=i)}return e?'<pre><code class="'+this.options.langPrefix+r(e,!0)+'">'+(n?t:r(t,!0))+"\n</code></pre>\n":"<pre><code>"+(n?t:r(t,!0))+"\n</code></pre>"},n.prototype.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},n.prototype.html=function(t){return t},n.prototype.heading=function(t,e,n){return"<h"+e+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+t+"</h"+e+">\n"},n.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},n.prototype.list=function(t,e){var n=e?"ol":"ul";return"<"+n+">\n"+t+"</"+n+">\n"},n.prototype.listitem=function(t){return"<li>"+t+"</li>\n"},n.prototype.paragraph=function(t){return"<p>"+t+"</p>\n"},n.prototype.table=function(t,e){return"<table>\n<thead>\n"+t+"</thead>\n<tbody>\n"+e+"</tbody>\n</table>\n"},n.prototype.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},n.prototype.tablecell=function(t,e){var n=e.header?"th":"td",i=e.align?"<"+n+' style="text-align:'+e.align+'">':"<"+n+">";return i+t+"</"+n+">\n"},n.prototype.strong=function(t){return"<strong>"+t+"</strong>"},n.prototype.em=function(t){return"<em>"+t+"</em>"},n.prototype.codespan=function(t){return"<code>"+t+"</code>"},n.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},n.prototype.del=function(t){return"<del>"+t+"</del>"},n.prototype.link=function(t,e,n){if(this.options.sanitize){try{var i=decodeURIComponent(o(t)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===i.indexOf("javascript:"))return""}var a='<a href="'+t+'"';return e&&(a+=' title="'+e+'"'),a+=">"+n+"</a>"},n.prototype.image=function(t,e,n){var i='<img src="'+t+'" alt="'+n+'"';return e&&(i+=' title="'+e+'"'),i+=this.options.xhtml?"/>":">"},i.parse=function(t,e,n){var r=new i(e,n);return r.parse(t)},i.prototype.parse=function(t){this.inline=new e(t.links,this.options,this.renderer),this.tokens=t.reverse();for(var n="";this.next();)n+=this.tok();return n},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var t=this.token.text;"text"===this.peek().type;)t+="\n"+this.next().text;return this.inline.output(t)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var t,e,n,i,r,o="",a="";for(n="",t=0;t<this.token.header.length;t++)i={header:!0,align:this.token.align[t]},n+=this.renderer.tablecell(this.inline.output(this.token.header[t]),{header:!0,align:this.token.align[t]});for(o+=this.renderer.tablerow(n),t=0;t<this.token.cells.length;t++){for(e=this.token.cells[t],n="",r=0;r<e.length;r++)n+=this.renderer.tablecell(this.inline.output(e[r]),{header:!1,align:this.token.align[r]});a+=this.renderer.tablerow(n)}return this.renderer.table(o,a);case"blockquote_start":for(var a="";"blockquote_end"!==this.next().type;)a+=this.tok();return this.renderer.blockquote(a);case"list_start":for(var a="",s=this.token.ordered;"list_end"!==this.next().type;)a+=this.tok();return this.renderer.list(a,s);case"list_item_start":for(var a="";"list_item_end"!==this.next().type;)a+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(a);case"loose_item_start":for(var a="";"list_item_end"!==this.next().type;)a+=this.tok();return this.renderer.listitem(a);case"html":var l=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(l);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},s.exec=s,u.options=u.setOptions=function(t){return l(u.defaults,t),u},u.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new n,xhtml:!1},u.Parser=i,u.parser=i.parse,u.Renderer=n,u.Lexer=t,u.lexer=t.lex,u.InlineLexer=e,u.inlineLexer=e.output,u.parse=u,"undefined"!=typeof module&&"object"==typeof exports?module.exports=u:"function"==typeof define&&define.amd?define(function(){return u}):this.marked=u}.call(function(){return this||("undefined"!=typeof window?window:global)}()),function(t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else{if("function"==typeof define&&define.amd)return define([],t);this.CodeMirror=t()}}(function(){"use strict";function t(n,i){if(!(this instanceof t))return new t(n,i);this.options=i=i?mo(i):{},mo(Oa,i,!1),p(i);var r=i.value;"string"==typeof r&&(r=new is(r,i.mode)),this.doc=r;var o=this.display=new e(n,r);o.wrapper.CodeMirror=this,c(this),l(this),i.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),i.autofocus&&!ca&&Tn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new lo},Zo&&11>ta&&setTimeout(vo(Sn,this,!0),20),En(this),Po(),Ze(this),this.curOp.forceUpdate=!0,Er(this,r),i.autofocus&&!ca||So()==o.input?setTimeout(vo(Jn,this),20):Zn(this);for(var a in Da)Da.hasOwnProperty(a)&&Da[a](this,i[a],Ia);b(this);for(var s=0;s<Ha.length;++s)Ha[s](this);en(this)}function e(t,e){var n=this,i=n.input=xo("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");ea?i.style.width="1000px":i.setAttribute("wrap","off"),ua&&(i.style.border="1px solid black"),i.setAttribute("autocorrect","off"),i.setAttribute("autocapitalize","off"),i.setAttribute("spellcheck","false"),n.inputDiv=xo("div",[i],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),n.scrollbarH=xo("div",[xo("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),n.scrollbarV=xo("div",[xo("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n.scrollbarFiller=xo("div",null,"CodeMirror-scrollbar-filler"),n.gutterFiller=xo("div",null,"CodeMirror-gutter-filler"),n.lineDiv=xo("div",null,"CodeMirror-code"),n.selectionDiv=xo("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=xo("div",null,"CodeMirror-cursors"),n.measure=xo("div",null,"CodeMirror-measure"),n.lineMeasure=xo("div",null,"CodeMirror-measure"),n.lineSpace=xo("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=xo("div",[xo("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=xo("div",[n.mover],"CodeMirror-sizer"),n.heightForcer=xo("div",null,null,"position: absolute; height: "+fs+"px; width: 1px;"),n.gutters=xo("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=xo("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=xo("div",[n.inputDiv,n.scrollbarH,n.scrollbarV,n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),Zo&&8>ta&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),ua&&(i.style.width="0px"),ea||(n.scroller.draggable=!0),aa&&(n.inputDiv.style.height="1px",n.inputDiv.style.position="absolute"),Zo&&8>ta&&(n.scrollbarH.style.minHeight=n.scrollbarV.style.minWidth="18px"),t.appendChild?t.appendChild(n.wrapper):t(n.wrapper),n.viewFrom=n.viewTo=e.first,n.view=[],n.externalMeasured=null,n.viewOffset=0,n.lastSizeC=0,n.updateLineNumbers=null,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.prevInput="",n.alignWidgets=!1,n.pollingFast=!1,n.poll=new lo,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.inaccurateSelection=!1,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null}function n(e){e.doc.mode=t.getMode(e.options,e.doc.modeOption),i(e)}function i(t){t.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),t.doc.frontier=t.doc.first,we(t,100),t.state.modeGen++,t.curOp&&gn(t)}function r(t){t.options.lineWrapping?(Lo(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth=""):(Mo(t.display.wrapper,"CodeMirror-wrap"),f(t)),a(t),gn(t),Ve(t),setTimeout(function(){v(t)},100)}function o(t){var e=Qe(t.display),n=t.options.lineWrapping,i=n&&Math.max(5,t.display.scroller.clientWidth/Je(t.display)-3);return function(r){if(nr(t.doc,r))return 0;var o=0;if(r.widgets)for(var a=0;a<r.widgets.length;a++)r.widgets[a].height&&(o+=r.widgets[a].height);return n?o+(Math.ceil(r.text.length/i)||1)*e:o+e}}function a(t){var e=t.doc,n=o(t);e.iter(function(t){var e=n(t);e!=t.height&&Or(t,e)})}function s(t){var e=Ua[t.options.keyMap],n=e.style;t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(n?" cm-keymap-"+n:"")}function l(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Ve(t)}function u(t){c(t),gn(t),setTimeout(function(){_(t)},20)}function c(t){var e=t.display.gutters,n=t.options.gutters;wo(e);for(var i=0;i<n.length;++i){var r=n[i],o=e.appendChild(xo("div",null,"CodeMirror-gutter "+r));"CodeMirror-linenumbers"==r&&(t.display.lineGutter=o,o.style.width=(t.display.lineNumWidth||1)+"px")}e.style.display=i?"":"none",h(t)}function h(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px",t.display.scrollbarH.style.left=t.options.fixedGutter?e+"px":0}function d(t){if(0==t.height)return 0;for(var e,n=t.text.length,i=t;e=Xi(i);){var r=e.find(0,!0);i=r.from.line,n+=r.from.ch-r.to.ch}for(i=t;e=Yi(i);){var r=e.find(0,!0);n-=i.text.length-r.from.ch,i=r.to.line,n+=i.text.length-r.to.ch}return n}function f(t){var e=t.display,n=t.doc;e.maxLine=Nr(n,n.first),e.maxLineLength=d(e.maxLine),e.maxLineChanged=!0,n.iter(function(t){var n=d(t);n>e.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}function p(t){var e=fo(t.gutters,"CodeMirror-linenumbers");-1==e&&t.lineNumbers?t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]):e>-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function g(t){return t.display.scroller.clientHeight-t.display.wrapper.clientHeight<fs-3}function m(t){var e=t.display.scroller;return{clientHeight:e.clientHeight,barHeight:t.display.scrollbarV.clientHeight,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth,hScrollbarTakesSpace:g(t),barWidth:t.display.scrollbarH.clientWidth,docHeight:Math.round(t.doc.height+Me(t.display))}}function v(t,e){e||(e=m(t));var n=t.display,i=Oo(n.measure),r=e.docHeight+fs,o=e.scrollWidth>e.clientWidth;o&&e.scrollWidth<=e.clientWidth+1&&i>0&&!e.hScrollbarTakesSpace&&(o=!1);var a=r>e.clientHeight;if(a?(n.scrollbarV.style.display="block",n.scrollbarV.style.bottom=o?i+"px":"0",n.scrollbarV.firstChild.style.height=Math.max(0,r-e.clientHeight+(e.barHeight||n.scrollbarV.clientHeight))+"px"):(n.scrollbarV.style.display="",n.scrollbarV.firstChild.style.height="0"),o?(n.scrollbarH.style.display="block",n.scrollbarH.style.right=a?i+"px":"0",n.scrollbarH.firstChild.style.width=e.scrollWidth-e.clientWidth+(e.barWidth||n.scrollbarH.clientWidth)+"px"):(n.scrollbarH.style.display="",n.scrollbarH.firstChild.style.width="0"),o&&a?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=n.scrollbarFiller.style.width=i+"px"):n.scrollbarFiller.style.display="",o&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i+"px",n.gutterFiller.style.width=n.gutters.offsetWidth+"px"):n.gutterFiller.style.display="",!t.state.checkedOverlayScrollbar&&e.clientHeight>0){if(0===i){var s=ha&&!sa?"12px":"18px";n.scrollbarV.style.minWidth=n.scrollbarH.style.minHeight=s;var l=function(e){to(e)!=n.scrollbarV&&to(e)!=n.scrollbarH&&cn(t,On)(e)};us(n.scrollbarV,"mousedown",l),us(n.scrollbarH,"mousedown",l)}t.state.checkedOverlayScrollbar=!0}}function y(t,e,n){var i=n&&null!=n.top?Math.max(0,n.top):t.scroller.scrollTop;i=Math.floor(i-Te(t));var r=n&&null!=n.bottom?n.bottom:i+t.wrapper.clientHeight,o=Ir(e,i),a=Ir(e,r);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;if(o>s)return{from:s,to:Ir(e,Br(Nr(e,s))+t.wrapper.clientHeight)};if(Math.min(l,e.lastLine())>=a)return{from:Ir(e,Br(Nr(e,l))-t.wrapper.clientHeight),to:l}}return{from:o,to:Math.max(a,o+1)}}function _(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var i=w(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,o=i+"px",a=0;a<n.length;a++)if(!n[a].hidden){t.options.fixedGutter&&n[a].gutter&&(n[a].gutter.style.left=o);var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}t.options.fixedGutter&&(e.gutters.style.left=i+r+"px")}}function b(t){if(!t.options.lineNumbers)return!1;var e=t.doc,n=x(t.options,e.first+e.size-1),i=t.display;if(n.length!=i.lineNumChars){var r=i.measure.appendChild(xo("div",[xo("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=r.firstChild.offsetWidth,a=r.offsetWidth-o;
|
||
return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(o,i.lineGutter.offsetWidth-a),i.lineNumWidth=i.lineNumInnerWidth+a,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",h(t),!0}return!1}function x(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function w(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function k(t,e,n){var i=t.display;this.viewport=e,this.visible=y(i,t.doc,e),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.oldViewFrom=i.viewFrom,this.oldViewTo=i.viewTo,this.oldScrollerWidth=i.scroller.clientWidth,this.force=n,this.dims=P(t)}function C(t,e){var n=t.display,i=t.doc;if(e.editorIsHidden)return vn(t),!1;if(!e.force&&e.visible.from>=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&0==xn(t))return!1;b(t)&&(vn(t),e.dims=P(t));var r=i.first+i.size,o=Math.max(e.visible.from-t.options.viewportMargin,i.first),a=Math.min(r,e.visible.to+t.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(i.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(r,n.viewTo)),va&&(o=tr(t.doc,o),a=er(t.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastSizeC!=e.wrapperHeight;bn(t,o,a),n.viewOffset=Br(Nr(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var l=xn(t);if(!s&&0==l&&!e.force&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=So();return l>4&&(n.lineDiv.style.display="none"),A(t,n.updateLineNumbers,e.dims),l>4&&(n.lineDiv.style.display=""),u&&So()!=u&&u.offsetHeight&&u.focus(),wo(n.cursorDiv),wo(n.selectionDiv),s&&(n.lastSizeC=e.wrapperHeight,we(t,400)),n.updateLineNumbers=null,!0}function S(t,e){for(var n=e.force,i=e.viewport,r=!0;;r=!1){if(r&&t.options.lineWrapping&&e.oldScrollerWidth!=t.display.scroller.clientWidth)n=!0;else if(n=!1,i&&null!=i.top&&(i={top:Math.min(t.doc.height+Me(t.display)-fs-t.display.scroller.clientHeight,i.top)}),e.visible=y(t.display,t.doc,i),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!C(t,e))break;E(t);var o=m(t);ye(t),M(t,o),v(t,o)}no(t,"update",t),(t.display.viewFrom!=e.oldViewFrom||t.display.viewTo!=e.oldViewTo)&&no(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo)}function T(t,e){var n=new k(t,e);if(C(t,n)){E(t),S(t,n);var i=m(t);ye(t),M(t,i),v(t,i)}}function M(t,e){t.display.sizer.style.minHeight=t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=Math.max(e.docHeight,e.clientHeight-fs)+"px"}function L(t,e){t.display.sizer.offsetWidth+t.display.gutters.offsetWidth<t.display.scroller.clientWidth-1&&(t.display.sizer.style.minHeight=t.display.heightForcer.style.top="0px",t.display.gutters.style.height=e.docHeight+"px")}function E(t){for(var e=t.display,n=e.lineDiv.offsetTop,i=0;i<e.view.length;i++){var r,o=e.view[i];if(!o.hidden){if(Zo&&8>ta){var a=o.node.offsetTop+o.node.offsetHeight;r=a-n,n=a}else{var s=o.node.getBoundingClientRect();r=s.bottom-s.top}var l=o.line.height-r;if(2>r&&(r=Qe(e)),(l>.001||-.001>l)&&(Or(o.line,r),N(o.line),o.rest))for(var u=0;u<o.rest.length;u++)N(o.rest[u])}}}function N(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e)t.widgets[e].height=t.widgets[e].node.offsetHeight}function P(t){for(var e=t.display,n={},i={},r=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[t.options.gutters[a]]=o.offsetLeft+o.clientLeft+r,i[t.options.gutters[a]]=o.clientWidth;return{fixedPos:w(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:e.wrapper.clientWidth}}function A(t,e,n){function i(e){var n=e.nextSibling;return ea&&ha&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var r=t.display,o=t.options.lineNumbers,a=r.lineDiv,s=a.firstChild,l=r.view,u=r.viewFrom,c=0;c<l.length;c++){var h=l[c];if(h.hidden);else if(h.node){for(;s!=h.node;)s=i(s);var d=o&&null!=e&&u>=e&&h.lineNumber;h.changes&&(fo(h.changes,"gutter")>-1&&(d=!1),O(t,h,u,n)),d&&(wo(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(x(t.options,u)))),s=h.node.nextSibling}else{var f=z(t,h,u,n);a.insertBefore(f,s)}u+=h.size}for(;s;)s=i(s)}function O(t,e,n,i){for(var r=0;r<e.changes.length;r++){var o=e.changes[r];"text"==o?R(t,e):"gutter"==o?H(t,e,n,i):"class"==o?W(e):"widget"==o&&V(e,i)}e.changes=null}function D(t){return t.node==t.text&&(t.node=xo("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),Zo&&8>ta&&(t.node.style.zIndex=2)),t.node}function I(t){var e=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(e&&(e+=" CodeMirror-linebackground"),t.background)e?t.background.className=e:(t.background.parentNode.removeChild(t.background),t.background=null);else if(e){var n=D(t);t.background=n.insertBefore(xo("div",null,e),n.firstChild)}}function B(t,e){var n=t.display.externalMeasured;return n&&n.line==e.line?(t.display.externalMeasured=null,e.measure=n.measure,n.built):vr(t,e)}function R(t,e){var n=e.text.className,i=B(t,e);e.text==e.node&&(e.node=i.pre),e.text.parentNode.replaceChild(i.pre,e.text),e.text=i.pre,i.bgClass!=e.bgClass||i.textClass!=e.textClass?(e.bgClass=i.bgClass,e.textClass=i.textClass,W(e)):n&&(e.text.className=n)}function W(t){I(t),t.line.wrapClass?D(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var e=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=e||""}function H(t,e,n,i){e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null);var r=e.line.gutterMarkers;if(t.options.lineNumbers||r){var o=D(e),a=e.gutter=o.insertBefore(xo("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(t.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px"),e.text);if(!t.options.lineNumbers||r&&r["CodeMirror-linenumbers"]||(e.lineNumber=a.appendChild(xo("div",x(t.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),r)for(var s=0;s<t.options.gutters.length;++s){var l=t.options.gutters[s],u=r.hasOwnProperty(l)&&r[l];u&&a.appendChild(xo("div",[u],"CodeMirror-gutter-elt","left: "+i.gutterLeft[l]+"px; width: "+i.gutterWidth[l]+"px"))}}}function V(t,e){t.alignable&&(t.alignable=null);for(var n,i=t.node.firstChild;i;i=n){var n=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}F(t,e)}function z(t,e,n,i){var r=B(t,e);return e.text=e.node=r.pre,r.bgClass&&(e.bgClass=r.bgClass),r.textClass&&(e.textClass=r.textClass),W(e),H(t,e,n,i),F(e,i),e.node}function F(t,e){if(j(t.line,t,e,!0),t.rest)for(var n=0;n<t.rest.length;n++)j(t.rest[n],t,e,!1)}function j(t,e,n,i){if(t.widgets)for(var r=D(e),o=0,a=t.widgets;o<a.length;++o){var s=a[o],l=xo("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||(l.ignoreEvents=!0),U(s,l,e,n),i&&s.above?r.insertBefore(l,e.gutter||e.text):r.appendChild(l),no(s,"redraw")}}function U(t,e,n,i){if(t.noHScroll){(n.alignable||(n.alignable=[])).push(e);var r=i.wrapperWidth;e.style.left=i.fixedPos+"px",t.coverGutter||(r-=i.gutterTotalWidth,e.style.paddingLeft=i.gutterTotalWidth+"px"),e.style.width=r+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-i.gutterTotalWidth+"px"))}function K(t){return ya(t.line,t.ch)}function q(t,e){return _a(t,e)<0?e:t}function $(t,e){return _a(t,e)<0?t:e}function G(t,e){this.ranges=t,this.primIndex=e}function X(t,e){this.anchor=t,this.head=e}function Y(t,e){var n=t[e];t.sort(function(t,e){return _a(t.from(),e.from())}),e=fo(t,n);for(var i=1;i<t.length;i++){var r=t[i],o=t[i-1];if(_a(o.to(),r.from())>=0){var a=$(o.from(),r.from()),s=q(o.to(),r.to()),l=o.empty()?r.from()==r.head:o.from()==o.head;e>=i&&--e,t.splice(--i,2,new X(l?s:a,l?a:s))}}return new G(t,e)}function Q(t,e){return new G([new X(t,e||t)],0)}function J(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function Z(t,e){if(e.line<t.first)return ya(t.first,0);var n=t.first+t.size-1;return e.line>n?ya(n,Nr(t,n).text.length):te(e,Nr(t,e.line).text.length)}function te(t,e){var n=t.ch;return null==n||n>e?ya(t.line,e):0>n?ya(t.line,0):t}function ee(t,e){return e>=t.first&&e<t.first+t.size}function ne(t,e){for(var n=[],i=0;i<e.length;i++)n[i]=Z(t,e[i]);return n}function ie(t,e,n,i){if(t.cm&&t.cm.display.shift||t.extend){var r=e.anchor;if(i){var o=_a(n,r)<0;o!=_a(i,r)<0?(r=n,n=i):o!=_a(n,i)<0&&(n=i)}return new X(r,n)}return new X(i||n,n)}function re(t,e,n,i){ce(t,new G([ie(t,t.sel.primary(),e,n)],0),i)}function oe(t,e,n){for(var i=[],r=0;r<t.sel.ranges.length;r++)i[r]=ie(t,t.sel.ranges[r],e[r],null);var o=Y(i,t.sel.primIndex);ce(t,o,n)}function ae(t,e,n,i){var r=t.sel.ranges.slice(0);r[e]=n,ce(t,Y(r,t.sel.primIndex),i)}function se(t,e,n,i){ce(t,Q(e,n),i)}function le(t,e){var n={ranges:e.ranges,update:function(e){this.ranges=[];for(var n=0;n<e.length;n++)this.ranges[n]=new X(Z(t,e[n].anchor),Z(t,e[n].head))}};return hs(t,"beforeSelectionChange",t,n),t.cm&&hs(t.cm,"beforeSelectionChange",t.cm,n),n.ranges!=e.ranges?Y(n.ranges,n.ranges.length-1):e}function ue(t,e,n){var i=t.history.done,r=ho(i);r&&r.ranges?(i[i.length-1]=e,he(t,e,n)):ce(t,e,n)}function ce(t,e,n){he(t,e,n),Ur(t,t.sel,t.cm?t.cm.curOp.id:0/0,n)}function he(t,e,n){(ao(t,"beforeSelectionChange")||t.cm&&ao(t.cm,"beforeSelectionChange"))&&(e=le(t,e));var i=n&&n.bias||(_a(e.primary().head,t.sel.primary().head)<0?-1:1);de(t,pe(t,e,i,!0)),n&&n.scroll===!1||!t.cm||_i(t.cm)}function de(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=t.cm.curOp.selectionChanged=!0,oo(t.cm)),no(t,"cursorActivity",t))}function fe(t){de(t,pe(t,t.sel,null,!1),gs)}function pe(t,e,n,i){for(var r,o=0;o<e.ranges.length;o++){var a=e.ranges[o],s=ge(t,a.anchor,n,i),l=ge(t,a.head,n,i);(r||s!=a.anchor||l!=a.head)&&(r||(r=e.ranges.slice(0,o)),r[o]=new X(s,l))}return r?Y(r,e.primIndex):e}function ge(t,e,n,i){var r=!1,o=e,a=n||1;t.cantEdit=!1;t:for(;;){var s=Nr(t,o.line);if(s.markedSpans)for(var l=0;l<s.markedSpans.length;++l){var u=s.markedSpans[l],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(i&&(hs(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--l;continue}break}if(!c.atomic)continue;var h=c.find(0>a?-1:1);if(0==_a(h,o)&&(h.ch+=a,h.ch<0?h=h.line>t.first?Z(t,ya(h.line-1)):null:h.ch>s.text.length&&(h=h.line<t.first+t.size-1?ya(h.line+1,0):null),!h)){if(r)return i?(t.cantEdit=!0,ya(t.first,0)):ge(t,e,n,!0);r=!0,h=e,a=-a}o=h;continue t}}return o}}function me(t){for(var e=t.display,n=t.doc,i={},r=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++){var s=n.sel.ranges[a],l=s.empty();(l||t.options.showCursorWhenSelecting)&&_e(t,s,r),l||be(t,s,o)}if(t.options.moveInputWithCursor){var u=qe(t,n.sel.primary().head,"div"),c=e.wrapper.getBoundingClientRect(),h=e.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,u.top+h.top-c.top)),i.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,u.left+h.left-c.left))}return i}function ve(t,e){ko(t.display.cursorDiv,e.cursors),ko(t.display.selectionDiv,e.selection),null!=e.teTop&&(t.display.inputDiv.style.top=e.teTop+"px",t.display.inputDiv.style.left=e.teLeft+"px")}function ye(t){ve(t,me(t))}function _e(t,e,n){var i=qe(t,e.head,"div",null,null,!t.options.singleCursorHeightPerLine),r=n.appendChild(xo("div"," ","CodeMirror-cursor"));if(r.style.left=i.left+"px",r.style.top=i.top+"px",r.style.height=Math.max(0,i.bottom-i.top)*t.options.cursorHeight+"px",i.other){var o=n.appendChild(xo("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=i.other.left+"px",o.style.top=i.other.top+"px",o.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function be(t,e,n){function i(t,e,n,i){0>e&&(e=0),e=Math.round(e),i=Math.round(i),s.appendChild(xo("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; width: "+(null==n?c-t:n)+"px; height: "+(i-e)+"px"))}function r(e,n,r){function o(n,i){return Ke(t,ya(e,n),"div",h,i)}var s,l,h=Nr(a,e),d=h.text.length;return Ro(Rr(h),n||0,null==r?d:r,function(t,e,a){var h,f,p,g=o(t,"left");if(t==e)h=g,f=p=g.left;else{if(h=o(e-1,"right"),"rtl"==a){var m=g;g=h,h=m}f=g.left,p=h.right}null==n&&0==t&&(f=u),h.top-g.top>3&&(i(f,g.top,null,g.bottom),f=u,g.bottom<h.top&&i(f,g.bottom,null,h.top)),null==r&&e==d&&(p=c),(!s||g.top<s.top||g.top==s.top&&g.left<s.left)&&(s=g),(!l||h.bottom>l.bottom||h.bottom==l.bottom&&h.right>l.right)&&(l=h),u+1>f&&(f=u),i(f,h.top,p-f,h.bottom)}),{start:s,end:l}}var o=t.display,a=t.doc,s=document.createDocumentFragment(),l=Le(t.display),u=l.left,c=o.lineSpace.offsetWidth-l.right,h=e.from(),d=e.to();if(h.line==d.line)r(h.line,h.ch,d.ch);else{var f=Nr(a,h.line),p=Nr(a,d.line),g=Ji(f)==Ji(p),m=r(h.line,h.ch,g?f.text.length+1:null).end,v=r(d.line,g?0:null,d.ch).start;g&&(m.top<v.top-2?(i(m.right,m.top,null,m.bottom),i(u,v.top,v.left,v.bottom)):i(m.right,m.top,v.left-m.right,m.bottom)),m.bottom<v.top&&i(u,m.bottom,null,v.top)}n.appendChild(s)}function xe(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var n=!0;e.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?e.blinker=setInterval(function(){e.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function we(t,e){t.doc.mode.startState&&t.doc.frontier<t.display.viewTo&&t.state.highlight.set(e,vo(ke,t))}function ke(t){var e=t.doc;if(e.frontier<e.first&&(e.frontier=e.first),!(e.frontier>=t.display.viewTo)){var n=+new Date+t.options.workTime,i=za(e.mode,Se(t,e.frontier)),r=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.viewTo+500),function(o){if(e.frontier>=t.display.viewFrom){var a=o.styles,s=fr(t,o,i,!0);o.styles=s.styles;var l=o.styleClasses,u=s.classes;u?o.styleClasses=u:l&&(o.styleClasses=null);for(var c=!a||a.length!=o.styles.length||l!=u&&(!l||!u||l.bgClass!=u.bgClass||l.textClass!=u.textClass),h=0;!c&&h<a.length;++h)c=a[h]!=o.styles[h];c&&r.push(e.frontier),o.stateAfter=za(e.mode,i)}else gr(t,o.text,i),o.stateAfter=e.frontier%5==0?za(e.mode,i):null;return++e.frontier,+new Date>n?(we(t,t.options.workDelay),!0):void 0}),r.length&&un(t,function(){for(var e=0;e<r.length;e++)mn(t,r[e],"text")})}}function Ce(t,e,n){for(var i,r,o=t.doc,a=n?-1:e-(t.doc.mode.innerMode?1e3:100),s=e;s>a;--s){if(s<=o.first)return o.first;var l=Nr(o,s-1);if(l.stateAfter&&(!n||s<=o.frontier))return s;var u=ys(l.text,null,t.options.tabSize);(null==r||i>u)&&(r=s-1,i=u)}return r}function Se(t,e,n){var i=t.doc,r=t.display;if(!i.mode.startState)return!0;var o=Ce(t,e,n),a=o>i.first&&Nr(i,o-1).stateAfter;return a=a?za(i.mode,a):Fa(i.mode),i.iter(o,e,function(n){gr(t,n.text,a);var s=o==e-1||o%5==0||o>=r.viewFrom&&o<r.viewTo;n.stateAfter=s?za(i.mode,a):null,++o}),n&&(i.frontier=o),a}function Te(t){return t.lineSpace.offsetTop}function Me(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Le(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=ko(t.measure,xo("pre","x")),n=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(t.cachedPaddingH=i),i}function Ee(t,e,n){var i=t.options.lineWrapping,r=i&&t.display.scroller.clientWidth;if(!e.measure.heights||i&&e.measure.width!=r){var o=e.measure.heights=[];if(i){e.measure.width=r;for(var a=e.text.firstChild.getClientRects(),s=0;s<a.length-1;s++){var l=a[s],u=a[s+1];Math.abs(l.bottom-u.bottom)>2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ne(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var i=0;i<t.rest.length;i++)if(t.rest[i]==e)return{map:t.measure.maps[i],cache:t.measure.caches[i]};for(var i=0;i<t.rest.length;i++)if(Dr(t.rest[i])>n)return{map:t.measure.maps[i],cache:t.measure.caches[i],before:!0}}function Pe(t,e){e=Ji(e);var n=Dr(e),i=t.display.externalMeasured=new fn(t.doc,e,n);i.lineN=n;var r=i.built=vr(t,i);return i.text=r.pre,ko(t.display.lineMeasure,r.pre),i}function Ae(t,e,n,i){return Ie(t,De(t,e),n,i)}function Oe(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[yn(t,e)];var n=t.display.externalMeasured;return n&&e>=n.lineN&&e<n.lineN+n.size?n:void 0}function De(t,e){var n=Dr(e),i=Oe(t,n);i&&!i.text?i=null:i&&i.changes&&O(t,i,n,P(t)),i||(i=Pe(t,e));var r=Ne(i,e,n);return{line:e,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function Ie(t,e,n,i,r){e.before&&(n=-1);var o,a=n+(i||"");return e.cache.hasOwnProperty(a)?o=e.cache[a]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(Ee(t,e.view,e.rect),e.hasHeights=!0),o=Be(t,e,n,i),o.bogus||(e.cache[a]=o)),{left:o.left,right:o.right,top:r?o.rtop:o.top,bottom:r?o.rbottom:o.bottom}}function Be(t,e,n,i){for(var r,o,a,s,l=e.map,u=0;u<l.length;u+=3){var c=l[u],h=l[u+1];if(c>n?(o=0,a=1,s="left"):h>n?(o=n-c,a=o+1):(u==l.length-3||n==h&&l[u+3]>n)&&(a=h-c,o=a-1,n>=h&&(s="right")),null!=o){if(r=l[u+2],c==h&&i==(r.insertLeft?"left":"right")&&(s=i),"left"==i&&0==o)for(;u&&l[u-2]==l[u-3]&&l[u-1].insertLeft;)r=l[(u-=3)+2],s="left";if("right"==i&&o==h-c)for(;u<l.length-3&&l[u+3]==l[u+4]&&!l[u+5].insertLeft;)r=l[(u+=3)+2],s="right";break}}var d;if(3==r.nodeType){for(var u=0;4>u;u++){for(;o&&bo(e.line.text.charAt(c+o));)--o;for(;h>c+a&&bo(e.line.text.charAt(c+a));)++a;if(Zo&&9>ta&&0==o&&a==h-c)d=r.parentNode.getBoundingClientRect();else if(Zo&&t.options.lineWrapping){var f=xs(r,o,a).getClientRects();d=f.length?f["right"==i?f.length-1:0]:ka}else d=xs(r,o,a).getBoundingClientRect()||ka;if(d.left||d.right||0==o)break;a=o,o-=1,s="right"}Zo&&11>ta&&(d=Re(t.display.measure,d))}else{o>0&&(s=i="right");var f;d=t.options.lineWrapping&&(f=r.getClientRects()).length>1?f["right"==i?f.length-1:0]:r.getBoundingClientRect()}if(Zo&&9>ta&&!o&&(!d||!d.left&&!d.right)){var p=r.parentNode.getClientRects()[0];d=p?{left:p.left,right:p.left+Je(t.display),top:p.top,bottom:p.bottom}:ka}for(var g=d.top-e.rect.top,m=d.bottom-e.rect.top,v=(g+m)/2,y=e.view.measure.heights,u=0;u<y.length-1&&!(v<y[u]);u++);var _=u?y[u-1]:0,b=y[u],x={left:("right"==s?d.right:d.left)-e.rect.left,right:("left"==s?d.left:d.right)-e.rect.left,top:_,bottom:b};return d.left||d.right||(x.bogus=!0),t.options.singleCursorHeightPerLine||(x.rtop=g,x.rbottom=m),x}function Re(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Bo(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*i,bottom:e.bottom*i}}function We(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function He(t){t.display.externalMeasure=null,wo(t.display.lineMeasure);for(var e=0;e<t.display.view.length;e++)We(t.display.view[e])}function Ve(t){He(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function ze(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Fe(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function je(t,e,n,i){if(e.widgets)for(var r=0;r<e.widgets.length;++r)if(e.widgets[r].above){var o=or(e.widgets[r]);n.top+=o,n.bottom+=o}if("line"==i)return n;i||(i="local");var a=Br(e);if("local"==i?a+=Te(t.display):a-=t.display.viewOffset,"page"==i||"window"==i){var s=t.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==i?0:Fe());var l=s.left+("window"==i?0:ze());n.left+=l,n.right+=l}return n.top+=a,n.bottom+=a,n}function Ue(t,e,n){if("div"==n)return e;var i=e.left,r=e.top;if("page"==n)i-=ze(),r-=Fe();else if("local"==n||!n){var o=t.display.sizer.getBoundingClientRect();i+=o.left,r+=o.top}var a=t.display.lineSpace.getBoundingClientRect();return{left:i-a.left,top:r-a.top}}function Ke(t,e,n,i,r){return i||(i=Nr(t.doc,e.line)),je(t,i,Ae(t,i,e.ch,r),n)}function qe(t,e,n,i,r,o){function a(e,a){var s=Ie(t,r,e,a?"right":"left",o);return a?s.left=s.right:s.right=s.left,je(t,i,s,n)}function s(t,e){var n=l[e],i=n.level%2;return t==Wo(n)&&e&&n.level<l[e-1].level?(n=l[--e],t=Ho(n)-(n.level%2?0:1),i=!0):t==Ho(n)&&e<l.length-1&&n.level<l[e+1].level&&(n=l[++e],t=Wo(n)-n.level%2,i=!1),i&&t==n.to&&t>n.from?a(t-1):a(t,i)}i=i||Nr(t.doc,e.line),r||(r=De(t,i));var l=Rr(i),u=e.ch;if(!l)return a(u);var c=qo(l,u),h=s(u,c);return null!=Is&&(h.other=s(u,Is)),h}function $e(t,e){var n=0,e=Z(t.doc,e);t.options.lineWrapping||(n=Je(t.display)*e.ch);var i=Nr(t.doc,e.line),r=Br(i)+Te(t.display);return{left:n,right:n,top:r,bottom:r+i.height}}function Ge(t,e,n,i){var r=ya(t,e);return r.xRel=i,n&&(r.outside=!0),r}function Xe(t,e,n){var i=t.doc;if(n+=t.display.viewOffset,0>n)return Ge(i.first,0,!0,-1);var r=Ir(i,n),o=i.first+i.size-1;if(r>o)return Ge(i.first+i.size-1,Nr(i,o).text.length,!0,1);0>e&&(e=0);for(var a=Nr(i,r);;){var s=Ye(t,a,r,e,n),l=Yi(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;r=Dr(a=u.to.line)}}function Ye(t,e,n,i,r){function o(i){var r=qe(t,ya(n,i),"line",e,u);return s=!0,a>r.bottom?r.left-l:a<r.top?r.left+l:(s=!1,r.left)}var a=r-Br(e),s=!1,l=2*t.display.wrapper.clientWidth,u=De(t,e),c=Rr(e),h=e.text.length,d=Vo(e),f=zo(e),p=o(d),g=s,m=o(f),v=s;if(i>m)return Ge(n,f,v,1);for(;;){if(c?f==d||f==Go(e,d,1):1>=f-d){for(var y=p>i||m-i>=i-p?d:f,_=i-(y==d?p:m);bo(e.text.charAt(y));)++y;var b=Ge(n,y,y==d?g:v,-1>_?-1:_>1?1:0);return b}var x=Math.ceil(h/2),w=d+x;if(c){w=d;for(var k=0;x>k;++k)w=Go(e,w,1)}var C=o(w);C>i?(f=w,m=C,(v=s)&&(m+=1e3),h=x):(d=w,p=C,g=s,h-=x)}}function Qe(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ba){ba=xo("pre");for(var e=0;49>e;++e)ba.appendChild(document.createTextNode("x")),ba.appendChild(xo("br"));ba.appendChild(document.createTextNode("x"))}ko(t.measure,ba);var n=ba.offsetHeight/50;return n>3&&(t.cachedTextHeight=n),wo(t.measure),n||1}function Je(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=xo("span","xxxxxxxxxx"),n=xo("pre",[e]);ko(t.measure,n);var i=e.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(t.cachedCharWidth=r),r||10}function Ze(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Sa},Ca?Ca.ops.push(t.curOp):t.curOp.ownsGroup=Ca={ops:[t.curOp],delayedCallbacks:[]}}function tn(t){var e=t.delayedCallbacks,n=0;do{for(;n<e.length;n++)e[n]();for(var i=0;i<t.ops.length;i++){var r=t.ops[i];if(r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++](r.cm)}}while(n<e.length)}function en(t){var e=t.curOp,n=e.ownsGroup;if(n)try{tn(n)}finally{Ca=null;for(var i=0;i<n.ops.length;i++)n.ops[i].cm.curOp=null;nn(n)}}function nn(t){for(var e=t.ops,n=0;n<e.length;n++)rn(e[n]);for(var n=0;n<e.length;n++)on(e[n]);for(var n=0;n<e.length;n++)an(e[n]);for(var n=0;n<e.length;n++)sn(e[n]);for(var n=0;n<e.length;n++)ln(e[n])}function rn(t){var e=t.cm,n=e.display;t.updateMaxLine&&f(e),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new k(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function on(t){t.updatedDisplay=t.mustUpdate&&C(t.cm,t.update)}function an(t){var e=t.cm,n=e.display;t.updatedDisplay&&E(e),t.barMeasure=m(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Ae(e,n.maxLine,n.maxLine.text.length).left+3,t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo+fs-n.scroller.clientWidth)),(t.updatedDisplay||t.selectionChanged)&&(t.newSelectionNodes=me(e))}function sn(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&Fn(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1),t.newSelectionNodes&&ve(e,t.newSelectionNodes),t.updatedDisplay&&M(e,t.barMeasure),(t.updatedDisplay||t.startHeight!=e.doc.height)&&v(e,t.barMeasure),t.selectionChanged&&xe(e),e.state.focused&&t.updateInput&&Sn(e,t.typing)}function ln(t){var e=t.cm,n=e.display,i=e.doc;if(null!=t.adjustWidthTo&&Math.abs(t.barMeasure.scrollWidth-e.display.scroller.scrollWidth)>1&&v(e),t.updatedDisplay&&S(e,t.update),null==n.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=t.scrollTop&&(n.scroller.scrollTop!=t.scrollTop||t.forceScroll)){var r=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,t.scrollTop));n.scroller.scrollTop=n.scrollbarV.scrollTop=i.scrollTop=r}if(null!=t.scrollLeft&&(n.scroller.scrollLeft!=t.scrollLeft||t.forceScroll)){var o=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,t.scrollLeft));n.scroller.scrollLeft=n.scrollbarH.scrollLeft=i.scrollLeft=o,_(e)}if(t.scrollToPos){var a=gi(e,Z(i,t.scrollToPos.from),Z(i,t.scrollToPos.to),t.scrollToPos.margin);t.scrollToPos.isCursor&&e.state.focused&&pi(e,a)}var s=t.maybeHiddenMarkers,l=t.maybeUnhiddenMarkers;if(s)for(var u=0;u<s.length;++u)s[u].lines.length||hs(s[u],"hide");if(l)for(var u=0;u<l.length;++u)l[u].lines.length&&hs(l[u],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=e.display.scroller.scrollTop),t.updatedDisplay&&ea&&(e.options.lineWrapping&&L(e,t.barMeasure),t.barMeasure.scrollWidth>t.barMeasure.clientWidth&&t.barMeasure.scrollWidth<t.barMeasure.clientWidth+1&&!g(e)&&v(e)),t.changeObjs&&hs(e,"changes",e,t.changeObjs)}function un(t,e){if(t.curOp)return e();Ze(t);try{return e()}finally{en(t)}}function cn(t,e){return function(){if(t.curOp)return e.apply(t,arguments);Ze(t);try{return e.apply(t,arguments)}finally{en(t)}}}function hn(t){return function(){if(this.curOp)return t.apply(this,arguments);Ze(this);try{return t.apply(this,arguments)}finally{en(this)}}}function dn(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Ze(e);try{return t.apply(this,arguments)}finally{en(e)}}}function fn(t,e,n){this.line=e,this.rest=Zi(e),this.size=this.rest?Dr(ho(this.rest))-n+1:1,this.node=this.text=null,this.hidden=nr(t,e)}function pn(t,e,n){for(var i,r=[],o=e;n>o;o=i){var a=new fn(t.doc,Nr(t.doc,o),o);i=o+a.size,r.push(a)}return r}function gn(t,e,n,i){null==e&&(e=t.doc.first),null==n&&(n=t.doc.first+t.doc.size),i||(i=0);var r=t.display;if(i&&n<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>e)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)va&&tr(t.doc,e)<r.viewTo&&vn(t);else if(n<=r.viewFrom)va&&er(t.doc,n+i)>r.viewFrom?vn(t):(r.viewFrom+=i,r.viewTo+=i);else if(e<=r.viewFrom&&n>=r.viewTo)vn(t);else if(e<=r.viewFrom){var o=_n(t,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):vn(t)}else if(n>=r.viewTo){var o=_n(t,e,e,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):vn(t)}else{var a=_n(t,e,e,-1),s=_n(t,n,n+i,1);a&&s?(r.view=r.view.slice(0,a.index).concat(pn(t,a.lineN,s.lineN)).concat(r.view.slice(s.index)),r.viewTo+=i):vn(t)}var l=r.externalMeasured;l&&(n<l.lineN?l.lineN+=i:e<l.lineN+l.size&&(r.externalMeasured=null))}function mn(t,e,n){t.curOp.viewChanged=!0;var i=t.display,r=t.display.externalMeasured;if(r&&e>=r.lineN&&e<r.lineN+r.size&&(i.externalMeasured=null),!(e<i.viewFrom||e>=i.viewTo)){var o=i.view[yn(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==fo(a,n)&&a.push(n)}}}function vn(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function yn(t,e){if(e>=t.display.viewTo)return null;if(e-=t.display.viewFrom,0>e)return null;for(var n=t.display.view,i=0;i<n.length;i++)if(e-=n[i].size,0>e)return i}function _n(t,e,n,i){var r,o=yn(t,e),a=t.display.view;if(!va||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=0,l=t.display.viewFrom;o>s;s++)l+=a[s].size;if(l!=e){if(i>0){if(o==a.length-1)return null;r=l+a[o].size-e,o++}else r=l-e;e+=r,n+=r}for(;tr(t.doc,n)!=n;){if(o==(0>i?0:a.length-1))return null;n+=i*a[o-(0>i?1:0)].size,o+=i}return{index:o,lineN:n}}function bn(t,e,n){var i=t.display,r=i.view;0==r.length||e>=i.viewTo||n<=i.viewFrom?(i.view=pn(t,e,n),i.viewFrom=e):(i.viewFrom>e?i.view=pn(t,e,i.viewFrom).concat(i.view):i.viewFrom<e&&(i.view=i.view.slice(yn(t,e))),i.viewFrom=e,i.viewTo<n?i.view=i.view.concat(pn(t,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,yn(t,n)))),i.viewTo=n}function xn(t){for(var e=t.display.view,n=0,i=0;i<e.length;i++){var r=e[i];r.hidden||r.node&&!r.changes||++n}return n}function wn(t){t.display.pollingFast||t.display.poll.set(t.options.pollInterval,function(){Cn(t),t.state.focused&&wn(t)})}function kn(t){function e(){var i=Cn(t);i||n?(t.display.pollingFast=!1,wn(t)):(n=!0,t.display.poll.set(60,e))}var n=!1;t.display.pollingFast=!0,t.display.poll.set(20,e)}function Cn(t){var e=t.display.input,n=t.display.prevInput,i=t.doc;if(!t.state.focused||Ps(e)&&!n||Ln(t)||t.options.disableInput)return!1;t.state.pasteIncoming&&t.state.fakedLastChar&&(e.value=e.value.substring(0,e.value.length-1),t.state.fakedLastChar=!1);var r=e.value;if(r==n&&!t.somethingSelected())return!1;if(Zo&&ta>=9&&t.display.inputHasSelection===r||ha&&/[\uf700-\uf7ff]/.test(r))return Sn(t),!1;var o=!t.curOp;o&&Ze(t),t.display.shift=!1,8203!=r.charCodeAt(0)||i.sel!=t.display.selForContextMenu||n||(n="");for(var a=0,s=Math.min(n.length,r.length);s>a&&n.charCodeAt(a)==r.charCodeAt(a);)++a;var l=r.slice(a),u=Ns(l),c=null;t.state.pasteIncoming&&i.sel.ranges.length>1&&(Ta&&Ta.join("\n")==l?c=i.sel.ranges.length%Ta.length==0&&po(Ta,Ns):u.length==i.sel.ranges.length&&(c=po(u,function(t){return[t]})));for(var h=i.sel.ranges.length-1;h>=0;h--){var d=i.sel.ranges[h],f=d.from(),p=d.to();a<n.length?f=ya(f.line,f.ch-(n.length-a)):t.state.overwrite&&d.empty()&&!t.state.pasteIncoming&&(p=ya(p.line,Math.min(Nr(i,p.line).text.length,p.ch+ho(u).length)));var g=t.curOp.updateInput,m={from:f,to:p,text:c?c[h%c.length]:u,origin:t.state.pasteIncoming?"paste":t.state.cutIncoming?"cut":"+input"};if(si(t.doc,m),no(t,"inputRead",t,m),l&&!t.state.pasteIncoming&&t.options.electricChars&&t.options.smartIndent&&d.head.ch<100&&(!h||i.sel.ranges[h-1].head.line!=d.head.line)){var v=t.getModeAt(d.head),y=Aa(m);if(v.electricChars){for(var _=0;_<v.electricChars.length;_++)if(l.indexOf(v.electricChars.charAt(_))>-1){xi(t,y.line,"smart");break}}else v.electricInput&&v.electricInput.test(Nr(i,y.line).text.slice(0,y.ch))&&xi(t,y.line,"smart")}}return _i(t),t.curOp.updateInput=g,t.curOp.typing=!0,r.length>1e3||r.indexOf("\n")>-1?e.value=t.display.prevInput="":t.display.prevInput=r,o&&en(t),t.state.pasteIncoming=t.state.cutIncoming=!1,!0}function Sn(t,e){var n,i,r=t.doc;if(t.somethingSelected()){t.display.prevInput="";var o=r.sel.primary();n=As&&(o.to().line-o.from().line>100||(i=t.getSelection()).length>1e3);var a=n?"-":i||t.getSelection();t.display.input.value=a,t.state.focused&&bs(t.display.input),Zo&&ta>=9&&(t.display.inputHasSelection=a)}else e||(t.display.prevInput=t.display.input.value="",Zo&&ta>=9&&(t.display.inputHasSelection=null));t.display.inaccurateSelection=n}function Tn(t){"nocursor"==t.options.readOnly||ca&&So()==t.display.input||t.display.input.focus()}function Mn(t){t.state.focused||(Tn(t),Jn(t))}function Ln(t){return t.options.readOnly||t.doc.cantEdit}function En(t){function e(){t.state.focused&&setTimeout(vo(Tn,t),0)}function n(e){ro(t,e)||ls(e)}function i(e){if(t.somethingSelected())Ta=t.getSelections(),r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,r.input.value=Ta.join("\n"),bs(r.input));else{for(var n=[],i=[],o=0;o<t.doc.sel.ranges.length;o++){var a=t.doc.sel.ranges[o].head.line,s={anchor:ya(a,0),head:ya(a+1,0)};
|
||
i.push(s),n.push(t.getRange(s.anchor,s.head))}"cut"==e.type?t.setSelections(i,null,gs):(r.prevInput="",r.input.value=n.join("\n"),bs(r.input)),Ta=n}"cut"==e.type&&(t.state.cutIncoming=!0)}var r=t.display;us(r.scroller,"mousedown",cn(t,On)),Zo&&11>ta?us(r.scroller,"dblclick",cn(t,function(e){if(!ro(t,e)){var n=An(t,e);if(n&&!Wn(t,e)&&!Pn(t.display,e)){as(e);var i=t.findWordAt(n);re(t.doc,i.anchor,i.head)}}})):us(r.scroller,"dblclick",function(e){ro(t,e)||as(e)}),us(r.lineSpace,"selectstart",function(t){Pn(r,t)||as(t)}),ga||us(r.scroller,"contextmenu",function(e){ti(t,e)}),us(r.scroller,"scroll",function(){r.scroller.clientHeight&&(zn(t,r.scroller.scrollTop),Fn(t,r.scroller.scrollLeft,!0),hs(t,"scroll",t))}),us(r.scrollbarV,"scroll",function(){r.scroller.clientHeight&&zn(t,r.scrollbarV.scrollTop)}),us(r.scrollbarH,"scroll",function(){r.scroller.clientHeight&&Fn(t,r.scrollbarH.scrollLeft)}),us(r.scroller,"mousewheel",function(e){jn(t,e)}),us(r.scroller,"DOMMouseScroll",function(e){jn(t,e)}),us(r.scrollbarH,"mousedown",e),us(r.scrollbarV,"mousedown",e),us(r.wrapper,"scroll",function(){r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),us(r.input,"keyup",function(e){Yn.call(t,e)}),us(r.input,"input",function(){Zo&&ta>=9&&t.display.inputHasSelection&&(t.display.inputHasSelection=null),kn(t)}),us(r.input,"keydown",cn(t,Gn)),us(r.input,"keypress",cn(t,Qn)),us(r.input,"focus",vo(Jn,t)),us(r.input,"blur",vo(Zn,t)),t.options.dragDrop&&(us(r.scroller,"dragstart",function(e){Vn(t,e)}),us(r.scroller,"dragenter",n),us(r.scroller,"dragover",n),us(r.scroller,"drop",cn(t,Hn))),us(r.scroller,"paste",function(e){Pn(r,e)||(t.state.pasteIncoming=!0,Tn(t),kn(t))}),us(r.input,"paste",function(){if(ea&&!t.state.fakedLastChar&&!(new Date-t.state.lastMiddleDown<200)){var e=r.input.selectionStart,n=r.input.selectionEnd;r.input.value+="$",r.input.selectionEnd=n,r.input.selectionStart=e,t.state.fakedLastChar=!0}t.state.pasteIncoming=!0,kn(t)}),us(r.input,"cut",i),us(r.input,"copy",i),aa&&us(r.sizer,"mouseup",function(){So()==r.input&&r.input.blur(),Tn(t)})}function Nn(t){var e=t.display;e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,t.setSize()}function Pn(t,e){for(var n=to(e);n!=t.wrapper;n=n.parentNode)if(!n||n.ignoreEvents||n.parentNode==t.sizer&&n!=t.mover)return!0}function An(t,e,n,i){var r=t.display;if(!n){var o=to(e);if(o==r.scrollbarH||o==r.scrollbarV||o==r.scrollbarFiller||o==r.gutterFiller)return null}var a,s,l=r.lineSpace.getBoundingClientRect();try{a=e.clientX-l.left,s=e.clientY-l.top}catch(e){return null}var u,c=Xe(t,a,s);if(i&&1==c.xRel&&(u=Nr(t.doc,c.line).text).length==c.ch){var h=ys(u,u.length,t.options.tabSize)-u.length;c=ya(c.line,Math.max(0,Math.round((a-Le(t.display).left)/Je(t.display))-h))}return c}function On(t){if(!ro(this,t)){var e=this,n=e.display;if(n.shift=t.shiftKey,Pn(n,t))return void(ea||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Wn(e,t)){var i=An(e,t);switch(window.focus(),eo(t)){case 1:i?Dn(e,t,i):to(t)==n.scroller&&as(t);break;case 2:ea&&(e.state.lastMiddleDown=+new Date),i&&re(e.doc,i),setTimeout(vo(Tn,e),20),as(t);break;case 3:ga&&ti(e,t)}}}}function Dn(t,e,n){setTimeout(vo(Mn,t),0);var i,r=+new Date;wa&&wa.time>r-400&&0==_a(wa.pos,n)?i="triple":xa&&xa.time>r-400&&0==_a(xa.pos,n)?(i="double",wa={time:r,pos:n}):(i="single",xa={time:r,pos:n});var o=t.doc.sel,a=ha?e.metaKey:e.ctrlKey;t.options.dragDrop&&Es&&!Ln(t)&&"single"==i&&o.contains(n)>-1&&o.somethingSelected()?In(t,e,n,a):Bn(t,e,n,i,a)}function In(t,e,n,i){var r=t.display,o=cn(t,function(a){ea&&(r.scroller.draggable=!1),t.state.draggingText=!1,cs(document,"mouseup",o),cs(r.scroller,"drop",o),Math.abs(e.clientX-a.clientX)+Math.abs(e.clientY-a.clientY)<10&&(as(a),i||re(t.doc,n),Tn(t),Zo&&9==ta&&setTimeout(function(){document.body.focus(),Tn(t)},20))});ea&&(r.scroller.draggable=!0),t.state.draggingText=o,r.scroller.dragDrop&&r.scroller.dragDrop(),us(document,"mouseup",o),us(r.scroller,"drop",o)}function Bn(t,e,n,i,r){function o(e){if(0!=_a(g,e))if(g=e,"rect"==i){for(var r=[],o=t.options.tabSize,a=ys(Nr(u,n.line).text,n.ch,o),s=ys(Nr(u,e.line).text,e.ch,o),l=Math.min(a,s),f=Math.max(a,s),p=Math.min(n.line,e.line),m=Math.min(t.lastLine(),Math.max(n.line,e.line));m>=p;p++){var v=Nr(u,p).text,y=uo(v,l,o);l==f?r.push(new X(ya(p,y),ya(p,y))):v.length>y&&r.push(new X(ya(p,y),ya(p,uo(v,f,o))))}r.length||r.push(new X(n,n)),ce(u,Y(d.ranges.slice(0,h).concat(r),h),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var _=c,b=_.anchor,x=e;if("single"!=i){if("double"==i)var w=t.findWordAt(e);else var w=new X(ya(e.line,0),Z(u,ya(e.line+1,0)));_a(w.anchor,b)>0?(x=w.head,b=$(_.from(),w.anchor)):(x=w.anchor,b=q(_.to(),w.head))}var r=d.ranges.slice(0);r[h]=new X(Z(u,b),x),ce(u,Y(r,h),ms)}}function a(e){var n=++v,r=An(t,e,!0,"rect"==i);if(r)if(0!=_a(r,g)){Mn(t),o(r);var s=y(l,u);(r.line>=s.to||r.line<s.from)&&setTimeout(cn(t,function(){v==n&&a(e)}),150)}else{var c=e.clientY<m.top?-20:e.clientY>m.bottom?20:0;c&&setTimeout(cn(t,function(){v==n&&(l.scroller.scrollTop+=c,a(e))}),50)}}function s(e){v=1/0,as(e),Tn(t),cs(document,"mousemove",_),cs(document,"mouseup",b),u.history.lastSelOrigin=null}var l=t.display,u=t.doc;as(e);var c,h,d=u.sel;if(r&&!e.shiftKey?(h=u.sel.contains(n),c=h>-1?u.sel.ranges[h]:new X(n,n)):c=u.sel.primary(),e.altKey)i="rect",r||(c=new X(n,n)),n=An(t,e,!0,!0),h=-1;else if("double"==i){var f=t.findWordAt(n);c=t.display.shift||u.extend?ie(u,c,f.anchor,f.head):f}else if("triple"==i){var p=new X(ya(n.line,0),Z(u,ya(n.line+1,0)));c=t.display.shift||u.extend?ie(u,c,p.anchor,p.head):p}else c=ie(u,c,n);r?h>-1?ae(u,h,c,ms):(h=u.sel.ranges.length,ce(u,Y(u.sel.ranges.concat([c]),h),{scroll:!1,origin:"*mouse"})):(h=0,ce(u,new G([c],0),ms),d=u.sel);var g=n,m=l.wrapper.getBoundingClientRect(),v=0,_=cn(t,function(t){eo(t)?a(t):s(t)}),b=cn(t,s);us(document,"mousemove",_),us(document,"mouseup",b)}function Rn(t,e,n,i,r){try{var o=e.clientX,a=e.clientY}catch(e){return!1}if(o>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&as(e);var s=t.display,l=s.lineDiv.getBoundingClientRect();if(a>l.bottom||!ao(t,n))return Zr(e);a-=l.top-s.viewOffset;for(var u=0;u<t.options.gutters.length;++u){var c=s.gutters.childNodes[u];if(c&&c.getBoundingClientRect().right>=o){var h=Ir(t.doc,a),d=t.options.gutters[u];return r(t,n,t,h,d,e),Zr(e)}}}function Wn(t,e){return Rn(t,e,"gutterClick",!0,no)}function Hn(t){var e=this;if(!ro(e,t)&&!Pn(e.display,t)){as(t),Zo&&(Ma=+new Date);var n=An(e,t,!0),i=t.dataTransfer.files;if(n&&!Ln(e))if(i&&i.length&&window.FileReader&&window.File)for(var r=i.length,o=Array(r),a=0,s=function(t,i){var s=new FileReader;s.onload=cn(e,function(){if(o[i]=s.result,++a==r){n=Z(e.doc,n);var t={from:n,to:n,text:Ns(o.join("\n")),origin:"paste"};si(e.doc,t),ue(e.doc,Q(n,Aa(t)))}}),s.readAsText(t)},l=0;r>l;++l)s(i[l],l);else{if(e.state.draggingText&&e.doc.sel.contains(n)>-1)return e.state.draggingText(t),void setTimeout(vo(Tn,e),20);try{var o=t.dataTransfer.getData("Text");if(o){if(e.state.draggingText&&!(ha?t.metaKey:t.ctrlKey))var u=e.listSelections();if(he(e.doc,Q(n,n)),u)for(var l=0;l<u.length;++l)fi(e.doc,"",u[l].anchor,u[l].head,"drag");e.replaceSelection(o,"around","paste"),Tn(e)}}catch(t){}}}}function Vn(t,e){if(Zo&&(!t.state.draggingText||+new Date-Ma<100))return void ls(e);if(!ro(t,e)&&!Pn(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.setDragImage&&!oa)){var n=xo("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",ra&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),ra&&n.parentNode.removeChild(n)}}function zn(t,e){Math.abs(t.doc.scrollTop-e)<2||(t.doc.scrollTop=e,Yo||T(t,{top:e}),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e),t.display.scrollbarV.scrollTop!=e&&(t.display.scrollbarV.scrollTop=e),Yo&&T(t),we(t,100))}function Fn(t,e,n){(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)||(e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),t.doc.scrollLeft=e,_(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbarH.scrollLeft!=e&&(t.display.scrollbarH.scrollLeft=e))}function jn(t,e){var n=e.wheelDeltaX,i=e.wheelDeltaY;null==n&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(n=e.detail),null==i&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:null==i&&(i=e.wheelDelta);var r=t.display,o=r.scroller;if(n&&o.scrollWidth>o.clientWidth||i&&o.scrollHeight>o.clientHeight){if(i&&ha&&ea)t:for(var a=e.target,s=r.view;a!=o;a=a.parentNode)for(var l=0;l<s.length;l++)if(s[l].node==a){t.display.currentWheelTarget=a;break t}if(n&&!Yo&&!ra&&null!=Ea)return i&&zn(t,Math.max(0,Math.min(o.scrollTop+i*Ea,o.scrollHeight-o.clientHeight))),Fn(t,Math.max(0,Math.min(o.scrollLeft+n*Ea,o.scrollWidth-o.clientWidth))),as(e),void(r.wheelStartX=null);if(i&&null!=Ea){var u=i*Ea,c=t.doc.scrollTop,h=c+r.wrapper.clientHeight;0>u?c=Math.max(0,c+u-50):h=Math.min(t.doc.height,h+u+50),T(t,{top:c,bottom:h})}20>La&&(null==r.wheelStartX?(r.wheelStartX=o.scrollLeft,r.wheelStartY=o.scrollTop,r.wheelDX=n,r.wheelDY=i,setTimeout(function(){if(null!=r.wheelStartX){var t=o.scrollLeft-r.wheelStartX,e=o.scrollTop-r.wheelStartY,n=e&&r.wheelDY&&e/r.wheelDY||t&&r.wheelDX&&t/r.wheelDX;r.wheelStartX=r.wheelStartY=null,n&&(Ea=(Ea*La+n)/(La+1),++La)}},200)):(r.wheelDX+=n,r.wheelDY+=i))}}function Un(t,e,n){if("string"==typeof e&&(e=ja[e],!e))return!1;t.display.pollingFast&&Cn(t)&&(t.display.pollingFast=!1);var i=t.display.shift,r=!1;try{Ln(t)&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),r=e(t)!=ps}finally{t.display.shift=i,t.state.suppressEdits=!1}return r}function Kn(t){var e=t.state.keyMaps.slice(0);return t.options.extraKeys&&e.push(t.options.extraKeys),e.push(t.options.keyMap),e}function qn(t,e){var n=Mi(t.options.keyMap),i=n.auto;clearTimeout(Na),i&&!qa(e)&&(Na=setTimeout(function(){Mi(t.options.keyMap)==n&&(t.options.keyMap=i.call?i.call(null,t):i,s(t))},50));var r=$a(e,!0),o=!1;if(!r)return!1;var a=Kn(t);return o=e.shiftKey?Ka("Shift-"+r,a,function(e){return Un(t,e,!0)})||Ka(r,a,function(e){return("string"==typeof e?/^go[A-Z]/.test(e):e.motion)?Un(t,e):void 0}):Ka(r,a,function(e){return Un(t,e)}),o&&(as(e),xe(t),no(t,"keyHandled",t,r,e)),o}function $n(t,e,n){var i=Ka("'"+n+"'",Kn(t),function(e){return Un(t,e,!0)});return i&&(as(e),xe(t),no(t,"keyHandled",t,"'"+n+"'",e)),i}function Gn(t){var e=this;if(Mn(e),!ro(e,t)){Zo&&11>ta&&27==t.keyCode&&(t.returnValue=!1);var n=t.keyCode;e.display.shift=16==n||t.shiftKey;var i=qn(e,t);ra&&(Pa=i?n:null,!i&&88==n&&!As&&(ha?t.metaKey:t.ctrlKey)&&e.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||Xn(e)}}function Xn(t){function e(t){18!=t.keyCode&&t.altKey||(Mo(n,"CodeMirror-crosshair"),cs(document,"keyup",e),cs(document,"mouseover",e))}var n=t.display.lineDiv;Lo(n,"CodeMirror-crosshair"),us(document,"keyup",e),us(document,"mouseover",e)}function Yn(t){16==t.keyCode&&(this.doc.sel.shift=!1),ro(this,t)}function Qn(t){var e=this;if(!(ro(e,t)||t.ctrlKey&&!t.altKey||ha&&t.metaKey)){var n=t.keyCode,i=t.charCode;if(ra&&n==Pa)return Pa=null,void as(t);if(!(ra&&(!t.which||t.which<10)||aa)||!qn(e,t)){var r=String.fromCharCode(null==i?n:i);$n(e,t,r)||(Zo&&ta>=9&&(e.display.inputHasSelection=null),kn(e))}}}function Jn(t){"nocursor"!=t.options.readOnly&&(t.state.focused||(hs(t,"focus",t),t.state.focused=!0,Lo(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(Sn(t),ea&&setTimeout(vo(Sn,t,!0),0))),wn(t),xe(t))}function Zn(t){t.state.focused&&(hs(t,"blur",t),t.state.focused=!1,Mo(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150)}function ti(t,e){function n(){if(null!=r.input.selectionStart){var e=t.somethingSelected(),n=r.input.value=""+(e?r.input.value:"");r.prevInput=e?"":"",r.input.selectionStart=1,r.input.selectionEnd=n.length,r.selForContextMenu=t.doc.sel}}function i(){if(r.inputDiv.style.position="relative",r.input.style.cssText=l,Zo&&9>ta&&(r.scrollbarV.scrollTop=r.scroller.scrollTop=a),wn(t),null!=r.input.selectionStart){(!Zo||Zo&&9>ta)&&n();var e=0,i=function(){r.selForContextMenu==t.doc.sel&&0==r.input.selectionStart?cn(t,ja.selectAll)(t):e++<10?r.detectingSelectAll=setTimeout(i,500):Sn(t)};r.detectingSelectAll=setTimeout(i,200)}}if(!ro(t,e,"contextmenu")){var r=t.display;if(!Pn(r,e)&&!ei(t,e)){var o=An(t,e),a=r.scroller.scrollTop;if(o&&!ra){var s=t.options.resetSelectionOnContextMenu;s&&-1==t.doc.sel.contains(o)&&cn(t,ce)(t.doc,Q(o),gs);var l=r.input.style.cssText;if(r.inputDiv.style.position="absolute",r.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(Zo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",ea)var u=window.scrollY;if(Tn(t),ea&&window.scrollTo(null,u),Sn(t),t.somethingSelected()||(r.input.value=r.prevInput=" "),r.selForContextMenu=t.doc.sel,clearTimeout(r.detectingSelectAll),Zo&&ta>=9&&n(),ga){ls(e);var c=function(){cs(window,"mouseup",c),setTimeout(i,20)};us(window,"mouseup",c)}else setTimeout(i,50)}}}}function ei(t,e){return ao(t,"gutterContextMenu")?Rn(t,e,"gutterContextMenu",!1,hs):!1}function ni(t,e){if(_a(t,e.from)<0)return t;if(_a(t,e.to)<=0)return Aa(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=Aa(e).ch-e.to.ch),ya(n,i)}function ii(t,e){for(var n=[],i=0;i<t.sel.ranges.length;i++){var r=t.sel.ranges[i];n.push(new X(ni(r.anchor,e),ni(r.head,e)))}return Y(n,t.sel.primIndex)}function ri(t,e,n){return t.line==e.line?ya(n.line,t.ch-e.ch+n.ch):ya(n.line+(t.line-e.line),t.ch)}function oi(t,e,n){for(var i=[],r=ya(t.first,0),o=r,a=0;a<e.length;a++){var s=e[a],l=ri(s.from,r,o),u=ri(Aa(s),r,o);if(r=s.to,o=u,"around"==n){var c=t.sel.ranges[a],h=_a(c.head,c.anchor)<0;i[a]=new X(h?u:l,h?l:u)}else i[a]=new X(l,l)}return new G(i,t.sel.primIndex)}function ai(t,e,n){var i={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){this.canceled=!0}};return n&&(i.update=function(e,n,i,r){e&&(this.from=Z(t,e)),n&&(this.to=Z(t,n)),i&&(this.text=i),void 0!==r&&(this.origin=r)}),hs(t,"beforeChange",t,i),t.cm&&hs(t.cm,"beforeChange",t.cm,i),i.canceled?null:{from:i.from,to:i.to,text:i.text,origin:i.origin}}function si(t,e,n){if(t.cm){if(!t.cm.curOp)return cn(t.cm,si)(t,e,n);if(t.cm.state.suppressEdits)return}if(!(ao(t,"beforeChange")||t.cm&&ao(t.cm,"beforeChange"))||(e=ai(t,e,!0))){var i=ma&&!n&&Fi(t,e.from,e.to);if(i)for(var r=i.length-1;r>=0;--r)li(t,{from:i[r].from,to:i[r].to,text:r?[""]:e.text});else li(t,e)}}function li(t,e){if(1!=e.text.length||""!=e.text[0]||0!=_a(e.from,e.to)){var n=ii(t,e);Fr(t,e,n,t.cm?t.cm.curOp.id:0/0),hi(t,e,n,Hi(t,e));var i=[];Lr(t,function(t,n){n||-1!=fo(i,t.history)||(Jr(t.history,e),i.push(t.history)),hi(t,e,null,Hi(t,e))})}}function ui(t,e,n){if(!t.cm||!t.cm.state.suppressEdits){for(var i,r=t.history,o=t.sel,a="undo"==e?r.done:r.undone,s="undo"==e?r.undone:r.done,l=0;l<a.length&&(i=a[l],n?!i.ranges||i.equals(t.sel):i.ranges);l++);if(l!=a.length){for(r.lastOrigin=r.lastSelOrigin=null;i=a.pop(),i.ranges;){if(Kr(i,s),n&&!i.equals(t.sel))return void ce(t,i,{clearRedo:!1});o=i}var u=[];Kr(o,s),s.push({changes:u,generation:r.generation}),r.generation=i.generation||++r.maxGeneration;for(var c=ao(t,"beforeChange")||t.cm&&ao(t.cm,"beforeChange"),l=i.changes.length-1;l>=0;--l){var h=i.changes[l];if(h.origin=e,c&&!ai(t,h,!1))return void(a.length=0);u.push(Hr(t,h));var d=l?ii(t,h):ho(a);hi(t,h,d,zi(t,h)),!l&&t.cm&&t.cm.scrollIntoView({from:h.from,to:Aa(h)});var f=[];Lr(t,function(t,e){e||-1!=fo(f,t.history)||(Jr(t.history,h),f.push(t.history)),hi(t,h,null,zi(t,h))})}}}}function ci(t,e){if(0!=e&&(t.first+=e,t.sel=new G(po(t.sel.ranges,function(t){return new X(ya(t.anchor.line+e,t.anchor.ch),ya(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){gn(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,i=n.viewFrom;i<n.viewTo;i++)mn(t.cm,i,"gutter")}}function hi(t,e,n,i){if(t.cm&&!t.cm.curOp)return cn(t.cm,hi)(t,e,n,i);if(e.to.line<t.first)return void ci(t,e.text.length-1-(e.to.line-e.from.line));if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var r=e.text.length-1-(t.first-e.from.line);ci(t,r),e={from:ya(t.first,0),to:ya(e.to.line+r,e.to.ch),text:[ho(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:ya(o,Nr(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=Pr(t,e.from,e.to),n||(n=ii(t,e)),t.cm?di(t.cm,e,i):Sr(t,e,i),he(t,n,gs)}}function di(t,e,n){var i=t.doc,r=t.display,a=e.from,s=e.to,l=!1,u=a.line;t.options.lineWrapping||(u=Dr(Ji(Nr(i,a.line))),i.iter(u,s.line+1,function(t){return t==r.maxLine?(l=!0,!0):void 0})),i.sel.contains(e.from,e.to)>-1&&oo(t),Sr(i,e,n,o(t)),t.options.lineWrapping||(i.iter(u,a.line+e.text.length,function(t){var e=d(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,l=!1)}),l&&(t.curOp.updateMaxLine=!0)),i.frontier=Math.min(i.frontier,a.line),we(t,400);var c=e.text.length-(s.line-a.line)-1;a.line!=s.line||1!=e.text.length||Cr(t.doc,e)?gn(t,a.line,s.line+1,c):mn(t,a.line,"text");var h=ao(t,"changes"),f=ao(t,"change");if(f||h){var p={from:a,to:s,text:e.text,removed:e.removed,origin:e.origin};f&&no(t,"change",t,p),h&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(p)}t.display.selForContextMenu=null}function fi(t,e,n,i,r){if(i||(i=n),_a(i,n)<0){var o=i;i=n,n=o}"string"==typeof e&&(e=Ns(e)),si(t,{from:n,to:i,text:e,origin:r})}function pi(t,e){var n=t.display,i=n.sizer.getBoundingClientRect(),r=null;if(e.top+i.top<0?r=!0:e.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!la){var o=xo("div","",null,"position: absolute; top: "+(e.top-n.viewOffset-Te(t.display))+"px; height: "+(e.bottom-e.top+fs)+"px; left: "+e.left+"px; width: 2px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(r),t.display.lineSpace.removeChild(o)}}function gi(t,e,n,i){null==i&&(i=0);for(var r=0;5>r;r++){var o=!1,a=qe(t,e),s=n&&n!=e?qe(t,n):a,l=vi(t,Math.min(a.left,s.left),Math.min(a.top,s.top)-i,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+i),u=t.doc.scrollTop,c=t.doc.scrollLeft;if(null!=l.scrollTop&&(zn(t,l.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(o=!0)),null!=l.scrollLeft&&(Fn(t,l.scrollLeft),Math.abs(t.doc.scrollLeft-c)>1&&(o=!0)),!o)return a}}function mi(t,e,n,i,r){var o=vi(t,e,n,i,r);null!=o.scrollTop&&zn(t,o.scrollTop),null!=o.scrollLeft&&Fn(t,o.scrollLeft)}function vi(t,e,n,i,r){var o=t.display,a=Qe(t.display);0>n&&(n=0);var s=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:o.scroller.scrollTop,l=o.scroller.clientHeight-fs,u={};r-n>l&&(r=n+l);var c=t.doc.height+Me(o),h=a>n,d=r>c-a;if(s>n)u.scrollTop=h?0:n;else if(r>s+l){var f=Math.min(n,(d?c:r)-l);f!=s&&(u.scrollTop=f)}var p=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:o.scroller.scrollLeft,g=o.scroller.clientWidth-fs-o.gutters.offsetWidth,m=i-e>g;return m&&(i=e+g),10>e?u.scrollLeft=0:p>e?u.scrollLeft=Math.max(0,e-(m?0:10)):i>g+p-3&&(u.scrollLeft=i+(m?0:10)-g),u}function yi(t,e,n){(null!=e||null!=n)&&bi(t),null!=e&&(t.curOp.scrollLeft=(null==t.curOp.scrollLeft?t.doc.scrollLeft:t.curOp.scrollLeft)+e),null!=n&&(t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+n)}function _i(t){bi(t);var e=t.getCursor(),n=e,i=e;t.options.lineWrapping||(n=e.ch?ya(e.line,e.ch-1):e,i=ya(e.line,e.ch+1)),t.curOp.scrollToPos={from:n,to:i,margin:t.options.cursorScrollMargin,isCursor:!0}}function bi(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var n=$e(t,e.from),i=$e(t,e.to),r=vi(t,Math.min(n.left,i.left),Math.min(n.top,i.top)-e.margin,Math.max(n.right,i.right),Math.max(n.bottom,i.bottom)+e.margin);t.scrollTo(r.scrollLeft,r.scrollTop)}}function xi(t,e,n,i){var r,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=Se(t,e):n="prev");var a=t.options.tabSize,s=Nr(o,e),l=ys(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(i||/\S/.test(s.text)){if("smart"==n&&(u=o.mode.indent(r,s.text.slice(c.length),s.text),u==ps||u>150)){if(!i)return;n="prev"}}else u=0,n="not";"prev"==n?u=e>o.first?ys(Nr(o,e-1).text,null,a):0:"add"==n?u=l+t.options.indentUnit:"subtract"==n?u=l-t.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var h="",d=0;if(t.options.indentWithTabs)for(var f=Math.floor(u/a);f;--f)d+=a,h+=" ";if(u>d&&(h+=co(u-d)),h!=c)fi(o,h,ya(e,0),ya(e,c.length),"+input");else for(var f=0;f<o.sel.ranges.length;f++){var p=o.sel.ranges[f];if(p.head.line==e&&p.head.ch<c.length){var d=ya(e,c.length);ae(o,f,new X(d,d));break}}s.stateAfter=null}function wi(t,e,n,i){var r=e,o=e;return"number"==typeof e?o=Nr(t,J(t,e)):r=Dr(e),null==r?null:(i(o,r)&&t.cm&&mn(t.cm,r,n),o)}function ki(t,e){for(var n=t.doc.sel.ranges,i=[],r=0;r<n.length;r++){for(var o=e(n[r]);i.length&&_a(o.from,ho(i).to)<=0;){var a=i.pop();if(_a(a.from,o.from)<0){o.from=a.from;break}}i.push(o)}un(t,function(){for(var e=i.length-1;e>=0;e--)fi(t.doc,"",i[e].from,i[e].to,"+delete");_i(t)})}function Ci(t,e,n,i,r){function o(){var e=s+n;return e<t.first||e>=t.first+t.size?h=!1:(s=e,c=Nr(t,e))}function a(t){var e=(r?Go:Xo)(c,l,n,!0);if(null==e){if(t||!o())return h=!1;l=r?(0>n?zo:Vo)(c):0>n?c.text.length:0}else l=e;return!0}var s=e.line,l=e.ch,u=n,c=Nr(t,s),h=!0;if("char"==i)a();else if("column"==i)a(!0);else if("word"==i||"group"==i)for(var d=null,f="group"==i,p=t.cm&&t.cm.getHelper(e,"wordChars"),g=!0;!(0>n)||a(!g);g=!1){var m=c.text.charAt(l)||"\n",v=yo(m,p)?"w":f&&"\n"==m?"n":!f||/\s/.test(m)?null:"p";if(!f||g||v||(v="s"),d&&d!=v){0>n&&(n=1,a());break}if(v&&(d=v),n>0&&!a(!g))break}var y=ge(t,ya(s,l),u,!0);return h||(y.hitSide=!0),y}function Si(t,e,n,i){var r,o=t.doc,a=e.left;if("page"==i){var s=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);r=e.top+n*(s-(0>n?1.5:.5)*Qe(t.display))}else"line"==i&&(r=n>0?e.bottom+3:e.top-3);for(;;){var l=Xe(t,a,r);if(!l.outside)break;if(0>n?0>=r:r>=o.height){l.hitSide=!0;break}r+=5*n}return l}function Ti(e,n,i,r){t.defaults[e]=n,i&&(Da[e]=r?function(t,e,n){n!=Ia&&i(t,e,n)}:i)}function Mi(t){return"string"==typeof t?Ua[t]:t}function Li(t,e,n,i,r){if(i&&i.shared)return Ei(t,e,n,i,r);if(t.cm&&!t.cm.curOp)return cn(t.cm,Li)(t,e,n,i,r);var o=new Xa(t,r),a=_a(e,n);if(i&&mo(i,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=xo("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||(o.widgetNode.ignoreEvents=!0),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Qi(t,e.line,e,n,o)||e.line!=n.line&&Qi(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");va=!0}o.addToHistory&&Fr(t,{from:e,to:n,origin:"markText"},t.sel,0/0);var s,l=e.line,u=t.cm;if(t.iter(l,n.line+1,function(t){u&&o.collapsed&&!u.options.lineWrapping&&Ji(t)==u.display.maxLine&&(s=!0),o.collapsed&&l!=e.line&&Or(t,0),Bi(t,new Oi(o,l==e.line?e.ch:null,l==n.line?n.ch:null)),++l}),o.collapsed&&t.iter(e.line,n.line+1,function(e){nr(t,e)&&Or(e,0)}),o.clearOnEnter&&us(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(ma=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++Ya,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)gn(u,e.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle)for(var c=e.line;c<=n.line;c++)mn(u,c,"text");o.atomic&&fe(u.doc),no(u,"markerAdded",u,o)}return o}function Ei(t,e,n,i,r){i=mo(i),i.shared=!1;var o=[Li(t,e,n,i,r)],a=o[0],s=i.widgetNode;return Lr(t,function(t){s&&(i.widgetNode=s.cloneNode(!0)),o.push(Li(t,Z(t,e),Z(t,n),i,r));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;a=ho(o)}),new Qa(o,a)}function Ni(t){return t.findMarks(ya(t.first,0),t.clipPos(ya(t.lastLine())),function(t){return t.parent})}function Pi(t,e){for(var n=0;n<e.length;n++){var i=e[n],r=i.find(),o=t.clipPos(r.from),a=t.clipPos(r.to);if(_a(o,a)){var s=Li(t,o,a,i.primary,i.primary.type);i.markers.push(s),s.parent=i}}}function Ai(t){for(var e=0;e<t.length;e++){var n=t[e],i=[n.primary.doc];Lr(n.primary.doc,function(t){i.push(t)});for(var r=0;r<n.markers.length;r++){var o=n.markers[r];-1==fo(i,o.doc)&&(o.parent=null,n.markers.splice(r--,1))}}}function Oi(t,e,n){this.marker=t,this.from=e,this.to=n}function Di(t,e){if(t)for(var n=0;n<t.length;++n){var i=t[n];if(i.marker==e)return i}}function Ii(t,e){for(var n,i=0;i<t.length;++i)t[i]!=e&&(n||(n=[])).push(t[i]);return n}function Bi(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t)}function Ri(t,e,n){if(t)for(var i,r=0;r<t.length;++r){var o=t[r],a=o.marker,s=null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e);if(s||o.from==e&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=e:o.to>e);(i||(i=[])).push(new Oi(a,o.from,l?null:o.to))}}return i}function Wi(t,e,n){if(t)for(var i,r=0;r<t.length;++r){var o=t[r],a=o.marker,s=null==o.to||(a.inclusiveRight?o.to>=e:o.to>e);if(s||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e);(i||(i=[])).push(new Oi(a,l?null:o.from-e,null==o.to?null:o.to-e))}}return i}function Hi(t,e){var n=ee(t,e.from.line)&&Nr(t,e.from.line).markedSpans,i=ee(t,e.to.line)&&Nr(t,e.to.line).markedSpans;if(!n&&!i)return null;var r=e.from.ch,o=e.to.ch,a=0==_a(e.from,e.to),s=Ri(n,r,a),l=Wi(i,o,a),u=1==e.text.length,c=ho(e.text).length+(u?r:0);if(s)for(var h=0;h<s.length;++h){var d=s[h];if(null==d.to){var f=Di(l,d.marker);f?u&&(d.to=null==f.to?null:f.to+c):d.to=r}}if(l)for(var h=0;h<l.length;++h){var d=l[h];if(null!=d.to&&(d.to+=c),null==d.from){var f=Di(s,d.marker);f||(d.from=c,u&&(s||(s=[])).push(d))}else d.from+=c,u&&(s||(s=[])).push(d)}s&&(s=Vi(s)),l&&l!=s&&(l=Vi(l));var p=[s];if(!u){var g,m=e.text.length-2;if(m>0&&s)for(var h=0;h<s.length;++h)null==s[h].to&&(g||(g=[])).push(new Oi(s[h].marker,null,null));for(var h=0;m>h;++h)p.push(g);p.push(l)}return p}function Vi(t){for(var e=0;e<t.length;++e){var n=t[e];null!=n.from&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&t.splice(e--,1)}return t.length?t:null}function zi(t,e){var n=Gr(t,e),i=Hi(t,e);if(!n)return i;if(!i)return n;for(var r=0;r<n.length;++r){var o=n[r],a=i[r];if(o&&a)t:for(var s=0;s<a.length;++s){for(var l=a[s],u=0;u<o.length;++u)if(o[u].marker==l.marker)continue t;o.push(l)}else a&&(n[r]=a)}return n}function Fi(t,e,n){var i=null;if(t.iter(e.line,n.line+1,function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var n=t.markedSpans[e].marker;!n.readOnly||i&&-1!=fo(i,n)||(i||(i=[])).push(n)}}),!i)return null;for(var r=[{from:e,to:n}],o=0;o<i.length;++o)for(var a=i[o],s=a.find(0),l=0;l<r.length;++l){var u=r[l];if(!(_a(u.to,s.from)<0||_a(u.from,s.to)>0)){var c=[l,1],h=_a(u.from,s.from),d=_a(u.to,s.to);(0>h||!a.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(d>0||!a.inclusiveRight&&!d)&&c.push({from:s.to,to:u.to}),r.splice.apply(r,c),l+=c.length-1}}return r}function ji(t){var e=t.markedSpans;if(e){for(var n=0;n<e.length;++n)e[n].marker.detachLine(t);t.markedSpans=null}}function Ui(t,e){if(e){for(var n=0;n<e.length;++n)e[n].marker.attachLine(t);t.markedSpans=e}}function Ki(t){return t.inclusiveLeft?-1:0}function qi(t){return t.inclusiveRight?1:0}function $i(t,e){var n=t.lines.length-e.lines.length;if(0!=n)return n;var i=t.find(),r=e.find(),o=_a(i.from,r.from)||Ki(t)-Ki(e);if(o)return-o;var a=_a(i.to,r.to)||qi(t)-qi(e);return a?a:e.id-t.id}function Gi(t,e){var n,i=va&&t.markedSpans;if(i)for(var r,o=0;o<i.length;++o)r=i[o],r.marker.collapsed&&null==(e?r.from:r.to)&&(!n||$i(n,r.marker)<0)&&(n=r.marker);return n}function Xi(t){return Gi(t,!0)}function Yi(t){return Gi(t,!1)}function Qi(t,e,n,i,r){var o=Nr(t,e),a=va&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(l.marker.collapsed){var u=l.marker.find(0),c=_a(u.from,n)||Ki(l.marker)-Ki(r),h=_a(u.to,i)||qi(l.marker)-qi(r);if(!(c>=0&&0>=h||0>=c&&h>=0)&&(0>=c&&(_a(u.to,n)>0||l.marker.inclusiveRight&&r.inclusiveLeft)||c>=0&&(_a(u.from,i)<0||l.marker.inclusiveLeft&&r.inclusiveRight)))return!0}}}function Ji(t){for(var e;e=Xi(t);)t=e.find(-1,!0).line;return t}function Zi(t){for(var e,n;e=Yi(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function tr(t,e){var n=Nr(t,e),i=Ji(n);return n==i?e:Dr(i)}function er(t,e){if(e>t.lastLine())return e;var n,i=Nr(t,e);if(!nr(t,i))return e;for(;n=Yi(i);)i=n.find(1,!0).line;return Dr(i)+1}function nr(t,e){var n=va&&e.markedSpans;if(n)for(var i,r=0;r<n.length;++r)if(i=n[r],i.marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&ir(t,e,i))return!0}}function ir(t,e,n){if(null==n.to){var i=n.marker.find(1,!0);return ir(t,i.line,Di(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==e.text.length)return!0;for(var r,o=0;o<e.markedSpans.length;++o)if(r=e.markedSpans[o],r.marker.collapsed&&!r.marker.widgetNode&&r.from==n.to&&(null==r.to||r.to!=n.from)&&(r.marker.inclusiveLeft||n.marker.inclusiveRight)&&ir(t,e,r))return!0}function rr(t,e,n){Br(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&yi(t,null,n)}function or(t){if(null!=t.height)return t.height;if(!Co(document.body,t.node)){var e="position: relative;";t.coverGutter&&(e+="margin-left: -"+t.cm.getGutterElement().offsetWidth+"px;"),ko(t.cm.display.measure,xo("div",[t.node],null,e))}return t.height=t.node.offsetHeight}function ar(t,e,n,i){var r=new Ja(t,n,i);return r.noHScroll&&(t.display.alignWidgets=!0),wi(t.doc,e,"widget",function(e){var n=e.widgets||(e.widgets=[]);if(null==r.insertAt?n.push(r):n.splice(Math.min(n.length-1,Math.max(0,r.insertAt)),0,r),r.line=e,!nr(t.doc,e)){var i=Br(e)<t.doc.scrollTop;Or(e,e.height+or(r)),i&&yi(t,null,r.height),t.curOp.forceUpdate=!0}return!0}),r}function sr(t,e,n,i){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),ji(t),Ui(t,n);var r=i?i(t):1;r!=t.height&&Or(t,r)}function lr(t){t.parent=null,ji(t)}function ur(t,e){if(t)for(;;){var n=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;t=t.slice(0,n.index)+t.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";null==e[i]?e[i]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(e[i])||(e[i]+=" "+n[2])}return t}function cr(e,n){if(e.blankLine)return e.blankLine(n);if(e.innerMode){var i=t.innerMode(e,n);return i.mode.blankLine?i.mode.blankLine(i.state):void 0}}function hr(t,e,n){for(var i=0;10>i;i++){var r=t.token(e,n);if(e.pos>e.start)return r}throw new Error("Mode "+t.name+" failed to advance stream.")}function dr(e,n,i,r,o,a,s){var l=i.flattenSpans;null==l&&(l=e.options.flattenSpans);var u,c=0,h=null,d=new Ga(n,e.options.tabSize);for(""==n&&ur(cr(i,r),a);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,s&&gr(e,n,r,d.pos),d.pos=n.length,u=null):u=ur(hr(i,d,r),a),e.options.addModeClass){var f=t.innerMode(i,r).mode.name;f&&(u="m-"+(u?f+" "+u:f))}l&&h==u||(c<d.start&&o(d.start,h),c=d.start,h=u),d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e4);o(p,h),c=p}}function fr(t,e,n,i){var r=[t.state.modeGen],o={};dr(t,e.text,t.doc.mode,n,function(t,e){r.push(t,e)},o,i);for(var a=0;a<t.state.overlays.length;++a){var s=t.state.overlays[a],l=1,u=0;dr(t,e.text,s.mode,!0,function(t,e){for(var n=l;t>u;){var i=r[l];i>t&&r.splice(l,1,t,r[l+1],i),l+=2,u=Math.min(t,i)}if(e)if(s.opaque)r.splice(n,l-n,t,"cm-overlay "+e),l=n+2;else for(;l>n;n+=2){var o=r[n+1];r[n+1]=(o?o+" ":"")+"cm-overlay "+e}},o)}return{styles:r,classes:o.bgClass||o.textClass?o:null}}function pr(t,e){if(!e.styles||e.styles[0]!=t.state.modeGen){var n=fr(t,e,e.stateAfter=Se(t,Dr(e)));e.styles=n.styles,n.classes?e.styleClasses=n.classes:e.styleClasses&&(e.styleClasses=null)}return e.styles}function gr(t,e,n,i){var r=t.doc.mode,o=new Ga(e,t.options.tabSize);
|
||
for(o.start=o.pos=i||0,""==e&&cr(r,n);!o.eol()&&o.pos<=t.options.maxHighlightLength;)hr(r,o,n),o.start=o.pos}function mr(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?es:ts;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function vr(t,e){var n=xo("span",null,null,ea?"padding-right: .1px":null),i={pre:xo("pre",[n]),content:n,col:0,pos:0,cm:t};e.measure={};for(var r=0;r<=(e.rest?e.rest.length:0);r++){var o,a=r?e.rest[r-1]:e.line;i.pos=0,i.addToken=_r,(Zo||ea)&&t.getOption("lineWrapping")&&(i.addToken=br(i.addToken)),Io(t.display.measure)&&(o=Rr(a))&&(i.addToken=xr(i.addToken,o)),i.map=[],kr(a,i,pr(t,a)),a.styleClasses&&(a.styleClasses.bgClass&&(i.bgClass=Eo(a.styleClasses.bgClass,i.bgClass||"")),a.styleClasses.textClass&&(i.textClass=Eo(a.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Do(t.display.measure))),0==r?(e.measure.map=i.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(i.map),(e.measure.caches||(e.measure.caches=[])).push({}))}return hs(t,"renderLine",t,e.line,i.pre),i.pre.className&&(i.textClass=Eo(i.pre.className,i.textClass||"")),i}function yr(t){var e=xo("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e}function _r(t,e,n,i,r,o){if(e){var a=t.cm.options.specialChars,s=!1;if(a.test(e))for(var l=document.createDocumentFragment(),u=0;;){a.lastIndex=u;var c=a.exec(e),h=c?c.index-u:e.length-u;if(h){var d=document.createTextNode(e.slice(u,u+h));l.appendChild(Zo&&9>ta?xo("span",[d]):d),t.map.push(t.pos,t.pos+h,d),t.col+=h,t.pos+=h}if(!c)break;if(u+=h+1," "==c[0]){var f=t.cm.options.tabSize,p=f-t.col%f,d=l.appendChild(xo("span",co(p),"cm-tab"));t.col+=p}else{var d=t.cm.options.specialCharPlaceholder(c[0]);l.appendChild(Zo&&9>ta?xo("span",[d]):d),t.col+=1}t.map.push(t.pos,t.pos+1,d),t.pos++}else{t.col+=e.length;var l=document.createTextNode(e);t.map.push(t.pos,t.pos+e.length,l),Zo&&9>ta&&(s=!0),t.pos+=e.length}if(n||i||r||s){var g=n||"";i&&(g+=i),r&&(g+=r);var m=xo("span",[l],g);return o&&(m.title=o),t.content.appendChild(m)}t.content.appendChild(l)}}function br(t){function e(t){for(var e=" ",n=0;n<t.length-2;++n)e+=n%2?" ":" ";return e+=" "}return function(n,i,r,o,a,s){t(n,i.replace(/ {3,}/g,e),r,o,a,s)}}function xr(t,e){return function(n,i,r,o,a,s){r=r?r+" cm-force-border":"cm-force-border";for(var l=n.pos,u=l+i.length;;){for(var c=0;c<e.length;c++){var h=e[c];if(h.to>l&&h.from<=l)break}if(h.to>=u)return t(n,i,r,o,a,s);t(n,i.slice(0,h.to-l),r,o,null,s),o=null,i=i.slice(h.to-l),l=h.to}}}function wr(t,e,n,i){var r=!i&&n.widgetNode;r&&(t.map.push(t.pos,t.pos+e,r),t.content.appendChild(r)),t.pos+=e}function kr(t,e,n){var i=t.markedSpans,r=t.text,o=0;if(i)for(var a,s,l,u,c,h,d=r.length,f=0,p=1,g="",m=0;;){if(m==f){s=l=u=c="",h=null,m=1/0;for(var v=[],y=0;y<i.length;++y){var _=i[y],b=_.marker;_.from<=f&&(null==_.to||_.to>f)?(null!=_.to&&m>_.to&&(m=_.to,l=""),b.className&&(s+=" "+b.className),b.startStyle&&_.from==f&&(u+=" "+b.startStyle),b.endStyle&&_.to==m&&(l+=" "+b.endStyle),b.title&&!c&&(c=b.title),b.collapsed&&(!h||$i(h.marker,b)<0)&&(h=_)):_.from>f&&m>_.from&&(m=_.from),"bookmark"==b.type&&_.from==f&&b.widgetNode&&v.push(b)}if(h&&(h.from||0)==f&&(wr(e,(null==h.to?d+1:h.to)-f,h.marker,null==h.from),null==h.to))return;if(!h&&v.length)for(var y=0;y<v.length;++y)wr(e,0,v[y])}if(f>=d)break;for(var x=Math.min(d,m);;){if(g){var w=f+g.length;if(!h){var k=w>x?g.slice(0,x-f):g;e.addToken(e,k,a?a+s:s,u,f+k.length==m?l:"",c)}if(w>=x){g=g.slice(x-f),f=x;break}f=w,u=""}g=r.slice(o,o=n[p++]),a=mr(n[p++],e.cm.options)}}else for(var p=1;p<n.length;p+=2)e.addToken(e,r.slice(o,o=n[p]),mr(n[p+1],e.cm.options))}function Cr(t,e){return 0==e.from.ch&&0==e.to.ch&&""==ho(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function Sr(t,e,n,i){function r(t){return n?n[t]:null}function o(t,n,r){sr(t,n,r,i),no(t,"change",t,e)}var a=e.from,s=e.to,l=e.text,u=Nr(t,a.line),c=Nr(t,s.line),h=ho(l),d=r(l.length-1),f=s.line-a.line;if(Cr(t,e)){for(var p=0,g=[];p<l.length-1;++p)g.push(new Za(l[p],r(p),i));o(c,c.text,d),f&&t.remove(a.line,f),g.length&&t.insert(a.line,g)}else if(u==c)if(1==l.length)o(u,u.text.slice(0,a.ch)+h+u.text.slice(s.ch),d);else{for(var g=[],p=1;p<l.length-1;++p)g.push(new Za(l[p],r(p),i));g.push(new Za(h+u.text.slice(s.ch),d,i)),o(u,u.text.slice(0,a.ch)+l[0],r(0)),t.insert(a.line+1,g)}else if(1==l.length)o(u,u.text.slice(0,a.ch)+l[0]+c.text.slice(s.ch),r(0)),t.remove(a.line+1,f);else{o(u,u.text.slice(0,a.ch)+l[0],r(0)),o(c,h+c.text.slice(s.ch),d);for(var p=1,g=[];p<l.length-1;++p)g.push(new Za(l[p],r(p),i));f>1&&t.remove(a.line+1,f-1),t.insert(a.line+1,g)}no(t,"change",t,e)}function Tr(t){this.lines=t,this.parent=null;for(var e=0,n=0;e<t.length;++e)t[e].parent=this,n+=t[e].height;this.height=n}function Mr(t){this.children=t;for(var e=0,n=0,i=0;i<t.length;++i){var r=t[i];e+=r.chunkSize(),n+=r.height,r.parent=this}this.size=e,this.height=n,this.parent=null}function Lr(t,e,n){function i(t,r,o){if(t.linked)for(var a=0;a<t.linked.length;++a){var s=t.linked[a];if(s.doc!=r){var l=o&&s.sharedHist;(!n||l)&&(e(s.doc,l),i(s.doc,t,l))}}}i(t,null,!0)}function Er(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,a(t),n(t),t.options.lineWrapping||f(t),t.options.mode=e.modeOption,gn(t)}function Nr(t,e){if(e-=t.first,0>e||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(o>e){n=r;break}e-=o}return n.lines[e]}function Pr(t,e,n){var i=[],r=e.line;return t.iter(e.line,n.line+1,function(t){var o=t.text;r==n.line&&(o=o.slice(0,n.ch)),r==e.line&&(o=o.slice(e.ch)),i.push(o),++r}),i}function Ar(t,e,n){var i=[];return t.iter(e,n,function(t){i.push(t.text)}),i}function Or(t,e){var n=e-t.height;if(n)for(var i=t;i;i=i.parent)i.height+=n}function Dr(t){if(null==t.parent)return null;for(var e=t.parent,n=fo(e.lines,t),i=e.parent;i;e=i,i=i.parent)for(var r=0;i.children[r]!=e;++r)n+=i.children[r].chunkSize();return n+e.first}function Ir(t,e){var n=t.first;t:do{for(var i=0;i<t.children.length;++i){var r=t.children[i],o=r.height;if(o>e){t=r;continue t}e-=o,n+=r.chunkSize()}return n}while(!t.lines);for(var i=0;i<t.lines.length;++i){var a=t.lines[i],s=a.height;if(s>e)break;e-=s}return n+i}function Br(t){t=Ji(t);for(var e=0,n=t.parent,i=0;i<n.lines.length;++i){var r=n.lines[i];if(r==t)break;e+=r.height}for(var o=n.parent;o;n=o,o=n.parent)for(var i=0;i<o.children.length;++i){var a=o.children[i];if(a==n)break;e+=a.height}return e}function Rr(t){var e=t.order;return null==e&&(e=t.order=Bs(t.text)),e}function Wr(t){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t||1}function Hr(t,e){var n={from:K(e.from),to:Aa(e),text:Pr(t,e.from,e.to)};return qr(t,n,e.from.line,e.to.line+1),Lr(t,function(t){qr(t,n,e.from.line,e.to.line+1)},!0),n}function Vr(t){for(;t.length;){var e=ho(t);if(!e.ranges)break;t.pop()}}function zr(t,e){return e?(Vr(t.done),ho(t.done)):t.done.length&&!ho(t.done).ranges?ho(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),ho(t.done)):void 0}function Fr(t,e,n,i){var r=t.history;r.undone.length=0;var o,a=+new Date;if((r.lastOp==i||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&r.lastModTime>a-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))&&(o=zr(r,r.lastOp==i))){var s=ho(o.changes);0==_a(e.from,e.to)&&0==_a(e.from,s.to)?s.to=Aa(e):o.changes.push(Hr(t,e))}else{var l=ho(r.done);for(l&&l.ranges||Kr(t.sel,r.done),o={changes:[Hr(t,e)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=e.origin,s||hs(t,"historyAdded")}function jr(t,e,n,i){var r=e.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Ur(t,e,n,i){var r=t.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||jr(t,o,ho(r.done),e))?r.done[r.done.length-1]=e:Kr(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&i.clearRedo!==!1&&Vr(r.undone)}function Kr(t,e){var n=ho(e);n&&n.ranges&&n.equals(t)||e.push(t)}function qr(t,e,n,i){var r=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,i),function(n){n.markedSpans&&((r||(r=e["spans_"+t.id]={}))[o]=n.markedSpans),++o})}function $r(t){if(!t)return null;for(var e,n=0;n<t.length;++n)t[n].marker.explicitlyCleared?e||(e=t.slice(0,n)):e&&e.push(t[n]);return e?e.length?e:null:t}function Gr(t,e){var n=e["spans_"+t.id];if(!n)return null;for(var i=0,r=[];i<e.text.length;++i)r.push($r(n[i]));return r}function Xr(t,e,n){for(var i=0,r=[];i<t.length;++i){var o=t[i];if(o.ranges)r.push(n?G.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];r.push({changes:s});for(var l=0;l<a.length;++l){var u,c=a[l];if(s.push({from:c.from,to:c.to,text:c.text}),e)for(var h in c)(u=h.match(/^spans_(\d+)$/))&&fo(e,Number(u[1]))>-1&&(ho(s)[h]=c[h],delete c[h])}}}return r}function Yr(t,e,n,i){n<t.line?t.line+=i:e<t.line&&(t.line=e,t.ch=0)}function Qr(t,e,n,i){for(var r=0;r<t.length;++r){var o=t[r],a=!0;if(o.ranges){o.copied||(o=t[r]=o.deepCopy(),o.copied=!0);for(var s=0;s<o.ranges.length;s++)Yr(o.ranges[s].anchor,e,n,i),Yr(o.ranges[s].head,e,n,i)}else{for(var s=0;s<o.changes.length;++s){var l=o.changes[s];if(n<l.from.line)l.from=ya(l.from.line+i,l.from.ch),l.to=ya(l.to.line+i,l.to.ch);else if(e<=l.to.line){a=!1;break}}a||(t.splice(0,r+1),r=0)}}}function Jr(t,e){var n=e.from.line,i=e.to.line,r=e.text.length-(i-n)-1;Qr(t.done,n,i,r),Qr(t.undone,n,i,r)}function Zr(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function to(t){return t.target||t.srcElement}function eo(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),ha&&t.ctrlKey&&1==e&&(e=3),e}function no(t,e){function n(t){return function(){t.apply(null,o)}}var i=t._handlers&&t._handlers[e];if(i){var r,o=Array.prototype.slice.call(arguments,2);Ca?r=Ca.delayedCallbacks:ds?r=ds:(r=ds=[],setTimeout(io,0));for(var a=0;a<i.length;++a)r.push(n(i[a]))}}function io(){var t=ds;ds=null;for(var e=0;e<t.length;++e)t[e]()}function ro(t,e,n){return hs(t,n||e.type,t,e),Zr(e)||e.codemirrorIgnore}function oo(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),i=0;i<e.length;++i)-1==fo(n,e[i])&&n.push(e[i])}function ao(t,e){var n=t._handlers&&t._handlers[e];return n&&n.length>0}function so(t){t.prototype.on=function(t,e){us(this,t,e)},t.prototype.off=function(t,e){cs(this,t,e)}}function lo(){this.id=null}function uo(t,e,n){for(var i=0,r=0;;){var o=t.indexOf(" ",i);-1==o&&(o=t.length);var a=o-i;if(o==t.length||r+a>=e)return i+Math.min(a,e-r);if(r+=o-i,r+=n-r%n,i=o+1,r>=e)return i}}function co(t){for(;_s.length<=t;)_s.push(ho(_s)+" ");return _s[t]}function ho(t){return t[t.length-1]}function fo(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}function po(t,e){for(var n=[],i=0;i<t.length;i++)n[i]=e(t[i],i);return n}function go(t,e){var n;if(Object.create)n=Object.create(t);else{var i=function(){};i.prototype=t,n=new i}return e&&mo(e,n),n}function mo(t,e,n){e||(e={});for(var i in t)!t.hasOwnProperty(i)||n===!1&&e.hasOwnProperty(i)||(e[i]=t[i]);return e}function vo(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function yo(t,e){return e?e.source.indexOf("\\w")>-1&&ks(t)?!0:e.test(t):ks(t)}function _o(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function bo(t){return t.charCodeAt(0)>=768&&Cs.test(t)}function xo(t,e,n,i){var r=document.createElement(t);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var o=0;o<e.length;++o)r.appendChild(e[o]);return r}function wo(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function ko(t,e){return wo(t).appendChild(e)}function Co(t,e){if(t.contains)return t.contains(e);for(;e=e.parentNode;)if(e==t)return!0}function So(){return document.activeElement}function To(t){return new RegExp("\\b"+t+"\\b\\s*")}function Mo(t,e){var n=To(e);n.test(t.className)&&(t.className=t.className.replace(n,""))}function Lo(t,e){To(e).test(t.className)||(t.className+=" "+e)}function Eo(t,e){for(var n=t.split(" "),i=0;i<n.length;i++)n[i]&&!To(n[i]).test(e)&&(e+=" "+n[i]);return e}function No(t){if(document.body.getElementsByClassName)for(var e=document.body.getElementsByClassName("CodeMirror"),n=0;n<e.length;n++){var i=e[n].CodeMirror;i&&t(i)}}function Po(){Ls||(Ao(),Ls=!0)}function Ao(){var t;us(window,"resize",function(){null==t&&(t=setTimeout(function(){t=null,Ss=null,No(Nn)},100))}),us(window,"blur",function(){No(Zn)})}function Oo(t){if(null!=Ss)return Ss;var e=xo("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ko(t,e),e.offsetWidth&&(Ss=e.offsetHeight-e.clientHeight),Ss||0}function Do(t){if(null==Ts){var e=xo("span","");ko(t,xo("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Ts=e.offsetWidth<=1&&e.offsetHeight>2&&!(Zo&&8>ta))}return Ts?xo("span",""):xo("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Io(t){if(null!=Ms)return Ms;var e=ko(t,document.createTextNode("AخA")),n=xs(e,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var i=xs(e,1,2).getBoundingClientRect();return Ms=i.right-n.right<3}function Bo(t){if(null!=Os)return Os;var e=ko(t,xo("span","x")),n=e.getBoundingClientRect(),i=xs(e,0,1).getBoundingClientRect();return Os=Math.abs(n.left-i.left)>1}function Ro(t,e,n,i){if(!t)return i(e,n,"ltr");for(var r=!1,o=0;o<t.length;++o){var a=t[o];(a.from<n&&a.to>e||e==n&&a.to==e)&&(i(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr"),r=!0)}r||i(e,n,"ltr")}function Wo(t){return t.level%2?t.to:t.from}function Ho(t){return t.level%2?t.from:t.to}function Vo(t){var e=Rr(t);return e?Wo(e[0]):0}function zo(t){var e=Rr(t);return e?Ho(ho(e)):t.text.length}function Fo(t,e){var n=Nr(t.doc,e),i=Ji(n);i!=n&&(e=Dr(i));var r=Rr(i),o=r?r[0].level%2?zo(i):Vo(i):0;return ya(e,o)}function jo(t,e){for(var n,i=Nr(t.doc,e);n=Yi(i);)i=n.find(1,!0).line,e=null;var r=Rr(i),o=r?r[0].level%2?Vo(i):zo(i):i.text.length;return ya(null==e?Dr(i):e,o)}function Uo(t,e){var n=Fo(t,e.line),i=Nr(t.doc,n.line),r=Rr(i);if(!r||0==r[0].level){var o=Math.max(0,i.text.search(/\S/)),a=e.line==n.line&&e.ch<=o&&e.ch;return ya(n.line,a?0:o)}return n}function Ko(t,e,n){var i=t[0].level;return e==i?!0:n==i?!1:n>e}function qo(t,e){Is=null;for(var n,i=0;i<t.length;++i){var r=t[i];if(r.from<e&&r.to>e)return i;if(r.from==e||r.to==e){if(null!=n)return Ko(t,r.level,t[n].level)?(r.from!=r.to&&(Is=n),i):(r.from!=r.to&&(Is=i),n);n=i}}return n}function $o(t,e,n,i){if(!i)return e+n;do e+=n;while(e>0&&bo(t.text.charAt(e)));return e}function Go(t,e,n,i){var r=Rr(t);if(!r)return Xo(t,e,n,i);for(var o=qo(r,e),a=r[o],s=$o(t,e,a.level%2?-n:n,i);;){if(s>a.from&&s<a.to)return s;if(s==a.from||s==a.to)return qo(r,s)==o?s:(a=r[o+=n],n>0==a.level%2?a.to:a.from);if(a=r[o+=n],!a)return null;s=n>0==a.level%2?$o(t,a.to,-1,i):$o(t,a.from,1,i)}}function Xo(t,e,n,i){var r=e+n;if(i)for(;r>0&&bo(t.text.charAt(r));)r+=n;return 0>r||r>t.text.length?null:r}var Yo=/gecko\/\d/i.test(navigator.userAgent),Qo=/MSIE \d/.test(navigator.userAgent),Jo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Zo=Qo||Jo,ta=Zo&&(Qo?document.documentMode||6:Jo[1]),ea=/WebKit\//.test(navigator.userAgent),na=ea&&/Qt\/\d+\.\d+/.test(navigator.userAgent),ia=/Chrome\//.test(navigator.userAgent),ra=/Opera\//.test(navigator.userAgent),oa=/Apple Computer/.test(navigator.vendor),aa=/KHTML\//.test(navigator.userAgent),sa=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),la=/PhantomJS/.test(navigator.userAgent),ua=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),ca=ua||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),ha=ua||/Mac/.test(navigator.platform),da=/win/i.test(navigator.platform),fa=ra&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);fa&&(fa=Number(fa[1])),fa&&fa>=15&&(ra=!1,ea=!0);var pa=ha&&(na||ra&&(null==fa||12.11>fa)),ga=Yo||Zo&&ta>=9,ma=!1,va=!1,ya=t.Pos=function(t,e){return this instanceof ya?(this.line=t,void(this.ch=e)):new ya(t,e)},_a=t.cmpPos=function(t,e){return t.line-e.line||t.ch-e.ch};G.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var n=this.ranges[e],i=t.ranges[e];if(0!=_a(n.anchor,i.anchor)||0!=_a(n.head,i.head))return!1}return!0},deepCopy:function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new X(K(this.ranges[e].anchor),K(this.ranges[e].head));return new G(t,this.primIndex)},somethingSelected:function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},contains:function(t,e){e||(e=t);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(_a(e,i.from())>=0&&_a(t,i.to())<=0)return n}return-1}},X.prototype={from:function(){return $(this.anchor,this.head)},to:function(){return q(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var ba,xa,wa,ka={left:0,right:0,top:0,bottom:0},Ca=null,Sa=0,Ta=null,Ma=0,La=0,Ea=null;Zo?Ea=-.53:Yo?Ea=15:ia?Ea=-.7:oa&&(Ea=-1/3);var Na,Pa=null,Aa=t.changeEnd=function(t){return t.text?ya(t.from.line+t.text.length-1,ho(t.text).length+(1==t.text.length?t.from.ch:0)):t.to};t.prototype={constructor:t,focus:function(){window.focus(),Tn(this),kn(this)},setOption:function(t,e){var n=this.options,i=n[t];(n[t]!=e||"mode"==t)&&(n[t]=e,Da.hasOwnProperty(t)&&cn(this,Da[t])(this,e,i))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](t)},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;n<e.length;++n)if(e[n]==t||"string"!=typeof e[n]&&e[n].name==t)return e.splice(n,1),!0},addOverlay:hn(function(e,n){var i=e.token?e:t.getMode(this.options,e);if(i.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:i,modeSpec:e,opaque:n&&n.opaque}),this.state.modeGen++,gn(this)}),removeOverlay:hn(function(t){for(var e=this.state.overlays,n=0;n<e.length;++n){var i=e[n].modeSpec;if(i==t||"string"==typeof t&&i.name==t)return e.splice(n,1),this.state.modeGen++,void gn(this)}}),indentLine:hn(function(t,e,n){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),ee(this.doc,t)&&xi(this,t,e,n)}),indentSelection:hn(function(t){for(var e=this.doc.sel.ranges,n=-1,i=0;i<e.length;i++){var r=e[i];if(r.empty())r.head.line>n&&(xi(this,r.head.line,t,!0),n=r.head.line,i==this.doc.sel.primIndex&&_i(this));else{var o=r.from(),a=r.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;n>l;++l)xi(this,l,t);var u=this.doc.sel.ranges;0==o.ch&&e.length==u.length&&u[i].from().ch>0&&ae(this.doc,i,new X(o,u[i].to()),gs)}}}),getTokenAt:function(t,e){var n=this.doc;t=Z(n,t);for(var i=Se(this,t.line,e),r=this.doc.mode,o=Nr(n,t.line),a=new Ga(o.text,this.options.tabSize);a.pos<t.ch&&!a.eol();){a.start=a.pos;var s=hr(r,a,i)}return{start:a.start,end:a.pos,string:a.current(),type:s||null,state:i}},getTokenTypeAt:function(t){t=Z(this.doc,t);var e,n=pr(this,Nr(this.doc,t.line)),i=0,r=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=i+r>>1;if((a?n[2*a-1]:0)>=o)r=a;else{if(!(n[2*a+1]<o)){e=n[2*a+2];break}i=a+1}}var s=e?e.indexOf("cm-overlay "):-1;return 0>s?e:0==s?null:e.slice(0,s-1)},getModeAt:function(e){var n=this.doc.mode;return n.innerMode?t.innerMode(n,this.getTokenAt(e).state).mode:n},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var n=[];if(!Va.hasOwnProperty(e))return Va;var i=Va[e],r=this.getModeAt(t);if("string"==typeof r[e])i[r[e]]&&n.push(i[r[e]]);else if(r[e])for(var o=0;o<r[e].length;o++){var a=i[r[e][o]];a&&n.push(a)}else r.helperType&&i[r.helperType]?n.push(i[r.helperType]):i[r.name]&&n.push(i[r.name]);for(var o=0;o<i._global.length;o++){var s=i._global[o];s.pred(r,this)&&-1==fo(n,s.val)&&n.push(s.val)}return n},getStateAfter:function(t,e){var n=this.doc;return t=J(n,null==t?n.first+n.size-1:t),Se(this,t+1,e)},cursorCoords:function(t,e){var n,i=this.doc.sel.primary();return n=null==t?i.head:"object"==typeof t?Z(this.doc,t):t?i.from():i.to(),qe(this,n,e||"page")},charCoords:function(t,e){return Ke(this,Z(this.doc,t),e||"page")},coordsChar:function(t,e){return t=Ue(this,t,e||"page"),Xe(this,t.left,t.top)},lineAtHeight:function(t,e){return t=Ue(this,{top:t,left:0},e||"page").top,Ir(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e){var n=!1,i=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>i&&(t=i,n=!0);var r=Nr(this.doc,t);return je(this,r,{top:0,left:0},e||"page").top+(n?this.doc.height-Br(r):0)},defaultTextHeight:function(){return Qe(this.display)},defaultCharWidth:function(){return Je(this.display)},setGutterMarker:hn(function(t,e,n){return wi(this.doc,t,"gutter",function(t){var i=t.gutterMarkers||(t.gutterMarkers={});return i[e]=n,!n&&_o(i)&&(t.gutterMarkers=null),!0})}),clearGutter:hn(function(t){var e=this,n=e.doc,i=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[t]&&(n.gutterMarkers[t]=null,mn(e,i,"gutter"),_o(n.gutterMarkers)&&(n.gutterMarkers=null)),++i})}),addLineWidget:hn(function(t,e,n){return ar(this,t,e,n)}),removeLineWidget:function(t){t.clear()},lineInfo:function(t){if("number"==typeof t){if(!ee(this.doc,t))return null;var e=t;if(t=Nr(this.doc,t),!t)return null}else{var e=Dr(t);if(null==e)return null}return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,i,r){var o=this.display;t=qe(this,Z(this.doc,t));var a=t.bottom,s=t.left;if(e.style.position="absolute",o.sizer.appendChild(e),"over"==i)a=t.top;else if("above"==i||"near"==i){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?a=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(a=t.bottom),s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=a+"px",e.style.left=e.style.right="","right"==r?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),n&&mi(this,s,a,s+e.offsetWidth,a+e.offsetHeight)},triggerOnKeyDown:hn(Gn),triggerOnKeyPress:hn(Qn),triggerOnKeyUp:Yn,execCommand:function(t){return ja.hasOwnProperty(t)?ja[t](this):void 0},findPosH:function(t,e,n,i){var r=1;0>e&&(r=-1,e=-e);for(var o=0,a=Z(this.doc,t);e>o&&(a=Ci(this.doc,a,r,n,i),!a.hitSide);++o);return a},moveH:hn(function(t,e){var n=this;n.extendSelectionsBy(function(i){return n.display.shift||n.doc.extend||i.empty()?Ci(n.doc,i.head,t,e,n.options.rtlMoveVisually):0>t?i.from():i.to()},vs)}),deleteH:hn(function(t,e){var n=this.doc.sel,i=this.doc;n.somethingSelected()?i.replaceSelection("",null,"+delete"):ki(this,function(n){var r=Ci(i,n.head,t,e,!1);return 0>t?{from:r,to:n.head}:{from:n.head,to:r}})}),findPosV:function(t,e,n,i){var r=1,o=i;0>e&&(r=-1,e=-e);for(var a=0,s=Z(this.doc,t);e>a;++a){var l=qe(this,s,"div");if(null==o?o=l.left:l.left=o,s=Si(this,l,r,n),s.hitSide)break}return s},moveV:hn(function(t,e){var n=this,i=this.doc,r=[],o=!n.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy(function(a){if(o)return 0>t?a.from():a.to();var s=qe(n,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),r.push(s.left);var l=Si(n,s,t,e);return"page"==e&&a==i.sel.primary()&&yi(n,null,Ke(n,l,"div").top-s.top),l},vs),r.length)for(var a=0;a<i.sel.ranges.length;a++)i.sel.ranges[a].goalColumn=r[a]}),findWordAt:function(t){var e=this.doc,n=Nr(e,t.line).text,i=t.ch,r=t.ch;if(n){var o=this.getHelper(t,"wordChars");(t.xRel<0||r==n.length)&&i?--i:++r;for(var a=n.charAt(i),s=yo(a,o)?function(t){return yo(t,o)}:/\s/.test(a)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!yo(t)};i>0&&s(n.charAt(i-1));)--i;for(;r<n.length&&s(n.charAt(r));)++r}return new X(ya(t.line,i),ya(t.line,r))},toggleOverwrite:function(t){(null==t||t!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Lo(this.display.cursorDiv,"CodeMirror-overwrite"):Mo(this.display.cursorDiv,"CodeMirror-overwrite"),hs(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return So()==this.display.input},scrollTo:hn(function(t,e){(null!=t||null!=e)&&bi(this),null!=t&&(this.curOp.scrollLeft=t),null!=e&&(this.curOp.scrollTop=e)}),getScrollInfo:function(){var t=this.display.scroller,e=fs;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-e,width:t.scrollWidth-e,clientHeight:t.clientHeight-e,clientWidth:t.clientWidth-e}},scrollIntoView:hn(function(t,e){if(null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:ya(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line)bi(this),this.curOp.scrollToPos=t;else{var n=vi(this,Math.min(t.from.left,t.to.left),Math.min(t.from.top,t.to.top)-t.margin,Math.max(t.from.right,t.to.right),Math.max(t.from.bottom,t.to.bottom)+t.margin);this.scrollTo(n.scrollLeft,n.scrollTop)}}),setSize:hn(function(t,e){function n(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t}var i=this;null!=t&&(i.display.wrapper.style.width=n(t)),null!=e&&(i.display.wrapper.style.height=n(e)),i.options.lineWrapping&&He(this);var r=i.display.viewFrom;i.doc.iter(r,i.display.viewTo,function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){mn(i,r,"widget");break}++r}),i.curOp.forceUpdate=!0,hs(i,"refresh",this)}),operation:function(t){return un(this,t)},refresh:hn(function(){var t=this.display.cachedTextHeight;gn(this),this.curOp.forceUpdate=!0,Ve(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),h(this),(null==t||Math.abs(t-Qe(this.display))>.5)&&a(this),hs(this,"refresh",this)}),swapDoc:hn(function(t){var e=this.doc;return e.cm=null,Er(this,t),Ve(this),Sn(this),this.scrollTo(t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,no(this,"swapDoc",this,e),e}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},so(t);var Oa=t.defaults={},Da=t.optionHandlers={},Ia=t.Init={toString:function(){return"CodeMirror.Init"}};Ti("value","",function(t,e){t.setValue(e)},!0),Ti("mode",null,function(t,e){t.doc.modeOption=e,n(t)},!0),Ti("indentUnit",2,n,!0),Ti("indentWithTabs",!1),Ti("smartIndent",!0),Ti("tabSize",4,function(t){i(t),Ve(t),gn(t)},!0),Ti("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e){t.options.specialChars=new RegExp(e.source+(e.test(" ")?"":"| "),"g"),t.refresh()},!0),Ti("specialCharPlaceholder",yr,function(t){t.refresh()},!0),Ti("electricChars",!0),Ti("rtlMoveVisually",!da),Ti("wholeLineUpdateBefore",!0),Ti("theme","default",function(t){l(t),u(t)},!0),Ti("keyMap","default",s),Ti("extraKeys",null),Ti("lineWrapping",!1,r,!0),Ti("gutters",[],function(t){p(t.options),u(t)},!0),Ti("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?w(t.display)+"px":"0",t.refresh()},!0),Ti("coverGutterNextToScrollbar",!1,v,!0),Ti("lineNumbers",!1,function(t){p(t.options),u(t)},!0),Ti("firstLineNumber",1,u,!0),Ti("lineNumberFormatter",function(t){return t},u,!0),Ti("showCursorWhenSelecting",!1,ye,!0),Ti("resetSelectionOnContextMenu",!0),Ti("readOnly",!1,function(t,e){"nocursor"==e?(Zn(t),t.display.input.blur(),t.display.disabled=!0):(t.display.disabled=!1,e||Sn(t))}),Ti("disableInput",!1,function(t,e){e||Sn(t)},!0),Ti("dragDrop",!0),Ti("cursorBlinkRate",530),Ti("cursorScrollMargin",0),Ti("cursorHeight",1,ye,!0),Ti("singleCursorHeightPerLine",!0,ye,!0),Ti("workTime",100),Ti("workDelay",100),Ti("flattenSpans",!0,i,!0),Ti("addModeClass",!1,i,!0),Ti("pollInterval",100),Ti("undoDepth",200,function(t,e){t.doc.history.undoDepth=e}),Ti("historyEventDelay",1250),Ti("viewportMargin",10,function(t){t.refresh()},!0),Ti("maxHighlightLength",1e4,i,!0),Ti("moveInputWithCursor",!0,function(t,e){e||(t.display.inputDiv.style.top=t.display.inputDiv.style.left=0)}),Ti("tabindex",null,function(t,e){t.display.input.tabIndex=e||""}),Ti("autofocus",null);var Ba=t.modes={},Ra=t.mimeModes={};t.defineMode=function(e,n){t.defaults.mode||"null"==e||(t.defaults.mode=e),arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),Ba[e]=n},t.defineMIME=function(t,e){Ra[t]=e},t.resolveMode=function(e){if("string"==typeof e&&Ra.hasOwnProperty(e))e=Ra[e];else if(e&&"string"==typeof e.name&&Ra.hasOwnProperty(e.name)){var n=Ra[e.name];"string"==typeof n&&(n={name:n}),e=go(n,e),e.name=n.name}else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return t.resolveMode("application/xml");return"string"==typeof e?{name:e}:e||{name:"null"}},t.getMode=function(e,n){var n=t.resolveMode(n),i=Ba[n.name];if(!i)return t.getMode(e,"text/plain");var r=i(e,n);if(Wa.hasOwnProperty(n.name)){var o=Wa[n.name];for(var a in o)o.hasOwnProperty(a)&&(r.hasOwnProperty(a)&&(r["_"+a]=r[a]),r[a]=o[a])}if(r.name=n.name,n.helperType&&(r.helperType=n.helperType),n.modeProps)for(var a in n.modeProps)r[a]=n.modeProps[a];return r},t.defineMode("null",function(){return{token:function(t){t.skipToEnd()}}}),t.defineMIME("text/plain","null");var Wa=t.modeExtensions={};t.extendMode=function(t,e){var n=Wa.hasOwnProperty(t)?Wa[t]:Wa[t]={};mo(e,n)},t.defineExtension=function(e,n){t.prototype[e]=n},t.defineDocExtension=function(t,e){is.prototype[t]=e},t.defineOption=Ti;var Ha=[];t.defineInitHook=function(t){Ha.push(t)};var Va=t.helpers={};t.registerHelper=function(e,n,i){Va.hasOwnProperty(e)||(Va[e]=t[e]={_global:[]}),Va[e][n]=i},t.registerGlobalHelper=function(e,n,i,r){t.registerHelper(e,n,r),Va[e]._global.push({pred:i,val:r})};var za=t.copyState=function(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var n={};for(var i in e){var r=e[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n},Fa=t.startState=function(t,e,n){return t.startState?t.startState(e,n):!0};t.innerMode=function(t,e){for(;t.innerMode;){var n=t.innerMode(e);if(!n||n.mode==t)break;e=n.state,t=n.mode}return n||{mode:t,state:e}};var ja=t.commands={selectAll:function(t){t.setSelection(ya(t.firstLine(),0),ya(t.lastLine()),gs)},singleSelection:function(t){t.setSelection(t.getCursor("anchor"),t.getCursor("head"),gs)},killLine:function(t){ki(t,function(e){if(e.empty()){var n=Nr(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line<t.lastLine()?{from:e.head,to:ya(e.head.line+1,0)}:{from:e.head,to:ya(e.head.line,n)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){ki(t,function(e){return{from:ya(e.from().line,0),to:Z(t.doc,ya(e.to().line+1,0))}})},delLineLeft:function(t){ki(t,function(t){return{from:ya(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(t){ki(t,function(e){var n=t.charCoords(e.head,"div").top+5,i=t.coordsChar({left:0,top:n},"div");return{from:i,to:e.from()}})},delWrappedLineRight:function(t){ki(t,function(e){var n=t.charCoords(e.head,"div").top+5,i=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:e.from(),to:i}
|
||
})},undo:function(t){t.undo()},redo:function(t){t.redo()},undoSelection:function(t){t.undoSelection()},redoSelection:function(t){t.redoSelection()},goDocStart:function(t){t.extendSelection(ya(t.firstLine(),0))},goDocEnd:function(t){t.extendSelection(ya(t.lastLine()))},goLineStart:function(t){t.extendSelectionsBy(function(e){return Fo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){t.extendSelectionsBy(function(e){return Uo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){t.extendSelectionsBy(function(e){return jo(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")},vs)},goLineLeft:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")},vs)},goLineLeftSmart:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5,i=t.coordsChar({left:0,top:n},"div");return i.ch<t.getLine(i.line).search(/\S/)?Uo(t,e.head):i},vs)},goLineUp:function(t){t.moveV(-1,"line")},goLineDown:function(t){t.moveV(1,"line")},goPageUp:function(t){t.moveV(-1,"page")},goPageDown:function(t){t.moveV(1,"page")},goCharLeft:function(t){t.moveH(-1,"char")},goCharRight:function(t){t.moveH(1,"char")},goColumnLeft:function(t){t.moveH(-1,"column")},goColumnRight:function(t){t.moveH(1,"column")},goWordLeft:function(t){t.moveH(-1,"word")},goGroupRight:function(t){t.moveH(1,"group")},goGroupLeft:function(t){t.moveH(-1,"group")},goWordRight:function(t){t.moveH(1,"word")},delCharBefore:function(t){t.deleteH(-1,"char")},delCharAfter:function(t){t.deleteH(1,"char")},delWordBefore:function(t){t.deleteH(-1,"word")},delWordAfter:function(t){t.deleteH(1,"word")},delGroupBefore:function(t){t.deleteH(-1,"group")},delGroupAfter:function(t){t.deleteH(1,"group")},indentAuto:function(t){t.indentSelection("smart")},indentMore:function(t){t.indentSelection("add")},indentLess:function(t){t.indentSelection("subtract")},insertTab:function(t){t.replaceSelection(" ")},insertSoftTab:function(t){for(var e=[],n=t.listSelections(),i=t.options.tabSize,r=0;r<n.length;r++){var o=n[r].from(),a=ys(t.getLine(o.line),o.ch,i);e.push(new Array(i-a%i+1).join(" "))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){un(t,function(){for(var e=t.listSelections(),n=[],i=0;i<e.length;i++){var r=e[i].head,o=Nr(t.doc,r.line).text;if(o)if(r.ch==o.length&&(r=new ya(r.line,r.ch-1)),r.ch>0)r=new ya(r.line,r.ch+1),t.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),ya(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var a=Nr(t.doc,r.line-1).text;a&&t.replaceRange(o.charAt(0)+"\n"+a.charAt(a.length-1),ya(r.line-1,a.length-1),ya(r.line,1),"+transpose")}n.push(new X(r,r))}t.setSelections(n)})},newlineAndIndent:function(t){un(t,function(){for(var e=t.listSelections().length,n=0;e>n;n++){var i=t.listSelections()[n];t.replaceRange("\n",i.anchor,i.head,"+input"),t.indentLine(i.from().line+1,null,!0),_i(t)}})},toggleOverwrite:function(t){t.toggleOverwrite()}},Ua=t.keyMap={};Ua.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ua.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ua.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ua.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},Ua["default"]=ha?Ua.macDefault:Ua.pcDefault;var Ka=t.lookupKey=function(t,e,n){function i(e){e=Mi(e);var r=e[t];if(r===!1)return"stop";if(null!=r&&n(r))return!0;if(e.nofallthrough)return"stop";var o=e.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return i(o);for(var a=0;a<o.length;++a){var s=i(o[a]);if(s)return s}return!1}for(var r=0;r<e.length;++r){var o=i(e[r]);if(o)return"stop"!=o}},qa=t.isModifierKey=function(t){var e=Ds[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e},$a=t.keyName=function(t,e){if(ra&&34==t.keyCode&&t["char"])return!1;var n=Ds[t.keyCode];return null==n||t.altGraphKey?!1:(t.altKey&&(n="Alt-"+n),(pa?t.metaKey:t.ctrlKey)&&(n="Ctrl-"+n),(pa?t.ctrlKey:t.metaKey)&&(n="Cmd-"+n),!e&&t.shiftKey&&(n="Shift-"+n),n)};t.fromTextArea=function(e,n){function i(){e.value=u.getValue()}if(n||(n={}),n.value=e.value,!n.tabindex&&e.tabindex&&(n.tabindex=e.tabindex),!n.placeholder&&e.placeholder&&(n.placeholder=e.placeholder),null==n.autofocus){var r=So();n.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}if(e.form&&(us(e.form,"submit",i),!n.leaveSubmitMethodAlone)){var o=e.form,a=o.submit;try{var s=o.submit=function(){i(),o.submit=a,o.submit(),o.submit=s}}catch(l){}}e.style.display="none";var u=t(function(t){e.parentNode.insertBefore(t,e.nextSibling)},n);return u.save=i,u.getTextArea=function(){return e},u.toTextArea=function(){u.toTextArea=isNaN,i(),e.parentNode.removeChild(u.getWrapperElement()),e.style.display="",e.form&&(cs(e.form,"submit",i),"function"==typeof e.form.submit&&(e.form.submit=a))},u};var Ga=t.StringStream=function(t,e){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Ga.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t)var n=e==t;else var n=e&&(t.test?t.test(e):t(e));return n?(++this.pos,e):void 0},eatWhile:function(t){for(var e=this.pos;this.eat(t););return this.pos>e},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);return e>-1?(this.pos=e,!0):void 0},backUp:function(t){this.pos-=t},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ys(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ys(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return ys(this.string,null,this.tabSize)-(this.lineStart?ys(this.string,this.lineStart,this.tabSize):0)},match:function(t,e,n){if("string"!=typeof t){var i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&e!==!1&&(this.pos+=i[0].length),i)}var r=function(t){return n?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);return r(o)==r(t)?(e!==!1&&(this.pos+=t.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}}};var Xa=t.TextMarker=function(t,e){this.lines=[],this.type=e,this.doc=t};so(Xa),Xa.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&Ze(t),ao(this,"clear")){var n=this.find();n&&no(this,"clear",n.from,n.to)}for(var i=null,r=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=Di(a.markedSpans,this);t&&!this.collapsed?mn(t,Dr(a),"text"):t&&(null!=s.to&&(r=Dr(a)),null!=s.from&&(i=Dr(a))),a.markedSpans=Ii(a.markedSpans,s),null==s.from&&this.collapsed&&!nr(this.doc,a)&&t&&Or(a,Qe(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var l=Ji(this.lines[o]),u=d(l);u>t.display.maxLineLength&&(t.display.maxLine=l,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&gn(t,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&fe(t.doc)),t&&no(t,"markerCleared",t,this),e&&en(t),this.parent&&this.parent.clear()}},Xa.prototype.find=function(t,e){null==t&&"bookmark"==this.type&&(t=1);for(var n,i,r=0;r<this.lines.length;++r){var o=this.lines[r],a=Di(o.markedSpans,this);if(null!=a.from&&(n=ya(e?o:Dr(o),a.from),-1==t))return n;if(null!=a.to&&(i=ya(e?o:Dr(o),a.to),1==t))return i}return n&&{from:n,to:i}},Xa.prototype.changed=function(){var t=this.find(-1,!0),e=this,n=this.doc.cm;t&&n&&un(n,function(){var i=t.line,r=Dr(t.line),o=Oe(n,r);if(o&&(We(o),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!nr(e.doc,i)&&null!=e.height){var a=e.height;e.height=null;var s=or(e)-a;s&&Or(i,i.height+s)}})},Xa.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=fo(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},Xa.prototype.detachLine=function(t){if(this.lines.splice(fo(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}};var Ya=0,Qa=t.SharedTextMarker=function(t,e){this.markers=t,this.primary=e;for(var n=0;n<t.length;++n)t[n].parent=this};so(Qa),Qa.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();no(this,"clear")}},Qa.prototype.find=function(t,e){return this.primary.find(t,e)};var Ja=t.LineWidget=function(t,e,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.cm=t,this.node=e};so(Ja),Ja.prototype.clear=function(){var t=this.cm,e=this.line.widgets,n=this.line,i=Dr(n);if(null!=i&&e){for(var r=0;r<e.length;++r)e[r]==this&&e.splice(r--,1);e.length||(n.widgets=null);var o=or(this);un(t,function(){rr(t,n,-o),mn(t,i,"widget"),Or(n,Math.max(0,n.height-o))})}},Ja.prototype.changed=function(){var t=this.height,e=this.cm,n=this.line;this.height=null;var i=or(this)-t;i&&un(e,function(){e.curOp.forceUpdate=!0,rr(e,n,i),Or(n,n.height+i)})};var Za=t.Line=function(t,e,n){this.text=t,Ui(this,e),this.height=n?n(this):1};so(Za),Za.prototype.lineNo=function(){return Dr(this)};var ts={},es={};Tr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=t,i=t+e;i>n;++n){var r=this.lines[n];this.height-=r.height,lr(r),no(r,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,n){this.height+=n,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var i=0;i<e.length;++i)e[i].parent=this},iterN:function(t,e,n){for(var i=t+e;i>t;++t)if(n(this.lines[t]))return!0}},Mr.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var n=0;n<this.children.length;++n){var i=this.children[n],r=i.chunkSize();if(r>t){var o=Math.min(e,r-t),a=i.height;if(i.removeInner(t,o),this.height-=a-i.height,r==o&&(this.children.splice(n--,1),i.parent=null),0==(e-=o))break;t=0}else t-=r}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof Tr))){var s=[];this.collapse(s),this.children=[new Tr(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,n){this.size+=e.length,this.height+=n;for(var i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(o>=t){if(r.insertInner(t,e,n),r.lines&&r.lines.length>50){for(;r.lines.length>50;){var a=r.lines.splice(r.lines.length-25,25),s=new Tr(a);r.height-=s.height,this.children.splice(i+1,0,s),s.parent=this}this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),n=new Mr(e);if(t.parent){t.size-=n.size,t.height-=n.height;var i=fo(t.parent.children,t);t.parent.children.splice(i+1,0,n)}else{var r=new Mr(t.children);r.parent=t,t.children=[r,n],t=r}n.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(o>t){var a=Math.min(e,o-t);if(r.iterN(t,a,n))return!0;if(0==(e-=a))break;t=0}else t-=o}}};var ns=0,is=t.Doc=function(t,e,n){if(!(this instanceof is))return new is(t,e,n);null==n&&(n=0),Mr.call(this,[new Tr([new Za("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var i=ya(n,0);this.sel=Q(i),this.history=new Wr(null),this.id=++ns,this.modeOption=e,"string"==typeof t&&(t=Ns(t)),Sr(this,{from:i,to:i,text:t}),ce(this,Q(i),gs)};is.prototype=go(Mr.prototype,{constructor:is,iter:function(t,e,n){n?this.iterN(t-this.first,e-t,n):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var n=0,i=0;i<e.length;++i)n+=e[i].height;this.insertInner(t-this.first,e,n)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=Ar(this,this.first,this.first+this.size);return t===!1?e:e.join(t||"\n")},setValue:dn(function(t){var e=ya(this.first,0),n=this.first+this.size-1;si(this,{from:e,to:ya(n,Nr(this,n).text.length),text:Ns(t),origin:"setValue"},!0),ce(this,Q(e))}),replaceRange:function(t,e,n,i){e=Z(this,e),n=n?Z(this,n):e,fi(this,t,e,n,i)},getRange:function(t,e,n){var i=Pr(this,Z(this,t),Z(this,e));return n===!1?i:i.join(n||"\n")},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){return ee(this,t)?Nr(this,t):void 0},getLineNumber:function(t){return Dr(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=Nr(this,t)),Ji(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return Z(this,t)},getCursor:function(t){var e,n=this.sel.primary();return e=null==t||"head"==t?n.head:"anchor"==t?n.anchor:"end"==t||"to"==t||t===!1?n.to():n.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:dn(function(t,e,n){se(this,Z(this,"number"==typeof t?ya(t,e||0):t),null,n)}),setSelection:dn(function(t,e,n){se(this,Z(this,t),Z(this,e||t),n)}),extendSelection:dn(function(t,e,n){re(this,Z(this,t),e&&Z(this,e),n)}),extendSelections:dn(function(t,e){oe(this,ne(this,t,e))}),extendSelectionsBy:dn(function(t,e){oe(this,po(this.sel.ranges,t),e)}),setSelections:dn(function(t,e,n){if(t.length){for(var i=0,r=[];i<t.length;i++)r[i]=new X(Z(this,t[i].anchor),Z(this,t[i].head));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),ce(this,Y(r,e),n)}}),addSelection:dn(function(t,e,n){var i=this.sel.ranges.slice(0);i.push(new X(Z(this,t),Z(this,e||t))),ce(this,Y(i,i.length-1),n)}),getSelection:function(t){for(var e,n=this.sel.ranges,i=0;i<n.length;i++){var r=Pr(this,n[i].from(),n[i].to());e=e?e.concat(r):r}return t===!1?e:e.join(t||"\n")},getSelections:function(t){for(var e=[],n=this.sel.ranges,i=0;i<n.length;i++){var r=Pr(this,n[i].from(),n[i].to());t!==!1&&(r=r.join(t||"\n")),e[i]=r}return e},replaceSelection:function(t,e,n){for(var i=[],r=0;r<this.sel.ranges.length;r++)i[r]=t;this.replaceSelections(i,e,n||"+input")},replaceSelections:dn(function(t,e,n){for(var i=[],r=this.sel,o=0;o<r.ranges.length;o++){var a=r.ranges[o];i[o]={from:a.from(),to:a.to(),text:Ns(t[o]),origin:n}}for(var s=e&&"end"!=e&&oi(this,i,e),o=i.length-1;o>=0;o--)si(this,i[o]);s?ue(this,s):this.cm&&_i(this.cm)}),undo:dn(function(){ui(this,"undo")}),redo:dn(function(){ui(this,"redo")}),undoSelection:dn(function(){ui(this,"undo",!0)}),redoSelection:dn(function(){ui(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,i=0;i<t.done.length;i++)t.done[i].ranges||++e;for(var i=0;i<t.undone.length;i++)t.undone[i].ranges||++n;return{undo:e,redo:n}},clearHistory:function(){this.history=new Wr(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Xr(this.history.done),undone:Xr(this.history.undone)}},setHistory:function(t){var e=this.history=new Wr(this.history.maxGeneration);e.done=Xr(t.done.slice(0),null,!0),e.undone=Xr(t.undone.slice(0),null,!0)},addLineClass:dn(function(t,e,n){return wi(this,t,"class",function(t){var i="text"==e?"textClass":"background"==e?"bgClass":"wrapClass";if(t[i]){if(new RegExp("(?:^|\\s)"+n+"(?:$|\\s)").test(t[i]))return!1;t[i]+=" "+n}else t[i]=n;return!0})}),removeLineClass:dn(function(t,e,n){return wi(this,t,"class",function(t){var i="text"==e?"textClass":"background"==e?"bgClass":"wrapClass",r=t[i];if(!r)return!1;if(null==n)t[i]=null;else{var o=r.match(new RegExp("(?:^|\\s+)"+n+"(?:$|\\s+)"));if(!o)return!1;var a=o.index+o[0].length;t[i]=r.slice(0,o.index)+(o.index&&a!=r.length?" ":"")+r.slice(a)||null}return!0})}),markText:function(t,e,n){return Li(this,Z(this,t),Z(this,e),n,"range")},setBookmark:function(t,e){var n={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared};return t=Z(this,t),Li(this,t,t,n,"bookmark")},findMarksAt:function(t){t=Z(this,t);var e=[],n=Nr(this,t.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var r=n[i];(null==r.from||r.from<=t.ch)&&(null==r.to||r.to>=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,n){t=Z(this,t),e=Z(this,e);var i=[],r=t.line;return this.iter(t.line,e.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s<a.length;s++){var l=a[s];r==t.line&&t.ch>l.to||null==l.from&&r!=t.line||r==e.line&&l.from>e.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r}),i},getAllMarks:function(){var t=[];return this.iter(function(e){var n=e.markedSpans;if(n)for(var i=0;i<n.length;++i)null!=n[i].from&&t.push(n[i].marker)}),t},posFromIndex:function(t){var e,n=this.first;return this.iter(function(i){var r=i.text.length+1;return r>t?(e=t,!0):(t-=r,void++n)}),Z(this,ya(n,e))},indexFromPos:function(t){t=Z(this,t);var e=t.ch;return t.line<this.first||t.ch<0?0:(this.iter(this.first,t.line,function(t){e+=t.text.length+1}),e)},copy:function(t){var e=new is(Ar(this,this.first,this.first+this.size),this.modeOption,this.first);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,n=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<n&&(n=t.to);var i=new is(Ar(this,e,n),t.mode||this.modeOption,e);return t.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:t.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],Pi(i,Ni(this)),i},unlinkDoc:function(e){if(e instanceof t&&(e=e.doc),this.linked)for(var n=0;n<this.linked.length;++n){var i=this.linked[n];if(i.doc==e){this.linked.splice(n,1),e.unlinkDoc(this),Ai(Ni(this));break}}if(e.history==this.history){var r=[e.id];Lr(e,function(t){r.push(t.id)},!0),e.history=new Wr(null),e.history.done=Xr(this.history.done,r),e.history.undone=Xr(this.history.undone,r)}},iterLinkedDocs:function(t){Lr(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),is.prototype.eachLine=is.prototype.iter;var rs="iter insert remove copy getEditor".split(" ");for(var os in is.prototype)is.prototype.hasOwnProperty(os)&&fo(rs,os)<0&&(t.prototype[os]=function(t){return function(){return t.apply(this.doc,arguments)}}(is.prototype[os]));so(is);var as=t.e_preventDefault=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},ss=t.e_stopPropagation=function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},ls=t.e_stop=function(t){as(t),ss(t)},us=t.on=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var i=t._handlers||(t._handlers={}),r=i[e]||(i[e]=[]);r.push(n)}},cs=t.off=function(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var i=t._handlers&&t._handlers[e];if(!i)return;for(var r=0;r<i.length;++r)if(i[r]==n){i.splice(r,1);break}}},hs=t.signal=function(t,e){var n=t._handlers&&t._handlers[e];if(n)for(var i=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,i)},ds=null,fs=30,ps=t.Pass={toString:function(){return"CodeMirror.Pass"}},gs={scroll:!1},ms={origin:"*mouse"},vs={origin:"+move"};lo.prototype.set=function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)};var ys=t.countColumn=function(t,e,n,i,r){null==e&&(e=t.search(/[^\s\u00a0]/),-1==e&&(e=t.length));for(var o=i||0,a=r||0;;){var s=t.indexOf(" ",o);if(0>s||s>=e)return a+(e-o);a+=s-o,a+=n-a%n,o=s+1}},_s=[""],bs=function(t){t.select()};ua?bs=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:Zo&&(bs=function(t){try{t.select()}catch(e){}}),[].indexOf&&(fo=function(t,e){return t.indexOf(e)}),[].map&&(po=function(t,e){return t.map(e)});var xs,ws=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,ks=t.isWordChar=function(t){return/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||ws.test(t))},Cs=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;xs=document.createRange?function(t,e,n){var i=document.createRange();return i.setEnd(t,n),i.setStart(t,e),i}:function(t,e,n){var i=document.body.createTextRange();return i.moveToElementText(t.parentNode),i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",e),i},Zo&&11>ta&&(So=function(){try{return document.activeElement}catch(t){return document.body}});var Ss,Ts,Ms,Ls=!1,Es=function(){if(Zo&&9>ta)return!1;var t=xo("div");return"draggable"in t||"dragDrop"in t}(),Ns=t.splitLines=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],i=t.length;i>=e;){var r=t.indexOf("\n",e);-1==r&&(r=t.length);var o=t.slice(e,"\r"==t.charAt(r-1)?r-1:r),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),e+=a+1):(n.push(o),e=r+1)}return n}:function(t){return t.split(/\r\n?|\n/)},Ps=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(n){}return e&&e.parentElement()==t?0!=e.compareEndPoints("StartToEnd",e):!1},As=function(){var t=xo("div");return"oncopy"in t?!0:(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),Os=null,Ds={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};t.keyNames=Ds,function(){for(var t=0;10>t;t++)Ds[t+48]=Ds[t+96]=String(t);for(var t=65;90>=t;t++)Ds[t]=String.fromCharCode(t);for(var t=1;12>=t;t++)Ds[t+111]=Ds[t+63235]="F"+t}();var Is,Bs=function(){function t(t){return 247>=t?n.charAt(t):t>=1424&&1524>=t?"R":t>=1536&&1773>=t?i.charAt(t-1536):t>=1774&&2220>=t?"r":t>=8192&&8203>=t?"w":8204==t?"b":"L"}function e(t,e,n){this.level=t,this.from=e,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,u="L";return function(n){if(!r.test(n))return!1;for(var i,c=n.length,h=[],d=0;c>d;++d)h.push(i=t(n.charCodeAt(d)));for(var d=0,f=u;c>d;++d){var i=h[d];"m"==i?h[d]=f:f=i}for(var d=0,p=u;c>d;++d){var i=h[d];"1"==i&&"r"==p?h[d]="n":a.test(i)&&(p=i,"r"==i&&(h[d]="R"))}for(var d=1,f=h[0];c-1>d;++d){var i=h[d];"+"==i&&"1"==f&&"1"==h[d+1]?h[d]="1":","!=i||f!=h[d+1]||"1"!=f&&"n"!=f||(h[d]=f),f=i}for(var d=0;c>d;++d){var i=h[d];if(","==i)h[d]="N";else if("%"==i){for(var g=d+1;c>g&&"%"==h[g];++g);for(var m=d&&"!"==h[d-1]||c>g&&"1"==h[g]?"1":"N",v=d;g>v;++v)h[v]=m;d=g-1}}for(var d=0,p=u;c>d;++d){var i=h[d];"L"==p&&"1"==i?h[d]="L":a.test(i)&&(p=i)}for(var d=0;c>d;++d)if(o.test(h[d])){for(var g=d+1;c>g&&o.test(h[g]);++g);for(var y="L"==(d?h[d-1]:u),_="L"==(c>g?h[g]:u),m=y||_?"L":"R",v=d;g>v;++v)h[v]=m;d=g-1}for(var b,x=[],d=0;c>d;)if(s.test(h[d])){var w=d;for(++d;c>d&&s.test(h[d]);++d);x.push(new e(0,w,d))}else{var k=d,C=x.length;for(++d;c>d&&"L"!=h[d];++d);for(var v=k;d>v;)if(l.test(h[v])){v>k&&x.splice(C,0,new e(1,k,v));var S=v;for(++v;d>v&&l.test(h[v]);++v);x.splice(C,0,new e(2,S,v)),k=v}else++v;d>k&&x.splice(C,0,new e(1,k,d))}return 1==x[0].level&&(b=n.match(/^\s+/))&&(x[0].from=b[0].length,x.unshift(new e(0,0,b[0].length))),1==ho(x).level&&(b=n.match(/\s+$/))&&(ho(x).to-=b[0].length,x.push(new e(0,c-b[0].length,c))),x[0].level!=ho(x).level&&x.push(new e(x[0].level,c,c)),x}}();return t.version="4.7.0",t}),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("xml",function(e,n){function i(t,e){function n(n){return e.tokenize=n,n(t,e)}var i=t.next();if("<"==i)return t.eat("!")?t.eat("[")?t.match("CDATA[")?n(a("atom","]]>")):null:t.match("--")?n(a("comment","-->")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(s(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=a("meta","?>"),"meta"):(k=t.eat("/")?"closeTag":"openTag",e.tokenize=r,"tag bracket");if("&"==i){var o;return o=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"),o?"atom":"error"}return t.eatWhile(/[^&<]/),null}function r(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=i,k=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return k="equals",null;if("<"==n){e.tokenize=i,e.state=h,e.tagName=e.tagStart=null;var r=e.tokenize(t,e);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(e.tokenize=o(n),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function o(t){var e=function(e,n){for(;!e.eol();)if(e.next()==t){n.tokenize=r;break}return"string"};return e.isInAttribute=!0,e}function a(t,e){return function(n,r){for(;!n.eol();){if(n.match(e)){r.tokenize=i;break}n.next()}return t}}function s(t){return function(e,n){for(var r;null!=(r=e.next());){if("<"==r)return n.tokenize=s(t+1),n.tokenize(e,n);if(">"==r){if(1==t){n.tokenize=i;break}return n.tokenize=s(t-1),n.tokenize(e,n)}}return"meta"}}function l(t,e,n){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=n,(S.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function u(t){t.context&&(t.context=t.context.prev)}function c(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!S.contextGrabbers.hasOwnProperty(n)||!S.contextGrabbers[n].hasOwnProperty(e))return;u(t)}}function h(t,e,n){return"openTag"==t?(n.tagStart=e.column(),d):"closeTag"==t?f:h}function d(t,e,n){return"word"==t?(n.tagName=e.current(),C="tag",m):(C="error",d)}function f(t,e,n){if("word"==t){var i=e.current();return n.context&&n.context.tagName!=i&&S.implicitlyClosed.hasOwnProperty(n.context.tagName)&&u(n),n.context&&n.context.tagName==i?(C="tag",p):(C="tag error",g)}return C="error",g}function p(t,e,n){return"endTag"!=t?(C="error",p):(u(n),h)}function g(t,e,n){return C="error",p(t,e,n)}function m(t,e,n){if("word"==t)return C="attribute",v;if("endTag"==t||"selfcloseTag"==t){var i=n.tagName,r=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||S.autoSelfClosers.hasOwnProperty(i)?c(n,i):(c(n,i),n.context=new l(n,i,r==n.indented)),h
|
||
}return C="error",m}function v(t,e,n){return"equals"==t?y:(S.allowMissing||(C="error"),m(t,e,n))}function y(t,e,n){return"string"==t?_:"word"==t&&S.allowUnquoted?(C="string",m):(C="error",m(t,e,n))}function _(t,e,n){return"string"==t?_:m(t,e,n)}var b=e.indentUnit,x=n.multilineTagIndentFactor||1,w=n.multilineTagIndentPastTag;null==w&&(w=!0);var k,C,S=n.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},T=n.alignCDATA;return{startState:function(){return{tokenize:i,state:h,indented:0,tagName:null,tagStart:null,context:null}},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;k=null;var n=e.tokenize(t,e);return(n||k)&&"comment"!=n&&(C=null,e.state=e.state(k||n,t,e),C&&(n="error"==C?n+" error":C)),n},indent:function(e,n,o){var a=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+b;if(a&&a.noIndent)return t.Pass;if(e.tokenize!=r&&e.tokenize!=i)return o?o.match(/^(\s*)/)[0].length:0;if(e.tagName)return w?e.tagStart+e.tagName.length+2:e.tagStart+b*x;if(T&&/<!\[CDATA\[/.test(n))return 0;var s=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(s&&s[1])for(;a;){if(a.tagName==s[2]){a=a.prev;break}if(!S.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(s)for(;a;){var l=S.contextGrabbers[a.tagName];if(!l||!l.hasOwnProperty(s[2]))break;a=a.prev}for(;a&&!a.startOfLine;)a=a.prev;return a?a.indent+b:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}}),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("javascript",function(e,n){function i(t){for(var e,n=!1,i=!1;null!=(e=t.next());){if(!n){if("/"==e&&!i)return;"["==e?i=!0:i&&"]"==e&&(i=!1)}n=!n&&"\\"==e}}function r(t,e,n){return pe=t,ge=n,e}function o(t,e){var n=t.next();if('"'==n||"'"==n)return e.tokenize=a(n),e.tokenize(t,e);if("."==n&&t.match(/^\d+(?:[eE][+\-]?\d+)?/))return r("number","number");if("."==n&&t.match(".."))return r("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return r(n);if("="==n&&t.eat(">"))return r("=>","operator");if("0"==n&&t.eat(/x/i))return t.eatWhile(/[\da-f]/i),r("number","number");if(/\d/.test(n))return t.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),r("number","number");if("/"==n)return t.eat("*")?(e.tokenize=s,s(t,e)):t.eat("/")?(t.skipToEnd(),r("comment","comment")):"operator"==e.lastType||"keyword c"==e.lastType||"sof"==e.lastType||/^[\[{}\(,;:]$/.test(e.lastType)?(i(t),t.eatWhile(/[gimy]/),r("regexp","string-2")):(t.eatWhile(ke),r("operator","operator",t.current()));if("`"==n)return e.tokenize=l,l(t,e);if("#"==n)return t.skipToEnd(),r("error","error");if(ke.test(n))return t.eatWhile(ke),r("operator","operator",t.current());if(xe.test(n)){t.eatWhile(xe);var o=t.current(),u=we.propertyIsEnumerable(o)&&we[o];return u&&"."!=e.lastType?r(u.type,u.style,o):r("variable","variable",o)}}function a(t){return function(e,n){var i,a=!1;if(ye&&"@"==e.peek()&&e.match(Ce))return n.tokenize=o,r("jsonld-keyword","meta");for(;null!=(i=e.next())&&(i!=t||a);)a=!a&&"\\"==i;return a||(n.tokenize=o),r("string","string")}}function s(t,e){for(var n,i=!1;n=t.next();){if("/"==n&&i){e.tokenize=o;break}i="*"==n}return r("comment","comment")}function l(t,e){for(var n,i=!1;null!=(n=t.next());){if(!i&&("`"==n||"$"==n&&t.eat("{"))){e.tokenize=o;break}i=!i&&"\\"==n}return r("quasi","string-2",t.current())}function u(t,e){e.fatArrowAt&&(e.fatArrowAt=null);var n=t.string.indexOf("=>",t.start);if(!(0>n)){for(var i=0,r=!1,o=n-1;o>=0;--o){var a=t.string.charAt(o),s=Se.indexOf(a);if(s>=0&&3>s){if(!i){++o;break}if(0==--i)break}else if(s>=3&&6>s)++i;else if(xe.test(a))r=!0;else if(r&&!i){++o;break}}r&&!i&&(e.fatArrowAt=o)}}function c(t,e,n,i,r,o){this.indented=t,this.column=e,this.type=n,this.prev=r,this.info=o,null!=i&&(this.align=i)}function h(t,e){for(var n=t.localVars;n;n=n.next)if(n.name==e)return!0;for(var i=t.context;i;i=i.prev)for(var n=i.vars;n;n=n.next)if(n.name==e)return!0}function d(t,e,n,i,r){var o=t.cc;for(Me.state=t,Me.stream=r,Me.marked=null,Me.cc=o,Me.style=e,t.lexical.hasOwnProperty("align")||(t.lexical.align=!0);;){var a=o.length?o.pop():_e?w:x;if(a(n,i)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Me.marked?Me.marked:"variable"==n&&h(t,i)?"variable-2":e}}}function f(){for(var t=arguments.length-1;t>=0;t--)Me.cc.push(arguments[t])}function p(){return f.apply(null,arguments),!0}function g(t){function e(e){for(var n=e;n;n=n.next)if(n.name==t)return!0;return!1}var i=Me.state;if(i.context){if(Me.marked="def",e(i.localVars))return;i.localVars={name:t,next:i.localVars}}else{if(e(i.globalVars))return;n.globalVars&&(i.globalVars={name:t,next:i.globalVars})}}function m(){Me.state.context={prev:Me.state.context,vars:Me.state.localVars},Me.state.localVars=Le}function v(){Me.state.localVars=Me.state.context.vars,Me.state.context=Me.state.context.prev}function y(t,e){var n=function(){var n=Me.state,i=n.indented;if("stat"==n.lexical.type)i=n.lexical.indented;else for(var r=n.lexical;r&&")"==r.type&&r.align;r=r.prev)i=r.indented;n.lexical=new c(i,Me.stream.column(),t,null,n.lexical,e)};return n.lex=!0,n}function _(){var t=Me.state;t.lexical.prev&&(")"==t.lexical.type&&(t.indented=t.lexical.indented),t.lexical=t.lexical.prev)}function b(t){function e(n){return n==t?p():";"==t?f():p(e)}return e}function x(t,e){return"var"==t?p(y("vardef",e.length),j,b(";"),_):"keyword a"==t?p(y("form"),w,x,_):"keyword b"==t?p(y("form"),x,_):"{"==t?p(y("}"),V,_):";"==t?p():"if"==t?("else"==Me.state.lexical.info&&Me.state.cc[Me.state.cc.length-1]==_&&Me.state.cc.pop()(),p(y("form"),w,x,_,G)):"function"==t?p(te):"for"==t?p(y("form"),X,x,_):"variable"==t?p(y("stat"),O):"switch"==t?p(y("form"),w,y("}","switch"),b("{"),V,_,_):"case"==t?p(w,b(":")):"default"==t?p(b(":")):"catch"==t?p(y("form"),m,b("("),ee,b(")"),x,_,v):"module"==t?p(y("form"),m,ae,v,_):"class"==t?p(y("form"),ne,_):"export"==t?p(y("form"),se,_):"import"==t?p(y("form"),le,_):f(y("stat"),w,b(";"),_)}function w(t){return C(t,!1)}function k(t){return C(t,!0)}function C(t,e){if(Me.state.fatArrowAt==Me.stream.start){var n=e?A:P;if("("==t)return p(m,y(")"),W(U,")"),_,b("=>"),n,v);if("variable"==t)return f(m,U,b("=>"),n,v)}var i=e?L:M;return Te.hasOwnProperty(t)?p(i):"function"==t?p(te,i):"keyword c"==t?p(e?T:S):"("==t?p(y(")"),S,fe,b(")"),_,i):"operator"==t||"spread"==t?p(e?k:w):"["==t?p(y("]"),he,_,i):"{"==t?H(I,"}",null,i):"quasi"==t?f(E,i):p()}function S(t){return t.match(/[;\}\)\],]/)?f():f(w)}function T(t){return t.match(/[;\}\)\],]/)?f():f(k)}function M(t,e){return","==t?p(w):L(t,e,!1)}function L(t,e,n){var i=0==n?M:L,r=0==n?w:k;return"=>"==t?p(m,n?A:P,v):"operator"==t?/\+\+|--/.test(e)?p(i):"?"==e?p(w,b(":"),r):p(r):"quasi"==t?f(E,i):";"!=t?"("==t?H(k,")","call",i):"."==t?p(D,i):"["==t?p(y("]"),S,b("]"),_,i):void 0:void 0}function E(t,e){return"quasi"!=t?f():"${"!=e.slice(e.length-2)?p(E):p(w,N)}function N(t){return"}"==t?(Me.marked="string-2",Me.state.tokenize=l,p(E)):void 0}function P(t){return u(Me.stream,Me.state),f("{"==t?x:w)}function A(t){return u(Me.stream,Me.state),f("{"==t?x:k)}function O(t){return":"==t?p(_,x):f(M,b(";"),_)}function D(t){return"variable"==t?(Me.marked="property",p()):void 0}function I(t,e){return"variable"==t||"keyword"==Me.style?(Me.marked="property",p("get"==e||"set"==e?B:R)):"number"==t||"string"==t?(Me.marked=ye?"property":Me.style+" property",p(R)):"jsonld-keyword"==t?p(R):"["==t?p(w,b("]"),R):void 0}function B(t){return"variable"!=t?f(R):(Me.marked="property",p(te))}function R(t){return":"==t?p(k):"("==t?f(te):void 0}function W(t,e){function n(i){if(","==i){var r=Me.state.lexical;return"call"==r.info&&(r.pos=(r.pos||0)+1),p(t,n)}return i==e?p():p(b(e))}return function(i){return i==e?p():f(t,n)}}function H(t,e,n){for(var i=3;i<arguments.length;i++)Me.cc.push(arguments[i]);return p(y(e,n),W(t,e),_)}function V(t){return"}"==t?p():f(x,V)}function z(t){return be&&":"==t?p(F):void 0}function F(t){return"variable"==t?(Me.marked="variable-3",p()):void 0}function j(){return f(U,z,q,$)}function U(t,e){return"variable"==t?(g(e),p()):"["==t?H(U,"]"):"{"==t?H(K,"}"):void 0}function K(t,e){return"variable"!=t||Me.stream.match(/^\s*:/,!1)?("variable"==t&&(Me.marked="property"),p(b(":"),U,q)):(g(e),p(q))}function q(t,e){return"="==e?p(k):void 0}function $(t){return","==t?p(j):void 0}function G(t,e){return"keyword b"==t&&"else"==e?p(y("form","else"),x,_):void 0}function X(t){return"("==t?p(y(")"),Y,b(")"),_):void 0}function Y(t){return"var"==t?p(j,b(";"),J):";"==t?p(J):"variable"==t?p(Q):f(w,b(";"),J)}function Q(t,e){return"in"==e||"of"==e?(Me.marked="keyword",p(w)):p(M,J)}function J(t,e){return";"==t?p(Z):"in"==e||"of"==e?(Me.marked="keyword",p(w)):f(w,b(";"),Z)}function Z(t){")"!=t&&p(w)}function te(t,e){return"*"==e?(Me.marked="keyword",p(te)):"variable"==t?(g(e),p(te)):"("==t?p(m,y(")"),W(ee,")"),_,x,v):void 0}function ee(t){return"spread"==t?p(ee):f(U,z)}function ne(t,e){return"variable"==t?(g(e),p(ie)):void 0}function ie(t,e){return"extends"==e?p(w,ie):"{"==t?p(y("}"),re,_):void 0}function re(t,e){return"variable"==t||"keyword"==Me.style?(Me.marked="property","get"==e||"set"==e?p(oe,te,re):p(te,re)):"*"==e?(Me.marked="keyword",p(re)):";"==t?p(re):"}"==t?p():void 0}function oe(t){return"variable"!=t?f():(Me.marked="property",p())}function ae(t,e){return"string"==t?p(x):"variable"==t?(g(e),p(ce)):void 0}function se(t,e){return"*"==e?(Me.marked="keyword",p(ce,b(";"))):"default"==e?(Me.marked="keyword",p(w,b(";"))):f(x)}function le(t){return"string"==t?p():f(ue,ce)}function ue(t,e){return"{"==t?H(ue,"}"):("variable"==t&&g(e),p())}function ce(t,e){return"from"==e?(Me.marked="keyword",p(w)):void 0}function he(t){return"]"==t?p():f(k,de)}function de(t){return"for"==t?f(fe,b("]")):","==t?p(W(T,"]")):f(W(k,"]"))}function fe(t){return"for"==t?p(X,fe):"if"==t?p(w,fe):void 0}var pe,ge,me=e.indentUnit,ve=n.statementIndent,ye=n.jsonld,_e=n.json||ye,be=n.typescript,xe=n.wordCharacters||/[\w$\xa1-\uffff]/,we=function(){function t(t){return{type:t,style:"keyword"}}var e=t("keyword a"),n=t("keyword b"),i=t("keyword c"),r=t("operator"),o={type:"atom",style:"atom"},a={"if":t("if"),"while":e,"with":e,"else":n,"do":n,"try":n,"finally":n,"return":i,"break":i,"continue":i,"new":i,"delete":i,"throw":i,"debugger":i,"var":t("var"),"const":t("var"),let:t("var"),"function":t("function"),"catch":t("catch"),"for":t("for"),"switch":t("switch"),"case":t("case"),"default":t("default"),"in":r,"typeof":r,"instanceof":r,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":t("this"),module:t("module"),"class":t("class"),"super":t("atom"),"yield":i,"export":t("export"),"import":t("import"),"extends":i};if(be){var s={type:"variable",style:"variable-3"},l={"interface":t("interface"),"extends":t("extends"),constructor:t("constructor"),"public":t("public"),"private":t("private"),"protected":t("protected"),"static":t("static"),string:s,number:s,bool:s,any:s};for(var u in l)a[u]=l[u]}return a}(),ke=/[+\-*&%=<>!?|~^]/,Ce=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Se="([{}])",Te={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Me={state:null,column:null,marked:null,cc:null},Le={name:"this",next:{name:"arguments"}};return _.lex=!0,{startState:function(t){var e={tokenize:o,lastType:"sof",cc:[],lexical:new c((t||0)-me,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:0};return n.globalVars&&"object"==typeof n.globalVars&&(e.globalVars=n.globalVars),e},token:function(t,e){if(t.sol()&&(e.lexical.hasOwnProperty("align")||(e.lexical.align=!1),e.indented=t.indentation(),u(t,e)),e.tokenize!=s&&t.eatSpace())return null;var n=e.tokenize(t,e);return"comment"==pe?n:(e.lastType="operator"!=pe||"++"!=ge&&"--"!=ge?pe:"incdec",d(e,n,pe,ge,t))},indent:function(e,i){if(e.tokenize==s)return t.Pass;if(e.tokenize!=o)return 0;var r=i&&i.charAt(0),a=e.lexical;if(!/^\s*else\b/.test(i))for(var l=e.cc.length-1;l>=0;--l){var u=e.cc[l];if(u==_)a=a.prev;else if(u!=G)break}"stat"==a.type&&"}"==r&&(a=a.prev),ve&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c=a.type,h=r==c;return"vardef"==c?a.indented+("operator"==e.lastType||","==e.lastType?a.info+1:0):"form"==c&&"{"==r?a.indented:"form"==c?a.indented+me:"stat"==c?a.indented+("operator"==e.lastType||","==e.lastType?ve||me:0):"switch"!=a.info||h||0==n.doubleIndentSwitch?a.align?a.column+(h?0:1):a.indented+(h?0:me):a.indented+(/^(?:case|default)\b/.test(i)?me:2*me)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:_e?null:"/*",blockCommentEnd:_e?null:"*/",lineComment:_e?null:"//",fold:"brace",helperType:_e?"json":"javascript",jsonldMode:ye,jsonMode:_e}}),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";function e(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=!0;return e}function n(t,e){for(var n,i=!1;null!=(n=t.next());){if(i&&"/"==n){e.tokenize=null;break}i="*"==n}return["comment","comment"]}function i(t,e){return t.skipTo("-->")?(t.match("-->"),e.tokenize=null):t.skipToEnd(),["comment","comment"]}t.defineMode("css",function(e,n){function i(t,e){return f=e,t}function r(t,e){var n=t.next();if(m[n]){var r=m[n](t,e);if(r!==!1)return r}return"@"==n?(t.eatWhile(/[\w\\\-]/),i("def",t.current())):"="==n||("~"==n||"|"==n)&&t.eat("=")?i(null,"compare"):'"'==n||"'"==n?(e.tokenize=o(n),e.tokenize(t,e)):"#"==n?(t.eatWhile(/[\w\\\-]/),i("atom","hash")):"!"==n?(t.match(/^\s*\w*/),i("keyword","important")):/\d/.test(n)||"."==n&&t.eat(/\d/)?(t.eatWhile(/[\w.%]/),i("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?i(null,"select-op"):"."==n&&t.match(/^-?[_a-z][_a-z0-9-]*/i)?i("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?i(null,n):"u"==n&&t.match("rl(")?(t.backUp(1),e.tokenize=a,i("property","word")):/[\w\\\-]/.test(n)?(t.eatWhile(/[\w\\\-]/),i("property","word")):i(null,null):/[\d.]/.test(t.peek())?(t.eatWhile(/[\w.%]/),i("number","unit")):t.match(/^\w+-/)?i("meta","meta"):void 0}function o(t){return function(e,n){for(var r,o=!1;null!=(r=e.next());){if(r==t&&!o){")"==t&&e.backUp(1);break}o=!o&&"\\"==r}return(r==t||!o&&")"!=t)&&(n.tokenize=null),i("string","string")}}function a(t,e){return t.next(),e.tokenize=t.match(/\s*[\"\')]/,!1)?null:o(")"),i(null,"(")}function s(t,e,n){this.type=t,this.indent=e,this.prev=n}function l(t,e,n){return t.context=new s(n,e.indentation()+g,t.context),n}function u(t){return t.context=t.context.prev,t.context.type}function c(t,e,n){return S[n.context.type](t,e,n)}function h(t,e,n,i){for(var r=i||1;r>0;r--)n.context=n.context.prev;return c(t,e,n)}function d(t){var e=t.current().toLowerCase();p=w.hasOwnProperty(e)?"atom":x.hasOwnProperty(e)?"keyword":"variable"}n.propertyKeywords||(n=t.resolveMode("text/css"));var f,p,g=e.indentUnit,m=n.tokenHooks,v=n.mediaTypes||{},y=n.mediaFeatures||{},_=n.propertyKeywords||{},b=n.nonStandardPropertyKeywords||{},x=n.colorKeywords||{},w=n.valueKeywords||{},k=n.fontProperties||{},C=n.allowNested,S={};return S.top=function(t,e,n){if("{"==t)return l(n,e,"block");if("}"==t&&n.context.prev)return u(n);if("@media"==t)return l(n,e,"media");if("@font-face"==t)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(t))return"keyframes";if(t&&"@"==t.charAt(0))return l(n,e,"at");if("hash"==t)p="builtin";else if("word"==t)p="tag";else{if("variable-definition"==t)return"maybeprop";if("interpolation"==t)return l(n,e,"interpolation");if(":"==t)return"pseudo";if(C&&"("==t)return l(n,e,"parens")}return n.context.type},S.block=function(t,e,n){if("word"==t){var i=e.current().toLowerCase();return _.hasOwnProperty(i)?(p="property","maybeprop"):b.hasOwnProperty(i)?(p="string-2","maybeprop"):C?(p=e.match(/^\s*:/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==t?"block":C||"hash"!=t&&"qualifier"!=t?S.top(t,e,n):(p="error","block")},S.maybeprop=function(t,e,n){return":"==t?l(n,e,"prop"):c(t,e,n)},S.prop=function(t,e,n){if(";"==t)return u(n);if("{"==t&&C)return l(n,e,"propBlock");if("}"==t||"{"==t)return h(t,e,n);if("("==t)return l(n,e,"parens");if("hash"!=t||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e.current())){if("word"==t)d(e);else if("interpolation"==t)return l(n,e,"interpolation")}else p+=" error";return"prop"},S.propBlock=function(t,e,n){return"}"==t?u(n):"word"==t?(p="property","maybeprop"):n.context.type},S.parens=function(t,e,n){return"{"==t||"}"==t?h(t,e,n):")"==t?u(n):"("==t?l(n,e,"parens"):("word"==t&&d(e),"parens")},S.pseudo=function(t,e,n){return"word"==t?(p="variable-3",n.context.type):c(t,e,n)},S.media=function(t,e,n){if("("==t)return l(n,e,"media_parens");if("}"==t)return h(t,e,n);if("{"==t)return u(n)&&l(n,e,C?"block":"top");if("word"==t){var i=e.current().toLowerCase();p="only"==i||"not"==i||"and"==i?"keyword":v.hasOwnProperty(i)?"attribute":y.hasOwnProperty(i)?"property":"error"}return n.context.type},S.media_parens=function(t,e,n){return")"==t?u(n):"{"==t||"}"==t?h(t,e,n,2):S.media(t,e,n)},S.font_face_before=function(t,e,n){return"{"==t?l(n,e,"font_face"):c(t,e,n)},S.font_face=function(t,e,n){return"}"==t?u(n):"word"==t?(p=k.hasOwnProperty(e.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},S.keyframes=function(t,e,n){return"word"==t?(p="variable","keyframes"):"{"==t?l(n,e,"top"):c(t,e,n)},S.at=function(t,e,n){return";"==t?u(n):"{"==t||"}"==t?h(t,e,n):("word"==t?p="tag":"hash"==t&&(p="builtin"),"at")},S.interpolation=function(t,e,n){return"}"==t?u(n):"{"==t||";"==t?h(t,e,n):("variable"!=t&&(p="error"),"interpolation")},{startState:function(t){return{tokenize:null,state:"top",context:new s("top",t||0,null)}},token:function(t,e){if(!e.tokenize&&t.eatSpace())return null;var n=(e.tokenize||r)(t,e);return n&&"object"==typeof n&&(f=n[1],n=n[0]),p=n,e.state=S[e.state](f,t,e),p},indent:function(t,e){var n=t.context,i=e&&e.charAt(0),r=n.indent;return"prop"!=n.type||"}"!=i&&")"!=i||(n=n.prev),!n.prev||("}"!=i||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"font_face"!=n.type)&&(")"!=i||"parens"!=n.type&&"media_parens"!=n.type)&&("{"!=i||"at"!=n.type&&"media"!=n.type)||(r=n.indent-g,n=n.prev),r},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var r=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=e(r),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],s=e(a),l=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],u=e(l),c=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],h=e(c),d=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],f=e(d),p=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],g=e(p),m=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],v=e(m),y=r.concat(a).concat(l).concat(c).concat(d).concat(p);
|
||
t.registerHelper("hintWords","css",y),t.defineMIME("text/css",{mediaTypes:o,mediaFeatures:s,propertyKeywords:u,nonStandardPropertyKeywords:h,colorKeywords:f,valueKeywords:g,fontProperties:v,tokenHooks:{"<":function(t,e){return t.match("!--")?(e.tokenize=i,i(t,e)):!1},"/":function(t,e){return t.eat("*")?(e.tokenize=n,n(t,e)):!1}},name:"css"}),t.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:s,propertyKeywords:u,nonStandardPropertyKeywords:h,colorKeywords:f,valueKeywords:g,fontProperties:v,allowNested:!0,tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=n,n(t,e)):["operator","operator"]},":":function(t){return t.match(/\s*\{/)?[null,"{"]:!1},$:function(t){return t.match(/^[\w-]+/),t.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(t){return t.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),t.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:s,propertyKeywords:u,nonStandardPropertyKeywords:h,colorKeywords:f,valueKeywords:g,fontProperties:v,allowNested:!0,tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=n,n(t,e)):["operator","operator"]},"@":function(t){return t.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(t.eatWhile(/[\w\\\-]/),t.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("htmlmixed",function(e,n){function i(t,e){var n=e.htmlState.tagName;n&&(n=n.toLowerCase());var i=s.token(t,e.htmlState);if("script"==n&&/\btag\b/.test(i)&&">"==t.current()){var r=t.string.slice(Math.max(0,t.pos-100),t.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);r=r?r[1]:"",r&&/[\"\']/.test(r.charAt(0))&&(r=r.slice(1,r.length-1));for(var c=0;c<u.length;++c){var h=u[c];if("string"==typeof h.matches?r==h.matches:h.matches.test(r)){h.mode&&(e.token=o,e.localMode=h.mode,e.localState=h.mode.startState&&h.mode.startState(s.indent(e.htmlState,"")));break}}}else"style"==n&&/\btag\b/.test(i)&&">"==t.current()&&(e.token=a,e.localMode=l,e.localState=l.startState(s.indent(e.htmlState,"")));return i}function r(t,e,n){var i,r=t.current(),o=r.search(e);return o>-1?t.backUp(r.length-o):(i=r.match(/<\/?$/))&&(t.backUp(r.length),t.match(e,!1)||t.match(r)),n}function o(t,e){return t.match(/^<\/\s*script\s*>/i,!1)?(e.token=i,e.localState=e.localMode=null,i(t,e)):r(t,/<\/\s*script\s*>/,e.localMode.token(t,e.localState))}function a(t,e){return t.match(/^<\/\s*style\s*>/i,!1)?(e.token=i,e.localState=e.localMode=null,i(t,e)):r(t,/<\/\s*style\s*>/,l.token(t,e.localState))}var s=t.getMode(e,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),l=t.getMode(e,"css"),u=[],c=n&&n.scriptTypes;if(u.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:t.getMode(e,"javascript")}),c)for(var h=0;h<c.length;++h){var d=c[h];u.push({matches:d.matches,mode:d.mode&&t.getMode(e,d.mode)})}return u.push({matches:/./,mode:t.getMode(e,"text/plain")}),{startState:function(){var t=s.startState();return{token:i,localMode:null,localState:null,htmlState:t}},copyState:function(e){if(e.localState)var n=t.copyState(e.localMode,e.localState);return{token:e.token,localMode:e.localMode,localState:n,htmlState:t.copyState(s,e.htmlState)}},token:function(t,e){return e.token(t,e)},indent:function(e,n){return!e.localMode||/^\s*<\//.test(n)?s.indent(e.htmlState,n):e.localMode.indent?e.localMode.indent(e.localState,n):t.Pass},innerMode:function(t){return{state:t.localState||t.htmlState,mode:t.localMode||s}}}},"xml","javascript","css"),t.defineMIME("text/html","htmlmixed")}),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror",require("../xml/xml"))):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("markdown",function(e,n){function i(t,e,n){return e.f=e.inline=n,n(t,e)}function r(t,e,n){return e.f=e.block=n,n(t,e)}function o(t){return t.linkTitle=!1,t.em=!1,t.strong=!1,t.quote=0,_||t.f!=s||(t.f=h,t.block=a),t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.thisLineHasContent=!1,null}function a(t,e){var o=t.sol(),a=e.list!==!1;e.list!==!1&&e.indentationDiff>=0?(e.indentationDiff<4&&(e.indentation-=e.indentationDiff),e.list=null):e.list!==!1&&e.indentation>0?(e.list=null,e.listDepth=Math.floor(e.indentation/4)):e.list!==!1&&(e.list=!1,e.listDepth=0);var s=null;if(e.indentationDiff>=4)return e.indentation-=4,t.skipToEnd(),S;if(t.eatSpace())return null;if(s=t.match(j))return e.header=s[0].length<=6?s[0].length:6,n.highlightFormatting&&(e.formatting="header"),e.f=e.inline,u(e);if(e.prevLineHasContent&&(s=t.match(U)))return e.header="="==s[0].charAt(0)?1:2,n.highlightFormatting&&(e.formatting="header"),e.f=e.inline,u(e);if(t.eat(">"))return e.indentation++,e.quote=o?1:e.quote+1,n.highlightFormatting&&(e.formatting="quote"),t.eatSpace(),u(e);if("["===t.peek())return i(t,e,g);if(t.match(H,!0))return N;if((!e.prevLineHasContent||a)&&(t.match(V,!1)||t.match(z,!1))){var c=null;return t.match(V,!0)?c="ul":(t.match(z,!0),c="ol"),e.indentation+=4,e.list=!0,e.listDepth++,n.taskLists&&t.match(F,!1)&&(e.taskList=!0),e.f=e.inline,n.highlightFormatting&&(e.formatting=["list","list-"+c]),u(e)}return n.fencedCodeBlocks&&t.match(/^```([\w+#]*)/,!0)?(e.localMode=w(RegExp.$1),e.localMode&&(e.localState=e.localMode.startState()),r(t,e,l),n.highlightFormatting&&(e.formatting="code-block"),e.code=!0,u(e)):i(t,e,e.inline)}function s(t,e){var n=b.token(t,e.htmlState);return(_&&null===e.htmlState.tagStart&&!e.htmlState.context||e.md_inside&&t.current().indexOf(">")>-1)&&(e.f=h,e.block=a,e.htmlState=null),n}function l(t,e){if(t.sol()&&t.match(/^```/,!0)){e.localMode=e.localState=null,e.f=h,e.block=a,n.highlightFormatting&&(e.formatting="code-block"),e.code=!0;var i=u(e);return e.code=!1,i}return e.localMode?e.localMode.token(t,e.localState):(t.skipToEnd(),S)}function u(t){var e=[];if(t.formatting){e.push(A),"string"==typeof t.formatting&&(t.formatting=[t.formatting]);for(var i=0;i<t.formatting.length;i++)e.push(A+"-"+t.formatting[i]),"header"===t.formatting[i]&&e.push(A+"-"+t.formatting[i]+"-"+t.header),"quote"===t.formatting[i]&&e.push(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=t.quote?A+"-"+t.formatting[i]+"-"+t.quote:"error")}if(t.taskOpen)return e.push("meta"),e.length?e.join(" "):null;if(t.taskClosed)return e.push("property"),e.length?e.join(" "):null;if(t.linkHref)return e.push(B),e.length?e.join(" "):null;if(t.strong&&e.push(W),t.em&&e.push(R),t.linkText&&e.push(I),t.code&&e.push(S),t.header&&(e.push(C),e.push(C+"-"+t.header)),t.quote&&(e.push(T),e.push(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=t.quote?T+"-"+t.quote:T+"-"+n.maxBlockquoteDepth)),t.list!==!1){var r=(t.listDepth-1)%3;e.push(r?1===r?L:E:M)}return t.trailingSpaceNewLine?e.push("trailing-space-new-line"):t.trailingSpace&&e.push("trailing-space-"+(t.trailingSpace%2?"a":"b")),e.length?e.join(" "):null}function c(t,e){return t.match(K,!0)?u(e):void 0}function h(e,i){var o=i.text(e,i);if("undefined"!=typeof o)return o;if(i.list)return i.list=null,u(i);if(i.taskList){var a="x"!==e.match(F,!0)[1];return a?i.taskOpen=!0:i.taskClosed=!0,n.highlightFormatting&&(i.formatting="task"),i.taskList=!1,u(i)}if(i.taskOpen=!1,i.taskClosed=!1,i.header&&e.match(/^#+$/,!0))return n.highlightFormatting&&(i.formatting="header"),u(i);var l=e.sol(),c=e.next();if("\\"===c&&(e.next(),n.highlightFormatting)){var h=u(i);return h?h+" formatting-escape":"formatting-escape"}if(i.linkTitle){i.linkTitle=!1;var p=c;"("===c&&(p=")"),p=(p+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var g="^\\s*(?:[^"+p+"\\\\]+|\\\\\\\\|\\\\.)"+p;if(e.match(new RegExp(g),!0))return B}if("`"===c){var m=i.formatting;n.highlightFormatting&&(i.formatting="code");var v=u(i),y=e.pos;e.eatWhile("`");var _=1+e.pos-y;return i.code?_===k?(i.code=!1,v):(i.formatting=m,u(i)):(k=_,i.code=!0,u(i))}if(i.code)return u(i);if("!"===c&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return e.match(/\[[^\]]*\]/),i.inline=i.f=f,P;if("["===c&&e.match(/.*\](\(| ?\[)/,!1))return i.linkText=!0,n.highlightFormatting&&(i.formatting="link"),u(i);if("]"===c&&i.linkText){n.highlightFormatting&&(i.formatting="link");var h=u(i);return i.linkText=!1,i.inline=i.f=f,h}if("<"===c&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){i.f=i.inline=d,n.highlightFormatting&&(i.formatting="link");var h=u(i);return h?h+=" ":h="",h+O}if("<"===c&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){i.f=i.inline=d,n.highlightFormatting&&(i.formatting="link");var h=u(i);return h?h+=" ":h="",h+D}if("<"===c&&e.match(/^\w/,!1)){if(-1!=e.string.indexOf(">")){var x=e.string.substring(1,e.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(i.md_inside=!0)}return e.backUp(1),i.htmlState=t.startState(b),r(e,i,s)}if("<"===c&&e.match(/^\/\w*?>/))return i.md_inside=!1,"tag";var w=!1;if(!n.underscoresBreakWords&&"_"===c&&"_"!==e.peek()&&e.match(/(\w)/,!1)){var C=e.pos-2;if(C>=0){var S=e.string.charAt(C);"_"!==S&&S.match(/(\w)/,!1)&&(w=!0)}}if("*"===c||"_"===c&&!w)if(l&&" "===e.peek());else{if(i.strong===c&&e.eat(c)){n.highlightFormatting&&(i.formatting="strong");var v=u(i);return i.strong=!1,v}if(!i.strong&&e.eat(c))return i.strong=c,n.highlightFormatting&&(i.formatting="strong"),u(i);if(i.em===c){n.highlightFormatting&&(i.formatting="em");var v=u(i);return i.em=!1,v}if(!i.em)return i.em=c,n.highlightFormatting&&(i.formatting="em"),u(i)}else if(" "===c&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return u(i);e.backUp(1)}return" "===c&&(e.match(/ +$/,!1)?i.trailingSpace++:i.trailingSpace&&(i.trailingSpaceNewLine=!0)),u(i)}function d(t,e){var i=t.next();if(">"===i){e.f=e.inline=h,n.highlightFormatting&&(e.formatting="link");var r=u(e);return r?r+=" ":r="",r+O}return t.match(/^[^>]+/,!0),O}function f(t,e){if(t.eatSpace())return null;var i=t.next();return"("===i||"["===i?(e.f=e.inline=p("("===i?")":"]"),n.highlightFormatting&&(e.formatting="link-string"),e.linkHref=!0,u(e)):"error"}function p(t){return function(e,i){var r=e.next();if(r===t){i.f=i.inline=h,n.highlightFormatting&&(i.formatting="link-string");var o=u(i);return i.linkHref=!1,o}return e.match(y(t),!0)&&e.backUp(1),i.linkHref=!0,u(i)}}function g(t,e){return t.match(/^[^\]]*\]:/,!1)?(e.f=m,t.next(),n.highlightFormatting&&(e.formatting="link"),e.linkText=!0,u(e)):i(t,e,h)}function m(t,e){if(t.match(/^\]:/,!0)){e.f=e.inline=v,n.highlightFormatting&&(e.formatting="link");var i=u(e);return e.linkText=!1,i}return t.match(/^[^\]]+/,!0),I}function v(t,e){return t.eatSpace()?null:(t.match(/^[^\s]+/,!0),void 0===t.peek()?e.linkTitle=!0:t.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),e.f=e.inline=h,B)}function y(t){return q[t]||(t=(t+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),q[t]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+t+")")),q[t]}var _=t.modes.hasOwnProperty("xml"),b=t.getMode(e,_?{name:"xml",htmlMode:!0}:"text/plain"),x={html:"htmlmixed",js:"javascript",json:"application/json",c:"text/x-csrc","c++":"text/x-c++src",java:"text/x-java",csharp:"text/x-csharp","c#":"text/x-csharp",scala:"text/x-scala"},w=function(){var n,i,r={},o={},a=[];for(var s in t.modes)t.modes.propertyIsEnumerable(s)&&a.push(s);for(n=0;n<a.length;n++)r[a[n]]=a[n];var l=[];for(var s in t.mimeModes)t.mimeModes.propertyIsEnumerable(s)&&l.push({mime:s,mode:t.mimeModes[s]});for(n=0;n<l.length;n++)i=l[n].mime,o[i]=l[n].mime;for(var u in x)(x[u]in r||x[u]in o)&&(r[u]=x[u]);return function(n){return r[n]?t.getMode(e,r[n]):null}}();void 0===n.highlightFormatting&&(n.highlightFormatting=!1),void 0===n.maxBlockquoteDepth&&(n.maxBlockquoteDepth=0),void 0===n.underscoresBreakWords&&(n.underscoresBreakWords=!0),void 0===n.fencedCodeBlocks&&(n.fencedCodeBlocks=!1),void 0===n.taskLists&&(n.taskLists=!1);var k=0,C="header",S="comment",T="quote",M="variable-2",L="variable-3",E="keyword",N="hr",P="tag",A="formatting",O="link",D="link",I="link",B="string",R="em",W="strong",H=/^([*\-=_])(?:\s*\1){2,}\s*$/,V=/^[*\-+]\s+/,z=/^[0-9]+\.\s+/,F=/^\[(x| )\](?=\s)/,j=/^#+/,U=/^(?:\={1,}|-{1,})$/,K=/^[^#!\[\]*_\\<>` "'(]+/,q=[],$={startState:function(){return{f:a,prevLineHasContent:!1,thisLineHasContent:!1,block:a,htmlState:null,indentation:0,inline:h,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1}},copyState:function(e){return{f:e.f,prevLineHasContent:e.prevLineHasContent,thisLineHasContent:e.thisLineHasContent,block:e.block,htmlState:e.htmlState&&t.copyState(b,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?t.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkTitle:e.linkTitle,em:e.em,strong:e.strong,header:e.header,taskList:e.taskList,list:e.list,listDepth:e.listDepth,quote:e.quote,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside}},token:function(t,e){if(e.formatting=!1,t.sol()){var n=!!e.header;if(e.header=0,t.match(/^\s*$/,!0)||n)return e.prevLineHasContent=!1,o(e),n?this.token(t,e):null;e.prevLineHasContent=e.thisLineHasContent,e.thisLineHasContent=!0,e.taskList=!1,e.code=!1,e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.f=e.block;var i=t.match(/^\s*/,!0)[0].replace(/\t/g," ").length,r=4*Math.floor((i-e.indentation)/4);r>4&&(r=4);var a=e.indentation+r;if(e.indentationDiff=a-e.indentation,e.indentation=a,i>0)return null}var s=e.f(t,e);return t.start==t.pos?this.token(t,e):s},innerMode:function(t){return t.block==s?{state:t.htmlState,mode:b}:t.localState?{state:t.localState,mode:t.localMode}:{state:t,mode:$}},blankLine:o,getType:u,fold:"markdown"};return $},"xml"),t.defineMIME("text/x-markdown","markdown")}),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";t.overlayMode=function(e,n,i){return{startState:function(){return{base:t.startState(e),overlay:t.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,lineSeen:null}},copyState:function(i){return{base:t.copyState(e,i.base),overlay:t.copyState(n,i.overlay),basePos:i.basePos,baseCur:null,overlayPos:i.overlayPos,overlayCur:null}},token:function(t,r){return(t.sol()||t.string!=r.lineSeen||Math.min(r.basePos,r.overlayPos)<t.start)&&(r.lineSeen=t.string,r.basePos=r.overlayPos=t.start),t.start==r.basePos&&(r.baseCur=e.token(t,r.base),r.basePos=t.pos),t.start==r.overlayPos&&(t.pos=t.start,r.overlayCur=n.token(t,r.overlay),r.overlayPos=t.pos),t.pos=Math.min(r.basePos,r.overlayPos),null==r.overlayCur?r.baseCur:null!=r.baseCur&&r.overlay.combineTokens||i&&null==r.overlay.combineTokens?r.baseCur+" "+r.overlayCur:r.overlayCur},indent:e.indent&&function(t,n){return e.indent(t.base,n)},electricChars:e.electricChars,innerMode:function(t){return{state:t.base,mode:e}},blankLine:function(t){e.blankLine&&e.blankLine(t.base),n.blankLine&&n.blankLine(t.overlay)}}}}),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("gfm",function(e,n){function i(t){return t.code=!1,null}var r=0,o={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(t){return{code:t.code,codeBlock:t.codeBlock,ateSpace:t.ateSpace}},token:function(t,e){if(e.combineTokens=null,e.codeBlock)return t.match(/^```/)?(e.codeBlock=!1,null):(t.skipToEnd(),null);if(t.sol()&&(e.code=!1),t.sol()&&t.match(/^```/))return t.skipToEnd(),e.codeBlock=!0,null;if("`"===t.peek()){t.next();var n=t.pos;t.eatWhile("`");var i=1+t.pos-n;return e.code?i===r&&(e.code=!1):(r=i,e.code=!0),null}if(e.code)return t.next(),null;if(t.eatSpace())return e.ateSpace=!0,null;if(t.sol()||e.ateSpace){if(e.ateSpace=!1,t.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return e.combineTokens=!0,"link";if(t.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return e.combineTokens=!0,"link"}return t.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=t.string.slice(t.start-2,t.start)?(e.combineTokens=!0,"link"):(t.next(),null)},blankLine:i},a={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:!0};for(var s in n)a[s]=n[s];return a.name="markdown",t.defineMIME("gfmBase",a),t.overlayMode(t.getMode(e,"gfmBase"),o)},"markdown")}),function(){function use(t){_p.r([moduleMapping[t]])}var _p={r:function(t){if(_p[t].inited)return _p[t].value;if("function"!=typeof _p[t].value)return _p[t].inited=!0,_p[t].value;var e={exports:{}},n=_p[t].value(null,e.exports,e);if(_p[t].inited=!0,_p[t].value=n,void 0!==n)return n;for(var i in e.exports)if(e.exports.hasOwnProperty(i))return _p[t].inited=!0,_p[t].value=e.exports,e.exports}};_p[0]={value:function(){function t(t){var e=parseFloat(t,10);return/ms/.test(t)?e:/s/.test(t)?1e3*e:/min/.test(t)?60*e*1e3:e}var e=_p.r(8),n=_p.r(1),i=_p.r(11).createClass("Animator",{constructor:function(t,e,n){if(1==arguments.length){var i=arguments[0];this.beginValue=i.beginValue,this.finishValue=i.finishValue,this.setter=i.setter}else this.beginValue=t,this.finishValue=e,this.setter=n},start:function(e,n,i,r,o){2===arguments.length&&"object"==typeof n&&(i=n.easing,r=n.delay,o=n.callback,n=n.duration),4===arguments.length&&"function"==typeof r&&(o=r,r=0);var a=this.create(e,n,i,o);return r=t(r),r>0?setTimeout(function(){a.play()},r):a.play(),a},create:function(r,o,a,s){var l;return o=o&&t(o)||i.DEFAULT_DURATION,a=a||i.DEFAULT_EASING,"string"==typeof a&&(a=n[a]),l=new e(this,r,o,a),"function"==typeof s&&l.on("finish",s),l},reverse:function(){return new i(this.finishValue,this.beginValue,this.setter)}});i.DEFAULT_DURATION=300,i.DEFAULT_EASING="linear";var r=_p.r(60);return _p.r(11).extendClass(r,{animate:function(t,e,n,i,r){function o(){a.shift(),a.length&&setTimeout(a[0].t.play.bind(a[0].t),a[0].d)}var a=this._KityAnimateQueue=this._KityAnimateQueue||[],s=t.create(this,e,n,r);return s.on("finish",o),a.push({t:s,d:i}),1==a.length&&setTimeout(s.play.bind(s),i),this},timeline:function(){return this._KityAnimateQueue[0].t},stop:function(){var t=this._KityAnimateQueue;if(t)for(;t.length;)t.shift().t.stop();return this}}),i}},_p[1]={value:function(){var t={linear:function(t,e,n,i){return n*(t/i)+e},swing:function(e,n,i,r){return t.easeOutQuad(e,n,i,r)},ease:function(e,n,i,r){return t.easeInOutCubic(e,n,i,r)},easeInQuad:function(t,e,n,i){return n*(t/=i)*t+e},easeOutQuad:function(t,e,n,i){return-n*(t/=i)*(t-2)+e},easeInOutQuad:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,n,i){return n*(t/=i)*t*t+e},easeOutCubic:function(t,e,n,i){return n*((t=t/i-1)*t*t+1)+e},easeInOutCubic:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t*t+e:n/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,n,i){return n*(t/=i)*t*t*t+e},easeOutQuart:function(t,e,n,i){return-n*((t=t/i-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t*t*t+e:-n/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,n,i){return n*(t/=i)*t*t*t*t+e},easeOutQuint:function(t,e,n,i){return n*((t=t/i-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,n,i){return-n*Math.cos(t/i*(Math.PI/2))+n+e},easeOutSine:function(t,e,n,i){return n*Math.sin(t/i*(Math.PI/2))+e},easeInOutSine:function(t,e,n,i){return-n/2*(Math.cos(Math.PI*t/i)-1)+e},easeInExpo:function(t,e,n,i){return 0===t?e:n*Math.pow(2,10*(t/i-1))+e},easeOutExpo:function(t,e,n,i){return t==i?e+n:n*(-Math.pow(2,-10*t/i)+1)+e},easeInOutExpo:function(t,e,n,i){return 0===t?e:t==i?e+n:(t/=i/2)<1?n/2*Math.pow(2,10*(t-1))+e:n/2*(-Math.pow(2,-10*--t)+2)+e},easeInCirc:function(t,e,n,i){return-n*(Math.sqrt(1-(t/=i)*t)-1)+e},easeOutCirc:function(t,e,n,i){return n*Math.sqrt(1-(t=t/i-1)*t)+e},easeInOutCirc:function(t,e,n,i){return(t/=i/2)<1?-n/2*(Math.sqrt(1-t*t)-1)+e:n/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(t,e,n,i){var r=1.70158,o=0,a=n;return 0===t?e:1==(t/=i)?e+n:(o||(o=.3*i),a<Math.abs(n)?(a=n,r=o/4):r=o/(2*Math.PI)*Math.asin(n/a),-(a*Math.pow(2,10*(t-=1))*Math.sin(2*(t*i-r)*Math.PI/o))+e)},easeOutElastic:function(t,e,n,i){var r=1.70158,o=0,a=n;return 0===t?e:1==(t/=i)?e+n:(o||(o=.3*i),a<Math.abs(n)?(a=n,r=o/4):r=o/(2*Math.PI)*Math.asin(n/a),a*Math.pow(2,-10*t)*Math.sin(2*(t*i-r)*Math.PI/o)+n+e)},easeInOutElastic:function(t,e,n,i){var r=1.70158,o=0,a=n;if(0===t)return e;if(2==(t/=i/2))return e+n;if(o||(o=.3*i*1.5),a<Math.abs(n)){a=n;var r=o/4}else var r=o/(2*Math.PI)*Math.asin(n/a);return 1>t?-.5*a*Math.pow(2,10*(t-=1))*Math.sin(2*(t*i-r)*Math.PI/o)+e:a*Math.pow(2,-10*(t-=1))*Math.sin(2*(t*i-r)*Math.PI/o)*.5+n+e},easeInBack:function(t,e,n,i,r){return void 0==r&&(r=1.70158),n*(t/=i)*t*((r+1)*t-r)+e},easeOutBack:function(t,e,n,i,r){return void 0==r&&(r=1.70158),n*((t=t/i-1)*t*((r+1)*t+r)+1)+e},easeInOutBack:function(t,e,n,i,r){return void 0==r&&(r=1.70158),(t/=i/2)<1?n/2*t*t*(((r*=1.525)+1)*t-r)+e:n/2*((t-=2)*t*(((r*=1.525)+1)*t+r)+2)+e},easeInBounce:function(e,n,i,r){return i-t.easeOutBounce(r-e,0,i,r)+n},easeOutBounce:function(t,e,n,i){return(t/=i)<1/2.75?7.5625*n*t*t+e:2/2.75>t?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:2.5/2.75>t?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e},easeInOutBounce:function(e,n,i,r){return r/2>e?.5*t.easeInBounce(2*e,0,i,r)+n:.5*t.easeOutBounce(2*e-r,0,i,r)+.5*i+n}};return t}},_p[2]={value:function(t,e){function n(t){1===h.push(t)&&(l=u(i))}function i(){var t=h;for(h=[];t.length;)s(t.pop());l=0}function r(t){var e=a(t);return n(e),e}function o(t){var e=h.indexOf(t);~e&&h.splice(e,1),0===h.length&&c(l)}function a(t){var e={index:0,time:+new Date,elapsed:0,action:t,next:function(){n(e)}};return e}function s(t){var e=+new Date,n=e-t.time;n>200&&(n=1e3/60),t.dur=n,t.elapsed+=n,t.time=e,t.action.call(null,t),t.index++}var l,u=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,1e3/60)},c=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout,h=[];e.requestFrame=r,e.releaseFrame=o}},_p[3]={value:function(){var t=_p.r(0),e=_p.r(34),n=_p.r(46),i=_p.r(60),r=_p.r(11).createClass("MotionAnimator",{base:t,constructor:function(t,i){var r=this;this.callBase({beginValue:0,finishValue:1,setter:function(t,i){var o=r.motionPath instanceof n?r.motionPath.getPathData():r.motionPath,a=e.pointAtPath(o,i);t.setTranslate(a.x,a.y),this.doRotate&&t.setRotate(a.tan.getAngle())}}),this.doRotate=i,this.motionPath=t}});return _p.r(11).extendClass(i,{motion:function(t,e,n,i,o){return this.animate(new r(t),e,n,i,o)}}),r}},_p[4]={value:function(){var t=_p.r(0),e=_p.r(11).createClass("OpacityAnimator",{base:t,constructor:function(t){this.callBase({beginValue:function(t){return t.getOpacity()},finishValue:t,setter:function(t,e){t.setOpacity(e)}})}}),n=_p.r(60);return _p.r(11).extendClass(n,{fxOpacity:function(t,n,i,r,o){return this.animate(new e(t),n,i,r,o)},fadeTo:function(){return this.fxOpacity.apply(this,arguments)},fadeIn:function(){return this.fxOpacity.apply(this,[1].concat([].slice.call(arguments)))},fadeOut:function(){return this.fxOpacity.apply(this,[0].concat([].slice.call(arguments)))}}),e}},_p[5]={value:function(){var t=_p.r(0),e=_p.r(34),n=_p.r(11).createClass("OpacityAnimator",{base:t,constructor:function(t){this.callBase({beginValue:function(t){return this.beginPath=t.getPathData(),0},finishValue:1,setter:function(n,i){n.setPathData(e.pathTween(this.beginPath,t,i))}})}}),i=_p.r(46);return _p.r(11).extendClass(i,{fxPath:function(t,e,i,r,o){return this.animate(new n(t),e,i,r,o)}}),n}},_p[6]={value:function(){var t=_p.r(0),e=_p.r(11).createClass("RotateAnimator",{base:t,constructor:function(t){this.callBase({beginValue:0,finishValue:t,setter:function(t,e,n){var i=n.getDelta();t.rotate(i,ax,ay)}})}}),n=_p.r(60);return _p.r(11).extendClass(n,{fxRotate:function(t,n,i,r,o){return this.animate(new e(t),n,i,r,o)}}),e}},_p[7]={value:function(){var t=_p.r(0),e=_p.r(11).createClass("ScaleAnimator",{base:t,constructor:function(t,e){this.callBase({beginValue:0,finishValue:1,setter:function(n,i,r){var o=r.getDelta(),a=Math.pow(t,o),s=Math.pow(e,o);n.scale(s,a)}})}}),n=_p.r(60);return _p.r(11).extendClass(n,{fxScale:function(t,n,i,r,o,a){return this.animate(new e(t,n),i,r,o,a)}}),e}},_p[8]={value:function(){function t(t,e,n){return r.paralle(t,e,function(t,e){return t+(e-t)*n})}function e(t,e){return r.paralle(t,e,function(t,e){return e-t})}function n(t,e,n){this.timeline=t,this.target=t.target,this.type=e;for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i])}var i=_p.r(33),r=_p.r(12),o=_p.r(2),a=_p.r(11).createClass("Timeline",{mixins:[i],constructor:function(t,e,n,i){this.callMixin(),this.target=e,this.time=0,this.duration=n,this.easing=i,this.animator=t,this.beginValue=t.beginValue,this.finishValue=t.finishValue,this.setter=t.setter,this.status="ready"},nextFrame:function(t){"playing"==this.status&&(this.time+=t.dur,this.setValue(this.getValue()),this.time>=this.duration&&this.timeUp(),t.next())},getPlayTime:function(){return this.rollbacking?this.duration-this.time:this.time},getTimeProportion:function(){return this.getPlayTime()/this.duration},getValueProportion:function(){return this.easing(this.getPlayTime(),0,1,this.duration)},getValue:function(){var e=this.beginValue,n=this.finishValue,i=this.getValueProportion();return t(e,n,i)},setValue:function(t){this.lastValue=this.currentValue,this.currentValue=t,this.setter.call(this.target,this.target,t,this)},getDelta:function(){return this.lastValue=void 0===this.lastValue?this.beginValue:this.lastValue,e(this.lastValue,this.currentValue)},play:function(){var t=this.status;switch(this.status="playing",t){case"ready":r.isFunction(this.beginValue)&&(this.beginValue=this.beginValue.call(this.target,this.target)),r.isFunction(this.finishValue)&&(this.finishValue=this.finishValue.call(this.target,this.target)),this.time=0,this.setValue(this.beginValue),this.frame=o.requestFrame(this.nextFrame.bind(this));break;case"finished":case"stoped":this.time=0,this.frame=o.requestFrame(this.nextFrame.bind(this));break;case"paused":this.frame.next()}return this.fire("play",new n(this,"play",{lastStatus:t})),this},pause:function(){return this.status="paused",this.fire("pause",new n(this,"pause")),o.releaseFrame(this.frame),this},stop:function(){return this.status="stoped",this.setValue(this.finishValue),this.rollbacking=!1,this.fire("stop",new n(this,"stop")),o.releaseFrame(this.frame),this},timeUp:function(){this.repeatOption?(this.time=0,this.rollback?this.rollbacking?(this.decreaseRepeat(),this.rollbacking=!1):(this.rollbacking=!0,this.fire("rollback",new n(this,"rollback"))):this.decreaseRepeat(),this.repeatOption?this.fire("repeat",new n(this,"repeat")):this.finish()):this.finish()},finish:function(){this.setValue(this.finishValue),this.status="finished",this.fire("finish",new n(this,"finish")),o.releaseFrame(this.frame)},decreaseRepeat:function(){this.repeatOption!==!0&&this.repeatOption--},repeat:function(t,e){return this.repeatOption=t,this.rollback=e,this}});return a.requestFrame=o.requestFrame,a.releaseFrame=o.releaseFrame,a}},_p[9]={value:function(){var t=_p.r(0),e=_p.r(11).createClass("TranslateAnimator",{base:t,constructor:function(t,e){this.callBase({x:0,y:0},{x:t,y:e},function(t,e,n){var i=n.getDelta();t.translate(i.x,i.y)})}}),n=_p.r(60);return _p.r(11).extendClass(n,{fxTranslate:function(t,n,i,r,o,a){return this.animate(new e(t,n),i,r,o,a)}}),e}},_p[10]={value:function(){var t=function(){var t,e=navigator.userAgent.toLowerCase(),n=window.opera;t={ie:/(msie\s|trident.*rv:)([\w.]+)/.test(e),opera:!!n&&n.version,webkit:e.indexOf(" applewebkit/")>-1,mac:e.indexOf("macintosh")>-1},t.gecko="Gecko"==navigator.product&&!t.webkit&&!t.opera&&!t.ie;var i=0;if(t.ie&&(i=1*(e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2]||0),t.ie11Compat=11==document.documentMode,t.ie9Compat=9==document.documentMode),t.gecko){var r=e.match(/rv:([\d\.]+)/);r&&(r=r[1].split("."),i=1e4*r[0]+100*(r[1]||0)+1*(r[2]||0))}return/chrome\/(\d+\.\d)/i.test(e)&&(t.chrome=+RegExp.$1),/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome/i.test(e)&&(t.safari=+(RegExp.$1||RegExp.$2)),t.opera&&(i=parseFloat(n.version())),t.webkit&&(i=parseFloat(e.match(/ applewebkit\/(\d+)/)[1])),t.version=i,t.isCompatible=!t.mobile&&(t.ie&&i>=6||t.gecko&&i>=10801||t.opera&&i>=9.5||t.air&&i>=1||t.webkit&&i>=522||!1),t}();return t}},_p[11]={value:function(require,exports){function Class(){}function checkBaseConstructorCall(t,e){var n=t.toString();if(!/this\.callBase/.test(n))throw new Error(e+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function inherit(constructor,BaseClass,classname){var KityClass=eval("(function "+classname+"( __inherit__flag ) {if( __inherit__flag != KITY_INHERIT_FLAG ) {KityClass.__KityConstructor.apply(this, arguments);}this.__KityClassName = KityClass.__KityClassName;})");KityClass.__KityConstructor=constructor,KityClass.prototype=new BaseClass(KITY_INHERIT_FLAG);for(var methodName in BaseClass.prototype)BaseClass.prototype.hasOwnProperty(methodName)&&0!==methodName.indexOf("__Kity")&&(KityClass.prototype[methodName]=BaseClass.prototype[methodName]);return KityClass.prototype.constructor=KityClass,KityClass}function mixin(t,e){if(!1==e instanceof Array)return t;var n,i,r,o=e.length;for(t.__KityMixins={constructor:[]},n=0;o>n;n++){i=e[n].prototype;for(r in i)!1!==i.hasOwnProperty(r)&&0!==r.indexOf("__Kity")&&("constructor"===r?t.__KityMixins.constructor.push(i[r]):t.prototype[r]=t.__KityMixins[r]=i[r])}return t}function extend(t,e){e.__KityClassName&&(e=e.prototype);for(var n in e)if(e.hasOwnProperty(n)&&n.indexOf("__Kity")&&"constructor"!=n){var i=t.prototype[n]=e[n];i.__KityMethodClass=t,i.__KityMethodName=n}return t}exports.Class=Class,Class.__KityClassName="Class",Class.prototype.base=function(t){var e=arguments.callee.caller,n=e.__KityMethodClass.__KityBaseClass.prototype[t];return n.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callBase=function(){var t=arguments.callee.caller,e=t.__KityMethodClass.__KityBaseClass.prototype[t.__KityMethodName];return e.apply(this,arguments)},Class.prototype.mixin=function(t){var e=arguments.callee.caller,n=e.__KityMethodClass.__KityMixins;if(!n)return this;var i=n[t];return i.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callMixin=function(){var t=arguments.callee.caller,e=t.__KityMethodName,n=t.__KityMethodClass.__KityMixins;if(!n)return this;var i=n[e];if("constructor"==e){for(var r=0,o=i.length;o>r;r++)i[r].call(this);return this}return i.apply(this,arguments)},Class.prototype.pipe=function(t){return"function"==typeof t&&t.call(this,this),this},Class.prototype.getType=function(){return this.__KityClassName},Class.prototype.getClass=function(){return this.constructor};var KITY_INHERIT_FLAG="__KITY_INHERIT_FLAG_"+ +new Date;exports.createClass=function(t,e){var n,i,r;return 1===arguments.length&&(e=arguments[0],t="AnonymousClass"),r=e.base||Class,e.hasOwnProperty("constructor")?(n=e.constructor,r!=Class&&checkBaseConstructorCall(n,t)):n=function(){this.callBase.apply(this,arguments),this.callMixin.apply(this,arguments)
|
||
},i=inherit(n,r,t),i=mixin(i,e.mixins),i.__KityClassName=n.__KityClassName=t,i.__KityBaseClass=n.__KityBaseClass=r,i.__KityMethodName=n.__KityMethodName="constructor",i.__KityMethodClass=n.__KityMethodClass=i,delete e.mixins,delete e.constructor,delete e.base,i=extend(i,e)},exports.extendClass=extend}},_p[12]={value:function(){var t={each:function(t,e,n){if(null!==t)if(t.length===+t.length){for(var i=0,r=t.length;r>i;i++)if(e.call(n,t[i],i,t)===!1)return!1}else for(var o in t)if(t.hasOwnProperty(o)&&e.call(n,t[o],o,t)===!1)return!1},extend:function(t){for(var e=arguments,n=this.isBoolean(e[e.length-1])?e[e.length-1]:!1,i=this.isBoolean(e[e.length-1])?e.length-1:e.length,r=1;i>r;r++){var o=e[r];for(var a in o)n&&t.hasOwnProperty(a)||(t[a]=o[a])}return t},deepExtend:function(t){for(var e=arguments,n=this.isBoolean(e[e.length-1])?e[e.length-1]:!1,i=this.isBoolean(e[e.length-1])?e.length-1:e.length,r=1;i>r;r++){var o=e[r];for(var a in o)n&&t.hasOwnProperty(a)||(this.isObject(t[a])&&this.isObject(o[a])?this.deepExtend(t[a],o[a],n):t[a]=o[a])}return t},clone:function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},copy:function(t){return"object"!=typeof t?t:"function"==typeof t?null:JSON.parse(JSON.stringify(t))},queryPath:function(t,e){for(var n=t.split("."),i=0,r=e,o=n.length;o>i;){if(!(n[i]in r))return void 0;if(r=r[n[i]],i++,i>=o||void 0===r)return r}},getValue:function(t,e){return void 0!==t?t:e},flatten:function(e){var n,i=[],r=e.length;for(n=0;r>n;n++)e[n]instanceof Array?i=i.concat(t.flatten(e[n])):i.push(e[n]);return i},paralle:function(e,n,i){var r,o,a,s;if(e instanceof Array){for(s=[],o=0;o<e.length;o++)s.push(t.paralle(e[o],n[o],i));return s}if(e instanceof Object){if(r=e.getClass&&e.getClass(),r&&r.parse)e=e.valueOf(),n=n.valueOf(),s=t.paralle(e,n,i),s=r.parse(s);else{s={};for(a in e)e.hasOwnProperty(a)&&n.hasOwnProperty(a)&&(s[a]=t.paralle(e[a],n[a],i))}return s}return!1===isNaN(parseFloat(e))?i(e,n):s},parallelize:function(e){return function(n,i){return t.paralle(n,i,e)}}};return t.each(["String","Function","Array","Number","RegExp","Object","Boolean"],function(e){t["is"+e]=function(t){return Object.prototype.toString.apply(t)=="[object "+e+"]"}}),t}},_p[13]={value:function(){var t=_p.r(16),e=_p.r(12),n=_p.r(11).createClass("ColorMatrixEffect",{base:t,constructor:function(i,r){this.callBase(t.NAME_COLOR_MATRIX),this.set("type",e.getValue(i,n.TYPE_MATRIX)),this.set("in",e.getValue(r,t.INPUT_SOURCE_GRAPHIC))}});return e.extend(n,{TYPE_MATRIX:"matrix",TYPE_SATURATE:"saturate",TYPE_HUE_ROTATE:"hueRotate",TYPE_LUMINANCE_TO_ALPHA:"luminanceToAlpha",MATRIX_ORIGINAL:"10000010000010000010".split("").join(" "),MATRIX_EMPTY:"00000000000000000000".split("").join(" ")}),n}},_p[14]={value:function(){var t=_p.r(16),e=_p.r(12),n=_p.r(11).createClass("CompositeEffect",{base:t,constructor:function(i,r,o){this.callBase(t.NAME_COMPOSITE),this.set("operator",e.getValue(i,n.OPERATOR_OVER)),r&&this.set("in",r),o&&this.set("in2",o)}});return e.extend(n,{OPERATOR_OVER:"over",OPERATOR_IN:"in",OPERATOR_OUT:"out",OPERATOR_ATOP:"atop",OPERATOR_XOR:"xor",OPERATOR_ARITHMETIC:"arithmetic"}),n}},_p[15]={value:function(){var t=_p.r(16),e=_p.r(12),n=_p.r(11).createClass("ConvolveMatrixEffect",{base:t,constructor:function(i,r){this.callBase(t.NAME_CONVOLVE_MATRIX),this.set("edgeMode",e.getValue(i,n.MODE_DUPLICATE)),this.set("in",e.getValue(r,t.INPUT_SOURCE_GRAPHIC))}});return e.extend(n,{MODE_DUPLICATE:"duplicate",MODE_WRAP:"wrap",MODE_NONE:"none"}),n}},_p[16]={value:function(){var t=_p.r(67),e=_p.r(11).createClass("Effect",{constructor:function(e){this.node=t.createNode(e)},getId:function(){return this.node.id},setId:function(t){return this.node.id=t,this},set:function(t,e){return this.node.setAttribute(t,e),this},get:function(t){return this.node.getAttribute(t)},getNode:function(){return this.node},toString:function(){return this.node.getAttribute("result")||""}});return _p.r(12).extend(e,{NAME_GAUSSIAN_BLUR:"feGaussianBlur",NAME_OFFSET:"feOffset",NAME_COMPOSITE:"feComposite",NAME_COLOR_MATRIX:"feColorMatrix",NAME_CONVOLVE_MATRIX:"feConvolveMatrix",INPUT_SOURCE_GRAPHIC:"SourceGraphic",INPUT_SOURCE_ALPHA:"SourceAlpha",INPUT_BACKGROUND_IMAGE:"BackgroundImage",INPUT_BACKGROUND_ALPHA:"BackgroundAlpha",INPUT_FILL_PAINT:"FillPaint",INPUT_STROKE_PAINT:"StrokePaint"}),e}},_p[17]={value:function(){var t=_p.r(16),e=_p.r(12);return _p.r(11).createClass("GaussianblurEffect",{base:t,constructor:function(n,i){this.callBase(t.NAME_GAUSSIAN_BLUR),this.set("stdDeviation",e.getValue(n,1)),this.set("in",e.getValue(i,t.INPUT_SOURCE_GRAPHIC))}})}},_p[18]={value:function(){var t=_p.r(16),e=_p.r(12);return _p.r(11).createClass("OffsetEffect",{base:t,constructor:function(n,i,r){this.callBase(t.NAME_OFFSET),this.set("dx",e.getValue(n,0)),this.set("dy",e.getValue(i,0)),this.set("in",e.getValue(r,t.INPUT_SOURCE_GRAPHIC))}})}},_p[19]={value:function(){return _p.r(11).createClass("EffectContainer",{base:_p.r(29),addEffect:function(){return this.addItem.apply(this,arguments)},prependEffect:function(){return this.prependItem.apply(this,arguments)},appendEffect:function(){return this.appendItem.apply(this,arguments)},removeEffect:function(){return this.removeItem.apply(this,arguments)},addEffects:function(){return this.addItems.apply(this,arguments)},setEffects:function(){return this.setItems.apply(this,arguments)},getEffect:function(){return this.getItem.apply(this,arguments)},getEffects:function(){return this.getItems.apply(this,arguments)},getFirstEffect:function(){return this.getFirstItem.apply(this,arguments)},getLastEffect:function(){return this.getLastItem.apply(this,arguments)},handleAdd:function(t,e){var n=this.getEffects().length,i=this.getItem(e+1);return n===e+1?void this.node.appendChild(t.getNode()):void this.node.insertBefore(t.getNode(),i.getNode())}})}},_p[20]={value:function(){var t=_p.r(67),e=_p.r(11),n=e.createClass("Filter",{mixins:[_p.r(19)],constructor:function(e,n,i,r){this.node=t.createNode("filter"),void 0!==e&&this.set("x",e),void 0!==n&&this.set("y",n),void 0!==i&&this.set("width",i),void 0!==r&&this.set("height",r)},getId:function(){return this.id},setId:function(t){return this.node.id=t,this},set:function(t,e){return this.node.setAttribute(t,e),this},get:function(t){return this.node.getAttribute(t)},getNode:function(){return this.node}}),i=_p.r(60);return e.extendClass(i,{applyFilter:function(t){var e=t.get("id");return e&&this.node.setAttribute("filter","url(#"+e+")"),this}}),n}},_p[21]={value:function(){var t=_p.r(17);return _p.r(11).createClass("GaussianblurFilter",{base:_p.r(20),constructor:function(e){this.callBase(),this.addEffect(new t(e))}})}},_p[22]={value:function(){var t=_p.r(17),e=_p.r(16),n=_p.r(13),i=_p.r(28),r=_p.r(12),o=_p.r(14),a=_p.r(18);return _p.r(11).createClass("ProjectionFilter",{base:_p.r(20),constructor:function(i,r,s){this.callBase(),this.gaussianblurEffect=new t(i,e.INPUT_SOURCE_ALPHA),this.gaussianblurEffect.set("result","gaussianblur"),this.addEffect(this.gaussianblurEffect),this.offsetEffect=new a(r,s,this.gaussianblurEffect),this.offsetEffect.set("result","offsetBlur"),this.addEffect(this.offsetEffect),this.colorMatrixEffect=new n(n.TYPE_MATRIX,this.offsetEffect),this.colorMatrixEffect.set("values",n.MATRIX_ORIGINAL),this.colorMatrixEffect.set("result","colorOffsetBlur"),this.addEffect(this.colorMatrixEffect),this.compositeEffect=new o(o.OPERATOR_OVER,e.INPUT_SOURCE_GRAPHIC,this.colorMatrixEffect),this.addEffect(this.compositeEffect)},setColor:function(t){var e=null,o=[];if(r.isString(t)&&(t=i.parse(t)),!t)return this;e=n.MATRIX_EMPTY.split(" "),o.push(t.get("r")),o.push(t.get("g")),o.push(t.get("b"));for(var a=0,s=o.length;s>a;a++)e[5*a+3]=o[a]/255;return e[18]=t.get("a"),this.colorMatrixEffect.set("values",e.join(" ")),this},setOpacity:function(t){var e=this.colorMatrixEffect.get("values").split(" ");return e[18]=t,this.colorMatrixEffect.set("values",e.join(" ")),this},setOffset:function(t,e){this.setOffsetX(t),this.setOffsetY(e)},setOffsetX:function(t){this.offsetEffect.set("dx",t)},setOffsetY:function(t){this.offsetEffect.set("dy",t)},setDeviation:function(t){this.gaussianblurEffect.set("stdDeviation",t)}})}},_p[23]={value:function(){return _p.r(11).createClass("Bezier",{mixins:[_p.r(51)],base:_p.r(46),constructor:function(t){this.callBase(),t=t||[],this.changeable=!0,this.setBezierPoints(t)},getBezierPoints:function(){return this.getPoints()},setBezierPoints:function(t){return this.setPoints(t)},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var t=null,e=this.getBezierPoints();if(!(e.length<2)){t=this.getDrawer(),t.clear();var n=e[0].getVertex(),i=null,r=null;t.moveTo(n.x,n.y);for(var o=1,a=e.length;a>o;o++)n=e[o].getVertex(),r=e[o].getBackward(),i=e[o-1].getForward(),t.bezierTo(i.x,i.y,r.x,r.y,n.x,n.y);return this}}})}},_p[24]={value:function(){var t=_p.r(63),e=_p.r(73),n=_p.r(11).createClass("BezierPoint",{constructor:function(e,n,i){this.vertex=new t(e,n),this.forward=new t(e,n),this.backward=new t(e,n),this.setSmooth(void 0===i||i),this.setSymReflaction(!0)},clone:function(){var t=new n,e=null;return e=this.getVertex(),t.setVertex(e.x,e.y),e=this.getForward(),t.setForward(e.x,e.y),e=this.getBackward(),t.setBackward(e.x,e.y),t.setSymReflaction(this.isSymReflaction),t.setSmooth(this.isSmooth()),t},setVertex:function(t,e){return this.vertex.setPoint(t,e),this.update(),this},moveTo:function(t,e){var n=this.forward.getPoint(),i=this.backward.getPoint(),r=this.vertex.getPoint(),o={left:t-r.x,top:e-r.y};this.forward.setPoint(n.x+o.left,n.y+o.top),this.backward.setPoint(i.x+o.left,i.y+o.top),this.vertex.setPoint(t,e),this.update()},setForward:function(t,e){return this.forward.setPoint(t,e),this.smooth&&this.updateAnother(this.forward,this.backward),this.update(),this.lastControlPointSet=this.forward,this},setBackward:function(t,e){return this.backward.setPoint(t,e),this.smooth&&this.updateAnother(this.backward,this.forward),this.update(),this.lastControlPointSet=this.backward,this},setSymReflaction:function(t){return this.symReflaction=t,this.smooth&&this.setSmooth(!0),this},isSymReflaction:function(){return this.symReflaction},updateAnother:function(t,n){var i=this.getVertex(),r=e.fromPoints(t.getPoint(),i),o=e.fromPoints(i,n.getPoint());return o=r.normalize(this.isSymReflaction()?r.length():o.length()),n.setPoint(i.x+o.x,i.y+o.y),this},setSmooth:function(t){var e;return this.smooth=!!t,this.smooth&&(e=this.lastControlPointSet)&&this.updateAnother(e,e==this.forward?this.backward:this.forward),this},isSmooth:function(){return this.smooth},getVertex:function(){return this.vertex.getPoint()},getForward:function(){return this.forward.getPoint()},getBackward:function(){return this.backward.getPoint()},update:function(){return this.container?void(this.container.update&&this.container.update(this)):this}});return n}},_p[25]={value:function(){var t=_p.r(11).createClass("Box",{constructor:function(t,e,n,i){var r=arguments[0];r&&"object"==typeof r&&(t=r.x,e=r.y,n=r.width,i=r.height),0>n&&(t-=n=-n),0>i&&(e-=i=-i),this.x=t||0,this.y=e||0,this.width=n||0,this.height=i||0,this.left=this.x,this.right=this.x+this.width,this.top=this.y,this.bottom=this.y+this.height,this.cx=this.x+this.width/2,this.cy=this.y+this.height/2},getRangeX:function(){return[this.left,this.right]},getRangeY:function(){return[this.top,this.bottom]},merge:function(e){if(this.isEmpty())return new t(e.x,e.y,e.width,e.height);var n=Math.min(this.left,e.left),i=Math.max(this.right,e.right),r=Math.min(this.top,e.top),o=Math.max(this.bottom,e.bottom);return new t(n,r,i-n,o-r)},intersect:function(e){!e instanceof t&&(e=new t(e));var n=Math.max(this.left,e.left),i=Math.min(this.right,e.right),r=Math.max(this.top,e.top),o=Math.min(this.bottom,e.bottom);return n>i||r>o?new t:new t(n,r,i-n,o-r)},expand:function(e,n,i,r){if(arguments.length<1)return new t(this);arguments.length<2&&(n=e),arguments.length<3&&(i=e),arguments.length<4&&(r=n);var o=this.left-r,a=this.top-e,s=this.width+n,l=this.height+e;return new t(o,a,s,l)},valueOf:function(){return[this.x,this.y,this.width,this.height]},toString:function(){return this.valueOf().join(" ")},isEmpty:function(){return!this.width||!this.height}});return t.parse=function(e){return"string"==typeof e?t.parse(e.split(/[\s,]+/).map(parseFloat)):e instanceof Array?new t(e[0],e[1],e[2],e[3]):"x"in e?new t(e):null},t}},_p[26]={value:function(){return _p.r(11).createClass("Circle",{base:_p.r(32),constructor:function(t,e,n){this.callBase(t,t,e,n)},getRadius:function(){return this.getRadiusX()},setRadius:function(t){return this.callBase(t,t)}})}},_p[27]={value:function(){var t=_p.r(11),e=_p.r(60),n=t.createClass("Clip",{base:e,mixins:[_p.r(61)],constructor:function(t){this.callBase("clipPath",t)},clip:function(t){return t.getNode().setAttribute("clip-path",this),this}});return t.extendClass(e,{clipWith:function(t){return t instanceof e&&(t=new n(t.getPaper()).addShape(t)),t.clip(this),this}}),n}},_p[28]={value:function(){var t=_p.r(12),e=_p.r(64),n={},i=_p.r(11).createClass("Color",{constructor:function(){var e=null;"string"==typeof arguments[0]?(e=n.parseToValue(arguments[0]),null===e&&(e={r:0,g:0,b:0,h:0,s:0,l:0,a:1})):(e={r:0|arguments[0],g:0|arguments[1],b:0|arguments[2],a:void 0===arguments[3]?1:parseFloat(arguments[3])},e=n.overflowFormat(e),e=t.extend(e,n.rgbValueToHslValue(e))),this._color=e},set:function(e,r){if(!i._MAX_VALUE[e])throw new Error("Color set(): Illegal parameter");return"a"!==e&&(r=Math.floor(r)),"h"==e&&(r=(r+360)%360),this._color[e]=Math.max(i._MIN_VALUE[e],Math.min(i._MAX_VALUE[e],r)),-1!=="rgb".indexOf(e)?this._color=t.extend(this._color,n.rgbValueToHslValue(this._color)):-1!=="hsl".indexOf(e)&&(this._color=t.extend(this._color,n.hslValueToRGBValue(this._color))),this},inc:function(t,e){return e=this.get(t)+e,"h"==t?e=(e+360)%360:(e=Math.min(i._MAX_VALUE[t],e),e=Math.max(i._MIN_VALUE[t],e)),this.clone().set(t,e)},dec:function(t,e){return this.inc(t,-e)},clone:function(){return new i(this.toRGBA())},get:function(t){return i._MAX_VALUE[t]?this._color[t]:null},getValues:function(){return t.clone(this._color)},valueOf:function(){return this.getValues()},toRGB:function(){return n.toString(this._color,"rgb")},toRGBA:function(){return n.toString(this._color,"rgba")},toHEX:function(){return n.toString(this._color,"hex")},toHSL:function(){return n.toString(this._color,"hsl")},toHSLA:function(){return n.toString(this._color,"hsla")},toString:function(){return 1===this._color.a?this.toRGB():this.toRGBA()}});return t.extend(i,{_MAX_VALUE:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},_MIN_VALUE:{r:0,g:0,b:0,h:0,s:0,l:0,a:0},R:"r",G:"g",B:"b",H:"h",S:"s",L:"l",A:"a",parse:function(e){var r;return t.isString(e)&&(r=n.parseToValue(e)),t.isObject(e)&&"r"in e&&(r=e),null===r?new i:new i(r.r,r.g,r.b,r.a)},createHSL:function(t,e,n){return i.createHSLA(t,e,n,1)},createHSLA:function(t,e,n,r){var o=null;return e+="%",n+="%",o=["hsla("+t,e,n,r+")"],i.parse(o.join(", "))},createRGB:function(t,e,n){return i.createRGBA(t,e,n,1)},createRGBA:function(t,e,n,r){return new i(t,e,n,r)}}),t.extend(n,{parseToValue:function(t){var i={};if(t=e.EXTEND_STANDARD[t]||e.COLOR_STANDARD[t]||t,/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t))i=n.hexToValue(t);else if(/^(rgba?)/i.test(t))i=n.rgbaToValue(t);else{if(!/^(hsla?)/i.test(t))return null;i=n.hslaToValue(t)}return n.overflowFormat(i)},hexToValue:function(e){var i={},r=["r","g","b"];return/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e)?(e=RegExp.$1.split(""),t.each(r,function(t,r){i[t]=n.toNumber(3===e.length?e[r]+e[r]:e[2*r]+e[2*r+1])}),i=t.extend(i,n.rgbValueToHslValue(i)),i.a=1,i):null},rgbaToValue:function(e){var i={},r=!1,o=["r","g","b"];return/^(rgba?)/i.test(e)?(r=4===RegExp.$1.length,e=e.replace(/^rgba?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),t.each(o,function(t,n){i[t]=0|e[n]}),i=t.extend(i,n.rgbValueToHslValue(i)),i.a=r?parseFloat(e[3]):1,i):null},hslaToValue:function(e){var i={},r=!1;return/^(hsla?)/i.test(e)?(r=4===RegExp.$1.length,e=e.replace(/^hsla?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),i.h=0|e[0],i.s=0|e[1],i.l=0|e[2],i=t.extend(i,n.hslValueToRGBValue(i)),i=n.hslValueToRGBValue(i),i.a=r?parseFloat(e[3]):1,i):null},hslValueToRGBValue:function(e){function n(t,e,n){return 0>n?n+=1:n>1&&(n-=1),1>6*n?t+6*(e-t)*n:1>2*n?e:2>3*n?t+6*(e-t)*(2/3-n):t}var i=null,r=null,o={};return e=t.extend({},e),e.h=e.h/360,e.s=e.s/100,e.l=e.l/100,0===e.s?o.r=o.g=o.b=e.l:(i=e.l<.5?e.l*(1+e.s):e.l+e.s-e.l*e.s,r=2*e.l-i,o.r=n(r,i,e.h+1/3),o.g=n(r,i,e.h),o.b=n(r,i,e.h-1/3)),o.r=Math.min(Math.round(255*o.r),255),o.g=Math.min(Math.round(255*o.g),255),o.b=Math.min(Math.round(255*o.b),255),o},rgbValueToHslValue:function(e){var n=null,i=null,r={};return e=t.extend({},e),e.r=e.r/255,e.g=e.g/255,e.b=e.b/255,n=Math.max(e.r,e.g,e.b),i=Math.min(e.r,e.g,e.b),n===i?r.h=0:n===e.r?r.h=e.g>=e.b?60*(e.g-e.b)/(n-i):60*(e.g-e.b)/(n-i)+360:n===e.g?r.h=60*(e.b-e.r)/(n-i)+120:n===e.b&&(r.h=60*(e.r-e.g)/(n-i)+240),r.l=(n+i)/2,r.s=0===r.l||n===i?0:r.l>0&&r.l<=.5?(n-i)/(n+i):(n-i)/(2-n-i),r.h=Math.round(r.h),r.s=Math.round(100*r.s),r.l=Math.round(100*r.l),r},toString:function(e,i){var r=[];return e=t.extend({},e),-1!==i.indexOf("hsl")&&(e.s+="%",e.l+="%"),"hex"!==i?(t.each(i.split(""),function(t){r.push(e[t])}),(i+"("+r.join(", ")+")").toLowerCase()):(r.push(n.toHexValue(+e.r)),r.push(n.toHexValue(+e.g)),r.push(n.toHexValue(+e.b)),("#"+r.join("")).toLowerCase())},toNumber:function(t){return 0|Number("0x"+t)},toHexValue:function(t){var e=t.toString(16);return 1===e.length?"0"+e:e},overflowFormat:function(e){var n=t.extend({},e),r="rgba";return t.each(r.split(""),function(t){n.hasOwnProperty(t)&&(n[t]=Math.min(i._MAX_VALUE[t],n[t]),n[t]=Math.max(i._MIN_VALUE[t],n[t]))}),n}}),i}},_p[29]={value:function(){function t(){return this.container.removeItem(this),this}return _p.r(11).createClass("Container",{getItems:function(){return this.items||(this.items=[])},getItem:function(t){return this.getItems()[t]},getFirstItem:function(){return this.getItem(0)},getLastItem:function(){return this.getItem(this.getItems().length-1)},indexOf:function(t){return this.getItems().indexOf(t)},eachItem:function(t){var e,n=this.getItems(),i=n.length;for(e=0;i>e;e++)t.call(this,e,n[e]);return this},addItem:function(e,n,i){var r=this.getItems(),o=r.length;return~r.indexOf(e)?this:(n>=0&&o>n||(n=o),r.splice(n,0,e),"object"==typeof e&&(e.container=this,e.remove=t),this.handleAdd(e,n),i||this.onContainerChanged("add",[e]),this)},addItems:function(t){for(var e=0,n=t.length;n>e;e++)this.addItem(t[e],-1,!0);return this.onContainerChanged("add",t),this},setItems:function(t){return this.clear().addItems(t)},appendItem:function(t){return this.addItem(t)},prependItem:function(t){return this.addItem(t,0)},removeItem:function(t,e){if("number"!=typeof t)return this.removeItem(this.indexOf(t));var n=this.getItems(),i=(n.length,n[t]);return void 0===i?this:(n.splice(t,1),i.container&&delete i.container,i.remove&&delete i.remove,this.handleRemove(i,t),e||this.onContainerChanged("remove",[i]),this)},clear:function(){for(var t,e=[];t=this.getFirstItem();)e.push(t),this.removeItem(0,!0);return this.onContainerChanged("remove",e),this},onContainerChanged:function(){},handleAdd:function(){},handleRemove:function(){}})}},_p[30]={value:function(){var t=_p.r(12),e={getCurvePanLines:function(t,n){var i=e.getCenterPoints(t),r=e.getPanLine(t.length,i);return e.getMovedPanLines(t,r,n)},getCenterPoints:function(t){for(var e={},n=null,i=0,r=0,o=t.length;o>i;i++)r=i===o-1?0:i+1,n=i+","+r,e[n]={x:(t[i].x+t[r].y)/2,y:(t[i].x+t[r].y)/2};return e},getPanLine:function(t,e){for(var n,i={},r=null,o=0;t>o;o++){var a=null,s=null;n=(o+1)%t,r=n,a=e[o+","+n],o=n,n=(o+1)%t,s=e[o+","+n],i[r]={points:[{x:a.x,y:a.y},{x:s.x,y:s.y}],center:{x:(a.x+s.x)/2,y:(a.y+s.y)/2}},o=(r+t-1)%t}return i},getMovedPanLines:function(e,n,i){var r={};return t.each(e,function(e,o){var a=n[o],s=a.center,l={x:s.x-e.x,y:s.y-e.y},u=r[o]={points:[],center:{x:e.x,y:e.y}};t.each(a.points,function(t){var e={x:t.x-l.x,y:t.y-l.y},n=u.center,r=e.x-n.x,o=e.y-n.y;e.x=n.x+i*r,e.y=n.y+i*o,u.points.push(e)})}),r}};return _p.r(11).createClass("Curve",{base:_p.r(46),mixins:[_p.r(51)],constructor:function(t,e){this.callBase(),this.setPoints(t||[]),this.closeState=!!e,this.changeable=!0,this.smoothFactor=1,this.update()},onContainerChanged:function(){this.changeable&&this.update()},setSmoothFactor:function(t){return this.smoothFactor=0>t?0:t,this.update(),this},getSmoothFactor:function(){return this.smoothFactor},update:function(){var t=this.getPoints(),n=null,i=this.getDrawer(),r=null,o=null,a=null;if(i.clear(),0===t.length)return this;if(i.moveTo(t[0]),1===t.length)return this;if(2===t.length)return i.lineTo(t[1]),this;n=e.getCurvePanLines(t,this.getSmoothFactor());for(var s=1,l=t.length;l>s;s++)r=n[s].center,o=this.closeState||s!=l-1?n[s].points[0]:n[s].center,a=this.closeState||1!=s?n[s-1].points[1]:n[s-1].center,i.bezierTo(a.x,a.y,o.x,o.y,r.x,r.y);return this.closeState&&(r=n[0].center,o=n[0].points[0],a=n[t.length-1].points[1],i.bezierTo(a.x,a.y,o.x,o.y,r.x,r.y)),this},close:function(){return this.closeState=!0,this.update()},open:function(){return this.closeState=!1,this.update()},isClose:function(){return!!this.closeState}})}},_p[31]={value:function(){return _p.r(11).createClass("Data",{constructor:function(){this._data={}},setData:function(t,e){return this._data[t]=e,this},getData:function(t){return this._data[t]},removeData:function(t){return delete this._data[t],this}})}},_p[32]={value:function(){var t=(_p.r(12),_p.r(50));return _p.r(11).createClass("Ellipse",{base:_p.r(46),constructor:function(t,e,n,i){this.callBase(),this.rx=t||0,this.ry=e||0,this.cx=n||0,this.cy=i||0,this.update()},update:function(){var t=this.rx,e=this.ry,n=this.cx+t,i=this.cx-t,r=this.cy,o=this.getDrawer();return o.clear(),o.moveTo(n,r),o.arcTo(t,e,0,1,1,i,r),o.arcTo(t,e,0,1,1,n,r),this},getRadius:function(){return{x:this.rx,y:this.ry}},getRadiusX:function(){return this.rx},getRadiusY:function(){return this.ry},getCenter:function(){return new t(this.cx,this.cy)},getCenterX:function(){return this.cx},getCenterY:function(){return this.cy},setRadius:function(t,e){return this.rx=t,this.ry=e,this.update()},setRadiusX:function(t){return this.rx=t,this.update()},setRadiusY:function(t){return this.ry=t,this.update()},setCenter:function(e,n){if(1==arguments.length){var i=t.parse(arguments[0]);e=i.x,n=i.y}return this.cx=e,this.cy=n,this.update()},setCenterX:function(t){return this.cx=t,this.update()},setCenterY:function(t){return this.cy=t,this.update()}})}},_p[33]={value:function(){function t(t,e,i){return i=!!i,a.isString(t)&&(t=t.match(/\S+/g)),a.each(t,function(t){n.call(this,this.node,t,e,i)},this),this}function e(t,e){var n=null,i=this._EVNET_UID,o=void 0===e;return n=u[i][t],o||(o=!0,a.each(n,function(t,i){t===e?delete n[i]:o=!1})),o&&(r(this.node,t,l[i][t]),delete u[i][t],delete l[i][t]),this}function n(t,e,n,r){var o=this._EVNET_UID,c=this;l[o]||(l[o]={}),l[o][e]||(l[o][e]=function(t){t=new s(t||window.event),a.each(u[o][e],function(n){var i;return n&&(i=n.call(c,t),r&&c.off(e,n)),i},c)}),u[o]||(u[o]={}),u[o][e]?u[o][e].push(n):(u[o][e]=[n],t&&"on"+e in t&&i(t,e,l[o][e]))}function i(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)}function r(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent(e,n)}function o(t,e,n){var i=null,r=null,o=l[t._EVNET_UID];o&&(r=o[e],r&&(i=a.extend({type:e,target:t},n||{}),r.call(t,i)))}!function(){function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}t.prototype=window.Event.prototype,window.CustomEvent=t}();var a=_p.r(12),s=_p.r(62),l={},u={},c=0;return _p.r(11).createClass("EventHandler",{constructor:function(){this._EVNET_UID=++c},addEventListener:function(e,n){return t.call(this,e,n,!1)},addOnceEventListener:function(e,n){return t.call(this,e,n,!0)},removeEventListener:function(t,n){return e.call(this,t,n)},on:function(){return this.addEventListener.apply(this,arguments)},once:function(){return this.addOnceEventListener.apply(this,arguments)},off:function(){return this.removeEventListener.apply(this,arguments)},fire:function(){return this.trigger.apply(this,arguments)},trigger:function(t,e){return o(this,t,e),this}})}},_p[34]={value:function(){function t(t){var e,n,i,r,o;for(e=[],n=0;n<t.length;n++)for(r=t[n],e.push(o=[]),i=0;i<r.length;i++)o.push(r[i]);return t.isUniform&&(e.isUniform=!0),t.isAbsolute&&(e.isAbsolute=!0),t.isCurve&&(e.isCurve=!0),e}function e(t,e,n){function i(t,e){for(var n=0,i=t.length;i>n;n++)if(t[n]===e)return t.push(t.splice(n,1)[0])}function r(){var o=Array.prototype.slice.call(arguments,0),a=o.join("␀"),s=r.cache=r.cache||{},l=r.count=r.count||[];return s.hasOwnProperty(a)?(i(l,a),n?n(s[a]):s[a]):(l.length>=1e3&&delete s[l.shift()],l.push(a),s[a]=t.apply(e,o),n?n(s[a]):s[a])}return r}function n(t,e,i,r,o,a,s,l,u,c){var h,d,f,p,g,m,v,y,_,b,x,w,k,C,S,T,M,L,E,N,P,A,O,D,I,B,R,W,H,V,z,F=Math,j=F.PI,U=Math.abs,K=120*j/180,q=j/180*(+o||0),$=[],G=function(t,e,n){var i=t*F.cos(n)-e*F.sin(n),r=t*F.sin(n)+e*F.cos(n);return{x:i,y:r}};if(c?(w=c[0],k=c[1],b=c[2],x=c[3]):(h=G(t,e,-q),t=h.x,e=h.y,h=G(l,u,-q),l=h.x,u=h.y,d=F.cos(j/180*o),f=F.sin(j/180*o),g=(t-l)/2,m=(e-u)/2,p=g*g/(i*i)+m*m/(r*r),p>1&&(p=F.sqrt(p),i=p*i,r=p*r),v=i*i,y=r*r,_=(a==s?-1:1)*F.sqrt(U((v*y-v*m*m-y*g*g)/(v*m*m+y*g*g))),b=_*i*m/r+(t+l)/2,x=_*-r*g/i+(e+u)/2,w=F.asin(((e-x)/r).toFixed(9)),k=F.asin(((u-x)/r).toFixed(9)),w=b>t?j-w:w,k=b>l?j-k:k,0>w&&(w=2*j+w),0>k&&(k=2*j+k),s&&w>k&&(w-=2*j),!s&&k>w&&(k-=2*j)),C=k-w,U(C)>K&&(S=k,T=l,M=u,k=w+K*(s&&k>w?1:-1),l=b+i*F.cos(k),u=x+r*F.sin(k),$=n(l,u,i,r,o,0,s,T,M,[k,S,b,x])),C=k-w,L=F.cos(w),E=F.sin(w),N=F.cos(k),P=F.sin(k),A=F.tan(C/4),O=4/3*i*A,D=4/3*r*A,I=[t,e],B=[t+O*E,e-D*L],R=[l+O*P,u-D*N],W=[l,u],B[0]=2*I[0]-B[0],B[1]=2*I[1]-B[1],c)return[B,R,W].concat($);for($=[B,R,W].concat($).join().split(","),H=[],V=0,z=$.length;z>V;V++)H[V]=V%2?G($[V-1],$[V],q).y:G($[V],$[V+1],q).x;return H}function i(t,e,n,i,r,o){var a=1/3,s=2/3;return[a*t+s*n,a*e+s*i,a*r+s*n,a*o+s*i,r,o]}function r(t,e){function n(t){return function(e,n){return e+t*(n-e)}}var i=n(e||.5),r=t,o=r[0],a=r[1],s=r[2],l=r[3],u=r[4],c=r[5],h=r[6],d=r[7],f=i(o,s),p=i(a,l),g=i(s,u),m=i(l,c),v=i(u,h),y=i(c,d),_=i(f,g),b=i(p,m),x=i(g,v),w=i(m,y),k=i(_,x),C=i(b,w);return[[o,a,f,p,_,b,k,C],[k,C,x,w,v,y,h,d]]}var o=_p.r(12),a=_p.r(50),s=_p.r(73),l=_p.r(43),u={},c=/([achlmrqstvz])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?\s*)+)/gi,h=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)\s*,?\s*/gi,d={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0};u.pathToString=function(t){return t=t||this,"string"==typeof t?t:t instanceof Array?(t=o.flatten(t),t.join(",").replace(/,?([achlmqrstvxz]),?/gi,"$1")):void 0},u.parsePathString=e(function(t){var e=[];return t.replace(c,function(t,n,i){var r=[],o=n.toLowerCase();if(i.replace(h,function(t,e){e&&r.push(+e)}),"m"==o&&r.length>2&&(e.push([n].concat(r.splice(0,2))),o="l",n="m"==n?"l":"L"),"r"==o)e.push([n].concat(r));else for(;r.length>=d[o]&&(e.push([n].concat(r.splice(0,d[o]))),d[o]););}),e.isUniform=!0,e.toString=u.pathToString,e}),u.pathToAbsolute=e(function(t){var e,n,i,r,o,a,s,l,c=t.isUniform?t:u.parsePathString(u.pathToString(t)),h=[],d=0,f=0,p=0,g=0,m=0;for("M"==c[0][0]&&(d=+c[0][1],f=+c[0][2],p=d,g=f,m++,h[0]=["M",d,f]),i=m,a=c.length;a>i;i++){if(h.push(e=[]),n=c[i],n[0]!=n[0].toUpperCase())switch(e[0]=n[0].toUpperCase(),e[0]){case"A":e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=+(n[6]+d),e[7]=+(n[7]+f);break;case"V":e[1]=+n[1]+f;break;case"H":e[1]=+n[1]+d;break;case"M":p=+n[1]+d,g=+n[2]+f;break;default:for(r=1,s=n.length;s>r;r++)e[r]=+n[r]+(r%2?d:f)}else for(o=0,l=n.length;l>o;o++)e[o]=n[o];switch(e[0]){case"Z":d=p,f=g;break;case"H":d=e[1];break;case"V":f=e[1];break;case"M":p=e[e.length-2],g=e[e.length-1];break;default:d=e[e.length-2],f=e[e.length-1]}}return h.isUniform=!0,h.isAbsolute=!0,h.toString=u.pathToString,h}),u.pathToCurve=e(function(t){var e,r,o,a,s,l,c,h,d,f,p,g,m=[];for(t.isAbsolute||(t=u.pathToAbsolute(t)),e=0;e<t.length;e++)if(o=t[e][0],a=t[e].slice(1),"M"!=o){switch("Z"==o&&(h=!0,o="L",a=s),c=a.slice(a.length-2),"H"==o&&(c=[a[0],l[1]],o="L"),"V"==o&&(c=[l[0],a[0]],o="L"),("S"==o||"T"==o)&&(f=[l[0]+(l[0]-d[0]),l[1]+(l[1]-d[1])]),o){case"L":p=l,g=c;break;case"C":p=a.slice(0,2),g=a.slice(2,4);break;case"S":p=f.slice(),g=a.slice(0,2);break;case"Q":d=a.slice(0,2),a=i.apply(null,l.concat(a)),p=a.slice(0,2),g=a.slice(2,4);break;case"T":a=i.apply(null,l.concat(f).concat(a)),p=a.slice(0,2),g=a.slice(2,4);break;case"A":for(a=n.apply(null,l.concat(a)),r=0;r in a;)p=a.slice(r,r+2),g=a.slice(r+2,r+4),c=a.slice(r+4,r+6),m.push(["C"].concat(p).concat(g).concat(c)),r+=6}"A"!=o&&m.push(["C"].concat(p).concat(g).concat(c)),l=c,"Q"!=o&&(d=g),h&&(m.push(["Z"]),h=!1)}else s=d=l=a,m.push(t[e]);return m.isUniform=!0,m.isAbsolute=!0,m.isCurve=!0,m.toString=u.pathToString,m}),u.cutBezier=e(r),u.subBezier=function(t,e,n){var i=r(t,e)[0];return n?r(i,n/e)[1]:i},u.pointAtBezier=function(t,e){var n=r(t,e)[0],i=a.parse(n.slice(6)),o=a.parse(n.slice(4,2)),l=s.fromPoints(o,i);return i.tan=0===e?u.pointAtBezier(t,.01).tan:l.normalize(),i},u.bezierLength=e(function(t){function e(t){var e=l*Math.pow(t,4)+u*Math.pow(t,3)+c*Math.pow(t,2)+h*t+d;return 0>e&&(e=0),Math.pow(e,.5)}var n,i,r,o,a,s,l,u,c,h,d,f=t;return n=-3*f[0]+9*f[2]-9*f[4]+3*f[6],i=6*f[0]-12*f[2]+6*f[4],r=-3*f[0]+3*f[2],o=-3*f[1]+9*f[3]-9*f[5]+3*f[7],a=6*f[1]-12*f[3]+6*f[5],s=-3*f[1]+3*f[3],l=Math.pow(n,2)+Math.pow(o,2),u=2*(n*i+o*a),c=2*(n*r+o*s)+Math.pow(i,2)+Math.pow(a,2),h=2*(i*r+a*s),d=Math.pow(r,2)+Math.pow(s,2),(e(0)+e(1)+4*(e(.125)+e(.375)+e(.625)+e(.875))+2*(e(.25)+e(.5)+e(.75)))/24});var f=e(function(t){var e,n,i,r,o,a,s;for(a=[],s=0,e=0,n=t.length;n>e;e++)i=t[e],"M"!=i[0]?"Z"!=i[0]?(o=u.bezierLength(r.concat(i.slice(1))),a.push([s,s+o]),s+=o,r=i.slice(4)):a.push(null):(r=i.slice(1),a.push(null));return a.totalLength=s,a});u.subPath=function(t,e,n){var i;if(n=n||0,i=e-n,i-=0|i,n-=0|n,e=n+i,e>1)return u.subPath(t,1,n).concat(u.subPath(t,e-1));t.isCurve||(t=u.pathToCurve(t));var r,o,a,s,l,c,h,d,p,g=f(t),m=g.totalLength,v=m*e,y=m*(n||0),_=[];for(r=0,o=t.length;o>r;r++)if("M"!=t[r][0]){if("Z"!=t[r][0])if(a=g[r][0],s=g[r][1],l=s-a,h=c.concat(t[r].slice(1)),y>s)c=h.slice(h.length-2);else{if(y>=a)d=u.subBezier(h,Math.min((v-a)/l,1),(y-a)/l),p=!0,c=d.slice(0,2),_.push(["M"].concat(d.slice(0,2))),_.push(["C"].concat(d.slice(2)));else if(v>=s)_.push(t[r].slice());else{if(!(v>=a))break;d=u.subBezier(h,(v-a)/l),_.push(["C"].concat(d.slice(2))),p=!1}c=h.slice(h.length-2)}}else c=t[r].slice(1),p&&_.push(t[r].slice());return _.isAbsolute=!0,_.isCurve=!0,_.isUniform=!0,_.toString=u.pathToString,_},u.pointAtPath=function(t,e){t.isCurve||(t=u.pathToCurve(t));var n=u.subPath(t,e),i="Z"==n[n.length-1][0]?n[n.length-2]:n[n.length-1];i=i.slice(1);var r=a.parse(i.slice(4)),o=a.parse(i.slice(2,4));return r.tan=s.fromPoints(o,r).normalize(),r},u.pathLength=e(function(t){t.isCurve||(t=u.pathToCurve(t));var e=f(t);return e.totalLength}),u.pathKeyPoints=e(function(t){var e,n,i;for(t.isCurve||(t=u.pathToCurve(t)),i=[],e=0,n=t.length;n>e;e++)"z"!=t[e][0]&&i.push(t[e].slice(t[e].length-2));return i});var p=e(function(e,n){function i(t,e){return t[e||t.i]&&t[e||t.i][0]}function r(t,e){return t[e||t.i]&&t[e||t.i].slice(1)}function o(t,e){var n=r(t,e);return n&&n.slice(-2)}function a(t){return"Z"==i(t)?(t.splice(t.i,1),!0):!1}function s(t){return"M"==i(t)?(t.o.splice(t.o.i,0,["M"].concat(o(t.o,t.o.i-1))),t.i++,t.o.i++,!0):!1}function l(t){for(var e,n=1;!e;)e=o(t,t.length-n++);for(t.o.i=t.i;t.length<t.o.length;)a(t.o)||s(t.o)||(t.push(["C"].concat(e).concat(e).concat(e)),t.i++,t.o.i++)}e.isCurve||(e=u.pathToCurve(e)),n.isCurve||(n=u.pathToCurve(n));var c=t(e),h=t(n);for(c.i=0,h.i=0,c.o=h,h.o=c;c.i<c.length&&h.i<h.length;)a(c)||a(h)||(i(c)!=i(h)?s(c)||s(h)||(c.i++,h.i++):(c.i++,h.i++));
|
||
return c.i==c.length&&l(c),h.i==h.length&&l(h),delete c.i,delete c.o,delete h.i,delete h.o,[c,h]});return u.alignCurve=p,u.pathTween=function(t,e,n){if(0===n)return t;if(1===n)return e;var i,r,o,a=p(t,e),s=[];for(t=a[0],e=a[1],r=0;r<t.length;r++)for(s.push(i=[]),i.push(t[r][0]),o=1;o<t[r].length;o++)i.push(t[r][o]+n*(e[r][o]-t[r][o]));return s.isUniform=s.isCurve=s.isAbsolute=!0,s},u.transformPath=e(function(t,e){var n,i,r,o,s,l;for(t.isCurve||(t=u.pathToCurve(t)),o=[],n=0,i=t.length;i>n;n++)for(o.push(s=[t[n][0]]),r=1;r<t[n].length;r+=2)l=t[n].slice(r,r+2),l=e.transformPoint(a.parse(l)),o.push(l);return o}),_p.r(11).extendClass(l,{transformPath:function(t){return u.transformPath(t,this)}}),u}},_p[35]={value:function(){var t=_p.r(67),e=_p.r(58),n=_p.r(28);return _p.r(11).createClass("GradientBrush",{base:e,constructor:function(t,e){this.callBase(t,e),this.stops=[]},addStop:function(e,i,r){var o=t.createNode("stop");return i instanceof n||(i=n.parse(i)),void 0===r&&(r=i.get("a")),o.setAttribute("offset",e),o.setAttribute("stop-color",i.toRGB()),1>r&&o.setAttribute("stop-opacity",r),this.node.appendChild(o),this}})}},_p[36]={value:function(){var t=_p.r(61);return _p.r(11).createClass("Group",{mixins:[t],base:_p.r(60),constructor:function(){this.callBase("g")}})}},_p[37]={value:function(){var t=_p.r(61);return _p.r(11).createClass("HyperLink",{mixins:[t],base:_p.r(60),constructor:function(t){this.callBase("a"),this.setHref(t)},setHref:function(t){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t),this},getHref:function(){return this.node.getAttributeNS("xlink:href")},setTarget:function(t){return this.node.setAttribute("target",t),this},getTarget:function(){return this.node.getAttribute("target")}})}},_p[38]={value:function(){return _p.r(11).createClass("Image",{base:_p.r(60),constructor:function(t,e,n,i,r){this.callBase("image"),this.url=t,this.width=e||0,this.height=n||0,this.x=i||0,this.y=r||0,this.update()},update:function(){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.url),this.node.setAttribute("x",this.x),this.node.setAttribute("y",this.y),this.node.setAttribute("width",this.width),this.node.setAttribute("height",this.height),this},setUrl:function(t){return this.url=""===t?null:t,this.update()},getUrl:function(){return this.url},setWidth:function(t){return this.width=t,this.update()},getWidth:function(){return this.width},setHeight:function(t){return this.height=t,this.update()},getHeight:function(){return this.height},setX:function(t){return this.x=t,this.update()},getX:function(){return this.x},setY:function(t){return this.y=t,this.update()},getY:function(){return this.y}})}},_p[39]={value:function(){return _p.r(11).createClass("Line",{base:_p.r(46),constructor:function(t,e,n,i){this.callBase(),this.point1={x:t||0,y:e||0},this.point2={x:n||0,y:i||0},this.update()},setPoint1:function(t,e){return this.point1.x=t,this.point1.y=e,this.update()},setPoint2:function(t,e){return this.point2.x=t,this.point2.y=e,this.update()},getPoint1:function(){return{x:this.point1.x,y:this.point1.y}},getPoint2:function(){return{x:this.point2.x,y:this.point2.y}},update:function(){var t=this.getDrawer();return t.clear(),t.moveTo(this.point1.x,this.point1.y),t.lineTo(this.point2.x,this.point2.y),this}})}},_p[40]={value:function(){var t=(_p.r(67),_p.r(35));return _p.r(11).createClass("LinearGradientBrush",{base:t,constructor:function(t){this.callBase("linearGradient",t),this.setStartPosition(0,0),this.setEndPosition(1,0)},setStartPosition:function(t,e){return this.node.setAttribute("x1",t),this.node.setAttribute("y1",e),this},setEndPosition:function(t,e){return this.node.setAttribute("x2",t),this.node.setAttribute("y2",e),this},getStartPosition:function(){return{x:+this.node.getAttribute("x1"),y:+this.node.getAttribute("y1")}},getEndPosition:function(){return{x:+this.node.getAttribute("x2"),y:+this.node.getAttribute("y2")}}})}},_p[41]={value:function(){var t=_p.r(50),e=_p.r(11).createClass("Marker",{base:_p.r(58),mixins:[_p.r(61),_p.r(75)],constructor:function(){this.callBase("marker"),this.setOrient("auto")},setRef:function(t,e){return 1===arguments.length&&(e=t.y,t=t.x),this.node.setAttribute("refX",t),this.node.setAttribute("refY",e),this},getRef:function(){return new t(+this.node.getAttribute("refX"),+this.node.getAttribute("refY"))},setWidth:function(t){return this.node.setAttribute("markerWidth",this.width=t),this},setOrient:function(t){return this.node.setAttribute("orient",this.orient=t),this},getOrient:function(){return this.orient},getWidth:function(){return+this.width},setHeight:function(t){return this.node.setAttribute("markerHeight",this.height=t),this},getHeight:function(){return+this.height}}),n=_p.r(46);return _p.r(11).extendClass(n,{setMarker:function(t,e){return e=e||"end",t?this.node.setAttribute("marker-"+e,t.toString()):this.node.removeAttribute("marker-"+e),this}}),e}},_p[42]={value:function(){var t=_p.r(11),e=_p.r(60),n=t.createClass("Mask",{base:e,mixins:[_p.r(61)],constructor:function(){this.callBase("mask")},mask:function(t){return t.getNode().setAttribute("mask","url(#"+this.getId()+")"),this}});return t.extendClass(e,{maskWith:function(t){return t.mask(this),this}}),n}},_p[43]={value:function(){function t(t,e){return{a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,e:e.a*t.e+e.c*t.f+e.e,f:e.b*t.e+e.d*t.f+e.f}}function e(t){return t*Math.PI/180}var n=_p.r(12),i=_p.r(25),r=/matrix\s*\((.+)\)/i,o=_p.r(50),a=_p.r(11).createClass("Matrix",{constructor:function(){arguments.length?this.setMatrix.apply(this,arguments):this.setMatrix(1,0,0,1,0,0)},translate:function(e,n){return this.m=t(this.m,{a:1,c:0,e:e,b:0,d:1,f:n}),this},rotate:function(n){var i=e(n),r=Math.sin(i),o=Math.cos(i);return this.m=t(this.m,{a:o,c:-r,e:0,b:r,d:o,f:0}),this},scale:function(e,n){return void 0===n&&(n=e),this.m=t(this.m,{a:e,c:0,e:0,b:0,d:n,f:0}),this},skew:function(n,i){void 0===i&&(i=n);var r=Math.tan(e(n)),o=Math.tan(e(i));return this.m=t(this.m,{a:1,c:r,e:0,b:o,d:1,f:0}),this},inverse:function(){var t,e,n,i,r,o,s,l=this.m,u=l.a,c=l.b,h=l.c,d=l.d,f=l.e,p=l.f;return t=u*d-c*h,e=d/t,n=-c/t,i=-h/t,r=u/t,o=(h*p-f*d)/t,s=(c*f-u*p)/t,new a(e,n,i,r,o,s)},setMatrix:function(t,e,i,r,o,a){return this.m=1===arguments.length?n.clone(arguments[0]):{a:t,b:e,c:i,d:r,e:o,f:a},this},getMatrix:function(){return n.clone(this.m)},getTranslate:function(){var t=this.m;return{x:t.e/t.a,y:t.f/t.d}},mergeMatrix:function(e){return new a(t(this.m,e.m))},merge:function(t){return this.mergeMatrix(t)},toString:function(){return this.valueOf().join(" ")},valueOf:function(){var t=this.m;return[t.a,t.b,t.c,t.d,t.e,t.f]},equals:function(t){var e=this.m,n=t.m;return e.a==n.a&&e.b==n.b&&e.c==n.c&&e.d==n.d&&e.e==n.e&&e.f==n.f},transformPoint:function(){return a.transformPoint.apply(null,[].slice.call(arguments).concat([this.m]))},transformBox:function(t){return a.transformBox(t,this.m)},clone:function(){return new a(this.m)}});return a.parse=function(t){var e,n=parseFloat;if(t instanceof Array)return new a({a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]});if(e=r.exec(t)){var i=e[1].split(",");return 6!=i.length&&(i=e[1].split(" ")),new a({a:n(i[0]),b:n(i[1]),c:n(i[2]),d:n(i[3]),e:n(i[4]),f:n(i[5])})}return new a},a.transformPoint=function(t,e,n){return 2===arguments.length&&(n=e,e=t.y,t=t.x),new o(n.a*t+n.c*e+n.e,n.b*t+n.d*e+n.f)},a.transformBox=function(t,e){for(var r,o,s=Number.MAX_VALUE,l=-Number.MAX_VALUE,u=Number.MAX_VALUE,c=-Number.MAX_VALUE,h=[[t.x,t.y],[t.x+t.width,t.y],[t.x,t.y+t.height],[t.x+t.width,t.y+t.height]],d=[];r=h.pop();)o=a.transformPoint(r[0],r[1],e),d.push(o),s=Math.min(s,o.x),l=Math.max(l,o.x),u=Math.min(u,o.y),c=Math.max(c,o.y);return t=new i({x:s,y:u,width:l-s,height:c-u}),n.extend(t,{closurePoints:d}),t},a.getCTM=function(t,e){function n(t,e){var n;try{n=e.getScreenCTM().inverse()}catch(i){throw new Error("Can not inverse source element' ctm.")}return n.multiply(t.getScreenCTM())}var i={a:1,b:0,c:0,d:1,e:0,f:0},r=t.shapeNode||t.node;switch(e=e||"parent"){case"screen":i=r.getScreenCTM();break;case"doc":case"paper":i=r.getCTM();break;case"view":case"top":t.getPaper()&&(i=void 0!==r.getTransformToElement?r.getTransformToElement(t.getPaper().shapeNode):n(r,t.getPaper().shapeNode));break;case"parent":t.node.parentNode&&(i=void 0!==r.getTransformToElement?r.getTransformToElement(t.node.parentNode):n(r,t.node.parentNode));break;default:e.node&&(i=void 0!==r.getTransformToElement?r.getTransformToElement(e.shapeNode||e.node):n(r,e.shapeNode||e.node))}return i?new a(i.a,i.b,i.c,i.d,i.e,i.f):new a},a}},_p[44]={value:function(){var t=_p.r(64),e=_p.r(28),n=_p.r(12),i=_p.r(11).createClass("Palette",{constructor:function(){this.color={}},get:function(n){var i=this.color[n]||t.EXTEND_STANDARD[n]||t.COLOR_STANDARD[n]||"";return i?new e(i):null},getColorValue:function(e){return this.color[e]||t.EXTEND_STANDARD[e]||t.COLOR_STANDARD[e]||""},add:function(t,n){return this.color[t]="string"==typeof n?new e(n).toRGBA():n.toRGBA(),n},remove:function(t){return this.color.hasOwnProperty(t)?(delete this.color[t],!0):!1}});return n.extend(i,{getColor:function(n){var i=t.EXTEND_STANDARD[n]||t.COLOR_STANDARD[n];return i?new e(i):null},getColorValue:function(e){return t.EXTEND_STANDARD[e]||t.COLOR_STANDARD[e]||""},addColor:function(n,i){return t.EXTEND_STANDARD[n]="string"==typeof i?new e(i).toRGBA():i.toRGBA(),i},removeColor:function(e){return t.EXTEND_STANDARD.hasOwnProperty(e)?(delete t.EXTEND_STANDARD[e],!0):!1}}),i}},_p[45]={value:function(){var t=_p.r(11),e=_p.r(12),n=_p.r(67),i=_p.r(29),r=_p.r(61),o=_p.r(75),a=_p.r(33),s=_p.r(66),l=_p.r(43),u=t.createClass("Paper",{mixins:[r,a,s,o],constructor:function(t){this.callBase(),this.node=this.createSVGNode(),this.node.paper=this,this.node.appendChild(this.resourceNode=n.createNode("defs")),this.node.appendChild(this.shapeNode=n.createNode("g")),this.resources=new i,this.setWidth("100%").setHeight("100%"),t&&this.renderTo(t),this.callMixin()},renderTo:function(t){e.isString(t)&&(t=document.getElementById(t)),this.container=t,t.appendChild(this.node)},createSVGNode:function(){var t=n.createNode("svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),t.setAttribute("version","1.1"),t},getNode:function(){return this.node},getContainer:function(){return this.container},getWidth:function(){return this.node.clientWidth},setWidth:function(t){return this.node.setAttribute("width",t),this},getHeight:function(){return this.node.clientHeight},setHeight:function(t){return this.node.setAttribute("height",t),this},setViewPort:function(t,e,n){var i,r;1==arguments.length&&(i=arguments[0],t=i.center.x,e=i.center.y,n=i.zoom),n=n||1,r=this.getViewBox();var o=new l,a=r.x+r.width/2-t,s=r.y+r.height/2-e;return o.translate(-t,-e),o.scale(n),o.translate(t,e),o.translate(a,s),this.shapeNode.setAttribute("transform","matrix("+o+")"),this.viewport={center:{x:t,y:e},offset:{x:a,y:s},zoom:n},this},getViewPort:function(){if(!this.viewport){var t=this.getViewBox();return{zoom:1,center:{x:t.x+t.width/2,y:t.y+t.height/2},offset:{x:0,y:0}}}return this.viewport},getViewPortMatrix:function(){return l.parse(this.shapeNode.getAttribute("transform"))},getViewPortTransform:function(){var t=this.shapeNode.getCTM();return new l(t.a,t.b,t.c,t.d,t.e,t.f)},getTransform:function(){return this.getViewPortTransform().reverse()},addResource:function(t){return this.resources.appendItem(t),t.node&&this.resourceNode.appendChild(t.node),this},removeResource:function(t){return t.remove&&t.remove(),t.node&&this.resourceNode.removeChild(t.node),this},getPaper:function(){return this}}),c=_p.r(60);return t.extendClass(c,{getPaper:function(){for(var t=this.container;t&&t instanceof u==!1;)t=t.container;return t},isAttached:function(){return!!this.getPaper()},whenPaperReady:function(t){function e(){var e=n.getPaper();return e&&t&&t.call(n,e),e}var n=this;return e()||this.on("add treeadd",function i(){e()&&(n.off("add",i),n.off("treeadd",i))}),this}}),u}},_p[46]={value:function(){var t=_p.r(12),e=_p.r(11).createClass,n=_p.r(60),i=_p.r(67),r=_p.r(34),o=Array.prototype.slice,a=(t.flatten,e("PathDrawer",{constructor:function(t){this.segment=[],this.path=t,this.__clear=!1},getPath:function(){return this.path},redraw:function(){return this._transation=this._transation||[],this.clear()},done:function(){var t=this._transation;return this._transation=null,this.push(t),this},clear:function(){return this._transation?this._transation=[]:this.path.setPathData("M 0 0"),this._clear=!0,this},push:function(){var t,e=o.call(arguments);return this._transation?(this._transation.push(e),this):(this._clear?(t="",this._clear=!1):t=this.path.getPathData(),t=t||"",this.path.setPathData(t+r.pathToString(e)),this)},moveTo:function(){return this.push("M",o.call(arguments))},moveBy:function(){return this.push("m",o.call(arguments))},lineTo:function(){return this.push("L",o.call(arguments))},lineBy:function(){return this.push("l",o.call(arguments))},arcTo:function(){return this.push("A",o.call(arguments))},arcBy:function(){return this.push("a",arguments)},carcTo:function(t){return this.push("A",[t,t,0].concat(o.call(arguments,1)))},carcBy:function(t){return this.push("a",[t,t,0].concat(o.call(arguments,1)))},bezierTo:function(){return this.push("C",o.call(arguments))},bezierBy:function(){return this.push("c",o.call(arguments))},close:function(){return this.push("z")}}));return e("Path",{base:n,constructor:function(t){this.callBase("path"),t&&this.setPathData(t),this.node.setAttribute("fill",i.defaults.fill),this.node.setAttribute("stroke",i.defaults.stroke)},setPathData:function(t){return t=t||"M0,0",this.pathdata=r.pathToString(t),this.node.setAttribute("d",this.pathdata),this.trigger("shapeupdate",{type:"pathdata"}),this},getPathData:function(){return this.pathdata||""},getDrawer:function(){return new a(this)},isClosed:function(){var t=this.getPathData();return!!~t.indexOf("z")||!!~t.indexOf("Z")}})}},_p[47]={value:function(){{var t=_p.r(58),e=_p.r(61);_p.r(67)}return _p.r(11).createClass("PatternBrush",{base:t,mixins:[e],constructor:function(t){this.callBase("pattern",t),this.node.setAttribute("patternUnits","userSpaceOnUse")},setX:function(t){return this.x=t,this.node.setAttribute("x",t),this},setY:function(t){return this.y=t,this.node.setAttribute("y",t),this},setWidth:function(t){return this.width=t,this.node.setAttribute("width",t),this},setHeight:function(t){return this.height=t,this.node.setAttribute("height",t),this},getWidth:function(){return this.width},getHeight:function(){return this.height}})}},_p[48]={value:function(){var t=_p.r(28);return _p.r(11).createClass("Pen",{constructor:function(t,e){this.brush=t,this.width=e||1,this.linecap=null,this.linejoin=null,this.dashArray=null,this.opacity=1},getBrush:function(){return this.brush},setBrush:function(t){return this.brush=t,this},setColor:function(t){return this.setBrush(t)},getColor:function(){return this.brush instanceof t?this.brush:null},getWidth:function(){return this.width},setWidth:function(t){return this.width=t,this},getOpacity:function(){return this.opacity},setOpacity:function(t){this.opacity=t},getLineCap:function(){return this.linecap},setLineCap:function(t){return this.linecap=t,this},getLineJoin:function(){return this.linejoin},setLineJoin:function(t){return this.linejoin=t,this},getDashArray:function(){return this.dashArray},setDashArray:function(t){return this.dashArray=t,this},stroke:function(t){var e=t.node;e.setAttribute("stroke",this.brush.toString()),e.setAttribute("stroke-width",this.getWidth()),this.getOpacity()<1&&e.setAttribute("stroke-opacity",this.getOpacity()),this.getLineCap()&&e.setAttribute("stroke-linecap",this.getLineCap()),this.getLineJoin()&&e.setAttribute("stroke-linejoin",this.getLineJoin()),this.getDashArray()&&e.setAttribute("stroke-dasharray",this.getDashArray())}})}},_p[49]={value:function(){return _p.r(11).createClass({base:_p.r(68),constructor:function(t,e,n){this.callBase([0,t],e,n)},getRadius:function(){return this.getSectionArray()[1]},setRadius:function(t){this.setSectionArray([0,t])}})}},_p[50]={value:function(){var t=_p.r(11).createClass("Point",{constructor:function(t,e){this.x=t||0,this.y=e||0},offset:function(e,n){return 1==arguments.length&&(n=e.y,e=e.x),new t(this.x+e,this.y+n)},valueOf:function(){return[this.x,this.y]},toString:function(){return this.valueOf().join(" ")},spof:function(){return new t((0|this.x)+.5,(0|this.y)+.5)},round:function(){return new t(0|this.x,0|this.y)},isOrigin:function(){return 0===this.x&&0===this.y}});return t.fromPolar=function(e,n,i){return"rad"!=i&&(n=n/180*Math.PI),new t(e*Math.cos(n),e*Math.sin(n))},t.parse=function(e){return e?e instanceof t?e:"string"==typeof e?t.parse(e.split(/\s*[\s,]\s*/)):"0"in e&&"1"in e?new t(e[0],e[1]):void 0:new t},t}},_p[51]={value:function(){return _p.r(11).createClass("PointContainer",{base:_p.r(29),constructor:function(){this.callBase()},addPoint:function(){return this.addItem.apply(this,arguments)},prependPoint:function(){return this.prependItem.apply(this,arguments)},appendPoint:function(){return this.appendItem.apply(this,arguments)},removePoint:function(){return this.removeItem.apply(this,arguments)},addPoints:function(){return this.addItems.apply(this,arguments)},setPoints:function(){return this.setItems.apply(this,arguments)},getPoint:function(){return this.getItem.apply(this,arguments)},getPoints:function(){return this.getItems.apply(this,arguments)},getFirstPoint:function(){return this.getFirstItem.apply(this,arguments)},getLastPoint:function(){return this.getLastItem.apply(this,arguments)}})}},_p[52]={value:function(){_p.r(12);return _p.r(11).createClass("Poly",{base:_p.r(46),mixins:[_p.r(51)],constructor:function(t,e){this.callBase(),this.closeable=!!e,this.setPoints(t||[]),this.changeable=!0,this.update()},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var t=this.getDrawer(),e=this.getPoints();if(t.clear(),!e.length)return this;t.moveTo(e[0]);for(var n,i=1,r=e.length;r>i;i++)n=e[i],t.lineTo(n);return this.closeable&&e.length>2&&t.close(),this}})}},_p[53]={value:function(){return _p.r(11).createClass("Polygon",{base:_p.r(52),constructor:function(t){this.callBase(t,!0)}})}},_p[54]={value:function(){return _p.r(11).createClass("Polyline",{base:_p.r(52),constructor:function(t){this.callBase(t)}})}},_p[55]={value:function(){var t=_p.r(35);return _p.r(11).createClass("RadialGradientBrush",{base:t,constructor:function(t){this.callBase("radialGradient",t),this.setCenter(.5,.5),this.setFocal(.5,.5),this.setRadius(.5)},setCenter:function(t,e){return this.node.setAttribute("cx",t),this.node.setAttribute("cy",e),this},getCenter:function(){return{x:+this.node.getAttribute("cx"),y:+this.node.getAttribute("cy")}},setFocal:function(t,e){return this.node.setAttribute("fx",t),this.node.setAttribute("fy",e),this},getFocal:function(){return{x:+this.node.getAttribute("fx"),y:+this.node.getAttribute("fy")}},setRadius:function(t){return this.node.setAttribute("r",t),this},getRadius:function(){return+this.node.getAttribute("r")}})}},_p[56]={value:function(){var t={},e=_p.r(12),n=_p.r(50),i=_p.r(25);e.extend(t,{formatRadius:function(t,e,n){var i=Math.floor(Math.min(t/2,e/2));return Math.min(i,n)}});var r=_p.r(11).createClass("Rect",{base:_p.r(46),constructor:function(e,n,i,r,o){this.callBase(),this.x=i||0,this.y=r||0,this.width=e||0,this.height=n||0,this.radius=t.formatRadius(this.width,this.height,o||0),this.update()},update:function(){var t=this.x,e=this.y,n=this.width,i=this.height,r=this.radius,o=this.getDrawer().redraw();return r?(n-=2*r,i-=2*r,o.push("M",t+r,e),o.push("h",n),o.push("a",r,r,0,0,1,r,r),o.push("v",i),o.push("a",r,r,0,0,1,-r,r),o.push("h",-n),o.push("a",r,r,0,0,1,-r,-r),o.push("v",-i),o.push("a",r,r,0,0,1,r,-r),o.push("z")):(o.push("M",t,e),o.push("h",n),o.push("v",i),o.push("h",-n),o.push("z")),o.done(),this},setWidth:function(t){return this.width=t,this.update()},setHeight:function(t){return this.height=t,this.update()},setSize:function(t,e){return this.width=t,this.height=e,this.update()},setBox:function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.update()},getBox:function(){return new i(this.x,this.y,this.width,this.height)},getRadius:function(){return this.radius},setRadius:function(e){return this.radius=t.formatRadius(this.width,this.height,e||0),this.update()},getPosition:function(){return new n(this.x,this.y)},setPosition:function(t,e){if(1==arguments.length){var i=n.parse(arguments[0]);e=i.y,t=i.x}return this.x=t,this.y=e,this.update()},getWidth:function(){return this.width},getHeight:function(){return this.height},getPositionX:function(){return this.x},getPositionY:function(){return this.y},setPositionX:function(t){return this.x=t,this.update()},setPositionY:function(t){return this.y=t,this.update()}});return r}},_p[57]={value:function(){var t=_p.r(50);return _p.r(11).createClass("RegularPolygon",{base:_p.r(46),constructor:function(e,n,i,r){this.callBase(),this.radius=n||0,this.side=Math.max(e||3,3),arguments.length>2&&3==arguments.length&&(r=i.y,i=i.x),this.center=new t(i,r),this.draw()},getSide:function(){return this.side},setSide:function(t){return this.side=t,this.draw()},getRadius:function(){return this.radius},setRadius:function(t){return this.radius=t,this.draw()},draw:function(){var e,n=this.radius,i=this.side,r=2*Math.PI/i,o=this.getDrawer();for(o.clear(),o.moveTo(t.fromPolar(n,Math.PI/2,"rad").offset(this.center)),e=0;i>=e;e++)o.lineTo(t.fromPolar(n,r*e+Math.PI/2,"rad").offset(this.center));return o.close(),this}})}},_p[58]={value:function(){var t=_p.r(67);return _p.r(11).createClass("Resource",{constructor:function(e,n){this.callBase(),this.node=t.createNode(e),n&&n.addResource(this)},toString:function(){return"url(#"+this.node.id+")"}})}},_p[59]={value:function(){return _p.r(11).createClass({base:_p.r(68),constructor:function(t,e){this.callBase([t,e],360,0)},getInnerRadius:function(){return this.getSectionArray()[0]},getOuterRadius:function(){return this.getSectionArray()[1]},setInnerRadius:function(t){this.setSectionArray([t,this.getOuterRadius()])},setOuterRadius:function(t){this.setSectionArray([this.getInnerRadius(),t])}})}},_p[60]={value:function(){var t=_p.r(67),e=_p.r(12),n=_p.r(33),i=_p.r(66),r=_p.r(31),o=_p.r(43),a=(_p.r(48),Array.prototype.slice),s=_p.r(25),l=_p.r(11).createClass("Shape",{mixins:[n,i,r],constructor:function(e){this.node=t.createNode(e),this.node.shape=this,this.transform={translate:null,rotate:null,scale:null,matrix:null},this.callMixin()},getId:function(){return this.node.id},setId:function(t){return this.node.id=t,this},getNode:function(){return this.node},getBoundaryBox:function(){var t;try{t=this.node.getBBox()}catch(e){t={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}return new s(t)},getRenderBox:function(t){var e=this.getBoundaryBox(),n=this.getTransform(t);return n.transformBox(e)},getWidth:function(){return this.getRenderBox().width},getHeight:function(){return this.getRenderBox().height},getSize:function(){var t=this.getRenderBox();return delete t.x,delete t.y,t},setOpacity:function(t){return this.node.setAttribute("opacity",t),this},getOpacity:function(){var t=this.node.getAttribute("opacity");return t?+t:1},setVisible:function(t){return t?this.node.removeAttribute("display"):this.node.setAttribute("display","none"),this},getVisible:function(){this.node.getAttribute("display")},hasAncestor:function(t){for(var e=this.container;e;){if(e===t)return!0;e=e.container}return!1},getTransform:function(t){return o.getCTM(this,t)},clearTransform:function(){return this.node.removeAttribute("transform"),this.transform={translate:null,rotate:null,scale:null,matrix:null},this.trigger("shapeupdate",{type:"transform"}),this},_applyTransform:function(){var t=this.transform,n=[];return t.translate&&n.push(["translate(",t.translate,")"]),t.rotate&&n.push(["rotate(",t.rotate,")"]),t.scale&&n.push(["scale(",t.scale,")"]),t.matrix&&n.push(["matrix(",t.matrix,")"]),this.node.setAttribute("transform",e.flatten(n).join(" ")),this},setMatrix:function(t){return this.transform.matrix=t,this._applyTransform()},setTranslate:function(t){return this.transform.translate=null!==t&&a.call(arguments)||null,this._applyTransform()},setRotate:function(t){return this.transform.rotate=null!==t&&a.call(arguments)||null,this._applyTransform()},setScale:function(t){return this.transform.scale=null!==t&&a.call(arguments)||null,this._applyTransform()},translate:function(t,e){var n=this.transform.matrix||new o;return void 0===e&&(e=0),this.transform.matrix=n.translate(t,e),this._applyTransform()},rotate:function(t){var e=this.transform.matrix||new o;return this.transform.matrix=e.rotate(t),this._applyTransform()},scale:function(t,e){var n=this.transform.matrix||new o;return void 0===e&&(e=t),this.transform.matrix=n.scale(t,e),this._applyTransform()},skew:function(t,e){var n=this.transform.matrix||new o;return void 0===e&&(e=t),this.transform.matrix=n.skew(t,e),this._applyTransform()},stroke:function(t,e){return t&&t.stroke?t.stroke(this):t?(this.node.setAttribute("stroke",t.toString()),e&&this.node.setAttribute("stroke-width",e)):null===t&&this.node.removeAttribute("stroe"),this},fill:function(t){return t&&this.node.setAttribute("fill",t.toString()),null===t&&this.node.removeAttribute("fill"),this},setAttr:function(t,n){var i=this;return e.isObject(t)&&e.each(t,function(t,e){i.setAttr(e,t)}),void 0===n||null===n||""===n?this.node.removeAttribute(t):this.node.setAttribute(t,n),this},getAttr:function(t){return this.node.getAttribute(t)}});return l}},_p[61]={value:function(){var t=_p.r(29),e=_p.r(12),n=_p.r(11).createClass("ShapeContainer",{base:t,isShapeContainer:!0,handleAdd:function(t,e){var n=this.getShapeNode();n.insertBefore(t.node,n.childNodes[e]||null),t.trigger("add",{container:this}),t.notifyTreeModification&&t.notifyTreeModification("treeadd",this)},handleRemove:function(t){var e=this.getShapeNode();e.removeChild(t.node),t.trigger("remove",{container:this}),t.notifyTreeModification&&t.notifyTreeModification("treeremove",this)},notifyTreeModification:function(t,e){this.eachItem(function(n,i){i.notifyTreeModification&&i.notifyTreeModification(t,e),i.trigger(t,{container:e})})},getShape:function(t){return this.getItem(t)},addShape:function(t,e){return this.addItem(t,e)},put:function(t){return this.addShape(t),t},appendShape:function(t){return this.addShape(t)},prependShape:function(t){return this.addShape(t,0)},replaceShape:function(t,e){var n=this.indexOf(e);if(-1!==n)return this.removeShape(n),this.addShape(t,n),this},addShapeBefore:function(t,e){var n=this.indexOf(e);return this.addShape(t,n)},addShapeAfter:function(t,e){var n=this.indexOf(e);return this.addShape(t,-1===n?void 0:n+1)},addShapes:function(t){return this.addItems(t)},removeShape:function(t){return this.removeItem(t)},getShapes:function(){return this.getItems()},getShapesByType:function(t){function n(r){t.toLowerCase()==r.getType().toLowerCase()&&i.push(r),r.isShapeContainer&&e.each(r.getShapes(),function(t){n(t)})}var i=[];return n(this),i},getShapeById:function(t){return this.getShapeNode().getElementById(t).shape},arrangeShape:function(t,e){return this.removeShape(t).addShape(t,e)},getShapeNode:function(){return this.shapeNode||this.node}}),i=_p.r(60);return _p.r(11).extendClass(i,{bringTo:function(t){return this.container.arrangeShape(this,t),this},bringFront:function(){return this.bringTo(this.container.indexOf(this)+1)},bringBack:function(){return this.bringTo(this.container.indexOf(this)-1)},bringTop:function(){return this.container.removeShape(this).addShape(this),this},bringRear:function(){return this.bringTo(0)},bringRefer:function(t,e){return t.container&&(this.remove&&this.remove(),t.container.addShape(this,t.container.indexOf(t)+(e||0))),this},bringAbove:function(t){return this.bringRefer(t)},bringBelow:function(t){return this.bringRefer(t,1)},replaceBy:function(t){return this.container&&(t.bringAbove(this),this.remove()),this}}),n}},_p[62]={value:function(){var t=_p.r(43),e=_p.r(12),n=_p.r(50);return _p.r(11).createClass("ShapeEvent",{constructor:function(t){var n=null;e.isObject(t.target)?e.extend(this,t):(this.type=t.type,n=t.target,n.correspondingUseElement&&(n=n.correspondingUseElement),this.originEvent=t,this.targetShape=n.shape||n.paper||t.currentTarget&&(t.currentTarget.shape||t.currentTarget.paper),t._kityParam&&e.extend(this,t._kityParam))},preventDefault:function(){var t=this.originEvent;return t?t.preventDefault?(t.preventDefault(),t.cancelable):(t.returnValue=!1,!0):!0},getPosition:function(e,i){if(!this.originEvent)return null;var r=this.originEvent.touches?this.originEvent.touches[i||0]:this.originEvent,o=this.targetShape,a=o.shapeNode||o.node,s=new n(r&&r.clientX||0,r&&r.clientY||0),l=t.transformPoint(s,a.getScreenCTM().inverse()),u=t.getCTM(o,e||"view").transformPoint(l);return u},stopPropagation:function(){var t=this.originEvent;return t?void(t.stopPropagation?t.stopPropagation():t.cancelBubble=!1):!0}})}},_p[63]={value:function(){return _p.r(11).createClass("ShapePoint",{base:_p.r(50),constructor:function(t,e){this.callBase(t,e)},setX:function(t){return this.setPoint(t,this.y)},setY:function(t){return this.setPoint(this.x,t)},setPoint:function(t,e){return this.x=t,this.y=e,this.update(),this},getPoint:function(){return this},update:function(){return this.container&&this.container.update&&this.container.update(),this}})}},_p[64]={value:{COLOR_STANDARD:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",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:"#ff00ff",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:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",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:"#ff0000",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:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00"},EXTEND_STANDARD:{}}},_p[65]={value:function(){var t={3:.2,5:.38196601125,6:.57735026919,8:.541196100146,10:.726542528005,12:.707106781187},e=_p.r(50);
|
||
return _p.r(11).createClass("Star",{base:_p.r(46),constructor:function(t,n,i,r,o){this.callBase(),this.vertex=t||3,this.radius=n||0,this.shrink=i,this.offset=r||new e(0,0),this.angleOffset=o||0,this.draw()},getVertex:function(){return this.vertex},setVertex:function(t){return this.vertex=t,this.draw()},getRadius:function(){return this.radius},setRadius:function(t){return this.radius=t,this.draw()},getShrink:function(){return this.shrink},setShrink:function(t){return this.shrink=t,this.draw()},getOffset:function(){return this.offset},setOffset:function(t){return this.offset=t,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(t){return this.angleOffset=t,this.draw()},draw:function(){var n,i,r=this.radius,o=this.radius*(this.shrink||t[this.vertex]||.5),a=this.vertex,s=this.offset,l=90,u=180/a,c=this.angleOffset,h=this.getDrawer();for(h.clear(),h.moveTo(e.fromPolar(o,l)),n=1;2*a>=n;n++)i=l+u*n,h.lineTo(n%2?e.fromPolar(r,i+c).offset(s):e.fromPolar(o,i));h.close()}})}},_p[66]={value:function(){function t(t){return t.classList||(t.classList=new e(t)),t.classList}var e=_p.r(11).createClass("ClassList",{constructor:function(t){this._node=t,this._list=t.className.toString().split(" ")},_update:function(){this._node.className=this._list.join(" ")},add:function(t){this._list.push(t),this._update()},remove:function(t){var e=this._list.indexOf(t);~e&&this._list.splice(e,1),this._update()},contains:function(t){return!!~this._list.indexOf(t)}});return _p.r(11).createClass("Styled",{addClass:function(e){return t(this.node).add(e),this},removeClass:function(e){return t(this.node).remove(e),this},hasClass:function(e){return t(this.node).contains(e)},setStyle:function(t){if(2==arguments.length)return this.node.style[arguments[0]]=arguments[1],this;for(var e in t)t.hasOwnProperty(e)&&(this.node.style[e]=t[e]);return this}})}},_p[67]={value:function(){var t=document,e=0,n={createNode:function(i){var r=t.createElementNS(n.ns,i);return r.id="kity_"+i+"_"+e++,r},defaults:{stroke:"none",fill:"none"},xlink:"http://www.w3.org/1999/xlink",ns:"http://www.w3.org/2000/svg"};return n}},_p[68]={value:function(){var t=_p.r(50);return _p.r(11).createClass("Sweep",{base:_p.r(46),constructor:function(t,e,n){this.callBase(),this.sectionArray=t||[],this.angle=e||0,this.angleOffset=n||0,this.draw()},getSectionArray:function(){return this.sectionArray},setSectionArray:function(t){return this.sectionArray=t,this.draw()},getAngle:function(){return this.angle},setAngle:function(t){return this.angle=t,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(t){return this.angleOffset=t,this.draw()},draw:function(){var t,e=this.sectionArray;for(t=0;t<e.length;t+=2)this.drawSection(e[t],e[t+1]);return this},drawSection:function(e,n){var i=this.angle&&(this.angle%360?this.angle%360:360),r=this.angleOffset,o=r+i/2,a=r+i,s=0>i?0:1,l=this.getDrawer();return l.redraw(),0===i?void l.done():(l.moveTo(t.fromPolar(e,r)),l.lineTo(t.fromPolar(n,r)),n&&(l.carcTo(n,0,s,t.fromPolar(n,o)),l.carcTo(n,0,s,t.fromPolar(n,a))),l.lineTo(t.fromPolar(e,a)),e&&(l.carcTo(e,0,s,t.fromPolar(e,o)),l.carcTo(e,0,s,t.fromPolar(e,r))),l.close(),void l.done())}})}},_p[69]={value:function(){function t(t){var e=t._cachedFontHash;if(o[e])return o[e];var n=t.getContent();t.setContent("百度Fex");var i=t.getBoundaryBox(),r=t.getY(),a=r-i.y+ +t.node.getAttribute("dy"),s=a-i.height;return t.setContent(n),o[e]={top:a,bottom:s,middle:(a+s)/2}}var e=_p.r(70),n=_p.r(61),i=_p.r(67),r=_p.r(12),o={};return _p.r(11).createClass("Text",{base:e,mixins:[n],constructor:function(t){this.callBase("text"),void 0!==t&&this.setContent(t),this._buildFontHash()},_buildFontHash:function(){var t=window.getComputedStyle(this.node);this._cachedFontHash=[t.fontFamily,t.fontSize,t.fontStretch,t.fontStyle,t.fontVariant,t.fontWeight].join("-")},_fontChanged:function(t){var e=this._lastFont,n=r.extend({},e,t);if(!e)return this._lastFont=t,!0;var i=e.family!=n.family||e.size!=n.size||e.style!=n.style||e.weight!=n.weight;return this._lastFont=n,i},setX:function(t){return this.node.setAttribute("x",t),this},setPosition:function(t,e){return this.setX(t).setY(e)},setY:function(t){return this.node.setAttribute("y",t),this},getX:function(){return+this.node.getAttribute("x")||0},getY:function(){return+this.node.getAttribute("y")||0},setFont:function(t){return this.callBase(t),this._fontChanged(t)&&(this._buildFontHash(),this.setVerticalAlign(this.getVerticalAlign())),this},setTextAnchor:function(t){return this.node.setAttribute("text-anchor",t),this},getTextAnchor:function(){return this.node.getAttribute("text-anchor")||"start"},setVerticalAlign:function(e){return this.whenPaperReady(function(){var n;switch(e){case"top":n=t(this).top;break;case"bottom":n=t(this).bottom;break;case"middle":n=t(this).middle;break;default:n=0}this.node.setAttribute("dy",n)}),this.verticalAlign=e,this},getVerticalAlign:function(){return this.verticalAlign||"baseline"},setStartOffset:function(t){this.shapeNode!=this.node&&this.shapeNode.setAttribute("startOffset",100*t+"%")},addSpan:function(t){return this.addShape(t),this},setPath:function(t){var e=this.shapeNode;if(this.shapeNode==this.node){for(e=this.shapeNode=i.createNode("textPath");this.node.firstChild;)this.shapeNode.appendChild(this.node.firstChild);this.node.appendChild(e)}return e.setAttributeNS(i.xlink,"xlink:href","#"+t.node.id),this.setTextAnchor(this.getTextAnchor()),this}})}},_p[70]={value:function(){var t=_p.r(60);return _p.r(11).createClass("TextContent",{base:t,constructor:function(t){this.callBase(t),this.shapeNode=this.shapeNode||this.node,this.shapeNode.setAttribute("text-rendering","geometricPrecision")},clearContent:function(){for(;this.shapeNode.firstChild;)this.shapeNode.removeChild(this.shapeNode.firstChild);return this},setContent:function(t){return this.shapeNode.textContent=t,this},getContent:function(){return this.shapeNode.textContent},appendContent:function(t){return this.shapeNode.textContent+=t,this},setSize:function(t){return this.setFontSize(t)},setFontSize:function(t){return this.setFont({size:t})},setFontFamily:function(t){return this.setFont({family:t})},setFontBold:function(t){return this.setFont({weight:t?"bold":"normal"})},setFontItalic:function(t){return this.setFont({style:t?"italic":"normal"})},setFont:function(t){var e=this.node;return["family","size","weight","style"].forEach(function(n){null===t[n]?e.removeAttribute("font-"+n):t[n]&&e.setAttribute("font-"+n,t[n])}),this},getExtentOfChar:function(t){return this.node.getExtentOfChar(t)},getRotationOfChar:function(t){return this.node.getRotationOfChar(t)},getCharNumAtPosition:function(t,e){return this.node.getCharNumAtPosition(this.node.viewportElement.createSVGPoint(t,e))}})}},_p[71]={value:function(){var t=_p.r(70),e=_p.r(66);return _p.r(11).createClass("TextSpan",{base:t,mixins:[e],constructor:function(t){this.callBase("tspan"),this.setContent(t)}})}},_p[72]={value:function(){var t=_p.r(67),e=_p.r(11),n=e.createClass("Use",{base:_p.r(60),constructor:function(t){this.callBase("use"),this.ref(t)},ref:function(e){if(!e)return this.node.removeAttributeNS(t.xlink,"xlink:href"),this;var n=e.getId();return n&&this.node.setAttributeNS(t.xlink,"xlink:href","#"+n),"none"===e.node.getAttribute("fill")&&e.node.removeAttribute("fill"),"none"===e.node.getAttribute("stroke")&&e.node.removeAttribute("stroke"),this}}),i=_p.r(60);return e.extendClass(i,{use:function(){return new n(this)}}),n}},_p[73]={value:function(){var t=_p.r(50),e=_p.r(43),n=_p.r(11).createClass("Vector",{base:t,constructor:function(t,e){this.callBase(t,e)},square:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.square())},add:function(t){return new n(this.x+t.x,this.y+t.y)},minus:function(t){return new n(this.x-t.x,this.y-t.y)},dot:function(t){return this.x*t.x+this.y*t.y},project:function(t){return t.multipy(this.dot(t)/t.square())},normalize:function(t){return void 0===t&&(t=1),this.multipy(t/this.length())},multipy:function(t){return new n(this.x*t,this.y*t)},rotate:function(t,i){"rad"==i&&(t=t/Math.PI*180);var r=(new e).rotate(t).transformPoint(this);return new n(r.x,r.y)},vertical:function(){return new n(this.y,-this.x)},reverse:function(){return this.multipy(-1)},getAngle:function(){var t=this.length();if(0===t)return 0;var e=Math.acos(this.x/t),n=this.y>0?1:-1;return 180*n*e/Math.PI}});return n.fromPoints=function(t,e){return new n(e.x-t.x,e.y-t.y)},n.fromPolar=function(){var e=t.fromPolar.apply(t,arguments);return new n(e.x,e.y)},_p.r(11).extendClass(t,{asVector:function(){return new n(this.x,this.y)}}),n}},_p[74]={value:function(){var t=_p.r(61),e=_p.r(75);return _p.r(11).createClass("View",{mixins:[t,e],base:_p.r(74),constructor:function(){this.callBase("view")}})}},_p[75]={value:function(){return _p.r(11).createClass("ViewBox",{getViewBox:function(){var t=this.node.getAttribute("viewBox");return null===t?{x:0,y:0,width:this.node.clientWidth||this.node.parentNode.clientWidth,height:this.node.clientHeight||this.node.parentNode.clientHeight}:(t=t.split(" "),{x:+t[0],y:+t[1],width:+t[2],height:+t[3]})},setViewBox:function(t,e,n,i){return this.node.setAttribute("viewBox",[t,e,n,i].join(" ")),this}})}},_p[76]={value:function(){var t={},e=_p.r(12);return t.version="2.0.0",e.extend(t,{createClass:_p.r(11).createClass,extendClass:_p.r(11).extendClass,Utils:e,Browser:_p.r(10),Box:_p.r(25),Bezier:_p.r(23),BezierPoint:_p.r(24),Circle:_p.r(26),Clip:_p.r(27),Color:_p.r(28),Container:_p.r(29),Curve:_p.r(30),Ellipse:_p.r(32),Group:_p.r(36),Gradient:_p.r(35),HyperLink:_p.r(37),Image:_p.r(38),Line:_p.r(39),LinearGradient:_p.r(40),Mask:_p.r(42),Matrix:_p.r(43),Marker:_p.r(41),Palette:_p.r(44),Paper:_p.r(45),Path:_p.r(46),Pattern:_p.r(47),Pen:_p.r(48),Point:_p.r(50),PointContainer:_p.r(51),Polygon:_p.r(53),Polyline:_p.r(54),Pie:_p.r(49),RadialGradient:_p.r(55),Resource:_p.r(58),Rect:_p.r(56),RegularPolygon:_p.r(57),Ring:_p.r(59),Shape:_p.r(60),ShapePoint:_p.r(63),ShapeContainer:_p.r(61),Sweep:_p.r(68),Star:_p.r(65),Text:_p.r(69),TextSpan:_p.r(71),Use:_p.r(72),Vector:_p.r(73),g:_p.r(34),Animator:_p.r(0),Easing:_p.r(1),OpacityAnimator:_p.r(4),RotateAnimator:_p.r(6),ScaleAnimator:_p.r(7),Timeline:_p.r(8),TranslateAnimator:_p.r(9),PathAnimator:_p.r(5),MotionAnimator:_p.r(3),requestFrame:_p.r(2).requestFrame,releaseFrame:_p.r(2).releaseFrame,Filter:_p.r(20),GaussianblurFilter:_p.r(21),ProjectionFilter:_p.r(22),ColorMatrixEffect:_p.r(13),CompositeEffect:_p.r(14),ConvolveMatrixEffect:_p.r(15),Effect:_p.r(16),GaussianblurEffect:_p.r(17),OffsetEffect:_p.r(18)}),window.kity=t}};var moduleMapping={kity:76};use("kity")}();var KityMinder=window.KM=window.KityMinder=function(){var t={},e=0,n={};return{version:"1.3.5",uuid:function(t){return t=t||"unknown",n[t]=n[t]||0,++n[t],t+"_"+n[t]},createMinder:function(t,e){e=e||{},e.renderTo=Utils.isString(t)?document.getElementById(t):t;var n=new Minder(e);return this.addMinder(e.renderTo,n),n},addMinder:function(n,i){var r;r="string"==typeof n?n:n.id||"KM_INSTANCE_"+e++,t[r]=i},getMinder:function(n,i){var r;return r="string"==typeof n?n:n.id||"KM_INSTANCE_"+e++,t[r]||this.createMinder(n,i)},LANG:{}}}(),utils=Utils=KityMinder.Utils={extend:kity.Utils.extend.bind(kity.Utils),listen:function(t,e,n){var i=utils.isArray(e)?e:utils.trim(e).split(/\s+/),r=i.length;if(r)for(;r--;)if(e=i[r],t.addEventListener)t.addEventListener(e,n,!1);else{n._d||(n._d={els:[]});var o=e+n.toString(),a=utils.indexOf(n._d.els,t);n._d[o]&&-1!=a||(-1==a&&n._d.els.push(t),n._d[o]||(n._d[o]=function(t){return n.call(t.srcElement,t||window.event)}),t.attachEvent("on"+e,n._d[o]))}t=null},trim:function(t){return t.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g,"")},each:function(t,e,n){if(null!=t)if(t.length===+t.length){for(var i=0,r=t.length;r>i;i++)if(e.call(n,i,t[i],t)===!1)return!1}else for(var o in t)if(t.hasOwnProperty(o)&&e.call(n,o,t[o],t)===!1)return!1},addCssRule:function(t,e,n){var i;return void 0===e||e&&e.nodeType&&9==e.nodeType?(n=e&&e.nodeType&&9==e.nodeType?e:n||document,i=n.getElementById(t),i?i.innerHTML:void 0):(n=n||document,i=n.getElementById(t),""===e?i?(i.parentNode.removeChild(i),!0):!1:void(i?i.innerHTML=e:(i=n.createElement("style"),i.id=t,i.innerHTML=e,n.getElementsByTagName("head")[0].appendChild(i))))},keys:function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},proxy:function(t,e){return function(){return t.apply(e,arguments)}},indexOf:function(t,e,n){var i=-1;return n=this.isNumber(n)?n:0,this.each(t,function(t,r){return r>=n&&t===e?(i=r,!1):void 0}),i},argsToArray:function(t,e){return Array.prototype.slice.call(t,e||0)},clonePlainObject:function(t,e){var n;e=e||{};for(var i in t)t.hasOwnProperty(i)&&(n=t[i],utils.isObject(n)||utils.isArray(n)?(e[i]=utils.isArray(n)?[]:{},utils.clonePlainObject(t[i],e[i])):e[i]=n);return e},compareObject:function(t,e){var n;if(this.isEmptyObject(t)!==this.isEmptyObject(e))return!1;if(this.getObjectLength(t)!=this.getObjectLength(e))return!1;for(var i in t)if(t.hasOwnProperty(i)){if(n=t[i],void 0===e[i])return!1;if(this.isObject(n)||this.isArray(n)){if(this.isObject(e[i])!==this.isObject(n))return!1;if(this.isArray(n)!==this.isArray(e[i]))return!1;if(this.compareObject(n,e[i])===!1)return!1}else if(n!=e[i])return!1}return!0},getObjectLength:function(t){if(this.isArray(t)||this.isString(t))return t.length;var e=0;for(var n in t)t.hasOwnProperty(n)&&e++;return e},isEmptyObject:function(t){if(null==t)return!0;if(this.isArray(t)||this.isString(t))return 0===t.length;for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},loadFile:function(){function t(t,n){try{for(var i,r=0;i=e[r++];)if(i.doc===t&&i.url==(n.src||n.href))return i}catch(o){return null}}var e=[];return function(n,i,r){var o=t(n,i);if(o)return void(o.ready?r&&r():o.funs.push(r));if(e.push({doc:n,url:i.src||i.href,funs:[r]}),!n.body){var a=[];for(var s in i)"tag"!=s&&a.push(s+'="'+i[s]+'"');return void n.write("<"+i.tag+" "+a.join(" ")+" ></"+i.tag+">")}if(!i.id||!n.getElementById(i.id)){var l=n.createElement(i.tag);delete i.tag;for(var s in i)l.setAttribute(s,i[s]);l.onload=l.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){if(o=t(n,i),o.funs.length>0){o.ready=1;for(var e;e=o.funs.pop();)e()}l.onload=l.onreadystatechange=null}},n.getElementsByTagName("head")[0].appendChild(l)}}}(),clone:function(t,e){var n;e=e||{};for(var i in t)t.hasOwnProperty(i)&&(n=t[i],"object"==typeof n?(e[i]=utils.isArray(n)?[]:{},utils.clone(t[i],e[i])):e[i]=n);return e},unhtml:function(t,e){return t?t.replace(e||/[&<">'](?:(amp|lt|quot|gt|#39|nbsp);)?/g,function(t,e){return e?t:{"<":"<","&":"&",'"':""",">":">","'":"'"}[t]}):""},cloneArr:function(t){return[].concat(t)},clearWhitespace:function(t){return t.replace(/[\u200b\t\r\n]/g,"")},getValueByIndex:function(t,e){var n=0,i=0;return utils.each(t,function(t,r){if(n+r.length>=e){if(e-n==r.length){if(1==r.length&&0===r[0].width)return void n++;i={x:r[r.length-1].x+r[r.length-1].width,y:r[r.length-1].y}}else i=r[e-n];return!1}n+=r.length+(1==r.length&&0===r[0].width?0:1)}),i},getNodeIndex:function(t,e){for(var n=t,i=0;n=n.previousSibling;)e&&3==n.nodeType?n.nodeType!=n.nextSibling.nodeType&&i++:i++;return i}};Utils.each(["String","Function","Array","Number","RegExp","Object"],function(t,e){KityMinder.Utils["is"+e]=function(t){return Object.prototype.toString.apply(t)=="[object "+e+"]"}});var browser=KityMinder.browser=function(){var t=navigator.userAgent.toLowerCase(),e=window.opera,n={ie:/(msie\s|trident.*rv:)([\w.]+)/.test(t),opera:!!e&&e.version,webkit:t.indexOf(" applewebkit/")>-1,mac:t.indexOf("macintosh")>-1,quirks:"BackCompat"==document.compatMode,ipad:t.indexOf("ipad")>-1};n.gecko="Gecko"==navigator.product&&!n.webkit&&!n.opera&&!n.ie;var i=0;if(n.ie){var r=t.match(/(?:msie\s([\w.]+))/),o=t.match(/(?:trident.*rv:([\w.]+))/);i=r&&o&&r[1]&&o[1]?Math.max(1*r[1],1*o[1]):r&&r[1]?1*r[1]:o&&o[1]?1*o[1]:0,n.ie11Compat=11==document.documentMode,n.ie9Compat=9==document.documentMode,n.ie8=!!document.documentMode,n.ie8Compat=8==document.documentMode,n.ie7Compat=7==i&&!document.documentMode||7==document.documentMode,n.ie6Compat=7>i||n.quirks,n.ie9above=i>8,n.ie9below=9>i}if(n.gecko){var a=t.match(/rv:([\d\.]+)/);a&&(a=a[1].split("."),i=1e4*a[0]+100*(a[1]||0)+1*(a[2]||0))}return/chrome\/(\d+\.\d)/i.test(t)&&(n.chrome=+RegExp.$1),/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(t)&&!/chrome/i.test(t)&&(n.safari=+(RegExp.$1||RegExp.$2)),n.opera&&(i=parseFloat(e.version())),n.webkit&&(i=parseFloat(t.match(/ applewebkit\/(\d+)/)[1])),n.version=i,n.isCompatible=!n.mobile&&(n.ie&&i>=6||n.gecko&&i>=10801||n.opera&&i>=9.5||n.air&&i>=1||n.webkit&&i>=522||!1),n}(),ie=browser.ie,webkit=browser.webkit,gecko=browser.gecko,opera=browser.opera,Minder=KityMinder.Minder=kity.createClass("KityMinder",{constructor:function(t){this._options=Utils.extend(window.KITYMINDER_CONFIG||{},t);for(var e=Minder._initFnQueue.slice();e.length;)e.shift().call(this,t);this.fire("ready")}});Minder._initFnQueue=[],Minder.registerInit=function(t){Minder._initFnQueue.push(t)};var Command=kity.createClass("Command",{constructor:function(){this._isContentChange=!0,this._isSelectionChange=!1},execute:function(){},setContentChanged:function(t){this._isContentChange=!!t},isContentChanged:function(){return this._isContentChange},setSelectionChanged:function(t){this._isSelectionChange=!!t},isSelectionChanged:function(){return this._isContentChange},queryState:function(){return 0},queryValue:function(){return 0},isNeedUndo:function(){return!0}});kity.extendClass(Minder,{_getCommand:function(t){return this._commands[t.toLowerCase()]},_queryCommand:function(t,e,n){var i=this._getCommand(t);if(i){var r=i["query"+e];if(r)return r.apply(i,[this].concat(n))}return 0},queryCommandState:function(t){return this._queryCommand(t,"State",Utils.argsToArray(1))},queryCommandValue:function(t){return this._queryCommand(t,"Value",Utils.argsToArray(1))},execCommand:function(t){t=t.toLowerCase();var e,n,i,r,o=Utils.argsToArray(arguments,1),a=this;return e=this._getCommand(t),r={command:e,commandName:t.toLowerCase(),commandArgs:o},e&&~this.queryCommandState(t)?(!this._hasEnterExecCommand&&e.isNeedUndo()?(this._hasEnterExecCommand=!0,n=this._fire(new MinderEvent("beforeExecCommand",r,!0)),n||(this._fire(new MinderEvent("saveScene")),this._fire(new MinderEvent("preExecCommand",r,!1)),i=e.execute.apply(e,[a].concat(o)),this._fire(new MinderEvent("execCommand",r,!1)),this._fire(new MinderEvent("saveScene")),e.isContentChanged()&&this._firePharse(new MinderEvent("contentchange")),this._interactChange()),this._hasEnterExecCommand=!1):(i=e.execute.apply(e,[a].concat(o)),this._hasEnterExecCommand||this._interactChange()),void 0===i?null:i):!1}});var MinderNode=KityMinder.MinderNode=kity.createClass("MinderNode",{constructor:function(t){this.parent=null,this.root=this,this.children=[],this.data={},this.tmpData={},this.initContainers(),Utils.isString(t)?this.setText(t):this.setData(t)},initContainers:function(){this.rc=(new kity.Group).setId(KityMinder.uuid("minder_node")),this.rc.minderNode=this},isRoot:function(){return this.root===this},isLeaf:function(){return 0===this.children.length},getRoot:function(){return this.root||this},getParent:function(){return this.parent},getLevel:function(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t},getComplex:function(){var t=0;return this.traverse(function(){t++}),t},getType:function(){return this.type=["root","main","sub"][Math.min(this.getLevel(),2)],this.type},isAncestorOf:function(t){for(var e=t.parent;e;){if(e==this)return!0;e=e.parent}return!1},setText:function(t){return utils.isArray(t)&&(t=t.join("\n")),this.setData("text",t)},getText:function(t){var e=this.getData("text")||"";return t&&(e=e.split("\n")),e},preTraverse:function(t,e){var n=this.getChildren();e||t(this);for(var i=0;i<n.length;i++)n[i].preTraverse(t)},postTraverse:function(t,e){for(var n=this.getChildren(),i=0;i<n.length;i++)n[i].postTraverse(t);e||t(this)},traverse:function(t,e){return this.postTraverse(t,e)},getChildren:function(){return this.children},getIndex:function(){return this.parent?this.parent.children.indexOf(this):-1},insertChild:function(t,e){void 0===e&&(e=this.children.length),t.parent&&t.parent.removeChild(t),t.parent=this,t.root=this.root,this.children.splice(e,0,t)},appendChild:function(t){return this.insertChild(t)},prependChild:function(t){return this.insertChild(t,0)},removeChild:function(t){var e,n=t;t instanceof MinderNode&&(n=this.children.indexOf(t)),n>=0&&(e=this.children.splice(n,1)[0],e.parent=null,e.root=e)},getChild:function(t){return this.children[t]},getFirstChild:function(){return this.children[0]},getLastChild:function(){return this.children[this.children.length-1]},getData:function(t){return void 0===t?this.data:this.data[t]},setData:function(t,e){return void 0===t?this.data={}:utils.isObject(t)?Utils.extend(this.data,t):void 0===e?(this.data[t]=null,delete this.data[t]):this.data[t]=e,this},getRenderContainer:function(){return this.rc},getCommonAncestor:function(t){return Utils.getNodeCommonAncestor(this,t)},contains:function(t){return this==t||this.isAncestorOf(t)},clone:function(){function t(e,n){var i=new KM.MinderNode;i.data=Utils.clonePlainObject(n.getData()),i.tmpData=Utils.clonePlainObject(n.getTmpData()),e&&e.appendChild(i);for(var r,o=0;r=n.children[o++];)t(i,r);return i}return t(null,this)},equals:function(t,e){function n(){r&&i.setSelectedFlag(),o&&t.setSelectedFlag()}var i=this;if(e){var r=!1,o=!1;i.isSelected()&&(r=!0,i.clearSelectedFlag()),t.isSelected()&&(o=!0,t.clearSelectedFlag())}if(t.children.length!=this.children.length)return n(),!1;if(utils.compareObject(t.getData(),i.getData())===!1)return n(),!1;if(utils.compareObject(t.getTmpData(),i.getTmpData())===!1)return n(),!1;for(var a,s=0;a=i.children[s];s++)if(a.equals(t.children[s],e)===!1)return n(),!1;return n(),!0},clearChildren:function(){this.children=[]},setTmpData:function(t,e){var n=this;utils.isObject(t)&&utils.each(t,function(t,e){n.setTmpData(t,e)}),void 0===e||null===e||""===e?delete this.tmpData[t]:this.tmpData[t]=e},getTmpData:function(t){return void 0===t?this.tmpData:this.tmpData[t]},setValue:function(t){return this.data={},this.setData(utils.clonePlainObject(t.getData())),this.tmpData={},this.setTmpData(utils.clonePlainObject(t.getTmpData())),this}});MinderNode.getCommonAncestor=function(t,e){if(t instanceof Array)return MinderNode.getCommonAncestor.apply(this,t);switch(arguments.length){case 1:return t.parent||t;case 2:if(t.isAncestorOf(e))return t;if(e.isAncestorOf(t))return e;for(var n=t.parent;n&&!n.isAncestorOf(e);)n=n.parent;return n;default:return Array.prototype.reduce.call(arguments,function(t,e){return MinderNode.getCommonAncestor(t,e)},t)}},kity.extendClass(Minder,{getRoot:function(){return this._root},setRoot:function(t){this._root=t,t.minder=this},createNode:function(t,e,n){var i=new MinderNode(t);return this.fire("nodecreate",{node:i,parent:e,index:n}),this.appendNode(i,e,n),i},appendNode:function(t,e,n){return e&&e.insertChild(t,n),this.attachNode(t),this},removeNode:function(t){t.parent&&(t.parent.removeChild(t),this.detachNode(t),this.fire("noderemove",{node:t}))},attachNode:function(t){var e=this._rc;t.traverse(function(t){t.attached=!0,e.addShape(t.getRenderContainer())}),e.addShape(t.getRenderContainer()),this.fire("nodeattach",{node:t})},detachNode:function(t){var e=this._rc;t.traverse(function(t){t.attached=!1,e.removeShape(t.getRenderContainer())}),this.fire("nodedetach",{node:t})},getMinderTitle:function(){return this.getRoot().getText()}}),kity.extendClass(MinderNode,{getMinder:function(){return this.getRoot().minder}}),kity.extendClass(Minder,{getOptions:function(t){var e;return t?(e=this.getPreferences(t),e&&e[t]||this._options[t]):(e=this.getPreferences(),utils.extend(e,this._options,!0))},setDefaultOptions:function(t,e,n){var i={};Utils.isString(t)?i[t]=e:i=t,utils.extend(this._options,i,!n)},setOptions:function(t,e){this.setPreferences(t,e)}}),Minder.registerInit(function(){this.setDefaultOptions(KM.defaultOptions)});var MinderEvent=kity.createClass("MindEvent",{constructor:function(t,e,n){e=e||{},e.getType&&"ShapeEvent"==e.getType()?(this.kityEvent=e,this.originEvent=e.originEvent,this.getPosition=e.getPosition.bind(e)):e.target&&e.preventDefault?this.originEvent=e:kity.Utils.extend(this,e),this.type=t,this._canstop=n||!1},getTargetNode:function(){var t=this.kityEvent&&this.kityEvent.targetShape;if(!t)return null;for(;!t.minderNode&&t.container;)t=t.container;var e=t.minderNode;return e&&t.getOpacity()<1?null:e||null},stopPropagation:function(){this._stoped=!0},stopPropagationImmediately:function(){this._immediatelyStoped=!0,this._stoped=!0},shouldStopPropagation:function(){return this._canstop&&this._stoped},shouldStopPropagationImmediately:function(){return this._canstop&&this._immediatelyStoped},preventDefault:function(){this.originEvent.preventDefault()},isRightMB:function(){var t=!1;return this.originEvent?("which"in this.originEvent?t=3==this.originEvent.which:"button"in this.originEvent&&(t=2==this.originEvent.button),t):!1},getKeyCode:function(){var t=this.originEvent;return t.keyCode||t.which}});Minder.registerInit(function(){this._initEvents()}),kity.extendClass(Minder,{_initEvents:function(){this._eventCallbacks={}},_bindEvents:function(){this._bindPaperEvents(),this._bindKeyboardEvents()},_resetEvents:function(){this._initEvents(),this._bindEvents()},_bindPaperEvents:function(){this._paper.on("click dblclick mousedown contextmenu mouseup mousemove mouseover mousewheel DOMMouseScroll touchstart touchmove touchend dragenter dragleave drop",this._firePharse.bind(this)),window&&(window.addEventListener("resize",this._firePharse.bind(this)),window.addEventListener("blur",this._firePharse.bind(this)))},_bindKeyboardEvents:function(){-1==navigator.userAgent.indexOf("iPhone")&&-1==navigator.userAgent.indexOf("iPod")&&-1==navigator.userAgent.indexOf("iPad")&&Utils.listen(document.body,"keydown keyup keypress paste",this._firePharse.bind(this))},_firePharse:function(t){var e,n,i;"DOMMouseScroll"==t.type&&(t.type="mousewheel",t.wheelDelta=t.originEvent.wheelDelta=-10*t.originEvent.detail,t.wheelDeltaX=t.originEvent.mozMovementX,t.wheelDeltaY=t.originEvent.mozMovementY),e=new MinderEvent("before"+t.type,t,!0),this._fire(e)||(n=new MinderEvent("pre"+t.type,t,!0),i=new MinderEvent(t.type,t,!0),(this._fire(n)||this._fire(i))&&this._fire(new MinderEvent("after"+t.type,t,!1)))},_interactChange:function(){var t=this;t._interactScheduled||(setTimeout(function(){t._fire(new MinderEvent("interactchange")),t._interactScheduled=!1},100),t._interactScheduled=!0)},_listen:function(t,e){var n=this._eventCallbacks[t]||(this._eventCallbacks[t]=[]);n.push(e)},_fire:function(t){var e=this.getStatus(),n=this._eventCallbacks[t.type.toLowerCase()]||[];if(e&&(n=n.concat(this._eventCallbacks[e+"."+t.type.toLowerCase()]||[])),0!==n.length){for(var i=(this.getStatus(),0);i<n.length&&(n[i].call(this,t),!t.shouldStopPropagationImmediately());i++);return t.shouldStopPropagation()}},on:function(t,e){var n=this;return utils.each(t.split(/\s+/),function(t,i){n._listen(i.toLowerCase(),e)}),this},off:function(t,e){var n,i,r,o,a=t.split(/\s+/);for(n=0;n<a.length;n++)if(r=this._eventCallbacks[a[n].toLowerCase()]){for(o=null,i=0;i<r.length;i++)r[i]==e&&(o=i);null!==o&&r.splice(o,1)}},fire:function(t,e){var n=new MinderEvent(t,e);return this._fire(n),this}}),Minder.registerInit(function(){this._initStatus()}),kity.extendClass(Minder,{_initStatus:function(){this._status="normal",this._rollbackStatus="normal"},setStatus:function(){var t=~window.location.href.indexOf("status"),e=~window.location.href.indexOf("trace");return function(n,i){return"readonly"!=this._status||i?(n!=this._status&&(this._rollbackStatus=this._status,this._status=n,this.fire("statuschange",{lastStatus:this._rollbackStatus,currentStatus:this._status}),t&&(console.log(window.event.type,this._rollbackStatus,"->",this._status),e&&console.trace())),this):this}}(),rollbackStatus:function(){this.setStatus(this._rollbackStatus)},getRollbackStatus:function(){return this._rollbackStatus},getStatus:function(){return this._status}}),Minder.registerInit(function(){this._initPaper()}),kity.extendClass(Minder,{_initPaper:function(){this._paper=new kity.Paper,this._paper.getNode().setAttribute("contenteditable",!0),this._paper.getNode().ondragstart=function(t){t.preventDefault()},this._paper.shapeNode.setAttribute("transform","translate(0.5, 0.5)"),this._addRenderContainer(),this.setRoot(this.createNode(this.getLang().maintopic)),this._options.renderTo&&this.renderTo(this._options.renderTo)},_addRenderContainer:function(){this._rc=(new kity.Group).setId(KityMinder.uuid("minder")),this._paper.addShape(this._rc)},renderTo:function(t){this._paper.renderTo(this._renderTarget=t),this._bindEvents()},getRenderContainer:function(){return this._rc},getPaper:function(){return this._paper},getRenderTarget:function(){return this._renderTarget}}),Minder.registerInit(function(){this._initSelection()}),kity.extendClass(Minder,{_initSelection:function(){this._selectedNodes=[]},renderChangedSelection:function(t){var e=this.getSelectedNodes(),n=[],i=0;for(e.forEach(function(e){-1==t.indexOf(e)&&(n.push(e),e.setTmpData("selected",!0))}),t.forEach(function(t){-1==e.indexOf(t)&&(n.push(t),t.setTmpData("selected",!1))}),n.length&&(this._interactChange(),this.fire("selectionchange"));i<n.length;)n[i++].render()},getSelectedNodes:function(){return this._selectedNodes},getSelectedNode:function(){return this.getSelectedNodes()[0]||null},removeAllSelectedNodes:function(){var t=this._selectedNodes.splice(0);return this._selectedNodes=[],this.renderChangedSelection(t),this.fire("selectionclear")},removeSelectedNodes:function(t){var e=this,n=this._selectedNodes.slice(0);return t=Utils.isArray(t)?t:[t],Utils.each(t,function(t,n){var i;-1!==(i=e._selectedNodes.indexOf(n))&&e._selectedNodes.splice(i,1)}),this.renderChangedSelection(n),this},select:function(t,e){var n=this.getSelectedNodes().slice(0);e&&(this._selectedNodes=[]);var i=this;return t=Utils.isArray(t)?t:[t],Utils.each(t,function(t,e){-1===i._selectedNodes.indexOf(e)&&i._selectedNodes.push(e)}),this.renderChangedSelection(n),this},toggleSelect:function(t){return Utils.isArray(t)?t.forEach(this.toggleSelect.bind(this)):t.isSelected()?this.removeSelectedNodes(t):this.select(t),this},isSingleSelect:function(){return 1==this._selectedNodes.length},getSelectedAncestors:function(t){function e(t,e){for(var n=t.length-1;n>=0;--n)if(t[n].isAncestorOf(e))return!0;return!1}var n,i=this.getSelectedNodes().slice(0),r=[],o=i.indexOf(this.getRoot());for(~o&&!t&&i.splice(o,1),i.sort(function(t,e){return t.getLevel()-e.getLevel()});n=i.pop();)e(i,n)||r.push(n);return r}}),kity.extendClass(MinderNode,{isSelected:function(){return this.getTmpData("selected")},clearSelectedFlag:function(){this.setTmpData("selected")},setSelectedFlag:function(){this.setTmpData("selected",!0)}}),kity.extendClass(MinderEvent,{isShortcutKey:function(t){var e=this.originEvent;return e?getMetaKeyCode(t)==getMetaKeyCode(e):!1}}),Minder.registerInit(function(){this._initShortcutKey()}),kity.extendClass(Minder,{_initShortcutKey:function(){this._bindShortcutKeys()},_bindShortcutKeys:function(){var t=this._shortcutKeys={},e="hasOwnProperty";this.on("keydown",function(n){for(var i in t)if(t[e](i)&&n.isShortcutKey(i)){var r=t[i];if(r.__statusCondition&&r.__statusCondition!=this.getStatus())return;r(),n.preventDefault()}})},addShortcut:function(t,e){var n=this._shortcutKeys;t.split(/\|\s*/).forEach(function(t){var i,r=t.split("::");r.length>1&&(t=r[1],i=r[0],e.__statusCondition=i),n[t]=e})},addCommandShortcutKeys:function(t,e){var n=this._commandShortcutKeys||(this._commandShortcutKeys={}),i={};e?i[t]=e:i=t;var r=this;utils.each(i,function(t,e){n[t]=e,r.addShortcut(e,function(){0===r.queryCommandState(t)&&r.execCommand(t)})})},getCommandShortcutKey:function(t){var e=this._commandShortcutKeys;
|
||
return e&&e[t]||null}}),Minder.registerInit(function(){this._initContextMenu()}),kity.extendClass(Minder,{_initContextMenu:function(){this.contextmenus=[]},addContextMenu:function(t){return utils.isArray(t)?this.contextmenus=this.contextmenus.concat(t):this.contextmenus.push(t),this},getContextMenu:function(){return this.contextmenus}}),function(){var t;KityMinder.registerModule=function(e,n){t||(t={}),t[e]=n},KityMinder.getModules=function(){return t}}(),Minder.registerInit(function(){this._initModules()}),kity.extendClass(Minder,{_initModules:function(){var t=KityMinder.getModules(),e=this._options.modules||Utils.keys(t);this._commands={},this._query={},this._modules={},this._rendererClasses={};var n,i,r,o,a,s,l,u=this;for(n=0;n<e.length;n++)if(i=e[n],t[i]&&(o="function"==typeof t[i]?t[i].call(u):t[i],this._modules[i]=o,o)){o.init&&o.init.call(u,this._options),a=o.commands;for(i in a)this._commands[i.toLowerCase()]=new a[i];if(s=o.events)for(r in s)u.on(r,s[r]);if(l=o.renderers)for(r in l)this._rendererClasses[r]=this._rendererClasses[r]||[],Utils.isArray(l[r])?this._rendererClasses[r]=this._rendererClasses[r].concat(l[r]):this._rendererClasses[r].push(l[r]);o.defaultOptions&&this.setDefaultOptions(o.defaultOptions),o.commandShortcutKeys&&this.addCommandShortcutKeys(o.commandShortcutKeys),o.contextmenu&&this.addContextMenu(o.contextmenu)}},_garbage:function(){for(this.clearSelect();this._root.getChildren().length;)this._root.removeChild(0)},destroy:function(){var t=this._modules;this._resetEvents(),this._garbage();for(var e in t)t[e].destroy&&t[e].destroy.call(this)},reset:function(){var t=this._modules;this._garbage();for(var e in t)t[e].reset&&t[e].reset.call(this)}}),Utils.extend(KityMinder,{_protocols:{},registerProtocol:function(t,e){KityMinder._protocols[t]=e}});var DEFAULT_TEXT={root:"maintopic",main:"topic",sub:"topic"};Minder.registerInit(function(){this._initProtocols()}),kity.extendClass(Minder,{_initProtocols:function(){var t=this._protocols={},e=KityMinder._protocols;for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n](this)),t[n].name=n},getProtocol:function(t){return this._protocols[t]||null},getSupportedProtocols:function(){var t=this._protocols;return Utils.keys(t).map(function(e){return t[e]})},exportJson:function(){function t(e){var n={};n.data=e.getData();var i=e.getChildren();if(i.length){n.children=[];for(var r=0;r<i.length;r++)n.children.push(t(i[r]))}return n}var e=t(this.getRoot());return e.template=this.getTemplate(),e.theme=this.getTheme(),e.version=KityMinder.version,e},importJson:function(t,e){function n(t,e,i){var r=e.data;t.data={};for(var o in r)t.setData(o,r[o]);t.setData("text",r.text||i.getLang(DEFAULT_TEXT[t.getType()]));for(var a=e.children||[],s=0;s<a.length;s++){var l=i.createNode(null,t);n(l,a[s],i)}return t}if(t){for(this._fire(new MinderEvent("preimport",e,!1));this._root.getChildren().length;)this.removeNode(this._root.getChildren()[0]);t=KityMinder.compatibility(t),n(this._root,t,this),this.setTemplate(t.template||"default"),this.setTheme(t.theme||null),this.refresh(),this.fire("import",e),this._firePharse({type:"contentchange"}),this._interactChange()}},exportData:function(t,e){var n,i;return n=this.exportJson(),!t||(i=this.getProtocol(t),i&&i.encode)?(this._fire(new MinderEvent("beforeexport",{json:n,protocolName:t,protocol:i})),Promise.resolve(i?i.encode(n,this,e):n)):Promise.reject(new Error("Not supported protocol:"+t))},importData:function(t,e){var n,i=this;if(e&&(n=this.getProtocol(e),!n||!n.decode))return Promise.reject(new Error("Not supported protocol:"+e));var r={local:t,protocolName:e,protocol:n};return this._fire(new MinderEvent("beforeimport",r)),new Promise(function(e){e(n?n.decode(t):t)}).then(function(t){return i.importJson(t,r),t})}}),Minder.registerInit(function(t){t.readOnly&&this.setDisabled()}),kity.extendClass(Minder,{disable:function(){var t=this;t.bkqueryCommandState=t.queryCommandState,t.bkqueryCommandValue=t.queryCommandValue,t.queryCommandState=function(e){var n=this._getCommand(e);return n&&n.enableReadOnly?t.bkqueryCommandState.apply(t,arguments):-1},t.queryCommandValue=function(e){var n=this._getCommand(e);return n&&n.enableReadOnly?t.bkqueryCommandValue.apply(t,arguments):null},this.setStatus("readonly"),t._interactChange()},enable:function(){var t=this;t.bkqueryCommandState&&(t.queryCommandState=t.bkqueryCommandState,delete t.bkqueryCommandState),t.bkqueryCommandValue&&(t.queryCommandValue=t.bkqueryCommandValue,delete t.bkqueryCommandValue),this.setStatus("normal"),t._interactChange()}}),Utils.extend(KityMinder,{_layout:{},registerLayout:function(t,e){KityMinder._layout[t]=e,KityMinder._defaultLayout||(KityMinder._defaultLayout=t)},getLayoutList:function(){return this._layout},getLayoutInstance:function(t){var e=KityMinder._layout[t];if(!e)throw new Error("Missing Layout: "+t);var n=new e;return n}}),kity.extendClass(MinderNode,{getLayout:function(){var t=this.getData("layout");return t=t||(this.isRoot()?KityMinder._defaultLayout:this.parent.getLayout())},setLayout:function(t){return t&&("inherit"==t?this.setData("layout"):this.setData("layout",t)),this},layout:function(t,e){return this.setLayout(t).getMinder().layout(e),this},getLayoutInstance:function(){return KityMinder.getLayoutInstance(this.getLayout())},getOrderHint:function(){return this.parent.getLayoutInstance().getOrderHint(this)},getExpandPosition:function(){return this.getLayoutInstance().getExpandPosition()},getLayoutTransform:function(){return this._layoutTransform||new kity.Matrix},getGlobalLayoutTransformPreview:function(){var t=this.parent?this.parent.getLayoutTransform():new kity.Matrix,e=this.getLayoutTransform(),n=this.getLayoutOffset();return n&&e.translate(n.x,n.y),t.merge(e)},getLayoutPointPreview:function(){return this.getGlobalLayoutTransformPreview().transformPoint(new kity.Point)},getGlobalLayoutTransform:function(){return this._globalLayoutTransform?this._globalLayoutTransform:this.parent?this.parent.getGlobalLayoutTransform():new kity.Matrix},setLayoutTransform:function(t){return this._layoutTransform=t,this},setGlobalLayoutTransform:function(t){return this.getRenderContainer().setMatrix(this._globalLayoutTransform=t),this},setVertexIn:function(t){this._vertexIn=t},setVertexOut:function(t){this._vertexOut=t},getVertexIn:function(){return this._vertexIn||new kity.Point},getVertexOut:function(){return this._vertexOut||new kity.Point},getLayoutVertexIn:function(){return this.getGlobalLayoutTransform().transformPoint(this.getVertexIn())},getLayoutVertexOut:function(){return this.getGlobalLayoutTransform().transformPoint(this.getVertexOut())},setLayoutVectorIn:function(t){return this._layoutVectorIn=t,this},setLayoutVectorOut:function(t){return this._layoutVectorOut=t,this},getLayoutVectorIn:function(){return this._layoutVectorIn||new kity.Vector},getLayoutVectorOut:function(){return this._layoutVectorOut||new kity.Vector},getLayoutBox:function(){var t=this.getGlobalLayoutTransform();return t.transformBox(this.getContentBox())},getLayoutPoint:function(){var t=this.getGlobalLayoutTransform();return t.transformPoint(new kity.Point)},getLayoutOffset:function(){if(!this.parent)return new kity.Point;var t=this.getData("layout_"+this.parent.getLayout()+"_offset");return t?new kity.Point(t.x,t.y):new kity.Point},setLayoutOffset:function(t){if(!this.parent)return this;if(t&&!this.hasLayoutOffset()){var e=this.getLayoutTransform().m;t=t.offset(e.e,e.f),this.setLayoutTransform(null)}return this.setData("layout_"+this.parent.getLayout()+"_offset",t?{x:t.x,y:t.y}:null),this},hasLayoutOffset:function(){return!!this.getData("layout_"+this.parent.getLayout()+"_offset")},resetLayoutOffset:function(){return this.setLayoutOffset(null)},getLayoutRoot:function(){return this.isLayoutRoot()?this:this.parent.getLayoutRoot()},isLayoutRoot:function(){return this.getData("layout")||this.isRoot()}}),Minder.registerInit(function(){this.refresh()}),kity.extendClass(Minder,{layout:function(t){function e(t,n){t.children.forEach(function(t){e(t,n)});var i=t.getLayoutInstance(),r=t.getChildren().filter(function(t){return!t.hasLayoutOffset()});i.doLayout(t,r,n)}this.getRoot().traverse(function(t){t.setLayoutTransform(null)}),e(this.getRoot(),1),e(this.getRoot(),2),t=t?300:0;var n=this;return this.applyLayoutResult(this.getRoot(),t).then(function(){n.fire("layoutallfinish")}),this.fire("layout")},refresh:function(t){return this.getRoot().renderTree(),this.layout(t).fire("contentchange")._interactChange(),this},applyLayoutResult:function(t,e){function n(){--l||a.resolve()}function i(t,e){t.setGlobalLayoutTransform(e),o.fire("layoutapply",{node:t,matrix:e})}function r(t,a){var s=t.getLayoutTransform().merge(a),l=t.getGlobalLayoutTransform()||new kity.Matrix,u=t.getLayoutOffset();s.translate(u.x,u.y),s.m.e=Math.round(s.m.e),s.m.f=Math.round(s.m.f),t._layoutTimeline&&(t._layoutTimeline.stop(),t._layoutTimeline=null),e?t._layoutTimeline=new kity.Animator(l,s,i).start(t,e,"ease").on("finish",function(){setTimeout(function(){i(t,s),o.fire("layoutfinish",{node:t,matrix:s}),n()},150)}):(i(t,s),o.fire("layoutfinish",{node:t,matrix:s}),n());for(var c=0;c<t.children.length;c++)r(t.children[c],s)}t=t||this.getRoot();var o=this,a={},s=new Promise(function(t,e){a.resolve=t,a.reject=e}),l=t.getComplex();return l>200&&(e=0),r(t,t.parent?t.parent.getGlobalLayoutTransform():new kity.Matrix),s}});var Layout=kity.createClass("Layout",{doLayout:function(){throw new Error("Not Implement: Layout.doLayout()")},align:function(t,e,n){var i=this;n=n||0,t.forEach(function(t){var r=i.getTreeBox([t]),o=t.getLayoutTransform();switch(e){case"left":return o.translate(n-r.left,0);case"right":return o.translate(n-r.right,0);case"top":return o.translate(0,n-r.top);case"bottom":return o.translate(0,n-r.bottom)}})},stack:function(t,e,n){var i=this,r=0;return n=n||function(t,e,n){return t.getStyle({x:"margin-right",y:"margin-bottom"}[n])+e.getStyle({x:"margin-left",y:"margin-top"}[n])},t.forEach(function(t,o,a){var s=i.getTreeBox([t]),l={x:s.width,y:s.height}[e],u={x:s.left,y:s.top}[e],c=t.getLayoutTransform();"x"==e?c.translate(r-u,0):c.translate(0,r-u),r+=l,a[o+1]&&(r+=n(t,a[o+1],e))}),r},move:function(t,e,n){t.forEach(function(t){t.getLayoutTransform().translate(e,n)})},getBranchBox:function(t){var e,n,i,r,o=new kity.Box;for(e=0;e<t.length;e++)n=t[e],i=n.getLayoutTransform(),r=n.getContentBox(),o=o.merge(i.transformBox(r));return o},getTreeBox:function(t){var e,n,i,r,o=KityMinder.Geometry,a={x:0,y:0,height:0,width:0};for(t instanceof Array||(t=[t]),e=0;e<t.length;e++)n=t[e],i=n.getLayoutTransform(),r=n.getContentBox(),n.isExpanded()&&n.children.length&&(r=o.mergeBox(r,this.getTreeBox(n.children))),a=o.mergeBox(a,i.transformBox(r));return a},getOrderHint:function(){return[]}}),LayoutCommand=kity.createClass("LayoutCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNodes();n.forEach(function(t){t.layout(e)})},queryValue:function(t){var e=t.getSelectedNode();return e?e.getData("layout"):void 0},queryState:function(t){return t.getSelectedNode()?0:-1}}),ResetLayoutCommand=kity.createClass("ResetLayoutCommand",{base:Command,execute:function(t){var e=t.getSelectedNodes();e.length||(e=[t.getRoot()]),e.forEach(function(t){t.traverse(function(t){t.resetLayoutOffset(),t.isRoot()||t.setData("layout",null)})}),t.layout(300)},enableReadOnly:!0});KityMinder.registerModule("LayoutModule",{commands:{layout:LayoutCommand,resetlayout:ResetLayoutCommand},contextmenu:[{command:"resetlayout"},{divider:!0}],commandShortcutKeys:{resetlayout:"Ctrl+Shift+L"}});var cssLikeValueMatcher={left:function(t){return 3 in t&&t[3]||1 in t&&t[1]||t[0]},right:function(t){return 1 in t&&t[1]||t[0]},top:function(t){return t[0]},bottom:function(t){return 2 in t&&t[2]||t[0]}};Utils.extend(KityMinder,{_themes:{},registerTheme:function(t,e){KityMinder._themes[t]=e},getThemeList:function(){return KityMinder._themes}}),kity.extendClass(Minder,{useTheme:function(t){return this.setTheme(t),this.refresh(800),!0},setTheme:function(t){this._theme=t||null,this.getRenderTarget().style.background=this.getStyle("background"),this.fire("themechange",{theme:t})},getTheme:function(){return this._theme||this.getOptions("defaultTheme")},getThemeItems:function(t){this.getTheme(t);return KityMinder._themes[this.getTheme(t)]},getStyle:function(t,e){var n,i,r,o,a=this.getThemeItems(e);if(t in a)return a[t];if(n=t.split("-"),n.length<2)return null;if(i=n.pop(),t=n.join("-"),t in a){if(r=a[t],Utils.isArray(r)&&(o=cssLikeValueMatcher[i]))return o(r);if(!isNaN(r))return r}return null},getNodeStyle:function(t,e){var n=this.getStyle(t.getType()+"-"+e,t);return null!==n?n:this.getStyle(e,t)}}),kity.extendClass(MinderNode,{getStyle:function(t){return this.getMinder().getNodeStyle(this,t)}}),KityMinder.registerModule("Theme",{defaultOptions:{defaultTheme:"fresh-blue"},commands:{theme:kity.createClass("ThemeCommand",{base:Command,execute:function(t,e){return t.useTheme(e)},queryValue:function(t){return t.getTheme()||"default"}})}}),Minder.registerInit(function(){this.setTheme()}),Utils.extend(KityMinder,{compatibility:function(t){function e(t,n){n(t),t.children&&t.children.forEach(function(t){e(t,n)})}function n(t){e(t,function(t){var e=t.data;delete e.layout_bottom_offset,delete e.layout_default_offset,delete e.layout_filetree_offset})}function i(t){var n=t.data.currentstyle;delete t.data.currentstyle,"bottom"==n?(t.template="structure",t.theme="snow"):"default"==n&&(t.template="default",t.theme="classic"),e(t,function(t){var e=t.data;"PriorityIcon"in e&&(e.priority=e.PriorityIcon,delete e.PriorityIcon),"ProgressIcon"in e&&(e.progress=1+(e.ProgressIcon-1<<1),delete e.ProgressIcon),delete e.point,delete e.layout})}var r=t.version||"1.1.3";switch(r){case"1.1.3":i(t);case"1.2.0":case"1.2.1":n(t)}return t}});var Renderer=KityMinder.Renderer=kity.createClass("Renderer",{constructor:function(t){this.node=t},create:function(){throw new Error("Not implement: Renderer.create()")},shouldRender:function(){return!0},watchChange:function(t){var e;e=void 0===this.watchingData?!0:this.watchingData!=t?!0:!1,this.watchingData=t},shouldDraw:function(){return!0},update:function(t,e,n){return this.shouldDraw()&&this.draw(t,e),this.place(t,e,n)},draw:function(){throw new Error("Not implement: Renderer.draw()")},place:function(){throw new Error("Not implement: Renderer.place()")},getRenderShape:function(){return this._renderShape||null},setRenderShape:function(t){this._renderShape=t}});kity.extendClass(Minder,function(){function t(t,e){var n=[];["center","left","right","top","bottom","outline","outside"].forEach(function(t){var i="before"+t,r="after"+t;e[i]&&(n=n.concat(e[i])),e[t]&&(n=n.concat(e[t])),e[r]&&(n=n.concat(e[r]))}),t._renderers=n.map(function(e){return new e(t)})}return{renderNodeBatch:function(e){var n,i,r,o,a=this._rendererClasses,s=[],l=0;if(e.length){for(i=0;i<e.length;i++)o=e[i],o._renderers||t(o,a),o._contentBox=new kity.Box,this.fire("beforerender",{node:o});for(l=e[0]._renderers.length,n=0;l>n;n++){for(i=0;i<e.length;i++)"function"==typeof s[i]&&(s[i]=s[i]()),s[i]instanceof kity.Box||(s[i]=new kity.Box(s[i]));for(i=0;i<e.length;i++)o=e[i],r=o._renderers[n],s[i]&&(o._contentBox=o._contentBox.merge(s[i])),r.shouldRender(o)?(r.getRenderShape()||(r.setRenderShape(r.create(o)),r.bringToBack?o.getRenderContainer().prependShape(r.getRenderShape()):o.getRenderContainer().appendShape(r.getRenderShape())),r.getRenderShape().setVisible(!0),s[i]=r.update(r.getRenderShape(),o,o._contentBox)):r.getRenderShape()&&(r.getRenderShape().setVisible(!1),s[i]=null)}for(i=0;i<e.length;i++)this.fire("noderender",{node:e[i]})}},renderNode:function(e){console.log(e);{var n,i=this._rendererClasses;KityMinder.Geometry}e._renderers||t(e,i),this.fire("beforerender",{node:e}),e._contentBox=new kity.Box,e._renderers.forEach(function(t){t.shouldRender(e)?(t.getRenderShape()||(t.setRenderShape(t.create(e)),t.bringToBack?e.getRenderContainer().prependShape(t.getRenderShape()):e.getRenderContainer().appendShape(t.getRenderShape())),t.getRenderShape().setVisible(!0),n=t.update(t.getRenderShape(),e,e._contentBox),"function"==typeof n&&(n=n()),n&&(e._contentBox=e._contentBox.merge(n))):t.getRenderShape()&&t.getRenderShape().setVisible(!1)}),this.fire("noderender",{node:e})}}}()),kity.extendClass(MinderNode,{render:function(){return this.attached?(this.getMinder().renderNode(this),this):void 0},renderTree:function(){if(this.attached){var t=[];return this.traverse(function(e){t.push(e)}),this.getMinder().renderNodeBatch(t),this}},getRenderer:function(t){for(var e=this._renderers,n=0;n<e.length;n++)if(e[n].getType()==t)return e[n];return null},getContentBox:function(){return this.parent&&this.parent.isCollapsed()?new kity.Box:this._contentBox||new kity.Box}}),utils.extend(KityMinder,{_connectProviders:{},_defaultConnectProvider:function(t,e,n){n.setPathData(["M",e.getLayoutVertexOut(),"L",t.getLayoutVertexIn()])},registerConnectProvider:function(t,e){KityMinder._connectProviders[t]=e},getConnectProvider:function(t){return KityMinder._connectProviders[t]||KityMinder._defaultConnectProvider}}),kity.extendClass(MinderNode,{getConnectProvider:function(){return KityMinder.getConnectProvider(this.getConnect())},getConnect:function(){return null},getConnection:function(){return this._connection||null}}),kity.extendClass(Minder,{getConnectContainer:function(){return this._connectContainer},createConnect:function(t){if(!t.isRoot()){var e=new kity.Path;t._connection=e,this._connectContainer.addShape(e),this.updateConnect(t)}},removeConnect:function(t){var e=this;t.traverse(function(t){e._connectContainer.removeShape(t._connection),t._connection=null})},updateConnect:function(t){var e=t._connection,n=t.parent;if(n&&e){if(n.isCollapsed())return void e.setVisible(!1);e.setVisible(!0);var i=t.getConnectProvider(),r=t.getStyle("connect-color")||"white",o=t.getStyle("connect-width")||2;e.stroke(r,o),i(t,n,e,o,r),o%2===0?e.setTranslate(.5,.5):e.setTranslate(0,0)}}}),KityMinder.registerModule("Connect",{init:function(){this._connectContainer=(new kity.Group).setId(KityMinder.uuid("minder_connect_group")),this.getRenderContainer().prependShape(this._connectContainer)},events:{nodeattach:function(t){this.createConnect(t.node)},nodedetach:function(t){this.removeConnect(t.node)},"layoutapply layoutfinish noderender":function(t){this.updateConnect(t.node)}}}),utils.extend(KityMinder,{_templates:{},registerTemplate:function(t,e){KityMinder._templates[t]=e},getTemplateList:function(){return KityMinder._templates}}),kity.extendClass(Minder,function(){var t=Minder.prototype.getTheme;return{useTemplate:function(t,e){this.setTemplate(t),this.refresh(e||800)},getTemplate:function(){return this._template||"default"},setTemplate:function(t){this._template=t||null},getTemplateSupport:function(t){var e=KityMinder._templates[this.getTemplate()];return e&&e[t]},getTheme:function(e){var n=this.getTemplateSupport("getTheme")||t;return n.call(this,e)}}}()),kity.extendClass(MinderNode,function(){var t=MinderNode.prototype.getLayout,e=MinderNode.prototype.getConnect;return{getLayout:function(){var e=this.getMinder().getTemplateSupport("getLayout")||t;return e.call(this,this)},getConnect:function(){var t=this.getMinder().getTemplateSupport("getConnect")||e;return t.call(this,this)}}}()),KityMinder.registerModule("TemplateModule",{commands:{template:kity.createClass("TemplateCommand",{base:Command,execute:function(t,e){t.useTemplate(e),t.execCommand("camera")},queryValue:function(t){return t.getTemplate()||"default"}})}}),kity.extendClass(Minder,{getLang:function(t){var e=KM.LANG[this.getOptions("lang")];if(!e)throw Error("not import language file");t=(t||"").split(".");for(var n,i=0;(n=t[i++])&&(e=e[n],e););if("string"==typeof e){var r=arguments;return e.replace(/\{(\d+)\}/gi,function(t,e){return void 0!=r[+e+1]&&r[+e+1].toString()||t})}return e}}),KM.defaultOptions={zIndex:1e3,lang:"zh-cn",readyOnly:!1},kity.extendClass(Minder,function(){var t="kityminder_preference",e=function(){var t=window.localStorage;return{saveLocalData:function(e,n){return t&&n?(t.setItem(e,n),!0):!1},getLocalData:function(e){return t?t.getItem(e):null},removeItem:function(e){t&&t.removeItem(e)}}}();return{setPreferences:function(n,i){var r={};Utils.isString(n)?r[n]=i:r=n;var o=e.getLocalData(t);o?(o=JSON.parse(o),utils.extend(o,r)):o=r,e.saveLocalData(t,JSON.stringify(o))},getPreferences:function(n){var i=e.getLocalData(t);return i?(i=JSON.parse(i),n?i[n]:i):{}},resetPreferences:function(t){var n=t?JSON.stringify(t):"";e.saveLocalData(n)}}}());var keymap=KityMinder.keymap=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n],e[n.toLowerCase()]=t[n]);var i=65,r="a".charCodeAt(0);"abcdefghijklmnopqrstuvwxyz".split("").forEach(function(t){e[t]=i+(t.charCodeAt(0)-r)});var o=9;do e[o.toString()]=o+48;while(--o);return e}({Backspace:8,Tab:9,Enter:13,Shift:16,Control:17,Alt:18,CapsLock:20,Esc:27,Spacebar:32,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Left:37,Up:38,Right:39,Down:40,direction:{37:1,38:1,39:1,40:1},Del:46,NumLock:144,Cmd:91,CmdFF:224,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,"`":192,"=":187,"-":189,"/":191,".":190,controlKeys:{16:1,17:1,18:1,20:1,91:1,224:1},notContentChange:{13:1,9:1,33:1,34:1,35:1,36:1,16:1,17:1,18:1,20:1,91:1,37:1,38:1,39:1,40:1,113:1,114:1,115:1,144:1,27:1},isSelectedNodeKey:{37:1,38:1,39:1,40:1,13:1,9:1}});KityMinder.registerLayout("mind",kity.createClass({base:Layout,doLayout:function(t,e){var n=Math.ceil(t.children.length/2),i=[],r=[];e.forEach(function(t){t.getIndex()<n?i.push(t):r.push(t)});var o=KityMinder.getLayoutInstance("left"),a=KityMinder.getLayoutInstance("right");o.doLayout(t,r),a.doLayout(t,i);var s=t.getContentBox();t.setVertexOut(new kity.Point(s.cx,s.cy)),t.setLayoutVectorOut(new kity.Vector(0,0))},getOrderHint:function(t){var e=[],n=t.getLayoutBox(),i=5;return e.push({type:"up",node:t,area:{x:n.x,y:n.top-t.getStyle("margin-top")-i,width:n.width,height:t.getStyle("margin-top")},path:["M",n.x,n.top-i,"L",n.right,n.top-i]}),e.push({type:"down",node:t,area:{x:n.x,y:n.bottom+i,width:n.width,height:t.getStyle("margin-bottom")},path:["M",n.x,n.bottom+i,"L",n.right,n.bottom+i]}),e}})),[-1,1].forEach(function(t){var e="filetree-"+(t>0?"down":"up");KityMinder.registerLayout(e,kity.createClass({base:Layout,doLayout:function(e,n){var i=e.getContentBox(),r=20;if(e.setVertexOut(new kity.Point(i.left+r,t>0?i.bottom:i.top)),e.setLayoutVectorOut(new kity.Vector(0,t)),n.length){n.forEach(function(t){var e=t.getContentBox();t.setLayoutTransform(new kity.Matrix),t.setVertexIn(new kity.Point(e.left,e.cy)),t.setLayoutVectorIn(new kity.Vector(1,0))}),this.align(n,"left"),this.stack(n,"y");var o=0;o+=i.left,o+=r,o+=n[0].getStyle("margin-left");var a=0;t>0?(a+=i.bottom,a+=e.getStyle("margin-bottom"),a+=n[0].getStyle("margin-top")):(a-=this.getTreeBox(n).bottom,a+=i.top,a-=e.getStyle("margin-top"),a-=n[0].getStyle("margin-bottom")),this.move(n,o,a)}},getOrderHint:function(t){var e=[],n=t.getLayoutBox(),i=t.getLevel()>1?3:5;return e.push({type:"up",node:t,area:{x:n.x,y:n.top-t.getStyle("margin-top")-i,width:n.width,height:t.getStyle("margin-top")},path:["M",n.x,n.top-i,"L",n.right,n.top-i]}),e.push({type:"down",node:t,area:{x:n.x,y:n.bottom+i,width:n.width,height:t.getStyle("margin-bottom")},path:["M",n.x,n.bottom+i,"L",n.right,n.bottom+i]}),e}}))});var layouts=["left","right","top","bottom"];layouts.forEach(function(t){function e(t){var e=[],i=t.getLayoutBox(),r=5;return"x"==n?(e.push({type:"up",node:t,area:{x:i.x,y:i.top-t.getStyle("margin-top")-r,width:i.width,height:t.getStyle("margin-top")},path:["M",i.x,i.top-r,"L",i.right,i.top-r]}),e.push({type:"down",node:t,area:{x:i.x,y:i.bottom+r,width:i.width,height:t.getStyle("margin-bottom")},path:["M",i.x,i.bottom+r,"L",i.right,i.bottom+r]})):(e.push({type:"up",node:t,area:{x:i.left-t.getStyle("margin-left")-r,y:i.top,width:t.getStyle("margin-left"),height:i.height},path:["M",i.left-r,i.top,"L",i.left-r,i.bottom]}),e.push({type:"down",node:t,area:{x:i.right+r,y:i.top,width:t.getStyle("margin-right"),height:i.height},path:["M",i.right+r,i.top,"L",i.right+r,i.bottom]})),e}var n="left"==t||"right"==t?"x":"y",i="left"==t||"top"==t?-1:1,r={left:"right",right:"left",top:"bottom",bottom:"top",x:"y",y:"x"};KityMinder.registerLayout(t,kity.createClass({base:Layout,doLayout:function(e,o){var a=e.getContentBox();if("x"==n?(e.setVertexOut(new kity.Point(a[t],a.cy)),e.setLayoutVectorOut(new kity.Vector(i,0))):(e.setVertexOut(new kity.Point(a.cx,a[t])),e.setLayoutVectorOut(new kity.Vector(0,i))),!o.length)return!1;o.forEach(function(e){var o=e.getContentBox();e.setLayoutTransform(new kity.Matrix),"x"==n?(e.setVertexIn(new kity.Point(o[r[t]],o.cy)),e.setLayoutVectorIn(new kity.Vector(i,0))):(e.setVertexIn(new kity.Point(o.cx,o[r[t]])),e.setLayoutVectorIn(new kity.Vector(0,i)))}),this.align(o,r[t]),this.stack(o,r[n]);var s,l,u=this.getBranchBox(o);"x"==n?(s=a[t],s+=i*e.getStyle("margin-"+t),s+=i*o[0].getStyle("margin-"+r[t]),l=a.bottom,l-=a.height/2,l-=u.height/2,l-=u.y):(s=a.right,s-=a.width/2,s-=u.width/2,s-=u.x,l=a[t],l+=i*e.getStyle("margin-"+t),l+=i*o[0].getStyle("margin-"+r[t])),this.move(o,s,l)},getOrderHint:e}))}),KityMinder.registerLayout("fish-bone-master",kity.createClass("FishBoneMasterLayout",{base:Layout,doLayout:function(t,e){var n=[],i=[],r=e[0],o=t.getContentBox();if(t.setVertexOut(new kity.Point(o.right,o.cy)),t.setLayoutVectorOut(new kity.Vector(1,0)),r){var a=(r.getContentBox(),t.getStyle("margin-right")),s=r.getStyle("margin-left"),l=r.getStyle("margin-top"),u=r.getStyle("margin-bottom");e.forEach(function(t,e){t.setLayoutTransform(new kity.Matrix);var r=t.getContentBox();e%2?(i.push(t),t.setVertexIn(new kity.Point(r.left,r.top)),t.setLayoutVectorIn(new kity.Vector(1,1))):(n.push(t),t.setVertexIn(new kity.Point(r.left,r.bottom)),t.setLayoutVectorIn(new kity.Vector(1,-1)))}),this.stack(n,"x"),this.stack(i,"x"),this.align(n,"bottom"),this.align(i,"top");var c=o.right+a+s,h=o.cy-u-t.getStyle("margin-top"),d=o.cy+l+t.getStyle("margin-bottom");this.move(n,c,h),this.move(i,c+s,d)}}})),KityMinder.registerLayout("fish-bone-slave",kity.createClass("FishBoneSlaveLayout",{base:Layout,doLayout:function(t,e,n){var i=this,r=Math.abs,o=.382,a=t.getContentBox(),s=t.getLayoutVectorIn();t.setLayoutVectorOut(s);var l=a.left+a.width*o,u=new kity.Point(l,s.y>0?a.bottom:a.top);t.setVertexOut(u);var c=e[0];if(c){var h=c.getContentBox();e.forEach(function(t){t.setLayoutTransform(new kity.Matrix),t.setLayoutVectorIn(new kity.Vector(1,0)),t.setVertexIn(new kity.Point(h.left,h.cy))}),this.stack(e,"y"),this.align(e,"left");var d=0,f=0;d+=u.x,t.getLayoutVectorOut().y<0?(f-=this.getTreeBox(e).bottom,f+=t.getContentBox().top,f-=t.getStyle("margin-top"),f-=c.getStyle("margin-bottom")):(f+=t.getContentBox().bottom,f+=t.getStyle("margin-bottom"),f+=c.getStyle("margin-top")),this.move(e,d,f),2==n&&e.forEach(function(t){var e=t.getLayoutTransform(),n=t.getContentBox(),o=e.transformPoint(new kity.Point(n.left,0));i.move([t],r(o.y-u.y),0)})}}})),KityMinder.registerLayout("tianpan",kity.createClass({base:Layout,doLayout:function(t,e){if(0!=e.length){var n,i,r,o=this,a=t.getContentBox(),s=5,l=Math.max(a.width,50);e.forEach(function(t){t.setLayoutTransform(new kity.Matrix),r=o.getTreeBox(t),l=Math.max(Math.max(r.width,r.height),l)}),l=l/1.5/Math.PI,e.forEach(function(t,e){n=l*(Math.cos(s)+Math.sin(s)*s),i=l*(Math.sin(s)-Math.cos(s)*s),s+=.9-.02*e,t.setLayoutVectorIn(new kity.Vector(1,0)),t.setVertexIn(new kity.Point(a.cx,a.cy)),t.setLayoutTransform(new kity.Matrix),o.move([t],n,i)})}},getOrderHint:function(t){var e=[],n=t.getLayoutBox(),i=5;return e.push({type:"up",node:t,area:{x:n.x,y:n.top-t.getStyle("margin-top")-i,width:n.width,height:t.getStyle("margin-top")},path:["M",n.x,n.top-i,"L",n.right,n.top-i]}),e.push({type:"down",node:t,area:{x:n.x,y:n.bottom+i,width:n.width,height:t.getStyle("margin-bottom")},path:["M",n.x,n.bottom+i,"L",n.right,n.bottom+i]}),e}})),KityMinder.registerConnectProvider("bezier",function(t,e,n){var i=e.getLayoutVertexOut(),r=t.getLayoutVertexIn(),o=e.getLayoutVectorOut().normalize(),a=Math.round,s=Math.abs,l=[];if(l.push("M",a(i.x),a(i.y)),s(o.x)>s(o.y)){var u=(r.x+i.x)/2;l.push("C",u,i.y,u,r.y,r.x,r.y)}else{var c=(r.y+i.y)/2;l.push("C",i.x,c,r.x,c,r.x,r.y)}n.setMarker(null),n.setPathData(l)}),KityMinder.registerConnectProvider("poly",function(t,e,n){var i=e.getLayoutVertexOut(),r=t.getLayoutVertexIn(),o=e.getLayoutVectorOut().normalize(),a=Math.round,s=Math.abs,l=[];switch(l.push("M",a(i.x),a(i.y)),!0){case s(o.x)>s(o.y)&&o.x<0:l.push("h",-e.getStyle("margin-left")),l.push("v",r.y-i.y),l.push("H",r.x);break;case s(o.x)>s(o.y)&&o.x>=0:l.push("h",e.getStyle("margin-right")),l.push("v",r.y-i.y),l.push("H",r.x);break;case s(o.x)<=s(o.y)&&o.y<0:l.push("v",-e.getStyle("margin-top")),l.push("h",r.x-i.x),l.push("V",r.y);break;case s(o.x)<=s(o.y)&&o.y>=0:l.push("v",e.getStyle("margin-bottom")),l.push("h",r.x-i.x),l.push("V",r.y)}n.setMarker(null),n.setPathData(l)});var connectMarker=(new kity.Marker).pipe(function(){var t=7,e=new kity.Circle(t-1);this.addShape(e),this.setRef(t-1,0).setViewBox(-t,-t,t+t,t+t).setWidth(t).setHeight(t),this.dot=e,this.node.setAttribute("markerUnits","userSpaceOnUse")});KityMinder.registerConnectProvider("arc",function(t,e,n,i,r){var o,a,s,l=t.getLayoutBox(),u=e.getLayoutBox(),c=Math.abs,h=[],d=l.x>u.x?"right":"left";t.getMinder().getPaper().addResource(connectMarker),o=new kity.Point(u.cx,u.cy),a="left"==d?new kity.Point(l.right+2,l.cy):new kity.Point(l.left-2,l.cy),s=kity.Vector.fromPoints(o,a),h.push("M",o),h.push("A",c(s.x),c(s.y),0,0,s.x*s.y>0?0:1,a),n.setMarker(connectMarker),connectMarker.dot.fill(r),n.setPathData(h)}),KityMinder.registerConnectProvider("under",function(t,e,n){var i,r,o,a,s=t.getLayoutBox(),l=e.getLayoutBox(),u=(Math.abs,[]),c=s.x>l.x?"right":"left",h=(t.getStyle("connect-radius"),s.bottom+3),d="sub"==e.getType()?l.bottom+3:l.cy;"right"==c?(i=new kity.Point(l.right,d),r=new kity.Point(s.left-10,h),o=new kity.Point(s.right,h)):(i=new kity.Point(l.left,d),r=new kity.Point(s.right+10,h),o=new kity.Point(s.left,h)),a=(i.x+r.x)/2,u.push("M",i),u.push("C",a,i.y,a,r.y,r),u.push("L",o),n.setMarker(null),n.setPathData(u)}),KityMinder.registerConnectProvider("l",function(t,e,n){var i=e.getLayoutVertexOut(),r=t.getLayoutVertexIn(),o=e.getLayoutVectorOut(),a=[],s=Math.round,l=Math.abs;a.push("M",i.round()),l(o.x)>l(o.y)?a.push("H",s(r.x)):a.push("V",r.y),a.push("L",r),n.setPathData(a)}),KityMinder.registerConnectProvider("fish-bone-master",function(t,e,n){var i=e.getLayoutVertexOut(),r=t.getLayoutVertexIn(),o=Math.abs,a=o(i.y-r.y),s=o(i.x-r.x),l=[];l.push("M",i.x,i.y),l.push("h",s-a),l.push("L",r.x,r.y),n.setMarker(null),n.setPathData(l)});var connectMarker=(new kity.Marker).pipe(function(){var t=7,e=new kity.Circle(t-1);this.addShape(e),this.setRef(t-1,0).setViewBox(-t,-t,t+t,t+t).setWidth(t).setHeight(t),this.dot=e,this.node.setAttribute("markerUnits","userSpaceOnUse")});KityMinder.registerConnectProvider("arc_tp",function(t,e,n,i,r){var o=t.getLayoutBox(),a=e.getLayoutBox();if(t.getIndex()>0){var s=t.getIndex();a=e.getChildren()[s-1].getLayoutBox()}{var l,u,c,h=(Math.abs,[]);o.x>a.x?"right":"left"}t.getMinder().getPaper().addResource(connectMarker),l=new kity.Point(a.cx,a.cy),u=new kity.Point(o.cx,o.cy);var d=Math.sqrt(Math.abs(l.x-u.x)*Math.abs(l.x-u.x)+Math.abs(l.y-u.y)*Math.abs(l.y-u.y));d=0==t.getIndex()?.4*d:d,c=kity.Vector.fromPoints(l,u),h.push("M",l),h.push("A",d,d,0,0,1,u),n.setMarker(connectMarker),connectMarker.dot.fill(r),n.setPathData(h)}),["classic","classic-compact"].forEach(function(t){var e="classic-compact"==t;KityMinder.registerTheme(t,{background:"#3A4144 url(ui/theme/default/images/grid.png) repeat","root-color":"#430","root-background":"#e9df98","root-stroke":"#e9df98","root-font-size":24,"root-padding":e?[10,25]:[15,25],"root-margin":e?[15,25]:[30,100],"root-radius":30,"root-space":10,"root-shadow":"rgba(0, 0, 0, .25)","main-color":"#333","main-background":"#a4c5c0","main-stroke":"#a4c5c0","main-font-size":16,"main-padding":e?[5,15]:[6,20],"main-margin":e?[5,10]:20,"main-radius":10,"main-space":5,"main-shadow":"rgba(0, 0, 0, .25)","sub-color":"white","sub-background":"transparent","sub-stroke":"none","sub-font-size":12,"sub-padding":[5,10],"sub-margin":e?[5,10]:[15,20],"sub-tree-margin":30,"sub-radius":5,"sub-space":5,"connect-color":"white","connect-width":2,"main-connect-width":3,"connect-radius":5,"selected-background":"rgb(254, 219, 0)","selected-stroke":"rgb(254, 219, 0)","selected-color":"black","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","sub-drop-hint-width":2,"main-drop-hint-width":4,"root-drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.5})
|
||
}),["snow","snow-compact"].forEach(function(t){var e="snow-compact"==t;KityMinder.registerTheme(t,{background:"#3A4144 url(ui/theme/default/images/grid.png) repeat","root-color":"#430","root-background":"#e9df98","root-stroke":"#e9df98","root-font-size":24,"root-padding":e?[5,10]:[15,25],"root-margin":e?15:30,"root-radius":5,"root-space":10,"root-shadow":"rgba(0, 0, 0, .25)","main-color":"#333","main-background":"#a4c5c0","main-stroke":"#a4c5c0","main-font-size":16,"main-padding":e?[4,10]:[6,20],"main-margin":e?[5,10]:[20,40],"main-radius":5,"main-space":5,"main-shadow":"rgba(0, 0, 0, .25)","sub-color":"black","sub-background":"white","sub-stroke":"white","sub-font-size":12,"sub-padding":[5,10],"sub-margin":e?[5,10]:[10,20],"sub-radius":5,"sub-space":5,"connect-color":"white","connect-width":2,"main-connect-width":3,"connect-radius":5,"selected-background":"rgb(254, 219, 0)","selected-stroke":"rgb(254, 219, 0)","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.5})}),function(){function t(t,e,n){return kity.Color.createHSL(t,e,n)}function e(e,n){return{background:"#fbfbfb","root-color":"white","root-background":t(e,37,60),"root-stroke":t(e,37,60),"root-font-size":16,"root-padding":n?[6,12]:[12,24],"root-margin":n?10:[30,100],"root-radius":5,"root-space":10,"main-color":"black","main-background":t(e,33,95),"main-stroke":t(e,37,60),"main-stroke-width":1,"main-font-size":14,"main-padding":[6,20],"main-margin":n?8:20,"main-radius":3,"main-space":5,"sub-color":"black","sub-background":"transparent","sub-stroke":"none","sub-font-size":12,"sub-padding":n?[3,5]:[5,10],"sub-margin":n?[4,8]:[15,20],"sub-radius":5,"sub-space":5,"connect-color":t(e,37,60),"connect-width":1,"connect-radius":5,"selected-stroke":t(e,26,30),"selected-stroke-width":"3","marquee-background":t(e,100,80).set("a",.1),"marquee-stroke":t(e,37,60),"drop-hint-color":t(e,26,35),"drop-hint-width":5,"order-hint-area-color":t(e,100,30).set("a",.5),"order-hint-path-color":t(e,100,25),"order-hint-path-width":1,"text-selection-color":t(e,100,20),"line-height":1.5}}var n,i={red:0,soil:25,green:122,blue:204,purple:246,pink:334};for(n in i)KityMinder.registerTheme("fresh-"+n,e(i[n])),KityMinder.registerTheme("fresh-"+n+"-compat",e(i[n],!0))}(),KityMinder.registerTheme("fish",{background:"#3A4144 url(ui/theme/default/images/grid.png) repeat","root-color":"#430","root-background":"#e9df98","root-stroke":"#e9df98","root-font-size":24,"root-padding":[35,35],"root-margin":30,"root-radius":100,"root-space":10,"root-shadow":"rgba(0, 0, 0, .25)","main-color":"#333","main-background":"#a4c5c0","main-stroke":"#a4c5c0","main-font-size":16,"main-padding":[6,20],"main-margin":[20,20],"main-radius":5,"main-space":5,"main-shadow":"rgba(0, 0, 0, .25)","sub-color":"black","sub-background":"white","sub-stroke":"white","sub-font-size":12,"sub-padding":[5,10],"sub-margin":[10],"sub-radius":5,"sub-space":5,"connect-color":"white","connect-width":3,"main-connect-width":3,"connect-radius":5,"selected-background":"rgb(254, 219, 0)","selected-stroke":"rgb(254, 219, 0)","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.5}),KityMinder.registerTheme("wire",{background:"black",color:"#999",stroke:"none",padding:10,margin:20,"font-size":14,"connect-color":"#999","connect-width":1,"selected-background":"#999","selected-color":"black","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","sub-drop-hint-width":2,"main-drop-hint-width":4,"root-drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.5}),["tianpan","tianpan-compact"].forEach(function(t){var e="tianpan-compact"==t;KityMinder.registerTheme(t,{background:"#3A4144 url(ui/theme/default/images/grid.png) repeat","root-color":"#430","root-background":"#e9df98","root-stroke":"#e9df98","root-font-size":25,"root-padding":e?15:20,"root-margin":e?[15,25]:100,"root-radius":30,"root-space":10,"root-shadow":"rgba(0, 0, 0, .25)","root-shape":"circle","main-color":"#333","main-background":"#a4c5c0","main-stroke":"#a4c5c0","main-font-size":15,"main-padding":e?10:12,"main-margin":e?10:12,"main-radius":10,"main-space":5,"main-shadow":"rgba(0, 0, 0, .25)","main-shape":"circle","sub-color":"#333","sub-background":"#99ca6a","sub-stroke":"#a4c5c0","sub-font-size":13,"sub-padding":5,"sub-margin":e?6:10,"sub-tree-margin":30,"sub-radius":5,"sub-space":5,"sub-shadow":"rgba(0, 0, 0, .25)","sub-shape":"circle","connect-color":"white","connect-width":2,"main-connect-width":3,"connect-radius":5,"selected-background":"rgb(254, 219, 0)","selected-stroke":"rgb(254, 219, 0)","selected-color":"black","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","sub-drop-hint-width":2,"main-drop-hint-width":4,"root-drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.4})}),KityMinder.registerTemplate("default",{getLayout:function(t){if(t.getData("layout"))return t.getData("layout");var e=t.getLevel();return 0===e?"mind":1===e?t.getLayoutPointPreview().x>0?"right":"left":t.parent.getLayout()},getConnect:function(t){return 1==t.getLevel()?"arc":"under"}}),KityMinder.registerTemplate("structure",{getLayout:function(t){return t.getData("layout")||"bottom"},getConnect:function(){return"poly"}}),KityMinder.registerTemplate("filetree",{getLayout:function(t){return t.getData("layout")?t.getData("layout"):t.isRoot()?"bottom":"filetree-down"},getConnect:function(t){return 1==t.getLevel()?"poly":"l"}}),KityMinder.registerTemplate("right",{getLayout:function(t){return t.getData("layout")||"right"},getConnect:function(t){return 1==t.getLevel()?"arc":"bezier"}}),KityMinder.registerTemplate("fish-bone",{getLayout:function(t){if(t.getData("layout"))return t.getData("layout");var e=t.getLevel();return 0===e?"fish-bone-master":1===e?"fish-bone-slave":t.getLayoutPointPreview().y>0?"filetree-up":"filetree-down"},getConnect:function(t){switch(t.getLevel()){case 1:return"fish-bone-master";case 2:return"line";default:return"l"}}}),KityMinder.registerTemplate("tianpan",{getLayout:function(t){if(t.getData("layout"))return t.getData("layout");var e=t.getLevel();return 0===e?"tianpan":t.parent.getLayout()},getConnect:function(){return"arc_tp"}});var AppendChildCommand=kity.createClass("AppendChildCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNode();if(!n)return null;e=e||t.getLang("topic"),n.expand();var i=t.createNode(e,n);t.select(i,!0),i.render(),t.layout(600)},queryState:function(t){var e=t.getSelectedNode();return e?0:-1}}),AppendSiblingCommand=kity.createClass("AppendSiblingCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNode(),i=n.parent;if(!i)return t.execCommand("AppendChildNode",e);e=e||t.getLang("topic");var r=t.createNode(e,i,n.getIndex()+1);t.select(r,!0),r.render(),t.layout(600)},queryState:function(t){var e=t.getSelectedNode();return e?0:-1}}),RemoveNodeCommand=kity.createClass("RemoverNodeCommand",{base:Command,execute:function(t){var e=t.getSelectedNodes(),n=MinderNode.getCommonAncestor.apply(null,e);e.forEach(function(e){e.isRoot()||t.removeNode(e)}),t.select(n||t.getRoot(),!0),t.layout(600)},queryState:function(t){var e=t.getSelectedNode();return e?0:-1}}),EditNodeCommand=kity.createClass("EditNodeCommand",{base:Command,execute:function(t){var e=t.getSelectedNode();return e?(t.select(e,!0),void t.textEditNode(e)):null},queryState:function(t){var e=t.getSelectedNode();return e?0:-1},isNeedUndo:function(){return!1}}),$importDialog,$exportDialog,ImportTextNode=kity.createClass("ImportTextNode",{base:Command,execute:function(t){function e(e){var i;if(e)try{o=n.decode(e,!0)}catch(r){i="文本格式解析错误. "+r.message}else i=t.getLang("contentIsRequired");i?(a.addClass("validate-error"),l.text(i),s.disable()):(a.removeClass("validate-error"),l.text(""),s.enable())}if(!$importDialog){var n=t.getProtocol("plain"),i=300;$importDialog=new FUI.Dialog({width:500,height:i,prompt:!0,caption:t.getLang("ui.importtextnode")}).appendTo(document.getElementById("content-wrapper"));var r=$($importDialog.getBodyElement());r.html(['<textarea style="width: 100%; color: red; height: '+(i-130)+'px"></textarea>'].join(""));var o,a=r.find("textarea"),s=$importDialog.getButton(0),l=$('<span class="validate-error"></span>');a.after(l),a.on("input",function(){e(a.val())}),a.on("keydown keyup",function(t){if(9===t.keyCode&&"keydown"===t.type){t.preventDefault();var e=this.selectionStart;this.value=this.value.substring(0,this.selectionStart)+" "+this.value.substring(this.selectionEnd),this.selectionEnd=e+1}(13!==t.keyCode||t.shiftKey)&&t.stopPropagation()}),$importDialog.on("open",function(){e(a.val()),setTimeout(function(){a[0].focus()},10)}),$importDialog.on("ok",function(){function e(n,i){if(n&&i){var r=t.createNode(i.data.text,n);return i.children&&i.children.forEach(function(t){e(r,t)}),r.render(),r}}var n=[],i=t.getSelectedNode();o&&o.children&&i&&(i.expand(),o.children.forEach(function(t){n.push(e(i,t))})),t.select(n,!0),t.layout(300),a.val(""),n=null,o=null})}$importDialog.open()},queryState:function(t){var e=t.getSelectedNode();return e?0:-1}}),ExportTextNode=kity.createClass("ExportTextNode",{base:Command,execute:function(t){if(!$exportDialog){var e=t.getProtocol("plain"),n=300;$exportDialog=new FUI.Dialog({width:500,height:n,prompt:!0,caption:t.getLang("ui.exporttextnode")}).appendTo(document.getElementById("content-wrapper"));var i=$($exportDialog.getBodyElement());i.html(['<textarea style="width: 100%; height: '+(n-130)+'px"></textarea>'].join(""));var r=i.find("textarea");r.on("keydown keyup",function(t){if(9===t.keyCode&&"keydown"===t.type){t.preventDefault();var e=this.selectionStart;this.value=this.value.substring(0,this.selectionStart)+" "+this.value.substring(this.selectionEnd),this.selectionEnd=e+1}(13!==t.keyCode||t.shiftKey)&&t.stopPropagation()}),$exportDialog.on("open",function(){r.val(e.encode(t.getSelectedNode())),setTimeout(function(){r[0].focus()},10)})}$exportDialog.open()},queryState:function(t){var e=t.getSelectedNode();return e?0:-1}});KityMinder.registerModule("NodeModule",function(){return{commands:{AppendChildNode:AppendChildCommand,AppendSiblingNode:AppendSiblingCommand,ImportTextNode:ImportTextNode,ExportTextNode:ExportTextNode,RemoveNode:RemoveNodeCommand,EditNode:EditNodeCommand},contextmenu:[{command:"appendsiblingnode"},{command:"appendchildnode"},{command:"editnode"},{command:"removenode"},{command:"importtextnode"},{command:"exporttextnode"},{divider:1}],commandShortcutKeys:{appendsiblingnode:"normal::Enter",appendchildnode:"normal::Insert|Tab",editnode:"normal::F2",removenode:"normal::Del|Backspace"}}});var FONT_ADJUST={"微软雅黑,Microsoft YaHei":-.15,"arial black,avant garde":-.17,"default":-.15},TextRenderer=KityMinder.TextRenderer=kity.createClass("TextRenderer",{base:Renderer,create:function(){return(new kity.Group).setId(KityMinder.uuid("node_text"))},update:function(t,e){function n(t){return e.getData(t)||e.getStyle(t)}var i=e.getText(!0),r=e.getStyle("line-height"),o=n("font-size"),a=n("font-family")||"default",s=r*o*i.length-(r-1)*o,l=-s/2,u=FONT_ADJUST[a]||0;t.setTranslate(0,u*o);var c=new kity.Box,h=Math.round;this.setTextStyle(e,t);var d=i.length,f=t.getItems().length;if(f>d)for(var p,g=d;p=t.getItem(g);)t.removeItem(g);else if(d>f)for(var m=d-f,g=0;m>g;g++){var v=(new kity.Text).setAttr("text-rendering","inherit");kity.Browser.ie?v.setVerticalAlign("top"):v.setAttr("dominant-baseline","text-before-edge"),t.addItem(v)}for(var y,v,g=0;y=i[g],v=t.getItem(g);g++)v.setContent(y);this.setTextStyle(e,t);var _=e.getText()+[n("font-size"),n("font-name"),n("font-weight"),n("font-style")].join("/");return e._currentTextHash==_&&e._currentTextGroupBox?e._currentTextGroupBox:(e._currentTextHash=_,function(){t.eachItem(function(t,e){var n=l+t*o*r;e.setY(n),c=c.merge(new kity.Box(0,n,e.getBoundaryBox().width||1,o))});var n=0,i=e.getStyle("shape");i&&"circle"==i&&(n=Math.max(c.width,c.height)/2-c.height/2);var a=new kity.Box(h(c.x),h(c.y-n),h(c.width),h(c.height));return e._currentTextGroupBox=a,a})},setTextStyle:function(t,e){var n=TextRenderer._styleHooks;n.forEach(function(n){n(t,e)})}});utils.extend(TextRenderer,{_styleHooks:[],registerStyleHook:function(t){TextRenderer._styleHooks.push(t)}}),kity.extendClass(MinderNode,{getTextGroup:function(){return this.getRenderer("TextRenderer").getRenderShape()}}),KityMinder.registerModule("text",{renderers:{center:TextRenderer}}),KityMinder.registerModule("Expand",function(){var t=this,e="expandState",n="expand",i="collapse";kity.extendClass(MinderNode,{expand:function(){return this.setData(e,n),this},collapse:function(){return this.setData(e,i),this},isExpanded:function(){var t=this.getData(e)!==i;return t&&(this.isRoot()||this.parent.isExpanded())},isCollapsed:function(){return!this.isExpanded()}});var r=kity.createClass("ExpandCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNode();if(n){for(e&&(n=n.parent);n.parent;)n.expand(),n=n.parent;n.renderTree(),t.layout(100)}},queryState:function(t){return t.getSelectedNode()?0:-1}}),o=kity.createClass("ExpandToLevelCommand",{base:Command,execute:function(t,e){t.getRoot().traverse(function(t){t.getLevel()<e&&t.expand(),t.getLevel()==e&&t.collapse()}),t.refresh(100)},enableReadOnly:!0}),a=kity.createClass("Expander",{base:kity.Group,constructor:function(t){this.callBase(),this.radius=6,this.outline=new kity.Circle(this.radius).stroke("gray").fill("white"),this.sign=(new kity.Path).stroke("gray"),this.addShapes([this.outline,this.sign]),this.initEvent(t),this.setId(KityMinder.uuid("node_expander")),this.setStyle("cursor","pointer")},initEvent:function(t){this.on("mousedown",function(e){t.isExpanded()?t.collapse():t.expand(),t.renderTree().getMinder().layout(100),t.getMinder().fire("contentchange"),e.stopPropagation(),e.preventDefault()}),this.on("dblclick click mouseup",function(t){t.stopPropagation(),t.preventDefault()})},setState:function(t){if("hide"==t)return void this.setVisible(!1);this.setVisible(!0);var e=["M",1.5-this.radius,0,"L",this.radius-1.5,0];t==i&&e.push(["M",0,1.5-this.radius,"L",0,this.radius-1.5]),this.sign.setPathData(e)}}),s=kity.createClass("ExpanderRenderer",{base:Renderer,create:function(t){return t.isRoot()?void 0:(this.expander=new a(t),t.getRenderContainer().prependShape(this.expander),t.expanderRenderer=this,this.node=t,this.expander)},shouldRender:function(t){return!t.isRoot()},update:function(t,n){if(n.parent){var i=n.parent.isExpanded();t.setState(i&&n.children.length?n.getData(e):"hide");var r=n.getLayoutVectorIn().normalize(t.radius+n.getStyle("stroke-width")),o=n.getVertexIn().offset(r.reverse());this.expander.setTranslate(o)}}});return{commands:{expand:r,expandtolevel:o},events:{layoutapply:function(t){var e=t.node.getRenderer("ExpanderRenderer");e.getRenderShape()&&e.update(e.getRenderShape(),t.node)},beforerender:function(t){var e=t.node,n=!e.parent||e.parent.isExpanded();e.getRenderContainer().setVisible(n),n||t.stopPropagation()},"normal.keydown":function(t){if("textedit"!=this.getStatus()){if(t.originEvent.keyCode==keymap["/"]){var e=this.getSelectedNode();if(!e||e==this.getRoot())return;var n=e.isExpanded();this.getSelectedNodes().forEach(function(t){n?t.collapse():t.expand(),t.renderTree()}),this.layout(100),this.fire("contentchange"),t.preventDefault(),t.stopPropagationImmediately()}t.isShortcutKey("Alt+`")&&this.execCommand("expandtolevel",9999);for(var i=1;6>i;i++)t.isShortcutKey("Alt+"+i)&&this.execCommand("expandtolevel",i)}}},renderers:{outside:s},contextmenu:[{command:"expandtoleaf",query:function(){return!t.getSelectedNode()},fn:function(t){t.execCommand("expandtolevel",9999)}},{command:"expandtolevel1",query:function(){return!t.getSelectedNode()},fn:function(t){t.execCommand("expandtolevel",1)}},{command:"expandtolevel2",query:function(){return!t.getSelectedNode()},fn:function(t){t.execCommand("expandtolevel",2)}},{command:"expandtolevel3",query:function(){return!t.getSelectedNode()},fn:function(t){t.execCommand("expandtolevel",3)}},{divider:!0}]}});var OutlineRenderer=kity.createClass("OutlineRenderer",{base:Renderer,create:function(){var t=(new kity.Rect).setId(KityMinder.uuid("node_outline"));return this.bringToBack=!0,t},update:function(t,e,n){var i=e.getStyle("shape");if(i&&"circle"==i)return updateCircle(t,e,n);var r=e.getStyle("padding-left"),o=e.getStyle("padding-right"),a=e.getStyle("padding-top"),s=e.getStyle("padding-bottom"),l={x:n.x-r,y:n.y-a,width:n.width+r+o,height:n.height+a+s},u=e.isSelected()?"selected-":"";return t.setPosition(l.x,l.y).setSize(l.width,l.height).setRadius(e.getStyle("radius")).fill(e.getData("background")||e.getStyle(u+"background")||e.getStyle("background")).stroke(e.getStyle(u+"stroke"||e.getStyle("stroke")),e.getStyle(u+"stroke-width")),new kity.Box(l)}}),ShadowRenderer=kity.createClass("ShadowRenderer",{base:Renderer,create:function(){return this.bringToBack=!0,new kity.Rect},shouldRender:function(t){return t.getStyle("shadow")},update:function(t,e,n){t.setPosition(n.x+4,n.y+5).fill(e.getStyle("shadow"));var i=e.getStyle("shape");if(i){if("circle"==i){var r=Math.max(n.width,n.height);t.setSize(r,r),t.setRadius(r/2)}}else t.setSize(n.width,n.height),t.setRadius(e.getStyle("radius"))}}),marker=new kity.Marker;marker.setWidth(10),marker.setHeight(12),marker.setRef(0,0),marker.setViewBox(-6,-4,8,10),marker.addShape((new kity.Path).setPathData("M-5-3l5,3,-5,3").stroke("#33ffff"));var wireframeOption=/wire/.test(window.location.href),WireframeRenderer=kity.createClass("WireframeRenderer",{base:Renderer,create:function(){var t=new kity.Group,e=this.oxy=(new kity.Path).stroke("#f6f").setPathData("M0,-50L0,50M-50,0L50,0"),n=this.wireframe=(new kity.Rect).stroke("lightgreen"),i=this.vectorIn=(new kity.Path).stroke("#66ffff"),r=this.vectorOut=(new kity.Path).stroke("#66ffff");return i.setMarker(marker,"end"),r.setMarker(marker,"end"),t.addShapes([e,n,i,r])},shouldRender:function(){return wireframeOption},update:function(t,e,n){this.wireframe.setPosition(n.x,n.y).setSize(n.width,n.height);var i=e.getVertexIn(),r=e.getVertexOut(),o=e.getLayoutVectorIn().normalize(30),a=e.getLayoutVectorOut().normalize(30);this.vectorIn.setPathData(["M",i.offset(o.reverse()),"L",i]),this.vectorOut.setPathData(["M",r,"l",a])}});KityMinder.registerModule("OutlineModule",function(){return{events:wireframeOption?{ready:function(){this.getPaper().addResource(marker)},layoutallfinish:function(){this.getRoot().traverse(function(t){t.getRenderer("WireframeRenderer").update(null,t,t.getContentBox())})}}:null,renderers:{outline:OutlineRenderer,outside:[ShadowRenderer,WireframeRenderer]}}}),KityMinder.Geometry=function(){function t(t){return t.width=t.right-t.left,t.height=t.bottom-t.top,t.x=t.left,t.y=t.top,t.cx=t.x+t.width/2,t.cy=t.y+t.height/2,t}function e(t){"x"in t&&(t.left=t.x,t.right=t.x+t.width,t.top=t.y,t.bottom=t.y+t.height)}var n={},i=Math.min,r=Math.max,o=(Math.abs,Object.prototype.hasOwnProperty);return n.isNumberInRange=function(t,e){return t>e[0]&&t<e[1]},n.getDistance=function(t,e){return kity.Vector.fromPoints(t,e).length()},n.wrapBox=t,n.getBox=function(e,n){return t({left:i(e.x,n.x),right:r(e.x,n.x),top:i(e.y,n.y),bottom:r(e.y,n.y)})},n.mergeBox=function(n,o){return e(n),e(o),t({left:i(n.left,o.left),right:r(n.right,o.right),top:i(n.top,o.top),bottom:r(n.bottom,o.bottom)})},n.getBoxRange=function(t){return{x:[t.left,t.right],y:[t.top,t.bottom]}},n.getBoxVertex=function(t){return{leftTop:{x:t.left,y:t.top},rightTop:{x:t.right,y:t.top},leftBottom:{x:t.left,y:t.bottom},rightBottom:{x:t.right,y:t.bottom}}},n.isPointInsideBox=function(t,i){e(i);var r=n.getBoxRange(i);return n.isNumberInRange(t.x,r.x)&&n.isNumberInRange(t.y,r.y)},n.getIntersectBox=function(n,o){e(n),e(o);var a=r(n.left,o.left),s=r(n.top,o.top),l=i(n.right,o.right),u=i(n.bottom,o.bottom);return l>a&&u>s?t({left:a,right:l,top:s,bottom:u}):null},n.snapToSharp=function(t){return utils.isNumber(t)?(0|t)+.5:utils.isArray(t)?t.map(n.snapToSharp):(["x","y","left","top","right","bottom"].forEach(function(e){o.call(t,e)&&(t[e]=n.snapToSharp(t[e]))}),t)},n.expandBox=function(e,n,i){return void 0===i&&(i=n),t({left:e.left-n,top:e.top-i,right:e.right+n,bottom:e.bottom+i})},n}(),KityMinder.registerModule("HistoryModule",function(){var t=this,e=kity.createClass("Scene",{constructor:function(t,e){this.data=t.clone(),this.inputStatus=e},getData:function(){return this.data},cloneData:function(){return this.getData().clone()},equals:function(t){return this.getData().equals(t.getData())},isInputStatus:function(){return this.inputStatus},setInputStatus:function(t){this.inputStatus=t}}),n=kity.createClass("HistoryManager",{constructor:function(t){this.list=[],this.index=0,this.hasUndo=!1,this.hasRedo=!1,this.km=t},undo:function(){if(this.hasUndo){var t=this.list[this.index];if(t&&t.isInputStatus())return this.saveScene(),this.restore(--this.index),void t.setInputStatus(!1);if(1==this.list.length)return void this.restore(0);if(!this.list[this.index-1]&&1==this.list.length)return void this.reset();for(;this.list[this.index].equals(this.list[this.index-1]);)if(this.index--,0===this.index)return this.restore(0);this.restore(--this.index)}},redo:function(){if(this.hasRedo){for(;this.list[this.index].equals(this.list[this.index+1]);)if(this.index++,this.index==this.list.length-1)return this.restore(this.index);this.restore(++this.index)}},partialRenewal:function(e){function n(t,e){return t.getText()!=e.getText()?!1:utils.compareObject(t.getData(),e.getData())===!1?!1:utils.compareObject(t.getTmpData(),e.getTmpData())===!1?!1:!0}function i(e,n){n.isSelected()&&o.push(n),t.appendNode(n,e),n.render();for(var r,a=utils.cloneArr(n.children),s=0;r=a[s++];)i(n,r)}function r(e,a){n(e,a)===!1&&e.setValue(a),e.render(),e.isSelected()&&o.push(e);for(var s,l,u=0,c=0;s=e.children[u],l=a.children[c],s||l;u++,c++)s&&!l?(u--,t.removeNode(s)):!s&&l?(c--,i(e,l)):r(s,l)}var o=[];r(t.getRoot(),e),t.layout(200),t.select(o,!0),o=[]},restore:function(t){t=void 0===t?this.index:t;var e=this.list[t];this.partialRenewal(e.cloneData()),this.update(),this.km.fire("restoreScene"),this.km.fire("contentChange")},getScene:function(t){return new e(this.km.getRoot(),t)},saveScene:function(t){var e=this.getScene(t),n=this.list[this.index];return n&&n.equals(e)?void(t&&(n.setInputStatus(!0),this.update())):(this.list=this.list.slice(0,this.index+1),this.list.push(e),this.list.length>this.km.getOptions("maxUndoCount")&&this.list.shift(),this.index=this.list.length-1,void this.update())},update:function(){this.hasRedo=!!this.list[this.index+1],this.hasUndo=!!this.list[this.index-1];var t=this.list[this.index];t&&t.isInputStatus()&&(this.hasUndo=!0)},reset:function(){this.list=[],this.index=0,this.hasUndo=!1,this.hasRedo=!1}});return this.historyManager=new n(this),{defaultOptions:{maxUndoCount:20,maxInputCount:20},commands:{undo:kity.createClass("UndoCommand",{base:Command,execute:function(t){t.historyManager.undo()},queryState:function(t){return t.historyManager.hasUndo?0:-1},isNeedUndo:function(){return!1}}),redo:kity.createClass("RedoCommand",{base:Command,execute:function(t){t.historyManager.redo()},queryState:function(t){return t.historyManager.hasRedo?0:-1},isNeedUndo:function(){return!1}})},commandShortcutKeys:{undo:"ctrl+z",redo:"ctrl+y"},events:{saveScene:function(t){this.historyManager.saveScene(t.inputStatus)},"import":function(){this.historyManager.reset()}}}}),KityMinder.registerModule("ProgressModule",function(){var t=this,e="progress",n="#FFED83",i="#43BC00",r="M10,3c4.418,0,8,3.582,8,8h1c0-5.523-3.477-10-9-10S1,5.477,1,11h1C2,6.582,5.582,3,10,3z",o="#8E8E8E",a="M10,0C4.477,0,0,4.477,0,10c0,5.523,4.477,10,10,10s10-4.477,10-10C20,4.477,15.523,0,10,0zM10,18c-4.418,0-8-3.582-8-8s3.582-8,8-8s8,3.582,8,8S14.418,18,10,18z",s=(new kity.LinearGradient).pipe(function(t){t.setStartPosition(0,0),t.setEndPosition(0,1),t.addStop(0,"#fff"),t.addStop(1,"#ccc")}),l="M15.812,7.896l-6.75,6.75l-4.5-4.5L6.25,8.459l2.812,2.803l5.062-5.053L15.812,7.896z",u="#EEE";t.getPaper().addResource(s);var c=kity.createClass("ProgressIcon",{base:kity.Group,constructor:function(t){this.callBase(),this.setSize(20),this.create(),this.setValue(t),this.setId(KityMinder.uuid("node_progress")),this.translate(.5,.5)},setSize:function(t){this.width=this.height=t},create:function(){var t,e,c,h,d;t=new kity.Circle(9).fill(n),e=new kity.Pie(9,0).fill(i),c=(new kity.Path).setPathData(r).setTranslate(-10,-10).fill(o),h=(new kity.Path).setTranslate(-10,-10).setPathData(a).fill(s),d=(new kity.Path).setTranslate(-10,-10).setPathData(l).fill(u),this.addShapes([t,e,c,d,h]),this.pie=e,this.check=d},setValue:function(t){this.pie.setAngle(-360*(t-1)/8),this.check.setVisible(9==t)}}),h=kity.createClass("ProgressCommand",{base:Command,execute:function(t,n){for(var i=t.getSelectedNodes(),r=0;r<i.length;r++)i[r].setData(e,n||null).render();t.layout()},queryValue:function(t){for(var n,i=t.getSelectedNodes(),r=0;r<i.length&&!(n=i[r].getData(e));r++);return n||null},queryState:function(t){return t.getSelectedNodes().length?0:-1}});return{commands:{progress:h},renderers:{left:kity.createClass("ProgressRenderer",{base:KityMinder.Renderer,create:function(){return new c},shouldRender:function(t){return t.getData(e)},update:function(t,n,i){var r,o,a=n.getData(e),s=n.getStyle("space-left");return t.setValue(a),r=i.left-t.width-s,o=-t.height/2,t.setTranslate(r+t.width/2,o+t.height/2),new kity.Box(r,o,t.width,t.height)}})}}}),KityMinder.registerModule("PriorityModule",function(){var t=[null,["#FF1200","#840023"],["#0074FF","#01467F"],["#00AF00","#006300"],["#FF962E","#B25000"],["#A464FF","#4720C4"],["#A3A3A3","#515151"],["#A3A3A3","#515151"],["#A3A3A3","#515151"],["#A3A3A3","#515151"]],e="M0,13c0,3.866,3.134,7,7,7h6c3.866,0,7-3.134,7-7V7H0V13z",n="M20,10c0,3.866-3.134,7-7,7H7c-3.866,0-7-3.134-7-7V7c0-3.866,3.134-7,7-7h6c3.866,0,7,3.134,7,7V10z",i="priority",r=kity.createClass("PriorityIcon",{base:kity.Group,constructor:function(){this.callBase(),this.setSize(20),this.create(),this.setId(KityMinder.uuid("node_priority"))},setSize:function(t){this.width=this.height=t},create:function(){var t,i,r,o;t=(new kity.Path).setPathData(n).fill("white"),i=(new kity.Path).setPathData(e).setTranslate(.5,.5),r=(new kity.Path).setPathData(n).setOpacity(.8).setTranslate(.5,.5),o=(new kity.Text).setX(this.width/2-.5).setY(this.height/2-1.5).setTextAnchor("middle").setVerticalAlign("middle").setFontItalic(!0).setFontSize(14).fill("white"),this.addShapes([i,r,o]),this.mask=r,this.back=i,this.number=o},setValue:function(e){var n=this.back,i=this.mask,r=this.number,o=t[e];o&&(n.fill(o[1]),i.fill(o[0])),r.setContent(e)}}),o=kity.createClass("SetPriorityCommand",{base:Command,execute:function(t,e){for(var n=t.getSelectedNodes(),r=0;r<n.length;r++)n[r].setData(i,e||null).render();t.layout()},queryValue:function(t){for(var e,n=t.getSelectedNodes(),r=0;r<n.length&&!(e=n[r].getData(i));r++);return e||null},queryState:function(t){return t.getSelectedNodes().length?0:-1}});return{commands:{priority:o},renderers:{left:kity.createClass("PriorityRenderer",{base:KityMinder.Renderer,create:function(){return new r},shouldRender:function(t){return t.getData(i)},update:function(t,e,n){var r,o,a=e.getData(i),s=e.getStyle("space-left");return t.setValue(a),r=n.left-t.width-s,o=-t.height/2,t.setTranslate(r,o),new kity.Box({x:r,y:o,width:t.width,height:t.height})}})}}}),KityMinder.registerModule("image",function(){function t(t,e){var n=document.createElement("img");n.onload=function(){e(n.width,n.height)},n.onerror=function(){e(null)},n.src=t}function e(t,e,n,i){var r=t/e,o=n/i;return t>n&&r>o?(t=n,e=t/r):e>i&&(e=i,t=e*r),{width:0|t,height:0|e}}var n=kity.createClass("ImageCommand",{base:Command,execute:function(n,i,r){var o=n.getSelectedNodes();t(i,function(t,a){t&&(utils.each(o,function(o,s){var l=e(t,a,n.getOptions("maxImageWidth"),n.getOptions("maxImageHeight"));s.setData("image",i),s.setData("imageTitle",r),s.setData("imageSize",l),s.render()}),n.fire("saveScene"),n.layout(300))})},queryState:function(t){var e=t.getSelectedNodes(),n=0;return 0===e.length?-1:(utils.each(e,function(t,e){return e&&e.getData("image")?(n=0,!1):void 0}),n)},queryValue:function(t){var e=t.getSelectedNode();return{url:e.getData("image"),title:e.getData("imageTitle")}}}),i=kity.createClass("RemoveImageCommand",{base:Command,execute:function(t){var e=t.getSelectedNodes();utils.each(e,function(t,e){e.setData("image").render()}),t.layout(300)},queryState:function(t){var e=t.getSelectedNodes();if(0===e.length)return-1;var n=!1;return utils.each(e,function(t,e){return e.getData("image")?(n=!0,!1):void 0}),n?0:-1}}),r=kity.createClass("ImageRenderer",{base:KityMinder.Renderer,create:function(t){return new kity.Image(t.getData("image"))},shouldRender:function(t){return t.getData("image")},update:function(t,e,n){var i=e.getData("image"),r=e.getData("imageTitle"),o=e.getData("imageSize"),a=e.getStyle("space-top");if(o){r&&t.node.setAttributeNS("http://www.w3.org/1999/xlink","title",r);var s=n.cx-o.width/2,l=n.y-o.height-a;return t.setUrl(i).setX(0|s).setY(0|l).setWidth(0|o.width).setHeight(0|o.height),new kity.Box(0|s,0|l,0|o.width,0|o.height)}}});return{defaultOptions:{maxImageWidth:200,maxImageHeight:200},commands:{image:n,removeimage:i},renderers:{top:r}}}),KityMinder.registerModule("Resource",function(){var t=function(){var t,e,n,i,r,o,a,s,l,u,c;return c=4*(1<<30),t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479],u=function(t){return 0>t&&(t+=c),("00000000"+t.toString(16)).slice(-8)},o=[[16,50,84,118,152,186,220,254],[174,132,249,109,193,32,123,53],[139,12,37,223,234,99,23,73],[151,19,205,235,98,165,4,143],[9,117,66,250,30,203,134,211],[194,166,176,56,212,87,239,145],[92,241,222,164,112,54,41,184],[189,231,28,147,5,79,104,162],[246,158,59,128,44,125,65,90],[42,72,103,81,191,233,195,13]],a=function(t,e,n){var i=s[t]^s[e];s[t]=i>>>n|i<<32-n},e=function(t,e,u,c,h){var d=i+o[n][t]%16,f=i+(o[n][t]>>4);e%=4,u=4+u%4,c=8+c%4,h=12+h%4,s[e]+=s[u]+(l[d]^r[f%16]),a(h,e,16),s[c]+=s[h],a(u,c,12),s[e]+=s[u]+(l[f]^r[d%16]),a(h,e,8),s[c]+=s[h],a(u,c,7)},function(o,a){a instanceof Array&&4===a.length||(a=[0,0,0,0]);var c,h,d,f,p,g,m,v;for(h=t.slice(0),c=r.slice(0,8),n=0;4>n;n+=1)c[n]^=a[n];if(d=16*o.length,p=d%512>446||d%512===0?0:d,d%512===432)o+="老";else{for(o+="耀";o.length%32!==27;)o+="\x00";o+=""}for(l=[],v=0;v<o.length;v+=2)l.push(65536*o.charCodeAt(v)+o.charCodeAt(v+1));for(l.push(0),l.push(d),g=l.length-16,m=0,i=0;i<l.length;i+=16){for(m+=512,f=i===g?p:Math.min(d,m),s=h.concat(c),s[12]^=f,s[13]^=f,n=0;10>n;n+=1)for(v=0;8>v;v+=1)4>v?e(v,v,v,v,v):e(v,v,v+1,v+2,v+3);for(v=0;8>v;v+=1)h[v]^=a[v%4]^s[v]^s[v+8]}return h.map(u).join("")}}(),e=[51,303,75,200,157,0,26,254].map(function(t){return kity.Color.createHSL(t,100,85)});kity.extendClass(Minder,{getHashCode:function(e){e=t(e);var n,i,r=1315423911;for(n=e.length-1;n>=0;n--)i=e.charCodeAt(n),r^=(r<<5)+i+(r>>2);return 2147483647&r},getResourceColor:function(t){var n,i=this._getResourceColorIndexMapping();return i.hasOwnProperty(t)||(n=this._getNextResourceColorIndex(),i[t]=n),e[i[t]]||kity.Color.createHSL(Math.floor(this.getHashCode(t)/2147483647*359),100,85)},getUsedResource:function(){var t,e=this._getResourceColorIndexMapping(),n=[];
|
||
for(t in e)e.hasOwnProperty(t)&&n.push(t);return n},_getNextResourceColorIndex:function(){var t,n,i,r=this._getResourceColorIndexMapping();n=[];for(t in r)r.hasOwnProperty(t)&&n.push(r[t]);for(i=0;i<e.length;i++)if(!~n.indexOf(i))return i;return-1},_getResourceColorIndexMapping:function(){return this._resourceColorMapping||(this._resourceColorMapping={})}});var n=kity.createClass("ResourceCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNodes();"string"==typeof e&&(e=[e]),n.forEach(function(t){t.setData("resource",e).render()}),t.layout(200)},queryValue:function(t){var e=t.getSelectedNodes(),n=[];return e.forEach(function(t){var e=t.getData("resource");e&&e.forEach(function(t){~n.indexOf(t)||n.push(t)})}),n},queryState:function(t){return t.getSelectedNode()?0:-1}}),i=kity.createClass("ResourceOverlay",{base:kity.Group,constructor:function(){this.callBase();var t,e;e=this.rect=(new kity.Rect).setRadius(4),t=this.text=(new kity.Text).setFontSize(12).setVerticalAlign("middle"),this.addShapes([e,t])},setValue:function(t,e){var n,i,r,o=8,a=4;n=this.text,t==this.lastResourceName?i=this.lastBox:(n.setContent(t),i=n.getBoundaryBox(),this.lastResourceName=t,this.lastBox=i),n.setX(o).fill(e.dec("l",70)),r=this.rect,r.setPosition(0,i.y-a),this.width=Math.round(i.width+2*o),this.height=Math.round(i.height+2*a),r.setSize(this.width,this.height),r.fill(e)}}),r=kity.createClass("ResourceRenderer",{base:KityMinder.Renderer,create:function(){return this.overlays=[],new kity.Group},shouldRender:function(t){return t.getData("resource")&&t.getData("resource").length},update:function(t,e,n){var r,o,a,s=e.getStyle("space-right"),l=this.overlays,u=e.getData("resource"),c=e.getMinder();for(a=0,r=0;r<u.length;r++)a+=s,o=l[r],o||(o=new i,l.push(o),t.addShape(o)),o.setVisible(!0),o.setValue(u[r],c.getResourceColor(u[r])),o.setTranslate(a,-1),a+=o.width;for(;o=l[r++];)o.setVisible(!1);return t.setTranslate(n.right,0),new kity.Box({x:n.right,y:Math.round(-l[0].height/2),width:a,height:l[0].height})}});return{commands:{resource:n},renderers:{right:r}}}),KityMinder.registerModule("NoteModule",function(){var t="M9,9H3V8h6L9,9L9,9z M9,7H3V6h6V7z M9,5H3V4h6V5z M8.5,11H2V2h8v7.5 M9,12l2-2V1H1v11",e=kity.createClass("NoteCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNode();n.setData("note",e),n.render(),n.getMinder().layout(300)},queryState:function(t){return 1===t.getSelectedNodes().length?0:-1},queryValue:function(t){var e=t.getSelectedNode();return e&&e.getData("note")}}),n=kity.createClass("NoteIcon",{base:kity.Group,constructor:function(){this.callBase(),this.width=16,this.height=17,this.rect=new kity.Rect(16,17,.5,-8.5,2).fill("transparent"),this.path=(new kity.Path).setPathData(t).setTranslate(2.5,-6.5),this.addShapes([this.rect,this.path]),this.on("mouseover",function(){this.rect.fill("rgba(255, 255, 200, .8)")}).on("mouseout",function(){this.rect.fill("transparent")}),this.setStyle("cursor","pointer")}}),i=kity.createClass("NoteIconRenderer",{base:KityMinder.Renderer,create:function(t){var e=new n;return e.on("mousedown",function(e){e.preventDefault(),t.getMinder().fire("editnoterequest")}),e.on("mouseover",function(){t.getMinder().fire("shownoterequest",{node:t,icon:e})}),e.on("mouseout",function(){t.getMinder().fire("hidenoterequest",{node:t,icon:e})}),e},shouldRender:function(t){return t.getData("note")},update:function(t,e,n){var i=n.right+e.getStyle("space-left"),r=n.cy;return t.path.fill(e.getStyle("color")),t.setTranslate(i,r),new kity.Box(i,Math.round(r-t.height/2),t.width,t.height)}});return{renderers:{right:i},commands:{note:e}}});var ViewDragger=kity.createClass("ViewDragger",{constructor:function(t){this._minder=t,this._enabled=!1,this._bind();var e=this;this._minder.getViewDragger=function(){return e}},isEnabled:function(){return this._enabled},setEnabled:function(t){var e=this._minder.getPaper();e.setStyle("cursor",t?"pointer":"default"),e.setStyle("cursor",t?"-webkit-grab":"default"),this._enabled=t},move:function(t,e){var n=(this._minder,this.getMovement().offset(t));this.moveTo(n,e)},moveTo:function(t,e){if(e){var n=this;return this._moveTimeline&&this._moveTimeline.stop(),this._moveTimeline=this._minder.getRenderContainer().animate(new kity.Animator(this.getMovement(),t,function(t,e){n.moveTo(e)}),e,"easeOutCubic"),this._moveTimeline.on("finish",function(){n._moveTimeline=null}),this}this._minder.getRenderContainer().setTranslate(t.round()),this._minder.fire("viewchange")},getMovement:function(){var t=this._minder.getRenderContainer().transform.translate;return t?t[0]:new kity.Point},getView:function(){var t=this._minder,e={width:t.getRenderTarget().clientWidth,height:t.getRenderTarget().clientHeight},n=this.getMovement(),i=new kity.Box(0,0,e.width,e.height),r=t.getPaper().getViewPortMatrix();return r.inverse().translate(-n.x,-n.y).transformBox(i)},_bind:function(){function t(t){if(i){i=null,t.stopPropagation(),n&&(e.setEnabled(!1),n=!1,"hand"==e._minder.getStatus()&&e._minder.rollbackStatus());var r=e._minder.getPaper();r.setStyle("cursor","hand"==e._minder.getStatus()?"-webkit-grab":"default")}}var e=this,n=!1,i=null,r=null;this._minder.on("normal.mousedown normal.touchstart inputready.mousedown inputready.touchstart readonly.mousedown readonly.touchstart",function(t){2==t.originEvent.button&&t.originEvent.preventDefault(),(t.getTargetNode()==this.getRoot()||2==t.originEvent.button||t.originEvent.altKey)&&(i=t.getPosition(),n=!0)}).on("normal.mousemove normal.touchmove readonly.mousemove readonly.touchmove inputready.mousemove inputready.touchmove",function(t){if("touchmove"==t.type&&t.preventDefault(),n){var r=kity.Vector.fromPoints(i,t.getPosition());if(r.length()>10){this.setStatus("hand",!0);var o=e._minder.getPaper();o.setStyle("cursor","-webkit-grabbing")}}}).on("hand.beforemousedown hand.beforetouchstart",function(t){if(e.isEnabled()){i=t.getPosition(),t.stopPropagation();var n=e._minder.getPaper();n.setStyle("cursor","-webkit-grabbing")}}).on("hand.beforemousemove hand.beforetouchmove",function(t){if(i){r=t.getPosition();var n=kity.Vector.fromPoints(i,r);e.move(n),t.stopPropagation(),t.preventDefault(),t.originEvent.preventDefault(),i=r}}).on("mouseup touchend",t),window.addEventListener("mouseup",t),this._minder.on("contextmenu",function(t){t.preventDefault()})}});KityMinder.registerModule("View",function(){var t=kity.createClass("ToggleHandCommand",{base:Command,execute:function(t){"hand"!=t.getStatus()?t.setStatus("hand",!0):t.rollbackStatus(),this.setContentChanged(!1)},queryState:function(t){return"hand"==t.getStatus()?1:0},enableReadOnly:!0}),e=kity.createClass("CameraCommand",{base:Command,execute:function(t,e,n){e=e||t.getRoot();var i=t.getPaper().getViewPort(),r=e.getRenderContainer().getRenderBox("view"),o=i.center.x-r.x-r.width/2,a=i.center.y-r.y,s=t._viewDragger;s.move(new kity.Point(o,a),n),this.setContentChanged(!1)},enableReadOnly:!0}),n=kity.createClass("MoveCommand",{base:Command,execute:function(t,e,n){var i=t._viewDragger,r=t._lastClientSize;switch(e){case"up":i.move(new kity.Point(0,r.height/2),n);break;case"down":i.move(new kity.Point(0,-r.height/2),n);break;case"left":i.move(new kity.Point(r.width/2,0),n);break;case"right":i.move(new kity.Point(-r.width/2,0),n)}},enableReadOnly:!0});return{init:function(){this._viewDragger=new ViewDragger(this)},commands:{hand:t,camera:e,move:n},events:{keydown:function(t){var e=this;["up","down","left","right"].forEach(function(n){t.isShortcutKey("ctrl+"+n)&&"textedit"!=e.getStatus()&&(e.removeAllSelectedNodes(),e.execCommand("move",n,100),t.preventDefault())}),t.isShortcutKey("ctrl+enter")&&e.execCommand("camera",e.getRoot(),100)},statuschange:function(t){this._viewDragger.setEnabled("hand"==t.currentStatus)},mousewheel:function(t){var e,n;t=t.originEvent,t.ctrlKey||t.shiftKey||("wheelDeltaX"in t?(e=t.wheelDeltaX||0,n=t.wheelDeltaY||0):(e=0,n=t.wheelDelta),this._viewDragger.move({x:e/2.5,y:n/2.5}),t.preventDefault())},"normal.dblclick readonly.dblclick":function(t){t.kityEvent.targetShape instanceof kity.Paper&&this.execCommand("camera",this.getRoot(),800)},ready:function(){this.execCommand("camera",null,0),this._lastClientSize={width:this.getRenderTarget().clientWidth,height:this.getRenderTarget().clientHeight}},resize:function(){var t={width:this.getRenderTarget().clientWidth,height:this.getRenderTarget().clientHeight},e=this._lastClientSize;this._viewDragger.move(new kity.Point((t.width-e.width)/2|0,(t.height-e.height)/2|0)),this._lastClientSize=t},"selectionchange layoutallfinish":function(){var t=this.getSelectedNode();if(t){var e=this._viewDragger,n=e.getView(),i=t.getLayoutBox(),r=50,o=0,a=0;i.right>n.right?o+=n.right-i.right-r:i.left<n.left&&(o+=n.left-i.left+r),i.bottom>n.bottom&&(a+=n.bottom-i.bottom-r),i.top<n.top&&(a+=n.top-i.top+r),(o||a)&&e.move(new kity.Point(o,a),100)}}}}});var GM=KityMinder.Geometry,MoveToParentCommand=kity.createClass("MoveToParentCommand",{base:Command,execute:function(t,e,n){for(var i,r=e.length-1;r>=0;r--)i=e[r],i.parent&&(i.parent.removeChild(i),n.appendChild(i),i.render());n.expand(),t.select(e,!0)}}),DropHinter=kity.createClass("DropHinter",{base:kity.Group,constructor:function(){this.callBase(),this.rect=new kity.Rect,this.addShape(this.rect)},render:function(t){this.setVisible(!!t),t&&(this.rect.setBox(t.getLayoutBox()).setRadius(t.getStyle("radius")||0).stroke(t.getStyle("drop-hint-color")||"yellow",t.getStyle("drop-hint-width")||2),this.bringTop())}}),OrderHinter=kity.createClass("OrderHinter",{base:kity.Group,constructor:function(){this.callBase(),this.area=new kity.Rect,this.path=new kity.Path,this.addShapes([this.area,this.path])},render:function(t){this.setVisible(!!t),t&&(this.area.setBox(t.area),this.area.fill(t.node.getStyle("order-hint-area-color")||"rgba(0, 255, 0, .5)"),this.path.setPathData(t.path),this.path.stroke(t.node.getStyle("order-hint-path-color")||"#0f0",t.node.getStyle("order-hint-path-width")||1))}}),TreeDragger=kity.createClass("TreeDragger",{constructor:function(t){this._minder=t,this._dropHinter=new DropHinter,this._orderHinter=new OrderHinter,t.getRenderContainer().addShapes([this._dropHinter,this._orderHinter])},dragStart:function(t){this._startPosition=t},dragMove:function(t){var e=10;if(this._startPosition){var n=kity.Vector.fromPoints(this._dragPosition||this._startPosition,t),i=this._minder;if(this._dragPosition=t,!this._dragMode){if(GM.getDistance(this._dragPosition,this._startPosition)<e)return;if(!this._enterDragMode())return}for(var r=0;r<this._dragSources.length;r++)this._dragSources[r].setLayoutOffset(this._dragSources[r].getLayoutOffset().offset(n)),i.applyLayoutResult(this._dragSources[r]);this._dropTest()?this._renderOrderHint(this._orderSucceedHint=null):this._orderTest()}},dragEnd:function(){if(this._startPosition=null,this._dragPosition=null,this._dragMode){if(this._fadeDragSources(1),this._dropSucceedTarget)this._dragSources.forEach(function(t){t.setLayoutOffset(null)}),this._minder.layout(-1),this._minder.execCommand("movetoparent",this._dragSources,this._dropSucceedTarget);else if(this._orderSucceedHint){var t=this._orderSucceedHint,e=t.node.getIndex(),n=this._dragSources.map(function(t){return t.setLayoutOffset(null),t.getIndex()}),i=Math.max.apply(Math,n),r=Math.min.apply(Math,n);r>e&&"down"==t.type&&e++,e>i&&"up"==t.type&&e--,t.node.setLayoutOffset(null),this._minder.execCommand("arrange",this._dragSources,e),this._renderOrderHint(null)}else this._minder.fire("savescene");this._minder.layout(300),this._leaveDragMode(),this._minder.fire("contentchange")}},_enterDragMode:function(){return this._calcDragSources(),this._dragSources.length?(this._fadeDragSources(.5),this._calcDropTargets(),this._calcOrderHints(),this._dragMode=!0,this._minder.setStatus("dragtree"),!0):(this._startPosition=null,!1)},_calcDragSources:function(){this._dragSources=this._minder.getSelectedAncestors()},_fadeDragSources:function(t){var e=this._minder;this._dragSources.forEach(function(n){n.getRenderContainer().setOpacity(t,200),n.traverse(function(n){1>t?e.detachNode(n):e.attachNode(n)},!0)})},_calcDropTargets:function(){function t(e,n){var i,r=[];return r.push(n),n.getChildren().forEach(function(n){for(i=0;i<e.length;i++)if(e[i]==n)return;r=r.concat(t(e,n))}),r}this._dropTargets=t(this._dragSources,this._minder.getRoot()),this._dropTargetBoxes=this._dropTargets.map(function(t){return t.getLayoutBox()})},_calcOrderHints:function(){var t=this._dragSources,e=MinderNode.getCommonAncestor(t);if(e==t[0]&&(e=t[0].parent),0===t.length||e!=t[0].parent)return void(this._orderHints=[]);var n=e.children;this._orderHints=n.reduce(function(e,n){return-1==t.indexOf(n)&&(e=e.concat(n.getOrderHint())),e},[])},_leaveDragMode:function(){this._dragMode=!1,this._dropSucceedTarget=null,this._orderSucceedHint=null,this._renderDropHint(null),this._renderOrderHint(null),this._minder.rollbackStatus()},_drawForDragMode:function(){this._text.setContent(this._dragSources.length+" items"),this._text.setPosition(this._startPosition.x,this._startPosition.y+5),this._minder.getRenderContainer().addShape(this)},_boxTest:function(t,e,n){var i,r,o,a,s,l=this._dragSources.map(function(t){return t.getLayoutBox()});for(n=n||function(t){return t},i=0;i<t.length;i++)for(o=t[i],s=e.call(this,o,i),r=0;r<l.length;r++){a=l[r];var u=GM.getIntersectBox(a,s);if(n(u,a,s))return o}return null},_dropTest:function(){return this._dropSucceedTarget=this._boxTest(this._dropTargets,function(t,e){return this._dropTargetBoxes[e]},function(t,e,n){function i(t){return t.width*t.height}return t?i(t)>.5*Math.min(i(e),i(n))?!0:t.width+1>=Math.min(e.width,n.width)?!0:t.height+1>=Math.min(e.height,n.height)?!0:!1:!1}),this._renderDropHint(this._dropSucceedTarget),!!this._dropSucceedTarget},_orderTest:function(){return this._orderSucceedHint=this._boxTest(this._orderHints,function(t){return t.area}),this._renderOrderHint(this._orderSucceedHint),!!this._orderSucceedHint},_renderDropHint:function(t){this._dropHinter.render(t)},_renderOrderHint:function(t){this._orderHinter.render(t)},preventDragMove:function(){this._startPosition=null}});KityMinder.registerModule("DragTree",function(){var t;return{init:function(){t=new TreeDragger(this),window.addEventListener("mouseup",function(){t.dragEnd()})},events:{"normal.mousedown inputready.mousedown":function(e){e.originEvent.button||e.getTargetNode()&&e.getTargetNode()!=this.getRoot()&&t.dragStart(e.getPosition(this.getRenderContainer()))},"normal.mousemove dragtree.mousemove":function(e){t.dragMove(e.getPosition(this.getRenderContainer()))},"normal.mouseup dragtree.beforemouseup":function(e){t.dragEnd(),e.preventDefault()},statuschange:function(e){"textedit"==e.lastStatus&&"normal"==e.currentStatus&&t.preventDragMove()}},commands:{movetoparent:MoveToParentCommand}}}),KityMinder.registerModule("KeyboardModule",function(){function t(t){var e,i=[];t.traverse(function(t){e=t.getLayoutBox(),e.width&&e.height&&i.push({left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height,width:e.width,height:e.height,node:t,text:t.getText()})});for(var r=0;r<i.length;r++)n(i,r)}function e(t,e){var n,i,s,l,u,c,h;return n=r(t.left,e.left),i=o(t.right,e.right),s=r(t.top,e.top),l=o(t.bottom,e.bottom),u=i-n-t.width-e.width,c=l-s-t.height-e.height,h=0>u?c:0>c?u:a(u*u+c*c),{cx:h,cy:h}}function n(t,n){for(var i,r,o=t[n],a={},s=0;s<t.length;s++)s!=n&&(i=t[s],r=e(i,o),i.right<o.left&&(!a.left||r.cx<a.left.dist)&&(a.left={dist:r.cx,node:i.node}),i.left>o.right&&(!a.right||r.cx<a.right.dist)&&(a.right={dist:r.cx,node:i.node}),i.bottom<o.top&&(!a.top||r.cy<a.top.dist)&&(a.top={dist:r.cy,node:i.node}),i.top>o.bottom&&(!a.down||r.cy<a.down.dist)&&(a.down={dist:r.cy,node:i.node}));o.node._nearestNodes={right:a.right&&a.right.node||null,top:a.top&&a.top.node||null,left:a.left&&a.left.node||null,down:a.down&&a.down.node||null}}function i(e,n){var i=e.getSelectedNode();if(!i)return e.select(e.getRoot()),void t(e.getRoot());i._nearestNodes||t(e.getRoot());var r=i._nearestNodes[n];r&&e.select(r,!0)}var r=Math.min,o=Math.max,a=(Math.abs,Math.sqrt),s=(Math.exp,kity.createClass({base:Command,execute:function(t){var e=t.getSelectedNode();e&&e.parent&&t.select(e.parent,!0),this.setContentChanged(!1)},queryState:function(t){return t.getSelectedNode()?0:-1},enableReadOnly:!0}));return{commands:{navparent:s},commandShortcutKeys:{navparent:"shift+tab"},events:{layoutallfinish:function(){var e=this.getRoot();t(e)},"normal.keydown readonly.keydown":function(t){var e=this;["left","right","up","down"].forEach(function(n){t.isShortcutKey(n)&&i(e,"up"==n?"top":n)})},"normal.keyup":function(t){if(browser.ipad){var e=KityMinder.keymap,n=t.getTargetNode(),i=this.getLang();this.receiver&&(this.receiver.keydownNode=n);var r=t.originEvent;if(r.altKey||r.ctrlKey||r.metaKey||r.shiftKey)return;switch(r.keyCode){case e.Enter:this.execCommand("AppendSiblingNode",i.topic),t.preventDefault();break;case e.Backspace:case e.Del:t.preventDefault(),this.execCommand("RemoveNode")}}}}}}),KityMinder.registerModule("Select",function(){var t=this,e=t.getRenderContainer(),n=KityMinder.Geometry,i=function(){var i=null,r=new kity.Path,o=!1,a=10;return{selectStart:function(t){return t.originEvent.button||t.originEvent.altKey?void 0:i?this.selectEnd():void(i=n.snapToSharp(t.getPosition(e)))},selectMove:function(s){if("textedit"!=t.getStatus()&&i){var l=i,u=s.getPosition(e);if(!o){if(n.getDistance(l,u)<a)return;o=!0,e.addShape(r),r.fill(t.getStyle("marquee-background")).stroke(t.getStyle("marquee-stroke")).setOpacity(.8).getDrawer().clear()}var c=n.getBox(l,u),h=[];c.left=Math.round(c.left),c.top=Math.round(c.top),c.right=Math.round(c.right),c.bottom=Math.round(c.bottom),r.getDrawer().pipe(function(){this.clear(),this.moveTo(c.left,c.top),this.lineTo(c.right,c.top),this.lineTo(c.right,c.bottom),this.lineTo(c.left,c.bottom),this.close()}),t.getRoot().traverse(function(t){var e=t.getLayoutBox();n.getIntersectBox(e,c)&&h.push(t)}),t.select(h,!0),window.getSelection().removeAllRanges()}},selectEnd:function(){i&&(i=null),o&&(r.fadeOut(200,"ease",0,function(){r.remove&&r.remove()}),o=!1)}}}(),r=null,o=null;return{init:function(){window.addEventListener("mouseup",function(){i.selectEnd()})},events:{mousedown:function(t){var e=t.getTargetNode();e?t.originEvent.shiftKey?this.toggleSelect(e):e.isSelected()?this.isSingleSelect()||(r=e,o=t.getPosition(this.getRenderContainer())):this.select(e,!0):(this.removeAllSelectedNodes(),i.selectStart(t),this.setStatus("normal"))},mousemove:i.selectMove,mouseup:function(t){var e=t.getTargetNode();if(e&&e==r){var n=t.getPosition(this.getRenderContainer()),a=kity.Vector.fromPoints(o,n);a.length()<1&&this.select(r,!0),r=null}i.selectEnd(t)},"normal.keydown inputready.keydown":function(t){if(t.isShortcutKey("ctrl+a")){var e=[];this.getRoot().traverse(function(t){e.push(t)}),this.select(e,!0),t.preventDefault()}}}}}),KityMinder.registerModule("TextEditModule",function(){function t(t){if(t&&e.isSingleSelect()&&t.isSelected()){t.getTextGroup().setStyle("cursor","default");var o=t.getStyle("text-selection-color");if(r.updateByMinderNode(t),n.setHide().setStartOffset(0).setEndOffset(r.getTxtOfContainer().length).setColor(o),r.updateContainerRangeBySel(),browser.ie)var a=setInterval(function(){var t=i.nativeSel.getRangeAt(0);!t||t.collapsed?i.select():clearInterval(a)});e.setStatus("inputready")}}{var e=this,n=new Minder.Selection,i=new Minder.Range,r=new Minder.Receiver(this,n,i);new Minder.keyboarder(r)}this.receiver=r;var o,a,s,l,u=!1,c=!1,h=!1;return e.textEditNode=function(n){t(n),e.setStatus("textedit"),r.updateSelection()},{events:{ready:function(){document.body.appendChild(r.container)},"normal.beforemousedown textedit.beforemousedown inputready.beforemousedown":function(t){if(t.isRightMB())return void(t.getTargetNode()||this.setStatus("normal"));u=!0,h=n.isShow(),n.setHide();var a=t.getTargetNode();if(!a){var d=t.kityEvent.targetShape;d&&"Selection"==d.getType()&&(a=r.getMinderNode(),t.stopPropagationImmediately())}if(a&&this.isSingleSelect()&&a.isSelected()){l=a,o=a;var f=a.getTextGroup();return n.collapse(!0),n.setColor(a.getStyle("text-selection-color")),r.updateByMinderNode(a).updateIndexByMouse(t.getPosition(a.getRenderContainer())).setRange(i).setReady(),void(h&&(n.setShowStatus(),clearTimeout(s),s=setTimeout(function(){return c?void(c=!1):(n.collapse(!0).updatePosition(r.getOffsetByIndex()).setShow(),void f.setStyle("cursor","text"))},200),e.setStatus("textedit")))}r.clearReady(),r.clear(),l&&l.getTextGroup().setStyle("cursor","default")},"inputready.keyup":function(){n.isHide()&&t(this.getSelectedNode())},"normal.keyup":function(e){var i=this.getSelectedNode(),r=e.getKeyCode();if(i&&this.isSingleSelect()&&i.isSelected()&&!n.isShow()){var o=e.originEvent;!keymap.isSelectedNodeKey[r]||o.ctrlKey||o.metaKey||o.shiftKey||o.altKey||t(i)}},"normal.mouseup textedit.mouseup inputready.mouseup":function(i){u=!1;var s=i.getTargetNode();return o=null,s&&!h&&r.isReady()?(n.collapse(!0),n.setColor(s.getStyle("text-selection-color")),browser.ipad&&r.focus(),clearTimeout(a),a=setTimeout(function(){return c?void(c=!1):(n.collapse(!0).updatePosition(r.getOffsetByIndex()).setShow(),void s.getTextGroup().setStyle("cursor","text"))},200),void e.setStatus("textedit")):void(n.isHide()?t(i.getTargetNode()):n.collapsed||r.updateContainerRangeBySel())},"textedit.beforemousemove inputready.beforemousemove":function(t){if(!browser.ipad)if(u&&r.isReady()&&h){if(t.stopPropagationImmediately(),o){var n=t.getPosition(o.getRenderContainer());r.updateSelectionByMousePosition(n).updateSelection(n),setTimeout(function(){r.updateContainerRangeBySel()})}}else u&&!h&&(e.setStatus("normal"),r.clearReady())},"normal.dblclick textedit.dblclick inputready.dblclick":function(n){var i=n.getTargetNode();c=!0,i&&(t(i),e.setStatus("textedit"),r.updateSelection())},restoreScene:function(){r.clear(),t(this.getSelectedNode())},stopTextEdit:function(){r.clear(),e.setStatus("normal")},resize:function(){n.setHide()},execCommand:function(i){var o={appendchildnode:1,appendsiblingnode:1,editnode:1};return o[i.commandName]?(t(e.getSelectedNode()),void r.updateSelection()):void(n.isShow()&&r.updateTextOffsetData().updateSelection())},layoutfinish:function(t){t.node!==r.minderNode||"textedit"!=this.getStatus()&&"inputready"!=this.getStatus()||r.setContainerStyle()},selectionclear:function(){var n=e.getSelectedNode();n?t(n):(e.setStatus("normal"),r.clear())},blur:function(){!/\?debug#?/.test(location.href)&&r.clear()},"textedit.import":function(){e.setStatus("normal"),r.clear()},"inputready.mousewheel textedit.mousewheel":function(){r.setContainerStyle()},statuschange:function(t){"textedit"==t.lastStatus&&this.fire("contentchange")}}}}),Minder.keyboarder=kity.createClass("keyboarder",function(){return{constructor:function(t){this.re=t,this.container=t.container,this.selection=t.selection,this.range=t.range,this.km=t.km,this.lastMinderNode=null,this.isTypeText=!1,this._initEvent(),this.isShortcutCopyKey=!1},_initEvent:function(){var t=this;browser.ipad&&utils.listen(this.container,"keydown keypress keyup input",function(e){t._handleEvents.call(t,new MinderEvent("keyup"==e.type?"beforekeyup":e.type,e)),"keyup"==e.type&&"normal"==t.km.getStatus()&&t.km.fire("keyup",e)}),this.km.on("inputready.beforekeyup inputready.beforekeydown textedit.beforekeyup normal.keydown normal.keyup textedit.beforekeydown textedit.keypress textedit.paste",utils.proxy(this._handleEvents,this))},_handleEvents:function(t){switch(t.type){case"input":this._input(t);break;case"beforekeydown":this._beforeKeydown(t);break;case"beforekeyup":this._beforeKeyup(t);break;case"keyup":this._keyup(t)}},_setTextToContainer:function(t,e){var n=this;if(n.minderNode=n.re.minderNode,clearTimeout(n.timer),n.range.hasNativeRange()&&(!keymap.controlKeys[t]||e)){n.lastMinderNode===n.minderNode||keymap.notContentChange[t]||(n.km.fire("saveScene",{inputStatus:!0}),n.lastMinderNode=n.minderNode);var i=n.re.getTxtOfContainer();n.minderNode.setText(i),n.re.setContainerStyle(),n.minderNode.getRenderContainer().bringTop(),n.minderNode.render(),keymap.notContentChange[t]||(clearTimeout(n.inputTextTimer),n.inputTextTimer=setTimeout(function(){n.km.layout(300)},300)),n.re.updateTextOffsetData().updateRange().updateSelectionByRange(),n.selection.updateOffsetByTextData(n.re.textData).updatePosition(),"inputready"!=n.km.getStatus()&&n.selection.setHoldShow(),n.timer=setTimeout(function(){n.selection.isShow()&&n.selection.setShow()},200),n.km.setStatus("textedit")}},_input:function(){var t=this;browser.ipad&&setTimeout(function(){t._setTextToContainer()})},_beforeKeydown:function(t){var e=this,n=t.originEvent,i=n.keyCode;switch(this.isTypeText=229==i||0===i,i){case keymap.Enter:if(t.originEvent.shiftKey&&e.selection.isShow())return e._handlerEnterkey(),t.preventDefault(),!1;case keymap.Tab:case keymap.Insert:return void(this.selection.isShow()?(this.re.clear(),this.km.setStatus("inputready"),clearTimeout(e.inputTextTimer),t.preventDefault()):(this.km.setStatus("normal"),this.km.fire("contentchange")));case keymap.left:case keymap.right:case keymap.up:case keymap.down:case keymap.Backspace:case keymap.Del:case keymap["/"]:case keymap.F2:case keymap.Insert:if(this.selection.isHide())return void this.km.setStatus("normal");break;case keymap.Control:case keymap.Alt:case keymap.Cmd:if(this.selection.isHide()&&"textedit"!=this.km.getStatus()&&"inputready"!=this.km.getStatus())return void this.km.setStatus("normal")}if(t.originEvent.ctrlKey||t.originEvent.metaKey){if(this.selection.isHide()&&{86:1,88:1,67:1}[i])return this.isShortcutCopyKey=!0,void this.km.setStatus("normal");if(i==keymap.v)return void setTimeout(function(){e.range.updateNativeRange().insertNode($("<span>$$_kityminder_bookmark_$$</span>")[0]);var t=[];utils.each(e.container.getElementsByTagName("br"),function(e,n){t.push(n)}),utils.each(t,function(t,e){var n=document.createTextNode("\n");e.parentNode.insertBefore(n,e),e.parentNode.removeChild(e)});var n=e.container.textContent.replace(/[\u200b\t\r]/g,""),r=n.indexOf("$$_kityminder_bookmark_$$");e.re.setContainerTxt(n.replace("$$_kityminder_bookmark_$$","")),e.range.setStartOffset(r).collapse(!0).select(),e._setTextToContainer(i)},50);if(i==keymap.x)return void setTimeout(function(){e._setTextToContainer(i)},50)}this.isShortcutCopyKey=!1,e._setTextToContainer(i)},_beforeKeyup:function(t){var e=this,n=t.originEvent,i=n.keyCode;switch(i){case keymap.Enter:case keymap.Tab:case keymap.Insert:case keymap.F2:return browser.ipad?void(this.selection.isShow()?(this.re.clear(),this.km.setStatus("inputready"),clearTimeout(e.inputTextTimer),t.preventDefault()):(this.km.setStatus("normal"),this.km.fire("contentchange"))):(keymap.Enter==i&&(this.isTypeText||browser.mac&&browser.gecko)&&e._setTextToContainer(i,!0),this.re.keydownNode===this.re.minderNode&&(this.km.rollbackStatus(),this.re.clear()),void t.preventDefault());case keymap.Del:case keymap.Backspace:case keymap.Spacebar:return browser.ipad&&this.selection.isHide()?void this.km.setStatus("normal"):void e._setTextToContainer(i,!0)}return this.isTypeText?void e._setTextToContainer(i,!0):browser.mac&&browser.gecko?void e._setTextToContainer(i,!0):(e._setTextToContainer(i,!0),e.km.fire("saveScene",{inputStatus:!0}),!0)},_keyup:function(){var t,e=this,n=this.km.getSelectedNode();if("normal"==this.km.getStatus()&&n&&this.selection.isHide()){if(this.isShortcutCopyKey)return;n&&this.km.isSingleSelect()&&n.isSelected()&&(this.re.updateByMinderNode(n),this.selection.setHide().setStartOffset(0).setEndOffset(this.re.getTxtOfContainer().length).setColor(n.getStyle("text-selection-color")),setTimeout(function(){e.re.updateContainerRangeBySel()}),browser.ie&&(t=setInterval(function(){var n=e.range.nativeSel.getRangeAt(0);!n||n.collapsed?e.range.select():clearInterval(t)})),this.km.setStatus("inputready"))}},_handlerEnterkey:function(){function t(t){t&&3==t.nodeType&&0===t.nodeValue.length&&t.parentNode.removeChild(t)}var e=this.range,n=document.createElement("br"),i=this;e.collapsed||e.deleteContents(),e.insertNode(n),t(n.previousSibling),t(n.nextSibling),e.setStartAfter(n),e.collapse(!0);var r=e.startContainer.childNodes[e.startOffset];r||(n=n.cloneNode(!1),e.startContainer.appendChild(n),e.setStartBefore(n),e.collapse(!0)),e.select(),i._setTextToContainer(keymap.Enter)}}}()),Minder.Range=kity.createClass("Range",function(){function t(t,e){var n=t[e+"Container"],i=t[e+"Offset"],r=0;return 1==n.nodeType&&(n=n.childNodes[i],!n&&t.startContainer&&"DIV"==t.startContainer.nodeName?(t.startContainer.innerHTML="<p></p>",i=0):3==n.nodeType&&(i=0)),utils.each(t.container.childNodes,function(t,e){return e===n?1==e.nodeType?!1:(r+=i,!1):void(r+=1==e.nodeType?1:utils.clearWhitespace(e.nodeValue).length)}),r}function e(t,e,n){var i=0,r=t.container;utils.each(r.childNodes,function(o,a){if(1==a.nodeType)return i==e?(t["set"+n](r,o),!1):void i++;var s=utils.clearWhitespace(a.nodeValue).length;return i+s>=e?(t["set"+n](a,e-i),!1):void(i+=s)})}return{constructor:function(t){this.nativeRange=document.createRange(),this.nativeSel=window.getSelection(),this.startContainer=this.endContainer=this.startOffset=this.endOffset=null,this.collapsed=!1,this.container=t||null},hasNativeRange:function(){return 0!==this.nativeSel.rangeCount},deleteContents:function(){return this.nativeRange.deleteContents(),this._updateBoundary()},select:function(){var t=this.nativeRange.startContainer;if(1==t.nodeType&&0===t.childNodes.length){var e=document.createTextNode("");t.appendChild(e),this.nativeRange.setStart(e,1),this.nativeRange.collapse(!0)}else this.collapsed&&1==t.nodeType&&(t=t.childNodes[this.startOffset],t&&3==t.nodeType&&0===t.nodeValue.length&&(this.nativeRange.setStart(t,1),this.nativeRange.collapse(!0)));try{this.nativeSel.removeAllRanges()}catch(n){}return this.nativeSel.addRange(this.nativeRange),this},_updateBoundary:function(){var t=this.nativeRange;return this.startContainer=t.startContainer,this.startContainer=t.startContainer,this.endContainer=t.endContainer,this.startOffset=t.startOffset,this.endOffset=t.endOffset,this.collapsed=t.collapsed,this},setStartOffset:function(t){return e(this,t,"Start"),this},setEndOffset:function(t){return e(this,t,"End"),this},setStart:function(t,e){return this.nativeRange.setStart(t,e),this._updateBoundary(),this},setStartAfter:function(t){return this.setStart(t.parentNode,utils.getNodeIndex(t)+1)},setStartBefore:function(t){return this.setStart(t.parentNode,utils.getNodeIndex(t))},setEnd:function(t,e){return this.nativeRange.setEnd(t,e),this._updateBoundary(),this},update:function(){return this.updateNativeRange()._updateBoundary(),this},getStart:function(){return this.update(),{startContainer:this.startContainer,startOffset:this.startOffset}},getStartOffset:function(){return t(this,"start")},getEndOffset:function(){return t(this,"end")},collapse:function(t){return this.nativeRange.collapse(t===!0),this._updateBoundary(),this},isCollapsed:function(){return this._updateBoundary(),this.collapsed},insertNode:function(t){return this.nativeRange.insertNode(t),this._updateBoundary()},updateNativeRange:function(){return this.nativeRange=this.nativeSel.getRangeAt(0),this},clear:function(){return this.nativeSel.removeAllRanges(),this}}}()),Minder.Receiver=kity.createClass("Receiver",{clear:function(){return this.container.innerHTML="",this.selection&&this.selection.setHide(),this.range&&this.range.clear(),this.index=0,this},constructor:function(t,e,n){this.setKityMinder(t);var i=document.createElement("div");i.setAttribute("contenteditable",!0),i.className="km_receiver",this.container=i,utils.addCssRule("km_receiver_css"," .km_receiver{white-space:nowrap;position:absolute;padding:0;margin:0;word-wrap:break-word;"+(/\?debug#?/.test(location.href)?"":"clip:rect(1em 1em 1em 1em);")),this.index=0,this.selection=e,this.range=n,this.range.container=i},setRange:function(t,e){this.index=e||this.index,this.range=t,t.setStartOffset(this.index),t.collapse(!0);var n=this;return setTimeout(function(){n.container.focus(),t.select()
|
||
}),this},setTextGroup:function(t){return this.textGroup=t,this},setKityMinder:function(t){return this.km=t,this},updateByMinderNode:function(t){return this.setMinderNode(t),this._addSelection(),this.setTextGroup(t.getTextGroup()),this.setContainerStyle(),this.updateTextOffsetData(),this.setSelectionHeight(),this.setContainerTxt(),this},setMinderNode:function(t){return this.minderNode=t,this.selection.setMinderNode(t),this},_addSelection:function(){return this.selection.container&&this.selection.remove(),this.minderNode.getRenderContainer().addShape(this.selection),this},getMinderNode:function(){return this.minderNode},updateIndex:function(){return this.index=this.range.getStartOffset(),this},setSelection:function(t){return this.selection=t,this},updateSelection:function(t){return this.selection.update(this.textData,t),this},getOffsetByIndex:function(t){return utils.getValueByIndex(this.textData,void 0!==t?t:this.index)},getBaseOffset:function(){var t=this.textGroup.getRenderBox("screen");return t},setContainerStyle:function(){var t=this.getBaseOffset();return this.container.style.cssText=";left:"+(browser.ipad?"-":"")+t.x+"px;top:"+(t.y+(/\?debug#?/.test(location.href)?this.textGroup.getItems().length*this.getlineHeight():0))+"px;width:"+t.width+"px;height:"+t.height+"px;",this},updateTextOffsetData:function(){var t,e=this,n=this.minderNode.getData("font-size")||this.minderNode.getStyle("font-size"),i=this.minderNode.getStyle("line-height")*n,r=(e.textGroup.getShapes().length*i-(i-n))/2;return this.textData=[],e.textGroup.eachItem(function(n,o){e.textData[n]=[];for(var a=n*i+1,s=o.getContent(),l=0,u=s.length;u>l;l++){try{t=o.getExtentOfChar(l)}catch(c){console.log(c)}e.textData[n].push({x:t.x,y:a-r,width:t.width,height:t.height})}0===s.length&&e.textData[n].push({x:0,y:a-r,width:0,height:i})}),this},getlineHeight:function(){return this.minderNode.getStyle("line-height")*(this.minderNode.getData("font-size")||this.minderNode.getStyle("font-size"))},updateIndexByMouse:function(t){var e=this;e.updateTextOffsetData(),this.index=0;var n=this.getlineHeight();return utils.each(this.textData,function(i,r){var o=r[0];return o.y<=t.y&&o.y+n>=t.y?(utils.each(r,function(n,i){return 0===n&&t.x<=i.x?!1:t.x>=i.x&&t.x<=i.x+i.width?(e.index+=t.x-i.x>i.width/2?n+1:n,!1):n==r.length-1&&t.x>=i.x?(e.index+=1==r.length&&0===r[0].width?0:r.length,!1):void 0}),!1):void(e.index+=r.length+(1==r.length&&0===r[0].width?0:1))}),this.selection.setStartOffset(this.index).collapse(!0),this},setSelectionHeight:function(){return this.selection.setHeight(1*(this.minderNode.getData("font-size")||this.minderNode.getStyle("font-size"))),this},updateSelectionByMousePosition:function(t){var e=this,n=0,i=this.getlineHeight();return utils.each(this.textData,function(r,o){var a=o[0];return a.y<=t.y&&a.y+i>=t.y?(utils.each(o,function(e,i){return 0===e&&t.x<=i.x?!1:t.x>=i.x&&t.x<=i.x+i.width?(n+=e,t.x-i.x>i.width/2&&(n+=1),!1):e==o.length-1&&t.x>=i.x?(n+=1==o.length&&0===o[0].width?0:o.length,!1):void 0}),!1):a.y>t.y&&0===r?(n=0,!1):r==e.textData.length-1&&a.y+i<t.y?(n+=o.length+1,!1):void(n+=o.length+(1==o.length&&0===o[0].width?0:1))}),n<e.index?(this.selection.setStartOffset(n),this.selection.setEndOffset(e.index)):n==e.index?this.selection.setStartOffset(n).collapse(!0):(this.selection.setStartOffset(e.index),this.selection.setEndOffset(n)),this},updateRange:function(){return this.range.update(),this},updateContainerRangeBySel:function(){var t=this;return this.range.setStartOffset(this.selection.startOffset),this.range.setEndOffset(this.selection.endOffset),browser.gecko?(this.container.focus(),setTimeout(function(){t.range.select()})):this.range.select(),this},updateSelectionByRange:function(){return this.selection.setStartOffset(this.range.getStartOffset()),this.selection.setEndOffset(this.range.getEndOffset()),this},setIndex:function(t){return this.index=t,this},setContainerTxt:function(t){function e(t){return t.replace(/</g,"<").replace(/>/g,">")}return t?(t=e(t),t=t.replace(/[\n]/g,"<br/>")):(t="",this.textGroup.eachItem(function(n,i){t+=e(i.getContent())+"<br/>"})),this.container.innerHTML=t,this},setReady:function(){this._ready=!0},clearReady:function(){this._ready=!1},isReady:function(){return this._ready},focus:function(){this.container.focus()},getTxtOfContainer:function(){var t="",e=this.container;return utils.each(e.childNodes,function(n,i){3==i.nodeType?t+=i.nodeValue.replace(/[\u200b]/g,""):i!==e.lastChild&&(t+="\n")}),t}}),Minder.Selection=kity.createClass("Selection",{base:kity.Path,constructor:function(t){this.callBase(),this.height=t||20,this.setAttr("id","_kity_selection"),this.width=2,this.fill("rgb(27,171,255)"),this.setHide(),this.timer=null,this.collapsed=!0,this.startOffset=this.endOffset=0,this.setOpacity(.5),this.setStyle("cursor","text"),this._show=!1,this.offset=[],this.setTranslate(-.5,-1.5)},setMinderNode:function(t){this.minderNode=t},setColor:function(t){this.fill(t)},updateOffsetByTextData:function(t){if(this.collapsed)return this.offset=utils.getValueByIndex(t,this.startOffset),this;var e=[],n={},i=this.startOffset,r=this.endOffset,o=0;return utils.each(t,function(t,a){return n={width:0,x:0,y:0},utils.each(a,function(t,e){if(o>=i&&r>=o)if(0===t||o===i)n.x=e.x,n.y=e.y,n.width=e.width;else if(r>o)n.width+=e.width;else if(o===r)return!1;o++}),void 0!==n.x&&e.push(n),o===r?!1:void((1!=a.length||0!==a[0].width)&&o++)}),this.offset=e,this},updatePosition:function(t){var e=this,n=Math.round,i=function(t,e,i,r){return["M",n(t),n(e),"h",n(i),"v",n(r),"h",-n(i),"v",-n(r),"z"]};if(t=void 0!==t?t:this.offset,this.collapsed){if(isNaN(t.x)||isNaN(t.y))return console&&console.warn("editor.selection.js 不正确的偏移位置"),this;this.setPathData(i(t.x,t.y,this.width,this.height))}else this.setPathData(t.reduce(function(t,n){return t.concat(i(n.x,n.y,n.width,e.height))},[]));return this._show=!0,this},collapse:function(t){return this.setOpacity(1),this.collapsed=!0,t?this.endOffset=this.startOffset:this.startOffset=this.endOffset,this},setStartOffset:function(t){return this.startOffset=t,this.startOffset>=this.endOffset?(this.collapse(!0),this):(this.collapsed=!1,this.setOpacity(.5),this)},setEndOffset:function(t){return this.endOffset=t,this.endOffset<=this.startOffset?(this.startOffset=t,this.collapse(!0),this):(this.collapsed=!1,this.setOpacity(.5),this)},update:function(t,e){return t&&this.updateOffsetByTextData(t,e),this.updatePosition(),this.setShow(),this},setHeight:function(t){return this.height=Math.round(t)+2,this},setHide:function(){return clearInterval(this.timer),this.setStyle("display","none"),this._show=!1,this},setHoldShow:function(){return this.setStyle("display",""),clearInterval(this.timer),this},setShow:function(){this.bringTop(),clearInterval(this.timer);var t=this,e="";return t.setStyle("display",""),t._show=!0,this.collapsed&&(t.setOpacity(1),this.timer=setInterval(function(){t.setStyle("display",e),e=e?"":"none"},400)),this},setShowStatus:function(){return this._show=!0,this},isShow:function(){return this._show},isHide:function(){return!this._show}}),KityMinder.registerModule("basestylemodule",function(){function t(t,e){return t.getData(e)||t.getStyle(e)}var e=this;return KityMinder.TextRenderer.registerStyleHook(function(e,n){{var i=t(e,"font-weight"),r=t(e,"font-style");[i,r].join("/")}n.eachItem(function(t,e){e.setFont({weight:i,style:r})})}),{commands:{bold:kity.createClass("boldCommand",{base:Command,execute:function(t){var e=t.getSelectedNodes();1==this.queryState("bold")?utils.each(e,function(t,e){e.setData("font-weight").render()}):utils.each(e,function(t,e){e.setData("font-weight","bold").render()}),t.layout()},queryState:function(){var t=e.getSelectedNodes(),n=0;return 0===t.length?-1:(utils.each(t,function(t,e){return e&&e.getData("font-weight")?(n=1,!1):void 0}),n)}}),italic:kity.createClass("italicCommand",{base:Command,execute:function(t){var e=t.getSelectedNodes();1==this.queryState("italic")?utils.each(e,function(t,e){e.setData("font-style").render()}):utils.each(e,function(t,e){e.setData("font-style","italic").render()}),t.layout()},queryState:function(){var t=e.getSelectedNodes(),n=0;return 0===t.length?-1:(utils.each(t,function(t,e){return e&&e.getData("font-style")?(n=1,!1):void 0}),n)}})},commandShortcutKeys:{bold:"ctrl+b",italic:"ctrl+i"}}}),KityMinder.registerModule("fontmodule",function(){function t(t,e){return t.getData(e)||t.getStyle(e)}KityMinder.TextRenderer.registerStyleHook(function(e,n){var i=e.getData("color"),r=e.getStyle("selected-color"),o=e.getStyle("color"),a=i||(e.isSelected()&&r?r:o),s=t(e,"font-family"),l=t(e,"font-size"),u=[s,l].join("/");n.fill(a),e.setTmpData("fore-color",a.toString()),n.eachItem(function(t,e){e.setFont({family:s,size:l})}),e.setTmpData("font-hash",u)});var e=[{name:"Arial",val:"arial,helvetica,sans-serif"},{name:"arialBlack",val:"arial black,avant garde"},{name:"Comic Sans Ms",val:"comic sans ms"},{name:"Impact",val:"impact,chicago"},{name:"Times New Roman",val:"times new roman"},{name:"Andale Mono",val:"andale mono"}],n=[{name:"宋体",val:"宋体,SimSun"},{name:"微软雅黑",val:"微软雅黑,Microsoft YaHei"},{name:"楷体",val:"楷体,楷体_GB2312,SimKai"},{name:"黑体",val:"黑体, SimHei"},{name:"隶书",val:"隶书, SimLi"},{name:"Sans-Serif",val:"sans-serif"}];return-1!=KITYMINDER_CONFIG.lang.indexOf("zh-")&&(e=n.concat(e)),{defaultOptions:{fontfamily:e,fontsize:[10,12,16,18,24,32,48]},commands:{forecolor:kity.createClass("fontcolorCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNodes();utils.each(n,function(t,n){n.setData("color",e),n.render()})},queryState:function(t){return 0==t.getSelectedNodes().length?-1:0},queryValue:function(t){return 1==t.getSelectedNodes().length?t.getSelectedNodes()[0].getData("color"):"mixed"}}),background:kity.createClass("backgroudCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNodes();utils.each(n,function(t,n){n.setData("background",e),n.render()})},queryState:function(t){return 0==t.getSelectedNodes().length?-1:0},queryValue:function(t){return 1==t.getSelectedNodes().length?t.getSelectedNodes()[0].getData("background"):"mixed"}}),fontfamily:kity.createClass("fontfamilyCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNodes();utils.each(n,function(n,i){i.setData("font-family",e),i.render(),t.layout()})},queryState:function(t){return 0===t.getSelectedNodes().length?-1:0},queryValue:function(t){var e=t.getSelectedNode();return e?e.getData("font-family"):null}}),fontsize:kity.createClass("fontsizeCommand",{base:Command,execute:function(t,e){var n=t.getSelectedNodes();utils.each(n,function(n,i){i.setData("font-size",e),i.render(),t.layout(300)})},queryState:function(t){return 0==t.getSelectedNodes().length?-1:0},queryValue:function(t){var e=t.getSelectedNode();return e?e.getData("font-size"):null}})}}}),KityMinder.registerModule("Zoom",function(){function t(){var t=r._zoomValue>=100?"optimize-speed":"geometricPrecision";r.getRenderContainer().setAttr("text-rendering",t)}function e(t){var e=t.shapeNode,n=e.getCTM(),i=new kity.Matrix(n.a,n.b,n.c,n.d,(0|n.e)+.5,(0|n.f)+.5);e.setAttribute("transform","matrix("+i.toString()+")")}function n(e,n){{var r=e.getPaper();r.getViewPort()}if(n){if(t(),e.getRoot().getComplex()>200)e._zoomValue=n,e.zoom(n),e.fire("viewchange");else{var o=new kity.Animator({beginValue:e._zoomValue,finishValue:n,setter:function(t,e){t.zoom(e)}});e._zoomValue=n,i&&i.pause(),i=o.start(e,300,"easeInOutSine"),i.on("finish",function(){e.fire("viewchange")})}e.fire("zoom",{zoom:n})}}var i,r=this;r.setDefaultOptions("zoom",[10,20,30,50,80,100,120,150,200]),kity.extendClass(Minder,{zoom:function(t){var n=this.getPaper(),i=n.getViewPort();i.zoom=t/100,i.center={x:i.center.x,y:i.center.y},n.setViewPort(i),100==t&&e(n)},getZoomValue:function(){return this._zoomValue}});var o=kity.createClass("Zoom",{base:Command,execute:n,queryValue:function(t){return t._zoomValue}}),a=kity.createClass("ZoomInCommand",{base:Command,execute:function(t){n(t,this.nextValue(t))},queryState:function(t){return+!this.nextValue(t)},nextValue:function(t){var e,n=t.getOptions("zoom");for(e=0;e<n.length;e++)if(n[e]>t._zoomValue)return n[e];return 0},enableReadOnly:!0}),s=kity.createClass("ZoomOutCommand",{base:Command,execute:function(t){n(t,this.nextValue(t))},queryState:function(t){return+!this.nextValue(t)},nextValue:function(t){var e,n=t.getOptions("zoom");for(e=n.length-1;e>=0;e--)if(n[e]<t._zoomValue)return n[e];return 0},enableReadOnly:!0});return{init:function(){this._zoomValue=100,t()},commands:{"zoom-in":a,"zoom-out":s,zoom:o},events:{"normal.mousewheel readonly.mousewheel":function(t){if(t.originEvent.ctrlKey||t.originEvent.metaKey){var e=t.originEvent.wheelDelta,n=this;kity.Browser.mac||(e=-e),Math.abs(e)>100&&(clearTimeout(this._wheelZoomTimeout),this._wheelZoomTimeout=setTimeout(function(){n.getPaper()._zoom||1;0>e?n.execCommand("zoom-in"):e>0&&n.execCommand("zoom-out")},100),t.originEvent.preventDefault())}}},commandShortcutKeys:{"zoom-in":"ctrl+=","zoom-out":"ctrl+-"}}}),KityMinder.registerModule("hyperlink",function(){var t="M16.614,10.224h-1.278c-1.668,0-3.07-1.07-3.599-2.556h4.877c0.707,0,1.278-0.571,1.278-1.278V3.834 c0-0.707-0.571-1.278-1.278-1.278h-4.877C12.266,1.071,13.668,0,15.336,0h1.278c2.116,0,3.834,1.716,3.834,3.834V6.39 C20.448,8.508,18.73,10.224,16.614,10.224z M5.112,5.112c0-0.707,0.573-1.278,1.278-1.278h7.668c0.707,0,1.278,0.571,1.278,1.278 S14.765,6.39,14.058,6.39H6.39C5.685,6.39,5.112,5.819,5.112,5.112z M2.556,3.834V6.39c0,0.707,0.573,1.278,1.278,1.278h4.877 c-0.528,1.486-1.932,2.556-3.599,2.556H3.834C1.716,10.224,0,8.508,0,6.39V3.834C0,1.716,1.716,0,3.834,0h1.278 c1.667,0,3.071,1.071,3.599,2.556H3.834C3.129,2.556,2.556,3.127,2.556,3.834z";return{commands:{hyperlink:kity.createClass("hyperlink",{base:Command,execute:function(t,e,n){var i=t.getSelectedNodes();utils.each(i,function(t,i){i.setData("hyperlink",e),i.setData("hyperlinkTitle",n),i.render()}),t.layout()},queryState:function(t){var e=t.getSelectedNodes(),n=0;return 0===e.length?-1:(utils.each(e,function(t,e){return e&&e.getData("hyperlink")?(n=0,!1):void 0}),n)},queryValue:function(t){var e=t.getSelectedNode();return{url:e.getData("hyperlink"),title:e.getData("hyperlinkTitle")}}}),unhyperlink:kity.createClass("hyperlink",{base:Command,execute:function(t){var e=t.getSelectedNodes();utils.each(e,function(t,e){e.setData("hyperlink"),e.render()}),t.layout()},queryState:function(t){var e=t.getSelectedNodes();if(0===e.length)return-1;var n=!1;return utils.each(e,function(t,e){return e.getData("hyperlink")?(n=!0,!1):void 0}),n?0:-1}})},renderers:{right:kity.createClass("hyperlinkrender",{base:KityMinder.Renderer,create:function(){var e=new kity.HyperLink,n=new kity.Path,i=new kity.Rect(24,22,-2,-6,4).fill("rgba(255, 255, 255, 0)");return n.setPathData(t).fill("#666"),e.addShape(i),e.addShape(n),e.setTarget("_blank"),e.setStyle("cursor","pointer"),e.on("mouseover",function(){i.fill("rgba(255, 255, 200, .8)")}).on("mouseout",function(){i.fill("rgba(255, 255, 255, 0)")}),e},shouldRender:function(t){return t.getData("hyperlink")},update:function(t,e,n){var i=e.getData("hyperlink");t.setHref(i);var r=e.getData("hyperlinkTitle");r=r?[r,"(",i,")"].join(""):i,t.node.setAttributeNS("http://www.w3.org/1999/xlink","title",r);var o=e.getStyle("space-right");return t.setTranslate(n.right+o+2,-5),new kity.Box({x:n.right+o,y:-11,width:24,height:22})}})}}}),kity.extendClass(MinderNode,{arrange:function(t){var e=this.parent;if(e){var n=e.children;if(!(0>t||t>=n.length))return n.splice(this.getIndex(),1),n.splice(t,0,this),this}}});var ArrangeUpCommand=kity.createClass("ArrangeUpCommand",{base:Command,execute:function(t){var e=t.getSelectedNodes();e.sort(asc);var n=e.map(function(t){return t.getIndex()});e.forEach(function(t,e){t.arrange(n[e]-1)}),t.layout(300)},queryState:function(t){var e=t.getSelectedNode();return e?0:-1}}),ArrangeDownCommand=kity.createClass("ArrangeUpCommand",{base:Command,execute:function(t){var e=t.getSelectedNodes();e.sort(desc);var n=e.map(function(t){return t.getIndex()});e.forEach(function(t,e){t.arrange(n[e]+1)}),t.layout(300)},queryState:function(t){var e=t.getSelectedNode();return e?0:-1}}),ArrangeCommand=kity.createClass("ArrangeCommand",{base:Command,execute:function(t,e,n){if(e=e&&e.slice()||t.getSelectedNodes().slice(),e.length){var i=MinderNode.getCommonAncestor(e);if(i==e[0].parent){var r=e.map(function(t){return{index:t.getIndex(),node:t}}),o=Math.min.apply(Math,r.map(function(t){return t.index}))>=n;r.sort(function(t,e){return o?e.index-t.index:t.index-e.index}),r.forEach(function(t){t.node.arrange(n)}),t.layout(300)}}},queryState:function(t){var e=t.getSelectedNode();return e?0:-1}});KityMinder.registerModule("ArrangeModule",{commands:{arrangeup:ArrangeUpCommand,arrangedown:ArrangeDownCommand,arrange:ArrangeCommand},contextmenu:[{command:"arrangeup"},{command:"arrangedown"},{divider:!0}],commandShortcutKeys:{arrangeup:"normal::alt+Up",arrangedown:"normal::alt+Down"}}),KityMinder.registerModule("ClipboardModule",function(){function t(e,i){r.push(i),n.appendNode(i,e),i.render(),i.setLayoutOffset(null);for(var o,a=utils.cloneArr(i.children),s=0;o=a[s];s++)t(i,o)}function e(t){t.length&&(t.sort(function(t,e){return t.getIndex()-e.getIndex()}),i=t.map(function(t){return t.clone()}))}var n=this,i=[],r=[],o=kity.createClass("CopyCommand",{base:Command,execute:function(t){e(t.getSelectedAncestors(!0)),this.setContentChanged(!1)}}),a=kity.createClass("CutCommand",{base:Command,execute:function(t){var n=t.getSelectedAncestors();0!==n.length&&(e(n),t.select(MinderNode.getCommonAncestor(n),!0),n.slice().forEach(function(e){t.removeNode(e)}),t.layout(300))}}),s=kity.createClass("PasteCommand",{base:Command,execute:function(e){if(i.length){var n=e.getSelectedNode();if(!n)return;for(var o,a=0;o=i[a];a++)t(n,o.clone());e.select(r,!0),r=[],e.layout(300)}},queryState:function(t){return t.getSelectedNode()?0:-1}});return{commands:{copy:o,cut:a,paste:s},commandShortcutKeys:{copy:"normal::ctrl+c|",cut:"normal::ctrl+x",paste:"normal::ctrl+v"}}}),KityMinder.registerModule("StyleModule",function(){function t(t){for(var n=t.getData(),i=0;i<e.length;i++)if(e[i]in n)return!0}var e=["font-size","font-family","font-weight","font-style","background","color"],n=null;return{commands:{copystyle:kity.createClass("CopyStyleCommand",{base:Command,execute:function(t){var i=t.getSelectedNode(),r=i.getData();return n={},e.forEach(function(t){t in r?n[t]=r[t]:(n[t]=null,delete n[t])}),n},queryState:function(e){var n=e.getSelectedNodes();return 1!==n.length?-1:t(n[0])?0:-1}}),pastestyle:kity.createClass("PastStyleCommand",{base:Command,execute:function(t){return t.getSelectedNodes().forEach(function(t){for(var e in n)n.hasOwnProperty(e)&&t.setData(e,n[e])}),t.renderNodeBatch(t.getSelectedNodes()),t.layout(300),n},queryState:function(t){return n&&t.getSelectedNodes().length?0:-1}}),clearstyle:kity.createClass("ClearStyleCommand",{base:Command,execute:function(t){return t.getSelectedNodes().forEach(function(t){e.forEach(function(e){t.setData(e)})}),t.renderNodeBatch(t.getSelectedNodes()),t.layout(300),n},queryState:function(e){var n=e.getSelectedNodes();if(!n.length)return-1;for(var i=0;i<n.length;i++)if(t(n[i]))return 0;return-1}})}}}),KityMinder.registerProtocol("xmind",function(){var t={"priority-1":["priority",1],"priority-2":["priority",2],"priority-3":["priority",3],"priority-4":["priority",4],"priority-5":["priority",5],"priority-6":["priority",6],"priority-7":["priority",7],"priority-8":["priority",8],"task-start":["progress",1],"task-oct":["progress",2],"task-quarter":["progress",3],"task-3oct":["progress",4],"task-half":["progress",5],"task-5oct":["progress",6],"task-3quar":["progress",7],"task-7oct":["progress",8],"task-done":["progress",9]};return{fileDescription:"XMind 格式",fileExtension:".xmind",dataType:"blob",mineType:"application/octet-stream",decode:function(e){function n(e,i){if(i.data={text:e.title},e.marker_refs&&e.marker_refs.marker_ref){var r,o=e.marker_refs.marker_ref;if(o.length&&o.length>0)for(var a in o)r=t[o[a].marker_id],r&&(i.data[r[0]]=r[1]);else r=t[o.marker_id],r&&(i.data[r[0]]=r[1])}e["xlink:href"]&&(i.data.hyperlink=e["xlink:href"]);var s=e.children&&e.children.topics,l=s&&(s.topic||s[0]&&s[0].topic);if(l){var u=l;if(u.length&&u.length>0){i.children=[];for(var a in u)i.children.push({}),n(u[a],i.children[a])}else i.children=[{}],n(u,i.children[0])}}function i(t){var e=$.xml2json(t),i={},r=e.sheet,o=utils.isArray(r)?r[0].topic:r.topic;return n(o,i),i}function r(t){return new Promise(function(e,n){zip.createReader(new zip.BlobReader(t),function(t){t.getEntries(e)},n)})}function o(t){return new Promise(function(e,n){for(var r,o;(r=t.pop())&&"content.xml"!=r.filename.split("/").pop();)r=null;r?r.getData(new zip.TextWriter,function(t){try{o=i($.parseXML(t)),e(o)}catch(r){n(r)}}):n(new Error("Content document missing"))})}return r(e).then(o)},encode:function(t,e,n){function i(){return new Promise(function(t,e){var n=new XMLHttpRequest;n.open("POST",o),n.responseType="blob",n.onload=t,n.onerror=e;var i=new FormData;i.append("type","xmind"),i.append("data",a),n.send(i)}).then(function(t){return t.target.response})}function r(){function t(t,e){var n=document.createElement("input");return n.type="hidden",n.name=t,n.value=e,n}var e=n.filename||"xmind.xmind",i=document.createElement("form");i.setAttribute("action",o),i.setAttribute("method","POST"),i.appendChild(t("filename",e)),i.appendChild(t("type","xmind")),i.appendChild(t("data",a)),i.appendChild(t("download","1")),document.body.appendChild(i),i.submit(),document.body.removeChild(i)}var o="native-support/export.php",a=JSON.stringify(t);return n&&n.download?r():i()},recognizePriority:-1}}),KityMinder.registerProtocol("freemind",function(){function t(e,i){i.data={text:e.TEXT};var r;if(e.icon){var o,a=e.icon;if(a.length&&a.length>0)for(r in a)o=n[a[r].BUILTIN],o&&(i.data[o[0]]=o[1]);else o=n[a.BUILTIN],o&&(i.data[o[0]]=o[1])}if(e.LINK&&(i.data.hyperlink=e.LINK),e.node){var s=e.node;if(s.length&&s.length>0){i.children=[];for(r in s)i.children.push({}),t(s[r],i.children[r])}else i.children=[{}],t(s,i.children[0])}}function e(e){var n=$.xml2json(e),i={};return t(n.node,i),i}var n={"full-1":["priority",1],"full-2":["priority",2],"full-3":["priority",3],"full-4":["priority",4],"full-5":["priority",5],"full-6":["priority",6],"full-7":["priority",7],"full-8":["priority",8]};return{fileDescription:"Freemind 格式",fileExtension:".mm",dataType:"text",decode:function(t){return new Promise(function(n,i){try{n(e(t))}catch(r){i(new Error("XML 文件损坏!"))}})},encode:function(t,e,n){function i(){return new Promise(function(t,e){var n=new XMLHttpRequest;n.open("POST",o),n.responseType="blob",n.onload=t,n.onerror=e;var i=new FormData;i.append("type","freemind"),i.append("data",a),n.send(i)}).then(function(t){return t.target.response})}function r(){function t(t,e){var n=document.createElement("input");return n.type="hidden",n.name=t,n.value=e,n}var e=n.filename||"freemind.mm",i=document.createElement("form");i.setAttribute("action",o),i.setAttribute("method","POST"),i.appendChild(t("filename",e)),i.appendChild(t("type","freemind")),i.appendChild(t("data",a)),i.appendChild(t("download","1")),document.body.appendChild(i),i.submit(),document.body.removeChild(i)}var o="native-support/export.php",a=JSON.stringify(t);return n&&n.download?r():i()}}}),KityMinder.registerProtocol("mindmanager",function(){function t(e,n){if(n.data={text:e.Text&&e.Text.PlainText||""},e.Task){var i;e.Task.TaskPriority&&(i=r[e.Task.TaskPriority],i&&(n.data[i[0]]=i[1])),e.Task.TaskPercentage&&(i=r[e.Task.TaskPercentage],i&&(n.data[i[0]]=i[1]))}if(e.Hyperlink&&(n.data.hyperlink=e.Hyperlink.Url),e.SubTopics&&e.SubTopics.Topic){var o=e.SubTopics.Topic;if(o.length&&o.length>0){n.children=[];for(var a in o)n.children.push({}),t(o[a],n.children[a])}else n.children=[{}],t(o,n.children[0])}}function e(e){var n=$.xml2json(e),i={};return t(n.OneTopic.Topic,i),i}function n(t){return new Promise(function(e,n){zip.createReader(new zip.BlobReader(t),function(t){t.getEntries(e)},n)})}function i(t){return new Promise(function(n,i){for(var r,o;(r=t.pop())&&"Document.xml"!=r.filename.split("/").pop();)r=null;r?r.getData(new zip.TextWriter,function(t){o=e($.parseXML(t)),n(o)}):i(new Error("Main document missing"))})}var r={"urn:mindjet:Prio1":["PriorityIcon",1],"urn:mindjet:Prio2":["PriorityIcon",2],"urn:mindjet:Prio3":["PriorityIcon",3],"urn:mindjet:Prio4":["PriorityIcon",4],"urn:mindjet:Prio5":["PriorityIcon",5],0:["ProgressIcon",1],25:["ProgressIcon",2],50:["ProgressIcon",3],75:["ProgressIcon",4],100:["ProgressIcon",5]};return{fileDescription:"MindManager 格式",fileExtension:".mmap",dataType:"blob",decode:function(t){return n(t).then(i)},encode:null,recognizePriority:-1}}),KityMinder.registerProtocol("plain",function(){function t(t,e){for(var n="";e--;)n+=t;return n}function e(n,i){var r="";return i=i||0,r+=t(l,i),r+=n.data.text+a,n.children&&n.children.forEach(function(t){r+=e(t,i+1)}),r}function n(t){return!/\S/.test(t)}function i(t){for(var e=0;t.charAt(e)===l;)e++;return e}function r(t){return{data:{text:t.replace(new RegExp("^"+l+"*"),"")}}}function o(t,e){function o(t,e){var n=t.children||(t.children=[]);n.push(e)}var a,l,u,c,h,d={},f=t.split(s);e?(d[0]=a=r("root"),l=1):l=0;for(var p=0;p<f.length;p++)if(u=f[p],!n(u)){if(c=i(u)+l,h=r(u),0===c){if(a)throw new Error("Invalid local format");a=h}else{if(!d[c-1])throw new Error("Invalid local format");o(d[c-1],h)}d[c]=h}return a}var a="\r",s=/\r\n|\r|\n/,l=" ";return{fileDescription:"大纲文本",fileExtension:".txt",mineType:"text/plain",dataType:"text",encode:function(t){return e(t,0)},decode:function(t,e){return o(t,e)},recognizePriority:-1}}),KityMinder.registerProtocol("markdown",function(){function t(t){return e(t,1).join("\n")}function e(t,i){var r=[];i=i||1;var o=n(i);r.push(o+" "+t.data.text),r.push(u);var a=t.data.note;if(a){var s=/^#/.test(a);s&&(r.push(c),a=a.replace(/^#+/gm,function(t){return o+t})),r.push(a),s&&r.push(h),r.push(u)}return t.children&&t.children.forEach(function(t){r=r.concat(e(t,i+1))}),r}function n(t){for(var e="";t--;)e+="#";return e}function i(t){var e,n,i,u,c,h,d,f={};t=t.replace(/^(.+)\n={3,}/,function(t,e){return"# "+e}),e=t.split(l);for(var p=0;p<e.length;p++)n=e[p],i=a(n),i.noteClose?h=!1:i.noteStart?h=!0:(d=i.codeBlock?!d:d,h||d||!i.level||i.level>u+1?c&&o(c,n):(u=i.level,c=r(i.content,f[u-1]),f[u]=c));return s(f[1]),f[1]}function r(t,e){var n={data:{text:t,note:""}};return e&&(e.children?e.children.push(n):e.children=[n]),n}function o(t,e){t.data.note+=e+"\n"}function a(t){var e=/^(#+)?\s*(.*)$/.exec(t);return{level:e[1]&&e[1].length||null,content:e[2],noteStart:t==c,noteClose:t==h,codeBlock:/^\s*```/.test(t)}}function s(t){if(/\S/.test(t.data.note)){for(var e=t.data.note.split("\n");e.length&&!/\S/.test(e[0]);)e.shift();for(;e.length&&!/\S/.test(e[e.length-1]);)e.pop();t.data.note=e.join("\n")}else t.data.note=null,delete t.data.note;t.children&&t.children.forEach(s)}var l=/\r\n|\r|\n/,u="",c="<!--Note-->",h="<!--/Note-->";return{fileDescription:"Markdown/GFM 格式",fileExtension:".md",mineType:"text/markdown",dataType:"text",encode:function(e){return t(e)},decode:function(t){return i(t)},recognizePriority:-1}}),KityMinder.registerProtocol("json",function(){return{fileDescription:"KityMinder 格式",fileExtension:".km",dataType:"text",mineType:"application/json",encode:function(t){return JSON.stringify(t)},decode:function(t){return JSON.parse(t)}}}),kity.Browser.ie||KityMinder.registerProtocol("png",function(t){function e(t){return new Promise(function(e,n){var i=document.createElement("img");i.onload=function(){e(this)},i.onerror=function(t){n(t)},i.crossOrigin="",i.src=t})}function n(){var e,n,i,o,a,s=t.getPaper(),l=(s.container,t.getRenderContainer()),u=l.getRenderBox(),c=u.width+1,h=u.height+1;return e=s.shapeNode.getAttribute("transform"),s.shapeNode.setAttribute("transform","translate(0.5, 0.5)"),l.translate(-u.x,-u.y),n=s.container.innerHTML,l.translate(u.x,u.y),s.shapeNode.setAttribute("transform",e),i=$(n).filter("svg"),i.attr({width:u.width+1,height:u.height+1,style:'font-family: Arial, "Microsoft Yahei","Heiti SC";'}),n=$("<div></div>").append(i).html(),n=n.replace(' xmlns="http://www.w3.org/2000/svg" xmlns:NS1="" NS1:ns1:xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:NS2="" NS2:xmlns:ns1=""',""),n=n.replace(/ /g," "),o=new Blob([n],{type:"image/svg+xml"}),a=r.createObjectURL(o),{width:c,height:h,dataUrl:a,xml:n}}function i(){function i(t,e){t.save(),t.fillStyle=e,t.fillRect(0,0,l.width,l.height),t.restore()}function o(t,e,n,i){t.drawImage(e,n,i)}function a(t){try{var e=t.toDataURL("png");return e}catch(n){throw new Error("当前浏览器版本不支持导出 PNG 功能,请尝试升级到最新版本!")}}function s(){return"undefined"!=typeof window.canvg?new Promise(function(t){window.canvg(l,f.xml,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:v,offsetY:v,renderCallback:function(){t(a(l))}})}):e(m).then(function(t){return o(u,t,v,v),r.revokeObjectURL(m),a(l)})}var l=document.createElement("canvas"),u=l.getContext("2d"),c=t.getStyle("background").toString(),h=/url\((.+)\)/.exec(c),d=kity.Color.parse(c),f=n(),p=f.width,g=f.height,m=f.dataUrl,v=20;return l.width=p+2*v,l.height=g+2*v,h?e(h[1]).then(function(t){return i(u,u.createPattern(t,"repeat")),s()}):(i(u,d.toString()),s())}var r=window.URL||window.webkitURL||window;return{fileDescription:"PNG 图片",fileExtension:".png",mineType:"image/png",dataType:"base64",encode:i,recognizePriority:-1}}),kity.Browser.ie||KityMinder.registerProtocol("svg",function(t){return{fileDescription:"SVG 矢量图",fileExtension:".svg",mineType:"image/svg+xml",dataType:"text",encode:function(){var e,n,i=t.getPaper(),r=i.shapeNode.getAttribute("transform"),o=t.getRenderContainer(),a=o.getRenderBox(),s=(o.getTransform(),a.width),l=a.height,u=20;return i.shapeNode.setAttribute("transform","translate(0.5, 0.5)"),e=i.container.innerHTML,i.shapeNode.setAttribute("transform",r),n=$(e).filter("svg"),n.attr({width:s+2*u|0,height:l+2*u|0,style:'font-family: Arial, "Microsoft Yahei", "Heiti SC"; background: '+t.getStyle("background")}),n[0].setAttribute("viewBox",[a.x-u|0,a.y-u|0,s+2*u|0,l+2*u|0].join(" ")),e=$("<div></div>").append(n).html(),e=$("<div></div>").append(n).html(),e=e.replace(/ /g," ")},recognizePriority:-1}}),function(){var t=[];KityMinder.registerUI=function(e,n,i){"function"==typeof n&&(i=n,n=null),t.push({id:e,ui:i,deps:n})},kity.extendClass(Minder,{initUI:function(e){var n=this._ui={},i=this;t.forEach(function(t){var e=t.deps;e&&(e=e.map(function(t){return i.getUI(t)})),n[t.id]=t.ui.apply(null,[i].concat(e||[]))}),$("#content-wrapper").delegate("#panel, #tab-container, .fui-dialog, #main-menu","keydown keyup",function(t){t.stopPropagation()}),$("#content-wrapper").delegate("input","mousedown mousemove mouseup contextmenu",function(t){t.stopPropagation()}),i.getPaper().addClass("loading-target"),this.fire("interactchange"),this.fire("uiready"),setTimeout(function(){e&&e()},10)},getUI:function(t){return this._ui[t]}}),$.ajaxSetup({cache:!1}),$.extend($,{pajax:function(){var t=$.ajax.apply($,arguments);return new Promise(function(e,n){t.done(e),t.fail(function(t,e,i){var r=new Error(e);r.getDetail=function(){try{return"jQuery XHR Error: \n"+JSON.stringify(i)}catch(t){return i}},n(r)})})}}),$(function(){var t=["kmcat_warn.png","kmcat_sad.png","icons.png","template_large.png","history.png","feedback.png","iconpriority.png","iconprogress.png","template.png","layout.png","next-level.png","prev-level.png"];t.forEach(function(t){(new Image).src="ui/theme/default/images/"+t})})}(),KityMinder.registerUI("eve",function(){return{setup:function(t){var e={};return t.on=function(t,n){var i=e[t]||(e[t]=[]);return i.push(n),this},t.off=function(t,n){var i=e[t];if(i){var r=i.indexOf(n);~r?i.splice(r,1):n[t]=null}return this},t.once=function(e,n){return this.on(e,function i(){n.apply(t,arguments),t.off(e,i)})},t.fire=function(n){var i=e[n],r=[].slice.call(arguments,1);
|
||
return i&&i.forEach(function(e){e.apply(t,r)}),this},t}}}),KityMinder.registerUI("memory",function(){var t=window.localStorage,e=t.uiMemory?JSON.parse(t.uiMemory):{};return{get:function(t){return e[t]||null},set:function(n,i){e[n]=i,t.uiMemory=JSON.stringify(e)}}}),kity.extendClass(FUI.Widget,{setEnable:function(t){t===!1?this.disable():this.enable()},setActive:function(t){t===!1?this.removeClass("active"):this.addClass("active")},bindExecution:function(t,e){var n=this;n.on(t,function(){n.interactFlag||e.apply(n,arguments)})},bindCommandState:function(t,e,n){var i=this;t.on("interactchange",function(){if(i.interactFlag=!0,n){var t=this.queryCommandValue(e);t!=i.lastHandleCommandValue&&(n.call(i,t),i.lastHandleCommandValue=t)}i.setEnable(-1!==this.queryCommandState(e)),i.setActive(1===this.queryCommandState(e)),i.interactFlag=!1})}}),KityMinder.registerUI("axss",function(){function t(t){var e=document.createElement("div");e.innerHTML=t,$(e).find("script, iframe, link").remove();for(var n in e)0===n.indexOf("on")&&e.removeAttribute(n);return e.innerHTML}return t}),KityMinder.registerUI("widget/commandbutton",function(t){return{generate:function(e,n){var i=new FUI.Button({label:t.getLang("ui.command."+e)||t.getLang("ui."+e),text:t.getLang("ui.command."+e)||t.getLang("ui."+e),className:["command-widget","command-button",e]});return i.bindExecution("click",n||function(){t.execCommand(e)}),i.bindCommandState(t,e),i}}}),KityMinder.registerUI("widget/commandbuttonset",function(t){function e(e,n){return n.map(function(n){var i=t.getLang([e,n].join("."))||n;return{label:i,text:i,value:n,className:[e,n].join(" ")}})}function n(n,i){var r=new FUI.Buttonset({id:"template-set",buttons:"object"==typeof i[0]?i:e(n,i),className:["command-widget","command-buttonset",n].join(" ")});return r.bindExecution("change",function(){t.execCommand(n,r.getValue())}),r.bindCommandState(t,n,function(t){this.selectByValue(t)}),r}return{generate:n}}),KityMinder.registerUI("widget/commandinputmenu",function(t){function e(e,n){var i=new FUI.InputMenu({menu:{items:n},input:{placeholder:t.getLang("ui."+e)},className:["command-widget","command-inputmenu",e]});i.bindCommandState(t,e,function(t){i.selectByValue(t)||i.clearSelect()});var r=-1;return i.bindExecution("select",function(n,o){~o.index?t.execCommand(e,o.value):i.select(r),r=o.index}),i}return{generate:e}}),KityMinder.registerUI("widget/commandselectmenu",function(t){function e(e,n){return n.map(function(n){var i=t.getLang([e,n].join("."))||n;return{clazz:"Button",label:i,text:i,value:n,className:[e,n].join(" ")}})}function n(n,i,r){var o=new FUI.SelectMenu({widgets:"object"==typeof i[0]?i:e(n,i),className:["command-widget","command-selectmenu",n].join(" "),column:r||3});return o.bindExecution("change",function(){t.execCommand(n,o.getValue())}),o.bindCommandState(t,n,function(t){void 0!==t&&this.selectByValue(t)}),o}return{generate:n}}),KityMinder.registerUI("widget/notice",function(t){function e(t,e){function n(){var e=t.text(),n=new RegExp("at.+"+p+".+\\:(\\d+)\\:(\\d+)\\)?","g");t.text(e.replace(n,function(t,e,n){var i={line:+e,column:+n},r=d.originalPositionFor(i),o=r.name;i={line:r.line,column:r.column},r=h.originalPositionFor(i),o=o||"<Anonymous>";var a="at "+o+" ("+r.source.replace("../","")+":"+r.line+":"+r.column+")";return-1!=a.indexOf("promise")&&(a="at <async> Promise."+o),a}))}if(p){if(h)return n();e.addClass("loading"),setTimeout(function(){e.removeClass("loading")},5e3);var i=document.createElement("script");i.onload=function(){Promise.all([$.pajax({url:p.replace("min.js","js.map"),dataType:"json"}),$.pajax({url:p.replace(".js",".map"),dataType:"json"})]).then(function(t){h=new window.sourceMap.SourceMapConsumer(t[0]),d=new window.sourceMap.SourceMapConsumer(t[1]),n(),e.removeClass("loading")})},i.src="lib/source-map.min.js",document.head.appendChild(i)}}function n(e,i,r){u.hasClass("show")||u.empty(),clearTimeout(n.ttl2),i?u.addClass("warn"):u.removeClass("warn");var o=t.getUI("menu/menu");u.css({top:o&&o.isVisible()?$("#main-menu .main-menu-level1").offset().top:$("#kityminder").offset().top+20}),u.append($("<p>").text(e)),u.addClass("show"),clearTimeout(n.ttl),r=r||(i?5e3:3e3),n.ttl=setTimeout(function(){u.removeClass("show"),n.ttl2=setTimeout(function(){u.empty()},1e3)},r)}function i(t){n(t,i)}function r(t){return t=t||new Error,"string"==typeof t&&(t=new Error(t)),t.getDetail?t:("undefined"!=typeof fio&&t instanceof fio.FileRequestError?(t.description=t.status?s.pcs_code[t.detail.error_code]:s.err_network,t.getDetail=function(){return JSON.stringify(t,null,4)}):"readyState"in t||(t.getDetail=function(){return t.stack||(new Error).stack}),t)}function o(n,i){1==arguments.length&&(i=n,n="unknown"),f.empty(),i=r(i);{var u=$("<div>").addClass("error-content").appendTo(f);$("<h3>").text(s[n]||s.err_unknown).appendTo(u),$("<p>").text(i.message||i.description||s.unknownreason).appendTo(u)}if(i.getDetail){var h=$("<div>").addClass("error-detail").append($('<a class="expander"></a>').text(t.getLang("ui.error_detail"))).appendTo(f),d=$("<div>").addClass("error-detail-wrapper").appendTo(h),p=$("<textarea>").attr("id","error-detail-content").text(i.getDetail()+"\n\n浏览器信息:"+navigator.userAgent).appendTo(d);e(p,d);var g=$("<button>").addClass("copy-and-feedback").text(t.getLang("ui.copy_and_feedback")).appendTo(d);g.attr("data-clipboard-target","error-detail-content"),a(g),l.get("show-error-detail")&&h.addClass("expanded")}return c.show(),c.getElement().style.top="180px",new Promise(function(t){o.resolve=t})}function a(e){if(window.ZeroClipboard){ZeroClipboard.config({swfPath:"lib/ZeroClipboard.swf",hoverClass:"hover",activeClass:"active"});var n=new window.ZeroClipboard(e);n.on("ready",function(){n.on("aftercopy",function(){c.hide(),t.getUI("topbar/feedback").click()})})}else e.remove()}var s=t.getLang("error_message"),l=t.getUI("memory"),u=$("<div>").addClass("notice-widget").appendTo("#content-wrapper"),c=($("<div>").addClass("error-mask"),new FUI.Dialog({width:500,height:"auto",prompt:!0,caption:s.title,className:"error-dialog"}).appendTo(document.getElementById("content-wrapper")));c.on("ok cancel",function(t){o.resolve&&o.resolve(t)});var h,d,f=$(c.getBodyElement()),p=function(){for(var t,e,n=[].slice.apply(document.getElementsByTagName("script"));t=n.pop();)if(e=/kityminder.*\.min\.js/.exec(t.src))return e[0];return!1}();return f.delegate(".error-detail a.expander","click",function(t){var e=$(t.target).closest(".error-detail").toggleClass("expanded"),n=e.hasClass("expanded");l.set("show-error-detail",n)}),{info:n,error:o,warn:i}}),KityMinder.registerUI("widget/friendlytimespan",function(t){function e(e){var n=Math.abs(e-new Date),i=n/1e3,r=i/60,o=r/60,a=o/24;return 60>i?t.getLang("ui.justnow",0|i):60>r?t.getLang("ui.minutesago",0|r):24>o?t.getLang("ui.hoursago",0|o):2>a?t.getLang("ui.yesterday"):30>=a?t.getLang("ui.daysago",0|a):t.getLang("ui.longago")}function n(t){t.text(e(t.data("time")))}function i(){$(".friendly-time").each(function(){n($(this))})}$.extend($.fn,{displayFriendlyTime:function(t){return this.each(function(){n($(this).addClass("friendly-time").data("time",t))})}}),setInterval(i,6e4)}),KityMinder.registerUI("widget/locallist",function(){function t(t,e){function n(){d=localStorage.getItem(t),d=d?JSON.parse(d):[],this.length=d.length}function i(){for(;d.length>e;)d.pop();localStorage.setItem(t,JSON.stringify(d)),this.length=d.length}function r(t){return d[t]}function o(t){d.splice(t,1),i()}function a(){d=[],i()}function s(t){d.unshift(t),i()}function l(t){return function(e,n){return e[t]==n}}function u(t,e){"string"==typeof t&&(t=l(t));for(var n=0;n<d.length;n++)if(t(d[n],e))return n;return-1}function c(t,e){return r(u(t,e))}function h(t){d.forEach(t),i()}var d;e=e||10,n.call(this),this.get=r,this.remove=o,this.findIndex=u,this.find=c,this.forEach=h,this.unshift=s,this.clear=a}return{use:function(e){return new t(e)}}}),KM.registerUI("widget/menutab",function(t){function e(e,n,i){var r=e.getButtons().length,o=e.appendTab({buttons:[{label:t.getLang("ui.menu."+n+"tab"),className:"tab-"+n}]});return i&&e.select(r),o[0].panel.getContentElement()}return{generate:e}}),KityMinder.registerUI("doc",function(t){function e(t,e){function n(t,e){for(var n=0;n in t&&n in e&&t[n]==e[n];)n++;return n in e?0:n}if("netdisk"==s.source){var i=t.split("/"),r=e.split("/"),o=s.path.split("/"),l=n(o,i);if(l){var u=r.concat(o.slice(l));s.path=u.join("/"),s.title=u.pop(),a.fire("docchange",s)}}}function n(e){if(h)return Promise.reject(new Error("doc was locked"));var n=e;return s=e,l=!0,t.importData(e.content,e.protocol).then(function(n){return e.title=e.title||t.getMinderTitle(),t.execCommand("camera",t.getRoot(),300),e.data=n,e.json=JSON.stringify(n),a.fire("docload",e),a.fire("docchange",e),e})["catch"](function(t){s=n,u.error("err_doc_resolve",t)}).then(function(e){return l=!1,e&&u.info(t.getLang("ui.load_success",e.title)),e})}function i(e){s=e,e.data=t.exportJson(),e.json=JSON.stringify(e.data),e.saved=!0,a.fire("docsave",e),a.fire("docchange",e)}function r(){return s}function o(e){return fio.user.current()?h?!1:e?s.saved:s.saved||window.confirm(t.getLang("ui.unsavedcontent","* "+s.title)):!0}var a=t.getUI("eve").setup({}),s={saved:!0},l=!1,u=t.getUI("widget/notice"),c=t.getUI("widget/netdiskfinder");c&&c.on("mv",e);var h=!1;return a.lock=function(){h=!0},a.unlock=function(){h=!1},setTimeout(function(){t.on("contentchange",function(){l||("netdisk"!=s.source?(s.title=t.getMinderTitle(),s.saved=!1):s.saved=s.json==JSON.stringify(t.exportJson()),a.fire("docchange",s))})},1e3),a.load=n,a.save=i,a.current=r,a.checkSaved=o,a}),KityMinder.registerUI("contextmenu",function(t){function e(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}function n(t,e){var n=t[0]-e[0],i=t[1]-e[1],r=Math.sqrt(n*n+i*i);return r}var i,r=kity.Browser.mac,o=$("<ul>").addClass("km-context-menu fui-popup-menu").appendTo("#content-wrapper");o.delegate("li","mousedown",function(e){var n=$(e.target).closest("li").data("menu");return n.fn?n.fn.call(t,t):n.command?t.execCommand(n.command):void 0}),$("#content-wrapper").on("contextmenu",function(t){t.preventDefault()}),$("#content-wrapper").on("mousedown",function(t){o.hide(),i=2==t.button?[t.pageX,t.pageY]:null}),t.on("mouseup",function(a){if(a.isRightMB()){a=a.originEvent;var s=n(i,[a.pageX,a.pageY]);if(!(isNaN(s)||s>5)){o.empty();var l=t.getContextMenu(),u=!0;if(l.forEach(function(n){var i=n.query||function(){return n.command&&0===t.queryCommandState(n.command)};if(i()){var a=t.getLang("ui.command."+n.command),s=$("<li>").addClass("fui-item").data("menu",n).appendTo(o),l=t.getCommandShortcutKey(n.command);l&&l.split("|").forEach(function(t){var n=$("<span>").addClass("shortcut").appendTo(s);t.split("+").forEach(function(t){var i=t.split("::");t=i.length>1?i[1]:i[0],$("<span>").addClass("shortcut-key "+t.toLowerCase()).text(e(t)).appendTo(n)}),r&&n.addClass("mac")}),s.append($("<div>").text(a).addClass("menu-label")),u=!1}n.divider&&!u&&($("<li>").addClass("divider").appendTo(o),u=!0)}),l.length){o.show();var c=a.pageX,h=a.pageY,d=o.outerWidth(),f=o.outerHeight(),p=document.body.clientWidth,g=document.body.clientHeight;c+d>p&&(c-=d),h+f>g&&(h-=f),o.offset({left:c,top:h})}}}})}),KityMinder.registerUI("nav",function(t){function e(e){function n(t){return(1-(t-a)/l)*u}function i(t){h.animate({y:n(t)},200)}var r=$("<div>").addClass("zoom-pan").appendTo(e),o=t.getOptions("zoom"),a=o[0],s=o[o.length-1],l=s-a,u=r.height(),c=$("<div>").addClass("origin").appendTo(r).css("y",n(100)),h=$("<div>").addClass("indicator").appendTo(r).css("y",n(100));return t.on("zoom",function(t){i(t.zoom)}),c.click(function(){t.execCommand("zoom",100)}),r}function n(){function e(){t.on("layout layoutallfinish",r),t.on("viewchange",o)}function n(){t.off("layout layoutallfinish",r),t.off("viewchange",o)}function i(){function e(e,n){var i=d;e.x=-e.x,e.y=-e.y;var r=t.getPaper().getViewPortMatrix();i=r.transformBox(i);var o=e.offset(i.width/2,i.height/2);t.getViewDragger().moveTo(o,n)}var n=!1;s.on("mousedown",function(t){n=!0,e(t.getPosition("top"),200),a.addClass("grab")}),s.on("mousemove",function(t){n&&e(t.getPosition("top"))}),$(window).on("mouseup",function(){n=!1,a.removeClass("grab")})}function r(){var e=t.getRenderContainer().getBoundaryBox();h=e;var n=30;s.setViewBox(e.x-n-.5,e.y-n-.5,e.width+2*n+1,e.height+2*n+1);var i=[],r=[];t.getRoot().traverse(function(t){var e=t.getLayoutBox();i.push("M",e.x,e.y,"h",e.width,"v",e.height,"h",-e.width,"z"),t.getConnection()&&t.parent&&t.parent.isExpanded()&&r.push(t.getConnection().getPathData())}),s.setStyle("background",t.getStyle("background")),i.length?l.fill(t.getStyle("root-background")).setPathData(i):l.setPathData(null),r.length?u.stroke(t.getStyle("connect-color"),"0.5%").setPathData(r):u.setPathData(null),o()}function o(){d=t.getViewDragger().getView(),c.setBox(d.intersect(h))}var a=$("<div>").addClass("preview-navigator").appendTo("#content-wrapper"),s=new kity.Paper(a[0]),l=s.put(new kity.Path),u=s.put(new kity.Path),c=s.put(new kity.Rect(100,100).stroke("red","1%")),h=new kity.Box,d=new kity.Box;return i(),a.show=function(){$.fn.show.call(this),e(),r(),o()},a.hide=function(){$.fn.hide.call(this),n()},window.u=r,a}function i(e){function n(){i.toggleClass("active").hasClass("active")?(e.show(),r.set("navigator-hidden",!1)):(e.hide(),r.set("navigator-hidden",!0))}var i=$("<div>").addClass("command-button nav-trigger");return i.append('<div class="fui-icon">'),i.click(n),i.attr("title",t.getLang("ui.navigator")),r.get("navigator-hidden")&&n(),n(),i}{var r=t.getUI("memory"),o=$("<div>").addClass("nav-bar").appendTo("#content-wrapper"),a=t.getUI("widget/commandbutton"),s=(a.generate("zoom-in").appendTo(o[0]),e(o),a.generate("zoom-out").appendTo(o[0]),n());a.generate("hand").appendTo(o[0]),a.generate("camera",function(){t.execCommand("camera",t.getRoot(),600)}).appendTo(o[0]),i(s).appendTo(o)}}),KityMinder.registerUI("topbar/history",function(t){var e={},n=t.getUI("widget/commandbutton");return["undo","redo"].forEach(function(t){e[t]=n.generate(t).appendTo(document.getElementById("panel"))}),e}),KityMinder.registerUI("ribbon/tabs",function(t){var e=t.getUI("memory"),n=new FUI.Tabs({buttons:["idea","appearence","view"].map(function(e){return t.getLang("ui.tabs."+e)})}),i=$('<div id="tab-select"></div>'),r=$('<div id="tab-container"></div>');i.appendTo("#panel"),$("#panel").after(r),n.appendButtonTo(i[0]),n.appendPanelTo(r[0]);var o=0,a=!1;n.on("tabsselect",function(t,n){n.index==o?(r.toggleClass("collapsed"),i.toggleClass("collapsed")):(r.removeClass("collapsed"),i.removeClass("collapsed")),a||(e.set("ribbon-tab-collapsed",r.hasClass("collapsed")),e.set("ribbon-tab-index",n.index)),o=n.index}),n.idea=n.getPanel(0),n.appearence=n.getPanel(1),n.view=n.getPanel(2);var s=e.get("ribbon-tab-index"),l=e.get("ribbon-tab-collapsed");return a=!0,n.select(s||0),a=!1,l?(r.addClass("collapsed"),i.addClass("collapsed")):(r.removeClass("collapsed"),i.removeClass("collapsed")),n}),KityMinder.registerUI("ribbon/idea/insert",function(t){var e=t.getUI("widget/commandbutton"),n=t.getUI("ribbon/tabs"),i=new FUI.LabelPanel({label:t.getLang("panels.insert"),column:!0});return e.generate("appendchildnode").appendTo(i),e.generate("appendsiblingnode").appendTo(i),n.idea.appendWidget(i),i}),KityMinder.registerUI("ribbon/idea/arrange",function(t){var e=t.getUI("ribbon/tabs"),n=t.getUI("widget/commandbutton"),i=new FUI.LabelPanel({label:t.getLang("panels.arrange"),column:!0});return n.generate("arrangeup").appendTo(i),n.generate("arrangedown").appendTo(i),e.idea.appendWidget(i),i}),KityMinder.registerUI("ribbon/idea/operation",function(t){var e=t.getUI("widget/commandbutton"),n=t.getUI("ribbon/tabs"),i=new FUI.LabelPanel({label:t.getLang("panels.nodeop"),column:!0}).appendTo(n.idea);["editnode","removenode"].forEach(function(t){e.generate(t).appendTo(i)})}),KityMinder.registerUI("ribbon/idea/attachment",function(t){var e=t.getUI("ribbon/tabs"),n=new FUI.LabelPanel({label:t.getLang("panels.attachment"),coloum:!0}).appendTo(e.idea);return n}),KityMinder.registerUI("ribbon/idea/link",function(t){function e(e){e?(s.addClass("validate-error"),c.text(t.getLang("dialogs.markers.static.errorLink")),u.disable()):(s.removeClass("validate-error"),c.text(""),u.enable())}var n=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?/,i=t.getUI("ribbon/idea/attachment"),r=new FUI.ButtonMenu({id:"link-button-menu",text:t.getLang("ui.link"),layout:"bottom",buttons:[{},{label:t.getLang("ui.link")}],menu:{items:[t.getLang("ui.removelink")]}}).appendTo(i);r.bindCommandState(t,"hyperlink");var o=new FUI.Dialog({width:400,height:200,prompt:!0,caption:t.getLang("ui.link")}).appendTo(document.getElementById("content-wrapper")),a=$(o.getBodyElement());a.html(["<p><label>"+t.getLang("dialogs.markers.static.lang_input_url")+'</label><input type="url" class="link-href fui-widget fui-selectable" /></p>',"<p><label>"+t.getLang("dialogs.markers.static.lang_input_title")+'</label><input type="text" class="link-title fui-widget fui-selectable" /></p>'].join(""));var s=a.find(".link-href"),l=a.find(".link-title"),u=o.getButton(0),c=$('<span class="validate-error"></span>');return s.after(c),s.on("input",function(){var t=s.val();e(!n.test(t))}),r.on("buttonclick",function(){o.open(),s[0].focus()}),r.on("select",function(){t.execCommand("unhyperlink")}),o.on("ok",function(){t.execCommand("hyperlink",s.val(),l.val()||"")}),o.on("open",function(){var n=t.queryCommandValue("hyperlink");s.val(n.url),l.val(n.title),e(!1)}),$(t.getPaper().getNode()).delegate("a","click",function(t){var e=$(t.target).closest("a"),n=e.prop("href").baseVal;top.open(n,"_blank"),t.preventDefault()}),r}),KityMinder.registerUI("ribbon/idea/note",function(t){function e(){if(v&&_!=t.getSelectedNode()){_=t.getSelectedNode();var e=t.queryCommandValue("note")||"";y.setValue(e),_?(c.removeAttr("disabled"),h.text(t.getLang("ui.note")+" - "+_.getText())):(c.attr("disabled","disabled"),h.text(t.getLang("ui.selectNodeToAddNote"))),p.hasClass(b)&&(m.html(s(marked(e))),m.find("a").attr("target","_blank"))}}function n(){_&&-1!=t.queryCommandState("note")&&t.execCommand("note",y.getValue())}function i(){if(!f.hasClass(b)){m.hide(),p.removeClass(b),g.show().addClass(b),f.addClass(b);var e=t.queryCommandValue("note")||"";y.setValue(e)}}function r(){p.hasClass(b)||(g.hide(),f.removeClass(b),m.html(s(marked(y.getValue()))).show(),m.find("a").attr("target","_blank"),p.addClass(b))}function o(){v=!0,c.show(),i(),e(),$("#content-wrapper").addClass("note-panel-visible")}function a(){v=!1,c.hide(),$("#content-wrapper").removeClass("note-panel-visible")}var s=t.getUI("axss");marked.setOptions({gfm:!0,breaks:!0});var l=t.getUI("ribbon/idea/attachment"),u=new FUI.ButtonMenu({id:"note-button-menu",text:t.getLang("ui.note"),layout:"bottom",buttons:[{},{label:t.getLang("ui.note")}],menu:{items:[t.getLang("ui.removenote")]}}).appendTo(l);u.on("select",function(){t.execCommand("note",null)});var c=$('<div id="note-panel"></div>'),h=$("<h2>"+t.getLang("ui.note")+"</h2>").appendTo(c),d=($('<a class="close"></a>').appendTo(c).click(a),$('<div class="tab"><a class="edit-tab">'+t.getLang("ui.edit")+'</a><a class="preview-tab">'+t.getLang("ui.preview")+'</a><a class="help">'+t.getLang("ui.supportMD")+"</a></div>").appendTo(c)),f=d.find(".edit-tab"),p=d.find(".preview-tab"),g=$('<div class="note-editor"></div>').appendTo(c),m=$('<div class="note-preview"></div>').appendTo(c),v=!1;c.on("keydown keyup keypress mouedown mouseup click contextmenu",function(t){t.stopPropagation()});var y=new window.CodeMirror(g[0],{mode:"gfm",lineWrapping:!0,dragDrop:!1});t.on("uiready",function(){y.setSize("100%","100%")});var _=null;t.on("interactchange",e),y.on("change",n),u.bindCommandState(t,"note"),u.on("buttonclick",o),t.on("editnoterequest",o),$("#kityminder").after(c),a();var b="active-tab";f.click(i),p.click(r)}),KityMinder.registerUI("ribbon/idea/notepreview",function(t){function e(t,e){var i=t.getRenderer("NoteIconRenderer").getRenderShape(),a=i.getRenderBox("screen"),s=t.getData("note");r[0].scrollTop=0;var l=marked(s);e&&(l=l.replace(new RegExp("("+e+")","ig"),'<span class="highlight">$1</span>')),r.html(n(l));var u=$("#content-wrapper").width(),c=$("#content-wrapper").height(),h=r.outerWidth(),d=r.outerHeight(),f=a.cx-h/2,p=a.bottom+10;0>f&&(f=10),f+h>u&&(f=u-h-10),p+d>c&&(p=a.top-d-10),r.css({left:Math.round(f),top:Math.round(p)}),r.show();var g=r[0].querySelector(".highlight");g&&g.scrollIntoView(),o=!0}var n=t.getUI("axss");marked.setOptions({gfm:!0,breaks:!0});var i,r=$('<div id="note-previewer"></div>').appendTo("#content-wrapper");t.on("shownoterequest",function(t){i=setTimeout(function(){e(t.node)},300)}),t.on("hidenoterequest",function(){clearTimeout(i)});var o=!1;return $("#kityminder").on("mousedown mousewheel DOMMouseScroll",function(){o&&(r.fadeOut(),o=!1)}),r.hide(),r.delegate("a","click",function(e){var n=$(e.target).closest("a"),i=n.prop("href");window.confirm(t.getLang("ui.redirect",i))&&window.open(i,"_blank"),e.preventDefault()}),{preview:e,hide:function(){r.hide()}}}),KityMinder.registerUI("ribbon/idea/priority",function(t){var e=t.getUI("widget/commandbuttonset"),n=t.getUI("ribbon/tabs"),i=new FUI.LabelPanel({label:t.getLang("panels.priority")}).appendTo(n.idea);return e.generate("priority",[1,2,3,4,5,6,7,8,9,0].map(function(e){return{label:e,text:t.getLang("ui.priority")+e,value:e,className:["priority",e].join("-")}})).appendTo(i),i}),KityMinder.registerUI("ribbon/idea/progress",function(t){var e=t.getUI("widget/commandbuttonset"),n=t.getUI("ribbon/tabs"),i=new FUI.LabelPanel({label:t.getLang("panels.progress")}).appendTo(n.idea);return e.generate("progress",[1,2,3,4,5,6,7,8,9,0].map(function(e){return{label:e,text:t.getLang("ui.progress.p"+e),value:e,className:["progress",e].join("-")}})).appendTo(i),i}),KityMinder.registerUI("ribbon/idea/resource",function(t){function e(){var e=s.getValue(),n=t.queryCommandValue("resource");/\S/.test(e)&&(~n.indexOf(e)||n.push(e),n.sort(),t.execCommand("resource",n)),s.setValue(null),r(),s.focus()}function n(t,e){return[t.join(","),e.join(",")].join(";")}function i(t,e){var r=n(t,e);return r==i.lastHash?!1:(i.lastHash=r,!0)}function r(){var e=t.queryCommandValue("resource"),n=t.getUsedResource();switch(n.sort(),t.queryCommandState("resource")){case 0:s.enable(),l.enable(),u.enable(),h.find("input[type=checkbox]").removeAttr("disabled");break;case-1:s.disable(),l.disable(),u.disable(),h.find("input[type=checkbox]").attr("disabled",!0)}if(i(e,n)){for(var r=n.length-h.children().length;r--;)h.append('<li><label><input type="checkbox" /><span></span></label></li>');for(;++r;)h.children().first().remove();n.forEach(function(n,i){var r=h.children().eq(i),o=r.find("label"),a=o.find("input"),s=o.find("span");a.data("resource",n),a.prop("checked",~e.indexOf(n)),s.text(n);var l=t.getResourceColor(n);r.css({color:l.dec("l",60).toString(),backgroundColor:~e.indexOf(n)?l:l.dec("a",.85).toRGBA()})}),h.children().length?c.parent().parent().show():c.parent().parent().hide()}}var o=(t.getUI("widget/commandbuttonset"),t.getUI("ribbon/tabs")),a=new FUI.LabelPanel({label:t.getLang("panels.resource"),id:"resource-panel"}).appendTo(o.idea),s=new FUI.Input({placeholder:"Tag"}).appendTo(a);s.getElement().type="text";var l=new FUI.Button({label:t.getLang("ui.add")}).appendTo(a),u=(new FUI.DropPanel).appendTo(a),c=$(u.getPanelElement()),h=$("<ul></ul>").addClass("resource-list").appendTo(c);return s.on("inputcomplete",function(){e()}),l.on("click",e),c.delegate("input[type=checkbox]","change",function(){t.execCommand("resource",c.find("input[type=checkbox]:checked").map(function(t,e){return $(e).data("resource")}).toArray()),r()}),t.on("interactchange",r),a}),KityMinder.registerUI("ribbon/appearence/template",function(t){var e=t.getUI("widget/commandselectmenu"),n=t.getUI("ribbon/tabs"),i=new FUI.LabelPanel({id:"template-panel",label:t.getLang("panels.template")}),r=KityMinder.Utils.keys(KityMinder.getTemplateList()),o=e.generate("template",r,2);return n.appearence.appendWidget(i),i.appendWidget(o),i}),KityMinder.registerUI("ribbon/appearence/theme",function(t){var e=t.getUI("widget/commandselectmenu"),n=t.getUI("ribbon/tabs"),i=new FUI.LabelPanel({id:"theme-panel",label:t.getLang("panels.theme")}),r=KityMinder.Utils.keys(KityMinder.getThemeList()),o=e.generate("theme",r.map(function(e){var n=KityMinder._themes[e];return{clazz:"Button",label:{text:t.getLang("theme."+e),style:{background:n["root-background"],color:n["root-color"],borderRadius:n["root-radius"]/2}},text:t.getLang("theme."+e),value:e,className:["theme",e].join(" ")}}));return n.appearence.appendWidget(i),i.appendWidget(o),t.on("themechange",function(){$("#content-wrapper").css("background",t.getStyle("background"))}),i}),KityMinder.registerUI("ribbon/appearence/layout",function(t){var e=t.getUI("ribbon/tabs"),n=t.getUI("widget/commandbutton"),i=new FUI.LabelPanel({id:"layout-panel",label:t.getLang("panels.layout")}).appendTo(e.appearence);return n.generate("resetlayout").appendTo(i).addClass("large"),i}),KityMinder.registerUI("ribbon/appearence/style",function(t){var e=t.getUI("ribbon/tabs"),n=t.getUI("widget/commandbutton"),i=new FUI.LabelPanel({label:t.getLang("panels.style")}).appendTo(e.appearence);n.generate("clearstyle").addClass("large").appendTo(i);var r=new FUI.Panel({column:!0}).appendTo(i);return n.generate("copystyle").appendTo(r),n.generate("pastestyle").appendTo(r),i}),KityMinder.registerUI("ribbon/appearence/font",function(t){var e=t.getUI("ribbon/tabs"),n=t.getUI("widget/commandinputmenu"),i=t.getUI("widget/commandbutton"),r=new FUI.LabelPanel({label:t.getLang("panels.font"),id:"font-panel"}),o=new FUI.Panel({column:!0}),a=new FUI.Panel({column:!0}),s=n.generate("fontfamily",t.getOptions("fontfamily").map(function(t){return{label:{text:t.name,style:{fontFamily:t.val}},text:t.name,value:t.val}})),l=n.generate("fontsize",t.getOptions("fontsize").map(function(t){return{label:{text:t,style:{fontSize:t}},text:t,value:t}}));o.appendWidgets([s,l]);var u=i.generate("bold"),c=i.generate("italic");a.appendWidgets([u,c]),r.appendWidgets([o,a]),e.appearence.appendWidget(r)}),KityMinder.registerUI("ribbon/appearence/color",function(t){function e(){return["#e75d66","#fac75b","#99ca6a","#00c5ad","#3bbce0","#c9ced1","#425b71","white"]}var n=t.getUI("widget/commandbuttonset"),i=t.getUI("ribbon/tabs"),r=new FUI.LabelPanel({label:t.getLang("panels.color")}).appendTo(i.appearence),o=new FUI.LabelPanel({label:t.getLang("panels.background")}).appendTo(i.appearence),a=e();return r.appendWidget(n.generate("forecolor",a.map(function(t){return{icon:{style:{background:t}},label:t,text:t,value:t}})).addClass("color-picker")),o.appendWidget(n.generate("background",a.map(function(t){return{icon:{style:{background:t}},label:t,text:t,value:t}})).addClass("color-picker")),{color:r,background:o}}),KityMinder.registerUI("ribbon/view/fullscreen",function(t){function e(){$("#content-wrapper").toggleClass("fullscreen").hasClass("fullscreen")&&r.info(t.getLang("ui.fullscreen_exit_hint"),!1,4e3)}var n=t.getUI("widget/commandbutton"),i=t.getUI("ribbon/tabs"),r=t.getUI("widget/notice"),o=new FUI.LabelPanel({label:t.getLang("panels.level"),column:!0}).appendTo(i.view),a=n.generate("fullscreen",e).addClass("large").appendTo(o);return t.addShortcut("F11",e),t.addShortcut("Esc",function(){$("#content-wrapper").hasClass("fullscreen")&&$("#content-wrapper").removeClass("fullscreen")}),a}),KityMinder.registerUI("ribbon/view/level",function(t){var e=(t.getUI("widget/commandbutton"),t.getUI("ribbon/tabs")),n=new FUI.LabelPanel({label:t.getLang("panels.level"),column:!0}).appendTo(e.view),i=new FUI.ButtonMenu({id:"level-button-menu",text:t.getLang("ui.level"),layout:"bottom",buttons:[{},{label:t.getLang("ui.expandtoleaf")}],menu:{items:[1,2,3,4,5,6].map(function(e){return{label:t.getLang("ui.command.expandtolevel"+e),value:e}})}}).appendTo(n);i.on("buttonclick",function(){t.execCommand("expandtolevel",9999)}),i.on("select",function(e,n){t.execCommand("expandtolevel",n.value)})}),KityMinder.registerUI("ribbon/view/select",function(t){var e=t.getUI("ribbon/tabs"),n=new FUI.LabelPanel({label:t.getLang("panels.level"),column:!0}).appendTo(e.view),i=new FUI.ButtonMenu({id:"select-button-menu",text:t.getLang("ui.select"),layout:"bottom",buttons:[{},{label:t.getLang("ui.selectall")}],menu:{items:["revert","siblings","level","path","tree"].map(function(e){return{label:t.getLang("ui.select"+e),value:e}})}}).appendTo(n),r={all:function(){var e=[];t.getRoot().traverse(function(t){e.push(t)}),t.select(e,!0)},revert:function(){var e=t.getSelectedNodes(),n=[];t.getRoot().traverse(function(t){-1==e.indexOf(t)&&n.push(t)}),t.select(n,!0)},siblings:function(){var e=t.getSelectedNodes(),n=[];e.forEach(function(t){t.parent&&t.parent.children.forEach(function(t){-1==n.indexOf(t)&&n.push(t)})}),t.select(n,!0)},level:function(){var e=t.getSelectedNodes().map(function(t){return t.getLevel()}),n=[];t.getRoot().traverse(function(t){-1!=e.indexOf(t.getLevel())&&n.push(t)}),t.select(n,!0)},path:function(){var e=t.getSelectedNodes(),n=[];e.forEach(function(t){for(;t&&-1==n.indexOf(t);)n.push(t),t=t.parent}),t.select(n,!0)},tree:function(){var e=t.getSelectedNodes(),n=[];e.forEach(function(t){t.traverse(function(t){-1==n.indexOf(t)&&n.push(t)})}),t.select(n,!0)}};i.on("buttonclick",r.all),i.on("select",function(t,e){r[e.value]()})})}(window); |