text: "use strict";var kite={browser:{}},nbe={browser:{icon:{}},dynamic:{},css:{},site:{},lib:{},doc:{},state:{},inputs:{},notify:{},format:{},location:{},events:{},triggers:{},ops:{},editor:{},paste:{},title:{},publish:{}};(function(){typeof console=="undefined"&&(console={}),typeof console.log=="undefined"&&(console.log=function(){})})(),typeof document!="undefined"&&!("classList"in document.createElement("a"))&&function(e){var t,n,r,i,s,o,u,a,f,l,c,h;t="classList",n="prototype",r=(e.HTMLElement||e.Element)[n],i=Object,s=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},o=Array[n].indexOf||function(e){var t,n;n=this.length;for(t=0;t<n;t++)if(t in this&&this[t]===e)return t;return-1},u=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},a=function(e,t){if(t==="")throw new u("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new u("INVALID_CHARACTER_ERR","String contains an invalid character");return o.call(e,t)},f=function(e){var t,n,r,i;t=s.call(e.className),n=t?t.split(/\s+/):[],i=n.length;for(r=0;r<i;r++)this.push(n[r]);this._updateClassName=function(){e.className=this.toString()}},l=f[n]=[],c=function(){return new f(this)},u[n]=Error[n],l.item=function(e){return this[e]||null},l.contains=function(e){return e+="",a(this,e)!==-1},l.add=function(e){e+="",a(this,e)===-1&&(this.push(e),this._updateClassName())},l.remove=function(e){var t;e+="",t=a(this,e),t!==-1&&(this.splice(t,1),this._updateClassName())},l.toggle=function(e){e+="",a(this,e)===-1?this.add(e):this.remove(e)},l.toString=function(){return this.join(" ")};if(i.defineProperty){h={get:c,enumerable:!0,configurable:!0};try{i.defineProperty(r,t,h)}catch(p){p.number===-2146823252&&(h.enumerable=!1,i.defineProperty(r,t,h))}}else i[n].__defineGetter__&&r.__defineGetter__(t,c)}(window.self);if(window.Element&&!window.addEventListener){var attach,remove;attach=function(e,t,n){this.attachEvent("on"+e,function(){var e;e=window.event,e.target=e.srcElement,t(e)})},remove=function(e,t,n){this.detachEvent("on"+e,t)},window.Element.prototype.addEventListener=attach,window.Element.prototype.removeEventListener=remove,Window.prototype.addEventListener=attach,Window.prototype.removeEventListener=remove,document.addEventListener=attach,document.removeEventListener=remove}Object.keys||(Object.keys=function(){var e,t,n,r;return e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],r=n.length,function(i){var s,o,u;if(typeof i!="object"&&typeof i!="function"||i===null)throw new TypeError("Object.keys called on non-object");s=[];for(o in i)e.call(i,o)&&s.push(o);if(t)for(u=0;u<r;u++)e.call(i,n[u])&&s.push(n[u]);return s}}()),Array.prototype.map||(Array.prototype.map=function(e,t){var n,r,i,s,o,u,a;if(this===null)throw new TypeError(" this is null or not defined");s={},o=s.length>0;if({}.toString.call(e)!=="[object Function]")throw new TypeError(e+" is not a function");t&&(n=t),r=new Array(o),i=0;while(i<o)i in s&&(u=s[i],a=e.call(n,u,i,s),r[i]=a),i++;return r}),Date.now=Date.now||function(){return+(new Date)},Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var t,n,r,i;if(this===null)throw new TypeError;t={},n=t.length>0;if(n===0)return-1;r=0,arguments.length>0&&(r=Number(arguments[1]),r!==r?r=0:r!==0&&r!==Infinity&&r!==-Infinity&&(r=(r>0||-1)*Math.floor(Math.abs(r))));if(r>=n)return-1;i=r>=0?r:Math.max(n-Math.abs(r),0);for(;i<n;i++)if(i in t&&t[i]===e)return i;return-1}),Array.prototype.filter||(Array.prototype.filter=function(e){var t,n,r,i,s,o;if(this===null)throw new TypeError;t={},n=t.length>0;if(typeof e!="function")throw new TypeError;r=[],i=arguments[1];for(s=0;s<n;s++)s in t&&(o=t[s],e.call(i,o,s,t)&&r.push(o));return r}),Array.prototype.forEach||(Array.prototype.forEach=function(t,n){var r,i,s,o,u;if(this===null)throw new TypeError("this is null or not defined");s={},o=s.length>0;if({}.toString.call(t)!=="[object Function]")throw new TypeError(t+" is not a function");n&&(r=n),i=0;while(i<o)Object.prototype.hasOwnProperty.call(s,i)&&(u=s[i],t.call(r,u,i,s)),i++}),nbe.site.panel=function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g;n=nbe.state.formats.default_values,r="off:on",i=!1,s={},o=kite.browser.dom.eac("div",e,"wu-format-panel"),u=function(){i?(o.className="wu-format-panel",a.textContent="More"):(o.className="wu-format-panel open",a.textContent="Less"),i=!i},a=kite.browser.dom.eac("button",e,"wu-toggle circle_button"),a.textContent="More",a.addEventListener("click",u,!1),o.addEventListener("click",function(e){(e.target.classList.contains("wu-icon")||e.target.parentNode.classList.contains("drop_down_menu")||e.target.parentNode.parentNode.classList.contains("drop_down_menu"))&&u()},!1),f=kite.browser.dom.ea("div",o),s.heading=nbe.inputs.heading(t.trigger,"Heading",{none:"No heading (-)",heading1:'<span class="line heading1">Heading 1 (H1)</span>',heading2:'<span class="line heading2">Heading 2 (H2)</span>',heading3:'<span class="line heading3">Heading 3 (H3)</span>',heading4:'<span class="line heading4">Heading 4 (H4)</span>',heading5:'<span class="line heading5">Heading 5 (H5)</span>',heading6:'<span class="line heading6">Heading 6 (H6)</span>'},{none:"-",heading1:"H1",heading2:"H2",heading3:"H3",heading4:"H4",heading5:"H5",heading6:"H6"},f,n.heading),l={},nbe.state.formats.font_family.forEach(function(e){var t;t=e[0].toUpperCase()+e.slice(1),l[e]='<span style="font-family : '+t+';">'+t+"</span>"}),s.font_family=nbe.inputs.font_family(t.trigger,"Font",l,f,n.font_family),s.font_size=nbe.inputs.font_size(t.trigger,"Font size",{"10px":"10","11px":"11","12px":"12","13px":"13","14px":"14","16px":"16","18px":"18","20px":"20","22px":"22","24px":"24","28px":"28","32px":"32","36px":"36","48px":"48","72px":"72"},f,n.font_size),c=kite.browser.dom.ea("div",o),s.bold=nbe.inputs.bold(t.trigger,"Bold",c,n.bold),s.italic=nbe.inputs.italic(t.trigger,"Italic",c,n.italic),s.underline=nbe.inputs.underline(t.trigger,"Underline",c,n.underline),s.strikethrough=nbe.inputs.strikethrough(t.trigger,"Strikethrough",c,n.strikethrough),h=kite.browser.dom.ea("div",o),s.color=nbe.inputs.color(t.trigger,"Text color",h,n.color),s.background_color=nbe.inputs.background_color(t.trigger,"Line color",h,n.background_color),s.vertical_align=nbe.inputs.vertical_align(t.trigger,kite.browser.dom.ea("div",o),n.vertical_align),s.left_margin=nbe.inputs.left_margin(t.trigger,kite.browser.dom.ea("div",o),r),p=kite.browser.dom.ea("div",o),s.text_align=nbe.inputs.text_align(t.trigger,"Text align",{left:"Left",center:"Center",right:"Right",justify:"Justify"},p,n.text_align),s.line_spacing=nbe.inputs.line_spacing(t.trigger,"Line spacing",{line_spacing_05:"0.5",line_spacing_06:"0.6",line_spacing_07:"0.7",line_spacing_08:"0.8",line_spacing_09:"0.9",line_spacing_10:"1",line_spacing_11:"1.1",line_spacing_12:"1.2",line_spacing_13:"1.3",line_spacing_14:"1.4",line_spacing_15:"1.5",line_spacing_16:"1.6 (default)",line_spacing_17:"1.7",line_spacing_18:"1.8",line_spacing_19:"1.9",line_spacing_20:"2"},p,n.line_spacing),s.list=nbe.inputs.list(t.trigger,"List",{none:"none",disc:"•",square:"▀",ordered:"1. 2. 3.","lower-alpha":"a. b. c.","upper-alpha":"A. B. C.","lower-roman":"i. ii. iii.","upper-roman":"I. II. III."},kite.browser.dom.ea("div",o),n.list),d=kite.browser.dom.ea("div",o),s.special_characters=nbe.inputs.special_characters(t.trigger,"Special characters",d,null),s.insert_link=nbe.inputs.insert_link(t.trigger,"Insert link",d),s.edit_link=nbe.inputs.edit_link(t.trigger,"Edit link",d,null),s.insert_img=nbe.inputs.insert_image(t.trigger,"Insert image",d),s.edit_img=nbe.inputs.edit_image(t.trigger,"Edit image",d,null);for(v in s)s.hasOwnProperty(v)&&t.inputs.add(v,s[v]);m=nbe.inputs.undo(t.trigger,kite.browser.dom.ea("div",o)),t.undo.add_button(m),g=kite.browser.dom.eac("button",o,"hide circle_button"),g.textContent="Close",g.addEventListener("click",u,!1)},nbe.site.status_panel=function(e){var t,n,r,i,s,o,u,a,f;return t=kite.browser.dom.ec("div","status_panel"),n=nbe.site.display_share(e),r=kite.browser.dom.eac("button",t,"circle_button"),r.textContent="Share",r.addEventListener("click",function(t){n.display(e)},!1),i=nbe.site.display_export(e),s=nbe.browser.icon.exporticon(t),s.addEventListener("click",function(e){i.display()},!1),o=nbe.browser.icon.network(t),u=nbe.browser.icon.saved(t),a=function(e,t){e==="network"?t==="connected"?o.on():o.off():e==="nunsaved"&&(t>0?u.off():u.on())},f=function(e){e.appendChild(t)},{set_status:a,display:f}},nbe.site.display_demo=function(){var e,t,n,r;e=nbe.doc.create({id:"demo",read:null,write:null,new_doc:!0},!1,null,function(e,t){}),t=[{domop:"append",id:"line2",parent:"root",type:"line",val:{}},{domop:"append",id:"line3",parent:"root",type:"line",val:{}},{domop:"append",id:"line4",parent:"root",type:"line",val:{}},{domop:"append",id:"line5",parent:"root",type:"line",val:{heading:"heading4"}},{domop:"append",id:"line6",parent:"root",type:"line",val:{}},{domop:"append",id:"line7",parent:"root",type:"line",val:{}},{domop:"append",id:"line8",parent:"root",type:"line",val:{}},{domop:"append",id:"line9",parent:"root",type:"line",val:{list:"ordered"}},{domop:"append",id:"line10",parent:"root",type:"line",val:{list:"ordered"}},{domop:"append",id:"line11",parent:"root",type:"line",val:{list:"ordered"}},{domop:"append",id:"line12",parent:"root",type:"line",val:{list:"ordered"}},{domop:"append",id:"line13",parent:"root",type:"line",val:{list:"ordered"}},{domop:"append",id:"line14",parent:"root",type:"line",val:{list:"ordered"}},{domop:"append",id:"line15",parent:"root",type:"line",val:{list:"ordered"}},{domop:"append",id:"line16",parent:"root",type:"line",val:{}},{domop:"append",id:"line17",parent:"root",type:"line",val:{text_align:"center"}},{domop:"append",id:"line18",parent:"root",type:"line",val:{text_align:"center"}},{domop:"append",id:"line19",parent:"root",type:"line",val:{text_align:"center"}},{domop:"append",id:"line20",parent:"root",type:"line",val:{}},{domop:"append",id:"line21",parent:"root",type:"line",val:{}},{domop:"append",id:"line22",parent:"root",type:"line",val:{left_margin:20}},{domop:"append",id:"line23",parent:"root",type:"line",val:{left_margin:40}},{domop:"append",id:"line24",parent:"root",type:"line",val:{}},{domop:"append",id:"line25",parent:"root",type:"line",val:{}},{domop:"append",id:"line26",parent:"root",type:"line",val:{}},{domop:"append",id:"line27",parent:"root",type:"line",val:{}},{domop:"append",id:"line28",parent:"root",type:"line",val:{}},{domop:"append",id:"text1.2",parent:"line",type:"text",val:{text:"Write in the left windows and see changes in the right window"}},{domop:"append",id:"text3.1",parent:"line3",type:"text",val:{text:"You can insert "}},{domop:"append",id:"link3.2",parent:"line3",type:"link",val:{href:"www.writeurl.com"}},{domop:"append",id:"text3.3",parent:"link3.2",type:"text",val:{text:"links"}},{domop:"append",id:"text3.4",parent:"line3",type:"text",val:{text:", images "}},{domop:"append",id:"img3.5",parent:"line3",type:"img",val:{src:"/img/nyckelpiga.jpg",height:"50"}},{domop:"append",id:"text3.6",parent:"line3",type:"text",val:{text:" and special characters : αβγ"}},{domop:"append",id:"text5.1",parent:"line5",type:"text",val:{text:"Lines can have headers"}},{domop:"append",id:"text7.1",parent:"line7",type:"text",val:{text:"There are lists and formatted text"}},{domop:"append",id:"text9.1",parent:"line9",type:"text",val:{text:"bold",bold:"on"}},{domop:"append",id:"text10.1",parent:"line10",type:"text",val:{text:"italic",italic:"on"}},{domop:"append",id:"text11.1",parent:"line11",type:"text",val:{text:"underline",underline:"on"}},{domop:"append",id:"text12.1",parent:"line12",type:"text",val:{text:"strikethrough",strikethrough:"on"}},{domop:"append",id:"text13.1",parent:"line13",type:"text",val:{text:"color",color:"rgb(255,0,0)"}},{domop:"append",id:"text14.1",parent:"line14",type:"text",val:{text:"line color",background_color:"rgb(255,255,0)"}},{domop:"append",id:"text15.1",parent:"line15",type:"text",val:{text:"superscript",vertical_align:"super"}},{domop:"append",id:"text15.2",parent:"line15",type:"text",val:{text:" and "}},{domop:"append",id:"text15.3",parent:"line15",type:"text",val:{text:"subscript",vertical_align:"sub"}},{domop:"append",id:"text17.1",parent:"line17",type:"text",val:{text:"Text alignments can be left,"}},{domop:"append",id:"text18.1",parent:"line18",type:"text",val:{text:"center (as here),"}},{domop:"append",id:"text19.1",parent:"line19",type:"text",val:{text:"right and justify."}},{domop:"append",id:"text21.1",parent:"line21",type:"text",val:{text:"Text can"}},{domop:"append",id:"text22.1",parent:"line22",type:"text",val:{text:"also have"}},{domop:"append",id:"text23.1",parent:"line23",type:"text",val:{text:"indentation levels"}},{domop:"append",id:"text25.1",parent:"line25",type:"text",val:{text:"Undo ( button or ctrl-z), redo (button or ctrl-shift-z)"}},{domop:"append",id:"text26.1",parent:"line26",type:"text",val:{text:"Copy (ctrl-c), cut (ctrl-x), paste (ctrl-v)"}},{domop:"append",id:"text28.1",parent:"line28",type:"text",val:{text:"spell check, fonts, line spacing."}}],e.add_ops(null,t),n=e.editors.add("editor_write","text",{editable:!0}),document.getElementById("editor_write").appendChild(n.el_editor),r=e.editors.add("editor_read","text",{editable:!1}),document.getElementById("editor_read").appendChild(r.el_editor),nbe.site.panel(document.getElementById("demo_panel"),n)},nbe.site.display_editor=function(e){var t,n,r,i;t=e.ids.write!==null,document.getElementById("frontpage").style.display="none",t?document.body.className="editor":(document.getElementById("home").style.display="none",document.getElementById("feedback").style.display="none",document.getElementById("faq").style.display="none",document.body.className="read_editor"),n=e.editors.add("editor","text",{editable:t}),r=kite.browser.dom.eac("div",document.body,"editor_container"),t&&nbe.site.panel(document.getElementById("panel"),n),i=e.editors.add("title_editor","title",{editable:t,html_title:!0}),t&&kite.browser.dom.eac("div",r,"wu-title-container").appendChild(i.el_editor),nbe.dynamic.get_title=i.get_value,nbe.dynamic.publish=e.editors.add("publish_editor","publish",{}),r.appendChild(n.el_editor),e.ids.prefix==="scroller"&&e.ids.write===null&&nbe.site.scroller(n)},nbe.site.display_share=function(e){var t,n,r,i,s,o,u;return t=new kite.browser.ui.Window,t.set_title("Share"),n=kite.browser.dom.ec("div","nbe_window share"),kite.browser.dom.ea("img",n).src="/img/fork.svg",kite.browser.dom.ea("h1",n).textContent="Share",kite.browser.dom.ea("p",n).textContent="Share the write URL with collaborators or share the read or publish URLs with readers.",r=function(e,t,r){var i,s,o;return i=kite.browser.dom.ea("div",n),s=kite.browser.dom.ea("h2",i),s.textContent=e,kite.browser.dom.ea("span",s).textContent=t,o=kite.browser.dom.ea("a",i),o.textContent=r,o.href=r,o.target="_blank",{element:i,url:o}},r("Write URL","(Collaborators can edit the document with this URL)",nbe.config.urls(e).write),r("Read URL","(Readers can view the document and see changes as you type)",nbe.config.urls(e).read),i=r("Publish URL","(Readers can view the published version of this document)",nbe.config.urls(e).publish),function(){var e;e=kite.browser.dom.ea("button",i.element),e.textContent="Publish",s=kite.browser.dom.ea("span",i.element),e.addEventListener("click",function(e){nbe.dynamic.publish.publish(function(e){e==="published"?(s.textContent="The document is published!",s.className="message_success",i.url.className="visible"):e==="not published"?(s.textContent="Error, please try again.",s.className="message_failure"):(s.textContent="Network error.",s.className="message_failure")})},!1)}(),function(){var t,r,i,s,o,a,f,l,c,h;t=kite.browser.dom.ea("div",n),r="publish",i=function(e){o.className="",a.className="",f.className="",e.target===o?(r="write",o.className="active"):e.target===a?(r="read",a.className="active"):e.target===f&&(r="publish",f.className="active")},s=kite.browser.dom.eac("div",t,"share_email"),kite.browser.dom.ea("h2",s).textContent="Share via e-mail",kite.browser.dom.ea("div",s).textContent="Select URL to share:",o=kite.browser.dom.ea("button",s),o.textContent="Write",o.addEventListener("click",i),a=kite.browser.dom.ea("button",s),a.textContent="Read",a.addEventListener("click",i),f=kite.browser.dom.ea("button",s),f.textContent="Publish",f.addEventListener("click",i),f.className="active",kite.browser.dom.ea("div",s).textContent="E-mail address(es):",l=kite.browser.dom.ea("textarea",s),l.setAttribute("autocapitalize","none"),kite.browser.dom.ea("div",s).textContent="Message (optional):",c=kite.browser.dom.ea("textarea",s),h=kite.browser.dom.eac("button",s,"send"),h.textContent="Send",h.addEventListener("click",function(t){var n,i;i=nbe.lib.share_emails(l.value),i.invalid.length===0&&i.valid.length!==0?(n={type:"share",emails:i.valid,message:c.value,access:r,url:nbe.config.urls(e)[r],title:nbe.dynamic.get_title()},nbe.lib.xhr("POST",nbe.config.share_url,{},JSON.stringify(n),0,function(e){l.value="",u.textContent="The invitation has been sent.",u.className="message_success"},function(){},function(){u.textContent="Internet connection error, please try again.",u.className="message_failure"})):(i.invalid.length!==0?u.textContent="These email addresses are invalid. Please correct them.\n\n"+i.invalid.join("\n"):u.textContent="Please specify the email address(es).",u.className="message_failure")},!1),u=kite.browser.dom.ea("span",s)}(),o=kite.browser.dom.ea("button",n),o.textContent="Close",o.addEventListener("click",function(e){t.close()},!1),t.set_content(n),{display:function(){u.textContent="",s.textContent="",i.element.appendChild(nbe.dynamic.publish.msg),nbe.dynamic.publish.get_time()===null?i.url.className="hidden":i.url.className="visible",t.open()}}},nbe.site.display_feedback=function(){var e,t,n,r,i,s,o,u,a,f;t=new kite.browser.ui.Window,t.set_title("Feedback"),e=document.getElementById("feedback"),e.addEventListener("click",function(e){t.open()},!1),n=kite.browser.dom.ec("div","nbe_window feedback"),kite.browser.dom.ea("div",n).innerHTML="!",kite.browser.dom.ea("h1",n).innerHTML="Feedback",kite.browser.dom.ea("p",n).innerHTML="Your opinion is very valuable to us, please let us know what you think.",kite.browser.dom.ea("h3",n).innerHTML="Name",r=kite.browser.dom.ea("input",n),r.type="text",kite.browser.dom.ea("h3",n).innerHTML="E-mail",i=kite.browser.dom.input("email",null,null,null,null,null,n),i.setAttribute("autocapitalize","none"),kite.browser.dom.ea("h3",n).innerHTML="Message",s=kite.browser.dom.ea("textarea",n),o=kite.browser.dom.ea("footer",n),u=kite.browser.dom.ea("button",o),u.innerHTML="Send",u.addEventListener("click",function(e){if(s.value)if(!i.value||i.value&&nbe.lib.valid_email(i.value)){var t={type:"feedback",name:r.value,mail:i.value,message:s.value};nbe.lib.xhr("POST",nbe.config.feedback_url,{},JSON.stringify(t),0,function(e){r.value="",i.value="",s.value="",a.innerHTML="Email sent.",a.className="message_success",setTimeout(function(){kite.browser.animation.Fade_out(a,{duration:4e3})},2e3)},function(){},function(){a.innerHTML="Server error, please try again.",a.className="message_failure",setTimeout(function(){kite.browser.animation.Fade_out(a,{duration:4e3})},2e3)})}else a.innerHTML="The email address is incorrect.",a.className="message_failure",setTimeout(function(){kite.browser.animation.Fade_out(a,{duration:4e3})},2e3);else a.innerHTML="Please write a message.",a.className="message_failure",setTimeout(function(){kite.browser.animation.Fade_out(a,{duration:4e3})},2e3)},!1),a=kite.browser.dom.ea("div",o),f=kite.browser.dom.ea("button",o),f.innerHTML="Close",f.addEventListener("click",function(e){t.close()},!1),t.set_content(n)},nbe.site.display_export=function(){var e,t,n,r,i,s;return e=new kite.browser.ui.Window,e.set_title("Export"),t=kite.browser.dom.ec("div","nbe_window share"),kite.browser.dom.ea("img",t).src="/img/export.svg",kite.browser.dom.ea("h1",t).textContent="Export",kite.browser.dom.ea("p",t).textContent="Please select format by clicking one of the buttons and the file will be downloaded to your device.",n=kite.browser.dom.ea("div",t),kite.browser.dom.ea("p",n).textContent="Please note that export currently only works in Google Chrome.",r=kite.browser.dom.ea("button",n),r.textContent="Word",r.addEventListener("click",function(e){nbe.lib.save_as(new Blob([nbe.doc.html(nbe.dynamic.doc)],{type:"application/vnd.ms-word"}),nbe.dynamic.get_title()+".doc")},!1),i=kite.browser.dom.ea("button",n),i.textContent="HTML",i.addEventListener("click",function(e){nbe.lib.save_as(new Blob([nbe.doc.html(nbe.dynamic.doc)],{type:"text/html"}),nbe.dynamic.get_title()+".html")},!1),kite.browser.dom.ea("p",t),s=kite.browser.dom.ea("button",t),s.textContent="Close",s.addEventListener("click",function(t){e.close()},!1),e.set_content(t),{display:function(){e.open()}}},nbe.site.doc_noexist=function(e){var t;t=kite.browser.dom.eac("div",document.body,"full_screen_message"),kite.browser.dom.ea("div",t).textContent="The document is not known to the server."},nbe.site.wrong_password=function(){var e;e=kite.browser.dom.eac("div",document.body,"full_screen_message"),kite.browser.dom.ea("div",e).textContent="It seems like you're not using a proper URL for this document, please check your link."},nbe.site.loading=function(){var e,t,n,r;return e=document.createElement("div"),e.className="full_screen_message",kite.browser.dom.ea("div",e).textContent="We are trying to connect to the server.",t="init",n=function(){setTimeout(function(){t==="init"&&(t="on",document.body.appendChild(e))},200)},r=function(){t==="on"&&document.body.removeChild(e),t="off"},{on:n,off:r}},nbe.site.supported_doc=function(){var e=kite.browser.dom.eac("div",document.body,"full_screen_message");kite.browser.dom.ea("div",e).innerHTML="Your browser is not supported."},nbe.site.supported_front=function(e){var t;t=document.getElementById("new_doc"),e?t.addEventListener("click",function(e){window.open(nbe.config.new_url(),"_blank")},!1):(t.innerHTML="Your browser is not supported.",t.className="unsupported")},nbe.site.scroller=function(e){var t,n;t=e.el_editor,n=t.parentNode.classList.contains("editor_container")?t.parentNode:t,setInterval(function(){n.scrollTop=n.scrollHeight},200)},nbe.site.embed=function(e,t,n,r,i,s,o,u,a){var f,l,c,h;f=r.write!==null&&r.write!=="",l=function(e){return typeof e=="string"?document.getElementById(e):e},c=function(r,i){var s,o;a(r,i),r==="doc"&&i==="exist"&&(h.comm.notify(),s=h.editors.add("editor","text",{editable:f}),e&&l(e).appendChild(s.el_editor),t&&(o=h.editors.add("title_editor","title",{editable:f,html_title:u}),l(t).appendChild(o.el_editor)),n&&nbe.site.panel(l(n),s))},r.new_doc=i,h=nbe.doc.create(r,o,s,c),h.server_status!=="unknown"&&c("doc","exist")},nbe.site.embed_read=function(e,t){var n,r,i;e=typeof e=="string"?document.getElementById(e):e,n="ws://www.writeurl.com:8043",t.write=null,r=document.createElement("div"),e.appendChild(r),i=document.createElement("div"),e.appendChild(i),nbe.site.embed(i,r,null,t,!1,n,!0,!1,function(){})},nbe.site.embed_write=function(e,t){var n,r,i,s;e=typeof e=="string"?document.getElementById(e):e,n="ws://www.writeurl.com:8043",r=document.createElement("div"),e.appendChild(r),i=document.createElement("div"),e.appendChild(i),s=document.createElement("div"),e.appendChild(s),console.log(t),nbe.site.embed(s,i,r,t,!1,n,!0,!1,function(){})},nbe.site.embed_new=function(e){var t,n,r,i,s;return e=typeof e=="string"?document.getElementById(e):e,t="ws://www.writeurl.com:8043",n=document.createElement("div"),e.appendChild(n),r=document.createElement("div"),e.appendChild(r),i=document.createElement("div"),e.appendChild(i),s={id:nbe.lib.rnd_string(20),read:nbe.lib.rnd_string(20),write:nbe.lib.rnd_string(20)},nbe.site.embed(i,r,n,s,!0,t,!0,!1,function(){}),s},nbe.config=function(){var e,t,n,r,i,s,o,u,a;return e=window.location.host,t="/",n=function(e){var t;return t=/^[a-z0-9]{3,}$/,t.test(e)},r=function(e){var t,r;return t=e.split("/"),r={prefix:t.length>1?t[1]:null,id:t.length>2&&n(t[2])?t[2]:null,read:t.length>3&&n(t[3])?t[3]:null,write:t.length>4&&n(t[4])?t[4]:null,new_doc:t.length>5&&t[5]==="new"},r},i=function(e){return"/publish/"+e.id},s=function(e){return"/text/"+e.id+"/"+e.read},o=function(e){return s(e)+"/"+e.write},u=function(t){var n;return n="http://"+e,{publish:n+i(t),read:n+s(t),write:n+o(t)}},a=function(){var e;return e={id:nbe.lib.rnd_string(20),read:nbe.lib.rnd_string(20),write:nbe.lib.rnd_string(20)},u(e).write+"/new"},{title:"My Title",home_pathname:t,write_pathname:o,urls:u,new_url:a,parse_pathname:r,local_storage:!0,ws_url:"ws://"+e+":8043",share_url:"http://"+e+":8050",feedback_url:"http://"+e+":8050",publish_url:"http://"+e+":8050",file_upload_url:"http://"+e+":8051"}}(),nbe.lib.clone=function(e){return JSON.parse(JSON.stringify(e))},nbe.lib.xhr=function(e,t,n,r,i,s,o,u){var a,f;a=new XMLHttpRequest,a.onreadystatechange=function(){a.readyState===4&&(a.status===200?s(a.responseText):o())},a.onerror=function(){u()},a.ontimeout=function(){u()},a.open(e,t,!0),a.timeout=i;for(f in n)n.hasOwnProperty(f)&&a.setRequestHeader(f,n[f]);a.send(r)},nbe.lib.rnd_random_org=function(){var e,t,n,r,i;return e=!1,e=!0,t=40,n="",r=function(){var t;e||(e=!0,t="http://www.random.org/strings/?num=3&len=20&digits=on&upperalpha=off&loweralpha=on&unique=off&format=plain&rnd=new",nbe.lib.xhr("GET",t,{},"",0,function(t){e=!1;try{n+=t.split("\n").join("")}catch(r){}},function(){e=!1},function(){e=!1}))},r(),i=function(e){var i;return i="",n.length>=e&&(i=n.slice(0,e),n=n.slice(e)),n.length<t&&r(),i},i}(),nbe.lib.rnd_crypto=function(e){var t,n,r;t=[];if("crypto"in window&&"getRandomValues"in window.crypto){n=new Uint8Array(e),window.crypto.getRandomValues(n);for(r=0;r<e;r++)t[r]=n[r].toString(36).slice(-1)}return t.join("")},nbe.lib.rnd_math_random=function(e){var t,n;t=[];for(n=0;n<e;n++)t[n]=Math.floor(36*Math.random()).toString(36);return t.join("")},nbe.lib.rnd_string=function(e){var t;return t=nbe.lib.rnd_random_org(e),t.length!==e&&(t=nbe.lib.rnd_crypto(e)),t.length!==e&&(t=nbe.lib.rnd_math_random(e)),t},nbe.lib.partial_copy=function(e,t,n){var r,i;for(r=0;r<n.length;r++)i=n[r],i in e&&(t[i]=e[i]);return t},nbe.lib.get_attributes=function(e,t){var n,r,i;n={},r=function(t){var r;r=e.getAttribute("data-"+t),r&&(n[t]=r)};for(i=0;i<t.length;i++)r(t[i]);return n},nbe.lib.set_attributes=function(e,t,n){var r,i;r=function(t){t in n?e.setAttribute("data-"+t,n[t]):e.removeAttribute("data-"+t)};for(i=0;i<t.length;i++)r(t[i]);return e},nbe.lib.new_id=function(){var e,t;return e=nbe.lib.rnd_string(12),t=0,function(){var n;return n=e+t,t++,n}},nbe.lib.valid_email=function(e){var t;return t=/^[\-a-z0-9~!$%\^&*_=+}{\'?]+(\.[\-a-z0-9~!$%\^&*_=+}{\'?]+)*@([a-z0-9_][\-a-z0-9_]*(\.[\-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i,typeof e=="string"&&t.test(e)},nbe.lib.share_emails=function(e){var t,n,r;return t=e.split(/[ ,\n]/).filter(function(e){return e!==""}),n=[],r=[],t.forEach(function(e){nbe.lib.valid_email(e)?n.push(e):r.push(e)}),{valid:n,invalid:r}},nbe.lib.file_upload=function(e,t){var n,r,i;n=function(e){var t;return t=e.name.match(/\.([a-zA-Z]+)/),r=t?t[1]:null,r},r=n(e),r===null?t(null):(i=new FileReader,i.onload=function(e){nbe.lib.xhr("POST",nbe.config.file_upload_url,{"X-File-Ending":r},i.result,0,function(e){t(JSON.parse(e))},function(){t(null)},function(){t(null)})},i.readAsArrayBuffer(e))},nbe.lib.save_as=function(e){var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=e.URL||e.webkitURL||e,i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in i,o=function(n){var r=t.createEvent("MouseEvents");return r.initMouseEvent("click",!0,!1,e,0,0,0,0,0,!1,!1,!1,!1,0,null),n.dispatchEvent(r)},u=e.webkitRequestFileSystem,a=e.requestFileSystem||u||e.mozRequestFileSystem,f=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},l="application/octet-stream",c=0,h=[],p=function(){var e,t;e=h.length;while(e)e-=1,t=h[e],typeof t=="string"?r.revokeObjectURL(t):t.remove();h.length=0},d=function(e,t,n){t=[].concat(t);var r,i;r=t.length;while(r){r-=1,i=e["on"+t[r]];if(typeof i=="function")try{i.call(e,n||e)}catch(s){f(s)}}},v=function(t,r){var f=this,p=t.type,v=!1,m,g,y=function(){var e=n().createObjectURL(t);return h.push(e),e},b=function(){d(f,"writestart progress write writeend".split(" "))},w=function(){if(v||!m)m=y(t);g.location.href=m,f.readyState=f.DONE,b()},E=function(e){return function(){if(f.readyState!==f.DONE)return e.apply(this,arguments)}},S={create:!0,exclusive:!1},x;f.readyState=f.INIT,r||(r="download");if(s){m=y(t),i.href=m,i.download=r;if(o(i)){f.readyState=f.DONE,b();return}}e.chrome&&p&&p!==l&&(x=t.slice||t.webkitSlice,t=x.call(t,0,t.size,l),v=!0),u&&r!=="download"&&(r+=".download"),p===l||u?g=e:g=e.open();if(!a){w();return}c+=t.size,a(e.TEMPORARY,c,E(function(e){e.root.getDirectory("saved",S,E(function(e){var n=function(){e.getFile(r,S,E(function(e){e.createWriter(E(function(n){n.onwriteend=function(t){g.location.href=e.toURL(),h.push(e),f.readyState=f.DONE,d(f,"writeend",t)},n.onerror=function(){var e=n.error;e.code!==e.ABORT_ERR&&w()},"writestart progress write abort".split(" ").forEach(function(e){n["on"+e]=f["on"+e]}),n.write(t),f.abort=function(){n.abort(),f.readyState=f.DONE},f.readyState=f.WRITING}),w)}),w)};e.getFile(r,{create:!1},E(function(e){e.remove(),n()}),E(function(e){e.code===e.NOT_FOUND_ERR?n():w()}))}),w)}),w)},m=v.prototype,g=function(e,t){return new v(e,t)};return m.abort=function(){var e=this;e.readyState=e.DONE,d(e,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,e.addEventListener("unload",p,!1),g}(window.self),nbe.doc.create=function(e,t,n,r){var i;return i={},i.ids=e,i.server_status="unknown",i.state=nbe.doc.state_init(),i.n_operations_server=0,i.operations_local=[],i.local_storage=nbe.doc.local_storage(i,t),i.local_storage.read(),i.server_status==="unknown"&&e.new_doc&&(i.server_status="new",i.local_storage.write()),delete e.new_doc,i.editors=nbe.doc.editors(i),i.new_id=nbe.lib.new_id(),i.add_ops=function(e,t){var n;n={id:i.new_id(),ops:t},i.editors.notify(t,e,!0),i.operations_local.push(n),i.comm.notify(),i.local_storage.write()},i.comm=nbe.doc.comm(i,n,r),r("nunsaved",i.operations_local.length),i},nbe.doc.editors=function(e){var t,n,r,i;return t={},n=function(n,r,i){var s,o,u,a,f,l,c;s=[];for(f=0;f<e.operations_local.length;f++){o=e.operations_local[f].ops;for(l=0;l<o.length;l++)c=o[l],(r===c.editor_class||r==="text"&&!("editor_class"in c))&&s.push(c)}return r==="text"?(u=nbe.state.state_copy(e.state.text),nbe.state.update(null,u,null,s),a=nbe.editor.create(n,i,e),a.init(u)):r==="title"?(u=nbe.title.state_copy(e.state.title),a=nbe.title.create(n,i,e),a.init(u),a.add_external_ops(s,!1)):r==="publish"&&(u=nbe.publish.state_copy(e.state.publish),a=nbe.publish.create(n,e),a.init(u),a.add_external_ops(s,!1)),t[n]=a,a},r=function(e){delete t[e]},i=function(e,n,r){var i;for(i in t)t.hasOwnProperty(i)&&(n===null||n!==i)&&t[i].add_external_ops(e,r)},{add:n,remove:r,notify:i}},nbe.doc.local_storage=function(e,t){var n,r,i,s,o,u,a,f;return i=5e3,n=function(){return JSON.stringify({state:nbe.doc.state_serialize(e.state),server_status:e.server_status,n_operations_server:e.n_operations_server,operations_local:e.operations_local})},r=function(t){var n;n=JSON.parse(t),e.state=nbe.doc.state_deserialize(n.state),e.server_status=n.server_status,e.n_operations_server=n.n_operations_server,e.operations_local=n.operations_local},s=function(){return"/nbe/text/"+e.ids.id},o=function(){var e;e=localStorage.getItem(s()),e&&r(e)},f=function(){localStorage.setItem(s(),n())},a=null,u=function(){a===null&&(a=setTimeout(function(){f(),a=null},i))},t&&typeof localStorage=="object"?{read:o,write:u}:{read:function(){},write:function(){}}},nbe.doc.merge=function(e,t,n){var r,i,s,o,u;t=t.slice(e.n_operations_server-n);if(t.length!==0){e.n_operations_server=e.n_operations_server+t.length,nbe.doc.state_update(e.state,t);for(r=0;r<e.operations_local.length&&r<t.length;r++)if(t[r].id!==e.operations_local[r].id)break;e.operations_local=e.operations_local.slice(r),i=t.slice(r),i.length!==0&&(s={},i.forEach(function(e){s[e.id]=!0}),o=e.operations_local.filter(function(e){return!(e.id in s)}),u=[],e.operations_local.forEach(function(e){u=u.concat(e.ops)}),u=nbe.state.invert_ops(u),i.concat(o).forEach(function(e){u=u.concat(e.ops)}),e.editors.notify(u,null,!0))}},nbe.doc.html=function(e){var t,n,r,i,s;return t=e.editors.add("temp","title",{editable:!1,html_title:!1}),r=t.get_value(),e.editors.remove("temp"),n=e.editors.add("temp","text",{editable:!1}),i=n.get_html(),e.editors.remove("temp"),i=i.replace(/ data-id="[a-z0-9]+"/g,""),i=i.replace(/ style=""/g,""),s=["<!DOCTYPE html>",'<html lang="en">',"<head>",'<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />',"<title>",r,"</title>",'<style type="text/css">',nbe.css.publish,"</style>","</head>","<body>",'<div class="nbe editor">',i,"</div>","</body>","</html>"].join("\n"),s},nbe.doc.comm=function(e,t,n){var r,i,s,o,u,a,f,l,c;r=function(){l.send(JSON.stringify({type:"new",ids:e.ids}))},i=function(t){t.text==="created"?(e.server_status="established",e.local_storage.write(),u()):console.log("The id is already taken")},s=function(){l.send(JSON.stringify({type:"unknown",ids:e.ids}))},o=function(t){t.text==="noexist"?(l.close(),n("doc","noexist")):(e.state=nbe.doc.state_deserialize(t.state),e.n_operations_server=t.noperation,e.server_status="established",e.local_storage.write(),n("doc","exist"))},u=function(){l.send(JSON.stringify({type:"sync",ids:e.ids,noperations:e.n_operations_server,operations:e.operations_local})),n("nunsaved",e.operations_local.length)},a=function(t){var n;n=e.n_operations_server,nbe.doc.merge(e,t.operations,t.noperations),n!==e.n_operations_server&&u()},f=function(e){var t;t=JSON.parse(e);switch(t.type){case"new":i(t);break;case"unknown":o(t);break;case"invalid":l.close(),n("password","wrong password");break;case"sync":a(t)}},n("network","unconnected");if(t){l=nbe.doc.ws(t,f,n);if(l!==null)switch(e.server_status){case"new":r();break;case"unknown":s();break;case"established":u()}}return c=function(){t&&l!==null&&e.server_status==="established"&&u()},{notify:c}},nbe.doc.ws=function(e,t,n){var r,i,s,o,u,a,f,l;return typeof WebSocket=="undefined"&&typeof MozWebSocket!="function"?null:(r=!1,i=null,s=null,o="received",u=function(e){s=e,o==="received"&&l.readyState===l.OPEN&&(i=e,o="pending",l.send(e))},a=function(){r=!0,l.readyState!==l.CLOSED&&l.close()},f=function(){l=typeof WebSocket!="undefined"?new WebSocket(e):new MozWebSocket(e),l.onopen=function(){n("network","connected"),s!==null&&u(s)},l.onerror=function(){l.close()},l.onclose=function(){o="received",n("network","unconnected"),r||setTimeout(f,5e3)},l.onmessage=function(e){o="received",t(e.data),i!==s&&u(s)}},f(),{send:u,close:a})},nbe.doc.state_init=function(){return{text:nbe.state.deserialize(nbe.state.initial()),title:nbe.title.state_init(),publish:nbe.publish.state_init()}},nbe.doc.state_copy=function(e){return{text:nbe.state.deserialize(nbe.state.serialize(e.text)),title:nbe.title.state_copy(e.title),publish:nbe.publish.state_copy(e.publish)}},nbe.doc.state_update=function(e,t){var n;n={text:[],title:[],publish:[]},t.forEach(function(e){e.ops.forEach(function(e){var t;t="editor_class"in e?e.editor_class:"text",n[t].push(e)})}),nbe.state.update(null,e.text,null,n.text),nbe.title.state_update(e.title,n.title),nbe.publish.state_update(e.publish,n.publish)},nbe.doc.state_serialize=function(e){return JSON.stringify({text:nbe.state.serialize(e.text),title:e.title,publish:e.publish})},nbe.doc.state_deserialize=function(e){var t;return t=JSON.parse(e),{text:nbe.state.deserialize(t.text),title:t.title,publish:t.publish}},nbe.state.initial=function(){return JSON.stringify({nodes:{root:{type:"root",id:"root",parent:null,children:["line"],val:{}},line:{type:"line",id:"line",parent:"root",children:[],val:{}}}})},nbe.state.init=function(e,t){var n,r;e.state=t,e.dom=n={},n.root=nbe.state.element("root","root",t.nodes.root.val),r=function(e,t,i){var s,o;for(s=0;s<i.length;s++)o=i[s],n[o.id]=nbe.state.element(o.id,o.type,o.val),t==="line"?e.insertBefore(n[o.id],e.lastChild):e.appendChild(n[o.id]),r(n[o.id],o.type,o.children)},r(n.root,"root",t.nodes.root.children),nbe.state.reset_counter(e),e.mutation.disconnect();while(e.el_editor.firstChild)e.el_editor.removeChild(e.el_editor.firstChild);return e.el_editor.appendChild(n.root),e.mutation.observe(),e},nbe.state.clean=function(e){nbe.state.init(e,e.state),nbe.location.set(e,e.location)},nbe.state.update=function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p;i=t.nodes,s=i.root,o=function(e,t,r,s){var o,u;!(e in i)&&t in i&&(o={id:e,type:r,val:s,parent:i[t].parent,children:[]},i[e]=o,u=o.parent.children.indexOf(i[t]),o.parent.children=o.parent.children.slice(0,u).concat([o]).concat(o.parent.children.slice(u)),n&&(n[e]=nbe.state.element(e,r,s),n[i[t].parent.id].insertBefore(n[e],n[t])))},u=function(e,r,s,o){var u;!(e in i)&&r in i&&(u={id:e,type:s,val:o,parent:i[r],children:[]},i[e]=u,u.parent.children.push(u),n&&(n[e]=nbe.state.element(e,s,o)),u.parent.type==="line"?(n&&n[r].insertBefore(n[e],n[r].lastChild),nbe.state.line_font_size(t,n,r,"append")):n&&n[r].appendChild(n[e]))},a=function(e){var r,s;e in i&&(r=i[e],r.children.length===0&&(r.parent.type==="line"&&nbe.state.line_font_size(t,n,r.parent.id,"remove"),delete i[e],s=r.parent.children.indexOf(r),r.parent.children=r.parent.children.slice(0,s).concat(r.parent.children.slice(s+1)),n&&(n[r.parent.id].removeChild(n[e]),delete n[e])))},f=function(e,t){e in i&&(i[e].val=t,n&&nbe.state.mutate_element(n[e],i[e].type,t))},l=function(e,t,r,o,u){var a,f,l,c,h,p;a=i[e];if(!(t in i)&&a&&a.type==="line"){f={id:t,type:"line",val:u,parent:s,children:[]},i[t]=f,n&&(n[t]=nbe.state.element(t,"line",f.val)),l=s.children.indexOf(a),l===s.children.length-1?n&&n.root.appendChild(n[t]):n&&n.root.insertBefore(n[t],n[s.children[l+1].id]),s.children=s.children.slice(0,l+1).concat([f]).concat(s.children.slice(l+1)),r&&r in i&&i[r].parent===a?c=a.children.indexOf(i[r]):c=a.children.length;for(h=c;h<a.children.length;h++)p=a.children[h],p.parent=f,n&&(n[e].removeChild(n[p.id]),n[t].insertBefore(n[p.id],n[t].lastChild));f.children=a.children.slice(c),a.children=a.children.slice(0,c),a.val=o,n&&nbe.state.mutate_element(n[e],"line",o)}},c=function(e,t,r){var o,u,a,f,l;o=i[e];if(o&&o.type==="line"){u=s.children.indexOf(o);if(u<s.children.length-1){a=s.children[u+1];for(f=0;f<a.children.length;f++)l=a.children[f],l.parent=o,n&&(n[a.id].removeChild(n[l.id]),n[e].insertBefore(n[l.id],n[e].lastChild));n&&(n.root.removeChild(n[a.id]),delete n[a.id]),s.children=s.children.slice(0,u+1).concat(s.children.slice(u+2)),delete i[a.id],o.children=o.children.concat(a.children),o.val=nbe.state.line_val_merge(t,r),n&&nbe.state.mutate_element(n[e],"line",o.val)}}},n&&e.mutation.disconnect();for(h=0;h<r.length;h++)p=r[h],p.domop==="insert"?o(p.id,p.before,p.type,p.val):p.domop==="append"?u(p.id,p.parent,p.type,p.val):p.domop==="remove"?a(p.id):p.domop==="mutate"?f(p.id,p.after):p.domop==="split"?l(p.parent,p.child,p.point,p.parentval,p.childval):p.domop==="merge"&&c(p.parent,p.parentval,p.childval);n&&(nbe.state.reset_counter(e),e.mutation.observe())},nbe.state.element=function(e,t,n){var r,i;return r={root:"div",line:"div",text:"span",img:"img",link:"a"}[t],i=document.createElement(r),i.setAttribute("data-id",e),i.classList.add("wu-"+t),t==="line"&&i.appendChild(document.createElement("br")),nbe.state.mutate_element(i,t,n),i},nbe.state.mutate_element=function(e,t,n){var r,i;r=function(t){var r;for(r=0;r<t.length;r++)t[r]in n&&e.classList.add("wu-"+n[t[r]])},i=function(t){var n;for(n=0;n<t.length;n++)e.classList.remove("wu-"+t[n])};switch(t){case"root":break;case"line":i(nbe.state.line_classes),r(["heading","text_align","list","line_spacing"]),e.style.marginLeft=n.left_margin?n.left_margin+"px":"",e.style.fontSize=n.font_size||"";break;case"text":e.textContent=n.text,e.classList[n.bold?"add":"remove"]("wu-bold"),e.classList[n.italic?"add":"remove"]("wu-italic"),e.classList[n.underline?"add":"remove"]("wu-underline"),e.classList[n.strikethrough?"add":"remove"]("wu-strikethrough"),e.style.color=n.color||"",e.style.backgroundColor=n.background_color||"",e.style.fontFamily=n.font_family||"",e.style.verticalAlign=n.vertical_align||"",e.style.fontSize=n.vertical_align?n.font_size?.8*Number(n.font_size.slice(0,n.font_size.length-2))+"px":"80%":n.font_size||"";break;case"img":e.src=n.src||"","width"in n?e.width=n.width:e.removeAttribute("width"),"height"in n?e.height=n.height:e.removeAttribute("height"),e.title=n.title||"";break;case"link":e.href=n.href}return e},nbe.state.formats={text:["bold","italic","underline","strikethrough","color","background_color","font_family","font_size","vertical_align"],line:["heading","text_align","left_margin","line_spacing","list"],default_values:{bold:"off",italic:"off",underline:"off",strikethrough:"off",color:"rgb(0, 0, 0)",background_color:"transparent",font_family:"arial",font_size:"16px",vertical_align:"baseline",heading:"none",text_align:"left",left_margin:0,line_spacing:"line_spacing_16",list:"none",edit_img:null,edit_link:null},left_margin:{step:20,max:500},font_family:["arial","courier","helvetica","times","verdana"]},nbe.state.line_font_size=function(e,t,n,r){var i,s,o,u;i=e.nodes[n],t&&(s=t[n]),r==="remove"?i.children.length===1&&(o=i.children[0],o.type==="text"&&(u=o.val.font_size,u&&(i.val.font_size=u,t&&nbe.state.mutate_element(s,"line",i.val)))):i.val.font_size&&(delete i.val.font_size,t&&nbe.state.mutate_element(s,"line",i.val))},nbe.state.reset_counter=function(e){var t,n,r,i,s,o,u;t={disc:!0,"lower-alpha":!0,"lower-roman":!0,square:!0,"upper-alpha":!0,"upper-roman":!0,ordered:!0},n=null,r=e.state.nodes.root.children;for(i=0;i<r.length;i++)s=r[i],o=s.val.list,o&&o in t?o!==n?(n=o,u=!0):u=!1:(n=null,u=!1),u?e.dom[s.id].classList.add("wu-reset-counter"):e.dom[s.id].classList.remove("wu-reset-counter")},nbe.state.copy_text_format=function(e,t){var n,r,i;n=nbe.state.formats.text;for(r=0;r<n.length;r++)i=n[r],i in e?t[i]=e[i]:delete t[i];return t},nbe.state.copy_line_format=function(e,t){var n,r,i;n=nbe.state.formats.text.concat(nbe.state.formats.line);for(r=0;r<n.length;r++)i=n[r],i in e?t[i]=e[i]:delete t[i];return t},nbe.state.line_val_merge=function(e,t){var n,r;return n={},r=function(r){r in e?n[r]=e[r]:r in t&&(n[r]=t[r])},nbe.state.formats.text.concat(nbe.state.formats.line).forEach(function(e){r(e)}),"left_margin"in e?n.left_margin=e.left_margin:delete n.left_margin,n},nbe.state.cmp_value_format=function(e,t,n){return nbe.state.formats.default_values[e]===t?!(e in n):e in n&&n[e]===t},nbe.state.cmp_text_format=function(e,t){var n,r;n=function(n){return n in e&&n in t?e[n]===t[n]:n in e?nbe.state.formats.default_values[n]===e[n]:n in t?nbe.state.formats.default_values[n]===t[n]:!0};for(r=0;r<nbe.state.formats.text.length;r++)if(!n(nbe.state.formats.text[r]))return!1;return!0},nbe.state.set_format=function(e,t,n){return nbe.state.formats.default_values[e]===t?delete n[e]:n[e]=t,n},nbe.state.line_classes=["center","right","justify","heading1","heading2","heading3","heading4","heading5","heading6","disc","lower-alpha","lower-roman","square","upper-alpha","upper-roman","ordered","line_spacing_05","line_spacing_06","line_spacing_07","line_spacing_08","line_spacing_09","line_spacing_10","line_spacing_11","line_spacing_12","line_spacing_13","line_spacing_14","line_spacing_15","line_spacing_16","line_spacing_17","line_spacing_18","line_spacing_19","line_spacing_20"],nbe.state.invert_ops=function(e){var t,n,r;t=function(e){var t;if("editor_class"in e&&(e.editor_class==="title"||e.editor_class==="publish"))t={editor_class:e.editor_class,before:e.after,after:e.before};else if(e.domop==="insert")t={domop:"remove",id:e.id,before:e.before,type:e.type,val:e.val};else if(e.domop==="append")t={domop:"remove",id:e.id,parent:e.parent,type:e.type,val:e.val};else if(e.domop==="remove"&&"before"in e)t={domop:"insert",id:e.id,before:e.before,type:e.type,val:e.val};else if(e.domop==="remove"&&"parent"in e)t={domop:"append",id:e.id,parent:e.parent,type:e.type,val:e.val};else if(e.domop==="mutate")t={domop:"mutate",id:e.id,before:e.after,after:e.before};else if(e.domop==="split"||e.domop==="merge")t={domop:"merge",parent:e.parent,child:e.child,point:e.point,parentval:e.parentval,childval:e.childval},t.domop=e.domop==="split"?"merge":"split";return t},n=[];for(r=0;r<e.length;r++)n.push(t(e[r]));return n=n.reverse(),n},nbe.state.invert_oploc=function(e){var t;return t={ops:nbe.state.invert_ops(e.ops),loc_before:e.loc_after,loc_after:e.loc_before},t},nbe.state.left_margin=function(e,t){var n,r,i;return n=20,r=t.left_margin?t.left_margin:0,e==="increment"?i=r+n:i=r>=n?r-n:r,i>0?t.left_margin=i:delete t.left_margin,i!==r},nbe.state.serialize=function(e){var t,n,r,i,s,o;t={},n=e.nodes;for(r in n)if(n.hasOwnProperty(r)){i=n[r],s={type:i.type,id:i.id,val:i.val,children:[]},i.parent&&(s.parent=i.parent.id);for(o=0;o<i.children.length;o++)s.children[o]=i.children[o].id;t[r]=s}return JSON.stringify({nodes:t})},nbe.state.deserialize=function(e){var t,n,r,i,s,o;t={},n=JSON.parse(e).nodes;for(r in n)n.hasOwnProperty(r)&&(i=n[r],t[r]={type:i.type,id:i.id,val:i.val,children:[]});for(r in n)if(n.hasOwnProperty(r)){i=n[r],s=t[r],i.parent&&(s.parent=t[i.parent]);for(o=0;o<i.children.length;o++)s.children[o]=t[i.children[o]]}return{nodes:t}},nbe.state.state_copy=function(e){return nbe.state.deserialize(nbe.state.serialize(e))},nbe.location.get=function(e){var t,n,r,i;return t={},n=window.getSelection().getRangeAt(0),r=function(e,t){var n;return e.classList?n=e:n=e.parentNode,{container:n.getAttribute("data-id"),offset:t}},i=function(t){var n,r,i;if(t.container==="editor"){n=e.state.nodes.root;if(t.offset===0)return{container:n.children[0].id,offset:0};r=n;while(r.children.length>0)r=r.children[r.children.length-1];return{container:r.id,offset:r.type==="text"?r.val.text.length:1}}return t.container==="root"?{container:e.state.nodes.root.children[t.offset].id,offset:0}:(t.container in e.state.nodes&&(r=e.state.nodes[t.container],i=t.offset),i===0&&r.type==="line"?t:i===0?nbe.location.loc_previous(r).start:r.type==="line"||r.type==="link"?nbe.location.loc_end(r.children[i-1]):t)},t.start=i(r(n.startContainer,n.startOffset)),n.collapsed?t.collapsed=!0:(t.collapsed=!1,t.end=i(r(n.endContainer,n.endOffset))),e.location=t,t},nbe.location.set=function(e,t){var n,r,i,s,o;n=function(t,n){var r,i,s,o,u;return r=e.state.nodes[t],r?(r.type==="img"?(i=r.parent.id,s=r.parent.children.indexOf(r)+1):(i=t,s=n),o=e.dom[i],u=e.state.nodes[i],u.type==="text"&&(o=o.firstChild,s>u.val.length&&(s=u.val.length)),{container:o,offset:s}):null},e.mutation.disconnect(),t&&(r=n(t.start.container,t.start.offset),t.collapsed?i=r:i=n(t.end.container,t.end.offset),r&&i?(s=document.createRange(),s.setStart(r.container,r.offset),s.setEnd(i.container,i.offset),o=window.getSelection(),o.removeAllRanges(),o.addRange(s)):t=null),e.location=t,t?(nbe.location.focus(e),nbe.location.scroll(e),e.inputs.notify()):nbe.location.blur(e),e.mutation.observe()},nbe.location.focus=function(e){e.el_editor.focus()},nbe.location.scroll=function(e){var t,n,r,i,s,o,u,a,f;t=e.el_editor,n=t.parentNode.classList.contains("editor_container")?t.parentNode:t,r=function(e){var t;t=0;while(e)t+=e.offsetTop,e=e.offsetParent;return t},i=e.location.collapsed?e.location.start:e.location.end,s=e.dom[i.container],o=r(s),u=r(n),a=o-u,n.scrollTop>a?n.scrollTop=a:(f=a+s.offsetHeight-n.offsetHeight,n.scrollTop<f&&(n.scrollTop=f))},nbe.location.blur=function(e){e.el_editor.blur()},nbe.location.format=function(e){var t;return t={},nbe.location.format_line(e,t),nbe.location.format_text(e,t),nbe.location.format_img_link(e,t),e.format=t,e.inputs.notify(),t},nbe.location.format_update=function(e){return nbe.location.format_line(e,e.format),nbe.location.format_text(e,e.format),nbe.location.format_img_link(e,e.format),e.inputs.notify(),e.format},nbe.location.format_text=function(e,t){var n,r,i,s,o,u,a,f,l;return n=function(e){e=nbe.location.previous_node(e);while(e!==null&&e.type!=="text"&&e.type!=="line")e=nbe.location.previous_node(e);return e},r=function(e){e=nbe.location.next_node(e);while(e!==null&&e.type!=="text"&&e.type!=="line")e=nbe.location.next_node(e);return e},i=function(e){var t;return t=r(e),t&&t.type==="text"?t:e},s=function(e){var t,i;return t=n(e),t.type==="text"?t:(i=r(e),i&&i.type==="text"?i:t)},e.location===null?o={}:(u=e.location.collapsed?e.location.start:e.location.end,a=e.state.nodes[u.container],a.type==="text"&&u.offset>0?f=a:a.type==="text"?(l=nbe.location.previous_node(a),l.type==="text"?f=l:f=a):a.type==="line"?f=i(a):f=s(a),o=f.val),nbe.state.copy_text_format(o,t),t},nbe.location.format_line=function(e,t){var n,r,i,s;return n=function(e){while(e.type!=="line")e=e.parent;return e.val},e.location===null?r={}:(i=e.location.collapsed?e.location.start:e.location.end,s=e.state.nodes[i.container],r=n(s)),nbe.state.copy_line_format(r,t),t},nbe.location.format_img_link=function(e,t){var n,r,i,s,o,u,a,f,l;n=function(e){e&&e.type==="img"&&a===null&&(a=e),f===null&&(e&&e.type==="link"?f=e:e&&e.parent&&e.parent.type==="link"&&(f=e.parent))};if(e.location===null)return null;e.location.collapsed?(r=i=e.state.nodes[e.location.start.container],s=e.location.start.offset):(r=e.state.nodes[e.location.start.container],i=e.state.nodes[e.location.end.container],s=e.location.end.offset),o=i,u=!0,a=null,f=null;while(u)n(o),o===r?u=!1:o=nbe.location.previous_node(o);return i.type==="text"&&s<i.val.text.length||(l=nbe.location.next_node(i),n(l)),a&&(t.edit_img={id:a.id},nbe.lib.partial_copy(a.val,t.edit_img,["src","width","height","title"])),f&&(t.edit_link={id:f.id,href:f.val.href}),t},nbe.location.get_format=function(e){nbe.location.get(e),nbe.location.format(e)},nbe.location.previous_node=function(e){var t,n;return t=function(e){return e.children.length===0?e:t(e.children[e.children.length-1])},e.parent?(n=e.parent.children.indexOf(e),n>0?t(e.parent.children[n-1]):e.parent):null},nbe.location.next_node=function(e){var t;return t=function(e){var n;return e.parent?(n=e.parent.children.indexOf(e),n<e.parent.children.length-1?e.parent.children[n+1]:t(e.parent)):null},e.children.length===0?t(e):e.children[0]},nbe.location.insert_after=function(e,t){var n,r;return n=e.state.nodes[t],r=n.parent.children.indexOf(n),r<n.parent.children.length-1?{domop:"insert",before:n.parent.children[r+1].id}:{domop:"append",parent:n.parent.id}},nbe.location.parent_line=function(e,t){var n;n=e.state.nodes[t];while(n&&n.type!=="line")n=n.parent;return n},nbe.location.op_remove=function(e){var t,n;return t={domop:"remove",id:e.id,type:e.type,val:e.val},n=e.parent.children.indexOf(e),n===e.parent.children.length-1?t.parent=e.parent.id:t.before=e.parent.children[n+1].id,t},nbe.location.loc_previous=function(e){var t,n,r;return t=function(e){return e.type==="text"?{container:e.id,offset:e.val.text.length}:e.type==="link"?t(e.children[e.children.length-1]):e.type==="line"?e.children.length===0?{container:e.id,offset:0}:t(e.children[e.children.length-1]):{container:e.id,offset:1}},n=e.parent.children.indexOf(e),n>0?(r=e.parent.children[n-1],{start:t(r),collapsed:!0}):e.type==="line"?{start:{container:e.id,offset:0},collapsed:!0}:e.parent.type==="line"?{start:{container:e.parent.id,offset:0},collapsed:!0}:nbe.location.loc_previous(e.parent)},nbe.location.loc_end=function(e){return e.type==="text"?{container:e.id,offset:e.val.text.length}:e.type==="link"?nbe.location.loc_end(e.children[e.children.length-1]):e.type==="line"?e.children.length===0?{container:e.id,offset:0}:nbe.location.loc_end(e.children[e.children.length-1]):{container:e.id,offset:1}},nbe.location.line=function(e){while(e.type!=="line")e=e.parent;return e},nbe.location.lines=function(e){var t,n,r,i,s,o,u,a,f;return t=[],e.location&&(n=e.state.nodes,r=e.location.start,i=e.location.collapsed?r:e.location.end,s=nbe.location.parent_line(e,r.container),o=nbe.location.parent_line(e,i.container),u=s.parent.children,a=u.indexOf(s),f=u.indexOf(o),t=u.slice(a,f+1)),t},nbe.location.next_sibling=function(e){var t;return t=e.parent.children.indexOf(e),t<e.parent.children.length-1?e.parent.children[t+1]:null},nbe.location.previous_sibling=function(e){var t;return t=e.parent.children.indexOf(e),t>0?e.parent.children[t-1]:null},nbe.location.in_text=function(e){return e&&e.node.type==="text"&&e.offset<e.node.val.text.length&&e.offset>0},nbe.location.in_link=function(e){var t;return e.node.parent.type!=="link"?!1:(t=e.node.parent.children.indexOf(e.node),t===e.node.parent.children.length-1?e.node.type==="text"?nbe.location.in_text(e):!1:!0)},nbe.location.previous_location=function(e,t){var n,r,i,s;return n=function(e){return e.type==="text"?{container:e.id,offset:e.val.text.length}:e.type==="link"?n(e.children[e.children.length-1]):e.type==="line"?e.children.length===0?{container:e.id,offset:0}:n(e.children[e.children.length-1]):{container:e.id,offset:1}},r=e.state.nodes[t.container],r.type==="text"&&t.offset>1?{container:r.id,offset:t.offset-1}:r.type==="line"?(i=nbe.location.previous_sibling(r),i?n(i):t):r.parent.type==="line"?(i=nbe.location.previous_sibling(r),i?n(i):{container:r.parent.id,offset:0}):(i=nbe.location.previous_sibling(r),i?n(i):(s=nbe.location.previous_sibling(r.parent),s?n(s):{container:r.parent.parent.id,offset:0}))},nbe.location.first_child=function(e){return e.children.length===0?null:e.children[0]},nbe.location.last_child=function(e){return e.children.length===0?null:e.children[e.children.length-1]},nbe.location.split_merge_point=function(e){var t,n;return e.node.type==="line"?(n=nbe.location.first_child(e.node),t=!1):e.node.parent.type==="link"?(n=e.node.parent,t=!nbe.location.in_link(e)):(n=e.node,t=!nbe.location.in_text(e)),t&&(n=nbe.location.next_sibling(n)),n?n.id:null},nbe.location.loc_to_point=function(e,t){return{node:e.state.nodes[t.container],offset:t.offset}},nbe.location.item_to_loc=function(e){var t,n;return n=e.item,t=n.type==="text"?n.val.text.length:1,{container:e.id,offset:t}},nbe.location.text_nodes_in_line=function(e){var t,n,r,i;t=[];for(n=0;n<e.children.length;n++){r=e.children[n];if(r.type==="text")t.push(r);else if(r.type==="link")for(i=0;i<r.children.length;i++)r.children[i].type==="text"&&t.push(r.children[i])}return t},nbe.ops.append=function(e,t,n){var r,i,s,o,u,a;r=[],i=null,s=function(t,n,r){var o,u,a;for(o=0;o<r.length;o++)u=e.new_id(),a=r[o],t.push({domop:"append",id:u,parent:n,type:a.type,val:a.val}),i={id:u,item:a},s(t,u,a.children)};for(o=0;o<n.length;o++)u=n[o],a=e.new_id(),r.push({domop:"append",id:a,parent:t,type:u.type,val:u.val}),i={id:a,item:u},s(r,a,u.children);return r.length>0?{ops:r,loc:nbe.location.item_to_loc(i)}:null},nbe.ops.insert_before=function(e,t,n){var r,i,s,o,u,a;r=[],i=null,s=function(t,n,r){var o,u,a;for(o=0;o<r.length;o++)u=e.new_id(),a=r[o],t.push({domop:"append",id:u,parent:n,type:a.type,val:a.val}),i={id:u,item:a},s(t,u,a.children)};for(o=0;o<n.length;o++)u=n[o],a=e.new_id(),r.push({domop:"insert",id:a,before:t,type:u.type,val:u.val}),i={id:a,item:u},s(r,a,u.children);return r.length>0?{ops:r,loc:nbe.location.item_to_loc(i)}:null},nbe.ops.insert_after=function(e,t,n){var r,i;return r=e.state.nodes[t],i=nbe.location.next_sibling(r),i?nbe.ops.insert_before(e,i.id,n):nbe.ops.append(e,r.parent,n)},nbe.ops.remove=function(e){var t,n;return t=function(e,t){var n;return n=e.parent.children.indexOf(e),n===e.parent.children.length-1?t.parent=e.parent.id:t.before=e.parent.children[n+1].id,t},n=function(e,r){var i;for(i=0;i<e.children.length;i++)n(e.children[i],r);return r.push(t(e,{domop:"remove",id:e.id,type:e.type,val:e.val})),r},n(e,[])},nbe.ops.text=function(e,t,n,r){var i,s,o,u,a,f;return i=t?t.node:n.node,s={domop:"mutate",id:i.id,before:i.val,after:nbe.lib.clone(i.val)},o=[s],u=null,r?(s.after.text=i.val.text.slice(n.offset),t&&(a={domop:"insert",id:e.new_id(),before:i.id,type:"text",val:nbe.lib.clone(i.val)},a.val.text=i.val.text.slice(0,t.offset),o.push(a),u={container:a.id,offset:t.offset}),f=nbe.ops.insert_before(e,i.id,r),f&&(o=o.concat(f.ops),f.loc&&(u=f.loc))):(s.after.text=(t?i.val.text.slice(0,t.offset):"")+(n?i.val.text.slice(n.offset):""),u=t?{container:i.id,offset:t.offset}:null),{ops:o,loc:u}},nbe.ops.link=function(e,t,n,r){var i,s,o,u,a,f,l,c,h;i=function(e){var t,n;t=[];for(n=0;n<e.length;n++)e[n].type!=="link"?t.push(e[n]):t=t.concat(e[n].children);return t},r&&(r=i(r)),s=t?t.node.parent:n.node.parent,o=t?s.children.indexOf(t.node)+1:0,n?(u=!nbe.location.in_text(n),a=s.children.indexOf(n.node)+(u?1:0)):(u=!0,a=s.children.length),f=[],l=null;if(a<o)c=nbe.ops.text(e,t,n,r),f=f.concat(c.ops),l=c.loc;else{nbe.location.in_text(t)?(c=nbe.ops.text(e,t,null,null),f=f.concat(c.ops),l=c.loc):l=t?{container:t.node.id,offset:t.offset}:null;for(h=o;h<a;h++)f=f.concat(nbe.ops.remove(s.children[h]));u?r&&(c=nbe.ops.insert_after(e,n.node.id,r),c&&(f=f.concat(c.ops),c.loc&&(l=c.loc))):(c=nbe.ops.text(e,null,n,r),f=f.concat(c.ops),c.loc&&(l=c.loc))}return{ops:f,loc:l}},nbe.ops.line=function(e,t,n,r){var i,s,o,u,a,f,l,c,h;t?t.node.type==="line"?(i=t.node,s=0,o=null):t.node.parent.type==="line"?(i=t.node.parent,s=i.children.indexOf(t.node)+1,o=nbe.location.in_text(t)?t.node:null):t.node.parent.type==="link"&&(i=t.node.parent.parent,s=i.children.indexOf(t.node.parent)+1,o=nbe.location.in_link(t)?t.node.parent:null):(s=0,o=null),n?n.node.type==="line"?(i=n.node,u=0,a=null):n.node.parent.type==="line"?(i=n.node.parent,u=i.children.indexOf(n.node)+(nbe.location.in_text(n)?0:1),a=nbe.location.in_text(n)?n.node:null):n.node.parent.type==="link"&&(i=n.node.parent.parent,u=i.children.indexOf(n.node.parent)+(nbe.location.in_link(n)?0:1),a=nbe.location.in_link(n)?n.node.parent:null):(u=i.children.length,a=null),f=[],l=t?{container:t.node.id,offset:t.offset}:{container:i.id,offset:0};if(u<s)o.type==="text"?c=nbe.ops.text(e,t,n,r):c=nbe.ops.link(e,t,n,r),f=f.concat(c.ops),c.loc&&(l=c.loc);else{o&&(o.type==="text"?c=nbe.ops.text(e,t,null,null):c=nbe.ops.link(e,t,null,null),f=f.concat(c.ops),c.loc&&(l=c.loc));for(h=s;h<u;h++)f=f.concat(nbe.ops.remove(i.children[h]));c=null,a?a.type==="text"?c=nbe.ops.text(e,null,n,r):c=nbe.ops.link(e,null,n,r):r&&(u===i.children.length?c=nbe.ops.append(e,i.id,r):u===0&&n.node.children.length>0?c=nbe.ops.insert_before(e,n.node.children[0].id,r):c=nbe.ops.insert_after(e,n.node.id,r)),c&&(f=f.concat(c.ops),c.loc&&(l=c.loc))}return{ops:f,loc:l}},nbe.ops.root=function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b;i=nbe.location.line(t.node),s=nbe.location.line(n.node),o=i.parent,u=o.children.indexOf(i),a=o.children.indexOf(s),f=[],l=null,c=function(e){e&&(f=f.concat(e.ops),e.loc&&(l=e.loc))},h=function(e){e&&(f=f.concat(e.ops))};if(u===a)r===null?c(nbe.ops.line(e,t,n,null)):r.length===1?c(nbe.ops.line(e,t,n,r[0].children)):(h(nbe.ops.line(e,t,n,r[0].children)),p=e.new_id(),m=nbe.location.split_merge_point(n),d=nbe.lib.clone(i.val),v=nbe.state.copy_line_format(e.format,{}),t.node===i?delete d.heading:delete v.heading,f.push({domop:"split",parent:i.id,child:p,point:m,parentval:d,childval:v}),l={container:p,offset:0},m?c(nbe.ops.insert_before(e,m,r[r.length-1].children)):c(nbe.ops.append(e,p,r[r.length-1].children)),h(nbe.ops.insert_before(e,p,r.slice(1,r.length-1))));else{for(g=u+1;g<a;g++)f=f.concat(nbe.ops.remove(o.children[g]));r===null?(c(nbe.ops.line(e,t,null,null)),h(nbe.ops.line(e,null,n,null)),f.push({domop:"merge",parent:i.id,child:s.id,point:nbe.location.split_merge_point(n),parentval:i.val,childval:s.val})):r.length===1?(c(nbe.ops.line(e,t,null,null)),y=r[0].children,c(nbe.ops.line(e,null,n,y)),b=y.length===0?nbe.location.split_merge_point(n):y[0].id,f.push({domop:"merge",parent:i.id,child:s.id,point:b,parentval:i.val,childval:s.val})):(h(nbe.ops.line(e,t,null,r[0].children)),h(nbe.ops.insert_before(e,s.id,r.slice(1,r.length-1))),c(nbe.ops.line(e,null,n,r[r.length-1].children)))}return{ops:f,loc:l}},nbe.ops.modified=function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p;n=e.state.nodes,r=function(e,t){var i,u,a;i=n[e];for(u=0;u<i.children.length;u++)a=i.children[u],s(a.id)?t=t.concat(nbe.ops.remove(a)):a.type==="text"?t=o(a,t):a.type==="link"&&(t=r(a.id,t));return t},i=function(t){var n;n=e.dom[t];while(n!==null&&(!n.getAttribute||n.getAttribute("data-id")!=="root"))n=n.parentNode;return n!==null},s=function(t){return i(t)?n[t].type==="text"?e.dom[t].textContent==="":!1:!0},o=function(t,n){var r,i;return r=e.dom[t.id],t.val.text!==r.textContent&&(i={domop:"mutate",id:t.id,before:t.val,after:nbe.lib.clone(t.val)},i.after.text=r.textContent,n.push(i)),n},u=function(t,r){var i,o,u,a,f,l,c,h,p,d,v;if(s(t))return r;i=e.dom[t],o=function(e,r){var i;return e.childNodes.length===r?null:(i=e.childNodes[r],i.getAttribute&&i.getAttribute("data-id")?(t=i.getAttribute("data-id"),n[t].type==="text"&&i.textContent===""?o(e,r+1):t):o(e,r+1))},u=function(e,t){var n;return t===-1?null:(n=e.childNodes[t],n.getAttribute&&n.getAttribute("data-id")?n.getAttribute("data-id"):u(e,t-1))},a=function(e,t){var r,i,s,a;return r=null,i=u(e,t),i&&(s=n[i],s.type==="text"&&(r=nbe.lib.clone(s.val))),r===null&&(a=o(e,t),a&&(s=n[a],s.type==="text"&&(r=nbe.lib.clone(s.val)))),r===null?{}:r};for(f=0;f<i.childNodes.length;f++){l=i.childNodes[f];if(!l.classList||!l.classList.contains("nbe"))c=l.textContent,c!==""&&(h=a(i,f),h.text=c,p=e.new_id(),d={id:p,type:"text",val:h},v=o(i,f),v?(d.domop="insert",d.before=v):(d.domop="append",d.parent=t),r.push(d))}return r},a=function(e,t){var i,s,o;i=n[e],t=r(e,t),t=u(e,t);for(s=0;s<i.children.length;s++)o=i.children[s],o.type==="link"&&(t=u(o.id,t));return t},f=function(){var t,r,i;return t=null,e.location&&(t={container:e.location.start.container,offset:e.location.start.offset},s(t.container)?t=null:(r=n[t.container],r.type==="text"&&(i=e.dom[t.container],t.offset=Math.min(t.offset+1,i.textContent.length)))),t},l=[];for(c=0;c<t.length;c++)l=a(t[c],l);return h=f(),h?p={ops:l,loc:h}:p={ops:l,loc_after:null},p},nbe.events.add_event_listeners=function(e){var t;t=e.el_editor,t.addEventListener("click",function(t){nbe.location.get_format(e)},!1),t.addEventListener("touchend",function(t){setTimeout(function(){nbe.location.get_format(e)},0)},!1),t.addEventListener("keydown",function(t){if(t.which&&t.keyCode>=37&&t.keyCode<=40)nbe.location.get_format(e);else if(t.keyCode===8)e.trigger("delete",null),t.preventDefault();else if(t.keyCode===9)e.trigger("tab",null),t.preventDefault();else if(t.keyCode===13)e.trigger("newline",null),t.preventDefault();else if(t.ctrlKey||t.metaKey)t.keyCode===65?(e.trigger("select",null),t.preventDefault()):t.keyCode===86?e.trigger("paste",null):t.keyCode!==88&&t.keyCode===90&&(e.trigger("undo",t.shiftKey?"redo":"undo"),t.preventDefault())},!1),t.addEventListener("keypress",function(t){var n;t.charCode===0&&t.keyCode>=37&&t.keyCode<=40?nbe.location.get_format(e):!t.ctrlKey&&!t.metaKey&&t.keyCode!==8&&t.keyCode!==9&&t.keyCode!==13&&(n=String.fromCharCode(t.charCode?t.charCode:t.which),e.trigger("text",n),t.preventDefault())},!1),t.addEventListener("keyup",function(t){t.keyCode>=37&&t.keyCode<=40&&nbe.location.get_format(e)},!1),t.addEventListener("mousedown",function(e){},!1),t.addEventListener("mouseup",function(t){nbe.location.get_format(e)},!1),t.addEventListener("mouseout",function(e){},!1),t.addEventListener("focus",function(t){e.focus=!0},!1),t.addEventListener("blur",function(t){e.focus=!1},!1),t.addEventListener("select",function(t){e.trigger("select",null)},!1),t.addEventListener("paste",function(t){e.trigger("paste",null)},!1),t.addEventListener("cut",function(t){e.trigger("cut",null)},!1),e.mutation=nbe.events.observer(e),e.mutation.supported||(e.mutation=nbe.events.subtree(e))},nbe.events.observer=function(e){var t,n,r,i,s,o;return t=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,n=typeof t!="undefined",n&&(r=new t(function(t){e.trigger("observer",t)})),i={childList:!0,characterData:!0,subtree:!0},s=function(){r.observe(e.el_editor,i)},o=function(){r.disconnect()},{observe:s,disconnect:o,supported:n}},nbe.events.subtree=function(e){var t,n,r,i,s;return t=!1,n=[],r=null,e.el_editor.addEventListener("DOMSubtreeModified",function(i){t&&(n.push(i),r||(r=setTimeout(function(){e.trigger("subtree",n),r=null,n=[]},0)))},!1),i=function(){t=!0},s=function(){t=!1},{observe:i,disconnect:s,supported:!0}},nbe.triggers.trigger=function(e,t,n){var r,i;switch(t){case"text":r=nbe.triggers.text(e,n);break;case"insertion":r=nbe.triggers.insertion(e,n);break;case"bold":case"underline":case"italic":case"strikethrough":case"color":case"background_color":case"font_family":case"vertical_align":case"font_size":case"heading":case"text_align":case"line_spacing":case"list":r=nbe.triggers.format(e,t,n);break;case"left_margin":r=nbe.triggers.left_margin(e,n);break;case"tab":r=nbe.triggers.tab(e);break;case"delete":r=nbe.triggers.del(e);break;case"newline":r=nbe.triggers.newline(e);break;case"img":r=nbe.triggers.img(e,n);break;case"link":r=nbe.triggers.link(e,n);break;case"cut":nbe.triggers.cut(e),r="break";break;case"paste":nbe.triggers.paste(e),r="break";break;case"undo":e.undo.trigger("undo",n),r=null;break;case"observer":r=nbe.triggers.observer(e,n);break;case"subtree":r=nbe.triggers.subtree(e,n);break;case"select":nbe.triggers.select(e),r="break";break;default:r=null}return r==="break"?r:r===null||r.ops.length===0?null:(i="loc_after"in r?r.loc_after:{start:r.loc,collapsed:!0},{ops:r.ops,loc_before:e.location,loc_after:i})},nbe.triggers.format=function(e,t,n){return nbe.state.set_format(t,n,e.format),e.location===null?null:e.location.collapsed?nbe.triggers.format_collapsed(e,t,n):nbe.state.formats.text.indexOf(t)!==-1?nbe.triggers.text_format(e,t,n):nbe.triggers.line_format(e,t,n)},nbe.triggers.format_collapsed=function(e,t,n){var r,i,s,o,u,a;r=nbe.location.parent_line(e,e.location.start.container),i=[];if(!nbe.state.cmp_value_format(t,n,r.val)&&(nbe.state.formats.text.indexOf(t)!==-1&&r.children.length===0||nbe.state.formats.line.indexOf(t)!==-1)){s={domop:"mutate",id:r.id,before:r.val},s.after=nbe.state.set_format(t,n,nbe.state.copy_line_format(r.val,{})),i.push(s);if(t==="heading"&&n!=="none"){o=nbe.location.text_nodes_in_line(r);for(u=0;u<o.length;u++)a=o[u],nbe.state.cmp_value_format("font_size",nbe.state.formats.default_values.font_size,a.val)||(s={domop:"mutate",id:a.id,before:a.val},s.after=nbe.state.set_format("font_size",nbe.state.formats.default_values.font_size,nbe.state.copy_text_format(a.val,{})),s.after.text=a.val.text,i.push(s));delete s.after.list}}return{ops:i,loc_after:e.location}},nbe.triggers.text_format=function(e,t,n){var r,i,s,o,u,a,f,l,c;return nbe.state.set_format(t,n,e.format),e.location===null||e.location.collapsed?null:(r=e.state.nodes,i=e.location.start,s=e.location.end,o={start:i,end:s,collapsed:!1},u=function(i,s,u){var a,f,l,c,h,p;return a=[],f=r[i],f.type==="text"&&!nbe.state.cmp_value_format(t,n,f.val)&&(l=u==="infinite"?f.val.text.length:u,s!==l&&(c={domop:"mutate",id:i,before:f.val},c.after=nbe.state.set_format(t,n,nbe.state.copy_text_format(f.val,{})),c.after.text=f.val.text.slice(s,l),a.push(c),u!=="infinite"&&(o.end={container:i,offset:l-s}),s>0&&(h={domop:"insert",id:e.new_id(),before:i,type:"text",val:nbe.state.copy_text_format(f.val,{})},h.val.text=f.val.text.slice(0,s),a.push(h),o.start={container:h.id,offset:s}),l<f.val.text.length&&(p=nbe.location.insert_after(e,i),p.id=e.new_id(),p.type="text",p.val=nbe.state.copy_text_format(f.val,{}),p.val.text=f.val.text.slice(l),a.push(p)))),a},a=function(e,i){var s,o,u;s=[],o=nbe.location.previous_node(r[i]);while(o&&o.id!==e)o.type==="text"&&!nbe.state.cmp_value_format(t,n,o.val)&&(u={domop:"mutate",id:o.id,before:o.val},u.after=nbe.state.set_format(t,n,nbe.state.copy_text_format(o.val,{})),u.after.text=o.val.text,s.push(u)),o=nbe.location.previous_node(o);return s},f=function(r,i){var s,o;return s=nbe.location.lines(e),o=[],s.forEach(function(e){var r;nbe.state.cmp_value_format(t,n,e.val)||(r={domop:"mutate",id:e.id,before:e.val},r.after=nbe.state.set_format(t,n,nbe.state.copy_line_format(e.val,{})),o.push(r))}),o},i.container===s.container?(l=u(i.container,i.offset,s.offset),c={container:i.container,offset:s.offset-i.offset}):(l=u(i.container,i.offset,"infinite"),l=l.concat(u(s.container,0,s.offset)),l=l.concat(a(i.container,s.container)),l=l.concat(f(i.container,s.container)),c=s),{ops:l,loc_after:o})},nbe.triggers.line_format=function(e,t,n){var r,i;return r=nbe.location.lines(e),i=[],r.forEach(function(e){var r;nbe.state.cmp_value_format(t,n,e.val)||(r={domop:"mutate",id:e.id,before:e.val},r.after=nbe.state.set_format(t,n,nbe.state.copy_line_format(e.val,{})),i.push(r),t==="heading"&&n!=="none"&&(nbe.location.text_nodes_in_line(e).forEach(function(e){nbe.state.cmp_value_format("font_size",nbe.state.formats.default_values.font_size,e.val)||(r={domop:"mutate",id:e.id,before:e.val},r.after=nbe.state.set_format("font_size",nbe.state.formats.default_values.font_size,nbe.state.copy_text_format(e.val,{})),r.after.text=e.val.text,i.push(r))}),delete r.after.list))}),{ops:i,loc_after:e.location}},nbe.triggers.left_margin=function(e,t){var n,r;return e.location===null?null:(n=nbe.location.lines(e),r=[],n.forEach(function(e){var n,i,s;n="left_margin"in e.val?e.val.left_margin:0,i=n+(t==="increment"?1:-1)*nbe.state.formats.left_margin.step,i>=0&&i<=nbe.state.formats.left_margin.max&&(s={domop:"mutate",id:e.id,before:e.val},s.after=nbe.state.set_format("left_margin",i,nbe.state.copy_line_format(e.val,{})),r.push(s))}),{ops:r,loc_after:e.location})},nbe.triggers.text=function(e,t){var n,r,i,s,o;return e.location?(n=e.location,n.collapsed?nbe.triggers.text_collapsed(e,t):(r=nbe.location.loc_to_point(e,n.start),i=nbe.location.loc_to_point(e,n.end),s=nbe.state.copy_text_format(e.format,{}),s.text=t,o=[{type:"line",val:{},children:[{type:"text",val:s,children:[]}]}],nbe.ops.root(e,r,i,o))):null},nbe.triggers.text_collapsed=function(e,t){var n,r,i,s,o,u;return n=10,r=nbe.location.loc_to_point(e,e.location.start),i=r.node,i.type==="text"&&i.val.text.length<n&&(r.offset<i.val.text.length||i.parent.type==="line")&&nbe.state.cmp_text_format(i.val,e.format)?(s={domop:"mutate",id:i.id,before:i.val,after:nbe.state.copy_text_format(i.val,{})},s.after.text=i.val.text.slice(0,r.offset)+t+i.val.text.slice(r.offset),{ops:[s],loc:{container:i.id,offset:r.offset+t.length}}):(o=nbe.state.copy_text_format(e.format,{}),o.text=t,u=[{type:"line",val:{},children:[{type:"text",val:o,children:[]}]}],nbe.ops.root(e,r,r,u))},nbe.triggers.del=function(e){var t,n,r,i,s;return e.location?(t=e.location,n=e.state.nodes[t.start.container],n.type==="line"&&"left_margin"in n.val&&t.collapsed?nbe.triggers.left_margin(e,"decrement"):(t.collapsed?(r=nbe.location.previous_location(e,t.start),i=nbe.location.loc_to_point(e,r),s=nbe.location.loc_to_point(e,t.start)):(i=nbe.location.loc_to_point(e,t.start),s=nbe.location.loc_to_point(e,t.end)),nbe.ops.root(e,i,s,null))):null},nbe.triggers.tab=function(e){var t,n;return e.location?(t=e.state.nodes[e.location.start.container],t.type==="line"?n=nbe.triggers.left_margin(e,"increment"):n=nbe.triggers.text(e," "),n):null},nbe.triggers.newline=function(e){var t,n,r,i;return e.location?(t=e.location,t.collapsed?n=r=nbe.location.loc_to_point(e,t.start):(n=nbe.location.loc_to_point(e,t.start),r=nbe.location.loc_to_point(e,t.end)),i=[{type:"line",val:{},children:[]},{type:"line",val:{},children:[]}],nbe.ops.root(e,n,r,i)):null},nbe.triggers.img=function(e,t){var n,r,i,s,o,u,a,f;return"id"in t&&t.id in e.state.nodes?(n=e.state.nodes[t.id],r={domop:"mutate",id:t.id,before:n.val,after:nbe.lib.clone(t)},delete r.after.id,i={ops:[r],loc_after:e.location}):e.location?(s=e.location,s.collapsed?o=u=nbe.location.loc_to_point(e,s.start):(o=nbe.location.loc_to_point(e,s.start),u=nbe.location.loc_to_point(e,s.end)),a=nbe.lib.clone(t),f=[{type:"line",val:{},children:[{type:"img",val:a,children:[]}]}],i=nbe.ops.root(e,o,u,f)):i=null,i},nbe.triggers.link=function(e,t){var n,r,i,s,o,u,a,f;return"id"in t&&t.id in e.state.nodes?(n=e.state.nodes[t.id],r={domop:"mutate",id:t.id,before:n.val,after:{href:t.href}},i={ops:[r],loc_after:e.location}):e.location?(s=e.location,s.collapsed?o=u=nbe.location.loc_to_point(e,s.start):(o=nbe.location.loc_to_point(e,s.start),u=nbe.location.loc_to_point(e,s.end)),a={type:"link",val:{href:t.href},children:t.insertion},f=[{type:"line",val:{},children:[a]}],i=nbe.ops.root(e,o,u,f)):i=null,i},nbe.triggers.paste=function(e){var t;t=function(t){e.trigger("insertion",t)},nbe.paste.clipboard(t)},nbe.triggers.cut=function(e){e.mutation.disconnect(),setTimeout(function(){nbe.state.clean(e),e.location.collapsed||e.trigger("delete",null),e.mutation.observe()},0)},nbe.triggers.select=function(e){var t,n,r,i;t=nbe.location.last_child(e.state.nodes.root),n=nbe.location.next_node(t);while(n!==null)t=n,n=nbe.location.next_node(t);t.type==="text"?r=t.val.text.length:t.type==="line"?r=0:r=1,i={start:{container:"line",offset:0},end:{container:t.id,offset:r},collapsed:!1},nbe.location.set(e,i)},nbe.triggers.insertion=function(e,t){var n,r,i;return e.location?(n=e.location,n.collapsed?r=i=nbe.location.loc_to_point(e,n.start):(r=nbe.location.loc_to_point(e,n.start),i=nbe.location.loc_to_point(e,n.end)),nbe.ops.root(e,r,i,t)):null},nbe.triggers.observer=function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p,d;return n=e.state.nodes,r=e.dom,i=[],s=[],o=[],u=function(e,t){var n;return n=e.indexOf(t),n===-1&&e.push(t),n===-1},a=function(e,t){var n;return n=e.indexOf(t),n!==-1&&e.splice(n,1),n!==-1},f=function(e){u(i,e)},l=function(e){var t;t=a(i,e),t||u(s,e)},c=function(e){i.indexOf(e)===-1&&u(o,e)},t.forEach(function(e){var t;if(e.type==="characterData")c(e.target);else if(e.type==="childList"){for(t=0;t<e.addedNodes.length;t++)f(e.addedNodes[t]);for(t=0;t<e.removedNodes.length;t++)l(e.removedNodes[t])}}),h=function(e,t){var n;while(e!==null&&(!e.classList||!e.classList.contains("line")))e=e.parentNode;e&&(n=e.getAttribute("data-id"),t[n]=!0)},p={},i.concat(s).concat(o).forEach(function(e){h(e,p)}),d=nbe.ops.modified(e,Object.keys(p)),nbe.state.clean(e),d},nbe.triggers.subtree=function(e,t){var n,r,i,s;n=function(e,t){while(e!==null&&(!e.classList||!e.classList.contains("line")))e=e.parentNode;return e!==null&&(t[e.getAttribute("data-id")]=!0),t},r={};for(i=0;i<t.length;i++)n(t[i].target?t[i].target:null,r);return s=nbe.ops.modified(e,Object.keys(r)),nbe.state.clean(e),s},nbe.editor.create=function(e,t,n){var r,i,s,o;return r=document.createElement("div"),r.classList.add("wu-editor"),r.setAttribute("data-id","editor"),i=function(e,t){e=e.filter(function(e){return!("editor_class"in e)}),nbe.state.update(o,o.state,o.dom,e),o.focus&&t&&nbe.location.set(o,o.location)},s=function(e){nbe.state.init(o,e),o.location=null},o={id:e,state:null,dom:null,location:null,format:{},inputs:null,undo:null,trigger:null,el_editor:r,get_html:function(){return r.innerHTML},init:s,focus:!1,add_internal_oploc:null,add_external_ops:i,new_id:null,mutation:{observe:function(){},disconnect:function(){}}},t.editable&&(r.contentEditable=!0,o.new_id=nbe.lib.new_id(),o.inputs=nbe.notify.inputs(o),o.undo=nbe.editor.undo(o),o.observer=nbe.events.observer(o),o.add_internal_oploc=function(t){n.add_ops(e,t.ops),nbe.state.update(o,o.state,o.dom,t.ops),nbe.location.set(o,t.loc_after),nbe.location.format_update(o)},o.trigger=function(e,t){var n;o.focus=!0,n=nbe.triggers.trigger(o,e,t),n!==null&&n!=="break"?(o.add_internal_oploc(n),o.undo.add_oploc(n)):n===null&&(nbe.location.set(o,o.location),o.inputs.notify())},nbe.events.add_event_listeners(o)),o},nbe.editor.undo=function(e){var t,n,r,i,s,o,u,a;return t=[],n=[],r=[],i=function(e){r.push(e),o()},s=function(e){var t;t=r.indexOf(e),t!==-1&&(r=r.splice(t,1))},o=function(){var e,i;e={undo:t.length!==0,redo:n.length!==0};for(i=0;i<r.length;i++)r[i].set_value(e)},u=function(e){t.push(e),n=[],o()},a=function(r,i){var s,u;i==="undo"&&t.length!==0?(s=t.pop(),n.push(s),u=nbe.state.invert_oploc(s),e.add_internal_oploc(u),nbe.location.format_update(e)):i==="redo"&&n.length!==0&&(s=n.pop(),t.push(s),e.add_internal_oploc(s)),o()},{add_button:i,remove_button:s,add_oploc:u,trigger:a}},nbe.notify.inputs=function(e){var t,n,r,i,s;return t={},n=function(e,n){e in t&&t[e].indexOf(n)===-1?t[e].push(n):t[e]=[n]},r=function(e,n){var r,i;r=t[e],r&&(i=r.indexOf(n),i!==-1&&(t[e]=r.slice(0,i).concat(r.slice(i+1))))},s=function(n,r){var i;n==="left_margin"&&"left_margin"in t&&(r=nbe.notify.left_margin(e));for(i=0;i<(n in t?t[n].length:0);i++)t[n][i].set_value(r)},i=function(){var t;for(t in nbe.state.formats.default_values)nbe.state.formats.default_values.hasOwnProperty(t)&&s(t,t in e.format?e.format[t]:nbe.state.formats.default_values[t])},{add:n,remove:r,notify:i}},nbe.notify.left_margin=function(e,t){var n,r,i;return n="off",r="off",i=nbe.location.lines(e),i.forEach(function(e){var t;t="left_margin"in e.val?e.val.left_margin:0,r=t<nbe.state.formats.left_margin.max?"on":r,n=t>0?"on":n}),n+":"+r},nbe.paste.clipboard=function(e){var t,n,r;t=document.createElement("div"),t.contentEditable=!0,t.className="clipboard",n=document.createRange(),n.setStart(t,0),n.setEnd(t,0),r=window.getSelection(),r.removeAllRanges(),r.addRange(n),document.body.appendChild(t),t.focus(),setTimeout(function(){var n;n=nbe.paste.insertion(t),document.body.removeChild(t),e(n)},0)},nbe.paste.insertion=function(e){var t,n,r;return t={type:"line",val:{},children:[]},n={root:[t],line:t,link:null,format:{}},n=nbe.paste.traverse(n,e),r=[],Object.keys(n.root[0].val).length!==0&&r.push({type:"line",val:{},children:[]}),r=r.concat(n.root),Object.keys(n.root[n.root.length-1].val).length!==0&&r.push({type:"line",val:{},children:[]}),r},nbe.paste.traverse=function(e,t){var n,r;for(n=0;n<t.childNodes.length;n++){r=t.childNodes[n];switch(r.nodeName){case"DIV":case"div":case"P":case"p":case"H1":case"h1":case"H2":case"h2":case"H3":case"h3":case"H4":case"h4":case"H5":case"h5":case"H6":case"h6":e=nbe.paste.div(e,r);break;case"SPAN":case"span":e=nbe.paste.span(e,r);break;case"A":case"a":e=nbe.paste.link(e,r);break;case"IMG":case"img":e=nbe.paste.img(e,r);break;case"#text":case"#TEXT":e=nbe.paste.text(e,r);break;case"BR":case"br":e=nbe.paste.br(e,r);break;case"STYLE":case"style":break;default:e=nbe.paste.remaining(e,r)}}return e},nbe.paste.div=function(e,t){var n,r,i,s,o,u;n=e.format,r=nbe.lib.clone(n),i=function(e,n){var i;for(i=0;i<n.length;i++)if(t.classList.contains(n[i]))return r[e]=n[i],null},i("text_align",["center","right","justify"]),i("heading",["heading1","heading2","heading3","heading4","heading5","heading6"]),i("list",["disc","lower-alpha","lower-roman","square","upper-alpha","upper-roman","ordered"]),i("line_spacing",["line_spacing_05","line_spacing_06","line_spacing_07","line_spacing_08","line_spacing_09","line_spacing_10","line_spacing_11","line_spacing_12","line_spacing_13","line_spacing_14","line_spacing_15","line_spacing_16","line_spacing_17","line_spacing_18","line_spacing_19","line_spacing_20"]),t.style.marginLeft&&(s=Number(t.style.marginLeft.slice(0,t.style.marginLeft.length-2)),s>=0&&(r.left_margin=s)),t.style.fontSize&&(r.font_size=t.style.fontSize);switch(t.align){case"LEFT":case"left":delete r.text_align;break;case"RIGHT":case"right":r.text_align="right";break;case"CENTER":case"center":r.text_align="center";break;case"JUSTIFY":case"justify":r.text_align="justify"}switch(t.nodeName){case"H1":case"h1":r.heading="heading1";break;case"H2":case"h2":r.heading="heading2";break;case"H3":case"h3":r.heading="heading3";break;case"H4":case"h4":r.heading="heading4";break;case"H5":case"h5":r.heading="heading5";break;case"H6":case"h6":r.heading="heading6"}return o=nbe.state.copy_line_format(r,{}),e.line.children.length===0?e.line.val=o:(u={type:"line",val:o,children:[]},e.root.push(u),e.line=u),e.format=r,e=nbe.paste.traverse(e,t),e.format=n,e},nbe.paste.span=function(e,t){var n,r,i,s,o,u;return n=e.format,r=nbe.lib.clone(n),i=function(e){var n;for(n=0;n<e.length;n++)t.classList.contains(e[n])&&(r[e[n]]="on")},i(["bold","italic","underline","strikethrough"]),s=function(e){return e.slice(0,4)==="rgb("},t.style.color&&s(t.style.color)&&(r.color=t.style.color),t.style.backgroundColor&&s(t.style.backgroundColor)&&(r.background_color=t.style.backgroundColor),o=function(e){var n;for(n=0;n<e.length;n++)t.style[e[n].style]&&(r[e[n].key]=t.style[e[n].style])},o([{key:"vertical_align",style:"verticalAlign"}]),r.vertical_align?t.style.fontSize.slice(-2)==="px"&&(r.font_size=1.25*Number(t.style.fontSize.slice(0,t.style.fontSize.length-2))+"px"):o([{key:"font_size",style:"fontSize"}]),t.style.fontFamily&&(u=t.style.fontFamily.toLowerCase(),nbe.state.formats.font_family.indexOf(u)!==-1&&(r.font_family=u)),e.format=r,e=nbe.paste.traverse(e,t),e.format=n,e},nbe.paste.link=function(e,t){var n,r;return n={href:t.href},r={type:"link",val:n,children:[]},e.line.children.push(r),e.link=r,e=nbe.paste.traverse(e,t),e.link=null,e},nbe.paste.img=function(e,t){var n,r,i;return n={},r=function(e){var r;for(r=0;r<e.length;r++)t[e[r]]&&(n[e[r]]=t[e[r]])},r(["src","width","height","title"]),i={type:"img",val:n,children:[]},e.link?e.link.children.push(i):e.line.children.push(i),e},nbe.paste.text=function(e,t){var n,r;return n=nbe.state.copy_text_format(e.format,{}),n.text=t.textContent,r={type:"text",val:n,children:[]},e.link?e.link.children.push(r):e.line.children.push(r),e},nbe.paste.br=function(e,t){var n;return n={type:"line",val:{},children:[]},e.root.push(n),e.line=n,e},nbe.paste.remaining=function(e,t){var n,r;n=e.format,r=nbe.lib.clone(n);switch(t.nodeName){case"STRONG":case"strong":case"B":case"b":r.bold="on";break;case"I":case"i":r.italic="on";break;case"U":case"u":r.underline="on"}return e.format=r,e=nbe.paste.traverse(e,t),e.format=n,e},kite.browser.dom={},kite.browser.dom.eac=function(e,t,n){var r=document.createElement(e);return r.className=n,t.appendChild(r),r},kite.browser.dom.ec=function(e,t){var n=document.createElement(e);return n.className=t,n},kite.browser.dom.ea=function(e,t){var n=document.createElement(e);return t.appendChild(n),n},kite.browser.dom.input=function(e,t,n,r,i,s,o){var u,a,f,l;u=document.createElement("input"),a=["type","id","name","value","className","placeholder"];for(f=0;f<a.length;f++)l=a[f],arguments[f]&&u.setAttribute(l,arguments[f]);return o&&o.appendChild(u),u},kite.browser.dom.select_option=function(e,t,n){var r;return r=kite.browser.dom.ea("option",n),r.value=e,r.innerHTML=t,r},kite.browser.dom.removeChildNodes=function(e){while(e.hasChildNodes())e.removeChild(e.firstChild)},kite.browser.dom.has_parent=function(e,t){while(e.parentNode){if(e.parentNode===t)return!0;e=e.parentNode}return!1},kite.browser.dom.text=function(e,t){return e.appendChild(document.createTextNode(t)),e},kite.browser.dom.svg=function(e,t,n,r,i,s){var o;return o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("version","1.2"),o.setAttribute("baseProfile","tiny"),i&&o.setAttribute("class",i),e&&o.setAttribute("x",e+"px"),t&&o.setAttribute("y",t+"px"),r&&o.setAttribute("height",r+"px"),n&&o.setAttribute("width",n+"px"),r&&n&&o.setAttribute("viewBox",(e?e+" ":"0 ")+(t?t+" ":"0 ")+" "+r+" "+n),s.appendChild(o),o},kite.browser.dom.ns=function(e,t,n){var r=document.createElementNS("http://www.w3.org/2000/svg",e);return t&&t.appendChild(r),n&&r.setAttribute(n[0],n[1]),r},kite.browser.ui={},kite.browser.ui.Window_core=function(){var e,t,n,r;e=this,this.close_handler=null,this.close_on="",this.is_open=!1,this.close_function=null,this.element=kite.browser.dom.ec("div","window window_light"),this.header=kite.browser.dom.ec("div","window_header header_light"),this.container=kite.browser.dom.ec("div","container"),t=new kite.browser.ui.Move(e.element,{}),this.header.addEventListener("mousedown",function(n){n.target===e.header&&t.drag_start(n,{})},!1),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,this.check_dimensions_position=function(t){if(n!==document.documentElement.clientWidth||r!==document.documentElement.clientHeight)e.position(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight},this.action=function(e,t){return!0}},kite.browser.ui.Window_core.prototype.set_content=function(e){this.container.appendChild(e)},kite.browser.ui.Window_core.prototype.set_title=function(e){this.header!==undefined&&kite.browser.dom.text(this.header,e)},kite.browser.ui.Window_core.prototype.set_close_handler=function(e){this.close_handler=e},kite.browser.ui.Window_core.prototype.open=function(e){var t=this;kite.browser.ui.set_opacity(this.element,1),this.cover&&document.body.appendChild(this.cover),document.body.appendChild(this.element),this.close_function=function(n){!kite.browser.dom.is_element_child(t.element,n.target)&&!kite.browser.dom.is_element_child(e,n.target)&&t.close()},this.close_on==="out"?this.element.addEventListener("mouseout",this.close_function,!1):this.close_on==="click"&&document.body.addEventListener("mousedown",this.close_function,!1),this.element.style.left=document.documentElement.clientWidth/2-this.element.offsetWidth/2+"px",this.position(e),this.is_open=!0,window.addEventListener("resize",this.check_dimensions_position,!1),document.body.addEventListener("orientationchange",this.check_dimensions_position,!1)},kite.browser.ui.Window_core.prototype.size=function(){this.element.style.width="auto",this.element.offsetWidth>=window.innerWidth-20?this.element.style.width=window.innerWidth-20+"px":this.element.style.width="auto",this.element.style.height="auto",this.element.offsetHeight>=document.documentElement.clientHeight-20?this.element.style.height=document.documentElement.clientHeight-20+"px":this.element.style.height="auto"},kite.browser.ui.Window_core.prototype.position=function(e){var t,n,r;this.size(),e?(t=kite.browser.ui.get_offset(e),n=t.left+e.offsetWidth/2-this.element.offsetWidth/2,n+this.element.offsetWidth>window.innerWidth?this.element.style.left=window.innerWidth-this.element.offsetWidth+"px":n<0?this.element.style.left="0px":this.element.style.left=n+"px",this.action(e,t)):(window.scrollTo(0,0),r=(document.documentElement.clientHeight-this.element.offsetHeight)/2,r<0&&(r=0),this.element.style.top=r+"px",n=(window.innerWidth-this.element.offsetWidth)/2,n<0&&(n=0),this.element.style.left=n+"px")},kite.browser.ui.Window_core.prototype.close=function(){var e=this;this.is_open&&(kite.browser.animation.Fade_out(e.element,{duration:50,fps:50,callback:function(){document.body.removeChild(e.element)}}),e.cover&&document.body.removeChild(e.cover),this.close_on==="out"?this.element.removeEventListener("mouseout",this.close_function,!1):this.close_on==="click"&&document.body.removeEventListener("mousedown",this.close_function,!1),this.close_function=null,this.is_open=!1,window.removeEventListener("resize",this.check_dimensions_position,!1),document.body.removeEventListener("orientationchange",this.check_dimensions_position,!1))},kite.browser.ui.Window_core.prototype.terminate=function(){this.close(),this.close_handler!==null&&this.close_handler()},kite.browser.ui.Window_core.prototype.insert_close_button=function(){var e=this;this.close_button=kite.browser.dom.eac("img",kite.browser.dom.eac("div",this.header,"close_div"),"close_button"),this.close_button.src="/public/inlund/img/close.png",this.close_button.addEventListener("click",function(t){e.terminate()},!1)},kite.browser.ui.Window_core.prototype.insert_footer=function(e){var t,n,r;t=this,this.footer=kite.browser.dom.eac("div",e,"window_footer_light"),n=kite.browser.dom.eac("img",t.footer,"window_resize"),n.src="/public/inlund/img/resize.png",r=kite.browser.ui.Resize(t.container,{}),n.addEventListener("mousedown",function(e){r.drag_start(e,{})},!1)},kite.browser.ui.Window=function(){var e=new kite.browser.ui.Window_core;return e.element.appendChild(e.container),e},kite.browser.ui.Dialog=function(){var e=new kite.browser.ui.Window_core;return e.container.className="container_dark",e.cover=kite.browser.dom.ec("div","dialog_cover"),e.cover.addEventListener("click",function(t){kite.browser.animation.shake(e.element,null)},!1),e.element.appendChild(e.container),e},kite.browser.ui.confirm=function(e,t,n,r){var i,s,o,u,a,f;i=new kite.browser.ui.Dialog,i.set_title(e),s=kite.browser.dom.ec("div","confirm_content"),s.textContent=t,o=kite.browser.dom.eac("div",s,"overflow_hidden"),o.style.marginTop="10px";for(u=0,a=n.length;u<a;u++)f=kite.browser.dom.eac("button",o,"float_left"),f.textContent=n[u],f.id=n[u];i.set_content(s),o.addEventListener("click",function(e){e.target.id&&(r&&r(e.target.id),i.close())},!1),i.open()},kite.browser.ui.Confirm=function(e,t,n,r){var i,s,o,u,a,f;i=new kite.browser.ui.Dialog,i.set_title(e),s=kite.browser.dom.ec("div","confirm_content"),s.textContent=t,o=kite.browser.dom.eac("div",s,"overflow_hidden"),o.style.marginTop="10px";for(u=0,a=n.length;u<a;u++)f=kite.browser.dom.eac("button",o,"float_left"),f.textContent=n[u],f.id=n[u];return i.set_content(s),o.addEventListener("click",function(e){e.target.id&&(r&&r(e.target.id),i.close())},!1),i},kite.browser.ui.Pop_up=function(){var e,t,n,r;return e=new kite.browser.ui.Window_core,e.close_on="click",e.element.style.backgroundImage="none",e.container.className="container_radius_bottom",e.element.appendChild(e.header),e.element.appendChild(e.container),e.insert_close_button(),t=kite.browser.dom.eac("div",e.element,"pop_up_arrow_space"),n=kite.browser.dom.eac("div",t,"pop_up_arrow_container"),r=kite.browser.dom.ea("img",n),r.src="/public/inlund/img/pop_up_arrow.png",e.action=function(t,n){e.element.style.top=n.top+"px",kite.browser.animation.Slide_up(e.element,{duration:100,padding:1,callback:function(){e.size()}})},e},kite.browser.ui.Drop_down=function(){var e=new kite.browser.ui.Window_core;return e.close_on="click",e.container.className="container_radius_no_padding",e.element.appendChild(e.container),e.action=function(t,n){e.element.style.top=n.top+t.offsetHeight+"px",kite.browser.animation.Slide_down(e.element,{duration:100,padding:1,callback:function(){e.size()}})},e},kite.browser.ui.get_offset=function(e){var t,n;t=e.offsetLeft,n=e.offsetTop,e=e.offsetParent;while(e)t+=e.offsetLeft,n+=e.offsetTop,e=e.offsetParent;return{left:t,top:n}},kite.browser.ui.set_opacity=function(e,t){e.style.opacity=t,e.style.filter="alpha(opacity = "+t*100+")"},kite.browser.ui.cursor_position=function(e){return{x:e.clientX+window.scrollX,y:e.clientY+window.scrollY}},kite.browser.ui.Move_resize_core=function(e,t){this.options={},this.drag={element:e,container:e.parentNode,direction:null,padding:0,step_size:1},this.change_options(t)},kite.browser.ui.Move_resize_core.prototype.drag_start=function(e,t){var n,r,i;e.preventDefault(),n=this,n.drag_callback=t.drag_callback?t.drag_callback:function(){},r=kite.browser.ui.cursor_position(e),this.drag.antagonist&&(this.drag.start_width_antagonist=this.drag.antagonist.offsetWidth,this.drag.start_height_antagonist=this.drag.antagonist.offsetHeight),this.drag.start_width=this.drag.element.offsetWidth,this.drag.start_height=this.drag.element.offsetHeight,this.drag.start_left=this.drag.element.offsetLeft,this.drag.start_top=this.drag.element.offsetTop,this.drag.max_offset_left=this.options.max_offset_left-this.drag.padding||-5e3,this.drag.max_offset_right=this.options.max_offset_right-this.drag.padding||(this.drag.container?this.drag.container.offsetWidth-this.drag.padding:5e3),this.drag.max_offset_top=this.options.max_offset_top-this.drag.padding||0,this.drag.max_offset_bottom=this.options.max_offset_bottom-this.drag.padding||(this.drag.container?this.drag.container.offsetHeight-this.drag.padding:5e3),this.drag.cursor_start_x=r.x,this.drag.cursor_start_y=r.y,i=function(e){document.removeEventListener("mousemove",n.go,!1),document.removeEventListener("mouseup",i,!1),t.stop_callback&&t.stop_callback()},document.addEventListener("mousemove",this.go,!1),document.addEventListener("mouseup",i,!1)},kite.browser.ui.Move_resize_core.prototype.change_options=function(e){var t;for(t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t],this.drag[t]=e[t])},kite.browser.ui.Move=function(e,t){var n;return n=new kite.browser.ui.Move_resize_core(e,t),n.go=function(e){var t,r;t=kite.browser.ui.cursor_position(e),e.preventDefault();if(n.drag.direction!=="vertical"){r=n.drag.start_left+kite.browser.ui.cursor_position(e).x-n.drag.cursor_start_x;if(r<n.drag.max_offset_left)n.drag.element.style.left=n.drag.max_offset_left+"px";else if(r<n.drag.max_offset_right)n.drag.element.style.left=r+"px";else if(r>n.drag.max_offset_right||t.x>0)n.drag.element.style.left=n.drag.max_offset_right+"px"}n.drag.direction!=="horizontal"&&(r=n.drag.start_top+kite.browser.ui.cursor_position(e).y-n.drag.cursor_start_y,r<n.drag.max_offset_top?n.drag.element.style.top=n.drag.max_offset_top+"px":r<n.drag.max_offset_bottom?n.drag.element.style.top=r+"px":r>n.drag.max_offset_bottom&&(n.drag.element.style.top=n.drag.max_offset_bottom+"px")),n.drag.move_callback&&n.drag.move_callback(e)},n},kite.browser.ui.Resize=function(e,t){var n;return n=new kite.browser.ui.Move_resize_core(e,t),n.go=function(e){var t,r,i,s;e.preventDefault(),t=kite.browser.ui.cursor_position(e),r=1,i=null,s=null,n.drag.reverse&&(r=-1),n.drag.direction!=="vertical"&&t.x+15<=document.documentElement.clientWidth&&t.x>0&&(i=n.drag.start_width+(t.x-n.drag.cursor_start_x)*r,n.drag.element.style.width=i+"px",n.drag.antagonist&&(n.drag.antagonist.style.width=n.drag.start_width_antagonist+(t.x-n.drag.cursor_start_x)*-1*r+"px")),n.drag.direction!=="horizontal"&&t.y+15<=document.documentElement.clientHeight&&t.y>0&&(s=n.drag.start_height+(t.y-n.drag.cursor_start_y)*r,n.drag.element.style.height=s+"px",n.drag.antagonist&&(n.drag.antagonist.style.height=n.drag.start_height+(t.y-n.drag.cursor_start_y)*-1*r+"px")),n.drag_callback&&n.drag_callback(e,i,s)},n},"use strict",kite.browser.animation={},kite.browser.animation.Core=function(e){var t;this.options={duration:200,fps:100,from:0,to:200,padding:0};for(t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.options.element2&&(this.options.element2.start_width=this.options.element2.start_width||this.options.element2.element.offsetWidth,this.options.element2.padding=this.options.element2.padding||0),this.start_on=0,this.finish_on=this.start_on-this.options.duration,this.from_to_delta=this.options.to-this.options.from,this.total_time=this.finish_on-this.start_on,this.total_frames=this.options.fps*(this.options.duration/1e3)},kite.browser.animation.Core.prototype.render=function(){var e,t,n;e=this,t=1,n=function(){e.action(t),t<e.total_frames?(t+=1,setTimeout(n,1e3/e.options.fps)):(e.end(),e.options.callback&&e.options.callback())},setTimeout(n,1e3/this.options.fps)},kite.browser.animation.Hide_up=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.target_height=n.options.target_height||e.offsetHeight,n.target_top=n.options.target_top||e.offsetTop-n.target_height,n.start_top=e.offsetTop},n.end=function(){e.style.top=n.target_top+"px"},n.action=function(t){var r=Math.round(t/n.total_frames*n.target_height);e.style.top=n.start_top-r+"px"},n.init(),n.render()},kite.browser.animation.Slide_up=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.target_height=n.options.target_height||e.offsetHeight,n.target_top=n.options.target_top||e.offsetTop-n.target_height,n.start_top=e.offsetTop,e.style.height="0px",e.style.overflow="hidden"},n.end=function(){e.style.top=n.target_top+"px",e.style.overflow="visible",e.style.height="auto"},n.action=function(t){var r=Math.round(t/n.total_frames*n.target_height);e.offsetHeight<n.target_height&&(e.style.height=r-n.options.padding*2+"px"),e.style.top=n.start_top-r+"px"},n.init(),n.render()},kite.browser.animation.Slide_down=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.target_height=n.options.target_height||e.offsetHeight,n.child=e.firstChild,n.target_top=0,n.start_child_top=-1*n.target_height,n.child.style.position="relative",n.child.style.top=n.start_child_top+"px",e.style.height="0px",e.style.overflow="hidden"},n.top=function(e){window.innerHeight<e.offsetTop+e.offsetHeight&&(e.style.top=window.innerHeight-e.offsetHeight+"px")},n.end=function(){n.child.style.top=n.target_top+"px",e.style.overflow="visible",e.style.height="auto",n.top(e)},n.action=function(t){var r,i;r=Math.round(t/n.total_frames*n.target_height),e.offsetHeight<n.target_height&&(i=r-n.options.padding*2,e.style.height=i+"px",n.top(e),n.child.style.top=n.start_child_top+r-n.options.padding+"px")},n.init(),n.render()},kite.browser.animation.Slide_in_right=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.start_width=n.options.start_width||e.offsetWidth,n.target_width=n.options.target_width||0},n.end=function(){e.style.width=n.target_width+"px"},n.action=function(t){var r=Math.round(t/n.total_frames*n.start_width);e.offsetWidth>n.target_width&&(e.style.width=n.start_width-r-n.options.padding*2+"px",n.options.element2&&(n.options.element2.element.style.width=n.options.element2.start_width+r-n.options.element2.padding*2+"px"))},n.init(),n.render()},kite.browser.animation.Slide_out_left=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.start_width=n.options.start_width||e.offsetWidth,n.target_width=n.options.target_width||0},n.end=function(){e.style.width=n.target_width+"px"},n.action=function(t){var r=Math.round(t/n.total_frames*n.target_width);e.offsetWidth<n.target_width&&(e.style.width=r-n.options.padding*2+"px",n.options.element2&&(n.options.element2.element.style.width=n.options.element2.start_width-r-n.options.element2.padding*2+"px"))},n.init(),n.render()},kite.browser.animation.Resize=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.target_height=n.options.target_height>=0?n.options.target_height:e.offsetHeight,n.target_width=n.options.target_width>=0?n.options.target_width:e.offsetWidth,n.start_height=n.options.start_height>=0?n.options.start_height:e.offsetHeight,n.start_width=n.options.start_width>=0?n.options.start_width:e.offsetWidth},n.end=function(){t.target_height>=0&&(e.style.height=n.target_height+"px"),t.target_width>=0&&(e.style.width=n.target_width+"px")},n.action=function(r){var i=r/n.total_frames;t.target_height>=0&&n.start_height!==n.target_height&&(e.style.height=Math.round(n.start_height+i*(n.target_height-n.start_height))+"px"),t.target_width>=0&&n.start_width!==n.target_width&&(e.style.width=Math.round(n.start_width+i*(n.target_width-n.start_width))+"px")},n.init(),n.render()},kite.browser.animation.Fade_out=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.start=1,n.target=0},n.end=function(){e.style.opacity=n.target},n.action=function(t){e.style.opacity=n.start-t/n.total_frames},n.init(),n.render()},kite.browser.animation.Fade_in=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.start=0,n.target=1,e.style.display="block"},n.end=function(){e.style.opacity=n.target},n.action=function(t){e.style.opacity=t/n.total_frames*n.target},n.init(),n.render()},kite.browser.animation.Highlight=function(e,t){var n,r;n=new kite.browser.animation.Core(t),n.init=function(){n.start_rgb=t.start_rgb,n.target_rgb={r:t.target_rgb.r-t.start_rgb.r,g:t.target_rgb.g-t.start_rgb.g,b:t.target_rgb.b-t.start_rgb.b}},n.end=function(){e.style.backgroundColor=""},n.action=function(t){r=t/n.total_frames,e.style.backgroundColor="rgb("+Math.ceil(r*n.target_rgb.r+n.start_rgb.r)+","+Math.ceil(r*n.target_rgb.g+n.start_rgb.g)+","+Math.ceil(r*n.target_rgb.b+n.start_rgb.b)+")"},n.init(),n.render()},kite.browser.animation.Scroll=function(e,t){var n=new kite.browser.animation.Core(t);n.init=function(){n.start=e.scrollLeft},n.end=function(){e.scrollLeft=t.to},n.action=function(r){e.scrollLeft=n.start+(t.to-n.start)/n.total_frames*r},n.init(),n.render()},kite.browser.animation.shake=function(e,t){var n,r,i,s,o;n=e.offsetLeft,r=5,i=0,s=1,o=setInterval(function(){e.style.left=e.offsetLeft+r*s+"px",i+=r*s;if(i>=20||i<=-20)s*=-1},10),setTimeout(function(){clearInterval(o),e.style.left=n+"px",t&&t()},400)},nbe.browser.icon.network=function(e){var t,n,r,i;return t="You offline",n=kite.browser.dom.ea("div",e),n.title=t,r=kite.browser.dom.svg(-8,-8,48,48,"circle_button",n),i=kite.browser.dom.ns("polygon",r,["points","32,0 8,16 14,20 0,32 24,20 18,16"]),{on:function(){i.setAttribute("fill","lightgreen"),n.title="You are online"},off:function(){i.setAttribute("fill","red"),n.title=t}}},nbe.browser.icon.saved=function(e){var t,n,r,i,s;return t="The document is saved",n=kite.browser.dom.ea("div",e),n.title=t,r=kite.browser.dom.svg(-8,-8,48,48,"circle_button",n),i=kite.browser.dom.ns("path",r,["d","M24,4c-0.375,0-0.738,0.062-1.102,0.109C21.504,1.648,18.926,0,16,0c-2.988,0-5.568,1.664-6.941,4.102C8.707,4.055,8.357,4,8,4c-4.412,0-8,3.586-8,8s3.588,8,8,8h16c4.414,0,8-3.586,8-8S28.414,4,24,4z M24,16H8c-2.205,0-4-1.797-4-4c0-2.195,1.943-3.883,4.004-3.945C8.012,9,8.176,9.922,8.504,10.797l3.746-1.398C12.084,8.953,12,8.484,12,8c0-2.203,1.795-4,4-4c1.295,0,2.463,0.641,3.201,1.641C17.27,7.102,16,9.395,16,12h4c0-2.203,1.797-4,4-4s4,1.797,4,4S26.203,16,24,16z"]),s=kite.browser.dom.ns("polygon",r,["points","18.002,26 22,26 16.004,20 10.002,26 14.002,26 14.002,32 18.002,32"]),{on:function(){i.setAttribute("fill","lightgreen"),s.setAttribute("fill","lightgreen"),n.title=t},off:function(){i.setAttribute("fill","red"),s.setAttribute("fill","red"),n.title="The document is not saved"}}},nbe.browser.icon.exporticon=function(e){var t,n,r,i;return t=kite.browser.dom.ea("div",e),t.title="Export",n=kite.browser.dom.svg(-16,-11,56,56,"circle_button",t),r=kite.browser.dom.ns("rect",n,["y","27.43"]),r.style.fill="#FFFFFF",r.setAttribute("width",24),r.setAttribute("height",4.57),i=kite.browser.dom.ns("polygon",n,["points","16,18.285 16,0 8,0 8,18.285 4,18.285 12.012,27.43 20,18.285"]),i.style.fill="#FFFFFF",t},nbe.inputs.color_menu=function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S;s=!1,o=document.body,u=kite.browser.dom.ec("div","wu-menu wu-color_menu"),u.addEventListener("click",function(e){var t;t=e.target.getAttribute("data-color"),t&&S(t)},!1),a=i,f={},l=function(e,t){var n;return n=kite.browser.dom.eac("div",t,"wu-color_swatch"),n.style.backgroundColor=e,n.setAttribute("data-color",e),n},c=kite.browser.dom.eac("div",u,"wu-color_default"),h=function(e){var t;v.value!==""&&m.value!==""&&g.value!==""?(t="rgb("+v.value+", "+m.value+", "+g.value+")",d.style.backgroundColor=t,S(t)):S(i)},p=kite.browser.dom.eac("div",u,"wu-color_custom"),d=kite.browser.dom.eac("div",p,"wu-color_swatch"),d.addEventListener("click",function(e){h(e)},!1),kite.browser.dom.ea("span",p).textContent="R:",v=kite.browser.dom.ea("input",p),v.addEventListener("keyup",h,!1),kite.browser.dom.ea("span",p).textContent="G:",m=kite.browser.dom.ea("input",p),m.addEventListener("keyup",h,!1),kite.browser.dom.ea("span",p).textContent="B:",g=kite.browser.dom.ea("input",p),g.addEventListener("keyup",h,!1),f[t]=l(t,c),y=kite.browser.dom.ea("span",c),y.textContent=n,y.setAttribute("data-color",t);for(b=0;b<r.length;b++)f[r[b]]=l(r[b],u);return w=function(){s=!1,o.removeChild(u),document.body.removeEventListener("click",E,!1),e(a)},E=function(e){e.target!==v&&e.target!==m&&e.target!==g&&w()},S=function(e){f[a]&&f[a].classList.remove("wu-selected"),d.classList.remove("wu-selected"),d.style.backgroundColor="transparent",f[e]?f[e].classList.add("wu-selected"):(d.classList.add("wu-selected"),d.style.backgroundColor=e),a=e},{display:function(e,t,n){var r,i;s=!0,o.appendChild(u),i=kite.browser.ui.get_offset(t),u.style.left=i.left-u.offsetWidth/2+t.offsetWidth/2+"px",u.style.top=i.top+t.offsetHeight+"px",document.body.addEventListener("click",E,!1),S(n),f[n]?v.value!==""&&m.value!==""&&g.value!==""&&(d.style.backgroundColor="rgb("+v.value+", "+m.value+", "+g.value+")"):(r=n.match(/^rgb\((\d+), (\d+), (\d+)\)$/),v.value=r[1],m.value=r[2],g.value=r[3])},remove:w,is_open:function(){return s}}},nbe.inputs.input=function(e,t){var n,r,i;return n=t?[t]:[],r=function(e){var t,r;r=!0;for(t=0;t<n.length;t++)n[t]===e&&(r=!1);r&&n.push(e)},i=function(e){var t;for(t=0;t<n.length;t++)n[t]===e&&n.splice(t,1)},{editors:n,add_trigger:r,remove_trigger:i,trigger:function(t){var r;for(r=0;r<n.length;r++)n[r](e,t)},get_triggers:function(){return n}}},nbe.inputs.button=function(e,t,n,r,i){var s,o,u,a;return s=nbe.inputs.input(e,r),o=null,u=kite.browser.dom.eac("button",n,"wu-icon wu-icon-"+e+" off"),u.title=t,a=function(t){o!==t&&(o=t,u.className="wu-icon wu-icon-"+e+" "+o)},a(i),u.addEventListener("click",function(){s.trigger(o==="off"?"on":"off")}),s.element=u,s.set_value=a,s},nbe.inputs.bold=function(e,t,n,r){var i;return i=nbe.inputs.button("bold",t,n,e,r),i.element.textContent="B",i},nbe.inputs.italic=function(e,t,n,r){var i;return i=nbe.inputs.button("italic",t,n,e,r),i.element.textContent="I",i},nbe.inputs.underline=function(e,t,n,r){var i;return i=nbe.inputs.button("underline",t,n,e,r),i.element.textContent="U",i},nbe.inputs.strikethrough=function(e,t,n,r){var i;return i=nbe.inputs.button("strikethrough",t,n,e,r),i.element.textContent="S",i},nbe.inputs.color=function(e,t,n,r){var i,s,o,u,a;return i=nbe.inputs.input("color",e),s=null,o=kite.browser.dom.eac("button",n,"wu-icon off"),o.title=t,o.textContent="A",u=nbe.inputs.color_menu(function(e){i.trigger(e)},"rgb(0, 0, 0)","Black",["rgb(255, 200, 200)","rgb(255, 200, 75)","rgb(255, 255, 200)","rgb(200, 255, 0)","rgb(200, 255, 200)","rgb(150, 255, 225)","rgb(200, 255, 255)","rgb(135, 240, 255)","rgb(100, 175, 255)","rgb(235, 120, 255)","rgb(255, 100, 200)","rgb(224,224,224)","rgb(255, 150, 150)","rgb(255, 175, 50)","rgb(255, 255, 150)","rgb(175, 255, 0)","rgb(150, 255, 150)","rgb(100, 255, 200)","rgb(150, 255, 255)","rgb(80, 235, 255)","rgb(0, 150, 255)","rgb(200, 80, 255)","rgb(237, 0, 175)","rgb(192,192,192)","rgb(255, 100, 100)","rgb(255, 150, 25)","rgb(255, 255, 100)","rgb(150, 255, 0)","rgb(100, 255, 100)","rgb(50, 255, 175)","rgb(100, 255, 255)","rgb(50, 220, 255)","rgb(0, 100, 255)","rgb(175, 40, 255)","rgb(218, 0, 150)","rgb(160,160,160)","rgb(255, 0, 0)","rgb(255, 125, 0)","rgb(255, 255, 0)","rgb(125, 255, 0)","rgb(0, 255, 0)","rgb(0, 255, 150)","rgb(0, 255, 255)","rgb(0, 200, 255)","rgb(0, 0, 255)","rgb(150, 0, 255)","rgb(200, 0, 125)","rgb(128,128,128)","rgb(200 ,0, 0)","rgb(200, 100, 0)","rgb(200, 200, 0)","rgb(100, 200, 0)","rgb(0, 200, 0)","rgb(0, 200, 125)","rgb(0, 200, 200)","rgb(0, 170, 225)","rgb(0, 0, 200)","rgb(125, 0, 200)","rgb(170, 0, 105)","rgb(96,96,96)","rgb(150, 0, 0)","rgb(150, 75, 0)","rgb(150, 150, 0)","rgb(75, 150, 0)","rgb(0, 150, 0)","rgb(0, 150, 100)","rgb(0, 150, 150)","rgb(0, 140, 195)","rgb(0, 0, 150)","rgb(100, 0, 150)","rgb(140, 0, 85)","rgb(64,64,64)","rgb(100, 0, 0)","rgb(100, 50, 0)","rgb(100, 100, 0)","rgb(50, 100, 0)","rgb(0, 100, 0)","rgb(0, 100, 75)","rgb(0, 100, 100)","rgb(0, 110, 165)","rgb(0, 0, 100)","rgb(75, 0, 100)","rgb(110, 0, 65)","rgb(32,32,32)"],r),a=function(e){s!==e&&(s=e,o.style.color=s)},a(r),o.addEventListener("click",function(e){e.stopPropagation(),u.is_open()?u.remove():u.display(n,o,s)},!1),i.element=o,i.set_value=a,i},nbe.inputs.background_color=function(e,t,n,r){var i,s,o,u,a,f;return i=nbe.inputs.input("background_color",e),s=null,o=kite.browser.dom.eac("button",n,"wu-icon wu-icon-background_color off"),o.title=t,u=kite.browser.dom.ea("div",o),u.textContent="A",a=nbe.inputs.color_menu(function(e){i.trigger(e)},"transparent","None",["rgb(255, 200, 200)","rgb(255, 200, 75)","rgb(255, 255, 200)","rgb(200, 255, 0)","rgb(200, 255, 200)","rgb(150, 255, 225)","rgb(200, 255, 255)","rgb(135, 240, 255)","rgb(100, 175, 255)","rgb(235, 120, 255)","rgb(255, 100, 200)","rgb(224,224,224)","rgb(255, 150, 150)","rgb(255, 175, 50)","rgb(255, 255, 150)","rgb(175, 255, 0)","rgb(150, 255, 150)","rgb(100, 255, 200)","rgb(150, 255, 255)","rgb(80, 235, 255)","rgb(0, 150, 255)","rgb(200, 80, 255)","rgb(237, 0, 175)","rgb(192,192,192)","rgb(255, 100, 100)","rgb(255, 150, 25)","rgb(255, 255, 100)","rgb(150, 255, 0)","rgb(100, 255, 100)","rgb(50, 255, 175)","rgb(100, 255, 255)","rgb(50, 220, 255)","rgb(0, 100, 255)","rgb(175, 40, 255)","rgb(218, 0, 150)","rgb(160,160,160)","rgb(255, 0, 0)","rgb(255, 125, 0)","rgb(255, 255, 0)","rgb(125, 255, 0)","rgb(0, 255, 0)","rgb(0, 255, 150)","rgb(0, 255, 255)","rgb(0, 200, 255)","rgb(0, 0, 255)","rgb(150, 0, 255)","rgb(200, 0, 125)","rgb(128,128,128)","rgb(200 ,0, 0)","rgb(200, 100, 0)","rgb(200, 200, 0)","rgb(100, 200, 0)","rgb(0, 200, 0)","rgb(0, 200, 125)","rgb(0, 200, 200)","rgb(0, 170, 225)","rgb(0, 0, 200)","rgb(125, 0, 200)","rgb(170, 0, 105)","rgb(96,96,96)","rgb(150, 0, 0)","rgb(150, 75, 0)","rgb(150, 150, 0)","rgb(75, 150, 0)","rgb(0, 150, 0)","rgb(0, 150, 100)","rgb(0, 150, 150)","rgb(0, 140, 195)","rgb(0, 0, 150)","rgb(100, 0, 150)","rgb(140, 0, 85)","rgb(64,64,64)","rgb(100, 0, 0)","rgb(100, 50, 0)","rgb(100, 100, 0)","rgb(50, 100, 0)","rgb(0, 100, 0)","rgb(0, 100, 75)","rgb(0, 100, 100)","rgb(0, 110, 165)","rgb(0, 0, 100)","rgb(75, 0, 100)","rgb(110, 0, 65)","rgb(32,32,32)"],r),f=function(e){s!==e&&(s=e,u.style.backgroundColor=s)},f(r),o.addEventListener("click",function(e){e.stopPropagation(),a.is_open()?a.remove():a.display(n,o,s)},!1),i.element=o,i.set_value=f,i},nbe.inputs.vertical_align=function(e,t,n){var r,i,s,o,u;return r=kite.browser.dom.ea("div",t),i=nbe.inputs.input("vertical_align",e),s=function(e,t){t==="on"?i.trigger(e):i.trigger("baseline")},o=nbe.inputs.button("super","Superscript",r,s,"off"),o.element.innerHTML="A<span>2</span>",u=nbe.inputs.button("sub","Subscript",r,s,"off"),u.element.innerHTML="A<span>2</span>",i.element=r,i.set_value=function(e){e==="super"?(o.set_value("on"),u.set_value("off")):e==="sub"?(u.set_value("on"),o.set_value("off")):(o.set_value("off"),u.set_value("off"))},i.set_value(n),i},nbe.inputs.left_margin=function(e,t,n){var r,i,s,o,u;return r=["off","on"],i=kite.browser.dom.ea("div",t),s=nbe.inputs.input("left_margin",e),o=nbe.inputs.button("decrease_indent","Decrease indentation",t,function(){r[0]==="on"&&s.trigger("decrement")},"off"),o.element.textContent="<",u=nbe.inputs.button("increase_indent","Increase indentation",t,function(){r[1]==="on"&&s.trigger("increment")},"off"),u.element.textContent=">",s.element=i,s.set_value=function(e){r=e.split(":"),o.set_value(r[0]),u.set_value(r[1])},s.set_value(n),s},nbe.inputs.undo=function(e,t){var n,r,i,s;return n=kite.browser.dom.ea("div",t),r=nbe.inputs.input("undo",e),i=nbe.inputs.button("undo","Undo",n,function(){r.trigger("undo")},"off"),kite.browser.dom.ea("img",i.element).src="/img/undo.svg",s=nbe.inputs.button("redo","Redo",n,function(){r.trigger("redo")},"off"),kite.browser.dom.ea("img",s.element).src="/img/redo.svg",r.element=n,r.set_value=function(e){i.set_value(e.undo?"on":"off"),s.set_value(e.redo?"on":"off")},r},nbe.inputs.drop_down=function(e,t,n,r,i,s,o,u){var a,f,l,c,h,p,d,v,m,g,y;a=nbe.inputs.input(e,s),f=null,l=document.body,c=kite.browser.dom.eac("div",i,"wu-icon wu-drop-down wu-icon-"+e),c.title=t,c.addEventListener("click",function(e){var t;!v.parentNode&&e.target!==h&&(t=kite.browser.ui.get_offset(c),v.style.left=t.left+1+"px",v.style.top=t.top+c.offsetHeight+"px",l.appendChild(v),d=!1,setTimeout(function(){d=!0},0))},!0),h=document.createElement("input"),u&&(c.appendChild(h),h.type="text",p=function(e){var t=h.value.replace(/\s/g,"");isNaN(t)?(alert("Please specify a number."),y(f)):(y(t+"px"),a.trigger(f))},h.addEventListener("blur",p,!1),h.addEventListener("keyup",function(e){e.keyCode===13&&p(e)},!1)),document.body.addEventListener("click",function(e){v.parentNode&&d&&l.removeChild(v)},!1),v=kite.browser.dom.ec("div","wu-menu drop_down_menu"),v.addEventListener("click",function(e){var t;t=e.target.getAttribute("data-option")?e.target.getAttribute("data-option"):e.target.parentNode.getAttribute("data-option"),a.trigger(t),v.parentNode&&l.removeChild(v)},!1),m={};for(g in n)n.hasOwnProperty(g)&&(m[g]=kite.browser.dom.eac("div",v,"wu-menu-row"),m[g].setAttribute("data-option",g),m[g].innerHTML=n[g]);return y=function(e){f&&f in m&&(m[f].className="wu-menu-row"),f=e,f in m&&(m[f].className="wu-menu-row wu-selected"),u?h.value=f.replace("px",""):c.innerHTML=r[f]?r[f]:n[f]?n[f].replace(" (default)",""):f},y(o),a.element=c,a.set_value=y,a},nbe.inputs.heading=function(e,t,n,r,i,s){var o;return o=nbe.inputs.drop_down("heading",t,n,r,i,e,s,!1),o},nbe.inputs.font_family=function(e,t,n,r,i){var s;return s=nbe.inputs.drop_down("font_family",t,n,{},r,e,i,!1),s},nbe.inputs.font_size=function(e,t,n,r,i){var s;return s=nbe.inputs.drop_down("font_size",t,n,{},r,e,i,!0),s},nbe.inputs.text_align=function(e,t,n,r,i){var s;return s=nbe.inputs.drop_down("text_align",t,n,{},r,e,i,!1),s},nbe.inputs.line_spacing=function(e,t,n,r,i){var s;return s=nbe.inputs.drop_down("line_spacing",t,n,{},r,e,i,!1),s},nbe.inputs.list=function(e,t,n,r,i){var s;return s=nbe.inputs.drop_down("list",t,n,{},r,e,i,!1),s},nbe.inputs.special_characters=function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b;r=nbe.inputs.input("text",e),i=kite.browser.dom.eac("button",n,"wu-icon wu-icon-special_characters off"),i.title=t,s=new kite.browser.ui.Window,s.set_title("Special Characters"),i.addEventListener("click",function(e){e.stopPropagation(),s.is_open?s.close():s.open()},!1),o=kite.browser.dom.ec("div","wu-special_characters"),kite.browser.dom.ea("div",o).textContent="Please choose character sets: ",u=kite.browser.dom.ea("select",o),a=[],f=kite.browser.dom.ea("div",o),l=function(e,t){var n,r;n=[];for(r=e;r<=t;r++)n.push(String.fromCharCode(r));return n},c=[{name:"latin extended",characters:l(192,687)},{name:"greek and coptic",characters:l(880,1023)},{name:"mathematical operators",characters:l(8704,8959)},{name:"arrows",characters:l(8592,8703)},{name:"currency",characters:l(8352,8399)}];for(h=0;h<c.length;h+=1){a[h]=kite.browser.dom.ec("div","wu-character_set"),p=kite.browser.dom.ea("option",u),p.textContent=c[h].name,p.value=h;for(d=0;d<c[h].characters.length;d+=1)v=kite.browser.dom.ea("div",a[h]),v.textContent=c[h].characters[d],d%11===0&&(v.style.clear="left")}return f.appendChild(a[0]),u.addEventListener("change",function(e){f.removeChild(f.firstChild),f.appendChild(a[e.target.value])},!1),kite.browser.dom.ea("div",o).textContent="Characters to insert:",m=kite.browser.dom.ea("input",o),g=kite.browser.dom.eac("div",o,"wu-special_character_buttons"),y=kite.browser.dom.eac("button",g,"button"),y.textContent="Insert characters",b=kite.browser.dom.eac("button",g,"button"),b.textContent="Cancel",s.set_content(o),o.addEventListener("click",function(e){y===e.target?(r.trigger(m.value),m.value="",s.close()):b===e.target?s.close():e.target.parentNode.className==="wu-character_set"&&(m.value+=e.target.textContent)},!1),r.element=i,r},nbe.inputs.insert_link=function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m;return r=nbe.inputs.input("link",e),i=kite.browser.dom.eac("button",n,"wu-icon wu-icon-insert_link off"),i.title=t,s=new kite.browser.ui.Window,s.set_title("Insert link"),i.addEventListener("click",function(e){e.stopPropagation(),s.is_open?s.close():(o=!1,o?a.parentNode&&u.removeChild(a):u.insertBefore(a,c),f.textContent="",h.textContent="",s.open())},!1),u=kite.browser.dom.ec("div","wu-special_characters"),a=document.createElement("div"),kite.browser.dom.ea("span",a).textContent="Link text: ",f=kite.browser.dom.eac("span",a,"message_failure"),kite.browser.dom.ea("br",a),l=kite.browser.dom.ea("input",a),l.type="text",c=kite.browser.dom.ea("div",u),kite.browser.dom.ea("span",c).textContent="URL: ",h=kite.browser.dom.eac("span",c,"message_failure"),kite.browser.dom.ea("br",c),p=kite.browser.dom.ea("input",c),p.type="text",p.value="http://",d=kite.browser.dom.eac("div",u,"wu-special_character_buttons"),v=kite.browser.dom.eac("button",d,"button"),v.textContent="Insert link",m=kite.browser.dom.eac("button",d,"button"),m.textContent="Cancel",s.set_content(u),u.addEventListener("click",function(e){var t;v===e.target?l.value===""?f.textContent=" Please specify a link text":p.value===""?h.textContent=" Please specify a url":(t={href:p.value},o||(t.insertion=[{type:"text",val:{text:l.value},children:[]}]),r.trigger(t),l.value="",p.value="http://",s.close()):m===e.target&&s.close()},!1),r.element=i,r},nbe.inputs.edit_link=function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v;return i=nbe.inputs.input("link",e),s=kite.browser.dom.eac("button",n,"wu-icon wu-icon-edit_link off"),s.title=t,kite.browser.dom.ea("img",s).src="/img/pen_alt2.svg",kite.browser.dom.ea("img",s).src="/img/link.svg",o=null,u=null,a=function(e){o=e,o?(u=o.id,h.value=o.href,s.className="wu-icon wu-icon-edit_link on"):(h.value="",s.className="wu-icon wu-icon-edit_link off")},f=new kite.browser.ui.Window,f.set_title("Edit link"),s.addEventListener("click",function(e){e.stopPropagation(),f.is_open?f.close():o&&f.open()},!1),l=kite.browser.dom.ec("div","wu-special_characters"),c=kite.browser.dom.ea("div",l),kite.browser.dom.ea("div",c).textContent="URL: ",h=kite.browser.dom.ea("input",c),h.type="text",p=kite.browser.dom.eac("div",l,"wu-special_character_buttons"),d=kite.browser.dom.eac("button",p,"button"),d.textContent="OK",v=kite.browser.dom.eac("button",p,"button"),v.textContent="Cancel",f.set_content(l),l.addEventListener("click",function(e){d===e.target?(i.trigger({id:u,href:h.value}),f.close()):v===e.target&&f.close()},!1),a(r),i.set_value=a,i.element=s,i},nbe.inputs.insert_image=function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p;return r=nbe.inputs.input("img",e),i=kite.browser.dom.eac("button",n,"wu-icon wu-icon-insert_image off"),i.title=t,s=new kite.browser.ui.Window,s.set_title("Insert image"),i.addEventListener("click",function(e){e.stopPropagation(),s.is_open?s.close():s.open()},!1),o=kite.browser.dom.ec("div","wu-image_window"),kite.browser.dom.ea("div",o).textContent="Image URL ",u=kite.browser.dom.ea("input",o),u.type="text",u.value="http://",kite.browser.dom.ea("div",o).textContent="Width ",a=kite.browser.dom.ea("input",o),a.type="text",kite.browser.dom.ea("div",o).textContent="Height ",f=kite.browser.dom.ea("input",o),f.type="text",kite.browser.dom.ea("div",o).textContent="Title ",l=kite.browser.dom.ea("input",o),l.type="text",c=kite.browser.dom.eac("div",o,"wu-special_character_buttons"),h=kite.browser.dom.eac("button",c,"button"),h.textContent="Insert image",p=kite.browser.dom.eac("button",c,"button"),p.textContent="Cancel",s.set_content(o),o.addEventListener("click",function(e){var t;h===e.target?(t={src:u.value},a.value!==""&&(t.width=a.value),f.value!==""&&(t.height=f.value),l.value!==""&&(t.title=l.value),r.trigger(t),u.value="http://",a.value="",f.value="",l.value="",s.close()):p===e.target&&s.close()},!1),r.element=i,r},nbe.inputs.edit_image=function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g;return i=nbe.inputs.input("img",e),s=kite.browser.dom.eac("button",n,"wu-icon wu-icon-edit_image off"),s.title=t,kite.browser.dom.ea("img",s).src="/img/pen_alt2.svg",kite.browser.dom.ea("img",s).src="/img/image.svg",o=null,u=null,a=function(e){o=e,o?(u=o.id,c.value=o.src||"",h.value=o.width||"",p.value=o.height||"",d.value=o.title||"",s.className="wu-icon wu-icon-edit_image on"):(c.value="",h.value="",p.value="",d.value="",s.className="wu-icon wu-icon-edit_image off")},f=new kite.browser.ui.Window,f.set_title("Edit image"),s.addEventListener("click",function(e){e.stopPropagation(),f.is_open?f.close():o&&f.open()},!1),l=kite.browser.dom.ec("div","wu-image_window"),kite.browser.dom.ea("div",l).textContent="Image URL ",c=kite.browser.dom.ea("input",l),c.type="text",c.value="http://",kite.browser.dom.ea("div",l).textContent="Width ",h=kite.browser.dom.ea("input",l),h.type="text",kite.browser.dom.ea("div",l).textContent="Height ",p=kite.browser.dom.ea("input",l),p.type="text",kite.browser.dom.ea("div",l).textContent="Title ",d=kite.browser.dom.ea("input",l),d.type="text",v=kite.browser.dom.eac("div",l,"wu-special_character_buttons"),m=kite.browser.dom.eac("button",v,"button"),m.textContent="OK",g=kite.browser.dom.eac("button",v,"button"),g.textContent="Cancel",f.set_content(l),l.addEventListener("click",function(e){var t;m===e.target?(t={id:u,src:c.value},h.value!==""&&(t.width=h.value),p.value!==""&&(t.height=p.value),d.value!==""&&(t.title=d.value),i.trigger(t),f.close()):g===e.target&&f.close()},!1),a(r),i.element=s,i.set_value=a,i},nbe.title.create=function(e,t,n){var r,i,s,o,u,a,f;return i=function(e){o(e.value)},t.editable?(s=kite.browser.dom.ec("input","wu-title"),s.setAttribute("type","text"),o=function(e){r=e,s.value!==r&&(s.value=r),t.html_title&&(document.title=r)},u=function(t){var i,u;i=s.value,i!==r&&(o(i),u={editor_class:"title",before:r,after:i},n.add_ops(e,[u]))},s.addEventListener("input",u,!1)):(s=document.createElement("div"),o=function(e){r=e,s.textContent=r,t.html_title&&(document.title=r)}),a=function(e,t){e.forEach(function(e){"editor_class"in e&&e.editor_class==="title"&&o(e.after)})},f=function(){return r},{id:e,el_editor:s,init:i,add_external_ops:a,get_value:f}},nbe.title.state_copy=function(e){return{value:e.value}},nbe.title.state_init=function(){return{value:"My Title"}},nbe.title.state_update=function(e,t){t.length>0&&(e.value=t[t.length-1].after)},nbe.publish.create=function(e,t){var n,r,i,s,o,u,a;return n=null,r=function(e){u(e.time)},i=document.createElement("div"),s=function(r){var i,s;i=nbe.doc.html(nbe.dynamic.doc),s={type:"publish",id:t.ids.id,write:t.ids.write,html:i},nbe.lib.xhr("POST",nbe.config.publish_url,{},JSON.stringify(s),0,function(i){var s;i=JSON.parse(i),i==="published"&&(s={editor_class:"publish",before:n,after:Date.now()},u(s.after),t.add_ops(e,[s]),r(i))},function(){},function(){r(null)})},o=function(e,t){e.forEach(function(e){"editor_class"in e&&e.editor_class==="publish"&&u(e.after)})},u=function(e){n=e,i.textContent=n===null?"Not published":"Published at "+new Date(n)},a=function(){return n},{id:e,init:r,msg:i,publish:s,add_external_ops:o,get_time:a}},nbe.publish.state_copy=function(e){return{time:e.time}},nbe.publish.state_init=function(){return{time:null}},nbe.publish.state_update=function(e,t){t.length>0&&(e.time=t[t.length-1].after)},nbe.css.publish='/* Line styles */\n\n.wu-line, .wu-line > span {\n	line-height : 160%;\n}\n\n.wu-line.wu-right {\n	text-align : right;\n}\n\n.wu-line.wu-center {\n	text-align : center;\n}\n\n.wu-line.wu-justify {\n	text-align : justify;\n}\n\n/* Line spacing */\n\n.wu-line_spacing_05, .wu-line_spacing_05 > span {\n	line-height : 50%;\n}\n\n.wu-line_spacing_06, .wu-line_spacing_06 > span {\n	line-height : 60%;\n}\n\n.wu-line_spacing_07, .wu-line_spacing_07 > span {\n	line-height : 70%;\n}\n\n.wu-line_spacing_08, .wu-line_spacing_08 > span {\n	line-height : 80%;\n}\n\n.wu-line_spacing_09, .wu-line_spacing_09 > span {\n	line-height : 90%;\n}\n\n.wu-line_spacing_10, .wu-line_spacing_10 > span {\n	line-height : 100%;\n}\n\n.wu-line_spacing_11, .wu-line_spacing_11 > span {\n	line-height : 110%;\n}\n\n.wu-line_spacing_12, .wu-line_spacing_12 > span {\n	line-height : 120%;\n}\n\n.wu-line_spacing_13, .wu-line_spacing_13 > span {\n	line-height : 130%;\n}\n\n.wu-line_spacing_14, .wu-line_spacing_14 > span {\n	line-height : 140%;\n}\n\n.wu-line_spacing_15, .wu-line_spacing_15 > span {\n	line-height : 150%;\n}\n\n.wu-line_spacing_16, .wu-line_spacing_16 > span {\n	line-height : 160%;\n}\n\n.wu-line_spacing_17, .wu-line_spacing_17 > span {\n	line-height : 170%;\n}\n\n.wu-line_spacing_18, .wu-line_spacing_18 > span {\n	line-height : 180%;\n}\n\n.wu-line_spacing_19, .wu-line_spacing_19 > span {\n	line-height : 190%;\n}\n\n.wu-line_spacing_20, .wu-line_spacing_20 > span {\n	line-height : 200%;\n}\n\n/* Lists */\n\n.wu-disc, .wu-square {\n	display : list-item;\n	list-style : inside;\n}\n\n.wu-lower-alpha, .wu-lower-roman , .wu-lower-roman, .wu-upper-alpha, .wu-upper-roman {\n	display : block;\n}\n\n.wu-disc {\n	list-style-type : disc;\n}\n\n.wu-lower-alpha:before {\n	counter-increment : item;\n	content : counter(item, lower-alpha) ". "\n}\n\n.wu-lower-roman:before {\n	counter-increment : item;\n	content : counter(item, lower-roman) ". "\n}\n\n.wu-square {\n	list-style-type : square;\n}\n\n.wu-upper-alpha:before {\n	counter-increment : item;\n	content : counter(item, upper-alpha) ". "\n}\n\n.wu-upper-roman:before {\n	counter-increment : item;\n	content : counter(item, upper-roman) ". "\n}\n\n.wu-ordered {\n	display : block;\n}\n\n.wu-ordered:before {\n	counter-increment : item;\n	content : counter(item) ". "\n}\n\n.wu-reset-counter {\n	counter-reset : item;\n}\n\n/* Heading */\n\n.wu-line.wu-heading1, .wu-line.wu-heading1 span {\n	display: block;\n	padding-top: 4px;\n	padding-bottom: 4px;\n	font-size: 135%;\n}\n\n.wu-line.wu-heading2, .wu-line.wu-heading2 span {\n	display: block;\n	padding-top: 4px;\n	padding-bottom: 4px;\n	font-size: 130%;\n}\n\n.wu-line.wu-heading3, .wu-line.wu-heading3 span {\n	display: block;\n	padding-top: 4px;\n	padding-bottom: 4px;\n	font-size: 125%;\n}\n\n.wu-line.wu-heading4, .wu-line.wu-heading4 span {\n	display: block;\n	padding-top: 4px;\n	padding-bottom: 4px;\n	font-size: 120%;\n}\n\n.wu-line.wu-heading5, .wu-line.wu-heading5 span {\n	display: block;\n	padding-top: 4px;\n	padding-bottom: 4px;\n	font-size: 115%;\n}\n\n.wu-line.wu-heading6, .wu-line.wu-heading6 span {\n	display: block;\n	padding-top: 4px;\n	padding-bottom: 4px;\n	font-size: 110%;\n}\n\n.wu-line.wu-heading1 span, .wu-line.wu-heading2 span, .wu-line.wu-heading3 span, .wu-line.wu-heading4 span, .wu-line.wu-heading5 span, .wu-line.wu-heading6 span {\n	display : inline-block;\n}\n\n/* Text styles */\n\n.wu-text.wu-bold {\n	font-weight : bold;\n}\n\n.wu-text.wu-underline {\n	text-decoration : underline;\n}\n\n.wu-text.wu-italic {\n	font-style : italic;\n}\n\n.wu-text.wu-strikethrough {\n	text-decoration : line-through;\n}\n\nbody {\n	margin : 0;\n}\n\ndiv.editor {\n	white-space : pre-wrap;\n	word-wrap : break-word;\n	font-size : 16px;\n	font-family : Arial;\n	line-height : 120%;\n	line-height : 160%;\n	padding : 30px 50px;\n}\n\ndiv.editor span {\n	font-size : 16px;\n	font-family : Arial;\n}\n\n'