").append('")),this.$cn.append(this.$header),this.$cn2.append('
').concat(n.t("traitManager.label"),"
")),this.$cn2.append(a.render().el);var l=t.Panels;(l.getPanel("views-container")?l.getPanel("views-container"):l.addPanel({id:"views-container"})).set("appendContent",this.$cn.get(0)).trigger("change:appendContent"),this.target=t.getModel(),this.listenTo(this.target,"component:toggled",this.toggleTm)}this.toggleTm()},toggleTm:function(){var t=this.sender;t&&t.get&&!t.get("active")||(1===this.target.getSelectedAll().length?(this.$cn2.show(),this.$header.hide()):(this.$cn2.hide(),this.$header.show()))},stop:function(){this.$cn2&&this.$cn2.hide(),this.$header&&this.$header.hide()}}},function(t,e,n){"use strict";n.r(e);var r=n(0);e.default={run:function(t){var e=t.getModel().get("clipboard"),n=t.getSelected();e&&n&&(t.getSelectedAll().forEach((function(n){if(n){var i,o=n.collection,a=o.indexOf(n)+1,s=e.filter((function(t){return t.get("copyable")}));i=Object(r.contains)(e,n)&&n.get("copyable")?o.add(n.clone(),{at:a}):o.add(s.map((function(t){return t.clone()})),{at:a}),(i=Object(r.isArray)(i)?i:[i]).forEach((function(e){return t.trigger("component:paste",e)}))}})),n.emitUpdate())}}},function(t,e,n){"use strict";n.r(e);var r=n(0),i="sw-visibility";e.default={getPanels:function(t){return this.panels||(this.panels=t.Panels.getPanels()),this.panels},preventDrag:function(t){t.abort=1},tglPointers:function(t,e){var n=t.Canvas.getBody().querySelectorAll(".".concat(this.ppfx,"no-pointer"));Object(r.each)(n,(function(t){return t.style.pointerEvents=e?"":"all"}))},tglEffects:function(t){var e=this.em;e&&e[t?"on":"off"]("run:tlb-move:before",this.preventDrag)},run:function(t,e){var n=this;this.sender=e,this.shouldRunSwVisibility||(this.shouldRunSwVisibility=t.Commands.isActive(i)),this.shouldRunSwVisibility&&t.stopCommand(i),t.getModel().stopDefault();var r=this.getPanels(t),o=t.Canvas.getElement(),a=t.getEl(),s=t.Config.stylePrefix;if(!this.helper){var l=document.createElement("span");l.className="".concat(s,"off-prv fa fa-eye-slash"),a.appendChild(l),l.onclick=function(){return n.stopCommand()},this.helper=l}this.helper.style.display="inline-block",this.tglPointers(t),r.forEach((function(t){return t.set("visible",!1)}));var c=o.style;c.width="100%",c.height="100%",c.top="0",c.left="0",c.padding="0",c.margin="0",t.refresh(),this.tglEffects(1)},stop:function(t){var e=this.sender,n=void 0===e?{}:e;n.set&&n.set("active",0);var r=this.getPanels(t);this.shouldRunSwVisibility&&(t.runCommand(i),this.shouldRunSwVisibility=!1),t.getModel().runDefault(),r.forEach((function(t){return t.set("visible",!0)})),t.Canvas.getElement().setAttribute("style",""),this.helper&&(this.helper.style.display="none"),t.refresh(),this.tglPointers(t,1),this.tglEffects()}}},function(t,e,n){"use strict";n.r(e),e.default={run:function(t,e,n){var r=n||{},i=r.el||"",o=t.Canvas,a=this.canvasResizer,s=r.options||{},l=o.getCanvasView();return s.appendTo=o.getResizerEl(),s.prefix=t.getConfig().stylePrefix,s.posFetcher=l.getElementPos.bind(l),s.mousePosFetcher=o.getMouseRelativePos,a&&!r.forceNew||(this.canvasResizer=t.Utils.Resizer.init(s),a=this.canvasResizer),a.setOptions(s),a.blur(),a.focus(i),a},stop:function(){var t=this.canvasResizer;t&&t.blur()}}},function(t,e,n){"use strict";n.r(e);var r=n(2),i=n.n(r),o=n(1),a=n.n(o),s=n(0),l=n(3);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var u=a.a.$;e.default={getOffsetMethod:function(t){return"get"+(t||"")+"OffsetViewerEl"},run:function(t,e,n){var r=n||{},o=r.state||"",a=t.getConfig(),d=this.em.getZoomDecimal(),h=r.el||"";if(!a.showOffsets||Object(l.q)(h)||!a.showOffsetsSelected&&"Fixed"==o)t.stopCommand(this.id,n);else{var f=t.Canvas,p=function(t){for(var e=1;e
')).get(0),D=u('')).get(0),A=v+E+"-el",L="".concat(v+P+"-el"," ").concat(v+P),N="".concat(A," ").concat(v+E);y=u('
')).get(0),w=u('
')).get(0),x=u('
')).get(0),O=u('
')).get(0),C=u('
')).get(0),S=u('
')).get(0),k=u('
')).get(0),j=u('
')).get(0),this["marginT"+o]=y,this["marginB"+o]=w,this["marginL"+o]=x,this["marginR"+o]=O,this["padT"+o]=C,this["padB"+o]=S,this["padL"+o]=k,this["padR"+o]=j,M.appendChild(y),M.appendChild(w),M.appendChild(x),M.appendChild(O),D.appendChild(C),D.appendChild(S),D.appendChild(k),D.appendChild(j),b.appendChild(M),b.appendChild(D),this[m]="1"}var I=parseFloat(g.marginLeft.replace("px",""))*d,_=parseFloat(g.marginRight.replace("px",""))*d,F=parseFloat(g.marginTop.replace("px",""))*d,V=parseFloat(g.marginBottom.replace("px",""))*d,R=y.style,z=w.style,H=x.style,$=O.style,W=C.style,B=S.style,U=k.style,q=j.style,G=parseFloat(p.left),K=parseFloat(g.width)*d+"px";R.height=F+"px",R.width=K,R.top=p.top-F+"px",R.left=G+"px",z.height=V+"px",z.width=K,z.top=p.top+p.height+"px",z.left=G+"px";var Y=p.height+F+V+"px",X=p.top-F+"px";H.height=Y,H.width=I+"px",H.top=X,H.left=G-I+"px",$.height=Y,$.width=_+"px",$.top=X,$.left=G+p.width+"px";var J=parseFloat(g.paddingTop)*d;W.height=J+"px";var Z=parseFloat(g.paddingBottom)*d;B.height=Z+"px";var Q=p.height-Z-J+"px",tt=p.top+J+"px";U.height=Q,U.width=parseFloat(g.paddingLeft)*d+"px",U.top=tt;var et=parseFloat(g.paddingRight)*d;q.height=Q,q.width=et+"px",q.top=tt}},stop:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n||{},i=r.state||"",o=this.getOffsetMethod(i),a=t.Canvas,s=a[o](n.view);s.style.opacity=0}}},function(t,e,n){"use strict";n.r(e),e.default={run:function(t){this.toggleVis(t)},stop:function(t){this.toggleVis(t,0)},toggleVis:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!t.Commands.isActive("preview")){var r=n?"add":"remove";t.Canvas.getFrames().forEach((function(t){t.view.getBody().classList[r]("".concat(e.ppfx,"dashed"))}))}}}},function(t,e,n){"use strict";n.r(e);var r=n(2),i=n.n(r),o={stylePrefix:"",appendTo:"",sortable:1,hidable:1,hideTextnode:1,root:"",showWrapper:1,showHover:1,scrollCanvas:{behavior:"smooth",block:"nearest"},scrollLayers:{behavior:"auto",block:"nearest"},highlightHover:1},a=n(36),s=n(0);function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t){for(var e=1;e
0&&void 0!==arguments[0]?arguments[0]:{};return(n=c({},o,{},e)).stylePrefix=e.pStylePrefix,t=n.em,this},getConfig:function(){return n},onLoad:function(){e=new a.a({level:0,config:n,opened:n.opened||{},model:t.get("DomComponents").getWrapper()}),t&&t.on("component:selected",this.componentChanged),this.componentChanged()},postRender:function(){var t=n.appendTo,e=n.root;(e&&this.setRoot(e),t)&&(Object(s.isElement)(t)?t:document.querySelector(t)).appendChild(this.render())},setRoot:function(t){return e.setRoot(t),this},getRoot:function(){return e.model},getAll:function(){return e},componentChanged:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!r.fromLayers){var i=t.get("opened"),o=t.getSelected(),a=n.scrollLayers,s=o&&o.collection?o.collection.parent:null;for(var l in i)i[l].set("open",0);for(;s;)s.set("open",1),i[s.cid]=s,s=s.collection?s.collection.parent:null;if(o&&a){var c=o.viewLayer&&o.viewLayer.el;c&&c.scrollIntoView(a)}}},render:function(){return e.render().el}}}},function(t,e,n){var r,i,o;
+/*! grapesjs - 0.16.22 */
+!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grapesjs=e():t.grapesjs=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=93)}([function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return o})),n.d(e,"VERSION",(function(){return r.VERSION})),n.d(e,"iteratee",(function(){return r.iteratee})),n.d(e,"restArguments",(function(){return r.restArguments})),n.d(e,"each",(function(){return r.each})),n.d(e,"forEach",(function(){return r.forEach})),n.d(e,"map",(function(){return r.map})),n.d(e,"collect",(function(){return r.collect})),n.d(e,"reduce",(function(){return r.reduce})),n.d(e,"foldl",(function(){return r.foldl})),n.d(e,"inject",(function(){return r.inject})),n.d(e,"reduceRight",(function(){return r.reduceRight})),n.d(e,"foldr",(function(){return r.foldr})),n.d(e,"find",(function(){return r.find})),n.d(e,"detect",(function(){return r.detect})),n.d(e,"filter",(function(){return r.filter})),n.d(e,"select",(function(){return r.select})),n.d(e,"reject",(function(){return r.reject})),n.d(e,"every",(function(){return r.every})),n.d(e,"all",(function(){return r.all})),n.d(e,"some",(function(){return r.some})),n.d(e,"any",(function(){return r.any})),n.d(e,"contains",(function(){return r.contains})),n.d(e,"includes",(function(){return r.includes})),n.d(e,"include",(function(){return r.include})),n.d(e,"invoke",(function(){return r.invoke})),n.d(e,"pluck",(function(){return r.pluck})),n.d(e,"where",(function(){return r.where})),n.d(e,"findWhere",(function(){return r.findWhere})),n.d(e,"max",(function(){return r.max})),n.d(e,"min",(function(){return r.min})),n.d(e,"shuffle",(function(){return r.shuffle})),n.d(e,"sample",(function(){return r.sample})),n.d(e,"sortBy",(function(){return r.sortBy})),n.d(e,"groupBy",(function(){return r.groupBy})),n.d(e,"indexBy",(function(){return r.indexBy})),n.d(e,"countBy",(function(){return r.countBy})),n.d(e,"toArray",(function(){return r.toArray})),n.d(e,"size",(function(){return r.size})),n.d(e,"partition",(function(){return r.partition})),n.d(e,"first",(function(){return r.first})),n.d(e,"head",(function(){return r.head})),n.d(e,"take",(function(){return r.take})),n.d(e,"initial",(function(){return r.initial})),n.d(e,"last",(function(){return r.last})),n.d(e,"rest",(function(){return r.rest})),n.d(e,"tail",(function(){return r.tail})),n.d(e,"drop",(function(){return r.drop})),n.d(e,"compact",(function(){return r.compact})),n.d(e,"flatten",(function(){return r.flatten})),n.d(e,"without",(function(){return r.without})),n.d(e,"uniq",(function(){return r.uniq})),n.d(e,"unique",(function(){return r.unique})),n.d(e,"union",(function(){return r.union})),n.d(e,"intersection",(function(){return r.intersection})),n.d(e,"difference",(function(){return r.difference})),n.d(e,"unzip",(function(){return r.unzip})),n.d(e,"zip",(function(){return r.zip})),n.d(e,"object",(function(){return r.object})),n.d(e,"findIndex",(function(){return r.findIndex})),n.d(e,"findLastIndex",(function(){return r.findLastIndex})),n.d(e,"sortedIndex",(function(){return r.sortedIndex})),n.d(e,"indexOf",(function(){return r.indexOf})),n.d(e,"lastIndexOf",(function(){return r.lastIndexOf})),n.d(e,"range",(function(){return r.range})),n.d(e,"chunk",(function(){return r.chunk})),n.d(e,"bind",(function(){return r.bind})),n.d(e,"partial",(function(){return r.partial})),n.d(e,"bindAll",(function(){return r.bindAll})),n.d(e,"memoize",(function(){return r.memoize})),n.d(e,"delay",(function(){return r.delay})),n.d(e,"defer",(function(){return r.defer})),n.d(e,"throttle",(function(){return r.throttle})),n.d(e,"debounce",(function(){return r.debounce})),n.d(e,"wrap",(function(){return r.wrap})),n.d(e,"negate",(function(){return r.negate})),n.d(e,"compose",(function(){return r.compose})),n.d(e,"after",(function(){return r.after})),n.d(e,"before",(function(){return r.before})),n.d(e,"once",(function(){return r.once})),n.d(e,"keys",(function(){return r.keys})),n.d(e,"allKeys",(function(){return r.allKeys})),n.d(e,"values",(function(){return r.values})),n.d(e,"mapObject",(function(){return r.mapObject})),n.d(e,"pairs",(function(){return r.pairs})),n.d(e,"invert",(function(){return r.invert})),n.d(e,"functions",(function(){return r.functions})),n.d(e,"methods",(function(){return r.methods})),n.d(e,"extend",(function(){return r.extend})),n.d(e,"extendOwn",(function(){return r.extendOwn})),n.d(e,"assign",(function(){return r.assign})),n.d(e,"findKey",(function(){return r.findKey})),n.d(e,"pick",(function(){return r.pick})),n.d(e,"omit",(function(){return r.omit})),n.d(e,"defaults",(function(){return r.defaults})),n.d(e,"create",(function(){return r.create})),n.d(e,"clone",(function(){return r.clone})),n.d(e,"tap",(function(){return r.tap})),n.d(e,"isMatch",(function(){return r.isMatch})),n.d(e,"isEqual",(function(){return r.isEqual})),n.d(e,"isEmpty",(function(){return r.isEmpty})),n.d(e,"isElement",(function(){return r.isElement})),n.d(e,"isArray",(function(){return r.isArray})),n.d(e,"isObject",(function(){return r.isObject})),n.d(e,"isArguments",(function(){return r.isArguments})),n.d(e,"isFunction",(function(){return r.isFunction})),n.d(e,"isString",(function(){return r.isString})),n.d(e,"isNumber",(function(){return r.isNumber})),n.d(e,"isDate",(function(){return r.isDate})),n.d(e,"isRegExp",(function(){return r.isRegExp})),n.d(e,"isError",(function(){return r.isError})),n.d(e,"isSymbol",(function(){return r.isSymbol})),n.d(e,"isMap",(function(){return r.isMap})),n.d(e,"isWeakMap",(function(){return r.isWeakMap})),n.d(e,"isSet",(function(){return r.isSet})),n.d(e,"isWeakSet",(function(){return r.isWeakSet})),n.d(e,"isFinite",(function(){return r.isFinite})),n.d(e,"isNaN",(function(){return r.isNaN})),n.d(e,"isBoolean",(function(){return r.isBoolean})),n.d(e,"isNull",(function(){return r.isNull})),n.d(e,"isUndefined",(function(){return r.isUndefined})),n.d(e,"has",(function(){return r.has})),n.d(e,"identity",(function(){return r.identity})),n.d(e,"constant",(function(){return r.constant})),n.d(e,"noop",(function(){return r.noop})),n.d(e,"property",(function(){return r.property})),n.d(e,"propertyOf",(function(){return r.propertyOf})),n.d(e,"matcher",(function(){return r.matcher})),n.d(e,"matches",(function(){return r.matches})),n.d(e,"times",(function(){return r.times})),n.d(e,"random",(function(){return r.random})),n.d(e,"now",(function(){return r.now})),n.d(e,"escape",(function(){return r.escape})),n.d(e,"unescape",(function(){return r.unescape})),n.d(e,"result",(function(){return r.result})),n.d(e,"uniqueId",(function(){return r.uniqueId})),n.d(e,"templateSettings",(function(){return r.templateSettings})),n.d(e,"template",(function(){return r.template})),n.d(e,"chain",(function(){return r.chain})),n.d(e,"mixin",(function(){return r.mixin}));var r=n(18),i=Object(r.mixin)(r);i._=i;var o=i},function(t,e,n){(function(r){var i,o,a;a="object"==typeof self&&self.self===self&&self||"object"==typeof r&&r.global===r&&r,i=[n(0),n(10),e],void 0===(o=function(t,e,n){a.Backbone=function(t,e,n,r){var i=t.Backbone,o=Array.prototype.slice;e.VERSION="1.3.3",e.$=r,e.noConflict=function(){return t.Backbone=i,this},e.emulateHTTP=!1,e.emulateJSON=!1;var a=function(t,e,r){n.each(e,(function(e,i){n[i]&&(t.prototype[i]=function(t,e,r){switch(t){case 1:return function(){return n[e](this[r])};case 2:return function(t){return n[e](this[r],t)};case 3:return function(t,i){return n[e](this[r],s(t,this),i)};case 4:return function(t,i,o){return n[e](this[r],s(t,this),i,o)};default:return function(){var t=o.call(arguments);return t.unshift(this[r]),n[e].apply(n,t)}}}(e,i,r))}))},s=function(t,e){return n.isFunction(t)?t:n.isObject(t)&&!e._isModel(t)?l(t):n.isString(t)?function(e){return e.get(t)}:t},l=function(t){var e=n.matches(t);return function(t){return e(t.attributes)}},c=e.Events={},u=/\s+/,d=function(t,e,r,i,o){var a,s=0;if(r&&"object"==typeof r){void 0!==i&&"context"in o&&void 0===o.context&&(o.context=i);for(a=n.keys(r);sthis.length&&(i=this.length),i<0&&(i+=this.length+1);var o,a,s=[],l=[],c=[],u=[],d={},h=e.add,f=e.merge,p=e.remove,g=!1,v=this.comparator&&null==i&&!1!==e.sort,m=n.isString(this.comparator)?this.comparator:null;for(a=0;a7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(N,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var r=document.body,i=r.insertBefore(this.iframe,r.firstChild).contentWindow;i.document.open(),i.document.close(),i.location.hash="#"+this.fragment}var o=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};this._usePushState?t("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&t("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),A.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e===this.fragment)return!1;this.iframe&&this.navigate(e),this.loadUrl()},loadUrl:function(t){return!!this.matchRoot()&&(t=this.fragment=this.getFragment(t),n.some(this.handlers,(function(e){if(e.route.test(t))return e.callback(t),!0})))},navigate:function(t,e){if(!A.started)return!1;e&&!0!==e||(e={trigger:!!e}),t=this.getFragment(t||"");var n=this.root;""!==t&&"?"!==t.charAt(0)||(n=n.slice(0,-1)||"/");var r=n+t;if(t=this.decodeFragment(t.replace(I,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var i=this.iframe.contentWindow;e.replace||(i.document.open(),i.document.close()),this._updateHash(i.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else t.hash="#"+e}}),e.history=new A,b.extend=y.extend=T.extend=C.extend=A.extend=function(t,e){var r,i=this;return r=t&&n.has(t,"constructor")?t.constructor:function(){return i.apply(this,arguments)},n.extend(r,i,e),r.prototype=n.create(i.prototype,t),r.prototype.constructor=r,r.__super__=i.prototype,r};var _=function(){throw new Error('A "url" property or function must be specified')},F=function(t,e){var n=e.error;e.error=function(r){n&&n.call(e.context,t,r,e),t.trigger("error",t,r,e)}};return e}(a,n,t,e)}.apply(e,i))||(t.exports=o)}).call(this,n(26))},function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},function(t,e,n){"use strict";n.d(e,"p",(function(){return x})),n.d(e,"u",(function(){return h})),n.d(e,"t",(function(){return f})),n.d(e,"k",(function(){return b})),n.d(e,"r",(function(){return c})),n.d(e,"g",(function(){return O})),n.d(e,"d",(function(){return C})),n.d(e,"b",(function(){return v})),n.d(e,"q",(function(){return w})),n.d(e,"f",(function(){return j})),n.d(e,"m",(function(){return T})),n.d(e,"e",(function(){return y})),n.d(e,"w",(function(){return d})),n.d(e,"s",(function(){return m})),n.d(e,"h",(function(){return S})),n.d(e,"i",(function(){return p})),n.d(e,"c",(function(){return E})),n.d(e,"j",(function(){return A})),n.d(e,"v",(function(){return L})),n.d(e,"a",(function(){return u})),n.d(e,"n",(function(){return P})),n.d(e,"l",(function(){return M})),n.d(e,"o",(function(){return D}));var r=n(8),i=n.n(r),o=n(7),a=n.n(o),s=n(0),l=window.Element.prototype,c=l.matches||l.webkitMatchesSelector||l.mozMatchesSelector||l.msMatchesSelector,u=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Object(s.isArray)(e)?a()(e):[e];if(r.length){var i=r.shift();if(i&&(!n.unique||!document.querySelector('link[href="'.concat(i,'"]')))){var o=document,l=o.head,c=document.createElement("link");c.href=i,c.rel="stylesheet",n.prepand?l.insertBefore(c,l.firstChild):l.appendChild(c)}t(r)}},d=function(t,e){var n={},r=Object(s.keys)(e);for(var i in t)if(t.hasOwnProperty(i)){var o=t[i],a=e[i];r.indexOf(i)>=0?o!==a&&(n[i]=a):n[i]=null}for(var l in e)e.hasOwnProperty(l)&&Object(s.isUndefined)(t[l])&&(n[l]=e[l]);return n},h=function(t,e,n){e=e.split(/\s+/),t=t instanceof Array?t:[t];for(var r=function(r){t.forEach((function(t){return t.addEventListener(e[r],n)}))},i=0;i1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0;if(isNaN(t))return n;if(t=parseFloat(t),Math.floor(t)!==t){var i=e.toString().split(".")[1];r=i?i.length:0}return r?parseFloat(t.toFixed(r)):t},b=function(t){return"draggable"in document.createElement("i")&&(t?t.get("Config").nativeDnD:1)},y=function(t){return Object(s.isElement)(t)||w(t)?t:t&&t.getEl?t.getEl():void 0},w=function(t){return t&&3===t.nodeType},x=function(t){return t&&!w(t)&&!function(t){return t&&8===t.nodeType}(t)},O=function(t,e){var n=t;return Object(s.isElement)(t)&&(n=e(t).data("model")),n},C=function(t){var e,n={top:0,left:0,width:0,height:0};if(!t)return n;if(w(t)){var r=document.createRange();r.selectNode(t),e=r.getBoundingClientRect(),r.detach()}return e||(t.getBoundingClientRect?t.getBoundingClientRect():n)},S=function(t){return t.touches&&t.touches[0]?t.touches[0]:t},k=function(t){return t.which||t.keyCode},j=function(t){return String.fromCharCode(k(t))},T=function(t){return 27===k(t)},P=function(t){return null!==t&&!Array.isArray(t)&&"object"===i()(t)},E=function(t){return t&&t.charAt(0).toUpperCase()+t.substring(1)},M=function(t){return t&&t.toHTML},D=function(t){return t&&t.toCSS},A=function(t){return t.__gjsv},L=function(t,e){t.__gjsv=e}},function(t,e,n){"use strict";n.r(e),n.d(e,"eventDrag",(function(){return O}));var r=n(8),i=n.n(r),o=n(2),a=n.n(o),s=n(0),l=n(3),c=n(23),u=n(1),d=n.n(u),h=n(21),f=n(9),p=n(11);function g(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function v(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},n=this.target,r=this.get("name");if(!Object(s.isUndefined)(t)){var i=t;if("false"===t?i=!1:"true"===t&&(i=!0),this.get("changeProp"))n.set(r,i,e);else{var o=v({},n.get("attributes"));o[r]=i,n.set("attributes",o,e)}}},setValueFromInput:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={value:t};this.set(r,v({},n,{avoidStore:1})),e&&(this.set("value","",n),this.set(r,n))},getInitValue:function(){var t,e=this.target,n=this.get("name");if(e){var r=e.get("attributes");t=this.get("changeProp")?e.get(n):r[n]}return t||this.get("value")||this.get("default")}}),b=d.a.Collection.extend({model:m,initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.em=e.em||"",this.listenTo(this,"add",this.handleAdd),this.listenTo(this,"reset",this.handleReset)},handleReset:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.previousModels,r=void 0===n?[]:n;r.forEach((function(t){return t.trigger("remove")}))},handleAdd:function(t){var e=this.target;e&&(t.target=e)},setTarget:function(t){this.target=t},add:function(t,e){var n=this.em;if(Object(s.isString)(t)||Object(s.isArray)(t)){var r=n&&n.get&&n.get("TraitManager"),i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{build:function(e){var n=[];"string"==typeof e&&(e=[e]);for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.em,i=this.parent(),o=i&&i.attributes;if(o&&o.propagate){var a={},l=o.propagate;l.forEach((function(t){return a[t]=i.get(t)})),a.propagate=l,a=w({},a,{},e),this.set(a)}var c=this.get("propagate");c&&this.set("propagate",Object(s.isArray)(c)?c:[c]),n&&n.config&&n.config.voidElements.indexOf(this.get("tagName"))>=0&&this.set("void",!0),n.em=r,this.opt=n,this.em=r,this.frame=n.frame,this.config=n.config||{},this.set("attributes",w({},this.defaults.attributes||{},{},this.get("attributes")||{})),this.ccid=C.createId(this),this.initClasses(),this.initTraits(),this.initComponents(),this.initToolbar(),this.listenTo(this,"change:script",this.scriptUpdated),this.listenTo(this,"change:tagName",this.tagUpdated),this.listenTo(this,"change:attributes",this.attrUpdated),this.listenTo(this,"change:attributes:id",this._idUpdated),this.set("status",""),this.views=[],["classes","traits","components"].forEach((function(e){var n="add remove ".concat("components"!==e?"change":"");t.listenTo(t.get(e),n.trim(),(function(){for(var n=arguments.length,r=new Array(n),i=0;i2&&void 0!==arguments[2]?arguments[2]:{},i=this.get("attributes"),o=i.class;o&&this.setClass(o),delete i.class;var a=i.style;a&&this.setStyle(a),delete i.style;var c=w({},this.previous("attributes")),u=Object(l.w)(c,this.get("attributes"));Object(s.keys)(u).forEach((function(t){return n.trigger("change:attributes:".concat(t),n,u[t],r)}))},setAttributes:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.set("attributes",w({},t),e),this},addAttributes:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=w({},this.getAttributes(),{},t);return this.setAttributes(n,e),this},getStyle:function(){var t=this.em;if(t&&t.getConfig("avoidInlineStyle")){var e=t.get("state"),n=t.get("CssComposer").getIdRule(this.getId(),{state:e});if(this.rule=n,n)return n.getStyle()}return c.a.getStyle.call(this)},setStyle:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.em,i=this.opt;if(r&&r.getConfig("avoidInlineStyle")&&!i.temporary){var o=this.get("style")||{};e=w({},e=Object(s.isString)(e)?this.parseStyle(e):e,{},o);var a=r.get("state"),u=r.get("CssComposer"),d=this.getStyle();this.rule=u.setIdRule(this.getId(),e,w({},n,{state:a}));var h=Object(l.w)(d,e);this.set("style",{},{silent:1}),Object(s.keys)(h).forEach((function(e){return t.trigger("change:style:".concat(e))}))}else e=c.a.setStyle.apply(this,arguments);return e},getAttributes:function(){var t,e=this.em,n=[],r=w({},this.get("attributes")),i=e&&e.get("SelectorManager"),o=this.getId();(this.get("classes").forEach((function(t){return n.push(Object(s.isString)(t)?t:t.get("name"))})),n.length&&(r.class=n.join(" ")),Object(s.has)(r,"id"))||(!function(t){return t&&t.getConfig("avoidInlineStyle")}(e)?Object(s.isEmpty)(this.getStyle())||(t=1):t=i&&i.get(o,i.Selector.TYPE_ID),t&&(r.id=this.getId()));return r},addClass:function(t){var e=this.em.get("SelectorManager").addClass(t);return this.get("classes").add(e)},setClass:function(t){return this.get("classes").reset(),this.addClass(t)},removeClass:function(t){var e=[];t=Object(s.isArray)(t)?t:[t];var n=this.get("classes"),r=f.a.TYPE_CLASS;return t.forEach((function(t){t.split(" ").forEach((function(t){var i=n.where({name:t,type:r})[0];i&&e.push(n.remove(i))}))})),e},getClasses:function(){var t=this.getAttributes().class;return t?t.split(" "):[]},initClasses:function(){var t=this.get("attributes").class||[],e=[this,"change:classes",this.initClasses],n=this.get("classes")||t,r=Object(s.isString)(n)?n.split(" "):n;this.stopListening.apply(this,e);var i=this.normalizeClasses(r),o=new p.a([]);return this.set("classes",o),o.add(i),this.listenTo.apply(this,e),this},initComponents:function(){var t=[this,"change:components",this.initComponents];this.stopListening.apply(this,t);var e=new h.a(null,this.opt);e.parent=this;var n=this.get("components"),r=!this.opt.avoidChildren;return this.set("components",e),r&&e.add(Object(s.isFunction)(n)?n(this):n),this.listenTo.apply(this,t),this},initTraits:function(t){var e=this.em,n=[this,"change:traits",this.initTraits];this.stopListening.apply(this,n),this.loadTraits();var r=w({},this.get("attributes")),i=this.get("traits");return i.each((function(t){if(!t.get("changeProp")){var e=t.get("name"),n=t.getInitValue();e&&n&&(r[e]=n)}})),i.length&&this.set("attributes",r),this.listenTo.apply(this,n),t&&e&&e.trigger("component:toggled"),this},append:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.components().add(t,e);return Object(s.isArray)(n)?n:[n]},components:function(t){var e=this.get("components");return Object(s.isUndefined)(t)?e:(e.reset(),t&&this.append(t))},empty:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.components().reset(null,t),this},parent:function(){var t=this.collection;return t&&t.parent},scriptUpdated:function(){this.set("scriptUpdated",1)},initToolbar:function(){var t=this.em,e=t&&t.getConfig("stylePrefix")||"";if(!this.get("toolbar")){var n=[];this.collection&&n.push({attributes:{class:"fa fa-arrow-up"},command:function(t){return t.runCommand("core:component-exit",{force:1})}}),this.get("draggable")&&n.push({attributes:{class:"fa fa-arrows ".concat(e,"no-touch-actions"),draggable:!0},command:"tlb-move"}),this.get("copyable")&&n.push({attributes:{class:"fa fa-clone"},command:"tlb-clone"}),this.get("removable")&&n.push({attributes:{class:"fa fa-trash-o"},command:"tlb-delete"}),this.set("toolbar",n)}},loadTraits:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t=t||this.get("traits"),!((t=Object(s.isFunction)(t)?t(this):t)instanceof b)){var n=new b([],this.opt);n.setTarget(this),t.length&&(t.forEach((function(t){return t.attributes&&delete t.attributes.value})),n.add(t)),this.set("traits",n,e)}return this},getTrait:function(t){return this.get("traits").filter((function(e){return e.get("id")===t||e.get("name")===t}))[0]},updateTrait:function(t,e){var n=this.em,r=this.getTrait(t);return r&&r.set(e),n&&n.trigger("component:toggled"),this},getTraitIndex:function(t){var e=this.getTrait(t);return e?this.get("traits").indexOf(e):e},removeTrait:function(t){var e=this,n=this.em,r=(Object(s.isArray)(t)?t:[t]).map((function(t){return e.getTrait(t)})),i=this.get("traits").remove(r);return n&&n.trigger("component:toggled"),i},addTrait:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.em,r=this.get("traits").add(t,e);return n&&n.trigger("component:toggled"),r},normalizeClasses:function(t){var e=[],n=this.em;if(n){var r=n.get("SelectorManager");if(r)return t.forEach((function(t){var n="";n="string"==typeof t?t:t.name;var i=r.add(n);e.push(i)})),e}},clone:function(){var t=this.em,e=this.getStyle(),n=w({},this.attributes),r=w({},this.opt);n.attributes=w({},n.attributes),delete n.attributes.id,n.components=[],n.classes=[],n.traits=[],this.get("components").each((function(t,e){n.components[e]=t.clone()})),this.get("traits").each((function(t,e){n.traits[e]=t.clone()})),this.get("classes").each((function(t,e){n.classes[e]=t.get("name")})),n.status="",n.view="",r.collection=null,t&&t.getConfig("avoidInlineStyle")&&!Object(s.isEmpty)(e)&&(n.style=e);var i=new this.constructor(n,r);return t&&t.trigger("component:clone",i),this.trigger("component:clone",i),i},getName:function(){var t=this.em,e=this.attributes,n=e.type,r=e.tagName,i=this.get("name"),o="div"==r,a=n||(o?"box":r),s=!n&&r&&!o&&r,c="domComponents.names.",u=i&&t&&t.t("".concat(c).concat(i)),d=s&&t&&t.t("".concat(c).concat(s)),h=t&&(t.t("".concat(c).concat(n))||t.t("".concat(c).concat(r)));return this.get("custom-name")||u||i||d||Object(l.c)(s)||h||Object(l.c)(a)},getIcon:function(){var t=this.get("icon");return t?t+" ":""},toHTML:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this,n=[],r=t.tag,i=r||e.get("tagName"),o=e.get("void"),a=t.attributes,l=this.getAttrToHTML();for(var c in delete t.tag,a&&(Object(s.isFunction)(a)?l=a(e,l)||{}:Object(s.isObject)(a)&&(l=a)),l){var u=l[c],d=Object(s.isString)(u)?u.replace(/"/g,"""):u;Object(s.isUndefined)(d)||(Object(s.isBoolean)(d)?d&&n.push(c):n.push("".concat(c,'="').concat(d,'"')))}var h=n.length?" ".concat(n.join(" ")):"",f="<".concat(i).concat(h).concat(o?"/":"",">").concat(e.get("content"));return e.get("components").each((function(e){return f+=e.toHTML(t)})),!o&&(f+="".concat(i,">")),f},getAttrToHTML:function(){var t=this.getAttributes();return delete t.style,t},toJSON:function(){for(var t=arguments.length,e=new Array(t),n=0;n1?r-1:0),o=1;o0&&void 0!==arguments[0]&&arguments[0];var t=this.em,e=this.getId();if(e){var n=C.createId(this);this.setId(n);var r=t&&t.get("CssComposer").getIdRule(e),i=r&&r.get("selectors").at(0);return i&&i.set("name",n),this}},_getStyleRule:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.id,n=this.em,r=e||this.getId();return n&&n.get("CssComposer").getIdRule(r)},_getStyleSelector:function(t){var e=this._getStyleRule(t);return e&&e.get("selectors").at(0)},_idUpdated:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.idUpdate){var r=this.ccid,i=this.get("attributes")||{},o=i.id,a=(this.previous("attributes")||{}).id||r,s=C.getList(this);if(s[o])return this.setId(a,{idUpdate:1});delete s[a],s[o]=this,this.ccid=o;var l=this._getStyleSelector({id:a});l&&l.set({name:o,label:o})}}},{isComponent:function(t){return{tagName:t.tagName?t.tagName.toLowerCase():""}},ensureInList:function(t){var e=C.getList(t),n=t.getId(),r=e[n];if(r){if(r!==t){var i=C.getIncrementId(n,e);t.setId(i),e[i]=t}}else e[n]=t;t.components().forEach((function(t){return C.ensureInList(t)}))},createId:function(t){var e,n=C.getList(t),r=t.get("attributes").id;return r?(e=C.getIncrementId(r,n),t.setId(e)):e=C.getNewId(n),n[e]=t,e},getNewId:function(t){for(var e=Object.keys(t).length.toString().length+2,n=(Math.random()+1.1).toString(36).slice(-e),r="i".concat(n);t[r];)r=C.getNewId(t);return r},getIncrementId:function(t,e){for(var n=1,r=t;e[r];)n++,r="".concat(t,"-").concat(n);return r},getList:function(t){var e=t.opt&&t.opt.domc;return e?e.componentsById:{}},checkId:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Object(s.isArray)(t)?t:[t];r.forEach((function(t){var r=t.attributes,i=void 0===r?{}:r,o=t.components,a=i.id;if(a&&n[a]){var l=C.getIncrementId(a,n);i.id=l,Object(s.isArray)(e)&&e.forEach((function(t){var e=t.selectors;e.forEach((function(t,n){t==="#".concat(a)&&(e[n]="#".concat(l))}))}))}o&&C.checkId(o,e,n)}))}});e.default=C},function(t,e,n){"use strict";n.r(e);var r=n(2),i=n.n(r),o=n(1),a=n.n(o),s=n(0),l=n(21),c=n(35),u=n(11),d=n(6),h=n(3);function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function p(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},e=this.model,n=t.config||{},r=n.em,i=e.opt||{},o=this.$el,a=this.el,s=n.draggableComponents;this.opts=t,this.modelOpt=i,this.config=n,this.em=r||"",this.pfx=n.stylePrefix||"",this.ppfx=n.pStylePrefix||"",this.attr=e.get("attributes"),this.classe=this.attr.class||[],this.listenTo(e,"change:style",this.updateStyle),this.listenTo(e,"change:attributes change:_innertext",this.renderAttributes),this.listenTo(e,"change:highlightable",this.updateHighlight),this.listenTo(e,"change:status",this.updateStatus),this.listenTo(e,"change:script",this.reset),this.listenTo(e,"change:content",this.updateContent),this.listenTo(e,"change",this.handleChange),this.listenTo(e,"active",this.onActive),this.listenTo(e,"disable",this.onDisable),o.data("model",e),Object(h.v)(a,this),e.view=this,this._getFrame()&&e.views.push(this),this.initClasses(),this.initComponents({avoidRender:1}),this.events=p({},this.events,{},s&&{dragstart:"handleDragStart"}),this.delegateEvents(),!i.temporary&&this.init(this._clbObj())},_clbObj:function(){var t=this.em,e=this.model,n=this.el;return{editor:t&&t.getEditor(),model:e,el:n}},init:function(){},removed:function(){},onActive:function(){},onDisable:function(){},remove:function(){var t=this;a.a.View.prototype.remove.apply(t,arguments);var e=t.model,n=t._getFrame()||{},r=n.model;e.components().forEach((function(t){var e=t.getView(r);e&&e.remove()}));var i=e.views;return i.splice(i.indexOf(t),1),t.removed(t._clbObj()),t.$el.data({model:"",collection:"",view:""}),delete t.model,delete t.$el,delete t.el.__gjsv,delete t.childrenView,delete t.scriptContainer,delete t.opts,t},handleDragStart:function(t){t.preventDefault(),t.stopPropagation(),this.em.get("Commands").run("tlb-move",{target:this.model,event:t})},initClasses:function(){var t=this.model,e=t.get("classes");e instanceof u.a&&(this.stopListening(t,"change:classes",this.initClasses),this.listenTo(t,"change:classes",this.initClasses),this.listenTo(e,"add remove change",this.updateClasses),e.length&&this.importClasses())},initComponents:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.model,n=this.$el,r=this.childrenView,i="change:components",o=e.get("components"),a=[e,i,this.initComponents];o instanceof l.a&&(n.data("collection",o),r&&r.remove(),this.stopListening.apply(this,a),!t.avoidRender&&this.renderChildren(),this.listenTo.apply(this,a))},handleChange:function(){var t=this.model,e=Object(s.keys)(t.changed);if(1!==e.length||"status"!==e[0])for(var n in t.emitUpdate(),t.changed)t.emitUpdate(n)},importClasses:function(){var t=this.config.em.get("SelectorManager");t&&this.model.get("classes").each((function(e){t.add(e.get("name"))}))},updateStatus:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(this.em,this.el),n=this.model.get("status"),r=(this.pfx,this.ppfx),i="".concat(r,"selected"),o="".concat(i,"-parent"),a="".concat(r,"freezed"),s="".concat(r,"hovered"),l=[i,o,a,s];this.$el.removeClass(l.join(" "));var c=e.getAttribute("class")||"",u="";switch(n){case"selected":u="".concat(c," ").concat(i);break;case"selected-parent":u="".concat(c," ").concat(o);break;case"freezed":u="".concat(c," ").concat(a);break;case"freezed-selected":u="".concat(c," ").concat(a," ").concat(i);break;case"hovered":u=t.avoidHover?"":"".concat(c," ").concat(s)}(u=u.trim())&&e.setAttribute("class",u)},updateHighlight:function(){var t=this.model.get("highlightable");this.setAttribute("data-highlightable",t?1:"")},updateStyle:function(){var t=this.model,e=this.em,n=this.el;if(e&&e.getConfig("avoidInlineStyle")){t.get("_innertext")?n.removeAttribute("id"):n.id=t.getId();var r=t.getStyle();!Object(s.isEmpty)(r)&&t.setStyle(r)}else this.setAttribute("style",t.styleToString())},updateClasses:function(){var t=this.model.get("classes").pluck("name").join(" ");this.setAttribute("class",t),this.updateStatus()},setAttribute:function(t,e){var n=this.$el;e?n.attr(t,e):n.removeAttr(t)},getClasses:function(){return this.model.getClasses().join(" ")},updateAttributes:function(){var t=[],e=this.model,n=this.$el,r=this.el,i=this.config,o=e.attributes,a=o.highlightable,l=o.textable,c=o.type,u=o._innertext,d=p({"data-gjs-type":c||"default"},i.draggableComponents&&!u?{draggable:!0}:{},{},a?{"data-highlightable":1}:{},{},l?{contenteditable:"false","data-gjs-textable":"true"}:{});Object(s.each)(r.attributes,(function(e){return t.push(e.nodeName)})),t.forEach((function(t){return n.removeAttr(t)}));var h=p({},d,{},e.getAttributes());Object(s.keys)(h).forEach((function(t){return!1===h[t]&&delete h[t]})),n.attr(h),this.updateStyle()},updateContent:function(){this.getChildrenContainer().innerHTML=this.model.get("content")},prevDef:function(t){t.preventDefault()},updateScript:function(){var t=this.model,e=this.em;t.get("script")&&e&&e.get("Canvas").getCanvasView().updateScript(this)},getChildrenContainer:function(){var t=this.el;return"function"==typeof this.getChildrenSelector?t=this.el.querySelector(this.getChildrenSelector()):this.getTemplate,t},getOffsetRect:function(){var t={},e=this.el,n=0,r=0;return function i(o){var a=o.offsetParent;a?(n+=a.offsetTop,r+=a.offsetLeft,i(a)):(t.top=e.offsetTop+n,t.left=e.offsetLeft+r,t.bottom=t.top+e.offsetHeight,t.right=t.left+e.offsetWidth)}(e),t},isInViewport:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.rect,n=this.el,r=n.ownerDocument,i=r.body,o=r.defaultView.frameElement,a=e||this.getOffsetRect(),s=a.top,l=a.left,c=this._getFrame().getOffsetRect();return s>=c.scrollTop&&l>=c.scrollLeft&&s<=c.scrollBottom&&l<=o.offsetWidth+i.scrollLeft},scrollIntoView:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.getOffsetRect(),n=this.isInViewport({rect:e});if(!n||t.force){var r=this.el;"smooth"!==t.behavior?r.ownerDocument.defaultView.scrollTo(0,e.top):r.scrollIntoView(p({behavior:"smooth",block:"nearest"},t))}},reset:function(){var t=this.el;this.el="",this._ensureElement(),this._setData(),Object(d.j)(t,this.el),this.render()},_setData:function(){var t=this.model,e=t.components();this.$el.data({model:t,collection:e,view:this})},_getFrame:function(){return this.config.frameView},renderChildren:function(){this.updateContent();var t=this.getChildrenContainer(),e=this.childrenView||new c.a({collection:this.model.get("components"),config:this.config,componentTypes:this.opts.componentTypes});e.render(t),this.childrenView=e;for(var n=Array.prototype.slice.call(e.el.childNodes),r=0,i=n.length;r=o?t.appendChild(e):t.insertBefore(e,i[a])},u=function(t,e){return c(t,e)},d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=document.createElement(t);return e&&Object(r.each)(e,(function(t,e){return i.setAttribute(e,t)})),n&&(Object(r.isString)(n)?i.innerHTML=n:i.appendChild(n)),i},h=function(t,e){var n;try{n=new window[e](t.type,t)}catch(t){(n=document.createEvent(e)).initEvent(t.type,!0,!0)}return n.keyCodeVal=t.keyCode,n._parentEvent=t,["keyCode","which"].forEach((function(t){Object.defineProperty(n,t,{get:function(){return this.keyCodeVal}})})),n},f=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=Array.isArray(e)?e:[e];n.forEach((function(e){var n=e.tag||"div",i=e.attributes||{},o=document.createElement(n);Object(r.each)(i,(function(t,e){o.setAttribute(e,t)})),t.appendChild(o)}))}},function(t,e,n){var r=n(73),i=n(74),o=n(43),a=n(75);t.exports=function(t){return r(t)||i(t)||o(t)||a()}},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},function(t,e,n){"use strict";var r=n(1),i=n.n(r).a.Model.extend({idAttribute:"name",defaults:{name:"",label:"",type:1,active:!0,private:!1,protected:!1},initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.config,r=void 0===n?{}:n,o=this.get("name"),a=this.get("label");o?a||this.set("label",o):this.set("name",a);var s=this.get("name"),l=r.escapeName,c=l?l(s):i.escapeName(s);this.set("name",c)},getFullName:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.escape,n=this.get("name"),r="";switch(this.get("type")){case 1:r=".";break;case 2:r="#"}return r+(e?e(n):n)}},{TYPE_CLASS:1,TYPE_ID:2,escapeName:function(t){return"".concat(t).trim().replace(/([^a-z0-9\w-\:]+)/gi,"-")}});e.a=i},function(t,e,n){"use strict";n.r(e);var r=document,i=window,o=Array.prototype,a=o.filter,s=o.indexOf,l=o.map,c=o.push,u=o.reverse,d=o.slice,h=o.splice,f=/^#[\w-]*$/,p=/^\.[\w-]*$/,g=/<.+>/,v=/^\w+$/;function m(t,e){return void 0===e&&(e=r),p.test(t)?e.getElementsByClassName(t.slice(1)):v.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t)}function b(t,e){if(void 0===e&&(e=r),t){if(t.__cash)return t;var n=t;if(P(t)){if(e.__cash&&(e=e[0]),!(n=f.test(t)?e.getElementById(t.slice(1)):g.test(t)?ct(t):m(t,e)))return}else if(T(t))return this.ready(t);(n.nodeType||n===i)&&(n=[n]),this.length=n.length;for(var o=0,a=this.length;o=0})):n.value=i}))},w.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},w.detach=function(){return this.each((function(t,e){e.parentNode&&e.parentNode.removeChild(e)}))};var at,st=/^\s*<(\w+)[^>]*>/,lt=/^\s*<(\w+)\s*\/?>(?:<\/\1>)?\s*$/;function ct(t){if(function(){if(!at){var t=r.createElement("table"),e=r.createElement("tr");at={"*":r.createElement("div"),tr:r.createElement("tbody"),td:e,th:e,thead:t,tbody:t,tfoot:t}}}(),!P(t))return[];if(lt.test(t))return[r.createElement(RegExp.$1)];var e=st.test(t)&&RegExp.$1,n=at[e]||at["*"];return n.innerHTML=t,y(n.childNodes).detach().get()}function ut(t,e,n){if(void 0!==e){var r=P(e);!r&&e.length?S(e,(function(e){return ut(t,e,n)})):S(t,r?function(t){t.insertAdjacentHTML(n?"afterbegin":"beforeend",e)}:function(t,r){return function(t,e,n){n?t.insertBefore(e,t.childNodes[0]):t.appendChild(e)}(t,r?e.cloneNode(!0):e,n)})}}y.parseHTML=ct,w.empty=function(){var t=this[0];if(t)for(;t.firstChild;)t.removeChild(t.firstChild);return this},w.append=function(){var t=this;return S(arguments,(function(e){ut(t,e)})),this},w.appendTo=function(t){return ut(y(t),this),this},w.html=function(t){if(void 0===t)return this[0]&&this[0].innerHTML;var e=t.nodeType?t[0].outerHTML:t;return this.each((function(t,n){n.innerHTML=e}))},w.insertAfter=function(t){var e=this;return y(t).each((function(t,n){var r=n.parentNode;e.each((function(e,i){r.insertBefore(t?i.cloneNode(!0):i,n.nextSibling)}))})),this},w.after=function(){var t=this;return S(u.apply(arguments),(function(e){u.apply(y(e).slice()).insertAfter(t)})),this},w.insertBefore=function(t){var e=this;return y(t).each((function(t,n){var r=n.parentNode;e.each((function(e,i){r.insertBefore(t?i.cloneNode(!0):i,n)}))})),this},w.before=function(){var t=this;return S(arguments,(function(e){y(e).insertBefore(t)})),this},w.prepend=function(){var t=this;return S(arguments,(function(e){ut(t,e,!0)})),this},w.prependTo=function(t){return ut(y(t),u.apply(this.slice()),!0),this},w.remove=function(){return this.detach().off()},w.replaceWith=function(t){var e=this;return this.each((function(n,r){var i=r.parentNode;if(i){var o=n?y(t).clone():y(t);if(!o[0])return e.remove(),!1;i.replaceChild(o[0],r),y(o[0]).after(o.slice(1))}}))},w.replaceAll=function(t){return y(t).replaceWith(this),this},w.text=function(t){return void 0===t?this[0]?this[0].textContent:"":this.each((function(e,n){n.textContent=t}))};var dt=r.documentElement;w.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+i.pageYOffset-dt.clientTop,left:e.left+i.pageXOffset-dt.clientLeft}}},w.offsetParent=function(){return y(this[0]&&this[0].offsetParent)},w.position=function(){var t=this[0];if(t)return{left:t.offsetLeft,top:t.offsetTop}},w.children=function(t){var e=[];return this.each((function(t,n){c.apply(e,n.children)})),e=y(N(e)),t?e.filter((function(e,n){return j(n,t)})):e},w.contents=function(){var t=[];return this.each((function(e,n){c.apply(t,"IFRAME"===n.tagName?[n.contentDocument]:n.childNodes)})),y(t.length&&N(t))},w.find=function(t){for(var e=[],n=0,r=this.length;n0&&void 0!==arguments[0]?arguments[0]:{},e=t.noDisabled;return Object(r.filter)(this.models,(function(t){return!t.get("private")})).filter((function(t){return e?t.get("active"):1}))},getFullString:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=t||this;return r.forEach((function(t){return n.push(t.getFullName(e))})),n.join("").trim()}})},function(t,e,n){t.exports=function(){"use strict";var t=navigator.userAgent,e=navigator.platform,n=/gecko\/\d/i.test(t),r=/MSIE \d/.test(t),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),a=r||i||o,s=a&&(r?document.documentMode||6:+(o||i)[1]),l=!o&&/WebKit\//.test(t),c=l&&/Qt\/\d+\.\d+/.test(t),u=!o&&/Chrome\//.test(t),d=/Opera\//.test(t),h=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),p=/PhantomJS/.test(t),g=!o&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t),v=/Android/.test(t),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),b=g||/Mac/.test(e),y=/\bCrOS\b/.test(t),w=/win/i.test(e),x=d&&t.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(d=!1,l=!0);var O=b&&(c||d&&(null==x||x<12.11)),C=n||a&&s>=9;function S(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var k,j=function(t,e){var n=t.className,r=S(e).exec(n);if(r){var i=n.slice(r.index+r[0].length);t.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function T(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function P(t,e){return T(t).appendChild(e)}function E(t,e,n,r){var i=document.createElement(t);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof e)i.appendChild(document.createTextNode(e));else if(e)for(var o=0;o=e)return a+(e-o);a+=s-o,a+=n-a%n,o=s+1}}g?I=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:a&&(I=function(t){try{t.select()}catch(t){}});var R=function(){this.id=null,this.f=null,this.time=0,this.handler=_(this.onTimeout,this)};function z(t,e){for(var n=0;n=e)return r+Math.min(a,e-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=e)return r}}var q=[""];function G(t){for(;q.length<=t;)q.push(K(q)+" ");return q[t]}function K(t){return t[t.length-1]}function Y(t,e){for(var n=[],r=0;r""&&(t.toUpperCase()!=t.toLowerCase()||Z.test(t))}function tt(t,e){return e?!!(e.source.indexOf("\\w")>-1&&Q(t))||e.test(t):Q(t)}function et(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var nt=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function rt(t){return t.charCodeAt(0)>=768&&nt.test(t)}function it(t,e,n){for(;(n<0?e>0:en?-1:1;;){if(e==n)return e;var i=(e+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+r}}var at=null;function st(t,e,n){var r;at=null;for(var i=0;ie)return i;o.to==e&&(o.from!=o.to&&"before"==n?r=i:at=i),o.from==e&&(o.from!=o.to&&"before"!=n?r=i:at=i)}return null!=r?r:at}var lt=function(){var t=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/;function o(t,e,n){this.level=t,this.from=e,this.to=n}return function(a,s){var l="ltr"==s?"L":"R";if(0==a.length||"ltr"==s&&!t.test(a))return!1;for(var c,u=a.length,d=[],h=0;h-1&&(r[e]=i.slice(0,o).concat(i.slice(o+1)))}}}function pt(t,e){var n=ht(t,e);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function bt(t){t.prototype.on=function(t,e){dt(this,t,e)},t.prototype.off=function(t,e){ft(this,t,e)}}function yt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function wt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function xt(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Ot(t){yt(t),wt(t)}function Ct(t){return t.target||t.srcElement}function St(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),b&&t.ctrlKey&&1==e&&(e=3),e}var kt,jt,Tt=function(){if(a&&s<9)return!1;var t=E("div");return"draggable"in t||"dragDrop"in t}();function Pt(t){if(null==kt){var e=E("span","");P(t,E("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(kt=e.offsetWidth<=1&&e.offsetHeight>2&&!(a&&s<8))}var n=kt?E("span",""):E("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Et(t){if(null!=jt)return jt;var e=P(t,document.createTextNode("AخA")),n=k(e,0,1).getBoundingClientRect(),r=k(e,1,2).getBoundingClientRect();return T(t),!(!n||n.left==n.right)&&(jt=r.right-n.right<3)}var Mt,Dt=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],r=t.length;e<=r;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),e+=a+1):(n.push(o),e=i+1)}return n}:function(t){return t.split(/\r\n?|\n/)},At=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Lt="oncopy"in(Mt=E("div"))||(Mt.setAttribute("oncopy","return;"),"function"==typeof Mt.oncopy),Nt=null,It={},_t={};function Ft(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),It[t]=e}function Vt(t){if("string"==typeof t&&_t.hasOwnProperty(t))t=_t[t];else if(t&&"string"==typeof t.name&&_t.hasOwnProperty(t.name)){var e=_t[t.name];"string"==typeof e&&(e={name:e}),(t=J(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Vt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Vt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Rt(t,e){e=Vt(e);var n=It[e.name];if(!n)return Rt(t,"text/plain");var r=n(t,e);if(zt.hasOwnProperty(e.name)){var i=zt[e.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=e.name,e.helperType&&(r.helperType=e.helperType),e.modeProps)for(var a in e.modeProps)r[a]=e.modeProps[a];return r}var zt={};function Ht(t,e){F(e,zt.hasOwnProperty(t)?zt[t]:zt[t]={})}function $t(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var r in e){var i=e[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Wt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Bt(t,e,n){return!t.startState||t.startState(e,n)}var Ut=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function qt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(e=t.first&&en?te(n,qt(t,n).text.length):function(t,e){var n=t.ch;return null==n||n>e?te(t.line,e):n<0?te(t.line,0):t}(e,qt(t,e.line).text.length)}function le(t,e){for(var n=[],r=0;r=this.string.length},Ut.prototype.sol=function(){return this.pos==this.lineStart},Ut.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ut.prototype.next=function(){if(this.pose},Ut.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Ut.prototype.skipToEnd=function(){this.pos=this.string.length},Ut.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},Ut.prototype.backUp=function(t){this.pos-=t},Ut.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==e&&(this.pos+=r[0].length),r)}var i=function(t){return n?t.toLowerCase():t};if(i(this.string.substr(this.pos,t.length))==i(t))return!1!==e&&(this.pos+=t.length),!0},Ut.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ut.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},Ut.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},Ut.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ce=function(t,e){this.state=t,this.lookAhead=e},ue=function(t,e,n,r){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function de(t,e,n,r){var i=[t.state.modeGen],o={};we(t,e.text,t.doc.mode,n,(function(t,e){return i.push(t,e)}),o,r);for(var a=n.state,s=function(r){n.baseTokens=i;var s=t.state.overlays[r],l=1,c=0;n.state=!0,we(t,e.text,s.mode,n,(function(t,e){for(var n=l;ct&&i.splice(l,1,t,i[l+1],r),l+=2,c=Math.min(t,r)}if(e)if(s.opaque)i.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;nt.options.maxHighlightLength&&$t(t.doc.mode,r.state),o=de(t,e,r);i&&(r.state=i),e.stateAfter=r.save(!i),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function fe(t,e,n){var r=t.doc,i=t.display;if(!r.mode.startState)return new ue(r,!0,e);var o=function(t,e,n){for(var r,i,o=t.doc,a=n?-1:e-(t.doc.mode.innerMode?1e3:100),s=e;s>a;--s){if(s<=o.first)return o.first;var l=qt(o,s-1),c=l.stateAfter;if(c&&(!n||s+(c instanceof ce?c.lookAhead:0)<=o.modeFrontier))return s;var u=V(l.text,null,t.options.tabSize);(null==i||r>u)&&(i=s-1,r=u)}return i}(t,e,n),a=o>r.first&&qt(r,o-1).stateAfter,s=a?ue.fromSaved(r,a,o):new ue(r,Bt(r.mode),o);return r.iter(o,e,(function(n){pe(t,n.text,s);var r=s.line;n.stateAfter=r==e-1||r%5==0||r>=i.viewFrom&&re.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}ue.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},ue.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},ue.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ue.fromSaved=function(t,e,n){return e instanceof ce?new ue(t,$t(t.mode,e.state),n,e.lookAhead):new ue(t,$t(t.mode,e),n)},ue.prototype.save=function(t){var e=!1!==t?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ce(e,this.maxLookAhead):e};var me=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n};function be(t,e,n,r){var i,o,a=t.doc,s=a.mode,l=qt(a,(e=se(a,e)).line),c=fe(t,e.line,n),u=new Ut(l.text,t.options.tabSize,c);for(r&&(o=[]);(r||u.post.options.maxHighlightLength?(s=!1,a&&pe(t,e,r,d.pos),d.pos=e.length,l=null):l=ye(ve(n,d,r.state,h),o),h){var f=h[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!s||u!=l){for(;c=e:o.to>e);(r||(r=[])).push(new Ce(a,o.from,s?null:o.to))}}return r}(n,i,a),l=function(t,e,n){var r;if(t)for(var i=0;i=e:o.to>e)||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=e:o.from0&&s)for(var y=0;ye)&&(!n||Ae(n,o.marker)<0)&&(n=o.marker)}return n}function Fe(t,e,n,r,i){var o=qt(t,e),a=Oe&&o.markedSpans;if(a)for(var s=0;s=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ee(c.to,n)>=0:ee(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ee(c.from,r)<=0:ee(c.from,r)<0)))return!0}}}function Ve(t){for(var e;e=Ne(t);)t=e.find(-1,!0).line;return t}function Re(t,e){var n=qt(t,e),r=Ve(n);return n==r?e:Xt(r)}function ze(t,e){if(e>t.lastLine())return e;var n,r=qt(t,e);if(!He(t,r))return e;for(;n=Ie(r);)r=n.find(1,!0).line;return Xt(r)+1}function He(t,e){var n=Oe&&e.markedSpans;if(n)for(var r=void 0,i=0;ie.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)}))}var qe=function(t,e,n){this.text=t,Ee(this,e),this.height=n?n(this):1};function Ge(t){t.parent=null,Pe(t)}qe.prototype.lineNo=function(){return Xt(this)},bt(qe);var Ke={},Ye={};function Xe(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?Ye:Ke;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function Je(t,e){var n=M("span",null,null,l?"padding-right: .1px":null),r={pre:M("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var i=0;i<=(e.rest?e.rest.length:0);i++){var o=i?e.rest[i-1]:e.line,a=void 0;r.pos=0,r.addToken=Qe,Et(t.display.measure)&&(a=ct(o,t.doc.direction))&&(r.addToken=tn(r.addToken,a)),r.map=[],nn(o,r,he(t,o,e!=t.display.externalMeasured&&Xt(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=N(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=N(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Pt(t.display.measure))),0==i?(e.measure.map=r.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(r.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return pt(t,"renderLine",t,e.line,r.pre),r.pre.className&&(r.textClass=N(r.pre.className,r.textClass||"")),r}function Ze(t){var e=E("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function Qe(t,e,n,r,i,o,l){if(e){var c,u=t.splitSpaces?function(t,e){if(t.length>1&&!/ /.test(t))return t;for(var n=e,r="",i=0;ic&&d.from<=c);h++);if(d.to>=u)return t(n,r,i,o,a,s,l);t(n,r.slice(0,d.to-c),i,o,null,s,l),o=null,r=r.slice(d.to-c),c=d.to}}}function en(t,e,n,r){var i=!r&&n.widgetNode;i&&t.map.push(t.pos,t.pos+e,i),!r&&t.cm.display.input.needsContentAttribute&&(i||(i=t.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(t.cm.display.input.setUneditable(i),t.content.appendChild(i)),t.pos+=e,t.trailingSpace=!1}function nn(t,e,n){var r=t.markedSpans,i=t.text,o=0;if(r)for(var a,s,l,c,u,d,h,f=i.length,p=0,g=1,v="",m=0;;){if(m==p){l=c=u=s="",h=null,d=null,m=1/0;for(var b=[],y=void 0,w=0;wp||O.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,c=""),O.className&&(l+=" "+O.className),O.css&&(s=(s?s+";":"")+O.css),O.startStyle&&x.from==p&&(u+=" "+O.startStyle),O.endStyle&&x.to==m&&(y||(y=[])).push(O.endStyle,x.to),O.title&&((h||(h={})).title=O.title),O.attributes)for(var C in O.attributes)(h||(h={}))[C]=O.attributes[C];O.collapsed&&(!d||Ae(d.marker,O)<0)&&(d=x)}else x.from>p&&m>x.from&&(m=x.from)}if(y)for(var S=0;S=f)break;for(var j=Math.min(f,m);;){if(v){var T=p+v.length;if(!d){var P=T>j?v.slice(0,j-p):v;e.addToken(e,P,a?a+l:l,u,p+P.length==m?c:"",s,h)}if(T>=j){v=v.slice(j-p),p=j;break}p=T,u=""}v=i.slice(o,o=n[g++]),a=Xe(n[g++],e.cm.options)}}else for(var E=1;En)return{map:t.measure.maps[i],cache:t.measure.caches[i],before:!0}}function Mn(t,e,n,r){return Ln(t,An(t,e),n,r)}function Dn(t,e){if(e>=t.display.viewFrom&&e=n.lineN&&e2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(t,e.view,e.rect),e.hasHeights=!0),(o=function(t,e,n,r){var i,o=_n(e.map,n,r),l=o.node,c=o.start,u=o.end,d=o.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){for(;c&&rt(e.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u1}(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*r,bottom:e.bottom*r}}(t.display.measure,i))}else{var f;c>0&&(d=r="right"),i=t.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==r?f.length-1:0]:l.getBoundingClientRect()}if(a&&s<9&&!c&&(!i||!i.left&&!i.right)){var p=l.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+ir(t.display),top:p.top,bottom:p.bottom}:In}for(var g=i.top-e.rect.top,v=i.bottom-e.rect.top,m=(g+v)/2,b=e.view.measure.heights,y=0;ye)&&(i=(o=l-s)-1,e>=l&&(a="right")),null!=i){if(r=t[c+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)r=t[2+(c-=3)],a="left";if("right"==n&&i==l-s)for(;c=0&&(n=t[i]).left==n.right;i--);return n}function Vn(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e=r.text.length?(l=r.text.length,c="before"):l<=0&&(l=0,c="after"),!s)return a("before"==c?l-1:l,"before"==c);function u(t,e,n){return a(n?t-1:t,1==s[e].level!=n)}var d=st(s,l,c),h=at,f=u(l,d,"before"==c);return null!=h&&(f.other=u(l,h,"before"!=c)),f}function Kn(t,e){var n=0;e=se(t.doc,e),t.options.lineWrapping||(n=ir(t.display)*e.ch);var r=qt(t.doc,e.line),i=We(r)+Cn(t.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Yn(t,e,n,r,i){var o=te(t,e,n);return o.xRel=i,r&&(o.outside=r),o}function Xn(t,e,n){var r=t.doc;if((n+=t.display.viewOffset)<0)return Yn(r.first,0,null,-1,-1);var i=Jt(r,n),o=r.first+r.size-1;if(i>o)return Yn(r.first+r.size-1,qt(r,o).text.length,null,1,1);e<0&&(e=0);for(var a=qt(r,i);;){var s=tr(t,a,i,e,n),l=_e(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var c=l.find(1);if(c.line==i)return c;a=qt(r,i=c.line)}}function Jn(t,e,n,r){r-=Wn(e);var i=e.text.length,o=ot((function(e){return Ln(t,n,e-1).bottom<=r}),i,0);return{begin:o,end:i=ot((function(e){return Ln(t,n,e).top>r}),o,i)}}function Zn(t,e,n,r){return n||(n=An(t,e)),Jn(t,e,n,Bn(t,e,Ln(t,n,r),"line").top)}function Qn(t,e,n,r){return!(t.bottom<=n)&&(t.top>n||(r?t.left:t.right)>e)}function tr(t,e,n,r,i){i-=We(e);var o=An(t,e),a=Wn(e),s=0,l=e.text.length,c=!0,u=ct(e,t.doc.direction);if(u){var d=(t.options.lineWrapping?nr:er)(t,e,n,o,u,r,i);s=(c=1!=d.level)?d.from:d.to-1,l=c?d.to:d.from-1}var h,f,p=null,g=null,v=ot((function(e){var n=Ln(t,o,e);return n.top+=a,n.bottom+=a,!!Qn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=e,g=n),!0)}),s,l),m=!1;if(g){var b=r-g.left=w.bottom?1:0}return Yn(n,v=it(e.text,v,1),f,m,r-h)}function er(t,e,n,r,i,o,a){var s=ot((function(s){var l=i[s],c=1!=l.level;return Qn(Gn(t,te(n,c?l.to:l.from,c?"before":"after"),"line",e,r),o,a,!0)}),0,i.length-1),l=i[s];if(s>0){var c=1!=l.level,u=Gn(t,te(n,c?l.from:l.to,c?"after":"before"),"line",e,r);Qn(u,o,a,!0)&&u.top>a&&(l=i[s-1])}return l}function nr(t,e,n,r,i,o,a){var s=Jn(t,e,r,a),l=s.begin,c=s.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,d=null,h=0;h=c||f.to<=l)){var p=Ln(t,r,1!=f.level?Math.min(c,f.to)-1:Math.max(l,f.from)).right,g=pg)&&(u=f,d=g)}}return u||(u=i[i.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}function rr(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==Nn){Nn=E("pre",null,"CodeMirror-line-like");for(var e=0;e<49;++e)Nn.appendChild(document.createTextNode("x")),Nn.appendChild(E("br"));Nn.appendChild(document.createTextNode("x"))}P(t.measure,Nn);var n=Nn.offsetHeight/50;return n>3&&(t.cachedTextHeight=n),T(t.measure),n||1}function ir(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=E("span","xxxxxxxxxx"),n=E("pre",[e],"CodeMirror-line-like");P(t.measure,n);var r=e.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(t.cachedCharWidth=i),i||10}function or(t){for(var e=t.display,n={},r={},i=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=t.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:ar(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:e.wrapper.clientWidth}}function ar(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function sr(t){var e=rr(t.display),n=t.options.lineWrapping,r=n&&Math.max(5,t.display.scroller.clientWidth/ir(t.display)-3);return function(i){if(He(t.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(l=qt(t.doc,c.line).text).length==c.ch){var u=V(l,l.length,t.options.tabSize)-l.length;c=te(c.line,Math.max(0,Math.round((o-kn(t.display).left)/ir(t.display))-u))}return c}function ur(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,r=0;re)&&(i.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=i.viewTo)Oe&&Re(t.doc,e)i.viewFrom?fr(t):(i.viewFrom+=r,i.viewTo+=r);else if(e<=i.viewFrom&&n>=i.viewTo)fr(t);else if(e<=i.viewFrom){var o=pr(t,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):fr(t)}else if(n>=i.viewTo){var a=pr(t,e,e,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):fr(t)}else{var s=pr(t,e,e,-1),l=pr(t,n,n+r,1);s&&l?(i.view=i.view.slice(0,s.index).concat(on(t,s.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):fr(t)}var c=i.externalMeasured;c&&(n=i.lineN&&e=r.viewTo)){var o=r.view[ur(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==z(a,n)&&a.push(n)}}}function fr(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function pr(t,e,n,r){var i,o=ur(t,e),a=t.display.view;if(!Oe||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=t.display.viewFrom,l=0;l0){if(o==a.length-1)return null;i=s+a[o].size-e,o++}else i=s-e;e+=i,n+=i}for(;Re(t.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function gr(t){for(var e=t.display.view,n=0,r=0;r=t.display.viewTo||s.to().linee||e==n&&a.to==e)&&(r(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(e,n,"ltr")}(g,n||0,null==r?h:r,(function(t,e,i,d){var v="ltr"==i,m=f(t,v?"left":"right"),b=f(e-1,v?"right":"left"),y=null==n&&0==t,w=null==r&&e==h,x=0==d,O=!g||d==g.length-1;if(b.top-m.top<=3){var C=(c?w:y)&&O,S=(c?y:w)&&x?s:(v?m:b).left,k=C?l:(v?b:m).right;u(S,m.top,k-S,m.bottom)}else{var j,T,P,E;v?(j=c&&y&&x?s:m.left,T=c?l:p(t,i,"before"),P=c?s:p(e,i,"after"),E=c&&w&&O?l:b.right):(j=c?p(t,i,"before"):s,T=!c&&y&&x?l:m.right,P=!c&&w&&O?s:b.left,E=c?p(e,i,"after"):l),u(j,m.top,T-j,m.bottom),m.bottom0?e.blinker=setInterval((function(){return e.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Or(t){t.state.focused||(t.display.input.focus(),Sr(t))}function Cr(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,kr(t))}),100)}function Sr(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(pt(t,"focus",t,e),t.state.focused=!0,L(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),xr(t))}function kr(t,e){t.state.delayingBlurEvent||(t.state.focused&&(pt(t,"blur",t,e),t.state.focused=!1,j(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function jr(t){for(var e=t.display,n=e.lineDiv.offsetTop,r=0;r.005||h<-.005)&&(Yt(i.line,l),Tr(i.line),i.rest))for(var f=0;ft.display.sizerWidth){var p=Math.ceil(c/ir(t.display));p>t.display.maxLineLength&&(t.display.maxLineLength=p,t.display.maxLine=i.line,t.display.maxLineChanged=!0)}}}}function Tr(t){if(t.widgets)for(var e=0;e=a&&(o=Jt(e,We(qt(e,l))-t.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function Er(t,e){var n=t.display,r=rr(t.display);e.top<0&&(e.top=0);var i=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=Pn(t),a={};e.bottom-e.top>o&&(e.bottom=e.top+o);var s=t.doc.height+Sn(n),l=e.tops-r;if(e.topi+o){var u=Math.min(e.top,(c?s:e.bottom)-o);u!=i&&(a.scrollTop=u)}var d=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft,h=Tn(t)-(t.options.fixedGutter?n.gutters.offsetWidth:0),f=e.right-e.left>h;return f&&(e.right=e.left+h),e.left<10?a.scrollLeft=0:e.lefth+d-3&&(a.scrollLeft=e.right+(f?0:10)-h),a}function Mr(t,e){null!=e&&(Lr(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Dr(t){Lr(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Ar(t,e,n){null==e&&null==n||Lr(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function Lr(t){var e=t.curOp.scrollToPos;e&&(t.curOp.scrollToPos=null,Nr(t,Kn(t,e.from),Kn(t,e.to),e.margin))}function Nr(t,e,n,r){var i=Er(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-r,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+r});Ar(t,i.scrollLeft,i.scrollTop)}function Ir(t,e){Math.abs(t.doc.scrollTop-e)<2||(n||li(t,{top:e}),_r(t,e,!0),n&&li(t),ri(t,100))}function _r(t,e,n){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function Fr(t,e,n,r){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!r||(t.doc.scrollLeft=e,di(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function Vr(t){var e=t.display,n=e.gutters.offsetWidth,r=Math.round(t.doc.height+Sn(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+jn(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}var Rr=function(t,e,n){this.cm=n;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,t(r),t(i),dt(r,"scroll",(function(){r.clientHeight&&e(r.scrollTop,"vertical")})),dt(i,"scroll",(function(){i.clientWidth&&e(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Rr.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,r=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?r+"px":"0";var i=t.viewHeight-(e?r:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:e?r:0}},Rr.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Rr.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Rr.prototype.zeroWidthHack=function(){var t=b&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},Rr.prototype.enableZeroWidthBar=function(t,e,n){t.style.pointerEvents="auto",e.set(1e3,(function r(){var i=t.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=t?t.style.pointerEvents="none":e.set(1e3,r)}))},Rr.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var zr=function(){};function Hr(t,e){e||(e=Vr(t));var n=t.display.barWidth,r=t.display.barHeight;$r(t,e);for(var i=0;i<4&&n!=t.display.barWidth||r!=t.display.barHeight;i++)n!=t.display.barWidth&&t.options.lineWrapping&&jr(t),$r(t,Vr(t)),n=t.display.barWidth,r=t.display.barHeight}function $r(t,e){var n=t.display,r=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}zr.prototype.update=function(){return{bottom:0,right:0}},zr.prototype.setScrollLeft=function(){},zr.prototype.setScrollTop=function(){},zr.prototype.clear=function(){};var Wr={native:Rr,null:zr};function Br(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&j(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Wr[t.options.scrollbarStyle]((function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),dt(e,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),e.setAttribute("cm-not-content","true")}),(function(e,n){"horizontal"==n?Fr(t,e):Ir(t,e)}),t),t.display.scrollbars.addClass&&L(t.display.wrapper,t.display.scrollbars.addClass)}var Ur=0;function qr(t){var e;t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ur},e=t.curOp,an?an.ops.push(e):e.ownsGroup=an={ops:[e],delayedCallbacks:[]}}function Gr(t){var e=t.curOp;e&&function(t,e){var n=t.ownsGroup;if(n)try{!function(t){var e=t.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new oi(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Yr(t){t.updatedDisplay=t.mustUpdate&&ai(t.cm,t.update)}function Xr(t){var e=t.cm,n=e.display;t.updatedDisplay&&jr(e),t.barMeasure=Vr(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Mn(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+jn(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Tn(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function Jr(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=E("div","",null,"position: absolute;\n top: "+(e.top-n.viewOffset-Cn(t.display))+"px;\n height: "+(e.bottom-e.top+jn(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(i),t.display.lineSpace.removeChild(o)}}}(e,function(t,e,n,r){var i;null==r&&(r=0),t.options.lineWrapping||e!=n||(n="before"==(e=e.ch?te(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e).sticky?te(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var a=!1,s=Gn(t,e),l=n&&n!=e?Gn(t,n):s,c=Er(t,i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),u=t.doc.scrollTop,d=t.doc.scrollLeft;if(null!=c.scrollTop&&(Ir(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&(Fr(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}(e,se(r,t.scrollToPos.from),se(r,t.scrollToPos.to),t.scrollToPos.margin));var i=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(i)for(var a=0;a=t.display.viewTo)){var n=+new Date+t.options.workTime,r=fe(t,e.highlightFrontier),i=[];e.iter(r.line,Math.min(e.first+e.size,t.display.viewTo+500),(function(o){if(r.line>=t.display.viewFrom){var a=o.styles,s=o.text.length>t.options.maxHighlightLength?$t(e.mode,r.state):null,l=de(t,o,r,!0);s&&(r.state=s),o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!d&&hn)return ri(t,t.options.workDelay),!0})),e.highlightFrontier=r.line,e.modeFrontier=Math.max(e.modeFrontier,r.line),i.length&&Qr(t,(function(){for(var e=0;e=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==gr(t))return!1;hi(t)&&(fr(t),e.dims=or(t));var i=r.first+r.size,o=Math.max(e.visible.from-t.options.viewportMargin,r.first),a=Math.min(i,e.visible.to+t.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Oe&&(o=Re(t.doc,o),a=ze(t.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;!function(t,e,n){var r=t.display;0==r.view.length||e>=r.viewTo||n<=r.viewFrom?(r.view=on(t,e,n),r.viewFrom=e):(r.viewFrom>e?r.view=on(t,e,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,ur(t,n)))),r.viewTo=n}(t,o,a),n.viewOffset=We(qt(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var c=gr(t);if(!s&&0==c&&!e.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(t){if(t.hasFocus())return null;var e=A();if(!e||!D(t.display.lineDiv,e))return null;var n={activeElt:e};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&D(t.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(t);return c>4&&(n.lineDiv.style.display="none"),function(t,e,n){var r=t.display,i=t.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(e){var n=e.nextSibling;return l&&b&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var c=r.view,u=r.viewFrom,d=0;d-1&&(f=!1),un(t,h,u,n)),f&&(T(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(Qt(t.options,u)))),a=h.node.nextSibling}else{var p=mn(t,h,u,n);o.insertBefore(p,a)}u+=h.size}for(;a;)a=s(a)}(t,n.updateLineNumbers,e.dims),c>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(t){if(t&&t.activeElt&&t.activeElt!=A()&&(t.activeElt.focus(),t.anchorNode&&D(document.body,t.anchorNode)&&D(document.body,t.focusNode))){var e=window.getSelection(),n=document.createRange();n.setEnd(t.anchorNode,t.anchorOffset),n.collapse(!1),e.removeAllRanges(),e.addRange(n),e.extend(t.focusNode,t.focusOffset)}}(u),T(n.cursorDiv),T(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=e.wrapperHeight,n.lastWrapWidth=e.wrapperWidth,ri(t,400)),n.updateLineNumbers=null,!0}function si(t,e){for(var n=e.viewport,r=!0;;r=!1){if(r&&t.options.lineWrapping&&e.oldDisplayWidth!=Tn(t))r&&(e.visible=Pr(t.display,t.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(t.doc.height+Sn(t.display)-Pn(t),n.top)}),e.visible=Pr(t.display,t.doc,n),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!ai(t,e))break;jr(t);var i=Vr(t);vr(t),Hr(t,i),ui(t,i),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function li(t,e){var n=new oi(t,e);if(ai(t,n)){jr(t),si(t,n);var r=Vr(t);vr(t),Hr(t,r),ui(t,r),n.finish()}}function ci(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px"}function ui(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+jn(t)+"px"}function di(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=ar(e)-e.scroller.scrollLeft+t.doc.scrollLeft,i=e.gutters.offsetWidth,o=r+"px",a=0;as.clientWidth,u=s.scrollHeight>s.clientHeight;if(i&&c||o&&u){if(o&&b&&l)t:for(var h=e.target,f=a.view;h!=s;h=h.parentNode)for(var p=0;p=0&&ee(t,r.to())<=0)return n}return-1};var Ci=function(t,e){this.anchor=t,this.head=e};function Si(t,e,n){var r=t&&t.options.selectionsMayTouch,i=e[n];e.sort((function(t,e){return ee(t.from(),e.from())})),n=z(e,i);for(var o=1;o0:l>=0){var c=oe(s.from(),a.from()),u=ie(s.to(),a.to()),d=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,e.splice(--o,2,new Ci(d?u:c,d?c:u))}}return new Oi(e,n)}function ki(t,e){return new Oi([new Ci(t,e||t)],0)}function ji(t){return t.text?te(t.from.line+t.text.length-1,K(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Ti(t,e){if(ee(t,e.from)<0)return t;if(ee(t,e.to)<=0)return ji(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,r=t.ch;return t.line==e.to.line&&(r+=ji(e).ch-e.to.ch),te(n,r)}function Pi(t,e){for(var n=[],r=0;r