mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
524 KiB
11 lines
524 KiB
/*! grapesjs - 0.9.18 */
|
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("jQuery")):"function"==typeof define&&define.amd?define(["jQuery"],e):"object"==typeof exports?exports.grapesjs=e(require("jQuery")):t.grapesjs=e(t.jQuery)}(this,function(t){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=133)}([function(t,e,i){(function(n){var r,s;!function(o){var a="object"==typeof self&&self.self===self&&self||"object"==typeof n&&n.global===n&&n;r=[i(1),i(12),e],void 0!==(s=function(t,e,i){a.Backbone=o(a,i,t,e)}.apply(e,r))&&(t.exports=s)}(function(t,e,i,n){var r=t.Backbone,s=Array.prototype.slice;e.VERSION="1.3.3",e.$=n,e.noConflict=function(){return t.Backbone=r,this},e.emulateHTTP=!1,e.emulateJSON=!1;var o=function(t,e,n){switch(t){case 1:return function(){return i[e](this[n])};case 2:return function(t){return i[e](this[n],t)};case 3:return function(t,r){return i[e](this[n],l(t,this),r)};case 4:return function(t,r,s){return i[e](this[n],l(t,this),r,s)};default:return function(){var t=s.call(arguments);return t.unshift(this[n]),i[e].apply(i,t)}}},a=function(t,e,n){i.each(e,function(e,r){i[r]&&(t.prototype[r]=o(e,r,n))})},l=function(t,e){return i.isFunction(t)?t:i.isObject(t)&&!e._isModel(t)?c(t):i.isString(t)?function(e){return e.get(t)}:t},c=function(t){var e=i.matches(t);return function(t){return e(t.attributes)}},u=e.Events={},h=/\s+/,d=function(t,e,n,r,s){var o,a=0;if(n&&"object"==typeof n){void 0!==r&&"context"in s&&void 0===s.context&&(s.context=r);for(o=i.keys(n);a<o.length;a++)e=d(t,e,o[a],n[o[a]],s)}else if(n&&h.test(n))for(o=n.split(h);a<o.length;a++)e=t(e,o[a],r,s);else e=t(e,n,r,s);return e};u.on=function(t,e,i){return f(this,t,e,i)};var f=function(t,e,i,n,r){if(t._events=d(p,t._events||{},e,i,{context:n,ctx:t,listening:r}),r){(t._listeners||(t._listeners={}))[r.id]=r}return t};u.listenTo=function(t,e,n){if(!t)return this;var r=t._listenId||(t._listenId=i.uniqueId("l")),s=this._listeningTo||(this._listeningTo={}),o=s[r];if(!o){var a=this._listenId||(this._listenId=i.uniqueId("l"));o=s[r]={obj:t,objId:r,id:a,listeningTo:s,count:0}}return f(t,e,n,this,o),this};var p=function(t,e,i,n){if(i){var r=t[e]||(t[e]=[]),s=n.context,o=n.ctx,a=n.listening;a&&a.count++,r.push({callback:i,context:s,ctx:s||o,listening:a})}return t};u.off=function(t,e,i){return this._events?(this._events=d(g,this._events,t,e,{context:i,listeners:this._listeners}),this):this},u.stopListening=function(t,e,n){var r=this._listeningTo;if(!r)return this;for(var s=t?[t._listenId]:i.keys(r),o=0;o<s.length;o++){var a=r[s[o]];if(!a)break;a.obj.off(e,n,this)}return this};var g=function(t,e,n,r){if(t){var s,o=0,a=r.context,l=r.listeners;if(e||n||a){for(var c=e?[e]:i.keys(t);o<c.length;o++){e=c[o];var u=t[e];if(!u)break;for(var h=[],d=0;d<u.length;d++){var f=u[d];n&&n!==f.callback&&n!==f.callback._callback||a&&a!==f.context?h.push(f):(s=f.listening)&&0==--s.count&&(delete l[s.id],delete s.listeningTo[s.objId])}h.length?t[e]=h:delete t[e]}return t}for(var p=i.keys(l);o<p.length;o++)s=l[p[o]],delete l[s.id],delete s.listeningTo[s.objId]}};u.once=function(t,e,n){var r=d(m,{},t,e,i.bind(this.off,this));return"string"==typeof t&&null==n&&(e=void 0),this.on(r,e,n)},u.listenToOnce=function(t,e,n){var r=d(m,{},e,n,i.bind(this.stopListening,this,t));return this.listenTo(t,r)};var m=function(t,e,n,r){if(n){var s=t[e]=i.once(function(){r(e,s),n.apply(this,arguments)});s._callback=n}return t};u.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),i=Array(e),n=0;n<e;n++)i[n]=arguments[n+1];return d(v,this._events,t,void 0,i),this};var v=function(t,e,i,n){if(t){var r=t[e],s=t.all;r&&s&&(s=s.slice()),r&&y(r,n),s&&y(s,[e].concat(n))}return t},y=function(t,e){var i,n=-1,r=t.length,s=e[0],o=e[1],a=e[2];switch(e.length){case 0:for(;++n<r;)(i=t[n]).callback.call(i.ctx);return;case 1:for(;++n<r;)(i=t[n]).callback.call(i.ctx,s);return;case 2:for(;++n<r;)(i=t[n]).callback.call(i.ctx,s,o);return;case 3:for(;++n<r;)(i=t[n]).callback.call(i.ctx,s,o,a);return;default:for(;++n<r;)(i=t[n]).callback.apply(i.ctx,e);return}};u.bind=u.on,u.unbind=u.off,i.extend(e,u);var b=e.Model=function(t,e){var n=t||{};e||(e={}),this.cid=i.uniqueId(this.cidPrefix),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(n=this.parse(n,e)||{});var r=i.result(this,"defaults");n=i.defaults(i.extend({},r,n),r),this.set(n,e),this.changed={},this.initialize.apply(this,arguments)};i.extend(b.prototype,u,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return null!=this.get(t)},matches:function(t){return!!i.iteratee(t,this)(this.attributes)},set:function(t,e,n){if(null==t)return this;var r;if("object"==typeof t?(r=t,n=e):(r={})[t]=e,n||(n={}),!this._validate(r,n))return!1;var s=n.unset,o=n.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=i.clone(this.attributes),this.changed={});var c=this.attributes,u=this.changed,h=this._previousAttributes;for(var d in r)e=r[d],i.isEqual(c[d],e)||a.push(d),i.isEqual(h[d],e)?delete u[d]:u[d]=e,s?delete c[d]:c[d]=e;if(this.idAttribute in r&&(this.id=this.get(this.idAttribute)),!o){a.length&&(this._pending=n);for(var f=0;f<a.length;f++)this.trigger("change:"+a[f],this,c[a[f]],n)}if(l)return this;if(!o)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:!0}))},clear:function(t){var e={};for(var n in this.attributes)e[n]=void 0;return this.set(e,i.extend({},t,{unset:!0}))},hasChanged:function(t){return null==t?!i.isEmpty(this.changed):i.has(this.changed,t)},changedAttributes:function(t){if(!t)return!!this.hasChanged()&&i.clone(this.changed);var e=this._changing?this._previousAttributes:this.attributes,n={};for(var r in t){var s=t[r];i.isEqual(e[r],s)||(n[r]=s)}return!!i.size(n)&&n},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=i.extend({parse:!0},t);var e=this,n=t.success;return t.success=function(i){var r=t.parse?e.parse(i,t):i;if(!e.set(r,t))return!1;n&&n.call(t.context,e,i,t),e.trigger("sync",e,i,t)},F(this,t),this.sync("read",this,t)},save:function(t,e,n){var r;null==t||"object"==typeof t?(r=t,n=e):(r={})[t]=e,n=i.extend({validate:!0,parse:!0},n);var s=n.wait;if(r&&!s){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;var o=this,a=n.success,l=this.attributes;n.success=function(t){o.attributes=l;var e=n.parse?o.parse(t,n):t;if(s&&(e=i.extend({},r,e)),e&&!o.set(e,n))return!1;a&&a.call(n.context,o,t,n),o.trigger("sync",o,t,n)},F(this,n),r&&s&&(this.attributes=i.extend({},l,r));var c=this.isNew()?"create":n.patch?"patch":"update";"patch"!==c||n.attrs||(n.attrs=r);var u=this.sync(c,this,n);return this.attributes=l,u},destroy:function(t){t=t?i.clone(t):{};var e=this,n=t.success,r=t.wait,s=function(){e.stopListening(),e.trigger("destroy",e,e.collection,t)};t.success=function(i){r&&s(),n&&n.call(t.context,e,i,t),e.isNew()||e.trigger("sync",e,i,t)};var o=!1;return this.isNew()?i.defer(t.success):(F(this,t),o=this.sync("delete",this,t)),r||s(),o},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||H();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend({},t,{validate:!0}))},_validate:function(t,e){if(!e.validate||!this.validate)return!0;t=i.extend({},this.attributes,t);var n=this.validationError=this.validate(t,e)||null;return!n||(this.trigger("invalid",this,n,i.extend(e,{validationError:n})),!1)}}),a(b,{keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1},"attributes");var x=e.Collection=function(t,e){e||(e={}),e.model&&(this.model=e.model),void 0!==e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,i.extend({silent:!0},e))},w={add:!0,remove:!0,merge:!0},C={add:!0,remove:!1},k=function(t,e,i){i=Math.min(Math.max(i,0),t.length);var n,r=Array(t.length-i),s=e.length;for(n=0;n<r.length;n++)r[n]=t[n+i];for(n=0;n<s;n++)t[n+i]=e[n];for(n=0;n<r.length;n++)t[n+s+i]=r[n]};i.extend(x.prototype,u,{model:b,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:!1},e,C))},remove:function(t,e){e=i.extend({},e);var n=!i.isArray(t);t=n?[t]:t.slice();var r=this._removeModels(t,e);return!e.silent&&r.length&&(e.changes={added:[],merged:[],removed:r},this.trigger("update",this,e)),n?r[0]:r},set:function(t,e){if(null!=t){e=i.extend({},w,e),e.parse&&!this._isModel(t)&&(t=this.parse(t,e)||[]);var n=!i.isArray(t);t=n?[t]:t.slice();var r=e.at;null!=r&&(r=+r),r>this.length&&(r=this.length),r<0&&(r+=this.length+1);var s,o,a=[],l=[],c=[],u=[],h={},d=e.add,f=e.merge,p=e.remove,g=!1,m=this.comparator&&null==r&&!1!==e.sort,v=i.isString(this.comparator)?this.comparator:null;for(o=0;o<t.length;o++){s=t[o];var y=this.get(s);if(y){if(f&&s!==y){var b=this._isModel(s)?s.attributes:s;e.parse&&(b=y.parse(b,e)),y.set(b,e),c.push(y),m&&!g&&(g=y.hasChanged(v))}h[y.cid]||(h[y.cid]=!0,a.push(y)),t[o]=y}else d&&(s=t[o]=this._prepareModel(s,e))&&(l.push(s),this._addReference(s,e),h[s.cid]=!0,a.push(s))}if(p){for(o=0;o<this.length;o++)s=this.models[o],h[s.cid]||u.push(s);u.length&&this._removeModels(u,e)}var x=!1,C=!m&&d&&p;if(a.length&&C?(x=this.length!==a.length||i.some(this.models,function(t,e){return t!==a[e]}),this.models.length=0,k(this.models,a,0),this.length=this.models.length):l.length&&(m&&(g=!0),k(this.models,l,null==r?this.length:r),this.length=this.models.length),g&&this.sort({silent:!0}),!e.silent){for(o=0;o<l.length;o++)null!=r&&(e.index=r+o),s=l[o],s.trigger("add",s,this,e);(g||x)&&this.trigger("sort",this,e),(l.length||u.length||c.length)&&(e.changes={added:l,removed:u,merged:c},this.trigger("update",this,e))}return n?t[0]:t}},reset:function(t,e){e=e?i.clone(e):{};for(var n=0;n<this.models.length;n++)this._removeReference(this.models[n],e);return e.previousModels=this.models,this._reset(),t=this.add(t,i.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return s.apply(this.models,arguments)},get:function(t){if(null!=t)return this._byId[t]||this._byId[this.modelId(t.attributes||t)]||t.cid&&this._byId[t.cid]},has:function(t){return null!=this.get(t)},at:function(t){return t<0&&(t+=this.length),this.models[t]},where:function(t,e){return this[e?"find":"filter"](t)},findWhere:function(t){return this.where(t,!0)},sort:function(t){var e=this.comparator;if(!e)throw new Error("Cannot sort a set without a comparator");t||(t={});var n=e.length;return i.isFunction(e)&&(e=i.bind(e,this)),1===n||i.isString(e)?this.models=this.sortBy(e):this.models.sort(e),t.silent||this.trigger("sort",this,t),this},pluck:function(t){return this.map(t+"")},fetch:function(t){t=i.extend({parse:!0},t);var e=t.success,n=this;return t.success=function(i){var r=t.reset?"reset":"set";n[r](i,t),e&&e.call(t.context,n,i,t),n.trigger("sync",n,i,t)},F(this,t),this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};var n=e.wait;if(!(t=this._prepareModel(t,e)))return!1;n||this.add(t,e);var r=this,s=e.success;return e.success=function(t,e,i){n&&r.add(t,i),s&&s.call(i.context,t,e,i)},t.save(null,e),t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){if(this._isModel(t))return t.collection||(t.collection=this),t;e=e?i.clone(e):{},e.collection=this;var n=new this.model(t,e);return n.validationError?(this.trigger("invalid",this,n.validationError,e),!1):n},_removeModels:function(t,e){for(var i=[],n=0;n<t.length;n++){var r=this.get(t[n]);if(r){var s=this.indexOf(r);this.models.splice(s,1),this.length--,delete this._byId[r.cid];var o=this.modelId(r.attributes);null!=o&&delete this._byId[o],e.silent||(e.index=s,r.trigger("remove",r,this,e)),i.push(r),this._removeReference(r,e)}}return i},_isModel:function(t){return t instanceof b},_addReference:function(t,e){this._byId[t.cid]=t;var i=this.modelId(t.attributes);null!=i&&(this._byId[i]=t),t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var i=this.modelId(t.attributes);null!=i&&delete this._byId[i],this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,n){if(e){if(("add"===t||"remove"===t)&&i!==this)return;if("destroy"===t&&this.remove(e,n),"change"===t){var r=this.modelId(e.previousAttributes()),s=this.modelId(e.attributes);r!==s&&(null!=r&&delete this._byId[r],null!=s&&(this._byId[s]=e))}}this.trigger.apply(this,arguments)}}),a(x,{forEach:3,each:3,map:3,collect:3,reduce:0,foldl:0,inject:0,reduceRight:0,foldr:0,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3,findIndex:3,findLastIndex:3},"models");var S=e.View=function(t){this.cid=i.uniqueId("view"),i.extend(this,i.pick(t,M)),this._ensureElement(),this.initialize.apply(this,arguments)},T=/^(\S+)\s*(.*)$/,M=["model","collection","el","id","attributes","className","tagName","events"];i.extend(S.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(t){return this.undelegateEvents(),this._setElement(t),this.delegateEvents(),this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t),this.el=this.$el[0]},delegateEvents:function(t){if(t||(t=i.result(this,"events")),!t)return this;this.undelegateEvents();for(var e in t){var n=t[e];if(i.isFunction(n)||(n=this[n]),n){var r=e.match(T);this.delegate(r[1],r[2],i.bind(n,this))}}return this},delegate:function(t,e,i){return this.$el.on(t+".delegateEvents"+this.cid,e,i),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(t,e,i){return this.$el.off(t+".delegateEvents"+this.cid,e,i),this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(this.el)this.setElement(i.result(this,"el"));else{var t=i.extend({},i.result(this,"attributes"));this.id&&(t.id=i.result(this,"id")),this.className&&(t.class=i.result(this,"className")),this.setElement(this._createElement(i.result(this,"tagName"))),this._setAttributes(t)}},_setAttributes:function(t){this.$el.attr(t)}}),e.sync=function(t,n,r){var s=E[t];i.defaults(r||(r={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var o={type:s,dataType:"json"};if(r.url||(o.url=i.result(n,"url")||H()),null!=r.data||!n||"create"!==t&&"update"!==t&&"patch"!==t||(o.contentType="application/json",o.data=JSON.stringify(r.attrs||n.toJSON(r))),r.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{}),r.emulateHTTP&&("PUT"===s||"DELETE"===s||"PATCH"===s)){o.type="POST",r.emulateJSON&&(o.data._method=s);var a=r.beforeSend;r.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",s),a)return a.apply(this,arguments)}}"GET"===o.type||r.emulateJSON||(o.processData=!1);var l=r.error;r.error=function(t,e,i){r.textStatus=e,r.errorThrown=i,l&&l.call(r.context,t,e,i)};var c=r.xhr=e.ajax(i.extend(o,r));return n.trigger("request",n,c,r),c};var E={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var P=e.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},$=/\((.*?)\)/g,L=/(\(\?)?:\w+/g,A=/\*\w+/g,N=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(P.prototype,u,{initialize:function(){},route:function(t,n,r){i.isRegExp(t)||(t=this._routeToRegExp(t)),i.isFunction(n)&&(r=n,n=""),r||(r=this[n]);var s=this;return e.history.route(t,function(i){var o=s._extractParameters(t,i);!1!==s.execute(r,o,n)&&(s.trigger.apply(s,["route:"+n].concat(o)),s.trigger("route",n,o),e.history.trigger("route",s,n,o))}),this},execute:function(t,e,i){t&&t.apply(this,e)},navigate:function(t,i){return e.history.navigate(t,i),this},_bindRoutes:function(){if(this.routes){this.routes=i.result(this,"routes");for(var t,e=i.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(N,"\\$&").replace($,"(?:$1)?").replace(L,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)"),new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var n=t.exec(e).slice(1);return i.map(n,function(t,e){return e===n.length-1?t||null:t?decodeURIComponent(t):null})}});var O=e.History=function(){this.handlers=[],this.checkUrl=i.bind(this.checkUrl,this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},D=/^[#\/]|\s+$/g,I=/^\/+|\/+$/g,_=/#.*$/;O.started=!1,i.extend(O.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root&&!this.getSearch()},matchRoot:function(){return this.decodeFragment(this.location.pathname).slice(0,this.root.length-1)+"/"===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===t.charAt(0)?t.slice(1):t},getFragment:function(t){return null==t&&(t=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),t.replace(D,"")},start:function(t){if(O.started)throw new Error("Backbone.history has already been started");if(O.started=!0,this.options=i.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,this._hasHashChange="onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7),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(I,"/"),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 n=document.body,r=n.insertBefore(this.iframe,n.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?s("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?s("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),O.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),i.some(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0}))},navigate:function(t,e){if(!O.started)return!1;e&&!0!==e||(e={trigger:!!e}),t=this.getFragment(t||"");var i=this.root;""!==t&&"?"!==t.charAt(0)||(i=i.slice(0,-1)||"/");var n=i+t;if(t=this.decodeFragment(t.replace(_,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var r=this.iframe.contentWindow;e.replace||(r.document.open(),r.document.close()),this._updateHash(r.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else t.hash="#"+e}}),e.history=new O;var z=function(t,e){var n,r=this;return n=t&&i.has(t,"constructor")?t.constructor:function(){return r.apply(this,arguments)},i.extend(n,r,e),n.prototype=i.create(r.prototype,t),n.prototype.constructor=n,n.__super__=r.prototype,n};b.extend=x.extend=P.extend=S.extend=O.extend=z;var H=function(){throw new Error('A "url" property or function must be specified')},F=function(t,e){var i=e.error;e.error=function(n){i&&i.call(e.context,t,n,e),t.trigger("error",t,n,e)}};return e})}).call(e,i(42))},function(t,e,i){var n,r;(function(){function i(t){function e(e,i,n,r,s,o){for(;s>=0&&s<o;s+=t){var a=r?r[s]:s;n=i(n,e[a],a,e)}return n}return function(i,n,r,s){n=k(n,s,4);var o=!L(i)&&C.keys(i),a=(o||i).length,l=t>0?0:a-1;return arguments.length<3&&(r=i[o?o[l]:l],l+=t),e(i,n,r,o,l,a)}}function s(t){return function(e,i,n){i=S(i,n);for(var r=$(e),s=t>0?0:r-1;s>=0&&s<r;s+=t)if(i(e[s],s,e))return s;return-1}}function o(t,e,i){return function(n,r,s){var o=0,a=$(n);if("number"==typeof s)t>0?o=s>=0?s:Math.max(s+a,o):a=s>=0?Math.min(s+1,a):s+a+1;else if(i&&s&&a)return s=i(n,r),n[s]===r?s:-1;if(r!==r)return s=e(p.call(n,o,a),C.isNaN),s>=0?s+o:-1;for(s=t>0?o:a-1;s>=0&&s<a;s+=t)if(n[s]===r)return s;return-1}}function a(t,e){var i=I.length,n=t.constructor,r=C.isFunction(n)&&n.prototype||h,s="constructor";for(C.has(t,s)&&!C.contains(e,s)&&e.push(s);i--;)(s=I[i])in t&&t[s]!==r[s]&&!C.contains(e,s)&&e.push(s)}var l=this,c=l._,u=Array.prototype,h=Object.prototype,d=Function.prototype,f=u.push,p=u.slice,g=h.toString,m=h.hasOwnProperty,v=Array.isArray,y=Object.keys,b=d.bind,x=Object.create,w=function(){},C=function(t){return t instanceof C?t:this instanceof C?void(this._wrapped=t):new C(t)};void 0!==t&&t.exports&&(e=t.exports=C),e._=C,C.VERSION="1.8.3";var k=function(t,e,i){if(void 0===e)return t;switch(null==i?3:i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,r){return t.call(e,i,n,r)};case 4:return function(i,n,r,s){return t.call(e,i,n,r,s)}}return function(){return t.apply(e,arguments)}},S=function(t,e,i){return null==t?C.identity:C.isFunction(t)?k(t,e,i):C.isObject(t)?C.matcher(t):C.property(t)};C.iteratee=function(t,e){return S(t,e,1/0)};var T=function(t,e){return function(i){var n=arguments.length;if(n<2||null==i)return i;for(var r=1;r<n;r++)for(var s=arguments[r],o=t(s),a=o.length,l=0;l<a;l++){var c=o[l];e&&void 0!==i[c]||(i[c]=s[c])}return i}},M=function(t){if(!C.isObject(t))return{};if(x)return x(t);w.prototype=t;var e=new w;return w.prototype=null,e},E=function(t){return function(e){return null==e?void 0:e[t]}},P=Math.pow(2,53)-1,$=E("length"),L=function(t){var e=$(t);return"number"==typeof e&&e>=0&&e<=P};C.each=C.forEach=function(t,e,i){e=k(e,i);var n,r;if(L(t))for(n=0,r=t.length;n<r;n++)e(t[n],n,t);else{var s=C.keys(t);for(n=0,r=s.length;n<r;n++)e(t[s[n]],s[n],t)}return t},C.map=C.collect=function(t,e,i){e=S(e,i);for(var n=!L(t)&&C.keys(t),r=(n||t).length,s=Array(r),o=0;o<r;o++){var a=n?n[o]:o;s[o]=e(t[a],a,t)}return s},C.reduce=C.foldl=C.inject=i(1),C.reduceRight=C.foldr=i(-1),C.find=C.detect=function(t,e,i){var n;if(void 0!==(n=L(t)?C.findIndex(t,e,i):C.findKey(t,e,i))&&-1!==n)return t[n]},C.filter=C.select=function(t,e,i){var n=[];return e=S(e,i),C.each(t,function(t,i,r){e(t,i,r)&&n.push(t)}),n},C.reject=function(t,e,i){return C.filter(t,C.negate(S(e)),i)},C.every=C.all=function(t,e,i){e=S(e,i);for(var n=!L(t)&&C.keys(t),r=(n||t).length,s=0;s<r;s++){var o=n?n[s]:s;if(!e(t[o],o,t))return!1}return!0},C.some=C.any=function(t,e,i){e=S(e,i);for(var n=!L(t)&&C.keys(t),r=(n||t).length,s=0;s<r;s++){var o=n?n[s]:s;if(e(t[o],o,t))return!0}return!1},C.contains=C.includes=C.include=function(t,e,i,n){return L(t)||(t=C.values(t)),("number"!=typeof i||n)&&(i=0),C.indexOf(t,e,i)>=0},C.invoke=function(t,e){var i=p.call(arguments,2),n=C.isFunction(e);return C.map(t,function(t){var r=n?e:t[e];return null==r?r:r.apply(t,i)})},C.pluck=function(t,e){return C.map(t,C.property(e))},C.where=function(t,e){return C.filter(t,C.matcher(e))},C.findWhere=function(t,e){return C.find(t,C.matcher(e))},C.max=function(t,e,i){var n,r,s=-1/0,o=-1/0;if(null==e&&null!=t){t=L(t)?t:C.values(t);for(var a=0,l=t.length;a<l;a++)(n=t[a])>s&&(s=n)}else e=S(e,i),C.each(t,function(t,i,n){((r=e(t,i,n))>o||r===-1/0&&s===-1/0)&&(s=t,o=r)});return s},C.min=function(t,e,i){var n,r,s=1/0,o=1/0;if(null==e&&null!=t){t=L(t)?t:C.values(t);for(var a=0,l=t.length;a<l;a++)(n=t[a])<s&&(s=n)}else e=S(e,i),C.each(t,function(t,i,n){((r=e(t,i,n))<o||r===1/0&&s===1/0)&&(s=t,o=r)});return s},C.shuffle=function(t){for(var e,i=L(t)?t:C.values(t),n=i.length,r=Array(n),s=0;s<n;s++)e=C.random(0,s),e!==s&&(r[s]=r[e]),r[e]=i[s];return r},C.sample=function(t,e,i){return null==e||i?(L(t)||(t=C.values(t)),t[C.random(t.length-1)]):C.shuffle(t).slice(0,Math.max(0,e))},C.sortBy=function(t,e,i){return e=S(e,i),C.pluck(C.map(t,function(t,i,n){return{value:t,index:i,criteria:e(t,i,n)}}).sort(function(t,e){var i=t.criteria,n=e.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(i<n||void 0===n)return-1}return t.index-e.index}),"value")};var A=function(t){return function(e,i,n){var r={};return i=S(i,n),C.each(e,function(n,s){var o=i(n,s,e);t(r,n,o)}),r}};C.groupBy=A(function(t,e,i){C.has(t,i)?t[i].push(e):t[i]=[e]}),C.indexBy=A(function(t,e,i){t[i]=e}),C.countBy=A(function(t,e,i){C.has(t,i)?t[i]++:t[i]=1}),C.toArray=function(t){return t?C.isArray(t)?p.call(t):L(t)?C.map(t,C.identity):C.values(t):[]},C.size=function(t){return null==t?0:L(t)?t.length:C.keys(t).length},C.partition=function(t,e,i){e=S(e,i);var n=[],r=[];return C.each(t,function(t,i,s){(e(t,i,s)?n:r).push(t)}),[n,r]},C.first=C.head=C.take=function(t,e,i){if(null!=t)return null==e||i?t[0]:C.initial(t,t.length-e)},C.initial=function(t,e,i){return p.call(t,0,Math.max(0,t.length-(null==e||i?1:e)))},C.last=function(t,e,i){if(null!=t)return null==e||i?t[t.length-1]:C.rest(t,Math.max(0,t.length-e))},C.rest=C.tail=C.drop=function(t,e,i){return p.call(t,null==e||i?1:e)},C.compact=function(t){return C.filter(t,C.identity)};var N=function(t,e,i,n){for(var r=[],s=0,o=n||0,a=$(t);o<a;o++){var l=t[o];if(L(l)&&(C.isArray(l)||C.isArguments(l))){e||(l=N(l,e,i));var c=0,u=l.length;for(r.length+=u;c<u;)r[s++]=l[c++]}else i||(r[s++]=l)}return r};C.flatten=function(t,e){return N(t,e,!1)},C.without=function(t){return C.difference(t,p.call(arguments,1))},C.uniq=C.unique=function(t,e,i,n){C.isBoolean(e)||(n=i,i=e,e=!1),null!=i&&(i=S(i,n));for(var r=[],s=[],o=0,a=$(t);o<a;o++){var l=t[o],c=i?i(l,o,t):l;e?(o&&s===c||r.push(l),s=c):i?C.contains(s,c)||(s.push(c),r.push(l)):C.contains(r,l)||r.push(l)}return r},C.union=function(){return C.uniq(N(arguments,!0,!0))},C.intersection=function(t){for(var e=[],i=arguments.length,n=0,r=$(t);n<r;n++){var s=t[n];if(!C.contains(e,s)){for(var o=1;o<i&&C.contains(arguments[o],s);o++);o===i&&e.push(s)}}return e},C.difference=function(t){var e=N(arguments,!0,!0,1);return C.filter(t,function(t){return!C.contains(e,t)})},C.zip=function(){return C.unzip(arguments)},C.unzip=function(t){for(var e=t&&C.max(t,$).length||0,i=Array(e),n=0;n<e;n++)i[n]=C.pluck(t,n);return i},C.object=function(t,e){for(var i={},n=0,r=$(t);n<r;n++)e?i[t[n]]=e[n]:i[t[n][0]]=t[n][1];return i},C.findIndex=s(1),C.findLastIndex=s(-1),C.sortedIndex=function(t,e,i,n){i=S(i,n,1);for(var r=i(e),s=0,o=$(t);s<o;){var a=Math.floor((s+o)/2);i(t[a])<r?s=a+1:o=a}return s},C.indexOf=o(1,C.findIndex,C.sortedIndex),C.lastIndexOf=o(-1,C.findLastIndex),C.range=function(t,e,i){null==e&&(e=t||0,t=0),i=i||1;for(var n=Math.max(Math.ceil((e-t)/i),0),r=Array(n),s=0;s<n;s++,t+=i)r[s]=t;return r};var O=function(t,e,i,n,r){if(!(n instanceof e))return t.apply(i,r);var s=M(t.prototype),o=t.apply(s,r);return C.isObject(o)?o:s};C.bind=function(t,e){if(b&&t.bind===b)return b.apply(t,p.call(arguments,1));if(!C.isFunction(t))throw new TypeError("Bind must be called on a function");var i=p.call(arguments,2),n=function(){return O(t,n,e,this,i.concat(p.call(arguments)))};return n},C.partial=function(t){var e=p.call(arguments,1),i=function(){for(var n=0,r=e.length,s=Array(r),o=0;o<r;o++)s[o]=e[o]===C?arguments[n++]:e[o];for(;n<arguments.length;)s.push(arguments[n++]);return O(t,i,this,this,s)};return i},C.bindAll=function(t){var e,i,n=arguments.length;if(n<=1)throw new Error("bindAll must be passed function names");for(e=1;e<n;e++)i=arguments[e],t[i]=C.bind(t[i],t);return t},C.memoize=function(t,e){var i=function(n){var r=i.cache,s=""+(e?e.apply(this,arguments):n);return C.has(r,s)||(r[s]=t.apply(this,arguments)),r[s]};return i.cache={},i},C.delay=function(t,e){var i=p.call(arguments,2);return setTimeout(function(){return t.apply(null,i)},e)},C.defer=C.partial(C.delay,C,1),C.throttle=function(t,e,i){var n,r,s,o=null,a=0;i||(i={});var l=function(){a=!1===i.leading?0:C.now(),o=null,s=t.apply(n,r),o||(n=r=null)};return function(){var c=C.now();a||!1!==i.leading||(a=c);var u=e-(c-a);return n=this,r=arguments,u<=0||u>e?(o&&(clearTimeout(o),o=null),a=c,s=t.apply(n,r),o||(n=r=null)):o||!1===i.trailing||(o=setTimeout(l,u)),s}},C.debounce=function(t,e,i){var n,r,s,o,a,l=function(){var c=C.now()-o;c<e&&c>=0?n=setTimeout(l,e-c):(n=null,i||(a=t.apply(s,r),n||(s=r=null)))};return function(){s=this,r=arguments,o=C.now();var c=i&&!n;return n||(n=setTimeout(l,e)),c&&(a=t.apply(s,r),s=r=null),a}},C.wrap=function(t,e){return C.partial(e,t)},C.negate=function(t){return function(){return!t.apply(this,arguments)}},C.compose=function(){var t=arguments,e=t.length-1;return function(){for(var i=e,n=t[e].apply(this,arguments);i--;)n=t[i].call(this,n);return n}},C.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},C.before=function(t,e){var i;return function(){return--t>0&&(i=e.apply(this,arguments)),t<=1&&(e=null),i}},C.once=C.partial(C.before,2);var D=!{toString:null}.propertyIsEnumerable("toString"),I=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];C.keys=function(t){if(!C.isObject(t))return[];if(y)return y(t);var e=[];for(var i in t)C.has(t,i)&&e.push(i);return D&&a(t,e),e},C.allKeys=function(t){if(!C.isObject(t))return[];var e=[];for(var i in t)e.push(i);return D&&a(t,e),e},C.values=function(t){for(var e=C.keys(t),i=e.length,n=Array(i),r=0;r<i;r++)n[r]=t[e[r]];return n},C.mapObject=function(t,e,i){e=S(e,i);for(var n,r=C.keys(t),s=r.length,o={},a=0;a<s;a++)n=r[a],o[n]=e(t[n],n,t);return o},C.pairs=function(t){for(var e=C.keys(t),i=e.length,n=Array(i),r=0;r<i;r++)n[r]=[e[r],t[e[r]]];return n},C.invert=function(t){for(var e={},i=C.keys(t),n=0,r=i.length;n<r;n++)e[t[i[n]]]=i[n];return e},C.functions=C.methods=function(t){var e=[];for(var i in t)C.isFunction(t[i])&&e.push(i);return e.sort()},C.extend=T(C.allKeys),C.extendOwn=C.assign=T(C.keys),C.findKey=function(t,e,i){e=S(e,i);for(var n,r=C.keys(t),s=0,o=r.length;s<o;s++)if(n=r[s],e(t[n],n,t))return n},C.pick=function(t,e,i){var n,r,s={},o=t;if(null==o)return s;C.isFunction(e)?(r=C.allKeys(o),n=k(e,i)):(r=N(arguments,!1,!1,1),n=function(t,e,i){return e in i},o=Object(o));for(var a=0,l=r.length;a<l;a++){var c=r[a],u=o[c];n(u,c,o)&&(s[c]=u)}return s},C.omit=function(t,e,i){if(C.isFunction(e))e=C.negate(e);else{var n=C.map(N(arguments,!1,!1,1),String);e=function(t,e){return!C.contains(n,e)}}return C.pick(t,e,i)},C.defaults=T(C.allKeys,!0),C.create=function(t,e){var i=M(t);return e&&C.extendOwn(i,e),i},C.clone=function(t){return C.isObject(t)?C.isArray(t)?t.slice():C.extend({},t):t},C.tap=function(t,e){return e(t),t},C.isMatch=function(t,e){var i=C.keys(e),n=i.length;if(null==t)return!n;for(var r=Object(t),s=0;s<n;s++){var o=i[s];if(e[o]!==r[o]||!(o in r))return!1}return!0};var _=function(t,e,i,n){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof C&&(t=t._wrapped),e instanceof C&&(e=e._wrapped);var r=g.call(t);if(r!==g.call(e))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:0==+t?1/+t==1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e}var s="[object Array]"===r;if(!s){if("object"!=typeof t||"object"!=typeof e)return!1;var o=t.constructor,a=e.constructor;if(o!==a&&!(C.isFunction(o)&&o instanceof o&&C.isFunction(a)&&a instanceof a)&&"constructor"in t&&"constructor"in e)return!1}i=i||[],n=n||[];for(var l=i.length;l--;)if(i[l]===t)return n[l]===e;if(i.push(t),n.push(e),s){if((l=t.length)!==e.length)return!1;for(;l--;)if(!_(t[l],e[l],i,n))return!1}else{var c,u=C.keys(t);if(l=u.length,C.keys(e).length!==l)return!1;for(;l--;)if(c=u[l],!C.has(e,c)||!_(t[c],e[c],i,n))return!1}return i.pop(),n.pop(),!0};C.isEqual=function(t,e){return _(t,e)},C.isEmpty=function(t){return null==t||(L(t)&&(C.isArray(t)||C.isString(t)||C.isArguments(t))?0===t.length:0===C.keys(t).length)},C.isElement=function(t){return!(!t||1!==t.nodeType)},C.isArray=v||function(t){return"[object Array]"===g.call(t)},C.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},C.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(t){C["is"+t]=function(e){return g.call(e)==="[object "+t+"]"}}),C.isArguments(arguments)||(C.isArguments=function(t){return C.has(t,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(C.isFunction=function(t){return"function"==typeof t||!1}),C.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},C.isNaN=function(t){return C.isNumber(t)&&t!==+t},C.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"===g.call(t)},C.isNull=function(t){return null===t},C.isUndefined=function(t){return void 0===t},C.has=function(t,e){return null!=t&&m.call(t,e)},C.noConflict=function(){return l._=c,this},C.identity=function(t){return t},C.constant=function(t){return function(){return t}},C.noop=function(){},C.property=E,C.propertyOf=function(t){return null==t?function(){}:function(e){return t[e]}},C.matcher=C.matches=function(t){return t=C.extendOwn({},t),function(e){return C.isMatch(e,t)}},C.times=function(t,e,i){var n=Array(Math.max(0,t));e=k(e,i,1);for(var r=0;r<t;r++)n[r]=e(r);return n},C.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},C.now=Date.now||function(){return(new Date).getTime()};var z={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},H=C.invert(z),F=function(t){var e=function(e){return t[e]},i="(?:"+C.keys(t).join("|")+")",n=RegExp(i),r=RegExp(i,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(r,e):t}};C.escape=F(z),C.unescape=F(H),C.result=function(t,e,i){var n=null==t?void 0:t[e];return void 0===n&&(n=i),C.isFunction(n)?n.call(t):n};var R=0;C.uniqueId=function(t){var e=++R+"";return t?t+e:e},C.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var V=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,j=function(t){return"\\"+B[t]};C.template=function(t,e,i){!e&&i&&(e=i),e=C.defaults({},e,C.templateSettings);var n=RegExp([(e.escape||V).source,(e.interpolate||V).source,(e.evaluate||V).source].join("|")+"|$","g"),r=0,s="__p+='";t.replace(n,function(e,i,n,o,a){return s+=t.slice(r,a).replace(W,j),r=a+e.length,i?s+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":n?s+="'+\n((__t=("+n+"))==null?'':__t)+\n'":o&&(s+="';\n"+o+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(e.variable||"obj","_",s)}catch(t){throw t.source=s,t}var a=function(t){return o.call(this,t,C)};return a.source="function("+(e.variable||"obj")+"){\n"+s+"}",a},C.chain=function(t){var e=C(t);return e._chain=!0,e};var U=function(t,e){return t._chain?C(e).chain():e};C.mixin=function(t){C.each(C.functions(t),function(e){var i=C[e]=t[e];C.prototype[e]=function(){var t=[this._wrapped];return f.apply(t,arguments),U(this,i.apply(C,t))}})},C.mixin(C),C.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=u[t];C.prototype[t]=function(){var i=this._wrapped;return e.apply(i,arguments),"shift"!==t&&"splice"!==t||0!==i.length||delete i[0],U(this,i)}}),C.each(["concat","join","slice"],function(t){var e=u[t];C.prototype[t]=function(){return U(this,e.apply(this._wrapped,arguments))}}),C.prototype.value=function(){return this._wrapped},C.prototype.valueOf=C.prototype.toJSON=C.prototype.value,C.prototype.toString=function(){return""+this._wrapped},n=[],void 0!==(r=function(){return C}.apply(e,n))&&(t.exports=r)}).call(this)},function(t,e,i){"use strict";(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=i(23),s=function(t){return t&&t.__esModule?t:{default:t}}(r),o=i(0),a=i(112),l=i(33),c=i(39),u=function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")};t.exports=o.Model.extend(s.default).extend({defaults:{tagName:"div",type:"",removable:!0,draggable:!0,droppable:!0,badgable:!0,stylable:!0,highlightable:!0,copyable:!0,resizable:!1,editable:!1,hiddenLayer:!1,void:!1,state:"",status:"",content:"",icon:"",style:{},attributes:"",classes:"",script:"",traits:["id","title"],toolbar:null,previousModel:"",mirror:""},initialize:function(t,e){e&&e.config&&e.config.voidElements.indexOf(this.get("tagName"))>=0&&this.set("void",!0),this.opt=e,this.sm=e?e.sm||{}:{},this.config=t||{},this.defaultC=this.config.components||[],this.defaultCl=this.normalizeClasses(this.get("classes")||this.config.classes||[]),this.components=new a(this.defaultC,e),this.components.parent=this,this.set("attributes",this.get("attributes")||{}),this.listenTo(this,"change:script",this.scriptUpdated),this.listenTo(this,"change:traits",this.traitsUpdated),this.set("components",this.components),this.set("classes",new l(this.defaultCl));var i=new c;i.setTarget(this),i.add(this.get("traits")),this.set("traits",i),this.initToolbar(),["stylable"].forEach(function(t){var e=this.get(t);if("string"==typeof e){var i=e.split(",").map(function(t){return t.trim()});this.set(t,i)}},this),this.set("status",""),this.init()},init:function(){},scriptUpdated:function(){this.set("scriptUpdated",1)},traitsUpdated:function(){var t=0,e=Object.assign({},this.get("attributes"));this.get("traits").each(function(i){if(t=1,!i.get("changeProp")){var n=i.getInitValue();n&&(e[i.get("name")]=n)}}),t&&this.set("attributes",e)},initToolbar:function(){var t=this;if(!t.get("toolbar")){var e=[];t.get("draggable")&&e.push({attributes:{class:"fa fa-arrows"},command:"tlb-move"}),t.get("copyable")&&e.push({attributes:{class:"fa fa-clone"},command:"tlb-clone"}),t.get("removable")&&e.push({attributes:{class:"fa fa-trash-o"},command:"tlb-delete"}),t.set("toolbar",e)}},loadTraits:function(t){var e=new c;e.setTarget(this),e.add(t),this.set("traits",e)},normalizeClasses:function(t){var e=[];if(this.sm.get){var i=this.sm.get("SelectorManager");if(i)return t.forEach(function(t){var n="";n="string"==typeof t?t:t.name;var r=i.add(n);e.push(r)}),e}},clone:function(t){var i=e.clone(this.attributes),n=this.get("components"),r=this.get("traits"),s=this.get("classes");return i.components=[],i.classes=[],i.traits=[],n.each(function(t,e){i.components[e]=t.clone(1)}),r.each(function(t,e){i.traits[e]=t.clone()}),s.each(function(t,e){i.classes[e]=t.get("name")}),i.status="",i.view="",t&&(this.opt.collection=null),new this.constructor(i,this.opt)},getName:function(){var t=this.get("custom-name"),e=this.get("tagName");e="div"==e?"box":e;var i=this.get("type")||e;return i=i.charAt(0).toUpperCase()+i.slice(1),t||i},getIcon:function(){var t=this.get("icon");return t?t+" ":""},toHTML:function(t){var i="",r=this,s=r.get("tagName"),o=0,a=r.get("void"),l="",c="",u=this.getAttrToHTML();for(var h in u){"id"==h&&(o=1);var d=u[h];c+=void 0!==(void 0===d?"undefined":n(d))&&""!==d?" "+h+'="'+d+'"':""}var f="";return r.get("classes").each(function(t){f+=" "+t.get("name")}),f=""!==f?' class="'+f.trim()+'"':"",e.isEmpty(r.get("style"))||o||(l=' id="'+r.getId()+'" '),i+="<"+s+f+l+c+(a?"/":"")+">"+r.get("content"),r.get("components").each(function(t){i+=t.toHTML()}),a||(i+="</"+s+">"),i},getAttrToHTML:function(){var t=this.get("attributes")||{};return delete t.style,t},toJSON:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=o.Model.prototype.toJSON.apply(this,e),r=this.getScriptString();return delete n.toolbar,r&&(n.script=r),n},getId:function(){return(this.get("attributes")||{}).id||this.cid},getScriptString:function(t){var e=this,i=t||this.get("script");if(!i)return i;if("function"==typeof i){var n=i.toString().trim();n=n.replace(/^function[\s\w]*\(\)\s?\{/,"").replace(/\}$/,""),i=n.trim()}var r=this.sm.config||{},s=u(r.tagVarStart||"{[ "),o=u(r.tagVarEnd||" ]}"),a=new RegExp(s+"(\\w+)"+o,"g");return i=i.replace(a,function(t,i){return e.scriptUpdated(),e.attributes[i]})}},{isComponent:function(t){return{tagName:t.tagName?t.tagName.toLowerCase():""}}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(124);t.exports=n.View.extend({className:function(){return this.getClasses()},tagName:function(){return this.model.get("tagName")},initialize:function(t){var e=this.model;this.opts=t||{},this.config=this.opts.config||{},this.em=this.config.em||"",this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.components=e.get("components"),this.attr=e.get("attributes"),this.classe=this.attr.class||[],this.listenTo(e,"destroy remove",this.remove),this.listenTo(e,"change:style",this.updateStyle),this.listenTo(e,"change:attributes",this.updateAttributes),this.listenTo(e,"change:status",this.updateStatus),this.listenTo(e,"change:state",this.updateState),this.listenTo(e,"change:script",this.render),this.listenTo(e,"change",this.handleChange),this.listenTo(e.get("classes"),"add remove change",this.updateClasses),this.$el.data("model",e),e.view=this,this.$el.data("collection",this.components),e.get("classes").length&&this.importClasses(),this.init()},init:function(){},handleChange:function(){var t=this.em;if(t){var e=this.model;t.trigger("component:update",e);for(var i in e.changed)t.trigger("component:update:"+i,e)}},importClasses:function(){var t=this.config.em.get("SelectorManager");t&&this.model.get("classes").each(function(e){t.add(e.get("name"))})},updateState:function(t){var e="hc-state";this.model.get("state")?this.$el.addClass(e):this.$el.removeClass(e)},updateStatus:function(t){var e=this.el,i=this.model.get("status"),n=this.pfx,r=this.ppfx,s=n+"selected",o=s+"-parent",a=r+"freezed",l=e.getAttribute("class")||"",c="";switch(i){case"selected":c=l+" "+s;break;case"selected-parent":c=l+" "+o;break;case"freezed":c=l+" "+a;break;default:this.$el.removeClass(s+" "+o+" "+a)}(c=c.trim())&&e.setAttribute("class",c)},getClasses:function(){var t=this.model.get("attributes"),e=t.class||[];return e.length?e.join(" "):null},updateAttributes:function(){var t=this.model,e={},i=t.get("attributes");for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n]);t.get("src")&&(e.src=t.get("src")),t.get("highlightable")&&(e["data-highlightable"]=1);var r=this.getStyleString();r&&(e.style=r),this.$el.attr(e)},updateStyle:function(){this.$el.attr("style",this.getStyleString())},updateContent:function(){this.getChildrenContainer().innerHTML=this.model.get("content")},getStyleString:function(){var t="";this.style=this.model.get("style");for(var e in this.style)this.style.hasOwnProperty(e)&&(t+=e+":"+this.style[e]+";");return t},updateClasses:function(){var t="";this.model.get("classes").each(function(e){t+=e.get("name")+" "}),t=t.trim(),t?this.$el.attr("class",t):this.$el.removeAttr("class"),this.updateStatus()},eventCall:function(t){t.viewResponse=this},prevDef:function(t){t.preventDefault()},updateScript:function(){if(this.model.get("script")){var t=this.em;if(t){t.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},renderChildren:function(){var t=new r({collection:this.model.get("components"),config:this.config,defaultTypes:this.opts.defaultTypes,componentTypes:this.opts.componentTypes}),e=this.getChildrenContainer(),i=t.render($(e)).el.childNodes;i=Array.prototype.slice.call(i);for(var n=0,s=i.length;n<s;n++)e.appendChild(i.shift());if(e!==this.el){!function t(i){Array.prototype.slice.call(i.children).forEach(function(i){i.style["pointer-events"]="none",e!==i&&t(i)})}(this.el)}},renderAttributes:function(){this.updateAttributes(),this.updateClasses()},render:function(){this.renderAttributes();this.model;return this.updateContent(),this.renderChildren(),this.updateScript(),this}})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({template:e.template('\n <div class="<%= ppfx %>field">\n <span id=\'<%= pfx %>input-holder\'></span>\n </div>\n <div style="clear:both"></div>'),templateLabel:e.template('\n <div class="<%= pfx %>label">\n <span class="<%= pfx %>icon <%= icon %>" title="<%= info %>">\n <%= label %>\n </span>\n <b class="<%= pfx %>clear">⨯</b>\n </div>'),events:{change:"valueUpdated"},initialize:function(t){this.config=t.config||{},this.em=this.config.em,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=t.target||{},this.propTarget=t.propTarget||{},this.onChange=t.onChange||{},this.onInputRender=t.onInputRender||{},this.customValue=t.customValue||{},this.defaultValue=this.model.get("defaults"),this.property=this.model.get("property"),this.input=this.$input=null;var e=this.pfx;this.className=e+"property",this.inputHolderId="#"+e+"input-holder",this.sector=this.model.collection&&this.model.collection.sector,this.model.get("value")||this.model.set("value",this.model.get("defaults")),this.listenTo(this.propTarget,"update",this.targetUpdated),this.listenTo(this.model,"destroy remove",this.remove),this.listenTo(this.model,"change:value",this.valueChanged),this.listenTo(this.model,"targetUpdated",this.targetUpdated),this.listenTo(this.model,"change:visible",this.updateVisibility),this.listenTo(this.model,"change:status",this.updateStatus),this.events["click ."+e+"clear"]="clear",this.delegateEvents()},updateStatus:function(){var t=this.model.get("status"),e=this.pfx,i=this.ppfx,n=this.config,r=i+"color-hl",s=i+"color-warn",o=this.$el.find("> ."+e+"label"),a=this.getClearEl().style;switch(o.removeClass(r+" "+s),a.display="none",t){case"updated":o.addClass(r),n.clearProperties&&(a.display="inline");break;case"computed":o.addClass(s)}},clear:function(){this.getTargetModel().removeStyle(this.model.get("property")),this.targetUpdated()},getClearEl:function(){return this.el.querySelector("."+this.pfx+"clear")},getTarget:function(){return this.propTarget&&this.propTarget.model},getTargetModel:function(){return this.propTarget&&this.propTarget.model},getHelperModel:function(){return this.propTarget&&this.propTarget.helper},valueUpdated:function(){this.model.set("value",this.getInputValue()),this.elementUpdated()},elementUpdated:function(){this.model.set("status","updated")},targetUpdated:function(){if(this.checkVisibility()){var t="",e="",i=this.getTargetValue({ignoreDefault:1}),n=this.getDefaultValue(),r=this.getComputedValue(),s=this.config,o=s.em,a=this.model;i?(t=i,s.highlightChanged&&(e="updated")):r&&s.showComputed&&r!=n?(t=r,s.highlightComputed&&(e="computed")):(t=n,e=""),this.setValue(t,1),this.model.set("status",e),o&&(o.trigger("styleManager:change",this),o.trigger("styleManager:change:"+a.get("property"),this))}},checkVisibility:function(){var t=1;return this.config.hideNotStylable&&(this.isTargetStylable()&&this.isComponentStylable()?this.show():(this.hide(),t=0),this.sector&&this.sector.trigger("updateVisibility")),t},sameValue:function(){return this.getComponentValue()==this.getValueForTarget()},getComponentValue:function(){var t=this.model,e=this.getTargetModel();if(e){var i=e.get("style")[this.property];if(this.componentValue=i||this.defaultValue+(this.unit||""),t.get("functionName")){var n=this.fetchFromFunction(this.componentValue);n&&(this.componentValue=n)}if(this.customValue&&"function"==typeof this.customValue){var r=t.collection.indexOf(t),s=this.customValue(this,r);s&&(this.componentValue=s)}return this.componentValue}},getTargetValue:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.model,n=this.getTargetModel(),r=this.customValue;if(!n)return t;if(t=n.getStyle()[i.get("property")],t||e.ignoreDefault||(t=this.getDefaultValue()),"function"==typeof r&&!e.ignoreCustomValue){var s=i.collection.indexOf(i),o=r(this,s);o&&(t=o)}return t},getDefaultValue:function(){return this.model.get("defaults")},getComputedValue:function(){var t=this.propTarget.computed,e=this.config.validComputed,i=this.model.get("property");return t&&e.indexOf(i)>=0&&t[i]},fetchFromFunction:function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},tryFetchFromFunction:function(t){if(!this.model.get("functionName"))return t;var e=t+"",i=e.indexOf("(")+1,n=e.lastIndexOf(")");return e.substring(i,n)},getValueForTarget:function(){return this.model.get("value")},getInputValue:function(){return this.$input?this.$input.val():""},valueChanged:function(t,e,i){var n=this.getValueForTarget(),r=this.config.em,s=this.model;if(this.$input&&this.setValue(n),this.getTarget()&&this.isTargetStylable()&&this.isComponentStylable()){var o=this.getValueForTarget(),a=s.get("functionName");a&&(o=a+"("+o+")");var l=this.getTarget(),c=this.onChange;c&&"function"==typeof c?c(l,this,i):this.updateTargetStyle(o,null,i),r&&(r.trigger("component:update",s),r.trigger("component:styleUpdate",s),r.trigger("component:styleUpdate:"+s.get("property"),s))}},updateTargetStyle:function(t,i,n){var r=i||this.property,s=t||"",o=n?n.avoidStore:0,a=this.getTarget(),l=e.clone(a.get("style"));s?l[r]=s:delete l[r],a.set("style",l,{avoidStore:o});var c=this.getHelperModel();c&&c.setStyle(l,{avoidStore:o})},isTargetStylable:function(){var t=this.getTarget().get("stylable");return t instanceof Array&&(t=e.indexOf(t,this.property)>=0),t},isComponentStylable:function(){var t=this.em,i=t&&t.get("selectedComponent");if(!i)return!0;var n=i.get("stylable");return n instanceof Array&&(n=e.indexOf(n,this.property)>=0),n},setValue:function(t,e){var i=0===e?0:1,n=this.model.get("defaults"),r=this.model.get("value")||n;(t||i)&&(r=t),this.$input&&this.$input.val(r),this.model.set({value:r},{silent:!0})},updateVisibility:function(){this.el.style.display=this.model.get("visible")?"block":"none"},show:function(){this.model.set("visible",1)},hide:function(){this.model.set("visible",0)},renderLabel:function(){var t=this.model;this.$el.html(this.templateLabel({pfx:this.pfx,ppfx:this.ppfx,icon:t.get("icon"),info:t.get("info"),label:t.get("name")}))},renderField:function(){this.renderTemplate(),this.renderInput(),delete this.componentValue},renderTemplate:function(){this.$el.append(this.template({pfx:this.pfx,ppfx:this.ppfx,icon:this.model.get("icon"),info:this.model.get("info"),label:this.model.get("name")}))},renderInput:function(){this.$input||(this.$input=$("<input>",{placeholder:this.model.get("defaults"),type:"text"}),this.$el.find(this.inputHolderId).html(this.$input)),this.setValue(this.componentValue,0)},renderInputRequest:function(){this.renderInput()},cleanValue:function(){this.setValue("")},render:function(){return this.renderLabel(),this.renderField(),this.$el.attr("class",this.className),this.updateStatus(),this}})}).call(e,i(1))},function(t,e,i){!function(e,i){t.exports=i()}(0,function(){"use strict";function t(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function e(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function i(t,i){return e(t).appendChild(i)}function n(t,e,i,n){var r=document.createElement(t);if(i&&(r.className=i),n&&(r.style.cssText=n),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var s=0;s<e.length;++s)r.appendChild(e[s]);return r}function r(t,e){if(3==e.nodeType&&(e=e.parentNode),t.contains)return t.contains(e);do{if(11==e.nodeType&&(e=e.host),e==t)return!0}while(e=e.parentNode)}function s(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.root&&t.root.activeElement;)t=t.root.activeElement;return t}function o(e,i){var n=e.className;t(i).test(n)||(e.className+=(n?" ":"")+i)}function a(e,i){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!t(n[r]).test(i)&&(i+=" "+n[r]);return i}function l(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function c(t,e,i){e||(e={});for(var n in t)!t.hasOwnProperty(n)||!1===i&&e.hasOwnProperty(n)||(e[n]=t[n]);return e}function u(t,e,i,n,r){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);for(var s=n||0,o=r||0;;){var a=t.indexOf("\t",s);if(a<0||a>=e)return o+(e-s);o+=a-s,o+=i-o%i,s=a+1}}function h(){this.id=null}function d(t,e){for(var i=0;i<t.length;++i)if(t[i]==e)return i;return-1}function f(t,e,i){for(var n=0,r=0;;){var s=t.indexOf("\t",n);-1==s&&(s=t.length);var o=s-n;if(s==t.length||r+o>=e)return n+Math.min(o,e-r);if(r+=s-n,r+=i-r%i,n=s+1,r>=e)return n}}function p(t){for(;Ao.length<=t;)Ao.push(g(Ao)+" ");return Ao[t]}function g(t){return t[t.length-1]}function m(t,e){for(var i=[],n=0;n<t.length;n++)i[n]=e(t[n],n);return i}function v(t,e,i){for(var n=0,r=i(e);n<t.length&&i(t[n])<=r;)n++;t.splice(n,0,e)}function y(){}function b(t,e){var i;return Object.create?i=Object.create(t):(y.prototype=t,i=new y),e&&c(e,i),i}function x(t){return/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||No.test(t))}function w(t,e){return e?!!(e.source.indexOf("\\w")>-1&&x(t))||e.test(t):x(t)}function C(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function k(t){return t.charCodeAt(0)>=768&&Oo.test(t)}function S(t,e,i){var r=this;this.input=i,r.scrollbarFiller=n("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=n("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=n("div",null,"CodeMirror-code"),r.selectionDiv=n("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=n("div",null,"CodeMirror-cursors"),r.measure=n("div",null,"CodeMirror-measure"),r.lineMeasure=n("div",null,"CodeMirror-measure"),r.lineSpace=n("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=n("div",[n("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=n("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=n("div",null,null,"position: absolute; height: "+Mo+"px; width: 1px;"),r.gutters=n("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=n("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=n("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),no&&ro<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),so||to&&po||(r.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(r.wrapper):t(r.wrapper)),r.viewFrom=r.viewTo=e.first,r.reportedViewFrom=r.reportedViewTo=e.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,i.init(r)}function T(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 i=t;!i.lines;)for(var n=0;;++n){var r=i.children[n],s=r.chunkSize();if(e<s){i=r;break}e-=s}return i.lines[e]}function M(t,e,i){var n=[],r=e.line;return t.iter(e.line,i.line+1,function(t){var s=t.text;r==i.line&&(s=s.slice(0,i.ch)),r==e.line&&(s=s.slice(e.ch)),n.push(s),++r}),n}function E(t,e,i){var n=[];return t.iter(e,i,function(t){n.push(t.text)}),n}function P(t,e){var i=e-t.height;if(i)for(var n=t;n;n=n.parent)n.height+=i}function $(t){if(null==t.parent)return null;for(var e=t.parent,i=d(e.lines,t),n=e.parent;n;e=n,n=n.parent)for(var r=0;n.children[r]!=e;++r)i+=n.children[r].chunkSize();return i+e.first}function L(t,e){var i=t.first;t:do{for(var n=0;n<t.children.length;++n){var r=t.children[n],s=r.height;if(e<s){t=r;continue t}e-=s,i+=r.chunkSize()}return i}while(!t.lines);for(var o=0;o<t.lines.length;++o){var a=t.lines[o],l=a.height;if(e<l)break;e-=l}return i+o}function A(t,e){return e>=t.first&&e<t.first+t.size}function N(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function O(t,e){if(!(this instanceof O))return new O(t,e);this.line=t,this.ch=e}function D(t,e){return t.line-e.line||t.ch-e.ch}function I(t){return O(t.line,t.ch)}function _(t,e){return D(t,e)<0?e:t}function z(t,e){return D(t,e)<0?t:e}function H(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function F(t,e){if(e.line<t.first)return O(t.first,0);var i=t.first+t.size-1;return e.line>i?O(i,T(t,i).text.length):R(e,T(t,e.line).text.length)}function R(t,e){var i=t.ch;return null==i||i>e?O(t.line,e):i<0?O(t.line,0):t}function V(t,e){for(var i=[],n=0;n<e.length;n++)i[n]=F(t,e[n]);return i}function B(){Do=!0}function W(){Io=!0}function j(t,e,i){this.marker=t,this.from=e,this.to=i}function U(t,e){if(t)for(var i=0;i<t.length;++i){var n=t[i];if(n.marker==e)return n}}function q(t,e){for(var i,n=0;n<t.length;++n)t[n]!=e&&(i||(i=[])).push(t[n]);return i}function K(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t)}function G(t,e,i){var n;if(t)for(var r=0;r<t.length;++r){var s=t[r],o=s.marker,a=null==s.from||(o.inclusiveLeft?s.from<=e:s.from<e);if(a||s.from==e&&"bookmark"==o.type&&(!i||!s.marker.insertLeft)){var l=null==s.to||(o.inclusiveRight?s.to>=e:s.to>e);(n||(n=[])).push(new j(o,s.from,l?null:s.to))}}return n}function Y(t,e,i){var n;if(t)for(var r=0;r<t.length;++r){var s=t[r],o=s.marker,a=null==s.to||(o.inclusiveRight?s.to>=e:s.to>e);if(a||s.from==e&&"bookmark"==o.type&&(!i||s.marker.insertLeft)){var l=null==s.from||(o.inclusiveLeft?s.from<=e:s.from<e);(n||(n=[])).push(new j(o,l?null:s.from-e,null==s.to?null:s.to-e))}}return n}function X(t,e){if(e.full)return null;var i=A(t,e.from.line)&&T(t,e.from.line).markedSpans,n=A(t,e.to.line)&&T(t,e.to.line).markedSpans;if(!i&&!n)return null;var r=e.from.ch,s=e.to.ch,o=0==D(e.from,e.to),a=G(i,r,o),l=Y(n,s,o),c=1==e.text.length,u=g(e.text).length+(c?r:0);if(a)for(var h=0;h<a.length;++h){var d=a[h];if(null==d.to){var f=U(l,d.marker);f?c&&(d.to=null==f.to?null:f.to+u):d.to=r}}if(l)for(var p=0;p<l.length;++p){var m=l[p];if(null!=m.to&&(m.to+=u),null==m.from){var v=U(a,m.marker);v||(m.from=u,c&&(a||(a=[])).push(m))}else m.from+=u,c&&(a||(a=[])).push(m)}a&&(a=J(a)),l&&l!=a&&(l=J(l));var y=[a];if(!c){var b,x=e.text.length-2;if(x>0&&a)for(var w=0;w<a.length;++w)null==a[w].to&&(b||(b=[])).push(new j(a[w].marker,null,null));for(var C=0;C<x;++C)y.push(b);y.push(l)}return y}function J(t){for(var e=0;e<t.length;++e){var i=t[e];null!=i.from&&i.from==i.to&&!1!==i.marker.clearWhenEmpty&&t.splice(e--,1)}return t.length?t:null}function Z(t,e,i){var n=null;if(t.iter(e.line,i.line+1,function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var i=t.markedSpans[e].marker;!i.readOnly||n&&-1!=d(n,i)||(n||(n=[])).push(i)}}),!n)return null;for(var r=[{from:e,to:i}],s=0;s<n.length;++s)for(var o=n[s],a=o.find(0),l=0;l<r.length;++l){var c=r[l];if(!(D(c.to,a.from)<0||D(c.from,a.to)>0)){var u=[l,1],h=D(c.from,a.from),f=D(c.to,a.to);(h<0||!o.inclusiveLeft&&!h)&&u.push({from:c.from,to:a.from}),(f>0||!o.inclusiveRight&&!f)&&u.push({from:a.to,to:c.to}),r.splice.apply(r,u),l+=u.length-1}}return r}function Q(t){var e=t.markedSpans;if(e){for(var i=0;i<e.length;++i)e[i].marker.detachLine(t);t.markedSpans=null}}function tt(t,e){if(e){for(var i=0;i<e.length;++i)e[i].marker.attachLine(t);t.markedSpans=e}}function et(t){return t.inclusiveLeft?-1:0}function it(t){return t.inclusiveRight?1:0}function nt(t,e){var i=t.lines.length-e.lines.length;if(0!=i)return i;var n=t.find(),r=e.find(),s=D(n.from,r.from)||et(t)-et(e);if(s)return-s;var o=D(n.to,r.to)||it(t)-it(e);return o||e.id-t.id}function rt(t,e){var i,n=Io&&t.markedSpans;if(n)for(var r=void 0,s=0;s<n.length;++s)r=n[s],r.marker.collapsed&&null==(e?r.from:r.to)&&(!i||nt(i,r.marker)<0)&&(i=r.marker);return i}function st(t){return rt(t,!0)}function ot(t){return rt(t,!1)}function at(t,e,i,n,r){var s=T(t,e),o=Io&&s.markedSpans;if(o)for(var a=0;a<o.length;++a){var l=o[a];if(l.marker.collapsed){var c=l.marker.find(0),u=D(c.from,i)||et(l.marker)-et(r),h=D(c.to,n)||it(l.marker)-it(r);if(!(u>=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?D(c.to,i)>=0:D(c.to,i)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?D(c.from,n)<=0:D(c.from,n)<0)))return!0}}}function lt(t){for(var e;e=st(t);)t=e.find(-1,!0).line;return t}function ct(t){for(var e,i;e=ot(t);)t=e.find(1,!0).line,(i||(i=[])).push(t);return i}function ut(t,e){var i=T(t,e),n=lt(i);return i==n?e:$(n)}function ht(t,e){if(e>t.lastLine())return e;var i,n=T(t,e);if(!dt(t,n))return e;for(;i=ot(n);)n=i.find(1,!0).line;return $(n)+1}function dt(t,e){var i=Io&&e.markedSpans;if(i)for(var n=void 0,r=0;r<i.length;++r)if(n=i[r],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&ft(t,e,n))return!0}}function ft(t,e,i){if(null==i.to){var n=i.marker.find(1,!0);return ft(t,n.line,U(n.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==e.text.length)return!0;for(var r=void 0,s=0;s<e.markedSpans.length;++s)if(r=e.markedSpans[s],r.marker.collapsed&&!r.marker.widgetNode&&r.from==i.to&&(null==r.to||r.to!=i.from)&&(r.marker.inclusiveLeft||i.marker.inclusiveRight)&&ft(t,e,r))return!0}function pt(t){t=lt(t);for(var e=0,i=t.parent,n=0;n<i.lines.length;++n){var r=i.lines[n];if(r==t)break;e+=r.height}for(var s=i.parent;s;i=s,s=i.parent)for(var o=0;o<s.children.length;++o){var a=s.children[o];if(a==i)break;e+=a.height}return e}function gt(t){if(0==t.height)return 0;for(var e,i=t.text.length,n=t;e=st(n);){var r=e.find(0,!0);n=r.from.line,i+=r.from.ch-r.to.ch}for(n=t;e=ot(n);){var s=e.find(0,!0);i-=n.text.length-s.from.ch,n=s.to.line,i+=n.text.length-s.to.ch}return i}function mt(t){var e=t.display,i=t.doc;e.maxLine=T(i,i.first),e.maxLineLength=gt(e.maxLine),e.maxLineChanged=!0,i.iter(function(t){var i=gt(t);i>e.maxLineLength&&(e.maxLineLength=i,e.maxLine=t)})}function vt(t,e,i,n){if(!t)return n(e,i,"ltr");for(var r=!1,s=0;s<t.length;++s){var o=t[s];(o.from<i&&o.to>e||e==i&&o.to==e)&&(n(Math.max(o.from,e),Math.min(o.to,i),1==o.level?"rtl":"ltr"),r=!0)}r||n(e,i,"ltr")}function yt(t){return t.level%2?t.to:t.from}function bt(t){return t.level%2?t.from:t.to}function xt(t){var e=Et(t);return e?yt(e[0]):0}function wt(t){var e=Et(t);return e?bt(g(e)):t.text.length}function Ct(t,e,i){var n=t[0].level;return e==n||i!=n&&e<i}function kt(t,e){var i;_o=null;for(var n=0;n<t.length;++n){var r=t[n];if(r.from<e&&r.to>e)return n;if(r.from==e||r.to==e){if(null!=i)return Ct(t,r.level,t[i].level)?(r.from!=r.to&&(_o=i),n):(r.from!=r.to&&(_o=n),i);i=n}}return i}function St(t,e,i,n){if(!n)return e+i;do{e+=i}while(e>0&&k(t.text.charAt(e)));return e}function Tt(t,e,i,n){var r=Et(t);if(!r)return Mt(t,e,i,n);for(var s=kt(r,e),o=r[s],a=St(t,e,o.level%2?-i:i,n);;){if(a>o.from&&a<o.to)return a;if(a==o.from||a==o.to)return kt(r,a)==s?a:(o=r[s+=i],i>0==o.level%2?o.to:o.from);if(!(o=r[s+=i]))return null;a=i>0==o.level%2?St(t,o.to,-1,n):St(t,o.from,1,n)}}function Mt(t,e,i,n){var r=e+i;if(n)for(;r>0&&k(t.text.charAt(r));)r+=i;return r<0||r>t.text.length?null:r}function Et(t){var e=t.order;return null==e&&(e=t.order=zo(t.text)),e}function Pt(t,e){return t._handlers&&t._handlers[e]||Ho}function $t(t,e,i){if(t.removeEventListener)t.removeEventListener(e,i,!1);else if(t.detachEvent)t.detachEvent("on"+e,i);else{var n=t._handlers,r=n&&n[e];if(r){var s=d(r,i);s>-1&&(n[e]=r.slice(0,s).concat(r.slice(s+1)))}}}function Lt(t,e){var i=Pt(t,e);if(i.length)for(var n=Array.prototype.slice.call(arguments,2),r=0;r<i.length;++r)i[r].apply(null,n)}function At(t,e,i){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),Lt(t,i||e.type,t,e),zt(e)||e.codemirrorIgnore}function Nt(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var i=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),n=0;n<e.length;++n)-1==d(i,e[n])&&i.push(e[n])}function Ot(t,e){return Pt(t,e).length>0}function Dt(t){t.prototype.on=function(t,e){Fo(this,t,e)},t.prototype.off=function(t,e){$t(this,t,e)}}function It(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function _t(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function zt(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Ht(t){It(t),_t(t)}function Ft(t){return t.target||t.srcElement}function Rt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),go&&t.ctrlKey&&1==e&&(e=3),e}function Vt(t){if(null==So){var e=n("span","");i(t,n("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(So=e.offsetWidth<=1&&e.offsetHeight>2&&!(no&&ro<8))}var r=So?n("span",""):n("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Bt(t){if(null!=To)return To;var n=i(t,document.createTextNode("AخA")),r=bo(n,0,1).getBoundingClientRect(),s=bo(n,1,2).getBoundingClientRect();return e(t),!(!r||r.left==r.right)&&(To=s.right-r.right<3)}function Wt(t){if(null!=jo)return jo;var e=i(t,n("span","x")),r=e.getBoundingClientRect(),s=bo(e,0,1).getBoundingClientRect();return jo=Math.abs(r.left-s.left)>1}function jt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Uo[t]=e}function Ut(t,e){qo[t]=e}function qt(t){if("string"==typeof t&&qo.hasOwnProperty(t))t=qo[t];else if(t&&"string"==typeof t.name&&qo.hasOwnProperty(t.name)){var e=qo[t.name];"string"==typeof e&&(e={name:e}),t=b(e,t),t.name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return qt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return qt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Kt(t,e){e=qt(e);var i=Uo[e.name];if(!i)return Kt(t,"text/plain");var n=i(t,e);if(Ko.hasOwnProperty(e.name)){var r=Ko[e.name];for(var s in r)r.hasOwnProperty(s)&&(n.hasOwnProperty(s)&&(n["_"+s]=n[s]),n[s]=r[s])}if(n.name=e.name,e.helperType&&(n.helperType=e.helperType),e.modeProps)for(var o in e.modeProps)n[o]=e.modeProps[o];return n}function Gt(t,e){c(e,Ko.hasOwnProperty(t)?Ko[t]:Ko[t]={})}function Yt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var i={};for(var n in e){var r=e[n];r instanceof Array&&(r=r.concat([])),i[n]=r}return i}function Xt(t,e){for(var i;t.innerMode&&(i=t.innerMode(e))&&i.mode!=t;)e=i.state,t=i.mode;return i||{mode:t,state:e}}function Jt(t,e,i){return!t.startState||t.startState(e,i)}function Zt(t,e,i,n){var r=[t.state.modeGen],s={};oe(t,e.text,t.doc.mode,i,function(t,e){return r.push(t,e)},s,n);for(var o=0;o<t.state.overlays.length;++o)!function(i){var n=t.state.overlays[i],o=1,a=0;oe(t,e.text,n.mode,!0,function(t,e){for(var i=o;a<t;){var s=r[o];s>t&&r.splice(o,1,t,r[o+1],s),o+=2,a=Math.min(t,s)}if(e)if(n.opaque)r.splice(i,o-i,t,"overlay "+e),o=i+2;else for(;i<o;i+=2){var l=r[i+1];r[i+1]=(l?l+" ":"")+"overlay "+e}},s)}(o);return{styles:r,classes:s.bgClass||s.textClass?s:null}}function Qt(t,e,i){if(!e.styles||e.styles[0]!=t.state.modeGen){var n=te(t,$(e)),r=Zt(t,e,e.text.length>t.options.maxHighlightLength?Yt(t.doc.mode,n):n);e.stateAfter=n,e.styles=r.styles,r.classes?e.styleClasses=r.classes:e.styleClasses&&(e.styleClasses=null),i===t.doc.frontier&&t.doc.frontier++}return e.styles}function te(t,e,i){var n=t.doc,r=t.display;if(!n.mode.startState)return!0;var s=ae(t,e,i),o=s>n.first&&T(n,s-1).stateAfter;return o=o?Yt(n.mode,o):Jt(n.mode),n.iter(s,e,function(i){ee(t,i.text,o);var a=s==e-1||s%5==0||s>=r.viewFrom&&s<r.viewTo;i.stateAfter=a?Yt(n.mode,o):null,++s}),i&&(n.frontier=s),o}function ee(t,e,i,n){var r=t.doc.mode,s=new Go(e,t.options.tabSize);for(s.start=s.pos=n||0,""==e&&ie(r,i);!s.eol();)ne(r,s,i),s.start=s.pos}function ie(t,e){if(t.blankLine)return t.blankLine(e);if(t.innerMode){var i=Xt(t,e);return i.mode.blankLine?i.mode.blankLine(i.state):void 0}}function ne(t,e,i,n){for(var r=0;r<10;r++){n&&(n[0]=Xt(t,i).mode);var s=t.token(e,i);if(e.pos>e.start)return s}throw new Error("Mode "+t.name+" failed to advance stream.")}function re(t,e,i,n){var r,s=function(t){return{start:h.start,end:h.pos,string:h.current(),type:r||null,state:t?Yt(o.mode,u):u}},o=t.doc,a=o.mode;e=F(o,e);var l,c=T(o,e.line),u=te(t,e.line,i),h=new Go(c.text,t.options.tabSize);for(n&&(l=[]);(n||h.pos<e.ch)&&!h.eol();)h.start=h.pos,r=ne(a,h,u),n&&l.push(s(!0));return n?l:s()}function se(t,e){if(t)for(;;){var i=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;t=t.slice(0,i.index)+t.slice(i.index+i[0].length);var n=i[1]?"bgClass":"textClass";null==e[n]?e[n]=i[2]:new RegExp("(?:^|s)"+i[2]+"(?:$|s)").test(e[n])||(e[n]+=" "+i[2])}return t}function oe(t,e,i,n,r,s,o){var a=i.flattenSpans;null==a&&(a=t.options.flattenSpans);var l,c=0,u=null,h=new Go(e,t.options.tabSize),d=t.options.addModeClass&&[null];for(""==e&&se(ie(i,n),s);!h.eol();){if(h.pos>t.options.maxHighlightLength?(a=!1,o&&ee(t,e,n,h.pos),h.pos=e.length,l=null):l=se(ne(i,h,n,d),s),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!a||u!=l){for(;c<h.start;)c=Math.min(h.start,c+5e3),r(c,u);u=l}h.start=h.pos}for(;c<h.pos;){var p=Math.min(h.pos,c+5e3);r(p,u),c=p}}function ae(t,e,i){for(var n,r,s=t.doc,o=i?-1:e-(t.doc.mode.innerMode?1e3:100),a=e;a>o;--a){if(a<=s.first)return s.first;var l=T(s,a-1);if(l.stateAfter&&(!i||a<=s.frontier))return a;var c=u(l.text,null,t.options.tabSize);(null==r||n>c)&&(r=a-1,n=c)}return r}function le(t,e,i){this.text=t,tt(this,e),this.height=i?i(this):1}function ce(t,e,i,n){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Q(t),tt(t,i);var r=n?n(t):1;r!=t.height&&P(t,r)}function ue(t){t.parent=null,Q(t)}function he(t,e){if(!t||/^\s*$/.test(t))return null;var i=e.addModeClass?Jo:Xo;return i[t]||(i[t]=t.replace(/\S+/g,"cm-$&"))}function de(t,e){var i=n("span",null,null,so?"padding-right: .1px":null),r={pre:n("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:(no||so)&&t.getOption("lineWrapping")};e.measure={};for(var s=0;s<=(e.rest?e.rest.length:0);s++){var o=s?e.rest[s-1]:e.line,l=void 0;r.pos=0,r.addToken=pe,Bt(t.display.measure)&&(l=Et(o))&&(r.addToken=me(r.addToken,l)),r.map=[];ye(o,r,Qt(t,o,e!=t.display.externalMeasured&&$(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=a(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=a(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Vt(t.display.measure))),0==s?(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(so){var c=r.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Lt(t,"renderLine",t,e.line,r.pre),r.pre.className&&(r.textClass=a(r.pre.className,r.textClass||"")),r}function fe(t){var e=n("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function pe(t,e,i,r,s,o,a){if(e){var l,c=t.splitSpaces?ge(e,t.trailingSpace):e,u=t.cm.state.specialChars,h=!1;if(u.test(e)){l=document.createDocumentFragment();for(var d=0;;){u.lastIndex=d;var f=u.exec(e),g=f?f.index-d:e.length-d;if(g){var m=document.createTextNode(c.slice(d,d+g));no&&ro<9?l.appendChild(n("span",[m])):l.appendChild(m),t.map.push(t.pos,t.pos+g,m),t.col+=g,t.pos+=g}if(!f)break;d+=g+1;var v=void 0;if("\t"==f[0]){var y=t.cm.options.tabSize,b=y-t.col%y;v=l.appendChild(n("span",p(b),"cm-tab")),v.setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),t.col+=b}else"\r"==f[0]||"\n"==f[0]?(v=l.appendChild(n("span","\r"==f[0]?"␍":"","cm-invalidchar")),v.setAttribute("cm-text",f[0]),t.col+=1):(v=t.cm.options.specialCharPlaceholder(f[0]),v.setAttribute("cm-text",f[0]),no&&ro<9?l.appendChild(n("span",[v])):l.appendChild(v),t.col+=1);t.map.push(t.pos,t.pos+1,v),t.pos++}}else t.col+=e.length,l=document.createTextNode(c),t.map.push(t.pos,t.pos+e.length,l),no&&ro<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==c.charCodeAt(e.length-1),i||r||s||h||a){var x=i||"";r&&(x+=r),s&&(x+=s);var w=n("span",[l],x,a);return o&&(w.title=o),t.content.appendChild(w)}t.content.appendChild(l)}}function ge(t,e){if(t.length>1&&!/ /.test(t))return t;for(var i=e,n="",r=0;r<t.length;r++){var s=t.charAt(r);" "!=s||!i||r!=t.length-1&&32!=t.charCodeAt(r+1)||(s=" "),n+=s,i=" "==s}return n}function me(t,e){return function(i,n,r,s,o,a,l){r=r?r+" cm-force-border":"cm-force-border";for(var c=i.pos,u=c+n.length;;){for(var h=void 0,d=0;d<e.length&&(h=e[d],!(h.to>c&&h.from<=c));d++);if(h.to>=u)return t(i,n,r,s,o,a,l);t(i,n.slice(0,h.to-c),r,s,null,a,l),s=null,n=n.slice(h.to-c),c=h.to}}}function ve(t,e,i,n){var r=!n&&i.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!n&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",i.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function ye(t,e,i){var n=t.markedSpans,r=t.text,s=0;if(n)for(var o,a,l,c,u,h,d,f=r.length,p=0,g=1,m="",v=0;;){if(v==p){l=c=u=h=a="",d=null,v=1/0;for(var y=[],b=void 0,x=0;x<n.length;++x){var w=n[x],C=w.marker;"bookmark"==C.type&&w.from==p&&C.widgetNode?y.push(C):w.from<=p&&(null==w.to||w.to>p||C.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,c=""),C.className&&(l+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&w.from==p&&(u+=" "+C.startStyle),C.endStyle&&w.to==v&&(b||(b=[])).push(C.endStyle,w.to),C.title&&!h&&(h=C.title),C.collapsed&&(!d||nt(d.marker,C)<0)&&(d=w)):w.from>p&&v>w.from&&(v=w.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(c+=" "+b[k]);if(!d||d.from==p)for(var S=0;S<y.length;++S)ve(e,0,y[S]);if(d&&(d.from||0)==p){if(ve(e,(null==d.to?f+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(p>=f)break;for(var T=Math.min(f,v);;){if(m){var M=p+m.length;if(!d){var E=M>T?m.slice(0,T-p):m;e.addToken(e,E,o?o+l:l,u,p+E.length==v?c:"",h,a)}if(M>=T){m=m.slice(T-p),p=T;break}p=M,u=""}m=r.slice(s,s=i[g++]),o=he(i[g++],e.cm.options)}}else for(var P=1;P<i.length;P+=2)e.addToken(e,r.slice(s,s=i[P]),he(i[P+1],e.cm.options))}function be(t,e,i){this.line=e,this.rest=ct(e),this.size=this.rest?$(g(this.rest))-i+1:1,this.node=this.text=null,this.hidden=dt(t,e)}function xe(t,e,i){for(var n,r=[],s=e;s<i;s=n){var o=new be(t.doc,T(t.doc,s),s);n=s+o.size,r.push(o)}return r}function we(t){Zo?Zo.ops.push(t):t.ownsGroup=Zo={ops:[t],delayedCallbacks:[]}}function Ce(t){var e=t.delayedCallbacks,i=0;do{for(;i<e.length;i++)e[i].call(null);for(var n=0;n<t.ops.length;n++){var r=t.ops[n];if(r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}}while(i<e.length)}function ke(t,e){var i=t.ownsGroup;if(i)try{Ce(i)}finally{Zo=null,e(i)}}function Se(t,e){var i=Pt(t,e);if(i.length){var n,r=Array.prototype.slice.call(arguments,2);Zo?n=Zo.delayedCallbacks:Qo?n=Qo:(n=Qo=[],setTimeout(Te,0));for(var s=0;s<i.length;++s)!function(t){n.push(function(){return i[t].apply(null,r)})}(s)}}function Te(){var t=Qo;Qo=null;for(var e=0;e<t.length;++e)t[e]()}function Me(t,e,i,n){for(var r=0;r<e.changes.length;r++){var s=e.changes[r];"text"==s?Le(t,e):"gutter"==s?Ne(t,e,i,n):"class"==s?Ae(e):"widget"==s&&Oe(t,e,n)}e.changes=null}function Ee(t){return t.node==t.text&&(t.node=n("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),no&&ro<8&&(t.node.style.zIndex=2)),t.node}function Pe(t){var e=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(e&&(e+=" CodeMirror-linebackground"),t.background)e?t.background.className=e:(t.background.parentNode.removeChild(t.background),t.background=null);else if(e){var i=Ee(t);t.background=i.insertBefore(n("div",null,e),i.firstChild)}}function $e(t,e){var i=t.display.externalMeasured;return i&&i.line==e.line?(t.display.externalMeasured=null,e.measure=i.measure,i.built):de(t,e)}function Le(t,e){var i=e.text.className,n=$e(t,e);e.text==e.node&&(e.node=n.pre),e.text.parentNode.replaceChild(n.pre,e.text),e.text=n.pre,n.bgClass!=e.bgClass||n.textClass!=e.textClass?(e.bgClass=n.bgClass,e.textClass=n.textClass,Ae(e)):i&&(e.text.className=i)}function Ae(t){Pe(t),t.line.wrapClass?Ee(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var e=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=e||""}function Ne(t,e,i,r){if(e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null),e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null),e.line.gutterClass){var s=Ee(e);e.gutterBackground=n("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,"left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),s.insertBefore(e.gutterBackground,e.text)}var o=e.line.gutterMarkers;if(t.options.lineNumbers||o){var a=Ee(e),l=e.gutter=n("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(t.display.input.setUneditable(l),a.insertBefore(l,e.text),e.line.gutterClass&&(l.className+=" "+e.line.gutterClass),!t.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(e.lineNumber=l.appendChild(n("div",N(t.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),o)for(var c=0;c<t.options.gutters.length;++c){var u=t.options.gutters[c],h=o.hasOwnProperty(u)&&o[u];h&&l.appendChild(n("div",[h],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function Oe(t,e,i){e.alignable&&(e.alignable=null);for(var n=e.node.firstChild,r=void 0;n;n=r)r=n.nextSibling,"CodeMirror-linewidget"==n.className&&e.node.removeChild(n);Ie(t,e,i)}function De(t,e,i,n){var r=$e(t,e);return e.text=e.node=r.pre,r.bgClass&&(e.bgClass=r.bgClass),r.textClass&&(e.textClass=r.textClass),Ae(e),Ne(t,e,i,n),Ie(t,e,n),e.node}function Ie(t,e,i){if(_e(t,e.line,e,i,!0),e.rest)for(var n=0;n<e.rest.length;n++)_e(t,e.rest[n],e,i,!1)}function _e(t,e,i,r,s){if(e.widgets)for(var o=Ee(i),a=0,l=e.widgets;a<l.length;++a){var c=l[a],u=n("div",[c.node],"CodeMirror-linewidget");c.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),ze(c,u,i,r),t.display.input.setUneditable(u),s&&c.above?o.insertBefore(u,i.gutter||i.text):o.appendChild(u),Se(c,"redraw")}}function ze(t,e,i,n){if(t.noHScroll){(i.alignable||(i.alignable=[])).push(e);var r=n.wrapperWidth;e.style.left=n.fixedPos+"px",t.coverGutter||(r-=n.gutterTotalWidth,e.style.paddingLeft=n.gutterTotalWidth+"px"),e.style.width=r+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-n.gutterTotalWidth+"px"))}function He(t){if(null!=t.height)return t.height;var e=t.doc.cm;if(!e)return 0;if(!r(document.body,t.node)){var s="position: relative;";t.coverGutter&&(s+="margin-left: -"+e.display.gutters.offsetWidth+"px;"),t.noHScroll&&(s+="width: "+e.display.wrapper.clientWidth+"px;"),i(e.display.measure,n("div",[t.node],null,s))}return t.height=t.node.parentNode.offsetHeight}function Fe(t,e){for(var i=Ft(e);i!=t.wrapper;i=i.parentNode)if(!i||1==i.nodeType&&"true"==i.getAttribute("cm-ignore-events")||i.parentNode==t.sizer&&i!=t.mover)return!0}function Re(t){return t.lineSpace.offsetTop}function Ve(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Be(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=i(t.measure,n("pre","x")),r=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,s={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(s.left)||isNaN(s.right)||(t.cachedPaddingH=s),s}function We(t){return Mo-t.display.nativeBarWidth}function je(t){return t.display.scroller.clientWidth-We(t)-t.display.barWidth}function Ue(t){return t.display.scroller.clientHeight-We(t)-t.display.barHeight}function qe(t,e,i){var n=t.options.lineWrapping,r=n&&je(t);if(!e.measure.heights||n&&e.measure.width!=r){var s=e.measure.heights=[];if(n){e.measure.width=r;for(var o=e.text.firstChild.getClientRects(),a=0;a<o.length-1;a++){var l=o[a],c=o[a+1];Math.abs(l.bottom-c.bottom)>2&&s.push((l.bottom+c.top)/2-i.top)}}s.push(i.bottom-i.top)}}function Ke(t,e,i){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var n=0;n<t.rest.length;n++)if(t.rest[n]==e)return{map:t.measure.maps[n],cache:t.measure.caches[n]};for(var r=0;r<t.rest.length;r++)if($(t.rest[r])>i)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function Ge(t,e){e=lt(e);var n=$(e),r=t.display.externalMeasured=new be(t.doc,e,n);r.lineN=n;var s=r.built=de(t,r);return r.text=s.pre,i(t.display.lineMeasure,s.pre),r}function Ye(t,e,i,n){return Ze(t,Je(t,e),i,n)}function Xe(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[ki(t,e)];var i=t.display.externalMeasured;return i&&e>=i.lineN&&e<i.lineN+i.size?i:void 0}function Je(t,e){var i=$(e),n=Xe(t,i);n&&!n.text?n=null:n&&n.changes&&(Me(t,n,i,yi(t)),t.curOp.forceUpdate=!0),n||(n=Ge(t,e));var r=Ke(n,e,i);return{line:e,view:n,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function Ze(t,e,i,n,r){e.before&&(i=-1);var s,o=i+(n||"");return e.cache.hasOwnProperty(o)?s=e.cache[o]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(qe(t,e.view,e.rect),e.hasHeights=!0),s=ei(t,e,i,n),s.bogus||(e.cache[o]=s)),{left:s.left,right:s.right,top:r?s.rtop:s.top,bottom:r?s.rbottom:s.bottom}}function Qe(t,e,i){for(var n,r,s,o,a,l,c=0;c<t.length;c+=3)if(a=t[c],l=t[c+1],e<a?(r=0,s=1,o="left"):e<l?(r=e-a,s=r+1):(c==t.length-3||e==l&&t[c+3]>e)&&(s=l-a,r=s-1,e>=l&&(o="right")),null!=r){if(n=t[c+2],a==l&&i==(n.insertLeft?"left":"right")&&(o=i),"left"==i&&0==r)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)n=t[2+(c-=3)],o="left";if("right"==i&&r==l-a)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)n=t[(c+=3)+2],o="right";break}return{node:n,start:r,end:s,collapse:o,coverStart:a,coverEnd:l}}function ti(t,e){var i=ta;if("left"==e)for(var n=0;n<t.length&&(i=t[n]).left==i.right;n++);else for(var r=t.length-1;r>=0&&(i=t[r]).left==i.right;r--);return i}function ei(t,e,i,n){var r,s=Qe(e.map,i,n),o=s.node,a=s.start,l=s.end,c=s.collapse;if(3==o.nodeType){for(var u=0;u<4;u++){for(;a&&k(e.line.text.charAt(s.coverStart+a));)--a;for(;s.coverStart+l<s.coverEnd&&k(e.line.text.charAt(s.coverStart+l));)++l;if(r=no&&ro<9&&0==a&&l==s.coverEnd-s.coverStart?o.parentNode.getBoundingClientRect():ti(bo(o,a,l).getClientRects(),n),r.left||r.right||0==a)break;l=a,a-=1,c="right"}no&&ro<11&&(r=ii(t.display.measure,r))}else{a>0&&(c=n="right");var h;r=t.options.lineWrapping&&(h=o.getClientRects()).length>1?h["right"==n?h.length-1:0]:o.getBoundingClientRect()}if(no&&ro<9&&!a&&(!r||!r.left&&!r.right)){var d=o.parentNode.getClientRects()[0];r=d?{left:d.left,right:d.left+vi(t.display),top:d.top,bottom:d.bottom}:ta}for(var f=r.top-e.rect.top,p=r.bottom-e.rect.top,g=(f+p)/2,m=e.view.measure.heights,v=0;v<m.length-1&&!(g<m[v]);v++);var y=v?m[v-1]:0,b=m[v],x={left:("right"==c?r.right:r.left)-e.rect.left,right:("left"==c?r.left:r.right)-e.rect.left,top:y,bottom:b};return r.left||r.right||(x.bogus=!0),t.options.singleCursorHeightPerLine||(x.rtop=f,x.rbottom=p),x}function ii(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Wt(t))return e;var i=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*i,right:e.right*i,top:e.top*n,bottom:e.bottom*n}}function ni(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function ri(t){t.display.externalMeasure=null,e(t.display.lineMeasure);for(var i=0;i<t.display.view.length;i++)ni(t.display.view[i])}function si(t){ri(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function oi(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ai(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function li(t,e,i,n,r){if(!r&&e.widgets)for(var s=0;s<e.widgets.length;++s)if(e.widgets[s].above){var o=He(e.widgets[s]);i.top+=o,i.bottom+=o}if("line"==n)return i;n||(n="local");var a=pt(e);if("local"==n?a+=Re(t.display):a-=t.display.viewOffset,"page"==n||"window"==n){var l=t.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:ai());var c=l.left+("window"==n?0:oi());i.left+=c,i.right+=c}return i.top+=a,i.bottom+=a,i}function ci(t,e,i){if("div"==i)return e;var n=e.left,r=e.top;if("page"==i)n-=oi(),r-=ai();else if("local"==i||!i){var s=t.display.sizer.getBoundingClientRect();n+=s.left,r+=s.top}var o=t.display.lineSpace.getBoundingClientRect();return{left:n-o.left,top:r-o.top}}function ui(t,e,i,n,r){return n||(n=T(t.doc,e.line)),li(t,n,Ye(t,n,e.ch,r),i)}function hi(t,e,i,n,r,s){function o(e,o){var a=Ze(t,r,e,o?"right":"left",s);return o?a.left=a.right:a.right=a.left,li(t,n,a,i)}function a(t,e){var i=l[e],n=i.level%2;return t==yt(i)&&e&&i.level<l[e-1].level?(i=l[--e],t=bt(i)-(i.level%2?0:1),n=!0):t==bt(i)&&e<l.length-1&&i.level<l[e+1].level&&(i=l[++e],t=yt(i)-i.level%2,n=!1),n&&t==i.to&&t>i.from?o(t-1):o(t,n)}n=n||T(t.doc,e.line),r||(r=Je(t,n));var l=Et(n),c=e.ch;if(!l)return o(c);var u=kt(l,c),h=a(c,u);return null!=_o&&(h.other=a(c,_o)),h}function di(t,e){var i=0;e=F(t.doc,e),t.options.lineWrapping||(i=vi(t.display)*e.ch);var n=T(t.doc,e.line),r=pt(n)+Re(t.display);return{left:i,right:i,top:r,bottom:r+n.height}}function fi(t,e,i,n){var r=O(t,e);return r.xRel=n,i&&(r.outside=!0),r}function pi(t,e,i){var n=t.doc;if((i+=t.display.viewOffset)<0)return fi(n.first,0,!0,-1);var r=L(n,i),s=n.first+n.size-1;if(r>s)return fi(n.first+n.size-1,T(n,s).text.length,!0,1);e<0&&(e=0);for(var o=T(n,r);;){var a=gi(t,o,r,e,i),l=ot(o),c=l&&l.find(0,!0);if(!l||!(a.ch>c.from.ch||a.ch==c.from.ch&&a.xRel>0))return a;r=$(o=c.to.line)}}function gi(t,e,i,n,r){function s(n){var r=hi(t,O(i,n),"line",e,c);return a=!0,o>r.bottom?r.left-l:o<r.top?r.left+l:(a=!1,r.left)}var o=r-pt(e),a=!1,l=2*t.display.wrapper.clientWidth,c=Je(t,e),u=Et(e),h=e.text.length,d=xt(e),f=wt(e),p=s(d),g=a,m=s(f),v=a;if(n>m)return fi(i,f,v,1);for(;;){if(u?f==d||f==Tt(e,d,1):f-d<=1){var y=n<p||n-p<=m-n?d:f,b=y==d?g:v,x=n-(y==d?p:m);if(v&&!u&&!/\s/.test(e.text.charAt(y))&&x>0&&y<e.text.length&&c.view.measure.heights.length>1){var w=Ze(t,c,y,"right");o<=w.bottom&&o>=w.top&&Math.abs(n-w.right)<x&&(b=!1,y++,x=n-w.right)}for(;k(e.text.charAt(y));)++y;return fi(i,y,b,x<-1?-1:x>1?1:0)}var C=Math.ceil(h/2),S=d+C;if(u){S=d;for(var T=0;T<C;++T)S=Tt(e,S,1)}var M=s(S);M>n?(f=S,m=M,(v=a)&&(m+=1e3),h=C):(d=S,p=M,g=a,h-=C)}}function mi(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==Yo){Yo=n("pre");for(var r=0;r<49;++r)Yo.appendChild(document.createTextNode("x")),Yo.appendChild(n("br"));Yo.appendChild(document.createTextNode("x"))}i(t.measure,Yo);var s=Yo.offsetHeight/50;return s>3&&(t.cachedTextHeight=s),e(t.measure),s||1}function vi(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=n("span","xxxxxxxxxx"),r=n("pre",[e]);i(t.measure,r);var s=e.getBoundingClientRect(),o=(s.right-s.left)/10;return o>2&&(t.cachedCharWidth=o),o||10}function yi(t){for(var e=t.display,i={},n={},r=e.gutters.clientLeft,s=e.gutters.firstChild,o=0;s;s=s.nextSibling,++o)i[t.options.gutters[o]]=s.offsetLeft+s.clientLeft+r,n[t.options.gutters[o]]=s.clientWidth;return{fixedPos:bi(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:e.wrapper.clientWidth}}function bi(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function xi(t){var e=mi(t.display),i=t.options.lineWrapping,n=i&&Math.max(5,t.display.scroller.clientWidth/vi(t.display)-3);return function(r){if(dt(t.doc,r))return 0;var s=0;if(r.widgets)for(var o=0;o<r.widgets.length;o++)r.widgets[o].height&&(s+=r.widgets[o].height);return i?s+(Math.ceil(r.text.length/n)||1)*e:s+e}}function wi(t){var e=t.doc,i=xi(t);e.iter(function(t){var e=i(t);e!=t.height&&P(t,e)})}function Ci(t,e,i,n){var r=t.display;if(!i&&"true"==Ft(e).getAttribute("cm-not-content"))return null;var s,o,a=r.lineSpace.getBoundingClientRect();try{s=e.clientX-a.left,o=e.clientY-a.top}catch(e){return null}var l,c=pi(t,s,o);if(n&&1==c.xRel&&(l=T(t.doc,c.line).text).length==c.ch){var h=u(l,l.length,t.options.tabSize)-l.length;c=O(c.line,Math.max(0,Math.round((s-Be(t.display).left)/vi(t.display))-h))}return c}function ki(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var i=t.display.view,n=0;n<i.length;n++)if((e-=i[n].size)<0)return n}function Si(t){t.display.input.showSelection(t.display.input.prepareSelection())}function Ti(t,e){for(var i=t.doc,n={},r=n.cursors=document.createDocumentFragment(),s=n.selection=document.createDocumentFragment(),o=0;o<i.sel.ranges.length;o++)if(!1!==e||o!=i.sel.primIndex){var a=i.sel.ranges[o];if(!(a.from().line>=t.display.viewTo||a.to().line<t.display.viewFrom)){var l=a.empty();(l||t.options.showCursorWhenSelecting)&&Mi(t,a.head,r),l||Ei(t,a,s)}}return n}function Mi(t,e,i){var r=hi(t,e,"div",null,null,!t.options.singleCursorHeightPerLine),s=i.appendChild(n("div"," ","CodeMirror-cursor"));if(s.style.left=r.left+"px",s.style.top=r.top+"px",s.style.height=Math.max(0,r.bottom-r.top)*t.options.cursorHeight+"px",r.other){var o=i.appendChild(n("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function Ei(t,e,i){function r(t,e,i,r){e<0&&(e=0),e=Math.round(e),r=Math.round(r),l.appendChild(n("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+e+"px; width: "+(null==i?h-t:i)+"px;\n height: "+(r-e)+"px"))}function s(e,i,n){function s(i,n){return ui(t,O(e,i),"div",c,n)}var o,l,c=T(a,e),d=c.text.length;return vt(Et(c),i||0,null==n?d:n,function(t,e,a){var c,f,p,g=s(t,"left");if(t==e)c=g,f=p=g.left;else{if(c=s(e-1,"right"),"rtl"==a){var m=g;g=c,c=m}f=g.left,p=c.right}null==i&&0==t&&(f=u),c.top-g.top>3&&(r(f,g.top,null,g.bottom),f=u,g.bottom<c.top&&r(f,g.bottom,null,c.top)),null==n&&e==d&&(p=h),(!o||g.top<o.top||g.top==o.top&&g.left<o.left)&&(o=g),(!l||c.bottom>l.bottom||c.bottom==l.bottom&&c.right>l.right)&&(l=c),f<u+1&&(f=u),r(f,c.top,p-f,c.bottom)}),{start:o,end:l}}var o=t.display,a=t.doc,l=document.createDocumentFragment(),c=Be(t.display),u=c.left,h=Math.max(o.sizerWidth,je(t)-o.sizer.offsetLeft)-c.right,d=e.from(),f=e.to();if(d.line==f.line)s(d.line,d.ch,f.ch);else{var p=T(a,d.line),g=T(a,f.line),m=lt(p)==lt(g),v=s(d.line,d.ch,m?p.text.length+1:null).end,y=s(f.line,m?0:null,f.ch).start;m&&(v.top<y.top-2?(r(v.right,v.top,null,v.bottom),r(u,y.top,y.left,y.bottom)):r(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&r(u,v.bottom,null,y.top)}i.appendChild(l)}function Pi(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var i=!0;e.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?e.blinker=setInterval(function(){return e.cursorDiv.style.visibility=(i=!i)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function $i(t){t.state.focused||(t.display.input.focus(),Ai(t))}function Li(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,Ni(t))},100)}function Ai(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(Lt(t,"focus",t,e),t.state.focused=!0,o(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),so&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Pi(t))}function Ni(t,e){t.state.delayingBlurEvent||(t.state.focused&&(Lt(t,"blur",t,e),t.state.focused=!1,Co(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function Oi(t){var e=t.display,i=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var n=bi(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,s=n+"px",o=0;o<i.length;o++)if(!i[o].hidden){t.options.fixedGutter&&(i[o].gutter&&(i[o].gutter.style.left=s),i[o].gutterBackground&&(i[o].gutterBackground.style.left=s));var a=i[o].alignable;if(a)for(var l=0;l<a.length;l++)a[l].style.left=s}t.options.fixedGutter&&(e.gutters.style.left=n+r+"px")}}function Di(t){if(!t.options.lineNumbers)return!1;var e=t.doc,i=N(t.options,e.first+e.size-1),r=t.display;if(i.length!=r.lineNumChars){var s=r.measure.appendChild(n("div",[n("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=s.firstChild.offsetWidth,a=s.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",$n(t),!0}return!1}function Ii(t){for(var e=t.display,i=e.lineDiv.offsetTop,n=0;n<e.view.length;n++){var r=e.view[n],s=void 0;if(!r.hidden){if(no&&ro<8){var o=r.node.offsetTop+r.node.offsetHeight;s=o-i,i=o}else{var a=r.node.getBoundingClientRect();s=a.bottom-a.top}var l=r.line.height-s;if(s<2&&(s=mi(e)),(l>.001||l<-.001)&&(P(r.line,s),_i(r.line),r.rest))for(var c=0;c<r.rest.length;c++)_i(r.rest[c])}}}function _i(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e)t.widgets[e].height=t.widgets[e].node.parentNode.offsetHeight}function zi(t,e,i){var n=i&&null!=i.top?Math.max(0,i.top):t.scroller.scrollTop;n=Math.floor(n-Re(t));var r=i&&null!=i.bottom?i.bottom:n+t.wrapper.clientHeight,s=L(e,n),o=L(e,r);if(i&&i.ensure){var a=i.ensure.from.line,l=i.ensure.to.line;a<s?(s=a,o=L(e,pt(T(e,a))+t.wrapper.clientHeight)):Math.min(l,e.lastLine())>=o&&(s=L(e,pt(T(e,l))-t.wrapper.clientHeight),o=l)}return{from:s,to:Math.max(o,s+1)}}function Hi(t,e){Math.abs(t.doc.scrollTop-e)<2||(t.doc.scrollTop=e,to||En(t,{top:e}),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e),t.display.scrollbars.setScrollTop(e),to&&En(t),wn(t,100))}function Fi(t,e,i){(i?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)||(e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),t.doc.scrollLeft=e,Oi(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function Ri(t){var e=t.wheelDeltaX,i=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==i&&t.detail&&t.axis==t.VERTICAL_AXIS?i=t.detail:null==i&&(i=t.wheelDelta),{x:e,y:i}}function Vi(t){var e=Ri(t);return e.x*=ia,e.y*=ia,e}function Bi(t,e){var i=Ri(e),n=i.x,r=i.y,s=t.display,o=s.scroller,a=o.scrollWidth>o.clientWidth,l=o.scrollHeight>o.clientHeight;if(n&&a||r&&l){if(r&&go&&so)t:for(var c=e.target,u=s.view;c!=o;c=c.parentNode)for(var h=0;h<u.length;h++)if(u[h].node==c){t.display.currentWheelTarget=c;break t}if(n&&!to&&!lo&&null!=ia)return r&&l&&Hi(t,Math.max(0,Math.min(o.scrollTop+r*ia,o.scrollHeight-o.clientHeight))),Fi(t,Math.max(0,Math.min(o.scrollLeft+n*ia,o.scrollWidth-o.clientWidth))),(!r||r&&l)&&It(e),void(s.wheelStartX=null);if(r&&null!=ia){var d=r*ia,f=t.doc.scrollTop,p=f+s.wrapper.clientHeight;d<0?f=Math.max(0,f+d-50):p=Math.min(t.doc.height,p+d+50),En(t,{top:f,bottom:p})}ea<20&&(null==s.wheelStartX?(s.wheelStartX=o.scrollLeft,s.wheelStartY=o.scrollTop,s.wheelDX=n,s.wheelDY=r,setTimeout(function(){if(null!=s.wheelStartX){var t=o.scrollLeft-s.wheelStartX,e=o.scrollTop-s.wheelStartY,i=e&&s.wheelDY&&e/s.wheelDY||t&&s.wheelDX&&t/s.wheelDX;s.wheelStartX=s.wheelStartY=null,i&&(ia=(ia*ea+i)/(ea+1),++ea)}},200)):(s.wheelDX+=n,s.wheelDY+=r))}}function Wi(t){var e=t.display,i=e.gutters.offsetWidth,n=Math.round(t.doc.height+Ve(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?i:0,docHeight:n,scrollHeight:n+We(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:i}}function ji(t,e,i){this.cm=i;var r=this.vert=n("div",[n("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),s=this.horiz=n("div",[n("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");t(r),t(s),Fo(r,"scroll",function(){r.clientHeight&&e(r.scrollTop,"vertical")}),Fo(s,"scroll",function(){s.clientWidth&&e(s.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,no&&ro<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function Ui(){}function qi(t,e){e||(e=Wi(t));var i=t.display.barWidth,n=t.display.barHeight;Ki(t,e);for(var r=0;r<4&&i!=t.display.barWidth||n!=t.display.barHeight;r++)i!=t.display.barWidth&&t.options.lineWrapping&&Ii(t),Ki(t,Wi(t)),i=t.display.barWidth,n=t.display.barHeight}function Ki(t,e){var i=t.display,n=i.scrollbars.update(e);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=e.gutterWidth+"px"):i.gutterFiller.style.display=""}function Gi(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Co(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new na[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Fo(e,"mousedown",function(){t.state.focused&&setTimeout(function(){return t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,i){"horizontal"==i?Fi(t,e):Hi(t,e)},t),t.display.scrollbars.addClass&&o(t.display.wrapper,t.display.scrollbars.addClass)}function Yi(t,e){if(!At(t,"scrollCursorIntoView")){var i=t.display,r=i.sizer.getBoundingClientRect(),s=null;if(e.top+r.top<0?s=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(s=!1),null!=s&&!ho){var o=n("div","",null,"position: absolute;\n top: "+(e.top-i.viewOffset-Re(t.display))+"px;\n height: "+(e.bottom-e.top+We(t)+i.barHeight)+"px;\n left: "+e.left+"px; width: 2px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(s),t.display.lineSpace.removeChild(o)}}}function Xi(t,e,i,n){null==n&&(n=0);for(var r,s=0;s<5;s++){var o=!1;r=hi(t,e);var a=i&&i!=e?hi(t,i):r,l=Zi(t,Math.min(r.left,a.left),Math.min(r.top,a.top)-n,Math.max(r.left,a.left),Math.max(r.bottom,a.bottom)+n),c=t.doc.scrollTop,u=t.doc.scrollLeft;if(null!=l.scrollTop&&(Hi(t,l.scrollTop),Math.abs(t.doc.scrollTop-c)>1&&(o=!0)),null!=l.scrollLeft&&(Fi(t,l.scrollLeft),Math.abs(t.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return r}function Ji(t,e,i,n,r){var s=Zi(t,e,i,n,r);null!=s.scrollTop&&Hi(t,s.scrollTop),null!=s.scrollLeft&&Fi(t,s.scrollLeft)}function Zi(t,e,i,n,r){var s=t.display,o=mi(t.display);i<0&&(i=0);var a=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:s.scroller.scrollTop,l=Ue(t),c={};r-i>l&&(r=i+l);var u=t.doc.height+Ve(s),h=i<o,d=r>u-o;if(i<a)c.scrollTop=h?0:i;else if(r>a+l){var f=Math.min(i,(d?u:r)-l);f!=a&&(c.scrollTop=f)}var p=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:s.scroller.scrollLeft,g=je(t)-(t.options.fixedGutter?s.gutters.offsetWidth:0),m=n-e>g;return m&&(n=e+g),e<10?c.scrollLeft=0:e<p?c.scrollLeft=Math.max(0,e-(m?0:10)):n>g+p-3&&(c.scrollLeft=n+(m?0:10)-g),c}function Qi(t,e,i){null==e&&null==i||en(t),null!=e&&(t.curOp.scrollLeft=(null==t.curOp.scrollLeft?t.doc.scrollLeft:t.curOp.scrollLeft)+e),null!=i&&(t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+i)}function tn(t){en(t);var e=t.getCursor(),i=e,n=e;t.options.lineWrapping||(i=e.ch?O(e.line,e.ch-1):e,n=O(e.line,e.ch+1)),t.curOp.scrollToPos={from:i,to:n,margin:t.options.cursorScrollMargin,isCursor:!0}}function en(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var i=di(t,e.from),n=di(t,e.to),r=Zi(t,Math.min(i.left,n.left),Math.min(i.top,n.top)-e.margin,Math.max(i.right,n.right),Math.max(i.bottom,n.bottom)+e.margin);t.scrollTo(r.scrollLeft,r.scrollTop)}}function nn(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++ra},we(t.curOp)}function rn(t){ke(t.curOp,function(t){for(var e=0;e<t.ops.length;e++)t.ops[e].cm.curOp=null;sn(t)})}function sn(t){for(var e=t.ops,i=0;i<e.length;i++)on(e[i]);for(var n=0;n<e.length;n++)an(e[n]);for(var r=0;r<e.length;r++)ln(e[r]);for(var s=0;s<e.length;s++)cn(e[s]);for(var o=0;o<e.length;o++)un(e[o])}function on(t){var e=t.cm,i=e.display;Sn(e),t.updateMaxLine&&mt(e),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<i.viewFrom||t.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new kn(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function an(t){t.updatedDisplay=t.mustUpdate&&Tn(t.cm,t.update)}function ln(t){var e=t.cm,i=e.display;t.updatedDisplay&&Ii(e),t.barMeasure=Wi(e),i.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Ye(e,i.maxLine,i.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+t.adjustWidthTo+We(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+t.adjustWidthTo-je(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=i.input.prepareSelection(t.focus))}function cn(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&Fi(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1);var i=t.focus&&t.focus==s()&&(!document.hasFocus||document.hasFocus());t.preparedSelection&&e.display.input.showSelection(t.preparedSelection,i),(t.updatedDisplay||t.startHeight!=e.doc.height)&&qi(e,t.barMeasure),t.updatedDisplay&&Ln(e,t.barMeasure),t.selectionChanged&&Pi(e),e.state.focused&&t.updateInput&&e.display.input.reset(t.typing),i&&$i(t.cm)}function un(t){var e=t.cm,i=e.display,n=e.doc;if(t.updatedDisplay&&Mn(e,t.update),null==i.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(i.wheelStartX=i.wheelStartY=null),null==t.scrollTop||i.scroller.scrollTop==t.scrollTop&&!t.forceScroll||(n.scrollTop=Math.max(0,Math.min(i.scroller.scrollHeight-i.scroller.clientHeight,t.scrollTop)),i.scrollbars.setScrollTop(n.scrollTop),i.scroller.scrollTop=n.scrollTop),null==t.scrollLeft||i.scroller.scrollLeft==t.scrollLeft&&!t.forceScroll||(n.scrollLeft=Math.max(0,Math.min(i.scroller.scrollWidth-i.scroller.clientWidth,t.scrollLeft)),i.scrollbars.setScrollLeft(n.scrollLeft),i.scroller.scrollLeft=n.scrollLeft,Oi(e)),t.scrollToPos){var r=Xi(e,F(n,t.scrollToPos.from),F(n,t.scrollToPos.to),t.scrollToPos.margin);t.scrollToPos.isCursor&&e.state.focused&&Yi(e,r)}var s=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(s)for(var a=0;a<s.length;++a)s[a].lines.length||Lt(s[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&Lt(o[l],"unhide");i.wrapper.offsetHeight&&(n.scrollTop=e.display.scroller.scrollTop),t.changeObjs&&Lt(e,"changes",e,t.changeObjs),t.update&&t.update.finish()}function hn(t,e){if(t.curOp)return e();nn(t);try{return e()}finally{rn(t)}}function dn(t,e){return function(){if(t.curOp)return e.apply(t,arguments);nn(t);try{return e.apply(t,arguments)}finally{rn(t)}}}function fn(t){return function(){if(this.curOp)return t.apply(this,arguments);nn(this);try{return t.apply(this,arguments)}finally{rn(this)}}}function pn(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);nn(e);try{return t.apply(this,arguments)}finally{rn(e)}}}function gn(t,e,i,n){null==e&&(e=t.doc.first),null==i&&(i=t.doc.first+t.doc.size),n||(n=0);var r=t.display;if(n&&i<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>e)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)Io&&ut(t.doc,e)<r.viewTo&&vn(t);else if(i<=r.viewFrom)Io&&ht(t.doc,i+n)>r.viewFrom?vn(t):(r.viewFrom+=n,r.viewTo+=n);else if(e<=r.viewFrom&&i>=r.viewTo)vn(t);else if(e<=r.viewFrom){var s=yn(t,i,i+n,1);s?(r.view=r.view.slice(s.index),r.viewFrom=s.lineN,r.viewTo+=n):vn(t)}else if(i>=r.viewTo){var o=yn(t,e,e,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):vn(t)}else{var a=yn(t,e,e,-1),l=yn(t,i,i+n,1);a&&l?(r.view=r.view.slice(0,a.index).concat(xe(t,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=n):vn(t)}var c=r.externalMeasured;c&&(i<c.lineN?c.lineN+=n:e<c.lineN+c.size&&(r.externalMeasured=null))}function mn(t,e,i){t.curOp.viewChanged=!0;var n=t.display,r=t.display.externalMeasured;if(r&&e>=r.lineN&&e<r.lineN+r.size&&(n.externalMeasured=null),!(e<n.viewFrom||e>=n.viewTo)){var s=n.view[ki(t,e)];if(null!=s.node){var o=s.changes||(s.changes=[]);-1==d(o,i)&&o.push(i)}}}function vn(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function yn(t,e,i,n){var r,s=ki(t,e),o=t.display.view;if(!Io||i==t.doc.first+t.doc.size)return{index:s,lineN:i};for(var a=t.display.viewFrom,l=0;l<s;l++)a+=o[l].size;if(a!=e){if(n>0){if(s==o.length-1)return null;r=a+o[s].size-e,s++}else r=a-e;e+=r,i+=r}for(;ut(t.doc,i)!=i;){if(s==(n<0?0:o.length-1))return null;i+=n*o[s-(n<0?1:0)].size,s+=n}return{index:s,lineN:i}}function bn(t,e,i){var n=t.display;0==n.view.length||e>=n.viewTo||i<=n.viewFrom?(n.view=xe(t,e,i),n.viewFrom=e):(n.viewFrom>e?n.view=xe(t,e,n.viewFrom).concat(n.view):n.viewFrom<e&&(n.view=n.view.slice(ki(t,e))),n.viewFrom=e,n.viewTo<i?n.view=n.view.concat(xe(t,n.viewTo,i)):n.viewTo>i&&(n.view=n.view.slice(0,ki(t,i)))),n.viewTo=i}function xn(t){for(var e=t.display.view,i=0,n=0;n<e.length;n++){var r=e[n];r.hidden||r.node&&!r.changes||++i}return i}function wn(t,e){t.doc.mode.startState&&t.doc.frontier<t.display.viewTo&&t.state.highlight.set(e,l(Cn,t))}function Cn(t){var e=t.doc;if(e.frontier<e.first&&(e.frontier=e.first),!(e.frontier>=t.display.viewTo)){var i=+new Date+t.options.workTime,n=Yt(e.mode,te(t,e.frontier)),r=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.viewTo+500),function(s){if(e.frontier>=t.display.viewFrom){var o=s.styles,a=s.text.length>t.options.maxHighlightLength,l=Zt(t,s,a?Yt(e.mode,n):n,!0);s.styles=l.styles;var c=s.styleClasses,u=l.classes;u?s.styleClasses=u:c&&(s.styleClasses=null);for(var h=!o||o.length!=s.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!h&&d<o.length;++d)h=o[d]!=s.styles[d];h&&r.push(e.frontier),s.stateAfter=a?n:Yt(e.mode,n)}else s.text.length<=t.options.maxHighlightLength&&ee(t,s.text,n),s.stateAfter=e.frontier%5==0?Yt(e.mode,n):null;if(++e.frontier,+new Date>i)return wn(t,t.options.workDelay),!0}),r.length&&hn(t,function(){for(var e=0;e<r.length;e++)mn(t,r[e],"text")})}}function kn(t,e,i){var n=t.display;this.viewport=e,this.visible=zi(n,t.doc,e),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=je(t),this.force=i,this.dims=yi(t),this.events=[]}function Sn(t){var e=t.display;!e.scrollbarsClipped&&e.scroller.offsetWidth&&(e.nativeBarWidth=e.scroller.offsetWidth-e.scroller.clientWidth,e.heightForcer.style.height=We(t)+"px",e.sizer.style.marginBottom=-e.nativeBarWidth+"px",e.sizer.style.borderRightWidth=We(t)+"px",e.scrollbarsClipped=!0)}function Tn(t,i){var n=t.display,r=t.doc;if(i.editorIsHidden)return vn(t),!1;if(!i.force&&i.visible.from>=n.viewFrom&&i.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==xn(t))return!1;Di(t)&&(vn(t),i.dims=yi(t));var o=r.first+r.size,a=Math.max(i.visible.from-t.options.viewportMargin,r.first),l=Math.min(o,i.visible.to+t.options.viewportMargin);n.viewFrom<a&&a-n.viewFrom<20&&(a=Math.max(r.first,n.viewFrom)),n.viewTo>l&&n.viewTo-l<20&&(l=Math.min(o,n.viewTo)),Io&&(a=ut(t.doc,a),l=ht(t.doc,l));var c=a!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=i.wrapperHeight||n.lastWrapWidth!=i.wrapperWidth;bn(t,a,l),n.viewOffset=pt(T(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var u=xn(t);if(!c&&0==u&&!i.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var h=s();return u>4&&(n.lineDiv.style.display="none"),Pn(t,n.updateLineNumbers,i.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,h&&s()!=h&&h.offsetHeight&&h.focus(),e(n.cursorDiv),e(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,c&&(n.lastWrapHeight=i.wrapperHeight,n.lastWrapWidth=i.wrapperWidth,wn(t,400)),n.updateLineNumbers=null,!0}function Mn(t,e){for(var i=e.viewport,n=!0;(n&&t.options.lineWrapping&&e.oldDisplayWidth!=je(t)||(i&&null!=i.top&&(i={top:Math.min(t.doc.height+Ve(t.display)-Ue(t),i.top)}),e.visible=zi(t.display,t.doc,i),!(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)))&&Tn(t,e);n=!1){Ii(t);var r=Wi(t);Si(t),qi(t,r),Ln(t,r)}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 En(t,e){var i=new kn(t,e);if(Tn(t,i)){Ii(t),Mn(t,i);var n=Wi(t);Si(t),qi(t,n),Ln(t,n),i.finish()}}function Pn(t,i,n){function r(e){var i=e.nextSibling;return so&&go&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),i}for(var s=t.display,o=t.options.lineNumbers,a=s.lineDiv,l=a.firstChild,c=s.view,u=s.viewFrom,h=0;h<c.length;h++){var f=c[h];if(f.hidden);else if(f.node&&f.node.parentNode==a){for(;l!=f.node;)l=r(l);var p=o&&null!=i&&i<=u&&f.lineNumber;f.changes&&(d(f.changes,"gutter")>-1&&(p=!1),Me(t,f,u,n)),p&&(e(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(N(t.options,u)))),l=f.node.nextSibling}else{var g=De(t,f,u,n);a.insertBefore(g,l)}u+=f.size}for(;l;)l=r(l)}function $n(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px"}function Ln(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+We(t)+"px"}function An(t){var i=t.display.gutters,r=t.options.gutters;e(i);for(var s=0;s<r.length;++s){var o=r[s],a=i.appendChild(n("div",null,"CodeMirror-gutter "+o));"CodeMirror-linenumbers"==o&&(t.display.lineGutter=a,a.style.width=(t.display.lineNumWidth||1)+"px")}i.style.display=s?"":"none",$n(t)}function Nn(t){var e=d(t.gutters,"CodeMirror-linenumbers");-1==e&&t.lineNumbers?t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]):e>-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function On(t,e){this.ranges=t,this.primIndex=e}function Dn(t,e){this.anchor=t,this.head=e}function In(t,e){var i=t[e];t.sort(function(t,e){return D(t.from(),e.from())}),e=d(t,i);for(var n=1;n<t.length;n++){var r=t[n],s=t[n-1];if(D(s.to(),r.from())>=0){var o=z(s.from(),r.from()),a=_(s.to(),r.to()),l=s.empty()?r.from()==r.head:s.from()==s.head;n<=e&&--e,t.splice(--n,2,new Dn(l?a:o,l?o:a))}}return new On(t,e)}function _n(t,e){return new On([new Dn(t,e||t)],0)}function zn(t){return t.text?O(t.from.line+t.text.length-1,g(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Hn(t,e){if(D(t,e.from)<0)return t;if(D(t,e.to)<=0)return zn(e);var i=t.line+e.text.length-(e.to.line-e.from.line)-1,n=t.ch;return t.line==e.to.line&&(n+=zn(e).ch-e.to.ch),O(i,n)}function Fn(t,e){for(var i=[],n=0;n<t.sel.ranges.length;n++){var r=t.sel.ranges[n];i.push(new Dn(Hn(r.anchor,e),Hn(r.head,e)))}return In(i,t.sel.primIndex)}function Rn(t,e,i){return t.line==e.line?O(i.line,t.ch-e.ch+i.ch):O(i.line+(t.line-e.line),t.ch)}function Vn(t,e,i){for(var n=[],r=O(t.first,0),s=r,o=0;o<e.length;o++){var a=e[o],l=Rn(a.from,r,s),c=Rn(zn(a),r,s);if(r=a.to,s=c,"around"==i){var u=t.sel.ranges[o],h=D(u.head,u.anchor)<0;n[o]=new Dn(h?c:l,h?l:c)}else n[o]=new Dn(l,l)}return new On(n,t.sel.primIndex)}function Bn(t){t.doc.mode=Kt(t.options,t.doc.modeOption),Wn(t)}function Wn(t){t.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),t.doc.frontier=t.doc.first,wn(t,100),t.state.modeGen++,t.curOp&&gn(t)}function jn(t,e){return 0==e.from.ch&&0==e.to.ch&&""==g(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function Un(t,e,i,n){function r(t){return i?i[t]:null}function s(t,i,r){ce(t,i,r,n),Se(t,"change",t,e)}function o(t,e){for(var i=[],s=t;s<e;++s)i.push(new le(c[s],r(s),n));return i}var a=e.from,l=e.to,c=e.text,u=T(t,a.line),h=T(t,l.line),d=g(c),f=r(c.length-1),p=l.line-a.line;if(e.full)t.insert(0,o(0,c.length)),t.remove(c.length,t.size-c.length);else if(jn(t,e)){var m=o(0,c.length-1);s(h,h.text,f),p&&t.remove(a.line,p),m.length&&t.insert(a.line,m)}else if(u==h)if(1==c.length)s(u,u.text.slice(0,a.ch)+d+u.text.slice(l.ch),f);else{var v=o(1,c.length-1);v.push(new le(d+u.text.slice(l.ch),f,n)),s(u,u.text.slice(0,a.ch)+c[0],r(0)),t.insert(a.line+1,v)}else if(1==c.length)s(u,u.text.slice(0,a.ch)+c[0]+h.text.slice(l.ch),r(0)),t.remove(a.line+1,p);else{s(u,u.text.slice(0,a.ch)+c[0],r(0)),s(h,d+h.text.slice(l.ch),f);var y=o(1,c.length-1);p>1&&t.remove(a.line+1,p-1),t.insert(a.line+1,y)}Se(t,"change",t,e)}function qn(t,e,i){function n(t,r,s){if(t.linked)for(var o=0;o<t.linked.length;++o){var a=t.linked[o];if(a.doc!=r){var l=s&&a.sharedHist;i&&!l||(e(a.doc,l),n(a.doc,t,l))}}}n(t,null,!0)}function Kn(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,wi(t),Bn(t),t.options.lineWrapping||mt(t),t.options.mode=e.modeOption,gn(t)}function Gn(t){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t||1}function Yn(t,e){var i={from:I(e.from),to:zn(e),text:M(t,e.from,e.to)};return ir(t,i,e.from.line,e.to.line+1),qn(t,function(t){return ir(t,i,e.from.line,e.to.line+1)},!0),i}function Xn(t){for(;t.length;){if(!g(t).ranges)break;t.pop()}}function Jn(t,e){return e?(Xn(t.done),g(t.done)):t.done.length&&!g(t.done).ranges?g(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),g(t.done)):void 0}function Zn(t,e,i,n){var r=t.history;r.undone.length=0;var s,o,a=+new Date;if((r.lastOp==n||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&r.lastModTime>a-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))&&(s=Jn(r,r.lastOp==n)))o=g(s.changes),0==D(e.from,e.to)&&0==D(e.from,o.to)?o.to=zn(e):s.changes.push(Yn(t,e));else{var l=g(r.done);for(l&&l.ranges||er(t.sel,r.done),s={changes:[Yn(t,e)],generation:r.generation},r.done.push(s);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(i),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=e.origin,o||Lt(t,"historyAdded")}function Qn(t,e,i,n){var r=e.charAt(0);return"*"==r||"+"==r&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function tr(t,e,i,n){var r=t.history,s=n&&n.origin;i==r.lastSelOp||s&&r.lastSelOrigin==s&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==s||Qn(t,s,g(r.done),e))?r.done[r.done.length-1]=e:er(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=s,r.lastSelOp=i,n&&!1!==n.clearRedo&&Xn(r.undone)}function er(t,e){var i=g(e);i&&i.ranges&&i.equals(t)||e.push(t)}function ir(t,e,i,n){var r=e["spans_"+t.id],s=0;t.iter(Math.max(t.first,i),Math.min(t.first+t.size,n),function(i){i.markedSpans&&((r||(r=e["spans_"+t.id]={}))[s]=i.markedSpans),++s})}function nr(t){if(!t)return null;for(var e,i=0;i<t.length;++i)t[i].marker.explicitlyCleared?e||(e=t.slice(0,i)):e&&e.push(t[i]);return e?e.length?e:null:t}function rr(t,e){var i=e["spans_"+t.id];if(!i)return null;for(var n=[],r=0;r<e.text.length;++r)n.push(nr(i[r]));return n}function sr(t,e){var i=rr(t,e),n=X(t,e);if(!i)return n;if(!n)return i;for(var r=0;r<i.length;++r){var s=i[r],o=n[r];if(s&&o)t:for(var a=0;a<o.length;++a){for(var l=o[a],c=0;c<s.length;++c)if(s[c].marker==l.marker)continue t;s.push(l)}else o&&(i[r]=o)}return i}function or(t,e,i){for(var n=[],r=0;r<t.length;++r){var s=t[r];if(s.ranges)n.push(i?On.prototype.deepCopy.call(s):s);else{var o=s.changes,a=[];n.push({changes:a});for(var l=0;l<o.length;++l){var c=o[l],u=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),e)for(var h in c)(u=h.match(/^spans_(\d+)$/))&&d(e,Number(u[1]))>-1&&(g(a)[h]=c[h],delete c[h])}}}return n}function ar(t,e,i,n){if(t.cm&&t.cm.display.shift||t.extend){var r=e.anchor;if(n){var s=D(i,r)<0;s!=D(n,r)<0?(r=i,i=n):s!=D(i,n)<0&&(i=n)}return new Dn(r,i)}return new Dn(n||i,i)}function lr(t,e,i,n){pr(t,new On([ar(t,t.sel.primary(),e,i)],0),n)}function cr(t,e,i){for(var n=[],r=0;r<t.sel.ranges.length;r++)n[r]=ar(t,t.sel.ranges[r],e[r],null);pr(t,In(n,t.sel.primIndex),i)}function ur(t,e,i,n){var r=t.sel.ranges.slice(0);r[e]=i,pr(t,In(r,t.sel.primIndex),n)}function hr(t,e,i,n){pr(t,_n(e,i),n)}function dr(t,e,i){var n={ranges:e.ranges,update:function(e){var i=this;this.ranges=[];for(var n=0;n<e.length;n++)i.ranges[n]=new Dn(F(t,e[n].anchor),F(t,e[n].head))},origin:i&&i.origin};return Lt(t,"beforeSelectionChange",t,n),t.cm&&Lt(t.cm,"beforeSelectionChange",t.cm,n),n.ranges!=e.ranges?In(n.ranges,n.ranges.length-1):e}function fr(t,e,i){var n=t.history.done,r=g(n);r&&r.ranges?(n[n.length-1]=e,gr(t,e,i)):pr(t,e,i)}function pr(t,e,i){gr(t,e,i),tr(t,t.sel,t.cm?t.cm.curOp.id:NaN,i)}function gr(t,e,i){(Ot(t,"beforeSelectionChange")||t.cm&&Ot(t.cm,"beforeSelectionChange"))&&(e=dr(t,e,i)),mr(t,yr(t,e,i&&i.bias||(D(e.primary().head,t.sel.primary().head)<0?-1:1),!0)),i&&!1===i.scroll||!t.cm||tn(t.cm)}function mr(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=t.cm.curOp.selectionChanged=!0,Nt(t.cm)),Se(t,"cursorActivity",t))}function vr(t){mr(t,yr(t,t.sel,null,!1),Po)}function yr(t,e,i,n){for(var r,s=0;s<e.ranges.length;s++){var o=e.ranges[s],a=e.ranges.length==t.sel.ranges.length&&t.sel.ranges[s],l=xr(t,o.anchor,a&&a.anchor,i,n),c=xr(t,o.head,a&&a.head,i,n);(r||l!=o.anchor||c!=o.head)&&(r||(r=e.ranges.slice(0,s)),r[s]=new Dn(l,c))}return r?In(r,e.primIndex):e}function br(t,e,i,n,r){var s=T(t,e.line);if(s.markedSpans)for(var o=0;o<s.markedSpans.length;++o){var a=s.markedSpans[o],l=a.marker;if((null==a.from||(l.inclusiveLeft?a.from<=e.ch:a.from<e.ch))&&(null==a.to||(l.inclusiveRight?a.to>=e.ch:a.to>e.ch))){if(r&&(Lt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(s.markedSpans){--o;continue}break}if(!l.atomic)continue;if(i){var c=l.find(n<0?1:-1),u=void 0;if((n<0?l.inclusiveRight:l.inclusiveLeft)&&(c=wr(t,c,-n,c&&c.line==e.line?s:null)),c&&c.line==e.line&&(u=D(c,i))&&(n<0?u<0:u>0))return br(t,c,e,n,r)}var h=l.find(n<0?-1:1);return(n<0?l.inclusiveLeft:l.inclusiveRight)&&(h=wr(t,h,n,h.line==e.line?s:null)),h?br(t,h,e,n,r):null}}return e}function xr(t,e,i,n,r){var s=n||1,o=br(t,e,i,s,r)||!r&&br(t,e,i,s,!0)||br(t,e,i,-s,r)||!r&&br(t,e,i,-s,!0);return o||(t.cantEdit=!0,O(t.first,0))}function wr(t,e,i,n){return i<0&&0==e.ch?e.line>t.first?F(t,O(e.line-1)):null:i>0&&e.ch==(n||T(t,e.line)).text.length?e.line<t.first+t.size-1?O(e.line+1,0):null:new O(e.line,e.ch+i)}function Cr(t){t.setSelection(O(t.firstLine(),0),O(t.lastLine()),Po)}function kr(t,e,i){var n={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return n.canceled=!0}};return i&&(n.update=function(e,i,r,s){e&&(n.from=F(t,e)),i&&(n.to=F(t,i)),r&&(n.text=r),void 0!==s&&(n.origin=s)}),Lt(t,"beforeChange",t,n),t.cm&&Lt(t.cm,"beforeChange",t.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Sr(t,e,i){if(t.cm){if(!t.cm.curOp)return dn(t.cm,Sr)(t,e,i);if(t.cm.state.suppressEdits)return}if(!(Ot(t,"beforeChange")||t.cm&&Ot(t.cm,"beforeChange"))||(e=kr(t,e,!0))){var n=Do&&!i&&Z(t,e.from,e.to);if(n)for(var r=n.length-1;r>=0;--r)Tr(t,{from:n[r].from,to:n[r].to,text:r?[""]:e.text});else Tr(t,e)}}function Tr(t,e){if(1!=e.text.length||""!=e.text[0]||0!=D(e.from,e.to)){var i=Fn(t,e);Zn(t,e,i,t.cm?t.cm.curOp.id:NaN),Pr(t,e,i,X(t,e));var n=[];qn(t,function(t,i){i||-1!=d(n,t.history)||(Or(t.history,e),n.push(t.history)),Pr(t,e,null,X(t,e))})}}function Mr(t,e,i){if(!t.cm||!t.cm.state.suppressEdits||i){for(var n,r=t.history,s=t.sel,o="undo"==e?r.done:r.undone,a="undo"==e?r.undone:r.done,l=0;l<o.length&&(n=o[l],i?!n.ranges||n.equals(t.sel):n.ranges);l++);if(l!=o.length){for(r.lastOrigin=r.lastSelOrigin=null;n=o.pop(),n.ranges;){if(er(n,a),i&&!n.equals(t.sel))return void pr(t,n,{clearRedo:!1});s=n}var c=[];er(s,a),a.push({changes:c,generation:r.generation}),r.generation=n.generation||++r.maxGeneration;for(var u=Ot(t,"beforeChange")||t.cm&&Ot(t.cm,"beforeChange"),h=n.changes.length-1;h>=0;--h){var f=function(i){var r=n.changes[i];if(r.origin=e,u&&!kr(t,r,!1))return o.length=0,{};c.push(Yn(t,r));var s=i?Fn(t,r):g(o);Pr(t,r,s,sr(t,r)),!i&&t.cm&&t.cm.scrollIntoView({from:r.from,to:zn(r)});var a=[];qn(t,function(t,e){e||-1!=d(a,t.history)||(Or(t.history,r),a.push(t.history)),Pr(t,r,null,sr(t,r))})}(h);if(f)return f.v}}}}function Er(t,e){if(0!=e&&(t.first+=e,t.sel=new On(m(t.sel.ranges,function(t){return new Dn(O(t.anchor.line+e,t.anchor.ch),O(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){gn(t.cm,t.first,t.first-e,e);for(var i=t.cm.display,n=i.viewFrom;n<i.viewTo;n++)mn(t.cm,n,"gutter")}}function Pr(t,e,i,n){if(t.cm&&!t.cm.curOp)return dn(t.cm,Pr)(t,e,i,n);if(e.to.line<t.first)return void Er(t,e.text.length-1-(e.to.line-e.from.line));if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var r=e.text.length-1-(t.first-e.from.line);Er(t,r),e={from:O(t.first,0),to:O(e.to.line+r,e.to.ch),text:[g(e.text)],origin:e.origin}}var s=t.lastLine();e.to.line>s&&(e={from:e.from,to:O(s,T(t,s).text.length),text:[e.text[0]],origin:e.origin}),e.removed=M(t,e.from,e.to),i||(i=Fn(t,e)),t.cm?$r(t.cm,e,n):Un(t,e,n),gr(t,i,Po)}}function $r(t,e,i){var n=t.doc,r=t.display,s=e.from,o=e.to,a=!1,l=s.line;t.options.lineWrapping||(l=$(lt(T(n,s.line))),n.iter(l,o.line+1,function(t){if(t==r.maxLine)return a=!0,!0})),n.sel.contains(e.from,e.to)>-1&&Nt(t),Un(n,e,i,xi(t)),t.options.lineWrapping||(n.iter(l,s.line+e.text.length,function(t){var e=gt(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,a=!1)}),a&&(t.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,s.line),wn(t,400);var c=e.text.length-(o.line-s.line)-1;e.full?gn(t):s.line!=o.line||1!=e.text.length||jn(t.doc,e)?gn(t,s.line,o.line+1,c):mn(t,s.line,"text");var u=Ot(t,"changes"),h=Ot(t,"change");if(h||u){var d={from:s,to:o,text:e.text,removed:e.removed,origin:e.origin};h&&Se(t,"change",t,d),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(d)}t.display.selForContextMenu=null}function Lr(t,e,i,n,r){if(n||(n=i),D(n,i)<0){var s=n;n=i,i=s}"string"==typeof e&&(e=t.splitLines(e)),Sr(t,{from:i,to:n,text:e,origin:r})}function Ar(t,e,i,n){i<t.line?t.line+=n:e<t.line&&(t.line=e,t.ch=0)}function Nr(t,e,i,n){for(var r=0;r<t.length;++r){var s=t[r],o=!0;if(s.ranges){s.copied||(s=t[r]=s.deepCopy(),s.copied=!0);for(var a=0;a<s.ranges.length;a++)Ar(s.ranges[a].anchor,e,i,n),Ar(s.ranges[a].head,e,i,n)}else{for(var l=0;l<s.changes.length;++l){var c=s.changes[l];if(i<c.from.line)c.from=O(c.from.line+n,c.from.ch),c.to=O(c.to.line+n,c.to.ch);else if(e<=c.to.line){o=!1;break}}o||(t.splice(0,r+1),r=0)}}}function Or(t,e){var i=e.from.line,n=e.to.line,r=e.text.length-(n-i)-1;Nr(t.done,i,n,r),Nr(t.undone,i,n,r)}function Dr(t,e,i,n){var r=e,s=e;return"number"==typeof e?s=T(t,H(t,e)):r=$(e),null==r?null:(n(s,r)&&t.cm&&mn(t.cm,r,i),s)}function Ir(t){var e=this;this.lines=t,this.parent=null;for(var i=0,n=0;n<t.length;++n)t[n].parent=e,i+=t[n].height;this.height=i}function _r(t){var e=this;this.children=t;for(var i=0,n=0,r=0;r<t.length;++r){var s=t[r];i+=s.chunkSize(),n+=s.height,s.parent=e}this.size=i,this.height=n,this.parent=null}function zr(t,e,i){var n=this;if(i)for(var r in i)i.hasOwnProperty(r)&&(n[r]=i[r]);this.doc=t,this.node=e}function Hr(t,e,i){pt(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&Qi(t,null,i)}function Fr(t,e,i,n){var r=new zr(t,i,n),s=t.cm;return s&&r.noHScroll&&(s.display.alignWidgets=!0),Dr(t,e,"widget",function(e){var i=e.widgets||(e.widgets=[]);if(null==r.insertAt?i.push(r):i.splice(Math.min(i.length-1,Math.max(0,r.insertAt)),0,r),r.line=e,s&&!dt(t,e)){var n=pt(e)<t.scrollTop;P(e,e.height+He(r)),n&&Qi(s,null,r.height),s.curOp.forceUpdate=!0}return!0}),r}function Rr(t,e){this.lines=[],this.type=e,this.doc=t,this.id=++sa}function Vr(t,e,i,r,s){if(r&&r.shared)return Wr(t,e,i,r,s);if(t.cm&&!t.cm.curOp)return dn(t.cm,Vr)(t,e,i,r,s);var o=new Rr(t,s),a=D(e,i);if(r&&c(r,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=n("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(at(t,e.line,e,i,o)||e.line!=i.line&&at(t,i.line,e,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");W()}o.addToHistory&&Zn(t,{from:e,to:i,origin:"markText"},t.sel,NaN);var l,u=e.line,h=t.cm;if(t.iter(u,i.line+1,function(t){h&&o.collapsed&&!h.options.lineWrapping&<(t)==h.display.maxLine&&(l=!0),o.collapsed&&u!=e.line&&P(t,0),K(t,new j(o,u==e.line?e.ch:null,u==i.line?i.ch:null)),++u}),o.collapsed&&t.iter(e.line,i.line+1,function(e){dt(t,e)&&P(e,0)}),o.clearOnEnter&&Fo(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(B(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++sa,o.atomic=!0),h){if(l&&(h.curOp.updateMaxLine=!0),o.collapsed)gn(h,e.line,i.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var d=e.line;d<=i.line;d++)mn(h,d,"text");o.atomic&&vr(h.doc),Se(h,"markerAdded",h,o)}return o}function Br(t,e){var i=this;this.markers=t,this.primary=e;for(var n=0;n<t.length;++n)t[n].parent=i}function Wr(t,e,i,n,r){n=c(n),n.shared=!1;var s=[Vr(t,e,i,n,r)],o=s[0],a=n.widgetNode;return qn(t,function(t){a&&(n.widgetNode=a.cloneNode(!0)),s.push(Vr(t,F(t,e),F(t,i),n,r));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;o=g(s)}),new Br(s,o)}function jr(t){return t.findMarks(O(t.first,0),t.clipPos(O(t.lastLine())),function(t){return t.parent})}function Ur(t,e){for(var i=0;i<e.length;i++){var n=e[i],r=n.find(),s=t.clipPos(r.from),o=t.clipPos(r.to);if(D(s,o)){var a=Vr(t,s,o,n.primary,n.primary.type);n.markers.push(a),a.parent=n}}}function qr(t){for(var e=0;e<t.length;e++)!function(e){var i=t[e],n=[i.primary.doc];qn(i.primary.doc,function(t){return n.push(t)});for(var r=0;r<i.markers.length;r++){var s=i.markers[r];-1==d(n,s.doc)&&(s.parent=null,i.markers.splice(r--,1))}}(e)}function Kr(t){var e=this;if(Xr(e),!At(e,t)&&!Fe(e.display,t)){It(t),no&&(la=+new Date);var i=Ci(e,t,!0),n=t.dataTransfer.files;if(i&&!e.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var r=n.length,s=Array(r),o=0,a=0;a<r;++a)!function(t,n){if(!e.options.allowDropFileTypes||-1!=d(e.options.allowDropFileTypes,t.type)){var a=new FileReader;a.onload=dn(e,function(){var t=a.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(t)&&(t=""),s[n]=t,++o==r){i=F(e.doc,i);var l={from:i,to:i,text:e.doc.splitLines(s.join(e.doc.lineSeparator())),origin:"paste"};Sr(e.doc,l),fr(e.doc,_n(i,zn(l)))}}),a.readAsText(t)}}(n[a],a);else{if(e.state.draggingText&&e.doc.sel.contains(i)>-1)return e.state.draggingText(t),void setTimeout(function(){return e.display.input.focus()},20);try{var l=t.dataTransfer.getData("Text");if(l){var c;if(e.state.draggingText&&!e.state.draggingText.copy&&(c=e.listSelections()),gr(e.doc,_n(i,i)),c)for(var u=0;u<c.length;++u)Lr(e.doc,"",c[u].anchor,c[u].head,"drag");e.replaceSelection(l,"around","paste"),e.display.input.focus()}}catch(t){}}}}function Gr(t,e){if(no&&(!t.state.draggingText||+new Date-la<100))return void Ht(e);if(!At(t,e)&&!Fe(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!co)){var i=n("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",lo&&(i.width=i.height=1,t.display.wrapper.appendChild(i),i._top=i.offsetTop),e.dataTransfer.setDragImage(i,0,0),lo&&i.parentNode.removeChild(i)}}function Yr(t,e){var r=Ci(t,e);if(r){var s=document.createDocumentFragment();Mi(t,r,s),t.display.dragCursor||(t.display.dragCursor=n("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),i(t.display.dragCursor,s)}}function Xr(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function Jr(t){if(document.body.getElementsByClassName)for(var e=document.body.getElementsByClassName("CodeMirror"),i=0;i<e.length;i++){var n=e[i].CodeMirror;n&&t(n)}}function Zr(){ca||(Qr(),ca=!0)}function Qr(){var t;Fo(window,"resize",function(){null==t&&(t=setTimeout(function(){t=null,Jr(ts)},100))}),Fo(window,"blur",function(){return Jr(Ni)})}function ts(t){var e=t.display;e.lastWrapHeight==e.wrapper.clientHeight&&e.lastWrapWidth==e.wrapper.clientWidth||(e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.scrollbarsClipped=!1,t.setSize())}function es(t){var e=t.split(/-(?!$)/);t=e[e.length-1];for(var i,n,r,s,o=0;o<e.length-1;o++){var a=e[o];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);r=!0}}return i&&(t="Alt-"+t),n&&(t="Ctrl-"+t),s&&(t="Cmd-"+t),r&&(t="Shift-"+t),t}function is(t){var e={};for(var i in t)if(t.hasOwnProperty(i)){var n=t[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if("..."==n){delete t[i];continue}for(var r=m(i.split(" "),es),s=0;s<r.length;s++){var o=void 0,a=void 0;s==r.length-1?(a=r.join(" "),o=n):(a=r.slice(0,s+1).join(" "),o="...");var l=e[a];if(l){if(l!=o)throw new Error("Inconsistent bindings for "+a)}else e[a]=o}delete t[i]}for(var c in e)t[c]=e[c];return t}function ns(t,e,i,n){e=os(e);var r=e.call?e.call(t,n):e[t];if(!1===r)return"nothing";if("..."===r)return"multi";if(null!=r&&i(r))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return ns(t,e.fallthrough,i,n);for(var s=0;s<e.fallthrough.length;s++){var o=ns(t,e.fallthrough[s],i,n);if(o)return o}}}function rs(t){var e="string"==typeof t?t:ua[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function ss(t,e){if(lo&&34==t.keyCode&&t.char)return!1;var i=ua[t.keyCode],n=i;return null!=n&&!t.altGraphKey&&(t.altKey&&"Alt"!=i&&(n="Alt-"+n),(xo?t.metaKey:t.ctrlKey)&&"Ctrl"!=i&&(n="Ctrl-"+n),(xo?t.ctrlKey:t.metaKey)&&"Cmd"!=i&&(n="Cmd-"+n),!e&&t.shiftKey&&"Shift"!=i&&(n="Shift-"+n),n)}function os(t){return"string"==typeof t?pa[t]:t}function as(t,e){for(var i=t.doc.sel.ranges,n=[],r=0;r<i.length;r++){for(var s=e(i[r]);n.length&&D(s.from,g(n).to)<=0;){var o=n.pop();if(D(o.from,s.from)<0){s.from=o.from;break}}n.push(s)}hn(t,function(){for(var e=n.length-1;e>=0;e--)Lr(t.doc,"",n[e].from,n[e].to,"+delete");tn(t)})}function ls(t,e){var i=T(t.doc,e),n=lt(i);n!=i&&(e=$(n));var r=Et(n);return O(e,r?r[0].level%2?wt(n):xt(n):0)}function cs(t,e){for(var i,n=T(t.doc,e);i=ot(n);)n=i.find(1,!0).line,e=null;var r=Et(n),s=r?r[0].level%2?xt(n):wt(n):n.text.length;return O(null==e?$(n):e,s)}function us(t,e){var i=ls(t,e.line),n=T(t.doc,i.line),r=Et(n);if(!r||0==r[0].level){var s=Math.max(0,n.text.search(/\S/)),o=e.line==i.line&&e.ch<=s&&e.ch;return O(i.line,o?0:s)}return i}function hs(t,e,i){if("string"==typeof e&&!(e=va[e]))return!1;t.display.input.ensurePolled();var n=t.display.shift,r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i&&(t.display.shift=!1),r=e(t)!=Eo}finally{t.display.shift=n,t.state.suppressEdits=!1}return r}function ds(t,e,i){for(var n=0;n<t.state.keyMaps.length;n++){var r=ns(e,t.state.keyMaps[n],i,t);if(r)return r}return t.options.extraKeys&&ns(e,t.options.extraKeys,i,t)||ns(e,t.options.keyMap,i,t)}function fs(t,e,i,n){var r=t.state.keySeq;if(r){if(rs(e))return"handled";ya.set(50,function(){t.state.keySeq==r&&(t.state.keySeq=null,t.display.input.reset())}),e=r+" "+e}var s=ds(t,e,n);return"multi"==s&&(t.state.keySeq=e),"handled"==s&&Se(t,"keyHandled",t,e,i),"handled"!=s&&"multi"!=s||(It(i),Pi(t)),r&&!s&&/\'$/.test(e)?(It(i),!0):!!s}function ps(t,e){var i=ss(e,!0);return!!i&&(e.shiftKey&&!t.state.keySeq?fs(t,"Shift-"+i,e,function(e){return hs(t,e,!0)})||fs(t,i,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return hs(t,e)}):fs(t,i,e,function(e){return hs(t,e)}))}function gs(t,e,i){return fs(t,"'"+i+"'",e,function(e){return hs(t,e,!0)})}function ms(t){var e=this;if(e.curOp.focus=s(),!At(e,t)){no&&ro<11&&27==t.keyCode&&(t.returnValue=!1);var i=t.keyCode;e.display.shift=16==i||t.shiftKey;var n=ps(e,t);lo&&(ba=n?i:null,!n&&88==i&&!Wo&&(go?t.metaKey:t.ctrlKey)&&e.replaceSelection("",null,"cut")),18!=i||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||vs(e)}}function vs(t){function e(t){18!=t.keyCode&&t.altKey||(Co(i,"CodeMirror-crosshair"),$t(document,"keyup",e),$t(document,"mouseover",e))}var i=t.display.lineDiv;o(i,"CodeMirror-crosshair"),Fo(document,"keyup",e),Fo(document,"mouseover",e)}function ys(t){16==t.keyCode&&(this.doc.sel.shift=!1),At(this,t)}function bs(t){var e=this;if(!(Fe(e.display,t)||At(e,t)||t.ctrlKey&&!t.altKey||go&&t.metaKey)){var i=t.keyCode,n=t.charCode;if(lo&&i==ba)return ba=null,void It(t);if(!lo||t.which&&!(t.which<10)||!ps(e,t)){var r=String.fromCharCode(null==n?i:n);"\b"!=r&&(gs(e,t,r)||e.display.input.onKeyPress(t))}}}function xs(t){var e=this,i=e.display;if(!(At(e,t)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=t.shiftKey,Fe(i,t))return void(so||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100)));if(!Ts(e,t)){var n=Ci(e,t);switch(window.focus(),Rt(t)){case 1:e.state.selectingText?e.state.selectingText(t):n?ws(e,t,n):Ft(t)==i.scroller&&It(t);break;case 2:so&&(e.state.lastMiddleDown=+new Date),n&&lr(e.doc,n),setTimeout(function(){return i.input.focus()},20),It(t);break;case 3:wo?Ms(e,t):Li(e)}}}}function ws(t,e,i){no?setTimeout(l($i,t),0):t.curOp.focus=s();var n,r=+new Date;ma&&ma.time>r-400&&0==D(ma.pos,i)?n="triple":ga&&ga.time>r-400&&0==D(ga.pos,i)?(n="double",ma={time:r,pos:i}):(n="single",ga={time:r,pos:i});var o,a=t.doc.sel,c=go?e.metaKey:e.ctrlKey;t.options.dragDrop&&Ro&&!t.isReadOnly()&&"single"==n&&(o=a.contains(i))>-1&&(D((o=a.ranges[o]).from(),i)<0||i.xRel>0)&&(D(o.to(),i)>0||i.xRel<0)?Cs(t,e,i,c):ks(t,e,i,n,c)}function Cs(t,e,i,n){var r=t.display,s=+new Date,o=dn(t,function(a){so&&(r.scroller.draggable=!1),t.state.draggingText=!1,$t(document,"mouseup",o),$t(r.scroller,"drop",o),Math.abs(e.clientX-a.clientX)+Math.abs(e.clientY-a.clientY)<10&&(It(a),!n&&+new Date-200<s&&lr(t.doc,i),so||no&&9==ro?setTimeout(function(){document.body.focus(),r.input.focus()},20):r.input.focus())});so&&(r.scroller.draggable=!0),t.state.draggingText=o,o.copy=go?e.altKey:e.ctrlKey,r.scroller.dragDrop&&r.scroller.dragDrop(),Fo(document,"mouseup",o),Fo(r.scroller,"drop",o)}function ks(t,e,i,n,r){function o(e){if(0!=D(b,e))if(b=e,"rect"==n){for(var r=[],s=t.options.tabSize,o=u(T(h,i.line).text,i.ch,s),a=u(T(h,e.line).text,e.ch,s),l=Math.min(o,a),c=Math.max(o,a),m=Math.min(i.line,e.line),v=Math.min(t.lastLine(),Math.max(i.line,e.line));m<=v;m++){var y=T(h,m).text,x=f(y,l,s);l==c?r.push(new Dn(O(m,x),O(m,x))):y.length>x&&r.push(new Dn(O(m,x),O(m,f(y,c,s))))}r.length||r.push(new Dn(i,i)),pr(h,In(g.ranges.slice(0,p).concat(r),p),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var w=d,C=w.anchor,k=e;if("single"!=n){var S;S="double"==n?t.findWordAt(e):new Dn(O(e.line,0),F(h,O(e.line+1,0))),D(S.anchor,C)>0?(k=S.head,C=z(w.from(),S.anchor)):(k=S.anchor,C=_(w.to(),S.head))}var M=g.ranges.slice(0);M[p]=new Dn(F(h,C),k),pr(h,In(M,p),$o)}}function a(e){var i=++w,r=Ci(t,e,!0,"rect"==n);if(r)if(0!=D(r,b)){t.curOp.focus=s(),o(r);var l=zi(c,h);(r.line>=l.to||r.line<l.from)&&setTimeout(dn(t,function(){w==i&&a(e)}),150)}else{var u=e.clientY<x.top?-20:e.clientY>x.bottom?20:0;u&&setTimeout(dn(t,function(){w==i&&(c.scroller.scrollTop+=u,a(e))}),50)}}function l(e){t.state.selectingText=!1,w=1/0,It(e),c.input.focus(),$t(document,"mousemove",C),$t(document,"mouseup",k),h.history.lastSelOrigin=null}var c=t.display,h=t.doc;It(e);var d,p,g=h.sel,m=g.ranges;if(r&&!e.shiftKey?(p=h.sel.contains(i),d=p>-1?m[p]:new Dn(i,i)):(d=h.sel.primary(),p=h.sel.primIndex),mo?e.shiftKey&&e.metaKey:e.altKey)n="rect",r||(d=new Dn(i,i)),i=Ci(t,e,!0,!0),p=-1;else if("double"==n){var v=t.findWordAt(i);d=t.display.shift||h.extend?ar(h,d,v.anchor,v.head):v}else if("triple"==n){var y=new Dn(O(i.line,0),F(h,O(i.line+1,0)));d=t.display.shift||h.extend?ar(h,d,y.anchor,y.head):y}else d=ar(h,d,i);r?-1==p?(p=m.length,pr(h,In(m.concat([d]),p),{scroll:!1,origin:"*mouse"})):m.length>1&&m[p].empty()&&"single"==n&&!e.shiftKey?(pr(h,In(m.slice(0,p).concat(m.slice(p+1)),0),{scroll:!1,origin:"*mouse"}),g=h.sel):ur(h,p,d,$o):(p=0,pr(h,new On([d],0),$o),g=h.sel);var b=i,x=c.wrapper.getBoundingClientRect(),w=0,C=dn(t,function(t){Rt(t)?a(t):l(t)}),k=dn(t,l);t.state.selectingText=k,Fo(document,"mousemove",C),Fo(document,"mouseup",k)}function Ss(t,e,i,n){var r,s;try{r=e.clientX,s=e.clientY}catch(e){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;n&&It(e);var o=t.display,a=o.lineDiv.getBoundingClientRect();if(s>a.bottom||!Ot(t,i))return zt(e);s-=a.top-o.viewOffset;for(var l=0;l<t.options.gutters.length;++l){var c=o.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=r){return Lt(t,i,t,L(t.doc,s),t.options.gutters[l],e),zt(e)}}}function Ts(t,e){return Ss(t,e,"gutterClick",!0)}function Ms(t,e){Fe(t.display,e)||Es(t,e)||At(t,e,"contextmenu")||t.display.input.onContextMenu(e)}function Es(t,e){return!!Ot(t,"gutterContextMenu")&&Ss(t,e,"gutterContextMenu",!1)}function Ps(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),si(t)}function $s(t){An(t),gn(t),setTimeout(function(){return Oi(t)},20)}function Ls(t,e,i){if(!e!=!(i&&i!=xa)){var n=t.display.dragFunctions,r=e?Fo:$t;r(t.display.scroller,"dragstart",n.start),r(t.display.scroller,"dragenter",n.enter),r(t.display.scroller,"dragover",n.over),r(t.display.scroller,"dragleave",n.leave),r(t.display.scroller,"drop",n.drop)}}function As(t){t.options.lineWrapping?(o(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(Co(t.display.wrapper,"CodeMirror-wrap"),mt(t)),wi(t),gn(t),si(t),setTimeout(function(){return qi(t)},100)}function Ns(t,e){var i=this;if(!(this instanceof Ns))return new Ns(t,e);this.options=e=e?c(e):{},c(wa,e,!1),Nn(e);var n=e.value;"string"==typeof n&&(n=new aa(n,e.mode,null,e.lineSeparator)),this.doc=n;var r=new Ns.inputStyles[e.inputStyle](this),s=this.display=new S(t,n,r);s.wrapper.CodeMirror=this,An(this),Ps(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),e.autofocus&&!po&&s.input.focus(),Gi(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new h,keySeq:null,specialChars:null},no&&ro<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Os(this),Zr(),nn(this),this.curOp.forceUpdate=!0,Kn(this,n),e.autofocus&&!po||this.hasFocus()?setTimeout(l(Ai,this),20):Ni(this);for(var o in Ca)Ca.hasOwnProperty(o)&&Ca[o](i,e[o],xa);Di(this),e.finishInit&&e.finishInit(this);for(var a=0;a<ka.length;++a)ka[a](i);rn(this),so&&e.lineWrapping&&"optimizelegibility"==getComputedStyle(s.lineDiv).textRendering&&(s.lineDiv.style.textRendering="auto")}function Os(t){function e(){r.activeTouch&&(s=setTimeout(function(){return r.activeTouch=null},1e3),o=r.activeTouch,o.end=+new Date)}function i(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return e.radiusX<=1&&e.radiusY<=1}function n(t,e){if(null==e.left)return!0;var i=e.left-t.left,n=e.top-t.top;return i*i+n*n>400}var r=t.display;Fo(r.scroller,"mousedown",dn(t,xs)),no&&ro<11?Fo(r.scroller,"dblclick",dn(t,function(e){if(!At(t,e)){var i=Ci(t,e);if(i&&!Ts(t,e)&&!Fe(t.display,e)){It(e);var n=t.findWordAt(i);lr(t.doc,n.anchor,n.head)}}})):Fo(r.scroller,"dblclick",function(e){return At(t,e)||It(e)}),wo||Fo(r.scroller,"contextmenu",function(e){return Ms(t,e)});var s,o={end:0};Fo(r.scroller,"touchstart",function(e){if(!At(t,e)&&!i(e)){r.input.ensurePolled(),clearTimeout(s);var n=+new Date;r.activeTouch={start:n,moved:!1,prev:n-o.end<=300?o:null},1==e.touches.length&&(r.activeTouch.left=e.touches[0].pageX,r.activeTouch.top=e.touches[0].pageY)}}),Fo(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),Fo(r.scroller,"touchend",function(i){var s=r.activeTouch;if(s&&!Fe(r,i)&&null!=s.left&&!s.moved&&new Date-s.start<300){var o,a=t.coordsChar(r.activeTouch,"page");o=!s.prev||n(s,s.prev)?new Dn(a,a):!s.prev.prev||n(s,s.prev.prev)?t.findWordAt(a):new Dn(O(a.line,0),F(t.doc,O(a.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),It(i)}e()}),Fo(r.scroller,"touchcancel",e),Fo(r.scroller,"scroll",function(){r.scroller.clientHeight&&(Hi(t,r.scroller.scrollTop),Fi(t,r.scroller.scrollLeft,!0),Lt(t,"scroll",t))}),Fo(r.scroller,"mousewheel",function(e){return Bi(t,e)}),Fo(r.scroller,"DOMMouseScroll",function(e){return Bi(t,e)}),Fo(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(e){At(t,e)||Ht(e)},over:function(e){At(t,e)||(Yr(t,e),Ht(e))},start:function(e){return Gr(t,e)},drop:dn(t,Kr),leave:function(e){At(t,e)||Xr(t)}};var a=r.input.getField();Fo(a,"keyup",function(e){return ys.call(t,e)}),Fo(a,"keydown",dn(t,ms)),Fo(a,"keypress",dn(t,bs)),Fo(a,"focus",function(e){return Ai(t,e)}),Fo(a,"blur",function(e){return Ni(t,e)})}function Ds(t,e,i,n){var r,s=t.doc;null==i&&(i="add"),"smart"==i&&(s.mode.indent?r=te(t,e):i="prev");var o=t.options.tabSize,a=T(s,e),l=u(a.text,null,o);a.stateAfter&&(a.stateAfter=null);var c,h=a.text.match(/^\s*/)[0];if(n||/\S/.test(a.text)){if("smart"==i&&((c=s.mode.indent(r,a.text.slice(h.length),a.text))==Eo||c>150)){if(!n)return;i="prev"}}else c=0,i="not";"prev"==i?c=e>s.first?u(T(s,e-1).text,null,o):0:"add"==i?c=l+t.options.indentUnit:"subtract"==i?c=l-t.options.indentUnit:"number"==typeof i&&(c=l+i),c=Math.max(0,c);var d="",f=0;if(t.options.indentWithTabs)for(var g=Math.floor(c/o);g;--g)f+=o,d+="\t";if(f<c&&(d+=p(c-f)),d!=h)return Lr(s,d,O(e,0),O(e,h.length),"+input"),a.stateAfter=null,!0;for(var m=0;m<s.sel.ranges.length;m++){var v=s.sel.ranges[m];if(v.head.line==e&&v.head.ch<h.length){var y=O(e,h.length);ur(s,m,new Dn(y,y));break}}}function Is(t){Sa=t}function _s(t,e,i,n,r){var s=t.doc;t.display.shift=!1,n||(n=s.sel);var o=t.state.pasteIncoming||"paste"==r,a=Vo(e),l=null;if(o&&n.ranges.length>1)if(Sa&&Sa.text.join("\n")==e){if(n.ranges.length%Sa.text.length==0){l=[];for(var c=0;c<Sa.text.length;c++)l.push(s.splitLines(Sa.text[c]))}}else a.length==n.ranges.length&&(l=m(a,function(t){return[t]}));for(var u,h=n.ranges.length-1;h>=0;h--){var d=n.ranges[h],f=d.from(),p=d.to();d.empty()&&(i&&i>0?f=O(f.line,f.ch-i):t.state.overwrite&&!o?p=O(p.line,Math.min(T(s,p.line).text.length,p.ch+g(a).length)):Sa&&Sa.lineWise&&Sa.text.join("\n")==e&&(f=p=O(f.line,0))),u=t.curOp.updateInput;var v={from:f,to:p,text:l?l[h%l.length]:a,origin:r||(o?"paste":t.state.cutIncoming?"cut":"+input")};Sr(t.doc,v),Se(t,"inputRead",t,v)}e&&!o&&Hs(t,e),tn(t),t.curOp.updateInput=u,t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=!1}function zs(t,e){var i=t.clipboardData&&t.clipboardData.getData("Text");if(i)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||hn(e,function(){return _s(e,i,0,null,"paste")}),!0}function Hs(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var i=t.doc.sel,n=i.ranges.length-1;n>=0;n--){var r=i.ranges[n];if(!(r.head.ch>100||n&&i.ranges[n-1].head.line==r.head.line)){var s=t.getModeAt(r.head),o=!1;if(s.electricChars){for(var a=0;a<s.electricChars.length;a++)if(e.indexOf(s.electricChars.charAt(a))>-1){o=Ds(t,r.head.line,"smart");break}}else s.electricInput&&s.electricInput.test(T(t.doc,r.head.line).text.slice(0,r.head.ch))&&(o=Ds(t,r.head.line,"smart"));o&&Se(t,"electricInput",t,r.head.line)}}}function Fs(t){for(var e=[],i=[],n=0;n<t.doc.sel.ranges.length;n++){var r=t.doc.sel.ranges[n].head.line,s={anchor:O(r,0),head:O(r+1,0)};i.push(s),e.push(t.getRange(s.anchor,s.head))}return{text:e,ranges:i}}function Rs(t,e){t.setAttribute("autocorrect","off"),t.setAttribute("autocapitalize","off"),t.setAttribute("spellcheck",!!e)}function Vs(){var t=n("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),e=n("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return so?t.style.width="1000px":t.setAttribute("wrap","off"),fo&&(t.style.border="1px solid black"),Rs(t),e}function Bs(t,e,i,n,r){function s(){var e=a+i;return!(e<t.first||e>=t.first+t.size)&&(a=e,u=T(t,e))}function o(t){var e=(r?Tt:Mt)(u,l,i,!0);if(null==e){if(t||!s())return!1;l=r?(i<0?wt:xt)(u):i<0?u.text.length:0}else l=e;return!0}var a=e.line,l=e.ch,c=i,u=T(t,a);if("char"==n)o();else if("column"==n)o(!0);else if("word"==n||"group"==n)for(var h=null,d="group"==n,f=t.cm&&t.cm.getHelper(e,"wordChars"),p=!0;!(i<0)||o(!p);p=!1){var g=u.text.charAt(l)||"\n",m=w(g,f)?"w":d&&"\n"==g?"n":!d||/\s/.test(g)?null:"p";if(!d||p||m||(m="s"),h&&h!=m){i<0&&(i=1,o());break}if(m&&(h=m),i>0&&!o(!p))break}var v=xr(t,O(a,l),e,c,!0);return D(e,v)||(v.hitSide=!0),v}function Ws(t,e,i,n){var r,s=t.doc,o=e.left;if("page"==n){var a=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(a-.5*mi(t.display),3);r=(i>0?e.bottom:e.top)+i*l}else"line"==n&&(r=i>0?e.bottom+3:e.top-3);for(var c;c=pi(t,o,r),c.outside;){if(i<0?r<=0:r>=s.height){c.hitSide=!0;break}r+=5*i}return c}function js(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new h,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Us(t,e){var i=Xe(t,e.line);if(!i||i.hidden)return null;var n=T(t.doc,e.line),r=Ke(i,n,e.line),s=Et(n),o="left";if(s){o=kt(s,e.ch)%2?"right":"left"}var a=Qe(r.map,e.ch,o);return a.offset="right"==a.collapse?a.end:a.start,a}function qs(t,e){return e&&(t.bad=!0),t}function Ks(t,e,i,n,r){function s(t){return function(e){return e.id==t}}function o(e){if(1==e.nodeType){var i=e.getAttribute("cm-text");if(null!=i)return void(a+=""==i?e.textContent.replace(/\u200b/g,""):i);var u,h=e.getAttribute("cm-marker");if(h){var d=t.findMarks(O(n,0),O(r+1,0),s(+h));return void(d.length&&(u=d[0].find())&&(a+=M(t.doc,u.from,u.to).join(c)))}if("false"==e.getAttribute("contenteditable"))return;for(var f=0;f<e.childNodes.length;f++)o(e.childNodes[f]);/^(pre|div|p)$/i.test(e.nodeName)&&(l=!0)}else if(3==e.nodeType){var p=e.nodeValue;if(!p)return;l&&(a+=c,l=!1),a+=p}}for(var a="",l=!1,c=t.doc.lineSeparator();o(e),e!=i;)e=e.nextSibling;return a}function Gs(t,e,i){var n;if(e==t.display.lineDiv){if(!(n=t.display.lineDiv.childNodes[i]))return qs(t.clipPos(O(t.display.viewTo-1)),!0);e=null,i=0}else for(n=e;;n=n.parentNode){if(!n||n==t.display.lineDiv)return null;if(n.parentNode&&n.parentNode==t.display.lineDiv)break}for(var r=0;r<t.display.view.length;r++){var s=t.display.view[r];if(s.node==n)return Ys(s,e,i)}}function Ys(t,e,i){function n(e,i,n){for(var r=-1;r<(h?h.length:0);r++)for(var s=r<0?u.map:h[r],o=0;o<s.length;o+=3){var a=s[o+2];if(a==e||a==i){var l=$(r<0?t.line:t.rest[r]),c=s[o]+n;return(n<0||a!=e)&&(c=s[o+(n?1:0)]),O(l,c)}}}var s=t.text.firstChild,o=!1;if(!e||!r(s,e))return qs(O($(t.line),0),!0);if(e==s&&(o=!0,e=s.childNodes[i],i=0,!e)){var a=t.rest?g(t.rest):t.line;return qs(O($(a),a.text.length),o)}var l=3==e.nodeType?e:null,c=e;for(l||1!=e.childNodes.length||3!=e.firstChild.nodeType||(l=e.firstChild,i&&(i=l.nodeValue.length));c.parentNode!=s;)c=c.parentNode;var u=t.measure,h=u.maps,d=n(l,c,i);if(d)return qs(d,o);for(var f=c.nextSibling,p=l?l.nodeValue.length-i:0;f;f=f.nextSibling){if(d=n(f,f.firstChild,0))return qs(O(d.line,d.ch-p),o);p+=f.textContent.length}for(var m=c.previousSibling,v=i;m;m=m.previousSibling){if(d=n(m,m.firstChild,-1))return qs(O(d.line,d.ch+v),o);v+=m.textContent.length}}function Xs(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new h,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function Js(t,e){function i(){t.value=l.getValue()}if(e=e?c(e):{},e.value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var n=s();e.autofocus=n==t||null!=t.getAttribute("autofocus")&&n==document.body}var r;if(t.form&&(Fo(t.form,"submit",i),!e.leaveSubmitMethodAlone)){var o=t.form;r=o.submit;try{var a=o.submit=function(){i(),o.submit=r,o.submit(),o.submit=a}}catch(t){}}e.finishInit=function(e){e.save=i,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,i(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&($t(t.form,"submit",i),"function"==typeof t.form.submit&&(t.form.submit=r))}},t.style.display="none";var l=Ns(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return l}var Zs=navigator.userAgent,Qs=navigator.platform,to=/gecko\/\d/i.test(Zs),eo=/MSIE \d/.test(Zs),io=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zs),no=eo||io,ro=no&&(eo?document.documentMode||6:io[1]),so=/WebKit\//.test(Zs),oo=so&&/Qt\/\d+\.\d+/.test(Zs),ao=/Chrome\//.test(Zs),lo=/Opera\//.test(Zs),co=/Apple Computer/.test(navigator.vendor),uo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Zs),ho=/PhantomJS/.test(Zs),fo=/AppleWebKit/.test(Zs)&&/Mobile\/\w+/.test(Zs),po=fo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Zs),go=fo||/Mac/.test(Qs),mo=/\bCrOS\b/.test(Zs),vo=/win/i.test(Qs),yo=lo&&Zs.match(/Version\/(\d*\.\d*)/);yo&&(yo=Number(yo[1])),yo&&yo>=15&&(lo=!1,so=!0);var bo,xo=go&&(oo||lo&&(null==yo||yo<12.11)),wo=to||no&&ro>=9,Co=function(e,i){var n=e.className,r=t(i).exec(n);if(r){var s=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(s?r[1]+s:"")}};bo=document.createRange?function(t,e,i,n){var r=document.createRange();return r.setEnd(n||t,i),r.setStart(t,e),r}:function(t,e,i){var n=document.body.createTextRange();try{n.moveToElementText(t.parentNode)}catch(t){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",e),n};var ko=function(t){t.select()};fo?ko=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:no&&(ko=function(t){try{t.select()}catch(t){}}),h.prototype.set=function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)};var So,To,Mo=30,Eo={toString:function(){return"CodeMirror.Pass"}},Po={scroll:!1},$o={origin:"*mouse"},Lo={origin:"+move"},Ao=[""],No=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Oo=/[\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]/,Do=!1,Io=!1,_o=null,zo=function(){function t(t){return t<=247?i.charAt(t):1424<=t&&t<=1524?"R":1536<=t&&t<=1773?n.charAt(t-1536):1774<=t&&t<=2220?"r":8192<=t&&t<=8203?"w":8204==t?"b":"L"}function e(t,e,i){this.level=t,this.from=e,this.to=i}var i="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;return function(i){if(!r.test(i))return!1;for(var n=i.length,c=[],u=0;u<n;++u)c.push(t(i.charCodeAt(u)));for(var h=0,d="L";h<n;++h){var f=c[h];"m"==f?c[h]=d:d=f}for(var p=0,m="L";p<n;++p){var v=c[p];"1"==v&&"r"==m?c[p]="n":o.test(v)&&(m=v,"r"==v&&(c[p]="R"))}for(var y=1,b=c[0];y<n-1;++y){var x=c[y];"+"==x&&"1"==b&&"1"==c[y+1]?c[y]="1":","!=x||b!=c[y+1]||"1"!=b&&"n"!=b||(c[y]=b),b=x}for(var w=0;w<n;++w){var C=c[w];if(","==C)c[w]="N";else if("%"==C){var k=void 0;for(k=w+1;k<n&&"%"==c[k];++k);for(var S=w&&"!"==c[w-1]||k<n&&"1"==c[k]?"1":"N",T=w;T<k;++T)c[T]=S;w=k-1}}for(var M=0,E="L";M<n;++M){var P=c[M];"L"==E&&"1"==P?c[M]="L":o.test(P)&&(E=P)}for(var $=0;$<n;++$)if(s.test(c[$])){var L=void 0;for(L=$+1;L<n&&s.test(c[L]);++L);for(var A="L"==($?c[$-1]:"L"),N="L"==(L<n?c[L]:"L"),O=A||N?"L":"R",D=$;D<L;++D)c[D]=O;$=L-1}for(var I,_=[],z=0;z<n;)if(a.test(c[z])){var H=z;for(++z;z<n&&a.test(c[z]);++z);_.push(new e(0,H,z))}else{var F=z,R=_.length;for(++z;z<n&&"L"!=c[z];++z);for(var V=F;V<z;)if(l.test(c[V])){F<V&&_.splice(R,0,new e(1,F,V));var B=V;for(++V;V<z&&l.test(c[V]);++V);_.splice(R,0,new e(2,B,V)),F=V}else++V;F<z&&_.splice(R,0,new e(1,F,z))}return 1==_[0].level&&(I=i.match(/^\s+/))&&(_[0].from=I[0].length,_.unshift(new e(0,0,I[0].length))),1==g(_).level&&(I=i.match(/\s+$/))&&(g(_).to-=I[0].length,_.push(new e(0,n-I[0].length,n))),2==_[0].level&&_.unshift(new e(1,_[0].to,_[0].to)),_[0].level!=g(_).level&&_.push(new e(_[0].level,n,n)),_}}(),Ho=[],Fo=function(t,e,i){if(t.addEventListener)t.addEventListener(e,i,!1);else if(t.attachEvent)t.attachEvent("on"+e,i);else{var n=t._handlers||(t._handlers={});n[e]=(n[e]||Ho).concat(i)}},Ro=function(){if(no&&ro<9)return!1;var t=n("div");return"draggable"in t||"dragDrop"in t}(),Vo=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,i=[],n=t.length;e<=n;){var r=t.indexOf("\n",e);-1==r&&(r=t.length);var s=t.slice(e,"\r"==t.charAt(r-1)?r-1:r),o=s.indexOf("\r");-1!=o?(i.push(s.slice(0,o)),e+=o+1):(i.push(s),e=r+1)}return i}:function(t){return t.split(/\r\n?|\n/)},Bo=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)},Wo=function(){var t=n("div");return"oncopy"in t||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),jo=null,Uo={},qo={},Ko={},Go=function(t,e){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Go.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t.test?t.test(e):t(e)))return++this.pos,e},eatWhile:function(t){for(var e=this.pos;this.eat(t););return this.pos>e},eatSpace:function(){for(var t=this,e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++t.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},backUp:function(t){this.pos-=t},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=u(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?u(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return u(this.string,null,this.tabSize)-(this.lineStart?u(this.string,this.lineStart,this.tabSize):0)},match:function(t,e,i){if("string"!=typeof t){var n=this.string.slice(this.pos).match(t);return n&&n.index>0?null:(n&&!1!==e&&(this.pos+=n[0].length),n)}var r=function(t){return i?t.toLowerCase():t};if(r(this.string.substr(this.pos,t.length))==r(t))return!1!==e&&(this.pos+=t.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}}},Dt(le),le.prototype.lineNo=function(){return $(this)};var Yo,Xo={},Jo={},Zo=null,Qo=null,ta={left:0,right:0,top:0,bottom:0},ea=0,ia=null;no?ia=-.53:to?ia=15:ao?ia=-.7:co&&(ia=-1/3),ji.prototype=c({update:function(t){var e=t.scrollWidth>t.clientWidth+1,i=t.scrollHeight>t.clientHeight+1,n=t.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=e?n+"px":"0";var r=t.viewHeight-(e?n:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=t.barLeft+"px";var s=t.viewWidth-t.barLeft-(i?n:0);this.horiz.firstChild.style.width=t.scrollWidth-t.clientWidth+s+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:e?n:0}},setScrollLeft:function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var t=go&&!uo?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new h,this.disableVert=new h},enableZeroWidthBar:function(t,e){function i(){var n=t.getBoundingClientRect();document.elementFromPoint(n.left+1,n.bottom-1)!=t?t.style.pointerEvents="none":e.set(1e3,i)}t.style.pointerEvents="auto",e.set(1e3,i)},clear:function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)}},ji.prototype),Ui.prototype=c({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},Ui.prototype);var na={native:ji,null:Ui},ra=0;kn.prototype.signal=function(t,e){Ot(t,e)&&this.events.push(arguments)},kn.prototype.finish=function(){for(var t=this,e=0;e<this.events.length;e++)Lt.apply(null,t.events[e])},On.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(t){var e=this;if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var i=0;i<this.ranges.length;i++){var n=e.ranges[i],r=t.ranges[i];if(0!=D(n.anchor,r.anchor)||0!=D(n.head,r.head))return!1}return!0},deepCopy:function(){for(var t=this,e=[],i=0;i<this.ranges.length;i++)e[i]=new Dn(I(t.ranges[i].anchor),I(t.ranges[i].head));return new On(e,this.primIndex)},somethingSelected:function(){for(var t=this,e=0;e<this.ranges.length;e++)if(!t.ranges[e].empty())return!0;return!1},contains:function(t,e){var i=this;e||(e=t);for(var n=0;n<this.ranges.length;n++){var r=i.ranges[n];if(D(e,r.from())>=0&&D(t,r.to())<=0)return n}return-1}},Dn.prototype={from:function(){return z(this.anchor,this.head)},to:function(){return _(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}},Ir.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var i=this,n=t,r=t+e;n<r;++n){var s=i.lines[n];i.height-=s.height,ue(s),Se(s,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,i){var n=this;this.height+=i,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var r=0;r<e.length;++r)e[r].parent=n},iterN:function(t,e,i){for(var n=this,r=t+e;t<r;++t)if(i(n.lines[t]))return!0}},_r.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){var i=this;this.size-=e;for(var n=0;n<this.children.length;++n){var r=i.children[n],s=r.chunkSize();if(t<s){var o=Math.min(e,s-t),a=r.height;if(r.removeInner(t,o),i.height-=a-r.height,s==o&&(i.children.splice(n--,1),r.parent=null),0==(e-=o))break;t=0}else t-=s}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof Ir))){var l=[];this.collapse(l),this.children=[new Ir(l)],this.children[0].parent=this}},collapse:function(t){for(var e=this,i=0;i<this.children.length;++i)e.children[i].collapse(t)},insertInner:function(t,e,i){var n=this;this.size+=e.length,this.height+=i;for(var r=0;r<this.children.length;++r){var s=n.children[r],o=s.chunkSize();if(t<=o){if(s.insertInner(t,e,i),s.lines&&s.lines.length>50){for(var a=s.lines.length%25+25,l=a;l<s.lines.length;){var c=new Ir(s.lines.slice(l,l+=25));s.height-=c.height,n.children.splice(++r,0,c),c.parent=n}s.lines=s.lines.slice(0,a),n.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),i=new _r(e);if(t.parent){t.size-=i.size,t.height-=i.height;var n=d(t.parent.children,t);t.parent.children.splice(n+1,0,i)}else{var r=new _r(t.children);r.parent=t,t.children=[r,i],t=r}i.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,i){for(var n=this,r=0;r<this.children.length;++r){var s=n.children[r],o=s.chunkSize();if(t<o){var a=Math.min(e,o-t);if(s.iterN(t,a,i))return!0;if(0==(e-=a))break;t=0}else t-=o}}},Dt(zr),zr.prototype.clear=function(){var t=this,e=this.doc.cm,i=this.line.widgets,n=this.line,r=$(n);if(null!=r&&i){for(var s=0;s<i.length;++s)i[s]==t&&i.splice(s--,1);i.length||(n.widgets=null);var o=He(this);P(n,Math.max(0,n.height-o)),e&&hn(e,function(){Hr(e,n,-o),mn(e,r,"widget")})}},zr.prototype.changed=function(){var t=this.height,e=this.doc.cm,i=this.line;this.height=null;var n=He(this)-t;n&&(P(i,i.height+n),e&&hn(e,function(){e.curOp.forceUpdate=!0,Hr(e,i,n)}))};var sa=0;Dt(Rr),Rr.prototype.clear=function(){var t=this;if(!this.explicitlyCleared){var e=this.doc.cm,i=e&&!e.curOp;if(i&&nn(e),Ot(this,"clear")){var n=this.find();n&&Se(this,"clear",n.from,n.to)}for(var r=null,s=null,o=0;o<this.lines.length;++o){var a=t.lines[o],l=U(a.markedSpans,t);e&&!t.collapsed?mn(e,$(a),"text"):e&&(null!=l.to&&(s=$(a)),null!=l.from&&(r=$(a))),a.markedSpans=q(a.markedSpans,l),null==l.from&&t.collapsed&&!dt(t.doc,a)&&e&&P(a,mi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=lt(t.lines[c]),h=gt(u);h>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=h,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&gn(e,r,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&vr(e.doc)),e&&Se(e,"markerCleared",e,this),i&&rn(e),this.parent&&this.parent.clear()}},Rr.prototype.find=function(t,e){var i=this;null==t&&"bookmark"==this.type&&(t=1);for(var n,r,s=0;s<this.lines.length;++s){var o=i.lines[s],a=U(o.markedSpans,i);if(null!=a.from&&(n=O(e?o:$(o),a.from),-1==t))return n;if(null!=a.to&&(r=O(e?o:$(o),a.to),1==t))return r}return n&&{from:n,to:r}},Rr.prototype.changed=function(){var t=this.find(-1,!0),e=this,i=this.doc.cm;t&&i&&hn(i,function(){var n=t.line,r=$(t.line),s=Xe(i,r);if(s&&(ni(s),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!dt(e.doc,n)&&null!=e.height){var o=e.height;e.height=null;var a=He(e)-o;a&&P(n,n.height+a)}})},Rr.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=d(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},Rr.prototype.detachLine=function(t){if(this.lines.splice(d(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},Dt(Br),Br.prototype.clear=function(){var t=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)t.markers[e].clear();Se(this,"clear")}},Br.prototype.find=function(t,e){return this.primary.find(t,e)};var oa=0,aa=function(t,e,i,n){if(!(this instanceof aa))return new aa(t,e,i,n);null==i&&(i=0),_r.call(this,[new Ir([new le("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=i;var r=O(i,0);this.sel=_n(r),this.history=new Gn(null),this.id=++oa,this.modeOption=e,this.lineSep=n,this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),Un(this,{from:r,to:r,text:t}),pr(this,_n(r),Po)};aa.prototype=b(_r.prototype,{constructor:aa,iter:function(t,e,i){i?this.iterN(t-this.first,e-t,i):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var i=0,n=0;n<e.length;++n)i+=e[n].height;this.insertInner(t-this.first,e,i)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=E(this,this.first,this.first+this.size);return!1===t?e:e.join(t||this.lineSeparator())},setValue:pn(function(t){var e=O(this.first,0),i=this.first+this.size-1;Sr(this,{from:e,to:O(i,T(this,i).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),pr(this,_n(e))}),replaceRange:function(t,e,i,n){e=F(this,e),i=i?F(this,i):e,Lr(this,t,e,i,n)},getRange:function(t,e,i){var n=M(this,F(this,t),F(this,e));return!1===i?n:n.join(i||this.lineSeparator())},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){if(A(this,t))return T(this,t)},getLineNumber:function(t){return $(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=T(this,t)),lt(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return F(this,t)},getCursor:function(t){var e=this.sel.primary();return null==t||"head"==t?e.head:"anchor"==t?e.anchor:"end"==t||"to"==t||!1===t?e.to():e.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:pn(function(t,e,i){hr(this,F(this,"number"==typeof t?O(t,e||0):t),null,i)}),setSelection:pn(function(t,e,i){hr(this,F(this,t),F(this,e||t),i)}),extendSelection:pn(function(t,e,i){lr(this,F(this,t),e&&F(this,e),i)}),extendSelections:pn(function(t,e){cr(this,V(this,t),e)}),extendSelectionsBy:pn(function(t,e){cr(this,V(this,m(this.sel.ranges,t)),e)}),setSelections:pn(function(t,e,i){var n=this;if(t.length){for(var r=[],s=0;s<t.length;s++)r[s]=new Dn(F(n,t[s].anchor),F(n,t[s].head));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),pr(this,In(r,e),i)}}),addSelection:pn(function(t,e,i){var n=this.sel.ranges.slice(0);n.push(new Dn(F(this,t),F(this,e||t))),pr(this,In(n,n.length-1),i)}),getSelection:function(t){for(var e,i=this,n=this.sel.ranges,r=0;r<n.length;r++){var s=M(i,n[r].from(),n[r].to());e=e?e.concat(s):s}return!1===t?e:e.join(t||this.lineSeparator())},getSelections:function(t){for(var e=this,i=[],n=this.sel.ranges,r=0;r<n.length;r++){var s=M(e,n[r].from(),n[r].to());!1!==t&&(s=s.join(t||e.lineSeparator())),i[r]=s}return i},replaceSelection:function(t,e,i){for(var n=[],r=0;r<this.sel.ranges.length;r++)n[r]=t;this.replaceSelections(n,e,i||"+input")},replaceSelections:pn(function(t,e,i){for(var n=this,r=[],s=this.sel,o=0;o<s.ranges.length;o++){var a=s.ranges[o];r[o]={from:a.from(),to:a.to(),text:n.splitLines(t[o]),origin:i}}for(var l=e&&"end"!=e&&Vn(this,r,e),c=r.length-1;c>=0;c--)Sr(n,r[c]);l?fr(this,l):this.cm&&tn(this.cm)}),undo:pn(function(){Mr(this,"undo")}),redo:pn(function(){Mr(this,"redo")}),undoSelection:pn(function(){Mr(this,"undo",!0)}),redoSelection:pn(function(){Mr(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,i=0,n=0;n<t.done.length;n++)t.done[n].ranges||++e;for(var r=0;r<t.undone.length;r++)t.undone[r].ranges||++i;return{undo:e,redo:i}},clearHistory:function(){this.history=new Gn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:or(this.history.done),undone:or(this.history.undone)}},setHistory:function(t){var e=this.history=new Gn(this.history.maxGeneration);e.done=or(t.done.slice(0),null,!0),e.undone=or(t.undone.slice(0),null,!0)},setGutterMarker:pn(function(t,e,i){return Dr(this,t,"gutter",function(t){var n=t.gutterMarkers||(t.gutterMarkers={});return n[e]=i,!i&&C(n)&&(t.gutterMarkers=null),!0})}),clearGutter:pn(function(t){var e=this,i=this.first;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[t]&&Dr(e,n,"gutter",function(){return n.gutterMarkers[t]=null,C(n.gutterMarkers)&&(n.gutterMarkers=null),!0}),++i})}),lineInfo:function(t){var e;if("number"==typeof t){if(!A(this,t))return null;if(e=t,!(t=T(this,t)))return null}else if(null==(e=$(t)))return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:pn(function(e,i,n){return Dr(this,e,"gutter"==i?"gutter":"class",function(e){var r="text"==i?"textClass":"background"==i?"bgClass":"gutter"==i?"gutterClass":"wrapClass";if(e[r]){if(t(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0})}),removeLineClass:pn(function(e,i,n){return Dr(this,e,"gutter"==i?"gutter":"class",function(e){var r="text"==i?"textClass":"background"==i?"bgClass":"gutter"==i?"gutterClass":"wrapClass",s=e[r];if(!s)return!1;if(null==n)e[r]=null;else{var o=s.match(t(n));if(!o)return!1;var a=o.index+o[0].length;e[r]=s.slice(0,o.index)+(o.index&&a!=s.length?" ":"")+s.slice(a)||null}return!0})}),addLineWidget:pn(function(t,e,i){return Fr(this,t,e,i)}),removeLineWidget:function(t){t.clear()},markText:function(t,e,i){return Vr(this,F(this,t),F(this,e),i,i&&i.type||"range")},setBookmark:function(t,e){var i={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared,handleMouseEvents:e&&e.handleMouseEvents};return t=F(this,t),Vr(this,t,t,i,"bookmark")},findMarksAt:function(t){t=F(this,t);var e=[],i=T(this,t.line).markedSpans;if(i)for(var n=0;n<i.length;++n){var r=i[n];(null==r.from||r.from<=t.ch)&&(null==r.to||r.to>=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,i){t=F(this,t),e=F(this,e);var n=[],r=t.line;return this.iter(t.line,e.line+1,function(s){var o=s.markedSpans;if(o)for(var a=0;a<o.length;a++){var l=o[a];null!=l.to&&r==t.line&&t.ch>=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||i&&!i(l.marker)||n.push(l.marker.parent||l.marker)}++r}),n},getAllMarks:function(){var t=[];return this.iter(function(e){var i=e.markedSpans;if(i)for(var n=0;n<i.length;++n)null!=i[n].from&&t.push(i[n].marker)}),t},posFromIndex:function(t){var e,i=this.first,n=this.lineSeparator().length;return this.iter(function(r){var s=r.text.length+n;if(s>t)return e=t,!0;t-=s,++i}),F(this,O(i,e))},indexFromPos:function(t){t=F(this,t);var e=t.ch;if(t.line<this.first||t.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,t.line,function(t){e+=t.text.length+i}),e},copy:function(t){var e=new aa(E(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,i=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<i&&(i=t.to);var n=new aa(E(this,e,i),t.mode||this.modeOption,e,this.lineSep);return t.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:t.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],Ur(n,jr(this)),n},unlinkDoc:function(t){var e=this;if(t instanceof Ns&&(t=t.doc),this.linked)for(var i=0;i<this.linked.length;++i){var n=e.linked[i];if(n.doc==t){e.linked.splice(i,1),t.unlinkDoc(e),qr(jr(e));break}}if(t.history==this.history){var r=[t.id];qn(t,function(t){return r.push(t.id)},!0),t.history=new Gn(null),t.history.done=or(this.history.done,r),t.history.undone=or(this.history.undone,r)}},iterLinkedDocs:function(t){qn(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):Vo(t)},lineSeparator:function(){return this.lineSep||"\n"}}),aa.prototype.eachLine=aa.prototype.iter;for(var la=0,ca=!1,ua={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ha=0;ha<10;ha++)ua[ha+48]=ua[ha+96]=String(ha);for(var da=65;da<=90;da++)ua[da]=String.fromCharCode(da);for(var fa=1;fa<=12;fa++)ua[fa+111]=ua[fa+63235]="F"+fa;var pa={};pa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},pa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},pa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},pa.default=go?pa.macDefault:pa.pcDefault;var ga,ma,va={selectAll:Cr,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Po)},killLine:function(t){return as(t,function(e){if(e.empty()){var i=T(t.doc,e.head.line).text.length;return e.head.ch==i&&e.head.line<t.lastLine()?{from:e.head,to:O(e.head.line+1,0)}:{from:e.head,to:O(e.head.line,i)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return as(t,function(e){return{from:O(e.from().line,0),to:F(t.doc,O(e.to().line+1,0))}})},delLineLeft:function(t){return as(t,function(t){return{from:O(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(t){return as(t,function(e){var i=t.charCoords(e.head,"div").top+5;return{from:t.coordsChar({left:0,top:i},"div"),to:e.from()}})},delWrappedLineRight:function(t){return as(t,function(e){var i=t.charCoords(e.head,"div").top+5,n=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:i},"div");return{from:e.from(),to:n}})},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(O(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(O(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return ls(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return us(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return cs(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){var i=t.charCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:i},"div")},Lo)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){var i=t.charCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:i},"div")},Lo)},goLineLeftSmart:function(t){return t.extendSelectionsBy(function(e){var i=t.charCoords(e.head,"div").top+5,n=t.coordsChar({left:0,top:i},"div");return n.ch<t.getLine(n.line).search(/\S/)?us(t,e.head):n},Lo)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"char")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var e=[],i=t.listSelections(),n=t.options.tabSize,r=0;r<i.length;r++){var s=i[r].from(),o=u(t.getLine(s.line),s.ch,n);e.push(p(n-o%n))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return hn(t,function(){for(var e=t.listSelections(),i=[],n=0;n<e.length;n++)if(e[n].empty()){var r=e[n].head,s=T(t.doc,r.line).text;if(s)if(r.ch==s.length&&(r=new O(r.line,r.ch-1)),r.ch>0)r=new O(r.line,r.ch+1),t.replaceRange(s.charAt(r.ch-1)+s.charAt(r.ch-2),O(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var o=T(t.doc,r.line-1).text;o&&(r=new O(r.line,1),t.replaceRange(s.charAt(0)+t.doc.lineSeparator()+o.charAt(o.length-1),O(r.line-1,o.length-1),r,"+transpose"))}i.push(new Dn(r,r))}t.setSelections(i)})},newlineAndIndent:function(t){return hn(t,function(){for(var e=t.listSelections(),i=e.length-1;i>=0;i--)t.replaceRange(t.doc.lineSeparator(),e[i].anchor,e[i].head,"+input");e=t.listSelections();for(var n=0;n<e.length;n++)t.indentLine(e[n].from().line,null,!0);tn(t)})},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}},ya=new h,ba=null,xa={toString:function(){return"CodeMirror.Init"}},wa={},Ca={};Ns.defaults=wa,Ns.optionHandlers=Ca;var ka=[];Ns.defineInitHook=function(t){return ka.push(t)};var Sa=null;js.prototype=c({init:function(t){function e(t){if(!At(r,t)){if(r.somethingSelected())Is({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=Fs(r);Is({lineWise:!0,text:e.text}),"cut"==t.type&&r.operation(function(){r.setSelections(e.ranges,0,Po),r.replaceSelection("",null,"cut")})}if(t.clipboardData){t.clipboardData.clearData();var i=Sa.text.join("\n");if(t.clipboardData.setData("Text",i),t.clipboardData.getData("Text")==i)return void t.preventDefault()}var o=Vs(),a=o.firstChild;r.display.lineSpace.insertBefore(o,r.display.lineSpace.firstChild),a.value=Sa.text.join("\n");var l=document.activeElement;ko(a),setTimeout(function(){r.display.lineSpace.removeChild(o),l.focus(),l==s&&n.showPrimarySelection()},50)}}var i=this,n=this,r=n.cm,s=n.div=t.lineDiv;Rs(s,r.options.spellcheck),Fo(s,"paste",function(t){At(r,t)||zs(t,r)||ro<=11&&setTimeout(dn(r,function(){n.pollContent()||gn(r)}),20)}),Fo(s,"compositionstart",function(t){i.composing={data:t.data}}),Fo(s,"compositionupdate",function(t){i.composing||(i.composing={data:t.data})}),Fo(s,"compositionend",function(t){i.composing&&(t.data!=i.composing.data&&i.readFromDOMSoon(),i.composing=null)}),Fo(s,"touchstart",function(){return n.forceCompositionEnd()}),Fo(s,"input",function(){i.composing||i.readFromDOMSoon()}),Fo(s,"copy",e),Fo(s,"cut",e)},prepareSelection:function(){var t=Ti(this.cm,!1);return t.focus=this.cm.state.focused,t},showSelection:function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},showPrimarySelection:function(){var t=window.getSelection(),e=this.cm.doc.sel.primary(),i=Gs(this.cm,t.anchorNode,t.anchorOffset),n=Gs(this.cm,t.focusNode,t.focusOffset);if(!i||i.bad||!n||n.bad||0!=D(z(i,n),e.from())||0!=D(_(i,n),e.to())){var r=Us(this.cm,e.from()),s=Us(this.cm,e.to());if(r||s){var o=this.cm.display.view,a=t.rangeCount&&t.getRangeAt(0);if(r){if(!s){var l=o[o.length-1].measure,c=l.maps?l.maps[l.maps.length-1]:l.map;s={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else r={node:o[0].measure.map[2],offset:0};var u;try{u=bo(r.node,r.offset,s.offset,s.node)}catch(t){}u&&(!to&&this.cm.state.focused?(t.collapse(r.node,r.offset),u.collapsed||(t.removeAllRanges(),t.addRange(u))):(t.removeAllRanges(),t.addRange(u)),a&&null==t.anchorNode?t.addRange(a):to&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation(function(){return t.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(t){i(this.cm.display.cursorDiv,t.cursors),i(this.cm.display.selectionDiv,t.selection)},rememberSelection:function(){var t=window.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},selectionInEditor:function(){var t=window.getSelection();if(!t.rangeCount)return!1;var e=t.getRangeAt(0).commonAncestorContainer;return r(this.div,e)},focus:function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}var e=this;this.selectionInEditor()?this.pollSelection():hn(this.cm,function(){return e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,t)},selectionChanged:function(){var t=window.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=window.getSelection(),e=this.cm;this.rememberSelection();var i=Gs(e,t.anchorNode,t.anchorOffset),n=Gs(e,t.focusNode,t.focusOffset);i&&n&&hn(e,function(){pr(e.doc,_n(i,n),Po),(i.bad||n.bad)&&(e.curOp.selectionChanged=!0)})}},pollContent:function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t=this.cm,e=t.display,i=t.doc.sel.primary(),n=i.from(),r=i.to();if(0==n.ch&&n.line>t.firstLine()&&(n=O(n.line-1,T(t.doc,n.line-1).length)),r.ch==T(t.doc,r.line).text.length&&r.line<t.lastLine()&&(r=O(r.line+1,0)),n.line<e.viewFrom||r.line>e.viewTo-1)return!1;var s,o,a;n.line==e.viewFrom||0==(s=ki(t,n.line))?(o=$(e.view[0].line),a=e.view[0].node):(o=$(e.view[s].line),a=e.view[s-1].node.nextSibling);var l,c,u=ki(t,r.line);if(u==e.view.length-1?(l=e.viewTo-1,c=e.lineDiv.lastChild):(l=$(e.view[u+1].line)-1,c=e.view[u+1].node.previousSibling),!a)return!1;for(var h=t.doc.splitLines(Ks(t,a,c,o,l)),d=M(t.doc,O(o,0),O(l,T(t.doc,l).text.length));h.length>1&&d.length>1;)if(g(h)==g(d))h.pop(),d.pop(),l--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),o++}for(var f=0,p=0,m=h[0],v=d[0],y=Math.min(m.length,v.length);f<y&&m.charCodeAt(f)==v.charCodeAt(f);)++f;for(var b=g(h),x=g(d),w=Math.min(b.length-(1==h.length?f:0),x.length-(1==d.length?f:0));p<w&&b.charCodeAt(b.length-p-1)==x.charCodeAt(x.length-p-1);)++p;h[h.length-1]=b.slice(0,b.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var C=O(o,f),k=O(l,d.length?g(d).length-p:0);return h.length>1||h[0]||D(C,k)?(Lr(t.doc,h,C,k,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&(this.composing=null,this.pollContent()||gn(this.cm),this.div.blur(),this.div.focus())},readFromDOMSoon:function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){t.readDOMTimeout=null,t.composing||!t.cm.isReadOnly()&&t.pollContent()||hn(t.cm,function(){return gn(t.cm)})},80))},setUneditable:function(t){t.contentEditable="false"},onKeyPress:function(t){t.preventDefault(),this.cm.isReadOnly()||dn(this.cm,_s)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0)},readOnlyChanged:function(t){this.div.contentEditable=String("nocursor"!=t)},onContextMenu:y,resetPosition:y,needsContentAttribute:!0},js.prototype),Xs.prototype=c({init:function(t){function e(t){if(!At(r,t)){if(r.somethingSelected())Is({lineWise:!1,text:r.getSelections()}),n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,o.value=Sa.text.join("\n"),ko(o));else{if(!r.options.lineWiseCopyCut)return;var e=Fs(r);Is({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,Po):(n.prevInput="",o.value=e.text.join("\n"),ko(o))}"cut"==t.type&&(r.state.cutIncoming=!0)}}var i=this,n=this,r=this.cm,s=this.wrapper=Vs(),o=this.textarea=s.firstChild;t.wrapper.insertBefore(s,t.wrapper.firstChild),fo&&(o.style.width="0px"),Fo(o,"input",function(){no&&ro>=9&&i.hasSelection&&(i.hasSelection=null),n.poll()}),Fo(o,"paste",function(t){At(r,t)||zs(t,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),Fo(o,"cut",e),Fo(o,"copy",e),Fo(t.scroller,"paste",function(e){Fe(t,e)||At(r,e)||(r.state.pasteIncoming=!0,n.focus())}),Fo(t.lineSpace,"selectstart",function(e){Fe(t,e)||It(e)}),Fo(o,"compositionstart",function(){var t=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Fo(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var t=this.cm,e=t.display,i=t.doc,n=Ti(t);if(t.options.moveInputWithCursor){var r=hi(t,i.sel.primary().head,"div"),s=e.wrapper.getBoundingClientRect(),o=e.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+o.top-s.top)),n.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+o.left-s.left))}return n},showSelection:function(t){var e=this.cm,n=e.display;i(n.cursorDiv,t.cursors),i(n.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},reset:function(t){if(!this.contextMenuPending){var e,i,n=this.cm,r=n.doc;if(n.somethingSelected()){this.prevInput="";var s=r.sel.primary();e=Wo&&(s.to().line-s.from().line>100||(i=n.getSelection()).length>1e3);var o=e?"-":i||n.getSelection();this.textarea.value=o,n.state.focused&&ko(this.textarea),no&&ro>=9&&(this.hasSelection=o)}else t||(this.prevInput=this.textarea.value="",no&&ro>=9&&(this.hasSelection=null));this.inaccurateSelection=e}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!po||s()!=this.textarea))try{this.textarea.focus()}catch(t){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},fastPoll:function(){function t(){i.poll()||e?(i.pollingFast=!1,i.slowPoll()):(e=!0,i.polling.set(60,t))}var e=!1,i=this;i.pollingFast=!0,i.polling.set(20,t)},poll:function(){var t=this,e=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||Bo(i)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=i.value;if(r==n&&!e.somethingSelected())return!1;if(no&&ro>=9&&this.hasSelection===r||go&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var s=r.charCodeAt(0);if(8203!=s||n||(n=""),8666==s)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(n.length,r.length);o<a&&n.charCodeAt(o)==r.charCodeAt(o);)++o;return hn(e,function(){_s(e,r.slice(o),n.length-o,null,t.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?i.value=t.prevInput="":t.prevInput=r,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){no&&ro>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(t){function e(){if(null!=o.selectionStart){var t=r.somethingSelected(),e=""+(t?o.value:"");o.value="⇚",o.value=e,n.prevInput=t?"":"",o.selectionStart=1,o.selectionEnd=e.length,s.selForContextMenu=r.doc.sel}}function i(){if(n.contextMenuPending=!1,n.wrapper.style.cssText=u,o.style.cssText=c,no&&ro<9&&s.scrollbars.setScrollTop(s.scroller.scrollTop=l),null!=o.selectionStart){(!no||no&&ro<9)&&e();var t=0,i=function(){s.selForContextMenu==r.doc.sel&&0==o.selectionStart&&o.selectionEnd>0&&""==n.prevInput?dn(r,Cr)(r):t++<10?s.detectingSelectAll=setTimeout(i,500):s.input.reset()};s.detectingSelectAll=setTimeout(i,200)}}var n=this,r=n.cm,s=r.display,o=n.textarea,a=Ci(r,t),l=s.scroller.scrollTop;if(a&&!lo){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(a)&&dn(r,pr)(r.doc,_n(a),Po);var c=o.style.cssText,u=n.wrapper.style.cssText;n.wrapper.style.cssText="position: absolute";var h=n.wrapper.getBoundingClientRect();o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-h.top-5)+"px; left: "+(t.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(no?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var d;if(so&&(d=window.scrollY),s.input.focus(),so&&window.scrollTo(null,d),s.input.reset(),r.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=!0,s.selForContextMenu=r.doc.sel,clearTimeout(s.detectingSelectAll),no&&ro>=9&&e(),wo){Ht(t);var f=function(){$t(window,"mouseup",f),setTimeout(i,20)};Fo(window,"mouseup",f)}else setTimeout(i,50)}},readOnlyChanged:function(t){t||this.reset()},setUneditable:y,needsContentAttribute:!1},Xs.prototype),function(t){function e(e,n,r,s){t.defaults[e]=n,r&&(i[e]=s?function(t,e,i){i!=xa&&r(t,e,i)}:r)}var i=t.optionHandlers;t.defineOption=e,t.Init=xa,e("value","",function(t,e){return t.setValue(e)},!0),e("mode",null,function(t,e){t.doc.modeOption=e,Bn(t)},!0),e("indentUnit",2,Bn,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(t){Wn(t),si(t),gn(t)},!0),e("lineSeparator",null,function(t,e){if(t.doc.lineSep=e,e){var i=[],n=t.doc.first;t.doc.iter(function(t){for(var r=0;;){var s=t.text.indexOf(e,r);if(-1==s)break;r=s+e.length,i.push(O(n,s))}n++});for(var r=i.length-1;r>=0;r--)Lr(t.doc,e,i[r],O(i[r].line,i[r].ch+e.length))}}),e("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e,i){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),i!=xa&&t.refresh()}),e("specialCharPlaceholder",fe,function(t){return t.refresh()},!0),e("electricChars",!0),e("inputStyle",po?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(t,e){return t.getInputField().spellcheck=e},!0),e("rtlMoveVisually",!vo),e("wholeLineUpdateBefore",!0),e("theme","default",function(t){Ps(t),$s(t)},!0),e("keyMap","default",function(t,e,i){var n=os(e),r=i!=xa&&os(i);r&&r.detach&&r.detach(t,n),n.attach&&n.attach(t,r||null)}),e("extraKeys",null),e("lineWrapping",!1,As,!0),e("gutters",[],function(t){Nn(t.options),$s(t)},!0),e("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?bi(t.display)+"px":"0",t.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(t){return qi(t)},!0),e("scrollbarStyle","native",function(t){Gi(t),qi(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),e("lineNumbers",!1,function(t){Nn(t.options),$s(t)},!0),e("firstLineNumber",1,$s,!0),e("lineNumberFormatter",function(t){return t},$s,!0),e("showCursorWhenSelecting",!1,Si,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("readOnly",!1,function(t,e){"nocursor"==e?(Ni(t),t.display.input.blur(),t.display.disabled=!0):t.display.disabled=!1,t.display.input.readOnlyChanged(e)}),e("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),e("dragDrop",!0,Ls),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,Si,!0),e("singleCursorHeightPerLine",!0,Si,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Wn,!0),e("addModeClass",!1,Wn,!0),e("pollInterval",100),e("undoDepth",200,function(t,e){return t.doc.history.undoDepth=e}),e("historyEventDelay",1250),e("viewportMargin",10,function(t){return t.refresh()},!0),e("maxHighlightLength",1e4,Wn,!0),e("moveInputWithCursor",!0,function(t,e){e||t.display.input.resetPosition()}),e("tabindex",null,function(t,e){return t.display.input.getField().tabIndex=e||""}),e("autofocus",null)}(Ns),function(t){var e=t.optionHandlers,i=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,i){var n=this.options,r=n[t];n[t]==i&&"mode"!=t||(n[t]=i,e.hasOwnProperty(t)&&dn(this,e[t])(this,i,r))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](os(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,i=0;i<e.length;++i)if(e[i]==t||e[i].name==t)return e.splice(i,1),!0},addOverlay:fn(function(e,i){var n=e.token?e:t.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");v(this.state.overlays,{mode:n,modeSpec:e,opaque:i&&i.opaque,priority:i&&i.priority||0},function(t){return t.priority}),this.state.modeGen++,gn(this)}),removeOverlay:fn(function(t){for(var e=this,i=this.state.overlays,n=0;n<i.length;++n){var r=i[n].modeSpec;if(r==t||"string"==typeof t&&r.name==t)return i.splice(n,1),e.state.modeGen++,void gn(e)}}),indentLine:fn(function(t,e,i){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),A(this.doc,t)&&Ds(this,t,e,i)}),indentSelection:fn(function(t){for(var e=this,i=this.doc.sel.ranges,n=-1,r=0;r<i.length;r++){var s=i[r];if(s.empty())s.head.line>n&&(Ds(e,s.head.line,t,!0),n=s.head.line,r==e.doc.sel.primIndex&&tn(e));else{var o=s.from(),a=s.to(),l=Math.max(n,o.line);n=Math.min(e.lastLine(),a.line-(a.ch?0:1))+1;for(var c=l;c<n;++c)Ds(e,c,t);var u=e.doc.sel.ranges;0==o.ch&&i.length==u.length&&u[r].from().ch>0&&ur(e.doc,r,new Dn(o,u[r].to()),Po)}}}),getTokenAt:function(t,e){return re(this,t,e)},getLineTokens:function(t,e){return re(this,O(t),e,!0)},getTokenTypeAt:function(t){t=F(this.doc,t);var e,i=Qt(this,T(this.doc,t.line)),n=0,r=(i.length-1)/2,s=t.ch;if(0==s)e=i[2];else for(;;){var o=n+r>>1;if((o?i[2*o-1]:0)>=s)r=o;else{if(!(i[2*o+1]<s)){e=i[2*o+2];break}n=o+1}}var a=e?e.indexOf("overlay "):-1;return a<0?e:0==a?null:e.slice(0,a-1)},getModeAt:function(e){var i=this.doc.mode;return i.innerMode?t.innerMode(i,this.getTokenAt(e).state).mode:i},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var n=this,r=[];if(!i.hasOwnProperty(e))return r;var s=i[e],o=this.getModeAt(t);if("string"==typeof o[e])s[o[e]]&&r.push(s[o[e]]);else if(o[e])for(var a=0;a<o[e].length;a++){var l=s[o[e][a]];l&&r.push(l)}else o.helperType&&s[o.helperType]?r.push(s[o.helperType]):s[o.name]&&r.push(s[o.name]);for(var c=0;c<s._global.length;c++){var u=s._global[c];u.pred(o,n)&&-1==d(r,u.val)&&r.push(u.val)}return r},getStateAfter:function(t,e){var i=this.doc;return t=H(i,null==t?i.first+i.size-1:t),te(this,t+1,e)},cursorCoords:function(t,e){var i,n=this.doc.sel.primary();return i=null==t?n.head:"object"==typeof t?F(this.doc,t):t?n.from():n.to(),hi(this,i,e||"page")},charCoords:function(t,e){return ui(this,F(this.doc,t),e||"page")},coordsChar:function(t,e){return t=ci(this,t,e||"page"),pi(this,t.left,t.top)},lineAtHeight:function(t,e){return t=ci(this,{top:t,left:0},e||"page").top,L(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e,i){var n,r=!1;if("number"==typeof t){var s=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>s&&(t=s,r=!0),n=T(this.doc,t)}else n=t;return li(this,n,{top:0,left:0},e||"page",i).top+(r?this.doc.height-pt(n):0)},defaultTextHeight:function(){return mi(this.display)},defaultCharWidth:function(){return vi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,i,n,r){var s=this.display;t=hi(this,F(this.doc,t));var o=t.bottom,a=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),s.sizer.appendChild(e),"over"==n)o=t.top;else if("above"==n||"near"==n){var l=Math.max(s.wrapper.clientHeight,this.doc.height),c=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==n||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?o=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(o=t.bottom),a+e.offsetWidth>c&&(a=c-e.offsetWidth)}e.style.top=o+"px",e.style.left=e.style.right="","right"==r?(a=s.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?a=0:"middle"==r&&(a=(s.sizer.clientWidth-e.offsetWidth)/2),e.style.left=a+"px"),i&&Ji(this,a,o,a+e.offsetWidth,o+e.offsetHeight)},triggerOnKeyDown:fn(ms),triggerOnKeyPress:fn(bs),triggerOnKeyUp:ys,execCommand:function(t){if(va.hasOwnProperty(t))return va[t].call(null,this)},triggerElectric:fn(function(t){Hs(this,t)}),findPosH:function(t,e,i,n){var r=this,s=1;e<0&&(s=-1,e=-e);for(var o=F(this.doc,t),a=0;a<e&&(o=Bs(r.doc,o,s,i,n),!o.hitSide);++a);return o},moveH:fn(function(t,e){var i=this;this.extendSelectionsBy(function(n){return i.display.shift||i.doc.extend||n.empty()?Bs(i.doc,n.head,t,e,i.options.rtlMoveVisually):t<0?n.from():n.to()},Lo)}),deleteH:fn(function(t,e){var i=this.doc.sel,n=this.doc;i.somethingSelected()?n.replaceSelection("",null,"+delete"):as(this,function(i){var r=Bs(n,i.head,t,e,!1);return t<0?{from:r,to:i.head}:{from:i.head,to:r}})}),findPosV:function(t,e,i,n){var r=this,s=1,o=n;e<0&&(s=-1,e=-e);for(var a=F(this.doc,t),l=0;l<e;++l){var c=hi(r,a,"div");if(null==o?o=c.left:c.left=o,a=Ws(r,c,s,i),a.hitSide)break}return a},moveV:fn(function(t,e){var i=this,n=this.doc,r=[],s=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(o){if(s)return t<0?o.from():o.to();var a=hi(i,o.head,"div");null!=o.goalColumn&&(a.left=o.goalColumn),r.push(a.left);var l=Ws(i,a,t,e);return"page"==e&&o==n.sel.primary()&&Qi(i,null,ui(i,l,"div").top-a.top),l},Lo),r.length)for(var o=0;o<n.sel.ranges.length;o++)n.sel.ranges[o].goalColumn=r[o]}),findWordAt:function(t){var e=this.doc,i=T(e,t.line).text,n=t.ch,r=t.ch;if(i){var s=this.getHelper(t,"wordChars");(t.xRel<0||r==i.length)&&n?--n:++r;for(var o=i.charAt(n),a=w(o,s)?function(t){return w(t,s)}:/\s/.test(o)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!w(t)};n>0&&a(i.charAt(n-1));)--n;for(;r<i.length&&a(i.charAt(r));)++r}return new Dn(O(t.line,n),O(t.line,r))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?o(this.display.cursorDiv,"CodeMirror-overwrite"):Co(this.display.cursorDiv,"CodeMirror-overwrite"),Lt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==s()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:fn(function(t,e){null==t&&null==e||en(this),null!=t&&(this.curOp.scrollLeft=t),null!=e&&(this.curOp.scrollTop=e)}),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-We(this)-this.display.barHeight,width:t.scrollWidth-We(this)-this.display.barWidth,clientHeight:Ue(this),clientWidth:je(this)}},scrollIntoView:fn(function(t,e){if(null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:O(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line)en(this),this.curOp.scrollToPos=t;else{var i=Zi(this,Math.min(t.from.left,t.to.left),Math.min(t.from.top,t.to.top)-t.margin,Math.max(t.from.right,t.to.right),Math.max(t.from.bottom,t.to.bottom)+t.margin);this.scrollTo(i.scrollLeft,i.scrollTop)}}),setSize:fn(function(t,e){var i=this,n=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=n(t)),null!=e&&(this.display.wrapper.style.height=n(e)),this.options.lineWrapping&&ri(this);var r=this.display.viewFrom;this.doc.iter(r,this.display.viewTo,function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){mn(i,r,"widget");break}++r}),this.curOp.forceUpdate=!0,Lt(this,"refresh",this)}),operation:function(t){return hn(this,t)},refresh:fn(function(){var t=this.display.cachedTextHeight;gn(this),this.curOp.forceUpdate=!0,si(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),$n(this),(null==t||Math.abs(t-mi(this.display))>.5)&&wi(this),Lt(this,"refresh",this)}),swapDoc:fn(function(t){var e=this.doc;return e.cm=null,Kn(this,t),si(this),this.display.input.reset(),this.scrollTo(t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,Se(this,"swapDoc",this,e),e}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Dt(t),t.registerHelper=function(e,n,r){i.hasOwnProperty(e)||(i[e]=t[e]={_global:[]}),i[e][n]=r},t.registerGlobalHelper=function(e,n,r,s){t.registerHelper(e,n,s),i[e]._global.push({pred:r,val:s})}}(Ns);var Ta="iter insert remove copy getEditor constructor".split(" ");for(var Ma in aa.prototype)aa.prototype.hasOwnProperty(Ma)&&d(Ta,Ma)<0&&(Ns.prototype[Ma]=function(t){return function(){return t.apply(this.doc,arguments)}}(aa.prototype[Ma]));return Dt(aa),Ns.inputStyles={textarea:Xs,contenteditable:js},Ns.defineMode=function(t){Ns.defaults.mode||"null"==t||(Ns.defaults.mode=t),jt.apply(this,arguments)},Ns.defineMIME=Ut,Ns.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),Ns.defineMIME("text/plain","null"),Ns.defineExtension=function(t,e){Ns.prototype[t]=e},Ns.defineDocExtension=function(t,e){aa.prototype[t]=e},Ns.fromTextArea=Js,function(t){t.off=$t,t.on=Fo,t.wheelEventPixels=Vi,t.Doc=aa,t.splitLines=Vo,t.countColumn=u,t.findColumn=f,t.isWordChar=x,t.Pass=Eo,t.signal=Lt,t.Line=le,t.changeEnd=zn,t.scrollbarModel=na,t.Pos=O,t.cmpPos=D,t.modes=Uo,t.mimeModes=qo,t.resolveMode=qt,t.getMode=Kt,t.modeExtensions=Ko,t.extendMode=Gt,t.copyState=Yt,t.startState=Jt,t.innerMode=Xt,t.commands=va,t.keyMap=pa,t.keyName=ss,t.isModifierKey=rs,t.lookupKey=ns,t.normalizeKeyMap=is,t.StringStream=Go,t.SharedTextMarker=Br,t.TextMarker=Rr,t.LineWidget=zr,t.e_preventDefault=It,t.e_stopPropagation=_t,t.e_stop=Ht,t.addClass=o,t.contains=r,t.rmClass=Co,t.keyNames=ua}(Ns),Ns.version="5.21.0",Ns})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({events:{change:"onChange"},initialize:function(t){var e=this.model;this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=e.target,this.className=this.pfx+"trait",this.labelClass=this.ppfx+"label",this.fieldClass=this.ppfx+"field "+this.ppfx+"field-"+e.get("type"),this.inputhClass=this.ppfx+"input-holder",e.off("change:value",this.onValueChange),this.listenTo(e,"change:value",this.onValueChange),this.tmpl='<div class="'+this.fieldClass+'"><div class="'+this.inputhClass+'"></div></div>'},onChange:function(){this.model.set("value",this.getInputEl().value)},getValueForTarget:function(){return this.model.get("value")},onValueChange:function(){var t=this.model,i=this.target,n=t.get("name"),r=this.getValueForTarget();if(t.get("changeProp"))i.set(n,r);else{var s=e.clone(i.get("attributes"));s[n]=r,i.set("attributes",s)}},renderLabel:function(){this.$el.html('<div class="'+this.labelClass+'">'+this.getLabel()+"</div>")},getLabel:function(){var t=this.model,e=t.get("label")||t.get("name");return e.charAt(0).toUpperCase()+e.slice(1).replace(/-/g," ")},getInputEl:function(){if(!this.$input){var t=this.model,e=this.target,i=t.get("name"),n={placeholder:t.get("placeholder")||t.get("default"),type:t.get("type")||"text"};if(t.get("changeProp"))n.value=e.get(i);else{var r=e.get("attributes");n.value=t.get("value")||r[i]}t.get("min")&&(n.min=t.get("min")),t.get("max")&&(n.max=t.get("max")),this.$input=$("<input>",n)}return this.$input.get(0)},getModelValue:function(){var t,e=this.model,i=this.target,n=e.get("name");if(e.get("changeProp"))t=i.get(n);else{var r=i.get("attributes");t=e.get("value")||r[n]}return t},renderField:function(){if(!this.$input){this.$el.append(this.tmpl);var t=this.getInputEl();this.$el.find("."+this.inputhClass).prepend(t)}},render:function(){return this.renderLabel(),this.renderField(),this.el.className=this.className,this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=(i(0),i(3));t.exports=n.extend({tagName:"img",events:{dblclick:"openModal",click:"initResize"},initialize:function(t){n.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:src",this.updateSrc),this.listenTo(this.model,"dblclick active",this.openModal),this.classEmpty=this.ppfx+"plh-image",this.config.modal&&(this.modal=this.config.modal),this.config.am&&(this.am=this.config.am)},updateSrc:function(){var t=this.model.get("src");this.$el.attr("src",t),t?this.$el.removeClass(this.classEmpty):this.$el.addClass(this.classEmpty)},openModal:function(t){var e=this.opts.config.em,i=e?e.get("Editor"):"";i&&i.runCommand("open-assets",{target:this.model,onSelect:function(){i.Modal.close(),i.AssetManager.setTarget(null)}})},render:function(){this.updateAttributes(),this.updateClasses();var t=this.$el.attr("class")||"";return this.model.get("src")||this.$el.attr("class",(t+" "+this.classEmpty).trim()),this.$el.attr("onmousedown","return false"),this}})},function(t,e,i){"use strict";var n=i(0),r=n.Model.extend({idAttribute:"name",defaults:{name:"",label:"",type:"class",active:!0,private:!1,protected:!1},initialize:function(){var t=this.get("name"),e=this.get("label");t?e||this.set("label",t):this.set("name",e),this.set("name",r.escapeName(this.get("name")))},getFullName:function(){var t="";switch(this.get("type")){case"class":t=".";break;case"id":t="#"}return t+this.get("name")}},{escapeName:function(t){return(""+t).trim().replace(/([^a-z0-9\w]+)/gi,"-")}});t.exports=r},function(t,e,i){"use strict";(function(e){var n=(i(0),i(18));t.exports=e.extend({},n,{init:function(t){e.bindAll(this,"startDraw","draw","endDraw","rollback"),this.config=t||{},this.hType=this.config.newFixedH?"height":"min-height",this.allowDraw=1},enable:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.enable.apply(this,e),this.$wr.css("cursor","crosshair"),this.allowDraw&&this.$wr.on("mousedown",this.startDraw),this.ghost=this.canvas.getGhostEl()},startDraw:function(t){t.preventDefault(),this.stopSelectPosition(),this.ghost.style.display="block",this.frameOff=this.getOffsetDim(),this.startPos={top:t.pageY+this.frameOff.top,left:t.pageX+this.frameOff.left},this.isDragged=!1,this.tempComponent={style:{}},this.beforeDraw(this.tempComponent),this.updateSize(this.startPos.top,this.startPos.left,0,0),this.toggleEvents(1)},toggleEvents:function(t){var e=t?"on":"off";this.$wr[e]("mousemove",this.draw),this.$wr[e]("mouseup",this.endDraw),this.$canvas[e]("mousemove",this.draw),$(document)[e]("mouseup",this.endDraw),$(document)[e]("keypress",this.rollback)},draw:function(t){this.isDragged=!0,this.updateComponentSize(t)},endDraw:function(t){this.toggleEvents();var e={};if(this.isDragged){this.updateComponentSize(t),this.setRequirements(this.tempComponent);var i=this.sorter.lastPos;e=this.create(this.sorter.target,this.tempComponent,i.index,i.method),this.sorter.prevTarget=null}this.ghost.style.display="none",this.startSelectPosition(),this.afterDraw(e)},create:function(t,e,i,n,r){i="after"===n?i+1:i;var s=r||{},o=$(t),a=o.data("model"),l=o.data("collection"),c=a?a.get("droppable"):1;if(s.at=i,l&&c)return l.add(e,s);console.warn("Invalid target position")},setRequirements:function(t){var e=this.config,i=t.style;i.width.replace(/\D/g,"")<e.minComponentW&&(i.width=e.minComponentW+"px"),i[this.hType].replace(/\D/g,"")<e.minComponentH&&(i[this.hType]=e.minComponentH+"px"),e.newFixedH&&(i.overflow="auto"),this.absoluteMode?i.position="absolute":(delete i.left,delete i.top);var n=this.sorter.lastPos;return this.nearFloat(n.index,n.method,this.sorter.lastDims)&&(i.float="left"),this.config.firstCentered&&this.getCanvasWrapper()==this.sorter.target&&(i.margin="0 auto"),t},updateComponentSize:function(t){var e=t.pageY+this.frameOff.top,i=t.pageX+this.frameOff.left,n=this.startPos,r=n.top,s=n.left,o=e-r,a=i-s;i<s&&(s=i,a=n.left-i),e<r&&(r=e,o=n.top-e),this.updateSize(r,s,a,o)},updateSize:function(t,e,i,n){var r="px",s=this.ghost.style,o=this.tempComponent.style;s.top=o.top=t+r,s.left=o.left=e+r,s.width=o.width=i+r,s[this.hType]=o[this.hType]=n+r},rollback:function(t,e){((t.which||t.keyCode)==this.config.ESCAPE_KEY||e)&&(this.isDragged=!1,this.endDraw())},beforeDraw:function(t){t.editable=!1},afterDraw:function(t){},run:function(t,e,i){this.editor=t,this.sender=e,this.$wr=this.$wrapper,this.enable()},stop:function(){this.stopSelectPosition(),this.$wrapper.css("cursor",""),this.$wrapper.unbind()}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=i(126),s=i(113),o=i(41),a=void 0;t.exports={init:function(t){e.bindAll(this,"onHover","onOut","onClick","onKeyPress")},enable:function(){e.bindAll(this,"copyComp","pasteComp","onFrameScroll"),this.frameOff=this.canvasOff=this.adjScroll=null;var t=this.config.em.get("Config");this.startSelectComponent(),this.toggleClipboard(t.copyPaste);var i=this.config.em;a=1,i.on("component:update",this.updateAttached,this),i.on("change:canvasOffset",this.updateAttached,this),i.on("change:selectedComponent",this.updateToolbar,this)},toggleClipboard:function(t){t||0?(o("⌘+c, ctrl+c",this.copyComp),o("⌘+v, ctrl+v",this.pasteComp)):(o.unbind("⌘+c, ctrl+c"),o.unbind("⌘+v, ctrl+v"))},copyComp:function(){var t=this.editorModel.get("selectedComponent");t&&t.get("copyable")&&this.editorModel.set("clipboard",t)},pasteComp:function(){var t=this.editorModel.get("clipboard"),e=this.editorModel.get("selectedComponent");if(t&&e&&e.collection){var i=e.collection.indexOf(e),n=t.clone();e.collection.add(n,{at:i+1})}},getCanvasBodyEl:function(){return this.$bodyEl||(this.$bodyEl=$(this.getCanvasBody())),this.$bodyEl},startSelectComponent:function(){this.toggleSelectComponent(1)},stopSelectComponent:function(){this.toggleSelectComponent()},toggleSelectComponent:function(t){var e=t?"on":"off";this.getCanvasBodyEl()[e]("mouseover","*",this.onHover)[e]("mouseout","*",this.onOut)[e]("click","*",this.onClick);var i=this.getContentWindow();i[e]("scroll",this.onFrameScroll),i[e]("keydown",this.onKeyPress)},onKeyPress:function(t){var e=t.which||t.keyCode,i=this.editorModel.get("selectedComponent"),n="BODY"!==this.frameEl.contentDocument.activeElement.tagName;if((8==e||46==e)&&(n||t.preventDefault(),i&&!n)){if(!i.get("removable"))return;i.set("status",""),i.destroy(),this.hideBadge(),this.clean(),this.hideHighlighter(),this.editorModel.set("selectedComponent",null)}},onHover:function(t){t.stopPropagation();var e=t.target;this.adjScroll||(this.adjScroll=1,this.onFrameScroll(t),this.updateAttached());var i=this.getElementPos(e);this.updateBadge(e,i),this.updateHighlighter(e,i),this.showElementOffset(e,i)},onOut:function(t){t.stopPropagation(),this.hideBadge(),this.hideHighlighter(),this.hideElementOffset()},showElementOffset:function(t,e){var i=$(t),n=i.data("model");n&&"selected"==n.get("status")||!a||this.editor.runCommand("show-offset",{el:t,elPos:e})},hideElementOffset:function(t,e){this.editor.stopCommand("show-offset")},showFixedElementOffset:function(t,e){this.editor.runCommand("show-offset",{el:t,elPos:e,state:"Fixed"})},hideFixedElementOffset:function(t,e){this.editor&&this.editor.stopCommand("show-offset",{state:"Fixed"})},hideHighlighter:function(){this.canvas.getHighlighter().style.display="none"},onClick:function(t){var e=$(t.target).data("model");if(e){var i=e.get("stylable");(i instanceof Array||i)&&this.onSelect(t,t.target)}},updateBadge:function(t,e){var i=$(t),n=this.canvas,r=n.getConfig(),s=r.customBadgeLabel;this.cacheEl=t;var o=i.data("model");if(o&&o.get("badgable")){var a=this.getBadge(),l=o.getIcon()+o.getName();l=s?s(o):l,a.innerHTML=l;var c=a.style;c.display="block";var u=n.getCanvasView().getPosition(),h=a?a.offsetHeight:0,d=a?a.offsetWidth:0,f=e.top-h<u.top?u.top:e.top-h,p=e.left+d<u.left?u.left:e.left;c.top=f+"px",c.left=p+"px"}},updateHighlighter:function(t,e){var i=$(t),n=i.data("model");if(n&&(!n||"selected"!=n.get("status"))){var r=this.canvas.getHighlighter(),s=r.style;s.left=e.left+"px",s.top=e.top+"px",s.height=e.height+"px",s.width=e.width+"px",s.display="block"}},onSelect:function(t,e){t.stopPropagation();var i=$(e).data("model");i&&(this.editor.select(i),this.showFixedElementOffset(e),this.hideElementOffset(),this.hideHighlighter(),this.initResize(e))},initResize:function(t){var e,i=this.em,r=i?i.get("Editor"):"",s=i?i.get("Config"):"",o=s.stylePrefix||"",l="data-"+o+"handler",c=o+"resizing",u=i.get("selectedComponent"),h=u.get("resizable"),d={},f=function(t,e,i){var n=(e.target.getAttribute(l),c);i.docs&&i.docs.find("body")[t](n)};r&&h&&(d={onStart:function(t,n){f("addClass",t,n),e=i.get("StyleManager").getModelToStyle(u),a=0},onMove:function(){r.trigger("change:canvasOffset")},onEnd:function(t,e){f("removeClass",t,e),r.trigger("change:canvasOffset"),a=1},updateTarget:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e){var s=r.store,o=r.selectedHandler,a=["tc","bc"].indexOf(o)>=0,l=["cl","cr"].indexOf(o)>=0,c=e.getStyle();a||(c.width=n.w+"px"),l||(c.height=n.h+"px"),e.setStyle(c,{avoidStore:1}),i.trigger("targetStyleUpdated"),s&&e.trigger("change:style",e,c,{})}}},"object"==(void 0===h?"undefined":n(h))&&(d=Object.assign(d,h)),r.runCommand("resize",{el:t,options:d}))},updateToolbar:function(t){var e=this.config.em,i=t==e?e.get("selectedComponent"):t;if(i){var n=i.get("toolbar"),o=(this.ppfx,e.get("Config").showToolbar),a=this.canvas.getToolbarEl(),l=a.style;if(o&&n&&n.length){if(l.display="flex",!this.toolbar){a.innerHTML="",this.toolbar=new s(n);var c=new r({collection:this.toolbar,editor:this.editor});a.appendChild(c.render().el)}this.toolbar.reset(n);var u=i.view;u&&this.updateToolbarPos(u.el)}else l.display="none"}},updateToolbarPos:function(t,e){var i=this.canvas.getToolbarEl(),n=i.style,r=this.canvas.getTargetToElementDim(i,t,{elPos:e,event:"toolbarPosUpdate"}),s=r.left+r.elementWidth-r.targetWidth;n.top=r.top+"px",n.left=s+"px"},getCanvasPosition:function(){return this.canvas.getCanvasView().getPosition()},clean:function(){this.selEl&&this.selEl.removeClass(this.hoverClass)},getBadge:function(){return this.canvas.getBadgeEl()},onFrameScroll:function(t){var e=this.cacheEl;if(e){var i=this.getElementPos(e);this.updateBadge(e,i);var n=this.em.get("selectedComponent");n&&this.updateToolbarPos(n.view.el)}},updateAttached:function(){var t=this.em.get("selectedComponent");if(t){var e=t.view;this.updateToolbarPos(e.el),this.showFixedElementOffset(e.el)}},getElementPos:function(t,e){return this.canvas.getCanvasView().getElementPos(t)},hideBadge:function(){this.getBadge().style.display="none"},cleanPrevious:function(t){t&&t.set({status:"",state:""})},getContentWindow:function(){return this.contWindow||(this.contWindow=$(this.frameEl.contentWindow)),this.contWindow},run:function(t){this.editor=t&&t.get("Editor"),this.enable()},stop:function(){this.stopSelectComponent(),this.cleanPrevious(this.em.get("selectedComponent")),this.clean(),this.em.set("selectedComponent",null),this.toggleClipboard(),this.hideBadge(),this.hideFixedElementOffset(),this.canvas.getToolbarEl().style.display="none",this.em.off("component:update",this.updateAttached,this),this.em.off("change:canvasOffset",this.updateAttached,this),this.em.off("change:selectedComponent",this.updateToolbar,this)}}}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(2);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"image",tagName:"img",src:"",void:1,droppable:!1,resizable:!0,traits:["alt"]}),initialize:function(t,e){n.prototype.initialize.apply(this,arguments);var i=this.get("attributes");i.src&&this.set("src",i.src)},initToolbar:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];if(n.prototype.initToolbar.apply(this,e),this.sm&&this.sm.get){var r=this.sm.get("Commands");if(r.has("image-editor")){var s=this.get("toolbar");s.push({attributes:{class:"fa fa-pencil"},command:"image-editor"}),this.set("toolbar",s)}}},getAttrToHTML:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var r=n.prototype.getAttrToHTML.apply(this,e);delete r.onmousedown;var s=this.get("src");return s&&(r.src=s),r},parseUri:function(t){var e=document.createElement("a");e.href=t;for(var i={},n=e.search.substring(1).split("&"),r=0;r<n.length;r++){var s=n[r].split("="),o=decodeURIComponent(s[0]);o&&(i[o]=decodeURIComponent(s[1]))}return{hostname:e.hostname,pathname:e.pathname,protocol:e.protocol,search:e.search,hash:e.hash,port:e.port,query:i}}},{isComponent:function(t){var e="";return"IMG"==t.tagName&&(e={type:"image"}),e}})}).call(e,i(1))},function(e,i){e.exports=t},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({idAttribute:"src",defaults:{type:"",src:""},getFilename:function(){return this.get("src").split("/").pop()},getExtension:function(){return this.getFilename().split(".").pop()}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({initialize:function(t){this.options=t,this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.className=this.pfx+"asset",this.listenTo(this.model,"destroy remove",this.remove)}})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({template:e.template('\n<form>\n <div id="<%= pfx %>title"><%= title %></div>\n <input type="file" id="<%= uploadId %>" name="file" accept="image/*" <%= disabled ? \'disabled\' : \'\' %> multiple/>\n <div style="clear:both;"></div>\n</form>\n'),events:{},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=t;var e=t.config||{};this.config=e,this.pfx=e.stylePrefix||"",this.ppfx=e.pStylePrefix||"",this.target=this.collection||{},this.uploadId=this.pfx+"uploadFile",this.disabled=!e.upload,this.events["change #"+this.uploadId]="uploadFile";var i=e.uploadFile;i&&(this.uploadFile=i.bind(this)),this.delegateEvents()},uploadFile:function(t){for(var e=t.dataTransfer?t.dataTransfer.files:t.target.files,i=new FormData,n=0;n<e.length;n++)i.append("files[]",e[n]);var r=this.target;$.ajax({url:this.config.upload,type:"POST",data:i,beforeSend:this.config.beforeSend,complete:this.config.onComplete,xhrFields:{onprogress:function(t){t.lengthComputable},onload:function(t){}},cache:!1,contentType:!1,processData:!1}).done(function(t){r.add(t.data)}).always(function(){})},initDrop:function(){var t=this;if(!this.uploadForm&&(this.uploadForm=this.$el.find("form").get(0),"draggable"in this.uploadForm)){this.uploadFile;this.uploadForm.ondragover=function(){return this.className=t.pfx+"hover",!1},this.uploadForm.ondragleave=function(){return this.className="",!1},this.uploadForm.ondrop=function(e){this.className="",e.preventDefault(),t.uploadFile(e)}}},initDropzone:function(t){var e=this,i=0,n=this.config,r=t.model,s=t.el,o=r&&r.get("Editor"),a=t.model.get("Canvas").getBody(),l=this.ppfx,c=l+"dropzone-active",u=l+"dropzone",h=function(){s.className=s.className.replace(c,"").trim(),i=0},d=function(){return i||(s.className+=" "+c,i=1),!1},f=function(){return h(),!1},p=function(t){if(h(),t.preventDefault(),e.uploadFile(t),n.openAssetsOnDrop&&o){var i=o.getSelected();o.runCommand("open-assets",{target:i,onSelect:function(){o.Modal.close(),o.AssetManager.setTarget(null)}})}return!1};t.$el.append('<div class="'+u+'">'+n.dropzoneContent+"</div>"),h(),n.dropzone&&"draggable"in s&&[s,a].forEach(function(t){t.ondragover=d,t.ondragleave=f,t.ondrop=p})},render:function(){return this.$el.html(this.template({title:this.config.uploadText,uploadId:this.uploadId,disabled:this.disabled,pfx:this.pfx})),this.initDrop(),this.$el.attr("class",this.pfx+"file-uploader"),this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{id:"",label:"",open:!0,attributes:{}}})},function(t,e,i){"use strict";(function(e){var n=(i(0),i(9));t.exports=e.extend({},n,{init:function(){for(var t=arguments.length,i=Array(t),r=0;r<t;r++)i[r]=arguments[r];n.init.apply(this,i),e.bindAll(this,"insertComponent"),this.allowDraw=0},run:function(t,e,i){this.em=t,this.sender=e,this.opt=i||{},this.$wr=this.$wrapper,this.enable()},enable:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.enable.apply(this,e),this.$wr.on("click",this.insertComponent)},insertComponent:function(){this.$wr.off("click",this.insertComponent),this.stopSelectPosition();var t=this.buildContent();this.beforeInsert(t);var e=this.sorter.lastPos.index,i=this.create(this.sorter.target,t,e,null,{silent:!1});this.opt.terminateAfterInsert&&this.sender?this.sender.set("active",!1):this.enable(),i&&(this.em&&this.em.editor.initChildrenComp(i),this.afterInsert(i,this))},beforeInsert:function(t){},afterInsert:function(t){},buildContent:function(){return this.opt.content||{}}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={startSelectPosition:function(t,e){this.isPointed=!1;var i=this.editorModel.get("Utils");i&&!this.sorter&&(this.sorter=new i.Sorter({container:this.getCanvasBody(),placer:this.canvas.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,direction:"a",document:e,wmargin:1,nested:1,em:this.editorModel,canvasRelative:1})),this.sorter.startSort(t)},getOffsetDim:function(){var t=this.offset(this.canvas.getFrameEl()),e=this.offset(this.canvas.getElement());return{top:t.top-e.top,left:t.left-e.left}},stopSelectPosition:function(){this.posTargetCollection=null,this.posIndex="after"==this.posMethod&&0!==this.cDim.length?this.posIndex+1:this.posIndex,this.sorter&&(this.sorter.moved=0,this.sorter.endMove()),this.cDim&&(this.posIsLastEl=0!==this.cDim.length&&"after"==this.posMethod&&this.posIndex==this.cDim.length,this.posTargetEl=0===this.cDim.length?$(this.outsideElem):!this.posIsLastEl&&this.cDim[this.posIndex]?$(this.cDim[this.posIndex][5]).parent():$(this.outsideElem),this.posTargetModel=this.posTargetEl.data("model"),this.posTargetCollection=this.posTargetEl.data("model-comp"))},enable:function(){this.startSelectPosition()},nearFloat:function(t,e,i){var n=t||0,r=e||"before",s=i.length,o=0!==s&&"after"==r&&n==s;return 0!==s&&(!o&&!i[n][4]||i[n-1]&&!i[n-1][4]||o&&!i[n-1][4])?1:0},run:function(){this.enable()},stop:function(){this.stopSelectPosition(),this.$wrapper.css("cursor",""),this.$wrapper.unbind()}}},function(t,e,i){"use strict";(function(e){var n=i(23),r=function(t){return t&&t.__esModule?t:{default:t}}(n),s=i(0),o=i(20);t.exports=s.Model.extend(r.default).extend({defaults:{selectors:{},selectorsAdd:"",style:{},mediaText:"",state:"",stylable:!0},initialize:function(t,e){this.config=t||{};var i=e&&e.sm,n=this.config.selectors||[];if(this.em=i,i){var r=i.get("SelectorManager"),s=[];n.forEach(function(t){s.push(r.add(t))}),n=s}this.set("selectors",new o(n))},compare:function(t,i,n,r){var s=r||{},o=i||"",a=n||"",l=s.selectorsAdd||"";t instanceof Array||t.models||(t=[t]);var c=e.map(t.models||t,function(t){return t.get("name")}),u=e.map(this.get("selectors").models,function(t){return t.get("name")});if(c.length!==u.length)return!1;for(var h=0;h<c.length;h++){for(var d=0,f=0;f<u.length;f++)c[h]===u[f]&&(d=1);if(0===d)return!1}return this.get("state")===o&&(this.get("mediaText")===a&&this.get("selectorsAdd")===l)}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0);t.exports=n.Collection.extend({initialize:function(t,e){this.model=function(t,e){return this.ClassTag||(this.ClassTag=i(8)),new this.ClassTag(t,e)}}})},function(t,e,i){"use strict";(function(e){var n=i(2);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"text",droppable:!1,editable:!0})})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=(i(0),i(3));t.exports=n.extend({events:{dblclick:"enableEditing",change:"parseRender"},initialize:function(t){n.prototype.initialize.apply(this,arguments),e.bindAll(this,"disableEditing");var i=this.model;this.listenTo(i,"focus active",this.enableEditing),this.listenTo(i,"change:content",this.updateContent),this.rte=this.config.rte||"",this.activeRte=null,this.em=this.config.em},enableEditing:function(t){var e=this.model.get("editable");if(this.rte&&e)try{this.activeRte=this.rte.attach(this,this.activeRte),this.rte.focus(this,this.activeRte)}catch(t){console.error(t)}this.toggleEvents(1)},disableEditing:function(t){var e=this.model,i=e.get("editable");if(this.rte&&i){try{this.rte.detach(this,this.activeRte)}catch(t){console.error(t)}var n=this.getChildrenContainer();e.get("components").reset(),e.set("content",n.innerHTML)}!this.rte.customRte&&i&&this.parseRender(),this.toggleEvents()},disablePropagation:function(t){t.stopPropagation()},parseRender:function(){var t=this.getChildrenContainer(),e=this.model.get("components"),i={silent:!0};e.reset(null,i),e.add(t.innerHTML,i),this.model.set("content",""),this.render(),e.trigger("resetNavigator")},toggleEvents:function(t){var e=t?"on":"off",i=[this.el.ownerDocument,document,this.rte];$(i).off("mousedown",this.disableEditing),$(i)[e]("mousedown",this.disableEditing),this.$el.off("mousedown",this.disablePropagation),this.$el[e]("mousedown",this.disablePropagation)}})}).call(e,i(1))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={extendStyle:function(t){return Object.assign({},this.getStyle(),t)},getStyle:function(){return Object.assign({},this.get("style"))},setStyle:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.set("style",Object.assign({},t),e)},addStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof t?t={prop:e}:i=e||{},t=this.extendStyle(t),this.setStyle(t,i)},removeStyle:function(t){var e=this.getStyle();delete e[t],this.setStyle(e)}}},function(t,e,i){"use strict";(function(e){var n=(i(0),i(127));i(203);t.exports=n.extend({template:e.template('\n <div class=\'<%= ppfx %>input-holder\'></div>\n <div class="<%= ppfx %>field-colorp">\n <div class="<%= ppfx %>field-colorp-c">\n <div class="<%= ppfx %>checker-bg"></div>\n </div>\n </div>'),initialize:function(t){n.prototype.initialize.apply(this,arguments);var e=this.ppfx;this.colorCls=e+"field-color-picker",this.inputClass=e+"field "+e+"field-color",this.colorHolderClass=e+"field-colorp-c",this.listenTo(this.model,"change:value",this.handleModelChange)},handleModelChange:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.prototype.handleModelChange.apply(this,e);var r=this.model.get("value"),s=this.getColorEl();r="none"===r?"#fff":r,s.spectrum("set",r),s.get(0).style.backgroundColor=r},getColorEl:function(){if(!this.colorEl){var t=this.model,e=$("<div>",{class:this.colorCls}),i=e.get(0).style,n=this.target&&this.target.config?this.target.config.el:"";if(void 0===e.spectrum)throw"Spectrum missing, probably you load jQuery twice";e.spectrum({appendTo:n||"body",maxSelectionSize:8,showPalette:!0,showAlpha:!0,chooseText:"Ok",cancelText:"⨯",palette:[],move:function(t){var e=1==t.getAlpha()?t.toHexString():t.toRgbString();i.backgroundColor=e},change:function(e){var n=1==e.getAlpha()?e.toHexString():e.toRgbString();n=n.replace(/ /g,""),i.backgroundColor=n,t.set("value",n)}}),this.colorEl=e}return this.colorEl},render:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];return n.prototype.render.apply(this,e),this.$el.find("."+this.colorHolderClass).html(this.getColorEl()),this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({events:{},template:e.template('\n <span class=\'<%= ppfx %>input-holder\'></span>\n <span class=\'<%= ppfx %>field-units\'></span>\n <div class="<%= ppfx %>field-arrows">\n <div class="<%= ppfx %>field-arrow-u"></div>\n <div class="<%= ppfx %>field-arrow-d"></div>\n </div>'),initialize:function(t){e.bindAll(this,"moveIncrement","upIncrement");var i=t||{},n=i.ppfx||"",r=i.contClass||n+"field";this.ppfx=n,this.docEl=$(document),this.inputCls=n+"input-number",this.unitCls=n+"input-unit",this.contClass=r,this.events["click ."+n+"field-arrow-u"]="upArrowClick",this.events["click ."+n+"field-arrow-d"]="downArrowClick",this.events["mousedown ."+n+"field-arrows"]="downIncrement",this.events["change ."+this.inputCls]="handleChange",this.events["change ."+this.unitCls]="handleUnitChange",this.listenTo(this.model,"change:unit change:value",this.handleModelChange),this.delegateEvents()},setValue:function(t,e){var i=e||{},n=this.validateInputValue(t,{deepCheck:1}),r={value:n.value};(n.unit||n.force)&&(r.unit=n.unit),this.model.set(r,i),i.silent&&this.handleModelChange()},handleChange:function(t){t.stopPropagation(),this.setValue(this.getInputEl().value),this.elementUpdated()},handleUnitChange:function(t){t.stopPropagation();var e=this.getUnitEl().value;this.model.set("unit",e),this.elementUpdated()},elementUpdated:function(){this.model.trigger("el:change")},handleModelChange:function(){var t=this.model;this.getInputEl().value=t.get("value");var e=this.getUnitEl();e&&(e.value=t.get("unit"))},getInputEl:function(){return this.inputEl||(this.inputEl=$("<input>",{type:"text",class:this.inputCls,placeholder:this.model.get("defaults")})),this.inputEl.get(0)},getUnitEl:function(){if(!this.unitEl){var t=this.model,i=t.get("units")||[];if(i.length){var n='<select class="'+this.unitCls+'">';e.each(i,function(e){var i=e==t.get("unit")?"selected":"";n+="<option "+i+" >"+e+"</option>"}),n+="</select>",this.unitEl=$(n)}}return this.unitEl&&this.unitEl.get(0)},upArrowClick:function(){var t=this.model.get("value");t=isNaN(t)?1:parseInt(t,10)+1;var e=this.validateInputValue(t);this.model.set("value",e.value)},downArrowClick:function(){var t=this.model.get("value");t=isNaN(t)?0:parseInt(t,10)-1;var e=this.validateInputValue(t);this.model.set("value",e.value)},downIncrement:function(t){t.preventDefault(),this.moved=0;var e=this.model.get("value");e=isNaN(e)?0:parseInt(e,10);var i={y:t.pageY,val:e};this.docEl.mouseup(i,this.upIncrement),this.docEl.mousemove(i,this.moveIncrement)},moveIncrement:function(t){this.moved=1;var e=parseInt(t.data.val-t.pageY+t.data.y,10);return this.prValue=this.validateInputValue(e).value,this.model.set("value",this.prValue,{avoidStore:1}),!1},upIncrement:function(t){if(this.docEl.off("mouseup",this.upIncrement),this.docEl.off("mousemove",this.moveIncrement),this.prValue&&this.moved){var e=this.prValue-1;this.model.set("value",e,{avoidStore:1}).set("value",e+1),this.elementUpdated()}},validateInputValue:function(t,i){var n=0,r=i||{},s=this.model,o=t||s.get("defaults"),a=s.get("units")||[],l=s.get("unit")||a.length&&a[0]||"",c=s.get("max"),u=s.get("min");if(r.deepCheck){var h=s.get("fixedValues")||[];if(o){var d=new RegExp("^"+h.join("|"),"g");if(h.length&&d.test(o))o=o.match(d)[0],l="",n=1;else{var f=o+"";o+="",o=parseFloat(o.replace(",",".")),o=isNaN(o)?s.get("defaults"):o;var p=f.replace(o,"");e.indexOf(a,p)>=0&&(l=p)}}}return void 0!==c&&""!==c&&(o=o>c?c:o),void 0!==u&&""!==u&&(o=o<u?u:o),{force:n,value:o,unit:l}},render:function(){var t=this.ppfx;return this.$el.html(this.template({ppfx:t})),this.$el.find("."+t+"input-holder").html(this.getInputEl()),this.$el.find("."+t+"field-units").html(this.getUnitEl()),this.$el.addClass(this.contClass),this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({itemView:"",itemsView:"",itemType:"type",initialize:function(t,e){this.config=e||{}},addTo:function(t){this.add(t)},add:function(t,e){var i=e||null,n=this.itemView,r=t.get(this.itemType);this.itemsView&&this.itemsView[r]&&(n=this.itemsView[r]);var s=new n({model:t,config:this.config},this.config),o=s.render().el;i?i.appendChild(o):this.$el.append(o)},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.length&&this.collection.each(function(e){this.add(e,t)},this),this.$el.append(t),this}})},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(140);t.exports=n.View.extend({initialize:function(t){if(this.opt=t,this.config=t.config,this.preview=t.preview,this.ppfx=t.config.pStylePrefix||"",this.pfx=t.config.stylePrefix||"",this.parent=t.parent,this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset resetNavigator",this.render),this.className=this.pfx+"items",this.config.sortable&&!this.opt.sorter){var e=this.pfx,i=this.config.em.get("Utils");this.opt.sorter=new i.Sorter({container:this.el,containerSel:"."+e+"items",itemSel:"."+e+"item",ppfx:this.ppfx,ignoreViewChildren:1,pfx:e,nested:1})}this.sorter=this.opt.sorter||"",this.parent||(this.className+=" "+this.pfx+this.config.containerId),this.$el.data("collection",this.collection),this.parent&&this.$el.data("model",this.parent)},addTo:function(t){var e=this.collection.indexOf(t);this.addToCollection(t,null,e)},addToCollection:function(t,e,i){var n=e||null,s=r,o=new s({model:t,config:this.config,sorter:this.sorter,isCountable:this.isCountable,opened:this.opt.opened}),a=o.render().el;if(n)n.appendChild(a);else if(void 0!==i){var l="before";this.$el.children().length==i&&(i--,l="after"),i<0?this.$el.append(a):this.$el.children().eq(i)[l](a)}else this.$el.append(a);return a},isCountable:function(t,e){var i=t.get("type"),n=t.get("tagName");return("textnode"!=i&&"br"!=n||!e)&&!t.get("hiddenLayer")},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.isCountable(e,this.config.hideTextnode)&&this.addToCollection(e,t)},this),this.$el.append(t),this.$el.attr("class",e.result(this,"className")),this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(143);t.exports=n.Collection.extend({model:r,deactivateAllExceptOne:function(t,e){this.forEach(function(i,n){i!==t&&(i.set("active",!1),e&&i.get("buttons").length&&i.get("buttons").deactivateAllExceptOne(t,e))})},deactivateAll:function(t){var e=t||"";this.forEach(function(t,i){t.get("context")==e&&(t.set("active",!1),t.get("buttons").length&&t.get("buttons").deactivateAll(e))})}})},function(t,e,i){"use strict";var n=i(0),r=i(28);t.exports=n.Model.extend({defaults:{id:"",content:"",visible:!0,buttons:[]},initialize:function(t){this.btn=this.get("buttons")||[],this.buttons=new r(this.btn),this.set("buttons",this.buttons)}})},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(145);t.exports=n.View.extend({initialize:function(t){this.opt=t||{},this.config=this.opt.config||{},this.pfx=this.config.stylePrefix||"",this.parentM=this.opt.parentM||null,this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render),this.className=this.pfx+"buttons"},addTo:function(t){this.addToCollection(t)},addToCollection:function(t,e){var i=e||null,n=r,s=new n({model:t,config:this.config,parentM:this.parentM}),o=s.render().el;return i?i.appendChild(o):this.$el.append(o),o},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.append(t),this.$el.attr("class",e.result(this,"className")),this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(30);t.exports=n.View.extend({initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.buttons=this.model.get("buttons"),this.className=this.pfx+"panel",this.id=this.pfx+this.model.get("id"),this.listenTo(this.model,"change:appendContent",this.appendContent),this.listenTo(this.model,"change:content",this.updateContent)},appendContent:function(){this.$el.append(this.model.get("appendContent"))},updateContent:function(){this.$el.html(this.model.get("content"))},initResize:function(){var t=this.config.em,e=t?t.get("Editor"):"",i=this.model.get("resizable");if(e&&i){var n,r,s,o=!0===i?[1,1,1,1]:i,a=o.length,l=0;2==a?(n=o[0],s=o[0],r=o[1],l=o[1]):4==a&&(n=o[0],r=o[1],s=o[2],l=o[3]);var c=e.Utils.Resizer.init({tc:n,cr:r,bc:s,cl:l,tl:0,tr:0,bl:0,br:0,appendTo:this.el,prefix:e.getConfig().stylePrefix,posFetcher:function(t){var e=t.getBoundingClientRect();return{left:0,top:0,width:e.width,height:e.height}}});c.blur=function(){},c.focus(this.el)}},render:function(){if(this.$el.attr("class",this.className),this.id&&this.$el.attr("id",this.id),this.buttons.length){var t=new r({collection:this.buttons,config:this.config});this.$el.append(t.render().el)}return this.$el.append(this.model.get("content")),this}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({tagName:"a",initialize:function(t,e){this.config=e||{},this.ppfx=this.config.pStylePrefix||"",this.className=this.config.stylePrefix+"btn "+this.model.get("class")},render:function(){return this.$el.addClass(this.className),this}})},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(8);t.exports=n.Collection.extend({model:r,getStyleable:function(){return e.filter(this.models,function(t){return t.get("active")&&!t.get("private")})},getValid:function(){return e.filter(this.models,function(t){return!t.get("private")})}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(168),s=i(173),o=i(183);return{name:"StyleManager",getConfig:function(){return n},init:function(i){n=i||{};for(var a in r)a in n||(n[a]=r[a]);var l=n.pStylePrefix;return l&&(n.stylePrefix=l+n.stylePrefix),t=new s(n.sectors),e=new o({collection:t,target:n.em,config:n}),this},addSector:function(e,i){var n=this.getSector(e);return n||(i.id=e,n=t.add(i)),n},getSector:function(e){var i=t.where({id:e});return i.length?i[0]:null},getSectors:function(){return t},addProperty:function(t,e){var i=null,n=this.getSector(t);return n&&(i=n.get("properties").add(e)),i},getProperty:function(t,e){var i=null,n=this.getSector(t);return n&&(i=n.get("properties").where({property:e}),i=1==i.length?i[0]:i),i},getProperties:function(t){var e=null,i=this.getSector(t);return i&&(e=i.get("properties")),e},getModelToStyle:function(t){var e=t.get("classes");if(n.em&&e&&e.length){var i=n.em.get("Config").devicePreviewMode,r=n.em.getDeviceModel(),s=i?"":t.get("state"),o=r&&!i?r.get("width"):"",a=n.em.get("CssComposer"),l=e.getStyleable(),c=a.get(l,s,o);if(c&&l.length)return c}return t},render:function(){return e.render().el}}}},function(t,e,i){"use strict";var n=i(0),r=i(169);t.exports=n.Collection.extend({model:r,initialize:function(){this.idx=1,this.on("add",this.onAdd),this.on("reset",this.onReset)},onAdd:function(t,e,i){i.noIncrement||t.set("index",this.idx++)},onReset:function(){this.idx=1}})},function(t,e,i){"use strict";var n=i(0),r=i(170);t.exports=n.Collection.extend({model:r})},function(t,e,i){"use strict";var n=i(0),r=i(4),s=i(178),o=i(179),a=i(180),l=i(176),c=i(177),u=i(38),h=i(181);t.exports=n.View.extend({initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.target=t.target||{},this.propTarget=t.propTarget||{},this.onChange=t.onChange||{},this.onInputRender=t.onInputRender||{},this.customValue=t.customValue||{}},render:function(){var t=document.createDocumentFragment();return this.collection.each(function(e){var i=r;switch(e.get("type")){case"integer":i=s;break;case"radio":i=o;break;case"select":i=a;break;case"color":i=l;break;case"file":i=c;break;case"composite":i=u;break;case"stack":i=h}var n=new i({model:e,name:e.get("name"),id:this.pfx+e.get("property"),target:this.target,propTarget:this.propTarget,onChange:this.onChange,onInputRender:this.onInputRender,config:this.config});"composite"!=e.get("type")&&(n.customValue=this.customValue),t.appendChild(n.render().el)},this),this.$el.append(t),this.$el.append($("<div>",{class:"clear"})),this.$el.attr("class",this.pfx+"properties"),this}})},function(t,e,i){"use strict";(function(e){var n=(i(0),i(4));t.exports=n.extend({template:e.template('\n <div class="<%= pfx %>field <%= pfx %>composite">\n \t<span id=\'<%= pfx %>input-holder\'></span>\n </div>\n <div style="clear:both"></div>'),initialize:function(t){n.prototype.initialize.apply(this,arguments),e.bindAll(this,"build"),this.config=t.config||{},this.className=this.className+" "+this.pfx+"composite"},valueUpdated:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];this.model.get("detached")||n.prototype.valueUpdated.apply(this,e)},renderInput:function(){var t=this.model,e=t.get("properties")||[];if(e.length&&(this.$input||(this.$input=$("<input>",{value:0,type:"hidden"})),this.props||(this.props=t.get("properties")),!this.$props)){this.props.each(function(e,i){e&&"composite"==e.get("type")&&(this.props.remove(e),console.warn("Nested composite types not yet allowed.")),e.parent=t},this);var n=i(37),r=new n(this.getPropsConfig());this.$props=r.render().$el,this.$el.find("#"+this.pfx+"input-holder").html(this.$props)}},getPropsConfig:function(t){var e=this,i={config:this.config,collection:this.props,target:this.target,propTarget:this.propTarget,onChange:function(t,i,n){var r=e.build();e.model.set("value",r,n)},customValue:function(t,i){return e.valueOnIndex(i,t)}};return this.model.get("detached")&&delete i.onChange,i},getDefaultValue:function(){var t="";return this.props.each(function(e,i){t+=e.get("defaults")+e.get("unit")+" "}),this.model.get("defaults")||t.replace(/ +$/,"")},valueOnIndex:function(t,e){var i=null,n=this.getComponentValue().split(" ");if(n.length&&n[t]&&(i=n[t],e&&e.model&&e.model.get("functionName"))){var r=this.fetchFromFunction(i);r&&(i=r)}return i},build:function(t,e,i){var n="";return this.model.get("properties").each(function(t){var e=t.getValue(),i=t.get("functionName");i&&(e=i+"("+e+")"),n+=e+" "}),n.replace(/ +$/,"")}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(186),s=i(187);t.exports=n.Collection.extend({model:r,setTarget:function(t){this.target=t},add:function(t,e){if("string"==typeof t||t instanceof Array){"string"==typeof t&&(t=[t]);for(var i=0,r=t.length;i<r;i++){var o=t[i],a="string"==typeof o?s.build(o)[0]:o;a.target=this.target,t[i]=a}}return n.Collection.prototype.add.apply(this,[t,e])}})},function(t,e,i){!function(t){t(i(5))}(function(t){"use strict";function e(t){for(var e={},i=0;i<t.length;++i)e[t[i].toLowerCase()]=!0;return e}function i(t,e){for(var i,n=!1;null!=(i=t.next());){if(n&&"/"==i){e.tokenize=null;break}n="*"==i}return["comment","comment"]}t.defineMode("css",function(e,i){function n(t,e){return p=e,t}function r(t,e){var i=t.next();if(v[i]){var r=v[i](t,e);if(!1!==r)return r}return"@"==i?(t.eatWhile(/[\w\\\-]/),n("def",t.current())):"="==i||("~"==i||"|"==i)&&t.eat("=")?n(null,"compare"):'"'==i||"'"==i?(e.tokenize=s(i),e.tokenize(t,e)):"#"==i?(t.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==i?(t.match(/^\s*\w*/),n("keyword","important")):/\d/.test(i)||"."==i&&t.eat(/\d/)?(t.eatWhile(/[\w.%]/),n("number","unit")):"-"!==i?/[,+>*\/]/.test(i)?n(null,"select-op"):"."==i&&t.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(i)?n(null,i):"u"==i&&t.match(/rl(-prefix)?\(/)||"d"==i&&t.match("omain(")||"r"==i&&t.match("egexp(")?(t.backUp(1),e.tokenize=o,n("property","word")):/[\w\\\-]/.test(i)?(t.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(t.peek())?(t.eatWhile(/[\w.%]/),n("number","unit")):t.match(/^-[\w\\\-]+/)?(t.eatWhile(/[\w\\\-]/),t.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):t.match(/^\w+-/)?n("meta","meta"):void 0}function s(t){return function(e,i){for(var r,s=!1;null!=(r=e.next());){if(r==t&&!s){")"==t&&e.backUp(1);break}s=!s&&"\\"==r}return(r==t||!s&&")"!=t)&&(i.tokenize=null),n("string","string")}}function o(t,e){return t.next(),t.match(/\s*[\"\')]/,!1)?e.tokenize=null:e.tokenize=s(")"),n(null,"(")}function a(t,e,i){this.type=t,this.indent=e,this.prev=i}function l(t,e,i,n){return t.context=new a(i,e.indentation()+(!1===n?0:m),t.context),i}function c(t){return t.context.prev&&(t.context=t.context.prev),t.context.type}function u(t,e,i){return L[i.context.type](t,e,i)}function h(t,e,i,n){for(var r=n||1;r>0;r--)i.context=i.context.prev;return u(t,e,i)}function d(t){var e=t.current().toLowerCase();g=E.hasOwnProperty(e)?"atom":M.hasOwnProperty(e)?"keyword":"variable"}var f=i.inline;i.propertyKeywords||(i=t.resolveMode("text/css"));var p,g,m=e.indentUnit,v=i.tokenHooks,y=i.documentTypes||{},b=i.mediaTypes||{},x=i.mediaFeatures||{},w=i.mediaValueKeywords||{},C=i.propertyKeywords||{},k=i.nonStandardPropertyKeywords||{},S=i.fontProperties||{},T=i.counterDescriptors||{},M=i.colorKeywords||{},E=i.valueKeywords||{},P=i.allowNested,$=!0===i.supportsAtComponent,L={};return L.top=function(t,e,i){if("{"==t)return l(i,e,"block");if("}"==t&&i.context.prev)return c(i);if($&&/@component/.test(t))return l(i,e,"atComponentBlock");if(/^@(-moz-)?document$/.test(t))return l(i,e,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(t))return l(i,e,"atBlock");if(/^@(font-face|counter-style)/.test(t))return i.stateArg=t,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(t))return"keyframes";if(t&&"@"==t.charAt(0))return l(i,e,"at");if("hash"==t)g="builtin";else if("word"==t)g="tag";else{if("variable-definition"==t)return"maybeprop";if("interpolation"==t)return l(i,e,"interpolation");if(":"==t)return"pseudo";if(P&&"("==t)return l(i,e,"parens")}return i.context.type},L.block=function(t,e,i){if("word"==t){var n=e.current().toLowerCase();return C.hasOwnProperty(n)?(g="property","maybeprop"):k.hasOwnProperty(n)?(g="string-2","maybeprop"):P?(g=e.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(g+=" error","maybeprop")}return"meta"==t?"block":P||"hash"!=t&&"qualifier"!=t?L.top(t,e,i):(g="error","block")},L.maybeprop=function(t,e,i){return":"==t?l(i,e,"prop"):u(t,e,i)},L.prop=function(t,e,i){if(";"==t)return c(i);if("{"==t&&P)return l(i,e,"propBlock");if("}"==t||"{"==t)return h(t,e,i);if("("==t)return l(i,e,"parens");if("hash"!=t||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(e.current())){if("word"==t)d(e);else if("interpolation"==t)return l(i,e,"interpolation")}else g+=" error";return"prop"},L.propBlock=function(t,e,i){return"}"==t?c(i):"word"==t?(g="property","maybeprop"):i.context.type},L.parens=function(t,e,i){return"{"==t||"}"==t?h(t,e,i):")"==t?c(i):"("==t?l(i,e,"parens"):"interpolation"==t?l(i,e,"interpolation"):("word"==t&&d(e),"parens")},L.pseudo=function(t,e,i){return"word"==t?(g="variable-3",i.context.type):u(t,e,i)},L.documentTypes=function(t,e,i){return"word"==t&&y.hasOwnProperty(e.current())?(g="tag",i.context.type):L.atBlock(t,e,i)},L.atBlock=function(t,e,i){if("("==t)return l(i,e,"atBlock_parens");if("}"==t||";"==t)return h(t,e,i);if("{"==t)return c(i)&&l(i,e,P?"block":"top");if("interpolation"==t)return l(i,e,"interpolation");if("word"==t){var n=e.current().toLowerCase();g="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":x.hasOwnProperty(n)?"property":w.hasOwnProperty(n)?"keyword":C.hasOwnProperty(n)?"property":k.hasOwnProperty(n)?"string-2":E.hasOwnProperty(n)?"atom":M.hasOwnProperty(n)?"keyword":"error"}return i.context.type},L.atComponentBlock=function(t,e,i){return"}"==t?h(t,e,i):"{"==t?c(i)&&l(i,e,P?"block":"top",!1):("word"==t&&(g="error"),i.context.type)},L.atBlock_parens=function(t,e,i){return")"==t?c(i):"{"==t||"}"==t?h(t,e,i,2):L.atBlock(t,e,i)},L.restricted_atBlock_before=function(t,e,i){return"{"==t?l(i,e,"restricted_atBlock"):"word"==t&&"@counter-style"==i.stateArg?(g="variable","restricted_atBlock_before"):u(t,e,i)},L.restricted_atBlock=function(t,e,i){return"}"==t?(i.stateArg=null,c(i)):"word"==t?(g="@font-face"==i.stateArg&&!S.hasOwnProperty(e.current().toLowerCase())||"@counter-style"==i.stateArg&&!T.hasOwnProperty(e.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},L.keyframes=function(t,e,i){return"word"==t?(g="variable","keyframes"):"{"==t?l(i,e,"top"):u(t,e,i)},L.at=function(t,e,i){return";"==t?c(i):"{"==t||"}"==t?h(t,e,i):("word"==t?g="tag":"hash"==t&&(g="builtin"),"at")},L.interpolation=function(t,e,i){return"}"==t?c(i):"{"==t||";"==t?h(t,e,i):("word"==t?g="variable":"variable"!=t&&"("!=t&&")"!=t&&(g="error"),"interpolation")},{startState:function(t){return{tokenize:null,state:f?"block":"top",stateArg:null,context:new a(f?"block":"top",t||0,null)}},token:function(t,e){if(!e.tokenize&&t.eatSpace())return null;var i=(e.tokenize||r)(t,e);return i&&"object"==typeof i&&(p=i[1],i=i[0]),g=i,e.state=L[e.state](p,t,e),g},indent:function(t,e){var i=t.context,n=e&&e.charAt(0),r=i.indent;return"prop"!=i.type||"}"!=n&&")"!=n||(i=i.prev),i.prev&&("}"!=n||"block"!=i.type&&"top"!=i.type&&"interpolation"!=i.type&&"restricted_atBlock"!=i.type?(")"!=n||"parens"!=i.type&&"atBlock_parens"!=i.type)&&("{"!=n||"at"!=i.type&&"atBlock"!=i.type)||(r=Math.max(0,i.indent-m),i=i.prev):(i=i.prev,r=i.indent)),r},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var n=["domain","regexp","url","url-prefix"],r=e(n),s=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=e(s),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],l=e(a),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=e(c),h=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=e(h),f=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],p=e(f),g=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=e(g),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=e(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],x=e(b),w=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],C=e(w),k=n.concat(s).concat(a).concat(c).concat(h).concat(f).concat(b).concat(w);t.registerHelper("hintWords","css",k),t.defineMIME("text/css",{documentTypes:r,mediaTypes:o,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,fontProperties:m,counterDescriptors:y,colorKeywords:x,valueKeywords:C,tokenHooks:{"/":function(t,e){return!!t.eat("*")&&(e.tokenize=i,i(t,e))}},name:"css"}),t.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,colorKeywords:x,valueKeywords:C,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=i,i(t,e)):["operator","operator"]},":":function(t){return!!t.match(/\s*\{/)&&[null,"{"]},$:function(t){return t.match(/^[\w-]+/),t.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(t){return!!t.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),t.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,colorKeywords:x,valueKeywords:C,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=i,i(t,e)):["operator","operator"]},"@":function(t){return t.eat("{")?[null,"interpolation"]:!t.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(t.eatWhile(/[\w\\\-]/),t.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),t.defineMIME("text/x-gss",{documentTypes:r,mediaTypes:o,mediaFeatures:l,propertyKeywords:d,nonStandardPropertyKeywords:p,fontProperties:m,counterDescriptors:y,colorKeywords:x,valueKeywords:C,supportsAtComponent:!0,tokenHooks:{"/":function(t,e){return!!t.eat("*")&&(e.tokenize=i,i(t,e))}},name:"css",helperType:"gss"})})},function(t,e,i){!function(e){function i(t,e){for(var i=t.length;i--;)if(t[i]===e)return i;return-1}function n(t,e){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function r(t){for(x in C)C[x]=t[P[x]]}function s(t){var e,n,s,o,a,c;if(e=t.keyCode,-1==i(E,e)&&E.push(e),93!=e&&224!=e||(e=91),e in C){C[e]=!0;for(s in S)S[s]==e&&(l[s]=!0)}else if(r(t),l.filter.call(this,t)&&e in w)for(c=p(),o=0;o<w[e].length;o++)if(n=w[e][o],n.scope==c||"all"==n.scope){a=n.mods.length>0;for(s in C)(!C[s]&&i(n.mods,+s)>-1||C[s]&&-1==i(n.mods,+s))&&(a=!1);(0!=n.mods.length||C[16]||C[18]||C[17]||C[91])&&!a||!1===n.method(t,n)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function o(t){var e,n=t.keyCode,r=i(E,n);if(r>=0&&E.splice(r,1),93!=n&&224!=n||(n=91),n in C){C[n]=!1;for(e in S)S[e]==n&&(l[e]=!1)}}function a(){for(x in C)C[x]=!1;for(x in S)l[x]=!1}function l(t,e,i){var n,r;n=m(t),void 0===i&&(i=e,e="all");for(var s=0;s<n.length;s++)r=[],t=n[s].split("+"),t.length>1&&(r=v(t),t=[t[t.length-1]]),t=t[0],t=M(t),t in w||(w[t]=[]),w[t].push({shortcut:n[s],scope:e,method:i,key:n[s],mods:r})}function c(t,e){var i,r,s,o,a,l=[];for(i=m(t),o=0;o<i.length;o++){if(r=i[o].split("+"),r.length>1&&(l=v(r),t=r[r.length-1]),t=M(t),void 0===e&&(e=p()),!w[t])return;for(s=0;s<w[t].length;s++)a=w[t][s],a.scope===e&&n(a.mods,l)&&(w[t][s]={})}}function u(t){return"string"==typeof t&&(t=M(t)),-1!=i(E,t)}function h(){return E.slice(0)}function d(t){var e=(t.target||t.srcElement).tagName;return!("INPUT"==e||"SELECT"==e||"TEXTAREA"==e)}function f(t){k=t||"all"}function p(){return k||"all"}function g(t){var e,i,n;for(e in w)for(i=w[e],n=0;n<i.length;)i[n].scope===t?i.splice(n,1):n++}function m(t){var e;return t=t.replace(/\s/g,""),e=t.split(","),""==e[e.length-1]&&(e[e.length-2]+=","),e}function v(t){for(var e=t.slice(0,t.length-1),i=0;i<e.length;i++)e[i]=S[e[i]];return e}function y(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent&&t.attachEvent("on"+e,function(){i(window.event)})}function b(){var t=e.key;return e.key=$,t}var x,w={},C={16:!1,18:!1,17:!1,91:!1},k="all",S={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},T={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220},M=function(t){return T[t]||t.toUpperCase().charCodeAt(0)},E=[];for(x=1;x<20;x++)T["f"+x]=111+x;var P={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(x in S)l[x]=!1;y(document,"keydown",function(t){s(t)}),y(document,"keyup",o),y(window,"focus",a);var $=e.key;e.key=l,e.key.setScope=f,e.key.getScope=p,e.key.deleteScope=g,e.key.filter=d,e.key.isPressed=u,e.key.getPressedKeyCodes=h,e.key.noConflict=b,e.key.unbind=c,t.exports=l}(this)},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";t.exports=function(t){var e=i(132),n=i(129),r=i(152),s=new r,o=[];return{editors:o,plugins:s,init:function(t){var i=t||{},r=i.container;if("undefined"==typeof $)throw"jQuery not found";for(var a in e)a in i||(i[a]=e[a]);if(!r)throw new Error("'container' is required");i.el=document.querySelector(r);var l=new n(i).init();s.getAll();return i.plugins.forEach(function(t){var e=s.get(t);e?e(l,i.pluginsOpts[t]||{}):console.warn("Plugin "+t+" not found")}),i.autorender&&l.render(),o.push(l),l}}}()},function(t,e,i){"use strict";t.exports={assets:[],stylePrefix:"am-",upload:"http://localhost/assets/upload",uploadText:"Drop files here or click to upload",addBtnText:"Add image",uploadFile:"",dropzone:1,openAssetsOnDrop:1,dropzoneContent:""}},function(t,e,i){"use strict";t.exports=function(){var t,e,n,r={},s=i(47),o=i(49),a=i(15);return{name:"AssetManager",storageKey:"assets",init:function(l){r=l||{};var c=i(44);for(var u in c)u in r||(r[u]=c[u]);var h=r.pStylePrefix;h&&(r.stylePrefix=h+r.stylePrefix),t=new s(r.assets);var d={collection:t,config:r};return e=new o(d),n=new a(d),this},add:function(e){return t.add(e)},get:function(e){return t.where({src:e})[0]},getAll:function(){return t},remove:function(t){var e=this.get(t);return this.getAll().remove(e),this},store:function(t){var e={},i=JSON.stringify(this.getAll().toJSON());return e[this.storageKey]=i,!t&&r.stm&&r.stm.store(e),e},load:function(t){var e=t||"",i=this.storageKey;!e&&r.stm&&(e=r.stm.load(i));var n=e[i]||[];if("string"==typeof n)try{n=JSON.parse(e[i])}catch(t){}return n&&n.length&&this.getAll().reset(n),n},render:function(t){return this.rendered&&!t||(this.rendered=e.render().$el.add(n.render().$el)),this.rendered},postRender:function(t){n.initDropzone(t)},setTarget:function(t){e.collection.target=t},onSelect:function(t){e.collection.onSelect=t},onClick:function(t){r.onClick=t},onDblClick:function(t){r.onDblClick=t}}}},function(t,e,i){"use strict";(function(e){var n=(i(0),i(13));t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"image",unitDim:"px",height:0,width:0})})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=(i(13),i(46));t.exports=n.Collection.extend({model:r,initialize:function(t,e){this.model=function(t,e){return t.type,new r(t,e)}},addImg:function(t,e){return this.add({type:"image",src:t},e),this},add:function(t,e){var i=[];t=t instanceof Array?t:[t];for(var r=0,s=t.length;r<s;r++){var o=t[r];if("string"==typeof o&&(o={src:o,type:"image"}),o&&o.src){this.where({src:o.src}).length||i.push(o)}}return 1==i.length&&(i=i[0]),n.Collection.prototype.add.apply(this,[i,e])}})},function(t,e,i){"use strict";(function(e){var n=i(14);t.exports=n.extend({events:{click:"handleClick",dblclick:"handleDblClick"},template:e.template('\n<div id="<%= pfx %>preview-cont">\n <div id="<%= pfx %>preview" style="background-image: url(<%= src %>);"></div>\n <div id="<%= pfx %>preview-bg" class="<%= ppfx %>checker-bg"></div>\n</div>\n<div id="<%= pfx %>meta">\n\t<div id="<%= pfx %>name"><%= name %></div>\n\t<div id="<%= pfx %>dimensions"><%= dim %></div>\n</div>\n<div id="<%= pfx %>close">⨯</div>\n<div style="clear:both"></div>\n'),initialize:function(t){n.prototype.initialize.apply(this,arguments),this.className+=" "+this.pfx+"asset-image",this.events["click #"+this.pfx+"close"]="removeItem",this.delegateEvents()},handleClick:function(){var t=this.config.onClick,e=this.model;e.collection.trigger("deselectAll"),this.$el.addClass(this.pfx+"highlight"),"function"==typeof t?t(e):this.updateTarget(e.get("src"))},handleDblClick:function(){var t=this.config.onDblClick,e=this.model;"function"==typeof t?t(e):this.updateTarget(e.get("src"));var i=e.collection.onSelect;"function"==typeof i&&i(this.model)},updateTarget:function(t){var i=this.model.collection.target;if(i&&i.set){var n=e.clone(i.get("attributes"));i.set("attributes",n),i.set("src",t)}},removeItem:function(t){t.stopPropagation(),this.model.collection.remove(this.model)},render:function(){var t=this.model.get("name"),e=this.model.get("width")&&this.model.get("height")?this.model.get("width")+" x "+this.model.get("height"):"";return t=t||this.model.get("src").split("/").pop(),t=t&&t.length>30?t.substring(0,30)+"...":t,e=e?e+(this.model.get("unitDim")?this.model.get("unitDim"):" px"):"",this.$el.html(this.template({name:t,src:this.model.get("src"),dim:e,pfx:this.pfx,ppfx:this.ppfx})),this.$el.attr("class",this.className),this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(14),s=i(48);i(15);t.exports=n.View.extend({template:e.template('\n<div class="<%= pfx %>assets-cont">\n <div class="<%= pfx %>assets-header">\n <form class="<%= pfx %>add-asset">\n <div class="<%= ppfx %>field <%= pfx %>add-field">\n <input placeholder="http://path/to/the/image.jpg"/>\n </div>\n <button class="<%= ppfx %>btn-prim"><%= btnText %></button>\n <div style="clear:both"></div>\n </form>\n <div class="<%= pfx %>dips" style="display:none">\n <button class="fa fa-th <%= ppfx %>btnt"></button>\n <button class="fa fa-th-list <%= ppfx %>btnt"></button>\n </div>\n </div>\n <div class="<%= pfx %>assets"></div>\n <div style="clear:both"></div>\n</div>\n\n'),initialize:function(t){this.options=t,this.config=t.config,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.listenTo(this.collection,"add",this.addToAsset),this.listenTo(this.collection,"deselectAll",this.deselectAll),this.listenTo(this.collection,"reset",this.render),this.className=this.pfx+"assets",this.events={},this.events.submit="addFromStr",this.delegateEvents()},addFromStr:function(t){t.preventDefault();var e=this.getInputUrl(),i=e.value.trim();if(i)return this.collection.addImg(i,{at:0}),this.getAssetsEl().scrollTop=0,e.value="",this},getAssetsEl:function(){return this.assets=this.el.querySelector("."+this.pfx+"assets"),this.assets},getInputUrl:function(){return this.inputUrl&&this.inputUrl.value||(this.inputUrl=this.el.querySelector("."+this.pfx+"add-asset input")),this.inputUrl},addToAsset:function(t){this.addAsset(t)},addAsset:function(t,e){var i=e||null,n=r;t.get("type").indexOf("image")>-1&&(n=s);var o=new n({model:t,config:this.config}),a=o.render().el;if(i)i.appendChild(a);else{var l=this.getAssetsEl();l&&l.insertBefore(a,l.firstChild)}return a},deselectAll:function(){this.$el.find("."+this.pfx+"highlight").removeClass(this.pfx+"highlight")},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addAsset(e,t)},this),this.$el.html(this.template({pfx:this.pfx,ppfx:this.ppfx,btnText:this.config.addBtnText})),this.$el.find("."+this.pfx+"assets").append(t),this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={blocks:[],appendTo:""}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(50),s=i(53),o=i(54),a=i(56),l=[];return{name:"BlockManager",init:function(i){n=i||{};for(var c in r)c in n||(n[c]=r[c]);return t=new s(n.blocks),l=new o,e=new a({collection:t,categories:l},n),this},add:function(e,i){var n=i||{};return n.id=e,t.add(n)},get:function(e){return t.get(e)},getAll:function(){return t},getCategories:function(){return l},render:function(){return e.render().el},remove:function(e){return t.remove(e)}}}},function(t,e,i){"use strict";var n=i(0),r=i(16);t.exports=n.Model.extend({defaults:{label:"",content:"",category:"",attributes:{}},initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],this.get("category"));if(t&&"string"==typeof t){new r({id:t,label:t})}}})},function(t,e,i){"use strict";var n=i(0),r=i(52);t.exports=n.Collection.extend({model:r})},function(t,e,i){"use strict";var n=i(0);t.exports=n.Collection.extend({model:i(16)})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({events:{mousedown:"startDrag"},initialize:function(t,i){e.bindAll(this,"endDrag"),this.config=i||{},this.ppfx=this.config.pStylePrefix||"",this.listenTo(this.model,"destroy remove",this.remove),this.doc=$(document)},startDrag:function(t){if(0===t.button&&this.config.getSorter){this.config.em.refreshCanvas();var e=this.config.getSorter();e.setDragHelper(this.el,t),e.startSort(this.el),e.setDropContent(this.model.get("content")),this.doc.on("mouseup",this.endDrag)}},endDrag:function(t){this.doc.off("mouseup",this.endDrag);var e=this.config.getSorter();e.moved=0,e.endMove()},render:function(){var t=this.ppfx+"block";return this.$el.addClass(t),this.el.innerHTML='<div class="'+t+'-label">'+this.model.get("label")+"</div>",this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(55),s=i(57);t.exports=n.View.extend({initialize:function(t,i){e.bindAll(this,"getSorter","onDrag","onDrop"),this.config=i||{},this.categories=t.categories||"",this.renderedCategories=[];var n=this.config.pStylePrefix||"";this.ppfx=n,this.noCatClass=n+"blocks-no-cat",this.blockContClass=n+"blocks-c",this.catsClass=n+"block-categories",this.listenTo(this.collection,"add",this.addTo),this.em=this.config.em,this.tac="test-tac",this.grabbingCls=this.ppfx+"grabbing",this.em&&(this.config.getSorter=this.getSorter,this.canvas=this.em.get("Canvas"))},getSorter:function(){if(this.em){if(!this.sorter){var t=this.em.get("Utils"),e=this.canvas;this.sorter=new t.Sorter({container:e.getBody(),placer:e.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,onStart:this.onDrag,onEndMove:this.onDrop,onMove:this.onMove,document:e.getFrameEl().contentDocument,direction:"a",wmargin:1,nested:1,em:this.em,canvasRelative:1})}return this.sorter}},onDrag:function(t){this.em.stopDefault(),this.em.trigger("block:drag:start",t)},onMove:function(t){this.em.trigger("block:drag:move",t)},onDrop:function(t){var e=this.em;e.runDefault(),t&&t.get&&(t.get("activeOnRender")&&(t.trigger("active"),t.set("activeOnRender",0)),e.initChildrenComp(t),e.trigger("block:drag:stop",t))},addTo:function(t){this.add(t)},add:function(t,e){var i=e||null,n=new r({model:t,attributes:t.get("attributes")},this.config),o=n.render().el,a=t.get("category");if(a&&this.categories){"string"==typeof a&&(a={id:a,label:a});var l=this.categories.add(a),c=l.get("id"),u=this.renderedCategories[c],h=this.getCategoriesEl();return t.set("category",l),!u&&h&&(u=new s({model:l},this.config).render(),this.renderedCategories[c]=u,h.appendChild(u.el)),void(u&&u.append(o))}i?i.appendChild(o):this.append(o)},getCategoriesEl:function(){return this.catsEl||(this.catsEl=this.el.querySelector("."+this.catsClass)),this.catsEl},getBlocksEl:function(){return this.blocksEl||(this.blocksEl=this.el.querySelector("."+this.noCatClass+" ."+this.blockContClass)),this.blocksEl},append:function(t){var e=this.getBlocksEl();e&&e.appendChild(t)},render:function(){var t=(this.ppfx,document.createDocumentFragment());return this.catsEl=null,this.blocksEl=null,this.renderedCategories=[],this.el.innerHTML='\n <div class="'+this.catsClass+'"></div>\n <div class="'+this.noCatClass+'">\n <div class="'+this.blockContClass+'"></div>\n </div>\n ',this.collection.each(function(e){this.add(e,t)},this),this.append(t),this.$el.addClass(this.blockContClass+"s"),this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({template:e.template('\n <div class="<%= pfx %>title">\n <i class="<%= pfx %>caret-icon"></i>\n <%= label %>\n </div>\n <div class="<%= pfx %>blocks-c"></div>\n '),events:{},initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});this.config=t;var e=this.config.pStylePrefix||"";this.pfx=e,this.caretR="fa fa-caret-right",this.caretD="fa fa-caret-down",this.iconClass=e+"caret-icon",this.activeClass=e+"open",this.className=e+"block-category",this.events["click ."+e+"title"]="toggle",this.listenTo(this.model,"change:open",this.updateVisibility),this.delegateEvents()},updateVisibility:function(){this.model.get("open")?this.open():this.close()},open:function(){this.el.className=this.className+" "+this.activeClass,this.getIconEl().className=this.iconClass+" "+this.caretD,this.getBlocksEl().style.display=""},close:function(){this.el.className=this.className,this.getIconEl().className=this.iconClass+" "+this.caretR,this.getBlocksEl().style.display="none"},toggle:function(){var t=this.model;t.set("open",!t.get("open"))},getIconEl:function(){return this.iconEl||(this.iconEl=this.el.querySelector("."+this.iconClass)),this.iconEl},getBlocksEl:function(){return this.blocksEl||(this.blocksEl=this.el.querySelector("."+this.pfx+"blocks-c")),this.blocksEl},append:function(t){this.getBlocksEl().appendChild(t)},render:function(){return this.el.innerHTML=this.template({pfx:this.pfx,label:this.model.get("label")}),this.el.className=this.className,this.updateVisibility(),this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={stylePrefix:"cv-",rulers:!1,scripts:[],styles:[],customBadgeLabel:""}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(58),s=i(60),o=i(62);return{getCanvasView:function(){return o},name:"Canvas",init:function(e){n=e||{};for(var i in r)i in n||(n[i]=r[i]);var a=n.pStylePrefix;a&&(n.stylePrefix=a+n.stylePrefix),t=new s(e),o=new o({model:t,config:n});var l=n.em.get("DomComponents");return l&&this.setWrapper(l),this.startAutoscroll=this.startAutoscroll.bind(this),this.stopAutoscroll=this.stopAutoscroll.bind(this),this.autoscroll=this.autoscroll.bind(this),this},getConfig:function(){return n},setWrapper:function(e){t.set("wrapper",e)},getElement:function(){return o.el},getFrameEl:function(){return o.frame.el},getBody:function(){return o.frame.el.contentDocument.body},getWrapperEl:function(){return this.getBody().querySelector("#wrapper")},getToolsEl:function(){return o.toolsEl},getHighlighter:function(){return o.hlEl},getBadgeEl:function(){return o.badgeEl},getPlacerEl:function(){return o.placerEl},getGhostEl:function(){return o.ghostEl},getToolbarEl:function(){return o.toolbarEl},getResizerEl:function(){return o.resizerEl},getOffsetViewerEl:function(){return o.offsetEl},getFixedOffsetViewerEl:function(){return o.fixedOffsetEl},render:function(){return o.render().el},getOffset:function(){var t=this.offset(this.getFrameEl()),e=this.offset(this.getElement());return{top:t.top-e.top,left:t.left-e.left}},offset:function(t){var e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},setCustomBadgeLabel:function(t){n.customBadgeLabel=t},getElementPos:function(t,e){return o.getElementPos(t,e)},getTargetToElementDim:function(t,e,i){var r=i||{},s=o.getPosition(),a=r.elPos||o.getElementPos(e),l=i.toRight||0,c=r.targetHeight||t.offsetHeight,u=r.targetWidth||t.offsetWidth,h=r.event||null,d=a.top-c,f=a.left;f+=l?a.width:0,f=l?f-u:f;var p=f<s.left?s.left:f,g=d<s.top?s.top:d;g=g>a.top+a.height?a.top+a.height:g;var m={top:g,left:p,elementTop:a.top,elementLeft:a.left,elementWidth:a.width,elementHeight:a.height,targetWidth:t.offsetWidth,targetHeight:t.offsetHeight,canvasTop:s.top,canvasLeft:s.left};return h&&n.em&&n.em.trigger(h,m),m},getMouseRelativePos:function(t,e){var i=e||{},n=0,r=0,s=i.subWinOffset,o=t.target.ownerDocument,a=o.defaultView||o.parentWindow,l=a.frameElement,c=s?a.pageYOffset:0,u=s?a.pageXOffset:0;if(l){var h=l.getBoundingClientRect();n=h.top||0,r=h.left||0}return{y:t.clientY+n-c,x:t.clientX+r-u}},getMouseRelativeCanvas:function(t,e){var i=this.getFrameEl(),n=this.getBody(),r=i.offsetTop||0,s=i.offsetLeft||0,o=n.scrollTop||0,a=n.scrollLeft||0;return{y:t.clientY+r+o,x:t.clientX+s+a}},startAutoscroll:function(){this.dragging=1;var t=this.getScrollListeners();e=o.getFrameOffset(1),t.on("mousemove",this.autoscroll),t.on("mouseup",this.stopAutoscroll)},autoscroll:function(t){if(t.preventDefault(),this.dragging){var i=this.getFrameEl().contentWindow,n=i.document.body.scrollTop,r=n,s=t.clientY,o=e.height-50;s<50&&(r-=50-s),s>o&&(r+=s-o),i.scrollTo(0,r)}},stopAutoscroll:function(){this.dragging=0;var t=this.getScrollListeners();t.off("mousemove",this.autoscroll),t.off("mouseup",this.stopAutoscroll)},getScrollListeners:function(){return this.scrollListeners||(this.scrollListeners=$(this.getFrameEl().contentWindow,this.getElement())),this.scrollListeners},getFrameWrapperEl:function(){return o.frame.getWrapper()}}}},function(t,e,i){"use strict";var n=i(0),r=i(61);t.exports=n.Model.extend({defaults:{frame:"",wrapper:"",rulers:!1},initialize:function(t){var e=this.conf||{};this.set("frame",new r(e.frame))}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{wrapper:"",width:"",height:"",attributes:{}}})},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(63);t.exports=n.View.extend({initialize:function(t){e.bindAll(this,"renderBody","onFrameScroll","clearOff"),this.config=t.config||{},this.em=this.config.em||{},this.ppfx=this.config.pStylePrefix||"",this.className=this.config.stylePrefix+"canvas",this.listenTo(this.em,"change:canvasOffset",this.clearOff),this.frame=new r({model:this.model.get("frame"),config:this.config})},onFrameScroll:function(){var t=this.frame.el.contentDocument.body;this.toolsEl.style.top="-"+t.scrollTop+"px",this.toolsEl.style.left="-"+t.scrollLeft+"px",this.em.trigger("canvasScroll")},renderScripts:function(){var t=this.frame,e=this;t.el.onload=function(){function i(n){if(n.length>0){var r=document.createElement("script");r.type="text/javascript",r.src=n.shift(),r.onerror=r.onload=i.bind(null,n),t.el.contentDocument.head.appendChild(r)}else e.renderBody()}var n=e.config.scripts.slice(0);i(n)}},renderBody:function(){var t=this.model.get("frame").get("wrapper"),e=this.config.em;if(t){var i=this.ppfx,n=this.frame.$el.contents().find("body"),r=e.get("CssComposer"),s=e.get("Config"),o=this.config,a=s.protectedCss,l="";o.styles.forEach(function(t){l+='<link rel="stylesheet" href="'+t+'"/>'});var c="\n ."+i+"comp-selected{\n outline: 3px solid #3b97e3 !important\n }\n ."+i+"comp-selected-parent{\n outline: 2px solid #ffca6f !important\n }\n ",u="\n * {\n box-sizing: border-box;\n }\n html, body, #wrapper {\n min-height: 100%;\n }\n body {\n margin: 0;\n height: 100%;\n background-color: #fff\n }\n #wrapper {\n overflow: auto\n }\n ."+i+"dashed :not([contenteditable]) > *[data-highlightable]{outline: 1px dashed rgba(170,170,170,0.7); outline-offset: -2px}"+c+"."+i+"no-select{user-select: none; -webkit-user-select:none; -moz-user-select: none}."+i+"freezed{opacity: 0.5; pointer-events: none}."+i+"no-pointer{pointer-events: none}."+i+"plh-image{background:#f5f5f5; border:none; height:50px; width:50px; display:block; outline:3px solid #ffca6f; cursor:pointer}."+i+"grabbing{cursor: grabbing; cursor: -webkit-grabbing}* ::-webkit-scrollbar-track {background: rgba(0, 0, 0, 0.1)}* ::-webkit-scrollbar-thumb {background: rgba(255, 255, 255, 0.2)}* ::-webkit-scrollbar {width: 10px}"+(s.canvasCss||"");u+=a||"",l&&n.append(l),n.append("<style>"+u+"</style>"),n.append(t.render()).append(r.render()),n.append(this.getJsContainer()),e.trigger("loaded"),this.frame.el.contentWindow.onscroll=this.onFrameScroll,this.frame.udpateOffset();var h=document,d=this.frame.el.contentDocument;d.addEventListener("keydown",function(t){h.dispatchEvent(new KeyboardEvent(t.type,t))}),d.addEventListener("keyup",function(t){h.dispatchEvent(new KeyboardEvent(t.type,t))})}},offset:function(t){var e=t.getBoundingClientRect(),i=t.ownerDocument.body;return{top:e.top+i.scrollTop,left:e.left+i.scrollLeft,width:e.width,height:e.height}},clearOff:function(){this.frmOff=null,this.cvsOff=null},getFrameOffset:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.frmOff&&!t||(this.frmOff=this.offset(this.frame.el)),this.frmOff},getCanvasOffset:function(){return this.cvsOff||(this.cvsOff=this.offset(this.el)),this.cvsOff},getElementPos:function(t,e){var i=e||{},n=this.getFrameOffset(),r=this.getCanvasOffset(),s=this.offset(t),o=i.avoidFrameOffset?0:n.top,a=i.avoidFrameOffset?0:n.left;return{top:s.top+o-r.top,left:s.left+a-r.left,height:t.offsetHeight,width:t.offsetWidth}},getPosition:function(){var t=this.frame.el.contentDocument.body,e=this.getFrameOffset(),i=this.getCanvasOffset();return{top:e.top+t.scrollTop-i.top,left:e.left+t.scrollLeft-i.left}},updateScript:function(t){t.scriptContainer||(t.scriptContainer=$("<div>"),this.getJsContainer().append(t.scriptContainer.get(0)));var e=t.model,i=e.getId();t.el.id=i,t.scriptContainer.html(""),t.scriptContainer.append("<script>\n setTimeout(function() {\n var item = document.getElementById('"+i+"');\n if (!item) return;\n (function(){"+e.getScriptString()+"}.bind(item))()\n }, 1);\n <\/script>")},getJsContainer:function(){return this.jsContainer||(this.jsContainer=$("<div>",{class:this.ppfx+"js-cont"}).get(0)),this.jsContainer},render:function(){if(this.wrapper=this.model.get("wrapper"),this.wrapper&&"function"==typeof this.wrapper.render){this.model.get("frame").set("wrapper",this.wrapper),this.$el.append(this.frame.render().el);var t=this.frame;0===this.config.scripts.length?t.el.onload=this.renderBody:this.renderScripts()}var e=this.ppfx,i=$("<div>",{id:e+"tools"}).get(0);this.hlEl=$("<div>",{class:e+"highlighter"}).get(0),this.badgeEl=$("<div>",{class:e+"badge"}).get(0),this.placerEl=$("<div>",{class:e+"placeholder"}).get(0),this.placerIntEl=$("<div>",{class:e+"placeholder-int"}).get(0),this.ghostEl=$("<div>",{class:e+"ghost"}).get(0),this.toolbarEl=$("<div>",{class:e+"toolbar"}).get(0),this.resizerEl=$("<div>",{class:e+"resizer"}).get(0),this.offsetEl=$("<div>",{class:e+"offset-v"}).get(0),this.fixedOffsetEl=$("<div>",{class:e+"offset-fixed-v"}).get(0),this.placerEl.appendChild(this.placerIntEl),i.appendChild(this.hlEl),i.appendChild(this.badgeEl),i.appendChild(this.placerEl),i.appendChild(this.ghostEl),i.appendChild(this.toolbarEl),i.appendChild(this.resizerEl),i.appendChild(this.offsetEl),i.appendChild(this.fixedOffsetEl),this.$el.append(i);var n=this.em.get("rte");return n&&i.appendChild(n.render()),this.toolsEl=i,this.$el.attr({class:this.className}),this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({tagName:"iframe",attributes:{src:"about:blank",allowfullscreen:"allowfullscreen"},initialize:function(t){e.bindAll(this,"udpateOffset"),this.config=t.config||{},this.ppfx=this.config.pStylePrefix||"",this.em=this.config.em,this.motionsEv="transitionend oTransitionEnd transitionend webkitTransitionEnd",this.listenTo(this.em,"change:device",this.updateWidth)},updateWidth:function(t){var e=this.em.getDeviceModel();this.el.style.width=e?e.get("width"):"",this.udpateOffset(),this.$el.on(this.motionsEv,this.udpateOffset)},udpateOffset:function(){var t=this.em.get("Canvas").getOffset();this.em.set("canvasOffset",t),this.$el.off(this.motionsEv,this.udpateOffset)},getBody:function(){this.$el.contents().find("body")},getWrapper:function(){return this.$el.contents().find("body > div")},render:function(){return this.$el.attr({class:this.ppfx+"frame"}),this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={stylePrefix:"cm-",inlineCss:!1}},function(t,e,i){"use strict";t.exports=function(){var t={},e=i(64),n=i(68),r=i(67),s=i(70),o=i(69),a=i(66),l=i(71),c={},u={},h={},d={};return{getConfig:function(){return t},config:t,EditorView:l,name:"CodeManager",init:function(i){t=i||{};for(var l in e)l in t||(t[l]=e[l]);var c=t.pStylePrefix;return c&&(t.stylePrefix=c+t.stylePrefix),u.html=new n,u.css=new r,u.json=new s,u.js=new o,d.CodeMirror=new a,this},onLoad:function(){this.loadDefaultGenerators().loadDefaultViewers()},addGenerator:function(t,e){return c[t]=e,this},getGenerator:function(t){return c[t]||null},getGenerators:function(){return c},addViewer:function(t,e){return h[t]=e,this},getViewer:function(t){return h[t]||null},getViewers:function(){return h},updateViewer:function(t,e){t.setContent(e)},getCode:function(t,e,i){var n=this.getGenerator(e);return n?n.build(t,i):""},loadDefaultGenerators:function(){for(var t in u)this.addGenerator(t,u[t]);return this},loadDefaultViewers:function(){for(var t in d)this.addViewer(t,d[t]);return this}}}},function(t,e,i){"use strict";var n=i(0),r=i(5);i(200),i(40),i(199);t.exports=n.Model.extend({defaults:{input:"",label:"",codeName:"",theme:"",readOnly:!0,lineNumbers:!0},init:function(t){return this.editor=r.fromTextArea(t,{dragDrop:!1,lineWrapping:!0,lineNumbers:this.get("lineNumbers"),readOnly:this.get("readOnly"),mode:this.get("codeName"),theme:this.get("theme")}),this},setContent:function(t){this.editor&&(this.editor.setValue(t),this.editor.autoFormatRange&&(r.commands.selectAll(this.editor),this.editor.autoFormatRange(this.editor.getCursor(!0),this.editor.getCursor(!1)),r.commands.goDocStart(this.editor)))}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({initialize:function(){this.compCls=[]},buildFromModel:function(t){var e="",i=t.get("style"),n=t.get("classes");if(n&&n.each(function(t){this.compCls.push(t.get("name"))},this),i&&0!==Object.keys(i).length){e+="#"+t.getId()+"{";for(var r in i)i.hasOwnProperty(r)&&(e+=r+":"+i[r]+";");e+="}"}return e},buildFromComp:function(t){var e=t.get("components")||t,i="";return e.each(function(t){var e=t.get("components");i+=this.buildFromModel(t),e.length&&(i+=this.buildFromComp(e))},this),i},build:function(t,e){this.compCls=[];var i=this.buildFromModel(t);i+=this.buildFromComp(t);this.compCls;if(e){var n=e.getAll(),r={};n.each(function(t){var e=t.get("mediaText");if(e){var n=r[e];return void(n?n.push(t):r[e]=[t])}i+=this.buildFromRule(t)},this);for(var s in r){for(var o=r[s],a="",l=0,c=o.length;l<c;l++)a+=this.buildFromRule(o[l]);a&&(i+="@media "+s+"{"+a+"}")}}return i},buildFromRule:function(t){var e="",i=t.get("selectorsAdd"),n=t.get("selectors"),r=t.get("style"),s=t.get("state"),o="",a=0,l=this.compCls;if(n.each(function(t){o+="."+t.get("name"),l.indexOf(t.get("name"))>-1&&(a=1)}),o&&a||i){o+=s?":"+s:"",o+=i?(o?", ":"")+i:"";var c="";if(r&&0!==Object.keys(r).length)for(var u in r)r.hasOwnProperty(u)&&(c+=u+":"+r[u]+";");c&&(e+=o+"{"+c+"}")}return e}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({build:function(t,e){var i=t.get("components")||t,n="";return i.each(function(t){n+=t.toHTML({cssc:e})},this),n}})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.Model.extend({mapModel:function(t){var i="",n=t.get("script"),r=t.get("type"),s=t.get("components"),o=t.getId();if(n){var a=t.get("attributes");a=e.extend({},a,{id:o}),t.set("attributes",a);var l=t.getScriptString();if(t.get("scriptUpdated"))this.mapJs[r+"-"+o]={ids:[o],code:l};else{var c=this.mapJs[r];c?c.ids.push(o):this.mapJs[r]={ids:[o],code:l}}}return s.each(function(t){i+=this.mapModel(t)},this),i},build:function(t){this.mapJs={},this.mapModel(t);var e="";for(var i in this.mapJs){var n=this.mapJs[i];e+="\n var items = document.querySelectorAll('"+("#"+n.ids.join(", #"))+"');\n for (var i = 0, len = items.length; i < len; i++) {\n (function(){"+n.code+"}.bind(items[i]))();\n }"}return e}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.Model.extend({build:function(t){var i=t.toJSON();return this.beforeEach(i),e.each(i,function(t,e){var r=i[e];if(r instanceof n.Model)i[e]=this.build(r);else if(r instanceof n.Collection){var s=r;i[e]=[],s.length&&s.each(function(t,n){i[e][n]=this.build(t)},this)}},this),i},beforeEach:function(t){delete t.status}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({template:e.template('\n <div class="<%= pfx %>editor" id="<%= pfx %><%= codeName %>">\n \t<div id="<%= pfx %>title"><%= label %></div>\n \t<div id="<%= pfx %>code"></div>\n </div>'),initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix},render:function(){var t=this.model.toJSON();return t.pfx=this.pfx,this.$el.html(this.template(t)),this.$el.attr("class",this.pfx+"editor-c"),this.$el.find("#"+this.pfx+"code").html(this.model.get("input")),this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={ESCAPE_KEY:27,stylePrefix:"com-",defaults:[],em:null,firstCentered:!0,newFixedH:!1,minComponentH:50,minComponentW:50}},function(t,e,i){"use strict";t.exports=function(){var t={},e={},n={},r=i(72),s=i(74),o=function(t,i){return delete i.initialize,e[t]=s.extend(i),this};return{name:"Commands",init:function(e){t=e||{};for(var s in r)s in t||(t[s]=r[s]);var o=t.pStylePrefix;o&&(t.stylePrefix=o+t.stylePrefix);for(var a in t.defaults){var l=t.defaults[a];l.id&&this.add(l.id,l)}return n["select-comp"]=i(10),n["create-comp"]=i(9),n["delete-comp"]=i(75),n["image-comp"]=i(79),n["move-comp"]=i(80),n["text-comp"]=i(90),n["insert-custom"]=i(17),n["export-template"]=i(77),n["sw-visibility"]=i(89),n["open-layers"]=i(83),n["open-sm"]=i(84),n["open-tm"]=i(85),n["open-blocks"]=i(82),n["open-assets"]=i(81),n["show-offset"]=i(88),n.fullscreen=i(78),n.preview=i(86),n.resize=i(87),n.drag=i(76),n["tlb-delete"]={run:function(t){var e=t.getSelected();if(!e||!e.get("removable"))return void console.warn("The element is not removable");e.set("status",""),e.destroy(),t.trigger("component:update",e),t.editor.set("selectedComponent",null)}},n["tlb-clone"]={run:function(t){var e=t.getSelected();if(!e||!e.get("copyable"))return void console.warn("The element is not clonable");var i=e.collection,n=i.indexOf(e);i.add(e.clone(),{at:n+1}),t.trigger("component:update",e)}},n["tlb-move"]={run:function(t,e,i){var n,r=t.getSelected();if(!r||!r.get("draggable"))return void console.warn("The element is not draggable");var s=function(t,e){console.log("start mouse pos ",e.start),console.log("el rect ",e.elRect);var i=e.el;i.style.position="absolute",i.style.margin=0},o=function(e,i){l.runDefault(),l.set("selectedComponent",r),t.trigger("component:update",r),n&&n.blur()},a=function(t,e){console.log("Delta ",e.delta),console.log("Current ",e.current)};t.Canvas.getToolbarEl().style.display="none";var l=t.getModel();if(l.stopDefault(),l.get("designerMode"))n=editor.runCommand("drag",{el:r.view.el,options:{event:i&&i.event,onStart:s,onDrag:a,onEnd:o}});else{var c=t.Commands.get("move-comp");c.onEndMoveFromModel=o,c.initSorterFromModel(r)}r.set("status","selected")}},t.em&&(t.model=t.em.get("Canvas")),this},onLoad:function(){this.loadDefaultCommands()},add:o,get:function(i){var n=e[i];return"function"==typeof n&&(n=new n(t),e[i]=n),n},has:function(t){return!!e[t]},loadDefaultCommands:function(){for(var t in n)this.add(t,n[t]);return this}}}},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({initialize:function(t){this.config=t||{},this.editorModel=this.em=this.config.em||{},this.pfx=this.config.stylePrefix,this.ppfx=this.config.pStylePrefix,this.hoverClass=this.pfx+"hover",this.badgeClass=this.pfx+"badge",this.plhClass=this.pfx+"placeholder",this.freezClass=this.ppfx+"freezed",this.canvas=this.em.get&&this.em.get("Canvas"),this.em.get&&this.setElement(this.getCanvas()),this.canvas&&(this.$canvas=this.$el,this.$wrapper=$(this.getCanvasWrapper()),this.frameEl=this.canvas.getFrameEl(),this.canvasTool=this.getCanvasTools(),this.bodyEl=this.getCanvasBody()),this.init(this.config)},onFrameScroll:function(t){},getCanvas:function(){return this.canvas.getElement()},getCanvasBody:function(){return this.canvas.getBody()},getCanvasWrapper:function(){return this.canvas.getWrapperEl()},getCanvasTools:function(){return this.canvas.getToolsEl()},offset:function(t){var e=t.getBoundingClientRect();return{top:e.top+t.ownerDocument.body.scrollTop,left:e.left+t.ownerDocument.body.scrollLeft}},init:function(t){},run:function(t,e){},stop:function(t,e){}})},function(t,e,i){"use strict";(function(e){var n=(i(0),i(10));t.exports=e.extend({},n,{init:function(t){e.bindAll(this,"startDelete","stopDelete","onDelete"),this.hoverClass=this.pfx+"hover-delete",this.badgeClass=this.pfx+"badge-red"},enable:function(){this.$el.find("*").mouseover(this.startDelete).mouseout(this.stopDelete).click(this.onDelete)},startDelete:function(t){t.stopPropagation();var e=$(t.target);e.data("model").get("removable")&&(e.addClass(this.hoverClass),this.attachBadge(e.get(0)))},stopDelete:function(t){t.stopPropagation(),$(t.target).removeClass(this.hoverClass),this.badge&&this.badge.css({left:-1e3,top:-1e3})},onDelete:function(t){t.stopPropagation();var e=$(t.target);e.data("model").get("removable")&&(e.data("model").destroy(),this.removeBadge(),this.clean())},updateBadgeLabel:function(t){this.badge.html("Remove "+t.getName())}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={run:function(t,e,i){var n=i&&i.el||"",r=t.Canvas,s=this.dragger,o=i.options||{},a=r.getCanvasView();return o.prefix=t.getConfig().stylePrefix,o.mousePosFetcher=r.getMouseRelativePos,o.posFetcher=a.getElementPos.bind(a),s||(s=t.Utils.Dragger.init(o),this.dragger=s),s.setOptions(o),s.focus(n),o.event&&s.start(o.event),s},stop:function(){this.canvasResizer&&this.canvasResizer.blur()}}},function(t,e,i){"use strict";t.exports={run:function(t,e){this.sender=e,this.wrapper=t.DomComponents.getWrapper(),this.components=t.DomComponents.getComponents(),this.modal=t.Modal||null,this.cm=t.CodeManager||null,this.cssc=t.CssComposer||null,this.protCss=t.Config.protectedCss,this.pfx=t.Config.stylePrefix||"",this.enable()},buildEditor:function(t,e,i){this.codeMirror||(this.codeMirror=this.cm.getViewer("CodeMirror"));var n=$("<textarea>"),r=this.codeMirror.clone().set({label:i,codeName:t,theme:e,input:n[0]}),s=new this.cm.EditorView({model:r,config:this.cm.getConfig()}).render().$el;return r.init(n[0]),{el:r,$el:s}},enable:function(){if(!this.$editors){var t=this.buildEditor("htmlmixed","hopscotch","HTML"),e=this.buildEditor("css","hopscotch","CSS");this.htmlEditor=t.el,this.cssEditor=e.el,this.$editors=$("<div>",{class:this.pfx+"export-dl"}),this.$editors.append(t.$el).append(e.$el)}this.modal&&(this.modal.setTitle("Export template"),this.modal.setContent(this.$editors),this.modal.open());var i=this.protCss||"";this.htmlEditor.setContent(this.em.getHtml()),this.cssEditor.setContent(i+this.cm.getCode(this.wrapper,"css",this.cssc)),this.sender&&this.sender.set("active",!1)},stop:function(){}}},function(t,e,i){"use strict";t.exports={isEnabled:function(){var t=document;return t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement?1:0},enable:function(t){var e="";return t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?(e="webkit",t.webkitRequestFullscreen()):t.mozRequestFullScreen?(e="moz",t.mozRequestFullScreen()):t.msRequestFullscreen?t.msRequestFullscreen():console.warn("Fullscreen not supported"),e},disable:function(){var t=document;t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen?t.webkitExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.msExitFullscreen&&t.msExitFullscreen()},fsChanged:function(t,e){var i=(document,(t||"")+"fullscreenchange");this.isEnabled()||(this.stop(null,this.sender),document.removeEventListener(i,this.fsChanged))},run:function(t,e){this.sender=e;var i=this.enable(t.getContainer());this.fsChanged=this.fsChanged.bind(this,i),document.addEventListener(i+"fullscreenchange",this.fsChanged),t&&t.trigger("change:canvasOffset")},stop:function(t,e){e&&e.set&&e.set("active",!1),this.disable(),t&&t.trigger("change:canvasOffset")}}},function(t,e,i){"use strict";(function(e){var n=(i(0),i(17));t.exports=e.extend({},n,{beforeInsert:function(t){t.type="image",t.style={},t.attributes={},t.attributes.onmousedown="return false",this.config.firstCentered&&this.getCanvasWrapper()==this.sorter.target&&(t.style.margin="0 auto")},afterInsert:function(t){t.trigger("dblclick"),this.sender&&this.sender.set("active",!1)}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=(i(0),i(10)),r=i(18);t.exports=e.extend({},r,n,{init:function(t){n.init.apply(this,arguments),e.bindAll(this,"initSorter","rollback","onEndMove"),this.opt=t,this.hoverClass=this.ppfx+"highlighter-warning",this.badgeClass=this.ppfx+"badge-warning",this.noSelClass=this.ppfx+"no-select"},enable:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.enable.apply(this,e),this.getBadgeEl().addClass(this.badgeClass),this.getHighlighterEl().addClass(this.hoverClass);var r=this.$wrapper;r.css("cursor","move"),r.on("mousedown",this.initSorter),r.addClass(this.noSelClass)},toggleClipboard:function(){},initSorter:function(t){var e=$(t.target).data("model"),i=e.get("draggable");i&&(this.cacheEl=null,this.startSelectPosition(t.target,this.frameEl.contentDocument),this.sorter.draggable=i,this.sorter.onEndMove=this.onEndMove.bind(this),this.stopSelectComponent(),this.$wrapper.off("mousedown",this.initSorter),this.getContentWindow().on("keydown",this.rollback))},initSorterFromModel:function(t){var e=t.get("draggable");if(e){this.cacheEl=null;var i=t.view.el;this.startSelectPosition(i,this.frameEl.contentDocument),this.sorter.draggable=e,this.sorter.onEndMove=this.onEndMoveFromModel.bind(this),this.stopSelectComponent(),this.getContentWindow().on("keydown",this.rollback)}},onEndMoveFromModel:function(){this.getContentWindow().off("keydown",this.rollback)},onEndMove:function(){this.enable(),this.getContentWindow().off("keydown",this.rollback)},onSelect:function(t,e){},rollback:function(t,e){((t.which||t.keyCode)==this.opt.ESCAPE_KEY||e)&&(this.sorter.moved=!1,this.sorter.endMove())},getBadgeEl:function(){return this.$badge||(this.$badge=$(this.getBadge())),this.$badge},getHighlighterEl:function(){return this.$hl||(this.$hl=$(this.canvas.getHighlighter())),this.$hl},stop:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.stop.apply(this,e),this.getBadgeEl().removeClass(this.badgeClass),this.getHighlighterEl().removeClass(this.hoverClass),this.$wrapper.css("cursor","").unbind().removeClass(this.noSelClass)}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={run:function(t,e,i){var n=i||{},r=(t.getConfig(),t.Modal),s=t.AssetManager;s.onClick(n.onClick),s.onDblClick(n.onDblClick),s.setTarget(n.target),s.onSelect(n.onSelect),r.setTitle(n.modalTitle||"Select image"),r.setContent(s.render()),r.open()}}},function(t,e,i){"use strict";t.exports={run:function(t,e){var i,n=t.Config,r=(n.stylePrefix,t.BlockManager);if(!this.blocks){this.blocks=$("<div/>").get(0),this.blocks.appendChild(r.render());var s=t.Panels;i=s.getPanel("views-container")?s.getPanel("views-container"):s.addPanel({id:"views-container"}),i.set("appendContent",this.blocks).trigger("change:appendContent")}this.blocks.style.display="block"},stop:function(){this.blocks&&(this.blocks.style.display="none")}}},function(t,e,i){"use strict";var n=i(139);t.exports={run:function(t,e){if(!this.$layers){var i=t.DomComponents.getComponent().get("components"),r=t.getConfig(),s=t.Panels,o=r.layers.stylePrefix||"nv-";r.layers.stylePrefix=r.stylePrefix+o,r.layers.pStylePrefix=r.stylePrefix,r.layers.em=t.editor,r.layers.opened=t.editor.get("opened");var a=(new n).init(i,r.layers);this.$layers=a.render(),s.getPanel("views-container")?this.panel=s.getPanel("views-container"):this.panel=s.addPanel({id:"views-container"}),this.panel.set("appendContent",this.$layers).trigger("change:appendContent")}this.$layers.show()},stop:function(){this.$layers&&this.$layers.hide()}}},function(t,e,i){"use strict";i(34);t.exports={run:function(t,e){if(this.sender=e,!this.$cn){var i=t.getConfig(),n=t.Panels;this.$cn=$("<div/>"),this.$cn2=$("<div/>"),this.$cn.append(this.$cn2);var r=t.DeviceManager;if(r&&i.showDevices){n.addPanel({id:"devices-c"}).set("appendContent",r.render()).trigger("change:appendContent")}var s=t.SelectorManager;s&&this.$cn2.append(s.render([])),this.$cn2.append(t.StyleManager.render());var o=t.StyleManager.getConfig();this.$header=$("<div>",{class:o.stylePrefix+"header",text:o.textNoElement}),this.$cn.append(this.$header),n.getPanel("views-container")?this.panel=n.getPanel("views-container"):this.panel=n.addPanel({id:"views-container"}),this.panel.set("appendContent",this.$cn).trigger("change:appendContent"),this.target=t.editor,this.listenTo(this.target,"change:selectedComponent",this.toggleSm)}this.toggleSm()},toggleSm:function(){this.sender.get("active")&&(this.target.get("selectedComponent")?(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,i){"use strict";t.exports={run:function(t,e){var i,n=t.Config,r=n.stylePrefix,s=t.TraitManager;if(!this.obj){var o=s.getTraitsViewer(),a=s.getConfig();this.obj=$("<div/>").append('<div class="'+r+'traits-label">'+a.labelContainer+"</div>").get(0),this.obj.appendChild(o.render().el);var l=t.Panels;i=l.getPanel("views-container")?l.getPanel("views-container"):l.addPanel({id:"views-container"}),i.set("appendContent",this.obj).trigger("change:appendContent")}this.obj.style.display="block"},stop:function(){this.obj&&(this.obj.style.display="none")}}},function(t,e,i){"use strict";(function(e){t.exports={getPanels:function(t){return this.panels||(this.panels=t.Panels.getPanelsEl()),this.panels},tglPointers:function(t,i){var n=t.Canvas.getBody().querySelectorAll("."+this.ppfx+"no-pointer");e.each(n,function(t){t.style.pointerEvents=i?"":"all"})},run:function(t,e){e&&e.set&&e.set("active",!1),t.stopCommand("sw-visibility"),t.getModel().stopDefault();var i=this,n=this.getPanels(t),r=t.Canvas.getElement(),s=t.getEl(),o=t.Config.stylePrefix;this.helper||(this.helper=document.createElement("span"),this.helper.className=o+"off-prv fa fa-eye-slash",s.appendChild(this.helper),this.helper.onclick=function(){i.stop(t)}),this.helper.style.display="inline-block",this.tglPointers(t),n.style.display="none";var a=r.style;a.width="100%",a.height="100%",a.top="0",a.left="0",a.padding="0",a.margin="0",t.trigger("change:canvasOffset")},stop:function(t,e){var i=this.getPanels(t);t.runCommand("sw-visibility"),t.getModel().runDefault(),i.style.display="block",t.Canvas.getElement().setAttribute("style",""),this.helper&&(this.helper.style.display="none"),t.trigger("change:canvasOffset"),this.tglPointers(t,1)}}}).call(e,i(1))},function(t,e,i){"use strict";t.exports={run:function(t,e,i){var n=i||{},r=n.el||"",s=t.Canvas,o=this.canvasResizer,a=n.options||{},l=s.getCanvasView();return a.ratioDefault=1,a.appendTo=s.getResizerEl(),a.prefix=t.getConfig().stylePrefix,a.posFetcher=l.getElementPos.bind(l),a.mousePosFetcher=s.getMouseRelativePos,o&&!n.forceNew||(this.canvasResizer=t.Utils.Resizer.init(a),o=this.canvasResizer),o.setOptions(a),o.focus(r),o},stop:function(){this.canvasResizer&&this.canvasResizer.blur()}}},function(t,e,i){"use strict";t.exports={getOffsetMethod:function(t){return"get"+(t||"")+"OffsetViewerEl"},run:function(t,e,i){var n=i||{},r=n.state||"",s=t.getConfig();if(s.showOffsets&&(s.showOffsetsSelected||"Fixed"!=r)){var o=t.Canvas,a=n.el||"",l=n.elPos||o.getElementPos(a),c=window.getComputedStyle(a),u=this.ppfx,h=r+"State",d=this.getOffsetMethod(r),f=o[d]();f.style.display="block";var p=this["marginT"+r],g=this["marginB"+r],m=this["marginL"+r],v=this["marginR"+r],y=this["padT"+r],b=this["padB"+r],x=this["padL"+r],w=this["padR"+r];if(!this[h]){var C=r.toLowerCase(),k=C+"margin-v",S=C+"padding-v",T=$("<div>",{class:u+k}).get(0),M=$("<div>",{class:u+S}).get(0),E=u+k+"-el",P=u+S+"-el";p=$("<div>",{class:u+k+"-top "+E}).get(0),g=$("<div>",{class:u+k+"-bottom "+E}).get(0),m=$("<div>",{class:u+k+"-left "+E}).get(0),v=$("<div>",{class:u+k+"-right "+E}).get(0),y=$("<div>",{class:u+S+"-top "+P}).get(0),b=$("<div>",{class:u+S+"-bottom "+P}).get(0),x=$("<div>",{class:u+S+"-left "+P}).get(0),w=$("<div>",{class:u+S+"-right "+P}).get(0),this["marginT"+r]=p,this["marginB"+r]=g,this["marginL"+r]=m,this["marginR"+r]=v,this["padT"+r]=y,this["padB"+r]=b,this["padL"+r]=x,this["padR"+r]=w,T.appendChild(p),T.appendChild(g),T.appendChild(m),T.appendChild(v),M.appendChild(y),M.appendChild(b),M.appendChild(x),M.appendChild(w),f.appendChild(T),f.appendChild(M),this[h]="1"}var L=c.marginLeft.replace("px",""),A=parseInt(c.marginTop.replace("px","")),N=parseInt(c.marginBottom.replace("px","")),O=p.style,D=g.style,I=m.style,_=v.style,z=y.style,H=b.style,F=x.style,R=w.style,V=parseInt(l.left);O.height=c.marginTop,O.width=c.width,O.top=l.top-c.marginTop.replace("px","")+"px",O.left=V+"px",D.height=c.marginBottom,D.width=c.width,D.top=l.top+l.height+"px",D.left=V+"px";var B=l.height+A+N+"px",W=l.top-A+"px";I.height=B,I.width=c.marginLeft,I.top=W,I.left=V-L+"px",_.height=B,_.width=c.marginRight,_.top=W,_.left=V+l.width+"px";var j=parseInt(c.paddingTop.replace("px",""));z.height=c.paddingTop,z.width=c.width,z.top=l.top+"px",z.left=V+"px";var U=parseInt(c.paddingBottom.replace("px",""));H.height=c.paddingBottom,H.width=c.width,H.top=l.top+l.height-U+"px",H.left=V+"px";var q=l.height-U-j+"px",K=l.top+j+"px";F.height=q,F.width=c.paddingLeft,F.top=K,F.left=l.left+"px";var G=parseInt(c.paddingRight.replace("px",""));R.height=q,R.width=c.paddingRight,R.top=K,R.left=l.left+l.width-G+"px"}},stop:function(t,e,i){var n=i||{},r=n.state||"",s=this.getOffsetMethod(r);t.Canvas[s]().style.display="none"}}},function(t,e,i){"use strict";t.exports={run:function(t){t.Canvas.getBody().className=this.ppfx+"dashed"},stop:function(t){t.Canvas.getBody().className=""}}},function(t,e,i){"use strict";(function(e){var n=(i(0),i(9));t.exports=e.extend({},n,{beforeDraw:function(t){t.type="text",t.style||(t.style={}),t.style.padding="10px"},afterDraw:function(t){t&&t.set&&(t.trigger("focus"),this.sender&&this.sender.set("active",!1))}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={stylePrefix:"css-",staticRules:"",rules:[]}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(91),s=i(19),o=i(93),a=i(20),l=i(95);return{Selectors:a,name:"CssComposer",storageKey:function(){var t=[],e=n.stm&&n.stm.getConfig()||{};return e.storeCss&&t.push("css"),e.storeStyles&&t.push("styles"),t},init:function(i){n=i||{};for(var s in r)s in n||(n[s]=r[s]);var a=n.pStylePrefix;a&&(n.stylePrefix=a+n.stylePrefix);var c=n.em&&n.em.config.style||"";return n.rules=c||n.rules,n.sm=n.em,t=new o([],n),t.add(n.rules),e=new l({collection:t,config:n}),this},onLoad:function(){n.stm&&n.stm.isAutosave()&&n.em.listenRules(this.getAll())},load:function(e){var i=e||"";!i&&n.stm&&(i=n.em.getCacheLoad());var r="";if(i.styles)try{r=JSON.parse(i.styles)}catch(t){}else i.css&&(r=n.em.get("Parser").parseCss(i.css));return r&&t.reset(r),r},store:function(e){if(n.stm){var i={},r=this.storageKey();return r.indexOf("css")>=0&&(i.css=n.em.getCss()),r.indexOf("styles")>=0&&(i.styles=JSON.stringify(t)),e||n.stm.store(i),i}},add:function(e,i,n,r){var o=i||"",a=n||"",l=r||{},c=this.get(e,o,a,l);return c||(l.state=o,l.mediaText=a,l.selectors="",c=new s(l),c.get("selectors").add(e),t.add(c),c)},get:function(e,i,n,r){var s=null;return t.each(function(t){s||t.compare(e,i,n,r)&&(s=t)}),s},getAll:function(){return t},addCollection:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[],r=t instanceof Array?t:[t],s=0,o=r.length;s<o;s++){var a=r[s]||{};if(a.selectors){var l=n.em&&n.em.get("SelectorManager");l||console.warn("Selector Manager not found");for(var c=a.selectors,u=c instanceof Array?c:[c],h=[],d=0,f=u.length;d<f;d++){var p=l.add(u[d]);h.push(p)}var g=this.get(h,a.state,a.mediaText,a),m=this.add(h,a.state,a.mediaText,a),v=!g||!e.avoidUpdateStyle,y=a.style||{};if(v){var b=e.extend?Object.assign({},m.get("style"),y):y;m.set("style",b)}i.push(m)}}return i},render:function(){return e.render().el}}}},function(t,e,i){"use strict";var n=i(0),r=i(19);t.exports=n.Collection.extend({initialize:function(t,e){e&&e.sm&&(this.editor=e.sm),this.model=function(t,i){return!i.sm&&e&&e.sm&&(i.sm=e.sm),new r(t,i)}},add:function(t,e){return"string"==typeof t&&(t=this.editor.get("Parser").parseCss(t)),n.Collection.prototype.add.apply(this,[t,e])}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({tagName:"style",initialize:function(t){this.config=t.config||{},this.listenTo(this.model,"change:style",this.render),this.listenTo(this.model,"change:state",this.render),this.listenTo(this.model,"destroy remove",this.remove),this.listenTo(this.model,"change:mediaText",this.render),this.listenTo(this.model.get("selectors"),"change",this.selChanged)},selChanged:function(){this.selStr=this.renderSelectors(),this.render()},renderSelectors:function(){var t=[],e=this.model,i=e.get("selectorsAdd");e.get("selectors").each(function(e){t.push("."+e.get("name"))});var n=t.join("");return n+(n&&i?", ":"")+i},renderProperties:function(){var t=[],e=this.model.get("style");for(var i in e)t.push(i+":"+e[i]+";");return t.join("")},render:function(){var t="",e="";this.selStr||(this.selStr=this.renderSelectors());var i=this.renderProperties(),n=this.model.get("state"),r=this.model.get("mediaText");return this.selStr&&(n=n?":"+n:"",t=""!==i?"{"+i+"}":""),e=this.selStr&&t?this.selStr+n+t:"",r&&e&&(e="@media "+r+"{"+e+"}"),this.$el.html(e),this}})},function(t,e,i){"use strict";var n=i(0),r=i(94);t.exports=n.View.extend({initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.className=this.pfx+"rules",this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render)},addTo:function(t){this.addToCollection(t)},addToCollection:function(t,e){var i=e||null,n=r,s=new n({model:t,config:this.config}),o=s.render().el;return i?i.appendChild(o):this.$el.append(o),o},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.append(t),this.$el.attr("class",this.className),this}})},function(t,e,i){"use strict";t.exports={devices:[],deviceLabel:"Device"}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(96),s=i(99),o=i(100);return{name:"DeviceManager",init:function(i){n=i||{};for(var a in r)a in n||(n[a]=r[a]);return t=new s(n.devices),e=new o({collection:t,config:n}),this},add:function(e,i,n){var r=n||{};return r.name=e,r.width=i,t.add(r)},get:function(e){return t.get(e)},getAll:function(){return t},render:function(){return e.render().el}}}},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({idAttribute:"name",defaults:{name:"",width:"",widthMedia:null},initialize:function(){null==this.get("widthMedia")&&this.set("widthMedia",this.get("width"))}})},function(t,e,i){"use strict";var n=i(0),r=i(98);t.exports=n.Collection.extend({model:r})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({template:e.template('\n <div class="<%= ppfx %>device-label"><%= deviceLabel %></div>\n <div class="<%= ppfx %>field <%= ppfx %>select">\n <span id="<%= ppfx %>input-holder">\n <select class="<%= ppfx %>devices"></select>\n </span>\n <div class="<%= ppfx %>sel-arrow">\n <div class="<%= ppfx %>d-s-arrow"></div>\n </div>\n </div>\n <button style="display:none" class="<%= ppfx %>add-trasp">+</button>'),events:{change:"updateDevice"},initialize:function(t){this.config=t.config||{},this.em=this.config.em,this.ppfx=this.config.pStylePrefix||"",this.events["click ."+this.ppfx+"add-trasp"]=this.startAdd,this.listenTo(this.em,"change:device",this.updateSelect),this.delegateEvents()},startAdd:function(){},updateDevice:function(){var t=this.em;if(t){var e=this.devicesEl,i=e?e.val():"";t.set("device",i)}},updateSelect:function(){var t=this.em,e=this.devicesEl;if(t&&t.getDeviceModel&&e){var i=t.getDeviceModel(),n=i?i.get("name"):"";e.val(n)}},getOptions:function(){var t="";return this.collection.each(function(e){var i=e.get("name");t+='<option value="'+i+'">'+i+"</option>"}),t},render:function(){var t=this.ppfx;return this.$el.html(this.template({ppfx:t,deviceLabel:this.config.deviceLabel})),this.devicesEl=this.$el.find("."+t+"devices"),this.devicesEl.append(this.getOptions()),this.el.className=t+"devices-c",this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={stylePrefix:"comp-",wrapperId:"wrapper",wrapper:{removable:!1,copyable:!1,stylable:["background","background-color","background-image","background-repeat","background-attachment","background-position"],draggable:!1,badgable:!1,components:[]},components:[],rte:{},imageCompClass:"fa fa-picture-o",oAssetsOnCreate:!0,voidElements:["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r={},s=i(101),o=i(2),a=i(3),l=[{id:"cell",model:i(108),view:i(119)},{id:"row",model:i(109),view:i(120)},{id:"table",model:i(107),view:i(121)},{id:"map",model:i(104),view:i(116)},{id:"link",model:i(103),view:i(115)},{id:"video",model:i(111),view:i(123)},{id:"image",model:i(11),view:i(7)},{id:"script",model:i(105),view:i(117)},{id:"svg",model:i(106),view:i(118)},{id:"textnode",model:i(110),view:i(122)},{id:"text",model:i(21),view:i(22)},{id:"default",model:o,view:a}];return{componentTypes:l,name:"DomComponents",getConfig:function(){return n},storageKey:function(){var t=[],e=n.stm&&n.stm.getConfig()||{};return e.storeHtml&&t.push("html"),e.storeComponents&&t.push("components"),t},init:function(i){n=i||{};var c=n.em;c&&(n.components=c.config.components||n.components);for(var u in s)u in n||(n[u]=s[u]);var h=n.pStylePrefix;return h&&(n.stylePrefix=h+n.stylePrefix),c&&(n.rte=c.get("rte")||"",n.modal=c.get("Modal")||"",n.am=c.get("AssetManager")||"",c.get("Parser").compTypes=l,c.on("change:selectedComponent",this.componentChanged,this)),t=new o(n.wrapper,{sm:c,config:n,defaultTypes:l,componentTypes:r}),t.set({attributes:{id:"wrapper"}}),c&&!c.config.loadCompsOnRender&&t.get("components").add(n.components),e=new a({model:t,config:n,defaultTypes:l,componentTypes:r}),this},onLoad:function(){n.stm&&n.stm.isAutosave()&&(n.em.initUndoManager(),n.em.initChildrenComp(this.getWrapper()))},load:function(t){var e=t||"";!e&&n.stm&&(e=n.em.getCacheLoad());var i="";if(e.components)try{i=JSON.parse(e.components)}catch(t){}else e.html&&(i=e.html);return i&&i.length&&(this.clear(),this.getComponents().reset(),this.getComponents().add(i)),i},store:function(t){if(n.stm){var e={},i=this.storageKey();return i.indexOf("html")>=0&&(e.html=n.em.getHtml()),i.indexOf("components")>=0&&(e.components=JSON.stringify(n.em.getComponents())),t||n.stm.store(e),e}},getComponent:function(){return t},getWrapper:function(){return this.getComponent()},getComponents:function(){return this.getWrapper().get("components")},addComponent:function(t){return this.getComponents().add(t)},render:function(){return e.render().el},clear:function(){for(var t=this.getComponents(),e=0,i=t.length;e<i;e++)t.pop();return this},setComponents:function(t){this.clear().addComponent(t)},addType:function(t,e){var i=this.getType(t);i?(i.model=e.model,i.view=e.view):(e.id=t,l.unshift(e))},getType:function(t){for(var e=l,i=0;i<e.length;i++){if(e[i].id==t)return e[i]}},componentChanged:function(){var t=n.em,e=t.get("selectedComponent"),i=t.previous("selectedComponent");i&&i.set({status:"",state:""}),e&&e.set("status","selected")}}}},function(t,e,i){"use strict";(function(e){var n=i(21);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"link",tagName:"a",traits:["title","href","target"]}),getAttrToHTML:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var r=n.prototype.getAttrToHTML.apply(this,e);return delete r.onmousedown,r}},{isComponent:function(t){var e="";return"A"==t.tagName&&(e={type:"link"}),e}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(11),r=i(2);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"map",void:0,mapUrl:"https://maps.google.com/maps",tagName:"iframe",mapType:"q",address:"",zoom:"1",attributes:{frameborder:0},toolbar:r.prototype.defaults.toolbar,traits:[{label:"Address",name:"address",placeholder:"eg. London, UK",changeProp:1},{type:"select",label:"Map type",name:"mapType",changeProp:1,options:[{value:"q",name:"Roadmap"},{value:"w",name:"Satellite"}]},{label:"Zoom",name:"zoom",type:"range",min:"1",max:"20",changeProp:1}]}),initialize:function(t,e){this.get("src")?this.parseFromSrc():this.updateSrc(),n.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:address change:zoom change:mapType",this.updateSrc)},updateSrc:function(){this.set("src",this.getMapUrl())},getMapUrl:function(){var t=this,e=t.get("address"),i=t.get("zoom"),n=t.get("mapType");e=e?"&q="+e:"",i=i?"&z="+i:"",n=n?"&t="+n:"";var r=t.get("mapUrl")+"?"+e+i+n;return r+="&output=embed"},parseFromSrc:function(){var t=this.parseUri(this.get("src")),e=t.query;e.q&&this.set("address",e.q),e.z&&this.set("zoom",e.z),e.t&&this.set("mapType",e.t)}},{isComponent:function(t){var e="";return"IFRAME"==t.tagName&&/maps\.google\.com/.test(t.src)&&(e={type:"map",src:t.src}),e}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(2);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"script",droppable:!1,draggable:!1,hiddenLayer:!0})},{isComponent:function(t){if("SCRIPT"==t.tagName){var e={type:"script"};return t.src&&(e.src=t.src,e.onload=t.onload),e}}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(2);t.exports=n.extend({getName:function(){var t=this.get("tagName"),e=this.get("custom-name");return t=t.charAt(0).toUpperCase()+t.slice(1),e||t}},{isComponent:function(t){if(SVGElement&&t instanceof SVGElement)return{type:"svg"}}})},function(t,e,i){"use strict";(function(e){var n=i(2);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"table",tagName:"table",droppable:["tr","tbody","thead","tfoot"],columns:3,rows:2}),initialize:function(t,e){n.prototype.initialize.apply(this,arguments);var i=this.get("components"),r=this.get("rows"),s=this.get("columns");if(!i.length){for(var o=[];r--;){for(var a=[],l=s;l--;)a.push({type:"cell",classes:["cell"]});o.push({type:"row",classes:["row"],components:a})}i.add(o)}var c=[];i.each(function(t){"row"!=t.get("type")?t.get("components").each(function(t){"row"==t.get("type")&&(t.collection=i,c.push(t))}):c.push(t)}),i.reset(c)}},{isComponent:function(t){var e="";return"TABLE"==t.tagName&&(e={type:"table"}),e}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(2);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"cell",tagName:"td",draggable:["tr"]})},{isComponent:function(t){var e="",i=t.tagName;return"TD"!=i&&"TH"!=i||(e={type:"cell",tagName:i.toLowerCase()}),e}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(2);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"row",tagName:"tr",draggable:["table","tbody","thead"],droppable:["th","td"]}),initialize:function(t,e){n.prototype.initialize.apply(this,arguments);var i=[],r=this.get("components");r.each(function(t){"cell"==t.get("type")&&i.push(t)}),r.reset(i)}},{isComponent:function(t){var e="";return"TR"==t.tagName&&(e={type:"row"}),e}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(2);t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{droppable:!1,editable:!0}),toHTML:function(){return this.get("content")}},{isComponent:function(t){var e="";return 3===t.nodeType&&(e={type:"textnode",content:t.textContent}),e}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(11),r=i(2),s="yt",o="vi";t.exports=n.extend({defaults:e.extend({},n.prototype.defaults,{type:"video",tagName:"video",videoId:"",void:0,provider:"",ytUrl:"https://www.youtube.com/embed/",viUrl:"https://player.vimeo.com/video/",loop:0,muted:0,autoplay:0,controls:1,color:"",sources:[],attributes:{allowfullscreen:"allowfullscreen"},toolbar:r.prototype.defaults.toolbar}),initialize:function(t,e){var i=[];switch(this.get("provider")){case s:i=this.getYoutubeTraits();break;case o:i=this.getVimeoTraits();break;default:i=this.getSourceTraits()}this.get("src")&&this.parseFromSrc(),this.set("traits",i),n.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:provider",this.updateTraits),this.listenTo(this,"change:videoId",this.updateSrc)},parseFromSrc:function(){var t=this.get("provider"),e=this.parseUri(this.get("src")),i=e.query;switch(t){case s:case o:var n=e.pathname.split("/").pop();this.set("videoId",n),i.autoplay&&this.set("autoplay",1),i.loop&&this.set("loop",1),0===parseInt(i.controls)&&this.set("controls",0),i.color&&this.set("color",i.color)}},updateSrc:function(){switch(this.get("provider")){case s:this.set("src",this.getYoutubeSrc());break;case o:this.set("src",this.getVimeoSrc())}},getAttrToHTML:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var r=n.prototype.getAttrToHTML.apply(this,e);switch(this.get("provider")){case s:case o:break;default:this.get("loop")&&(r.loop="loop"),this.get("autoplay")&&(r.autoplay="autoplay"),this.get("controls")&&(r.controls="controls")}return r},updateTraits:function(){var t=this.get("provider"),e=this.getSourceTraits();switch(t){case s:this.set("tagName","iframe"),e=this.getYoutubeTraits();break;case o:this.set("tagName","iframe"),e=this.getVimeoTraits();break;default:this.set("tagName","video")}this.loadTraits(e),this.sm.trigger("change:selectedComponent")},getProviderTrait:function(){return{type:"select",label:"Provider",name:"provider",changeProp:1,value:this.get("provider"),options:[{value:"so",name:"HTML5 Source"},{value:s,name:"Youtube"},{value:o,name:"Vimeo"}]}},getSourceTraits:function(){return[this.getProviderTrait(),{label:"Source",name:"src",placeholder:"eg. ./media/video.mp4",changeProp:1},this.getAutoplayTrait(),this.getLoopTrait(),this.getControlsTrait()]},getYoutubeTraits:function(){return[this.getProviderTrait(),{label:"Video ID",name:"videoId",placeholder:"eg. jNQXAC9IVRw",changeProp:1},this.getAutoplayTrait(),this.getLoopTrait(),this.getControlsTrait()]},getVimeoTraits:function(){return[this.getProviderTrait(),{label:"Video ID",name:"videoId",placeholder:"eg. 123456789",changeProp:1},{label:"Color",name:"color",placeholder:"eg. FF0000",changeProp:1},this.getAutoplayTrait(),this.getLoopTrait(),this.getControlsTrait()]},getAutoplayTrait:function(){return{type:"checkbox",label:"Autoplay",name:"autoplay",changeProp:1}},getLoopTrait:function(){return{type:"checkbox",label:"Loop",name:"loop",changeProp:1}},getControlsTrait:function(){return{type:"checkbox",label:"Controls",name:"controls",changeProp:1}},getYoutubeSrc:function(){var t=this.get("ytUrl");return t+=this.get("videoId")+"?",t+=this.get("autoplay")?"&autoplay=1":"",t+=this.get("controls")?"":"&controls=0",t+=this.get("loop")?"&loop=1":""},getVimeoSrc:function(){var t=this.get("viUrl");return t+=this.get("videoId")+"?",t+=this.get("autoplay")?"&autoplay=1":"",t+=this.get("loop")?"&loop=1":"",t+=this.get("controls")?"":"&title=0&portrait=0&badge=0",t+=this.get("color")?"&color="+this.get("color"):""}},{isComponent:function(t){var e="",i=/youtube\.com\/embed/.test(t.src),n=/player\.vimeo\.com\/video/.test(t.src),r=i||n;return("VIDEO"==t.tagName||"IFRAME"==t.tagName&&r)&&(e={type:"video"},t.src&&(e.src=t.src),r&&(i?e.provider=s:n&&(e.provider=o))),e}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.Collection.extend({initialize:function(t,e){this.on("add",this.onAdd),this.config=e&&e.config?e.config:null,e&&e.sm&&(this.editor=e.sm),this.model=function(t,i){var n;!i.sm&&e&&e.sm&&(i.sm=e.sm),e&&e.config&&(i.config=e.config),e&&e.defaultTypes&&(i.defaultTypes=e.defaultTypes),e&&e.componentTypes&&(i.componentTypes=e.componentTypes);for(var r=e.defaultTypes,s=0;s<r.length;s++){if(r[s].id==t.type){n=r[s].model;break}}return n||(n=r[r.length-1].model),new n(t,i)}},add:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t){var i=this.editor.get("Parser").parseHtml(t);t=i.html;var r=this.editor.get("CssComposer");if(i.css&&r){var s=e.avoidUpdateStyle;r.addCollection(i.css,{extend:1,avoidUpdateStyle:s})}}return n.Collection.prototype.add.apply(this,[t,e])},onAdd:function(t,i,n){var r=t.get("style"),s=this.editor;if(!e.isEmpty(r)&&s&&s.get("Config").forceClass){var o=this.editor.get("CssComposer"),a=this.editor.get("SelectorManager").add(t.cid);t.set({style:{}}),t.get("classes").add(a);o.add(a).set("style",r)}}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(114);t.exports=n.Collection.extend({model:r})},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{command:"",attributes:{}}})},function(t,e,i){"use strict";var n=(i(0),i(22));t.exports=n.extend({events:{dblclick:"enableEditing"},render:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];return n.prototype.render.apply(this,e),this.el.addEventListener("click",this.prevDef,!0),this}})},function(t,e,i){"use strict";var n=(i(0),i(7));t.exports=n.extend({tagName:"div",events:{},initialize:function(t){n.prototype.initialize.apply(this,arguments),this.classEmpty=this.ppfx+"plh-map"},updateSrc:function(){this.getIframe().src=this.model.get("src")},getIframe:function(){if(!this.iframe){var t=document.createElement("iframe");t.src=this.model.get("src"),t.frameBorder=0,t.style.height="100%",t.style.width="100%",t.className=this.ppfx+"no-pointer",this.iframe=t}return this.iframe},render:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];return n.prototype.render.apply(this,e),this.updateClasses(),this.el.appendChild(this.getIframe()),this}})},function(t,e,i){"use strict";var n=(i(0),i(7));t.exports=n.extend({tagName:"script",events:{},render:function(){var t=this.model,e=t.get("src"),i=this.em,n=i&&i.get("scriptCount")?i.get("scriptCount"):0,r="";if(e){var s=t.get("onload"),o="script"+n,a="script"+(n+1);r="var "+o+" = document.createElement('script');\n"+o+".onload = function(){\n"+(s?s+"();\n":"")+"typeof "+a+"Start == 'function' && "+a+"Start();\n};\n"+o+".src = '"+e+"';\nfunction "+o+"Start() { document.body.appendChild("+o+"); };\n"+(n?"":o+"Start();"),i&&i.set("scriptCount",n+1)}else r=t.get("content");return this.el.innerHTML=r,this}})},function(t,e,i){"use strict";var n=i(3);t.exports=n.extend({_createElement:function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}})},function(t,e,i){"use strict";var n=(i(0),i(3));t.exports=n.extend({})},function(t,e,i){"use strict";var n=(i(0),i(3));t.exports=n.extend({})},function(t,e,i){"use strict";var n=(i(0),i(3));t.exports=n.extend({events:{}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({})},function(t,e,i){"use strict";var n=(i(0),i(7));t.exports=n.extend({tagName:"div",events:{},initialize:function(t){n.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:loop change:autoplay change:controls change:color",this.updateVideo),this.listenTo(this.model,"change:provider",this.updateProvider)},updateProvider:function(){var t=this.model.get("provider");this.el.innerHTML="",this.el.appendChild(this.renderByProvider(t))},updateSrc:function(){var t=this.model.get("provider"),e=this.model.get("src");switch(t){case"yt":e=this.model.getYoutubeSrc();break;case"vi":e=this.model.getVimeoSrc()}this.videoEl.src=e},updateVideo:function(){var t=this.model.get("provider"),e=this.videoEl,i=this.model;switch(t){case"yt":case"vi":this.model.trigger("change:videoId");break;default:e.loop=i.get("loop"),e.autoplay=i.get("autoplay"),e.controls=i.get("controls")}},renderByProvider:function(t){var e;switch(t){case"yt":e=this.renderYoutube();break;case"vi":e=this.renderVimeo();break;default:e=this.renderSource()}return this.videoEl=e,e},renderSource:function(){var t=document.createElement("video");return t.src=this.model.get("src"),this.initVideoEl(t),t},renderYoutube:function(){var t=document.createElement("iframe");return t.src=this.model.getYoutubeSrc(),t.frameBorder=0,t.setAttribute("allowfullscreen",!0),this.initVideoEl(t),t},renderVimeo:function(){var t=document.createElement("iframe");return t.src=this.model.getVimeoSrc(),t.frameBorder=0,t.setAttribute("allowfullscreen",!0),this.initVideoEl(t),t},initVideoEl:function(t){t.className=this.ppfx+"no-pointer",t.style.height="100%",t.style.width="100%"},render:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.prototype.render.apply(this,e),this.updateClasses();var r=this.model.get("provider");return this.el.appendChild(this.renderByProvider(r)),this}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({initialize:function(t){this.opts=t||{},this.config=t.config||{},this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render)},addTo:function(t){var e=this.collection.indexOf(t);this.addToCollection(t,null,e);var i=this.config.em;i&&(i.trigger("add:component",t),i.trigger("component:add",t))},addToCollection:function(t,e,n){this.compView||(this.compView=i(3));for(var r=e||null,s=this.compView,o=this.opts.defaultTypes,a=this.opts.componentTypes,l=t.get("type"),c=0;c<o.length;c++){if(o[c].id==l){s=o[c].view;break}}var u=new s({model:t,config:this.config,defaultTypes:o,componentTypes:a}),h=u.render().el;if("textnode"==u.model.get("type")&&(h=document.createTextNode(u.model.get("content"))),r)r.appendChild(h);else{var d=this.$parent,f=d.children;if(void 0!==n){var p="before";f&&d.children().length==n&&(n--,p="after"),n<0?d.append(h):f&&d.children().eq(n)[p](h)}else d.append(h)}return h},render:function(t){var e=document.createDocumentFragment();return this.$parent=t||this.$el,this.$el.empty(),this.collection.each(function(t){this.addToCollection(t,e)},this),this.$el.append(e),this}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({events:{mousedown:"handleClick"},attributes:function(){return this.model.get("attributes")},initialize:function(t){this.editor=t.config.editor},handleClick:function(t){var e={event:t},i=this.model.get("command");"function"==typeof i&&i(this.editor,null,e),"string"==typeof i&&this.editor.runCommand(i,e)},render:function(){var t=this.editor.getConfig();return this.el.className+=" "+t.stylePrefix+"toolbar-item",this}})},function(t,e,i){"use strict";var n=(i(0),i(26)),r=i(125);t.exports=n.extend({itemView:r,initialize:function(t){this.config={editor:t.editor||""},this.listenTo(this.collection,"reset",this.render)}})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({events:{change:"handleChange"},template:e.template("<span class='<%= holderClass %>'></span>"),initialize:function(t){var e=t||{},i=e.ppfx||"";this.target=e.target||{},this.inputClass=i+"field",this.inputHolderClass=i+"input-holder",this.ppfx=i,this.listenTo(this.model,"change:value",this.handleModelChange)},handleChange:function(t){t.stopPropagation(),this.setValue(this.getInputEl().value)},setValue:function(t,e){var i=e||{},n=this.model;n.set({value:t||n.get("defaults")},i),i.silent&&this.handleModelChange()},handleModelChange:function(){this.getInputEl().value=this.model.get("value")},getInputEl:function(){return this.inputEl||(this.inputEl=$("<input>",{type:"text",class:this.inputCls,placeholder:this.model.get("defaults")})),this.inputEl.get(0)},render:function(){var t=this.$el;return t.addClass(this.inputClass),t.html(this.template({holderClass:this.inputHolderClass,ppfx:this.ppfx})),t.find("."+this.inputHolderClass).html(this.getInputEl()),this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={stylePrefix:"gjs-",components:"",copyPaste:!0,noticeOnUnload:!0,undoManager:!0,showOffsets:!1,showOffsetsSelected:!1,clearOnRender:!1,jsInHtml:!0,forceClass:!0,height:"900px",width:"100%",protectedCss:"*{box-sizing: border-box;} body{margin: 0;}",canvasCss:"",defaultCommand:"select-comp",showToolbar:1,allowScripts:0,showDevices:1,devicePreviewMode:0,mediaCondition:"max-width",tagVarStart:"{[ ",tagVarEnd:" ]}",loadCompsOnRender:1,el:"",assetManager:{},canvas:{},layers:{},storageManager:{},rte:{},domComponents:{},modal:{},codeManager:{},panels:{},commands:{},cssComposer:{},selectorManager:{},deviceManager:{devices:[{name:"Desktop",width:""},{name:"Tablet",width:"768px",widthMedia:"992px"},{name:"Mobile landscape",width:"568px",widthMedia:"768px"},{name:"Mobile portrait",width:"320px",widthMedia:"480px"}]},styleManager:{sectors:[{name:"General",open:!1,buildProps:["float","display","position","top","right","left","bottom"]},{name:"Dimension",open:!1,buildProps:["width","height","max-width","min-height","margin","padding"]},{name:"Typography",open:!1,buildProps:["font-family","font-size","font-weight","letter-spacing","color","line-height","text-align","text-shadow"],properties:[{property:"text-align",list:[{value:"left",className:"fa fa-align-left"},{value:"center",className:"fa fa-align-center"},{value:"right",className:"fa fa-align-right"},{value:"justify",className:"fa fa-align-justify"}]}]},{name:"Decorations",open:!1,buildProps:["border-radius-c","background-color","border-radius","border","box-shadow","background"]},{name:"Extra",open:!1,buildProps:["transition","perspective","transform"]}]},blockManager:{}}},function(t,e,i){"use strict";t.exports=function(t){var e=t||{},n=i(128),r=i(130),s=i(131);for(var o in n)o in e||(e[o]=n[o]);e.pStylePrefix=e.stylePrefix;var a=new r(e),l=new s({model:a,config:e});return{editor:a,DomComponents:a.get("DomComponents"),CssComposer:a.get("CssComposer"),StorageManager:a.get("StorageManager"),AssetManager:a.get("AssetManager"),BlockManager:a.get("BlockManager"),TraitManager:a.get("TraitManager"),SelectorManager:a.get("SelectorManager"),CodeManager:a.get("CodeManager"),Commands:a.get("Commands"),Modal:a.get("Modal"),Panels:a.get("Panels"),StyleManager:a.get("StyleManager"),Canvas:a.get("Canvas"),UndoManager:a.get("UndoManager"),DeviceManager:a.get("DeviceManager"),RichTextEditor:a.get("rte"),Utils:a.get("Utils"),Config:a.get("Config"),init:function(){return a.init(this),this},getConfig:function(){return e},getHtml:function(){return a.getHtml()},getCss:function(){return a.getCss()},getJs:function(){return a.getJs()},getComponents:function(){return a.get("DomComponents").getComponents()},setComponents:function(t){return a.setComponents(t),this},addComponents:function(t,e){return this.getComponents().add(t,e)},getStyle:function(){return a.get("CssComposer").getAll()},setStyle:function(t){return a.setStyle(t),this},getSelected:function(){return a.getSelected()},getSelectedToStyle:function(){var t=a.getSelected();if(t)return this.StyleManager.getModelToStyle(t)},select:function(t){return a.setSelected(t),this},setDevice:function(t){return a.set("device",t),this},getDevice:function(){return a.get("device")},runCommand:function(t,e){var i,n=a.get("Commands").get(t);return n&&(i=n.run(this,this,e),this.trigger("run:"+t)),i},stopCommand:function(t,e){var i,n=a.get("Commands").get(t);return n&&(i=n.stop(this,this,e),this.trigger("stop:"+t)),i},store:function(t){return a.store(t)},load:function(t){return a.load(t)},getContainer:function(){return e.el},refresh:function(){a.refreshCanvas()},setCustomRte:function(t){this.RichTextEditor.customRte=t},on:function(t,e){return a.on(t,e)},off:function(t,e){return a.off(t,e)},trigger:function(t){return a.trigger(t)},getEl:function(){return l.el},getModel:function(){return a},render:function(){return a.on("loaded",function(){a.get("modules").forEach(function(t){t.postRender&&t.postRender(l)})}),l.render(),l.el}}}},function(t,e,i){"use strict";var n,r=[i(196),i(165),i(97),i(148),i(161),i(135),i(65),i(142),i(154),i(34),i(45),i(92),i(102),i(59),i(73),i(51),i(185)],s=i(0),o=i(197),a=i(41);t.exports=s.Model.extend({defaults:{clipboard:null,designerMode:!1,selectedComponent:null,previousModel:null,changesCount:0,storables:[],modules:[],toLoad:[],opened:{},device:""},initialize:function(t){this.config=t,this.set("Config",t),this.set("modules",[]),t.el&&t.fromElement&&(this.config.components=t.el.innerHTML),r.forEach(function(t){this.loadModule(t)},this),this.get("toLoad").forEach(function(t){t.onLoad()}),this.loadOnStart(),this.initUndoManager(),this.on("change:selectedComponent",this.componentSelected,this),this.on("change:changesCount",this.updateBeforeUnload,this)},loadOnStart:function(){var t=this.get("StorageManager");t&&t.getConfig().autoload&&this.load()},updateBeforeUnload:function(){var t=this.get("changesCount");this.config.noticeOnUnload&&t?window.onbeforeunload=function(t){return 1}:window.onbeforeunload=null},loadModule:function(t){var e=this.config,i=new t,n=i.name.charAt(0).toLowerCase()+i.name.slice(1),r=e[n]||e[i.name]||{};r.pStylePrefix=e.pStylePrefix||"";var s=this.get("StorageManager");if(i.storageKey&&i.store&&i.load&&s){r.stm=s;var o=this.get("storables");o.push(i),this.set("storables",o)}return r.em=this,i.init(Object.create(r)),i.private||this.set(i.name,i),i.onLoad&&this.get("toLoad").push(i),this.get("modules").push(i),this},init:function(t){this.set("Editor",t)},listenRules:function(t){this.stopListening(t,"add remove",this.listenRule),this.listenTo(t,"add remove",this.listenRule),t.each(function(t){this.listenRule(t)},this)},listenRule:function(t){this.stopListening(t,"change:style",this.componentsUpdated),this.listenTo(t,"change:style",this.componentsUpdated)},componentsUpdated:function(t,e,i){var r=this;(i?i.temporary:0)||(n&&clearInterval(n),n=setTimeout(function(){var t=r.get("changesCount")+1,e=i?i.avoidStore:0,n=r.get("StorageManager");r.set("changesCount",t),!n.isAutosave()||t<n.getStepsBeforeSave()||e||r.store()},0))},initUndoManager:function(){if(!this.um){var t=this.get("DomComponents");if(t&&this.config.undoManager){var e=this;this.um=new o({register:[t.getComponents(),this.get("CssComposer").getAll()],track:!0}),this.UndoManager=this.um,this.set("UndoManager",this.um),a("⌘+z, ctrl+z",function(){e.um.undo(!0),e.trigger("component:update")}),a("⌘+shift+z, ctrl+shift+z",function(){e.um.redo(!0),e.trigger("component:update")});var i,n={on:function(t,e,n){var r=n||{};if(i||(i=t.previousAttributes()),!r||!r.avoidStore){var s={object:t,before:i,after:t.toJSON()};return i=null,s}},undo:function(t,i,n,r){t.set(i),e.trigger("change:selectedComponent")},redo:function(t,i,n,r){t.set(n),e.trigger("change:selectedComponent")}};o.removeUndoType("change"),o.addUndoType("change:style",n),o.addUndoType("change:content",n)}}},componentSelected:function(t,e,i){this.get("selectedComponent")?this.trigger("select-comp",[t,e,i]):this.trigger("deselect-comp")},updateComponents:function(t,e,i){var n=t.get("components"),r=t.get("classes"),s=i?i.avoidStore:0;this.um&&this.um.register(n),this.stopListening(n,"add",this.updateComponents),this.stopListening(n,"remove",this.rmComponents),this.listenTo(n,"add",this.updateComponents),this.listenTo(n,"remove",this.rmComponents),this.stopListening(r,"add remove",this.componentsUpdated),this.listenTo(r,"add remove",this.componentsUpdated);var o="change:style change:content change:attributes";this.stopListening(t,o,this.componentsUpdated),this.listenTo(t,o,this.componentsUpdated),s||this.componentsUpdated(t,e,i)},initChildrenComp:function(t){var e=t.get("components");this.updateComponents(t,null,{avoidStore:1}),e.each(function(t){this.initChildrenComp(t),this.um&&this.um.register(t)},this)},rmComponents:function(t,e,i){(i?i.avoidStore:0)||this.componentsUpdated(t,e,i)},getSelected:function(){return this.get("selectedComponent")},setSelected:function(t){var e=t;t instanceof HTMLElement&&(e=$(t).data("model")),this.set("selectedComponent",e)},setComponents:function(t){return this.get("DomComponents").setComponents(t)},getComponents:function(){var t=this.get("DomComponents"),e=this.get("CodeManager");if(t&&e){var i=t.getComponents();return e.getCode(i,"json")}},setStyle:function(t){for(var e=this.get("CssComposer").getAll(),i=0,n=e.length;i<n;i++)e.pop();return e.add(t),this},getStyle:function(){return this.get("CssComposer").getAll()},getHtml:function(){var t=this.config.jsInHtml?this.getJs():"",e=this.get("DomComponents").getComponent(),i=this.get("CodeManager").getCode(e,"html");return i+=t?"<script>"+t+"<\/script>":""},getCss:function(){var t=this.get("CssComposer"),e=this.get("DomComponents").getComponent();return this.config.protectedCss+this.get("CodeManager").getCode(e,"css",t)},getJs:function(){var t=this.get("DomComponents").getWrapper();return this.get("CodeManager").getCode(t,"js").trim()},store:function(t){var e=this,i=this.get("StorageManager"),n={};if(i)return this.get("storables").forEach(function(t){var e=t.store(1);for(var i in e)n[i]=e[i]}),i.store(n,function(){t&&t(),e.set("changesCount",0),e.trigger("storage:store",n)}),n},load:function(t){var e=this.getCacheLoad(1,t);return this.get("storables").forEach(function(t){t.load(e)}),e},getCacheLoad:function(t,e){var i=this,n=t?1:0;if(this.cacheLoad&&!n)return this.cacheLoad;var r=this.get("StorageManager"),s=[];return r?(this.get("storables").forEach(function(t){var e=t.storageKey;e="function"==typeof e?e():e,(e instanceof Array?e:[e]).forEach(function(t){s.push(t)})}),this.cacheLoad=r.load(s,function(t){e&&e(t),i.trigger("storage:load",t)}),this.cacheLoad):{}},getDeviceModel:function(){var t=this.get("device");return this.get("DeviceManager").get(t)},runDefault:function(){var t=this.get("Commands").get(this.config.defaultCommand);t&&!this.defaultRunning&&(t.stop(this,this),t.run(this,this),this.defaultRunning=1)},stopDefault:function(){var t=this.get("Commands").get(this.config.defaultCommand);t&&(t.stop(this,this),this.defaultRunning=0)},refreshCanvas:function(){this.set("canvasOffset",this.get("Canvas").getOffset())},clearSelection:function(t){(t||window).getSelection().removeAllRanges()}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.View.extend({initialize:function(){this.model.view=this,this.pn=this.model.get("Panels"),this.conf=this.model.config,this.className=this.conf.stylePrefix+"editor",this.model.on("loaded",function(){this.pn.active(),this.model.runDefault(),this.model.trigger("load")},this)},render:function(){var t=this.model,e=t.get("UndoManager"),i=t.get("DomComponents"),n=t.get("Config");n.loadCompsOnRender&&(n.clearOnRender&&i.clear(),i.getComponents().reset(n.components),t.loadOnStart(),e.clear(),i.onLoad());var r=this.conf,s=$(r.el||"body "+r.container);return this.$el.empty(),r.width&&s.css("width",r.width),r.height&&s.css("height",r.height),this.$el.append(t.get("Canvas").render()),this.$el.append(this.pn.render()),this.$el.attr("class",this.className),s.addClass(r.stylePrefix+"editor-cont"),s.html(this.$el),this}})},function(t,e,i){"use strict";t.exports={autorender:1,container:"",components:"",style:"",fromElement:0,copyPaste:!0,undoManager:!0,storageManager:{},plugins:[],pluginsOpts:{}}},function(t,e,i){"use strict";t.exports=i(43)},function(t,e,i){"use strict";t.exports={stylePrefix:"mdl-",title:"",content:"",backdrop:!0}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(134),s=i(136),o=i(137);return{name:"Modal",init:function(i){n=i||{};for(var a in r)a in n||(n[a]=r[a]);var l=n.pStylePrefix;return l&&(n.stylePrefix=l+n.stylePrefix),t=new s(n),e=new o({model:t,config:n}),n.em&&n.em.on("loaded",function(){this.render().appendTo(n.em.config.el||"body")},this),this},open:function(){return e.show(),this},close:function(){return e.hide(),this},isOpen:function(){return!!t.get("open")},setTitle:function(e){return t.set("title",e),this},getTitle:function(){return t.get("title")},setContent:function(e){return t.set("content"," "),t.set("content",e),this},getContent:function(){return t.get("content")},getContentEl:function(){return e.getContent().get(0)},getModel:function(){return t},render:function(){return e.render().$el}}}},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{title:"",content:"",open:!1}})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({template:e.template('\n <div class="<%= pfx %>dialog">\n <div class="<%= pfx %>header">\n <div class="<%= pfx %>title"><%= title %></div>\n <div class="<%= pfx %>btn-close">⨯</div>\n </div>\n <div class="<%= pfx %>content">\n <div id="<%= pfx %>c"> <%= content %> </div>\n <div style="clear:both"></div>\n </div>\n </div>\n <div class="<%= pfx %>backlayer"></div>\n <div class="<%= pfx %>collector" style="display: none"></div>'),events:{},initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.listenTo(this.model,"change:open",this.updateOpen),this.listenTo(this.model,"change:title",this.updateTitle),this.listenTo(this.model,"change:content",this.updateContent),this.events["click ."+this.pfx+"btn-close"]="hide",this.config.backdrop&&(this.events["click ."+this.pfx+"backlayer"]="hide"),this.delegateEvents()},getCollector:function(){return this.$collector||(this.$collector=this.$el.find("."+this.pfx+"collector")),this.$collector},getContent:function(){return this.$content||(this.$content=this.$el.find("."+this.pfx+"content #"+this.pfx+"c")),this.$content},getTitle:function(){return this.$title||(this.$title=this.$el.find("."+this.pfx+"title")),this.$title.get(0)},updateContent:function(){var t=this.getContent();this.getCollector().append(t.children()),t.html(this.model.get("content"))},updateTitle:function(){var t=this.getTitle();t&&(t.innerHTML=this.model.get("title"))},updateOpen:function(){this.model.get("open")?this.$el.show():this.$el.hide()},hide:function(){this.model.set("open",0)},show:function(){this.model.set("open",1)},render:function(){var t=this.model.toJSON();return t.pfx=this.pfx,this.$el.html(this.template(t)),this.$el.attr("class",this.pfx+"container"),this.updateOpen(),this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={stylePrefix:"nv-",sortable:1,hidable:1,hideTextnode:1,containerId:"navigator",itemClass:"item",itemsClass:"items"}},function(t,e,i){"use strict";t.exports=function(){var t=void 0,e={},n=i(138),r=i(27);return{init:function(i,s){e=s||e;var o=e.em;for(var a in n)a in e||(e[a]=n[a]);return t=new r({collection:i,config:e,opened:s.opened||{}}),o&&o.on("change:selectedComponent",this.componentChanged),this.componentChanged(),this},componentChanged:function(){var t=e.em,i=t.get("opened"),n=t.get("selectedComponent"),r=n&&n.collection?n.collection.parent:null;for(var s in i)i[s].set("open",0);for(;r;)r.set("open",1),i[r.cid]=r,r=r.collection?r.collection.parent:null},render:function(){return t.render().$el}}}},function(t,e,i){"use strict";(function(e){var n,r=i(0),s=i(3);t.exports=r.View.extend({template:e.template('\n <% if (hidable) { %>\n \t<i id="<%= prefix %>btn-eye" class="btn fa fa-eye <%= (visible ? \'\' : \'fa-eye-slash\') %>"></i>\n <% } %>\n\n <div class="<%= prefix %>title-c">\n <div class="<%= prefix %>title <%= addClass %>">\n \t<i id="<%= prefix %>caret" class="fa fa-chevron-right <%= caretCls %>"></i>\n \t\t<i class="fa fa-pencil <%= editBtnCls %>"></i>\n <%= icon %>\n \t\t<input class="<%= ppfx %>no-app <%= inputNameCls %>" value="<%= title %>" readonly>\n </div>\n </div>\n\n <div id="<%= prefix %>counter"><%= (count ? count : \'\') %></div>\n\n <div id="<%= prefix %>move">\n \t<i class="fa fa-arrows"></i>\n </div>\n\n <div class="<%= prefix %>children"></div>'),initialize:function(t){this.opt=t,this.config=t.config,this.em=t.config.em,this.ppfx=this.em.get("Config").stylePrefix,this.sorter=t.sorter||{},this.pfx=this.config.stylePrefix,void 0===this.model.get("open")&&this.model.set("open",!1),this.listenTo(this.model.components,"remove add change reset",this.checkChildren),this.listenTo(this.model,"destroy remove",this.remove),this.listenTo(this.model,"change:status",this.updateStatus),this.listenTo(this.model,"change:open",this.updateOpening),this.className=this.pfx+"item no-select",this.editBtnCls=this.pfx+"nav-item-edit",this.inputNameCls=this.ppfx+"nav-comp-name",this.caretCls=this.ppfx+"nav-item-caret",this.titleCls=this.pfx+"title",this.events={},this.events["click > #"+this.pfx+"btn-eye"]="toggleVisibility",this.events["click ."+this.caretCls]="toggleOpening",this.events["click ."+this.titleCls]="handleSelect",this.events["click ."+this.editBtnCls]="handleEdit",this.events["blur ."+this.inputNameCls]="handleEditEnd",this.$el.data("model",this.model),this.$el.data("collection",this.model.get("components")),t.config.sortable&&(this.events["mousedown > #"+this.pfx+"move"]="startSort"),this.delegateEvents()},handleEdit:function(t){t.stopPropagation();var e=this.getInputName();e.readOnly=!1,e.focus()},handleEditEnd:function(t){t.stopPropagation();var e=this.getInputName();e.readOnly=!0,this.model.set("custom-name",e.value)},getInputName:function(){return this.inputName||(this.inputName=this.el.querySelector("."+this.inputNameCls)),this.inputName},updateOpening:function(){var t=this.opt.opened||{},e=this.model;e.get("open")?(this.$el.addClass("open"),this.$caret.addClass("fa-chevron-down"),t[e.cid]=e):(this.$el.removeClass("open"),this.$caret.removeClass("fa-chevron-down"),delete t[e.cid])},toggleOpening:function(t){t.stopPropagation(),this.model.components.length&&this.model.set("open",!this.model.get("open"))},handleSelect:function(t){t.stopPropagation();var e=this.em;if(e){var i=e.get("selectedComponent");i&&i.set("status",""),this.model.set("status","selected"),e.set("selectedComponent",this.model)}},startSort:function(t){this.sorter&&this.sorter.startSort(t.target)},freeze:function(){this.$el.addClass(this.pfx+"opac50"),this.model.set("open",0)},unfreeze:function(){this.$el.removeClass(this.pfx+"opac50")},updateStatus:function(t){s.prototype.updateStatus.apply(this,arguments)},toggleVisibility:function(t){this.$eye||(this.$eye=this.$el.find("> #"+this.pfx+"btn-eye"));var i=e.clone(this.model.get("style")),n=this.pfx+"hide";this.isVisible()?(this.$el.addClass(n),this.$eye.addClass("fa-eye-slash"),i.display="none"):(this.$el.removeClass(n),this.$eye.removeClass("fa-eye-slash"),delete i.display),this.model.set("style",i)},isVisible:function(){var t=this.model.get("style"),e=t.display;if(!e||"none"!=e)return 1},checkChildren:function(){var t=this.countChildren(this.model),e=this.pfx,i="> ."+e+"title-c > ."+e+"title";this.$counter||(this.$counter=this.$el.find("> #"+e+"counter")),t?(this.$el.find(i).removeClass(e+"no-chld"),this.$counter.html(t)):(this.$el.find(i).addClass(e+"no-chld"),this.$counter.empty(),this.model.set("open",0))},countChildren:function(t){var e=0;return t.components.each(function(t){var i=this.opt.isCountable,n=this.config.hideTextnode;i&&!i(t,n)||e++},this),e},render:function(){var t=this.model,r=this.pfx,s=this.isVisible(),o=this.countChildren(t);return this.$el.html(this.template({title:t.getName(),icon:t.getIcon(),addClass:o?"":r+"no-chld",editBtnCls:this.editBtnCls,inputNameCls:this.inputNameCls,caretCls:this.caretCls,count:o,visible:s,hidable:this.config.hidable,prefix:r,ppfx:this.ppfx})),void 0===n&&(n=i(27)),this.$components=new n({collection:t.components,config:this.config,sorter:this.sorter,opened:this.opt.opened,parent:t}).render().$el,this.$el.find("."+r+"children").html(this.$components),this.$caret=this.$el.find("> ."+r+"title-c > ."+r+"title > #"+r+"caret"),t.get("draggable")&&this.config.sortable||this.$el.find("> #"+r+"move").detach(),s||(this.className+=" "+r+"hide"),this.$el.attr("class",e.result(this,"className")),this.updateOpening(),this.updateStatus(),this}})}).call(e,i(1))},function(t,e,i){"use strict";var n="sw-visibility",r="export-template",s="open-layers",o="open-blocks",a="fullscreen",l="preview";t.exports={stylePrefix:"pn-",defaults:[{id:"commands",buttons:[{}]},{id:"options",buttons:[{active:!0,id:n,className:"fa fa-square-o",command:n,context:n,attributes:{title:"View components"}},{id:l,className:"fa fa-eye",command:l,context:l,attributes:{title:"Preview"}},{id:a,className:"fa fa-arrows-alt",command:a,context:a,attributes:{title:"Fullscreen"}},{id:r,className:"fa fa-code",command:r,attributes:{title:"View code"}}]},{id:"views",buttons:[{id:"open-sm",className:"fa fa-paint-brush",command:"open-sm",active:!0,attributes:{title:"Open Style Manager"}},{id:"open-tm",className:"fa fa-cog",command:"open-tm",attributes:{title:"Settings"}},{id:s,className:"fa fa-bars",command:s,attributes:{title:"Open Layer Manager"}},{id:o,className:"fa fa-th-large",command:o,attributes:{title:"Open Blocks"}}]}],em:null,delayBtnsShow:300}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(141),s=i(29),o=i(144),a=(i(31),i(146));return{name:"Panels",init:function(i){n=i||{};for(var s in r)s in n||(n[s]=r[s]);var l=n.pStylePrefix;return l&&(n.stylePrefix=l+n.stylePrefix),t=new o(n.defaults),e=new a({collection:t,config:n}),this},getPanels:function(){return t},getPanelsEl:function(){return e.el},addPanel:function(e){return t.add(e)},getPanel:function(e){var i=t.where({id:e});return i.length?i[0]:null},addButton:function(t,e){var i=this.getPanel(t);return i?i.get("buttons").add(e):null},getButton:function(t,e){var i=this.getPanel(t);if(i){var n=i.get("buttons").where({id:e});return n.length?n[0]:null}return null},render:function(){return e.render().el},active:function(){this.getPanels().each(function(t){t.get("buttons").each(function(t){t.get("active")&&t.trigger("updateActive")})})},Panel:s}}},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{id:"",className:"",command:"",context:"",buttons:[],attributes:{},options:{},active:!1,dragDrop:!1,runDefaultCommand:!0,stopDefaultCommand:!1},initialize:function(t){if(this.get("buttons").length){var e=i(28);this.set("buttons",new e(this.get("buttons")))}}})},function(t,e,i){"use strict";var n=i(0),r=i(29);t.exports=n.Collection.extend({model:r})},function(t,e,i){"use strict";(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=i(0);t.exports=r.View.extend({tagName:"span",initialize:function(t){e.bindAll(this,"startTimer","stopTimer","showButtons","hideButtons","closeOnKeyPress","onDrop","initSorter","stopDrag");var i=this.model.get("className");this.config=t.config||{},this.em=this.config.em||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.id=this.pfx+this.model.get("id"),this.activeCls=this.pfx+"active",this.btnsVisCls=this.pfx+"visible",this.parentM=t.parentM||null,this.className=this.pfx+"btn"+(i?" "+i:""),this.listenTo(this.model,"change:active updateActive",this.updateActive),this.listenTo(this.model,"checkActive",this.checkActive),this.listenTo(this.model,"change:bntsVis",this.updateBtnsVis),this.listenTo(this.model,"change:attributes",this.updateAttributes),this.listenTo(this.model,"change:className",this.updateClassName),this.model.get("buttons").length&&(this.$el.on("mousedown",this.startTimer),this.$el.append($("<div>",{class:this.pfx+"arrow-rd"}))),this.em&&this.em.get&&(this.commands=this.em.get("Commands")),this.events={},this.model.get("dragDrop")?(this.events.mousedown="initDrag",this.em.on("loaded",this.initSorter)):this.events.click="clicked",this.delegateEvents()},initSorter:function(){if(this.em.Canvas){var t=this.em.Canvas;this.canvasEl=t.getBody(),this.sorter=new this.em.Utils.Sorter({container:this.canvasEl,placer:t.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,onMove:this.onDrag,onEndMove:this.onDrop,document:t.getFrameEl().contentDocument,direction:"a",wmargin:1,nested:1});var e=t.getOffset();this.sorter.offTop=e.top,this.sorter.offLeft=e.left}},initDrag:function(){this.model.collection.deactivateAll(this.model.get("context")),this.sorter.startSort(this.el),this.sorter.setDropContent(this.model.get("options").content),this.canvasEl.style.cursor="grabbing",$(document).on("mouseup",this.stopDrag)},stopDrag:function(){$(document).off("mouseup",this.stopDrag),this.sorter.endMove()},onDrag:function(t){},onDrop:function(t){this.canvasEl.style.cursor="default"},updateClassName:function(){var t=this.model.get("className");this.$el.attr("class",this.pfx+"btn"+(t?" "+t:""))},updateAttributes:function(){this.$el.attr(this.model.get("attributes"))},updateBtnsVis:function(){this.$buttons&&(this.model.get("bntsVis")?this.$buttons.addClass(this.btnsVisCls):this.$buttons.removeClass(this.btnsVisCls))},startTimer:function(){this.timeout=setTimeout(this.showButtons,this.config.delayBtnsShow),$(document).on("mouseup",this.stopTimer)},stopTimer:function(){$(document).off("mouseup",this.stopTimer),this.timeout&&clearTimeout(this.timeout)},showButtons:function(){clearTimeout(this.timeout),this.model.set("bntsVis",!0),$(document).on("mousedown",this.hideButtons),$(document).on("keypress",this.closeOnKeyPress)},hideButtons:function(t){t&&$(t.target).trigger("click"),this.model.set("bntsVis",!1),$(document).off("mousedown",this.hideButtons),$(document).off("keypress",this.closeOnKeyPress)},closeOnKeyPress:function(t){27==(t.which||t.keyCode)&&this.hideButtons()},updateActive:function(){var t=null,e=this.em&&this.em.get?this.em.get("Editor"):null,i=this.model.get("command");this.commands&&"string"==typeof i?t=this.commands.get(i):null!==i&&"object"===(void 0===i?"undefined":n(i))?t=i:"function"==typeof i&&(t={run:i}),this.model.get("active")?(this.model.collection.deactivateAll(this.model.get("context")),this.model.set("active",!0,{silent:!0}).trigger("checkActive"),this.parentM&&this.parentM.set("active",!0,{silent:!0}).trigger("checkActive"),t&&t.run&&(t.run(e,this.model,this.model.get("options")),e.trigger("run:"+i))):(this.$el.removeClass(this.activeCls),this.model.collection.deactivateAll(this.model.get("context")),this.parentM&&this.parentM.set("active",!1,{silent:!0}).trigger("checkActive"),t&&t.stop&&(t.stop(e,this.model,this.model.get("options")),e.trigger("stop:"+i)))},checkActive:function(){this.model.get("active")?this.$el.addClass(this.activeCls):this.$el.removeClass(this.activeCls)},clicked:function(t){if(!this.model.get("bntsVis")){this.parentM&&this.swapParent();var e=this.model.get("active");this.model.set("active",!e);this.em.get("Commands").get("select-comp");e?this.model.get("runDefaultCommand")&&this.em.runDefault():this.model.get("stopDefaultCommand")&&this.em.stopDefault()}},swapParent:function(){this.parentM.collection.deactivateAll(this.model.get("context")),this.parentM.set("attributes",this.model.get("attributes")),this.parentM.set("options",this.model.get("options")),this.parentM.set("command",this.model.get("command")),this.parentM.set("className",this.model.get("className")),this.parentM.set("active",!0,{silent:!0}).trigger("checkActive")},render:function(){if(this.updateAttributes(),this.$el.attr("class",this.className),this.model.get("buttons").length){var t=i(30),e=new t({collection:this.model.get("buttons"),config:this.config,parentM:this.model});this.$buttons=e.render().$el,this.$buttons.append($("<div>",{class:this.pfx+"arrow-l"})),this.$el.append(this.$buttons)}return this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(31);t.exports=n.View.extend({initialize:function(t){this.opt=t||{},this.config=this.opt.config||{},this.pfx=this.config.stylePrefix||"",this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render),this.className=this.pfx+"panels"},addTo:function(t){this.addToCollection(t)},addToCollection:function(t,e){var i=e||null,n=new r({model:t,config:this.config}),s=n.render().el,o=t.get("appendTo");if(o){document.querySelector(o).appendChild(s)}else i?i.appendChild(s):this.$el.append(s);return n.initResize(),s},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.append(t),this.$el.attr("class",this.className),this}})},function(t,e,i){"use strict";t.exports={textTags:["br","b","i","u"]}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(147),s=i(149),o=i(150);return{compTypes:"",name:"Parser",init:function(i){n=i||{};for(var a in r)a in n||(n[a]=r[a]);return t=new o(n),e=new s(n),this},parseHtml:function(i){return t.compTypes=this.compTypes,t.parse(i,e)},parseCss:function(t){return e.parse(t)}}}},function(t,e,i){"use strict";t.exports=function(t){return{parseSelector:function(t){for(var e=[],i=[],n=t.split(","),r=0,s=n.length;r<s;r++){var o=n[r].trim();if(/^(\.{1}[\w\-]+)+(:{1,2}[\w\-()]+)?$/gi.test(o)){var a=o.split(".").filter(Boolean);i.push(a)}else e.push(o)}return{result:i,add:e}},parseNode:function(t){for(var e=[],i=t.cssRules,n=0,r=i.length;n<r;n++){var s=i[n],o=s.selectorText,a=[];if(s.cssRules){for(var l=this.parseNode(s),c=s.media.mediaText,u=0,h=l.length;u<h;u++){l[u].mediaText=c?c.trim():""}e=e.concat(l)}if(o){var d=this.parseSelector(o);o=d.result,a=d.add;for(var f=s.style,p={},g=0,m=f.length;g<m;g++){var v=f[g],y=f.getPropertyPriority(v);p[v]=f[v]+(y?" !"+y:"")}for(var b="",x=0,w=o.length;x<w;x++){var C=o[x],k={},S=C[C.length-1].split(/:(.+)/);S[1]&&(C[C.length-1]=S[0],k.state=S[1],S.splice(S.length-1,1)),k.selectors=C,k.style=p,b=k,e.push(k)}if(a.length){var T=a.join(", ");b?b.selectorsAdd=T:e.push({selectors:[],selectorsAdd:T,style:p})}}}return e},parse:function(t){var e=document.createElement("style");e.innerHTML=t,document.head.appendChild(e);var i=e.sheet;document.head.removeChild(e);var n=this.parseNode(i);return 1==n.length&&(n=n[0]),n}}}},function(t,e,i){"use strict";t.exports=function(t){var e=t;return{compTypes:"",parseStyle:function(t){for(var e={},i=t.split(";"),n=0,r=i.length;n<r;n++){var s=i[n].trim();if(s){var o=s.split(":");e[o[0].trim()]=o.slice(1).join(":").trim()}}return e},parseClass:function(t){for(var i=[],n=t.split(" "),r=0,s=n.length;r<s;r++){var o=n[r].trim(),a=new RegExp("^"+e.pStylePrefix);o&&!a.test(o)&&i.push(o)}return i},parseNode:function(t){for(var i=[],n=t.childNodes,r=0,s=n.length;r<s;r++){var o=n[r],a={},l=o.attributes||[],c=l.length,u=i.length-1,h=i[u],d=this.compTypes;if(d){for(var f="",p=0;p<d.length;p++){if(f=d[p].model.isComponent(o))break}a=f}a.tagName||(a.tagName=o.tagName?o.tagName.toLowerCase():""),c&&(a.attributes={});for(var g=0;g<c;g++){var m=l[g].nodeName,v=l[g].nodeValue;if("style"==m)a.style=this.parseStyle(v);else if("class"==m)a.classes=this.parseClass(v);else{if("contenteditable"==m)continue;if(0===m.indexOf("data-gjs-")){var y=m.replace("data-gjs-","");v="true"===v||v,v="false"!==v&&v,a[y]=v}else a.attributes[m]=v}}var b=o.childNodes.length;if(b&&!a.components){var x=o.childNodes[0];if(1===b&&3===x.nodeType)a.type||(a.type="text"),a.content=x.nodeValue;else{var w=this.parseNode(o);1==w.length&&"text"==w[0].type&&"span"==w[0].tagName?(a.type="text",a.content=w[0].content):a.components=w}}if("textnode"==a.type){if(h&&"textnode"==h.type){h.content+=a.content;continue}var C=o.nodeValue;if(" "!=C&&!C.trim())continue}var k=a.components;if(!a.type&&k){for(var S=1,T=0,M=0;M<k.length;M++){var E=k[M];if("text"!=E.type&&"textnode"!=E.type&&e.textTags.indexOf(E.tagName)<0){S=0;break}"textnode"==E.type&&(T=1)}S&&T&&(a.type="text")}(a.tagName||"textnode"==a.type)&&i.push(a)}return i},parse:function(t,i){var n=e.em&&e.em.get("Config")||{},r={html:"",css:""},s=document.createElement("div");s.innerHTML=t;var o=s.querySelectorAll("script"),a=o.length;if(!n.allowScripts)for(;a--;)o[a].parentNode.removeChild(o[a]);if(i){for(var l="",c=s.querySelectorAll("style"),u=c.length;u--;)l=c[u].innerHTML+l,c[u].parentNode.removeChild(c[u]);l&&(r.css=i.parse(l))}var h=this.parseNode(s);return 1==h.length&&(h=h[0]),r.html=h,r}}}},function(t,e,i){"use strict";t.exports={plugins:[]}},function(t,e,i){"use strict";t.exports=function(t){var e=t||{},n=i(151);for(var r in n)r in e||(e[r]=n[r]);var s={};return{add:function(t,e){return s[t]?this:(s[t]=e,this)},get:function(t){return s[t]},getAll:function(){return s}}}},function(t,e,i){"use strict";t.exports={stylePrefix:"rte-",toolbarId:"toolbar",adjustToolbar:1,commands:[{command:"bold",title:"Bold",class:"fa fa-bold"},{command:"italic",title:"Italic",class:"fa fa-italic"},{command:"underline",title:"Underline",class:"fa fa-underline"},{command:"strikethrough",title:"Strikethrough",class:"fa fa-strikethrough",group:"format"},{command:"insertHTML",title:"Link",class:"fa fa-link",args:'<a class="link" href="">${content}</a>'}]}},function(t,e,i){"use strict";t.exports=function(){var t,e,n,r,s={},o=i(153),a=(i(159),i(156)),l=i(158);return{customRte:null,name:"rte",init:function(i){r=this,s=i||{};for(var c in o)c in s||(s[c]=o[c]);var u=s.pStylePrefix;return u&&(s.stylePrefix=u+s.stylePrefix),t=s.stylePrefix,n=new a(s.commands),e=new l({collection:n,config:s}),this},add:function(t,e){var i=e||{};return i.command=t,n.add(i)},get:function(t){return n.where({command:t})[0]},getAll:function(){return n},udpatePosition:function(){var t=s.em.get("Canvas"),i=t.getTargetToElementDim(e.el,this.lastEl,{event:"rteToolbarPosUpdate"});s.adjustToolbar&&i.top<=i.canvasTop&&(i.top=i.elementTop+i.elementHeight);var n=e.el.style;n.top=i.top+"px",n.left=i.left+"px"},attach:function(t,i){this.lastEl=t.el;var n=t.getChildrenContainer(),r=this.customRte;return r?i=r.enable(n,i):$(n).wysiwyg({}).focus(),this.show(),s.em&&(setTimeout(this.udpatePosition.bind(this),0),s.em.off("change:canvasOffset",this.udpatePosition,this),s.em.on("change:canvasOffset",this.udpatePosition,this),s.em.off("canvasScroll",this.udpatePosition,this),s.em.on("canvasScroll",this.udpatePosition,this)),e.$el.on("mousedown",this.disableProp),i},detach:function(t,i){var n=this.customRte,r=t.getChildrenContainer();n?(t.model.set("content",r.innerHTML),n.disable(r,i)):$(r).wysiwyg("destroy"),this.hide(),e.$el.off("mousedown",this.disableProp)},focus:function(t,e){var i=this.customRte,n=t.getChildrenContainer();i?i.focus&&i.focus(n,e):this.attach(t)},show:function(){e.el.style.display="block"},hide:function(){e.el.style.display="none"},disableProp:function(t){t.stopPropagation()},getToolbarEl:function(){return e.el},render:function(){return e.render().el}}}},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({idAttribute:"command",defaults:{command:"",type:"",title:"",class:"",options:[]},initialize:function(){this.get("options").length&&this.set("type","select")}})},function(t,e,i){"use strict";var n=i(0),r=i(155);t.exports=n.Collection.extend({model:r})},function(t,e,i){"use strict";var n=(i(0),i(32));t.exports=n.extend({initialize:function(t,e){n.prototype.initialize.apply(this,arguments)},getInput:function(){var t=this.model;if(!this.input){var e=t.get("command"),i='<select data-edit="'+e+'">',n=t.get("options");i+="<option>"+(t.get("title")||t.get("command"))+"</option>";for(var r=0,s=n.length;r<s;r++){var o=n[r],a=o.value;i+='<option value="'+a+'">'+(o.name||a)+"</option>"}i+="</select>",this.input=$(i)}return this.input},getInputCont:function(){var t=this.getInput(),e=this.ppfx;return $('<div class="'+e+"field "+e+'select"><div class="'+e+'sel-arrow"><div class="'+e+'d-s-arrow"></div></div></div>').append(t)},render:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];return n.prototype.render.apply(this,e),this.$el.html(this.getInputCont()),this}})},function(t,e,i){"use strict";var n=i(0),r=i(32),s=i(157);t.exports=n.View.extend({attributes:{"data-role":"editor-toolbar"},initialize:function(t){this.config=t.config||{};var e=this.config.stylePrefix||"";this.id=e+this.config.toolbarId,this.listenTo(this.collection,"add",this.addTo),this.$el.data("helper",1)},addTo:function(t){this.add(t)},add:function(t,e){var i=e||null,n=r;switch(t.get("type")){case"select":n=s}var o=t.get("args"),a={title:t.get("title"),"data-edit":t.get("command")};o&&(a["data-args"]=o);var l=new n({model:t,attributes:a},this.config),c=l.render().el;i?i.appendChild(c):this.$el.append(c)},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.add(e,t)},this),this.$el.append(t),this.$el.attr("id",this.id),this}})},function(t,e,i){"use strict";var n=function(t){var e=$.Deferred(),i=new FileReader;return i.onload=function(t){e.resolve(t.target.result)},i.onerror=e.reject,i.onprogress=e.notify,i.readAsDataURL(t),e.promise()};$.fn.cleanHtml=function(){var t=$(this).html();return t&&t.replace(/(<br>|\s|<div><br><\/div>| )*$/,"")},$.fn.wysiwyg=function(t){var e,i,r,s=this,o=function(){var t=i.activeToolbarClass;t&&$(i.toolbarSelector).find(r).each(function(){var e=$(this),n=e.data(i.commandRole);s.get(0).ownerDocument.queryCommandState(n)?e.addClass(t):e.removeClass(t)})},a=function(t,e){var i=t.split(" "),n=i.shift(),r=i.join(" ")+(e||"");s.get(0).ownerDocument.execCommand("styleWithCSS",!1,!0),s.get(0).ownerDocument.execCommand(n,0,r),o(),s.trigger("change")},l=function(){var t=window.getSelection();if(t.getRangeAt&&t.rangeCount)return t.getRangeAt(0)},c=function(){e=l()},u=function(){var t=window.getSelection();if(e){try{t.removeAllRanges()}catch(t){document.body.createTextRange().select(),document.selection.empty()}t.addRange(e)}},h=function(t){s.focus(),$.each(t,function(t,e){/^image\//.test(e.type)?$.when(n(e)).done(function(t){a("insertimage",t)}).fail(function(t){i.fileUploadError("file-reader",t)}):i.fileUploadError("unsupported-file-type",e.type)})},d=function(t,e){u(),document.queryCommandSupported("hiliteColor")&&document.execCommand("hiliteColor",0,e||"transparent"),c(),t.data(i.selectionMarker,e)};if("string"==typeof t&&"destroy"==t)return s.attr("contenteditable",!1).unbind("mouseup keyup mouseout dragenter dragover"),$(window).unbind("touchend"),this;i=$.extend({},$.fn.wysiwyg.defaults,t);var f="[data-"+i.commandRole+"]";return r="a"+f+",button"+f+",input[type=button]"+f+", select"+f,i.dragAndDropImages&&function(){s.on("dragenter dragover",!1).on("drop",function(t){var e=t.originalEvent.dataTransfer;t.stopPropagation(),t.preventDefault(),e&&e.files&&e.files.length>0&&h(e.files)})}(),function(t,e){t.find(r).unbind().click(function(){u();var t=s.get(0).ownerDocument,i=$(this),n=i.data(e.commandRole),r=i.data("args");r?(r=r.replace("${content}",t.getSelection()),a(n,r)):t.execCommand(n),c()}),t.find("[data-toggle=dropdown]").click(u);var i="[data-"+e.commandRole+"]";t.find("select"+i).on("webkitspeechchange change",function(){var t=this.value;u(),t&&(s.focus(),a($(this).data(e.commandRole),t)),c()}),t.find("input[type=text]"+i,", select"+i).on("webkitspeechchange change",function(){var t=this.value;this.value="",u(),t&&(s.focus(),a($(this).data(e.commandRole),t)),c()}).on("focus",function(){var t=$(this);t.data(e.selectionMarker)||(d(t,e.selectionColor),t.focus())}).on("blur",function(){var t=$(this);t.data(e.selectionMarker)&&d(t,!1)}),t.find("input[type=file][data-"+e.commandRole+"]").change(function(){u(),"file"===this.type&&this.files&&this.files.length>0&&h(this.files),c(),this.value=""})}($(i.toolbarSelector),i),s.attr("contenteditable",!0).on("mouseup keyup mouseout",function(){c(),o()}),$(window).bind("touchend",function(t){var e=s.is(t.target)||s.has(t.target).length>0,i=l();i&&i.startContainer===i.endContainer&&i.startOffset===i.endOffset&&!e||(c(),o())}),this},$.fn.wysiwyg.defaults={toolbarSelector:"[data-role=editor-toolbar]",commandRole:"edit",activeToolbarClass:"btn-info",selectionMarker:"edit-focus-marker",selectionColor:"darkgrey",dragAndDropImages:!0,fileUploadError:function(t,e){console.log("File upload error",t,e)}},t.exports=$},function(t,e,i){"use strict";t.exports={stylePrefix:"clm-",selectors:[],label:"Classes",statesLabel:"- State -",states:[{name:"hover",label:"Hover"},{name:"active",label:"Click"},{name:"nth-of-type(2n)",label:"Even/Odd"}]}},function(t,e,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var e,r,s=t||{},o=i(160),a=i(8),l=i(33),c=i(163);return{name:"SelectorManager",init:function(t){s=t||{};for(var i in o)i in s||(s[i]=o[i]);var n=s.em,a=s.pStylePrefix;return a&&(s.stylePrefix=a+s.stylePrefix),r=new c({collection:new l([],{em:n,config:s}),config:s}),e=new l(s.selectors),e.on("add",function(t){return n.trigger("selector:add",t)}),this},add:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"==(void 0===t?"undefined":n(t))?i=t:i.name=t,i.label&&!i.name&&(i.name=a.escapeName(i.label));var r=i.name,s=r?this.get(r):e.where(i)[0];return s||e.add(i)},get:function(t){return e.where({name:t})[0]},getAll:function(){return e},render:function(t){if(t){return new c({collection:new l(t),config:s}).render().el}return r.render().el}}}},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(8);t.exports=n.View.extend({template:e.template('\n <span id="<%= pfx %>checkbox" class="fa"></span>\n <span id="<%= pfx %>tag-label">\n <input class="<%= ppfx %>no-app" value="<%= label %>" <%= inputProp %>/>\n </span>\n <span id="<%= pfx %>close">⨯</span>'),events:{},initialize:function(t){this.config=t.config||{},this.coll=t.coll||null,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.inputProp="readonly",this.target=this.config.em,this.className=this.pfx+"tag",this.closeId=this.pfx+"close",this.chkId=this.pfx+"checkbox",this.labelId=this.pfx+"tag-label",this.events["click #"+this.closeId]="removeTag",this.events["click #"+this.chkId]="changeStatus",this.events["dblclick #"+this.labelId]="startEditTag",this.events["keypress #"+this.labelId+" input"]="updateInputLabel",this.events["blur #"+this.labelId+" input"]="endEditTag",this.listenTo(this.model,"change:active",this.updateStatus),this.delegateEvents()},startEditTag:function(){this.$labelInput.prop(this.inputProp,!1)},endEditTag:function(){var t=this.$labelInput.val(),e=r.escapeName(t);if(this.target){var i=this.target.get("SelectorManager");i&&(i.get(e)?this.$labelInput.val(this.model.get("label")):this.model.set({name:e,label:t}))}this.$labelInput.prop(this.inputProp,!0)},changeStatus:function(){this.model.set("active",!this.model.get("active")),this.target.trigger("targetClassUpdated")},removeTag:function(t){var e=this.target.get("selectedComponent");e&&e.get("classes").remove(this.model),this.coll&&(this.coll.remove(this.model),this.target.trigger("targetClassRemoved")),this.remove()},updateStatus:function(){var t="fa-check-square-o";this.$chk||(this.$chk=this.$el.find("#"+this.pfx+"checkbox")),this.model.get("active")?(this.$chk.removeClass("fa-square-o").addClass(t),this.$el.removeClass("opac50")):(this.$chk.removeClass(t).addClass("fa-square-o"),this.$el.addClass("opac50"))},updateInputLabel:function(){this.$labelInput||(this.$labelInput=this.$el.find("input"));var t=this.$labelInput.val().length-1;t=t<1?1:t,this.$labelInput.attr("size",t)},render:function(){return this.$el.html(this.template({label:this.model.get("label"),pfx:this.pfx,ppfx:this.ppfx,inputProp:this.inputProp})),this.$el.attr("class",this.className),this.updateStatus(),this.updateInputLabel(),this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(162);t.exports=n.View.extend({template:e.template('\n <div id="<%= pfx %>up">\n <div id="<%= pfx %>label"><%= label %></div>\n <div id="<%= pfx %>status-c">\n <span id="<%= pfx %>input-c">\n <div class="<%= ppfx %>field <%= ppfx %>select">\n <span id="<%= ppfx %>input-holder">\n <select id="<%= pfx %>states">\n <option value=""><%= statesLabel %></option>\n </select>\n </span>\n <div class="<%= ppfx %>sel-arrow">\n <div class="<%= ppfx %>d-s-arrow"></div>\n </div>\n </div>\n </span>\n </div>\n </div>\n <div id="<%= pfx %>tags-field" class="<%= ppfx %>field">\n <div id="<%= pfx %>tags-c"></div>\n <input id="<%= pfx %>new" />\n <span id="<%= pfx %>add-tag" class="fa fa-plus"></span>\n </div>\n <div id="<%= pfx %>sel-help">\n <div id="<%= pfx %>label">Selected</div>\n <div id="<%= pfx %>sel"></div>\n <div style="clear:both"></div>\n </div>'),events:{},initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.className=this.pfx+"tags",this.addBtnId=this.pfx+"add-tag",this.newInputId=this.pfx+"new",this.stateInputId=this.pfx+"states",this.stateInputC=this.pfx+"input-c",this.states=this.config.states||[],this.events["click #"+this.addBtnId]="startNewTag",this.events["blur #"+this.newInputId]="endNewTag",this.events["keyup #"+this.newInputId]="onInputKeyUp",this.events["change #"+this.stateInputId]="stateChanged",this.target=this.config.em,this.listenTo(this.target,"change:selectedComponent",this.componentChanged),this.listenTo(this.target,"targetClassUpdated",this.updateSelector),this.listenTo(this.collection,"add",this.addNew),this.listenTo(this.collection,"reset",this.renderClasses),this.listenTo(this.collection,"remove",this.tagRemoved),this.delegateEvents()},tagRemoved:function(t){this.updateStateVis()},getStateOptions:function(){for(var t="",e=0;e<this.states.length;e++)t+='<option value="'+this.states[e].name+'">'+this.states[e].label+"</option>";return t},addNew:function(t){this.addToClasses(t)},startNewTag:function(t){this.$addBtn.hide(),this.$input.show().focus()},endNewTag:function(t){this.$addBtn.show(),this.$input.hide().val("")},onInputKeyUp:function(t){13===t.keyCode?this.addNewTag(this.$input.val()):27===t.keyCode&&this.endNewTag()},componentChanged:function(t){this.compTarget=this.target.get("selectedComponent");var e=this.compTarget,i=[];e&&(this.getStates().val(e.get("state")),i=e.get("classes").getValid()),this.collection.reset(i),this.updateStateVis()},updateStateVis:function(){this.collection.length?this.getStatesC().css("display","block"):this.getStatesC().css("display","none"),this.updateSelector()},updateSelector:function(){if(this.compTarget=this.target.get("selectedComponent"),this.compTarget&&this.compTarget.get){var t="";this.collection.each(function(e){e.get("active")&&(t+="."+e.get("name"))});var e=this.compTarget.get("state");t=e?t+":"+e:t;var i=this.el.querySelector("#"+this.pfx+"sel");i&&(i.innerHTML=t)}},stateChanged:function(t){this.compTarget&&(this.compTarget.set("state",this.$states.val()),this.target&&this.target.trigger("targetStateUpdated"),this.updateSelector())},addNewTag:function(t){var e=this.target,i=this.compTarget;if(t.trim()){if(e){var n=e.get("SelectorManager"),r=n.add({label:t});if(i){var s=i.get("classes"),o=s.length;s.add(r);var a=s.length;this.collection.add(r),a>o&&e.trigger("targetClassAdded"),this.updateStateVis()}}this.endNewTag()}},addToClasses:function(t,e){var i=e||null,n=new r({model:t,config:this.config,coll:this.collection}),s=n.render().el;return i?i.appendChild(s):this.getClasses().append(s),s},renderClasses:function(){var t=document.createDocumentFragment();return this.collection.each(function(e){this.addToClasses(e,t)},this),this.getClasses()&&this.getClasses().empty().append(t),this},getClasses:function(){return this.$classes||(this.$classes=this.$el.find("#"+this.pfx+"tags-c")),this.$classes},getStates:function(){return this.$states||(this.$states=this.$el.find("#"+this.stateInputId)),this.$states},getStatesC:function(){return this.$statesC||(this.$statesC=this.$el.find("#"+this.stateInputC)),this.$statesC},render:function(){return this.$el.html(this.template({label:this.config.label,statesLabel:this.config.statesLabel,pfx:this.pfx,ppfx:this.ppfx})),this.$input=this.$el.find("input#"+this.newInputId),this.$addBtn=this.$el.find("#"+this.addBtnId),this.$classes=this.$el.find("#"+this.pfx+"tags-c"),this.$states=this.$el.find("#"+this.stateInputId),this.$statesC=this.$el.find("#"+this.stateInputC),this.$states.append(this.getStateOptions()),this.renderClasses(),this.$el.attr("class",this.className),this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={id:"gjs-",autosave:1,autoload:1,type:"local",stepsBeforeSave:1,storeComponents:!1,storeStyles:!1,storeHtml:!0,storeCss:!0,checkLocal:!0,params:{},urlStore:"",urlLoad:"",beforeSend:function(t,e){},onComplete:function(t,e){},contentTypeJson:!1}},function(t,e,i){"use strict";t.exports=function(){var t={},e=i(164),n=i(166),r=i(167),s={},o={};return{name:"StorageManager",init:function(i){t=i||{};for(var s in e)s in t||(t[s]=e[s]);return o.remote=new r(t),o.local=new n(t),t.currentStorage=t.type,this},onLoad:function(){this.loadDefaultProviders().setCurrent(t.type)},isAutosave:function(){return!!t.autosave},setAutosave:function(e){return t.autosave=!!e,this},getStepsBeforeSave:function(){return t.stepsBeforeSave},setStepsBeforeSave:function(e){return t.stepsBeforeSave=e,this},add:function(t,e){return s[t]=e,this},get:function(t){return s[t]||null},getStorages:function(){return s},getCurrent:function(){return t.currentStorage},setCurrent:function(e){return t.currentStorage=e,this},store:function(e,i){var n=this.get(this.getCurrent()),r={};for(var s in e)r[t.id+s]=e[s];return n?n.store(r,i):null},load:function(e,i){var n=this.get(this.getCurrent()),r=[],s={};"string"==typeof e&&(e=[e]);for(var o=0,a=e.length;o<a;o++)r.push(t.id+e[o]);var l=n?n.load(r,i):{};for(var c in l){var u=new RegExp("^"+t.id);s[c.replace(u,"")]=l[c]}return s},loadDefaultProviders:function(){for(var t in o)this.add(t,o[t]);return this},getConfig:function(){return t}}}},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{checkLocal:!0},store:function(t,e){this.checkStorageEnvironment();for(var i in t)localStorage.setItem(i,t[i]);"function"==typeof e&&e()},load:function(t,e){this.checkStorageEnvironment();for(var i={},n=0,r=t.length;n<r;n++){var s=localStorage.getItem(t[n]);s&&(i[t[n]]=s)}return"function"==typeof e&&e(i),i},remove:function(t){this.checkStorageEnvironment();for(var e=0,i=t.length;e<i;e++)localStorage.removeItem(t[e])},checkStorageEnvironment:function(){this.get("checkLocal")&&!localStorage&&console.warn("Your browser doesn't support localStorage")}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{urlStore:"",urlLoad:"",params:{},beforeSend:function(){},onComplete:function(){},contentTypeJson:!1},store:function(t,e){var i={},n=this.get("params");for(var r in t)i[r]=t[r];for(var s in n)i[s]=n[s];var o=$.ajax({url:this.get("urlStore"),beforeSend:this.get("beforeSend"),complete:this.get("onComplete"),method:"POST",dataType:"json",contentType:this.get("contentTypeJson")?"application/json; charset=utf-8":"x-www-form-urlencoded",data:this.get("contentTypeJson")?JSON.stringify(i):i});o&&o.always&&o.always(function(){"function"==typeof e&&e()})},load:function(t,e){var i={},n={},r=this.get("params");for(var s in r)n[s]=r[s];n.keys=t;var o=$.ajax({url:this.get("urlLoad"),beforeSend:this.get("beforeSend"),complete:this.get("onComplete"),data:n,async:!1,method:"GET"}).done(function(t){i=t});return o&&o.always&&o.always(function(t){"function"==typeof e&&e(t)}),i}})},function(t,e,i){"use strict";t.exports={stylePrefix:"sm-",sectors:[],textNoElement:"Select an element before using Style Manager",hideNotStylable:!0,highlightChanged:!0,highlightComputed:!0,showComputed:!0,clearProperties:!1,validComputed:["border-collapse","border-spacing","caption-side","color","cursor","direction","empty-cells","font-family","font-size","font-style","font-variant","font-weight","font-size-adjust","font-stretch","font","letter-spacing","line-height","list-style-image","list-style-position","list-style-type","list-style","orphans","quotes","tab-size","text-align","text-align-last","text-decoration-color","text-indent","text-justify","text-shadow","text-transform","visibility","white-space","widows","word-break","word-spacing","word-wrap"]}},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{index:"",value:"",values:{},active:!0,preview:!1},initialize:function(){if(!this.get("value")){var t="",e=this.get("values");for(var i in e)t+=" "+e[i];this.set("value",t.trim())}}})},function(t,e,i){"use strict";var n=i(0),r=i(35);t.exports=n.Model.extend({defaults:{name:"",property:"",type:"",units:[],unit:"",defaults:"",info:"",value:"",icon:"",preview:!1,detached:!1,visible:!0,functionName:"",status:"",properties:[],layers:[],list:[],fixedValues:["initial","inherit"]},initialize:function(t){var e=this.get("type"),n=this.get("name"),s=this.get("property"),o=this.get("properties");if(n||this.set("name",s.charAt(0).toUpperCase()+s.slice(1).replace(/-/g," ")),o.length){var a=i(36);this.set("properties",new a(o))}switch(e){case"stack":this.set("layers",new r)}},getValue:function(){var t="";switch(this.get("type")){case"integer":t=this.get("value")+this.get("unit");break;default:t=this.get("value")}return t}})},function(t,e,i){"use strict";i(0);t.exports=function(){return{build:function(t){var e=[];"string"==typeof t&&(t=[t]);for(var i=0,n=t.length;i<n;i++){var r={},s=t[i];switch(r.property=s,s){case"border-radius-c":r.property="border-radius"}switch(s){case"margin-top":case"margin-right":case"margin-bottom":case"margin-left":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"width":case"max-width":case"min-width":case"height":case"max-height":case"min-height":r.fixedValues=["initial","inherit","auto"];break;case"font-size":r.fixedValues=["medium","xx-small","x-small","small","large","x-large","xx-large","smaller","larger","length","initial","inherit"];break;case"letter-spacing":case"line-height":r.fixedValues=["normal","initial","inherit"]}switch(s){case"float":case"position":case"text-align":r.type="radio";break;case"display":case"font-family":case"font-weight":case"border-style":case"box-shadow-type":case"background-repeat":case"background-position":case"background-attachment":case"background-size":case"transition-property":case"transition-timing-function":case"cursor":case"overflow":r.type="select";break;case"top":case"right":case"bottom":case"left":case"margin-top":case"margin-right":case"margin-bottom":case"margin-left":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"min-height":case"min-width":case"max-height":case"max-width":case"width":case"height":case"font-size":case"letter-spacing":case"line-height":case"text-shadow-h":case"text-shadow-v":case"text-shadow-blur":case"border-radius-c":case"border-top-left-radius":case"border-top-right-radius":case"border-bottom-left-radius":case"border-bottom-right-radius":case"border-width":case"box-shadow-h":case"box-shadow-v":case"box-shadow-blur":case"box-shadow-spread":case"transition-duration":case"perspective":case"transform-rotate-x":case"transform-rotate-y":case"transform-rotate-z":case"transform-scale-x":case"transform-scale-y":case"transform-scale-z":r.type="integer";break;case"margin":case"padding":case"border-radius":case"border":case"transform":r.type="composite";break;case"color":case"text-shadow-color":case"background-color":case"border-color":case"box-shadow-color":r.type="color";break;case"text-shadow":case"box-shadow":case"background":case"transition":r.type="stack";break;case"background-image":r.type="file"}switch(s){case"float":case"background-color":case"background-image":case"text-shadow":r.defaults="none";break;case"display":r.defaults="block";break;case"position":r.defaults="static";break;case"top":case"right":case"bottom":case"left":case"margin-top":case"margin-right":case"margin-bottom":case"margin-left":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"text-shadow-h":case"text-shadow-v":case"text-shadow-blur":case"border-radius-c":case"border-top-left-radius":case"border-top-right-radius":case"border-bottom-left-radius":case"border-bottom-right-radius":case"box-shadow-h":case"box-shadow-v":case"box-shadow-spread":case"perspective":case"transform-rotate-x":case"transform-rotate-y":case"transform-rotate-z":r.defaults=0;break;case"transform-scale-x":case"transform-scale-y":case"transform-scale-z":r.defaults=1;break;case"box-shadow-blur":r.defaults=5;break;case"min-height":case"min-width":case"max-height":case"max-width":case"width":case"height":case"background-size":case"cursor":r.defaults="auto";break;case"font-family":r.defaults="Arial, Helvetica, sans-serif";break;case"font-size":case"border-width":r.defaults="medium";break;case"font-weight":r.defaults="400";break;case"letter-spacing":case"line-height":r.defaults="normal";break;case"color":case"text-shadow-color":case"border-color":case"box-shadow-color":r.defaults="black";break;case"text-align":r.defaults="left";break;case"border-style":r.defaults="solid";break;case"box-shadow-type":r.defaults="";break;case"background-repeat":r.defaults="repeat";break;case"background-position":r.defaults="left top";break;case"background-attachment":r.defaults="scroll";break;case"transition-property":r.defaults="width";break;case"transition-duration":r.defaults="2";break;case"transition-timing-function":r.defaults="ease";break;case"overflow":r.defaults="visible"}switch(s){case"top":case"right":case"bottom":case"left":case"margin-top":case"margin-right":case"margin-bottom":case"margin-left":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"min-height":case"min-width":case"max-height":case"max-width":case"width":case"height":case"text-shadow-h":case"text-shadow-v":case"text-shadow-blur":case"border-radius-c":case"border-top-left-radius":case"border-top-right-radius":case"border-bottom-left-radius":case"border-bottom-right-radius":case"box-shadow-h":case"box-shadow-v":r.units=["px","%"];break;case"font-size":case"letter-spacing":case"line-height":r.units=["px","em","rem","%"];break;case"border-width":r.units=["px","em"];break;case"box-shadow-blur":case"box-shadow-spread":case"perspective":r.units=["px"];break;case"transition-duration":r.units=["s"];break;case"transform-rotate-x":case"transform-rotate-y":case"transform-rotate-z":r.units=["deg"]}switch(s){case"min-height":case"min-width":case"max-height":case"max-width":case"width":case"height":case"font-size":case"text-shadow-blur":case"border-radius-c":case"border-top-left-radius":case"border-top-right-radius":case"border-bottom-left-radius":case"border-bottom-right-radius":case"border-width":case"box-shadow-blur":case"transition-duration":case"perspective":r.min=0}switch(s){case"text-shadow":case"box-shadow":case"background":r.preview=!0}switch(s){case"background":r.detached=!0}switch(s){case"transform-rotate-x":r.functionName="rotateX";break;case"transform-rotate-y":r.functionName="rotateY";break;case"transform-rotate-z":r.functionName="rotateZ";break;case"transform-scale-x":r.functionName="scaleX";break;case"transform-scale-y":r.functionName="scaleY";break;case"transform-scale-z":r.functionName="scaleZ";break;case"background-image":r.functionName="url"}switch(s){case"float":r.list=[{value:"none"},{value:"left"},{value:"right"}];break;case"display":r.list=[{value:"block"},{value:"inline"},{value:"inline-block"},{value:"none"}];break;case"position":r.list=[{value:"static"},{value:"relative"},{value:"absolute"},{value:"fixed"}];break;case"font-family":var o=", sans-serif",a=["Arial, Helvetica"+o,"Arial Black, Gadget"+o,"Brush Script MT"+o,"Comic Sans MS, cursive"+o,"Courier New, Courier, monospace","Georgia, serif","Helvetica, serif","Impact, Charcoal"+o,"Lucida Sans Unicode, Lucida Grande"+o,"Tahoma, Geneva"+o,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+o,"Verdana, Geneva"+o];r.list=[];for(var l=0,c=a.length;l<c;l++){var u={};u.value=a[l],u.name=a[l].split(",")[0],u.style="font-family: "+a[l]+"; font-size:15px",r.list.push(u)}break;case"font-weight":r.list=[{value:"100",name:"Thin"},{value:"200",name:"Extra-Light"},{value:"300",name:"Light"},{value:"400",name:"Normal"},{value:"500",name:"Medium"},{value:"600",name:"Semi-Bold"},{value:"700",name:"Bold"},{value:"800",name:"Extra-Bold"},{value:"900",name:"Ultra-Bold"}];break;case"text-align":r.list=[{value:"left"},{value:"center"},{value:"right"},{value:"justify"}];break;case"border-style":r.list=[{value:"none"},{value:"solid"},{value:"dotted"},{value:"dashed"},{value:"double"},{value:"groove"},{value:"ridge"},{value:"inset"},{value:"outset"}];break;case"box-shadow-type":r.list=[{value:"",name:"Outside"},{value:"inset",name:"Inside"}];break;case"background-repeat":r.list=[{value:"repeat"},{value:"repeat-x"},{value:"repeat-y"},{value:"no-repeat"}];break;case"background-position":r.list=[{value:"left top"},{value:"left center"},{value:"left bottom"},{value:"right top"},{value:"right center"},{value:"right bottom"},{value:"center top"},{value:"center center"},{value:"center bottom"}];break;case"background-attachment":r.list=[{value:"scroll"},{value:"fixed"},{value:"local"}];break;case"background-size":r.list=[{value:"auto"},{value:"cover"},{value:"contain"}];break;case"transition-property":r.list=[{value:"all"},{value:"width"},{value:"height"},{value:"background-color"},{value:"transform"},{value:"box-shadow"},{value:"opacity"}];break;case"transition-timing-function":r.list=[{value:"linear"},{value:"ease"},{value:"ease-in"},{value:"ease-out"},{value:"ease-in-out"}];break;case"cursor":r.list=[{value:"auto"},{value:"pointer"},{value:"copy"},{value:"crosshair"},{value:"grab"},{value:"grabbing"},{value:"help"},{value:"move"},{value:"text"}];break;case"overflow":r.list=[{value:"visible"},{value:"hidden"},{value:"scroll"},{value:"auto"}]}switch(s){case"margin":r.properties=this.build(["margin-top","margin-right","margin-bottom","margin-left"]);break;case"padding":r.properties=this.build(["padding-top","padding-right","padding-bottom","padding-left"]);break;case"text-shadow":r.properties=this.build(["text-shadow-h","text-shadow-v","text-shadow-blur","text-shadow-color"]);break;case"border":r.properties=this.build(["border-width","border-style","border-color"]);break;case"border-radius":r.properties=this.build(["border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"]);break;case"box-shadow":r.properties=this.build(["box-shadow-h","box-shadow-v","box-shadow-blur","box-shadow-spread","box-shadow-color","box-shadow-type"]);break;case"background":r.properties=this.build(["background-image","background-repeat","background-position","background-attachment","background-size"]);break;case"transition":r.properties=this.build(["transition-property","transition-duration","transition-timing-function"]);break;case"transform":r.properties=this.build(["transform-rotate-x","transform-rotate-y","transform-rotate-z","transform-scale-x","transform-scale-y","transform-scale-z"])}e.push(r)}return e}}}},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(36),s=i(171);t.exports=n.Model.extend({defaults:{id:"",name:"",open:!0,buildProps:"",extendBuilded:1,properties:[]},initialize:function(t){var e=t||{},i=[],n=this.buildProperties(e.buildProps);i=n?this.extendProperties(n):this.get("properties");var s=new r(i);s.sector=this,this.set("properties",s)},extendProperties:function(t,i,n){for(var r=t.length,s=i||this.get("properties"),o=this.get("extendBuilded"),a=[],l=0,c=s.length;l<c;l++){for(var u=s[l],h=0,d=0;d<r;d++){var f=t[d];if(u.property!=f.property);else{var p=u.properties;p&&p.length&&(u.properties=this.extendProperties(f.properties,p,1)),t[d]=o?e.extend(f,u):u,a[d]=t[d],h=1}}h||(t.push(u),a.push(u))}return n?a:t},buildProperties:function(t){var e=t||[];if(e.length)return this.propFactory||(this.propFactory=new s),this.propFactory.build(e)}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(172);t.exports=n.Collection.extend({model:r})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({events:{click:"updateIndex"},template:e.template('\n <div id="<%= pfx %>move">\n <i class="fa fa-arrows"></i>\n </div>\n <div id="<%= pfx %>label"><%= label %></div>\n <div id="<%= pfx %>preview-box">\n \t<div id="<%= pfx %>preview"></div>\n </div>\n <div id="<%= pfx %>close-layer" class="<%= pfx %>btn-close">⨯</div>\n <div id="<%= pfx %>inputs"></div>\n <div style="clear:both"></div>'),initialize:function(t){var e=this.model;this.stackModel=t.stackModel||{},this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.className=this.pfx+"layer",this.sorter=t.sorter||null,this.listenTo(e,"destroy remove",this.remove),this.listenTo(e,"change:value",this.valueChanged),this.listenTo(e,"change:props",this.showProps),this.events["click #"+this.pfx+"close-layer"]="remove",this.events["mousedown > #"+this.pfx+"move"]="initSorter",e.get("preview")||this.$el.addClass(this.pfx+"no-preview"),e.view=this,e.set({droppable:0,draggable:1}),this.$el.data("model",e),this.delegateEvents()},initSorter:function(t){this.sorter&&this.sorter.startSort(this.el)},getProps:function(){return this.stackModel.get?this.stackModel.get("properties"):null},valueChanged:function(){var t=this.model.get("preview");if(t){this.$preview||(this.$preview=this.$el.find("#"+this.pfx+"preview"));var e=this.getProps(),i=this.$preview;"function"==typeof t?t(e,i):this.onPreview(e,i)}},onPreview:function(t,e){var i=this.model.get("value").split(" "),n="";if(t.each(function(t,e){var r=i[e]||"";if(r&&"integer"==t.get("type")){var s=parseInt(r,10),o=r.replace(s,"");s=isNaN(s)?0:s,s>3&&(s=3),s<-3&&(s=-3),r=s+o}n+=r+" "}),this.stackModel.get){var r=this.stackModel.get("property");r&&(this.$preview.get(0).style[r]=n)}},showProps:function(){this.$props=this.model.get("props"),this.$el.find("#"+this.pfx+"inputs").html(this.$props.show()),this.model.set({props:null},{silent:!0})},remove:function(t){this.$props&&this.$props.detach(),t&&t.stopPropagation&&t.stopPropagation(),n.View.prototype.remove.apply(this,arguments),this.model.collection.contains(this.model)&&this.model.collection.remove(this.model),this.stackModel&&this.stackModel.set&&(this.stackModel.set({stackIndex:null},{silent:!0}),this.stackModel.trigger("updateValue"))},updateIndex:function(t){var e=this.getIndex();this.stackModel.set("stackIndex",e),this.model.collection&&this.model.collection.trigger("deselectAll"),this.$el.addClass(this.pfx+"active")},getIndex:function(){var t=0,e=this.model;return e.collection&&(t=e.collection.indexOf(e)),t},render:function(){return this.$el.html(this.template({label:"Layer "+this.model.get("index"),pfx:this.pfx})),this.$el.attr("class",this.className),this.valueChanged(),this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(174);t.exports=n.View.extend({initialize:function(t){this.config=t.config||{},this.stackModel=t.stackModel,this.preview=t.preview,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"";var e=this.pfx,i=this.ppfx,n=this.collection;this.className=e+"layers "+i+"field",this.listenTo(n,"add",this.addTo),this.listenTo(n,"deselectAll",this.deselectAll),this.listenTo(n,"reset",this.render);var r=this.config.em||"",s=r?r.get("Utils"):"";this.sorter=s?new s.Sorter({container:this.el,ignoreViewChildren:1,containerSel:"."+e+"layers",itemSel:"."+e+"layer",pfx:this.config.pStylePrefix}):"",n.view=this,this.$el.data("model",n),this.$el.data("collection",n)},addTo:function(t){var e=this.collection.indexOf(t);this.addToCollection(t,null,e)},addToCollection:function(t,e,i){var n=e||null,s=r;void 0!==this.preview&&t.set("preview",this.preview);var o=new s({model:t,stackModel:this.stackModel,config:this.config,sorter:this.sorter}),a=o.render().el;if(n)n.appendChild(a);else if(void 0!==i){var l="before";this.$el.children().length==i&&(i--,l="after"),i<0?this.$el.append(a):this.$el.children().eq(i)[l](a)}else this.$el.append(a);return a},deselectAll:function(){this.$el.find("."+this.pfx+"layer").removeClass(this.pfx+"active")},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.append(t),this.$el.attr("class",this.className),this.sorter&&(this.sorter.plh=null),this}})},function(t,e,i){"use strict";var n=(i(0),i(4)),r=i(24);t.exports=n.extend({renderTemplate:function(){},renderInput:function(){if(!this.input){var t=new r({target:this.target,model:this.model,ppfx:this.ppfx});this.input=t.render(),this.$el.append(this.input.$el),this.$input=this.input.inputEl,this.$color=this.input.colorEl}this.setValue(this.componentValue)},setValue:function(t){this.input.setValue(t,{silent:1})}})},function(t,e,i){"use strict";(function(e){var n=(i(0),i(4));t.exports=n.extend({template:e.template('<div class="<%= pfx %>field <%= pfx %>file">\n <div id=\'<%= pfx %>input-holder\'>\n <div class="<%= pfx %>btn-c">\n <button class="<%= pfx %>btn" id="<%= pfx %>images" type="button"><%= assets %></button>\n </div>\n <div style="clear:both;"></div>\n </div>\n <div id="<%= pfx %>preview-box">\n <div id="<%= pfx %>preview-file"></div>\n <div id="<%= pfx %>close">⨯</div>\n </div>\n </div>\n <div style="clear:both"></div>'),initialize:function(t){n.prototype.initialize.apply(this,arguments),this.assets=this.target.get("assets"),this.modal=this.target.get("Modal"),this.am=this.target.get("AssetManager"),this.className=this.className+" "+this.pfx+"file",this.events["click #"+this.pfx+"close"]="removeFile",this.events["click #"+this.pfx+"images"]="openAssetManager",this.delegateEvents()},renderInput:function(){this.$input||(this.$input=$("<input>",{placeholder:this.defaultValue,type:"text"})),this.$preview||(this.$preview=this.$el.find("#"+this.pfx+"preview-file")),this.$previewBox||(this.$previewBox=this.$el.find("#"+this.pfx+"preview-box")),this.setValue(this.componentValue,0)},setValue:function(t,e){n.prototype.setValue.apply(this,arguments),this.setPreviewView(t&&t!=this.getDefaultValue()),this.setPreview(t)},setPreviewView:function(t){this.$previewBox&&(t?this.$previewBox.addClass(this.pfx+"show"):this.$previewBox.removeClass(this.pfx+"show"))},spreadUrl:function(t){this.setValue(t),this.setPreviewView(1)},setPreview:function(t){this.$preview&&this.$preview.css("background-image","url("+t+")")},renderTemplate:function(){this.$el.append(this.template({upload:"Upload",assets:"Images",pfx:this.pfx}))},cleanValue:function(){this.setPreviewView(0),this.model.set({value:""},{silent:!0})},removeFile:function(){this.model.set("value",this.defaultValue);for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.prototype.cleanValue.apply(this,e),this.setPreviewView(0)},openAssetManager:function(t){var e=this,i=this.em,n=i?i.get("Editor"):"";n&&(this.modal.setTitle("Select image"),this.modal.setContent(this.am.render()),this.am.setTarget(null),n.runCommand("open-assets",{target:this.model,onSelect:function(i){e.modal.close(),e.spreadUrl(i.get("src")),e.valueChanged(t)}}))}})}).call(e,i(1))},function(t,e,i){"use strict";var n=(i(0),i(4)),r=i(25);t.exports=n.extend({initialize:function(t){n.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:unit",this.valueChanged),this.listenTo(this.model,"el:change",this.elementUpdated)},getValueForTarget:function(){var t=this.model;return t.get("value")+t.get("unit")},renderInput:function(){if(!this.input){var t=new r({model:this.model,ppfx:this.ppfx});this.input=t.render(),this.$el.append(this.input.$el),this.$input=this.input.inputEl,this.$unit=this.input.unitEl}this.setValue(this.componentValue)},renderTemplate:function(){},setValue:function(t){this.input.setValue(t,{silent:1})}})},function(t,e,i){"use strict";(function(e){var n=(i(0),i(4));t.exports=n.extend({template:e.template('\n <div class="<%= ppfx %>field <%= ppfx %>field-radio">\n <span id=\'<%= pfx %>input-holder\'></span>\n </div>\n <div style="clear:both"></div>'),initialize:function(t){n.prototype.initialize.apply(this,arguments),this.list=this.model.get("list")||[],this.className=this.className+" "+this.pfx+"list"},renderInput:function(){var t=this.pfx,i=this.ppfx,n=i+"radio-item-label",r=this.property;if(!this.$input&&this.list&&this.list.length){var s="";e.each(this.list,function(e){var o=e.className?e.className+" "+t+"icon "+n:"",a=r+"-"+e.value,l=e.name?e.name:e.value,c=e.title?'title="'+e.title+'"':"";s+='<div class="'+i+'radio-item"><input class="'+t+'radio" type="radio" id="'+a+'" name="'+r+'" value="'+e.value+'" /><label class="'+(o||n)+'" '+c+' for="'+a+'">'+(o?"":l)+"</label></div>"}),this.input=s,this.$inputEl=$(this.input),this.$el.find("#"+t+"input-holder").html(this.$inputEl),this.$input=this.$inputEl.find('input[name="'+this.property+'"]')}this.setValue(this.componentValue)},getInputValue:function(){return this.$input?this.$el.find("input:checked").val():""},setValue:function(t){var e=this.model.get("value")||this.defaultValue;t&&(e=t),this.$input&&this.$input.filter('[value="'+e+'"]').prop("checked",!0),this.model.set({value:e},{silent:!0})}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=(i(0),i(4));t.exports=n.extend({template:e.template('\n <div class="<%= ppfx %>field <%= ppfx %>select">\n <span id=\'<%= pfx %>input-holder\'></span>\n <div class="<%= ppfx %>sel-arrow">\n <div class="<%= ppfx %>d-s-arrow"></div>\n </div>\n </div>\n <div style="clear:both"></div>'),initialize:function(t){n.prototype.initialize.apply(this,arguments),this.list=this.model.get("list")||[]},renderInput:function(){var t=this.pfx;if(!this.$input){var i="<select>";this.list&&this.list.length&&e.each(this.list,function(t){var e=t.name?t.name:t.value,n=t.style?t.style.replace(/"/g,"""):"",r=n?'style="'+n+'"':"";i+='<option value="'+t.value.replace(/"/g,""")+'" '+r+">"+e+"</option>"}),i+="</select>",this.input=i,this.$input=$(this.input),this.$el.find("#"+t+"input-holder").html(this.$input)}this.setValue(this.componentValue,0)}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=(i(0),i(38)),r=(i(35),i(175));t.exports=n.extend({template:e.template('\n <div class="<%= pfx %>field <%= pfx %>stack">\n <button type="button" id=\'<%= pfx %>add\'>+</button>\n <span id=\'<%= pfx %>input-holder\'></span>\n </div>\n <div style="clear:both"></div>'),initialize:function(t){n.prototype.initialize.apply(this,arguments),this.model.set("stackIndex",null),this.className=this.pfx+"property "+this.pfx+"stack",this.events["click #"+this.pfx+"add"]="addLayer",this.listenTo(this.model,"change:stackIndex",this.indexChanged),this.listenTo(this.model,"updateValue",this.valueUpdated),this.delegateEvents()},targetUpdated:function(){if(this.model.get("detached"))this.checkVisibility();else{for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.prototype.targetUpdated.apply(this,e)}this.refreshLayers()},getLayers:function(){return this.model.get("layers")},indexChanged:function(t){var e=this.model;this.getLayers().at(e.get("stackIndex")).set("props",this.$props),e.get("properties").each(function(t){t.trigger("targetUpdated")})},getStackValues:function(){return this.getLayers().pluck("value")},getPropsConfig:function(t){var e=this,i=n.prototype.getPropsConfig.apply(this,arguments);return i.onChange=function(t,i,n){var r=i.model,s=e.build();if(e.model.get("detached")){var o="";r.collection.indexOf(r);e.getLayers().each(function(t){var e=t.get("values")[r.get("property")];e&&(o+=(o?",":"")+e)}),i.updateTargetStyle(o,null,n)}else e.model.set("value",s,n)},i},valueOnIndex:function(t,e){var i=null,n=this.model.get("stackIndex");if(this.model.get("detached")){i=(e.getTargetValue({ignoreCustomValue:1})+"").split(",")[n],i=i?i.trim():e.getDefaultValue(),i=e.tryFetchFromFunction(i)}else{var r=this.getStackValues(),s=r[n];if(!s)return;var o=s.split(" ");o.length&&o[t]&&(i=o[t])}return i},build:function(){var t=this.model.get("stackIndex");if(null!==t){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];var s=n.prototype.build.apply(this,i),o=this.getLayers().at(t);if(o){var a={};return this.model.get("properties").each(function(t){var e=t.getValue(),i=t.get("functionName");i&&(e=i+"("+e+")"),a[t.get("property")]=e}),o.set("values",a),o.set("value",s),this.createValue()}}},addLayer:function(t){if(this.getTarget()){var e=this.getLayers(),i=e.add({name:"test"}),n=e.indexOf(i);return i.set("value",this.getDefaultValue()),this.valueUpdated(),this.model.set("stackIndex",n),i}},valueUpdated:function(){var t=this.model;t.get("detached")?t.get("properties").each(function(t){t.trigger("change:value")}):t.set("value",this.createValue())},createValue:function(){return this.getStackValues().join(", ")},renderLayers:function(){return this.$field||(this.$field=this.$el.find("> ."+this.pfx+"field")),this.$layers||(this.$layers=new r({collection:this.getLayers(),stackModel:this.model,preview:this.model.get("preview"),config:this.config})),this.$field.append(this.$layers.render().el),this.$props.hide(),this},renderInput:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.prototype.renderInput.apply(this,e),this.refreshLayers()},getLayersFromTarget:function(){var t=[],e=this.getTarget();if(!e)return t;var i=e.get("style");return this.model.get("properties").each(function(e){var n=i[e.get("property")];if(n)for(var r=n.split(","),s=0,o=r.length;s<o;s++){var a=r[s].trim();if(t[s])t[s][e.get("property")]=a;else{var l={};l[e.get("property")]=a,t[s]=l}}}),t},refreshLayers:function(){var t=[],i=[],n="value",r=this.model.get("detached");if(r)n="values",i=this.getLayersFromTarget();else{var s=this.getTargetValue(),o=this.getDefaultValue();s=s==o?"":s,s&&(s.replace(/\(([\w\s,.]*)\)/g,function(t){var e=t.replace(/,\s*/g,",");s=s.replace(t,e)}),i=s.split(", "))}e.each(i,function(e){var i={};i[n]=e,t.push(i)},this),this.$props.detach();var a=this.getLayers();a.reset(),a.add(t),r||this.valueUpdated(),this.model.set({stackIndex:null},{silent:!0})},render:function(){return this.renderLabel(),this.renderField(),this.renderLayers(),this.$el.attr("class",this.className),this.updateStatus(),this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(37);t.exports=n.View.extend({template:e.template('\n <div class="<%= pfx %>title">\n <i id="<%= pfx %>caret" class="fa"></i>\n <%= label %>\n </div>'),events:{},initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.target=t.target||{},this.propTarget=t.propTarget||{},this.open=this.model.get("open"),this.caretR="fa-caret-right",this.caretD="fa-caret-down",this.listenTo(this.model,"change:open",this.updateOpen),this.listenTo(this.model,"updateVisibility",this.updateVisibility),this.events["click ."+this.pfx+"title"]="toggle",this.delegateEvents()},updateVisibility:function(){var t;this.model.get("properties").each(function(e){e.get("visible")&&(t=1)}),this.el.style.display=t?"block":"none"},updateOpen:function(){this.model.get("open")?this.show():this.hide()},show:function(){this.$el.addClass(this.pfx+"open"),this.$el.find("."+this.pfx+"properties").show(),this.$caret.removeClass(this.caretR).addClass(this.caretD)},hide:function(){this.$el.removeClass(this.pfx+"open"),this.$el.find("."+this.pfx+"properties").hide(),this.$caret.removeClass(this.caretD).addClass(this.caretR)},toggle:function(){var t=this.model.get("open")?0:1;this.model.set("open",t)},render:function(){return this.$el.html(this.template({pfx:this.pfx,label:this.model.get("name")})),this.$caret=this.$el.find("#"+this.pfx+"caret"),this.renderProperties(),this.$el.attr("class",this.pfx+"sector no-select"),this.updateOpen(),this},renderProperties:function(){var t=this.model.get("properties");if(t){var e=new r({collection:t,target:this.target,propTarget:this.propTarget,config:this.config});this.$el.append(e.render().el)}}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(182);t.exports=n.View.extend({initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.target=t.target||{},this.propTarget={},e.extend(this.propTarget,n.Events),this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render),this.listenTo(this.target,"change:selectedComponent targetClassAdded targetClassRemoved targetClassUpdated targetStateUpdated targetStyleUpdated change:device",this.targetUpdated)},addTo:function(t){this.addToCollection(t)},targetUpdated:function(){var t=this.target,e=t.get("selectedComponent");if(e){var i=t.get("Config"),n=i.devicePreviewMode,r=e.get("classes"),s=this.propTarget,o=t.getDeviceModel(),a=n?"":e.get("state"),l=o&&o.get("widthMedia"),c=a?":"+a:null,u=e.view,h=o&&!n&&l?"("+i.mediaCondition+": "+l+")":"";if(s.helper=null,u&&(s.computed=window.getComputedStyle(u.el,c)),r.length){var d=t.get("CssComposer"),f=r.getStyleable(),p=d.get(f,a,h);if(!p&&f.length&&(p=d.add(f,a,h),p.set("style",e.get("style")),e.set("style",{})),!p)return s.model=e,void s.trigger("update");if(a){var g=t.get("SelectorManager"),m=g.add("hc-state"),v=d.get([m]);v?(d.getAll().remove(v),d.getAll().add(v)):v=d.add([m]),v.set("style",p.get("style")),s.helper=v}return s.model=p,void s.trigger("update")}s.model=e,s.trigger("update")}},addToCollection:function(t,e){var i=e||null,n=r,s=new n({model:t,id:this.pfx+t.get("name").replace(" ","_").toLowerCase(),name:t.get("name"),properties:t.get("properties"),target:this.target,propTarget:this.propTarget,config:this.config}),o=s.render().el;return i?i.appendChild(o):this.$el.append(o),o},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.attr("id",this.pfx+"sectors"),this.$el.append(t),this}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports={stylePrefix:"trt-",labelContainer:"Component settings"}},function(t,e,i){"use strict";t.exports=function(){var t,e={},n=i(184),r=(i(39),i(192));return{TraitsView:r,name:"TraitManager",getConfig:function(){return e},init:function(i){e=i||{};for(var s in n)s in e||(e[s]=n[s]);var o=e.pStylePrefix;return o&&(e.stylePrefix=o+e.stylePrefix),t=new r({collection:[],editor:e.em,config:e}),this},getTraitsViewer:function(){return t},addType:function(e,i){var n=t.itemView;t.itemsView[e]=n.extend(i)},getType:function(e){return t.itemsView[e]}}}},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{type:"text",label:"",name:"",min:"",max:"",value:"",target:"",default:"",placeholder:"",changeProp:0,options:[]},initialize:function(){this.get("target")&&(this.target=this.get("target"),this.unset("target"))},getInitValue:function(){var t=this.target,e=this.get("name"),i=void 0;if(t){var n=t.get("attributes");i=this.get("changeProp")?t.get(e):n[e]}return i||this.get("value")||this.get("default")}})},function(t,e,i){"use strict";i(0);t.exports=function(){return{build:function(t){var e=[];"string"==typeof t&&(t=[t]);for(var i=0;i<t.length;i++){var n={},r=t[i];switch(n.name=r,r){case"target":n.type="select"}switch(r){case"title":case"alt":case"id":n.placeholder="eg. Text here";break;case"href":n.placeholder="eg. https://google.com"}switch(r){case"target":n.options=[{value:"",name:"This window"},{value:"_blank",name:"New window"}]}e.push(n)}return e}}}()},function(t,e,i){"use strict";var n=i(6);t.exports=n.extend({initialize:function(t){n.prototype.initialize.apply(this,arguments);var e=this.ppfx+"chk-icon";this.tmpl='<div class="'+this.fieldClass+'"><label class="'+this.inputhClass+'"><i class="'+e+'"></i></label></div>'},onChange:function(){this.model.set("value",this.getInputEl().checked)},getInputEl:function(){var t;this.$input||(t=1);for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];var s=n.prototype.getInputEl.apply(this,i);if(t){var o=this.model,a=o.get("name"),l=this.target;if(o.get("changeProp"))s.checked=l.get(a);else{var c=l.get("attributes");s.checked=!!c[a]}}return s}})},function(t,e,i){"use strict";var n=i(6),r=i(24);t.exports=n.extend({getInputEl:function(){if(!this.$input){var t=this.getModelValue(),e=new r({contClass:this.ppfx+"field-color",model:this.model,ppfx:this.ppfx});this.input=e.render(),this.$input=this.input.colorEl,t=t||"",this.model.set("value",t).trigger("change:value")}return this.$input.get(0)},renderField:function(){this.$input||(this.getInputEl(),this.$el.append(this.input.el))}})},function(t,e,i){"use strict";var n=i(6),r=i(25);t.exports=n.extend({getValueForTarget:function(){var t=this.model,e=t.get("value"),i=t.get("unit");return e?e+i:""},getInputEl:function(){if(!this.$input){var t=this.getModelValue(),e=new r({contClass:this.ppfx+"field-int",model:this.model,ppfx:this.ppfx});this.input=e.render(),this.$input=this.input.inputEl,this.$unit=this.input.unitEl,this.model.set("value",t),this.$input.val(t)}return this.$input.get(0)},renderField:function(){this.$input||(this.$el.append(this.tmpl),this.getInputEl(),this.$el.find("."+this.inputhClass).prepend(this.input.el))}})},function(t,e,i){"use strict";(function(e){var n=(i(0),i(6));t.exports=n.extend({initialize:function(t){n.prototype.initialize.apply(this,arguments);var e=this.ppfx;this.tmpl='<div class="'+this.fieldClass+'"><div class="'+this.inputhClass+'"></div><div class="'+e+'sel-arrow"><div class="'+e+'d-s-arrow"></div></div> </div>'},getInputEl:function(){if(!this.$input){var t=this.model,i=t.get("options")||[],n="<select>";i.length&&e.each(i,function(t){var e,i,r,s="";"string"==typeof t?(e=t,i=t):(e=t.name?t.name:t.value,i=t.value.replace(/"/g,"""),r=t.style?t.style.replace(/"/g,"""):"",s+=r?'style="'+r+'"':""),n+='<option value="'+i+'" '+s+">"+e+"</option>"}),n+="</select>",this.input=n,this.$input=$(this.input);var r=this.target,s=t.get("name"),o=t.get("value");if(t.get("changeProp"))o=o||r.get(s);else{o=r.get("attributes")[s]}o&&this.$input.val(o)}return this.$input.get(0)}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(26),r=i(6),s=i(191),o=i(188),a=i(190),l=i(189);t.exports=n.extend({itemView:r,itemsView:{text:r,number:a,select:s,checkbox:o,color:l},initialize:function(t){this.config=t.config||{},this.em=t.editor,this.pfx=this.config.stylePrefix||"",this.className=this.pfx+"traits",this.listenTo(this.em,"change:selectedComponent",this.updatedCollection),this.updatedCollection()},updatedCollection:function(){this.el.className=this.className;var t=this.em.get("selectedComponent");t&&(this.collection=t.get("traits"),this.render())}})},function(t,e,i){"use strict";var n=function(t,e){var i=e||window,n=t.getBoundingClientRect();return{left:n.left+i.pageXOffset,top:n.top+i.pageYOffset,width:n.width,height:n.height}};t.exports={setKey:function(t,e){},getElementRect:function(t){var e=this.opts.posFetcher||"";return e?e(t,{avoidFrameOffset:1}):n(t)},init:function(t){return this.setOptions(t),this.handleMouseDown=this.handleMouseDown.bind(this),this.drag=this.drag.bind(this),this.move=this.move.bind(this),this.stop=this.stop.bind(this),this.setKey("up, right, down, left",this.handleKey),this},setOptions:function(t){this.opts=t||{}},focus:function(t){if(!t||t!==this.el){this.getDocumentEl(t),this.blur(),this.el=t,this.handlers=this.opts.dragHandlers||[t];var e=this.getElementRect(t);this.elRect=e,this.startTop=e.top,this.startLeft=e.left,this.getDocumentEl().on("mousedown",this.handleMouseDown)}},blur:function(){this.getDocumentEl().off("mousedown",this.handleMouseDown),this.el=null},start:function(t){this.startPos=this.getMousePos(t);var e=this.getDocumentEl();e.on("mousemove",this.drag),e.on("mouseup",this.stop);var i=this.opts.onStart;"function"==typeof i&&i(t,{docs:e,el:this.el,start:this.startPos,elRect:this.elRect}),this.drag(t)},stop:function(t){var e=this.getDocumentEl();e.off("mousemove",this.drag),e.off("mouseup",this.stop),this.lockedAxis=null;var i=this.opts.onEnd;"function"==typeof i&&i(t,{docs:e,delta:this.delta,end:{x:this.startLeft+this.delta.x,y:this.startTop+this.delta.y}})},handleMouseDown:function(t){var e=t.target;this.isHandler(e)&&this.start(t)},isHandler:function(t){var e=this.handlers;for(var i in e)if(e[i]===t)return!0;return!1},handleKey:function(t,e){switch(e.shortcut){case"up":this.move(0,-1);break;case"right":this.move(1,0);break;case"down":this.move(0,1);break;case"left":this.move(-1,0)}},getDocumentEl:function(t){var t=t||this.el;if(!this.$doc){var e=[document];t&&e.push(t.ownerDocument),this.$doc=$(e)}return this.$doc},getMousePos:function(t){var e=this.opts.mousePosFetcher;return e?e(t):{x:t.clientX,y:t.clientY}},drag:function(t){var e=this.lockedAxis,i=this.getMousePos(t),n={x:i.x-this.startPos.x,y:i.y-this.startPos.y};if(t.shiftKey){if(!e){var r=n.x,s=n.y,o=Math.abs(r),a=Math.abs(s);s>=o||s<=-o?e="x":(r>a||r<-a)&&(e="y")}}else e=null;"x"===e&&(n.x=this.startPos.x),"y"===e&&(n.y=this.startPos.y),this.lockedAxis=e,this.delta=n,this.move(n.x,n.y);var l=this.opts.onDrag;"function"==typeof l&&l(t,{delta:n,current:{x:this.startLeft+n.x,y:this.startTop+n.y},lockedAxis:e}),0===t.which&&this.stop(t)},move:function(t,e){this.moveX(t),this.moveY(e)},moveX:function(t){var e=this.el,i=(this.opts,this.startLeft+t),n=this.opts.setX;"function"==typeof n?n(i,{el:e,start:this.startLeft,delta:t}):e.style.left=i+"px"},moveY:function(t){var e=this.el,i=(this.opts,this.startTop+t),n=this.opts.setY;"function"==typeof n?n(i,{el:e,start:this.startTop,delta:t}):e.style.top=i+"px"}}},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s={mousePosFetcher:null,updateTarget:null,ratioDefault:0,posFetcher:null,onStart:null,onMove:null,onEnd:null,tl:1,tc:1,tr:1,cl:1,cr:1,bl:1,bc:1,br:1},o=function(t,e){var i=e.prefix||"",n=document.createElement("i");return n.className=i+"resizer-h "+i+"resizer-h-"+t,n.setAttribute("data-"+i+"handler",t),n},a=function(t,e){var i=e||window,n=t.getBoundingClientRect();return{left:n.left+i.pageXOffset,top:n.top+i.pageYOffset,width:n.width,height:n.height}},l=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(this,t),this.setOptions(e),this}return r(t,[{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in s)e in t||(t[e]=s[e]);this.opts=t,this.setup()}},{key:"setup",value:function(){var t=this.opts,e=t.prefix||"",i=t.appendTo||document.body,n=void 0;for(this.container||(n=document.createElement("div"),n.className=e+"resizer-c",i.appendChild(n),this.container=n),n=this.container;n.firstChild;)n.removeChild(n.firstChild);var r={tl:t.tl?o("tl",t):"",tc:t.tc?o("tc",t):"",tr:t.tr?o("tr",t):"",cl:t.cl?o("cl",t):"",cr:t.cr?o("cr",t):"",bl:t.bl?o("bl",t):"",bc:t.bc?o("bc",t):"",br:t.br?o("br",t):""};for(var s in r){var a=r[s];a&&n.appendChild(a)}this.handlers=r,this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.move=this.move.bind(this),this.stop=this.stop.bind(this),this.mousePosFetcher=t.mousePosFetcher,this.updateTarget=t.updateTarget,this.posFetcher=t.posFetcher,this.onStart=t.onStart,this.onMove=t.onMove,this.onEnd=t.onEnd}},{key:"isHandler",value:function(t){var e=this.handlers;for(var i in e)if(e[i]===t)return!0;return!1}},{key:"getFocusedEl",value:function(){return this.el}},{key:"getDocumentEl",value:function(){return this.$doc||(this.$doc=$([this.el.ownerDocument,document])),this.$doc}},{key:"getElementPos",value:function(t){var e=this.posFetcher||"";return e?e(t):a(t)}},{key:"focus",value:function(t){if(!t||t!==this.el){this.el=t;var e=this.getElementPos(t),i=this.container,n=i.style;n.left=e.left+"px",n.top=e.top+"px",n.width=e.width+"px",n.height=e.height+"px",this.container.style.display="block",this.getDocumentEl().on("mousedown",this.handleMouseDown)}}},{key:"blur",value:function(){if(this.container.style.display="none",this.el){$([this.el.ownerDocument,document]);this.getDocumentEl().off("mousedown",this.handleMouseDown),this.el=null}}},{key:"start",value:function(t){if(0===t.button){t.preventDefault(),t.stopPropagation();var e=this.opts||{},i="data-"+e.prefix+"handler",n=this.getElementPos(this.el);this.handlerAttr=t.target.getAttribute(i),this.clickedHandler=t.target,this.startDim={t:n.top,l:n.left,w:n.width,h:n.height},this.rectDim={t:n.top,l:n.left,w:n.width,h:n.height},this.startPos={x:t.clientX,y:t.clientY};var r=this.getDocumentEl();r.on("mousemove",this.move),r.on("keydown",this.handleKeyDown),r.on("mouseup",this.stop),this.move(t),"function"==typeof this.onStart&&this.onStart(t,{docs:r})}}},{key:"move",value:function(t){var e=this.mousePosFetcher,i=e?e(t):{x:t.clientX,y:t.clientY};this.currentPos=i,this.delta={x:i.x-this.startPos.x,y:i.y-this.startPos.y},this.keys={shift:t.shiftKey,ctrl:t.ctrlKey,alt:t.altKey},this.rectDim=this.calc(this),this.updateRect(0),"function"==typeof this.onMove&&this.onMove(t),0===t.which&&this.stop(t)}},{key:"stop",value:function(t){var e=this.getDocumentEl();e.off("mousemove",this.move),e.off("keydown",this.handleKeyDown),e.off("mouseup",this.stop),this.updateRect(1),"function"==typeof this.onEnd&&this.onEnd(t,{docs:e})}},{key:"updateRect",value:function(t){var e=this.el.style,i=this.container.style,n=this.rectDim,r=this.getSelectedHandler();"function"==typeof this.updateTarget?this.updateTarget(this.el,n,{store:t,selectedHandler:r}):(e.width=n.w+"px",e.height=n.h+"px");var s=this.getElementPos(this.el);i.left=s.left+"px",i.top=s.top+"px",i.width=s.width+"px",i.height=s.height+"px"}},{key:"getSelectedHandler",value:function(){var t=this.handlers;if(this.selectedHandler)for(var e in t)if(t[e]===this.selectedHandler)return e}},{key:"handleKeyDown",value:function(t){27===t.keyCode&&(this.rectDim=this.startDim,this.stop(t))}},{key:"handleMouseDown",value:function(t){var e=t.target;this.isHandler(e)?(this.selectedHandler=e,this.start(t)):e!==this.el&&(this.selectedHandler="",this.blur())}},{key:"calc",value:function(t){var e=this.opts||{},i=this.startDim,n={t:0,l:0,w:i.w,h:i.h};if(t){var r=t.handlerAttr;~r.indexOf("r")&&(n.w=Math.max(32,i.w+t.delta.x)),~r.indexOf("b")&&(n.h=Math.max(32,i.h+t.delta.y)),~r.indexOf("l")&&(n.w=Math.max(32,i.w-t.delta.x)),~r.indexOf("t")&&(n.h=Math.max(32,i.h-t.delta.y));var s=e.ratioDefault?!t.keys.shift:t.keys.shift;if(r.indexOf("c")<0&&s){var o=i.w/i.h;n.w/n.h>o?n.h=Math.round(n.w/o):n.w=Math.round(n.h*o)}return~r.indexOf("l")&&(n.l=i.w-n.w),~r.indexOf("t")&&(n.t=i.h-n.h),n}}}]),t}();t.exports={init:function(t){return new l(t)}}},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({initialize:function(t){this.opt=t||{},e.bindAll(this,"startSort","onMove","endMove","rollback","udpateOffset","moveDragHelper");var i=t||{};this.elT=0,this.elL=0,this.borderOffset=i.borderOffset||10;var n=i.container;this.el="string"==typeof n?document.querySelector(n):n,this.$el=$(this.el),this.containerSel=i.containerSel||"div",this.itemSel=i.itemSel||"div",this.draggable=i.draggable||!0,this.nested=i.nested||0,this.pfx=i.pfx||"",this.ppfx=i.ppfx||"",this.freezeClass=i.freezeClass||this.pfx+"freezed",this.onStart=i.onStart||"",this.onEndMove=i.onEndMove||"",this.direction=i.direction||"v",this.onMoveClb=i.onMove||"",this.relative=i.relative||0,this.ignoreViewChildren=i.ignoreViewChildren||0,this.ignoreModels=i.ignoreModels||0,this.plh=i.placer||"",this.wmargin=i.wmargin||0,this.offTop=i.offsetTop||0,this.offLeft=i.offsetLeft||0,this.document=i.document||document,this.$document=$(this.document),this.dropContent=null,this.em=i.em||"",this.dragHelper=null,this.canvasRelative=i.canvasRelative||0,this.em&&this.em.on&&(this.em.on("change:canvasOffset",this.udpateOffset),this.udpateOffset())},getContainerEl:function(){if(!this.el){var t=this.opt.container;this.el="string"==typeof t?document.querySelector(t):t,this.$el=$(this.el)}return this.el},udpateOffset:function(){var t=this.em.get("canvasOffset");this.offTop=t.top,this.offLeft=t.left},setDropContent:function(t){this.dropContent=t},toggleSortCursor:function(t){var e=this.em,i=document.body,n=this.ppfx||this.pfx,r=n+"grabbing",s=e?e.get("Canvas").getBody():"";t?(e&&e.get("Canvas").startAutoscroll(),i.className+=" "+r,e&&(s.className+=" "+r)):(e&&e.get("Canvas").stopAutoscroll(),i.className=i.className.replace(r,"").trim(),e&&(s.className=s.className.replace(r,"").trim()))},setDragHelper:function(t,e){for(var i=e||"",n=t.cloneNode(1),r="",s=getComputedStyle(t),o=0;o<s.length;o++)r+=s[o]+":"+s.getPropertyValue(s[o])+";";n.setAttribute("style",r),n.className+=" "+this.pfx+"bdrag",document.body.appendChild(n),this.dragHelper=n,i&&this.moveDragHelper(i),this.em&&$(this.em.get("Canvas").getBody().ownerDocument).off("mousemove",this.moveDragHelper).on("mousemove",this.moveDragHelper),$(document).off("mousemove",this.moveDragHelper).on("mousemove",this.moveDragHelper)},moveDragHelper:function(t){var e=t.target.ownerDocument;if(this.dragHelper&&e){var i=e.defaultView||e.parentWindow,n=0,r=0,s=i.frameElement;if(s){var o=s.getBoundingClientRect();n=o.top||0,r=o.left||0}var a=this.dragHelper.style;a.left=t.pageX-i.pageXOffset+r+"px",a.top=t.pageY-i.pageYOffset+n+"px"}},matches:function(t,e,i){for(var n=t.parentNode||document.body,r=n.querySelectorAll(e),s=0;r[s]&&r[s]!==t;)++s;return!!r[s]},closest:function(t,e){if(t){for(var i=t.parentNode;i&&1===i.nodeType;){if(this.matches(i,e))return i;i=i.parentNode}return null}},offset:function(t){var e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},createPlaceholder:function(){var t=this.pfx,e=document.createElement("div"),i=document.createElement("div");return e.className=t+"placeholder",e.style.display="none",e.style["pointer-events"]="none",i.className=t+"placeholder-int",e.appendChild(i),e},startSort:function(t){if(this.dropModel=null,this.moved=0,t&&!this.matches(t,this.itemSel+","+this.containerSel)&&(t=this.closest(t,this.itemSel)),this.eV=t,this.plh||(this.plh=this.createPlaceholder(),this.getContainerEl().appendChild(this.plh)),t){var e=this.getSourceModel();e&&e.set&&e.set("status","freezed"),this.$document.on("mouseup",this.endMove)}this.$el.on("mousemove",this.onMove),$(document).on("keydown",this.rollback),this.$document.on("keydown",this.rollback),"function"==typeof this.onStart&&this.onStart(),this.em&&this.em.clearSelection(),this.toggleSortCursor(1)},getTargetModel:function(t){var e=t||this.target;return $(e).data("model")},getSourceModel:function(){var t=this.eV,e=this.dropContent,i=this.dropModel,n=this.em;if(e&&n){if(!i){var r=n.get("DomComponents").getComponents(),s=r.add(e,{avoidUpdateStyle:1,temporary:1});i=r.remove(s,{temporary:1}),this.dropModel=i instanceof Array?i[0]:i}return i}if(t)return $(t).data("model")},selectTargetModel:function(t){if(!(t instanceof n.Collection)){var e=this.targetModel;e&&e.set("status",""),t&&t.set&&(t.set("status","selected-parent"),this.targetModel=t)}},onMove:function(t){this.moved=1;var e=this.plh,i=e.style.display;i&&"none"!==i||(e.style.display="block");var n=this.offset(this.el);this.elT=this.wmargin?Math.abs(n.top):n.top,this.elL=this.wmargin?Math.abs(n.left):n.left;var r=t.pageY-this.elT+this.el.scrollTop,s=t.pageX-this.elL+this.el.scrollLeft;if(this.canvasRelative&&this.em){var o=this.em.get("Canvas").getMouseRelativeCanvas(t);s=o.x,r=o.y}var a=this.dimsFromTarget(t.target,s,r),l=this.getTargetModel(this.target);this.selectTargetModel(l),this.lastDims=a;var c=this.findPosition(a,s,r);this.lastPos&&this.lastPos.index==c.index&&this.lastPos.method==c.method||(this.movePlaceholder(this.plh,a,c,this.prevTargetDim),this.$plh||(this.$plh=$(this.plh)),this.canvasRelative||(this.offTop&&this.$plh.css("top","+="+this.offTop+"px"),this.offLeft&&this.$plh.css("left","+="+this.offLeft+"px")),this.lastPos=c),"function"==typeof this.onMoveClb&&this.onMoveClb(t)},isInFlow:function(t,e){if(!t)return!1;e=e||document.body;var i=t;return i.offsetHeight,!!this.styleInFlow(i,e)},styleInFlow:function(t,e){var i=t.style,n=$(t);if(!(i.overflow&&"visible"!==i.overflow||"none"!==n.css("float")||e&&"flex"==$(e).css("display"))){switch(i.position){case"static":case"relative":case"":break;default:return}switch(t.tagName){case"TR":case"TBODY":case"THEAD":case"TFOOT":return!0}switch(n.css("display")){case"block":case"list-item":case"table":case"flex":return!0}}},validTarget:function(t){var e=this.getSourceModel(),i=e&&e.view&&e.view.el,r=this.getTargetModel(t);t=r&&r.view&&r.view.el;var s={valid:!0,src:i,srcModel:e,trg:t,trgModel:r};if(!i||!t)return s.valid=!1,s;var o=r.get("droppable");o=o instanceof n.Collection?1:o,o=o instanceof Array?o.join(", "):o,s.dropInfo=o,o="string"==typeof o?i.matches(o):o,s.droppable=o;var a=e.get("draggable");return a=a instanceof Array?a.join(", "):a,s.dragInfo=a,a="string"==typeof a?t.matches(a):a,s.draggable=a,o&&a||(s.valid=!1),s},dimsFromTarget:function(t,e,i){var n=[];if(!t)return n;if(t.matches(this.itemSel+", "+this.containerSel)||(t=this.closest(t,this.itemSel)),this.draggable instanceof Array&&(t=this.closest(t,this.draggable.join(","))),!t)return n;if(this.prevTarget&&this.prevTarget!=t&&(this.prevTarget=null),!this.prevTarget){this.targetP=this.closest(t,this.containerSel);if(!this.validTarget(t).valid&&this.targetP)return this.dimsFromTarget(this.targetP,e,i);this.prevTarget=t,this.prevTargetDim=this.getDim(t),this.cacheDimsP=this.getChildrenDim(this.targetP),this.cacheDims=this.getChildrenDim(t)}if(this.prevTarget==t&&(n=this.cacheDims),this.target=this.prevTarget,this.nearBorders(this.prevTargetDim,e,i)||!this.nested&&!this.cacheDims.length){if(!this.validTarget(this.targetP).valid)return this.dimsFromTarget(this.targetP,e,i);n=this.cacheDimsP,this.target=this.targetP}return this.lastPos=null,n},getDim:function(t){var e,i,n,r;if(this.canvasRelative&&this.em){var s=this.em.get("Canvas").getElementPos(t),o=window.getComputedStyle(t),a=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),c=parseFloat(o.marginRight),u=parseFloat(o.marginLeft);e=s.top-a,i=s.left-u,n=s.height+a+l,r=s.width+u+c}else{var h=this.offset(t);e=this.relative?t.offsetTop:h.top-(this.wmargin?-1:1)*this.elT,i=this.relative?t.offsetLeft:h.left-(this.wmargin?-1:1)*this.elL,n=t.offsetHeight,r=t.offsetWidth}return[e,i,n,r]},getChildrenDim:function(t){var e=[];if(!t)return e;var i=this.getTargetModel(t);i&&i.view&&!this.ignoreViewChildren&&(t=i.view.getChildrenContainer());for(var n=t.children,r=0,s=n.length;r<s;r++){var o=n[r];if(o.matches(this.itemSel)){var a=this.getDim(o),l=this.direction;l="v"==l||"h"!=l&&this.isInFlow(o,t),a.push(l),a.push(o),e.push(a)}}return e},nearBorders:function(t,e,i){var n=0,r=this.borderOffset,s=e||0,o=i||0,a=t[0],l=t[1],c=t[2],u=t[3];return(a+r>o||o>a+c-r||l+r>s||s>l+u-r)&&(n=1),!!n},findPosition:function(t,e,i){for(var n={index:0,method:"before"},r=0,s=0,o=0,a=0,l=0,c=0,u=0,h=0,d=0,f=t.length;d<f;d++)if(h=t[d],o=h[1]+h[3],u=h[0]+h[2],l=h[1]+h[3]/2,c=h[0]+h[2]/2,!(s&&h[1]>s||a&&c>=a||r&&o<r))if(n.index=d,h[4]){if(i<c){n.method="before";break}n.method="after"}else i<u&&(a=u),e<l?(s=l,n.method="before"):(r=l,n.method="after");return n},movePlaceholder:function(t,e,i,n){var r=0,s=0,o=0,a=0,l="px",c=i.method,u=e[i.index];if(t.style.borderColor="transparent #62c462",t.style.borderWidth="3px 5px",t.style.margin="-3px 0 0",u)u[4]?(o=u[3]+l,a="auto",r="before"==c?u[0]-0:u[0]+u[2]-0,s=u[1]):(o="auto",a=u[2]-0+l,r=u[0]+0,s="before"==c?u[1]-0:u[1]+u[3]-0,t.style.borderColor="#62c462 transparent",t.style.borderWidth="5px 3px",t.style.margin="0 0 0 -3px");else{if(!this.nested)return void(t.style.display="none");n&&(r=n[0]+5,s=n[1]+5,o=parseInt(n[3])-10+l,a="auto")}t.style.top=r+l,t.style.left=s+l,o&&(t.style.width=o),a&&(t.style.height=a)},endMove:function(t){var e;this.$el.off("mousemove",this.onMove),this.$document.off("mouseup",this.endMove),this.$document.off("keydown",this.rollback),this.plh.style.display="none";var i=(new RegExp("(?:^|\\s)"+this.freezeClass+"(?!\\S)","gi"),this.eV);if(i){var n=this.getSourceModel();n&&n.set&&(n.set("status",""),n.set("status","selected"))}this.moved&&(e=this.move(this.target,i,this.lastPos)),this.plh&&(this.plh.style.display="none"),"function"==typeof this.onEndMove&&this.onEndMove(e);var r=this.dragHelper;r&&(r.remove(),this.dragHelper=null),this.selectTargetModel(),this.toggleSortCursor()},move:function(t,e,i){var r=this.em;r&&r.trigger("component:dragEnd:before",t,e,i);var s,o,a,l=[],c=i.index,u=this.validTarget(t),h=$(t).data("collection"),d=u.srcModel,f=u.droppable,p=u.draggable,g=u.dropInfo,m=u.dragInfo,v=this.dropContent;if(f=u.trgModel instanceof n.Collection?1:f,h&&f&&p){c="after"===i.method?c+1:c;var y={at:c,noIncrement:1};v?(s=v,y.silent=!1,y.avoidUpdateStyle=1):(o=h.add({},y),d&&(s=d.collection.remove(d))),a=h.add(s,y),v?this.dropContent=null:h.remove(o),this.prevTarget=null}else h||l.push("Target collection not found"),f||l.push("Target is not droppable, accepts ["+g+"]"),p||l.push("Component not draggable, acceptable by ["+m+"]"),console.warn("Invalid target position: "+l.join(", "));return r&&r.trigger("component:dragEnd",h,s,l),a},rollback:function(t){$(document).off("keydown",this.rollback),this.$document.off("keydown",this.rollback),27==(t.which||t.keyCode)&&(this.moved=!1,this.endMove())}})}).call(e,i(1))},function(t,e,i){"use strict";t.exports=function(){var t=i(195),e=i(194),n=i(193);return{name:"Utils",init:function(){return this},Sorter:t,Resizer:e,Dragger:n}}},function(t,e,i){var n,r,s;/*!
|
|
* Backbone.Undo.js v0.2
|
|
*
|
|
* Copyright (c)2013 Oliver Sartun
|
|
* Released under the MIT License
|
|
*
|
|
* Documentation and full license available at
|
|
* https://github.com/osartun/Backbone.Undo.js
|
|
*/
|
|
!function(o){r=[i(1),i(198)],n=o,void 0!==(s="function"==typeof n?n.apply(e,r):n)&&(t.exports=s)}(function(t,e){function i(t,e,i){return i.length<=4?t.call(e,i[0],i[1],i[2],i[3]):t.apply(e,i)}function n(t,e){return f.call(t,e)}function r(e,i){return null!=e&&(t.isArray(i)||(i=n(arguments,1)),t.all(i,function(t){return t in e}))}function s(){this.registeredObjects=[],this.cidIndexes=[]}function o(e,i,n,r){for(var s,o=0,a=i.length;o<a;o++)if(s=i[o]){if("on"===e){if(!r.objectRegistry.register(s))continue}else if(!r.objectRegistry.unregister(s))continue;t.isFunction(s[e])&&s[e]("all",n,r)}}function a(e,i){var n=i.type,r=i.undoTypes,s=!r[n]||r[n][e];t.isFunction(s)&&s(i.object,i.before,i.after,i.options)}function l(e,i,n,r,s){if(!(n.isCurrentlyUndoRedoing||"undo"===e&&-1===n.pointer||"redo"===e&&n.pointer===n.length-1)){n.isCurrentlyUndoRedoing=!0;var o,a,l="undo"===e;for(s?a=l&&n.pointer===n.length-1||!l&&-1===n.pointer?t.clone(n.models):f.apply(n.models,l?[0,n.pointer]:[n.pointer,n.length-1]):(o=n.at(l?n.pointer:n.pointer+1),a=r?n.where({magicFusionIndex:o.get("magicFusionIndex")}):[o]),n.pointer+=(l?-1:1)*a.length;o=l?a.pop():a.shift();)o[e]();n.isCurrentlyUndoRedoing=!1,i.trigger(e,i)}}function c(t,e){var n=t.condition,r=typeof n;return"function"===r?!!i(n,t,e):"boolean"!==r||n}function u(t,e,n,s){if(t.track&&!t.isCurrentlyUndoRedoing&&e in s&&c(s[e],n)){var o,a=i(s[e].on,s[e],n);if(r(a,"object","before","after")){if(a.type=e,a.magicFusionIndex=p(),a.undoTypes=s,t.pointer<t.length-1)for(var o=t.length-t.pointer-1;o--;)t.pop();t.pointer=t.length,t.add(a),t.length>t.maximumStackLength&&(t.shift(),t.pointer--)}}}function h(){}function d(e,i,n,s){if("object"==typeof i)return t.each(i,function(t,i){2===e?d(e,t,n,s):d(e,i,t,n)});switch(e){case 0:r(n,"undo","redo","on")&&t.all(t.pick(n,"undo","redo","on"),t.isFunction)&&(s[i]=n);break;case 1:s[i]&&t.isObject(n)&&(s[i]=t.extend({},s[i],n));break;case 2:delete s[i]}return this}var f=Array.prototype.slice,p=function(){function e(){n++,i=!0,t.defer(function(){i=!1})}var i=!1,n=-1;return function(){return i||e(),n}}();s.prototype={isRegistered:function(e){return e&&e.cid?this.registeredObjects[e.cid]:t.contains(this.registeredObjects,e)},register:function(t){return!this.isRegistered(t)&&(t&&t.cid?(this.registeredObjects[t.cid]=t,this.cidIndexes.push(t.cid)):this.registeredObjects.push(t),!0)},unregister:function(e){if(this.isRegistered(e)){if(e&&e.cid)delete this.registeredObjects[e.cid],this.cidIndexes.splice(t.indexOf(this.cidIndexes,e.cid),1);else{var i=t.indexOf(this.registeredObjects,e);this.registeredObjects.splice(i,1)}return!0}return!1},get:function(){return t.map(this.cidIndexes,function(t){return this.registeredObjects[t]},this).concat(this.registeredObjects)}};var g={add:{undo:function(t,e,i,n){t.remove(i,n)},redo:function(t,e,i,n){n.index&&(n.at=n.index),t.add(i,n)},on:function(e,i,n){return{object:i,before:void 0,after:e,options:t.clone(n)}}},remove:{undo:function(t,e,i,n){"index"in n&&(n.at=n.index),t.add(e,n)},redo:function(t,e,i,n){t.remove(e,n)},on:function(e,i,n){return{object:i,before:e,after:void 0,options:t.clone(n)}}},change:{undo:function(e,i,n,r){t.isEmpty(i)?t.each(t.keys(n),e.unset,e):(e.set(i),r&&r.unsetData&&r.unsetData.before&&r.unsetData.before.length&&t.each(r.unsetData.before,e.unset,e))},redo:function(e,i,n,r){t.isEmpty(n)?t.each(t.keys(i),e.unset,e):(e.set(n),r&&r.unsetData&&r.unsetData.after&&r.unsetData.after.length&&t.each(r.unsetData.after,e.unset,e))},on:function(e,i){var n=e.changedAttributes(),r=t.keys(n),s=t.pick(e.previousAttributes(),r),o=t.keys(s),a=(i||(i={})).unsetData={after:[],before:[]};return r.length!=o.length&&(r.length>o.length?t.each(r,function(t){t in s||a.before.push(t)},this):t.each(o,function(t){t in n||a.after.push(t)})),{object:e,before:s,after:n,options:t.clone(i)}}},reset:{undo:function(t,e,i){t.reset(e)},redo:function(t,e,i){t.reset(i)},on:function(e,i){return{object:e,before:i.previousModels,after:t.clone(e.models)}}}};h.prototype=g;var m=e.Model.extend({defaults:{type:null,object:null,before:null,after:null,magicFusionIndex:null},undo:function(t){a("undo",this.attributes)},redo:function(t){a("redo",this.attributes)}}),v=e.Collection.extend({model:m,pointer:-1,track:!1,isCurrentlyUndoRedoing:!1,maximumStackLength:1/0,setMaxLength:function(t){this.maximumStackLength=t}}),y=e.Model.extend({defaults:{maximumStackLength:1/0,track:!1},initialize:function(e){this.stack=new v,this.objectRegistry=new s,this.undoTypes=new h,this.stack.setMaxLength(this.get("maximumStackLength")),this.on("change:maximumStackLength",function(t,e){this.stack.setMaxLength(e)},this),e&&e.track&&this.startTracking(),e&&e.register&&(t.isArray(e.register)||t.isArguments(e.register)?i(this.register,this,e.register):this.register(e.register))},startTracking:function(){this.set("track",!0),this.stack.track=!0},stopTracking:function(){this.set("track",!1),this.stack.track=!1},isTracking:function(){return this.get("track")},_addToStack:function(t){u(this.stack,t,n(arguments,1),this.undoTypes)},register:function(){o("on",arguments,this._addToStack,this)},unregister:function(){o("off",arguments,this._addToStack,this)},unregisterAll:function(){i(this.unregister,this,this.objectRegistry.get())},undo:function(t){l("undo",this,this.stack,t)},undoAll:function(){l("undo",this,this.stack,!1,!0)},redo:function(t){l("redo",this,this.stack,t)},redoAll:function(){l("redo",this,this.stack,!1,!0)},isAvailable:function(t){var e=this.stack,i=e.length;switch(t){case"undo":return i>0&&e.pointer>-1;case"redo":return i>0&&e.pointer<i-1;default:return!1}},merge:function(e){for(var i,r=t.isArray(e)?e:n(arguments);i=r.pop();)i instanceof y&&i.stack instanceof v&&(i.stack=this.stack)},addUndoType:function(t,e){d(0,t,e,this.undoTypes)},changeUndoType:function(t,e){d(1,t,e,this.undoTypes)},removeUndoType:function(t){d(2,t,void 0,this.undoTypes)},clear:function(){this.stack.reset(),this.stack.pointer=-1}});return t.extend(y,{defaults:function(e){t.extend(y.prototype.defaults,e)},addUndoType:function(t,e){d(0,t,e,g)},changeUndoType:function(t,e){d(1,t,e,g)},removeUndoType:function(t){d(2,t,void 0,g)}}),e.UndoManager=y})},function(t,e,i){(function(n){var r,s;!function(o){var a="object"==typeof self&&self.self==self&&self||"object"==typeof n&&n.global==n&&n;r=[i(1),i(12),e],void 0!==(s=function(t,e,i){a.Backbone=o(a,i,t,e)}.apply(e,r))&&(t.exports=s)}(function(t,e,i,n){var r=t.Backbone,s=[].slice;e.VERSION="1.2.1",e.$=n,e.noConflict=function(){return t.Backbone=r,this},e.emulateHTTP=!1,e.emulateJSON=!1;var o=function(t,e,n){switch(t){case 1:return function(){return i[e](this[n])};case 2:return function(t){return i[e](this[n],t)};case 3:return function(t,r){return i[e](this[n],t,r)};case 4:return function(t,r,s){return i[e](this[n],t,r,s)};default:return function(){var t=s.call(arguments);return t.unshift(this[n]),i[e].apply(i,t)}}},a=function(t,e,n){i.each(e,function(e,r){i[r]&&(t.prototype[r]=o(e,r,n))})},l=e.Events={},c=/\s+/,u=function(t,e,n,r,s){var o,a=0;if(n&&"object"==typeof n){void 0!==r&&"context"in s&&void 0===s.context&&(s.context=r);for(o=i.keys(n);a<o.length;a++)e=t(e,o[a],n[o[a]],s)}else if(n&&c.test(n))for(o=n.split(c);a<o.length;a++)e=t(e,o[a],r,s);else e=t(e,n,r,s);return e};l.on=function(t,e,i){return h(this,t,e,i)};var h=function(t,e,i,n,r){if(t._events=u(d,t._events||{},e,i,{context:n,ctx:t,listening:r}),r){(t._listeners||(t._listeners={}))[r.id]=r}return t};l.listenTo=function(t,e,n){if(!t)return this;var r=t._listenId||(t._listenId=i.uniqueId("l")),s=this._listeningTo||(this._listeningTo={}),o=s[r];if(!o){var a=this._listenId||(this._listenId=i.uniqueId("l"));o=s[r]={obj:t,objId:r,id:a,listeningTo:s,count:0}}return h(t,e,n,this,o),this};var d=function(t,e,i,n){if(i){var r=t[e]||(t[e]=[]),s=n.context,o=n.ctx,a=n.listening;a&&a.count++,r.push({callback:i,context:s,ctx:s||o,listening:a})}return t};l.off=function(t,e,i){return this._events?(this._events=u(f,this._events,t,e,{context:i,listeners:this._listeners}),this):this},l.stopListening=function(t,e,n){var r=this._listeningTo;if(!r)return this;for(var s=t?[t._listenId]:i.keys(r),o=0;o<s.length;o++){var a=r[s[o]];if(!a)break;a.obj.off(e,n,this)}return i.isEmpty(r)&&(this._listeningTo=void 0),this};var f=function(t,e,n,r){if(t){var s,o=0,a=r.context,l=r.listeners;if(e||n||a){for(var c=e?[e]:i.keys(t);o<c.length;o++){e=c[o];var u=t[e];if(!u)break;for(var h=[],d=0;d<u.length;d++){var f=u[d];n&&n!==f.callback&&n!==f.callback._callback||a&&a!==f.context?h.push(f):(s=f.listening)&&0==--s.count&&(delete l[s.id],delete s.listeningTo[s.objId])}h.length?t[e]=h:delete t[e]}return i.size(t)?t:void 0}for(var p=i.keys(l);o<p.length;o++)s=l[p[o]],delete l[s.id],delete s.listeningTo[s.objId]}};l.once=function(t,e,n){var r=u(p,{},t,e,i.bind(this.off,this));return this.on(r,void 0,n)},l.listenToOnce=function(t,e,n){var r=u(p,{},e,n,i.bind(this.stopListening,this,t));return this.listenTo(t,r)};var p=function(t,e,n,r){if(n){var s=t[e]=i.once(function(){r(e,s),n.apply(this,arguments)});s._callback=n}return t};l.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),i=Array(e),n=0;n<e;n++)i[n]=arguments[n+1];return u(g,this._events,t,void 0,i),this};var g=function(t,e,i,n){if(t){var r=t[e],s=t.all;r&&s&&(s=s.slice()),r&&m(r,n),s&&m(s,[e].concat(n))}return t},m=function(t,e){var i,n=-1,r=t.length,s=e[0],o=e[1],a=e[2];switch(e.length){case 0:for(;++n<r;)(i=t[n]).callback.call(i.ctx);return;case 1:for(;++n<r;)(i=t[n]).callback.call(i.ctx,s);return;case 2:for(;++n<r;)(i=t[n]).callback.call(i.ctx,s,o);return;case 3:for(;++n<r;)(i=t[n]).callback.call(i.ctx,s,o,a);return;default:for(;++n<r;)(i=t[n]).callback.apply(i.ctx,e);return}};l.bind=l.on,l.unbind=l.off,i.extend(e,l);var v=e.Model=function(t,e){var n=t||{};e||(e={}),this.cid=i.uniqueId(this.cidPrefix),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(n=this.parse(n,e)||{}),n=i.defaults({},n,i.result(this,"defaults")),this.set(n,e),this.changed={},this.initialize.apply(this,arguments)};i.extend(v.prototype,l,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return null!=this.get(t)},matches:function(t){return!!i.iteratee(t,this)(this.attributes)},set:function(t,e,n){if(null==t)return this;var r;if("object"==typeof t?(r=t,n=e):(r={})[t]=e,n||(n={}),!this._validate(r,n))return!1;var s=n.unset,o=n.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=i.clone(this.attributes),this.changed={});var c=this.attributes,u=this.changed,h=this._previousAttributes;this.idAttribute in r&&(this.id=r[this.idAttribute]);for(var d in r)e=r[d],i.isEqual(c[d],e)||a.push(d),i.isEqual(h[d],e)?delete u[d]:u[d]=e,s?delete c[d]:c[d]=e;if(!o){a.length&&(this._pending=n);for(var f=0;f<a.length;f++)this.trigger("change:"+a[f],this,c[a[f]],n)}if(l)return this;if(!o)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:!0}))},clear:function(t){var e={};for(var n in this.attributes)e[n]=void 0;return this.set(e,i.extend({},t,{unset:!0}))},hasChanged:function(t){return null==t?!i.isEmpty(this.changed):i.has(this.changed,t)},changedAttributes:function(t){if(!t)return!!this.hasChanged()&&i.clone(this.changed);var e=this._changing?this._previousAttributes:this.attributes,n={};for(var r in t){var s=t[r];i.isEqual(e[r],s)||(n[r]=s)}return!!i.size(n)&&n},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=i.extend({parse:!0},t);var e=this,n=t.success;return t.success=function(i){var r=t.parse?e.parse(i,t):i;if(!e.set(r,t))return!1;n&&n.call(t.context,e,i,t),e.trigger("sync",e,i,t)},z(this,t),this.sync("read",this,t)},save:function(t,e,n){var r;null==t||"object"==typeof t?(r=t,n=e):(r={})[t]=e,n=i.extend({validate:!0,parse:!0},n);var s=n.wait;if(r&&!s){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;var o=this,a=n.success,l=this.attributes;n.success=function(t){o.attributes=l;var e=n.parse?o.parse(t,n):t;if(s&&(e=i.extend({},r,e)),e&&!o.set(e,n))return!1;a&&a.call(n.context,o,t,n),o.trigger("sync",o,t,n)},z(this,n),r&&s&&(this.attributes=i.extend({},l,r));var c=this.isNew()?"create":n.patch?"patch":"update";"patch"!==c||n.attrs||(n.attrs=r);var u=this.sync(c,this,n);return this.attributes=l,u},destroy:function(t){t=t?i.clone(t):{};var e=this,n=t.success,r=t.wait,s=function(){e.stopListening(),e.trigger("destroy",e,e.collection,t)};t.success=function(i){r&&s(),n&&n.call(t.context,e,i,t),e.isNew()||e.trigger("sync",e,i,t)};var o=!1;return this.isNew()?i.defer(t.success):(z(this,t),o=this.sync("delete",this,t)),r||s(),o},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||_();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.defaults({validate:!0},t))},_validate:function(t,e){if(!e.validate||!this.validate)return!0;t=i.extend({},this.attributes,t);var n=this.validationError=this.validate(t,e)||null;return!n||(this.trigger("invalid",this,n,i.extend(e,{validationError:n})),!1)}}),a(v,{keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1},"attributes");var y=e.Collection=function(t,e){e||(e={}),e.model&&(this.model=e.model),void 0!==e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,i.extend({silent:!0},e))},b={add:!0,remove:!0,merge:!0},x={add:!0,remove:!1};i.extend(y.prototype,l,{model:v,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:!1},e,x))},remove:function(t,e){e=i.extend({},e);var n=!i.isArray(t);t=n?[t]:i.clone(t);var r=this._removeModels(t,e);return!e.silent&&r&&this.trigger("update",this,e),n?r[0]:r},set:function(t,e){e=i.defaults({},e,b),e.parse&&!this._isModel(t)&&(t=this.parse(t,e));var n=!i.isArray(t);t=n?t?[t]:[]:t.slice();var r,s,o,a,l,c=e.at;null!=c&&(c=+c),c<0&&(c+=this.length+1);for(var u=this.comparator&&null==c&&!1!==e.sort,h=i.isString(this.comparator)?this.comparator:null,d=[],f=[],p={},g=e.add,m=e.merge,v=e.remove,y=!(u||!g||!v)&&[],x=!1,w=0;w<t.length;w++){if(o=t[w],a=this.get(o))v&&(p[a.cid]=!0),m&&o!==a&&(o=this._isModel(o)?o.attributes:o,e.parse&&(o=a.parse(o,e)),a.set(o,e),u&&!l&&a.hasChanged(h)&&(l=!0)),t[w]=a;else if(g){if(!(s=t[w]=this._prepareModel(o,e)))continue;d.push(s),this._addReference(s,e)}s=a||s,s&&(r=this.modelId(s.attributes),!y||!s.isNew()&&p[r]||(y.push(s),x=x||!this.models[w]||s.cid!==this.models[w].cid),p[r]=!0)}if(v){for(var w=0;w<this.length;w++)p[(s=this.models[w]).cid]||f.push(s);f.length&&this._removeModels(f,e)}if(d.length||x)if(u&&(l=!0),this.length+=d.length,null!=c)for(var w=0;w<d.length;w++)this.models.splice(c+w,0,d[w]);else{y&&(this.models.length=0);for(var C=y||d,w=0;w<C.length;w++)this.models.push(C[w])}if(l&&this.sort({silent:!0}),!e.silent){for(var k=null!=c?i.clone(e):e,w=0;w<d.length;w++)null!=c&&(k.index=c+w),(s=d[w]).trigger("add",s,this,k);(l||x)&&this.trigger("sort",this,e),(d.length||f.length)&&this.trigger("update",this,e)}return n?t[0]:t},reset:function(t,e){e=e?i.clone(e):{};for(var n=0;n<this.models.length;n++)this._removeReference(this.models[n],e);return e.previousModels=this.models,this._reset(),t=this.add(t,i.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return s.apply(this.models,arguments)},get:function(t){if(null!=t){var e=this.modelId(this._isModel(t)?t.attributes:t);return this._byId[t]||this._byId[e]||this._byId[t.cid]}},at:function(t){return t<0&&(t+=this.length),this.models[t]},where:function(t,e){var n=i.matches(t);return this[e?"find":"filter"](function(t){return n(t.attributes)})},findWhere:function(t){return this.where(t,!0)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return t||(t={}),i.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(i.bind(this.comparator,this)),t.silent||this.trigger("sort",this,t),this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=i.extend({parse:!0},t);var e=t.success,n=this;return t.success=function(i){var r=t.reset?"reset":"set";n[r](i,t),e&&e.call(t.context,n,i,t),n.trigger("sync",n,i,t)},z(this,t),this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};var n=e.wait;if(!(t=this._prepareModel(t,e)))return!1;n||this.add(t,e);var r=this,s=e.success;return e.success=function(t,e,i){n&&r.add(t,i),s&&s.call(i.context,t,e,i)},t.save(null,e),t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){if(this._isModel(t))return t.collection||(t.collection=this),t;e=e?i.clone(e):{},e.collection=this;var n=new this.model(t,e);return n.validationError?(this.trigger("invalid",this,n.validationError,e),!1):n},_removeModels:function(t,e){for(var i=[],n=0;n<t.length;n++){var r=this.get(t[n]);if(r){var s=this.indexOf(r);this.models.splice(s,1),this.length--,e.silent||(e.index=s,r.trigger("remove",r,this,e)),i.push(r),this._removeReference(r,e)}}return!!i.length&&i},_isModel:function(t){return t instanceof v},_addReference:function(t,e){this._byId[t.cid]=t;var i=this.modelId(t.attributes);null!=i&&(this._byId[i]=t),t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var i=this.modelId(t.attributes);null!=i&&delete this._byId[i],this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,n){if("add"!==t&&"remove"!==t||i===this){if("destroy"===t&&this.remove(e,n),"change"===t){var r=this.modelId(e.previousAttributes()),s=this.modelId(e.attributes);r!==s&&(null!=r&&delete this._byId[r],null!=s&&(this._byId[s]=e))}this.trigger.apply(this,arguments)}}}),a(y,{forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:2,contains:2,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3},"models");var w=["groupBy","countBy","sortBy","indexBy"];i.each(w,function(t){i[t]&&(y.prototype[t]=function(e,n){var r=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,r,n)})});var C=e.View=function(t){this.cid=i.uniqueId("view"),i.extend(this,i.pick(t,S)),this._ensureElement(),this.initialize.apply(this,arguments)},k=/^(\S+)\s*(.*)$/,S=["model","collection","el","id","attributes","className","tagName","events"];i.extend(C.prototype,l,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(t){return this.undelegateEvents(),this._setElement(t),this.delegateEvents(),this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t),this.el=this.$el[0]},delegateEvents:function(t){if(t||(t=i.result(this,"events")),!t)return this;this.undelegateEvents();for(var e in t){var n=t[e];if(i.isFunction(n)||(n=this[n]),n){var r=e.match(k);this.delegate(r[1],r[2],i.bind(n,this))}}return this},delegate:function(t,e,i){return this.$el.on(t+".delegateEvents"+this.cid,e,i),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(t,e,i){return this.$el.off(t+".delegateEvents"+this.cid,e,i),this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(this.el)this.setElement(i.result(this,"el"));else{var t=i.extend({},i.result(this,"attributes"));this.id&&(t.id=i.result(this,"id")),this.className&&(t.class=i.result(this,"className")),this.setElement(this._createElement(i.result(this,"tagName"))),this._setAttributes(t)}},_setAttributes:function(t){this.$el.attr(t)}}),e.sync=function(t,n,r){var s=T[t];i.defaults(r||(r={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var o={type:s,dataType:"json"};if(r.url||(o.url=i.result(n,"url")||_()),null!=r.data||!n||"create"!==t&&"update"!==t&&"patch"!==t||(o.contentType="application/json",o.data=JSON.stringify(r.attrs||n.toJSON(r))),r.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{}),r.emulateHTTP&&("PUT"===s||"DELETE"===s||"PATCH"===s)){o.type="POST",r.emulateJSON&&(o.data._method=s);var a=r.beforeSend;r.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",s),a)return a.apply(this,arguments)}}"GET"===o.type||r.emulateJSON||(o.processData=!1);var l=r.error;r.error=function(t,e,i){r.textStatus=e,r.errorThrown=i,l&&l.call(r.context,t,e,i)};var c=r.xhr=e.ajax(i.extend(o,r));return n.trigger("request",n,c,r),c};var T={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var M=e.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},E=/\((.*?)\)/g,P=/(\(\?)?:\w+/g,$=/\*\w+/g,L=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(M.prototype,l,{initialize:function(){},route:function(t,n,r){i.isRegExp(t)||(t=this._routeToRegExp(t)),i.isFunction(n)&&(r=n,n=""),r||(r=this[n]);var s=this;return e.history.route(t,function(i){var o=s._extractParameters(t,i);!1!==s.execute(r,o,n)&&(s.trigger.apply(s,["route:"+n].concat(o)),s.trigger("route",n,o),e.history.trigger("route",s,n,o))}),this},execute:function(t,e,i){t&&t.apply(this,e)},navigate:function(t,i){return e.history.navigate(t,i),this},_bindRoutes:function(){if(this.routes){this.routes=i.result(this,"routes");for(var t,e=i.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(L,"\\$&").replace(E,"(?:$1)?").replace(P,function(t,e){return e?t:"([^/?]+)"}).replace($,"([^?]*?)"),new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var n=t.exec(e).slice(1);return i.map(n,function(t,e){return e===n.length-1?t||null:t?decodeURIComponent(t):null})}});var A=e.History=function(){this.handlers=[],i.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},N=/^[#\/]|\s+$/g,O=/^\/+|\/+$/g,D=/#.*$/;A.started=!1,i.extend(A.prototype,l,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root&&!this.getSearch()},matchRoot:function(){return this.decodeFragment(this.location.pathname).slice(0,this.root.length-1)+"/"===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===t.charAt(0)?t.slice(1):t},getFragment:function(t){return null==t&&(t=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),t.replace(N,"")},start:function(t){if(A.started)throw new Error("Backbone.history has already been started");if(A.started=!0,this.options=i.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,this._hasHashChange="onhashchange"in window,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(O,"/"),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 n=document.body,r=n.insertBefore(this.iframe,n.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?s("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?s("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),i.any(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 i=this.root;""!==t&&"?"!==t.charAt(0)||(i=i.slice(0,-1)||"/");var n=i+t;if(t=this.decodeFragment(t.replace(D,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var r=this.iframe.contentWindow;e.replace||(r.document.open(),r.document.close()),this._updateHash(r.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else t.hash="#"+e}}),e.history=new A;var I=function(t,e){var n,r=this;n=t&&i.has(t,"constructor")?t.constructor:function(){return r.apply(this,arguments)},i.extend(n,r,e);var s=function(){this.constructor=n};return s.prototype=r.prototype,n.prototype=new s,t&&i.extend(n.prototype,t),n.__super__=r.prototype,n};v.extend=y.extend=M.extend=C.extend=A.extend=I;var _=function(){throw new Error('A "url" property or function must be specified')},z=function(t,e){var i=e.error;e.error=function(n){i&&i.call(e.context,t,n,e),t.trigger("error",t,n,e)}};return e})}).call(e,i(42))},function(t,e,i){!function(t){t(i(5))}(function(t){t.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(t,e){return/^[;{}]$/.test(e)}}),t.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(t,e,i,n){return this.jsonMode?/^[\[,{]$/.test(e)||/^}/.test(i):(";"!=e||!n.lexical||")"!=n.lexical.type)&&(/^[;{}]$/.test(e)&&!/^;/.test(i))}});var e=/^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;t.extendMode("xml",{commentStart:"\x3c!--",commentEnd:"--\x3e",newlineAfterToken:function(t,i,n,r){var s=!1;return"html"==this.configuration&&(s=!!r.context&&e.test(r.context.tagName)),!s&&("tag"==t&&/>$/.test(i)&&r.context||/^</.test(n))}}),t.defineExtension("commentRange",function(e,i,n){var r=this,s=t.innerMode(r.getMode(),r.getTokenAt(i).state).mode;r.operation(function(){if(e)r.replaceRange(s.commentEnd,n),r.replaceRange(s.commentStart,i),i.line==n.line&&i.ch==n.ch&&r.setCursor(i.line,i.ch+s.commentStart.length);else{var t=r.getRange(i,n),o=t.indexOf(s.commentStart),a=t.lastIndexOf(s.commentEnd);o>-1&&a>-1&&a>o&&(t=t.substr(0,o)+t.substring(o+s.commentStart.length,a)+t.substr(a+s.commentEnd.length)),r.replaceRange(t,i,n)}})}),t.defineExtension("autoIndentRange",function(t,e){var i=this;this.operation(function(){for(var n=t.line;n<=e.line;n++)i.indentLine(n,"smart")})}),t.defineExtension("autoFormatRange",function(e,i){function n(){c+="\n",h=!0,++u}for(var r=this,s=r.getMode(),o=r.getRange(e,i).split("\n"),a=t.copyState(s,r.getTokenAt(e).state),l=r.getOption("tabSize"),c="",u=0,h=0===e.ch,d=0;d<o.length;++d){for(var f=new t.StringStream(o[d],l);!f.eol();){var p=t.innerMode(s,a),g=s.token(f,a),m=f.current();f.start=f.pos,h&&!/\S/.test(m)||(c+=m,h=!1),!h&&p.mode.newlineAfterToken&&p.mode.newlineAfterToken(g,m,f.string.slice(f.pos)||o[d+1]||"",p.state)&&n()}!f.pos&&s.blankLine&&s.blankLine(a),!h&&d<o.length-1&&n()}r.operation(function(){r.replaceRange(c,e,i);for(var t=e.line+1,n=e.line+u;t<=n;++t)r.indentLine(t,"smart");r.setSelection(e,r.getCursor(!1))})})})},function(t,e,i){!function(t){t(i(5),i(202),i(201),i(40))}(function(t){"use strict";function e(t,e,i){var n=t.current(),r=n.search(e);return r>-1?t.backUp(n.length-r):n.match(/<\/?$/)&&(t.backUp(n.length),t.match(e,!1)||t.match(n)),i}function i(t){var e=l[t];return e||(l[t]=new RegExp("\\s+"+t+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*"))}function n(t,e){var n=t.match(i(e));return n?/^\s*(.*?)\s*$/.exec(n[2])[1]:""}function r(t,e){return new RegExp((e?"^":"")+"</s*"+t+"s*>","i")}function s(t,e){for(var i in t)for(var n=e[i]||(e[i]=[]),r=t[i],s=r.length-1;s>=0;s--)n.unshift(r[s])}function o(t,e){for(var i=0;i<t.length;i++){var r=t[i];if(!r[0]||r[1].test(n(e,r[0])))return r[2]}}var a={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},l={};t.defineMode("htmlmixed",function(i,n){function l(n,s){var a,h=c.token(n,s.htmlState),d=/\btag\b/.test(h);if(d&&!/[<>\s\/]/.test(n.current())&&(a=s.htmlState.tagName&&s.htmlState.tagName.toLowerCase())&&u.hasOwnProperty(a))s.inTag=a+" ";else if(s.inTag&&d&&/>$/.test(n.current())){var f=/^([\S]+) (.*)/.exec(s.inTag);s.inTag=null;var p=">"==n.current()&&o(u[f[1]],f[2]),g=t.getMode(i,p),m=r(f[1],!0),v=r(f[1],!1);s.token=function(t,i){return t.match(m,!1)?(i.token=l,i.localState=i.localMode=null,null):e(t,v,i.localMode.token(t,i.localState))},s.localMode=g,s.localState=t.startState(g,c.indent(s.htmlState,""))}else s.inTag&&(s.inTag+=n.current(),n.eol()&&(s.inTag+=" "));return h}var c=t.getMode(i,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),u={},h=n&&n.tags,d=n&&n.scriptTypes;if(s(a,u),h&&s(h,u),d)for(var f=d.length-1;f>=0;f--)u.script.unshift(["type",d[f].matches,d[f].mode]);return{startState:function(){return{token:l,inTag:null,localMode:null,localState:null,htmlState:t.startState(c)}},copyState:function(e){var i;return e.localState&&(i=t.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:i,htmlState:t.copyState(c,e.htmlState)}},token:function(t,e){return e.token(t,e)},indent:function(e,i){return!e.localMode||/^\s*<\//.test(i)?c.indent(e.htmlState,i):e.localMode.indent?e.localMode.indent(e.localState,i):t.Pass},innerMode:function(t){return{state:t.localState||t.htmlState,mode:t.localMode||c}}}},"xml","javascript","css"),t.defineMIME("text/html","htmlmixed")})},function(t,e,i){!function(t){t(i(5))}(function(t){"use strict";function e(t,e,i){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(e.lastType)||"quasi"==e.lastType&&/\{\s*$/.test(t.string.slice(0,t.pos-(i||0)))}t.defineMode("javascript",function(i,n){function r(t){for(var e,i=!1,n=!1;null!=(e=t.next());){if(!i){if("/"==e&&!n)return;"["==e?n=!0:n&&"]"==e&&(n=!1)}i=!i&&"\\"==e}}function s(t,e,i){return kt=t,St=i,e}function o(t,i){var n=t.next();if('"'==n||"'"==n)return i.tokenize=a(n),i.tokenize(t,i);if("."==n&&t.match(/^\d+(?:[eE][+\-]?\d+)?/))return s("number","number");if("."==n&&t.match(".."))return s("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return s(n);if("="==n&&t.eat(">"))return s("=>","operator");if("0"==n&&t.eat(/x/i))return t.eatWhile(/[\da-f]/i),s("number","number");if("0"==n&&t.eat(/o/i))return t.eatWhile(/[0-7]/i),s("number","number");if("0"==n&&t.eat(/b/i))return t.eatWhile(/[01]/i),s("number","number");if(/\d/.test(n))return t.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),s("number","number");if("/"==n)return t.eat("*")?(i.tokenize=l,l(t,i)):t.eat("/")?(t.skipToEnd(),s("comment","comment")):e(t,i,1)?(r(t),t.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),s("regexp","string-2")):(t.eatWhile(Nt),s("operator","operator",t.current()));if("`"==n)return i.tokenize=c,c(t,i);if("#"==n)return t.skipToEnd(),s("error","error");if(Nt.test(n))return t.eatWhile(Nt),s("operator","operator",t.current());if(Lt.test(n)){t.eatWhile(Lt);var o=t.current(),u=At.propertyIsEnumerable(o)&&At[o];return u&&"."!=i.lastType?s(u.type,u.style,o):s("variable","variable",o)}}function a(t){return function(e,i){var n,r=!1;if(Et&&"@"==e.peek()&&e.match(Ot))return i.tokenize=o,s("jsonld-keyword","meta");for(;null!=(n=e.next())&&(n!=t||r);)r=!r&&"\\"==n;return r||(i.tokenize=o),s("string","string")}}function l(t,e){for(var i,n=!1;i=t.next();){if("/"==i&&n){e.tokenize=o;break}n="*"==i}return s("comment","comment")}function c(t,e){for(var i,n=!1;null!=(i=t.next());){if(!n&&("`"==i||"$"==i&&t.eat("{"))){e.tokenize=o;break}n=!n&&"\\"==i}return s("quasi","string-2",t.current())}function u(t,e){e.fatArrowAt&&(e.fatArrowAt=null);var i=t.string.indexOf("=>",t.start);if(!(i<0)){if($t){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(t.string.slice(t.start,i));n&&(i=n.index)}for(var r=0,s=!1,o=i-1;o>=0;--o){var a=t.string.charAt(o),l=Dt.indexOf(a);if(l>=0&&l<3){if(!r){++o;break}if(0==--r){"("==a&&(s=!0);break}}else if(l>=3&&l<6)++r;else if(Lt.test(a))s=!0;else{if(/["'\/]/.test(a))return;if(s&&!r){++o;break}}}s&&!r&&(e.fatArrowAt=o)}}function h(t,e,i,n,r,s){this.indented=t,this.column=e,this.type=i,this.prev=r,this.info=s,null!=n&&(this.align=n)}function d(t,e){for(var i=t.localVars;i;i=i.next)if(i.name==e)return!0;for(var n=t.context;n;n=n.prev)for(var i=n.vars;i;i=i.next)if(i.name==e)return!0}function f(t,e,i,n,r){var s=t.cc;for(_t.state=t,_t.stream=r,_t.marked=null,_t.cc=s,_t.style=e,t.lexical.hasOwnProperty("align")||(t.lexical.align=!0);;){if((s.length?s.pop():Pt?k:C)(i,n)){for(;s.length&&s[s.length-1].lex;)s.pop()();return _t.marked?_t.marked:"variable"==i&&d(t,n)?"variable-2":e}}}function p(){for(var t=arguments.length-1;t>=0;t--)_t.cc.push(arguments[t])}function g(){return p.apply(null,arguments),!0}function m(t){function e(e){for(var i=e;i;i=i.next)if(i.name==t)return!0;return!1}var i=_t.state;if(_t.marked="def",i.context){if(e(i.localVars))return;i.localVars={name:t,next:i.localVars}}else{if(e(i.globalVars))return;n.globalVars&&(i.globalVars={name:t,next:i.globalVars})}}function v(){_t.state.context={prev:_t.state.context,vars:_t.state.localVars},_t.state.localVars=zt}function y(){_t.state.localVars=_t.state.context.vars,_t.state.context=_t.state.context.prev}function b(t,e){var i=function(){var i=_t.state,n=i.indented;if("stat"==i.lexical.type)n=i.lexical.indented;else for(var r=i.lexical;r&&")"==r.type&&r.align;r=r.prev)n=r.indented;i.lexical=new h(n,_t.stream.column(),t,null,i.lexical,e)};return i.lex=!0,i}function x(){var t=_t.state;t.lexical.prev&&(")"==t.lexical.type&&(t.indented=t.lexical.indented),t.lexical=t.lexical.prev)}function w(t){function e(i){return i==t?g():";"==t?p():g(e)}return e}function C(t,e){return"var"==t?g(b("vardef",e.length),Z,w(";"),x):"keyword a"==t?g(b("form"),T,C,x):"keyword b"==t?g(b("form"),C,x):"{"==t?g(b("}"),U,x):";"==t?g():"if"==t?("else"==_t.state.lexical.info&&_t.state.cc[_t.state.cc.length-1]==x&&_t.state.cc.pop()(),g(b("form"),T,C,x,nt)):"function"==t?g(ct):"for"==t?g(b("form"),rt,C,x):"variable"==t?g(b("stat"),H):"switch"==t?g(b("form"),T,b("}","switch"),w("{"),U,x,x):"case"==t?g(k,w(":")):"default"==t?g(w(":")):"catch"==t?g(b("form"),v,w("("),ut,w(")"),C,x,y):"class"==t?g(b("form"),dt,x):"export"==t?g(b("stat"),mt,x):"import"==t?g(b("stat"),vt,x):"module"==t?g(b("form"),Q,b("}"),w("{"),U,x,x):"type"==t?g(K,w("operator"),K,w(";")):"async"==t?g(C):p(b("stat"),k,w(";"),x)}function k(t){return M(t,!1)}function S(t){return M(t,!0)}function T(t){return"("!=t?p():g(b(")"),k,w(")"),x)}function M(t,e){if(_t.state.fatArrowAt==_t.stream.start){var i=e?D:O;if("("==t)return g(v,b(")"),W(Q,")"),x,w("=>"),i,y);if("variable"==t)return p(v,Q,w("=>"),i,y)}var n=e?L:$;return It.hasOwnProperty(t)?g(n):"function"==t?g(ct,n):"class"==t?g(b("form"),ht,x):"keyword c"==t||"async"==t?g(e?P:E):"("==t?g(b(")"),E,w(")"),x,n):"operator"==t||"spread"==t?g(e?S:k):"["==t?g(b("]"),wt,x,n):"{"==t?j(R,"}",null,n):"quasi"==t?p(A,n):"new"==t?g(I(e)):g()}function E(t){return t.match(/[;\}\)\],]/)?p():p(k)}function P(t){return t.match(/[;\}\)\],]/)?p():p(S)}function $(t,e){return","==t?g(k):L(t,e,!1)}function L(t,e,i){var n=0==i?$:L,r=0==i?k:S;return"=>"==t?g(v,i?D:O,y):"operator"==t?/\+\+|--/.test(e)?g(n):"?"==e?g(k,w(":"),r):g(r):"quasi"==t?p(A,n):";"!=t?"("==t?j(S,")","call",n):"."==t?g(F,n):"["==t?g(b("]"),E,w("]"),x,n):void 0:void 0}function A(t,e){return"quasi"!=t?p():"${"!=e.slice(e.length-2)?g(A):g(k,N)}function N(t){if("}"==t)return _t.marked="string-2",_t.state.tokenize=c,g(A)}function O(t){return u(_t.stream,_t.state),p("{"==t?C:k)}function D(t){return u(_t.stream,_t.state),p("{"==t?C:S)}function I(t){return function(e){return"."==e?g(t?z:_):p(t?S:k)}}function _(t,e){if("target"==e)return _t.marked="keyword",g($)}function z(t,e){if("target"==e)return _t.marked="keyword",g(L)}function H(t){return":"==t?g(x,C):p($,w(";"),x)}function F(t){if("variable"==t)return _t.marked="property",g()}function R(t,e){return"async"==t?(_t.marked="property",g(R)):"variable"==t||"keyword"==_t.style?(_t.marked="property",g("get"==e||"set"==e?V:B)):"number"==t||"string"==t?(_t.marked=Et?"property":_t.style+" property",g(B)):"jsonld-keyword"==t?g(B):"modifier"==t?g(R):"["==t?g(k,w("]"),B):"spread"==t?g(k):":"==t?p(B):void 0}function V(t){return"variable"!=t?p(B):(_t.marked="property",g(ct))}function B(t){return":"==t?g(S):"("==t?p(ct):void 0}function W(t,e){function i(n,r){if(","==n){var s=_t.state.lexical;return"call"==s.info&&(s.pos=(s.pos||0)+1),g(function(i,n){return i==e||n==e?p():p(t)},i)}return n==e||r==e?g():g(w(e))}return function(n,r){return n==e||r==e?g():p(t,i)}}function j(t,e,i){for(var n=3;n<arguments.length;n++)_t.cc.push(arguments[n]);return g(b(e,i),W(t,e),x)}function U(t){return"}"==t?g():p(C,U)}function q(t,e){if($t){if(":"==t)return g(K);if("?"==e)return g(q)}}function K(t){return"variable"==t?(_t.marked="variable-3",g(J)):"{"==t?g(W(Y,"}")):"("==t?g(W(X,")"),G):void 0}function G(t){if("=>"==t)return g(K)}function Y(t){return"variable"==t||"keyword"==_t.style?(_t.marked="property",g(Y)):":"==t?g(K):void 0}function X(t){return"variable"==t?g(X):":"==t?g(K):void 0}function J(t,e){return"<"==e?g(W(K,">"),J):"["==t?g(w("]"),J):void 0}function Z(){return p(Q,q,et,it)}function Q(t,e){return"modifier"==t?g(Q):"variable"==t?(m(e),g()):"spread"==t?g(Q):"["==t?j(Q,"]"):"{"==t?j(tt,"}"):void 0}function tt(t,e){return"variable"!=t||_t.stream.match(/^\s*:/,!1)?("variable"==t&&(_t.marked="property"),"spread"==t?g(Q):"}"==t?p():g(w(":"),Q,et)):(m(e),g(et))}function et(t,e){if("="==e)return g(S)}function it(t){if(","==t)return g(Z)}function nt(t,e){if("keyword b"==t&&"else"==e)return g(b("form","else"),C,x)}function rt(t){if("("==t)return g(b(")"),st,w(")"),x)}function st(t){return"var"==t?g(Z,w(";"),at):";"==t?g(at):"variable"==t?g(ot):p(k,w(";"),at)}function ot(t,e){return"in"==e||"of"==e?(_t.marked="keyword",g(k)):g($,at)}function at(t,e){return";"==t?g(lt):"in"==e||"of"==e?(_t.marked="keyword",g(k)):p(k,w(";"),lt)}function lt(t){")"!=t&&g(k)}function ct(t,e){return"*"==e?(_t.marked="keyword",g(ct)):"variable"==t?(m(e),g(ct)):"("==t?g(v,b(")"),W(ut,")"),x,q,C,y):void 0}function ut(t){return"spread"==t?g(ut):p(Q,q,et)}function ht(t,e){return"variable"==t?dt(t,e):ft(t,e)}function dt(t,e){if("variable"==t)return m(e),g(ft)}function ft(t,e){return"extends"==e||"implements"==e?g($t?K:k,ft):"{"==t?g(b("}"),pt,x):void 0}function pt(t,e){return"variable"==t||"keyword"==_t.style?("static"==e||"get"==e||"set"==e||$t&&("public"==e||"private"==e||"protected"==e||"readonly"==e||"abstract"==e))&&_t.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(_t.marked="keyword",g(pt)):(_t.marked="property",g($t?gt:ct,pt)):"*"==e?(_t.marked="keyword",g(pt)):";"==t?g(pt):"}"==t?g():void 0}function gt(t,e){return"?"==e?g(gt):":"==t?g(K,et):p(ct)}function mt(t,e){return"*"==e?(_t.marked="keyword",g(xt,w(";"))):"default"==e?(_t.marked="keyword",g(k,w(";"))):p(C)}function vt(t){return"string"==t?g():p(yt,xt)}function yt(t,e){return"{"==t?j(yt,"}"):("variable"==t&&m(e),"*"==e&&(_t.marked="keyword"),g(bt))}function bt(t,e){if("as"==e)return _t.marked="keyword",g(yt)}function xt(t,e){if("from"==e)return _t.marked="keyword",g(k)}function wt(t){return"]"==t?g():p(W(S,"]"))}function Ct(t,e){return"operator"==t.lastType||","==t.lastType||Nt.test(e.charAt(0))||/[,.]/.test(e.charAt(0))}var kt,St,Tt=i.indentUnit,Mt=n.statementIndent,Et=n.jsonld,Pt=n.json||Et,$t=n.typescript,Lt=n.wordCharacters||/[\w$\xa1-\uffff]/,At=function(){function t(t){return{type:t,style:"keyword"}}var e=t("keyword a"),i=t("keyword b"),n=t("keyword c"),r=t("operator"),s={type:"atom",style:"atom"},o={if:t("if"),while:e,with:e,else:i,do:i,try:i,finally:i,return:n,break:n,continue:n,new:t("new"),delete:n,throw:n,debugger:n,var:t("var"),const:t("var"),let:t("var"),function:t("function"),catch:t("catch"),for:t("for"),switch:t("switch"),case:t("case"),default:t("default"),in:r,typeof:r,instanceof:r,true:s,false:s,null:s,undefined:s,NaN:s,Infinity:s,this:t("this"),class:t("class"),super:t("atom"),yield:n,export:t("export"),import:t("import"),extends:n,await:n,async:t("async")};if($t){var a={type:"variable",style:"variable-3"},l={interface:t("class"),implements:n,namespace:n,module:t("module"),enum:t("module"),type:t("type"),public:t("modifier"),private:t("modifier"),protected:t("modifier"),abstract:t("modifier"),as:r,string:a,number:a,boolean:a,any:a};for(var c in l)o[c]=l[c]}return o}(),Nt=/[+\-*&%=<>!?|~^]/,Ot=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Dt="([{}])",It={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},_t={state:null,column:null,marked:null,cc:null},zt={name:"this",next:{name:"arguments"}};return x.lex=!0,{startState:function(t){var e={tokenize:o,lastType:"sof",cc:[],lexical:new h((t||0)-Tt,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:t||0};return n.globalVars&&"object"==typeof n.globalVars&&(e.globalVars=n.globalVars),e},token:function(t,e){if(t.sol()&&(e.lexical.hasOwnProperty("align")||(e.lexical.align=!1),e.indented=t.indentation(),u(t,e)),e.tokenize!=l&&t.eatSpace())return null;var i=e.tokenize(t,e);return"comment"==kt?i:(e.lastType="operator"!=kt||"++"!=St&&"--"!=St?kt:"incdec",f(e,i,kt,St,t))},indent:function(e,i){if(e.tokenize==l)return t.Pass;if(e.tokenize!=o)return 0;var r,s=i&&i.charAt(0),a=e.lexical;if(!/^\s*else\b/.test(i))for(var c=e.cc.length-1;c>=0;--c){var u=e.cc[c];if(u==x)a=a.prev;else if(u!=nt)break}for(;("stat"==a.type||"form"==a.type)&&("}"==s||(r=e.cc[e.cc.length-1])&&(r==$||r==L)&&!/^[,\.=+\-*:?[\(]/.test(i));)a=a.prev;Mt&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var h=a.type,d=s==h;return"vardef"==h?a.indented+("operator"==e.lastType||","==e.lastType?a.info+1:0):"form"==h&&"{"==s?a.indented:"form"==h?a.indented+Tt:"stat"==h?a.indented+(Ct(e,i)?Mt||Tt:0):"switch"!=a.info||d||0==n.doubleIndentSwitch?a.align?a.column+(d?0:1):a.indented+(d?0:Tt):a.indented+(/^(?:case|default)\b/.test(i)?Tt:2*Tt)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Pt?null:"/*",blockCommentEnd:Pt?null:"*/",lineComment:Pt?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Pt?"json":"javascript",jsonldMode:Et,jsonMode:Pt,expressionAllowed:e,skipExpression:function(t){var e=t.cc[t.cc.length-1];e!=k&&e!=S||t.cc.pop()}}}),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})},function(t,e,i){!function(t){t(i(5))}(function(t){"use strict";var e={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},i={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};t.defineMode("xml",function(n,r){function s(t,e){function i(i){return e.tokenize=i,i(t,e)}var n=t.next();if("<"==n)return t.eat("!")?t.eat("[")?t.match("CDATA[")?i(l("atom","]]>")):null:t.match("--")?i(l("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),i(c(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=l("meta","?>"),"meta"):(M=t.eat("/")?"closeTag":"openTag",e.tokenize=o,"tag bracket");if("&"==n){var r;return r=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"),r?"atom":"error"}return t.eatWhile(/[^&<]/),null}function o(t,e){var i=t.next();if(">"==i||"/"==i&&t.eat(">"))return e.tokenize=s,M=">"==i?"endTag":"selfcloseTag","tag bracket";if("="==i)return M="equals",null;if("<"==i){e.tokenize=s,e.state=f,e.tagName=e.tagStart=null;var n=e.tokenize(t,e);return n?n+" tag error":"tag error"}return/[\'\"]/.test(i)?(e.tokenize=a(i),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function a(t){var e=function(e,i){for(;!e.eol();)if(e.next()==t){i.tokenize=o;break}return"string"};return e.isInAttribute=!0,e}function l(t,e){return function(i,n){for(;!i.eol();){if(i.match(e)){n.tokenize=s;break}i.next()}return t}}function c(t){return function(e,i){for(var n;null!=(n=e.next());){if("<"==n)return i.tokenize=c(t+1),i.tokenize(e,i);if(">"==n){if(1==t){i.tokenize=s;break}return i.tokenize=c(t-1),i.tokenize(e,i)}}return"meta"}}function u(t,e,i){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=i,(k.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function h(t){t.context&&(t.context=t.context.prev)}function d(t,e){for(var i;;){if(!t.context)return;if(i=t.context.tagName,!k.contextGrabbers.hasOwnProperty(i)||!k.contextGrabbers[i].hasOwnProperty(e))return;h(t)}}function f(t,e,i){return"openTag"==t?(i.tagStart=e.column(),p):"closeTag"==t?g:f}function p(t,e,i){return"word"==t?(i.tagName=e.current(),E="tag",y):(E="error",p)}function g(t,e,i){if("word"==t){var n=e.current();return i.context&&i.context.tagName!=n&&k.implicitlyClosed.hasOwnProperty(i.context.tagName)&&h(i),i.context&&i.context.tagName==n||!1===k.matchClosing?(E="tag",m):(E="tag error",v)}return E="error",v}function m(t,e,i){return"endTag"!=t?(E="error",m):(h(i),f)}function v(t,e,i){return E="error",m(t,e,i)}function y(t,e,i){if("word"==t)return E="attribute",b;if("endTag"==t||"selfcloseTag"==t){var n=i.tagName,r=i.tagStart;return i.tagName=i.tagStart=null,"selfcloseTag"==t||k.autoSelfClosers.hasOwnProperty(n)?d(i,n):(d(i,n),i.context=new u(i,n,r==i.indented)),f}return E="error",y}function b(t,e,i){return"equals"==t?x:(k.allowMissing||(E="error"),y(t,e,i))}function x(t,e,i){return"string"==t?w:"word"==t&&k.allowUnquoted?(E="string",y):(E="error",y(t,e,i))}function w(t,e,i){return"string"==t?w:y(t,e,i)}var C=n.indentUnit,k={},S=r.htmlMode?e:i;for(var T in S)k[T]=S[T];for(var T in r)k[T]=r[T];var M,E;return s.isInText=!0,{startState:function(t){var e={tokenize:s,state:f,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;M=null;var i=e.tokenize(t,e);return(i||M)&&"comment"!=i&&(E=null,e.state=e.state(M||i,t,e),E&&(i="error"==E?i+" error":E)),i},indent:function(e,i,n){var r=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+C;if(r&&r.noIndent)return t.Pass;if(e.tokenize!=o&&e.tokenize!=s)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==k.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+C*(k.multilineTagIndentFactor||1);if(k.alignCDATA&&/<!\[CDATA\[/.test(i))return 0;var a=i&&/^<(\/)?([\w_:\.-]*)/.exec(i);if(a&&a[1])for(;r;){if(r.tagName==a[2]){r=r.prev;break}if(!k.implicitlyClosed.hasOwnProperty(r.tagName))break;r=r.prev}else if(a)for(;r;){var l=k.contextGrabbers[r.tagName];if(!l||!l.hasOwnProperty(a[2]))break;r=r.prev}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+C:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:k.htmlMode?"html":"xml",helperType:k.htmlMode?"html":"xml",skipAttribute:function(t){t.state==x&&(t.state=y)}}}),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})})},function(t,e,i){var n,r,s;!function(o){"use strict";r=[i(12)],n=o,void 0!==(s="function"==typeof n?n.apply(e,r):n)&&(t.exports=s)}(function(t,e){"use strict";function i(e,i,n,r){for(var s=[],o=0;o<e.length;o++){var a=e[o];if(a){var l=tinycolor(a),c=l.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";c+=tinycolor.equals(i,a)?" sp-thumb-active":"";var u=l.toString(r.preferredFormat||"rgb"),h=m?"background-color:"+l.toRgbString():"filter:"+l.toFilter();s.push('<span title="'+u+'" data-color="'+l.toRgbString()+'" class="'+c+'"><span class="sp-thumb-inner" style="'+h+';" /></span>')}else{s.push(t("<div />").append(t('<span data-color="" style="background-color:transparent;" class="sp-clear-display"></span>').attr("title",r.noColorSelectedText)).html())}}return"<div class='sp-cf "+n+"'>"+s.join("")+"</div>"}function n(){for(var t=0;t<p.length;t++)p[t]&&p[t].hide()}function r(e,i){var n=t.extend({},f,e);return n.callbacks={move:c(n.move,i),change:c(n.change,i),show:c(n.show,i),hide:c(n.hide,i),beforeShow:c(n.beforeShow,i)},n}function s(s,a){function c(){if(U.showPaletteOnly&&(U.showPalette=!0),zt.text(U.showPaletteOnly?U.togglePaletteMoreText:U.togglePaletteLessText),U.palette){dt=U.palette.slice(0),ft=t.isArray(dt[0])?dt:[dt],pt={};for(var e=0;e<ft.length;e++)for(var i=0;i<ft[e].length;i++){var n=tinycolor(ft[e][i]).toRgbString();pt[n]=!0}}Ct.toggleClass("sp-flat",q),Ct.toggleClass("sp-input-disabled",!U.showInput),Ct.toggleClass("sp-alpha-enabled",U.showAlpha),Ct.toggleClass("sp-clear-enabled",Yt),Ct.toggleClass("sp-buttons-disabled",!U.showButtons),Ct.toggleClass("sp-palette-buttons-disabled",!U.togglePaletteOnly),Ct.toggleClass("sp-palette-disabled",!U.showPalette),Ct.toggleClass("sp-palette-only",U.showPaletteOnly),Ct.toggleClass("sp-initial-disabled",!U.showInitial),Ct.addClass(U.className).addClass(U.containerClassName),F()}function f(){if(G&&window.localStorage){try{var e=window.localStorage[G].split(",#");e.length>1&&(delete window.localStorage[G],t.each(e,function(t,e){b(e)}))}catch(t){}try{gt=window.localStorage[G].split(";")}catch(t){}}}function b(e){if(K){var i=tinycolor(e).toRgbString();if(!pt[i]&&-1===t.inArray(i,gt))for(gt.push(i);gt.length>mt;)gt.shift();if(G&&window.localStorage)try{window.localStorage[G]=gt.join(";")}catch(t){}}}function x(){var t=[];if(U.showPalette)for(var e=0;e<gt.length;e++){var i=tinycolor(gt[e]).toRgbString();pt[i]||t.push(gt[e])}return t.reverse().slice(0,U.maxSelectionSize)}function w(){var e=O(),n=t.map(ft,function(t,n){return i(t,e,"sp-palette-row sp-palette-row-"+n,U)});f(),gt&&n.push(i(x(),e,"sp-palette-row sp-palette-row-selection",U)),Nt.html(n.join(""))}function C(){if(U.showInitial){var t=Ut,e=O();Ot.html(i([t,e],e,"sp-palette-row-initial",U))}}function k(){(et<=0||tt<=0||nt<=0)&&F(),Q=!0,Ct.addClass(vt),yt=null,xt.trigger("dragstart.spectrum",[O()])}function S(){Q=!1,Ct.removeClass(vt),xt.trigger("dragstop.spectrum",[O()])}function T(){var t=At.val();if(null!==t&&""!==t||!Yt){var e=tinycolor(t);e.isValid()?(N(e),H(!0)):At.addClass("sp-validation-error")}else N(null),H(!0)}function M(){Z?L():E()}function E(){var e=t.Event("beforeShow.spectrum");if(Z)return void F();xt.trigger(e,[O()]),!1===X.beforeShow(O())||e.isDefaultPrevented()||(n(),Z=!0,t(bt).bind("keydown.spectrum",P),t(bt).bind("click.spectrum",$),t(window).bind("resize.spectrum",J),Vt.addClass("sp-active"),Ct.removeClass("sp-hidden"),F(),_(),Ut=O(),C(),X.show(Ut),xt.trigger("show.spectrum",[Ut]))}function P(t){27===t.keyCode&&L()}function $(t){2!=t.button&&(Q||(Kt?H(!0):A(),L()))}function L(){Z&&!q&&(Z=!1,t(bt).unbind("keydown.spectrum",P),t(bt).unbind("click.spectrum",$),t(window).unbind("resize.spectrum",J),Vt.removeClass("sp-active"),Ct.addClass("sp-hidden"),X.hide(O()),xt.trigger("hide.spectrum",[O()]))}function A(){N(Ut,!0)}function N(t,e){if(tinycolor.equals(t,O()))return void _();var i,n;!t&&Yt?Gt=!0:(Gt=!1,i=tinycolor(t),n=i.toHsv(),lt=n.h%360/360,ct=n.s,ut=n.v,ht=n.a),_(),i&&i.isValid()&&!e&&(qt=U.preferredFormat||i.getFormat())}function O(t){return t=t||{},Yt&&Gt?null:tinycolor.fromRatio({h:lt,s:ct,v:ut,a:Math.round(100*ht)/100},{format:t.format||qt})}function D(){return!At.hasClass("sp-validation-error")}function I(){_(),X.move(O()),xt.trigger("move.spectrum",[O()])}function _(){At.removeClass("sp-validation-error"),z();var t=tinycolor.fromRatio({h:lt,s:1,v:1});St.css("background-color",t.toHexString());var e=qt;ht<1&&(0!==ht||"name"!==e)&&("hex"!==e&&"hex3"!==e&&"hex6"!==e&&"name"!==e||(e="rgb"));var i=O({format:e}),n="";if(Wt.removeClass("sp-clear-display"),Wt.css("background-color","transparent"),!i&&Yt)Wt.addClass("sp-clear-display");else{var r=i.toHexString(),s=i.toRgbString();if(m||1===i.alpha?Wt.css("background-color",s):(Wt.css("background-color","transparent"),Wt.css("filter",i.toFilter())),U.showAlpha){var o=i.toRgb();o.a=0;var a=tinycolor(o).toRgbString(),l="linear-gradient(left, "+a+", "+r+")";g?Pt.css("filter",tinycolor(a).toFilter({gradientType:1},r)):(Pt.css("background","-webkit-"+l),Pt.css("background","-moz-"+l),Pt.css("background","-ms-"+l),Pt.css("background","linear-gradient(to right, "+a+", "+r+")"))}n=i.toString(e)}U.showInput&&At.val(n),U.showPalette&&w(),C()}function z(){var t=ct,e=ut;if(Yt&&Gt)Lt.hide(),Et.hide(),Tt.hide();else{Lt.show(),Et.show(),Tt.show();var i=t*tt,n=et-e*et;i=Math.max(-it,Math.min(tt-it,i-it)),n=Math.max(-it,Math.min(et-it,n-it)),Tt.css({top:n+"px",left:i+"px"});var r=ht*st;Lt.css({left:r-ot/2+"px"});var s=lt*nt;Et.css({top:s-at+"px"})}}function H(t){var e=O(),i="",n=!tinycolor.equals(e,Ut);e&&(i=e.toString(qt),b(e)),Ht&&xt.val(i),t&&n&&(X.change(e),xt.trigger("change",[e]))}function F(){Z&&(tt=St.width(),et=St.height(),it=Tt.height(),rt=Mt.width(),nt=Mt.height(),at=Et.height(),st=$t.width(),ot=Lt.width(),q||(Ct.css("position","absolute"),U.offset?Ct.offset(U.offset):Ct.offset(o(Ct,Bt))),z(),U.showPalette&&w(),xt.trigger("reflow.spectrum"))}function R(){xt.show(),Bt.unbind("click.spectrum touchstart.spectrum"),Ct.remove(),Vt.remove(),p[Xt.id]=null}function V(i,n){return i===e?t.extend({},U):n===e?U[i]:(U[i]=n,"preferredFormat"===i&&(qt=U.preferredFormat),void c())}function B(){wt=!1,xt.attr("disabled",!1),Bt.removeClass("sp-disabled")}function W(){L(),wt=!0,xt.attr("disabled",!0),Bt.addClass("sp-disabled")}function j(t){U.offset=t,F()}var U=r(a,s),q=U.flat,K=U.showSelectionPalette,G=U.localStorageKey,Y=U.theme,X=U.callbacks,J=h(F,10),Z=!1,Q=!1,tt=0,et=0,it=0,nt=0,rt=0,st=0,ot=0,at=0,lt=0,ct=0,ut=0,ht=1,dt=[],ft=[],pt={},gt=U.selectionPalette.slice(0),mt=U.maxSelectionSize,vt="sp-dragging",yt=null,bt=s.ownerDocument,xt=(bt.body,t(s)),wt=!1,Ct=t(y,bt).addClass(Y),kt=Ct.find(".sp-picker-container"),St=Ct.find(".sp-color"),Tt=Ct.find(".sp-dragger"),Mt=Ct.find(".sp-hue"),Et=Ct.find(".sp-slider"),Pt=Ct.find(".sp-alpha-inner"),$t=Ct.find(".sp-alpha"),Lt=Ct.find(".sp-alpha-handle"),At=Ct.find(".sp-input"),Nt=Ct.find(".sp-palette"),Ot=Ct.find(".sp-initial"),Dt=Ct.find(".sp-cancel"),It=Ct.find(".sp-clear"),_t=Ct.find(".sp-choose"),zt=Ct.find(".sp-palette-toggle"),Ht=xt.is("input"),Ft=Ht&&"color"===xt.attr("type")&&d(),Rt=Ht&&!q,Vt=Rt?t(v).addClass(Y).addClass(U.className).addClass(U.replacerClassName):t([]),Bt=Rt?Vt:xt,Wt=Vt.find(".sp-preview-inner"),jt=U.color||Ht&&xt.val(),Ut=!1,qt=U.preferredFormat,Kt=!U.showButtons||U.clickoutFiresChange,Gt=!jt,Yt=U.allowEmpty&&!Ft;!function(){function e(e){return e.data&&e.data.ignore?(N(t(e.target).closest(".sp-thumb-el").data("color")),I()):(N(t(e.target).closest(".sp-thumb-el").data("color")),I(),H(!0),U.hideAfterPaletteSelect&&L()),!1}if(g&&Ct.find("*:not(input)").attr("unselectable","on"),c(),Rt&&xt.after(Vt).hide(),Yt||It.hide(),q)xt.after(Ct).hide();else{var i="parent"===U.appendTo?xt.parent():t(U.appendTo);1!==i.length&&(i=t("body")),i.append(Ct)}f(),Bt.bind("click.spectrum touchstart.spectrum",function(e){wt||M(),e.stopPropagation(),t(e.target).is("input")||e.preventDefault()}),(xt.is(":disabled")||!0===U.disabled)&&W(),Ct.click(l),At.change(T),At.bind("paste",function(){setTimeout(T,1)}),At.keydown(function(t){13==t.keyCode&&T()}),Dt.text(U.cancelText),Dt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),A(),L()}),It.attr("title",U.clearText),It.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Gt=!0,I(),q&&H(!0)}),_t.text(U.chooseText),_t.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),g&&At.is(":focus")&&At.trigger("change"),D()&&(H(!0),L())}),zt.text(U.showPaletteOnly?U.togglePaletteMoreText:U.togglePaletteLessText),zt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),U.showPaletteOnly=!U.showPaletteOnly,U.showPaletteOnly||q||Ct.css("left","-="+(kt.outerWidth(!0)+5)),c()}),u($t,function(t,e,i){ht=t/st,Gt=!1,i.shiftKey&&(ht=Math.round(10*ht)/10),I()},k,S),u(Mt,function(t,e){lt=parseFloat(e/nt),Gt=!1,U.showAlpha||(ht=1),I()},k,S),u(St,function(t,e,i){if(i.shiftKey){if(!yt){var n=ct*tt,r=et-ut*et,s=Math.abs(t-n)>Math.abs(e-r);yt=s?"x":"y"}}else yt=null;var o=!yt||"x"===yt,a=!yt||"y"===yt;o&&(ct=parseFloat(t/tt)),a&&(ut=parseFloat((et-e)/et)),Gt=!1,U.showAlpha||(ht=1),I()},k,S),jt?(N(jt),_(),qt=U.preferredFormat||tinycolor(jt).format,b(jt)):_(),q&&E();var n=g?"mousedown.spectrum":"click.spectrum touchstart.spectrum";Nt.delegate(".sp-thumb-el",n,e),Ot.delegate(".sp-thumb-el:nth-child(1)",n,{ignore:!0},e)}();var Xt={show:E,hide:L,toggle:M,reflow:F,option:V,enable:B,disable:W,offset:j,set:function(t){N(t),H()},get:O,destroy:R,container:Ct};return Xt.id=p.push(Xt)-1,Xt}function o(e,i){var n=e.outerWidth(),r=e.outerHeight(),s=i.outerHeight(),o=e[0].ownerDocument,a=o.documentElement,l=a.clientWidth+t(o).scrollLeft(),c=a.clientHeight+t(o).scrollTop(),u=i.offset();return u.top+=s,u.left-=Math.min(u.left,u.left+n>l&&l>n?Math.abs(u.left+n-l):0),u.top-=Math.min(u.top,u.top+r>c&&c>r?Math.abs(r+s-0):0),u}function a(){}function l(t){t.stopPropagation()}function c(t,e){var i=Array.prototype.slice,n=i.call(arguments,2);return function(){return t.apply(e,n.concat(i.call(arguments)))}}function u(e,i,n,r){function s(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function o(t){if(u){if(g&&c.documentMode<9&&!t.button)return l();var n=t.originalEvent&&t.originalEvent.touches&&t.originalEvent.touches[0],r=n&&n.pageX||t.pageX,o=n&&n.pageY||t.pageY,a=Math.max(0,Math.min(r-h.left,f)),m=Math.max(0,Math.min(o-h.top,d));p&&s(t),i.apply(e,[a,m,t])}}function a(i){(i.which?3==i.which:2==i.button)||u||!1!==n.apply(e,arguments)&&(u=!0,d=t(e).height(),f=t(e).width(),h=t(e).offset(),t(c).bind(m),t(c.body).addClass("sp-dragging"),o(i),s(i))}function l(){u&&(t(c).unbind(m),t(c.body).removeClass("sp-dragging"),setTimeout(function(){r.apply(e,arguments)},0)),u=!1}i=i||function(){},n=n||function(){},r=r||function(){};var c=document,u=!1,h={},d=0,f=0,p="ontouchstart"in window,m={};m.selectstart=s,m.dragstart=s,m["touchmove mousemove"]=o,m["touchend mouseup"]=l,t(e).bind("touchstart mousedown",a)}function h(t,e,i){var n;return function(){var r=this,s=arguments,o=function(){n=null,t.apply(r,s)};i&&clearTimeout(n),!i&&n||(n=setTimeout(o,e))}}function d(){return t.fn.spectrum.inputTypeColorSupport()}var f={beforeShow:a,move:a,change:a,show:a,hide:a,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},p=[],g=!!/msie/i.exec(window.navigator.userAgent),m=function(){function t(t,e){return!!~(""+t).indexOf(e)}var e=document.createElement("div"),i=e.style;return i.cssText="background-color:rgba(0,0,0,.5)",t(i.backgroundColor,"rgba")||t(i.backgroundColor,"hsla")}(),v=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>▼</div>","</div>"].join(""),y=function(){var t="";if(g)for(var e=1;e<=6;e++)t+="<div class='sp-"+e+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",t,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}();t.fn.spectrum=function(e,i){if("string"==typeof e){var n=this,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var i=p[t(this).data("spectrum.id")];if(i){var s=i[e];if(!s)throw new Error("Spectrum: no such method: '"+e+"'");"get"==e?n=i.get():"container"==e?n=i.container:"option"==e?n=i.option.apply(i,r):"destroy"==e?(i.destroy(),t(this).removeData("spectrum.id")):s.apply(i,r)}}),n}return this.spectrum("destroy").each(function(){var i=t.extend({},e,t(this).data()),n=s(this,i);t(this).data("spectrum.id",n.id)})},t.fn.spectrum.load=!0,t.fn.spectrum.loadOpts={},t.fn.spectrum.draggable=u,t.fn.spectrum.defaults=f,t.fn.spectrum.inputTypeColorSupport=function e(){if(void 0===e._cachedResult){var i=t("<input type='color'/>")[0];e._cachedResult="color"===i.type&&""!==i.value}return e._cachedResult},t.spectrum={},t.spectrum.localization={},t.spectrum.palettes={},t.fn.spectrum.processNativeColorInputs=function(){var e=t("input[type=color]");e.length&&!d()&&e.spectrum({preferredFormat:"hex6"})},function(){function t(t){var i={r:0,g:0,b:0},r=1,o=!1,a=!1;return"string"==typeof t&&(t=A(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(i=e(t.r,t.g,t.b),o=!0,a="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=P(t.s),t.v=P(t.v),i=s(t.h,t.s,t.v),o=!0,a="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=P(t.s),t.l=P(t.l),i=n(t.h,t.s,t.l),o=!0,a="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=w(r),{ok:o,format:t.format||a,r:z(255,H(i.r,0)),g:z(255,H(i.g,0)),b:z(255,H(i.b,0)),a:r}}function e(t,e,i){return{r:255*C(t,255),g:255*C(e,255),b:255*C(i,255)}}function i(t,e,i){t=C(t,255),e=C(e,255),i=C(i,255);var n,r,s=H(t,e,i),o=z(t,e,i),a=(s+o)/2;if(s==o)n=r=0;else{var l=s-o;switch(r=a>.5?l/(2-s-o):l/(s+o),s){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,l:a}}function n(t,e,i){function n(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}var r,s,o;if(t=C(t,360),e=C(e,100),i=C(i,100),0===e)r=s=o=i;else{var a=i<.5?i*(1+e):i+e-i*e,l=2*i-a;r=n(l,a,t+1/3),s=n(l,a,t),o=n(l,a,t-1/3)}return{r:255*r,g:255*s,b:255*o}}function r(t,e,i){t=C(t,255),e=C(e,255),i=C(i,255);var n,r,s=H(t,e,i),o=z(t,e,i),a=s,l=s-o;if(r=0===s?0:l/s,s==o)n=0;else{switch(s){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,v:a}}function s(t,e,i){t=6*C(t,360),e=C(e,100),i=C(i,100);var n=I.floor(t),r=t-n,s=i*(1-e),o=i*(1-r*e),a=i*(1-(1-r)*e),l=n%6;return{r:255*[i,o,s,s,a,i][l],g:255*[a,i,i,o,s,s][l],b:255*[s,s,a,i,i,o][l]}}function o(t,e,i,n){var r=[E(_(t).toString(16)),E(_(e).toString(16)),E(_(i).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function a(t,e,i,n){return[E($(n)),E(_(t).toString(16)),E(_(e).toString(16)),E(_(i).toString(16))].join("")}function l(t,e){e=0===e?0:e||10;var i=R(t).toHsl();return i.s-=e/100,i.s=k(i.s),R(i)}function c(t,e){e=0===e?0:e||10;var i=R(t).toHsl();return i.s+=e/100,i.s=k(i.s),R(i)}function u(t){return R(t).desaturate(100)}function h(t,e){e=0===e?0:e||10;var i=R(t).toHsl();return i.l+=e/100,i.l=k(i.l),R(i)}function d(t,e){e=0===e?0:e||10;var i=R(t).toRgb();return i.r=H(0,z(255,i.r-_(-e/100*255))),i.g=H(0,z(255,i.g-_(-e/100*255))),i.b=H(0,z(255,i.b-_(-e/100*255))),R(i)}function f(t,e){e=0===e?0:e||10;var i=R(t).toHsl();return i.l-=e/100,i.l=k(i.l),R(i)}function p(t,e){var i=R(t).toHsl(),n=(_(i.h)+e)%360;return i.h=n<0?360+n:n,R(i)}function g(t){var e=R(t).toHsl();return e.h=(e.h+180)%360,R(e)}function m(t){var e=R(t).toHsl(),i=e.h;return[R(t),R({h:(i+120)%360,s:e.s,l:e.l}),R({h:(i+240)%360,s:e.s,l:e.l})]}function v(t){var e=R(t).toHsl(),i=e.h;return[R(t),R({h:(i+90)%360,s:e.s,l:e.l}),R({h:(i+180)%360,s:e.s,l:e.l}),R({h:(i+270)%360,s:e.s,l:e.l})]}function y(t){var e=R(t).toHsl(),i=e.h;return[R(t),R({h:(i+72)%360,s:e.s,l:e.l}),R({h:(i+216)%360,s:e.s,l:e.l})]}function b(t,e,i){e=e||6,i=i||30;var n=R(t).toHsl(),r=360/i,s=[R(t)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(R(n));return s}function x(t,e){e=e||6;for(var i=R(t).toHsv(),n=i.h,r=i.s,s=i.v,o=[],a=1/e;e--;)o.push(R({h:n,s:r,v:s})),s=(s+a)%1;return o}function w(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,e){T(t)&&(t="100%");var i=M(t);return t=z(e,H(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),I.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function k(t){return z(1,H(0,t))}function S(t){return parseInt(t,16)}function T(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function M(t){return"string"==typeof t&&-1!=t.indexOf("%")}function E(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function $(t){return Math.round(255*parseFloat(t)).toString(16)}function L(t){return S(t)/255}function A(t){t=t.replace(N,"").replace(O,"").toLowerCase();var e=!1;if(V[t])t=V[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=W.rgb.exec(t))?{r:i[1],g:i[2],b:i[3]}:(i=W.rgba.exec(t))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=W.hsl.exec(t))?{h:i[1],s:i[2],l:i[3]}:(i=W.hsla.exec(t))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=W.hsv.exec(t))?{h:i[1],s:i[2],v:i[3]}:(i=W.hsva.exec(t))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=W.hex8.exec(t))?{a:L(i[1]),r:S(i[2]),g:S(i[3]),b:S(i[4]),format:e?"name":"hex8"}:(i=W.hex6.exec(t))?{r:S(i[1]),g:S(i[2]),b:S(i[3]),format:e?"name":"hex"}:!!(i=W.hex3.exec(t))&&{r:S(i[1]+""+i[1]),g:S(i[2]+""+i[2]),b:S(i[3]+""+i[3]),format:e?"name":"hex"}}var N=/^[\s,#]+/,O=/\s+$/,D=0,I=Math,_=I.round,z=I.min,H=I.max,F=I.random,R=function(e,i){if(e=e||"",i=i||{},e instanceof R)return e;if(!(this instanceof R))return new R(e,i);var n=t(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=_(100*this._a)/100,this._format=i.format||n.format,this._gradientType=i.gradientType,this._r<1&&(this._r=_(this._r)),this._g<1&&(this._g=_(this._g)),this._b<1&&(this._b=_(this._b)),this._ok=n.ok,this._tc_id=D++};R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},setAlpha:function(t){return this._a=w(t),this._roundA=_(100*this._a)/100,this},toHsv:function(){var t=r(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=r(this._r,this._g,this._b),e=_(360*t.h),i=_(100*t.s),n=_(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=_(360*t.h),n=_(100*t.s),r=_(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return o(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return a(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:_(this._r),g:_(this._g),b:_(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+_(this._r)+", "+_(this._g)+", "+_(this._b)+")":"rgba("+_(this._r)+", "+_(this._g)+", "+_(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:_(100*C(this._r,255))+"%",g:_(100*C(this._g,255))+"%",b:_(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+_(100*C(this._r,255))+"%, "+_(100*C(this._g,255))+"%, "+_(100*C(this._b,255))+"%)":"rgba("+_(100*C(this._r,255))+"%, "+_(100*C(this._g,255))+"%, "+_(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(B[o(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+a(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){i=R(t).toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(h,arguments)},brighten:function(){return this._applyModification(d,arguments)},darken:function(){return this._applyModification(f,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(c,arguments)},greyscale:function(){return this._applyModification(u,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(b,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(m,arguments)},tetrad:function(){return this._applyCombination(v,arguments)}},R.fromRatio=function(t,e){if("object"==typeof t){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]="a"===n?t[n]:P(t[n]));t=i}return R(t,e)},R.equals=function(t,e){return!(!t||!e)&&R(t).toRgbString()==R(e).toRgbString()},R.random=function(){return R.fromRatio({r:F(),g:F(),b:F()})},R.mix=function(t,e,i){i=0===i?0:i||50;var n,r=R(t).toRgb(),s=R(e).toRgb(),o=i/100,a=2*o-1,l=s.a-r.a;n=a*l==-1?a:(a+l)/(1+a*l),n=(n+1)/2;var c=1-n,u={r:s.r*n+r.r*c,g:s.g*n+r.g*c,b:s.b*n+r.b*c,a:s.a*o+r.a*(1-o)};return R(u)},R.readability=function(t,e){var i=R(t),n=R(e),r=i.toRgb(),s=n.toRgb(),o=i.getBrightness(),a=n.getBrightness(),l=Math.max(r.r,s.r)-Math.min(r.r,s.r)+Math.max(r.g,s.g)-Math.min(r.g,s.g)+Math.max(r.b,s.b)-Math.min(r.b,s.b);return{brightness:Math.abs(o-a),color:l}},R.isReadable=function(t,e){var i=R.readability(t,e);return i.brightness>125&&i.color>500},R.mostReadable=function(t,e){for(var i=null,n=0,r=!1,s=0;s<e.length;s++){var o=R.readability(t,e[s]),a=o.brightness>125&&o.color>500,l=o.brightness/125*3+o.color/500;(a&&!r||a&&r&&l>n||!a&&!r&&l>n)&&(r=a,n=l,i=R(e[s]))}return i};var V=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},B=R.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(V),W=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+i),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();window.tinycolor=R}(),t(function(){t.fn.spectrum.load&&t.fn.spectrum.processNativeColorInputs()})})}])});
|