/*
 Constructor for kissy editor,dependency moved to independent module
 thanks to CKSource's intelligent work on CKEditor
 @author: yiminghe@gmail.com, lifesinger@gmail.com
 @version: 2.1.5
 @buildtime: 2011-04-08 17:26:00
*/
var U=true,V=null,Y=false;
KISSY.add("editor",function(j){function w(u,p){var m=this;if(!(m instanceof w))return new w(u,p);if(j.isString(u))u=j.one(u);u=q.C(u);p=p||{};p.Bf=p.pluginConfig||{};m.va=p;p.pluginConfig=p.Bf;m.cfg=p;j.app(m,j.EventTarget);var d=["htmldataprocessor","enterkey","clipboard"],f=C;m.use=function(e,i){e=e.split(",");if(!f)for(var r=0;r<d.length;r++){var k=d[r];j.inArray(k,e)||e.unshift(k)}m.ready(function(){j.use.call(m,e.join(","),function(){for(var a=0;a<e.length;a++)m.Zd(e[a]);i&&i.call(m);if(!f){m.setData(u.val());
if(p.focus)m.focus();else(a=m.getSelection())&&a.removeAllRanges();f=I}},{global:w})});return m};m.use=m.use;m.Config.base=w.Config.base;m.Config.debug=w.Config.debug;m.Config.componentJsName=y;m.qf(u);return m}var q=j.DOM,I=U,C=Y,y;y=parseFloat(j.version)<1.2?function(){return"plugin-min.js?t=2011-04-08 17:26:00"}:function(u,p){return u+"/plugin-min.js"+(p?p:"?t=2011-04-08 17:26:00")};j.app(w,j.EventTarget);w.Config.base=j.Config.base+"editor/plugins/";w.Config.debug=j.Config.debug;w.Config.componentJsName=y;j.Editor=
w;j.Editor=w});
KISSY.Editor.add("utils",function(j){var w=V,q=KISSY,I=q.Node,C=q.DOM,y=q.UA,u=q.Event,p;if(y.ie)p=document.documentMode||y.ie;var m={pd:function(d){d=d.replace(/-min\.(js|css)/i,".$1");j.Config.debug||(d=d.replace(/\.(js|css)/i,"-min.$1"));if(d.indexOf("?t")==-1){d+=d.indexOf("?")!=-1?"&":"?";d+="t="+encodeURIComponent("2011-02-14 14:32:25")}return j.Config.Eg+d},Id:function(d,f,e){var i=d[f],r=d[e];d[f]=function(){i.apply(this,arguments);d[f]=d[e];return r.apply(this,arguments)}},mf:function(d,
f,e,i){e=e.defaultView||e.parentWindow;d-=C.scrollLeft(e);f-=C.scrollTop(e);if(i)if(e!=(i.defaultView||i.parentWindow)&&e.frameElement){i=C.Rb(e.frameElement,i);d+=i.left;f+=i.top}return{left:d,top:f}},Yd:function(){for(var d,f=0,e=arguments.length;f<e;f++){var i=arguments[f];try{d=i();break}catch(r){}}return d},Me:function(d,f){if(!d&&!f)return U;if(!d||!f||d.length!=f.length)return Y;for(var e=0;e<d.length;e++)if(d[e]!==f[e])return Y;return U},xd:function(d,f,e){d=d.documentElement;for(var i=0;d&&
i<f.length;i++){var r=f[i];if(e)for(var k=-1,a=0;a<d.childNodes.length;a++){var b=d.childNodes[a];if(!(e===U&&b.nodeType==3&&b.previousSibling&&b.previousSibling.nodeType==3)){k++;if(k==r){d=b;break}}}else d=d.childNodes[r]}return d?new I(d):w},Ue:function(d){for(var f in d)d[f].Qc(d,U)},pc:function(d){return d.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/,"&gt;")},Ra:function(d){return d.replace(/^\s+/,"")},Ta:function(d){return d.replace(/\s+$/,"")},trim:function(d){return this.Ra(this.Ta(d))},
mix:function(){for(var d={},f=0;f<arguments.length;f++)d=q.mix(d,arguments[f]);return d},rb:function(){if(!y.ie)return Y;var d=document.domain,f=window.location.hostname;return d!=f&&d!="["+f+"]"},af:function(d,f){return Array(f+1).join(d)},Mf:function(d,f,e){e=e||150;if(e===-1)return function(){d.apply(f,arguments)};var i=(new Date).getTime();return function(){var r=(new Date).getTime();if(r-i>e){i=r;d.apply(f,arguments)}}},Qe:function(d,f,e){e=e||0;var i=w;return function(){i&&clearTimeout(i);var r=
arguments;i=setTimeout(function(){return d.apply(f,r)},e)}},isNumber:function(d){return/^\d+(.\d+)?$/.test(q.trim(d))},Of:function(d){for(var f=0;f<d.length;f++){var e=C.C(d[f]),i=q.trim(e.val()),r=e.attr("data-verify");e=e.attr("data-warning");if(r&&!RegExp(r).test(i)){alert(e);return Y}}return U},If:function(d,f){d.on("sourcemode",f.qd,f);d.on("wysiwygmode",f.sd,f)},Ef:function(d){var f=d.attr("placeholder");if(f&&!y.webkit){d.addClass("ke-input-tip");d.val(f)}else y.webkit&&d.val("")},kh:function(d,
f){d.removeClass("ke-input-tip");d.val(f)},Af:function(d,f){d.attr("placeholder",f);if(!y.webkit){d.on("blur",function(){if(!q.trim(d.val())){d.addClass("ke-input-tip");d.val(f)}});d.on("focus",function(){d.removeClass("ke-input-tip");q.trim(d.val())==f&&d.val("")})}},Te:function(d){d=d[0]||d;for(var f=q.makeArray(d.childNodes),e=0;e<f.length;e++){var i=f[e];i.nodeType==j.n.f&&!q.trim(i.nodeValue)&&d.removeChild(i)}},pf:function(d){return!d?d:String(d).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,
"&lt;").replace(/"/g,"&quot;")},of:function(d){return!d?d:String(d).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&")},ef:function(d,f){return d.toLowerCase()==f.toLowerCase()},Jd:function(d){d=q.clone(d);for(var f in d)if(d.hasOwnProperty(f)){var e=d[f];if(q.isFunction(e))d[f]=e()}return d},$e:function(d,f,e){function i(){var A={responseText:"",responseXML:w};A.Le=d?d.Le:w;try{var B;if((B=y.ie?k.contentWindow.document:k.contentDocument||window.frames[r].document)&&
B.body)A.responseText=B.body.innerHTML;A.responseXML=B&&B.XMLDocument?B.XMLDocument:B}catch(s){q.log(s)}u.remove(k,"load",i);d.Re&&d.Re(A);setTimeout(function(){C.j(k)},100)}var r=q.guid("form-upload-"),k=document.createElement("iframe");k.id=r;k.name=r;k.className="ke-hidden";var a="document.open();"+(m.rb()?'document.domain="'+document.domain+'";':"")+"document.close();";if(y.ie)k.src=y.ie?"javascript:void(function(){"+encodeURIComponent(a)+"}())":"";q.log("doFormUpload : "+k.src);document.body.appendChild(k);
if(y.ie)document.frames[r].name=r;a=C.Xc(d.form);var b={target:a.target,method:a.method,encoding:a.encoding,enctype:a.enctype,action:a.action};a.target=r;a.method="POST";a.enctype=a.encoding="multipart/form-data";if(e)a.action=e;var g;if(f){g=[];f=j.k.Jd(f);for(var n in f)if(f.hasOwnProperty(n)){e=document.createElement("input");e.type="hidden";e.name=n;e.value=f[n];a.appendChild(e);g.push(e)}}u.on(k,"load",i);a.submit();a.target=b.target;a.method=b.method;a.enctype=b.enctype;a.encoding=b.encoding;
a.action=b.action;if(g){f=0;for(n=g.length;f<n;f++)C.j(g[f])}return k},o:function(d,f){for(var e in f)d[e]=f[e]},map:function(d,f){for(var e=0;e<d.length;e++)d[e]=f(d[e]);return d},Ba:p,Cf:function(d){y.ie?d.ta():d.attr("onmousedown","return false;")},Wg:function(d){d=d.attributes;return d.type=="application/x-shockwave-flash"||/\.swf(?:$|\?)/i.test(d.src||"")},Je:function(){var d=this.kb=this.kb||[];d.push.apply(d,q.makeArray(arguments))},Ze:function(){for(var d=this.kb||[],f=0;f<d.length;f++){var e=
d[f];if(q.isFunction(e))e();else{e.detach&&e.detach();e.za&&e.za();e.nodeType&&e.remove&&e.remove()}}this.kb=[]}};j.k=m;j.Utils=m;y.Ba=m.Ba;m.o(m,{debugUrl:m.pd,lazyRun:m.Id,getXY:m.mf,tryThese:m.Yd,arrayCompare:m.Me,getByAddress:m.xd,clearAllMarkers:m.Ue,htmlEncodeAttr:m.pc,ltrim:m.Ra,rtrim:m.Ta,trim:m.trim,mix:m.mix,isCustomDomain:m.rb,duplicateStr:m.af,buffer:m.Qe,isNumber:m.isNumber,verifyInputs:m.Of,sourceDisable:m.If,resetInput:m.Ef,placeholder:m.Af,clean:m.Te,htmlEncode:m.pf,htmlDecode:m.of,
equalsIgnoreCase:m.ef,normParams:m.Jd,throttle:m.Mf,doFormUpload:m.$e,map:m.map})});
KISSY.Editor.add("dom",function(j){function w(a){if(a&&!a[0])return new p(a);return a}function q(a){return a[0]||a}function I(a){return a.replace(/-(\w)/g,function(b,g){return g.toUpperCase()})}var C=KISSY,y=C.DOM,u=C.UA,p=C.Node,m=j.k,d={abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,"var":1};j.n={e:1,f:3,ee:8,dg:11};j.NODE=j.n;j.ab={ea:0,ge:1,da:2,aa:4,$:8,Kc:16};j.POSITION=
j.ab;var f=j.n,e=j.ab,i={block:1,"list-item":1,table:1,"table-row-group":1,"table-header-group":1,"table-footer-group":1,"table-row":1,"table-column-group":1,"table-column":1,"table-cell":1,"table-caption":1},r={hr:1},k={C:w,Xc:q,g:function(a,b){if(!a&&!b)return U;if(!a||!b)return Y;a=q(a);b=q(b);return a===b},qa:function(a,b){a=w(a);var g=C.mix(C.mix({},r),b||{});return i[a.css("display")]||g[a.d()]},pa:function(a){return a&&"scrollTo"in a&&a.document?a:a&&a.nodeType===9?a.defaultView||a.parentWindow:
Y},t:function(a){a=q(a);for(var b=a.parentNode.childNodes,g=0;g<b.length;g++)if(b[g]===a)return g;return-1},le:function(a,b){a=q(a);var g=a.firstChild;if((g=g&&new p(g))&&b&&!b(g))g=g.Ka(b);return g},Vc:function(a,b,g){a=q(a);y.j(a);b=q(b);g?b.insertBefore(a,b.firstChild):b.appendChild(a)},d:function(a){a=q(a);var b=a.nodeName.toLowerCase();if(u.ie)if((a=a.scopeName)&&a!="HTML")b=a.toLowerCase()+":"+b;return b},Tc:function(a,b){if(a.d()!=b.d())return Y;var g=a[0].attributes,n=b[0].attributes,A=g.length,
B=n.length;if(A!=B)return Y;for(var s=0;s<A;s++){var x=g[s],z=x.name;if(x.specified&&a.attr(z)!=b.attr(z))return Y}if(m.Ba<8)for(s=0;s<B;s++){x=n[s];z=x.name;if(x.specified&&a.attr(z)!=b.attr(z))return Y}return U},Sb:function(a){a=q(a).childNodes;for(var b=0,g=a.length;b<g;b++){var n=a[b],A=n.nodeType;if(!(A==f.e&&n.getAttribute("_ke_bookmark")))if(A==f.e&&!k.Sb(n)||A==f.f&&C.trim(n.nodeValue))return Y}return U},Tb:function(a,b,g){a=q(a);b=b[0]||b;if(a!=b)if(g)for(;g=a.lastChild;)b.insertBefore(a.removeChild(g),
b.firstChild);else for(;g=a.firstChild;)b.appendChild(a.removeChild(g))},ra:function(){function a(b,g,n){if(g[0]&&g[0].nodeType==f.e){for(var A=[];g.attr("_ke_bookmark")||g.Sb();){A.push(g);g=n?new p(g[0].nextSibling):new p(g[0].previousSibling);if(!g[0]||g[0].nodeType!=f.e)return}if(b.Tc(g)){for(var B=n?b[0].lastChild:b[0].firstChild;A.length;)A.shift().Vc(b,!n);g.Tb(b,!n);g.j();B[0]&&B[0].nodeType==f.e&&B.ra()}}}return function(b){if(b[0])if(d[b.d()]||b.d()=="a"){a(b,new p(b[0].nextSibling),U);
a(b,new p(b[0].previousSibling))}}}(),ta:u.gecko?function(a){a=q(a);a.style.MozUserSelect="none"}:u.webkit?function(a){a=q(a);a.style.ag="none"}:function(a){a=q(a);if(u.ie||u.opera){var b=0;a.setAttribute("unselectable","on");for(var g=a.getElementsByTagName("*");a=g[b++];)switch(a.tagName.toLowerCase()){case "iframe":case "textarea":case "input":case "select":break;default:a.setAttribute("unselectable","on")}}},Rb:function(a,b){a=q(a);var g,n=0;g=0;var A=a.ownerDocument.defaultView||a.ownerDocument.parentWindow,
B=a.ownerDocument,s=B.documentElement;b=b||B;if(a.getBoundingClientRect){if(a!==B.body&&s!==a){g=a.getBoundingClientRect();n=g.left+(b===B?y.scrollLeft(A):0);g=g.top+(b===B?y.scrollTop(A):0)}if(b)if(A!=(b.defaultView||b.parentWindow)&&A.frameElement){A=k.Rb(A.frameElement,b);n+=A.left;g+=A.top}}return{left:n,top:g}},ne:function(a){return(a=q(a))&&a.contentWindow.document},ia:function(a,b){a=q(a);var g=a.ownerDocument;if(!(!a||a.nodeType!=f.f)){if(u.ie&&b==a.nodeValue.length){var n=g.createTextNode("");
y.insertAfter(n,a);return new p(n)}n=new p(a.splitText(b));if(g.documentMode){g=g.createTextNode("");y.insertAfter(g,n[0]);y.j(g)}return n}},Ub:function(a,b){a=w(a);var g=[];do g[b?"push":"unshift"](a);while(a=a.parent());return g},K:function(a,b,g){a=q(a);a=a.cloneNode(b);if(!g){var n=function(A){if(A.nodeType==f.e){A.removeAttribute("id");A=A.childNodes;for(var B=0;B<A.length;B++)n(A[B])}};n(a)}return new p(a)},v:function(a,b,g,n){a=q(a);if(n&&!n.call){var A=n[0]||n;n=function(s){s=s[0]||s;return s!==
A}}b=!b&&a.firstChild;var B=new p(a);if(!b){if(a.nodeType==f.e&&n&&n(a,U)===Y)return V;b=a.nextSibling}for(;!b&&(B=B.parent());){if(n&&n(B,U)===Y)return V;b=B[0].nextSibling}if(!b)return V;b=y.C(b);if(n&&n(b)===Y)return V;if(g&&g!=b[0].nodeType)return b.v(Y,g,n);return b},ha:function(a,b,g,n){a=q(a);if(n&&!n.call){var A=n[0]||n;n=function(s){s=s[0]||s;return s!==A}}b=!b&&a.lastChild;var B=new p(a);if(!b){if(a.nodeType==f.e&&n&&n(a,U)===Y)return V;b=a.previousSibling}for(;!b&&(B=B.parent());){if(n&&
n(B,U)===Y)return V;b=B[0].previousSibling}if(!b)return V;b=y.C(b);if(n&&n(b)===Y)return V;if(g&&b[0].nodeType!=g)return b.ha(Y,g,n);return b},Qb:function(a,b){if(a.g(b))return a;if(b[0].nodeType!=f.f&&b.contains(a))return b;var g=a[0].nodeType==f.f?a.parent():a;do if(g[0].nodeType!=f.f&&g.contains(b))return g;while(g=g.parent());return V},Pc:function(a,b,g){a=q(a);if(!g)a=a.parentNode;if(b&&!C.isFunction(b)){var n=b;b=function(A){return A.d()==n}}for(;a&&a.nodeType!=9;){if(!b||b(new p(a))===U)return new p(a);
a=a.parentNode}return V},fb:m.Ba<9?function(a,b){a=q(a);var g=a.getAttributeNode(b);return!!(g&&g.specified)}:function(a,b){a=q(a);return a.hasAttribute(b)},gb:m.Ba<9?function(a){a=q(a);for(var b=a.attributes,g=0;g<b.length;g++){var n=b[g];switch(n.name){case "class":if(a.getAttribute("class"))return U;break;default:if(n.specified)return U}}return Y}:function(a){a=q(a);u.gecko&&a.removeAttribute("_moz_dirty");return a.hasAttributes()},La:function(a,b){var g=q(a),n=q(b);if(g.compareDocumentPosition)return g.compareDocumentPosition(n);
if(g==n)return e.ea;if(g.nodeType==f.e&&n.nodeType==f.e){if(g.contains){if(g.contains(n))return e.Kc+e.aa;if(n.contains(g))return e.$+e.da}if("sourceIndex"in g)return g.sourceIndex<0||n.sourceIndex<0?e.ge:g.sourceIndex<n.sourceIndex?e.aa:e.da}g=a.Ja();n=b.Ja();for(var A=Math.min(g.length,n.length),B=0;B<=A-1;B++)if(g[B]!=n[B]){if(B<A)return g[B]<n[B]?e.aa:e.da;break}return g.length<n.length?e.Kc+e.aa:e.$+e.da},Ja:function(a,b){a=q(a);for(var g=[],n=a.ownerDocument.documentElement,A=a;A&&A!=n;){var B=
A.parentNode,s=-1;if(B){for(var x=0;x<B.childNodes.length;x++){var z=B.childNodes[x];if(!(b&&z.nodeType==3&&z.previousSibling&&z.previousSibling.nodeType==3)){s++;if(z==A)break}}g.unshift(s)}A=B}return g},Pb:function(a,b){var g=new j.Range(a[0].ownerDocument);g.setStartAfter(a);g.setEndAfter(b);var n=g.extractContents();g.insertNode(a.j());a[0].parentNode.insertBefore(n,a[0].nextSibling)},L:function(a,b,g){a=w(a);if(g!==undefined)return a.css(b,g);a=q(a);return a.style[I(b)]},j:function(a,b){var g=
q(a),n=g.parentNode;if(n){if(b)for(var A;A=g.firstChild;)n.insertBefore(g.removeChild(A),g);n.removeChild(g)}return a},ib:function(a){y.Uc(a);y.Wc(a)},Uc:function(a){a=q(a);for(var b;b=a.firstChild;){if(b.nodeType==f.f){var g=m.Ra(b.nodeValue),n=b.nodeValue.length;if(g){if(g.length<n){(new p(b)).ia(n-g.length);a.removeChild(a.firstChild)}}else{a.removeChild(b);continue}}break}},Wc:function(a){a=q(a);for(var b;b=a.lastChild;){if(b.type==f.f){var g=m.Ta(b.nodeValue),n=b.nodeValue.length;if(g){if(g.length<
n){(new p(b)).ia(g.length);a.removeChild(a.lastChild)}}else{a.removeChild(b);continue}}break}if(!u.ie&&!u.opera)(b=a.lastChild)&&b.nodeType==1&&b.nodeName.toLowerCase()=="br"&&b.parentNode.removeChild(b)},Ob:function(a){a=q(a);for(var b=a.lastChild;b&&b.nodeType==f.f&&!C.trim(b.nodeValue);)b=b.previousSibling;if(!b||b.nodeType==f.f||y.d(b)!=="br"){b=u.opera?a.ownerDocument.createTextNode(""):a.ownerDocument.createElement("br");u.gecko&&b.setAttribute("type","_moz");a.appendChild(b)}},sa:function(a,
b){var g=q(a),n;do n=(g=g.previousSibling)&&new p(g);while(n&&b&&!b(n));return n},pe:function(a,b){a=y.C(a);var g=a[0].lastChild;if((g=g&&new p(g))&&b&&!b(g))g=g.sa(b);return g},Ka:function(a,b){var g=q(a),n;do n=(g=g.nextSibling)&&new p(g);while(n&&b&&!b(n));return n},hb:function(a){a=q(a);if(a.outerHTML)return a.outerHTML.replace(/<\?[^>]*>/,"");var b=a.ownerDocument.createElement("div");b.appendChild(a.cloneNode(U));return b.innerHTML},qe:function(a,b,g,n){a=y.C(a);var A=a.data("list_marker_id")||
a.data("list_marker_id",C.guid()).data("list_marker_id"),B=a.data("list_marker_names")||a.data("list_marker_names",{}).data("list_marker_names");b[A]=a;B[g]=1;return a.data(g,n)},Qc:function(a,b,g){a=w(a);var n=a.data("list_marker_names"),A=a.data("list_marker_id"),B;for(B in n)a.removeData(B);a.removeData("list_marker_names");if(g){a.removeData("list_marker_id");delete b[A]}},Rc:function(a,b,g){a=q(a);b=w(b);var n=a.attributes;g=g||{};for(var A=0;A<n.length;A++){var B=n[A],s=B.name.toLowerCase(),
x;if(!(s in g))if(s=="checked"&&(x=y.attr(a,s)))b.attr(s,x);else if(B.specified||u.ie&&B.value&&s=="value"){x=y.attr(a,s);if(x===V)x=B.nodeValue;b.attr(s,x)}}if(a.style.cssText!=="")b[0].style.cssText=a.style.cssText},Sc:function(a){a=y.d(a);var b=j.m;return(a=!b.Hc[a]&&(b[a]||b.span))&&a["#"]},Vb:function(a){a=w(a);var b=a[0].ownerDocument,g=y.scrollLeft(b),n=y.scrollTop(b),A=a.offset(),B=A.left;A=A.top;if(y.viewportHeight(b)+n<A||A<n||y.viewportWidth(b)+g<B||B<g)a.scrollIntoView(b)},me:function(a,
b,g){a=q(a);if(!u.ie&&g)b=g+":"+b;g=[];a=a.getElementsByTagName(b);for(b=0;b<a.length;b++)g.push(new p(a[b]));return g}};C.DOM.oe=function(a){C.mix(y,a);for(var b in a)a.hasOwnProperty(b)&&function(g){p.prototype[g]=function(){var n=[].slice.call(arguments,0);n.unshift(this);return a[g].apply(V,n)}}(b)};m.o(k,{_4e_wrap:k.C,_4e_unwrap:k.Xc,_4e_equals:k.g,_4e_isBlockBoundary:k.qa,_4e_getWin:k.pa,_4e_index:k.t,_4e_first:k.le,_4e_move:k.Vc,_4e_name:k.d,_4e_isIdentical:k.Tc,_4e_isEmptyInlineRemoveable:k.Sb,
_4e_moveChildren:k.Tb,_4e_mergeSiblings:k.ra,_4e_unselectable:k.ta,_4e_getOffset:k.Rb,_4e_getFrameDocument:k.ne,_4e_splitText:k.ia,_4e_parents:k.Ub,_4e_clone:k.K,_4e_nextSourceNode:k.v,_4e_previousSourceNode:k.ha,_4e_commonAncestor:k.Qb,_4e_ascendant:k.Pc,_4e_hasAttribute:k.fb,_4e_hasAttributes:k.gb,_4e_position:k.La,_4e_address:k.Ja,_4e_breakParent:k.Pb,_4e_style:k.L,_4e_remove:k.j,_4e_trim:k.ib,_4e_ltrim:k.Uc,_4e_rtrim:k.Wc,_4e_appendBogus:k.Ob,_4e_last:k.pe,_4e_previous:k.sa,_4e_next:k.Ka,_4e_outerHtml:k.hb,
_4e_setMarker:k.qe,_4e_clearMarkers:k.Qc,_4e_getUniqueId:k.pg,_4e_copyAttributes:k.Rc,_4e_isEditable:k.Sc,_4e_scrollIntoView:k.Vb,_4e_getElementsByTagName:k.me});y.oe(k)});
KISSY.Editor.add("focusmanager",function(j){function w(){var i=this;i.qc=d;m=i;p&&clearTimeout(p);p=setTimeout(function(){i.fire("focus")},100)}function q(){var i=this;i.qc=f;m=e;p&&clearTimeout(p);p=setTimeout(function(){i.fire("blur")},100)}var I=KISSY,C=I.DOM,y=I.Event,u={},p,m;I={dh:function(){for(var i in u){var r=u[i];r.document.designMode="off";r.document.designMode="on"}},Jg:function(){return m},hf:function(i){return u[i]},add:function(i){var r=C.pa(i.document);y.on(r,"focus",w,i);y.on(r,
"blur",q,i)},Df:function(i){u[i.Wb]=i},remove:function(i){delete u[i.Wb];var r=C.pa(i.document);y.remove(r,"focus",w,i);y.remove(r,"blur",q,i)}};var d=U,f=Y,e=V;j.vd=I;j.focusManager=I;j.jf=function(){return u};j.getInstances=j.jf});
KISSY.Editor.add("definition",function(j){var w=U,q=Y,I=j.k,C=document,y=KISSY,u=y.UA,p=y.DOM,m=y.Node,d=y.Event,f=j.vd,e=I.Yd,i=1,r="document.open();"+(I.rb()?'document.domain="'+C.domain+'";':"")+"document.close();",k="<div  class='ke-editor-wrap'  > <div class='"+".ke-editor-tools".substring(1)+"' ></div><div class='"+".ke-textarea-wrap".substring(1)+'\'><iframe  style="width:100%;height:100%;border:none;"  width="100%"  height="100%"  frameborder="0"  title="kissy-editor"  src="'+(u.ie?"javascript:void(function(){"+
encodeURIComponent(r)+"}())":"")+'"  allowTransparency="true" ></iframe></div><div class=\''+".ke-editor-status".substring(1)+"'></div></div>";j.Nc=0;j.eb=1;j.SOURCE_MODE=j.Nc;j.WYSIWYG_MODE=j.eb;y.augment(j,{qf:function(a){var b=this;b.jb={};b.Ma={};b.ua={};u.ie&&p.addClass(C.body,"ke-ie"+u.ie);if(u.trident)p.addClass(C.body,"ke-trident"+u.trident);else if(u.gecko)p.addClass(C.body,"ke-gecko");else u.webkit&&p.addClass(C.body,"ke-webkit");var g=new m(k);b.cf=g;b.Wb=i++;f.Df(b);b.Xa=g.one(".ke-textarea-wrap");
b.wrap=b.Xa;b.Ca=b.Xa.one("iframe");b.iframe=b.Ca;b.Xd=g.one(".ke-editor-tools");b.toolBarDiv=b.Xd;b.W=a;b.textarea=b.W;b.Kf=g.one(".ke-editor-status");b.statusDiv=b.Kf;I.Cf(b.Xd);var n=a.L("width"),A=a.L("height");if(n){g.css("width",n);a.css("width","100%")}b.W.css("display","none");g.insertAfter(a);b.Xa[0].appendChild(a[0]);if(A){b.Xa.css("height",A);a.css("height","100%")}g=b.Ca;if(a.fb("tabindex"))g[0].tabIndex=u.webkit?-1:a[0].tabIndex;b.on("dataReady",function(){b.Ae=w;j.fire("instanceCreated",
{bf:b})});u.gecko?g.on("load",b.ed,b):b.ed();b.va.attachForm&&a[0].form&&b.ve()},za:function(){if(!this.te){var a=this.cf,b=this.W,g=this.document,n=this.Ca[0].contentWindow;this.Cb();j.vd.remove(this);d.remove(g);d.remove(g.documentElement);d.remove(g.body);d.remove(n);this.Ca.detach();g=this.ua;for(var A in g)if(g.hasOwnProperty(A)){n=g[A];n.za&&n.za()}this.fire("destroy");b.insertBefore(a);a.remove();b.css({width:a.css("width"),height:this.Xa.css("height")});b.show();this.jb=this.Ma=this.ua=V;
this.detach();this.te=U}},ve:function(){var a=this,b=new m(a.W[0].form);b.on("submit",a.Cb,a);a.on("destroy",function(){b.detach("submit",a.Cb,a)})},Nf:function(a,b){var g=this,n=j.fe;n&&n.sc();g.use(a,function(){var A=g.yd(a);if(A){b(A);n&&n.jh()}else y.later(arguments.callee,50,Y,g)})},Ie:function(a,b){this.Ma[a]=b},yd:function(a){return this.Ma[a]},Mg:function(a){var b=this.Ma[a];b&&b.za();this.Ma[a]=V},Ge:function(a,b){this.jb[a]=b},nf:function(a){return this.jb[a]},execCommand:function(a){var b=
this.jb[a],g=y.makeArray(arguments);g.shift();g.unshift(this);return b.exec.apply(b,g)},lc:function(){return this.W.css("display")=="none"?j.eb:j.Nc},getData:function(a){var b;b=this.lc()==j.eb?this.document&&this.document.body?this.document.body.innerHTML:"":this.W.val();if(this.htmlDataProcessor)b=a?this.htmlDataProcessor.toHtml(b,"p"):this.htmlDataProcessor.toServer(b,"p");b=y.trim(b);if(/^<p>((&nbsp;)|\s)*<\/p>$/.test(b))b="";return b},setData:function(a){var b=a;if(this.htmlDataProcessor)b=this.htmlDataProcessor.toDataFormat(a,
"p");this.document.body.innerHTML=b;if(!b)this.document.body.innerHTML=b;this.lc()!=j.eb&&this.W.val(a)},Cb:function(){this.W.val(this.getData())},rg:function(){return this.document.body.innerHTML},vg:function(a){this.document.body.innerHTML=a},ze:function(a){var b=this.va,g=b.ec;b=b.ya;var n="",A=j.k.pd("../theme/editor-iframe.css");if(b)for(var B=0;B<b.length;B++)n+='<link href="'+b[B]+'" rel="stylesheet"/>';return"<!doctype html><html><head><title>${title}</title><link href='"+A+"' rel='stylesheet'/><style>"+
(g||"")+"</style>"+n+"</head><body class='ke-editor'>&nbsp;"+(a?'<script id="ke_actscript" type="text/javascript">'+(I.rb()?'document.domain="'+C.domain+'";':"")+'window.parent.KISSY.Editor._initIFrame("'+a+'");<\/script>':"")+"</body></html>"},getSelection:function(){return j.Oc.getSelection(this.document)},focus:function(){var a=this.document,b=p.pa(a);u.webkit&&b&&b.parent&&b.parent.focus();u.webkit&&b&&b.focus();a&&a.body.focus();this.vb()},blur:function(){p.pa(this.document).blur();this.document&&
this.document.body.blur()},He:function(a){var b=this.va,g=this.document;b.ec=b.ec||"";b.ec+="\n"+a;b=g.createElement("style");g.getElementsByTagName("head")[0].appendChild(b);if(b.styleSheet)b.styleSheet.cssText=a;else b.appendChild(g.createTextNode(a))},Bg:function(a){var b=this.va,g=this.document;b.ya=b.ya||[];b.ya.push(a);b=g.createElement("link");b.rel="stylesheet";g.getElementsByTagName("head")[0].appendChild(b);b.href=a},eh:function(a){for(var b=this.va,g=y.makeArray(this.document.getElementsByTagName("link")),
n=0;n<g.length;n++)g[n].href==a&&p.j(g[n]);b.ya=b.ya||[];b=b.ya;a=y.indexOf(a,b);a!=-1&&b.splice(a,1)},ed:function(){function a(){B=A.document;b.document=B;g.detach();B.open("text/html","replace");B.write(n);B.close()}var b=this,g=b.Ca,n=b.ze(b.Wb),A=g[0].contentWindow,B;try{B=A.document}catch(s){g[0].src=g[0].src;if(u.ie<7){setTimeout(a,10);return}}a()},ready:function(a){this.Ae?a():this.on("dataReady",a)},Cg:function(a,b,g){this.ua=this.ua;g=g||{};g.gf=b;this.ua[a]=g},Zd:function(a){var b=this.ua[a];
if(b)if(!(b.status&&!b.duplicate)){a=this.Env.mods[a].requires||[];for(var g=0;g<a.length;g++)this.Zd(a[g]);b.gf.call(b);b.status=1}},lb:function(){var a=this;a.ad&&clearTimeout(a.ad);a.ad=setTimeout(function(){var b=a.getSelection();if(b&&!b.Fd){var g=b.qb(),n=new j.$a(g);if(!a.xc||!a.xc.nd(n)){a.xc=n;a.fire("selectionChange",{selection:b,path:n,element:g})}}},100)},vb:function(){this.xc=V;this.lb()},rf:function(a,b,g){var n=this;n.focus();setTimeout(function(){var A,B=a.d(),s=j.m,x=j.oa,z=j.n,J=
s.Ya[B],t=n.getSelection(),c=t&&t.F(),h,l,v,o;if(!c||c.length==0){var D=arguments,P=D.callee;setTimeout(function(){P.apply(n,D)},30)}else{n.fire("save");for(var O=c.length-1;O>=0;O--){h=c[O];h.deleteContents();A=!O&&a||a.K(w);b&&b(A);if(J)for(;(v=h.Aa(q,w))&&(o=s[v.d()])&&!(o&&o[B]);)if(v.d()in s.span)h.Cc(v);else if(h.wa()&&h.ka()){h.setStartBefore(v);h.collapse(w);v.j()}else h.Bc();h.insertNode(A);l||(l=A)}if(l){B=l.v(w);s=n.document;o=j.m;if(o.Eb[A.d()]){B=new m(s.createTextNode(" "));B.insertAfter(l)}else if(B){if(B.d()==
"br"&&o[B.parent().d()].p){o=new m("<p>&nbsp;</p>",V,s);B[0].parentNode.replaceChild(o[0],B[0]);B=o}}else{o=new m("<p>&nbsp;</p>",V,s);o.insertAfter(l);B=o}h.H(l,x.r);B&&B[0].nodeType==z.e&&h.tb(B);t.Bb([h]);n.focus();A&&A.Vb();setTimeout(function(){n.fire("save")},10);g&&g(A)}}},0)},sf:function(a,b){var g=this;if(g.htmlDataProcessor)a=g.htmlDataProcessor.toDataFormat(a,V,b);g.focus();setTimeout(function(){var n=g.getSelection(),A=n&&n.F();if(!A||A.length==0){var B=arguments,s=B.callee;setTimeout(function(){s.apply(g,
B)},30)}else{g.fire("save");if(document.selection){A=document.selection;if(A.type=="Control")A.clear();else if(n.Pa()==j.Lc.fa){n=n.F()[0];n.deleteContents();n.select()}A.createRange().pasteHTML(a)}else g.document.execCommand("inserthtml",q,a);setTimeout(function(){g.fire("save")},10)}},0)}});j._initIFrame=function(a){function b(t){e(function(){A.designMode="on";setTimeout(function(){A.designMode="off";s.focus();if(!arguments.callee.Ff)arguments.callee.Ff=w},50)},function(){A.designMode="off";p.attr(s,
"contentEditable",q);p.attr(s,"contentEditable",w);!t&&b(1)})}var g=f.hf(a);a=g.W[0];var n=g.Ca[0].contentWindow,A=g.document,B=g.va;p.j(A.getElementById("ke_actscript"));var s=A.body;if(u.ie){s.hideFocus=w;s.disabled=w;s.contentEditable=w;s.removeAttribute("disabled")}else setTimeout(function(){if(u.gecko||u.opera)s.contentEditable=w;else if(u.webkit)s.parentNode.contentEditable=w;else A.designMode="on"},0);if(u.webkit){d.on(A,"click",function(t){var c=new m(t.target);y.inArray(c.d(),["input","select"])&&
t.preventDefault()});d.on(A,"mouseup",function(t){var c=new m(t.target);y.inArray(c.d(),["input","textarea"])&&t.preventDefault()})}if(u.gecko||u.ie||u.opera){var x;x=new m(p.insertAfter((new m('<span tabindex="-1" style="position:absolute; left:-10000" role="presentation"></span>'))[0],a));x.on("focus",function(){g.focus()});g.Ag=function(){u.gecko&&g.qc&&x[0].focus()};g.on("destroy",function(){x.detach();x.remove()})}if(A.documentMode||u.gecko||u.opera){var z=A.documentElement;d.on(z,"mousedown",
function(t){if((new m(t.target))[0]==z){u.gecko&&b(q);x[0].focus()}})}d.on(n,"focus",function(){if(u.gecko)b(q);else u.opera&&s.focus();g.vb()});u.gecko&&d.on(g.document,"mousedown",function(){g.qc||b(q)});if(u.ie){d.on(A,"keydown",function(t){if(t.keyCode in{8:1,46:1}){var c=g.getSelection(),h=c.mc();if(h){g.fire("save");var l=c.F()[0].O();h.j();c.Td([l]);g.fire("save");t.preventDefault()}}});if(A.compatMode=="CSS1Compat"){var J={33:1,34:1};d.on(A,"keydown",function(t){t.keyCode in J&&setTimeout(function(){g.getSelection().scrollIntoView()},
0)})}}setTimeout(function(){u.ie&&setTimeout(function(){if(A){s.runtimeStyle.marginBottom="0px";s.runtimeStyle.marginBottom=""}},1E3)},0);setTimeout(function(){g.fire("dataReady");var t=B.disableObjectResizing,c=B.disableInlineTableEditing;if(t||c)try{A.execCommand("enableObjectResizing",q,!t);A.execCommand("enableInlineTableEditing",q,!c)}catch(h){d.on(s,u.ie?"resizestart":"resize",function(l){var v=new m(l.target);if(t||v.d()==="table"&&c)l.preventDefault()})}},10);u.webkit&&d.on(A,"mousedown",
function(t){t=new m(t.target);y.inArray(t.d(),["img","hr","input","textarea","select"])&&g.getSelection().Ac(t)});u.gecko&&d.on(A,"dragstart",function(t){var c=new m(t.target);c.d()==="img"&&/ke_/.test(c[0].className)&&t.preventDefault()});f.add(g)};document.documentMode>7&&function(){for(var a=y.all("link"),b=0;b<a.length;b++){var g=new m(a[b]),n=g.attr("href");n.indexOf("editor-pkg-min-mhtml.css")!=-1&&g.attr("href",n.replace(/editor-pkg-min-mhtml\.css/g,"editor-pkg-min-datauri.css"))}}();r=j.prototype;
I.o(r,{setData:r.setData,getData:r.getData,insertElement:r.rf,insertHtml:r.sf,ready:r.ready,addCustomStyle:r.He,addCommand:r.Ge,hasCommand:r.nf,execCommand:r.execCommand,useDialog:r.Nf,addDialog:r.Ie,getDialog:r.yd,getMode:r.lc,sync:r.Cb,getSelection:r.getSelection,focus:r.focus,blur:r.blur,notifySelectionChange:r.vb})});
KISSY.Editor.add("zindex",function(){var j=KISSY.Editor;if(!j.Dc){j.Dc={Uf:1100,jg:1200,Wf:99999,cg:900,ig:9999,LOADING:11E3,bg:12E3,he:1200};j.$b=function(w){return(j.Vf.$b||1E4)+w};j.baseZIndex=j.$b;j.zIndexManager=j.Dc}});
KISSY.Editor.add("dtd",function(j){j.m=function(){function w(s){for(var x=arguments.length-1;x>0;)KISSY.mix(s,arguments[x--]);return s}var q={isindex:1,fieldset:1},I={input:1,button:1,select:1,textarea:1,label:1},C=w({a:1},I),y=w({iframe:1},C),u={hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},p={ins:1,del:1,script:1,style:1},m=w({b:1,acronym:1,bdo:1,"var":1,"#":1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,
s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1},p),d=w({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1},m),f=w({p:1},d);I=w({iframe:1},d,I);d={img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,"#":1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,"var":1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,
del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1};var e=w({a:1},I),i={tr:1},r={"#":1},k=w({param:1},d),a=w({form:1},q,y,u,f),b={li:1},g={base:1,link:1,meta:1,title:1},n=w(g,{style:1,script:1}),A={head:1,body:1},B={address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};return{Gb:w({html:1},A,g),Ya:B,Sf:{body:1,div:1,td:1,th:1,caption:1,
form:1},Eb:e,Ec:w({script:1,style:1},B),Fc:{script:1,style:1},Db:{area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1},Fb:{dd:1,dt:1,li:1},$d:{ul:1,ol:1,dl:1},Hc:{applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1},ca:{abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,"var":1},Tf:{a:1,area:1,button:1,input:1,object:1,select:1,
textarea:1},Ic:{caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},html:A,head:n,style:r,body:a,base:{},link:{},meta:{},title:r,col:{},tr:{td:1,th:1},img:{},colgroup:{col:1},noscript:a,td:a,br:{},th:a,center:a,kbd:e,button:w(f,u),basefont:{},h5:e,h4:e,samp:e,h6:e,ol:b,h1:e,h3:e,option:r,h2:e,form:w(q,y,u,f),select:{optgroup:1,option:1},font:e,ins:e,menu:b,abbr:e,label:e,table:{thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},code:e,script:r,tfoot:i,cite:e,li:a,input:{},iframe:a,
strong:e,textarea:r,noframes:a,big:e,small:e,span:e,hr:{},dt:e,sub:e,optgroup:{option:1},param:{},bdo:e,"var":e,div:a,object:k,sup:e,dd:a,strike:e,area:{},dir:b,map:w({area:1,form:1,p:1},q,p,u),applet:k,dl:{dt:1,dd:1},del:e,isindex:{},fieldset:w({Xg:1},d),thead:i,ul:b,acronym:e,b:e,a:I,blockquote:a,caption:e,i:e,u:e,tbody:i,s:e,address:w(y,f),tt:e,legend:e,q:e,pre:w(m,C),p:e,em:e,dfn:e}}();j.XHTML_DTD=j.m});
KISSY.Editor.add("elementpath",function(j){function w(d){var f=y,e=y,i=[];for(d=d;d&&d[0];){if(d[0].nodeType==C.e){if(!this.wf)this.wf=d;var r=d.d();if(!e){if(!f&&u[r])f=d;if(p[r]){var k;if(k=!f){if(k=r=="div"){a:{k=d;k=k[0]||k;k=k.childNodes;for(var a=0,b=k.length;a<b;a++){var g=k[a];if(g.nodeType==C.e&&I.Ya[g.nodeName.toLowerCase()]){k=U;break a}}k=Y}k=!k}k=k}if(k)f=d;else e=d}}i.push(d);if(r=="body")break}d=d.parent()}this.block=this.w=f;this.blockLimit=this.D=e;this.elements=this.elements=i}var q=
KISSY.DOM,I=j.m,C=j.n,y=V,u={address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1},p={body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1};w.prototype={nd:function(d){var f=this.elements;d=d&&d.elements;if(!d||f.length!=d.length)return Y;for(var e=0;e<f.length;e++)if(!q.g(f[e],d[e]))return Y;return U},contains:function(d){for(var f=this.elements,e=0;e<f.length;e++)if(f[e].d()in d)return f[e];return y}};j.ElementPath=j.$a=w;var m=w.prototype;j.k.o(m,{compare:m.nd,
contains:m.contains})});
KISSY.Editor.add("walker",function(j){function w(i,r){if(this.c.end)return u;var k,a=this.Ea,b,g=this.nc,n=this.type,A=i?"_4e_previousSourceNode":"_4e_nextSourceNode";if(!this.c.start){this.c.start=1;a.trim();if(a.collapsed){this.end();return u}}if(!i&&!this.c.Bd){var B=a.endContainer,s=new f(B[0].childNodes[a.endOffset]);this.c.Bd=function(t,c){return(t=d.C(t))&&t[0]&&(!c||!d.g(B,t))&&(!s[0]||!t.g(s))&&(t[0].nodeType!=m.e||!c||t.d()!="body")}}if(i&&!this.c.Cd){var x=a.startContainer,z=a.startOffset>
0&&new f(x[0].childNodes[a.startOffset-1]);this.c.Cd=function(t,c){return(t=d.C(t))&&t[0]&&(!c||!t.g(x))&&(!z[0]||!t.g(z))&&(t[0].nodeType!=m.e||!c||t.d()!="body")}}var J=i?this.c.Cd:this.c.Bd;b=g?function(t,c){if(J(t,c)===y)return y;return g(t,c)}:J;if(this.ob)k=this.ob[A](y,n,b);else if(i){k=a.endContainer;if(a.endOffset>0){k=new f(k[0].childNodes[a.endOffset-1]);if(b(k)===y)k=u}else k=b(k,C)===y?u:k.ha(C,n,b)}else{k=a.startContainer;if((k=new f(k[0].childNodes[a.startOffset]))&&k[0]){if(b(k)===
y)k=u}else k=b(a.startContainer,C)===y?u:a.startContainer.v(C,n,b)}for(;k&&k[0]&&!this.c.end;){this.ob=k;if(!this.R||this.R(k)!==y){if(!r)return k}else if(r&&this.R)return y;k=k[A](y,n,b)}this.end();return this.ob=u}function q(i){for(var r,k=u;r=w.call(this,i);)k=r;return k}function I(i){this.Ea=i;this.c={}}var C=U,y=Y,u=V,p=KISSY,m=j.n,d=p.DOM,f=p.Node;p.augment(I,{end:function(){this.c.end=1},next:function(){return w.call(this)},yb:function(){return w.call(this,C)},md:function(){return w.call(this,
y,C)!==y},ld:function(){return w.call(this,C,C)!==y},Hd:function(){return q.call(this)},Gd:function(){return q.call(this,C)},reset:function(){delete this.ob;this.c={}}});I.ac=function(i){return function(r){r=d.C(r);return!(r&&r[0].nodeType==m.e&&r.qa(i))}};I.yf=function(){return this.ac({bc:1})};I.Na=function(i,r){function k(a){return a&&a[0]&&a.d()=="span"&&a.attr("_ke_bookmark")}return function(a){var b,g;b=a&&a[0]&&a[0].nodeType==m.f&&(g=a.parent())&&k(g);b=i?b:b||k(a);return r^b}};I.Wa=function(i){return function(r){r=
(r=r[0]||r)&&r.nodeType==m.f&&!p.trim(r.nodeValue);return i^r}};I.tf=function(i){var r=I.Wa();return function(k){k=r(k)||k[0].nodeType==m.e&&!k[0].offsetHeight;return i^k}};j.Ia=I;j.Walker=I;var e=I.prototype;j.k.o(e,{end:e.end,next:e.next,previous:e.yb,checkForward:e.md,checkBackward:e.ld,lastForward:e.Hd,lastBackward:e.Gd,reset:e.reset});j.k.o(I,{blockBoundary:I.ac,listItemBoundary:I.yf,bookmark:I.Na,whitespaces:I.Wa,invisible:I.tf})});
KISSY.Editor.add("range",function(j){function w(c){this.endOffset=this.endContainer=this.startOffset=this.startContainer=d;this.collapsed=p;this.document=c}function q(c){var h=c[0].nodeType!=e.f&&c.d()in n.ca,l=!f.trim(c[0].nodeValue);c=!!c.parent().attr("_ke_bookmark");return h||l||c}function I(c){return!z(c)&&!J(c)}function C(c){var h=m,l=k.Na(p);return function(v){if(l(v))return p;if(v[0].nodeType==e.f){if(f.trim(v[0].nodeValue).length)return m}else if(v[0].nodeType==e.e)if(!x[v.d()])if(!c&&!g.ie&&
v.d()=="br"&&!h)h=p;else return m;return p}}function y(c,h){function l(v){return v&&v.nodeName=="span"&&v.getAttribute("_ke_bookmark")}return function(v){var o,D;o=v&&!v.nodeName&&(D=v.parentNode)&&l(D);o=c?o:o||l(v);return h^o}}function u(c){return function(h){h=(h=h[0]||h)&&h.nodeType==e.f&&!f.trim(h.nodeValue);return c^h}}j.oa={Z:1,J:2,B:3,r:4,Jb:1,Ib:2,Za:3,cb:1,de:2,kg:3,ga:1,Mc:2};j.RANGE=j.oa;var p=U,m=Y,d=V,f=KISSY,e=j.n,i=j.oa,r=j.ab,k=j.Ia,a=f.DOM,b=j.k.xd,g=f.UA,n=j.m,A=j.$a,B=f.Node,s=
{area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1};w.prototype.toString=function(){var c=[];c.push((this.startContainer[0].id||this.startContainer[0].nodeName)+":"+this.startOffset);c.push((this.endContainer[0].id||this.endContainer[0].nodeName)+":"+this.endOffset);return c.join("<br/>")};f.augment(w,{Va:function(){this.collapsed=this.startContainer&&this.endContainer&&a.g(this.startContainer,this.endContainer)&&this.startOffset==this.endOffset},vc:function(){var c=this.startContainer,
h=this.startOffset;if(c[0].nodeType!=e.e)if(h)h>=c[0].nodeValue.length&&this.setStartAfter(c);else this.setStartBefore(c);c=this.endContainer;h=this.endOffset;if(c[0].nodeType!=e.e)if(h)h>=c[0].nodeValue.length&&this.setEndAfter(c);else this.setEndBefore(c)},setStartAfter:function(c){this.setStart(c.parent(),c.t()+1)},setStartBefore:function(c){this.setStart(c.parent(),c.t())},setEndAfter:function(c){this.setEnd(c.parent(),c.t()+1)},setEndBefore:function(c){this.setEnd(c.parent(),c.t())},wc:function(){var c=
this.startContainer,h=this.endContainer;c&&c.d()=="span"&&c.attr("_ke_bookmark")&&this.V(c,i.B);h&&h.d()=="span"&&h.attr("_ke_bookmark")&&this.U(h,i.r)},setStart:function(c,h){if(c[0].nodeType==e.e&&s[c.d()]){c=c.parent();h=c.t()}this.startContainer=c;this.startOffset=h;if(!this.endContainer){this.endContainer=c;this.endOffset=h}this.Va()},setEnd:function(c,h){if(c[0].nodeType==e.e&&s[c.d()]){c=c.parent();h=c.t()+1}this.endContainer=c;this.endOffset=h;if(!this.startContainer){this.startContainer=
c;this.startOffset=h}this.Va()},V:function(c,h){switch(h){case i.Z:this.setStart(c,0);break;case i.J:c[0].nodeType==e.f?this.setStart(c,c[0].nodeValue.length):this.setStart(c,c[0].childNodes.length);break;case i.B:this.setStartBefore(c);break;case i.r:this.setStartAfter(c)}this.Va()},U:function(c,h){switch(h){case i.Z:this.setEnd(c,0);break;case i.J:c[0].nodeType==e.f?this.setEnd(c,c[0].nodeValue.length):this.setEnd(c,c[0].childNodes.length);break;case i.B:this.setEndBefore(c);break;case i.r:this.setEndAfter(c)}this.Va()},
hc:function(c,h){var l=this.startContainer,v=this.endContainer,o=this.startOffset,D=this.endOffset,P,O=this.document,Q;this.wc();if(v[0].nodeType==e.f)v=v.ia(D);else if(v[0].childNodes.length>0)if(D>=v[0].childNodes.length){v=new B(v[0].appendChild(O.createTextNode("")));Q=p}else v=new B(v[0].childNodes[D]);if(l[0].nodeType==e.f){l.ia(o);if(l.g(v))v=new B(l[0].nextSibling)}else if(o)if(o>=l[0].childNodes.length){P=new B(O.createTextNode(""));l.append(P);l=P;P=p}else l=new B(l[0].childNodes[o].previousSibling);
else{P=new B(O.createTextNode(""));l.prepend(P);l=P;P=p}o=l.Ub();D=v.Ub();var N,W,R;for(N=0;N<o.length;N++){W=o[N];R=D[N];if(!W.g(R))break}O=h;for(var X,aa,ca,F=N;F<o.length;F++){X=o[F];aa=O&&!X.g(l)?O.appendChild(X.K()[0]):V;for(X=X[0].nextSibling;X;){if(a.g(D[F],X)||a.g(v,X))break;ca=X.nextSibling;if(c==2)O.appendChild(X.cloneNode(p));else{a.j(X);c==1&&O.appendChild(X)}X=ca}if(aa)O=aa}O=h;for(N=N;N<D.length;N++){X=D[N];aa=O&&c>0&&!X.g(v)?O.appendChild(X.K()[0]):V;if(!o[N]||!X.parent().g(o[N].parent()))for(X=
X[0].previousSibling;X;){if(a.g(o[N],X)||a.g(l,X))break;ca=X.previousSibling;if(c==2)O.insertBefore(X.cloneNode(p),O.firstChild);else{a.j(X);c==1&&O.insertBefore(X,O.firstChild)}X=ca}if(aa)O=aa}if(c==2){R=this.startContainer[0];if(R.nodeType==e.f&&R.nextSibling&&R.nextSibling.nodeType==e.f){R.data+=R.nextSibling.data;R.parentNode.removeChild(R.nextSibling)}R=this.endContainer[0];if(R.nodeType==e.f&&R.nextSibling&&R.nextSibling.nodeType==e.f){R.data+=R.nextSibling.data;R.parentNode.removeChild(R.nextSibling)}}else{if(W&&
R&&(!l.parent().g(W.parent())||!v.parent().g(R.parent()))){W=R.t();P&&R.parent().g(l.parent())&&W--;this.setStart(R.parent(),W)}this.collapse(p)}P&&l.j();Q&&v[0].parentNode&&v.j()},collapse:function(c){if(c){this.endContainer=this.startContainer;this.endOffset=this.startOffset}else{this.startContainer=this.endContainer;this.startOffset=this.endOffset}this.collapsed=p},clone:function(){var c=new w(this.document);c.startContainer=this.startContainer;c.startOffset=this.startOffset;c.endContainer=this.endContainer;
c.endOffset=this.endOffset;c.collapsed=this.collapsed;return c},zd:function(){var c=this.clone();c.vc();if(c.startContainer[0].nodeType!=e.e||c.endContainer[0].nodeType!=e.e)return d;var h=new j.Ia(c),l=y(p,undefined),v=u(p);c.R=function(o){return v(o)&&l(o)};c=h.next();h.reset();h=h.yb();return c&&c.g(h)?c:d},Ua:function(c,h){if(!this.collapsed){c=c||i.Mc;var l=this.clone(),v=this.startContainer,o=this.endContainer,D=this.startOffset,P=this.endOffset,O=1,Q=1;if(v&&v[0].nodeType==e.f)if(D)if(D>=v[0].nodeValue.length)l.setStartAfter(v);
else{l.setStartBefore(v);O=0}else l.setStartBefore(v);if(o&&o[0].nodeType==e.f)if(P)if(P>=o[0].nodeValue.length)l.setEndAfter(o);else{l.setEndAfter(o);Q=0}else l.setEndBefore(o);l=new k(l);l.R=function(W){W=W[0]||W;return W.nodeType==(c==i.ga?e.e:e.f)};var N;l.nc=function(W,R){W=W[0]||W;if(c==i.ga&&W.nodeType==e.f)return m;if(R&&W==N)return m;if(!R&&W.nodeType==e.e)N=W;return p};if(O)(v=l[c==i.ga?"lastForward":"next"]())&&this.V(v,h?i.Z:i.B);if(Q){l.reset();(l=l[c==i.ga?"lastBackward":"previous"]())&&
this.U(l,h?i.J:i.r)}return!!(O||Q)}},lf:function(){var c=this.startContainer;if(this.collapsed||c[0].nodeType!=e.e)return c;return c.childNodes[this.startOffset]||c},od:function(c){var h=this.startContainer,l=this.endContainer,v=this.startOffset,o=this.endOffset,D,P;if(!h||!l)return{start:0,end:0};if(c){if(h[0].nodeType==e.e)if((D=new B(h[0].childNodes[v]))&&D[0]&&D[0].nodeType==e.f&&v>0&&D[0].previousSibling.nodeType==e.f){h=D;v=0}for(;h[0].nodeType==e.f&&(P=h.sa())&&P[0].nodeType==e.f;){h=P;v+=
P[0].nodeValue.length}if(!this.collapsed){if(l[0].nodeType==e.e)if((D=new B(l[0].childNodes[o]))&&D[0]&&D[0].nodeType==e.f&&o>0&&D[0].previousSibling.nodeType==e.f){l=D;o=0}for(;l[0].nodeType==e.f&&(P=l.sa())&&P[0].nodeType==e.f;){l=P;o+=P[0].nodeValue.length}}}return{start:h.Ja(c),end:this.collapsed?d:l.Ja(c),startOffset:v,endOffset:o,Kd:c,uf:p}},O:function(c){var h,l,v,o,D=this.collapsed;h=new B("<span>",d,this.document);h.attr("_ke_bookmark",1);h.css("display","none");h.html("&nbsp;");if(c){v=
f.guid("ke_bm_");h.attr("id",v+"S")}if(!D){l=h.K();l.html("&nbsp;");c&&l.attr("id",v+"E");o=this.clone();o.collapse();o.insertNode(l)}o=this.clone();o.collapse(p);o.insertNode(h);if(l){this.setStartAfter(h);this.setEndBefore(l)}else this.H(h,i.r);return{ba:c?v+"S":h,Q:c?v+"E":l,Vd:c,collapsed:D}},H:function(c,h){this.V(c,h);this.collapse(p)},trim:function(c,h){var l=this.startContainer,v=this.startOffset,o=this.collapsed;if((!c||o)&&l[0]&&l[0].nodeType==e.f){if(v)if(v>=l[0].nodeValue.length){v=l.t()+
1;l=l.parent()}else{var D=l.ia(v);v=l.t()+1;l=l.parent();if(a.g(this.startContainer,this.endContainer))this.setEnd(D,this.endOffset-this.startOffset);else if(a.g(l,this.endContainer))this.endOffset+=1}else{v=l.t();l=l.parent()}this.setStart(l,v);if(o){this.collapse(p);return}}l=this.endContainer;v=this.endOffset;if(!(h||o)&&l[0]&&l[0].nodeType==e.f){if(v){v>=l.nodeValue.length||l.ia(v);v=l.t()+1}else v=l.t();l=l.parent();this.setEnd(l,v)}},insertNode:function(c){this.wc();this.trim(m,p);var h=this.startContainer;
h[0].insertBefore(c[0]||c,h[0].childNodes[this.startOffset]||V);a.g(c.parent(),this.endContainer)&&this.endOffset++;this.setStartBefore(c)},moveToBookmark:function(c){if(c.uf){var h=b(this.document,c.start,c.Kd),l=c.startOffset,v=c.end&&b(this.document,c.end,c.Kd);c=c.endOffset;this.setStart(h,l);v?this.setEnd(v,c):this.collapse(p)}else{h=(l=c.Vd)?f.one("#"+c.ba,this.document):c.ba;c=l?f.one("#"+c.Q,this.document):c.Q;this.setStartBefore(h);h.j();if(c&&c[0]){this.setEndBefore(c);c.j()}else this.collapse(p)}},
Aa:function(c,h){var l=this.startContainer,v=this.endContainer;l=a.g(l,v)?c&&l[0].nodeType==e.e&&this.startOffset==this.endOffset-1?new B(l[0].childNodes[this.startOffset]):l:l.Qb(v);return h&&l[0].nodeType==e.f?l.parent():l},Oa:function(c){switch(c){case i.Jb:if(this.collapsed)break;c=this.Aa();var h=new B(this.document.body),l,v,o,D,P,O=m,Q,N;Q=this.startContainer;N=this.startOffset;if(Q[0].nodeType==e.f){if(N){Q=!f.trim(Q[0].nodeValue.substring(0,N)).length&&Q;O=!!Q}if(Q)if(!(D=Q[0].previousSibling))o=
Q.parent()}else{if(N)D=Q[0].childNodes[N-1]||Q[0].lastChild;D||(o=Q)}for(;o||D;){if(o&&!D){if(!P&&a.g(o,c))P=p;if(!h.contains(o))break;if(!O||o.css("display")!="inline"){O=m;if(P)l=o;else this.setStartBefore(o)}D=o[0].previousSibling}for(;D;){Q=m;if(D.nodeType==e.f){N=D.nodeValue;if(/[^\s\ufeff]/.test(N))D=d;Q=/[\s\ufeff]$/.test(N)}else if(D.offsetWidth>0&&!D.getAttribute("_ke_bookmark"))if(O&&n.ca[D.nodeName.toLowerCase()]){N=a.text(D);if(/[^\s\ufeff]/.test(N))D=d;else for(var W=D.all||D.getElementsByTagName("*"),
R=0,X;X=W[R++];)if(!n.ca[X.nodeName.toLowerCase()]){D=d;break}if(D)Q=!!N.length}else D=d;if(Q)if(O)if(P)l=o;else o&&this.setStartBefore(o);else O=p;if(D){Q=D.previousSibling;if(!o&&!Q){o=new B(D);D=d;break}D=Q}else o=d}if(o)o=o.parent()}Q=this.endContainer;N=this.endOffset;o=D=d;P=O=m;if(Q[0].nodeType==e.f){Q=!f.trim(Q[0].nodeValue.substring(N)).length&&Q;O=!(Q&&Q[0].nodeValue.length);if(Q)if(!(D=Q[0].nextSibling))o=Q.parent()}else(D=Q[0].childNodes[N])||(o=Q);for(;o||D;){if(o&&!D){if(!P&&a.g(o,c))P=
p;if(!h.contains(o))break;if(!O||o.css("display")!="inline"){O=m;if(P)v=o;else o&&this.setEndAfter(o)}D=o[0].nextSibling}for(;D;){Q=m;if(D.nodeType==e.f){N=D.nodeValue;if(/[^\s\ufeff]/.test(N))D=d;Q=/^[\s\ufeff]/.test(N)}else if(D.offsetWidth>0&&!D.getAttribute("_ke_bookmark"))if(O&&n.ca[D.nodeName.toLowerCase()]){N=a.text(D);if(/[^\s\ufeff]/.test(N))D=d;else{W=D.all||D.getElementsByTagName("*");for(R=0;X=W[R++];)if(!n.ca[X.nodeName.toLowerCase()]){D=d;break}}if(D)Q=!!N.length}else D=d;if(Q)if(O)if(P)v=
o;else this.setEndAfter(o);if(D){Q=D.nextSibling;if(!o&&!Q){o=new B(D);D=d;break}D=Q}else o=d}if(o)o=o.parent()}if(l&&v){c=l.contains(v)?v:l;this.setStartBefore(c);this.setEndAfter(c)}break;case i.Ib:case i.Za:o=new w(this.document);h=new B(this.document.body);o.V(h,i.Z);o.setEnd(this.startContainer,this.startOffset);o=new k(o);var aa,ca,F=k.ac(c==i.Za?{bc:1}:d),K=function(E){var H=F(E);H||(aa=E);return H};l=function(E){var H=K(E);if(!H&&E[0]&&E.d()=="br")ca=E;return H};o.nc=K;o=o.Gd();aa=aa||h;this.V(aa,
aa.d()!="br"&&(!o&&this.wa()||o&&aa.contains(o))?i.Z:i.r);o=this.clone();o.collapse();o.U(h,i.J);o=new k(o);o.nc=c==i.Za?l:K;aa=d;o=o.Hd();aa=aa||h;this.U(aa,!o&&this.ka()||o&&aa.contains(o)?i.J:i.B);ca&&this.setEndAfter(ca)}},wa:function(){var c=this.startContainer,h=this.startOffset;if(h&&c[0].nodeType==e.f)if(f.trim(c[0].nodeValue.substring(0,h)).length)return m;this.trim();c=new A(this.startContainer);h=this.clone();h.collapse(p);h.V(c.w||c.D,i.Z);c=new k(h);c.R=C(p);return c.ld()},ka:function(){var c=
this.endContainer,h=this.endOffset;if(c[0].nodeType==e.f)if(f.trim(c[0].nodeValue.substring(h)).length)return m;this.trim();c=new A(this.endContainer);h=this.clone();h.collapse(m);h.U(c.w||c.D,i.J);c=new k(h);c.R=C(m);return c.md()},deleteContents:function(){this.collapsed||this.hc(0)},extractContents:function(){var c=this.document.createDocumentFragment();this.collapsed||this.hc(1,c);return c},dc:function(c,h){var l=this.clone();l[h==i.cb?"setStartAt":"setEndAt"](c,h==i.cb?i.Z:i.J);l=new k(l);l.R=
q;return l[h==i.cb?"checkBackward":"checkForward"]()},wd:function(){var c=this.startContainer,h=this.endContainer,l=this.startOffset,v=this.endOffset,o;if(c[0].nodeType==e.e){o=c[0].childNodes.length;if(o>l)c=new B(c[0].childNodes[l]);else if(o<1)c=c.ha();else{for(c=c[0];c.lastChild;)c=c.lastChild;c=new B(c);c=c.v()||c}}if(h[0].nodeType==e.e){o=h[0].childNodes.length;if(o>v)h=(new B(h[0].childNodes[v])).ha(p);else if(o<1)h=h.ha();else{for(h=h[0];h.lastChild;)h=h.lastChild;h=new B(h)}}if(c.La(h)&r.da)c=
h;return{ba:c,Q:h}},pb:function(c,h){var l=this.O(),v=new B(this.document.createElement(h));this.collapse(c);this.Oa(i.Ib);v[0].appendChild(this.extractContents());v.ib();g.ie||v.Ob();for(var o=v[0].childNodes,D=0;D<o.length;D++){var P=o[D];P.nodeType==8&&this.insertNode(new B(P))}this.insertNode(v);this.moveToBookmark(l);return v},Bc:function(c){var h=new A(this.startContainer),l=new A(this.endContainer),v=h.w,o=l.w,D=d;if(!h.D.g(l.D))return d;if(c!="br"){if(!v){v=this.pb(p,c);o=(new A(this.endContainer)).w}o||
(o=this.pb(m,c))}c=v&&this.wa();h=o&&this.ka();this.deleteContents();if(v&&a.g(v,o))if(h){D=new A(this.startContainer);this.H(o,i.r);o=d}else if(c){D=new A(this.startContainer);this.H(v,i.B);v=d}else{o=this.Cc(v);!g.ie&&!f.inArray(v.d(),["ul","ol"])&&v.Ob()}return{bh:v,$g:o,Qf:c,Pf:h,Sg:D}},Cc:function(c){if(!this.collapsed)return d;this.U(c,i.J);var h=this.extractContents(),l=c.K(m);l[0].appendChild(h);l.insertAfter(c);this.H(c,i.r);return l},tb:function(c,h){var l,v=j.m;if(v.Db[c.d()])return m;
for(;c&&c[0].nodeType==e.e;){if(l=c.Sc())this.H(c,h?i.J:i.Z);else if(v.Eb[c.d()]){this.H(c,h?i.r:i.B);return p}if((c=v.Db[c.d()]?c[h?"_4e_previous":"_4e_next"](I):c[h?"_4e_last":"_4e_first"](I))&&c[0].nodeType==e.f){this.H(c,h?i.r:i.B);return p}}return l},selectNodeContents:function(c){this.setStart(c,0);this.setEnd(c,c[0].nodeType==e.f?c[0].nodeValue.length:c[0].childNodes.length)}});var x={abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,
small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,"var":1},z=new k.Wa,J=new k.Na;j.Range=w;j.Range=w;var t=w.prototype;j.k.o(t,{updateCollapsed:t.Va,optimize:t.vc,setStartAfter:t.setStartAfter,setEndAfter:t.setEndAfter,setStartBefore:t.setStartBefore,setEndBefore:t.setEndBefore,optimizeBookmark:t.wc,setStart:t.setStart,setEnd:t.setEnd,setStartAt:t.V,setEndAt:t.U,execContentsAction:t.hc,collapse:t.collapse,clone:t.clone,getEnclosedNode:t.zd,shrink:t.Ua,getTouchedStartNode:t.lf,createBookmark2:t.od,
createBookmark:t.O,moveToPosition:t.H,trim:t.trim,insertNode:t.insertNode,moveToBookmark:t.moveToBookmark,getCommonAncestor:t.Aa,enlarge:t.Oa,checkStartOfBlock:t.wa,checkEndOfBlock:t.ka,deleteContents:t.deleteContents,extractContents:t.extractContents,checkBoundaryOfElement:t.dc,getBoundaryNodes:t.wd,fixBlock:t.pb,splitBlock:t.Bc,splitElement:t.Cc,moveToElementEditablePosition:t.tb,selectNodeContents:t.selectNodeContents})});
KISSY.Editor.add("domiterator",function(j){function w(k){if(!(arguments.length<1)){this.Ea=k;this.jc=I;this.ud=q;this.gc=I;this.c||(this.c={})}}var q=U,I=Y,C=KISSY,y=C.UA,u=j.Ia,p=j.Range,m=j.oa,d=j.n,f=j.$a,e=C.Node,i=C.DOM,r=/^[\r\n\t ]*$/;C.augment(w,{kf:function(k){var a,b,g,n,A;if(!this.c.I){b=this.Ea.clone();b.Ua(m.ga,q);b.Oa(this.jc||!this.ud?m.Za:m.Ib);var B=new u(b),s=u.Na(q,q);B.R=s;this.c.la=B.next();B=new u(b);B.R=s;B=B.yb();this.c.I=B.v(q);if(this.c.I&&this.c.I[0].nodeType==d.f&&!C.trim(this.c.I[0].nodeValue)&&
this.c.I.parent().qa()){s=new p(b.document);s.H(this.c.I,m.r);if(s.ka()){s=new f(s.endContainer);this.c.I=(s.w||s.D).v(q)}}if(!this.c.I){this.c.I=this.c.rd=new e(b.document.createTextNode(""));i.insertAfter(this.c.I[0],B[0])}b=V}s=this.c.la;B=this.c.I;for(this.c.la=V;s;){var x=I,z=s[0].nodeType!=d.e,J=I;if(z){if(s[0].nodeType==d.f)if(r.test(s[0].nodeValue))z=I}else{var t=s.d();if(s.qa(this.jc&&{bc:1})){if(t=="br")z=q;else if(!b&&!s[0].childNodes.length&&t!="hr"){a=s;g=s.g(B);break}if(b){b.U(s,m.B);
if(t!="br")this.c.la=s}x=q}else{if(s[0].firstChild){if(!b){b=new p(this.Ea.document);b.V(s,m.B)}s=new e(s[0].firstChild);continue}z=q}}if(z&&!b){b=new p(this.Ea.document);b.V(s,m.B)}g=(!x||z)&&s.g(B);if(b&&!x)for(;!s[0].nextSibling&&!g;){t=s.parent();if(t.qa(this.jc&&{bc:1})){x=q;g||t.g(B);break}s=t;z=q;g=s.g(B);J=q}z&&b.U(s,m.r);s=s.v(J,V,B);if((g=!s)||x&&b)break}if(!a){if(!b){this.c.rd&&this.c.rd.j();return this.c.la=V}a=new f(b.startContainer);s=a.D;x={Ng:1,ih:1,hh:1};a=a.w;if((!a||!a[0])&&!this.gc&&
x[s.d()]&&b.wa()&&b.ka())a=s;else if(!a||this.gc&&a.d()=="li"){a=new e(this.Ea.document.createElement(k||"p"));a[0].appendChild(b.extractContents());a.ib();b.insertNode(a);n=A=q}else if(a.d()!="li"){if(!b.wa()||!b.ka()){a=a.K(I);a[0].appendChild(b.extractContents());a.ib();A=b.Bc();n=!A.Qf;A=!A.Pf;b.insertNode(a)}}else if(!g)this.c.la=a.g(B)?V:b.wd().Q.v(q,V,B)}if(n){b=new e(a[0].previousSibling);if(b[0]&&b[0].nodeType==d.e)if(b.d()=="br")b.j();else b[0].lastChild&&i.d(b[0].lastChild)=="br"&&i.j(b[0].lastChild)}if(A){b=
u.Na(I,q);n=new e(a[0].lastChild);if(n[0]&&n[0].nodeType==d.e&&n.d()=="br")if(y.ie||n.sa(b)||n.Ka(b))n.j()}if(!this.c.la)this.c.la=g||a.g(B)?V:a.v(q,V,B);return a}});p.prototype.Ye=function(){return new w(this)}});
KISSY.Editor.add("selection",function(j){function w(x){this.document=this.document=x;this.c={M:{}};if(a){var z=this.z().createRange();if(!z||z.item&&z.item(0).ownerDocument!=x||z.parentElement&&z.parentElement().ownerDocument!=x)this.Fd=C}}function q(x){x=new w(x);return!x||x.Fd?u:x}function I(x){function z(N){return Q(N)&&N&&N[0].nodeType!=8}var J=x.document,t=new e(J.body),c=new e(J.documentElement);if(m.ie){m.Ba<8&&c.on("click",function(N){(new e(N.target)).d()==="html"&&x.getSelection().z().createRange().select()});
var h,l,v=1;c.on("mousedown",function(){v=0});c.on("mouseup",function(){v=1});t.on("focusin",function(N){if((new e(N.target)).d()=="body")if(h){try{v&&h.select()}catch(W){}h=u}});t.on("focus",function(){l=C;D()});t.on("beforedeactivate",function(N){if(!N.relatedTarget){o();v=1}});x.on("blur",function(){try{var N=document.documentElement||document.body,W=N.scrollTop,R=N.scrollLeft;J&&J.selection.empty();N.scrollTop=W;N.scrollLeft=R}catch(X){}});t.on("mousedown",function(){o()});t.on("mouseup",function(){l=
C;setTimeout(function(){D(C)},0)});var o=function(){l=y},D=function(N){if(l){var W=x.document,R=x.getSelection(),X=R&&R.Pa(),aa=R&&W.selection;if(N&&aa&&X==i.Lb)if(!W.queryCommandEnabled("InsertImage")){setTimeout(function(){D(C)},50);return}var ca;if(!(aa&&X==i.fa&&(ca=d.d(R.qb()))&&ca in{input:1,textarea:1})){h=aa&&aa.createRange();x.lb()}}};t.on("keydown",o);t.on("keyup",function(){l=C;D()});f.on(J,"selectionchange",D)}else{f.on(J,"mouseup",x.lb,x);f.on(J,"keyup",x.lb,x)}var P={table:1,pre:1},
O=/\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;|(<!--[\s\S]*?--\>))?\s*(:?<\/\1>)?(?=\s*$|<\/body>)/gi,Q=j.Ia.Wa(C);x.on("selectionChange",function(N){var W=N.path;N=(N=N.selection)&&N.F()[0];if(!(!N||!N.collapsed||W.w))if(W.D.d()=="body")if(W=N.pb(C,"p")){if(W.hb().match(O)){var R=W.Ka(z);if(R&&R[0].nodeType==k.e&&!P[R.d()]){N.tb(R);W.j()}else if((R=W.sa(z))&&R[0].nodeType==k.e&&!P[R.d()]){N.tb(R,R.hb().match(O)?y:C);W.j()}}N.select();a||x.vb()}})}j.Lc={Lb:1,fa:2,bb:3};
var C=U,y=Y,u=V,p=KISSY,m=p.UA,d=p.DOM,f=p.Event,e=p.Node,i=j.Lc,r=j.oa,k=j.n,a=!window.getSelection,b=j.Ia,g=j.Range,n={img:1,hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,thead:1,tfoot:1};p.augment(w,{z:!a?function(){var x=this.c.M;return x.tc||(x.tc=d.pa(this.document).getSelection())}:function(){var x=this.c.M;return x.tc||(x.tc=this.document.selection)},Pa:!a?function(){var x=this.c.M;if(x.type)return x.type;var z=i.fa,
J=this.z();if(J){if(J.rangeCount==1){J=J.getRangeAt(0);var t=J.startContainer;if(t==J.endContainer&&t.nodeType==k.e&&J.endOffset-J.startOffset===1&&n[t.childNodes[J.startOffset].nodeName.toLowerCase()])z=i.bb}}else z=i.Lb;return x.type=z}:function(){var x=this.c.M;if(x.type)return x.type;var z=i.Lb;try{var J=this.z(),t=J.type;if(t=="Text")z=i.fa;if(t=="Control")z=i.bb;if(J.createRange().parentElement)z=i.fa}catch(c){}return x.type=z},F:a?function(){function x(z,J){z=z.duplicate();z.collapse(J);for(var t=
z.parentElement(),c=t.childNodes,h,l=0;l<c.length;l++){var v=c[l];if(v.nodeType==k.e){h=z.duplicate();h.moveToElementText(v);v=h.compareEndPoints("StartToStart",z);var o=h.compareEndPoints("EndToStart",z);h.collapse();if(v>0)break;else if(!v||o==1&&v==-1)return{xa:t,offset:l};else if(!o)return{xa:t,offset:l+1};h=u}}if(!h){h=z.duplicate();h.moveToElementText(t);h.collapse(y)}h.setEndPoint("StartToStart",z);h=String(h.text).replace(/\r\n|\r/g,"\n").length;try{for(;h>0;)h-=c[--l].nodeValue.length}catch(D){h=
0}return h===0?{xa:t,offset:l}:{xa:c[l],offset:-h}}return function(){var z=this.c.M;if(z.na)return z.na;var J=this.z(),t=J&&J.createRange(),c=this.Pa();if(!J)return[];if(c==i.fa){J=new g(this.document);c=x(t,C);J.setStart(new e(c.xa),c.offset);c=x(t);J.setEnd(new e(c.xa),c.offset);return z.na=[J]}else if(c==i.bb){z=z.na=[];for(c=0;c<t.length;c++){var h=t.item(c),l=h.parentNode,v=0;for(J=new g(this.document);v<l.childNodes.length&&l.childNodes[v]!=h;v++);J.setStart(new e(l),v);J.setEnd(new e(l),v+
1);z.push(J)}return z}return z.na=[]}}():function(){var x=this.c.M;if(x.na)return x.na;var z=[],J=this.z();if(!J)return[];for(var t=0;t<J.rangeCount;t++){var c=J.getRangeAt(t),h=new g(this.document);h.setStart(new e(c.startContainer),c.startOffset);h.setEnd(new e(c.endContainer),c.endOffset);z.push(h)}return x.na=z},qb:function(){var x=this.c.M;if(x.Wd!==undefined)return x.Wd;var z,J=this.z();switch(this.Pa()){case i.bb:return this.mc();case i.fa:var t=this.F()[0];if(t)if(!t.collapsed){for(t.vc();C;){z=
t.startContainer;if(t.startOffset==(z[0].nodeType===k.e?z[0].childNodes.length:z[0].nodeValue.length)&&!z.qa())t.setStartAfter(z);else break}z=t.startContainer;if(z[0].nodeType!=k.e)return z.parent();z=new e(z[0].childNodes[t.startOffset]);if(!z[0]||z[0].nodeType!=k.e)return t.startContainer;for(t=z[0].firstChild;t&&t.nodeType==k.e;){z=new e(t);t=t.firstChild}return z}if(a){t=J.createRange();t.collapse(C);z=t.parentElement()}else if((z=J.anchorNode)&&z.nodeType!=k.e)z=z.parentNode}return x.Wd=z?d.C(z):
u},mc:function(){var x=this,z,J=x.c.M;if(J.Ud!==undefined)return J.Ud;if(a){z=x.z().createRange();z=z.item&&z.item(0)}z||(z=function(){for(var t=x.F()[0],c,h,l=2;l&&!((c=t.zd())&&c[0].nodeType==k.e&&n[c.d()]&&(h=c));l--)t.Ua(r.ga);return h&&h[0]}());return J.Ud=d.C(z)},reset:function(){this.c.M={}},Ac:function(x){var z,J=this.document;if(a)try{z=J.body.createControlRange();z.addElement(x[0]);z.select()}catch(t){z=J.body.createTextRange();z.moveToElementText(x[0]);z.select()}finally{}else{z=J.createRange();
z.selectNode(x[0]);x=this.z();x.removeAllRanges();x.addRange(z)}this.reset()},Bb:function(x){if(a){if(x.length>1){var z=x[x.length-1];x[0].setEnd(z.endContainer,z.endOffset);x.length=1}x[0]&&x[0].select()}else{z=this.z();if(!z)return;z.removeAllRanges();for(var J=0;J<x.length;J++){var t=x[J],c=this.document.createRange(),h=t.startContainer;t.collapsed&&m.gecko&&m.gecko<1.09&&h[0].nodeType==k.e&&!h[0].childNodes.length&&h[0].appendChild(this.document.createTextNode(""));c.setStart(h[0],t.startOffset);
c.setEnd(t.endContainer[0],t.endOffset);z.addRange(c)}}this.reset()},Xe:function(x){for(var z=[],J=this.F(),t=0;t<J.length;t++)z.push(J[t].od(x));return z},We:function(x,z){var J=[],t=this.document,c;z=z||this.F();for(var h=z.length,l=0;l<h;l++){J.push(c=z[l].O(x,C));var v=(x=c.Vd)?p.one("#"+c.ba,t):c.ba;c=x?p.one("#"+c.Q,t):c.Q;for(var o=l+1;o<h;o++){var D=z[o],P=D.startContainer,O=D.endContainer;d.g(P,v.parent())&&D.startOffset++;d.g(P,c.parent())&&D.startOffset++;d.g(O,v.parent())&&D.endOffset++;
d.g(O,c.parent())&&D.endOffset++}}return J},Td:function(x){for(var z=[],J=0;J<x.length;J++){var t=new g(this.document);t.moveToBookmark(x[J]);z.push(t)}this.Bb(z);return this},Aa:function(){var x=this.F();return x[0].startContainer.Qb(x[x.length-1].endContainer)},scrollIntoView:function(){var x=this.qb();x&&x.Vb()},removeAllRanges:function(){var x=this.z();if(a)x&&x.clear();else x&&x.removeAllRanges()}});var A={table:1,tbody:1,tr:1},B=b.Wa(C),s=/\ufeff|\u00a0/;g.prototype.select=g.prototype.select=
!a?function(){var x=this.startContainer;this.collapsed&&x[0].nodeType==k.e&&!x[0].childNodes.length&&x[0].appendChild(this.document.createTextNode(""));var z=this.document.createRange();z.setStart(x[0],this.startOffset);try{z.setEnd(this.endContainer[0],this.endOffset)}catch(J){if(J.toString().indexOf("NS_ERROR_ILLEGAL_VALUE")>=0){this.collapse(C);z.setEnd(this.endContainer[0],this.endOffset)}else throw J;}x=q(this.document).z();x.removeAllRanges();x.addRange(z)}:function(x){var z=this.collapsed,
J,t;if(this.startContainer[0]===this.endContainer[0]&&this.endOffset-this.startOffset==1){var c=this.startContainer[0].childNodes[this.startOffset];if(c.nodeType==k.e){(new w(this.document)).Ac(new e(c));return}}if(this.startContainer[0].nodeType==k.e&&this.startContainer.d()in A||this.endContainer[0].nodeType==k.e&&this.endContainer.d()in A)this.Ua(r.ga,C);var h=this.O();c=h.ba;var l;if(!z)l=h.Q;h=this.document.body.createTextRange();h.moveToElementText(c[0]);h.moveStart("character",1);if(l){x=this.document.body.createTextRange();
x.moveToElementText(l[0]);h.setEndPoint("EndToEnd",x);h.moveEnd("character",-1)}else{for(J=c[0].nextSibling;J&&!B(J);)J=J.nextSibling;J=!(J&&J.nodeValue&&J.nodeValue.match(s))&&(x||!c[0].previousSibling||c[0].previousSibling&&d.d(c[0].previousSibling)=="br");t=new e(this.document.createElement("span"));t.html("&#65279;");t.insertBefore(c);J&&d.insertBefore(this.document.createTextNode("\ufeff"),c)}this.setStartBefore(c);c.j();if(z){if(J){h.moveStart("character",-1);h.select();this.document.selection.clear()}else h.select();
if(t){this.H(t,r.B);t.j()}}else{this.setEndBefore(l);l.j();h.select()}};w.getSelection=q;j.Oc=w;j.Selection=w;b=w.prototype;j.k.o(b,{getNative:b.z,getType:b.Pa,getRanges:b.F,getStartElement:b.qb,getSelectedElement:b.mc,reset:b.reset,selectElement:b.Ac,selectRanges:b.Bb,createBookmarks2:b.Xe,createBookmarks:b.We,getCommonAncestor:b.Aa,scrollIntoView:b.scrollIntoView,selectBookmarks:b.Td,removeAllRanges:b.removeAllRanges});j.on("instanceCreated",function(x){I(x.bf)})});
KISSY.Editor.add("styles",function(j){function w(F){return!F.attr("_ke_bookmark")}function q(F,K){for(var E in F)if(F.hasOwnProperty(E))if(J.isString(F[E]))F[E]=F[E].replace(aa,function(H,G){return K[G]});else q(F[E],K)}function I(F,K){if(K){F=J.clone(F);q(F,K)}var E=this.element=this.element=(F.element||"*").toLowerCase();this.type=this.type=E=="#"||W[E]?h.Mb:R[E]?h.db:h.Ha;this.c={definition:F}}function C(F,K){var E=K?this.zc:this.Xb;F.body.focus();for(var H=new v(F),G=H.F(),M=0;M<G.length;M++)E.call(this,
G[M]);H.Bb(G)}function y(F,K,E){var H=F.element;if(H=="*")H="span";K=new O(K.createElement(H));E&&E.Rc(K);return u(K,F)}function u(F,K){var E=K.c.definition,H=E.attributes;E=I.Ad(E);if(H)for(var G in H)F.attr(G,H[G]);if(E)F[0].style.cssText=E;return F}function p(F){var K=F.O(s),E=F.Ye();E.gc=s;E.ud=s;for(var H,G=F.document;H=E.kf();){var M=y(this,G,H);H=H;var L=M;M=L.d=="pre";var S=H.d=="pre",T=!M&&S;if(M&&!S){S=H;L=L;T=S.html();T=m(T,/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,"");T=T.replace(/[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi,
"$1");T=T.replace(/([ \t\n\r]+|&nbsp;)/g," ");T=T.replace(/<br\b[^>]*>/gi,"\n");if(Q.ie){S=S[0].ownerDocument.createElement("div");S.appendChild(L[0]);L[0].outerHTML="<pre>"+T+"</pre>";L=new O(S.firstChild);L.j()}else L.html(T);L=L}else if(T)L=f(d(H),L);else H.Tb(L);H[0].parentNode.replaceChild(L[0],H[0]);if(M){H=L;M=void 0;if((M=H.ha(s,o.e))&&M.d()=="pre"){L=m(M.html(),/\n$/,"")+"\n\n"+m(H.html(),/^\n/,"");if(Q.ie)H[0].outerHTML="<pre>"+L+"</pre>";else H.html(L);M.j()}}}F.moveToBookmark(K)}function m(F,
K,E){var H="",G="";F=F.replace(/(^<span[^>]+_ke_bookmark.*?\/span>)|(<span[^>]+_ke_bookmark.*?\/span>$)/gi,function(M,L,S){L&&(H=L);S&&(G=S);return""});return H+F.replace(K,E)+G}function d(F){var K=[];m(F.hb(),/(\S\s*)\n(?:\s|(<span[^>]+_ck_bookmark.*?\/span>))*\n(?!$)/gi,function(E,H,G){return H+"</pre>"+G+"<pre>"}).replace(/<pre\b.*?>([\s\S]*?)<\/pre>/gi,function(E,H){K.push(H)});return K}function f(F,K){for(var E=K[0].ownerDocument.createDocumentFragment(),H=0;H<F.length;H++){var G=F[H];G=G.replace(/(\r\n|\r)/g,
"\n");G=m(G,/^[ \t]*\n/,"");G=m(G,/\n$/,"");G=m(G,/^[ \t]+|[ \t]+$/g,function(L,S){return L.length==1?"&nbsp;":S?" "+Array(L.length).join("&nbsp;"):Array(L.length).join("&nbsp;")+" "});G=G.replace(/\n/g,"<br>");G=G.replace(/[ \t]{2,}/g,function(L){return Array(L.length).join("&nbsp;")+" "});var M=K.K();M.html(G);E.appendChild(M[0])}return E}function e(F){var K=F.document;if(F.collapsed){K=y(this,K,undefined);F.insertNode(K);F.H(K,l.J)}else{var E=this.element,H=this.c.definition,G,M=j.m[E]||(G=s,j.m.span),
L=F.O();F.Oa(l.Jb);F.trim();var S=F.O(),T=S.ba;S=S.Q;for(var $=T,da;$&&$[0];){var Z=x;if(c.g($,S)){$=z;Z=s}else{var ba=$[0].nodeType,fa=ba==o.e?$.d():z;if(fa&&$.attr("_ke_bookmark")){$=$.v(s);continue}if(!fa||M[fa]&&($.La(S)|D.aa|D.ea|D.$)==D.aa+D.ea+D.$&&(!H.childRule||H.childRule($))){var ha=$.parent();if(ha&&ha[0]&&((j.m[ha.d()]||j.m.span)[E]||G)&&(!H.parentRule||H.parentRule(ha))){if(!da&&(!fa||!j.m.ca[fa]||($.La(S)|D.aa|D.ea|D.$)==D.aa+D.ea+D.$)){da=new P(K);da.setStartBefore($)}if(ba==o.f||
ba==o.e&&!$[0].childNodes.length){ba=$;for(var ga;(Z=!ba.Ka(w))&&(ga=ba.parent(),M[ga.d()])&&(ga.La(T)|D.da|D.ea|D.$)==D.da+D.ea+D.$&&(!H.childRule||H.childRule(ga));)ba=ga;da.setEndAfter(ba)}}else Z=s}else Z=s;$=$.v()}if(Z&&da&&!da.collapsed){Z=y(this,K,undefined);ba=da.Aa();fa={Lf:{},Ne:{},hd:{},gd:{}};for(var ea,ia,ja;Z&&ba&&Z[0]&&ba[0];){if(ba.d()==E){for(ea in H.attributes)if(!(fa.gd[ea]||!(ja=ba.attr(ia))))if(Z.attr(ea)==ja)Z.removeAttr(ea);else fa.gd[ea]=1;for(ia in H.styles)if(!(fa.hd[ia]||
!(ja=ba.L(ia))))if(Z.L(ia)==ja)Z.L(ia,"");else fa.hd[ia]=1;if(!Z.gb()){Z=z;break}}ba=ba.parent()}if(Z){Z[0].appendChild(da.extractContents());n(this,Z);da.insertNode(Z);Z.ra();Q.ie||Z[0].normalize()}else{Z=new O(K.createElement("span"));Z[0].appendChild(da.extractContents());da.insertNode(Z);n(this,Z);Z.j(U)}da=z}}T.j();S.j();F.moveToBookmark(L);F.Ua(l.Mc)}}function i(F){F.Oa(l.Jb);var K=F.O(),E=K.ba;if(F.collapsed){for(var H=new N(E.parent()),G,M=0,L;M<H.elements.length&&(L=H.elements[M]);M++){if(L==
H.w||L==H.D)break;if(this.ja(L)){var S=F.dc(L,l.de),T=!S&&F.dc(L,l.cb);if(T||S){G=L;G.match=T?"start":"end"}else{L.ra();if(L.d()!=this.element){S=a(this);A(L,S[L.d()]||S["*"])}else b(this,L)}}}if(G&&G[0]){L=E;for(M=0;;M++){S=H.elements[M];if(c.g(S,G))break;else if(S.match)continue;else S=S.K();S[0].appendChild(L[0]);L=S}c[G.match=="start"?"insertBefore":"insertAfter"](L,G)}}else{var $=K.Q,da=this;H=function(){for(var Z=new N(E.parent()),ba=new N($.parent()),fa=z,ha=z,ga=0;ga<Z.elements.length;ga++){var ea=
Z.elements[ga];if(ea==Z.w||ea==Z.D)break;if(da.ja(ea))fa=ea}for(ga=0;ga<ba.elements.length;ga++){ea=ba.elements[ga];if(ea==ba.w||ea==ba.D)break;if(da.ja(ea))ha=ea}ha&&$.Pb(ha);fa&&E.Pb(fa)};H();for(G=new O(E[0].nextSibling);G[0]!==$[0];){M=G.v();if(G[0]&&G[0].nodeType==o.e&&this.ja(G)){if(G.d()==this.element)b(this,G);else{L=a(this);A(G,L[G.d()]||L["*"])}if(M[0].nodeType==o.e&&M.contains(E)){H();M=new O(E[0].nextSibling)}}G=M}}F.moveToBookmark(K)}function r(F){F=String(F);var K={};F.replace(/&quot;/g,
'"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,function(E,H,G){K[H]=G});return K}function k(F,K){var E="";if(K!==x){E=document.createElement("span");E.style.cssText=F;E=E.style.cssText||""}else E=F;return E.replace(/\s*([;:])\s*/,"$1").replace(/([^\s;])$/,"$1;").replace(/,\s+/g,",").toLowerCase()}function a(F){if(F.c.Sd)return F.c.Sd;var K=F.c.Sd={},E=F.c.definition.overrides;if(E){J.isArray(E)||(E=[E]);for(var H=0;H<E.length;H++){var G=E[H],M,L,S;if(typeof G=="string")M=G.toLowerCase();else{M=
G.element?G.element.toLowerCase():F.element;L=G.attributes;S=G.styles}G=K[M]||(K[M]={});if(L){M=G.attributes=G.attributes||[];for(var T in L)L.hasOwnProperty(T)&&M.push([T.toLowerCase(),L[T]])}if(S){G=G.styles=G.styles||[];for(var $ in S)S.hasOwnProperty($)&&G.push([$.toLowerCase(),S[$]])}}}return K}function b(F,K){var E=F.c.definition,H=a(F),G=t.mix(E.attributes,(H[K.d()]||H["*"]||{}).attributes);E=t.mix(E.styles,(H[K.d()]||H["*"]||{}).styles);H=J.isEmptyObject(G)&&J.isEmptyObject(E);for(var M in G)if(G.hasOwnProperty(M))if(!((M==
"class"||F.c.definition.fullMatch)&&K.attr(M)!=g(M,G[M]))){H=H||!!K.fb(M);K.removeAttr(M)}for(var L in E)if(E.hasOwnProperty(L))if(!(F.c.definition.fullMatch&&K.L(L)!=g(L,E[L],s))){H=H||!!K.L(L);K.L(L,"")}B(K)}function g(F,K,E){var H=new O("<span>");H[E?"_4e_style":"attr"](F,K);return H[E?"_4e_style":"attr"](F)}function n(F,K){for(var E=a(F),H=K.all(F.element),G=H.length;--G>=0;)b(F,new O(H[G]));for(var M in E)if(M!=F.element){H=K.all(M);for(G=H.length-1;G>=0;G--){var L=new O(H[G]);A(L,E[M])}}}function A(F,
K){var E,H=K&&K.attributes;if(H)for(E=0;E<H.length;E++){var G=H[E][0],M;if(M=F.attr(G)){var L=H[E][1];if(L===z||L.test&&L.test(M)||typeof L=="string"&&M==L)F[0].removeAttribute(G)}}if(H=K&&K.styles)for(E=0;E<H.length;E++){G=H[E][0];if(L=F.css(G)){var S=H[E][1];if(S===z||S.test&&S.test(M)||typeof S=="string"&&L==S)F.css(G,"")}}B(F)}function B(F){if(!F.gb()){var K=F[0].firstChild,E=F[0].lastChild;F.j(s);if(K){K.nodeType==o.e&&c.ra(K);E&&K!=E&&E.nodeType==o.e&&c.ra(E)}}}var s=U,x=Y,z=V,J=KISSY,t=j.k,
c=J.DOM,h={Mb:1,Ha:2,db:3},l=j.oa,v=j.Oc,o=j.n,D=j.ab,P=j.Range,O=J.Node,Q=J.UA,N=j.$a,W={address:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1},R={embed:1,hr:1,img:1,li:1,object:1,ol:1,table:1,td:1,tr:1,th:1,ul:1,dl:1,dt:1,dd:1,form:1},X=/\s*(?:;\s*|$)/g,aa=/#\((.+?)\)/g;j.lg=h;I.prototype={apply:function(F){C.call(this,F,x)},remove:function(F){C.call(this,F,s)},Xb:function(F){return(this.Xb=this.type==h.Ha?e:this.type==h.Mb?p:this.type==h.db?z:z).call(this,F)},zc:function(F){return(this.zc=this.type==
h.Ha?i:z).call(this,F)},Ke:function(F){u(F,this)},ja:function(F,K){if(!F)return x;var E=this.c.definition,H;if(F.d()==this.element){if(!K&&!F.gb())return s;var G=E.re;if(G)E=G;else{G={};var M=0,L=E.attributes;if(L)for(var S in L){M++;G[S]=L[S]}if(L=I.Ad(E)){G.style||M++;G.style=L}G._length=M;E=E.re=G}if(E._length){for(var T in E)if(T!="_length"){M=F.attr(T)||"";if(T=="style")a:{G=E[T];M=k(M,x);typeof G=="string"&&(G=r(G));typeof M=="string"&&(M=r(M));L=void 0;for(L in G)if(!(L in M&&(M[L]==G[L]||
G[L]=="inherit"||M[L]=="inherit"))){G=x;break a}G=s}else G=E[T]==M;if(G){if(!K)return s}else if(K)return x}if(K)return s}else return s}T=a(this);if(T=T[F.d()]||T["*"]){if(!(E=T.attributes)&&!(H=T.Lf))return s;if(E)for(G=0;G<E.length;G++){T=E[G][0];if(T=F.attr(T)){M=E[G][1];if(M===z||typeof M=="string"&&T==M||M.test&&M.test(T))return s}}if(H)for(G=0;G<H.length;G++)if(T=F.css(H[G][0])){E=H[G][1];if(E===z||typeof E=="string"&&T==E||E.test&&E.test(T))return s}}return x},Se:function(F){switch(this.type){case h.Mb:return this.ja(F.w||
F.D,s);case h.db:case h.Ha:for(var K=F.elements,E=0,H;E<K.length;E++){H=K[E];if(!(this.type==h.Ha&&(c.g(H,F.w)||c.g(H,F.D))))if(!(this.type==h.db&&!(H.d()in R)))if(this.ja(H,s))return s}}return x}};I.Ad=function(F){var K=F.se;if(K)return K;K=F.styles;var E=F.attributes&&F.attributes.style||"",H="";if(E.length)E=E.replace(X,";");for(var G in K){var M=K[G],L=(G+":"+M).replace(X,";");if(M=="inherit")H+=L;else E+=L}if(E.length)E=k(E);E+=H;return F.se=E};j.mg=I;j.Style=I;var ca=I.prototype;j.k.o(ca,{apply:ca.apply,
remove:ca.remove,applyToRange:ca.Xb,removeFromRange:ca.zc,applyToObject:ca.Ke,checkElementRemovable:ca.ja,checkActive:ca.Se})});
KISSY.Editor.add("htmlparser",function(){function j(){}function w(){this.c={Dd:RegExp("<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)--\>)|(?:([^\\s>]+)\\s*((?:(?:[^\"'>]+)|(?:\"[^\"]*\")|(?:'[^']*'))*)\\/?>))","g")}}var q=KISSY,I=q.Editor,C=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,y={checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1},u=I.m;q.augment(w,{Da:j,Rd:j,ma:j,Nd:j,Sa:j,parse:function(p){for(var m,
d,f=0,e;m=this.c.Dd.exec(p);){d=m.index;if(d>f){f=p.substring(f,d);e?e.push(f):this.ma(f)}f=this.c.Dd.lastIndex;if(d=m[1]){d=d.toLowerCase();if(e&&u.Fc[d]){this.Nd(e.join(""));e=V}if(!e){this.Rd(d);continue}}if(e)e.push(m[0]);else if(d=m[3]){d=d.toLowerCase();if(!/="/.test(d)){var i={},r;m=m[4];var k=!!(m&&m.charAt(m.length-1)=="/");if(m)for(;r=C.exec(m);){var a=r[1].toLowerCase();r=r[2]||r[3]||r[4]||"";i[a]=!r&&y[a]?a:r}this.Da(d,i,k);if(!e&&u.Fc[d])e=[]}}else if(d=m[2])this.Sa(d)}p.length>f&&this.ma(p.substring(f,
p.length))}});I.h=w;I.HtmlParser=w});
KISSY.Editor.add("htmlparser-basicwriter",function(){function j(){this.c={l:[]}}var w=KISSY,q=w.Editor,I=q.k;w.augment(j,{wb:function(C){this.c.l.push("<",C)},xb:function(C,y){y?this.c.l.push(" />"):this.c.l.push(">")},mb:function(C,y){if(typeof y=="string")y=I.pc(y);this.c.l.push(" ",C,'="',y,'"')},nb:function(C){this.c.l.push("</",C,">")},text:function(C){this.c.l.push(C)},N:function(C){this.c.l.push("<!--",C,"--\>")},write:function(C){this.c.l.push(C)},reset:function(){this.c.l=[];this.c.A=Y},
kc:function(C){var y=this.c.l.join("");C&&this.reset();return y}});q.h.Hb=j;q.h.BasicWriter=j;w=j.prototype;q.k.o(w,{openTag:w.wb,openTagClose:w.xb,attribute:w.mb,closeTag:w.nb,text:w.text,comment:w.N,write:w.write,reset:w.reset,getHtml:w.kc})});
KISSY.Editor.add("htmlparser-htmlwriter",function(){function j(){j.superclass.constructor.call(this);this.Ed="\t";this.Gf=" />";this.xf="\n";this.ff=y;this.Hf=C;this.c.A=y;this.c.G="";this.c.rules={};var u=q.m,p;for(p in I.mix({},u.Gb,u.Ya,u.Fb,u.Ic))this.Fa(p,{A:C,Pe:C,cc:C,jd:!u[p]["#"],Oe:C});this.Fa("br",{cc:C});this.Fa("title",{A:y,cc:y});this.Fa("style",{A:y,jd:C});this.Fa("pre",{A:y})}var w=KISSY,q=w.Editor,I=q.k,C=U,y=Y;w.extend(j,q.h.Hb,{wb:function(u){var p=this.c.rules[u];if(this.c.A)this.G();
else if(p&&p.Pe){this.Qa();this.G()}this.c.l.push("<",u)},xb:function(u,p){var m=this.c.rules[u];if(p)this.c.l.push(this.Gf);else{this.c.l.push(">");if(m&&m.A)this.c.G+=this.Ed}m&&m.cc&&this.Qa()},mb:function(u,p){if(typeof p=="string"){this.ff&&(p=p.replace(/&amp;/g,"&"));p=I.pc(p)}this.c.l.push(" ",u,'="',p,'"')},nb:function(u){var p=this.c.rules[u];if(p&&p.A)this.c.G=this.c.G.substr(this.Ed.length);if(this.c.A)this.G();else if(p&&p.jd){this.Qa();this.G()}this.c.l.push("</",u,">");p&&p.Oe&&this.Qa()},
text:function(u){if(this.c.A){this.G();u=I.Ra(u)}this.c.l.push(u)},N:function(u){this.c.A&&this.G();this.c.l.push("<!--",u,"--\>")},Qa:function(){this.c.l.length>0&&this.c.l.push(this.xf);this.c.A=C},G:function(){this.c.l.push(this.c.G);this.c.A=y},Fa:function(u,p){var m=this.c.rules[u];if(m)I.mix(m,p);else this.c.rules[u]=p}});q.h.$f=j;q.h.HtmlWriter=j;w=j.prototype;q.k.o(w,{openTag:w.wb,openTagClose:w.xb,attribute:w.mb,closeTag:w.nb,text:w.text,comment:w.N,lineBreak:w.Qa,indentation:w.G,setRules:w.Fa})});
KISSY.Editor.add("htmlparser-fragment",function(){function j(){this.children=[];this.parent=I;this.c={S:w,oc:q}}var w=U,q=Y,I=V,C=KISSY.Editor,y={colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1},u=KISSY,p=C.k,m=C.n,d=C.m;p.mix({table:1,ul:1,ol:1,dl:1},d.table,d.ul,d.ol,d.dl);var f=d.$d,e=d.Fb;j.Kb=function(i,r){function k(c){var h;if(A.length>0)for(var l=0;l<A.length;l++){var v=A[l],o=v.name,D=d[o],P=s.name&&d[s.name];if((!P||P[o])&&(!c||!D||D[c]||!d[c])){if(!h){a();h=1}v=v.clone();
v.parent=s;s=v;A.splice(l,1);l--}}}function a(){for(;B.length;)s.add(B.shift())}function b(c,h,l){h=h||s||n;if(r&&!h.type){var v,o;if((v=c.attributes&&(o=c.attributes._ke_real_element_type)?o:c.name)&&!(v in d.Ec)&&!(v in d.Gb)){o=s;s=h;g.Da({Yg:"ul",Pg:"dl",Kg:"dl"}[v]||r,{});h=s;if(l)s=o}}if(c.c.S&&c.name!="pre"){l=c.children.length;if((v=c.children[l-1])&&v.type==m.f)if(o=p.Ta(v.value))v.value=o;else c.children.length=l-1}h.add(c);if(c.zb){s=c.zb;delete c.zb}}var g=new C.h,n=new j,A=[],B=[],s=
n,x=q,z;g.Da=function(c,h,l){var v=new C.h.Jc(c,h);if(v.rc&&l)v.sb=w;if(d.ca[c])A.push(v);else{if(c==="pre")x=w;else if(c==="br"&&x){s.add(new C.h.Nb("\n"));return}if(c==="br")B.push(v);else{var o=s.name,D=o&&(d[o]||(s.c.S?d.div:d.span));if(D&&!v.rc&&!s.rc&&!D[c]){D=q;var P;if(c in f&&o in f){o=s.children;(o=o[o.length-1])&&o.name in e||b(o=new C.h.Jc("li"),s);z=s;P=o}else if(c==o)b(s,s.parent);else{b(s,s.parent,w);!y[o]&&o in d.Eb&&A.unshift(s);D=w}s=P?P:s.zb||s.parent;if(D){g.Da.apply(this,arguments);
return}}k(c);a();v.parent=s;v.zb=z;z=0;if(v.sb)b(v);else s=v}}};g.Rd=function(c){for(var h=A.length-1;h>=0;h--)if(c==A[h].name){A.splice(h,1);return}for(var l=[],v=[],o=s;o.type&&o.name!=c;){o.c.S||v.unshift(o);l.push(o);o=o.parent}if(o.type){for(h=0;h<l.length;h++){var D=l[h];b(D,D.parent)}s=o;if(s.name=="pre")x=q;o.c.S&&a();b(o,o.parent);if(o==s)s=s.parent;A=A.concat(v)}if(c=="body")r=q};g.ma=function(c){if(!s.c.oc&&!x){c=p.Ra(c);if(c.length===0)return}a();k();if(r&&(!s.type||s.name=="body")&&p.trim(c))this.Da(r,
{});x||(c=c.replace(/[\t\r\n ]{2,}|[\t\r\n]/g," "));s.add(new C.h.Nb(c))};g.Nd=function(c){s.add(new C.h.kd(c))};g.Sa=function(c){s.add(new C.h.be(c))};g.parse(i);for(a();s.type;){var J=s.parent,t=s;if(r&&(!J.type||J.name=="body")&&!d.Ec[t.name]){s=J;g.Da(r,{});J=s}J.add(t);s=J}return n};u.augment(j,{add:function(i){var r=this.children.length;if(r=r>0&&this.children[r-1]||I){if(i.c.S&&r.type==m.f){r.value=p.Ta(r.value);if(r.value.length===0){this.children.pop();this.add(i);return}}r.next=i}i.yb=r;
i.parent=this;this.children.push(i);this.c.oc=i.type==m.f||i.type==m.e&&!i.c.S},Y:function(i,r){var k;this.filterChildren=this.ic=function(){var a=new C.h.Hb;this.X.call(this,a,r,w);a=a.kc();this.children=(new j.Kb(a)).children;k=1};!this.name&&r&&r.Pd(this);this.X(i,k?I:r)},X:function(i,r){for(var k=0;k<this.children.length;k++)this.children[k].Y(i,r)}});C.h.Ga=j;C.h.Fragment=j;j.FromHtml=j.Kb;u=j.prototype;C.k.o(u,{add:u.add,writeHtml:u.Y,writeChildrenHtml:u.X})});
KISSY.Editor.add("htmlparser-element",function(){function j(y,u){y=y[0];u=u[0];return y<u?-1:y>u?1:0}function w(y,u){this.name=y;this.attributes=u||(u={});this.children=[];var p=u.sg||y,m=q.m;p=!!(m.Gb[p]||m.Ya[p]||m.Fb[p]||m.Ic[p]||m.Hc[p]||p=="br");var d=!!m.Db[y];this.sb=d;this.rc=!m[y];this.c={S:p,oc:d||!p}}var q=KISSY.Editor,I=q.n;KISSY.augment(w,{type:I.e,add:q.h.Ga.prototype.add,clone:function(){return new w(this.name,this.attributes)},Y:function(y,u){var p=this.attributes,m=this,d=m.name,
f,e,i,r;m.ic=function(){if(!r){var b=new q.h.Hb;q.h.Ga.prototype.X.call(m,b,u);m.children=(new q.h.Ga.Kb(b.kc())).children;r=1}};m.filterChildren=m.ic;if(u){for(;;){if(!(d=u.Od(d)))return;m.name=d;if(!(m=u.uc(m)))return;m.parent=this.parent;if(m.name==d)break;if(m.type!=I.e){m.Y(y,u);return}d=m.name;if(!d){this.X.call(m,y,r?V:u);return}}p=m.attributes}y.wb(d,p);for(var k=[],a=0;a<2;a++)for(f in p){e=f;i=p[f];if(a==1)k.push([f,i]);else if(u){for(;;)if(e=u.Md(f))if(e!=f){delete p[f];f=e}else break;
else{delete p[f];break}if(e)if((i=u.Ld(m,e,i))===Y)delete p[e];else p[e]=i}}y.Hf&&k.sort(j);p=k.length;for(a=0;a<p;a++){f=k[a];y.mb(f[0],f[1])}y.xb(d,m.sb);if(!m.sb){this.X.call(m,y,r?V:u);y.nb(d)}},X:function(){q.h.Ga.prototype.X.apply(this,arguments)}});q.h.Jc=w;q.h.Element=w;var C=w.prototype;q.k.o(C,{type:C.type,add:C.add,clone:C.clone,writeHtml:C.Y,writeChildrenHtml:C.X})});
KISSY.Editor.add("htmlparser-filter",function(){function j(f){this.c={fc:[],Zb:[],elements:{Gc:0},attributes:{Gc:0}};f&&this.fd(f,10)}function w(f,e){for(var i=0;f&&i<e.length;i++){var r=e[i];f=f.replace(r[0],r[1])}return f}function q(f,e,i){if(typeof e=="function")e=[e];var r,k;k=f.length;var a=e&&e.length;if(a){for(r=0;r<k&&f[r].yc<i;r++);for(k=a-1;k>=0;k--)if(a=e[k]){a.yc=i;f.splice(r,0,a)}}}function I(f,e,i){if(e)for(var r in e){var k=f[r];f[r]=C(k,e[r],i);k||f.Gc++}}function C(f,e,i){if(e){e.yc=
i;if(f){if(f.splice)q(f,e,i);else{f=f.yc>i?[e,f]:[f,e];f.filter=y}return f}else return e.filter=e}}function y(f){for(var e=f.type||f instanceof p.h.Ga,i=0;i<this.length;i++){if(e)var r=f.type,k=f.name;var a=this[i].apply(window,arguments);if(a===d)return a;if(e){if(a&&(a.name!=k||a.type!=r))return a}else if(typeof a!="string")return a;a!=undefined&&(f=a)}return f}var u=KISSY,p=u.Editor,m=p.n,d=Y;u.augment(j,{fd:function(f,e){if(typeof e!="number")e=10;q(this.c.fc,f.fc,e);q(this.c.Zb,f.Zb,e);I(this.c.elements,
f.elements,e);I(this.c.attributes,f.attributes,e);this.c.text=C(this.c.text,f.text,e)||this.c.text;this.c.N=C(this.c.N,f.N,e)||this.c.N;this.c.Ab=C(this.c.Ab,f.Ab,e)||this.c.Ab},Od:function(f){return w(f,this.c.fc)},Md:function(f){return w(f,this.c.Zb)},ma:function(f){var e=this.c.text;return e?e.filter(f):f},Sa:function(f,e){var i=this.c.N;return i?i.filter(f,e):f},Pd:function(f){var e=this.c.Ab;return e?e.filter(f):f},uc:function(f){for(var e=[this.c.elements["^"],this.c.elements[f.name],this.c.elements.Rf],
i,r=0;r<3;r++)if(i=e[r]){i=i.filter(f,this);if(i===d)return V;if(i&&i!=f)return this.Qd(i);if(f.parent&&!f.name)break}return f},Qd:function(f){var e=f.type;return e==m.e?this.uc(f):e==m.f?new p.h.Nb(this.ma(f.value)):V},Ld:function(f,e,i){if(e=this.c.attributes[e]){f=e.filter(i,f,this);if(f===d)return d;if(typeof f!="undefined")return f}return i}});p.h.Zf=j;u=j.prototype;p.k.o(u,{addRules:u.fd,onElementName:u.Od,onAttributeName:u.Md,onText:u.ma,onComment:u.Sa,onFragment:u.Pd,onElement:u.uc,onNode:u.Qd,
onAttribute:u.Ld});p.h.Filter=j});KISSY.Editor.add("htmlparser-text",function(){function j(C){this.value=C;this.c={S:I}}var w=KISSY,q=w.Editor,I=Y;w.augment(j,{type:q.n.f,Y:function(C,y){var u=this.value;y&&!(u=y.ma(u,this))||C.text(u)}});q.h.Nb=j;q.h.Text=j});KISSY.Editor.add("htmlparser-cdata",function(j){j.h.kd=function(w){this.value=w};j.h.kd.prototype={type:j.n.f,Y:function(w){w.write(this.value)}}});
KISSY.Editor.add("htmlparser-comment",function(){function j(I){this.value=I;this.c={S:Y}}var w=KISSY.Editor,q=w.n;w.h.be=j;w.h.Comment=j;j.prototype={constructor:j,type:q.ee,Y:function(I,C){var y=this.value;if(C){if(!(y=C.Sa(y,this)))return;if(typeof y!="string"){y.parent=this.parent;y.Y(I,C);return}}I.N(y)}}});
KISSY.Editor.add("button",function(){var j=KISSY,w=j.Editor;if(w.ke)j.log("TripleButton attach twice","warn");else{j=j.UIBase.create([j.UIBase.Box.Render||j.UIBase.Box],{Fg:function(){var q=this,I=q.get("el");I.on("click",q.ue,q);I.on("mousedown",function(){q.get("state")=="off"&&I.addClass("ke-triplebutton-active")});I.on("mouseup mouseleave",function(){q.get("state")=="off"&&I.hasClass("ke-triplebutton-active")&&setTimeout(function(){I.removeClass("ke-triplebutton-active")},300)})},zg:function(){this.get("el").attr("title",
this.get("title"))},wg:function(q){var I=this.get("el");if(q!==undefined){I.html("<span class='ke-toolbar-item "+q+"'>");I.ta()}},yg:function(q){var I=this.get("el");q!==undefined&&I.html(q)},xg:function(q){this["_"+q]()},qd:function(){this.Ce=this.get("state");this.set("state","disabled")},sd:function(){this.get("state")=="disabled"&&this.set("state",this.Ce)},ue:function(q){this.fire(this.get("state")+"Click",{og:q});this.fire("click",{ng:this.get("state")+"Click"});q&&q.preventDefault()},Hg:function(){this.set("state",
"on")},Gg:function(){this.set("state","off")},ug:function(){var q=this.get("el");q.removeClass("ke-triplebutton-off ke-triplebutton-disabled");q.addClass("ke-triplebutton-on")},tg:function(){var q=this.get("el");q.removeClass("ke-triplebutton-on ke-triplebutton-disabled");q.addClass("ke-triplebutton-off")},qg:function(){var q=this.get("el");q.removeClass("ke-triplebutton-off ke-triplebutton-on");q.addClass("ke-triplebutton-disabled")}},{ae:{Jf:{value:"off"},df:{value:"ke-triplebutton ke-triplebutton-off"},
Qg:{value:{hideFocus:U,tabIndex:0}},Rg:{value:"a"},title:{},Ig:{},text:{}}});j.gg="on";j.eg="off";j.ce="disabled";j.hg="ke-triplebutton-on";j.fg="ke-triplebutton-off";j.Xf="ke-triplebutton-disabled";w.ke=j}});
KISSY.Editor.add("select",function(){function j(d){j.superclass.constructor.call(this,d);this.xe()}var w=KISSY,q=w.Node,I=w.Event,C=w.DOM,y=w.Editor;if(y.je)w.log("ke select attach more");else{j.ce=0;j.Yf=1;var u=y.m;j.ae={gh:{},P:{},Ve:{},xa:{},Og:{},value:{},width:{},title:{},vf:{},Tg:{},align:{value:["l","b"]},Zg:{lh:function(){for(var d=this.P.parent();d;){var f=d.d();if(u[f]&&u[f].div)return d;d=d.parent()}return new q(document.body)}},Jf:{value:1}};j.Lg=function(d){for(var f=d.width(),e=[],
i=d.all("option"),r=0;r<i.length;r++){var k=i[r];e.push({name:C.html(k),value:C.attr(k,"value")})}return new j({width:f+"px",P:d,vf:e,Ve:"ke-combox",value:d.val()})};var p=y.k.Je,m=y.k.Ze;w.extend(j,w.Base,{xe:function(){var d=this.get("container"),f=this.get("el"),e=new q("<span class='ke-select-wrap'><a onclick='return false;' class='ke-select'><span class='ke-select-text'><span class='ke-select-text-inner'></span></span><span class='ke-select-drop-wrap'><span class='ke-select-drop'></span></span></a></span>"),
i=this.get("title")||"",r=this.get("cls"),k=e.one(".ke-select-text"),a=e.one(".ke-select-text-inner");e.one(".ke-select-drop");this.get("value")!==undefined?a.html(this.Yc(this.get("value"))):a.html(i);k.css("width",this.get("width"));e.ta();i&&e.attr("title",i);r&&e.addClass(r);if(f)f[0].parentNode.replaceChild(e[0],f[0]);else d&&e.appendTo(d);e.on("click",this.we,this);this.P=e;this.title=a;this.Zc=e.one("a.ke-select");y.k.Id(this,"_prepare","_real");this.on("afterValueChange",this.Fe,this);this.on("afterStateChange",
this.Ee,this)},Yc:function(d){var f=this.get("title")||"",e=this.get("items");if(this.get("showValue"))return d||f;for(var i=0;i<e.length;i++){var r=e[i];if(r.value==d){f=r.name;break}}return f},Fe:function(d){this.title.html(this.Yc(d.ub))},$c:function(d){var f;f=d.ub;d=this.cd;d.html("");if(f&&f.length)for(var e=0;e<f.length;e++){var i=f[e];(new q("<a class='ke-select-menu-item' href='#' data-value='"+i.value+"'>"+i.name+"</a>",i.Ne)).appendTo(d).ta()}else if(f=this.get("emptyText"))(new q("<a class='ke-select-menu-item' href='#'>"+
f+"</a>")).appendTo(d).ta();this.Yb=d.all("a")},val:function(d){if(d!==undefined){this.set("value",d);return this}else return this.get("value")},bd:function(){this.T.get("visible")&&this.Be()},ye:function(){function d(b){b=new q(b.target);e.contains(b)||e.g(b)||k.hide()}var f=this,e=f.P,i=f.get("popUpWidth"),r=f.Zc,k=new y.fe({Dg:U,fh:f.get("menuContainer"),content:"<div>",Ug:Y,df:"ke-menu",width:i?i:e.width(),zIndex:y.$b(y.Dc.he),Vg:Y}),a=f.get("items");p.call(f,k);i=k.get("contentEl").one("div");
f.T=k;I.on(window,"resize",f.bd,f);p.call(f,function(){I.remove(window,"resize",f.bd,f)});f.get("title")&&(new q("<div class='ke-menu-title ke-select-menu-item' style='margin-top:-6px;' >"+f.get("title")+"</div>")).appendTo(i);f.cd=(new q("<div>")).appendTo(i);f.$c({ub:a});k.on("show",function(){r.addClass("ke-select-active")});k.on("hide",function(){r.removeClass("ke-select-active")});I.on(document,"click",d);p.call(f,function(){I.remove(document,"click",d)});f.get("doc")&&I.on(f.get("doc"),"click",
d);i.on("click",f.De,f);f.Yb=f.cd.all("a");I.on(i[0],"mouseenter",function(){f.Yb.removeClass("ke-menu-selected")});p.call(f,i);f.on("afterItemsChange",f.$c,f);f.zf=i},Ee:function(d){var f=this.P;d.ub==1?f.removeClass("ke-select-disabled"):f.addClass("ke-select-disabled")},sd:function(){this.set("state",1)},qd:function(){this.set("state",0)},De:function(d){d&&d.halt();var f=this.T,e=this.zf;if((d=(new q(d.target)).Pc(function(k){return e.contains(k)&&k.d()=="a"},U))&&d.fb("data-value")){var i=this.get("value"),
r=d.attr("data-value");this.set("value",r);this.fire("click",{ub:r,ah:i,name:d.html()});f.hide()}},Be:function(){var d=this.P,f=d.offset(),e=w.clone(f),i=this.T.get("el").height(),r=this.T.get("el").width(),k=C.scrollTop(),a=C.scrollLeft(),b=C.viewportHeight(),g=C.viewportWidth();g=a+g-60;b=k+b;var n=f.top+(d.height()-2);d=f.left+d.width()-2;var A=this.get("align"),B=A[0];if(A[1]=="b"){f.top=n;if(f.top+i>b&&e.top-k>b-n)f.top=e.top-i}else{f.top=e.top-i;if(f.top<k&&e.top-k<b-n)f.top=n}if(B=="l"){if(f.left+
r>g&&d-a>g-e.left)f.left=d-r}else{f.left=d-r;if(f.left<a&&d-a<g-e.left)f.left=e.left}this.T.set("xy",[f.left,f.top]);this.T.show()},we:function(d){if(!this.sc){d&&d.preventDefault();var f=this;d=f.P;var e=f.get("value");if(!d.hasClass("ke-select-disabled"))if(f.Zc.hasClass("ke-select-active"))f.T&&f.T.hide();else{f.sc=U;y.use("overlay",function(){f.sc=Y;f.fire("select");f.ye();e&&f.T&&f.Yb.each(function(i){i.attr("data-value")==e?i.addClass("ke-menu-selected"):i.removeClass("ke-menu-selected")})})}}},
za:function(){m.call(this);this.P.detach();this.P.remove()}});y.je=j}});
