File "all.js"

Full path: /var/www/vhosts/derekdigital.com/gawrjuhs.art/js/all.js
File size: 1.05 B
MIME-type: text/plain
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}function fe(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}ce.fn=ce.prototype={jquery:t,constructor:ce,length:0,toArray:function(){return ae.call(this)},get:function(e){return null==e?ae.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ce.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ce.each(this,e)},map:function(n){return this.pushStack(ce.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(ae.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ce.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ce.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:oe.sort,splice:oe.splice},ce.extend=ce.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||v(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(ce.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||ce.isPlainObject(n)?n:{},i=!1,a[t]=ce.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},ce.extend({expando:"jQuery"+(t+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==i.call(e))&&(!(t=r(e))||"function"==typeof(n=ue.call(t,"constructor")&&t.constructor)&&o.call(n)===a)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){m(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(c(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},text:function(e){var t,n="",r=0,i=e.nodeType;if(!i)while(t=e[r++])n+=ce.text(t);return 1===i||11===i?e.textContent:9===i?e.documentElement.textContent:3===i||4===i?e.nodeValue:n},makeArray:function(e,t){var n=t||[];return null!=e&&(c(Object(e))?ce.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},isXMLDoc:function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!l.test(t||n&&n.nodeName||"HTML")},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(c(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:le}),"function"==typeof Symbol&&(ce.fn[Symbol.iterator]=oe[Symbol.iterator]),ce.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var pe=oe.pop,de=oe.sort,he=oe.splice,ge="[\\x20\\t\\r\\n\\f]",ve=new RegExp("^"+ge+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ge+"+$","g");ce.contains=function(e,t){var n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var f=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function p(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}ce.escapeSelector=function(e){return(e+"").replace(f,p)};var ye=C,me=s;!function(){var e,b,w,o,a,T,r,C,d,i,k=me,S=ce.expando,E=0,n=0,s=W(),c=W(),u=W(),h=W(),l=function(e,t){return e===t&&(a=!0),0},f="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",t="(?:\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",p="\\["+ge+"*("+t+")(?:"+ge+"*([*^$|!~]?=)"+ge+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+t+"))|)"+ge+"*\\]",g=":("+t+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+p+")*)|.*)\\)|)",v=new RegExp(ge+"+","g"),y=new RegExp("^"+ge+"*,"+ge+"*"),m=new RegExp("^"+ge+"*([>+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="<a id='"+S+"' href='' disabled='disabled'></a><select id='"+S+"-\r\\' disabled='disabled'><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0<I(t,T,null,[e]).length},I.contains=function(e,t){return(e.ownerDocument||e)!=T&&V(e),ce.contains(e,t)},I.attr=function(e,t){(e.ownerDocument||e)!=T&&V(e);var n=b.attrHandle[t.toLowerCase()],r=n&&ue.call(b.attrHandle,t.toLowerCase())?n(e,t,!C):void 0;return void 0!==r?r:e.getAttribute(t)},I.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ce.uniqueSort=function(e){var t,n=[],r=0,i=0;if(a=!le.sortStable,o=!le.sortStable&&ae.call(e,0),de.call(e,l),a){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)he.call(e,n[r],1)}return o=null,e},ce.fn.uniqueSort=function(){return this.pushStack(ce.uniqueSort(ae.apply(this)))},(b=ce.expr={cacheLength:50,createPseudo:F,match:D,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(v," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(d,e,t,h,g){var v="nth"!==d.slice(0,3),y="last"!==d.slice(-4),m="of-type"===e;return 1===h&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u=v!==y?"nextSibling":"previousSibling",l=e.parentNode,c=m&&e.nodeName.toLowerCase(),f=!n&&!m,p=!1;if(l){if(v){while(u){o=e;while(o=o[u])if(m?fe(o,c):1===o.nodeType)return!1;s=u="only"===d&&!s&&"nextSibling"}return!0}if(s=[y?l.firstChild:l.lastChild],y&&f){p=(a=(r=(i=l[S]||(l[S]={}))[d]||[])[0]===E&&r[1])&&r[2],o=a&&l.childNodes[a];while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if(1===o.nodeType&&++p&&o===e){i[d]=[E,a,p];break}}else if(f&&(p=a=(r=(i=e[S]||(e[S]={}))[d]||[])[0]===E&&r[1]),!1===p)while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if((m?fe(o,c):1===o.nodeType)&&++p&&(f&&((i=o[S]||(o[S]={}))[d]=[E,p]),o===e))break;return(p-=g)===h||p%h==0&&0<=p/h}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||I.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?F(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=se.call(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:F(function(e){var r=[],i=[],s=ne(e.replace(ve,"$1"));return s[S]?F(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:F(function(t){return function(e){return 0<I(t,e).length}}),contains:F(function(t){return t=t.replace(O,P),function(e){return-1<(e.textContent||ce.text(e)).indexOf(t)}}),lang:F(function(n){return A.test(n||"")||I.error("unsupported lang: "+n),n=n.replace(O,P).toLowerCase(),function(e){var t;do{if(t=C?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=ie.location&&ie.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===r},focus:function(e){return e===function(){try{return T.activeElement}catch(e){}}()&&T.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:z(!1),disabled:z(!0),checked:function(e){return fe(e,"input")&&!!e.checked||fe(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)},input:function(e){return N.test(e.nodeName)},button:function(e){return fe(e,"input")&&"button"===e.type||fe(e,"button")},text:function(e){var t;return fe(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:X(function(){return[0]}),last:X(function(e,t){return[t-1]}),eq:X(function(e,t,n){return[n<0?n+t:n]}),even:X(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:X(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:X(function(e,t,n){var r;for(r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:X(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=B(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=_(e);function G(){}function Y(e,t){var n,r,i,o,a,s,u,l=c[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=y.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=m.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(ve," ")}),a=a.slice(n.length)),b.filter)!(r=D[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?I.error(e):c(e,s).slice(0)}function Q(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function J(a,e,t){var s=e.dir,u=e.next,l=u||s,c=t&&"parentNode"===l,f=n++;return e.first?function(e,t,n){while(e=e[s])if(1===e.nodeType||c)return a(e,t,n);return!1}:function(e,t,n){var r,i,o=[E,f];if(n){while(e=e[s])if((1===e.nodeType||c)&&a(e,t,n))return!0}else while(e=e[s])if(1===e.nodeType||c)if(i=e[S]||(e[S]={}),u&&fe(e,u))e=e[s]||e;else{if((r=i[l])&&r[0]===E&&r[1]===f)return o[2]=r[2];if((i[l]=o)[2]=a(e,t,n))return!0}return!1}}function K(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Z(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function ee(d,h,g,v,y,e){return v&&!v[S]&&(v=ee(v)),y&&!y[S]&&(y=ee(y,e)),F(function(e,t,n,r){var i,o,a,s,u=[],l=[],c=t.length,f=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)I(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),p=!d||!e&&h?f:Z(f,u,d,n,r);if(g?g(p,s=y||(e?d:c||v)?[]:t,n,r):s=p,v){i=Z(s,l),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(s[l[o]]=!(p[l[o]]=a))}if(e){if(y||d){if(y){i=[],o=s.length;while(o--)(a=s[o])&&i.push(p[o]=a);y(null,s=[],i,r)}o=s.length;while(o--)(a=s[o])&&-1<(i=y?se.call(e,a):u[o])&&(e[i]=!(t[i]=a))}}else s=Z(s===t?s.splice(c,s.length):s),y?y(null,t,s,r):k.apply(t,s)})}function te(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=J(function(e){return e===i},a,!0),l=J(function(e){return-1<se.call(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!=w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[J(K(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return ee(1<s&&K(c),1<s&&Q(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ve,"$1"),t,s<n&&te(e.slice(s,n)),n<r&&te(e=e.slice(n)),n<r&&Q(e))}c.push(t)}return K(c)}function ne(e,t){var n,v,y,m,x,r,i=[],o=[],a=u[e+" "];if(!a){t||(t=Y(e)),n=t.length;while(n--)(a=te(t[n]))[S]?i.push(a):o.push(a);(a=u(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=E+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==T||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==T||(V(o),n=!C);while(s=v[a++])if(s(o,t||T,n)){k.call(r,o);break}i&&(E=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=pe.call(r));f=Z(f)}k.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&ce.uniqueSort(r)}return i&&(E=h,w=p),c},m?F(r):r))).selector=e}return a}function re(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&Y(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&C&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(O,P),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=D.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(O,P),H.test(o[0].type)&&U(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&Q(o)))return k.apply(n,r),n;break}}}return(l||ne(e,c))(r,t,!C,n,!t||H.test(e)&&U(t.parentNode)||t),n}G.prototype=b.filters=b.pseudos,b.setFilters=new G,le.sortStable=S.split("").sort(l).join("")===S,V(),le.sortDetached=$(function(e){return 1&e.compareDocumentPosition(T.createElement("fieldset"))}),ce.find=I,ce.expr[":"]=ce.expr.pseudos,ce.unique=ce.uniqueSort,I.compile=ne,I.select=re,I.setDocument=V,I.tokenize=Y,I.escape=ce.escapeSelector,I.getText=ce.text,I.isXML=ce.isXMLDoc,I.selectors=ce.expr,I.support=ce.support,I.uniqueSort=ce.uniqueSort}();var d=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&ce(e).is(n))break;r.push(e)}return r},h=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},b=ce.expr.match.needsContext,w=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1<se.call(n,e)!==r}):ce.filter(n,e,r)}ce.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ce.find.matchesSelector(r,e)?[r]:[]:ce.find.matches(e,ce.grep(t,function(e){return 1===e.nodeType}))},ce.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(ce(e).filter(function(){for(t=0;t<r;t++)if(ce.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)ce.find(e,i[t],n);return 1<r?ce.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"==typeof e&&b.test(e)?ce(e):e||[],!1).length}});var k,S=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(ce.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&ce(e);if(!b.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&ce.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?ce.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?se.call(ce(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ce.uniqueSort(ce.merge(this.get(),ce(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ce.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return d(e,"parentNode")},parentsUntil:function(e,t,n){return d(e,"parentNode",n)},next:function(e){return A(e,"nextSibling")},prev:function(e){return A(e,"previousSibling")},nextAll:function(e){return d(e,"nextSibling")},prevAll:function(e){return d(e,"previousSibling")},nextUntil:function(e,t,n){return d(e,"nextSibling",n)},prevUntil:function(e,t,n){return d(e,"previousSibling",n)},siblings:function(e){return h((e.parentNode||{}).firstChild,e)},children:function(e){return h(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(fe(e,"template")&&(e=e.content||e),ce.merge([],e.childNodes))}},function(r,i){ce.fn[r]=function(e,t){var n=ce.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=ce.filter(t,n)),1<this.length&&(j[r]||ce.uniqueSort(n),E.test(r)&&n.reverse()),this.pushStack(n)}});var D=/[^\x20\t\r\n\f]+/g;function N(e){return e}function q(e){throw e}function L(e,t,n,r){var i;try{e&&v(i=e.promise)?i.call(e).done(t).fail(n):e&&v(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}ce.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},ce.each(e.match(D)||[],function(e,t){n[t]=!0}),n):ce.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){ce.each(e,function(e,t){v(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==x(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return ce.each(arguments,function(e,t){var n;while(-1<(n=ce.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<ce.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},ce.extend({Deferred:function(e){var o=[["notify","progress",ce.Callbacks("memory"),ce.Callbacks("memory"),2],["resolve","done",ce.Callbacks("once memory"),ce.Callbacks("once memory"),0,"resolved"],["reject","fail",ce.Callbacks("once memory"),ce.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return ce.Deferred(function(r){ce.each(o,function(e,t){var n=v(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&v(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,v(t)?s?t.call(e,l(u,o,N,s),l(u,o,q,s)):(u++,t.call(e,l(u,o,N,s),l(u,o,q,s),l(u,o,N,o.notifyWith))):(a!==N&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){ce.Deferred.exceptionHook&&ce.Deferred.exceptionHook(e,t.error),u<=i+1&&(a!==q&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(ce.Deferred.getErrorHook?t.error=ce.Deferred.getErrorHook():ce.Deferred.getStackHook&&(t.error=ce.Deferred.getStackHook()),ie.setTimeout(t))}}return ce.Deferred(function(e){o[0][3].add(l(0,e,v(r)?r:N,e.notifyWith)),o[1][3].add(l(0,e,v(t)?t:N)),o[2][3].add(l(0,e,v(n)?n:q))}).promise()},promise:function(e){return null!=e?ce.extend(e,a):a}},s={};return ce.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=ae.call(arguments),o=ce.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?ae.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(L(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||v(i[t]&&i[t].then)))return o.then();while(t--)L(i[t],a(t),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ce.Deferred.exceptionHook=function(e,t){ie.console&&ie.console.warn&&e&&H.test(e.name)&&ie.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},ce.readyException=function(e){ie.setTimeout(function(){throw e})};var O=ce.Deferred();function P(){C.removeEventListener("DOMContentLoaded",P),ie.removeEventListener("load",P),ce.ready()}ce.fn.ready=function(e){return O.then(e)["catch"](function(e){ce.readyException(e)}),this},ce.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ce.readyWait:ce.isReady)||(ce.isReady=!0)!==e&&0<--ce.readyWait||O.resolveWith(C,[ce])}}),ce.ready.then=O.then,"complete"===C.readyState||"loading"!==C.readyState&&!C.documentElement.doScroll?ie.setTimeout(ce.ready):(C.addEventListener("DOMContentLoaded",P),ie.addEventListener("load",P));var M=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n))for(s in i=!0,n)M(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,v(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(ce(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},R=/^-ms-/,I=/-([a-z])/g;function W(e,t){return t.toUpperCase()}function F(e){return e.replace(R,"ms-").replace(I,W)}var $=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function B(){this.expando=ce.expando+B.uid++}B.uid=1,B.prototype={cache:function(e){var t=e[this.expando];return t||(t={},$(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[F(t)]=n;else for(r in t)i[F(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][F(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(F):(t=F(t))in r?[t]:t.match(D)||[]).length;while(n--)delete r[t[n]]}(void 0===t||ce.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ce.isEmptyObject(t)}};var _=new B,z=new B,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,U=/[A-Z]/g;function V(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(U,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:X.test(i)?JSON.parse(i):i)}catch(e){}z.set(e,t,n)}else n=void 0;return n}ce.extend({hasData:function(e){return z.hasData(e)||_.hasData(e)},data:function(e,t,n){return z.access(e,t,n)},removeData:function(e,t){z.remove(e,t)},_data:function(e,t,n){return _.access(e,t,n)},_removeData:function(e,t){_.remove(e,t)}}),ce.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=z.get(o),1===o.nodeType&&!_.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=F(r.slice(5)),V(o,r,i[r]));_.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){z.set(this,n)}):M(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=z.get(o,n))?t:void 0!==(t=V(o,n))?t:void 0;this.each(function(){z.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){z.remove(this,e)})}}),ce.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=_.get(e,t),n&&(!r||Array.isArray(n)?r=_.access(e,t,ce.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=ce.queue(e,t),r=n.length,i=n.shift(),o=ce._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){ce.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _.get(e,n)||_.access(e,n,{empty:ce.Callbacks("once memory").add(function(){_.remove(e,[t+"queue",n])})})}}),ce.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?ce.queue(this[0],t):void 0===n?this:this.each(function(){var e=ce.queue(this,t,n);ce._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&ce.dequeue(this,t)})},dequeue:function(e){return this.each(function(){ce.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=ce.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=_.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var G=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Y=new RegExp("^(?:([+-])=|)("+G+")([a-z%]*)$","i"),Q=["Top","Right","Bottom","Left"],J=C.documentElement,K=function(e){return ce.contains(e.ownerDocument,e)},Z={composed:!0};J.getRootNode&&(K=function(e){return ce.contains(e.ownerDocument,e)||e.getRootNode(Z)===e.ownerDocument});var ee=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&K(e)&&"none"===ce.css(e,"display")};function te(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return ce.css(e,t,"")},u=s(),l=n&&n[3]||(ce.cssNumber[t]?"":"px"),c=e.nodeType&&(ce.cssNumber[t]||"px"!==l&&+u)&&Y.exec(ce.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)ce.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,ce.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ne={};function re(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=_.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ee(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ne[s])||(o=a.body.appendChild(a.createElement(s)),u=ce.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ne[s]=u)))):"none"!==n&&(l[c]="none",_.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}ce.fn.extend({show:function(){return re(this,!0)},hide:function(){return re(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ee(this)?ce(this).show():ce(this).hide()})}});var xe,be,we=/^(?:checkbox|radio)$/i,Te=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="<textarea>x</textarea>",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="<option></option>",le.option=!!xe.lastChild;var ke={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n<r;n++)_.set(e[n],"globalEval",!t||_.get(t[n],"globalEval"))}ke.tbody=ke.tfoot=ke.colgroup=ke.caption=ke.thead,ke.th=ke.td,le.option||(ke.optgroup=ke.option=[1,"<select multiple='multiple'>","</select>"]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))ce.merge(p,o.nodeType?[o]:o);else if(je.test(o)){a=a||f.appendChild(t.createElement("div")),s=(Te.exec(o)||["",""])[1].toLowerCase(),u=ke[s]||ke._default,a.innerHTML=u[1]+ce.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;ce.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<ce.inArray(o,r))i&&i.push(o);else if(l=K(o),a=Se(f.appendChild(o),"script"),l&&Ee(a),n){c=0;while(o=a[c++])Ce.test(o.type||"")&&n.push(o)}return f}var De=/^([^.]*)(?:\.(.+)|)/;function Ne(){return!0}function qe(){return!1}function Le(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Le(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=qe;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return ce().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=ce.guid++)),e.each(function(){ce.event.add(this,t,i,r,n)})}function He(e,r,t){t?(_.set(e,r,!1),ce.event.add(e,r,{namespace:!1,handler:function(e){var t,n=_.get(this,r);if(1&e.isTrigger&&this[r]){if(n)(ce.event.special[r]||{}).delegateType&&e.stopPropagation();else if(n=ae.call(arguments),_.set(this,r,n),this[r](),t=_.get(this,r),_.set(this,r,!1),n!==t)return e.stopImmediatePropagation(),e.preventDefault(),t}else n&&(_.set(this,r,ce.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ne)}})):void 0===_.get(e,r)&&ce.event.add(e,r,Ne)}ce.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.get(t);if($(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&ce.find.matchesSelector(J,i),n.guid||(n.guid=ce.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof ce&&ce.event.triggered!==e.type?ce.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(D)||[""]).length;while(l--)d=g=(s=De.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=ce.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=ce.event.special[d]||{},c=ce.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ce.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),ce.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.hasData(e)&&_.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(D)||[""]).length;while(l--)if(d=g=(s=De.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=ce.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||ce.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)ce.event.remove(e,d+t[l],n,r,!0);ce.isEmptyObject(u)&&_.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=ce.event.fix(e),l=(_.get(this,"events")||Object.create(null))[u.type]||[],c=ce.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=ce.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((ce.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<ce(i,this).index(l):ce.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(ce.Event.prototype,t,{enumerable:!0,configurable:!0,get:v(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[ce.expando]?e:new ce.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click",!0),!1},trigger:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click"),!0},_default:function(e){var t=e.target;return we.test(t.type)&&t.click&&fe(t,"input")&&_.get(t,"click")||fe(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ce.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},ce.Event=function(e,t){if(!(this instanceof ce.Event))return new ce.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ne:qe,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ce.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[ce.expando]=!0},ce.Event.prototype={constructor:ce.Event,isDefaultPrevented:qe,isPropagationStopped:qe,isImmediatePropagationStopped:qe,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ne,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ne,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ne,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ce.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},ce.event.addProp),ce.each({focus:"focusin",blur:"focusout"},function(r,i){function o(e){if(C.documentMode){var t=_.get(this,"handle"),n=ce.event.fix(e);n.type="focusin"===e.type?"focus":"blur",n.isSimulated=!0,t(e),n.target===n.currentTarget&&t(n)}else ce.event.simulate(i,e.target,ce.event.fix(e))}ce.event.special[r]={setup:function(){var e;if(He(this,r,!0),!C.documentMode)return!1;(e=_.get(this,i))||this.addEventListener(i,o),_.set(this,i,(e||0)+1)},trigger:function(){return He(this,r),!0},teardown:function(){var e;if(!C.documentMode)return!1;(e=_.get(this,i)-1)?_.set(this,i,e):(this.removeEventListener(i,o),_.remove(this,i))},_default:function(e){return _.get(e.target,r)},delegateType:i},ce.event.special[i]={setup:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i);n||(C.documentMode?this.addEventListener(i,o):e.addEventListener(r,o,!0)),_.set(t,i,(n||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i)-1;n?_.set(t,i,n):(C.documentMode?this.removeEventListener(i,o):e.removeEventListener(r,o,!0),_.remove(t,i))}}}),ce.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){ce.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||ce.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),ce.fn.extend({on:function(e,t,n,r){return Le(this,e,t,n,r)},one:function(e,t,n,r){return Le(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ce(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=qe),this.each(function(){ce.event.remove(this,e,n,t)})}});var Oe=/<script|<style|<link/i,Pe=/checked\s*(?:[^=]|=\s*.checked.)/i,Me=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)ce.event.add(t,i,s[i][n]);z.hasData(e)&&(o=z.access(e),a=ce.extend({},o),z.set(t,a))}}function $e(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=v(d);if(h||1<f&&"string"==typeof d&&!le.checkClone&&Pe.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),$e(t,r,i,o)});if(f&&(t=(e=Ae(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=ce.map(Se(e,"script"),Ie)).length;c<f;c++)u=e,c!==p&&(u=ce.clone(u,!0,!0),s&&ce.merge(a,Se(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,ce.map(a,We),c=0;c<s;c++)u=a[c],Ce.test(u.type||"")&&!_.access(u,"globalEval")&&ce.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?ce._evalUrl&&!u.noModule&&ce._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):m(u.textContent.replace(Me,""),u,l))}return n}function Be(e,t,n){for(var r,i=t?ce.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||ce.cleanData(Se(r)),r.parentNode&&(n&&K(r)&&Ee(Se(r,"script")),r.parentNode.removeChild(r));return e}ce.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=K(e);if(!(le.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ce.isXMLDoc(e)))for(a=Se(c),r=0,i=(o=Se(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&we.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||Se(e),a=a||Se(c),r=0,i=o.length;r<i;r++)Fe(o[r],a[r]);else Fe(e,c);return 0<(a=Se(c,"script")).length&&Ee(a,!f&&Se(e,"script")),c},cleanData:function(e){for(var t,n,r,i=ce.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[_.expando]){if(t.events)for(r in t.events)i[r]?ce.event.remove(n,r):ce.removeEvent(n,r,t.handle);n[_.expando]=void 0}n[z.expando]&&(n[z.expando]=void 0)}}}),ce.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return M(this,function(e){return void 0===e?ce.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return $e(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Re(this,e).appendChild(e)})},prepend:function(){return $e(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Re(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ce.cleanData(Se(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ce.clone(this,e,t)})},html:function(e){return M(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Oe.test(e)&&!ke[(Te.exec(e)||["",""])[1].toLowerCase()]){e=ce.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(ce.cleanData(Se(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return $e(this,arguments,function(e){var t=this.parentNode;ce.inArray(this,n)<0&&(ce.cleanData(Se(this)),t&&t.replaceChild(e,this))},n)}}),ce.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){ce.fn[e]=function(e){for(var t,n=[],r=ce(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),ce(r[o])[a](t),s.apply(n,t.get());return this.pushStack(n)}});var _e=new RegExp("^("+G+")(?!px)[a-z%]+$","i"),ze=/^--/,Xe=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=ie),t.getComputedStyle(e)},Ue=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ve=new RegExp(Q.join("|"),"i");function Ge(e,t,n){var r,i,o,a,s=ze.test(t),u=e.style;return(n=n||Xe(e))&&(a=n.getPropertyValue(t)||n[t],s&&a&&(a=a.replace(ve,"$1")||void 0),""!==a||K(e)||(a=ce.style(e,t)),!le.pixelBoxStyles()&&_e.test(a)&&Ve.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+"":a}function Ye(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",J.appendChild(u).appendChild(l);var e=ie.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),J.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=C.createElement("div"),l=C.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",le.clearCloneStyle="content-box"===l.style.backgroundClip,ce.extend(le,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=C.createElement("table"),t=C.createElement("tr"),n=C.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="box-sizing:content-box;border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",J.appendChild(e).appendChild(t).appendChild(n),r=ie.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,J.removeChild(e)),a}}))}();var Qe=["Webkit","Moz","ms"],Je=C.createElement("div").style,Ke={};function Ze(e){var t=ce.cssProps[e]||Ke[e];return t||(e in Je?e:Ke[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Qe.length;while(n--)if((e=Qe[n]+t)in Je)return e}(e)||e)}var et=/^(none|table(?!-c[ea]).+)/,tt={position:"absolute",visibility:"hidden",display:"block"},nt={letterSpacing:"0",fontWeight:"400"};function rt(e,t,n){var r=Y.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function it(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0,l=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(l+=ce.css(e,n+Q[a],!0,i)),r?("content"===n&&(u-=ce.css(e,"padding"+Q[a],!0,i)),"margin"!==n&&(u-=ce.css(e,"border"+Q[a]+"Width",!0,i))):(u+=ce.css(e,"padding"+Q[a],!0,i),"padding"!==n?u+=ce.css(e,"border"+Q[a]+"Width",!0,i):s+=ce.css(e,"border"+Q[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u+l}function ot(e,t,n){var r=Xe(e),i=(!le.boxSizingReliable()||n)&&"border-box"===ce.css(e,"boxSizing",!1,r),o=i,a=Ge(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(_e.test(a)){if(!n)return a;a="auto"}return(!le.boxSizingReliable()&&i||!le.reliableTrDimensions()&&fe(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===ce.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===ce.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+it(e,t,n||(i?"border":"content"),o,r,a)+"px"}function at(e,t,n,r,i){return new at.prototype.init(e,t,n,r,i)}ce.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ge(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=F(t),u=ze.test(t),l=e.style;if(u||(t=Ze(s)),a=ce.cssHooks[t]||ce.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=Y.exec(n))&&i[1]&&(n=te(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(ce.cssNumber[s]?"":"px")),le.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=F(t);return ze.test(t)||(t=Ze(s)),(a=ce.cssHooks[t]||ce.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Ge(e,t,r)),"normal"===i&&t in nt&&(i=nt[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),ce.each(["height","width"],function(e,u){ce.cssHooks[u]={get:function(e,t,n){if(t)return!et.test(ce.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,u,n):Ue(e,tt,function(){return ot(e,u,n)})},set:function(e,t,n){var r,i=Xe(e),o=!le.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===ce.css(e,"boxSizing",!1,i),s=n?it(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-it(e,u,"border",!1,i)-.5)),s&&(r=Y.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=ce.css(e,u)),rt(0,t,s)}}}),ce.cssHooks.marginLeft=Ye(le.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Ge(e,"marginLeft"))||e.getBoundingClientRect().left-Ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),ce.each({margin:"",padding:"",border:"Width"},function(i,o){ce.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+Q[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(ce.cssHooks[i+o].set=rt)}),ce.fn.extend({css:function(e,t){return M(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Xe(e),i=t.length;a<i;a++)o[t[a]]=ce.css(e,t[a],!1,r);return o}return void 0!==n?ce.style(e,t,n):ce.css(e,t)},e,t,1<arguments.length)}}),((ce.Tween=at).prototype={constructor:at,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ce.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ce.cssNumber[n]?"":"px")},cur:function(){var e=at.propHooks[this.prop];return e&&e.get?e.get(this):at.propHooks._default.get(this)},run:function(e){var t,n=at.propHooks[this.prop];return this.options.duration?this.pos=t=ce.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):at.propHooks._default.set(this),this}}).init.prototype=at.prototype,(at.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ce.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){ce.fx.step[e.prop]?ce.fx.step[e.prop](e):1!==e.elem.nodeType||!ce.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:ce.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=at.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ce.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ce.fx=at.prototype.init,ce.fx.step={};var st,ut,lt,ct,ft=/^(?:toggle|show|hide)$/,pt=/queueHooks$/;function dt(){ut&&(!1===C.hidden&&ie.requestAnimationFrame?ie.requestAnimationFrame(dt):ie.setTimeout(dt,ce.fx.interval),ce.fx.tick())}function ht(){return ie.setTimeout(function(){st=void 0}),st=Date.now()}function gt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=Q[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function vt(e,t,n){for(var r,i=(yt.tweeners[t]||[]).concat(yt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function yt(o,e,t){var n,a,r=0,i=yt.prefilters.length,s=ce.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=st||ht(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:ce.extend({},e),opts:ce.extend(!0,{specialEasing:{},easing:ce.easing._default},t),originalProperties:e,originalOptions:t,startTime:st||ht(),duration:t.duration,tweens:[],createTween:function(e,t){var n=ce.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=F(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=ce.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=yt.prefilters[r].call(l,o,c,l.opts))return v(n.stop)&&(ce._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return ce.map(c,vt,l),v(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),ce.fx.timer(ce.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}ce.Animation=ce.extend(yt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return te(n.elem,e,Y.exec(t),n),n}]},tweener:function(e,t){v(e)?(t=e,e=["*"]):e=e.match(D);for(var n,r=0,i=e.length;r<i;r++)n=e[r],yt.tweeners[n]=yt.tweeners[n]||[],yt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ee(e),v=_.get(e,"fxshow");for(r in n.queue||(null==(a=ce._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,ce.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ft.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||ce.style(e,r)}if((u=!ce.isEmptyObject(t))||!ce.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=_.get(e,"display")),"none"===(c=ce.css(e,"display"))&&(l?c=l:(re([e],!0),l=e.style.display||l,c=ce.css(e,"display"),re([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===ce.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=_.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&re([e],!0),p.done(function(){for(r in g||re([e]),_.remove(e,"fxshow"),d)ce.style(e,r,d[r])})),u=vt(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?yt.prefilters.unshift(e):yt.prefilters.push(e)}}),ce.speed=function(e,t,n){var r=e&&"object"==typeof e?ce.extend({},e):{complete:n||!n&&t||v(e)&&e,duration:e,easing:n&&t||t&&!v(t)&&t};return ce.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in ce.fx.speeds?r.duration=ce.fx.speeds[r.duration]:r.duration=ce.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){v(r.old)&&r.old.call(this),r.queue&&ce.dequeue(this,r.queue)},r},ce.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ee).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=ce.isEmptyObject(t),o=ce.speed(e,n,r),a=function(){var e=yt(this,ce.extend({},t),o);(i||_.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=ce.timers,r=_.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&pt.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||ce.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=_.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=ce.timers,o=n?n.length:0;for(t.finish=!0,ce.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),ce.each(["toggle","show","hide"],function(e,r){var i=ce.fn[r];ce.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(gt(r,!0),e,t,n)}}),ce.each({slideDown:gt("show"),slideUp:gt("hide"),slideToggle:gt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){ce.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),ce.timers=[],ce.fx.tick=function(){var e,t=0,n=ce.timers;for(st=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||ce.fx.stop(),st=void 0},ce.fx.timer=function(e){ce.timers.push(e),ce.fx.start()},ce.fx.interval=13,ce.fx.start=function(){ut||(ut=!0,dt())},ce.fx.stop=function(){ut=null},ce.fx.speeds={slow:600,fast:200,_default:400},ce.fn.delay=function(r,e){return r=ce.fx&&ce.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=ie.setTimeout(e,r);t.stop=function(){ie.clearTimeout(n)}})},lt=C.createElement("input"),ct=C.createElement("select").appendChild(C.createElement("option")),lt.type="checkbox",le.checkOn=""!==lt.value,le.optSelected=ct.selected,(lt=C.createElement("input")).value="t",lt.type="radio",le.radioValue="t"===lt.value;var mt,xt=ce.expr.attrHandle;ce.fn.extend({attr:function(e,t){return M(this,ce.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){ce.removeAttr(this,e)})}}),ce.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?ce.prop(e,t,n):(1===o&&ce.isXMLDoc(e)||(i=ce.attrHooks[t.toLowerCase()]||(ce.expr.match.bool.test(t)?mt:void 0)),void 0!==n?null===n?void ce.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=ce.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!le.radioValue&&"radio"===t&&fe(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(D);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),mt={set:function(e,t,n){return!1===t?ce.removeAttr(e,n):e.setAttribute(n,n),n}},ce.each(ce.expr.match.bool.source.match(/\w+/g),function(e,t){var a=xt[t]||ce.find.attr;xt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=xt[o],xt[o]=r,r=null!=a(e,t,n)?o:null,xt[o]=i),r}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;function Tt(e){return(e.match(D)||[]).join(" ")}function Ct(e){return e.getAttribute&&e.getAttribute("class")||""}function kt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(D)||[]}ce.fn.extend({prop:function(e,t){return M(this,ce.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[ce.propFix[e]||e]})}}),ce.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ce.isXMLDoc(e)||(t=ce.propFix[t]||t,i=ce.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ce.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),le.optSelected||(ce.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ce.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ce.propFix[this.toLowerCase()]=this}),ce.fn.extend({addClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).addClass(t.call(this,e,Ct(this)))}):(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++)i=e[o],n.indexOf(" "+i+" ")<0&&(n+=i+" ");a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this},removeClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).removeClass(t.call(this,e,Ct(this)))}):arguments.length?(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++){i=e[o];while(-1<n.indexOf(" "+i+" "))n=n.replace(" "+i+" "," ")}a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this:this.attr("class","")},toggleClass:function(t,n){var e,r,i,o,a=typeof t,s="string"===a||Array.isArray(t);return v(t)?this.each(function(e){ce(this).toggleClass(t.call(this,e,Ct(this),n),n)}):"boolean"==typeof n&&s?n?this.addClass(t):this.removeClass(t):(e=kt(t),this.each(function(){if(s)for(o=ce(this),i=0;i<e.length;i++)r=e[i],o.hasClass(r)?o.removeClass(r):o.addClass(r);else void 0!==t&&"boolean"!==a||((r=Ct(this))&&_.set(this,"__className__",r),this.setAttribute&&this.setAttribute("class",r||!1===t?"":_.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+Tt(Ct(n))+" ").indexOf(t))return!0;return!1}});var St=/\r/g;ce.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=v(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,ce(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=ce.map(t,function(e){return null==e?"":e+""})),(r=ce.valHooks[this.type]||ce.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=ce.valHooks[t.type]||ce.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(St,""):null==e?"":e:void 0}}),ce.extend({valHooks:{option:{get:function(e){var t=ce.find.attr(e,"value");return null!=t?t:Tt(ce.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!fe(n.parentNode,"optgroup"))){if(t=ce(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=ce.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<ce.inArray(ce.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),ce.each(["radio","checkbox"],function(){ce.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<ce.inArray(ce(e).val(),t)}},le.checkOn||(ce.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Et=ie.location,jt={guid:Date.now()},At=/\?/;ce.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new ie.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||ce.error("Invalid XML: "+(n?ce.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Dt=/^(?:focusinfocus|focusoutblur)$/,Nt=function(e){e.stopPropagation()};ce.extend(ce.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||C],d=ue.call(e,"type")?e.type:e,h=ue.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||C,3!==n.nodeType&&8!==n.nodeType&&!Dt.test(d+ce.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[ce.expando]?e:new ce.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ce.makeArray(t,[e]),c=ce.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!y(n)){for(s=c.delegateType||d,Dt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||C)&&p.push(a.defaultView||a.parentWindow||ie)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(_.get(o,"events")||Object.create(null))[e.type]&&_.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&$(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!$(n)||u&&v(n[d])&&!y(n)&&((a=n[u])&&(n[u]=null),ce.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,Nt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,Nt),ce.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=ce.extend(new ce.Event,n,{type:e,isSimulated:!0});ce.event.trigger(r,null,t)}}),ce.fn.extend({trigger:function(e,t){return this.each(function(){ce.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ce.event.trigger(e,t,n,!0)}});var qt=/\[\]$/,Lt=/\r?\n/g,Ht=/^(?:submit|button|image|reset|file)$/i,Ot=/^(?:input|select|textarea|keygen)/i;function Pt(n,e,r,i){var t;if(Array.isArray(e))ce.each(e,function(e,t){r||qt.test(n)?i(n,t):Pt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==x(e))i(n,e);else for(t in e)Pt(n+"["+t+"]",e[t],r,i)}ce.param=function(e,t){var n,r=[],i=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!ce.isPlainObject(e))ce.each(e,function(){i(this.name,this.value)});else for(n in e)Pt(n,e[n],t,i);return r.join("&")},ce.fn.extend({serialize:function(){return ce.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ce.prop(this,"elements");return e?ce.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ce(this).is(":disabled")&&Ot.test(this.nodeName)&&!Ht.test(e)&&(this.checked||!we.test(e))}).map(function(e,t){var n=ce(this).val();return null==n?null:Array.isArray(n)?ce.map(n,function(e){return{name:t.name,value:e.replace(Lt,"\r\n")}}):{name:t.name,value:n.replace(Lt,"\r\n")}}).get()}});var Mt=/%20/g,Rt=/#.*$/,It=/([?&])_=[^&]*/,Wt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ft=/^(?:GET|HEAD)$/,$t=/^\/\//,Bt={},_t={},zt="*/".concat("*"),Xt=C.createElement("a");function Ut(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(D)||[];if(v(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Vt(t,i,o,a){var s={},u=t===_t;function l(e){var r;return s[e]=!0,ce.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function Gt(e,t){var n,r,i=ce.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&ce.extend(!0,e,r),e}Xt.href=Et.href,ce.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ce.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Gt(Gt(e,ce.ajaxSettings),t):Gt(ce.ajaxSettings,e)},ajaxPrefilter:Ut(Bt),ajaxTransport:Ut(_t),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=ce.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?ce(y):ce.event,x=ce.Deferred(),b=ce.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Wt.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Et.href)+"").replace($t,Et.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(D)||[""],null==v.crossDomain){r=C.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Xt.protocol+"//"+Xt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=ce.param(v.data,v.traditional)),Vt(Bt,v,t,T),h)return T;for(i in(g=ce.event&&v.global)&&0==ce.active++&&ce.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ft.test(v.type),f=v.url.replace(Rt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Mt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(At.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(It,"$1"),o=(At.test(f)?"&":"?")+"_="+jt.guid+++o),v.url=f+o),v.ifModified&&(ce.lastModified[f]&&T.setRequestHeader("If-Modified-Since",ce.lastModified[f]),ce.etag[f]&&T.setRequestHeader("If-None-Match",ce.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+zt+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Vt(_t,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=ie.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&ie.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<ce.inArray("script",v.dataTypes)&&ce.inArray("json",v.dataTypes)<0&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(ce.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(ce.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--ce.active||ce.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return ce.get(e,t,n,"json")},getScript:function(e,t){return ce.get(e,void 0,t,"script")}}),ce.each(["get","post"],function(e,i){ce[i]=function(e,t,n,r){return v(t)&&(r=r||n,n=t,t=void 0),ce.ajax(ce.extend({url:e,type:i,dataType:r,data:t,success:n},ce.isPlainObject(e)&&e))}}),ce.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),ce._evalUrl=function(e,t,n){return ce.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){ce.globalEval(e,t,n)}})},ce.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=ce(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return v(n)?this.each(function(e){ce(this).wrapInner(n.call(this,e))}):this.each(function(){var e=ce(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=v(t);return this.each(function(e){ce(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ce(this).replaceWith(this.childNodes)}),this}}),ce.expr.pseudos.hidden=function(e){return!ce.expr.pseudos.visible(e)},ce.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ce.ajaxSettings.xhr=function(){try{return new ie.XMLHttpRequest}catch(e){}};var Yt={0:200,1223:204},Qt=ce.ajaxSettings.xhr();le.cors=!!Qt&&"withCredentials"in Qt,le.ajax=Qt=!!Qt,ce.ajaxTransport(function(i){var o,a;if(le.cors||Qt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(Yt[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&ie.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),ce.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ce.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ce.globalEval(e),e}}}),ce.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ce.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=ce("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=Tt(e.slice(s)),e=e.slice(0,s)),v(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&ce.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?ce("<div>").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var en=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;ce.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),v(e))return r=ae.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(ae.call(arguments)))}).guid=e.guid=e.guid||ce.guid++,i},ce.holdReady=function(e){e?ce.readyWait++:ce.ready(!0)},ce.isArray=Array.isArray,ce.parseJSON=JSON.parse,ce.nodeName=fe,ce.isFunction=v,ce.isWindow=y,ce.camelCase=F,ce.type=x,ce.now=Date.now,ce.isNumeric=function(e){var t=ce.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},ce.trim=function(e){return null==e?"":(e+"").replace(en,"$1")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return ce});var tn=ie.jQuery,nn=ie.$;return ce.noConflict=function(e){return ie.$===ce&&(ie.$=nn),e&&ie.jQuery===ce&&(ie.jQuery=tn),ce},"undefined"==typeof e&&(ie.jQuery=ie.$=ce),ce});

/* jqBootstrapValidation
 * A plugin for automating validation on Twitter Bootstrap formatted forms.
 *
 * v1.3.6
 *
 * License: MIT <http://opensource.org/licenses/mit-license.php> - see LICENSE file
 *
 * http://ReactiveRaven.github.com/jqBootstrapValidation/
 */

(function( $ ){

	var createdElements = [];

	var defaults = {
		options: {
			prependExistingHelpBlock: false,
			sniffHtml: true, // sniff for 'required', 'maxlength', etc
			preventSubmit: true, // stop the form submit event from firing if validation fails
			submitError: false, // function called if there is an error when trying to submit
			submitSuccess: false, // function called just before a successful submit event is sent to the server
            semanticallyStrict: false, // set to true to tidy up generated HTML output
			autoAdd: {
				helpBlocks: true
			},
            filter: function () {
                // return $(this).is(":visible"); // only validate elements you can see
                return true; // validate everything
            }
		},
    methods: {
      init : function( options ) {

        var settings = $.extend(true, {}, defaults);

        settings.options = $.extend(true, settings.options, options);

        var $siblingElements = this;

        var uniqueForms = $.unique(
          $siblingElements.map( function () {
            return $(this).parents("form")[0];
          }).toArray()
        );

        $(uniqueForms).bind("submit", function (e) {
          var $form = $(this);
          var warningsFound = 0;
          var $inputs = $form.find("input,textarea,select").not("[type=submit],[type=image]").filter(settings.options.filter);
          $inputs.trigger("submit.validation").trigger("validationLostFocus.validation");

          $inputs.each(function (i, el) {
            var $this = $(el),
              $controlGroup = $this.parents(".form-group, .form-check, .custom-switch").first();
            if (
              $controlGroup.hasClass("warning")
            ) {
              $controlGroup.removeClass("warning").addClass("error");
              warningsFound++;
            }
          });

          $inputs.trigger("validationLostFocus.validation");

          if (warningsFound) {
            if (settings.options.preventSubmit) {
              e.preventDefault();
            }
            $form.addClass("error");
            if ($.isFunction(settings.options.submitError)) {
              settings.options.submitError($form, e, $inputs.jqBootstrapValidation("collectErrors", true));
            }
          } else {
            $form.removeClass("error");
            if ($.isFunction(settings.options.submitSuccess)) {
              settings.options.submitSuccess($form, e);
            }
          }
        });

        return this.each(function(){

          // Get references to everything we're interested in
          var $this = $(this),
            $controlGroup = $this.parents(".form-group, .form-check, .custom-switch").first(),
            $helpBlock = $controlGroup.find(".help-block").first(),
            $form = $this.parents("form").first(),
            validatorNames = [];

          // create message container if not exists
          if (!$helpBlock.length && settings.options.autoAdd && settings.options.autoAdd.helpBlocks) {
              $helpBlock = $('<div class="help-block" />');
              $controlGroup.append($helpBlock);
							createdElements.push($helpBlock[0]);
          }

          // =============================================================
          //                                     SNIFF HTML FOR VALIDATORS
          // =============================================================

          // *snort sniff snuffle*

          if (settings.options.sniffHtml) {
            var message = "";
            // ---------------------------------------------------------
            //                                                   PATTERN
            // ---------------------------------------------------------
            if ($this.attr("pattern") !== undefined) {
              message = "Not in the expected format<!-- data-validation-pattern-message to override -->";
              if ($this.data("validationPatternMessage")) {
                message = $this.data("validationPatternMessage");
              }
              $this.data("validationPatternMessage", message);
              $this.data("validationPatternRegex", $this.attr("pattern"));
            }
            // ---------------------------------------------------------
            //                                                       MAX
            // ---------------------------------------------------------
            if ($this.attr("max") !== undefined || $this.attr("aria-valuemax") !== undefined) {
              var max = ($this.attr("max") !== undefined ? $this.attr("max") : $this.attr("aria-valuemax"));
              message = "Too high: Maximum of '" + max + "'<!-- data-validation-max-message to override -->";
              if ($this.data("validationMaxMessage")) {
                message = $this.data("validationMaxMessage");
              }
              $this.data("validationMaxMessage", message);
              $this.data("validationMaxMax", max);
            }
            // ---------------------------------------------------------
            //                                                       MIN
            // ---------------------------------------------------------
            if ($this.attr("min") !== undefined || $this.attr("aria-valuemin") !== undefined) {
              var min = ($this.attr("min") !== undefined ? $this.attr("min") : $this.attr("aria-valuemin"));
              message = "Too low: Minimum of '" + min + "'<!-- data-validation-min-message to override -->";
              if ($this.data("validationMinMessage")) {
                message = $this.data("validationMinMessage");
              }
              $this.data("validationMinMessage", message);
              $this.data("validationMinMin", min);
            }
            // ---------------------------------------------------------
            //                                                 MAXLENGTH
            // ---------------------------------------------------------
            if ($this.attr("maxlength") !== undefined) {
              message = "Too long: Maximum of '" + $this.attr("maxlength") + "' characters<!-- data-validation-maxlength-message to override -->";
              if ($this.data("validationMaxlengthMessage")) {
                message = $this.data("validationMaxlengthMessage");
              }
              $this.data("validationMaxlengthMessage", message);
              $this.data("validationMaxlengthMaxlength", $this.attr("maxlength"));
            }
            // ---------------------------------------------------------
            //                                                 MINLENGTH
            // ---------------------------------------------------------
            if ($this.attr("minlength") !== undefined) {
              message = "Too short: Minimum of '" + $this.attr("minlength") + "' characters<!-- data-validation-minlength-message to override -->";
              if ($this.data("validationMinlengthMessage")) {
                message = $this.data("validationMinlengthMessage");
              }
              $this.data("validationMinlengthMessage", message);
              $this.data("validationMinlengthMinlength", $this.attr("minlength"));
            }
            // ---------------------------------------------------------
            //                                                  REQUIRED
            // ---------------------------------------------------------
            if ($this.attr("required") !== undefined || $this.attr("aria-required") !== undefined) {
              message = settings.builtInValidators.required.message;
              if ($this.data("validationRequiredMessage")) {
                message = $this.data("validationRequiredMessage");
              }
              $this.data("validationRequiredMessage", message);
            }
            // ---------------------------------------------------------
            //                                                    NUMBER
            // ---------------------------------------------------------
            if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "number") {
              message = settings.builtInValidators.number.message;
              if ($this.data("validationNumberMessage")) {
                message = $this.data("validationNumberMessage");
              }
              $this.data("validationNumberMessage", message);
            }
            // ---------------------------------------------------------
            //                                                     EMAIL
            // ---------------------------------------------------------
            if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "email") {
              message = $this.attr("data-error-validation-msg")+"<!-- data-validator-validemail-message to override -->";
              if ($this.data("validationValidemailMessage")) {
                message = $this.data("validationValidemailMessage");
              } else if ($this.data("validationEmailMessage")) {
                message = $this.data("validationEmailMessage");
              }
              $this.data("validationValidemailMessage", message);			  
            }
            // ---------------------------------------------------------
            //                                                MINCHECKED
            // ---------------------------------------------------------
            if ($this.attr("minchecked") !== undefined) {
              message = "Not enough options checked; Minimum of '" + $this.attr("minchecked") + "' required<!-- data-validation-minchecked-message to override -->";
              if ($this.data("validationMincheckedMessage")) {
                message = $this.data("validationMincheckedMessage");
              }
              $this.data("validationMincheckedMessage", message);
              $this.data("validationMincheckedMinchecked", $this.attr("minchecked"));
            }
            // ---------------------------------------------------------
            //                                                MAXCHECKED
            // ---------------------------------------------------------
            if ($this.attr("maxchecked") !== undefined) {
              message = "Too many options checked; Maximum of '" + $this.attr("maxchecked") + "' required<!-- data-validation-maxchecked-message to override -->";
              if ($this.data("validationMaxcheckedMessage")) {
                message = $this.data("validationMaxcheckedMessage");
              }
              $this.data("validationMaxcheckedMessage", message);
              $this.data("validationMaxcheckedMaxchecked", $this.attr("maxchecked"));
            }
          }

          // =============================================================
          //                                       COLLECT VALIDATOR NAMES
          // =============================================================

          // Get named validators
          if ($this.data("validation") !== undefined) {
            validatorNames = $this.data("validation").split(",");
          }

          // Get extra ones defined on the element's data attributes
          $.each($this.data(), function (i, el) {
            var parts = i.replace(/([A-Z])/g, ",$1").split(",");
            if (parts[0] === "validation" && parts[1]) {
              validatorNames.push(parts[1]);
            }
          });

          // =============================================================
          //                                     NORMALISE VALIDATOR NAMES
          // =============================================================

          var validatorNamesToInspect = validatorNames;
          var newValidatorNamesToInspect = [];

          do // repeatedly expand 'shortcut' validators into their real validators
          {
            // Uppercase only the first letter of each name
            $.each(validatorNames, function (i, el) {
              validatorNames[i] = formatValidatorName(el);
            });

            // Remove duplicate validator names
            validatorNames = $.unique(validatorNames);

            // Pull out the new validator names from each shortcut
            newValidatorNamesToInspect = [];
            $.each(validatorNamesToInspect, function(i, el) {
              if ($this.data("validation" + el + "Shortcut") !== undefined) {
                // Are these custom validators?
                // Pull them out!
                $.each($this.data("validation" + el + "Shortcut").split(","), function(i2, el2) {
                  newValidatorNamesToInspect.push(el2);
                });
              } else if (settings.builtInValidators[el.toLowerCase()]) {
                // Is this a recognised built-in?
                // Pull it out!
                var validator = settings.builtInValidators[el.toLowerCase()];
                if (validator.type.toLowerCase() === "shortcut") {
                  $.each(validator.shortcut.split(","), function (i, el) {
                    el = formatValidatorName(el);
                    newValidatorNamesToInspect.push(el);
                    validatorNames.push(el);
                  });
                }
              }
            });

            validatorNamesToInspect = newValidatorNamesToInspect;

          } while (validatorNamesToInspect.length > 0)

          // =============================================================
          //                                       SET UP VALIDATOR ARRAYS
          // =============================================================

          var validators = {};

          $.each(validatorNames, function (i, el) {
            // Set up the 'override' message
            var message = $this.data("validation" + el + "Message");
            var hasOverrideMessage = (message !== undefined);
            var foundValidator = false;
            message =
              (
                message
                  ? message
                  : "'" + el + "' validation failed <!-- Add attribute 'data-validation-" + el.toLowerCase() + "-message' to input to change this message -->"
              )
            ;

            $.each(
              settings.validatorTypes,
              function (validatorType, validatorTemplate) {
                if (validators[validatorType] === undefined) {
                  validators[validatorType] = [];
                }
                if (!foundValidator && $this.data("validation" + el + formatValidatorName(validatorTemplate.name)) !== undefined) {
                  validators[validatorType].push(
                    $.extend(
                      true,
                      {
                        name: formatValidatorName(validatorTemplate.name),
                        message: message
                      },
                      validatorTemplate.init($this, el)
                    )
                  );
                  foundValidator = true;
                }
              }
            );

            if (!foundValidator && settings.builtInValidators[el.toLowerCase()]) {

              var validator = $.extend(true, {}, settings.builtInValidators[el.toLowerCase()]);
              if (hasOverrideMessage) {
                validator.message = message;
              }
              var validatorType = validator.type.toLowerCase();

              if (validatorType === "shortcut") {
                foundValidator = true;
              } else {
                $.each(
                  settings.validatorTypes,
                  function (validatorTemplateType, validatorTemplate) {
                    if (validators[validatorTemplateType] === undefined) {
                      validators[validatorTemplateType] = [];
                    }
                    if (!foundValidator && validatorType === validatorTemplateType.toLowerCase()) {
                      $this.data("validation" + el + formatValidatorName(validatorTemplate.name), validator[validatorTemplate.name.toLowerCase()]);
                      validators[validatorType].push(
                        $.extend(
                          validator,
                          validatorTemplate.init($this, el)
                        )
                      );
                      foundValidator = true;
                    }
                  }
                );
              }
            }

            if (! foundValidator) {
              $.error("Cannot find validation info for '" + el + "'");
            }
          });

          // =============================================================
          //                                         STORE FALLBACK VALUES
          // =============================================================

          $helpBlock.data(
            "original-contents",
            (
              $helpBlock.data("original-contents")
                ? $helpBlock.data("original-contents")
                : $helpBlock.html()
            )
          );

          $helpBlock.data(
            "original-role",
            (
              $helpBlock.data("original-role")
                ? $helpBlock.data("original-role")
                : $helpBlock.attr("role")
            )
          );

          $controlGroup.data(
            "original-classes",
            (
              $controlGroup.data("original-clases")
                ? $controlGroup.data("original-classes")
                : $controlGroup.attr("class")
            )
          );

          $this.data(
            "original-aria-invalid",
            (
              $this.data("original-aria-invalid")
                ? $this.data("original-aria-invalid")
                : $this.attr("aria-invalid")
            )
          );

          // =============================================================
          //                                                    VALIDATION
          // =============================================================

          $this.bind(
            "validation.validation",
            function (event, params) {

              var value = getValue($this);

              // Get a list of the errors to apply
              var errorsFound = [];

              $.each(validators, function (validatorType, validatorTypeArray) {
                if (value || value.length || (params && params.includeEmpty) || (!!settings.validatorTypes[validatorType].blockSubmit && params && !!params.submitting)) {
                  $.each(validatorTypeArray, function (i, validator) {
                    if (settings.validatorTypes[validatorType].validate($this, value, validator)) {
                      errorsFound.push(validator.message);
                    }
                  });
                }
              });

              return errorsFound;
            }
          );

          $this.bind(
            "getValidators.validation",
            function () {
              return validators;
            }
          );

          // =============================================================
          //                                             WATCH FOR CHANGES
          // =============================================================
          $this.bind(
            "submit.validation",
            function () {
              return $this.triggerHandler("change.validation", {submitting: true});
            }
          );
          $this.bind(
            [
              "keyup",
              "focus",
              "blur",
              "click",
              "keydown",
              "keypress",
              "change"
            ].join(".validation ") + ".validation",
            function (e, params) {

              var value = getValue($this);

              var errorsFound = [];

              $controlGroup.find("input,textarea,select").each(function (i, el) {
                var oldCount = errorsFound.length;
                $.each($(el).triggerHandler("validation.validation", params), function (j, message) {
                  errorsFound.push(message);
                });
                if (errorsFound.length > oldCount) {
                  $(el).attr("aria-invalid", "true");
                } else {
                  var original = $this.data("original-aria-invalid");
                  $(el).attr("aria-invalid", (original !== undefined ? original : false));
                }
              });

              $form.find("input,select,textarea").not($this).not("[name=\"" + $this.attr("name") + "\"]").trigger("validationLostFocus.validation");

              errorsFound = $.unique(errorsFound.sort());

              // Were there any errors?
              if (errorsFound.length) {
                // Better flag it up as a warning.
                $controlGroup.removeClass("success error").addClass("warning");

                // How many errors did we find?
                if (settings.options.semanticallyStrict && errorsFound.length === 1) {
                  // Only one? Being strict? Just output it.
                  $helpBlock.html(errorsFound[0] + 
                    ( settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : "" ));
                } else {
                  // Multiple? Being sloppy? Glue them together into an UL.
                  $helpBlock.html("<ul class=\"list-unstyled alert alert-warning mt-2\" role=\"alert\"><li>" + errorsFound.join("</li><li>") + "</li></ul>" +
                    ( settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : "" ));
                }
              } else {
                $controlGroup.removeClass("warning error success");
                if (value.length > 0) {
                  $controlGroup.addClass("success");
                }
                $helpBlock.html($helpBlock.data("original-contents"));
              }

              if (e.type === "blur") {
                $controlGroup.removeClass("success");
              }
            }
          );
          $this.bind("validationLostFocus.validation", function () {
            $controlGroup.removeClass("success");
          });
        });
      },
      destroy : function( ) {

        return this.each(
          function() {

            var
              $this = $(this),
              $controlGroup = $this.parents(".form-group, .form-check, .custom-switch").first(),
              $helpBlock = $controlGroup.find(".help-block").first();

            // remove our events
            $this.unbind('.validation'); // events are namespaced.
            // reset help text
            $helpBlock.html($helpBlock.data("original-contents"));
            // reset classes
            $controlGroup.attr("class", $controlGroup.data("original-classes"));
            // reset aria
            $this.attr("aria-invalid", $this.data("original-aria-invalid"));
            // reset role
            $helpBlock.attr("role", $this.data("original-role"));
						// remove all elements we created
						if (createdElements.indexOf($helpBlock[0]) > -1) {
							$helpBlock.remove();
						}

          }
        );

      },
      collectErrors : function(includeEmpty) {

        var errorMessages = {};
        this.each(function (i, el) {
          var $el = $(el);
          var name = $el.attr("name");
          var errors = $el.triggerHandler("validation.validation", {includeEmpty: true});
          errorMessages[name] = $.extend(true, errors, errorMessages[name]);
        });

        $.each(errorMessages, function (i, el) {
          if (el.length === 0) {
            delete errorMessages[i];
          }
        });

        return errorMessages;

      },
      hasErrors: function() {

        var errorMessages = [];

        this.each(function (i, el) {
          errorMessages = errorMessages.concat(
            $(el).triggerHandler("getValidators.validation") ? $(el).triggerHandler("validation.validation", {submitting: true}) : []
          );
        });

        return (errorMessages.length > 0);
      },
      override : function (newDefaults) {
        defaults = $.extend(true, defaults, newDefaults);
      }
    },
		validatorTypes: {
      callback: {
        name: "callback",
        init: function ($this, name) {
          return {
            validatorName: name,
            callback: $this.data("validation" + name + "Callback"),
            lastValue: $this.val(),
            lastValid: true,
            lastFinished: true
          };
        },
        validate: function ($this, value, validator) {
          if (validator.lastValue === value && validator.lastFinished) {
            return !validator.lastValid;
          }

          if (validator.lastFinished === true)
          {
            validator.lastValue = value;
            validator.lastValid = true;
            validator.lastFinished = false;

            var rrjqbvValidator = validator;
            var rrjqbvThis = $this;
            executeFunctionByName(
              validator.callback,
              window,
              $this,
              value,
              function (data) {
                if (rrjqbvValidator.lastValue === data.value) {
                  rrjqbvValidator.lastValid = data.valid;
                  if (data.message) {
                    rrjqbvValidator.message = data.message;
                  }
                  rrjqbvValidator.lastFinished = true;
                  rrjqbvThis.data("validation" + rrjqbvValidator.validatorName + "Message", rrjqbvValidator.message);
                  // Timeout is set to avoid problems with the events being considered 'already fired'
                  setTimeout(function () {
                    rrjqbvThis.trigger("change.validation");
                  }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
                }
              }
            );
          }

          return false;

        }
      },
      ajax: {
        name: "ajax",
        init: function ($this, name) {
          return {
            validatorName: name,
            url: $this.data("validation" + name + "Ajax"),
            lastValue: $this.val(),
            lastValid: true,
            lastFinished: true
          };
        },
        validate: function ($this, value, validator) {
          if (""+validator.lastValue === ""+value && validator.lastFinished === true) {
            return validator.lastValid === false;
          }

          if (validator.lastFinished === true)
          {
            validator.lastValue = value;
            validator.lastValid = true;
            validator.lastFinished = false;
            $.ajax({
              url: validator.url,
              data: "value=" + value + "&field=" + $this.attr("name"),
              dataType: "json",
              success: function (data) {
                if (""+validator.lastValue === ""+data.value) {
                  validator.lastValid = !!(data.valid);
                  if (data.message) {
                    validator.message = data.message;
                  }
                  validator.lastFinished = true;
                  $this.data("validation" + validator.validatorName + "Message", validator.message);
                  // Timeout is set to avoid problems with the events being considered 'already fired'
                  setTimeout(function () {
                    $this.trigger("change.validation");
                  }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
                }
              },
              failure: function () {
                validator.lastValid = true;
                validator.message = "ajax call failed";
                validator.lastFinished = true;
                $this.data("validation" + validator.validatorName + "Message", validator.message);
                // Timeout is set to avoid problems with the events being considered 'already fired'
                setTimeout(function () {
                  $this.trigger("change.validation");
                }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
              }
            });
          }

          return false;

        }
      },
			regex: {
				name: "regex",
				init: function ($this, name) {
					return {regex: regexFromString($this.data("validation" + name + "Regex"))};
				},
				validate: function ($this, value, validator) {
					return (!validator.regex.test(value) && ! validator.negative)
						|| (validator.regex.test(value) && validator.negative);
				}
			},
			required: {
				name: "required",
				init: function ($this, name) {
					return {};
				},
				validate: function ($this, value, validator) {
					return !!(value.length === 0  && ! validator.negative)
						|| !!(value.length > 0 && validator.negative);
				},
        blockSubmit: true
			},
			match: {
				name: "match",
				init: function ($this, name) {
					var element = $this.parents("form").first().find("[name=\"" + $this.data("validation" + name + "Match") + "\"]").first();
					element.bind("validation.validation", function () {
						$this.trigger("change.validation", {submitting: true});
					});
					return {"element": element};
				},
				validate: function ($this, value, validator) {
					return (value !== validator.element.val() && ! validator.negative)
						|| (value === validator.element.val() && validator.negative);
				},
        blockSubmit: true
			},
			max: {
				name: "max",
				init: function ($this, name) {
					return {max: $this.data("validation" + name + "Max")};
				},
				validate: function ($this, value, validator) {
					return (parseFloat(value, 10) > parseFloat(validator.max, 10) && ! validator.negative)
						|| (parseFloat(value, 10) <= parseFloat(validator.max, 10) && validator.negative);
				}
			},
			min: {
				name: "min",
				init: function ($this, name) {
					return {min: $this.data("validation" + name + "Min")};
				},
				validate: function ($this, value, validator) {
					return (parseFloat(value) < parseFloat(validator.min) && ! validator.negative)
						|| (parseFloat(value) >= parseFloat(validator.min) && validator.negative);
				}
			},
			maxlength: {
				name: "maxlength",
				init: function ($this, name) {
					return {maxlength: $this.data("validation" + name + "Maxlength")};
				},
				validate: function ($this, value, validator) {
					return ((value.length > validator.maxlength) && ! validator.negative)
						|| ((value.length <= validator.maxlength) && validator.negative);
				}
			},
			minlength: {
				name: "minlength",
				init: function ($this, name) {
					return {minlength: $this.data("validation" + name + "Minlength")};
				},
				validate: function ($this, value, validator) {
					return ((value.length < validator.minlength) && ! validator.negative)
						|| ((value.length >= validator.minlength) && validator.negative);
				}
			},
			maxchecked: {
				name: "maxchecked",
				init: function ($this, name) {
					var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]");
					elements.bind("click.validation", function () {
						$this.trigger("change.validation", {includeEmpty: true});
					});
					return {maxchecked: $this.data("validation" + name + "Maxchecked"), elements: elements};
				},
				validate: function ($this, value, validator) {
					return (validator.elements.filter(":checked").length > validator.maxchecked && ! validator.negative)
						|| (validator.elements.filter(":checked").length <= validator.maxchecked && validator.negative);
				},
        blockSubmit: true
			},
			minchecked: {
				name: "minchecked",
				init: function ($this, name) {
					var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]");
					elements.bind("click.validation", function () {
						$this.trigger("change.validation", {includeEmpty: true});
					});
					return {minchecked: $this.data("validation" + name + "Minchecked"), elements: elements};
				},
				validate: function ($this, value, validator) {
					return (validator.elements.filter(":checked").length < validator.minchecked && ! validator.negative)
						|| (validator.elements.filter(":checked").length >= validator.minchecked && validator.negative);
				},
        blockSubmit: true
			}
		},
		builtInValidators: {
			email: {
				name: "Email",
				type: "shortcut",
				shortcut: "validemail"
			},
			validemail: {
				name: "Validemail",
				type: "regex",
				regex: "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\.[A-Za-z]{2,10}",
				message: "Not a valid email address<!-- data-validator-validemail-message to override -->"
			},
			passwordagain: {
				name: "Passwordagain",
				type: "match",
				match: "password",
				message: "Does not match the given password<!-- data-validator-paswordagain-message to override -->"
			},
			positive: {
				name: "Positive",
				type: "shortcut",
				shortcut: "number,positivenumber"
			},
			negative: {
				name: "Negative",
				type: "shortcut",
				shortcut: "number,negativenumber"
			},
			number: {
				name: "Number",
				type: "regex",
				regex: "([+-]?\\\d+(\\\.\\\d*)?([eE][+-]?[0-9]+)?)?",
				message: "Must be a number<!-- data-validator-number-message to override -->"
			},
			integer: {
				name: "Integer",
				type: "regex",
				regex: "[+-]?\\\d+",
				message: "No decimal places allowed<!-- data-validator-integer-message to override -->"
			},
			positivenumber: {
				name: "Positivenumber",
				type: "min",
				min: 0,
				message: "Must be a positive number<!-- data-validator-positivenumber-message to override -->"
			},
			negativenumber: {
				name: "Negativenumber",
				type: "max",
				max: 0,
				message: "Must be a negative number<!-- data-validator-negativenumber-message to override -->"
			},
			required: {
				name: "Required",
				type: "required",
				message: "This is required<!-- data-validator-required-message to override -->"
			},
			checkone: {
				name: "Checkone",
				type: "minchecked",
				minchecked: 1,
				message: "Check at least one option<!-- data-validation-checkone-message to override -->"
			}
		}
	};

	var formatValidatorName = function (name) {
		return name
			.toLowerCase()
			.replace(
				/(^|\s)([a-z])/g ,
				function(m,p1,p2) {
					return p1+p2.toUpperCase();
				}
			)
		;
	};

	var getValue = function ($this) {
		// Extract the value we're talking about
		var value = $this.val();
		var type = $this.attr("type");
		if (type === "checkbox") {
			value = ($this.is(":checked") ? value : "");
		}
		if (type === "radio") {
			value = ($('input[name="' + $this.attr("name") + '"]:checked').length > 0 ? value : "");
		}
		return value;
	};

  function regexFromString(inputstring) {
		return new RegExp("^" + inputstring + "$");
	}

  /**
   * Thanks to Jason Bunting via StackOverflow.com
   *
   * http://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string#answer-359910
   * Short link: http://tinyurl.com/executeFunctionByName
  **/
  function executeFunctionByName(functionName, context /*, args*/) {
    var args = Array.prototype.slice.call(arguments).splice(2);
    var namespaces = functionName.split(".");
    var func = namespaces.pop();
    for(var i = 0; i < namespaces.length; i++) {
      context = context[namespaces[i]];
    }
    return context[func].apply(this, args);
  }

	$.fn.jqBootstrapValidation = function( method ) {

		if ( defaults.methods[method] ) {
			return defaults.methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
		} else if ( typeof method === 'object' || ! method ) {
			return defaults.methods.init.apply( this, arguments );
		} else {
		$.error( 'Method ' +  method + ' does not exist on jQuery.jqBootstrapValidation' );
			return null;
		}

	};

  $.jqBootstrapValidation = function (options) {
    $(":input").not("[type=image],[type=submit]").jqBootstrapValidation.apply(this,arguments);
  };

})( jQuery );

/*! lazysizes - v5.3.0 */
!function(e){var t=function(u,D,f){"use strict";var k,H;if(function(){var e;var t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:true,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:true,ricTimeout:0,throttleDelay:125};H=u.lazySizesConfig||u.lazysizesConfig||{};for(e in t){if(!(e in H)){H[e]=t[e]}}}(),!D||!D.getElementsByClassName){return{init:function(){},cfg:H,noSupport:true}}var O=D.documentElement,i=u.HTMLPictureElement,P="addEventListener",$="getAttribute",q=u[P].bind(u),I=u.setTimeout,U=u.requestAnimationFrame||I,o=u.requestIdleCallback,j=/^picture$/i,r=["load","error","lazyincluded","_lazyloaded"],a={},G=Array.prototype.forEach,J=function(e,t){if(!a[t]){a[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")}return a[t].test(e[$]("class")||"")&&a[t]},K=function(e,t){if(!J(e,t)){e.setAttribute("class",(e[$]("class")||"").trim()+" "+t)}},Q=function(e,t){var a;if(a=J(e,t)){e.setAttribute("class",(e[$]("class")||"").replace(a," "))}},V=function(t,a,e){var i=e?P:"removeEventListener";if(e){V(t,a)}r.forEach(function(e){t[i](e,a)})},X=function(e,t,a,i,r){var n=D.createEvent("Event");if(!a){a={}}a.instance=k;n.initEvent(t,!i,!r);n.detail=a;e.dispatchEvent(n);return n},Y=function(e,t){var a;if(!i&&(a=u.picturefill||H.pf)){if(t&&t.src&&!e[$]("srcset")){e.setAttribute("srcset",t.src)}a({reevaluate:true,elements:[e]})}else if(t&&t.src){e.src=t.src}},Z=function(e,t){return(getComputedStyle(e,null)||{})[t]},s=function(e,t,a){a=a||e.offsetWidth;while(a<H.minSize&&t&&!e._lazysizesWidth){a=t.offsetWidth;t=t.parentNode}return a},ee=function(){var a,i;var t=[];var r=[];var n=t;var s=function(){var e=n;n=t.length?r:t;a=true;i=false;while(e.length){e.shift()()}a=false};var e=function(e,t){if(a&&!t){e.apply(this,arguments)}else{n.push(e);if(!i){i=true;(D.hidden?I:U)(s)}}};e._lsFlush=s;return e}(),te=function(a,e){return e?function(){ee(a)}:function(){var e=this;var t=arguments;ee(function(){a.apply(e,t)})}},ae=function(e){var a;var i=0;var r=H.throttleDelay;var n=H.ricTimeout;var t=function(){a=false;i=f.now();e()};var s=o&&n>49?function(){o(t,{timeout:n});if(n!==H.ricTimeout){n=H.ricTimeout}}:te(function(){I(t)},true);return function(e){var t;if(e=e===true){n=33}if(a){return}a=true;t=r-(f.now()-i);if(t<0){t=0}if(e||t<9){s()}else{I(s,t)}}},ie=function(e){var t,a;var i=99;var r=function(){t=null;e()};var n=function(){var e=f.now()-a;if(e<i){I(n,i-e)}else{(o||r)(r)}};return function(){a=f.now();if(!t){t=I(n,i)}}},e=function(){var v,m,c,h,e;var y,z,g,p,C,b,A;var n=/^img$/i;var d=/^iframe$/i;var E="onscroll"in u&&!/(gle|ing)bot/.test(navigator.userAgent);var _=0;var w=0;var M=0;var N=-1;var L=function(e){M--;if(!e||M<0||!e.target){M=0}};var x=function(e){if(A==null){A=Z(D.body,"visibility")=="hidden"}return A||!(Z(e.parentNode,"visibility")=="hidden"&&Z(e,"visibility")=="hidden")};var W=function(e,t){var a;var i=e;var r=x(e);g-=t;b+=t;p-=t;C+=t;while(r&&(i=i.offsetParent)&&i!=D.body&&i!=O){r=(Z(i,"opacity")||1)>0;if(r&&Z(i,"overflow")!="visible"){a=i.getBoundingClientRect();r=C>a.left&&p<a.right&&b>a.top-1&&g<a.bottom+1}}return r};var t=function(){var e,t,a,i,r,n,s,o,l,u,f,c;var d=k.elements;if((h=H.loadMode)&&M<8&&(e=d.length)){t=0;N++;for(;t<e;t++){if(!d[t]||d[t]._lazyRace){continue}if(!E||k.prematureUnveil&&k.prematureUnveil(d[t])){R(d[t]);continue}if(!(o=d[t][$]("data-expand"))||!(n=o*1)){n=w}if(!u){u=!H.expand||H.expand<1?O.clientHeight>500&&O.clientWidth>500?500:370:H.expand;k._defEx=u;f=u*H.expFactor;c=H.hFac;A=null;if(w<f&&M<1&&N>2&&h>2&&!D.hidden){w=f;N=0}else if(h>1&&N>1&&M<6){w=u}else{w=_}}if(l!==n){y=innerWidth+n*c;z=innerHeight+n;s=n*-1;l=n}a=d[t].getBoundingClientRect();if((b=a.bottom)>=s&&(g=a.top)<=z&&(C=a.right)>=s*c&&(p=a.left)<=y&&(b||C||p||g)&&(H.loadHidden||x(d[t]))&&(m&&M<3&&!o&&(h<3||N<4)||W(d[t],n))){R(d[t]);r=true;if(M>9){break}}else if(!r&&m&&!i&&M<4&&N<4&&h>2&&(v[0]||H.preloadAfterLoad)&&(v[0]||!o&&(b||C||p||g||d[t][$](H.sizesAttr)!="auto"))){i=v[0]||d[t]}}if(i&&!r){R(i)}}};var a=ae(t);var S=function(e){var t=e.target;if(t._lazyCache){delete t._lazyCache;return}L(e);K(t,H.loadedClass);Q(t,H.loadingClass);V(t,B);X(t,"lazyloaded")};var i=te(S);var B=function(e){i({target:e.target})};var T=function(e,t){var a=e.getAttribute("data-load-mode")||H.iframeLoadMode;if(a==0){e.contentWindow.location.replace(t)}else if(a==1){e.src=t}};var F=function(e){var t;var a=e[$](H.srcsetAttr);if(t=H.customMedia[e[$]("data-media")||e[$]("media")]){e.setAttribute("media",t)}if(a){e.setAttribute("srcset",a)}};var s=te(function(t,e,a,i,r){var n,s,o,l,u,f;if(!(u=X(t,"lazybeforeunveil",e)).defaultPrevented){if(i){if(a){K(t,H.autosizesClass)}else{t.setAttribute("sizes",i)}}s=t[$](H.srcsetAttr);n=t[$](H.srcAttr);if(r){o=t.parentNode;l=o&&j.test(o.nodeName||"")}f=e.firesLoad||"src"in t&&(s||n||l);u={target:t};K(t,H.loadingClass);if(f){clearTimeout(c);c=I(L,2500);V(t,B,true)}if(l){G.call(o.getElementsByTagName("source"),F)}if(s){t.setAttribute("srcset",s)}else if(n&&!l){if(d.test(t.nodeName)){T(t,n)}else{t.src=n}}if(r&&(s||l)){Y(t,{src:n})}}if(t._lazyRace){delete t._lazyRace}Q(t,H.lazyClass);ee(function(){var e=t.complete&&t.naturalWidth>1;if(!f||e){if(e){K(t,H.fastLoadedClass)}S(u);t._lazyCache=true;I(function(){if("_lazyCache"in t){delete t._lazyCache}},9)}if(t.loading=="lazy"){M--}},true)});var R=function(e){if(e._lazyRace){return}var t;var a=n.test(e.nodeName);var i=a&&(e[$](H.sizesAttr)||e[$]("sizes"));var r=i=="auto";if((r||!m)&&a&&(e[$]("src")||e.srcset)&&!e.complete&&!J(e,H.errorClass)&&J(e,H.lazyClass)){return}t=X(e,"lazyunveilread").detail;if(r){re.updateElem(e,true,e.offsetWidth)}e._lazyRace=true;M++;s(e,t,r,i,a)};var r=ie(function(){H.loadMode=3;a()});var o=function(){if(H.loadMode==3){H.loadMode=2}r()};var l=function(){if(m){return}if(f.now()-e<999){I(l,999);return}m=true;H.loadMode=3;a();q("scroll",o,true)};return{_:function(){e=f.now();k.elements=D.getElementsByClassName(H.lazyClass);v=D.getElementsByClassName(H.lazyClass+" "+H.preloadClass);q("scroll",a,true);q("resize",a,true);q("pageshow",function(e){if(e.persisted){var t=D.querySelectorAll("."+H.loadingClass);if(t.length&&t.forEach){U(function(){t.forEach(function(e){if(e.complete){R(e)}})})}}});if(u.MutationObserver){new MutationObserver(a).observe(O,{childList:true,subtree:true,attributes:true})}else{O[P]("DOMNodeInserted",a,true);O[P]("DOMAttrModified",a,true);setInterval(a,999)}q("hashchange",a,true);["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){D[P](e,a,true)});if(/d$|^c/.test(D.readyState)){l()}else{q("load",l);D[P]("DOMContentLoaded",a);I(l,2e4)}if(k.elements.length){t();ee._lsFlush()}else{a()}},checkElems:a,unveil:R,_aLSL:o}}(),re=function(){var a;var n=te(function(e,t,a,i){var r,n,s;e._lazysizesWidth=i;i+="px";e.setAttribute("sizes",i);if(j.test(t.nodeName||"")){r=t.getElementsByTagName("source");for(n=0,s=r.length;n<s;n++){r[n].setAttribute("sizes",i)}}if(!a.detail.dataAttr){Y(e,a.detail)}});var i=function(e,t,a){var i;var r=e.parentNode;if(r){a=s(e,r,a);i=X(e,"lazybeforesizes",{width:a,dataAttr:!!t});if(!i.defaultPrevented){a=i.detail.width;if(a&&a!==e._lazysizesWidth){n(e,r,i,a)}}}};var e=function(){var e;var t=a.length;if(t){e=0;for(;e<t;e++){i(a[e])}}};var t=ie(e);return{_:function(){a=D.getElementsByClassName(H.autosizesClass);q("resize",t)},checkElems:t,updateElem:i}}(),t=function(){if(!t.i&&D.getElementsByClassName){t.i=true;re._();e._()}};return I(function(){H.init&&t()}),k={cfg:H,autoSizer:re,loader:e,init:t,uP:Y,aC:K,rC:Q,hC:J,fire:X,gW:s,rAF:ee}}(e,e.document,Date);e.lazySizes=t,"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:{});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.Macy=n()}(this,function(){"use strict";function t(t,n){var e=void 0;return function(){e&&clearTimeout(e),e=setTimeout(t,n)}}function n(t,n){for(var e=t.length,r=e,o=[];e--;)o.push(n(t[r-e-1]));return o}function e(t,n){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(window.Promise)return A(t,n,e);t.recalculate(!0,!0)}function r(t){for(var n=t.options,e=t.responsiveOptions,r=t.keys,o=t.docWidth,i=void 0,s=0;s<r.length;s++){var a=parseInt(r[s],10);o>=a&&(i=n.breakAt[a],O(i,e))}return e}function o(t){for(var n=t.options,e=t.responsiveOptions,r=t.keys,o=t.docWidth,i=void 0,s=r.length-1;s>=0;s--){var a=parseInt(r[s],10);o<=a&&(i=n.breakAt[a],O(i,e))}return e}function i(t){var n=t.useContainerForBreakpoints?t.container.clientWidth:window.innerWidth,e={columns:t.columns};b(t.margin)?e.margin={x:t.margin.x,y:t.margin.y}:e.margin={x:t.margin,y:t.margin};var i=Object.keys(t.breakAt);return t.mobileFirst?r({options:t,responsiveOptions:e,keys:i,docWidth:n}):o({options:t,responsiveOptions:e,keys:i,docWidth:n})}function s(t){return i(t).columns}function a(t){return i(t).margin}function c(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=s(t),r=a(t).x,o=100/e;if(!n)return o;if(1===e)return"100%";var i="px";if("string"==typeof r){var c=parseFloat(r);i=r.replace(c,""),r=c}return r=(e-1)*r/e,"%"===i?o-r+"%":"calc("+o+"% - "+r+i+")"}function u(t,n){var e=s(t.options),r=0,o=void 0,i=void 0;if(1===++n)return 0;i=a(t.options).x;var u="px";if("string"==typeof i){var l=parseFloat(i,10);u=i.replace(l,""),i=l}return o=(i-(e-1)*i/e)*(n-1),r+=c(t.options,!1)*(n-1),"%"===u?r+o+"%":"calc("+r+"% + "+o+u+")"}function l(t){var n=0,e=t.container,r=t.rows;v(r,function(t){n=t>n?t:n}),e.style.height=n+"px"}function p(t,n){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=s(t.options),i=a(t.options).y;M(t,o,e),v(n,function(n){var e=0,o=parseInt(n.offsetHeight,10);isNaN(o)||(t.rows.forEach(function(n,r){n<t.rows[e]&&(e=r)}),n.style.position="absolute",n.style.top=t.rows[e]+"px",n.style.left=""+t.cols[e],t.rows[e]+=isNaN(o)?0:o+i,r&&(n.dataset.macyComplete=1))}),r&&(t.tmpRows=null),l(t)}function f(t,n){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=s(t.options),i=a(t.options).y;M(t,o,e),v(n,function(n){t.lastcol===o&&(t.lastcol=0);var e=C(n,"height");e=parseInt(n.offsetHeight,10),isNaN(e)||(n.style.position="absolute",n.style.top=t.rows[t.lastcol]+"px",n.style.left=""+t.cols[t.lastcol],t.rows[t.lastcol]+=isNaN(e)?0:e+i,t.lastcol+=1,r&&(n.dataset.macyComplete=1))}),r&&(t.tmpRows=null),l(t)}var h=function t(n,e){if(!(this instanceof t))return new t(n,e);if(n&&n.nodeName)return n;if(n=n.replace(/^\s*/,"").replace(/\s*$/,""),e)return this.byCss(n,e);for(var r in this.selectors)if(e=r.split("/"),new RegExp(e[1],e[2]).test(n))return this.selectors[r](n);return this.byCss(n)};h.prototype.byCss=function(t,n){return(n||document).querySelectorAll(t)},h.prototype.selectors={},h.prototype.selectors[/^\.[\w\-]+$/]=function(t){return document.getElementsByClassName(t.substring(1))},h.prototype.selectors[/^\w+$/]=function(t){return document.getElementsByTagName(t)},h.prototype.selectors[/^\#[\w\-]+$/]=function(t){return document.getElementById(t.substring(1))};var v=function(t,n){for(var e=t.length,r=e;e--;)n(t[r-e-1])},m=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.running=!1,this.events=[],this.add(t)};m.prototype.run=function(){if(!this.running&&this.events.length>0){var t=this.events.shift();this.running=!0,t(),this.running=!1,this.run()}},m.prototype.add=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!!n&&(Array.isArray(n)?v(n,function(n){return t.add(n)}):(this.events.push(n),void this.run()))},m.prototype.clear=function(){this.events=[]};var d=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.instance=t,this.data=n,this},y=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.events={},this.instance=t};y.prototype.on=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!(!t||!n)&&(Array.isArray(this.events[t])||(this.events[t]=[]),this.events[t].push(n))},y.prototype.emit=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||!Array.isArray(this.events[t]))return!1;var e=new d(this.instance,n);v(this.events[t],function(t){return t(e)})};var g=function(t){return!("naturalHeight"in t&&t.naturalHeight+t.naturalWidth===0)||t.width+t.height!==0},E=function(t,n){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise(function(t,e){if(n.complete)return g(n)?t(n):e(n);n.addEventListener("load",function(){return g(n)?t(n):e(n)}),n.addEventListener("error",function(){return e(n)})}).then(function(n){e&&t.emit(t.constants.EVENT_IMAGE_LOAD,{img:n})}).catch(function(n){return t.emit(t.constants.EVENT_IMAGE_ERROR,{img:n})})},w=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n(e,function(n){return E(t,n,r)})},A=function(t,n){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Promise.all(w(t,n,e)).then(function(){t.emit(t.constants.EVENT_IMAGE_COMPLETE)})},I=function(n){return t(function(){n.emit(n.constants.EVENT_RESIZE),n.queue.add(function(){return n.recalculate(!0,!0)})},100)},N=function(t){if(t.container=h(t.options.container),t.container instanceof h||!t.container)return!!t.options.debug&&console.error("Error: Container not found");t.container.length&&(t.container=t.container[0]),t.options.container=t.container,t.container.style.position="relative"},T=function(t){t.queue=new m,t.events=new y(t),t.rows=[],t.resizer=I(t)},L=function(t){var n=h("img",t.container);window.addEventListener("resize",t.resizer),t.on(t.constants.EVENT_IMAGE_LOAD,function(){return t.recalculate(!1,!1)}),t.on(t.constants.EVENT_IMAGE_COMPLETE,function(){return t.recalculate(!0,!0)}),t.options.useOwnImageLoader||e(t,n,!t.options.waitForImages),t.emit(t.constants.EVENT_INITIALIZED)},_=function(t){N(t),T(t),L(t)},b=function(t){return t===Object(t)&&"[object Array]"!==Object.prototype.toString.call(t)},O=function(t,n){b(t)||(n.columns=t),b(t)&&t.columns&&(n.columns=t.columns),b(t)&&t.margin&&!b(t.margin)&&(n.margin={x:t.margin,y:t.margin}),b(t)&&t.margin&&b(t.margin)&&t.margin.x&&(n.margin.x=t.margin.x),b(t)&&t.margin&&b(t.margin)&&t.margin.y&&(n.margin.y=t.margin.y)},C=function(t,n){return window.getComputedStyle(t,null).getPropertyValue(n)},M=function(t,n){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.lastcol||(t.lastcol=0),t.rows.length<1&&(e=!0),e){t.rows=[],t.cols=[],t.lastcol=0;for(var r=n-1;r>=0;r--)t.rows[r]=0,t.cols[r]=u(t,r)}else if(t.tmpRows){t.rows=[];for(var r=n-1;r>=0;r--)t.rows[r]=t.tmpRows[r]}else{t.tmpRows=[];for(var r=n-1;r>=0;r--)t.tmpRows[r]=t.rows[r]}},V=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=n?t.container.children:h(':scope > *:not([data-macy-complete="1"])',t.container);r=Array.from(r).filter(function(t){return null!==t.offsetParent});var o=c(t.options);return v(r,function(t){n&&(t.dataset.macyComplete=0),t.style.width=o}),t.options.trueOrder?(f(t,r,n,e),t.emit(t.constants.EVENT_RECALCULATED)):(p(t,r,n,e),t.emit(t.constants.EVENT_RECALCULATED))},R=function(){return!!window.Promise},x=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};Array.from||(Array.from=function(t){for(var n=0,e=[];n<t.length;)e.push(t[n++]);return e});var k={columns:4,margin:2,trueOrder:!1,waitForImages:!1,useImageLoader:!0,breakAt:{},useOwnImageLoader:!1,onInit:!1,cancelLegacy:!1,useContainerForBreakpoints:!1};!function(){try{document.createElement("a").querySelector(":scope *")}catch(t){!function(){function t(t){return function(e){if(e&&n.test(e)){var r=this.getAttribute("id");r||(this.id="q"+Math.floor(9e6*Math.random())+1e6),arguments[0]=e.replace(n,"#"+this.id);var o=t.apply(this,arguments);return null===r?this.removeAttribute("id"):r||(this.id=r),o}return t.apply(this,arguments)}}var n=/:scope\b/gi,e=t(Element.prototype.querySelector);Element.prototype.querySelector=function(t){return e.apply(this,arguments)};var r=t(Element.prototype.querySelectorAll);Element.prototype.querySelectorAll=function(t){return r.apply(this,arguments)}}()}}();var q=function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:k;if(!(this instanceof t))return new t(n);this.options={},x(this.options,k,n),this.options.cancelLegacy&&!R()||_(this)};return q.init=function(t){return console.warn("Depreciated: Macy.init will be removed in v3.0.0 opt to use Macy directly like so Macy({ /*options here*/ }) "),new q(t)},q.prototype.recalculateOnImageLoad=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e(this,h("img",this.container),!t)},q.prototype.runOnImageLoad=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=h("img",this.container);return this.on(this.constants.EVENT_IMAGE_COMPLETE,t),n&&this.on(this.constants.EVENT_IMAGE_LOAD,t),e(this,r,n)},q.prototype.recalculate=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e&&this.queue.clear(),this.queue.add(function(){return V(t,n,e)})},q.prototype.remove=function(){window.removeEventListener("resize",this.resizer),v(this.container.children,function(t){t.removeAttribute("data-macy-complete"),t.removeAttribute("style")}),this.container.removeAttribute("style")},q.prototype.reInit=function(){this.recalculate(!0,!0),this.emit(this.constants.EVENT_INITIALIZED),window.addEventListener("resize",this.resizer),this.container.style.position="relative"},q.prototype.on=function(t,n){this.events.on(t,n)},q.prototype.emit=function(t,n){this.events.emit(t,n)},q.constants={EVENT_INITIALIZED:"macy.initialized",EVENT_RECALCULATED:"macy.recalculated",EVENT_IMAGE_LOAD:"macy.image.load",EVENT_IMAGE_ERROR:"macy.image.error",EVENT_IMAGE_COMPLETE:"macy.images.complete",EVENT_RESIZE:"macy.resize"},q.prototype.constants=q.constants,q});

/*! volt-editor v2.0.2 */
(function(){var a;a={},a.Machine=function(){function a(a){this.context=a,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return a.prototype.addTransition=function(a,b,c,d){return c||(c=b),this._stateTransitions[[a,b]]=[c,d]},a.prototype.addTransitions=function(a,b,c,d){var e,f,g,h;for(c||(c=b),h=[],f=0,g=a.length;f<g;f++)e=a[f],h.push(this.addTransition(e,b,c,d));return h},a.prototype.addTransitionAny=function(a,b,c){return b||(b=a),this._stateTransitionsAny[a]=[b,c]},a.prototype.setDefaultTransition=function(a,b){return this._defaultTransition=[a,b]},a.prototype.getTransition=function(a,b){if(this._stateTransitions[[a,b]])return this._stateTransitions[[a,b]];if(this._stateTransitionsAny[b])return this._stateTransitionsAny[b];if(this._defaultTransition)return this._defaultTransition;throw new Error("Transition is undefined: ("+a+", "+b+")")},a.prototype.getCurrentState=function(){return this._currentState},a.prototype.setInitialState=function(a){if(this._initialState=a,!this._currentState)return this.reset()},a.prototype.reset=function(){return this._currentState=this._initialState},a.prototype.process=function(a){var b;return b=this.getTransition(a,this._currentState),b[1]&&b[1].call(this.context||(this.context=this),a),this._currentState=b[0]},a}(),"undefined"!=typeof window&&(window.FSM=a),"undefined"!=typeof module&&module.exports&&(module.exports=a)}).call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A=[].slice,B=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};r={},"undefined"!=typeof window&&(window.HTMLString=r),"undefined"!=typeof module&&module.exports&&(module.exports=r),r.String=function(){function a(a,b){null==b&&(b=!1),this._preserveWhitespace=b,a?(null===r.String._parser&&(r.String._parser=new z),this.characters=r.String._parser.parse(a,this._preserveWhitespace).characters):this.characters=[]}return a._parser=null,a.prototype.isWhitespace=function(){var a,b,c,d;for(d=this.characters,b=0,c=d.length;b<c;b++)if(a=d[b],!a.isWhitespace())return!1;return!0},a.prototype.length=function(){return this.characters.length},a.prototype.preserveWhitespace=function(){return this._preserveWhitespace},a.prototype.capitalize=function(){var a,b;return b=this.copy(),b.length()&&(a=b.characters[0]._c.toUpperCase(),b.characters[0]._c=a),b},a.prototype.charAt=function(a){return this.characters[a].copy()},a.prototype.concat=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(g=2<=arguments.length?A.call(arguments,0,i=arguments.length-1):(i=0,[]),c=arguments[i++],void 0!==c&&"boolean"!=typeof c&&(g.push(c),c=!0),e=this.copy(),j=0,m=g.length;j<m;j++)if(f=g[j],0!==f.length){if(h=f,"string"==typeof f&&(h=new r.String(f,this._preserveWhitespace)),c&&e.length())for(b=e.charAt(e.length()-1),d=b.tags(),b.isTag()&&d.shift(),"string"!=typeof f&&(h=h.copy()),p=h.characters,k=0,n=p.length;k<n;k++)a=p[k],a.addTags.apply(a,d);for(q=h.characters,l=0,o=q.length;l<o;l++)a=q[l],e.characters.push(a)}return e},a.prototype.contains=function(a){var b,c,d,e,f,g,h;if("string"==typeof a)return this.text().indexOf(a)>-1;for(d=0;d<=this.length()-a.length();){for(c=!0,h=a.characters,e=f=0,g=h.length;f<g;e=++f)if(b=h[e],!b.eq(this.characters[e+d])){c=!1;break}if(c)return!0;d++}return!1},a.prototype.endsWith=function(a){var b,c,d,e,f,g;if("string"==typeof a)return""===a||this.text().slice(-a.length)===a;for(c=this.characters.slice().reverse(),g=a.characters.slice().reverse(),d=e=0,f=g.length;e<f;d=++e)if(b=g[d],!b.eq(c[d]))return!1;return!0},a.prototype.format=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?A.call(arguments,2):[],f<0&&(f=this.length()+f+1),b<0&&(b=this.length()+b),d=this.copy(),c=g=b;b<=f?g<f:g>f;c=b<=f?++g:--g)a=d.characters[c],a.addTags.apply(a,e);return d},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h;for(d=2<=arguments.length?A.call(arguments,0,e=arguments.length-1):(e=0,[]),c=arguments[e++],void 0!==c&&"boolean"!=typeof c&&(d.push(c),c=!1),b=!1,h=this.characters,f=0,g=h.length;f<g;f++)if(a=h[f],a.hasTags.apply(a,d))b=!0;else if(c)return!1;return b},a.prototype.html=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;for(e="",h=[],f=[],c=[],t=this.characters,j=0,n=t.length;j<n;j++){for(a=t[j],c=[],u=h.slice().reverse(),k=0,o=u.length;k<o;k++)if(g=u[k],c.push(g),!a.hasTags(g)){for(l=0,p=c.length;l<p;l++)b=c[l],e+=b.tail(),h.pop(),f.pop();c=[]}for(v=a._tags,m=0,q=v.length;m<q;m++)i=v[m],-1===f.indexOf(i.head())&&(i.selfClosing()||(d=i.head(),e+=d,h.push(i),f.push(d)));a._tags.length>0&&a._tags[0].selfClosing()&&(e+=a._tags[0].head()),e+=a.c()}for(w=h.reverse(),s=0,r=w.length;s<r;s++)i=w[s],e+=i.tail();return e},a.prototype.indexOf=function(a,b){var c,d,e,f,g,h;if(null==b&&(b=0),b<0&&(b=0),"string"==typeof a)return this.text().indexOf(a,b);for(;b<=this.length()-a.length();){for(d=!0,h=a.characters,e=f=0,g=h.length;f<g;e=++f)if(c=h[e],!c.eq(this.characters[e+b])){d=!1;break}if(d)return b;b++}return-1},a.prototype.insert=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t;if(null==c&&(c=!0),e=this.slice(0,a),j=this.slice(a),a<0&&(a=this.length()+a),h=b,"string"==typeof b&&(h=new r.String(b,this._preserveWhitespace)),c&&a>0)for(f=this.charAt(a-1),g=f.tags(),f.isTag()&&g.shift(),"string"!=typeof b&&(h=h.copy()),q=h.characters,k=0,n=q.length;k<n;k++)d=q[k],d.addTags.apply(d,g);for(i=e,s=h.characters,l=0,o=s.length;l<o;l++)d=s[l],i.characters.push(d);for(t=j.characters,m=0,p=t.length;m<p;m++)d=t[m],i.characters.push(d);return i},a.prototype.lastIndexOf=function(a,b){var c,d,e,f,g,h,i,j,k;if(null==b&&(b=0),b<0&&(b=0),d=this.characters.slice(b).reverse(),b=0,"string"==typeof a){if(!this.contains(a))return-1;for(a=a.split("").reverse();b<=d.length-a.length;){for(e=!0,g=0,f=h=0,j=a.length;h<j;f=++h)if(c=a[f],d[f+b].isTag()&&(g+=1),c!==d[g+f+b].c()){e=!1;break}if(e)return b;b++}return-1}for(a=a.characters.slice().reverse();b<=d.length-a.length;){for(e=!0,f=i=0,k=a.length;i<k;f=++i)if(c=a[f],!c.eq(d[f+b])){e=!1;break}if(e)return b;b++}return-1},a.prototype.optimize=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I;for(h=[],f=[],d=null,C=this.characters.slice().reverse(),o=0,s=C.length;o<s;o++){for(a=C[o],a._runLengthMap={},a._runLengthMapSize=0,b=[],D=h.slice().reverse(),p=0,t=D.length;p<t;p++)if(g=D[p],b.push(g),!a.hasTags(g)){for(q=0,u=b.length;q<u;q++)b[q],h.pop(),f.pop();b=[]}for(E=a._tags,r=0,v=E.length;r<v;r++)n=E[r],-1===f.indexOf(n.head())&&(n.selfClosing()||(h.push(n),f.push(n.head())));for(z=0,w=h.length;z<w;z++)n=h[z],c=n.head(),d?(a._runLengthMap[c]||(a._runLengthMap[c]=[n,0]),l=0,d._runLengthMap[c]&&(l=d._runLengthMap[c][1]),a._runLengthMap[c][1]=l+1):a._runLengthMap[c]=[n,1];d=a}for(j=function(a,b){return b[1]-a[1]},F=this.characters,I=[],A=0,x=F.length;A<x;A++)if(a=F[A],!((e=a._tags.length)>0&&a._tags[0].selfClosing()&&e<3||e<2)){k=[],G=a._runLengthMap;for(n in G)i=G[n],k.push(i);for(k.sort(j),H=a._tags.slice(),B=0,y=H.length;B<y;B++)n=H[B],n.selfClosing()||a.removeTags(n);I.push(a.addTags.apply(a,function(){var a,b,c;for(c=[],b=0,a=k.length;b<a;b++)m=k[b],c.push(m[0]);return c}()))}return I},a.prototype.slice=function(a,b){var c,d;return d=new r.String("",this._preserveWhitespace),d.characters=function(){var d,e,f,g;for(f=this.characters.slice(a,b),g=[],d=0,e=f.length;d<e;d++)c=f[d],g.push(c.copy());return g}.call(this),d},a.prototype.split=function(a,b){var c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=""),null==b&&(b=0),h=0,c=0,g=[0];;){if(b>0&&c>b)break;if(-1===(f=this.indexOf(a,h)))break;g.push(f),h=f+1}for(g.push(this.length()),j=[],e=k=0,l=g.length-2;0<=l?k<=l:k>=l;e=0<=l?++k:--k)i=g[e],e>0&&(i+=1),d=g[e+1],j.push(this.slice(i,d));return j},a.prototype.startsWith=function(a){var b,c,d,e,f;if("string"==typeof a)return this.text().slice(0,a.length)===a;for(f=a.characters,c=d=0,e=f.length;d<e;c=++d)if(b=f[c],!b.eq(this.characters[c]))return!1;return!0},a.prototype.substr=function(a,b){return b<=0?new r.String("",this._preserveWhitespace):(a<0&&(a=this.length()+a),void 0===b&&(b=this.length()-a),this.slice(a,a+b))},a.prototype.substring=function(a,b){return void 0===b&&(b=this.length()),this.slice(a,b)},a.prototype.text=function(){var a,b,c,d,e;for(b="",e=this.characters,c=0,d=e.length;c<d;c++)a=e[c],a.isTag()?a.isTag("br")&&(b+="\n"):(a.c(),b+=a.c());return this.constructor.decode(b)},a.prototype.toLowerCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;c<d;c++)a=e[c],1===a._c.length&&(a._c=a._c.toLowerCase());return b},a.prototype.toUpperCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;c<d;c++)a=e[c],1===a._c.length&&(a._c=a._c.toUpperCase());return b},a.prototype.trim=function(){var a,b,c,d,e,f,g,h,i,j;for(i=this.characters,b=e=0,g=i.length;e<g&&(a=i[b],a.isWhitespace());b=++e);for(j=this.characters.slice().reverse(),d=f=0,h=j.length;f<h&&(a=j[d],a.isWhitespace());d=++f);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimLeft=function(){var a,b,c,d,e,f,g;for(d=this.length()-1,g=this.characters,b=e=0,f=g.length;e<f&&(a=g[b],a.isWhitespace());b=++e);return c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimRight=function(){var a,b,c,d,e,f,g;for(b=0,g=this.characters.slice().reverse(),d=e=0,f=g.length;e<f&&(a=g[d],a.isWhitespace());d=++e);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.unformat=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?A.call(arguments,2):[],f<0&&(f=this.length()+f+1),b<0&&(b=this.length()+b),d=this.copy(),c=g=b;b<=f?g<f:g>f;c=b<=f?++g:--g)a=d.characters[c],a.removeTags.apply(a,e);return d},a.prototype.copy=function(){var a,b;return b=new r.String("",this._preserveWhitespace),b.characters=function(){var b,c,d,e;for(d=this.characters,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this),b},a.decode=function(a){var b;return b=document.createElement("textarea"),b.innerHTML=a,b.textContent},a.encode=function(a){var b;return b=document.createElement("textarea"),b.textContent=a,b.innerHTML},a.join=function(a,b){var c,d,e,f;for(c=b.shift(),e=0,f=b.length;e<f;e++)d=b[e],c=c.concat(a,d);return c},a}(),a="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$".split(""),b=a.concat("1234567890".split("")),h=b.concat([":"]),q=b.concat(["#"]),u=b.concat([":"]),n=1,p=2,t=3,s=4,o=5,x=6,v=7,y=8,w=9,j=10,g=11,i=12,c=13,m=14,k=15,l=16,e=17,f=18,d=19,z=function(){function z(){this.fsm=new FSM.Machine(this),this.fsm.setInitialState(n),this.fsm.addTransitionAny(n,null,function(a){return this._pushChar(a)}),this.fsm.addTransition("<",n,t),this.fsm.addTransition("&",n,p),this.fsm.addTransitions(q,p,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",p,n,function(){return this._pushChar("&"+this.entity+";"),this.entity=""}),this.fsm.addTransitions([" ","\n"],t),this.fsm.addTransitions(a,t,s,function(){return this._back()}),this.fsm.addTransition("/",t,o),this.fsm.addTransitions([" ","\n"],s),this.fsm.addTransitions(a,s,x,function(){return this._back()}),this.fsm.addTransitions([" ","\n"],o),this.fsm.addTransitions(a,o,v,function(){return this._back()}),this.fsm.addTransitions(u,x,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],x,j),this.fsm.addTransition("/",x,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",x,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],y),this.fsm.addTransition(">",y,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],j),this.fsm.addTransition("/",j,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",j,n,function(){return this._pushTag()}),this.fsm.addTransitions(a,j,g,function(){return this._back()}),this.fsm.addTransitions(u,v,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],v,w),this.fsm.addTransition(">",v,n,function(){return this._popTag()}),this.fsm.addTransitions([" ","\n"],w),this.fsm.addTransition(">",w,n,function(){return this._popTag()}),this.fsm.addTransitions(h,g,null,function(a){return this.attributeName+=a}),this.fsm.addTransitions([" ","\n"],g,i),this.fsm.addTransition("=",g,c),this.fsm.addTransitions([" ","\n"],i),this.fsm.addTransition("=",i,c),this.fsm.addTransitions(">",g,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(i,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ","\n"],c),this.fsm.addTransition("'",c,m),this.fsm.addTransition('"',c,k),this.fsm.addTransitions(b.concat(["&"],c,l,function(){return this._back()})),this.fsm.addTransition(" ",l,j,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],l,j,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",l,e),this.fsm.addTransitionAny(l,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition("'",m,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",m,f),this.fsm.addTransitionAny(m,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition('"',k,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",k,d),this.fsm.addTransitionAny(k,null,function(a){return this.attributeValue+=a}),this.fsm.addTransitions(q,e,null,function(a){return this.entity+=a}),this.fsm.addTransitions(q,f,function(a){return this.entity+=a}),this.fsm.addTransitions(q,d,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",e,l,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",f,m,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",d,k,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return z.prototype._back=function(){return this.head--},z.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},z.prototype._pushChar=function(a){var b,c;return b=new r.Character(a,this.tags),this._preserveWhitespace?void this.string.characters.push(b):!this.string.length()||b.isTag()||b.isEntity()||!b.isWhitespace()||(c=this.string.characters[this.string.length()-1],!c.isWhitespace()||c.isTag()||c.isEntity())?this.string.characters.push(b):void 0},z.prototype._pushTag=function(){var a,b;return a=new r.Tag(this.tagName,this.attributes),this.tags.push(a),a.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(b=this.tagName,B.call(r.Tag.SELF_CLOSING,b)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},z.prototype._popTag=function(){for(var a,b;;)if(b=this.tags.pop(),this.string.length()&&(a=this.string.characters[this.string.length()-1],a.isTag()||a.isEntity()||!a.isWhitespace()||a.removeTags(b)),b.name()===this.tagName.toLowerCase())break;return this.tagName=""},z.prototype.parse=function(a,b){var c,d;for(this._preserveWhitespace=b,this.reset(),a=this.preprocess(a),this.fsm.parser=this;this.head<a.length;){c=a[this.head];try{this.fsm.process(c)}catch(a){throw d=a,new Error("Error at char "+this.head+" >> "+d)}this.head++}return this.string},z.prototype.preprocess=function(a){return a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),a=a.replace(/<!--[\s\S]*?-->/g,""),this._preserveWhitespace||(a=a.replace(/\s+/g," ")),a},z.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new r.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},z}(),r.Tag=function(){function a(a,b){var c,d;this._name=a.toLowerCase(),this._selfClosing=!0===r.Tag.SELF_CLOSING[this._name],this._head=null,this._attributes={};for(c in b)d=b[c],this._attributes[c]=d}return a.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},a.prototype.head=function(){var a,b,c,d;if(!this._head){a=[],d=this._attributes;for(b in d)c=d[b],c?a.push(b+'="'+c+'"'):a.push(""+b);a.sort(),a.unshift(this._name),this._head="<"+a.join(" ")+">"}return this._head},a.prototype.name=function(){return this._name},a.prototype.selfClosing=function(){return this._selfClosing},a.prototype.tail=function(){return this._selfClosing?"":"</"+this._name+">"},a.prototype.attr=function(a,b){return void 0===b?this._attributes[a]:(this._attributes[a]=b,this._head=null)},a.prototype.removeAttr=function(a){if(void 0!==this._attributes[a])return delete this._attributes[a],this._head=null},a.prototype.copy=function(){return new r.Tag(this._name,this._attributes)},a}(),r.Character=function(){function a(a,b){this._c=a,a.length>1&&(this._c=a.toLowerCase()),this._tags=[],this.addTags.apply(this,b)}return a.prototype.c=function(){return this._c},a.prototype.isEntity=function(){return this._c.length>1},a.prototype.isTag=function(a){return!(0===this._tags.length||!this._tags[0].selfClosing())&&(!a||this._tags[0].name()===a)},a.prototype.isWhitespace=function(){var a;return" "===(a=this._c)||"\n"===a||"&nbsp;"===a||this.isTag("br")},a.prototype.tags=function(){var a;return function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this)},a.prototype.addTags=function(){var a,b,c,d,e;for(b=1<=arguments.length?A.call(arguments,0):[],e=[],c=0,d=b.length;c<d;c++)a=b[c],Array.isArray(a)||(a.selfClosing()?this.isTag()||this._tags.unshift(a.copy()):e.push(this._tags.push(a.copy())));return e},a.prototype.eq=function(a){var b,c,d,e,f,g,h,i;if(this.c()!==a.c())return!1;if(this._tags.length!==a._tags.length)return!1;for(c={},h=this._tags,d=0,f=h.length;d<f;d++)b=h[d],c[b.head()]=!0;for(i=a._tags,e=0,g=i.length;e<g;e++)if(b=i[e],!c[b.head()])return!1;return!0},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h,i;for(d=1<=arguments.length?A.call(arguments,0):[],c={},b={},i=this._tags,e=0,g=i.length;e<g;e++)a=i[e],c[a.name()]=!0,b[a.head()]=!0;for(f=0,h=d.length;f<h;f++)if("string"==typeof(a=d[f])){if(void 0===c[a])return!1}else if(void 0===b[a.head()])return!1;return!0},a.prototype.removeTags=function(){var a,b,c,d,e,f;if(d=1<=arguments.length?A.call(arguments,0):[],0===d.length)return void(this._tags=[]);for(b={},a={},e=0,f=d.length;e<f;e++)c=d[e],"string"==typeof c?b[c]=c:a[c.head()]=c;return[],this._tags=this._tags.filter(function(c){if(!a[c.head()]&&!b[c.name()])return c})},a.prototype.copy=function(){var a;return new r.Character(this._c,function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this))},a}()}.call(this),function(){var a,b,c,d,e,f,g=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};a={},a.Range=function(){function g(a,b){this.set(a,b)}return g.prototype.isCollapsed=function(){return this._from===this._to},g.prototype.span=function(){return this._to-this._from},g.prototype.collapse=function(){return this._to=this._from},g.prototype.eq=function(a){return this.get()[0]===a.get()[0]&&this.get()[1]===a.get()[1]},g.prototype.get=function(){return[this._from,this._to]},g.prototype.select=function(b){var c,e,f,g,h,i,j,k,l;return a.Range.unselectAll(),c=document.createRange(),k=d(b,this._from),h=k[0],j=k[1],l=d(b,this._to),e=l[0],g=l[1],i=h.length||0,f=e.length||0,c.setStart(h,Math.min(j,i)),c.setEnd(e,Math.min(g,f)),window.getSelection().addRange(c)},g.prototype.set=function(a,b){return a=Math.max(0,a),b=Math.max(0,b),this._from=Math.min(a,b),this._to=Math.max(a,b)},g.prepareElement=function(a){var c,d,e,f,g,h;for(e=a.querySelectorAll(b.join(", ")),h=[],c=f=0,g=e.length;f<g;c=++f)d=e[c],d.parentNode.insertBefore(document.createTextNode(""),d),c<e.length-1?h.push(d.parentNode.insertBefore(document.createTextNode(""),d.nextSibling)):h.push(void 0);return h},g.query=function(b){var d,g,h,i,j,k,l;i=new a.Range(0,0);try{d=window.getSelection().getRangeAt(0)}catch(a){return i}return null===b.firstChild&&null===b.lastChild?i:c(d.startContainer,b)&&c(d.endContainer,b)?(l=e(b,d),j=l[0],k=l[1],g=l[2],h=l[3],i.set(f(b,j)+k,f(b,g)+h),i):i},g.rect=function(){var a,b,c;try{a=window.getSelection().getRangeAt(0)}catch(a){return null}return a.collapsed?(b=document.createElement("span"),a.insertNode(b),c=b.getBoundingClientRect(),b.parentNode.removeChild(b),c):a.getBoundingClientRect()},g.unselectAll=function(){if(window.getSelection())return window.getSelection().removeAllRanges()},g}(),b=["br","img","input"],c=function(a,b){for(;a;){if(a===b)return!0;a=a.parentNode}return!1},d=function(a,c){var d,e,f,h,i;if(0===a.childNodes.length)return[a,c];for(d=null,e=c,f=function(){var b,c,d,e;for(d=a.childNodes,e=[],b=0,c=d.length;b<c;b++)h=d[b],e.push(h);return e}();f.length>0;)switch(d=f.shift(),d.nodeType){case Node.TEXT_NODE:if(d.textContent.length>=e)return[d,e];e-=d.textContent.length;break;case Node.ELEMENT_NODE:if(i=d.nodeName.toLowerCase(),g.call(b,i)>=0){if(0===e)return[d,0];e=Math.max(0,e-1)}else d.childNodes&&Array.prototype.unshift.apply(f,function(){var a,b,c,e;for(c=d.childNodes,e=[],a=0,b=c.length;a<b;a++)h=c[a],e.push(h);return e}())}return[d,e]},f=function(a,c){var d,e,f,h,i,j;if(0===a.childNodes.length)return 0;for(f=0,d=function(){var b,c,d,f;for(d=a.childNodes,f=[],b=0,c=d.length;b<c;b++)e=d[b],f.push(e);return f}();d.length>0;){if((h=d.shift())===c)return i=h.nodeName.toLowerCase(),g.call(b,i)>=0?f+1:f;switch(h.nodeType){case Node.TEXT_NODE:f+=h.textContent.length;break;case Node.ELEMENT_NODE:j=h.nodeName.toLowerCase(),g.call(b,j)>=0?f+=1:h.childNodes&&Array.prototype.unshift.apply(d,function(){var a,b,c,d;for(c=h.childNodes,d=[],a=0,b=c.length;a<b;a++)e=c[a],d.push(e);return d}())}}return f},e=function(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,q,r;if(e=a.childNodes,m=c.cloneRange(),m.collapse(!0),i=c.cloneRange(),i.collapse(!1),k=m.startContainer,l=m.startOffset,f=i.endContainer,h=i.endOffset,!m.comparePoint)return[k,l,f,h];if(k===a)for(k=e[e.length-1],l=k.textContent.length,j=n=0,p=e.length;n<p;j=++n)if(d=e[j],1===m.comparePoint(d,0)){0===j?(k=d,l=0):(k=e[j-1],l=d.textContent.length),r=k.nodeName.toLowerCase,g.call(b,r)>=0&&(l=1);break}if(c.collapsed)return[k,l,k,l];if(f===a)for(f=e[e.length-1],h=f.textContent.length,j=o=0,q=e.length;o<q;j=++o)d=e[j],1===i.comparePoint(d,0)&&(f=0===j?d:e[j-1],h=d.textContent.length+1);return[k,l,f,h]},"undefined"!=typeof window&&(window.ContentSelect=a),"undefined"!=typeof module&&module.exports&&(module.exports=a)}.call(this),function(){var a,b,c,d,e=[].slice,f=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=function(a,b){return function(){return a.apply(b,arguments)}};a={ALIGNMENT_CLASS_NAMES:{left:"align-left",right:"align-right"},DEFAULT_MAX_ELEMENT_WIDTH:2e3,DEFAULT_MIN_ELEMENT_WIDTH:80,DRAG_HOLD_DURATION:500,DROP_EDGE_SIZE:50,HELPER_CHAR_LIMIT:250,INDENT:"    ",LANGUAGE:"en",LINE_ENDINGS:"\n",PREFER_LINE_BREAKS:!1,RESIZE_CORNER_SIZE:15,TRIM_WHITESPACE:!0,_translations:{},_:function(b){var c;return c=a.LANGUAGE,a._translations[c]&&a._translations[c][b]?a._translations[c][b]:b},addTranslations:function(b,c){return a._translations[b]=c},addCSSClass:function(a,b){var c,d,e;return a.classList?void a.classList.add(b):(d=a.getAttribute("class"),d?(e=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;a<b;a++)c=e[a],f.push(c);return f}(),-1===e.indexOf(b)?a.setAttribute("class",d+" "+b):void 0):a.setAttribute("class",b))},attributesToString:function(a){var b,c,d,e,f,g;if(!a)return"";for(d=function(){var b;b=[];for(c in a)b.push(c);return b}(),d.sort(),b=[],f=0,g=d.length;f<g;f++)c=d[f],e=a[c],""===e?b.push(c):(e=HTMLString.String.encode(e),e=e.replace(/"/g,"&quot;"),b.push(c+'="'+e+'"'));return b.join(" ")},removeCSSClass:function(a,b){var c,d,e,f;return a.classList?(a.classList.remove(b),void(0===a.classList.length&&a.removeAttribute("class"))):(d=a.getAttribute("class"),d&&(f=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;a<b;a++)c=e[a],f.push(c);return f}(),(e=f.indexOf(b))>-1)?(f.splice(e,1),f.length?a.setAttribute("class",f.join(" ")):a.removeAttribute("class")):void 0)}},"undefined"!=typeof window&&(window.ContentEdit=a),"undefined"!=typeof module&&module.exports&&(module.exports=a),c=function(){function b(){this._tagNames={}}return b.prototype.register=function(){var a,b,c,d,f,g;for(a=arguments[0],c=2<=arguments.length?e.call(arguments,1):[],g=[],d=0,f=c.length;d<f;d++)b=c[d],g.push(this._tagNames[b.toLowerCase()]=a);return g},b.prototype.match=function(b){return b=b.toLowerCase(),this._tagNames[b]?this._tagNames[b]:a.Static},b}(),a.TagNames=function(){function a(){}var b;return b=null,a.get=function(){return null!=b?b:b=new c},a}(),a.Node=function(){function b(){this._bindings={},this._parent=null,this._modified=null}return b.prototype.lastModified=function(){return this._modified},b.prototype.parent=function(){return this._parent},b.prototype.parents=function(){var a,b;for(b=[],a=this._parent;a;)b.push(a),a=a._parent;return b},b.prototype.type=function(){return"Node"},b.prototype.html=function(a){throw null==a&&(a=""),new Error("`html` not implemented")},b.prototype.bind=function(a,b){return void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b),b},b.prototype.trigger=function(){var a,b,c,d,f,g,h;if(c=arguments[0],a=2<=arguments.length?e.call(arguments,1):[],this._bindings[c]){for(g=this._bindings[c],h=[],d=0,f=g.length;d<f;d++)(b=g[d])&&h.push(b.call.apply(b,[this].concat(e.call(a))));return h}},b.prototype.unbind=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;e<f;c=++e)d=g[c],d===b?h.push(this._bindings[a].splice(c,1)):h.push(void 0);return h}},b.prototype.commit=function(){return this._modified=null,a.Root.get().trigger("commit",this)},b.prototype.taint=function(){var b,c,d,e,f,g;for(b=Date.now(),this._modified=b,g=this.parents(),e=0,f=g.length;e<f;e++)c=g[e],c._modified=b;return d=a.Root.get(),d._modified=b,d.trigger("taint",this)},b.prototype.closest=function(a){var b;for(b=this.parent();b&&!a(b);)b=b.parent?b.parent():null;return b},b.prototype.next=function(){var a,b,c,d,e,f;if(this.children&&this.children.length>0)return this.children[0];for(f=[this].concat(this.parents()),d=0,e=f.length;d<e;d++){if(c=f[d],!c.parent())return null;if(a=c.parent().children,(b=a.indexOf(c))<a.length-1)return a[b+1]}},b.prototype.nextContent=function(){return this.nextWithTest(function(a){return void 0!==a.content})},b.prototype.nextSibling=function(){var a;return a=this.parent().children.indexOf(this),a===this.parent().children.length-1?null:this.parent().children[a+1]},b.prototype.nextWithTest=function(a){var b;for(b=this;b;)if((b=b.next())&&a(b))return b},b.prototype.previous=function(){var a,b;if(!this.parent())return null;if(a=this.parent().children,a[0]===this)return this.parent();for(b=a[a.indexOf(this)-1];b.children&&b.children.length;)b=b.children[b.children.length-1];return b},b.prototype.previousContent=function(){return this.previousWithTest(function(a){return void 0!==a.content})},b.prototype.previousSibling=function(){var a;return a=this.parent().children.indexOf(this),0===a?null:this.parent().children[a-1]},b.prototype.previousWithTest=function(a){var b;for(b=this;b;)if((b=b.previous())&&a(b))return b},b.extend=function(a){var b,c,d;d=a.prototype;for(b in d)c=d[b],"constructor"!==b&&(this.prototype[b]=c);for(b in a)c=a[b],f.call("__super__",b)>=0||(this.prototype[b]=c);return this},b.fromDOMElement=function(a){throw new Error("`fromDOMElement` not implemented")},b}(),a.NodeCollection=function(b){function c(){c.__super__.constructor.call(this),this.children=[]}return h(c,b),c.prototype.descendants=function(){var a,b,c;for(a=[],c=this.children.slice();c.length>0;)b=c.shift(),a.push(b),b.children&&b.children.length>0&&(c=b.children.slice().concat(c));return a},c.prototype.isMounted=function(){return!1},c.prototype.type=function(){return"NodeCollection"},c.prototype.attach=function(b,c){return b.parent()&&b.parent().detach(b),b._parent=this,void 0!==c?this.children.splice(c,0,b):this.children.push(b),b.mount&&this.isMounted()&&b.mount(),this.taint(),a.Root.get().trigger("attach",this,b)},c.prototype.commit=function(){var b,c,d,e;for(e=this.descendants(),c=0,d=e.length;c<d;c++)b=e[c],b._modified=null;return this._modified=null,a.Root.get().trigger("commit",this)},c.prototype.detach=function(b){var c;if(-1!==(c=this.children.indexOf(b)))return b.unmount&&this.isMounted()&&b.isMounted()&&b.unmount(),this.children.splice(c,1),b._parent=null,this.taint(),a.Root.get().trigger("detach",this,b)},c}(a.Node),a.Element=function(b){function c(a,b){c.__super__.constructor.call(this),this._tagName=a.toLowerCase(),this._attributes=b||{},this._domElement=null,this._behaviours={drag:!0,drop:!0,merge:!0,remove:!0,resize:!0,spawn:!0}}return h(c,b),c.prototype.attributes=function(){var a,b,c,d;a={},d=this._attributes;for(b in d)c=d[b],a[b]=c;return a},c.prototype.cssTypeName=function(){return"element"},c.prototype.domElement=function(){return this._domElement},c.prototype.isFixed=function(){return this.parent()&&"Fixture"===this.parent().type()},c.prototype.isGallery=function(){return this.parent()&&-1!==this.parent().domElement().className.indexOf("gallery")},c.prototype.isFocused=function(){return a.Root.get().focused()===this},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"Element"},c.prototype.typeName=function(){return"Element"},c.prototype.addCSSClass=function(a){var b;if(b=!1,this.hasCSSClass(a)||(b=!0,this.attr("class")?this.attr("class",this.attr("class")+" "+a):this.attr("class",a)),this._addCSSClass(a),b)return this.taint()},c.prototype.attr=function(a,b){return a=a.toLowerCase(),void 0===b?this._attributes[a]:(this._attributes[a]=b,this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.setAttribute(a,b),this.taint())},c.prototype.blur=function(){var b;if(b=a.Root.get(),this.isFocused())return this._removeCSSClass("ce-element--focused"),b._focused=null,b.trigger("blur",this)},c.prototype.can=function(a,b){return void 0===b?!this.isFixed()&&this._behaviours[a]:this._behaviours[a]=b},c.prototype.createDraggingDOMElement=function(){var b;if(this.isMounted())return b=document.createElement("div"),b.setAttribute("class","ce-drag-helper ce-drag-helper--type-"+this.cssTypeName()),b.setAttribute("data-ce-type",a._(this.typeName())),b},c.prototype.drag=function(b,c){var d;if(this.isMounted()&&this.can("drag"))return d=a.Root.get(),d.startDragging(this,b,c),d.trigger("drag",this)},c.prototype.drop=function(b,c){var d;if(this.can("drop")){if(d=a.Root.get(),b){if(b._removeCSSClass("ce-element--drop"),b._removeCSSClass("ce-element--drop-"+c[0]),b._removeCSSClass("ce-element--drop-"+c[1]),this.constructor.droppers[b.type()])return this.constructor.droppers[b.type()](this,b,c),void d.trigger("drop",this,b,c);if(b.constructor.droppers[this.type()])return b.constructor.droppers[this.type()](this,b,c),void d.trigger("drop",this,b,c)}return d.trigger("drop",this,null,null)}},c.prototype.focus=function(b){var c;if(c=a.Root.get(),!this.isFocused())return c.focused()&&c.focused().blur(),
this._addCSSClass("ce-element--focused"),c._focused=this,this.isMounted()&&!b&&this.domElement().focus(),c.trigger("focus",this)},c.prototype.hasCSSClass=function(a){var b,c;return!!(this.attr("class")&&(c=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}.call(this),c.indexOf(a)>-1))},c.prototype.merge=function(a){return!(!this.can("merge")||!this.can("remove"))&&(this.constructor.mergers[a.type()]?this.constructor.mergers[a.type()](a,this):a.constructor.mergers[this.type()]?a.constructor.mergers[this.type()](a,this):void 0)},c.prototype.mount=function(){var b;return this._domElement||(this._domElement=document.createElement(this.tagName())),b=this.nextSibling(),b?this.parent().domElement().insertBefore(this._domElement,b.domElement()):this.isFixed()?(this.parent().domElement().parentNode.replaceChild(this._domElement,this.parent().domElement()),this.parent()._domElement=this._domElement):this.parent().domElement().appendChild(this._domElement),this._addDOMEventListeners(),this._addCSSClass("ce-element"),this._addCSSClass("ce-element--type-"+this.cssTypeName()),this.isFocused()&&this._addCSSClass("ce-element--focused"),a.Root.get().trigger("mount",this)},c.prototype.removeAttr=function(a){if(a=a.toLowerCase(),this._attributes[a])return delete this._attributes[a],this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.removeAttribute(a),this.taint()},c.prototype.removeCSSClass=function(a){var b,c,d;if(this.hasCSSClass(a))return d=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}.call(this),c=d.indexOf(a),c>-1&&d.splice(c,1),d.length?this.attr("class",d.join(" ")):this.removeAttr("class"),this._removeCSSClass(a),this.taint()},c.prototype.tagName=function(a){return void 0===a?this._tagName:(this._tagName=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){return this._removeDOMEventListeners(),this.isFixed()?(this._removeCSSClass("ce-element"),this._removeCSSClass("ce-element--type-"+this.cssTypeName()),void this._removeCSSClass("ce-element--focused")):(this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,a.Root.get().trigger("unmount",this))},c.prototype._addDOMEventListeners=function(){var a,b,c,d;this._domEventHandlers={dragstart:function(a){return function(a){return a.preventDefault()}}(),focus:function(a){return function(a){return a.preventDefault()}}(),keydown:function(a){return function(b){return a._onKeyDown(b)}}(this),keyup:function(a){return function(b){return a._onKeyUp(b)}}(this),mousedown:function(a){return function(b){if(0===b.button)return a._onMouseDown(b)}}(this),mousemove:function(a){return function(b){return a._onMouseMove(b)}}(this),mouseover:function(a){return function(b){return a._onMouseOver(b)}}(this),mouseout:function(a){return function(b){return a._onMouseOut(b)}}(this),mouseup:function(a){return function(b){if(0===b.button)return a._onMouseUp(b)}}(this),dragover:function(a){return function(a){return a.preventDefault()}}(),drop:function(a){return function(b){return a._onNativeDrop(b)}}(this),paste:function(a){return function(b){return a._onPaste(b)}}(this)},c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.addEventListener(b,a));return d},c.prototype._onKeyDown=function(a){},c.prototype._onKeyUp=function(a){},c.prototype._onMouseDown=function(a){if(this.focus)return this.focus(!0)},c.prototype._onMouseMove=function(a){return this._onOver(a)},c.prototype._onMouseOver=function(a){return this._onOver(a)},c.prototype._onMouseOut=function(b){var c;if(this._removeCSSClass("ce-element--over"),c=a.Root.get(),c.dragging())return this._removeCSSClass("ce-element--drop"),this._removeCSSClass("ce-element--drop-above"),this._removeCSSClass("ce-element--drop-below"),this._removeCSSClass("ce-element--drop-center"),this._removeCSSClass("ce-element--drop-left"),this._removeCSSClass("ce-element--drop-right"),c._dropTarget=null},c.prototype._onMouseUp=function(a){return this._ieMouseDownEchoed=!1},c.prototype._onNativeDrop=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("native-drop",this,b)},c.prototype._onPaste=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("paste",this,b)},c.prototype._onOver=function(b){var c,d;if(this._addCSSClass("ce-element--over"),d=a.Root.get(),(c=d.dragging())&&c!==this&&!d._dropTarget&&this.can("drop")&&(this.constructor.droppers[c.type()]||c.constructor.droppers[this.type()]))return this._addCSSClass("ce-element--drop"),d._dropTarget=this},c.prototype._removeDOMEventListeners=function(){var a,b,c,d;c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.removeEventListener(b,a));return d},c.prototype._addCSSClass=function(b){if(this.isMounted())return a.addCSSClass(this._domElement,b)},c.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+a.attributesToString(this._attributes):""},c.prototype._removeCSSClass=function(b){if(this.isMounted())return a.removeCSSClass(this._domElement,b)},c.droppers={},c.mergers={},c.placements=["above","below"],c.getDOMElementAttributes=function(a){var b,c,d,e,f;if(!a.hasAttributes())return{};for(c={},f=a.attributes,d=0,e=f.length;d<e;d++)b=f[d],c[b.name.toLowerCase()]=b.value;return c},c._dropVert=function(a,b,c){var d;return a.parent().detach(a),d=b.parent().children.indexOf(b),"below"===c[0]&&(d+=1),b.parent().attach(a,d)},c._dropBoth=function(b,c,d){var e,f,g,h,i,j,k,l;if(b.parent().detach(b),i=c.parent().children.indexOf(c),"below"===d[0]&&"center"===d[1]&&(i+=1),f=a.ALIGNMENT_CLASS_NAMES.left,g=a.ALIGNMENT_CLASS_NAMES.right,b.a){if(b._removeCSSClass(f),b._removeCSSClass(g),b.a.class){for(e=[],l=b.a.class.split(" "),j=0,k=l.length;j<k;j++)(h=l[j])!==f&&h!==g&&e.push(h);e.length?b.a.class=e.join(" "):delete b.a.class}}else b.removeCSSClass(f),b.removeCSSClass(g);return"left"===d[1]&&(b.a?(b.a.class?b.a.class+=" "+f:b.a.class=f,b._addCSSClass(f)):b.addCSSClass(f)),"right"===d[1]&&(b.a?(b.a.class?b.a.class+=" "+g:b.a.class=g,b._addCSSClass(g)):b.addCSSClass(g)),c.parent().attach(b,i)},c}(a.Node),a.ElementCollection=function(b){function c(b,d){c.__super__.constructor.call(this,b,d),a.NodeCollection.prototype.constructor.call(this)}return h(c,b),c.extend(a.NodeCollection),c.prototype.cssTypeName=function(){return"element-collection"},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"ElementCollection"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.detach=function(b){if(a.NodeCollection.prototype.detach.call(this,b),0===this.children.length&&this.parent())return this.parent().detach(this)},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),e=function(){var c,e,f,g;for(f=this.children,g=[],c=0,e=f.length;c<e;c++)d=f[c],g.push(d.html(b+a.INDENT));return g}.call(this),f=a.LINE_ENDINGS,this.isFixed()?e.join(f):(c=this._attributesToString(),b+"<"+this.tagName()+c+">"+f+e.join(f)+f+b+"</"+this.tagName()+">")},c.prototype.mount=function(){var a,b,d,e,f,g,h,i;this._domElement=document.createElement(this._tagName),g=this._attributes;for(b in g)d=g[b],this._domElement.setAttribute(b,d);for(c.__super__.mount.call(this),h=this.children,i=[],e=0,f=h.length;e<f;e++)a=h[e],i.push(a.mount());return i},c.prototype.unmount=function(){var a,b,d,e;for(e=this.children,b=0,d=e.length;b<d;b++)a=e[b],a.unmount();return c.__super__.unmount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c}(a.Element),a.ResizableElement=function(b){function c(a,b){c.__super__.constructor.call(this,a,b),this._domSizeInfoElement=null,this._aspectRatio=1}return h(c,b),c.prototype.aspectRatio=function(){return this._aspectRatio},c.prototype.maxSize=function(){var b;return b=parseInt(this.attr("data-ce-max-width")||0),b||(b=a.DEFAULT_MAX_ELEMENT_WIDTH),b=Math.max(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.minSize=function(){var b;return b=parseInt(this.attr("data-ce-min-width")||0),b||(b=a.DEFAULT_MIN_ELEMENT_WIDTH),b=Math.min(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.type=function(){return"ResizableElement"},c.prototype.mount=function(){return c.__super__.mount.call(this),this._domElement.setAttribute("data-ce-size",this._getSizeInfo())},c.prototype.resize=function(b,c,d){if(this.isMounted()&&this.can("resize"))return a.Root.get().startResizing(this,b,c,d,!0)},c.prototype.size=function(a){var b,c,d,e;return a?(a[0]=parseInt(a[0]),a[1]=parseInt(a[1]),d=this.minSize(),a[0]=Math.max(a[0],d[0]),a[1]=Math.max(a[1],d[1]),c=this.maxSize(),a[0]=Math.min(a[0],c[0]),a[1]=Math.min(a[1],c[1]),this.attr("width",parseInt(a[0])),this.attr("height",parseInt(a[1])),this.isMounted()?(this._domElement.style.width=a[0]+"px",this._domElement.style.height=a[1]+"px",this._domElement.setAttribute("data-ce-size",this._getSizeInfo())):void 0):(e=parseInt(this.attr("width")||1),b=parseInt(this.attr("height")||1),[e,b])},c.prototype._onMouseDown=function(a){var b;return c.__super__._onMouseDown.call(this,a),b=this._getResizeCorner(a.clientX,a.clientY),b?this.resize(b,a.clientX,a.clientY):(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150))},c.prototype._onMouseMove=function(a){var b;if(c.__super__._onMouseMove.call(this),this.can("resize"))return this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right"),b=this._getResizeCorner(a.clientX,a.clientY),b?this._addCSSClass("ce-element--resize-"+b[0]+"-"+b[1]):void 0},c.prototype._onMouseOut=function(a){return c.__super__._onMouseOut.call(this),this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.prototype._getResizeCorner=function(b,c){var d,e,f,g,h;return f=this._domElement.getBoundingClientRect(),h=[b-f.left,c-f.top],b=h[0],c=h[1],g=this.size(),e=a.RESIZE_CORNER_SIZE,e=Math.min(e,Math.max(parseInt(g[0]/4),1)),e=Math.min(e,Math.max(parseInt(g[1]/4),1)),d=null,b<e?c<e?d=["top","left"]:c>f.height-e&&(d=["bottom","left"]):b>f.width-e&&(c<e?d=["top","right"]:c>f.height-e&&(d=["bottom","right"])),d},c.prototype._getSizeInfo=function(){var a;return a=this.size(),"w "+a[0]+" × h "+a[1]},c}(a.Element),a.Region=function(b){function c(a){c.__super__.constructor.call(this),this._domElement=a,this.setContent(a)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Region"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c.prototype.setContent=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(h=b,void 0===b.childNodes&&(k=document.createElement("div"),k.innerHTML=b,h=k),p=this.children.slice(),l=0,n=p.length;l<n;l++)d=p[l],this.detach(d);for(j=a.TagNames.get(),f=function(){var a,b,d,e;for(d=h.childNodes,e=[],a=0,b=d.length;a<b;a++)c=d[a],e.push(c);return e}(),m=0,o=f.length;m<o;m++)e=f[m],1===e.nodeType&&(g=e.getAttribute("data-ce-tag")?j.match(e.getAttribute("data-ce-tag")):j.match(e.tagName),i=g.fromDOMElement(e),h.removeChild(e),i&&this.attach(i));return a.Root.get().trigger("ready",this)},c}(a.NodeCollection),a.Fixture=function(b){function c(b){var d,e,f;c.__super__.constructor.call(this),this._domElement=b,f=a.TagNames.get(),d=this._domElement.getAttribute("data-ce-tag")?f.match(this._domElement.getAttribute("data-ce-tag")):f.match(this._domElement.tagName),e=d.fromDOMElement(this._domElement),this.children=[e],e._parent=this,e.mount(),a.Root.get().trigger("ready",this)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Fixture"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c}(a.NodeCollection),b=function(b){function c(){this._onStopResizing=i(this._onStopResizing,this),this._onResize=i(this._onResize,this),this._onStopDragging=i(this._onStopDragging,this),this._onDrag=i(this._onDrag,this),c.__super__.constructor.call(this),this._focused=null,this._dragging=null,this._dropTarget=null,this._draggingDOMElement=null,this._resizing=null,this._resizingInit=null}return h(c,b),c.prototype.dragging=function(){return this._dragging},c.prototype.dropTarget=function(){return this._dropTarget},c.prototype.focused=function(){return this._focused},c.prototype.resizing=function(){return this._resizing},c.prototype.type=function(){return"Root"},c.prototype.cancelDragging=function(){if(this._dragging)return document.body.removeChild(this._draggingDOMElement),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._dragging._removeCSSClass("ce-element--dragging"),this._dragging=null,this._dropTarget=null,a.removeCSSClass(document.body,"ce--dragging")},c.prototype.startDragging=function(b,c,d){if(!this._dragging)return this._dragging=b,this._dragging._addCSSClass("ce-element--dragging"),this._draggingDOMElement=this._dragging.createDraggingDOMElement(),document.body.appendChild(this._draggingDOMElement),this._draggingDOMElement.style.left=c+"px",this._draggingDOMElement.style.top=d+"px",document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),a.addCSSClass(document.body,"ce--dragging")},c.prototype._getDropPlacement=function(b,c){var d,e,f,g;return this._dropTarget?(e=this._dropTarget.domElement().getBoundingClientRect(),g=[b-e.left,c-e.top],b=g[0],c=g[1],d="center",b<a.DROP_EDGE_SIZE?d="left":b>e.width-a.DROP_EDGE_SIZE&&(d="right"),f="above",c>e.height/2&&(f="below"),[f,d]):null},c.prototype._onDrag=function(a){var b,c,d;if(ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=a.pageX+"px",this._draggingDOMElement.style.top=a.pageY+"px",this._dropTarget&&(b=this._getDropPlacement(a.clientX,a.clientY),this._dropTarget._removeCSSClass("ce-element--drop-above"),this._dropTarget._removeCSSClass("ce-element--drop-below"),this._dropTarget._removeCSSClass("ce-element--drop-center"),this._dropTarget._removeCSSClass("ce-element--drop-left"),this._dropTarget._removeCSSClass("ce-element--drop-right"),c=b[0],f.call(this._dragging.constructor.placements,c)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+b[0]),d=b[1],f.call(this._dragging.constructor.placements,d)>=0))return this._dropTarget._addCSSClass("ce-element--drop-"+b[1])},c.prototype._onStopDragging=function(a){var b;return b=this._getDropPlacement(a.clientX,a.clientY),this._dragging.drop(this._dropTarget,b),this.cancelDragging()},c.prototype.startResizing=function(b,c,d,e,f){var g,h;if(!this._resizing)return this._resizing=b,this._resizingInit={corner:c,fixed:f,origin:[d,e],size:b.size()},this._resizing._addCSSClass("ce-element--resizing"),h=this._resizing.parent().domElement(),g=document.createElement("div"),g.setAttribute("class","ce-measure"),h.appendChild(g),this._resizingParentWidth=g.getBoundingClientRect().width,h.removeChild(g),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),a.addCSSClass(document.body,"ce--resizing")},c.prototype._onResize=function(a){var b,c,d,e;return ContentSelect.Range.unselectAll(),d=this._resizingInit.origin[0]-a.clientX,"right"===this._resizingInit.corner[1]&&(d=-d),c=this._resizingInit.size[0]+d,c=Math.min(c,this._resizingParentWidth),this._resizingInit.fixed?b=c*this._resizing.aspectRatio():(e=this._resizingInit.origin[1]-a.clientY,"bottom"===this._resizingInit.corner[0]&&(e=-e),b=this._resizingInit.size[1]+e),this._resizing.size([c,b])},c.prototype._onStopResizing=function(b){return document.removeEventListener("mousemove",this._onResize),document.removeEventListener("mouseup",this._onStopResizing),this._resizing._removeCSSClass("ce-element--resizing"),this._resizing=null,this._resizingInit=null,this._resizingParentWidth=null,a.removeCSSClass(document.body,"ce--resizing")},c}(a.Node),a.Root=function(){function a(){}var c;return c=null,a.get=function(){return null!=c?c:c=new b},a}(),a.Static=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._content=d}return h(c,b),c.prototype.cssTypeName=function(){return"static"},c.prototype.type=function(){return"Static"},c.prototype.typeName=function(){return"Static"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.html=function(a){return null==a&&(a=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?a+"<"+this._tagName+this._attributesToString()+">":a+"<"+this._tagName+this._attributesToString()+">"+this._content+a+"</"+this._tagName+">"},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this._domElement.innerHTML=this._content,c.__super__.mount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c.prototype._onMouseDown=function(a){if(c.__super__._onMouseDown.call(this,a),void 0!==this.attr("data-ce-moveable"))return clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this,a),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.droppers={Static:a.Element._dropVert},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Element),a.TagNames.get().register(a.Static,"static"),a.Text=function(b){function c(b,d,e){c.__super__.constructor.call(this,b,d),e instanceof HTMLString.String?this.content=e:a.TRIM_WHITESPACE?this.content=new HTMLString.String(e).trim():this.content=new HTMLString.String(e,!0)}return h(c,b),c.prototype.cssTypeName=function(){return"text"},c.prototype.type=function(){return"Text"},c.prototype.typeName=function(){return"Text"},c.prototype.blur=function(){return this.isMounted()&&this._syncContent(),this.content.isWhitespace()&&this.can("remove")?this.parent()&&this.parent().detach(this):this.isMounted()&&(document.documentMode||/Edge/.test(navigator.userAgent)||this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.__super__.blur.call(this)},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=HTMLString.String.encode(this._domElement.textContent),d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.drag=function(a,b){return this.storeState(),this._domElement.removeAttribute("contenteditable"),c.__super__.drag.call(this,a,b)},c.prototype.drop=function(a,b){return c.__super__.drop.call(this,a,b),this.restoreState()},c.prototype.focus=function(a){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),c.__super__.focus.call(this,a)},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(d=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),d.optimize(),this._lastCached=Date.now(),this._cached=d.html()),e=a.LINE_ENDINGS,c=this._attributesToString(),b+"<"+this._tagName+c+">"+e+b+a.INDENT+this._cached+e+b+"</"+this._tagName+">"},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this.updateInnerHTML(),c.__super__.mount.call(this)},c.prototype.restoreState=function(){if(this._savedSelection)return this.isMounted()&&this.isFocused()?(this._domElement.setAttribute("contenteditable",""),this._addCSSClass("ce-element--focused"),document.activeElement!==this.domElement()&&this.domElement().focus(),this._savedSelection.select(this._domElement),this._savedSelection=void 0):void(this._savedSelection=void 0)},c.prototype.selection=function(a){return void 0===a?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):a.select(this._domElement)},c.prototype.storeState=function(){if(this.isMounted()&&this.isFocused())return this._savedSelection=ContentSelect.Range.query(this._domElement)},c.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),c.__super__.unmount.call(this)},c.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._onKeyDown=function(a){switch(a.keyCode){case 40:return this._keyDown(a);case 37:return this._keyLeft(a);case 39:return this._keyRight(a);case 38:return this._keyUp(a);case 9:return this._keyTab(a);case 8:return this._keyBack(a);case 46:return this._keyDelete(a);case 13:return this._keyReturn(a)}},c.prototype._onKeyUp=function(a){return c.__super__._onKeyUp.call(this,a),this._syncContent()},c.prototype._onMouseDown=function(b){if(c.__super__._onMouseDown.call(this,b),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(a){return function(){return a.drag(b.pageX,b.pageY)}}(this),a.DRAG_HOLD_DURATION),0===this.content.length()&&a.Root.get().focused()===this)return b.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)},c.prototype._onMouseMove=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseMove.call(this,a)},c.prototype._onMouseOut=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseOut.call(this,a)},c.prototype._onMouseUp=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseUp.call(this,a)},c.prototype._keyBack=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),0===c.get()[0]&&c.isCollapsed())return a.preventDefault(),b=this.previousContent(),this._syncContent(),b?b.merge(this):void 0},c.prototype._keyDelete=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),this._atEnd(c)&&c.isCollapsed())return a.preventDefault(),b=this.nextContent(),b?this.merge(b):void 0},c.prototype._keyDown=function(a){return this._keyRight(a)},c.prototype._keyLeft=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),0===d.get()[0]&&d.isCollapsed())return b.preventDefault(),c=this.previousContent(),c?(c.focus(),d=new ContentSelect.Range(c.content.length(),c.content.length()),d.select(c.domElement())):a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;if(b.preventDefault(),!(this.content.isWhitespace()&&!b.shiftKey^a.PREFER_LINE_BREAKS)){if(f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),b.shiftKey^a.PREFER_LINE_BREAKS)return d=f.get()[0],e="<br>",this.content.length()===d&&(0!==this.content.length()&&this.content.characters[d-1].isTag("br")||(e="<br><br>")),this.content=this.content.insert(d,new HTMLString.String(e,!0),!0),this.updateInnerHTML(),d+=1,f=new ContentSelect.Range(d,d),f.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=h.trim(),this.updateInnerHTML(),c=new this.constructor("p",{},g.trim()),this.parent().attach(c,this.parent().children.indexOf(this)+1),h.length()?(c.focus(),f=new ContentSelect.Range(0,0),f.select(c.domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint()}},c.prototype._keyRight=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),this._atEnd(d)&&d.isCollapsed())return b.preventDefault(),c=this.nextContent(),c?(c.focus(),d=new ContentSelect.Range(0,0),d.select(c.domElement())):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyTab=function(b){if(b.preventDefault(),this.isFixed())return b.shiftKey?a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyUp=function(a){return this._keyLeft(a)},c.prototype._atEnd=function(a){return a.get()[0]>=this.content.length()},c.prototype._flagIfEmpty=function(){return 0===this.content.length()?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},c.prototype._syncContent=function(a){var b,c;return c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.droppers={Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={Text:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&b.updateInnerHTML(),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),a.parent()&&a.parent().detach(a),b.taint()}},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML.replace(/^\s+|\s+$/g,""))},c}(a.Element),a.TagNames.get().register(a.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),a.PreText=function(b){function c(b,c,d){d instanceof HTMLString.String?this.content=d:this.content=new HTMLString.String(d,!0),a.Element.call(this,b,c)}return h(c,b),c.TAB_INDENT="    ",c.prototype.cssTypeName=function(){return"pre-text"},c.prototype.type=function(){return"PreText"},c.prototype.typeName=function(){return"Preformatted"},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),c.__super__.blur.call(this)},c.prototype.html=function(a){var b;return null==a&&(a=""),(!this._lastCached||this._lastCached<this._modified)&&(b=this.content.copy(),b.optimize(),this._lastCached=Date.now(),this._cached=b.html()),a+"<"+this._tagName+this._attributesToString()+">"+this._cached+"</"+this._tagName+">"},c.prototype.updateInnerHTML=function(){var a;return a=this.content.html(),this._domElement.innerHTML=a,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._keyBack=function(a){var b;return b=ContentSelect.Range.query(this._domElement),b.get()[0]<=this.content.length()?c.__super__._keyBack.call(this,a):(b.set(this.content.length(),this.content.length()),b.select(this._domElement))},c.prototype._keyReturn=function(a){var b,c,d,e;return a.preventDefault(),c=ContentSelect.Range.query(this._domElement),b=c.get()[0]+1,0===c.get()[0]&&c.isCollapsed()?this.content=new HTMLString.String("\n",!0).concat(this.content):this._atEnd(c)&&c.isCollapsed()?this.content=this.content.concat(new HTMLString.String("\n",!0)):0===c.get()[0]&&c.get()[1]===this.content.length()?(this.content=new HTMLString.String("\n",!0),b=0):(e=this.content.substring(0,c.get()[0]),d=this.content.substring(c.get()[1]),this.content=e.concat(new HTMLString.String("\n",!0),d)),this.updateInnerHTML(),c.set(b,b),c.select(this._domElement),this.taint()},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(b.preventDefault(),c=this.content.length(),k=a.PreText.TAB_INDENT,j=k.length,o=this.content.split("\n"),p=this.selection().get(),p[0]=Math.min(p[0],c),p[1]=Math.min(p[1],c),e=0,s=-1,f=-1,h=v=0,z=o.length;v<z&&(m=o[h],n=m.length()+1,p[0]<e+n&&-1===s&&(s=h),p[1]<e+n&&-1===f&&(f=h),!(s>-1&&f>-1));h=++v)e+=n;if(s===f)j-=(p[0]-e)%j,i=new HTMLString.String(Array(j+1).join(" "),!0),u=o[s].substring(0,p[0]-e),t=o[s].substring(p[1]-e),o[s]=u.concat(i,t),r=j;else if(b.shiftKey){for(g=0,h=w=s;s<=f?w<=f:w>=f;h=s<=f?++w:--w){for(B=o[h].characters.slice(),l=x=0,A=B.length;x<A&&(d=B[l],!(l>j-1))&&d.isWhitespace();l=++x)o[h].characters.shift();h===s&&(g=l)}r=Math.max(-j,-g)}else{for(i=new HTMLString.String(k,!0),h=y=s;s<=f?y<=f:y>=f;h=s<=f?++y:--y)o[h]=i.concat(o[h]);r=j}return this.content=HTMLString.String.join(new HTMLString.String("\n",!0),o),this.updateInnerHTML(),q=this.content.length()-c,new ContentSelect.Range(p[0]+r,p[1]+q).select(this._domElement)},c.prototype._syncContent=function(a){var b,c;return this._ensureEndZWS(),c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.prototype._ensureEndZWS=function(){var a,b;if(this._domElement.lastChild&&(a=this._domElement.innerHTML,!("​"===a[a.length-1]&&a.indexOf("​")<a.length-1)))return b=function(b){return function(){return a.indexOf("​")>-1&&(b._domElement.innerHTML=a.replace(/\u200B/g,"")),b._domElement.lastChild.textContent+="​"}}(this),this._savedSelection?b():(this.storeState(),b(),this.restoreState())},c.droppers={PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Text),a.TagNames.get().register(a.PreText,"pre"),a.Image=function(b){function c(a,b){var d;c.__super__.constructor.call(this,"img",a),this.a=b||null,d=this.size(),this._aspectRatio=d[1]/d[0]}return h(c,b),c.prototype.cssTypeName=function(){return"image"},c.prototype.type=function(){return"Image"},c.prototype.typeName=function(){return"Image"},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.style.backgroundImage="url('"+this._attributes.src+"')",a},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),d=b+"<img"+this._attributesToString()+">",this.a?(e=a.LINE_ENDINGS,c=a.attributesToString(this.a),c+=' data-ce-tag="img"',b+"<a "+c+">"+e+a.INDENT+d+e+b+"</a>"):d},c.prototype.mount=function(){var a,b;return this._domElement=document.createElement("img"),this._domElement.setAttribute("src",this._attributes.src),a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),b=this._attributes.style?this._attributes.style:"",this._attributes.width&&(b+="width:"+this._attributes.width+"px;"),this._attributes.height&&(b+="height:auto;"),this._domElement.setAttribute("style",b),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("a, img"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth},
c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i,j;if(b=null,"a"===a.tagName.toLowerCase()){for(b=this.getDOMElementAttributes(a),f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b<c;b++)d=e[b],f.push(d);return f}(),i=0,j=f.length;i<j;i++)if(e=f[i],1===e.nodeType&&"img"===e.tagName.toLowerCase()){a=e;break}"a"===a.tagName.toLowerCase()&&(a=document.createElement("img"))}return c=this.getDOMElementAttributes(a),h=c.width,g=c.height,void 0===c.width&&(h=void 0===c.height?a.naturalWidth:a.clientWidth),void 0===c.height&&(g=void 0===c.width?a.naturalHeight:a.clientHeight),c.width=h,c.height=g,new this(c,b)},c}(a.ResizableElement),a.TagNames.get().register(a.Image,"img"),a.ImageFixture=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._src=d}return h(c,b),c.prototype.cssTypeName=function(){return"image-fixture"},c.prototype.type=function(){return"ImageFixture"},c.prototype.typeName=function(){return"ImageFixture"},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),f=a.LINE_ENDINGS,d=this._attributesToString(),c="",void 0!==this._attributes.alt&&(c='alt="'+this._attributes.alt+'"'),e=b+'<img src="'+this.src()+'"'+c+">",b+"<"+this.tagName()+" "+d+">"+f+a.INDENT+e+f+b+"</"+this.tagName()+">"},c.prototype.mount=function(){var a,b,d,e,f,g;this._domElement=document.createElement(this.tagName()),g=this._attributes;for(b in g)f=g[b],"alt"!==b&&"style"!==b&&this._domElement.setAttribute(b,f);return a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),d=this._attributes.style?this._attributes.style:"",e=document.createElement("div"),e.setAttribute("style",d.trim()),e.style.backgroundImage=null,d=e.getAttribute("style"),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._domElement.setAttribute("style",d.trim()),c.__super__.mount.call(this)},c.prototype.src=function(a){return void 0===a?this._src:(this._src=a,this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){var a,b;return this.isFixed()?(b=document.createElement("div"),b.innerHTML=this.html(),a=b.firstElementChild,this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a,this.parent()._domElement=this._domElement):c.__super__.unmount.call(this)},c.prototype._attributesToString=function(){var b,c,d,e,f,g;this._attributes.style?(d=this._attributes.style?this._attributes.style:"",e=document.createElement("div"),e.setAttribute("style",d.trim()),e.style.backgroundImage=null,d=e.getAttribute("style"),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._attributes.style=d.trim()):this._attributes.style="background-image:url('"+this.src()+"');",b={},g=this._attributes;for(c in g)f=g[c],"alt"!==c&&(b[c]=f);return" "+a.attributesToString(b)},c.droppers={ImageFixture:a.Element._dropVert,Image:a.Element._dropVert,PreText:a.Element._dropVert,Text:a.Element._dropVert},c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i;for(a.tagName,c=this.getDOMElementAttributes(a),g="",b="",f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b<c;b++)d=e[b],f.push(d);return f}(),h=0,i=f.length;h<i;h++)if(e=f[h],1===e.nodeType&&"img"===e.tagName.toLowerCase()){g=e.getAttribute("src")||"",b=e.getAttribute("alt")||"";break}return c=this.getDOMElementAttributes(a),c.alt=b,new this(a.tagName,c,g)},c}(a.Element),a.TagNames.get().register(a.ImageFixture,"img-fixture"),a.Video=function(b){function c(a,b,d){var e;null==d&&(d=[]),c.__super__.constructor.call(this,a,b),this.sources=d,e=this.size(),this._aspectRatio=e[1]/e[0]}return h(c,b),c.prototype.cssTypeName=function(){return"video"},c.prototype.type=function(){return"Video"},c.prototype.typeName=function(){return"Video"},c.prototype._title=function(){var a;return a="",this.attr("src")?a=this.attr("src"):this.sources.length&&(a=this.sources[0].src),a||(a="No video source set"),a.length>80&&(a=a.substr(0,80)+"..."),a},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.innerHTML=this._title(),a},c.prototype.html=function(b){var c,d,e,f,g,h,i;if(null==b&&(b=""),d=a.LINE_ENDINGS,"video"===this.tagName()){for(f=[],i=this.sources,g=0,h=i.length;g<h;g++)e=i[g],c=a.attributesToString(e),f.push(""+b+a.INDENT+"<source "+c+">");return b+"<video"+this._attributesToString()+">"+d+f.join(d)+d+b+"</video>"}return b+"<"+this._tagName+this._attributesToString()+"></"+this._tagName+">"},c.prototype.mount=function(){var a;return this._domElement=document.createElement("div"),this.a&&this.a.class?this._domElement.setAttribute("class",this.a.class):this._attributes.class&&this._domElement.setAttribute("class",this._attributes.class),a=this._attributes.style?this._attributes.style:"",this._attributes.width&&(a+="width:"+this._attributes.width+"px;"),this._attributes.height&&(a+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",a),this._domElement.setAttribute("data-ce-title",this._title()),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("iframe"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth,Video:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g;for(d=function(){var c,d,e,f;for(e=a.childNodes,f=[],c=0,d=e.length;c<d;c++)b=e[c],f.push(b);return f}(),e=[],f=0,g=d.length;f<g;f++)c=d[f],1===c.nodeType&&"source"===c.tagName.toLowerCase()&&e.push(this.getDOMElementAttributes(c));return new this(a.tagName,this.getDOMElementAttributes(a),e)},c}(a.ResizableElement),a.TagNames.get().register(a.Video,"iframe","video"),a.List=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"list"},c.prototype.type=function(){return"List"},c.prototype.typeName=function(){return"List"},c.prototype._onMouseOver=function(a){if("ListItem"!==this.parent().type())return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;g<h;g++)d=e[g],1===d.nodeType&&"li"===d.tagName.toLowerCase()&&f.attach(a.ListItem.fromDOMElement(d));return 0===f.children.length?null:f},c}(a.ElementCollection),a.TagNames.get().register(a.List,"ol","ul"),a.ListItem=function(b){function c(a){c.__super__.constructor.call(this,"li",a),this._behaviours.indent=!0}return h(c,b),c.prototype.cssTypeName=function(){return"list-item"},c.prototype.list=function(){return 2===this.children.length?this.children[1]:null},c.prototype.listItemText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"ListItem"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<li"+this._attributesToString()+">"],this.listItemText()&&c.push(this.listItemText().html(b+a.INDENT)),this.list()&&c.push(this.list().html(b+a.INDENT)),c.push(b+"</li>"),c.join(a.LINE_ENDINGS)},c.prototype.indent=function(){var b;if(this.can("indent")&&0!==this.parent().children.indexOf(this))return b=this.previousSibling(),b.list()||b.attach(new a.List(b.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),b.list().attach(this),this.listItemText().restoreState()},c.prototype.remove=function(){var a,b,c,d,e,f;if(this.parent()){if(c=this.parent().children.indexOf(this),this.list())for(f=this.list().children.slice(),b=d=0,e=f.length;d<e;b=++d)a=f[b],a.parent().detach(a),this.parent().attach(a,b+c);return this.parent().detach(this)}},c.prototype.unindent=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(this.can("indent")){if(g=this.parent(),c=g.parent(),k=g.children.slice(g.children.indexOf(this)+1,g.children.length),"ListItem"===c.type()){for(this.listItemText().storeState(),g.detach(this),c.parent().attach(this,c.parent().children.indexOf(c)+1),k.length&&!this.list()&&this.attach(new a.List(g.tagName())),m=0,q=k.length;m<q;m++)j=k[m],j.parent().detach(j),this.list().attach(j);return this.listItemText().restoreState()}if(l=new a.Text("p",this.attr("class")?{class:this.attr("class")}:{},this.listItemText().content),i=null,this.listItemText().isFocused()&&(i=ContentSelect.Range.query(this.listItemText().domElement())),h=c.children.indexOf(g),0===(e=g.children.indexOf(this))){if(f=null,1===g.children.length?(this.list()&&(f=new a.List(g.tagName())),c.detach(g)):g.detach(this),c.attach(l,h),f&&c.attach(f,h+1),this.list())for(u=this.list().children.slice(),d=n=0,r=u.length;n<r;d=++n)b=u[d],b.parent().detach(b),f?f.attach(b):g.attach(b,d)}else if(e===g.children.length-1)g.detach(this),c.attach(l,h+1),this.list()&&c.attach(this.list(),h+2);else{if(g.detach(this),c.attach(l,h+1),f=new a.List(g.tagName()),c.attach(f,h+2),this.list())for(v=this.list().children.slice(),o=0,s=v.length;o<s;o++)b=v[o],b.parent().detach(b),f.attach(b);for(p=0,t=k.length;p<t;p++)j=k[p],j.parent().detach(j),f.attach(j)}return i?(l.focus(),i.select(l.domElement())):void 0}},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l;for(g=new this(this.getDOMElementAttributes(b)),d="",e=null,k=b.childNodes,i=0,j=k.length;i<j;i++)c=k[i],1===c.nodeType?"ul"===(l=c.tagName.toLowerCase())||"ol"===l||"li"===l?e||(e=c):d+=c.outerHTML:d+=HTMLString.String.encode(c.textContent);return d=d.replace(/^\s+|\s+$/g,""),h=new a.ListItemText(d),g.attach(h),e&&(f=a.List.fromDOMElement(e),g.attach(f)),g},c}(a.ElementCollection),a.ListItemText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"list-item-text"},c.prototype.type=function(){return"ListItemText"},c.prototype.typeName=function(){return"List item"},c.prototype.blur=function(){return this.content.isWhitespace()&&this.can("remove")?this.parent().remove():this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(c=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),c.optimize(),this._lastCached=Date.now(),this._cached=c.html()),""+b+this._cached},c.prototype._onMouseDown=function(b){var c;return a.Element.prototype._onMouseDown.call(this,b),c=function(d){return function(){var e;return a.Root.get().dragging()===d?(a.Root.get().cancelDragging(),e=d.closest(function(a){return"Region"===a.parent().type()}),e.drag(b.pageX,b.pageY)):(d.drag(b.pageX,b.pageY),d._dragTimeout=setTimeout(c,2*a.DRAG_HOLD_DURATION))}}(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(c,a.DRAG_HOLD_DURATION)},c.prototype._onMouseMove=function(b){return this._dragTimeout&&clearTimeout(this._dragTimeout),a.Element.prototype._onMouseMove.call(this,b)},c.prototype._onMouseUp=function(b){return this._dragTimeout&&clearTimeout(this._dragTimeout),a.Element.prototype._onMouseUp.call(this,b)},c.prototype._keyTab=function(a){return a.preventDefault(),a.shiftKey?this.parent().unindent():this.parent().indent()},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;return b.preventDefault(),this.content.isWhitespace()?void this.parent().unindent():this.can("spawn")?(ContentSelect.Range.query(this._domElement),f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),h.length()+g.length()===0?void this.parent().unindent():(this.content=h.trim(),this.updateInnerHTML(),c=this.parent().parent(),e=new a.ListItem(this.attr("class")?{class:this.attr("class")}:{}),c.attach(e,c.children.indexOf(this.parent())+1),e.attach(new a.ListItemText(g.trim())),d=this.parent().list(),d&&(this.parent().detach(d),e.attach(d)),h.length()?(e.listItemText().focus(),f=new ContentSelect.Range(0,0),f.select(e.listItemText().domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint())):void 0},c.droppers={ListItemText:function(b,c,d){var e,f,g,h;return e=b.parent(),h=c.parent(),e.remove(),e.detach(b),g=new a.ListItem(e._attributes),g.attach(b),h.list()&&"below"===d[0]?void h.list().attach(g,0):(f=h.parent().children.indexOf(h),"below"===d[0]&&(f+=1),h.parent().attach(g,f))},Text:function(b,c,d){var e,f,g,h,i;if("Text"===b.type()){if(h=c.parent(),b.parent().detach(b),e=b.attr("class"),g=new a.ListItem(e?{class:e}:{}),g.attach(new a.ListItemText(b.content)),h.list()&&"below"===d[0])return void h.list().attach(g,0);if(f=h.parent().children.indexOf(h),"below"===d[0]&&(f+=1),h.parent().attach(g,f),g.listItemText().focus(),b._savedSelection)return b._savedSelection.select(g.listItemText().domElement())}else if(e=b.attr("class"),i=new a.Text("p",e?{class:e}:{},b.content),b.parent().remove(),f=c.parent().children.indexOf(c),"below"===d[0]&&(f+=1),c.parent().attach(i,f),i.focus(),b._savedSelection)return b._savedSelection.select(i.domElement())}},c.mergers={ListItemText:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&(b._domElement.innerHTML=b.content.html()),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),"Text"===a.type()?a.parent()&&a.parent().detach(a):a.parent().remove(),b.taint()}},c}(a.Text),d=a.ListItemText.mergers,d.Text=d.ListItemText,a.Table=function(b){function c(a){c.__super__.constructor.call(this,"table",a)}return h(c,b),c.prototype.cssTypeName=function(){return"table"},c.prototype.typeName=function(){return"Table"},c.prototype.type=function(){return"Table"},c.prototype.firstSection=function(){var a;return(a=this.thead())?a:(a=this.tbody())?a:(a=this.tfoot())?a:null},c.prototype.lastSection=function(){var a;return(a=this.tfoot())?a:(a=this.tbody())?a:(a=this.thead())?a:null},c.prototype.tbody=function(){return this._getChild("tbody")},c.prototype.tfoot=function(){return this._getChild("tfoot")},c.prototype.thead=function(){return this._getChild("thead")},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._getChild=function(a){var b,c,d,e;for(e=this.children,c=0,d=e.length;c<d;c++)if(b=e[c],b.tagName()===a)return b;return null},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Table:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;for(i=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),f=[],k=0,m=e.length;k<m;k++)if(d=e[k],1===d.nodeType&&(j=d.tagName.toLowerCase(),!i._getChild(j)))switch(j){case"tbody":case"tfoot":case"thead":h=a.TableSection.fromDOMElement(d),i.attach(h);break;case"tr":f.push(a.TableRow.fromDOMElement(d))}if(f.length>0)for(i._getChild("tbody")||i.attach(new a.TableSection("tbody")),l=0,n=f.length;l<n;l++)g=f[l],i.tbody().attach(g);return 0===i.children.length?null:i},c}(a.ElementCollection),a.TagNames.get().register(a.Table,"table"),a.TableSection=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"table-section"},c.prototype.type=function(){return"TableSection"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;g<h;g++)d=e[g],1===d.nodeType&&"tr"===d.tagName.toLowerCase()&&f.attach(a.TableRow.fromDOMElement(d));return f},c}(a.ElementCollection),a.TableRow=function(b){function c(a){c.__super__.constructor.call(this,"tr",a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-row"},c.prototype.isEmpty=function(){var a,b,c,d,e;for(e=this.children,c=0,d=e.length;c<d;c++)if(a=e[c],(b=a.tableCellText())&&b.content.length()>0)return!1;return!0},c.prototype.type=function(){return"TableRow"},c.prototype.typeName=function(){return"Table row"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={TableRow:a.Element._dropVert},c.fromDOMElement=function(b){var c,d,e,f,g,h,i;for(f=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),h=0,i=e.length;h<i;h++)d=e[h],1===d.nodeType&&("td"!==(g=d.tagName.toLowerCase())&&"th"!==g||f.attach(a.TableCell.fromDOMElement(d)));return f},c}(a.ElementCollection),a.TableCell=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell"},c.prototype.tableCellText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"TableCell"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&c.push(this.tableCellText().html(b+a.INDENT)),c.push(b+"</"+this.tagName()+">"),c.join(a.LINE_ENDINGS)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d;return c=new this(b.tagName,this.getDOMElementAttributes(b)),d=new a.TableCellText(b.innerHTML.replace(/^\s+|\s+$/g,"")),c.attach(d),c},c}(a.ElementCollection),a.TableCellText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell-text"},c.prototype.type=function(){return"TableCellText"},c.prototype._isInFirstRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.firstSection()&&b===c.children[0]},c.prototype._isInLastRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.lastSection()&&b===c.children[c.children.length-1]},c.prototype._isLastInSection=function(){var a,b,c;return a=this.parent(),b=a.parent(),c=b.parent(),b===c.children[c.children.length-1]&&a===b.children[b.children.length-1]},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(c=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),c.optimize(),this._lastCached=Date.now(),this._cached=c.html()),""+b+this._cached},c.prototype._onMouseDown=function(b){var c;return a.Element.prototype._onMouseDown.call(this,b),c=function(d){return function(){var e,f;return e=d.parent(),a.Root.get().dragging()===e.parent()?(a.Root.get().cancelDragging(),f=e.parent().parent().parent(),f.drag(b.pageX,b.pageY)):(e.parent().drag(b.pageX,b.pageY),d._dragTimeout=setTimeout(c,2*a.DRAG_HOLD_DURATION))}}(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(c,a.DRAG_HOLD_DURATION)},c.prototype._keyBack=function(a){var b,c,d,e;if(e=ContentSelect.Range.query(this._domElement),0===e.get()[0]&&e.isCollapsed()&&(a.preventDefault(),b=this.parent(),d=b.parent(),d.isEmpty()&&d.can("remove")))return 0===this.content.length()&&0===d.children.indexOf(b)?(c=this.previousContent(),c&&(c.focus(),e=new ContentSelect.Range(c.content.length(),c.content.length()),e.select(c.domElement())),d.parent().detach(d)):void 0},c.prototype._keyDelete=function(a){var b,c,d,e;if(d=this.parent().parent(),d.isEmpty()&&d.can("remove"))return a.preventDefault(),b=d.children[d.children.length-1],c=b.tableCellText().nextContent(),c&&(c.focus(),e=new ContentSelect.Range(0,0),e.select(c.domElement())),d.parent().detach(d)},c.prototype._keyDown=function(b){var c,d,e,f,g,h,i;if(i=ContentSelect.Range.query(this._domElement),this._atEnd(i)&&i.isCollapsed())return b.preventDefault(),c=this.parent(),this._isInLastRow()?(h=c.parent(),e=h.children[h.children.length-1].tableCellText(),f=e.nextContent(),f?f.focus():a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(g=c.parent().nextWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,g.children.length),g.children[d].tableCellText().focus())},c.prototype._keyReturn=function(a){return a.preventDefault(),this._keyTab({shiftKey:!1,preventDefault:function(){}})},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l;if(b.preventDefault(),c=this.parent(),b.shiftKey){if(this._isInFirstRow()&&c.parent().children[0]===c)return;return this.previousContent().focus()}if(this.can("spawn")){if(e=c.parent().parent(),"tbody"===e.tagName()&&this._isLastInSection()){for(h=new a.TableRow,l=c.parent().children,j=0,k=l.length;j<k;j++)d=l[j],f=new a.TableCell(d.tagName(),d._attributes),g=new a.TableCellText(""),f.attach(g),h.attach(f);return i=this.closest(function(a){return"TableSection"===a.type()}),i.attach(h),h.children[0].tableCellText().focus()}return this.nextContent().focus()}},c.prototype._keyUp=function(b){var c,d,e,f,g,h;if(h=ContentSelect.Range.query(this._domElement),0===h.get()[0]&&h.isCollapsed())return b.preventDefault(),c=this.parent(),this._isInFirstRow()?(g=c.parent(),e=g.children[0].previousContent(),e?e.focus():a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(f=c.parent().previousWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,f.children.length),f.children[d].tableCellText().focus())},c.droppers={},c.mergers={},c}(a.Text)}.call(this),function(){var a,b,c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h=function(a,b){return function(){return a.apply(b,arguments)}},i=[].slice;b={Tools:{},CANCEL_MESSAGE:"Your changes have not been saved, do you really want to lose them?".trim(),DEFAULT_TOOLS:[["heading","heading2","heading3","heading4","heading5","paragraph","bold","italic","underline","strike","code","link","align-left","align-center","align-right","unordered-list","ordered-list","line-break","indent","unindent"],["image","video","table","undo","redo","remove"]],DEFAULT_VIDEO_HEIGHT:300,DEFAULT_VIDEO_WIDTH:400,HIGHLIGHT_HOLD_DURATION:2e3,IMAGE_UPLOADER:null,INLINE_TAGS:["a","address","b","code","del","em","i","ins","span","strong","sup","u"],INSPECTOR_IGNORED_ELEMENTS:["Fixture","ListItemText","Region","TableCellText"],MIN_CROP:10,RESTRICTED_ATTRIBUTES:{"*":["style"],img:["height","src","width","data-ce-max-width","data-ce-min-width"],iframe:["height","width"]},getEmbedVideoURL:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(b={"www.youtube.com":"youtube","youtu.be":"youtube","vimeo.com":"vimeo","player.vimeo.com":"vimeo"},k=document.createElement("a"),k.href=a,g=k.hostname.toLowerCase(),l=k.pathname,null!==l&&"/"!==l.substr(0,1)&&(l="/"+l),i={},j=k.search.slice(1),p=j.split("&"),n=0,o=p.length;n<o;n++)e=p[n],e=e.split("="),e[0]&&(i[e[0]]=e[1]);switch(b[g]){case"youtube":if("/watch"===l.toLowerCase()){if(!i.v)return null;c=i.v,delete i.v}else{if(!(f=l.match(/\/([A-Za-z0-9_-]+)$/i)))return null;c=f[1]}return a="https://www.youtube.com/embed/"+c,h=function(){var a;a=[];for(d in i)m=i[d],a.push(d+"="+m);return a}().join("&"),h&&(a+="?"+h),a;case"vimeo":return(f=l.match(/\/(\w+\/\w+\/){0,1}(\d+)/i))?(a="https://player.vimeo.com/video/"+f[2],h=function(){var a;a=[];for(d in i)m=i[d],a.push(d+"="+m);return a}().join("&"),h&&(a+="?"+h),a):null}return null},getHTMLCleaner:function(){return new b.HTMLCleaner},getRestrictedAtributes:function(a){var c;return c=[],b.RESTRICTED_ATTRIBUTES[a]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES[a])),b.RESTRICTED_ATTRIBUTES["*"]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES["*"])),c},getScrollPosition:function(){var a,b;return b=void 0!==window.pageXOffset,a=4===(document.compatMode||4),b?[window.pageXOffset,window.pageYOffset]:a?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]}},"undefined"!=typeof window&&(window.ContentTools=b),"undefined"!=typeof module&&module.exports&&(module.exports=b),b.ComponentUI=function(){function a(){this._bindings={},this._parent=null,this._children=[],this._domElement=null}return a.prototype.children=function(){return this._children.slice()},a.prototype.domElement=function(){return this._domElement},a.prototype.isMounted=function(){return null!==this._domElement},a.prototype.parent=function(){return this._parent},a.prototype.attach=function(a,b){return a.parent()&&a.parent().detach(a),a._parent=this,void 0!==b?this._children.splice(b,0,a):this._children.push(a)},a.prototype.addCSSClass=function(a){if(this.isMounted())return ContentEdit.addCSSClass(this._domElement,a)},a.prototype.detach=function(a){var b;if(-1!==(b=this._children.indexOf(a)))return this._children.splice(b,1)},a.prototype.mount=function(){},a.prototype.removeCSSClass=function(a){if(this.isMounted())return ContentEdit.removeCSSClass(this._domElement,a)},a.prototype.unmount=function(){if(this.isMounted())return this._removeDOMEventListeners(),this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null},a.prototype.addEventListener=function(a,b){void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b)},a.prototype.createEvent=function(a,c){return new b.Event(a,c)},a.prototype.dispatchEvent=function(a){var b,c,d,e;if(!this._bindings[a.name()])return!a.defaultPrevented();for(e=this._bindings[a.name()],c=0,d=e.length;c<d&&(b=e[c],!a.propagationStopped());c++)b&&b.call(this,a);return!a.defaultPrevented()},a.prototype.removeEventListener=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;e<f;c=++e)d=g[c],d===b?h.push(this._bindings[a].splice(c,1)):h.push(void 0);return h}},a.prototype._addDOMEventListeners=function(){},a.prototype._removeDOMEventListeners=function(){},a.createDiv=function(a,b,c){var d,e,f;if(d=document.createElement("div"),a&&a.length>0&&d.setAttribute("class",a.join(" ")),b)for(e in b)f=b[e],d.setAttribute(e,f);return c&&(d.innerHTML=c),d},a}(),b.WidgetUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.attach=function(a,c){if(b.__super__.attach.call(this,a,c),!this.isMounted())return a.mount()},b.prototype.detach=function(a){if(b.__super__.detach.call(this,a),this.isMounted())return a.unmount()},b.prototype.detatch=function(a){return console.log("Please call detach, detatch will be removed in release 1.4.x"),this.detach(a)},b.prototype.show=function(){var a;return this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null,this.unmount()),this.isMounted()||this.mount(),a=function(a){return function(){return a.addCSSClass("ct-widget--active"),a._showTimeout=null}}(this),this._showTimeout=setTimeout(a,100)},b.prototype.hide=function(){var a;if(this._showTimeout&&(clearTimeout(this._showTimeout),this._showTimeout=null),this.removeCSSClass("ct-widget--active"),a=function(b){return function(){return b._hideTimeout=null,window.getComputedStyle?parseFloat(window.getComputedStyle(b._domElement).opacity)<.01?b.unmount():b._hideTimeout=setTimeout(a,250):void b.unmount()}}(this),this.isMounted())return this._hideTimeout=setTimeout(a,250)},b}(b.ComponentUI),b.AnchoredComponentUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.mount=function(a,b){return null==b&&(b=null),a.insertBefore(this._domElement,b),this._addDOMEventListeners()},b}(b.ComponentUI),b.Event=function(){function a(a,b){this._name=a,this._detail=b,this._timeStamp=Date.now(),this._defaultPrevented=!1,this._propagationStopped=!1}return a.prototype.defaultPrevented=function(){return this._defaultPrevented},a.prototype.detail=function(){return this._detail},a.prototype.name=function(){return this._name},a.prototype.propagationStopped=function(){return this._propagationStopped},a.prototype.timeStamp=function(){return this._timeStamp},a.prototype.preventDefault=function(){return this._defaultPrevented=!0},a.prototype.stopImmediatePropagation=function(){return this._propagationStopped=!0},a}(),b.FlashUI=function(a){function c(a){c.__super__.constructor.call(this),this.mount(a)}return g(c,a),c.prototype.mount=function(a){var d;return this._domElement=this.constructor.createDiv(["ct-flash","ct-flash--active","ct-flash--"+a,"ct-widget","ct-widget--active"]),c.__super__.mount.call(this,b.EditorApp.get().domElement()),d=function(a){return function(){return window.getComputedStyle?parseFloat(window.getComputedStyle(a._domElement).opacity)<.01?a.unmount():setTimeout(d,250):void a.unmount()}}(this),setTimeout(d,250)},c}(b.AnchoredComponentUI),b.IgnitionUI=function(a){function b(){b.__super__.constructor.call(this),this._revertToState="ready",this._state="ready"}return g(b,a),b.prototype.busy=function(a){if(this.dispatchEvent(this.createEvent("busy",{busy:a}))){if(a===("busy"===this._state))return;return a?(this._revertToState=this._state,this.state("busy")):this.state(this._revertToState)}},b.prototype.cancel=function(){if(this.dispatchEvent(this.createEvent("cancel")))return this.state("ready")},b.prototype.confirm=function(){if(this.dispatchEvent(this.createEvent("confirm")))return this.state("ready")},b.prototype.edit=function(){if(this.dispatchEvent(this.createEvent("edit")))return this.state("editing")},b.prototype.mount=function(){return b.__super__.mount.call(this),this._domElement=this.constructor.createDiv(["ct-widget","ct-ignition","ct-ignition--ready"]),this.parent().domElement().appendChild(this._domElement),this._domEdit=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--edit"]),this._domElement.appendChild(this._domEdit),this._domLogout=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--logout"]),this._domElement.appendChild(this._domLogout),this._domConfirm=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--confirm"]),this._domElement.appendChild(this._domConfirm),this._domBlog=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--blog"]),this._domElement.appendChild(this._domBlog),this._domCancel=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--cancel"]),this._domElement.appendChild(this._domCancel),
this._domBusy=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--busy"]),this._domElement.appendChild(this._domBusy),this._addDOMEventListeners()},b.prototype.state=function(a){if(void 0===a)return this._state;if(this._state!==a&&this.dispatchEvent(this.createEvent("statechange",{state:a})))return this._state=a,this.removeCSSClass("ct-ignition--busy"),this.removeCSSClass("ct-ignition--editing"),this.removeCSSClass("ct-ignition--ready"),"busy"===this._state?this.addCSSClass("ct-ignition--busy"):"editing"===this._state?this.addCSSClass("ct-ignition--editing"):"ready"===this._state?this.addCSSClass("ct-ignition--ready"):void 0},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domEdit=null,this._domConfirm=null,this._domCancel=null},b.prototype._addDOMEventListeners=function(){return this._domEdit.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.edit()}}(this)),this._domConfirm.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.confirm()}}(this)),this._domCancel.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.cancel()}}(this))},b}(b.WidgetUI),b.InspectorUI=function(a){function c(){c.__super__.constructor.call(this),this._tagUIs=[]}return g(c,a),c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-inspector"]),this.parent().domElement().appendChild(this._domElement),this._domTags=this.constructor.createDiv(["ct-inspector__tags","ct-tags"]),this._domElement.appendChild(this._domTags),this._domCounter=this.constructor.createDiv(["ct-inspector__counter"]),this._domElement.appendChild(this._domCounter),this.updateCounter(),this._addDOMEventListeners(),this._handleFocusChange=function(a){return function(){return a.updateTags()}}(this),ContentEdit.Root.get().bind("blur",this._handleFocusChange),ContentEdit.Root.get().bind("focus",this._handleFocusChange),ContentEdit.Root.get().bind("mount",this._handleFocusChange)},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domTags=null,ContentEdit.Root.get().unbind("blur",this._handleFocusChange),ContentEdit.Root.get().unbind("focus",this._handleFocusChange),ContentEdit.Root.get().unbind("mount",this._handleFocusChange)},c.prototype.updateCounter=function(){var a,c,d,e,f,g,h,i,j,k,l;if(this.isMounted()){for(c="",l=b.EditorApp.get().orderedRegions(),j=0,k=l.length;j<k;j++)(g=l[j])&&(c+=g.domElement().textContent);return c=c.trim(),(c=c.replace(/<\/?[a-z][^>]*>/gi,""),c=c.replace(/[\u200B]+/,""),c=c.replace(/['";:,.?¿\-!¡]+/g,""),i=(c.match(/\S+/g)||[]).length,i=i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),(d=ContentEdit.Root.get().focused())&&"PreText"===d.type()&&d.selection().isCollapsed())?(e=0,a=1,h=d.content.substring(0,d.selection().get()[0]),f=h.text().split("\n"),e=f.length,a=f[f.length-1].length+1,e=e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),a=a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),this._domCounter.textContent=i+" / "+e+":"+a):void(this._domCounter.textContent=i)}},c.prototype.updateTags=function(){var a,c,d,e,f,g,h,i,j;for(a=ContentEdit.Root.get().focused(),i=this._tagUIs,e=0,g=i.length;e<g;e++)d=i[e],d.unmount();if(this._tagUIs=[],a){for(c=a.parents(),c.reverse(),c.push(a),j=[],f=0,h=c.length;f<h;f++)a=c[f],-1===b.INSPECTOR_IGNORED_ELEMENTS.indexOf(a.type())&&(d=new b.TagUI(a),this._tagUIs.push(d),j.push(d.mount(this._domTags)));return j}},c.prototype._addDOMEventListeners=function(){return this._updateCounterInterval=setInterval(function(a){return function(){return a.updateCounter()}}(this),250)},c.prototype._removeDOMEventListeners=function(){return clearInterval(this._updateCounterInterval)},c}(b.WidgetUI),b.TagUI=function(a){function c(a){this.element=a,this._onMouseDown=h(this._onMouseDown,this),c.__super__.constructor.call(this)}return g(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-tag"]),this._domElement.textContent=this.element.tagName(),c.__super__.mount.call(this,a,b)},c.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown)},c.prototype._onMouseDown=function(a){var c,d,e;return a.preventDefault(),this.element.storeState&&this.element.storeState(),c=b.EditorApp.get(),e=new b.ModalUI,d=new b.PropertiesDialog(this.element),d.addEventListener("cancel",function(a){return function(){if(e.hide(),d.hide(),a.element.restoreState)return a.element.restoreState()}}(this)),d.addEventListener("save",function(a){return function(b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;j=b.detail(),f=j.changedAttributes,n=j.changedStyles,l=j.innerHTML;for(m in f)if(o=f[m],"class"===m){for(null===o&&(o=""),h={},t=o.split(" "),p=0,r=t.length;p<r;p++)g=t[p],(g=g.trim())&&(h[g]=!0,a.element.hasCSSClass(g)||a.element.addCSSClass(g));if(a.element.attr("class"))for(u=a.element.attr("class").split(" "),q=0,s=u.length;q<s;q++)g=u[q],g=g.trim(),void 0===h[g]&&a.element.removeCSSClass(g)}else null===o?a.element.removeAttr(m):a.element.attr(m,o);for(i in n)c=n[i],c?a.element.addCSSClass(i):a.element.removeCSSClass(i);if(null!==l&&l!==d.getElementInnerHTML()&&(k=a.element,k.content||(k=k.children[0]),k.content=new HTMLString.String(l,k.content.preserveWhitespace()),k.updateInnerHTML(),k.taint(),k.selection(new ContentSelect.Range(0,0)),k.storeState()),e.hide(),d.hide(),a.element.restoreState)return a.element.restoreState()}}(this)),c.attach(e),c.attach(d),e.show(),d.show()},c}(b.AnchoredComponentUI),b.ModalUI=function(a){function b(a,c){b.__super__.constructor.call(this),this._transparent=a,this._allowScrolling=c}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-modal"]),this.parent().domElement().appendChild(this._domElement),this._transparent&&this.addCSSClass("ct-modal--transparent"),this._allowScrolling||ContentEdit.addCSSClass(document.body,"ct--no-scroll"),this._addDOMEventListeners()},b.prototype.unmount=function(){return this._allowScrolling||ContentEdit.removeCSSClass(document.body,"ct--no-scroll"),b.__super__.unmount.call(this)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("click"))}}(this))},b}(b.WidgetUI),b.ToolboxUI=function(a){function c(a){this._onStopDragging=h(this._onStopDragging,this),this._onStartDragging=h(this._onStartDragging,this),this._onDrag=h(this._onDrag,this),c.__super__.constructor.call(this),this._tools=a,this._dragging=!1,this._draggingOffset=null,this._domGrip=null,this._toolUIs={}}return g(c,a),c.prototype.isDragging=function(){return this._dragging},c.prototype.hide=function(){return this._removeDOMEventListeners(),c.__super__.hide.call(this)},c.prototype.mount=function(){var a,b,c;return this._domElement=this.constructor.createDiv(["ct-widget","ct-toolbox"]),this.parent().domElement().appendChild(this._domElement),this._domGrip=this.constructor.createDiv(["ct-toolbox__grip","ct-grip"]),this._domElement.appendChild(this._domGrip),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domToolGroups=this.constructor.createDiv(["ct-tool-groups"]),this._domElement.appendChild(this._domToolGroups),this.tools(this._tools),c=window.localStorage.getItem("ct-toolbox-position"),c&&/^\d+,\d+$/.test(c)&&(b=function(){var b,d,e,f;for(e=c.split(","),f=[],b=0,d=e.length;b<d;b++)a=e[b],f.push(parseInt(a));return f}(),this._domElement.style.left=b[0]+"px",this._domElement.style.top=b[1]+"px",this._contain()),this._addDOMEventListeners()},c.prototype.tools=function(a){var c,d,e,f,g,h,i,j,k,l,m;if(void 0===a)return this._tools;if(this._tools=a,this.isMounted()){k=this._toolUIs;for(g in k)h=k[g],h.unmount();for(this._toolUIs={};this._domToolGroups.lastChild;)this._domToolGroups.removeChild(this._domToolGroups.lastChild);for(l=this._tools,m=[],d=i=0,j=l.length;i<j;d=++i)f=l[d],c=this.constructor.createDiv(["ct-tool-group"]),this._domToolGroups.appendChild(c),m.push(function(){var a,d,h;for(h=[],a=0,d=f.length;a<d;a++)g=f[a],e=b.ToolShelf.fetch(g),this._toolUIs[g]=new b.ToolUI(e),this._toolUIs[g].mount(c),this._toolUIs[g].disabled(!0),h.push(this._toolUIs[g].addEventListener("applied",function(a){return function(){return a.updateTools()}}(this)));return h}.call(this));return m}},c.prototype.updateTools=function(){var a,b,c,d,e,f;a=ContentEdit.Root.get().focused(),c=null,a&&a.selection&&(c=a.selection()),e=this._toolUIs,f=[];for(b in e)d=e[b],f.push(d.update(a,c));return f},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domGrip=null},c.prototype._addDOMEventListeners=function(){return this._domGrip.addEventListener("mousedown",this._onStartDragging),this._domGrip.addEventListener("touchstart",this._onStartDragging),this._handleResize=function(a){return function(b){var c;return a._resizeTimeout&&clearTimeout(a._resizeTimeout),c=function(){return a._contain()},a._resizeTimeout=setTimeout(c,250)}}(this),window.addEventListener("resize",this._handleResize),this._updateTools=function(a){return function(){var c,d,e,f,g,h,i,j;if(c=b.EditorApp.get(),h=!1,d=ContentEdit.Root.get().focused(),f=null,d===a._lastUpdateElement?d&&d.selection&&(f=d.selection(),a._lastUpdateSelection?f.eq(a._lastUpdateSelection)||(h=!0):h=!0):h=!0,c.history&&(a._lastUpdateHistoryLength!==c.history.length()&&(h=!0),a._lastUpdateHistoryLength=c.history.length(),a._lastUpdateHistoryIndex!==c.history.index()&&(h=!0),a._lastUpdateHistoryIndex=c.history.index()),a._lastUpdateElement=d,a._lastUpdateSelection=f,h){i=a._toolUIs,j=[];for(e in i)g=i[e],j.push(g.update(d,f));return j}}}(this),this._updateToolsInterval=setInterval(this._updateTools,100),this._handleKeyDown=function(a){return function(c){var d,e,f,g,h,i,j;if((e=ContentEdit.Root.get().focused())&&!e.content){if(46===c.keyCode)return c.preventDefault(),b.Tools.Remove.apply(e,null,function(){});if(13===c.keyCode)return c.preventDefault(),d=b.Tools.Paragraph,d.apply(e,null,function(){})}switch(j=navigator.appVersion,f="linux",-1!==j.indexOf("Mac")?f="mac":-1!==j.indexOf("Win")&&(f="windows"),g=!1,i=!1,h=!1,f){case"linux":c.altKey||(90===c.keyCode&&c.ctrlKey&&(g=c.shiftKey,i=!g),83===c.keyCode&&c.ctrlKey&&(h=!0));break;case"mac":c.altKey||c.ctrlKey||(90===c.keyCode&&c.metaKey&&(g=c.shiftKey,i=!g),83===c.keyCode&&c.metaKey&&(h=!0));break;case"windows":c.altKey&&!c.shiftKey||(89===c.keyCode&&c.ctrlKey&&(g=!0),90===c.keyCode&&c.ctrlKey&&(i=!0),83===c.keyCode&&c.ctrlKey&&(h=!0))}if(i&&b.Tools.Undo.canApply(null,null)&&b.Tools.Undo.apply(null,null,function(){}),g&&b.Tools.Redo.canApply(null,null)&&b.Tools.Redo.apply(null,null,function(){}),h)return c.preventDefault(),a._parent.save(!0)}}(this),window.addEventListener("keydown",this._handleKeyDown)},c.prototype._contain=function(){var a;if(this.isMounted())return a=this._domElement.getBoundingClientRect(),a.left+a.width>window.innerWidth&&(this._domElement.style.left=window.innerWidth-a.width+"px"),a.top+a.height>window.innerHeight&&(this._domElement.style.top=window.innerHeight-a.height+"px"),a.left<0&&(this._domElement.style.left="0px"),a.top<0&&(this._domElement.style.top="0px"),a=this._domElement.getBoundingClientRect(),window.localStorage.setItem("ct-toolbox-position",a.left+","+a.top)},c.prototype._removeDOMEventListeners=function(){return this.isMounted()&&this._domGrip.removeEventListener("mousedown",this._onStartDragging),window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("resize",this._handleResize),clearInterval(this._updateToolsInterval)},c.prototype._onDrag=function(a){return a.preventDefault(),ContentSelect.Range.unselectAll(),"touchmove"===a.type?(this._domElement.style.left=a.touches[0].clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.touches[0].clientY-this._draggingOffset.y+"px"):(this._domElement.style.left=a.clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.clientY-this._draggingOffset.y+"px")},c.prototype._onStartDragging=function(a){var b;if(a.preventDefault(),!this.isDragging())return this._dragging=!0,this.addCSSClass("ct-toolbox--dragging"),b=this._domElement.getBoundingClientRect(),"touchstart"===a.type?(this._draggingOffset={x:a.touches[0].clientX-b.left,y:a.touches[0].clientY-b.top},document.addEventListener("touchmove",this._onDrag),document.addEventListener("touchend",this._onStopDragging)):(this._draggingOffset={x:a.clientX-b.left,y:a.clientY-b.top},document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging)),ContentEdit.addCSSClass(document.body,"ce--dragging")},c.prototype._onStopDragging=function(a){if(this.isDragging())return this._contain(),document.removeEventListener("touchmove",this._onDrag),document.removeEventListener("touchend",this._onStopDragging),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._draggingOffset=null,this._dragging=!1,this.removeCSSClass("ct-toolbox--dragging"),ContentEdit.removeCSSClass(document.body,"ce--dragging")},c}(b.WidgetUI),b.ToolUI=function(a){function b(a){this._onMouseUp=h(this._onMouseUp,this),this._onMouseLeave=h(this._onMouseLeave,this),this._onMouseDown=h(this._onMouseDown,this),this._addDOMEventListeners=h(this._addDOMEventListeners,this),b.__super__.constructor.call(this),this.tool=a,this._mouseDown=!1,this._disabled=!1}return g(b,a),b.prototype.apply=function(a,b){var c,d;if(this.tool.canApply(a,b))return d={element:a,selection:b},c=function(a){return function(b){if(b)return a.dispatchEvent(a.createEvent("applied",d))}}(this),this.dispatchEvent(this.createEvent("apply",d))?this.tool.apply(a,b,c):void 0},b.prototype.disabled=function(a){if(void 0===a)return this._disabled;if(this._disabled!==a)return this._disabled=a,a?(this._mouseDown=!1,this.addCSSClass("ct-tool--disabled"),this.removeCSSClass("ct-tool--applied")):this.removeCSSClass("ct-tool--disabled")},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-tool","ct-tool--"+this.tool.icon]),this._domElement.setAttribute("data-ct-tooltip",ContentEdit._(this.tool.label)),b.__super__.mount.call(this,a,c)},b.prototype.update=function(a,b){return(!this.tool.requiresElement||a&&a.isMounted())&&this.tool.canApply(a,b)?(this.disabled(!1),this.tool.isApplied(a,b)?this.addCSSClass("ct-tool--applied"):this.removeCSSClass("ct-tool--applied")):void this.disabled(!0)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseleave",this._onMouseLeave),this._domElement.addEventListener("mouseup",this._onMouseUp)},b.prototype._onMouseDown=function(a){if(a.preventDefault(),!this.disabled())return this._mouseDown=!0,this.addCSSClass("ct-tool--down")},b.prototype._onMouseLeave=function(a){return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b.prototype._onMouseUp=function(a){var b,c;if(this._mouseDown){if(b=ContentEdit.Root.get().focused(),this.tool.requiresElement&&(!b||!b.isMounted()))return;c=null,b&&b.selection&&(c=b.selection()),this.apply(b,c)}return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b}(b.AnchoredComponentUI),b.AnchoredDialogUI=function(a){function b(){b.__super__.constructor.call(this),this._position=[0,0]}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-anchored-dialog"]),this.parent().domElement().appendChild(this._domElement),this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"},b.prototype.position=function(a){return void 0===a?this._position.slice():(this._position=a.slice(),this.isMounted()?(this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"):void 0)},b.prototype._contain=function(){var a,b,c;if(this.isMounted())return c=this._domElement.getBoundingClientRect(),a=c.width/2+5,b=document.documentElement.clientWidth||document.body.clientWidth,this._position[0]+a>b&&(this._position[0]=b-a),this._position[0]<a&&(this._position[0]=a),this._position[1]+c.top<5?this._position[1]=Math.abs(c.top)+5:void 0},b}(b.WidgetUI),b.DialogUI=function(a){function b(a){null==a&&(a=""),b.__super__.constructor.call(this),this._busy=!1,this._caption=a}return g(b,a),b.prototype.busy=function(a){if(void 0===a)return this._busy;if(this._busy!==a&&(this._busy=a,this.isMounted()))return this._busy?ContentEdit.addCSSClass(this._domElement,"ct-dialog--busy"):ContentEdit.removeCSSClass(this._domElement,"ct-dialog--busy")},b.prototype.caption=function(a){return void 0===a?this._caption:(this._caption=a,this._domCaption.textContent=ContentEdit._(a))},b.prototype.mount=function(){var a,b,c;return document.activeElement&&(document.activeElement.blur(),window.getSelection().removeAllRanges()),a=["ct-widget","ct-dialog"],this._busy&&a.push("ct-dialog--busy"),this._domElement=this.constructor.createDiv(a),this.parent().domElement().appendChild(this._domElement),c=this.constructor.createDiv(["ct-dialog__header"]),this._domElement.appendChild(c),this._domCaption=this.constructor.createDiv(["ct-dialog__caption"]),c.appendChild(this._domCaption),this.caption(this._caption),this._domClose=this.constructor.createDiv(["ct-dialog__close"]),c.appendChild(this._domClose),b=this.constructor.createDiv(["ct-dialog__body"]),this._domElement.appendChild(b),this._domView=this.constructor.createDiv(["ct-dialog__view"]),b.appendChild(this._domView),this._domControls=this.constructor.createDiv(["ct-dialog__controls"]),b.appendChild(this._domControls),this._domBusy=this.constructor.createDiv(["ct-dialog__busy"]),this._domElement.appendChild(this._domBusy)},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBusy=null,this._domCaption=null,this._domClose=null,this._domControls=null,this._domView=null},b.prototype._addDOMEventListeners=function(){return this._handleEscape=function(a){return function(b){if(!a._busy)return 27===b.keyCode?a.dispatchEvent(a.createEvent("cancel")):void 0}}(this),document.addEventListener("keyup",this._handleEscape),this._domClose.addEventListener("click",function(a){return function(b){if(b.preventDefault(),!a._busy)return a.dispatchEvent(a.createEvent("cancel"))}}(this))},b.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keyup",this._handleEscape)},b}(b.WidgetUI),b.ImageDialog=function(a){function d(){d.__super__.constructor.call(this,"Insert image"),this._cropMarks=null,this._imageURL=null,this._imageSize=null,this._progress=0,this._state="empty",b.IMAGE_UPLOADER&&b.IMAGE_UPLOADER(this)}return g(d,a),d.prototype.cropRegion=function(){return this._cropMarks?this._cropMarks.region():[0,0,1,1]},d.prototype.hideImages=function(){if(this._domImagesContainer)return this._domImagesContainer.parentNode.removeChild(this._domImagesContainer)},d.prototype.showImages=function(){var a,b,c,d,e,f,g,h;if(this.hideImages,this.images){for(this._domImagesContainer=this.constructor.createDiv(["ct-image-dialog-images__container"]),this._domView.appendChild(this._domImagesContainer),d=this.constructor.createDiv(["ct-image-dialog-images"]),this._domImagesContainer.appendChild(d),g=this.images,h=[],e=0,f=g.length;e<f;e++)a=g[e],c=this.constructor.createDiv(["ct-image-dialog-images__image"]),b=new Image,b.src=a,c.appendChild(b),d.appendChild(c),h.push(b.addEventListener("click",function(a){return function(b){return a._imageSelected={src:b.target.attributes[0].value,size:[b.target.naturalWidth,b.target.naturalHeight]},a.populate(a._imageSelected.src,a._imageSelected.size)}}(this)));return h}},d.prototype.addImages=function(a){return this.images=a},d.prototype.addCropMarks=function(){if(!this._cropMarks)return this._cropMarks=new c(this._imageSize),this._cropMarks.mount(this._domView),ContentEdit.addCSSClass(this._domCrop,"ct-control--active")},d.prototype.clear=function(){return this._domImage&&(this._domImage.parentNode.removeChild(this._domImage),this._domImage=null),this._imageURL=null,this._imageSize=null,this.state("empty"),this.showImages()},d.prototype.mount=function(){var a,b,c;return d.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog"),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--empty"),ContentEdit.addCSSClass(this._domView,"ct-image-dialog__view"),c=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(c),b=this.constructor.createDiv(["ct-progress-bar"]),c.appendChild(b),this._domProgress=this.constructor.createDiv(["ct-progress-bar__progress"]),b.appendChild(this._domProgress),a=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(a),this._domUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--upload"]),this._domUpload.textContent=ContentEdit._("Upload"),a.appendChild(this._domUpload),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-image-dialog__file-upload"),this._domInput.setAttribute("name","file"),this._domInput.setAttribute("type","file"),this._domInput.setAttribute("accept","image/*"),this._domUpload.appendChild(this._domInput),this._domInsert=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert"]),this._domInsert.textContent=ContentEdit._("Insert"),a.appendChild(this._domInsert),this._domCancelUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--cancel"]),this._domCancelUpload.textContent=ContentEdit._("Cancel"),a.appendChild(this._domCancelUpload),this._domClear=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--clear"]),this._domClear.textContent=ContentEdit._("Clear"),a.appendChild(this._domClear),this._addDOMEventListeners(),this.dispatchEvent(this.createEvent("imageuploader.mount")),this.showImages()},d.prototype.populate=function(a,b){return this.hideImages(),this._imageURL=a,this._imageSize=b,this._domImage||(this._domImage=this.constructor.createDiv(["ct-image-dialog__image"]),this._domView.appendChild(this._domImage)),this._domImage.style["background-image"]="url("+a+")",this.state("populated")},d.prototype.progress=function(a){return void 0===a?this._progress:(this._progress=a,this.isMounted()?this._domProgress.style.width=this._progress+"%":void 0)},d.prototype.removeCropMarks=function(){if(this._cropMarks)return this._cropMarks.unmount(),this._cropMarks=null,ContentEdit.removeCSSClass(this._domCrop,"ct-control--active")},d.prototype.save=function(a,b,c){return a?this.dispatchEvent(this.createEvent("save",{imageURL:a,imageSize:b,imageAttrs:c})):this._imageSelected?this.dispatchEvent(this.createEvent("save",{imageURL:this._imageSelected.src,imageSize:this._imageSelected.size})):void 0},d.prototype.state=function(a){var b;if(void 0===a)return this._state;if(this._state!==a&&(b=this._state,this._state=a,this.isMounted()))return ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--"+this._state),ContentEdit.removeCSSClass(this._domElement,"ct-image-dialog--"+b)},d.prototype.unmount=function(){return d.__super__.unmount.call(this),this._domCancelUpload=null,this._domClear=null,this._domCrop=null,this._domInput=null,this._domInsert=null,this._domProgress=null,this._domRotateCCW=null,this._domRotateCW=null,this._domUpload=null,this.dispatchEvent(this.createEvent("imageuploader.unmount"))},d.prototype._addDOMEventListeners=function(){return d.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("change",function(a){return function(b){var c;if(c=b.target.files[0])return b.target.value="",b.target.value&&(b.target.type="text",b.target.type="file"),a.dispatchEvent(a.createEvent("imageuploader.fileready",{file:c}))}}(this)),this._domCancelUpload.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("imageuploader.cancelupload"))}}(this)),this._domClear.addEventListener("click",function(a){return function(b){return a.removeCropMarks(),a.dispatchEvent(a.createEvent("imageuploader.clear"))}}(this)),this._domInsert.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("imageuploader.save"))}}(this))},d}(b.DialogUI),c=function(a){function c(a){c.__super__.constructor.call(this),this._bounds=null,this._dragging=null,this._draggingOrigin=null,this._imageSize=a}return g(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-crop-marks"]),this._domClipper=this.constructor.createDiv(["ct-crop-marks__clipper"]),this._domElement.appendChild(this._domClipper),this._domRulers=[this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--top-left"]),this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--bottom-right"])],this._domClipper.appendChild(this._domRulers[0]),this._domClipper.appendChild(this._domRulers[1]),this._domHandles=[this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--top-left"]),this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--bottom-right"])],this._domElement.appendChild(this._domHandles[0]),this._domElement.appendChild(this._domHandles[1]),c.__super__.mount.call(this,a,b),this._fit(a)},c.prototype.region=function(){return[parseFloat(this._domHandles[0].style.top)/this._bounds[1],parseFloat(this._domHandles[0].style.left)/this._bounds[0],parseFloat(this._domHandles[1].style.top)/this._bounds[1],parseFloat(this._domHandles[1].style.left)/this._bounds[0]]},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domClipper=null,this._domHandles=null,this._domRulers=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domHandles[0].addEventListener("mousedown",function(a){return function(b){if(0===b.button)return a._startDrag(0,b.clientY,b.clientX)}}(this)),this._domHandles[1].addEventListener("mousedown",function(a){return function(b){if(0===b.button)return a._startDrag(1,b.clientY,b.clientX)}}(this))},c.prototype._drag=function(a,c){var d,e,f,g,h;if(null!==this._dragging)return ContentSelect.Range.unselectAll(),g=a-this._draggingOrigin[1],f=c-this._draggingOrigin[0],d=this._bounds[1],c=0,a=0,h=this._bounds[0],e=Math.min(Math.min(b.MIN_CROP,d),h),0===this._dragging?(d=parseInt(this._domHandles[1].style.top)-e,h=parseInt(this._domHandles[1].style.left)-e):(c=parseInt(this._domHandles[0].style.left)+e,a=parseInt(this._domHandles[0].style.top)+e),g=Math.min(Math.max(a,g),d),f=Math.min(Math.max(c,f),h),this._domHandles[this._dragging].style.top=g+"px",this._domHandles[this._dragging].style.left=f+"px",this._domRulers[this._dragging].style.top=g+"px",this._domRulers[this._dragging].style.left=f+"px"},c.prototype._fit=function(a){var b,c,d,e,f,g,h,i;return f=a.getBoundingClientRect(),i=f.width/this._imageSize[0],c=f.height/this._imageSize[1],e=Math.min(i,c),h=e*this._imageSize[0],b=e*this._imageSize[1],d=(f.width-h)/2,g=(f.height-b)/2,this._domElement.style.width=h+"px",this._domElement.style.height=b+"px",this._domElement.style.top=g+"px",this._domElement.style.left=d+"px",this._domHandles[0].style.top="0px",this._domHandles[0].style.left="0px",this._domHandles[1].style.top=b+"px",this._domHandles[1].style.left=h+"px",this._domRulers[0].style.top="0px",this._domRulers[0].style.left="0px",this._domRulers[1].style.top=b+"px",this._domRulers[1].style.left=h+"px",this._bounds=[h,b]},c.prototype._startDrag=function(a,b,c){var d;return d=this._domHandles[a],this._dragging=a,this._draggingOrigin=[c-parseInt(d.style.left),b-parseInt(d.style.top)],this._onMouseMove=function(a){return function(b){return a._drag(b.clientY,b.clientX)}}(this),document.addEventListener("mousemove",this._onMouseMove),this._onMouseUp=function(a){return function(b){return a._stopDrag()}}(this),document.addEventListener("mouseup",this._onMouseUp)},c.prototype._stopDrag=function(){return document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._dragging=null,this._draggingOrigin=null},c}(b.AnchoredComponentUI),b.LinkDialog=function(a){function b(a,c){null==a&&(a=""),null==c&&(c=""),b.__super__.constructor.call(this),this._href=a,this._target=c}var c;return g(b,a),c="_blank",b.prototype.mount=function(){return b.__super__.mount.call(this),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-anchored-dialog__input"),this._domInput.setAttribute("name","href"),this._domInput.setAttribute("placeholder",ContentEdit._("Enter a link")+"..."),this._domInput.setAttribute("type","text"),this._domInput.setAttribute("value",this._href),this._domElement.appendChild(this._domInput),this._domTargetButton=this.constructor.createDiv(["ct-anchored-dialog__target-button"]),this._domElement.appendChild(this._domTargetButton),this._target===c&&ContentEdit.addCSSClass(this._domTargetButton,"ct-anchored-dialog__target-button--active"),this._domButton=this.constructor.createDiv(["ct-anchored-dialog__button"]),this._domElement.appendChild(this._domButton),this._addDOMEventListeners()},b.prototype.save=function(){var a;return this.isMounted()?(a={href:this._domInput.value.trim()},this._target&&(a.target=this._target),this.dispatchEvent(this.createEvent("save",a))):void this.dispatchEvent(this.createEvent("save"))},b.prototype.show=function(){if(b.__super__.show.call(this),this._domInput.focus(),this._href)return this._domInput.select()},b.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),b.__super__.unmount.call(this),this._domButton=null,this._domInput=null},b.prototype._addDOMEventListeners=function(){return this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domTargetButton.addEventListener("click",function(a){return function(b){return b.preventDefault(),a._target===c?(a._target="",ContentEdit.removeCSSClass(a._domTargetButton,"ct-anchored-dialog__target-button--active")):(a._target=c,ContentEdit.addCSSClass(a._domTargetButton,"ct-anchored-dialog__target-button--active"))}}(this)),this._domButton.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.save()}}(this))},b}(b.AnchoredDialogUI),b.PropertiesDialog=function(c){function e(a){var b;this.element=a,e.__super__.constructor.call(this,"Properties"),this._attributeUIs=[],this._focusedAttributeUI=null,this._styleUIs=[],this._supportsCoding=this.element.content,"ListItem"!==(b=this.element.type())&&"TableCell"!==b||(this._supportsCoding=!0)}return g(e,c),e.prototype.caption=function(a){return void 0===a?this._caption:(this._caption=a,this._domCaption.textContent=ContentEdit._(a)+": "+this.element.tagName())},e.prototype.changedAttributes=function(){var a,c,d,e,f,g,h,i,j,k;for(c={},d={},j=this._attributeUIs,h=0,i=j.length;h<i;h++)a=j[h],e=a.name(),g=a.value(),""!==e&&(c[e.toLowerCase()]=!0,this.element.attr(e)!==g&&(d[e]=g));f=b.getRestrictedAtributes(this.element.tagName()),k=this.element.attributes();for(e in k)g=k[e],f&&-1!==f.indexOf(e.toLowerCase())||void 0===c[e]&&(d[e]=null);return d},e.prototype.changedStyles=function(){var a,b,c,d,e,f;for(c={},f=this._styleUIs,d=0,e=f.length;d<e;d++)b=f[d],a=b.style.cssClass(),this.element.hasCSSClass(a)!==b.applied()&&(c[a]=b.applied());return c},e.prototype.getElementInnerHTML=function(){return this._supportsCoding?this.element.content?this.element.content.html():this.element.children[0].content.html():null},e.prototype.mount=function(){var a,c,f,g,h,i,j,k,l,m,n,o,p,q,r;for(e.__super__.mount.call(this),
ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog"),ContentEdit.addCSSClass(this._domView,"ct-properties-dialog__view"),this._domStyles=this.constructor.createDiv(["ct-properties-dialog__styles"]),this._domStyles.setAttribute("data-ct-empty",ContentEdit._("No styles available for this tag")),this._domView.appendChild(this._domStyles),r=b.StylePalette.styles(this.element),n=0,p=r.length;n<p;n++)k=r[n],l=new d(k,this.element.hasCSSClass(k.cssClass())),this._styleUIs.push(l),l.mount(this._domStyles);this._domAttributes=this.constructor.createDiv(["ct-properties-dialog__attributes"]),this._domView.appendChild(this._domAttributes),j=b.getRestrictedAtributes(this.element.tagName()),c=this.element.attributes(),a=[];for(i in c)m=c[i],j&&-1!==j.indexOf(i.toLowerCase())||a.push(i);for(-1===a.indexOf("class")&&a.push("class"),a.sort(),o=0,q=a.length;o<q;o++)i=a[o],m=c[i],void 0===m&&(m=""),this._addAttributeUI(i,m);return this._addAttributeUI("",""),this._domCode=this.constructor.createDiv(["ct-properties-dialog__code"]),this._domView.appendChild(this._domCode),this._domInnerHTML=document.createElement("textarea"),this._domInnerHTML.setAttribute("class","ct-properties-dialog__inner-html"),this._domInnerHTML.setAttribute("name","code"),this._domInnerHTML.value=this.getElementInnerHTML(),this._domCode.appendChild(this._domInnerHTML),g=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(g),this._domStylesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--styles"]),this._domStylesTab.setAttribute("data-ct-tooltip",ContentEdit._("Styles")),g.appendChild(this._domStylesTab),this._domAttributesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--attributes"]),this._domAttributesTab.setAttribute("data-ct-tooltip",ContentEdit._("Attributes")),g.appendChild(this._domAttributesTab),this._domCodeTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--code"]),this._domCodeTab.setAttribute("data-ct-tooltip",ContentEdit._("Code")),g.appendChild(this._domCodeTab),this._supportsCoding||ContentEdit.addCSSClass(this._domCodeTab,"ct-control--muted"),this._domRemoveAttribute=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--remove","ct-control--muted"]),this._domRemoveAttribute.setAttribute("data-ct-tooltip",ContentEdit._("Remove")),g.appendChild(this._domRemoveAttribute),f=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(f),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent=ContentEdit._("Apply"),f.appendChild(this._domApply),h=window.localStorage.getItem("ct-properties-dialog-tab"),"attributes"===h?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--attributes"),ContentEdit.addCSSClass(this._domAttributesTab,"ct-control--active")):"code"===h&&this._supportsCoding?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--code"),ContentEdit.addCSSClass(this._domCodeTab,"ct-control--active")):(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--styles"),ContentEdit.addCSSClass(this._domStylesTab,"ct-control--active")),this._addDOMEventListeners()},e.prototype.save=function(){var a,b;return b=null,this._supportsCoding&&(b=this._domInnerHTML.value),a={changedAttributes:this.changedAttributes(),changedStyles:this.changedStyles(),innerHTML:b},this.dispatchEvent(this.createEvent("save",a))},e.prototype._addAttributeUI=function(c,d){var e,f;return f=this,e=new a(c,d),this._attributeUIs.push(e),e.addEventListener("blur",function(a){var b,c,d;if(f._focusedAttributeUI=null,ContentEdit.addCSSClass(f._domRemoveAttribute,"ct-control--muted"),b=f._attributeUIs.indexOf(this),d=f._attributeUIs.length,""===this.name()&&b<d-1&&(this.unmount(),f._attributeUIs.splice(b,1)),(c=f._attributeUIs[d-1])&&c.name()&&c.value())return f._addAttributeUI("","")}),e.addEventListener("focus",function(a){return f._focusedAttributeUI=this,ContentEdit.removeCSSClass(f._domRemoveAttribute,"ct-control--muted")}),e.addEventListener("namechange",function(a){var d,e,g,h,i,j,k;for(d=f.element,c=this.name().toLowerCase(),g=b.getRestrictedAtributes(d.tagName()),h=!0,g&&-1!==g.indexOf(c)&&(h=!1),k=f._attributeUIs,i=0,j=k.length;i<j;i++)e=k[i],""!==c&&e!==this&&e.name().toLowerCase()===c&&(h=!1);return this.valid(h),h?ContentEdit.removeCSSClass(f._domApply,"ct-control--muted"):ContentEdit.addCSSClass(f._domApply,"ct-control--muted")}),e.mount(this._domAttributes),e},e.prototype._addDOMEventListeners=function(){var a,b;return e.__super__._addDOMEventListeners.call(this),a=function(a){return function(b){var c,d,e,f,g,h;for(f=["attributes","code","styles"],g=0,h=f.length;g<h;g++)(d=f[g])!==b&&(e=d.charAt(0).toUpperCase()+d.slice(1),ContentEdit.removeCSSClass(a._domElement,"ct-properties-dialog--"+d),ContentEdit.removeCSSClass(a["_dom"+e+"Tab"],"ct-control--active"));return c=b.charAt(0).toUpperCase()+b.slice(1),ContentEdit.addCSSClass(a._domElement,"ct-properties-dialog--"+b),ContentEdit.addCSSClass(a["_dom"+c+"Tab"],"ct-control--active"),window.localStorage.setItem("ct-properties-dialog-tab",b)}}(this),this._domStylesTab.addEventListener("mousedown",function(b){return function(){return a("styles")}}()),this._domAttributesTab.addEventListener("mousedown",function(b){return function(){return a("attributes")}}()),this._supportsCoding&&this._domCodeTab.addEventListener("mousedown",function(b){return function(){return a("code")}}()),this._domRemoveAttribute.addEventListener("mousedown",function(a){return function(b){var c,d;if(b.preventDefault(),a._focusedAttributeUI&&(c=a._attributeUIs.indexOf(a._focusedAttributeUI),d=c===a._attributeUIs.length-1,a._focusedAttributeUI.unmount(),a._attributeUIs.splice(c,1),d))return a._addAttributeUI("","")}}(this)),b=function(a){return function(b){try{return new HTMLString.String(a._domInnerHTML.value),ContentEdit.removeCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")}catch(b){return ContentEdit.addCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted")}}}(this),this._domInnerHTML.addEventListener("input",b),this._domInnerHTML.addEventListener("propertychange",b),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},e}(b.DialogUI),d=function(a){function b(a,c){this.style=a,b.__super__.constructor.call(this),this._applied=c}return g(b,a),b.prototype.applied=function(a){if(void 0===a)return this._applied;if(this._applied!==a)return this._applied=a,this._applied?ContentEdit.addCSSClass(this._domElement,"ct-section--applied"):ContentEdit.removeCSSClass(this._domElement,"ct-section--applied")},b.prototype.mount=function(a,c){var d;return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-section"]),this._applied&&ContentEdit.addCSSClass(this._domElement,"ct-section--applied"),d=this.constructor.createDiv(["ct-section__label"]),d.textContent=this.style.name(),this._domElement.appendChild(d),this._domElement.appendChild(this.constructor.createDiv(["ct-section__switch"])),b.__super__.mount.call(this,a,c)},b.prototype._addDOMEventListeners=function(){var a;return a=function(a){return function(b){return b.preventDefault(),a.applied()?a.applied(!1):a.applied(!0)}}(this),this._domElement.addEventListener("click",a)},b}(b.AnchoredComponentUI),a=function(a){function b(a,c){b.__super__.constructor.call(this),this._initialName=a,this._initialValue=c}return g(b,a),b.prototype.name=function(){return this._domName.value.trim()},b.prototype.value=function(){return this._domValue.value.trim()},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-attribute"]),this._domName=document.createElement("input"),this._domName.setAttribute("class","ct-attribute__name"),this._domName.setAttribute("name","name"),this._domName.setAttribute("placeholder",ContentEdit._("Name")),this._domName.setAttribute("type","text"),this._domName.setAttribute("value",this._initialName),this._domElement.appendChild(this._domName),this._domValue=document.createElement("input"),this._domValue.setAttribute("class","ct-attribute__value"),this._domValue.setAttribute("name","value"),this._domValue.setAttribute("type","text"),this._domValue.setAttribute("value",this._initialValue),this._domElement.appendChild(this._domValue),b.__super__.mount.call(this,a,c)},b.prototype.valid=function(a){return a?ContentEdit.removeCSSClass(this._domName,"ct-attribute__name--invalid"):ContentEdit.addCSSClass(this._domName,"ct-attribute__name--invalid")},b.prototype._addDOMEventListeners=function(){return this._domName.addEventListener("blur",function(a){return function(){var b,c,d;if(b=a.name(),c=a._domElement.nextSibling,a.dispatchEvent(a.createEvent("blur")),""===b&&c)return d=c.querySelector(".ct-attribute__name"),d.focus()}}(this)),this._domName.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domName.addEventListener("input",function(a){return function(){return a.dispatchEvent(a.createEvent("namechange"))}}(this)),this._domName.addEventListener("keydown",function(a){return function(b){if(13===b.keyCode)return a._domValue.focus()}}(this)),this._domValue.addEventListener("blur",function(a){return function(){return a.dispatchEvent(a.createEvent("blur"))}}(this)),this._domValue.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domValue.addEventListener("keydown",function(a){return function(b){var c,d;if(13===b.keyCode||9===b.keyCode&&!b.shiftKey)return b.preventDefault(),c=a._domElement.nextSibling,c||(a._domValue.blur(),c=a._domElement.nextSibling),c?(d=c.querySelector(".ct-attribute__name"),d.focus()):void 0}}(this))},b}(b.AnchoredComponentUI),b.TableDialog=function(a){function b(a){this.table=a,this.table?b.__super__.constructor.call(this,"Update table"):b.__super__.constructor.call(this,"Insert table")}return g(b,a),b.prototype.mount=function(){var a,c,d,e,f,g,h;return b.__super__.mount.call(this),a={columns:3,foot:!1,head:!0},this.table&&(a={columns:this.table.firstSection().children[0].children.length,foot:this.table.tfoot(),head:this.table.thead()}),ContentEdit.addCSSClass(this._domElement,"ct-table-dialog"),ContentEdit.addCSSClass(this._domView,"ct-table-dialog__view"),h=["ct-section"],a.head&&h.push("ct-section--applied"),this._domHeadSection=this.constructor.createDiv(h),this._domView.appendChild(this._domHeadSection),f=this.constructor.createDiv(["ct-section__label"]),f.textContent=ContentEdit._("Table head"),this._domHeadSection.appendChild(f),this._domHeadSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domHeadSection.appendChild(this._domHeadSwitch),this._domBodySection=this.constructor.createDiv(["ct-section","ct-section--applied","ct-section--contains-input"]),this._domView.appendChild(this._domBodySection),c=this.constructor.createDiv(["ct-section__label"]),c.textContent=ContentEdit._("Table body (columns)"),this._domBodySection.appendChild(c),this._domBodyInput=document.createElement("input"),this._domBodyInput.setAttribute("class","ct-section__input"),this._domBodyInput.setAttribute("maxlength","2"),this._domBodyInput.setAttribute("name","columns"),this._domBodyInput.setAttribute("type","text"),this._domBodyInput.setAttribute("value",a.columns),this._domBodySection.appendChild(this._domBodyInput),g=["ct-section"],a.foot&&g.push("ct-section--applied"),this._domFootSection=this.constructor.createDiv(g),this._domView.appendChild(this._domFootSection),e=this.constructor.createDiv(["ct-section__label"]),e.textContent=ContentEdit._("Table foot"),this._domFootSection.appendChild(e),this._domFootSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domFootSection.appendChild(this._domFootSwitch),d=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(d),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent="Apply",d.appendChild(this._domApply),this._addDOMEventListeners()},b.prototype.save=function(){var a,b,c;return b=this._domFootSection.getAttribute("class"),c=this._domHeadSection.getAttribute("class"),a={columns:parseInt(this._domBodyInput.value),foot:b.indexOf("ct-section--applied")>-1,head:c.indexOf("ct-section--applied")>-1},this.dispatchEvent(this.createEvent("save",a))},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBodyInput=null,this._domBodySection=null,this._domApply=null,this._domHeadSection=null,this._domHeadSwitch=null,this._domFootSection=null,this._domFootSwitch=null},b.prototype._addDOMEventListeners=function(){var a;return b.__super__._addDOMEventListeners.call(this),a=function(a){return a.preventDefault(),this.getAttribute("class").indexOf("ct-section--applied")>-1?ContentEdit.removeCSSClass(this,"ct-section--applied"):ContentEdit.addCSSClass(this,"ct-section--applied")},this._domHeadSection.addEventListener("click",a),this._domFootSection.addEventListener("click",a),this._domBodySection.addEventListener("click",function(a){return function(b){return a._domBodyInput.focus()}}(this)),this._domBodyInput.addEventListener("input",function(a){return function(b){var c;return c=/^[1-9]\d{0,1}$/.test(b.target.value),c?(ContentEdit.removeCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")):(ContentEdit.addCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted"))}}(this)),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},b}(b.DialogUI),b.VideoDialog=function(a){function c(){c.__super__.constructor.call(this,"Insert video")}return g(c,a),c.prototype.clearPreview=function(){if(this._domPreview)return this._domPreview.parentNode.removeChild(this._domPreview),this._domPreview=void 0},c.prototype.mount=function(){var a;return c.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-video-dialog"),ContentEdit.addCSSClass(this._domView,"ct-video-dialog__preview"),a=this.constructor.createDiv(["ct-control-group"]),this._domControls.appendChild(a),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-video-dialog__input"),this._domInput.setAttribute("name","url"),this._domInput.setAttribute("placeholder",ContentEdit._("Paste YouTube or Vimeo URL")+"..."),this._domInput.setAttribute("type","text"),a.appendChild(this._domInput),this._domButton=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert","ct-control--muted"]),this._domButton.textContent=ContentEdit._("Insert"),a.appendChild(this._domButton),this._addDOMEventListeners()},c.prototype.preview=function(a){return this.clearPreview(),this._domPreview=document.createElement("iframe"),this._domPreview.setAttribute("frameborder","0"),this._domPreview.setAttribute("height","100%"),this._domPreview.setAttribute("src",a),this._domPreview.setAttribute("width","100%"),this._domView.appendChild(this._domPreview)},c.prototype.save=function(){var a,c;return c=this._domInput.value.trim(),a=b.getEmbedVideoURL(c),a?this.dispatchEvent(this.createEvent("save",{url:a})):this.dispatchEvent(this.createEvent("save",{url:c}))},c.prototype.show=function(){return c.__super__.show.call(this),this._domInput.focus()},c.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),c.__super__.unmount.call(this),this._domButton=null,this._domInput=null,this._domPreview=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("input",function(a){return function(c){var d;return c.target.value?ContentEdit.removeCSSClass(a._domButton,"ct-control--muted"):ContentEdit.addCSSClass(a._domButton,"ct-control--muted"),a._updatePreviewTimeout&&clearTimeout(a._updatePreviewTimeout),d=function(){var c,d;return d=a._domInput.value.trim(),c=b.getEmbedVideoURL(d),c?a.preview(c):a.clearPreview()},a._updatePreviewTimeout=setTimeout(d,500)}}(this)),this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domButton.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domButton.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},c}(b.DialogUI),b.HTMLCleaner=function(){function a(a,b){this.tagWhitelist=a||this.constructor.DEFAULT_TAG_WHITELIST,this.attributeWhitelist=b||this.constructor.DEFAULT_ATTRIBUTE_WHITELIST}return a.DEFAULT_ATTRIBUTE_WHITELIST={a:["href"],td:["colspan"]},a.DEFAULT_TAG_WHITELIST=["a","address","b","blockquote","code","del","em","h1","h2","h3","h4","h5","h6","i","ins","li","ol","p","pre","strong","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","#text"],a.NO_CONTENT_TAGS=["head","meta","style","script","title"],a.prototype.clean=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;for(j=document.implementation.createHTMLDocument(),m=j.createElement("div"),m.innerHTML=a,k=function(){var a,b,c,e;for(c=m.childNodes,e=[],a=0,b=c.length;a<b;a++)d=c[a],e.push(d);return e}();k.length>0;)if(f=k.shift(),g=f.nodeName.toLowerCase(),this.tagWhitelist.indexOf(g)<0){if(this.constructor.NO_CONTENT_TAGS.indexOf(g)>-1){f.remove();continue}for(r=f.childNodes,n=0,p=r.length;n<p;n++)(e=r[n])&&(e=e.cloneNode(!0),e.nodeName.toLowerCase(),f.parentNode.insertBefore(e,f),k.push(e));f.remove()}else if("#text"===g||""!==f.textContent.trim()){if("td"!==g&&"th"!==g&&"li"!==g||f.querySelector("p")&&(f.innerHTML=f.textContent),f.attributes)for(i=this.attributeWhitelist[g]||[],h=function(){var a,c,d,e;for(d=f.attributes,e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}(),o=0,q=h.length;o<q;o++)c=h[o],i.indexOf(c.name.toLowerCase())<0?f.removeAttribute(c.name):"href"===c.name.toLowerCase()&&(l=f.getAttribute(c.name),l.startsWith("javascript:"))&&f.removeAttribute(c.name);k.push.apply(k,function(){var a,b,c,e;for(c=f.childNodes,e=[],a=0,b=c.length;a<b;a++)d=c[a],e.push(d);return e}())}else""===f.textContent||f.parentNode===m?f.remove():f.parentNode.replaceChild(j.createTextNode(" "),f);return m.innerHTML},a}(),e=function(a){function c(){c.__super__.constructor.call(this),this.history=null,this._state="dormant",this._busy=!1,this._namingProp=null,this._fixtureTest=function(a){return a.hasAttribute("data-fixture")},this._regionQuery=null,this._domRegions=null,this._regions={},this._orderedRegions=[],this._rootLastModified=null,this._regionsLastModified={},this._ignition=null,this._inspector=null,this._toolbox=null,this._emptyRegionsAllowed=!1}return g(c,a),c.prototype.ctrlDown=function(){return this._ctrlDown},c.prototype.domRegions=function(){return this._domRegions},c.prototype.getState=function(){return this._state},c.prototype.ignition=function(){return this._ignition},c.prototype.inspector=function(){return this._inspector},c.prototype.isDormant=function(){return"dormant"===this._state},c.prototype.isReady=function(){return"ready"===this._state},c.prototype.isEditing=function(){return"editing"===this._state},c.prototype.orderedRegions=function(){var a;return function(){var b,c,d,e;for(d=this._orderedRegions,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(this._regions[a]);return e}.call(this)},c.prototype.regions=function(){return this._regions},c.prototype.shiftDown=function(){return this._shiftDown},c.prototype.toolbox=function(){return this._toolbox},c.prototype.busy=function(a){return void 0===a?this._busy:(this._busy=a,this._ignition?this._ignition.busy(a):void 0)},c.prototype.createPlaceholderElement=function(a){return new ContentEdit.Text("p",{},"")},c.prototype.init=function(a,c,d,e){return null==c&&(c="id"),null==d&&(d=null),null==e&&(e=!0),this._namingProp=c,d&&(this._fixtureTest=d),this.mount(),e&&(this._ignition=new b.IgnitionUI,this.attach(this._ignition),this._ignition.addEventListener("edit",function(a){return function(b){return b.preventDefault(),a.start(),a._ignition.state("editing")}}(this)),this._ignition.addEventListener("confirm",function(a){return function(b){if(b.preventDefault(),"editing"===a._ignition.state())return a._ignition.state("ready"),a.stop(!0)}}(this)),this._ignition.addEventListener("cancel",function(a){return function(b){if(b.preventDefault(),"editing"===a._ignition.state())return a.stop(!1),a.isEditing()?a._ignition.state("editing"):a._ignition.state("ready")}}(this))),this._toolbox=new b.ToolboxUI(b.DEFAULT_TOOLS),this.attach(this._toolbox),this._inspector=new b.InspectorUI,this.attach(this._inspector),this._state="ready",this._handleDetach=function(a){return function(b){return a._preventEmptyRegions()}}(this),this._handleClipboardPaste=function(a){return function(b,c){return null,c.clipboardData?void(c.clipboardData.getData("text/html")&&"PreText"!==b.type()?a.pasteHTML(b,c.clipboardData.getData("text/html")):a.pasteText(b,c.clipboardData.getData("text/plain"))):window.clipboardData?(window.clipboardData.getData("TEXT"),a.pasteText(b,window.clipboardData.getData("TEXT"))):void 0}}(this),this._handleNextRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i;if(f=a.orderedRegions(),!((e=f.indexOf(b))>=f.length-1)){for(b=f[e+1],d=null,i=b.descendants(),g=0,h=i.length;g<h;g++)if(c=i[g],void 0!==c.content){d=c;break}return d?(d.focus(),void d.selection(new ContentSelect.Range(0,0))):ContentEdit.Root.get().trigger("next-region",b)}}}(this),this._handlePreviousRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i,j;if(h=a.orderedRegions(),!((f=h.indexOf(b))<=0)){for(b=h[f-1],e=null,d=b.descendants(),d.reverse(),i=0,j=d.length;i<j;i++)if(c=d[i],void 0!==c.content){e=c;break}return e?(g=e.content.length(),e.focus(),void e.selection(new ContentSelect.Range(g,g))):ContentEdit.Root.get().trigger("previous-region",b)}}}(this),ContentEdit.Root.get().bind("detach",this._handleDetach),ContentEdit.Root.get().bind("paste",this._handleClipboardPaste),ContentEdit.Root.get().bind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().bind("previous-region",this._handlePreviousRegionTransition),this.syncRegions(a)},c.prototype.destroy=function(){return ContentEdit.Root.get().unbind("detach",this._handleDetach),ContentEdit.Root.get().unbind("paste",this._handleClipboardPaste),ContentEdit.Root.get().unbind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().unbind("previous-region",this._handlePreviousRegionTransition),this.removeEventListener(),this.unmount(),this._children=[]},c.prototype.highlightRegions=function(a){var b,c,d,e,f;for(e=this._domRegions,f=[],c=0,d=e.length;c<d;c++)b=e[c],a?f.push(ContentEdit.addCSSClass(b,"ct--highlight")):f.push(ContentEdit.removeCSSClass(b,"ct--highlight"));return f},c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-app"]),document.body.insertBefore(this._domElement,null),this._addDOMEventListeners()},c.prototype.unmount=function(){var a,b,c,d;if(this.isMounted()){for(d=this._children,b=0,c=d.length;b<c;b++)a=d[b],a.unmount();return this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,this._removeDOMEventListeners(),this._ignition=null,this._inspector=null,this._toolbox=null}},c.prototype.pasteHTML=function(a,c){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G;for(w=ContentEdit.TagNames.get(),u=document.implementation.createHTMLDocument(),A=u.createElement("div"),A.innerHTML=b.getHTMLCleaner().clean(c.trim()),f=[],F=A.childNodes,B=0,D=F.length;B<D;B++)(e=F[B])&&("#text"===e.nodeName.toLowerCase()&&""===e.textContent.trim()||f.push(e));if(f.length){if(l=b.INLINE_TAGS.slice(),l.push("#text"),j=f[0].nodeName.toLowerCase(),n=f[f.length-1].nodeName.toLowerCase(),a.isFixed()||l.indexOf(j)>-1&&l.indexOf(n)>-1){if(l.indexOf(j)>-1&&l.indexOf(n)>-1?c=new HTMLString.String(A.innerHTML):(console.log(A.textContent),c=new HTMLString.String(HTMLString.String.encode(A.textContent))),a.content)return v=a.selection(),g=v.get()[0]+c.length(),z=a.content.substring(0,v.get()[0]),y=a.content.substring(v.get()[1]),t=a.content.substring(v.get()[0],v.get()[1]),t.length()&&(d=t.characters[0],x=d.tags(),d.isTag()&&x.shift(),x.length>=1&&(c=c.format.apply(c,[0,c.length()].concat(i.call(x))))),a.content=z.concat(c),a.content=a.content.concat(y,!1),a.updateInnerHTML(),a.taint(),v.set(g,g),void a.selection(v);A.innerHTML="<p>"+c.html()+"</p>"}if(q=a,"Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),s=a.parent(),l.indexOf(j)>-1&&l.indexOf(n)>-1){for(m=A.createElement("p");A.childNodes.length>0;)m.appendChild(A.childNodes[0]);A.appendChild(m)}for(k=0,o=q,G=A.childNodes,C=0,E=G.length;C<E;C++)(p=G[C])&&("#text"===p.nodeName&&""===p.textContent.trim()||(h=w.match(p.nodeName),h===ContentEdit.Static&&(r=document.createElement("p"),r.appendChild(p),p=r,h=ContentEdit.Text),o=h.fromDOMElement(p),s.attach(o,s.children.indexOf(a)+(1+k)),k+=1));return o.focus?o.focus():o.nextSibling()?(o=o.nextSibling().previousWithTest(function(a){if(a.focus)return a}))?o.focus():void 0:(o=o.nextWithTest(function(a){if(a.focus)return a}),o?o.focus():q.focus())}},c.prototype.pasteText=function(a,b){var c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;if(p="PreText"!==a.type()?b.split("\n"):[b],p=p.filter(function(a){return""!==a.trim()})){if(e=HTMLString.String.encode,s=!0,w=a.type(),1===p.length&&(s=!1),"PreText"===w&&(s=!1),a.can("spawn")||(s=!1),s){for("ListItemText"===w?(j=a.parent(),h=a.parent().parent(),g=h.children.indexOf(j)+1):(j=a,"Region"!==j.parent().type()&&(j=a.closest(function(a){return"Region"===a.parent().type()})),h=j.parent(),g=h.children.indexOf(j)+1),f=x=0,y=p.length;x<y;f=++x)n=p[f],n=e(n),"ListItemText"===w?(k=new ContentEdit.ListItem,l=new ContentEdit.ListItemText(n),k.attach(l),m=l):(k=new ContentEdit.Text("p",{},n),m=k),h.attach(k,g+f);return o=m.content.length(),m.focus(),m.selection(new ContentSelect.Range(o,o))}return b=e(b),b=new HTMLString.String(b,"PreText"===w),r=a.selection(),d=r.get()[0]+b.length(),v=a.content.substring(0,r.get()[0]),u=a.content.substring(r.get()[1]),q=a.content.substring(r.get()[0],r.get()[1]),q.length()&&(c=q.characters[0],t=c.tags(),c.isTag()&&t.shift(),t.length>=1&&(b=b.format.apply(b,[0,b.length()].concat(i.call(t))))),a.content=v.concat(b),a.content=a.content.concat(u,!1),a.updateInnerHTML(),a.taint(),r.set(d,d),a.selection(r)}},c.prototype.revert=function(){var a;if(this.dispatchEvent(this.createEvent("revert")))return!(b.CANCEL_MESSAGE&&(a=ContentEdit._(b.CANCEL_MESSAGE),ContentEdit.Root.get().lastModified()>this._rootLastModified&&!window.confirm(a)))&&(this.revertToSnapshot(this.history.goTo(0),!1),!0)},c.prototype.revertToSnapshot=function(a,b){var c,d,e,f,g,h,i,j,k,l;null==b&&(b=!0),d=[],j=this._regions;for(e in j){for(f=j[e],k=f.children,h=0,i=k.length;h<i;h++)c=k[h],c.unmount();void 0!==a.regions[e]?1===f.children.length&&f.children[0].isFixed()?(g=this.constructor.createDiv(),g.innerHTML=a.regions[e],d.push(g.firstElementChild),f.domElement().parentNode.replaceChild(g.firstElementChild,f.domElement())):(d.push(f.domElement()),f.domElement().innerHTML=a.regions[e]):(f.domElement().remove(),delete this._regions[e])}if(this._domRegions=d,b){ContentEdit.Root.get().focused()&&ContentEdit.Root.get().focused().blur(),this._regions={},this.syncRegions(null,!0),ContentEdit.Root.get()._modified=a.rootModified,l=this._regions;for(e in l)f=l[e],a.regionModifieds[e]&&(f._modified=a.regionModifieds[e]);return this.history.replaceRegions(this._regions),this.history.restoreSelection(a),this._inspector.updateTags()}},c.prototype.save=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;if(this.dispatchEvent(this.createEvent("save",{passive:a}))){if(h=ContentEdit.Root.get(),h.focused()&&!a&&h.focused().blur(),h.lastModified()===this._rootLastModified&&a)return void this.dispatchEvent(this.createEvent("saved",{regions:{},passive:a}));c=[],e={},l=this._regions;for(f in l){if(g=l[f],d=g.html(),1===g.children.length&&"Fixture"===!g.type()&&(b=g.children[0],b.content&&!b.content.html()&&(d="")),!a){for(m=g.children,j=0,k=m.length;j<k;j++)b=m[j],b.unmount();1===g.children.length&&g.children[0].isFixed()?(i=this.constructor.createDiv(),i.innerHTML=d,c.push(i.firstElementChild),g.domElement().parentNode.replaceChild(i.firstElementChild,g.domElement())):(c.push(g.domElement()),g.domElement().innerHTML=d)}g.lastModified()!==this._regionsLastModified[f]&&(e[f]=d,this._regionsLastModified[f]=g.lastModified())}return this._domRegions=c,this.dispatchEvent(this.createEvent("saved",{regions:e,passive:a}))}},c.prototype.setRegionOrder=function(a){return this._orderedRegions=a.slice()},c.prototype.start=function(){if(this.dispatchEvent(this.createEvent("start")))return this.busy(!0),this.syncRegions(),this._initRegions(),this._preventEmptyRegions(),this._rootLastModified=ContentEdit.Root.get().lastModified(),this.history=new b.History(this._regions),this.history.watch(),this._state="editing",this._toolbox.show(),this._inspector.show(),this.busy(!1),this.dispatchEvent(this.createEvent("started"))},c.prototype.stop=function(a){var b;if(this.dispatchEvent(this.createEvent("stop",{save:a}))){if(b=ContentEdit.Root.get().focused(),b&&b.isMounted()&&void 0!==b._syncContent&&b._syncContent(),a)this.save();else if(!this.revert())return;return this.history.stopWatching(),this.history=null,this._toolbox.hide(),this._inspector.hide(),this._regions={},this._state="ready",ContentEdit.Root.get().focused()&&this._allowEmptyRegions(function(a){return function(){return ContentEdit.Root.get().focused().blur()}}()),this.dispatchEvent(this.createEvent("stopped"))}},c.prototype.syncRegions=function(a,b){if(a&&(this._regionQuery=a),this._domRegions=[],this._regionQuery&&("string"==typeof this._regionQuery||this._regionQuery instanceof String?this._domRegions=document.querySelectorAll(this._regionQuery):this._domRegions=this._regionQuery),"editing"===this._state&&(this._initRegions(b),this._preventEmptyRegions()),this._ignition)return this._domRegions.length?this._ignition.show():this._ignition.hide()},c.prototype._addDOMEventListeners=function(){return this._handleHighlightOn=function(a){return function(c){var d;if(17!==(d=c.keyCode)&&224!==d&&91!==d&&93!==d||(a._ctrlDown=!0),16===c.keyCode&&!a._ctrlDown){if(a._highlightTimeout)return;return a._shiftDown=!0,void(a._highlightTimeout=setTimeout(function(){return a.highlightRegions(!0)},b.HIGHLIGHT_HOLD_DURATION))}return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),this._handleHighlightOff=function(a){return function(b){var c;return 17===(c=b.keyCode)||224===c||91===c||93===c?void(a._ctrlDown=!1):16===b.keyCode?(a._shiftDown=!1,a._highlightTimeout&&(clearTimeout(a._highlightTimeout),a._highlightTimeout=null),a.highlightRegions(!1)):void 0}}(this),this._handleVisibility=function(a){return function(b){if(!document.hasFocus())return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),document.addEventListener("keydown",this._handleHighlightOn),document.addEventListener("keyup",this._handleHighlightOff),document.addEventListener("visibilitychange",this._handleVisibility),this._handleBeforeUnload=function(a){return function(c){var d;if("editing"===a._state&&b.CANCEL_MESSAGE)return d=ContentEdit._(b.CANCEL_MESSAGE),(c||window.event).returnValue=d,d}}(this),window.addEventListener("beforeunload",this._handleBeforeUnload),this._handleUnload=function(a){return function(b){return a.destroy()}}(this),
window.addEventListener("unload",this._handleUnload)},c.prototype._allowEmptyRegions=function(a){return this._emptyRegionsAllowed=!0,a(),this._emptyRegionsAllowed=!1},c.prototype._preventEmptyRegions=function(){var a,b,c,d,e,f,g,h,i,j,k;if(!this._emptyRegionsAllowed){i=this._regions,k=[];for(d in i){for(f=i[d],c=f.lastModified(),b=!1,j=f.children,g=0,h=j.length;g<h;g++)if(a=j[g],"Static"!==a.type()){b=!0;break}b||(e=this.createPlaceholderElement(f),f.attach(e),k.push(f._modified=c))}return k}},c.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keydown",this._handleHighlightOn),document.removeEventListener("keyup",this._handleHighlightOff),window.removeEventListener("beforeunload",this._handleBeforeUnload),window.removeEventListener("unload",this._handleUnload)},c.prototype._initRegions=function(a){var b,c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=!1),d={},c=[],this._orderedRegions=[],j=this._domRegions,e=h=0,i=j.length;h<i;e=++h)b=j[e],g=b.getAttribute(this._namingProp),g||(g=e),d[g]=!0,this._orderedRegions.push(g),this._regions[g]&&this._regions[g].domElement()===b||(this._fixtureTest(b)?this._regions[g]=new ContentEdit.Fixture(b):this._regions[g]=new ContentEdit.Region(b),c.push(this._regions[g].domElement()),a||(this._regionsLastModified[g]=this._regions[g].lastModified()));this._domRegions=c,k=this._regions,l=[];for(g in k)k[g],d[g]||(delete this._regions[g],delete this._regionsLastModified[g],f=this._orderedRegions.indexOf(g),f>-1?l.push(this._orderedRegions.splice(f,1)):l.push(void 0));return l},c}(b.ComponentUI),b.EditorApp=function(){function a(){}var c;return c=null,a.get=function(){var a;return a=b.EditorApp.getCls(),null!=c?c:c=new a},a.getCls=function(){return e},a}(),b.History=function(){function a(a){this._lastSnapshotTaken=null,this._regions={},this.replaceRegions(a),this._snapshotIndex=-1,this._snapshots=[],this._store()}return a.prototype.canRedo=function(){return this._snapshotIndex<this._snapshots.length-1},a.prototype.canUndo=function(){return this._snapshotIndex>0},a.prototype.index=function(){return this._snapshotIndex},a.prototype.length=function(){return this._snapshots.length},a.prototype.snapshot=function(){return this._snapshots[this._snapshotIndex]},a.prototype.goTo=function(a){return this._snapshotIndex=Math.min(this._snapshots.length-1,Math.max(0,a)),this.snapshot()},a.prototype.redo=function(){return this.goTo(this._snapshotIndex+1)},a.prototype.replaceRegions=function(a){var b,c,d;this._regions={},d=[];for(b in a)c=a[b],d.push(this._regions[b]=c);return d},a.prototype.restoreSelection=function(a){var b,c;if(a.selected)return c=this._regions[a.selected.region],b=c.descendants()[a.selected.element],b.focus(),b.selection&&a.selected.selection?b.selection(a.selected.selection):void 0},a.prototype.stopWatching=function(){if(this._watchInterval&&clearInterval(this._watchInterval),this._delayedStoreTimeout)return clearTimeout(this._delayedStoreTimeout)},a.prototype.undo=function(){return this.goTo(this._snapshotIndex-1)},a.prototype.watch=function(){var a;return this._lastSnapshotTaken=Date.now(),a=function(a){return function(){var b,c;if(null!==(c=ContentEdit.Root.get().lastModified())&&c>a._lastSnapshotTaken){if(a._delayedStoreRequested===c)return;return a._delayedStoreTimeout&&clearTimeout(a._delayedStoreTimeout),b=function(){return a._lastSnapshotTaken=c,a._store()},a._delayedStoreRequested=c,a._delayedStoreTimeout=setTimeout(b,500)}}}(this),this._watchInterval=setInterval(a,50)},a.prototype._store=function(){var a,b,c,d,e,f,g;e={regions:{},regionModifieds:{},rootModified:ContentEdit.Root.get().lastModified(),selected:null},f=this._regions;for(b in f)d=f[b],e.regions[b]=d.html(),e.regionModifieds[b]=d.lastModified();if(a=ContentEdit.Root.get().focused()){if(e.selected={},!(d=a.closest(function(a){return"Region"===a.type()||"Fixture"===a.type()})))return;g=this._regions;for(b in g)if(c=g[b],d===c){e.selected.region=b;break}e.selected.element=d.descendants().indexOf(a),a.selection&&(e.selected.selection=a.selection())}return this._snapshotIndex<this._snapshots.length-1&&(this._snapshots=this._snapshots.slice(0,this._snapshotIndex+1)),this._snapshotIndex++,this._snapshots.splice(this._snapshotIndex,0,e)},a}(),b.StylePalette=function(){function a(){}return a._styles=[],a.add=function(a){return this._styles=this._styles.concat(a)},a.styles=function(a){var b;return void 0===a?this._styles.slice():(b=a.tagName(),this._styles.filter(function(a){return!a._applicableTo||-1!==a._applicableTo.indexOf(b)}))},a}(),b.Style=function(){function a(a,b,c){this._name=a,this._cssClass=b,this._applicableTo=c||null}return a.prototype.applicableTo=function(){return this._applicableTo},a.prototype.cssClass=function(){return this._cssClass},a.prototype.name=function(){return this._name},a}(),b.ToolShelf=function(){function a(){}return a._tools={},a.stow=function(a,b){return this._tools[b]=a},a.fetch=function(a){if(!this._tools[a])throw new Error("`"+a+"` has not been stowed on the tool shelf");return this._tools[a]},a}(),b.Tool=function(){function a(){}return a.label="Tool",a.icon="tool",a.requiresElement=!0,a.canApply=function(a,b){return!1},a.isApplied=function(a,b){return!1},a.apply=function(a,b,c){throw new Error("Not implemented")},a.editor=function(){return b.EditorApp.get()},a.dispatchEditorEvent=function(a,b){return this.editor().dispatchEvent(this.editor().createEvent(a,b))},a._insertAt=function(a){var b,c;return c=a,"Region"!==c.parent().type()&&(c=a.closest(function(a){return"Region"===a.parent().type()})),b=c.parent().children.indexOf(c)+1,[c,b]},a}(),b.Tools.Bold=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"bold"),c.label="Bold",c.icon="bold",c.tagName="b",c.canApply=function(a,b){return!a.isGallery()&&(!!a.content&&(b&&!b.isCollapsed()))},c.isApplied=function(a,b){var c,d,e;return!(void 0===a.content||!a.content.length())&&(e=b.get(),c=e[0],d=e[1],c===d&&(d+=1),a.content.slice(c,d).hasTags(this.tagName,!0))},c.apply=function(a,b,c){var d,e,f,g;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return a.storeState(),g=b.get(),d=g[0],e=g[1],this.isApplied(a,b)?a.content=a.content.unformat(d,e,new HTMLString.Tag(this.tagName)):a.content=a.content.format(d,e,new HTMLString.Tag(this.tagName)),a.content.optimize(),a.updateInnerHTML(),a.taint(),a.restoreState(),c(!0),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Italic=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"italic"),c.label="Italic",c.icon="italic",c.tagName="i",c}(b.Tools.Bold),b.Tools.Underline=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"underline"),c.label="Underline",c.icon="underline",c.tagName="u",c}(b.Tools.Bold),b.Tools.Code=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"code"),c.label="Code",c.icon="preformatted",c.tagName="code",c}(b.Tools.Bold),b.Tools.Strike=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"strike"),c.label="Strikethrough",c.icon="strike",c.tagName="strike",c}(b.Tools.Bold),b.Tools.Link=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"link"),c.label="Link",c.icon="link",c.tagName="a",c.getAttr=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;if("Image"===b.type()){if(b.a)return b.a[a]}else{if(b.isFixed()&&"a"===b.tagName())return b.attr(a);for(m=c.get(),e=m[0],h=m[1],f=b.content.slice(e,h),n=f.characters,i=0,k=n.length;i<k;i++)if(d=n[i],d.hasTags("a"))for(o=d.tags(),j=0,l=o.length;j<l;j++)if(g=o[j],"a"===g.name())return g.attr(a)}return""},c.canApply=function(a,b){var c;return!a.isGallery()&&("Image"===a.type()||(!(!a.isFixed()||"a"!==a.tagName())||!!a.content&&(!!b&&!!(!b.isCollapsed()||(c=a.content.characters[b.get()[0]])&&c.hasTags("a")))))},c.isApplied=function(a,b){return"Image"===a.type()?a.a:!(!a.isFixed()||"a"!==a.tagName())||c.__super__.constructor.isApplied.call(this,a,b)},c.apply=function(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(t={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",t)){if(f=!1,"Image"===a.type())n=a.domElement().getBoundingClientRect();else if(a.isFixed()&&"a"===a.tagName())n=a.domElement().getBoundingClientRect();else{if(c.isCollapsed()){for(g=a.content.characters,r=c.get(0)[0],j=r;r>0&&g[r-1].hasTags("a");)r-=1;for(;j<g.length&&g[j].hasTags("a");)j+=1;c=new ContentSelect.Range(r,j),c.select(a.domElement())}a.storeState(),q=new HTMLString.Tag("span",{class:"ct--pseudo-select"}),u=c.get(),k=u[0],s=u[1],a.content=a.content.format(k,s,q),a.updateInnerHTML(),i=a.domElement(),l=i.getElementsByClassName("ct--pseudo-select"),n=l[0].getBoundingClientRect()}return e=b.EditorApp.get(),m=new b.ModalUI(!0,!0),m.addEventListener("click",function(){if(this.unmount(),h.hide(),a.content&&(a.content=a.content.unformat(k,s,q),a.updateInnerHTML(),a.restoreState()),d(f),f)return b.Tools.Link.dispatchEditorEvent("tool-applied",t)}),h=new b.LinkDialog(this.getAttr("href",a,c),this.getAttr("target",a,c)),v=b.getScrollPosition(),o=v[0],p=v[1],h.position([n.left+n.width/2+o,n.top+n.height/2+p]),h.addEventListener("save",function(b){var c,d,e,g,h,i,j,l,n;if(g=b.detail(),f=!0,"Image"===a.type()){if(d=["align-center","align-left","align-right"],g.href){for(a.a={href:g.href},a.a&&(a.a.class=a.a.class),g.target&&(a.a.target=g.target),i=0,l=d.length;i<l;i++)if(e=d[i],a.hasCSSClass(e)){a.removeCSSClass(e),a.a.class=e;break}}else{for(h=[],a.a.class&&(h=a.a.class.split(" ")),j=0,n=d.length;j<n;j++)if(e=d[j],h.indexOf(e)>-1){a.addCSSClass(e);break}a.a=null}a.unmount(),a.mount()}else a.isFixed()&&"a"===a.tagName()?a.attr("href",g.href):(a.content=a.content.unformat(k,s,"a"),g.href&&(c=new HTMLString.Tag("a",g),a.content=a.content.format(k,s,c),a.content.optimize()),a.updateInnerHTML());return a.taint(),m.dispatchEvent(m.createEvent("click"))}),e.attach(m),e.attach(h),m.show(),h.show()}},c}(b.Tools.Bold),b.Tools.Heading=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading"),c.label="Heading",c.icon="heading",c.tagName="h1",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&(void 0!==a.content&&-1!==["Text","PreText"].indexOf(a.type())))},c.isApplied=function(a,b){return!!a.content&&(-1!==["Text","PreText"].indexOf(a.type())&&a.tagName()===this.tagName)},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return a.storeState(),"PreText"===a.type()?(d=a.content.html().replace(/&nbsp;/g," "),g=new ContentEdit.Text(this.tagName,{},d),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(b)):(a.removeAttr("class"),a.tagName()===this.tagName?a.tagName("p"):a.tagName(this.tagName),a.restoreState()),this.dispatchEditorEvent("tool-applied",h),c(!0)},c}(b.Tool),b.Tools.Heading2=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading2"),c.icon=c.icon+"2",c.tagName="h2",c}(b.Tools.Heading),b.Tools.Heading3=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading3"),c.icon=c.icon+"3",c.tagName="h3",c}(b.Tools.Heading),b.Tools.Heading4=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading4"),c.icon=c.icon+"4",c.tagName="h4",c}(b.Tools.Heading),b.Tools.Heading5=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading5"),c.icon=c.icon+"5",c.tagName="h5",c}(b.Tools.Heading),b.Tools.Heading6=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading6"),c.icon=c.icon+"6",c.tagName="h6",c}(b.Tools.Heading),b.Tools.Paragraph=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"paragraph"),c.label="Paragraph",c.icon="paragraph",c.tagName="p",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&void 0!==a)},c.apply=function(a,d,e){var f,g,h,i;return f=this.editor().ctrlDown(),b.Tools.Heading.canApply(a)&&!f?c.__super__.constructor.apply.call(this,a,d,e):(i={tool:this,element:a,selection:d},this.dispatchEditorEvent("tool-apply",i)?("Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),h=a.parent(),g=new ContentEdit.Text("p"),h.attach(g,h.children.indexOf(a)+1),g.focus(),e(!0),this.dispatchEditorEvent("tool-applied",i)):void 0)},c}(b.Tools.Heading),b.Tools.Preformatted=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"preformatted"),c.label="Preformatted",c.icon="preformatted",c.tagName="pre",c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return"PreText"===a.type()?void b.Tools.Paragraph.apply(a,c,d):(h=a.content.text(),g=new ContentEdit.PreText("pre",{},HTMLString.String.encode(h)),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(c),d(!0),this.dispatchEditorEvent("tool-applied",i))},c}(b.Tools.Heading),b.Tools.AlignLeft=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-left"),c.label="Align left",c.icon="align-left",c.className="text-left",c.canApply=function(a,b){return!a.isGallery()&&("Image"===a.type()||void 0!==a.content)},c.isApplied=function(a,b){var c;return!!this.canApply(a)&&("ListItemText"!==(c=a.type())&&"TableCellText"!==c||(a=a.parent()),a.hasCSSClass(this.className))},c.apply=function(a,c,d){var e,f,g,h,i,j;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g)){for("ListItemText"!==(j=a.type())&&"TableCellText"!==j||(a=a.parent()),e=[b.Tools.AlignLeft.className,b.Tools.AlignCenter.className,b.Tools.AlignRight.className],h=0,i=e.length;h<i;h++)if(f=e[h],a.hasCSSClass(f)&&(a.removeCSSClass(f),f===this.className))return d(!0);return a.addCSSClass(this.className),d(!0),this.dispatchEditorEvent("tool-applied",g)}},c}(b.Tool),b.Tools.AlignCenter=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-center"),c.label="Align center",c.icon="align-center",c.className="text-center",c}(b.Tools.AlignLeft),b.Tools.AlignRight=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-right"),c.label="Align right",c.icon="align-right",c.className="text-right",c}(b.Tools.AlignLeft),b.Tools.UnorderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unordered-list"),c.label="Bullet list",c.icon="unordered-list",c.listTag="ul",c.canApply=function(a,b){var c;return!a.isGallery()&&(!a.isFixed()&&(void 0!==a.content&&("Region"===(c=a.parent().type())||"ListItem"===c)))},c.apply=function(a,b,c){var d,e,f,g,h,i;if(i={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",i))return"ListItem"===a.parent().type()?(a.storeState(),e=a.closest(function(a){return"List"===a.type()}),e.tagName(this.listTag),a.restoreState()):(g=new ContentEdit.ListItemText(a.content.copy()),f=new ContentEdit.ListItem,f.attach(g),e=new ContentEdit.List(this.listTag,{}),e.attach(f),h=a.parent(),d=h.children.indexOf(a),h.detach(a),h.attach(e,d),g.focus(),g.selection(b)),c(!0),this.dispatchEditorEvent("tool-applied",i)},c}(b.Tool),b.Tools.OrderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"ordered-list"),c.label="Numbers list",c.icon="ordered-list",c.listTag="ol",c}(b.Tools.UnorderedList),b.Tools.Table=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"table"),c.label="Table",c.icon="table",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&void 0!==a)},c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,h=a.closest(function(a){return a&&"Table"===a.type()}),f=new b.TableDialog(h),f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,j,k,l,m;return l=c.detail(),j=!0,h?(b._updateTable(l,h),j=a.closest(function(a){return a&&"Table"===a.type()})):(h=b._createTable(l),m=b._insertAt(a),k=m[0],e=m[1],k.parent().attach(h,e),j=!1),j?a.restoreState():h.firstSection().children[0].children[0].children[0].focus(),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",i)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c._adjustColumns=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;for(l=a.children,m=[],j=0,k=l.length;j<k;j++)i=l[j],d=i.children[0].tagName(),f=i.children.length,g=b-f,g<0?m.push(function(){var a,b;for(b=[],h=a=g;g<=0?a<0:a>0;h=g<=0?++a:--a)c=i.children[i.children.length-1],b.push(i.detach(c));return b}()):g>0?m.push(function(){var a,b;for(b=[],h=a=0;0<=g?a<g:a>g;h=0<=g?++a:--a)c=new ContentEdit.TableCell(d),i.attach(c),e=new ContentEdit.TableCellText(""),b.push(c.attach(e));return b}()):m.push(void 0);return m},c._createTable=function(a){var b,c,d,e;return e=new ContentEdit.Table,a.head&&(d=this._createTableSection("thead","th",a.columns),e.attach(d)),b=this._createTableSection("tbody","td",a.columns),e.attach(b),a.foot&&(c=this._createTableSection("tfoot","td",a.columns),e.attach(c)),e},c._createTableSection=function(a,b,c){var d,e,f,g,h;for(g=new ContentEdit.TableSection(a),f=new ContentEdit.TableRow,g.attach(f),h=0;0<=c?h<c:h>c;0<=c?++h:--h)d=new ContentEdit.TableCell(b),f.attach(d),e=new ContentEdit.TableCellText(""),d.attach(e);return g},c._updateTable=function(a,b){var c,d,e,f,g,h,i;if(!a.head&&b.thead()&&b.detach(b.thead()),!a.foot&&b.tfoot()&&b.detach(b.tfoot()),c=b.firstSection().children[0].children.length,a.columns!==c)for(i=b.children,g=0,h=i.length;g<h;g++)f=i[g],this._adjustColumns(f,a.columns);if(a.head&&!b.thead()&&(e=this._createTableSection("thead","th",a.columns),b.attach(e,0)),a.foot&&!b.tfoot())return d=this._createTableSection("tfoot","td",a.columns),b.attach(d)},c}(b.Tool),b.Tools.Indent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"indent"),c.label="Indent",c.icon="indent",c.canApply=function(a,b){return!a.isGallery()&&("ListItem"===a.parent().type()&&a.parent().parent().children.indexOf(a.parent())>0)},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().indent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.Unindent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unindent"),c.label="Unindent",c.icon="unindent",c.canApply=function(a,b){return!a.isGallery()&&"ListItem"===a.parent().type()},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().unindent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.LineBreak=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"line-break"),c.label="Line break",c.icon="line-break",c.canApply=function(a,b){return!a.isGallery()&&a.content},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return e=b.get()[0]+1,g=a.content.substring(0,b.get()[0]),f=a.content.substring(b.get()[1]),d=f&&f.characters&&f.characters.length?new HTMLString.String("<br>",a.content.preserveWhitespace()):new HTMLString.String("<br><br>",a.content.preserveWhitespace()),a.content=g.concat(d,f),a.updateInnerHTML(),a.taint(),b.set(e,e),a.selection(b),c(!0),this.dispatchEditorEvent("tool-applied",h)},c}(b.Tool),b.Tools.Image=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"image"),c.label="Image",c.icon="image",c.canApply=function(a,b){return!a.isFixed()||"ImageFixture"===a.type()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.ImageDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,i,j,k,l,m,n,o;return e=c.detail(),l=e.imageURL,k=e.imageSize,j=e.imageAttrs,j||(j={}),j.height=k[1],j.src=l,j.width=k[0],"ImageFixture"===a.type()?a.src(l):(i=new ContentEdit.Image(j),o=b._insertAt(a),n=o[0],m=o[1],n.parent().attach(i,m),i.focus()),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Video=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"video"),c.label="Video",c.icon="video",c.canApply=function(a,b){return!a.isGallery()&&!a.isFixed()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.VideoDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(c){return function(e){var i,j,k,l,m,n;if(l=e.detail().url,l?(m=new ContentEdit.Video("iframe",{frameborder:0,height:b.DEFAULT_VIDEO_HEIGHT,src:l,width:b.DEFAULT_VIDEO_WIDTH}),n=c._insertAt(a),k=n[0],j=n[1],k.parent().attach(m,j),m.focus()):a.restoreState&&a.restoreState(),g.hide(),f.hide(),i=""!==l,d(i),i)return c.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Undo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"undo"),c.label="Undo",c.icon="undo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canUndo()},c.apply=function(a,b,c){var d,e,f;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return d=this.editor(),d.history.stopWatching(),e=d.history.undo(),d.revertToSnapshot(e),d.history.watch(),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Redo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"redo"),c.label="Redo",c.icon="redo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canRedo()},c.apply=function(a,c,d){var e,f,g;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g))return e=b.EditorApp.get(),e.history.stopWatching(),f=e.history.redo(),e.revertToSnapshot(f),e.history.watch(),this.dispatchEditorEvent("tool-applied",g)},c}(b.Tool),b.Tools.Remove=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"remove"),c.label="Remove",c.icon="remove",c.canApply=function(a,b){return!a.isFixed()},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h)){if(d=this.editor(),a.blur(),a.nextContent()?a.nextContent().focus():a.previousContent()&&a.previousContent().focus(),!a.isMounted())return c(!0),void this.dispatchEditorEvent("tool-applied",h);switch(a.type()){case"ListItemText":d.ctrlDown()?(e=a.closest(function(a){return"Region"===a.parent().type()}),e.parent().detach(e)):a.parent().parent().detach(a.parent());break;case"TableCellText":d.ctrlDown()?(g=a.closest(function(a){return"Table"===a.type()}),g.parent().detach(g)):(f=a.parent().parent(),f.parent().detach(f));break;default:a.parent().detach(a)}return c(!0),this.dispatchEditorEvent("tool-applied",h)}},c}(b.Tool)}.call(this);
/*!
 * baguetteBox.js
 * @author  feimosi
 * @version 1.11.0
 * @url https://github.com/feimosi/baguetteBox.js
 */
!function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.baguetteBox=t()}(this,function(){"use strict";var s,l,u,c,d,f='<svg width="44" height="60"><polyline points="30 10 10 30 30 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',g='<svg width="44" height="60"><polyline points="14 10 34 30 14 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',p='<svg width="30" height="30"><g stroke="rgb(160,160,160)" stroke-width="4"><line x1="5" y1="5" x2="25" y2="25"/><line x1="5" y1="25" x2="25" y2="5"/></g></svg>',b={},m={captions:!0,buttons:"auto",fullScreen:!1,noScrollbars:!1,bodyClass:"baguetteBox-open",titleTag:!1,async:!1,preload:2,animation:"slideIn",afterShow:null,afterHide:null,onChange:null,overlayBackgroundColor:"rgba(0,0,0,.8)"},v={},h=[],o=0,n=!1,i={},a=!1,y=/.+\.(gif|jpe?g|png|webp)/i,w={},k=[],r=null,x=function(e){-1!==e.target.id.indexOf("baguette-img")&&j()},C=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,D()},E=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,X()},B=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,j()},T=function(e){i.count++,1<i.count&&(i.multitouch=!0),i.startX=e.changedTouches[0].pageX,i.startY=e.changedTouches[0].pageY},N=function(e){if(!a&&!i.multitouch){e.preventDefault?e.preventDefault():e.returnValue=!1;var t=e.touches[0]||e.changedTouches[0];40<t.pageX-i.startX?(a=!0,D()):t.pageX-i.startX<-40?(a=!0,X()):100<i.startY-t.pageY&&j()}},L=function(){i.count--,i.count<=0&&(i.multitouch=!1),a=!1},A=function(){L()},P=function(e){"block"===s.style.display&&s.contains&&!s.contains(e.target)&&(e.stopPropagation(),Y())};function S(e){if(w.hasOwnProperty(e)){var t=w[e].galleries;[].forEach.call(t,function(e){[].forEach.call(e,function(e){W(e.imageElement,"click",e.eventHandler)}),h===e&&(h=[])}),delete w[e]}}function F(e){switch(e.keyCode){case 37:D();break;case 39:X();break;case 27:j();break;case 36:!function t(e){e&&e.preventDefault();return M(0)}(e);break;case 35:!function n(e){e&&e.preventDefault();return M(h.length-1)}(e)}}function H(e,t){if(h!==e){for(h=e,function r(e){e||(e={});for(var t in m)b[t]=m[t],"undefined"!=typeof e[t]&&(b[t]=e[t]);l.style.transition=l.style.webkitTransition="fadeIn"===b.animation?"opacity .4s ease":"slideIn"===b.animation?"":"none","auto"===b.buttons&&("ontouchstart"in window||1===h.length)&&(b.buttons=!1);u.style.display=c.style.display=b.buttons?"":"none";try{s.style.backgroundColor=b.overlayBackgroundColor}catch(n){}}(t);l.firstChild;)l.removeChild(l.firstChild);for(var n,o=[],i=[],a=k.length=0;a<e.length;a++)(n=J("div")).className="full-image",n.id="baguette-img-"+a,k.push(n),o.push("baguetteBox-figure-"+a),i.push("baguetteBox-figcaption-"+a),l.appendChild(k[a]);s.setAttribute("aria-labelledby",o.join(" ")),s.setAttribute("aria-describedby",i.join(" "))}}function I(e){b.noScrollbars&&(document.documentElement.style.overflowY="hidden",document.body.style.overflowY="scroll"),"block"!==s.style.display&&(U(document,"keydown",F),i={count:0,startX:null,startY:null},q(o=e,function(){z(o),V(o)}),R(),s.style.display="block",b.fullScreen&&function t(){s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.mozRequestFullScreen&&s.mozRequestFullScreen()}(),setTimeout(function(){s.className="visible",b.bodyClass&&document.body.classList&&document.body.classList.add(b.bodyClass),b.afterShow&&b.afterShow()},50),b.onChange&&b.onChange(o,k.length),r=document.activeElement,Y(),n=!0)}function Y(){b.buttons?u.focus():d.focus()}function j(){b.noScrollbars&&(document.documentElement.style.overflowY="auto",document.body.style.overflowY="auto"),"none"!==s.style.display&&(W(document,"keydown",F),s.className="",setTimeout(function(){s.style.display="none",document.fullscreen&&function e(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}(),b.bodyClass&&document.body.classList&&document.body.classList.remove(b.bodyClass),b.afterHide&&b.afterHide(),r&&r.focus(),n=!1},500))}function q(t,n){var e=k[t],o=h[t];if(void 0!==e&&void 0!==o)if(e.getElementsByTagName("img")[0])n&&n();else{var i=o.imageElement,a=i.getElementsByTagName("img")[0],r="function"==typeof b.captions?b.captions.call(h,i):i.getAttribute("data-caption")||i.title,s=function d(e){var t=e.href;if(e.dataset){var n=[];for(var o in e.dataset)"at-"!==o.substring(0,3)||isNaN(o.substring(3))||(n[o.replace("at-","")]=e.dataset[o]);for(var i=Object.keys(n).sort(function(e,t){return parseInt(e,10)<parseInt(t,10)?-1:1}),a=window.innerWidth*window.devicePixelRatio,r=0;r<i.length-1&&i[r]<a;)r++;t=n[i[r]]||t}return t}(i),l=J("figure");if(l.id="baguetteBox-figure-"+t,l.innerHTML='<div class="baguetteBox-spinner"><div class="baguetteBox-double-bounce1"></div><div class="baguetteBox-double-bounce2"></div></div>',b.captions&&r){var u=J("figcaption");u.id="baguetteBox-figcaption-"+t,u.innerHTML=r,l.appendChild(u)}e.appendChild(l);var c=J("img");c.onload=function(){var e=document.querySelector("#baguette-img-"+t+" .baguetteBox-spinner");l.removeChild(e),!b.async&&n&&n()},c.setAttribute("src",s),c.alt=a&&a.alt||"",b.titleTag&&r&&(c.title=r),l.appendChild(c),b.async&&n&&n()}}function X(){return M(o+1)}function D(){return M(o-1)}function M(e,t){return!n&&0<=e&&e<t.length?(H(t,b),I(e),!0):e<0?(b.animation&&O("left"),!1):e>=k.length?(b.animation&&O("right"),!1):(q(o=e,function(){z(o),V(o)}),R(),b.onChange&&b.onChange(o,k.length),!0)}function O(e){l.className="bounce-from-"+e,setTimeout(function(){l.className=""},400)}function R(){var e=100*-o+"%";"fadeIn"===b.animation?(l.style.opacity=0,setTimeout(function(){v.transforms?l.style.transform=l.style.webkitTransform="translate3d("+e+",0,0)":l.style.left=e,l.style.opacity=1},400)):v.transforms?l.style.transform=l.style.webkitTransform="translate3d("+e+",0,0)":l.style.left=e}function z(e){e-o>=b.preload||q(e+1,function(){z(e+1)})}function V(e){o-e>=b.preload||q(e-1,function(){V(e-1)})}function U(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent("on"+t,function(e){(e=e||window.event).target=e.target||e.srcElement,n(e)})}function W(e,t,n,o){e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent("on"+t,n)}function G(e){return document.getElementById(e)}function J(e){return document.createElement(e)}return[].forEach||(Array.prototype.forEach=function(e,t){for(var n=0;n<this.length;n++)e.call(t,this[n],n,this)}),[].filter||(Array.prototype.filter=function(e,t,n,o,i){for(n=this,o=[],i=0;i<n.length;i++)e.call(t,n[i],i,n)&&o.push(n[i]);return o}),{run:function K(e,t){return v.transforms=function n(){var e=J("div");return"undefined"!=typeof e.style.perspective||"undefined"!=typeof e.style.webkitPerspective}(),v.svg=function o(){var e=J("div");return e.innerHTML="<svg/>","http://www.w3.org/2000/svg"===(e.firstChild&&e.firstChild.namespaceURI)}(),v.passiveEvents=function i(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(n){}return e}(),function a(){if(s=G("baguetteBox-overlay"))return l=G("baguetteBox-slider"),u=G("previous-button"),c=G("next-button"),void(d=G("close-button"));(s=J("div")).setAttribute("role","dialog"),s.id="baguetteBox-overlay",document.getElementsByTagName("body")[0].appendChild(s),(l=J("div")).id="baguetteBox-slider",s.appendChild(l),(u=J("button")).setAttribute("type","button"),u.id="previous-button",u.setAttribute("aria-label","Previous"),u.innerHTML=v.svg?f:"&lt;",s.appendChild(u),(c=J("button")).setAttribute("type","button"),c.id="next-button",c.setAttribute("aria-label","Next"),c.innerHTML=v.svg?g:"&gt;",s.appendChild(c),(d=J("button")).setAttribute("type","button"),d.id="close-button",d.setAttribute("aria-label","Close"),d.innerHTML=v.svg?p:"&times;",s.appendChild(d),u.className=c.className=d.className="baguetteBox-button",function t(){var e=v.passiveEvents?{passive:!0}:null;U(s,"click",x),U(u,"click",C),U(c,"click",E),U(d,"click",B),U(l,"contextmenu",A),U(s,"touchstart",T,e),U(s,"touchmove",N,e),U(s,"touchend",L),U(document,"focus",P,!0)}()}(),S(e),function r(e,a){var t=document.querySelectorAll(e),n={galleries:[],nodeList:t};return w[e]=n,[].forEach.call(t,function(e){a&&a.filter&&(y=a.filter);var t=[];if(t="A"===e.tagName?[e]:e.getElementsByTagName("a"),0!==(t=[].filter.call(t,function(e){if(-1===e.className.indexOf(a&&a.ignoreClass))return y.test(e.href)})).length){var i=[];[].forEach.call(t,function(e,t){var n=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,H(i,a),I(t)},o={eventHandler:n,imageElement:e};U(e,"click",n),i.push(o)}),n.galleries.push(i)}}),n.galleries}(e,t)},show:M,showNext:X,showPrevious:D,hide:j,destroy:function e(){!function t(){var e=v.passiveEvents?{passive:!0}:null;W(s,"click",x),W(u,"click",C),W(c,"click",E),W(d,"click",B),W(l,"contextmenu",A),W(s,"touchstart",T,e),W(s,"touchmove",N,e),W(s,"touchend",L),W(document,"focus",P,!0)}(),function n(){for(var e in w)w.hasOwnProperty(e)&&S(e)}(),W(document,"keydown",F),document.getElementsByTagName("body")[0].removeChild(document.getElementById("baguetteBox-overlay")),w={},h=[],o=0}}});
/**************************
Easy Burger V1.3.0
Built By Blocs Builder
Updated: May 27 2024
www.blocsbuilder.com
***************************/

var _0x17468d=_0x221f;(function(_0x59f26e,_0x19ba01){var _0x33df31=_0x221f,_0x1c7f77=_0x59f26e();while(!![]){try{var _0x2f7082=parseInt(_0x33df31(0x155))/0x1+-parseInt(_0x33df31(0x151))/0x2*(-parseInt(_0x33df31(0x160))/0x3)+parseInt(_0x33df31(0x164))/0x4*(parseInt(_0x33df31(0x169))/0x5)+-parseInt(_0x33df31(0x158))/0x6+parseInt(_0x33df31(0x18d))/0x7+-parseInt(_0x33df31(0x162))/0x8*(-parseInt(_0x33df31(0x154))/0x9)+parseInt(_0x33df31(0x157))/0xa*(-parseInt(_0x33df31(0x17a))/0xb);if(_0x2f7082===_0x19ba01)break;else _0x1c7f77['push'](_0x1c7f77['shift']());}catch(_0x171239){_0x1c7f77['push'](_0x1c7f77['shift']());}}}(_0x919d,0xb332a));function _0x221f(_0x5afa8b,_0x4def94){var _0x919daf=_0x919d();return _0x221f=function(_0x221f20,_0x825376){_0x221f20=_0x221f20-0x150;var _0x2b2290=_0x919daf[_0x221f20];return _0x2b2290;},_0x221f(_0x5afa8b,_0x4def94);}function _0x919d(){var _0x573e03=['padding-left','close-size','3417007nvwDeR','head','icon-hover',';\x20transition-property:\x20color,\x20border-color,\x20background,\x20box-shadow;\x20font-size:\x20','rem;\x20height:\x20','\x20{\x20color:','\x20{\x20position:\x20relative;\x20content:\x20\x22','text-spacing-direction',';\x20font-size:\x20',';\x20transition-property:\x20background;\x20background:\x20','text/css','!important;\x20border:\x20','icon-size','radius-bottom-left',';}\x20.navbar-toggler:hover::','icon-transition',';\x20transition-property:\x20color,\x20border-color,\x20background,\x20box-shadow;\x20color:\x20','!important;\x20background-color:\x20','close-icon-thickness','1695876yODWMB','getAttribute','\x20;\x20line-height:\x201em;\x20padding-','padding-bottom','radius-top-left','padding-right','text-color','text-size','rem;}\x20.close-special-menu\x20.close-icon\x20{transition:\x20all\x20','<span><i\x20class=\x22','icon-hover-bg','border-color-hover','font-weight','56RfBPbV',';\x20}\x20.navbar-toggler:hover\x20{\x20transition-duration:\x20','fa-icon','342euTWvN','1332896lwBBKH','getElementById','100JHwtNb','5313024vLXHJn','easy-burger','padding-top','text-position','getElementsByTagName','createTextNode','border-color',';\x20letter-spacing:\x20','152169OFAoIu','\x20solid\x20','266368kPxXkE','text-base','4796BjrRCv','styleSheet','shadow-box-hover','letter-spacing',';\x20color:\x20','1940NRWJvQ','icon-color','font-family','.navbar-toggler-icon\x20{display:none;}\x20.navbar-toggler\x20{\x20display:flex;\x20align-items:\x20center;\x20transition-duration:\x20',';}\x20.nav-special.sidebar-nav\x20.site-navigation\x20{margin-top:\x20','yes','appendChild','icon-color-bg','!important\x20;\x20margin-bottom:\x20','!important;\x20box-shadow:\x20','text',';}\x20.close-special-menu:hover\x20.close-icon\x20{transition:\x20all\x20',';}\x20',';\x20font-weight:\x20','style'];_0x919d=function(){return _0x573e03;};return _0x919d();}var easyBurger=document[_0x17468d(0x156)](_0x17468d(0x159)),iconBootstrap=easyBurger[_0x17468d(0x18e)]('default-bs'),displayText=easyBurger[_0x17468d(0x18e)]('text-display'),textCSS='';if(iconBootstrap=='no'){var burger=easyBurger[_0x17468d(0x18e)](_0x17468d(0x153));if(displayText==='text')var iconHtml='\x20';else var iconHtml=_0x17468d(0x196)+burger+'\x22></i></span>';var iconTrans=easyBurger[_0x17468d(0x18e)](_0x17468d(0x189)),iconSize=easyBurger['getAttribute'](_0x17468d(0x186)),iconColor=easyBurger[_0x17468d(0x18e)](_0x17468d(0x16a)),iconColorbg=easyBurger[_0x17468d(0x18e)](_0x17468d(0x170)),iconPadtop=easyBurger['getAttribute'](_0x17468d(0x15a)),iconPadbottom=easyBurger[_0x17468d(0x18e)](_0x17468d(0x190)),iconPadleft=easyBurger[_0x17468d(0x18e)](_0x17468d(0x178)),iconPadright=easyBurger[_0x17468d(0x18e)](_0x17468d(0x192)),iconRadiustopl=easyBurger['getAttribute'](_0x17468d(0x191)),iconRadiustopr=easyBurger[_0x17468d(0x18e)]('radius-top-right'),iconRadiusbotl=easyBurger[_0x17468d(0x18e)](_0x17468d(0x187)),iconRadiusbotr=easyBurger[_0x17468d(0x18e)]('radius-bottom-right'),borderWidth=easyBurger['getAttribute']('border-width'),borderColor=easyBurger[_0x17468d(0x18e)](_0x17468d(0x15e)),borderColorhover=easyBurger['getAttribute'](_0x17468d(0x198)),iconHover=easyBurger[_0x17468d(0x18e)](_0x17468d(0x17c)),iconHoverbg=easyBurger[_0x17468d(0x18e)](_0x17468d(0x197)),closeThickness=easyBurger[_0x17468d(0x18e)](_0x17468d(0x18c)),closeColor=easyBurger[_0x17468d(0x18e)]('close-icon-color'),closeHover=easyBurger[_0x17468d(0x18e)]('close-icon-hover'),closeSize=easyBurger[_0x17468d(0x18e)](_0x17468d(0x179)),shadowBox=easyBurger['getAttribute']('shadow-box'),shadowHover=easyBurger[_0x17468d(0x18e)](_0x17468d(0x166)),navOffset=easyBurger[_0x17468d(0x18e)]('nav-offset');if(displayText==_0x17468d(0x16e)||displayText==_0x17468d(0x173))var textContent=easyBurger[_0x17468d(0x18e)]('text'),textPosition=easyBurger[_0x17468d(0x18e)](_0x17468d(0x15b)),textFontFam=easyBurger[_0x17468d(0x18e)](_0x17468d(0x16b)),textWeight=easyBurger[_0x17468d(0x18e)](_0x17468d(0x150)),textColor=easyBurger[_0x17468d(0x18e)](_0x17468d(0x193)),textColorHover=easyBurger[_0x17468d(0x18e)]('text-color-hover'),textSize=easyBurger['getAttribute'](_0x17468d(0x194)),textBase=easyBurger[_0x17468d(0x18e)](_0x17468d(0x163)),textLettering=easyBurger[_0x17468d(0x18e)](_0x17468d(0x167)),textSpacing=easyBurger[_0x17468d(0x18e)]('text-spacing'),textSpacingDirection=easyBurger[_0x17468d(0x18e)](_0x17468d(0x181)),textCss='.navbar-toggler::'+textPosition+_0x17468d(0x180)+textContent+'\x22;\x20font-family:\x20'+textFontFam+_0x17468d(0x176)+textWeight+_0x17468d(0x168)+textColor+_0x17468d(0x182)+textSize+_0x17468d(0x15f)+textLettering+_0x17468d(0x171)+textBase+_0x17468d(0x18f)+textSpacingDirection+':'+textSpacing+_0x17468d(0x188)+textPosition+_0x17468d(0x17f)+textColorHover+_0x17468d(0x175);document[_0x17468d(0x156)]('nav-toggle')['innerHTML']=iconHtml;var toggleClasses=_0x17468d(0x16c)+iconTrans+_0x17468d(0x17d)+iconSize+'rem!important;\x20color:\x20'+iconColor+_0x17468d(0x18b)+iconColorbg+';\x20padding:\x20'+iconPadtop+'\x20'+iconPadright+'\x20'+iconPadbottom+'\x20'+iconPadleft+_0x17468d(0x185)+borderWidth+_0x17468d(0x161)+borderColor+'!important;\x20border-radius:\x20'+iconRadiustopl+'\x20'+iconRadiustopr+'\x20'+iconRadiusbotr+'\x20'+iconRadiusbotl+_0x17468d(0x172)+shadowBox+_0x17468d(0x152)+iconTrans+_0x17468d(0x18a)+iconHover+_0x17468d(0x18b)+iconHoverbg+'!important;\x20border-color:\x20'+borderColorhover+_0x17468d(0x172)+shadowHover+';}\x20.close-special-menu\x20{width:\x20'+closeSize+_0x17468d(0x17e)+closeSize+_0x17468d(0x195)+iconTrans+_0x17468d(0x183)+closeColor+';\x20height:\x20'+closeThickness+_0x17468d(0x174)+iconTrans+';\x20transition-property:\x20background;\x20background:\x20'+closeHover+_0x17468d(0x16d)+navOffset+_0x17468d(0x175)+textCss+'\x20',head=document['head']||document[_0x17468d(0x15c)](_0x17468d(0x17b))[0x0],style=document['createElement'](_0x17468d(0x177));head[_0x17468d(0x16f)](style),style['type']=_0x17468d(0x184),style[_0x17468d(0x165)]?style[_0x17468d(0x165)]['cssText']=toggleClasses:style[_0x17468d(0x16f)](document[_0x17468d(0x15d)](toggleClasses));}

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).reframe=t()}(this,function(){"use strict";function t(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var i=Array(e),o=0,t=0;t<n;t++)for(var r=arguments[t],f=0,d=r.length;f<d;f++,o++)i[o]=r[f];return i}return function(e,s){return void 0===s&&(s="js-reframe"),("string"==typeof e?t(document.querySelectorAll(e)):"length"in e?t(e):[e]).forEach(function(e){var t,n,i,o,r,f,d,l;-1!==e.className.split(" ").indexOf(s)||-1<e.style.width.indexOf("%")||(i=e.getAttribute("height")||e.offsetHeight,o=e.getAttribute("width")||e.offsetWidth,r=("string"==typeof i?parseInt(i):i)/("string"==typeof o?parseInt(o):o)*100,(f=document.createElement("div")).className=s,(d=f.style).position="relative",d.width="100%",d.paddingTop=r+"%",(l=e.style).position="absolute",l.width="100%",l.height="100%",l.left="0",l.top="0",null!==(t=e.parentNode)&&void 0!==t&&t.insertBefore(f,e),null!==(n=e.parentNode)&&void 0!==n&&n.removeChild(e),f.appendChild(e))})}});

$(function () {
    //////////////////////////////////////////////////
    // Bric Version 1.9.4
    // 1.9.7
    //////////////////////////////////////////////////

    //////////////////////////////////////////////////
    // template parameters
    //////////////////////////////////////////////////
    var localhost_preview = '0';
    var baseURL = 'https://www.gawrjuhs.art/';
    var redirect_root = '1';
    var lightbox_captions = '1';
    var lightbox_color = 'rgba(0,0,0,0.8)';
    var language = 'en';
    var styles_img = '';
    var styles_p = 'white-text, small-gold-headings, footer-subheads, footer-paragraph, gold-buttons, p-white, p-white-small, p-white-semibold, shop-info-bar';
    var is_preview = 'false';

    //////////////////////////////////////////////////
    // constants and variables
    //////////////////////////////////////////////////
    var base_path = '';
    var volt_php_file = 'includes/volt-core.php';
    var login = false;
    var authorization_editor = false;
    var csrfToken = '';
    var editor;
    var storedImages = [];
    var volt_content = 'volt-content-';
    var volt_blog_item = 'volt-blog-item-';
    var blankRegex = /\s+/g;
    var charRegex = /[^a-z0-9_\-]+/g;
    var emptyParagraphRegex = /<p>(|\s+)<\/p>/;
    var sanitizeString = function (value) {
        value = value.trim();
        value = value.toLowerCase();
        value = value.replace(blankRegex, '-');
        value = value.replace(charRegex, '');
        return value;
    }
    var blogActive = Boolean($('.volt-blog').length);
    var blogModalActive = Boolean($('.volt-blog').length && $('.volt-blog-modal').length);
    var blogModal;
    if (blogModalActive) {
        blogModal = new bootstrap.Modal($('.volt-blog-modal').parent().parent()[0], {
            backdrop: 'static',
            keyboard: false,
            focus: false
        })
    }

    if (localhost_preview === '1' &&
        is_preview === 'true' &&
        baseURL !== 'http://setTheBaseURLInProjectSettings.com/') {
        localhost_preview = true;
        base_path = baseURL + volt_php_file;
    } else {
        localhost_preview = false;
        base_path = '/' + volt_php_file;
    }
    redirect_root = redirect_root === '1';
    lightbox_captions = lightbox_captions === '1';
    language = language.indexOf('%') === -1 ? language : 'en';
    styles_img = styles_img.indexOf('%') === -1 ? styles_img : '';
    styles_p = styles_p.indexOf('%') === -1 ? styles_p : '';

    $.ajaxSetup({
        cache: false
    });

    //////////////////////////////////////////////////
    // check for login state
    //////////////////////////////////////////////////
    $.ajax({
        url: base_path,
        data: {
            api: 'login'
        },
        dataType: 'json',
        beforeSend: function (request) {
            // fetch csrf token
            request.setRequestHeader("X-CSRF-Token", "fetch");
        }
    })
        .done(function (response, status, xhr) {
            if (response.login) {
                login = true;
                toggleLoginForm(false, true, false, response.username);
                // TODO
                if (response.editor) {
                    authorization_editor = true;
                    initializeEditor();
                    initializeStoredImages();
                    editor.init('.volt-content, .volt-blog-content', 'data-name');
                    afterEditorInit();
                }
            } else {
                toggleLoginForm(true, false, false, response.username);
            }
            // store csrf token
            csrfToken = xhr.getResponseHeader("X-CSRF-Token");
            loadContentJS(authorization_editor);
        })
        .fail(function () {
            // Blocs preview mode
            toggleLoginForm(true, true, true, 'username');
            afterEditorInit();
            if (localhost_preview) {
                loadContentJS(authorization_editor);
                if (blogActive) {
                    loadBlogJS();
                }
            }
        });

    //////////////////////////////////////////////////
    // blog items
    //////////////////////////////////////////////////
    if ($('.volt-blog-item-detail').length) {
        // share icons
        if ($('.volt-blog-item-share-detail').length && $('.volt-blog-share').length) {
            var permalink = $('.volt-blog-item-detail').attr('data-item-permalink');
            var title = $('.volt-blog-item-detail').attr('data-item-title');
            html = $('.volt-blog-share').html().replace(/&amp;/gi, '&').replace(/\$\{permalink\}/gi, permalink).replace(/\$\{title\}/gi, title);
            $('.volt-blog-item-share-detail').html(html);
        }
    }

    //////////////////////////////////////////////////
    // recent posts
    //////////////////////////////////////////////////
    if ($('.volt-recent-posts').length) {
        function generateRecentPosts(value) {
            return function(data) {
                var html = [],
                i = 0;
                var items = parseInt(value.attr('data-blog-items'));
                var start = parseInt(value.attr('data-blog-start') - 1);
                items = items + start;
                var url = value.find('.volt-recent-posts-link').attr('href') + "?feed=rss";
                var query = value.attr('data-blog-query');
                if (query) {
                    url = url + "&" + query;
                }
                if (localhost_preview) {
                    url = baseURL + url.replace('.php', '/');
                }
                var layout = value.attr('data-blog-layout');
                var css_wrapper = '';
                var css_item = '';
                switch (layout) {
                    case '1 Column':
                        break;
                    case 'Bootstrap 2 Columns':
                        css_wrapper = 'row';
                        css_item = 'col-12 col-md-6';
                        break;
                    case 'Bootstrap 3 Columns':
                        css_wrapper = 'row';
                        css_item = 'col-12 col-md-6 col-lg-4';
                        break;
                    case 'Bootstrap 4 Columns':
                        css_wrapper = 'row';
                        css_item = 'col-12 col-md-6 col-lg-4 col-xl-3';
                        break;
                    case 'Bootstrap 6 Columns':
                        css_wrapper = 'row';
                        css_item = 'col-12 col-md-6 col-lg-3 col-xl-2';
                        break;
                    default:
                        break;
                }
                var image = Boolean(parseInt(value.attr('data-blog-image')));
                var link = Boolean(parseInt(value.attr('data-blog-link')));
                var description = Boolean(parseInt(value.attr('data-blog-description')));
                var date = Boolean(parseInt(value.attr('data-blog-date')));
                value.addClass(css_wrapper);
                $(data).find("item").each(function () {
                    if (start <= i) {
                        var item = $(this);
                        html.push('<div class="volt-recent-posts-item-wrapper ' + css_item + '"><div class="volt-recent-posts-item">');
                        if (image && item.find('content\\:encoded').length > 0) {
                            html.push('<div class="volt-recent-posts-item-header">');
                            if (link) {
                                html.push('<a href="' + item.find('link').text() + '">' + item.find('content\\:encoded').text() + '</a>');
                            } else {
                                item.find('content\\:encoded').text()
                            }
                            html.push('</div>');
                        }
                        if (date) {
                            html.push('<div class="volt-recent-posts-item-date">' + item.find('pubDateFormat').text() + '</div>');
                        }
                        html.push('<h3 class="volt-recent-posts-item-title mt-2">');
                        if (link) {
                            html.push('<a class="volt-recent-posts-item-title-link" href="' + item.find('link').text() + '">' + item.find('title').text() + '</a>');
                        } else {
                            html.push(item.find('title').text());
                        }
                        html.push('</h3>');
                        if (description) {
                            html.push('<div class="volt-recent-posts-item-body"><p>' + item.find('description').text() + '</p></div>');
                        }
                        html.push('</div></div>');
                    }
                    i++;
                    if (i === items) {
                        return false;
                    }
                });
                value.html(html.join(''));
            }
        };

        $.each($('.volt-recent-posts'), function(index, value){
            value = $(this);
            var url = value.find('.volt-recent-posts-link').attr('href') + "?feed=rss";
            var query = value.attr('data-blog-query');
            if (query) {
                url = url + "&" + query;
            }
            if (localhost_preview) {
                url = baseURL + url.replace('.php', '/');
            }
            $.ajax({
                url: url,
                dataType: 'xml',
                success: generateRecentPosts(value)
            })
        });
    }

    //////////////////////////////////////////////////
    // functions
    //////////////////////////////////////////////////
    var initializeStoredImages = function () {
        storedImages = [];
        $.ajax({
            url: base_path,
            data: {
                api: 'image'
            }
        })
            .done(function (response) {
                if (response && response.image) {
                    $.each(response.image, function (index, val) {
                        if (val.url) {
                            storedImages.push(val.url);
                        }
                    });
                }
            });
    }

    var initializeJSforContent = function () {
        var voltGallery = $('.volt-gallery');
        if (voltGallery.length) {
            voltGallery.each(function (index, value) {
                // add id to all galleries for later accesss
                var id = 'volt-gallery-' + index;
                $(this).attr('id', id);
                // check if attribute data-gallery-layout is existing, if not, add default value flexbox
                if (!$(this).attr('data-gallery-layout')) {
                    $(this).attr('data-gallery-layout', 'flexbox');
                }
                // if carousel, add max-heigth none to images
                // build html for carousel
                if ($(this).attr('data-gallery-layout') == 'carousel') {
                    $(this).addClass('carousel');
                    $(this).addClass('slide');
                    $(this).attr('data-ride', 'carousel');
                    $(this).attr('data-bs-ride', 'carousel');
                    var captions = false;
                    if (this.dataset.galleryLightboxCaptions == 1) {
                        captions = true;
                    }
                    var interval = 5000;
                    if (this.dataset.galleryCarouselInterval) {
                        interval = parseInt(this.dataset.galleryCarouselInterval) * 1000;
                    }
                    var html = '<ol class="carousel-indicators">';
                    var images = $(this).find('img');
                    $(images).each(function (index, value) {
                        if (index == 0) {
                            html = html + '<li data-target="#' + id + '" data-bs-target="#' + id + '" data-slide-to="' + index + '" data-bs-slide-to="' + index + '" class="active"></li>';
                        } else {
                            html = html + '<li data-target="#' + id + '" data-bs-target="#' + id + '" data-slide-to="' + index + '" data-bs-slide-to="' + index + '" class=""></li>';
                        }
                    });
                    html = html + '</ol><div class="carousel-inner" role="listbox">';
                    $(images).each(function (index, value) {
                        if (index == 0) {
                            html = html + '<div class="carousel-item active">';
                        } else {
                            html = html + '<div class="carousel-item">';
                        }
                        var img = $(this),
                            href = img.attr('src'),
                            caption = img.attr('alt');
                        html = html + '<img class="d-inline-block w-100 img-fluid" alt="' + caption + '" src="' + href + '">';
                        if (captions) {
                            html = html + '<div class="carousel-caption d-none d-md-block"><p>' + caption + '</p></div>'
                        }
                        html = html + '</div>';
                    });
                    html = html + '</div></div><a class="carousel-nav-controls carousel-control-prev" href="#' + id + '" role="button" data-slide="prev" data-bs-slide="prev">' +
                        '<span class="fa fa-chevron-left"></span><span class="sr-only">Previous</span></a>' +
                        '<a class="carousel-nav-controls carousel-control-next" href="#' + id + '" role="button" data-slide="next" data-bs-slide="next">' +
                        '<span class="fa fa-chevron-right"></span><span class="sr-only">Next</span></a></div>';
                    $(this).html(html);
                    $(this).carousel({
                        interval: interval
                    });
                }
                // if not carousel, add attribute data-gallery-lightbox with value baguetteBox for later initialization
                // build html for lightbox
                if ($(this).attr('data-gallery-layout') !== 'carousel') {
                    $(this).attr('data-gallery-lightbox', 'baguetteBox');
                    $(this).find('img').each(function () {
                        var img = $(this),
                            href = img.attr('src'),
                            caption = img.attr('alt');
                        img.wrap('<a href="' + href + '" data-caption="' + caption + '"></a>');
                    });
                }
            });
            $('[data-gallery-lightbox="baguetteBox"]').each(function (index, value) {
                var captions = false;
                if (this.dataset.galleryLightboxCaptions == 1) {
                    captions = true;
                }
                baguetteBox.run('#' + this.id, {
                    captions: captions,
                    overlayBackgroundColor: lightbox_color,
                    noScrollbars: true
                    // animation: 'slideIn',
                    // filter: /.+\.(gif|jpe?g|png|webp)|unsplash/i
                });
            });
            $('[data-gallery-layout="masonry"]').each(function (index, value) {
                new Macy({
                    container: '#' + this.id,
                    mobileFirst: true,
                    columns: 2,
                    margin: {
                        y: 10,
                        x: 10,
                    },
                    breakAt: {
                        1200: 5,
                        992: 4,
                        768: 3,
                        576: 2
                    },
                });
            });
        }

        var voltBlog = $('.volt-blog-layout-masonry-2');
        if (voltBlog.length) {
            new Macy({
                container: '.volt-blog-layout-masonry-2',
                mobileFirst: true,
                columns: 1,
                margin: {
                    y: 16,
                    x: 16,
                },
                breakAt: {
                    1200: 2,
                    992: 2,
                    768: 2,
                    576: 1
                },
            });
        }

        var voltBlog = $('.volt-blog-layout-masonry-3');
        if (voltBlog.length) {
            new Macy({
                container: '.volt-blog-layout-masonry-3',
                mobileFirst: true,
                columns: 1,
                margin: {
                    y: 16,
                    x: 16,
                },
                breakAt: {
                    1200: 3,
                    992: 3,
                    768: 2,
                    576: 1
                },
            });
        }

        var voltBlog = $('.volt-blog-layout-masonry-4');
        if (voltBlog.length) {
            new Macy({
                container: '.volt-blog-layout-masonry-4',
                mobileFirst: true,
                columns: 1,
                margin: {
                    y: 16,
                    x: 16,
                },
                breakAt: {
                    1200: 4,
                    992: 3,
                    768: 2,
                    576: 1
                },
            });
        }

        var voltLightbox = $('.volt-lightbox');
        if (voltLightbox.length) {
            voltLightbox.each(function () {
                var img = $(this),
                    href = img.attr('src'),
                    caption = img.attr('alt');
                if (img.parent().parent().hasClass('volt-gallery')) {
                    img.removeClass('volt-lightbox');
                } else {
                    img.wrap('<div class="volt-lightbox"><a href="' + href + '" data-caption="' + caption + '"></a></div>');
                }
            });
            baguetteBox.run('.volt-lightbox', {
                captions: lightbox_captions,
                overlayBackgroundColor: lightbox_color,
                noScrollbars: true
            });
        }

        reframe('iframe[class*="volt-reframe"]');
        $('iframe[class*="volt-reframe"]').each(function(index, value) {
            $(value.parentElement).addClass(value.className);
        });

        $('body .img-protected').on('contextmenu', function (t) {
            return !1
        }),
            $('.img-protected').mousedown(function (t) {
                t.preventDefault()
            })

        if ($('.twitter-tweet').length) {
            jQuery.ajax({
                url: 'https://platform.twitter.com/widgets.js',
                dataType: 'script',
                async: true
            });
        }

        if ($('.instagram-media').length) {
            jQuery.ajax({
                url: 'https://www.instagram.com/embed.js',
                dataType: 'script',
                async: true
            });
        }

        var hashIndex = window.location.href.indexOf('#');
        if (hashIndex > -1 && scrollToTarget) {
            scrollToTarget(window.location.href.substring(hashIndex));
        }

    }

    var splitStyles = function (styles, tags) {
        var result = [];
        styles = styles.replace(blankRegex, '').split(',');
        styles.forEach(function (value, index) {
            if (value.indexOf(':') != -1) {
                result.push(new ContentTools.Style(value.substring(0, value.indexOf(':')), value.substring(value.indexOf(':') + 1), tags));
            } else {
                result.push(new ContentTools.Style(value, value, tags));
            }
        });
        return result;
    }

    var initializeStyles = function () {
        ContentTools.StylePalette.add([
            new ContentTools.Style(ContentEdit._('Margin medium'), 'mb-3', ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'li', 'ol', 'ul', 'img', 'iframe']),
            new ContentTools.Style(ContentEdit._('Margin large'), 'mb-5', ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'li', 'ol', 'ul', 'img', 'iframe']),
            new ContentTools.Style(ContentEdit._('Column Layout'), 'volt-column-layout', ['p']),
            new ContentTools.Style(ContentEdit._('Lightbox'), 'volt-lightbox', ['img']),
            new ContentTools.Style(ContentEdit._('Image Protection'), 'img-protected', ['img']),
            new ContentTools.Style(ContentEdit._('Responsive Video'), 'volt-reframe', ['iframe'])
        ]);
        if (styles_img) {
            ContentTools.StylePalette.add(splitStyles(styles_img, ['img']));
        }
        if (styles_p) {
            ContentTools.StylePalette.add(splitStyles(styles_p, ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p']));
        }
    }

    var initializeEditor = function () {
        //////////////////////////////////////////////////
        // editor styles and language configuration
        //////////////////////////////////////////////////
        if (!editor) {
            if (language != 'en') {
                if (language == 'browser') {
                    if (navigator.language && navigator.language.length >= 2) {
                        language = navigator.language.substring(0, 2).toLowerCase();
                    } else {
                        language == 'en';
                    }
                }
                if (language != 'en') {
                    $.ajax({
                        url: '/js/volt-editor-i18n.json',
                        dataType: 'json'
                    })
                        .done(function (response) {
                            if (response.hasOwnProperty(language)) {
                                ContentEdit.addTranslations(language, response[language]);
                                ContentEdit.LANGUAGE = language;
                                initializeStyles();
                            } else {
                                initializeStyles();
                            }
                        });
                } else {
                    initializeStyles();
                }
            } else {
                initializeStyles();
            }
        }

        //////////////////////////////////////////////////
        // editor initialization
        //////////////////////////////////////////////////
        editor = ContentTools.EditorApp.get();

        // Triggered when the editor saves the page. The event includes the passive key/value.
        editor.addEventListener('saved', function (ev) {
            var name, payload, regions, passive, xhr;

            // Check that something changed
            regions = ev.detail().regions;
            passive = ev.detail().passive;
            var regionsChanged = Object.keys(regions).length > 0;
            if (!regionsChanged && !blogModalActive) {
                return;
            }

            var blogItem;
            if (blogModalActive) {
                if (validateBlogItemInput()) {
                    blogItem = {};
                    blogItem['volt-blog-item-title'] = $('[data-name=volt-blog-item-title]').val();
                    if ($('.volt-blog-modal').attr('data-item-id')) {
                        blogItem['volt-blog-item-id'] = $('.volt-blog-modal').attr('data-item-id');
                    }
                    blogItem['volt-blog-item-blog-id'] = $('.volt-blog').attr('data-blog-id');
                    blogItem['volt-blog-item-slug'] = $('[data-name=volt-blog-item-slug]').val();
                    blogItem['volt-blog-item-date'] = $('[data-name=volt-blog-item-date]').val() + 'T' + $('[data-name=volt-blog-item-time]').val();
                    blogItem['volt-blog-item-draft'] = $('[data-name=volt-blog-item-draft]').prop('checked');
                    blogItem['volt-blog-item-categories'] = $('[data-name=volt-blog-item-categories]').val();
                    blogItem['volt-blog-item-authors'] = $('[data-name=volt-blog-item-authors]').val();
                    blogItem['volt-blog-item-description'] = $('[data-name=volt-blog-item-description]').val();
                    var tempRegions;
                    if (passive && editor.history._snapshots.length > 0) {
                        tempRegions = editor.history._snapshots[editor.history._snapshotIndex].regions;
                    } else {
                        passive = false;
                    }
                    if (regions['volt-blog-item-header']) {
                        if (emptyParagraphRegex.test(regions['volt-blog-item-header'])) {
                            blogItem['volt-blog-item-header'] = '';
                        } else {
                            blogItem['volt-blog-item-header'] = regions['volt-blog-item-header'];
                        }
                    } else if (passive && tempRegions['volt-blog-item-header']) {
                        if (emptyParagraphRegex.test(tempRegions['volt-blog-item-header'])) {
                            blogItem['volt-blog-item-header'] = '';
                        } else {
                            blogItem['volt-blog-item-header'] = tempRegions['volt-blog-item-header'];
                        }
                    }
                    if (regions['volt-blog-item-summary']) {
                        blogItem['volt-blog-item-summary'] = regions['volt-blog-item-summary'];
                    } else if (passive && tempRegions['volt-blog-item-summary']) {
                        blogItem['volt-blog-item-summary'] = tempRegions['volt-blog-item-summary'];
                    }
                    if (regions['volt-blog-item-main']) {
                        blogItem['volt-blog-item-main'] = regions['volt-blog-item-main'];
                    } else if (passive && tempRegions['volt-blog-item-main']) {
                        blogItem['volt-blog-item-main'] = tempRegions['volt-blog-item-main'];
                    }
                    if ($('[data-name=volt-blog-item-gallery-layout]')) {
                        if (regions['volt-blog-item-gallery']) {
                            blogItem['volt-blog-item-gallery'] = regions['volt-blog-item-gallery'];
                        } else if (passive && tempRegions['volt-blog-item-gallery']) {
                            blogItem['volt-blog-item-gallery'] = tempRegions['volt-blog-item-gallery'];
                        }
                        blogItem['volt-blog-item-gallery-layout'] = $('[data-name=volt-blog-item-gallery-layout]').val();
                        blogItem['volt-blog-item-gallery-lightbox-captions'] = $('[data-name=volt-blog-item-gallery-lightbox-captions]').prop('checked');
                        blogItem['volt-blog-item-gallery-carousel-interval'] = $('[data-name=volt-blog-item-gallery-carousel-interval]').val();
                    }
                }
            }

            if (regionsChanged || blogItem) {
                // Set the editor as busy while we save our changes
                this.busy(true);

                if (regionsChanged) {
                    // Collect the contents of each region into a FormData instance
                    payload = new FormData();
                    for (name in regions) {
                        if (regions.hasOwnProperty(name)) {
                            payload.append(volt_content + name, regions[name]);
                        }
                    }
                    $.ajax({
                        type: 'POST',
                        url: base_path + '?api=content',
                        data: payload,
                        contentType: false,
                        processData: false
                    })
                        .done(function () {
                            editor.busy(false);
                            new ContentTools.FlashUI('ok');
                        })
                        .fail(function () {
                            editor.busy(false);
                            new ContentTools.FlashUI('no');
                        });
                }

                if (blogItem) {
                    $.ajax({
                        type: 'POST',
                        url: base_path + '?api=blog',
                        data: blogItem,
                    })
                        .done(function (response) {
                            if (ev._detail.passive) {
                                editor.busy(false);
                                new ContentTools.FlashUI('ok');
                                $('.volt-blog-modal').attr('data-item-id', response._id);
                            } else {
                                location.reload();
                            }
                        })
                        .fail(function () {
                            editor.busy(false);
                            new ContentTools.FlashUI('no');
                        });
                }
            }

        });

        // Triggered when the editor is started.
        editor.addEventListener('start', function (ev) {
            if (blogModalActive) {
                $('.ct-ignition__button--blog').hide();
                $('.volt-blog-item-action a').css('display', 'none');
            }
        });

        // Triggered when the editor is stopped. The event includes the save key/value.
        editor.addEventListener('stop', function (ev) {
            if (blogModalActive) {
                $('.ct-ignition__button--blog').css('display', 'block')
                $('.volt-blog-item-action a').fadeIn('slow').css('display', 'inline-block');
            }
        });

        // upload image
        ContentTools.IMAGE_UPLOADER = function (dialog) {
            var image, xhr, xhrComplete, xhrProgress;

            if (storedImages) {
                dialog.addImages(storedImages);
            }

            // Set up the event handlers
            dialog.addEventListener('imageuploader.cancelupload', function () {
                // Cancel the current upload

                // Stop the upload
                if (xhr) {
                    xhr.upload.removeEventListener('progress', xhrProgress);
                    xhr.removeEventListener('readystatechange', xhrComplete);
                    xhr.abort();
                }

                // Set the dialog to empty
                dialog.state('empty');
            });

            // delete image
            dialog.addEventListener('imageuploader.clear', function () {
                var name = this._imageURL.substring(this._imageURL.lastIndexOf('/') + 1);
                $.ajax({
                    type: 'DELETE',
                    url: base_path + '?api=image&name=' + name
                });

                // Clear the current image
                dialog.clear();
                image = null;
            });

            // upload image
            dialog.addEventListener('imageuploader.fileready', function (ev) {

                // Upload a file to the server
                var formData;
                var file = ev.detail().file;

                // Define functions to handle upload progress and completion
                xhrProgress = function (ev) {
                    // Set the progress for the upload
                    dialog.progress((ev.loaded / ev.total) * 100);
                }

                xhrComplete = function (ev) {
                    var response;

                    // Check the request is complete
                    if (ev.target.readyState != 4) {
                        return;
                    }

                    // Clear the request
                    xhr = null
                    xhrProgress = null
                    xhrComplete = null

                    // Handle the result of the upload
                    if (parseInt(ev.target.status) == 200) {
                        // Unpack the response (from JSON)
                        response = JSON.parse(ev.target.responseText);

                        // Store the image details
                        image = {
                            size: response.size,
                            url: response.url
                        };

                        // Populate the dialog
                        dialog.populate(image.url, image.size);

                    } else {
                        // The request failed, notify the user
                        new ContentTools.FlashUI('no');
                    }
                }

                // Set the dialog state to uploading and reset the progress bar to 0
                dialog.state('uploading');
                dialog.progress(0);

                // Build the form data to post to the server
                formData = new FormData();
                formData.append('image', file);

                // Make the request
                xhr = new XMLHttpRequest();
                xhr.upload.addEventListener('progress', xhrProgress);
                xhr.addEventListener('readystatechange', xhrComplete);
                xhr.open('POST', base_path + '?api=image', true);
                xhr.send(formData);
            });

            // insert image
            dialog.addEventListener('imageuploader.save', function () {
                dialog.save(this._imageURL, this._imageSize, {
                    'alt': this._imageURL.substring(this._imageURL.lastIndexOf('/') + 1, this._imageURL.lastIndexOf('.'))
                });
                initializeStoredImages();
            });

        }
    }

    //////////////////////////////////////////////////
    // content regions highlighting
    //////////////////////////////////////////////////
    var loadContentJS = function (authorization_editor) {
        var load = [];
        $('.volt-content').each(function (index, element) {
            if (element.dataset.name) {
                var data = {
                    api: 'content',
                    name: element.dataset.name
                }
                // loadBlogJS will be called in all cases, if localhost_preview = true or false
                if (localhost_preview) {
                    data.localhost_preview = true;
                }
                load.push(
                    $.ajax({
                        url: base_path,
                        data: data
                    })
                        .done(function (response) {
                            element.innerHTML = response;
                        })
                );
            }
        });
        if (!authorization_editor) {
            if (load.length > 0) {
                $.when.apply($, load).then(initializeJSforContent);
            } else if (blogActive) {
                initializeJSforContent();
            }
        }
    }

    var loadBlogJS = function () {
        $('.volt-blog').each(function (index, element) {
            $.ajax({
                url: base_path,
                data: {
                    'api': 'blog',
                    'blog-id': element.dataset.blogId,
                    'blog-items': element.dataset.blogItems,
                    'blog-layout': element.dataset.blogLayout,
                    'blog-date-pattern': element.dataset.blogDatePattern,
                    'blog-hide-future-items': element.dataset.blogHideFutureItems,
                    'blog-author-text': element.dataset.blogAuthorText,
                    'blog-category-text': element.dataset.blogCategoryText,
                    'blog-tag-text': element.dataset.blogTagText,
                    'blog-separator-text': element.dataset.blogSeparatorText,
                    'blog-readmore-text': element.dataset.blogReadmoreText,
                    'blog-back-text': element.dataset.blogBackText,
                    'blog-prev-post-text': element.dataset.blogPrevPostText,
                    'blog-next-post-text': element.dataset.blogNextPostText,
                    'blog-prev-page-text': element.dataset.blogPrevPageText,
                    'blog-next-page-text': element.dataset.blogNextPageText,
                    'blog-heading-list': element.dataset.blogHeadingList,
                    'blog-heading-detail': element.dataset.blogHeadingDetail,
                    'blog-metadata-display': element.dataset.blogMetadataDisplay,
                    'blog-share-display': element.dataset.blogShareDisplay,
                    // loadBlogJS will only be called if localhost_preview = true
                    localhost_preview: true
                }
            })
                .done(function (response) {
                    element.innerHTML = response;
                })
        });
    }

    var afterEditorInit = function () {
        $('.volt-content').each(function (index, element) {
            if (!element.dataset.name) {
                delete element.dataset.editable;
                if (element.className.indexOf('gallery') !== -1) {
                    element.dataset.error = 'Gallery Name Missing';
                } else {
                    element.dataset.error = 'Content Name Missing';
                }
            }
        });
        $('.volt-content').each(function (index, element) {
            if (element.dataset.name) {
                $(element).addClass('volt-content-editor-start');
            } else {
                $(element).addClass('volt-content-editor-error');
            }
        });
        $('.ct-ignition__button--logout').click(function (e) {
            performLogout(e);
        });
        if (blogModalActive) {
            $('.volt-blog-modal').parent().addClass('modal-xl');
            if ($('[data-name=volt-blog-item-time]').length) {
                $('[data-name=volt-blog-item-time]').prop('type', 'time');
            }
            // must be called in after init
            $('.volt-blog-item').each(function (index, el) {
                if ($(this).attr('data-item-readonly')) {
                    $(this).append('<div class="volt-blog-item-action mt-2"><a class="volt-blog-item-copy" data-name="volt-blog-item-copy"></a></div>');
                } else {
                    $(this).append('<div class="volt-blog-item-action mt-2"><a class="volt-blog-item-edit" data-name="volt-blog-item-edit"></a><a class="volt-blog-item-delete" data-name="volt-blog-item-delete"></a><a class="volt-blog-item-copy" data-name="volt-blog-item-copy"></a></div>');
                }
            });
            $('.ct-ignition__button--blog').show();
            $('.volt-blog-item-action a').fadeIn('slow').css('display', 'inline-block');
            $('.ct-ignition__button--blog').click(function (e) {
                createBlogItem(e);
            });
            $('[data-name=volt-blog-item-edit]').click(function (e) {
                editBlogItem(e);
            });
            $('[data-name=volt-blog-item-delete]').click(function (e) {
                deleteBlogItem(e);
            });
            $('[data-name=volt-blog-item-copy]').click(function (e) {
                copyBlogItem(e);
            });
            $('[data-name=volt-blog-item-save]').click(function (e) {
                saveBlogItem(e, true);
            });
            $('[data-name=volt-blog-item-save-close]').click(function (e) {
                saveBlogItem(e, false);
            });
            $('[data-name=volt-blog-item-cancel]').click(function (e) {
                cancelBlogItem(e);
            });
        }
    }

    //////////////////////////////////////////////////
    // login and logout forms
    //////////////////////////////////////////////////
    var toggleLoginForm = function (showLoginForm, showLogoutForm, showAlert, username) {
        if (showLoginForm) {
            $('.volt-login-form').show();
        } else {
            $('.volt-login-form').hide();
        }
        if (showLogoutForm) {
            $('.volt-logout-form').show();
        } else {
            $('.volt-logout-form').hide();
        }
        if (showAlert) {
            $('.volt-login-alert').show();
        } else {
            $('.volt-login-alert').hide();
        }
        if (username) {
            $('.volt-login-username').show();
        } else {
            $('.volt-login-username').hide();
        }
        $('.volt-login-username').text(username);
    }

    var performLogin = function (e) {
        e.stopPropagation();
        e.preventDefault();
        var username = $('[name=username]').val();
        var password = $('[name=password]').val();
        $.ajax({
            type: 'POST',
            url: base_path,
            data: {
                api: 'login',
                username: username,
                password: password
            },
            dataType: 'json',
            beforeSend: function (request) {
                // send csrf token
                request.setRequestHeader("X-CSRF-Token", csrfToken);
            }
        })
            .done(function (response) {
                if (response.login) {
                    if (location.search.indexOf('ref') != -1) {
                        window.location.href = location.search.substring(location.search.indexOf('ref=') + 4)
                    } else if (redirect_root) {
                        window.location.href = '/';
                    } else {
                        location.reload();
                    }
                }
            })
            .fail(function (response) {
                login = false;
                toggleLoginForm(true, false, true, response.username);
            });
    }

    var performLogout = function (e) {
        e.stopPropagation();
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: base_path,
            data: {
                api: 'logout'
            },
            dataType: 'json'
        })
            .always(function () {
                location.reload();
            });
    }

    $('[name=submit_login]').click(function (e) {
        performLogin(e);
    });
    $('[name=username]').keypress(function (e) {
        if (e.which == 13) {
            performLogin(e);
        }
    });
    $('[name=password]').keypress(function (e) {
        if (e.which == 13) {
            performLogin(e);
        }
    });
    $('[name=submit_logout]').click(function (e) {
        performLogout(e);
    });

    //////////////////////////////////////////////////
    // blog
    //////////////////////////////////////////////////
    var createBlogItem = function (e) {
        var date = new Date();
        $('[data-name=volt-blog-item-date]').val(getDateString(date));
        $('[data-name=volt-blog-item-time]').val(getTimeString(date));
        $('.ct-ignition').hide();
        if (!editor.isEditing()) {
            editor.start();
        }
        showBlogModal();
    }

    var editBlogItem = function (e) {
        $.ajax({
            url: base_path,
            data: {
                api: 'blog',
                'blog-id': $('.volt-blog').attr('data-blog-id'),
                id: e.target.parentElement.parentElement.dataset.itemId
            }
        })
            .done(function (response) {
                loadBlogItemInput(response);
                $('.ct-ignition').hide();
                if (!editor.isEditing()) {
                    editor.start();
                }
                showBlogModal();
            })
    }

    var deleteBlogItem = function (e) {
        var result = confirm("Delete Post?");
        if (result) {
            $.ajax({
                type: 'DELETE',
                url: base_path + '?api=blog&blog-id=' + $('.volt-blog').attr('data-blog-id') + '&id=' + e.target.parentElement.parentElement.dataset.itemId
            })
                .done(function () {
                    location.reload();
                })
                .fail(function () {
                    new ContentTools.FlashUI('no');
                });
        }
    }

    var saveBlogItem = function (e, passive) {
        if (passive) {
            editor.save(true);
        } else {
            editor.stop(true);
        }
    }

    var cancelBlogItem = function (e) {
        var result = editor.stop(false);
        if (result) {
            location.reload();
        }
    }

    var copyBlogItem = function (e) {
        $.ajax({
            url: base_path,
            data: {
                api: 'blog',
                'blog-id': $('.volt-blog').attr('data-blog-id'),
                id: e.target.parentElement.parentElement.dataset.itemId
            }
        })
            .done(function (response) {
                delete response._id;
                response.title = response.title + ' - Copy';
                var date = new Date();
                response.date = getDateString(date) + 'T' + getTimeString(date);
                loadBlogItemInput(response);
                $('.ct-ignition').hide();
                if (!editor.isEditing()) {
                    editor.start();
                }
                var modified = new Date().getTime();
                if (editor.regions()['volt-blog-item-header']) {
                    editor.regions()['volt-blog-item-header']._modified = modified;
                }
                if (editor.regions()['volt-blog-item-summary']) {
                    editor.regions()['volt-blog-item-summary']._modified = modified;
                }
                if (editor.regions()['volt-blog-item-main']) {
                    editor.regions()['volt-blog-item-main']._modified = modified;
                }
                if (editor.regions()['volt-blog-item-gallery']) {
                    editor.regions()['volt-blog-item-gallery']._modified = modified;
                }
                showBlogModal();
            });
    }

    var showBlogModal = function () {
        $('[data-name=volt-blog-item-title]').removeClass('is-invalid');
        $('[data-name=volt-blog-item-date]').removeClass('is-invalid');
        $('[data-name=volt-blog-item-time]').removeClass('is-invalid');
        blogModal.show();
    }

    var hideBlogModal = function () {
        blogModal.hide();
    }

    var clearBlogItemInput = function () {
        $('[data-name=volt-blog-item-title]').val('');
        $('[data-name=volt-blog-item-slug]').val('');
        $('[data-name=volt-blog-item-date]').val('');
        $('[data-name=volt-blog-item-time]').val('');
        $('[data-name=volt-blog-item-draft]').prop('checked', false);
        $('[data-name=volt-blog-item-categories]').val('');
        $('[data-name=volt-blog-item-authors]').val('');
        $('[data-name=volt-blog-item-description]').val('');
        $('[data-name=volt-blog-item-header]').html('');
        $('[data-name=volt-blog-item-summary]').html('');
        $('[data-name=volt-blog-item-main]').html('');
        if ($('[data-name=volt-blog-item-gallery-layout]')) {
            $('[data-name=volt-blog-item-gallery]').html('');
            $('[data-name=volt-blog-item-gallery-layout]').val('flexbox');
            $('[data-name=volt-blog-item-gallery-lightbox-captions]').prop('checked', false);
            $('[data-name=volt-blog-item-gallery-carousel-interval]').val('5');
        }
    }

    var loadBlogItemInput = function (data) {
        if (data._id) {
            $('.volt-blog-modal').attr('data-item-id', data._id);
        } else {
            $('.volt-blog-modal').removeAttr('data-item-id');
        }
        $('[data-name=volt-blog-item-title]').val(data.title);
        $('[data-name=volt-blog-item-slug]').val(data.slug);
        $('[data-name=volt-blog-item-date]').val(data.date.substring(0, 10));
        $('[data-name=volt-blog-item-time]').val(data.date.substring(11, 16));
        if (data.draft === 'true') {
            $('[data-name=volt-blog-item-draft]').prop('checked', true);
        }
        $('[data-name=volt-blog-item-categories]').val(data.categories);
        $('[data-name=volt-blog-item-authors]').val(data.authors);
        $('[data-name=volt-blog-item-description]').val(data.description);
        if (data.header) {
            $('[data-name=volt-blog-item-header]').html(data.header);
        }
        if (data.summary) {
            $('[data-name=volt-blog-item-summary]').html(data.summary);
        }
        if (data.main) {
            $('[data-name=volt-blog-item-main]').html(data.main);
        }
        if (data['gallery-layout']) {
            if (data.gallery) {
                $('[data-name=volt-blog-item-gallery]').html(data.gallery);
            }
            $('[data-name=volt-blog-item-gallery-layout]').val(data['gallery-layout']);
            if (data['gallery-lightbox-captions'] === 'true') {
                $('[data-name=volt-blog-item-gallery-lightbox-captions]').prop('checked', true);
            }
            $('[data-name=volt-blog-item-gallery-carousel-interval]').val(data['gallery-carousel-interval']);
        }
    }

    var validateBlogItemInput = function (e) {
        var result = true;
        if ($('[data-name=volt-blog-item-title]')[0].checkValidity() && $('[data-name=volt-blog-item-title]').val().trim().length !== 0) {
            $('[data-name=volt-blog-item-title]').removeClass('is-invalid');
        } else {
            result = false;
            $('[data-name=volt-blog-item-title]').addClass('is-invalid');
        }
        if ($('[data-name=volt-blog-item-date]')[0].checkValidity() && $('[data-name=volt-blog-item-date]').val().trim().length === 10) {
            $('[data-name=volt-blog-item-date]').removeClass('is-invalid');
        } else {
            result = false;
            $('[data-name=volt-blog-item-date]').addClass('is-invalid');
        }
        if ($('[data-name=volt-blog-item-time]')[0].checkValidity() && $('[data-name=volt-blog-item-time]').val().trim().length === 5) {
            $('[data-name=volt-blog-item-time]').removeClass('is-invalid');
        } else {
            result = false;
            $('[data-name=volt-blog-item-time]').addClass('is-invalid');
        }
        return result;
    }

    var padLeadingZero = function (string) {
        string = string + '';
        if (string.length === 1) {
            return '0' + string;
        }
        return string;
    }

    var getDateString = function (date) {
        return padLeadingZero(date.getUTCFullYear()) + '-' + padLeadingZero(date.getMonth() + 1) + '-' + padLeadingZero(date.getDate());
    }

    var getTimeString = function (date) {
        return padLeadingZero(date.getHours()) + ':' + padLeadingZero(date.getMinutes());
    }

});
$(function() {
  $('#despam_outerwrapper').css({'display': 'none'});
  window.addEventListener('beforeunload', function() { // desktop refresh
    var formString = formToString($('form'));
    sessionStorage.setItem("despamformdata", formString);  
  });
  window.addEventListener('visibilitychange', function() { // mobile refresh
    if ((document.visibilityState === 'hidden') && (sessionStorage.getItem("despamformdata") === null)) {
      //console.log('Inside VisChange');
      var formString = formToString($('form'));
      sessionStorage.setItem("despamformdata", formString);
    }
  });
  function formToString(filledForm) {
    formObject = new Object;
    filledForm.find("input, select, textarea").each(function() {
      if (this.id) {
        elem = $(this);
        if ((elem.attr("type") == 'checkbox') || (elem.attr("type") == 'radio')) {formObject[this.id] = elem.prop("checked")}
        else {formObject[this.id] = elem.val()}
      }
    });
    formString = JSON.stringify(formObject);
    return formString;
  }
  function stringToForm(formString, unfilledForm) {
    formObject = JSON.parse(formString);
    unfilledForm.find("input, select, textarea").each(function() {
      if (this.id) {
        id = this.id;
        elem = $(this); 
        if ((elem.attr("type") == "checkbox") || (elem.attr("type") == "radio")) {elem.prop("checked", formObject[id])}
        else {elem.val(formObject[id])}
      }
    });
  }
  // Convert stored string to form values & reinsert in form
  if (sessionStorage.getItem("despamformdata") !== null) {
    var storedformdata = sessionStorage.getItem("despamformdata");
    stringToForm(storedformdata, $('form'));
    sessionStorage.removeItem("despamformdata");
  }
  $('button[type="submit"]').on('click', function(e) {
    var dropcol = $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').attr('data-dropcol');
    //console.log('DropCol: ' + dropcol);
    var dropinrcol = $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').attr('data-dropinrcol');
    //console.log('DropInrCol: ' + dropinrcol);
    $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop svg.shapedrop').children().attr({'fill': dropinrcol, 'stroke': dropcol});
    var dsck = $('#despam_outerwrapper').attr('data-despamck');
    if (dsck == 0) {
      e.preventDefault();
      $('#despam_outerwrapper #despam_wrapper').removeClass('editonly');
      $('#despam_outerwrapper').css({'display': 'none'}).removeClass('hidden d-none').slideDown(600);
      var dropht = $('#despamdrop').outerHeight();
      $('#despam_outerwrapper #despam_wrapper #despamshapes .draggable').outerHeight(dropht); // match shapes ht to drop ht
    }
    if (dsck == 1) {$('#despam_outerwrapper').attr('data-despamck', 0)}
    function updateDrop(shapeid) {
      if (shapeid == 'shape_s') {$('#despam_wrapper #despamshapes #despamdrop svg.shapedrop').html('<rect x="10" y="10" rx="10" ry="10" width="80" height="78" fill="'+dropinrcol+'" stroke="'+dropcol+'" stroke-width="6" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="13"></rect>')} // square
      else if (shapeid == 'shape_c') {$('#despam_wrapper #despamshapes #despamdrop svg.shapedrop').html('<circle cx="50" cy="50" r="45" fill="'+dropinrcol+'" stroke="'+dropcol+'" stroke-width="6" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="13"></circle>')} // circle
      else {$('#despam_wrapper #despamshapes #despamdrop svg.shapedrop').html('<path fill="'+dropinrcol+'" stroke="'+dropcol+'" stroke-width="6" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="11" d="M50,12.778,M50,6.778,c-5.006,0,-9.639,3.049,-12.711,8.366L7.23,67.209,c-1.704,2.952,-2.568,5.906,-2.568,8.781,c0.004,7.792,6.288,13.232,15.279,13.232,h60.117,c8.996,0,15.278,-5.441,15.278,-13.232,c0,-2.875,-0.864,-5.829,-2.568,-8.781,L62.708,15.146,C59.639,9.828,55.007,6.778,50,6.778,L50,6.778,z"></path>')} // triangle
    }
    function checkShape(shapeid,eshape) {
      if (shapeid === undefined) {return false;}
      $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').removeClass('hshake');
      var curpg = window.location.href;
      //console.log('Curpg: ' + curpg);
      var diri = window.location.origin+window.location.pathname;
      //console.log('Diri: ' + diri);
      //console.log('Pathname: ' + window.location.pathname);
      var dir = diri.replace(window.location.pathname.split('/').pop(), '');
      //console.log('Dir-PgRemove: ' + dir);
      if (curpg.indexOf('www') == -1) {dir = dir.replace('www.', '')}
      var clurlck = $('body').attr('data-clean-url');
      if (clurlck == 'true') { // Clean urls set on publish
        //console.log('Clean Urls Used');
        var end = '/';
        if (window.location.pathname.substr(-1) === end) {var path1 = window.location.pathname.slice(0, -1)}
        else {var path1 = window.location.pathname}
        //console.log('Path1: ' + path1);
        var fromrootpath = path1.substring(path1.lastIndexOf('/')+1);
        //console.log('Fromrootpath: ' + fromrootpath);
        var pgpath = fromrootpath + '/';
        dir = dir.replace(pgpath, '');
      }
      //console.log('Dir-final: ' + dir);
      var backck = curpg.replace(dir, '');
      //console.log('Backck: ' + backck);
      if (backck.indexOf('/') > -1) {var ckurl = '../includes/despam_ckshape.php'}
      else {var ckurl = 'includes/despam_ckshape.php'}
      //console.log('CkUrl: ' + ckurl);
      obj_shape = {};
      obj_shape['shapeid'] = shapeid;
      var textDatas = new FormData();
      $.each(obj_shape, function(k, v) {textDatas.append(k, v);});
      $.ajax({
        method: 'POST',
        processData: false,
        contentType: false,
        url: ckurl,
        data: textDatas
      })
      .fail (function(XMLHttpRequest, textStatus, error) {
        console.log('Despam: Fail in checkShape');
        console.log('Despam: Fail-textStatus: ' + textStatus);
        console.log('Despam: Fail-Error: ' + error);
      })
      .done(function(data) {
        var shck = data.success;
        if (shck == 'match') { // shape matches
          //$('#despam_outerwrapper').attr('data-despamck', 1);
          //$('button[type="submit"]').trigger('click');
          var formid = $('button[type="submit"]').closest('form').attr('id');
          //console.log('FormID: ' + formid);
          $('#' + formid).submit();
          $('#despam_outerwrapper').delay(400).slideUp(600);
        }
        else { // no match
          $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').addClass('hshake');
          $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').on('animationend webkitAnimationEnd', function() {$('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop svg.shapedrop').html(eshape)});
        }
      });
    }
    $('body').on('dragstart', '.draggable', function(e) {
      e.stopPropagation();
      if ($(this).find('path').attr('id') == 'shape_a') {
        $('#shapeid1').attr('draggable', 'false');
        $('#shapeid2').attr('draggable', 'false');
        $('#shapeid3').attr('draggable', 'false');
        return false;
      }
      $(this).css({'border-color': '#55ba76'}); // # should have a color #
      $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').removeClass('dropped');
    });
    $('body').on('dragend', '.draggable', function(e) {
      e.stopPropagation();
      var myid = $(this).find('path').attr('id')
      var eshape = $('#despam_wrapper #despamshapes #despamdrop svg.shapedrop').html();
      updateDrop(myid);
      $(this).css({'border-color': 'transparent'});
      var now = Date.now();
      var lt = $(this).data("lastime") || now; 
      if (lt > now ) return; // prevent running checkShape during timeout period
      $(this).data('lastime', now + 1000);
      if ($('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').hasClass('dropped')) {checkShape(myid,eshape)}
      else {$('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop svg.shapedrop').html(eshape)}
    });  
    $('body').on('dragover', '#despamdrop', function(e) {
      e.stopPropagation();
      e.preventDefault();
      $(this).css({'background-color': '#c2f2d5'});
    });
    $('body').on('dragleave', '#despamdrop', function(e) {
      e.stopPropagation();
      e.preventDefault();
      $(this).css({'background-color': '#f0f0f0'});
    });
    $('body').on('drop', '#despamdrop', function(e) {
      e.stopPropagation();
      e.preventDefault();
      $(this).css({'background-color': '#f0f0f0'}).addClass('dropped');
    });
    $('body').on('touchstart', '.draggable', function(e) {
      e.preventDefault();
      //console.log('Touchstart Fired');
      var startthis = $(this);
      if (startthis.find('path').attr('id') == 'shape_a') {
        $('#shapeid1').attr('draggable', 'false');
        $('#shapeid2').attr('draggable', 'false');
        $('#shapeid3').attr('draggable', 'false');
         return false;
      }
      var targetpid = $(e.target).parent().attr('id');
      var wd = $(e.target).width();
      var wdt = wd + 8; // add margin-rt
      var scbord = (wd / 100) * 5; // scaled border of svg
      if (targetpid == 'shapeid1') {var offset = -70}
      else if (targetpid == 'shapeid2') {var offset = wdt - 60}
      else if (targetpid == 'shapeid3') {var offset = (2 * wdt) - 50}
      //console.log('Offset: ' + offset);
      var touchcursor = e.target.cloneNode(true);
      touchcursor.style.display = 'block';
      touchcursor.style.position = 'absolute';
      touchcursor.style.opacity = '0.8';
      touchcursor.classList.add('touchcursor');
      var tchstx = e.touches[0].clientX; // start x pos
      sessionStorage.setItem('despam-tchstx', tchstx);
      //console.log('TouchStart-X: ' + e.touches[0].clientX);
      var stlft = offset + 50 + scbord; // start left for cursor
      sessionStorage.setItem('despam-stlft', stlft);
      touchcursor.style.left = stlft + 'px';
      $('#despamshapes').append(touchcursor);
      startthis.css({'border-color': '#55ba76'});
    });
    $('body').on('touchmove', '.draggable', function(e) {
      e.preventDefault();
      //console.log('TouchMove Fired');
      var tchstx = sessionStorage.getItem('despam-tchstx');
      var stlft = parseFloat(sessionStorage.getItem('despam-stlft'));
      var touchmovex = e.changedTouches[0].clientX; // x pos after move
      var elft = parseFloat($('#despamshapes .touchcursor').css('left'));
      //console.log('Elft-Move: ' + elft);
      var diffx = touchmovex - tchstx;
      var nlft = stlft + diffx;
      //console.log('Nlft-Move: ' + nlft);
      $('#despamshapes .touchcursor').css({'left': nlft + 'px'});
      var dropx = $('#despamdrop')[0].getBoundingClientRect().left; // drop left edge x pos
      if (touchmovex >= dropx) {$('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').css({'background-color': '#c2f2d5'})}
    });
    $('body').on('touchend', '.draggable', function(e) {
      e.preventDefault();
      //console.log('TouchEnd Fired');
      sessionStorage.removeItem('despam-tchstx');
      sessionStorage.removeItem('despam-stlft');
      $('#despamshapes .touchcursor').remove();
      var eshape = $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop svg.shapedrop').html();
      var endthis = $(this);
      endthis.css({'border-color': 'transparent'});
      var idck = endthis.find('path').attr('id');
      var drck = endthis.attr('draggable');
      var touchendx = e.changedTouches[0].pageX; // x pos after move
      var dropx = $('#despamdrop')[0].getBoundingClientRect().left; // drop left edge x pos
      if (touchendx >= dropx) {
        $('#despam_outerwrapper #despam_wrapper #despamshapes #despamdrop').css({'background-color': '#f0f0f0'});
        if (idck == 'shape_a' || drck == 'false') {
          $('#shapeid1').attr('draggable', 'false');
          $('#shapeid2').attr('draggable', 'false');
          $('#shapeid3').attr('draggable', 'false');
          return false;
        }
        else {
          updateDrop(idck);
          var now = Date.now();
          var lt = $(this).data("lastime") || now; 
          if (lt > now ) return; // prevent running checkShape during timeout period
          $(this).data('lastime', now + 1000);
          checkShape(idck, eshape);
        } 
      }
    });
  }); // end submit click
  $('#despam_outerwrapper #setupbtns button#despamclean').on('click', function(e) {
    e.preventDefault();
    var curpgc = window.location.href;
    //console.log('CurpgcWin: ' + curpgc);
    var pgname = window.location.pathname.split("/").pop();
    //console.log('PgName: ' + pgname);
    var dirc = window.location.origin+window.location.pathname.replace(pgname, '');
    var rawpgnm = $('#despam_wrapper').attr('data-pgnm');
    //console.log('RawPgNm: ' + rawpgnm);
    if (pgname == '') {
      var pgpathw = rawpgnm + '/';
      pgpathw = pgpathw.toLowerCase();
      dirc = curpgc.replace(pgpathw, '');
    }
    if (curpgc.indexOf('www') == -1) {dirc = dirc.replace('www.', '')}
    var clurlck = $('body').attr('data-clean-url');
    if (clurlck == 'true') { // Clean urls set on publish
      //console.log('in Cleanurls');
      var pgpath = rawpgnm + '/';
      pgpath = pgpath.toLowerCase();
      dirc = dirc.replace(pgpath, '');
      var clurl = '../includes/despam_cleaner.php';
      curpgc = curpgc.replace(dirc, '');
    }
    else { // non-clean urls
      var clurl = 'includes/despam_cleaner.php';
      curpgc = curpgc.replace(dirc, '');
      if (rawpgnm == 'Home') {curpgc = 'index.php'}
    }
    //console.log('Cleanurl-Final: ' + clurl);
    //console.log('CurPgC-Final: ' + curpgc);
    obj_clean = {};
    obj_clean['curpg'] = curpgc;
    var textDatac = new FormData();
    $.each(obj_clean, function(k, v) {textDatac.append(k, v);});
    $.ajax({
      method: 'POST',
      processData: false,
      contentType: false,
      url: clurl,
      data: textDatac
    })
    .fail (function(XMLHttpRequest, textStatus, error) {
      $('#cleanerr-message').hide().removeClass('d-none').fadeIn(400);
      console.log('Despam: Fail in Despam Clean');
      console.log('Despam: Fail-textStatus: ' + textStatus);
      console.log('Despam: Fail-Error: ' + error);  
    })
    .done(function(data) {
      var clck = data.success;
      if (clck == 'done') {
        $('#cleansuc-message').hide().removeClass('d-none').fadeIn(400);
        setTimeout(function() {
          window.location = window.location.href+'?eraseCache=true';
        }, 4000);
      }
      else {
        if (clck == 'prevcleaned') { // previously cleaned & needs new file
          $('#cleanerr-prev').hide().removeClass('d-none').fadeIn(400);
        }
      } 
    });
  });
});
/*!
 * baguetteBox.js
 * @author  feimosi
 * @version 1.11.1
 * @url https://github.com/feimosi/baguetteBox.js
 */
!function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.baguetteBox=t()}(this,function(){"use strict";var r,l,u,c,d,f='<svg width="44" height="60"><polyline points="30 10 10 30 30 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',g='<svg width="44" height="60"><polyline points="14 10 34 30 14 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',p='<svg width="30" height="30"><g stroke="rgb(160,160,160)" stroke-width="4"><line x1="5" y1="5" x2="25" y2="25"/><line x1="5" y1="25" x2="25" y2="5"/></g></svg>',b={},v={captions:!0,buttons:"auto",fullScreen:!1,noScrollbars:!1,bodyClass:"baguetteBox-open",titleTag:!1,async:!1,preload:2,animation:"slideIn",afterShow:null,afterHide:null,onChange:null,overlayBackgroundColor:"rgba(0,0,0,.8)"},m={},h=[],o=0,n=!1,i={},a=!1,y=/.+\.(gif|jpe?g|png|webp)/i,w={},k=[],s=null,x=function(e){-1!==e.target.id.indexOf("baguette-img")&&j()},E=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,D()},C=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,X()},B=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,j()},T=function(e){i.count++,1<i.count&&(i.multitouch=!0),i.startX=e.changedTouches[0].pageX,i.startY=e.changedTouches[0].pageY},N=function(e){if(!a&&!i.multitouch){e.preventDefault?e.preventDefault():e.returnValue=!1;var t=e.touches[0]||e.changedTouches[0];40<t.pageX-i.startX?(a=!0,D()):t.pageX-i.startX<-40?(a=!0,X()):100<i.startY-t.pageY&&j()}},L=function(){i.count--,i.count<=0&&(i.multitouch=!1),a=!1},A=function(){L()},P=function(e){"block"===r.style.display&&r.contains&&!r.contains(e.target)&&(e.stopPropagation(),Y())};function S(e){if(w.hasOwnProperty(e)){var t=w[e].galleries;[].forEach.call(t,function(e){[].forEach.call(e,function(e){W(e.imageElement,"click",e.eventHandler)}),h===e&&(h=[])}),delete w[e]}}function F(e){switch(e.keyCode){case 37:D();break;case 39:X();break;case 27:j();break;case 36:!function t(e){e&&e.preventDefault();return M(0)}(e);break;case 35:!function n(e){e&&e.preventDefault();return M(h.length-1)}(e)}}function H(e,t){if(h!==e){for(h=e,function s(e){e=e||{};for(var t in v)b[t]=v[t],"undefined"!=typeof e[t]&&(b[t]=e[t]);l.style.transition=l.style.webkitTransition="fadeIn"===b.animation?"opacity .4s ease":"slideIn"===b.animation?"":"none","auto"===b.buttons&&("ontouchstart"in window||1===h.length)&&(b.buttons=!1);u.style.display=c.style.display=b.buttons?"":"none";try{r.style.backgroundColor=b.overlayBackgroundColor}catch(n){}}(t);l.firstChild;)l.removeChild(l.firstChild);for(var n,o=[],i=[],a=k.length=0;a<e.length;a++)(n=J("div")).className="full-image",n.id="baguette-img-"+a,k.push(n),o.push("baguetteBox-figure-"+a),i.push("baguetteBox-figcaption-"+a),l.appendChild(k[a]);r.setAttribute("aria-labelledby",o.join(" ")),r.setAttribute("aria-describedby",i.join(" "))}}function I(e){b.noScrollbars&&(document.documentElement.style.overflowY="hidden",document.body.style.overflowY="scroll"),"block"!==r.style.display&&(U(document,"keydown",F),i={count:0,startX:null,startY:null},q(o=e,function(){z(o),V(o)}),R(),r.style.display="block",b.fullScreen&&function t(){r.requestFullscreen?r.requestFullscreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.mozRequestFullScreen&&r.mozRequestFullScreen()}(),setTimeout(function(){r.className="visible",b.bodyClass&&document.body.classList&&document.body.classList.add(b.bodyClass),b.afterShow&&b.afterShow()},50),b.onChange&&b.onChange(o,k.length),s=document.activeElement,Y(),n=!0)}function Y(){b.buttons?u.focus():d.focus()}function j(){b.noScrollbars&&(document.documentElement.style.overflowY="auto",document.body.style.overflowY="auto"),"none"!==r.style.display&&(W(document,"keydown",F),r.className="",setTimeout(function(){r.style.display="none",document.fullscreen&&function e(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}(),b.bodyClass&&document.body.classList&&document.body.classList.remove(b.bodyClass),b.afterHide&&b.afterHide(),s&&s.focus(),n=!1},500))}function q(t,n){var e=k[t],o=h[t];if(void 0!==e&&void 0!==o)if(e.getElementsByTagName("img")[0])n&&n();else{var i=o.imageElement,a=i.getElementsByTagName("img")[0],s="function"==typeof b.captions?b.captions.call(h,i):i.getAttribute("data-caption")||i.title,r=function d(e){var t=e.href;if(e.dataset){var n=[];for(var o in e.dataset)"at-"!==o.substring(0,3)||isNaN(o.substring(3))||(n[o.replace("at-","")]=e.dataset[o]);for(var i=Object.keys(n).sort(function(e,t){return parseInt(e,10)<parseInt(t,10)?-1:1}),a=window.innerWidth*window.devicePixelRatio,s=0;s<i.length-1&&i[s]<a;)s++;t=n[i[s]]||t}return t}(i),l=J("figure");if(l.id="baguetteBox-figure-"+t,l.innerHTML='<div class="baguetteBox-spinner"><div class="baguetteBox-double-bounce1"></div><div class="baguetteBox-double-bounce2"></div></div>',b.captions&&s){var u=J("figcaption");u.id="baguetteBox-figcaption-"+t,u.innerHTML=s,l.appendChild(u)}e.appendChild(l);var c=J("img");c.onload=function(){var e=document.querySelector("#baguette-img-"+t+" .baguetteBox-spinner");l.removeChild(e),!b.async&&n&&n()},c.setAttribute("src",r),c.alt=a&&a.alt||"",b.titleTag&&s&&(c.title=s),l.appendChild(c),b.async&&n&&n()}}function X(){return M(o+1)}function D(){return M(o-1)}function M(e,t){return!n&&0<=e&&e<t.length?(H(t,b),I(e),!0):e<0?(b.animation&&O("left"),!1):e>=k.length?(b.animation&&O("right"),!1):(q(o=e,function(){z(o),V(o)}),R(),b.onChange&&b.onChange(o,k.length),!0)}function O(e){l.className="bounce-from-"+e,setTimeout(function(){l.className=""},400)}function R(){var e=100*-o+"%";"fadeIn"===b.animation?(l.style.opacity=0,setTimeout(function(){m.transforms?l.style.transform=l.style.webkitTransform="translate3d("+e+",0,0)":l.style.left=e,l.style.opacity=1},400)):m.transforms?l.style.transform=l.style.webkitTransform="translate3d("+e+",0,0)":l.style.left=e}function z(e){e-o>=b.preload||q(e+1,function(){z(e+1)})}function V(e){o-e>=b.preload||q(e-1,function(){V(e-1)})}function U(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent("on"+t,function(e){(e=e||window.event).target=e.target||e.srcElement,n(e)})}function W(e,t,n,o){e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent("on"+t,n)}function G(e){return document.getElementById(e)}function J(e){return document.createElement(e)}return[].forEach||(Array.prototype.forEach=function(e,t){for(var n=0;n<this.length;n++)e.call(t,this[n],n,this)}),[].filter||(Array.prototype.filter=function(e,t,n,o,i){for(n=this,o=[],i=0;i<n.length;i++)e.call(t,n[i],i,n)&&o.push(n[i]);return o}),{run:function K(e,t){return m.transforms=function n(){var e=J("div");return"undefined"!=typeof e.style.perspective||"undefined"!=typeof e.style.webkitPerspective}(),m.svg=function o(){var e=J("div");return e.innerHTML="<svg/>","http://www.w3.org/2000/svg"===(e.firstChild&&e.firstChild.namespaceURI)}(),m.passiveEvents=function i(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(n){}return e}(),function a(){if(r=G("baguetteBox-overlay"))return l=G("baguetteBox-slider"),u=G("previous-button"),c=G("next-button"),void(d=G("close-button"));(r=J("div")).setAttribute("role","dialog"),r.id="baguetteBox-overlay",document.getElementsByTagName("body")[0].appendChild(r),(l=J("div")).id="baguetteBox-slider",r.appendChild(l),(u=J("button")).setAttribute("type","button"),u.id="previous-button",u.setAttribute("aria-label","Previous"),u.innerHTML=m.svg?f:"&lt;",r.appendChild(u),(c=J("button")).setAttribute("type","button"),c.id="next-button",c.setAttribute("aria-label","Next"),c.innerHTML=m.svg?g:"&gt;",r.appendChild(c),(d=J("button")).setAttribute("type","button"),d.id="close-button",d.setAttribute("aria-label","Close"),d.innerHTML=m.svg?p:"&times;",r.appendChild(d),u.className=c.className=d.className="baguetteBox-button",function n(){var e=m.passiveEvents?{passive:!1}:null,t=m.passiveEvents?{passive:!0}:null;U(r,"click",x),U(u,"click",E),U(c,"click",C),U(d,"click",B),U(l,"contextmenu",A),U(r,"touchstart",T,t),U(r,"touchmove",N,e),U(r,"touchend",L),U(document,"focus",P,!0)}()}(),S(e),function s(e,a){var t=document.querySelectorAll(e),n={galleries:[],nodeList:t};return w[e]=n,[].forEach.call(t,function(e){a&&a.filter&&(y=a.filter);var t=[];if(t="A"===e.tagName?[e]:e.getElementsByTagName("a"),0!==(t=[].filter.call(t,function(e){if(-1===e.className.indexOf(a&&a.ignoreClass))return y.test(e.href)})).length){var i=[];[].forEach.call(t,function(e,t){var n=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,H(i,a),I(t)},o={eventHandler:n,imageElement:e};U(e,"click",n),i.push(o)}),n.galleries.push(i)}}),n.galleries}(e,t)},show:M,showNext:X,showPrevious:D,hide:j,destroy:function e(){!function n(){var e=m.passiveEvents?{passive:!1}:null,t=m.passiveEvents?{passive:!0}:null;W(r,"click",x),W(u,"click",E),W(c,"click",C),W(d,"click",B),W(l,"contextmenu",A),W(r,"touchstart",T,t),W(r,"touchmove",N,e),W(r,"touchend",L),W(document,"focus",P,!0)}(),function t(){for(var e in w)w.hasOwnProperty(e)&&S(e)}(),W(document,"keydown",F),document.getElementsByTagName("body")[0].removeChild(document.getElementById("baguetteBox-overlay")),w={},h=[],o=0}}});
/*! volt-editor v2.0.4 */
(function(){var a;a={},a.Machine=function(){function a(a){this.context=a,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return a.prototype.addTransition=function(a,b,c,d){return c||(c=b),this._stateTransitions[[a,b]]=[c,d]},a.prototype.addTransitions=function(a,b,c,d){var e,f,g,h;for(c||(c=b),h=[],f=0,g=a.length;f<g;f++)e=a[f],h.push(this.addTransition(e,b,c,d));return h},a.prototype.addTransitionAny=function(a,b,c){return b||(b=a),this._stateTransitionsAny[a]=[b,c]},a.prototype.setDefaultTransition=function(a,b){return this._defaultTransition=[a,b]},a.prototype.getTransition=function(a,b){if(this._stateTransitions[[a,b]])return this._stateTransitions[[a,b]];if(this._stateTransitionsAny[b])return this._stateTransitionsAny[b];if(this._defaultTransition)return this._defaultTransition;throw new Error("Transition is undefined: ("+a+", "+b+")")},a.prototype.getCurrentState=function(){return this._currentState},a.prototype.setInitialState=function(a){if(this._initialState=a,!this._currentState)return this.reset()},a.prototype.reset=function(){return this._currentState=this._initialState},a.prototype.process=function(a){var b;return b=this.getTransition(a,this._currentState),b[1]&&b[1].call(this.context||(this.context=this),a),this._currentState=b[0]},a}(),"undefined"!=typeof window&&(window.FSM=a),"undefined"!=typeof module&&module.exports&&(module.exports=a)}).call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A=[].slice,B=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};r={},"undefined"!=typeof window&&(window.HTMLString=r),"undefined"!=typeof module&&module.exports&&(module.exports=r),r.String=function(){function a(a,b){null==b&&(b=!1),this._preserveWhitespace=b,a?(null===r.String._parser&&(r.String._parser=new z),this.characters=r.String._parser.parse(a,this._preserveWhitespace).characters):this.characters=[]}return a._parser=null,a.prototype.isWhitespace=function(){var a,b,c,d;for(d=this.characters,b=0,c=d.length;b<c;b++)if(a=d[b],!a.isWhitespace())return!1;return!0},a.prototype.length=function(){return this.characters.length},a.prototype.preserveWhitespace=function(){return this._preserveWhitespace},a.prototype.capitalize=function(){var a,b;return b=this.copy(),b.length()&&(a=b.characters[0]._c.toUpperCase(),b.characters[0]._c=a),b},a.prototype.charAt=function(a){return this.characters[a].copy()},a.prototype.concat=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(g=2<=arguments.length?A.call(arguments,0,i=arguments.length-1):(i=0,[]),c=arguments[i++],void 0!==c&&"boolean"!=typeof c&&(g.push(c),c=!0),e=this.copy(),j=0,m=g.length;j<m;j++)if(f=g[j],0!==f.length){if(h=f,"string"==typeof f&&(h=new r.String(f,this._preserveWhitespace)),c&&e.length())for(b=e.charAt(e.length()-1),d=b.tags(),b.isTag()&&d.shift(),"string"!=typeof f&&(h=h.copy()),p=h.characters,k=0,n=p.length;k<n;k++)a=p[k],a.addTags.apply(a,d);for(q=h.characters,l=0,o=q.length;l<o;l++)a=q[l],e.characters.push(a)}return e},a.prototype.contains=function(a){var b,c,d,e,f,g,h;if("string"==typeof a)return this.text().indexOf(a)>-1;for(d=0;d<=this.length()-a.length();){for(c=!0,h=a.characters,e=f=0,g=h.length;f<g;e=++f)if(b=h[e],!b.eq(this.characters[e+d])){c=!1;break}if(c)return!0;d++}return!1},a.prototype.endsWith=function(a){var b,c,d,e,f,g;if("string"==typeof a)return""===a||this.text().slice(-a.length)===a;for(c=this.characters.slice().reverse(),g=a.characters.slice().reverse(),d=e=0,f=g.length;e<f;d=++e)if(b=g[d],!b.eq(c[d]))return!1;return!0},a.prototype.format=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?A.call(arguments,2):[],f<0&&(f=this.length()+f+1),b<0&&(b=this.length()+b),d=this.copy(),c=g=b;b<=f?g<f:g>f;c=b<=f?++g:--g)a=d.characters[c],a.addTags.apply(a,e);return d},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h;for(d=2<=arguments.length?A.call(arguments,0,e=arguments.length-1):(e=0,[]),c=arguments[e++],void 0!==c&&"boolean"!=typeof c&&(d.push(c),c=!1),b=!1,h=this.characters,f=0,g=h.length;f<g;f++)if(a=h[f],a.hasTags.apply(a,d))b=!0;else if(c)return!1;return b},a.prototype.html=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;for(e="",h=[],f=[],c=[],t=this.characters,j=0,n=t.length;j<n;j++){for(a=t[j],c=[],u=h.slice().reverse(),k=0,o=u.length;k<o;k++)if(g=u[k],c.push(g),!a.hasTags(g)){for(l=0,p=c.length;l<p;l++)b=c[l],e+=b.tail(),h.pop(),f.pop();c=[]}for(v=a._tags,m=0,q=v.length;m<q;m++)i=v[m],-1===f.indexOf(i.head())&&(i.selfClosing()||(d=i.head(),e+=d,h.push(i),f.push(d)));a._tags.length>0&&a._tags[0].selfClosing()&&(e+=a._tags[0].head()),e+=a.c()}for(w=h.reverse(),s=0,r=w.length;s<r;s++)i=w[s],e+=i.tail();return e},a.prototype.indexOf=function(a,b){var c,d,e,f,g,h;if(null==b&&(b=0),b<0&&(b=0),"string"==typeof a)return this.text().indexOf(a,b);for(;b<=this.length()-a.length();){for(d=!0,h=a.characters,e=f=0,g=h.length;f<g;e=++f)if(c=h[e],!c.eq(this.characters[e+b])){d=!1;break}if(d)return b;b++}return-1},a.prototype.insert=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t;if(null==c&&(c=!0),e=this.slice(0,a),j=this.slice(a),a<0&&(a=this.length()+a),h=b,"string"==typeof b&&(h=new r.String(b,this._preserveWhitespace)),c&&a>0)for(f=this.charAt(a-1),g=f.tags(),f.isTag()&&g.shift(),"string"!=typeof b&&(h=h.copy()),q=h.characters,k=0,n=q.length;k<n;k++)d=q[k],d.addTags.apply(d,g);for(i=e,s=h.characters,l=0,o=s.length;l<o;l++)d=s[l],i.characters.push(d);for(t=j.characters,m=0,p=t.length;m<p;m++)d=t[m],i.characters.push(d);return i},a.prototype.lastIndexOf=function(a,b){var c,d,e,f,g,h,i,j,k;if(null==b&&(b=0),b<0&&(b=0),d=this.characters.slice(b).reverse(),b=0,"string"==typeof a){if(!this.contains(a))return-1;for(a=a.split("").reverse();b<=d.length-a.length;){for(e=!0,g=0,f=h=0,j=a.length;h<j;f=++h)if(c=a[f],d[f+b].isTag()&&(g+=1),c!==d[g+f+b].c()){e=!1;break}if(e)return b;b++}return-1}for(a=a.characters.slice().reverse();b<=d.length-a.length;){for(e=!0,f=i=0,k=a.length;i<k;f=++i)if(c=a[f],!c.eq(d[f+b])){e=!1;break}if(e)return b;b++}return-1},a.prototype.optimize=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I;for(h=[],f=[],d=null,C=this.characters.slice().reverse(),o=0,s=C.length;o<s;o++){for(a=C[o],a._runLengthMap={},a._runLengthMapSize=0,b=[],D=h.slice().reverse(),p=0,t=D.length;p<t;p++)if(g=D[p],b.push(g),!a.hasTags(g)){for(q=0,u=b.length;q<u;q++)b[q],h.pop(),f.pop();b=[]}for(E=a._tags,r=0,v=E.length;r<v;r++)n=E[r],-1===f.indexOf(n.head())&&(n.selfClosing()||(h.push(n),f.push(n.head())));for(z=0,w=h.length;z<w;z++)n=h[z],c=n.head(),d?(a._runLengthMap[c]||(a._runLengthMap[c]=[n,0]),l=0,d._runLengthMap[c]&&(l=d._runLengthMap[c][1]),a._runLengthMap[c][1]=l+1):a._runLengthMap[c]=[n,1];d=a}for(j=function(a,b){return b[1]-a[1]},F=this.characters,I=[],A=0,x=F.length;A<x;A++)if(a=F[A],!((e=a._tags.length)>0&&a._tags[0].selfClosing()&&e<3||e<2)){k=[],G=a._runLengthMap;for(n in G)i=G[n],k.push(i);for(k.sort(j),H=a._tags.slice(),B=0,y=H.length;B<y;B++)n=H[B],n.selfClosing()||a.removeTags(n);I.push(a.addTags.apply(a,function(){var a,b,c;for(c=[],b=0,a=k.length;b<a;b++)m=k[b],c.push(m[0]);return c}()))}return I},a.prototype.slice=function(a,b){var c,d;return d=new r.String("",this._preserveWhitespace),d.characters=function(){var d,e,f,g;for(f=this.characters.slice(a,b),g=[],d=0,e=f.length;d<e;d++)c=f[d],g.push(c.copy());return g}.call(this),d},a.prototype.split=function(a,b){var c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=""),null==b&&(b=0),h=0,c=0,g=[0];;){if(b>0&&c>b)break;if(-1===(f=this.indexOf(a,h)))break;g.push(f),h=f+1}for(g.push(this.length()),j=[],e=k=0,l=g.length-2;0<=l?k<=l:k>=l;e=0<=l?++k:--k)i=g[e],e>0&&(i+=1),d=g[e+1],j.push(this.slice(i,d));return j},a.prototype.startsWith=function(a){var b,c,d,e,f;if("string"==typeof a)return this.text().slice(0,a.length)===a;for(f=a.characters,c=d=0,e=f.length;d<e;c=++d)if(b=f[c],!b.eq(this.characters[c]))return!1;return!0},a.prototype.substr=function(a,b){return b<=0?new r.String("",this._preserveWhitespace):(a<0&&(a=this.length()+a),void 0===b&&(b=this.length()-a),this.slice(a,a+b))},a.prototype.substring=function(a,b){return void 0===b&&(b=this.length()),this.slice(a,b)},a.prototype.text=function(){var a,b,c,d,e;for(b="",e=this.characters,c=0,d=e.length;c<d;c++)a=e[c],a.isTag()?a.isTag("br")&&(b+="\n"):(a.c(),b+=a.c());return this.constructor.decode(b)},a.prototype.toLowerCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;c<d;c++)a=e[c],1===a._c.length&&(a._c=a._c.toLowerCase());return b},a.prototype.toUpperCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;c<d;c++)a=e[c],1===a._c.length&&(a._c=a._c.toUpperCase());return b},a.prototype.trim=function(){var a,b,c,d,e,f,g,h,i,j;for(i=this.characters,b=e=0,g=i.length;e<g&&(a=i[b],a.isWhitespace());b=++e);for(j=this.characters.slice().reverse(),d=f=0,h=j.length;f<h&&(a=j[d],a.isWhitespace());d=++f);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimLeft=function(){var a,b,c,d,e,f,g;for(d=this.length()-1,g=this.characters,b=e=0,f=g.length;e<f&&(a=g[b],a.isWhitespace());b=++e);return c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimRight=function(){var a,b,c,d,e,f,g;for(b=0,g=this.characters.slice().reverse(),d=e=0,f=g.length;e<f&&(a=g[d],a.isWhitespace());d=++e);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.unformat=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?A.call(arguments,2):[],f<0&&(f=this.length()+f+1),b<0&&(b=this.length()+b),d=this.copy(),c=g=b;b<=f?g<f:g>f;c=b<=f?++g:--g)a=d.characters[c],a.removeTags.apply(a,e);return d},a.prototype.copy=function(){var a,b;return b=new r.String("",this._preserveWhitespace),b.characters=function(){var b,c,d,e;for(d=this.characters,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this),b},a.decode=function(a){var b;return b=document.createElement("textarea"),b.innerHTML=a,b.textContent},a.encode=function(a){var b;return b=document.createElement("textarea"),b.textContent=a,b.innerHTML},a.join=function(a,b){var c,d,e,f;for(c=b.shift(),e=0,f=b.length;e<f;e++)d=b[e],c=c.concat(a,d);return c},a}(),a="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$".split(""),b=a.concat("1234567890".split("")),h=b.concat([":"]),q=b.concat(["#"]),u=b.concat([":"]),n=1,p=2,t=3,s=4,o=5,x=6,v=7,y=8,w=9,j=10,g=11,i=12,c=13,m=14,k=15,l=16,e=17,f=18,d=19,z=function(){function z(){this.fsm=new FSM.Machine(this),this.fsm.setInitialState(n),this.fsm.addTransitionAny(n,null,function(a){return this._pushChar(a)}),this.fsm.addTransition("<",n,t),this.fsm.addTransition("&",n,p),this.fsm.addTransitions(q,p,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",p,n,function(){return this._pushChar("&"+this.entity+";"),this.entity=""}),this.fsm.addTransitions([" ","\n"],t),this.fsm.addTransitions(a,t,s,function(){return this._back()}),this.fsm.addTransition("/",t,o),this.fsm.addTransitions([" ","\n"],s),this.fsm.addTransitions(a,s,x,function(){return this._back()}),this.fsm.addTransitions([" ","\n"],o),this.fsm.addTransitions(a,o,v,function(){return this._back()}),this.fsm.addTransitions(u,x,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],x,j),this.fsm.addTransition("/",x,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",x,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],y),this.fsm.addTransition(">",y,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],j),this.fsm.addTransition("/",j,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",j,n,function(){return this._pushTag()}),this.fsm.addTransitions(a,j,g,function(){return this._back()}),this.fsm.addTransitions(u,v,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],v,w),this.fsm.addTransition(">",v,n,function(){return this._popTag()}),this.fsm.addTransitions([" ","\n"],w),this.fsm.addTransition(">",w,n,function(){return this._popTag()}),this.fsm.addTransitions(h,g,null,function(a){return this.attributeName+=a}),this.fsm.addTransitions([" ","\n"],g,i),this.fsm.addTransition("=",g,c),this.fsm.addTransitions([" ","\n"],i),this.fsm.addTransition("=",i,c),this.fsm.addTransitions(">",g,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(i,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ","\n"],c),this.fsm.addTransition("'",c,m),this.fsm.addTransition('"',c,k),this.fsm.addTransitions(b.concat(["&"],c,l,function(){return this._back()})),this.fsm.addTransition(" ",l,j,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],l,j,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",l,e),this.fsm.addTransitionAny(l,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition("'",m,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",m,f),this.fsm.addTransitionAny(m,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition('"',k,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",k,d),this.fsm.addTransitionAny(k,null,function(a){return this.attributeValue+=a}),this.fsm.addTransitions(q,e,null,function(a){return this.entity+=a}),this.fsm.addTransitions(q,f,function(a){return this.entity+=a}),this.fsm.addTransitions(q,d,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",e,l,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",f,m,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",d,k,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return z.prototype._back=function(){return this.head--},z.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},z.prototype._pushChar=function(a){var b,c;return b=new r.Character(a,this.tags),this._preserveWhitespace?void this.string.characters.push(b):!this.string.length()||b.isTag()||b.isEntity()||!b.isWhitespace()||(c=this.string.characters[this.string.length()-1],!c.isWhitespace()||c.isTag()||c.isEntity())?this.string.characters.push(b):void 0},z.prototype._pushTag=function(){var a,b;return a=new r.Tag(this.tagName,this.attributes),this.tags.push(a),a.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(b=this.tagName,B.call(r.Tag.SELF_CLOSING,b)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},z.prototype._popTag=function(){for(var a,b;;)if(b=this.tags.pop(),this.string.length()&&(a=this.string.characters[this.string.length()-1],a.isTag()||a.isEntity()||!a.isWhitespace()||a.removeTags(b)),b.name()===this.tagName.toLowerCase())break;return this.tagName=""},z.prototype.parse=function(a,b){var c,d;for(this._preserveWhitespace=b,this.reset(),a=this.preprocess(a),this.fsm.parser=this;this.head<a.length;){c=a[this.head];try{this.fsm.process(c)}catch(a){throw d=a,new Error("Error at char "+this.head+" >> "+d)}this.head++}return this.string},z.prototype.preprocess=function(a){return a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),a=a.replace(/<!--[\s\S]*?-->/g,""),this._preserveWhitespace||(a=a.replace(/\s+/g," ")),a},z.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new r.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},z}(),r.Tag=function(){function a(a,b){var c,d;this._name=a.toLowerCase(),this._selfClosing=!0===r.Tag.SELF_CLOSING[this._name],this._head=null,this._attributes={};for(c in b)d=b[c],this._attributes[c]=d}return a.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},a.prototype.head=function(){var a,b,c,d;if(!this._head){a=[],d=this._attributes;for(b in d)c=d[b],c?a.push(b+'="'+c+'"'):a.push(""+b);a.sort(),a.unshift(this._name),this._head="<"+a.join(" ")+">"}return this._head},a.prototype.name=function(){return this._name},a.prototype.selfClosing=function(){return this._selfClosing},a.prototype.tail=function(){return this._selfClosing?"":"</"+this._name+">"},a.prototype.attr=function(a,b){return void 0===b?this._attributes[a]:(this._attributes[a]=b,this._head=null)},a.prototype.removeAttr=function(a){if(void 0!==this._attributes[a])return delete this._attributes[a],this._head=null},a.prototype.copy=function(){return new r.Tag(this._name,this._attributes)},a}(),r.Character=function(){function a(a,b){this._c=a,a.length>1&&(this._c=a.toLowerCase()),this._tags=[],this.addTags.apply(this,b)}return a.prototype.c=function(){return this._c},a.prototype.isEntity=function(){return this._c.length>1},a.prototype.isTag=function(a){return!(0===this._tags.length||!this._tags[0].selfClosing())&&(!a||this._tags[0].name()===a)},a.prototype.isWhitespace=function(){var a;return" "===(a=this._c)||"\n"===a||"&nbsp;"===a||this.isTag("br")},a.prototype.tags=function(){var a;return function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this)},a.prototype.addTags=function(){var a,b,c,d,e;for(b=1<=arguments.length?A.call(arguments,0):[],e=[],c=0,d=b.length;c<d;c++)a=b[c],Array.isArray(a)||(a.selfClosing()?this.isTag()||this._tags.unshift(a.copy()):e.push(this._tags.push(a.copy())));return e},a.prototype.eq=function(a){var b,c,d,e,f,g,h,i;if(this.c()!==a.c())return!1;if(this._tags.length!==a._tags.length)return!1;for(c={},h=this._tags,d=0,f=h.length;d<f;d++)b=h[d],c[b.head()]=!0;for(i=a._tags,e=0,g=i.length;e<g;e++)if(b=i[e],!c[b.head()])return!1;return!0},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h,i;for(d=1<=arguments.length?A.call(arguments,0):[],c={},b={},i=this._tags,e=0,g=i.length;e<g;e++)a=i[e],c[a.name()]=!0,b[a.head()]=!0;for(f=0,h=d.length;f<h;f++)if("string"==typeof(a=d[f])){if(void 0===c[a])return!1}else if(void 0===b[a.head()])return!1;return!0},a.prototype.removeTags=function(){var a,b,c,d,e,f;if(d=1<=arguments.length?A.call(arguments,0):[],0===d.length)return void(this._tags=[]);for(b={},a={},e=0,f=d.length;e<f;e++)c=d[e],"string"==typeof c?b[c]=c:a[c.head()]=c;return[],this._tags=this._tags.filter(function(c){if(!a[c.head()]&&!b[c.name()])return c})},a.prototype.copy=function(){var a;return new r.Character(this._c,function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this))},a}()}.call(this),function(){var a,b,c,d,e,f,g=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};a={},a.Range=function(){function g(a,b){this.set(a,b)}return g.prototype.isCollapsed=function(){return this._from===this._to},g.prototype.span=function(){return this._to-this._from},g.prototype.collapse=function(){return this._to=this._from},g.prototype.eq=function(a){return this.get()[0]===a.get()[0]&&this.get()[1]===a.get()[1]},g.prototype.get=function(){return[this._from,this._to]},g.prototype.select=function(b){var c,e,f,g,h,i,j,k,l;return a.Range.unselectAll(),c=document.createRange(),k=d(b,this._from),h=k[0],j=k[1],l=d(b,this._to),e=l[0],g=l[1],i=h.length||0,f=e.length||0,c.setStart(h,Math.min(j,i)),c.setEnd(e,Math.min(g,f)),window.getSelection().addRange(c)},g.prototype.set=function(a,b){return a=Math.max(0,a),b=Math.max(0,b),this._from=Math.min(a,b),this._to=Math.max(a,b)},g.prepareElement=function(a){var c,d,e,f,g,h;for(e=a.querySelectorAll(b.join(", ")),h=[],c=f=0,g=e.length;f<g;c=++f)d=e[c],d.parentNode.insertBefore(document.createTextNode(""),d),c<e.length-1?h.push(d.parentNode.insertBefore(document.createTextNode(""),d.nextSibling)):h.push(void 0);return h},g.query=function(b){var d,g,h,i,j,k,l;i=new a.Range(0,0);try{d=window.getSelection().getRangeAt(0)}catch(a){return i}return null===b.firstChild&&null===b.lastChild?i:c(d.startContainer,b)&&c(d.endContainer,b)?(l=e(b,d),j=l[0],k=l[1],g=l[2],h=l[3],i.set(f(b,j)+k,f(b,g)+h),i):i},g.rect=function(){var a,b,c;try{a=window.getSelection().getRangeAt(0)}catch(a){return null}return a.collapsed?(b=document.createElement("span"),a.insertNode(b),c=b.getBoundingClientRect(),b.parentNode.removeChild(b),c):a.getBoundingClientRect()},g.unselectAll=function(){if(window.getSelection())return window.getSelection().removeAllRanges()},g}(),b=["br","img","input"],c=function(a,b){for(;a;){if(a===b)return!0;a=a.parentNode}return!1},d=function(a,c){var d,e,f,h,i;if(0===a.childNodes.length)return[a,c];for(d=null,e=c,f=function(){var b,c,d,e;for(d=a.childNodes,e=[],b=0,c=d.length;b<c;b++)h=d[b],e.push(h);return e}();f.length>0;)switch(d=f.shift(),d.nodeType){case Node.TEXT_NODE:if(d.textContent.length>=e)return[d,e];e-=d.textContent.length;break;case Node.ELEMENT_NODE:if(i=d.nodeName.toLowerCase(),g.call(b,i)>=0){if(0===e)return[d,0];e=Math.max(0,e-1)}else d.childNodes&&Array.prototype.unshift.apply(f,function(){var a,b,c,e;for(c=d.childNodes,e=[],a=0,b=c.length;a<b;a++)h=c[a],e.push(h);return e}())}return[d,e]},f=function(a,c){var d,e,f,h,i,j;if(0===a.childNodes.length)return 0;for(f=0,d=function(){var b,c,d,f;for(d=a.childNodes,f=[],b=0,c=d.length;b<c;b++)e=d[b],f.push(e);return f}();d.length>0;){if((h=d.shift())===c)return i=h.nodeName.toLowerCase(),g.call(b,i)>=0?f+1:f;switch(h.nodeType){case Node.TEXT_NODE:f+=h.textContent.length;break;case Node.ELEMENT_NODE:j=h.nodeName.toLowerCase(),g.call(b,j)>=0?f+=1:h.childNodes&&Array.prototype.unshift.apply(d,function(){var a,b,c,d;for(c=h.childNodes,d=[],a=0,b=c.length;a<b;a++)e=c[a],d.push(e);return d}())}}return f},e=function(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,q,r;if(e=a.childNodes,m=c.cloneRange(),m.collapse(!0),i=c.cloneRange(),i.collapse(!1),k=m.startContainer,l=m.startOffset,f=i.endContainer,h=i.endOffset,!m.comparePoint)return[k,l,f,h];if(k===a)for(k=e[e.length-1],l=k.textContent.length,j=n=0,p=e.length;n<p;j=++n)if(d=e[j],1===m.comparePoint(d,0)){0===j?(k=d,l=0):(k=e[j-1],l=d.textContent.length),r=k.nodeName.toLowerCase,g.call(b,r)>=0&&(l=1);break}if(c.collapsed)return[k,l,k,l];if(f===a)for(f=e[e.length-1],h=f.textContent.length,j=o=0,q=e.length;o<q;j=++o)d=e[j],1===i.comparePoint(d,0)&&(f=0===j?d:e[j-1],h=d.textContent.length+1);return[k,l,f,h]},"undefined"!=typeof window&&(window.ContentSelect=a),"undefined"!=typeof module&&module.exports&&(module.exports=a)}.call(this),function(){var a,b,c,d,e=[].slice,f=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=function(a,b){return function(){return a.apply(b,arguments)}};a={ALIGNMENT_CLASS_NAMES:{left:"align-left",right:"align-right"},DEFAULT_MAX_ELEMENT_WIDTH:2e3,DEFAULT_MIN_ELEMENT_WIDTH:80,DRAG_HOLD_DURATION:500,DROP_EDGE_SIZE:50,HELPER_CHAR_LIMIT:250,INDENT:"    ",LANGUAGE:"en",LINE_ENDINGS:"\n",PREFER_LINE_BREAKS:!1,RESIZE_CORNER_SIZE:15,TRIM_WHITESPACE:!0,_translations:{},_:function(b){var c;return c=a.LANGUAGE,a._translations[c]&&a._translations[c][b]?a._translations[c][b]:b},addTranslations:function(b,c){return a._translations[b]=c},addCSSClass:function(a,b){var c,d,e;return a.classList?void a.classList.add(b):(d=a.getAttribute("class"),d?(e=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;a<b;a++)c=e[a],f.push(c);return f}(),-1===e.indexOf(b)?a.setAttribute("class",d+" "+b):void 0):a.setAttribute("class",b))},attributesToString:function(a){var b,c,d,e,f,g;if(!a)return"";for(d=function(){var b;b=[];for(c in a)b.push(c);return b}(),d.sort(),b=[],f=0,g=d.length;f<g;f++)c=d[f],e=a[c],""===e?b.push(c):(e=HTMLString.String.encode(e),e=e.replace(/"/g,"&quot;"),b.push(c+'="'+e+'"'));return b.join(" ")},removeCSSClass:function(a,b){var c,d,e,f;return a.classList?(a.classList.remove(b),void(0===a.classList.length&&a.removeAttribute("class"))):(d=a.getAttribute("class"),d&&(f=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;a<b;a++)c=e[a],f.push(c);return f}(),(e=f.indexOf(b))>-1)?(f.splice(e,1),f.length?a.setAttribute("class",f.join(" ")):a.removeAttribute("class")):void 0)}},"undefined"!=typeof window&&(window.ContentEdit=a),"undefined"!=typeof module&&module.exports&&(module.exports=a),c=function(){function b(){this._tagNames={}}return b.prototype.register=function(){var a,b,c,d,f,g;for(a=arguments[0],c=2<=arguments.length?e.call(arguments,1):[],g=[],d=0,f=c.length;d<f;d++)b=c[d],g.push(this._tagNames[b.toLowerCase()]=a);return g},b.prototype.match=function(b){return b=b.toLowerCase(),this._tagNames[b]?this._tagNames[b]:a.Static},b}(),a.TagNames=function(){function a(){}var b;return b=null,a.get=function(){return null!=b?b:b=new c},a}(),a.Node=function(){function b(){this._bindings={},this._parent=null,this._modified=null}return b.prototype.lastModified=function(){return this._modified},b.prototype.parent=function(){return this._parent},b.prototype.parents=function(){var a,b;for(b=[],a=this._parent;a;)b.push(a),a=a._parent;return b},b.prototype.type=function(){return"Node"},b.prototype.html=function(a){throw null==a&&(a=""),new Error("`html` not implemented")},b.prototype.bind=function(a,b){return void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b),b},b.prototype.trigger=function(){var a,b,c,d,f,g,h;if(c=arguments[0],a=2<=arguments.length?e.call(arguments,1):[],this._bindings[c]){for(g=this._bindings[c],h=[],d=0,f=g.length;d<f;d++)(b=g[d])&&h.push(b.call.apply(b,[this].concat(e.call(a))));return h}},b.prototype.unbind=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;e<f;c=++e)d=g[c],d===b?h.push(this._bindings[a].splice(c,1)):h.push(void 0);return h}},b.prototype.commit=function(){return this._modified=null,a.Root.get().trigger("commit",this)},b.prototype.taint=function(){var b,c,d,e,f,g;for(b=Date.now(),this._modified=b,g=this.parents(),e=0,f=g.length;e<f;e++)c=g[e],c._modified=b;return d=a.Root.get(),d._modified=b,d.trigger("taint",this)},b.prototype.closest=function(a){var b;for(b=this.parent();b&&!a(b);)b=b.parent?b.parent():null;return b},b.prototype.next=function(){var a,b,c,d,e,f;if(this.children&&this.children.length>0)return this.children[0];for(f=[this].concat(this.parents()),d=0,e=f.length;d<e;d++){if(c=f[d],!c.parent())return null;if(a=c.parent().children,(b=a.indexOf(c))<a.length-1)return a[b+1]}},b.prototype.nextContent=function(){return this.nextWithTest(function(a){return void 0!==a.content})},b.prototype.nextSibling=function(){var a;return a=this.parent().children.indexOf(this),a===this.parent().children.length-1?null:this.parent().children[a+1]},b.prototype.nextWithTest=function(a){var b;for(b=this;b;)if((b=b.next())&&a(b))return b},b.prototype.previous=function(){var a,b;if(!this.parent())return null;if(a=this.parent().children,a[0]===this)return this.parent();for(b=a[a.indexOf(this)-1];b.children&&b.children.length;)b=b.children[b.children.length-1];return b},b.prototype.previousContent=function(){return this.previousWithTest(function(a){return void 0!==a.content})},b.prototype.previousSibling=function(){var a;return a=this.parent().children.indexOf(this),0===a?null:this.parent().children[a-1]},b.prototype.previousWithTest=function(a){var b;for(b=this;b;)if((b=b.previous())&&a(b))return b},b.extend=function(a){var b,c,d;d=a.prototype;for(b in d)c=d[b],"constructor"!==b&&(this.prototype[b]=c);for(b in a)c=a[b],f.call("__super__",b)>=0||(this.prototype[b]=c);return this},b.fromDOMElement=function(a){throw new Error("`fromDOMElement` not implemented")},b}(),a.NodeCollection=function(b){function c(){c.__super__.constructor.call(this),this.children=[]}return h(c,b),c.prototype.descendants=function(){var a,b,c;for(a=[],c=this.children.slice();c.length>0;)b=c.shift(),a.push(b),b.children&&b.children.length>0&&(c=b.children.slice().concat(c));return a},c.prototype.isMounted=function(){return!1},c.prototype.type=function(){return"NodeCollection"},c.prototype.attach=function(b,c){return b.parent()&&b.parent().detach(b),b._parent=this,void 0!==c?this.children.splice(c,0,b):this.children.push(b),b.mount&&this.isMounted()&&b.mount(),this.taint(),a.Root.get().trigger("attach",this,b)},c.prototype.commit=function(){var b,c,d,e;for(e=this.descendants(),c=0,d=e.length;c<d;c++)b=e[c],b._modified=null;return this._modified=null,a.Root.get().trigger("commit",this)},c.prototype.detach=function(b){var c;if(-1!==(c=this.children.indexOf(b)))return b.unmount&&this.isMounted()&&b.isMounted()&&b.unmount(),this.children.splice(c,1),b._parent=null,this.taint(),a.Root.get().trigger("detach",this,b)},c}(a.Node),a.Element=function(b){function c(a,b){c.__super__.constructor.call(this),this._tagName=a.toLowerCase(),this._attributes=b||{},this._domElement=null,this._behaviours={drag:!0,drop:!0,merge:!0,remove:!0,resize:!0,spawn:!0}}return h(c,b),c.prototype.attributes=function(){var a,b,c,d;a={},d=this._attributes;for(b in d)c=d[b],a[b]=c;return a},c.prototype.cssTypeName=function(){return"element"},c.prototype.domElement=function(){return this._domElement},c.prototype.isFixed=function(){return this.parent()&&"Fixture"===this.parent().type()},c.prototype.isGallery=function(){return this.parent()&&-1!==this.parent().domElement().className.indexOf("gallery")},c.prototype.isFocused=function(){return a.Root.get().focused()===this},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"Element"},c.prototype.typeName=function(){return"Element"},c.prototype.addCSSClass=function(a){var b;if(b=!1,this.hasCSSClass(a)||(b=!0,this.attr("class")?this.attr("class",this.attr("class")+" "+a):this.attr("class",a)),this._addCSSClass(a),b)return this.taint()},c.prototype.attr=function(a,b){return a=a.toLowerCase(),void 0===b?this._attributes[a]:(this._attributes[a]=b,this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.setAttribute(a,b),this.taint())},c.prototype.blur=function(){var b;if(b=a.Root.get(),this.isFocused())return this._removeCSSClass("ce-element--focused"),b._focused=null,b.trigger("blur",this)},c.prototype.can=function(a,b){return void 0===b?!this.isFixed()&&this._behaviours[a]:this._behaviours[a]=b},c.prototype.createDraggingDOMElement=function(){var b;if(this.isMounted())return b=document.createElement("div"),b.setAttribute("class","ce-drag-helper ce-drag-helper--type-"+this.cssTypeName()),b.setAttribute("data-ce-type",a._(this.typeName())),b},c.prototype.drag=function(b,c){var d;if(this.isMounted()&&this.can("drag"))return d=a.Root.get(),d.startDragging(this,b,c),d.trigger("drag",this)},c.prototype.drop=function(b,c){var d;if(this.can("drop")){if(d=a.Root.get(),b){if(b._removeCSSClass("ce-element--drop"),b._removeCSSClass("ce-element--drop-"+c[0]),b._removeCSSClass("ce-element--drop-"+c[1]),this.constructor.droppers[b.type()])return this.constructor.droppers[b.type()](this,b,c),void d.trigger("drop",this,b,c);if(b.constructor.droppers[this.type()])return b.constructor.droppers[this.type()](this,b,c),void d.trigger("drop",this,b,c)}return d.trigger("drop",this,null,null)}},c.prototype.focus=function(b){var c;if(c=a.Root.get(),!this.isFocused())return c.focused()&&c.focused().blur(),
this._addCSSClass("ce-element--focused"),c._focused=this,this.isMounted()&&!b&&this.domElement().focus(),c.trigger("focus",this)},c.prototype.hasCSSClass=function(a){var b,c;return!!(this.attr("class")&&(c=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}.call(this),c.indexOf(a)>-1))},c.prototype.merge=function(a){return!(!this.can("merge")||!this.can("remove"))&&(this.constructor.mergers[a.type()]?this.constructor.mergers[a.type()](a,this):a.constructor.mergers[this.type()]?a.constructor.mergers[this.type()](a,this):void 0)},c.prototype.mount=function(){var b;return this._domElement||(this._domElement=document.createElement(this.tagName())),b=this.nextSibling(),b?this.parent().domElement().insertBefore(this._domElement,b.domElement()):this.isFixed()?(this.parent().domElement().parentNode.replaceChild(this._domElement,this.parent().domElement()),this.parent()._domElement=this._domElement):this.parent().domElement().appendChild(this._domElement),this._addDOMEventListeners(),this._addCSSClass("ce-element"),this._addCSSClass("ce-element--type-"+this.cssTypeName()),this.isFocused()&&this._addCSSClass("ce-element--focused"),a.Root.get().trigger("mount",this)},c.prototype.removeAttr=function(a){if(a=a.toLowerCase(),this._attributes[a])return delete this._attributes[a],this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.removeAttribute(a),this.taint()},c.prototype.removeCSSClass=function(a){var b,c,d;if(this.hasCSSClass(a))return d=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}.call(this),c=d.indexOf(a),c>-1&&d.splice(c,1),d.length?this.attr("class",d.join(" ")):this.removeAttr("class"),this._removeCSSClass(a),this.taint()},c.prototype.tagName=function(a){return void 0===a?this._tagName:(this._tagName=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){return this._removeDOMEventListeners(),this.isFixed()?(this._removeCSSClass("ce-element"),this._removeCSSClass("ce-element--type-"+this.cssTypeName()),void this._removeCSSClass("ce-element--focused")):(this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,a.Root.get().trigger("unmount",this))},c.prototype._addDOMEventListeners=function(){var a,b,c,d;this._domEventHandlers={dragstart:function(a){return function(a){return a.preventDefault()}}(),focus:function(a){return function(a){return a.preventDefault()}}(),keydown:function(a){return function(b){return a._onKeyDown(b)}}(this),keyup:function(a){return function(b){return a._onKeyUp(b)}}(this),mousedown:function(a){return function(b){if(0===b.button)return a._onMouseDown(b)}}(this),mousemove:function(a){return function(b){return a._onMouseMove(b)}}(this),mouseover:function(a){return function(b){return a._onMouseOver(b)}}(this),mouseout:function(a){return function(b){return a._onMouseOut(b)}}(this),mouseup:function(a){return function(b){if(0===b.button)return a._onMouseUp(b)}}(this),dragover:function(a){return function(a){return a.preventDefault()}}(),drop:function(a){return function(b){return a._onNativeDrop(b)}}(this),paste:function(a){return function(b){return a._onPaste(b)}}(this)},c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.addEventListener(b,a));return d},c.prototype._onKeyDown=function(a){},c.prototype._onKeyUp=function(a){},c.prototype._onMouseDown=function(a){if(this.focus)return this.focus(!0)},c.prototype._onMouseMove=function(a){return this._onOver(a)},c.prototype._onMouseOver=function(a){return this._onOver(a)},c.prototype._onMouseOut=function(b){var c;if(this._removeCSSClass("ce-element--over"),c=a.Root.get(),c.dragging())return this._removeCSSClass("ce-element--drop"),this._removeCSSClass("ce-element--drop-above"),this._removeCSSClass("ce-element--drop-below"),this._removeCSSClass("ce-element--drop-center"),this._removeCSSClass("ce-element--drop-left"),this._removeCSSClass("ce-element--drop-right"),c._dropTarget=null},c.prototype._onMouseUp=function(a){return this._ieMouseDownEchoed=!1},c.prototype._onNativeDrop=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("native-drop",this,b)},c.prototype._onPaste=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("paste",this,b)},c.prototype._onOver=function(b){var c,d;if(this._addCSSClass("ce-element--over"),d=a.Root.get(),(c=d.dragging())&&c!==this&&!d._dropTarget&&this.can("drop")&&(this.constructor.droppers[c.type()]||c.constructor.droppers[this.type()]))return this._addCSSClass("ce-element--drop"),d._dropTarget=this},c.prototype._removeDOMEventListeners=function(){var a,b,c,d;c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.removeEventListener(b,a));return d},c.prototype._addCSSClass=function(b){if(this.isMounted())return a.addCSSClass(this._domElement,b)},c.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+a.attributesToString(this._attributes):""},c.prototype._removeCSSClass=function(b){if(this.isMounted())return a.removeCSSClass(this._domElement,b)},c.droppers={},c.mergers={},c.placements=["above","below"],c.getDOMElementAttributes=function(a){var b,c,d,e,f;if(!a.hasAttributes())return{};for(c={},f=a.attributes,d=0,e=f.length;d<e;d++)b=f[d],c[b.name.toLowerCase()]=b.value;return c},c._dropVert=function(a,b,c){var d;return a.parent().detach(a),d=b.parent().children.indexOf(b),"below"===c[0]&&(d+=1),b.parent().attach(a,d)},c._dropBoth=function(b,c,d){var e,f,g,h,i,j,k,l;if(b.parent().detach(b),i=c.parent().children.indexOf(c),"below"===d[0]&&"center"===d[1]&&(i+=1),f=a.ALIGNMENT_CLASS_NAMES.left,g=a.ALIGNMENT_CLASS_NAMES.right,b.a){if(b._removeCSSClass(f),b._removeCSSClass(g),b.a.class){for(e=[],l=b.a.class.split(" "),j=0,k=l.length;j<k;j++)(h=l[j])!==f&&h!==g&&e.push(h);e.length?b.a.class=e.join(" "):delete b.a.class}}else b.removeCSSClass(f),b.removeCSSClass(g);return"left"===d[1]&&(b.a?(b.a.class?b.a.class+=" "+f:b.a.class=f,b._addCSSClass(f)):b.addCSSClass(f)),"right"===d[1]&&(b.a?(b.a.class?b.a.class+=" "+g:b.a.class=g,b._addCSSClass(g)):b.addCSSClass(g)),c.parent().attach(b,i)},c}(a.Node),a.ElementCollection=function(b){function c(b,d){c.__super__.constructor.call(this,b,d),a.NodeCollection.prototype.constructor.call(this)}return h(c,b),c.extend(a.NodeCollection),c.prototype.cssTypeName=function(){return"element-collection"},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"ElementCollection"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.detach=function(b){if(a.NodeCollection.prototype.detach.call(this,b),0===this.children.length&&this.parent())return this.parent().detach(this)},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),e=function(){var c,e,f,g;for(f=this.children,g=[],c=0,e=f.length;c<e;c++)d=f[c],g.push(d.html(b+a.INDENT));return g}.call(this),f=a.LINE_ENDINGS,this.isFixed()?e.join(f):(c=this._attributesToString(),b+"<"+this.tagName()+c+">"+f+e.join(f)+f+b+"</"+this.tagName()+">")},c.prototype.mount=function(){var a,b,d,e,f,g,h,i;this._domElement=document.createElement(this._tagName),g=this._attributes;for(b in g)d=g[b],this._domElement.setAttribute(b,d);for(c.__super__.mount.call(this),h=this.children,i=[],e=0,f=h.length;e<f;e++)a=h[e],i.push(a.mount());return i},c.prototype.unmount=function(){var a,b,d,e;for(e=this.children,b=0,d=e.length;b<d;b++)a=e[b],a.unmount();return c.__super__.unmount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c}(a.Element),a.ResizableElement=function(b){function c(a,b){c.__super__.constructor.call(this,a,b),this._domSizeInfoElement=null,this._aspectRatio=1}return h(c,b),c.prototype.aspectRatio=function(){return this._aspectRatio},c.prototype.maxSize=function(){var b;return b=parseInt(this.attr("data-ce-max-width")||0),b||(b=a.DEFAULT_MAX_ELEMENT_WIDTH),b=Math.max(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.minSize=function(){var b;return b=parseInt(this.attr("data-ce-min-width")||0),b||(b=a.DEFAULT_MIN_ELEMENT_WIDTH),b=Math.min(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.type=function(){return"ResizableElement"},c.prototype.mount=function(){return c.__super__.mount.call(this),this._domElement.setAttribute("data-ce-size",this._getSizeInfo())},c.prototype.resize=function(b,c,d){if(this.isMounted()&&this.can("resize"))return a.Root.get().startResizing(this,b,c,d,!0)},c.prototype.size=function(a){var b,c,d,e;return a?(a[0]=parseInt(a[0]),a[1]=parseInt(a[1]),d=this.minSize(),a[0]=Math.max(a[0],d[0]),a[1]=Math.max(a[1],d[1]),c=this.maxSize(),a[0]=Math.min(a[0],c[0]),a[1]=Math.min(a[1],c[1]),this.attr("width",parseInt(a[0])),this.attr("height",parseInt(a[1])),this.isMounted()?(this._domElement.style.width=a[0]+"px",this._domElement.style.height=a[1]+"px",this._domElement.setAttribute("data-ce-size",this._getSizeInfo())):void 0):(e=parseInt(this.attr("width")||1),b=parseInt(this.attr("height")||1),[e,b])},c.prototype._onMouseDown=function(a){var b;return c.__super__._onMouseDown.call(this,a),b=this._getResizeCorner(a.clientX,a.clientY),b?this.resize(b,a.clientX,a.clientY):(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150))},c.prototype._onMouseMove=function(a){var b;if(c.__super__._onMouseMove.call(this),this.can("resize"))return this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right"),b=this._getResizeCorner(a.clientX,a.clientY),b?this._addCSSClass("ce-element--resize-"+b[0]+"-"+b[1]):void 0},c.prototype._onMouseOut=function(a){return c.__super__._onMouseOut.call(this),this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.prototype._getResizeCorner=function(b,c){var d,e,f,g,h;return f=this._domElement.getBoundingClientRect(),h=[b-f.left,c-f.top],b=h[0],c=h[1],g=this.size(),e=a.RESIZE_CORNER_SIZE,e=Math.min(e,Math.max(parseInt(g[0]/4),1)),e=Math.min(e,Math.max(parseInt(g[1]/4),1)),d=null,b<e?c<e?d=["top","left"]:c>f.height-e&&(d=["bottom","left"]):b>f.width-e&&(c<e?d=["top","right"]:c>f.height-e&&(d=["bottom","right"])),d},c.prototype._getSizeInfo=function(){var a;return a=this.size(),"w "+a[0]+" × h "+a[1]},c}(a.Element),a.Region=function(b){function c(a){c.__super__.constructor.call(this),this._domElement=a,this.setContent(a)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Region"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c.prototype.setContent=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(h=b,void 0===b.childNodes&&(k=document.createElement("div"),k.innerHTML=b,h=k),p=this.children.slice(),l=0,n=p.length;l<n;l++)d=p[l],this.detach(d);for(j=a.TagNames.get(),f=function(){var a,b,d,e;for(d=h.childNodes,e=[],a=0,b=d.length;a<b;a++)c=d[a],e.push(c);return e}(),m=0,o=f.length;m<o;m++)e=f[m],1===e.nodeType&&(g=e.getAttribute("data-ce-tag")?j.match(e.getAttribute("data-ce-tag")):j.match(e.tagName),i=g.fromDOMElement(e),h.removeChild(e),i&&this.attach(i));return a.Root.get().trigger("ready",this)},c}(a.NodeCollection),a.Fixture=function(b){function c(b){var d,e,f;c.__super__.constructor.call(this),this._domElement=b,f=a.TagNames.get(),d=this._domElement.getAttribute("data-ce-tag")?f.match(this._domElement.getAttribute("data-ce-tag")):f.match(this._domElement.tagName),e=d.fromDOMElement(this._domElement),this.children=[e],e._parent=this,e.mount(),a.Root.get().trigger("ready",this)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Fixture"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c}(a.NodeCollection),b=function(b){function c(){this._onStopResizing=i(this._onStopResizing,this),this._onResize=i(this._onResize,this),this._onStopDragging=i(this._onStopDragging,this),this._onDrag=i(this._onDrag,this),c.__super__.constructor.call(this),this._focused=null,this._dragging=null,this._dropTarget=null,this._draggingDOMElement=null,this._resizing=null,this._resizingInit=null}return h(c,b),c.prototype.dragging=function(){return this._dragging},c.prototype.dropTarget=function(){return this._dropTarget},c.prototype.focused=function(){return this._focused},c.prototype.resizing=function(){return this._resizing},c.prototype.type=function(){return"Root"},c.prototype.cancelDragging=function(){if(this._dragging)return document.body.removeChild(this._draggingDOMElement),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._dragging._removeCSSClass("ce-element--dragging"),this._dragging=null,this._dropTarget=null,a.removeCSSClass(document.body,"ce--dragging")},c.prototype.startDragging=function(b,c,d){if(!this._dragging)return this._dragging=b,this._dragging._addCSSClass("ce-element--dragging"),this._draggingDOMElement=this._dragging.createDraggingDOMElement(),document.body.appendChild(this._draggingDOMElement),this._draggingDOMElement.style.left=c+"px",this._draggingDOMElement.style.top=d+"px",document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),a.addCSSClass(document.body,"ce--dragging")},c.prototype._getDropPlacement=function(b,c){var d,e,f,g;return this._dropTarget?(e=this._dropTarget.domElement().getBoundingClientRect(),g=[b-e.left,c-e.top],b=g[0],c=g[1],d="center",b<a.DROP_EDGE_SIZE?d="left":b>e.width-a.DROP_EDGE_SIZE&&(d="right"),f="above",c>e.height/2&&(f="below"),[f,d]):null},c.prototype._onDrag=function(a){var b,c,d;if(ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=a.pageX+"px",this._draggingDOMElement.style.top=a.pageY+"px",this._dropTarget&&(b=this._getDropPlacement(a.clientX,a.clientY),this._dropTarget._removeCSSClass("ce-element--drop-above"),this._dropTarget._removeCSSClass("ce-element--drop-below"),this._dropTarget._removeCSSClass("ce-element--drop-center"),this._dropTarget._removeCSSClass("ce-element--drop-left"),this._dropTarget._removeCSSClass("ce-element--drop-right"),c=b[0],f.call(this._dragging.constructor.placements,c)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+b[0]),d=b[1],f.call(this._dragging.constructor.placements,d)>=0))return this._dropTarget._addCSSClass("ce-element--drop-"+b[1])},c.prototype._onStopDragging=function(a){var b;return b=this._getDropPlacement(a.clientX,a.clientY),this._dragging.drop(this._dropTarget,b),this.cancelDragging()},c.prototype.startResizing=function(b,c,d,e,f){var g,h;if(!this._resizing)return this._resizing=b,this._resizingInit={corner:c,fixed:f,origin:[d,e],size:b.size()},this._resizing._addCSSClass("ce-element--resizing"),h=this._resizing.parent().domElement(),g=document.createElement("div"),g.setAttribute("class","ce-measure"),h.appendChild(g),this._resizingParentWidth=g.getBoundingClientRect().width,h.removeChild(g),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),a.addCSSClass(document.body,"ce--resizing")},c.prototype._onResize=function(a){var b,c,d,e;return ContentSelect.Range.unselectAll(),d=this._resizingInit.origin[0]-a.clientX,"right"===this._resizingInit.corner[1]&&(d=-d),c=this._resizingInit.size[0]+d,c=Math.min(c,this._resizingParentWidth),this._resizingInit.fixed?b=c*this._resizing.aspectRatio():(e=this._resizingInit.origin[1]-a.clientY,"bottom"===this._resizingInit.corner[0]&&(e=-e),b=this._resizingInit.size[1]+e),this._resizing.size([c,b])},c.prototype._onStopResizing=function(b){return document.removeEventListener("mousemove",this._onResize),document.removeEventListener("mouseup",this._onStopResizing),this._resizing._removeCSSClass("ce-element--resizing"),this._resizing=null,this._resizingInit=null,this._resizingParentWidth=null,a.removeCSSClass(document.body,"ce--resizing")},c}(a.Node),a.Root=function(){function a(){}var c;return c=null,a.get=function(){return null!=c?c:c=new b},a}(),a.Static=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._content=d}return h(c,b),c.prototype.cssTypeName=function(){return"static"},c.prototype.type=function(){return"Static"},c.prototype.typeName=function(){return"Static"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.html=function(a){return null==a&&(a=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?a+"<"+this._tagName+this._attributesToString()+">":a+"<"+this._tagName+this._attributesToString()+">"+this._content+a+"</"+this._tagName+">"},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this._domElement.innerHTML=this._content,c.__super__.mount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c.prototype._onMouseDown=function(a){if(c.__super__._onMouseDown.call(this,a),void 0!==this.attr("data-ce-moveable"))return clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this,a),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.droppers={Static:a.Element._dropVert},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Element),a.TagNames.get().register(a.Static,"static"),a.Text=function(b){function c(b,d,e){c.__super__.constructor.call(this,b,d),e instanceof HTMLString.String?this.content=e:a.TRIM_WHITESPACE?this.content=new HTMLString.String(e).trim():this.content=new HTMLString.String(e,!0)}return h(c,b),c.prototype.cssTypeName=function(){return"text"},c.prototype.type=function(){return"Text"},c.prototype.typeName=function(){return"Text"},c.prototype.blur=function(){return this.isMounted()&&this._syncContent(),this.content.isWhitespace()&&this.can("remove")?this.parent()&&this.parent().detach(this):this.isMounted()&&(document.documentMode||/Edge/.test(navigator.userAgent)||this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.__super__.blur.call(this)},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=HTMLString.String.encode(this._domElement.textContent),d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.drag=function(a,b){return this.storeState(),this._domElement.removeAttribute("contenteditable"),c.__super__.drag.call(this,a,b)},c.prototype.drop=function(a,b){return c.__super__.drop.call(this,a,b),this.restoreState()},c.prototype.focus=function(a){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),c.__super__.focus.call(this,a)},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(d=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),d.optimize(),this._lastCached=Date.now(),this._cached=d.html()),e=a.LINE_ENDINGS,c=this._attributesToString(),b+"<"+this._tagName+c+">"+e+b+a.INDENT+this._cached+e+b+"</"+this._tagName+">"},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this.updateInnerHTML(),c.__super__.mount.call(this)},c.prototype.restoreState=function(){if(this._savedSelection)return this.isMounted()&&this.isFocused()?(this._domElement.setAttribute("contenteditable",""),this._addCSSClass("ce-element--focused"),document.activeElement!==this.domElement()&&this.domElement().focus(),this._savedSelection.select(this._domElement),this._savedSelection=void 0):void(this._savedSelection=void 0)},c.prototype.selection=function(a){return void 0===a?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):a.select(this._domElement)},c.prototype.storeState=function(){if(this.isMounted()&&this.isFocused())return this._savedSelection=ContentSelect.Range.query(this._domElement)},c.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),c.__super__.unmount.call(this)},c.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._onKeyDown=function(a){switch(a.keyCode){case 40:return this._keyDown(a);case 37:return this._keyLeft(a);case 39:return this._keyRight(a);case 38:return this._keyUp(a);case 9:return this._keyTab(a);case 8:return this._keyBack(a);case 46:return this._keyDelete(a);case 13:return this._keyReturn(a)}},c.prototype._onKeyUp=function(a){return c.__super__._onKeyUp.call(this,a),this._syncContent()},c.prototype._onMouseDown=function(b){if(c.__super__._onMouseDown.call(this,b),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(a){return function(){return a.drag(b.pageX,b.pageY)}}(this),a.DRAG_HOLD_DURATION),0===this.content.length()&&a.Root.get().focused()===this)return b.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)},c.prototype._onMouseMove=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseMove.call(this,a)},c.prototype._onMouseOut=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseOut.call(this,a)},c.prototype._onMouseUp=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseUp.call(this,a)},c.prototype._keyBack=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),0===c.get()[0]&&c.isCollapsed())return a.preventDefault(),b=this.previousContent(),this._syncContent(),b?b.merge(this):void 0},c.prototype._keyDelete=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),this._atEnd(c)&&c.isCollapsed())return a.preventDefault(),b=this.nextContent(),b?this.merge(b):void 0},c.prototype._keyDown=function(a){return this._keyRight(a)},c.prototype._keyLeft=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),0===d.get()[0]&&d.isCollapsed())return b.preventDefault(),c=this.previousContent(),c?(c.focus(),d=new ContentSelect.Range(c.content.length(),c.content.length()),d.select(c.domElement())):a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;if(b.preventDefault(),!(this.content.isWhitespace()&&!b.shiftKey^a.PREFER_LINE_BREAKS)){if(f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),b.shiftKey^a.PREFER_LINE_BREAKS)return d=f.get()[0],e="<br>",this.content.length()===d&&(0!==this.content.length()&&this.content.characters[d-1].isTag("br")||(e="<br><br>")),this.content=this.content.insert(d,new HTMLString.String(e,!0),!0),this.updateInnerHTML(),d+=1,f=new ContentSelect.Range(d,d),f.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=h.trim(),this.updateInnerHTML(),c=new this.constructor("p",{},g.trim()),this.parent().attach(c,this.parent().children.indexOf(this)+1),h.length()?(c.focus(),f=new ContentSelect.Range(0,0),f.select(c.domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint()}},c.prototype._keyRight=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),this._atEnd(d)&&d.isCollapsed())return b.preventDefault(),c=this.nextContent(),c?(c.focus(),d=new ContentSelect.Range(0,0),d.select(c.domElement())):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyTab=function(b){if(b.preventDefault(),this.isFixed())return b.shiftKey?a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyUp=function(a){return this._keyLeft(a)},c.prototype._atEnd=function(a){return a.get()[0]>=this.content.length()},c.prototype._flagIfEmpty=function(){return 0===this.content.length()?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},c.prototype._syncContent=function(a){var b,c;return c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.droppers={Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={Text:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&b.updateInnerHTML(),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),a.parent()&&a.parent().detach(a),b.taint()}},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML.replace(/^\s+|\s+$/g,""))},c}(a.Element),a.TagNames.get().register(a.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),a.PreText=function(b){function c(b,c,d){d instanceof HTMLString.String?this.content=d:this.content=new HTMLString.String(d,!0),a.Element.call(this,b,c)}return h(c,b),c.TAB_INDENT="    ",c.prototype.cssTypeName=function(){return"pre-text"},c.prototype.type=function(){return"PreText"},c.prototype.typeName=function(){return"Preformatted"},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),c.__super__.blur.call(this)},c.prototype.html=function(a){var b;return null==a&&(a=""),(!this._lastCached||this._lastCached<this._modified)&&(b=this.content.copy(),b.optimize(),this._lastCached=Date.now(),this._cached=b.html()),a+"<"+this._tagName+this._attributesToString()+">"+this._cached+"</"+this._tagName+">"},c.prototype.updateInnerHTML=function(){var a;return a=this.content.html(),this._domElement.innerHTML=a,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._keyBack=function(a){var b;return b=ContentSelect.Range.query(this._domElement),b.get()[0]<=this.content.length()?c.__super__._keyBack.call(this,a):(b.set(this.content.length(),this.content.length()),b.select(this._domElement))},c.prototype._keyReturn=function(a){var b,c,d,e;return a.preventDefault(),c=ContentSelect.Range.query(this._domElement),b=c.get()[0]+1,0===c.get()[0]&&c.isCollapsed()?this.content=new HTMLString.String("\n",!0).concat(this.content):this._atEnd(c)&&c.isCollapsed()?this.content=this.content.concat(new HTMLString.String("\n",!0)):0===c.get()[0]&&c.get()[1]===this.content.length()?(this.content=new HTMLString.String("\n",!0),b=0):(e=this.content.substring(0,c.get()[0]),d=this.content.substring(c.get()[1]),this.content=e.concat(new HTMLString.String("\n",!0),d)),this.updateInnerHTML(),c.set(b,b),c.select(this._domElement),this.taint()},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(b.preventDefault(),c=this.content.length(),k=a.PreText.TAB_INDENT,j=k.length,o=this.content.split("\n"),p=this.selection().get(),p[0]=Math.min(p[0],c),p[1]=Math.min(p[1],c),e=0,s=-1,f=-1,h=v=0,z=o.length;v<z&&(m=o[h],n=m.length()+1,p[0]<e+n&&-1===s&&(s=h),p[1]<e+n&&-1===f&&(f=h),!(s>-1&&f>-1));h=++v)e+=n;if(s===f)j-=(p[0]-e)%j,i=new HTMLString.String(Array(j+1).join(" "),!0),u=o[s].substring(0,p[0]-e),t=o[s].substring(p[1]-e),o[s]=u.concat(i,t),r=j;else if(b.shiftKey){for(g=0,h=w=s;s<=f?w<=f:w>=f;h=s<=f?++w:--w){for(B=o[h].characters.slice(),l=x=0,A=B.length;x<A&&(d=B[l],!(l>j-1))&&d.isWhitespace();l=++x)o[h].characters.shift();h===s&&(g=l)}r=Math.max(-j,-g)}else{for(i=new HTMLString.String(k,!0),h=y=s;s<=f?y<=f:y>=f;h=s<=f?++y:--y)o[h]=i.concat(o[h]);r=j}return this.content=HTMLString.String.join(new HTMLString.String("\n",!0),o),this.updateInnerHTML(),q=this.content.length()-c,new ContentSelect.Range(p[0]+r,p[1]+q).select(this._domElement)},c.prototype._syncContent=function(a){var b,c;return this._ensureEndZWS(),c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.prototype._ensureEndZWS=function(){var a,b;if(this._domElement.lastChild&&(a=this._domElement.innerHTML,!("​"===a[a.length-1]&&a.indexOf("​")<a.length-1)))return b=function(b){return function(){return a.indexOf("​")>-1&&(b._domElement.innerHTML=a.replace(/\u200B/g,"")),b._domElement.lastChild.textContent+="​"}}(this),this._savedSelection?b():(this.storeState(),b(),this.restoreState())},c.droppers={PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Text),a.TagNames.get().register(a.PreText,"pre"),a.Image=function(b){function c(a,b){var d;c.__super__.constructor.call(this,"img",a),this.a=b||null,d=this.size(),this._aspectRatio=d[1]/d[0]}return h(c,b),c.prototype.cssTypeName=function(){return"image"},c.prototype.type=function(){return"Image"},c.prototype.typeName=function(){return"Image"},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.style.backgroundImage="url('"+this._attributes.src+"')",a},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),d=b+"<img"+this._attributesToString()+">",this.a?(e=a.LINE_ENDINGS,c=a.attributesToString(this.a),c+=' data-ce-tag="img"',b+"<a "+c+">"+e+a.INDENT+d+e+b+"</a>"):d},c.prototype.mount=function(){var a,b;return this._domElement=document.createElement("img"),this._domElement.setAttribute("src",this._attributes.src),a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),b=this._attributes.style?this._attributes.style:"",this._attributes.width&&(b+="width:"+this._attributes.width+"px;"),this._attributes.height&&(b+="height:auto;"),this._domElement.setAttribute("style",b),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("a, img"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth},
c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i,j;if(b=null,"a"===a.tagName.toLowerCase()){for(b=this.getDOMElementAttributes(a),f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b<c;b++)d=e[b],f.push(d);return f}(),i=0,j=f.length;i<j;i++)if(e=f[i],1===e.nodeType&&"img"===e.tagName.toLowerCase()){a=e;break}"a"===a.tagName.toLowerCase()&&(a=document.createElement("img"))}return c=this.getDOMElementAttributes(a),h=c.width,g=c.height,void 0===c.width&&(h=void 0===c.height?a.naturalWidth:a.clientWidth),void 0===c.height&&(g=void 0===c.width?a.naturalHeight:a.clientHeight),c.width=h,c.height=g,new this(c,b)},c}(a.ResizableElement),a.TagNames.get().register(a.Image,"img"),a.ImageFixture=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._src=d}return h(c,b),c.prototype.cssTypeName=function(){return"image-fixture"},c.prototype.type=function(){return"ImageFixture"},c.prototype.typeName=function(){return"ImageFixture"},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),f=a.LINE_ENDINGS,d=this._attributesToString(),c="",void 0!==this._attributes.alt&&(c='alt="'+this._attributes.alt+'"'),e=b+'<img src="'+this.src()+'"'+c+">",b+"<"+this.tagName()+" "+d+">"+f+a.INDENT+e+f+b+"</"+this.tagName()+">"},c.prototype.mount=function(){var a,b,d,e,f,g;this._domElement=document.createElement(this.tagName()),g=this._attributes;for(b in g)f=g[b],"alt"!==b&&"style"!==b&&this._domElement.setAttribute(b,f);return a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),d=this._attributes.style?this._attributes.style:"",e=document.createElement("div"),e.setAttribute("style",d.trim()),e.style.backgroundImage=null,d=e.getAttribute("style"),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._domElement.setAttribute("style",d.trim()),c.__super__.mount.call(this)},c.prototype.src=function(a){return void 0===a?this._src:(this._src=a,this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){var a,b;return this.isFixed()?(b=document.createElement("div"),b.innerHTML=this.html(),a=b.firstElementChild,this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a,this.parent()._domElement=this._domElement):c.__super__.unmount.call(this)},c.prototype._attributesToString=function(){var b,c,d,e,f,g;this._attributes.style?(d=this._attributes.style?this._attributes.style:"",e=document.createElement("div"),e.setAttribute("style",d.trim()),e.style.backgroundImage=null,d=e.getAttribute("style"),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._attributes.style=d.trim()):this._attributes.style="background-image:url('"+this.src()+"');",b={},g=this._attributes;for(c in g)f=g[c],"alt"!==c&&(b[c]=f);return" "+a.attributesToString(b)},c.droppers={ImageFixture:a.Element._dropVert,Image:a.Element._dropVert,PreText:a.Element._dropVert,Text:a.Element._dropVert},c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i;for(a.tagName,c=this.getDOMElementAttributes(a),g="",b="",f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b<c;b++)d=e[b],f.push(d);return f}(),h=0,i=f.length;h<i;h++)if(e=f[h],1===e.nodeType&&"img"===e.tagName.toLowerCase()){g=e.getAttribute("src")||"",b=e.getAttribute("alt")||"";break}return c=this.getDOMElementAttributes(a),c.alt=b,new this(a.tagName,c,g)},c}(a.Element),a.TagNames.get().register(a.ImageFixture,"img-fixture"),a.Video=function(b){function c(a,b,d){var e;null==d&&(d=[]),c.__super__.constructor.call(this,a,b),this.sources=d,e=this.size(),this._aspectRatio=e[1]/e[0]}return h(c,b),c.prototype.cssTypeName=function(){return"video"},c.prototype.type=function(){return"Video"},c.prototype.typeName=function(){return"Video"},c.prototype._title=function(){var a;return a="",this.attr("src")?a=this.attr("src"):this.sources.length&&(a=this.sources[0].src),a||(a="No video source set"),a.length>80&&(a=a.substr(0,80)+"..."),a},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.innerHTML=this._title(),a},c.prototype.html=function(b){var c,d,e,f,g,h,i;if(null==b&&(b=""),d=a.LINE_ENDINGS,"video"===this.tagName()){for(f=[],i=this.sources,g=0,h=i.length;g<h;g++)e=i[g],c=a.attributesToString(e),f.push(""+b+a.INDENT+"<source "+c+">");return b+"<video"+this._attributesToString()+">"+d+f.join(d)+d+b+"</video>"}return b+"<"+this._tagName+this._attributesToString()+"></"+this._tagName+">"},c.prototype.mount=function(){var a;return this._domElement=document.createElement("div"),this.a&&this.a.class?this._domElement.setAttribute("class",this.a.class):this._attributes.class&&this._domElement.setAttribute("class",this._attributes.class),a=this._attributes.style?this._attributes.style:"",this._attributes.width&&(a+="width:"+this._attributes.width+"px;"),this._attributes.height&&(a+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",a),this._domElement.setAttribute("data-ce-title",this._title()),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("iframe"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth,Video:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g;for(d=function(){var c,d,e,f;for(e=a.childNodes,f=[],c=0,d=e.length;c<d;c++)b=e[c],f.push(b);return f}(),e=[],f=0,g=d.length;f<g;f++)c=d[f],1===c.nodeType&&"source"===c.tagName.toLowerCase()&&e.push(this.getDOMElementAttributes(c));return new this(a.tagName,this.getDOMElementAttributes(a),e)},c}(a.ResizableElement),a.TagNames.get().register(a.Video,"iframe","video"),a.List=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"list"},c.prototype.type=function(){return"List"},c.prototype.typeName=function(){return"List"},c.prototype._onMouseOver=function(a){if("ListItem"!==this.parent().type())return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;g<h;g++)d=e[g],1===d.nodeType&&"li"===d.tagName.toLowerCase()&&f.attach(a.ListItem.fromDOMElement(d));return 0===f.children.length?null:f},c}(a.ElementCollection),a.TagNames.get().register(a.List,"ol","ul"),a.ListItem=function(b){function c(a){c.__super__.constructor.call(this,"li",a),this._behaviours.indent=!0}return h(c,b),c.prototype.cssTypeName=function(){return"list-item"},c.prototype.list=function(){return 2===this.children.length?this.children[1]:null},c.prototype.listItemText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"ListItem"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<li"+this._attributesToString()+">"],this.listItemText()&&c.push(this.listItemText().html(b+a.INDENT)),this.list()&&c.push(this.list().html(b+a.INDENT)),c.push(b+"</li>"),c.join(a.LINE_ENDINGS)},c.prototype.indent=function(){var b;if(this.can("indent")&&0!==this.parent().children.indexOf(this))return b=this.previousSibling(),b.list()||b.attach(new a.List(b.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),b.list().attach(this),this.listItemText().restoreState()},c.prototype.remove=function(){var a,b,c,d,e,f;if(this.parent()){if(c=this.parent().children.indexOf(this),this.list())for(f=this.list().children.slice(),b=d=0,e=f.length;d<e;b=++d)a=f[b],a.parent().detach(a),this.parent().attach(a,b+c);return this.parent().detach(this)}},c.prototype.unindent=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(this.can("indent")){if(g=this.parent(),c=g.parent(),k=g.children.slice(g.children.indexOf(this)+1,g.children.length),"ListItem"===c.type()){for(this.listItemText().storeState(),g.detach(this),c.parent().attach(this,c.parent().children.indexOf(c)+1),k.length&&!this.list()&&this.attach(new a.List(g.tagName())),m=0,q=k.length;m<q;m++)j=k[m],j.parent().detach(j),this.list().attach(j);return this.listItemText().restoreState()}if(l=new a.Text("p",this.attr("class")?{class:this.attr("class")}:{},this.listItemText().content),i=null,this.listItemText().isFocused()&&(i=ContentSelect.Range.query(this.listItemText().domElement())),h=c.children.indexOf(g),0===(e=g.children.indexOf(this))){if(f=null,1===g.children.length?(this.list()&&(f=new a.List(g.tagName())),c.detach(g)):g.detach(this),c.attach(l,h),f&&c.attach(f,h+1),this.list())for(u=this.list().children.slice(),d=n=0,r=u.length;n<r;d=++n)b=u[d],b.parent().detach(b),f?f.attach(b):g.attach(b,d)}else if(e===g.children.length-1)g.detach(this),c.attach(l,h+1),this.list()&&c.attach(this.list(),h+2);else{if(g.detach(this),c.attach(l,h+1),f=new a.List(g.tagName()),c.attach(f,h+2),this.list())for(v=this.list().children.slice(),o=0,s=v.length;o<s;o++)b=v[o],b.parent().detach(b),f.attach(b);for(p=0,t=k.length;p<t;p++)j=k[p],j.parent().detach(j),f.attach(j)}return i?(l.focus(),i.select(l.domElement())):void 0}},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l;for(g=new this(this.getDOMElementAttributes(b)),d="",e=null,k=b.childNodes,i=0,j=k.length;i<j;i++)c=k[i],1===c.nodeType?"ul"===(l=c.tagName.toLowerCase())||"ol"===l||"li"===l?e||(e=c):d+=c.outerHTML:d+=HTMLString.String.encode(c.textContent);return d=d.replace(/^\s+|\s+$/g,""),h=new a.ListItemText(d),g.attach(h),e&&(f=a.List.fromDOMElement(e),g.attach(f)),g},c}(a.ElementCollection),a.ListItemText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"list-item-text"},c.prototype.type=function(){return"ListItemText"},c.prototype.typeName=function(){return"List item"},c.prototype.blur=function(){return this.content.isWhitespace()&&this.can("remove")?this.parent().remove():this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(c=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),c.optimize(),this._lastCached=Date.now(),this._cached=c.html()),""+b+this._cached},c.prototype._onMouseDown=function(b){var c;return a.Element.prototype._onMouseDown.call(this,b),c=function(d){return function(){var e;return a.Root.get().dragging()===d?(a.Root.get().cancelDragging(),e=d.closest(function(a){return"Region"===a.parent().type()}),e.drag(b.pageX,b.pageY)):(d.drag(b.pageX,b.pageY),d._dragTimeout=setTimeout(c,2*a.DRAG_HOLD_DURATION))}}(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(c,a.DRAG_HOLD_DURATION)},c.prototype._onMouseMove=function(b){return this._dragTimeout&&clearTimeout(this._dragTimeout),a.Element.prototype._onMouseMove.call(this,b)},c.prototype._onMouseUp=function(b){return this._dragTimeout&&clearTimeout(this._dragTimeout),a.Element.prototype._onMouseUp.call(this,b)},c.prototype._keyTab=function(a){return a.preventDefault(),a.shiftKey?this.parent().unindent():this.parent().indent()},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;return b.preventDefault(),this.content.isWhitespace()?void this.parent().unindent():this.can("spawn")?(ContentSelect.Range.query(this._domElement),f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),h.length()+g.length()===0?void this.parent().unindent():(this.content=h.trim(),this.updateInnerHTML(),c=this.parent().parent(),e=new a.ListItem(this.attr("class")?{class:this.attr("class")}:{}),c.attach(e,c.children.indexOf(this.parent())+1),e.attach(new a.ListItemText(g.trim())),d=this.parent().list(),d&&(this.parent().detach(d),e.attach(d)),h.length()?(e.listItemText().focus(),f=new ContentSelect.Range(0,0),f.select(e.listItemText().domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint())):void 0},c.droppers={ListItemText:function(b,c,d){var e,f,g,h;return e=b.parent(),h=c.parent(),e.remove(),e.detach(b),g=new a.ListItem(e._attributes),g.attach(b),h.list()&&"below"===d[0]?void h.list().attach(g,0):(f=h.parent().children.indexOf(h),"below"===d[0]&&(f+=1),h.parent().attach(g,f))},Text:function(b,c,d){var e,f,g,h,i;if("Text"===b.type()){if(h=c.parent(),b.parent().detach(b),e=b.attr("class"),g=new a.ListItem(e?{class:e}:{}),g.attach(new a.ListItemText(b.content)),h.list()&&"below"===d[0])return void h.list().attach(g,0);if(f=h.parent().children.indexOf(h),"below"===d[0]&&(f+=1),h.parent().attach(g,f),g.listItemText().focus(),b._savedSelection)return b._savedSelection.select(g.listItemText().domElement())}else if(e=b.attr("class"),i=new a.Text("p",e?{class:e}:{},b.content),b.parent().remove(),f=c.parent().children.indexOf(c),"below"===d[0]&&(f+=1),c.parent().attach(i,f),i.focus(),b._savedSelection)return b._savedSelection.select(i.domElement())}},c.mergers={ListItemText:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&(b._domElement.innerHTML=b.content.html()),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),"Text"===a.type()?a.parent()&&a.parent().detach(a):a.parent().remove(),b.taint()}},c}(a.Text),d=a.ListItemText.mergers,d.Text=d.ListItemText,a.Table=function(b){function c(a){c.__super__.constructor.call(this,"table",a)}return h(c,b),c.prototype.cssTypeName=function(){return"table"},c.prototype.typeName=function(){return"Table"},c.prototype.type=function(){return"Table"},c.prototype.firstSection=function(){var a;return(a=this.thead())?a:(a=this.tbody())?a:(a=this.tfoot())?a:null},c.prototype.lastSection=function(){var a;return(a=this.tfoot())?a:(a=this.tbody())?a:(a=this.thead())?a:null},c.prototype.tbody=function(){return this._getChild("tbody")},c.prototype.tfoot=function(){return this._getChild("tfoot")},c.prototype.thead=function(){return this._getChild("thead")},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._getChild=function(a){var b,c,d,e;for(e=this.children,c=0,d=e.length;c<d;c++)if(b=e[c],b.tagName()===a)return b;return null},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Table:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;for(i=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),f=[],k=0,m=e.length;k<m;k++)if(d=e[k],1===d.nodeType&&(j=d.tagName.toLowerCase(),!i._getChild(j)))switch(j){case"tbody":case"tfoot":case"thead":h=a.TableSection.fromDOMElement(d),i.attach(h);break;case"tr":f.push(a.TableRow.fromDOMElement(d))}if(f.length>0)for(i._getChild("tbody")||i.attach(new a.TableSection("tbody")),l=0,n=f.length;l<n;l++)g=f[l],i.tbody().attach(g);return 0===i.children.length?null:i},c}(a.ElementCollection),a.TagNames.get().register(a.Table,"table"),a.TableSection=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"table-section"},c.prototype.type=function(){return"TableSection"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;g<h;g++)d=e[g],1===d.nodeType&&"tr"===d.tagName.toLowerCase()&&f.attach(a.TableRow.fromDOMElement(d));return f},c}(a.ElementCollection),a.TableRow=function(b){function c(a){c.__super__.constructor.call(this,"tr",a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-row"},c.prototype.isEmpty=function(){var a,b,c,d,e;for(e=this.children,c=0,d=e.length;c<d;c++)if(a=e[c],(b=a.tableCellText())&&b.content.length()>0)return!1;return!0},c.prototype.type=function(){return"TableRow"},c.prototype.typeName=function(){return"Table row"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={TableRow:a.Element._dropVert},c.fromDOMElement=function(b){var c,d,e,f,g,h,i;for(f=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),h=0,i=e.length;h<i;h++)d=e[h],1===d.nodeType&&("td"!==(g=d.tagName.toLowerCase())&&"th"!==g||f.attach(a.TableCell.fromDOMElement(d)));return f},c}(a.ElementCollection),a.TableCell=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell"},c.prototype.tableCellText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"TableCell"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&c.push(this.tableCellText().html(b+a.INDENT)),c.push(b+"</"+this.tagName()+">"),c.join(a.LINE_ENDINGS)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d;return c=new this(b.tagName,this.getDOMElementAttributes(b)),d=new a.TableCellText(b.innerHTML.replace(/^\s+|\s+$/g,"")),c.attach(d),c},c}(a.ElementCollection),a.TableCellText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell-text"},c.prototype.type=function(){return"TableCellText"},c.prototype._isInFirstRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.firstSection()&&b===c.children[0]},c.prototype._isInLastRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.lastSection()&&b===c.children[c.children.length-1]},c.prototype._isLastInSection=function(){var a,b,c;return a=this.parent(),b=a.parent(),c=b.parent(),b===c.children[c.children.length-1]&&a===b.children[b.children.length-1]},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(c=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),c.optimize(),this._lastCached=Date.now(),this._cached=c.html()),""+b+this._cached},c.prototype._onMouseDown=function(b){var c;return a.Element.prototype._onMouseDown.call(this,b),c=function(d){return function(){var e,f;return e=d.parent(),a.Root.get().dragging()===e.parent()?(a.Root.get().cancelDragging(),f=e.parent().parent().parent(),f.drag(b.pageX,b.pageY)):(e.parent().drag(b.pageX,b.pageY),d._dragTimeout=setTimeout(c,2*a.DRAG_HOLD_DURATION))}}(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(c,a.DRAG_HOLD_DURATION)},c.prototype._keyBack=function(a){var b,c,d,e;if(e=ContentSelect.Range.query(this._domElement),0===e.get()[0]&&e.isCollapsed()&&(a.preventDefault(),b=this.parent(),d=b.parent(),d.isEmpty()&&d.can("remove")))return 0===this.content.length()&&0===d.children.indexOf(b)?(c=this.previousContent(),c&&(c.focus(),e=new ContentSelect.Range(c.content.length(),c.content.length()),e.select(c.domElement())),d.parent().detach(d)):void 0},c.prototype._keyDelete=function(a){var b,c,d,e;if(d=this.parent().parent(),d.isEmpty()&&d.can("remove"))return a.preventDefault(),b=d.children[d.children.length-1],c=b.tableCellText().nextContent(),c&&(c.focus(),e=new ContentSelect.Range(0,0),e.select(c.domElement())),d.parent().detach(d)},c.prototype._keyDown=function(b){var c,d,e,f,g,h,i;if(i=ContentSelect.Range.query(this._domElement),this._atEnd(i)&&i.isCollapsed())return b.preventDefault(),c=this.parent(),this._isInLastRow()?(h=c.parent(),e=h.children[h.children.length-1].tableCellText(),f=e.nextContent(),f?f.focus():a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(g=c.parent().nextWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,g.children.length),g.children[d].tableCellText().focus())},c.prototype._keyReturn=function(a){return a.preventDefault(),this._keyTab({shiftKey:!1,preventDefault:function(){}})},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l;if(b.preventDefault(),c=this.parent(),b.shiftKey){if(this._isInFirstRow()&&c.parent().children[0]===c)return;return this.previousContent().focus()}if(this.can("spawn")){if(e=c.parent().parent(),"tbody"===e.tagName()&&this._isLastInSection()){for(h=new a.TableRow,l=c.parent().children,j=0,k=l.length;j<k;j++)d=l[j],f=new a.TableCell(d.tagName(),d._attributes),g=new a.TableCellText(""),f.attach(g),h.attach(f);return i=this.closest(function(a){return"TableSection"===a.type()}),i.attach(h),h.children[0].tableCellText().focus()}return this.nextContent().focus()}},c.prototype._keyUp=function(b){var c,d,e,f,g,h;if(h=ContentSelect.Range.query(this._domElement),0===h.get()[0]&&h.isCollapsed())return b.preventDefault(),c=this.parent(),this._isInFirstRow()?(g=c.parent(),e=g.children[0].previousContent(),e?e.focus():a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(f=c.parent().previousWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,f.children.length),f.children[d].tableCellText().focus())},c.droppers={},c.mergers={},c}(a.Text)}.call(this),function(){var a,b,c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h=function(a,b){return function(){return a.apply(b,arguments)}},i=[].slice;b={Tools:{},CANCEL_MESSAGE:"Your changes have not been saved, do you really want to lose them?".trim(),DEFAULT_TOOLS:[["heading","heading2","heading3","heading4","heading5","paragraph","bold","italic","underline","strike","code","link","align-left","align-center","align-right","unordered-list","ordered-list","line-break","indent","unindent"],["image","video","table","undo","redo","remove"]],DEFAULT_VIDEO_HEIGHT:315,DEFAULT_VIDEO_WIDTH:560,HIGHLIGHT_HOLD_DURATION:2e3,IMAGE_UPLOADER:null,INLINE_TAGS:["a","address","b","code","del","em","i","ins","span","strong","sup","u"],INSPECTOR_IGNORED_ELEMENTS:["Fixture","ListItemText","Region","TableCellText"],MIN_CROP:10,RESTRICTED_ATTRIBUTES:{"*":["style"],img:["height","src","width","data-ce-max-width","data-ce-min-width"]},getEmbedVideoURL:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(b={"www.youtube.com":"youtube","youtu.be":"youtube","vimeo.com":"vimeo","player.vimeo.com":"vimeo"},k=document.createElement("a"),k.href=a,g=k.hostname.toLowerCase(),l=k.pathname,null!==l&&"/"!==l.substr(0,1)&&(l="/"+l),i={},j=k.search.slice(1),p=j.split("&"),n=0,o=p.length;n<o;n++)e=p[n],e=e.split("="),e[0]&&(i[e[0]]=e[1]);switch(b[g]){case"youtube":if("/watch"===l.toLowerCase()){if(!i.v)return null;c=i.v,delete i.v}else{if(!(f=l.match(/\/([A-Za-z0-9_-]+)$/i)))return null;c=f[1]}return a="https://www.youtube.com/embed/"+c,h=function(){var a;a=[];for(d in i)m=i[d],a.push(d+"="+m);return a}().join("&"),h&&(a+="?"+h),a;case"vimeo":return(f=l.match(/\/(\w+\/\w+\/){0,1}(\d+)/i))?(a="https://player.vimeo.com/video/"+f[2],h=function(){var a;a=[];for(d in i)m=i[d],a.push(d+"="+m);return a}().join("&"),h&&(a+="?"+h),a):null}return null},getHTMLCleaner:function(){return new b.HTMLCleaner},getRestrictedAtributes:function(a){var c;return c=[],b.RESTRICTED_ATTRIBUTES[a]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES[a])),b.RESTRICTED_ATTRIBUTES["*"]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES["*"])),c},getScrollPosition:function(){var a,b;return b=void 0!==window.pageXOffset,a=4===(document.compatMode||4),b?[window.pageXOffset,window.pageYOffset]:a?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]}},"undefined"!=typeof window&&(window.ContentTools=b),"undefined"!=typeof module&&module.exports&&(module.exports=b),b.ComponentUI=function(){function a(){this._bindings={},this._parent=null,this._children=[],this._domElement=null}return a.prototype.children=function(){return this._children.slice()},a.prototype.domElement=function(){return this._domElement},a.prototype.isMounted=function(){return null!==this._domElement},a.prototype.parent=function(){return this._parent},a.prototype.attach=function(a,b){return a.parent()&&a.parent().detach(a),a._parent=this,void 0!==b?this._children.splice(b,0,a):this._children.push(a)},a.prototype.addCSSClass=function(a){if(this.isMounted())return ContentEdit.addCSSClass(this._domElement,a)},a.prototype.detach=function(a){var b;if(-1!==(b=this._children.indexOf(a)))return this._children.splice(b,1)},a.prototype.mount=function(){},a.prototype.removeCSSClass=function(a){if(this.isMounted())return ContentEdit.removeCSSClass(this._domElement,a)},a.prototype.unmount=function(){if(this.isMounted())return this._removeDOMEventListeners(),this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null},a.prototype.addEventListener=function(a,b){void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b)},a.prototype.createEvent=function(a,c){return new b.Event(a,c)},a.prototype.dispatchEvent=function(a){var b,c,d,e;if(!this._bindings[a.name()])return!a.defaultPrevented();for(e=this._bindings[a.name()],c=0,d=e.length;c<d&&(b=e[c],!a.propagationStopped());c++)b&&b.call(this,a);return!a.defaultPrevented()},a.prototype.removeEventListener=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;e<f;c=++e)d=g[c],d===b?h.push(this._bindings[a].splice(c,1)):h.push(void 0);return h}},a.prototype._addDOMEventListeners=function(){},a.prototype._removeDOMEventListeners=function(){},a.createDiv=function(a,b,c){var d,e,f;if(d=document.createElement("div"),a&&a.length>0&&d.setAttribute("class",a.join(" ")),b)for(e in b)f=b[e],d.setAttribute(e,f);return c&&(d.innerHTML=c),d},a}(),b.WidgetUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.attach=function(a,c){if(b.__super__.attach.call(this,a,c),!this.isMounted())return a.mount()},b.prototype.detach=function(a){if(b.__super__.detach.call(this,a),this.isMounted())return a.unmount()},b.prototype.detatch=function(a){return console.log("Please call detach, detatch will be removed in release 1.4.x"),this.detach(a)},b.prototype.show=function(){var a;return this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null,this.unmount()),this.isMounted()||this.mount(),a=function(a){return function(){return a.addCSSClass("ct-widget--active"),a._showTimeout=null}}(this),this._showTimeout=setTimeout(a,100)},b.prototype.hide=function(){var a;if(this._showTimeout&&(clearTimeout(this._showTimeout),this._showTimeout=null),this.removeCSSClass("ct-widget--active"),a=function(b){return function(){return b._hideTimeout=null,window.getComputedStyle?parseFloat(window.getComputedStyle(b._domElement).opacity)<.01?b.unmount():b._hideTimeout=setTimeout(a,250):void b.unmount()}}(this),this.isMounted())return this._hideTimeout=setTimeout(a,250)},b}(b.ComponentUI),b.AnchoredComponentUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.mount=function(a,b){return null==b&&(b=null),a.insertBefore(this._domElement,b),this._addDOMEventListeners()},b}(b.ComponentUI),b.Event=function(){function a(a,b){this._name=a,this._detail=b,this._timeStamp=Date.now(),this._defaultPrevented=!1,this._propagationStopped=!1}return a.prototype.defaultPrevented=function(){return this._defaultPrevented},a.prototype.detail=function(){return this._detail},a.prototype.name=function(){return this._name},a.prototype.propagationStopped=function(){return this._propagationStopped},a.prototype.timeStamp=function(){return this._timeStamp},a.prototype.preventDefault=function(){return this._defaultPrevented=!0},a.prototype.stopImmediatePropagation=function(){return this._propagationStopped=!0},a}(),b.FlashUI=function(a){function c(a){c.__super__.constructor.call(this),this.mount(a)}return g(c,a),c.prototype.mount=function(a){var d;return this._domElement=this.constructor.createDiv(["ct-flash","ct-flash--active","ct-flash--"+a,"ct-widget","ct-widget--active"]),c.__super__.mount.call(this,b.EditorApp.get().domElement()),d=function(a){return function(){return window.getComputedStyle?parseFloat(window.getComputedStyle(a._domElement).opacity)<.01?a.unmount():setTimeout(d,250):void a.unmount()}}(this),setTimeout(d,250)},c}(b.AnchoredComponentUI),b.IgnitionUI=function(a){function b(){b.__super__.constructor.call(this),this._revertToState="ready",this._state="ready"}return g(b,a),b.prototype.busy=function(a){if(this.dispatchEvent(this.createEvent("busy",{busy:a}))){if(a===("busy"===this._state))return;return a?(this._revertToState=this._state,this.state("busy")):this.state(this._revertToState)}},b.prototype.cancel=function(){if(this.dispatchEvent(this.createEvent("cancel")))return this.state("ready")},b.prototype.confirm=function(){if(this.dispatchEvent(this.createEvent("confirm")))return this.state("ready")},b.prototype.edit=function(){if(this.dispatchEvent(this.createEvent("edit")))return this.state("editing")},b.prototype.mount=function(){return b.__super__.mount.call(this),this._domElement=this.constructor.createDiv(["ct-widget","ct-ignition","ct-ignition--ready"]),this.parent().domElement().appendChild(this._domElement),this._domEdit=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--edit"]),this._domElement.appendChild(this._domEdit),this._domLogout=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--logout"]),this._domElement.appendChild(this._domLogout),this._domConfirm=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--confirm"]),this._domElement.appendChild(this._domConfirm),this._domBlog=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--blog"]),this._domElement.appendChild(this._domBlog),this._domCancel=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--cancel"]),this._domElement.appendChild(this._domCancel),
this._domBusy=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--busy"]),this._domElement.appendChild(this._domBusy),this._addDOMEventListeners()},b.prototype.state=function(a){if(void 0===a)return this._state;if(this._state!==a&&this.dispatchEvent(this.createEvent("statechange",{state:a})))return this._state=a,this.removeCSSClass("ct-ignition--busy"),this.removeCSSClass("ct-ignition--editing"),this.removeCSSClass("ct-ignition--ready"),"busy"===this._state?this.addCSSClass("ct-ignition--busy"):"editing"===this._state?this.addCSSClass("ct-ignition--editing"):"ready"===this._state?this.addCSSClass("ct-ignition--ready"):void 0},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domEdit=null,this._domConfirm=null,this._domCancel=null},b.prototype._addDOMEventListeners=function(){return this._domEdit.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.edit()}}(this)),this._domConfirm.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.confirm()}}(this)),this._domCancel.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.cancel()}}(this))},b}(b.WidgetUI),b.InspectorUI=function(a){function c(){c.__super__.constructor.call(this),this._tagUIs=[]}return g(c,a),c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-inspector"]),this.parent().domElement().appendChild(this._domElement),this._domTags=this.constructor.createDiv(["ct-inspector__tags","ct-tags"]),this._domElement.appendChild(this._domTags),this._domCounter=this.constructor.createDiv(["ct-inspector__counter"]),this._domElement.appendChild(this._domCounter),this.updateCounter(),this._addDOMEventListeners(),this._handleFocusChange=function(a){return function(){return a.updateTags()}}(this),ContentEdit.Root.get().bind("blur",this._handleFocusChange),ContentEdit.Root.get().bind("focus",this._handleFocusChange),ContentEdit.Root.get().bind("mount",this._handleFocusChange)},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domTags=null,ContentEdit.Root.get().unbind("blur",this._handleFocusChange),ContentEdit.Root.get().unbind("focus",this._handleFocusChange),ContentEdit.Root.get().unbind("mount",this._handleFocusChange)},c.prototype.updateCounter=function(){var a,c,d,e,f,g,h,i,j,k,l;if(this.isMounted()){for(c="",l=b.EditorApp.get().orderedRegions(),j=0,k=l.length;j<k;j++)(g=l[j])&&(c+=g.domElement().textContent);return c=c.trim(),(c=c.replace(/<\/?[a-z][^>]*>/gi,""),c=c.replace(/[\u200B]+/,""),c=c.replace(/['";:,.?¿\-!¡]+/g,""),i=(c.match(/\S+/g)||[]).length,i=i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),(d=ContentEdit.Root.get().focused())&&"PreText"===d.type()&&d.selection().isCollapsed())?(e=0,a=1,h=d.content.substring(0,d.selection().get()[0]),f=h.text().split("\n"),e=f.length,a=f[f.length-1].length+1,e=e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),a=a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),this._domCounter.textContent=i+" / "+e+":"+a):void(this._domCounter.textContent=i)}},c.prototype.updateTags=function(){var a,c,d,e,f,g,h,i,j;for(a=ContentEdit.Root.get().focused(),i=this._tagUIs,e=0,g=i.length;e<g;e++)d=i[e],d.unmount();if(this._tagUIs=[],a){for(c=a.parents(),c.reverse(),c.push(a),j=[],f=0,h=c.length;f<h;f++)a=c[f],-1===b.INSPECTOR_IGNORED_ELEMENTS.indexOf(a.type())&&(d=new b.TagUI(a),this._tagUIs.push(d),j.push(d.mount(this._domTags)));return j}},c.prototype._addDOMEventListeners=function(){return this._updateCounterInterval=setInterval(function(a){return function(){return a.updateCounter()}}(this),250)},c.prototype._removeDOMEventListeners=function(){return clearInterval(this._updateCounterInterval)},c}(b.WidgetUI),b.TagUI=function(a){function c(a){this.element=a,this._onMouseDown=h(this._onMouseDown,this),c.__super__.constructor.call(this)}return g(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-tag"]),this._domElement.textContent=this.element.tagName(),c.__super__.mount.call(this,a,b)},c.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown)},c.prototype._onMouseDown=function(a){var c,d,e;return a.preventDefault(),this.element.storeState&&this.element.storeState(),c=b.EditorApp.get(),e=new b.ModalUI,d=new b.PropertiesDialog(this.element),d.addEventListener("cancel",function(a){return function(){if(e.hide(),d.hide(),a.element.restoreState)return a.element.restoreState()}}(this)),d.addEventListener("save",function(a){return function(b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;j=b.detail(),f=j.changedAttributes,n=j.changedStyles,l=j.innerHTML;for(m in f)if(o=f[m],"class"===m){for(null===o&&(o=""),h={},t=o.split(" "),p=0,r=t.length;p<r;p++)g=t[p],(g=g.trim())&&(h[g]=!0,a.element.hasCSSClass(g)||a.element.addCSSClass(g));if(a.element.attr("class"))for(u=a.element.attr("class").split(" "),q=0,s=u.length;q<s;q++)g=u[q],g=g.trim(),void 0===h[g]&&a.element.removeCSSClass(g)}else null===o?a.element.removeAttr(m):a.element.attr(m,o);for(i in n)c=n[i],c?a.element.addCSSClass(i):a.element.removeCSSClass(i);if(null!==l&&l!==d.getElementInnerHTML()&&(k=a.element,k.content||(k=k.children[0]),k.content=new HTMLString.String(l,k.content.preserveWhitespace()),k.updateInnerHTML(),k.taint(),k.selection(new ContentSelect.Range(0,0)),k.storeState()),e.hide(),d.hide(),a.element.restoreState)return a.element.restoreState()}}(this)),c.attach(e),c.attach(d),e.show(),d.show()},c}(b.AnchoredComponentUI),b.ModalUI=function(a){function b(a,c){b.__super__.constructor.call(this),this._transparent=a,this._allowScrolling=c}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-modal"]),this.parent().domElement().appendChild(this._domElement),this._transparent&&this.addCSSClass("ct-modal--transparent"),this._allowScrolling||ContentEdit.addCSSClass(document.body,"ct--no-scroll"),this._addDOMEventListeners()},b.prototype.unmount=function(){return this._allowScrolling||ContentEdit.removeCSSClass(document.body,"ct--no-scroll"),b.__super__.unmount.call(this)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("click"))}}(this))},b}(b.WidgetUI),b.ToolboxUI=function(a){function c(a){this._onStopDragging=h(this._onStopDragging,this),this._onStartDragging=h(this._onStartDragging,this),this._onDrag=h(this._onDrag,this),c.__super__.constructor.call(this),this._tools=a,this._dragging=!1,this._draggingOffset=null,this._domGrip=null,this._toolUIs={}}return g(c,a),c.prototype.isDragging=function(){return this._dragging},c.prototype.hide=function(){return this._removeDOMEventListeners(),c.__super__.hide.call(this)},c.prototype.mount=function(){var a,b,c;return this._domElement=this.constructor.createDiv(["ct-widget","ct-toolbox"]),this.parent().domElement().appendChild(this._domElement),this._domGrip=this.constructor.createDiv(["ct-toolbox__grip","ct-grip"]),this._domElement.appendChild(this._domGrip),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domToolGroups=this.constructor.createDiv(["ct-tool-groups"]),this._domElement.appendChild(this._domToolGroups),this.tools(this._tools),c=window.localStorage.getItem("ct-toolbox-position"),c&&/^\d+,\d+$/.test(c)&&(b=function(){var b,d,e,f;for(e=c.split(","),f=[],b=0,d=e.length;b<d;b++)a=e[b],f.push(parseInt(a));return f}(),this._domElement.style.left=b[0]+"px",this._domElement.style.top=b[1]+"px",this._contain()),this._addDOMEventListeners()},c.prototype.tools=function(a){var c,d,e,f,g,h,i,j,k,l,m;if(void 0===a)return this._tools;if(this._tools=a,this.isMounted()){k=this._toolUIs;for(g in k)h=k[g],h.unmount();for(this._toolUIs={};this._domToolGroups.lastChild;)this._domToolGroups.removeChild(this._domToolGroups.lastChild);for(l=this._tools,m=[],d=i=0,j=l.length;i<j;d=++i)f=l[d],c=this.constructor.createDiv(["ct-tool-group"]),this._domToolGroups.appendChild(c),m.push(function(){var a,d,h;for(h=[],a=0,d=f.length;a<d;a++)g=f[a],e=b.ToolShelf.fetch(g),this._toolUIs[g]=new b.ToolUI(e),this._toolUIs[g].mount(c),this._toolUIs[g].disabled(!0),h.push(this._toolUIs[g].addEventListener("applied",function(a){return function(){return a.updateTools()}}(this)));return h}.call(this));return m}},c.prototype.updateTools=function(){var a,b,c,d,e,f;a=ContentEdit.Root.get().focused(),c=null,a&&a.selection&&(c=a.selection()),e=this._toolUIs,f=[];for(b in e)d=e[b],f.push(d.update(a,c));return f},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domGrip=null},c.prototype._addDOMEventListeners=function(){return this._domGrip.addEventListener("mousedown",this._onStartDragging),this._domGrip.addEventListener("touchstart",this._onStartDragging),this._handleResize=function(a){return function(b){var c;return a._resizeTimeout&&clearTimeout(a._resizeTimeout),c=function(){return a._contain()},a._resizeTimeout=setTimeout(c,250)}}(this),window.addEventListener("resize",this._handleResize),this._updateTools=function(a){return function(){var c,d,e,f,g,h,i,j;if(c=b.EditorApp.get(),h=!1,d=ContentEdit.Root.get().focused(),f=null,d===a._lastUpdateElement?d&&d.selection&&(f=d.selection(),a._lastUpdateSelection?f.eq(a._lastUpdateSelection)||(h=!0):h=!0):h=!0,c.history&&(a._lastUpdateHistoryLength!==c.history.length()&&(h=!0),a._lastUpdateHistoryLength=c.history.length(),a._lastUpdateHistoryIndex!==c.history.index()&&(h=!0),a._lastUpdateHistoryIndex=c.history.index()),a._lastUpdateElement=d,a._lastUpdateSelection=f,h){i=a._toolUIs,j=[];for(e in i)g=i[e],j.push(g.update(d,f));return j}}}(this),this._updateToolsInterval=setInterval(this._updateTools,100),this._handleKeyDown=function(a){return function(c){var d,e,f,g,h,i,j;if((e=ContentEdit.Root.get().focused())&&!e.content){if(46===c.keyCode)return c.preventDefault(),b.Tools.Remove.apply(e,null,function(){});if(13===c.keyCode)return c.preventDefault(),d=b.Tools.Paragraph,d.apply(e,null,function(){})}switch(j=navigator.appVersion,f="linux",-1!==j.indexOf("Mac")?f="mac":-1!==j.indexOf("Win")&&(f="windows"),g=!1,i=!1,h=!1,f){case"linux":c.altKey||(90===c.keyCode&&c.ctrlKey&&(g=c.shiftKey,i=!g),83===c.keyCode&&c.ctrlKey&&(h=!0));break;case"mac":c.altKey||c.ctrlKey||(90===c.keyCode&&c.metaKey&&(g=c.shiftKey,i=!g),83===c.keyCode&&c.metaKey&&(h=!0));break;case"windows":c.altKey&&!c.shiftKey||(89===c.keyCode&&c.ctrlKey&&(g=!0),90===c.keyCode&&c.ctrlKey&&(i=!0),83===c.keyCode&&c.ctrlKey&&(h=!0))}if(i&&b.Tools.Undo.canApply(null,null)&&b.Tools.Undo.apply(null,null,function(){}),g&&b.Tools.Redo.canApply(null,null)&&b.Tools.Redo.apply(null,null,function(){}),h)return c.preventDefault(),a._parent.save(!0)}}(this),window.addEventListener("keydown",this._handleKeyDown)},c.prototype._contain=function(){var a;if(this.isMounted())return a=this._domElement.getBoundingClientRect(),a.left+a.width>window.innerWidth&&(this._domElement.style.left=window.innerWidth-a.width+"px"),a.top+a.height>window.innerHeight&&(this._domElement.style.top=window.innerHeight-a.height+"px"),a.left<0&&(this._domElement.style.left="0px"),a.top<0&&(this._domElement.style.top="0px"),a=this._domElement.getBoundingClientRect(),window.localStorage.setItem("ct-toolbox-position",a.left+","+a.top)},c.prototype._removeDOMEventListeners=function(){return this.isMounted()&&this._domGrip.removeEventListener("mousedown",this._onStartDragging),window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("resize",this._handleResize),clearInterval(this._updateToolsInterval)},c.prototype._onDrag=function(a){return a.preventDefault(),ContentSelect.Range.unselectAll(),"touchmove"===a.type?(this._domElement.style.left=a.touches[0].clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.touches[0].clientY-this._draggingOffset.y+"px"):(this._domElement.style.left=a.clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.clientY-this._draggingOffset.y+"px")},c.prototype._onStartDragging=function(a){var b;if(a.preventDefault(),!this.isDragging())return this._dragging=!0,this.addCSSClass("ct-toolbox--dragging"),b=this._domElement.getBoundingClientRect(),"touchstart"===a.type?(this._draggingOffset={x:a.touches[0].clientX-b.left,y:a.touches[0].clientY-b.top},document.addEventListener("touchmove",this._onDrag),document.addEventListener("touchend",this._onStopDragging)):(this._draggingOffset={x:a.clientX-b.left,y:a.clientY-b.top},document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging)),ContentEdit.addCSSClass(document.body,"ce--dragging")},c.prototype._onStopDragging=function(a){if(this.isDragging())return this._contain(),document.removeEventListener("touchmove",this._onDrag),document.removeEventListener("touchend",this._onStopDragging),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._draggingOffset=null,this._dragging=!1,this.removeCSSClass("ct-toolbox--dragging"),ContentEdit.removeCSSClass(document.body,"ce--dragging")},c}(b.WidgetUI),b.ToolUI=function(a){function b(a){this._onMouseUp=h(this._onMouseUp,this),this._onMouseLeave=h(this._onMouseLeave,this),this._onMouseDown=h(this._onMouseDown,this),this._addDOMEventListeners=h(this._addDOMEventListeners,this),b.__super__.constructor.call(this),this.tool=a,this._mouseDown=!1,this._disabled=!1}return g(b,a),b.prototype.apply=function(a,b){var c,d;if(this.tool.canApply(a,b))return d={element:a,selection:b},c=function(a){return function(b){if(b)return a.dispatchEvent(a.createEvent("applied",d))}}(this),this.dispatchEvent(this.createEvent("apply",d))?this.tool.apply(a,b,c):void 0},b.prototype.disabled=function(a){if(void 0===a)return this._disabled;if(this._disabled!==a)return this._disabled=a,a?(this._mouseDown=!1,this.addCSSClass("ct-tool--disabled"),this.removeCSSClass("ct-tool--applied")):this.removeCSSClass("ct-tool--disabled")},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-tool","ct-tool--"+this.tool.icon]),this._domElement.setAttribute("data-ct-tooltip",ContentEdit._(this.tool.label)),b.__super__.mount.call(this,a,c)},b.prototype.update=function(a,b){return(!this.tool.requiresElement||a&&a.isMounted())&&this.tool.canApply(a,b)?(this.disabled(!1),this.tool.isApplied(a,b)?this.addCSSClass("ct-tool--applied"):this.removeCSSClass("ct-tool--applied")):void this.disabled(!0)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseleave",this._onMouseLeave),this._domElement.addEventListener("mouseup",this._onMouseUp)},b.prototype._onMouseDown=function(a){if(a.preventDefault(),!this.disabled())return this._mouseDown=!0,this.addCSSClass("ct-tool--down")},b.prototype._onMouseLeave=function(a){return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b.prototype._onMouseUp=function(a){var b,c;if(this._mouseDown){if(b=ContentEdit.Root.get().focused(),this.tool.requiresElement&&(!b||!b.isMounted()))return;c=null,b&&b.selection&&(c=b.selection()),this.apply(b,c)}return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b}(b.AnchoredComponentUI),b.AnchoredDialogUI=function(a){function b(){b.__super__.constructor.call(this),this._position=[0,0]}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-anchored-dialog"]),this.parent().domElement().appendChild(this._domElement),this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"},b.prototype.position=function(a){return void 0===a?this._position.slice():(this._position=a.slice(),this.isMounted()?(this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"):void 0)},b.prototype._contain=function(){var a,b,c;if(this.isMounted())return c=this._domElement.getBoundingClientRect(),a=c.width/2+5,b=document.documentElement.clientWidth||document.body.clientWidth,this._position[0]+a>b&&(this._position[0]=b-a),this._position[0]<a&&(this._position[0]=a),this._position[1]+c.top<5?this._position[1]=Math.abs(c.top)+5:void 0},b}(b.WidgetUI),b.DialogUI=function(a){function b(a){null==a&&(a=""),b.__super__.constructor.call(this),this._busy=!1,this._caption=a}return g(b,a),b.prototype.busy=function(a){if(void 0===a)return this._busy;if(this._busy!==a&&(this._busy=a,this.isMounted()))return this._busy?ContentEdit.addCSSClass(this._domElement,"ct-dialog--busy"):ContentEdit.removeCSSClass(this._domElement,"ct-dialog--busy")},b.prototype.caption=function(a){return void 0===a?this._caption:(this._caption=a,this._domCaption.textContent=ContentEdit._(a))},b.prototype.mount=function(){var a,b,c;return document.activeElement&&(document.activeElement.blur(),window.getSelection().removeAllRanges()),a=["ct-widget","ct-dialog"],this._busy&&a.push("ct-dialog--busy"),this._domElement=this.constructor.createDiv(a),this.parent().domElement().appendChild(this._domElement),c=this.constructor.createDiv(["ct-dialog__header"]),this._domElement.appendChild(c),this._domCaption=this.constructor.createDiv(["ct-dialog__caption"]),c.appendChild(this._domCaption),this.caption(this._caption),this._domClose=this.constructor.createDiv(["ct-dialog__close"]),c.appendChild(this._domClose),b=this.constructor.createDiv(["ct-dialog__body"]),this._domElement.appendChild(b),this._domView=this.constructor.createDiv(["ct-dialog__view"]),b.appendChild(this._domView),this._domControls=this.constructor.createDiv(["ct-dialog__controls"]),b.appendChild(this._domControls),this._domBusy=this.constructor.createDiv(["ct-dialog__busy"]),this._domElement.appendChild(this._domBusy)},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBusy=null,this._domCaption=null,this._domClose=null,this._domControls=null,this._domView=null},b.prototype._addDOMEventListeners=function(){return this._handleEscape=function(a){return function(b){if(!a._busy)return 27===b.keyCode?a.dispatchEvent(a.createEvent("cancel")):void 0}}(this),document.addEventListener("keyup",this._handleEscape),this._domClose.addEventListener("click",function(a){return function(b){if(b.preventDefault(),!a._busy)return a.dispatchEvent(a.createEvent("cancel"))}}(this))},b.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keyup",this._handleEscape)},b}(b.WidgetUI),b.ImageDialog=function(a){function d(){d.__super__.constructor.call(this,"Insert image"),this._cropMarks=null,this._imageURL=null,this._imageSize=null,this._progress=0,this._state="empty",b.IMAGE_UPLOADER&&b.IMAGE_UPLOADER(this)}return g(d,a),d.prototype.cropRegion=function(){return this._cropMarks?this._cropMarks.region():[0,0,1,1]},d.prototype.hideImages=function(){if(this._domImagesContainer)return this._domImagesContainer.parentNode.removeChild(this._domImagesContainer)},d.prototype.showImages=function(){var a,b,c,d,e,f,g,h;if(this.hideImages,this.images){for(this._domImagesContainer=this.constructor.createDiv(["ct-image-dialog-images__container"]),this._domView.appendChild(this._domImagesContainer),d=this.constructor.createDiv(["ct-image-dialog-images"]),this._domImagesContainer.appendChild(d),g=this.images,h=[],e=0,f=g.length;e<f;e++)a=g[e],c=this.constructor.createDiv(["ct-image-dialog-images__image"]),b=new Image,b.src=a,c.appendChild(b),d.appendChild(c),h.push(b.addEventListener("click",function(a){return function(b){return a._imageSelected={src:b.target.attributes[0].value,size:[b.target.naturalWidth,b.target.naturalHeight]},a.populate(a._imageSelected.src,a._imageSelected.size)}}(this)));return h}},d.prototype.addImages=function(a){return this.images=a},d.prototype.addCropMarks=function(){if(!this._cropMarks)return this._cropMarks=new c(this._imageSize),this._cropMarks.mount(this._domView),ContentEdit.addCSSClass(this._domCrop,"ct-control--active")},d.prototype.clear=function(){return this._domImage&&(this._domImage.parentNode.removeChild(this._domImage),this._domImage=null),this._imageURL=null,this._imageSize=null,this.state("empty"),this.showImages()},d.prototype.mount=function(){var a,b,c;return d.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog"),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--empty"),ContentEdit.addCSSClass(this._domView,"ct-image-dialog__view"),c=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(c),b=this.constructor.createDiv(["ct-progress-bar"]),c.appendChild(b),this._domProgress=this.constructor.createDiv(["ct-progress-bar__progress"]),b.appendChild(this._domProgress),a=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(a),this._domUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--upload"]),this._domUpload.textContent=ContentEdit._("Upload"),a.appendChild(this._domUpload),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-image-dialog__file-upload"),this._domInput.setAttribute("name","file"),this._domInput.setAttribute("type","file"),this._domInput.setAttribute("accept","image/*"),this._domUpload.appendChild(this._domInput),this._domInsert=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert"]),this._domInsert.textContent=ContentEdit._("Insert"),a.appendChild(this._domInsert),this._domCancelUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--cancel"]),this._domCancelUpload.textContent=ContentEdit._("Cancel"),a.appendChild(this._domCancelUpload),this._domClear=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--clear"]),this._domClear.textContent=ContentEdit._("Clear"),a.appendChild(this._domClear),this._addDOMEventListeners(),this.dispatchEvent(this.createEvent("imageuploader.mount")),this.showImages()},d.prototype.populate=function(a,b){return this.hideImages(),this._imageURL=a,this._imageSize=b,this._domImage||(this._domImage=this.constructor.createDiv(["ct-image-dialog__image"]),this._domView.appendChild(this._domImage)),this._domImage.style["background-image"]="url("+a+")",this.state("populated")},d.prototype.progress=function(a){return void 0===a?this._progress:(this._progress=a,this.isMounted()?this._domProgress.style.width=this._progress+"%":void 0)},d.prototype.removeCropMarks=function(){if(this._cropMarks)return this._cropMarks.unmount(),this._cropMarks=null,ContentEdit.removeCSSClass(this._domCrop,"ct-control--active")},d.prototype.save=function(a,b,c){return a?this.dispatchEvent(this.createEvent("save",{imageURL:a,imageSize:b,imageAttrs:c})):this._imageSelected?this.dispatchEvent(this.createEvent("save",{imageURL:this._imageSelected.src,imageSize:this._imageSelected.size})):void 0},d.prototype.state=function(a){var b;if(void 0===a)return this._state;if(this._state!==a&&(b=this._state,this._state=a,this.isMounted()))return ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--"+this._state),ContentEdit.removeCSSClass(this._domElement,"ct-image-dialog--"+b)},d.prototype.unmount=function(){return d.__super__.unmount.call(this),this._domCancelUpload=null,this._domClear=null,this._domCrop=null,this._domInput=null,this._domInsert=null,this._domProgress=null,this._domRotateCCW=null,this._domRotateCW=null,this._domUpload=null,this.dispatchEvent(this.createEvent("imageuploader.unmount"))},d.prototype._addDOMEventListeners=function(){return d.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("change",function(a){return function(b){var c;if(c=b.target.files[0])return b.target.value="",b.target.value&&(b.target.type="text",b.target.type="file"),a.dispatchEvent(a.createEvent("imageuploader.fileready",{file:c}))}}(this)),this._domCancelUpload.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("imageuploader.cancelupload"))}}(this)),this._domClear.addEventListener("click",function(a){return function(b){return a.removeCropMarks(),a.dispatchEvent(a.createEvent("imageuploader.clear"))}}(this)),this._domInsert.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("imageuploader.save"))}}(this))},d}(b.DialogUI),c=function(a){function c(a){c.__super__.constructor.call(this),this._bounds=null,this._dragging=null,this._draggingOrigin=null,this._imageSize=a}return g(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-crop-marks"]),this._domClipper=this.constructor.createDiv(["ct-crop-marks__clipper"]),this._domElement.appendChild(this._domClipper),this._domRulers=[this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--top-left"]),this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--bottom-right"])],this._domClipper.appendChild(this._domRulers[0]),this._domClipper.appendChild(this._domRulers[1]),this._domHandles=[this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--top-left"]),this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--bottom-right"])],this._domElement.appendChild(this._domHandles[0]),this._domElement.appendChild(this._domHandles[1]),c.__super__.mount.call(this,a,b),this._fit(a)},c.prototype.region=function(){return[parseFloat(this._domHandles[0].style.top)/this._bounds[1],parseFloat(this._domHandles[0].style.left)/this._bounds[0],parseFloat(this._domHandles[1].style.top)/this._bounds[1],parseFloat(this._domHandles[1].style.left)/this._bounds[0]]},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domClipper=null,this._domHandles=null,this._domRulers=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domHandles[0].addEventListener("mousedown",function(a){return function(b){if(0===b.button)return a._startDrag(0,b.clientY,b.clientX)}}(this)),this._domHandles[1].addEventListener("mousedown",function(a){return function(b){if(0===b.button)return a._startDrag(1,b.clientY,b.clientX)}}(this))},c.prototype._drag=function(a,c){var d,e,f,g,h;if(null!==this._dragging)return ContentSelect.Range.unselectAll(),g=a-this._draggingOrigin[1],f=c-this._draggingOrigin[0],d=this._bounds[1],c=0,a=0,h=this._bounds[0],e=Math.min(Math.min(b.MIN_CROP,d),h),0===this._dragging?(d=parseInt(this._domHandles[1].style.top)-e,h=parseInt(this._domHandles[1].style.left)-e):(c=parseInt(this._domHandles[0].style.left)+e,a=parseInt(this._domHandles[0].style.top)+e),g=Math.min(Math.max(a,g),d),f=Math.min(Math.max(c,f),h),this._domHandles[this._dragging].style.top=g+"px",this._domHandles[this._dragging].style.left=f+"px",this._domRulers[this._dragging].style.top=g+"px",this._domRulers[this._dragging].style.left=f+"px"},c.prototype._fit=function(a){var b,c,d,e,f,g,h,i;return f=a.getBoundingClientRect(),i=f.width/this._imageSize[0],c=f.height/this._imageSize[1],e=Math.min(i,c),h=e*this._imageSize[0],b=e*this._imageSize[1],d=(f.width-h)/2,g=(f.height-b)/2,this._domElement.style.width=h+"px",this._domElement.style.height=b+"px",this._domElement.style.top=g+"px",this._domElement.style.left=d+"px",this._domHandles[0].style.top="0px",this._domHandles[0].style.left="0px",this._domHandles[1].style.top=b+"px",this._domHandles[1].style.left=h+"px",this._domRulers[0].style.top="0px",this._domRulers[0].style.left="0px",this._domRulers[1].style.top=b+"px",this._domRulers[1].style.left=h+"px",this._bounds=[h,b]},c.prototype._startDrag=function(a,b,c){var d;return d=this._domHandles[a],this._dragging=a,this._draggingOrigin=[c-parseInt(d.style.left),b-parseInt(d.style.top)],this._onMouseMove=function(a){return function(b){return a._drag(b.clientY,b.clientX)}}(this),document.addEventListener("mousemove",this._onMouseMove),this._onMouseUp=function(a){return function(b){return a._stopDrag()}}(this),document.addEventListener("mouseup",this._onMouseUp)},c.prototype._stopDrag=function(){return document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._dragging=null,this._draggingOrigin=null},c}(b.AnchoredComponentUI),b.LinkDialog=function(a){function b(a,c){null==a&&(a=""),null==c&&(c=""),b.__super__.constructor.call(this),this._href=a,this._target=c}var c;return g(b,a),c="_blank",b.prototype.mount=function(){return b.__super__.mount.call(this),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-anchored-dialog__input"),this._domInput.setAttribute("name","href"),this._domInput.setAttribute("placeholder",ContentEdit._("Enter a link")+"..."),this._domInput.setAttribute("type","text"),this._domInput.setAttribute("value",this._href),this._domElement.appendChild(this._domInput),this._domTargetButton=this.constructor.createDiv(["ct-anchored-dialog__target-button"]),this._domElement.appendChild(this._domTargetButton),this._target===c&&ContentEdit.addCSSClass(this._domTargetButton,"ct-anchored-dialog__target-button--active"),this._domButton=this.constructor.createDiv(["ct-anchored-dialog__button"]),this._domElement.appendChild(this._domButton),this._addDOMEventListeners()},b.prototype.save=function(){var a;return this.isMounted()?(a={href:this._domInput.value.trim()},this._target&&(a.target=this._target),this.dispatchEvent(this.createEvent("save",a))):void this.dispatchEvent(this.createEvent("save"))},b.prototype.show=function(){if(b.__super__.show.call(this),this._domInput.focus(),this._href)return this._domInput.select()},b.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),b.__super__.unmount.call(this),this._domButton=null,this._domInput=null},b.prototype._addDOMEventListeners=function(){return this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domTargetButton.addEventListener("click",function(a){return function(b){return b.preventDefault(),a._target===c?(a._target="",ContentEdit.removeCSSClass(a._domTargetButton,"ct-anchored-dialog__target-button--active")):(a._target=c,ContentEdit.addCSSClass(a._domTargetButton,"ct-anchored-dialog__target-button--active"))}}(this)),this._domButton.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.save()}}(this))},b}(b.AnchoredDialogUI),b.PropertiesDialog=function(c){function e(a){var b;this.element=a,e.__super__.constructor.call(this,"Properties"),this._attributeUIs=[],this._focusedAttributeUI=null,this._styleUIs=[],this._supportsCoding=this.element.content,"ListItem"!==(b=this.element.type())&&"TableCell"!==b||(this._supportsCoding=!0)}return g(e,c),e.prototype.caption=function(a){return void 0===a?this._caption:(this._caption=a,this._domCaption.textContent=ContentEdit._(a)+": "+this.element.tagName())},e.prototype.changedAttributes=function(){var a,c,d,e,f,g,h,i,j,k;for(c={},d={},j=this._attributeUIs,h=0,i=j.length;h<i;h++)a=j[h],e=a.name(),g=a.value(),""!==e&&(c[e.toLowerCase()]=!0,this.element.attr(e)!==g&&(d[e]=g));f=b.getRestrictedAtributes(this.element.tagName()),k=this.element.attributes();for(e in k)g=k[e],f&&-1!==f.indexOf(e.toLowerCase())||void 0===c[e]&&(d[e]=null);return d},e.prototype.changedStyles=function(){var a,b,c,d,e,f;for(c={},f=this._styleUIs,d=0,e=f.length;d<e;d++)b=f[d],a=b.style.cssClass(),this.element.hasCSSClass(a)!==b.applied()&&(c[a]=b.applied());return c},e.prototype.getElementInnerHTML=function(){return this._supportsCoding?this.element.content?this.element.content.html():this.element.children[0].content.html():null},e.prototype.mount=function(){var a,c,f,g,h,i,j,k,l,m,n,o,p,q,r;for(e.__super__.mount.call(this),
ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog"),ContentEdit.addCSSClass(this._domView,"ct-properties-dialog__view"),this._domStyles=this.constructor.createDiv(["ct-properties-dialog__styles"]),this._domStyles.setAttribute("data-ct-empty",ContentEdit._("No styles available for this tag")),this._domView.appendChild(this._domStyles),r=b.StylePalette.styles(this.element),n=0,p=r.length;n<p;n++)k=r[n],l=new d(k,this.element.hasCSSClass(k.cssClass())),this._styleUIs.push(l),l.mount(this._domStyles);this._domAttributes=this.constructor.createDiv(["ct-properties-dialog__attributes"]),this._domView.appendChild(this._domAttributes),j=b.getRestrictedAtributes(this.element.tagName()),c=this.element.attributes(),a=[];for(i in c)m=c[i],j&&-1!==j.indexOf(i.toLowerCase())||a.push(i);for(-1===a.indexOf("class")&&a.push("class"),a.sort(),o=0,q=a.length;o<q;o++)i=a[o],m=c[i],void 0===m&&(m=""),this._addAttributeUI(i,m);return this._addAttributeUI("",""),this._domCode=this.constructor.createDiv(["ct-properties-dialog__code"]),this._domView.appendChild(this._domCode),this._domInnerHTML=document.createElement("textarea"),this._domInnerHTML.setAttribute("class","ct-properties-dialog__inner-html"),this._domInnerHTML.setAttribute("name","code"),this._domInnerHTML.value=this.getElementInnerHTML(),this._domCode.appendChild(this._domInnerHTML),g=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(g),this._domStylesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--styles"]),this._domStylesTab.setAttribute("data-ct-tooltip",ContentEdit._("Styles")),g.appendChild(this._domStylesTab),this._domAttributesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--attributes"]),this._domAttributesTab.setAttribute("data-ct-tooltip",ContentEdit._("Attributes")),g.appendChild(this._domAttributesTab),this._domCodeTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--code"]),this._domCodeTab.setAttribute("data-ct-tooltip",ContentEdit._("Code")),g.appendChild(this._domCodeTab),this._supportsCoding||ContentEdit.addCSSClass(this._domCodeTab,"ct-control--muted"),this._domRemoveAttribute=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--remove","ct-control--muted"]),this._domRemoveAttribute.setAttribute("data-ct-tooltip",ContentEdit._("Remove")),g.appendChild(this._domRemoveAttribute),f=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(f),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent=ContentEdit._("Apply"),f.appendChild(this._domApply),h=window.localStorage.getItem("ct-properties-dialog-tab"),"attributes"===h?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--attributes"),ContentEdit.addCSSClass(this._domAttributesTab,"ct-control--active")):"code"===h&&this._supportsCoding?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--code"),ContentEdit.addCSSClass(this._domCodeTab,"ct-control--active")):(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--styles"),ContentEdit.addCSSClass(this._domStylesTab,"ct-control--active")),this._addDOMEventListeners()},e.prototype.save=function(){var a,b;return b=null,this._supportsCoding&&(b=this._domInnerHTML.value),a={changedAttributes:this.changedAttributes(),changedStyles:this.changedStyles(),innerHTML:b},this.dispatchEvent(this.createEvent("save",a))},e.prototype._addAttributeUI=function(c,d){var e,f;return f=this,e=new a(c,d),this._attributeUIs.push(e),e.addEventListener("blur",function(a){var b,c,d;if(f._focusedAttributeUI=null,ContentEdit.addCSSClass(f._domRemoveAttribute,"ct-control--muted"),b=f._attributeUIs.indexOf(this),d=f._attributeUIs.length,""===this.name()&&b<d-1&&(this.unmount(),f._attributeUIs.splice(b,1)),(c=f._attributeUIs[d-1])&&c.name()&&c.value())return f._addAttributeUI("","")}),e.addEventListener("focus",function(a){return f._focusedAttributeUI=this,ContentEdit.removeCSSClass(f._domRemoveAttribute,"ct-control--muted")}),e.addEventListener("namechange",function(a){var d,e,g,h,i,j,k;for(d=f.element,c=this.name().toLowerCase(),g=b.getRestrictedAtributes(d.tagName()),h=!0,g&&-1!==g.indexOf(c)&&(h=!1),k=f._attributeUIs,i=0,j=k.length;i<j;i++)e=k[i],""!==c&&e!==this&&e.name().toLowerCase()===c&&(h=!1);return this.valid(h),h?ContentEdit.removeCSSClass(f._domApply,"ct-control--muted"):ContentEdit.addCSSClass(f._domApply,"ct-control--muted")}),e.mount(this._domAttributes),e},e.prototype._addDOMEventListeners=function(){var a,b;return e.__super__._addDOMEventListeners.call(this),a=function(a){return function(b){var c,d,e,f,g,h;for(f=["attributes","code","styles"],g=0,h=f.length;g<h;g++)(d=f[g])!==b&&(e=d.charAt(0).toUpperCase()+d.slice(1),ContentEdit.removeCSSClass(a._domElement,"ct-properties-dialog--"+d),ContentEdit.removeCSSClass(a["_dom"+e+"Tab"],"ct-control--active"));return c=b.charAt(0).toUpperCase()+b.slice(1),ContentEdit.addCSSClass(a._domElement,"ct-properties-dialog--"+b),ContentEdit.addCSSClass(a["_dom"+c+"Tab"],"ct-control--active"),window.localStorage.setItem("ct-properties-dialog-tab",b)}}(this),this._domStylesTab.addEventListener("mousedown",function(b){return function(){return a("styles")}}()),this._domAttributesTab.addEventListener("mousedown",function(b){return function(){return a("attributes")}}()),this._supportsCoding&&this._domCodeTab.addEventListener("mousedown",function(b){return function(){return a("code")}}()),this._domRemoveAttribute.addEventListener("mousedown",function(a){return function(b){var c,d;if(b.preventDefault(),a._focusedAttributeUI&&(c=a._attributeUIs.indexOf(a._focusedAttributeUI),d=c===a._attributeUIs.length-1,a._focusedAttributeUI.unmount(),a._attributeUIs.splice(c,1),d))return a._addAttributeUI("","")}}(this)),b=function(a){return function(b){try{return new HTMLString.String(a._domInnerHTML.value),ContentEdit.removeCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")}catch(b){return ContentEdit.addCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted")}}}(this),this._domInnerHTML.addEventListener("input",b),this._domInnerHTML.addEventListener("propertychange",b),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},e}(b.DialogUI),d=function(a){function b(a,c){this.style=a,b.__super__.constructor.call(this),this._applied=c}return g(b,a),b.prototype.applied=function(a){if(void 0===a)return this._applied;if(this._applied!==a)return this._applied=a,this._applied?ContentEdit.addCSSClass(this._domElement,"ct-section--applied"):ContentEdit.removeCSSClass(this._domElement,"ct-section--applied")},b.prototype.mount=function(a,c){var d;return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-section"]),this._applied&&ContentEdit.addCSSClass(this._domElement,"ct-section--applied"),d=this.constructor.createDiv(["ct-section__label"]),d.textContent=this.style.name(),this._domElement.appendChild(d),this._domElement.appendChild(this.constructor.createDiv(["ct-section__switch"])),b.__super__.mount.call(this,a,c)},b.prototype._addDOMEventListeners=function(){var a;return a=function(a){return function(b){return b.preventDefault(),a.applied()?a.applied(!1):a.applied(!0)}}(this),this._domElement.addEventListener("click",a)},b}(b.AnchoredComponentUI),a=function(a){function b(a,c){b.__super__.constructor.call(this),this._initialName=a,this._initialValue=c}return g(b,a),b.prototype.name=function(){return this._domName.value.trim()},b.prototype.value=function(){return this._domValue.value.trim()},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-attribute"]),this._domName=document.createElement("input"),this._domName.setAttribute("class","ct-attribute__name"),this._domName.setAttribute("name","name"),this._domName.setAttribute("placeholder",ContentEdit._("Name")),this._domName.setAttribute("type","text"),this._domName.setAttribute("value",this._initialName),this._domElement.appendChild(this._domName),this._domValue=document.createElement("input"),this._domValue.setAttribute("class","ct-attribute__value"),this._domValue.setAttribute("name","value"),this._domValue.setAttribute("type","text"),this._domValue.setAttribute("value",this._initialValue),this._domElement.appendChild(this._domValue),b.__super__.mount.call(this,a,c)},b.prototype.valid=function(a){return a?ContentEdit.removeCSSClass(this._domName,"ct-attribute__name--invalid"):ContentEdit.addCSSClass(this._domName,"ct-attribute__name--invalid")},b.prototype._addDOMEventListeners=function(){return this._domName.addEventListener("blur",function(a){return function(){var b,c,d;if(b=a.name(),c=a._domElement.nextSibling,a.dispatchEvent(a.createEvent("blur")),""===b&&c)return d=c.querySelector(".ct-attribute__name"),d.focus()}}(this)),this._domName.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domName.addEventListener("input",function(a){return function(){return a.dispatchEvent(a.createEvent("namechange"))}}(this)),this._domName.addEventListener("keydown",function(a){return function(b){if(13===b.keyCode)return a._domValue.focus()}}(this)),this._domValue.addEventListener("blur",function(a){return function(){return a.dispatchEvent(a.createEvent("blur"))}}(this)),this._domValue.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domValue.addEventListener("keydown",function(a){return function(b){var c,d;if(13===b.keyCode||9===b.keyCode&&!b.shiftKey)return b.preventDefault(),c=a._domElement.nextSibling,c||(a._domValue.blur(),c=a._domElement.nextSibling),c?(d=c.querySelector(".ct-attribute__name"),d.focus()):void 0}}(this))},b}(b.AnchoredComponentUI),b.TableDialog=function(a){function b(a){this.table=a,this.table?b.__super__.constructor.call(this,"Update table"):b.__super__.constructor.call(this,"Insert table")}return g(b,a),b.prototype.mount=function(){var a,c,d,e,f,g,h;return b.__super__.mount.call(this),a={columns:3,foot:!1,head:!0},this.table&&(a={columns:this.table.firstSection().children[0].children.length,foot:this.table.tfoot(),head:this.table.thead()}),ContentEdit.addCSSClass(this._domElement,"ct-table-dialog"),ContentEdit.addCSSClass(this._domView,"ct-table-dialog__view"),h=["ct-section"],a.head&&h.push("ct-section--applied"),this._domHeadSection=this.constructor.createDiv(h),this._domView.appendChild(this._domHeadSection),f=this.constructor.createDiv(["ct-section__label"]),f.textContent=ContentEdit._("Table head"),this._domHeadSection.appendChild(f),this._domHeadSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domHeadSection.appendChild(this._domHeadSwitch),this._domBodySection=this.constructor.createDiv(["ct-section","ct-section--applied","ct-section--contains-input"]),this._domView.appendChild(this._domBodySection),c=this.constructor.createDiv(["ct-section__label"]),c.textContent=ContentEdit._("Table body (columns)"),this._domBodySection.appendChild(c),this._domBodyInput=document.createElement("input"),this._domBodyInput.setAttribute("class","ct-section__input"),this._domBodyInput.setAttribute("maxlength","2"),this._domBodyInput.setAttribute("name","columns"),this._domBodyInput.setAttribute("type","text"),this._domBodyInput.setAttribute("value",a.columns),this._domBodySection.appendChild(this._domBodyInput),g=["ct-section"],a.foot&&g.push("ct-section--applied"),this._domFootSection=this.constructor.createDiv(g),this._domView.appendChild(this._domFootSection),e=this.constructor.createDiv(["ct-section__label"]),e.textContent=ContentEdit._("Table foot"),this._domFootSection.appendChild(e),this._domFootSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domFootSection.appendChild(this._domFootSwitch),d=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(d),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent="Apply",d.appendChild(this._domApply),this._addDOMEventListeners()},b.prototype.save=function(){var a,b,c;return b=this._domFootSection.getAttribute("class"),c=this._domHeadSection.getAttribute("class"),a={columns:parseInt(this._domBodyInput.value),foot:b.indexOf("ct-section--applied")>-1,head:c.indexOf("ct-section--applied")>-1},this.dispatchEvent(this.createEvent("save",a))},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBodyInput=null,this._domBodySection=null,this._domApply=null,this._domHeadSection=null,this._domHeadSwitch=null,this._domFootSection=null,this._domFootSwitch=null},b.prototype._addDOMEventListeners=function(){var a;return b.__super__._addDOMEventListeners.call(this),a=function(a){return a.preventDefault(),this.getAttribute("class").indexOf("ct-section--applied")>-1?ContentEdit.removeCSSClass(this,"ct-section--applied"):ContentEdit.addCSSClass(this,"ct-section--applied")},this._domHeadSection.addEventListener("click",a),this._domFootSection.addEventListener("click",a),this._domBodySection.addEventListener("click",function(a){return function(b){return a._domBodyInput.focus()}}(this)),this._domBodyInput.addEventListener("input",function(a){return function(b){var c;return c=/^[1-9]\d{0,1}$/.test(b.target.value),c?(ContentEdit.removeCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")):(ContentEdit.addCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted"))}}(this)),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},b}(b.DialogUI),b.VideoDialog=function(a){function c(){c.__super__.constructor.call(this,"Insert video")}return g(c,a),c.prototype.clearPreview=function(){if(this._domPreview)return this._domPreview.parentNode.removeChild(this._domPreview),this._domPreview=void 0},c.prototype.mount=function(){var a;return c.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-video-dialog"),ContentEdit.addCSSClass(this._domView,"ct-video-dialog__preview"),a=this.constructor.createDiv(["ct-control-group"]),this._domControls.appendChild(a),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-video-dialog__input"),this._domInput.setAttribute("name","url"),this._domInput.setAttribute("placeholder",ContentEdit._("Paste YouTube or Vimeo URL")+"..."),this._domInput.setAttribute("type","text"),a.appendChild(this._domInput),this._domButton=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert","ct-control--muted"]),this._domButton.textContent=ContentEdit._("Insert"),a.appendChild(this._domButton),this._addDOMEventListeners()},c.prototype.preview=function(a){return this.clearPreview(),this._domPreview=document.createElement("iframe"),this._domPreview.setAttribute("frameborder","0"),this._domPreview.setAttribute("height","100%"),this._domPreview.setAttribute("src",a),this._domPreview.setAttribute("width","100%"),this._domView.appendChild(this._domPreview)},c.prototype.save=function(){var a,c;return c=this._domInput.value.trim(),a=b.getEmbedVideoURL(c),a?this.dispatchEvent(this.createEvent("save",{url:a})):this.dispatchEvent(this.createEvent("save",{url:c}))},c.prototype.show=function(){return c.__super__.show.call(this),this._domInput.focus()},c.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),c.__super__.unmount.call(this),this._domButton=null,this._domInput=null,this._domPreview=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("input",function(a){return function(c){var d;return c.target.value?ContentEdit.removeCSSClass(a._domButton,"ct-control--muted"):ContentEdit.addCSSClass(a._domButton,"ct-control--muted"),a._updatePreviewTimeout&&clearTimeout(a._updatePreviewTimeout),d=function(){var c,d;return d=a._domInput.value.trim(),c=b.getEmbedVideoURL(d),c?a.preview(c):a.clearPreview()},a._updatePreviewTimeout=setTimeout(d,500)}}(this)),this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domButton.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domButton.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},c}(b.DialogUI),b.HTMLCleaner=function(){function a(a,b){this.tagWhitelist=a||this.constructor.DEFAULT_TAG_WHITELIST,this.attributeWhitelist=b||this.constructor.DEFAULT_ATTRIBUTE_WHITELIST}return a.DEFAULT_ATTRIBUTE_WHITELIST={a:["href"],td:["colspan"]},a.DEFAULT_TAG_WHITELIST=["a","address","b","blockquote","code","del","em","h1","h2","h3","h4","h5","h6","i","ins","li","ol","p","pre","strong","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","#text"],a.NO_CONTENT_TAGS=["head","meta","style","script","title"],a.prototype.clean=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;for(j=document.implementation.createHTMLDocument(),m=j.createElement("div"),m.innerHTML=a,k=function(){var a,b,c,e;for(c=m.childNodes,e=[],a=0,b=c.length;a<b;a++)d=c[a],e.push(d);return e}();k.length>0;)if(f=k.shift(),g=f.nodeName.toLowerCase(),this.tagWhitelist.indexOf(g)<0){if(this.constructor.NO_CONTENT_TAGS.indexOf(g)>-1){f.remove();continue}for(r=f.childNodes,n=0,p=r.length;n<p;n++)(e=r[n])&&(e=e.cloneNode(!0),e.nodeName.toLowerCase(),f.parentNode.insertBefore(e,f),k.push(e));f.remove()}else if("#text"===g||""!==f.textContent.trim()){if("td"!==g&&"th"!==g&&"li"!==g||f.querySelector("p")&&(f.innerHTML=f.textContent),f.attributes)for(i=this.attributeWhitelist[g]||[],h=function(){var a,c,d,e;for(d=f.attributes,e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}(),o=0,q=h.length;o<q;o++)c=h[o],i.indexOf(c.name.toLowerCase())<0?f.removeAttribute(c.name):"href"===c.name.toLowerCase()&&(l=f.getAttribute(c.name),l.startsWith("javascript:"))&&f.removeAttribute(c.name);k.push.apply(k,function(){var a,b,c,e;for(c=f.childNodes,e=[],a=0,b=c.length;a<b;a++)d=c[a],e.push(d);return e}())}else""===f.textContent||f.parentNode===m?f.remove():f.parentNode.replaceChild(j.createTextNode(" "),f);return m.innerHTML},a}(),e=function(a){function c(){c.__super__.constructor.call(this),this.history=null,this._state="dormant",this._busy=!1,this._namingProp=null,this._fixtureTest=function(a){return a.hasAttribute("data-fixture")},this._regionQuery=null,this._domRegions=null,this._regions={},this._orderedRegions=[],this._rootLastModified=null,this._regionsLastModified={},this._ignition=null,this._inspector=null,this._toolbox=null,this._emptyRegionsAllowed=!1}return g(c,a),c.prototype.ctrlDown=function(){return this._ctrlDown},c.prototype.domRegions=function(){return this._domRegions},c.prototype.getState=function(){return this._state},c.prototype.ignition=function(){return this._ignition},c.prototype.inspector=function(){return this._inspector},c.prototype.isDormant=function(){return"dormant"===this._state},c.prototype.isReady=function(){return"ready"===this._state},c.prototype.isEditing=function(){return"editing"===this._state},c.prototype.orderedRegions=function(){var a;return function(){var b,c,d,e;for(d=this._orderedRegions,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(this._regions[a]);return e}.call(this)},c.prototype.regions=function(){return this._regions},c.prototype.shiftDown=function(){return this._shiftDown},c.prototype.toolbox=function(){return this._toolbox},c.prototype.busy=function(a){return void 0===a?this._busy:(this._busy=a,this._ignition?this._ignition.busy(a):void 0)},c.prototype.createPlaceholderElement=function(a){return new ContentEdit.Text("p",{},"")},c.prototype.init=function(a,c,d,e){return null==c&&(c="id"),null==d&&(d=null),null==e&&(e=!0),this._namingProp=c,d&&(this._fixtureTest=d),this.mount(),e&&(this._ignition=new b.IgnitionUI,this.attach(this._ignition),this._ignition.addEventListener("edit",function(a){return function(b){return b.preventDefault(),a.start(),a._ignition.state("editing")}}(this)),this._ignition.addEventListener("confirm",function(a){return function(b){if(b.preventDefault(),"editing"===a._ignition.state())return a._ignition.state("ready"),a.stop(!0)}}(this)),this._ignition.addEventListener("cancel",function(a){return function(b){if(b.preventDefault(),"editing"===a._ignition.state())return a.stop(!1),a.isEditing()?a._ignition.state("editing"):a._ignition.state("ready")}}(this))),this._toolbox=new b.ToolboxUI(b.DEFAULT_TOOLS),this.attach(this._toolbox),this._inspector=new b.InspectorUI,this.attach(this._inspector),this._state="ready",this._handleDetach=function(a){return function(b){return a._preventEmptyRegions()}}(this),this._handleClipboardPaste=function(a){return function(b,c){return null,c.clipboardData?void(c.clipboardData.getData("text/html")&&"PreText"!==b.type()?a.pasteHTML(b,c.clipboardData.getData("text/html")):a.pasteText(b,c.clipboardData.getData("text/plain"))):window.clipboardData?(window.clipboardData.getData("TEXT"),a.pasteText(b,window.clipboardData.getData("TEXT"))):void 0}}(this),this._handleNextRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i;if(f=a.orderedRegions(),!((e=f.indexOf(b))>=f.length-1)){for(b=f[e+1],d=null,i=b.descendants(),g=0,h=i.length;g<h;g++)if(c=i[g],void 0!==c.content){d=c;break}return d?(d.focus(),void d.selection(new ContentSelect.Range(0,0))):ContentEdit.Root.get().trigger("next-region",b)}}}(this),this._handlePreviousRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i,j;if(h=a.orderedRegions(),!((f=h.indexOf(b))<=0)){for(b=h[f-1],e=null,d=b.descendants(),d.reverse(),i=0,j=d.length;i<j;i++)if(c=d[i],void 0!==c.content){e=c;break}return e?(g=e.content.length(),e.focus(),void e.selection(new ContentSelect.Range(g,g))):ContentEdit.Root.get().trigger("previous-region",b)}}}(this),ContentEdit.Root.get().bind("detach",this._handleDetach),ContentEdit.Root.get().bind("paste",this._handleClipboardPaste),ContentEdit.Root.get().bind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().bind("previous-region",this._handlePreviousRegionTransition),this.syncRegions(a)},c.prototype.destroy=function(){return ContentEdit.Root.get().unbind("detach",this._handleDetach),ContentEdit.Root.get().unbind("paste",this._handleClipboardPaste),ContentEdit.Root.get().unbind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().unbind("previous-region",this._handlePreviousRegionTransition),this.removeEventListener(),this.unmount(),this._children=[]},c.prototype.highlightRegions=function(a){var b,c,d,e,f;for(e=this._domRegions,f=[],c=0,d=e.length;c<d;c++)b=e[c],a?f.push(ContentEdit.addCSSClass(b,"ct--highlight")):f.push(ContentEdit.removeCSSClass(b,"ct--highlight"));return f},c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-app"]),document.body.insertBefore(this._domElement,null),this._addDOMEventListeners()},c.prototype.unmount=function(){var a,b,c,d;if(this.isMounted()){for(d=this._children,b=0,c=d.length;b<c;b++)a=d[b],a.unmount();return this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,this._removeDOMEventListeners(),this._ignition=null,this._inspector=null,this._toolbox=null}},c.prototype.pasteHTML=function(a,c){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G;for(w=ContentEdit.TagNames.get(),u=document.implementation.createHTMLDocument(),A=u.createElement("div"),A.innerHTML=b.getHTMLCleaner().clean(c.trim()),f=[],F=A.childNodes,B=0,D=F.length;B<D;B++)(e=F[B])&&("#text"===e.nodeName.toLowerCase()&&""===e.textContent.trim()||f.push(e));if(f.length){if(l=b.INLINE_TAGS.slice(),l.push("#text"),j=f[0].nodeName.toLowerCase(),n=f[f.length-1].nodeName.toLowerCase(),a.isFixed()||l.indexOf(j)>-1&&l.indexOf(n)>-1){if(l.indexOf(j)>-1&&l.indexOf(n)>-1?c=new HTMLString.String(A.innerHTML):(console.log(A.textContent),c=new HTMLString.String(HTMLString.String.encode(A.textContent))),a.content)return v=a.selection(),g=v.get()[0]+c.length(),z=a.content.substring(0,v.get()[0]),y=a.content.substring(v.get()[1]),t=a.content.substring(v.get()[0],v.get()[1]),t.length()&&(d=t.characters[0],x=d.tags(),d.isTag()&&x.shift(),x.length>=1&&(c=c.format.apply(c,[0,c.length()].concat(i.call(x))))),a.content=z.concat(c),a.content=a.content.concat(y,!1),a.updateInnerHTML(),a.taint(),v.set(g,g),void a.selection(v);A.innerHTML="<p>"+c.html()+"</p>"}if(q=a,"Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),s=a.parent(),l.indexOf(j)>-1&&l.indexOf(n)>-1){for(m=A.createElement("p");A.childNodes.length>0;)m.appendChild(A.childNodes[0]);A.appendChild(m)}for(k=0,o=q,G=A.childNodes,C=0,E=G.length;C<E;C++)(p=G[C])&&("#text"===p.nodeName&&""===p.textContent.trim()||(h=w.match(p.nodeName),h===ContentEdit.Static&&(r=document.createElement("p"),r.appendChild(p),p=r,h=ContentEdit.Text),o=h.fromDOMElement(p),s.attach(o,s.children.indexOf(a)+(1+k)),k+=1));return o.focus?o.focus():o.nextSibling()?(o=o.nextSibling().previousWithTest(function(a){if(a.focus)return a}))?o.focus():void 0:(o=o.nextWithTest(function(a){if(a.focus)return a}),o?o.focus():q.focus())}},c.prototype.pasteText=function(a,b){var c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;if(p="PreText"!==a.type()?b.split("\n"):[b],p=p.filter(function(a){return""!==a.trim()})){if(e=HTMLString.String.encode,s=!0,w=a.type(),1===p.length&&(s=!1),"PreText"===w&&(s=!1),a.can("spawn")||(s=!1),s){for("ListItemText"===w?(j=a.parent(),h=a.parent().parent(),g=h.children.indexOf(j)+1):(j=a,"Region"!==j.parent().type()&&(j=a.closest(function(a){return"Region"===a.parent().type()})),h=j.parent(),g=h.children.indexOf(j)+1),f=x=0,y=p.length;x<y;f=++x)n=p[f],n=e(n),"ListItemText"===w?(k=new ContentEdit.ListItem,l=new ContentEdit.ListItemText(n),k.attach(l),m=l):(k=new ContentEdit.Text("p",{},n),m=k),h.attach(k,g+f);return o=m.content.length(),m.focus(),m.selection(new ContentSelect.Range(o,o))}return b=e(b),b=new HTMLString.String(b,"PreText"===w),r=a.selection(),d=r.get()[0]+b.length(),v=a.content.substring(0,r.get()[0]),u=a.content.substring(r.get()[1]),q=a.content.substring(r.get()[0],r.get()[1]),q.length()&&(c=q.characters[0],t=c.tags(),c.isTag()&&t.shift(),t.length>=1&&(b=b.format.apply(b,[0,b.length()].concat(i.call(t))))),a.content=v.concat(b),a.content=a.content.concat(u,!1),a.updateInnerHTML(),a.taint(),r.set(d,d),a.selection(r)}},c.prototype.revert=function(){var a;if(this.dispatchEvent(this.createEvent("revert")))return!(b.CANCEL_MESSAGE&&(a=ContentEdit._(b.CANCEL_MESSAGE),ContentEdit.Root.get().lastModified()>this._rootLastModified&&!window.confirm(a)))&&(this.revertToSnapshot(this.history.goTo(0),!1),!0)},c.prototype.revertToSnapshot=function(a,b){var c,d,e,f,g,h,i,j,k,l;null==b&&(b=!0),d=[],j=this._regions;for(e in j){for(f=j[e],k=f.children,h=0,i=k.length;h<i;h++)c=k[h],c.unmount();void 0!==a.regions[e]?1===f.children.length&&f.children[0].isFixed()?(g=this.constructor.createDiv(),g.innerHTML=a.regions[e],d.push(g.firstElementChild),f.domElement().parentNode.replaceChild(g.firstElementChild,f.domElement())):(d.push(f.domElement()),f.domElement().innerHTML=a.regions[e]):(f.domElement().remove(),delete this._regions[e])}if(this._domRegions=d,b){ContentEdit.Root.get().focused()&&ContentEdit.Root.get().focused().blur(),this._regions={},this.syncRegions(null,!0),ContentEdit.Root.get()._modified=a.rootModified,l=this._regions;for(e in l)f=l[e],a.regionModifieds[e]&&(f._modified=a.regionModifieds[e]);return this.history.replaceRegions(this._regions),this.history.restoreSelection(a),this._inspector.updateTags()}},c.prototype.save=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;if(this.dispatchEvent(this.createEvent("save",{passive:a}))){if(h=ContentEdit.Root.get(),h.focused()&&!a&&h.focused().blur(),h.lastModified()===this._rootLastModified&&a)return void this.dispatchEvent(this.createEvent("saved",{regions:{},passive:a}));c=[],e={},l=this._regions;for(f in l){if(g=l[f],d=g.html(),1===g.children.length&&"Fixture"===!g.type()&&(b=g.children[0],b.content&&!b.content.html()&&(d="")),!a){for(m=g.children,j=0,k=m.length;j<k;j++)b=m[j],b.unmount();1===g.children.length&&g.children[0].isFixed()?(i=this.constructor.createDiv(),i.innerHTML=d,c.push(i.firstElementChild),g.domElement().parentNode.replaceChild(i.firstElementChild,g.domElement())):(c.push(g.domElement()),g.domElement().innerHTML=d)}g.lastModified()!==this._regionsLastModified[f]&&(e[f]=d,this._regionsLastModified[f]=g.lastModified())}return this._domRegions=c,this.dispatchEvent(this.createEvent("saved",{regions:e,passive:a}))}},c.prototype.setRegionOrder=function(a){return this._orderedRegions=a.slice()},c.prototype.start=function(){if(this.dispatchEvent(this.createEvent("start")))return this.busy(!0),this.syncRegions(),this._initRegions(),this._preventEmptyRegions(),this._rootLastModified=ContentEdit.Root.get().lastModified(),this.history=new b.History(this._regions),this.history.watch(),this._state="editing",this._toolbox.show(),this._inspector.show(),this.busy(!1),this.dispatchEvent(this.createEvent("started"))},c.prototype.stop=function(a){var b;if(this.dispatchEvent(this.createEvent("stop",{save:a}))){if(b=ContentEdit.Root.get().focused(),b&&b.isMounted()&&void 0!==b._syncContent&&b._syncContent(),a)this.save();else if(!this.revert())return;return this.history.stopWatching(),this.history=null,this._toolbox.hide(),this._inspector.hide(),this._regions={},this._state="ready",ContentEdit.Root.get().focused()&&this._allowEmptyRegions(function(a){return function(){return ContentEdit.Root.get().focused().blur()}}()),this.dispatchEvent(this.createEvent("stopped"))}},c.prototype.syncRegions=function(a,b){if(a&&(this._regionQuery=a),this._domRegions=[],this._regionQuery&&("string"==typeof this._regionQuery||this._regionQuery instanceof String?this._domRegions=document.querySelectorAll(this._regionQuery):this._domRegions=this._regionQuery),"editing"===this._state&&(this._initRegions(b),this._preventEmptyRegions()),this._ignition)return this._domRegions.length?this._ignition.show():this._ignition.hide()},c.prototype._addDOMEventListeners=function(){return this._handleHighlightOn=function(a){return function(c){var d;if(17!==(d=c.keyCode)&&224!==d&&91!==d&&93!==d||(a._ctrlDown=!0),16===c.keyCode&&!a._ctrlDown){if(a._highlightTimeout)return;return a._shiftDown=!0,void(a._highlightTimeout=setTimeout(function(){return a.highlightRegions(!0)},b.HIGHLIGHT_HOLD_DURATION))}return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),this._handleHighlightOff=function(a){return function(b){var c;return 17===(c=b.keyCode)||224===c||91===c||93===c?void(a._ctrlDown=!1):16===b.keyCode?(a._shiftDown=!1,a._highlightTimeout&&(clearTimeout(a._highlightTimeout),a._highlightTimeout=null),a.highlightRegions(!1)):void 0}}(this),this._handleVisibility=function(a){return function(b){if(!document.hasFocus())return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),document.addEventListener("keydown",this._handleHighlightOn),document.addEventListener("keyup",this._handleHighlightOff),document.addEventListener("visibilitychange",this._handleVisibility),this._handleBeforeUnload=function(a){return function(c){var d;if("editing"===a._state&&b.CANCEL_MESSAGE)return d=ContentEdit._(b.CANCEL_MESSAGE),(c||window.event).returnValue=d,d}}(this),window.addEventListener("beforeunload",this._handleBeforeUnload),this._handleUnload=function(a){return function(b){return a.destroy()}}(this),
window.addEventListener("unload",this._handleUnload)},c.prototype._allowEmptyRegions=function(a){return this._emptyRegionsAllowed=!0,a(),this._emptyRegionsAllowed=!1},c.prototype._preventEmptyRegions=function(){var a,b,c,d,e,f,g,h,i,j,k;if(!this._emptyRegionsAllowed){i=this._regions,k=[];for(d in i){for(f=i[d],c=f.lastModified(),b=!1,j=f.children,g=0,h=j.length;g<h;g++)if(a=j[g],"Static"!==a.type()){b=!0;break}b||(e=this.createPlaceholderElement(f),f.attach(e),k.push(f._modified=c))}return k}},c.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keydown",this._handleHighlightOn),document.removeEventListener("keyup",this._handleHighlightOff),window.removeEventListener("beforeunload",this._handleBeforeUnload),window.removeEventListener("unload",this._handleUnload)},c.prototype._initRegions=function(a){var b,c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=!1),d={},c=[],this._orderedRegions=[],j=this._domRegions,e=h=0,i=j.length;h<i;e=++h)b=j[e],g=b.getAttribute(this._namingProp),g||(g=e),d[g]=!0,this._orderedRegions.push(g),this._regions[g]&&this._regions[g].domElement()===b||(this._fixtureTest(b)?this._regions[g]=new ContentEdit.Fixture(b):this._regions[g]=new ContentEdit.Region(b),c.push(this._regions[g].domElement()),a||(this._regionsLastModified[g]=this._regions[g].lastModified()));this._domRegions=c,k=this._regions,l=[];for(g in k)k[g],d[g]||(delete this._regions[g],delete this._regionsLastModified[g],f=this._orderedRegions.indexOf(g),f>-1?l.push(this._orderedRegions.splice(f,1)):l.push(void 0));return l},c}(b.ComponentUI),b.EditorApp=function(){function a(){}var c;return c=null,a.get=function(){var a;return a=b.EditorApp.getCls(),null!=c?c:c=new a},a.getCls=function(){return e},a}(),b.History=function(){function a(a){this._lastSnapshotTaken=null,this._regions={},this.replaceRegions(a),this._snapshotIndex=-1,this._snapshots=[],this._store()}return a.prototype.canRedo=function(){return this._snapshotIndex<this._snapshots.length-1},a.prototype.canUndo=function(){return this._snapshotIndex>0},a.prototype.index=function(){return this._snapshotIndex},a.prototype.length=function(){return this._snapshots.length},a.prototype.snapshot=function(){return this._snapshots[this._snapshotIndex]},a.prototype.goTo=function(a){return this._snapshotIndex=Math.min(this._snapshots.length-1,Math.max(0,a)),this.snapshot()},a.prototype.redo=function(){return this.goTo(this._snapshotIndex+1)},a.prototype.replaceRegions=function(a){var b,c,d;this._regions={},d=[];for(b in a)c=a[b],d.push(this._regions[b]=c);return d},a.prototype.restoreSelection=function(a){var b,c;if(a.selected)return c=this._regions[a.selected.region],b=c.descendants()[a.selected.element],b.focus(),b.selection&&a.selected.selection?b.selection(a.selected.selection):void 0},a.prototype.stopWatching=function(){if(this._watchInterval&&clearInterval(this._watchInterval),this._delayedStoreTimeout)return clearTimeout(this._delayedStoreTimeout)},a.prototype.undo=function(){return this.goTo(this._snapshotIndex-1)},a.prototype.watch=function(){var a;return this._lastSnapshotTaken=Date.now(),a=function(a){return function(){var b,c;if(null!==(c=ContentEdit.Root.get().lastModified())&&c>a._lastSnapshotTaken){if(a._delayedStoreRequested===c)return;return a._delayedStoreTimeout&&clearTimeout(a._delayedStoreTimeout),b=function(){return a._lastSnapshotTaken=c,a._store()},a._delayedStoreRequested=c,a._delayedStoreTimeout=setTimeout(b,500)}}}(this),this._watchInterval=setInterval(a,50)},a.prototype._store=function(){var a,b,c,d,e,f,g;e={regions:{},regionModifieds:{},rootModified:ContentEdit.Root.get().lastModified(),selected:null},f=this._regions;for(b in f)d=f[b],e.regions[b]=d.html(),e.regionModifieds[b]=d.lastModified();if(a=ContentEdit.Root.get().focused()){if(e.selected={},!(d=a.closest(function(a){return"Region"===a.type()||"Fixture"===a.type()})))return;g=this._regions;for(b in g)if(c=g[b],d===c){e.selected.region=b;break}e.selected.element=d.descendants().indexOf(a),a.selection&&(e.selected.selection=a.selection())}return this._snapshotIndex<this._snapshots.length-1&&(this._snapshots=this._snapshots.slice(0,this._snapshotIndex+1)),this._snapshotIndex++,this._snapshots.splice(this._snapshotIndex,0,e)},a}(),b.StylePalette=function(){function a(){}return a._styles=[],a.add=function(a){return this._styles=this._styles.concat(a)},a.styles=function(a){var b;return void 0===a?this._styles.slice():(b=a.tagName(),this._styles.filter(function(a){return!a._applicableTo||-1!==a._applicableTo.indexOf(b)}))},a}(),b.Style=function(){function a(a,b,c){this._name=a,this._cssClass=b,this._applicableTo=c||null}return a.prototype.applicableTo=function(){return this._applicableTo},a.prototype.cssClass=function(){return this._cssClass},a.prototype.name=function(){return this._name},a}(),b.ToolShelf=function(){function a(){}return a._tools={},a.stow=function(a,b){return this._tools[b]=a},a.fetch=function(a){if(!this._tools[a])throw new Error("`"+a+"` has not been stowed on the tool shelf");return this._tools[a]},a}(),b.Tool=function(){function a(){}return a.label="Tool",a.icon="tool",a.requiresElement=!0,a.canApply=function(a,b){return!1},a.isApplied=function(a,b){return!1},a.apply=function(a,b,c){throw new Error("Not implemented")},a.editor=function(){return b.EditorApp.get()},a.dispatchEditorEvent=function(a,b){return this.editor().dispatchEvent(this.editor().createEvent(a,b))},a._insertAt=function(a){var b,c;return c=a,"Region"!==c.parent().type()&&(c=a.closest(function(a){return"Region"===a.parent().type()})),b=c.parent().children.indexOf(c)+1,[c,b]},a}(),b.Tools.Bold=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"bold"),c.label="Bold",c.icon="bold",c.tagName="b",c.canApply=function(a,b){return!a.isGallery()&&(!!a.content&&(b&&!b.isCollapsed()))},c.isApplied=function(a,b){var c,d,e;return!(void 0===a.content||!a.content.length())&&(e=b.get(),c=e[0],d=e[1],c===d&&(d+=1),a.content.slice(c,d).hasTags(this.tagName,!0))},c.apply=function(a,b,c){var d,e,f,g;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return a.storeState(),g=b.get(),d=g[0],e=g[1],this.isApplied(a,b)?a.content=a.content.unformat(d,e,new HTMLString.Tag(this.tagName)):a.content=a.content.format(d,e,new HTMLString.Tag(this.tagName)),a.content.optimize(),a.updateInnerHTML(),a.taint(),a.restoreState(),c(!0),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Italic=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"italic"),c.label="Italic",c.icon="italic",c.tagName="i",c}(b.Tools.Bold),b.Tools.Underline=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"underline"),c.label="Underline",c.icon="underline",c.tagName="u",c}(b.Tools.Bold),b.Tools.Code=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"code"),c.label="Code",c.icon="preformatted",c.tagName="code",c}(b.Tools.Bold),b.Tools.Strike=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"strike"),c.label="Strikethrough",c.icon="strike",c.tagName="strike",c}(b.Tools.Bold),b.Tools.Link=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"link"),c.label="Link",c.icon="link",c.tagName="a",c.getAttr=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;if("Image"===b.type()){if(b.a)return b.a[a]}else{if(b.isFixed()&&"a"===b.tagName())return b.attr(a);for(m=c.get(),e=m[0],h=m[1],f=b.content.slice(e,h),n=f.characters,i=0,k=n.length;i<k;i++)if(d=n[i],d.hasTags("a"))for(o=d.tags(),j=0,l=o.length;j<l;j++)if(g=o[j],"a"===g.name())return g.attr(a)}return""},c.canApply=function(a,b){var c;return!a.isGallery()&&("Image"===a.type()||(!(!a.isFixed()||"a"!==a.tagName())||!!a.content&&(!!b&&!!(!b.isCollapsed()||(c=a.content.characters[b.get()[0]])&&c.hasTags("a")))))},c.isApplied=function(a,b){return"Image"===a.type()?a.a:!(!a.isFixed()||"a"!==a.tagName())||c.__super__.constructor.isApplied.call(this,a,b)},c.apply=function(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(t={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",t)){if(f=!1,"Image"===a.type())n=a.domElement().getBoundingClientRect();else if(a.isFixed()&&"a"===a.tagName())n=a.domElement().getBoundingClientRect();else{if(c.isCollapsed()){for(g=a.content.characters,r=c.get(0)[0],j=r;r>0&&g[r-1].hasTags("a");)r-=1;for(;j<g.length&&g[j].hasTags("a");)j+=1;c=new ContentSelect.Range(r,j),c.select(a.domElement())}a.storeState(),q=new HTMLString.Tag("span",{class:"ct--pseudo-select"}),u=c.get(),k=u[0],s=u[1],a.content=a.content.format(k,s,q),a.updateInnerHTML(),i=a.domElement(),l=i.getElementsByClassName("ct--pseudo-select"),n=l[0].getBoundingClientRect()}return e=b.EditorApp.get(),m=new b.ModalUI(!0,!0),m.addEventListener("click",function(){if(this.unmount(),h.hide(),a.content&&(a.content=a.content.unformat(k,s,q),a.updateInnerHTML(),a.restoreState()),d(f),f)return b.Tools.Link.dispatchEditorEvent("tool-applied",t)}),h=new b.LinkDialog(this.getAttr("href",a,c),this.getAttr("target",a,c)),v=b.getScrollPosition(),o=v[0],p=v[1],h.position([n.left+n.width/2+o,n.top+n.height/2+p]),h.addEventListener("save",function(b){var c,d,e,g,h,i,j,l,n;if(g=b.detail(),f=!0,"Image"===a.type()){if(d=["align-center","align-left","align-right"],g.href){for(a.a={href:g.href},a.a&&(a.a.class=a.a.class),g.target&&(a.a.target=g.target),i=0,l=d.length;i<l;i++)if(e=d[i],a.hasCSSClass(e)){a.removeCSSClass(e),a.a.class=e;break}}else{for(h=[],a.a.class&&(h=a.a.class.split(" ")),j=0,n=d.length;j<n;j++)if(e=d[j],h.indexOf(e)>-1){a.addCSSClass(e);break}a.a=null}a.unmount(),a.mount()}else a.isFixed()&&"a"===a.tagName()?a.attr("href",g.href):(a.content=a.content.unformat(k,s,"a"),g.href&&(c=new HTMLString.Tag("a",g),a.content=a.content.format(k,s,c),a.content.optimize()),a.updateInnerHTML());return a.taint(),m.dispatchEvent(m.createEvent("click"))}),e.attach(m),e.attach(h),m.show(),h.show()}},c}(b.Tools.Bold),b.Tools.Heading=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading"),c.label="Heading",c.icon="heading",c.tagName="h1",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&(void 0!==a.content&&-1!==["Text","PreText"].indexOf(a.type())))},c.isApplied=function(a,b){return!!a.content&&(-1!==["Text","PreText"].indexOf(a.type())&&a.tagName()===this.tagName)},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return a.storeState(),"PreText"===a.type()?(d=a.content.html().replace(/&nbsp;/g," "),g=new ContentEdit.Text(this.tagName,{},d),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(b)):(a.removeAttr("class"),a.tagName()===this.tagName?a.tagName("p"):a.tagName(this.tagName),a.restoreState()),this.dispatchEditorEvent("tool-applied",h),c(!0)},c}(b.Tool),b.Tools.Heading2=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading2"),c.icon=c.icon+"2",c.tagName="h2",c}(b.Tools.Heading),b.Tools.Heading3=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading3"),c.icon=c.icon+"3",c.tagName="h3",c}(b.Tools.Heading),b.Tools.Heading4=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading4"),c.icon=c.icon+"4",c.tagName="h4",c}(b.Tools.Heading),b.Tools.Heading5=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading5"),c.icon=c.icon+"5",c.tagName="h5",c}(b.Tools.Heading),b.Tools.Heading6=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading6"),c.icon=c.icon+"6",c.tagName="h6",c}(b.Tools.Heading),b.Tools.Paragraph=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"paragraph"),c.label="Paragraph",c.icon="paragraph",c.tagName="p",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&void 0!==a)},c.apply=function(a,d,e){var f,g,h,i;return f=this.editor().ctrlDown(),b.Tools.Heading.canApply(a)&&!f?c.__super__.constructor.apply.call(this,a,d,e):(i={tool:this,element:a,selection:d},this.dispatchEditorEvent("tool-apply",i)?("Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),h=a.parent(),g=new ContentEdit.Text("p"),h.attach(g,h.children.indexOf(a)+1),g.focus(),e(!0),this.dispatchEditorEvent("tool-applied",i)):void 0)},c}(b.Tools.Heading),b.Tools.Preformatted=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"preformatted"),c.label="Preformatted",c.icon="preformatted",c.tagName="pre",c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return"PreText"===a.type()?void b.Tools.Paragraph.apply(a,c,d):(h=a.content.text(),g=new ContentEdit.PreText("pre",{},HTMLString.String.encode(h)),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(c),d(!0),this.dispatchEditorEvent("tool-applied",i))},c}(b.Tools.Heading),b.Tools.AlignLeft=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-left"),c.label="Align left",c.icon="align-left",c.className="text-left",c.canApply=function(a,b){return!a.isGallery()&&("Image"===a.type()||void 0!==a.content)},c.isApplied=function(a,b){var c;return!!this.canApply(a)&&("ListItemText"!==(c=a.type())&&"TableCellText"!==c||(a=a.parent()),a.hasCSSClass(this.className))},c.apply=function(a,c,d){var e,f,g,h,i,j;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g)){for("ListItemText"!==(j=a.type())&&"TableCellText"!==j||(a=a.parent()),e=[b.Tools.AlignLeft.className,b.Tools.AlignCenter.className,b.Tools.AlignRight.className],h=0,i=e.length;h<i;h++)if(f=e[h],a.hasCSSClass(f)&&(a.removeCSSClass(f),f===this.className))return d(!0);return a.addCSSClass(this.className),d(!0),this.dispatchEditorEvent("tool-applied",g)}},c}(b.Tool),b.Tools.AlignCenter=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-center"),c.label="Align center",c.icon="align-center",c.className="text-center",c}(b.Tools.AlignLeft),b.Tools.AlignRight=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-right"),c.label="Align right",c.icon="align-right",c.className="text-right",c}(b.Tools.AlignLeft),b.Tools.UnorderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unordered-list"),c.label="Bullet list",c.icon="unordered-list",c.listTag="ul",c.canApply=function(a,b){var c;return!a.isGallery()&&(!a.isFixed()&&(void 0!==a.content&&("Region"===(c=a.parent().type())||"ListItem"===c)))},c.apply=function(a,b,c){var d,e,f,g,h,i;if(i={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",i))return"ListItem"===a.parent().type()?(a.storeState(),e=a.closest(function(a){return"List"===a.type()}),e.tagName(this.listTag),a.restoreState()):(g=new ContentEdit.ListItemText(a.content.copy()),f=new ContentEdit.ListItem,f.attach(g),e=new ContentEdit.List(this.listTag,{}),e.attach(f),h=a.parent(),d=h.children.indexOf(a),h.detach(a),h.attach(e,d),g.focus(),g.selection(b)),c(!0),this.dispatchEditorEvent("tool-applied",i)},c}(b.Tool),b.Tools.OrderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"ordered-list"),c.label="Numbers list",c.icon="ordered-list",c.listTag="ol",c}(b.Tools.UnorderedList),b.Tools.Table=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"table"),c.label="Table",c.icon="table",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&void 0!==a)},c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,h=a.closest(function(a){return a&&"Table"===a.type()}),f=new b.TableDialog(h),f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,j,k,l,m;return l=c.detail(),j=!0,h?(b._updateTable(l,h),j=a.closest(function(a){return a&&"Table"===a.type()})):(h=b._createTable(l),m=b._insertAt(a),k=m[0],e=m[1],k.parent().attach(h,e),j=!1),j?a.restoreState():h.firstSection().children[0].children[0].children[0].focus(),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",i)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c._adjustColumns=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;for(l=a.children,m=[],j=0,k=l.length;j<k;j++)i=l[j],d=i.children[0].tagName(),f=i.children.length,g=b-f,g<0?m.push(function(){var a,b;for(b=[],h=a=g;g<=0?a<0:a>0;h=g<=0?++a:--a)c=i.children[i.children.length-1],b.push(i.detach(c));return b}()):g>0?m.push(function(){var a,b;for(b=[],h=a=0;0<=g?a<g:a>g;h=0<=g?++a:--a)c=new ContentEdit.TableCell(d),i.attach(c),e=new ContentEdit.TableCellText(""),b.push(c.attach(e));return b}()):m.push(void 0);return m},c._createTable=function(a){var b,c,d,e;return e=new ContentEdit.Table,a.head&&(d=this._createTableSection("thead","th",a.columns),e.attach(d)),b=this._createTableSection("tbody","td",a.columns),e.attach(b),a.foot&&(c=this._createTableSection("tfoot","td",a.columns),e.attach(c)),e},c._createTableSection=function(a,b,c){var d,e,f,g,h;for(g=new ContentEdit.TableSection(a),f=new ContentEdit.TableRow,g.attach(f),h=0;0<=c?h<c:h>c;0<=c?++h:--h)d=new ContentEdit.TableCell(b),f.attach(d),e=new ContentEdit.TableCellText(""),d.attach(e);return g},c._updateTable=function(a,b){var c,d,e,f,g,h,i;if(!a.head&&b.thead()&&b.detach(b.thead()),!a.foot&&b.tfoot()&&b.detach(b.tfoot()),c=b.firstSection().children[0].children.length,a.columns!==c)for(i=b.children,g=0,h=i.length;g<h;g++)f=i[g],this._adjustColumns(f,a.columns);if(a.head&&!b.thead()&&(e=this._createTableSection("thead","th",a.columns),b.attach(e,0)),a.foot&&!b.tfoot())return d=this._createTableSection("tfoot","td",a.columns),b.attach(d)},c}(b.Tool),b.Tools.Indent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"indent"),c.label="Indent",c.icon="indent",c.canApply=function(a,b){return!a.isGallery()&&("ListItem"===a.parent().type()&&a.parent().parent().children.indexOf(a.parent())>0)},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().indent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.Unindent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unindent"),c.label="Unindent",c.icon="unindent",c.canApply=function(a,b){return!a.isGallery()&&"ListItem"===a.parent().type()},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().unindent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.LineBreak=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"line-break"),c.label="Line break",c.icon="line-break",c.canApply=function(a,b){return!a.isGallery()&&a.content},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return e=b.get()[0]+1,g=a.content.substring(0,b.get()[0]),f=a.content.substring(b.get()[1]),d=f&&f.characters&&f.characters.length?new HTMLString.String("<br>",a.content.preserveWhitespace()):new HTMLString.String("<br><br>",a.content.preserveWhitespace()),a.content=g.concat(d,f),a.updateInnerHTML(),a.taint(),b.set(e,e),a.selection(b),c(!0),this.dispatchEditorEvent("tool-applied",h)},c}(b.Tool),b.Tools.Image=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"image"),c.label="Image",c.icon="image",c.canApply=function(a,b){return!a.isFixed()||"ImageFixture"===a.type()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.ImageDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,i,j,k,l,m,n,o;return e=c.detail(),l=e.imageURL,k=e.imageSize,j=e.imageAttrs,j||(j={}),j.height=k[1],j.src=l,j.width=k[0],"ImageFixture"===a.type()?a.src(l):(i=new ContentEdit.Image(j),o=b._insertAt(a),n=o[0],m=o[1],n.parent().attach(i,m),i.focus()),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Video=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"video"),c.label="Video",c.icon="video",c.canApply=function(a,b){return!a.isGallery()&&!a.isFixed()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.VideoDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(c){return function(e){var i,j,k,l,m,n;if(l=e.detail().url,l?(m=new ContentEdit.Video("iframe",{frameborder:0,height:b.DEFAULT_VIDEO_HEIGHT,src:l,width:b.DEFAULT_VIDEO_WIDTH,'allowfullscreen':'allowfullscreen'}),n=c._insertAt(a),k=n[0],j=n[1],k.parent().attach(m,j),m.focus()):a.restoreState&&a.restoreState(),g.hide(),f.hide(),i=""!==l,d(i),i)return c.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Undo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"undo"),c.label="Undo",c.icon="undo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canUndo()},c.apply=function(a,b,c){var d,e,f;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return d=this.editor(),d.history.stopWatching(),e=d.history.undo(),d.revertToSnapshot(e),d.history.watch(),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Redo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"redo"),c.label="Redo",c.icon="redo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canRedo()},c.apply=function(a,c,d){var e,f,g;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g))return e=b.EditorApp.get(),e.history.stopWatching(),f=e.history.redo(),e.revertToSnapshot(f),e.history.watch(),this.dispatchEditorEvent("tool-applied",g)},c}(b.Tool),b.Tools.Remove=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"remove"),c.label="Remove",c.icon="remove",c.canApply=function(a,b){return!a.isFixed()},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h)){if(d=this.editor(),a.blur(),a.nextContent()?a.nextContent().focus():a.previousContent()&&a.previousContent().focus(),!a.isMounted())return c(!0),void this.dispatchEditorEvent("tool-applied",h);switch(a.type()){case"ListItemText":d.ctrlDown()?(e=a.closest(function(a){return"Region"===a.parent().type()}),e.parent().detach(e)):a.parent().parent().detach(a.parent());break;case"TableCellText":d.ctrlDown()?(g=a.closest(function(a){return"Table"===a.type()}),g.parent().detach(g)):(f=a.parent().parent(),f.parent().detach(f));break;default:a.parent().detach(a)}return c(!0),this.dispatchEditorEvent("tool-applied",h)}},c}(b.Tool)}.call(this);
/*!
  * Bootstrap v4.6.2 (https://getbootstrap.com/)
  * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery")):"function"==typeof define&&define.amd?define(["exports","jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap={},t.jQuery)}(this,(function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(e);function o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function r(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function a(){return a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},a.apply(this,arguments)}function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}var l="transitionend";var u={TRANSITION_END:"bsTransitionEnd",getUID:function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},getSelectorFromElement:function(t){var e=t.getAttribute("data-target");if(!e||"#"===e){var n=t.getAttribute("href");e=n&&"#"!==n?n.trim():""}try{return document.querySelector(e)?e:null}catch(t){return null}},getTransitionDurationFromElement:function(t){if(!t)return 0;var e=i.default(t).css("transition-duration"),n=i.default(t).css("transition-delay"),o=parseFloat(e),r=parseFloat(n);return o||r?(e=e.split(",")[0],n=n.split(",")[0],1e3*(parseFloat(e)+parseFloat(n))):0},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(t){i.default(t).trigger(l)},supportsTransitionEnd:function(){return Boolean(l)},isElement:function(t){return(t[0]||t).nodeType},typeCheckConfig:function(t,e,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i],r=e[i],a=r&&u.isElement(r)?"element":null===(s=r)||"undefined"==typeof s?""+s:{}.toString.call(s).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(o).test(a))throw new Error(t.toUpperCase()+': Option "'+i+'" provided type "'+a+'" but expected type "'+o+'".')}var s},findShadowRoot:function(t){if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){var e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?u.findShadowRoot(t.parentNode):null},jQueryDetection:function(){if("undefined"==typeof i.default)throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.");var t=i.default.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1===t[0]&&9===t[1]&&t[2]<1||t[0]>=4)throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}};u.jQueryDetection(),i.default.fn.emulateTransitionEnd=function(t){var e=this,n=!1;return i.default(this).one(u.TRANSITION_END,(function(){n=!0})),setTimeout((function(){n||u.triggerTransitionEnd(e)}),t),this},i.default.event.special[u.TRANSITION_END]={bindType:l,delegateType:l,handle:function(t){if(i.default(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}};var f="bs.alert",d=i.default.fn.alert,c=function(){function t(t){this._element=t}var e=t.prototype;return e.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},e.dispose=function(){i.default.removeData(this._element,f),this._element=null},e._getRootElement=function(t){var e=u.getSelectorFromElement(t),n=!1;return e&&(n=document.querySelector(e)),n||(n=i.default(t).closest(".alert")[0]),n},e._triggerCloseEvent=function(t){var e=i.default.Event("close.bs.alert");return i.default(t).trigger(e),e},e._removeElement=function(t){var e=this;if(i.default(t).removeClass("show"),i.default(t).hasClass("fade")){var n=u.getTransitionDurationFromElement(t);i.default(t).one(u.TRANSITION_END,(function(n){return e._destroyElement(t,n)})).emulateTransitionEnd(n)}else this._destroyElement(t)},e._destroyElement=function(t){i.default(t).detach().trigger("closed.bs.alert").remove()},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data(f);o||(o=new t(this),n.data(f,o)),"close"===e&&o[e](this)}))},t._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}}]),t}();i.default(document).on("click.bs.alert.data-api",'[data-dismiss="alert"]',c._handleDismiss(new c)),i.default.fn.alert=c._jQueryInterface,i.default.fn.alert.Constructor=c,i.default.fn.alert.noConflict=function(){return i.default.fn.alert=d,c._jQueryInterface};var h="bs.button",p=i.default.fn.button,m="active",g='[data-toggle^="button"]',_='input:not([type="hidden"])',v=".btn",b=function(){function t(t){this._element=t,this.shouldAvoidTriggerChange=!1}var e=t.prototype;return e.toggle=function(){var t=!0,e=!0,n=i.default(this._element).closest('[data-toggle="buttons"]')[0];if(n){var o=this._element.querySelector(_);if(o){if("radio"===o.type)if(o.checked&&this._element.classList.contains(m))t=!1;else{var r=n.querySelector(".active");r&&i.default(r).removeClass(m)}t&&("checkbox"!==o.type&&"radio"!==o.type||(o.checked=!this._element.classList.contains(m)),this.shouldAvoidTriggerChange||i.default(o).trigger("change")),o.focus(),e=!1}}this._element.hasAttribute("disabled")||this._element.classList.contains("disabled")||(e&&this._element.setAttribute("aria-pressed",!this._element.classList.contains(m)),t&&i.default(this._element).toggleClass(m))},e.dispose=function(){i.default.removeData(this._element,h),this._element=null},t._jQueryInterface=function(e,n){return this.each((function(){var o=i.default(this),r=o.data(h);r||(r=new t(this),o.data(h,r)),r.shouldAvoidTriggerChange=n,"toggle"===e&&r[e]()}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}}]),t}();i.default(document).on("click.bs.button.data-api",g,(function(t){var e=t.target,n=e;if(i.default(e).hasClass("btn")||(e=i.default(e).closest(v)[0]),!e||e.hasAttribute("disabled")||e.classList.contains("disabled"))t.preventDefault();else{var o=e.querySelector(_);if(o&&(o.hasAttribute("disabled")||o.classList.contains("disabled")))return void t.preventDefault();"INPUT"!==n.tagName&&"LABEL"===e.tagName||b._jQueryInterface.call(i.default(e),"toggle","INPUT"===n.tagName)}})).on("focus.bs.button.data-api blur.bs.button.data-api",g,(function(t){var e=i.default(t.target).closest(v)[0];i.default(e).toggleClass("focus",/^focus(in)?$/.test(t.type))})),i.default(window).on("load.bs.button.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-toggle="buttons"] .btn')),e=0,n=t.length;e<n;e++){var i=t[e],o=i.querySelector(_);o.checked||o.hasAttribute("checked")?i.classList.add(m):i.classList.remove(m)}for(var r=0,a=(t=[].slice.call(document.querySelectorAll('[data-toggle="button"]'))).length;r<a;r++){var s=t[r];"true"===s.getAttribute("aria-pressed")?s.classList.add(m):s.classList.remove(m)}})),i.default.fn.button=b._jQueryInterface,i.default.fn.button.Constructor=b,i.default.fn.button.noConflict=function(){return i.default.fn.button=p,b._jQueryInterface};var y="carousel",E="bs.carousel",w=i.default.fn[y],T="active",C="next",S="prev",N="slid.bs.carousel",D=".active.carousel-item",A={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},k={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},I={TOUCH:"touch",PEN:"pen"},O=function(){function t(t,e){this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._element=t,this._indicatorsElement=this._element.querySelector(".carousel-indicators"),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent||window.MSPointerEvent),this._addEventListeners()}var e=t.prototype;return e.next=function(){this._isSliding||this._slide(C)},e.nextWhenVisible=function(){var t=i.default(this._element);!document.hidden&&t.is(":visible")&&"hidden"!==t.css("visibility")&&this.next()},e.prev=function(){this._isSliding||this._slide(S)},e.pause=function(t){t||(this._isPaused=!0),this._element.querySelector(".carousel-item-next, .carousel-item-prev")&&(u.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},e.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},e.to=function(t){var e=this;this._activeElement=this._element.querySelector(D);var n=this._getItemIndex(this._activeElement);if(!(t>this._items.length-1||t<0))if(this._isSliding)i.default(this._element).one(N,(function(){return e.to(t)}));else{if(n===t)return this.pause(),void this.cycle();var o=t>n?C:S;this._slide(o,this._items[t])}},e.dispose=function(){i.default(this._element).off(".bs.carousel"),i.default.removeData(this._element,E),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},e._getConfig=function(t){return t=a({},A,t),u.typeCheckConfig(y,t,k),t},e._handleSwipe=function(){var t=Math.abs(this.touchDeltaX);if(!(t<=40)){var e=t/this.touchDeltaX;this.touchDeltaX=0,e>0&&this.prev(),e<0&&this.next()}},e._addEventListeners=function(){var t=this;this._config.keyboard&&i.default(this._element).on("keydown.bs.carousel",(function(e){return t._keydown(e)})),"hover"===this._config.pause&&i.default(this._element).on("mouseenter.bs.carousel",(function(e){return t.pause(e)})).on("mouseleave.bs.carousel",(function(e){return t.cycle(e)})),this._config.touch&&this._addTouchEventListeners()},e._addTouchEventListeners=function(){var t=this;if(this._touchSupported){var e=function(e){t._pointerEvent&&I[e.originalEvent.pointerType.toUpperCase()]?t.touchStartX=e.originalEvent.clientX:t._pointerEvent||(t.touchStartX=e.originalEvent.touches[0].clientX)},n=function(e){t._pointerEvent&&I[e.originalEvent.pointerType.toUpperCase()]&&(t.touchDeltaX=e.originalEvent.clientX-t.touchStartX),t._handleSwipe(),"hover"===t._config.pause&&(t.pause(),t.touchTimeout&&clearTimeout(t.touchTimeout),t.touchTimeout=setTimeout((function(e){return t.cycle(e)}),500+t._config.interval))};i.default(this._element.querySelectorAll(".carousel-item img")).on("dragstart.bs.carousel",(function(t){return t.preventDefault()})),this._pointerEvent?(i.default(this._element).on("pointerdown.bs.carousel",(function(t){return e(t)})),i.default(this._element).on("pointerup.bs.carousel",(function(t){return n(t)})),this._element.classList.add("pointer-event")):(i.default(this._element).on("touchstart.bs.carousel",(function(t){return e(t)})),i.default(this._element).on("touchmove.bs.carousel",(function(e){return function(e){t.touchDeltaX=e.originalEvent.touches&&e.originalEvent.touches.length>1?0:e.originalEvent.touches[0].clientX-t.touchStartX}(e)})),i.default(this._element).on("touchend.bs.carousel",(function(t){return n(t)})))}},e._keydown=function(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.which){case 37:t.preventDefault(),this.prev();break;case 39:t.preventDefault(),this.next()}},e._getItemIndex=function(t){return this._items=t&&t.parentNode?[].slice.call(t.parentNode.querySelectorAll(".carousel-item")):[],this._items.indexOf(t)},e._getItemByDirection=function(t,e){var n=t===C,i=t===S,o=this._getItemIndex(e),r=this._items.length-1;if((i&&0===o||n&&o===r)&&!this._config.wrap)return e;var a=(o+(t===S?-1:1))%this._items.length;return-1===a?this._items[this._items.length-1]:this._items[a]},e._triggerSlideEvent=function(t,e){var n=this._getItemIndex(t),o=this._getItemIndex(this._element.querySelector(D)),r=i.default.Event("slide.bs.carousel",{relatedTarget:t,direction:e,from:o,to:n});return i.default(this._element).trigger(r),r},e._setActiveIndicatorElement=function(t){if(this._indicatorsElement){var e=[].slice.call(this._indicatorsElement.querySelectorAll(".active"));i.default(e).removeClass(T);var n=this._indicatorsElement.children[this._getItemIndex(t)];n&&i.default(n).addClass(T)}},e._updateInterval=function(){var t=this._activeElement||this._element.querySelector(D);if(t){var e=parseInt(t.getAttribute("data-interval"),10);e?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=e):this._config.interval=this._config.defaultInterval||this._config.interval}},e._slide=function(t,e){var n,o,r,a=this,s=this._element.querySelector(D),l=this._getItemIndex(s),f=e||s&&this._getItemByDirection(t,s),d=this._getItemIndex(f),c=Boolean(this._interval);if(t===C?(n="carousel-item-left",o="carousel-item-next",r="left"):(n="carousel-item-right",o="carousel-item-prev",r="right"),f&&i.default(f).hasClass(T))this._isSliding=!1;else if(!this._triggerSlideEvent(f,r).isDefaultPrevented()&&s&&f){this._isSliding=!0,c&&this.pause(),this._setActiveIndicatorElement(f),this._activeElement=f;var h=i.default.Event(N,{relatedTarget:f,direction:r,from:l,to:d});if(i.default(this._element).hasClass("slide")){i.default(f).addClass(o),u.reflow(f),i.default(s).addClass(n),i.default(f).addClass(n);var p=u.getTransitionDurationFromElement(s);i.default(s).one(u.TRANSITION_END,(function(){i.default(f).removeClass(n+" "+o).addClass(T),i.default(s).removeClass("active "+o+" "+n),a._isSliding=!1,setTimeout((function(){return i.default(a._element).trigger(h)}),0)})).emulateTransitionEnd(p)}else i.default(s).removeClass(T),i.default(f).addClass(T),this._isSliding=!1,i.default(this._element).trigger(h);c&&this.cycle()}},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this).data(E),o=a({},A,i.default(this).data());"object"==typeof e&&(o=a({},o,e));var r="string"==typeof e?e:o.slide;if(n||(n=new t(this,o),i.default(this).data(E,n)),"number"==typeof e)n.to(e);else if("string"==typeof r){if("undefined"==typeof n[r])throw new TypeError('No method named "'+r+'"');n[r]()}else o.interval&&o.ride&&(n.pause(),n.cycle())}))},t._dataApiClickHandler=function(e){var n=u.getSelectorFromElement(this);if(n){var o=i.default(n)[0];if(o&&i.default(o).hasClass("carousel")){var r=a({},i.default(o).data(),i.default(this).data()),s=this.getAttribute("data-slide-to");s&&(r.interval=!1),t._jQueryInterface.call(i.default(o),r),s&&i.default(o).data(E).to(s),e.preventDefault()}}},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}},{key:"Default",get:function(){return A}}]),t}();i.default(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",O._dataApiClickHandler),i.default(window).on("load.bs.carousel.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-ride="carousel"]')),e=0,n=t.length;e<n;e++){var o=i.default(t[e]);O._jQueryInterface.call(o,o.data())}})),i.default.fn[y]=O._jQueryInterface,i.default.fn[y].Constructor=O,i.default.fn[y].noConflict=function(){return i.default.fn[y]=w,O._jQueryInterface};var x="collapse",j="bs.collapse",L=i.default.fn[x],P="show",F="collapse",R="collapsing",B="collapsed",H="width",M='[data-toggle="collapse"]',q={toggle:!0,parent:""},Q={toggle:"boolean",parent:"(string|element)"},W=function(){function t(t,e){this._isTransitioning=!1,this._element=t,this._config=this._getConfig(e),this._triggerArray=[].slice.call(document.querySelectorAll('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'));for(var n=[].slice.call(document.querySelectorAll(M)),i=0,o=n.length;i<o;i++){var r=n[i],a=u.getSelectorFromElement(r),s=[].slice.call(document.querySelectorAll(a)).filter((function(e){return e===t}));null!==a&&s.length>0&&(this._selector=a,this._triggerArray.push(r))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var e=t.prototype;return e.toggle=function(){i.default(this._element).hasClass(P)?this.hide():this.show()},e.show=function(){var e,n,o=this;if(!(this._isTransitioning||i.default(this._element).hasClass(P)||(this._parent&&0===(e=[].slice.call(this._parent.querySelectorAll(".show, .collapsing")).filter((function(t){return"string"==typeof o._config.parent?t.getAttribute("data-parent")===o._config.parent:t.classList.contains(F)}))).length&&(e=null),e&&(n=i.default(e).not(this._selector).data(j))&&n._isTransitioning))){var r=i.default.Event("show.bs.collapse");if(i.default(this._element).trigger(r),!r.isDefaultPrevented()){e&&(t._jQueryInterface.call(i.default(e).not(this._selector),"hide"),n||i.default(e).data(j,null));var a=this._getDimension();i.default(this._element).removeClass(F).addClass(R),this._element.style[a]=0,this._triggerArray.length&&i.default(this._triggerArray).removeClass(B).attr("aria-expanded",!0),this.setTransitioning(!0);var s="scroll"+(a[0].toUpperCase()+a.slice(1)),l=u.getTransitionDurationFromElement(this._element);i.default(this._element).one(u.TRANSITION_END,(function(){i.default(o._element).removeClass(R).addClass("collapse show"),o._element.style[a]="",o.setTransitioning(!1),i.default(o._element).trigger("shown.bs.collapse")})).emulateTransitionEnd(l),this._element.style[a]=this._element[s]+"px"}}},e.hide=function(){var t=this;if(!this._isTransitioning&&i.default(this._element).hasClass(P)){var e=i.default.Event("hide.bs.collapse");if(i.default(this._element).trigger(e),!e.isDefaultPrevented()){var n=this._getDimension();this._element.style[n]=this._element.getBoundingClientRect()[n]+"px",u.reflow(this._element),i.default(this._element).addClass(R).removeClass("collapse show");var o=this._triggerArray.length;if(o>0)for(var r=0;r<o;r++){var a=this._triggerArray[r],s=u.getSelectorFromElement(a);null!==s&&(i.default([].slice.call(document.querySelectorAll(s))).hasClass(P)||i.default(a).addClass(B).attr("aria-expanded",!1))}this.setTransitioning(!0),this._element.style[n]="";var l=u.getTransitionDurationFromElement(this._element);i.default(this._element).one(u.TRANSITION_END,(function(){t.setTransitioning(!1),i.default(t._element).removeClass(R).addClass(F).trigger("hidden.bs.collapse")})).emulateTransitionEnd(l)}}},e.setTransitioning=function(t){this._isTransitioning=t},e.dispose=function(){i.default.removeData(this._element,j),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},e._getConfig=function(t){return(t=a({},q,t)).toggle=Boolean(t.toggle),u.typeCheckConfig(x,t,Q),t},e._getDimension=function(){return i.default(this._element).hasClass(H)?H:"height"},e._getParent=function(){var e,n=this;u.isElement(this._config.parent)?(e=this._config.parent,"undefined"!=typeof this._config.parent.jquery&&(e=this._config.parent[0])):e=document.querySelector(this._config.parent);var o='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]',r=[].slice.call(e.querySelectorAll(o));return i.default(r).each((function(e,i){n._addAriaAndCollapsedClass(t._getTargetFromElement(i),[i])})),e},e._addAriaAndCollapsedClass=function(t,e){var n=i.default(t).hasClass(P);e.length&&i.default(e).toggleClass(B,!n).attr("aria-expanded",n)},t._getTargetFromElement=function(t){var e=u.getSelectorFromElement(t);return e?document.querySelector(e):null},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data(j),r=a({},q,n.data(),"object"==typeof e&&e?e:{});if(!o&&r.toggle&&"string"==typeof e&&/show|hide/.test(e)&&(r.toggle=!1),o||(o=new t(this,r),n.data(j,o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e]()}}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}},{key:"Default",get:function(){return q}}]),t}();i.default(document).on("click.bs.collapse.data-api",M,(function(t){"A"===t.currentTarget.tagName&&t.preventDefault();var e=i.default(this),n=u.getSelectorFromElement(this),o=[].slice.call(document.querySelectorAll(n));i.default(o).each((function(){var t=i.default(this),n=t.data(j)?"toggle":e.data();W._jQueryInterface.call(t,n)}))})),i.default.fn[x]=W._jQueryInterface,i.default.fn[x].Constructor=W,i.default.fn[x].noConflict=function(){return i.default.fn[x]=L,W._jQueryInterface};var U="undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof navigator,V=function(){for(var t=["Edge","Trident","Firefox"],e=0;e<t.length;e+=1)if(U&&navigator.userAgent.indexOf(t[e])>=0)return 1;return 0}(),Y=U&&window.Promise?function(t){var e=!1;return function(){e||(e=!0,window.Promise.resolve().then((function(){e=!1,t()})))}}:function(t){var e=!1;return function(){e||(e=!0,setTimeout((function(){e=!1,t()}),V))}};function z(t){return t&&"[object Function]"==={}.toString.call(t)}function K(t,e){if(1!==t.nodeType)return[];var n=t.ownerDocument.defaultView.getComputedStyle(t,null);return e?n[e]:n}function X(t){return"HTML"===t.nodeName?t:t.parentNode||t.host}function G(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=K(t),n=e.overflow,i=e.overflowX,o=e.overflowY;return/(auto|scroll|overlay)/.test(n+o+i)?t:G(X(t))}function $(t){return t&&t.referenceNode?t.referenceNode:t}var J=U&&!(!window.MSInputMethodContext||!document.documentMode),Z=U&&/MSIE 10/.test(navigator.userAgent);function tt(t){return 11===t?J:10===t?Z:J||Z}function et(t){if(!t)return document.documentElement;for(var e=tt(10)?document.body:null,n=t.offsetParent||null;n===e&&t.nextElementSibling;)n=(t=t.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&"BODY"!==i&&"HTML"!==i?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===K(n,"position")?et(n):n:t?t.ownerDocument.documentElement:document.documentElement}function nt(t){return null!==t.parentNode?nt(t.parentNode):t}function it(t,e){if(!(t&&t.nodeType&&e&&e.nodeType))return document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,i=n?t:e,o=n?e:t,r=document.createRange();r.setStart(i,0),r.setEnd(o,0);var a,s,l=r.commonAncestorContainer;if(t!==l&&e!==l||i.contains(o))return"BODY"===(s=(a=l).nodeName)||"HTML"!==s&&et(a.firstElementChild)!==a?et(l):l;var u=nt(t);return u.host?it(u.host,e):it(t,nt(e).host)}function ot(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",n="top"===e?"scrollTop":"scrollLeft",i=t.nodeName;if("BODY"===i||"HTML"===i){var o=t.ownerDocument.documentElement,r=t.ownerDocument.scrollingElement||o;return r[n]}return t[n]}function rt(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=ot(e,"top"),o=ot(e,"left"),r=n?-1:1;return t.top+=i*r,t.bottom+=i*r,t.left+=o*r,t.right+=o*r,t}function at(t,e){var n="x"===e?"Left":"Top",i="Left"===n?"Right":"Bottom";return parseFloat(t["border"+n+"Width"])+parseFloat(t["border"+i+"Width"])}function st(t,e,n,i){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],tt(10)?parseInt(n["offset"+t])+parseInt(i["margin"+("Height"===t?"Top":"Left")])+parseInt(i["margin"+("Height"===t?"Bottom":"Right")]):0)}function lt(t){var e=t.body,n=t.documentElement,i=tt(10)&&getComputedStyle(n);return{height:st("Height",e,n,i),width:st("Width",e,n,i)}}var ut=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},ft=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),dt=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},ct=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};function ht(t){return ct({},t,{right:t.left+t.width,bottom:t.top+t.height})}function pt(t){var e={};try{if(tt(10)){e=t.getBoundingClientRect();var n=ot(t,"top"),i=ot(t,"left");e.top+=n,e.left+=i,e.bottom+=n,e.right+=i}else e=t.getBoundingClientRect()}catch(t){}var o={left:e.left,top:e.top,width:e.right-e.left,height:e.bottom-e.top},r="HTML"===t.nodeName?lt(t.ownerDocument):{},a=r.width||t.clientWidth||o.width,s=r.height||t.clientHeight||o.height,l=t.offsetWidth-a,u=t.offsetHeight-s;if(l||u){var f=K(t);l-=at(f,"x"),u-=at(f,"y"),o.width-=l,o.height-=u}return ht(o)}function mt(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=tt(10),o="HTML"===e.nodeName,r=pt(t),a=pt(e),s=G(t),l=K(e),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var d=ht({top:r.top-a.top-u,left:r.left-a.left-f,width:r.width,height:r.height});if(d.marginTop=0,d.marginLeft=0,!i&&o){var c=parseFloat(l.marginTop),h=parseFloat(l.marginLeft);d.top-=u-c,d.bottom-=u-c,d.left-=f-h,d.right-=f-h,d.marginTop=c,d.marginLeft=h}return(i&&!n?e.contains(s):e===s&&"BODY"!==s.nodeName)&&(d=rt(d,e)),d}function gt(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.ownerDocument.documentElement,i=mt(t,n),o=Math.max(n.clientWidth,window.innerWidth||0),r=Math.max(n.clientHeight,window.innerHeight||0),a=e?0:ot(n),s=e?0:ot(n,"left"),l={top:a-i.top+i.marginTop,left:s-i.left+i.marginLeft,width:o,height:r};return ht(l)}function _t(t){var e=t.nodeName;if("BODY"===e||"HTML"===e)return!1;if("fixed"===K(t,"position"))return!0;var n=X(t);return!!n&&_t(n)}function vt(t){if(!t||!t.parentElement||tt())return document.documentElement;for(var e=t.parentElement;e&&"none"===K(e,"transform");)e=e.parentElement;return e||document.documentElement}function bt(t,e,n,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r={top:0,left:0},a=o?vt(t):it(t,$(e));if("viewport"===i)r=gt(a,o);else{var s=void 0;"scrollParent"===i?"BODY"===(s=G(X(e))).nodeName&&(s=t.ownerDocument.documentElement):s="window"===i?t.ownerDocument.documentElement:i;var l=mt(s,a,o);if("HTML"!==s.nodeName||_t(a))r=l;else{var u=lt(t.ownerDocument),f=u.height,d=u.width;r.top+=l.top-l.marginTop,r.bottom=f+l.top,r.left+=l.left-l.marginLeft,r.right=d+l.left}}var c="number"==typeof(n=n||0);return r.left+=c?n:n.left||0,r.top+=c?n:n.top||0,r.right-=c?n:n.right||0,r.bottom-=c?n:n.bottom||0,r}function yt(t){return t.width*t.height}function Et(t,e,n,i,o){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===t.indexOf("auto"))return t;var a=bt(n,i,r,o),s={top:{width:a.width,height:e.top-a.top},right:{width:a.right-e.right,height:a.height},bottom:{width:a.width,height:a.bottom-e.bottom},left:{width:e.left-a.left,height:a.height}},l=Object.keys(s).map((function(t){return ct({key:t},s[t],{area:yt(s[t])})})).sort((function(t,e){return e.area-t.area})),u=l.filter((function(t){var e=t.width,i=t.height;return e>=n.clientWidth&&i>=n.clientHeight})),f=u.length>0?u[0].key:l[0].key,d=t.split("-")[1];return f+(d?"-"+d:"")}function wt(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=i?vt(e):it(e,$(n));return mt(n,o,i)}function Tt(t){var e=t.ownerDocument.defaultView.getComputedStyle(t),n=parseFloat(e.marginTop||0)+parseFloat(e.marginBottom||0),i=parseFloat(e.marginLeft||0)+parseFloat(e.marginRight||0);return{width:t.offsetWidth+i,height:t.offsetHeight+n}}function Ct(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,(function(t){return e[t]}))}function St(t,e,n){n=n.split("-")[0];var i=Tt(t),o={width:i.width,height:i.height},r=-1!==["right","left"].indexOf(n),a=r?"top":"left",s=r?"left":"top",l=r?"height":"width",u=r?"width":"height";return o[a]=e[a]+e[l]/2-i[l]/2,o[s]=n===s?e[s]-i[u]:e[Ct(s)],o}function Nt(t,e){return Array.prototype.find?t.find(e):t.filter(e)[0]}function Dt(t,e,n){return(void 0===n?t:t.slice(0,function(t,e,n){if(Array.prototype.findIndex)return t.findIndex((function(t){return t.name===n}));var i=Nt(t,(function(t){return t.name===n}));return t.indexOf(i)}(t,0,n))).forEach((function(t){t.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var n=t.function||t.fn;t.enabled&&z(n)&&(e.offsets.popper=ht(e.offsets.popper),e.offsets.reference=ht(e.offsets.reference),e=n(e,t))})),e}function At(){if(!this.state.isDestroyed){var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=wt(this.state,this.popper,this.reference,this.options.positionFixed),t.placement=Et(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.positionFixed=this.options.positionFixed,t.offsets.popper=St(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",t=Dt(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t))}}function kt(t,e){return t.some((function(t){var n=t.name;return t.enabled&&n===e}))}function It(t){for(var e=[!1,"ms","Webkit","Moz","O"],n=t.charAt(0).toUpperCase()+t.slice(1),i=0;i<e.length;i++){var o=e[i],r=o?""+o+n:t;if("undefined"!=typeof document.body.style[r])return r}return null}function Ot(){return this.state.isDestroyed=!0,kt(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.position="",this.popper.style.top="",this.popper.style.left="",this.popper.style.right="",this.popper.style.bottom="",this.popper.style.willChange="",this.popper.style[It("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function xt(t){var e=t.ownerDocument;return e?e.defaultView:window}function jt(t,e,n,i){var o="BODY"===t.nodeName,r=o?t.ownerDocument.defaultView:t;r.addEventListener(e,n,{passive:!0}),o||jt(G(r.parentNode),e,n,i),i.push(r)}function Lt(t,e,n,i){n.updateBound=i,xt(t).addEventListener("resize",n.updateBound,{passive:!0});var o=G(t);return jt(o,"scroll",n.updateBound,n.scrollParents),n.scrollElement=o,n.eventsEnabled=!0,n}function Pt(){this.state.eventsEnabled||(this.state=Lt(this.reference,this.options,this.state,this.scheduleUpdate))}function Ft(){var t,e;this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=(t=this.reference,e=this.state,xt(t).removeEventListener("resize",e.updateBound),e.scrollParents.forEach((function(t){t.removeEventListener("scroll",e.updateBound)})),e.updateBound=null,e.scrollParents=[],e.scrollElement=null,e.eventsEnabled=!1,e))}function Rt(t){return""!==t&&!isNaN(parseFloat(t))&&isFinite(t)}function Bt(t,e){Object.keys(e).forEach((function(n){var i="";-1!==["width","height","top","right","bottom","left"].indexOf(n)&&Rt(e[n])&&(i="px"),t.style[n]=e[n]+i}))}var Ht=U&&/Firefox/i.test(navigator.userAgent);function Mt(t,e,n){var i=Nt(t,(function(t){return t.name===e})),o=!!i&&t.some((function(t){return t.name===n&&t.enabled&&t.order<i.order}));if(!o){var r="`"+e+"`",a="`"+n+"`";console.warn(a+" modifier is required by "+r+" modifier in order to work, be sure to include it before "+r+"!")}return o}var qt=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],Qt=qt.slice(3);function Wt(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Qt.indexOf(t),i=Qt.slice(n+1).concat(Qt.slice(0,n));return e?i.reverse():i}var Ut={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(t){var e=t.placement,n=e.split("-")[0],i=e.split("-")[1];if(i){var o=t.offsets,r=o.reference,a=o.popper,s=-1!==["bottom","top"].indexOf(n),l=s?"left":"top",u=s?"width":"height",f={start:dt({},l,r[l]),end:dt({},l,r[l]+r[u]-a[u])};t.offsets.popper=ct({},a,f[i])}return t}},offset:{order:200,enabled:!0,fn:function(t,e){var n,i=e.offset,o=t.placement,r=t.offsets,a=r.popper,s=r.reference,l=o.split("-")[0];return n=Rt(+i)?[+i,0]:function(t,e,n,i){var o=[0,0],r=-1!==["right","left"].indexOf(i),a=t.split(/(\+|\-)/).map((function(t){return t.trim()})),s=a.indexOf(Nt(a,(function(t){return-1!==t.search(/,|\s/)})));a[s]&&-1===a[s].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=-1!==s?[a.slice(0,s).concat([a[s].split(l)[0]]),[a[s].split(l)[1]].concat(a.slice(s+1))]:[a];return u=u.map((function(t,i){var o=(1===i?!r:r)?"height":"width",a=!1;return t.reduce((function(t,e){return""===t[t.length-1]&&-1!==["+","-"].indexOf(e)?(t[t.length-1]=e,a=!0,t):a?(t[t.length-1]+=e,a=!1,t):t.concat(e)}),[]).map((function(t){return function(t,e,n,i){var o=t.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+o[1],a=o[2];return r?0===a.indexOf("%")?ht("%p"===a?n:i)[e]/100*r:"vh"===a||"vw"===a?("vh"===a?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*r:r:t}(t,o,e,n)}))})),u.forEach((function(t,e){t.forEach((function(n,i){Rt(n)&&(o[e]+=n*("-"===t[i-1]?-1:1))}))})),o}(i,a,s,l),"left"===l?(a.top+=n[0],a.left-=n[1]):"right"===l?(a.top+=n[0],a.left+=n[1]):"top"===l?(a.left+=n[0],a.top-=n[1]):"bottom"===l&&(a.left+=n[0],a.top+=n[1]),t.popper=a,t},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(t,e){var n=e.boundariesElement||et(t.instance.popper);t.instance.reference===n&&(n=et(n));var i=It("transform"),o=t.instance.popper.style,r=o.top,a=o.left,s=o[i];o.top="",o.left="",o[i]="";var l=bt(t.instance.popper,t.instance.reference,e.padding,n,t.positionFixed);o.top=r,o.left=a,o[i]=s,e.boundaries=l;var u=e.priority,f=t.offsets.popper,d={primary:function(t){var n=f[t];return f[t]<l[t]&&!e.escapeWithReference&&(n=Math.max(f[t],l[t])),dt({},t,n)},secondary:function(t){var n="right"===t?"left":"top",i=f[n];return f[t]>l[t]&&!e.escapeWithReference&&(i=Math.min(f[n],l[t]-("right"===t?f.width:f.height))),dt({},n,i)}};return u.forEach((function(t){var e=-1!==["left","top"].indexOf(t)?"primary":"secondary";f=ct({},f,d[e](t))})),t.offsets.popper=f,t},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(t){var e=t.offsets,n=e.popper,i=e.reference,o=t.placement.split("-")[0],r=Math.floor,a=-1!==["top","bottom"].indexOf(o),s=a?"right":"bottom",l=a?"left":"top",u=a?"width":"height";return n[s]<r(i[l])&&(t.offsets.popper[l]=r(i[l])-n[u]),n[l]>r(i[s])&&(t.offsets.popper[l]=r(i[s])),t}},arrow:{order:500,enabled:!0,fn:function(t,e){var n;if(!Mt(t.instance.modifiers,"arrow","keepTogether"))return t;var i=e.element;if("string"==typeof i){if(!(i=t.instance.popper.querySelector(i)))return t}else if(!t.instance.popper.contains(i))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),t;var o=t.placement.split("-")[0],r=t.offsets,a=r.popper,s=r.reference,l=-1!==["left","right"].indexOf(o),u=l?"height":"width",f=l?"Top":"Left",d=f.toLowerCase(),c=l?"left":"top",h=l?"bottom":"right",p=Tt(i)[u];s[h]-p<a[d]&&(t.offsets.popper[d]-=a[d]-(s[h]-p)),s[d]+p>a[h]&&(t.offsets.popper[d]+=s[d]+p-a[h]),t.offsets.popper=ht(t.offsets.popper);var m=s[d]+s[u]/2-p/2,g=K(t.instance.popper),_=parseFloat(g["margin"+f]),v=parseFloat(g["border"+f+"Width"]),b=m-t.offsets.popper[d]-_-v;return b=Math.max(Math.min(a[u]-p,b),0),t.arrowElement=i,t.offsets.arrow=(dt(n={},d,Math.round(b)),dt(n,c,""),n),t},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(t,e){if(kt(t.instance.modifiers,"inner"))return t;if(t.flipped&&t.placement===t.originalPlacement)return t;var n=bt(t.instance.popper,t.instance.reference,e.padding,e.boundariesElement,t.positionFixed),i=t.placement.split("-")[0],o=Ct(i),r=t.placement.split("-")[1]||"",a=[];switch(e.behavior){case"flip":a=[i,o];break;case"clockwise":a=Wt(i);break;case"counterclockwise":a=Wt(i,!0);break;default:a=e.behavior}return a.forEach((function(s,l){if(i!==s||a.length===l+1)return t;i=t.placement.split("-")[0],o=Ct(i);var u=t.offsets.popper,f=t.offsets.reference,d=Math.floor,c="left"===i&&d(u.right)>d(f.left)||"right"===i&&d(u.left)<d(f.right)||"top"===i&&d(u.bottom)>d(f.top)||"bottom"===i&&d(u.top)<d(f.bottom),h=d(u.left)<d(n.left),p=d(u.right)>d(n.right),m=d(u.top)<d(n.top),g=d(u.bottom)>d(n.bottom),_="left"===i&&h||"right"===i&&p||"top"===i&&m||"bottom"===i&&g,v=-1!==["top","bottom"].indexOf(i),b=!!e.flipVariations&&(v&&"start"===r&&h||v&&"end"===r&&p||!v&&"start"===r&&m||!v&&"end"===r&&g),y=!!e.flipVariationsByContent&&(v&&"start"===r&&p||v&&"end"===r&&h||!v&&"start"===r&&g||!v&&"end"===r&&m),E=b||y;(c||_||E)&&(t.flipped=!0,(c||_)&&(i=a[l+1]),E&&(r=function(t){return"end"===t?"start":"start"===t?"end":t}(r)),t.placement=i+(r?"-"+r:""),t.offsets.popper=ct({},t.offsets.popper,St(t.instance.popper,t.offsets.reference,t.placement)),t=Dt(t.instance.modifiers,t,"flip"))})),t},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(t){var e=t.placement,n=e.split("-")[0],i=t.offsets,o=i.popper,r=i.reference,a=-1!==["left","right"].indexOf(n),s=-1===["top","left"].indexOf(n);return o[a?"left":"top"]=r[n]-(s?o[a?"width":"height"]:0),t.placement=Ct(e),t.offsets.popper=ht(o),t}},hide:{order:800,enabled:!0,fn:function(t){if(!Mt(t.instance.modifiers,"hide","preventOverflow"))return t;var e=t.offsets.reference,n=Nt(t.instance.modifiers,(function(t){return"preventOverflow"===t.name})).boundaries;if(e.bottom<n.top||e.left>n.right||e.top>n.bottom||e.right<n.left){if(!0===t.hide)return t;t.hide=!0,t.attributes["x-out-of-boundaries"]=""}else{if(!1===t.hide)return t;t.hide=!1,t.attributes["x-out-of-boundaries"]=!1}return t}},computeStyle:{order:850,enabled:!0,fn:function(t,e){var n=e.x,i=e.y,o=t.offsets.popper,r=Nt(t.instance.modifiers,(function(t){return"applyStyle"===t.name})).gpuAcceleration;void 0!==r&&console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");var a,s,l=void 0!==r?r:e.gpuAcceleration,u=et(t.instance.popper),f=pt(u),d={position:o.position},c=function(t,e){var n=t.offsets,i=n.popper,o=n.reference,r=Math.round,a=Math.floor,s=function(t){return t},l=r(o.width),u=r(i.width),f=-1!==["left","right"].indexOf(t.placement),d=-1!==t.placement.indexOf("-"),c=e?f||d||l%2==u%2?r:a:s,h=e?r:s;return{left:c(l%2==1&&u%2==1&&!d&&e?i.left-1:i.left),top:h(i.top),bottom:h(i.bottom),right:c(i.right)}}(t,window.devicePixelRatio<2||!Ht),h="bottom"===n?"top":"bottom",p="right"===i?"left":"right",m=It("transform");if(s="bottom"===h?"HTML"===u.nodeName?-u.clientHeight+c.bottom:-f.height+c.bottom:c.top,a="right"===p?"HTML"===u.nodeName?-u.clientWidth+c.right:-f.width+c.right:c.left,l&&m)d[m]="translate3d("+a+"px, "+s+"px, 0)",d[h]=0,d[p]=0,d.willChange="transform";else{var g="bottom"===h?-1:1,_="right"===p?-1:1;d[h]=s*g,d[p]=a*_,d.willChange=h+", "+p}var v={"x-placement":t.placement};return t.attributes=ct({},v,t.attributes),t.styles=ct({},d,t.styles),t.arrowStyles=ct({},t.offsets.arrow,t.arrowStyles),t},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(t){var e,n;return Bt(t.instance.popper,t.styles),e=t.instance.popper,n=t.attributes,Object.keys(n).forEach((function(t){!1!==n[t]?e.setAttribute(t,n[t]):e.removeAttribute(t)})),t.arrowElement&&Object.keys(t.arrowStyles).length&&Bt(t.arrowElement,t.arrowStyles),t},onLoad:function(t,e,n,i,o){var r=wt(o,e,t,n.positionFixed),a=Et(n.placement,r,e,t,n.modifiers.flip.boundariesElement,n.modifiers.flip.padding);return e.setAttribute("x-placement",a),Bt(e,{position:n.positionFixed?"fixed":"absolute"}),n},gpuAcceleration:void 0}}},Vt=function(){function t(e,n){var i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ut(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(i.update)},this.update=Y(this.update.bind(this)),this.options=ct({},t.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(ct({},t.Defaults.modifiers,o.modifiers)).forEach((function(e){i.options.modifiers[e]=ct({},t.Defaults.modifiers[e]||{},o.modifiers?o.modifiers[e]:{})})),this.modifiers=Object.keys(this.options.modifiers).map((function(t){return ct({name:t},i.options.modifiers[t])})).sort((function(t,e){return t.order-e.order})),this.modifiers.forEach((function(t){t.enabled&&z(t.onLoad)&&t.onLoad(i.reference,i.popper,i.options,t,i.state)})),this.update();var r=this.options.eventsEnabled;r&&this.enableEventListeners(),this.state.eventsEnabled=r}return ft(t,[{key:"update",value:function(){return At.call(this)}},{key:"destroy",value:function(){return Ot.call(this)}},{key:"enableEventListeners",value:function(){return Pt.call(this)}},{key:"disableEventListeners",value:function(){return Ft.call(this)}}]),t}();Vt.Utils=("undefined"!=typeof window?window:global).PopperUtils,Vt.placements=qt,Vt.Defaults=Ut;var Yt=Vt,zt="dropdown",Kt="bs.dropdown",Xt=i.default.fn[zt],Gt=new RegExp("38|40|27"),$t="disabled",Jt="show",Zt="dropdown-menu-right",te="hide.bs.dropdown",ee="hidden.bs.dropdown",ne="click.bs.dropdown.data-api",ie="keydown.bs.dropdown.data-api",oe='[data-toggle="dropdown"]',re=".dropdown-menu",ae={offset:0,flip:!0,boundary:"scrollParent",reference:"toggle",display:"dynamic",popperConfig:null},se={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string",popperConfig:"(null|object)"},le=function(){function t(t,e){this._element=t,this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var e=t.prototype;return e.toggle=function(){if(!this._element.disabled&&!i.default(this._element).hasClass($t)){var e=i.default(this._menu).hasClass(Jt);t._clearMenus(),e||this.show(!0)}},e.show=function(e){if(void 0===e&&(e=!1),!(this._element.disabled||i.default(this._element).hasClass($t)||i.default(this._menu).hasClass(Jt))){var n={relatedTarget:this._element},o=i.default.Event("show.bs.dropdown",n),r=t._getParentFromElement(this._element);if(i.default(r).trigger(o),!o.isDefaultPrevented()){if(!this._inNavbar&&e){if("undefined"==typeof Yt)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");var a=this._element;"parent"===this._config.reference?a=r:u.isElement(this._config.reference)&&(a=this._config.reference,"undefined"!=typeof this._config.reference.jquery&&(a=this._config.reference[0])),"scrollParent"!==this._config.boundary&&i.default(r).addClass("position-static"),this._popper=new Yt(a,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===i.default(r).closest(".navbar-nav").length&&i.default(document.body).children().on("mouseover",null,i.default.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),i.default(this._menu).toggleClass(Jt),i.default(r).toggleClass(Jt).trigger(i.default.Event("shown.bs.dropdown",n))}}},e.hide=function(){if(!this._element.disabled&&!i.default(this._element).hasClass($t)&&i.default(this._menu).hasClass(Jt)){var e={relatedTarget:this._element},n=i.default.Event(te,e),o=t._getParentFromElement(this._element);i.default(o).trigger(n),n.isDefaultPrevented()||(this._popper&&this._popper.destroy(),i.default(this._menu).toggleClass(Jt),i.default(o).toggleClass(Jt).trigger(i.default.Event(ee,e)))}},e.dispose=function(){i.default.removeData(this._element,Kt),i.default(this._element).off(".bs.dropdown"),this._element=null,this._menu=null,null!==this._popper&&(this._popper.destroy(),this._popper=null)},e.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},e._addEventListeners=function(){var t=this;i.default(this._element).on("click.bs.dropdown",(function(e){e.preventDefault(),e.stopPropagation(),t.toggle()}))},e._getConfig=function(t){return t=a({},this.constructor.Default,i.default(this._element).data(),t),u.typeCheckConfig(zt,t,this.constructor.DefaultType),t},e._getMenuElement=function(){if(!this._menu){var e=t._getParentFromElement(this._element);e&&(this._menu=e.querySelector(re))}return this._menu},e._getPlacement=function(){var t=i.default(this._element.parentNode),e="bottom-start";return t.hasClass("dropup")?e=i.default(this._menu).hasClass(Zt)?"top-end":"top-start":t.hasClass("dropright")?e="right-start":t.hasClass("dropleft")?e="left-start":i.default(this._menu).hasClass(Zt)&&(e="bottom-end"),e},e._detectNavbar=function(){return i.default(this._element).closest(".navbar").length>0},e._getOffset=function(){var t=this,e={};return"function"==typeof this._config.offset?e.fn=function(e){return e.offsets=a({},e.offsets,t._config.offset(e.offsets,t._element)),e}:e.offset=this._config.offset,e},e._getPopperConfig=function(){var t={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(t.modifiers.applyStyle={enabled:!1}),a({},t,this._config.popperConfig)},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this).data(Kt);if(n||(n=new t(this,"object"==typeof e?e:null),i.default(this).data(Kt,n)),"string"==typeof e){if("undefined"==typeof n[e])throw new TypeError('No method named "'+e+'"');n[e]()}}))},t._clearMenus=function(e){if(!e||3!==e.which&&("keyup"!==e.type||9===e.which))for(var n=[].slice.call(document.querySelectorAll(oe)),o=0,r=n.length;o<r;o++){var a=t._getParentFromElement(n[o]),s=i.default(n[o]).data(Kt),l={relatedTarget:n[o]};if(e&&"click"===e.type&&(l.clickEvent=e),s){var u=s._menu;if(i.default(a).hasClass(Jt)&&!(e&&("click"===e.type&&/input|textarea/i.test(e.target.tagName)||"keyup"===e.type&&9===e.which)&&i.default.contains(a,e.target))){var f=i.default.Event(te,l);i.default(a).trigger(f),f.isDefaultPrevented()||("ontouchstart"in document.documentElement&&i.default(document.body).children().off("mouseover",null,i.default.noop),n[o].setAttribute("aria-expanded","false"),s._popper&&s._popper.destroy(),i.default(u).removeClass(Jt),i.default(a).removeClass(Jt).trigger(i.default.Event(ee,l)))}}}},t._getParentFromElement=function(t){var e,n=u.getSelectorFromElement(t);return n&&(e=document.querySelector(n)),e||t.parentNode},t._dataApiKeydownHandler=function(e){if(!(/input|textarea/i.test(e.target.tagName)?32===e.which||27!==e.which&&(40!==e.which&&38!==e.which||i.default(e.target).closest(re).length):!Gt.test(e.which))&&!this.disabled&&!i.default(this).hasClass($t)){var n=t._getParentFromElement(this),o=i.default(n).hasClass(Jt);if(o||27!==e.which){if(e.preventDefault(),e.stopPropagation(),!o||27===e.which||32===e.which)return 27===e.which&&i.default(n.querySelector(oe)).trigger("focus"),void i.default(this).trigger("click");var r=[].slice.call(n.querySelectorAll(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)")).filter((function(t){return i.default(t).is(":visible")}));if(0!==r.length){var a=r.indexOf(e.target);38===e.which&&a>0&&a--,40===e.which&&a<r.length-1&&a++,a<0&&(a=0),r[a].focus()}}}},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}},{key:"Default",get:function(){return ae}},{key:"DefaultType",get:function(){return se}}]),t}();i.default(document).on(ie,oe,le._dataApiKeydownHandler).on(ie,re,le._dataApiKeydownHandler).on(ne+" keyup.bs.dropdown.data-api",le._clearMenus).on(ne,oe,(function(t){t.preventDefault(),t.stopPropagation(),le._jQueryInterface.call(i.default(this),"toggle")})).on(ne,".dropdown form",(function(t){t.stopPropagation()})),i.default.fn[zt]=le._jQueryInterface,i.default.fn[zt].Constructor=le,i.default.fn[zt].noConflict=function(){return i.default.fn[zt]=Xt,le._jQueryInterface};var ue="bs.modal",fe=i.default.fn.modal,de="modal-open",ce="fade",he="show",pe="modal-static",me="hidden.bs.modal",ge="show.bs.modal",_e="focusin.bs.modal",ve="resize.bs.modal",be="click.dismiss.bs.modal",ye="keydown.dismiss.bs.modal",Ee="mousedown.dismiss.bs.modal",we=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",Te={backdrop:!0,keyboard:!0,focus:!0,show:!0},Ce={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},Se=function(){function t(t,e){this._config=this._getConfig(e),this._element=t,this._dialog=t.querySelector(".modal-dialog"),this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollbarWidth=0}var e=t.prototype;return e.toggle=function(t){return this._isShown?this.hide():this.show(t)},e.show=function(t){var e=this;if(!this._isShown&&!this._isTransitioning){var n=i.default.Event(ge,{relatedTarget:t});i.default(this._element).trigger(n),n.isDefaultPrevented()||(this._isShown=!0,i.default(this._element).hasClass(ce)&&(this._isTransitioning=!0),this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),i.default(this._element).on(be,'[data-dismiss="modal"]',(function(t){return e.hide(t)})),i.default(this._dialog).on(Ee,(function(){i.default(e._element).one("mouseup.dismiss.bs.modal",(function(t){i.default(t.target).is(e._element)&&(e._ignoreBackdropClick=!0)}))})),this._showBackdrop((function(){return e._showElement(t)})))}},e.hide=function(t){var e=this;if(t&&t.preventDefault(),this._isShown&&!this._isTransitioning){var n=i.default.Event("hide.bs.modal");if(i.default(this._element).trigger(n),this._isShown&&!n.isDefaultPrevented()){this._isShown=!1;var o=i.default(this._element).hasClass(ce);if(o&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),i.default(document).off(_e),i.default(this._element).removeClass(he),i.default(this._element).off(be),i.default(this._dialog).off(Ee),o){var r=u.getTransitionDurationFromElement(this._element);i.default(this._element).one(u.TRANSITION_END,(function(t){return e._hideModal(t)})).emulateTransitionEnd(r)}else this._hideModal()}}},e.dispose=function(){[window,this._element,this._dialog].forEach((function(t){return i.default(t).off(".bs.modal")})),i.default(document).off(_e),i.default.removeData(this._element,ue),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._isTransitioning=null,this._scrollbarWidth=null},e.handleUpdate=function(){this._adjustDialog()},e._getConfig=function(t){return t=a({},Te,t),u.typeCheckConfig("modal",t,Ce),t},e._triggerBackdropTransition=function(){var t=this,e=i.default.Event("hidePrevented.bs.modal");if(i.default(this._element).trigger(e),!e.isDefaultPrevented()){var n=this._element.scrollHeight>document.documentElement.clientHeight;n||(this._element.style.overflowY="hidden"),this._element.classList.add(pe);var o=u.getTransitionDurationFromElement(this._dialog);i.default(this._element).off(u.TRANSITION_END),i.default(this._element).one(u.TRANSITION_END,(function(){t._element.classList.remove(pe),n||i.default(t._element).one(u.TRANSITION_END,(function(){t._element.style.overflowY=""})).emulateTransitionEnd(t._element,o)})).emulateTransitionEnd(o),this._element.focus()}},e._showElement=function(t){var e=this,n=i.default(this._element).hasClass(ce),o=this._dialog?this._dialog.querySelector(".modal-body"):null;this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),i.default(this._dialog).hasClass("modal-dialog-scrollable")&&o?o.scrollTop=0:this._element.scrollTop=0,n&&u.reflow(this._element),i.default(this._element).addClass(he),this._config.focus&&this._enforceFocus();var r=i.default.Event("shown.bs.modal",{relatedTarget:t}),a=function(){e._config.focus&&e._element.focus(),e._isTransitioning=!1,i.default(e._element).trigger(r)};if(n){var s=u.getTransitionDurationFromElement(this._dialog);i.default(this._dialog).one(u.TRANSITION_END,a).emulateTransitionEnd(s)}else a()},e._enforceFocus=function(){var t=this;i.default(document).off(_e).on(_e,(function(e){document!==e.target&&t._element!==e.target&&0===i.default(t._element).has(e.target).length&&t._element.focus()}))},e._setEscapeEvent=function(){var t=this;this._isShown?i.default(this._element).on(ye,(function(e){t._config.keyboard&&27===e.which?(e.preventDefault(),t.hide()):t._config.keyboard||27!==e.which||t._triggerBackdropTransition()})):this._isShown||i.default(this._element).off(ye)},e._setResizeEvent=function(){var t=this;this._isShown?i.default(window).on(ve,(function(e){return t.handleUpdate(e)})):i.default(window).off(ve)},e._hideModal=function(){var t=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._showBackdrop((function(){i.default(document.body).removeClass(de),t._resetAdjustments(),t._resetScrollbar(),i.default(t._element).trigger(me)}))},e._removeBackdrop=function(){this._backdrop&&(i.default(this._backdrop).remove(),this._backdrop=null)},e._showBackdrop=function(t){var e=this,n=i.default(this._element).hasClass(ce)?ce:"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className="modal-backdrop",n&&this._backdrop.classList.add(n),i.default(this._backdrop).appendTo(document.body),i.default(this._element).on(be,(function(t){e._ignoreBackdropClick?e._ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"===e._config.backdrop?e._triggerBackdropTransition():e.hide())})),n&&u.reflow(this._backdrop),i.default(this._backdrop).addClass(he),!t)return;if(!n)return void t();var o=u.getTransitionDurationFromElement(this._backdrop);i.default(this._backdrop).one(u.TRANSITION_END,t).emulateTransitionEnd(o)}else if(!this._isShown&&this._backdrop){i.default(this._backdrop).removeClass(he);var r=function(){e._removeBackdrop(),t&&t()};if(i.default(this._element).hasClass(ce)){var a=u.getTransitionDurationFromElement(this._backdrop);i.default(this._backdrop).one(u.TRANSITION_END,r).emulateTransitionEnd(a)}else r()}else t&&t()},e._adjustDialog=function(){var t=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},e._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},e._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(t.left+t.right)<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},e._setScrollbar=function(){var t=this;if(this._isBodyOverflowing){var e=[].slice.call(document.querySelectorAll(we)),n=[].slice.call(document.querySelectorAll(".sticky-top"));i.default(e).each((function(e,n){var o=n.style.paddingRight,r=i.default(n).css("padding-right");i.default(n).data("padding-right",o).css("padding-right",parseFloat(r)+t._scrollbarWidth+"px")})),i.default(n).each((function(e,n){var o=n.style.marginRight,r=i.default(n).css("margin-right");i.default(n).data("margin-right",o).css("margin-right",parseFloat(r)-t._scrollbarWidth+"px")}));var o=document.body.style.paddingRight,r=i.default(document.body).css("padding-right");i.default(document.body).data("padding-right",o).css("padding-right",parseFloat(r)+this._scrollbarWidth+"px")}i.default(document.body).addClass(de)},e._resetScrollbar=function(){var t=[].slice.call(document.querySelectorAll(we));i.default(t).each((function(t,e){var n=i.default(e).data("padding-right");i.default(e).removeData("padding-right"),e.style.paddingRight=n||""}));var e=[].slice.call(document.querySelectorAll(".sticky-top"));i.default(e).each((function(t,e){var n=i.default(e).data("margin-right");"undefined"!=typeof n&&i.default(e).css("margin-right",n).removeData("margin-right")}));var n=i.default(document.body).data("padding-right");i.default(document.body).removeData("padding-right"),document.body.style.paddingRight=n||""},e._getScrollbarWidth=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e},t._jQueryInterface=function(e,n){return this.each((function(){var o=i.default(this).data(ue),r=a({},Te,i.default(this).data(),"object"==typeof e&&e?e:{});if(o||(o=new t(this,r),i.default(this).data(ue,o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e](n)}else r.show&&o.show(n)}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}},{key:"Default",get:function(){return Te}}]),t}();i.default(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',(function(t){var e,n=this,o=u.getSelectorFromElement(this);o&&(e=document.querySelector(o));var r=i.default(e).data(ue)?"toggle":a({},i.default(e).data(),i.default(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||t.preventDefault();var s=i.default(e).one(ge,(function(t){t.isDefaultPrevented()||s.one(me,(function(){i.default(n).is(":visible")&&n.focus()}))}));Se._jQueryInterface.call(i.default(e),r,this)})),i.default.fn.modal=Se._jQueryInterface,i.default.fn.modal.Constructor=Se,i.default.fn.modal.noConflict=function(){return i.default.fn.modal=fe,Se._jQueryInterface};var Ne=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],De=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,Ae=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;function ke(t,e,n){if(0===t.length)return t;if(n&&"function"==typeof n)return n(t);for(var i=(new window.DOMParser).parseFromString(t,"text/html"),o=Object.keys(e),r=[].slice.call(i.body.querySelectorAll("*")),a=function(t,n){var i=r[t],a=i.nodeName.toLowerCase();if(-1===o.indexOf(i.nodeName.toLowerCase()))return i.parentNode.removeChild(i),"continue";var s=[].slice.call(i.attributes),l=[].concat(e["*"]||[],e[a]||[]);s.forEach((function(t){(function(t,e){var n=t.nodeName.toLowerCase();if(-1!==e.indexOf(n))return-1===Ne.indexOf(n)||Boolean(De.test(t.nodeValue)||Ae.test(t.nodeValue));for(var i=e.filter((function(t){return t instanceof RegExp})),o=0,r=i.length;o<r;o++)if(i[o].test(n))return!0;return!1})(t,l)||i.removeAttribute(t.nodeName)}))},s=0,l=r.length;s<l;s++)a(s);return i.body.innerHTML}var Ie="tooltip",Oe="bs.tooltip",xe=i.default.fn.tooltip,je=new RegExp("(^|\\s)bs-tooltip\\S+","g"),Le=["sanitize","whiteList","sanitizeFn"],Pe="fade",Fe="show",Re="show",Be="out",He="hover",Me="focus",qe={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},Qe={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",customClass:"",sanitize:!0,sanitizeFn:null,whiteList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},We={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string|function)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",whiteList:"object",popperConfig:"(null|object)"},Ue={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},Ve=function(){function t(t,e){if("undefined"==typeof Yt)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var e=t.prototype;return e.enable=function(){this._isEnabled=!0},e.disable=function(){this._isEnabled=!1},e.toggleEnabled=function(){this._isEnabled=!this._isEnabled},e.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=i.default(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(i.default(this.getTipElement()).hasClass(Fe))return void this._leave(null,this);this._enter(null,this)}},e.dispose=function(){clearTimeout(this._timeout),i.default.removeData(this.element,this.constructor.DATA_KEY),i.default(this.element).off(this.constructor.EVENT_KEY),i.default(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&i.default(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},e.show=function(){var t=this;if("none"===i.default(this.element).css("display"))throw new Error("Please use show on visible elements");var e=i.default.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){i.default(this.element).trigger(e);var n=u.findShadowRoot(this.element),o=i.default.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(e.isDefaultPrevented()||!o)return;var r=this.getTipElement(),a=u.getUID(this.constructor.NAME);r.setAttribute("id",a),this.element.setAttribute("aria-describedby",a),this.setContent(),this.config.animation&&i.default(r).addClass(Pe);var s="function"==typeof this.config.placement?this.config.placement.call(this,r,this.element):this.config.placement,l=this._getAttachment(s);this.addAttachmentClass(l);var f=this._getContainer();i.default(r).data(this.constructor.DATA_KEY,this),i.default.contains(this.element.ownerDocument.documentElement,this.tip)||i.default(r).appendTo(f),i.default(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new Yt(this.element,r,this._getPopperConfig(l)),i.default(r).addClass(Fe),i.default(r).addClass(this.config.customClass),"ontouchstart"in document.documentElement&&i.default(document.body).children().on("mouseover",null,i.default.noop);var d=function(){t.config.animation&&t._fixTransition();var e=t._hoverState;t._hoverState=null,i.default(t.element).trigger(t.constructor.Event.SHOWN),e===Be&&t._leave(null,t)};if(i.default(this.tip).hasClass(Pe)){var c=u.getTransitionDurationFromElement(this.tip);i.default(this.tip).one(u.TRANSITION_END,d).emulateTransitionEnd(c)}else d()}},e.hide=function(t){var e=this,n=this.getTipElement(),o=i.default.Event(this.constructor.Event.HIDE),r=function(){e._hoverState!==Re&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),i.default(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(i.default(this.element).trigger(o),!o.isDefaultPrevented()){if(i.default(n).removeClass(Fe),"ontouchstart"in document.documentElement&&i.default(document.body).children().off("mouseover",null,i.default.noop),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,i.default(this.tip).hasClass(Pe)){var a=u.getTransitionDurationFromElement(n);i.default(n).one(u.TRANSITION_END,r).emulateTransitionEnd(a)}else r();this._hoverState=""}},e.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},e.isWithContent=function(){return Boolean(this.getTitle())},e.addAttachmentClass=function(t){i.default(this.getTipElement()).addClass("bs-tooltip-"+t)},e.getTipElement=function(){return this.tip=this.tip||i.default(this.config.template)[0],this.tip},e.setContent=function(){var t=this.getTipElement();this.setElementContent(i.default(t.querySelectorAll(".tooltip-inner")),this.getTitle()),i.default(t).removeClass("fade show")},e.setElementContent=function(t,e){"object"!=typeof e||!e.nodeType&&!e.jquery?this.config.html?(this.config.sanitize&&(e=ke(e,this.config.whiteList,this.config.sanitizeFn)),t.html(e)):t.text(e):this.config.html?i.default(e).parent().is(t)||t.empty().append(e):t.text(i.default(e).text())},e.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},e._getPopperConfig=function(t){var e=this;return a({},{placement:t,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:".arrow"},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}},this.config.popperConfig)},e._getOffset=function(){var t=this,e={};return"function"==typeof this.config.offset?e.fn=function(e){return e.offsets=a({},e.offsets,t.config.offset(e.offsets,t.element)),e}:e.offset=this.config.offset,e},e._getContainer=function(){return!1===this.config.container?document.body:u.isElement(this.config.container)?i.default(this.config.container):i.default(document).find(this.config.container)},e._getAttachment=function(t){return qe[t.toUpperCase()]},e._setListeners=function(){var t=this;this.config.trigger.split(" ").forEach((function(e){if("click"===e)i.default(t.element).on(t.constructor.Event.CLICK,t.config.selector,(function(e){return t.toggle(e)}));else if("manual"!==e){var n=e===He?t.constructor.Event.MOUSEENTER:t.constructor.Event.FOCUSIN,o=e===He?t.constructor.Event.MOUSELEAVE:t.constructor.Event.FOCUSOUT;i.default(t.element).on(n,t.config.selector,(function(e){return t._enter(e)})).on(o,t.config.selector,(function(e){return t._leave(e)}))}})),this._hideModalHandler=function(){t.element&&t.hide()},i.default(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=a({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},e._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},e._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||i.default(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?Me:He]=!0),i.default(e.getTipElement()).hasClass(Fe)||e._hoverState===Re?e._hoverState=Re:(clearTimeout(e._timeout),e._hoverState=Re,e.config.delay&&e.config.delay.show?e._timeout=setTimeout((function(){e._hoverState===Re&&e.show()}),e.config.delay.show):e.show())},e._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||i.default(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?Me:He]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=Be,e.config.delay&&e.config.delay.hide?e._timeout=setTimeout((function(){e._hoverState===Be&&e.hide()}),e.config.delay.hide):e.hide())},e._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},e._getConfig=function(t){var e=i.default(this.element).data();return Object.keys(e).forEach((function(t){-1!==Le.indexOf(t)&&delete e[t]})),"number"==typeof(t=a({},this.constructor.Default,e,"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),u.typeCheckConfig(Ie,t,this.constructor.DefaultType),t.sanitize&&(t.template=ke(t.template,t.whiteList,t.sanitizeFn)),t},e._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},e._cleanTipClass=function(){var t=i.default(this.getTipElement()),e=t.attr("class").match(je);null!==e&&e.length&&t.removeClass(e.join(""))},e._handlePopperPlacementChange=function(t){this.tip=t.instance.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},e._fixTransition=function(){var t=this.getTipElement(),e=this.config.animation;null===t.getAttribute("x-placement")&&(i.default(t).removeClass(Pe),this.config.animation=!1,this.hide(),this.show(),this.config.animation=e)},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data(Oe),r="object"==typeof e&&e;if((o||!/dispose|hide/.test(e))&&(o||(o=new t(this,r),n.data(Oe,o)),"string"==typeof e)){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e]()}}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}},{key:"Default",get:function(){return Qe}},{key:"NAME",get:function(){return Ie}},{key:"DATA_KEY",get:function(){return Oe}},{key:"Event",get:function(){return Ue}},{key:"EVENT_KEY",get:function(){return".bs.tooltip"}},{key:"DefaultType",get:function(){return We}}]),t}();i.default.fn.tooltip=Ve._jQueryInterface,i.default.fn.tooltip.Constructor=Ve,i.default.fn.tooltip.noConflict=function(){return i.default.fn.tooltip=xe,Ve._jQueryInterface};var Ye="bs.popover",ze=i.default.fn.popover,Ke=new RegExp("(^|\\s)bs-popover\\S+","g"),Xe=a({},Ve.Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),Ge=a({},Ve.DefaultType,{content:"(string|element|function)"}),$e={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"},Je=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,s(e,n);var a=o.prototype;return a.isWithContent=function(){return this.getTitle()||this._getContent()},a.addAttachmentClass=function(t){i.default(this.getTipElement()).addClass("bs-popover-"+t)},a.getTipElement=function(){return this.tip=this.tip||i.default(this.config.template)[0],this.tip},a.setContent=function(){var t=i.default(this.getTipElement());this.setElementContent(t.find(".popover-header"),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(".popover-body"),e),t.removeClass("fade show")},a._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},a._cleanTipClass=function(){var t=i.default(this.getTipElement()),e=t.attr("class").match(Ke);null!==e&&e.length>0&&t.removeClass(e.join(""))},o._jQueryInterface=function(t){return this.each((function(){var e=i.default(this).data(Ye),n="object"==typeof t?t:null;if((e||!/dispose|hide/.test(t))&&(e||(e=new o(this,n),i.default(this).data(Ye,e)),"string"==typeof t)){if("undefined"==typeof e[t])throw new TypeError('No method named "'+t+'"');e[t]()}}))},r(o,null,[{key:"VERSION",get:function(){return"4.6.2"}},{key:"Default",get:function(){return Xe}},{key:"NAME",get:function(){return"popover"}},{key:"DATA_KEY",get:function(){return Ye}},{key:"Event",get:function(){return $e}},{key:"EVENT_KEY",get:function(){return".bs.popover"}},{key:"DefaultType",get:function(){return Ge}}]),o}(Ve);i.default.fn.popover=Je._jQueryInterface,i.default.fn.popover.Constructor=Je,i.default.fn.popover.noConflict=function(){return i.default.fn.popover=ze,Je._jQueryInterface};var Ze="scrollspy",tn="bs.scrollspy",en=i.default.fn[Ze],nn="active",on="position",rn=".nav, .list-group",an={offset:10,method:"auto",target:""},sn={offset:"number",method:"string",target:"(string|element)"},ln=function(){function t(t,e){var n=this;this._element=t,this._scrollElement="BODY"===t.tagName?window:t,this._config=this._getConfig(e),this._selector=this._config.target+" .nav-link,"+this._config.target+" .list-group-item,"+this._config.target+" .dropdown-item",this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,i.default(this._scrollElement).on("scroll.bs.scrollspy",(function(t){return n._process(t)})),this.refresh(),this._process()}var e=t.prototype;return e.refresh=function(){var t=this,e=this._scrollElement===this._scrollElement.window?"offset":on,n="auto"===this._config.method?e:this._config.method,o=n===on?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),[].slice.call(document.querySelectorAll(this._selector)).map((function(t){var e,r=u.getSelectorFromElement(t);if(r&&(e=document.querySelector(r)),e){var a=e.getBoundingClientRect();if(a.width||a.height)return[i.default(e)[n]().top+o,r]}return null})).filter(Boolean).sort((function(t,e){return t[0]-e[0]})).forEach((function(e){t._offsets.push(e[0]),t._targets.push(e[1])}))},e.dispose=function(){i.default.removeData(this._element,tn),i.default(this._scrollElement).off(".bs.scrollspy"),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},e._getConfig=function(t){if("string"!=typeof(t=a({},an,"object"==typeof t&&t?t:{})).target&&u.isElement(t.target)){var e=i.default(t.target).attr("id");e||(e=u.getUID(Ze),i.default(t.target).attr("id",e)),t.target="#"+e}return u.typeCheckConfig(Ze,t,sn),t},e._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},e._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},e._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},e._process=function(){var t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=n){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&t<this._offsets[0]&&this._offsets[0]>0)return this._activeTarget=null,void this._clear();for(var o=this._offsets.length;o--;)this._activeTarget!==this._targets[o]&&t>=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||t<this._offsets[o+1])&&this._activate(this._targets[o])}},e._activate=function(t){this._activeTarget=t,this._clear();var e=this._selector.split(",").map((function(e){return e+'[data-target="'+t+'"],'+e+'[href="'+t+'"]'})),n=i.default([].slice.call(document.querySelectorAll(e.join(","))));n.hasClass("dropdown-item")?(n.closest(".dropdown").find(".dropdown-toggle").addClass(nn),n.addClass(nn)):(n.addClass(nn),n.parents(rn).prev(".nav-link, .list-group-item").addClass(nn),n.parents(rn).prev(".nav-item").children(".nav-link").addClass(nn)),i.default(this._scrollElement).trigger("activate.bs.scrollspy",{relatedTarget:t})},e._clear=function(){[].slice.call(document.querySelectorAll(this._selector)).filter((function(t){return t.classList.contains(nn)})).forEach((function(t){return t.classList.remove(nn)}))},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this).data(tn);if(n||(n=new t(this,"object"==typeof e&&e),i.default(this).data(tn,n)),"string"==typeof e){if("undefined"==typeof n[e])throw new TypeError('No method named "'+e+'"');n[e]()}}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}},{key:"Default",get:function(){return an}}]),t}();i.default(window).on("load.bs.scrollspy.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-spy="scroll"]')),e=t.length;e--;){var n=i.default(t[e]);ln._jQueryInterface.call(n,n.data())}})),i.default.fn[Ze]=ln._jQueryInterface,i.default.fn[Ze].Constructor=ln,i.default.fn[Ze].noConflict=function(){return i.default.fn[Ze]=en,ln._jQueryInterface};var un="bs.tab",fn=i.default.fn.tab,dn="active",cn="fade",hn="show",pn=".active",mn="> li > .active",gn=function(){function t(t){this._element=t}var e=t.prototype;return e.show=function(){var t=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&i.default(this._element).hasClass(dn)||i.default(this._element).hasClass("disabled")||this._element.hasAttribute("disabled"))){var e,n,o=i.default(this._element).closest(".nav, .list-group")[0],r=u.getSelectorFromElement(this._element);if(o){var a="UL"===o.nodeName||"OL"===o.nodeName?mn:pn;n=(n=i.default.makeArray(i.default(o).find(a)))[n.length-1]}var s=i.default.Event("hide.bs.tab",{relatedTarget:this._element}),l=i.default.Event("show.bs.tab",{relatedTarget:n});if(n&&i.default(n).trigger(s),i.default(this._element).trigger(l),!l.isDefaultPrevented()&&!s.isDefaultPrevented()){r&&(e=document.querySelector(r)),this._activate(this._element,o);var f=function(){var e=i.default.Event("hidden.bs.tab",{relatedTarget:t._element}),o=i.default.Event("shown.bs.tab",{relatedTarget:n});i.default(n).trigger(e),i.default(t._element).trigger(o)};e?this._activate(e,e.parentNode,f):f()}}},e.dispose=function(){i.default.removeData(this._element,un),this._element=null},e._activate=function(t,e,n){var o=this,r=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?i.default(e).children(pn):i.default(e).find(mn))[0],a=n&&r&&i.default(r).hasClass(cn),s=function(){return o._transitionComplete(t,r,n)};if(r&&a){var l=u.getTransitionDurationFromElement(r);i.default(r).removeClass(hn).one(u.TRANSITION_END,s).emulateTransitionEnd(l)}else s()},e._transitionComplete=function(t,e,n){if(e){i.default(e).removeClass(dn);var o=i.default(e.parentNode).find("> .dropdown-menu .active")[0];o&&i.default(o).removeClass(dn),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1)}i.default(t).addClass(dn),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),u.reflow(t),t.classList.contains(cn)&&t.classList.add(hn);var r=t.parentNode;if(r&&"LI"===r.nodeName&&(r=r.parentNode),r&&i.default(r).hasClass("dropdown-menu")){var a=i.default(t).closest(".dropdown")[0];if(a){var s=[].slice.call(a.querySelectorAll(".dropdown-toggle"));i.default(s).addClass(dn)}t.setAttribute("aria-expanded",!0)}n&&n()},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data(un);if(o||(o=new t(this),n.data(un,o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e]()}}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}}]),t}();i.default(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',(function(t){t.preventDefault(),gn._jQueryInterface.call(i.default(this),"show")})),i.default.fn.tab=gn._jQueryInterface,i.default.fn.tab.Constructor=gn,i.default.fn.tab.noConflict=function(){return i.default.fn.tab=fn,gn._jQueryInterface};var _n="bs.toast",vn=i.default.fn.toast,bn="hide",yn="show",En="showing",wn="click.dismiss.bs.toast",Tn={animation:!0,autohide:!0,delay:500},Cn={animation:"boolean",autohide:"boolean",delay:"number"},Sn=function(){function t(t,e){this._element=t,this._config=this._getConfig(e),this._timeout=null,this._setListeners()}var e=t.prototype;return e.show=function(){var t=this,e=i.default.Event("show.bs.toast");if(i.default(this._element).trigger(e),!e.isDefaultPrevented()){this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");var n=function(){t._element.classList.remove(En),t._element.classList.add(yn),i.default(t._element).trigger("shown.bs.toast"),t._config.autohide&&(t._timeout=setTimeout((function(){t.hide()}),t._config.delay))};if(this._element.classList.remove(bn),u.reflow(this._element),this._element.classList.add(En),this._config.animation){var o=u.getTransitionDurationFromElement(this._element);i.default(this._element).one(u.TRANSITION_END,n).emulateTransitionEnd(o)}else n()}},e.hide=function(){if(this._element.classList.contains(yn)){var t=i.default.Event("hide.bs.toast");i.default(this._element).trigger(t),t.isDefaultPrevented()||this._close()}},e.dispose=function(){this._clearTimeout(),this._element.classList.contains(yn)&&this._element.classList.remove(yn),i.default(this._element).off(wn),i.default.removeData(this._element,_n),this._element=null,this._config=null},e._getConfig=function(t){return t=a({},Tn,i.default(this._element).data(),"object"==typeof t&&t?t:{}),u.typeCheckConfig("toast",t,this.constructor.DefaultType),t},e._setListeners=function(){var t=this;i.default(this._element).on(wn,'[data-dismiss="toast"]',(function(){return t.hide()}))},e._close=function(){var t=this,e=function(){t._element.classList.add(bn),i.default(t._element).trigger("hidden.bs.toast")};if(this._element.classList.remove(yn),this._config.animation){var n=u.getTransitionDurationFromElement(this._element);i.default(this._element).one(u.TRANSITION_END,e).emulateTransitionEnd(n)}else e()},e._clearTimeout=function(){clearTimeout(this._timeout),this._timeout=null},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data(_n);if(o||(o=new t(this,"object"==typeof e&&e),n.data(_n,o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e](this)}}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.2"}},{key:"DefaultType",get:function(){return Cn}},{key:"Default",get:function(){return Tn}}]),t}();i.default.fn.toast=Sn._jQueryInterface,i.default.fn.toast.Constructor=Sn,i.default.fn.toast.noConflict=function(){return i.default.fn.toast=vn,Sn._jQueryInterface},t.Alert=c,t.Button=b,t.Carousel=O,t.Collapse=W,t.Dropdown=le,t.Modal=Se,t.Popover=Je,t.Scrollspy=ln,t.Tab=gn,t.Toast=Sn,t.Tooltip=Ve,t.Util=u,Object.defineProperty(t,"__esModule",{value:!0})}));
/*! volt-editor v2.0.4 */
(function(){var a;a={},a.Machine=function(){function a(a){this.context=a,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return a.prototype.addTransition=function(a,b,c,d){return c||(c=b),this._stateTransitions[[a,b]]=[c,d]},a.prototype.addTransitions=function(a,b,c,d){var e,f,g,h;for(c||(c=b),h=[],f=0,g=a.length;f<g;f++)e=a[f],h.push(this.addTransition(e,b,c,d));return h},a.prototype.addTransitionAny=function(a,b,c){return b||(b=a),this._stateTransitionsAny[a]=[b,c]},a.prototype.setDefaultTransition=function(a,b){return this._defaultTransition=[a,b]},a.prototype.getTransition=function(a,b){if(this._stateTransitions[[a,b]])return this._stateTransitions[[a,b]];if(this._stateTransitionsAny[b])return this._stateTransitionsAny[b];if(this._defaultTransition)return this._defaultTransition;throw new Error("Transition is undefined: ("+a+", "+b+")")},a.prototype.getCurrentState=function(){return this._currentState},a.prototype.setInitialState=function(a){if(this._initialState=a,!this._currentState)return this.reset()},a.prototype.reset=function(){return this._currentState=this._initialState},a.prototype.process=function(a){var b;return b=this.getTransition(a,this._currentState),b[1]&&b[1].call(this.context||(this.context=this),a),this._currentState=b[0]},a}(),"undefined"!=typeof window&&(window.FSM=a),"undefined"!=typeof module&&module.exports&&(module.exports=a)}).call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A=[].slice,B=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};r={},"undefined"!=typeof window&&(window.HTMLString=r),"undefined"!=typeof module&&module.exports&&(module.exports=r),r.String=function(){function a(a,b){null==b&&(b=!1),this._preserveWhitespace=b,a?(null===r.String._parser&&(r.String._parser=new z),this.characters=r.String._parser.parse(a,this._preserveWhitespace).characters):this.characters=[]}return a._parser=null,a.prototype.isWhitespace=function(){var a,b,c,d;for(d=this.characters,b=0,c=d.length;b<c;b++)if(a=d[b],!a.isWhitespace())return!1;return!0},a.prototype.length=function(){return this.characters.length},a.prototype.preserveWhitespace=function(){return this._preserveWhitespace},a.prototype.capitalize=function(){var a,b;return b=this.copy(),b.length()&&(a=b.characters[0]._c.toUpperCase(),b.characters[0]._c=a),b},a.prototype.charAt=function(a){return this.characters[a].copy()},a.prototype.concat=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(g=2<=arguments.length?A.call(arguments,0,i=arguments.length-1):(i=0,[]),c=arguments[i++],void 0!==c&&"boolean"!=typeof c&&(g.push(c),c=!0),e=this.copy(),j=0,m=g.length;j<m;j++)if(f=g[j],0!==f.length){if(h=f,"string"==typeof f&&(h=new r.String(f,this._preserveWhitespace)),c&&e.length())for(b=e.charAt(e.length()-1),d=b.tags(),b.isTag()&&d.shift(),"string"!=typeof f&&(h=h.copy()),p=h.characters,k=0,n=p.length;k<n;k++)a=p[k],a.addTags.apply(a,d);for(q=h.characters,l=0,o=q.length;l<o;l++)a=q[l],e.characters.push(a)}return e},a.prototype.contains=function(a){var b,c,d,e,f,g,h;if("string"==typeof a)return this.text().indexOf(a)>-1;for(d=0;d<=this.length()-a.length();){for(c=!0,h=a.characters,e=f=0,g=h.length;f<g;e=++f)if(b=h[e],!b.eq(this.characters[e+d])){c=!1;break}if(c)return!0;d++}return!1},a.prototype.endsWith=function(a){var b,c,d,e,f,g;if("string"==typeof a)return""===a||this.text().slice(-a.length)===a;for(c=this.characters.slice().reverse(),g=a.characters.slice().reverse(),d=e=0,f=g.length;e<f;d=++e)if(b=g[d],!b.eq(c[d]))return!1;return!0},a.prototype.format=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?A.call(arguments,2):[],f<0&&(f=this.length()+f+1),b<0&&(b=this.length()+b),d=this.copy(),c=g=b;b<=f?g<f:g>f;c=b<=f?++g:--g)a=d.characters[c],a.addTags.apply(a,e);return d},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h;for(d=2<=arguments.length?A.call(arguments,0,e=arguments.length-1):(e=0,[]),c=arguments[e++],void 0!==c&&"boolean"!=typeof c&&(d.push(c),c=!1),b=!1,h=this.characters,f=0,g=h.length;f<g;f++)if(a=h[f],a.hasTags.apply(a,d))b=!0;else if(c)return!1;return b},a.prototype.html=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;for(e="",h=[],f=[],c=[],t=this.characters,j=0,n=t.length;j<n;j++){for(a=t[j],c=[],u=h.slice().reverse(),k=0,o=u.length;k<o;k++)if(g=u[k],c.push(g),!a.hasTags(g)){for(l=0,p=c.length;l<p;l++)b=c[l],e+=b.tail(),h.pop(),f.pop();c=[]}for(v=a._tags,m=0,q=v.length;m<q;m++)i=v[m],-1===f.indexOf(i.head())&&(i.selfClosing()||(d=i.head(),e+=d,h.push(i),f.push(d)));a._tags.length>0&&a._tags[0].selfClosing()&&(e+=a._tags[0].head()),e+=a.c()}for(w=h.reverse(),s=0,r=w.length;s<r;s++)i=w[s],e+=i.tail();return e},a.prototype.indexOf=function(a,b){var c,d,e,f,g,h;if(null==b&&(b=0),b<0&&(b=0),"string"==typeof a)return this.text().indexOf(a,b);for(;b<=this.length()-a.length();){for(d=!0,h=a.characters,e=f=0,g=h.length;f<g;e=++f)if(c=h[e],!c.eq(this.characters[e+b])){d=!1;break}if(d)return b;b++}return-1},a.prototype.insert=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t;if(null==c&&(c=!0),e=this.slice(0,a),j=this.slice(a),a<0&&(a=this.length()+a),h=b,"string"==typeof b&&(h=new r.String(b,this._preserveWhitespace)),c&&a>0)for(f=this.charAt(a-1),g=f.tags(),f.isTag()&&g.shift(),"string"!=typeof b&&(h=h.copy()),q=h.characters,k=0,n=q.length;k<n;k++)d=q[k],d.addTags.apply(d,g);for(i=e,s=h.characters,l=0,o=s.length;l<o;l++)d=s[l],i.characters.push(d);for(t=j.characters,m=0,p=t.length;m<p;m++)d=t[m],i.characters.push(d);return i},a.prototype.lastIndexOf=function(a,b){var c,d,e,f,g,h,i,j,k;if(null==b&&(b=0),b<0&&(b=0),d=this.characters.slice(b).reverse(),b=0,"string"==typeof a){if(!this.contains(a))return-1;for(a=a.split("").reverse();b<=d.length-a.length;){for(e=!0,g=0,f=h=0,j=a.length;h<j;f=++h)if(c=a[f],d[f+b].isTag()&&(g+=1),c!==d[g+f+b].c()){e=!1;break}if(e)return b;b++}return-1}for(a=a.characters.slice().reverse();b<=d.length-a.length;){for(e=!0,f=i=0,k=a.length;i<k;f=++i)if(c=a[f],!c.eq(d[f+b])){e=!1;break}if(e)return b;b++}return-1},a.prototype.optimize=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I;for(h=[],f=[],d=null,C=this.characters.slice().reverse(),o=0,s=C.length;o<s;o++){for(a=C[o],a._runLengthMap={},a._runLengthMapSize=0,b=[],D=h.slice().reverse(),p=0,t=D.length;p<t;p++)if(g=D[p],b.push(g),!a.hasTags(g)){for(q=0,u=b.length;q<u;q++)b[q],h.pop(),f.pop();b=[]}for(E=a._tags,r=0,v=E.length;r<v;r++)n=E[r],-1===f.indexOf(n.head())&&(n.selfClosing()||(h.push(n),f.push(n.head())));for(z=0,w=h.length;z<w;z++)n=h[z],c=n.head(),d?(a._runLengthMap[c]||(a._runLengthMap[c]=[n,0]),l=0,d._runLengthMap[c]&&(l=d._runLengthMap[c][1]),a._runLengthMap[c][1]=l+1):a._runLengthMap[c]=[n,1];d=a}for(j=function(a,b){return b[1]-a[1]},F=this.characters,I=[],A=0,x=F.length;A<x;A++)if(a=F[A],!((e=a._tags.length)>0&&a._tags[0].selfClosing()&&e<3||e<2)){k=[],G=a._runLengthMap;for(n in G)i=G[n],k.push(i);for(k.sort(j),H=a._tags.slice(),B=0,y=H.length;B<y;B++)n=H[B],n.selfClosing()||a.removeTags(n);I.push(a.addTags.apply(a,function(){var a,b,c;for(c=[],b=0,a=k.length;b<a;b++)m=k[b],c.push(m[0]);return c}()))}return I},a.prototype.slice=function(a,b){var c,d;return d=new r.String("",this._preserveWhitespace),d.characters=function(){var d,e,f,g;for(f=this.characters.slice(a,b),g=[],d=0,e=f.length;d<e;d++)c=f[d],g.push(c.copy());return g}.call(this),d},a.prototype.split=function(a,b){var c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=""),null==b&&(b=0),h=0,c=0,g=[0];;){if(b>0&&c>b)break;if(-1===(f=this.indexOf(a,h)))break;g.push(f),h=f+1}for(g.push(this.length()),j=[],e=k=0,l=g.length-2;0<=l?k<=l:k>=l;e=0<=l?++k:--k)i=g[e],e>0&&(i+=1),d=g[e+1],j.push(this.slice(i,d));return j},a.prototype.startsWith=function(a){var b,c,d,e,f;if("string"==typeof a)return this.text().slice(0,a.length)===a;for(f=a.characters,c=d=0,e=f.length;d<e;c=++d)if(b=f[c],!b.eq(this.characters[c]))return!1;return!0},a.prototype.substr=function(a,b){return b<=0?new r.String("",this._preserveWhitespace):(a<0&&(a=this.length()+a),void 0===b&&(b=this.length()-a),this.slice(a,a+b))},a.prototype.substring=function(a,b){return void 0===b&&(b=this.length()),this.slice(a,b)},a.prototype.text=function(){var a,b,c,d,e;for(b="",e=this.characters,c=0,d=e.length;c<d;c++)a=e[c],a.isTag()?a.isTag("br")&&(b+="\n"):(a.c(),b+=a.c());return this.constructor.decode(b)},a.prototype.toLowerCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;c<d;c++)a=e[c],1===a._c.length&&(a._c=a._c.toLowerCase());return b},a.prototype.toUpperCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;c<d;c++)a=e[c],1===a._c.length&&(a._c=a._c.toUpperCase());return b},a.prototype.trim=function(){var a,b,c,d,e,f,g,h,i,j;for(i=this.characters,b=e=0,g=i.length;e<g&&(a=i[b],a.isWhitespace());b=++e);for(j=this.characters.slice().reverse(),d=f=0,h=j.length;f<h&&(a=j[d],a.isWhitespace());d=++f);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimLeft=function(){var a,b,c,d,e,f,g;for(d=this.length()-1,g=this.characters,b=e=0,f=g.length;e<f&&(a=g[b],a.isWhitespace());b=++e);return c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimRight=function(){var a,b,c,d,e,f,g;for(b=0,g=this.characters.slice().reverse(),d=e=0,f=g.length;e<f&&(a=g[d],a.isWhitespace());d=++e);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.unformat=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?A.call(arguments,2):[],f<0&&(f=this.length()+f+1),b<0&&(b=this.length()+b),d=this.copy(),c=g=b;b<=f?g<f:g>f;c=b<=f?++g:--g)a=d.characters[c],a.removeTags.apply(a,e);return d},a.prototype.copy=function(){var a,b;return b=new r.String("",this._preserveWhitespace),b.characters=function(){var b,c,d,e;for(d=this.characters,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this),b},a.decode=function(a){var b;return b=document.createElement("textarea"),b.innerHTML=a,b.textContent},a.encode=function(a){var b;return b=document.createElement("textarea"),b.textContent=a,b.innerHTML},a.join=function(a,b){var c,d,e,f;for(c=b.shift(),e=0,f=b.length;e<f;e++)d=b[e],c=c.concat(a,d);return c},a}(),a="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$".split(""),b=a.concat("1234567890".split("")),h=b.concat([":"]),q=b.concat(["#"]),u=b.concat([":"]),n=1,p=2,t=3,s=4,o=5,x=6,v=7,y=8,w=9,j=10,g=11,i=12,c=13,m=14,k=15,l=16,e=17,f=18,d=19,z=function(){function z(){this.fsm=new FSM.Machine(this),this.fsm.setInitialState(n),this.fsm.addTransitionAny(n,null,function(a){return this._pushChar(a)}),this.fsm.addTransition("<",n,t),this.fsm.addTransition("&",n,p),this.fsm.addTransitions(q,p,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",p,n,function(){return this._pushChar("&"+this.entity+";"),this.entity=""}),this.fsm.addTransitions([" ","\n"],t),this.fsm.addTransitions(a,t,s,function(){return this._back()}),this.fsm.addTransition("/",t,o),this.fsm.addTransitions([" ","\n"],s),this.fsm.addTransitions(a,s,x,function(){return this._back()}),this.fsm.addTransitions([" ","\n"],o),this.fsm.addTransitions(a,o,v,function(){return this._back()}),this.fsm.addTransitions(u,x,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],x,j),this.fsm.addTransition("/",x,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",x,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],y),this.fsm.addTransition(">",y,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],j),this.fsm.addTransition("/",j,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",j,n,function(){return this._pushTag()}),this.fsm.addTransitions(a,j,g,function(){return this._back()}),this.fsm.addTransitions(u,v,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],v,w),this.fsm.addTransition(">",v,n,function(){return this._popTag()}),this.fsm.addTransitions([" ","\n"],w),this.fsm.addTransition(">",w,n,function(){return this._popTag()}),this.fsm.addTransitions(h,g,null,function(a){return this.attributeName+=a}),this.fsm.addTransitions([" ","\n"],g,i),this.fsm.addTransition("=",g,c),this.fsm.addTransitions([" ","\n"],i),this.fsm.addTransition("=",i,c),this.fsm.addTransitions(">",g,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(i,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ","\n"],c),this.fsm.addTransition("'",c,m),this.fsm.addTransition('"',c,k),this.fsm.addTransitions(b.concat(["&"],c,l,function(){return this._back()})),this.fsm.addTransition(" ",l,j,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],l,j,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",l,e),this.fsm.addTransitionAny(l,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition("'",m,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",m,f),this.fsm.addTransitionAny(m,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition('"',k,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",k,d),this.fsm.addTransitionAny(k,null,function(a){return this.attributeValue+=a}),this.fsm.addTransitions(q,e,null,function(a){return this.entity+=a}),this.fsm.addTransitions(q,f,function(a){return this.entity+=a}),this.fsm.addTransitions(q,d,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",e,l,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",f,m,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",d,k,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return z.prototype._back=function(){return this.head--},z.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},z.prototype._pushChar=function(a){var b,c;return b=new r.Character(a,this.tags),this._preserveWhitespace?void this.string.characters.push(b):!this.string.length()||b.isTag()||b.isEntity()||!b.isWhitespace()||(c=this.string.characters[this.string.length()-1],!c.isWhitespace()||c.isTag()||c.isEntity())?this.string.characters.push(b):void 0},z.prototype._pushTag=function(){var a,b;return a=new r.Tag(this.tagName,this.attributes),this.tags.push(a),a.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(b=this.tagName,B.call(r.Tag.SELF_CLOSING,b)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},z.prototype._popTag=function(){for(var a,b;;)if(b=this.tags.pop(),this.string.length()&&(a=this.string.characters[this.string.length()-1],a.isTag()||a.isEntity()||!a.isWhitespace()||a.removeTags(b)),b.name()===this.tagName.toLowerCase())break;return this.tagName=""},z.prototype.parse=function(a,b){var c,d;for(this._preserveWhitespace=b,this.reset(),a=this.preprocess(a),this.fsm.parser=this;this.head<a.length;){c=a[this.head];try{this.fsm.process(c)}catch(a){throw d=a,new Error("Error at char "+this.head+" >> "+d)}this.head++}return this.string},z.prototype.preprocess=function(a){return a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),a=a.replace(/<!--[\s\S]*?-->/g,""),this._preserveWhitespace||(a=a.replace(/\s+/g," ")),a},z.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new r.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},z}(),r.Tag=function(){function a(a,b){var c,d;this._name=a.toLowerCase(),this._selfClosing=!0===r.Tag.SELF_CLOSING[this._name],this._head=null,this._attributes={};for(c in b)d=b[c],this._attributes[c]=d}return a.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},a.prototype.head=function(){var a,b,c,d;if(!this._head){a=[],d=this._attributes;for(b in d)c=d[b],c?a.push(b+'="'+c+'"'):a.push(""+b);a.sort(),a.unshift(this._name),this._head="<"+a.join(" ")+">"}return this._head},a.prototype.name=function(){return this._name},a.prototype.selfClosing=function(){return this._selfClosing},a.prototype.tail=function(){return this._selfClosing?"":"</"+this._name+">"},a.prototype.attr=function(a,b){return void 0===b?this._attributes[a]:(this._attributes[a]=b,this._head=null)},a.prototype.removeAttr=function(a){if(void 0!==this._attributes[a])return delete this._attributes[a],this._head=null},a.prototype.copy=function(){return new r.Tag(this._name,this._attributes)},a}(),r.Character=function(){function a(a,b){this._c=a,a.length>1&&(this._c=a.toLowerCase()),this._tags=[],this.addTags.apply(this,b)}return a.prototype.c=function(){return this._c},a.prototype.isEntity=function(){return this._c.length>1},a.prototype.isTag=function(a){return!(0===this._tags.length||!this._tags[0].selfClosing())&&(!a||this._tags[0].name()===a)},a.prototype.isWhitespace=function(){var a;return" "===(a=this._c)||"\n"===a||"&nbsp;"===a||this.isTag("br")},a.prototype.tags=function(){var a;return function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this)},a.prototype.addTags=function(){var a,b,c,d,e;for(b=1<=arguments.length?A.call(arguments,0):[],e=[],c=0,d=b.length;c<d;c++)a=b[c],Array.isArray(a)||(a.selfClosing()?this.isTag()||this._tags.unshift(a.copy()):e.push(this._tags.push(a.copy())));return e},a.prototype.eq=function(a){var b,c,d,e,f,g,h,i;if(this.c()!==a.c())return!1;if(this._tags.length!==a._tags.length)return!1;for(c={},h=this._tags,d=0,f=h.length;d<f;d++)b=h[d],c[b.head()]=!0;for(i=a._tags,e=0,g=i.length;e<g;e++)if(b=i[e],!c[b.head()])return!1;return!0},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h,i;for(d=1<=arguments.length?A.call(arguments,0):[],c={},b={},i=this._tags,e=0,g=i.length;e<g;e++)a=i[e],c[a.name()]=!0,b[a.head()]=!0;for(f=0,h=d.length;f<h;f++)if("string"==typeof(a=d[f])){if(void 0===c[a])return!1}else if(void 0===b[a.head()])return!1;return!0},a.prototype.removeTags=function(){var a,b,c,d,e,f;if(d=1<=arguments.length?A.call(arguments,0):[],0===d.length)return void(this._tags=[]);for(b={},a={},e=0,f=d.length;e<f;e++)c=d[e],"string"==typeof c?b[c]=c:a[c.head()]=c;return[],this._tags=this._tags.filter(function(c){if(!a[c.head()]&&!b[c.name()])return c})},a.prototype.copy=function(){var a;return new r.Character(this._c,function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this))},a}()}.call(this),function(){var a,b,c,d,e,f,g=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};a={},a.Range=function(){function g(a,b){this.set(a,b)}return g.prototype.isCollapsed=function(){return this._from===this._to},g.prototype.span=function(){return this._to-this._from},g.prototype.collapse=function(){return this._to=this._from},g.prototype.eq=function(a){return this.get()[0]===a.get()[0]&&this.get()[1]===a.get()[1]},g.prototype.get=function(){return[this._from,this._to]},g.prototype.select=function(b){var c,e,f,g,h,i,j,k,l;return a.Range.unselectAll(),c=document.createRange(),k=d(b,this._from),h=k[0],j=k[1],l=d(b,this._to),e=l[0],g=l[1],i=h.length||0,f=e.length||0,c.setStart(h,Math.min(j,i)),c.setEnd(e,Math.min(g,f)),window.getSelection().addRange(c)},g.prototype.set=function(a,b){return a=Math.max(0,a),b=Math.max(0,b),this._from=Math.min(a,b),this._to=Math.max(a,b)},g.prepareElement=function(a){var c,d,e,f,g,h;for(e=a.querySelectorAll(b.join(", ")),h=[],c=f=0,g=e.length;f<g;c=++f)d=e[c],d.parentNode.insertBefore(document.createTextNode(""),d),c<e.length-1?h.push(d.parentNode.insertBefore(document.createTextNode(""),d.nextSibling)):h.push(void 0);return h},g.query=function(b){var d,g,h,i,j,k,l;i=new a.Range(0,0);try{d=window.getSelection().getRangeAt(0)}catch(a){return i}return null===b.firstChild&&null===b.lastChild?i:c(d.startContainer,b)&&c(d.endContainer,b)?(l=e(b,d),j=l[0],k=l[1],g=l[2],h=l[3],i.set(f(b,j)+k,f(b,g)+h),i):i},g.rect=function(){var a,b,c;try{a=window.getSelection().getRangeAt(0)}catch(a){return null}return a.collapsed?(b=document.createElement("span"),a.insertNode(b),c=b.getBoundingClientRect(),b.parentNode.removeChild(b),c):a.getBoundingClientRect()},g.unselectAll=function(){if(window.getSelection())return window.getSelection().removeAllRanges()},g}(),b=["br","img","input"],c=function(a,b){for(;a;){if(a===b)return!0;a=a.parentNode}return!1},d=function(a,c){var d,e,f,h,i;if(0===a.childNodes.length)return[a,c];for(d=null,e=c,f=function(){var b,c,d,e;for(d=a.childNodes,e=[],b=0,c=d.length;b<c;b++)h=d[b],e.push(h);return e}();f.length>0;)switch(d=f.shift(),d.nodeType){case Node.TEXT_NODE:if(d.textContent.length>=e)return[d,e];e-=d.textContent.length;break;case Node.ELEMENT_NODE:if(i=d.nodeName.toLowerCase(),g.call(b,i)>=0){if(0===e)return[d,0];e=Math.max(0,e-1)}else d.childNodes&&Array.prototype.unshift.apply(f,function(){var a,b,c,e;for(c=d.childNodes,e=[],a=0,b=c.length;a<b;a++)h=c[a],e.push(h);return e}())}return[d,e]},f=function(a,c){var d,e,f,h,i,j;if(0===a.childNodes.length)return 0;for(f=0,d=function(){var b,c,d,f;for(d=a.childNodes,f=[],b=0,c=d.length;b<c;b++)e=d[b],f.push(e);return f}();d.length>0;){if((h=d.shift())===c)return i=h.nodeName.toLowerCase(),g.call(b,i)>=0?f+1:f;switch(h.nodeType){case Node.TEXT_NODE:f+=h.textContent.length;break;case Node.ELEMENT_NODE:j=h.nodeName.toLowerCase(),g.call(b,j)>=0?f+=1:h.childNodes&&Array.prototype.unshift.apply(d,function(){var a,b,c,d;for(c=h.childNodes,d=[],a=0,b=c.length;a<b;a++)e=c[a],d.push(e);return d}())}}return f},e=function(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,q,r;if(e=a.childNodes,m=c.cloneRange(),m.collapse(!0),i=c.cloneRange(),i.collapse(!1),k=m.startContainer,l=m.startOffset,f=i.endContainer,h=i.endOffset,!m.comparePoint)return[k,l,f,h];if(k===a)for(k=e[e.length-1],l=k.textContent.length,j=n=0,p=e.length;n<p;j=++n)if(d=e[j],1===m.comparePoint(d,0)){0===j?(k=d,l=0):(k=e[j-1],l=d.textContent.length),r=k.nodeName.toLowerCase,g.call(b,r)>=0&&(l=1);break}if(c.collapsed)return[k,l,k,l];if(f===a)for(f=e[e.length-1],h=f.textContent.length,j=o=0,q=e.length;o<q;j=++o)d=e[j],1===i.comparePoint(d,0)&&(f=0===j?d:e[j-1],h=d.textContent.length+1);return[k,l,f,h]},"undefined"!=typeof window&&(window.ContentSelect=a),"undefined"!=typeof module&&module.exports&&(module.exports=a)}.call(this),function(){var a,b,c,d,e=[].slice,f=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=function(a,b){return function(){return a.apply(b,arguments)}};a={ALIGNMENT_CLASS_NAMES:{left:"align-left",right:"align-right"},DEFAULT_MAX_ELEMENT_WIDTH:2e3,DEFAULT_MIN_ELEMENT_WIDTH:80,DRAG_HOLD_DURATION:500,DROP_EDGE_SIZE:50,HELPER_CHAR_LIMIT:250,INDENT:"    ",LANGUAGE:"en",LINE_ENDINGS:"\n",PREFER_LINE_BREAKS:!1,RESIZE_CORNER_SIZE:15,TRIM_WHITESPACE:!0,_translations:{},_:function(b){var c;return c=a.LANGUAGE,a._translations[c]&&a._translations[c][b]?a._translations[c][b]:b},addTranslations:function(b,c){return a._translations[b]=c},addCSSClass:function(a,b){var c,d,e;return a.classList?void a.classList.add(b):(d=a.getAttribute("class"),d?(e=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;a<b;a++)c=e[a],f.push(c);return f}(),-1===e.indexOf(b)?a.setAttribute("class",d+" "+b):void 0):a.setAttribute("class",b))},attributesToString:function(a){var b,c,d,e,f,g;if(!a)return"";for(d=function(){var b;b=[];for(c in a)b.push(c);return b}(),d.sort(),b=[],f=0,g=d.length;f<g;f++)c=d[f],e=a[c],""===e?b.push(c):(e=HTMLString.String.encode(e),e=e.replace(/"/g,"&quot;"),b.push(c+'="'+e+'"'));return b.join(" ")},removeCSSClass:function(a,b){var c,d,e,f;return a.classList?(a.classList.remove(b),void(0===a.classList.length&&a.removeAttribute("class"))):(d=a.getAttribute("class"),d&&(f=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;a<b;a++)c=e[a],f.push(c);return f}(),(e=f.indexOf(b))>-1)?(f.splice(e,1),f.length?a.setAttribute("class",f.join(" ")):a.removeAttribute("class")):void 0)}},"undefined"!=typeof window&&(window.ContentEdit=a),"undefined"!=typeof module&&module.exports&&(module.exports=a),c=function(){function b(){this._tagNames={}}return b.prototype.register=function(){var a,b,c,d,f,g;for(a=arguments[0],c=2<=arguments.length?e.call(arguments,1):[],g=[],d=0,f=c.length;d<f;d++)b=c[d],g.push(this._tagNames[b.toLowerCase()]=a);return g},b.prototype.match=function(b){return b=b.toLowerCase(),this._tagNames[b]?this._tagNames[b]:a.Static},b}(),a.TagNames=function(){function a(){}var b;return b=null,a.get=function(){return null!=b?b:b=new c},a}(),a.Node=function(){function b(){this._bindings={},this._parent=null,this._modified=null}return b.prototype.lastModified=function(){return this._modified},b.prototype.parent=function(){return this._parent},b.prototype.parents=function(){var a,b;for(b=[],a=this._parent;a;)b.push(a),a=a._parent;return b},b.prototype.type=function(){return"Node"},b.prototype.html=function(a){throw null==a&&(a=""),new Error("`html` not implemented")},b.prototype.bind=function(a,b){return void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b),b},b.prototype.trigger=function(){var a,b,c,d,f,g,h;if(c=arguments[0],a=2<=arguments.length?e.call(arguments,1):[],this._bindings[c]){for(g=this._bindings[c],h=[],d=0,f=g.length;d<f;d++)(b=g[d])&&h.push(b.call.apply(b,[this].concat(e.call(a))));return h}},b.prototype.unbind=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;e<f;c=++e)d=g[c],d===b?h.push(this._bindings[a].splice(c,1)):h.push(void 0);return h}},b.prototype.commit=function(){return this._modified=null,a.Root.get().trigger("commit",this)},b.prototype.taint=function(){var b,c,d,e,f,g;for(b=Date.now(),this._modified=b,g=this.parents(),e=0,f=g.length;e<f;e++)c=g[e],c._modified=b;return d=a.Root.get(),d._modified=b,d.trigger("taint",this)},b.prototype.closest=function(a){var b;for(b=this.parent();b&&!a(b);)b=b.parent?b.parent():null;return b},b.prototype.next=function(){var a,b,c,d,e,f;if(this.children&&this.children.length>0)return this.children[0];for(f=[this].concat(this.parents()),d=0,e=f.length;d<e;d++){if(c=f[d],!c.parent())return null;if(a=c.parent().children,(b=a.indexOf(c))<a.length-1)return a[b+1]}},b.prototype.nextContent=function(){return this.nextWithTest(function(a){return void 0!==a.content})},b.prototype.nextSibling=function(){var a;return a=this.parent().children.indexOf(this),a===this.parent().children.length-1?null:this.parent().children[a+1]},b.prototype.nextWithTest=function(a){var b;for(b=this;b;)if((b=b.next())&&a(b))return b},b.prototype.previous=function(){var a,b;if(!this.parent())return null;if(a=this.parent().children,a[0]===this)return this.parent();for(b=a[a.indexOf(this)-1];b.children&&b.children.length;)b=b.children[b.children.length-1];return b},b.prototype.previousContent=function(){return this.previousWithTest(function(a){return void 0!==a.content})},b.prototype.previousSibling=function(){var a;return a=this.parent().children.indexOf(this),0===a?null:this.parent().children[a-1]},b.prototype.previousWithTest=function(a){var b;for(b=this;b;)if((b=b.previous())&&a(b))return b},b.extend=function(a){var b,c,d;d=a.prototype;for(b in d)c=d[b],"constructor"!==b&&(this.prototype[b]=c);for(b in a)c=a[b],f.call("__super__",b)>=0||(this.prototype[b]=c);return this},b.fromDOMElement=function(a){throw new Error("`fromDOMElement` not implemented")},b}(),a.NodeCollection=function(b){function c(){c.__super__.constructor.call(this),this.children=[]}return h(c,b),c.prototype.descendants=function(){var a,b,c;for(a=[],c=this.children.slice();c.length>0;)b=c.shift(),a.push(b),b.children&&b.children.length>0&&(c=b.children.slice().concat(c));return a},c.prototype.isMounted=function(){return!1},c.prototype.type=function(){return"NodeCollection"},c.prototype.attach=function(b,c){return b.parent()&&b.parent().detach(b),b._parent=this,void 0!==c?this.children.splice(c,0,b):this.children.push(b),b.mount&&this.isMounted()&&b.mount(),this.taint(),a.Root.get().trigger("attach",this,b)},c.prototype.commit=function(){var b,c,d,e;for(e=this.descendants(),c=0,d=e.length;c<d;c++)b=e[c],b._modified=null;return this._modified=null,a.Root.get().trigger("commit",this)},c.prototype.detach=function(b){var c;if(-1!==(c=this.children.indexOf(b)))return b.unmount&&this.isMounted()&&b.isMounted()&&b.unmount(),this.children.splice(c,1),b._parent=null,this.taint(),a.Root.get().trigger("detach",this,b)},c}(a.Node),a.Element=function(b){function c(a,b){c.__super__.constructor.call(this),this._tagName=a.toLowerCase(),this._attributes=b||{},this._domElement=null,this._behaviours={drag:!0,drop:!0,merge:!0,remove:!0,resize:!0,spawn:!0}}return h(c,b),c.prototype.attributes=function(){var a,b,c,d;a={},d=this._attributes;for(b in d)c=d[b],a[b]=c;return a},c.prototype.cssTypeName=function(){return"element"},c.prototype.domElement=function(){return this._domElement},c.prototype.isFixed=function(){return this.parent()&&"Fixture"===this.parent().type()},c.prototype.isGallery=function(){return this.parent()&&-1!==this.parent().domElement().className.indexOf("gallery")},c.prototype.isFocused=function(){return a.Root.get().focused()===this},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"Element"},c.prototype.typeName=function(){return"Element"},c.prototype.addCSSClass=function(a){var b;if(b=!1,this.hasCSSClass(a)||(b=!0,this.attr("class")?this.attr("class",this.attr("class")+" "+a):this.attr("class",a)),this._addCSSClass(a),b)return this.taint()},c.prototype.attr=function(a,b){return a=a.toLowerCase(),void 0===b?this._attributes[a]:(this._attributes[a]=b,this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.setAttribute(a,b),this.taint())},c.prototype.blur=function(){var b;if(b=a.Root.get(),this.isFocused())return this._removeCSSClass("ce-element--focused"),b._focused=null,b.trigger("blur",this)},c.prototype.can=function(a,b){return void 0===b?!this.isFixed()&&this._behaviours[a]:this._behaviours[a]=b},c.prototype.createDraggingDOMElement=function(){var b;if(this.isMounted())return b=document.createElement("div"),b.setAttribute("class","ce-drag-helper ce-drag-helper--type-"+this.cssTypeName()),b.setAttribute("data-ce-type",a._(this.typeName())),b},c.prototype.drag=function(b,c){var d;if(this.isMounted()&&this.can("drag"))return d=a.Root.get(),d.startDragging(this,b,c),d.trigger("drag",this)},c.prototype.drop=function(b,c){var d;if(this.can("drop")){if(d=a.Root.get(),b){if(b._removeCSSClass("ce-element--drop"),b._removeCSSClass("ce-element--drop-"+c[0]),b._removeCSSClass("ce-element--drop-"+c[1]),this.constructor.droppers[b.type()])return this.constructor.droppers[b.type()](this,b,c),void d.trigger("drop",this,b,c);if(b.constructor.droppers[this.type()])return b.constructor.droppers[this.type()](this,b,c),void d.trigger("drop",this,b,c)}return d.trigger("drop",this,null,null)}},c.prototype.focus=function(b){var c;if(c=a.Root.get(),!this.isFocused())return c.focused()&&c.focused().blur(),
this._addCSSClass("ce-element--focused"),c._focused=this,this.isMounted()&&!b&&this.domElement().focus(),c.trigger("focus",this)},c.prototype.hasCSSClass=function(a){var b,c;return!!(this.attr("class")&&(c=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}.call(this),c.indexOf(a)>-1))},c.prototype.merge=function(a){return!(!this.can("merge")||!this.can("remove"))&&(this.constructor.mergers[a.type()]?this.constructor.mergers[a.type()](a,this):a.constructor.mergers[this.type()]?a.constructor.mergers[this.type()](a,this):void 0)},c.prototype.mount=function(){var b;return this._domElement||(this._domElement=document.createElement(this.tagName())),b=this.nextSibling(),b?this.parent().domElement().insertBefore(this._domElement,b.domElement()):this.isFixed()?(this.parent().domElement().parentNode.replaceChild(this._domElement,this.parent().domElement()),this.parent()._domElement=this._domElement):this.parent().domElement().appendChild(this._domElement),this._addDOMEventListeners(),this._addCSSClass("ce-element"),this._addCSSClass("ce-element--type-"+this.cssTypeName()),this.isFocused()&&this._addCSSClass("ce-element--focused"),a.Root.get().trigger("mount",this)},c.prototype.removeAttr=function(a){if(a=a.toLowerCase(),this._attributes[a])return delete this._attributes[a],this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.removeAttribute(a),this.taint()},c.prototype.removeCSSClass=function(a){var b,c,d;if(this.hasCSSClass(a))return d=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}.call(this),c=d.indexOf(a),c>-1&&d.splice(c,1),d.length?this.attr("class",d.join(" ")):this.removeAttr("class"),this._removeCSSClass(a),this.taint()},c.prototype.tagName=function(a){return void 0===a?this._tagName:(this._tagName=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){return this._removeDOMEventListeners(),this.isFixed()?(this._removeCSSClass("ce-element"),this._removeCSSClass("ce-element--type-"+this.cssTypeName()),void this._removeCSSClass("ce-element--focused")):(this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,a.Root.get().trigger("unmount",this))},c.prototype._addDOMEventListeners=function(){var a,b,c,d;this._domEventHandlers={dragstart:function(a){return function(a){return a.preventDefault()}}(),focus:function(a){return function(a){return a.preventDefault()}}(),keydown:function(a){return function(b){return a._onKeyDown(b)}}(this),keyup:function(a){return function(b){return a._onKeyUp(b)}}(this),mousedown:function(a){return function(b){if(0===b.button)return a._onMouseDown(b)}}(this),mousemove:function(a){return function(b){return a._onMouseMove(b)}}(this),mouseover:function(a){return function(b){return a._onMouseOver(b)}}(this),mouseout:function(a){return function(b){return a._onMouseOut(b)}}(this),mouseup:function(a){return function(b){if(0===b.button)return a._onMouseUp(b)}}(this),dragover:function(a){return function(a){return a.preventDefault()}}(),drop:function(a){return function(b){return a._onNativeDrop(b)}}(this),paste:function(a){return function(b){return a._onPaste(b)}}(this)},c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.addEventListener(b,a));return d},c.prototype._onKeyDown=function(a){},c.prototype._onKeyUp=function(a){},c.prototype._onMouseDown=function(a){if(this.focus)return this.focus(!0)},c.prototype._onMouseMove=function(a){return this._onOver(a)},c.prototype._onMouseOver=function(a){return this._onOver(a)},c.prototype._onMouseOut=function(b){var c;if(this._removeCSSClass("ce-element--over"),c=a.Root.get(),c.dragging())return this._removeCSSClass("ce-element--drop"),this._removeCSSClass("ce-element--drop-above"),this._removeCSSClass("ce-element--drop-below"),this._removeCSSClass("ce-element--drop-center"),this._removeCSSClass("ce-element--drop-left"),this._removeCSSClass("ce-element--drop-right"),c._dropTarget=null},c.prototype._onMouseUp=function(a){return this._ieMouseDownEchoed=!1},c.prototype._onNativeDrop=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("native-drop",this,b)},c.prototype._onPaste=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("paste",this,b)},c.prototype._onOver=function(b){var c,d;if(this._addCSSClass("ce-element--over"),d=a.Root.get(),(c=d.dragging())&&c!==this&&!d._dropTarget&&this.can("drop")&&(this.constructor.droppers[c.type()]||c.constructor.droppers[this.type()]))return this._addCSSClass("ce-element--drop"),d._dropTarget=this},c.prototype._removeDOMEventListeners=function(){var a,b,c,d;c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.removeEventListener(b,a));return d},c.prototype._addCSSClass=function(b){if(this.isMounted())return a.addCSSClass(this._domElement,b)},c.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+a.attributesToString(this._attributes):""},c.prototype._removeCSSClass=function(b){if(this.isMounted())return a.removeCSSClass(this._domElement,b)},c.droppers={},c.mergers={},c.placements=["above","below"],c.getDOMElementAttributes=function(a){var b,c,d,e,f;if(!a.hasAttributes())return{};for(c={},f=a.attributes,d=0,e=f.length;d<e;d++)b=f[d],c[b.name.toLowerCase()]=b.value;return c},c._dropVert=function(a,b,c){var d;return a.parent().detach(a),d=b.parent().children.indexOf(b),"below"===c[0]&&(d+=1),b.parent().attach(a,d)},c._dropBoth=function(b,c,d){var e,f,g,h,i,j,k,l;if(b.parent().detach(b),i=c.parent().children.indexOf(c),"below"===d[0]&&"center"===d[1]&&(i+=1),f=a.ALIGNMENT_CLASS_NAMES.left,g=a.ALIGNMENT_CLASS_NAMES.right,b.a){if(b._removeCSSClass(f),b._removeCSSClass(g),b.a.class){for(e=[],l=b.a.class.split(" "),j=0,k=l.length;j<k;j++)(h=l[j])!==f&&h!==g&&e.push(h);e.length?b.a.class=e.join(" "):delete b.a.class}}else b.removeCSSClass(f),b.removeCSSClass(g);return"left"===d[1]&&(b.a?(b.a.class?b.a.class+=" "+f:b.a.class=f,b._addCSSClass(f)):b.addCSSClass(f)),"right"===d[1]&&(b.a?(b.a.class?b.a.class+=" "+g:b.a.class=g,b._addCSSClass(g)):b.addCSSClass(g)),c.parent().attach(b,i)},c}(a.Node),a.ElementCollection=function(b){function c(b,d){c.__super__.constructor.call(this,b,d),a.NodeCollection.prototype.constructor.call(this)}return h(c,b),c.extend(a.NodeCollection),c.prototype.cssTypeName=function(){return"element-collection"},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"ElementCollection"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.detach=function(b){if(a.NodeCollection.prototype.detach.call(this,b),0===this.children.length&&this.parent())return this.parent().detach(this)},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),e=function(){var c,e,f,g;for(f=this.children,g=[],c=0,e=f.length;c<e;c++)d=f[c],g.push(d.html(b+a.INDENT));return g}.call(this),f=a.LINE_ENDINGS,this.isFixed()?e.join(f):(c=this._attributesToString(),b+"<"+this.tagName()+c+">"+f+e.join(f)+f+b+"</"+this.tagName()+">")},c.prototype.mount=function(){var a,b,d,e,f,g,h,i;this._domElement=document.createElement(this._tagName),g=this._attributes;for(b in g)d=g[b],this._domElement.setAttribute(b,d);for(c.__super__.mount.call(this),h=this.children,i=[],e=0,f=h.length;e<f;e++)a=h[e],i.push(a.mount());return i},c.prototype.unmount=function(){var a,b,d,e;for(e=this.children,b=0,d=e.length;b<d;b++)a=e[b],a.unmount();return c.__super__.unmount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c}(a.Element),a.ResizableElement=function(b){function c(a,b){c.__super__.constructor.call(this,a,b),this._domSizeInfoElement=null,this._aspectRatio=1}return h(c,b),c.prototype.aspectRatio=function(){return this._aspectRatio},c.prototype.maxSize=function(){var b;return b=parseInt(this.attr("data-ce-max-width")||0),b||(b=a.DEFAULT_MAX_ELEMENT_WIDTH),b=Math.max(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.minSize=function(){var b;return b=parseInt(this.attr("data-ce-min-width")||0),b||(b=a.DEFAULT_MIN_ELEMENT_WIDTH),b=Math.min(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.type=function(){return"ResizableElement"},c.prototype.mount=function(){return c.__super__.mount.call(this),this._domElement.setAttribute("data-ce-size",this._getSizeInfo())},c.prototype.resize=function(b,c,d){if(this.isMounted()&&this.can("resize"))return a.Root.get().startResizing(this,b,c,d,!0)},c.prototype.size=function(a){var b,c,d,e;return a?(a[0]=parseInt(a[0]),a[1]=parseInt(a[1]),d=this.minSize(),a[0]=Math.max(a[0],d[0]),a[1]=Math.max(a[1],d[1]),c=this.maxSize(),a[0]=Math.min(a[0],c[0]),a[1]=Math.min(a[1],c[1]),this.attr("width",parseInt(a[0])),this.attr("height",parseInt(a[1])),this.isMounted()?(this._domElement.style.width=a[0]+"px",this._domElement.style.height=a[1]+"px",this._domElement.setAttribute("data-ce-size",this._getSizeInfo())):void 0):(e=parseInt(this.attr("width")||1),b=parseInt(this.attr("height")||1),[e,b])},c.prototype._onMouseDown=function(a){var b;return c.__super__._onMouseDown.call(this,a),b=this._getResizeCorner(a.clientX,a.clientY),b?this.resize(b,a.clientX,a.clientY):(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150))},c.prototype._onMouseMove=function(a){var b;if(c.__super__._onMouseMove.call(this),this.can("resize"))return this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right"),b=this._getResizeCorner(a.clientX,a.clientY),b?this._addCSSClass("ce-element--resize-"+b[0]+"-"+b[1]):void 0},c.prototype._onMouseOut=function(a){return c.__super__._onMouseOut.call(this),this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.prototype._getResizeCorner=function(b,c){var d,e,f,g,h;return f=this._domElement.getBoundingClientRect(),h=[b-f.left,c-f.top],b=h[0],c=h[1],g=this.size(),e=a.RESIZE_CORNER_SIZE,e=Math.min(e,Math.max(parseInt(g[0]/4),1)),e=Math.min(e,Math.max(parseInt(g[1]/4),1)),d=null,b<e?c<e?d=["top","left"]:c>f.height-e&&(d=["bottom","left"]):b>f.width-e&&(c<e?d=["top","right"]:c>f.height-e&&(d=["bottom","right"])),d},c.prototype._getSizeInfo=function(){var a;return a=this.size(),"w "+a[0]+" × h "+a[1]},c}(a.Element),a.Region=function(b){function c(a){c.__super__.constructor.call(this),this._domElement=a,this.setContent(a)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Region"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c.prototype.setContent=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(h=b,void 0===b.childNodes&&(k=document.createElement("div"),k.innerHTML=b,h=k),p=this.children.slice(),l=0,n=p.length;l<n;l++)d=p[l],this.detach(d);for(j=a.TagNames.get(),f=function(){var a,b,d,e;for(d=h.childNodes,e=[],a=0,b=d.length;a<b;a++)c=d[a],e.push(c);return e}(),m=0,o=f.length;m<o;m++)e=f[m],1===e.nodeType&&(g=e.getAttribute("data-ce-tag")?j.match(e.getAttribute("data-ce-tag")):j.match(e.tagName),i=g.fromDOMElement(e),h.removeChild(e),i&&this.attach(i));return a.Root.get().trigger("ready",this)},c}(a.NodeCollection),a.Fixture=function(b){function c(b){var d,e,f;c.__super__.constructor.call(this),this._domElement=b,f=a.TagNames.get(),d=this._domElement.getAttribute("data-ce-tag")?f.match(this._domElement.getAttribute("data-ce-tag")):f.match(this._domElement.tagName),e=d.fromDOMElement(this._domElement),this.children=[e],e._parent=this,e.mount(),a.Root.get().trigger("ready",this)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Fixture"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c}(a.NodeCollection),b=function(b){function c(){this._onStopResizing=i(this._onStopResizing,this),this._onResize=i(this._onResize,this),this._onStopDragging=i(this._onStopDragging,this),this._onDrag=i(this._onDrag,this),c.__super__.constructor.call(this),this._focused=null,this._dragging=null,this._dropTarget=null,this._draggingDOMElement=null,this._resizing=null,this._resizingInit=null}return h(c,b),c.prototype.dragging=function(){return this._dragging},c.prototype.dropTarget=function(){return this._dropTarget},c.prototype.focused=function(){return this._focused},c.prototype.resizing=function(){return this._resizing},c.prototype.type=function(){return"Root"},c.prototype.cancelDragging=function(){if(this._dragging)return document.body.removeChild(this._draggingDOMElement),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._dragging._removeCSSClass("ce-element--dragging"),this._dragging=null,this._dropTarget=null,a.removeCSSClass(document.body,"ce--dragging")},c.prototype.startDragging=function(b,c,d){if(!this._dragging)return this._dragging=b,this._dragging._addCSSClass("ce-element--dragging"),this._draggingDOMElement=this._dragging.createDraggingDOMElement(),document.body.appendChild(this._draggingDOMElement),this._draggingDOMElement.style.left=c+"px",this._draggingDOMElement.style.top=d+"px",document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),a.addCSSClass(document.body,"ce--dragging")},c.prototype._getDropPlacement=function(b,c){var d,e,f,g;return this._dropTarget?(e=this._dropTarget.domElement().getBoundingClientRect(),g=[b-e.left,c-e.top],b=g[0],c=g[1],d="center",b<a.DROP_EDGE_SIZE?d="left":b>e.width-a.DROP_EDGE_SIZE&&(d="right"),f="above",c>e.height/2&&(f="below"),[f,d]):null},c.prototype._onDrag=function(a){var b,c,d;if(ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=a.pageX+"px",this._draggingDOMElement.style.top=a.pageY+"px",this._dropTarget&&(b=this._getDropPlacement(a.clientX,a.clientY),this._dropTarget._removeCSSClass("ce-element--drop-above"),this._dropTarget._removeCSSClass("ce-element--drop-below"),this._dropTarget._removeCSSClass("ce-element--drop-center"),this._dropTarget._removeCSSClass("ce-element--drop-left"),this._dropTarget._removeCSSClass("ce-element--drop-right"),c=b[0],f.call(this._dragging.constructor.placements,c)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+b[0]),d=b[1],f.call(this._dragging.constructor.placements,d)>=0))return this._dropTarget._addCSSClass("ce-element--drop-"+b[1])},c.prototype._onStopDragging=function(a){var b;return b=this._getDropPlacement(a.clientX,a.clientY),this._dragging.drop(this._dropTarget,b),this.cancelDragging()},c.prototype.startResizing=function(b,c,d,e,f){var g,h;if(!this._resizing)return this._resizing=b,this._resizingInit={corner:c,fixed:f,origin:[d,e],size:b.size()},this._resizing._addCSSClass("ce-element--resizing"),h=this._resizing.parent().domElement(),g=document.createElement("div"),g.setAttribute("class","ce-measure"),h.appendChild(g),this._resizingParentWidth=g.getBoundingClientRect().width,h.removeChild(g),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),a.addCSSClass(document.body,"ce--resizing")},c.prototype._onResize=function(a){var b,c,d,e;return ContentSelect.Range.unselectAll(),d=this._resizingInit.origin[0]-a.clientX,"right"===this._resizingInit.corner[1]&&(d=-d),c=this._resizingInit.size[0]+d,c=Math.min(c,this._resizingParentWidth),this._resizingInit.fixed?b=c*this._resizing.aspectRatio():(e=this._resizingInit.origin[1]-a.clientY,"bottom"===this._resizingInit.corner[0]&&(e=-e),b=this._resizingInit.size[1]+e),this._resizing.size([c,b])},c.prototype._onStopResizing=function(b){return document.removeEventListener("mousemove",this._onResize),document.removeEventListener("mouseup",this._onStopResizing),this._resizing._removeCSSClass("ce-element--resizing"),this._resizing=null,this._resizingInit=null,this._resizingParentWidth=null,a.removeCSSClass(document.body,"ce--resizing")},c}(a.Node),a.Root=function(){function a(){}var c;return c=null,a.get=function(){return null!=c?c:c=new b},a}(),a.Static=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._content=d}return h(c,b),c.prototype.cssTypeName=function(){return"static"},c.prototype.type=function(){return"Static"},c.prototype.typeName=function(){return"Static"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.html=function(a){return null==a&&(a=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?a+"<"+this._tagName+this._attributesToString()+">":a+"<"+this._tagName+this._attributesToString()+">"+this._content+a+"</"+this._tagName+">"},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this._domElement.innerHTML=this._content,c.__super__.mount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c.prototype._onMouseDown=function(a){if(c.__super__._onMouseDown.call(this,a),void 0!==this.attr("data-ce-moveable"))return clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this,a),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.droppers={Static:a.Element._dropVert},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Element),a.TagNames.get().register(a.Static,"static"),a.Text=function(b){function c(b,d,e){c.__super__.constructor.call(this,b,d),e instanceof HTMLString.String?this.content=e:a.TRIM_WHITESPACE?this.content=new HTMLString.String(e).trim():this.content=new HTMLString.String(e,!0)}return h(c,b),c.prototype.cssTypeName=function(){return"text"},c.prototype.type=function(){return"Text"},c.prototype.typeName=function(){return"Text"},c.prototype.blur=function(){return this.isMounted()&&this._syncContent(),this.content.isWhitespace()&&this.can("remove")?this.parent()&&this.parent().detach(this):this.isMounted()&&(document.documentMode||/Edge/.test(navigator.userAgent)||this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.__super__.blur.call(this)},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=HTMLString.String.encode(this._domElement.textContent),d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.drag=function(a,b){return this.storeState(),this._domElement.removeAttribute("contenteditable"),c.__super__.drag.call(this,a,b)},c.prototype.drop=function(a,b){return c.__super__.drop.call(this,a,b),this.restoreState()},c.prototype.focus=function(a){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),c.__super__.focus.call(this,a)},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(d=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),d.optimize(),this._lastCached=Date.now(),this._cached=d.html()),e=a.LINE_ENDINGS,c=this._attributesToString(),b+"<"+this._tagName+c+">"+e+b+a.INDENT+this._cached+e+b+"</"+this._tagName+">"},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this.updateInnerHTML(),c.__super__.mount.call(this)},c.prototype.restoreState=function(){if(this._savedSelection)return this.isMounted()&&this.isFocused()?(this._domElement.setAttribute("contenteditable",""),this._addCSSClass("ce-element--focused"),document.activeElement!==this.domElement()&&this.domElement().focus(),this._savedSelection.select(this._domElement),this._savedSelection=void 0):void(this._savedSelection=void 0)},c.prototype.selection=function(a){return void 0===a?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):a.select(this._domElement)},c.prototype.storeState=function(){if(this.isMounted()&&this.isFocused())return this._savedSelection=ContentSelect.Range.query(this._domElement)},c.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),c.__super__.unmount.call(this)},c.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._onKeyDown=function(a){switch(a.keyCode){case 40:return this._keyDown(a);case 37:return this._keyLeft(a);case 39:return this._keyRight(a);case 38:return this._keyUp(a);case 9:return this._keyTab(a);case 8:return this._keyBack(a);case 46:return this._keyDelete(a);case 13:return this._keyReturn(a)}},c.prototype._onKeyUp=function(a){return c.__super__._onKeyUp.call(this,a),this._syncContent()},c.prototype._onMouseDown=function(b){if(c.__super__._onMouseDown.call(this,b),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(a){return function(){return a.drag(b.pageX,b.pageY)}}(this),a.DRAG_HOLD_DURATION),0===this.content.length()&&a.Root.get().focused()===this)return b.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)},c.prototype._onMouseMove=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseMove.call(this,a)},c.prototype._onMouseOut=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseOut.call(this,a)},c.prototype._onMouseUp=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseUp.call(this,a)},c.prototype._keyBack=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),0===c.get()[0]&&c.isCollapsed())return a.preventDefault(),b=this.previousContent(),this._syncContent(),b?b.merge(this):void 0},c.prototype._keyDelete=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),this._atEnd(c)&&c.isCollapsed())return a.preventDefault(),b=this.nextContent(),b?this.merge(b):void 0},c.prototype._keyDown=function(a){return this._keyRight(a)},c.prototype._keyLeft=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),0===d.get()[0]&&d.isCollapsed())return b.preventDefault(),c=this.previousContent(),c?(c.focus(),d=new ContentSelect.Range(c.content.length(),c.content.length()),d.select(c.domElement())):a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;if(b.preventDefault(),!(this.content.isWhitespace()&&!b.shiftKey^a.PREFER_LINE_BREAKS)){if(f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),b.shiftKey^a.PREFER_LINE_BREAKS)return d=f.get()[0],e="<br>",this.content.length()===d&&(0!==this.content.length()&&this.content.characters[d-1].isTag("br")||(e="<br><br>")),this.content=this.content.insert(d,new HTMLString.String(e,!0),!0),this.updateInnerHTML(),d+=1,f=new ContentSelect.Range(d,d),f.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=h.trim(),this.updateInnerHTML(),c=new this.constructor("p",{},g.trim()),this.parent().attach(c,this.parent().children.indexOf(this)+1),h.length()?(c.focus(),f=new ContentSelect.Range(0,0),f.select(c.domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint()}},c.prototype._keyRight=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),this._atEnd(d)&&d.isCollapsed())return b.preventDefault(),c=this.nextContent(),c?(c.focus(),d=new ContentSelect.Range(0,0),d.select(c.domElement())):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyTab=function(b){if(b.preventDefault(),this.isFixed())return b.shiftKey?a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyUp=function(a){return this._keyLeft(a)},c.prototype._atEnd=function(a){return a.get()[0]>=this.content.length()},c.prototype._flagIfEmpty=function(){return 0===this.content.length()?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},c.prototype._syncContent=function(a){var b,c;return c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.droppers={Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={Text:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&b.updateInnerHTML(),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),a.parent()&&a.parent().detach(a),b.taint()}},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML.replace(/^\s+|\s+$/g,""))},c}(a.Element),a.TagNames.get().register(a.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),a.PreText=function(b){function c(b,c,d){d instanceof HTMLString.String?this.content=d:this.content=new HTMLString.String(d,!0),a.Element.call(this,b,c)}return h(c,b),c.TAB_INDENT="    ",c.prototype.cssTypeName=function(){return"pre-text"},c.prototype.type=function(){return"PreText"},c.prototype.typeName=function(){return"Preformatted"},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),c.__super__.blur.call(this)},c.prototype.html=function(a){var b;return null==a&&(a=""),(!this._lastCached||this._lastCached<this._modified)&&(b=this.content.copy(),b.optimize(),this._lastCached=Date.now(),this._cached=b.html()),a+"<"+this._tagName+this._attributesToString()+">"+this._cached+"</"+this._tagName+">"},c.prototype.updateInnerHTML=function(){var a;return a=this.content.html(),this._domElement.innerHTML=a,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._keyBack=function(a){var b;return b=ContentSelect.Range.query(this._domElement),b.get()[0]<=this.content.length()?c.__super__._keyBack.call(this,a):(b.set(this.content.length(),this.content.length()),b.select(this._domElement))},c.prototype._keyReturn=function(a){var b,c,d,e;return a.preventDefault(),c=ContentSelect.Range.query(this._domElement),b=c.get()[0]+1,0===c.get()[0]&&c.isCollapsed()?this.content=new HTMLString.String("\n",!0).concat(this.content):this._atEnd(c)&&c.isCollapsed()?this.content=this.content.concat(new HTMLString.String("\n",!0)):0===c.get()[0]&&c.get()[1]===this.content.length()?(this.content=new HTMLString.String("\n",!0),b=0):(e=this.content.substring(0,c.get()[0]),d=this.content.substring(c.get()[1]),this.content=e.concat(new HTMLString.String("\n",!0),d)),this.updateInnerHTML(),c.set(b,b),c.select(this._domElement),this.taint()},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(b.preventDefault(),c=this.content.length(),k=a.PreText.TAB_INDENT,j=k.length,o=this.content.split("\n"),p=this.selection().get(),p[0]=Math.min(p[0],c),p[1]=Math.min(p[1],c),e=0,s=-1,f=-1,h=v=0,z=o.length;v<z&&(m=o[h],n=m.length()+1,p[0]<e+n&&-1===s&&(s=h),p[1]<e+n&&-1===f&&(f=h),!(s>-1&&f>-1));h=++v)e+=n;if(s===f)j-=(p[0]-e)%j,i=new HTMLString.String(Array(j+1).join(" "),!0),u=o[s].substring(0,p[0]-e),t=o[s].substring(p[1]-e),o[s]=u.concat(i,t),r=j;else if(b.shiftKey){for(g=0,h=w=s;s<=f?w<=f:w>=f;h=s<=f?++w:--w){for(B=o[h].characters.slice(),l=x=0,A=B.length;x<A&&(d=B[l],!(l>j-1))&&d.isWhitespace();l=++x)o[h].characters.shift();h===s&&(g=l)}r=Math.max(-j,-g)}else{for(i=new HTMLString.String(k,!0),h=y=s;s<=f?y<=f:y>=f;h=s<=f?++y:--y)o[h]=i.concat(o[h]);r=j}return this.content=HTMLString.String.join(new HTMLString.String("\n",!0),o),this.updateInnerHTML(),q=this.content.length()-c,new ContentSelect.Range(p[0]+r,p[1]+q).select(this._domElement)},c.prototype._syncContent=function(a){var b,c;return this._ensureEndZWS(),c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.prototype._ensureEndZWS=function(){var a,b;if(this._domElement.lastChild&&(a=this._domElement.innerHTML,!("​"===a[a.length-1]&&a.indexOf("​")<a.length-1)))return b=function(b){return function(){return a.indexOf("​")>-1&&(b._domElement.innerHTML=a.replace(/\u200B/g,"")),b._domElement.lastChild.textContent+="​"}}(this),this._savedSelection?b():(this.storeState(),b(),this.restoreState())},c.droppers={PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Text),a.TagNames.get().register(a.PreText,"pre"),a.Image=function(b){function c(a,b){var d;c.__super__.constructor.call(this,"img",a),this.a=b||null,d=this.size(),this._aspectRatio=d[1]/d[0]}return h(c,b),c.prototype.cssTypeName=function(){return"image"},c.prototype.type=function(){return"Image"},c.prototype.typeName=function(){return"Image"},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.style.backgroundImage="url('"+this._attributes.src+"')",a},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),d=b+"<img"+this._attributesToString()+">",this.a?(e=a.LINE_ENDINGS,c=a.attributesToString(this.a),c+=' data-ce-tag="img"',b+"<a "+c+">"+e+a.INDENT+d+e+b+"</a>"):d},c.prototype.mount=function(){var a,b;return this._domElement=document.createElement("img"),this._domElement.setAttribute("src",this._attributes.src),a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),b=this._attributes.style?this._attributes.style:"",this._attributes.width&&(b+="width:"+this._attributes.width+"px;"),this._attributes.height&&(b+="height:auto;"),this._domElement.setAttribute("style",b),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("a, img"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth},
c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i,j;if(b=null,"a"===a.tagName.toLowerCase()){for(b=this.getDOMElementAttributes(a),f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b<c;b++)d=e[b],f.push(d);return f}(),i=0,j=f.length;i<j;i++)if(e=f[i],1===e.nodeType&&"img"===e.tagName.toLowerCase()){a=e;break}"a"===a.tagName.toLowerCase()&&(a=document.createElement("img"))}return c=this.getDOMElementAttributes(a),h=c.width,g=c.height,void 0===c.width&&(h=void 0===c.height?a.naturalWidth:a.clientWidth),void 0===c.height&&(g=void 0===c.width?a.naturalHeight:a.clientHeight),c.width=h,c.height=g,new this(c,b)},c}(a.ResizableElement),a.TagNames.get().register(a.Image,"img"),a.ImageFixture=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._src=d}return h(c,b),c.prototype.cssTypeName=function(){return"image-fixture"},c.prototype.type=function(){return"ImageFixture"},c.prototype.typeName=function(){return"ImageFixture"},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),f=a.LINE_ENDINGS,d=this._attributesToString(),c="",void 0!==this._attributes.alt&&(c='alt="'+this._attributes.alt+'"'),e=b+'<img src="'+this.src()+'"'+c+">",b+"<"+this.tagName()+" "+d+">"+f+a.INDENT+e+f+b+"</"+this.tagName()+">"},c.prototype.mount=function(){var a,b,d,e,f,g;this._domElement=document.createElement(this.tagName()),g=this._attributes;for(b in g)f=g[b],"alt"!==b&&"style"!==b&&this._domElement.setAttribute(b,f);return a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),d=this._attributes.style?this._attributes.style:"",e=document.createElement("div"),e.setAttribute("style",d.trim()),e.style.backgroundImage=null,d=e.getAttribute("style"),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._domElement.setAttribute("style",d.trim()),c.__super__.mount.call(this)},c.prototype.src=function(a){return void 0===a?this._src:(this._src=a,this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){var a,b;return this.isFixed()?(b=document.createElement("div"),b.innerHTML=this.html(),a=b.firstElementChild,this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a,this.parent()._domElement=this._domElement):c.__super__.unmount.call(this)},c.prototype._attributesToString=function(){var b,c,d,e,f,g;this._attributes.style?(d=this._attributes.style?this._attributes.style:"",e=document.createElement("div"),e.setAttribute("style",d.trim()),e.style.backgroundImage=null,d=e.getAttribute("style"),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._attributes.style=d.trim()):this._attributes.style="background-image:url('"+this.src()+"');",b={},g=this._attributes;for(c in g)f=g[c],"alt"!==c&&(b[c]=f);return" "+a.attributesToString(b)},c.droppers={ImageFixture:a.Element._dropVert,Image:a.Element._dropVert,PreText:a.Element._dropVert,Text:a.Element._dropVert},c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i;for(a.tagName,c=this.getDOMElementAttributes(a),g="",b="",f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b<c;b++)d=e[b],f.push(d);return f}(),h=0,i=f.length;h<i;h++)if(e=f[h],1===e.nodeType&&"img"===e.tagName.toLowerCase()){g=e.getAttribute("src")||"",b=e.getAttribute("alt")||"";break}return c=this.getDOMElementAttributes(a),c.alt=b,new this(a.tagName,c,g)},c}(a.Element),a.TagNames.get().register(a.ImageFixture,"img-fixture"),a.Video=function(b){function c(a,b,d){var e;null==d&&(d=[]),c.__super__.constructor.call(this,a,b),this.sources=d,e=this.size(),this._aspectRatio=e[1]/e[0]}return h(c,b),c.prototype.cssTypeName=function(){return"video"},c.prototype.type=function(){return"Video"},c.prototype.typeName=function(){return"Video"},c.prototype._title=function(){var a;return a="",this.attr("src")?a=this.attr("src"):this.sources.length&&(a=this.sources[0].src),a||(a="No video source set"),a.length>80&&(a=a.substr(0,80)+"..."),a},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.innerHTML=this._title(),a},c.prototype.html=function(b){var c,d,e,f,g,h,i;if(null==b&&(b=""),d=a.LINE_ENDINGS,"video"===this.tagName()){for(f=[],i=this.sources,g=0,h=i.length;g<h;g++)e=i[g],c=a.attributesToString(e),f.push(""+b+a.INDENT+"<source "+c+">");return b+"<video"+this._attributesToString()+">"+d+f.join(d)+d+b+"</video>"}return b+"<"+this._tagName+this._attributesToString()+"></"+this._tagName+">"},c.prototype.mount=function(){var a;return this._domElement=document.createElement("div"),this.a&&this.a.class?this._domElement.setAttribute("class",this.a.class):this._attributes.class&&this._domElement.setAttribute("class",this._attributes.class),a=this._attributes.style?this._attributes.style:"",this._attributes.width&&(a+="width:"+this._attributes.width+"px;"),this._attributes.height&&(a+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",a),this._domElement.setAttribute("data-ce-title",this._title()),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("iframe"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth,Video:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g;for(d=function(){var c,d,e,f;for(e=a.childNodes,f=[],c=0,d=e.length;c<d;c++)b=e[c],f.push(b);return f}(),e=[],f=0,g=d.length;f<g;f++)c=d[f],1===c.nodeType&&"source"===c.tagName.toLowerCase()&&e.push(this.getDOMElementAttributes(c));return new this(a.tagName,this.getDOMElementAttributes(a),e)},c}(a.ResizableElement),a.TagNames.get().register(a.Video,"iframe","video"),a.List=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"list"},c.prototype.type=function(){return"List"},c.prototype.typeName=function(){return"List"},c.prototype._onMouseOver=function(a){if("ListItem"!==this.parent().type())return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;g<h;g++)d=e[g],1===d.nodeType&&"li"===d.tagName.toLowerCase()&&f.attach(a.ListItem.fromDOMElement(d));return 0===f.children.length?null:f},c}(a.ElementCollection),a.TagNames.get().register(a.List,"ol","ul"),a.ListItem=function(b){function c(a){c.__super__.constructor.call(this,"li",a),this._behaviours.indent=!0}return h(c,b),c.prototype.cssTypeName=function(){return"list-item"},c.prototype.list=function(){return 2===this.children.length?this.children[1]:null},c.prototype.listItemText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"ListItem"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<li"+this._attributesToString()+">"],this.listItemText()&&c.push(this.listItemText().html(b+a.INDENT)),this.list()&&c.push(this.list().html(b+a.INDENT)),c.push(b+"</li>"),c.join(a.LINE_ENDINGS)},c.prototype.indent=function(){var b;if(this.can("indent")&&0!==this.parent().children.indexOf(this))return b=this.previousSibling(),b.list()||b.attach(new a.List(b.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),b.list().attach(this),this.listItemText().restoreState()},c.prototype.remove=function(){var a,b,c,d,e,f;if(this.parent()){if(c=this.parent().children.indexOf(this),this.list())for(f=this.list().children.slice(),b=d=0,e=f.length;d<e;b=++d)a=f[b],a.parent().detach(a),this.parent().attach(a,b+c);return this.parent().detach(this)}},c.prototype.unindent=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(this.can("indent")){if(g=this.parent(),c=g.parent(),k=g.children.slice(g.children.indexOf(this)+1,g.children.length),"ListItem"===c.type()){for(this.listItemText().storeState(),g.detach(this),c.parent().attach(this,c.parent().children.indexOf(c)+1),k.length&&!this.list()&&this.attach(new a.List(g.tagName())),m=0,q=k.length;m<q;m++)j=k[m],j.parent().detach(j),this.list().attach(j);return this.listItemText().restoreState()}if(l=new a.Text("p",this.attr("class")?{class:this.attr("class")}:{},this.listItemText().content),i=null,this.listItemText().isFocused()&&(i=ContentSelect.Range.query(this.listItemText().domElement())),h=c.children.indexOf(g),0===(e=g.children.indexOf(this))){if(f=null,1===g.children.length?(this.list()&&(f=new a.List(g.tagName())),c.detach(g)):g.detach(this),c.attach(l,h),f&&c.attach(f,h+1),this.list())for(u=this.list().children.slice(),d=n=0,r=u.length;n<r;d=++n)b=u[d],b.parent().detach(b),f?f.attach(b):g.attach(b,d)}else if(e===g.children.length-1)g.detach(this),c.attach(l,h+1),this.list()&&c.attach(this.list(),h+2);else{if(g.detach(this),c.attach(l,h+1),f=new a.List(g.tagName()),c.attach(f,h+2),this.list())for(v=this.list().children.slice(),o=0,s=v.length;o<s;o++)b=v[o],b.parent().detach(b),f.attach(b);for(p=0,t=k.length;p<t;p++)j=k[p],j.parent().detach(j),f.attach(j)}return i?(l.focus(),i.select(l.domElement())):void 0}},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l;for(g=new this(this.getDOMElementAttributes(b)),d="",e=null,k=b.childNodes,i=0,j=k.length;i<j;i++)c=k[i],1===c.nodeType?"ul"===(l=c.tagName.toLowerCase())||"ol"===l||"li"===l?e||(e=c):d+=c.outerHTML:d+=HTMLString.String.encode(c.textContent);return d=d.replace(/^\s+|\s+$/g,""),h=new a.ListItemText(d),g.attach(h),e&&(f=a.List.fromDOMElement(e),g.attach(f)),g},c}(a.ElementCollection),a.ListItemText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"list-item-text"},c.prototype.type=function(){return"ListItemText"},c.prototype.typeName=function(){return"List item"},c.prototype.blur=function(){return this.content.isWhitespace()&&this.can("remove")?this.parent().remove():this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(c=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),c.optimize(),this._lastCached=Date.now(),this._cached=c.html()),""+b+this._cached},c.prototype._onMouseDown=function(b){var c;return a.Element.prototype._onMouseDown.call(this,b),c=function(d){return function(){var e;return a.Root.get().dragging()===d?(a.Root.get().cancelDragging(),e=d.closest(function(a){return"Region"===a.parent().type()}),e.drag(b.pageX,b.pageY)):(d.drag(b.pageX,b.pageY),d._dragTimeout=setTimeout(c,2*a.DRAG_HOLD_DURATION))}}(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(c,a.DRAG_HOLD_DURATION)},c.prototype._onMouseMove=function(b){return this._dragTimeout&&clearTimeout(this._dragTimeout),a.Element.prototype._onMouseMove.call(this,b)},c.prototype._onMouseUp=function(b){return this._dragTimeout&&clearTimeout(this._dragTimeout),a.Element.prototype._onMouseUp.call(this,b)},c.prototype._keyTab=function(a){return a.preventDefault(),a.shiftKey?this.parent().unindent():this.parent().indent()},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;return b.preventDefault(),this.content.isWhitespace()?void this.parent().unindent():this.can("spawn")?(ContentSelect.Range.query(this._domElement),f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),h.length()+g.length()===0?void this.parent().unindent():(this.content=h.trim(),this.updateInnerHTML(),c=this.parent().parent(),e=new a.ListItem(this.attr("class")?{class:this.attr("class")}:{}),c.attach(e,c.children.indexOf(this.parent())+1),e.attach(new a.ListItemText(g.trim())),d=this.parent().list(),d&&(this.parent().detach(d),e.attach(d)),h.length()?(e.listItemText().focus(),f=new ContentSelect.Range(0,0),f.select(e.listItemText().domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint())):void 0},c.droppers={ListItemText:function(b,c,d){var e,f,g,h;return e=b.parent(),h=c.parent(),e.remove(),e.detach(b),g=new a.ListItem(e._attributes),g.attach(b),h.list()&&"below"===d[0]?void h.list().attach(g,0):(f=h.parent().children.indexOf(h),"below"===d[0]&&(f+=1),h.parent().attach(g,f))},Text:function(b,c,d){var e,f,g,h,i;if("Text"===b.type()){if(h=c.parent(),b.parent().detach(b),e=b.attr("class"),g=new a.ListItem(e?{class:e}:{}),g.attach(new a.ListItemText(b.content)),h.list()&&"below"===d[0])return void h.list().attach(g,0);if(f=h.parent().children.indexOf(h),"below"===d[0]&&(f+=1),h.parent().attach(g,f),g.listItemText().focus(),b._savedSelection)return b._savedSelection.select(g.listItemText().domElement())}else if(e=b.attr("class"),i=new a.Text("p",e?{class:e}:{},b.content),b.parent().remove(),f=c.parent().children.indexOf(c),"below"===d[0]&&(f+=1),c.parent().attach(i,f),i.focus(),b._savedSelection)return b._savedSelection.select(i.domElement())}},c.mergers={ListItemText:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&(b._domElement.innerHTML=b.content.html()),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),"Text"===a.type()?a.parent()&&a.parent().detach(a):a.parent().remove(),b.taint()}},c}(a.Text),d=a.ListItemText.mergers,d.Text=d.ListItemText,a.Table=function(b){function c(a){c.__super__.constructor.call(this,"table",a)}return h(c,b),c.prototype.cssTypeName=function(){return"table"},c.prototype.typeName=function(){return"Table"},c.prototype.type=function(){return"Table"},c.prototype.firstSection=function(){var a;return(a=this.thead())?a:(a=this.tbody())?a:(a=this.tfoot())?a:null},c.prototype.lastSection=function(){var a;return(a=this.tfoot())?a:(a=this.tbody())?a:(a=this.thead())?a:null},c.prototype.tbody=function(){return this._getChild("tbody")},c.prototype.tfoot=function(){return this._getChild("tfoot")},c.prototype.thead=function(){return this._getChild("thead")},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._getChild=function(a){var b,c,d,e;for(e=this.children,c=0,d=e.length;c<d;c++)if(b=e[c],b.tagName()===a)return b;return null},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Table:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;for(i=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),f=[],k=0,m=e.length;k<m;k++)if(d=e[k],1===d.nodeType&&(j=d.tagName.toLowerCase(),!i._getChild(j)))switch(j){case"tbody":case"tfoot":case"thead":h=a.TableSection.fromDOMElement(d),i.attach(h);break;case"tr":f.push(a.TableRow.fromDOMElement(d))}if(f.length>0)for(i._getChild("tbody")||i.attach(new a.TableSection("tbody")),l=0,n=f.length;l<n;l++)g=f[l],i.tbody().attach(g);return 0===i.children.length?null:i},c}(a.ElementCollection),a.TagNames.get().register(a.Table,"table"),a.TableSection=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"table-section"},c.prototype.type=function(){return"TableSection"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;g<h;g++)d=e[g],1===d.nodeType&&"tr"===d.tagName.toLowerCase()&&f.attach(a.TableRow.fromDOMElement(d));return f},c}(a.ElementCollection),a.TableRow=function(b){function c(a){c.__super__.constructor.call(this,"tr",a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-row"},c.prototype.isEmpty=function(){var a,b,c,d,e;for(e=this.children,c=0,d=e.length;c<d;c++)if(a=e[c],(b=a.tableCellText())&&b.content.length()>0)return!1;return!0},c.prototype.type=function(){return"TableRow"},c.prototype.typeName=function(){return"Table row"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={TableRow:a.Element._dropVert},c.fromDOMElement=function(b){var c,d,e,f,g,h,i;for(f=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),h=0,i=e.length;h<i;h++)d=e[h],1===d.nodeType&&("td"!==(g=d.tagName.toLowerCase())&&"th"!==g||f.attach(a.TableCell.fromDOMElement(d)));return f},c}(a.ElementCollection),a.TableCell=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell"},c.prototype.tableCellText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"TableCell"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&c.push(this.tableCellText().html(b+a.INDENT)),c.push(b+"</"+this.tagName()+">"),c.join(a.LINE_ENDINGS)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d;return c=new this(b.tagName,this.getDOMElementAttributes(b)),d=new a.TableCellText(b.innerHTML.replace(/^\s+|\s+$/g,"")),c.attach(d),c},c}(a.ElementCollection),a.TableCellText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell-text"},c.prototype.type=function(){return"TableCellText"},c.prototype._isInFirstRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.firstSection()&&b===c.children[0]},c.prototype._isInLastRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.lastSection()&&b===c.children[c.children.length-1]},c.prototype._isLastInSection=function(){var a,b,c;return a=this.parent(),b=a.parent(),c=b.parent(),b===c.children[c.children.length-1]&&a===b.children[b.children.length-1]},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(c=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),c.optimize(),this._lastCached=Date.now(),this._cached=c.html()),""+b+this._cached},c.prototype._onMouseDown=function(b){var c;return a.Element.prototype._onMouseDown.call(this,b),c=function(d){return function(){var e,f;return e=d.parent(),a.Root.get().dragging()===e.parent()?(a.Root.get().cancelDragging(),f=e.parent().parent().parent(),f.drag(b.pageX,b.pageY)):(e.parent().drag(b.pageX,b.pageY),d._dragTimeout=setTimeout(c,2*a.DRAG_HOLD_DURATION))}}(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(c,a.DRAG_HOLD_DURATION)},c.prototype._keyBack=function(a){var b,c,d,e;if(e=ContentSelect.Range.query(this._domElement),0===e.get()[0]&&e.isCollapsed()&&(a.preventDefault(),b=this.parent(),d=b.parent(),d.isEmpty()&&d.can("remove")))return 0===this.content.length()&&0===d.children.indexOf(b)?(c=this.previousContent(),c&&(c.focus(),e=new ContentSelect.Range(c.content.length(),c.content.length()),e.select(c.domElement())),d.parent().detach(d)):void 0},c.prototype._keyDelete=function(a){var b,c,d,e;if(d=this.parent().parent(),d.isEmpty()&&d.can("remove"))return a.preventDefault(),b=d.children[d.children.length-1],c=b.tableCellText().nextContent(),c&&(c.focus(),e=new ContentSelect.Range(0,0),e.select(c.domElement())),d.parent().detach(d)},c.prototype._keyDown=function(b){var c,d,e,f,g,h,i;if(i=ContentSelect.Range.query(this._domElement),this._atEnd(i)&&i.isCollapsed())return b.preventDefault(),c=this.parent(),this._isInLastRow()?(h=c.parent(),e=h.children[h.children.length-1].tableCellText(),f=e.nextContent(),f?f.focus():a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(g=c.parent().nextWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,g.children.length),g.children[d].tableCellText().focus())},c.prototype._keyReturn=function(a){return a.preventDefault(),this._keyTab({shiftKey:!1,preventDefault:function(){}})},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l;if(b.preventDefault(),c=this.parent(),b.shiftKey){if(this._isInFirstRow()&&c.parent().children[0]===c)return;return this.previousContent().focus()}if(this.can("spawn")){if(e=c.parent().parent(),"tbody"===e.tagName()&&this._isLastInSection()){for(h=new a.TableRow,l=c.parent().children,j=0,k=l.length;j<k;j++)d=l[j],f=new a.TableCell(d.tagName(),d._attributes),g=new a.TableCellText(""),f.attach(g),h.attach(f);return i=this.closest(function(a){return"TableSection"===a.type()}),i.attach(h),h.children[0].tableCellText().focus()}return this.nextContent().focus()}},c.prototype._keyUp=function(b){var c,d,e,f,g,h;if(h=ContentSelect.Range.query(this._domElement),0===h.get()[0]&&h.isCollapsed())return b.preventDefault(),c=this.parent(),this._isInFirstRow()?(g=c.parent(),e=g.children[0].previousContent(),e?e.focus():a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(f=c.parent().previousWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,f.children.length),f.children[d].tableCellText().focus())},c.droppers={},c.mergers={},c}(a.Text)}.call(this),function(){var a,b,c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h=function(a,b){return function(){return a.apply(b,arguments)}},i=[].slice;b={Tools:{},CANCEL_MESSAGE:"Your changes have not been saved, do you really want to lose them?".trim(),DEFAULT_TOOLS:[["heading","heading2","heading3","heading4","heading5","paragraph","bold","italic","underline","strike","code","link","align-left","align-center","align-right","unordered-list","ordered-list","line-break","indent","unindent"],["image","video","table","undo","redo","remove"]],DEFAULT_VIDEO_HEIGHT:315,DEFAULT_VIDEO_WIDTH:560,HIGHLIGHT_HOLD_DURATION:2e3,IMAGE_UPLOADER:null,INLINE_TAGS:["a","address","b","code","del","em","i","ins","span","strong","sup","u"],INSPECTOR_IGNORED_ELEMENTS:["Fixture","ListItemText","Region","TableCellText"],MIN_CROP:10,RESTRICTED_ATTRIBUTES:{"*":["style"],img:["height","src","width","data-ce-max-width","data-ce-min-width"]},getEmbedVideoURL:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(b={"www.youtube.com":"youtube","youtu.be":"youtube","vimeo.com":"vimeo","player.vimeo.com":"vimeo"},k=document.createElement("a"),k.href=a,g=k.hostname.toLowerCase(),l=k.pathname,null!==l&&"/"!==l.substr(0,1)&&(l="/"+l),i={},j=k.search.slice(1),p=j.split("&"),n=0,o=p.length;n<o;n++)e=p[n],e=e.split("="),e[0]&&(i[e[0]]=e[1]);switch(b[g]){case"youtube":if("/watch"===l.toLowerCase()){if(!i.v)return null;c=i.v,delete i.v}else{if(!(f=l.match(/\/([A-Za-z0-9_-]+)$/i)))return null;c=f[1]}return a="https://www.youtube.com/embed/"+c,h=function(){var a;a=[];for(d in i)m=i[d],a.push(d+"="+m);return a}().join("&"),h&&(a+="?"+h),a;case"vimeo":return(f=l.match(/\/(\w+\/\w+\/){0,1}(\d+)/i))?(a="https://player.vimeo.com/video/"+f[2],h=function(){var a;a=[];for(d in i)m=i[d],a.push(d+"="+m);return a}().join("&"),h&&(a+="?"+h),a):null}return null},getHTMLCleaner:function(){return new b.HTMLCleaner},getRestrictedAtributes:function(a){var c;return c=[],b.RESTRICTED_ATTRIBUTES[a]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES[a])),b.RESTRICTED_ATTRIBUTES["*"]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES["*"])),c},getScrollPosition:function(){var a,b;return b=void 0!==window.pageXOffset,a=4===(document.compatMode||4),b?[window.pageXOffset,window.pageYOffset]:a?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]}},"undefined"!=typeof window&&(window.ContentTools=b),"undefined"!=typeof module&&module.exports&&(module.exports=b),b.ComponentUI=function(){function a(){this._bindings={},this._parent=null,this._children=[],this._domElement=null}return a.prototype.children=function(){return this._children.slice()},a.prototype.domElement=function(){return this._domElement},a.prototype.isMounted=function(){return null!==this._domElement},a.prototype.parent=function(){return this._parent},a.prototype.attach=function(a,b){return a.parent()&&a.parent().detach(a),a._parent=this,void 0!==b?this._children.splice(b,0,a):this._children.push(a)},a.prototype.addCSSClass=function(a){if(this.isMounted())return ContentEdit.addCSSClass(this._domElement,a)},a.prototype.detach=function(a){var b;if(-1!==(b=this._children.indexOf(a)))return this._children.splice(b,1)},a.prototype.mount=function(){},a.prototype.removeCSSClass=function(a){if(this.isMounted())return ContentEdit.removeCSSClass(this._domElement,a)},a.prototype.unmount=function(){if(this.isMounted())return this._removeDOMEventListeners(),this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null},a.prototype.addEventListener=function(a,b){void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b)},a.prototype.createEvent=function(a,c){return new b.Event(a,c)},a.prototype.dispatchEvent=function(a){var b,c,d,e;if(!this._bindings[a.name()])return!a.defaultPrevented();for(e=this._bindings[a.name()],c=0,d=e.length;c<d&&(b=e[c],!a.propagationStopped());c++)b&&b.call(this,a);return!a.defaultPrevented()},a.prototype.removeEventListener=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;e<f;c=++e)d=g[c],d===b?h.push(this._bindings[a].splice(c,1)):h.push(void 0);return h}},a.prototype._addDOMEventListeners=function(){},a.prototype._removeDOMEventListeners=function(){},a.createDiv=function(a,b,c){var d,e,f;if(d=document.createElement("div"),a&&a.length>0&&d.setAttribute("class",a.join(" ")),b)for(e in b)f=b[e],d.setAttribute(e,f);return c&&(d.innerHTML=c),d},a}(),b.WidgetUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.attach=function(a,c){if(b.__super__.attach.call(this,a,c),!this.isMounted())return a.mount()},b.prototype.detach=function(a){if(b.__super__.detach.call(this,a),this.isMounted())return a.unmount()},b.prototype.detatch=function(a){return console.log("Please call detach, detatch will be removed in release 1.4.x"),this.detach(a)},b.prototype.show=function(){var a;return this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null,this.unmount()),this.isMounted()||this.mount(),a=function(a){return function(){return a.addCSSClass("ct-widget--active"),a._showTimeout=null}}(this),this._showTimeout=setTimeout(a,100)},b.prototype.hide=function(){var a;if(this._showTimeout&&(clearTimeout(this._showTimeout),this._showTimeout=null),this.removeCSSClass("ct-widget--active"),a=function(b){return function(){return b._hideTimeout=null,window.getComputedStyle?parseFloat(window.getComputedStyle(b._domElement).opacity)<.01?b.unmount():b._hideTimeout=setTimeout(a,250):void b.unmount()}}(this),this.isMounted())return this._hideTimeout=setTimeout(a,250)},b}(b.ComponentUI),b.AnchoredComponentUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.mount=function(a,b){return null==b&&(b=null),a.insertBefore(this._domElement,b),this._addDOMEventListeners()},b}(b.ComponentUI),b.Event=function(){function a(a,b){this._name=a,this._detail=b,this._timeStamp=Date.now(),this._defaultPrevented=!1,this._propagationStopped=!1}return a.prototype.defaultPrevented=function(){return this._defaultPrevented},a.prototype.detail=function(){return this._detail},a.prototype.name=function(){return this._name},a.prototype.propagationStopped=function(){return this._propagationStopped},a.prototype.timeStamp=function(){return this._timeStamp},a.prototype.preventDefault=function(){return this._defaultPrevented=!0},a.prototype.stopImmediatePropagation=function(){return this._propagationStopped=!0},a}(),b.FlashUI=function(a){function c(a){c.__super__.constructor.call(this),this.mount(a)}return g(c,a),c.prototype.mount=function(a){var d;return this._domElement=this.constructor.createDiv(["ct-flash","ct-flash--active","ct-flash--"+a,"ct-widget","ct-widget--active"]),c.__super__.mount.call(this,b.EditorApp.get().domElement()),d=function(a){return function(){return window.getComputedStyle?parseFloat(window.getComputedStyle(a._domElement).opacity)<.01?a.unmount():setTimeout(d,250):void a.unmount()}}(this),setTimeout(d,250)},c}(b.AnchoredComponentUI),b.IgnitionUI=function(a){function b(){b.__super__.constructor.call(this),this._revertToState="ready",this._state="ready"}return g(b,a),b.prototype.busy=function(a){if(this.dispatchEvent(this.createEvent("busy",{busy:a}))){if(a===("busy"===this._state))return;return a?(this._revertToState=this._state,this.state("busy")):this.state(this._revertToState)}},b.prototype.cancel=function(){if(this.dispatchEvent(this.createEvent("cancel")))return this.state("ready")},b.prototype.confirm=function(){if(this.dispatchEvent(this.createEvent("confirm")))return this.state("ready")},b.prototype.edit=function(){if(this.dispatchEvent(this.createEvent("edit")))return this.state("editing")},b.prototype.mount=function(){return b.__super__.mount.call(this),this._domElement=this.constructor.createDiv(["ct-widget","ct-ignition","ct-ignition--ready"]),this.parent().domElement().appendChild(this._domElement),this._domEdit=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--edit"]),this._domElement.appendChild(this._domEdit),this._domLogout=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--logout"]),this._domElement.appendChild(this._domLogout),this._domConfirm=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--confirm"]),this._domElement.appendChild(this._domConfirm),this._domBlog=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--blog"]),this._domElement.appendChild(this._domBlog),this._domCancel=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--cancel"]),this._domElement.appendChild(this._domCancel),
this._domBusy=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--busy"]),this._domElement.appendChild(this._domBusy),this._addDOMEventListeners()},b.prototype.state=function(a){if(void 0===a)return this._state;if(this._state!==a&&this.dispatchEvent(this.createEvent("statechange",{state:a})))return this._state=a,this.removeCSSClass("ct-ignition--busy"),this.removeCSSClass("ct-ignition--editing"),this.removeCSSClass("ct-ignition--ready"),"busy"===this._state?this.addCSSClass("ct-ignition--busy"):"editing"===this._state?this.addCSSClass("ct-ignition--editing"):"ready"===this._state?this.addCSSClass("ct-ignition--ready"):void 0},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domEdit=null,this._domConfirm=null,this._domCancel=null},b.prototype._addDOMEventListeners=function(){return this._domEdit.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.edit()}}(this)),this._domConfirm.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.confirm()}}(this)),this._domCancel.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.cancel()}}(this))},b}(b.WidgetUI),b.InspectorUI=function(a){function c(){c.__super__.constructor.call(this),this._tagUIs=[]}return g(c,a),c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-inspector"]),this.parent().domElement().appendChild(this._domElement),this._domTags=this.constructor.createDiv(["ct-inspector__tags","ct-tags"]),this._domElement.appendChild(this._domTags),this._domCounter=this.constructor.createDiv(["ct-inspector__counter"]),this._domElement.appendChild(this._domCounter),this.updateCounter(),this._addDOMEventListeners(),this._handleFocusChange=function(a){return function(){return a.updateTags()}}(this),ContentEdit.Root.get().bind("blur",this._handleFocusChange),ContentEdit.Root.get().bind("focus",this._handleFocusChange),ContentEdit.Root.get().bind("mount",this._handleFocusChange)},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domTags=null,ContentEdit.Root.get().unbind("blur",this._handleFocusChange),ContentEdit.Root.get().unbind("focus",this._handleFocusChange),ContentEdit.Root.get().unbind("mount",this._handleFocusChange)},c.prototype.updateCounter=function(){var a,c,d,e,f,g,h,i,j,k,l;if(this.isMounted()){for(c="",l=b.EditorApp.get().orderedRegions(),j=0,k=l.length;j<k;j++)(g=l[j])&&(c+=g.domElement().textContent);return c=c.trim(),(c=c.replace(/<\/?[a-z][^>]*>/gi,""),c=c.replace(/[\u200B]+/,""),c=c.replace(/['";:,.?¿\-!¡]+/g,""),i=(c.match(/\S+/g)||[]).length,i=i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),(d=ContentEdit.Root.get().focused())&&"PreText"===d.type()&&d.selection().isCollapsed())?(e=0,a=1,h=d.content.substring(0,d.selection().get()[0]),f=h.text().split("\n"),e=f.length,a=f[f.length-1].length+1,e=e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),a=a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),this._domCounter.textContent=i+" / "+e+":"+a):void(this._domCounter.textContent=i)}},c.prototype.updateTags=function(){var a,c,d,e,f,g,h,i,j;for(a=ContentEdit.Root.get().focused(),i=this._tagUIs,e=0,g=i.length;e<g;e++)d=i[e],d.unmount();if(this._tagUIs=[],a){for(c=a.parents(),c.reverse(),c.push(a),j=[],f=0,h=c.length;f<h;f++)a=c[f],-1===b.INSPECTOR_IGNORED_ELEMENTS.indexOf(a.type())&&(d=new b.TagUI(a),this._tagUIs.push(d),j.push(d.mount(this._domTags)));return j}},c.prototype._addDOMEventListeners=function(){return this._updateCounterInterval=setInterval(function(a){return function(){return a.updateCounter()}}(this),250)},c.prototype._removeDOMEventListeners=function(){return clearInterval(this._updateCounterInterval)},c}(b.WidgetUI),b.TagUI=function(a){function c(a){this.element=a,this._onMouseDown=h(this._onMouseDown,this),c.__super__.constructor.call(this)}return g(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-tag"]),this._domElement.textContent=this.element.tagName(),c.__super__.mount.call(this,a,b)},c.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown)},c.prototype._onMouseDown=function(a){var c,d,e;return a.preventDefault(),this.element.storeState&&this.element.storeState(),c=b.EditorApp.get(),e=new b.ModalUI,d=new b.PropertiesDialog(this.element),d.addEventListener("cancel",function(a){return function(){if(e.hide(),d.hide(),a.element.restoreState)return a.element.restoreState()}}(this)),d.addEventListener("save",function(a){return function(b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;j=b.detail(),f=j.changedAttributes,n=j.changedStyles,l=j.innerHTML;for(m in f)if(o=f[m],"class"===m){for(null===o&&(o=""),h={},t=o.split(" "),p=0,r=t.length;p<r;p++)g=t[p],(g=g.trim())&&(h[g]=!0,a.element.hasCSSClass(g)||a.element.addCSSClass(g));if(a.element.attr("class"))for(u=a.element.attr("class").split(" "),q=0,s=u.length;q<s;q++)g=u[q],g=g.trim(),void 0===h[g]&&a.element.removeCSSClass(g)}else null===o?a.element.removeAttr(m):a.element.attr(m,o);for(i in n)c=n[i],c?a.element.addCSSClass(i):a.element.removeCSSClass(i);if(null!==l&&l!==d.getElementInnerHTML()&&(k=a.element,k.content||(k=k.children[0]),k.content=new HTMLString.String(l,k.content.preserveWhitespace()),k.updateInnerHTML(),k.taint(),k.selection(new ContentSelect.Range(0,0)),k.storeState()),e.hide(),d.hide(),a.element.restoreState)return a.element.restoreState()}}(this)),c.attach(e),c.attach(d),e.show(),d.show()},c}(b.AnchoredComponentUI),b.ModalUI=function(a){function b(a,c){b.__super__.constructor.call(this),this._transparent=a,this._allowScrolling=c}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-modal"]),this.parent().domElement().appendChild(this._domElement),this._transparent&&this.addCSSClass("ct-modal--transparent"),this._allowScrolling||ContentEdit.addCSSClass(document.body,"ct--no-scroll"),this._addDOMEventListeners()},b.prototype.unmount=function(){return this._allowScrolling||ContentEdit.removeCSSClass(document.body,"ct--no-scroll"),b.__super__.unmount.call(this)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("click"))}}(this))},b}(b.WidgetUI),b.ToolboxUI=function(a){function c(a){this._onStopDragging=h(this._onStopDragging,this),this._onStartDragging=h(this._onStartDragging,this),this._onDrag=h(this._onDrag,this),c.__super__.constructor.call(this),this._tools=a,this._dragging=!1,this._draggingOffset=null,this._domGrip=null,this._toolUIs={}}return g(c,a),c.prototype.isDragging=function(){return this._dragging},c.prototype.hide=function(){return this._removeDOMEventListeners(),c.__super__.hide.call(this)},c.prototype.mount=function(){var a,b,c;return this._domElement=this.constructor.createDiv(["ct-widget","ct-toolbox"]),this.parent().domElement().appendChild(this._domElement),this._domGrip=this.constructor.createDiv(["ct-toolbox__grip","ct-grip"]),this._domElement.appendChild(this._domGrip),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domToolGroups=this.constructor.createDiv(["ct-tool-groups"]),this._domElement.appendChild(this._domToolGroups),this.tools(this._tools),c=window.localStorage.getItem("ct-toolbox-position"),c&&/^\d+,\d+$/.test(c)&&(b=function(){var b,d,e,f;for(e=c.split(","),f=[],b=0,d=e.length;b<d;b++)a=e[b],f.push(parseInt(a));return f}(),this._domElement.style.left=b[0]+"px",this._domElement.style.top=b[1]+"px",this._contain()),this._addDOMEventListeners()},c.prototype.tools=function(a){var c,d,e,f,g,h,i,j,k,l,m;if(void 0===a)return this._tools;if(this._tools=a,this.isMounted()){k=this._toolUIs;for(g in k)h=k[g],h.unmount();for(this._toolUIs={};this._domToolGroups.lastChild;)this._domToolGroups.removeChild(this._domToolGroups.lastChild);for(l=this._tools,m=[],d=i=0,j=l.length;i<j;d=++i)f=l[d],c=this.constructor.createDiv(["ct-tool-group"]),this._domToolGroups.appendChild(c),m.push(function(){var a,d,h;for(h=[],a=0,d=f.length;a<d;a++)g=f[a],e=b.ToolShelf.fetch(g),this._toolUIs[g]=new b.ToolUI(e),this._toolUIs[g].mount(c),this._toolUIs[g].disabled(!0),h.push(this._toolUIs[g].addEventListener("applied",function(a){return function(){return a.updateTools()}}(this)));return h}.call(this));return m}},c.prototype.updateTools=function(){var a,b,c,d,e,f;a=ContentEdit.Root.get().focused(),c=null,a&&a.selection&&(c=a.selection()),e=this._toolUIs,f=[];for(b in e)d=e[b],f.push(d.update(a,c));return f},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domGrip=null},c.prototype._addDOMEventListeners=function(){return this._domGrip.addEventListener("mousedown",this._onStartDragging),this._domGrip.addEventListener("touchstart",this._onStartDragging),this._handleResize=function(a){return function(b){var c;return a._resizeTimeout&&clearTimeout(a._resizeTimeout),c=function(){return a._contain()},a._resizeTimeout=setTimeout(c,250)}}(this),window.addEventListener("resize",this._handleResize),this._updateTools=function(a){return function(){var c,d,e,f,g,h,i,j;if(c=b.EditorApp.get(),h=!1,d=ContentEdit.Root.get().focused(),f=null,d===a._lastUpdateElement?d&&d.selection&&(f=d.selection(),a._lastUpdateSelection?f.eq(a._lastUpdateSelection)||(h=!0):h=!0):h=!0,c.history&&(a._lastUpdateHistoryLength!==c.history.length()&&(h=!0),a._lastUpdateHistoryLength=c.history.length(),a._lastUpdateHistoryIndex!==c.history.index()&&(h=!0),a._lastUpdateHistoryIndex=c.history.index()),a._lastUpdateElement=d,a._lastUpdateSelection=f,h){i=a._toolUIs,j=[];for(e in i)g=i[e],j.push(g.update(d,f));return j}}}(this),this._updateToolsInterval=setInterval(this._updateTools,100),this._handleKeyDown=function(a){return function(c){var d,e,f,g,h,i,j;if((e=ContentEdit.Root.get().focused())&&!e.content){if(46===c.keyCode)return c.preventDefault(),b.Tools.Remove.apply(e,null,function(){});if(13===c.keyCode)return c.preventDefault(),d=b.Tools.Paragraph,d.apply(e,null,function(){})}switch(j=navigator.appVersion,f="linux",-1!==j.indexOf("Mac")?f="mac":-1!==j.indexOf("Win")&&(f="windows"),g=!1,i=!1,h=!1,f){case"linux":c.altKey||(90===c.keyCode&&c.ctrlKey&&(g=c.shiftKey,i=!g),83===c.keyCode&&c.ctrlKey&&(h=!0));break;case"mac":c.altKey||c.ctrlKey||(90===c.keyCode&&c.metaKey&&(g=c.shiftKey,i=!g),83===c.keyCode&&c.metaKey&&(h=!0));break;case"windows":c.altKey&&!c.shiftKey||(89===c.keyCode&&c.ctrlKey&&(g=!0),90===c.keyCode&&c.ctrlKey&&(i=!0),83===c.keyCode&&c.ctrlKey&&(h=!0))}if(i&&b.Tools.Undo.canApply(null,null)&&b.Tools.Undo.apply(null,null,function(){}),g&&b.Tools.Redo.canApply(null,null)&&b.Tools.Redo.apply(null,null,function(){}),h)return c.preventDefault(),a._parent.save(!0)}}(this),window.addEventListener("keydown",this._handleKeyDown)},c.prototype._contain=function(){var a;if(this.isMounted())return a=this._domElement.getBoundingClientRect(),a.left+a.width>window.innerWidth&&(this._domElement.style.left=window.innerWidth-a.width+"px"),a.top+a.height>window.innerHeight&&(this._domElement.style.top=window.innerHeight-a.height+"px"),a.left<0&&(this._domElement.style.left="0px"),a.top<0&&(this._domElement.style.top="0px"),a=this._domElement.getBoundingClientRect(),window.localStorage.setItem("ct-toolbox-position",a.left+","+a.top)},c.prototype._removeDOMEventListeners=function(){return this.isMounted()&&this._domGrip.removeEventListener("mousedown",this._onStartDragging),window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("resize",this._handleResize),clearInterval(this._updateToolsInterval)},c.prototype._onDrag=function(a){return a.preventDefault(),ContentSelect.Range.unselectAll(),"touchmove"===a.type?(this._domElement.style.left=a.touches[0].clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.touches[0].clientY-this._draggingOffset.y+"px"):(this._domElement.style.left=a.clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.clientY-this._draggingOffset.y+"px")},c.prototype._onStartDragging=function(a){var b;if(a.preventDefault(),!this.isDragging())return this._dragging=!0,this.addCSSClass("ct-toolbox--dragging"),b=this._domElement.getBoundingClientRect(),"touchstart"===a.type?(this._draggingOffset={x:a.touches[0].clientX-b.left,y:a.touches[0].clientY-b.top},document.addEventListener("touchmove",this._onDrag),document.addEventListener("touchend",this._onStopDragging)):(this._draggingOffset={x:a.clientX-b.left,y:a.clientY-b.top},document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging)),ContentEdit.addCSSClass(document.body,"ce--dragging")},c.prototype._onStopDragging=function(a){if(this.isDragging())return this._contain(),document.removeEventListener("touchmove",this._onDrag),document.removeEventListener("touchend",this._onStopDragging),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._draggingOffset=null,this._dragging=!1,this.removeCSSClass("ct-toolbox--dragging"),ContentEdit.removeCSSClass(document.body,"ce--dragging")},c}(b.WidgetUI),b.ToolUI=function(a){function b(a){this._onMouseUp=h(this._onMouseUp,this),this._onMouseLeave=h(this._onMouseLeave,this),this._onMouseDown=h(this._onMouseDown,this),this._addDOMEventListeners=h(this._addDOMEventListeners,this),b.__super__.constructor.call(this),this.tool=a,this._mouseDown=!1,this._disabled=!1}return g(b,a),b.prototype.apply=function(a,b){var c,d;if(this.tool.canApply(a,b))return d={element:a,selection:b},c=function(a){return function(b){if(b)return a.dispatchEvent(a.createEvent("applied",d))}}(this),this.dispatchEvent(this.createEvent("apply",d))?this.tool.apply(a,b,c):void 0},b.prototype.disabled=function(a){if(void 0===a)return this._disabled;if(this._disabled!==a)return this._disabled=a,a?(this._mouseDown=!1,this.addCSSClass("ct-tool--disabled"),this.removeCSSClass("ct-tool--applied")):this.removeCSSClass("ct-tool--disabled")},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-tool","ct-tool--"+this.tool.icon]),this._domElement.setAttribute("data-ct-tooltip",ContentEdit._(this.tool.label)),b.__super__.mount.call(this,a,c)},b.prototype.update=function(a,b){return(!this.tool.requiresElement||a&&a.isMounted())&&this.tool.canApply(a,b)?(this.disabled(!1),this.tool.isApplied(a,b)?this.addCSSClass("ct-tool--applied"):this.removeCSSClass("ct-tool--applied")):void this.disabled(!0)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseleave",this._onMouseLeave),this._domElement.addEventListener("mouseup",this._onMouseUp)},b.prototype._onMouseDown=function(a){if(a.preventDefault(),!this.disabled())return this._mouseDown=!0,this.addCSSClass("ct-tool--down")},b.prototype._onMouseLeave=function(a){return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b.prototype._onMouseUp=function(a){var b,c;if(this._mouseDown){if(b=ContentEdit.Root.get().focused(),this.tool.requiresElement&&(!b||!b.isMounted()))return;c=null,b&&b.selection&&(c=b.selection()),this.apply(b,c)}return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b}(b.AnchoredComponentUI),b.AnchoredDialogUI=function(a){function b(){b.__super__.constructor.call(this),this._position=[0,0]}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-anchored-dialog"]),this.parent().domElement().appendChild(this._domElement),this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"},b.prototype.position=function(a){return void 0===a?this._position.slice():(this._position=a.slice(),this.isMounted()?(this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"):void 0)},b.prototype._contain=function(){var a,b,c;if(this.isMounted())return c=this._domElement.getBoundingClientRect(),a=c.width/2+5,b=document.documentElement.clientWidth||document.body.clientWidth,this._position[0]+a>b&&(this._position[0]=b-a),this._position[0]<a&&(this._position[0]=a),this._position[1]+c.top<5?this._position[1]=Math.abs(c.top)+5:void 0},b}(b.WidgetUI),b.DialogUI=function(a){function b(a){null==a&&(a=""),b.__super__.constructor.call(this),this._busy=!1,this._caption=a}return g(b,a),b.prototype.busy=function(a){if(void 0===a)return this._busy;if(this._busy!==a&&(this._busy=a,this.isMounted()))return this._busy?ContentEdit.addCSSClass(this._domElement,"ct-dialog--busy"):ContentEdit.removeCSSClass(this._domElement,"ct-dialog--busy")},b.prototype.caption=function(a){return void 0===a?this._caption:(this._caption=a,this._domCaption.textContent=ContentEdit._(a))},b.prototype.mount=function(){var a,b,c;return document.activeElement&&(document.activeElement.blur(),window.getSelection().removeAllRanges()),a=["ct-widget","ct-dialog"],this._busy&&a.push("ct-dialog--busy"),this._domElement=this.constructor.createDiv(a),this.parent().domElement().appendChild(this._domElement),c=this.constructor.createDiv(["ct-dialog__header"]),this._domElement.appendChild(c),this._domCaption=this.constructor.createDiv(["ct-dialog__caption"]),c.appendChild(this._domCaption),this.caption(this._caption),this._domClose=this.constructor.createDiv(["ct-dialog__close"]),c.appendChild(this._domClose),b=this.constructor.createDiv(["ct-dialog__body"]),this._domElement.appendChild(b),this._domView=this.constructor.createDiv(["ct-dialog__view"]),b.appendChild(this._domView),this._domControls=this.constructor.createDiv(["ct-dialog__controls"]),b.appendChild(this._domControls),this._domBusy=this.constructor.createDiv(["ct-dialog__busy"]),this._domElement.appendChild(this._domBusy)},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBusy=null,this._domCaption=null,this._domClose=null,this._domControls=null,this._domView=null},b.prototype._addDOMEventListeners=function(){return this._handleEscape=function(a){return function(b){if(!a._busy)return 27===b.keyCode?a.dispatchEvent(a.createEvent("cancel")):void 0}}(this),document.addEventListener("keyup",this._handleEscape),this._domClose.addEventListener("click",function(a){return function(b){if(b.preventDefault(),!a._busy)return a.dispatchEvent(a.createEvent("cancel"))}}(this))},b.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keyup",this._handleEscape)},b}(b.WidgetUI),b.ImageDialog=function(a){function d(){d.__super__.constructor.call(this,"Insert image"),this._cropMarks=null,this._imageURL=null,this._imageSize=null,this._progress=0,this._state="empty",b.IMAGE_UPLOADER&&b.IMAGE_UPLOADER(this)}return g(d,a),d.prototype.cropRegion=function(){return this._cropMarks?this._cropMarks.region():[0,0,1,1]},d.prototype.hideImages=function(){if(this._domImagesContainer)return this._domImagesContainer.parentNode.removeChild(this._domImagesContainer)},d.prototype.showImages=function(){var a,b,c,d,e,f,g,h;if(this.hideImages,this.images){for(this._domImagesContainer=this.constructor.createDiv(["ct-image-dialog-images__container"]),this._domView.appendChild(this._domImagesContainer),d=this.constructor.createDiv(["ct-image-dialog-images"]),this._domImagesContainer.appendChild(d),g=this.images,h=[],e=0,f=g.length;e<f;e++)a=g[e],c=this.constructor.createDiv(["ct-image-dialog-images__image"]),b=new Image,b.src=a,c.appendChild(b),d.appendChild(c),h.push(b.addEventListener("click",function(a){return function(b){return a._imageSelected={src:b.target.attributes[0].value,size:[b.target.naturalWidth,b.target.naturalHeight]},a.populate(a._imageSelected.src,a._imageSelected.size)}}(this)));return h}},d.prototype.addImages=function(a){return this.images=a},d.prototype.addCropMarks=function(){if(!this._cropMarks)return this._cropMarks=new c(this._imageSize),this._cropMarks.mount(this._domView),ContentEdit.addCSSClass(this._domCrop,"ct-control--active")},d.prototype.clear=function(){return this._domImage&&(this._domImage.parentNode.removeChild(this._domImage),this._domImage=null),this._imageURL=null,this._imageSize=null,this.state("empty"),this.showImages()},d.prototype.mount=function(){var a,b,c;return d.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog"),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--empty"),ContentEdit.addCSSClass(this._domView,"ct-image-dialog__view"),c=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(c),b=this.constructor.createDiv(["ct-progress-bar"]),c.appendChild(b),this._domProgress=this.constructor.createDiv(["ct-progress-bar__progress"]),b.appendChild(this._domProgress),a=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(a),this._domUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--upload"]),this._domUpload.textContent=ContentEdit._("Upload"),a.appendChild(this._domUpload),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-image-dialog__file-upload"),this._domInput.setAttribute("name","file"),this._domInput.setAttribute("type","file"),this._domInput.setAttribute("accept","image/*"),this._domUpload.appendChild(this._domInput),this._domInsert=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert"]),this._domInsert.textContent=ContentEdit._("Insert"),a.appendChild(this._domInsert),this._domCancelUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--cancel"]),this._domCancelUpload.textContent=ContentEdit._("Cancel"),a.appendChild(this._domCancelUpload),this._domClear=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--clear"]),this._domClear.textContent=ContentEdit._("Clear"),a.appendChild(this._domClear),this._addDOMEventListeners(),this.dispatchEvent(this.createEvent("imageuploader.mount")),this.showImages()},d.prototype.populate=function(a,b){return this.hideImages(),this._imageURL=a,this._imageSize=b,this._domImage||(this._domImage=this.constructor.createDiv(["ct-image-dialog__image"]),this._domView.appendChild(this._domImage)),this._domImage.style["background-image"]="url("+a+")",this.state("populated")},d.prototype.progress=function(a){return void 0===a?this._progress:(this._progress=a,this.isMounted()?this._domProgress.style.width=this._progress+"%":void 0)},d.prototype.removeCropMarks=function(){if(this._cropMarks)return this._cropMarks.unmount(),this._cropMarks=null,ContentEdit.removeCSSClass(this._domCrop,"ct-control--active")},d.prototype.save=function(a,b,c){return a?this.dispatchEvent(this.createEvent("save",{imageURL:a,imageSize:b,imageAttrs:c})):this._imageSelected?this.dispatchEvent(this.createEvent("save",{imageURL:this._imageSelected.src,imageSize:this._imageSelected.size})):void 0},d.prototype.state=function(a){var b;if(void 0===a)return this._state;if(this._state!==a&&(b=this._state,this._state=a,this.isMounted()))return ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--"+this._state),ContentEdit.removeCSSClass(this._domElement,"ct-image-dialog--"+b)},d.prototype.unmount=function(){return d.__super__.unmount.call(this),this._domCancelUpload=null,this._domClear=null,this._domCrop=null,this._domInput=null,this._domInsert=null,this._domProgress=null,this._domRotateCCW=null,this._domRotateCW=null,this._domUpload=null,this.dispatchEvent(this.createEvent("imageuploader.unmount"))},d.prototype._addDOMEventListeners=function(){return d.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("change",function(a){return function(b){var c;if(c=b.target.files[0])return b.target.value="",b.target.value&&(b.target.type="text",b.target.type="file"),a.dispatchEvent(a.createEvent("imageuploader.fileready",{file:c}))}}(this)),this._domCancelUpload.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("imageuploader.cancelupload"))}}(this)),this._domClear.addEventListener("click",function(a){return function(b){return a.removeCropMarks(),a.dispatchEvent(a.createEvent("imageuploader.clear"))}}(this)),this._domInsert.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("imageuploader.save"))}}(this))},d}(b.DialogUI),c=function(a){function c(a){c.__super__.constructor.call(this),this._bounds=null,this._dragging=null,this._draggingOrigin=null,this._imageSize=a}return g(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-crop-marks"]),this._domClipper=this.constructor.createDiv(["ct-crop-marks__clipper"]),this._domElement.appendChild(this._domClipper),this._domRulers=[this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--top-left"]),this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--bottom-right"])],this._domClipper.appendChild(this._domRulers[0]),this._domClipper.appendChild(this._domRulers[1]),this._domHandles=[this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--top-left"]),this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--bottom-right"])],this._domElement.appendChild(this._domHandles[0]),this._domElement.appendChild(this._domHandles[1]),c.__super__.mount.call(this,a,b),this._fit(a)},c.prototype.region=function(){return[parseFloat(this._domHandles[0].style.top)/this._bounds[1],parseFloat(this._domHandles[0].style.left)/this._bounds[0],parseFloat(this._domHandles[1].style.top)/this._bounds[1],parseFloat(this._domHandles[1].style.left)/this._bounds[0]]},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domClipper=null,this._domHandles=null,this._domRulers=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domHandles[0].addEventListener("mousedown",function(a){return function(b){if(0===b.button)return a._startDrag(0,b.clientY,b.clientX)}}(this)),this._domHandles[1].addEventListener("mousedown",function(a){return function(b){if(0===b.button)return a._startDrag(1,b.clientY,b.clientX)}}(this))},c.prototype._drag=function(a,c){var d,e,f,g,h;if(null!==this._dragging)return ContentSelect.Range.unselectAll(),g=a-this._draggingOrigin[1],f=c-this._draggingOrigin[0],d=this._bounds[1],c=0,a=0,h=this._bounds[0],e=Math.min(Math.min(b.MIN_CROP,d),h),0===this._dragging?(d=parseInt(this._domHandles[1].style.top)-e,h=parseInt(this._domHandles[1].style.left)-e):(c=parseInt(this._domHandles[0].style.left)+e,a=parseInt(this._domHandles[0].style.top)+e),g=Math.min(Math.max(a,g),d),f=Math.min(Math.max(c,f),h),this._domHandles[this._dragging].style.top=g+"px",this._domHandles[this._dragging].style.left=f+"px",this._domRulers[this._dragging].style.top=g+"px",this._domRulers[this._dragging].style.left=f+"px"},c.prototype._fit=function(a){var b,c,d,e,f,g,h,i;return f=a.getBoundingClientRect(),i=f.width/this._imageSize[0],c=f.height/this._imageSize[1],e=Math.min(i,c),h=e*this._imageSize[0],b=e*this._imageSize[1],d=(f.width-h)/2,g=(f.height-b)/2,this._domElement.style.width=h+"px",this._domElement.style.height=b+"px",this._domElement.style.top=g+"px",this._domElement.style.left=d+"px",this._domHandles[0].style.top="0px",this._domHandles[0].style.left="0px",this._domHandles[1].style.top=b+"px",this._domHandles[1].style.left=h+"px",this._domRulers[0].style.top="0px",this._domRulers[0].style.left="0px",this._domRulers[1].style.top=b+"px",this._domRulers[1].style.left=h+"px",this._bounds=[h,b]},c.prototype._startDrag=function(a,b,c){var d;return d=this._domHandles[a],this._dragging=a,this._draggingOrigin=[c-parseInt(d.style.left),b-parseInt(d.style.top)],this._onMouseMove=function(a){return function(b){return a._drag(b.clientY,b.clientX)}}(this),document.addEventListener("mousemove",this._onMouseMove),this._onMouseUp=function(a){return function(b){return a._stopDrag()}}(this),document.addEventListener("mouseup",this._onMouseUp)},c.prototype._stopDrag=function(){return document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._dragging=null,this._draggingOrigin=null},c}(b.AnchoredComponentUI),b.LinkDialog=function(a){function b(a,c){null==a&&(a=""),null==c&&(c=""),b.__super__.constructor.call(this),this._href=a,this._target=c}var c;return g(b,a),c="_blank",b.prototype.mount=function(){return b.__super__.mount.call(this),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-anchored-dialog__input"),this._domInput.setAttribute("name","href"),this._domInput.setAttribute("placeholder",ContentEdit._("Enter a link")+"..."),this._domInput.setAttribute("type","text"),this._domInput.setAttribute("value",this._href),this._domElement.appendChild(this._domInput),this._domTargetButton=this.constructor.createDiv(["ct-anchored-dialog__target-button"]),this._domElement.appendChild(this._domTargetButton),this._target===c&&ContentEdit.addCSSClass(this._domTargetButton,"ct-anchored-dialog__target-button--active"),this._domButton=this.constructor.createDiv(["ct-anchored-dialog__button"]),this._domElement.appendChild(this._domButton),this._addDOMEventListeners()},b.prototype.save=function(){var a;return this.isMounted()?(a={href:this._domInput.value.trim()},this._target&&(a.target=this._target),this.dispatchEvent(this.createEvent("save",a))):void this.dispatchEvent(this.createEvent("save"))},b.prototype.show=function(){if(b.__super__.show.call(this),this._domInput.focus(),this._href)return this._domInput.select()},b.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),b.__super__.unmount.call(this),this._domButton=null,this._domInput=null},b.prototype._addDOMEventListeners=function(){return this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domTargetButton.addEventListener("click",function(a){return function(b){return b.preventDefault(),a._target===c?(a._target="",ContentEdit.removeCSSClass(a._domTargetButton,"ct-anchored-dialog__target-button--active")):(a._target=c,ContentEdit.addCSSClass(a._domTargetButton,"ct-anchored-dialog__target-button--active"))}}(this)),this._domButton.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.save()}}(this))},b}(b.AnchoredDialogUI),b.PropertiesDialog=function(c){function e(a){var b;this.element=a,e.__super__.constructor.call(this,"Properties"),this._attributeUIs=[],this._focusedAttributeUI=null,this._styleUIs=[],this._supportsCoding=this.element.content,"ListItem"!==(b=this.element.type())&&"TableCell"!==b||(this._supportsCoding=!0)}return g(e,c),e.prototype.caption=function(a){return void 0===a?this._caption:(this._caption=a,this._domCaption.textContent=ContentEdit._(a)+": "+this.element.tagName())},e.prototype.changedAttributes=function(){var a,c,d,e,f,g,h,i,j,k;for(c={},d={},j=this._attributeUIs,h=0,i=j.length;h<i;h++)a=j[h],e=a.name(),g=a.value(),""!==e&&(c[e.toLowerCase()]=!0,this.element.attr(e)!==g&&(d[e]=g));f=b.getRestrictedAtributes(this.element.tagName()),k=this.element.attributes();for(e in k)g=k[e],f&&-1!==f.indexOf(e.toLowerCase())||void 0===c[e]&&(d[e]=null);return d},e.prototype.changedStyles=function(){var a,b,c,d,e,f;for(c={},f=this._styleUIs,d=0,e=f.length;d<e;d++)b=f[d],a=b.style.cssClass(),this.element.hasCSSClass(a)!==b.applied()&&(c[a]=b.applied());return c},e.prototype.getElementInnerHTML=function(){return this._supportsCoding?this.element.content?this.element.content.html():this.element.children[0].content.html():null},e.prototype.mount=function(){var a,c,f,g,h,i,j,k,l,m,n,o,p,q,r;for(e.__super__.mount.call(this),
ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog"),ContentEdit.addCSSClass(this._domView,"ct-properties-dialog__view"),this._domStyles=this.constructor.createDiv(["ct-properties-dialog__styles"]),this._domStyles.setAttribute("data-ct-empty",ContentEdit._("No styles available for this tag")),this._domView.appendChild(this._domStyles),r=b.StylePalette.styles(this.element),n=0,p=r.length;n<p;n++)k=r[n],l=new d(k,this.element.hasCSSClass(k.cssClass())),this._styleUIs.push(l),l.mount(this._domStyles);this._domAttributes=this.constructor.createDiv(["ct-properties-dialog__attributes"]),this._domView.appendChild(this._domAttributes),j=b.getRestrictedAtributes(this.element.tagName()),c=this.element.attributes(),a=[];for(i in c)m=c[i],j&&-1!==j.indexOf(i.toLowerCase())||a.push(i);for(-1===a.indexOf("class")&&a.push("class"),a.sort(),o=0,q=a.length;o<q;o++)i=a[o],m=c[i],void 0===m&&(m=""),this._addAttributeUI(i,m);return this._addAttributeUI("",""),this._domCode=this.constructor.createDiv(["ct-properties-dialog__code"]),this._domView.appendChild(this._domCode),this._domInnerHTML=document.createElement("textarea"),this._domInnerHTML.setAttribute("class","ct-properties-dialog__inner-html"),this._domInnerHTML.setAttribute("name","code"),this._domInnerHTML.value=this.getElementInnerHTML(),this._domCode.appendChild(this._domInnerHTML),g=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(g),this._domStylesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--styles"]),this._domStylesTab.setAttribute("data-ct-tooltip",ContentEdit._("Styles")),g.appendChild(this._domStylesTab),this._domAttributesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--attributes"]),this._domAttributesTab.setAttribute("data-ct-tooltip",ContentEdit._("Attributes")),g.appendChild(this._domAttributesTab),this._domCodeTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--code"]),this._domCodeTab.setAttribute("data-ct-tooltip",ContentEdit._("Code")),g.appendChild(this._domCodeTab),this._supportsCoding||ContentEdit.addCSSClass(this._domCodeTab,"ct-control--muted"),this._domRemoveAttribute=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--remove","ct-control--muted"]),this._domRemoveAttribute.setAttribute("data-ct-tooltip",ContentEdit._("Remove")),g.appendChild(this._domRemoveAttribute),f=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(f),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent=ContentEdit._("Apply"),f.appendChild(this._domApply),h=window.localStorage.getItem("ct-properties-dialog-tab"),"attributes"===h?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--attributes"),ContentEdit.addCSSClass(this._domAttributesTab,"ct-control--active")):"code"===h&&this._supportsCoding?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--code"),ContentEdit.addCSSClass(this._domCodeTab,"ct-control--active")):(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--styles"),ContentEdit.addCSSClass(this._domStylesTab,"ct-control--active")),this._addDOMEventListeners()},e.prototype.save=function(){var a,b;return b=null,this._supportsCoding&&(b=this._domInnerHTML.value),a={changedAttributes:this.changedAttributes(),changedStyles:this.changedStyles(),innerHTML:b},this.dispatchEvent(this.createEvent("save",a))},e.prototype._addAttributeUI=function(c,d){var e,f;return f=this,e=new a(c,d),this._attributeUIs.push(e),e.addEventListener("blur",function(a){var b,c,d;if(f._focusedAttributeUI=null,ContentEdit.addCSSClass(f._domRemoveAttribute,"ct-control--muted"),b=f._attributeUIs.indexOf(this),d=f._attributeUIs.length,""===this.name()&&b<d-1&&(this.unmount(),f._attributeUIs.splice(b,1)),(c=f._attributeUIs[d-1])&&c.name()&&c.value())return f._addAttributeUI("","")}),e.addEventListener("focus",function(a){return f._focusedAttributeUI=this,ContentEdit.removeCSSClass(f._domRemoveAttribute,"ct-control--muted")}),e.addEventListener("namechange",function(a){var d,e,g,h,i,j,k;for(d=f.element,c=this.name().toLowerCase(),g=b.getRestrictedAtributes(d.tagName()),h=!0,g&&-1!==g.indexOf(c)&&(h=!1),k=f._attributeUIs,i=0,j=k.length;i<j;i++)e=k[i],""!==c&&e!==this&&e.name().toLowerCase()===c&&(h=!1);return this.valid(h),h?ContentEdit.removeCSSClass(f._domApply,"ct-control--muted"):ContentEdit.addCSSClass(f._domApply,"ct-control--muted")}),e.mount(this._domAttributes),e},e.prototype._addDOMEventListeners=function(){var a,b;return e.__super__._addDOMEventListeners.call(this),a=function(a){return function(b){var c,d,e,f,g,h;for(f=["attributes","code","styles"],g=0,h=f.length;g<h;g++)(d=f[g])!==b&&(e=d.charAt(0).toUpperCase()+d.slice(1),ContentEdit.removeCSSClass(a._domElement,"ct-properties-dialog--"+d),ContentEdit.removeCSSClass(a["_dom"+e+"Tab"],"ct-control--active"));return c=b.charAt(0).toUpperCase()+b.slice(1),ContentEdit.addCSSClass(a._domElement,"ct-properties-dialog--"+b),ContentEdit.addCSSClass(a["_dom"+c+"Tab"],"ct-control--active"),window.localStorage.setItem("ct-properties-dialog-tab",b)}}(this),this._domStylesTab.addEventListener("mousedown",function(b){return function(){return a("styles")}}()),this._domAttributesTab.addEventListener("mousedown",function(b){return function(){return a("attributes")}}()),this._supportsCoding&&this._domCodeTab.addEventListener("mousedown",function(b){return function(){return a("code")}}()),this._domRemoveAttribute.addEventListener("mousedown",function(a){return function(b){var c,d;if(b.preventDefault(),a._focusedAttributeUI&&(c=a._attributeUIs.indexOf(a._focusedAttributeUI),d=c===a._attributeUIs.length-1,a._focusedAttributeUI.unmount(),a._attributeUIs.splice(c,1),d))return a._addAttributeUI("","")}}(this)),b=function(a){return function(b){try{return new HTMLString.String(a._domInnerHTML.value),ContentEdit.removeCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")}catch(b){return ContentEdit.addCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted")}}}(this),this._domInnerHTML.addEventListener("input",b),this._domInnerHTML.addEventListener("propertychange",b),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},e}(b.DialogUI),d=function(a){function b(a,c){this.style=a,b.__super__.constructor.call(this),this._applied=c}return g(b,a),b.prototype.applied=function(a){if(void 0===a)return this._applied;if(this._applied!==a)return this._applied=a,this._applied?ContentEdit.addCSSClass(this._domElement,"ct-section--applied"):ContentEdit.removeCSSClass(this._domElement,"ct-section--applied")},b.prototype.mount=function(a,c){var d;return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-section"]),this._applied&&ContentEdit.addCSSClass(this._domElement,"ct-section--applied"),d=this.constructor.createDiv(["ct-section__label"]),d.textContent=this.style.name(),this._domElement.appendChild(d),this._domElement.appendChild(this.constructor.createDiv(["ct-section__switch"])),b.__super__.mount.call(this,a,c)},b.prototype._addDOMEventListeners=function(){var a;return a=function(a){return function(b){return b.preventDefault(),a.applied()?a.applied(!1):a.applied(!0)}}(this),this._domElement.addEventListener("click",a)},b}(b.AnchoredComponentUI),a=function(a){function b(a,c){b.__super__.constructor.call(this),this._initialName=a,this._initialValue=c}return g(b,a),b.prototype.name=function(){return this._domName.value.trim()},b.prototype.value=function(){return this._domValue.value.trim()},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-attribute"]),this._domName=document.createElement("input"),this._domName.setAttribute("class","ct-attribute__name"),this._domName.setAttribute("name","name"),this._domName.setAttribute("placeholder",ContentEdit._("Name")),this._domName.setAttribute("type","text"),this._domName.setAttribute("value",this._initialName),this._domElement.appendChild(this._domName),this._domValue=document.createElement("input"),this._domValue.setAttribute("class","ct-attribute__value"),this._domValue.setAttribute("name","value"),this._domValue.setAttribute("type","text"),this._domValue.setAttribute("value",this._initialValue),this._domElement.appendChild(this._domValue),b.__super__.mount.call(this,a,c)},b.prototype.valid=function(a){return a?ContentEdit.removeCSSClass(this._domName,"ct-attribute__name--invalid"):ContentEdit.addCSSClass(this._domName,"ct-attribute__name--invalid")},b.prototype._addDOMEventListeners=function(){return this._domName.addEventListener("blur",function(a){return function(){var b,c,d;if(b=a.name(),c=a._domElement.nextSibling,a.dispatchEvent(a.createEvent("blur")),""===b&&c)return d=c.querySelector(".ct-attribute__name"),d.focus()}}(this)),this._domName.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domName.addEventListener("input",function(a){return function(){return a.dispatchEvent(a.createEvent("namechange"))}}(this)),this._domName.addEventListener("keydown",function(a){return function(b){if(13===b.keyCode)return a._domValue.focus()}}(this)),this._domValue.addEventListener("blur",function(a){return function(){return a.dispatchEvent(a.createEvent("blur"))}}(this)),this._domValue.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domValue.addEventListener("keydown",function(a){return function(b){var c,d;if(13===b.keyCode||9===b.keyCode&&!b.shiftKey)return b.preventDefault(),c=a._domElement.nextSibling,c||(a._domValue.blur(),c=a._domElement.nextSibling),c?(d=c.querySelector(".ct-attribute__name"),d.focus()):void 0}}(this))},b}(b.AnchoredComponentUI),b.TableDialog=function(a){function b(a){this.table=a,this.table?b.__super__.constructor.call(this,"Update table"):b.__super__.constructor.call(this,"Insert table")}return g(b,a),b.prototype.mount=function(){var a,c,d,e,f,g,h;return b.__super__.mount.call(this),a={columns:3,foot:!1,head:!0},this.table&&(a={columns:this.table.firstSection().children[0].children.length,foot:this.table.tfoot(),head:this.table.thead()}),ContentEdit.addCSSClass(this._domElement,"ct-table-dialog"),ContentEdit.addCSSClass(this._domView,"ct-table-dialog__view"),h=["ct-section"],a.head&&h.push("ct-section--applied"),this._domHeadSection=this.constructor.createDiv(h),this._domView.appendChild(this._domHeadSection),f=this.constructor.createDiv(["ct-section__label"]),f.textContent=ContentEdit._("Table head"),this._domHeadSection.appendChild(f),this._domHeadSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domHeadSection.appendChild(this._domHeadSwitch),this._domBodySection=this.constructor.createDiv(["ct-section","ct-section--applied","ct-section--contains-input"]),this._domView.appendChild(this._domBodySection),c=this.constructor.createDiv(["ct-section__label"]),c.textContent=ContentEdit._("Table body (columns)"),this._domBodySection.appendChild(c),this._domBodyInput=document.createElement("input"),this._domBodyInput.setAttribute("class","ct-section__input"),this._domBodyInput.setAttribute("maxlength","2"),this._domBodyInput.setAttribute("name","columns"),this._domBodyInput.setAttribute("type","text"),this._domBodyInput.setAttribute("value",a.columns),this._domBodySection.appendChild(this._domBodyInput),g=["ct-section"],a.foot&&g.push("ct-section--applied"),this._domFootSection=this.constructor.createDiv(g),this._domView.appendChild(this._domFootSection),e=this.constructor.createDiv(["ct-section__label"]),e.textContent=ContentEdit._("Table foot"),this._domFootSection.appendChild(e),this._domFootSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domFootSection.appendChild(this._domFootSwitch),d=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(d),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent="Apply",d.appendChild(this._domApply),this._addDOMEventListeners()},b.prototype.save=function(){var a,b,c;return b=this._domFootSection.getAttribute("class"),c=this._domHeadSection.getAttribute("class"),a={columns:parseInt(this._domBodyInput.value),foot:b.indexOf("ct-section--applied")>-1,head:c.indexOf("ct-section--applied")>-1},this.dispatchEvent(this.createEvent("save",a))},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBodyInput=null,this._domBodySection=null,this._domApply=null,this._domHeadSection=null,this._domHeadSwitch=null,this._domFootSection=null,this._domFootSwitch=null},b.prototype._addDOMEventListeners=function(){var a;return b.__super__._addDOMEventListeners.call(this),a=function(a){return a.preventDefault(),this.getAttribute("class").indexOf("ct-section--applied")>-1?ContentEdit.removeCSSClass(this,"ct-section--applied"):ContentEdit.addCSSClass(this,"ct-section--applied")},this._domHeadSection.addEventListener("click",a),this._domFootSection.addEventListener("click",a),this._domBodySection.addEventListener("click",function(a){return function(b){return a._domBodyInput.focus()}}(this)),this._domBodyInput.addEventListener("input",function(a){return function(b){var c;return c=/^[1-9]\d{0,1}$/.test(b.target.value),c?(ContentEdit.removeCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")):(ContentEdit.addCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted"))}}(this)),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},b}(b.DialogUI),b.VideoDialog=function(a){function c(){c.__super__.constructor.call(this,"Insert video")}return g(c,a),c.prototype.clearPreview=function(){if(this._domPreview)return this._domPreview.parentNode.removeChild(this._domPreview),this._domPreview=void 0},c.prototype.mount=function(){var a;return c.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-video-dialog"),ContentEdit.addCSSClass(this._domView,"ct-video-dialog__preview"),a=this.constructor.createDiv(["ct-control-group"]),this._domControls.appendChild(a),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-video-dialog__input"),this._domInput.setAttribute("name","url"),this._domInput.setAttribute("placeholder",ContentEdit._("Paste YouTube or Vimeo URL")+"..."),this._domInput.setAttribute("type","text"),a.appendChild(this._domInput),this._domButton=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert","ct-control--muted"]),this._domButton.textContent=ContentEdit._("Insert"),a.appendChild(this._domButton),this._addDOMEventListeners()},c.prototype.preview=function(a){return this.clearPreview(),this._domPreview=document.createElement("iframe"),this._domPreview.setAttribute("frameborder","0"),this._domPreview.setAttribute("height","100%"),this._domPreview.setAttribute("src",a),this._domPreview.setAttribute("width","100%"),this._domView.appendChild(this._domPreview)},c.prototype.save=function(){var a,c;return c=this._domInput.value.trim(),a=b.getEmbedVideoURL(c),a?this.dispatchEvent(this.createEvent("save",{url:a})):this.dispatchEvent(this.createEvent("save",{url:c}))},c.prototype.show=function(){return c.__super__.show.call(this),this._domInput.focus()},c.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),c.__super__.unmount.call(this),this._domButton=null,this._domInput=null,this._domPreview=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("input",function(a){return function(c){var d;return c.target.value?ContentEdit.removeCSSClass(a._domButton,"ct-control--muted"):ContentEdit.addCSSClass(a._domButton,"ct-control--muted"),a._updatePreviewTimeout&&clearTimeout(a._updatePreviewTimeout),d=function(){var c,d;return d=a._domInput.value.trim(),c=b.getEmbedVideoURL(d),c?a.preview(c):a.clearPreview()},a._updatePreviewTimeout=setTimeout(d,500)}}(this)),this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domButton.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domButton.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},c}(b.DialogUI),b.HTMLCleaner=function(){function a(a,b){this.tagWhitelist=a||this.constructor.DEFAULT_TAG_WHITELIST,this.attributeWhitelist=b||this.constructor.DEFAULT_ATTRIBUTE_WHITELIST}return a.DEFAULT_ATTRIBUTE_WHITELIST={a:["href"],td:["colspan"]},a.DEFAULT_TAG_WHITELIST=["a","address","b","blockquote","code","del","em","h1","h2","h3","h4","h5","h6","i","ins","li","ol","p","pre","strong","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","#text"],a.NO_CONTENT_TAGS=["head","meta","style","script","title"],a.prototype.clean=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;for(j=document.implementation.createHTMLDocument(),m=j.createElement("div"),m.innerHTML=a,k=function(){var a,b,c,e;for(c=m.childNodes,e=[],a=0,b=c.length;a<b;a++)d=c[a],e.push(d);return e}();k.length>0;)if(f=k.shift(),g=f.nodeName.toLowerCase(),this.tagWhitelist.indexOf(g)<0){if(this.constructor.NO_CONTENT_TAGS.indexOf(g)>-1){f.remove();continue}for(r=f.childNodes,n=0,p=r.length;n<p;n++)(e=r[n])&&(e=e.cloneNode(!0),e.nodeName.toLowerCase(),f.parentNode.insertBefore(e,f),k.push(e));f.remove()}else if("#text"===g||""!==f.textContent.trim()){if("td"!==g&&"th"!==g&&"li"!==g||f.querySelector("p")&&(f.innerHTML=f.textContent),f.attributes)for(i=this.attributeWhitelist[g]||[],h=function(){var a,c,d,e;for(d=f.attributes,e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}(),o=0,q=h.length;o<q;o++)c=h[o],i.indexOf(c.name.toLowerCase())<0?f.removeAttribute(c.name):"href"===c.name.toLowerCase()&&(l=f.getAttribute(c.name),l.startsWith("javascript:"))&&f.removeAttribute(c.name);k.push.apply(k,function(){var a,b,c,e;for(c=f.childNodes,e=[],a=0,b=c.length;a<b;a++)d=c[a],e.push(d);return e}())}else""===f.textContent||f.parentNode===m?f.remove():f.parentNode.replaceChild(j.createTextNode(" "),f);return m.innerHTML},a}(),e=function(a){function c(){c.__super__.constructor.call(this),this.history=null,this._state="dormant",this._busy=!1,this._namingProp=null,this._fixtureTest=function(a){return a.hasAttribute("data-fixture")},this._regionQuery=null,this._domRegions=null,this._regions={},this._orderedRegions=[],this._rootLastModified=null,this._regionsLastModified={},this._ignition=null,this._inspector=null,this._toolbox=null,this._emptyRegionsAllowed=!1}return g(c,a),c.prototype.ctrlDown=function(){return this._ctrlDown},c.prototype.domRegions=function(){return this._domRegions},c.prototype.getState=function(){return this._state},c.prototype.ignition=function(){return this._ignition},c.prototype.inspector=function(){return this._inspector},c.prototype.isDormant=function(){return"dormant"===this._state},c.prototype.isReady=function(){return"ready"===this._state},c.prototype.isEditing=function(){return"editing"===this._state},c.prototype.orderedRegions=function(){var a;return function(){var b,c,d,e;for(d=this._orderedRegions,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(this._regions[a]);return e}.call(this)},c.prototype.regions=function(){return this._regions},c.prototype.shiftDown=function(){return this._shiftDown},c.prototype.toolbox=function(){return this._toolbox},c.prototype.busy=function(a){return void 0===a?this._busy:(this._busy=a,this._ignition?this._ignition.busy(a):void 0)},c.prototype.createPlaceholderElement=function(a){return new ContentEdit.Text("p",{},"")},c.prototype.init=function(a,c,d,e){return null==c&&(c="id"),null==d&&(d=null),null==e&&(e=!0),this._namingProp=c,d&&(this._fixtureTest=d),this.mount(),e&&(this._ignition=new b.IgnitionUI,this.attach(this._ignition),this._ignition.addEventListener("edit",function(a){return function(b){return b.preventDefault(),a.start(),a._ignition.state("editing")}}(this)),this._ignition.addEventListener("confirm",function(a){return function(b){if(b.preventDefault(),"editing"===a._ignition.state())return a._ignition.state("ready"),a.stop(!0)}}(this)),this._ignition.addEventListener("cancel",function(a){return function(b){if(b.preventDefault(),"editing"===a._ignition.state())return a.stop(!1),a.isEditing()?a._ignition.state("editing"):a._ignition.state("ready")}}(this))),this._toolbox=new b.ToolboxUI(b.DEFAULT_TOOLS),this.attach(this._toolbox),this._inspector=new b.InspectorUI,this.attach(this._inspector),this._state="ready",this._handleDetach=function(a){return function(b){return a._preventEmptyRegions()}}(this),this._handleClipboardPaste=function(a){return function(b,c){return null,c.clipboardData?void(c.clipboardData.getData("text/html")&&"PreText"!==b.type()?a.pasteHTML(b,c.clipboardData.getData("text/html")):a.pasteText(b,c.clipboardData.getData("text/plain"))):window.clipboardData?(window.clipboardData.getData("TEXT"),a.pasteText(b,window.clipboardData.getData("TEXT"))):void 0}}(this),this._handleNextRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i;if(f=a.orderedRegions(),!((e=f.indexOf(b))>=f.length-1)){for(b=f[e+1],d=null,i=b.descendants(),g=0,h=i.length;g<h;g++)if(c=i[g],void 0!==c.content){d=c;break}return d?(d.focus(),void d.selection(new ContentSelect.Range(0,0))):ContentEdit.Root.get().trigger("next-region",b)}}}(this),this._handlePreviousRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i,j;if(h=a.orderedRegions(),!((f=h.indexOf(b))<=0)){for(b=h[f-1],e=null,d=b.descendants(),d.reverse(),i=0,j=d.length;i<j;i++)if(c=d[i],void 0!==c.content){e=c;break}return e?(g=e.content.length(),e.focus(),void e.selection(new ContentSelect.Range(g,g))):ContentEdit.Root.get().trigger("previous-region",b)}}}(this),ContentEdit.Root.get().bind("detach",this._handleDetach),ContentEdit.Root.get().bind("paste",this._handleClipboardPaste),ContentEdit.Root.get().bind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().bind("previous-region",this._handlePreviousRegionTransition),this.syncRegions(a)},c.prototype.destroy=function(){return ContentEdit.Root.get().unbind("detach",this._handleDetach),ContentEdit.Root.get().unbind("paste",this._handleClipboardPaste),ContentEdit.Root.get().unbind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().unbind("previous-region",this._handlePreviousRegionTransition),this.removeEventListener(),this.unmount(),this._children=[]},c.prototype.highlightRegions=function(a){var b,c,d,e,f;for(e=this._domRegions,f=[],c=0,d=e.length;c<d;c++)b=e[c],a?f.push(ContentEdit.addCSSClass(b,"ct--highlight")):f.push(ContentEdit.removeCSSClass(b,"ct--highlight"));return f},c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-app"]),document.body.insertBefore(this._domElement,null),this._addDOMEventListeners()},c.prototype.unmount=function(){var a,b,c,d;if(this.isMounted()){for(d=this._children,b=0,c=d.length;b<c;b++)a=d[b],a.unmount();return this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,this._removeDOMEventListeners(),this._ignition=null,this._inspector=null,this._toolbox=null}},c.prototype.pasteHTML=function(a,c){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G;for(w=ContentEdit.TagNames.get(),u=document.implementation.createHTMLDocument(),A=u.createElement("div"),A.innerHTML=b.getHTMLCleaner().clean(c.trim()),f=[],F=A.childNodes,B=0,D=F.length;B<D;B++)(e=F[B])&&("#text"===e.nodeName.toLowerCase()&&""===e.textContent.trim()||f.push(e));if(f.length){if(l=b.INLINE_TAGS.slice(),l.push("#text"),j=f[0].nodeName.toLowerCase(),n=f[f.length-1].nodeName.toLowerCase(),a.isFixed()||l.indexOf(j)>-1&&l.indexOf(n)>-1){if(l.indexOf(j)>-1&&l.indexOf(n)>-1?c=new HTMLString.String(A.innerHTML):(console.log(A.textContent),c=new HTMLString.String(HTMLString.String.encode(A.textContent))),a.content)return v=a.selection(),g=v.get()[0]+c.length(),z=a.content.substring(0,v.get()[0]),y=a.content.substring(v.get()[1]),t=a.content.substring(v.get()[0],v.get()[1]),t.length()&&(d=t.characters[0],x=d.tags(),d.isTag()&&x.shift(),x.length>=1&&(c=c.format.apply(c,[0,c.length()].concat(i.call(x))))),a.content=z.concat(c),a.content=a.content.concat(y,!1),a.updateInnerHTML(),a.taint(),v.set(g,g),void a.selection(v);A.innerHTML="<p>"+c.html()+"</p>"}if(q=a,"Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),s=a.parent(),l.indexOf(j)>-1&&l.indexOf(n)>-1){for(m=A.createElement("p");A.childNodes.length>0;)m.appendChild(A.childNodes[0]);A.appendChild(m)}for(k=0,o=q,G=A.childNodes,C=0,E=G.length;C<E;C++)(p=G[C])&&("#text"===p.nodeName&&""===p.textContent.trim()||(h=w.match(p.nodeName),h===ContentEdit.Static&&(r=document.createElement("p"),r.appendChild(p),p=r,h=ContentEdit.Text),o=h.fromDOMElement(p),s.attach(o,s.children.indexOf(a)+(1+k)),k+=1));return o.focus?o.focus():o.nextSibling()?(o=o.nextSibling().previousWithTest(function(a){if(a.focus)return a}))?o.focus():void 0:(o=o.nextWithTest(function(a){if(a.focus)return a}),o?o.focus():q.focus())}},c.prototype.pasteText=function(a,b){var c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;if(p="PreText"!==a.type()?b.split("\n"):[b],p=p.filter(function(a){return""!==a.trim()})){if(e=HTMLString.String.encode,s=!0,w=a.type(),1===p.length&&(s=!1),"PreText"===w&&(s=!1),a.can("spawn")||(s=!1),s){for("ListItemText"===w?(j=a.parent(),h=a.parent().parent(),g=h.children.indexOf(j)+1):(j=a,"Region"!==j.parent().type()&&(j=a.closest(function(a){return"Region"===a.parent().type()})),h=j.parent(),g=h.children.indexOf(j)+1),f=x=0,y=p.length;x<y;f=++x)n=p[f],n=e(n),"ListItemText"===w?(k=new ContentEdit.ListItem,l=new ContentEdit.ListItemText(n),k.attach(l),m=l):(k=new ContentEdit.Text("p",{},n),m=k),h.attach(k,g+f);return o=m.content.length(),m.focus(),m.selection(new ContentSelect.Range(o,o))}return b=e(b),b=new HTMLString.String(b,"PreText"===w),r=a.selection(),d=r.get()[0]+b.length(),v=a.content.substring(0,r.get()[0]),u=a.content.substring(r.get()[1]),q=a.content.substring(r.get()[0],r.get()[1]),q.length()&&(c=q.characters[0],t=c.tags(),c.isTag()&&t.shift(),t.length>=1&&(b=b.format.apply(b,[0,b.length()].concat(i.call(t))))),a.content=v.concat(b),a.content=a.content.concat(u,!1),a.updateInnerHTML(),a.taint(),r.set(d,d),a.selection(r)}},c.prototype.revert=function(){var a;if(this.dispatchEvent(this.createEvent("revert")))return!(b.CANCEL_MESSAGE&&(a=ContentEdit._(b.CANCEL_MESSAGE),ContentEdit.Root.get().lastModified()>this._rootLastModified&&!window.confirm(a)))&&(this.revertToSnapshot(this.history.goTo(0),!1),!0)},c.prototype.revertToSnapshot=function(a,b){var c,d,e,f,g,h,i,j,k,l;null==b&&(b=!0),d=[],j=this._regions;for(e in j){for(f=j[e],k=f.children,h=0,i=k.length;h<i;h++)c=k[h],c.unmount();void 0!==a.regions[e]?1===f.children.length&&f.children[0].isFixed()?(g=this.constructor.createDiv(),g.innerHTML=a.regions[e],d.push(g.firstElementChild),f.domElement().parentNode.replaceChild(g.firstElementChild,f.domElement())):(d.push(f.domElement()),f.domElement().innerHTML=a.regions[e]):(f.domElement().remove(),delete this._regions[e])}if(this._domRegions=d,b){ContentEdit.Root.get().focused()&&ContentEdit.Root.get().focused().blur(),this._regions={},this.syncRegions(null,!0),ContentEdit.Root.get()._modified=a.rootModified,l=this._regions;for(e in l)f=l[e],a.regionModifieds[e]&&(f._modified=a.regionModifieds[e]);return this.history.replaceRegions(this._regions),this.history.restoreSelection(a),this._inspector.updateTags()}},c.prototype.save=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;if(this.dispatchEvent(this.createEvent("save",{passive:a}))){if(h=ContentEdit.Root.get(),h.focused()&&!a&&h.focused().blur(),h.lastModified()===this._rootLastModified&&a)return void this.dispatchEvent(this.createEvent("saved",{regions:{},passive:a}));c=[],e={},l=this._regions;for(f in l){if(g=l[f],d=g.html(),1===g.children.length&&"Fixture"===!g.type()&&(b=g.children[0],b.content&&!b.content.html()&&(d="")),!a){for(m=g.children,j=0,k=m.length;j<k;j++)b=m[j],b.unmount();1===g.children.length&&g.children[0].isFixed()?(i=this.constructor.createDiv(),i.innerHTML=d,c.push(i.firstElementChild),g.domElement().parentNode.replaceChild(i.firstElementChild,g.domElement())):(c.push(g.domElement()),g.domElement().innerHTML=d)}g.lastModified()!==this._regionsLastModified[f]&&(e[f]=d,this._regionsLastModified[f]=g.lastModified())}return this._domRegions=c,this.dispatchEvent(this.createEvent("saved",{regions:e,passive:a}))}},c.prototype.setRegionOrder=function(a){return this._orderedRegions=a.slice()},c.prototype.start=function(){if(this.dispatchEvent(this.createEvent("start")))return this.busy(!0),this.syncRegions(),this._initRegions(),this._preventEmptyRegions(),this._rootLastModified=ContentEdit.Root.get().lastModified(),this.history=new b.History(this._regions),this.history.watch(),this._state="editing",this._toolbox.show(),this._inspector.show(),this.busy(!1),this.dispatchEvent(this.createEvent("started"))},c.prototype.stop=function(a){var b;if(this.dispatchEvent(this.createEvent("stop",{save:a}))){if(b=ContentEdit.Root.get().focused(),b&&b.isMounted()&&void 0!==b._syncContent&&b._syncContent(),a)this.save();else if(!this.revert())return;return this.history.stopWatching(),this.history=null,this._toolbox.hide(),this._inspector.hide(),this._regions={},this._state="ready",ContentEdit.Root.get().focused()&&this._allowEmptyRegions(function(a){return function(){return ContentEdit.Root.get().focused().blur()}}()),this.dispatchEvent(this.createEvent("stopped"))}},c.prototype.syncRegions=function(a,b){if(a&&(this._regionQuery=a),this._domRegions=[],this._regionQuery&&("string"==typeof this._regionQuery||this._regionQuery instanceof String?this._domRegions=document.querySelectorAll(this._regionQuery):this._domRegions=this._regionQuery),"editing"===this._state&&(this._initRegions(b),this._preventEmptyRegions()),this._ignition)return this._domRegions.length?this._ignition.show():this._ignition.hide()},c.prototype._addDOMEventListeners=function(){return this._handleHighlightOn=function(a){return function(c){var d;if(17!==(d=c.keyCode)&&224!==d&&91!==d&&93!==d||(a._ctrlDown=!0),16===c.keyCode&&!a._ctrlDown){if(a._highlightTimeout)return;return a._shiftDown=!0,void(a._highlightTimeout=setTimeout(function(){return a.highlightRegions(!0)},b.HIGHLIGHT_HOLD_DURATION))}return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),this._handleHighlightOff=function(a){return function(b){var c;return 17===(c=b.keyCode)||224===c||91===c||93===c?void(a._ctrlDown=!1):16===b.keyCode?(a._shiftDown=!1,a._highlightTimeout&&(clearTimeout(a._highlightTimeout),a._highlightTimeout=null),a.highlightRegions(!1)):void 0}}(this),this._handleVisibility=function(a){return function(b){if(!document.hasFocus())return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),document.addEventListener("keydown",this._handleHighlightOn),document.addEventListener("keyup",this._handleHighlightOff),document.addEventListener("visibilitychange",this._handleVisibility),this._handleBeforeUnload=function(a){return function(c){var d;if("editing"===a._state&&b.CANCEL_MESSAGE)return d=ContentEdit._(b.CANCEL_MESSAGE),(c||window.event).returnValue=d,d}}(this),window.addEventListener("beforeunload",this._handleBeforeUnload),this._handleUnload=function(a){return function(b){return a.destroy()}}(this),
window.addEventListener("unload",this._handleUnload)},c.prototype._allowEmptyRegions=function(a){return this._emptyRegionsAllowed=!0,a(),this._emptyRegionsAllowed=!1},c.prototype._preventEmptyRegions=function(){var a,b,c,d,e,f,g,h,i,j,k;if(!this._emptyRegionsAllowed){i=this._regions,k=[];for(d in i){for(f=i[d],c=f.lastModified(),b=!1,j=f.children,g=0,h=j.length;g<h;g++)if(a=j[g],"Static"!==a.type()){b=!0;break}b||(e=this.createPlaceholderElement(f),f.attach(e),k.push(f._modified=c))}return k}},c.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keydown",this._handleHighlightOn),document.removeEventListener("keyup",this._handleHighlightOff),window.removeEventListener("beforeunload",this._handleBeforeUnload),window.removeEventListener("unload",this._handleUnload)},c.prototype._initRegions=function(a){var b,c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=!1),d={},c=[],this._orderedRegions=[],j=this._domRegions,e=h=0,i=j.length;h<i;e=++h)b=j[e],g=b.getAttribute(this._namingProp),g||(g=e),d[g]=!0,this._orderedRegions.push(g),this._regions[g]&&this._regions[g].domElement()===b||(this._fixtureTest(b)?this._regions[g]=new ContentEdit.Fixture(b):this._regions[g]=new ContentEdit.Region(b),c.push(this._regions[g].domElement()),a||(this._regionsLastModified[g]=this._regions[g].lastModified()));this._domRegions=c,k=this._regions,l=[];for(g in k)k[g],d[g]||(delete this._regions[g],delete this._regionsLastModified[g],f=this._orderedRegions.indexOf(g),f>-1?l.push(this._orderedRegions.splice(f,1)):l.push(void 0));return l},c}(b.ComponentUI),b.EditorApp=function(){function a(){}var c;return c=null,a.get=function(){var a;return a=b.EditorApp.getCls(),null!=c?c:c=new a},a.getCls=function(){return e},a}(),b.History=function(){function a(a){this._lastSnapshotTaken=null,this._regions={},this.replaceRegions(a),this._snapshotIndex=-1,this._snapshots=[],this._store()}return a.prototype.canRedo=function(){return this._snapshotIndex<this._snapshots.length-1},a.prototype.canUndo=function(){return this._snapshotIndex>0},a.prototype.index=function(){return this._snapshotIndex},a.prototype.length=function(){return this._snapshots.length},a.prototype.snapshot=function(){return this._snapshots[this._snapshotIndex]},a.prototype.goTo=function(a){return this._snapshotIndex=Math.min(this._snapshots.length-1,Math.max(0,a)),this.snapshot()},a.prototype.redo=function(){return this.goTo(this._snapshotIndex+1)},a.prototype.replaceRegions=function(a){var b,c,d;this._regions={},d=[];for(b in a)c=a[b],d.push(this._regions[b]=c);return d},a.prototype.restoreSelection=function(a){var b,c;if(a.selected)return c=this._regions[a.selected.region],b=c.descendants()[a.selected.element],b.focus(),b.selection&&a.selected.selection?b.selection(a.selected.selection):void 0},a.prototype.stopWatching=function(){if(this._watchInterval&&clearInterval(this._watchInterval),this._delayedStoreTimeout)return clearTimeout(this._delayedStoreTimeout)},a.prototype.undo=function(){return this.goTo(this._snapshotIndex-1)},a.prototype.watch=function(){var a;return this._lastSnapshotTaken=Date.now(),a=function(a){return function(){var b,c;if(null!==(c=ContentEdit.Root.get().lastModified())&&c>a._lastSnapshotTaken){if(a._delayedStoreRequested===c)return;return a._delayedStoreTimeout&&clearTimeout(a._delayedStoreTimeout),b=function(){return a._lastSnapshotTaken=c,a._store()},a._delayedStoreRequested=c,a._delayedStoreTimeout=setTimeout(b,500)}}}(this),this._watchInterval=setInterval(a,50)},a.prototype._store=function(){var a,b,c,d,e,f,g;e={regions:{},regionModifieds:{},rootModified:ContentEdit.Root.get().lastModified(),selected:null},f=this._regions;for(b in f)d=f[b],e.regions[b]=d.html(),e.regionModifieds[b]=d.lastModified();if(a=ContentEdit.Root.get().focused()){if(e.selected={},!(d=a.closest(function(a){return"Region"===a.type()||"Fixture"===a.type()})))return;g=this._regions;for(b in g)if(c=g[b],d===c){e.selected.region=b;break}e.selected.element=d.descendants().indexOf(a),a.selection&&(e.selected.selection=a.selection())}return this._snapshotIndex<this._snapshots.length-1&&(this._snapshots=this._snapshots.slice(0,this._snapshotIndex+1)),this._snapshotIndex++,this._snapshots.splice(this._snapshotIndex,0,e)},a}(),b.StylePalette=function(){function a(){}return a._styles=[],a.add=function(a){return this._styles=this._styles.concat(a)},a.styles=function(a){var b;return void 0===a?this._styles.slice():(b=a.tagName(),this._styles.filter(function(a){return!a._applicableTo||-1!==a._applicableTo.indexOf(b)}))},a}(),b.Style=function(){function a(a,b,c){this._name=a,this._cssClass=b,this._applicableTo=c||null}return a.prototype.applicableTo=function(){return this._applicableTo},a.prototype.cssClass=function(){return this._cssClass},a.prototype.name=function(){return this._name},a}(),b.ToolShelf=function(){function a(){}return a._tools={},a.stow=function(a,b){return this._tools[b]=a},a.fetch=function(a){if(!this._tools[a])throw new Error("`"+a+"` has not been stowed on the tool shelf");return this._tools[a]},a}(),b.Tool=function(){function a(){}return a.label="Tool",a.icon="tool",a.requiresElement=!0,a.canApply=function(a,b){return!1},a.isApplied=function(a,b){return!1},a.apply=function(a,b,c){throw new Error("Not implemented")},a.editor=function(){return b.EditorApp.get()},a.dispatchEditorEvent=function(a,b){return this.editor().dispatchEvent(this.editor().createEvent(a,b))},a._insertAt=function(a){var b,c;return c=a,"Region"!==c.parent().type()&&(c=a.closest(function(a){return"Region"===a.parent().type()})),b=c.parent().children.indexOf(c)+1,[c,b]},a}(),b.Tools.Bold=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"bold"),c.label="Bold",c.icon="bold",c.tagName="b",c.canApply=function(a,b){return!a.isGallery()&&(!!a.content&&(b&&!b.isCollapsed()))},c.isApplied=function(a,b){var c,d,e;return!(void 0===a.content||!a.content.length())&&(e=b.get(),c=e[0],d=e[1],c===d&&(d+=1),a.content.slice(c,d).hasTags(this.tagName,!0))},c.apply=function(a,b,c){var d,e,f,g;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return a.storeState(),g=b.get(),d=g[0],e=g[1],this.isApplied(a,b)?a.content=a.content.unformat(d,e,new HTMLString.Tag(this.tagName)):a.content=a.content.format(d,e,new HTMLString.Tag(this.tagName)),a.content.optimize(),a.updateInnerHTML(),a.taint(),a.restoreState(),c(!0),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Italic=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"italic"),c.label="Italic",c.icon="italic",c.tagName="i",c}(b.Tools.Bold),b.Tools.Underline=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"underline"),c.label="Underline",c.icon="underline",c.tagName="u",c}(b.Tools.Bold),b.Tools.Code=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"code"),c.label="Code",c.icon="preformatted",c.tagName="code",c}(b.Tools.Bold),b.Tools.Strike=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"strike"),c.label="Strikethrough",c.icon="strike",c.tagName="strike",c}(b.Tools.Bold),b.Tools.Link=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"link"),c.label="Link",c.icon="link",c.tagName="a",c.getAttr=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;if("Image"===b.type()){if(b.a)return b.a[a]}else{if(b.isFixed()&&"a"===b.tagName())return b.attr(a);for(m=c.get(),e=m[0],h=m[1],f=b.content.slice(e,h),n=f.characters,i=0,k=n.length;i<k;i++)if(d=n[i],d.hasTags("a"))for(o=d.tags(),j=0,l=o.length;j<l;j++)if(g=o[j],"a"===g.name())return g.attr(a)}return""},c.canApply=function(a,b){var c;return!a.isGallery()&&("Image"===a.type()||(!(!a.isFixed()||"a"!==a.tagName())||!!a.content&&(!!b&&!!(!b.isCollapsed()||(c=a.content.characters[b.get()[0]])&&c.hasTags("a")))))},c.isApplied=function(a,b){return"Image"===a.type()?a.a:!(!a.isFixed()||"a"!==a.tagName())||c.__super__.constructor.isApplied.call(this,a,b)},c.apply=function(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(t={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",t)){if(f=!1,"Image"===a.type())n=a.domElement().getBoundingClientRect();else if(a.isFixed()&&"a"===a.tagName())n=a.domElement().getBoundingClientRect();else{if(c.isCollapsed()){for(g=a.content.characters,r=c.get(0)[0],j=r;r>0&&g[r-1].hasTags("a");)r-=1;for(;j<g.length&&g[j].hasTags("a");)j+=1;c=new ContentSelect.Range(r,j),c.select(a.domElement())}a.storeState(),q=new HTMLString.Tag("span",{class:"ct--pseudo-select"}),u=c.get(),k=u[0],s=u[1],a.content=a.content.format(k,s,q),a.updateInnerHTML(),i=a.domElement(),l=i.getElementsByClassName("ct--pseudo-select"),n=l[0].getBoundingClientRect()}return e=b.EditorApp.get(),m=new b.ModalUI(!0,!0),m.addEventListener("click",function(){if(this.unmount(),h.hide(),a.content&&(a.content=a.content.unformat(k,s,q),a.updateInnerHTML(),a.restoreState()),d(f),f)return b.Tools.Link.dispatchEditorEvent("tool-applied",t)}),h=new b.LinkDialog(this.getAttr("href",a,c),this.getAttr("target",a,c)),v=b.getScrollPosition(),o=v[0],p=v[1],h.position([n.left+n.width/2+o,n.top+n.height/2+p]),h.addEventListener("save",function(b){var c,d,e,g,h,i,j,l,n;if(g=b.detail(),f=!0,"Image"===a.type()){if(d=["align-center","align-left","align-right"],g.href){for(a.a={href:g.href},a.a&&(a.a.class=a.a.class),g.target&&(a.a.target=g.target),i=0,l=d.length;i<l;i++)if(e=d[i],a.hasCSSClass(e)){a.removeCSSClass(e),a.a.class=e;break}}else{for(h=[],a.a.class&&(h=a.a.class.split(" ")),j=0,n=d.length;j<n;j++)if(e=d[j],h.indexOf(e)>-1){a.addCSSClass(e);break}a.a=null}a.unmount(),a.mount()}else a.isFixed()&&"a"===a.tagName()?a.attr("href",g.href):(a.content=a.content.unformat(k,s,"a"),g.href&&(c=new HTMLString.Tag("a",g),a.content=a.content.format(k,s,c),a.content.optimize()),a.updateInnerHTML());return a.taint(),m.dispatchEvent(m.createEvent("click"))}),e.attach(m),e.attach(h),m.show(),h.show()}},c}(b.Tools.Bold),b.Tools.Heading=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading"),c.label="Heading",c.icon="heading",c.tagName="h1",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&(void 0!==a.content&&-1!==["Text","PreText"].indexOf(a.type())))},c.isApplied=function(a,b){return!!a.content&&(-1!==["Text","PreText"].indexOf(a.type())&&a.tagName()===this.tagName)},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return a.storeState(),"PreText"===a.type()?(d=a.content.html().replace(/&nbsp;/g," "),g=new ContentEdit.Text(this.tagName,{},d),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(b)):(a.removeAttr("class"),a.tagName()===this.tagName?a.tagName("p"):a.tagName(this.tagName),a.restoreState()),this.dispatchEditorEvent("tool-applied",h),c(!0)},c}(b.Tool),b.Tools.Heading2=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading2"),c.icon=c.icon+"2",c.tagName="h2",c}(b.Tools.Heading),b.Tools.Heading3=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading3"),c.icon=c.icon+"3",c.tagName="h3",c}(b.Tools.Heading),b.Tools.Heading4=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading4"),c.icon=c.icon+"4",c.tagName="h4",c}(b.Tools.Heading),b.Tools.Heading5=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading5"),c.icon=c.icon+"5",c.tagName="h5",c}(b.Tools.Heading),b.Tools.Heading6=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading6"),c.icon=c.icon+"6",c.tagName="h6",c}(b.Tools.Heading),b.Tools.Paragraph=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"paragraph"),c.label="Paragraph",c.icon="paragraph",c.tagName="p",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&void 0!==a)},c.apply=function(a,d,e){var f,g,h,i;return f=this.editor().ctrlDown(),b.Tools.Heading.canApply(a)&&!f?c.__super__.constructor.apply.call(this,a,d,e):(i={tool:this,element:a,selection:d},this.dispatchEditorEvent("tool-apply",i)?("Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),h=a.parent(),g=new ContentEdit.Text("p"),h.attach(g,h.children.indexOf(a)+1),g.focus(),e(!0),this.dispatchEditorEvent("tool-applied",i)):void 0)},c}(b.Tools.Heading),b.Tools.Preformatted=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"preformatted"),c.label="Preformatted",c.icon="preformatted",c.tagName="pre",c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return"PreText"===a.type()?void b.Tools.Paragraph.apply(a,c,d):(h=a.content.text(),g=new ContentEdit.PreText("pre",{},HTMLString.String.encode(h)),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(c),d(!0),this.dispatchEditorEvent("tool-applied",i))},c}(b.Tools.Heading),b.Tools.AlignLeft=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-left"),c.label="Align left",c.icon="align-left",c.className="text-left",c.canApply=function(a,b){return!a.isGallery()&&("Image"===a.type()||void 0!==a.content)},c.isApplied=function(a,b){var c;return!!this.canApply(a)&&("ListItemText"!==(c=a.type())&&"TableCellText"!==c||(a=a.parent()),a.hasCSSClass(this.className))},c.apply=function(a,c,d){var e,f,g,h,i,j;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g)){for("ListItemText"!==(j=a.type())&&"TableCellText"!==j||(a=a.parent()),e=[b.Tools.AlignLeft.className,b.Tools.AlignCenter.className,b.Tools.AlignRight.className],h=0,i=e.length;h<i;h++)if(f=e[h],a.hasCSSClass(f)&&(a.removeCSSClass(f),f===this.className))return d(!0);return a.addCSSClass(this.className),d(!0),this.dispatchEditorEvent("tool-applied",g)}},c}(b.Tool),b.Tools.AlignCenter=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-center"),c.label="Align center",c.icon="align-center",c.className="text-center",c}(b.Tools.AlignLeft),b.Tools.AlignRight=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-right"),c.label="Align right",c.icon="align-right",c.className="text-right",c}(b.Tools.AlignLeft),b.Tools.UnorderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unordered-list"),c.label="Bullet list",c.icon="unordered-list",c.listTag="ul",c.canApply=function(a,b){var c;return!a.isGallery()&&(!a.isFixed()&&(void 0!==a.content&&("Region"===(c=a.parent().type())||"ListItem"===c)))},c.apply=function(a,b,c){var d,e,f,g,h,i;if(i={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",i))return"ListItem"===a.parent().type()?(a.storeState(),e=a.closest(function(a){return"List"===a.type()}),e.tagName(this.listTag),a.restoreState()):(g=new ContentEdit.ListItemText(a.content.copy()),f=new ContentEdit.ListItem,f.attach(g),e=new ContentEdit.List(this.listTag,{}),e.attach(f),h=a.parent(),d=h.children.indexOf(a),h.detach(a),h.attach(e,d),g.focus(),g.selection(b)),c(!0),this.dispatchEditorEvent("tool-applied",i)},c}(b.Tool),b.Tools.OrderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"ordered-list"),c.label="Numbers list",c.icon="ordered-list",c.listTag="ol",c}(b.Tools.UnorderedList),b.Tools.Table=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"table"),c.label="Table",c.icon="table",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&void 0!==a)},c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,h=a.closest(function(a){return a&&"Table"===a.type()}),f=new b.TableDialog(h),f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,j,k,l,m;return l=c.detail(),j=!0,h?(b._updateTable(l,h),j=a.closest(function(a){return a&&"Table"===a.type()})):(h=b._createTable(l),m=b._insertAt(a),k=m[0],e=m[1],k.parent().attach(h,e),j=!1),j?a.restoreState():h.firstSection().children[0].children[0].children[0].focus(),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",i)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c._adjustColumns=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;for(l=a.children,m=[],j=0,k=l.length;j<k;j++)i=l[j],d=i.children[0].tagName(),f=i.children.length,g=b-f,g<0?m.push(function(){var a,b;for(b=[],h=a=g;g<=0?a<0:a>0;h=g<=0?++a:--a)c=i.children[i.children.length-1],b.push(i.detach(c));return b}()):g>0?m.push(function(){var a,b;for(b=[],h=a=0;0<=g?a<g:a>g;h=0<=g?++a:--a)c=new ContentEdit.TableCell(d),i.attach(c),e=new ContentEdit.TableCellText(""),b.push(c.attach(e));return b}()):m.push(void 0);return m},c._createTable=function(a){var b,c,d,e;return e=new ContentEdit.Table,a.head&&(d=this._createTableSection("thead","th",a.columns),e.attach(d)),b=this._createTableSection("tbody","td",a.columns),e.attach(b),a.foot&&(c=this._createTableSection("tfoot","td",a.columns),e.attach(c)),e},c._createTableSection=function(a,b,c){var d,e,f,g,h;for(g=new ContentEdit.TableSection(a),f=new ContentEdit.TableRow,g.attach(f),h=0;0<=c?h<c:h>c;0<=c?++h:--h)d=new ContentEdit.TableCell(b),f.attach(d),e=new ContentEdit.TableCellText(""),d.attach(e);return g},c._updateTable=function(a,b){var c,d,e,f,g,h,i;if(!a.head&&b.thead()&&b.detach(b.thead()),!a.foot&&b.tfoot()&&b.detach(b.tfoot()),c=b.firstSection().children[0].children.length,a.columns!==c)for(i=b.children,g=0,h=i.length;g<h;g++)f=i[g],this._adjustColumns(f,a.columns);if(a.head&&!b.thead()&&(e=this._createTableSection("thead","th",a.columns),b.attach(e,0)),a.foot&&!b.tfoot())return d=this._createTableSection("tfoot","td",a.columns),b.attach(d)},c}(b.Tool),b.Tools.Indent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"indent"),c.label="Indent",c.icon="indent",c.canApply=function(a,b){return!a.isGallery()&&("ListItem"===a.parent().type()&&a.parent().parent().children.indexOf(a.parent())>0)},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().indent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.Unindent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unindent"),c.label="Unindent",c.icon="unindent",c.canApply=function(a,b){return!a.isGallery()&&"ListItem"===a.parent().type()},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().unindent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.LineBreak=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"line-break"),c.label="Line break",c.icon="line-break",c.canApply=function(a,b){return!a.isGallery()&&a.content},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return e=b.get()[0]+1,g=a.content.substring(0,b.get()[0]),f=a.content.substring(b.get()[1]),d=f&&f.characters&&f.characters.length?new HTMLString.String("<br>",a.content.preserveWhitespace()):new HTMLString.String("<br><br>",a.content.preserveWhitespace()),a.content=g.concat(d,f),a.updateInnerHTML(),a.taint(),b.set(e,e),a.selection(b),c(!0),this.dispatchEditorEvent("tool-applied",h)},c}(b.Tool),b.Tools.Image=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"image"),c.label="Image",c.icon="image",c.canApply=function(a,b){return!a.isFixed()||"ImageFixture"===a.type()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.ImageDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,i,j,k,l,m,n,o;return e=c.detail(),l=e.imageURL,k=e.imageSize,j=e.imageAttrs,j||(j={}),j.height=k[1],j.src=l,j.width=k[0],"ImageFixture"===a.type()?a.src(l):(i=new ContentEdit.Image(j),o=b._insertAt(a),n=o[0],m=o[1],n.parent().attach(i,m),i.focus()),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Video=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"video"),c.label="Video",c.icon="video",c.canApply=function(a,b){return!a.isGallery()&&!a.isFixed()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.VideoDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(c){return function(e){var i,j,k,l,m,n;if(l=e.detail().url,l?(m=new ContentEdit.Video("iframe",{frameborder:0,height:b.DEFAULT_VIDEO_HEIGHT,src:l,width:b.DEFAULT_VIDEO_WIDTH,'allowfullscreen':'allowfullscreen'}),n=c._insertAt(a),k=n[0],j=n[1],k.parent().attach(m,j),m.focus()):a.restoreState&&a.restoreState(),g.hide(),f.hide(),i=""!==l,d(i),i)return c.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Undo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"undo"),c.label="Undo",c.icon="undo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canUndo()},c.apply=function(a,b,c){var d,e,f;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return d=this.editor(),d.history.stopWatching(),e=d.history.undo(),d.revertToSnapshot(e),d.history.watch(),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Redo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"redo"),c.label="Redo",c.icon="redo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canRedo()},c.apply=function(a,c,d){var e,f,g;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g))return e=b.EditorApp.get(),e.history.stopWatching(),f=e.history.redo(),e.revertToSnapshot(f),e.history.watch(),this.dispatchEditorEvent("tool-applied",g)},c}(b.Tool),b.Tools.Remove=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"remove"),c.label="Remove",c.icon="remove",c.canApply=function(a,b){return!a.isFixed()},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h)){if(d=this.editor(),a.blur(),a.nextContent()?a.nextContent().focus():a.previousContent()&&a.previousContent().focus(),!a.isMounted())return c(!0),void this.dispatchEditorEvent("tool-applied",h);switch(a.type()){case"ListItemText":d.ctrlDown()?(e=a.closest(function(a){return"Region"===a.parent().type()}),e.parent().detach(e)):a.parent().parent().detach(a.parent());break;case"TableCellText":d.ctrlDown()?(g=a.closest(function(a){return"Table"===a.type()}),g.parent().detach(g)):(f=a.parent().parent(),f.parent().detach(f));break;default:a.parent().detach(a)}return c(!0),this.dispatchEditorEvent("tool-applied",h)}},c}(b.Tool)}.call(this);
/*! volt-editor v2.0.4 */
(function(){var a;a={},a.Machine=function(){function a(a){this.context=a,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return a.prototype.addTransition=function(a,b,c,d){return c||(c=b),this._stateTransitions[[a,b]]=[c,d]},a.prototype.addTransitions=function(a,b,c,d){var e,f,g,h;for(c||(c=b),h=[],f=0,g=a.length;f<g;f++)e=a[f],h.push(this.addTransition(e,b,c,d));return h},a.prototype.addTransitionAny=function(a,b,c){return b||(b=a),this._stateTransitionsAny[a]=[b,c]},a.prototype.setDefaultTransition=function(a,b){return this._defaultTransition=[a,b]},a.prototype.getTransition=function(a,b){if(this._stateTransitions[[a,b]])return this._stateTransitions[[a,b]];if(this._stateTransitionsAny[b])return this._stateTransitionsAny[b];if(this._defaultTransition)return this._defaultTransition;throw new Error("Transition is undefined: ("+a+", "+b+")")},a.prototype.getCurrentState=function(){return this._currentState},a.prototype.setInitialState=function(a){if(this._initialState=a,!this._currentState)return this.reset()},a.prototype.reset=function(){return this._currentState=this._initialState},a.prototype.process=function(a){var b;return b=this.getTransition(a,this._currentState),b[1]&&b[1].call(this.context||(this.context=this),a),this._currentState=b[0]},a}(),"undefined"!=typeof window&&(window.FSM=a),"undefined"!=typeof module&&module.exports&&(module.exports=a)}).call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A=[].slice,B=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};r={},"undefined"!=typeof window&&(window.HTMLString=r),"undefined"!=typeof module&&module.exports&&(module.exports=r),r.String=function(){function a(a,b){null==b&&(b=!1),this._preserveWhitespace=b,a?(null===r.String._parser&&(r.String._parser=new z),this.characters=r.String._parser.parse(a,this._preserveWhitespace).characters):this.characters=[]}return a._parser=null,a.prototype.isWhitespace=function(){var a,b,c,d;for(d=this.characters,b=0,c=d.length;b<c;b++)if(a=d[b],!a.isWhitespace())return!1;return!0},a.prototype.length=function(){return this.characters.length},a.prototype.preserveWhitespace=function(){return this._preserveWhitespace},a.prototype.capitalize=function(){var a,b;return b=this.copy(),b.length()&&(a=b.characters[0]._c.toUpperCase(),b.characters[0]._c=a),b},a.prototype.charAt=function(a){return this.characters[a].copy()},a.prototype.concat=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(g=2<=arguments.length?A.call(arguments,0,i=arguments.length-1):(i=0,[]),c=arguments[i++],void 0!==c&&"boolean"!=typeof c&&(g.push(c),c=!0),e=this.copy(),j=0,m=g.length;j<m;j++)if(f=g[j],0!==f.length){if(h=f,"string"==typeof f&&(h=new r.String(f,this._preserveWhitespace)),c&&e.length())for(b=e.charAt(e.length()-1),d=b.tags(),b.isTag()&&d.shift(),"string"!=typeof f&&(h=h.copy()),p=h.characters,k=0,n=p.length;k<n;k++)a=p[k],a.addTags.apply(a,d);for(q=h.characters,l=0,o=q.length;l<o;l++)a=q[l],e.characters.push(a)}return e},a.prototype.contains=function(a){var b,c,d,e,f,g,h;if("string"==typeof a)return this.text().indexOf(a)>-1;for(d=0;d<=this.length()-a.length();){for(c=!0,h=a.characters,e=f=0,g=h.length;f<g;e=++f)if(b=h[e],!b.eq(this.characters[e+d])){c=!1;break}if(c)return!0;d++}return!1},a.prototype.endsWith=function(a){var b,c,d,e,f,g;if("string"==typeof a)return""===a||this.text().slice(-a.length)===a;for(c=this.characters.slice().reverse(),g=a.characters.slice().reverse(),d=e=0,f=g.length;e<f;d=++e)if(b=g[d],!b.eq(c[d]))return!1;return!0},a.prototype.format=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?A.call(arguments,2):[],f<0&&(f=this.length()+f+1),b<0&&(b=this.length()+b),d=this.copy(),c=g=b;b<=f?g<f:g>f;c=b<=f?++g:--g)a=d.characters[c],a.addTags.apply(a,e);return d},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h;for(d=2<=arguments.length?A.call(arguments,0,e=arguments.length-1):(e=0,[]),c=arguments[e++],void 0!==c&&"boolean"!=typeof c&&(d.push(c),c=!1),b=!1,h=this.characters,f=0,g=h.length;f<g;f++)if(a=h[f],a.hasTags.apply(a,d))b=!0;else if(c)return!1;return b},a.prototype.html=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;for(e="",h=[],f=[],c=[],t=this.characters,j=0,n=t.length;j<n;j++){for(a=t[j],c=[],u=h.slice().reverse(),k=0,o=u.length;k<o;k++)if(g=u[k],c.push(g),!a.hasTags(g)){for(l=0,p=c.length;l<p;l++)b=c[l],e+=b.tail(),h.pop(),f.pop();c=[]}for(v=a._tags,m=0,q=v.length;m<q;m++)i=v[m],-1===f.indexOf(i.head())&&(i.selfClosing()||(d=i.head(),e+=d,h.push(i),f.push(d)));a._tags.length>0&&a._tags[0].selfClosing()&&(e+=a._tags[0].head()),e+=a.c()}for(w=h.reverse(),s=0,r=w.length;s<r;s++)i=w[s],e+=i.tail();return e},a.prototype.indexOf=function(a,b){var c,d,e,f,g,h;if(null==b&&(b=0),b<0&&(b=0),"string"==typeof a)return this.text().indexOf(a,b);for(;b<=this.length()-a.length();){for(d=!0,h=a.characters,e=f=0,g=h.length;f<g;e=++f)if(c=h[e],!c.eq(this.characters[e+b])){d=!1;break}if(d)return b;b++}return-1},a.prototype.insert=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t;if(null==c&&(c=!0),e=this.slice(0,a),j=this.slice(a),a<0&&(a=this.length()+a),h=b,"string"==typeof b&&(h=new r.String(b,this._preserveWhitespace)),c&&a>0)for(f=this.charAt(a-1),g=f.tags(),f.isTag()&&g.shift(),"string"!=typeof b&&(h=h.copy()),q=h.characters,k=0,n=q.length;k<n;k++)d=q[k],d.addTags.apply(d,g);for(i=e,s=h.characters,l=0,o=s.length;l<o;l++)d=s[l],i.characters.push(d);for(t=j.characters,m=0,p=t.length;m<p;m++)d=t[m],i.characters.push(d);return i},a.prototype.lastIndexOf=function(a,b){var c,d,e,f,g,h,i,j,k;if(null==b&&(b=0),b<0&&(b=0),d=this.characters.slice(b).reverse(),b=0,"string"==typeof a){if(!this.contains(a))return-1;for(a=a.split("").reverse();b<=d.length-a.length;){for(e=!0,g=0,f=h=0,j=a.length;h<j;f=++h)if(c=a[f],d[f+b].isTag()&&(g+=1),c!==d[g+f+b].c()){e=!1;break}if(e)return b;b++}return-1}for(a=a.characters.slice().reverse();b<=d.length-a.length;){for(e=!0,f=i=0,k=a.length;i<k;f=++i)if(c=a[f],!c.eq(d[f+b])){e=!1;break}if(e)return b;b++}return-1},a.prototype.optimize=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I;for(h=[],f=[],d=null,C=this.characters.slice().reverse(),o=0,s=C.length;o<s;o++){for(a=C[o],a._runLengthMap={},a._runLengthMapSize=0,b=[],D=h.slice().reverse(),p=0,t=D.length;p<t;p++)if(g=D[p],b.push(g),!a.hasTags(g)){for(q=0,u=b.length;q<u;q++)b[q],h.pop(),f.pop();b=[]}for(E=a._tags,r=0,v=E.length;r<v;r++)n=E[r],-1===f.indexOf(n.head())&&(n.selfClosing()||(h.push(n),f.push(n.head())));for(z=0,w=h.length;z<w;z++)n=h[z],c=n.head(),d?(a._runLengthMap[c]||(a._runLengthMap[c]=[n,0]),l=0,d._runLengthMap[c]&&(l=d._runLengthMap[c][1]),a._runLengthMap[c][1]=l+1):a._runLengthMap[c]=[n,1];d=a}for(j=function(a,b){return b[1]-a[1]},F=this.characters,I=[],A=0,x=F.length;A<x;A++)if(a=F[A],!((e=a._tags.length)>0&&a._tags[0].selfClosing()&&e<3||e<2)){k=[],G=a._runLengthMap;for(n in G)i=G[n],k.push(i);for(k.sort(j),H=a._tags.slice(),B=0,y=H.length;B<y;B++)n=H[B],n.selfClosing()||a.removeTags(n);I.push(a.addTags.apply(a,function(){var a,b,c;for(c=[],b=0,a=k.length;b<a;b++)m=k[b],c.push(m[0]);return c}()))}return I},a.prototype.slice=function(a,b){var c,d;return d=new r.String("",this._preserveWhitespace),d.characters=function(){var d,e,f,g;for(f=this.characters.slice(a,b),g=[],d=0,e=f.length;d<e;d++)c=f[d],g.push(c.copy());return g}.call(this),d},a.prototype.split=function(a,b){var c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=""),null==b&&(b=0),h=0,c=0,g=[0];;){if(b>0&&c>b)break;if(-1===(f=this.indexOf(a,h)))break;g.push(f),h=f+1}for(g.push(this.length()),j=[],e=k=0,l=g.length-2;0<=l?k<=l:k>=l;e=0<=l?++k:--k)i=g[e],e>0&&(i+=1),d=g[e+1],j.push(this.slice(i,d));return j},a.prototype.startsWith=function(a){var b,c,d,e,f;if("string"==typeof a)return this.text().slice(0,a.length)===a;for(f=a.characters,c=d=0,e=f.length;d<e;c=++d)if(b=f[c],!b.eq(this.characters[c]))return!1;return!0},a.prototype.substr=function(a,b){return b<=0?new r.String("",this._preserveWhitespace):(a<0&&(a=this.length()+a),void 0===b&&(b=this.length()-a),this.slice(a,a+b))},a.prototype.substring=function(a,b){return void 0===b&&(b=this.length()),this.slice(a,b)},a.prototype.text=function(){var a,b,c,d,e;for(b="",e=this.characters,c=0,d=e.length;c<d;c++)a=e[c],a.isTag()?a.isTag("br")&&(b+="\n"):(a.c(),b+=a.c());return this.constructor.decode(b)},a.prototype.toLowerCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;c<d;c++)a=e[c],1===a._c.length&&(a._c=a._c.toLowerCase());return b},a.prototype.toUpperCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;c<d;c++)a=e[c],1===a._c.length&&(a._c=a._c.toUpperCase());return b},a.prototype.trim=function(){var a,b,c,d,e,f,g,h,i,j;for(i=this.characters,b=e=0,g=i.length;e<g&&(a=i[b],a.isWhitespace());b=++e);for(j=this.characters.slice().reverse(),d=f=0,h=j.length;f<h&&(a=j[d],a.isWhitespace());d=++f);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimLeft=function(){var a,b,c,d,e,f,g;for(d=this.length()-1,g=this.characters,b=e=0,f=g.length;e<f&&(a=g[b],a.isWhitespace());b=++e);return c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimRight=function(){var a,b,c,d,e,f,g;for(b=0,g=this.characters.slice().reverse(),d=e=0,f=g.length;e<f&&(a=g[d],a.isWhitespace());d=++e);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;c<e;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.unformat=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?A.call(arguments,2):[],f<0&&(f=this.length()+f+1),b<0&&(b=this.length()+b),d=this.copy(),c=g=b;b<=f?g<f:g>f;c=b<=f?++g:--g)a=d.characters[c],a.removeTags.apply(a,e);return d},a.prototype.copy=function(){var a,b;return b=new r.String("",this._preserveWhitespace),b.characters=function(){var b,c,d,e;for(d=this.characters,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this),b},a.decode=function(a){var b;return b=document.createElement("textarea"),b.innerHTML=a,b.textContent},a.encode=function(a){var b;return b=document.createElement("textarea"),b.textContent=a,b.innerHTML},a.join=function(a,b){var c,d,e,f;for(c=b.shift(),e=0,f=b.length;e<f;e++)d=b[e],c=c.concat(a,d);return c},a}(),a="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$".split(""),b=a.concat("1234567890".split("")),h=b.concat([":"]),q=b.concat(["#"]),u=b.concat([":"]),n=1,p=2,t=3,s=4,o=5,x=6,v=7,y=8,w=9,j=10,g=11,i=12,c=13,m=14,k=15,l=16,e=17,f=18,d=19,z=function(){function z(){this.fsm=new FSM.Machine(this),this.fsm.setInitialState(n),this.fsm.addTransitionAny(n,null,function(a){return this._pushChar(a)}),this.fsm.addTransition("<",n,t),this.fsm.addTransition("&",n,p),this.fsm.addTransitions(q,p,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",p,n,function(){return this._pushChar("&"+this.entity+";"),this.entity=""}),this.fsm.addTransitions([" ","\n"],t),this.fsm.addTransitions(a,t,s,function(){return this._back()}),this.fsm.addTransition("/",t,o),this.fsm.addTransitions([" ","\n"],s),this.fsm.addTransitions(a,s,x,function(){return this._back()}),this.fsm.addTransitions([" ","\n"],o),this.fsm.addTransitions(a,o,v,function(){return this._back()}),this.fsm.addTransitions(u,x,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],x,j),this.fsm.addTransition("/",x,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",x,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],y),this.fsm.addTransition(">",y,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],j),this.fsm.addTransition("/",j,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",j,n,function(){return this._pushTag()}),this.fsm.addTransitions(a,j,g,function(){return this._back()}),this.fsm.addTransitions(u,v,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],v,w),this.fsm.addTransition(">",v,n,function(){return this._popTag()}),this.fsm.addTransitions([" ","\n"],w),this.fsm.addTransition(">",w,n,function(){return this._popTag()}),this.fsm.addTransitions(h,g,null,function(a){return this.attributeName+=a}),this.fsm.addTransitions([" ","\n"],g,i),this.fsm.addTransition("=",g,c),this.fsm.addTransitions([" ","\n"],i),this.fsm.addTransition("=",i,c),this.fsm.addTransitions(">",g,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(i,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ","\n"],c),this.fsm.addTransition("'",c,m),this.fsm.addTransition('"',c,k),this.fsm.addTransitions(b.concat(["&"],c,l,function(){return this._back()})),this.fsm.addTransition(" ",l,j,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],l,j,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",l,e),this.fsm.addTransitionAny(l,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition("'",m,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",m,f),this.fsm.addTransitionAny(m,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition('"',k,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",k,d),this.fsm.addTransitionAny(k,null,function(a){return this.attributeValue+=a}),this.fsm.addTransitions(q,e,null,function(a){return this.entity+=a}),this.fsm.addTransitions(q,f,function(a){return this.entity+=a}),this.fsm.addTransitions(q,d,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",e,l,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",f,m,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",d,k,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return z.prototype._back=function(){return this.head--},z.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},z.prototype._pushChar=function(a){var b,c;return b=new r.Character(a,this.tags),this._preserveWhitespace?void this.string.characters.push(b):!this.string.length()||b.isTag()||b.isEntity()||!b.isWhitespace()||(c=this.string.characters[this.string.length()-1],!c.isWhitespace()||c.isTag()||c.isEntity())?this.string.characters.push(b):void 0},z.prototype._pushTag=function(){var a,b;return a=new r.Tag(this.tagName,this.attributes),this.tags.push(a),a.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(b=this.tagName,B.call(r.Tag.SELF_CLOSING,b)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},z.prototype._popTag=function(){for(var a,b;;)if(b=this.tags.pop(),this.string.length()&&(a=this.string.characters[this.string.length()-1],a.isTag()||a.isEntity()||!a.isWhitespace()||a.removeTags(b)),b.name()===this.tagName.toLowerCase())break;return this.tagName=""},z.prototype.parse=function(a,b){var c,d;for(this._preserveWhitespace=b,this.reset(),a=this.preprocess(a),this.fsm.parser=this;this.head<a.length;){c=a[this.head];try{this.fsm.process(c)}catch(a){throw d=a,new Error("Error at char "+this.head+" >> "+d)}this.head++}return this.string},z.prototype.preprocess=function(a){return a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),a=a.replace(/<!--[\s\S]*?-->/g,""),this._preserveWhitespace||(a=a.replace(/\s+/g," ")),a},z.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new r.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},z}(),r.Tag=function(){function a(a,b){var c,d;this._name=a.toLowerCase(),this._selfClosing=!0===r.Tag.SELF_CLOSING[this._name],this._head=null,this._attributes={};for(c in b)d=b[c],this._attributes[c]=d}return a.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},a.prototype.head=function(){var a,b,c,d;if(!this._head){a=[],d=this._attributes;for(b in d)c=d[b],c?a.push(b+'="'+c+'"'):a.push(""+b);a.sort(),a.unshift(this._name),this._head="<"+a.join(" ")+">"}return this._head},a.prototype.name=function(){return this._name},a.prototype.selfClosing=function(){return this._selfClosing},a.prototype.tail=function(){return this._selfClosing?"":"</"+this._name+">"},a.prototype.attr=function(a,b){return void 0===b?this._attributes[a]:(this._attributes[a]=b,this._head=null)},a.prototype.removeAttr=function(a){if(void 0!==this._attributes[a])return delete this._attributes[a],this._head=null},a.prototype.copy=function(){return new r.Tag(this._name,this._attributes)},a}(),r.Character=function(){function a(a,b){this._c=a,a.length>1&&(this._c=a.toLowerCase()),this._tags=[],this.addTags.apply(this,b)}return a.prototype.c=function(){return this._c},a.prototype.isEntity=function(){return this._c.length>1},a.prototype.isTag=function(a){return!(0===this._tags.length||!this._tags[0].selfClosing())&&(!a||this._tags[0].name()===a)},a.prototype.isWhitespace=function(){var a;return" "===(a=this._c)||"\n"===a||"&nbsp;"===a||this.isTag("br")},a.prototype.tags=function(){var a;return function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this)},a.prototype.addTags=function(){var a,b,c,d,e;for(b=1<=arguments.length?A.call(arguments,0):[],e=[],c=0,d=b.length;c<d;c++)a=b[c],Array.isArray(a)||(a.selfClosing()?this.isTag()||this._tags.unshift(a.copy()):e.push(this._tags.push(a.copy())));return e},a.prototype.eq=function(a){var b,c,d,e,f,g,h,i;if(this.c()!==a.c())return!1;if(this._tags.length!==a._tags.length)return!1;for(c={},h=this._tags,d=0,f=h.length;d<f;d++)b=h[d],c[b.head()]=!0;for(i=a._tags,e=0,g=i.length;e<g;e++)if(b=i[e],!c[b.head()])return!1;return!0},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h,i;for(d=1<=arguments.length?A.call(arguments,0):[],c={},b={},i=this._tags,e=0,g=i.length;e<g;e++)a=i[e],c[a.name()]=!0,b[a.head()]=!0;for(f=0,h=d.length;f<h;f++)if("string"==typeof(a=d[f])){if(void 0===c[a])return!1}else if(void 0===b[a.head()])return!1;return!0},a.prototype.removeTags=function(){var a,b,c,d,e,f;if(d=1<=arguments.length?A.call(arguments,0):[],0===d.length)return void(this._tags=[]);for(b={},a={},e=0,f=d.length;e<f;e++)c=d[e],"string"==typeof c?b[c]=c:a[c.head()]=c;return[],this._tags=this._tags.filter(function(c){if(!a[c.head()]&&!b[c.name()])return c})},a.prototype.copy=function(){var a;return new r.Character(this._c,function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(a.copy());return e}.call(this))},a}()}.call(this),function(){var a,b,c,d,e,f,g=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};a={},a.Range=function(){function g(a,b){this.set(a,b)}return g.prototype.isCollapsed=function(){return this._from===this._to},g.prototype.span=function(){return this._to-this._from},g.prototype.collapse=function(){return this._to=this._from},g.prototype.eq=function(a){return this.get()[0]===a.get()[0]&&this.get()[1]===a.get()[1]},g.prototype.get=function(){return[this._from,this._to]},g.prototype.select=function(b){var c,e,f,g,h,i,j,k,l;return a.Range.unselectAll(),c=document.createRange(),k=d(b,this._from),h=k[0],j=k[1],l=d(b,this._to),e=l[0],g=l[1],i=h.length||0,f=e.length||0,c.setStart(h,Math.min(j,i)),c.setEnd(e,Math.min(g,f)),window.getSelection().addRange(c)},g.prototype.set=function(a,b){return a=Math.max(0,a),b=Math.max(0,b),this._from=Math.min(a,b),this._to=Math.max(a,b)},g.prepareElement=function(a){var c,d,e,f,g,h;for(e=a.querySelectorAll(b.join(", ")),h=[],c=f=0,g=e.length;f<g;c=++f)d=e[c],d.parentNode.insertBefore(document.createTextNode(""),d),c<e.length-1?h.push(d.parentNode.insertBefore(document.createTextNode(""),d.nextSibling)):h.push(void 0);return h},g.query=function(b){var d,g,h,i,j,k,l;i=new a.Range(0,0);try{d=window.getSelection().getRangeAt(0)}catch(a){return i}return null===b.firstChild&&null===b.lastChild?i:c(d.startContainer,b)&&c(d.endContainer,b)?(l=e(b,d),j=l[0],k=l[1],g=l[2],h=l[3],i.set(f(b,j)+k,f(b,g)+h),i):i},g.rect=function(){var a,b,c;try{a=window.getSelection().getRangeAt(0)}catch(a){return null}return a.collapsed?(b=document.createElement("span"),a.insertNode(b),c=b.getBoundingClientRect(),b.parentNode.removeChild(b),c):a.getBoundingClientRect()},g.unselectAll=function(){if(window.getSelection())return window.getSelection().removeAllRanges()},g}(),b=["br","img","input"],c=function(a,b){for(;a;){if(a===b)return!0;a=a.parentNode}return!1},d=function(a,c){var d,e,f,h,i;if(0===a.childNodes.length)return[a,c];for(d=null,e=c,f=function(){var b,c,d,e;for(d=a.childNodes,e=[],b=0,c=d.length;b<c;b++)h=d[b],e.push(h);return e}();f.length>0;)switch(d=f.shift(),d.nodeType){case Node.TEXT_NODE:if(d.textContent.length>=e)return[d,e];e-=d.textContent.length;break;case Node.ELEMENT_NODE:if(i=d.nodeName.toLowerCase(),g.call(b,i)>=0){if(0===e)return[d,0];e=Math.max(0,e-1)}else d.childNodes&&Array.prototype.unshift.apply(f,function(){var a,b,c,e;for(c=d.childNodes,e=[],a=0,b=c.length;a<b;a++)h=c[a],e.push(h);return e}())}return[d,e]},f=function(a,c){var d,e,f,h,i,j;if(0===a.childNodes.length)return 0;for(f=0,d=function(){var b,c,d,f;for(d=a.childNodes,f=[],b=0,c=d.length;b<c;b++)e=d[b],f.push(e);return f}();d.length>0;){if((h=d.shift())===c)return i=h.nodeName.toLowerCase(),g.call(b,i)>=0?f+1:f;switch(h.nodeType){case Node.TEXT_NODE:f+=h.textContent.length;break;case Node.ELEMENT_NODE:j=h.nodeName.toLowerCase(),g.call(b,j)>=0?f+=1:h.childNodes&&Array.prototype.unshift.apply(d,function(){var a,b,c,d;for(c=h.childNodes,d=[],a=0,b=c.length;a<b;a++)e=c[a],d.push(e);return d}())}}return f},e=function(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,q,r;if(e=a.childNodes,m=c.cloneRange(),m.collapse(!0),i=c.cloneRange(),i.collapse(!1),k=m.startContainer,l=m.startOffset,f=i.endContainer,h=i.endOffset,!m.comparePoint)return[k,l,f,h];if(k===a)for(k=e[e.length-1],l=k.textContent.length,j=n=0,p=e.length;n<p;j=++n)if(d=e[j],1===m.comparePoint(d,0)){0===j?(k=d,l=0):(k=e[j-1],l=d.textContent.length),r=k.nodeName.toLowerCase,g.call(b,r)>=0&&(l=1);break}if(c.collapsed)return[k,l,k,l];if(f===a)for(f=e[e.length-1],h=f.textContent.length,j=o=0,q=e.length;o<q;j=++o)d=e[j],1===i.comparePoint(d,0)&&(f=0===j?d:e[j-1],h=d.textContent.length+1);return[k,l,f,h]},"undefined"!=typeof window&&(window.ContentSelect=a),"undefined"!=typeof module&&module.exports&&(module.exports=a)}.call(this),function(){var a,b,c,d,e=[].slice,f=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=function(a,b){return function(){return a.apply(b,arguments)}};a={ALIGNMENT_CLASS_NAMES:{left:"align-left",right:"align-right"},DEFAULT_MAX_ELEMENT_WIDTH:2e3,DEFAULT_MIN_ELEMENT_WIDTH:80,DRAG_HOLD_DURATION:500,DROP_EDGE_SIZE:50,HELPER_CHAR_LIMIT:250,INDENT:"    ",LANGUAGE:"en",LINE_ENDINGS:"\n",PREFER_LINE_BREAKS:!1,RESIZE_CORNER_SIZE:15,TRIM_WHITESPACE:!0,_translations:{},_:function(b){var c;return c=a.LANGUAGE,a._translations[c]&&a._translations[c][b]?a._translations[c][b]:b},addTranslations:function(b,c){return a._translations[b]=c},addCSSClass:function(a,b){var c,d,e;return a.classList?void a.classList.add(b):(d=a.getAttribute("class"),d?(e=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;a<b;a++)c=e[a],f.push(c);return f}(),-1===e.indexOf(b)?a.setAttribute("class",d+" "+b):void 0):a.setAttribute("class",b))},attributesToString:function(a){var b,c,d,e,f,g;if(!a)return"";for(d=function(){var b;b=[];for(c in a)b.push(c);return b}(),d.sort(),b=[],f=0,g=d.length;f<g;f++)c=d[f],e=a[c],""===e?b.push(c):(e=HTMLString.String.encode(e),e=e.replace(/"/g,"&quot;"),b.push(c+'="'+e+'"'));return b.join(" ")},removeCSSClass:function(a,b){var c,d,e,f;return a.classList?(a.classList.remove(b),void(0===a.classList.length&&a.removeAttribute("class"))):(d=a.getAttribute("class"),d&&(f=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;a<b;a++)c=e[a],f.push(c);return f}(),(e=f.indexOf(b))>-1)?(f.splice(e,1),f.length?a.setAttribute("class",f.join(" ")):a.removeAttribute("class")):void 0)}},"undefined"!=typeof window&&(window.ContentEdit=a),"undefined"!=typeof module&&module.exports&&(module.exports=a),c=function(){function b(){this._tagNames={}}return b.prototype.register=function(){var a,b,c,d,f,g;for(a=arguments[0],c=2<=arguments.length?e.call(arguments,1):[],g=[],d=0,f=c.length;d<f;d++)b=c[d],g.push(this._tagNames[b.toLowerCase()]=a);return g},b.prototype.match=function(b){return b=b.toLowerCase(),this._tagNames[b]?this._tagNames[b]:a.Static},b}(),a.TagNames=function(){function a(){}var b;return b=null,a.get=function(){return null!=b?b:b=new c},a}(),a.Node=function(){function b(){this._bindings={},this._parent=null,this._modified=null}return b.prototype.lastModified=function(){return this._modified},b.prototype.parent=function(){return this._parent},b.prototype.parents=function(){var a,b;for(b=[],a=this._parent;a;)b.push(a),a=a._parent;return b},b.prototype.type=function(){return"Node"},b.prototype.html=function(a){throw null==a&&(a=""),new Error("`html` not implemented")},b.prototype.bind=function(a,b){return void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b),b},b.prototype.trigger=function(){var a,b,c,d,f,g,h;if(c=arguments[0],a=2<=arguments.length?e.call(arguments,1):[],this._bindings[c]){for(g=this._bindings[c],h=[],d=0,f=g.length;d<f;d++)(b=g[d])&&h.push(b.call.apply(b,[this].concat(e.call(a))));return h}},b.prototype.unbind=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;e<f;c=++e)d=g[c],d===b?h.push(this._bindings[a].splice(c,1)):h.push(void 0);return h}},b.prototype.commit=function(){return this._modified=null,a.Root.get().trigger("commit",this)},b.prototype.taint=function(){var b,c,d,e,f,g;for(b=Date.now(),this._modified=b,g=this.parents(),e=0,f=g.length;e<f;e++)c=g[e],c._modified=b;return d=a.Root.get(),d._modified=b,d.trigger("taint",this)},b.prototype.closest=function(a){var b;for(b=this.parent();b&&!a(b);)b=b.parent?b.parent():null;return b},b.prototype.next=function(){var a,b,c,d,e,f;if(this.children&&this.children.length>0)return this.children[0];for(f=[this].concat(this.parents()),d=0,e=f.length;d<e;d++){if(c=f[d],!c.parent())return null;if(a=c.parent().children,(b=a.indexOf(c))<a.length-1)return a[b+1]}},b.prototype.nextContent=function(){return this.nextWithTest(function(a){return void 0!==a.content})},b.prototype.nextSibling=function(){var a;return a=this.parent().children.indexOf(this),a===this.parent().children.length-1?null:this.parent().children[a+1]},b.prototype.nextWithTest=function(a){var b;for(b=this;b;)if((b=b.next())&&a(b))return b},b.prototype.previous=function(){var a,b;if(!this.parent())return null;if(a=this.parent().children,a[0]===this)return this.parent();for(b=a[a.indexOf(this)-1];b.children&&b.children.length;)b=b.children[b.children.length-1];return b},b.prototype.previousContent=function(){return this.previousWithTest(function(a){return void 0!==a.content})},b.prototype.previousSibling=function(){var a;return a=this.parent().children.indexOf(this),0===a?null:this.parent().children[a-1]},b.prototype.previousWithTest=function(a){var b;for(b=this;b;)if((b=b.previous())&&a(b))return b},b.extend=function(a){var b,c,d;d=a.prototype;for(b in d)c=d[b],"constructor"!==b&&(this.prototype[b]=c);for(b in a)c=a[b],f.call("__super__",b)>=0||(this.prototype[b]=c);return this},b.fromDOMElement=function(a){throw new Error("`fromDOMElement` not implemented")},b}(),a.NodeCollection=function(b){function c(){c.__super__.constructor.call(this),this.children=[]}return h(c,b),c.prototype.descendants=function(){var a,b,c;for(a=[],c=this.children.slice();c.length>0;)b=c.shift(),a.push(b),b.children&&b.children.length>0&&(c=b.children.slice().concat(c));return a},c.prototype.isMounted=function(){return!1},c.prototype.type=function(){return"NodeCollection"},c.prototype.attach=function(b,c){return b.parent()&&b.parent().detach(b),b._parent=this,void 0!==c?this.children.splice(c,0,b):this.children.push(b),b.mount&&this.isMounted()&&b.mount(),this.taint(),a.Root.get().trigger("attach",this,b)},c.prototype.commit=function(){var b,c,d,e;for(e=this.descendants(),c=0,d=e.length;c<d;c++)b=e[c],b._modified=null;return this._modified=null,a.Root.get().trigger("commit",this)},c.prototype.detach=function(b){var c;if(-1!==(c=this.children.indexOf(b)))return b.unmount&&this.isMounted()&&b.isMounted()&&b.unmount(),this.children.splice(c,1),b._parent=null,this.taint(),a.Root.get().trigger("detach",this,b)},c}(a.Node),a.Element=function(b){function c(a,b){c.__super__.constructor.call(this),this._tagName=a.toLowerCase(),this._attributes=b||{},this._domElement=null,this._behaviours={drag:!0,drop:!0,merge:!0,remove:!0,resize:!0,spawn:!0}}return h(c,b),c.prototype.attributes=function(){var a,b,c,d;a={},d=this._attributes;for(b in d)c=d[b],a[b]=c;return a},c.prototype.cssTypeName=function(){return"element"},c.prototype.domElement=function(){return this._domElement},c.prototype.isFixed=function(){return this.parent()&&"Fixture"===this.parent().type()},c.prototype.isGallery=function(){return this.parent()&&-1!==this.parent().domElement().className.indexOf("gallery")},c.prototype.isFocused=function(){return a.Root.get().focused()===this},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"Element"},c.prototype.typeName=function(){return"Element"},c.prototype.addCSSClass=function(a){var b;if(b=!1,this.hasCSSClass(a)||(b=!0,this.attr("class")?this.attr("class",this.attr("class")+" "+a):this.attr("class",a)),this._addCSSClass(a),b)return this.taint()},c.prototype.attr=function(a,b){return a=a.toLowerCase(),void 0===b?this._attributes[a]:(this._attributes[a]=b,this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.setAttribute(a,b),this.taint())},c.prototype.blur=function(){var b;if(b=a.Root.get(),this.isFocused())return this._removeCSSClass("ce-element--focused"),b._focused=null,b.trigger("blur",this)},c.prototype.can=function(a,b){return void 0===b?!this.isFixed()&&this._behaviours[a]:this._behaviours[a]=b},c.prototype.createDraggingDOMElement=function(){var b;if(this.isMounted())return b=document.createElement("div"),b.setAttribute("class","ce-drag-helper ce-drag-helper--type-"+this.cssTypeName()),b.setAttribute("data-ce-type",a._(this.typeName())),b},c.prototype.drag=function(b,c){var d;if(this.isMounted()&&this.can("drag"))return d=a.Root.get(),d.startDragging(this,b,c),d.trigger("drag",this)},c.prototype.drop=function(b,c){var d;if(this.can("drop")){if(d=a.Root.get(),b){if(b._removeCSSClass("ce-element--drop"),b._removeCSSClass("ce-element--drop-"+c[0]),b._removeCSSClass("ce-element--drop-"+c[1]),this.constructor.droppers[b.type()])return this.constructor.droppers[b.type()](this,b,c),void d.trigger("drop",this,b,c);if(b.constructor.droppers[this.type()])return b.constructor.droppers[this.type()](this,b,c),void d.trigger("drop",this,b,c)}return d.trigger("drop",this,null,null)}},c.prototype.focus=function(b){var c;if(c=a.Root.get(),!this.isFocused())return c.focused()&&c.focused().blur(),
this._addCSSClass("ce-element--focused"),c._focused=this,this.isMounted()&&!b&&this.domElement().focus(),c.trigger("focus",this)},c.prototype.hasCSSClass=function(a){var b,c;return!!(this.attr("class")&&(c=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}.call(this),c.indexOf(a)>-1))},c.prototype.merge=function(a){return!(!this.can("merge")||!this.can("remove"))&&(this.constructor.mergers[a.type()]?this.constructor.mergers[a.type()](a,this):a.constructor.mergers[this.type()]?a.constructor.mergers[this.type()](a,this):void 0)},c.prototype.mount=function(){var b;return this._domElement||(this._domElement=document.createElement(this.tagName())),b=this.nextSibling(),b?this.parent().domElement().insertBefore(this._domElement,b.domElement()):this.isFixed()?(this.parent().domElement().parentNode.replaceChild(this._domElement,this.parent().domElement()),this.parent()._domElement=this._domElement):this.parent().domElement().appendChild(this._domElement),this._addDOMEventListeners(),this._addCSSClass("ce-element"),this._addCSSClass("ce-element--type-"+this.cssTypeName()),this.isFocused()&&this._addCSSClass("ce-element--focused"),a.Root.get().trigger("mount",this)},c.prototype.removeAttr=function(a){if(a=a.toLowerCase(),this._attributes[a])return delete this._attributes[a],this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.removeAttribute(a),this.taint()},c.prototype.removeCSSClass=function(a){var b,c,d;if(this.hasCSSClass(a))return d=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}.call(this),c=d.indexOf(a),c>-1&&d.splice(c,1),d.length?this.attr("class",d.join(" ")):this.removeAttr("class"),this._removeCSSClass(a),this.taint()},c.prototype.tagName=function(a){return void 0===a?this._tagName:(this._tagName=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){return this._removeDOMEventListeners(),this.isFixed()?(this._removeCSSClass("ce-element"),this._removeCSSClass("ce-element--type-"+this.cssTypeName()),void this._removeCSSClass("ce-element--focused")):(this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,a.Root.get().trigger("unmount",this))},c.prototype._addDOMEventListeners=function(){var a,b,c,d;this._domEventHandlers={dragstart:function(a){return function(a){return a.preventDefault()}}(),focus:function(a){return function(a){return a.preventDefault()}}(),keydown:function(a){return function(b){return a._onKeyDown(b)}}(this),keyup:function(a){return function(b){return a._onKeyUp(b)}}(this),mousedown:function(a){return function(b){if(0===b.button)return a._onMouseDown(b)}}(this),mousemove:function(a){return function(b){return a._onMouseMove(b)}}(this),mouseover:function(a){return function(b){return a._onMouseOver(b)}}(this),mouseout:function(a){return function(b){return a._onMouseOut(b)}}(this),mouseup:function(a){return function(b){if(0===b.button)return a._onMouseUp(b)}}(this),dragover:function(a){return function(a){return a.preventDefault()}}(),drop:function(a){return function(b){return a._onNativeDrop(b)}}(this),paste:function(a){return function(b){return a._onPaste(b)}}(this)},c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.addEventListener(b,a));return d},c.prototype._onKeyDown=function(a){},c.prototype._onKeyUp=function(a){},c.prototype._onMouseDown=function(a){if(this.focus)return this.focus(!0)},c.prototype._onMouseMove=function(a){return this._onOver(a)},c.prototype._onMouseOver=function(a){return this._onOver(a)},c.prototype._onMouseOut=function(b){var c;if(this._removeCSSClass("ce-element--over"),c=a.Root.get(),c.dragging())return this._removeCSSClass("ce-element--drop"),this._removeCSSClass("ce-element--drop-above"),this._removeCSSClass("ce-element--drop-below"),this._removeCSSClass("ce-element--drop-center"),this._removeCSSClass("ce-element--drop-left"),this._removeCSSClass("ce-element--drop-right"),c._dropTarget=null},c.prototype._onMouseUp=function(a){return this._ieMouseDownEchoed=!1},c.prototype._onNativeDrop=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("native-drop",this,b)},c.prototype._onPaste=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("paste",this,b)},c.prototype._onOver=function(b){var c,d;if(this._addCSSClass("ce-element--over"),d=a.Root.get(),(c=d.dragging())&&c!==this&&!d._dropTarget&&this.can("drop")&&(this.constructor.droppers[c.type()]||c.constructor.droppers[this.type()]))return this._addCSSClass("ce-element--drop"),d._dropTarget=this},c.prototype._removeDOMEventListeners=function(){var a,b,c,d;c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.removeEventListener(b,a));return d},c.prototype._addCSSClass=function(b){if(this.isMounted())return a.addCSSClass(this._domElement,b)},c.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+a.attributesToString(this._attributes):""},c.prototype._removeCSSClass=function(b){if(this.isMounted())return a.removeCSSClass(this._domElement,b)},c.droppers={},c.mergers={},c.placements=["above","below"],c.getDOMElementAttributes=function(a){var b,c,d,e,f;if(!a.hasAttributes())return{};for(c={},f=a.attributes,d=0,e=f.length;d<e;d++)b=f[d],c[b.name.toLowerCase()]=b.value;return c},c._dropVert=function(a,b,c){var d;return a.parent().detach(a),d=b.parent().children.indexOf(b),"below"===c[0]&&(d+=1),b.parent().attach(a,d)},c._dropBoth=function(b,c,d){var e,f,g,h,i,j,k,l;if(b.parent().detach(b),i=c.parent().children.indexOf(c),"below"===d[0]&&"center"===d[1]&&(i+=1),f=a.ALIGNMENT_CLASS_NAMES.left,g=a.ALIGNMENT_CLASS_NAMES.right,b.a){if(b._removeCSSClass(f),b._removeCSSClass(g),b.a.class){for(e=[],l=b.a.class.split(" "),j=0,k=l.length;j<k;j++)(h=l[j])!==f&&h!==g&&e.push(h);e.length?b.a.class=e.join(" "):delete b.a.class}}else b.removeCSSClass(f),b.removeCSSClass(g);return"left"===d[1]&&(b.a?(b.a.class?b.a.class+=" "+f:b.a.class=f,b._addCSSClass(f)):b.addCSSClass(f)),"right"===d[1]&&(b.a?(b.a.class?b.a.class+=" "+g:b.a.class=g,b._addCSSClass(g)):b.addCSSClass(g)),c.parent().attach(b,i)},c}(a.Node),a.ElementCollection=function(b){function c(b,d){c.__super__.constructor.call(this,b,d),a.NodeCollection.prototype.constructor.call(this)}return h(c,b),c.extend(a.NodeCollection),c.prototype.cssTypeName=function(){return"element-collection"},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"ElementCollection"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.detach=function(b){if(a.NodeCollection.prototype.detach.call(this,b),0===this.children.length&&this.parent())return this.parent().detach(this)},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),e=function(){var c,e,f,g;for(f=this.children,g=[],c=0,e=f.length;c<e;c++)d=f[c],g.push(d.html(b+a.INDENT));return g}.call(this),f=a.LINE_ENDINGS,this.isFixed()?e.join(f):(c=this._attributesToString(),b+"<"+this.tagName()+c+">"+f+e.join(f)+f+b+"</"+this.tagName()+">")},c.prototype.mount=function(){var a,b,d,e,f,g,h,i;this._domElement=document.createElement(this._tagName),g=this._attributes;for(b in g)d=g[b],this._domElement.setAttribute(b,d);for(c.__super__.mount.call(this),h=this.children,i=[],e=0,f=h.length;e<f;e++)a=h[e],i.push(a.mount());return i},c.prototype.unmount=function(){var a,b,d,e;for(e=this.children,b=0,d=e.length;b<d;b++)a=e[b],a.unmount();return c.__super__.unmount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c}(a.Element),a.ResizableElement=function(b){function c(a,b){c.__super__.constructor.call(this,a,b),this._domSizeInfoElement=null,this._aspectRatio=1}return h(c,b),c.prototype.aspectRatio=function(){return this._aspectRatio},c.prototype.maxSize=function(){var b;return b=parseInt(this.attr("data-ce-max-width")||0),b||(b=a.DEFAULT_MAX_ELEMENT_WIDTH),b=Math.max(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.minSize=function(){var b;return b=parseInt(this.attr("data-ce-min-width")||0),b||(b=a.DEFAULT_MIN_ELEMENT_WIDTH),b=Math.min(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.type=function(){return"ResizableElement"},c.prototype.mount=function(){return c.__super__.mount.call(this),this._domElement.setAttribute("data-ce-size",this._getSizeInfo())},c.prototype.resize=function(b,c,d){if(this.isMounted()&&this.can("resize"))return a.Root.get().startResizing(this,b,c,d,!0)},c.prototype.size=function(a){var b,c,d,e;return a?(a[0]=parseInt(a[0]),a[1]=parseInt(a[1]),d=this.minSize(),a[0]=Math.max(a[0],d[0]),a[1]=Math.max(a[1],d[1]),c=this.maxSize(),a[0]=Math.min(a[0],c[0]),a[1]=Math.min(a[1],c[1]),this.attr("width",parseInt(a[0])),this.attr("height",parseInt(a[1])),this.isMounted()?(this._domElement.style.width=a[0]+"px",this._domElement.style.height=a[1]+"px",this._domElement.setAttribute("data-ce-size",this._getSizeInfo())):void 0):(e=parseInt(this.attr("width")||1),b=parseInt(this.attr("height")||1),[e,b])},c.prototype._onMouseDown=function(a){var b;return c.__super__._onMouseDown.call(this,a),b=this._getResizeCorner(a.clientX,a.clientY),b?this.resize(b,a.clientX,a.clientY):(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150))},c.prototype._onMouseMove=function(a){var b;if(c.__super__._onMouseMove.call(this),this.can("resize"))return this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right"),b=this._getResizeCorner(a.clientX,a.clientY),b?this._addCSSClass("ce-element--resize-"+b[0]+"-"+b[1]):void 0},c.prototype._onMouseOut=function(a){return c.__super__._onMouseOut.call(this),this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.prototype._getResizeCorner=function(b,c){var d,e,f,g,h;return f=this._domElement.getBoundingClientRect(),h=[b-f.left,c-f.top],b=h[0],c=h[1],g=this.size(),e=a.RESIZE_CORNER_SIZE,e=Math.min(e,Math.max(parseInt(g[0]/4),1)),e=Math.min(e,Math.max(parseInt(g[1]/4),1)),d=null,b<e?c<e?d=["top","left"]:c>f.height-e&&(d=["bottom","left"]):b>f.width-e&&(c<e?d=["top","right"]:c>f.height-e&&(d=["bottom","right"])),d},c.prototype._getSizeInfo=function(){var a;return a=this.size(),"w "+a[0]+" × h "+a[1]},c}(a.Element),a.Region=function(b){function c(a){c.__super__.constructor.call(this),this._domElement=a,this.setContent(a)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Region"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c.prototype.setContent=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(h=b,void 0===b.childNodes&&(k=document.createElement("div"),k.innerHTML=b,h=k),p=this.children.slice(),l=0,n=p.length;l<n;l++)d=p[l],this.detach(d);for(j=a.TagNames.get(),f=function(){var a,b,d,e;for(d=h.childNodes,e=[],a=0,b=d.length;a<b;a++)c=d[a],e.push(c);return e}(),m=0,o=f.length;m<o;m++)e=f[m],1===e.nodeType&&(g=e.getAttribute("data-ce-tag")?j.match(e.getAttribute("data-ce-tag")):j.match(e.tagName),i=g.fromDOMElement(e),h.removeChild(e),i&&this.attach(i));return a.Root.get().trigger("ready",this)},c}(a.NodeCollection),a.Fixture=function(b){function c(b){var d,e,f;c.__super__.constructor.call(this),this._domElement=b,f=a.TagNames.get(),d=this._domElement.getAttribute("data-ce-tag")?f.match(this._domElement.getAttribute("data-ce-tag")):f.match(this._domElement.tagName),e=d.fromDOMElement(this._domElement),this.children=[e],e._parent=this,e.mount(),a.Root.get().trigger("ready",this)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Fixture"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c}(a.NodeCollection),b=function(b){function c(){this._onStopResizing=i(this._onStopResizing,this),this._onResize=i(this._onResize,this),this._onStopDragging=i(this._onStopDragging,this),this._onDrag=i(this._onDrag,this),c.__super__.constructor.call(this),this._focused=null,this._dragging=null,this._dropTarget=null,this._draggingDOMElement=null,this._resizing=null,this._resizingInit=null}return h(c,b),c.prototype.dragging=function(){return this._dragging},c.prototype.dropTarget=function(){return this._dropTarget},c.prototype.focused=function(){return this._focused},c.prototype.resizing=function(){return this._resizing},c.prototype.type=function(){return"Root"},c.prototype.cancelDragging=function(){if(this._dragging)return document.body.removeChild(this._draggingDOMElement),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._dragging._removeCSSClass("ce-element--dragging"),this._dragging=null,this._dropTarget=null,a.removeCSSClass(document.body,"ce--dragging")},c.prototype.startDragging=function(b,c,d){if(!this._dragging)return this._dragging=b,this._dragging._addCSSClass("ce-element--dragging"),this._draggingDOMElement=this._dragging.createDraggingDOMElement(),document.body.appendChild(this._draggingDOMElement),this._draggingDOMElement.style.left=c+"px",this._draggingDOMElement.style.top=d+"px",document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),a.addCSSClass(document.body,"ce--dragging")},c.prototype._getDropPlacement=function(b,c){var d,e,f,g;return this._dropTarget?(e=this._dropTarget.domElement().getBoundingClientRect(),g=[b-e.left,c-e.top],b=g[0],c=g[1],d="center",b<a.DROP_EDGE_SIZE?d="left":b>e.width-a.DROP_EDGE_SIZE&&(d="right"),f="above",c>e.height/2&&(f="below"),[f,d]):null},c.prototype._onDrag=function(a){var b,c,d;if(ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=a.pageX+"px",this._draggingDOMElement.style.top=a.pageY+"px",this._dropTarget&&(b=this._getDropPlacement(a.clientX,a.clientY),this._dropTarget._removeCSSClass("ce-element--drop-above"),this._dropTarget._removeCSSClass("ce-element--drop-below"),this._dropTarget._removeCSSClass("ce-element--drop-center"),this._dropTarget._removeCSSClass("ce-element--drop-left"),this._dropTarget._removeCSSClass("ce-element--drop-right"),c=b[0],f.call(this._dragging.constructor.placements,c)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+b[0]),d=b[1],f.call(this._dragging.constructor.placements,d)>=0))return this._dropTarget._addCSSClass("ce-element--drop-"+b[1])},c.prototype._onStopDragging=function(a){var b;return b=this._getDropPlacement(a.clientX,a.clientY),this._dragging.drop(this._dropTarget,b),this.cancelDragging()},c.prototype.startResizing=function(b,c,d,e,f){var g,h;if(!this._resizing)return this._resizing=b,this._resizingInit={corner:c,fixed:f,origin:[d,e],size:b.size()},this._resizing._addCSSClass("ce-element--resizing"),h=this._resizing.parent().domElement(),g=document.createElement("div"),g.setAttribute("class","ce-measure"),h.appendChild(g),this._resizingParentWidth=g.getBoundingClientRect().width,h.removeChild(g),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),a.addCSSClass(document.body,"ce--resizing")},c.prototype._onResize=function(a){var b,c,d,e;return ContentSelect.Range.unselectAll(),d=this._resizingInit.origin[0]-a.clientX,"right"===this._resizingInit.corner[1]&&(d=-d),c=this._resizingInit.size[0]+d,c=Math.min(c,this._resizingParentWidth),this._resizingInit.fixed?b=c*this._resizing.aspectRatio():(e=this._resizingInit.origin[1]-a.clientY,"bottom"===this._resizingInit.corner[0]&&(e=-e),b=this._resizingInit.size[1]+e),this._resizing.size([c,b])},c.prototype._onStopResizing=function(b){return document.removeEventListener("mousemove",this._onResize),document.removeEventListener("mouseup",this._onStopResizing),this._resizing._removeCSSClass("ce-element--resizing"),this._resizing=null,this._resizingInit=null,this._resizingParentWidth=null,a.removeCSSClass(document.body,"ce--resizing")},c}(a.Node),a.Root=function(){function a(){}var c;return c=null,a.get=function(){return null!=c?c:c=new b},a}(),a.Static=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._content=d}return h(c,b),c.prototype.cssTypeName=function(){return"static"},c.prototype.type=function(){return"Static"},c.prototype.typeName=function(){return"Static"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.html=function(a){return null==a&&(a=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?a+"<"+this._tagName+this._attributesToString()+">":a+"<"+this._tagName+this._attributesToString()+">"+this._content+a+"</"+this._tagName+">"},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this._domElement.innerHTML=this._content,c.__super__.mount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c.prototype._onMouseDown=function(a){if(c.__super__._onMouseDown.call(this,a),void 0!==this.attr("data-ce-moveable"))return clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this,a),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.droppers={Static:a.Element._dropVert},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Element),a.TagNames.get().register(a.Static,"static"),a.Text=function(b){function c(b,d,e){c.__super__.constructor.call(this,b,d),e instanceof HTMLString.String?this.content=e:a.TRIM_WHITESPACE?this.content=new HTMLString.String(e).trim():this.content=new HTMLString.String(e,!0)}return h(c,b),c.prototype.cssTypeName=function(){return"text"},c.prototype.type=function(){return"Text"},c.prototype.typeName=function(){return"Text"},c.prototype.blur=function(){return this.isMounted()&&this._syncContent(),this.content.isWhitespace()&&this.can("remove")?this.parent()&&this.parent().detach(this):this.isMounted()&&(document.documentMode||/Edge/.test(navigator.userAgent)||this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.__super__.blur.call(this)},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=HTMLString.String.encode(this._domElement.textContent),d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.drag=function(a,b){return this.storeState(),this._domElement.removeAttribute("contenteditable"),c.__super__.drag.call(this,a,b)},c.prototype.drop=function(a,b){return c.__super__.drop.call(this,a,b),this.restoreState()},c.prototype.focus=function(a){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),c.__super__.focus.call(this,a)},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(d=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),d.optimize(),this._lastCached=Date.now(),this._cached=d.html()),e=a.LINE_ENDINGS,c=this._attributesToString(),b+"<"+this._tagName+c+">"+e+b+a.INDENT+this._cached+e+b+"</"+this._tagName+">"},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this.updateInnerHTML(),c.__super__.mount.call(this)},c.prototype.restoreState=function(){if(this._savedSelection)return this.isMounted()&&this.isFocused()?(this._domElement.setAttribute("contenteditable",""),this._addCSSClass("ce-element--focused"),document.activeElement!==this.domElement()&&this.domElement().focus(),this._savedSelection.select(this._domElement),this._savedSelection=void 0):void(this._savedSelection=void 0)},c.prototype.selection=function(a){return void 0===a?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):a.select(this._domElement)},c.prototype.storeState=function(){if(this.isMounted()&&this.isFocused())return this._savedSelection=ContentSelect.Range.query(this._domElement)},c.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),c.__super__.unmount.call(this)},c.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._onKeyDown=function(a){switch(a.keyCode){case 40:return this._keyDown(a);case 37:return this._keyLeft(a);case 39:return this._keyRight(a);case 38:return this._keyUp(a);case 9:return this._keyTab(a);case 8:return this._keyBack(a);case 46:return this._keyDelete(a);case 13:return this._keyReturn(a)}},c.prototype._onKeyUp=function(a){return c.__super__._onKeyUp.call(this,a),this._syncContent()},c.prototype._onMouseDown=function(b){if(c.__super__._onMouseDown.call(this,b),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(a){return function(){return a.drag(b.pageX,b.pageY)}}(this),a.DRAG_HOLD_DURATION),0===this.content.length()&&a.Root.get().focused()===this)return b.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)},c.prototype._onMouseMove=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseMove.call(this,a)},c.prototype._onMouseOut=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseOut.call(this,a)},c.prototype._onMouseUp=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseUp.call(this,a)},c.prototype._keyBack=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),0===c.get()[0]&&c.isCollapsed())return a.preventDefault(),b=this.previousContent(),this._syncContent(),b?b.merge(this):void 0},c.prototype._keyDelete=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),this._atEnd(c)&&c.isCollapsed())return a.preventDefault(),b=this.nextContent(),b?this.merge(b):void 0},c.prototype._keyDown=function(a){return this._keyRight(a)},c.prototype._keyLeft=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),0===d.get()[0]&&d.isCollapsed())return b.preventDefault(),c=this.previousContent(),c?(c.focus(),d=new ContentSelect.Range(c.content.length(),c.content.length()),d.select(c.domElement())):a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;if(b.preventDefault(),!(this.content.isWhitespace()&&!b.shiftKey^a.PREFER_LINE_BREAKS)){if(f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),b.shiftKey^a.PREFER_LINE_BREAKS)return d=f.get()[0],e="<br>",this.content.length()===d&&(0!==this.content.length()&&this.content.characters[d-1].isTag("br")||(e="<br><br>")),this.content=this.content.insert(d,new HTMLString.String(e,!0),!0),this.updateInnerHTML(),d+=1,f=new ContentSelect.Range(d,d),f.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=h.trim(),this.updateInnerHTML(),c=new this.constructor("p",{},g.trim()),this.parent().attach(c,this.parent().children.indexOf(this)+1),h.length()?(c.focus(),f=new ContentSelect.Range(0,0),f.select(c.domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint()}},c.prototype._keyRight=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),this._atEnd(d)&&d.isCollapsed())return b.preventDefault(),c=this.nextContent(),c?(c.focus(),d=new ContentSelect.Range(0,0),d.select(c.domElement())):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyTab=function(b){if(b.preventDefault(),this.isFixed())return b.shiftKey?a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyUp=function(a){return this._keyLeft(a)},c.prototype._atEnd=function(a){return a.get()[0]>=this.content.length()},c.prototype._flagIfEmpty=function(){return 0===this.content.length()?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},c.prototype._syncContent=function(a){var b,c;return c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.droppers={Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={Text:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&b.updateInnerHTML(),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),a.parent()&&a.parent().detach(a),b.taint()}},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML.replace(/^\s+|\s+$/g,""))},c}(a.Element),a.TagNames.get().register(a.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),a.PreText=function(b){function c(b,c,d){d instanceof HTMLString.String?this.content=d:this.content=new HTMLString.String(d,!0),a.Element.call(this,b,c)}return h(c,b),c.TAB_INDENT="    ",c.prototype.cssTypeName=function(){return"pre-text"},c.prototype.type=function(){return"PreText"},c.prototype.typeName=function(){return"Preformatted"},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),c.__super__.blur.call(this)},c.prototype.html=function(a){var b;return null==a&&(a=""),(!this._lastCached||this._lastCached<this._modified)&&(b=this.content.copy(),b.optimize(),this._lastCached=Date.now(),this._cached=b.html()),a+"<"+this._tagName+this._attributesToString()+">"+this._cached+"</"+this._tagName+">"},c.prototype.updateInnerHTML=function(){var a;return a=this.content.html(),this._domElement.innerHTML=a,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._keyBack=function(a){var b;return b=ContentSelect.Range.query(this._domElement),b.get()[0]<=this.content.length()?c.__super__._keyBack.call(this,a):(b.set(this.content.length(),this.content.length()),b.select(this._domElement))},c.prototype._keyReturn=function(a){var b,c,d,e;return a.preventDefault(),c=ContentSelect.Range.query(this._domElement),b=c.get()[0]+1,0===c.get()[0]&&c.isCollapsed()?this.content=new HTMLString.String("\n",!0).concat(this.content):this._atEnd(c)&&c.isCollapsed()?this.content=this.content.concat(new HTMLString.String("\n",!0)):0===c.get()[0]&&c.get()[1]===this.content.length()?(this.content=new HTMLString.String("\n",!0),b=0):(e=this.content.substring(0,c.get()[0]),d=this.content.substring(c.get()[1]),this.content=e.concat(new HTMLString.String("\n",!0),d)),this.updateInnerHTML(),c.set(b,b),c.select(this._domElement),this.taint()},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(b.preventDefault(),c=this.content.length(),k=a.PreText.TAB_INDENT,j=k.length,o=this.content.split("\n"),p=this.selection().get(),p[0]=Math.min(p[0],c),p[1]=Math.min(p[1],c),e=0,s=-1,f=-1,h=v=0,z=o.length;v<z&&(m=o[h],n=m.length()+1,p[0]<e+n&&-1===s&&(s=h),p[1]<e+n&&-1===f&&(f=h),!(s>-1&&f>-1));h=++v)e+=n;if(s===f)j-=(p[0]-e)%j,i=new HTMLString.String(Array(j+1).join(" "),!0),u=o[s].substring(0,p[0]-e),t=o[s].substring(p[1]-e),o[s]=u.concat(i,t),r=j;else if(b.shiftKey){for(g=0,h=w=s;s<=f?w<=f:w>=f;h=s<=f?++w:--w){for(B=o[h].characters.slice(),l=x=0,A=B.length;x<A&&(d=B[l],!(l>j-1))&&d.isWhitespace();l=++x)o[h].characters.shift();h===s&&(g=l)}r=Math.max(-j,-g)}else{for(i=new HTMLString.String(k,!0),h=y=s;s<=f?y<=f:y>=f;h=s<=f?++y:--y)o[h]=i.concat(o[h]);r=j}return this.content=HTMLString.String.join(new HTMLString.String("\n",!0),o),this.updateInnerHTML(),q=this.content.length()-c,new ContentSelect.Range(p[0]+r,p[1]+q).select(this._domElement)},c.prototype._syncContent=function(a){var b,c;return this._ensureEndZWS(),c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.prototype._ensureEndZWS=function(){var a,b;if(this._domElement.lastChild&&(a=this._domElement.innerHTML,!("​"===a[a.length-1]&&a.indexOf("​")<a.length-1)))return b=function(b){return function(){return a.indexOf("​")>-1&&(b._domElement.innerHTML=a.replace(/\u200B/g,"")),b._domElement.lastChild.textContent+="​"}}(this),this._savedSelection?b():(this.storeState(),b(),this.restoreState())},c.droppers={PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Text),a.TagNames.get().register(a.PreText,"pre"),a.Image=function(b){function c(a,b){var d;c.__super__.constructor.call(this,"img",a),this.a=b||null,d=this.size(),this._aspectRatio=d[1]/d[0]}return h(c,b),c.prototype.cssTypeName=function(){return"image"},c.prototype.type=function(){return"Image"},c.prototype.typeName=function(){return"Image"},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.style.backgroundImage="url('"+this._attributes.src+"')",a},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),d=b+"<img"+this._attributesToString()+">",this.a?(e=a.LINE_ENDINGS,c=a.attributesToString(this.a),c+=' data-ce-tag="img"',b+"<a "+c+">"+e+a.INDENT+d+e+b+"</a>"):d},c.prototype.mount=function(){var a,b;return this._domElement=document.createElement("img"),this._domElement.setAttribute("src",this._attributes.src),a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),b=this._attributes.style?this._attributes.style:"",this._attributes.width&&(b+="width:"+this._attributes.width+"px;"),this._attributes.height&&(b+="height:auto;"),this._domElement.setAttribute("style",b),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("a, img"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth},
c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i,j;if(b=null,"a"===a.tagName.toLowerCase()){for(b=this.getDOMElementAttributes(a),f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b<c;b++)d=e[b],f.push(d);return f}(),i=0,j=f.length;i<j;i++)if(e=f[i],1===e.nodeType&&"img"===e.tagName.toLowerCase()){a=e;break}"a"===a.tagName.toLowerCase()&&(a=document.createElement("img"))}return c=this.getDOMElementAttributes(a),h=c.width,g=c.height,void 0===c.width&&(h=void 0===c.height?a.naturalWidth:a.clientWidth),void 0===c.height&&(g=void 0===c.width?a.naturalHeight:a.clientHeight),c.width=h,c.height=g,new this(c,b)},c}(a.ResizableElement),a.TagNames.get().register(a.Image,"img"),a.ImageFixture=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._src=d}return h(c,b),c.prototype.cssTypeName=function(){return"image-fixture"},c.prototype.type=function(){return"ImageFixture"},c.prototype.typeName=function(){return"ImageFixture"},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),f=a.LINE_ENDINGS,d=this._attributesToString(),c="",void 0!==this._attributes.alt&&(c='alt="'+this._attributes.alt+'"'),e=b+'<img src="'+this.src()+'"'+c+">",b+"<"+this.tagName()+" "+d+">"+f+a.INDENT+e+f+b+"</"+this.tagName()+">"},c.prototype.mount=function(){var a,b,d,e,f,g;this._domElement=document.createElement(this.tagName()),g=this._attributes;for(b in g)f=g[b],"alt"!==b&&"style"!==b&&this._domElement.setAttribute(b,f);return a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),d=this._attributes.style?this._attributes.style:"",e=document.createElement("div"),e.setAttribute("style",d.trim()),e.style.backgroundImage=null,d=e.getAttribute("style"),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._domElement.setAttribute("style",d.trim()),c.__super__.mount.call(this)},c.prototype.src=function(a){return void 0===a?this._src:(this._src=a,this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){var a,b;return this.isFixed()?(b=document.createElement("div"),b.innerHTML=this.html(),a=b.firstElementChild,this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a,this.parent()._domElement=this._domElement):c.__super__.unmount.call(this)},c.prototype._attributesToString=function(){var b,c,d,e,f,g;this._attributes.style?(d=this._attributes.style?this._attributes.style:"",e=document.createElement("div"),e.setAttribute("style",d.trim()),e.style.backgroundImage=null,d=e.getAttribute("style"),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._attributes.style=d.trim()):this._attributes.style="background-image:url('"+this.src()+"');",b={},g=this._attributes;for(c in g)f=g[c],"alt"!==c&&(b[c]=f);return" "+a.attributesToString(b)},c.droppers={ImageFixture:a.Element._dropVert,Image:a.Element._dropVert,PreText:a.Element._dropVert,Text:a.Element._dropVert},c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i;for(a.tagName,c=this.getDOMElementAttributes(a),g="",b="",f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b<c;b++)d=e[b],f.push(d);return f}(),h=0,i=f.length;h<i;h++)if(e=f[h],1===e.nodeType&&"img"===e.tagName.toLowerCase()){g=e.getAttribute("src")||"",b=e.getAttribute("alt")||"";break}return c=this.getDOMElementAttributes(a),c.alt=b,new this(a.tagName,c,g)},c}(a.Element),a.TagNames.get().register(a.ImageFixture,"img-fixture"),a.Video=function(b){function c(a,b,d){var e;null==d&&(d=[]),c.__super__.constructor.call(this,a,b),this.sources=d,e=this.size(),this._aspectRatio=e[1]/e[0]}return h(c,b),c.prototype.cssTypeName=function(){return"video"},c.prototype.type=function(){return"Video"},c.prototype.typeName=function(){return"Video"},c.prototype._title=function(){var a;return a="",this.attr("src")?a=this.attr("src"):this.sources.length&&(a=this.sources[0].src),a||(a="No video source set"),a.length>80&&(a=a.substr(0,80)+"..."),a},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.innerHTML=this._title(),a},c.prototype.html=function(b){var c,d,e,f,g,h,i;if(null==b&&(b=""),d=a.LINE_ENDINGS,"video"===this.tagName()){for(f=[],i=this.sources,g=0,h=i.length;g<h;g++)e=i[g],c=a.attributesToString(e),f.push(""+b+a.INDENT+"<source "+c+">");return b+"<video"+this._attributesToString()+">"+d+f.join(d)+d+b+"</video>"}return b+"<"+this._tagName+this._attributesToString()+"></"+this._tagName+">"},c.prototype.mount=function(){var a;return this._domElement=document.createElement("div"),this.a&&this.a.class?this._domElement.setAttribute("class",this.a.class):this._attributes.class&&this._domElement.setAttribute("class",this._attributes.class),a=this._attributes.style?this._attributes.style:"",this._attributes.width&&(a+="width:"+this._attributes.width+"px;"),this._attributes.height&&(a+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",a),this._domElement.setAttribute("data-ce-title",this._title()),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("iframe"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth,Video:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g;for(d=function(){var c,d,e,f;for(e=a.childNodes,f=[],c=0,d=e.length;c<d;c++)b=e[c],f.push(b);return f}(),e=[],f=0,g=d.length;f<g;f++)c=d[f],1===c.nodeType&&"source"===c.tagName.toLowerCase()&&e.push(this.getDOMElementAttributes(c));return new this(a.tagName,this.getDOMElementAttributes(a),e)},c}(a.ResizableElement),a.TagNames.get().register(a.Video,"iframe","video"),a.List=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"list"},c.prototype.type=function(){return"List"},c.prototype.typeName=function(){return"List"},c.prototype._onMouseOver=function(a){if("ListItem"!==this.parent().type())return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;g<h;g++)d=e[g],1===d.nodeType&&"li"===d.tagName.toLowerCase()&&f.attach(a.ListItem.fromDOMElement(d));return 0===f.children.length?null:f},c}(a.ElementCollection),a.TagNames.get().register(a.List,"ol","ul"),a.ListItem=function(b){function c(a){c.__super__.constructor.call(this,"li",a),this._behaviours.indent=!0}return h(c,b),c.prototype.cssTypeName=function(){return"list-item"},c.prototype.list=function(){return 2===this.children.length?this.children[1]:null},c.prototype.listItemText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"ListItem"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<li"+this._attributesToString()+">"],this.listItemText()&&c.push(this.listItemText().html(b+a.INDENT)),this.list()&&c.push(this.list().html(b+a.INDENT)),c.push(b+"</li>"),c.join(a.LINE_ENDINGS)},c.prototype.indent=function(){var b;if(this.can("indent")&&0!==this.parent().children.indexOf(this))return b=this.previousSibling(),b.list()||b.attach(new a.List(b.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),b.list().attach(this),this.listItemText().restoreState()},c.prototype.remove=function(){var a,b,c,d,e,f;if(this.parent()){if(c=this.parent().children.indexOf(this),this.list())for(f=this.list().children.slice(),b=d=0,e=f.length;d<e;b=++d)a=f[b],a.parent().detach(a),this.parent().attach(a,b+c);return this.parent().detach(this)}},c.prototype.unindent=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(this.can("indent")){if(g=this.parent(),c=g.parent(),k=g.children.slice(g.children.indexOf(this)+1,g.children.length),"ListItem"===c.type()){for(this.listItemText().storeState(),g.detach(this),c.parent().attach(this,c.parent().children.indexOf(c)+1),k.length&&!this.list()&&this.attach(new a.List(g.tagName())),m=0,q=k.length;m<q;m++)j=k[m],j.parent().detach(j),this.list().attach(j);return this.listItemText().restoreState()}if(l=new a.Text("p",this.attr("class")?{class:this.attr("class")}:{},this.listItemText().content),i=null,this.listItemText().isFocused()&&(i=ContentSelect.Range.query(this.listItemText().domElement())),h=c.children.indexOf(g),0===(e=g.children.indexOf(this))){if(f=null,1===g.children.length?(this.list()&&(f=new a.List(g.tagName())),c.detach(g)):g.detach(this),c.attach(l,h),f&&c.attach(f,h+1),this.list())for(u=this.list().children.slice(),d=n=0,r=u.length;n<r;d=++n)b=u[d],b.parent().detach(b),f?f.attach(b):g.attach(b,d)}else if(e===g.children.length-1)g.detach(this),c.attach(l,h+1),this.list()&&c.attach(this.list(),h+2);else{if(g.detach(this),c.attach(l,h+1),f=new a.List(g.tagName()),c.attach(f,h+2),this.list())for(v=this.list().children.slice(),o=0,s=v.length;o<s;o++)b=v[o],b.parent().detach(b),f.attach(b);for(p=0,t=k.length;p<t;p++)j=k[p],j.parent().detach(j),f.attach(j)}return i?(l.focus(),i.select(l.domElement())):void 0}},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l;for(g=new this(this.getDOMElementAttributes(b)),d="",e=null,k=b.childNodes,i=0,j=k.length;i<j;i++)c=k[i],1===c.nodeType?"ul"===(l=c.tagName.toLowerCase())||"ol"===l||"li"===l?e||(e=c):d+=c.outerHTML:d+=HTMLString.String.encode(c.textContent);return d=d.replace(/^\s+|\s+$/g,""),h=new a.ListItemText(d),g.attach(h),e&&(f=a.List.fromDOMElement(e),g.attach(f)),g},c}(a.ElementCollection),a.ListItemText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"list-item-text"},c.prototype.type=function(){return"ListItemText"},c.prototype.typeName=function(){return"List item"},c.prototype.blur=function(){return this.content.isWhitespace()&&this.can("remove")?this.parent().remove():this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(c=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),c.optimize(),this._lastCached=Date.now(),this._cached=c.html()),""+b+this._cached},c.prototype._onMouseDown=function(b){var c;return a.Element.prototype._onMouseDown.call(this,b),c=function(d){return function(){var e;return a.Root.get().dragging()===d?(a.Root.get().cancelDragging(),e=d.closest(function(a){return"Region"===a.parent().type()}),e.drag(b.pageX,b.pageY)):(d.drag(b.pageX,b.pageY),d._dragTimeout=setTimeout(c,2*a.DRAG_HOLD_DURATION))}}(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(c,a.DRAG_HOLD_DURATION)},c.prototype._onMouseMove=function(b){return this._dragTimeout&&clearTimeout(this._dragTimeout),a.Element.prototype._onMouseMove.call(this,b)},c.prototype._onMouseUp=function(b){return this._dragTimeout&&clearTimeout(this._dragTimeout),a.Element.prototype._onMouseUp.call(this,b)},c.prototype._keyTab=function(a){return a.preventDefault(),a.shiftKey?this.parent().unindent():this.parent().indent()},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;return b.preventDefault(),this.content.isWhitespace()?void this.parent().unindent():this.can("spawn")?(ContentSelect.Range.query(this._domElement),f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),h.length()+g.length()===0?void this.parent().unindent():(this.content=h.trim(),this.updateInnerHTML(),c=this.parent().parent(),e=new a.ListItem(this.attr("class")?{class:this.attr("class")}:{}),c.attach(e,c.children.indexOf(this.parent())+1),e.attach(new a.ListItemText(g.trim())),d=this.parent().list(),d&&(this.parent().detach(d),e.attach(d)),h.length()?(e.listItemText().focus(),f=new ContentSelect.Range(0,0),f.select(e.listItemText().domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint())):void 0},c.droppers={ListItemText:function(b,c,d){var e,f,g,h;return e=b.parent(),h=c.parent(),e.remove(),e.detach(b),g=new a.ListItem(e._attributes),g.attach(b),h.list()&&"below"===d[0]?void h.list().attach(g,0):(f=h.parent().children.indexOf(h),"below"===d[0]&&(f+=1),h.parent().attach(g,f))},Text:function(b,c,d){var e,f,g,h,i;if("Text"===b.type()){if(h=c.parent(),b.parent().detach(b),e=b.attr("class"),g=new a.ListItem(e?{class:e}:{}),g.attach(new a.ListItemText(b.content)),h.list()&&"below"===d[0])return void h.list().attach(g,0);if(f=h.parent().children.indexOf(h),"below"===d[0]&&(f+=1),h.parent().attach(g,f),g.listItemText().focus(),b._savedSelection)return b._savedSelection.select(g.listItemText().domElement())}else if(e=b.attr("class"),i=new a.Text("p",e?{class:e}:{},b.content),b.parent().remove(),f=c.parent().children.indexOf(c),"below"===d[0]&&(f+=1),c.parent().attach(i,f),i.focus(),b._savedSelection)return b._savedSelection.select(i.domElement())}},c.mergers={ListItemText:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&(b._domElement.innerHTML=b.content.html()),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),"Text"===a.type()?a.parent()&&a.parent().detach(a):a.parent().remove(),b.taint()}},c}(a.Text),d=a.ListItemText.mergers,d.Text=d.ListItemText,a.Table=function(b){function c(a){c.__super__.constructor.call(this,"table",a)}return h(c,b),c.prototype.cssTypeName=function(){return"table"},c.prototype.typeName=function(){return"Table"},c.prototype.type=function(){return"Table"},c.prototype.firstSection=function(){var a;return(a=this.thead())?a:(a=this.tbody())?a:(a=this.tfoot())?a:null},c.prototype.lastSection=function(){var a;return(a=this.tfoot())?a:(a=this.tbody())?a:(a=this.thead())?a:null},c.prototype.tbody=function(){return this._getChild("tbody")},c.prototype.tfoot=function(){return this._getChild("tfoot")},c.prototype.thead=function(){return this._getChild("thead")},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._getChild=function(a){var b,c,d,e;for(e=this.children,c=0,d=e.length;c<d;c++)if(b=e[c],b.tagName()===a)return b;return null},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Table:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;for(i=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),f=[],k=0,m=e.length;k<m;k++)if(d=e[k],1===d.nodeType&&(j=d.tagName.toLowerCase(),!i._getChild(j)))switch(j){case"tbody":case"tfoot":case"thead":h=a.TableSection.fromDOMElement(d),i.attach(h);break;case"tr":f.push(a.TableRow.fromDOMElement(d))}if(f.length>0)for(i._getChild("tbody")||i.attach(new a.TableSection("tbody")),l=0,n=f.length;l<n;l++)g=f[l],i.tbody().attach(g);return 0===i.children.length?null:i},c}(a.ElementCollection),a.TagNames.get().register(a.Table,"table"),a.TableSection=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"table-section"},c.prototype.type=function(){return"TableSection"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;g<h;g++)d=e[g],1===d.nodeType&&"tr"===d.tagName.toLowerCase()&&f.attach(a.TableRow.fromDOMElement(d));return f},c}(a.ElementCollection),a.TableRow=function(b){function c(a){c.__super__.constructor.call(this,"tr",a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-row"},c.prototype.isEmpty=function(){var a,b,c,d,e;for(e=this.children,c=0,d=e.length;c<d;c++)if(a=e[c],(b=a.tableCellText())&&b.content.length()>0)return!1;return!0},c.prototype.type=function(){return"TableRow"},c.prototype.typeName=function(){return"Table row"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={TableRow:a.Element._dropVert},c.fromDOMElement=function(b){var c,d,e,f,g,h,i;for(f=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a<d;a++)c=e[a],f.push(c);return f}(),h=0,i=e.length;h<i;h++)d=e[h],1===d.nodeType&&("td"!==(g=d.tagName.toLowerCase())&&"th"!==g||f.attach(a.TableCell.fromDOMElement(d)));return f},c}(a.ElementCollection),a.TableCell=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell"},c.prototype.tableCellText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"TableCell"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&c.push(this.tableCellText().html(b+a.INDENT)),c.push(b+"</"+this.tagName()+">"),c.join(a.LINE_ENDINGS)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d;return c=new this(b.tagName,this.getDOMElementAttributes(b)),d=new a.TableCellText(b.innerHTML.replace(/^\s+|\s+$/g,"")),c.attach(d),c},c}(a.ElementCollection),a.TableCellText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell-text"},c.prototype.type=function(){return"TableCellText"},c.prototype._isInFirstRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.firstSection()&&b===c.children[0]},c.prototype._isInLastRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.lastSection()&&b===c.children[c.children.length-1]},c.prototype._isLastInSection=function(){var a,b,c;return a=this.parent(),b=a.parent(),c=b.parent(),b===c.children[c.children.length-1]&&a===b.children[b.children.length-1]},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached<this._modified)&&(c=a.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),c.optimize(),this._lastCached=Date.now(),this._cached=c.html()),""+b+this._cached},c.prototype._onMouseDown=function(b){var c;return a.Element.prototype._onMouseDown.call(this,b),c=function(d){return function(){var e,f;return e=d.parent(),a.Root.get().dragging()===e.parent()?(a.Root.get().cancelDragging(),f=e.parent().parent().parent(),f.drag(b.pageX,b.pageY)):(e.parent().drag(b.pageX,b.pageY),d._dragTimeout=setTimeout(c,2*a.DRAG_HOLD_DURATION))}}(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(c,a.DRAG_HOLD_DURATION)},c.prototype._keyBack=function(a){var b,c,d,e;if(e=ContentSelect.Range.query(this._domElement),0===e.get()[0]&&e.isCollapsed()&&(a.preventDefault(),b=this.parent(),d=b.parent(),d.isEmpty()&&d.can("remove")))return 0===this.content.length()&&0===d.children.indexOf(b)?(c=this.previousContent(),c&&(c.focus(),e=new ContentSelect.Range(c.content.length(),c.content.length()),e.select(c.domElement())),d.parent().detach(d)):void 0},c.prototype._keyDelete=function(a){var b,c,d,e;if(d=this.parent().parent(),d.isEmpty()&&d.can("remove"))return a.preventDefault(),b=d.children[d.children.length-1],c=b.tableCellText().nextContent(),c&&(c.focus(),e=new ContentSelect.Range(0,0),e.select(c.domElement())),d.parent().detach(d)},c.prototype._keyDown=function(b){var c,d,e,f,g,h,i;if(i=ContentSelect.Range.query(this._domElement),this._atEnd(i)&&i.isCollapsed())return b.preventDefault(),c=this.parent(),this._isInLastRow()?(h=c.parent(),e=h.children[h.children.length-1].tableCellText(),f=e.nextContent(),f?f.focus():a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(g=c.parent().nextWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,g.children.length),g.children[d].tableCellText().focus())},c.prototype._keyReturn=function(a){return a.preventDefault(),this._keyTab({shiftKey:!1,preventDefault:function(){}})},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l;if(b.preventDefault(),c=this.parent(),b.shiftKey){if(this._isInFirstRow()&&c.parent().children[0]===c)return;return this.previousContent().focus()}if(this.can("spawn")){if(e=c.parent().parent(),"tbody"===e.tagName()&&this._isLastInSection()){for(h=new a.TableRow,l=c.parent().children,j=0,k=l.length;j<k;j++)d=l[j],f=new a.TableCell(d.tagName(),d._attributes),g=new a.TableCellText(""),f.attach(g),h.attach(f);return i=this.closest(function(a){return"TableSection"===a.type()}),i.attach(h),h.children[0].tableCellText().focus()}return this.nextContent().focus()}},c.prototype._keyUp=function(b){var c,d,e,f,g,h;if(h=ContentSelect.Range.query(this._domElement),0===h.get()[0]&&h.isCollapsed())return b.preventDefault(),c=this.parent(),this._isInFirstRow()?(g=c.parent(),e=g.children[0].previousContent(),e?e.focus():a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(f=c.parent().previousWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,f.children.length),f.children[d].tableCellText().focus())},c.droppers={},c.mergers={},c}(a.Text)}.call(this),function(){var a,b,c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h=function(a,b){return function(){return a.apply(b,arguments)}},i=[].slice;b={Tools:{},CANCEL_MESSAGE:"Your changes have not been saved, do you really want to lose them?".trim(),DEFAULT_TOOLS:[["heading","heading2","heading3","heading4","heading5","paragraph","bold","italic","underline","strike","code","link","align-left","align-center","align-right","unordered-list","ordered-list","line-break","indent","unindent"],["image","video","table","undo","redo","remove"]],DEFAULT_VIDEO_HEIGHT:315,DEFAULT_VIDEO_WIDTH:560,HIGHLIGHT_HOLD_DURATION:2e3,IMAGE_UPLOADER:null,INLINE_TAGS:["a","address","b","code","del","em","i","ins","span","strong","sup","u"],INSPECTOR_IGNORED_ELEMENTS:["Fixture","ListItemText","Region","TableCellText"],MIN_CROP:10,RESTRICTED_ATTRIBUTES:{"*":["style"],img:["height","src","width","data-ce-max-width","data-ce-min-width"]},getEmbedVideoURL:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(b={"www.youtube.com":"youtube","youtu.be":"youtube","vimeo.com":"vimeo","player.vimeo.com":"vimeo"},k=document.createElement("a"),k.href=a,g=k.hostname.toLowerCase(),l=k.pathname,null!==l&&"/"!==l.substr(0,1)&&(l="/"+l),i={},j=k.search.slice(1),p=j.split("&"),n=0,o=p.length;n<o;n++)e=p[n],e=e.split("="),e[0]&&(i[e[0]]=e[1]);switch(b[g]){case"youtube":if("/watch"===l.toLowerCase()){if(!i.v)return null;c=i.v,delete i.v}else{if(!(f=l.match(/\/([A-Za-z0-9_-]+)$/i)))return null;c=f[1]}return a="https://www.youtube.com/embed/"+c,h=function(){var a;a=[];for(d in i)m=i[d],a.push(d+"="+m);return a}().join("&"),h&&(a+="?"+h),a;case"vimeo":return(f=l.match(/\/(\w+\/\w+\/){0,1}(\d+)/i))?(a="https://player.vimeo.com/video/"+f[2],h=function(){var a;a=[];for(d in i)m=i[d],a.push(d+"="+m);return a}().join("&"),h&&(a+="?"+h),a):null}return null},getHTMLCleaner:function(){return new b.HTMLCleaner},getRestrictedAtributes:function(a){var c;return c=[],b.RESTRICTED_ATTRIBUTES[a]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES[a])),b.RESTRICTED_ATTRIBUTES["*"]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES["*"])),c},getScrollPosition:function(){var a,b;return b=void 0!==window.pageXOffset,a=4===(document.compatMode||4),b?[window.pageXOffset,window.pageYOffset]:a?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]}},"undefined"!=typeof window&&(window.ContentTools=b),"undefined"!=typeof module&&module.exports&&(module.exports=b),b.ComponentUI=function(){function a(){this._bindings={},this._parent=null,this._children=[],this._domElement=null}return a.prototype.children=function(){return this._children.slice()},a.prototype.domElement=function(){return this._domElement},a.prototype.isMounted=function(){return null!==this._domElement},a.prototype.parent=function(){return this._parent},a.prototype.attach=function(a,b){return a.parent()&&a.parent().detach(a),a._parent=this,void 0!==b?this._children.splice(b,0,a):this._children.push(a)},a.prototype.addCSSClass=function(a){if(this.isMounted())return ContentEdit.addCSSClass(this._domElement,a)},a.prototype.detach=function(a){var b;if(-1!==(b=this._children.indexOf(a)))return this._children.splice(b,1)},a.prototype.mount=function(){},a.prototype.removeCSSClass=function(a){if(this.isMounted())return ContentEdit.removeCSSClass(this._domElement,a)},a.prototype.unmount=function(){if(this.isMounted())return this._removeDOMEventListeners(),this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null},a.prototype.addEventListener=function(a,b){void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b)},a.prototype.createEvent=function(a,c){return new b.Event(a,c)},a.prototype.dispatchEvent=function(a){var b,c,d,e;if(!this._bindings[a.name()])return!a.defaultPrevented();for(e=this._bindings[a.name()],c=0,d=e.length;c<d&&(b=e[c],!a.propagationStopped());c++)b&&b.call(this,a);return!a.defaultPrevented()},a.prototype.removeEventListener=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;e<f;c=++e)d=g[c],d===b?h.push(this._bindings[a].splice(c,1)):h.push(void 0);return h}},a.prototype._addDOMEventListeners=function(){},a.prototype._removeDOMEventListeners=function(){},a.createDiv=function(a,b,c){var d,e,f;if(d=document.createElement("div"),a&&a.length>0&&d.setAttribute("class",a.join(" ")),b)for(e in b)f=b[e],d.setAttribute(e,f);return c&&(d.innerHTML=c),d},a}(),b.WidgetUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.attach=function(a,c){if(b.__super__.attach.call(this,a,c),!this.isMounted())return a.mount()},b.prototype.detach=function(a){if(b.__super__.detach.call(this,a),this.isMounted())return a.unmount()},b.prototype.detatch=function(a){return console.log("Please call detach, detatch will be removed in release 1.4.x"),this.detach(a)},b.prototype.show=function(){var a;return this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null,this.unmount()),this.isMounted()||this.mount(),a=function(a){return function(){return a.addCSSClass("ct-widget--active"),a._showTimeout=null}}(this),this._showTimeout=setTimeout(a,100)},b.prototype.hide=function(){var a;if(this._showTimeout&&(clearTimeout(this._showTimeout),this._showTimeout=null),this.removeCSSClass("ct-widget--active"),a=function(b){return function(){return b._hideTimeout=null,window.getComputedStyle?parseFloat(window.getComputedStyle(b._domElement).opacity)<.01?b.unmount():b._hideTimeout=setTimeout(a,250):void b.unmount()}}(this),this.isMounted())return this._hideTimeout=setTimeout(a,250)},b}(b.ComponentUI),b.AnchoredComponentUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.mount=function(a,b){return null==b&&(b=null),a.insertBefore(this._domElement,b),this._addDOMEventListeners()},b}(b.ComponentUI),b.Event=function(){function a(a,b){this._name=a,this._detail=b,this._timeStamp=Date.now(),this._defaultPrevented=!1,this._propagationStopped=!1}return a.prototype.defaultPrevented=function(){return this._defaultPrevented},a.prototype.detail=function(){return this._detail},a.prototype.name=function(){return this._name},a.prototype.propagationStopped=function(){return this._propagationStopped},a.prototype.timeStamp=function(){return this._timeStamp},a.prototype.preventDefault=function(){return this._defaultPrevented=!0},a.prototype.stopImmediatePropagation=function(){return this._propagationStopped=!0},a}(),b.FlashUI=function(a){function c(a){c.__super__.constructor.call(this),this.mount(a)}return g(c,a),c.prototype.mount=function(a){var d;return this._domElement=this.constructor.createDiv(["ct-flash","ct-flash--active","ct-flash--"+a,"ct-widget","ct-widget--active"]),c.__super__.mount.call(this,b.EditorApp.get().domElement()),d=function(a){return function(){return window.getComputedStyle?parseFloat(window.getComputedStyle(a._domElement).opacity)<.01?a.unmount():setTimeout(d,250):void a.unmount()}}(this),setTimeout(d,250)},c}(b.AnchoredComponentUI),b.IgnitionUI=function(a){function b(){b.__super__.constructor.call(this),this._revertToState="ready",this._state="ready"}return g(b,a),b.prototype.busy=function(a){if(this.dispatchEvent(this.createEvent("busy",{busy:a}))){if(a===("busy"===this._state))return;return a?(this._revertToState=this._state,this.state("busy")):this.state(this._revertToState)}},b.prototype.cancel=function(){if(this.dispatchEvent(this.createEvent("cancel")))return this.state("ready")},b.prototype.confirm=function(){if(this.dispatchEvent(this.createEvent("confirm")))return this.state("ready")},b.prototype.edit=function(){if(this.dispatchEvent(this.createEvent("edit")))return this.state("editing")},b.prototype.mount=function(){return b.__super__.mount.call(this),this._domElement=this.constructor.createDiv(["ct-widget","ct-ignition","ct-ignition--ready"]),this.parent().domElement().appendChild(this._domElement),this._domEdit=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--edit"]),this._domElement.appendChild(this._domEdit),this._domLogout=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--logout"]),this._domElement.appendChild(this._domLogout),this._domConfirm=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--confirm"]),this._domElement.appendChild(this._domConfirm),this._domBlog=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--blog"]),this._domElement.appendChild(this._domBlog),this._domCancel=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--cancel"]),this._domElement.appendChild(this._domCancel),
this._domBusy=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--busy"]),this._domElement.appendChild(this._domBusy),this._addDOMEventListeners()},b.prototype.state=function(a){if(void 0===a)return this._state;if(this._state!==a&&this.dispatchEvent(this.createEvent("statechange",{state:a})))return this._state=a,this.removeCSSClass("ct-ignition--busy"),this.removeCSSClass("ct-ignition--editing"),this.removeCSSClass("ct-ignition--ready"),"busy"===this._state?this.addCSSClass("ct-ignition--busy"):"editing"===this._state?this.addCSSClass("ct-ignition--editing"):"ready"===this._state?this.addCSSClass("ct-ignition--ready"):void 0},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domEdit=null,this._domConfirm=null,this._domCancel=null},b.prototype._addDOMEventListeners=function(){return this._domEdit.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.edit()}}(this)),this._domConfirm.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.confirm()}}(this)),this._domCancel.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.cancel()}}(this))},b}(b.WidgetUI),b.InspectorUI=function(a){function c(){c.__super__.constructor.call(this),this._tagUIs=[]}return g(c,a),c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-inspector"]),this.parent().domElement().appendChild(this._domElement),this._domTags=this.constructor.createDiv(["ct-inspector__tags","ct-tags"]),this._domElement.appendChild(this._domTags),this._domCounter=this.constructor.createDiv(["ct-inspector__counter"]),this._domElement.appendChild(this._domCounter),this.updateCounter(),this._addDOMEventListeners(),this._handleFocusChange=function(a){return function(){return a.updateTags()}}(this),ContentEdit.Root.get().bind("blur",this._handleFocusChange),ContentEdit.Root.get().bind("focus",this._handleFocusChange),ContentEdit.Root.get().bind("mount",this._handleFocusChange)},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domTags=null,ContentEdit.Root.get().unbind("blur",this._handleFocusChange),ContentEdit.Root.get().unbind("focus",this._handleFocusChange),ContentEdit.Root.get().unbind("mount",this._handleFocusChange)},c.prototype.updateCounter=function(){var a,c,d,e,f,g,h,i,j,k,l;if(this.isMounted()){for(c="",l=b.EditorApp.get().orderedRegions(),j=0,k=l.length;j<k;j++)(g=l[j])&&(c+=g.domElement().textContent);return c=c.trim(),(c=c.replace(/<\/?[a-z][^>]*>/gi,""),c=c.replace(/[\u200B]+/,""),c=c.replace(/['";:,.?¿\-!¡]+/g,""),i=(c.match(/\S+/g)||[]).length,i=i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),(d=ContentEdit.Root.get().focused())&&"PreText"===d.type()&&d.selection().isCollapsed())?(e=0,a=1,h=d.content.substring(0,d.selection().get()[0]),f=h.text().split("\n"),e=f.length,a=f[f.length-1].length+1,e=e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),a=a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),this._domCounter.textContent=i+" / "+e+":"+a):void(this._domCounter.textContent=i)}},c.prototype.updateTags=function(){var a,c,d,e,f,g,h,i,j;for(a=ContentEdit.Root.get().focused(),i=this._tagUIs,e=0,g=i.length;e<g;e++)d=i[e],d.unmount();if(this._tagUIs=[],a){for(c=a.parents(),c.reverse(),c.push(a),j=[],f=0,h=c.length;f<h;f++)a=c[f],-1===b.INSPECTOR_IGNORED_ELEMENTS.indexOf(a.type())&&(d=new b.TagUI(a),this._tagUIs.push(d),j.push(d.mount(this._domTags)));return j}},c.prototype._addDOMEventListeners=function(){return this._updateCounterInterval=setInterval(function(a){return function(){return a.updateCounter()}}(this),250)},c.prototype._removeDOMEventListeners=function(){return clearInterval(this._updateCounterInterval)},c}(b.WidgetUI),b.TagUI=function(a){function c(a){this.element=a,this._onMouseDown=h(this._onMouseDown,this),c.__super__.constructor.call(this)}return g(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-tag"]),this._domElement.textContent=this.element.tagName(),c.__super__.mount.call(this,a,b)},c.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown)},c.prototype._onMouseDown=function(a){var c,d,e;return a.preventDefault(),this.element.storeState&&this.element.storeState(),c=b.EditorApp.get(),e=new b.ModalUI,d=new b.PropertiesDialog(this.element),d.addEventListener("cancel",function(a){return function(){if(e.hide(),d.hide(),a.element.restoreState)return a.element.restoreState()}}(this)),d.addEventListener("save",function(a){return function(b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;j=b.detail(),f=j.changedAttributes,n=j.changedStyles,l=j.innerHTML;for(m in f)if(o=f[m],"class"===m){for(null===o&&(o=""),h={},t=o.split(" "),p=0,r=t.length;p<r;p++)g=t[p],(g=g.trim())&&(h[g]=!0,a.element.hasCSSClass(g)||a.element.addCSSClass(g));if(a.element.attr("class"))for(u=a.element.attr("class").split(" "),q=0,s=u.length;q<s;q++)g=u[q],g=g.trim(),void 0===h[g]&&a.element.removeCSSClass(g)}else null===o?a.element.removeAttr(m):a.element.attr(m,o);for(i in n)c=n[i],c?a.element.addCSSClass(i):a.element.removeCSSClass(i);if(null!==l&&l!==d.getElementInnerHTML()&&(k=a.element,k.content||(k=k.children[0]),k.content=new HTMLString.String(l,k.content.preserveWhitespace()),k.updateInnerHTML(),k.taint(),k.selection(new ContentSelect.Range(0,0)),k.storeState()),e.hide(),d.hide(),a.element.restoreState)return a.element.restoreState()}}(this)),c.attach(e),c.attach(d),e.show(),d.show()},c}(b.AnchoredComponentUI),b.ModalUI=function(a){function b(a,c){b.__super__.constructor.call(this),this._transparent=a,this._allowScrolling=c}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-modal"]),this.parent().domElement().appendChild(this._domElement),this._transparent&&this.addCSSClass("ct-modal--transparent"),this._allowScrolling||ContentEdit.addCSSClass(document.body,"ct--no-scroll"),this._addDOMEventListeners()},b.prototype.unmount=function(){return this._allowScrolling||ContentEdit.removeCSSClass(document.body,"ct--no-scroll"),b.__super__.unmount.call(this)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("click"))}}(this))},b}(b.WidgetUI),b.ToolboxUI=function(a){function c(a){this._onStopDragging=h(this._onStopDragging,this),this._onStartDragging=h(this._onStartDragging,this),this._onDrag=h(this._onDrag,this),c.__super__.constructor.call(this),this._tools=a,this._dragging=!1,this._draggingOffset=null,this._domGrip=null,this._toolUIs={}}return g(c,a),c.prototype.isDragging=function(){return this._dragging},c.prototype.hide=function(){return this._removeDOMEventListeners(),c.__super__.hide.call(this)},c.prototype.mount=function(){var a,b,c;return this._domElement=this.constructor.createDiv(["ct-widget","ct-toolbox"]),this.parent().domElement().appendChild(this._domElement),this._domGrip=this.constructor.createDiv(["ct-toolbox__grip","ct-grip"]),this._domElement.appendChild(this._domGrip),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domToolGroups=this.constructor.createDiv(["ct-tool-groups"]),this._domElement.appendChild(this._domToolGroups),this.tools(this._tools),c=window.localStorage.getItem("ct-toolbox-position"),c&&/^\d+,\d+$/.test(c)&&(b=function(){var b,d,e,f;for(e=c.split(","),f=[],b=0,d=e.length;b<d;b++)a=e[b],f.push(parseInt(a));return f}(),this._domElement.style.left=b[0]+"px",this._domElement.style.top=b[1]+"px",this._contain()),this._addDOMEventListeners()},c.prototype.tools=function(a){var c,d,e,f,g,h,i,j,k,l,m;if(void 0===a)return this._tools;if(this._tools=a,this.isMounted()){k=this._toolUIs;for(g in k)h=k[g],h.unmount();for(this._toolUIs={};this._domToolGroups.lastChild;)this._domToolGroups.removeChild(this._domToolGroups.lastChild);for(l=this._tools,m=[],d=i=0,j=l.length;i<j;d=++i)f=l[d],c=this.constructor.createDiv(["ct-tool-group"]),this._domToolGroups.appendChild(c),m.push(function(){var a,d,h;for(h=[],a=0,d=f.length;a<d;a++)g=f[a],e=b.ToolShelf.fetch(g),this._toolUIs[g]=new b.ToolUI(e),this._toolUIs[g].mount(c),this._toolUIs[g].disabled(!0),h.push(this._toolUIs[g].addEventListener("applied",function(a){return function(){return a.updateTools()}}(this)));return h}.call(this));return m}},c.prototype.updateTools=function(){var a,b,c,d,e,f;a=ContentEdit.Root.get().focused(),c=null,a&&a.selection&&(c=a.selection()),e=this._toolUIs,f=[];for(b in e)d=e[b],f.push(d.update(a,c));return f},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domGrip=null},c.prototype._addDOMEventListeners=function(){return this._domGrip.addEventListener("mousedown",this._onStartDragging),this._domGrip.addEventListener("touchstart",this._onStartDragging),this._handleResize=function(a){return function(b){var c;return a._resizeTimeout&&clearTimeout(a._resizeTimeout),c=function(){return a._contain()},a._resizeTimeout=setTimeout(c,250)}}(this),window.addEventListener("resize",this._handleResize),this._updateTools=function(a){return function(){var c,d,e,f,g,h,i,j;if(c=b.EditorApp.get(),h=!1,d=ContentEdit.Root.get().focused(),f=null,d===a._lastUpdateElement?d&&d.selection&&(f=d.selection(),a._lastUpdateSelection?f.eq(a._lastUpdateSelection)||(h=!0):h=!0):h=!0,c.history&&(a._lastUpdateHistoryLength!==c.history.length()&&(h=!0),a._lastUpdateHistoryLength=c.history.length(),a._lastUpdateHistoryIndex!==c.history.index()&&(h=!0),a._lastUpdateHistoryIndex=c.history.index()),a._lastUpdateElement=d,a._lastUpdateSelection=f,h){i=a._toolUIs,j=[];for(e in i)g=i[e],j.push(g.update(d,f));return j}}}(this),this._updateToolsInterval=setInterval(this._updateTools,100),this._handleKeyDown=function(a){return function(c){var d,e,f,g,h,i,j;if((e=ContentEdit.Root.get().focused())&&!e.content){if(46===c.keyCode)return c.preventDefault(),b.Tools.Remove.apply(e,null,function(){});if(13===c.keyCode)return c.preventDefault(),d=b.Tools.Paragraph,d.apply(e,null,function(){})}switch(j=navigator.appVersion,f="linux",-1!==j.indexOf("Mac")?f="mac":-1!==j.indexOf("Win")&&(f="windows"),g=!1,i=!1,h=!1,f){case"linux":c.altKey||(90===c.keyCode&&c.ctrlKey&&(g=c.shiftKey,i=!g),83===c.keyCode&&c.ctrlKey&&(h=!0));break;case"mac":c.altKey||c.ctrlKey||(90===c.keyCode&&c.metaKey&&(g=c.shiftKey,i=!g),83===c.keyCode&&c.metaKey&&(h=!0));break;case"windows":c.altKey&&!c.shiftKey||(89===c.keyCode&&c.ctrlKey&&(g=!0),90===c.keyCode&&c.ctrlKey&&(i=!0),83===c.keyCode&&c.ctrlKey&&(h=!0))}if(i&&b.Tools.Undo.canApply(null,null)&&b.Tools.Undo.apply(null,null,function(){}),g&&b.Tools.Redo.canApply(null,null)&&b.Tools.Redo.apply(null,null,function(){}),h)return c.preventDefault(),a._parent.save(!0)}}(this),window.addEventListener("keydown",this._handleKeyDown)},c.prototype._contain=function(){var a;if(this.isMounted())return a=this._domElement.getBoundingClientRect(),a.left+a.width>window.innerWidth&&(this._domElement.style.left=window.innerWidth-a.width+"px"),a.top+a.height>window.innerHeight&&(this._domElement.style.top=window.innerHeight-a.height+"px"),a.left<0&&(this._domElement.style.left="0px"),a.top<0&&(this._domElement.style.top="0px"),a=this._domElement.getBoundingClientRect(),window.localStorage.setItem("ct-toolbox-position",a.left+","+a.top)},c.prototype._removeDOMEventListeners=function(){return this.isMounted()&&this._domGrip.removeEventListener("mousedown",this._onStartDragging),window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("resize",this._handleResize),clearInterval(this._updateToolsInterval)},c.prototype._onDrag=function(a){return a.preventDefault(),ContentSelect.Range.unselectAll(),"touchmove"===a.type?(this._domElement.style.left=a.touches[0].clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.touches[0].clientY-this._draggingOffset.y+"px"):(this._domElement.style.left=a.clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.clientY-this._draggingOffset.y+"px")},c.prototype._onStartDragging=function(a){var b;if(a.preventDefault(),!this.isDragging())return this._dragging=!0,this.addCSSClass("ct-toolbox--dragging"),b=this._domElement.getBoundingClientRect(),"touchstart"===a.type?(this._draggingOffset={x:a.touches[0].clientX-b.left,y:a.touches[0].clientY-b.top},document.addEventListener("touchmove",this._onDrag),document.addEventListener("touchend",this._onStopDragging)):(this._draggingOffset={x:a.clientX-b.left,y:a.clientY-b.top},document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging)),ContentEdit.addCSSClass(document.body,"ce--dragging")},c.prototype._onStopDragging=function(a){if(this.isDragging())return this._contain(),document.removeEventListener("touchmove",this._onDrag),document.removeEventListener("touchend",this._onStopDragging),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._draggingOffset=null,this._dragging=!1,this.removeCSSClass("ct-toolbox--dragging"),ContentEdit.removeCSSClass(document.body,"ce--dragging")},c}(b.WidgetUI),b.ToolUI=function(a){function b(a){this._onMouseUp=h(this._onMouseUp,this),this._onMouseLeave=h(this._onMouseLeave,this),this._onMouseDown=h(this._onMouseDown,this),this._addDOMEventListeners=h(this._addDOMEventListeners,this),b.__super__.constructor.call(this),this.tool=a,this._mouseDown=!1,this._disabled=!1}return g(b,a),b.prototype.apply=function(a,b){var c,d;if(this.tool.canApply(a,b))return d={element:a,selection:b},c=function(a){return function(b){if(b)return a.dispatchEvent(a.createEvent("applied",d))}}(this),this.dispatchEvent(this.createEvent("apply",d))?this.tool.apply(a,b,c):void 0},b.prototype.disabled=function(a){if(void 0===a)return this._disabled;if(this._disabled!==a)return this._disabled=a,a?(this._mouseDown=!1,this.addCSSClass("ct-tool--disabled"),this.removeCSSClass("ct-tool--applied")):this.removeCSSClass("ct-tool--disabled")},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-tool","ct-tool--"+this.tool.icon]),this._domElement.setAttribute("data-ct-tooltip",ContentEdit._(this.tool.label)),b.__super__.mount.call(this,a,c)},b.prototype.update=function(a,b){return(!this.tool.requiresElement||a&&a.isMounted())&&this.tool.canApply(a,b)?(this.disabled(!1),this.tool.isApplied(a,b)?this.addCSSClass("ct-tool--applied"):this.removeCSSClass("ct-tool--applied")):void this.disabled(!0)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseleave",this._onMouseLeave),this._domElement.addEventListener("mouseup",this._onMouseUp)},b.prototype._onMouseDown=function(a){if(a.preventDefault(),!this.disabled())return this._mouseDown=!0,this.addCSSClass("ct-tool--down")},b.prototype._onMouseLeave=function(a){return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b.prototype._onMouseUp=function(a){var b,c;if(this._mouseDown){if(b=ContentEdit.Root.get().focused(),this.tool.requiresElement&&(!b||!b.isMounted()))return;c=null,b&&b.selection&&(c=b.selection()),this.apply(b,c)}return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b}(b.AnchoredComponentUI),b.AnchoredDialogUI=function(a){function b(){b.__super__.constructor.call(this),this._position=[0,0]}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-anchored-dialog"]),this.parent().domElement().appendChild(this._domElement),this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"},b.prototype.position=function(a){return void 0===a?this._position.slice():(this._position=a.slice(),this.isMounted()?(this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"):void 0)},b.prototype._contain=function(){var a,b,c;if(this.isMounted())return c=this._domElement.getBoundingClientRect(),a=c.width/2+5,b=document.documentElement.clientWidth||document.body.clientWidth,this._position[0]+a>b&&(this._position[0]=b-a),this._position[0]<a&&(this._position[0]=a),this._position[1]+c.top<5?this._position[1]=Math.abs(c.top)+5:void 0},b}(b.WidgetUI),b.DialogUI=function(a){function b(a){null==a&&(a=""),b.__super__.constructor.call(this),this._busy=!1,this._caption=a}return g(b,a),b.prototype.busy=function(a){if(void 0===a)return this._busy;if(this._busy!==a&&(this._busy=a,this.isMounted()))return this._busy?ContentEdit.addCSSClass(this._domElement,"ct-dialog--busy"):ContentEdit.removeCSSClass(this._domElement,"ct-dialog--busy")},b.prototype.caption=function(a){return void 0===a?this._caption:(this._caption=a,this._domCaption.textContent=ContentEdit._(a))},b.prototype.mount=function(){var a,b,c;return document.activeElement&&(document.activeElement.blur(),window.getSelection().removeAllRanges()),a=["ct-widget","ct-dialog"],this._busy&&a.push("ct-dialog--busy"),this._domElement=this.constructor.createDiv(a),this.parent().domElement().appendChild(this._domElement),c=this.constructor.createDiv(["ct-dialog__header"]),this._domElement.appendChild(c),this._domCaption=this.constructor.createDiv(["ct-dialog__caption"]),c.appendChild(this._domCaption),this.caption(this._caption),this._domClose=this.constructor.createDiv(["ct-dialog__close"]),c.appendChild(this._domClose),b=this.constructor.createDiv(["ct-dialog__body"]),this._domElement.appendChild(b),this._domView=this.constructor.createDiv(["ct-dialog__view"]),b.appendChild(this._domView),this._domControls=this.constructor.createDiv(["ct-dialog__controls"]),b.appendChild(this._domControls),this._domBusy=this.constructor.createDiv(["ct-dialog__busy"]),this._domElement.appendChild(this._domBusy)},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBusy=null,this._domCaption=null,this._domClose=null,this._domControls=null,this._domView=null},b.prototype._addDOMEventListeners=function(){return this._handleEscape=function(a){return function(b){if(!a._busy)return 27===b.keyCode?a.dispatchEvent(a.createEvent("cancel")):void 0}}(this),document.addEventListener("keyup",this._handleEscape),this._domClose.addEventListener("click",function(a){return function(b){if(b.preventDefault(),!a._busy)return a.dispatchEvent(a.createEvent("cancel"))}}(this))},b.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keyup",this._handleEscape)},b}(b.WidgetUI),b.ImageDialog=function(a){function d(){d.__super__.constructor.call(this,"Insert image"),this._cropMarks=null,this._imageURL=null,this._imageSize=null,this._progress=0,this._state="empty",b.IMAGE_UPLOADER&&b.IMAGE_UPLOADER(this)}return g(d,a),d.prototype.cropRegion=function(){return this._cropMarks?this._cropMarks.region():[0,0,1,1]},d.prototype.hideImages=function(){if(this._domImagesContainer)return this._domImagesContainer.parentNode.removeChild(this._domImagesContainer)},d.prototype.showImages=function(){var a,b,c,d,e,f,g,h;if(this.hideImages,this.images){for(this._domImagesContainer=this.constructor.createDiv(["ct-image-dialog-images__container"]),this._domView.appendChild(this._domImagesContainer),d=this.constructor.createDiv(["ct-image-dialog-images"]),this._domImagesContainer.appendChild(d),g=this.images,h=[],e=0,f=g.length;e<f;e++)a=g[e],c=this.constructor.createDiv(["ct-image-dialog-images__image"]),b=new Image,b.src=a,c.appendChild(b),d.appendChild(c),h.push(b.addEventListener("click",function(a){return function(b){return a._imageSelected={src:b.target.attributes[0].value,size:[b.target.naturalWidth,b.target.naturalHeight]},a.populate(a._imageSelected.src,a._imageSelected.size)}}(this)));return h}},d.prototype.addImages=function(a){return this.images=a},d.prototype.addCropMarks=function(){if(!this._cropMarks)return this._cropMarks=new c(this._imageSize),this._cropMarks.mount(this._domView),ContentEdit.addCSSClass(this._domCrop,"ct-control--active")},d.prototype.clear=function(){return this._domImage&&(this._domImage.parentNode.removeChild(this._domImage),this._domImage=null),this._imageURL=null,this._imageSize=null,this.state("empty"),this.showImages()},d.prototype.mount=function(){var a,b,c;return d.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog"),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--empty"),ContentEdit.addCSSClass(this._domView,"ct-image-dialog__view"),c=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(c),b=this.constructor.createDiv(["ct-progress-bar"]),c.appendChild(b),this._domProgress=this.constructor.createDiv(["ct-progress-bar__progress"]),b.appendChild(this._domProgress),a=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(a),this._domUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--upload"]),this._domUpload.textContent=ContentEdit._("Upload"),a.appendChild(this._domUpload),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-image-dialog__file-upload"),this._domInput.setAttribute("name","file"),this._domInput.setAttribute("type","file"),this._domInput.setAttribute("accept","image/*"),this._domUpload.appendChild(this._domInput),this._domInsert=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert"]),this._domInsert.textContent=ContentEdit._("Insert"),a.appendChild(this._domInsert),this._domCancelUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--cancel"]),this._domCancelUpload.textContent=ContentEdit._("Cancel"),a.appendChild(this._domCancelUpload),this._domClear=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--clear"]),this._domClear.textContent=ContentEdit._("Clear"),a.appendChild(this._domClear),this._addDOMEventListeners(),this.dispatchEvent(this.createEvent("imageuploader.mount")),this.showImages()},d.prototype.populate=function(a,b){return this.hideImages(),this._imageURL=a,this._imageSize=b,this._domImage||(this._domImage=this.constructor.createDiv(["ct-image-dialog__image"]),this._domView.appendChild(this._domImage)),this._domImage.style["background-image"]="url("+a+")",this.state("populated")},d.prototype.progress=function(a){return void 0===a?this._progress:(this._progress=a,this.isMounted()?this._domProgress.style.width=this._progress+"%":void 0)},d.prototype.removeCropMarks=function(){if(this._cropMarks)return this._cropMarks.unmount(),this._cropMarks=null,ContentEdit.removeCSSClass(this._domCrop,"ct-control--active")},d.prototype.save=function(a,b,c){return a?this.dispatchEvent(this.createEvent("save",{imageURL:a,imageSize:b,imageAttrs:c})):this._imageSelected?this.dispatchEvent(this.createEvent("save",{imageURL:this._imageSelected.src,imageSize:this._imageSelected.size})):void 0},d.prototype.state=function(a){var b;if(void 0===a)return this._state;if(this._state!==a&&(b=this._state,this._state=a,this.isMounted()))return ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--"+this._state),ContentEdit.removeCSSClass(this._domElement,"ct-image-dialog--"+b)},d.prototype.unmount=function(){return d.__super__.unmount.call(this),this._domCancelUpload=null,this._domClear=null,this._domCrop=null,this._domInput=null,this._domInsert=null,this._domProgress=null,this._domRotateCCW=null,this._domRotateCW=null,this._domUpload=null,this.dispatchEvent(this.createEvent("imageuploader.unmount"))},d.prototype._addDOMEventListeners=function(){return d.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("change",function(a){return function(b){var c;if(c=b.target.files[0])return b.target.value="",b.target.value&&(b.target.type="text",b.target.type="file"),a.dispatchEvent(a.createEvent("imageuploader.fileready",{file:c}))}}(this)),this._domCancelUpload.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("imageuploader.cancelupload"))}}(this)),this._domClear.addEventListener("click",function(a){return function(b){return a.removeCropMarks(),a.dispatchEvent(a.createEvent("imageuploader.clear"))}}(this)),this._domInsert.addEventListener("click",function(a){return function(b){return a.dispatchEvent(a.createEvent("imageuploader.save"))}}(this))},d}(b.DialogUI),c=function(a){function c(a){c.__super__.constructor.call(this),this._bounds=null,this._dragging=null,this._draggingOrigin=null,this._imageSize=a}return g(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-crop-marks"]),this._domClipper=this.constructor.createDiv(["ct-crop-marks__clipper"]),this._domElement.appendChild(this._domClipper),this._domRulers=[this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--top-left"]),this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--bottom-right"])],this._domClipper.appendChild(this._domRulers[0]),this._domClipper.appendChild(this._domRulers[1]),this._domHandles=[this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--top-left"]),this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--bottom-right"])],this._domElement.appendChild(this._domHandles[0]),this._domElement.appendChild(this._domHandles[1]),c.__super__.mount.call(this,a,b),this._fit(a)},c.prototype.region=function(){return[parseFloat(this._domHandles[0].style.top)/this._bounds[1],parseFloat(this._domHandles[0].style.left)/this._bounds[0],parseFloat(this._domHandles[1].style.top)/this._bounds[1],parseFloat(this._domHandles[1].style.left)/this._bounds[0]]},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domClipper=null,this._domHandles=null,this._domRulers=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domHandles[0].addEventListener("mousedown",function(a){return function(b){if(0===b.button)return a._startDrag(0,b.clientY,b.clientX)}}(this)),this._domHandles[1].addEventListener("mousedown",function(a){return function(b){if(0===b.button)return a._startDrag(1,b.clientY,b.clientX)}}(this))},c.prototype._drag=function(a,c){var d,e,f,g,h;if(null!==this._dragging)return ContentSelect.Range.unselectAll(),g=a-this._draggingOrigin[1],f=c-this._draggingOrigin[0],d=this._bounds[1],c=0,a=0,h=this._bounds[0],e=Math.min(Math.min(b.MIN_CROP,d),h),0===this._dragging?(d=parseInt(this._domHandles[1].style.top)-e,h=parseInt(this._domHandles[1].style.left)-e):(c=parseInt(this._domHandles[0].style.left)+e,a=parseInt(this._domHandles[0].style.top)+e),g=Math.min(Math.max(a,g),d),f=Math.min(Math.max(c,f),h),this._domHandles[this._dragging].style.top=g+"px",this._domHandles[this._dragging].style.left=f+"px",this._domRulers[this._dragging].style.top=g+"px",this._domRulers[this._dragging].style.left=f+"px"},c.prototype._fit=function(a){var b,c,d,e,f,g,h,i;return f=a.getBoundingClientRect(),i=f.width/this._imageSize[0],c=f.height/this._imageSize[1],e=Math.min(i,c),h=e*this._imageSize[0],b=e*this._imageSize[1],d=(f.width-h)/2,g=(f.height-b)/2,this._domElement.style.width=h+"px",this._domElement.style.height=b+"px",this._domElement.style.top=g+"px",this._domElement.style.left=d+"px",this._domHandles[0].style.top="0px",this._domHandles[0].style.left="0px",this._domHandles[1].style.top=b+"px",this._domHandles[1].style.left=h+"px",this._domRulers[0].style.top="0px",this._domRulers[0].style.left="0px",this._domRulers[1].style.top=b+"px",this._domRulers[1].style.left=h+"px",this._bounds=[h,b]},c.prototype._startDrag=function(a,b,c){var d;return d=this._domHandles[a],this._dragging=a,this._draggingOrigin=[c-parseInt(d.style.left),b-parseInt(d.style.top)],this._onMouseMove=function(a){return function(b){return a._drag(b.clientY,b.clientX)}}(this),document.addEventListener("mousemove",this._onMouseMove),this._onMouseUp=function(a){return function(b){return a._stopDrag()}}(this),document.addEventListener("mouseup",this._onMouseUp)},c.prototype._stopDrag=function(){return document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._dragging=null,this._draggingOrigin=null},c}(b.AnchoredComponentUI),b.LinkDialog=function(a){function b(a,c){null==a&&(a=""),null==c&&(c=""),b.__super__.constructor.call(this),this._href=a,this._target=c}var c;return g(b,a),c="_blank",b.prototype.mount=function(){return b.__super__.mount.call(this),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-anchored-dialog__input"),this._domInput.setAttribute("name","href"),this._domInput.setAttribute("placeholder",ContentEdit._("Enter a link")+"..."),this._domInput.setAttribute("type","text"),this._domInput.setAttribute("value",this._href),this._domElement.appendChild(this._domInput),this._domTargetButton=this.constructor.createDiv(["ct-anchored-dialog__target-button"]),this._domElement.appendChild(this._domTargetButton),this._target===c&&ContentEdit.addCSSClass(this._domTargetButton,"ct-anchored-dialog__target-button--active"),this._domButton=this.constructor.createDiv(["ct-anchored-dialog__button"]),this._domElement.appendChild(this._domButton),this._addDOMEventListeners()},b.prototype.save=function(){var a;return this.isMounted()?(a={href:this._domInput.value.trim()},this._target&&(a.target=this._target),this.dispatchEvent(this.createEvent("save",a))):void this.dispatchEvent(this.createEvent("save"))},b.prototype.show=function(){if(b.__super__.show.call(this),this._domInput.focus(),this._href)return this._domInput.select()},b.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),b.__super__.unmount.call(this),this._domButton=null,this._domInput=null},b.prototype._addDOMEventListeners=function(){return this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domTargetButton.addEventListener("click",function(a){return function(b){return b.preventDefault(),a._target===c?(a._target="",ContentEdit.removeCSSClass(a._domTargetButton,"ct-anchored-dialog__target-button--active")):(a._target=c,ContentEdit.addCSSClass(a._domTargetButton,"ct-anchored-dialog__target-button--active"))}}(this)),this._domButton.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.save()}}(this))},b}(b.AnchoredDialogUI),b.PropertiesDialog=function(c){function e(a){var b;this.element=a,e.__super__.constructor.call(this,"Properties"),this._attributeUIs=[],this._focusedAttributeUI=null,this._styleUIs=[],this._supportsCoding=this.element.content,"ListItem"!==(b=this.element.type())&&"TableCell"!==b||(this._supportsCoding=!0)}return g(e,c),e.prototype.caption=function(a){return void 0===a?this._caption:(this._caption=a,this._domCaption.textContent=ContentEdit._(a)+": "+this.element.tagName())},e.prototype.changedAttributes=function(){var a,c,d,e,f,g,h,i,j,k;for(c={},d={},j=this._attributeUIs,h=0,i=j.length;h<i;h++)a=j[h],e=a.name(),g=a.value(),""!==e&&(c[e.toLowerCase()]=!0,this.element.attr(e)!==g&&(d[e]=g));f=b.getRestrictedAtributes(this.element.tagName()),k=this.element.attributes();for(e in k)g=k[e],f&&-1!==f.indexOf(e.toLowerCase())||void 0===c[e]&&(d[e]=null);return d},e.prototype.changedStyles=function(){var a,b,c,d,e,f;for(c={},f=this._styleUIs,d=0,e=f.length;d<e;d++)b=f[d],a=b.style.cssClass(),this.element.hasCSSClass(a)!==b.applied()&&(c[a]=b.applied());return c},e.prototype.getElementInnerHTML=function(){return this._supportsCoding?this.element.content?this.element.content.html():this.element.children[0].content.html():null},e.prototype.mount=function(){var a,c,f,g,h,i,j,k,l,m,n,o,p,q,r;for(e.__super__.mount.call(this),
ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog"),ContentEdit.addCSSClass(this._domView,"ct-properties-dialog__view"),this._domStyles=this.constructor.createDiv(["ct-properties-dialog__styles"]),this._domStyles.setAttribute("data-ct-empty",ContentEdit._("No styles available for this tag")),this._domView.appendChild(this._domStyles),r=b.StylePalette.styles(this.element),n=0,p=r.length;n<p;n++)k=r[n],l=new d(k,this.element.hasCSSClass(k.cssClass())),this._styleUIs.push(l),l.mount(this._domStyles);this._domAttributes=this.constructor.createDiv(["ct-properties-dialog__attributes"]),this._domView.appendChild(this._domAttributes),j=b.getRestrictedAtributes(this.element.tagName()),c=this.element.attributes(),a=[];for(i in c)m=c[i],j&&-1!==j.indexOf(i.toLowerCase())||a.push(i);for(-1===a.indexOf("class")&&a.push("class"),a.sort(),o=0,q=a.length;o<q;o++)i=a[o],m=c[i],void 0===m&&(m=""),this._addAttributeUI(i,m);return this._addAttributeUI("",""),this._domCode=this.constructor.createDiv(["ct-properties-dialog__code"]),this._domView.appendChild(this._domCode),this._domInnerHTML=document.createElement("textarea"),this._domInnerHTML.setAttribute("class","ct-properties-dialog__inner-html"),this._domInnerHTML.setAttribute("name","code"),this._domInnerHTML.value=this.getElementInnerHTML(),this._domCode.appendChild(this._domInnerHTML),g=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(g),this._domStylesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--styles"]),this._domStylesTab.setAttribute("data-ct-tooltip",ContentEdit._("Styles")),g.appendChild(this._domStylesTab),this._domAttributesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--attributes"]),this._domAttributesTab.setAttribute("data-ct-tooltip",ContentEdit._("Attributes")),g.appendChild(this._domAttributesTab),this._domCodeTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--code"]),this._domCodeTab.setAttribute("data-ct-tooltip",ContentEdit._("Code")),g.appendChild(this._domCodeTab),this._supportsCoding||ContentEdit.addCSSClass(this._domCodeTab,"ct-control--muted"),this._domRemoveAttribute=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--remove","ct-control--muted"]),this._domRemoveAttribute.setAttribute("data-ct-tooltip",ContentEdit._("Remove")),g.appendChild(this._domRemoveAttribute),f=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(f),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent=ContentEdit._("Apply"),f.appendChild(this._domApply),h=window.localStorage.getItem("ct-properties-dialog-tab"),"attributes"===h?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--attributes"),ContentEdit.addCSSClass(this._domAttributesTab,"ct-control--active")):"code"===h&&this._supportsCoding?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--code"),ContentEdit.addCSSClass(this._domCodeTab,"ct-control--active")):(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--styles"),ContentEdit.addCSSClass(this._domStylesTab,"ct-control--active")),this._addDOMEventListeners()},e.prototype.save=function(){var a,b;return b=null,this._supportsCoding&&(b=this._domInnerHTML.value),a={changedAttributes:this.changedAttributes(),changedStyles:this.changedStyles(),innerHTML:b},this.dispatchEvent(this.createEvent("save",a))},e.prototype._addAttributeUI=function(c,d){var e,f;return f=this,e=new a(c,d),this._attributeUIs.push(e),e.addEventListener("blur",function(a){var b,c,d;if(f._focusedAttributeUI=null,ContentEdit.addCSSClass(f._domRemoveAttribute,"ct-control--muted"),b=f._attributeUIs.indexOf(this),d=f._attributeUIs.length,""===this.name()&&b<d-1&&(this.unmount(),f._attributeUIs.splice(b,1)),(c=f._attributeUIs[d-1])&&c.name()&&c.value())return f._addAttributeUI("","")}),e.addEventListener("focus",function(a){return f._focusedAttributeUI=this,ContentEdit.removeCSSClass(f._domRemoveAttribute,"ct-control--muted")}),e.addEventListener("namechange",function(a){var d,e,g,h,i,j,k;for(d=f.element,c=this.name().toLowerCase(),g=b.getRestrictedAtributes(d.tagName()),h=!0,g&&-1!==g.indexOf(c)&&(h=!1),k=f._attributeUIs,i=0,j=k.length;i<j;i++)e=k[i],""!==c&&e!==this&&e.name().toLowerCase()===c&&(h=!1);return this.valid(h),h?ContentEdit.removeCSSClass(f._domApply,"ct-control--muted"):ContentEdit.addCSSClass(f._domApply,"ct-control--muted")}),e.mount(this._domAttributes),e},e.prototype._addDOMEventListeners=function(){var a,b;return e.__super__._addDOMEventListeners.call(this),a=function(a){return function(b){var c,d,e,f,g,h;for(f=["attributes","code","styles"],g=0,h=f.length;g<h;g++)(d=f[g])!==b&&(e=d.charAt(0).toUpperCase()+d.slice(1),ContentEdit.removeCSSClass(a._domElement,"ct-properties-dialog--"+d),ContentEdit.removeCSSClass(a["_dom"+e+"Tab"],"ct-control--active"));return c=b.charAt(0).toUpperCase()+b.slice(1),ContentEdit.addCSSClass(a._domElement,"ct-properties-dialog--"+b),ContentEdit.addCSSClass(a["_dom"+c+"Tab"],"ct-control--active"),window.localStorage.setItem("ct-properties-dialog-tab",b)}}(this),this._domStylesTab.addEventListener("mousedown",function(b){return function(){return a("styles")}}()),this._domAttributesTab.addEventListener("mousedown",function(b){return function(){return a("attributes")}}()),this._supportsCoding&&this._domCodeTab.addEventListener("mousedown",function(b){return function(){return a("code")}}()),this._domRemoveAttribute.addEventListener("mousedown",function(a){return function(b){var c,d;if(b.preventDefault(),a._focusedAttributeUI&&(c=a._attributeUIs.indexOf(a._focusedAttributeUI),d=c===a._attributeUIs.length-1,a._focusedAttributeUI.unmount(),a._attributeUIs.splice(c,1),d))return a._addAttributeUI("","")}}(this)),b=function(a){return function(b){try{return new HTMLString.String(a._domInnerHTML.value),ContentEdit.removeCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")}catch(b){return ContentEdit.addCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted")}}}(this),this._domInnerHTML.addEventListener("input",b),this._domInnerHTML.addEventListener("propertychange",b),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},e}(b.DialogUI),d=function(a){function b(a,c){this.style=a,b.__super__.constructor.call(this),this._applied=c}return g(b,a),b.prototype.applied=function(a){if(void 0===a)return this._applied;if(this._applied!==a)return this._applied=a,this._applied?ContentEdit.addCSSClass(this._domElement,"ct-section--applied"):ContentEdit.removeCSSClass(this._domElement,"ct-section--applied")},b.prototype.mount=function(a,c){var d;return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-section"]),this._applied&&ContentEdit.addCSSClass(this._domElement,"ct-section--applied"),d=this.constructor.createDiv(["ct-section__label"]),d.textContent=this.style.name(),this._domElement.appendChild(d),this._domElement.appendChild(this.constructor.createDiv(["ct-section__switch"])),b.__super__.mount.call(this,a,c)},b.prototype._addDOMEventListeners=function(){var a;return a=function(a){return function(b){return b.preventDefault(),a.applied()?a.applied(!1):a.applied(!0)}}(this),this._domElement.addEventListener("click",a)},b}(b.AnchoredComponentUI),a=function(a){function b(a,c){b.__super__.constructor.call(this),this._initialName=a,this._initialValue=c}return g(b,a),b.prototype.name=function(){return this._domName.value.trim()},b.prototype.value=function(){return this._domValue.value.trim()},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-attribute"]),this._domName=document.createElement("input"),this._domName.setAttribute("class","ct-attribute__name"),this._domName.setAttribute("name","name"),this._domName.setAttribute("placeholder",ContentEdit._("Name")),this._domName.setAttribute("type","text"),this._domName.setAttribute("value",this._initialName),this._domElement.appendChild(this._domName),this._domValue=document.createElement("input"),this._domValue.setAttribute("class","ct-attribute__value"),this._domValue.setAttribute("name","value"),this._domValue.setAttribute("type","text"),this._domValue.setAttribute("value",this._initialValue),this._domElement.appendChild(this._domValue),b.__super__.mount.call(this,a,c)},b.prototype.valid=function(a){return a?ContentEdit.removeCSSClass(this._domName,"ct-attribute__name--invalid"):ContentEdit.addCSSClass(this._domName,"ct-attribute__name--invalid")},b.prototype._addDOMEventListeners=function(){return this._domName.addEventListener("blur",function(a){return function(){var b,c,d;if(b=a.name(),c=a._domElement.nextSibling,a.dispatchEvent(a.createEvent("blur")),""===b&&c)return d=c.querySelector(".ct-attribute__name"),d.focus()}}(this)),this._domName.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domName.addEventListener("input",function(a){return function(){return a.dispatchEvent(a.createEvent("namechange"))}}(this)),this._domName.addEventListener("keydown",function(a){return function(b){if(13===b.keyCode)return a._domValue.focus()}}(this)),this._domValue.addEventListener("blur",function(a){return function(){return a.dispatchEvent(a.createEvent("blur"))}}(this)),this._domValue.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domValue.addEventListener("keydown",function(a){return function(b){var c,d;if(13===b.keyCode||9===b.keyCode&&!b.shiftKey)return b.preventDefault(),c=a._domElement.nextSibling,c||(a._domValue.blur(),c=a._domElement.nextSibling),c?(d=c.querySelector(".ct-attribute__name"),d.focus()):void 0}}(this))},b}(b.AnchoredComponentUI),b.TableDialog=function(a){function b(a){this.table=a,this.table?b.__super__.constructor.call(this,"Update table"):b.__super__.constructor.call(this,"Insert table")}return g(b,a),b.prototype.mount=function(){var a,c,d,e,f,g,h;return b.__super__.mount.call(this),a={columns:3,foot:!1,head:!0},this.table&&(a={columns:this.table.firstSection().children[0].children.length,foot:this.table.tfoot(),head:this.table.thead()}),ContentEdit.addCSSClass(this._domElement,"ct-table-dialog"),ContentEdit.addCSSClass(this._domView,"ct-table-dialog__view"),h=["ct-section"],a.head&&h.push("ct-section--applied"),this._domHeadSection=this.constructor.createDiv(h),this._domView.appendChild(this._domHeadSection),f=this.constructor.createDiv(["ct-section__label"]),f.textContent=ContentEdit._("Table head"),this._domHeadSection.appendChild(f),this._domHeadSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domHeadSection.appendChild(this._domHeadSwitch),this._domBodySection=this.constructor.createDiv(["ct-section","ct-section--applied","ct-section--contains-input"]),this._domView.appendChild(this._domBodySection),c=this.constructor.createDiv(["ct-section__label"]),c.textContent=ContentEdit._("Table body (columns)"),this._domBodySection.appendChild(c),this._domBodyInput=document.createElement("input"),this._domBodyInput.setAttribute("class","ct-section__input"),this._domBodyInput.setAttribute("maxlength","2"),this._domBodyInput.setAttribute("name","columns"),this._domBodyInput.setAttribute("type","text"),this._domBodyInput.setAttribute("value",a.columns),this._domBodySection.appendChild(this._domBodyInput),g=["ct-section"],a.foot&&g.push("ct-section--applied"),this._domFootSection=this.constructor.createDiv(g),this._domView.appendChild(this._domFootSection),e=this.constructor.createDiv(["ct-section__label"]),e.textContent=ContentEdit._("Table foot"),this._domFootSection.appendChild(e),this._domFootSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domFootSection.appendChild(this._domFootSwitch),d=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(d),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent="Apply",d.appendChild(this._domApply),this._addDOMEventListeners()},b.prototype.save=function(){var a,b,c;return b=this._domFootSection.getAttribute("class"),c=this._domHeadSection.getAttribute("class"),a={columns:parseInt(this._domBodyInput.value),foot:b.indexOf("ct-section--applied")>-1,head:c.indexOf("ct-section--applied")>-1},this.dispatchEvent(this.createEvent("save",a))},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBodyInput=null,this._domBodySection=null,this._domApply=null,this._domHeadSection=null,this._domHeadSwitch=null,this._domFootSection=null,this._domFootSwitch=null},b.prototype._addDOMEventListeners=function(){var a;return b.__super__._addDOMEventListeners.call(this),a=function(a){return a.preventDefault(),this.getAttribute("class").indexOf("ct-section--applied")>-1?ContentEdit.removeCSSClass(this,"ct-section--applied"):ContentEdit.addCSSClass(this,"ct-section--applied")},this._domHeadSection.addEventListener("click",a),this._domFootSection.addEventListener("click",a),this._domBodySection.addEventListener("click",function(a){return function(b){return a._domBodyInput.focus()}}(this)),this._domBodyInput.addEventListener("input",function(a){return function(b){var c;return c=/^[1-9]\d{0,1}$/.test(b.target.value),c?(ContentEdit.removeCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")):(ContentEdit.addCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted"))}}(this)),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},b}(b.DialogUI),b.VideoDialog=function(a){function c(){c.__super__.constructor.call(this,"Insert video")}return g(c,a),c.prototype.clearPreview=function(){if(this._domPreview)return this._domPreview.parentNode.removeChild(this._domPreview),this._domPreview=void 0},c.prototype.mount=function(){var a;return c.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-video-dialog"),ContentEdit.addCSSClass(this._domView,"ct-video-dialog__preview"),a=this.constructor.createDiv(["ct-control-group"]),this._domControls.appendChild(a),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-video-dialog__input"),this._domInput.setAttribute("name","url"),this._domInput.setAttribute("placeholder",ContentEdit._("Paste YouTube or Vimeo URL")+"..."),this._domInput.setAttribute("type","text"),a.appendChild(this._domInput),this._domButton=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert","ct-control--muted"]),this._domButton.textContent=ContentEdit._("Insert"),a.appendChild(this._domButton),this._addDOMEventListeners()},c.prototype.preview=function(a){return this.clearPreview(),this._domPreview=document.createElement("iframe"),this._domPreview.setAttribute("frameborder","0"),this._domPreview.setAttribute("height","100%"),this._domPreview.setAttribute("src",a),this._domPreview.setAttribute("width","100%"),this._domView.appendChild(this._domPreview)},c.prototype.save=function(){var a,c;return c=this._domInput.value.trim(),a=b.getEmbedVideoURL(c),a?this.dispatchEvent(this.createEvent("save",{url:a})):this.dispatchEvent(this.createEvent("save",{url:c}))},c.prototype.show=function(){return c.__super__.show.call(this),this._domInput.focus()},c.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),c.__super__.unmount.call(this),this._domButton=null,this._domInput=null,this._domPreview=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("input",function(a){return function(c){var d;return c.target.value?ContentEdit.removeCSSClass(a._domButton,"ct-control--muted"):ContentEdit.addCSSClass(a._domButton,"ct-control--muted"),a._updatePreviewTimeout&&clearTimeout(a._updatePreviewTimeout),d=function(){var c,d;return d=a._domInput.value.trim(),c=b.getEmbedVideoURL(d),c?a.preview(c):a.clearPreview()},a._updatePreviewTimeout=setTimeout(d,500)}}(this)),this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domButton.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domButton.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},c}(b.DialogUI),b.HTMLCleaner=function(){function a(a,b){this.tagWhitelist=a||this.constructor.DEFAULT_TAG_WHITELIST,this.attributeWhitelist=b||this.constructor.DEFAULT_ATTRIBUTE_WHITELIST}return a.DEFAULT_ATTRIBUTE_WHITELIST={a:["href"],td:["colspan"]},a.DEFAULT_TAG_WHITELIST=["a","address","b","blockquote","code","del","em","h1","h2","h3","h4","h5","h6","i","ins","li","ol","p","pre","strong","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","#text"],a.NO_CONTENT_TAGS=["head","meta","style","script","title"],a.prototype.clean=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;for(j=document.implementation.createHTMLDocument(),m=j.createElement("div"),m.innerHTML=a,k=function(){var a,b,c,e;for(c=m.childNodes,e=[],a=0,b=c.length;a<b;a++)d=c[a],e.push(d);return e}();k.length>0;)if(f=k.shift(),g=f.nodeName.toLowerCase(),this.tagWhitelist.indexOf(g)<0){if(this.constructor.NO_CONTENT_TAGS.indexOf(g)>-1){f.remove();continue}for(r=f.childNodes,n=0,p=r.length;n<p;n++)(e=r[n])&&(e=e.cloneNode(!0),e.nodeName.toLowerCase(),f.parentNode.insertBefore(e,f),k.push(e));f.remove()}else if("#text"===g||""!==f.textContent.trim()){if("td"!==g&&"th"!==g&&"li"!==g||f.querySelector("p")&&(f.innerHTML=f.textContent),f.attributes)for(i=this.attributeWhitelist[g]||[],h=function(){var a,c,d,e;for(d=f.attributes,e=[],a=0,c=d.length;a<c;a++)b=d[a],e.push(b);return e}(),o=0,q=h.length;o<q;o++)c=h[o],i.indexOf(c.name.toLowerCase())<0?f.removeAttribute(c.name):"href"===c.name.toLowerCase()&&(l=f.getAttribute(c.name),l.startsWith("javascript:"))&&f.removeAttribute(c.name);k.push.apply(k,function(){var a,b,c,e;for(c=f.childNodes,e=[],a=0,b=c.length;a<b;a++)d=c[a],e.push(d);return e}())}else""===f.textContent||f.parentNode===m?f.remove():f.parentNode.replaceChild(j.createTextNode(" "),f);return m.innerHTML},a}(),e=function(a){function c(){c.__super__.constructor.call(this),this.history=null,this._state="dormant",this._busy=!1,this._namingProp=null,this._fixtureTest=function(a){return a.hasAttribute("data-fixture")},this._regionQuery=null,this._domRegions=null,this._regions={},this._orderedRegions=[],this._rootLastModified=null,this._regionsLastModified={},this._ignition=null,this._inspector=null,this._toolbox=null,this._emptyRegionsAllowed=!1}return g(c,a),c.prototype.ctrlDown=function(){return this._ctrlDown},c.prototype.domRegions=function(){return this._domRegions},c.prototype.getState=function(){return this._state},c.prototype.ignition=function(){return this._ignition},c.prototype.inspector=function(){return this._inspector},c.prototype.isDormant=function(){return"dormant"===this._state},c.prototype.isReady=function(){return"ready"===this._state},c.prototype.isEditing=function(){return"editing"===this._state},c.prototype.orderedRegions=function(){var a;return function(){var b,c,d,e;for(d=this._orderedRegions,e=[],b=0,c=d.length;b<c;b++)a=d[b],e.push(this._regions[a]);return e}.call(this)},c.prototype.regions=function(){return this._regions},c.prototype.shiftDown=function(){return this._shiftDown},c.prototype.toolbox=function(){return this._toolbox},c.prototype.busy=function(a){return void 0===a?this._busy:(this._busy=a,this._ignition?this._ignition.busy(a):void 0)},c.prototype.createPlaceholderElement=function(a){return new ContentEdit.Text("p",{},"")},c.prototype.init=function(a,c,d,e){return null==c&&(c="id"),null==d&&(d=null),null==e&&(e=!0),this._namingProp=c,d&&(this._fixtureTest=d),this.mount(),e&&(this._ignition=new b.IgnitionUI,this.attach(this._ignition),this._ignition.addEventListener("edit",function(a){return function(b){return b.preventDefault(),a.start(),a._ignition.state("editing")}}(this)),this._ignition.addEventListener("confirm",function(a){return function(b){if(b.preventDefault(),"editing"===a._ignition.state())return a._ignition.state("ready"),a.stop(!0)}}(this)),this._ignition.addEventListener("cancel",function(a){return function(b){if(b.preventDefault(),"editing"===a._ignition.state())return a.stop(!1),a.isEditing()?a._ignition.state("editing"):a._ignition.state("ready")}}(this))),this._toolbox=new b.ToolboxUI(b.DEFAULT_TOOLS),this.attach(this._toolbox),this._inspector=new b.InspectorUI,this.attach(this._inspector),this._state="ready",this._handleDetach=function(a){return function(b){return a._preventEmptyRegions()}}(this),this._handleClipboardPaste=function(a){return function(b,c){return null,c.clipboardData?void(c.clipboardData.getData("text/html")&&"PreText"!==b.type()?a.pasteHTML(b,c.clipboardData.getData("text/html")):a.pasteText(b,c.clipboardData.getData("text/plain"))):window.clipboardData?(window.clipboardData.getData("TEXT"),a.pasteText(b,window.clipboardData.getData("TEXT"))):void 0}}(this),this._handleNextRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i;if(f=a.orderedRegions(),!((e=f.indexOf(b))>=f.length-1)){for(b=f[e+1],d=null,i=b.descendants(),g=0,h=i.length;g<h;g++)if(c=i[g],void 0!==c.content){d=c;break}return d?(d.focus(),void d.selection(new ContentSelect.Range(0,0))):ContentEdit.Root.get().trigger("next-region",b)}}}(this),this._handlePreviousRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i,j;if(h=a.orderedRegions(),!((f=h.indexOf(b))<=0)){for(b=h[f-1],e=null,d=b.descendants(),d.reverse(),i=0,j=d.length;i<j;i++)if(c=d[i],void 0!==c.content){e=c;break}return e?(g=e.content.length(),e.focus(),void e.selection(new ContentSelect.Range(g,g))):ContentEdit.Root.get().trigger("previous-region",b)}}}(this),ContentEdit.Root.get().bind("detach",this._handleDetach),ContentEdit.Root.get().bind("paste",this._handleClipboardPaste),ContentEdit.Root.get().bind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().bind("previous-region",this._handlePreviousRegionTransition),this.syncRegions(a)},c.prototype.destroy=function(){return ContentEdit.Root.get().unbind("detach",this._handleDetach),ContentEdit.Root.get().unbind("paste",this._handleClipboardPaste),ContentEdit.Root.get().unbind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().unbind("previous-region",this._handlePreviousRegionTransition),this.removeEventListener(),this.unmount(),this._children=[]},c.prototype.highlightRegions=function(a){var b,c,d,e,f;for(e=this._domRegions,f=[],c=0,d=e.length;c<d;c++)b=e[c],a?f.push(ContentEdit.addCSSClass(b,"ct--highlight")):f.push(ContentEdit.removeCSSClass(b,"ct--highlight"));return f},c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-app"]),document.body.insertBefore(this._domElement,null),this._addDOMEventListeners()},c.prototype.unmount=function(){var a,b,c,d;if(this.isMounted()){for(d=this._children,b=0,c=d.length;b<c;b++)a=d[b],a.unmount();return this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,this._removeDOMEventListeners(),this._ignition=null,this._inspector=null,this._toolbox=null}},c.prototype.pasteHTML=function(a,c){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G;for(w=ContentEdit.TagNames.get(),u=document.implementation.createHTMLDocument(),A=u.createElement("div"),A.innerHTML=b.getHTMLCleaner().clean(c.trim()),f=[],F=A.childNodes,B=0,D=F.length;B<D;B++)(e=F[B])&&("#text"===e.nodeName.toLowerCase()&&""===e.textContent.trim()||f.push(e));if(f.length){if(l=b.INLINE_TAGS.slice(),l.push("#text"),j=f[0].nodeName.toLowerCase(),n=f[f.length-1].nodeName.toLowerCase(),a.isFixed()||l.indexOf(j)>-1&&l.indexOf(n)>-1){if(l.indexOf(j)>-1&&l.indexOf(n)>-1?c=new HTMLString.String(A.innerHTML):(console.log(A.textContent),c=new HTMLString.String(HTMLString.String.encode(A.textContent))),a.content)return v=a.selection(),g=v.get()[0]+c.length(),z=a.content.substring(0,v.get()[0]),y=a.content.substring(v.get()[1]),t=a.content.substring(v.get()[0],v.get()[1]),t.length()&&(d=t.characters[0],x=d.tags(),d.isTag()&&x.shift(),x.length>=1&&(c=c.format.apply(c,[0,c.length()].concat(i.call(x))))),a.content=z.concat(c),a.content=a.content.concat(y,!1),a.updateInnerHTML(),a.taint(),v.set(g,g),void a.selection(v);A.innerHTML="<p>"+c.html()+"</p>"}if(q=a,"Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),s=a.parent(),l.indexOf(j)>-1&&l.indexOf(n)>-1){for(m=A.createElement("p");A.childNodes.length>0;)m.appendChild(A.childNodes[0]);A.appendChild(m)}for(k=0,o=q,G=A.childNodes,C=0,E=G.length;C<E;C++)(p=G[C])&&("#text"===p.nodeName&&""===p.textContent.trim()||(h=w.match(p.nodeName),h===ContentEdit.Static&&(r=document.createElement("p"),r.appendChild(p),p=r,h=ContentEdit.Text),o=h.fromDOMElement(p),s.attach(o,s.children.indexOf(a)+(1+k)),k+=1));return o.focus?o.focus():o.nextSibling()?(o=o.nextSibling().previousWithTest(function(a){if(a.focus)return a}))?o.focus():void 0:(o=o.nextWithTest(function(a){if(a.focus)return a}),o?o.focus():q.focus())}},c.prototype.pasteText=function(a,b){var c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;if(p="PreText"!==a.type()?b.split("\n"):[b],p=p.filter(function(a){return""!==a.trim()})){if(e=HTMLString.String.encode,s=!0,w=a.type(),1===p.length&&(s=!1),"PreText"===w&&(s=!1),a.can("spawn")||(s=!1),s){for("ListItemText"===w?(j=a.parent(),h=a.parent().parent(),g=h.children.indexOf(j)+1):(j=a,"Region"!==j.parent().type()&&(j=a.closest(function(a){return"Region"===a.parent().type()})),h=j.parent(),g=h.children.indexOf(j)+1),f=x=0,y=p.length;x<y;f=++x)n=p[f],n=e(n),"ListItemText"===w?(k=new ContentEdit.ListItem,l=new ContentEdit.ListItemText(n),k.attach(l),m=l):(k=new ContentEdit.Text("p",{},n),m=k),h.attach(k,g+f);return o=m.content.length(),m.focus(),m.selection(new ContentSelect.Range(o,o))}return b=e(b),b=new HTMLString.String(b,"PreText"===w),r=a.selection(),d=r.get()[0]+b.length(),v=a.content.substring(0,r.get()[0]),u=a.content.substring(r.get()[1]),q=a.content.substring(r.get()[0],r.get()[1]),q.length()&&(c=q.characters[0],t=c.tags(),c.isTag()&&t.shift(),t.length>=1&&(b=b.format.apply(b,[0,b.length()].concat(i.call(t))))),a.content=v.concat(b),a.content=a.content.concat(u,!1),a.updateInnerHTML(),a.taint(),r.set(d,d),a.selection(r)}},c.prototype.revert=function(){var a;if(this.dispatchEvent(this.createEvent("revert")))return!(b.CANCEL_MESSAGE&&(a=ContentEdit._(b.CANCEL_MESSAGE),ContentEdit.Root.get().lastModified()>this._rootLastModified&&!window.confirm(a)))&&(this.revertToSnapshot(this.history.goTo(0),!1),!0)},c.prototype.revertToSnapshot=function(a,b){var c,d,e,f,g,h,i,j,k,l;null==b&&(b=!0),d=[],j=this._regions;for(e in j){for(f=j[e],k=f.children,h=0,i=k.length;h<i;h++)c=k[h],c.unmount();void 0!==a.regions[e]?1===f.children.length&&f.children[0].isFixed()?(g=this.constructor.createDiv(),g.innerHTML=a.regions[e],d.push(g.firstElementChild),f.domElement().parentNode.replaceChild(g.firstElementChild,f.domElement())):(d.push(f.domElement()),f.domElement().innerHTML=a.regions[e]):(f.domElement().remove(),delete this._regions[e])}if(this._domRegions=d,b){ContentEdit.Root.get().focused()&&ContentEdit.Root.get().focused().blur(),this._regions={},this.syncRegions(null,!0),ContentEdit.Root.get()._modified=a.rootModified,l=this._regions;for(e in l)f=l[e],a.regionModifieds[e]&&(f._modified=a.regionModifieds[e]);return this.history.replaceRegions(this._regions),this.history.restoreSelection(a),this._inspector.updateTags()}},c.prototype.save=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;if(this.dispatchEvent(this.createEvent("save",{passive:a}))){if(h=ContentEdit.Root.get(),h.focused()&&!a&&h.focused().blur(),h.lastModified()===this._rootLastModified&&a)return void this.dispatchEvent(this.createEvent("saved",{regions:{},passive:a}));c=[],e={},l=this._regions;for(f in l){if(g=l[f],d=g.html(),1===g.children.length&&"Fixture"===!g.type()&&(b=g.children[0],b.content&&!b.content.html()&&(d="")),!a){for(m=g.children,j=0,k=m.length;j<k;j++)b=m[j],b.unmount();1===g.children.length&&g.children[0].isFixed()?(i=this.constructor.createDiv(),i.innerHTML=d,c.push(i.firstElementChild),g.domElement().parentNode.replaceChild(i.firstElementChild,g.domElement())):(c.push(g.domElement()),g.domElement().innerHTML=d)}g.lastModified()!==this._regionsLastModified[f]&&(e[f]=d,this._regionsLastModified[f]=g.lastModified())}return this._domRegions=c,this.dispatchEvent(this.createEvent("saved",{regions:e,passive:a}))}},c.prototype.setRegionOrder=function(a){return this._orderedRegions=a.slice()},c.prototype.start=function(){if(this.dispatchEvent(this.createEvent("start")))return this.busy(!0),this.syncRegions(),this._initRegions(),this._preventEmptyRegions(),this._rootLastModified=ContentEdit.Root.get().lastModified(),this.history=new b.History(this._regions),this.history.watch(),this._state="editing",this._toolbox.show(),this._inspector.show(),this.busy(!1),this.dispatchEvent(this.createEvent("started"))},c.prototype.stop=function(a){var b;if(this.dispatchEvent(this.createEvent("stop",{save:a}))){if(b=ContentEdit.Root.get().focused(),b&&b.isMounted()&&void 0!==b._syncContent&&b._syncContent(),a)this.save();else if(!this.revert())return;return this.history.stopWatching(),this.history=null,this._toolbox.hide(),this._inspector.hide(),this._regions={},this._state="ready",ContentEdit.Root.get().focused()&&this._allowEmptyRegions(function(a){return function(){return ContentEdit.Root.get().focused().blur()}}()),this.dispatchEvent(this.createEvent("stopped"))}},c.prototype.syncRegions=function(a,b){if(a&&(this._regionQuery=a),this._domRegions=[],this._regionQuery&&("string"==typeof this._regionQuery||this._regionQuery instanceof String?this._domRegions=document.querySelectorAll(this._regionQuery):this._domRegions=this._regionQuery),"editing"===this._state&&(this._initRegions(b),this._preventEmptyRegions()),this._ignition)return this._domRegions.length?this._ignition.show():this._ignition.hide()},c.prototype._addDOMEventListeners=function(){return this._handleHighlightOn=function(a){return function(c){var d;if(17!==(d=c.keyCode)&&224!==d&&91!==d&&93!==d||(a._ctrlDown=!0),16===c.keyCode&&!a._ctrlDown){if(a._highlightTimeout)return;return a._shiftDown=!0,void(a._highlightTimeout=setTimeout(function(){return a.highlightRegions(!0)},b.HIGHLIGHT_HOLD_DURATION))}return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),this._handleHighlightOff=function(a){return function(b){var c;return 17===(c=b.keyCode)||224===c||91===c||93===c?void(a._ctrlDown=!1):16===b.keyCode?(a._shiftDown=!1,a._highlightTimeout&&(clearTimeout(a._highlightTimeout),a._highlightTimeout=null),a.highlightRegions(!1)):void 0}}(this),this._handleVisibility=function(a){return function(b){if(!document.hasFocus())return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),document.addEventListener("keydown",this._handleHighlightOn),document.addEventListener("keyup",this._handleHighlightOff),document.addEventListener("visibilitychange",this._handleVisibility),this._handleBeforeUnload=function(a){return function(c){var d;if("editing"===a._state&&b.CANCEL_MESSAGE)return d=ContentEdit._(b.CANCEL_MESSAGE),(c||window.event).returnValue=d,d}}(this),window.addEventListener("beforeunload",this._handleBeforeUnload),this._handleUnload=function(a){return function(b){return a.destroy()}}(this),
window.addEventListener("unload",this._handleUnload)},c.prototype._allowEmptyRegions=function(a){return this._emptyRegionsAllowed=!0,a(),this._emptyRegionsAllowed=!1},c.prototype._preventEmptyRegions=function(){var a,b,c,d,e,f,g,h,i,j,k;if(!this._emptyRegionsAllowed){i=this._regions,k=[];for(d in i){for(f=i[d],c=f.lastModified(),b=!1,j=f.children,g=0,h=j.length;g<h;g++)if(a=j[g],"Static"!==a.type()){b=!0;break}b||(e=this.createPlaceholderElement(f),f.attach(e),k.push(f._modified=c))}return k}},c.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keydown",this._handleHighlightOn),document.removeEventListener("keyup",this._handleHighlightOff),window.removeEventListener("beforeunload",this._handleBeforeUnload),window.removeEventListener("unload",this._handleUnload)},c.prototype._initRegions=function(a){var b,c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=!1),d={},c=[],this._orderedRegions=[],j=this._domRegions,e=h=0,i=j.length;h<i;e=++h)b=j[e],g=b.getAttribute(this._namingProp),g||(g=e),d[g]=!0,this._orderedRegions.push(g),this._regions[g]&&this._regions[g].domElement()===b||(this._fixtureTest(b)?this._regions[g]=new ContentEdit.Fixture(b):this._regions[g]=new ContentEdit.Region(b),c.push(this._regions[g].domElement()),a||(this._regionsLastModified[g]=this._regions[g].lastModified()));this._domRegions=c,k=this._regions,l=[];for(g in k)k[g],d[g]||(delete this._regions[g],delete this._regionsLastModified[g],f=this._orderedRegions.indexOf(g),f>-1?l.push(this._orderedRegions.splice(f,1)):l.push(void 0));return l},c}(b.ComponentUI),b.EditorApp=function(){function a(){}var c;return c=null,a.get=function(){var a;return a=b.EditorApp.getCls(),null!=c?c:c=new a},a.getCls=function(){return e},a}(),b.History=function(){function a(a){this._lastSnapshotTaken=null,this._regions={},this.replaceRegions(a),this._snapshotIndex=-1,this._snapshots=[],this._store()}return a.prototype.canRedo=function(){return this._snapshotIndex<this._snapshots.length-1},a.prototype.canUndo=function(){return this._snapshotIndex>0},a.prototype.index=function(){return this._snapshotIndex},a.prototype.length=function(){return this._snapshots.length},a.prototype.snapshot=function(){return this._snapshots[this._snapshotIndex]},a.prototype.goTo=function(a){return this._snapshotIndex=Math.min(this._snapshots.length-1,Math.max(0,a)),this.snapshot()},a.prototype.redo=function(){return this.goTo(this._snapshotIndex+1)},a.prototype.replaceRegions=function(a){var b,c,d;this._regions={},d=[];for(b in a)c=a[b],d.push(this._regions[b]=c);return d},a.prototype.restoreSelection=function(a){var b,c;if(a.selected)return c=this._regions[a.selected.region],b=c.descendants()[a.selected.element],b.focus(),b.selection&&a.selected.selection?b.selection(a.selected.selection):void 0},a.prototype.stopWatching=function(){if(this._watchInterval&&clearInterval(this._watchInterval),this._delayedStoreTimeout)return clearTimeout(this._delayedStoreTimeout)},a.prototype.undo=function(){return this.goTo(this._snapshotIndex-1)},a.prototype.watch=function(){var a;return this._lastSnapshotTaken=Date.now(),a=function(a){return function(){var b,c;if(null!==(c=ContentEdit.Root.get().lastModified())&&c>a._lastSnapshotTaken){if(a._delayedStoreRequested===c)return;return a._delayedStoreTimeout&&clearTimeout(a._delayedStoreTimeout),b=function(){return a._lastSnapshotTaken=c,a._store()},a._delayedStoreRequested=c,a._delayedStoreTimeout=setTimeout(b,500)}}}(this),this._watchInterval=setInterval(a,50)},a.prototype._store=function(){var a,b,c,d,e,f,g;e={regions:{},regionModifieds:{},rootModified:ContentEdit.Root.get().lastModified(),selected:null},f=this._regions;for(b in f)d=f[b],e.regions[b]=d.html(),e.regionModifieds[b]=d.lastModified();if(a=ContentEdit.Root.get().focused()){if(e.selected={},!(d=a.closest(function(a){return"Region"===a.type()||"Fixture"===a.type()})))return;g=this._regions;for(b in g)if(c=g[b],d===c){e.selected.region=b;break}e.selected.element=d.descendants().indexOf(a),a.selection&&(e.selected.selection=a.selection())}return this._snapshotIndex<this._snapshots.length-1&&(this._snapshots=this._snapshots.slice(0,this._snapshotIndex+1)),this._snapshotIndex++,this._snapshots.splice(this._snapshotIndex,0,e)},a}(),b.StylePalette=function(){function a(){}return a._styles=[],a.add=function(a){return this._styles=this._styles.concat(a)},a.styles=function(a){var b;return void 0===a?this._styles.slice():(b=a.tagName(),this._styles.filter(function(a){return!a._applicableTo||-1!==a._applicableTo.indexOf(b)}))},a}(),b.Style=function(){function a(a,b,c){this._name=a,this._cssClass=b,this._applicableTo=c||null}return a.prototype.applicableTo=function(){return this._applicableTo},a.prototype.cssClass=function(){return this._cssClass},a.prototype.name=function(){return this._name},a}(),b.ToolShelf=function(){function a(){}return a._tools={},a.stow=function(a,b){return this._tools[b]=a},a.fetch=function(a){if(!this._tools[a])throw new Error("`"+a+"` has not been stowed on the tool shelf");return this._tools[a]},a}(),b.Tool=function(){function a(){}return a.label="Tool",a.icon="tool",a.requiresElement=!0,a.canApply=function(a,b){return!1},a.isApplied=function(a,b){return!1},a.apply=function(a,b,c){throw new Error("Not implemented")},a.editor=function(){return b.EditorApp.get()},a.dispatchEditorEvent=function(a,b){return this.editor().dispatchEvent(this.editor().createEvent(a,b))},a._insertAt=function(a){var b,c;return c=a,"Region"!==c.parent().type()&&(c=a.closest(function(a){return"Region"===a.parent().type()})),b=c.parent().children.indexOf(c)+1,[c,b]},a}(),b.Tools.Bold=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"bold"),c.label="Bold",c.icon="bold",c.tagName="b",c.canApply=function(a,b){return!a.isGallery()&&(!!a.content&&(b&&!b.isCollapsed()))},c.isApplied=function(a,b){var c,d,e;return!(void 0===a.content||!a.content.length())&&(e=b.get(),c=e[0],d=e[1],c===d&&(d+=1),a.content.slice(c,d).hasTags(this.tagName,!0))},c.apply=function(a,b,c){var d,e,f,g;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return a.storeState(),g=b.get(),d=g[0],e=g[1],this.isApplied(a,b)?a.content=a.content.unformat(d,e,new HTMLString.Tag(this.tagName)):a.content=a.content.format(d,e,new HTMLString.Tag(this.tagName)),a.content.optimize(),a.updateInnerHTML(),a.taint(),a.restoreState(),c(!0),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Italic=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"italic"),c.label="Italic",c.icon="italic",c.tagName="i",c}(b.Tools.Bold),b.Tools.Underline=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"underline"),c.label="Underline",c.icon="underline",c.tagName="u",c}(b.Tools.Bold),b.Tools.Code=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"code"),c.label="Code",c.icon="preformatted",c.tagName="code",c}(b.Tools.Bold),b.Tools.Strike=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"strike"),c.label="Strikethrough",c.icon="strike",c.tagName="strike",c}(b.Tools.Bold),b.Tools.Link=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"link"),c.label="Link",c.icon="link",c.tagName="a",c.getAttr=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;if("Image"===b.type()){if(b.a)return b.a[a]}else{if(b.isFixed()&&"a"===b.tagName())return b.attr(a);for(m=c.get(),e=m[0],h=m[1],f=b.content.slice(e,h),n=f.characters,i=0,k=n.length;i<k;i++)if(d=n[i],d.hasTags("a"))for(o=d.tags(),j=0,l=o.length;j<l;j++)if(g=o[j],"a"===g.name())return g.attr(a)}return""},c.canApply=function(a,b){var c;return!a.isGallery()&&("Image"===a.type()||(!(!a.isFixed()||"a"!==a.tagName())||!!a.content&&(!!b&&!!(!b.isCollapsed()||(c=a.content.characters[b.get()[0]])&&c.hasTags("a")))))},c.isApplied=function(a,b){return"Image"===a.type()?a.a:!(!a.isFixed()||"a"!==a.tagName())||c.__super__.constructor.isApplied.call(this,a,b)},c.apply=function(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(t={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",t)){if(f=!1,"Image"===a.type())n=a.domElement().getBoundingClientRect();else if(a.isFixed()&&"a"===a.tagName())n=a.domElement().getBoundingClientRect();else{if(c.isCollapsed()){for(g=a.content.characters,r=c.get(0)[0],j=r;r>0&&g[r-1].hasTags("a");)r-=1;for(;j<g.length&&g[j].hasTags("a");)j+=1;c=new ContentSelect.Range(r,j),c.select(a.domElement())}a.storeState(),q=new HTMLString.Tag("span",{class:"ct--pseudo-select"}),u=c.get(),k=u[0],s=u[1],a.content=a.content.format(k,s,q),a.updateInnerHTML(),i=a.domElement(),l=i.getElementsByClassName("ct--pseudo-select"),n=l[0].getBoundingClientRect()}return e=b.EditorApp.get(),m=new b.ModalUI(!0,!0),m.addEventListener("click",function(){if(this.unmount(),h.hide(),a.content&&(a.content=a.content.unformat(k,s,q),a.updateInnerHTML(),a.restoreState()),d(f),f)return b.Tools.Link.dispatchEditorEvent("tool-applied",t)}),h=new b.LinkDialog(this.getAttr("href",a,c),this.getAttr("target",a,c)),v=b.getScrollPosition(),o=v[0],p=v[1],h.position([n.left+n.width/2+o,n.top+n.height/2+p]),h.addEventListener("save",function(b){var c,d,e,g,h,i,j,l,n;if(g=b.detail(),f=!0,"Image"===a.type()){if(d=["align-center","align-left","align-right"],g.href){for(a.a={href:g.href},a.a&&(a.a.class=a.a.class),g.target&&(a.a.target=g.target),i=0,l=d.length;i<l;i++)if(e=d[i],a.hasCSSClass(e)){a.removeCSSClass(e),a.a.class=e;break}}else{for(h=[],a.a.class&&(h=a.a.class.split(" ")),j=0,n=d.length;j<n;j++)if(e=d[j],h.indexOf(e)>-1){a.addCSSClass(e);break}a.a=null}a.unmount(),a.mount()}else a.isFixed()&&"a"===a.tagName()?a.attr("href",g.href):(a.content=a.content.unformat(k,s,"a"),g.href&&(c=new HTMLString.Tag("a",g),a.content=a.content.format(k,s,c),a.content.optimize()),a.updateInnerHTML());return a.taint(),m.dispatchEvent(m.createEvent("click"))}),e.attach(m),e.attach(h),m.show(),h.show()}},c}(b.Tools.Bold),b.Tools.Heading=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading"),c.label="Heading",c.icon="heading",c.tagName="h1",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&(void 0!==a.content&&-1!==["Text","PreText"].indexOf(a.type())))},c.isApplied=function(a,b){return!!a.content&&(-1!==["Text","PreText"].indexOf(a.type())&&a.tagName()===this.tagName)},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return a.storeState(),"PreText"===a.type()?(d=a.content.html().replace(/&nbsp;/g," "),g=new ContentEdit.Text(this.tagName,{},d),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(b)):(a.removeAttr("class"),a.tagName()===this.tagName?a.tagName("p"):a.tagName(this.tagName),a.restoreState()),this.dispatchEditorEvent("tool-applied",h),c(!0)},c}(b.Tool),b.Tools.Heading2=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading2"),c.icon=c.icon+"2",c.tagName="h2",c}(b.Tools.Heading),b.Tools.Heading3=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading3"),c.icon=c.icon+"3",c.tagName="h3",c}(b.Tools.Heading),b.Tools.Heading4=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading4"),c.icon=c.icon+"4",c.tagName="h4",c}(b.Tools.Heading),b.Tools.Heading5=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading5"),c.icon=c.icon+"5",c.tagName="h5",c}(b.Tools.Heading),b.Tools.Heading6=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading6"),c.icon=c.icon+"6",c.tagName="h6",c}(b.Tools.Heading),b.Tools.Paragraph=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"paragraph"),c.label="Paragraph",c.icon="paragraph",c.tagName="p",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&void 0!==a)},c.apply=function(a,d,e){var f,g,h,i;return f=this.editor().ctrlDown(),b.Tools.Heading.canApply(a)&&!f?c.__super__.constructor.apply.call(this,a,d,e):(i={tool:this,element:a,selection:d},this.dispatchEditorEvent("tool-apply",i)?("Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),h=a.parent(),g=new ContentEdit.Text("p"),h.attach(g,h.children.indexOf(a)+1),g.focus(),e(!0),this.dispatchEditorEvent("tool-applied",i)):void 0)},c}(b.Tools.Heading),b.Tools.Preformatted=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"preformatted"),c.label="Preformatted",c.icon="preformatted",c.tagName="pre",c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return"PreText"===a.type()?void b.Tools.Paragraph.apply(a,c,d):(h=a.content.text(),g=new ContentEdit.PreText("pre",{},HTMLString.String.encode(h)),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(c),d(!0),this.dispatchEditorEvent("tool-applied",i))},c}(b.Tools.Heading),b.Tools.AlignLeft=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-left"),c.label="Align left",c.icon="align-left",c.className="text-left",c.canApply=function(a,b){return!a.isGallery()&&("Image"===a.type()||void 0!==a.content)},c.isApplied=function(a,b){var c;return!!this.canApply(a)&&("ListItemText"!==(c=a.type())&&"TableCellText"!==c||(a=a.parent()),a.hasCSSClass(this.className))},c.apply=function(a,c,d){var e,f,g,h,i,j;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g)){for("ListItemText"!==(j=a.type())&&"TableCellText"!==j||(a=a.parent()),e=[b.Tools.AlignLeft.className,b.Tools.AlignCenter.className,b.Tools.AlignRight.className],h=0,i=e.length;h<i;h++)if(f=e[h],a.hasCSSClass(f)&&(a.removeCSSClass(f),f===this.className))return d(!0);return a.addCSSClass(this.className),d(!0),this.dispatchEditorEvent("tool-applied",g)}},c}(b.Tool),b.Tools.AlignCenter=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-center"),c.label="Align center",c.icon="align-center",c.className="text-center",c}(b.Tools.AlignLeft),b.Tools.AlignRight=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-right"),c.label="Align right",c.icon="align-right",c.className="text-right",c}(b.Tools.AlignLeft),b.Tools.UnorderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unordered-list"),c.label="Bullet list",c.icon="unordered-list",c.listTag="ul",c.canApply=function(a,b){var c;return!a.isGallery()&&(!a.isFixed()&&(void 0!==a.content&&("Region"===(c=a.parent().type())||"ListItem"===c)))},c.apply=function(a,b,c){var d,e,f,g,h,i;if(i={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",i))return"ListItem"===a.parent().type()?(a.storeState(),e=a.closest(function(a){return"List"===a.type()}),e.tagName(this.listTag),a.restoreState()):(g=new ContentEdit.ListItemText(a.content.copy()),f=new ContentEdit.ListItem,f.attach(g),e=new ContentEdit.List(this.listTag,{}),e.attach(f),h=a.parent(),d=h.children.indexOf(a),h.detach(a),h.attach(e,d),g.focus(),g.selection(b)),c(!0),this.dispatchEditorEvent("tool-applied",i)},c}(b.Tool),b.Tools.OrderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"ordered-list"),c.label="Numbers list",c.icon="ordered-list",c.listTag="ol",c}(b.Tools.UnorderedList),b.Tools.Table=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"table"),c.label="Table",c.icon="table",c.canApply=function(a,b){return!a.isGallery()&&(!a.isFixed()&&void 0!==a)},c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,h=a.closest(function(a){return a&&"Table"===a.type()}),f=new b.TableDialog(h),f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,j,k,l,m;return l=c.detail(),j=!0,h?(b._updateTable(l,h),j=a.closest(function(a){return a&&"Table"===a.type()})):(h=b._createTable(l),m=b._insertAt(a),k=m[0],e=m[1],k.parent().attach(h,e),j=!1),j?a.restoreState():h.firstSection().children[0].children[0].children[0].focus(),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",i)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c._adjustColumns=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;for(l=a.children,m=[],j=0,k=l.length;j<k;j++)i=l[j],d=i.children[0].tagName(),f=i.children.length,g=b-f,g<0?m.push(function(){var a,b;for(b=[],h=a=g;g<=0?a<0:a>0;h=g<=0?++a:--a)c=i.children[i.children.length-1],b.push(i.detach(c));return b}()):g>0?m.push(function(){var a,b;for(b=[],h=a=0;0<=g?a<g:a>g;h=0<=g?++a:--a)c=new ContentEdit.TableCell(d),i.attach(c),e=new ContentEdit.TableCellText(""),b.push(c.attach(e));return b}()):m.push(void 0);return m},c._createTable=function(a){var b,c,d,e;return e=new ContentEdit.Table,a.head&&(d=this._createTableSection("thead","th",a.columns),e.attach(d)),b=this._createTableSection("tbody","td",a.columns),e.attach(b),a.foot&&(c=this._createTableSection("tfoot","td",a.columns),e.attach(c)),e},c._createTableSection=function(a,b,c){var d,e,f,g,h;for(g=new ContentEdit.TableSection(a),f=new ContentEdit.TableRow,g.attach(f),h=0;0<=c?h<c:h>c;0<=c?++h:--h)d=new ContentEdit.TableCell(b),f.attach(d),e=new ContentEdit.TableCellText(""),d.attach(e);return g},c._updateTable=function(a,b){var c,d,e,f,g,h,i;if(!a.head&&b.thead()&&b.detach(b.thead()),!a.foot&&b.tfoot()&&b.detach(b.tfoot()),c=b.firstSection().children[0].children.length,a.columns!==c)for(i=b.children,g=0,h=i.length;g<h;g++)f=i[g],this._adjustColumns(f,a.columns);if(a.head&&!b.thead()&&(e=this._createTableSection("thead","th",a.columns),b.attach(e,0)),a.foot&&!b.tfoot())return d=this._createTableSection("tfoot","td",a.columns),b.attach(d)},c}(b.Tool),b.Tools.Indent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"indent"),c.label="Indent",c.icon="indent",c.canApply=function(a,b){return!a.isGallery()&&("ListItem"===a.parent().type()&&a.parent().parent().children.indexOf(a.parent())>0)},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().indent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.Unindent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unindent"),c.label="Unindent",c.icon="unindent",c.canApply=function(a,b){return!a.isGallery()&&"ListItem"===a.parent().type()},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().unindent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.LineBreak=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"line-break"),c.label="Line break",c.icon="line-break",c.canApply=function(a,b){return!a.isGallery()&&a.content},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return e=b.get()[0]+1,g=a.content.substring(0,b.get()[0]),f=a.content.substring(b.get()[1]),d=f&&f.characters&&f.characters.length?new HTMLString.String("<br>",a.content.preserveWhitespace()):new HTMLString.String("<br><br>",a.content.preserveWhitespace()),a.content=g.concat(d,f),a.updateInnerHTML(),a.taint(),b.set(e,e),a.selection(b),c(!0),this.dispatchEditorEvent("tool-applied",h)},c}(b.Tool),b.Tools.Image=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"image"),c.label="Image",c.icon="image",c.canApply=function(a,b){return!a.isFixed()||"ImageFixture"===a.type()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.ImageDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,i,j,k,l,m,n,o;return e=c.detail(),l=e.imageURL,k=e.imageSize,j=e.imageAttrs,j||(j={}),j.height=k[1],j.src=l,j.width=k[0],"ImageFixture"===a.type()?a.src(l):(i=new ContentEdit.Image(j),o=b._insertAt(a),n=o[0],m=o[1],n.parent().attach(i,m),i.focus()),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Video=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"video"),c.label="Video",c.icon="video",c.canApply=function(a,b){return!a.isGallery()&&!a.isFixed()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.VideoDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(c){return function(e){var i,j,k,l,m,n;if(l=e.detail().url,l?(m=new ContentEdit.Video("iframe",{frameborder:0,height:b.DEFAULT_VIDEO_HEIGHT,src:l,width:b.DEFAULT_VIDEO_WIDTH,'allowfullscreen':'allowfullscreen'}),n=c._insertAt(a),k=n[0],j=n[1],k.parent().attach(m,j),m.focus()):a.restoreState&&a.restoreState(),g.hide(),f.hide(),i=""!==l,d(i),i)return c.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Undo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"undo"),c.label="Undo",c.icon="undo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canUndo()},c.apply=function(a,b,c){var d,e,f;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return d=this.editor(),d.history.stopWatching(),e=d.history.undo(),d.revertToSnapshot(e),d.history.watch(),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Redo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"redo"),c.label="Redo",c.icon="redo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canRedo()},c.apply=function(a,c,d){var e,f,g;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g))return e=b.EditorApp.get(),e.history.stopWatching(),f=e.history.redo(),e.revertToSnapshot(f),e.history.watch(),this.dispatchEditorEvent("tool-applied",g)},c}(b.Tool),b.Tools.Remove=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"remove"),c.label="Remove",c.icon="remove",c.canApply=function(a,b){return!a.isFixed()},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h)){if(d=this.editor(),a.blur(),a.nextContent()?a.nextContent().focus():a.previousContent()&&a.previousContent().focus(),!a.isMounted())return c(!0),void this.dispatchEditorEvent("tool-applied",h);switch(a.type()){case"ListItemText":d.ctrlDown()?(e=a.closest(function(a){return"Region"===a.parent().type()}),e.parent().detach(e)):a.parent().parent().detach(a.parent());break;case"TableCellText":d.ctrlDown()?(g=a.closest(function(a){return"Table"===a.type()}),g.parent().detach(g)):(f=a.parent().parent(),f.parent().detach(f));break;default:a.parent().detach(a)}return c(!0),this.dispatchEditorEvent("tool-applied",h)}},c}(b.Tool)}.call(this);
/*!
 * baguetteBox.js
 * @author  feimosi
 * @version 1.11.1
 * @url https://github.com/feimosi/baguetteBox.js
 */
!function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.baguetteBox=t()}(this,function(){"use strict";var r,l,u,c,d,f='<svg width="44" height="60"><polyline points="30 10 10 30 30 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',g='<svg width="44" height="60"><polyline points="14 10 34 30 14 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',p='<svg width="30" height="30"><g stroke="rgb(160,160,160)" stroke-width="4"><line x1="5" y1="5" x2="25" y2="25"/><line x1="5" y1="25" x2="25" y2="5"/></g></svg>',b={},v={captions:!0,buttons:"auto",fullScreen:!1,noScrollbars:!1,bodyClass:"baguetteBox-open",titleTag:!1,async:!1,preload:2,animation:"slideIn",afterShow:null,afterHide:null,onChange:null,overlayBackgroundColor:"rgba(0,0,0,.8)"},m={},h=[],o=0,n=!1,i={},a=!1,y=/.+\.(gif|jpe?g|png|webp)/i,w={},k=[],s=null,x=function(e){-1!==e.target.id.indexOf("baguette-img")&&j()},E=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,D()},C=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,X()},B=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,j()},T=function(e){i.count++,1<i.count&&(i.multitouch=!0),i.startX=e.changedTouches[0].pageX,i.startY=e.changedTouches[0].pageY},N=function(e){if(!a&&!i.multitouch){e.preventDefault?e.preventDefault():e.returnValue=!1;var t=e.touches[0]||e.changedTouches[0];40<t.pageX-i.startX?(a=!0,D()):t.pageX-i.startX<-40?(a=!0,X()):100<i.startY-t.pageY&&j()}},L=function(){i.count--,i.count<=0&&(i.multitouch=!1),a=!1},A=function(){L()},P=function(e){"block"===r.style.display&&r.contains&&!r.contains(e.target)&&(e.stopPropagation(),Y())};function S(e){if(w.hasOwnProperty(e)){var t=w[e].galleries;[].forEach.call(t,function(e){[].forEach.call(e,function(e){W(e.imageElement,"click",e.eventHandler)}),h===e&&(h=[])}),delete w[e]}}function F(e){switch(e.keyCode){case 37:D();break;case 39:X();break;case 27:j();break;case 36:!function t(e){e&&e.preventDefault();return M(0)}(e);break;case 35:!function n(e){e&&e.preventDefault();return M(h.length-1)}(e)}}function H(e,t){if(h!==e){for(h=e,function s(e){e=e||{};for(var t in v)b[t]=v[t],"undefined"!=typeof e[t]&&(b[t]=e[t]);l.style.transition=l.style.webkitTransition="fadeIn"===b.animation?"opacity .4s ease":"slideIn"===b.animation?"":"none","auto"===b.buttons&&("ontouchstart"in window||1===h.length)&&(b.buttons=!1);u.style.display=c.style.display=b.buttons?"":"none";try{r.style.backgroundColor=b.overlayBackgroundColor}catch(n){}}(t);l.firstChild;)l.removeChild(l.firstChild);for(var n,o=[],i=[],a=k.length=0;a<e.length;a++)(n=J("div")).className="full-image",n.id="baguette-img-"+a,k.push(n),o.push("baguetteBox-figure-"+a),i.push("baguetteBox-figcaption-"+a),l.appendChild(k[a]);r.setAttribute("aria-labelledby",o.join(" ")),r.setAttribute("aria-describedby",i.join(" "))}}function I(e){b.noScrollbars&&(document.documentElement.style.overflowY="hidden",document.body.style.overflowY="scroll"),"block"!==r.style.display&&(U(document,"keydown",F),i={count:0,startX:null,startY:null},q(o=e,function(){z(o),V(o)}),R(),r.style.display="block",b.fullScreen&&function t(){r.requestFullscreen?r.requestFullscreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.mozRequestFullScreen&&r.mozRequestFullScreen()}(),setTimeout(function(){r.className="visible",b.bodyClass&&document.body.classList&&document.body.classList.add(b.bodyClass),b.afterShow&&b.afterShow()},50),b.onChange&&b.onChange(o,k.length),s=document.activeElement,Y(),n=!0)}function Y(){b.buttons?u.focus():d.focus()}function j(){b.noScrollbars&&(document.documentElement.style.overflowY="auto",document.body.style.overflowY="auto"),"none"!==r.style.display&&(W(document,"keydown",F),r.className="",setTimeout(function(){r.style.display="none",document.fullscreen&&function e(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}(),b.bodyClass&&document.body.classList&&document.body.classList.remove(b.bodyClass),b.afterHide&&b.afterHide(),s&&s.focus(),n=!1},500))}function q(t,n){var e=k[t],o=h[t];if(void 0!==e&&void 0!==o)if(e.getElementsByTagName("img")[0])n&&n();else{var i=o.imageElement,a=i.getElementsByTagName("img")[0],s="function"==typeof b.captions?b.captions.call(h,i):i.getAttribute("data-caption")||i.title,r=function d(e){var t=e.href;if(e.dataset){var n=[];for(var o in e.dataset)"at-"!==o.substring(0,3)||isNaN(o.substring(3))||(n[o.replace("at-","")]=e.dataset[o]);for(var i=Object.keys(n).sort(function(e,t){return parseInt(e,10)<parseInt(t,10)?-1:1}),a=window.innerWidth*window.devicePixelRatio,s=0;s<i.length-1&&i[s]<a;)s++;t=n[i[s]]||t}return t}(i),l=J("figure");if(l.id="baguetteBox-figure-"+t,l.innerHTML='<div class="baguetteBox-spinner"><div class="baguetteBox-double-bounce1"></div><div class="baguetteBox-double-bounce2"></div></div>',b.captions&&s){var u=J("figcaption");u.id="baguetteBox-figcaption-"+t,u.innerHTML=s,l.appendChild(u)}e.appendChild(l);var c=J("img");c.onload=function(){var e=document.querySelector("#baguette-img-"+t+" .baguetteBox-spinner");l.removeChild(e),!b.async&&n&&n()},c.setAttribute("src",r),c.alt=a&&a.alt||"",b.titleTag&&s&&(c.title=s),l.appendChild(c),b.async&&n&&n()}}function X(){return M(o+1)}function D(){return M(o-1)}function M(e,t){return!n&&0<=e&&e<t.length?(H(t,b),I(e),!0):e<0?(b.animation&&O("left"),!1):e>=k.length?(b.animation&&O("right"),!1):(q(o=e,function(){z(o),V(o)}),R(),b.onChange&&b.onChange(o,k.length),!0)}function O(e){l.className="bounce-from-"+e,setTimeout(function(){l.className=""},400)}function R(){var e=100*-o+"%";"fadeIn"===b.animation?(l.style.opacity=0,setTimeout(function(){m.transforms?l.style.transform=l.style.webkitTransform="translate3d("+e+",0,0)":l.style.left=e,l.style.opacity=1},400)):m.transforms?l.style.transform=l.style.webkitTransform="translate3d("+e+",0,0)":l.style.left=e}function z(e){e-o>=b.preload||q(e+1,function(){z(e+1)})}function V(e){o-e>=b.preload||q(e-1,function(){V(e-1)})}function U(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent("on"+t,function(e){(e=e||window.event).target=e.target||e.srcElement,n(e)})}function W(e,t,n,o){e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent("on"+t,n)}function G(e){return document.getElementById(e)}function J(e){return document.createElement(e)}return[].forEach||(Array.prototype.forEach=function(e,t){for(var n=0;n<this.length;n++)e.call(t,this[n],n,this)}),[].filter||(Array.prototype.filter=function(e,t,n,o,i){for(n=this,o=[],i=0;i<n.length;i++)e.call(t,n[i],i,n)&&o.push(n[i]);return o}),{run:function K(e,t){return m.transforms=function n(){var e=J("div");return"undefined"!=typeof e.style.perspective||"undefined"!=typeof e.style.webkitPerspective}(),m.svg=function o(){var e=J("div");return e.innerHTML="<svg/>","http://www.w3.org/2000/svg"===(e.firstChild&&e.firstChild.namespaceURI)}(),m.passiveEvents=function i(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(n){}return e}(),function a(){if(r=G("baguetteBox-overlay"))return l=G("baguetteBox-slider"),u=G("previous-button"),c=G("next-button"),void(d=G("close-button"));(r=J("div")).setAttribute("role","dialog"),r.id="baguetteBox-overlay",document.getElementsByTagName("body")[0].appendChild(r),(l=J("div")).id="baguetteBox-slider",r.appendChild(l),(u=J("button")).setAttribute("type","button"),u.id="previous-button",u.setAttribute("aria-label","Previous"),u.innerHTML=m.svg?f:"&lt;",r.appendChild(u),(c=J("button")).setAttribute("type","button"),c.id="next-button",c.setAttribute("aria-label","Next"),c.innerHTML=m.svg?g:"&gt;",r.appendChild(c),(d=J("button")).setAttribute("type","button"),d.id="close-button",d.setAttribute("aria-label","Close"),d.innerHTML=m.svg?p:"&times;",r.appendChild(d),u.className=c.className=d.className="baguetteBox-button",function n(){var e=m.passiveEvents?{passive:!1}:null,t=m.passiveEvents?{passive:!0}:null;U(r,"click",x),U(u,"click",E),U(c,"click",C),U(d,"click",B),U(l,"contextmenu",A),U(r,"touchstart",T,t),U(r,"touchmove",N,e),U(r,"touchend",L),U(document,"focus",P,!0)}()}(),S(e),function s(e,a){var t=document.querySelectorAll(e),n={galleries:[],nodeList:t};return w[e]=n,[].forEach.call(t,function(e){a&&a.filter&&(y=a.filter);var t=[];if(t="A"===e.tagName?[e]:e.getElementsByTagName("a"),0!==(t=[].filter.call(t,function(e){if(-1===e.className.indexOf(a&&a.ignoreClass))return y.test(e.href)})).length){var i=[];[].forEach.call(t,function(e,t){var n=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,H(i,a),I(t)},o={eventHandler:n,imageElement:e};U(e,"click",n),i.push(o)}),n.galleries.push(i)}}),n.galleries}(e,t)},show:M,showNext:X,showPrevious:D,hide:j,destroy:function e(){!function n(){var e=m.passiveEvents?{passive:!1}:null,t=m.passiveEvents?{passive:!0}:null;W(r,"click",x),W(u,"click",E),W(c,"click",C),W(d,"click",B),W(l,"contextmenu",A),W(r,"touchstart",T,t),W(r,"touchmove",N,e),W(r,"touchend",L),W(document,"focus",P,!0)}(),function t(){for(var e in w)w.hasOwnProperty(e)&&S(e)}(),W(document,"keydown",F),document.getElementsByTagName("body")[0].removeChild(document.getElementById("baguetteBox-overlay")),w={},h=[],o=0}}});
function setUpSpecialNavs(){function e(){document.querySelector(".content-tint").classList.remove("on"),document.querySelector(".selected-nav").click(),setTimeout((function(){document.querySelector(".content-tint").remove()}),10)}document.querySelectorAll(".navbar-toggler").forEach((function(e){e.addEventListener("click",(function(e){var t=e.target.closest("nav"),o=t.querySelector("ul.site-navigation"),l=o.parentNode.innerHTML;if(o.parentNode.matches(".fullscreen-nav, .sidebar-nav"))if(e.stopPropagation(),o.parentNode.classList.add("nav-special"),e.target.classList.contains("selected-nav"))document.querySelector(".close-special-menu").remove(),document.querySelector(".blocsapp-special-menu blocsnav").classList.remove("open"),document.querySelector(".selected-nav").classList.remove("selected-nav"),setTimeout((function(){document.querySelector(".blocsapp-special-menu").remove(),document.body.classList.remove("lock-scroll"),document.querySelector(".nav-special").classList.remove("nav-special")}),300);else{e.target.classList.add("selected-nav");var n=t.getAttribute("class").replace("navbar","").replace("row","").replace("hover-open-submenu",""),i=o.parentNode.getAttribute("class").replace("navbar-collapse","").replace("collapse","").replace("collapsing","");document.querySelector(".content-tint")||document.body.insertAdjacentHTML("beforeend",'<div class="content-tint"></div>'),document.querySelector(".page-container").insertAdjacentHTML("beforebegin",'<div class="blocsapp-special-menu '+n+'"><blocsnav class="'+i+'">'+l+"</div>"),document.querySelector("blocsnav").insertAdjacentHTML("afterbegin",'<a class="close-special-menu animated fadeIn animDelay06"><div class="close-icon"></div></a>'),function(){var e=0,t=60,o="fadeInRight";document.querySelector(".blocsapp-special-menu blocsnav").classList.contains("fullscreen-nav")?(o="fadeIn",t=100):document.querySelector(".blocsapp-special-menu").classList.contains("nav-invert")&&(o="fadeInLeft");document.querySelectorAll(".blocsapp-special-menu blocsnav li").forEach((l=>{l.parentNode.classList.contains("dropdown-menu")?l.classList.add.apply(l.classList,["animated","fadeIn"]):(e+=t,l.classList.add.apply(l.classList,["animated",o]),l.setAttribute("style","animation-delay:"+e+"ms"))}))}(),setTimeout((function(){document.querySelector(".blocsapp-special-menu blocsnav").classList.add("open"),document.querySelector(".content-tint").classList.add("on"),document.body.classList.add("lock-scroll")}),10)}}))})),delegateSelector("body","click",".blocsapp-special-menu a",(function(t){if (!t.target.closest('.dropdown-toggle')){if (t.target.hasAttribute('href') && t.target.closest('.fullscreen-nav')){const href = t.target.getAttribute('href');if (!href.startsWith('#')){return;}}e()}})),delegateSelector("body","mousedown touchend",".content-tint, .close-special-menu, .close-special-menu .close-icon",(function(t){e()}))}function setUpNavExtras(){function e(e){var t=e.closest(".dropdown-menu");if(t){var o=e.parentNode.querySelector(".dropdown-menu");if(!t.parentNode.classList.contains("navbar-nav")&&!e.closest(".nav-special")){var l=t.offsetWidth-2,n=e.parentNode.querySelector(".dropdown-menu").offsetWidth;o.classList.remove("submenu-left"),0==n&&(n=160),t.getBoundingClientRect().left+n+l>window.innerWidth&&o.classList.add("submenu-left")}}}delegateSelector("body","click",".dropdown-menu a.dropdown-toggle",(function(t){e(t.target)})),document.querySelectorAll(".dropdown-menu a.dropdown-toggle").forEach((function(t){t.addEventListener("click",(function(t){e(t.target)}))})),document.querySelectorAll("ul.dropdown-menu [data-toggle=dropdown]").forEach((function(e){e.addEventListener("click",(function(e){e.stopPropagation()}))}))}function scrollToTarget(e,t){var o=window.scrollY||document.documentElement.scrollTop,l=0,n=1e3,i=0;if(0==e)i=t.closest(".bloc").offsetHeight;else if(2==e)i=document.documentElement.scrollHeight;else if(1!=e){i=document.querySelector(e).getBoundingClientRect().top+window.scrollY;var a=document.querySelector(".sticky-nav");a&&(i-=a.offsetHeight)}t.matches("[data-scroll-speed]")&&(n=parseInt(t.getAttribute("data-scroll-speed")));var c=Math.max(.1,Math.min(Math.abs(o-i)/n,.8));!function e(){var t=(l+=1/60)/c,n=Math.sin(t*(Math.PI/2)),a=i;t<1&&(requestAnimFrame(e),a=o+(i-o)*n),window.scrollTo(0,a)}()}function stickyNavToggle(){var e=document.querySelector(".sticky-nav");if(e){var t=e.getBoundingClientRect().top+window.scrollY,o=["sticky"],l=document.querySelector(".page-container"),n=e.classList.contains("fill-bloc-top-edge");n&&(l=document.querySelector(".fill-bloc-top-edge.sticky-nav").parentNode,o=["sticky","animated","fadeIn"]),e.classList.contains("sticky")&&(t=e.getAttribute("data-original-offset")),(window.pageYOffset||document.documentElement.scrollTop)>t?e.classList.contains("sticky")||(e.classList.add.apply(e.classList,o),e.setAttribute("data-original-offset",t),t=e.offsetHeight,n&&(e.style.background=getBlocBgColor(l),t+=parseInt(window.getComputedStyle(l,null).getPropertyValue("padding-top"))),l.style.paddingTop=t+"px"):e.classList.contains("sticky")&&(e.classList.remove.apply(e.classList,o),e.removeAttribute("style"),l.removeAttribute("style"))}}function getBlocBgColor(e){var t=window.getComputedStyle(e,null),o=t.getPropertyValue("background-color"),l=t.getPropertyValue("background-image");return e.classList.contains("b-parallax")&&(o=window.getComputedStyle(e.querySelector(".parallax"),null).getPropertyValue("background-color")),"rgba(0, 0, 0, 0)"==o&&-1==l.indexOf("gradient")&&(o="#FFFFFF"),o}function hideAll(){document.querySelectorAll(".animated").forEach((e=>{(!document.body.classList.contains("mob-disable-anim")||document.body.classList.contains("mob-disable-anim")&&window.innerWidth>767)&&(e.getBoundingClientRect().top+e.offsetHeight/3>window.innerHeight&&(e.classList.remove("animated"),e.classList.add("hideMe")))}))}function inViewCheck(){[].slice.call(document.querySelectorAll(".hideMe"),0).reverse().forEach((e=>{var t=e.getBoundingClientRect().top+window.scrollY,o=t+e.offsetHeight,l=window.pageYOffset+window.innerHeight;if(e.offsetHeight>window.innerHeight&&(o=t),o<l){var n=e.className.replace("hideMe","animated");e.style.visibility="hidden",e.removeAttribute("class"),setTimeout((function(){e.style.visibility="visible",e.setAttribute("class",n)}),.01);["webkitAnimationEnd","mozAnimationEnd","oAnimationEnd","animationEnd"].forEach((function(t){window.addEventListener(t,(function(t){e.classList.contains("animLoopInfinite")||e.classList.remove(e.getAttribute("data-appear-anim-style"))}))}))}}))}function scrollBtnVisible(){var e=document.querySelector(".scrollToTop");e&&(window.pageYOffset>window.innerHeight/3?e.classList.contains("showScrollTop")||e.classList.add("showScrollTop"):e.classList.remove("showScrollTop"))}function setUpVisibilityToggle(){document.querySelectorAll("[data-toggle-visibility]").forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault();var t=e.currentTarget.getAttribute("data-toggle-visibility"),o=[t];-1!=t.indexOf(",")&&(o=t.split(",")),o.forEach((function(e){!function(e){if(e){if(e.classList.contains("toggled-item")||e.classList.add("toggled-item"),"0px"==window.getComputedStyle(e,null).getPropertyValue("height")||e.classList.contains("object-hidden")){e.classList.remove("object-hidden"),e.style.removeProperty("display"),e.style.height="auto";var t=e.clientHeight+"px";e.style.height="0px",e.offsetHeight,e.classList.remove("toggled-item-hidden"),setTimeout((function(){e.style.height=t}),0),setTimeout((function(){e.style.minHeight=t,e.style.removeProperty("height")}),360)}else e.style.height=e.scrollHeight+"px",e.offsetHeight,e.style.removeProperty("min-height"),e.classList.add("toggled-item-hidden"),window.setTimeout((function(){e.style.height="0",0==e.style.height&&(e.style.display="none")}),0);reCalculateParallax()}}(document.getElementById(e))}))}))}))}function setUpClassToggle(){document.querySelectorAll("[data-toggle-class-target]").forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault();var t=e.currentTarget.getAttribute("data-toggle-class-target"),o=e.currentTarget.getAttribute("data-toggle-class");if(o.length){if(-1!=t.indexOf(","))t.split(",").forEach((function(e){document.getElementById(e).classList.toggle(o)}));else document.getElementById(t).classList.toggle(o);reCalculateParallax()}}))}))}function setUpLightBox(){function e(){var e=document.querySelector("#lightbox-image"),t=document.querySelector(".lightbox-caption"),o=document.querySelector("#lightbox-video-container");e.style.display="block",t.style.display="none",o.style.display="none";var l=targetJSLightbox.getAttribute("data-lightbox");if(".mp4"==l.substring(l.length-4)){var n="";1==targetJSLightbox.getAttribute("data-autoplay")&&(n="autoplay"),e.style.display="none",o.style.display="block",o.innerHTML="<video controls "+n+' class="embed-responsive-item"><source id="lightbox-video" src="'+l+'" type="video/mp4"></video>'}else{e.setAttribute("src",l);var i=targetJSLightbox.getAttribute("data-caption");i&&(t.innerHTML=i,t.style.display="block")}var a=document.querySelector(".prev-lightbox"),c=document.querySelector(".next-lightbox");a.style.display="block",c.style.display="block";var s=document.querySelectorAll("a[data-lightbox]");if(targetJSLightbox.getAttribute("data-gallery-id")){var r=targetJSLightbox.getAttribute("data-gallery-id");s=document.querySelectorAll('a[data-gallery-id="'+r+'"]')}var d=Array.from(s).indexOf(targetJSLightbox);0==d?(a.style.display="none",1==s.length&&(c.style.display="none")):d==s.length-1&&(c.style.display="none")}window.targetJSLightbox,document.querySelectorAll("[data-lightbox]").forEach((function(t){t.addEventListener("click",(function(o){o.preventDefault(),targetJSLightbox=t;var l=targetJSLightbox.getAttribute("data-lightbox"),n=targetJSLightbox.getAttribute("data-caption"),i=targetJSLightbox.getAttribute("data-frame"),a="",c="";1==targetJSLightbox.getAttribute("data-autoplay")&&(c="autoplay");var s=targetJSLightbox.querySelector("img");s&&s.classList.contains("img-protected")&&(a="img-protected");var r=document.querySelector("#lightbox-modal");r&&r.remove();var d='<svg class="lightbox-close-svg" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 32 32"><path class="lightbox-close-icon" d="M4,4L28,28"/><path class="lightbox-close-icon" d="M28,4L4,28"/></svg>',u='<div id="lightbox-modal" class="modal fade"><div class="modal-dialog modal-dialog-centered modal-lg"><div class="modal-content '+i+' blocs-lb-container"><button id="blocs-lightbox-close-btn" type="button" class="close-lightbox" data-bs-dismiss="modal" aria-label="Close">'+d+'</button><div class="modal-body"><a href="#" class="prev-lightbox" aria-label="prev"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 32 32"><path class="lightbox-nav-icon lightbox-prev-icon" d="M22,2L9,16,22,30"/></svg></a><a href="#" class="next-lightbox" aria-label="next"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 32 32"><path class="lightbox-nav-icon lightbox-next-icon" d="M10.344,2l13,14-13,14"/></svg></a><img id="lightbox-image" class="img-fluid mx-auto '+a+'" src="'+l+'"><div id="lightbox-video-container" class="embed-responsive embed-responsive-16by9"><video controls '+c+' class="embed-responsive-item"><source id="lightbox-video" src="'+l+'" type="video/mp4"></video></div><p class="lightbox-caption">'+n+"</p></div></div></div></div>";document.body.insertAdjacentHTML("beforeend",u),document.querySelectorAll(".next-lightbox, .prev-lightbox").forEach((function(t){t.addEventListener("click",(function(o){o.preventDefault();var l=document.querySelectorAll("a[data-lightbox]");if(targetJSLightbox.getAttribute("data-gallery-id")){var n=targetJSLightbox.getAttribute("data-gallery-id");l=document.querySelectorAll('a[data-gallery-id="'+n+'"]')}var i=Array.from(l).indexOf(targetJSLightbox)+1;t.classList.contains("prev-lightbox")&&(i-=2),i>-1&&l.length>i&&(targetJSLightbox=l[i],e())}))})),function(){const e=document.getElementById("lightbox-image");if(e){let o=0,l=0,n=0,i=0;function t(){var e=document.querySelector(".prev-lightbox"),t=document.querySelector(".next-lightbox");n<=o&&"none"!=t.style.display&&t.click(),n>=o&&"none"!=e.style.display&&e.click()}e.addEventListener("touchstart",(function(e){o=e.changedTouches[0].screenX,l=e.changedTouches[0].screenY}),!1),e.addEventListener("touchend",(function(e){n=e.changedTouches[0].screenX,i=e.changedTouches[0].screenY,t()}),!1)}}(),r=document.querySelector("#lightbox-modal"),"fullscreen-lb"==i&&(r.classList.add("fullscreen-modal"),document.querySelector("#blocs-lightbox-close-btn").remove(),r.insertAdjacentHTML("beforeend",'<a class="close-full-screen-modal animated fadeIn" style="animation-delay:0.5s;" data-bs-dismiss="modal">'+d+"</a>")),e();var g=new bootstrap.Modal(document.querySelector("#lightbox-modal"),{});if(g.show(),a.length){var p=document.querySelector("#lightbox-modal .img-protected");p.addEventListener("contextmenu",(function(e){e.preventDefault()})),p.addEventListener("mousedown",(function(e){e.preventDefault()}))}delegateSelector("body","click",'[data-bs-dismiss="modal"]',(function(e){g.hide()}))}))})),window.addEventListener("keydown",(e=>{if(document.querySelector("#lightbox-modal")){var t=document.querySelector(".prev-lightbox");37==e.which||39==e.which?(39==e.which&&(t=document.querySelector(".next-lightbox")),"none"!=t.style.display&&t.click()):27==e.which&&document.getElementById("blocs-lightbox-close-btn").click()}}))}function setUpImgProtection(){document.querySelectorAll(".img-protected").forEach((function(e){e.addEventListener("contextmenu",(function(e){e.preventDefault()})),e.addEventListener("mousedown",(function(e){e.preventDefault()}))}))}function reCalculateParallax(){if(document.querySelector(".b-parallax")){var e=document.querySelectorAll(".parallax__container .parallax");e.forEach((e=>{e.style.height="100%"})),setTimeout((function(){calculateHeight(e,3)}),400)}}function scrollToPolyFill(){var e=window,t=document;if(!("scrollBehavior"in t.documentElement.style)||!0===e.__forceSmoothScrollPolyfill__){var o,l=e.HTMLElement||e.Element,n=468,i={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:l.prototype.scroll||s,scrollIntoView:l.prototype.scrollIntoView},a=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now,c=(o=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(o)?1:0);e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==r(arguments[0])?m.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):i.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(r(arguments[0])?i.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):m.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},l.prototype.scroll=l.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==r(arguments[0])){var e=arguments[0].left,t=arguments[0].top;m.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},l.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==r(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},l.prototype.scrollIntoView=function(){if(!0!==r(arguments[0])){var o=function(e){for(;e!==t.body&&!1===g(e);)e=e.parentNode||e.host;return e}(this),l=o.getBoundingClientRect(),n=this.getBoundingClientRect();o!==t.body?(m.call(this,o,o.scrollLeft+n.left-l.left,o.scrollTop+n.top-l.top),"fixed"!==e.getComputedStyle(o).position&&e.scrollBy({left:l.left,top:l.top,behavior:"smooth"})):e.scrollBy({left:n.left,top:n.top,behavior:"smooth"})}else i.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function s(e,t){this.scrollLeft=e,this.scrollTop=t}function r(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function d(e,t){return"Y"===t?e.clientHeight+c<e.scrollHeight:"X"===t?e.clientWidth+c<e.scrollWidth:void 0}function u(t,o){var l=e.getComputedStyle(t,null)["overflow"+o];return"auto"===l||"scroll"===l}function g(e){var t=d(e,"Y")&&u(e,"Y"),o=d(e,"X")&&u(e,"X");return t||o}function p(t){var o,l,i,c,s=(a()-t.startTime)/n;c=s=s>1?1:s,o=.5*(1-Math.cos(Math.PI*c)),l=t.startX+(t.x-t.startX)*o,i=t.startY+(t.y-t.startY)*o,t.method.call(t.scrollable,l,i),l===t.x&&i===t.y||e.requestAnimationFrame(p.bind(e,t))}function m(o,l,n){var c,r,d,u,g=a();o===t.body?(c=e,r=e.scrollX||e.pageXOffset,d=e.scrollY||e.pageYOffset,u=i.scroll):(c=o,r=o.scrollLeft,d=o.scrollTop,u=s),p({scrollable:c,method:u,startTime:g,startX:r,startY:d,x:l,y:n})}}function delegateSelector(e,t,o,l){t.split(" ").forEach((t=>{var n=document.querySelectorAll(e);[].forEach.call(n,(function(e,n){e.addEventListener(t,(function(e){e.target.matches(o)&&l(e)}))}))}))}document.addEventListener("DOMContentLoaded",(function(){setUpNavExtras(),setUpSpecialNavs(),setUpLightBox(),setUpVisibilityToggle(),setUpClassToggle(),setUpImgProtection(),$('[data-toggle="tooltip"]').tooltip(),$('.modal').on('hidden.bs.modal', function (e){e.target.querySelectorAll(".embed-responsive-item").forEach(videoItem =>{if (videoItem.tagName=='VIDEO'){videoItem.pause();}else{videoItem.setAttribute('src',videoItem.getAttribute('data-src'));}});}),document.querySelectorAll('a[onclick^="scrollToTarget"]').forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault()}))})),document.querySelectorAll(".nav-item [data-active-page]").forEach((function(e){e.classList.add(e.getAttribute("data-active-page"))})),window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,o=(this.document||this.ownerDocument).querySelectorAll(e),l=this;do{for(t=o.length;--t>=0&&o.item(t)!==l;);}while(t<0&&(l=l.parentElement));return l}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),window.matchMedia("(prefers-color-scheme: dark)").matches&&document.body.classList.add("dark-theme"),scrollToPolyFill()})),window.addEventListener("load",(function(){hideAll(),inViewCheck(),window.addEventListener("scroll",(function(){inViewCheck(),scrollBtnVisible(),stickyNavToggle()}));var e=document.getElementById("page-loading-blocs-notifaction");e&&e.classList.add("preloader-complete")})),$.fn.dropdown=function(){var o=$.fn.dropdown;return function(d){"string"==typeof d&&"toggle"===d&&($(".has-child-dropdown-show").removeClass("has-child-dropdown-show"),$(this).closest(".dropdown").parents(".dropdown").addClass("has-child-dropdown-show"));var n=o.call($(this),d);return $(this).off("click.bs.dropdown"),n}}(),$(function(){$("body").on("click",'.dropdown [data-toggle="dropdown"]',function(o){$(this).dropdown("toggle"),o.stopPropagation()}),$("body").on("hide.bs.dropdown",".dropdown",function(o){$(this).is(".has-child-dropdown-show")&&($(this).removeClass("has-child-dropdown-show"),o.preventDefault()),o.stopPropagation()}),$('.dropdown [data-toggle="dropdown"]').on("click",function(o){$(this).dropdown("toggle"),o.stopPropagation()}),$(".dropdown").on("hide.bs.dropdown",function(o){$(this).is(".has-child-dropdown-show")&&($(this).removeClass("has-child-dropdown-show"),o.preventDefault()),o.stopPropagation()}),$("a.dropdown-toggle").click(function(o) {o.preventDefault();})});window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)};var siteRelativeURLPath;(function(){var scriptUrl = new URL(document.currentScript.src);var parentDirectory = scriptUrl.pathname.substring(0, scriptUrl.pathname.lastIndexOf("/js/")+1);siteRelativeURLPath = scriptUrl.origin + parentDirectory;})();
/*!
 * baguetteBox.js
 * @author  feimosi
 * @version 1.11.1
 * @url https://github.com/feimosi/baguetteBox.js
 */
!function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.baguetteBox=t()}(this,function(){"use strict";var r,l,u,c,d,f='<svg width="44" height="60"><polyline points="30 10 10 30 30 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',g='<svg width="44" height="60"><polyline points="14 10 34 30 14 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',p='<svg width="30" height="30"><g stroke="rgb(160,160,160)" stroke-width="4"><line x1="5" y1="5" x2="25" y2="25"/><line x1="5" y1="25" x2="25" y2="5"/></g></svg>',b={},v={captions:!0,buttons:"auto",fullScreen:!1,noScrollbars:!1,bodyClass:"baguetteBox-open",titleTag:!1,async:!1,preload:2,animation:"slideIn",afterShow:null,afterHide:null,onChange:null,overlayBackgroundColor:"rgba(0,0,0,.8)"},m={},h=[],o=0,n=!1,i={},a=!1,y=/.+\.(gif|jpe?g|png|webp)/i,w={},k=[],s=null,x=function(e){-1!==e.target.id.indexOf("baguette-img")&&j()},E=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,D()},C=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,X()},B=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,j()},T=function(e){i.count++,1<i.count&&(i.multitouch=!0),i.startX=e.changedTouches[0].pageX,i.startY=e.changedTouches[0].pageY},N=function(e){if(!a&&!i.multitouch){e.preventDefault?e.preventDefault():e.returnValue=!1;var t=e.touches[0]||e.changedTouches[0];40<t.pageX-i.startX?(a=!0,D()):t.pageX-i.startX<-40?(a=!0,X()):100<i.startY-t.pageY&&j()}},L=function(){i.count--,i.count<=0&&(i.multitouch=!1),a=!1},A=function(){L()},P=function(e){"block"===r.style.display&&r.contains&&!r.contains(e.target)&&(e.stopPropagation(),Y())};function S(e){if(w.hasOwnProperty(e)){var t=w[e].galleries;[].forEach.call(t,function(e){[].forEach.call(e,function(e){W(e.imageElement,"click",e.eventHandler)}),h===e&&(h=[])}),delete w[e]}}function F(e){switch(e.keyCode){case 37:D();break;case 39:X();break;case 27:j();break;case 36:!function t(e){e&&e.preventDefault();return M(0)}(e);break;case 35:!function n(e){e&&e.preventDefault();return M(h.length-1)}(e)}}function H(e,t){if(h!==e){for(h=e,function s(e){e=e||{};for(var t in v)b[t]=v[t],"undefined"!=typeof e[t]&&(b[t]=e[t]);l.style.transition=l.style.webkitTransition="fadeIn"===b.animation?"opacity .4s ease":"slideIn"===b.animation?"":"none","auto"===b.buttons&&("ontouchstart"in window||1===h.length)&&(b.buttons=!1);u.style.display=c.style.display=b.buttons?"":"none";try{r.style.backgroundColor=b.overlayBackgroundColor}catch(n){}}(t);l.firstChild;)l.removeChild(l.firstChild);for(var n,o=[],i=[],a=k.length=0;a<e.length;a++)(n=J("div")).className="full-image",n.id="baguette-img-"+a,k.push(n),o.push("baguetteBox-figure-"+a),i.push("baguetteBox-figcaption-"+a),l.appendChild(k[a]);r.setAttribute("aria-labelledby",o.join(" ")),r.setAttribute("aria-describedby",i.join(" "))}}function I(e){b.noScrollbars&&(document.documentElement.style.overflowY="hidden",document.body.style.overflowY="scroll"),"block"!==r.style.display&&(U(document,"keydown",F),i={count:0,startX:null,startY:null},q(o=e,function(){z(o),V(o)}),R(),r.style.display="block",b.fullScreen&&function t(){r.requestFullscreen?r.requestFullscreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.mozRequestFullScreen&&r.mozRequestFullScreen()}(),setTimeout(function(){r.className="visible",b.bodyClass&&document.body.classList&&document.body.classList.add(b.bodyClass),b.afterShow&&b.afterShow()},50),b.onChange&&b.onChange(o,k.length),s=document.activeElement,Y(),n=!0)}function Y(){b.buttons?u.focus():d.focus()}function j(){b.noScrollbars&&(document.documentElement.style.overflowY="auto",document.body.style.overflowY="auto"),"none"!==r.style.display&&(W(document,"keydown",F),r.className="",setTimeout(function(){r.style.display="none",document.fullscreen&&function e(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}(),b.bodyClass&&document.body.classList&&document.body.classList.remove(b.bodyClass),b.afterHide&&b.afterHide(),s&&s.focus(),n=!1},500))}function q(t,n){var e=k[t],o=h[t];if(void 0!==e&&void 0!==o)if(e.getElementsByTagName("img")[0])n&&n();else{var i=o.imageElement,a=i.getElementsByTagName("img")[0],s="function"==typeof b.captions?b.captions.call(h,i):i.getAttribute("data-caption")||i.title,r=function d(e){var t=e.href;if(e.dataset){var n=[];for(var o in e.dataset)"at-"!==o.substring(0,3)||isNaN(o.substring(3))||(n[o.replace("at-","")]=e.dataset[o]);for(var i=Object.keys(n).sort(function(e,t){return parseInt(e,10)<parseInt(t,10)?-1:1}),a=window.innerWidth*window.devicePixelRatio,s=0;s<i.length-1&&i[s]<a;)s++;t=n[i[s]]||t}return t}(i),l=J("figure");if(l.id="baguetteBox-figure-"+t,l.innerHTML='<div class="baguetteBox-spinner"><div class="baguetteBox-double-bounce1"></div><div class="baguetteBox-double-bounce2"></div></div>',b.captions&&s){var u=J("figcaption");u.id="baguetteBox-figcaption-"+t,u.innerHTML=s,l.appendChild(u)}e.appendChild(l);var c=J("img");c.onload=function(){var e=document.querySelector("#baguette-img-"+t+" .baguetteBox-spinner");l.removeChild(e),!b.async&&n&&n()},c.setAttribute("src",r),c.alt=a&&a.alt||"",b.titleTag&&s&&(c.title=s),l.appendChild(c),b.async&&n&&n()}}function X(){return M(o+1)}function D(){return M(o-1)}function M(e,t){return!n&&0<=e&&e<t.length?(H(t,b),I(e),!0):e<0?(b.animation&&O("left"),!1):e>=k.length?(b.animation&&O("right"),!1):(q(o=e,function(){z(o),V(o)}),R(),b.onChange&&b.onChange(o,k.length),!0)}function O(e){l.className="bounce-from-"+e,setTimeout(function(){l.className=""},400)}function R(){var e=100*-o+"%";"fadeIn"===b.animation?(l.style.opacity=0,setTimeout(function(){m.transforms?l.style.transform=l.style.webkitTransform="translate3d("+e+",0,0)":l.style.left=e,l.style.opacity=1},400)):m.transforms?l.style.transform=l.style.webkitTransform="translate3d("+e+",0,0)":l.style.left=e}function z(e){e-o>=b.preload||q(e+1,function(){z(e+1)})}function V(e){o-e>=b.preload||q(e-1,function(){V(e-1)})}function U(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent("on"+t,function(e){(e=e||window.event).target=e.target||e.srcElement,n(e)})}function W(e,t,n,o){e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent("on"+t,n)}function G(e){return document.getElementById(e)}function J(e){return document.createElement(e)}return[].forEach||(Array.prototype.forEach=function(e,t){for(var n=0;n<this.length;n++)e.call(t,this[n],n,this)}),[].filter||(Array.prototype.filter=function(e,t,n,o,i){for(n=this,o=[],i=0;i<n.length;i++)e.call(t,n[i],i,n)&&o.push(n[i]);return o}),{run:function K(e,t){return m.transforms=function n(){var e=J("div");return"undefined"!=typeof e.style.perspective||"undefined"!=typeof e.style.webkitPerspective}(),m.svg=function o(){var e=J("div");return e.innerHTML="<svg/>","http://www.w3.org/2000/svg"===(e.firstChild&&e.firstChild.namespaceURI)}(),m.passiveEvents=function i(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(n){}return e}(),function a(){if(r=G("baguetteBox-overlay"))return l=G("baguetteBox-slider"),u=G("previous-button"),c=G("next-button"),void(d=G("close-button"));(r=J("div")).setAttribute("role","dialog"),r.id="baguetteBox-overlay",document.getElementsByTagName("body")[0].appendChild(r),(l=J("div")).id="baguetteBox-slider",r.appendChild(l),(u=J("button")).setAttribute("type","button"),u.id="previous-button",u.setAttribute("aria-label","Previous"),u.innerHTML=m.svg?f:"&lt;",r.appendChild(u),(c=J("button")).setAttribute("type","button"),c.id="next-button",c.setAttribute("aria-label","Next"),c.innerHTML=m.svg?g:"&gt;",r.appendChild(c),(d=J("button")).setAttribute("type","button"),d.id="close-button",d.setAttribute("aria-label","Close"),d.innerHTML=m.svg?p:"&times;",r.appendChild(d),u.className=c.className=d.className="baguetteBox-button",function n(){var e=m.passiveEvents?{passive:!1}:null,t=m.passiveEvents?{passive:!0}:null;U(r,"click",x),U(u,"click",E),U(c,"click",C),U(d,"click",B),U(l,"contextmenu",A),U(r,"touchstart",T,t),U(r,"touchmove",N,e),U(r,"touchend",L),U(document,"focus",P,!0)}()}(),S(e),function s(e,a){var t=document.querySelectorAll(e),n={galleries:[],nodeList:t};return w[e]=n,[].forEach.call(t,function(e){a&&a.filter&&(y=a.filter);var t=[];if(t="A"===e.tagName?[e]:e.getElementsByTagName("a"),0!==(t=[].filter.call(t,function(e){if(-1===e.className.indexOf(a&&a.ignoreClass))return y.test(e.href)})).length){var i=[];[].forEach.call(t,function(e,t){var n=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,H(i,a),I(t)},o={eventHandler:n,imageElement:e};U(e,"click",n),i.push(o)}),n.galleries.push(i)}}),n.galleries}(e,t)},show:M,showNext:X,showPrevious:D,hide:j,destroy:function e(){!function n(){var e=m.passiveEvents?{passive:!1}:null,t=m.passiveEvents?{passive:!0}:null;W(r,"click",x),W(u,"click",E),W(c,"click",C),W(d,"click",B),W(l,"contextmenu",A),W(r,"touchstart",T,t),W(r,"touchmove",N,e),W(r,"touchend",L),W(document,"focus",P,!0)}(),function t(){for(var e in w)w.hasOwnProperty(e)&&S(e)}(),W(document,"keydown",F),document.getElementsByTagName("body")[0].removeChild(document.getElementById("baguetteBox-overlay")),w={},h=[],o=0}}});
$(function()
{	
	$('[data-form-type="blocs-form"] input,[data-form-type="blocs-form"] textarea').jqBootstrapValidation(
    {
     	preventSubmit: true,
     	submitSuccess: function($form, event)
	 	{			
			if(!$form.attr('action')) // Check form doesnt have action attribute
			{
				event.preventDefault(); // prevent default submit behaviour
			
				var processorFile = getProcessorPath($form);
				var formData = {};

				$form.find("input, textarea, option:selected").each(function(e) // Loop over form objects build data object
				{		
					var fieldData =  $(this).val();
					var fieldID =  $(this).attr('id');
				
					if($(this).is(':checkbox')) // Handle Checkboxes
					{
						fieldData = $(this).is(":checked");
					}
					else if($(this).is(':radio')) // Handle Radios
					{
						fieldData = $(this).val()+' = '+$(this).is(":checked");
					}
					else if($(this).is('option:selected')) // Handle Option Selects
					{
						fieldID = $(this).parent().attr('id');
					}
					
					formData[fieldID] = fieldData;		
				});
	
				$.ajax({
		        	url: processorFile,
		    		type: "POST",
		    		data: formData,
		    		cache: false,
		    		success: function(data) // Success
		 			{  
		 				if ($form.find('#form-feedback-alert').length == 0) // Add Alert
		 				{
		 					$form.append("<div id='form-feedback-alert' class='mt-2'><div class='alert alert-success' role='alert'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><strong></strong></div></div>");
		 				}
		 				
		 				var alert = $('#form-feedback-alert .alert');

		 				if (data == 'capture-error' || data == 'capture-connection-error') // Capture Error
		 				{
		 					var type = 'warning';

		 					if (data == 'capture-connection-error')
		 					{
		 						type = 'fail';
		 					}

		 					$('#form-feedback-alert strong').html($form.find('.g-recaptcha').attr('data-capture-'+type));
		 					alert.addClass('alert-danger').removeClass('alert-success');
		 				}
		 				else // Success
		 				{
		 					if ($form.is('[data-success-msg]')) // Show Success Message
							{
								alert.addClass('alert-success').removeClass('alert-danger');
		 						$('#form-feedback-alert strong').html($form.attr('data-success-msg'));
								$form.trigger("reset"); // Clear Form	
							}
							else // Re-Direct
							{
								window.location.replace($form.attr('data-success-url'));
							}	
		 				}
		 	   		},
			   		error: function(xhr, status, error) // Error Posting Form
			   		{
						if ($('#form-alert').length == 0)
						{
							$form.append("<div id='form-alert' class='mt-2'><div class='alert alert-danger' role='alert'><button type='button' class='btn-close float-end' data-bs-dismiss='alert' aria-hidden='true'></button><strong>"+$form.attr('data-fail-msg')+"</strong></div></div>");
						}

						// Log Error
						var response = $.parseJSON(xhr.responseText);
        				console.log("Mail Error: " + response.message);
			   		},
		   		});
			}
         },
         filter: function() // Handle hidden form elements
		 {
			 return $(this).is(":visible");
         },
	 });
	 
	 // Get Path to processor PHP file
	 function getProcessorPath(form)
	 {
		var path = siteRelativeURLPath+"includes/"+form.attr('id')+".php";
		
		if (form.attr('template-path')) // Check For Template Path (Wordpress)
		{
			path = form.attr('template-path')+"/includes/"+form.attr('id')+".php";
		}
		
	 	return path
	 }
});