/*
 CLEditor WYSIWYG HTML Editor v1.4.5
 http://premiumsoftware.net/CLEditor
 requires jQuery v1.4.2 or later

 Copyright 2010, Chris Landowski, Premium Software, LLC
 Dual licensed under the MIT or GPL Version 2 licenses.
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,m,l){c instanceof String&&(c=String(c));for(var p=c.length,n=0;n<p;n++){var t=c[n];if(m.call(l,t,n,c))return{i:n,v:t}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,m,l){if(c==Array.prototype||c==Object.prototype)return c;c[m]=l.value;return c};$jscomp.getGlobal=function(c){c=["object"==typeof globalThis&&globalThis,c,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var m=0;m<c.length;++m){var l=c[m];if(l&&l.Math==Math)return l}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(c,m){var l=$jscomp.propertyToPolyfillSymbol[m];if(null==l)return c[m];l=c[l];return void 0!==l?l:c[m]};
$jscomp.polyfill=function(c,m,l,p){m&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(c,m,l,p):$jscomp.polyfillUnisolated(c,m,l,p))};$jscomp.polyfillUnisolated=function(c,m,l,p){l=$jscomp.global;c=c.split(".");for(p=0;p<c.length-1;p++){var n=c[p];if(!(n in l))return;l=l[n]}c=c[c.length-1];p=l[c];m=m(p);m!=p&&null!=m&&$jscomp.defineProperty(l,c,{configurable:!0,writable:!0,value:m})};
$jscomp.polyfillIsolated=function(c,m,l,p){var n=c.split(".");c=1===n.length;p=n[0];p=!c&&p in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var t=0;t<n.length-1;t++){var D=n[t];if(!(D in p))return;p=p[D]}n=n[n.length-1];l=$jscomp.IS_SYMBOL_NATIVE&&"es6"===l?p[n]:null;m=m(l);null!=m&&(c?$jscomp.defineProperty($jscomp.polyfills,n,{configurable:!0,writable:!0,value:m}):m!==l&&(void 0===$jscomp.propertyToPolyfillSymbol[n]&&(l=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[n]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(n):$jscomp.POLYFILL_PREFIX+l+"$"+n),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[n],{configurable:!0,writable:!0,value:m})))};$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(m,l){return $jscomp.findInternal(this,m,l).v}},"es6","es3");
(function(c){function m(a){var b=this,d=a.target,g=c.data(d,"buttonName"),h=z[g],e=h.popupName,k=v[e];if(!b.disabled&&"disabled"!==c(d).attr("disabled")){var f={editor:b,button:d,buttonName:g,popup:k,popupName:e,command:h.command,useCSS:b.options.useCSS};if(h.buttonClick&&!1===h.buttonClick(a,f))return!1;if("source"===g)A(b)?(delete b.range,b.$area.hide(),b.$frame.show(),d.title=h.title):(b.$frame.hide(),b.$area.show(),d.title="Show Rich Text");else if(!A(b)){if(e){var q=c(k);if("url"===e){if("link"===
g&&""===Q(b))return I(b,"A selection is required when inserting a link.",d),!1;q.children(":button").unbind("click").bind("click",function(){var u=q.find(":text"),w=c.trim(u.val());""!==w&&B(b,f.command,w,null,f.button);u.val("http://");x();C(b)})}else"pastetext"===e&&q.children(":button").unbind("click").bind("click",function(){var u=q.find("textarea"),w=u.val().replace(/\n/g,"<br />");""!==w&&B(b,f.command,w,null,f.button);u.val("");x();C(b)});if(d!==c.data(k,"button"))return R(b,k,d),!1;return}if("print"===
g)b.$frame[0].contentWindow.print();else if(!B(b,f.command,f.value,f.useCSS,d))return!1}C(b)}}function l(a){a=c(a.target).closest("div");a.css("backgroundColor",a.data("buttonName")?"#FFF":"#FFC")}function p(a){c(a.target).closest("div").css("backgroundColor","transparent")}function n(a){var b=a.data.popup,d=a.target;if(b!==v.msg&&!c(b).hasClass("cleditorPrompt")){var g=c.data(b,"button"),h=c.data(g,"buttonName"),e=z[h],k=e.command,f=this.options.useCSS;if("font"===h)var q=d.style.fontFamily.replace(/"/g,
"");else"size"===h?("DIV"===d.tagName.toUpperCase()&&(d=d.children[0]),q=d.innerHTML):"style"===h?q="<"+d.tagName+">":"color"===h?q=S(d.style.backgroundColor):"highlight"===h&&(q=S(d.style.backgroundColor),r?k="backcolor":f=!0);b={editor:this,button:g,buttonName:h,popup:b,popupName:e.popupName,command:k,value:q,useCSS:f};if(!e.popupClick||!1!==e.popupClick(a,b)){if(b.command&&!B(this,b.command,b.value,b.useCSS,g))return!1;x();C(this)}}}function t(a){for(var b=1,d=0,g=0;g<a.length;++g)b=(b+a.charCodeAt(g))%
65521,d=(d+b)%65521;return d<<16|b}function D(a,b,d,g,h){if(v[a])return v[a];var e=c("<div>").hide().addClass("cleditorPopup").appendTo("body");g?e.html(g):"color"===a?(b=b.colors.split(" "),10>b.length&&e.width("auto"),c.each(b,function(k,f){c("<div>").appendTo(e).css("backgroundColor","#"+f)}),d="cleditorColor"):"font"===a?c.each(b.fonts.split(","),function(k,f){c("<div>").appendTo(e).css("fontFamily",f).html(f)}):"size"===a?c.each(b.sizes.split(","),function(k,f){c("<div>").appendTo(e).html('<font size="'+
f+'">'+f+"</font>")}):"style"===a?c.each(b.styles,function(k,f){c("<div>").appendTo(e).html(f[1]+f[0]+f[1].replace("<","</"))}):"url"===a?(e.html('<label>Enter URL:<br /><input type="text" value="http://" style="width:200px" /></label><br /><input type="button" value="Submit" />'),d="cleditorPrompt"):"pastetext"===a&&(e.html('<label>Paste your content here:<br /><textarea rows="3" style="width:200px"></textarea></label><br /><input type="button" value="Submit" />'),d="cleditorPrompt");d||g||(d="cleditorList");
e.addClass(d);r&&e.attr("unselectable","on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr("unselectable","on");(e.hasClass("cleditorList")||!0===h)&&e.children().hover(l,p);v[a]=e[0];return e[0]}function T(a,b){b?(a.$area.attr("disabled","disabled"),a.disabled=!0):(a.$area.removeAttr("disabled"),delete a.disabled);try{r?a.doc.body.contentEditable=!b:a.doc.designMode=b?"off":"on"}catch(d){}E(a)}function B(a,b,d,g,h){J(a);if(!r){if(void 0===g||null===g)g=a.options.useCSS;a.doc.execCommand("styleWithCSS",
0,g.toString())}g="inserthtml"===b.toLowerCase();if(r&&g)F(a).pasteHTML(d);else if(G&&g)b=y(a),h=b.getRangeAt(0),h.deleteContents(),h.insertNode(h.createContextualFragment(d)),b.removeAllRanges(),b.addRange(h);else{var e=!0;try{e=a.doc.execCommand(b,0,d||null)}catch(f){var k=f.message;e=!1}e||(-1<"cutcopypaste".indexOf(b)?I(a,"For security reasons, your browser does not support the "+b+" command. Try using the keyboard shortcut or context menu instead.",h):I(a,k?k:"Error executing the "+b+" command.",
h))}E(a);M(a,!0);return e}function C(a){setTimeout(function(){A(a)?a.$area.focus():a.$frame[0].contentWindow.focus();E(a)},0)}function F(a){return r?y(a).createRange():y(a).getRangeAt(0)}function y(a){return r?a.doc.selection:a.$frame[0].contentWindow.getSelection()}function S(a){var b=/rgba?\((\d+), (\d+), (\d+)/.exec(a);if(b){for(a=(b[1]<<16|b[2]<<8|b[3]).toString(16);6>a.length;)a="0"+a;return"#"+a}b=a.split("");return 4===a.length?"#"+b[1]+b[1]+b[2]+b[2]+b[3]+b[3]:a}function x(){c.each(v,function(a,
b){c(b).hide().unbind("click").removeData("button")})}function U(){return c("link[href*=cleditor]").attr("href").replace(/^(.*\/)[^\/]+$/,"$1")+"images/"}function N(a){var b=a.$main,d=a.options;a.$frame&&a.$frame.remove();var g=a.$frame=c('<iframe frameborder="0" src="javascript:true;" />').hide().appendTo(b),h=a.doc=g[0].contentWindow.document,e=c(h);h.open();h.write(d.docType+"<html>"+(""===d.docCSSFile?"":'<head><link rel="stylesheet" type="text/css" href="'+d.docCSSFile+'" /></head>')+'<body style="'+
d.bodyStyle+'"></body></html>');h.close();(r||G)&&e.click(function(){C(a)});K(a);r||G?(e.bind("beforedeactivate beforeactivate selectionchange keypress keyup",function(k){if("beforedeactivate"===k.type)a.inactive=!0;else if("beforeactivate"===k.type)!a.inactive&&a.range&&1<a.range.length&&a.range.shift(),delete a.inactive;else if(!a.inactive)for(a.range||(a.range=[]),a.range.unshift(F(a));2<a.range.length;)a.range.pop()}),g.focus(function(){J(a);c(a).triggerHandler("focused")}),g.blur(function(){c(a).triggerHandler("blurred")})):
c(g[0].contentWindow).focus(function(){c(a).triggerHandler("focused")}).blur(function(){c(a).triggerHandler("blurred")});e.click(x).keydown(function(k){r&&"Control"==y(a).type&&8==k.keyCode&&(y(a).clear(),k.preventDefault())}).bind("keyup mouseup",function(){E(a);M(a,!0)});O?a.$area.show():g.show();c(function(){var k=a.$toolbar,f=k.children("div:last"),q=b.width();f=f.offset().top+f.outerHeight()-k.offset().top+1;k.height(f);f=(/%/.test(""+d.height)?b.height():parseInt(d.height,10))-f;g.width(q).height(f);
a.$area.width(q).height(X?f-2:f);T(a,a.disabled);E(a)})}function E(a){O||!Y||a.focused||(a.$frame[0].contentWindow.focus(),window.focus(),a.focused=!0);var b=a.doc;r&&(b=F(a));var d=A(a);c.each(a.$toolbar.find(".cleditorButton"),function(g,h){g=c(h);var e=c.cleditor.buttons[c.data(h,"buttonName")],k=e.command,f=!0;if(a.disabled)f=!1;else if(e.getEnabled)f=e.getEnabled({editor:a,button:h,buttonName:e.name,popup:v[e.popupName],popupName:e.popupName,command:e.command,useCSS:a.options.useCSS}),void 0===
f&&(f=!0);else if((d||O)&&"source"!==e.name||r&&("undo"===k||"redo"===k))f=!1;else if(k&&"print"!==k&&(r&&"hilitecolor"===k&&(k="backcolor"),!r&&!G||"inserthtml"!==k))try{f=b.queryCommandEnabled(k)}catch(q){f=!1}f?(g.removeClass("cleditorDisabled"),g.removeAttr("disabled")):(g.addClass("cleditorDisabled"),g.attr("disabled","disabled"))})}function J(a){a.range&&(r?a.range[0].select():G&&y(a).addRange(a.range[0]))}function Q(a){J(a);return r?F(a).text:y(a).toString()}function I(a,b,d){var g=D("msg",
a.options,"cleditorMsg");g.innerHTML=b;R(a,g,d)}function R(a,b,d){var g=c(b);if(d){var h=c(d);var e=h.offset();var k=--e.left;e=e.top+h.height()}else h=a.$toolbar,e=h.offset(),k=Math.floor((h.width()-g.width())/2)+e.left,e=e.top+h.height()-2;x();g.css({left:k,top:e}).show();d&&(c.data(b,"button",d),g.bind("click",{popup:b},c.proxy(n,a)));setTimeout(function(){g.find(":text,textarea").eq(0).focus().select()},100)}function A(a){return a.$area.is(":visible")}function K(a,b){var d=a.$area.val(),g=a.options,
h=g.updateFrame,e=c(a.doc.body);if(h){var k=t(d);if(b&&a.areaChecksum===k)return;a.areaChecksum=k}b=h?h(d):d;b=b.replace(/<(?=\/?script)/ig,"&lt;");g.updateTextArea&&(a.frameChecksum=t(b));b!==e.html()&&(e.html(b),c(a).triggerHandler("change"))}function M(a,b){var d=c(a.doc.body).html(),g=a.options,h=g.updateTextArea,e=a.$area;if(h){var k=t(d);if(b&&a.frameChecksum===k)return;a.frameChecksum=k}b=h?h(d):d;g.updateFrame&&(a.areaChecksum=t(b));b!==e.val()&&(e.val(b),c(a).triggerHandler("change"))}c.cleditor=
{defaultOptions:{width:"auto",height:250,controls:"bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",colors:"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C 666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636 000 300 630 633 330 030 033 006 309 303",
fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",sizes:"1,2,3,4,5,6,7",styles:[["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],["Header 3","<h3>"],["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]],useCSS:!0,docType:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',docCSSFile:"",bodyStyle:"margin:4px; font:10pt Arial,Verdana; cursor:text"},buttons:{init:"bold,,|italic,,|underline,,|strikethrough,,|subscript,,|superscript,,|font,,fontname,|size,Font Size,fontsize,|style,,formatblock,|color,Font Color,forecolor,|highlight,Text Highlight Color,hilitecolor,color|removeformat,Remove Formatting,|bullets,,insertunorderedlist|numbering,,insertorderedlist|outdent,,|indent,,|alignleft,Align Text Left,justifyleft|center,,justifycenter|alignright,Align Text Right,justifyright|justify,,justifyfull|undo,,|redo,,|rule,Insert Horizontal Rule,inserthorizontalrule|image,Insert Image,insertimage,url|link,Insert Hyperlink,createlink,url|unlink,Remove Hyperlink,|cut,,|copy,,|paste,,|pastetext,Paste as Text,inserthtml,|print,,|source,Show Source"},
imagesPath:function(){return U()}};c.fn.cleditor=function(a){var b=c([]);this.each(function(d,g){"TEXTAREA"===g.tagName.toUpperCase()&&((d=c.data(g,V))||(d=new cleditor(g,a)),b=b.add(d))});return b};var V="cleditor",H=navigator.userAgent.toLowerCase(),r=/msie/.test(H),X=/msie\s6/.test(H),G=/(trident)(?:.*rv:([\w.]+))?/.test(H),Y=/webkit/.test(H),O=/iPhone|iPad|iPod/i.test(H),v={},W,z=c.cleditor.buttons;c.each(z.init.split("|"),function(a,b){b=b.split(",");var d=b[0];z[d]={stripIndex:a,name:d,title:""===
b[1]?d.charAt(0).toUpperCase()+d.substr(1):b[1],command:""===b[2]?d:b[2],popupName:""===b[3]?d:b[3]}});delete z.init;cleditor=function(a,b){var d=this;d.options=b=c.extend({},c.cleditor.defaultOptions,b);a=d.$area=c(a).css({border:"none",margin:0,padding:0}).hide().data(V,d).blur(function(){K(d,!0)});var g=d.$main=c("<div>").addClass("cleditorMain").width(b.width).height(b.height),h=d.$toolbar=c("<div>").addClass("cleditorToolbar").appendTo(g),e=c("<div>").addClass("cleditorGroup").appendTo(h),k=
0;c.each(b.controls.split(" "),function(f,q){if(""===q)return!0;if("|"===q)c("<div>").addClass("cleditorDivider").appendTo(e),e.width(k+1),k=0,e=c("<div>").addClass("cleditorGroup").appendTo(h);else{f=z[q];q=c("<div>").data("buttonName",f.name).addClass("cleditorButton").attr("title",f.title).bind("click",c.proxy(m,d)).appendTo(e).hover(l,p);k+=24;e.width(k+1);var u={};if(f.css)u=f.css;else if(f.image){var w=u;var P=f.image;P="url("+U()+P+")";w.backgroundImage=P}f.stripIndex&&(u.backgroundPosition=
-24*f.stripIndex);q.css(u);r&&q.attr("unselectable","on");f.popupName&&D(f.popupName,b,f.popupClass,f.popupContent,f.popupHover)}});g.insertBefore(a).append(a);W||(c(document).click(function(f){f=c(f.target);f.add(f.parents()).is(".cleditorPrompt")||x()}),W=!0);/auto|%/.test(""+b.width+b.height)&&c(window).bind("resize.cleditor",function(){N(d)});N(d)};var L=cleditor.prototype;c.each([["clear",function(a){a.$area.val("");K(a)}],["disable",T],["execCommand",B],["focus",C],["hidePopups",x],["sourceMode",
A,!0],["refresh",N],["select",function(a){setTimeout(function(){A(a)?a.$area.select():B(a,"selectall")},0)}],["selectedHTML",function(a){J(a);a=F(a);if(r)return a.htmlText;var b=c("<layer>")[0];b.appendChild(a.cloneContents());return b.innerHTML},!0],["selectedText",Q,!0],["showMessage",I],["updateFrame",K],["updateTextArea",M]],function(a,b){L[b[0]]=function(){for(var d=[this],g=0;g<arguments.length;g++)d.push(arguments[g]);d=b[1].apply(this,d);return b[2]?d:this}});L.blurred=function(a){var b=c(this);
return a?b.bind("blurred",a):b.trigger("blurred")};L.change=function(a){var b=c(this);return a?b.bind("change",a):b.trigger("change")};L.focused=function(a){var b=c(this);return a?b.bind("focused",a):b.trigger("focused")}})(jQuery);
