"],_default:[0,"",""]};function getAll(context,tag){var ret=void 0!==context.getElementsByTagName?context.getElementsByTagName(tag||"*"):void 0!==context.querySelectorAll?context.querySelectorAll(tag||"*"):[];return void 0===tag||tag&&jQuery.nodeName(context,tag)?jQuery.merge([context],ret):ret}function setGlobalEval(elems,refElements){for(var i=0,l=elems.length;i-1)ignored&&ignored.push(elem);else if(contains=jQuery.contains(elem.ownerDocument,elem),tmp=getAll(fragment.appendChild(elem),"script"),contains&&setGlobalEval(tmp),scripts)for(j=0;elem=tmp[j++];)rscriptType.test(elem.type||"")&&scripts.push(elem);return fragment}div=document.createDocumentFragment().appendChild(document.createElement("div")),(input=document.createElement("input")).setAttribute("type","radio"),input.setAttribute("checked","checked"),input.setAttribute("name","t"),div.appendChild(input),support.checkClone=div.cloneNode(!0).cloneNode(!0).lastChild.checked,div.innerHTML="",support.noCloneChecked=!!div.cloneNode(!0).lastChild.defaultValue;var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return!0}function returnFalse(){return!1}function safeActiveElement(){try{return document.activeElement}catch(err){}}function on(elem,types,selector,data,fn,one){var origFn,type;if("object"==typeof types){for(type in"string"!=typeof selector&&(data=data||selector,selector=void 0),types)on(elem,type,selector,data,types[type],one);return elem}if(null==data&&null==fn?(fn=selector,data=selector=void 0):null==fn&&("string"==typeof selector?(fn=data,data=void 0):(fn=data,data=selector,selector=void 0)),!1===fn)fn=returnFalse;else if(!fn)return elem;return 1===one&&(origFn=fn,(fn=function(event){return jQuery().off(event),origFn.apply(this,arguments)}).guid=origFn.guid||(origFn.guid=jQuery.guid++)),elem.each(function(){jQuery.event.add(this,types,fn,data,selector)})}jQuery.event={global:{},add:function(elem,types,handler,data,selector){var handleObjIn,eventHandle,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.get(elem);if(elemData)for(handler.handler&&(handler=(handleObjIn=handler).handler,selector=handleObjIn.selector),handler.guid||(handler.guid=jQuery.guid++),(events=elemData.events)||(events=elemData.events={}),(eventHandle=elemData.handle)||(eventHandle=elemData.handle=function(e){return void 0!==jQuery&&jQuery.event.triggered!==e.type?jQuery.event.dispatch.apply(elem,arguments):void 0}),t=(types=(types||"").match(rnotwhite)||[""]).length;t--;)type=origType=(tmp=rtypenamespace.exec(types[t])||[])[1],namespaces=(tmp[2]||"").split(".").sort(),type&&(special=jQuery.event.special[type]||{},type=(selector?special.delegateType:special.bindType)||type,special=jQuery.event.special[type]||{},handleObj=jQuery.extend({type,origType,data,handler,guid:handler.guid,selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn),(handlers=events[type])||((handlers=events[type]=[]).delegateCount=0,special.setup&&!1!==special.setup.call(elem,data,namespaces,eventHandle)||elem.addEventListener&&elem.addEventListener(type,eventHandle)),special.add&&(special.add.call(elem,handleObj),handleObj.handler.guid||(handleObj.handler.guid=handler.guid)),selector?handlers.splice(handlers.delegateCount++,0,handleObj):handlers.push(handleObj),jQuery.event.global[type]=!0)},remove:function(elem,types,handler,selector,mappedTypes){var j,origCount,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.hasData(elem)&&dataPriv.get(elem);if(elemData&&(events=elemData.events)){for(t=(types=(types||"").match(rnotwhite)||[""]).length;t--;)if(type=origType=(tmp=rtypenamespace.exec(types[t])||[])[1],namespaces=(tmp[2]||"").split(".").sort(),type){for(special=jQuery.event.special[type]||{},handlers=events[type=(selector?special.delegateType:special.bindType)||type]||[],tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"),origCount=j=handlers.length;j--;)handleObj=handlers[j],!mappedTypes&&origType!==handleObj.origType||handler&&handler.guid!==handleObj.guid||tmp&&!tmp.test(handleObj.namespace)||selector&&selector!==handleObj.selector&&("**"!==selector||!handleObj.selector)||(handlers.splice(j,1),handleObj.selector&&handlers.delegateCount--,special.remove&&special.remove.call(elem,handleObj));origCount&&!handlers.length&&(special.teardown&&!1!==special.teardown.call(elem,namespaces,elemData.handle)||jQuery.removeEvent(elem,type,elemData.handle),delete events[type])}else for(type in events)jQuery.event.remove(elem,type+types[t],handler,selector,!0);jQuery.isEmptyObject(events)&&dataPriv.remove(elem,"handle events")}},dispatch:function(event){event=jQuery.event.fix(event);var i,j,ret,matched,handleObj,handlerQueue,args=slice.call(arguments),handlers=(dataPriv.get(this,"events")||{})[event.type]||[],special=jQuery.event.special[event.type]||{};if(args[0]=event,event.delegateTarget=this,!special.preDispatch||!1!==special.preDispatch.call(this,event)){for(handlerQueue=jQuery.event.handlers.call(this,event,handlers),i=0;(matched=handlerQueue[i++])&&!event.isPropagationStopped();)for(event.currentTarget=matched.elem,j=0;(handleObj=matched.handlers[j++])&&!event.isImmediatePropagationStopped();)event.rnamespace&&!event.rnamespace.test(handleObj.namespace)||(event.handleObj=handleObj,event.data=handleObj.data,void 0!==(ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args))&&!1===(event.result=ret)&&(event.preventDefault(),event.stopPropagation()));return special.postDispatch&&special.postDispatch.call(this,event),event.result}},handlers:function(event,handlers){var i,matches,sel,handleObj,handlerQueue=[],delegateCount=handlers.delegateCount,cur=event.target;if(delegateCount&&cur.nodeType&&("click"!==event.type||isNaN(event.button)||event.button<1))for(;cur!==this;cur=cur.parentNode||this)if(1===cur.nodeType&&(!0!==cur.disabled||"click"!==event.type)){for(matches=[],i=0;i-1:jQuery.find(sel,this,null,[cur]).length),matches[sel]&&matches.push(handleObj);matches.length&&handlerQueue.push({elem:cur,handlers:matches})}return delegateCount]*)\/>/gi,rnoInnerhtml=/' : '')\r\n },\r\n getCss: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = this.config,\r\n n = e.wrappesIsBody,\r\n i = t.avoidProtected,\r\n o = (0, r.isUndefined)(t.keepUnusedStyles) ? e.keepUnusedStyles : t.keepUnusedStyles,\r\n s = this.get('CssComposer'),\r\n a = this.get('DomComponents').getComponent()\r\n return (\r\n (i ? '' : e.protectedCss) +\r\n this.get('CodeManager').getCode(a, 'css', { cssc: s, wrappesIsBody: n, keepUnusedStyles: o })\r\n )\r\n },\r\n getJs: function () {\r\n var t = this.get('DomComponents').getWrapper()\r\n return this.get('CodeManager')\r\n .getCode(t, 'js')\r\n .trim()\r\n },\r\n store: function (t) {\r\n var e = this,\r\n n = this.get('StorageManager'),\r\n i = {}\r\n if (n)\r\n return (\r\n this.get('storables').forEach(function (t) {\r\n var e = t.store(1)\r\n for (var n in e) i[n] = e[n]\r\n }),\r\n n.store(i, function (n) {\r\n t && t(n), e.set('changesCount', 0), e.trigger('storage:store', i)\r\n }),\r\n i\r\n )\r\n },\r\n load: function () {\r\n var t = this,\r\n e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null\r\n this.getCacheLoad(1, function (n) {\r\n t.get('storables').forEach(function (t) {\r\n return t.load(n)\r\n }),\r\n e && e(n)\r\n })\r\n },\r\n getCacheLoad: function (t, e) {\r\n var n = this,\r\n i = t ? 1 : 0\r\n if (this.cacheLoad && !i) return this.cacheLoad\r\n var r = this.get('StorageManager'),\r\n o = []\r\n if (!r) return {}\r\n this.get('storables').forEach(function (t) {\r\n var e = t.storageKey\r\n ;((e = 'function' == typeof e ? e() : e) instanceof Array ? e : [e]).forEach(function (t) {\r\n o.push(t)\r\n })\r\n }),\r\n r.load(o, function (t) {\r\n ;(n.cacheLoad = t),\r\n e && e(t),\r\n setTimeout(function () {\r\n return n.trigger('storage:load', t)\r\n }, 0)\r\n })\r\n },\r\n getDeviceModel: function () {\r\n var t = this.get('device')\r\n return this.get('DeviceManager').get(t)\r\n },\r\n runDefault: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = this.get('Commands').get(this.config.defaultCommand)\r\n e && !this.defaultRunning && (e.stop(this, this, t), e.run(this, this, t), (this.defaultRunning = 1))\r\n },\r\n stopDefault: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = this.get('Commands').get(this.config.defaultCommand)\r\n e && (e.stop(this, this, t), (this.defaultRunning = 0))\r\n },\r\n refreshCanvas: function () {\r\n this.set('canvasOffset', this.get('Canvas').getOffset())\r\n },\r\n clearSelection: function (t) {\r\n ;(t || window).getSelection().removeAllRanges()\r\n },\r\n getCurrentMedia: function () {\r\n var t = this.config,\r\n e = this.getDeviceModel(),\r\n n = t.mediaCondition,\r\n i = t.devicePreviewMode,\r\n r = e && e.get('widthMedia')\r\n return e && r && !i ? '(' + n + ': ' + r + ')' : ''\r\n },\r\n getWrapper: function () {\r\n return this.get('DomComponents').getWrapper()\r\n },\r\n getDirtyCount: function () {\r\n return this.get('changesCount')\r\n },\r\n destroyAll: function () {\r\n var t = this.attributes,\r\n e = t.DomComponents,\r\n n = t.CssComposer,\r\n i = t.UndoManager,\r\n r = t.Panels,\r\n o = t.Canvas,\r\n s = t.Keymaps\r\n e.clear(),\r\n n.clear(),\r\n i.clear().removeAll(),\r\n r.getPanels().reset(),\r\n o.getCanvasView().remove(),\r\n s.removeAll(),\r\n this.view.remove(),\r\n this.stopListening(),\r\n u(this.config.el)\r\n .empty()\r\n .attr(this.attrsOrig)\r\n },\r\n setEditing: function (t) {\r\n return this.set('editing', t), this\r\n },\r\n isEditing: function () {\r\n return !!this.get('editing')\r\n },\r\n log: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = e.ns,\r\n i = e.level,\r\n r = void 0 === i ? 'debug' : i\r\n if ((this.trigger('log', t, e), r && this.trigger('log:' + r, t, e), n)) {\r\n var o = 'log-' + n\r\n this.trigger(o, t, e), r && this.trigger(o + ':' + r, t, e)\r\n }\r\n },\r\n logInfo: function (t, e) {\r\n this.log(t, i({}, e, { level: 'info' }))\r\n },\r\n logWarning: function (t, e) {\r\n this.log(t, i({}, e, { level: 'warning' }))\r\n },\r\n logError: function (t, e) {\r\n this.log(t, i({}, e, { level: 'error' }))\r\n },\r\n data: function (t, e, n) {\r\n if ((t['_gjs-data'] || (t['_gjs-data'] = {}), (0, r.isUndefined)(n))) return t['_gjs-data'][e]\r\n t['_gjs-data'][e] = n\r\n }\r\n })\r\n },\r\n function (t, e) {\r\n t.exports = function (t) {\r\n return (\r\n t.webpackPolyfill ||\r\n ((t.deprecate = function () {}),\r\n (t.paths = []),\r\n t.children || (t.children = []),\r\n Object.defineProperty(t, 'loaded', {\r\n enumerable: !0,\r\n get: function () {\r\n return t.l\r\n }\r\n }),\r\n Object.defineProperty(t, 'id', {\r\n enumerable: !0,\r\n get: function () {\r\n return t.i\r\n }\r\n }),\r\n (t.webpackPolyfill = 1)),\r\n t\r\n )\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = function () {\r\n return {\r\n name: 'Utils',\r\n init: function () {\r\n return this\r\n },\r\n Sorter: n(93),\r\n Resizer: n(94),\r\n Dragger: n(95)\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n ;(function (e) {\r\n var i,\r\n r =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n o = n(0),\r\n s = (i = o) && i.__esModule ? i : { default: i },\r\n a = n(1),\r\n l = n(2)\r\n var c = s.default.$\r\n t.exports = s.default.View.extend({\r\n initialize: function (t) {\r\n ;(this.opt = t || {}),\r\n e.bindAll(this, 'startSort', 'onMove', 'endMove', 'rollback', 'udpateOffset', 'moveDragHelper')\r\n var n = t || {}\r\n ;(this.elT = 0), (this.elL = 0), (this.borderOffset = n.borderOffset || 10)\r\n var i = n.container\r\n ;(this.el = 'string' == typeof i ? document.querySelector(i) : i),\r\n (this.$el = c(this.el)),\r\n (this.containerSel = n.containerSel || 'div'),\r\n (this.itemSel = n.itemSel || 'div'),\r\n (this.draggable = n.draggable || !0),\r\n (this.nested = n.nested || 0),\r\n (this.pfx = n.pfx || ''),\r\n (this.ppfx = n.ppfx || ''),\r\n (this.freezeClass = n.freezeClass || this.pfx + 'freezed'),\r\n (this.onStart = n.onStart || ''),\r\n (this.onEndMove = n.onEndMove || ''),\r\n (this.direction = n.direction || 'v'),\r\n (this.onMoveClb = n.onMove || ''),\r\n (this.relative = n.relative || 0),\r\n (this.ignoreViewChildren = n.ignoreViewChildren || 0),\r\n (this.ignoreModels = n.ignoreModels || 0),\r\n (this.plh = n.placer || ''),\r\n (this.wmargin = n.wmargin || 0),\r\n (this.offTop = n.offsetTop || 0),\r\n (this.offLeft = n.offsetLeft || 0),\r\n (this.document = n.document || document),\r\n (this.$document = c(this.document)),\r\n (this.dropContent = null),\r\n (this.em = n.em || ''),\r\n (this.dragHelper = null),\r\n (this.canvasRelative = n.canvasRelative || 0),\r\n (this.selectOnEnd = !n.avoidSelectOnEnd),\r\n this.em && this.em.on && (this.em.on('change:canvasOffset', this.udpateOffset), this.udpateOffset())\r\n },\r\n getContainerEl: function () {\r\n if (!this.el) {\r\n var t = this.opt.container\r\n ;(this.el = 'string' == typeof t ? document.querySelector(t) : t), (this.$el = c(this.el))\r\n }\r\n return this.el\r\n },\r\n getDocuments: function () {\r\n var t = this.em,\r\n e = t && t.get('Canvas').getBody().ownerDocument,\r\n n = [document]\r\n return e && n.push(e), n\r\n },\r\n udpateOffset: function () {\r\n var t = this.em.get('canvasOffset')\r\n ;(this.offTop = t.top), (this.offLeft = t.left)\r\n },\r\n setDropContent: function (t) {\r\n this.dropContent = t\r\n },\r\n toggleSortCursor: function (t) {\r\n var e = this.em\r\n document.body, this.ppfx || this.pfx, e && e.get('Canvas').getBody()\r\n t ? e && e.get('Canvas').startAutoscroll() : e && e.get('Canvas').stopAutoscroll()\r\n },\r\n setDragHelper: function (t, e) {\r\n for (\r\n var n = e || '',\r\n i = t.cloneNode(1),\r\n r = t.getBoundingClientRect(),\r\n o = getComputedStyle(t),\r\n s = '',\r\n a = 0;\r\n a < o.length;\r\n a++\r\n ) {\r\n var l = o[a]\r\n s += l + ':' + o.getPropertyValue(l) + ';'\r\n }\r\n document.body.appendChild(i),\r\n (i.className += ' ' + this.pfx + 'bdrag'),\r\n i.setAttribute('style', s),\r\n (this.dragHelper = i),\r\n (i.style.width = r.width + 'px'),\r\n (i.style.height = r.height + 'px'),\r\n n && this.moveDragHelper(n),\r\n this.em &&\r\n c(this.em.get('Canvas').getBody().ownerDocument)\r\n .off('mousemove', this.moveDragHelper)\r\n .on('mousemove', this.moveDragHelper),\r\n c(document)\r\n .off('mousemove', this.moveDragHelper)\r\n .on('mousemove', this.moveDragHelper)\r\n },\r\n moveDragHelper: function (t) {\r\n var e = t.target.ownerDocument\r\n if (this.dragHelper && e) {\r\n var n = t.pageY,\r\n i = t.pageX,\r\n r = 0,\r\n o = 0,\r\n s = (e.defaultView || e.parentWindow).frameElement,\r\n a = this.dragHelper.style\r\n if (s) {\r\n var l = s.getBoundingClientRect()\r\n ;(r = l.top + document.documentElement.scrollTop),\r\n (o = l.left + document.documentElement.scrollLeft),\r\n (n = t.clientY),\r\n (i = t.clientX)\r\n }\r\n ;(a.top = n + r + 'px'), (a.left = i + o + 'px')\r\n }\r\n },\r\n matches: function (t, e, n) {\r\n return l.matches.call(t, e)\r\n },\r\n closest: function (t, e) {\r\n if (t) {\r\n for (var n = t.parentNode; n && 1 === n.nodeType; ) {\r\n if (this.matches(n, e)) return n\r\n n = n.parentNode\r\n }\r\n return null\r\n }\r\n },\r\n offset: function (t) {\r\n var e = t.getBoundingClientRect()\r\n return { top: e.top + document.body.scrollTop, left: e.left + document.body.scrollLeft }\r\n },\r\n createPlaceholder: function () {\r\n var t = this.pfx,\r\n e = document.createElement('div'),\r\n n = document.createElement('div')\r\n return (\r\n (e.className = t + 'placeholder'),\r\n (e.style.display = 'none'),\r\n (e.style['pointer-events'] = 'none'),\r\n (n.className = t + 'placeholder-int'),\r\n e.appendChild(n),\r\n e\r\n )\r\n },\r\n startSort: function (t) {\r\n var e = this.em,\r\n n = this.itemSel,\r\n i = this.containerSel,\r\n r = this.getContainerEl(),\r\n o = this.getDocuments(),\r\n s = this.onStart,\r\n a = void 0,\r\n c = this.plh\r\n ;(this.dropModel = null),\r\n (this.moved = 0),\r\n t && !this.matches(t, n + ', ' + i) && (t = this.closest(t, n)),\r\n (this.eV = t),\r\n c || ((c = this.createPlaceholder()), r.appendChild(c), (this.plh = c)),\r\n t && (a = this.getSourceModel(t)) && a.set && a.set('status', 'freezed'),\r\n (0, l.on)(r, 'mousemove dragover', this.onMove),\r\n (0, l.on)(o, 'mouseup dragend touchend', this.endMove),\r\n (0, l.on)(o, 'keydown', this.rollback),\r\n s && s(),\r\n e && e.clearSelection(),\r\n this.toggleSortCursor(1),\r\n e && e.trigger('sorter:drag:start', t, a)\r\n },\r\n getTargetModel: function (t) {\r\n var e = t || this.target\r\n return c(e).data('model')\r\n },\r\n getSourceModel: function (t) {\r\n var e = t || this.eV,\r\n n = this.dropContent,\r\n i = this.dropModel,\r\n r = this.em\r\n if (n && r) {\r\n if (!i) {\r\n var o = r.get('DomComponents').getComponents(),\r\n s = { avoidStore: 1, avoidChildren: 1, avoidUpdateStyle: 1, temporary: 1 },\r\n a = o.add(n, s)\r\n ;(i = o.remove(a, s)), (this.dropModel = i instanceof Array ? i[0] : i)\r\n }\r\n return i\r\n }\r\n if (e) return c(e).data('model')\r\n },\r\n selectTargetModel: function (t) {\r\n if (!(t instanceof s.default.Collection)) {\r\n var e = this.targetModel\r\n e && e.set('status', ''), t && t.set && (t.set('status', 'selected-parent'), (this.targetModel = t))\r\n }\r\n },\r\n onMove: function (t) {\r\n var e = this.em\r\n this.moved = 1\r\n var n = this.plh,\r\n i = n.style.display\r\n ;(i && 'none' !== i) || (n.style.display = 'block')\r\n var r = this.offset(this.el)\r\n ;(this.elT = this.wmargin ? Math.abs(r.top) : r.top), (this.elL = this.wmargin ? Math.abs(r.left) : r.left)\r\n var o = t.pageY - this.elT + this.el.scrollTop,\r\n s = t.pageX - this.elL + this.el.scrollLeft\r\n if (this.canvasRelative && e) {\r\n var a = e.get('Canvas').getMouseRelativeCanvas(t)\r\n ;(s = a.x), (o = a.y)\r\n }\r\n ;(this.rX = s), (this.rY = o), (this.eventMove = t)\r\n var l = this.dimsFromTarget(t.target, s, o),\r\n u = this.target,\r\n h = this.getTargetModel(u)\r\n this.selectTargetModel(h), h || (n.style.display = 'none'), (this.lastDims = l)\r\n var d = this.findPosition(l, s, o)\r\n ;(this.lastPos && this.lastPos.index == d.index && this.lastPos.method == d.method) ||\r\n (this.movePlaceholder(this.plh, l, d, this.prevTargetDim),\r\n this.$plh || (this.$plh = c(this.plh)),\r\n this.canvasRelative ||\r\n (this.offTop && this.$plh.css('top', '+=' + this.offTop + 'px'),\r\n this.offLeft && this.$plh.css('left', '+=' + this.offLeft + 'px')),\r\n (this.lastPos = d)),\r\n 'function' == typeof this.onMoveClb && this.onMoveClb(t),\r\n e && e.trigger('sorter:drag', { target: u, targetModel: h, dims: l, pos: d, x: s, y: o })\r\n },\r\n isInFlow: function (t, e) {\r\n if (!t) return !1\r\n e = e || document.body\r\n var n = t\r\n return n.offsetHeight, !!this.styleInFlow(n, e)\r\n },\r\n styleInFlow: function (t, e) {\r\n var n = t.style,\r\n i = c(t),\r\n r = e && c(e)\r\n if (\r\n !(\r\n (n.overflow && 'visible' !== n.overflow) ||\r\n 'none' !== i.css('float') ||\r\n (r && 'flex' == r.css('display') && 'column' !== r.css('flex-direction'))\r\n )\r\n ) {\r\n switch (n.position) {\r\n case 'static':\r\n case 'relative':\r\n case '':\r\n break\r\n default:\r\n return\r\n }\r\n switch (t.tagName) {\r\n case 'TR':\r\n case 'TBODY':\r\n case 'THEAD':\r\n case 'TFOOT':\r\n return !0\r\n }\r\n switch (i.css('display')) {\r\n case 'block':\r\n case 'list-item':\r\n case 'table':\r\n case 'flex':\r\n return !0\r\n }\r\n }\r\n },\r\n validTarget: function (t, e) {\r\n var n = this.getSourceModel(e)\r\n e = n && n.view && n.view.el\r\n var i = this.getTargetModel(t),\r\n r = { valid: !0, src: e, srcModel: n, trg: (t = i && i.view && i.view.el), trgModel: i }\r\n if (!e || !t) return (r.valid = !1), r\r\n var o = i.get('droppable')\r\n ;(o = (o = o instanceof s.default.Collection ? 1 : o) instanceof Array ? o.join(', ') : o),\r\n (r.dropInfo = o),\r\n (o = (0, a.isString)(o) ? this.matches(e, o) : o),\r\n (r.droppable = o)\r\n var l = n.get('draggable')\r\n return (\r\n (l = l instanceof Array ? l.join(', ') : l),\r\n (r.dragInfo = l),\r\n (l = (0, a.isString)(l) ? this.matches(t, l) : l),\r\n (r.draggable = l),\r\n (o && l) || (r.valid = !1),\r\n r\r\n )\r\n },\r\n dimsFromTarget: function (t, e, n) {\r\n var i = this.em,\r\n r = []\r\n if (!t) return r\r\n if (\r\n (this.matches(t, this.itemSel + ', ' + this.containerSel) || (t = this.closest(t, this.itemSel)),\r\n this.draggable instanceof Array && (t = this.closest(t, this.draggable.join(','))),\r\n !t)\r\n )\r\n return r\r\n if ((this.prevTarget && this.prevTarget != t && (this.prevTarget = null), !this.prevTarget)) {\r\n this.targetP = this.closest(t, this.containerSel)\r\n var o = this.validTarget(t)\r\n if ((i && i.trigger('sorter:drag:validation', o), !o.valid && this.targetP))\r\n return this.dimsFromTarget(this.targetP, e, n)\r\n ;(this.prevTarget = t),\r\n (this.prevTargetDim = this.getDim(t)),\r\n (this.cacheDimsP = this.getChildrenDim(this.targetP)),\r\n (this.cacheDims = this.getChildrenDim(t))\r\n }\r\n if (\r\n (this.prevTarget == t && (r = this.cacheDims),\r\n (this.target = this.prevTarget),\r\n this.nearBorders(this.prevTargetDim, e, n) || (!this.nested && !this.cacheDims.length))\r\n ) {\r\n var s = this.targetP\r\n s && this.validTarget(s).valid && ((r = this.cacheDimsP), (this.target = s))\r\n }\r\n return (this.lastPos = null), r\r\n },\r\n getTargetFromEl: function (t) {\r\n var e = t,\r\n n = void 0,\r\n i = this.targetPrev,\r\n r = this.em,\r\n o = this.containerSel,\r\n s = this.itemSel\r\n if (\r\n (this.matches(e, s + ', ' + o) || (e = this.closest(e, s)),\r\n this.draggable instanceof Array && (e = this.closest(e, this.draggable.join(','))),\r\n i && i != e && (this.targetPrev = ''),\r\n !this.targetPrev)\r\n ) {\r\n n = this.closest(e, o)\r\n var a = this.validTarget(e)\r\n if ((r && r.trigger('sorter:drag:validation', a), !a.valid && n)) return this.getTargetFromEl(n)\r\n this.targetPrev = e\r\n }\r\n return this.nearElBorders(e) && (n = this.closest(e, o)) && this.validTarget(n).valid && (e = n), e\r\n },\r\n nearElBorders: function (t) {\r\n var e = t.getBoundingClientRect(),\r\n n = t.ownerDocument.body,\r\n i = this.getCurrentPos(),\r\n r = i.x,\r\n o = i.y,\r\n s = e.top + n.scrollTop,\r\n a = e.left + n.scrollLeft,\r\n l = e.width,\r\n c = e.height\r\n if (o < s + 10 || o > s + c - 10 || r < a + 10 || r > a + l - 10) return 1\r\n },\r\n getCurrentPos: function () {\r\n var t = this.eventMove\r\n return { x: t.pageX || 0, y: t.pageY || 0 }\r\n },\r\n getDim: function (t) {\r\n var e, n, i, r\r\n if (this.canvasRelative && this.em) {\r\n var o = this.em.get('Canvas').getElementPos(t),\r\n s = window.getComputedStyle(t),\r\n a = parseFloat(s.marginTop),\r\n l = parseFloat(s.marginBottom),\r\n c = parseFloat(s.marginRight),\r\n u = parseFloat(s.marginLeft)\r\n ;(e = o.top - a), (n = o.left - u), (i = o.height + a + l), (r = o.width + u + c)\r\n } else {\r\n var h = this.offset(t)\r\n ;(e = this.relative ? t.offsetTop : h.top - (this.wmargin ? -1 : 1) * this.elT),\r\n (n = this.relative ? t.offsetLeft : h.left - (this.wmargin ? -1 : 1) * this.elL),\r\n (i = t.offsetHeight),\r\n (r = t.offsetWidth)\r\n }\r\n return [e, n, i, r]\r\n },\r\n getChildrenDim: function (t) {\r\n var e = []\r\n if (!t) return e\r\n var n = this.getTargetModel(t)\r\n n && n.view && !this.ignoreViewChildren && (t = n.view.getChildrenContainer())\r\n for (var i = t.children, r = 0, o = i.length; r < o; r++) {\r\n var s = i[r]\r\n if (this.matches(s, this.itemSel)) {\r\n var a = this.getDim(s),\r\n l = this.direction\r\n ;(l = 'v' == l || ('h' != l && this.isInFlow(s, t))), a.push(l), a.push(s), e.push(a)\r\n }\r\n }\r\n return e\r\n },\r\n nearBorders: function (t, e, n) {\r\n var i = 0,\r\n r = this.borderOffset,\r\n o = e || 0,\r\n s = n || 0,\r\n a = t[0],\r\n l = t[1],\r\n c = t[2],\r\n u = t[3]\r\n return (a + r > s || s > a + c - r || l + r > o || o > l + u - r) && (i = 1), !!i\r\n },\r\n findPosition: function (t, e, n) {\r\n for (\r\n var i = { index: 0, method: 'before' },\r\n r = 0,\r\n o = 0,\r\n s = 0,\r\n a = 0,\r\n l = 0,\r\n c = 0,\r\n u = 0,\r\n h = 0,\r\n d = 0,\r\n f = t.length;\r\n d < f;\r\n d++\r\n )\r\n if (\r\n ((s = (h = t[d])[1] + h[3]),\r\n (u = h[0] + h[2]),\r\n (l = h[1] + h[3] / 2),\r\n (c = h[0] + h[2] / 2),\r\n !((o && h[1] > o) || (a && c >= a) || (r && s < r)))\r\n )\r\n if (((i.index = d), h[4])) {\r\n if (n < c) {\r\n i.method = 'before'\r\n break\r\n }\r\n i.method = 'after'\r\n } else n < u && (a = u), e < l ? ((o = l), (i.method = 'before')) : ((r = l), (i.method = 'after'))\r\n return i\r\n },\r\n movePlaceholder: function (t, e, n, i) {\r\n var r = 0,\r\n o = 0,\r\n s = 0,\r\n a = 0,\r\n l = 'px',\r\n c = n.method,\r\n u = e[n.index]\r\n if (\r\n ((t.style.borderColor = 'transparent #62c462'),\r\n (t.style.borderWidth = '3px 5px'),\r\n (t.style.margin = '-3px 0 0'),\r\n u)\r\n )\r\n u[4]\r\n ? ((s = u[3] + l), (a = 'auto'), (r = 'before' == c ? u[0] - 0 : u[0] + u[2] - 0), (o = u[1]))\r\n : ((s = 'auto'),\r\n (a = u[2] - 0 + l),\r\n (r = u[0] + 0),\r\n (o = 'before' == c ? u[1] - 0 : u[1] + u[3] - 0),\r\n (t.style.borderColor = '#62c462 transparent'),\r\n (t.style.borderWidth = '5px 3px'),\r\n (t.style.margin = '0 0 0 -3px'))\r\n else {\r\n if (!this.nested) return void (t.style.display = 'none')\r\n i && ((r = i[0] + 5), (o = i[1] + 5), (s = parseInt(i[3]) - 10 + l), (a = 'auto'))\r\n }\r\n ;(t.style.top = r + l), (t.style.left = o + l), s && (t.style.width = s), a && (t.style.height = a)\r\n },\r\n endMove: function (t) {\r\n var e = this,\r\n n = [null],\r\n i = this.getDocuments(),\r\n r = this.getContainerEl(),\r\n o = this.onEndMove,\r\n s = this.target,\r\n c = this.lastPos\r\n ;(0, l.off)(r, 'mousemove dragover', this.onMove),\r\n (0, l.off)(i, 'mouseup dragend touchend', this.endMove),\r\n (0, l.off)(i, 'keydown', this.rollback),\r\n (this.plh.style.display = 'none')\r\n new RegExp('(?:^|\\\\s)' + this.freezeClass + '(?!\\\\S)', 'gi')\r\n var u = this.eV\r\n if (u && this.selectOnEnd) {\r\n var h = this.getSourceModel()\r\n h && h.set && (h.set('status', ''), h.set('status', 'selected'))\r\n }\r\n if (this.moved) {\r\n var d = this.toMove\r\n ;((0, a.isArray)(d) ? d : d ? [d] : [u]).forEach(function (t) {\r\n n.push(e.move(s, t, c))\r\n })\r\n }\r\n this.plh && (this.plh.style.display = 'none')\r\n var f = this.dragHelper\r\n f && (f.parentNode.removeChild(f), (this.dragHelper = null)),\r\n this.selectTargetModel(),\r\n this.toggleSortCursor(),\r\n (this.toMove = null),\r\n (0, a.isFunction)(o) &&\r\n n.forEach(function (t) {\r\n return o(t, e)\r\n })\r\n },\r\n move: function (t, e, n) {\r\n var i = this.em,\r\n o = (0, l.getElement)(e)\r\n i && i.trigger('component:dragEnd:before', t, o, n)\r\n var a,\r\n u,\r\n h,\r\n d = [],\r\n f = n.index,\r\n p = this.validTarget(t, o),\r\n g = c(t).data('collection'),\r\n v = p.srcModel,\r\n m = p.droppable,\r\n y = p.draggable,\r\n b = p.dropInfo,\r\n x = p.dragInfo,\r\n w = this.dropContent\r\n if (((m = p.trgModel instanceof s.default.Collection ? 1 : m), g && m && y)) {\r\n var C = { at: (f = 'after' === n.method ? f + 1 : f), noIncrement: 1 }\r\n w\r\n ? ((a = w), (C.silent = !1), (C.avoidUpdateStyle = 1))\r\n : ((C.temporary = 1), (u = g.add({}, r({}, C))), v && (a = v.collection.remove(v))),\r\n (h = g.add(a, C)),\r\n w ? (this.dropContent = null) : g.remove(u),\r\n (this.prevTarget = null)\r\n } else\r\n g || d.push('Target collection not found'),\r\n m || d.push('Target is not droppable, accepts [' + b + ']'),\r\n y || d.push('Component not draggable, acceptable by [' + x + ']'),\r\n console.warn('Invalid target position: ' + d.join(', '))\r\n return i && i.trigger('component:dragEnd', g, a, d), i && i.trigger('sorter:drag:end', g, a, d), h\r\n },\r\n rollback: function (t) {\r\n ;(0, l.off)(this.getDocuments(), 'keydown', this.rollback),\r\n 27 == (t.which || t.keyCode) && ((this.moved = 0), this.endMove())\r\n }\r\n })\r\n }.call(this, n(1)))\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = (function () {\r\n function t (t, e) {\r\n for (var n = 0; n < e.length; n++) {\r\n var i = e[n]\r\n ;(i.enumerable = i.enumerable || !1),\r\n (i.configurable = !0),\r\n 'value' in i && (i.writable = !0),\r\n Object.defineProperty(t, i.key, i)\r\n }\r\n }\r\n return function (e, n, i) {\r\n return n && t(e.prototype, n), i && t(e, i), e\r\n }\r\n })(),\r\n r = n(1),\r\n o = n(2)\r\n var s = {\r\n mousePosFetcher: null,\r\n updateTarget: null,\r\n ratioDefault: 0,\r\n posFetcher: null,\r\n onStart: null,\r\n onMove: null,\r\n onEnd: null,\r\n step: 1,\r\n minDim: 32,\r\n maxDim: '',\r\n unitHeight: 'px',\r\n unitWidth: 'px',\r\n keyHeight: 'height',\r\n keyWidth: 'width',\r\n currentUnit: 1,\r\n silentFrames: 0,\r\n avoidContainerUpdate: 0,\r\n keepAutoHeight: !1,\r\n keepAutoWidth: !1,\r\n autoHeight: !1,\r\n autoWidth: !1,\r\n tl: 1,\r\n tc: 1,\r\n tr: 1,\r\n cl: 1,\r\n cr: 1,\r\n bl: 1,\r\n bc: 1,\r\n br: 1\r\n },\r\n a = (function () {\r\n function t () {\r\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n return (\r\n (function (t, e) {\r\n if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')\r\n })(this, t),\r\n this.setOptions(e),\r\n (0, r.bindAll)(this, 'handleKeyDown', 'handleMouseDown', 'move', 'stop'),\r\n this\r\n )\r\n }\r\n return (\r\n i(t, [\r\n {\r\n key: 'getConfig',\r\n value: function () {\r\n return this.opts\r\n }\r\n },\r\n {\r\n key: 'setOptions',\r\n value: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n ;(this.opts = (0, r.defaults)(t, s)), this.setup()\r\n }\r\n },\r\n {\r\n key: 'setup',\r\n value: function () {\r\n var t = this.opts,\r\n e = t.prefix || '',\r\n n = t.appendTo || document.body,\r\n i = this.container\r\n for (\r\n i ||\r\n (((i = document.createElement('div')).className = e + 'resizer-c'),\r\n n.appendChild(i),\r\n (this.container = i));\r\n i.firstChild;\r\n\r\n )\r\n i.removeChild(i.firstChild)\r\n var r = {}\r\n for (var o in (['tl', 'tc', 'tr', 'cl', 'cr', 'bl', 'bc', 'br'].forEach(function (e) {\r\n return (r[e] = t[e]\r\n ? (function (t, e) {\r\n var n = e.prefix || '',\r\n i = document.createElement('i')\r\n return (\r\n (i.className = n + 'resizer-h ' + n + 'resizer-h-' + t),\r\n i.setAttribute('data-' + n + 'handler', t),\r\n i\r\n )\r\n })(e, t)\r\n : '')\r\n }),\r\n r)) {\r\n var s = r[o]\r\n s && i.appendChild(s)\r\n }\r\n ;(this.handlers = r),\r\n (this.mousePosFetcher = t.mousePosFetcher),\r\n (this.updateTarget = t.updateTarget),\r\n (this.posFetcher = t.posFetcher),\r\n (this.onStart = t.onStart),\r\n (this.onMove = t.onMove),\r\n (this.onEnd = t.onEnd)\r\n }\r\n },\r\n {\r\n key: 'toggleFrames',\r\n value: function (t) {\r\n if (this.opts.silentFrames) {\r\n var e = document.querySelectorAll('iframe')\r\n ;(0, r.each)(e, function (e) {\r\n return (e.style.pointerEvents = t ? 'none' : '')\r\n })\r\n }\r\n }\r\n },\r\n {\r\n key: 'isHandler',\r\n value: function (t) {\r\n var e = this.handlers\r\n for (var n in e) if (e[n] === t) return !0\r\n return !1\r\n }\r\n },\r\n {\r\n key: 'getFocusedEl',\r\n value: function () {\r\n return this.el\r\n }\r\n },\r\n {\r\n key: 'getDocumentEl',\r\n value: function () {\r\n return [this.el.ownerDocument, document]\r\n }\r\n },\r\n {\r\n key: 'getElementPos',\r\n value: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = this.posFetcher || ''\r\n return n\r\n ? n(t, e)\r\n : (function (t, e) {\r\n var n = e || window,\r\n i = t.getBoundingClientRect()\r\n return {\r\n left: i.left + n.pageXOffset,\r\n top: i.top + n.pageYOffset,\r\n width: i.width,\r\n height: i.height\r\n }\r\n })(t)\r\n }\r\n },\r\n {\r\n key: 'focus',\r\n value: function (t) {\r\n if (!t || t !== this.el) {\r\n this.el = t\r\n var e = this.opts,\r\n n = this.getElementPos(t, { target: 'container' }),\r\n i = this.container.style\r\n e.avoidContainerUpdate ||\r\n ((i.left = n.left + 'px'),\r\n (i.top = n.top + 'px'),\r\n (i.width = n.width + 'px'),\r\n (i.height = n.height + 'px'),\r\n (i.display = 'block')),\r\n (0, o.on)(this.getDocumentEl(), 'mousedown', this.handleMouseDown)\r\n }\r\n }\r\n },\r\n {\r\n key: 'blur',\r\n value: function () {\r\n ;(this.container.style.display = 'none'),\r\n this.el && ((0, o.off)(this.getDocumentEl(), 'mousedown', this.handleMouseDown), (this.el = null))\r\n }\r\n },\r\n {\r\n key: 'start',\r\n value: function (t) {\r\n if (0 === t.button) {\r\n t.preventDefault(), t.stopPropagation()\r\n var e = this.el,\r\n n = this.opts || {},\r\n i = 'data-' + n.prefix + 'handler',\r\n s = this.getElementPos(e, { target: 'el' })\r\n ;(this.handlerAttr = t.target.getAttribute(i)),\r\n (this.clickedHandler = t.target),\r\n (this.startDim = { t: s.top, l: s.left, w: s.width, h: s.height }),\r\n (this.rectDim = { t: s.top, l: s.left, w: s.width, h: s.height }),\r\n (this.startPos = { x: t.clientX, y: t.clientY })\r\n var a = this.getDocumentEl()\r\n ;(0, o.on)(a, 'mousemove', this.move),\r\n (0, o.on)(a, 'keydown', this.handleKeyDown),\r\n (0, o.on)(a, 'mouseup', this.stop),\r\n (0, r.isFunction)(this.onStart) && this.onStart(t, { docs: a, config: n, el: e, resizer: this }),\r\n this.toggleFrames(1),\r\n this.move(t)\r\n }\r\n }\r\n },\r\n {\r\n key: 'move',\r\n value: function (t) {\r\n var e = this.onMove,\r\n n = this.mousePosFetcher,\r\n i = n ? n(t) : { x: t.clientX, y: t.clientY }\r\n ;(this.currentPos = i),\r\n (this.delta = { x: i.x - this.startPos.x, y: i.y - this.startPos.y }),\r\n (this.keys = { shift: t.shiftKey, ctrl: t.ctrlKey, alt: t.altKey }),\r\n (this.rectDim = this.calc(this)),\r\n this.updateRect(0),\r\n e && e(t),\r\n 0 === t.which && this.stop(t)\r\n }\r\n },\r\n {\r\n key: 'stop',\r\n value: function (t) {\r\n var e = this.opts,\r\n n = this.getDocumentEl()\r\n ;(0, o.off)(n, 'mousemove', this.move),\r\n (0, o.off)(n, 'keydown', this.handleKeyDown),\r\n (0, o.off)(n, 'mouseup', this.stop),\r\n this.updateRect(1),\r\n this.toggleFrames(),\r\n (0, r.isFunction)(this.onEnd) && this.onEnd(t, { docs: n, config: e })\r\n }\r\n },\r\n {\r\n key: 'updateRect',\r\n value: function (t) {\r\n var e = this.el,\r\n n = this.opts,\r\n i = this.rectDim,\r\n o = this.container.style,\r\n s = this.updateTarget,\r\n a = this.getSelectedHandler(),\r\n l = n.unitHeight,\r\n c = n.unitWidth,\r\n u = n.keyWidth,\r\n h = n.keyHeight\r\n if ((0, r.isFunction)(s)) s(e, i, { store: t, selectedHandler: a, resizer: this, config: n })\r\n else {\r\n var d = e.style\r\n ;(d[u] = i.w + c), (d[h] = i.h + l)\r\n }\r\n var f = this.getElementPos(e, { target: 'container' })\r\n n.avoidContainerUpdate ||\r\n ((o.left = f.left + 'px'),\r\n (o.top = f.top + 'px'),\r\n (o.width = f.width + 'px'),\r\n (o.height = f.height + 'px'))\r\n }\r\n },\r\n {\r\n key: 'getSelectedHandler',\r\n value: function () {\r\n var t = this.handlers\r\n if (this.selectedHandler) for (var e in t) if (t[e] === this.selectedHandler) return e\r\n }\r\n },\r\n {\r\n key: 'handleKeyDown',\r\n value: function (t) {\r\n 27 === t.keyCode && ((this.rectDim = this.startDim), this.stop(t))\r\n }\r\n },\r\n {\r\n key: 'handleMouseDown',\r\n value: function (t) {\r\n var e = t.target\r\n this.isHandler(e)\r\n ? ((this.selectedHandler = e), this.start(t))\r\n : e !== this.el && ((this.selectedHandler = ''), this.blur())\r\n }\r\n },\r\n {\r\n key: 'calc',\r\n value: function (t) {\r\n var e = void 0,\r\n n = this.opts || {},\r\n i = n.step,\r\n r = this.startDim,\r\n s = n.minDim,\r\n a = n.maxDim,\r\n l = t.delta.x,\r\n c = t.delta.y,\r\n u = r.w,\r\n h = r.h,\r\n d = { t: 0, l: 0, w: u, h: h }\r\n if (t) {\r\n var f = t.handlerAttr\r\n ~f.indexOf('r') &&\r\n ((e = (0, o.normalizeFloat)(u + l * i, i)),\r\n (e = Math.max(s, e)),\r\n a && (e = Math.min(a, e)),\r\n (d.w = e)),\r\n ~f.indexOf('b') &&\r\n ((e = (0, o.normalizeFloat)(h + c * i, i)),\r\n (e = Math.max(s, e)),\r\n a && (e = Math.min(a, e)),\r\n (d.h = e)),\r\n ~f.indexOf('l') &&\r\n ((e = (0, o.normalizeFloat)(u - l * i, i)),\r\n (e = Math.max(s, e)),\r\n a && (e = Math.min(a, e)),\r\n (d.w = e)),\r\n ~f.indexOf('t') &&\r\n ((e = (0, o.normalizeFloat)(h - c * i, i)),\r\n (e = Math.max(s, e)),\r\n a && (e = Math.min(a, e)),\r\n (d.h = e))\r\n var p = n.ratioDefault ? !t.keys.shift : t.keys.shift\r\n if (f.indexOf('c') < 0 && p) {\r\n var g = r.w / r.h\r\n d.w / d.h > g ? (d.h = Math.round(d.w / g)) : (d.w = Math.round(d.h * g))\r\n }\r\n return ~f.indexOf('l') && (d.l = r.w - d.w), ~f.indexOf('t') && (d.t = r.h - d.h), d\r\n }\r\n }\r\n }\r\n ]),\r\n t\r\n )\r\n })()\r\n t.exports = {\r\n init: function (t) {\r\n return new a(t)\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0)\r\n var o = ((i = r) && i.__esModule ? i : { default: i }).default.$\r\n t.exports = {\r\n setKey: function (t, e) {},\r\n getElementRect: function (t) {\r\n var e = this.opts.posFetcher || ''\r\n return e\r\n ? e(t, { avoidFrameOffset: 1 })\r\n : (function (t, e) {\r\n var n = e || window,\r\n i = t.getBoundingClientRect()\r\n return { left: i.left + n.pageXOffset, top: i.top + n.pageYOffset, width: i.width, height: i.height }\r\n })(t)\r\n },\r\n init: function (t) {\r\n return (\r\n this.setOptions(t),\r\n (this.handleMouseDown = this.handleMouseDown.bind(this)),\r\n (this.drag = this.drag.bind(this)),\r\n (this.move = this.move.bind(this)),\r\n (this.stop = this.stop.bind(this)),\r\n this.setKey('up, right, down, left', this.handleKey),\r\n this\r\n )\r\n },\r\n setOptions: function (t) {\r\n this.opts = t || {}\r\n },\r\n focus: function (t) {\r\n if (!t || t !== this.el) {\r\n this.getDocumentEl(t), this.blur(), (this.el = t), (this.handlers = this.opts.dragHandlers || [t])\r\n var e = this.getElementRect(t)\r\n ;(this.elRect = e),\r\n (this.startTop = e.top),\r\n (this.startLeft = e.left),\r\n this.getDocumentEl().on('mousedown', this.handleMouseDown)\r\n }\r\n },\r\n blur: function () {\r\n this.getDocumentEl().off('mousedown', this.handleMouseDown), (this.el = null)\r\n },\r\n start: function (t) {\r\n this.startPos = this.getMousePos(t)\r\n var e = this.getDocumentEl()\r\n e.on('mousemove', this.drag), e.on('mouseup', this.stop)\r\n var n = this.opts.onStart\r\n 'function' == typeof n && n(t, { docs: e, el: this.el, start: this.startPos, elRect: this.elRect }),\r\n this.drag(t)\r\n },\r\n stop: function (t) {\r\n var e = this.getDocumentEl()\r\n e.off('mousemove', this.drag), e.off('mouseup', this.stop), (this.lockedAxis = null)\r\n var n = this.opts.onEnd\r\n 'function' == typeof n &&\r\n n(t, {\r\n docs: e,\r\n delta: this.delta,\r\n end: { x: this.startLeft + this.delta.x, y: this.startTop + this.delta.y }\r\n })\r\n },\r\n handleMouseDown: function (t) {\r\n var e = t.target\r\n this.isHandler(e) && this.start(t)\r\n },\r\n isHandler: function (t) {\r\n var e = this.handlers\r\n for (var n in e) if (e[n] === t) return !0\r\n return !1\r\n },\r\n handleKey: function (t, e) {\r\n switch (e.shortcut) {\r\n case 'up':\r\n this.move(0, -1)\r\n break\r\n case 'right':\r\n this.move(1, 0)\r\n break\r\n case 'down':\r\n this.move(0, 1)\r\n break\r\n case 'left':\r\n this.move(-1, 0)\r\n }\r\n },\r\n getDocumentEl: function (t) {\r\n t = t || this.el\r\n if (!this.$doc) {\r\n var e = [document]\r\n t && e.push(t.ownerDocument), (this.$doc = o(e))\r\n }\r\n return this.$doc\r\n },\r\n getMousePos: function (t) {\r\n var e = this.opts.mousePosFetcher\r\n return e ? e(t) : { x: t.clientX, y: t.clientY }\r\n },\r\n drag: function (t) {\r\n var e = this.lockedAxis,\r\n n = this.getMousePos(t),\r\n i = { x: n.x - this.startPos.x, y: n.y - this.startPos.y }\r\n if (t.shiftKey) {\r\n if (!e) {\r\n var r = i.x,\r\n o = i.y,\r\n s = Math.abs(r),\r\n a = Math.abs(o)\r\n o >= s || o <= -s ? (e = 'x') : (r > a || r < -a) && (e = 'y')\r\n }\r\n } else e = null\r\n 'x' === e && (i.x = this.startPos.x),\r\n 'y' === e && (i.y = this.startPos.y),\r\n (this.lockedAxis = e),\r\n (this.delta = i),\r\n this.move(i.x, i.y)\r\n var l = this.opts.onDrag\r\n 'function' == typeof l &&\r\n l(t, { delta: i, current: { x: this.startLeft + i.x, y: this.startTop + i.y }, lockedAxis: e }),\r\n 0 === t.which && this.stop(t)\r\n },\r\n move: function (t, e) {\r\n this.moveX(t), this.moveY(e)\r\n },\r\n moveX: function (t) {\r\n var e = this.el,\r\n n = (this.opts, this.startLeft + t),\r\n i = this.opts.setX\r\n 'function' == typeof i ? i(n, { el: e, start: this.startLeft, delta: t }) : (e.style.left = n + 'px')\r\n },\r\n moveY: function (t) {\r\n var e = this.el,\r\n n = (this.opts, this.startTop + t),\r\n i = this.opts.setY\r\n 'function' == typeof i ? i(n, { el: e, start: this.startTop, delta: t }) : (e.style.top = n + 'px')\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator\r\n ? function (t) {\r\n return typeof t\r\n }\r\n : function (t) {\r\n return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype\r\n ? 'symbol'\r\n : typeof t\r\n },\r\n r =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n o = n(1),\r\n s = n(45)\r\n t.exports = function () {\r\n var t = void 0,\r\n e = void 0,\r\n n = {},\r\n a = {\r\n defaults: {\r\n 'core:undo': { keys: '⌘+z, ctrl+z', handler: 'core:undo' },\r\n 'core:redo': { keys: '⌘+shift+z, ctrl+shift+z', handler: 'core:redo' },\r\n 'core:copy': { keys: '⌘+c, ctrl+c', handler: 'core:copy' },\r\n 'core:paste': { keys: '⌘+v, ctrl+v', handler: 'core:paste' },\r\n 'core:component-next': { keys: 's', handler: 'core:component-next' },\r\n 'core:component-prev': { keys: 'w', handler: 'core:component-prev' },\r\n 'core:component-enter': { keys: 'd', handler: 'core:component-enter' },\r\n 'core:component-exit': { keys: 'a', handler: 'core:component-exit' },\r\n 'core:component-delete': { keys: 'backspace, delete', handler: 'core:component-delete' }\r\n }\r\n }\r\n return {\r\n keymaster: s,\r\n name: 'Keymaps',\r\n getConfig: function () {\r\n return e\r\n },\r\n init: function () {\r\n var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n return (e = r({}, a, n)), (t = e.em), (this.em = t), this\r\n },\r\n onLoad: function () {\r\n var t = e.defaults\r\n for (var n in t) {\r\n var i = t[n]\r\n this.add(n, i.keys, i.handler)\r\n }\r\n },\r\n add: function (t, e, r) {\r\n var a = this.em,\r\n l = a.get('Commands'),\r\n c = a.getEditor(),\r\n u = { id: t, keys: e, handler: r }\r\n return (\r\n n[t] && this.remove(t),\r\n (n[t] = u),\r\n s(e, function (e, n) {\r\n 'object' == (void 0 === (r = (0, o.isString)(r) ? l.get(r) : r) ? 'undefined' : i(r)) ? r.run(c) : r(c)\r\n var s = [t, n.shortcut, e]\r\n a.trigger.apply(a, ['keymap:emit'].concat(s)), a.trigger.apply(a, ['keymap:emit:' + t].concat(s))\r\n }),\r\n a.trigger('keymap:add', u),\r\n u\r\n )\r\n },\r\n get: function (t) {\r\n return n[t]\r\n },\r\n getAll: function () {\r\n return n\r\n },\r\n remove: function (t) {\r\n var e = this.em,\r\n i = this.get(t)\r\n if (i) return delete n[t], s.unbind(i.keys), e && e.trigger('keymap:remove', i), i\r\n },\r\n removeAll: function () {\r\n var t = this\r\n return (\r\n Object.keys(n).forEach(function (e) {\r\n return t.remove(e)\r\n }),\r\n this\r\n )\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n o = n(98),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n t.exports = function () {\r\n var t = void 0,\r\n e = void 0,\r\n n = void 0,\r\n i = void 0,\r\n o = {}\r\n return {\r\n name: 'UndoManager',\r\n init: function () {\r\n var a = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n ;(n = r({}, a, o)),\r\n (t = n.em),\r\n (this.em = t),\r\n (e = new s.default({ track: !0, register: [] })).changeUndoType('change', { condition: !1 }),\r\n e.changeUndoType('add', {\r\n on: function (t, e) {\r\n var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}\r\n if (!n.avoidStore) return { object: e, before: void 0, after: t, options: r({}, n) }\r\n }\r\n }),\r\n e.changeUndoType('remove', {\r\n on: function (t, e) {\r\n var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}\r\n if (!n.avoidStore) return { object: e, before: t, after: void 0, options: r({}, n) }\r\n }\r\n })\r\n var l = {\r\n on: function (t, e) {\r\n var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}\r\n if ((!i && (i = t.previousAttributes()), !n.avoidStore)) {\r\n var r = { object: t, before: i, after: t.toJSON() }\r\n return (i = null), r\r\n }\r\n },\r\n undo: function (t, e, n, i) {\r\n t.set(e)\r\n },\r\n redo: function (t, e, n, i) {\r\n t.set(n)\r\n }\r\n }\r\n return (\r\n ['style', 'attributes', 'content', 'src'].forEach(function (t) {\r\n return e.addUndoType('change:' + t, l)\r\n }),\r\n e.on('undo redo', function () {\r\n return t.trigger('component:toggled change:canvasOffset')\r\n }),\r\n ['undo', 'redo'].forEach(function (n) {\r\n return e.on(n, function () {\r\n return t.trigger(n)\r\n })\r\n }),\r\n this\r\n )\r\n },\r\n getConfig: function () {\r\n return n\r\n },\r\n add: function (t) {\r\n return e.register(t), this\r\n },\r\n remove: function (t) {\r\n return e.unregister(t), this\r\n },\r\n removeAll: function () {\r\n return e.unregisterAll(), this\r\n },\r\n start: function () {\r\n return e.startTracking(), this\r\n },\r\n stop: function () {\r\n return e.stopTracking(), this\r\n },\r\n undo: function () {\r\n return !t.isEditing() && e.undo(1), this\r\n },\r\n undoAll: function () {\r\n return e.undoAll(), this\r\n },\r\n redo: function () {\r\n return !t.isEditing() && e.redo(1), this\r\n },\r\n redoAll: function () {\r\n return e.redoAll(), this\r\n },\r\n hasUndo: function () {\r\n return e.isAvailable('undo')\r\n },\r\n hasRedo: function () {\r\n return e.isAvailable('redo')\r\n },\r\n getStack: function () {\r\n return e.stack\r\n },\r\n clear: function () {\r\n return e.clear(), this\r\n },\r\n getInstance: function () {\r\n return e\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n var i, r, o\r\n /*!\r\n * Backbone.Undo.js v0.2\r\n *\r\n * Copyright (c)2013 Oliver Sartun\r\n * Released under the MIT License\r\n *\r\n * Documentation and full license available at\r\n * https://github.com/osartun/Backbone.Undo.js\r\n */ ;(r = [n(46), n(99)]),\r\n void 0 ===\r\n (o =\r\n 'function' ==\r\n typeof (i = function (t, e) {\r\n var n = Array.prototype.slice\r\n function i (t, e, n) {\r\n return n.length <= 4 ? t.call(e, n[0], n[1], n[2], n[3]) : t.apply(e, n)\r\n }\r\n function r (t, e) {\r\n return n.call(t, e)\r\n }\r\n function o (e, n) {\r\n return (\r\n null != e &&\r\n (t.isArray(n) || (n = r(arguments, 1)),\r\n t.all(n, function (t) {\r\n return t in e\r\n }))\r\n )\r\n }\r\n var s,\r\n a,\r\n l = ((s = !1),\r\n (a = -1),\r\n function () {\r\n return (\r\n s ||\r\n (a++,\r\n (s = !0),\r\n t.defer(function () {\r\n s = !1\r\n })),\r\n a\r\n )\r\n })\r\n function c () {\r\n ;(this.registeredObjects = []), (this.cidIndexes = [])\r\n }\r\n function u (e, n, i, r) {\r\n for (var o, s = 0, a = n.length; s < a; s++)\r\n if ((o = n[s])) {\r\n if ('on' === e) {\r\n if (!r.objectRegistry.register(o)) continue\r\n } else if (!r.objectRegistry.unregister(o)) continue\r\n t.isFunction(o[e]) && o[e]('all', i, r)\r\n }\r\n }\r\n function h (e, n) {\r\n var i = n.type,\r\n r = n.undoTypes,\r\n o = !r[i] || r[i][e]\r\n t.isFunction(o) && o(n.object, n.before, n.after, n.options)\r\n }\r\n function d (e, i, r, o, s) {\r\n if (\r\n !(\r\n r.isCurrentlyUndoRedoing ||\r\n ('undo' === e && -1 === r.pointer) ||\r\n ('redo' === e && r.pointer === r.length - 1)\r\n )\r\n ) {\r\n r.isCurrentlyUndoRedoing = !0\r\n var a,\r\n l,\r\n c = 'undo' === e\r\n for (\r\n s\r\n ? (l =\r\n (c && r.pointer === r.length - 1) || (!c && -1 === r.pointer)\r\n ? t.clone(r.models)\r\n : n.apply(r.models, c ? [0, r.pointer] : [r.pointer, r.length - 1]))\r\n : ((a = r.at(c ? r.pointer : r.pointer + 1)),\r\n (l = o ? r.where({ magicFusionIndex: a.get('magicFusionIndex') }) : [a])),\r\n r.pointer += (c ? -1 : 1) * l.length;\r\n (a = c ? l.pop() : l.shift());\r\n\r\n )\r\n a[e]()\r\n ;(r.isCurrentlyUndoRedoing = !1), i.trigger(e, i)\r\n }\r\n }\r\n function f (t, e, n, r) {\r\n if (\r\n t.track &&\r\n !t.isCurrentlyUndoRedoing &&\r\n e in r &&\r\n (function (t, e) {\r\n var n = t.condition,\r\n r = typeof n\r\n return 'function' === r ? !!i(n, t, e) : 'boolean' !== r || n\r\n })(r[e], n)\r\n ) {\r\n var s = i(r[e].on, r[e], n)\r\n if (o(s, 'object', 'before', 'after')) {\r\n if (((s.type = e), (s.magicFusionIndex = l()), (s.undoTypes = r), t.pointer < t.length - 1))\r\n for (var a = t.length - t.pointer - 1; a--; ) t.pop()\r\n ;(t.pointer = t.length), t.add(s), t.length > t.maximumStackLength && (t.shift(), t.pointer--)\r\n }\r\n }\r\n }\r\n c.prototype = {\r\n isRegistered: function (e) {\r\n return e && e.cid ? this.registeredObjects[e.cid] : t.contains(this.registeredObjects, e)\r\n },\r\n register: function (t) {\r\n return (\r\n !this.isRegistered(t) &&\r\n (t && t.cid\r\n ? ((this.registeredObjects[t.cid] = t), this.cidIndexes.push(t.cid))\r\n : this.registeredObjects.push(t),\r\n !0)\r\n )\r\n },\r\n unregister: function (e) {\r\n if (this.isRegistered(e)) {\r\n if (e && e.cid)\r\n delete this.registeredObjects[e.cid], this.cidIndexes.splice(t.indexOf(this.cidIndexes, e.cid), 1)\r\n else {\r\n var n = t.indexOf(this.registeredObjects, e)\r\n this.registeredObjects.splice(n, 1)\r\n }\r\n return !0\r\n }\r\n return !1\r\n },\r\n get: function () {\r\n return t\r\n .map(\r\n this.cidIndexes,\r\n function (t) {\r\n return this.registeredObjects[t]\r\n },\r\n this\r\n )\r\n .concat(this.registeredObjects)\r\n }\r\n }\r\n var p = {\r\n add: {\r\n undo: function (t, e, n, i) {\r\n t.remove(n, i)\r\n },\r\n redo: function (t, e, n, i) {\r\n i.index && (i.at = i.index), t.add(n, i)\r\n },\r\n on: function (e, n, i) {\r\n return { object: n, before: void 0, after: e, options: t.clone(i) }\r\n }\r\n },\r\n remove: {\r\n undo: function (t, e, n, i) {\r\n 'index' in i && (i.at = i.index), t.add(e, i)\r\n },\r\n redo: function (t, e, n, i) {\r\n t.remove(e, i)\r\n },\r\n on: function (e, n, i) {\r\n return { object: n, before: e, after: void 0, options: t.clone(i) }\r\n }\r\n },\r\n change: {\r\n undo: function (e, n, i, r) {\r\n t.isEmpty(n)\r\n ? t.each(t.keys(i), e.unset, e)\r\n : (e.set(n),\r\n r &&\r\n r.unsetData &&\r\n r.unsetData.before &&\r\n r.unsetData.before.length &&\r\n t.each(r.unsetData.before, e.unset, e))\r\n },\r\n redo: function (e, n, i, r) {\r\n t.isEmpty(i)\r\n ? t.each(t.keys(n), e.unset, e)\r\n : (e.set(i),\r\n r &&\r\n r.unsetData &&\r\n r.unsetData.after &&\r\n r.unsetData.after.length &&\r\n t.each(r.unsetData.after, e.unset, e))\r\n },\r\n on: function (e, n) {\r\n var i = e.changedAttributes(),\r\n r = t.keys(i),\r\n o = t.pick(e.previousAttributes(), r),\r\n s = t.keys(o),\r\n a = ((n || (n = {})).unsetData = { after: [], before: [] })\r\n return (\r\n r.length != s.length &&\r\n (r.length > s.length\r\n ? t.each(\r\n r,\r\n function (t) {\r\n t in o || a.before.push(t)\r\n },\r\n this\r\n )\r\n : t.each(s, function (t) {\r\n t in i || a.after.push(t)\r\n })),\r\n { object: e, before: o, after: i, options: t.clone(n) }\r\n )\r\n }\r\n },\r\n reset: {\r\n undo: function (t, e, n) {\r\n t.reset(e)\r\n },\r\n redo: function (t, e, n) {\r\n t.reset(n)\r\n },\r\n on: function (e, n) {\r\n return { object: e, before: n.previousModels, after: t.clone(e.models) }\r\n }\r\n }\r\n }\r\n function g () {}\r\n function v (e, n, i, r) {\r\n if ('object' == typeof n)\r\n return t.each(n, function (t, n) {\r\n 2 === e ? v(e, t, i, r) : v(e, n, t, i)\r\n })\r\n switch (e) {\r\n case 0:\r\n o(i, 'undo', 'redo', 'on') && t.all(t.pick(i, 'undo', 'redo', 'on'), t.isFunction) && (r[n] = i)\r\n break\r\n case 1:\r\n r[n] && t.isObject(i) && (r[n] = t.extend({}, r[n], i))\r\n break\r\n case 2:\r\n delete r[n]\r\n }\r\n return this\r\n }\r\n g.prototype = p\r\n var m = e.Model.extend({\r\n defaults: { type: null, object: null, before: null, after: null, magicFusionIndex: null },\r\n undo: function (t) {\r\n h('undo', this.attributes)\r\n },\r\n redo: function (t) {\r\n h('redo', this.attributes)\r\n }\r\n }),\r\n y = e.Collection.extend({\r\n model: m,\r\n pointer: -1,\r\n track: !1,\r\n isCurrentlyUndoRedoing: !1,\r\n maximumStackLength: 1 / 0,\r\n setMaxLength: function (t) {\r\n this.maximumStackLength = t\r\n }\r\n }),\r\n b = e.Model.extend({\r\n defaults: { maximumStackLength: 1 / 0, track: !1 },\r\n initialize: function (e) {\r\n ;(this.stack = new y()),\r\n (this.objectRegistry = new c()),\r\n (this.undoTypes = new g()),\r\n this.stack.setMaxLength(this.get('maximumStackLength')),\r\n this.on(\r\n 'change:maximumStackLength',\r\n function (t, e) {\r\n this.stack.setMaxLength(e)\r\n },\r\n this\r\n ),\r\n e && e.track && this.startTracking(),\r\n e &&\r\n e.register &&\r\n (t.isArray(e.register) || t.isArguments(e.register)\r\n ? i(this.register, this, e.register)\r\n : this.register(e.register))\r\n },\r\n startTracking: function () {\r\n this.set('track', !0), (this.stack.track = !0)\r\n },\r\n stopTracking: function () {\r\n this.set('track', !1), (this.stack.track = !1)\r\n },\r\n isTracking: function () {\r\n return this.get('track')\r\n },\r\n _addToStack: function (t) {\r\n f(this.stack, t, r(arguments, 1), this.undoTypes)\r\n },\r\n register: function () {\r\n u('on', arguments, this._addToStack, this)\r\n },\r\n unregister: function () {\r\n u('off', arguments, this._addToStack, this)\r\n },\r\n unregisterAll: function () {\r\n i(this.unregister, this, this.objectRegistry.get())\r\n },\r\n undo: function (t) {\r\n d('undo', this, this.stack, t)\r\n },\r\n undoAll: function () {\r\n d('undo', this, this.stack, !1, !0)\r\n },\r\n redo: function (t) {\r\n d('redo', this, this.stack, t)\r\n },\r\n redoAll: function () {\r\n d('redo', this, this.stack, !1, !0)\r\n },\r\n isAvailable: function (t) {\r\n var e = this.stack,\r\n n = e.length\r\n switch (t) {\r\n case 'undo':\r\n return n > 0 && e.pointer > -1\r\n case 'redo':\r\n return n > 0 && e.pointer < n - 1\r\n default:\r\n return !1\r\n }\r\n },\r\n merge: function (e) {\r\n for (var n, i = t.isArray(e) ? e : r(arguments); (n = i.pop()); )\r\n n instanceof b && n.stack instanceof y && (n.stack = this.stack)\r\n },\r\n addUndoType: function (t, e) {\r\n v(0, t, e, this.undoTypes)\r\n },\r\n changeUndoType: function (t, e) {\r\n v(1, t, e, this.undoTypes)\r\n },\r\n removeUndoType: function (t) {\r\n v(2, t, void 0, this.undoTypes)\r\n },\r\n clear: function () {\r\n this.stack.reset(), (this.stack.pointer = -1)\r\n }\r\n })\r\n return (\r\n t.extend(b, {\r\n defaults: function (e) {\r\n t.extend(b.prototype.defaults, e)\r\n },\r\n addUndoType: function (t, e) {\r\n v(0, t, e, p)\r\n },\r\n changeUndoType: function (t, e) {\r\n v(1, t, e, p)\r\n },\r\n removeUndoType: function (t) {\r\n v(2, t, void 0, p)\r\n }\r\n }),\r\n (e.UndoManager = b)\r\n )\r\n })\r\n ? i.apply(e, r)\r\n : i) || (t.exports = o)\r\n },\r\n function (t, e, n) {\r\n ;(function (i) {\r\n var r, o, s\r\n ;(s = ('object' == typeof self && self.self == self && self) || ('object' == typeof i && i.global == i && i)),\r\n (r = [n(46), n(13), e]),\r\n void 0 ===\r\n (o = function (t, e, n) {\r\n s.Backbone = (function (t, e, n, i) {\r\n var r = t.Backbone,\r\n o = [].slice\r\n ;(e.VERSION = '1.2.1'),\r\n (e.$ = i),\r\n (e.noConflict = function () {\r\n return (t.Backbone = r), this\r\n }),\r\n (e.emulateHTTP = !1),\r\n (e.emulateJSON = !1)\r\n var s = function (t, e, i) {\r\n n.each(e, function (e, r) {\r\n n[r] &&\r\n (t.prototype[r] = (function (t, e, i) {\r\n switch (t) {\r\n case 1:\r\n return function () {\r\n return n[e](this[i])\r\n }\r\n case 2:\r\n return function (t) {\r\n return n[e](this[i], t)\r\n }\r\n case 3:\r\n return function (t, r) {\r\n return n[e](this[i], t, r)\r\n }\r\n case 4:\r\n return function (t, r, o) {\r\n return n[e](this[i], t, r, o)\r\n }\r\n default:\r\n return function () {\r\n var t = o.call(arguments)\r\n return t.unshift(this[i]), n[e].apply(n, t)\r\n }\r\n }\r\n })(e, r, i))\r\n })\r\n },\r\n a = (e.Events = {}),\r\n l = /\\s+/,\r\n c = function (t, e, i, r, o) {\r\n var s,\r\n a = 0\r\n if (i && 'object' == typeof i) {\r\n void 0 !== r && 'context' in o && void 0 === o.context && (o.context = r)\r\n for (s = n.keys(i); a < s.length; a++) e = t(e, s[a], i[s[a]], o)\r\n } else if (i && l.test(i)) for (s = i.split(l); a < s.length; a++) e = t(e, s[a], r, o)\r\n else e = t(e, i, r, o)\r\n return e\r\n }\r\n a.on = function (t, e, n) {\r\n return u(this, t, e, n)\r\n }\r\n var u = function (t, e, n, i, r) {\r\n if (((t._events = c(h, t._events || {}, e, n, { context: i, ctx: t, listening: r })), r)) {\r\n var o = t._listeners || (t._listeners = {})\r\n o[r.id] = r\r\n }\r\n return t\r\n }\r\n a.listenTo = function (t, e, i) {\r\n if (!t) return this\r\n var r = t._listenId || (t._listenId = n.uniqueId('l')),\r\n o = this._listeningTo || (this._listeningTo = {}),\r\n s = o[r]\r\n if (!s) {\r\n var a = this._listenId || (this._listenId = n.uniqueId('l'))\r\n s = o[r] = { obj: t, objId: r, id: a, listeningTo: o, count: 0 }\r\n }\r\n return u(t, e, i, this, s), this\r\n }\r\n var h = function (t, e, n, i) {\r\n if (n) {\r\n var r = t[e] || (t[e] = []),\r\n o = i.context,\r\n s = i.ctx,\r\n a = i.listening\r\n a && a.count++, r.push({ callback: n, context: o, ctx: o || s, listening: a })\r\n }\r\n return t\r\n }\r\n ;(a.off = function (t, e, n) {\r\n return this._events\r\n ? ((this._events = c(d, this._events, t, e, { context: n, listeners: this._listeners })), this)\r\n : this\r\n }),\r\n (a.stopListening = function (t, e, i) {\r\n var r = this._listeningTo\r\n if (!r) return this\r\n for (var o = t ? [t._listenId] : n.keys(r), s = 0; s < o.length; s++) {\r\n var a = r[o[s]]\r\n if (!a) break\r\n a.obj.off(e, i, this)\r\n }\r\n return n.isEmpty(r) && (this._listeningTo = void 0), this\r\n })\r\n var d = function (t, e, i, r) {\r\n if (t) {\r\n var o,\r\n s = 0,\r\n a = r.context,\r\n l = r.listeners\r\n if (e || i || a) {\r\n for (var c = e ? [e] : n.keys(t); s < c.length; s++) {\r\n e = c[s]\r\n var u = t[e]\r\n if (!u) break\r\n for (var h = [], d = 0; d < u.length; d++) {\r\n var f = u[d]\r\n ;(i && i !== f.callback && i !== f.callback._callback) || (a && a !== f.context)\r\n ? h.push(f)\r\n : (o = f.listening) && 0 == --o.count && (delete l[o.id], delete o.listeningTo[o.objId])\r\n }\r\n h.length ? (t[e] = h) : delete t[e]\r\n }\r\n return n.size(t) ? t : void 0\r\n }\r\n for (var p = n.keys(l); s < p.length; s++)\r\n (o = l[p[s]]), delete l[o.id], delete o.listeningTo[o.objId]\r\n }\r\n }\r\n ;(a.once = function (t, e, i) {\r\n var r = c(f, {}, t, e, n.bind(this.off, this))\r\n return this.on(r, void 0, i)\r\n }),\r\n (a.listenToOnce = function (t, e, i) {\r\n var r = c(f, {}, e, i, n.bind(this.stopListening, this, t))\r\n return this.listenTo(t, r)\r\n })\r\n var f = function (t, e, i, r) {\r\n if (i) {\r\n var o = (t[e] = n.once(function () {\r\n r(e, o), i.apply(this, arguments)\r\n }))\r\n o._callback = i\r\n }\r\n return t\r\n }\r\n a.trigger = function (t) {\r\n if (!this._events) return this\r\n for (var e = Math.max(0, arguments.length - 1), n = Array(e), i = 0; i < e; i++)\r\n n[i] = arguments[i + 1]\r\n return c(p, this._events, t, void 0, n), this\r\n }\r\n var p = function (t, e, n, i) {\r\n if (t) {\r\n var r = t[e],\r\n o = t.all\r\n r && o && (o = o.slice()), r && g(r, i), o && g(o, [e].concat(i))\r\n }\r\n return t\r\n },\r\n g = function (t, e) {\r\n var n,\r\n i = -1,\r\n r = t.length,\r\n o = e[0],\r\n s = e[1],\r\n a = e[2]\r\n switch (e.length) {\r\n case 0:\r\n for (; ++i < r; ) (n = t[i]).callback.call(n.ctx)\r\n return\r\n case 1:\r\n for (; ++i < r; ) (n = t[i]).callback.call(n.ctx, o)\r\n return\r\n case 2:\r\n for (; ++i < r; ) (n = t[i]).callback.call(n.ctx, o, s)\r\n return\r\n case 3:\r\n for (; ++i < r; ) (n = t[i]).callback.call(n.ctx, o, s, a)\r\n return\r\n default:\r\n for (; ++i < r; ) (n = t[i]).callback.apply(n.ctx, e)\r\n return\r\n }\r\n }\r\n ;(a.bind = a.on), (a.unbind = a.off), n.extend(e, a)\r\n var v = (e.Model = function (t, e) {\r\n var i = t || {}\r\n e || (e = {}),\r\n (this.cid = n.uniqueId(this.cidPrefix)),\r\n (this.attributes = {}),\r\n e.collection && (this.collection = e.collection),\r\n e.parse && (i = this.parse(i, e) || {}),\r\n (i = n.defaults({}, i, n.result(this, 'defaults'))),\r\n this.set(i, e),\r\n (this.changed = {}),\r\n this.initialize.apply(this, arguments)\r\n })\r\n n.extend(v.prototype, a, {\r\n changed: null,\r\n validationError: null,\r\n idAttribute: 'id',\r\n cidPrefix: 'c',\r\n initialize: function () {},\r\n toJSON: function (t) {\r\n return n.clone(this.attributes)\r\n },\r\n sync: function () {\r\n return e.sync.apply(this, arguments)\r\n },\r\n get: function (t) {\r\n return this.attributes[t]\r\n },\r\n escape: function (t) {\r\n return n.escape(this.get(t))\r\n },\r\n has: function (t) {\r\n return null != this.get(t)\r\n },\r\n matches: function (t) {\r\n return !!n.iteratee(t, this)(this.attributes)\r\n },\r\n set: function (t, e, i) {\r\n if (null == t) return this\r\n var r\r\n if (\r\n ('object' == typeof t ? ((r = t), (i = e)) : ((r = {})[t] = e),\r\n i || (i = {}),\r\n !this._validate(r, i))\r\n )\r\n return !1\r\n var o = i.unset,\r\n s = i.silent,\r\n a = [],\r\n l = this._changing\r\n ;(this._changing = !0),\r\n l || ((this._previousAttributes = n.clone(this.attributes)), (this.changed = {}))\r\n var c = this.attributes,\r\n u = this.changed,\r\n h = this._previousAttributes\r\n for (var d in (this.idAttribute in r && (this.id = r[this.idAttribute]), r))\r\n (e = r[d]),\r\n n.isEqual(c[d], e) || a.push(d),\r\n n.isEqual(h[d], e) ? delete u[d] : (u[d] = e),\r\n o ? delete c[d] : (c[d] = e)\r\n if (!s) {\r\n a.length && (this._pending = i)\r\n for (var f = 0; f < a.length; f++) this.trigger('change:' + a[f], this, c[a[f]], i)\r\n }\r\n if (l) return this\r\n if (!s)\r\n for (; this._pending; ) (i = this._pending), (this._pending = !1), this.trigger('change', this, i)\r\n return (this._pending = !1), (this._changing = !1), this\r\n },\r\n unset: function (t, e) {\r\n return this.set(t, void 0, n.extend({}, e, { unset: !0 }))\r\n },\r\n clear: function (t) {\r\n var e = {}\r\n for (var i in this.attributes) e[i] = void 0\r\n return this.set(e, n.extend({}, t, { unset: !0 }))\r\n },\r\n hasChanged: function (t) {\r\n return null == t ? !n.isEmpty(this.changed) : n.has(this.changed, t)\r\n },\r\n changedAttributes: function (t) {\r\n if (!t) return !!this.hasChanged() && n.clone(this.changed)\r\n var e = this._changing ? this._previousAttributes : this.attributes,\r\n i = {}\r\n for (var r in t) {\r\n var o = t[r]\r\n n.isEqual(e[r], o) || (i[r] = o)\r\n }\r\n return !!n.size(i) && i\r\n },\r\n previous: function (t) {\r\n return null != t && this._previousAttributes ? this._previousAttributes[t] : null\r\n },\r\n previousAttributes: function () {\r\n return n.clone(this._previousAttributes)\r\n },\r\n fetch: function (t) {\r\n t = n.extend({ parse: !0 }, t)\r\n var e = this,\r\n i = t.success\r\n return (\r\n (t.success = function (n) {\r\n var r = t.parse ? e.parse(n, t) : n\r\n if (!e.set(r, t)) return !1\r\n i && i.call(t.context, e, n, t), e.trigger('sync', e, n, t)\r\n }),\r\n D(this, t),\r\n this.sync('read', this, t)\r\n )\r\n },\r\n save: function (t, e, i) {\r\n var r\r\n null == t || 'object' == typeof t ? ((r = t), (i = e)) : ((r = {})[t] = e)\r\n var o = (i = n.extend({ validate: !0, parse: !0 }, i)).wait\r\n if (r && !o) {\r\n if (!this.set(r, i)) return !1\r\n } else if (!this._validate(r, i)) return !1\r\n var s = this,\r\n a = i.success,\r\n l = this.attributes\r\n ;(i.success = function (t) {\r\n s.attributes = l\r\n var e = i.parse ? s.parse(t, i) : t\r\n if ((o && (e = n.extend({}, r, e)), e && !s.set(e, i))) return !1\r\n a && a.call(i.context, s, t, i), s.trigger('sync', s, t, i)\r\n }),\r\n D(this, i),\r\n r && o && (this.attributes = n.extend({}, l, r))\r\n var c = this.isNew() ? 'create' : i.patch ? 'patch' : 'update'\r\n 'patch' !== c || i.attrs || (i.attrs = r)\r\n var u = this.sync(c, this, i)\r\n return (this.attributes = l), u\r\n },\r\n destroy: function (t) {\r\n t = t ? n.clone(t) : {}\r\n var e = this,\r\n i = t.success,\r\n r = t.wait,\r\n o = function () {\r\n e.stopListening(), e.trigger('destroy', e, e.collection, t)\r\n }\r\n t.success = function (n) {\r\n r && o(), i && i.call(t.context, e, n, t), e.isNew() || e.trigger('sync', e, n, t)\r\n }\r\n var s = !1\r\n return (\r\n this.isNew() ? n.defer(t.success) : (D(this, t), (s = this.sync('delete', this, t))), r || o(), s\r\n )\r\n },\r\n url: function () {\r\n var t = n.result(this, 'urlRoot') || n.result(this.collection, 'url') || N()\r\n if (this.isNew()) return t\r\n var e = this.get(this.idAttribute)\r\n return t.replace(/[^\\/]$/, '$&/') + encodeURIComponent(e)\r\n },\r\n parse: function (t, e) {\r\n return t\r\n },\r\n clone: function () {\r\n return new this.constructor(this.attributes)\r\n },\r\n isNew: function () {\r\n return !this.has(this.idAttribute)\r\n },\r\n isValid: function (t) {\r\n return this._validate({}, n.defaults({ validate: !0 }, t))\r\n },\r\n _validate: function (t, e) {\r\n if (!e.validate || !this.validate) return !0\r\n t = n.extend({}, this.attributes, t)\r\n var i = (this.validationError = this.validate(t, e) || null)\r\n return !i || (this.trigger('invalid', this, i, n.extend(e, { validationError: i })), !1)\r\n }\r\n }),\r\n s(\r\n v,\r\n { keys: 1, values: 1, pairs: 1, invert: 1, pick: 0, omit: 0, chain: 1, isEmpty: 1 },\r\n 'attributes'\r\n )\r\n var m = (e.Collection = function (t, e) {\r\n e || (e = {}),\r\n e.model && (this.model = e.model),\r\n void 0 !== e.comparator && (this.comparator = e.comparator),\r\n this._reset(),\r\n this.initialize.apply(this, arguments),\r\n t && this.reset(t, n.extend({ silent: !0 }, e))\r\n }),\r\n y = { add: !0, remove: !0, merge: !0 },\r\n b = { add: !0, remove: !1 }\r\n n.extend(m.prototype, a, {\r\n model: v,\r\n initialize: function () {},\r\n toJSON: function (t) {\r\n return this.map(function (e) {\r\n return e.toJSON(t)\r\n })\r\n },\r\n sync: function () {\r\n return e.sync.apply(this, arguments)\r\n },\r\n add: function (t, e) {\r\n return this.set(t, n.extend({ merge: !1 }, e, b))\r\n },\r\n remove: function (t, e) {\r\n e = n.extend({}, e)\r\n var i = !n.isArray(t)\r\n t = i ? [t] : n.clone(t)\r\n var r = this._removeModels(t, e)\r\n return !e.silent && r && this.trigger('update', this, e), i ? r[0] : r\r\n },\r\n set: function (t, e) {\r\n ;(e = n.defaults({}, e, y)).parse && !this._isModel(t) && (t = this.parse(t, e))\r\n var i,\r\n r,\r\n o,\r\n s,\r\n a,\r\n l = !n.isArray(t)\r\n t = l ? (t ? [t] : []) : t.slice()\r\n var c = e.at\r\n null != c && (c = +c), c < 0 && (c += this.length + 1)\r\n for (\r\n var u = this.comparator && null == c && !1 !== e.sort,\r\n h = n.isString(this.comparator) ? this.comparator : null,\r\n d = [],\r\n f = [],\r\n p = {},\r\n g = e.add,\r\n v = e.merge,\r\n m = e.remove,\r\n b = !(u || !g || !m) && [],\r\n x = !1,\r\n w = 0;\r\n w < t.length;\r\n w++\r\n ) {\r\n if (((o = t[w]), (s = this.get(o))))\r\n m && (p[s.cid] = !0),\r\n v &&\r\n o !== s &&\r\n ((o = this._isModel(o) ? o.attributes : o),\r\n e.parse && (o = s.parse(o, e)),\r\n s.set(o, e),\r\n u && !a && s.hasChanged(h) && (a = !0)),\r\n (t[w] = s)\r\n else if (g) {\r\n if (!(r = t[w] = this._prepareModel(o, e))) continue\r\n d.push(r), this._addReference(r, e)\r\n }\r\n ;(r = s || r) &&\r\n ((i = this.modelId(r.attributes)),\r\n !b ||\r\n (!r.isNew() && p[i]) ||\r\n (b.push(r), (x = x || !this.models[w] || r.cid !== this.models[w].cid)),\r\n (p[i] = !0))\r\n }\r\n if (m) {\r\n for (var w = 0; w < this.length; w++) p[(r = this.models[w]).cid] || f.push(r)\r\n f.length && this._removeModels(f, e)\r\n }\r\n if (d.length || x)\r\n if ((u && (a = !0), (this.length += d.length), null != c))\r\n for (var w = 0; w < d.length; w++) this.models.splice(c + w, 0, d[w])\r\n else {\r\n b && (this.models.length = 0)\r\n for (var C = b || d, w = 0; w < C.length; w++) this.models.push(C[w])\r\n }\r\n if ((a && this.sort({ silent: !0 }), !e.silent)) {\r\n for (var k = null != c ? n.clone(e) : e, w = 0; w < d.length; w++)\r\n null != c && (k.index = c + w), (r = d[w]).trigger('add', r, this, k)\r\n ;(a || x) && this.trigger('sort', this, e),\r\n (d.length || f.length) && this.trigger('update', this, e)\r\n }\r\n return l ? t[0] : t\r\n },\r\n reset: function (t, e) {\r\n e = e ? n.clone(e) : {}\r\n for (var i = 0; i < this.models.length; i++) this._removeReference(this.models[i], e)\r\n return (\r\n (e.previousModels = this.models),\r\n this._reset(),\r\n (t = this.add(t, n.extend({ silent: !0 }, e))),\r\n e.silent || this.trigger('reset', this, e),\r\n t\r\n )\r\n },\r\n push: function (t, e) {\r\n return this.add(t, n.extend({ at: this.length }, e))\r\n },\r\n pop: function (t) {\r\n var e = this.at(this.length - 1)\r\n return this.remove(e, t)\r\n },\r\n unshift: function (t, e) {\r\n return this.add(t, n.extend({ at: 0 }, e))\r\n },\r\n shift: function (t) {\r\n var e = this.at(0)\r\n return this.remove(e, t)\r\n },\r\n slice: function () {\r\n return o.apply(this.models, arguments)\r\n },\r\n get: function (t) {\r\n if (null != t) {\r\n var e = this.modelId(this._isModel(t) ? t.attributes : t)\r\n return this._byId[t] || this._byId[e] || this._byId[t.cid]\r\n }\r\n },\r\n at: function (t) {\r\n return t < 0 && (t += this.length), this.models[t]\r\n },\r\n where: function (t, e) {\r\n var i = n.matches(t)\r\n return this[e ? 'find' : 'filter'](function (t) {\r\n return i(t.attributes)\r\n })\r\n },\r\n findWhere: function (t) {\r\n return this.where(t, !0)\r\n },\r\n sort: function (t) {\r\n if (!this.comparator) throw new Error('Cannot sort a set without a comparator')\r\n return (\r\n t || (t = {}),\r\n n.isString(this.comparator) || 1 === this.comparator.length\r\n ? (this.models = this.sortBy(this.comparator, this))\r\n : this.models.sort(n.bind(this.comparator, this)),\r\n t.silent || this.trigger('sort', this, t),\r\n this\r\n )\r\n },\r\n pluck: function (t) {\r\n return n.invoke(this.models, 'get', t)\r\n },\r\n fetch: function (t) {\r\n var e = (t = n.extend({ parse: !0 }, t)).success,\r\n i = this\r\n return (\r\n (t.success = function (n) {\r\n var r = t.reset ? 'reset' : 'set'\r\n i[r](n, t), e && e.call(t.context, i, n, t), i.trigger('sync', i, n, t)\r\n }),\r\n D(this, t),\r\n this.sync('read', this, t)\r\n )\r\n },\r\n create: function (t, e) {\r\n var i = (e = e ? n.clone(e) : {}).wait\r\n if (!(t = this._prepareModel(t, e))) return !1\r\n i || this.add(t, e)\r\n var r = this,\r\n o = e.success\r\n return (\r\n (e.success = function (t, e, n) {\r\n i && r.add(t, n), o && o.call(n.context, t, e, n)\r\n }),\r\n t.save(null, e),\r\n t\r\n )\r\n },\r\n parse: function (t, e) {\r\n return t\r\n },\r\n clone: function () {\r\n return new this.constructor(this.models, { model: this.model, comparator: this.comparator })\r\n },\r\n modelId: function (t) {\r\n return t[this.model.prototype.idAttribute || 'id']\r\n },\r\n _reset: function () {\r\n ;(this.length = 0), (this.models = []), (this._byId = {})\r\n },\r\n _prepareModel: function (t, e) {\r\n if (this._isModel(t)) return t.collection || (t.collection = this), t\r\n ;(e = e ? n.clone(e) : {}).collection = this\r\n var i = new this.model(t, e)\r\n return i.validationError ? (this.trigger('invalid', this, i.validationError, e), !1) : i\r\n },\r\n _removeModels: function (t, e) {\r\n for (var n = [], i = 0; i < t.length; i++) {\r\n var r = this.get(t[i])\r\n if (r) {\r\n var o = this.indexOf(r)\r\n this.models.splice(o, 1),\r\n this.length--,\r\n e.silent || ((e.index = o), r.trigger('remove', r, this, e)),\r\n n.push(r),\r\n this._removeReference(r, e)\r\n }\r\n }\r\n return !!n.length && n\r\n },\r\n _isModel: function (t) {\r\n return t instanceof v\r\n },\r\n _addReference: function (t, e) {\r\n this._byId[t.cid] = t\r\n var n = this.modelId(t.attributes)\r\n null != n && (this._byId[n] = t), t.on('all', this._onModelEvent, this)\r\n },\r\n _removeReference: function (t, e) {\r\n delete this._byId[t.cid]\r\n var n = this.modelId(t.attributes)\r\n null != n && delete this._byId[n],\r\n this === t.collection && delete t.collection,\r\n t.off('all', this._onModelEvent, this)\r\n },\r\n _onModelEvent: function (t, e, n, i) {\r\n if (('add' !== t && 'remove' !== t) || n === this) {\r\n if (('destroy' === t && this.remove(e, i), 'change' === t)) {\r\n var r = this.modelId(e.previousAttributes()),\r\n o = this.modelId(e.attributes)\r\n r !== o && (null != r && delete this._byId[r], null != o && (this._byId[o] = e))\r\n }\r\n this.trigger.apply(this, arguments)\r\n }\r\n }\r\n }),\r\n s(\r\n m,\r\n {\r\n forEach: 3,\r\n each: 3,\r\n map: 3,\r\n collect: 3,\r\n reduce: 4,\r\n foldl: 4,\r\n inject: 4,\r\n reduceRight: 4,\r\n foldr: 4,\r\n find: 3,\r\n detect: 3,\r\n filter: 3,\r\n select: 3,\r\n reject: 3,\r\n every: 3,\r\n all: 3,\r\n some: 3,\r\n any: 3,\r\n include: 2,\r\n contains: 2,\r\n invoke: 0,\r\n max: 3,\r\n min: 3,\r\n toArray: 1,\r\n size: 1,\r\n first: 3,\r\n head: 3,\r\n take: 3,\r\n initial: 3,\r\n rest: 3,\r\n tail: 3,\r\n drop: 3,\r\n last: 3,\r\n without: 0,\r\n difference: 0,\r\n indexOf: 3,\r\n shuffle: 1,\r\n lastIndexOf: 3,\r\n isEmpty: 1,\r\n chain: 1,\r\n sample: 3,\r\n partition: 3\r\n },\r\n 'models'\r\n ),\r\n n.each(['groupBy', 'countBy', 'sortBy', 'indexBy'], function (t) {\r\n n[t] &&\r\n (m.prototype[t] = function (e, i) {\r\n var r = n.isFunction(e)\r\n ? e\r\n : function (t) {\r\n return t.get(e)\r\n }\r\n return n[t](this.models, r, i)\r\n })\r\n })\r\n var x = (e.View = function (t) {\r\n ;(this.cid = n.uniqueId('view')),\r\n n.extend(this, n.pick(t, C)),\r\n this._ensureElement(),\r\n this.initialize.apply(this, arguments)\r\n }),\r\n w = /^(\\S+)\\s*(.*)$/,\r\n C = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events']\r\n n.extend(x.prototype, a, {\r\n tagName: 'div',\r\n $: function (t) {\r\n return this.$el.find(t)\r\n },\r\n initialize: function () {},\r\n render: function () {\r\n return this\r\n },\r\n remove: function () {\r\n return this._removeElement(), this.stopListening(), this\r\n },\r\n _removeElement: function () {\r\n this.$el.remove()\r\n },\r\n setElement: function (t) {\r\n return this.undelegateEvents(), this._setElement(t), this.delegateEvents(), this\r\n },\r\n _setElement: function (t) {\r\n ;(this.$el = t instanceof e.$ ? t : e.$(t)), (this.el = this.$el[0])\r\n },\r\n delegateEvents: function (t) {\r\n if ((t || (t = n.result(this, 'events')), !t)) return this\r\n for (var e in (this.undelegateEvents(), t)) {\r\n var i = t[e]\r\n if ((n.isFunction(i) || (i = this[i]), i)) {\r\n var r = e.match(w)\r\n this.delegate(r[1], r[2], n.bind(i, this))\r\n }\r\n }\r\n return this\r\n },\r\n delegate: function (t, e, n) {\r\n return this.$el.on(t + '.delegateEvents' + this.cid, e, n), this\r\n },\r\n undelegateEvents: function () {\r\n return this.$el && this.$el.off('.delegateEvents' + this.cid), this\r\n },\r\n undelegate: function (t, e, n) {\r\n return this.$el.off(t + '.delegateEvents' + this.cid, e, n), this\r\n },\r\n _createElement: function (t) {\r\n return document.createElement(t)\r\n },\r\n _ensureElement: function () {\r\n if (this.el) this.setElement(n.result(this, 'el'))\r\n else {\r\n var t = n.extend({}, n.result(this, 'attributes'))\r\n this.id && (t.id = n.result(this, 'id')),\r\n this.className && (t.class = n.result(this, 'className')),\r\n this.setElement(this._createElement(n.result(this, 'tagName'))),\r\n this._setAttributes(t)\r\n }\r\n },\r\n _setAttributes: function (t) {\r\n this.$el.attr(t)\r\n }\r\n }),\r\n (e.sync = function (t, i, r) {\r\n var o = k[t]\r\n n.defaults(r || (r = {}), { emulateHTTP: e.emulateHTTP, emulateJSON: e.emulateJSON })\r\n var s = { type: o, dataType: 'json' }\r\n if (\r\n (r.url || (s.url = n.result(i, 'url') || N()),\r\n null != r.data ||\r\n !i ||\r\n ('create' !== t && 'update' !== t && 'patch' !== t) ||\r\n ((s.contentType = 'application/json'), (s.data = JSON.stringify(r.attrs || i.toJSON(r)))),\r\n r.emulateJSON &&\r\n ((s.contentType = 'application/x-www-form-urlencoded'),\r\n (s.data = s.data ? { model: s.data } : {})),\r\n r.emulateHTTP && ('PUT' === o || 'DELETE' === o || 'PATCH' === o))\r\n ) {\r\n ;(s.type = 'POST'), r.emulateJSON && (s.data._method = o)\r\n var a = r.beforeSend\r\n r.beforeSend = function (t) {\r\n if ((t.setRequestHeader('X-HTTP-Method-Override', o), a)) return a.apply(this, arguments)\r\n }\r\n }\r\n 'GET' === s.type || r.emulateJSON || (s.processData = !1)\r\n var l = r.error\r\n r.error = function (t, e, n) {\r\n ;(r.textStatus = e), (r.errorThrown = n), l && l.call(r.context, t, e, n)\r\n }\r\n var c = (r.xhr = e.ajax(n.extend(s, r)))\r\n return i.trigger('request', i, c, r), c\r\n })\r\n var k = { create: 'POST', update: 'PUT', patch: 'PATCH', delete: 'DELETE', read: 'GET' }\r\n e.ajax = function () {\r\n return e.$.ajax.apply(e.$, arguments)\r\n }\r\n var S = (e.Router = function (t) {\r\n t || (t = {}),\r\n t.routes && (this.routes = t.routes),\r\n this._bindRoutes(),\r\n this.initialize.apply(this, arguments)\r\n }),\r\n T = /\\((.*?)\\)/g,\r\n E = /(\\(\\?)?:\\w+/g,\r\n M = /\\*\\w+/g,\r\n A = /[\\-{}\\[\\]+?.,\\\\\\^$|#\\s]/g\r\n n.extend(S.prototype, a, {\r\n initialize: function () {},\r\n route: function (t, i, r) {\r\n n.isRegExp(t) || (t = this._routeToRegExp(t)),\r\n n.isFunction(i) && ((r = i), (i = '')),\r\n r || (r = this[i])\r\n var o = this\r\n return (\r\n e.history.route(t, function (n) {\r\n var s = o._extractParameters(t, n)\r\n !1 !== o.execute(r, s, i) &&\r\n (o.trigger.apply(o, ['route:' + i].concat(s)),\r\n o.trigger('route', i, s),\r\n e.history.trigger('route', o, i, s))\r\n }),\r\n this\r\n )\r\n },\r\n execute: function (t, e, n) {\r\n t && t.apply(this, e)\r\n },\r\n navigate: function (t, n) {\r\n return e.history.navigate(t, n), this\r\n },\r\n _bindRoutes: function () {\r\n if (this.routes) {\r\n this.routes = n.result(this, 'routes')\r\n for (var t, e = n.keys(this.routes); null != (t = e.pop()); ) this.route(t, this.routes[t])\r\n }\r\n },\r\n _routeToRegExp: function (t) {\r\n return (\r\n (t = t\r\n .replace(A, '\\\\$&')\r\n .replace(T, '(?:$1)?')\r\n .replace(E, function (t, e) {\r\n return e ? t : '([^/?]+)'\r\n })\r\n .replace(M, '([^?]*?)')),\r\n new RegExp('^' + t + '(?:\\\\?([\\\\s\\\\S]*))?$')\r\n )\r\n },\r\n _extractParameters: function (t, e) {\r\n var i = t.exec(e).slice(1)\r\n return n.map(i, function (t, e) {\r\n return e === i.length - 1 ? t || null : t ? decodeURIComponent(t) : null\r\n })\r\n }\r\n })\r\n var O = (e.History = function () {\r\n ;(this.handlers = []),\r\n n.bindAll(this, 'checkUrl'),\r\n 'undefined' != typeof window &&\r\n ((this.location = window.location), (this.history = window.history))\r\n }),\r\n P = /^[#\\/]|\\s+$/g,\r\n L = /^\\/+|\\/+$/g,\r\n _ = /#.*$/\r\n ;(O.started = !1),\r\n n.extend(O.prototype, a, {\r\n interval: 50,\r\n atRoot: function () {\r\n var t = this.location.pathname.replace(/[^\\/]$/, '$&/')\r\n return t === this.root && !this.getSearch()\r\n },\r\n matchRoot: function () {\r\n var t = this.decodeFragment(this.location.pathname),\r\n e = t.slice(0, this.root.length - 1) + '/'\r\n return e === this.root\r\n },\r\n decodeFragment: function (t) {\r\n return decodeURI(t.replace(/%25/g, '%2525'))\r\n },\r\n getSearch: function () {\r\n var t = this.location.href.replace(/#.*/, '').match(/\\?.+/)\r\n return t ? t[0] : ''\r\n },\r\n getHash: function (t) {\r\n var e = (t || this).location.href.match(/#(.*)$/)\r\n return e ? e[1] : ''\r\n },\r\n getPath: function () {\r\n var t = this.decodeFragment(this.location.pathname + this.getSearch()).slice(this.root.length - 1)\r\n return '/' === t.charAt(0) ? t.slice(1) : t\r\n },\r\n getFragment: function (t) {\r\n return (\r\n null == t &&\r\n (t = this._usePushState || !this._wantsHashChange ? this.getPath() : this.getHash()),\r\n t.replace(P, '')\r\n )\r\n },\r\n start: function (t) {\r\n if (O.started) throw new Error('Backbone.history has already been started')\r\n if (\r\n ((O.started = !0),\r\n (this.options = n.extend({ root: '/' }, this.options, t)),\r\n (this.root = this.options.root),\r\n (this._wantsHashChange = !1 !== this.options.hashChange),\r\n (this._hasHashChange = 'onhashchange' in window),\r\n (this._useHashChange = this._wantsHashChange && this._hasHashChange),\r\n (this._wantsPushState = !!this.options.pushState),\r\n (this._hasPushState = !(!this.history || !this.history.pushState)),\r\n (this._usePushState = this._wantsPushState && this._hasPushState),\r\n (this.fragment = this.getFragment()),\r\n (this.root = ('/' + this.root + '/').replace(L, '/')),\r\n this._wantsHashChange && this._wantsPushState)\r\n ) {\r\n if (!this._hasPushState && !this.atRoot()) {\r\n var e = this.root.slice(0, -1) || '/'\r\n return this.location.replace(e + '#' + this.getPath()), !0\r\n }\r\n this._hasPushState && this.atRoot() && this.navigate(this.getHash(), { replace: !0 })\r\n }\r\n if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {\r\n ;(this.iframe = document.createElement('iframe')),\r\n (this.iframe.src = 'javascript:0'),\r\n (this.iframe.style.display = 'none'),\r\n (this.iframe.tabIndex = -1)\r\n var i = document.body,\r\n r = i.insertBefore(this.iframe, i.firstChild).contentWindow\r\n r.document.open(), r.document.close(), (r.location.hash = '#' + this.fragment)\r\n }\r\n var o =\r\n window.addEventListener ||\r\n function (t, e) {\r\n return attachEvent('on' + t, e)\r\n }\r\n if (\r\n (this._usePushState\r\n ? o('popstate', this.checkUrl, !1)\r\n : this._useHashChange && !this.iframe\r\n ? o('hashchange', this.checkUrl, !1)\r\n : this._wantsHashChange &&\r\n (this._checkUrlInterval = setInterval(this.checkUrl, this.interval)),\r\n !this.options.silent)\r\n )\r\n return this.loadUrl()\r\n },\r\n stop: function () {\r\n var t =\r\n window.removeEventListener ||\r\n function (t, e) {\r\n return detachEvent('on' + t, e)\r\n }\r\n this._usePushState\r\n ? t('popstate', this.checkUrl, !1)\r\n : this._useHashChange && !this.iframe && t('hashchange', this.checkUrl, !1),\r\n this.iframe && (document.body.removeChild(this.iframe), (this.iframe = null)),\r\n this._checkUrlInterval && clearInterval(this._checkUrlInterval),\r\n (O.started = !1)\r\n },\r\n route: function (t, e) {\r\n this.handlers.unshift({ route: t, callback: e })\r\n },\r\n checkUrl: function (t) {\r\n var e = this.getFragment()\r\n if (\r\n (e === this.fragment && this.iframe && (e = this.getHash(this.iframe.contentWindow)),\r\n e === this.fragment)\r\n )\r\n return !1\r\n this.iframe && this.navigate(e), this.loadUrl()\r\n },\r\n loadUrl: function (t) {\r\n return (\r\n !!this.matchRoot() &&\r\n ((t = this.fragment = this.getFragment(t)),\r\n n.any(this.handlers, function (e) {\r\n if (e.route.test(t)) return e.callback(t), !0\r\n }))\r\n )\r\n },\r\n navigate: function (t, e) {\r\n if (!O.started) return !1\r\n ;(e && !0 !== e) || (e = { trigger: !!e }), (t = this.getFragment(t || ''))\r\n var n = this.root\r\n ;('' !== t && '?' !== t.charAt(0)) || (n = n.slice(0, -1) || '/')\r\n var i = n + t\r\n if (((t = this.decodeFragment(t.replace(_, ''))), this.fragment !== t)) {\r\n if (((this.fragment = t), this._usePushState))\r\n this.history[e.replace ? 'replaceState' : 'pushState']({}, document.title, i)\r\n else {\r\n if (!this._wantsHashChange) return this.location.assign(i)\r\n if (\r\n (this._updateHash(this.location, t, e.replace),\r\n this.iframe && t !== this.getHash(this.iframe.contentWindow))\r\n ) {\r\n var r = this.iframe.contentWindow\r\n e.replace || (r.document.open(), r.document.close()),\r\n this._updateHash(r.location, t, e.replace)\r\n }\r\n }\r\n return e.trigger ? this.loadUrl(t) : void 0\r\n }\r\n },\r\n _updateHash: function (t, e, n) {\r\n if (n) {\r\n var i = t.href.replace(/(javascript:|#).*$/, '')\r\n t.replace(i + '#' + e)\r\n } else t.hash = '#' + e\r\n }\r\n }),\r\n (e.history = new O()),\r\n (v.extend = m.extend = S.extend = x.extend = O.extend = function (t, e) {\r\n var i,\r\n r = this\r\n ;(i =\r\n t && n.has(t, 'constructor')\r\n ? t.constructor\r\n : function () {\r\n return r.apply(this, arguments)\r\n }),\r\n n.extend(i, r, e)\r\n var o = function () {\r\n this.constructor = i\r\n }\r\n return (\r\n (o.prototype = r.prototype),\r\n (i.prototype = new o()),\r\n t && n.extend(i.prototype, t),\r\n (i.__super__ = r.prototype),\r\n i\r\n )\r\n })\r\n var N = function () {\r\n throw new Error('A \"url\" property or function must be specified')\r\n },\r\n D = function (t, e) {\r\n var n = e.error\r\n e.error = function (i) {\r\n n && n.call(e.context, t, i, e), t.trigger('error', t, i, e)\r\n }\r\n }\r\n return e\r\n })(s, n, t, e)\r\n }.apply(e, r)) || (t.exports = o)\r\n }.call(this, n(8)))\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = function () {\r\n var t = {},\r\n e = n(101),\r\n i = n(102),\r\n r = n(103),\r\n o = void 0,\r\n s = {},\r\n a = {}\r\n return {\r\n name: 'StorageManager',\r\n init: function (n) {\r\n for (var s in ((o = (t = n || {}).em), e)) s in t || (t[s] = e[s])\r\n return (\r\n (a.remote = new r(t)),\r\n (a.local = new i(t)),\r\n (t.currentStorage = t.type),\r\n this.loadDefaultProviders().setCurrent(t.type),\r\n this\r\n )\r\n },\r\n getConfig: function () {\r\n return t\r\n },\r\n isAutosave: function () {\r\n return !!t.autosave\r\n },\r\n setAutosave: function (e) {\r\n return (t.autosave = !!e), this\r\n },\r\n getStepsBeforeSave: function () {\r\n return t.stepsBeforeSave\r\n },\r\n setStepsBeforeSave: function (e) {\r\n return (t.stepsBeforeSave = e), this\r\n },\r\n add: function (t, e) {\r\n return (s[t] = e), this\r\n },\r\n get: function (t) {\r\n return s[t] || null\r\n },\r\n getStorages: function () {\r\n return s\r\n },\r\n getCurrent: function () {\r\n return t.currentStorage\r\n },\r\n setCurrent: function (e) {\r\n return (t.currentStorage = e), this\r\n },\r\n store: function (e, n) {\r\n var i = this,\r\n r = this.get(this.getCurrent()),\r\n o = {}\r\n for (var s in (this.onStart('store', e), e)) o[t.id + s] = e[s]\r\n return r\r\n ? r.store(\r\n o,\r\n function (t) {\r\n n && n(t), i.onEnd('store', t)\r\n },\r\n function (t) {\r\n i.onError('store', t)\r\n }\r\n )\r\n : null\r\n },\r\n load: function (e, n) {\r\n var i = this,\r\n r = this.get(this.getCurrent()),\r\n o = [],\r\n s = {}\r\n 'string' == typeof e && (e = [e]), this.onStart('load', e)\r\n for (var a = 0, l = e.length; a < l; a++) o.push(t.id + e[a])\r\n r\r\n ? r.load(\r\n o,\r\n function (e) {\r\n var r = new RegExp('^' + t.id)\r\n for (var o in e) {\r\n var a = o.replace(r, '')\r\n s[a] = e[o]\r\n }\r\n n && n(s), i.onEnd('load', s)\r\n },\r\n function (t) {\r\n i.onError('load', t)\r\n }\r\n )\r\n : n && n(s)\r\n },\r\n loadDefaultProviders: function () {\r\n for (var t in a) this.add(t, a[t])\r\n return this\r\n },\r\n getCurrentStorage: function () {\r\n return this.get(this.getCurrent())\r\n },\r\n onStart: function (t, e) {\r\n o && (o.trigger('storage:start'), t && o.trigger('storage:start:' + t, e))\r\n },\r\n onEnd: function (t, e) {\r\n o && (o.trigger('storage:end'), t && o.trigger('storage:end:' + t, e))\r\n },\r\n onError: function (t, e) {\r\n o && (o.trigger('storage:error', e), t && o.trigger('storage:error:' + t, e), this.onEnd(t, e))\r\n },\r\n canAutoload: function () {\r\n return this.getCurrentStorage() && this.getConfig().autoload\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n id: 'gjs-',\r\n autosave: 1,\r\n autoload: 1,\r\n type: 'local',\r\n stepsBeforeSave: 1,\r\n storeComponents: 1,\r\n storeStyles: 1,\r\n storeHtml: 1,\r\n storeCss: 1,\r\n checkLocal: 1,\r\n params: {},\r\n headers: {},\r\n urlStore: '',\r\n urlLoad: '',\r\n beforeSend: function (t, e) {},\r\n onComplete: function (t, e) {},\r\n contentTypeJson: !1\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0)\r\n t.exports = i.Model.extend({\r\n defaults: { checkLocal: !0 },\r\n store: function (t, e) {\r\n for (var n in (this.checkStorageEnvironment(), t)) localStorage.setItem(n, t[n])\r\n 'function' == typeof e && e()\r\n },\r\n load: function (t, e) {\r\n this.checkStorageEnvironment()\r\n for (var n = {}, i = 0, r = t.length; i < r; i++) {\r\n var o = localStorage.getItem(t[i])\r\n o && (n[t[i]] = o)\r\n }\r\n return 'function' == typeof e && e(n), n\r\n },\r\n remove: function (t) {\r\n this.checkStorageEnvironment()\r\n for (var e = 0, n = t.length; e < n; e++) localStorage.removeItem(t[e])\r\n },\r\n checkStorageEnvironment: function () {\r\n this.get('checkLocal') && !localStorage && console.warn(\"Your browser doesn't support localStorage\")\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(47),\r\n o = (i = r) && i.__esModule ? i : { default: i },\r\n s = n(1)\r\n t.exports = n(0).Model.extend({\r\n fetch: o.default,\r\n defaults: {\r\n urlStore: '',\r\n urlLoad: '',\r\n params: {},\r\n beforeSend: function () {},\r\n onComplete: function () {},\r\n contentTypeJson: !1\r\n },\r\n onStart: function () {\r\n this.get('em')\r\n var t = this.get('beforeSend')\r\n t && t()\r\n },\r\n onError: function (t, e) {\r\n if (e) e(t)\r\n else {\r\n var n = this.get('em')\r\n console.error(t), n && n.trigger('storage:error', t)\r\n }\r\n },\r\n onResponse: function (t, e) {\r\n var n = this.get('em'),\r\n i = this.get('onComplete'),\r\n r = this.get('contentTypeJson') && (t && 'string' == typeof t) ? JSON.parse(t) : t\r\n i && i(r), e && e(r), n && n.trigger('storage:response', r)\r\n },\r\n store: function (t, e, n) {\r\n var i = {}\r\n for (var r in t) i[r] = t[r]\r\n this.request(this.get('urlStore'), { body: i }, e, n)\r\n },\r\n load: function (t, e, n) {\r\n this.request(this.get('urlLoad'), { method: 'get' }, e, n)\r\n },\r\n request: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = this,\r\n i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null,\r\n r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null,\r\n o = this.get('contentTypeJson'),\r\n a = this.get('headers') || {},\r\n l = this.get('params'),\r\n c = e.body || {},\r\n u = void 0,\r\n h = void 0\r\n for (var d in l) c[d] = l[d]\r\n if (\r\n ((0, s.isUndefined)(a['X-Requested-With']) && (a['X-Requested-With'] = 'XMLHttpRequest'),\r\n (0, s.isUndefined)(a['Content-Type']) && o && (a['Content-Type'] = 'application/json; charset=utf-8'),\r\n o)\r\n )\r\n h = JSON.stringify(c)\r\n else for (var f in ((h = new FormData()), c)) h.append(f, c[f])\r\n 'post' === (u = { method: e.method || 'post', credentials: 'include', headers: a }).method && (u.body = h),\r\n this.onStart(),\r\n this.fetch(t, u)\r\n .then(function (t) {\r\n return 1 == ((t.status / 200) | 0)\r\n ? t.text()\r\n : t.text().then(function (t) {\r\n return Promise.reject(t)\r\n })\r\n })\r\n .then(function (t) {\r\n return n.onResponse(t, i)\r\n })\r\n .catch(function (t) {\r\n return n.onError(t, r)\r\n })\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n ;(function (t) {\r\n Object.defineProperty(e, '__esModule', { value: !0 })\r\n var i,\r\n r =\r\n 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator\r\n ? function (t) {\r\n return typeof t\r\n }\r\n : function (t) {\r\n return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype\r\n ? 'symbol'\r\n : typeof t\r\n },\r\n o = n(108),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n var a = setTimeout\r\n function l () {}\r\n function c (t) {\r\n if (!(this instanceof c)) throw new TypeError('Promises must be constructed via new')\r\n if ('function' != typeof t) throw new TypeError('not a function')\r\n ;(this._state = 0), (this._handled = !1), (this._value = void 0), (this._deferreds = []), g(t, this)\r\n }\r\n function u (t, e) {\r\n for (; 3 === t._state; ) t = t._value\r\n 0 !== t._state\r\n ? ((t._handled = !0),\r\n c._immediateFn(function () {\r\n var n = 1 === t._state ? e.onFulfilled : e.onRejected\r\n if (null !== n) {\r\n var i\r\n try {\r\n i = n(t._value)\r\n } catch (t) {\r\n return void d(e.promise, t)\r\n }\r\n h(e.promise, i)\r\n } else (1 === t._state ? h : d)(e.promise, t._value)\r\n }))\r\n : t._deferreds.push(e)\r\n }\r\n function h (t, e) {\r\n try {\r\n if (e === t) throw new TypeError('A promise cannot be resolved with itself.')\r\n if (e && ('object' === (void 0 === e ? 'undefined' : r(e)) || 'function' == typeof e)) {\r\n var n = e.then\r\n if (e instanceof c) return (t._state = 3), (t._value = e), void f(t)\r\n if ('function' == typeof n)\r\n return void g(\r\n ((i = n),\r\n (o = e),\r\n function () {\r\n i.apply(o, arguments)\r\n }),\r\n t\r\n )\r\n }\r\n ;(t._state = 1), (t._value = e), f(t)\r\n } catch (e) {\r\n d(t, e)\r\n }\r\n var i, o\r\n }\r\n function d (t, e) {\r\n ;(t._state = 2), (t._value = e), f(t)\r\n }\r\n function f (t) {\r\n 2 === t._state &&\r\n 0 === t._deferreds.length &&\r\n c._immediateFn(function () {\r\n t._handled || c._unhandledRejectionFn(t._value)\r\n })\r\n for (var e = 0, n = t._deferreds.length; e < n; e++) u(t, t._deferreds[e])\r\n t._deferreds = null\r\n }\r\n function p (t, e, n) {\r\n ;(this.onFulfilled = 'function' == typeof t ? t : null),\r\n (this.onRejected = 'function' == typeof e ? e : null),\r\n (this.promise = n)\r\n }\r\n function g (t, e) {\r\n var n = !1\r\n try {\r\n t(\r\n function (t) {\r\n n || ((n = !0), h(e, t))\r\n },\r\n function (t) {\r\n n || ((n = !0), d(e, t))\r\n }\r\n )\r\n } catch (t) {\r\n if (n) return\r\n ;(n = !0), d(e, t)\r\n }\r\n }\r\n ;(c.prototype.catch = function (t) {\r\n return this.then(null, t)\r\n }),\r\n (c.prototype.then = function (t, e) {\r\n var n = new this.constructor(l)\r\n return u(this, new p(t, e, n)), n\r\n }),\r\n (c.prototype.finally = s.default),\r\n (c.all = function (t) {\r\n return new c(function (e, n) {\r\n if (!t || void 0 === t.length) throw new TypeError('Promise.all accepts an array')\r\n var i = Array.prototype.slice.call(t)\r\n if (0 === i.length) return e([])\r\n var o = i.length\r\n function s (t, a) {\r\n try {\r\n if (a && ('object' === (void 0 === a ? 'undefined' : r(a)) || 'function' == typeof a)) {\r\n var l = a.then\r\n if ('function' == typeof l)\r\n return void l.call(\r\n a,\r\n function (e) {\r\n s(t, e)\r\n },\r\n n\r\n )\r\n }\r\n ;(i[t] = a), 0 == --o && e(i)\r\n } catch (t) {\r\n n(t)\r\n }\r\n }\r\n for (var a = 0; a < i.length; a++) s(a, i[a])\r\n })\r\n }),\r\n (c.resolve = function (t) {\r\n return t && 'object' === (void 0 === t ? 'undefined' : r(t)) && t.constructor === c\r\n ? t\r\n : new c(function (e) {\r\n e(t)\r\n })\r\n }),\r\n (c.reject = function (t) {\r\n return new c(function (e, n) {\r\n n(t)\r\n })\r\n }),\r\n (c.race = function (t) {\r\n return new c(function (e, n) {\r\n for (var i = 0, r = t.length; i < r; i++) t[i].then(e, n)\r\n })\r\n }),\r\n (c._immediateFn =\r\n ('function' == typeof t &&\r\n function (e) {\r\n t(e)\r\n }) ||\r\n function (t) {\r\n a(t, 0)\r\n }),\r\n (c._unhandledRejectionFn = function (t) {\r\n 'undefined' != typeof console && console && console.warn('Possible Unhandled Promise Rejection:', t)\r\n }),\r\n (e.default = c)\r\n }.call(this, n(105).setImmediate))\r\n },\r\n function (t, e, n) {\r\n ;(function (t) {\r\n var i = (void 0 !== t && t) || ('undefined' != typeof self && self) || window,\r\n r = Function.prototype.apply\r\n function o (t, e) {\r\n ;(this._id = t), (this._clearFn = e)\r\n }\r\n ;(e.setTimeout = function () {\r\n return new o(r.call(setTimeout, i, arguments), clearTimeout)\r\n }),\r\n (e.setInterval = function () {\r\n return new o(r.call(setInterval, i, arguments), clearInterval)\r\n }),\r\n (e.clearTimeout = e.clearInterval = function (t) {\r\n t && t.close()\r\n }),\r\n (o.prototype.unref = o.prototype.ref = function () {}),\r\n (o.prototype.close = function () {\r\n this._clearFn.call(i, this._id)\r\n }),\r\n (e.enroll = function (t, e) {\r\n clearTimeout(t._idleTimeoutId), (t._idleTimeout = e)\r\n }),\r\n (e.unenroll = function (t) {\r\n clearTimeout(t._idleTimeoutId), (t._idleTimeout = -1)\r\n }),\r\n (e._unrefActive = e.active = function (t) {\r\n clearTimeout(t._idleTimeoutId)\r\n var e = t._idleTimeout\r\n e >= 0 &&\r\n (t._idleTimeoutId = setTimeout(function () {\r\n t._onTimeout && t._onTimeout()\r\n }, e))\r\n }),\r\n n(106),\r\n (e.setImmediate =\r\n ('undefined' != typeof self && self.setImmediate) ||\r\n (void 0 !== t && t.setImmediate) ||\r\n (this && this.setImmediate)),\r\n (e.clearImmediate =\r\n ('undefined' != typeof self && self.clearImmediate) ||\r\n (void 0 !== t && t.clearImmediate) ||\r\n (this && this.clearImmediate))\r\n }.call(this, n(8)))\r\n },\r\n function (t, e, n) {\r\n ;(function (t, e) {\r\n !(function (t, n) {\r\n 'use strict'\r\n if (!t.setImmediate) {\r\n var i,\r\n r,\r\n o,\r\n s,\r\n a,\r\n l = 1,\r\n c = {},\r\n u = !1,\r\n h = t.document,\r\n d = Object.getPrototypeOf && Object.getPrototypeOf(t)\r\n ;(d = d && d.setTimeout ? d : t),\r\n '[object process]' === {}.toString.call(t.process)\r\n ? (i = function (t) {\r\n e.nextTick(function () {\r\n p(t)\r\n })\r\n })\r\n : !(function () {\r\n if (t.postMessage && !t.importScripts) {\r\n var e = !0,\r\n n = t.onmessage\r\n return (\r\n (t.onmessage = function () {\r\n e = !1\r\n }),\r\n t.postMessage('', '*'),\r\n (t.onmessage = n),\r\n e\r\n )\r\n }\r\n })()\r\n ? t.MessageChannel\r\n ? (((o = new MessageChannel()).port1.onmessage = function (t) {\r\n p(t.data)\r\n }),\r\n (i = function (t) {\r\n o.port2.postMessage(t)\r\n }))\r\n : h && 'onreadystatechange' in h.createElement('script')\r\n ? ((r = h.documentElement),\r\n (i = function (t) {\r\n var e = h.createElement('script')\r\n ;(e.onreadystatechange = function () {\r\n p(t), (e.onreadystatechange = null), r.removeChild(e), (e = null)\r\n }),\r\n r.appendChild(e)\r\n }))\r\n : (i = function (t) {\r\n setTimeout(p, 0, t)\r\n })\r\n : ((s = 'setImmediate$' + Math.random() + '$'),\r\n (a = function (e) {\r\n e.source === t && 'string' == typeof e.data && 0 === e.data.indexOf(s) && p(+e.data.slice(s.length))\r\n }),\r\n t.addEventListener ? t.addEventListener('message', a, !1) : t.attachEvent('onmessage', a),\r\n (i = function (e) {\r\n t.postMessage(s + e, '*')\r\n })),\r\n (d.setImmediate = function (t) {\r\n 'function' != typeof t && (t = new Function('' + t))\r\n for (var e = new Array(arguments.length - 1), n = 0; n < e.length; n++) e[n] = arguments[n + 1]\r\n var r = { callback: t, args: e }\r\n return (c[l] = r), i(l), l++\r\n }),\r\n (d.clearImmediate = f)\r\n }\r\n function f (t) {\r\n delete c[t]\r\n }\r\n function p (t) {\r\n if (u) setTimeout(p, 0, t)\r\n else {\r\n var e = c[t]\r\n if (e) {\r\n u = !0\r\n try {\r\n !(function (t) {\r\n var e = t.callback,\r\n i = t.args\r\n switch (i.length) {\r\n case 0:\r\n e()\r\n break\r\n case 1:\r\n e(i[0])\r\n break\r\n case 2:\r\n e(i[0], i[1])\r\n break\r\n case 3:\r\n e(i[0], i[1], i[2])\r\n break\r\n default:\r\n e.apply(n, i)\r\n }\r\n })(e)\r\n } finally {\r\n f(t), (u = !1)\r\n }\r\n }\r\n }\r\n }\r\n })('undefined' == typeof self ? (void 0 === t ? this : t) : self)\r\n }.call(this, n(8), n(107)))\r\n },\r\n function (t, e) {\r\n var n,\r\n i,\r\n r = (t.exports = {})\r\n function o () {\r\n throw new Error('setTimeout has not been defined')\r\n }\r\n function s () {\r\n throw new Error('clearTimeout has not been defined')\r\n }\r\n function a (t) {\r\n if (n === setTimeout) return setTimeout(t, 0)\r\n if ((n === o || !n) && setTimeout) return (n = setTimeout), setTimeout(t, 0)\r\n try {\r\n return n(t, 0)\r\n } catch (e) {\r\n try {\r\n return n.call(null, t, 0)\r\n } catch (e) {\r\n return n.call(this, t, 0)\r\n }\r\n }\r\n }\r\n !(function () {\r\n try {\r\n n = 'function' == typeof setTimeout ? setTimeout : o\r\n } catch (t) {\r\n n = o\r\n }\r\n try {\r\n i = 'function' == typeof clearTimeout ? clearTimeout : s\r\n } catch (t) {\r\n i = s\r\n }\r\n })()\r\n var l,\r\n c = [],\r\n u = !1,\r\n h = -1\r\n function d () {\r\n u && l && ((u = !1), l.length ? (c = l.concat(c)) : (h = -1), c.length && f())\r\n }\r\n function f () {\r\n if (!u) {\r\n var t = a(d)\r\n u = !0\r\n for (var e = c.length; e; ) {\r\n for (l = c, c = []; ++h < e; ) l && l[h].run()\r\n ;(h = -1), (e = c.length)\r\n }\r\n ;(l = null),\r\n (u = !1),\r\n (function (t) {\r\n if (i === clearTimeout) return clearTimeout(t)\r\n if ((i === s || !i) && clearTimeout) return (i = clearTimeout), clearTimeout(t)\r\n try {\r\n i(t)\r\n } catch (e) {\r\n try {\r\n return i.call(null, t)\r\n } catch (e) {\r\n return i.call(this, t)\r\n }\r\n }\r\n })(t)\r\n }\r\n }\r\n function p (t, e) {\r\n ;(this.fun = t), (this.array = e)\r\n }\r\n function g () {}\r\n ;(r.nextTick = function (t) {\r\n var e = new Array(arguments.length - 1)\r\n if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) e[n - 1] = arguments[n]\r\n c.push(new p(t, e)), 1 !== c.length || u || a(f)\r\n }),\r\n (p.prototype.run = function () {\r\n this.fun.apply(null, this.array)\r\n }),\r\n (r.title = 'browser'),\r\n (r.browser = !0),\r\n (r.env = {}),\r\n (r.argv = []),\r\n (r.version = ''),\r\n (r.versions = {}),\r\n (r.on = g),\r\n (r.addListener = g),\r\n (r.once = g),\r\n (r.off = g),\r\n (r.removeListener = g),\r\n (r.removeAllListeners = g),\r\n (r.emit = g),\r\n (r.prependListener = g),\r\n (r.prependOnceListener = g),\r\n (r.listeners = function (t) {\r\n return []\r\n }),\r\n (r.binding = function (t) {\r\n throw new Error('process.binding is not supported')\r\n }),\r\n (r.cwd = function () {\r\n return '/'\r\n }),\r\n (r.chdir = function (t) {\r\n throw new Error('process.chdir is not supported')\r\n }),\r\n (r.umask = function () {\r\n return 0\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n Object.defineProperty(e, '__esModule', { value: !0 }),\r\n (e.default = function (t) {\r\n var e = this.constructor\r\n return this.then(\r\n function (n) {\r\n return e.resolve(t()).then(function () {\r\n return n\r\n })\r\n },\r\n function (n) {\r\n return e.resolve(t()).then(function () {\r\n return e.reject(n)\r\n })\r\n }\r\n )\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = function () {\r\n var t,\r\n e,\r\n i = {},\r\n r = n(110),\r\n o = n(111),\r\n s = n(113)\r\n return {\r\n name: 'DeviceManager',\r\n init: function (n) {\r\n for (var a in ((i = n || {}), r)) a in i || (i[a] = r[a])\r\n return (t = new o(i.devices)), (e = new s({ collection: t, config: i })), this\r\n },\r\n add: function (e, n, i) {\r\n var r = i || {}\r\n return (r.name = e), (r.width = n), t.add(r)\r\n },\r\n get: function (e) {\r\n return t.get(e)\r\n },\r\n getAll: function () {\r\n return t\r\n },\r\n render: function () {\r\n return e.render().el\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = { devices: [], deviceLabel: 'Device' }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n var s = n(112)\r\n t.exports = o.default.Collection.extend({\r\n model: s,\r\n comparator: function (t, e) {\r\n var n = Number.MAX_VALUE\r\n return (e.get('priority') || n) - (t.get('priority') || n)\r\n },\r\n getSorted: function () {\r\n return this.sort()\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n t.exports = o.default.Model.extend({\r\n idAttribute: 'name',\r\n defaults: { name: '', width: '', height: '', widthMedia: null, priority: null },\r\n initialize: function () {\r\n null == this.get('widthMedia') && this.set('widthMedia', this.get('width')),\r\n this.get('priority') || this.set('priority', parseFloat(this.get('widthMedia')) || 0)\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = o(n(1)),\r\n r = o(n(0))\r\n function o (t) {\r\n return t && t.__esModule ? t : { default: t }\r\n }\r\n t.exports = r.default.View.extend({\r\n template: i.default.template(\r\n '\\n
device-label\"><%= deviceLabel %>
\\n
field <%= ppfx %>select\">\\n input-holder\">\\n \\n \\n
sel-arrow\">\\n
d-s-arrow\">
\\n
\\n
\\n '\r\n ),\r\n events: { change: 'updateDevice' },\r\n initialize: function (t) {\r\n ;(this.config = t.config || {}),\r\n (this.em = this.config.em),\r\n (this.ppfx = this.config.pStylePrefix || ''),\r\n (this.events['click .' + this.ppfx + 'add-trasp'] = this.startAdd),\r\n this.listenTo(this.em, 'change:device', this.updateSelect),\r\n this.delegateEvents()\r\n },\r\n startAdd: function () {},\r\n updateDevice: function () {\r\n var t = this.em\r\n if (t) {\r\n var e = this.devicesEl,\r\n n = e ? e.val() : ''\r\n t.set('device', n)\r\n }\r\n },\r\n updateSelect: function () {\r\n var t = this.em,\r\n e = this.devicesEl\r\n if (t && t.getDeviceModel && e) {\r\n var n = t.getDeviceModel(),\r\n i = n ? n.get('name') : ''\r\n e.val(i)\r\n }\r\n },\r\n getOptions: function () {\r\n var t = ''\r\n return (\r\n this.collection.each(function (e) {\r\n var n = e.get('name')\r\n t += ''\r\n }),\r\n t\r\n )\r\n },\r\n render: function () {\r\n var t = this.ppfx\r\n return (\r\n this.$el.html(this.template({ ppfx: t, deviceLabel: this.config.deviceLabel })),\r\n (this.devicesEl = this.$el.find('.' + t + 'devices')),\r\n this.devicesEl.append(this.getOptions()),\r\n (this.el.className = t + 'devices-c'),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n }\r\n t.exports = function () {\r\n var t = {},\r\n e = n(115),\r\n r = n(116),\r\n o = n(48),\r\n s = void 0,\r\n a = void 0\r\n return {\r\n compTypes: '',\r\n parserCss: null,\r\n parserHtml: null,\r\n name: 'Parser',\r\n getConfig: function () {\r\n return t\r\n },\r\n init: function () {\r\n var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n return ((t = i({}, e, n)).Parser = this), (s = new o(t)), (a = new r(t)), (this.em = t.em), this\r\n },\r\n parseHtml: function (t) {\r\n var e = this.em,\r\n n = this.compTypes\r\n return (s.compTypes = e ? e.get('DomComponents').getTypes() : n), s.parse(t, a)\r\n },\r\n parseCss: function (t) {\r\n return a.parse(t)\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = { textTags: ['br', 'b', 'i', 'u', 'a', 'ul', 'ol'], parserCss: null, parserHtml: null }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(1),\r\n o = n(117),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n t.exports = function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n return {\r\n parse: function (e) {\r\n var n = this,\r\n i = [],\r\n r = t.parserCss,\r\n o = t.em,\r\n a = void 0 === o ? {} : o,\r\n l = a && a.get && a.get('Editor')\r\n return (\r\n (r ? r(e, l) : (0, s.default)(e)).forEach(function (t) {\r\n return (i = i.concat(n.checkNode(t)))\r\n }),\r\n i\r\n )\r\n },\r\n checkNode: function (t) {\r\n var e = t,\r\n n = e.selectors,\r\n i = e.style\r\n if ((0, r.isString)(n)) {\r\n var s = [],\r\n a = (0, o.parseSelector)(n),\r\n l = a.result,\r\n c = a.add.join(', '),\r\n u = { atRule: t.atRule, mediaText: t.params }\r\n if (\r\n (l.length\r\n ? l.forEach(function (t) {\r\n s.push((0, o.createNode)(t, i, u))\r\n })\r\n : s.push((0, o.createNode)([], i, u)),\r\n c)\r\n )\r\n s[s.length - 1].selectorsAdd = c\r\n t = s\r\n }\r\n return t\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n Object.defineProperty(e, '__esModule', { value: !0 }),\r\n (e.parseNode = e.createNode = e.parseCondition = e.parseStyle = e.parseSelector = void 0)\r\n var i = n(1),\r\n r = {\r\n 4: 'media',\r\n 5: 'font-face',\r\n 6: 'page',\r\n 7: 'keyframes',\r\n 11: 'counter-style',\r\n 12: 'supports',\r\n 13: 'document',\r\n 14: 'font-feature-values',\r\n 15: 'viewport'\r\n },\r\n o = (0, i.keys)(r),\r\n s = ['5', '6', '11', '15'],\r\n a = ['font-face', 'page', 'counter-style', 'viewport'],\r\n l = (e.parseSelector = function () {\r\n for (\r\n var t = [],\r\n e = [],\r\n n = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '').split(','),\r\n i = 0,\r\n r = n.length;\r\n i < r;\r\n i++\r\n ) {\r\n var o = n[i].trim()\r\n if (/^(\\.{1}[\\w\\-]+)+(:{1,2}[\\w\\-()]+)?$/gi.test(o) || /^(#{1}[\\w\\-]+){1}(:{1,2}[\\w\\-()]+)?$/gi.test(o)) {\r\n var s = o.split('.').filter(Boolean)\r\n e.push(s)\r\n } else t.push(o)\r\n }\r\n return { result: e, add: t }\r\n }),\r\n c = (e.parseStyle = function (t) {\r\n for (var e = t.style, n = {}, i = 0, r = e.length; i < r; i++) {\r\n var o = e[i],\r\n s = e.getPropertyValue(o),\r\n a = e.getPropertyPriority(o)\r\n n[o] = s + (a ? ' !' + a : '')\r\n }\r\n return n\r\n }),\r\n u = (e.parseCondition = function (t) {\r\n return (t.conditionText || (t.media && t.media.mediaText) || t.name || t.selectorText || '').trim()\r\n }),\r\n h = (e.createNode = function (t, e) {\r\n var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},\r\n i = {},\r\n r = t.length,\r\n o = t[r - 1],\r\n s = o ? o.split(/:(.+)/) : [],\r\n l = s[1],\r\n c = n.atRule,\r\n u = n.selectorsAdd,\r\n h = n.mediaText\r\n return (\r\n a.indexOf(c) >= 0 && (i.singleAtRule = 1),\r\n c && (i.atRuleType = c),\r\n u && (i.selectorsAdd = u),\r\n h && (i.mediaText = h),\r\n l && ((t[r - 1] = s[0]), (i.state = l), s.splice(s.length - 1, 1)),\r\n (i.selectors = t),\r\n (i.style = e),\r\n i\r\n )\r\n }),\r\n d = (e.parseNode = function t (e) {\r\n for (var n = [], i = e.cssRules || [], a = 0, d = i.length; a < d; a++) {\r\n var f = i[a],\r\n p = f.type.toString(),\r\n g = 0,\r\n v = '',\r\n m = '',\r\n y = f.selectorText || f.keyText,\r\n b = s.indexOf(p) >= 0\r\n if (b) (g = 1), (v = r[p]), (m = u(f))\r\n else if (o.indexOf(p) >= 0) {\r\n var x = t(f)\r\n m = u(f)\r\n for (var w = 0, C = x.length; w < C; w++) {\r\n var k = x[w]\r\n m && (k.mediaText = m), (k.atRuleType = r[p])\r\n }\r\n n = n.concat(x)\r\n }\r\n if (y || b) {\r\n for (var S = c(f), T = l(y), E = T.add, M = void 0, A = 0, O = (y = T.result).length; A < O; A++) {\r\n var P = h(y[A], S, { atRule: r[p] })\r\n n.push(P), (M = P)\r\n }\r\n if (E.length) {\r\n var L = E.join(', ')\r\n if (M) M.selectorsAdd = L\r\n else {\r\n var _ = { selectors: [], selectorsAdd: L, style: S }\r\n g && (_.singleAtRule = g), v && (_.atRuleType = v), m && (_.mediaText = m), n.push(_)\r\n }\r\n }\r\n }\r\n }\r\n return n\r\n })\r\n e.default = function (t) {\r\n var e = document.createElement('style')\r\n ;(e.innerHTML = t), document.head.appendChild(e)\r\n var n = e.sheet\r\n return document.head.removeChild(e), d(n)\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n stylePrefix: 'sm-',\r\n sectors: [],\r\n appendTo: '',\r\n textNoElement: 'Select an element before using Style Manager',\r\n hideNotStylable: !0,\r\n highlightChanged: !0,\r\n highlightComputed: !0,\r\n showComputed: !0,\r\n clearProperties: 0,\r\n avoidComputed: ['width', 'height']\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(120)\r\n t.exports = n(0).Collection.extend({ model: i })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1),\r\n r = n(0),\r\n o = n(14),\r\n s = n(130)\r\n t.exports = r.Model.extend({\r\n defaults: { id: '', name: '', open: !0, buildProps: '', extendBuilded: 1, properties: [] },\r\n initialize: function (t) {\r\n var e = t || {},\r\n n = [],\r\n i = this.buildProperties(e.buildProps)\r\n !this.get('id') && this.set('id', this.get('name')),\r\n (n = i ? this.extendProperties(i) : this.get('properties'))\r\n var r = new o(n)\r\n ;(r.sector = this), this.set('properties', r)\r\n },\r\n extendProperties: function (t, e, n) {\r\n for (\r\n var r = t.length,\r\n o = e || this.get('properties'),\r\n s = this.get('extendBuilded'),\r\n a = [],\r\n l = 0,\r\n c = o.length;\r\n l < c;\r\n l++\r\n ) {\r\n for (var u = o[l], h = 0, d = 0; d < r; d++) {\r\n var f = t[d]\r\n if (u.property != f.property && u.id != f.property);\r\n else {\r\n var p = u.properties\r\n p && p.length && (u.properties = this.extendProperties(f.properties || [], p, 1)),\r\n (t[d] = s ? (0, i.extend)(f, u) : u),\r\n (a[d] = t[d]),\r\n (h = 1)\r\n }\r\n }\r\n h || (t.push(u), a.push(u))\r\n }\r\n return n ? a : t\r\n },\r\n buildProperties: function (t) {\r\n var e = t || []\r\n if (e.length) return this.propFactory || (this.propFactory = new s()), this.propFactory.build(e)\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(51),\r\n o = n(122)\r\n t.exports = r.extend({\r\n defaults: i({}, r.prototype.defaults, { layers: [], layerSeparator: ', ', preview: 0 }),\r\n initialize: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n r.callParentInit(r, this, t, e)\r\n var n = this.get('layers'),\r\n i = new o(n)\r\n ;(i.property = this), (i.properties = this.get('properties')), this.set('layers', i), r.callInit(this, t, e)\r\n },\r\n getLayers: function () {\r\n return this.get('layers')\r\n },\r\n getCurrentLayer: function () {\r\n return this.getLayers().filter(function (t) {\r\n return t.get('active')\r\n })[0]\r\n },\r\n getFullValue: function () {\r\n return this.get('detached') ? '' : this.get('layers').getFullValue()\r\n },\r\n getLayersFromTarget: function (t) {}\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n o = n(0),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n var a = n(123)\r\n t.exports = s.default.Collection.extend({\r\n model: a,\r\n initialize: function () {\r\n ;(this.idx = 1), this.on('add', this.onAdd), this.on('reset', this.onReset)\r\n },\r\n onAdd: function (t, e, n) {\r\n n.noIncrement || t.set('index', this.idx++)\r\n },\r\n onReset: function () {\r\n this.idx = 1\r\n },\r\n getSeparator: function () {\r\n var t = this.property\r\n return t ? t.get('layerSeparator') : ', '\r\n },\r\n getLayersFromValue: function (t) {\r\n var e = this,\r\n n = []\r\n return (\r\n t.replace(/\\(([\\w\\s,.]*)\\)/g, function (e) {\r\n var n = e.replace(/,\\s*/g, ',')\r\n t = t.replace(e, n)\r\n }),\r\n (t ? t.split(this.getSeparator()) : []).forEach(function (t) {\r\n n.push({ properties: e.properties.parseValue(t) })\r\n }),\r\n n\r\n )\r\n },\r\n getLayersFromStyle: function (t) {\r\n var e = [],\r\n n = this.properties\r\n n.pluck('property')\r\n return (\r\n n.each(function (n) {\r\n var i = t[n.get('property')]\r\n ;(i ? i.split(', ') : []).forEach(function (t, i) {\r\n t = n.parseValue(t.trim()).value\r\n var o = e[i],\r\n s = r({}, n.attributes, { value: t })\r\n o ? o.properties.push(s) : (e[i] = { properties: [s] })\r\n })\r\n }),\r\n e.forEach(function (t) {\r\n var e = t.properties.map(function (t) {\r\n return t.property\r\n })\r\n n.each(function (n) {\r\n var i = n.get('property')\r\n e.indexOf(i) < 0 && t.properties.push(r({}, n.attributes))\r\n })\r\n }),\r\n e\r\n )\r\n },\r\n active: function (t) {\r\n this.each(function (t) {\r\n return t.set('active', 0)\r\n })\r\n var e = this.at(t)\r\n e && e.set('active', 1)\r\n },\r\n getFullValue: function () {\r\n var t = []\r\n return (\r\n this.each(function (e) {\r\n return t.push(e.getFullValue())\r\n }),\r\n t.join(this.getSeparator())\r\n )\r\n },\r\n getPropertyValues: function (t) {\r\n var e = []\r\n return (\r\n this.each(function (n) {\r\n var i = n.getPropertyValue(t)\r\n i && e.push(i)\r\n }),\r\n e.join(', ')\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n t.exports = o.default.Model.extend({\r\n defaults: { index: '', value: '', values: {}, active: !1, preview: !1, properties: [] },\r\n initialize: function () {\r\n var t = this,\r\n e = n(14),\r\n i = this.get('properties'),\r\n r = this.get('value')\r\n if (\r\n (this.set('properties', i instanceof e ? i : new e(i)),\r\n this.get('properties').forEach(function (e) {\r\n var n = t.collection\r\n e.parent = n && n.property\r\n }),\r\n !r)\r\n ) {\r\n var o = '',\r\n s = this.get('values')\r\n for (var a in s) o += ' ' + s[a]\r\n this.set('value', o.trim())\r\n }\r\n },\r\n getPropertyAt: function (t) {\r\n return this.get('properties').at(t)\r\n },\r\n getPropertyValue: function (t) {\r\n var e = ''\r\n return (\r\n this.get('properties').each(function (n) {\r\n n.get('property') == t && (e = n.getFullValue())\r\n }),\r\n e\r\n )\r\n },\r\n getFullValue: function () {\r\n var t = []\r\n return (\r\n this.get('properties').each(function (e) {\r\n return t.push(e.getFullValue())\r\n }),\r\n t.join(' ')\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n Object.defineProperty(e, '__esModule', { value: !0 })\r\n var i =\r\n 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator\r\n ? function (t) {\r\n return typeof t\r\n }\r\n : function (t) {\r\n return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype\r\n ? 'symbol'\r\n : typeof t\r\n }\r\n e.default = function (t, e) {\r\n var n = {\r\n beforeShow: h,\r\n move: h,\r\n change: h,\r\n show: h,\r\n hide: h,\r\n color: !1,\r\n flat: !1,\r\n showInput: !1,\r\n allowEmpty: !1,\r\n showButtons: !0,\r\n clickoutFiresChange: !0,\r\n showInitial: !1,\r\n showPalette: !1,\r\n showPaletteOnly: !1,\r\n hideAfterPaletteSelect: !1,\r\n togglePaletteOnly: !1,\r\n showSelectionPalette: !0,\r\n localStorageKey: !1,\r\n appendTo: 'body',\r\n maxSelectionSize: 7,\r\n cancelText: 'cancel',\r\n chooseText: 'choose',\r\n togglePaletteMoreText: 'more',\r\n togglePaletteLessText: 'less',\r\n clearText: 'Clear Color Selection',\r\n noColorSelectedText: 'No Color Selected',\r\n preferredFormat: !1,\r\n className: '',\r\n containerClassName: '',\r\n replacerClassName: '',\r\n showAlpha: !1,\r\n theme: 'sp-light',\r\n palette: [\r\n ['#ffffff', '#000000', '#ff0000', '#ff8000', '#ffff00', '#008000', '#0000ff', '#4b0082', '#9400d3']\r\n ],\r\n selectionPalette: [],\r\n disabled: !1,\r\n offset: null\r\n },\r\n r = [],\r\n o = !!/msie/i.exec(window.navigator.userAgent),\r\n s = (function () {\r\n function t (t, e) {\r\n return !!~('' + t).indexOf(e)\r\n }\r\n var e = document.createElement('div').style\r\n return (\r\n (e.cssText = 'background-color:rgba(0,0,0,.5)'),\r\n t(e.backgroundColor, 'rgba') || t(e.backgroundColor, 'hsla')\r\n )\r\n })(),\r\n a = [\r\n \"
\",\r\n \"
\",\r\n \"
▼
\",\r\n '
'\r\n ].join(''),\r\n l = (function () {\r\n var t = ''\r\n if (o) for (var e = 1; e <= 6; e++) t += \"\"\r\n return [\r\n \"
\",\r\n \"
\",\r\n \"\",\r\n \"
\",\r\n \"\",\r\n '
',\r\n '
',\r\n \"
\",\r\n \"
\",\r\n \"\",\r\n \"
\",\r\n \"
\",\r\n \"
\",\r\n \"
\",\r\n \"\",\r\n '
',\r\n '
',\r\n '
',\r\n \"
\",\r\n '
',\r\n \"
\",\r\n \"\",\r\n t,\r\n '
',\r\n '
',\r\n \"
\",\r\n '
',\r\n \"
\",\r\n \"\",\r\n '
',\r\n \"\",\r\n \"
\",\r\n \"\",\r\n \"\",\r\n '
',\r\n '
',\r\n '
'\r\n ].join('')\r\n })()\r\n function c (e, n, i, r) {\r\n for (var o = [], a = 0; a < e.length; a++) {\r\n var l = e[a]\r\n if (l) {\r\n var c = S(l),\r\n u = c.toHsl().l < 0.5 ? 'sp-thumb-el sp-thumb-dark' : 'sp-thumb-el sp-thumb-light'\r\n u += S.equals(n, l) ? ' sp-thumb-active' : ''\r\n var h = c.toString(r.preferredFormat || 'rgb'),\r\n d = s ? 'background-color:' + c.toRgbString() : 'filter:' + c.toFilter()\r\n o.push(\r\n ''\r\n )\r\n } else {\r\n o.push(\r\n t('')\r\n .append(\r\n t(\r\n ''\r\n ).attr('title', r.noColorSelectedText)\r\n )\r\n .html()\r\n )\r\n }\r\n }\r\n return \"
\" + o.join('') + '
'\r\n }\r\n function u (i, u) {\r\n var h,\r\n v,\r\n m,\r\n y,\r\n b = (function (e, i) {\r\n var r = t.extend({}, n, e)\r\n return (\r\n (r.callbacks = {\r\n move: f(r.move, i),\r\n change: f(r.change, i),\r\n show: f(r.show, i),\r\n hide: f(r.hide, i),\r\n beforeShow: f(r.beforeShow, i)\r\n }),\r\n r\r\n )\r\n })(u, i),\r\n x = b.flat,\r\n w = b.showSelectionPalette,\r\n C = b.localStorageKey,\r\n k = b.theme,\r\n T = b.callbacks,\r\n E = ((h = Wt),\r\n (v = 10),\r\n function () {\r\n var t = this,\r\n e = arguments\r\n m && clearTimeout(y),\r\n (!m && y) ||\r\n (y = setTimeout(function () {\r\n ;(y = null), h.apply(t, e)\r\n }, v))\r\n }),\r\n M = !1,\r\n A = !1,\r\n O = 0,\r\n P = 0,\r\n L = 0,\r\n _ = 0,\r\n N = 0,\r\n D = 0,\r\n I = 0,\r\n F = 0,\r\n j = 0,\r\n R = 0,\r\n z = 1,\r\n V = [],\r\n H = [],\r\n $ = {},\r\n B = b.selectionPalette.slice(0),\r\n W = b.maxSelectionSize,\r\n U = 'sp-dragging',\r\n q = null,\r\n K = i.ownerDocument,\r\n Y = (K.body, t(i)),\r\n G = !1,\r\n X = t(l, K).addClass(k),\r\n J = X.find('.sp-picker-container'),\r\n Z = X.find('.sp-color'),\r\n Q = X.find('.sp-dragger'),\r\n tt = X.find('.sp-hue'),\r\n et = X.find('.sp-slider'),\r\n nt = X.find('.sp-alpha-inner'),\r\n it = X.find('.sp-alpha'),\r\n rt = X.find('.sp-alpha-handle'),\r\n ot = X.find('.sp-input'),\r\n st = X.find('.sp-palette'),\r\n at = X.find('.sp-initial'),\r\n lt = X.find('.sp-cancel'),\r\n ct = X.find('.sp-clear'),\r\n ut = X.find('.sp-choose'),\r\n ht = X.find('.sp-palette-toggle'),\r\n dt = Y.is('input'),\r\n ft = dt && 'color' === Y.attr('type') && g(),\r\n pt = dt && !x,\r\n gt = pt\r\n ? t(a)\r\n .addClass(k)\r\n .addClass(b.className)\r\n .addClass(b.replacerClassName)\r\n : t([]),\r\n vt = pt ? gt : Y,\r\n mt = gt.find('.sp-preview-inner'),\r\n yt = b.color || (dt && Y.val()),\r\n bt = !1,\r\n xt = b.preferredFormat,\r\n wt = !b.showButtons || b.clickoutFiresChange,\r\n Ct = !yt,\r\n kt = b.allowEmpty && !ft\r\n function St () {\r\n if (\r\n (b.showPaletteOnly && (b.showPalette = !0),\r\n ht.text(b.showPaletteOnly ? b.togglePaletteMoreText : b.togglePaletteLessText),\r\n b.palette)\r\n ) {\r\n ;(V = b.palette.slice(0)), (H = t.isArray(V[0]) ? V : [V]), ($ = {})\r\n for (var e = 0; e < H.length; e++)\r\n for (var n = 0; n < H[e].length; n++) {\r\n var i = S(H[e][n]).toRgbString()\r\n $[i] = !0\r\n }\r\n }\r\n X.toggleClass('sp-flat', x),\r\n X.toggleClass('sp-input-disabled', !b.showInput),\r\n X.toggleClass('sp-alpha-enabled', b.showAlpha),\r\n X.toggleClass('sp-clear-enabled', kt),\r\n X.toggleClass('sp-buttons-disabled', !b.showButtons),\r\n X.toggleClass('sp-palette-buttons-disabled', !b.togglePaletteOnly),\r\n X.toggleClass('sp-palette-disabled', !b.showPalette),\r\n X.toggleClass('sp-palette-only', b.showPaletteOnly),\r\n X.toggleClass('sp-initial-disabled', !b.showInitial),\r\n X.addClass(b.className).addClass(b.containerClassName),\r\n Wt()\r\n }\r\n function Tt () {\r\n if (C && window.localStorage) {\r\n try {\r\n var e = window.localStorage[C].split(',#')\r\n e.length > 1 &&\r\n (delete window.localStorage[C],\r\n t.each(e, function (t, e) {\r\n Et(e)\r\n }))\r\n } catch (t) {}\r\n try {\r\n B = window.localStorage[C].split(';')\r\n } catch (t) {}\r\n }\r\n }\r\n function Et (e) {\r\n if (w) {\r\n var n = S(e).toRgbString()\r\n if (!$[n] && -1 === t.inArray(n, B)) for (B.push(n); B.length > W; ) B.shift()\r\n if (C && window.localStorage)\r\n try {\r\n window.localStorage[C] = B.join(';')\r\n } catch (t) {}\r\n }\r\n }\r\n function Mt () {\r\n var e = zt(),\r\n n = t.map(H, function (t, n) {\r\n return c(t, e, 'sp-palette-row sp-palette-row-' + n, b)\r\n })\r\n Tt(),\r\n B &&\r\n n.push(\r\n c(\r\n (function () {\r\n var t = []\r\n if (b.showPalette)\r\n for (var e = 0; e < B.length; e++) {\r\n var n = S(B[e]).toRgbString()\r\n $[n] || t.push(B[e])\r\n }\r\n return t.reverse().slice(0, b.maxSelectionSize)\r\n })(),\r\n e,\r\n 'sp-palette-row sp-palette-row-selection',\r\n b\r\n )\r\n ),\r\n st.html(n.join(''))\r\n }\r\n function At () {\r\n if (b.showInitial) {\r\n var t = bt,\r\n e = zt()\r\n at.html(c([t, e], e, 'sp-palette-row-initial', b))\r\n }\r\n }\r\n function Ot () {\r\n ;(P <= 0 || O <= 0 || _ <= 0) && Wt(),\r\n (A = !0),\r\n X.addClass(U),\r\n (q = null),\r\n Y.trigger('dragstart.spectrum', [zt()])\r\n }\r\n function Pt () {\r\n ;(A = !1), X.removeClass(U), Y.trigger('dragstop.spectrum', [zt()])\r\n }\r\n function Lt () {\r\n var t = ot.val()\r\n if ((null !== t && '' !== t) || !kt) {\r\n var e = S(t)\r\n e.isValid() ? (Rt(e), Bt(!0)) : ot.addClass('sp-validation-error')\r\n } else Rt(null), Bt(!0)\r\n }\r\n function _t () {\r\n M ? Ft() : Nt()\r\n }\r\n function Nt () {\r\n var e = t.Event('beforeShow.spectrum')\r\n if (M) Wt()\r\n else if ((Y.trigger(e, [zt()]), !1 !== T.beforeShow(zt()) && !e.isDefaultPrevented())) {\r\n !(function () {\r\n for (var t = 0; t < r.length; t++) r[t] && r[t].hide()\r\n })(),\r\n (M = !0)\r\n var n = t(K)\r\n n.bind('keydown.spectrum', Dt),\r\n n.bind('click.spectrum', It),\r\n t(window).bind('resize.spectrum', E),\r\n gt.addClass('sp-active'),\r\n X.removeClass('sp-hidden'),\r\n Wt(),\r\n Ht(),\r\n (bt = zt()),\r\n At(),\r\n T.show(bt),\r\n Y.trigger('show.spectrum', [bt])\r\n }\r\n }\r\n function Dt (t) {\r\n 27 === t.keyCode && Ft()\r\n }\r\n function It (t) {\r\n 2 != t.button && (A || (wt ? Bt(!0) : jt(), Ft()))\r\n }\r\n function Ft () {\r\n M &&\r\n !x &&\r\n ((M = !1),\r\n t(K).unbind('keydown.spectrum', Dt),\r\n t(K).unbind('click.spectrum', It),\r\n t(window).unbind('resize.spectrum', E),\r\n gt.removeClass('sp-active'),\r\n X.addClass('sp-hidden'),\r\n T.hide(zt()),\r\n Y.trigger('hide.spectrum', [zt()]))\r\n }\r\n function jt () {\r\n Rt(bt, !0)\r\n }\r\n function Rt (t, e) {\r\n var n, i\r\n S.equals(t, zt())\r\n ? Ht()\r\n : (!t && kt\r\n ? (Ct = !0)\r\n : ((Ct = !1), (i = (n = S(t)).toHsv()), (F = (i.h % 360) / 360), (j = i.s), (R = i.v), (z = i.a)),\r\n Ht(),\r\n n && n.isValid() && !e && (xt = b.preferredFormat || n.getFormat()))\r\n }\r\n function zt (t) {\r\n return (\r\n (t = t || {}),\r\n kt && Ct\r\n ? null\r\n : S.fromRatio({ h: F, s: j, v: R, a: Math.round(100 * z) / 100 }, { format: t.format || xt })\r\n )\r\n }\r\n function Vt () {\r\n Ht(), T.move(zt()), Y.trigger('move.spectrum', [zt()])\r\n }\r\n function Ht () {\r\n ot.removeClass('sp-validation-error'), $t()\r\n var t = S.fromRatio({ h: F, s: 1, v: 1 })\r\n Z.css('background-color', t.toHexString())\r\n var e = xt\r\n z < 1 &&\r\n (0 !== z || 'name' !== e) &&\r\n (('hex' !== e && 'hex3' !== e && 'hex6' !== e && 'name' !== e) || (e = 'rgb'))\r\n var n = zt({ format: e }),\r\n i = ''\r\n if ((mt.removeClass('sp-clear-display'), mt.css('background-color', 'transparent'), !n && kt))\r\n mt.addClass('sp-clear-display')\r\n else {\r\n var r = n.toHexString(),\r\n a = n.toRgbString()\r\n if (\r\n (s || 1 === n.alpha\r\n ? mt.css('background-color', a)\r\n : (mt.css('background-color', 'transparent'), mt.css('filter', n.toFilter())),\r\n b.showAlpha)\r\n ) {\r\n var l = n.toRgb()\r\n l.a = 0\r\n var c = S(l).toRgbString(),\r\n u = 'linear-gradient(left, ' + c + ', ' + r + ')'\r\n o\r\n ? nt.css('filter', S(c).toFilter({ gradientType: 1 }, r))\r\n : (nt.css('background', '-webkit-' + u),\r\n nt.css('background', '-moz-' + u),\r\n nt.css('background', '-ms-' + u),\r\n nt.css('background', 'linear-gradient(to right, ' + c + ', ' + r + ')'))\r\n }\r\n i = n.toString(e)\r\n }\r\n b.showInput && ot.val(i), b.showPalette && Mt(), At()\r\n }\r\n function $t () {\r\n var t = j,\r\n e = R\r\n if (kt && Ct) rt.hide(), et.hide(), Q.hide()\r\n else {\r\n rt.show(), et.show(), Q.show()\r\n var n = t * O,\r\n i = P - e * P\r\n ;(n = Math.max(-L, Math.min(O - L, n - L))),\r\n (i = Math.max(-L, Math.min(P - L, i - L))),\r\n Q.css({ top: i + 'px', left: n + 'px' })\r\n var r = z * N\r\n rt.css({ left: r - D / 2 + 'px' })\r\n var o = F * _\r\n et.css({ top: o - I + 'px' })\r\n }\r\n }\r\n function Bt (t) {\r\n var e = zt(),\r\n n = '',\r\n i = !S.equals(e, bt)\r\n e && ((n = e.toString(xt)), Et(e)), dt && Y.val(n), t && i && (T.change(e), Y.trigger('change', [e]))\r\n }\r\n function Wt () {\r\n var e, n, i, r, o, s, a, l, c, u, h, d, f, p\r\n M &&\r\n ((O = Z.width()),\r\n (P = Z.height()),\r\n (L = Q.height()),\r\n tt.width(),\r\n (_ = tt.height()),\r\n (I = et.height()),\r\n (N = it.width()),\r\n (D = rt.width()),\r\n x ||\r\n (X.css('position', 'absolute'),\r\n b.offset\r\n ? X.offset(b.offset)\r\n : X.offset(\r\n ((n = vt),\r\n (i = (e = X).outerWidth()),\r\n (r = e.outerHeight()),\r\n (o = n.outerHeight()),\r\n (s = e[0].ownerDocument),\r\n (a = s.documentElement),\r\n (l = a.clientWidth),\r\n (c = a.clientHeight),\r\n (u = t(s).scrollLeft()),\r\n (h = t(s).scrollTop()),\r\n (d = l + u),\r\n (f = c + h),\r\n ((p = n.offset()).top += o),\r\n (p.left -= Math.min(p.left, p.left + i > d && d > i ? Math.abs(p.left + i - d) : 0)),\r\n (p.top -= Math.min(p.top, p.top + r > f && f > r ? Math.abs(r + o - 0) : 0)),\r\n p)\r\n )),\r\n $t(),\r\n b.showPalette && Mt(),\r\n Y.trigger('reflow.spectrum'))\r\n }\r\n function Ut () {\r\n Ft(), (G = !0), Y.attr('disabled', !0), vt.addClass('sp-disabled')\r\n }\r\n !(function () {\r\n if (\r\n (o && X.find('*:not(input)').attr('unselectable', 'on'),\r\n St(),\r\n pt && Y.after(gt).hide(),\r\n kt || ct.hide(),\r\n x)\r\n )\r\n Y.after(X).hide()\r\n else {\r\n var e = 'parent' === b.appendTo ? Y.parent() : t(b.appendTo)\r\n 1 !== e.length && (e = t('body')), e.append(X)\r\n }\r\n function n (e) {\r\n return (\r\n e.data && e.data.ignore\r\n ? (Rt(\r\n t(e.target)\r\n .closest('.sp-thumb-el')\r\n .data('color')\r\n ),\r\n Vt())\r\n : (Rt(\r\n t(e.target)\r\n .closest('.sp-thumb-el')\r\n .data('color')\r\n ),\r\n Vt(),\r\n Bt(!0),\r\n b.hideAfterPaletteSelect && Ft()),\r\n !1\r\n )\r\n }\r\n Tt(),\r\n vt.bind('click.spectrum touchstart.spectrum', function (e) {\r\n G || _t(), e.stopPropagation(), t(e.target).is('input') || e.preventDefault()\r\n }),\r\n (Y.is(':disabled') || !0 === b.disabled) && Ut(),\r\n X.click(d),\r\n ot.change(Lt),\r\n ot.bind('paste', function () {\r\n setTimeout(Lt, 1)\r\n }),\r\n ot.keydown(function (t) {\r\n 13 == t.keyCode && Lt()\r\n }),\r\n lt.text(b.cancelText),\r\n lt.bind('click.spectrum', function (t) {\r\n t.stopPropagation(), t.preventDefault(), jt(), Ft()\r\n }),\r\n ct.attr('title', b.clearText),\r\n ct.bind('click.spectrum', function (t) {\r\n t.stopPropagation(), t.preventDefault(), (Ct = !0), Vt(), x && Bt(!0)\r\n }),\r\n ut.text(b.chooseText),\r\n ut.bind('click.spectrum', function (t) {\r\n t.stopPropagation(),\r\n t.preventDefault(),\r\n o && ot.is(':focus') && ot.trigger('change'),\r\n ot.hasClass('sp-validation-error') || (Bt(!0), Ft())\r\n }),\r\n ht.text(b.showPaletteOnly ? b.togglePaletteMoreText : b.togglePaletteLessText),\r\n ht.bind('click.spectrum', function (t) {\r\n t.stopPropagation(),\r\n t.preventDefault(),\r\n (b.showPaletteOnly = !b.showPaletteOnly),\r\n b.showPaletteOnly || x || X.css('left', '-=' + (J.outerWidth(!0) + 5)),\r\n St()\r\n }),\r\n p(\r\n it,\r\n function (t, e, n) {\r\n ;(z = t / N), (Ct = !1), n.shiftKey && (z = Math.round(10 * z) / 10), Vt()\r\n },\r\n Ot,\r\n Pt\r\n ),\r\n p(\r\n tt,\r\n function (t, e) {\r\n ;(F = parseFloat(e / _)), (Ct = !1), b.showAlpha || (z = 1), Vt()\r\n },\r\n Ot,\r\n Pt\r\n ),\r\n p(\r\n Z,\r\n function (t, e, n) {\r\n if (n.shiftKey) {\r\n if (!q) {\r\n var i = j * O,\r\n r = P - R * P,\r\n o = Math.abs(t - i) > Math.abs(e - r)\r\n q = o ? 'x' : 'y'\r\n }\r\n } else q = null\r\n var s = !q || 'y' === q\r\n ;(!q || 'x' === q) && (j = parseFloat(t / O)),\r\n s && (R = parseFloat((P - e) / P)),\r\n (Ct = !1),\r\n b.showAlpha || (z = 1),\r\n Vt()\r\n },\r\n Ot,\r\n Pt\r\n ),\r\n yt ? (Rt(yt), Ht(), (xt = b.preferredFormat || S(yt).format), Et(yt)) : Ht(),\r\n x && Nt()\r\n var i = o ? 'mousedown.spectrum' : 'click.spectrum touchstart.spectrum'\r\n st.delegate('.sp-thumb-el', i, n), at.delegate('.sp-thumb-el:nth-child(1)', i, { ignore: !0 }, n)\r\n })()\r\n var qt = {\r\n show: Nt,\r\n hide: Ft,\r\n toggle: _t,\r\n reflow: Wt,\r\n option: function (n, i) {\r\n return n === e\r\n ? t.extend({}, b)\r\n : i === e\r\n ? b[n]\r\n : ((b[n] = i), 'preferredFormat' === n && (xt = b.preferredFormat), void St())\r\n },\r\n enable: function () {\r\n ;(G = !1), Y.attr('disabled', !1), vt.removeClass('sp-disabled')\r\n },\r\n disable: Ut,\r\n offset: function (t) {\r\n ;(b.offset = t), Wt()\r\n },\r\n set: function (t) {\r\n Rt(t), Bt()\r\n },\r\n get: zt,\r\n destroy: function () {\r\n Y.show(), vt.unbind('click.spectrum touchstart.spectrum'), X.remove(), gt.remove(), (r[qt.id] = null)\r\n },\r\n container: X\r\n }\r\n return (qt.id = r.push(qt) - 1), qt\r\n }\r\n function h () {}\r\n function d (t) {\r\n t.stopPropagation()\r\n }\r\n function f (t, e) {\r\n var n = Array.prototype.slice,\r\n i = n.call(arguments, 2)\r\n return function () {\r\n return t.apply(e, i.concat(n.call(arguments)))\r\n }\r\n }\r\n function p (e, n, i, r) {\r\n ;(n = n || function () {}), (i = i || function () {}), (r = r || function () {})\r\n var s = document,\r\n a = !1,\r\n l = {},\r\n c = 0,\r\n u = 0,\r\n h = 'ontouchstart' in window,\r\n d = {}\r\n function f (t) {\r\n t.stopPropagation && t.stopPropagation(), t.preventDefault && t.preventDefault(), (t.returnValue = !1)\r\n }\r\n function p (t) {\r\n if (a) {\r\n if (o && s.documentMode < 9 && !t.button) return g()\r\n var i = t && t.touches && t.touches[0],\r\n r = (i && i.pageX) || t.pageX,\r\n d = (i && i.pageY) || t.pageY,\r\n p = Math.max(0, Math.min(r - l.left, u)),\r\n v = Math.max(0, Math.min(d - l.top, c))\r\n h && f(t), n.apply(e, [p, v, t])\r\n }\r\n }\r\n function g () {\r\n a &&\r\n (t(s).unbind(d),\r\n t(s.body).removeClass('sp-dragging'),\r\n setTimeout(function () {\r\n r.apply(e, arguments)\r\n }, 0)),\r\n (a = !1)\r\n }\r\n ;(d.selectstart = f),\r\n (d.dragstart = f),\r\n (d['touchmove mousemove'] = p),\r\n (d['touchend mouseup'] = g),\r\n t(e).bind('touchstart mousedown', function (n) {\r\n ;(n.which ? 3 == n.which : 2 == n.button) ||\r\n a ||\r\n (!1 !== i.apply(e, arguments) &&\r\n ((a = !0),\r\n (c = t(e).height()),\r\n (u = t(e).width()),\r\n (l = t(e).offset()),\r\n t(s).bind(d),\r\n t(s.body).addClass('sp-dragging'),\r\n p(n),\r\n f(n)))\r\n })\r\n }\r\n function g () {\r\n return t.fn.spectrum.inputTypeColorSupport()\r\n }\r\n ;(t.fn.spectrum = function (e, n) {\r\n if ('string' == typeof e) {\r\n var i = this,\r\n o = Array.prototype.slice.call(arguments, 1)\r\n return (\r\n this.each(function () {\r\n var n = r[t(this).data('spectrum.id')]\r\n if (n) {\r\n var s = n[e]\r\n if (!s) throw new Error(\"Spectrum: no such method: '\" + e + \"'\")\r\n 'get' == e\r\n ? (i = n.get())\r\n : 'container' == e\r\n ? (i = n.container)\r\n : 'option' == e\r\n ? (i = n.option.apply(n, o))\r\n : 'destroy' == e\r\n ? (n.destroy(), t(this).removeData('spectrum.id'))\r\n : s.apply(n, o)\r\n }\r\n }),\r\n i\r\n )\r\n }\r\n return this.spectrum('destroy').each(function () {\r\n var n = u(this, t.extend({}, e, t(this).data()))\r\n t(this).data('spectrum.id', n.id)\r\n })\r\n }),\r\n (t.fn.spectrum.load = !0),\r\n (t.fn.spectrum.loadOpts = {}),\r\n (t.fn.spectrum.draggable = p),\r\n (t.fn.spectrum.defaults = n),\r\n (t.fn.spectrum.inputTypeColorSupport = function e () {\r\n if (void 0 === e._cachedResult) {\r\n var n = t(\"\")[0]\r\n e._cachedResult = 'color' === n.type && '' !== n.value\r\n }\r\n return e._cachedResult\r\n }),\r\n (t.spectrum = {}),\r\n (t.spectrum.localization = {}),\r\n (t.spectrum.palettes = {}),\r\n (t.fn.spectrum.processNativeColorInputs = function () {\r\n var e = t('input[type=color]')\r\n e.length && !g() && e.spectrum({ preferredFormat: 'hex6' })\r\n })\r\n var v = /^[\\s,#]+/,\r\n m = /\\s+$/,\r\n y = 0,\r\n b = Math,\r\n x = b.round,\r\n w = b.min,\r\n C = b.max,\r\n k = b.random,\r\n S = function t (e, n) {\r\n if (((n = n || {}), (e = e || '') instanceof t)) return e\r\n if (!(this instanceof t)) return new t(e, n)\r\n var r = (function (t) {\r\n var e = { r: 0, g: 0, b: 0 },\r\n n = 1,\r\n r = !1,\r\n o = !1\r\n 'string' == typeof t &&\r\n (t = (function (t) {\r\n t = t\r\n .replace(v, '')\r\n .replace(m, '')\r\n .toLowerCase()\r\n var e,\r\n n = !1\r\n if ($[t]) (t = $[t]), (n = !0)\r\n else if ('transparent' == t) return { r: 0, g: 0, b: 0, a: 0, format: 'name' }\r\n if ((e = Q.rgb.exec(t))) return { r: e[1], g: e[2], b: e[3] }\r\n if ((e = Q.rgba.exec(t))) return { r: e[1], g: e[2], b: e[3], a: e[4] }\r\n if ((e = Q.hsl.exec(t))) return { h: e[1], s: e[2], l: e[3] }\r\n if ((e = Q.hsla.exec(t))) return { h: e[1], s: e[2], l: e[3], a: e[4] }\r\n if ((e = Q.hsv.exec(t))) return { h: e[1], s: e[2], v: e[3] }\r\n if ((e = Q.hsva.exec(t))) return { h: e[1], s: e[2], v: e[3], a: e[4] }\r\n if ((e = Q.hex8.exec(t)))\r\n return {\r\n a: ((i = e[1]), K(i) / 255),\r\n r: K(e[2]),\r\n g: K(e[3]),\r\n b: K(e[4]),\r\n format: n ? 'name' : 'hex8'\r\n }\r\n var i\r\n if ((e = Q.hex6.exec(t))) return { r: K(e[1]), g: K(e[2]), b: K(e[3]), format: n ? 'name' : 'hex' }\r\n if ((e = Q.hex3.exec(t)))\r\n return {\r\n r: K(e[1] + '' + e[1]),\r\n g: K(e[2] + '' + e[2]),\r\n b: K(e[3] + '' + e[3]),\r\n format: n ? 'name' : 'hex'\r\n }\r\n return !1\r\n })(t))\r\n 'object' == (void 0 === t ? 'undefined' : i(t)) &&\r\n (t.hasOwnProperty('r') && t.hasOwnProperty('g') && t.hasOwnProperty('b')\r\n ? ((s = t.r),\r\n (a = t.g),\r\n (l = t.b),\r\n (e = { r: 255 * U(s, 255), g: 255 * U(a, 255), b: 255 * U(l, 255) }),\r\n (r = !0),\r\n (o = '%' === String(t.r).substr(-1) ? 'prgb' : 'rgb'))\r\n : t.hasOwnProperty('h') && t.hasOwnProperty('s') && t.hasOwnProperty('v')\r\n ? ((t.s = G(t.s)),\r\n (t.v = G(t.v)),\r\n (e = (function (t, e, n) {\r\n ;(t = 6 * U(t, 360)), (e = U(e, 100)), (n = U(n, 100))\r\n var i = b.floor(t),\r\n r = t - i,\r\n o = n * (1 - e),\r\n s = n * (1 - r * e),\r\n a = n * (1 - (1 - r) * e),\r\n l = i % 6\r\n return {\r\n r: 255 * [n, s, o, o, a, n][l],\r\n g: 255 * [a, n, n, s, o, o][l],\r\n b: 255 * [o, o, a, n, n, s][l]\r\n }\r\n })(t.h, t.s, t.v)),\r\n (r = !0),\r\n (o = 'hsv'))\r\n : t.hasOwnProperty('h') &&\r\n t.hasOwnProperty('s') &&\r\n t.hasOwnProperty('l') &&\r\n ((t.s = G(t.s)),\r\n (t.l = G(t.l)),\r\n (e = (function (t, e, n) {\r\n var i, r, o\r\n function s (t, e, n) {\r\n return (\r\n n < 0 && (n += 1),\r\n n > 1 && (n -= 1),\r\n n < 1 / 6 ? t + 6 * (e - t) * n : n < 0.5 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t\r\n )\r\n }\r\n if (((t = U(t, 360)), (e = U(e, 100)), (n = U(n, 100)), 0 === e)) i = r = o = n\r\n else {\r\n var a = n < 0.5 ? n * (1 + e) : n + e - n * e,\r\n l = 2 * n - a\r\n ;(i = s(l, a, t + 1 / 3)), (r = s(l, a, t)), (o = s(l, a, t - 1 / 3))\r\n }\r\n return { r: 255 * i, g: 255 * r, b: 255 * o }\r\n })(t.h, t.s, t.l)),\r\n (r = !0),\r\n (o = 'hsl')),\r\n t.hasOwnProperty('a') && (n = t.a))\r\n var s, a, l\r\n return (\r\n (n = W(n)),\r\n { ok: r, format: t.format || o, r: w(255, C(e.r, 0)), g: w(255, C(e.g, 0)), b: w(255, C(e.b, 0)), a: n }\r\n )\r\n })(e)\r\n ;(this._originalInput = e),\r\n (this._r = r.r),\r\n (this._g = r.g),\r\n (this._b = r.b),\r\n (this._a = r.a),\r\n (this._roundA = x(100 * this._a) / 100),\r\n (this._format = n.format || r.format),\r\n (this._gradientType = n.gradientType),\r\n this._r < 1 && (this._r = x(this._r)),\r\n this._g < 1 && (this._g = x(this._g)),\r\n this._b < 1 && (this._b = x(this._b)),\r\n (this._ok = r.ok),\r\n (this._tc_id = y++)\r\n }\r\n function T (t, e, n) {\r\n ;(t = U(t, 255)), (e = U(e, 255)), (n = U(n, 255))\r\n var i,\r\n r,\r\n o = C(t, e, n),\r\n s = w(t, e, n),\r\n a = (o + s) / 2\r\n if (o == s) i = r = 0\r\n else {\r\n var l = o - s\r\n switch (((r = a > 0.5 ? l / (2 - o - s) : l / (o + s)), o)) {\r\n case t:\r\n i = (e - n) / l + (e < n ? 6 : 0)\r\n break\r\n case e:\r\n i = (n - t) / l + 2\r\n break\r\n case n:\r\n i = (t - e) / l + 4\r\n }\r\n i /= 6\r\n }\r\n return { h: i, s: r, l: a }\r\n }\r\n function E (t, e, n) {\r\n ;(t = U(t, 255)), (e = U(e, 255)), (n = U(n, 255))\r\n var i,\r\n r,\r\n o = C(t, e, n),\r\n s = w(t, e, n),\r\n a = o,\r\n l = o - s\r\n if (((r = 0 === o ? 0 : l / o), o == s)) i = 0\r\n else {\r\n switch (o) {\r\n case t:\r\n i = (e - n) / l + (e < n ? 6 : 0)\r\n break\r\n case e:\r\n i = (n - t) / l + 2\r\n break\r\n case n:\r\n i = (t - e) / l + 4\r\n }\r\n i /= 6\r\n }\r\n return { h: i, s: r, v: a }\r\n }\r\n function M (t, e, n, i) {\r\n var r = [Y(x(t).toString(16)), Y(x(e).toString(16)), Y(x(n).toString(16))]\r\n return i &&\r\n r[0].charAt(0) == r[0].charAt(1) &&\r\n r[1].charAt(0) == r[1].charAt(1) &&\r\n r[2].charAt(0) == r[2].charAt(1)\r\n ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0)\r\n : r.join('')\r\n }\r\n function A (t, e, n, i) {\r\n var r\r\n return [\r\n Y(((r = i), Math.round(255 * parseFloat(r)).toString(16))),\r\n Y(x(t).toString(16)),\r\n Y(x(e).toString(16)),\r\n Y(x(n).toString(16))\r\n ].join('')\r\n }\r\n function O (t, e) {\r\n e = 0 === e ? 0 : e || 10\r\n var n = S(t).toHsl()\r\n return (n.s -= e / 100), (n.s = q(n.s)), S(n)\r\n }\r\n function P (t, e) {\r\n e = 0 === e ? 0 : e || 10\r\n var n = S(t).toHsl()\r\n return (n.s += e / 100), (n.s = q(n.s)), S(n)\r\n }\r\n function L (t) {\r\n return S(t).desaturate(100)\r\n }\r\n function _ (t, e) {\r\n e = 0 === e ? 0 : e || 10\r\n var n = S(t).toHsl()\r\n return (n.l += e / 100), (n.l = q(n.l)), S(n)\r\n }\r\n function N (t, e) {\r\n e = 0 === e ? 0 : e || 10\r\n var n = S(t).toRgb()\r\n return (\r\n (n.r = C(0, w(255, n.r - x((-e / 100) * 255)))),\r\n (n.g = C(0, w(255, n.g - x((-e / 100) * 255)))),\r\n (n.b = C(0, w(255, n.b - x((-e / 100) * 255)))),\r\n S(n)\r\n )\r\n }\r\n function D (t, e) {\r\n e = 0 === e ? 0 : e || 10\r\n var n = S(t).toHsl()\r\n return (n.l -= e / 100), (n.l = q(n.l)), S(n)\r\n }\r\n function I (t, e) {\r\n var n = S(t).toHsl(),\r\n i = (x(n.h) + e) % 360\r\n return (n.h = i < 0 ? 360 + i : i), S(n)\r\n }\r\n function F (t) {\r\n var e = S(t).toHsl()\r\n return (e.h = (e.h + 180) % 360), S(e)\r\n }\r\n function j (t) {\r\n var e = S(t).toHsl(),\r\n n = e.h\r\n return [S(t), S({ h: (n + 120) % 360, s: e.s, l: e.l }), S({ h: (n + 240) % 360, s: e.s, l: e.l })]\r\n }\r\n function R (t) {\r\n var e = S(t).toHsl(),\r\n n = e.h\r\n return [\r\n S(t),\r\n S({ h: (n + 90) % 360, s: e.s, l: e.l }),\r\n S({ h: (n + 180) % 360, s: e.s, l: e.l }),\r\n S({ h: (n + 270) % 360, s: e.s, l: e.l })\r\n ]\r\n }\r\n function z (t) {\r\n var e = S(t).toHsl(),\r\n n = e.h\r\n return [S(t), S({ h: (n + 72) % 360, s: e.s, l: e.l }), S({ h: (n + 216) % 360, s: e.s, l: e.l })]\r\n }\r\n function V (t, e, n) {\r\n ;(e = e || 6), (n = n || 30)\r\n var i = S(t).toHsl(),\r\n r = 360 / n,\r\n o = [S(t)]\r\n for (i.h = (i.h - ((r * e) >> 1) + 720) % 360; --e; ) (i.h = (i.h + r) % 360), o.push(S(i))\r\n return o\r\n }\r\n function H (t, e) {\r\n e = e || 6\r\n for (var n = S(t).toHsv(), i = n.h, r = n.s, o = n.v, s = [], a = 1 / e; e--; )\r\n s.push(S({ h: i, s: r, v: o })), (o = (o + a) % 1)\r\n return s\r\n }\r\n ;(S.prototype = {\r\n isDark: function () {\r\n return this.getBrightness() < 128\r\n },\r\n isLight: function () {\r\n return !this.isDark()\r\n },\r\n isValid: function () {\r\n return this._ok\r\n },\r\n getOriginalInput: function () {\r\n return this._originalInput\r\n },\r\n getFormat: function () {\r\n return this._format\r\n },\r\n getAlpha: function () {\r\n return this._a\r\n },\r\n getBrightness: function () {\r\n var t = this.toRgb()\r\n return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3\r\n },\r\n setAlpha: function (t) {\r\n return (this._a = W(t)), (this._roundA = x(100 * this._a) / 100), this\r\n },\r\n toHsv: function () {\r\n var t = E(this._r, this._g, this._b)\r\n return { h: 360 * t.h, s: t.s, v: t.v, a: this._a }\r\n },\r\n toHsvString: function () {\r\n var t = E(this._r, this._g, this._b),\r\n e = x(360 * t.h),\r\n n = x(100 * t.s),\r\n i = x(100 * t.v)\r\n return 1 == this._a\r\n ? 'hsv(' + e + ', ' + n + '%, ' + i + '%)'\r\n : 'hsva(' + e + ', ' + n + '%, ' + i + '%, ' + this._roundA + ')'\r\n },\r\n toHsl: function () {\r\n var t = T(this._r, this._g, this._b)\r\n return { h: 360 * t.h, s: t.s, l: t.l, a: this._a }\r\n },\r\n toHslString: function () {\r\n var t = T(this._r, this._g, this._b),\r\n e = x(360 * t.h),\r\n n = x(100 * t.s),\r\n i = x(100 * t.l)\r\n return 1 == this._a\r\n ? 'hsl(' + e + ', ' + n + '%, ' + i + '%)'\r\n : 'hsla(' + e + ', ' + n + '%, ' + i + '%, ' + this._roundA + ')'\r\n },\r\n toHex: function (t) {\r\n return M(this._r, this._g, this._b, t)\r\n },\r\n toHexString: function (t) {\r\n return '#' + this.toHex(t)\r\n },\r\n toHex8: function () {\r\n return A(this._r, this._g, this._b, this._a)\r\n },\r\n toHex8String: function () {\r\n return '#' + this.toHex8()\r\n },\r\n toRgb: function () {\r\n return { r: x(this._r), g: x(this._g), b: x(this._b), a: this._a }\r\n },\r\n toRgbString: function () {\r\n return 1 == this._a\r\n ? 'rgb(' + x(this._r) + ', ' + x(this._g) + ', ' + x(this._b) + ')'\r\n : 'rgba(' + x(this._r) + ', ' + x(this._g) + ', ' + x(this._b) + ', ' + this._roundA + ')'\r\n },\r\n toPercentageRgb: function () {\r\n return {\r\n r: x(100 * U(this._r, 255)) + '%',\r\n g: x(100 * U(this._g, 255)) + '%',\r\n b: x(100 * U(this._b, 255)) + '%',\r\n a: this._a\r\n }\r\n },\r\n toPercentageRgbString: function () {\r\n return 1 == this._a\r\n ? 'rgb(' +\r\n x(100 * U(this._r, 255)) +\r\n '%, ' +\r\n x(100 * U(this._g, 255)) +\r\n '%, ' +\r\n x(100 * U(this._b, 255)) +\r\n '%)'\r\n : 'rgba(' +\r\n x(100 * U(this._r, 255)) +\r\n '%, ' +\r\n x(100 * U(this._g, 255)) +\r\n '%, ' +\r\n x(100 * U(this._b, 255)) +\r\n '%, ' +\r\n this._roundA +\r\n ')'\r\n },\r\n toName: function () {\r\n return 0 === this._a ? 'transparent' : !(this._a < 1) && (B[M(this._r, this._g, this._b, !0)] || !1)\r\n },\r\n toFilter: function (t) {\r\n var e = '#' + A(this._r, this._g, this._b, this._a),\r\n n = e,\r\n i = this._gradientType ? 'GradientType = 1, ' : ''\r\n t && (n = S(t).toHex8String())\r\n return 'progid:DXImageTransform.Microsoft.gradient(' + i + 'startColorstr=' + e + ',endColorstr=' + n + ')'\r\n },\r\n toString: function (t) {\r\n var e = !!t\r\n t = t || this._format\r\n var n = !1,\r\n i = this._a < 1 && this._a >= 0\r\n return e || !i || ('hex' !== t && 'hex6' !== t && 'hex3' !== t && 'name' !== t)\r\n ? ('rgb' === t && (n = this.toRgbString()),\r\n 'prgb' === t && (n = this.toPercentageRgbString()),\r\n ('hex' !== t && 'hex6' !== t) || (n = this.toHexString()),\r\n 'hex3' === t && (n = this.toHexString(!0)),\r\n 'hex8' === t && (n = this.toHex8String()),\r\n 'name' === t && (n = this.toName()),\r\n 'hsl' === t && (n = this.toHslString()),\r\n 'hsv' === t && (n = this.toHsvString()),\r\n n || this.toHexString())\r\n : 'name' === t && 0 === this._a\r\n ? this.toName()\r\n : this.toRgbString()\r\n },\r\n _applyModification: function (t, e) {\r\n var n = t.apply(null, [this].concat([].slice.call(e)))\r\n return (this._r = n._r), (this._g = n._g), (this._b = n._b), this.setAlpha(n._a), this\r\n },\r\n lighten: function () {\r\n return this._applyModification(_, arguments)\r\n },\r\n brighten: function () {\r\n return this._applyModification(N, arguments)\r\n },\r\n darken: function () {\r\n return this._applyModification(D, arguments)\r\n },\r\n desaturate: function () {\r\n return this._applyModification(O, arguments)\r\n },\r\n saturate: function () {\r\n return this._applyModification(P, arguments)\r\n },\r\n greyscale: function () {\r\n return this._applyModification(L, arguments)\r\n },\r\n spin: function () {\r\n return this._applyModification(I, arguments)\r\n },\r\n _applyCombination: function (t, e) {\r\n return t.apply(null, [this].concat([].slice.call(e)))\r\n },\r\n analogous: function () {\r\n return this._applyCombination(V, arguments)\r\n },\r\n complement: function () {\r\n return this._applyCombination(F, arguments)\r\n },\r\n monochromatic: function () {\r\n return this._applyCombination(H, arguments)\r\n },\r\n splitcomplement: function () {\r\n return this._applyCombination(z, arguments)\r\n },\r\n triad: function () {\r\n return this._applyCombination(j, arguments)\r\n },\r\n tetrad: function () {\r\n return this._applyCombination(R, arguments)\r\n }\r\n }),\r\n (S.fromRatio = function (t, e) {\r\n if ('object' == (void 0 === t ? 'undefined' : i(t))) {\r\n var n = {}\r\n for (var r in t) t.hasOwnProperty(r) && (n[r] = 'a' === r ? t[r] : G(t[r]))\r\n t = n\r\n }\r\n return S(t, e)\r\n }),\r\n (S.equals = function (t, e) {\r\n return !(!t || !e) && S(t).toRgbString() == S(e).toRgbString()\r\n }),\r\n (S.random = function () {\r\n return S.fromRatio({ r: k(), g: k(), b: k() })\r\n }),\r\n (S.mix = function (t, e, n) {\r\n n = 0 === n ? 0 : n || 50\r\n var i,\r\n r = S(t).toRgb(),\r\n o = S(e).toRgb(),\r\n s = n / 100,\r\n a = 2 * s - 1,\r\n l = o.a - r.a,\r\n c = 1 - (i = ((i = a * l == -1 ? a : (a + l) / (1 + a * l)) + 1) / 2),\r\n u = { r: o.r * i + r.r * c, g: o.g * i + r.g * c, b: o.b * i + r.b * c, a: o.a * s + r.a * (1 - s) }\r\n return S(u)\r\n }),\r\n (S.readability = function (t, e) {\r\n var n = S(t),\r\n i = S(e),\r\n r = n.toRgb(),\r\n o = i.toRgb(),\r\n s = n.getBrightness(),\r\n a = i.getBrightness(),\r\n l =\r\n Math.max(r.r, o.r) -\r\n Math.min(r.r, o.r) +\r\n Math.max(r.g, o.g) -\r\n Math.min(r.g, o.g) +\r\n Math.max(r.b, o.b) -\r\n Math.min(r.b, o.b)\r\n return { brightness: Math.abs(s - a), color: l }\r\n }),\r\n (S.isReadable = function (t, e) {\r\n var n = S.readability(t, e)\r\n return n.brightness > 125 && n.color > 500\r\n }),\r\n (S.mostReadable = function (t, e) {\r\n for (var n = null, i = 0, r = !1, o = 0; o < e.length; o++) {\r\n var s = S.readability(t, e[o]),\r\n a = s.brightness > 125 && s.color > 500,\r\n l = (s.brightness / 125) * 3 + s.color / 500\r\n ;((a && !r) || (a && r && l > i) || (!a && !r && l > i)) && ((r = a), (i = l), (n = S(e[o])))\r\n }\r\n return n\r\n })\r\n var $ = (S.names = {\r\n aliceblue: 'f0f8ff',\r\n antiquewhite: 'faebd7',\r\n aqua: '0ff',\r\n aquamarine: '7fffd4',\r\n azure: 'f0ffff',\r\n beige: 'f5f5dc',\r\n bisque: 'ffe4c4',\r\n black: '000',\r\n blanchedalmond: 'ffebcd',\r\n blue: '00f',\r\n blueviolet: '8a2be2',\r\n brown: 'a52a2a',\r\n burlywood: 'deb887',\r\n burntsienna: 'ea7e5d',\r\n cadetblue: '5f9ea0',\r\n chartreuse: '7fff00',\r\n chocolate: 'd2691e',\r\n coral: 'ff7f50',\r\n cornflowerblue: '6495ed',\r\n cornsilk: 'fff8dc',\r\n crimson: 'dc143c',\r\n cyan: '0ff',\r\n darkblue: '00008b',\r\n darkcyan: '008b8b',\r\n darkgoldenrod: 'b8860b',\r\n darkgray: 'a9a9a9',\r\n darkgreen: '006400',\r\n darkgrey: 'a9a9a9',\r\n darkkhaki: 'bdb76b',\r\n darkmagenta: '8b008b',\r\n darkolivegreen: '556b2f',\r\n darkorange: 'ff8c00',\r\n darkorchid: '9932cc',\r\n darkred: '8b0000',\r\n darksalmon: 'e9967a',\r\n darkseagreen: '8fbc8f',\r\n darkslateblue: '483d8b',\r\n darkslategray: '2f4f4f',\r\n darkslategrey: '2f4f4f',\r\n darkturquoise: '00ced1',\r\n darkviolet: '9400d3',\r\n deeppink: 'ff1493',\r\n deepskyblue: '00bfff',\r\n dimgray: '696969',\r\n dimgrey: '696969',\r\n dodgerblue: '1e90ff',\r\n firebrick: 'b22222',\r\n floralwhite: 'fffaf0',\r\n forestgreen: '228b22',\r\n fuchsia: 'f0f',\r\n gainsboro: 'dcdcdc',\r\n ghostwhite: 'f8f8ff',\r\n gold: 'ffd700',\r\n goldenrod: 'daa520',\r\n gray: '808080',\r\n green: '008000',\r\n greenyellow: 'adff2f',\r\n grey: '808080',\r\n honeydew: 'f0fff0',\r\n hotpink: 'ff69b4',\r\n indianred: 'cd5c5c',\r\n indigo: '4b0082',\r\n ivory: 'fffff0',\r\n khaki: 'f0e68c',\r\n lavender: 'e6e6fa',\r\n lavenderblush: 'fff0f5',\r\n lawngreen: '7cfc00',\r\n lemonchiffon: 'fffacd',\r\n lightblue: 'add8e6',\r\n lightcoral: 'f08080',\r\n lightcyan: 'e0ffff',\r\n lightgoldenrodyellow: 'fafad2',\r\n lightgray: 'd3d3d3',\r\n lightgreen: '90ee90',\r\n lightgrey: 'd3d3d3',\r\n lightpink: 'ffb6c1',\r\n lightsalmon: 'ffa07a',\r\n lightseagreen: '20b2aa',\r\n lightskyblue: '87cefa',\r\n lightslategray: '789',\r\n lightslategrey: '789',\r\n lightsteelblue: 'b0c4de',\r\n lightyellow: 'ffffe0',\r\n lime: '0f0',\r\n limegreen: '32cd32',\r\n linen: 'faf0e6',\r\n magenta: 'f0f',\r\n maroon: '800000',\r\n mediumaquamarine: '66cdaa',\r\n mediumblue: '0000cd',\r\n mediumorchid: 'ba55d3',\r\n mediumpurple: '9370db',\r\n mediumseagreen: '3cb371',\r\n mediumslateblue: '7b68ee',\r\n mediumspringgreen: '00fa9a',\r\n mediumturquoise: '48d1cc',\r\n mediumvioletred: 'c71585',\r\n midnightblue: '191970',\r\n mintcream: 'f5fffa',\r\n mistyrose: 'ffe4e1',\r\n moccasin: 'ffe4b5',\r\n navajowhite: 'ffdead',\r\n navy: '000080',\r\n oldlace: 'fdf5e6',\r\n olive: '808000',\r\n olivedrab: '6b8e23',\r\n orange: 'ffa500',\r\n orangered: 'ff4500',\r\n orchid: 'da70d6',\r\n palegoldenrod: 'eee8aa',\r\n palegreen: '98fb98',\r\n paleturquoise: 'afeeee',\r\n palevioletred: 'db7093',\r\n papayawhip: 'ffefd5',\r\n peachpuff: 'ffdab9',\r\n peru: 'cd853f',\r\n pink: 'ffc0cb',\r\n plum: 'dda0dd',\r\n powderblue: 'b0e0e6',\r\n purple: '800080',\r\n rebeccapurple: '663399',\r\n red: 'f00',\r\n rosybrown: 'bc8f8f',\r\n royalblue: '4169e1',\r\n saddlebrown: '8b4513',\r\n salmon: 'fa8072',\r\n sandybrown: 'f4a460',\r\n seagreen: '2e8b57',\r\n seashell: 'fff5ee',\r\n sienna: 'a0522d',\r\n silver: 'c0c0c0',\r\n skyblue: '87ceeb',\r\n slateblue: '6a5acd',\r\n slategray: '708090',\r\n slategrey: '708090',\r\n snow: 'fffafa',\r\n springgreen: '00ff7f',\r\n steelblue: '4682b4',\r\n tan: 'd2b48c',\r\n teal: '008080',\r\n thistle: 'd8bfd8',\r\n tomato: 'ff6347',\r\n turquoise: '40e0d0',\r\n violet: 'ee82ee',\r\n wheat: 'f5deb3',\r\n white: 'fff',\r\n whitesmoke: 'f5f5f5',\r\n yellow: 'ff0',\r\n yellowgreen: '9acd32'\r\n }),\r\n B = (S.hexNames = (function (t) {\r\n var e = {}\r\n for (var n in t) t.hasOwnProperty(n) && (e[t[n]] = n)\r\n return e\r\n })($))\r\n function W (t) {\r\n return (t = parseFloat(t)), (isNaN(t) || t < 0 || t > 1) && (t = 1), t\r\n }\r\n function U (t, e) {\r\n ;(function (t) {\r\n return 'string' == typeof t && -1 != t.indexOf('.') && 1 === parseFloat(t)\r\n })(t) && (t = '100%')\r\n var n = (function (t) {\r\n return 'string' == typeof t && -1 != t.indexOf('%')\r\n })(t)\r\n return (\r\n (t = w(e, C(0, parseFloat(t)))),\r\n n && (t = parseInt(t * e, 10) / 100),\r\n b.abs(t - e) < 1e-6 ? 1 : (t % e) / parseFloat(e)\r\n )\r\n }\r\n function q (t) {\r\n return w(1, C(0, t))\r\n }\r\n function K (t) {\r\n return parseInt(t, 16)\r\n }\r\n function Y (t) {\r\n return 1 == t.length ? '0' + t : '' + t\r\n }\r\n function G (t) {\r\n return t <= 1 && (t = 100 * t + '%'), t\r\n }\r\n var X,\r\n J,\r\n Z,\r\n Q = ((J =\r\n '[\\\\s|\\\\(]+(' +\r\n (X = '(?:[-\\\\+]?\\\\d*\\\\.\\\\d+%?)|(?:[-\\\\+]?\\\\d+%?)') +\r\n ')[,|\\\\s]+(' +\r\n X +\r\n ')[,|\\\\s]+(' +\r\n X +\r\n ')\\\\s*\\\\)?'),\r\n (Z = '[\\\\s|\\\\(]+(' + X + ')[,|\\\\s]+(' + X + ')[,|\\\\s]+(' + X + ')[,|\\\\s]+(' + X + ')\\\\s*\\\\)?'),\r\n {\r\n rgb: new RegExp('rgb' + J),\r\n rgba: new RegExp('rgba' + Z),\r\n hsl: new RegExp('hsl' + J),\r\n hsla: new RegExp('hsla' + Z),\r\n hsv: new RegExp('hsv' + J),\r\n hsva: new RegExp('hsva' + Z),\r\n hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\r\n hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,\r\n hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/\r\n })\r\n ;(window.tinycolor = S),\r\n t(function () {\r\n t.fn.spectrum.load && t.fn.spectrum.processNativeColorInputs()\r\n })\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0),\r\n r = n(126)\r\n t.exports = i.View.extend({\r\n initialize: function (t) {\r\n ;(this.config = t.config || {}),\r\n (this.stackModel = t.stackModel),\r\n (this.preview = t.preview),\r\n (this.pfx = this.config.stylePrefix || ''),\r\n (this.ppfx = this.config.pStylePrefix || ''),\r\n (this.propsConfig = t.propsConfig)\r\n var e = this.pfx,\r\n n = this.ppfx,\r\n i = this.collection\r\n ;(this.className = e + 'layers ' + n + 'field'),\r\n this.listenTo(i, 'add', this.addTo),\r\n this.listenTo(i, 'deselectAll', this.deselectAll),\r\n this.listenTo(i, 'reset', this.render)\r\n var r = this.config.em || '',\r\n o = r ? r.get('Utils') : ''\r\n ;(this.sorter = o\r\n ? new o.Sorter({\r\n container: this.el,\r\n ignoreViewChildren: 1,\r\n containerSel: '.' + e + 'layers',\r\n itemSel: '.' + e + 'layer',\r\n pfx: this.config.pStylePrefix\r\n })\r\n : ''),\r\n (i.view = this),\r\n this.$el.data('model', i),\r\n this.$el.data('collection', i)\r\n },\r\n addTo: function (t) {\r\n var e = this.collection.indexOf(t)\r\n this.addToCollection(t, null, e)\r\n },\r\n addToCollection: function (t, e, n) {\r\n var i = e || null,\r\n o = this.stackModel,\r\n s = this.config,\r\n a = this.sorter,\r\n l = this.propsConfig\r\n void 0 !== this.preview && t.set('preview', this.preview)\r\n var c = new r({ model: t, config: s, sorter: a, stackModel: o, propsConfig: l }).render().el\r\n if (i) i.appendChild(c)\r\n else if (void 0 !== n) {\r\n var u = 'before'\r\n this.$el.children().length == n && (n--, (u = 'after')),\r\n n < 0\r\n ? this.$el.append(c)\r\n : this.$el\r\n .children()\r\n .eq(n)\r\n [u](c)\r\n } else this.$el.append(c)\r\n return c\r\n },\r\n deselectAll: function () {\r\n this.$el.find('.' + this.pfx + 'layer').removeClass(this.pfx + 'active')\r\n },\r\n render: function () {\r\n var t = document.createDocumentFragment()\r\n return (\r\n this.$el.empty(),\r\n this.collection.each(function (e) {\r\n this.addToCollection(e, t)\r\n }, this),\r\n this.$el.append(t),\r\n this.$el.attr('class', this.className),\r\n this.sorter && (this.sorter.plh = null),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n t.exports = o.default.View.extend({\r\n events: {\r\n click: 'active',\r\n 'click [data-close-layer]': 'remove',\r\n 'mousedown [data-move-layer]': 'initSorter',\r\n 'touchstart [data-move-layer]': 'initSorter'\r\n },\r\n template: function (t) {\r\n var e = this.pfx\r\n return (\r\n '\\n
\\n \\n
\\n
' +\r\n ('Layer ' + t.get('index')) +\r\n '
\\n
\\n \\t\\n
\\n
\\n ⨯\\n
\\n \\n \\n '\r\n )\r\n },\r\n initialize: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = this.model\r\n ;(this.stackModel = t.stackModel || {}),\r\n (this.config = t.config || {}),\r\n (this.pfx = this.config.stylePrefix || ''),\r\n (this.ppfx = this.config.pStylePrefix || ''),\r\n (this.sorter = t.sorter || null),\r\n (this.propsConfig = t.propsConfig || {}),\r\n (this.customPreview = t.onPreview),\r\n this.listenTo(e, 'destroy remove', this.remove),\r\n this.listenTo(e, 'change:active', this.updateVisibility),\r\n this.listenTo(e.get('properties'), 'change', this.updatePreview),\r\n (e.view = this),\r\n e.set({ droppable: 0, draggable: 1 }),\r\n this.$el.data('model', e)\r\n },\r\n initSorter: function (t) {\r\n this.sorter && this.sorter.startSort(this.el)\r\n },\r\n remove: function (t) {\r\n t && t.stopPropagation && t.stopPropagation()\r\n var e = this.model,\r\n n = e.collection,\r\n i = this.stackModel\r\n o.default.View.prototype.remove.apply(this, arguments),\r\n n.contains(e) && n.remove(e),\r\n i && i.set && (i.set({ stackIndex: null }, { silent: !0 }), i.trigger('updateValue'))\r\n },\r\n onPreview: function (t) {\r\n var e = t.split(' '),\r\n n = []\r\n return (\r\n this.model.get('properties').each(function (t, i) {\r\n var r = e[i] || ''\r\n if (r && 'integer' == t.get('type')) {\r\n var o = parseInt(r, 10),\r\n s = r.replace(o, '')\r\n r = (o = (o = (o = isNaN(o) ? 0 : o) > 3 ? 3 : o) < -3 ? -3 : o) + s\r\n }\r\n n.push(r)\r\n }),\r\n n.join(' ')\r\n )\r\n },\r\n updatePreview: function () {\r\n var t = this.stackModel,\r\n e = this.customPreview,\r\n n = this.getPreviewEl(),\r\n i = this.model.getFullValue(),\r\n r = e ? e(i) : this.onPreview(i)\r\n r && t && n && (n.style[t.get('property')] = r)\r\n },\r\n getPropertiesWrapper: function () {\r\n return this.propsWrapEl || (this.propsWrapEl = this.el.querySelector('[data-properties]')), this.propsWrapEl\r\n },\r\n getPreviewEl: function () {\r\n return this.previewEl || (this.previewEl = this.el.querySelector('[data-preview]')), this.previewEl\r\n },\r\n active: function () {\r\n var t = this.model,\r\n e = t.collection\r\n e.active(e.indexOf(t))\r\n },\r\n updateVisibility: function () {\r\n var t = this.pfx,\r\n e = this.getPropertiesWrapper(),\r\n n = this.model.get('active')\r\n ;(e.style.display = n ? '' : 'none'), this.$el[n ? 'addClass' : 'removeClass'](t + 'active')\r\n },\r\n render: function () {\r\n var t = n(16),\r\n e = this.propsConfig,\r\n i = this.model,\r\n r = this.el,\r\n o = this.pfx,\r\n s = i.get('preview'),\r\n a = new t({\r\n collection: i.get('properties'),\r\n config: this.config,\r\n target: e.target,\r\n customValue: e.customValue,\r\n propTarget: e.propTarget,\r\n onChange: e.onChange\r\n }).render().el\r\n return (\r\n (r.innerHTML = this.template(i)),\r\n (r.className = o + 'layer' + (s ? '' : ' ' + o + 'no-preview')),\r\n this.getPropertiesWrapper().appendChild(a),\r\n this.updateVisibility(),\r\n this.updatePreview(),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n Object.defineProperty(e, '__esModule', { value: !0 })\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(59)\r\n e.default = r.extend({\r\n defaults: function () {\r\n return i({}, r.prototype.defaults, { full: 0 })\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(60)\r\n t.exports = r.extend({ defaults: i({}, r.prototype.defaults, { showInput: 1 }) })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(17)\r\n t.exports = r.extend({\r\n events: function () {\r\n return i({}, r.prototype.events, {\r\n 'change [type=range]': 'inputValueChanged',\r\n 'input [type=range]': 'inputValueChangedSoft',\r\n change: ''\r\n })\r\n },\r\n templateInput: function (t) {\r\n var e = this.ppfx\r\n return (\r\n '\\n
\\n \\n
\\n '\r\n )\r\n },\r\n getSliderEl: function () {\r\n return this.slider || (this.slider = this.el.querySelector('input[type=range]')), this.slider\r\n },\r\n inputValueChanged: function () {\r\n var t = this.model,\r\n e = t.get('step')\r\n this.getInputEl().value = this.getSliderEl().value\r\n var n = this.getInputValue() - e\r\n t.set('value', n, { avoidStore: 1 }).set('value', n + e), this.elementUpdated()\r\n },\r\n inputValueChangedSoft: function () {\r\n ;(this.getInputEl().value = this.getSliderEl().value),\r\n this.model.set('value', this.getInputValue(), { avoidStore: 1 }),\r\n this.elementUpdated()\r\n },\r\n setValue: function (t) {\r\n var e = this.model.parseValue(t)\r\n ;(this.getSliderEl().value = parseFloat(e.value)), r.prototype.setValue.apply(this, arguments)\r\n },\r\n onRender: function () {\r\n r.prototype.onRender.apply(this, arguments),\r\n this.model.get('showInput') || (this.inputInst.el.style.display = 'none')\r\n },\r\n clearCached: function () {\r\n r.prototype.clearCached.apply(this, arguments), (this.slider = null)\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n n(0)\r\n t.exports = function () {\r\n return {\r\n build: function (t) {\r\n var e = []\r\n 'string' == typeof t && (t = [t])\r\n for (var n = 0, i = t.length; n < i; n++) {\r\n var r = {},\r\n o = t[n]\r\n switch (((r.property = o), o)) {\r\n case 'border-radius-c':\r\n r.property = 'border-radius'\r\n }\r\n switch (o) {\r\n case 'margin-top':\r\n case 'margin-right':\r\n case 'margin-bottom':\r\n case 'margin-left':\r\n case 'padding-top':\r\n case 'padding-right':\r\n case 'padding-bottom':\r\n case 'padding-left':\r\n case 'width':\r\n case 'max-width':\r\n case 'min-width':\r\n case 'height':\r\n case 'max-height':\r\n case 'min-height':\r\n r.fixedValues = ['initial', 'inherit', 'auto']\r\n break\r\n case 'font-size':\r\n r.fixedValues = [\r\n 'medium',\r\n 'xx-small',\r\n 'x-small',\r\n 'small',\r\n 'large',\r\n 'x-large',\r\n 'xx-large',\r\n 'smaller',\r\n 'larger',\r\n 'length',\r\n 'initial',\r\n 'inherit'\r\n ]\r\n break\r\n case 'letter-spacing':\r\n case 'line-height':\r\n r.fixedValues = ['normal', 'initial', 'inherit']\r\n }\r\n switch (o) {\r\n case 'float':\r\n case 'position':\r\n case 'text-align':\r\n r.type = 'radio'\r\n break\r\n case 'display':\r\n case 'font-family':\r\n case 'font-weight':\r\n case 'border-style':\r\n case 'box-shadow-type':\r\n case 'background-repeat':\r\n case 'background-position':\r\n case 'background-attachment':\r\n case 'background-size':\r\n case 'transition-property':\r\n case 'transition-timing-function':\r\n case 'cursor':\r\n case 'overflow':\r\n r.type = 'select'\r\n break\r\n case 'top':\r\n case 'right':\r\n case 'bottom':\r\n case 'left':\r\n case 'margin-top':\r\n case 'margin-right':\r\n case 'margin-bottom':\r\n case 'margin-left':\r\n case 'padding-top':\r\n case 'padding-right':\r\n case 'padding-bottom':\r\n case 'padding-left':\r\n case 'min-height':\r\n case 'min-width':\r\n case 'max-height':\r\n case 'max-width':\r\n case 'width':\r\n case 'height':\r\n case 'font-size':\r\n case 'letter-spacing':\r\n case 'line-height':\r\n case 'text-shadow-h':\r\n case 'text-shadow-v':\r\n case 'text-shadow-blur':\r\n case 'border-radius-c':\r\n case 'border-top-left-radius':\r\n case 'border-top-right-radius':\r\n case 'border-bottom-left-radius':\r\n case 'border-bottom-right-radius':\r\n case 'border-width':\r\n case 'box-shadow-h':\r\n case 'box-shadow-v':\r\n case 'box-shadow-blur':\r\n case 'box-shadow-spread':\r\n case 'transition-duration':\r\n case 'perspective':\r\n case 'transform-rotate-x':\r\n case 'transform-rotate-y':\r\n case 'transform-rotate-z':\r\n case 'transform-scale-x':\r\n case 'transform-scale-y':\r\n case 'transform-scale-z':\r\n r.type = 'integer'\r\n break\r\n case 'margin':\r\n case 'padding':\r\n case 'border-radius':\r\n case 'border':\r\n case 'transform':\r\n r.type = 'composite'\r\n break\r\n case 'color':\r\n case 'text-shadow-color':\r\n case 'background-color':\r\n case 'border-color':\r\n case 'box-shadow-color':\r\n r.type = 'color'\r\n break\r\n case 'text-shadow':\r\n case 'box-shadow':\r\n case 'background':\r\n case 'transition':\r\n r.type = 'stack'\r\n break\r\n case 'background-image':\r\n r.type = 'file'\r\n }\r\n switch (o) {\r\n case 'float':\r\n case 'background-color':\r\n case 'background-image':\r\n case 'text-shadow':\r\n r.defaults = 'none'\r\n break\r\n case 'display':\r\n r.defaults = 'block'\r\n break\r\n case 'position':\r\n r.defaults = 'static'\r\n break\r\n case 'top':\r\n case 'right':\r\n case 'bottom':\r\n case 'left':\r\n case 'margin-top':\r\n case 'margin-right':\r\n case 'margin-bottom':\r\n case 'margin-left':\r\n case 'padding-top':\r\n case 'padding-right':\r\n case 'padding-bottom':\r\n case 'padding-left':\r\n case 'text-shadow-h':\r\n case 'text-shadow-v':\r\n case 'text-shadow-blur':\r\n case 'border-radius-c':\r\n case 'box-shadow-h':\r\n case 'box-shadow-v':\r\n case 'box-shadow-spread':\r\n case 'perspective':\r\n case 'transform-rotate-x':\r\n case 'transform-rotate-y':\r\n case 'transform-rotate-z':\r\n r.defaults = 0\r\n break\r\n case 'border-top-left-radius':\r\n case 'border-top-right-radius':\r\n case 'border-bottom-left-radius':\r\n case 'border-bottom-right-radius':\r\n r.defaults = '0px'\r\n break\r\n case 'transform-scale-x':\r\n case 'transform-scale-y':\r\n case 'transform-scale-z':\r\n r.defaults = 1\r\n break\r\n case 'box-shadow-blur':\r\n r.defaults = '5px'\r\n break\r\n case 'min-height':\r\n case 'min-width':\r\n case 'max-height':\r\n case 'max-width':\r\n case 'width':\r\n case 'height':\r\n case 'background-size':\r\n case 'cursor':\r\n r.defaults = 'auto'\r\n break\r\n case 'font-family':\r\n r.defaults = 'Arial, Helvetica, sans-serif'\r\n break\r\n case 'font-size':\r\n case 'border-width':\r\n r.defaults = 'medium'\r\n break\r\n case 'font-weight':\r\n r.defaults = '400'\r\n break\r\n case 'letter-spacing':\r\n case 'line-height':\r\n r.defaults = 'normal'\r\n break\r\n case 'color':\r\n case 'text-shadow-color':\r\n case 'border-color':\r\n case 'box-shadow-color':\r\n r.defaults = 'black'\r\n break\r\n case 'text-align':\r\n r.defaults = 'left'\r\n break\r\n case 'border-style':\r\n r.defaults = 'solid'\r\n break\r\n case 'box-shadow-type':\r\n r.defaults = ''\r\n break\r\n case 'background-repeat':\r\n r.defaults = 'repeat'\r\n break\r\n case 'background-position':\r\n r.defaults = 'left top'\r\n break\r\n case 'background-attachment':\r\n r.defaults = 'scroll'\r\n break\r\n case 'transition-property':\r\n r.defaults = 'width'\r\n break\r\n case 'transition-duration':\r\n r.defaults = '2'\r\n break\r\n case 'transition-timing-function':\r\n r.defaults = 'ease'\r\n break\r\n case 'overflow':\r\n r.defaults = 'visible'\r\n }\r\n switch (o) {\r\n case 'top':\r\n case 'bottom':\r\n case 'margin-top':\r\n case 'margin-bottom':\r\n case 'padding-top':\r\n case 'padding-bottom':\r\n case 'min-height':\r\n case 'max-height':\r\n case 'height':\r\n r.units = ['px', '%', 'vh']\r\n break\r\n case 'right':\r\n case 'left':\r\n case 'margin-right':\r\n case 'margin-left':\r\n case 'padding-right':\r\n case 'padding-left':\r\n case 'min-width':\r\n case 'max-width':\r\n case 'width':\r\n r.units = ['px', '%', 'vw']\r\n break\r\n case 'text-shadow-v':\r\n case 'text-shadow-h':\r\n case 'text-shadow-blur':\r\n case 'border-radius-c':\r\n case 'border-top-left-radius':\r\n case 'border-top-right-radius':\r\n case 'border-bottom-left-radius':\r\n case 'border-bottom-right-radius':\r\n case 'box-shadow-h':\r\n case 'box-shadow-v':\r\n r.units = ['px', '%']\r\n break\r\n case 'font-size':\r\n case 'letter-spacing':\r\n case 'line-height':\r\n r.units = ['px', 'em', 'rem', '%']\r\n break\r\n case 'border-width':\r\n r.units = ['px', 'em']\r\n break\r\n case 'box-shadow-blur':\r\n case 'box-shadow-spread':\r\n case 'perspective':\r\n r.units = ['px']\r\n break\r\n case 'transition-duration':\r\n r.units = ['s']\r\n break\r\n case 'transform-rotate-x':\r\n case 'transform-rotate-y':\r\n case 'transform-rotate-z':\r\n r.units = ['deg']\r\n }\r\n switch (o) {\r\n case 'padding-top':\r\n case 'padding-right':\r\n case 'padding-bottom':\r\n case 'padding-left':\r\n case 'min-height':\r\n case 'min-width':\r\n case 'max-height':\r\n case 'max-width':\r\n case 'width':\r\n case 'height':\r\n case 'font-size':\r\n case 'text-shadow-blur':\r\n case 'border-radius-c':\r\n case 'border-top-left-radius':\r\n case 'border-top-right-radius':\r\n case 'border-bottom-left-radius':\r\n case 'border-bottom-right-radius':\r\n case 'border-width':\r\n case 'box-shadow-blur':\r\n case 'transition-duration':\r\n case 'perspective':\r\n r.min = 0\r\n }\r\n switch (o) {\r\n case 'text-shadow':\r\n case 'box-shadow':\r\n case 'background':\r\n r.preview = !0\r\n }\r\n switch (o) {\r\n case 'background':\r\n r.detached = !0\r\n }\r\n switch (o) {\r\n case 'transform-rotate-x':\r\n r.functionName = 'rotateX'\r\n break\r\n case 'transform-rotate-y':\r\n r.functionName = 'rotateY'\r\n break\r\n case 'transform-rotate-z':\r\n r.functionName = 'rotateZ'\r\n break\r\n case 'transform-scale-x':\r\n r.functionName = 'scaleX'\r\n break\r\n case 'transform-scale-y':\r\n r.functionName = 'scaleY'\r\n break\r\n case 'transform-scale-z':\r\n r.functionName = 'scaleZ'\r\n break\r\n case 'background-image':\r\n r.functionName = 'url'\r\n }\r\n switch (o) {\r\n case 'float':\r\n r.list = [{ value: 'none' }, { value: 'left' }, { value: 'right' }]\r\n break\r\n case 'display':\r\n r.list = [{ value: 'block' }, { value: 'inline' }, { value: 'inline-block' }, { value: 'none' }]\r\n break\r\n case 'position':\r\n r.list = [{ value: 'static' }, { value: 'relative' }, { value: 'absolute' }, { value: 'fixed' }]\r\n break\r\n case 'font-family':\r\n var s = ', sans-serif',\r\n a = [\r\n 'Arial, Helvetica' + s,\r\n 'Arial Black, Gadget' + s,\r\n 'Brush Script MT' + s,\r\n 'Comic Sans MS, cursive' + s,\r\n 'Courier New, Courier, monospace',\r\n 'Georgia, serif',\r\n 'Helvetica, serif',\r\n 'Impact, Charcoal' + s,\r\n 'Lucida Sans Unicode, Lucida Grande' + s,\r\n 'Tahoma, Geneva' + s,\r\n 'Times New Roman, Times, serif',\r\n 'Trebuchet MS, Helvetica' + s,\r\n 'Verdana, Geneva' + s\r\n ]\r\n r.list = []\r\n for (var l = 0, c = a.length; l < c; l++) {\r\n var u = {}\r\n ;(u.value = a[l]), (u.name = a[l].split(',')[0]), r.list.push(u)\r\n }\r\n break\r\n case 'font-weight':\r\n r.list = [\r\n { value: '100', name: 'Thin' },\r\n { value: '200', name: 'Extra-Light' },\r\n { value: '300', name: 'Light' },\r\n { value: '400', name: 'Normal' },\r\n { value: '500', name: 'Medium' },\r\n { value: '600', name: 'Semi-Bold' },\r\n { value: '700', name: 'Bold' },\r\n { value: '800', name: 'Extra-Bold' },\r\n { value: '900', name: 'Ultra-Bold' }\r\n ]\r\n break\r\n case 'text-align':\r\n r.list = [{ value: 'left' }, { value: 'center' }, { value: 'right' }, { value: 'justify' }]\r\n break\r\n case 'border-style':\r\n r.list = [\r\n { value: 'none' },\r\n { value: 'solid' },\r\n { value: 'dotted' },\r\n { value: 'dashed' },\r\n { value: 'double' },\r\n { value: 'groove' },\r\n { value: 'ridge' },\r\n { value: 'inset' },\r\n { value: 'outset' }\r\n ]\r\n break\r\n case 'box-shadow-type':\r\n r.list = [{ value: '', name: 'Outside' }, { value: 'inset', name: 'Inside' }]\r\n break\r\n case 'background-repeat':\r\n r.list = [{ value: 'repeat' }, { value: 'repeat-x' }, { value: 'repeat-y' }, { value: 'no-repeat' }]\r\n break\r\n case 'background-position':\r\n r.list = [\r\n { value: 'left top' },\r\n { value: 'left center' },\r\n { value: 'left bottom' },\r\n { value: 'right top' },\r\n { value: 'right center' },\r\n { value: 'right bottom' },\r\n { value: 'center top' },\r\n { value: 'center center' },\r\n { value: 'center bottom' }\r\n ]\r\n break\r\n case 'background-attachment':\r\n r.list = [{ value: 'scroll' }, { value: 'fixed' }, { value: 'local' }]\r\n break\r\n case 'background-size':\r\n r.list = [{ value: 'auto' }, { value: 'cover' }, { value: 'contain' }]\r\n break\r\n case 'transition-property':\r\n r.list = [\r\n { value: 'all' },\r\n { value: 'width' },\r\n { value: 'height' },\r\n { value: 'background-color' },\r\n { value: 'transform' },\r\n { value: 'box-shadow' },\r\n { value: 'opacity' }\r\n ]\r\n break\r\n case 'transition-timing-function':\r\n r.list = [\r\n { value: 'linear' },\r\n { value: 'ease' },\r\n { value: 'ease-in' },\r\n { value: 'ease-out' },\r\n { value: 'ease-in-out' }\r\n ]\r\n break\r\n case 'cursor':\r\n r.list = [\r\n { value: 'auto' },\r\n { value: 'pointer' },\r\n { value: 'copy' },\r\n { value: 'crosshair' },\r\n { value: 'grab' },\r\n { value: 'grabbing' },\r\n { value: 'help' },\r\n { value: 'move' },\r\n { value: 'text' }\r\n ]\r\n break\r\n case 'overflow':\r\n r.list = [{ value: 'visible' }, { value: 'hidden' }, { value: 'scroll' }, { value: 'auto' }]\r\n }\r\n switch (o) {\r\n case 'margin':\r\n r.properties = this.build(['margin-top', 'margin-right', 'margin-bottom', 'margin-left'])\r\n break\r\n case 'padding':\r\n r.properties = this.build(['padding-top', 'padding-right', 'padding-bottom', 'padding-left'])\r\n break\r\n case 'text-shadow':\r\n r.properties = this.build(['text-shadow-h', 'text-shadow-v', 'text-shadow-blur', 'text-shadow-color'])\r\n break\r\n case 'border':\r\n r.properties = this.build(['border-width', 'border-style', 'border-color'])\r\n break\r\n case 'border-radius':\r\n r.properties = this.build([\r\n 'border-top-left-radius',\r\n 'border-top-right-radius',\r\n 'border-bottom-left-radius',\r\n 'border-bottom-right-radius'\r\n ])\r\n break\r\n case 'box-shadow':\r\n r.properties = this.build([\r\n 'box-shadow-h',\r\n 'box-shadow-v',\r\n 'box-shadow-blur',\r\n 'box-shadow-spread',\r\n 'box-shadow-color',\r\n 'box-shadow-type'\r\n ])\r\n break\r\n case 'background':\r\n r.properties = this.build([\r\n 'background-image',\r\n 'background-repeat',\r\n 'background-position',\r\n 'background-attachment',\r\n 'background-size'\r\n ])\r\n break\r\n case 'transition':\r\n r.properties = this.build([\r\n 'transition-property',\r\n 'transition-duration',\r\n 'transition-timing-function'\r\n ])\r\n break\r\n case 'transform':\r\n r.properties = this.build([\r\n 'transform-rotate-x',\r\n 'transform-rotate-y',\r\n 'transform-rotate-z',\r\n 'transform-scale-x',\r\n 'transform-scale-y',\r\n 'transform-scale-z'\r\n ])\r\n }\r\n e.push(r)\r\n }\r\n return e\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n o = n(0),\r\n s = (i = o) && i.__esModule ? i : { default: i },\r\n a = n(1)\r\n var l = n(132)\r\n t.exports = s.default.View.extend({\r\n initialize: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = t.config || {}\r\n ;(this.pfx = e.stylePrefix || ''),\r\n (this.ppfx = e.pStylePrefix || ''),\r\n (this.target = t.target || {}),\r\n (this.config = e)\r\n var n = {}\r\n ;(0, a.extend)(n, s.default.Events)\r\n var i = document.body,\r\n o = document.createElement('el-' + new Date().getTime())\r\n i.appendChild(o),\r\n (n.computedDefault = r({}, window.getComputedStyle(o))),\r\n i.removeChild(o),\r\n (this.propTarget = n)\r\n var l = this.collection\r\n this.listenTo(l, 'add', this.addTo),\r\n this.listenTo(l, 'reset', this.render),\r\n this.listenTo(\r\n this.target,\r\n 'component:toggled component:update:classes component:update:state change:device',\r\n this.targetUpdated\r\n )\r\n },\r\n addTo: function (t) {\r\n this.addToCollection(t)\r\n },\r\n targetUpdated: function () {\r\n var t = this.target,\r\n e = this.propTarget,\r\n n = t.getSelected()\r\n if (n) {\r\n var i = t.get('Config').devicePreviewMode ? '' : n.get('state'),\r\n r = n.getEl()\r\n if (((e.helper = null), r)) {\r\n var o = i ? ':' + i : null\r\n e.computed = window.getComputedStyle(r, o)\r\n }\r\n ;(n = t.get('StyleManager').getModelToStyle(n)),\r\n i &&\r\n (function () {\r\n var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n i = t.get('CssComposer'),\r\n r = i.getAll(),\r\n o = i.getClassRule('hc-state')\r\n o ? (r.remove(o), r.add(o)) : (o = i.setClassRule('hc-state')),\r\n o.set('important', 1),\r\n o.setStyle(n),\r\n (e.helper = o)\r\n })(n.getStyle()),\r\n (e.model = n),\r\n e.trigger('update')\r\n }\r\n },\r\n setTarget: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = this.target,\r\n i = n.get('Config'),\r\n r = e.targetIsClass,\r\n o = e.stylable,\r\n s = t\r\n if ((0, a.isString)(t)) {\r\n var l = void 0,\r\n c = n.get('CssComposer').getAll()\r\n r &&\r\n (l = c.filter(function (e) {\r\n return e.get('selectors').getFullString() === t\r\n })[0]),\r\n l ||\r\n (l = c.filter(function (e) {\r\n return e.get('selectorsAdd') === t\r\n })[0]),\r\n l || (l = c.add({ selectors: [], selectorsAdd: t })),\r\n o && l.set({ stylable: o }),\r\n (s = l)\r\n }\r\n i.devicePreviewMode || s.get('state')\r\n var u = this.propTarget\r\n return (u.model = s), u.trigger('styleManager:update', s), s\r\n },\r\n addToCollection: function (t, e) {\r\n var n = e || null,\r\n i = new l({\r\n model: t,\r\n id:\r\n this.pfx +\r\n t\r\n .get('name')\r\n .replace(' ', '_')\r\n .toLowerCase(),\r\n name: t.get('name'),\r\n properties: t.get('properties'),\r\n target: this.target,\r\n propTarget: this.propTarget,\r\n config: this.config\r\n }).render().el\r\n return n ? n.appendChild(i) : this.$el.append(i), i\r\n },\r\n render: function () {\r\n var t = this,\r\n e = document.createDocumentFragment(),\r\n n = this.$el,\r\n i = this.pfx,\r\n r = this.ppfx\r\n return (\r\n n.empty(),\r\n this.collection.each(function (n) {\r\n return t.addToCollection(n, e)\r\n }),\r\n n.append(e),\r\n n.addClass(i + 'sectors ' + r + 'one-bg ' + r + 'two-color'),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = o(n(1)),\r\n r = o(n(0))\r\n function o (t) {\r\n return t && t.__esModule ? t : { default: t }\r\n }\r\n var s = n(16)\r\n t.exports = r.default.View.extend({\r\n template: i.default.template(\r\n '\\n
'\r\n ),\r\n events: {},\r\n initialize: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n ;(this.config = t.config || {}),\r\n (this.pfx = this.config.stylePrefix || ''),\r\n (this.ppfx = this.config.pStylePrefix || ''),\r\n (this.className = this.pfx + 'tags'),\r\n (this.addBtnId = this.pfx + 'add-tag'),\r\n (this.newInputId = this.pfx + 'new'),\r\n (this.stateInputId = this.pfx + 'states'),\r\n (this.stateInputC = this.pfx + 'input-c'),\r\n (this.states = this.config.states || []),\r\n (this.events['click #' + this.addBtnId] = 'startNewTag'),\r\n (this.events['blur #' + this.newInputId] = 'endNewTag'),\r\n (this.events['keyup #' + this.newInputId] = 'onInputKeyUp'),\r\n (this.events['change #' + this.stateInputId] = 'stateChanged'),\r\n (this.target = this.config.em),\r\n (this.em = this.target),\r\n this.listenTo(this.getStyleEmitter(), 'styleManager:update', this.componentChanged),\r\n this.listenTo(this.target, 'component:toggled component:update:classes', this.componentChanged),\r\n this.listenTo(this.target, 'component:update:classes', this.updateSelector),\r\n this.listenTo(this.collection, 'add', this.addNew),\r\n this.listenTo(this.collection, 'reset', this.renderClasses),\r\n this.listenTo(this.collection, 'remove', this.tagRemoved),\r\n this.delegateEvents()\r\n },\r\n getStyleEmitter: function () {\r\n var t = this.em,\r\n e = t && t.get('StyleManager')\r\n return (e && e.getEmitter()) || {}\r\n },\r\n tagRemoved: function (t) {\r\n this.updateStateVis()\r\n },\r\n getStateOptions: function () {\r\n for (var t = '', e = 0; e < this.states.length; e++)\r\n t += ''\r\n return t\r\n },\r\n addNew: function (t) {\r\n this.addToClasses(t)\r\n },\r\n startNewTag: function (t) {\r\n ;(this.$addBtn.get(0).style.display = 'none'), this.$input.show().focus()\r\n },\r\n endNewTag: function (t) {\r\n ;(this.$addBtn.get(0).style.display = ''), this.$input.hide().val('')\r\n },\r\n onInputKeyUp: function (t) {\r\n 13 === t.keyCode ? this.addNewTag(this.$input.val()) : 27 === t.keyCode && this.endNewTag()\r\n },\r\n componentChanged: function (t) {\r\n ;(t = t || this.getTarget()), (this.compTarget = t)\r\n var e = []\r\n if (t) {\r\n var n = t.get('state')\r\n n && this.getStates().val(n), (e = t.getSelectors().getValid())\r\n }\r\n this.collection.reset(e), this.updateStateVis(t)\r\n },\r\n getTarget: function () {\r\n this.getStyleEmitter().model\r\n return this.target.getSelected()\r\n },\r\n updateStateVis: function (t) {\r\n var e = this.em,\r\n n = e && e.getConfig('avoidInlineStyle'),\r\n i = this.collection.length || n ? 'block' : 'none'\r\n this.getStatesC().css('display', i), this.updateSelector(t)\r\n },\r\n updateSelector: function (t) {\r\n var e = this.pfx,\r\n n = this.collection,\r\n i = this.el,\r\n r = t || this.getTarget()\r\n if (((this.compTarget = r), r && r.get)) {\r\n var o = r.get('state'),\r\n s = n.getFullString(r.getSelectors().getStyleable())\r\n ;(s = s || r.get('selectorsAdd') || (r.getId ? '#' + r.getId() : '')), (s += o ? ':' + o : '')\r\n var a = i.querySelector('#' + e + 'sel')\r\n a && (a.innerHTML = s)\r\n }\r\n },\r\n stateChanged: function (t) {\r\n this.compTarget && (this.compTarget.set('state', this.$states.val()), this.updateSelector())\r\n },\r\n addNewTag: function (t) {\r\n var e = this.target,\r\n n = this.compTarget\r\n if (t.trim()) {\r\n if (e) {\r\n var i = e.get('SelectorManager').add({ label: t })\r\n if (n) n.getSelectors().add(i), this.collection.add(i), this.updateStateVis()\r\n }\r\n this.endNewTag()\r\n }\r\n },\r\n addToClasses: function (t, e) {\r\n var n = e || null,\r\n i = new a({ model: t, config: this.config, coll: this.collection }).render().el\r\n return n ? n.appendChild(i) : this.getClasses().append(i), i\r\n },\r\n renderClasses: function () {\r\n var t = this,\r\n e = document.createDocumentFragment(),\r\n n = this.getClasses()\r\n return (\r\n this.collection.each(function (n) {\r\n return t.addToClasses(n, e)\r\n }),\r\n n.get(0) && n.empty().append(e),\r\n this\r\n )\r\n },\r\n getClasses: function () {\r\n return this.$classes || (this.$classes = this.$el.find('#' + this.pfx + 'tags-c')), this.$classes\r\n },\r\n getStates: function () {\r\n return this.$states || (this.$states = this.$el.find('#' + this.stateInputId)), this.$states\r\n },\r\n getStatesC: function () {\r\n return this.$statesC || (this.$statesC = this.$el.find('#' + this.stateInputC)), this.$statesC\r\n },\r\n render: function () {\r\n var t = this.ppfx,\r\n e = this.config,\r\n n = this.$el\r\n return (\r\n n.html(\r\n this.template({\r\n selectedLabel: e.selectedLabel,\r\n statesLabel: e.statesLabel,\r\n label: e.label,\r\n pfx: this.pfx,\r\n ppfx: this.ppfx\r\n })\r\n ),\r\n (this.$input = n.find('input#' + this.newInputId)),\r\n (this.$addBtn = n.find('#' + this.addBtnId)),\r\n (this.$classes = n.find('#' + this.pfx + 'tags-c')),\r\n (this.$states = n.find('#' + this.stateInputId)),\r\n (this.$statesC = n.find('#' + this.stateInputC)),\r\n this.$states.append(this.getStateOptions()),\r\n this.renderClasses(),\r\n n.attr('class', this.className + ' ' + t + 'one-bg ' + t + 'two-color'),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(9)\r\n t.exports = n(0).View.extend({\r\n template: function () {\r\n var t = this.pfx\r\n this.ppfx\r\n return (\r\n '\\n \\n ' +\r\n (this.model.get('label') || '') +\r\n '\\n \\n ⨯\\n \\n '\r\n )\r\n },\r\n events: {\r\n 'click [data-tag-remove]': 'removeTag',\r\n 'click [data-tag-status]': 'changeStatus',\r\n 'dblclick [data-tag-name]': 'startEditTag',\r\n 'focusout [data-tag-name]': 'endEditTag'\r\n },\r\n initialize: function (t) {\r\n ;(this.config = t.config || {}),\r\n (this.coll = t.coll || null),\r\n (this.pfx = this.config.stylePrefix || ''),\r\n (this.ppfx = this.config.pStylePrefix || ''),\r\n (this.em = this.config.em),\r\n this.listenTo(this.model, 'change:active', this.updateStatus)\r\n },\r\n getInputEl: function () {\r\n return this.inputEl || (this.inputEl = this.el.querySelector('[data-tag-name]')), this.inputEl\r\n },\r\n startEditTag: function () {\r\n var t = this.em,\r\n e = this.getInputEl()\r\n ;(e.contentEditable = !0), e.focus(), t && t.setEditing(1)\r\n },\r\n endEditTag: function () {\r\n var t = this.model,\r\n e = this.getInputEl(),\r\n n = e.textContent,\r\n r = i.escapeName(n),\r\n o = this.em,\r\n s = o && o.get('SelectorManager')\r\n ;(e.contentEditable = !1),\r\n o && o.setEditing(0),\r\n s && (s.get(r) ? (e.innerText = t.get('label')) : t.set({ name: r, label: n }))\r\n },\r\n changeStatus: function () {\r\n this.model.set('active', !this.model.get('active'))\r\n },\r\n removeTag: function (t) {\r\n var e = this.em,\r\n n = this.model,\r\n i = e && e.getSelected()\r\n i &&\r\n setTimeout(function () {\r\n return i.getSelectors().remove(n)\r\n })\r\n },\r\n updateStatus: function () {\r\n var t = 'fa-check-square-o'\r\n this.$chk || (this.$chk = this.$el.find('#' + this.pfx + 'checkbox')),\r\n this.model.get('active')\r\n ? (this.$chk.removeClass('fa-square-o').addClass(t), this.$el.removeClass('opac50'))\r\n : (this.$chk.removeClass(t).addClass('fa-square-o'), this.$el.addClass('opac50'))\r\n },\r\n render: function () {\r\n var t = this.pfx,\r\n e = this.ppfx\r\n return (\r\n this.$el.html(this.template()),\r\n this.$el.attr('class', t + 'tag ' + e + 'three-bg'),\r\n this.updateStatus(),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = function () {\r\n var t,\r\n e,\r\n i = {},\r\n r = n(138),\r\n o = n(139),\r\n s = n(140)\r\n return {\r\n name: 'Modal',\r\n init: function (n) {\r\n for (var a in ((i = n || {}), r)) a in i || (i[a] = r[a])\r\n var l = i.pStylePrefix\r\n return l && (i.stylePrefix = l + i.stylePrefix), (t = new o(i)), (e = new s({ model: t, config: i })), this\r\n },\r\n postRender: function (t) {\r\n var e = t.model.getConfig().el || t.el\r\n this.render().appendTo(e)\r\n },\r\n open: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n return t.title && this.setTitle(t.title), t.content && this.setContent(t.content), e.show(), this\r\n },\r\n close: function () {\r\n return e.hide(), this\r\n },\r\n isOpen: function () {\r\n return !!t.get('open')\r\n },\r\n setTitle: function (e) {\r\n return t.set('title', e), this\r\n },\r\n getTitle: function () {\r\n return t.get('title')\r\n },\r\n setContent: function (e) {\r\n return t.set('content', ' '), t.set('content', e), this\r\n },\r\n getContent: function () {\r\n return t.get('content')\r\n },\r\n getContentEl: function () {\r\n return e.getContent().get(0)\r\n },\r\n getModel: function () {\r\n return t\r\n },\r\n render: function () {\r\n return e.render().$el\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = { stylePrefix: 'mdl-', title: '', content: '', backdrop: !0 }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0)\r\n t.exports = i.Model.extend({ defaults: { title: '', content: '', open: !1 } })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(0).View.extend({\r\n template: function (t) {\r\n var e = t.pfx,\r\n n = t.ppfx,\r\n i = t.content\r\n return (\r\n '
\\n
\\n
' +\r\n t.title +\r\n '
\\n
⨯
\\n
\\n
\\n
' +\r\n i +\r\n '
\\n \\n
\\n
\\n '\r\n )\r\n },\r\n events: { click: 'onClick', 'click [data-close-modal]': 'hide' },\r\n initialize: function (t) {\r\n var e = this.model,\r\n n = t.config || {},\r\n i = n.stylePrefix || ''\r\n ;(this.config = n),\r\n (this.pfx = i),\r\n (this.ppfx = n.pStylePrefix || ''),\r\n this.listenTo(e, 'change:open', this.updateOpen),\r\n this.listenTo(e, 'change:title', this.updateTitle),\r\n this.listenTo(e, 'change:content', this.updateContent)\r\n },\r\n onClick: function (t) {\r\n this.config.backdrop && t.target === this.el && this.hide()\r\n },\r\n getCollector: function () {\r\n return this.$collector || (this.$collector = this.$el.find('.' + this.pfx + 'collector')), this.$collector\r\n },\r\n getContent: function () {\r\n var t = this.pfx\r\n return this.$content || (this.$content = this.$el.find('.' + t + 'content #' + t + 'c')), this.$content\r\n },\r\n getTitle: function () {\r\n return this.$title || (this.$title = this.$el.find('.' + this.pfx + 'title')), this.$title.get(0)\r\n },\r\n updateContent: function () {\r\n var t = this.getContent(),\r\n e = t.children(),\r\n n = this.getCollector(),\r\n i = this.model.get('content')\r\n e.length && n.append(e), t.empty().append(i)\r\n },\r\n updateTitle: function () {\r\n var t = this.getTitle()\r\n t && (t.innerHTML = this.model.get('title'))\r\n },\r\n updateOpen: function () {\r\n this.el.style.display = this.model.get('open') ? '' : 'none'\r\n },\r\n hide: function () {\r\n this.model.set('open', 0)\r\n },\r\n show: function () {\r\n this.model.set('open', 1)\r\n },\r\n render: function () {\r\n var t = this.$el,\r\n e = this.pfx,\r\n n = (this.ppfx, this.model.toJSON())\r\n return (\r\n (n.pfx = this.pfx),\r\n (n.ppfx = this.ppfx),\r\n t.html(this.template(n)),\r\n t.attr('class', e + 'container'),\r\n this.updateOpen(),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1)\r\n t.exports = function () {\r\n var t = {},\r\n e = n(142),\r\n r = n(143),\r\n o = n(144),\r\n s = n(145),\r\n a = n(146),\r\n l = n(147),\r\n c = n(152),\r\n u = {},\r\n h = {},\r\n d = {},\r\n f = {}\r\n return {\r\n getConfig: function () {\r\n return t\r\n },\r\n config: t,\r\n EditorView: c,\r\n name: 'CodeManager',\r\n init: function (n) {\r\n for (var i in ((t = n || {}), e)) i in t || (t[i] = e[i])\r\n var c = t.pStylePrefix\r\n return (\r\n c && (t.stylePrefix = c + t.stylePrefix),\r\n (h.html = new r()),\r\n (h.css = new o()),\r\n (h.json = new s()),\r\n (h.js = new a()),\r\n (f.CodeMirror = new l()),\r\n this.loadDefaultGenerators().loadDefaultViewers(),\r\n this\r\n )\r\n },\r\n addGenerator: function (t, e) {\r\n return (u[t] = e), this\r\n },\r\n getGenerator: function (t) {\r\n return u[t] || null\r\n },\r\n getGenerators: function () {\r\n return u\r\n },\r\n addViewer: function (t, e) {\r\n return (d[t] = e), this\r\n },\r\n getViewer: function (t) {\r\n return d[t] || null\r\n },\r\n getViewers: function () {\r\n return d\r\n },\r\n createViewer: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = (0, i.isUndefined)(t.type) ? 'CodeMirror' : t.type,\r\n n = this.getViewer(e) && this.getViewer(e).clone(),\r\n r = document.createElement('div'),\r\n o = document.createElement('textarea')\r\n return r.appendChild(o), n.set(t), n.init(o), n.setElement(r), n\r\n },\r\n updateViewer: function (t, e) {\r\n t.setContent(e)\r\n },\r\n getCode: function (e, n) {\r\n var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}\r\n i.em = t.em\r\n var r = this.getGenerator(n)\r\n return r ? r.build(e, i) : ''\r\n },\r\n loadDefaultGenerators: function () {\r\n for (var t in h) this.addGenerator(t, h[t])\r\n return this\r\n },\r\n loadDefaultViewers: function () {\r\n for (var t in f) this.addViewer(t, f[t])\r\n return this\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = { stylePrefix: 'cm-', inlineCss: !1 }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n t.exports = o.default.Model.extend({\r\n build: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = t.get('components')\r\n return e.exportWrapper\r\n ? e.wrappesIsBody\r\n ? '' + this.buildModels(n) + ''\r\n : t.toHTML()\r\n : this.buildModels(n)\r\n },\r\n buildModels: function (t) {\r\n var e = ''\r\n return (\r\n t.each(function (t) {\r\n e += t.toHTML()\r\n }),\r\n e\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1),\r\n r = Number.MAX_VALUE\r\n t.exports = n(0).Model.extend({\r\n initialize: function () {\r\n ;(this.compCls = []), (this.ids = [])\r\n },\r\n buildFromModel: function (t) {\r\n var e = this,\r\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n i = '',\r\n r = this.em,\r\n o = r && r.getConfig('avoidInlineStyle'),\r\n s = t.styleToString(),\r\n a = t.get('classes'),\r\n l = n.wrappesIsBody,\r\n c = t.get('wrapper')\r\n if (\r\n (this.ids.push('#' + t.getId()),\r\n a.each(function (t) {\r\n return e.compCls.push(t.getFullName())\r\n }),\r\n !o && s)\r\n ) {\r\n var u = '#' + t.getId()\r\n i = (u = l && c ? 'body' : u) + '{' + s + '}'\r\n }\r\n return (\r\n t.components().each(function (t) {\r\n return (i += e.buildFromModel(t, n))\r\n }),\r\n i\r\n )\r\n },\r\n build: function (t) {\r\n var e = this,\r\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n r = n.cssc,\r\n o = n.em || ''\r\n ;(this.em = o), (this.compCls = []), (this.ids = [])\r\n var s = this.buildFromModel(t, n),\r\n a = (0, i.isUndefined)(n.clearStyles) && o ? o.getConfig('clearStyles') : n.clearStyles\r\n if (r) {\r\n var l = r.getAll(),\r\n c = {},\r\n u = []\r\n l.each(function (t) {\r\n var i = t.getAtRule()\r\n if (i) {\r\n var r = c[i]\r\n r ? r.push(t) : (c[i] = [t])\r\n } else s += e.buildFromRule(t, u, n)\r\n }),\r\n this.sortMediaObject(c).forEach(function (t) {\r\n var i = '',\r\n r = t.key\r\n t.value.forEach(function (t) {\r\n var o = e.buildFromRule(t, u, n)\r\n t.get('singleAtRule') ? (s += r + '{' + o + '}') : (i += o)\r\n }),\r\n i && (s += r + '{' + i + '}')\r\n }),\r\n o && a && l.remove(u)\r\n }\r\n return s\r\n },\r\n buildFromRule: function (t, e) {\r\n var n = this,\r\n i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},\r\n r = '',\r\n o = t.selectorsToString({ skipAdd: 1 }),\r\n s = t.get('selectorsAdd'),\r\n a = t.get('singleAtRule'),\r\n l = void 0\r\n if (\r\n (t.get('selectors').each(function (t) {\r\n var e = t.getFullName()\r\n ;(n.compCls.indexOf(e) >= 0 || n.ids.indexOf(e) >= 0 || i.keepUnusedStyles) && (l = 1)\r\n }),\r\n (o && l) || s || a)\r\n ) {\r\n var c = t.getDeclaration()\r\n c && (r += c)\r\n } else e.push(t)\r\n return r\r\n },\r\n getQueryLength: function (t) {\r\n var e = /(-?\\d*\\.?\\d+)\\w{0,}/.exec(t)\r\n return e ? parseFloat(e[1]) : r\r\n },\r\n sortMediaObject: function () {\r\n var t = this,\r\n e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n n = []\r\n return (\r\n (0, i.each)(e, function (t, e) {\r\n return n.push({ key: e, value: t })\r\n }),\r\n n.sort(function (e, n) {\r\n return t.getQueryLength(n.key) - t.getQueryLength(e.key)\r\n })\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(1),\r\n o = n(0),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n t.exports = s.default.Model.extend({\r\n build: function (t) {\r\n var e = t.toJSON()\r\n return (\r\n this.beforeEach(e),\r\n (0, r.each)(\r\n e,\r\n function (t, n) {\r\n var i = e[n]\r\n if (i instanceof s.default.Model) e[n] = this.build(i)\r\n else if (i instanceof s.default.Collection) {\r\n var r = i\r\n ;(e[n] = []),\r\n r.length &&\r\n r.each(function (t, i) {\r\n e[n][i] = this.build(t)\r\n }, this)\r\n }\r\n },\r\n this\r\n ),\r\n e\r\n )\r\n },\r\n beforeEach: function (t) {\r\n delete t.status\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(1),\r\n o = n(0),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n t.exports = s.default.Model.extend({\r\n mapModel: function (t) {\r\n var e = '',\r\n n = t.get('script'),\r\n i = t.get('type'),\r\n o = t.get('components'),\r\n s = t.getId()\r\n if (n) {\r\n var a = t.get('attributes')\r\n ;(a = (0, r.extend)({}, a, { id: s })), t.set('attributes', a)\r\n var l = t.getScriptString()\r\n if (t.get('scriptUpdated')) this.mapJs[i + '-' + s] = { ids: [s], code: l }\r\n else {\r\n var c = this.mapJs[i]\r\n c ? c.ids.push(s) : (this.mapJs[i] = { ids: [s], code: l })\r\n }\r\n }\r\n return (\r\n o.each(function (t) {\r\n e += this.mapModel(t)\r\n }, this),\r\n e\r\n )\r\n },\r\n build: function (t) {\r\n ;(this.mapJs = {}), this.mapModel(t)\r\n var e = ''\r\n for (var n in this.mapJs) {\r\n var i = this.mapJs[n]\r\n e +=\r\n \"\\n var items = document.querySelectorAll('\" +\r\n ('#' + i.ids.join(', #')) +\r\n \"');\\n for (var i = 0, len = items.length; i < len; i++) {\\n (function(){\" +\r\n i.code +\r\n '}.bind(items[i]))();\\n }'\r\n }\r\n return e\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n o = n(0),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n var a = n(6)\r\n n(148), n(61), n(151)\r\n t.exports = s.default.Model.extend({\r\n defaults: { input: '', label: '', codeName: '', theme: '', readOnly: !0, lineNumbers: !0 },\r\n init: function (t) {\r\n return (\r\n (this.editor = a.fromTextArea(\r\n t,\r\n r({ dragDrop: !1, lineWrapping: !0, mode: this.get('codeName') }, this.attributes)\r\n )),\r\n (this.element = t),\r\n this\r\n )\r\n },\r\n getEditor: function () {\r\n return this.editor\r\n },\r\n getElement: function () {\r\n return this.element\r\n },\r\n setElement: function (t) {\r\n return (this.element = t), this\r\n },\r\n refresh: function () {\r\n return this.getEditor().refresh(), this\r\n },\r\n focus: function () {\r\n return this.getEditor().focus(), this\r\n },\r\n getContent: function () {\r\n var t = this.getEditor()\r\n return t && t.getValue()\r\n },\r\n setContent: function (t) {\r\n this.editor &&\r\n (this.editor.setValue(t),\r\n this.editor.autoFormatRange &&\r\n (a.commands.selectAll(this.editor),\r\n this.editor.autoFormatRange(this.editor.getCursor(!0), this.editor.getCursor(!1)),\r\n a.commands.goDocStart(this.editor)))\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n !(function (t) {\r\n 'use strict'\r\n var e = {\r\n script: [\r\n ['lang', /(javascript|babel)/i, 'javascript'],\r\n ['type', /^(?:text|application)\\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, 'javascript'],\r\n ['type', /./, 'text/plain'],\r\n [null, null, 'javascript']\r\n ],\r\n style: [\r\n ['lang', /^css$/i, 'css'],\r\n ['type', /^(text\\/)?(x-)?(stylesheet|css)$/i, 'css'],\r\n ['type', /./, 'text/plain'],\r\n [null, null, 'css']\r\n ]\r\n },\r\n n = {}\r\n function i (t, e) {\r\n var i = t.match(\r\n (function (t) {\r\n var e = n[t]\r\n return e || (n[t] = new RegExp('\\\\s+' + t + '\\\\s*=\\\\s*(\\'|\")?([^\\'\"]+)(\\'|\")?\\\\s*'))\r\n })(e)\r\n )\r\n return i ? /^\\s*(.*?)\\s*$/.exec(i[2])[1] : ''\r\n }\r\n function r (t, e) {\r\n return new RegExp((e ? '^' : '') + '', 'i')\r\n }\r\n function o (t, e) {\r\n for (var n in t) for (var i = e[n] || (e[n] = []), r = t[n], o = r.length - 1; o >= 0; o--) i.unshift(r[o])\r\n }\r\n t.defineMode(\r\n 'htmlmixed',\r\n function (n, s) {\r\n var a = t.getMode(n, {\r\n name: 'xml',\r\n htmlMode: !0,\r\n multilineTagIndentFactor: s.multilineTagIndentFactor,\r\n multilineTagIndentPastTag: s.multilineTagIndentPastTag\r\n }),\r\n l = {},\r\n c = s && s.tags,\r\n u = s && s.scriptTypes\r\n if ((o(e, l), c && o(c, l), u))\r\n for (var h = u.length - 1; h >= 0; h--) l.script.unshift(['type', u[h].matches, u[h].mode])\r\n function d (e, o) {\r\n var s,\r\n c = a.token(e, o.htmlState),\r\n u = /\\btag\\b/.test(c)\r\n if (\r\n u &&\r\n !/[<>\\s\\/]/.test(e.current()) &&\r\n (s = o.htmlState.tagName && o.htmlState.tagName.toLowerCase()) &&\r\n l.hasOwnProperty(s)\r\n )\r\n o.inTag = s + ' '\r\n else if (o.inTag && u && />$/.test(e.current())) {\r\n var h = /^([\\S]+) (.*)/.exec(o.inTag)\r\n o.inTag = null\r\n var f =\r\n '>' == e.current() &&\r\n (function (t, e) {\r\n for (var n = 0; n < t.length; n++) {\r\n var r = t[n]\r\n if (!r[0] || r[1].test(i(e, r[0]))) return r[2]\r\n }\r\n })(l[h[1]], h[2]),\r\n p = t.getMode(n, f),\r\n g = r(h[1], !0),\r\n v = r(h[1], !1)\r\n ;(o.token = function (t, e) {\r\n return t.match(g, !1)\r\n ? ((e.token = d), (e.localState = e.localMode = null), null)\r\n : (function (t, e, n) {\r\n var i = t.current(),\r\n r = i.search(e)\r\n return (\r\n r > -1\r\n ? t.backUp(i.length - r)\r\n : i.match(/<\\/?$/) && (t.backUp(i.length), t.match(e, !1) || t.match(i)),\r\n n\r\n )\r\n })(t, v, e.localMode.token(t, e.localState))\r\n }),\r\n (o.localMode = p),\r\n (o.localState = t.startState(p, a.indent(o.htmlState, '')))\r\n } else o.inTag && ((o.inTag += e.current()), e.eol() && (o.inTag += ' '))\r\n return c\r\n }\r\n return {\r\n startState: function () {\r\n var e = t.startState(a)\r\n return { token: d, inTag: null, localMode: null, localState: null, htmlState: e }\r\n },\r\n copyState: function (e) {\r\n var n\r\n return (\r\n e.localState && (n = t.copyState(e.localMode, e.localState)),\r\n {\r\n token: e.token,\r\n inTag: e.inTag,\r\n localMode: e.localMode,\r\n localState: n,\r\n htmlState: t.copyState(a, e.htmlState)\r\n }\r\n )\r\n },\r\n token: function (t, e) {\r\n return e.token(t, e)\r\n },\r\n indent: function (e, n, i) {\r\n return !e.localMode || /^\\s*<\\//.test(n)\r\n ? a.indent(e.htmlState, n)\r\n : e.localMode.indent\r\n ? e.localMode.indent(e.localState, n, i)\r\n : t.Pass\r\n },\r\n innerMode: function (t) {\r\n return { state: t.localState || t.htmlState, mode: t.localMode || a }\r\n }\r\n }\r\n },\r\n 'xml',\r\n 'javascript',\r\n 'css'\r\n ),\r\n t.defineMIME('text/html', 'htmlmixed')\r\n })(n(6), n(149), n(150), n(61))\r\n },\r\n function (t, e, n) {\r\n !(function (t) {\r\n 'use strict'\r\n var e = {\r\n autoSelfClosers: {\r\n area: !0,\r\n base: !0,\r\n br: !0,\r\n col: !0,\r\n command: !0,\r\n embed: !0,\r\n frame: !0,\r\n hr: !0,\r\n img: !0,\r\n input: !0,\r\n keygen: !0,\r\n link: !0,\r\n meta: !0,\r\n param: !0,\r\n source: !0,\r\n track: !0,\r\n wbr: !0,\r\n menuitem: !0\r\n },\r\n implicitlyClosed: {\r\n dd: !0,\r\n li: !0,\r\n optgroup: !0,\r\n option: !0,\r\n p: !0,\r\n rp: !0,\r\n rt: !0,\r\n tbody: !0,\r\n td: !0,\r\n tfoot: !0,\r\n th: !0,\r\n tr: !0\r\n },\r\n contextGrabbers: {\r\n dd: { dd: !0, dt: !0 },\r\n dt: { dd: !0, dt: !0 },\r\n li: { li: !0 },\r\n option: { option: !0, optgroup: !0 },\r\n optgroup: { optgroup: !0 },\r\n p: {\r\n address: !0,\r\n article: !0,\r\n aside: !0,\r\n blockquote: !0,\r\n dir: !0,\r\n div: !0,\r\n dl: !0,\r\n fieldset: !0,\r\n footer: !0,\r\n form: !0,\r\n h1: !0,\r\n h2: !0,\r\n h3: !0,\r\n h4: !0,\r\n h5: !0,\r\n h6: !0,\r\n header: !0,\r\n hgroup: !0,\r\n hr: !0,\r\n menu: !0,\r\n nav: !0,\r\n ol: !0,\r\n p: !0,\r\n pre: !0,\r\n section: !0,\r\n table: !0,\r\n ul: !0\r\n },\r\n rp: { rp: !0, rt: !0 },\r\n rt: { rp: !0, rt: !0 },\r\n tbody: { tbody: !0, tfoot: !0 },\r\n td: { td: !0, th: !0 },\r\n tfoot: { tbody: !0 },\r\n th: { td: !0, th: !0 },\r\n thead: { tbody: !0, tfoot: !0 },\r\n tr: { tr: !0 }\r\n },\r\n doNotIndent: { pre: !0 },\r\n allowUnquoted: !0,\r\n allowMissing: !0,\r\n caseFold: !0\r\n },\r\n n = {\r\n autoSelfClosers: {},\r\n implicitlyClosed: {},\r\n contextGrabbers: {},\r\n doNotIndent: {},\r\n allowUnquoted: !1,\r\n allowMissing: !1,\r\n allowMissingTagName: !1,\r\n caseFold: !1\r\n }\r\n t.defineMode('xml', function (i, r) {\r\n var o,\r\n s,\r\n a = i.indentUnit,\r\n l = {},\r\n c = r.htmlMode ? e : n\r\n for (var u in c) l[u] = c[u]\r\n for (var u in r) l[u] = r[u]\r\n function h (t, e) {\r\n function n (n) {\r\n return (e.tokenize = n), n(t, e)\r\n }\r\n var i = t.next()\r\n return '<' == i\r\n ? t.eat('!')\r\n ? t.eat('[')\r\n ? t.match('CDATA[')\r\n ? n(f('atom', ']]>'))\r\n : null\r\n : t.match('--')\r\n ? n(f('comment', '--\\x3e'))\r\n : t.match('DOCTYPE', !0, !0)\r\n ? (t.eatWhile(/[\\w\\._\\-]/),\r\n n(\r\n (function t (e) {\r\n return function (n, i) {\r\n for (var r; null != (r = n.next()); ) {\r\n if ('<' == r) return (i.tokenize = t(e + 1)), i.tokenize(n, i)\r\n if ('>' == r) {\r\n if (1 == e) {\r\n i.tokenize = h\r\n break\r\n }\r\n return (i.tokenize = t(e - 1)), i.tokenize(n, i)\r\n }\r\n }\r\n return 'meta'\r\n }\r\n })(1)\r\n ))\r\n : null\r\n : t.eat('?')\r\n ? (t.eatWhile(/[\\w\\._\\-]/), (e.tokenize = f('meta', '?>')), 'meta')\r\n : ((o = t.eat('/') ? 'closeTag' : 'openTag'), (e.tokenize = d), 'tag bracket')\r\n : '&' == i\r\n ? (t.eat('#')\r\n ? t.eat('x')\r\n ? t.eatWhile(/[a-fA-F\\d]/) && t.eat(';')\r\n : t.eatWhile(/[\\d]/) && t.eat(';')\r\n : t.eatWhile(/[\\w\\.\\-:]/) && t.eat(';'))\r\n ? 'atom'\r\n : 'error'\r\n : (t.eatWhile(/[^&<]/), null)\r\n }\r\n function d (t, e) {\r\n var n,\r\n i,\r\n r = t.next()\r\n if ('>' == r || ('/' == r && t.eat('>')))\r\n return (e.tokenize = h), (o = '>' == r ? 'endTag' : 'selfcloseTag'), 'tag bracket'\r\n if ('=' == r) return (o = 'equals'), null\r\n if ('<' == r) {\r\n ;(e.tokenize = h), (e.state = m), (e.tagName = e.tagStart = null)\r\n var s = e.tokenize(t, e)\r\n return s ? s + ' tag error' : 'tag error'\r\n }\r\n return /[\\'\\\"]/.test(r)\r\n ? ((e.tokenize = ((n = r),\r\n ((i = function (t, e) {\r\n for (; !t.eol(); )\r\n if (t.next() == n) {\r\n e.tokenize = d\r\n break\r\n }\r\n return 'string'\r\n }).isInAttribute = !0),\r\n i)),\r\n (e.stringStartCol = t.column()),\r\n e.tokenize(t, e))\r\n : (t.match(/^[^\\s\\u00a0=<>\\\"\\']*[^\\s\\u00a0=<>\\\"\\'\\/]/), 'word')\r\n }\r\n function f (t, e) {\r\n return function (n, i) {\r\n for (; !n.eol(); ) {\r\n if (n.match(e)) {\r\n i.tokenize = h\r\n break\r\n }\r\n n.next()\r\n }\r\n return t\r\n }\r\n }\r\n function p (t, e, n) {\r\n ;(this.prev = t.context),\r\n (this.tagName = e),\r\n (this.indent = t.indented),\r\n (this.startOfLine = n),\r\n (l.doNotIndent.hasOwnProperty(e) || (t.context && t.context.noIndent)) && (this.noIndent = !0)\r\n }\r\n function g (t) {\r\n t.context && (t.context = t.context.prev)\r\n }\r\n function v (t, e) {\r\n for (var n; ; ) {\r\n if (!t.context) return\r\n if (\r\n ((n = t.context.tagName),\r\n !l.contextGrabbers.hasOwnProperty(n) || !l.contextGrabbers[n].hasOwnProperty(e))\r\n )\r\n return\r\n g(t)\r\n }\r\n }\r\n function m (t, e, n) {\r\n return 'openTag' == t ? ((n.tagStart = e.column()), y) : 'closeTag' == t ? b : m\r\n }\r\n function y (t, e, n) {\r\n return 'word' == t\r\n ? ((n.tagName = e.current()), (s = 'tag'), C)\r\n : l.allowMissingTagName && 'endTag' == t\r\n ? ((s = 'tag bracket'), C(t, 0, n))\r\n : ((s = 'error'), y)\r\n }\r\n function b (t, e, n) {\r\n if ('word' == t) {\r\n var i = e.current()\r\n return (\r\n n.context && n.context.tagName != i && l.implicitlyClosed.hasOwnProperty(n.context.tagName) && g(n),\r\n (n.context && n.context.tagName == i) || !1 === l.matchClosing\r\n ? ((s = 'tag'), x)\r\n : ((s = 'tag error'), w)\r\n )\r\n }\r\n return l.allowMissingTagName && 'endTag' == t ? ((s = 'tag bracket'), x(t, 0, n)) : ((s = 'error'), w)\r\n }\r\n function x (t, e, n) {\r\n return 'endTag' != t ? ((s = 'error'), x) : (g(n), m)\r\n }\r\n function w (t, e, n) {\r\n return (s = 'error'), x(t, 0, n)\r\n }\r\n function C (t, e, n) {\r\n if ('word' == t) return (s = 'attribute'), k\r\n if ('endTag' == t || 'selfcloseTag' == t) {\r\n var i = n.tagName,\r\n r = n.tagStart\r\n return (\r\n (n.tagName = n.tagStart = null),\r\n 'selfcloseTag' == t || l.autoSelfClosers.hasOwnProperty(i)\r\n ? v(n, i)\r\n : (v(n, i), (n.context = new p(n, i, r == n.indented))),\r\n m\r\n )\r\n }\r\n return (s = 'error'), C\r\n }\r\n function k (t, e, n) {\r\n return 'equals' == t ? S : (l.allowMissing || (s = 'error'), C(t, 0, n))\r\n }\r\n function S (t, e, n) {\r\n return 'string' == t\r\n ? T\r\n : 'word' == t && l.allowUnquoted\r\n ? ((s = 'string'), C)\r\n : ((s = 'error'), C(t, 0, n))\r\n }\r\n function T (t, e, n) {\r\n return 'string' == t ? T : C(t, 0, n)\r\n }\r\n return (\r\n (h.isInText = !0),\r\n {\r\n startState: function (t) {\r\n var e = { tokenize: h, state: m, indented: t || 0, tagName: null, tagStart: null, context: null }\r\n return null != t && (e.baseIndent = t), e\r\n },\r\n token: function (t, e) {\r\n if ((!e.tagName && t.sol() && (e.indented = t.indentation()), t.eatSpace())) return null\r\n o = null\r\n var n = e.tokenize(t, e)\r\n return (\r\n (n || o) &&\r\n 'comment' != n &&\r\n ((s = null), (e.state = e.state(o || n, t, e)), s && (n = 'error' == s ? n + ' error' : s)),\r\n n\r\n )\r\n },\r\n indent: function (e, n, i) {\r\n var r = e.context\r\n if (e.tokenize.isInAttribute) return e.tagStart == e.indented ? e.stringStartCol + 1 : e.indented + a\r\n if (r && r.noIndent) return t.Pass\r\n if (e.tokenize != d && e.tokenize != h) return i ? i.match(/^(\\s*)/)[0].length : 0\r\n if (e.tagName)\r\n return !1 !== l.multilineTagIndentPastTag\r\n ? e.tagStart + e.tagName.length + 2\r\n : e.tagStart + a * (l.multilineTagIndentFactor || 1)\r\n if (l.alignCDATA && /$/,\r\n blockCommentStart: '\\x3c!--',\r\n blockCommentEnd: '--\\x3e',\r\n configuration: l.htmlMode ? 'html' : 'xml',\r\n helperType: l.htmlMode ? 'html' : 'xml',\r\n skipAttribute: function (t) {\r\n t.state == S && (t.state = C)\r\n }\r\n }\r\n )\r\n }),\r\n t.defineMIME('text/xml', 'xml'),\r\n t.defineMIME('application/xml', 'xml'),\r\n t.mimeModes.hasOwnProperty('text/html') || t.defineMIME('text/html', { name: 'xml', htmlMode: !0 })\r\n })(n(6))\r\n },\r\n function (t, e, n) {\r\n !(function (t) {\r\n 'use strict'\r\n t.defineMode('javascript', function (e, n) {\r\n var i,\r\n r,\r\n o = e.indentUnit,\r\n s = n.statementIndent,\r\n a = n.jsonld,\r\n l = n.json || a,\r\n c = n.typescript,\r\n u = n.wordCharacters || /[\\w$\\xa1-\\uffff]/,\r\n h = (function () {\r\n function t (t) {\r\n return { type: t, style: 'keyword' }\r\n }\r\n var e = t('keyword a'),\r\n n = t('keyword b'),\r\n i = t('keyword c'),\r\n r = t('keyword d'),\r\n o = t('operator'),\r\n s = { type: 'atom', style: 'atom' }\r\n return {\r\n if: t('if'),\r\n while: e,\r\n with: e,\r\n else: n,\r\n do: n,\r\n try: n,\r\n finally: n,\r\n return: r,\r\n break: r,\r\n continue: r,\r\n new: t('new'),\r\n delete: i,\r\n void: i,\r\n throw: i,\r\n debugger: t('debugger'),\r\n var: t('var'),\r\n const: t('var'),\r\n let: t('var'),\r\n function: t('function'),\r\n catch: t('catch'),\r\n for: t('for'),\r\n switch: t('switch'),\r\n case: t('case'),\r\n default: t('default'),\r\n in: o,\r\n typeof: o,\r\n instanceof: o,\r\n true: s,\r\n false: s,\r\n null: s,\r\n undefined: s,\r\n NaN: s,\r\n Infinity: s,\r\n this: t('this'),\r\n class: t('class'),\r\n super: t('atom'),\r\n yield: i,\r\n export: t('export'),\r\n import: t('import'),\r\n extends: i,\r\n await: i\r\n }\r\n })(),\r\n d = /[+\\-*&%=<>!?|~^@]/,\r\n f = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/\r\n function p (t, e, n) {\r\n return (i = t), (r = n), e\r\n }\r\n function g (t, e) {\r\n var n,\r\n i = t.next()\r\n if ('\"' == i || \"'\" == i)\r\n return (\r\n (e.tokenize = ((n = i),\r\n function (t, e) {\r\n var i,\r\n r = !1\r\n if (a && '@' == t.peek() && t.match(f)) return (e.tokenize = g), p('jsonld-keyword', 'meta')\r\n for (; null != (i = t.next()) && (i != n || r); ) r = !r && '\\\\' == i\r\n return r || (e.tokenize = g), p('string', 'string')\r\n })),\r\n e.tokenize(t, e)\r\n )\r\n if ('.' == i && t.match(/^\\d+(?:[eE][+\\-]?\\d+)?/)) return p('number', 'number')\r\n if ('.' == i && t.match('..')) return p('spread', 'meta')\r\n if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(i)) return p(i)\r\n if ('=' == i && t.eat('>')) return p('=>', 'operator')\r\n if ('0' == i && t.match(/^(?:x[\\da-f]+|o[0-7]+|b[01]+)n?/i)) return p('number', 'number')\r\n if (/\\d/.test(i)) return t.match(/^\\d*(?:n|(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)?/), p('number', 'number')\r\n if ('/' == i)\r\n return t.eat('*')\r\n ? ((e.tokenize = v), v(t, e))\r\n : t.eat('/')\r\n ? (t.skipToEnd(), p('comment', 'comment'))\r\n : Kt(t, e, 1)\r\n ? ((function (t) {\r\n for (var e, n = !1, i = !1; null != (e = t.next()); ) {\r\n if (!n) {\r\n if ('/' == e && !i) return\r\n '[' == e ? (i = !0) : i && ']' == e && (i = !1)\r\n }\r\n n = !n && '\\\\' == e\r\n }\r\n })(t),\r\n t.match(/^\\b(([gimyus])(?![gimyus]*\\2))+\\b/),\r\n p('regexp', 'string-2'))\r\n : (t.eat('='), p('operator', 'operator', t.current()))\r\n if ('`' == i) return (e.tokenize = m), m(t, e)\r\n if ('#' == i) return t.skipToEnd(), p('error', 'error')\r\n if (d.test(i))\r\n return (\r\n ('>' == i && e.lexical && '>' == e.lexical.type) ||\r\n (t.eat('=')\r\n ? ('!' != i && '=' != i) || t.eat('=')\r\n : /[<>*+\\-]/.test(i) && (t.eat(i), '>' == i && t.eat(i))),\r\n p('operator', 'operator', t.current())\r\n )\r\n if (u.test(i)) {\r\n t.eatWhile(u)\r\n var r = t.current()\r\n if ('.' != e.lastType) {\r\n if (h.propertyIsEnumerable(r)) {\r\n var o = h[r]\r\n return p(o.type, o.style, r)\r\n }\r\n if ('async' == r && t.match(/^(\\s|\\/\\*.*?\\*\\/)*[\\[\\(\\w]/, !1)) return p('async', 'keyword', r)\r\n }\r\n return p('variable', 'variable', r)\r\n }\r\n }\r\n function v (t, e) {\r\n for (var n, i = !1; (n = t.next()); ) {\r\n if ('/' == n && i) {\r\n e.tokenize = g\r\n break\r\n }\r\n i = '*' == n\r\n }\r\n return p('comment', 'comment')\r\n }\r\n function m (t, e) {\r\n for (var n, i = !1; null != (n = t.next()); ) {\r\n if (!i && ('`' == n || ('$' == n && t.eat('{')))) {\r\n e.tokenize = g\r\n break\r\n }\r\n i = !i && '\\\\' == n\r\n }\r\n return p('quasi', 'string-2', t.current())\r\n }\r\n var y = '([{}])'\r\n function b (t, e) {\r\n e.fatArrowAt && (e.fatArrowAt = null)\r\n var n = t.string.indexOf('=>', t.start)\r\n if (!(n < 0)) {\r\n if (c) {\r\n var i = /:\\s*(?:\\w+(?:<[^>]*>|\\[\\])?|\\{[^}]*\\})\\s*$/.exec(t.string.slice(t.start, n))\r\n i && (n = i.index)\r\n }\r\n for (var r = 0, o = !1, s = n - 1; s >= 0; --s) {\r\n var a = t.string.charAt(s),\r\n l = y.indexOf(a)\r\n if (l >= 0 && l < 3) {\r\n if (!r) {\r\n ++s\r\n break\r\n }\r\n if (0 == --r) {\r\n '(' == a && (o = !0)\r\n break\r\n }\r\n } else if (l >= 3 && l < 6) ++r\r\n else if (u.test(a)) o = !0\r\n else {\r\n if (/[\"'\\/]/.test(a)) return\r\n if (o && !r) {\r\n ++s\r\n break\r\n }\r\n }\r\n }\r\n o && !r && (e.fatArrowAt = s)\r\n }\r\n }\r\n var x = { atom: !0, number: !0, variable: !0, string: !0, regexp: !0, this: !0, 'jsonld-keyword': !0 }\r\n function w (t, e, n, i, r, o) {\r\n ;(this.indented = t),\r\n (this.column = e),\r\n (this.type = n),\r\n (this.prev = r),\r\n (this.info = o),\r\n null != i && (this.align = i)\r\n }\r\n function C (t, e) {\r\n for (var n = t.localVars; n; n = n.next) if (n.name == e) return !0\r\n for (var i = t.context; i; i = i.prev) for (var n = i.vars; n; n = n.next) if (n.name == e) return !0\r\n }\r\n var k = { state: null, column: null, marked: null, cc: null }\r\n function S () {\r\n for (var t = arguments.length - 1; t >= 0; t--) k.cc.push(arguments[t])\r\n }\r\n function T () {\r\n return S.apply(null, arguments), !0\r\n }\r\n function E (t, e) {\r\n for (var n = e; n; n = n.next) if (n.name == t) return !0\r\n return !1\r\n }\r\n function M (t) {\r\n var e = k.state\r\n if (((k.marked = 'def'), e.context))\r\n if ('var' == e.lexical.info && e.context && e.context.block) {\r\n var i = (function t (e, n) {\r\n if (n) {\r\n if (n.block) {\r\n var i = t(e, n.prev)\r\n return i ? (i == n.prev ? n : new O(i, n.vars, !0)) : null\r\n }\r\n return E(e, n.vars) ? n : new O(n.prev, new P(e, n.vars), !1)\r\n }\r\n return null\r\n })(t, e.context)\r\n if (null != i) return void (e.context = i)\r\n } else if (!E(t, e.localVars)) return void (e.localVars = new P(t, e.localVars))\r\n n.globalVars && !E(t, e.globalVars) && (e.globalVars = new P(t, e.globalVars))\r\n }\r\n function A (t) {\r\n return 'public' == t || 'private' == t || 'protected' == t || 'abstract' == t || 'readonly' == t\r\n }\r\n function O (t, e, n) {\r\n ;(this.prev = t), (this.vars = e), (this.block = n)\r\n }\r\n function P (t, e) {\r\n ;(this.name = t), (this.next = e)\r\n }\r\n var L = new P('this', new P('arguments', null))\r\n function _ () {\r\n ;(k.state.context = new O(k.state.context, k.state.localVars, !1)), (k.state.localVars = L)\r\n }\r\n function N () {\r\n ;(k.state.context = new O(k.state.context, k.state.localVars, !0)), (k.state.localVars = null)\r\n }\r\n function D () {\r\n ;(k.state.localVars = k.state.context.vars), (k.state.context = k.state.context.prev)\r\n }\r\n function I (t, e) {\r\n var n = function () {\r\n var n = k.state,\r\n i = n.indented\r\n if ('stat' == n.lexical.type) i = n.lexical.indented\r\n else for (var r = n.lexical; r && ')' == r.type && r.align; r = r.prev) i = r.indented\r\n n.lexical = new w(i, k.stream.column(), t, null, n.lexical, e)\r\n }\r\n return (n.lex = !0), n\r\n }\r\n function F () {\r\n var t = k.state\r\n t.lexical.prev && (')' == t.lexical.type && (t.indented = t.lexical.indented), (t.lexical = t.lexical.prev))\r\n }\r\n function j (t) {\r\n return function e (n) {\r\n return n == t ? T() : ';' == t || '}' == n || ')' == n || ']' == n ? S() : T(e)\r\n }\r\n }\r\n function R (t, e) {\r\n return 'var' == t\r\n ? T(I('vardef', e), yt, j(';'), F)\r\n : 'keyword a' == t\r\n ? T(I('form'), $, R, F)\r\n : 'keyword b' == t\r\n ? T(I('form'), R, F)\r\n : 'keyword d' == t\r\n ? k.stream.match(/^\\s*$/, !1)\r\n ? T()\r\n : T(I('stat'), W, j(';'), F)\r\n : 'debugger' == t\r\n ? T(j(';'))\r\n : '{' == t\r\n ? T(I('}'), N, st, F, D)\r\n : ';' == t\r\n ? T()\r\n : 'if' == t\r\n ? ('else' == k.state.lexical.info && k.state.cc[k.state.cc.length - 1] == F && k.state.cc.pop()(),\r\n T(I('form'), $, R, F, St))\r\n : 'function' == t\r\n ? T(Pt)\r\n : 'for' == t\r\n ? T(I('form'), Tt, R, F)\r\n : 'class' == t || (c && 'interface' == e)\r\n ? ((k.marked = 'keyword'), T(I('form'), Nt, F))\r\n : 'variable' == t\r\n ? c && 'declare' == e\r\n ? ((k.marked = 'keyword'), T(R))\r\n : c && ('module' == e || 'enum' == e || 'type' == e) && k.stream.match(/^\\s*\\w/, !1)\r\n ? ((k.marked = 'keyword'),\r\n 'enum' == e\r\n ? T(Ut)\r\n : 'type' == e\r\n ? T(ut, j('operator'), ut, j(';'))\r\n : T(I('form'), bt, j('{'), I('}'), st, F, F))\r\n : c && 'namespace' == e\r\n ? ((k.marked = 'keyword'), T(I('form'), V, st, F))\r\n : c && 'abstract' == e\r\n ? ((k.marked = 'keyword'), T(R))\r\n : T(I('stat'), Q)\r\n : 'switch' == t\r\n ? T(I('form'), $, j('{'), I('}', 'switch'), N, st, F, F, D)\r\n : 'case' == t\r\n ? T(V, j(':'))\r\n : 'default' == t\r\n ? T(j(':'))\r\n : 'catch' == t\r\n ? T(I('form'), _, z, R, F, D)\r\n : 'export' == t\r\n ? T(I('stat'), jt, F)\r\n : 'import' == t\r\n ? T(I('stat'), zt, F)\r\n : 'async' == t\r\n ? T(R)\r\n : '@' == e\r\n ? T(V, R)\r\n : S(I('stat'), V, j(';'), F)\r\n }\r\n function z (t) {\r\n if ('(' == t) return T(Lt, j(')'))\r\n }\r\n function V (t, e) {\r\n return B(t, e, !1)\r\n }\r\n function H (t, e) {\r\n return B(t, e, !0)\r\n }\r\n function $ (t) {\r\n return '(' != t ? S() : T(I(')'), V, j(')'), F)\r\n }\r\n function B (t, e, n) {\r\n if (k.state.fatArrowAt == k.stream.start) {\r\n var i = n ? X : G\r\n if ('(' == t) return T(_, I(')'), rt(Lt, ')'), F, j('=>'), i, D)\r\n if ('variable' == t) return S(_, bt, j('=>'), i, D)\r\n }\r\n var r = n ? q : U\r\n return x.hasOwnProperty(t)\r\n ? T(r)\r\n : 'function' == t\r\n ? T(Pt, r)\r\n : 'class' == t || (c && 'interface' == e)\r\n ? ((k.marked = 'keyword'), T(I('form'), _t, F))\r\n : 'keyword c' == t || 'async' == t\r\n ? T(n ? H : V)\r\n : '(' == t\r\n ? T(I(')'), W, j(')'), F, r)\r\n : 'operator' == t || 'spread' == t\r\n ? T(n ? H : V)\r\n : '[' == t\r\n ? T(I(']'), Wt, F, r)\r\n : '{' == t\r\n ? ot(et, '}', null, r)\r\n : 'quasi' == t\r\n ? S(K, r)\r\n : 'new' == t\r\n ? T(\r\n (function (t) {\r\n return function (e) {\r\n return '.' == e ? T(t ? Z : J) : 'variable' == e && c ? T(gt, t ? q : U) : S(t ? H : V)\r\n }\r\n })(n)\r\n )\r\n : 'import' == t\r\n ? T(V)\r\n : T()\r\n }\r\n function W (t) {\r\n return t.match(/[;\\}\\)\\],]/) ? S() : S(V)\r\n }\r\n function U (t, e) {\r\n return ',' == t ? T(V) : q(t, e, !1)\r\n }\r\n function q (t, e, n) {\r\n var i = 0 == n ? U : q,\r\n r = 0 == n ? V : H\r\n return '=>' == t\r\n ? T(_, n ? X : G, D)\r\n : 'operator' == t\r\n ? /\\+\\+|--/.test(e) || (c && '!' == e)\r\n ? T(i)\r\n : c && '<' == e && k.stream.match(/^([^>]|<.*?>)*>\\s*\\(/, !1)\r\n ? T(I('>'), rt(ut, '>'), F, i)\r\n : '?' == e\r\n ? T(V, j(':'), r)\r\n : T(r)\r\n : 'quasi' == t\r\n ? S(K, i)\r\n : ';' != t\r\n ? '(' == t\r\n ? ot(H, ')', 'call', i)\r\n : '.' == t\r\n ? T(tt, i)\r\n : '[' == t\r\n ? T(I(']'), W, j(']'), F, i)\r\n : c && 'as' == e\r\n ? ((k.marked = 'keyword'), T(ut, i))\r\n : 'regexp' == t\r\n ? ((k.state.lastType = k.marked = 'operator'), k.stream.backUp(k.stream.pos - k.stream.start - 1), T(r))\r\n : void 0\r\n : void 0\r\n }\r\n function K (t, e) {\r\n return 'quasi' != t ? S() : '${' != e.slice(e.length - 2) ? T(K) : T(V, Y)\r\n }\r\n function Y (t) {\r\n if ('}' == t) return (k.marked = 'string-2'), (k.state.tokenize = m), T(K)\r\n }\r\n function G (t) {\r\n return b(k.stream, k.state), S('{' == t ? R : V)\r\n }\r\n function X (t) {\r\n return b(k.stream, k.state), S('{' == t ? R : H)\r\n }\r\n function J (t, e) {\r\n if ('target' == e) return (k.marked = 'keyword'), T(U)\r\n }\r\n function Z (t, e) {\r\n if ('target' == e) return (k.marked = 'keyword'), T(q)\r\n }\r\n function Q (t) {\r\n return ':' == t ? T(F, R) : S(U, j(';'), F)\r\n }\r\n function tt (t) {\r\n if ('variable' == t) return (k.marked = 'property'), T()\r\n }\r\n function et (t, e) {\r\n return 'async' == t\r\n ? ((k.marked = 'property'), T(et))\r\n : 'variable' == t || 'keyword' == k.style\r\n ? ((k.marked = 'property'),\r\n 'get' == e || 'set' == e\r\n ? T(nt)\r\n : (c &&\r\n k.state.fatArrowAt == k.stream.start &&\r\n (n = k.stream.match(/^\\s*:\\s*/, !1)) &&\r\n (k.state.fatArrowAt = k.stream.pos + n[0].length),\r\n T(it)))\r\n : 'number' == t || 'string' == t\r\n ? ((k.marked = a ? 'property' : k.style + ' property'), T(it))\r\n : 'jsonld-keyword' == t\r\n ? T(it)\r\n : c && A(e)\r\n ? ((k.marked = 'keyword'), T(et))\r\n : '[' == t\r\n ? T(V, at, j(']'), it)\r\n : 'spread' == t\r\n ? T(H, it)\r\n : '*' == e\r\n ? ((k.marked = 'keyword'), T(et))\r\n : ':' == t\r\n ? S(it)\r\n : void 0\r\n var n\r\n }\r\n function nt (t) {\r\n return 'variable' != t ? S(it) : ((k.marked = 'property'), T(Pt))\r\n }\r\n function it (t) {\r\n return ':' == t ? T(H) : '(' == t ? S(Pt) : void 0\r\n }\r\n function rt (t, e, n) {\r\n function i (r, o) {\r\n if (n ? n.indexOf(r) > -1 : ',' == r) {\r\n var s = k.state.lexical\r\n return (\r\n 'call' == s.info && (s.pos = (s.pos || 0) + 1),\r\n T(function (n, i) {\r\n return n == e || i == e ? S() : S(t)\r\n }, i)\r\n )\r\n }\r\n return r == e || o == e ? T() : T(j(e))\r\n }\r\n return function (n, r) {\r\n return n == e || r == e ? T() : S(t, i)\r\n }\r\n }\r\n function ot (t, e, n) {\r\n for (var i = 3; i < arguments.length; i++) k.cc.push(arguments[i])\r\n return T(I(e, n), rt(t, e), F)\r\n }\r\n function st (t) {\r\n return '}' == t ? T() : S(R, st)\r\n }\r\n function at (t, e) {\r\n if (c) {\r\n if (':' == t) return T(ut)\r\n if ('?' == e) return T(at)\r\n }\r\n }\r\n function lt (t) {\r\n if (c && ':' == t) return k.stream.match(/^\\s*\\w+\\s+is\\b/, !1) ? T(V, ct, ut) : T(ut)\r\n }\r\n function ct (t, e) {\r\n if ('is' == e) return (k.marked = 'keyword'), T()\r\n }\r\n function ut (t, e) {\r\n return 'keyof' == e || 'typeof' == e\r\n ? ((k.marked = 'keyword'), T('keyof' == e ? ut : H))\r\n : 'variable' == t || 'void' == e\r\n ? ((k.marked = 'type'), T(pt))\r\n : 'string' == t || 'number' == t || 'atom' == t\r\n ? T(pt)\r\n : '[' == t\r\n ? T(I(']'), rt(ut, ']', ','), F, pt)\r\n : '{' == t\r\n ? T(I('}'), rt(dt, '}', ',;'), F, pt)\r\n : '(' == t\r\n ? T(rt(ft, ')'), ht)\r\n : '<' == t\r\n ? T(rt(ut, '>'), ut)\r\n : void 0\r\n }\r\n function ht (t) {\r\n if ('=>' == t) return T(ut)\r\n }\r\n function dt (t, e) {\r\n return 'variable' == t || 'keyword' == k.style\r\n ? ((k.marked = 'property'), T(dt))\r\n : '?' == e\r\n ? T(dt)\r\n : ':' == t\r\n ? T(ut)\r\n : '[' == t\r\n ? T(V, at, j(']'), dt)\r\n : void 0\r\n }\r\n function ft (t, e) {\r\n return ('variable' == t && k.stream.match(/^\\s*[?:]/, !1)) || '?' == e ? T(ft) : ':' == t ? T(ut) : S(ut)\r\n }\r\n function pt (t, e) {\r\n return '<' == e\r\n ? T(I('>'), rt(ut, '>'), F, pt)\r\n : '|' == e || '.' == t || '&' == e\r\n ? T(ut)\r\n : '[' == t\r\n ? T(j(']'), pt)\r\n : 'extends' == e || 'implements' == e\r\n ? ((k.marked = 'keyword'), T(ut))\r\n : void 0\r\n }\r\n function gt (t, e) {\r\n if ('<' == e) return T(I('>'), rt(ut, '>'), F, pt)\r\n }\r\n function vt () {\r\n return S(ut, mt)\r\n }\r\n function mt (t, e) {\r\n if ('=' == e) return T(ut)\r\n }\r\n function yt (t, e) {\r\n return 'enum' == e ? ((k.marked = 'keyword'), T(Ut)) : S(bt, at, Ct, kt)\r\n }\r\n function bt (t, e) {\r\n return c && A(e)\r\n ? ((k.marked = 'keyword'), T(bt))\r\n : 'variable' == t\r\n ? (M(e), T())\r\n : 'spread' == t\r\n ? T(bt)\r\n : '[' == t\r\n ? ot(wt, ']')\r\n : '{' == t\r\n ? ot(xt, '}')\r\n : void 0\r\n }\r\n function xt (t, e) {\r\n return 'variable' != t || k.stream.match(/^\\s*:/, !1)\r\n ? ('variable' == t && (k.marked = 'property'),\r\n 'spread' == t ? T(bt) : '}' == t ? S() : '[' == t ? T(V, j(']'), j(':'), xt) : T(j(':'), bt, Ct))\r\n : (M(e), T(Ct))\r\n }\r\n function wt () {\r\n return S(bt, Ct)\r\n }\r\n function Ct (t, e) {\r\n if ('=' == e) return T(H)\r\n }\r\n function kt (t) {\r\n if (',' == t) return T(yt)\r\n }\r\n function St (t, e) {\r\n if ('keyword b' == t && 'else' == e) return T(I('form', 'else'), R, F)\r\n }\r\n function Tt (t, e) {\r\n return 'await' == e ? T(Tt) : '(' == t ? T(I(')'), Et, j(')'), F) : void 0\r\n }\r\n function Et (t) {\r\n return 'var' == t ? T(yt, j(';'), At) : ';' == t ? T(At) : 'variable' == t ? T(Mt) : S(V, j(';'), At)\r\n }\r\n function Mt (t, e) {\r\n return 'in' == e || 'of' == e ? ((k.marked = 'keyword'), T(V)) : T(U, At)\r\n }\r\n function At (t, e) {\r\n return ';' == t ? T(Ot) : 'in' == e || 'of' == e ? ((k.marked = 'keyword'), T(V)) : S(V, j(';'), Ot)\r\n }\r\n function Ot (t) {\r\n ')' != t && T(V)\r\n }\r\n function Pt (t, e) {\r\n return '*' == e\r\n ? ((k.marked = 'keyword'), T(Pt))\r\n : 'variable' == t\r\n ? (M(e), T(Pt))\r\n : '(' == t\r\n ? T(_, I(')'), rt(Lt, ')'), F, lt, R, D)\r\n : c && '<' == e\r\n ? T(I('>'), rt(vt, '>'), F, Pt)\r\n : void 0\r\n }\r\n function Lt (t, e) {\r\n return (\r\n '@' == e && T(V, Lt), 'spread' == t ? T(Lt) : c && A(e) ? ((k.marked = 'keyword'), T(Lt)) : S(bt, at, Ct)\r\n )\r\n }\r\n function _t (t, e) {\r\n return 'variable' == t ? Nt(t, e) : Dt(t, e)\r\n }\r\n function Nt (t, e) {\r\n if ('variable' == t) return M(e), T(Dt)\r\n }\r\n function Dt (t, e) {\r\n return '<' == e\r\n ? T(I('>'), rt(vt, '>'), F, Dt)\r\n : 'extends' == e || 'implements' == e || (c && ',' == t)\r\n ? ('implements' == e && (k.marked = 'keyword'), T(c ? ut : V, Dt))\r\n : '{' == t\r\n ? T(I('}'), It, F)\r\n : void 0\r\n }\r\n function It (t, e) {\r\n return 'async' == t ||\r\n ('variable' == t &&\r\n ('static' == e || 'get' == e || 'set' == e || (c && A(e))) &&\r\n k.stream.match(/^\\s+[\\w$\\xa1-\\uffff]/, !1))\r\n ? ((k.marked = 'keyword'), T(It))\r\n : 'variable' == t || 'keyword' == k.style\r\n ? ((k.marked = 'property'), T(c ? Ft : Pt, It))\r\n : '[' == t\r\n ? T(V, at, j(']'), c ? Ft : Pt, It)\r\n : '*' == e\r\n ? ((k.marked = 'keyword'), T(It))\r\n : ';' == t\r\n ? T(It)\r\n : '}' == t\r\n ? T()\r\n : '@' == e\r\n ? T(V, It)\r\n : void 0\r\n }\r\n function Ft (t, e) {\r\n return '?' == e ? T(Ft) : ':' == t ? T(ut, Ct) : '=' == e ? T(H) : S(Pt)\r\n }\r\n function jt (t, e) {\r\n return '*' == e\r\n ? ((k.marked = 'keyword'), T(Bt, j(';')))\r\n : 'default' == e\r\n ? ((k.marked = 'keyword'), T(V, j(';')))\r\n : '{' == t\r\n ? T(rt(Rt, '}'), Bt, j(';'))\r\n : S(R)\r\n }\r\n function Rt (t, e) {\r\n return 'as' == e ? ((k.marked = 'keyword'), T(j('variable'))) : 'variable' == t ? S(H, Rt) : void 0\r\n }\r\n function zt (t) {\r\n return 'string' == t ? T() : '(' == t ? S(V) : S(Vt, Ht, Bt)\r\n }\r\n function Vt (t, e) {\r\n return '{' == t ? ot(Vt, '}') : ('variable' == t && M(e), '*' == e && (k.marked = 'keyword'), T($t))\r\n }\r\n function Ht (t) {\r\n if (',' == t) return T(Vt, Ht)\r\n }\r\n function $t (t, e) {\r\n if ('as' == e) return (k.marked = 'keyword'), T(Vt)\r\n }\r\n function Bt (t, e) {\r\n if ('from' == e) return (k.marked = 'keyword'), T(V)\r\n }\r\n function Wt (t) {\r\n return ']' == t ? T() : S(rt(H, ']'))\r\n }\r\n function Ut () {\r\n return S(I('form'), bt, j('{'), I('}'), rt(qt, '}'), F, F)\r\n }\r\n function qt () {\r\n return S(bt, Ct)\r\n }\r\n function Kt (t, e, n) {\r\n return (\r\n (e.tokenize == g &&\r\n /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\\[{}\\(,;:]|=>)$/.test(e.lastType)) ||\r\n ('quasi' == e.lastType && /\\{\\s*$/.test(t.string.slice(0, t.pos - (n || 0))))\r\n )\r\n }\r\n return (\r\n (D.lex = !0),\r\n (F.lex = !0),\r\n {\r\n startState: function (t) {\r\n var e = {\r\n tokenize: g,\r\n lastType: 'sof',\r\n cc: [],\r\n lexical: new w((t || 0) - o, 0, 'block', !1),\r\n localVars: n.localVars,\r\n context: n.localVars && new O(null, null, !1),\r\n indented: t || 0\r\n }\r\n return n.globalVars && 'object' == typeof n.globalVars && (e.globalVars = n.globalVars), e\r\n },\r\n token: function (t, e) {\r\n if (\r\n (t.sol() &&\r\n (e.lexical.hasOwnProperty('align') || (e.lexical.align = !1),\r\n (e.indented = t.indentation()),\r\n b(t, e)),\r\n e.tokenize != v && t.eatSpace())\r\n )\r\n return null\r\n var n = e.tokenize(t, e)\r\n return 'comment' == i\r\n ? n\r\n : ((e.lastType = 'operator' != i || ('++' != r && '--' != r) ? i : 'incdec'),\r\n (function (t, e, n, i, r) {\r\n var o = t.cc\r\n for (\r\n k.state = t,\r\n k.stream = r,\r\n k.marked = null,\r\n k.cc = o,\r\n k.style = e,\r\n t.lexical.hasOwnProperty('align') || (t.lexical.align = !0);\r\n ;\r\n\r\n ) {\r\n var s = o.length ? o.pop() : l ? V : R\r\n if (s(n, i)) {\r\n for (; o.length && o[o.length - 1].lex; ) o.pop()()\r\n return k.marked ? k.marked : 'variable' == n && C(t, i) ? 'variable-2' : e\r\n }\r\n }\r\n })(e, n, i, r, t))\r\n },\r\n indent: function (e, i) {\r\n if (e.tokenize == v) return t.Pass\r\n if (e.tokenize != g) return 0\r\n var r,\r\n a = i && i.charAt(0),\r\n l = e.lexical\r\n if (!/^\\s*else\\b/.test(i))\r\n for (var c = e.cc.length - 1; c >= 0; --c) {\r\n var u = e.cc[c]\r\n if (u == F) l = l.prev\r\n else if (u != St) break\r\n }\r\n for (\r\n ;\r\n ('stat' == l.type || 'form' == l.type) &&\r\n ('}' == a || ((r = e.cc[e.cc.length - 1]) && (r == U || r == q) && !/^[,\\.=+\\-*:?[\\(]/.test(i)));\r\n\r\n )\r\n l = l.prev\r\n s && ')' == l.type && 'stat' == l.prev.type && (l = l.prev)\r\n var h = l.type,\r\n f = a == h\r\n return 'vardef' == h\r\n ? l.indented + ('operator' == e.lastType || ',' == e.lastType ? l.info.length + 1 : 0)\r\n : 'form' == h && '{' == a\r\n ? l.indented\r\n : 'form' == h\r\n ? l.indented + o\r\n : 'stat' == h\r\n ? l.indented +\r\n ((function (t, e) {\r\n return (\r\n 'operator' == t.lastType || ',' == t.lastType || d.test(e.charAt(0)) || /[,.]/.test(e.charAt(0))\r\n )\r\n })(e, i)\r\n ? s || o\r\n : 0)\r\n : 'switch' != l.info || f || 0 == n.doubleIndentSwitch\r\n ? l.align\r\n ? l.column + (f ? 0 : 1)\r\n : l.indented + (f ? 0 : o)\r\n : l.indented + (/^(?:case|default)\\b/.test(i) ? o : 2 * o)\r\n },\r\n electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\r\n blockCommentStart: l ? null : '/*',\r\n blockCommentEnd: l ? null : '*/',\r\n blockCommentContinue: l ? null : ' * ',\r\n lineComment: l ? null : '//',\r\n fold: 'brace',\r\n closeBrackets: '()[]{}\\'\\'\"\"``',\r\n helperType: l ? 'json' : 'javascript',\r\n jsonldMode: a,\r\n jsonMode: l,\r\n expressionAllowed: Kt,\r\n skipExpression: function (t) {\r\n var e = t.cc[t.cc.length - 1]\r\n ;(e != V && e != H) || t.cc.pop()\r\n }\r\n }\r\n )\r\n }),\r\n t.registerHelper('wordChars', 'javascript', /[\\w$]/),\r\n t.defineMIME('text/javascript', 'javascript'),\r\n t.defineMIME('text/ecmascript', 'javascript'),\r\n t.defineMIME('application/javascript', 'javascript'),\r\n t.defineMIME('application/x-javascript', 'javascript'),\r\n t.defineMIME('application/ecmascript', 'javascript'),\r\n t.defineMIME('application/json', { name: 'javascript', json: !0 }),\r\n t.defineMIME('application/x-json', { name: 'javascript', json: !0 }),\r\n t.defineMIME('application/ld+json', { name: 'javascript', jsonld: !0 }),\r\n t.defineMIME('text/typescript', { name: 'javascript', typescript: !0 }),\r\n t.defineMIME('application/typescript', { name: 'javascript', typescript: !0 })\r\n })(n(6))\r\n },\r\n function (t, e, n) {\r\n !(function (t) {\r\n t.extendMode('css', {\r\n commentStart: '/*',\r\n commentEnd: '*/',\r\n newlineAfterToken: function (t, e) {\r\n return /^[;{}]$/.test(e)\r\n }\r\n }),\r\n t.extendMode('javascript', {\r\n commentStart: '/*',\r\n commentEnd: '*/',\r\n newlineAfterToken: function (t, e, n, i) {\r\n return this.jsonMode\r\n ? /^[\\[,{]$/.test(e) || /^}/.test(n)\r\n : (';' != e || !i.lexical || ')' != i.lexical.type) && /^[;{}]$/.test(e) && !/^;/.test(n)\r\n }\r\n })\r\n 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)$/\r\n t.extendMode('xml', {\r\n commentStart: '\\x3c!--',\r\n commentEnd: '--\\x3e',\r\n newlineAfterToken: function (t, n, i, r) {\r\n var o = !1\r\n return (\r\n 'html' == this.configuration && (o = !!r.context && e.test(r.context.tagName)),\r\n !o && (('tag' == t && />$/.test(n) && r.context) || /^ -1 &&\r\n a > -1 &&\r\n a > s &&\r\n (t = t.substr(0, s) + t.substring(s + o.commentStart.length, a) + t.substr(a + o.commentEnd.length)),\r\n r.replaceRange(t, n, i)\r\n }\r\n })\r\n }),\r\n t.defineExtension('autoIndentRange', function (t, e) {\r\n var n = this\r\n this.operation(function () {\r\n for (var i = t.line; i <= e.line; i++) n.indentLine(i, 'smart')\r\n })\r\n }),\r\n t.defineExtension('autoFormatRange', function (e, n) {\r\n var i = this,\r\n r = i.getMode(),\r\n o = i.getRange(e, n).split('\\n'),\r\n s = t.copyState(r, i.getTokenAt(e).state),\r\n a = i.getOption('tabSize'),\r\n l = '',\r\n c = 0,\r\n u = 0 === e.ch\r\n function h () {\r\n ;(l += '\\n'), (u = !0), ++c\r\n }\r\n for (var d = 0; d < o.length; ++d) {\r\n for (var f = new t.StringStream(o[d], a); !f.eol(); ) {\r\n var p = t.innerMode(r, s),\r\n g = r.token(f, s),\r\n v = f.current()\r\n ;(f.start = f.pos),\r\n (u && !/\\S/.test(v)) || ((l += v), (u = !1)),\r\n !u &&\r\n p.mode.newlineAfterToken &&\r\n p.mode.newlineAfterToken(g, v, f.string.slice(f.pos) || o[d + 1] || '', p.state) &&\r\n h()\r\n }\r\n !f.pos && r.blankLine && r.blankLine(s), !u && d < o.length - 1 && h()\r\n }\r\n i.operation(function () {\r\n i.replaceRange(l, e, n)\r\n for (var t = e.line + 1, r = e.line + c; t <= r; ++t) i.indentLine(t, 'smart')\r\n i.setSelection(e, i.getCursor(!1))\r\n })\r\n })\r\n })(n(6))\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(1),\r\n o = n(0),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n t.exports = s.default.View.extend({\r\n template: (0, r.template)(\r\n '\\n
editor\" id=\"<%= pfx %><%= codeName %>\">\\n \\t
title\"><%= label %>
\\n \\t
code\">
\\n
'\r\n ),\r\n initialize: function (t) {\r\n ;(this.config = t.config || {}), (this.pfx = this.config.stylePrefix)\r\n },\r\n render: function () {\r\n var t = this.model.toJSON()\r\n return (\r\n (t.pfx = this.pfx),\r\n this.$el.html(this.template(t)),\r\n this.$el.attr('class', this.pfx + 'editor-c'),\r\n this.$el.find('#' + this.pfx + 'code').append(this.model.get('input')),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = function () {\r\n var t,\r\n e,\r\n i = {},\r\n r = n(154),\r\n o = n(62),\r\n s = n(156),\r\n a = (n(64), n(159))\r\n return {\r\n name: 'Panels',\r\n init: function (n) {\r\n for (var o in ((i = n || {}), r)) o in i || (i[o] = r[o])\r\n var l = i.pStylePrefix\r\n return (\r\n l && (i.stylePrefix = l + i.stylePrefix),\r\n (t = new s(i.defaults)),\r\n (e = new a({ collection: t, config: i })),\r\n this\r\n )\r\n },\r\n getPanels: function () {\r\n return t\r\n },\r\n getPanelsEl: function () {\r\n return e.el\r\n },\r\n addPanel: function (e) {\r\n return t.add(e)\r\n },\r\n removePanel: function (e) {\r\n return t.remove(e)\r\n },\r\n getPanel: function (e) {\r\n var n = t.where({ id: e })\r\n return n.length ? n[0] : null\r\n },\r\n addButton: function (t, e) {\r\n var n = this.getPanel(t)\r\n return n ? n.get('buttons').add(e) : null\r\n },\r\n removeButton: function (t, e) {\r\n var n = this.getPanel(t)\r\n return n && n.get('buttons').remove(e)\r\n },\r\n getButton: function (t, e) {\r\n var n = this.getPanel(t)\r\n if (n) {\r\n var i = n.get('buttons').where({ id: e })\r\n return i.length ? i[0] : null\r\n }\r\n return null\r\n },\r\n render: function () {\r\n return e.render().el\r\n },\r\n active: function () {\r\n this.getPanels().each(function (t) {\r\n t.get('buttons').each(function (t) {\r\n t.get('active') && t.trigger('updateActive')\r\n })\r\n })\r\n },\r\n disableButtons: function () {\r\n this.getPanels().each(function (t) {\r\n t.get('buttons').each(function (t) {\r\n t.get('disable') && t.trigger('change:disable')\r\n })\r\n })\r\n },\r\n Panel: o\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = 'sw-visibility',\r\n r = 'export-template',\r\n o = 'open-layers',\r\n s = 'open-blocks',\r\n a = 'fullscreen',\r\n l = 'preview'\r\n t.exports = {\r\n stylePrefix: 'pn-',\r\n defaults: [\r\n { id: 'commands', buttons: [{}] },\r\n {\r\n id: 'options',\r\n buttons: [\r\n {\r\n active: !0,\r\n id: i,\r\n className: 'fa fa-square-o',\r\n command: i,\r\n context: i,\r\n attributes: { title: 'View components' }\r\n },\r\n { id: l, className: 'fa fa-eye', command: l, context: l, attributes: { title: 'Preview' } },\r\n { id: a, className: 'fa fa-arrows-alt', command: a, context: a, attributes: { title: 'Fullscreen' } },\r\n { id: r, className: 'fa fa-code', command: r, attributes: { title: 'View code' } }\r\n ]\r\n },\r\n {\r\n id: 'views',\r\n buttons: [\r\n {\r\n id: 'open-sm',\r\n className: 'fa fa-paint-brush',\r\n command: 'open-sm',\r\n active: !0,\r\n attributes: { title: 'Open Style Manager' }\r\n },\r\n { id: 'open-tm', className: 'fa fa-cog', command: 'open-tm', attributes: { title: 'Settings' } },\r\n { id: o, className: 'fa fa-bars', command: o, attributes: { title: 'Open Layer Manager' } },\r\n { id: s, className: 'fa fa-th-large', command: s, attributes: { title: 'Open Blocks' } }\r\n ]\r\n }\r\n ],\r\n em: null,\r\n delayBtnsShow: 300\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0)\r\n t.exports = i.Model.extend({\r\n defaults: {\r\n id: '',\r\n label: '',\r\n className: '',\r\n command: '',\r\n context: '',\r\n buttons: [],\r\n attributes: {},\r\n options: {},\r\n active: !1,\r\n dragDrop: !1,\r\n togglable: !0,\r\n runDefaultCommand: !0,\r\n stopDefaultCommand: !1,\r\n disable: !1\r\n },\r\n initialize: function (t) {\r\n if (this.get('buttons').length) {\r\n var e = n(63)\r\n this.set('buttons', new e(this.get('buttons')))\r\n }\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0),\r\n r = n(62)\r\n t.exports = i.Collection.extend({ model: r })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n ;(function (e) {\r\n var i = n(0),\r\n r = n(158)\r\n t.exports = i.View.extend({\r\n initialize: function (t) {\r\n ;(this.opt = t || {}),\r\n (this.config = this.opt.config || {}),\r\n (this.pfx = this.config.stylePrefix || ''),\r\n (this.parentM = this.opt.parentM || null),\r\n this.listenTo(this.collection, 'add', this.addTo),\r\n this.listenTo(this.collection, 'reset remove', this.render),\r\n (this.className = this.pfx + 'buttons')\r\n },\r\n addTo: function (t) {\r\n this.addToCollection(t)\r\n },\r\n addToCollection: function (t, e) {\r\n var n = e || null,\r\n i = new r({ model: t, config: this.config, parentM: this.parentM }).render().el\r\n return n ? n.appendChild(i) : this.$el.append(i), i\r\n },\r\n render: function () {\r\n var t = document.createDocumentFragment()\r\n return (\r\n this.$el.empty(),\r\n this.collection.each(function (e) {\r\n this.addToCollection(e, t)\r\n }, this),\r\n this.$el.append(t),\r\n this.$el.attr('class', e.result(this, 'className')),\r\n this\r\n )\r\n }\r\n })\r\n }.call(this, n(1)))\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n o = n(0),\r\n s = (i = o) && i.__esModule ? i : { default: i },\r\n a = n(1)\r\n s.default.$\r\n t.exports = s.default.View.extend({\r\n tagName: 'span',\r\n events: { click: 'clicked' },\r\n initialize: function (t) {\r\n var e = this.model.get('className')\r\n ;(this.config = t.config || {}), (this.em = this.config.em || {})\r\n var n = this.config.stylePrefix || '',\r\n i = this.config.pStylePrefix || ''\r\n ;(this.pfx = n),\r\n (this.ppfx = this.config.pStylePrefix || ''),\r\n (this.id = n + this.model.get('id')),\r\n (this.activeCls = n + 'active ' + i + 'four-color'),\r\n (this.disableCls = i + 'disabled'),\r\n (this.btnsVisCls = n + 'visible'),\r\n (this.className = n + 'btn' + (e ? ' ' + e : '')),\r\n this.listenTo(this.model, 'change', this.render),\r\n this.listenTo(this.model, 'change:active updateActive', this.updateActive),\r\n this.listenTo(this.model, 'checkActive', this.checkActive),\r\n this.listenTo(this.model, 'change:bntsVis', this.updateBtnsVis),\r\n this.listenTo(this.model, 'change:attributes', this.updateAttributes),\r\n this.listenTo(this.model, 'change:className', this.updateClassName),\r\n this.listenTo(this.model, 'change:disable', this.updateDisable),\r\n this.em && this.em.get && (this.commands = this.em.get('Commands'))\r\n },\r\n updateClassName: function () {\r\n var t = this.model,\r\n e = this.pfx,\r\n n = t.get('className'),\r\n i = t.get('attributes').class,\r\n r = (i || '') + ' ' + e + 'btn ' + (n || '')\r\n this.$el.attr('class', r.trim())\r\n },\r\n updateAttributes: function () {\r\n this.$el.attr(this.model.get('attributes')), this.updateClassName()\r\n },\r\n updateBtnsVis: function () {\r\n this.$buttons &&\r\n (this.model.get('bntsVis')\r\n ? this.$buttons.addClass(this.btnsVisCls)\r\n : this.$buttons.removeClass(this.btnsVisCls))\r\n },\r\n updateActive: function () {\r\n var t = this.model,\r\n e = this.commands,\r\n n = this.em,\r\n i = t.get('context'),\r\n o = t.get('options'),\r\n s = {},\r\n l = (n && n.get && n.get('Editor'), t.get('command')),\r\n c = (0, a.isFunction)(l)\r\n e && (0, a.isString)(l)\r\n ? (s = e.get(l) || {})\r\n : c\r\n ? (s = e.create({ run: l }))\r\n : null !== l && (0, a.isObject)(l) && (s = e.create(l)),\r\n t.get('active')\r\n ? (t.collection.deactivateAll(i),\r\n t.set('active', !0, { silent: !0 }).trigger('checkActive'),\r\n e.runCommand(s, r({}, o, { sender: t })),\r\n c && t.set('active', !1))\r\n : (this.$el.removeClass(this.activeCls),\r\n t.collection.deactivateAll(i),\r\n e.stopCommand(s, r({}, o, { sender: t })))\r\n },\r\n updateDisable: function () {\r\n var t = this.disableCls,\r\n e = this.model.get('disable')\r\n this.$el[e ? 'addClass' : 'removeClass'](t)\r\n },\r\n checkActive: function () {\r\n var t = this.model,\r\n e = this.$el,\r\n n = this.activeCls\r\n t.get('active') ? e.addClass(n) : e.removeClass(n)\r\n },\r\n clicked: function (t) {\r\n this.model.get('bntsVis') || this.model.get('disable') || this.toogleActive()\r\n },\r\n toogleActive: function () {\r\n var t = this.model,\r\n e = t.attributes,\r\n n = e.active,\r\n i = e.togglable\r\n if (!n || i) {\r\n t.set('active', !n)\r\n this.em.get('Commands').get('select-comp')\r\n n\r\n ? t.get('runDefaultCommand') && this.em.runDefault()\r\n : t.get('stopDefaultCommand') && this.em.stopDefault()\r\n }\r\n },\r\n render: function () {\r\n var t = this.model.get('label'),\r\n e = this.$el\r\n return e.empty(), this.updateAttributes(), t && e.append(t), this.checkActive(), this.updateDisable(), this\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0),\r\n r = n(64)\r\n t.exports = i.View.extend({\r\n initialize: function (t) {\r\n ;(this.opt = t || {}), (this.config = this.opt.config || {}), (this.pfx = this.config.stylePrefix || '')\r\n var e = this.collection\r\n this.listenTo(e, 'add', this.addTo),\r\n this.listenTo(e, 'reset', this.render),\r\n this.listenTo(e, 'remove', this.onRemove),\r\n (this.className = this.pfx + 'panels')\r\n },\r\n onRemove: function (t) {\r\n var e = t.view\r\n e && e.remove()\r\n },\r\n addTo: function (t) {\r\n this.addToCollection(t)\r\n },\r\n addToCollection: function (t, e) {\r\n var n = e || null,\r\n i = this.config,\r\n o = t.get('el'),\r\n s = new r({ el: o, model: t, config: i }),\r\n a = s.render().el,\r\n l = t.get('appendTo')\r\n if (o);\r\n else if (l) {\r\n document.querySelector(l).appendChild(a)\r\n } else n ? n.appendChild(a) : this.$el.append(a)\r\n return s.initResize(), a\r\n },\r\n render: function () {\r\n var t = this,\r\n e = this.$el,\r\n n = document.createDocumentFragment()\r\n return (\r\n e.empty(),\r\n this.collection.each(function (e) {\r\n return t.addToCollection(e, n)\r\n }),\r\n e.append(n),\r\n e.attr('class', this.className),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(161),\r\n o = (i = r) && i.__esModule ? i : { default: i },\r\n s = n(2)\r\n t.exports = function () {\r\n var t = {},\r\n e = n(162),\r\n i = void 0,\r\n r = void 0,\r\n a = void 0,\r\n l = function () {\r\n var t = i.style\r\n ;(t.top = '-1000px'), (t.left = '-1000px'), (t.display = 'none')\r\n }\r\n return {\r\n customRte: null,\r\n name: 'RichTextEditor',\r\n init: function () {\r\n var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n for (var r in ((t = n), e)) r in t || (t[r] = e[r])\r\n var o = t.pStylePrefix\r\n return (\r\n o && (t.stylePrefix = o + t.stylePrefix),\r\n (this.pfx = t.stylePrefix),\r\n t.actions || [],\r\n ((i = document.createElement('div')).className = o + 'rte-toolbar ' + o + 'one-bg'),\r\n (a = this.initRte(document.createElement('div'))),\r\n (0, s.on)(i, 'mousedown', function (t) {\r\n return t.stopPropagation()\r\n }),\r\n this\r\n )\r\n },\r\n postRender: function (t) {\r\n var e = t.model.get('Canvas')\r\n ;(i.style.pointerEvents = 'all'), l(), e.getToolsEl().appendChild(i)\r\n },\r\n initRte: function (e) {\r\n var n = this.pfx,\r\n r = i,\r\n s = this.actionbar,\r\n l = this.actions || t.actions,\r\n c = { actionbar: n + 'actionbar', button: n + 'action', active: n + 'active' },\r\n u = new o.default({ el: e, classes: c, actions: l, actionbar: s, actionbarContainer: r })\r\n return (\r\n a && a.setEl(e), u.actionbar && (this.actionbar = u.actionbar), u.actions && (this.actions = u.actions), u\r\n )\r\n },\r\n add: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n ;(e.name = t), a.addAction(e, { sync: 1 })\r\n },\r\n get: function (t) {\r\n var e = void 0\r\n return (\r\n a.getActions().forEach(function (n) {\r\n n.name == t && (e = n)\r\n }),\r\n e\r\n )\r\n },\r\n getAll: function () {\r\n return a.getActions()\r\n },\r\n remove: function (t) {\r\n var e = this.getAll(),\r\n n = this.get(t)\r\n if (n) {\r\n var i = n.btn,\r\n r = e.indexOf(n)\r\n i.parentNode.removeChild(i), e.splice(r, 1)\r\n }\r\n return n\r\n },\r\n getToolbarEl: function () {\r\n return i\r\n },\r\n udpatePosition: function () {\r\n var e = t.em.get('Canvas').getTargetToElementDim(i, r, { event: 'rteToolbarPosUpdate' })\r\n if (e) {\r\n t.adjustToolbar && e.top <= e.canvasTop && (e.top = e.elementTop + e.elementHeight)\r\n var n = i.style\r\n ;(n.top = e.top + 'px'), (n.left = e.left + 'px')\r\n }\r\n },\r\n enable: function (e, n) {\r\n r = e.el\r\n var o = t.em,\r\n s = e.getChildrenContainer(),\r\n a = this.customRte\r\n if (((i.style.display = ''), (n = a ? a.enable(s, n) : this.initRte(s).enable()), o)) {\r\n setTimeout(this.udpatePosition.bind(this), 0)\r\n var l = 'change:canvasOffset canvasScroll'\r\n o.off(l, this.udpatePosition, this), o.on(l, this.udpatePosition, this), o.trigger('rte:enable', e, n)\r\n }\r\n return n\r\n },\r\n disable: function (e, n) {\r\n var i = t.em,\r\n r = this.customRte,\r\n o = e.getChildrenContainer()\r\n r ? r.disable(o, n) : n && n.disable(), l(), i && i.trigger('rte:disable', e, n)\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n Object.defineProperty(e, '__esModule', { value: !0 })\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = (function () {\r\n function t (t, e) {\r\n for (var n = 0; n < e.length; n++) {\r\n var i = e[n]\r\n ;(i.enumerable = i.enumerable || !1),\r\n (i.configurable = !0),\r\n 'value' in i && (i.writable = !0),\r\n Object.defineProperty(t, i.key, i)\r\n }\r\n }\r\n return function (e, n, i) {\r\n return n && t(e.prototype, n), i && t(e, i), e\r\n }\r\n })(),\r\n o = n(2)\r\n var s = '_rte',\r\n a = {\r\n bold: {\r\n name: 'bold',\r\n icon: 'B',\r\n attributes: { title: 'Bold' },\r\n result: function (t) {\r\n return t.exec('bold')\r\n }\r\n },\r\n italic: {\r\n name: 'italic',\r\n icon: 'I',\r\n attributes: { title: 'Italic' },\r\n result: function (t) {\r\n return t.exec('italic')\r\n }\r\n },\r\n underline: {\r\n name: 'underline',\r\n icon: 'U',\r\n attributes: { title: 'Underline' },\r\n result: function (t) {\r\n return t.exec('underline')\r\n }\r\n },\r\n strikethrough: {\r\n name: 'strikethrough',\r\n icon: 'S',\r\n attributes: { title: 'Strike-through' },\r\n result: function (t) {\r\n return t.exec('strikeThrough')\r\n }\r\n },\r\n link: {\r\n icon: '⫘',\r\n name: 'link',\r\n attributes: { style: 'font-size:1.4rem;padding:0 4px 2px;', title: 'Link' },\r\n result: function (t) {\r\n var e = t.selection().anchorNode,\r\n n = e && e.nextSibling\r\n n && 'A' == n.nodeName\r\n ? t.exec('unlink')\r\n : t.insertHTML('' + t.selection() + '')\r\n }\r\n }\r\n },\r\n l = (function () {\r\n function t () {\r\n var e = this,\r\n n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n !(function (t, e) {\r\n if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')\r\n })(this, t)\r\n var r = n.el\r\n if (r[s]) return r[s]\r\n ;(r[s] = this), this.setEl(r), (this.updateActiveActions = this.updateActiveActions.bind(this))\r\n var o = n.actions || []\r\n o.forEach(function (t, e) {\r\n 'string' == typeof t ? (t = a[t]) : a[t.name] && (t = i({}, a[t.name], t)), (o[e] = t)\r\n })\r\n var l = o.length\r\n ? o\r\n : Object.keys(a).map(function (t) {\r\n return a[t]\r\n })\r\n n.classes = i({ actionbar: 'actionbar', button: 'action', active: 'active' }, n.classes)\r\n var c = n.classes,\r\n u = n.actionbar\r\n if (((this.actionbar = u), (this.settings = n), (this.classes = c), (this.actions = l), !u)) {\r\n var h = n.actionbarContainer\r\n ;((u = document.createElement('div')).className = c.actionbar),\r\n h.appendChild(u),\r\n (this.actionbar = u),\r\n l.forEach(function (t) {\r\n return e.addAction(t)\r\n })\r\n }\r\n return n.styleWithCSS && this.exec('styleWithCSS'), this.syncActions(), this\r\n }\r\n return (\r\n r(t, [\r\n {\r\n key: 'setEl',\r\n value: function (t) {\r\n ;(this.el = t), (this.doc = t.ownerDocument)\r\n }\r\n },\r\n {\r\n key: 'updateActiveActions',\r\n value: function () {\r\n var t = this\r\n this.getActions().forEach(function (e) {\r\n var n = e.btn,\r\n i = e.update,\r\n r = t.classes.active,\r\n o = e.name,\r\n s = t.doc\r\n ;(n.className = n.className.replace(r, '').trim()),\r\n s.queryCommandSupported(o) && s.queryCommandState(o) && (n.className += ' ' + r),\r\n i && i(t, e)\r\n })\r\n }\r\n },\r\n {\r\n key: 'enable',\r\n value: function () {\r\n return this.enabled\r\n ? this\r\n : ((this.actionbarEl().style.display = ''),\r\n (this.el.contentEditable = !0),\r\n (0, o.on)(this.el, 'mouseup keyup', this.updateActiveActions),\r\n this.syncActions(),\r\n this.updateActiveActions(),\r\n this.el.focus(),\r\n (this.enabled = 1),\r\n this)\r\n }\r\n },\r\n {\r\n key: 'disable',\r\n value: function () {\r\n return (\r\n (this.actionbarEl().style.display = 'none'),\r\n (this.el.contentEditable = !1),\r\n (0, o.off)(this.el, 'mouseup keyup', this.updateActiveActions),\r\n (this.enabled = 0),\r\n this\r\n )\r\n }\r\n },\r\n {\r\n key: 'syncActions',\r\n value: function () {\r\n var t = this\r\n this.getActions().forEach(function (e) {\r\n var n = e.event || 'click'\r\n e.btn['on' + n] = function (n) {\r\n e.result(t, e), t.updateActiveActions()\r\n }\r\n })\r\n }\r\n },\r\n {\r\n key: 'addAction',\r\n value: function (t) {\r\n var e = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}).sync,\r\n n = document.createElement('span'),\r\n i = t.icon,\r\n r = t.attributes || {}\r\n for (var o in ((n.className = this.classes.button), (t.btn = n), r)) n.setAttribute(o, r[o])\r\n 'string' == typeof i ? (n.innerHTML = i) : n.appendChild(i),\r\n this.actionbarEl().appendChild(n),\r\n e && (this.actions.push(t), this.syncActions())\r\n }\r\n },\r\n {\r\n key: 'getActions',\r\n value: function () {\r\n return this.actions\r\n }\r\n },\r\n {\r\n key: 'selection',\r\n value: function () {\r\n return this.doc.getSelection()\r\n }\r\n },\r\n {\r\n key: 'exec',\r\n value: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null\r\n this.doc.execCommand(t, !1, e)\r\n }\r\n },\r\n {\r\n key: 'actionbarEl',\r\n value: function () {\r\n return this.actionbar\r\n }\r\n },\r\n {\r\n key: 'insertHTML',\r\n value: function (t) {\r\n var e = this.doc,\r\n n = e.getSelection()\r\n if (n && n.rangeCount) {\r\n var i = e.createElement('div'),\r\n r = n.getRangeAt(0)\r\n r.deleteContents(),\r\n (i.innerHTML = t),\r\n Array.prototype.slice.call(i.childNodes).forEach(function (t) {\r\n r.insertNode(t), t\r\n }),\r\n n.removeAllRanges(),\r\n n.addRange(r),\r\n this.el.focus()\r\n }\r\n }\r\n }\r\n ]),\r\n t\r\n )\r\n })()\r\n e.default = l\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n stylePrefix: 'rte-',\r\n adjustToolbar: 1,\r\n actions: ['bold', 'italic', 'underline', 'strikethrough', 'link']\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = function () {\r\n var t = {},\r\n e = n(164),\r\n i = n(165),\r\n r = n(168),\r\n o = n(67),\r\n s = void 0,\r\n a = void 0,\r\n l = void 0\r\n return {\r\n name: 'AssetManager',\r\n storageKey: 'assets',\r\n getConfig: function () {\r\n return t\r\n },\r\n init: function (n) {\r\n var c = this\r\n for (var u in ((t = n || {}), e)) u in t || (t[u] = e[u])\r\n var h = t.pStylePrefix,\r\n d = t.em\r\n h && (t.stylePrefix = h + t.stylePrefix), (s = new i([]))\r\n var f = { collection: new i([]), globalCollection: s, config: t }\r\n return (\r\n (l = new o(f)),\r\n (f.fu = l),\r\n (a = new r(f)),\r\n s.listenTo(s, 'add', function (t) {\r\n c.getAllVisible().add(t), d && d.trigger('asset:add', t)\r\n }),\r\n s.listenTo(s, 'remove', function (t) {\r\n c.getAllVisible().remove(t), d && d.trigger('asset:remove', t)\r\n }),\r\n this\r\n )\r\n },\r\n add: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n return void 0 === e.at && (e.at = 0), s.add(t, e)\r\n },\r\n get: function (t) {\r\n return s.where({ src: t })[0]\r\n },\r\n getAll: function () {\r\n return s\r\n },\r\n getAllVisible: function () {\r\n return a.collection\r\n },\r\n remove: function (t) {\r\n var e = this.get(t)\r\n return this.getAll().remove(e), this\r\n },\r\n store: function (e) {\r\n var n = {},\r\n i = JSON.stringify(this.getAll().toJSON())\r\n return (n[this.storageKey] = i), !e && t.stm && t.stm.store(n), n\r\n },\r\n load: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = this.storageKey,\r\n n = t[e] || []\r\n if ('string' == typeof n)\r\n try {\r\n n = JSON.parse(t[e])\r\n } catch (t) {}\r\n return n && n.length && this.getAll().reset(n), n\r\n },\r\n getContainer: function () {\r\n return a.el\r\n },\r\n getAssetsEl: function () {\r\n return a.el.querySelector('[data-el=assets]')\r\n },\r\n render: function (t) {\r\n var e = t || this.getAll().models\r\n return a.rendered || a.render(), a.collection.reset(e), this.getContainer()\r\n },\r\n addType: function (t, e) {\r\n this.getAll().addType(t, e)\r\n },\r\n getType: function (t) {\r\n return this.getAll().getType(t)\r\n },\r\n getTypes: function () {\r\n return this.getAll().getTypes()\r\n },\r\n AssetsView: function () {\r\n return a\r\n },\r\n FileUploader: function () {\r\n return l\r\n },\r\n onLoad: function () {\r\n this.getAll().reset(t.assets)\r\n },\r\n postRender: function (e) {\r\n t.dropzone && l.initDropzone(e)\r\n },\r\n setTarget: function (t) {\r\n a.collection.target = t\r\n },\r\n onSelect: function (t) {\r\n a.collection.onSelect = t\r\n },\r\n onClick: function (e) {\r\n t.onClick = e\r\n },\r\n onDblClick: function (e) {\r\n t.onDblClick = e\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n assets: [],\r\n noAssets: '',\r\n stylePrefix: 'am-',\r\n upload: 0,\r\n uploadName: 'files',\r\n headers: {},\r\n params: {},\r\n credentials: 'include',\r\n multiUpload: !0,\r\n autoAdd: 1,\r\n uploadText: 'Drop files here or click to upload',\r\n addBtnText: 'Add image',\r\n uploadFile: '',\r\n handleAdd: '',\r\n dropzone: 0,\r\n openAssetsOnDrop: 1,\r\n dropzoneContent: '',\r\n modalTitle: 'Select Image',\r\n inputPlaceholder: 'http://path/to/the/image.jpg'\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(50),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n t.exports = n(0)\r\n .Collection.extend(o.default)\r\n .extend({\r\n types: [\r\n {\r\n id: 'image',\r\n model: n(166),\r\n view: n(65),\r\n isType: function (t) {\r\n return 'string' == typeof t ? { type: 'image', src: t } : t\r\n }\r\n }\r\n ]\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(167)\r\n t.exports = r.extend({\r\n defaults: i({}, r.prototype.defaults, { type: 'image', unitDim: 'px', height: 0, width: 0 })\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(0).Model.extend({\r\n idAttribute: 'src',\r\n defaults: { type: '', src: '' },\r\n getFilename: function () {\r\n return this.get('src')\r\n .split('/')\r\n .pop()\r\n },\r\n getExtension: function () {\r\n return this.getFilename()\r\n .split('.')\r\n .pop()\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n n(66), n(65), n(67)\r\n t.exports = o.default.View.extend({\r\n events: { submit: 'handleSubmit' },\r\n template: function (t) {\r\n var e = t.pfx,\r\n n = t.ppfx\r\n return (\r\n '\\n
\\n
\\n \\n
\\n \\n \\n
\\n '\r\n )\r\n },\r\n initialize: function (t) {\r\n ;(this.options = t),\r\n (this.config = t.config),\r\n (this.pfx = this.config.stylePrefix || ''),\r\n (this.ppfx = this.config.pStylePrefix || '')\r\n var e = this.collection\r\n this.listenTo(e, 'reset', this.renderAssets),\r\n this.listenTo(e, 'add', this.addToAsset),\r\n this.listenTo(e, 'remove', this.removedAsset),\r\n this.listenTo(e, 'deselectAll', this.deselectAll)\r\n },\r\n handleSubmit: function (t) {\r\n t.preventDefault()\r\n var e = this.getAddInput(),\r\n n = e.value.trim(),\r\n i = this.config.handleAdd\r\n n &&\r\n ((e.value = ''),\r\n (this.getAssetsEl().scrollTop = 0),\r\n i ? i.bind(this)(n) : this.options.globalCollection.add(n, { at: 0 }))\r\n },\r\n getAssetsEl: function () {\r\n return this.el.querySelector('.' + this.pfx + 'assets')\r\n },\r\n getAddInput: function () {\r\n return (\r\n (this.inputUrl && this.inputUrl.value) ||\r\n (this.inputUrl = this.el.querySelector('.' + this.pfx + 'add-asset input')),\r\n this.inputUrl\r\n )\r\n },\r\n removedAsset: function (t) {\r\n this.collection.length || this.toggleNoAssets()\r\n },\r\n addToAsset: function (t) {\r\n 1 == this.collection.length && this.toggleNoAssets(1), this.addAsset(t)\r\n },\r\n addAsset: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null,\r\n n = this.collection,\r\n i = this.config,\r\n r = new t.typeView({ model: t, collection: n, config: i }).render().el\r\n if (e) e.appendChild(r)\r\n else {\r\n var o = this.getAssetsEl()\r\n o && o.insertBefore(r, o.firstChild)\r\n }\r\n return r\r\n },\r\n toggleNoAssets: function (t) {\r\n var e = this.$el.find('.' + this.pfx + 'assets')\r\n if (t) e.empty()\r\n else {\r\n var n = this.config.noAssets\r\n n && e.append(n)\r\n }\r\n },\r\n deselectAll: function () {\r\n var t = this.pfx\r\n this.$el.find('.' + t + 'highlight').removeClass(t + 'highlight')\r\n },\r\n renderAssets: function () {\r\n var t = this,\r\n e = document.createDocumentFragment(),\r\n n = this.$el.find('.' + this.pfx + 'assets')\r\n n.empty(),\r\n this.toggleNoAssets(this.collection.length),\r\n this.collection.each(function (n) {\r\n return t.addAsset(n, e)\r\n }),\r\n n.append(e)\r\n },\r\n render: function () {\r\n var t = this.options.fu.render().el\r\n return (\r\n this.$el.empty(),\r\n this.$el.append(t).append(this.template(this)),\r\n (this.el.className = this.ppfx + 'asset-manager'),\r\n this.renderAssets(),\r\n (this.rendered = 1),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(1)\r\n t.exports = function () {\r\n var t,\r\n e,\r\n o = void 0,\r\n s = {},\r\n a = n(170),\r\n l = n(68),\r\n c = n(171),\r\n u = n(172),\r\n h = n(10),\r\n d = n(9)\r\n return {\r\n Selectors: h,\r\n name: 'CssComposer',\r\n storageKey: function () {\r\n var t = [],\r\n e = (s.stm && s.stm.getConfig()) || {}\r\n return e.storeCss && t.push('css'), e.storeStyles && t.push('styles'), t\r\n },\r\n init: function (n) {\r\n for (var i in ((s = n || {}), a)) i in s || (s[i] = a[i])\r\n var r = s.pStylePrefix\r\n r && (s.stylePrefix = r + s.stylePrefix)\r\n var l = (s.em && s.em.config.style) || ''\r\n return (\r\n (s.rules = l || s.rules), (o = s.em), (t = new c([], s)), (e = new u({ collection: t, config: s })), this\r\n )\r\n },\r\n onLoad: function () {\r\n t.add(s.rules)\r\n },\r\n postLoad: function (t) {\r\n var e = this,\r\n n = 'add remove',\r\n i = this.getAll(),\r\n r = t.get('UndoManager')\r\n r && r.add(i),\r\n t.stopListening(i, n, this.handleChange),\r\n t.listenTo(i, n, this.handleChange),\r\n i.each(function (t) {\r\n return e.handleChange(t, { avoidStore: 1 })\r\n })\r\n },\r\n handleChange: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = 'change:style',\r\n i = o.get('UndoManager')\r\n i && i.add(t)\r\n var r = o.handleUpdates.bind(o)\r\n o.stopListening(t, n, r), o.listenTo(t, n, r), !e.avoidStore && r('', '', e)\r\n },\r\n load: function (e) {\r\n var n = e || ''\r\n !n && s.stm && (n = s.em.getCacheLoad())\r\n var i = n.styles || ''\r\n if (n.styles)\r\n try {\r\n i = JSON.parse(n.styles)\r\n } catch (t) {}\r\n else n.css && (i = s.em.get('Parser').parseCss(n.css))\r\n return (0, r.isArray)(i) ? i.length && t.reset(i) : i && t.reset(i), i\r\n },\r\n store: function (e) {\r\n if (s.stm) {\r\n var n = {},\r\n i = this.storageKey()\r\n return (\r\n i.indexOf('css') >= 0 && (n.css = s.em.getCss()),\r\n i.indexOf('styles') >= 0 && (n.styles = JSON.stringify(t)),\r\n e || s.stm.store(n),\r\n n\r\n )\r\n }\r\n },\r\n add: function (e, n, r) {\r\n var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},\r\n a = n || '',\r\n c = r || '',\r\n u = i({}, o),\r\n h = this.get(e, a, c, u)\r\n return h && h.config && !h.config.singleAtRule\r\n ? h\r\n : ((u.state = a),\r\n (u.mediaText = c),\r\n (u.selectors = ''),\r\n (h = new l(u, s)).get('selectors').add(e),\r\n t.add(h),\r\n h)\r\n },\r\n get: function (e, n, i, r) {\r\n var o = null\r\n return (\r\n t.each(function (t) {\r\n o || (t.compare(e, n, i, r) && (o = t))\r\n }),\r\n o\r\n )\r\n },\r\n getAll: function () {\r\n return t\r\n },\r\n clear: function () {\r\n return this.getAll().reset(), this\r\n },\r\n addCollection: function (t) {\r\n for (\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = [],\r\n r = t instanceof Array ? t : [t],\r\n o = 0,\r\n a = r.length;\r\n o < a;\r\n o++\r\n ) {\r\n var l = r[o] || {}\r\n if (l.selectors) {\r\n var c = s.em && s.em.get('SelectorManager')\r\n c || console.warn('Selector Manager not found')\r\n for (var u = l.selectors, h = u instanceof Array ? u : [u], d = [], f = 0, p = h.length; f < p; f++) {\r\n var g = c.add(h[f])\r\n d.push(g)\r\n }\r\n var v = this.get(d, l.state, l.mediaText, l),\r\n m = this.add(d, l.state, l.mediaText, l),\r\n y = !v || !e.avoidUpdateStyle,\r\n b = l.style || {}\r\n if (y) {\r\n var x = e.extend ? i({}, m.get('style'), b) : b\r\n m.set('style', x)\r\n }\r\n n.push(m)\r\n }\r\n }\r\n return n\r\n },\r\n setIdRule: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},\r\n i = n.state || '',\r\n r = n.mediaText || o.getCurrentMedia(),\r\n s = o.get('SelectorManager').add({ name: t, type: d.TYPE_ID }),\r\n a = this.add(s, i, r)\r\n return a.setStyle(e, n), a\r\n },\r\n getIdRule: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = e.state || '',\r\n i = e.mediaText || o.getCurrentMedia(),\r\n r = o.get('SelectorManager').get(t, d.TYPE_ID)\r\n return r && this.get(r, n, i)\r\n },\r\n setClassRule: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},\r\n i = n.state || '',\r\n r = n.mediaText || o.getCurrentMedia(),\r\n s = o.get('SelectorManager').add({ name: t, type: d.TYPE_CLASS }),\r\n a = this.add(s, i, r)\r\n return a.setStyle(e, n), a\r\n },\r\n getClassRule: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = e.state || '',\r\n i = e.mediaText || o.getCurrentMedia(),\r\n r = o.get('SelectorManager').get(t, d.TYPE_CLASS)\r\n return r && this.get(r, n, i)\r\n },\r\n render: function () {\r\n return e.render().el\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = { stylePrefix: 'css-', staticRules: '', rules: [] }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n var s = n(68)\r\n t.exports = o.default.Collection.extend({\r\n initialize: function (t, e) {\r\n e && e.em && (this.editor = e.em),\r\n (this.model = function (t, n) {\r\n return !n.em && e && e.em && (n.em = e.em), new s(t, n)\r\n })\r\n },\r\n add: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n return (\r\n 'string' == typeof t && (t = this.editor.get('Parser').parseCss(t)),\r\n (e.em = this.editor),\r\n o.default.Collection.prototype.add.apply(this, [t, e])\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n var s = n(70),\r\n a = n(173),\r\n l = o.default.$,\r\n c = function (t, e) {\r\n return t + (e ? '-' + parseFloat(e) : '')\r\n }\r\n t.exports = o.default.View.extend({\r\n initialize: function (t) {\r\n var e = t.config || {}\r\n ;(this.atRules = {}),\r\n (this.config = e),\r\n (this.em = e.em),\r\n (this.pfx = e.stylePrefix || ''),\r\n (this.className = this.pfx + 'rules')\r\n var n = this.collection\r\n this.listenTo(n, 'add', this.addTo), this.listenTo(n, 'reset', this.render)\r\n },\r\n addTo: function (t) {\r\n this.addToCollection(t)\r\n },\r\n addToCollection: function (t, e) {\r\n if (this.renderStarted) {\r\n var n = e || null,\r\n i = void 0,\r\n r = void 0,\r\n o = { model: t, config: this.config }\r\n if ('keyframes' === t.get('atRuleType')) {\r\n var l = t.getAtRule(),\r\n u = this.atRules[l]\r\n if (!u) {\r\n var h = document.createElement('style')\r\n ;(u = document.createTextNode('')),\r\n h.appendChild(document.createTextNode(l + '{')),\r\n h.appendChild(u),\r\n h.appendChild(document.createTextNode('}')),\r\n (this.atRules[l] = u),\r\n (i = h)\r\n }\r\n ;(r = new a(o)), u.appendData(r.render().el.textContent)\r\n } else i = (r = new s(o)).render().el\r\n var d = this.className,\r\n f = t.get('mediaText'),\r\n p = c(d),\r\n g = p\r\n if ((f && (g = c(d, this.getMediaWidth(f))), i)) {\r\n var v = n || this.el,\r\n m = void 0\r\n try {\r\n m = v.querySelector('#' + g)\r\n } catch (t) {}\r\n m || (m = v.querySelector('#' + p)), m.appendChild(i)\r\n }\r\n return i\r\n }\r\n },\r\n getMediaWidth: function (t) {\r\n return t && t.replace('(' + this.em.getConfig('mediaCondition') + ': ', '').replace(')', '')\r\n },\r\n render: function () {\r\n var t = this\r\n ;(this.renderStarted = 1), (this.atRules = {})\r\n var e = this.$el,\r\n n = document.createDocumentFragment(),\r\n i = this.className\r\n return (\r\n e.empty(),\r\n this.em\r\n .get('DeviceManager')\r\n .getAll()\r\n .pluck('priority')\r\n .forEach(function (t) {\r\n l('').appendTo(n)\r\n }),\r\n this.collection.each(function (e) {\r\n return t.addToCollection(e, n)\r\n }),\r\n e.append(n),\r\n e.attr('class', i),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(70).extend({\r\n _createElement: function (t) {\r\n return document.createTextNode('')\r\n },\r\n render: function () {\r\n var t = this.model,\r\n e = t.get('important')\r\n return (this.el.textContent = t.getDeclaration({ important: e })), this\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1),\r\n r = n(175),\r\n o = n(176)\r\n t.exports = function () {\r\n var t = {},\r\n e = void 0\r\n return {\r\n TraitsView: o,\r\n name: 'TraitManager',\r\n getConfig: function () {\r\n return t\r\n },\r\n init: function () {\r\n var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n ;(t = n), (0, i.defaults)(t, r)\r\n var s = t.pStylePrefix\r\n return (\r\n s && (t.stylePrefix = '' + s + t.stylePrefix),\r\n (e = new o({ collection: [], editor: t.em, config: t })),\r\n this\r\n )\r\n },\r\n postRender: function () {\r\n var t = this.getConfig().appendTo\r\n t && ((0, i.isElement)(t) ? t : document.querySelector(t)).appendChild(this.render())\r\n },\r\n getTraitsViewer: function () {\r\n return e\r\n },\r\n addType: function (t, n) {\r\n var i = e.itemView\r\n e.itemsView[t] = i.extend(n)\r\n },\r\n getType: function (t) {\r\n return e.itemsView[t]\r\n },\r\n render: function () {\r\n return e.render().el\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n stylePrefix: 'trt-',\r\n appendTo: '',\r\n labelContainer: 'Component settings',\r\n labelPlhText: 'eg. Text here',\r\n labelPlhHref: 'eg. https://google.com',\r\n optionsTarget: [{ value: '', name: 'This window' }, { value: '_blank', name: 'New window' }],\r\n textNoElement: 'Select an element before using Trait Manager'\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(71),\r\n r = n(7),\r\n o = n(177),\r\n s = n(178),\r\n a = n(179),\r\n l = n(180),\r\n c = n(181)\r\n t.exports = i.extend({\r\n itemView: r,\r\n itemsView: { text: r, number: a, select: o, checkbox: s, color: l, button: c },\r\n initialize: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\r\n e = t.config || {}\r\n ;(this.config = e),\r\n (this.em = t.editor),\r\n (this.pfx = e.stylePrefix || ''),\r\n (this.ppfx = e.pStylePrefix || ''),\r\n (this.className = this.pfx + 'traits')\r\n this.listenTo(this.em, 'component:toggled', this.updatedCollection), this.updatedCollection()\r\n },\r\n updatedCollection: function () {\r\n var t = this.ppfx,\r\n e = this.em.getSelected()\r\n ;(this.el.className = this.className + ' ' + t + 'one-bg ' + t + 'two-color'),\r\n (this.collection = e ? e.get('traits') : []),\r\n this.render()\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n ;(function (e) {\r\n var i = n(7),\r\n r = n(0).$\r\n t.exports = i.extend({\r\n initialize: function (t) {\r\n i.prototype.initialize.apply(this, arguments)\r\n var e = this.ppfx\r\n this.tmpl =\r\n '
'\r\n },\r\n getInputEl: function () {\r\n if (!this.$input) {\r\n var t = this.model,\r\n n = t.get('options') || [],\r\n i = ''),\r\n (this.input = i),\r\n (this.$input = r(this.input))\r\n var o = this.target,\r\n s = t.get('name'),\r\n a = t.get('value')\r\n if (t.get('changeProp')) a = a || o.get(s)\r\n else a = o.get('attributes')[s]\r\n a && this.$input.val(a)\r\n }\r\n return this.$input.get(0)\r\n }\r\n })\r\n }.call(this, n(1)))\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1),\r\n r = n(7)\r\n t.exports = r.extend({\r\n initialize: function (t) {\r\n r.prototype.initialize.apply(this, arguments)\r\n var e = this.ppfx,\r\n n = this.fieldClass,\r\n i = this.inputhClass\r\n this.tmpl =\r\n '
\\n \\n
'\r\n },\r\n onChange: function () {\r\n var t = this.getInputEl().checked\r\n this.model.set('value', this.getCheckedValue(t))\r\n },\r\n getCheckedValue: function (t) {\r\n var e = t,\r\n n = this.model.attributes,\r\n r = n.valueTrue,\r\n o = n.valueFalse\r\n return e && !(0, i.isUndefined)(r) && (e = r), e || (0, i.isUndefined)(o) || (e = o), e\r\n },\r\n getInputEl: function () {\r\n for (var t = !this.$input, e = arguments.length, n = Array(e), o = 0; o < e; o++) n[o] = arguments[o]\r\n var s = r.prototype.getInputEl.apply(this, n)\r\n if (t) {\r\n var a = void 0,\r\n l = void 0,\r\n c = this.model,\r\n u = this.target,\r\n h = c.attributes,\r\n d = (h.valueTrue, h.valueFalse),\r\n f = c.get('name')\r\n c.get('changeProp') ? (l = a = u.get(f)) : (a = !(!(l = u.get('attributes')[f]) && '' !== l)),\r\n (0, i.isUndefined)(d) || l !== d || (a = !1),\r\n (s.checked = a)\r\n }\r\n return s\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(7),\r\n r = n(22)\r\n t.exports = i.extend({\r\n getValueForTarget: function () {\r\n var t = this.model,\r\n e = t.get('value'),\r\n n = t.get('unit')\r\n return e ? e + n : ''\r\n },\r\n getInputEl: function () {\r\n if (!this.$input) {\r\n var t = this.getModelValue(),\r\n e = new r({ contClass: this.ppfx + 'field-int', model: this.model, ppfx: this.ppfx })\r\n ;(this.input = e.render()),\r\n (this.$input = this.input.inputEl),\r\n (this.$unit = this.input.unitEl),\r\n this.model.set('value', t),\r\n this.$input.val(t)\r\n }\r\n return this.$input.get(0)\r\n },\r\n renderField: function () {\r\n this.$input ||\r\n (this.$el.append(this.tmpl),\r\n this.getInputEl(),\r\n this.$el.find('.' + this.inputhClass).prepend(this.input.el))\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(7),\r\n r = n(57)\r\n t.exports = i.extend({\r\n getInputEl: function () {\r\n if (!this.$input) {\r\n var t = this.model,\r\n e = this.getModelValue(),\r\n n = new r({\r\n model: t,\r\n target: this.config.em,\r\n contClass: this.ppfx + 'field-color',\r\n ppfx: this.ppfx\r\n }).render()\r\n ;(this.$input = n.colorEl), n.setValue(e, { fromTarget: 1 }), (this.input = n)\r\n }\r\n return this.$input.get(0)\r\n },\r\n renderField: function () {\r\n this.$input || (this.getInputEl(), this.$el.append(this.input.el))\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1),\r\n r = n(7)\r\n t.exports = r.extend({\r\n events: { 'click button': 'handleClick' },\r\n handleClick: function () {\r\n var t = this.model,\r\n e = this.em,\r\n n = t.get('command')\r\n n && ((0, i.isString)(n) ? e.get('Commands').run(n) : n(e.get('Editor'), t))\r\n },\r\n renderLabel: function () {\r\n this.model.get('label') && r.prototype.renderLabel.apply(this, arguments)\r\n },\r\n getInputEl: function () {\r\n if (!this.input) {\r\n var t = this.model,\r\n e = this.ppfx,\r\n n = (this.getModelValue(), t.get('labelButton') || ''),\r\n i = e + 'btn',\r\n r =\r\n ''\r\n this.input = r\r\n }\r\n return this.input\r\n },\r\n renderField: function () {\r\n this.$input || this.$el.append(this.getInputEl())\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r =\r\n 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator\r\n ? function (t) {\r\n return typeof t\r\n }\r\n : function (t) {\r\n return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype\r\n ? 'symbol'\r\n : typeof t\r\n },\r\n o =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n s = n(0),\r\n a = (i = s) && i.__esModule ? i : { default: i },\r\n l = n(1)\r\n t.exports = function () {\r\n var t,\r\n e,\r\n i = {},\r\n s = void 0,\r\n c = n(183),\r\n u = n(3),\r\n h = n(4),\r\n d = n(23),\r\n f = n(72),\r\n p = [\r\n { id: 'cell', model: n(187), view: n(188) },\r\n { id: 'row', model: n(189), view: n(190) },\r\n { id: 'table', model: n(191), view: n(192) },\r\n { id: 'thead', model: n(193), view: n(194) },\r\n { id: 'tbody', model: n(24), view: n(195) },\r\n { id: 'tfoot', model: n(196), view: n(197) },\r\n { id: 'map', model: n(198), view: n(199) },\r\n { id: 'link', model: n(200), view: n(73) },\r\n { id: 'label', model: n(201), view: n(202) },\r\n { id: 'video', model: n(203), view: n(204) },\r\n { id: 'image', model: n(25), view: n(18) },\r\n { id: 'script', model: n(205), view: n(206) },\r\n { id: 'svg', model: n(207), view: n(208) },\r\n { id: 'textnode', model: n(209), view: n(210) },\r\n { id: 'text', model: n(26), view: n(74) },\r\n { id: 'wrapper', model: n(211), view: h },\r\n { id: 'default', model: u, view: h }\r\n ]\r\n return {\r\n Component: u,\r\n Components: d,\r\n ComponentsView: f,\r\n componentTypes: p,\r\n name: 'DomComponents',\r\n getConfig: function () {\r\n return i\r\n },\r\n storageKey: function () {\r\n var t = [],\r\n e = (i.stm && i.stm.getConfig()) || {}\r\n return e.storeHtml && t.push('html'), e.storeComponents && t.push('components'), t\r\n },\r\n init: function (n) {\r\n var r = this\r\n for (var a in ((s = (i = n || {}).em),\r\n (this.em = s),\r\n s && (i.components = s.config.components || i.components),\r\n c))\r\n a in i || (i[a] = c[a])\r\n var l = i.pStylePrefix\r\n if ((l && (i.stylePrefix = l + i.stylePrefix), s)) {\r\n ;(i.modal = s.get('Modal') || ''),\r\n (i.am = s.get('AssetManager') || ''),\r\n (s.get('Parser').compTypes = p),\r\n s.on('change:componentHovered', this.componentHovered, this)\r\n var d = s.get('selected')\r\n s.listenTo(d, 'add', function (t, e, n) {\r\n return r.selectAdd(t, n)\r\n }),\r\n s.listenTo(d, 'remove', function (t, e, n) {\r\n return r.selectRemove(t, n)\r\n })\r\n }\r\n var f = i.components,\r\n g = o({}, i.wrapper)\r\n return (\r\n (g['custom-name'] = i.wrapperName),\r\n (g.wrapper = 1),\r\n (g.type = 'wrapper'),\r\n f &&\r\n f.constructor === Object &&\r\n f.wrapper &&\r\n ((g = o({}, f)),\r\n (f = f.components || []),\r\n (g.components = []),\r\n s && ((s.config.components = f), (i.components = f))),\r\n (t = new u(g, { em: s, config: i, componentTypes: p })).set({ attributes: { id: 'wrapper' } }),\r\n (e = new h({ model: t, config: i, componentTypes: p })),\r\n this\r\n )\r\n },\r\n onLoad: function () {\r\n this.setComponents(i.components)\r\n },\r\n postLoad: function (t) {\r\n this.handleChanges(this.getWrapper(), null, { avoidStore: 1 })\r\n },\r\n handleChanges: function (t, e) {\r\n var n = this,\r\n i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},\r\n r = t.components(),\r\n o = s.get('UndoManager'),\r\n a = s.handleUpdates.bind(s),\r\n l = this.handleChanges.bind(this),\r\n c = this.handleChangesColl.bind(this),\r\n u = this.handleRemoves.bind(this)\r\n o && o.add(t), o && r && o.add(r)\r\n ;[\r\n [t, 'change:style change:content change:attributes change:src', a],\r\n [t, 'change:components', c],\r\n [r, 'add', l],\r\n [r, 'remove', u],\r\n [t.get('classes'), 'add remove', a]\r\n ].forEach(function (t) {\r\n s.stopListening(t[0], t[1], t[2]), s.listenTo(t[0], t[1], t[2])\r\n }),\r\n !i.avoidStore && a('', '', i),\r\n r.each(function (t) {\r\n return n.handleChanges(t, e, i)\r\n })\r\n },\r\n handleChangesColl: function (t, e) {\r\n var n = s.get('UndoManager')\r\n if (n && e instanceof a.default.Collection) {\r\n var i = this.handleChanges.bind(this),\r\n r = this.handleRemoves.bind(this)\r\n n.add(e),\r\n [[e, 'add', i], [e, 'remove', r]].forEach(function (t) {\r\n s.stopListening(t[0], t[1], t[2]), s.listenTo(t[0], t[1], t[2])\r\n })\r\n }\r\n },\r\n handleRemoves: function (t, e) {\r\n var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}\r\n !n.avoidStore && s.handleUpdates(t, e, n)\r\n },\r\n load: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '',\r\n e = this.em,\r\n n = ''\r\n !t && i.stm && (t = i.em.getCacheLoad())\r\n var r = t,\r\n o = r.components,\r\n s = r.html\r\n if (o)\r\n if ((0, l.isObject)(o) || (0, l.isArray)(o)) n = o\r\n else\r\n try {\r\n n = JSON.parse(o)\r\n } catch (t) {\r\n e && e.logError(t)\r\n }\r\n else s && (n = s)\r\n var a = n && n.constructor === Object\r\n return (\r\n ((n && n.length) || a) && (this.clear(), a ? this.getWrapper().set(n) : this.getComponents().add(n)), n\r\n )\r\n },\r\n store: function (t) {\r\n if (i.stm) {\r\n var e = {},\r\n n = this.storageKey()\r\n if ((n.indexOf('html') >= 0 && (e.html = i.em.getHtml()), n.indexOf('components') >= 0)) {\r\n this.em\r\n var r = i.storeWrapper ? this.getWrapper() : this.getComponents()\r\n e.components = JSON.stringify(r)\r\n }\r\n return t || i.stm.store(e), e\r\n }\r\n },\r\n getComponent: function () {\r\n return t\r\n },\r\n getWrapper: function () {\r\n return this.getComponent()\r\n },\r\n getComponents: function () {\r\n return this.getWrapper().get('components')\r\n },\r\n addComponent: function (t) {\r\n return this.getComponents().add(t)\r\n },\r\n render: function () {\r\n return e.render().el\r\n },\r\n clear: function () {\r\n return this.getComponents().reset(), this\r\n },\r\n setComponents: function (t) {\r\n this.clear().addComponent(t)\r\n },\r\n addType: function (t, e) {\r\n var n = e.model,\r\n i = void 0 === n ? {} : n,\r\n s = e.view,\r\n a = void 0 === s ? {} : s,\r\n l = e.isComponent,\r\n c = e.extend,\r\n u = e.extendView,\r\n h = this.getType(t),\r\n d = this.getType(c),\r\n f = this.getType(u),\r\n g = d || (h || this.getType('default')),\r\n v = g.model,\r\n m = f ? f.view : g.view\r\n return (\r\n 'object' === (void 0 === i ? 'undefined' : r(i)) &&\r\n (e.model = v.extend(o({}, i, { defaults: o({}, v.prototype.defaults, i.defaults || {}) }), {\r\n isComponent:\r\n !h || d || l\r\n ? l ||\r\n function () {\r\n return 0\r\n }\r\n : v.isComponent\r\n })),\r\n 'object' === (void 0 === a ? 'undefined' : r(a)) && (e.view = m.extend(o({}, a))),\r\n h ? ((h.model = e.model), (h.view = e.view)) : ((e.id = t), p.unshift(e)),\r\n this\r\n )\r\n },\r\n getType: function (t) {\r\n for (var e = p, n = 0; n < e.length; n++) {\r\n if (e[n].id == t) return e[n]\r\n }\r\n },\r\n getTypes: function () {\r\n return p\r\n },\r\n selectAdd: function (t) {\r\n var e = this,\r\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n t &&\r\n (t.set({ status: 'selected' }),\r\n ['component:selected', 'component:toggled'].forEach(function (i) {\r\n return e.em.trigger(i, t, n)\r\n }))\r\n },\r\n selectRemove: function (t) {\r\n var e = this,\r\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n if (t) {\r\n this.em\r\n t.set({ status: '', state: '' }),\r\n ['component:deselected', 'component:toggled'].forEach(function (i) {\r\n return e.em.trigger(i, t, n)\r\n })\r\n }\r\n },\r\n componentHovered: function () {\r\n var t = i.em,\r\n e = t.get('componentHovered'),\r\n n = t.previous('componentHovered')\r\n n && 'hovered' == n.get('status') && n.set({ status: '', state: '' }),\r\n e && (0, l.isEmpty)(e.get('status')) && e.set('status', 'hovered')\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n stylePrefix: 'comp-',\r\n wrapperId: 'wrapper',\r\n wrapperName: 'Body',\r\n wrapper: {\r\n removable: !1,\r\n copyable: !1,\r\n draggable: !1,\r\n components: [],\r\n traits: [],\r\n stylable: [\r\n 'background',\r\n 'background-color',\r\n 'background-image',\r\n 'background-repeat',\r\n 'background-attachment',\r\n 'background-position',\r\n 'background-size'\r\n ]\r\n },\r\n components: [],\r\n imageCompClass: 'fa fa-picture-o',\r\n oAssetsOnCreate: !0,\r\n storeWrapper: 0,\r\n voidElements: [\r\n 'area',\r\n 'base',\r\n 'br',\r\n 'col',\r\n 'embed',\r\n 'hr',\r\n 'img',\r\n 'input',\r\n 'keygen',\r\n 'link',\r\n 'menuitem',\r\n 'meta',\r\n 'param',\r\n 'source',\r\n 'track',\r\n 'wbr'\r\n ]\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1),\r\n r = n(0),\r\n o = n(185),\r\n s = n(186)\r\n t.exports = r.Collection.extend({\r\n model: o,\r\n initialize: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n ;(this.em = e.em || ''), this.listenTo(this, 'add', this.handleAdd)\r\n },\r\n handleAdd: function (t) {\r\n var e = this.target\r\n e && (t.target = e)\r\n },\r\n setTarget: function (t) {\r\n this.target = t\r\n },\r\n add: function (t, e) {\r\n var n = this.em\r\n if ((0, i.isString)(t) || (0, i.isArray)(t)) {\r\n var o = n && n.get && n.get('TraitManager'),\r\n a = o && o.getConfig(),\r\n l = s(a)\r\n ;(0, i.isString)(t) && (t = [t])\r\n for (var c = 0, u = t.length; c < u; c++) {\r\n var h = t[c],\r\n d = (0, i.isString)(h) ? l.build(h)[0] : h\r\n ;(d.target = this.target), (t[c] = d)\r\n }\r\n }\r\n return r.Collection.prototype.add.apply(this, [t, e])\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(1)\r\n t.exports = n(0).Model.extend({\r\n defaults: {\r\n type: 'text',\r\n label: '',\r\n name: '',\r\n min: '',\r\n max: '',\r\n unit: '',\r\n step: 1,\r\n value: '',\r\n target: '',\r\n default: '',\r\n placeholder: '',\r\n changeProp: 0,\r\n options: []\r\n },\r\n initialize: function () {\r\n var t = this.get('target'),\r\n e = this.get('name'),\r\n n = this.get('changeProp')\r\n if (t) {\r\n ;(this.target = t), this.unset('target')\r\n var i = n ? 'change:' + e : 'change:attributes:' + e\r\n this.listenTo(t, i, this.targetUpdated)\r\n }\r\n },\r\n targetUpdated: function () {\r\n var t = this.getTargetValue()\r\n this.set({ value: t }, { fromTarget: 1 })\r\n },\r\n getTargetValue: function () {\r\n var t = this.get('name'),\r\n e = this.target,\r\n n = void 0\r\n return (n = this.get('changeProp') ? e.get(t) : e.getAttributes()[t]), (0, r.isUndefined)(n) ? '' : n\r\n },\r\n setTargetValue: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = this.target,\r\n o = this.get('name')\r\n if (!(0, r.isUndefined)(t))\r\n if (this.get('changeProp')) n.set(o, t, e)\r\n else {\r\n var s = i({}, n.get('attributes'))\r\n ;(s[o] = t), n.set('attributes', s, e)\r\n }\r\n },\r\n setValueFromInput: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,\r\n n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},\r\n r = { value: t }\r\n this.set(r, i({}, n, { avoidStore: 1 })), e && (this.set('value', '', n), this.set(r, n))\r\n },\r\n getInitValue: function () {\r\n var t = this.target,\r\n e = this.get('name'),\r\n n = void 0\r\n if (t) {\r\n var i = t.get('attributes')\r\n n = this.get('changeProp') ? t.get(e) : i[e]\r\n }\r\n return n || this.get('value') || this.get('default')\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n return {\r\n build: function (e) {\r\n var n = []\r\n 'string' == typeof e && (e = [e])\r\n for (var i = 0; i < e.length; i++) {\r\n var r = {},\r\n o = e[i]\r\n switch (((r.name = o), o)) {\r\n case 'target':\r\n r.type = 'select'\r\n }\r\n switch (o) {\r\n case 'title':\r\n case 'alt':\r\n case 'id':\r\n r.placeholder = t.labelPlhText\r\n break\r\n case 'href':\r\n r.placeholder = t.labelPlhHref\r\n }\r\n switch (o) {\r\n case 'target':\r\n r.options = t.optionsTarget\r\n }\r\n n.push(r)\r\n }\r\n return n\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(3)\r\n t.exports = r.extend(\r\n { defaults: i({}, r.prototype.defaults, { type: 'cell', tagName: 'td', draggable: ['tr'] }) },\r\n {\r\n isComponent: function (t) {\r\n var e = '',\r\n n = t.tagName\r\n return ('TD' != n && 'TH' != n) || (e = { type: 'cell', tagName: n.toLowerCase() }), e\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(4).extend({})\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(3)\r\n t.exports = r.extend(\r\n {\r\n defaults: i({}, r.prototype.defaults, {\r\n type: 'row',\r\n tagName: 'tr',\r\n draggable: ['thead', 'tbody', 'tfoot'],\r\n droppable: ['th', 'td']\r\n }),\r\n initialize: function (t, e) {\r\n r.prototype.initialize.apply(this, arguments)\r\n var n = [],\r\n i = this.get('components')\r\n i.each(function (t) {\r\n return t.is('cell') && n.push(t)\r\n }),\r\n i.reset(n)\r\n }\r\n },\r\n {\r\n isComponent: function (t) {\r\n var e = ''\r\n return 'TR' == t.tagName && (e = { type: 'row' }), e\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(4).extend({})\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(3)\r\n t.exports = r.extend(\r\n {\r\n defaults: i({}, r.prototype.defaults, {\r\n type: 'table',\r\n tagName: 'table',\r\n droppable: ['tbody', 'thead', 'tfoot']\r\n }),\r\n initialize: function (t, e) {\r\n r.prototype.initialize.apply(this, arguments)\r\n var n = this.get('components')\r\n !n.length && n.add({ type: 'tbody' })\r\n }\r\n },\r\n {\r\n isComponent: function (t) {\r\n var e = ''\r\n return 'TABLE' == t.tagName && (e = { type: 'table' }), e\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(4).extend({ events: {} })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(24)\r\n t.exports = r.extend(\r\n { defaults: i({}, r.prototype.defaults, { type: 'thead', tagName: 'thead' }) },\r\n {\r\n isComponent: function (t) {\r\n var e = ''\r\n return 'THEAD' == t.tagName && (e = { type: 'thead' }), e\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(4).extend({})\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(4).extend({})\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(24)\r\n t.exports = r.extend(\r\n { defaults: i({}, r.prototype.defaults, { type: 'tfoot', tagName: 'tfoot' }) },\r\n {\r\n isComponent: function (t) {\r\n var e = ''\r\n return 'TFOOT' == t.tagName && (e = { type: 'tfoot' }), e\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(4).extend({})\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(25),\r\n o = n(3)\r\n t.exports = r.extend(\r\n {\r\n defaults: i({}, r.prototype.defaults, {\r\n type: 'map',\r\n void: 0,\r\n mapUrl: 'https://maps.google.com/maps',\r\n tagName: 'iframe',\r\n mapType: 'q',\r\n address: '',\r\n zoom: '1',\r\n attributes: { frameborder: 0 },\r\n toolbar: o.prototype.defaults.toolbar,\r\n traits: [\r\n { label: 'Address', name: 'address', placeholder: 'eg. London, UK', changeProp: 1 },\r\n {\r\n type: 'select',\r\n label: 'Map type',\r\n name: 'mapType',\r\n changeProp: 1,\r\n options: [{ value: 'q', name: 'Roadmap' }, { value: 'w', name: 'Satellite' }]\r\n },\r\n { label: 'Zoom', name: 'zoom', type: 'range', min: '1', max: '20', changeProp: 1 }\r\n ]\r\n }),\r\n initialize: function (t, e) {\r\n this.get('src') ? this.parseFromSrc() : this.updateSrc(),\r\n r.prototype.initialize.apply(this, arguments),\r\n this.listenTo(this, 'change:address change:zoom change:mapType', this.updateSrc)\r\n },\r\n updateSrc: function () {\r\n this.set('src', this.getMapUrl())\r\n },\r\n getMapUrl: function () {\r\n var t = this.get('address'),\r\n e = this.get('zoom'),\r\n n = this.get('mapType')\r\n ;(t = t ? '&q=' + t : ''), (e = e ? '&z=' + e : ''), (n = n ? '&t=' + n : '')\r\n var i = this.get('mapUrl') + '?' + t + e + n\r\n return (i += '&output=embed')\r\n },\r\n parseFromSrc: function () {\r\n var t = this.parseUri(this.get('src')).query\r\n t.q && this.set('address', t.q), t.z && this.set('zoom', t.z), t.t && this.set('mapType', t.t)\r\n }\r\n },\r\n {\r\n isComponent: function (t) {\r\n var e = ''\r\n return 'IFRAME' == t.tagName && /maps\\.google\\.com/.test(t.src) && (e = { type: 'map', src: t.src }), e\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n n(0)\r\n var i = n(18)\r\n t.exports = i.extend({\r\n tagName: 'div',\r\n events: {},\r\n initialize: function (t) {\r\n i.prototype.initialize.apply(this, arguments), (this.classEmpty = this.ppfx + 'plh-map')\r\n },\r\n updateSrc: function () {\r\n this.getIframe().src = this.model.get('src')\r\n },\r\n getIframe: function () {\r\n if (!this.iframe) {\r\n var t = document.createElement('iframe')\r\n ;(t.src = this.model.get('src')),\r\n (t.frameBorder = 0),\r\n (t.style.height = '100%'),\r\n (t.style.width = '100%'),\r\n (t.className = this.ppfx + 'no-pointer'),\r\n (this.iframe = t)\r\n }\r\n return this.iframe\r\n },\r\n render: function () {\r\n for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n]\r\n return i.prototype.render.apply(this, e), this.updateClasses(), this.el.appendChild(this.getIframe()), this\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(26)\r\n t.exports = r.extend(\r\n {\r\n defaults: i({}, r.prototype.defaults, { type: 'link', tagName: 'a', traits: ['title', 'href', 'target'] }),\r\n getAttrToHTML: function () {\r\n for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n]\r\n var i = r.prototype.getAttrToHTML.apply(this, e)\r\n return delete i.onmousedown, i\r\n }\r\n },\r\n {\r\n isComponent: function (t) {\r\n var e = void 0\r\n if ('A' == t.tagName) {\r\n e = { type: 'link', editable: 0 }\r\n var n = t.childNodes,\r\n i = n.length\r\n i || delete e.editable\r\n for (var r = 0; r < i; r++) {\r\n var o = n[r]\r\n if (3 == o.nodeType && '' != o.textContent.trim()) {\r\n delete e.editable\r\n break\r\n }\r\n }\r\n }\r\n return e\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(26)\r\n t.exports = r.extend(\r\n { defaults: i({}, r.prototype.defaults, { tagName: 'label', traits: ['id', 'title', 'for'] }) },\r\n {\r\n isComponent: function (t) {\r\n if ('LABEL' == t.tagName) return { type: 'label' }\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(73).extend({})\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(25),\r\n o = n(3),\r\n s = 'yt',\r\n a = 'vi',\r\n l = 'ytnc'\r\n t.exports = r.extend(\r\n {\r\n defaults: i({}, r.prototype.defaults, {\r\n type: 'video',\r\n tagName: 'video',\r\n videoId: '',\r\n void: 0,\r\n provider: '',\r\n ytUrl: 'https://www.youtube.com/embed/',\r\n ytncUrl: 'https://www.youtube-nocookie.com/embed/',\r\n viUrl: 'https://player.vimeo.com/video/',\r\n loop: 0,\r\n poster: '',\r\n muted: 0,\r\n autoplay: 0,\r\n controls: 1,\r\n color: '',\r\n rel: 1,\r\n modestbranding: 0,\r\n sources: [],\r\n attributes: { allowfullscreen: 'allowfullscreen' },\r\n toolbar: o.prototype.defaults.toolbar\r\n }),\r\n initialize: function (t, e) {\r\n var n = []\r\n switch (this.get('provider')) {\r\n case s:\r\n case l:\r\n n = this.getYoutubeTraits()\r\n break\r\n case a:\r\n n = this.getVimeoTraits()\r\n break\r\n default:\r\n n = this.getSourceTraits()\r\n }\r\n this.get('src') && this.parseFromSrc(),\r\n this.set('traits', n),\r\n r.prototype.initialize.apply(this, arguments),\r\n this.listenTo(this, 'change:provider', this.updateTraits),\r\n this.listenTo(this, 'change:videoId change:provider', this.updateSrc)\r\n },\r\n initToolbar: function () {\r\n for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n]\r\n o.prototype.initToolbar.apply(this, e)\r\n },\r\n parseFromSrc: function () {\r\n var t = this.get('provider'),\r\n e = this.parseUri(this.get('src')),\r\n n = e.query\r\n switch (t) {\r\n case s:\r\n case l:\r\n case a:\r\n var i = e.pathname.split('/').pop()\r\n this.set('videoId', i),\r\n n.autoplay && this.set('autoplay', 1),\r\n n.loop && this.set('loop', 1),\r\n 0 === parseInt(n.controls) && this.set('controls', 0),\r\n n.color && this.set('color', n.color),\r\n '0' === n.rel && this.set('rel', 0),\r\n '1' === n.modestbranding && this.set('modestbranding', 1)\r\n }\r\n },\r\n updateSrc: function () {\r\n switch (this.get('provider')) {\r\n case s:\r\n this.set('src', this.getYoutubeSrc())\r\n break\r\n case l:\r\n this.set('src', this.getYoutubeNoCookieSrc())\r\n break\r\n case a:\r\n this.set('src', this.getVimeoSrc())\r\n }\r\n },\r\n getAttrToHTML: function () {\r\n for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n]\r\n var i = r.prototype.getAttrToHTML.apply(this, e)\r\n switch (this.get('provider')) {\r\n case s:\r\n case l:\r\n case a:\r\n break\r\n default:\r\n this.get('loop') && (i.loop = 'loop'),\r\n this.get('autoplay') && (i.autoplay = 'autoplay'),\r\n this.get('controls') && (i.controls = 'controls')\r\n }\r\n return i\r\n },\r\n updateTraits: function () {\r\n var t = this.get('provider'),\r\n e = this.getSourceTraits()\r\n switch (t) {\r\n case s:\r\n case l:\r\n this.set('tagName', 'iframe'), (e = this.getYoutubeTraits())\r\n break\r\n case a:\r\n this.set('tagName', 'iframe'), (e = this.getVimeoTraits())\r\n break\r\n default:\r\n this.set('tagName', 'video')\r\n }\r\n this.loadTraits(e), this.em.trigger('component:toggled')\r\n },\r\n getProviderTrait: function () {\r\n return {\r\n type: 'select',\r\n label: 'Provider',\r\n name: 'provider',\r\n changeProp: 1,\r\n value: this.get('provider'),\r\n options: [\r\n { value: 'so', name: 'HTML5 Source' },\r\n { value: s, name: 'Youtube' },\r\n { value: l, name: 'Youtube (no cookie)' },\r\n { value: a, name: 'Vimeo' }\r\n ]\r\n }\r\n },\r\n getSourceTraits: function () {\r\n return [\r\n this.getProviderTrait(),\r\n { label: 'Source', name: 'src', placeholder: 'eg. ./media/video.mp4', changeProp: 1 },\r\n { label: 'Poster', name: 'poster', placeholder: 'eg. ./media/image.jpg', changeProp: 1 },\r\n this.getAutoplayTrait(),\r\n this.getLoopTrait(),\r\n this.getControlsTrait()\r\n ]\r\n },\r\n getYoutubeTraits: function () {\r\n return [\r\n this.getProviderTrait(),\r\n { label: 'Video ID', name: 'videoId', placeholder: 'eg. jNQXAC9IVRw', changeProp: 1 },\r\n this.getAutoplayTrait(),\r\n this.getLoopTrait(),\r\n this.getControlsTrait(),\r\n { type: 'checkbox', label: 'Related', name: 'rel', changeProp: 1 },\r\n { type: 'checkbox', label: 'Modest', name: 'modestbranding', changeProp: 1 }\r\n ]\r\n },\r\n getVimeoTraits: function () {\r\n return [\r\n this.getProviderTrait(),\r\n { label: 'Video ID', name: 'videoId', placeholder: 'eg. 123456789', changeProp: 1 },\r\n { label: 'Color', name: 'color', placeholder: 'eg. FF0000', changeProp: 1 },\r\n this.getAutoplayTrait(),\r\n this.getLoopTrait()\r\n ]\r\n },\r\n getAutoplayTrait: function () {\r\n return { type: 'checkbox', label: 'Autoplay', name: 'autoplay', changeProp: 1 }\r\n },\r\n getLoopTrait: function () {\r\n return { type: 'checkbox', label: 'Loop', name: 'loop', changeProp: 1 }\r\n },\r\n getControlsTrait: function () {\r\n return { type: 'checkbox', label: 'Controls', name: 'controls', changeProp: 1 }\r\n },\r\n getYoutubeSrc: function () {\r\n var t = this.get('videoId'),\r\n e = this.get('ytUrl')\r\n return (\r\n (e += t + '?'),\r\n (e += this.get('autoplay') ? '&autoplay=1' : ''),\r\n (e += this.get('controls') ? '' : '&controls=0&showinfo=0'),\r\n (e += this.get('loop') ? '&loop=1&playlist=' + t : ''),\r\n (e += this.get('rel') ? '' : '&rel=0'),\r\n (e += this.get('modestbranding') ? '&modestbranding=1' : '')\r\n )\r\n },\r\n getYoutubeNoCookieSrc: function () {\r\n var t = this.getYoutubeSrc()\r\n return (t = t.replace(this.get('ytUrl'), this.get('ytncUrl')))\r\n },\r\n getVimeoSrc: function () {\r\n var t = this.get('viUrl')\r\n return (\r\n (t += this.get('videoId') + '?'),\r\n (t += this.get('autoplay') ? '&autoplay=1' : ''),\r\n (t += this.get('loop') ? '&loop=1' : ''),\r\n (t += this.get('controls') ? '' : '&title=0&portrait=0&badge=0'),\r\n (t += this.get('color') ? '&color=' + this.get('color') : '')\r\n )\r\n }\r\n },\r\n {\r\n isComponent: function (t) {\r\n var e = '',\r\n n = /youtube\\.com\\/embed/.test(t.src),\r\n i = /youtube-nocookie\\.com\\/embed/.test(t.src),\r\n r = /player\\.vimeo\\.com\\/video/.test(t.src),\r\n o = n || i || r\r\n return (\r\n ('VIDEO' == t.tagName || ('IFRAME' == t.tagName && o)) &&\r\n ((e = { type: 'video' }),\r\n t.src && (e.src = t.src),\r\n o && (n ? (e.provider = s) : i ? (e.provider = l) : r && (e.provider = a))),\r\n e\r\n )\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n n(0)\r\n var i = n(18),\r\n r = n(4)\r\n t.exports = i.extend({\r\n tagName: 'div',\r\n events: {},\r\n initialize: function (t) {\r\n r.prototype.initialize.apply(this, arguments),\r\n this.listenTo(this.model, 'change:src', this.updateSrc),\r\n this.listenTo(\r\n this.model,\r\n 'change:loop change:autoplay change:controls change:color change:rel change:modestbranding change:poster',\r\n this.updateVideo\r\n ),\r\n this.listenTo(this.model, 'change:provider', this.updateProvider)\r\n },\r\n updateProvider: function () {\r\n var t = this.model.get('provider')\r\n ;(this.el.innerHTML = ''), this.el.appendChild(this.renderByProvider(t))\r\n },\r\n updateSrc: function () {\r\n var t = this.model.get('provider'),\r\n e = this.model.get('src')\r\n switch (t) {\r\n case 'yt':\r\n e = this.model.getYoutubeSrc()\r\n break\r\n case 'ytnc':\r\n e = this.model.getYoutubeNoCookieSrc()\r\n break\r\n case 'vi':\r\n e = this.model.getVimeoSrc()\r\n }\r\n this.videoEl.src = e\r\n },\r\n updateVideo: function () {\r\n var t = this.model.get('provider'),\r\n e = this.videoEl,\r\n n = this.model\r\n switch (t) {\r\n case 'yt':\r\n case 'ytnc':\r\n case 'vi':\r\n this.model.trigger('change:videoId')\r\n break\r\n default:\r\n ;(e.loop = n.get('loop')),\r\n (e.autoplay = n.get('autoplay')),\r\n (e.controls = n.get('controls')),\r\n (e.poster = n.get('poster'))\r\n }\r\n },\r\n renderByProvider: function (t) {\r\n var e\r\n switch (t) {\r\n case 'yt':\r\n e = this.renderYoutube()\r\n break\r\n case 'ytnc':\r\n e = this.renderYoutubeNoCookie()\r\n break\r\n case 'vi':\r\n e = this.renderVimeo()\r\n break\r\n default:\r\n e = this.renderSource()\r\n }\r\n return (this.videoEl = e), e\r\n },\r\n renderSource: function () {\r\n var t = document.createElement('video')\r\n return (t.src = this.model.get('src')), this.initVideoEl(t), t\r\n },\r\n renderYoutube: function () {\r\n var t = document.createElement('iframe')\r\n return (\r\n (t.src = this.model.getYoutubeSrc()),\r\n (t.frameBorder = 0),\r\n t.setAttribute('allowfullscreen', !0),\r\n this.initVideoEl(t),\r\n t\r\n )\r\n },\r\n renderYoutubeNoCookie: function () {\r\n var t = document.createElement('iframe')\r\n return (\r\n (t.src = this.model.getYoutubeNoCookieSrc()),\r\n (t.frameBorder = 0),\r\n t.setAttribute('allowfullscreen', !0),\r\n this.initVideoEl(t),\r\n t\r\n )\r\n },\r\n renderVimeo: function () {\r\n var t = document.createElement('iframe')\r\n return (\r\n (t.src = this.model.getVimeoSrc()),\r\n (t.frameBorder = 0),\r\n t.setAttribute('allowfullscreen', !0),\r\n this.initVideoEl(t),\r\n t\r\n )\r\n },\r\n initVideoEl: function (t) {\r\n ;(t.className = this.ppfx + 'no-pointer'), (t.style.height = '100%'), (t.style.width = '100%')\r\n },\r\n render: function () {\r\n for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n]\r\n i.prototype.render.apply(this, e), this.updateClasses()\r\n var r = this.model.get('provider')\r\n return this.el.appendChild(this.renderByProvider(r)), this\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(3)\r\n t.exports = r.extend(\r\n { defaults: i({}, r.prototype.defaults, { type: 'script', droppable: !1, draggable: !1, layerable: !1 }) },\r\n {\r\n isComponent: function (t) {\r\n if ('SCRIPT' == t.tagName) {\r\n var e = { type: 'script' }\r\n return t.src && ((e.src = t.src), (e.onload = t.onload)), e\r\n }\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n n(0)\r\n var i = n(18)\r\n t.exports = i.extend({\r\n tagName: 'script',\r\n events: {},\r\n render: function () {\r\n var t = this.model,\r\n e = t.get('src'),\r\n n = this.em,\r\n i = n && n.get('scriptCount') ? n.get('scriptCount') : 0,\r\n r = ''\r\n if (e) {\r\n var o = t.get('onload'),\r\n s = 'script' + i,\r\n a = 'script' + (i + 1)\r\n ;(r =\r\n 'var ' +\r\n s +\r\n \" = document.createElement('script');\\n\" +\r\n s +\r\n '.onload = function(){\\n' +\r\n (o ? o + '();\\n' : '') +\r\n 'typeof ' +\r\n a +\r\n \"Start == 'function' && \" +\r\n a +\r\n 'Start();\\n};\\n' +\r\n s +\r\n \".src = '\" +\r\n e +\r\n \"';\\nfunction \" +\r\n s +\r\n 'Start() { document.body.appendChild(' +\r\n s +\r\n '); };\\n' +\r\n (i ? '' : s + 'Start();')),\r\n n && n.set('scriptCount', i + 1)\r\n } else r = t.get('content')\r\n return (this.el.innerHTML = r), this\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(3)\r\n t.exports = r.extend(\r\n {\r\n defaults: i({}, r.prototype.defaults, { highlightable: 0 }),\r\n getName: function () {\r\n var t = this.get('tagName'),\r\n e = this.get('custom-name')\r\n return (t = t.charAt(0).toUpperCase() + t.slice(1)), e || t\r\n }\r\n },\r\n {\r\n isComponent: function (t) {\r\n if (SVGElement && t instanceof SVGElement) {\r\n var e = t.tagName\r\n return { tagName: e, type: 'svg', resizable: 'svg' == e }\r\n }\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(4)\r\n t.exports = i.extend({\r\n _createElement: function (t) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', t)\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i =\r\n Object.assign ||\r\n function (t) {\r\n for (var e = 1; e < arguments.length; e++) {\r\n var n = arguments[e]\r\n for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i])\r\n }\r\n return t\r\n },\r\n r = n(3)\r\n t.exports = r.extend(\r\n {\r\n defaults: i({}, r.prototype.defaults, { droppable: !1, editable: !0 }),\r\n toHTML: function () {\r\n return this.get('content')\r\n }\r\n },\r\n {\r\n isComponent: function (t) {\r\n var e = ''\r\n return 3 === t.nodeType && (e = { type: 'textnode', content: t.textContent }), e\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(0).View.extend({})\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = n(3).extend(\r\n {},\r\n {\r\n isComponent: function () {\r\n return !1\r\n }\r\n }\r\n )\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n stylePrefix: '',\r\n appendTo: '',\r\n sortable: 1,\r\n hidable: 1,\r\n hideTextnode: 1,\r\n root: '',\r\n showWrapper: 1,\r\n showHover: 1,\r\n scrollCanvas: { behavior: 'smooth' },\r\n scrollLayers: 1,\r\n highlightHover: 1\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(76),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n t.exports = n(0).View.extend({\r\n initialize: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}\r\n this.opt = t\r\n var e = t.config || {}\r\n ;(this.level = t.level),\r\n (this.config = e),\r\n (this.preview = t.preview),\r\n (this.ppfx = e.pStylePrefix || ''),\r\n (this.pfx = e.stylePrefix || ''),\r\n (this.parent = t.parent)\r\n var n = this.pfx,\r\n i = this.ppfx,\r\n r = this.parent,\r\n o = this.collection\r\n this.listenTo(o, 'add', this.addTo),\r\n this.listenTo(o, 'reset resetNavigator', this.render),\r\n this.listenTo(o, 'remove', this.removeChildren),\r\n (this.className = n + 'layers')\r\n var s = e.em\r\n if (e.sortable && !this.opt.sorter) {\r\n var a = s.get('Utils')\r\n this.opt.sorter = new a.Sorter({\r\n container: e.sortContainer || this.el,\r\n containerSel: '.' + this.className,\r\n itemSel: '.' + n + 'layer',\r\n ignoreViewChildren: 1,\r\n onEndMove: function (t, e) {\r\n var n = e.getSourceModel()\r\n s.setSelected(n, { forceChange: 1 })\r\n },\r\n avoidSelectOnEnd: 1,\r\n nested: 1,\r\n ppfx: i,\r\n pfx: n\r\n })\r\n }\r\n ;(this.sorter = this.opt.sorter || ''), this.$el.data('collection', o), r && this.$el.data('model', r)\r\n },\r\n removeChildren: function (t) {\r\n var e = t.viewLayer\r\n e && e.remove.apply(e)\r\n },\r\n addTo: function (t) {\r\n var e = this.collection.indexOf(t)\r\n this.addToCollection(t, null, e)\r\n },\r\n addToCollection: function (t, e, n) {\r\n var i = this.level,\r\n r = e || null,\r\n s = o.default\r\n if (this.isCountable(t, this.config.hideTextnode)) {\r\n var a = new s({\r\n level: i,\r\n model: t,\r\n config: this.config,\r\n sorter: this.sorter,\r\n isCountable: this.isCountable,\r\n opened: this.opt.opened\r\n }).render().el\r\n if (r) r.appendChild(a)\r\n else if (void 0 !== n) {\r\n var l = 'before'\r\n this.$el.children().length == n && (n--, (l = 'after')),\r\n n < 0\r\n ? this.$el.append(a)\r\n : this.$el\r\n .children()\r\n .eq(n)\r\n [l](a)\r\n } else this.$el.append(a)\r\n return a\r\n }\r\n },\r\n isCountable: function (t, e) {\r\n var n = t.get('type'),\r\n i = t.get('tagName')\r\n return !((('textnode' == n || 'br' == i) && e) || !t.get('layerable'))\r\n },\r\n render: function () {\r\n var t = this,\r\n e = document.createDocumentFragment(),\r\n n = this.el\r\n return (\r\n (n.innerHTML = ''),\r\n this.collection.each(function (n) {\r\n return t.addToCollection(n, e)\r\n }),\r\n n.appendChild(e),\r\n (n.className = this.className),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(2),\r\n o = n(215),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n t.exports = function () {\r\n var t,\r\n e,\r\n i = {},\r\n o = n(216),\r\n a = n(217),\r\n l = n(219)\r\n return {\r\n getCanvasView: function () {\r\n return l\r\n },\r\n name: 'Canvas',\r\n init: function (e) {\r\n for (var n in ((i = e || {}), o)) n in i || (i[n] = o[n])\r\n var r = i.pStylePrefix\r\n r && (i.stylePrefix = r + i.stylePrefix), (t = new a(e)), (l = new l({ model: t, config: i }))\r\n var s = i.em.get('DomComponents')\r\n return (\r\n s && this.setWrapper(s),\r\n (this.startAutoscroll = this.startAutoscroll.bind(this)),\r\n (this.stopAutoscroll = this.stopAutoscroll.bind(this)),\r\n (this.autoscroll = this.autoscroll.bind(this)),\r\n this\r\n )\r\n },\r\n getConfig: function () {\r\n return i\r\n },\r\n setWrapper: function (e) {\r\n t.set('wrapper', e)\r\n },\r\n getElement: function () {\r\n return l.el\r\n },\r\n getFrameEl: function () {\r\n return l.frame.el\r\n },\r\n getWindow: function () {\r\n return this.getFrameEl().contentWindow\r\n },\r\n getDocument: function () {\r\n return this.getFrameEl().contentDocument\r\n },\r\n getBody: function () {\r\n var t = this.getDocument()\r\n return t && t.body\r\n },\r\n getWrapperEl: function () {\r\n var t = this.getBody()\r\n return t && t.querySelector('#wrapper')\r\n },\r\n getToolsEl: function () {\r\n return l.toolsEl\r\n },\r\n getHighlighter: function () {\r\n return l.hlEl\r\n },\r\n getBadgeEl: function () {\r\n return l.badgeEl\r\n },\r\n getPlacerEl: function () {\r\n return l.placerEl\r\n },\r\n getGhostEl: function () {\r\n return l.ghostEl\r\n },\r\n getToolbarEl: function () {\r\n return l.toolbarEl\r\n },\r\n getResizerEl: function () {\r\n return l.resizerEl\r\n },\r\n getOffsetViewerEl: function () {\r\n return l.offsetEl\r\n },\r\n getFixedOffsetViewerEl: function () {\r\n return l.fixedOffsetEl\r\n },\r\n render: function () {\r\n return l.render().el\r\n },\r\n getOffset: function () {\r\n var t = this.offset(this.getFrameEl()),\r\n e = this.offset(this.getElement())\r\n return { top: t.top - e.top, left: t.left - e.left }\r\n },\r\n offset: function (t) {\r\n return l.offset(t)\r\n },\r\n setCustomBadgeLabel: function (t) {\r\n i.customBadgeLabel = t\r\n },\r\n getElementPos: function (t, e) {\r\n return l.getElementPos(t, e)\r\n },\r\n getTargetToElementDim: function (t, e, n) {\r\n var r = n || {},\r\n o = l.getPosition()\r\n if (o) {\r\n var s = r.elPos || l.getElementPos(e),\r\n a = n.toRight || 0,\r\n c = r.targetHeight || t.offsetHeight,\r\n u = r.targetWidth || t.offsetWidth,\r\n h = r.event || null,\r\n d = s.top - c,\r\n f = s.left\r\n f += a ? s.width : 0\r\n var p = (f = a ? f - u : f) < o.left ? o.left : f,\r\n g = d < o.top ? o.top : d,\r\n v = {\r\n top: (g = g > s.top + s.height ? s.top + s.height : g),\r\n left: p,\r\n elementTop: s.top,\r\n elementLeft: s.left,\r\n elementWidth: s.width,\r\n elementHeight: s.height,\r\n targetWidth: t.offsetWidth,\r\n targetHeight: t.offsetHeight,\r\n canvasTop: o.top,\r\n canvasLeft: o.left\r\n }\r\n return h && i.em && i.em.trigger(h, v), v\r\n }\r\n },\r\n getMouseRelativePos: function (t, e) {\r\n var n = 0,\r\n i = 0,\r\n r = (e || {}).subWinOffset,\r\n o = t.target.ownerDocument,\r\n s = o.defaultView || o.parentWindow,\r\n a = s.frameElement,\r\n l = r ? s.pageYOffset : 0,\r\n c = r ? s.pageXOffset : 0\r\n if (a) {\r\n var u = a.getBoundingClientRect()\r\n ;(n = u.top || 0), (i = u.left || 0)\r\n }\r\n return { y: t.clientY + n - l, x: t.clientX + i - c }\r\n },\r\n getMouseRelativeCanvas: function (t, e) {\r\n var n = this.getFrameEl(),\r\n i = this.getBody(),\r\n r = n.offsetTop || 0,\r\n o = n.offsetLeft || 0,\r\n s = i.scrollTop || 0,\r\n a = i.scrollLeft || 0\r\n return { y: t.clientY + r + s, x: t.clientX + o + a }\r\n },\r\n hasFocus: function () {\r\n return this.getDocument().hasFocus()\r\n },\r\n isInputFocused: function () {\r\n var t = this.getDocument(),\r\n e = ['body'].concat(\r\n (function (t) {\r\n if (Array.isArray(t)) {\r\n for (var e = 0, n = Array(t.length); e < t.length; e++) n[e] = t[e]\r\n return n\r\n }\r\n return Array.from(t)\r\n })(this.getConfig().notTextable)\r\n ),\r\n n = t && t.activeElement\r\n return (\r\n n &&\r\n !e.some(function (t) {\r\n return n.matches(t)\r\n })\r\n )\r\n },\r\n scrollTo: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = (0, r.getElement)(t)\r\n ;(this.getCanvasView().isElInViewport(n) && !e.force) || n.scrollIntoView(e)\r\n },\r\n startAutoscroll: function () {\r\n var t = this\r\n this.dragging = 1\r\n var n = this.getScrollListeners()\r\n ;(e = l.getFrameOffset(1)),\r\n setTimeout(function () {\r\n ;(0, r.on)(n, 'mousemove', t.autoscroll), (0, r.on)(n, 'mouseup', t.stopAutoscroll)\r\n }, 0)\r\n },\r\n autoscroll: function (t) {\r\n if ((t.preventDefault(), this.dragging)) {\r\n var n = this.getFrameEl().contentWindow,\r\n i = n.document.body.scrollTop,\r\n r = t.clientY,\r\n o = e.height - 50\r\n r < 50 && (i -= 50 - r), r > o && (i += r - o), n.scrollTo(0, i)\r\n }\r\n },\r\n stopAutoscroll: function () {\r\n this.dragging = 0\r\n var t = this.getScrollListeners()\r\n ;(0, r.off)(t, 'mousemove', this.autoscroll), (0, r.off)(t, 'mouseup', this.stopAutoscroll)\r\n },\r\n getScrollListeners: function () {\r\n return [this.getFrameEl().contentWindow, this.getElement()]\r\n },\r\n postRender: function () {\r\n ;(0, r.hasDnd)(i.em) && (this.droppable = new s.default(i.em))\r\n },\r\n getFrameWrapperEl: function () {\r\n return l.frame.getWrapper()\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n Object.defineProperty(e, '__esModule', { value: !0 })\r\n var i = (function () {\r\n function t (t, e) {\r\n for (var n = 0; n < e.length; n++) {\r\n var i = e[n]\r\n ;(i.enumerable = i.enumerable || !1),\r\n (i.configurable = !0),\r\n 'value' in i && (i.writable = !0),\r\n Object.defineProperty(t, i.key, i)\r\n }\r\n }\r\n return function (e, n, i) {\r\n return n && t(e.prototype, n), i && t(e, i), e\r\n }\r\n })(),\r\n r = n(2),\r\n o = n(1)\r\n var s = (function () {\r\n function t (e) {\r\n !(function (t, e) {\r\n if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')\r\n })(this, t),\r\n (this.em = e)\r\n var n = e\r\n .get('DomComponents')\r\n .getWrapper()\r\n .getEl()\r\n return (\r\n (this.el = n),\r\n (this.counter = 0),\r\n (0, o.bindAll)(this, 'handleDragEnter', 'handleDragOver', 'handleDrop', 'handleDragLeave'),\r\n (0, r.on)(n, 'dragenter', this.handleDragEnter),\r\n (0, r.on)(n, 'dragover', this.handleDragOver),\r\n (0, r.on)(n, 'drop', this.handleDrop),\r\n (0, r.on)(n, 'dragleave', this.handleDragLeave),\r\n this\r\n )\r\n }\r\n return (\r\n i(t, [\r\n {\r\n key: 'endDrop',\r\n value: function (t, e) {\r\n var n = this.em\r\n ;(this.counter = 0), (this.over = 0)\r\n var i = this.sorter\r\n t && (i.moved = 0), i.endMove(), n.trigger('canvas:dragend', e)\r\n }\r\n },\r\n {\r\n key: 'handleDragLeave',\r\n value: function (t) {\r\n this.updateCounter(-1, t)\r\n }\r\n },\r\n {\r\n key: 'updateCounter',\r\n value: function (t, e) {\r\n ;(this.counter += t), 0 === this.counter && this.endDrop(1, e)\r\n }\r\n },\r\n {\r\n key: 'handleDragEnter',\r\n value: function (t) {\r\n var e = this.em,\r\n n = t.dataTransfer\r\n if ((this.updateCounter(1, t), !this.over)) {\r\n this.over = 1\r\n var i = e.get('Utils'),\r\n r = e.get('Canvas')\r\n this.sorter = new i.Sorter({\r\n em: e,\r\n wmargin: 1,\r\n nested: 1,\r\n canvasRelative: 1,\r\n direction: 'a',\r\n container: r.getBody(),\r\n placer: r.getPlacerEl(),\r\n eventMoving: 'mousemove dragover',\r\n containerSel: '*',\r\n itemSel: '*',\r\n pfx: 'gjs-',\r\n onStart: function () {\r\n return e.stopDefault()\r\n },\r\n onEndMove: function (t) {\r\n e.runDefault(), e.set('dragResult', t), t && e.trigger('canvas:drop', n, t)\r\n },\r\n document: r.getFrameEl().contentDocument\r\n })\r\n var o = e.get('dragContent') || ' '\r\n this.sorter.setDropContent(o), this.sorter.startSort(), e.trigger('canvas:dragenter', n, o)\r\n }\r\n }\r\n },\r\n {\r\n key: 'handleDragOver',\r\n value: function (t) {\r\n t.preventDefault(), this.em.trigger('canvas:dragover', t)\r\n }\r\n },\r\n {\r\n key: 'handleDrop',\r\n value: function (t) {\r\n t.preventDefault()\r\n var e = t.dataTransfer,\r\n n = this.getContentByData(e).content\r\n ;(t.target.style.border = ''),\r\n n ? this.sorter.setDropContent(n) : (this.sorter.moved = 0),\r\n this.endDrop(0, t)\r\n }\r\n },\r\n {\r\n key: 'getContentByData',\r\n value: function (t) {\r\n var e = this.em,\r\n n = t.types,\r\n i = t.files || [],\r\n r = e.get('dragContent'),\r\n s = t.getData('text')\r\n if (i.length) {\r\n s = []\r\n for (var a = 0; a < i.length; a++) {\r\n var l = i[a],\r\n c = l.type.split('/')[0]\r\n 'image' == c && s.push({ type: c, file: l, attributes: { alt: l.name } })\r\n }\r\n } else if (r) s = r\r\n else if ((0, o.indexOf)(n, 'text/html') >= 0) s = t.getData('text/html').replace(/<\\/?meta[^>]*>/g, '')\r\n else if ((0, o.indexOf)(n, 'text/uri-list') >= 0)\r\n s = { type: 'link', attributes: { href: s }, content: s }\r\n else if ((0, o.indexOf)(n, 'text/json') >= 0) {\r\n var u = t.getData('text/json')\r\n u && (s = JSON.parse(u))\r\n }\r\n var h = { content: s }\r\n return e.trigger('canvas:dragdata', t, h), h\r\n }\r\n }\r\n ]),\r\n t\r\n )\r\n })()\r\n e.default = s\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n stylePrefix: 'cv-',\r\n scripts: [],\r\n styles: [],\r\n customBadgeLabel: '',\r\n notTextable: ['button', 'input[type=checkbox]', 'input[type=radio]']\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n var s = n(218)\r\n t.exports = o.default.Model.extend({\r\n defaults: { frame: '', wrapper: '', rulers: !1 },\r\n initialize: function (t) {\r\n var e = this.conf || {}\r\n this.set('frame', new s(e.frame))\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n t.exports = o.default.Model.extend({ defaults: { wrapper: '', width: '', height: '', attributes: {} } })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n ;(function (e) {\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i },\r\n s = n(2)\r\n var a = n(220),\r\n l = o.default.$\r\n t.exports = o.default.View.extend({\r\n initialize: function (t) {\r\n e.bindAll(this, 'renderBody', 'onFrameScroll', 'clearOff'),\r\n (0, s.on)(window, 'scroll resize', this.clearOff),\r\n (this.config = t.config || {}),\r\n (this.em = this.config.em || {}),\r\n (this.ppfx = this.config.pStylePrefix || ''),\r\n (this.className = this.config.stylePrefix + 'canvas'),\r\n this.listenTo(this.em, 'change:canvasOffset', this.clearOff),\r\n (this.frame = new a({ model: this.model.get('frame'), config: this.config }))\r\n },\r\n isElInViewport: function (t) {\r\n var e = (0, s.getElement)(t).getBoundingClientRect(),\r\n n = this.getFrameOffset(1),\r\n i = e.top,\r\n r = e.left\r\n return i >= 0 && r >= 0 && i <= n.height && r <= n.width\r\n },\r\n onFrameScroll: function () {\r\n var t = this.frame.el.contentDocument.body\r\n ;(this.toolsEl.style.top = '-' + t.scrollTop + 'px'),\r\n (this.toolsEl.style.left = '-' + t.scrollLeft + 'px'),\r\n this.em.trigger('canvasScroll')\r\n },\r\n renderScripts: function () {\r\n var t = this.frame,\r\n e = this\r\n t.el.onload = function () {\r\n !(function n (i) {\r\n if (i.length > 0) {\r\n var r = document.createElement('script')\r\n ;(r.type = 'text/javascript'),\r\n (r.src = i.shift()),\r\n (r.onerror = r.onload = n.bind(null, i)),\r\n t.el.contentDocument.head.appendChild(r)\r\n } else e.renderBody()\r\n })(e.config.scripts.slice(0))\r\n }\r\n },\r\n renderBody: function () {\r\n var t = this.config,\r\n e = (this.model, this.model.get('frame').get('wrapper')),\r\n n = t.em\r\n if (e) {\r\n var i = n.get('Canvas'),\r\n r = this.ppfx,\r\n o = l(i.getBody()),\r\n s = l(i.getDocument().head),\r\n a = n.get('CssComposer'),\r\n c = n.get('Config'),\r\n u = ''\r\n t.styles.forEach(function (t) {\r\n u += ''\r\n })\r\n var h =\r\n '\\n ' +\r\n (n.config.baseCss || '') +\r\n '\\n\\n .' +\r\n r +\r\n 'dashed *[data-highlightable] {\\n outline: 1px dashed rgba(170,170,170,0.7);\\n outline-offset: -2px;\\n }\\n\\n .' +\r\n r +\r\n 'comp-selected {\\n outline: 3px solid #3b97e3 !important;\\n outline-offset: -3px;\\n }\\n\\n .' +\r\n r +\r\n 'comp-selected-parent {\\n outline: 2px solid #ffca6f !important\\n }\\n\\n .' +\r\n r +\r\n 'no-select {\\n user-select: none;\\n -webkit-user-select:none;\\n -moz-user-select: none;\\n }\\n\\n .' +\r\n r +\r\n 'freezed {\\n opacity: 0.5;\\n pointer-events: none;\\n }\\n\\n .' +\r\n r +\r\n 'no-pointer {\\n pointer-events: none;\\n }\\n\\n .' +\r\n r +\r\n 'plh-image {\\n background: #f5f5f5;\\n border: none;\\n height: 50px;\\n width: 50px;\\n display: block;\\n outline: 3px solid #ffca6f;\\n cursor: pointer;\\n outline-offset: -2px\\n }\\n\\n .' +\r\n r +\r\n 'grabbing {\\n cursor: grabbing;\\n cursor: -webkit-grabbing;\\n }\\n\\n ' +\r\n (c.canvasCss || '') +\r\n '\\n ' +\r\n (c.protectedCss || '') +\r\n '\\n '\r\n u && s.append(u),\r\n o.append(''),\r\n o.append(e.render()).append(a.render()),\r\n o.append(this.getJsContainer()),\r\n n.trigger('loaded'),\r\n (this.frame.el.contentWindow.onscroll = this.onFrameScroll),\r\n this.frame.udpateOffset()\r\n var d = document,\r\n f = this.frame.el.contentDocument\r\n ;[{ event: 'keydown keyup', class: 'KeyboardEvent' }].forEach(function (t) {\r\n return t.event.split(' ').forEach(function (e) {\r\n f.addEventListener(e, function (e) {\r\n return d.dispatchEvent(\r\n (function (t, e) {\r\n var n = void 0\r\n try {\r\n n = new window[e](t.type, t)\r\n } catch (t) {\r\n ;(n = document.createEvent(e)).initEvent(t.type, !0, !0)\r\n }\r\n return (\r\n (n.keyCodeVal = t.keyCode),\r\n ['keyCode', 'which'].forEach(function (t) {\r\n Object.defineProperty(n, t, {\r\n get: function () {\r\n return this.keyCodeVal\r\n }\r\n })\r\n }),\r\n n\r\n )\r\n })(e, t.class)\r\n )\r\n })\r\n })\r\n })\r\n }\r\n },\r\n offset: function (t) {\r\n var e = t.getBoundingClientRect(),\r\n n = t.ownerDocument.body\r\n return { top: e.top + n.scrollTop, left: e.left + n.scrollLeft, width: e.width, height: e.height }\r\n },\r\n clearOff: function () {\r\n ;(this.frmOff = null), (this.cvsOff = null)\r\n },\r\n getFrameOffset: function () {\r\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0\r\n return (this.frmOff && !t) || (this.frmOff = this.offset(this.frame.el)), this.frmOff\r\n },\r\n getCanvasOffset: function () {\r\n return this.cvsOff || (this.cvsOff = this.offset(this.el)), this.cvsOff\r\n },\r\n getElementPos: function (t, e) {\r\n var n = e || {},\r\n i = this.getFrameOffset(),\r\n r = this.getCanvasOffset(),\r\n o = this.offset(t),\r\n s = n.avoidFrameOffset ? 0 : i.top,\r\n a = n.avoidFrameOffset ? 0 : i.left\r\n return {\r\n top: o.top + s - r.top,\r\n left: o.left + a - r.left,\r\n height: t.offsetHeight || t.clientHeight,\r\n width: t.offsetWidth || t.clientWidth\r\n }\r\n },\r\n getPosition: function () {\r\n var t = this.frame.el.contentDocument\r\n if (t) {\r\n var e = t.body,\r\n n = this.getFrameOffset(),\r\n i = this.getCanvasOffset()\r\n return { top: n.top + e.scrollTop - i.top, left: n.left + e.scrollLeft - i.left }\r\n }\r\n },\r\n updateScript: function (t) {\r\n t.scriptContainer ||\r\n ((t.scriptContainer = l('
')), this.getJsContainer().appendChild(t.scriptContainer.get(0)))\r\n var e = t.model,\r\n n = e.getId()\r\n ;(t.el.id = n), t.scriptContainer.html('')\r\n var i = document.createElement('script')\r\n ;(i.innerHTML =\r\n \"\\n setTimeout(function() {\\n var item = document.getElementById('\" +\r\n n +\r\n \"');\\n if (!item) return;\\n (function(){\\n \" +\r\n e.getScriptString() +\r\n ';\\n }.bind(item))()\\n }, 1);'),\r\n setTimeout(function () {\r\n return t.scriptContainer.get(0).appendChild(i)\r\n }, 0)\r\n },\r\n getJsContainer: function () {\r\n return (\r\n this.jsContainer || (this.jsContainer = l('
').get(0)),\r\n this.jsContainer\r\n )\r\n },\r\n render: function () {\r\n if (\r\n ((this.wrapper = this.model.get('wrapper')), this.wrapper && 'function' == typeof this.wrapper.render)\r\n ) {\r\n this.model.get('frame').set('wrapper', this.wrapper), this.$el.append(this.frame.render().el)\r\n var t = this.frame\r\n 0 === this.config.scripts.length ? (t.el.onload = this.renderBody) : this.renderScripts()\r\n }\r\n var e = this.ppfx\r\n this.$el.append(\r\n '\\n
\\n \\n \\n
\\n \\n
\\n \\n \\n \\n \\n \\n
\\n '\r\n )\r\n var n = this.el,\r\n i = n.querySelector('#' + e + 'tools')\r\n return (\r\n (this.hlEl = n.querySelector('.' + e + 'highlighter')),\r\n (this.badgeEl = n.querySelector('.' + e + 'badge')),\r\n (this.placerEl = n.querySelector('.' + e + 'placeholder')),\r\n (this.ghostEl = n.querySelector('.' + e + 'ghost')),\r\n (this.toolbarEl = n.querySelector('.' + e + 'toolbar')),\r\n (this.resizerEl = n.querySelector('.' + e + 'resizer')),\r\n (this.offsetEl = n.querySelector('.' + e + 'offset-v')),\r\n (this.fixedOffsetEl = n.querySelector('.' + e + 'offset-fixed-v')),\r\n (this.toolsEl = i),\r\n (this.el.className = this.className),\r\n this\r\n )\r\n }\r\n })\r\n }.call(this, n(1)))\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1),\r\n r = 'transitionend oTransitionEnd transitionend webkitTransitionEnd'\r\n t.exports = n(0).View.extend({\r\n tagName: 'iframe',\r\n attributes: { allowfullscreen: 'allowfullscreen' },\r\n initialize: function (t) {\r\n ;(0, i.bindAll)(this, 'udpateOffset'),\r\n (this.config = t.config || {}),\r\n (this.ppfx = this.config.pStylePrefix || ''),\r\n (this.em = this.config.em),\r\n this.listenTo(this.em, 'change:device', this.updateDim)\r\n },\r\n updateDim: function (t) {\r\n var e = this.em,\r\n n = e.getDeviceModel(),\r\n i = this.el.style,\r\n o = i.width || '',\r\n s = i.height || '',\r\n a = n ? n.get('width') : '',\r\n l = n ? n.get('height') : '',\r\n c = o == a && s == l\r\n ;(i.width = a),\r\n (i.height = l),\r\n this.udpateOffset(),\r\n e.stopDefault({ preserveSelected: 1 }),\r\n c ? this.udpateOffset() : this.$el.on(r, this.udpateOffset)\r\n },\r\n udpateOffset: function () {\r\n var t = this.em,\r\n e = t.get('Canvas').getOffset()\r\n t.set('canvasOffset', e), t.runDefault({ preserveSelected: 1 }), this.$el.off(r, this.udpateOffset)\r\n },\r\n getBody: function () {\r\n this.$el.contents().find('body')\r\n },\r\n getWrapper: function () {\r\n return this.$el.contents().find('body > div')\r\n },\r\n render: function () {\r\n return this.$el.attr({ class: this.ppfx + 'frame' }), this\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(1),\r\n o = n(27),\r\n s = (i = o) && i.__esModule ? i : { default: i }\r\n t.exports = function () {\r\n var t = void 0,\r\n e = {},\r\n i = {},\r\n o = {},\r\n a = n(222),\r\n l = {}\r\n return {\r\n CommandAbstract: s.default,\r\n name: 'Commands',\r\n init: function (i) {\r\n for (var r in ((e = i || {}), a)) r in e || (e[r] = a[r])\r\n t = e.em\r\n var s = e.pStylePrefix\r\n for (var l in (s && (e.stylePrefix = s + e.stylePrefix), e.defaults)) {\r\n var c = e.defaults[l]\r\n c.id && this.add(c.id, c)\r\n }\r\n var u = n(28)\r\n return (\r\n (o['select-comp'] = n(11)),\r\n (o['create-comp'] = n(12)),\r\n (o['delete-comp'] = n(29)),\r\n (o['image-comp'] = n(30)),\r\n (o['move-comp'] = n(31)),\r\n (o['text-comp'] = n(32)),\r\n (o['insert-custom'] = n(20)),\r\n (o['export-template'] = u),\r\n (o['sw-visibility'] = n(33)),\r\n (o['open-layers'] = n(34)),\r\n (o['open-sm'] = n(35)),\r\n (o['open-tm'] = n(36)),\r\n (o['open-blocks'] = n(37)),\r\n (o['open-assets'] = n(38)),\r\n (o['show-offset'] = n(39)),\r\n (o['select-parent'] = n(40)),\r\n (o.fullscreen = n(41)),\r\n (o.preview = n(42)),\r\n (o.resize = n(43)),\r\n (o.drag = n(44)),\r\n (o['tlb-delete'] = {\r\n run: function (t) {\r\n return t.runCommand('core:component-delete')\r\n }\r\n }),\r\n (o['tlb-clone'] = {\r\n run: function (t) {\r\n t.runCommand('core:copy'), t.runCommand('core:paste')\r\n }\r\n }),\r\n (o['tlb-move'] = {\r\n run: function (t, e, n) {\r\n var i = void 0,\r\n r = t.getModel(),\r\n o = n && n.event,\r\n s = t.getSelected(),\r\n a = [].concat(\r\n (function (t) {\r\n if (Array.isArray(t)) {\r\n for (var e = 0, n = Array(t.length); e < t.length; e++) n[e] = t[e]\r\n return n\r\n }\r\n return Array.from(t)\r\n })(t.getSelectedAll())\r\n ),\r\n l = t.Canvas.getToolbarEl().style,\r\n c = o && 'dragstart' == o.type,\r\n u = { preserveSelected: 1 },\r\n h = function () {\r\n ;(l.display = 'none'), r.stopDefault(u)\r\n }\r\n if (s && s.get('draggable')) {\r\n c\r\n ? setTimeout(function () {\r\n return h\r\n }, 0)\r\n : h()\r\n var d = function (e, n) {\r\n r.runDefault(u),\r\n a.forEach(function (t) {\r\n return t.set('status', 'selected')\r\n }),\r\n t.select(a),\r\n s.emitUpdate(),\r\n i && i.blur()\r\n }\r\n if (r.get('designerMode'))\r\n i = editor.runCommand('drag', {\r\n el: s.view.el,\r\n options: {\r\n event: o,\r\n onStart: function (t, e) {\r\n console.log('start mouse pos ', e.start), console.log('el rect ', e.elRect)\r\n var n = e.el\r\n ;(n.style.position = 'absolute'), (n.style.margin = 0)\r\n },\r\n onDrag: function (t, e) {\r\n console.log('Delta ', e.delta), console.log('Current ', e.current)\r\n },\r\n onEnd: d\r\n }\r\n })\r\n else {\r\n c && o.dataTransfer.setDragImage(s.view.el, 0, 0)\r\n var f = t.Commands.get('move-comp')\r\n ;(f.onEndMoveFromModel = d), f.initSorterFromModels(a)\r\n }\r\n a.forEach(function (t) {\r\n return t.set('status', 'freezed-selected')\r\n })\r\n } else console.warn('The element is not draggable')\r\n }\r\n }),\r\n (o['core:undo'] = function (t) {\r\n return t.UndoManager.undo()\r\n }),\r\n (o['core:redo'] = function (t) {\r\n return t.UndoManager.redo()\r\n }),\r\n [\r\n ['copy', 'CopyComponent'],\r\n ['paste', 'PasteComponent'],\r\n ['component-next', 'ComponentNext'],\r\n ['component-prev', 'ComponentPrev'],\r\n ['component-enter', 'ComponentEnter'],\r\n ['component-exit', 'ComponentExit'],\r\n ['canvas-clear', 'CanvasClear'],\r\n ['component-delete', 'ComponentDelete'],\r\n ['component-style-clear', 'ComponentStyleClear']\r\n ].forEach(function (t) {\r\n return (o['core:' + t[0]] = n(227)('./' + t[1]).run)\r\n }),\r\n e.em && (e.model = e.em.get('Canvas')),\r\n this.loadDefaultCommands(),\r\n this\r\n )\r\n },\r\n add: function (t, e) {\r\n return (\r\n (0, r.isFunction)(e) && (e = { run: e }),\r\n e.stop || (e.noStop = 1),\r\n delete e.initialize,\r\n (e.id = t),\r\n (i[t] = s.default.extend(e)),\r\n this\r\n )\r\n },\r\n get: function (t) {\r\n var n = i[t]\r\n return 'function' == typeof n && ((n = new n(e)), (i[t] = n)), n\r\n },\r\n has: function (t) {\r\n return !!i[t]\r\n },\r\n getAll: function () {\r\n return i\r\n },\r\n run: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n return this.runCommand(this.get(t), e)\r\n },\r\n stop: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}\r\n return this.stopCommand(this.get(t), e)\r\n },\r\n isActive: function (t) {\r\n return this.getActive().hasOwnProperty(t)\r\n },\r\n getActive: function () {\r\n return l\r\n },\r\n loadDefaultCommands: function () {\r\n for (var t in o) this.add(t, o[t])\r\n return this\r\n },\r\n runCommand: function (e) {\r\n var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n i = void 0\r\n if (e && e.run) {\r\n var r = e.id,\r\n o = t.get('Editor')\r\n ;(i = e.callRun(o, n)), r && e.stop && !e.noStop && (l[r] = i)\r\n }\r\n return i\r\n },\r\n stopCommand: function (e) {\r\n var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n i = void 0\r\n if (e && e.run) {\r\n var r = e.id,\r\n o = t.get('Editor')\r\n ;(i = e.callStop(o, n)), r && delete l[r]\r\n }\r\n return i\r\n },\r\n create: function (t) {\r\n return new (s.default.extend(t))(e)\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = {\r\n ESCAPE_KEY: 27,\r\n stylePrefix: 'com-',\r\n defaults: [],\r\n em: null,\r\n firstCentered: !0,\r\n newFixedH: !1,\r\n minComponentH: 50,\r\n minComponentW: 50\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n n(0)\r\n var i = n(71),\r\n r = n(224)\r\n t.exports = i.extend({\r\n itemView: r,\r\n initialize: function (t) {\r\n ;(this.config = { editor: t.editor || '' }), this.listenTo(this.collection, 'reset', this.render)\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0)\r\n t.exports = i.View.extend({\r\n events: function () {\r\n return this.model.get('events') || { mousedown: 'handleClick' }\r\n },\r\n attributes: function () {\r\n return this.model.get('attributes')\r\n },\r\n initialize: function (t) {\r\n this.editor = t.config.editor\r\n },\r\n handleClick: function (t) {\r\n t.preventDefault(), t.stopPropagation(), this.execCommand(t)\r\n },\r\n execCommand: function (t) {\r\n var e = { event: t },\r\n n = this.model.get('command'),\r\n i = this.editor\r\n 'function' == typeof n && n(i, null, e), 'string' == typeof n && i.runCommand(n, e)\r\n },\r\n render: function () {\r\n var t = this.editor,\r\n e = this.$el,\r\n n = this.model,\r\n i = n.get('id'),\r\n r = n.get('label'),\r\n o = t.getConfig('stylePrefix')\r\n return e.addClass(o + 'toolbar-item'), i && e.addClass(o + 'toolbar-item__' + i), r && e.append(r), this\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0),\r\n r = n(226)\r\n t.exports = i.Collection.extend({ model: r })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(0)\r\n t.exports = i.Model.extend({ defaults: { command: '', attributes: {} } })\r\n },\r\n function (t, e, n) {\r\n var i = {\r\n './CanvasClear': 77,\r\n './CanvasClear.js': 77,\r\n './CommandAbstract': 27,\r\n './CommandAbstract.js': 27,\r\n './ComponentDelete': 78,\r\n './ComponentDelete.js': 78,\r\n './ComponentEnter': 79,\r\n './ComponentEnter.js': 79,\r\n './ComponentExit': 80,\r\n './ComponentExit.js': 80,\r\n './ComponentNext': 81,\r\n './ComponentNext.js': 81,\r\n './ComponentPrev': 82,\r\n './ComponentPrev.js': 82,\r\n './ComponentStyleClear': 83,\r\n './ComponentStyleClear.js': 83,\r\n './CopyComponent': 84,\r\n './CopyComponent.js': 84,\r\n './CreateComponent': 12,\r\n './CreateComponent.js': 12,\r\n './DeleteComponent': 29,\r\n './DeleteComponent.js': 29,\r\n './Drag': 44,\r\n './Drag.js': 44,\r\n './ExportTemplate': 28,\r\n './ExportTemplate.js': 28,\r\n './Fullscreen': 41,\r\n './Fullscreen.js': 41,\r\n './ImageComponent': 30,\r\n './ImageComponent.js': 30,\r\n './InsertCustom': 20,\r\n './InsertCustom.js': 20,\r\n './MoveComponent': 31,\r\n './MoveComponent.js': 31,\r\n './OpenAssets': 38,\r\n './OpenAssets.js': 38,\r\n './OpenBlocks': 37,\r\n './OpenBlocks.js': 37,\r\n './OpenLayers': 34,\r\n './OpenLayers.js': 34,\r\n './OpenStyleManager': 35,\r\n './OpenStyleManager.js': 35,\r\n './OpenTraitManager': 36,\r\n './OpenTraitManager.js': 36,\r\n './PasteComponent': 85,\r\n './PasteComponent.js': 85,\r\n './Preview': 42,\r\n './Preview.js': 42,\r\n './Resize': 43,\r\n './Resize.js': 43,\r\n './SelectComponent': 11,\r\n './SelectComponent.js': 11,\r\n './SelectParent': 40,\r\n './SelectParent.js': 40,\r\n './SelectPosition': 19,\r\n './SelectPosition.js': 19,\r\n './ShowOffset': 39,\r\n './ShowOffset.js': 39,\r\n './SwitchVisibility': 33,\r\n './SwitchVisibility.js': 33,\r\n './TextComponent': 32,\r\n './TextComponent.js': 32\r\n }\r\n function r (t) {\r\n var e = o(t)\r\n return n(e)\r\n }\r\n function o (t) {\r\n var e = i[t]\r\n if (!(e + 1)) {\r\n var n = new Error(\"Cannot find module '\" + t + \"'\")\r\n throw ((n.code = 'MODULE_NOT_FOUND'), n)\r\n }\r\n return e\r\n }\r\n ;(r.keys = function () {\r\n return Object.keys(i)\r\n }),\r\n (r.resolve = o),\r\n (t.exports = r),\r\n (r.id = 227)\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1)\r\n t.exports = function () {\r\n var t,\r\n e,\r\n r,\r\n o = {},\r\n s = n(229),\r\n a = n(230),\r\n l = n(232),\r\n c = n(233),\r\n u = []\r\n return {\r\n name: 'BlockManager',\r\n init: function (n) {\r\n var i = (o = n || {}).em\r\n for (var h in s) h in o || (o[h] = s[h])\r\n return (\r\n (t = new a([])),\r\n (e = new a([])),\r\n (u = new l()),\r\n (r = new c({ collection: e, categories: u }, o)),\r\n t.listenTo(t, 'add', function (t) {\r\n e.add(t), i && i.trigger('block:add', t)\r\n }),\r\n t.listenTo(t, 'remove', function (t) {\r\n e.remove(t), i && i.trigger('block:remove', t)\r\n }),\r\n t.listenTo(t, 'reset', function (t) {\r\n e.reset(t.models)\r\n }),\r\n this\r\n )\r\n },\r\n getConfig: function () {\r\n return o\r\n },\r\n onLoad: function () {\r\n var t = this.getAll()\r\n !t.length && t.reset(o.blocks)\r\n },\r\n postRender: function () {\r\n var t = this.getConfig().appendTo\r\n t && ((0, i.isElement)(t) ? t : document.querySelector(t)).appendChild(this.render())\r\n },\r\n add: function (e, n) {\r\n var i = n || {}\r\n return (i.id = e), t.add(i)\r\n },\r\n get: function (e) {\r\n return t.get(e)\r\n },\r\n getAll: function () {\r\n return t\r\n },\r\n getAllVisible: function () {\r\n return e\r\n },\r\n remove: function (e) {\r\n return t.remove(e)\r\n },\r\n getCategories: function () {\r\n return u\r\n },\r\n getContainer: function () {\r\n return r.el\r\n },\r\n render: function (t) {\r\n var e = t || this.getAll().models\r\n return r.rendered || (r.render(), (r.rendered = 1)), r.collection.reset(e), this.getContainer()\r\n }\r\n }\r\n }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n t.exports = { appendTo: '', blocks: [] }\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n var s = n(231)\r\n t.exports = o.default.Collection.extend({ model: s })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n var s = n(86)\r\n t.exports = o.default.Model.extend({\r\n defaults: { activate: 0, select: 0, resetId: 0, label: '', content: '', category: '', attributes: {} },\r\n initialize: function () {\r\n arguments.length > 0 && void 0 !== arguments[0] && arguments[0]\r\n var t = this.get('category')\r\n if (t && 'string' == typeof t) new s({ id: t, label: t })\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i }\r\n t.exports = o.default.Collection.extend({ model: n(86) })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = n(1),\r\n r = n(234),\r\n o = n(235)\r\n t.exports = n(0).View.extend({\r\n initialize: function (t, e) {\r\n ;(0, i.bindAll)(this, 'getSorter', 'onDrag', 'onDrop'),\r\n (this.config = e || {}),\r\n (this.categories = t.categories || ''),\r\n (this.renderedCategories = [])\r\n var n = this.config.pStylePrefix || ''\r\n ;(this.ppfx = n),\r\n (this.noCatClass = n + 'blocks-no-cat'),\r\n (this.blockContClass = n + 'blocks-c'),\r\n (this.catsClass = n + 'block-categories')\r\n var r = this.collection\r\n this.listenTo(r, 'add', this.addTo),\r\n this.listenTo(r, 'reset', this.render),\r\n (this.em = this.config.em),\r\n (this.tac = 'test-tac'),\r\n (this.grabbingCls = this.ppfx + 'grabbing'),\r\n this.em && ((this.config.getSorter = this.getSorter), (this.canvas = this.em.get('Canvas')))\r\n },\r\n getSorter: function () {\r\n if (this.em) {\r\n if (!this.sorter) {\r\n var t = this.em.get('Utils'),\r\n e = this.canvas\r\n this.sorter = new t.Sorter({\r\n container: e.getBody(),\r\n placer: e.getPlacerEl(),\r\n containerSel: '*',\r\n itemSel: '*',\r\n pfx: this.ppfx,\r\n onStart: this.onDrag,\r\n onEndMove: this.onDrop,\r\n onMove: this.onMove,\r\n document: e.getFrameEl().contentDocument,\r\n direction: 'a',\r\n wmargin: 1,\r\n nested: 1,\r\n em: this.em,\r\n canvasRelative: 1\r\n })\r\n }\r\n return this.sorter\r\n }\r\n },\r\n onDrag: function (t) {\r\n this.em.stopDefault(), this.em.trigger('block:drag:start', t)\r\n },\r\n onMove: function (t) {\r\n this.em.trigger('block:drag:move', t)\r\n },\r\n onDrop: function (t) {\r\n var e = this.em\r\n e.runDefault(),\r\n t &&\r\n t.get &&\r\n (t.get('activeOnRender') && (t.trigger('active'), t.set('activeOnRender', 0)),\r\n e.trigger('block:drag:stop', t))\r\n },\r\n addTo: function (t) {\r\n this.add(t)\r\n },\r\n add: function (t, e) {\r\n var n = e || null,\r\n s = new r({ model: t, attributes: t.get('attributes') }, this.config).render().el,\r\n a = t.get('category')\r\n if (a && this.categories) {\r\n ;(0, i.isString)(a) ? (a = { id: a, label: a }) : (0, i.isObject)(a) && !a.id && (a.id = a.label)\r\n var l = this.categories.add(a),\r\n c = l.get('id'),\r\n u = this.renderedCategories[c],\r\n h = this.getCategoriesEl()\r\n return (\r\n t.set('category', l),\r\n !u &&\r\n h &&\r\n ((u = new o({ model: l }, this.config).render()),\r\n (this.renderedCategories[c] = u),\r\n h.appendChild(u.el)),\r\n void (u && u.append(s))\r\n )\r\n }\r\n n ? n.appendChild(s) : this.append(s)\r\n },\r\n getCategoriesEl: function () {\r\n return this.catsEl || (this.catsEl = this.el.querySelector('.' + this.catsClass)), this.catsEl\r\n },\r\n getBlocksEl: function () {\r\n return (\r\n this.blocksEl ||\r\n (this.blocksEl = this.el.querySelector('.' + this.noCatClass + ' .' + this.blockContClass)),\r\n this.blocksEl\r\n )\r\n },\r\n append: function (t) {\r\n var e = this.getBlocksEl()\r\n e && e.appendChild(t)\r\n },\r\n render: function () {\r\n var t = this,\r\n e = this.ppfx,\r\n n = document.createDocumentFragment()\r\n ;(this.catsEl = null),\r\n (this.blocksEl = null),\r\n (this.renderedCategories = []),\r\n (this.el.innerHTML =\r\n '\\n \\n
\\n \\n
\\n '),\r\n this.collection.each(function (e) {\r\n return t.add(e, n)\r\n }),\r\n this.append(n)\r\n var i = this.blockContClass + 's ' + e + 'one-bg ' + e + 'two-color'\r\n return this.$el.addClass(i), this\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i,\r\n r = n(0),\r\n o = (i = r) && i.__esModule ? i : { default: i },\r\n s = n(1),\r\n a = n(2)\r\n t.exports = o.default.View.extend({\r\n events: { mousedown: 'startDrag', dragstart: 'handleDragStart', drag: 'handleDrag', dragend: 'handleDragEnd' },\r\n initialize: function (t) {\r\n var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\r\n n = this.model\r\n ;(this.em = e.em),\r\n (this.config = e),\r\n (this.endDrag = this.endDrag.bind(this)),\r\n (this.ppfx = e.pStylePrefix || ''),\r\n this.listenTo(n, 'destroy remove', this.remove),\r\n this.listenTo(n, 'change', this.render)\r\n },\r\n startDrag: function (t) {\r\n var e = this.config\r\n if (0 === t.button && e.getSorter && !this.el.draggable) {\r\n e.em.refreshCanvas()\r\n var n = e.getSorter()\r\n n.setDragHelper(this.el, t),\r\n n.setDropContent(this.model.get('content')),\r\n n.startSort(this.el),\r\n (0, a.on)(document, 'mouseup', this.endDrag)\r\n }\r\n },\r\n handleDragStart: function (t) {\r\n var e = this.em,\r\n n = this.model,\r\n i = n.get('content'),\r\n r = (0, s.isObject)(i),\r\n o = r ? JSON.stringify(i) : i\r\n t.dataTransfer.setData('text', o), e.set('dragContent', i), e.trigger('block:drag:start', n, t)\r\n },\r\n handleDrag: function (t) {\r\n this.em.trigger('block:drag', this.model, t)\r\n },\r\n handleDragEnd: function () {\r\n var t = this.em,\r\n e = this.model,\r\n n = t.get('dragResult')\r\n if (n) {\r\n var i = n.get && n.get('activeOnRender')\r\n ;(e.get('activate') || i) && (n.trigger('active'), n.set('activeOnRender', 0)),\r\n e.get('select') && t.setSelected(n),\r\n e.get('resetId') &&\r\n n.onAll(function (t) {\r\n return t.resetId()\r\n })\r\n }\r\n t.set({ dragResult: null, dragContent: null }), t.trigger('block:drag:stop', n, e)\r\n },\r\n endDrag: function (t) {\r\n ;(0, a.off)(document, 'mouseup', this.endDrag)\r\n var e = this.config.getSorter()\r\n ;(e.moved = 0), e.endMove()\r\n },\r\n render: function () {\r\n var t = this.el,\r\n e = this.ppfx,\r\n n = e + 'block',\r\n i = this.model.get('label')\r\n return (\r\n (t.className += ' ' + n + ' ' + e + 'one-bg ' + e + 'four-color-h'),\r\n (t.innerHTML = '
' + i + '
'),\r\n (t.title = t.textContent.trim()),\r\n (0, a.hasDnd)(this.em) && t.setAttribute('draggable', !0),\r\n this\r\n )\r\n }\r\n })\r\n },\r\n function (t, e, n) {\r\n 'use strict'\r\n var i = o(n(1)),\r\n r = o(n(0))\r\n function o (t) {\r\n return t && t.__esModule ? t : { default: t }\r\n }\r\n t.exports = r.default.View.extend({\r\n template: i.default.template(\r\n '\\n
'\r\n }\r\n\r\n return html\r\n }\r\n\r\n // Remove all Events in the .conversation namespace for this page.\r\n $(window).off('.conversation')\r\n\r\n // On user Typing\r\n $(window).on('$trudesk:chat:typing.conversation', function (event, data) {\r\n var convoListItem = $('#convo-list').find('li[data-conversation-id=\"' + data.cid + '\"]')\r\n if (convoListItem.length > 0) {\r\n $recentMessages[data.cid] = convoListItem.find('.message-subject').text()\r\n convoListItem.find('.message-subject').text(data.fromUser.fullname + ' is typing...')\r\n }\r\n })\r\n\r\n $(window).on('$trudesk:chat:stoptyping.conversation', function (event, data) {\r\n var convoListItem = $('#convo-list').find('li[data-conversation-id=\"' + data.cid + '\"]')\r\n if (convoListItem.length > 0) {\r\n convoListItem.find('.message-subject').text($recentMessages[data.cid])\r\n }\r\n })\r\n\r\n // On Chat Message\r\n $(window).on('$trudesk:chat:message.conversation', function (event, data) {\r\n var message = {\r\n _id: data.messageId,\r\n conversation: data.conversation,\r\n body: data.message,\r\n owner: data.fromUser\r\n }\r\n\r\n var html = buildMessageHTML(message)\r\n var messageWrapper = $('#message-content[data-conversation-id=\"' + message.conversation + '\"]')\r\n if (messageWrapper.length > 0) {\r\n messageWrapper.find('#messages').append(html)\r\n }\r\n\r\n var convoListItem = $('li[data-conversation-id=\"' + data.conversation + '\"]')\r\n if (convoListItem.length > 0) {\r\n convoListItem.attr('data-updatedAt', new Date())\r\n var ul = convoListItem.parent('ul')\r\n var li = ul.children('li')\r\n li.detach().sort(function (a, b) {\r\n return new Date($(a).attr('data-updatedAt')) < new Date($(b).attr('data-updatedAt'))\r\n })\r\n\r\n ul.append(li)\r\n\r\n var fromName = message.owner.fullname\r\n if (message.owner._id.toString() === $loggedInAccountId) {\r\n fromName = 'You'\r\n }\r\n\r\n convoListItem.find('.message-subject').text(fromName + ': ' + message.body)\r\n $recentMessages[message.conversation] = fromName + ': ' + message.body\r\n var timezone = helpers.getTimezone()\r\n convoListItem.find('.message-date').text(\r\n moment\r\n .utc()\r\n .tz(timezone)\r\n .calendar()\r\n )\r\n } else {\r\n var convoUL = $('#convo-list > ul.message-items')\r\n if (convoUL.length > 0) {\r\n var partner = message.owner\r\n if (message.owner._id.toString() === $loggedInAccountId.toString()) {\r\n partner = data.toUser\r\n }\r\n var newLI = buildConversationListItem({\r\n _id: message.conversation,\r\n partner: partner,\r\n updatedAt: new Date(),\r\n recentMessage: message.owner.fullname + ': ' + message.body\r\n })\r\n\r\n var $injector = angular.injector(['ng', 'trudesk'])\r\n $injector.invoke([\r\n '$compile',\r\n '$rootScope',\r\n function ($compile, $rootScope) {\r\n var $scope = convoUL.prepend(newLI).scope()\r\n $compile(convoUL)($scope || $rootScope)\r\n $rootScope.$digest()\r\n }\r\n ])\r\n }\r\n }\r\n\r\n UIKit.$html.trigger('changed.uk.dom')\r\n helpers.scrollToBottom($messageScroller)\r\n })\r\n\r\n function buildConversationListItem (data) {\r\n var html = ''\r\n\r\n html +=\r\n '
'\r\n html += '
'\r\n var imageUrl = 'defaultProfile.jpg'\r\n if (data.partner.image) {\r\n imageUrl = data.partner.image\r\n }\r\n html +=\r\n ''\r\n html += ''\r\n html += '
'\r\n html += '
'\r\n html += '' + data.partner.fullname + ''\r\n html += '' + moment(data.updatedAt).calendar() + ''\r\n html += '' + data.recentMessage + ''\r\n html += '
\");\r\n\r\n stepItem._enableAria(options.enableAllSteps || state.currentIndex > index);\r\n\r\n if (state.currentIndex > index)\r\n {\r\n stepItem.addClass(\"done\");\r\n }\r\n\r\n header._id(uniqueHeaderId).attr(\"tabindex\", \"-1\").addClass(\"title\");\r\n\r\n if (index === 0)\r\n {\r\n stepCollection.prepend(stepItem);\r\n }\r\n else\r\n {\r\n stepCollection.find(\"li\").eq(index - 1).after(stepItem);\r\n }\r\n\r\n // Set the \"first\" class to the new first step button\r\n if (index === 0)\r\n {\r\n stepCollection.find(\"li\").removeClass(\"first\").eq(index).addClass(\"first\");\r\n }\r\n\r\n // Set the \"last\" class to the new last step button\r\n if (index === (state.stepCount - 1))\r\n {\r\n stepCollection.find(\"li\").removeClass(\"last\").eq(index).addClass(\"last\");\r\n }\r\n\r\n // Register click event\r\n stepItem.children(\"a\").bind(\"click\" + getEventNamespace(wizard), stepClickHandler);\r\n }\r\n\r\n /**\r\n * Saves the current state to a cookie.\r\n *\r\n * @static\r\n * @private\r\n * @method saveCurrentStateToCookie\r\n * @param wizard {Object} A jQuery wizard object\r\n * @param options {Object} Settings of the current wizard\r\n * @param state {Object} The state container of the current wizard\r\n */\r\n function saveCurrentStateToCookie(wizard, options, state)\r\n {\r\n if (options.saveState && $.cookie)\r\n {\r\n $.cookie(_cookiePrefix + getUniqueId(wizard), state.currentIndex);\r\n }\r\n }\r\n\r\n function startTransitionEffect(wizard, options, state, index, oldIndex, doneCallback)\r\n {\r\n var stepContents = wizard.find(\".content > .body\"),\r\n effect = getValidEnumValue(transitionEffect, options.transitionEffect),\r\n effectSpeed = options.transitionEffectSpeed,\r\n newStep = stepContents.eq(index),\r\n currentStep = stepContents.eq(oldIndex);\r\n\r\n switch (effect)\r\n {\r\n case transitionEffect.fade:\r\n case transitionEffect.slide:\r\n var hide = (effect === transitionEffect.fade) ? \"fadeOut\" : \"slideUp\",\r\n show = (effect === transitionEffect.fade) ? \"fadeIn\" : \"slideDown\";\r\n\r\n state.transitionElement = newStep;\r\n currentStep[hide](effectSpeed, function ()\r\n {\r\n var wizard = $(this)._showAria(false).parent().parent(),\r\n state = getState(wizard);\r\n\r\n if (state.transitionElement)\r\n {\r\n state.transitionElement[show](effectSpeed, function ()\r\n {\r\n $(this)._showAria();\r\n }).promise().done(doneCallback);\r\n state.transitionElement = null;\r\n }\r\n });\r\n break;\r\n\r\n case transitionEffect.slideLeft:\r\n var outerWidth = currentStep.outerWidth(true),\r\n posFadeOut = (index > oldIndex) ? -(outerWidth) : outerWidth,\r\n posFadeIn = (index > oldIndex) ? outerWidth : -(outerWidth);\r\n\r\n $.when(currentStep.animate({ left: posFadeOut }, effectSpeed,\r\n function () { $(this)._showAria(false); }),\r\n newStep.css(\"left\", posFadeIn + \"px\")._showAria()\r\n .animate({ left: 0 }, effectSpeed)).done(doneCallback);\r\n break;\r\n\r\n default:\r\n $.when(currentStep._showAria(false), newStep._showAria())\r\n .done(doneCallback);\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Fires when a step click happens.\r\n *\r\n * @static\r\n * @private\r\n * @event click\r\n * @param event {Object} An event object\r\n */\r\n function stepClickHandler(event)\r\n {\r\n event.preventDefault();\r\n\r\n var anchor = $(this),\r\n wizard = anchor.parent().parent().parent().parent(),\r\n options = getOptions(wizard),\r\n state = getState(wizard),\r\n oldIndex = state.currentIndex;\r\n\r\n if (anchor.parent().is(\":not(.disabled):not(.current)\"))\r\n {\r\n var href = anchor.attr(\"href\"),\r\n position = parseInt(href.substring(href.lastIndexOf(\"-\") + 1), 0);\r\n\r\n goToStep(wizard, options, state, position);\r\n }\r\n\r\n // If nothing has changed\r\n if (oldIndex === state.currentIndex)\r\n {\r\n getStepAnchor(wizard, oldIndex).focus();\r\n return false;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n function throwError(message)\r\n {\r\n if (arguments.length > 1)\r\n {\r\n message = message.format(Array.prototype.slice.call(arguments, 1));\r\n }\r\n\r\n throw new Error(message);\r\n }\r\n\r\n /**\r\n * Checks an argument for null or undefined and throws an error if one check applies.\r\n *\r\n * @static\r\n * @private\r\n * @method validateArgument\r\n * @param argumentName {String} The name of the given argument\r\n * @param argumentValue {Object} The argument itself\r\n */\r\n function validateArgument(argumentName, argumentValue)\r\n {\r\n if (argumentValue == null)\r\n {\r\n throwError(\"The argument '{0}' is null or undefined.\", argumentName);\r\n }\r\n }\r\n\r\n /**\r\n * Represents a jQuery wizard plugin.\r\n *\r\n * @class steps\r\n * @constructor\r\n * @param [method={}] The name of the method as `String` or an JSON object for initialization\r\n * @param [params=]* {Array} Additional arguments for a method call\r\n * @chainable\r\n **/\r\n $.fn.steps = function (method)\r\n {\r\n if ($.fn.steps[method])\r\n {\r\n return $.fn.steps[method].apply(this, Array.prototype.slice.call(arguments, 1));\r\n }\r\n else if (typeof method === \"object\" || !method)\r\n {\r\n return initialize.apply(this, arguments);\r\n }\r\n else\r\n {\r\n $.error(\"Method \" + method + \" does not exist on jQuery.steps\");\r\n }\r\n };\r\n\r\n /**\r\n * Adds a new step.\r\n *\r\n * @method add\r\n * @param step {Object} The step object to add\r\n * @chainable\r\n **/\r\n $.fn.steps.add = function (step)\r\n {\r\n var state = getState(this);\r\n return insertStep(this, getOptions(this), state, state.stepCount, step);\r\n };\r\n\r\n /**\r\n * Gets the step count.\r\n *\r\n * @method count\r\n * @return {Integer} step count\r\n * @for steps\r\n **/\r\n $.fn.steps.count = function ()\r\n {\r\n var state = getState(this);\r\n return state.stepCount;\r\n };\r\n\r\n /**\r\n * Removes the control functionality completely and transforms the current state to the initial HTML structure.\r\n *\r\n * @method destroy\r\n * @chainable\r\n **/\r\n $.fn.steps.destroy = function ()\r\n {\r\n return destroy(this, getOptions(this));\r\n };\r\n\r\n /**\r\n * Triggers the onFinishing and onFinished event.\r\n *\r\n * @method finish\r\n **/\r\n $.fn.steps.finish = function ()\r\n {\r\n finishStep(this, getState(this));\r\n };\r\n\r\n /**\r\n * Gets the current step index.\r\n *\r\n * @method getCurrentIndex\r\n * @return {Integer} The actual step index (zero-based)\r\n * @for steps\r\n **/\r\n $.fn.steps.getCurrentIndex = function ()\r\n {\r\n return getState(this).currentIndex;\r\n };\r\n\r\n /**\r\n * Gets the current step object.\r\n *\r\n * @method getCurrentStep\r\n * @return {Object} The actual step object\r\n **/\r\n $.fn.steps.getCurrentStep = function ()\r\n {\r\n return getStep(this, getState(this).currentIndex);\r\n };\r\n\r\n /**\r\n * Gets a specific step object by index.\r\n *\r\n * @method getStep\r\n * @param index {Integer} An integer that belongs to the position of a step\r\n * @return {Object} A specific step object\r\n **/\r\n $.fn.steps.getStep = function (index)\r\n {\r\n return getStep(this, index);\r\n };\r\n\r\n /**\r\n * Inserts a new step to a specific position.\r\n *\r\n * @method insert\r\n * @param index {Integer} The position (zero-based) to add\r\n * @param step {Object} The step object to add\r\n * @example\r\n * $(\"#wizard\").steps().insert(0, {\r\n * title: \"Title\",\r\n * content: \"\", // optional\r\n * contentMode: \"async\", // optional\r\n * contentUrl: \"/Content/Step/1\" // optional\r\n * });\r\n * @chainable\r\n **/\r\n $.fn.steps.insert = function (index, step)\r\n {\r\n return insertStep(this, getOptions(this), getState(this), index, step);\r\n };\r\n\r\n /**\r\n * Routes to the next step.\r\n *\r\n * @method next\r\n * @return {Boolean} Indicates whether the action executed\r\n **/\r\n $.fn.steps.next = function ()\r\n {\r\n return goToNextStep(this, getOptions(this), getState(this));\r\n };\r\n\r\n /**\r\n * Routes to the previous step.\r\n *\r\n * @method previous\r\n * @return {Boolean} Indicates whether the action executed\r\n **/\r\n $.fn.steps.previous = function ()\r\n {\r\n return goToPreviousStep(this, getOptions(this), getState(this));\r\n };\r\n\r\n /**\r\n * Removes a specific step by an given index.\r\n *\r\n * @method remove\r\n * @param index {Integer} The position (zero-based) of the step to remove\r\n * @return Indecates whether the item is removed.\r\n **/\r\n $.fn.steps.remove = function (index)\r\n {\r\n return removeStep(this, getOptions(this), getState(this), index);\r\n };\r\n\r\n /**\r\n * Sets a specific step object by index.\r\n *\r\n * @method setStep\r\n * @param index {Integer} An integer that belongs to the position of a step\r\n **/\r\n $.fn.steps.setStep = function (index)\r\n {\r\n var options = getOptions(this),\r\n state = getState(this);\r\n return goToStep(this, options, state, index);\r\n };\r\n\r\n /**\r\n * Skips an certain amount of steps.\r\n *\r\n * @method skip\r\n * @param count {Integer} The amount of steps that should be skipped\r\n * @return {Boolean} Indicates whether the action executed\r\n **/\r\n $.fn.steps.skip = function (count)\r\n {\r\n throw new Error(\"Not yet implemented!\");\r\n };\r\n\r\n /**\r\n * An enum represents the different content types of a step and their loading mechanisms.\r\n *\r\n * @class contentMode\r\n * @for steps\r\n **/\r\n var contentMode = $.fn.steps.contentMode = {\r\n /**\r\n * HTML embedded content\r\n *\r\n * @readOnly\r\n * @property html\r\n * @type Integer\r\n * @for contentMode\r\n **/\r\n html: 0,\r\n\r\n /**\r\n * IFrame embedded content\r\n *\r\n * @readOnly\r\n * @property iframe\r\n * @type Integer\r\n * @for contentMode\r\n **/\r\n iframe: 1,\r\n\r\n /**\r\n * Async embedded content\r\n *\r\n * @readOnly\r\n * @property async\r\n * @type Integer\r\n * @for contentMode\r\n **/\r\n async: 2\r\n };\r\n\r\n /**\r\n * An enum represents the orientation of the steps navigation.\r\n *\r\n * @class stepsOrientation\r\n * @for steps\r\n **/\r\n var stepsOrientation = $.fn.steps.stepsOrientation = {\r\n /**\r\n * Horizontal orientation\r\n *\r\n * @readOnly\r\n * @property horizontal\r\n * @type Integer\r\n * @for stepsOrientation\r\n **/\r\n horizontal: 0,\r\n\r\n /**\r\n * Vertical orientation\r\n *\r\n * @readOnly\r\n * @property vertical\r\n * @type Integer\r\n * @for stepsOrientation\r\n **/\r\n vertical: 1\r\n };\r\n\r\n /**\r\n * An enum that represents the various transition animations.\r\n *\r\n * @class transitionEffect\r\n * @for steps\r\n **/\r\n var transitionEffect = $.fn.steps.transitionEffect = {\r\n /**\r\n * No transition animation\r\n *\r\n * @readOnly\r\n * @property none\r\n * @type Integer\r\n * @for transitionEffect\r\n **/\r\n none: 0,\r\n\r\n /**\r\n * Fade in transition\r\n *\r\n * @readOnly\r\n * @property fade\r\n * @type Integer\r\n * @for transitionEffect\r\n **/\r\n fade: 1,\r\n\r\n /**\r\n * Slide up transition\r\n *\r\n * @readOnly\r\n * @property slide\r\n * @type Integer\r\n * @for transitionEffect\r\n **/\r\n slide: 2,\r\n\r\n /**\r\n * Slide left transition\r\n *\r\n * @readOnly\r\n * @property slideLeft\r\n * @type Integer\r\n * @for transitionEffect\r\n **/\r\n slideLeft: 3\r\n };\r\n\r\n var stepModel = $.fn.steps.stepModel = {\r\n title: \"\",\r\n content: \"\",\r\n contentUrl: \"\",\r\n contentMode: contentMode.html,\r\n contentLoaded: false\r\n };\r\n\r\n /**\r\n * An object that represents the default settings.\r\n * There are two possibities to override the sub-properties.\r\n * Either by doing it generally (global) or on initialization.\r\n *\r\n * @static\r\n * @class defaults\r\n * @for steps\r\n * @example\r\n * // Global approach\r\n * $.steps.defaults.headerTag = \"h3\";\r\n * @example\r\n * // Initialization approach\r\n * $(\"#wizard\").steps({ headerTag: \"h3\" });\r\n **/\r\n var defaults = $.fn.steps.defaults = {\r\n /**\r\n * The header tag is used to find the step button text within the declared wizard area.\r\n *\r\n * @property headerTag\r\n * @type String\r\n * @default \"h1\"\r\n * @for defaults\r\n **/\r\n headerTag: \"h1\",\r\n\r\n /**\r\n * The body tag is used to find the step content within the declared wizard area.\r\n *\r\n * @property bodyTag\r\n * @type String\r\n * @default \"div\"\r\n * @for defaults\r\n **/\r\n bodyTag: \"div\",\r\n\r\n /**\r\n * The content container tag which will be used to wrap all step contents.\r\n *\r\n * @property contentContainerTag\r\n * @type String\r\n * @default \"div\"\r\n * @for defaults\r\n **/\r\n contentContainerTag: \"div\",\r\n\r\n /**\r\n * The action container tag which will be used to wrap the pagination navigation.\r\n *\r\n * @property actionContainerTag\r\n * @type String\r\n * @default \"div\"\r\n * @for defaults\r\n **/\r\n actionContainerTag: \"div\",\r\n\r\n /**\r\n * The steps container tag which will be used to wrap the steps navigation.\r\n *\r\n * @property stepsContainerTag\r\n * @type String\r\n * @default \"div\"\r\n * @for defaults\r\n **/\r\n stepsContainerTag: \"div\",\r\n\r\n /**\r\n * The css class which will be added to the outer component wrapper.\r\n *\r\n * @property cssClass\r\n * @type String\r\n * @default \"wizard\"\r\n * @for defaults\r\n * @example\r\n *
\r\n * ...\r\n *
\r\n **/\r\n cssClass: \"wizard\",\r\n\r\n /**\r\n * The css class which will be used for floating scenarios.\r\n *\r\n * @property clearFixCssClass\r\n * @type String\r\n * @default \"clearfix\"\r\n * @for defaults\r\n **/\r\n clearFixCssClass: \"clearfix\",\r\n\r\n /**\r\n * Determines whether the steps are vertically or horizontally oriented.\r\n *\r\n * @property stepsOrientation\r\n * @type stepsOrientation\r\n * @default horizontal\r\n * @for defaults\r\n * @since 1.0.0\r\n **/\r\n stepsOrientation: stepsOrientation.horizontal,\r\n\r\n /*\r\n * Tempplates\r\n */\r\n\r\n /**\r\n * The title template which will be used to create a step button.\r\n *\r\n * @property titleTemplate\r\n * @type String\r\n * @default \"#index#. #title#\"\r\n * @for defaults\r\n **/\r\n titleTemplate: \"#index##title#\",\r\n\r\n /**\r\n * The loading template which will be used to create the loading animation.\r\n *\r\n * @property loadingTemplate\r\n * @type String\r\n * @default \" #text#\"\r\n * @for defaults\r\n **/\r\n loadingTemplate: \" #text#\",\r\n\r\n /*\r\n * Behaviour\r\n */\r\n\r\n /**\r\n * Sets the focus to the first wizard instance in order to enable the key navigation from the begining if `true`.\r\n *\r\n * @property autoFocus\r\n * @type Boolean\r\n * @default false\r\n * @for defaults\r\n * @since 0.9.4\r\n **/\r\n autoFocus: false,\r\n\r\n /**\r\n * Enables all steps from the begining if `true` (all steps are clickable).\r\n *\r\n * @property enableAllSteps\r\n * @type Boolean\r\n * @default false\r\n * @for defaults\r\n **/\r\n enableAllSteps: false,\r\n\r\n /**\r\n * Enables keyboard navigation if `true` (arrow left and arrow right).\r\n *\r\n * @property enableKeyNavigation\r\n * @type Boolean\r\n * @default true\r\n * @for defaults\r\n **/\r\n enableKeyNavigation: true,\r\n\r\n /**\r\n * Enables pagination if `true`.\r\n *\r\n * @property enablePagination\r\n * @type Boolean\r\n * @default true\r\n * @for defaults\r\n **/\r\n enablePagination: true,\r\n\r\n /**\r\n * Suppresses pagination if a form field is focused.\r\n *\r\n * @property suppressPaginationOnFocus\r\n * @type Boolean\r\n * @default true\r\n * @for defaults\r\n **/\r\n suppressPaginationOnFocus: true,\r\n\r\n /**\r\n * Enables cache for async loaded or iframe embedded content.\r\n *\r\n * @property enableContentCache\r\n * @type Boolean\r\n * @default true\r\n * @for defaults\r\n **/\r\n enableContentCache: true,\r\n\r\n /**\r\n * Shows the cancel button if enabled.\r\n *\r\n * @property enableCancelButton\r\n * @type Boolean\r\n * @default false\r\n * @for defaults\r\n **/\r\n enableCancelButton: false,\r\n\r\n /**\r\n * Shows the finish button if enabled.\r\n *\r\n * @property enableFinishButton\r\n * @type Boolean\r\n * @default true\r\n * @for defaults\r\n **/\r\n enableFinishButton: true,\r\n\r\n /**\r\n * Not yet implemented.\r\n *\r\n * @property preloadContent\r\n * @type Boolean\r\n * @default false\r\n * @for defaults\r\n **/\r\n preloadContent: false,\r\n\r\n /**\r\n * Shows the finish button always (on each step; right beside the next button) if `true`.\r\n * Otherwise the next button will be replaced by the finish button if the last step becomes active.\r\n *\r\n * @property showFinishButtonAlways\r\n * @type Boolean\r\n * @default false\r\n * @for defaults\r\n **/\r\n showFinishButtonAlways: false,\r\n\r\n /**\r\n * Prevents jumping to a previous step.\r\n *\r\n * @property forceMoveForward\r\n * @type Boolean\r\n * @default false\r\n * @for defaults\r\n **/\r\n forceMoveForward: false,\r\n\r\n /**\r\n * Saves the current state (step position) to a cookie.\r\n * By coming next time the last active step becomes activated.\r\n *\r\n * @property saveState\r\n * @type Boolean\r\n * @default false\r\n * @for defaults\r\n **/\r\n saveState: false,\r\n\r\n /**\r\n * The position to start on (zero-based).\r\n *\r\n * @property startIndex\r\n * @type Integer\r\n * @default 0\r\n * @for defaults\r\n **/\r\n startIndex: 0,\r\n\r\n /*\r\n * Animation Effect Configuration\r\n */\r\n\r\n /**\r\n * The animation effect which will be used for step transitions.\r\n *\r\n * @property transitionEffect\r\n * @type transitionEffect\r\n * @default none\r\n * @for defaults\r\n **/\r\n transitionEffect: transitionEffect.none,\r\n\r\n /**\r\n * Animation speed for step transitions (in milliseconds).\r\n *\r\n * @property transitionEffectSpeed\r\n * @type Integer\r\n * @default 200\r\n * @for defaults\r\n **/\r\n transitionEffectSpeed: 280,\r\n\r\n /*\r\n * Events\r\n */\r\n\r\n /**\r\n * Fires before the step changes and can be used to prevent step changing by returning `false`.\r\n * Very useful for form validation.\r\n *\r\n * @property onStepChanging\r\n * @type Event\r\n * @default function (event, currentIndex, newIndex) { return true; }\r\n * @for defaults\r\n **/\r\n onStepChanging: function (event, currentIndex, newIndex) { return true; },\r\n\r\n /**\r\n * Fires after the step has change.\r\n *\r\n * @property onStepChanged\r\n * @type Event\r\n * @default function (event, currentIndex, priorIndex) { }\r\n * @for defaults\r\n **/\r\n onStepChanged: function (event, currentIndex, priorIndex) { },\r\n\r\n /**\r\n * Fires after cancelation.\r\n *\r\n * @property onCanceled\r\n * @type Event\r\n * @default function (event) { }\r\n * @for defaults\r\n **/\r\n onCanceled: function (event) { },\r\n\r\n /**\r\n * Fires before finishing and can be used to prevent completion by returning `false`.\r\n * Very useful for form validation.\r\n *\r\n * @property onFinishing\r\n * @type Event\r\n * @default function (event, currentIndex) { return true; }\r\n * @for defaults\r\n **/\r\n onFinishing: function (event, currentIndex) { return true; },\r\n\r\n /**\r\n * Fires after completion.\r\n *\r\n * @property onFinished\r\n * @type Event\r\n * @default function (event, currentIndex) { }\r\n * @for defaults\r\n **/\r\n onFinished: function (event, currentIndex) { },\r\n\r\n /**\r\n * Fires after async content is loaded.\r\n *\r\n * @property onContentLoaded\r\n * @type Event\r\n * @default function (event, index) { }\r\n * @for defaults\r\n **/\r\n onContentLoaded: function (event, currentIndex) { },\r\n\r\n /**\r\n * Fires when the wizard is initialized.\r\n *\r\n * @property onInit\r\n * @type Event\r\n * @default function (event) { }\r\n * @for defaults\r\n **/\r\n onInit: function (event, currentIndex) { },\r\n\r\n /**\r\n * Contains all labels.\r\n *\r\n * @property labels\r\n * @type Object\r\n * @for defaults\r\n **/\r\n labels: {\r\n /**\r\n * Label for the cancel button.\r\n *\r\n * @property cancel\r\n * @type String\r\n * @default \"Cancel\"\r\n * @for defaults\r\n **/\r\n cancel: \"Cancel\",\r\n\r\n /**\r\n * This label is important for accessability reasons.\r\n * Indicates which step is activated.\r\n *\r\n * @property current\r\n * @type String\r\n * @default \"current step:\"\r\n * @for defaults\r\n **/\r\n current: \"current step:\",\r\n\r\n /**\r\n * This label is important for accessability reasons and describes the kind of navigation.\r\n *\r\n * @property pagination\r\n * @type String\r\n * @default \"Pagination\"\r\n * @for defaults\r\n * @since 0.9.7\r\n **/\r\n pagination: \"Pagination\",\r\n\r\n /**\r\n * Label for the finish button.\r\n *\r\n * @property finish\r\n * @type String\r\n * @default \"Finish\"\r\n * @for defaults\r\n **/\r\n finish: \"Finish\",\r\n\r\n /**\r\n * Label for the next button.\r\n *\r\n * @property next\r\n * @type String\r\n * @default \"Next\"\r\n * @for defaults\r\n **/\r\n next: \"Next \",\r\n\r\n /**\r\n * Label for the previous button.\r\n *\r\n * @property previous\r\n * @type String\r\n * @default \"Previous\"\r\n * @for defaults\r\n **/\r\n previous: \" Previous\",\r\n\r\n /**\r\n * Label for the loading animation.\r\n *\r\n * @property loading\r\n * @type String\r\n * @default \"Loading ...\"\r\n * @for defaults\r\n **/\r\n loading: \"Loading ...\"\r\n }\r\n };\r\n})(jQuery);\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ \"./src/public/js/vendor/jquery/jquery.js\")))\n\n//# sourceURL=webpack:///./src/public/js/plugins/jquery.steps.js?");
+
+/***/ }),
+
+/***/ "./src/public/js/vendor/c3/c3.js":
+/*!***************************************!*\
+ !*** ./src/public/js/vendor/c3/c3.js ***!
+ \***************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+eval("var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (window) {\r\n 'use strict';\r\n\r\n /*global define, module, exports, require */\r\n\r\n var c3 = { version: \"0.4.11-rc4\" };\r\n\r\n var c3_chart_fn,\r\n c3_chart_internal_fn,\r\n c3_chart_internal_axis_fn;\r\n\r\n function API(owner) {\r\n this.owner = owner;\r\n }\r\n\r\n function inherit(base, derived) {\r\n\r\n if (Object.create) {\r\n derived.prototype = Object.create(base.prototype);\r\n } else {\r\n var f = function f() {};\r\n f.prototype = base.prototype;\r\n derived.prototype = new f();\r\n }\r\n\r\n derived.prototype.constructor = derived;\r\n\r\n return derived;\r\n }\r\n\r\n function Chart(config) {\r\n var $$ = this.internal = new ChartInternal(this);\r\n $$.loadConfig(config);\r\n\r\n $$.beforeInit(config);\r\n $$.init();\r\n $$.afterInit(config);\r\n\r\n // bind \"this\" to nested API\r\n (function bindThis(fn, target, argThis) {\r\n Object.keys(fn).forEach(function (key) {\r\n target[key] = fn[key].bind(argThis);\r\n if (Object.keys(fn[key]).length > 0) {\r\n bindThis(fn[key], target[key], argThis);\r\n }\r\n });\r\n })(c3_chart_fn, this, this);\r\n }\r\n\r\n function ChartInternal(api) {\r\n var $$ = this;\r\n $$.d3 = window.d3 ? window.d3 : true ? __webpack_require__(/*! d3 */ \"./src/public/js/vendor/d3/d3.min.js\") : undefined;\r\n $$.api = api;\r\n $$.config = $$.getDefaultConfig();\r\n $$.data = {};\r\n $$.cache = {};\r\n $$.axes = {};\r\n }\r\n\r\n c3.generate = function (config) {\r\n return new Chart(config);\r\n };\r\n\r\n c3.chart = {\r\n fn: Chart.prototype,\r\n internal: {\r\n fn: ChartInternal.prototype,\r\n axis: {\r\n fn: Axis.prototype\r\n }\r\n }\r\n };\r\n c3_chart_fn = c3.chart.fn;\r\n c3_chart_internal_fn = c3.chart.internal.fn;\r\n c3_chart_internal_axis_fn = c3.chart.internal.axis.fn;\r\n\r\n c3_chart_internal_fn.beforeInit = function () {\r\n // can do something\r\n };\r\n c3_chart_internal_fn.afterInit = function () {\r\n // can do something\r\n };\r\n c3_chart_internal_fn.init = function () {\r\n var $$ = this, config = $$.config;\r\n\r\n $$.initParams();\r\n\r\n if (config.data_url) {\r\n $$.convertUrlToData(config.data_url, config.data_mimeType, config.data_headers, config.data_keys, $$.initWithData);\r\n }\r\n else if (config.data_json) {\r\n $$.initWithData($$.convertJsonToData(config.data_json, config.data_keys));\r\n }\r\n else if (config.data_rows) {\r\n $$.initWithData($$.convertRowsToData(config.data_rows));\r\n }\r\n else if (config.data_columns) {\r\n $$.initWithData($$.convertColumnsToData(config.data_columns));\r\n }\r\n else {\r\n throw Error('url or json or rows or columns is required.');\r\n }\r\n };\r\n\r\n c3_chart_internal_fn.initParams = function () {\r\n var $$ = this, d3 = $$.d3, config = $$.config;\r\n\r\n // MEMO: clipId needs to be unique because it conflicts when multiple charts exist\r\n $$.clipId = \"c3-\" + (+new Date()) + '-clip',\r\n $$.clipIdForXAxis = $$.clipId + '-xaxis',\r\n $$.clipIdForYAxis = $$.clipId + '-yaxis',\r\n $$.clipIdForGrid = $$.clipId + '-grid',\r\n $$.clipIdForSubchart = $$.clipId + '-subchart',\r\n $$.clipPath = $$.getClipPath($$.clipId),\r\n $$.clipPathForXAxis = $$.getClipPath($$.clipIdForXAxis),\r\n $$.clipPathForYAxis = $$.getClipPath($$.clipIdForYAxis);\r\n $$.clipPathForGrid = $$.getClipPath($$.clipIdForGrid),\r\n $$.clipPathForSubchart = $$.getClipPath($$.clipIdForSubchart),\r\n\r\n $$.dragStart = null;\r\n $$.dragging = false;\r\n $$.flowing = false;\r\n $$.cancelClick = false;\r\n $$.mouseover = false;\r\n $$.transiting = false;\r\n\r\n $$.color = $$.generateColor();\r\n $$.levelColor = $$.generateLevelColor();\r\n\r\n $$.dataTimeFormat = config.data_xLocaltime ? d3.time.format : d3.time.format.utc;\r\n $$.axisTimeFormat = config.axis_x_localtime ? d3.time.format : d3.time.format.utc;\r\n $$.defaultAxisTimeFormat = $$.axisTimeFormat.multi([\r\n [\".%L\", function (d) { return d.getMilliseconds(); }],\r\n [\":%S\", function (d) { return d.getSeconds(); }],\r\n [\"%I:%M\", function (d) { return d.getMinutes(); }],\r\n [\"%I %p\", function (d) { return d.getHours(); }],\r\n [\"%-m/%-d\", function (d) { return d.getDay() && d.getDate() !== 1; }],\r\n [\"%-m/%-d\", function (d) { return d.getDate() !== 1; }],\r\n [\"%-m/%-d\", function (d) { return d.getMonth(); }],\r\n [\"%Y/%-m/%-d\", function () { return true; }]\r\n ]);\r\n\r\n $$.hiddenTargetIds = [];\r\n $$.hiddenLegendIds = [];\r\n $$.focusedTargetIds = [];\r\n $$.defocusedTargetIds = [];\r\n\r\n $$.xOrient = config.axis_rotated ? \"left\" : \"bottom\";\r\n $$.yOrient = config.axis_rotated ? (config.axis_y_inner ? \"top\" : \"bottom\") : (config.axis_y_inner ? \"right\" : \"left\");\r\n $$.y2Orient = config.axis_rotated ? (config.axis_y2_inner ? \"bottom\" : \"top\") : (config.axis_y2_inner ? \"left\" : \"right\");\r\n $$.subXOrient = config.axis_rotated ? \"left\" : \"bottom\";\r\n\r\n $$.isLegendRight = config.legend_position === 'right';\r\n $$.isLegendInset = config.legend_position === 'inset';\r\n $$.isLegendTop = config.legend_inset_anchor === 'top-left' || config.legend_inset_anchor === 'top-right';\r\n $$.isLegendLeft = config.legend_inset_anchor === 'top-left' || config.legend_inset_anchor === 'bottom-left';\r\n $$.legendStep = 0;\r\n $$.legendItemWidth = 0;\r\n $$.legendItemHeight = 0;\r\n\r\n $$.currentMaxTickWidths = {\r\n x: 0,\r\n y: 0,\r\n y2: 0\r\n };\r\n\r\n $$.rotated_padding_left = 30;\r\n $$.rotated_padding_right = config.axis_rotated && !config.axis_x_show ? 0 : 30;\r\n $$.rotated_padding_top = 5;\r\n\r\n $$.withoutFadeIn = {};\r\n\r\n $$.intervalForObserveInserted = undefined;\r\n\r\n $$.axes.subx = d3.selectAll([]); // needs when excluding subchart.js\r\n };\r\n\r\n c3_chart_internal_fn.initChartElements = function () {\r\n if (this.initBar) { this.initBar(); }\r\n if (this.initLine) { this.initLine(); }\r\n if (this.initArc) { this.initArc(); }\r\n if (this.initGauge) { this.initGauge(); }\r\n if (this.initText) { this.initText(); }\r\n };\r\n\r\n c3_chart_internal_fn.initWithData = function (data) {\r\n var $$ = this, d3 = $$.d3, config = $$.config;\r\n var defs, main, binding = true;\r\n\r\n $$.axis = new Axis($$);\r\n\r\n if ($$.initPie) { $$.initPie(); }\r\n if ($$.initBrush) { $$.initBrush(); }\r\n if ($$.initZoom) { $$.initZoom(); }\r\n\r\n if (!config.bindto) {\r\n $$.selectChart = d3.selectAll([]);\r\n }\r\n else if (typeof config.bindto.node === 'function') {\r\n $$.selectChart = config.bindto;\r\n }\r\n else {\r\n $$.selectChart = d3.select(config.bindto);\r\n }\r\n if ($$.selectChart.empty()) {\r\n $$.selectChart = d3.select(document.createElement('div')).style('opacity', 0);\r\n $$.observeInserted($$.selectChart);\r\n binding = false;\r\n }\r\n $$.selectChart.html(\"\").classed(\"c3\", true);\r\n\r\n // Init data as targets\r\n $$.data.xs = {};\r\n $$.data.targets = $$.convertDataToTargets(data);\r\n\r\n if (config.data_filter) {\r\n $$.data.targets = $$.data.targets.filter(config.data_filter);\r\n }\r\n\r\n // Set targets to hide if needed\r\n if (config.data_hide) {\r\n $$.addHiddenTargetIds(config.data_hide === true ? $$.mapToIds($$.data.targets) : config.data_hide);\r\n }\r\n if (config.legend_hide) {\r\n $$.addHiddenLegendIds(config.legend_hide === true ? $$.mapToIds($$.data.targets) : config.legend_hide);\r\n }\r\n\r\n // when gauge, hide legend // TODO: fix\r\n if ($$.hasType('gauge')) {\r\n config.legend_show = false;\r\n }\r\n\r\n // Init sizes and scales\r\n $$.updateSizes();\r\n $$.updateScales();\r\n\r\n // Set domains for each scale\r\n $$.x.domain(d3.extent($$.getXDomain($$.data.targets)));\r\n $$.y.domain($$.getYDomain($$.data.targets, 'y'));\r\n $$.y2.domain($$.getYDomain($$.data.targets, 'y2'));\r\n $$.subX.domain($$.x.domain());\r\n $$.subY.domain($$.y.domain());\r\n $$.subY2.domain($$.y2.domain());\r\n\r\n // Save original x domain for zoom update\r\n $$.orgXDomain = $$.x.domain();\r\n\r\n // Set initialized scales to brush and zoom\r\n if ($$.brush) { $$.brush.scale($$.subX); }\r\n if (config.zoom_enabled) { $$.zoom.scale($$.x); }\r\n\r\n /*-- Basic Elements --*/\r\n\r\n // Define svgs\r\n $$.svg = $$.selectChart.append(\"svg\")\r\n .style(\"overflow\", \"hidden\")\r\n .on('mouseenter', function () { return config.onmouseover.call($$); })\r\n .on('mouseleave', function () { return config.onmouseout.call($$); });\r\n\r\n if ($$.config.svg_classname) {\r\n $$.svg.attr('class', $$.config.svg_classname);\r\n }\r\n\r\n // Define defs\r\n defs = $$.svg.append(\"defs\");\r\n $$.clipChart = $$.appendClip(defs, $$.clipId);\r\n $$.clipXAxis = $$.appendClip(defs, $$.clipIdForXAxis);\r\n $$.clipYAxis = $$.appendClip(defs, $$.clipIdForYAxis);\r\n $$.clipGrid = $$.appendClip(defs, $$.clipIdForGrid);\r\n $$.clipSubchart = $$.appendClip(defs, $$.clipIdForSubchart);\r\n $$.updateSvgSize();\r\n\r\n // Define regions\r\n main = $$.main = $$.svg.append(\"g\").attr(\"transform\", $$.getTranslate('main'));\r\n\r\n if ($$.initSubchart) { $$.initSubchart(); }\r\n if ($$.initTooltip) { $$.initTooltip(); }\r\n if ($$.initLegend) { $$.initLegend(); }\r\n if ($$.initTitle) { $$.initTitle(); }\r\n\r\n /*-- Main Region --*/\r\n\r\n // text when empty\r\n main.append(\"text\")\r\n .attr(\"class\", CLASS.text + ' ' + CLASS.empty)\r\n .attr(\"text-anchor\", \"middle\") // horizontal centering of text at x position in all browsers.\r\n .attr(\"dominant-baseline\", \"middle\"); // vertical centering of text at y position in all browsers, except IE.\r\n\r\n // Regions\r\n $$.initRegion();\r\n\r\n // Grids\r\n $$.initGrid();\r\n\r\n // Define g for chart area\r\n main.append('g')\r\n .attr(\"clip-path\", $$.clipPath)\r\n .attr('class', CLASS.chart);\r\n\r\n // Grid lines\r\n if (config.grid_lines_front) { $$.initGridLines(); }\r\n\r\n // Cover whole with rects for events\r\n $$.initEventRect();\r\n\r\n // Define g for chart\r\n $$.initChartElements();\r\n\r\n // if zoom privileged, insert rect to forefront\r\n // TODO: is this needed?\r\n main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS.regions)\r\n .attr('class', CLASS.zoomRect)\r\n .attr('width', $$.width)\r\n .attr('height', $$.height)\r\n .style('opacity', 0)\r\n .on(\"dblclick.zoom\", null);\r\n\r\n // Set default extent if defined\r\n if (config.axis_x_extent) { $$.brush.extent($$.getDefaultExtent()); }\r\n\r\n // Add Axis\r\n $$.axis.init();\r\n\r\n // Set targets\r\n $$.updateTargets($$.data.targets);\r\n\r\n // Draw with targets\r\n if (binding) {\r\n $$.updateDimension();\r\n $$.config.oninit.call($$);\r\n $$.redraw({\r\n withTransition: false,\r\n withTransform: true,\r\n withUpdateXDomain: true,\r\n withUpdateOrgXDomain: true,\r\n withTransitionForAxis: false\r\n });\r\n }\r\n\r\n // Bind resize event\r\n $$.bindResize();\r\n\r\n // export element of the chart\r\n $$.api.element = $$.selectChart.node();\r\n };\r\n\r\n c3_chart_internal_fn.smoothLines = function (el, type) {\r\n var $$ = this;\r\n if (type === 'grid') {\r\n el.each(function () {\r\n var g = $$.d3.select(this),\r\n x1 = g.attr('x1'),\r\n x2 = g.attr('x2'),\r\n y1 = g.attr('y1'),\r\n y2 = g.attr('y2');\r\n g.attr({\r\n 'x1': Math.ceil(x1),\r\n 'x2': Math.ceil(x2),\r\n 'y1': Math.ceil(y1),\r\n 'y2': Math.ceil(y2)\r\n });\r\n });\r\n }\r\n };\r\n\r\n\r\n c3_chart_internal_fn.updateSizes = function () {\r\n var $$ = this, config = $$.config;\r\n var legendHeight = $$.legend ? $$.getLegendHeight() : 0,\r\n legendWidth = $$.legend ? $$.getLegendWidth() : 0,\r\n legendHeightForBottom = $$.isLegendRight || $$.isLegendInset ? 0 : legendHeight,\r\n hasArc = $$.hasArcType(),\r\n xAxisHeight = config.axis_rotated || hasArc ? 0 : $$.getHorizontalAxisHeight('x'),\r\n subchartHeight = config.subchart_show && !hasArc ? (config.subchart_size_height + xAxisHeight) : 0;\r\n\r\n $$.currentWidth = $$.getCurrentWidth();\r\n $$.currentHeight = $$.getCurrentHeight();\r\n\r\n // for main\r\n $$.margin = config.axis_rotated ? {\r\n top: $$.getHorizontalAxisHeight('y2') + $$.getCurrentPaddingTop(),\r\n right: hasArc ? 0 : $$.getCurrentPaddingRight(),\r\n bottom: $$.getHorizontalAxisHeight('y') + legendHeightForBottom + $$.getCurrentPaddingBottom(),\r\n left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft())\r\n } : {\r\n top: 4 + $$.getCurrentPaddingTop(), // for top tick text\r\n right: hasArc ? 0 : $$.getCurrentPaddingRight(),\r\n bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),\r\n left: hasArc ? 0 : $$.getCurrentPaddingLeft()\r\n };\r\n\r\n // for subchart\r\n $$.margin2 = config.axis_rotated ? {\r\n top: $$.margin.top,\r\n right: NaN,\r\n bottom: 20 + legendHeightForBottom,\r\n left: $$.rotated_padding_left\r\n } : {\r\n top: $$.currentHeight - subchartHeight - legendHeightForBottom,\r\n right: NaN,\r\n bottom: xAxisHeight + legendHeightForBottom,\r\n left: $$.margin.left\r\n };\r\n\r\n // for legend\r\n $$.margin3 = {\r\n top: 0,\r\n right: NaN,\r\n bottom: 0,\r\n left: 0\r\n };\r\n if ($$.updateSizeForLegend) { $$.updateSizeForLegend(legendHeight, legendWidth); }\r\n\r\n $$.width = $$.currentWidth - $$.margin.left - $$.margin.right;\r\n $$.height = $$.currentHeight - $$.margin.top - $$.margin.bottom;\r\n if ($$.width < 0) { $$.width = 0; }\r\n if ($$.height < 0) { $$.height = 0; }\r\n\r\n $$.width2 = config.axis_rotated ? $$.margin.left - $$.rotated_padding_left - $$.rotated_padding_right : $$.width;\r\n $$.height2 = config.axis_rotated ? $$.height : $$.currentHeight - $$.margin2.top - $$.margin2.bottom;\r\n if ($$.width2 < 0) { $$.width2 = 0; }\r\n if ($$.height2 < 0) { $$.height2 = 0; }\r\n\r\n // for arc\r\n $$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0);\r\n $$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10);\r\n if ($$.hasType('gauge')) {\r\n $$.arcHeight += $$.height - $$.getGaugeLabelHeight();\r\n }\r\n if ($$.updateRadius) { $$.updateRadius(); }\r\n\r\n if ($$.isLegendRight && hasArc) {\r\n $$.margin3.left = $$.arcWidth / 2 + $$.radiusExpanded * 1.1;\r\n }\r\n };\r\n\r\n c3_chart_internal_fn.updateTargets = function (targets) {\r\n var $$ = this;\r\n\r\n /*-- Main --*/\r\n\r\n //-- Text --//\r\n $$.updateTargetsForText(targets);\r\n\r\n //-- Bar --//\r\n $$.updateTargetsForBar(targets);\r\n\r\n //-- Line --//\r\n $$.updateTargetsForLine(targets);\r\n\r\n //-- Arc --//\r\n if ($$.hasArcType() && $$.updateTargetsForArc) { $$.updateTargetsForArc(targets); }\r\n\r\n /*-- Sub --*/\r\n\r\n if ($$.updateTargetsForSubchart) { $$.updateTargetsForSubchart(targets); }\r\n\r\n // Fade-in each chart\r\n $$.showTargets();\r\n };\r\n c3_chart_internal_fn.showTargets = function () {\r\n var $$ = this;\r\n $$.svg.selectAll('.' + CLASS.target).filter(function (d) { return $$.isTargetToShow(d.id); })\r\n .transition().duration($$.config.transition_duration)\r\n .style(\"opacity\", 1);\r\n };\r\n\r\n c3_chart_internal_fn.redraw = function (options, transitions) {\r\n var $$ = this, main = $$.main, d3 = $$.d3, config = $$.config;\r\n var areaIndices = $$.getShapeIndices($$.isAreaType), barIndices = $$.getShapeIndices($$.isBarType), lineIndices = $$.getShapeIndices($$.isLineType);\r\n var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis,\r\n withTransform, withUpdateXDomain, withUpdateOrgXDomain, withTrimXDomain, withLegend,\r\n withEventRect, withDimension, withUpdateXAxis;\r\n var hideAxis = $$.hasArcType();\r\n var drawArea, drawBar, drawLine, xForText, yForText;\r\n var duration, durationForExit, durationForAxis;\r\n var waitForDraw, flow;\r\n var targetsToShow = $$.filterTargetsToShow($$.data.targets), tickValues, i, intervalForCulling, xDomainForZoom;\r\n var xv = $$.xv.bind($$), cx, cy;\r\n\r\n options = options || {};\r\n withY = getOption(options, \"withY\", true);\r\n withSubchart = getOption(options, \"withSubchart\", true);\r\n withTransition = getOption(options, \"withTransition\", true);\r\n withTransform = getOption(options, \"withTransform\", false);\r\n withUpdateXDomain = getOption(options, \"withUpdateXDomain\", false);\r\n withUpdateOrgXDomain = getOption(options, \"withUpdateOrgXDomain\", false);\r\n withTrimXDomain = getOption(options, \"withTrimXDomain\", true);\r\n withUpdateXAxis = getOption(options, \"withUpdateXAxis\", withUpdateXDomain);\r\n withLegend = getOption(options, \"withLegend\", false);\r\n withEventRect = getOption(options, \"withEventRect\", true);\r\n withDimension = getOption(options, \"withDimension\", true);\r\n withTransitionForExit = getOption(options, \"withTransitionForExit\", withTransition);\r\n withTransitionForAxis = getOption(options, \"withTransitionForAxis\", withTransition);\r\n\r\n duration = withTransition ? config.transition_duration : 0;\r\n durationForExit = withTransitionForExit ? duration : 0;\r\n durationForAxis = withTransitionForAxis ? duration : 0;\r\n\r\n transitions = transitions || $$.axis.generateTransitions(durationForAxis);\r\n\r\n // update legend and transform each g\r\n if (withLegend && config.legend_show) {\r\n $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);\r\n } else if (withDimension) {\r\n // need to update dimension (e.g. axis.y.tick.values) because y tick values should change\r\n // no need to update axis in it because they will be updated in redraw()\r\n $$.updateDimension(true);\r\n }\r\n\r\n // MEMO: needed for grids calculation\r\n if ($$.isCategorized() && targetsToShow.length === 0) {\r\n $$.x.domain([0, $$.axes.x.selectAll('.tick').size()]);\r\n }\r\n\r\n if (targetsToShow.length) {\r\n $$.updateXDomain(targetsToShow, withUpdateXDomain, withUpdateOrgXDomain, withTrimXDomain);\r\n if (!config.axis_x_tick_values) {\r\n tickValues = $$.axis.updateXAxisTickValues(targetsToShow);\r\n }\r\n } else {\r\n $$.xAxis.tickValues([]);\r\n $$.subXAxis.tickValues([]);\r\n }\r\n\r\n if (config.zoom_rescale && !options.flow) {\r\n xDomainForZoom = $$.x.orgDomain();\r\n }\r\n\r\n $$.y.domain($$.getYDomain(targetsToShow, 'y', xDomainForZoom));\r\n $$.y2.domain($$.getYDomain(targetsToShow, 'y2', xDomainForZoom));\r\n\r\n if (!config.axis_y_tick_values && config.axis_y_tick_count) {\r\n $$.yAxis.tickValues($$.axis.generateTickValues($$.y.domain(), config.axis_y_tick_count));\r\n }\r\n if (!config.axis_y2_tick_values && config.axis_y2_tick_count) {\r\n $$.y2Axis.tickValues($$.axis.generateTickValues($$.y2.domain(), config.axis_y2_tick_count));\r\n }\r\n\r\n // axes\r\n $$.axis.redraw(transitions, hideAxis);\r\n\r\n // Update axis label\r\n $$.axis.updateLabels(withTransition);\r\n\r\n // show/hide if manual culling needed\r\n if ((withUpdateXDomain || withUpdateXAxis) && targetsToShow.length) {\r\n if (config.axis_x_tick_culling && tickValues) {\r\n for (i = 1; i < tickValues.length; i++) {\r\n if (tickValues.length / i < config.axis_x_tick_culling_max) {\r\n intervalForCulling = i;\r\n break;\r\n }\r\n }\r\n $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) {\r\n var index = tickValues.indexOf(e);\r\n if (index >= 0) {\r\n d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block');\r\n }\r\n });\r\n } else {\r\n $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block');\r\n }\r\n }\r\n\r\n // setup drawer - MEMO: these must be called after axis updated\r\n drawArea = $$.generateDrawArea ? $$.generateDrawArea(areaIndices, false) : undefined;\r\n drawBar = $$.generateDrawBar ? $$.generateDrawBar(barIndices) : undefined;\r\n drawLine = $$.generateDrawLine ? $$.generateDrawLine(lineIndices, false) : undefined;\r\n xForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, true);\r\n yForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, false);\r\n\r\n // Update sub domain\r\n if (withY) {\r\n $$.subY.domain($$.getYDomain(targetsToShow, 'y'));\r\n $$.subY2.domain($$.getYDomain(targetsToShow, 'y2'));\r\n }\r\n\r\n // xgrid focus\r\n $$.updateXgridFocus();\r\n\r\n // Data empty label positioning and text.\r\n main.select(\"text.\" + CLASS.text + '.' + CLASS.empty)\r\n .attr(\"x\", $$.width / 2)\r\n .attr(\"y\", $$.height / 2)\r\n .text(config.data_empty_label_text)\r\n .transition()\r\n .style('opacity', targetsToShow.length ? 0 : 1);\r\n\r\n // grid\r\n $$.updateGrid(duration);\r\n\r\n // rect for regions\r\n $$.updateRegion(duration);\r\n\r\n // bars\r\n $$.updateBar(durationForExit);\r\n\r\n // lines, areas and cricles\r\n $$.updateLine(durationForExit);\r\n $$.updateArea(durationForExit);\r\n $$.updateCircle();\r\n\r\n // text\r\n if ($$.hasDataLabel()) {\r\n $$.updateText(durationForExit);\r\n }\r\n\r\n // title\r\n if ($$.redrawTitle) { $$.redrawTitle(); }\r\n\r\n // arc\r\n if ($$.redrawArc) { $$.redrawArc(duration, durationForExit, withTransform); }\r\n\r\n // subchart\r\n if ($$.redrawSubchart) {\r\n $$.redrawSubchart(withSubchart, transitions, duration, durationForExit, areaIndices, barIndices, lineIndices);\r\n }\r\n\r\n // circles for select\r\n main.selectAll('.' + CLASS.selectedCircles)\r\n .filter($$.isBarType.bind($$))\r\n .selectAll('circle')\r\n .remove();\r\n\r\n // event rects will redrawn when flow called\r\n if (config.interaction_enabled && !options.flow && withEventRect) {\r\n $$.redrawEventRect();\r\n if ($$.updateZoom) { $$.updateZoom(); }\r\n }\r\n\r\n // update circleY based on updated parameters\r\n $$.updateCircleY();\r\n\r\n // generate circle x/y functions depending on updated params\r\n cx = ($$.config.axis_rotated ? $$.circleY : $$.circleX).bind($$);\r\n cy = ($$.config.axis_rotated ? $$.circleX : $$.circleY).bind($$);\r\n\r\n if (options.flow) {\r\n flow = $$.generateFlow({\r\n targets: targetsToShow,\r\n flow: options.flow,\r\n duration: options.flow.duration,\r\n drawBar: drawBar,\r\n drawLine: drawLine,\r\n drawArea: drawArea,\r\n cx: cx,\r\n cy: cy,\r\n xv: xv,\r\n xForText: xForText,\r\n yForText: yForText\r\n });\r\n }\r\n\r\n if ((duration || flow) && $$.isTabVisible()) { // Only use transition if tab visible. See #938.\r\n // transition should be derived from one transition\r\n d3.transition().duration(duration).each(function () {\r\n var transitionsToWait = [];\r\n\r\n // redraw and gather transitions\r\n [\r\n $$.redrawBar(drawBar, true),\r\n $$.redrawLine(drawLine, true),\r\n $$.redrawArea(drawArea, true),\r\n $$.redrawCircle(cx, cy, true),\r\n $$.redrawText(xForText, yForText, options.flow, true),\r\n $$.redrawRegion(true),\r\n $$.redrawGrid(true),\r\n ].forEach(function (transitions) {\r\n transitions.forEach(function (transition) {\r\n transitionsToWait.push(transition);\r\n });\r\n });\r\n\r\n // Wait for end of transitions to call flow and onrendered callback\r\n waitForDraw = $$.generateWait();\r\n transitionsToWait.forEach(function (t) {\r\n waitForDraw.add(t);\r\n });\r\n })\r\n .call(waitForDraw, function () {\r\n if (flow) {\r\n flow();\r\n }\r\n if (config.onrendered) {\r\n config.onrendered.call($$);\r\n }\r\n });\r\n }\r\n else {\r\n $$.redrawBar(drawBar);\r\n $$.redrawLine(drawLine);\r\n $$.redrawArea(drawArea);\r\n $$.redrawCircle(cx, cy);\r\n $$.redrawText(xForText, yForText, options.flow);\r\n $$.redrawRegion();\r\n $$.redrawGrid();\r\n if (config.onrendered) {\r\n config.onrendered.call($$);\r\n }\r\n }\r\n\r\n // update fadein condition\r\n $$.mapToIds($$.data.targets).forEach(function (id) {\r\n $$.withoutFadeIn[id] = true;\r\n });\r\n };\r\n\r\n c3_chart_internal_fn.updateAndRedraw = function (options) {\r\n var $$ = this, config = $$.config, transitions;\r\n options = options || {};\r\n // same with redraw\r\n options.withTransition = getOption(options, \"withTransition\", true);\r\n options.withTransform = getOption(options, \"withTransform\", false);\r\n options.withLegend = getOption(options, \"withLegend\", false);\r\n // NOT same with redraw\r\n options.withUpdateXDomain = true;\r\n options.withUpdateOrgXDomain = true;\r\n options.withTransitionForExit = false;\r\n options.withTransitionForTransform = getOption(options, \"withTransitionForTransform\", options.withTransition);\r\n // MEMO: this needs to be called before updateLegend and it means this ALWAYS needs to be called)\r\n $$.updateSizes();\r\n // MEMO: called in updateLegend in redraw if withLegend\r\n if (!(options.withLegend && config.legend_show)) {\r\n transitions = $$.axis.generateTransitions(options.withTransitionForAxis ? config.transition_duration : 0);\r\n // Update scales\r\n $$.updateScales();\r\n $$.updateSvgSize();\r\n // Update g positions\r\n $$.transformAll(options.withTransitionForTransform, transitions);\r\n }\r\n // Draw with new sizes & scales\r\n $$.redraw(options, transitions);\r\n };\r\n c3_chart_internal_fn.redrawWithoutRescale = function () {\r\n this.redraw({\r\n withY: false,\r\n withSubchart: false,\r\n withEventRect: false,\r\n withTransitionForAxis: false\r\n });\r\n };\r\n\r\n c3_chart_internal_fn.isTimeSeries = function () {\r\n return this.config.axis_x_type === 'timeseries';\r\n };\r\n c3_chart_internal_fn.isCategorized = function () {\r\n return this.config.axis_x_type.indexOf('categor') >= 0;\r\n };\r\n c3_chart_internal_fn.isCustomX = function () {\r\n var $$ = this, config = $$.config;\r\n return !$$.isTimeSeries() && (config.data_x || notEmpty(config.data_xs));\r\n };\r\n\r\n c3_chart_internal_fn.isTimeSeriesY = function () {\r\n return this.config.axis_y_type === 'timeseries';\r\n };\r\n\r\n c3_chart_internal_fn.getTranslate = function (target) {\r\n var $$ = this, config = $$.config, x, y;\r\n if (target === 'main') {\r\n x = asHalfPixel($$.margin.left);\r\n y = asHalfPixel($$.margin.top);\r\n } else if (target === 'context') {\r\n x = asHalfPixel($$.margin2.left);\r\n y = asHalfPixel($$.margin2.top);\r\n } else if (target === 'legend') {\r\n x = $$.margin3.left;\r\n y = $$.margin3.top;\r\n } else if (target === 'x') {\r\n x = 0;\r\n y = config.axis_rotated ? 0 : $$.height;\r\n } else if (target === 'y') {\r\n x = 0;\r\n y = config.axis_rotated ? $$.height : 0;\r\n } else if (target === 'y2') {\r\n x = config.axis_rotated ? 0 : $$.width;\r\n y = config.axis_rotated ? 1 : 0;\r\n } else if (target === 'subx') {\r\n x = 0;\r\n y = config.axis_rotated ? 0 : $$.height2;\r\n } else if (target === 'arc') {\r\n x = $$.arcWidth / 2;\r\n y = $$.arcHeight / 2;\r\n }\r\n return \"translate(\" + x + \",\" + y + \")\";\r\n };\r\n c3_chart_internal_fn.initialOpacity = function (d) {\r\n return d.value !== null && this.withoutFadeIn[d.id] ? 1 : 0;\r\n };\r\n c3_chart_internal_fn.initialOpacityForCircle = function (d) {\r\n return d.value !== null && this.withoutFadeIn[d.id] ? this.opacityForCircle(d) : 0;\r\n };\r\n c3_chart_internal_fn.opacityForCircle = function (d) {\r\n var opacity = this.config.point_show ? 1 : 0;\r\n return isValue(d.value) ? (this.isScatterType(d) ? 0.5 : opacity) : 0;\r\n };\r\n c3_chart_internal_fn.opacityForText = function () {\r\n return this.hasDataLabel() ? 1 : 0;\r\n };\r\n c3_chart_internal_fn.xx = function (d) {\r\n return d ? this.x(d.x) : null;\r\n };\r\n c3_chart_internal_fn.xv = function (d) {\r\n var $$ = this, value = d.value;\r\n if ($$.isTimeSeries()) {\r\n value = $$.parseDate(d.value);\r\n }\r\n else if ($$.isCategorized() && typeof d.value === 'string') {\r\n value = $$.config.axis_x_categories.indexOf(d.value);\r\n }\r\n return Math.ceil($$.x(value));\r\n };\r\n c3_chart_internal_fn.yv = function (d) {\r\n var $$ = this,\r\n yScale = d.axis && d.axis === 'y2' ? $$.y2 : $$.y;\r\n return Math.ceil(yScale(d.value));\r\n };\r\n c3_chart_internal_fn.subxx = function (d) {\r\n return d ? this.subX(d.x) : null;\r\n };\r\n\r\n c3_chart_internal_fn.transformMain = function (withTransition, transitions) {\r\n var $$ = this,\r\n xAxis, yAxis, y2Axis;\r\n if (transitions && transitions.axisX) {\r\n xAxis = transitions.axisX;\r\n } else {\r\n xAxis = $$.main.select('.' + CLASS.axisX);\r\n if (withTransition) { xAxis = xAxis.transition(); }\r\n }\r\n if (transitions && transitions.axisY) {\r\n yAxis = transitions.axisY;\r\n } else {\r\n yAxis = $$.main.select('.' + CLASS.axisY);\r\n if (withTransition) { yAxis = yAxis.transition(); }\r\n }\r\n if (transitions && transitions.axisY2) {\r\n y2Axis = transitions.axisY2;\r\n } else {\r\n y2Axis = $$.main.select('.' + CLASS.axisY2);\r\n if (withTransition) { y2Axis = y2Axis.transition(); }\r\n }\r\n (withTransition ? $$.main.transition() : $$.main).attr(\"transform\", $$.getTranslate('main'));\r\n xAxis.attr(\"transform\", $$.getTranslate('x'));\r\n yAxis.attr(\"transform\", $$.getTranslate('y'));\r\n y2Axis.attr(\"transform\", $$.getTranslate('y2'));\r\n $$.main.select('.' + CLASS.chartArcs).attr(\"transform\", $$.getTranslate('arc'));\r\n };\r\n c3_chart_internal_fn.transformAll = function (withTransition, transitions) {\r\n var $$ = this;\r\n $$.transformMain(withTransition, transitions);\r\n if ($$.config.subchart_show) { $$.transformContext(withTransition, transitions); }\r\n if ($$.legend) { $$.transformLegend(withTransition); }\r\n };\r\n\r\n c3_chart_internal_fn.updateSvgSize = function () {\r\n var $$ = this,\r\n brush = $$.svg.select(\".c3-brush .background\");\r\n $$.svg.attr('width', $$.currentWidth).attr('height', $$.currentHeight);\r\n $$.svg.selectAll(['#' + $$.clipId, '#' + $$.clipIdForGrid]).select('rect')\r\n .attr('width', $$.width)\r\n .attr('height', $$.height);\r\n $$.svg.select('#' + $$.clipIdForXAxis).select('rect')\r\n .attr('x', $$.getXAxisClipX.bind($$))\r\n .attr('y', $$.getXAxisClipY.bind($$))\r\n .attr('width', $$.getXAxisClipWidth.bind($$))\r\n .attr('height', $$.getXAxisClipHeight.bind($$));\r\n $$.svg.select('#' + $$.clipIdForYAxis).select('rect')\r\n .attr('x', $$.getYAxisClipX.bind($$))\r\n .attr('y', $$.getYAxisClipY.bind($$))\r\n .attr('width', $$.getYAxisClipWidth.bind($$))\r\n .attr('height', $$.getYAxisClipHeight.bind($$));\r\n $$.svg.select('#' + $$.clipIdForSubchart).select('rect')\r\n .attr('width', $$.width)\r\n .attr('height', brush.size() ? brush.attr('height') : 0);\r\n $$.svg.select('.' + CLASS.zoomRect)\r\n .attr('width', $$.width)\r\n .attr('height', $$.height);\r\n // MEMO: parent div's height will be bigger than svg when \r\n $$.selectChart.style('max-height', $$.currentHeight + \"px\");\r\n };\r\n\r\n\r\n c3_chart_internal_fn.updateDimension = function (withoutAxis) {\r\n var $$ = this;\r\n if (!withoutAxis) {\r\n if ($$.config.axis_rotated) {\r\n $$.axes.x.call($$.xAxis);\r\n $$.axes.subx.call($$.subXAxis);\r\n } else {\r\n $$.axes.y.call($$.yAxis);\r\n $$.axes.y2.call($$.y2Axis);\r\n }\r\n }\r\n $$.updateSizes();\r\n $$.updateScales();\r\n $$.updateSvgSize();\r\n $$.transformAll(false);\r\n };\r\n\r\n c3_chart_internal_fn.observeInserted = function (selection) {\r\n var $$ = this, observer;\r\n if (typeof MutationObserver === 'undefined') {\r\n window.console.error(\"MutationObserver not defined.\");\r\n return;\r\n }\r\n observer= new MutationObserver(function (mutations) {\r\n mutations.forEach(function (mutation) {\r\n if (mutation.type === 'childList' && mutation.previousSibling) {\r\n observer.disconnect();\r\n // need to wait for completion of load because size calculation requires the actual sizes determined after that completion\r\n $$.intervalForObserveInserted = window.setInterval(function () {\r\n // parentNode will NOT be null when completed\r\n if (selection.node().parentNode) {\r\n window.clearInterval($$.intervalForObserveInserted);\r\n $$.updateDimension();\r\n if ($$.brush) { $$.brush.update(); }\r\n $$.config.oninit.call($$);\r\n $$.redraw({\r\n withTransform: true,\r\n withUpdateXDomain: true,\r\n withUpdateOrgXDomain: true,\r\n withTransition: false,\r\n withTransitionForTransform: false,\r\n withLegend: true\r\n });\r\n selection.transition().style('opacity', 1);\r\n }\r\n }, 10);\r\n }\r\n });\r\n });\r\n observer.observe(selection.node(), {attributes: true, childList: true, characterData: true});\r\n };\r\n\r\n c3_chart_internal_fn.bindResize = function () {\r\n var $$ = this, config = $$.config;\r\n\r\n $$.resizeFunction = $$.generateResize();\r\n\r\n $$.resizeFunction.add(function () {\r\n config.onresize.call($$);\r\n });\r\n if (config.resize_auto) {\r\n $$.resizeFunction.add(function () {\r\n if ($$.resizeTimeout !== undefined) {\r\n window.clearTimeout($$.resizeTimeout);\r\n }\r\n $$.resizeTimeout = window.setTimeout(function () {\r\n delete $$.resizeTimeout;\r\n $$.api.flush();\r\n }, 100);\r\n });\r\n }\r\n $$.resizeFunction.add(function () {\r\n config.onresized.call($$);\r\n });\r\n\r\n if (window.attachEvent) {\r\n window.attachEvent('onresize', $$.resizeFunction);\r\n } else if (window.addEventListener) {\r\n window.addEventListener('resize', $$.resizeFunction, false);\r\n } else {\r\n // fallback to this, if this is a very old browser\r\n var wrapper = window.onresize;\r\n if (!wrapper) {\r\n // create a wrapper that will call all charts\r\n wrapper = $$.generateResize();\r\n } else if (!wrapper.add || !wrapper.remove) {\r\n // there is already a handler registered, make sure we call it too\r\n wrapper = $$.generateResize();\r\n wrapper.add(window.onresize);\r\n }\r\n // add this graph to the wrapper, we will be removed if the user calls destroy\r\n wrapper.add($$.resizeFunction);\r\n window.onresize = wrapper;\r\n }\r\n };\r\n\r\n c3_chart_internal_fn.generateResize = function () {\r\n var resizeFunctions = [];\r\n function callResizeFunctions() {\r\n resizeFunctions.forEach(function (f) {\r\n f();\r\n });\r\n }\r\n callResizeFunctions.add = function (f) {\r\n resizeFunctions.push(f);\r\n };\r\n callResizeFunctions.remove = function (f) {\r\n for (var i = 0; i < resizeFunctions.length; i++) {\r\n if (resizeFunctions[i] === f) {\r\n resizeFunctions.splice(i, 1);\r\n break;\r\n }\r\n }\r\n };\r\n return callResizeFunctions;\r\n };\r\n\r\n c3_chart_internal_fn.endall = function (transition, callback) {\r\n var n = 0;\r\n transition\r\n .each(function () { ++n; })\r\n .each(\"end\", function () {\r\n if (!--n) { callback.apply(this, arguments); }\r\n });\r\n };\r\n c3_chart_internal_fn.generateWait = function () {\r\n var transitionsToWait = [],\r\n f = function (transition, callback) {\r\n var timer = setInterval(function () {\r\n var done = 0;\r\n transitionsToWait.forEach(function (t) {\r\n if (t.empty()) {\r\n done += 1;\r\n return;\r\n }\r\n try {\r\n t.transition();\r\n } catch (e) {\r\n done += 1;\r\n }\r\n });\r\n if (done === transitionsToWait.length) {\r\n clearInterval(timer);\r\n if (callback) { callback(); }\r\n }\r\n }, 10);\r\n };\r\n f.add = function (transition) {\r\n transitionsToWait.push(transition);\r\n };\r\n return f;\r\n };\r\n\r\n c3_chart_internal_fn.parseDate = function (date) {\r\n var $$ = this, parsedDate;\r\n if (date instanceof Date) {\r\n parsedDate = date;\r\n } else if (typeof date === 'string') {\r\n parsedDate = $$.dataTimeFormat($$.config.data_xFormat).parse(date);\r\n } else if (typeof date === 'number' && !isNaN(date)) {\r\n parsedDate = new Date(+date);\r\n }\r\n if (!parsedDate || isNaN(+parsedDate)) {\r\n window.console.error(\"Failed to parse x '\" + date + \"' to Date object\");\r\n }\r\n return parsedDate;\r\n };\r\n\r\n c3_chart_internal_fn.isTabVisible = function () {\r\n var hidden;\r\n if (typeof document.hidden !== \"undefined\") { // Opera 12.10 and Firefox 18 and later support\r\n hidden = \"hidden\";\r\n } else if (typeof document.mozHidden !== \"undefined\") {\r\n hidden = \"mozHidden\";\r\n } else if (typeof document.msHidden !== \"undefined\") {\r\n hidden = \"msHidden\";\r\n } else if (typeof document.webkitHidden !== \"undefined\") {\r\n hidden = \"webkitHidden\";\r\n }\r\n\r\n return document[hidden] ? false : true;\r\n };\r\n\r\n c3_chart_internal_fn.getDefaultConfig = function () {\r\n var config = {\r\n bindto: '#chart',\r\n svg_classname: undefined,\r\n size_width: undefined,\r\n size_height: undefined,\r\n padding_left: undefined,\r\n padding_right: undefined,\r\n padding_top: undefined,\r\n padding_bottom: undefined,\r\n resize_auto: true,\r\n zoom_enabled: false,\r\n zoom_extent: undefined,\r\n zoom_privileged: false,\r\n zoom_rescale: false,\r\n zoom_onzoom: function () {},\r\n zoom_onzoomstart: function () {},\r\n zoom_onzoomend: function () {},\r\n zoom_x_min: undefined,\r\n zoom_x_max: undefined,\r\n interaction_enabled: true,\r\n onmouseover: function () {},\r\n onmouseout: function () {},\r\n onresize: function () {},\r\n onresized: function () {},\r\n oninit: function () {},\r\n onrendered: function () {},\r\n transition_duration: 350,\r\n data_x: undefined,\r\n data_xs: {},\r\n data_xFormat: '%Y-%m-%d',\r\n data_xLocaltime: true,\r\n data_xSort: true,\r\n data_idConverter: function (id) { return id; },\r\n data_names: {},\r\n data_classes: {},\r\n data_groups: [],\r\n data_axes: {},\r\n data_type: undefined,\r\n data_types: {},\r\n data_labels: {},\r\n data_order: 'desc',\r\n data_regions: {},\r\n data_color: undefined,\r\n data_colors: {},\r\n data_hide: false,\r\n data_filter: undefined,\r\n data_selection_enabled: false,\r\n data_selection_grouped: false,\r\n data_selection_isselectable: function () { return true; },\r\n data_selection_multiple: true,\r\n data_selection_draggable: false,\r\n data_onclick: function () {},\r\n data_onmouseover: function () {},\r\n data_onmouseout: function () {},\r\n data_onselected: function () {},\r\n data_onunselected: function () {},\r\n data_url: undefined,\r\n data_headers: undefined,\r\n data_json: undefined,\r\n data_rows: undefined,\r\n data_columns: undefined,\r\n data_mimeType: undefined,\r\n data_keys: undefined,\r\n // configuration for no plot-able data supplied.\r\n data_empty_label_text: \"\",\r\n // subchart\r\n subchart_show: false,\r\n subchart_size_height: 60,\r\n subchart_axis_x_show: true,\r\n subchart_onbrush: function () {},\r\n // color\r\n color_pattern: [],\r\n color_threshold: {},\r\n // legend\r\n legend_show: true,\r\n legend_hide: false,\r\n legend_position: 'bottom',\r\n legend_inset_anchor: 'top-left',\r\n legend_inset_x: 10,\r\n legend_inset_y: 0,\r\n legend_inset_step: undefined,\r\n legend_item_onclick: undefined,\r\n legend_item_onmouseover: undefined,\r\n legend_item_onmouseout: undefined,\r\n legend_equally: false,\r\n legend_padding: 0,\r\n legend_item_tile_width: 10,\r\n legend_item_tile_height: 10,\r\n // axis\r\n axis_rotated: false,\r\n axis_x_show: true,\r\n axis_x_type: 'indexed',\r\n axis_x_localtime: true,\r\n axis_x_categories: [],\r\n axis_x_tick_centered: false,\r\n axis_x_tick_format: undefined,\r\n axis_x_tick_culling: {},\r\n axis_x_tick_culling_max: 10,\r\n axis_x_tick_count: undefined,\r\n axis_x_tick_fit: true,\r\n axis_x_tick_values: null,\r\n axis_x_tick_rotate: 0,\r\n axis_x_tick_outer: true,\r\n axis_x_tick_multiline: true,\r\n axis_x_tick_width: null,\r\n axis_x_max: undefined,\r\n axis_x_min: undefined,\r\n axis_x_padding: {},\r\n axis_x_height: undefined,\r\n axis_x_extent: undefined,\r\n axis_x_label: {},\r\n axis_y_show: true,\r\n axis_y_type: undefined,\r\n axis_y_max: undefined,\r\n axis_y_min: undefined,\r\n axis_y_inverted: false,\r\n axis_y_center: undefined,\r\n axis_y_inner: undefined,\r\n axis_y_label: {},\r\n axis_y_tick_format: undefined,\r\n axis_y_tick_outer: true,\r\n axis_y_tick_values: null,\r\n axis_y_tick_rotate: 0,\r\n axis_y_tick_count: undefined,\r\n axis_y_tick_time_value: undefined,\r\n axis_y_tick_time_interval: undefined,\r\n axis_y_padding: {},\r\n axis_y_default: undefined,\r\n axis_y2_show: false,\r\n axis_y2_max: undefined,\r\n axis_y2_min: undefined,\r\n axis_y2_inverted: false,\r\n axis_y2_center: undefined,\r\n axis_y2_inner: undefined,\r\n axis_y2_label: {},\r\n axis_y2_tick_format: undefined,\r\n axis_y2_tick_outer: true,\r\n axis_y2_tick_values: null,\r\n axis_y2_tick_count: undefined,\r\n axis_y2_padding: {},\r\n axis_y2_default: undefined,\r\n // grid\r\n grid_x_show: false,\r\n grid_x_type: 'tick',\r\n grid_x_lines: [],\r\n grid_y_show: false,\r\n // not used\r\n // grid_y_type: 'tick',\r\n grid_y_lines: [],\r\n grid_y_ticks: 10,\r\n grid_focus_show: true,\r\n grid_lines_front: true,\r\n // point - point of each data\r\n point_show: true,\r\n point_r: 2.5,\r\n point_sensitivity: 10,\r\n point_focus_expand_enabled: true,\r\n point_focus_expand_r: undefined,\r\n point_select_r: undefined,\r\n // line\r\n line_connectNull: false,\r\n line_step_type: 'step',\r\n // bar\r\n bar_width: undefined,\r\n bar_width_ratio: 0.6,\r\n bar_width_max: undefined,\r\n bar_zerobased: true,\r\n // area\r\n area_zerobased: true,\r\n // pie\r\n pie_label_show: true,\r\n pie_label_format: undefined,\r\n pie_label_threshold: 0.05,\r\n pie_expand: {},\r\n pie_expand_duration: 50,\r\n // gauge\r\n gauge_label_show: true,\r\n gauge_label_format: undefined,\r\n gauge_min: 0,\r\n gauge_max: 100,\r\n gauge_units: undefined,\r\n gauge_width: undefined,\r\n gauge_expand: {},\r\n gauge_expand_duration: 50,\r\n // donut\r\n donut_label_show: true,\r\n donut_label_format: undefined,\r\n donut_label_threshold: 0.05,\r\n donut_width: undefined,\r\n donut_title: \"\",\r\n donut_expand: {},\r\n donut_expand_duration: 50,\r\n // spline\r\n spline_interpolation_type: 'cardinal',\r\n // region - region to change style\r\n regions: [],\r\n // tooltip - show when mouseover on each data\r\n tooltip_show: true,\r\n tooltip_grouped: true,\r\n tooltip_format_title: undefined,\r\n tooltip_format_name: undefined,\r\n tooltip_format_value: undefined,\r\n tooltip_position: undefined,\r\n tooltip_contents: function (d, defaultTitleFormat, defaultValueFormat, color) {\r\n return this.getTooltipContent ? this.getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) : '';\r\n },\r\n tooltip_init_show: false,\r\n tooltip_init_x: 0,\r\n tooltip_init_position: {top: '0px', left: '50px'},\r\n tooltip_onshow: function () {},\r\n tooltip_onhide: function () {},\r\n // title\r\n title_text: undefined,\r\n title_padding: {\r\n top: 0,\r\n right: 0,\r\n bottom: 0,\r\n left: 0\r\n },\r\n title_position: 'top-center',\r\n };\r\n\r\n Object.keys(this.additionalConfig).forEach(function (key) {\r\n config[key] = this.additionalConfig[key];\r\n }, this);\r\n\r\n return config;\r\n };\r\n c3_chart_internal_fn.additionalConfig = {};\r\n\r\n c3_chart_internal_fn.loadConfig = function (config) {\r\n var this_config = this.config, target, keys, read;\r\n function find() {\r\n var key = keys.shift();\r\n // console.log(\"key =>\", key, \", target =>\", target);\r\n if (key && target && typeof target === 'object' && key in target) {\r\n target = target[key];\r\n return find();\r\n }\r\n else if (!key) {\r\n return target;\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n Object.keys(this_config).forEach(function (key) {\r\n target = config;\r\n keys = key.split('_');\r\n read = find();\r\n // console.log(\"CONFIG : \", key, read);\r\n if (isDefined(read)) {\r\n this_config[key] = read;\r\n }\r\n });\r\n };\r\n\r\n c3_chart_internal_fn.getScale = function (min, max, forTimeseries) {\r\n return (forTimeseries ? this.d3.time.scale() : this.d3.scale.linear()).range([min, max]);\r\n };\r\n c3_chart_internal_fn.getX = function (min, max, domain, offset) {\r\n var $$ = this,\r\n scale = $$.getScale(min, max, $$.isTimeSeries()),\r\n _scale = domain ? scale.domain(domain) : scale, key;\r\n // Define customized scale if categorized axis\r\n if ($$.isCategorized()) {\r\n offset = offset || function () { return 0; };\r\n scale = function (d, raw) {\r\n var v = _scale(d) + offset(d);\r\n return raw ? v : Math.ceil(v);\r\n };\r\n } else {\r\n scale = function (d, raw) {\r\n var v = _scale(d);\r\n return raw ? v : Math.ceil(v);\r\n };\r\n }\r\n // define functions\r\n for (key in _scale) {\r\n scale[key] = _scale[key];\r\n }\r\n scale.orgDomain = function () {\r\n return _scale.domain();\r\n };\r\n // define custom domain() for categorized axis\r\n if ($$.isCategorized()) {\r\n scale.domain = function (domain) {\r\n if (!arguments.length) {\r\n domain = this.orgDomain();\r\n return [domain[0], domain[1] + 1];\r\n }\r\n _scale.domain(domain);\r\n return scale;\r\n };\r\n }\r\n return scale;\r\n };\r\n c3_chart_internal_fn.getY = function (min, max, domain) {\r\n var scale = this.getScale(min, max, this.isTimeSeriesY());\r\n if (domain) { scale.domain(domain); }\r\n return scale;\r\n };\r\n c3_chart_internal_fn.getYScale = function (id) {\r\n return this.axis.getId(id) === 'y2' ? this.y2 : this.y;\r\n };\r\n c3_chart_internal_fn.getSubYScale = function (id) {\r\n return this.axis.getId(id) === 'y2' ? this.subY2 : this.subY;\r\n };\r\n c3_chart_internal_fn.updateScales = function () {\r\n var $$ = this, config = $$.config,\r\n forInit = !$$.x;\r\n // update edges\r\n $$.xMin = config.axis_rotated ? 1 : 0;\r\n $$.xMax = config.axis_rotated ? $$.height : $$.width;\r\n $$.yMin = config.axis_rotated ? 0 : $$.height;\r\n $$.yMax = config.axis_rotated ? $$.width : 1;\r\n $$.subXMin = $$.xMin;\r\n $$.subXMax = $$.xMax;\r\n $$.subYMin = config.axis_rotated ? 0 : $$.height2;\r\n $$.subYMax = config.axis_rotated ? $$.width2 : 1;\r\n // update scales\r\n $$.x = $$.getX($$.xMin, $$.xMax, forInit ? undefined : $$.x.orgDomain(), function () { return $$.xAxis.tickOffset(); });\r\n $$.y = $$.getY($$.yMin, $$.yMax, forInit ? config.axis_y_default : $$.y.domain());\r\n $$.y2 = $$.getY($$.yMin, $$.yMax, forInit ? config.axis_y2_default : $$.y2.domain());\r\n $$.subX = $$.getX($$.xMin, $$.xMax, $$.orgXDomain, function (d) { return d % 1 ? 0 : $$.subXAxis.tickOffset(); });\r\n $$.subY = $$.getY($$.subYMin, $$.subYMax, forInit ? config.axis_y_default : $$.subY.domain());\r\n $$.subY2 = $$.getY($$.subYMin, $$.subYMax, forInit ? config.axis_y2_default : $$.subY2.domain());\r\n // update axes\r\n $$.xAxisTickFormat = $$.axis.getXAxisTickFormat();\r\n $$.xAxisTickValues = $$.axis.getXAxisTickValues();\r\n $$.yAxisTickValues = $$.axis.getYAxisTickValues();\r\n $$.y2AxisTickValues = $$.axis.getY2AxisTickValues();\r\n\r\n $$.xAxis = $$.axis.getXAxis($$.x, $$.xOrient, $$.xAxisTickFormat, $$.xAxisTickValues, config.axis_x_tick_outer);\r\n $$.subXAxis = $$.axis.getXAxis($$.subX, $$.subXOrient, $$.xAxisTickFormat, $$.xAxisTickValues, config.axis_x_tick_outer);\r\n $$.yAxis = $$.axis.getYAxis($$.y, $$.yOrient, config.axis_y_tick_format, $$.yAxisTickValues, config.axis_y_tick_outer);\r\n $$.y2Axis = $$.axis.getYAxis($$.y2, $$.y2Orient, config.axis_y2_tick_format, $$.y2AxisTickValues, config.axis_y2_tick_outer);\r\n\r\n // Set initialized scales to brush and zoom\r\n if (!forInit) {\r\n if ($$.brush) { $$.brush.scale($$.subX); }\r\n if (config.zoom_enabled) { $$.zoom.scale($$.x); }\r\n }\r\n // update for arc\r\n if ($$.updateArc) { $$.updateArc(); }\r\n };\r\n\r\n c3_chart_internal_fn.getYDomainMin = function (targets) {\r\n var $$ = this, config = $$.config,\r\n ids = $$.mapToIds(targets), ys = $$.getValuesAsIdKeyed(targets),\r\n j, k, baseId, idsInGroup, id, hasNegativeValue;\r\n if (config.data_groups.length > 0) {\r\n hasNegativeValue = $$.hasNegativeValueInTargets(targets);\r\n for (j = 0; j < config.data_groups.length; j++) {\r\n // Determine baseId\r\n idsInGroup = config.data_groups[j].filter(function (id) { return ids.indexOf(id) >= 0; });\r\n if (idsInGroup.length === 0) { continue; }\r\n baseId = idsInGroup[0];\r\n // Consider negative values\r\n if (hasNegativeValue && ys[baseId]) {\r\n ys[baseId].forEach(function (v, i) {\r\n ys[baseId][i] = v < 0 ? v : 0;\r\n });\r\n }\r\n // Compute min\r\n for (k = 1; k < idsInGroup.length; k++) {\r\n id = idsInGroup[k];\r\n if (! ys[id]) { continue; }\r\n ys[id].forEach(function (v, i) {\r\n if ($$.axis.getId(id) === $$.axis.getId(baseId) && ys[baseId] && !(hasNegativeValue && +v > 0)) {\r\n ys[baseId][i] += +v;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n return $$.d3.min(Object.keys(ys).map(function (key) { return $$.d3.min(ys[key]); }));\r\n };\r\n c3_chart_internal_fn.getYDomainMax = function (targets) {\r\n var $$ = this, config = $$.config,\r\n ids = $$.mapToIds(targets), ys = $$.getValuesAsIdKeyed(targets),\r\n j, k, baseId, idsInGroup, id, hasPositiveValue;\r\n if (config.data_groups.length > 0) {\r\n hasPositiveValue = $$.hasPositiveValueInTargets(targets);\r\n for (j = 0; j < config.data_groups.length; j++) {\r\n // Determine baseId\r\n idsInGroup = config.data_groups[j].filter(function (id) { return ids.indexOf(id) >= 0; });\r\n if (idsInGroup.length === 0) { continue; }\r\n baseId = idsInGroup[0];\r\n // Consider positive values\r\n if (hasPositiveValue && ys[baseId]) {\r\n ys[baseId].forEach(function (v, i) {\r\n ys[baseId][i] = v > 0 ? v : 0;\r\n });\r\n }\r\n // Compute max\r\n for (k = 1; k < idsInGroup.length; k++) {\r\n id = idsInGroup[k];\r\n if (! ys[id]) { continue; }\r\n ys[id].forEach(function (v, i) {\r\n if ($$.axis.getId(id) === $$.axis.getId(baseId) && ys[baseId] && !(hasPositiveValue && +v < 0)) {\r\n ys[baseId][i] += +v;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n return $$.d3.max(Object.keys(ys).map(function (key) { return $$.d3.max(ys[key]); }));\r\n };\r\n c3_chart_internal_fn.getYDomain = function (targets, axisId, xDomain) {\r\n var $$ = this, config = $$.config,\r\n targetsByAxisId = targets.filter(function (t) { return $$.axis.getId(t.id) === axisId; }),\r\n yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId,\r\n yMin = axisId === 'y2' ? config.axis_y2_min : config.axis_y_min,\r\n yMax = axisId === 'y2' ? config.axis_y2_max : config.axis_y_max,\r\n yDomainMin = $$.getYDomainMin(yTargets),\r\n yDomainMax = $$.getYDomainMax(yTargets),\r\n domain, domainLength, padding, padding_top, padding_bottom,\r\n center = axisId === 'y2' ? config.axis_y2_center : config.axis_y_center,\r\n yDomainAbs, lengths, diff, ratio, isAllPositive, isAllNegative,\r\n isZeroBased = ($$.hasType('bar', yTargets) && config.bar_zerobased) || ($$.hasType('area', yTargets) && config.area_zerobased),\r\n isInverted = axisId === 'y2' ? config.axis_y2_inverted : config.axis_y_inverted,\r\n showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated,\r\n showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;\r\n\r\n // MEMO: avoid inverting domain unexpectedly\r\n yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? (yDomainMin < yMax ? yDomainMin : yMax - 10) : yDomainMin;\r\n yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? (yMin < yDomainMax ? yDomainMax : yMin + 10) : yDomainMax;\r\n\r\n if (yTargets.length === 0) { // use current domain if target of axisId is none\r\n return axisId === 'y2' ? $$.y2.domain() : $$.y.domain();\r\n }\r\n if (isNaN(yDomainMin)) { // set minimum to zero when not number\r\n yDomainMin = 0;\r\n }\r\n if (isNaN(yDomainMax)) { // set maximum to have same value as yDomainMin\r\n yDomainMax = yDomainMin;\r\n }\r\n if (yDomainMin === yDomainMax) {\r\n yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0;\r\n }\r\n isAllPositive = yDomainMin >= 0 && yDomainMax >= 0;\r\n isAllNegative = yDomainMin <= 0 && yDomainMax <= 0;\r\n\r\n // Cancel zerobased if axis_*_min / axis_*_max specified\r\n if ((isValue(yMin) && isAllPositive) || (isValue(yMax) && isAllNegative)) {\r\n isZeroBased = false;\r\n }\r\n\r\n // Bar/Area chart should be 0-based if all positive|negative\r\n if (isZeroBased) {\r\n if (isAllPositive) { yDomainMin = 0; }\r\n if (isAllNegative) { yDomainMax = 0; }\r\n }\r\n\r\n domainLength = Math.abs(yDomainMax - yDomainMin);\r\n padding = padding_top = padding_bottom = domainLength * 0.1;\r\n\r\n if (typeof center !== 'undefined') {\r\n yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));\r\n yDomainMax = center + yDomainAbs;\r\n yDomainMin = center - yDomainAbs;\r\n }\r\n // add padding for data label\r\n if (showHorizontalDataLabel) {\r\n lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, 'width');\r\n diff = diffDomain($$.y.range());\r\n ratio = [lengths[0] / diff, lengths[1] / diff];\r\n padding_top += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1]));\r\n padding_bottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1]));\r\n } else if (showVerticalDataLabel) {\r\n lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, 'height');\r\n padding_top += $$.axis.convertPixelsToAxisPadding(lengths[1], domainLength);\r\n padding_bottom += $$.axis.convertPixelsToAxisPadding(lengths[0], domainLength);\r\n }\r\n if (axisId === 'y' && notEmpty(config.axis_y_padding)) {\r\n padding_top = $$.axis.getPadding(config.axis_y_padding, 'top', padding_top, domainLength);\r\n padding_bottom = $$.axis.getPadding(config.axis_y_padding, 'bottom', padding_bottom, domainLength);\r\n }\r\n if (axisId === 'y2' && notEmpty(config.axis_y2_padding)) {\r\n padding_top = $$.axis.getPadding(config.axis_y2_padding, 'top', padding_top, domainLength);\r\n padding_bottom = $$.axis.getPadding(config.axis_y2_padding, 'bottom', padding_bottom, domainLength);\r\n }\r\n // Bar/Area chart should be 0-based if all positive|negative\r\n if (isZeroBased) {\r\n if (isAllPositive) { padding_bottom = yDomainMin; }\r\n if (isAllNegative) { padding_top = -yDomainMax; }\r\n }\r\n domain = [yDomainMin - padding_bottom, yDomainMax + padding_top];\r\n return isInverted ? domain.reverse() : domain;\r\n };\r\n c3_chart_internal_fn.getXDomainMin = function (targets) {\r\n var $$ = this, config = $$.config;\r\n return isDefined(config.axis_x_min) ?\r\n ($$.isTimeSeries() ? this.parseDate(config.axis_x_min) : config.axis_x_min) :\r\n $$.d3.min(targets, function (t) { return $$.d3.min(t.values, function (v) { return v.x; }); });\r\n };\r\n c3_chart_internal_fn.getXDomainMax = function (targets) {\r\n var $$ = this, config = $$.config;\r\n return isDefined(config.axis_x_max) ?\r\n ($$.isTimeSeries() ? this.parseDate(config.axis_x_max) : config.axis_x_max) :\r\n $$.d3.max(targets, function (t) { return $$.d3.max(t.values, function (v) { return v.x; }); });\r\n };\r\n c3_chart_internal_fn.getXDomainPadding = function (domain) {\r\n var $$ = this, config = $$.config,\r\n diff = domain[1] - domain[0],\r\n maxDataCount, padding, paddingLeft, paddingRight;\r\n if ($$.isCategorized()) {\r\n padding = 0;\r\n } else if ($$.hasType('bar')) {\r\n maxDataCount = $$.getMaxDataCount();\r\n padding = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5;\r\n } else {\r\n padding = diff * 0.01;\r\n }\r\n if (typeof config.axis_x_padding === 'object' && notEmpty(config.axis_x_padding)) {\r\n paddingLeft = isValue(config.axis_x_padding.left) ? config.axis_x_padding.left : padding;\r\n paddingRight = isValue(config.axis_x_padding.right) ? config.axis_x_padding.right : padding;\r\n } else if (typeof config.axis_x_padding === 'number') {\r\n paddingLeft = paddingRight = config.axis_x_padding;\r\n } else {\r\n paddingLeft = paddingRight = padding;\r\n }\r\n return {left: paddingLeft, right: paddingRight};\r\n };\r\n c3_chart_internal_fn.getXDomain = function (targets) {\r\n var $$ = this,\r\n xDomain = [$$.getXDomainMin(targets), $$.getXDomainMax(targets)],\r\n firstX = xDomain[0], lastX = xDomain[1],\r\n padding = $$.getXDomainPadding(xDomain),\r\n min = 0, max = 0;\r\n // show center of x domain if min and max are the same\r\n if ((firstX - lastX) === 0 && !$$.isCategorized()) {\r\n if ($$.isTimeSeries()) {\r\n firstX = new Date(firstX.getTime() * 0.5);\r\n lastX = new Date(lastX.getTime() * 1.5);\r\n } else {\r\n firstX = firstX === 0 ? 1 : (firstX * 0.5);\r\n lastX = lastX === 0 ? -1 : (lastX * 1.5);\r\n }\r\n }\r\n if (firstX || firstX === 0) {\r\n min = $$.isTimeSeries() ? new Date(firstX.getTime() - padding.left) : firstX - padding.left;\r\n }\r\n if (lastX || lastX === 0) {\r\n max = $$.isTimeSeries() ? new Date(lastX.getTime() + padding.right) : lastX + padding.right;\r\n }\r\n return [min, max];\r\n };\r\n c3_chart_internal_fn.updateXDomain = function (targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {\r\n var $$ = this, config = $$.config;\r\n\r\n if (withUpdateOrgXDomain) {\r\n $$.x.domain(domain ? domain : $$.d3.extent($$.getXDomain(targets)));\r\n $$.orgXDomain = $$.x.domain();\r\n if (config.zoom_enabled) { $$.zoom.scale($$.x).updateScaleExtent(); }\r\n $$.subX.domain($$.x.domain());\r\n if ($$.brush) { $$.brush.scale($$.subX); }\r\n }\r\n if (withUpdateXDomain) {\r\n $$.x.domain(domain ? domain : (!$$.brush || $$.brush.empty()) ? $$.orgXDomain : $$.brush.extent());\r\n if (config.zoom_enabled) { $$.zoom.scale($$.x).updateScaleExtent(); }\r\n }\r\n\r\n // Trim domain when too big by zoom mousemove event\r\n if (withTrim) { $$.x.domain($$.trimXDomain($$.x.orgDomain())); }\r\n\r\n return $$.x.domain();\r\n };\r\n c3_chart_internal_fn.trimXDomain = function (domain) {\r\n var zoomDomain = this.getZoomDomain(),\r\n min = zoomDomain[0], max = zoomDomain[1];\r\n if (domain[0] <= min) {\r\n domain[1] = +domain[1] + (min - domain[0]);\r\n domain[0] = min;\r\n }\r\n if (max <= domain[1]) {\r\n domain[0] = +domain[0] - (domain[1] - max);\r\n domain[1] = max;\r\n }\r\n return domain;\r\n };\r\n\r\n c3_chart_internal_fn.isX = function (key) {\r\n var $$ = this, config = $$.config;\r\n return (config.data_x && key === config.data_x) || (notEmpty(config.data_xs) && hasValue(config.data_xs, key));\r\n };\r\n c3_chart_internal_fn.isNotX = function (key) {\r\n return !this.isX(key);\r\n };\r\n c3_chart_internal_fn.getXKey = function (id) {\r\n var $$ = this, config = $$.config;\r\n return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null;\r\n };\r\n c3_chart_internal_fn.getXValuesOfXKey = function (key, targets) {\r\n var $$ = this,\r\n xValues, ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : [];\r\n ids.forEach(function (id) {\r\n if ($$.getXKey(id) === key) {\r\n xValues = $$.data.xs[id];\r\n }\r\n });\r\n return xValues;\r\n };\r\n c3_chart_internal_fn.getIndexByX = function (x) {\r\n var $$ = this,\r\n data = $$.filterByX($$.data.targets, x);\r\n return data.length ? data[0].index : null;\r\n };\r\n c3_chart_internal_fn.getXValue = function (id, i) {\r\n var $$ = this;\r\n return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i;\r\n };\r\n c3_chart_internal_fn.getOtherTargetXs = function () {\r\n var $$ = this,\r\n idsForX = Object.keys($$.data.xs);\r\n return idsForX.length ? $$.data.xs[idsForX[0]] : null;\r\n };\r\n c3_chart_internal_fn.getOtherTargetX = function (index) {\r\n var xs = this.getOtherTargetXs();\r\n return xs && index < xs.length ? xs[index] : null;\r\n };\r\n c3_chart_internal_fn.addXs = function (xs) {\r\n var $$ = this;\r\n Object.keys(xs).forEach(function (id) {\r\n $$.config.data_xs[id] = xs[id];\r\n });\r\n };\r\n c3_chart_internal_fn.hasMultipleX = function (xs) {\r\n return this.d3.set(Object.keys(xs).map(function (id) { return xs[id]; })).size() > 1;\r\n };\r\n c3_chart_internal_fn.isMultipleX = function () {\r\n return notEmpty(this.config.data_xs) || !this.config.data_xSort || this.hasType('scatter');\r\n };\r\n c3_chart_internal_fn.addName = function (data) {\r\n var $$ = this, name;\r\n if (data) {\r\n name = $$.config.data_names[data.id];\r\n data.name = name !== undefined ? name : data.id;\r\n }\r\n return data;\r\n };\r\n c3_chart_internal_fn.getValueOnIndex = function (values, index) {\r\n var valueOnIndex = values.filter(function (v) { return v.index === index; });\r\n return valueOnIndex.length ? valueOnIndex[0] : null;\r\n };\r\n c3_chart_internal_fn.updateTargetX = function (targets, x) {\r\n var $$ = this;\r\n targets.forEach(function (t) {\r\n t.values.forEach(function (v, i) {\r\n v.x = $$.generateTargetX(x[i], t.id, i);\r\n });\r\n $$.data.xs[t.id] = x;\r\n });\r\n };\r\n c3_chart_internal_fn.updateTargetXs = function (targets, xs) {\r\n var $$ = this;\r\n targets.forEach(function (t) {\r\n if (xs[t.id]) {\r\n $$.updateTargetX([t], xs[t.id]);\r\n }\r\n });\r\n };\r\n c3_chart_internal_fn.generateTargetX = function (rawX, id, index) {\r\n var $$ = this, x;\r\n if ($$.isTimeSeries()) {\r\n x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index));\r\n }\r\n else if ($$.isCustomX() && !$$.isCategorized()) {\r\n x = isValue(rawX) ? +rawX : $$.getXValue(id, index);\r\n }\r\n else {\r\n x = index;\r\n }\r\n return x;\r\n };\r\n c3_chart_internal_fn.cloneTarget = function (target) {\r\n return {\r\n id : target.id,\r\n id_org : target.id_org,\r\n values : target.values.map(function (d) {\r\n return {x: d.x, value: d.value, id: d.id};\r\n })\r\n };\r\n };\r\n c3_chart_internal_fn.updateXs = function () {\r\n var $$ = this;\r\n if ($$.data.targets.length) {\r\n $$.xs = [];\r\n $$.data.targets[0].values.forEach(function (v) {\r\n $$.xs[v.index] = v.x;\r\n });\r\n }\r\n };\r\n c3_chart_internal_fn.getPrevX = function (i) {\r\n var x = this.xs[i - 1];\r\n return typeof x !== 'undefined' ? x : null;\r\n };\r\n c3_chart_internal_fn.getNextX = function (i) {\r\n var x = this.xs[i + 1];\r\n return typeof x !== 'undefined' ? x : null;\r\n };\r\n c3_chart_internal_fn.getMaxDataCount = function () {\r\n var $$ = this;\r\n return $$.d3.max($$.data.targets, function (t) { return t.values.length; });\r\n };\r\n c3_chart_internal_fn.getMaxDataCountTarget = function (targets) {\r\n var length = targets.length, max = 0, maxTarget;\r\n if (length > 1) {\r\n targets.forEach(function (t) {\r\n if (t.values.length > max) {\r\n maxTarget = t;\r\n max = t.values.length;\r\n }\r\n });\r\n } else {\r\n maxTarget = length ? targets[0] : null;\r\n }\r\n return maxTarget;\r\n };\r\n c3_chart_internal_fn.getEdgeX = function (targets) {\r\n var $$ = this;\r\n return !targets.length ? [0, 0] : [\r\n $$.d3.min(targets, function (t) { return t.values[0].x; }),\r\n $$.d3.max(targets, function (t) { return t.values[t.values.length - 1].x; })\r\n ];\r\n };\r\n c3_chart_internal_fn.mapToIds = function (targets) {\r\n return targets.map(function (d) { return d.id; });\r\n };\r\n c3_chart_internal_fn.mapToTargetIds = function (ids) {\r\n var $$ = this;\r\n return ids ? [].concat(ids) : $$.mapToIds($$.data.targets);\r\n };\r\n c3_chart_internal_fn.hasTarget = function (targets, id) {\r\n var ids = this.mapToIds(targets), i;\r\n for (i = 0; i < ids.length; i++) {\r\n if (ids[i] === id) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n c3_chart_internal_fn.isTargetToShow = function (targetId) {\r\n return this.hiddenTargetIds.indexOf(targetId) < 0;\r\n };\r\n c3_chart_internal_fn.isLegendToShow = function (targetId) {\r\n return this.hiddenLegendIds.indexOf(targetId) < 0;\r\n };\r\n c3_chart_internal_fn.filterTargetsToShow = function (targets) {\r\n var $$ = this;\r\n return targets.filter(function (t) { return $$.isTargetToShow(t.id); });\r\n };\r\n c3_chart_internal_fn.mapTargetsToUniqueXs = function (targets) {\r\n var $$ = this;\r\n var xs = $$.d3.set($$.d3.merge(targets.map(function (t) { return t.values.map(function (v) { return +v.x; }); }))).values();\r\n xs = $$.isTimeSeries() ? xs.map(function (x) { return new Date(+x); }) : xs.map(function (x) { return +x; });\r\n return xs.sort(function (a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; });\r\n };\r\n c3_chart_internal_fn.addHiddenTargetIds = function (targetIds) {\r\n this.hiddenTargetIds = this.hiddenTargetIds.concat(targetIds);\r\n };\r\n c3_chart_internal_fn.removeHiddenTargetIds = function (targetIds) {\r\n this.hiddenTargetIds = this.hiddenTargetIds.filter(function (id) { return targetIds.indexOf(id) < 0; });\r\n };\r\n c3_chart_internal_fn.addHiddenLegendIds = function (targetIds) {\r\n this.hiddenLegendIds = this.hiddenLegendIds.concat(targetIds);\r\n };\r\n c3_chart_internal_fn.removeHiddenLegendIds = function (targetIds) {\r\n this.hiddenLegendIds = this.hiddenLegendIds.filter(function (id) { return targetIds.indexOf(id) < 0; });\r\n };\r\n c3_chart_internal_fn.getValuesAsIdKeyed = function (targets) {\r\n var ys = {};\r\n targets.forEach(function (t) {\r\n ys[t.id] = [];\r\n t.values.forEach(function (v) {\r\n ys[t.id].push(v.value);\r\n });\r\n });\r\n return ys;\r\n };\r\n c3_chart_internal_fn.checkValueInTargets = function (targets, checker) {\r\n var ids = Object.keys(targets), i, j, values;\r\n for (i = 0; i < ids.length; i++) {\r\n values = targets[ids[i]].values;\r\n for (j = 0; j < values.length; j++) {\r\n if (checker(values[j].value)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n c3_chart_internal_fn.hasNegativeValueInTargets = function (targets) {\r\n return this.checkValueInTargets(targets, function (v) { return v < 0; });\r\n };\r\n c3_chart_internal_fn.hasPositiveValueInTargets = function (targets) {\r\n return this.checkValueInTargets(targets, function (v) { return v > 0; });\r\n };\r\n c3_chart_internal_fn.isOrderDesc = function () {\r\n var config = this.config;\r\n return typeof(config.data_order) === 'string' && config.data_order.toLowerCase() === 'desc';\r\n };\r\n c3_chart_internal_fn.isOrderAsc = function () {\r\n var config = this.config;\r\n return typeof(config.data_order) === 'string' && config.data_order.toLowerCase() === 'asc';\r\n };\r\n c3_chart_internal_fn.orderTargets = function (targets) {\r\n var $$ = this, config = $$.config, orderAsc = $$.isOrderAsc(), orderDesc = $$.isOrderDesc();\r\n if (orderAsc || orderDesc) {\r\n targets.sort(function (t1, t2) {\r\n var reducer = function (p, c) { return p + Math.abs(c.value); };\r\n var t1Sum = t1.values.reduce(reducer, 0),\r\n t2Sum = t2.values.reduce(reducer, 0);\r\n return orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;\r\n });\r\n } else if (isFunction(config.data_order)) {\r\n targets.sort(config.data_order);\r\n } // TODO: accept name array for order\r\n return targets;\r\n };\r\n c3_chart_internal_fn.filterByX = function (targets, x) {\r\n return this.d3.merge(targets.map(function (t) { return t.values; })).filter(function (v) { return v.x - x === 0; });\r\n };\r\n c3_chart_internal_fn.filterRemoveNull = function (data) {\r\n return data.filter(function (d) { return isValue(d.value); });\r\n };\r\n c3_chart_internal_fn.filterByXDomain = function (targets, xDomain) {\r\n return targets.map(function (t) {\r\n return {\r\n id: t.id,\r\n id_org: t.id_org,\r\n values: t.values.filter(function (v) {\r\n return xDomain[0] <= v.x && v.x <= xDomain[1];\r\n })\r\n };\r\n });\r\n };\r\n c3_chart_internal_fn.hasDataLabel = function () {\r\n var config = this.config;\r\n if (typeof config.data_labels === 'boolean' && config.data_labels) {\r\n return true;\r\n } else if (typeof config.data_labels === 'object' && notEmpty(config.data_labels)) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n c3_chart_internal_fn.getDataLabelLength = function (min, max, key) {\r\n var $$ = this,\r\n lengths = [0, 0], paddingCoef = 1.3;\r\n $$.selectChart.select('svg').selectAll('.dummy')\r\n .data([min, max])\r\n .enter().append('text')\r\n .text(function (d) { return $$.dataLabelFormat(d.id)(d); })\r\n .each(function (d, i) {\r\n lengths[i] = this.getBoundingClientRect()[key] * paddingCoef;\r\n })\r\n .remove();\r\n return lengths;\r\n };\r\n c3_chart_internal_fn.isNoneArc = function (d) {\r\n return this.hasTarget(this.data.targets, d.id);\r\n },\r\n c3_chart_internal_fn.isArc = function (d) {\r\n return 'data' in d && this.hasTarget(this.data.targets, d.data.id);\r\n };\r\n c3_chart_internal_fn.findSameXOfValues = function (values, index) {\r\n var i, targetX = values[index].x, sames = [];\r\n for (i = index - 1; i >= 0; i--) {\r\n if (targetX !== values[i].x) { break; }\r\n sames.push(values[i]);\r\n }\r\n for (i = index; i < values.length; i++) {\r\n if (targetX !== values[i].x) { break; }\r\n sames.push(values[i]);\r\n }\r\n return sames;\r\n };\r\n\r\n c3_chart_internal_fn.findClosestFromTargets = function (targets, pos) {\r\n var $$ = this, candidates;\r\n\r\n // map to array of closest points of each target\r\n candidates = targets.map(function (target) {\r\n return $$.findClosest(target.values, pos);\r\n });\r\n\r\n // decide closest point and return\r\n return $$.findClosest(candidates, pos);\r\n };\r\n c3_chart_internal_fn.findClosest = function (values, pos) {\r\n var $$ = this, minDist = $$.config.point_sensitivity, closest;\r\n\r\n // find mouseovering bar\r\n values.filter(function (v) { return v && $$.isBarType(v.id); }).forEach(function (v) {\r\n var shape = $$.main.select('.' + CLASS.bars + $$.getTargetSelectorSuffix(v.id) + ' .' + CLASS.bar + '-' + v.index).node();\r\n if (!closest && $$.isWithinBar(shape)) {\r\n closest = v;\r\n }\r\n });\r\n\r\n // find closest point from non-bar\r\n values.filter(function (v) { return v && !$$.isBarType(v.id); }).forEach(function (v) {\r\n var d = $$.dist(v, pos);\r\n if (d < minDist) {\r\n minDist = d;\r\n closest = v;\r\n }\r\n });\r\n\r\n return closest;\r\n };\r\n c3_chart_internal_fn.dist = function (data, pos) {\r\n var $$ = this, config = $$.config,\r\n xIndex = config.axis_rotated ? 1 : 0,\r\n yIndex = config.axis_rotated ? 0 : 1,\r\n y = $$.circleY(data, data.index),\r\n x = $$.x(data.x);\r\n return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2));\r\n };\r\n c3_chart_internal_fn.convertValuesToStep = function (values) {\r\n var converted = [].concat(values), i;\r\n\r\n if (!this.isCategorized()) {\r\n return values;\r\n }\r\n\r\n for (i = values.length + 1; 0 < i; i--) {\r\n converted[i] = converted[i - 1];\r\n }\r\n\r\n converted[0] = {\r\n x: converted[0].x - 1,\r\n value: converted[0].value,\r\n id: converted[0].id\r\n };\r\n converted[values.length + 1] = {\r\n x: converted[values.length].x + 1,\r\n value: converted[values.length].value,\r\n id: converted[values.length].id\r\n };\r\n\r\n return converted;\r\n };\r\n c3_chart_internal_fn.updateDataAttributes = function (name, attrs) {\r\n var $$ = this, config = $$.config, current = config['data_' + name];\r\n if (typeof attrs === 'undefined') { return current; }\r\n Object.keys(attrs).forEach(function (id) {\r\n current[id] = attrs[id];\r\n });\r\n $$.redraw({withLegend: true});\r\n return current;\r\n };\r\n\r\n c3_chart_internal_fn.convertUrlToData = function (url, mimeType, headers, keys, done) {\r\n var $$ = this, type = mimeType ? mimeType : 'csv';\r\n var req = $$.d3.xhr(url);\r\n if (headers) {\r\n Object.keys(headers).forEach(function (header) {\r\n req.header(header, headers[header]);\r\n });\r\n }\r\n req.get(function (error, data) {\r\n var d;\r\n if (!data) {\r\n throw new Error(error.responseURL + ' ' + error.status + ' (' + error.statusText + ')');\r\n }\r\n if (type === 'json') {\r\n d = $$.convertJsonToData(JSON.parse(data.response), keys);\r\n } else if (type === 'tsv') {\r\n d = $$.convertTsvToData(data.response);\r\n } else {\r\n d = $$.convertCsvToData(data.response);\r\n }\r\n done.call($$, d);\r\n });\r\n };\r\n c3_chart_internal_fn.convertXsvToData = function (xsv, parser) {\r\n var rows = parser.parseRows(xsv), d;\r\n if (rows.length === 1) {\r\n d = [{}];\r\n rows[0].forEach(function (id) {\r\n d[0][id] = null;\r\n });\r\n } else {\r\n d = parser.parse(xsv);\r\n }\r\n return d;\r\n };\r\n c3_chart_internal_fn.convertCsvToData = function (csv) {\r\n return this.convertXsvToData(csv, this.d3.csv);\r\n };\r\n c3_chart_internal_fn.convertTsvToData = function (tsv) {\r\n return this.convertXsvToData(tsv, this.d3.tsv);\r\n };\r\n c3_chart_internal_fn.convertJsonToData = function (json, keys) {\r\n var $$ = this,\r\n new_rows = [], targetKeys, data;\r\n if (keys) { // when keys specified, json would be an array that includes objects\r\n if (keys.x) {\r\n targetKeys = keys.value.concat(keys.x);\r\n $$.config.data_x = keys.x;\r\n } else {\r\n targetKeys = keys.value;\r\n }\r\n new_rows.push(targetKeys);\r\n json.forEach(function (o) {\r\n var new_row = [];\r\n targetKeys.forEach(function (key) {\r\n // convert undefined to null because undefined data will be removed in convertDataToTargets()\r\n var v = isUndefined(o[key]) ? null : o[key];\r\n new_row.push(v);\r\n });\r\n new_rows.push(new_row);\r\n });\r\n data = $$.convertRowsToData(new_rows);\r\n } else {\r\n Object.keys(json).forEach(function (key) {\r\n new_rows.push([key].concat(json[key]));\r\n });\r\n data = $$.convertColumnsToData(new_rows);\r\n }\r\n return data;\r\n };\r\n c3_chart_internal_fn.convertRowsToData = function (rows) {\r\n var keys = rows[0], new_row = {}, new_rows = [], i, j;\r\n for (i = 1; i < rows.length; i++) {\r\n new_row = {};\r\n for (j = 0; j < rows[i].length; j++) {\r\n if (isUndefined(rows[i][j])) {\r\n throw new Error(\"Source data is missing a component at (\" + i + \",\" + j + \")!\");\r\n }\r\n new_row[keys[j]] = rows[i][j];\r\n }\r\n new_rows.push(new_row);\r\n }\r\n return new_rows;\r\n };\r\n c3_chart_internal_fn.convertColumnsToData = function (columns) {\r\n var new_rows = [], i, j, key;\r\n for (i = 0; i < columns.length; i++) {\r\n key = columns[i][0];\r\n for (j = 1; j < columns[i].length; j++) {\r\n if (isUndefined(new_rows[j - 1])) {\r\n new_rows[j - 1] = {};\r\n }\r\n if (isUndefined(columns[i][j])) {\r\n throw new Error(\"Source data is missing a component at (\" + i + \",\" + j + \")!\");\r\n }\r\n new_rows[j - 1][key] = columns[i][j];\r\n }\r\n }\r\n return new_rows;\r\n };\r\n c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {\r\n var $$ = this, config = $$.config,\r\n ids = $$.d3.keys(data[0]).filter($$.isNotX, $$),\r\n xs = $$.d3.keys(data[0]).filter($$.isX, $$),\r\n targets;\r\n\r\n // save x for update data by load when custom x and c3.x API\r\n ids.forEach(function (id) {\r\n var xKey = $$.getXKey(id);\r\n\r\n if ($$.isCustomX() || $$.isTimeSeries()) {\r\n // if included in input data\r\n if (xs.indexOf(xKey) >= 0) {\r\n $$.data.xs[id] = (appendXs && $$.data.xs[id] ? $$.data.xs[id] : []).concat(\r\n data.map(function (d) { return d[xKey]; })\r\n .filter(isValue)\r\n .map(function (rawX, i) { return $$.generateTargetX(rawX, id, i); })\r\n );\r\n }\r\n // if not included in input data, find from preloaded data of other id's x\r\n else if (config.data_x) {\r\n $$.data.xs[id] = $$.getOtherTargetXs();\r\n }\r\n // if not included in input data, find from preloaded data\r\n else if (notEmpty(config.data_xs)) {\r\n $$.data.xs[id] = $$.getXValuesOfXKey(xKey, $$.data.targets);\r\n }\r\n // MEMO: if no x included, use same x of current will be used\r\n } else {\r\n $$.data.xs[id] = data.map(function (d, i) { return i; });\r\n }\r\n });\r\n\r\n\r\n // check x is defined\r\n ids.forEach(function (id) {\r\n if (!$$.data.xs[id]) {\r\n throw new Error('x is not defined for id = \"' + id + '\".');\r\n }\r\n });\r\n\r\n // convert to target\r\n targets = ids.map(function (id, index) {\r\n var convertedId = config.data_idConverter(id);\r\n return {\r\n id: convertedId,\r\n id_org: id,\r\n values: data.map(function (d, i) {\r\n var xKey = $$.getXKey(id), rawX = d[xKey], x = $$.generateTargetX(rawX, id, i),\r\n value = d[id] !== null && !isNaN(d[id]) ? +d[id] : null;\r\n // use x as categories if custom x and categorized\r\n if ($$.isCustomX() && $$.isCategorized() && index === 0 && rawX) {\r\n if (i === 0) { config.axis_x_categories = []; }\r\n config.axis_x_categories.push(rawX);\r\n }\r\n // mark as x = undefined if value is undefined and filter to remove after mapped\r\n if (isUndefined(d[id]) || $$.data.xs[id].length <= i) {\r\n x = undefined;\r\n }\r\n return {x: x, value: value, id: convertedId};\r\n }).filter(function (v) { return isDefined(v.x); })\r\n };\r\n });\r\n\r\n // finish targets\r\n targets.forEach(function (t) {\r\n var i;\r\n // sort values by its x\r\n if (config.data_xSort) {\r\n t.values = t.values.sort(function (v1, v2) {\r\n var x1 = v1.x || v1.x === 0 ? v1.x : Infinity,\r\n x2 = v2.x || v2.x === 0 ? v2.x : Infinity;\r\n return x1 - x2;\r\n });\r\n }\r\n // indexing each value\r\n i = 0;\r\n t.values.forEach(function (v) {\r\n v.index = i++;\r\n });\r\n // this needs to be sorted because its index and value.index is identical\r\n $$.data.xs[t.id].sort(function (v1, v2) {\r\n return v1 - v2;\r\n });\r\n });\r\n\r\n // cache information about values\r\n $$.hasNegativeValue = $$.hasNegativeValueInTargets(targets);\r\n $$.hasPositiveValue = $$.hasPositiveValueInTargets(targets);\r\n\r\n // set target types\r\n if (config.data_type) {\r\n $$.setTargetType($$.mapToIds(targets).filter(function (id) { return ! (id in config.data_types); }), config.data_type);\r\n }\r\n\r\n // cache as original id keyed\r\n targets.forEach(function (d) {\r\n $$.addCache(d.id_org, d);\r\n });\r\n\r\n return targets;\r\n };\r\n\r\n c3_chart_internal_fn.load = function (targets, args) {\r\n var $$ = this;\r\n if (targets) {\r\n // filter loading targets if needed\r\n if (args.filter) {\r\n targets = targets.filter(args.filter);\r\n }\r\n // set type if args.types || args.type specified\r\n if (args.type || args.types) {\r\n targets.forEach(function (t) {\r\n var type = args.types && args.types[t.id] ? args.types[t.id] : args.type;\r\n $$.setTargetType(t.id, type);\r\n });\r\n }\r\n // Update/Add data\r\n $$.data.targets.forEach(function (d) {\r\n for (var i = 0; i < targets.length; i++) {\r\n if (d.id === targets[i].id) {\r\n d.values = targets[i].values;\r\n targets.splice(i, 1);\r\n break;\r\n }\r\n }\r\n });\r\n $$.data.targets = $$.data.targets.concat(targets); // add remained\r\n }\r\n\r\n // Set targets\r\n $$.updateTargets($$.data.targets);\r\n\r\n // Redraw with new targets\r\n $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true});\r\n\r\n if (args.done) { args.done(); }\r\n };\r\n c3_chart_internal_fn.loadFromArgs = function (args) {\r\n var $$ = this;\r\n if (args.data) {\r\n $$.load($$.convertDataToTargets(args.data), args);\r\n }\r\n else if (args.url) {\r\n $$.convertUrlToData(args.url, args.mimeType, args.headers, args.keys, function (data) {\r\n $$.load($$.convertDataToTargets(data), args);\r\n });\r\n }\r\n else if (args.json) {\r\n $$.load($$.convertDataToTargets($$.convertJsonToData(args.json, args.keys)), args);\r\n }\r\n else if (args.rows) {\r\n $$.load($$.convertDataToTargets($$.convertRowsToData(args.rows)), args);\r\n }\r\n else if (args.columns) {\r\n $$.load($$.convertDataToTargets($$.convertColumnsToData(args.columns)), args);\r\n }\r\n else {\r\n $$.load(null, args);\r\n }\r\n };\r\n c3_chart_internal_fn.unload = function (targetIds, done) {\r\n var $$ = this;\r\n if (!done) {\r\n done = function () {};\r\n }\r\n // filter existing target\r\n targetIds = targetIds.filter(function (id) { return $$.hasTarget($$.data.targets, id); });\r\n // If no target, call done and return\r\n if (!targetIds || targetIds.length === 0) {\r\n done();\r\n return;\r\n }\r\n $$.svg.selectAll(targetIds.map(function (id) { return $$.selectorTarget(id); }))\r\n .transition()\r\n .style('opacity', 0)\r\n .remove()\r\n .call($$.endall, done);\r\n targetIds.forEach(function (id) {\r\n // Reset fadein for future load\r\n $$.withoutFadeIn[id] = false;\r\n // Remove target's elements\r\n if ($$.legend) {\r\n $$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove();\r\n }\r\n // Remove target\r\n $$.data.targets = $$.data.targets.filter(function (t) {\r\n return t.id !== id;\r\n });\r\n });\r\n };\r\n\r\n c3_chart_internal_fn.categoryName = function (i) {\r\n var config = this.config;\r\n return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i;\r\n };\r\n\r\n c3_chart_internal_fn.initEventRect = function () {\r\n var $$ = this;\r\n $$.main.select('.' + CLASS.chart).append(\"g\")\r\n .attr(\"class\", CLASS.eventRects)\r\n .style('fill-opacity', 0);\r\n };\r\n c3_chart_internal_fn.redrawEventRect = function () {\r\n var $$ = this, config = $$.config,\r\n eventRectUpdate, maxDataCountTarget,\r\n isMultipleX = $$.isMultipleX();\r\n\r\n // rects for mouseover\r\n var eventRects = $$.main.select('.' + CLASS.eventRects)\r\n .style('cursor', config.zoom_enabled ? config.axis_rotated ? 'ns-resize' : 'ew-resize' : null)\r\n .classed(CLASS.eventRectsMultiple, isMultipleX)\r\n .classed(CLASS.eventRectsSingle, !isMultipleX);\r\n\r\n // clear old rects\r\n eventRects.selectAll('.' + CLASS.eventRect).remove();\r\n\r\n // open as public variable\r\n $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect);\r\n\r\n if (isMultipleX) {\r\n eventRectUpdate = $$.eventRect.data([0]);\r\n // enter : only one rect will be added\r\n $$.generateEventRectsForMultipleXs(eventRectUpdate.enter());\r\n // update\r\n $$.updateEventRect(eventRectUpdate);\r\n // exit : not needed because always only one rect exists\r\n }\r\n else {\r\n // Set data and update $$.eventRect\r\n maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets);\r\n eventRects.datum(maxDataCountTarget ? maxDataCountTarget.values : []);\r\n $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect);\r\n eventRectUpdate = $$.eventRect.data(function (d) { return d; });\r\n // enter\r\n $$.generateEventRectsForSingleX(eventRectUpdate.enter());\r\n // update\r\n $$.updateEventRect(eventRectUpdate);\r\n // exit\r\n eventRectUpdate.exit().remove();\r\n }\r\n };\r\n c3_chart_internal_fn.updateEventRect = function (eventRectUpdate) {\r\n var $$ = this, config = $$.config,\r\n x, y, w, h, rectW, rectX;\r\n\r\n // set update selection if null\r\n eventRectUpdate = eventRectUpdate || $$.eventRect.data(function (d) { return d; });\r\n\r\n if ($$.isMultipleX()) {\r\n // TODO: rotated not supported yet\r\n x = 0;\r\n y = 0;\r\n w = $$.width;\r\n h = $$.height;\r\n }\r\n else {\r\n if (($$.isCustomX() || $$.isTimeSeries()) && !$$.isCategorized()) {\r\n\r\n // update index for x that is used by prevX and nextX\r\n $$.updateXs();\r\n\r\n rectW = function (d) {\r\n var prevX = $$.getPrevX(d.index), nextX = $$.getNextX(d.index);\r\n\r\n // if there this is a single data point make the eventRect full width (or height)\r\n if (prevX === null && nextX === null) {\r\n return config.axis_rotated ? $$.height : $$.width;\r\n }\r\n\r\n if (prevX === null) { prevX = $$.x.domain()[0]; }\r\n if (nextX === null) { nextX = $$.x.domain()[1]; }\r\n\r\n return Math.max(0, ($$.x(nextX) - $$.x(prevX)) / 2);\r\n };\r\n rectX = function (d) {\r\n var prevX = $$.getPrevX(d.index), nextX = $$.getNextX(d.index),\r\n thisX = $$.data.xs[d.id][d.index];\r\n\r\n // if there this is a single data point position the eventRect at 0\r\n if (prevX === null && nextX === null) {\r\n return 0;\r\n }\r\n\r\n if (prevX === null) { prevX = $$.x.domain()[0]; }\r\n\r\n return ($$.x(thisX) + $$.x(prevX)) / 2;\r\n };\r\n } else {\r\n rectW = $$.getEventRectWidth();\r\n rectX = function (d) {\r\n return $$.x(d.x) - (rectW / 2);\r\n };\r\n }\r\n x = config.axis_rotated ? 0 : rectX;\r\n y = config.axis_rotated ? rectX : 0;\r\n w = config.axis_rotated ? $$.width : rectW;\r\n h = config.axis_rotated ? rectW : $$.height;\r\n }\r\n\r\n eventRectUpdate\r\n .attr('class', $$.classEvent.bind($$))\r\n .attr(\"x\", x)\r\n .attr(\"y\", y)\r\n .attr(\"width\", w)\r\n .attr(\"height\", h);\r\n };\r\n c3_chart_internal_fn.generateEventRectsForSingleX = function (eventRectEnter) {\r\n var $$ = this, d3 = $$.d3, config = $$.config;\r\n eventRectEnter.append(\"rect\")\r\n .attr(\"class\", $$.classEvent.bind($$))\r\n .style(\"cursor\", config.data_selection_enabled && config.data_selection_grouped ? \"pointer\" : null)\r\n .on('mouseover', function (d) {\r\n var index = d.index;\r\n\r\n if ($$.dragging || $$.flowing) { return; } // do nothing while dragging/flowing\r\n if ($$.hasArcType()) { return; }\r\n\r\n // Expand shapes for selection\r\n if (config.point_focus_expand_enabled) { $$.expandCircles(index, null, true); }\r\n $$.expandBars(index, null, true);\r\n\r\n // Call event handler\r\n $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {\r\n config.data_onmouseover.call($$.api, d);\r\n });\r\n })\r\n .on('mouseout', function (d) {\r\n var index = d.index;\r\n if (!$$.config) { return; } // chart is destroyed\r\n if ($$.hasArcType()) { return; }\r\n $$.hideXGridFocus();\r\n $$.hideTooltip();\r\n // Undo expanded shapes\r\n $$.unexpandCircles();\r\n $$.unexpandBars();\r\n // Call event handler\r\n $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {\r\n config.data_onmouseout.call($$.api, d);\r\n });\r\n })\r\n .on('mousemove', function (d) {\r\n var selectedData, index = d.index,\r\n eventRect = $$.svg.select('.' + CLASS.eventRect + '-' + index);\r\n\r\n if ($$.dragging || $$.flowing) { return; } // do nothing while dragging/flowing\r\n if ($$.hasArcType()) { return; }\r\n\r\n if ($$.isStepType(d) && $$.config.line_step_type === 'step-after' && d3.mouse(this)[0] < $$.x($$.getXValue(d.id, index))) {\r\n index -= 1;\r\n }\r\n\r\n // Show tooltip\r\n selectedData = $$.filterTargetsToShow($$.data.targets).map(function (t) {\r\n return $$.addName($$.getValueOnIndex(t.values, index));\r\n });\r\n\r\n if (config.tooltip_grouped) {\r\n $$.showTooltip(selectedData, this);\r\n $$.showXGridFocus(selectedData);\r\n }\r\n\r\n if (config.tooltip_grouped && (!config.data_selection_enabled || config.data_selection_grouped)) {\r\n return;\r\n }\r\n\r\n $$.main.selectAll('.' + CLASS.shape + '-' + index)\r\n .each(function () {\r\n d3.select(this).classed(CLASS.EXPANDED, true);\r\n if (config.data_selection_enabled) {\r\n eventRect.style('cursor', config.data_selection_grouped ? 'pointer' : null);\r\n }\r\n if (!config.tooltip_grouped) {\r\n $$.hideXGridFocus();\r\n $$.hideTooltip();\r\n if (!config.data_selection_grouped) {\r\n $$.unexpandCircles(index);\r\n $$.unexpandBars(index);\r\n }\r\n }\r\n })\r\n .filter(function (d) {\r\n return $$.isWithinShape(this, d);\r\n })\r\n .each(function (d) {\r\n if (config.data_selection_enabled && (config.data_selection_grouped || config.data_selection_isselectable(d))) {\r\n eventRect.style('cursor', 'pointer');\r\n }\r\n if (!config.tooltip_grouped) {\r\n $$.showTooltip([d], this);\r\n $$.showXGridFocus([d]);\r\n if (config.point_focus_expand_enabled) { $$.expandCircles(index, d.id, true); }\r\n $$.expandBars(index, d.id, true);\r\n }\r\n });\r\n })\r\n .on('click', function (d) {\r\n var index = d.index;\r\n if ($$.hasArcType() || !$$.toggleShape) { return; }\r\n if ($$.cancelClick) {\r\n $$.cancelClick = false;\r\n return;\r\n }\r\n if ($$.isStepType(d) && config.line_step_type === 'step-after' && d3.mouse(this)[0] < $$.x($$.getXValue(d.id, index))) {\r\n index -= 1;\r\n }\r\n $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {\r\n if (config.data_selection_grouped || $$.isWithinShape(this, d)) {\r\n $$.toggleShape(this, d, index);\r\n $$.config.data_onclick.call($$.api, d, this);\r\n }\r\n });\r\n })\r\n .call(\r\n config.data_selection_draggable && $$.drag ? (\r\n d3.behavior.drag().origin(Object)\r\n .on('drag', function () { $$.drag(d3.mouse(this)); })\r\n .on('dragstart', function () { $$.dragstart(d3.mouse(this)); })\r\n .on('dragend', function () { $$.dragend(); })\r\n ) : function () {}\r\n );\r\n };\r\n\r\n c3_chart_internal_fn.generateEventRectsForMultipleXs = function (eventRectEnter) {\r\n var $$ = this, d3 = $$.d3, config = $$.config;\r\n\r\n function mouseout() {\r\n $$.svg.select('.' + CLASS.eventRect).style('cursor', null);\r\n $$.hideXGridFocus();\r\n $$.hideTooltip();\r\n $$.unexpandCircles();\r\n $$.unexpandBars();\r\n }\r\n\r\n eventRectEnter.append('rect')\r\n .attr('x', 0)\r\n .attr('y', 0)\r\n .attr('width', $$.width)\r\n .attr('height', $$.height)\r\n .attr('class', CLASS.eventRect)\r\n .on('mouseout', function () {\r\n if (!$$.config) { return; } // chart is destroyed\r\n if ($$.hasArcType()) { return; }\r\n mouseout();\r\n })\r\n .on('mousemove', function () {\r\n var targetsToShow = $$.filterTargetsToShow($$.data.targets);\r\n var mouse, closest, sameXData, selectedData;\r\n\r\n if ($$.dragging) { return; } // do nothing when dragging\r\n if ($$.hasArcType(targetsToShow)) { return; }\r\n\r\n mouse = d3.mouse(this);\r\n closest = $$.findClosestFromTargets(targetsToShow, mouse);\r\n\r\n if ($$.mouseover && (!closest || closest.id !== $$.mouseover.id)) {\r\n config.data_onmouseout.call($$.api, $$.mouseover);\r\n $$.mouseover = undefined;\r\n }\r\n\r\n if (! closest) {\r\n mouseout();\r\n return;\r\n }\r\n\r\n if ($$.isScatterType(closest) || !config.tooltip_grouped) {\r\n sameXData = [closest];\r\n } else {\r\n sameXData = $$.filterByX(targetsToShow, closest.x);\r\n }\r\n\r\n // show tooltip when cursor is close to some point\r\n selectedData = sameXData.map(function (d) {\r\n return $$.addName(d);\r\n });\r\n $$.showTooltip(selectedData, this);\r\n\r\n // expand points\r\n if (config.point_focus_expand_enabled) {\r\n $$.expandCircles(closest.index, closest.id, true);\r\n }\r\n $$.expandBars(closest.index, closest.id, true);\r\n\r\n // Show xgrid focus line\r\n $$.showXGridFocus(selectedData);\r\n\r\n // Show cursor as pointer if point is close to mouse position\r\n if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {\r\n $$.svg.select('.' + CLASS.eventRect).style('cursor', 'pointer');\r\n if (!$$.mouseover) {\r\n config.data_onmouseover.call($$.api, closest);\r\n $$.mouseover = closest;\r\n }\r\n }\r\n })\r\n .on('click', function () {\r\n var targetsToShow = $$.filterTargetsToShow($$.data.targets);\r\n var mouse, closest;\r\n if ($$.hasArcType(targetsToShow)) { return; }\r\n\r\n mouse = d3.mouse(this);\r\n closest = $$.findClosestFromTargets(targetsToShow, mouse);\r\n if (! closest) { return; }\r\n // select if selection enabled\r\n if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {\r\n $$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(closest.id)).selectAll('.' + CLASS.shape + '-' + closest.index).each(function () {\r\n if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {\r\n $$.toggleShape(this, closest, closest.index);\r\n $$.config.data_onclick.call($$.api, closest, this);\r\n }\r\n });\r\n }\r\n })\r\n .call(\r\n config.data_selection_draggable && $$.drag ? (\r\n d3.behavior.drag().origin(Object)\r\n .on('drag', function () { $$.drag(d3.mouse(this)); })\r\n .on('dragstart', function () { $$.dragstart(d3.mouse(this)); })\r\n .on('dragend', function () { $$.dragend(); })\r\n ) : function () {}\r\n );\r\n };\r\n c3_chart_internal_fn.dispatchEvent = function (type, index, mouse) {\r\n var $$ = this,\r\n selector = '.' + CLASS.eventRect + (!$$.isMultipleX() ? '-' + index : ''),\r\n eventRect = $$.main.select(selector).node(),\r\n box = eventRect.getBoundingClientRect(),\r\n x = box.left + (mouse ? mouse[0] : 0),\r\n y = box.top + (mouse ? mouse[1] : 0),\r\n event = document.createEvent(\"MouseEvents\");\r\n\r\n event.initMouseEvent(type, true, true, window, 0, x, y, x, y,\r\n false, false, false, false, 0, null);\r\n eventRect.dispatchEvent(event);\r\n };\r\n\r\n c3_chart_internal_fn.getCurrentWidth = function () {\r\n var $$ = this, config = $$.config;\r\n return config.size_width ? config.size_width : $$.getParentWidth();\r\n };\r\n c3_chart_internal_fn.getCurrentHeight = function () {\r\n var $$ = this, config = $$.config,\r\n h = config.size_height ? config.size_height : $$.getParentHeight();\r\n return h > 0 ? h : 320 / ($$.hasType('gauge') ? 2 : 1);\r\n };\r\n c3_chart_internal_fn.getCurrentPaddingTop = function () {\r\n var $$ = this,\r\n config = $$.config,\r\n padding = isValue(config.padding_top) ? config.padding_top : 0;\r\n if ($$.title && $$.title.node()) {\r\n padding += $$.getTitlePadding();\r\n }\r\n return padding;\r\n };\r\n c3_chart_internal_fn.getCurrentPaddingBottom = function () {\r\n var config = this.config;\r\n return isValue(config.padding_bottom) ? config.padding_bottom : 0;\r\n };\r\n c3_chart_internal_fn.getCurrentPaddingLeft = function (withoutRecompute) {\r\n var $$ = this, config = $$.config;\r\n if (isValue(config.padding_left)) {\r\n return config.padding_left;\r\n } else if (config.axis_rotated) {\r\n return !config.axis_x_show ? 1 : Math.max(ceil10($$.getAxisWidthByAxisId('x', withoutRecompute)), 40);\r\n } else if (!config.axis_y_show || config.axis_y_inner) { // && !config.axis_rotated\r\n return $$.axis.getYAxisLabelPosition().isOuter ? 30 : 1;\r\n } else {\r\n return ceil10($$.getAxisWidthByAxisId('y', withoutRecompute));\r\n }\r\n };\r\n c3_chart_internal_fn.getCurrentPaddingRight = function () {\r\n var $$ = this, config = $$.config,\r\n defaultPadding = 10, legendWidthOnRight = $$.isLegendRight ? $$.getLegendWidth() + 20 : 0;\r\n if (isValue(config.padding_right)) {\r\n return config.padding_right + 1; // 1 is needed not to hide tick line\r\n } else if (config.axis_rotated) {\r\n return defaultPadding + legendWidthOnRight;\r\n } else if (!config.axis_y2_show || config.axis_y2_inner) { // && !config.axis_rotated\r\n return 2 + legendWidthOnRight + ($$.axis.getY2AxisLabelPosition().isOuter ? 20 : 0);\r\n } else {\r\n return ceil10($$.getAxisWidthByAxisId('y2')) + legendWidthOnRight;\r\n }\r\n };\r\n\r\n c3_chart_internal_fn.getParentRectValue = function (key) {\r\n var parent = this.selectChart.node(), v;\r\n while (parent && parent.tagName !== 'BODY') {\r\n try {\r\n v = parent.getBoundingClientRect()[key];\r\n } catch(e) {\r\n if (key === 'width') {\r\n // In IE in certain cases getBoundingClientRect\r\n // will cause an \"unspecified error\"\r\n v = parent.offsetWidth;\r\n }\r\n }\r\n if (v) {\r\n break;\r\n }\r\n parent = parent.parentNode;\r\n }\r\n return v;\r\n };\r\n c3_chart_internal_fn.getParentWidth = function () {\r\n return this.getParentRectValue('width');\r\n };\r\n c3_chart_internal_fn.getParentHeight = function () {\r\n var h = this.selectChart.style('height');\r\n return h.indexOf('px') > 0 ? +h.replace('px', '') : 0;\r\n };\r\n\r\n\r\n c3_chart_internal_fn.getSvgLeft = function (withoutRecompute) {\r\n var $$ = this, config = $$.config,\r\n hasLeftAxisRect = config.axis_rotated || (!config.axis_rotated && !config.axis_y_inner),\r\n leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY,\r\n leftAxis = $$.main.select('.' + leftAxisClass).node(),\r\n svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : {right: 0},\r\n chartRect = $$.selectChart.node().getBoundingClientRect(),\r\n hasArc = $$.hasArcType(),\r\n svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute));\r\n return svgLeft > 0 ? svgLeft : 0;\r\n };\r\n\r\n\r\n c3_chart_internal_fn.getAxisWidthByAxisId = function (id, withoutRecompute) {\r\n var $$ = this, position = $$.axis.getLabelPositionById(id);\r\n return $$.axis.getMaxTickWidth(id, withoutRecompute) + (position.isInner ? 20 : 40);\r\n };\r\n c3_chart_internal_fn.getHorizontalAxisHeight = function (axisId) {\r\n var $$ = this, config = $$.config, h = 30;\r\n if (axisId === 'x' && !config.axis_x_show) { return 8; }\r\n if (axisId === 'x' && config.axis_x_height) { return config.axis_x_height; }\r\n if (axisId === 'y' && !config.axis_y_show) {\r\n return config.legend_show && !$$.isLegendRight && !$$.isLegendInset ? 10 : 1;\r\n }\r\n if (axisId === 'y2' && !config.axis_y2_show) { return $$.rotated_padding_top; }\r\n // Calculate x axis height when tick rotated\r\n if (axisId === 'x' && !config.axis_rotated && config.axis_x_tick_rotate) {\r\n h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - config.axis_x_tick_rotate) / 180);\r\n }\r\n // Calculate y axis height when tick rotated\r\n if (axisId === 'y' && config.axis_rotated && config.axis_y_tick_rotate) {\r\n h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - config.axis_y_tick_rotate) / 180);\r\n }\r\n return h + ($$.axis.getLabelPositionById(axisId).isInner ? 0 : 10) + (axisId === 'y2' ? -10 : 0);\r\n };\r\n\r\n c3_chart_internal_fn.getEventRectWidth = function () {\r\n return Math.max(0, this.xAxis.tickInterval());\r\n };\r\n\r\n c3_chart_internal_fn.getShapeIndices = function (typeFilter) {\r\n var $$ = this, config = $$.config,\r\n indices = {}, i = 0, j, k;\r\n $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach(function (d) {\r\n for (j = 0; j < config.data_groups.length; j++) {\r\n if (config.data_groups[j].indexOf(d.id) < 0) { continue; }\r\n for (k = 0; k < config.data_groups[j].length; k++) {\r\n if (config.data_groups[j][k] in indices) {\r\n indices[d.id] = indices[config.data_groups[j][k]];\r\n break;\r\n }\r\n }\r\n }\r\n if (isUndefined(indices[d.id])) { indices[d.id] = i++; }\r\n });\r\n indices.__max__ = i - 1;\r\n return indices;\r\n };\r\n c3_chart_internal_fn.getShapeX = function (offset, targetsNum, indices, isSub) {\r\n var $$ = this, scale = isSub ? $$.subX : $$.x;\r\n return function (d) {\r\n var index = d.id in indices ? indices[d.id] : 0;\r\n return d.x || d.x === 0 ? scale(d.x) - offset * (targetsNum / 2 - index) : 0;\r\n };\r\n };\r\n c3_chart_internal_fn.getShapeY = function (isSub) {\r\n var $$ = this;\r\n return function (d) {\r\n var scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id);\r\n return scale(d.value);\r\n };\r\n };\r\n c3_chart_internal_fn.getShapeOffset = function (typeFilter, indices, isSub) {\r\n var $$ = this,\r\n targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))),\r\n targetIds = targets.map(function (t) { return t.id; });\r\n return function (d, i) {\r\n var scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id),\r\n y0 = scale(0), offset = y0;\r\n targets.forEach(function (t) {\r\n var values = $$.isStepType(d) ? $$.convertValuesToStep(t.values) : t.values;\r\n if (t.id === d.id || indices[t.id] !== indices[d.id]) { return; }\r\n if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id)) {\r\n // check if the x values line up\r\n if (typeof values[i] === 'undefined' || +values[i].x !== +d.x) { // \"+\" for timeseries\r\n // if not, try to find the value that does line up\r\n i = -1;\r\n values.forEach(function (v, j) {\r\n if (v.x === d.x) {\r\n i = j;\r\n }\r\n });\r\n }\r\n if (i in values && values[i].value * d.value >= 0) {\r\n offset += scale(values[i].value) - y0;\r\n }\r\n }\r\n });\r\n return offset;\r\n };\r\n };\r\n c3_chart_internal_fn.isWithinShape = function (that, d) {\r\n var $$ = this,\r\n shape = $$.d3.select(that), isWithin;\r\n if (!$$.isTargetToShow(d.id)) {\r\n isWithin = false;\r\n }\r\n else if (that.nodeName === 'circle') {\r\n isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScale(d.id)(d.value)) : $$.isWithinCircle(that, $$.pointSelectR(d) * 1.5);\r\n }\r\n else if (that.nodeName === 'path') {\r\n isWithin = shape.classed(CLASS.bar) ? $$.isWithinBar(that) : true;\r\n }\r\n return isWithin;\r\n };\r\n\r\n\r\n c3_chart_internal_fn.getInterpolate = function (d) {\r\n var $$ = this,\r\n interpolation = $$.isInterpolationType($$.config.spline_interpolation_type) ? $$.config.spline_interpolation_type : 'cardinal';\r\n return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? $$.config.line_step_type : \"linear\";\r\n };\r\n\r\n c3_chart_internal_fn.initLine = function () {\r\n var $$ = this;\r\n $$.main.select('.' + CLASS.chart).append(\"g\")\r\n .attr(\"class\", CLASS.chartLines);\r\n };\r\n c3_chart_internal_fn.updateTargetsForLine = function (targets) {\r\n var $$ = this, config = $$.config,\r\n mainLineUpdate, mainLineEnter,\r\n classChartLine = $$.classChartLine.bind($$),\r\n classLines = $$.classLines.bind($$),\r\n classAreas = $$.classAreas.bind($$),\r\n classCircles = $$.classCircles.bind($$),\r\n classFocus = $$.classFocus.bind($$);\r\n mainLineUpdate = $$.main.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine)\r\n .data(targets)\r\n .attr('class', function (d) { return classChartLine(d) + classFocus(d); });\r\n mainLineEnter = mainLineUpdate.enter().append('g')\r\n .attr('class', classChartLine)\r\n .style('opacity', 0)\r\n .style(\"pointer-events\", \"none\");\r\n // Lines for each data\r\n mainLineEnter.append('g')\r\n .attr(\"class\", classLines);\r\n // Areas\r\n mainLineEnter.append('g')\r\n .attr('class', classAreas);\r\n // Circles for each data point on lines\r\n mainLineEnter.append('g')\r\n .attr(\"class\", function (d) { return $$.generateClass(CLASS.selectedCircles, d.id); });\r\n mainLineEnter.append('g')\r\n .attr(\"class\", classCircles)\r\n .style(\"cursor\", function (d) { return config.data_selection_isselectable(d) ? \"pointer\" : null; });\r\n // Update date for selected circles\r\n targets.forEach(function (t) {\r\n $$.main.selectAll('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS.selectedCircle).each(function (d) {\r\n d.value = t.values[d.index].value;\r\n });\r\n });\r\n // MEMO: can not keep same color...\r\n //mainLineUpdate.exit().remove();\r\n };\r\n c3_chart_internal_fn.updateLine = function (durationForExit) {\r\n var $$ = this;\r\n $$.mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line)\r\n .data($$.lineData.bind($$));\r\n $$.mainLine.enter().append('path')\r\n .attr('class', $$.classLine.bind($$))\r\n .style(\"stroke\", $$.color);\r\n $$.mainLine\r\n .style(\"opacity\", $$.initialOpacity.bind($$))\r\n .style('shape-rendering', function (d) { return $$.isStepType(d) ? 'crispEdges' : ''; })\r\n .attr('transform', null);\r\n $$.mainLine.exit().transition().duration(durationForExit)\r\n .style('opacity', 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawLine = function (drawLine, withTransition) {\r\n return [\r\n (withTransition ? this.mainLine.transition(Math.random().toString()) : this.mainLine)\r\n .attr(\"d\", drawLine)\r\n .style(\"stroke\", this.color)\r\n .style(\"opacity\", 1)\r\n ];\r\n };\r\n c3_chart_internal_fn.generateDrawLine = function (lineIndices, isSub) {\r\n var $$ = this, config = $$.config,\r\n line = $$.d3.svg.line(),\r\n getPoints = $$.generateGetLinePoints(lineIndices, isSub),\r\n yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale,\r\n xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); },\r\n yValue = function (d, i) {\r\n return config.data_groups.length > 0 ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)(d.value);\r\n };\r\n\r\n line = config.axis_rotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue);\r\n if (!config.line_connectNull) { line = line.defined(function (d) { return d.value != null; }); }\r\n return function (d) {\r\n var values = config.line_connectNull ? $$.filterRemoveNull(d.values) : d.values,\r\n x = isSub ? $$.x : $$.subX, y = yScaleGetter.call($$, d.id), x0 = 0, y0 = 0, path;\r\n if ($$.isLineType(d)) {\r\n if (config.data_regions[d.id]) {\r\n path = $$.lineWithRegions(values, x, y, config.data_regions[d.id]);\r\n } else {\r\n if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); }\r\n path = line.interpolate($$.getInterpolate(d))(values);\r\n }\r\n } else {\r\n if (values[0]) {\r\n x0 = x(values[0].x);\r\n y0 = y(values[0].value);\r\n }\r\n path = config.axis_rotated ? \"M \" + y0 + \" \" + x0 : \"M \" + x0 + \" \" + y0;\r\n }\r\n return path ? path : \"M 0 0\";\r\n };\r\n };\r\n c3_chart_internal_fn.generateGetLinePoints = function (lineIndices, isSub) { // partial duplication of generateGetBarPoints\r\n var $$ = this, config = $$.config,\r\n lineTargetsNum = lineIndices.__max__ + 1,\r\n x = $$.getShapeX(0, lineTargetsNum, lineIndices, !!isSub),\r\n y = $$.getShapeY(!!isSub),\r\n lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, !!isSub),\r\n yScale = isSub ? $$.getSubYScale : $$.getYScale;\r\n return function (d, i) {\r\n var y0 = yScale.call($$, d.id)(0),\r\n offset = lineOffset(d, i) || y0, // offset is for stacked area chart\r\n posX = x(d), posY = y(d);\r\n // fix posY not to overflow opposite quadrant\r\n if (config.axis_rotated) {\r\n if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; }\r\n }\r\n // 1 point that marks the line position\r\n return [\r\n [posX, posY - (y0 - offset)],\r\n [posX, posY - (y0 - offset)], // needed for compatibility\r\n [posX, posY - (y0 - offset)], // needed for compatibility\r\n [posX, posY - (y0 - offset)] // needed for compatibility\r\n ];\r\n };\r\n };\r\n\r\n\r\n c3_chart_internal_fn.lineWithRegions = function (d, x, y, _regions) {\r\n var $$ = this, config = $$.config,\r\n prev = -1, i, j,\r\n s = \"M\", sWithRegion,\r\n xp, yp, dx, dy, dd, diff, diffx2,\r\n xOffset = $$.isCategorized() ? 0.5 : 0,\r\n xValue, yValue,\r\n regions = [];\r\n\r\n function isWithinRegions(x, regions) {\r\n var i;\r\n for (i = 0; i < regions.length; i++) {\r\n if (regions[i].start < x && x <= regions[i].end) { return true; }\r\n }\r\n return false;\r\n }\r\n\r\n // Check start/end of regions\r\n if (isDefined(_regions)) {\r\n for (i = 0; i < _regions.length; i++) {\r\n regions[i] = {};\r\n if (isUndefined(_regions[i].start)) {\r\n regions[i].start = d[0].x;\r\n } else {\r\n regions[i].start = $$.isTimeSeries() ? $$.parseDate(_regions[i].start) : _regions[i].start;\r\n }\r\n if (isUndefined(_regions[i].end)) {\r\n regions[i].end = d[d.length - 1].x;\r\n } else {\r\n regions[i].end = $$.isTimeSeries() ? $$.parseDate(_regions[i].end) : _regions[i].end;\r\n }\r\n }\r\n }\r\n\r\n // Set scales\r\n xValue = config.axis_rotated ? function (d) { return y(d.value); } : function (d) { return x(d.x); };\r\n yValue = config.axis_rotated ? function (d) { return x(d.x); } : function (d) { return y(d.value); };\r\n\r\n // Define svg generator function for region\r\n function generateM(points) {\r\n return 'M' + points[0][0] + ' ' + points[0][1] + ' ' + points[1][0] + ' ' + points[1][1];\r\n }\r\n if ($$.isTimeSeries()) {\r\n sWithRegion = function (d0, d1, j, diff) {\r\n var x0 = d0.x.getTime(), x_diff = d1.x - d0.x,\r\n xv0 = new Date(x0 + x_diff * j),\r\n xv1 = new Date(x0 + x_diff * (j + diff)),\r\n points;\r\n if (config.axis_rotated) {\r\n points = [[y(yp(j)), x(xv0)], [y(yp(j + diff)), x(xv1)]];\r\n } else {\r\n points = [[x(xv0), y(yp(j))], [x(xv1), y(yp(j + diff))]];\r\n }\r\n return generateM(points);\r\n };\r\n } else {\r\n sWithRegion = function (d0, d1, j, diff) {\r\n var points;\r\n if (config.axis_rotated) {\r\n points = [[y(yp(j), true), x(xp(j))], [y(yp(j + diff), true), x(xp(j + diff))]];\r\n } else {\r\n points = [[x(xp(j), true), y(yp(j))], [x(xp(j + diff), true), y(yp(j + diff))]];\r\n }\r\n return generateM(points);\r\n };\r\n }\r\n\r\n // Generate\r\n for (i = 0; i < d.length; i++) {\r\n\r\n // Draw as normal\r\n if (isUndefined(regions) || ! isWithinRegions(d[i].x, regions)) {\r\n s += \" \" + xValue(d[i]) + \" \" + yValue(d[i]);\r\n }\r\n // Draw with region // TODO: Fix for horizotal charts\r\n else {\r\n xp = $$.getScale(d[i - 1].x + xOffset, d[i].x + xOffset, $$.isTimeSeries());\r\n yp = $$.getScale(d[i - 1].value, d[i].value);\r\n\r\n dx = x(d[i].x) - x(d[i - 1].x);\r\n dy = y(d[i].value) - y(d[i - 1].value);\r\n dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));\r\n diff = 2 / dd;\r\n diffx2 = diff * 2;\r\n\r\n for (j = diff; j <= 1; j += diffx2) {\r\n s += sWithRegion(d[i - 1], d[i], j, diff);\r\n }\r\n }\r\n prev = d[i].x;\r\n }\r\n\r\n return s;\r\n };\r\n\r\n\r\n c3_chart_internal_fn.updateArea = function (durationForExit) {\r\n var $$ = this, d3 = $$.d3;\r\n $$.mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)\r\n .data($$.lineData.bind($$));\r\n $$.mainArea.enter().append('path')\r\n .attr(\"class\", $$.classArea.bind($$))\r\n .style(\"fill\", $$.color)\r\n .style(\"opacity\", function () { $$.orgAreaOpacity = +d3.select(this).style('opacity'); return 0; });\r\n $$.mainArea\r\n .style(\"opacity\", $$.orgAreaOpacity);\r\n $$.mainArea.exit().transition().duration(durationForExit)\r\n .style('opacity', 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawArea = function (drawArea, withTransition) {\r\n return [\r\n (withTransition ? this.mainArea.transition(Math.random().toString()) : this.mainArea)\r\n .attr(\"d\", drawArea)\r\n .style(\"fill\", this.color)\r\n .style(\"opacity\", this.orgAreaOpacity)\r\n ];\r\n };\r\n c3_chart_internal_fn.generateDrawArea = function (areaIndices, isSub) {\r\n var $$ = this, config = $$.config, area = $$.d3.svg.area(),\r\n getPoints = $$.generateGetAreaPoints(areaIndices, isSub),\r\n yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale,\r\n xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); },\r\n value0 = function (d, i) {\r\n return config.data_groups.length > 0 ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.getAreaBaseValue(d.id));\r\n },\r\n value1 = function (d, i) {\r\n return config.data_groups.length > 0 ? getPoints(d, i)[1][1] : yScaleGetter.call($$, d.id)(d.value);\r\n };\r\n\r\n area = config.axis_rotated ? area.x0(value0).x1(value1).y(xValue) : area.x(xValue).y0(value0).y1(value1);\r\n if (!config.line_connectNull) {\r\n area = area.defined(function (d) { return d.value !== null; });\r\n }\r\n\r\n return function (d) {\r\n var values = config.line_connectNull ? $$.filterRemoveNull(d.values) : d.values,\r\n x0 = 0, y0 = 0, path;\r\n if ($$.isAreaType(d)) {\r\n if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); }\r\n path = area.interpolate($$.getInterpolate(d))(values);\r\n } else {\r\n if (values[0]) {\r\n x0 = $$.x(values[0].x);\r\n y0 = $$.getYScale(d.id)(values[0].value);\r\n }\r\n path = config.axis_rotated ? \"M \" + y0 + \" \" + x0 : \"M \" + x0 + \" \" + y0;\r\n }\r\n return path ? path : \"M 0 0\";\r\n };\r\n };\r\n c3_chart_internal_fn.getAreaBaseValue = function () {\r\n return 0;\r\n };\r\n c3_chart_internal_fn.generateGetAreaPoints = function (areaIndices, isSub) { // partial duplication of generateGetBarPoints\r\n var $$ = this, config = $$.config,\r\n areaTargetsNum = areaIndices.__max__ + 1,\r\n x = $$.getShapeX(0, areaTargetsNum, areaIndices, !!isSub),\r\n y = $$.getShapeY(!!isSub),\r\n areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, !!isSub),\r\n yScale = isSub ? $$.getSubYScale : $$.getYScale;\r\n return function (d, i) {\r\n var y0 = yScale.call($$, d.id)(0),\r\n offset = areaOffset(d, i) || y0, // offset is for stacked area chart\r\n posX = x(d), posY = y(d);\r\n // fix posY not to overflow opposite quadrant\r\n if (config.axis_rotated) {\r\n if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; }\r\n }\r\n // 1 point that marks the area position\r\n return [\r\n [posX, offset],\r\n [posX, posY - (y0 - offset)],\r\n [posX, posY - (y0 - offset)], // needed for compatibility\r\n [posX, offset] // needed for compatibility\r\n ];\r\n };\r\n };\r\n\r\n\r\n c3_chart_internal_fn.updateCircle = function () {\r\n var $$ = this;\r\n $$.mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle)\r\n .data($$.lineOrScatterData.bind($$));\r\n $$.mainCircle.enter().append(\"circle\")\r\n .attr(\"class\", $$.classCircle.bind($$))\r\n .attr(\"r\", $$.pointR.bind($$))\r\n .style(\"fill\", $$.color);\r\n $$.mainCircle\r\n .style(\"opacity\", $$.initialOpacityForCircle.bind($$));\r\n $$.mainCircle.exit().remove();\r\n };\r\n c3_chart_internal_fn.redrawCircle = function (cx, cy, withTransition) {\r\n var selectedCircles = this.main.selectAll('.' + CLASS.selectedCircle);\r\n return [\r\n (withTransition ? this.mainCircle.transition(Math.random().toString()) : this.mainCircle)\r\n .style('opacity', this.opacityForCircle.bind(this))\r\n .style(\"fill\", this.color)\r\n .attr(\"cx\", cx)\r\n .attr(\"cy\", cy),\r\n (withTransition ? selectedCircles.transition(Math.random().toString()) : selectedCircles)\r\n .attr(\"cx\", cx)\r\n .attr(\"cy\", cy)\r\n ];\r\n };\r\n c3_chart_internal_fn.circleX = function (d) {\r\n return d.x || d.x === 0 ? this.x(d.x) : null;\r\n };\r\n c3_chart_internal_fn.updateCircleY = function () {\r\n var $$ = this, lineIndices, getPoints;\r\n if ($$.config.data_groups.length > 0) {\r\n lineIndices = $$.getShapeIndices($$.isLineType),\r\n getPoints = $$.generateGetLinePoints(lineIndices);\r\n $$.circleY = function (d, i) {\r\n return getPoints(d, i)[0][1];\r\n };\r\n } else {\r\n $$.circleY = function (d) {\r\n return $$.getYScale(d.id)(d.value);\r\n };\r\n }\r\n };\r\n c3_chart_internal_fn.getCircles = function (i, id) {\r\n var $$ = this;\r\n return (id ? $$.main.selectAll('.' + CLASS.circles + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.circle + (isValue(i) ? '-' + i : ''));\r\n };\r\n c3_chart_internal_fn.expandCircles = function (i, id, reset) {\r\n var $$ = this,\r\n r = $$.pointExpandedR.bind($$);\r\n if (reset) { $$.unexpandCircles(); }\r\n $$.getCircles(i, id)\r\n .classed(CLASS.EXPANDED, true)\r\n .attr('r', r);\r\n };\r\n c3_chart_internal_fn.unexpandCircles = function (i) {\r\n var $$ = this,\r\n r = $$.pointR.bind($$);\r\n $$.getCircles(i)\r\n .filter(function () { return $$.d3.select(this).classed(CLASS.EXPANDED); })\r\n .classed(CLASS.EXPANDED, false)\r\n .attr('r', r);\r\n };\r\n c3_chart_internal_fn.pointR = function (d) {\r\n var $$ = this, config = $$.config;\r\n return $$.isStepType(d) ? 0 : (isFunction(config.point_r) ? config.point_r(d) : config.point_r);\r\n };\r\n c3_chart_internal_fn.pointExpandedR = function (d) {\r\n var $$ = this, config = $$.config;\r\n return config.point_focus_expand_enabled ? (config.point_focus_expand_r ? config.point_focus_expand_r : $$.pointR(d) * 1.75) : $$.pointR(d);\r\n };\r\n c3_chart_internal_fn.pointSelectR = function (d) {\r\n var $$ = this, config = $$.config;\r\n return config.point_select_r ? config.point_select_r : $$.pointR(d) * 4;\r\n };\r\n c3_chart_internal_fn.isWithinCircle = function (that, r) {\r\n var d3 = this.d3,\r\n mouse = d3.mouse(that), d3_this = d3.select(that),\r\n cx = +d3_this.attr(\"cx\"), cy = +d3_this.attr(\"cy\");\r\n return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < r;\r\n };\r\n c3_chart_internal_fn.isWithinStep = function (that, y) {\r\n return Math.abs(y - this.d3.mouse(that)[1]) < 30;\r\n };\r\n\r\n c3_chart_internal_fn.initBar = function () {\r\n var $$ = this;\r\n $$.main.select('.' + CLASS.chart).append(\"g\")\r\n .attr(\"class\", CLASS.chartBars);\r\n };\r\n c3_chart_internal_fn.updateTargetsForBar = function (targets) {\r\n var $$ = this, config = $$.config,\r\n mainBarUpdate, mainBarEnter,\r\n classChartBar = $$.classChartBar.bind($$),\r\n classBars = $$.classBars.bind($$),\r\n classFocus = $$.classFocus.bind($$);\r\n mainBarUpdate = $$.main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar)\r\n .data(targets)\r\n .attr('class', function (d) { return classChartBar(d) + classFocus(d); });\r\n mainBarEnter = mainBarUpdate.enter().append('g')\r\n .attr('class', classChartBar)\r\n .style('opacity', 0)\r\n .style(\"pointer-events\", \"none\");\r\n // Bars for each data\r\n mainBarEnter.append('g')\r\n .attr(\"class\", classBars)\r\n .style(\"cursor\", function (d) { return config.data_selection_isselectable(d) ? \"pointer\" : null; });\r\n\r\n };\r\n c3_chart_internal_fn.updateBar = function (durationForExit) {\r\n var $$ = this,\r\n barData = $$.barData.bind($$),\r\n classBar = $$.classBar.bind($$),\r\n initialOpacity = $$.initialOpacity.bind($$),\r\n color = function (d) { return $$.color(d.id); };\r\n $$.mainBar = $$.main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar)\r\n .data(barData);\r\n $$.mainBar.enter().append('path')\r\n .attr(\"class\", classBar)\r\n .style(\"stroke\", color)\r\n .style(\"fill\", color);\r\n $$.mainBar\r\n .style(\"opacity\", initialOpacity);\r\n $$.mainBar.exit().transition().duration(durationForExit)\r\n .style('opacity', 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawBar = function (drawBar, withTransition) {\r\n return [\r\n (withTransition ? this.mainBar.transition(Math.random().toString()) : this.mainBar)\r\n .attr('d', drawBar)\r\n .style(\"fill\", this.color)\r\n .style(\"opacity\", 1)\r\n ];\r\n };\r\n c3_chart_internal_fn.getBarW = function (axis, barTargetsNum) {\r\n var $$ = this, config = $$.config,\r\n w = typeof config.bar_width === 'number' ? config.bar_width : barTargetsNum ? (axis.tickInterval() * config.bar_width_ratio) / barTargetsNum : 0;\r\n return config.bar_width_max && w > config.bar_width_max ? config.bar_width_max : w;\r\n };\r\n c3_chart_internal_fn.getBars = function (i, id) {\r\n var $$ = this;\r\n return (id ? $$.main.selectAll('.' + CLASS.bars + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : ''));\r\n };\r\n c3_chart_internal_fn.expandBars = function (i, id, reset) {\r\n var $$ = this;\r\n if (reset) { $$.unexpandBars(); }\r\n $$.getBars(i, id).classed(CLASS.EXPANDED, true);\r\n };\r\n c3_chart_internal_fn.unexpandBars = function (i) {\r\n var $$ = this;\r\n $$.getBars(i).classed(CLASS.EXPANDED, false);\r\n };\r\n c3_chart_internal_fn.generateDrawBar = function (barIndices, isSub) {\r\n var $$ = this, config = $$.config,\r\n getPoints = $$.generateGetBarPoints(barIndices, isSub);\r\n return function (d, i) {\r\n // 4 points that make a bar\r\n var points = getPoints(d, i);\r\n\r\n // switch points if axis is rotated, not applicable for sub chart\r\n var indexX = config.axis_rotated ? 1 : 0;\r\n var indexY = config.axis_rotated ? 0 : 1;\r\n\r\n var path = 'M ' + points[0][indexX] + ',' + points[0][indexY] + ' ' +\r\n 'L' + points[1][indexX] + ',' + points[1][indexY] + ' ' +\r\n 'L' + points[2][indexX] + ',' + points[2][indexY] + ' ' +\r\n 'L' + points[3][indexX] + ',' + points[3][indexY] + ' ' +\r\n 'z';\r\n\r\n return path;\r\n };\r\n };\r\n c3_chart_internal_fn.generateGetBarPoints = function (barIndices, isSub) {\r\n var $$ = this,\r\n axis = isSub ? $$.subXAxis : $$.xAxis,\r\n barTargetsNum = barIndices.__max__ + 1,\r\n barW = $$.getBarW(axis, barTargetsNum),\r\n barX = $$.getShapeX(barW, barTargetsNum, barIndices, !!isSub),\r\n barY = $$.getShapeY(!!isSub),\r\n barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub),\r\n yScale = isSub ? $$.getSubYScale : $$.getYScale;\r\n return function (d, i) {\r\n var y0 = yScale.call($$, d.id)(0),\r\n offset = barOffset(d, i) || y0, // offset is for stacked bar chart\r\n posX = barX(d), posY = barY(d);\r\n // fix posY not to overflow opposite quadrant\r\n if ($$.config.axis_rotated) {\r\n if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; }\r\n }\r\n // 4 points that make a bar\r\n return [\r\n [posX, offset],\r\n [posX, posY - (y0 - offset)],\r\n [posX + barW, posY - (y0 - offset)],\r\n [posX + barW, offset]\r\n ];\r\n };\r\n };\r\n c3_chart_internal_fn.isWithinBar = function (that) {\r\n var mouse = this.d3.mouse(that), box = that.getBoundingClientRect(),\r\n seg0 = that.pathSegList.getItem(0), seg1 = that.pathSegList.getItem(1),\r\n x = Math.min(seg0.x, seg1.x), y = Math.min(seg0.y, seg1.y),\r\n w = box.width, h = box.height, offset = 2,\r\n sx = x - offset, ex = x + w + offset, sy = y + h + offset, ey = y - offset;\r\n return sx < mouse[0] && mouse[0] < ex && ey < mouse[1] && mouse[1] < sy;\r\n };\r\n\r\n c3_chart_internal_fn.initText = function () {\r\n var $$ = this;\r\n $$.main.select('.' + CLASS.chart).append(\"g\")\r\n .attr(\"class\", CLASS.chartTexts);\r\n $$.mainText = $$.d3.selectAll([]);\r\n };\r\n c3_chart_internal_fn.updateTargetsForText = function (targets) {\r\n var $$ = this, mainTextUpdate, mainTextEnter,\r\n classChartText = $$.classChartText.bind($$),\r\n classTexts = $$.classTexts.bind($$),\r\n classFocus = $$.classFocus.bind($$);\r\n mainTextUpdate = $$.main.select('.' + CLASS.chartTexts).selectAll('.' + CLASS.chartText)\r\n .data(targets)\r\n .attr('class', function (d) { return classChartText(d) + classFocus(d); });\r\n mainTextEnter = mainTextUpdate.enter().append('g')\r\n .attr('class', classChartText)\r\n .style('opacity', 0)\r\n .style(\"pointer-events\", \"none\");\r\n mainTextEnter.append('g')\r\n .attr('class', classTexts);\r\n };\r\n c3_chart_internal_fn.updateText = function (durationForExit) {\r\n var $$ = this, config = $$.config,\r\n barOrLineData = $$.barOrLineData.bind($$),\r\n classText = $$.classText.bind($$);\r\n $$.mainText = $$.main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text)\r\n .data(barOrLineData);\r\n $$.mainText.enter().append('text')\r\n .attr(\"class\", classText)\r\n .attr('text-anchor', function (d) { return config.axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; })\r\n .style(\"stroke\", 'none')\r\n .style(\"fill\", function (d) { return $$.color(d); })\r\n .style(\"fill-opacity\", 0);\r\n $$.mainText\r\n .text(function (d, i, j) { return $$.dataLabelFormat(d.id)(d.value, d.id, i, j); });\r\n $$.mainText.exit()\r\n .transition().duration(durationForExit)\r\n .style('fill-opacity', 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTransition) {\r\n return [\r\n (withTransition ? this.mainText.transition() : this.mainText)\r\n .attr('x', xForText)\r\n .attr('y', yForText)\r\n .style(\"fill\", this.color)\r\n .style(\"fill-opacity\", forFlow ? 0 : this.opacityForText.bind(this))\r\n ];\r\n };\r\n c3_chart_internal_fn.getTextRect = function (text, cls, element) {\r\n var dummy = this.d3.select('body').append('div').classed('c3', true),\r\n svg = dummy.append(\"svg\").style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0),\r\n font = this.d3.select(element).style('font'),\r\n rect;\r\n svg.selectAll('.dummy')\r\n .data([text])\r\n .enter().append('text')\r\n .classed(cls ? cls : \"\", true)\r\n .style('font', font)\r\n .text(text)\r\n .each(function () { rect = this.getBoundingClientRect(); });\r\n dummy.remove();\r\n return rect;\r\n };\r\n c3_chart_internal_fn.generateXYForText = function (areaIndices, barIndices, lineIndices, forX) {\r\n var $$ = this,\r\n getAreaPoints = $$.generateGetAreaPoints(areaIndices, false),\r\n getBarPoints = $$.generateGetBarPoints(barIndices, false),\r\n getLinePoints = $$.generateGetLinePoints(lineIndices, false),\r\n getter = forX ? $$.getXForText : $$.getYForText;\r\n return function (d, i) {\r\n var getPoints = $$.isAreaType(d) ? getAreaPoints : $$.isBarType(d) ? getBarPoints : getLinePoints;\r\n return getter.call($$, getPoints(d, i), d, this);\r\n };\r\n };\r\n c3_chart_internal_fn.getXForText = function (points, d, textElement) {\r\n var $$ = this,\r\n box = textElement.getBoundingClientRect(), xPos, padding;\r\n if ($$.config.axis_rotated) {\r\n padding = $$.isBarType(d) ? 4 : 6;\r\n xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1);\r\n } else {\r\n xPos = $$.hasType('bar') ? (points[2][0] + points[0][0]) / 2 : points[0][0];\r\n }\r\n // show labels regardless of the domain if value is null\r\n if (d.value === null) {\r\n if (xPos > $$.width) {\r\n xPos = $$.width - box.width;\r\n } else if (xPos < 0) {\r\n xPos = 4;\r\n }\r\n }\r\n return xPos;\r\n };\r\n c3_chart_internal_fn.getYForText = function (points, d, textElement) {\r\n var $$ = this,\r\n box = textElement.getBoundingClientRect(),\r\n yPos;\r\n if ($$.config.axis_rotated) {\r\n yPos = (points[0][0] + points[2][0] + box.height * 0.6) / 2;\r\n } else {\r\n yPos = points[2][1];\r\n if (d.value < 0 || (d.value === 0 && !$$.hasPositiveValue)) {\r\n yPos += box.height;\r\n if ($$.isBarType(d) && $$.isSafari()) {\r\n yPos -= 3;\r\n }\r\n else if (!$$.isBarType(d) && $$.isChrome()) {\r\n yPos += 3;\r\n }\r\n } else {\r\n yPos += $$.isBarType(d) ? -3 : -6;\r\n }\r\n }\r\n // show labels regardless of the domain if value is null\r\n if (d.value === null && !$$.config.axis_rotated) {\r\n if (yPos < box.height) {\r\n yPos = box.height;\r\n } else if (yPos > this.height) {\r\n yPos = this.height - 4;\r\n }\r\n }\r\n return yPos;\r\n };\r\n\r\n c3_chart_internal_fn.setTargetType = function (targetIds, type) {\r\n var $$ = this, config = $$.config;\r\n $$.mapToTargetIds(targetIds).forEach(function (id) {\r\n $$.withoutFadeIn[id] = (type === config.data_types[id]);\r\n config.data_types[id] = type;\r\n });\r\n if (!targetIds) {\r\n config.data_type = type;\r\n }\r\n };\r\n c3_chart_internal_fn.hasType = function (type, targets) {\r\n var $$ = this, types = $$.config.data_types, has = false;\r\n targets = targets || $$.data.targets;\r\n if (targets && targets.length) {\r\n targets.forEach(function (target) {\r\n var t = types[target.id];\r\n if ((t && t.indexOf(type) >= 0) || (!t && type === 'line')) {\r\n has = true;\r\n }\r\n });\r\n } else if (Object.keys(types).length) {\r\n Object.keys(types).forEach(function (id) {\r\n if (types[id] === type) { has = true; }\r\n });\r\n } else {\r\n has = $$.config.data_type === type;\r\n }\r\n return has;\r\n };\r\n c3_chart_internal_fn.hasArcType = function (targets) {\r\n return this.hasType('pie', targets) || this.hasType('donut', targets) || this.hasType('gauge', targets);\r\n };\r\n c3_chart_internal_fn.isLineType = function (d) {\r\n var config = this.config, id = isString(d) ? d : d.id;\r\n return !config.data_types[id] || ['line', 'spline', 'area', 'area-spline', 'step', 'area-step'].indexOf(config.data_types[id]) >= 0;\r\n };\r\n c3_chart_internal_fn.isStepType = function (d) {\r\n var id = isString(d) ? d : d.id;\r\n return ['step', 'area-step'].indexOf(this.config.data_types[id]) >= 0;\r\n };\r\n c3_chart_internal_fn.isSplineType = function (d) {\r\n var id = isString(d) ? d : d.id;\r\n return ['spline', 'area-spline'].indexOf(this.config.data_types[id]) >= 0;\r\n };\r\n c3_chart_internal_fn.isAreaType = function (d) {\r\n var id = isString(d) ? d : d.id;\r\n return ['area', 'area-spline', 'area-step'].indexOf(this.config.data_types[id]) >= 0;\r\n };\r\n c3_chart_internal_fn.isBarType = function (d) {\r\n var id = isString(d) ? d : d.id;\r\n return this.config.data_types[id] === 'bar';\r\n };\r\n c3_chart_internal_fn.isScatterType = function (d) {\r\n var id = isString(d) ? d : d.id;\r\n return this.config.data_types[id] === 'scatter';\r\n };\r\n c3_chart_internal_fn.isPieType = function (d) {\r\n var id = isString(d) ? d : d.id;\r\n return this.config.data_types[id] === 'pie';\r\n };\r\n c3_chart_internal_fn.isGaugeType = function (d) {\r\n var id = isString(d) ? d : d.id;\r\n return this.config.data_types[id] === 'gauge';\r\n };\r\n c3_chart_internal_fn.isDonutType = function (d) {\r\n var id = isString(d) ? d : d.id;\r\n return this.config.data_types[id] === 'donut';\r\n };\r\n c3_chart_internal_fn.isArcType = function (d) {\r\n return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d);\r\n };\r\n c3_chart_internal_fn.lineData = function (d) {\r\n return this.isLineType(d) ? [d] : [];\r\n };\r\n c3_chart_internal_fn.arcData = function (d) {\r\n return this.isArcType(d.data) ? [d] : [];\r\n };\r\n /* not used\r\n function scatterData(d) {\r\n return isScatterType(d) ? d.values : [];\r\n }\r\n */\r\n c3_chart_internal_fn.barData = function (d) {\r\n return this.isBarType(d) ? d.values : [];\r\n };\r\n c3_chart_internal_fn.lineOrScatterData = function (d) {\r\n return this.isLineType(d) || this.isScatterType(d) ? d.values : [];\r\n };\r\n c3_chart_internal_fn.barOrLineData = function (d) {\r\n return this.isBarType(d) || this.isLineType(d) ? d.values : [];\r\n };\r\n c3_chart_internal_fn.isInterpolationType = function (type) {\r\n return ['linear', 'linear-closed', 'basis', 'basis-open', 'basis-closed', 'bundle', 'cardinal', 'cardinal-open', 'cardinal-closed', 'monotone'].indexOf(type) >= 0;\r\n };\r\n\r\n c3_chart_internal_fn.initGrid = function () {\r\n var $$ = this, config = $$.config, d3 = $$.d3;\r\n $$.grid = $$.main.append('g')\r\n .attr(\"clip-path\", $$.clipPathForGrid)\r\n .attr('class', CLASS.grid);\r\n if (config.grid_x_show) {\r\n $$.grid.append(\"g\").attr(\"class\", CLASS.xgrids);\r\n }\r\n if (config.grid_y_show) {\r\n $$.grid.append('g').attr('class', CLASS.ygrids);\r\n }\r\n if (config.grid_focus_show) {\r\n $$.grid.append('g')\r\n .attr(\"class\", CLASS.xgridFocus)\r\n .append('line')\r\n .attr('class', CLASS.xgridFocus);\r\n }\r\n $$.xgrid = d3.selectAll([]);\r\n if (!config.grid_lines_front) { $$.initGridLines(); }\r\n };\r\n c3_chart_internal_fn.initGridLines = function () {\r\n var $$ = this, d3 = $$.d3;\r\n $$.gridLines = $$.main.append('g')\r\n .attr(\"clip-path\", $$.clipPathForGrid)\r\n .attr('class', CLASS.grid + ' ' + CLASS.gridLines);\r\n $$.gridLines.append('g').attr(\"class\", CLASS.xgridLines);\r\n $$.gridLines.append('g').attr('class', CLASS.ygridLines);\r\n $$.xgridLines = d3.selectAll([]);\r\n };\r\n c3_chart_internal_fn.updateXGrid = function (withoutUpdate) {\r\n var $$ = this, config = $$.config, d3 = $$.d3,\r\n xgridData = $$.generateGridData(config.grid_x_type, $$.x),\r\n tickOffset = $$.isCategorized() ? $$.xAxis.tickOffset() : 0;\r\n\r\n $$.xgridAttr = config.axis_rotated ? {\r\n 'x1': 0,\r\n 'x2': $$.width,\r\n 'y1': function (d) { return $$.x(d) - tickOffset; },\r\n 'y2': function (d) { return $$.x(d) - tickOffset; }\r\n } : {\r\n 'x1': function (d) { return $$.x(d) + tickOffset; },\r\n 'x2': function (d) { return $$.x(d) + tickOffset; },\r\n 'y1': 0,\r\n 'y2': $$.height\r\n };\r\n\r\n $$.xgrid = $$.main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid)\r\n .data(xgridData);\r\n $$.xgrid.enter().append('line').attr(\"class\", CLASS.xgrid);\r\n if (!withoutUpdate) {\r\n $$.xgrid.attr($$.xgridAttr)\r\n .style(\"opacity\", function () { return +d3.select(this).attr(config.axis_rotated ? 'y1' : 'x1') === (config.axis_rotated ? $$.height : 0) ? 0 : 1; });\r\n }\r\n $$.xgrid.exit().remove();\r\n };\r\n\r\n c3_chart_internal_fn.updateYGrid = function () {\r\n var $$ = this, config = $$.config,\r\n gridValues = $$.yAxis.tickValues() || $$.y.ticks(config.grid_y_ticks);\r\n $$.ygrid = $$.main.select('.' + CLASS.ygrids).selectAll('.' + CLASS.ygrid)\r\n .data(gridValues);\r\n $$.ygrid.enter().append('line')\r\n .attr('class', CLASS.ygrid);\r\n $$.ygrid.attr(\"x1\", config.axis_rotated ? $$.y : 0)\r\n .attr(\"x2\", config.axis_rotated ? $$.y : $$.width)\r\n .attr(\"y1\", config.axis_rotated ? 0 : $$.y)\r\n .attr(\"y2\", config.axis_rotated ? $$.height : $$.y);\r\n $$.ygrid.exit().remove();\r\n $$.smoothLines($$.ygrid, 'grid');\r\n };\r\n\r\n c3_chart_internal_fn.gridTextAnchor = function (d) {\r\n return d.position ? d.position : \"end\";\r\n };\r\n c3_chart_internal_fn.gridTextDx = function (d) {\r\n return d.position === 'start' ? 4 : d.position === 'middle' ? 0 : -4;\r\n };\r\n c3_chart_internal_fn.xGridTextX = function (d) {\r\n return d.position === 'start' ? -this.height : d.position === 'middle' ? -this.height / 2 : 0;\r\n };\r\n c3_chart_internal_fn.yGridTextX = function (d) {\r\n return d.position === 'start' ? 0 : d.position === 'middle' ? this.width / 2 : this.width;\r\n };\r\n c3_chart_internal_fn.updateGrid = function (duration) {\r\n var $$ = this, main = $$.main, config = $$.config,\r\n xgridLine, ygridLine, yv;\r\n\r\n // hide if arc type\r\n $$.grid.style('visibility', $$.hasArcType() ? 'hidden' : 'visible');\r\n\r\n main.select('line.' + CLASS.xgridFocus).style(\"visibility\", \"hidden\");\r\n if (config.grid_x_show) {\r\n $$.updateXGrid();\r\n }\r\n $$.xgridLines = main.select('.' + CLASS.xgridLines).selectAll('.' + CLASS.xgridLine)\r\n .data(config.grid_x_lines);\r\n // enter\r\n xgridLine = $$.xgridLines.enter().append('g')\r\n .attr(\"class\", function (d) { return CLASS.xgridLine + (d['class'] ? ' ' + d['class'] : ''); });\r\n xgridLine.append('line')\r\n .style(\"opacity\", 0);\r\n xgridLine.append('text')\r\n .attr(\"text-anchor\", $$.gridTextAnchor)\r\n .attr(\"transform\", config.axis_rotated ? \"\" : \"rotate(-90)\")\r\n .attr('dx', $$.gridTextDx)\r\n .attr('dy', -5)\r\n .style(\"opacity\", 0);\r\n // udpate\r\n // done in d3.transition() of the end of this function\r\n // exit\r\n $$.xgridLines.exit().transition().duration(duration)\r\n .style(\"opacity\", 0)\r\n .remove();\r\n\r\n // Y-Grid\r\n if (config.grid_y_show) {\r\n $$.updateYGrid();\r\n }\r\n $$.ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine)\r\n .data(config.grid_y_lines);\r\n // enter\r\n ygridLine = $$.ygridLines.enter().append('g')\r\n .attr(\"class\", function (d) { return CLASS.ygridLine + (d['class'] ? ' ' + d['class'] : ''); });\r\n ygridLine.append('line')\r\n .style(\"opacity\", 0);\r\n ygridLine.append('text')\r\n .attr(\"text-anchor\", $$.gridTextAnchor)\r\n .attr(\"transform\", config.axis_rotated ? \"rotate(-90)\" : \"\")\r\n .attr('dx', $$.gridTextDx)\r\n .attr('dy', -5)\r\n .style(\"opacity\", 0);\r\n // update\r\n yv = $$.yv.bind($$);\r\n $$.ygridLines.select('line')\r\n .transition().duration(duration)\r\n .attr(\"x1\", config.axis_rotated ? yv : 0)\r\n .attr(\"x2\", config.axis_rotated ? yv : $$.width)\r\n .attr(\"y1\", config.axis_rotated ? 0 : yv)\r\n .attr(\"y2\", config.axis_rotated ? $$.height : yv)\r\n .style(\"opacity\", 1);\r\n $$.ygridLines.select('text')\r\n .transition().duration(duration)\r\n .attr(\"x\", config.axis_rotated ? $$.xGridTextX.bind($$) : $$.yGridTextX.bind($$))\r\n .attr(\"y\", yv)\r\n .text(function (d) { return d.text; })\r\n .style(\"opacity\", 1);\r\n // exit\r\n $$.ygridLines.exit().transition().duration(duration)\r\n .style(\"opacity\", 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawGrid = function (withTransition) {\r\n var $$ = this, config = $$.config, xv = $$.xv.bind($$),\r\n lines = $$.xgridLines.select('line'),\r\n texts = $$.xgridLines.select('text');\r\n return [\r\n (withTransition ? lines.transition() : lines)\r\n .attr(\"x1\", config.axis_rotated ? 0 : xv)\r\n .attr(\"x2\", config.axis_rotated ? $$.width : xv)\r\n .attr(\"y1\", config.axis_rotated ? xv : 0)\r\n .attr(\"y2\", config.axis_rotated ? xv : $$.height)\r\n .style(\"opacity\", 1),\r\n (withTransition ? texts.transition() : texts)\r\n .attr(\"x\", config.axis_rotated ? $$.yGridTextX.bind($$) : $$.xGridTextX.bind($$))\r\n .attr(\"y\", xv)\r\n .text(function (d) { return d.text; })\r\n .style(\"opacity\", 1)\r\n ];\r\n };\r\n c3_chart_internal_fn.showXGridFocus = function (selectedData) {\r\n var $$ = this, config = $$.config,\r\n dataToShow = selectedData.filter(function (d) { return d && isValue(d.value); }),\r\n focusEl = $$.main.selectAll('line.' + CLASS.xgridFocus),\r\n xx = $$.xx.bind($$);\r\n if (! config.tooltip_show) { return; }\r\n // Hide when scatter plot exists\r\n if ($$.hasType('scatter') || $$.hasArcType()) { return; }\r\n focusEl\r\n .style(\"visibility\", \"visible\")\r\n .data([dataToShow[0]])\r\n .attr(config.axis_rotated ? 'y1' : 'x1', xx)\r\n .attr(config.axis_rotated ? 'y2' : 'x2', xx);\r\n $$.smoothLines(focusEl, 'grid');\r\n };\r\n c3_chart_internal_fn.hideXGridFocus = function () {\r\n this.main.select('line.' + CLASS.xgridFocus).style(\"visibility\", \"hidden\");\r\n };\r\n c3_chart_internal_fn.updateXgridFocus = function () {\r\n var $$ = this, config = $$.config;\r\n $$.main.select('line.' + CLASS.xgridFocus)\r\n .attr(\"x1\", config.axis_rotated ? 0 : -10)\r\n .attr(\"x2\", config.axis_rotated ? $$.width : -10)\r\n .attr(\"y1\", config.axis_rotated ? -10 : 0)\r\n .attr(\"y2\", config.axis_rotated ? -10 : $$.height);\r\n };\r\n c3_chart_internal_fn.generateGridData = function (type, scale) {\r\n var $$ = this,\r\n gridData = [], xDomain, firstYear, lastYear, i,\r\n tickNum = $$.main.select(\".\" + CLASS.axisX).selectAll('.tick').size();\r\n if (type === 'year') {\r\n xDomain = $$.getXDomain();\r\n firstYear = xDomain[0].getFullYear();\r\n lastYear = xDomain[1].getFullYear();\r\n for (i = firstYear; i <= lastYear; i++) {\r\n gridData.push(new Date(i + '-01-01 00:00:00'));\r\n }\r\n } else {\r\n gridData = scale.ticks(10);\r\n if (gridData.length > tickNum) { // use only int\r\n gridData = gridData.filter(function (d) { return (\"\" + d).indexOf('.') < 0; });\r\n }\r\n }\r\n return gridData;\r\n };\r\n c3_chart_internal_fn.getGridFilterToRemove = function (params) {\r\n return params ? function (line) {\r\n var found = false;\r\n [].concat(params).forEach(function (param) {\r\n if ((('value' in param && line.value === param.value) || ('class' in param && line['class'] === param['class']))) {\r\n found = true;\r\n }\r\n });\r\n return found;\r\n } : function () { return true; };\r\n };\r\n c3_chart_internal_fn.removeGridLines = function (params, forX) {\r\n var $$ = this, config = $$.config,\r\n toRemove = $$.getGridFilterToRemove(params),\r\n toShow = function (line) { return !toRemove(line); },\r\n classLines = forX ? CLASS.xgridLines : CLASS.ygridLines,\r\n classLine = forX ? CLASS.xgridLine : CLASS.ygridLine;\r\n $$.main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove)\r\n .transition().duration(config.transition_duration)\r\n .style('opacity', 0).remove();\r\n if (forX) {\r\n config.grid_x_lines = config.grid_x_lines.filter(toShow);\r\n } else {\r\n config.grid_y_lines = config.grid_y_lines.filter(toShow);\r\n }\r\n };\r\n\r\n c3_chart_internal_fn.initTooltip = function () {\r\n var $$ = this, config = $$.config, i;\r\n $$.tooltip = $$.selectChart\r\n .style(\"position\", \"relative\")\r\n .append(\"div\")\r\n .attr('class', CLASS.tooltipContainer)\r\n .style(\"position\", \"absolute\")\r\n .style(\"pointer-events\", \"none\")\r\n .style(\"display\", \"none\");\r\n // Show tooltip if needed\r\n if (config.tooltip_init_show) {\r\n if ($$.isTimeSeries() && isString(config.tooltip_init_x)) {\r\n config.tooltip_init_x = $$.parseDate(config.tooltip_init_x);\r\n for (i = 0; i < $$.data.targets[0].values.length; i++) {\r\n if (($$.data.targets[0].values[i].x - config.tooltip_init_x) === 0) { break; }\r\n }\r\n config.tooltip_init_x = i;\r\n }\r\n $$.tooltip.html(config.tooltip_contents.call($$, $$.data.targets.map(function (d) {\r\n return $$.addName(d.values[config.tooltip_init_x]);\r\n }), $$.axis.getXAxisTickFormat(), $$.getYFormat($$.hasArcType()), $$.color));\r\n $$.tooltip.style(\"top\", config.tooltip_init_position.top)\r\n .style(\"left\", config.tooltip_init_position.left)\r\n .style(\"display\", \"block\");\r\n }\r\n };\r\n c3_chart_internal_fn.getTooltipContent = function (d, defaultTitleFormat, defaultValueFormat, color) {\r\n var $$ = this, config = $$.config,\r\n titleFormat = config.tooltip_format_title || defaultTitleFormat,\r\n nameFormat = config.tooltip_format_name || function (name) { return name; },\r\n valueFormat = config.tooltip_format_value || defaultValueFormat,\r\n text, i, title, value, name, bgcolor,\r\n orderAsc = $$.isOrderAsc();\r\n\r\n if (config.data_groups.length === 0) {\r\n d.sort(function(a,b){\r\n return orderAsc ? a.value - b.value : b.value - a.value;\r\n });\r\n } else {\r\n var ids = $$.orderTargets($$.data.targets).map(function (i) {\r\n return i.id;\r\n });\r\n d.sort(function(a, b) {\r\n if (a.value > 0 && b.value > 0) {\r\n return orderAsc ? ids.indexOf(a.id) - ids.indexOf(b.id) : ids.indexOf(b.id) - ids.indexOf(a.id);\r\n } else {\r\n return orderAsc ? a.value - b.value : b.value - a.value;\r\n }\r\n });\r\n }\r\n\r\n for (i = 0; i < d.length; i++) {\r\n if (! (d[i] && (d[i].value || d[i].value === 0))) { continue; }\r\n\r\n if (! text) {\r\n title = titleFormat ? titleFormat(d[i].x) : d[i].x;\r\n text = \"
\" + (title || title === 0 ? \"
\" + title + \"
\" : \"\");\r\n }\r\n\r\n value = valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index);\r\n if (value !== undefined) {\r\n // Skip elements when their name is set to null\r\n if (d[i].name === null) { continue; }\r\n name = nameFormat(d[i].name, d[i].ratio, d[i].id, d[i].index);\r\n bgcolor = $$.levelColor ? $$.levelColor(d[i].value) : color(d[i].id);\r\n\r\n text += \"
\";\r\n text += \"
\" + name + \"
\";\r\n text += \"
\" + value + \"
\";\r\n text += \"
\";\r\n }\r\n }\r\n return text + \"
\";\r\n };\r\n c3_chart_internal_fn.tooltipPosition = function (dataToShow, tWidth, tHeight, element) {\r\n var $$ = this, config = $$.config, d3 = $$.d3;\r\n var svgLeft, tooltipLeft, tooltipRight, tooltipTop, chartRight;\r\n var forArc = $$.hasArcType(),\r\n mouse = d3.mouse(element);\r\n // Determin tooltip position\r\n if (forArc) {\r\n tooltipLeft = (($$.width - ($$.isLegendRight ? $$.getLegendWidth() : 0)) / 2) + mouse[0];\r\n tooltipTop = ($$.height / 2) + mouse[1] + 20;\r\n } else {\r\n svgLeft = $$.getSvgLeft(true);\r\n if (config.axis_rotated) {\r\n tooltipLeft = svgLeft + mouse[0] + 100;\r\n tooltipRight = tooltipLeft + tWidth;\r\n chartRight = $$.currentWidth - $$.getCurrentPaddingRight();\r\n tooltipTop = $$.x(dataToShow[0].x) + 20;\r\n } else {\r\n tooltipLeft = svgLeft + $$.getCurrentPaddingLeft(true) + $$.x(dataToShow[0].x) + 20;\r\n tooltipRight = tooltipLeft + tWidth;\r\n chartRight = svgLeft + $$.currentWidth - $$.getCurrentPaddingRight();\r\n tooltipTop = mouse[1] + 15;\r\n }\r\n\r\n if (tooltipRight > chartRight) {\r\n // 20 is needed for Firefox to keep tooltip width\r\n tooltipLeft -= tooltipRight - chartRight + 20;\r\n }\r\n if (tooltipTop + tHeight > $$.currentHeight) {\r\n tooltipTop -= tHeight + 30;\r\n }\r\n }\r\n if (tooltipTop < 0) {\r\n tooltipTop = 0;\r\n }\r\n return {top: tooltipTop, left: tooltipLeft};\r\n };\r\n c3_chart_internal_fn.showTooltip = function (selectedData, element) {\r\n var $$ = this, config = $$.config;\r\n var tWidth, tHeight, position;\r\n var forArc = $$.hasArcType(),\r\n dataToShow = selectedData.filter(function (d) { return d && isValue(d.value); }),\r\n positionFunction = config.tooltip_position || c3_chart_internal_fn.tooltipPosition;\r\n if (dataToShow.length === 0 || !config.tooltip_show) {\r\n return;\r\n }\r\n $$.tooltip.html(config.tooltip_contents.call($$, selectedData, $$.axis.getXAxisTickFormat(), $$.getYFormat(forArc), $$.color)).style(\"display\", \"block\");\r\n\r\n // Get tooltip dimensions\r\n tWidth = $$.tooltip.property('offsetWidth');\r\n tHeight = $$.tooltip.property('offsetHeight');\r\n\r\n position = positionFunction.call(this, dataToShow, tWidth, tHeight, element);\r\n // Set tooltip\r\n $$.tooltip\r\n .style(\"top\", position.top + \"px\")\r\n .style(\"left\", position.left + 'px');\r\n };\r\n c3_chart_internal_fn.hideTooltip = function () {\r\n this.tooltip.style(\"display\", \"none\");\r\n };\r\n\r\n c3_chart_internal_fn.initLegend = function () {\r\n var $$ = this;\r\n $$.legendItemTextBox = {};\r\n $$.legendHasRendered = false;\r\n $$.legend = $$.svg.append(\"g\").attr(\"transform\", $$.getTranslate('legend'));\r\n if (!$$.config.legend_show) {\r\n $$.legend.style('visibility', 'hidden');\r\n $$.hiddenLegendIds = $$.mapToIds($$.data.targets);\r\n return;\r\n }\r\n // MEMO: call here to update legend box and tranlate for all\r\n // MEMO: translate will be upated by this, so transform not needed in updateLegend()\r\n $$.updateLegendWithDefaults();\r\n };\r\n c3_chart_internal_fn.updateLegendWithDefaults = function () {\r\n var $$ = this;\r\n $$.updateLegend($$.mapToIds($$.data.targets), {withTransform: false, withTransitionForTransform: false, withTransition: false});\r\n };\r\n c3_chart_internal_fn.updateSizeForLegend = function (legendHeight, legendWidth) {\r\n var $$ = this, config = $$.config, insetLegendPosition = {\r\n top: $$.isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : $$.currentHeight - legendHeight - $$.getCurrentPaddingBottom() - config.legend_inset_y,\r\n left: $$.isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + 0.5 : $$.currentWidth - legendWidth - $$.getCurrentPaddingRight() - config.legend_inset_x + 0.5\r\n };\r\n\r\n $$.margin3 = {\r\n top: $$.isLegendRight ? 0 : $$.isLegendInset ? insetLegendPosition.top : $$.currentHeight - legendHeight,\r\n right: NaN,\r\n bottom: 0,\r\n left: $$.isLegendRight ? $$.currentWidth - legendWidth : $$.isLegendInset ? insetLegendPosition.left : 0\r\n };\r\n };\r\n c3_chart_internal_fn.transformLegend = function (withTransition) {\r\n var $$ = this;\r\n (withTransition ? $$.legend.transition() : $$.legend).attr(\"transform\", $$.getTranslate('legend'));\r\n };\r\n c3_chart_internal_fn.updateLegendStep = function (step) {\r\n this.legendStep = step;\r\n };\r\n c3_chart_internal_fn.updateLegendItemWidth = function (w) {\r\n this.legendItemWidth = w;\r\n };\r\n c3_chart_internal_fn.updateLegendItemHeight = function (h) {\r\n this.legendItemHeight = h;\r\n };\r\n c3_chart_internal_fn.getLegendWidth = function () {\r\n var $$ = this;\r\n return $$.config.legend_show ? $$.isLegendRight || $$.isLegendInset ? $$.legendItemWidth * ($$.legendStep + 1) : $$.currentWidth : 0;\r\n };\r\n c3_chart_internal_fn.getLegendHeight = function () {\r\n var $$ = this, h = 0;\r\n if ($$.config.legend_show) {\r\n if ($$.isLegendRight) {\r\n h = $$.currentHeight;\r\n } else {\r\n h = Math.max(20, $$.legendItemHeight) * ($$.legendStep + 1);\r\n }\r\n }\r\n return h;\r\n };\r\n c3_chart_internal_fn.opacityForLegend = function (legendItem) {\r\n return legendItem.classed(CLASS.legendItemHidden) ? null : 1;\r\n };\r\n c3_chart_internal_fn.opacityForUnfocusedLegend = function (legendItem) {\r\n return legendItem.classed(CLASS.legendItemHidden) ? null : 0.3;\r\n };\r\n c3_chart_internal_fn.toggleFocusLegend = function (targetIds, focus) {\r\n var $$ = this;\r\n targetIds = $$.mapToTargetIds(targetIds);\r\n $$.legend.selectAll('.' + CLASS.legendItem)\r\n .filter(function (id) { return targetIds.indexOf(id) >= 0; })\r\n .classed(CLASS.legendItemFocused, focus)\r\n .transition().duration(100)\r\n .style('opacity', function () {\r\n var opacity = focus ? $$.opacityForLegend : $$.opacityForUnfocusedLegend;\r\n return opacity.call($$, $$.d3.select(this));\r\n });\r\n };\r\n c3_chart_internal_fn.revertLegend = function () {\r\n var $$ = this, d3 = $$.d3;\r\n $$.legend.selectAll('.' + CLASS.legendItem)\r\n .classed(CLASS.legendItemFocused, false)\r\n .transition().duration(100)\r\n .style('opacity', function () { return $$.opacityForLegend(d3.select(this)); });\r\n };\r\n c3_chart_internal_fn.showLegend = function (targetIds) {\r\n var $$ = this, config = $$.config;\r\n if (!config.legend_show) {\r\n config.legend_show = true;\r\n $$.legend.style('visibility', 'visible');\r\n if (!$$.legendHasRendered) {\r\n $$.updateLegendWithDefaults();\r\n }\r\n }\r\n $$.removeHiddenLegendIds(targetIds);\r\n $$.legend.selectAll($$.selectorLegends(targetIds))\r\n .style('visibility', 'visible')\r\n .transition()\r\n .style('opacity', function () { return $$.opacityForLegend($$.d3.select(this)); });\r\n };\r\n c3_chart_internal_fn.hideLegend = function (targetIds) {\r\n var $$ = this, config = $$.config;\r\n if (config.legend_show && isEmpty(targetIds)) {\r\n config.legend_show = false;\r\n $$.legend.style('visibility', 'hidden');\r\n }\r\n $$.addHiddenLegendIds(targetIds);\r\n $$.legend.selectAll($$.selectorLegends(targetIds))\r\n .style('opacity', 0)\r\n .style('visibility', 'hidden');\r\n };\r\n c3_chart_internal_fn.clearLegendItemTextBoxCache = function () {\r\n this.legendItemTextBox = {};\r\n };\r\n c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {\r\n var $$ = this, config = $$.config;\r\n var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect, x1ForLegendTile, x2ForLegendTile, yForLegendTile;\r\n var paddingTop = 4, paddingRight = 10, maxWidth = 0, maxHeight = 0, posMin = 10, tileWidth = config.legend_item_tile_width + 5;\r\n var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0;\r\n var withTransition, withTransitionForTransform;\r\n var texts, rects, tiles, background;\r\n\r\n // Skip elements when their name is set to null\r\n targetIds = targetIds.filter(function(id) {\r\n return !isDefined(config.data_names[id]) || config.data_names[id] !== null;\r\n });\r\n\r\n options = options || {};\r\n withTransition = getOption(options, \"withTransition\", true);\r\n withTransitionForTransform = getOption(options, \"withTransitionForTransform\", true);\r\n\r\n function getTextBox(textElement, id) {\r\n if (!$$.legendItemTextBox[id]) {\r\n $$.legendItemTextBox[id] = $$.getTextRect(textElement.textContent, CLASS.legendItem, textElement);\r\n }\r\n return $$.legendItemTextBox[id];\r\n }\r\n\r\n function updatePositions(textElement, id, index) {\r\n var reset = index === 0, isLast = index === targetIds.length - 1,\r\n box = getTextBox(textElement, id),\r\n itemWidth = box.width + tileWidth + (isLast && !($$.isLegendRight || $$.isLegendInset) ? 0 : paddingRight) + config.legend_padding,\r\n itemHeight = box.height + paddingTop,\r\n itemLength = $$.isLegendRight || $$.isLegendInset ? itemHeight : itemWidth,\r\n areaLength = $$.isLegendRight || $$.isLegendInset ? $$.getLegendHeight() : $$.getLegendWidth(),\r\n margin, maxLength;\r\n\r\n // MEMO: care about condifion of step, totalLength\r\n function updateValues(id, withoutStep) {\r\n if (!withoutStep) {\r\n margin = (areaLength - totalLength - itemLength) / 2;\r\n if (margin < posMin) {\r\n margin = (areaLength - itemLength) / 2;\r\n totalLength = 0;\r\n step++;\r\n }\r\n }\r\n steps[id] = step;\r\n margins[step] = $$.isLegendInset ? 10 : margin;\r\n offsets[id] = totalLength;\r\n totalLength += itemLength;\r\n }\r\n\r\n if (reset) {\r\n totalLength = 0;\r\n step = 0;\r\n maxWidth = 0;\r\n maxHeight = 0;\r\n }\r\n\r\n if (config.legend_show && !$$.isLegendToShow(id)) {\r\n widths[id] = heights[id] = steps[id] = offsets[id] = 0;\r\n return;\r\n }\r\n\r\n widths[id] = itemWidth;\r\n heights[id] = itemHeight;\r\n\r\n if (!maxWidth || itemWidth >= maxWidth) { maxWidth = itemWidth; }\r\n if (!maxHeight || itemHeight >= maxHeight) { maxHeight = itemHeight; }\r\n maxLength = $$.isLegendRight || $$.isLegendInset ? maxHeight : maxWidth;\r\n\r\n if (config.legend_equally) {\r\n Object.keys(widths).forEach(function (id) { widths[id] = maxWidth; });\r\n Object.keys(heights).forEach(function (id) { heights[id] = maxHeight; });\r\n margin = (areaLength - maxLength * targetIds.length) / 2;\r\n if (margin < posMin) {\r\n totalLength = 0;\r\n step = 0;\r\n targetIds.forEach(function (id) { updateValues(id); });\r\n }\r\n else {\r\n updateValues(id, true);\r\n }\r\n } else {\r\n updateValues(id);\r\n }\r\n }\r\n\r\n if ($$.isLegendInset) {\r\n step = config.legend_inset_step ? config.legend_inset_step : targetIds.length;\r\n $$.updateLegendStep(step);\r\n }\r\n\r\n if ($$.isLegendRight) {\r\n xForLegend = function (id) { return maxWidth * steps[id]; };\r\n yForLegend = function (id) { return margins[steps[id]] + offsets[id]; };\r\n } else if ($$.isLegendInset) {\r\n xForLegend = function (id) { return maxWidth * steps[id] + 10; };\r\n yForLegend = function (id) { return margins[steps[id]] + offsets[id]; };\r\n } else {\r\n xForLegend = function (id) { return margins[steps[id]] + offsets[id]; };\r\n yForLegend = function (id) { return maxHeight * steps[id]; };\r\n }\r\n xForLegendText = function (id, i) { return xForLegend(id, i) + 4 + config.legend_item_tile_width; };\r\n yForLegendText = function (id, i) { return yForLegend(id, i) + 9; };\r\n xForLegendRect = function (id, i) { return xForLegend(id, i); };\r\n yForLegendRect = function (id, i) { return yForLegend(id, i) - 5; };\r\n x1ForLegendTile = function (id, i) { return xForLegend(id, i) - 2; };\r\n x2ForLegendTile = function (id, i) { return xForLegend(id, i) - 2 + config.legend_item_tile_width; };\r\n yForLegendTile = function (id, i) { return yForLegend(id, i) + 4; };\r\n\r\n // Define g for legend area\r\n l = $$.legend.selectAll('.' + CLASS.legendItem)\r\n .data(targetIds)\r\n .enter().append('g')\r\n .attr('class', function (id) { return $$.generateClass(CLASS.legendItem, id); })\r\n .style('visibility', function (id) { return $$.isLegendToShow(id) ? 'visible' : 'hidden'; })\r\n .style('cursor', 'pointer')\r\n .on('click', function (id) {\r\n if (config.legend_item_onclick) {\r\n config.legend_item_onclick.call($$, id);\r\n } else {\r\n if ($$.d3.event.altKey) {\r\n $$.api.hide();\r\n $$.api.show(id);\r\n } else {\r\n $$.api.toggle(id);\r\n $$.isTargetToShow(id) ? $$.api.focus(id) : $$.api.revert();\r\n }\r\n }\r\n })\r\n .on('mouseover', function (id) {\r\n if (config.legend_item_onmouseover) {\r\n config.legend_item_onmouseover.call($$, id);\r\n }\r\n else {\r\n $$.d3.select(this).classed(CLASS.legendItemFocused, true);\r\n if (!$$.transiting && $$.isTargetToShow(id)) {\r\n $$.api.focus(id);\r\n }\r\n }\r\n })\r\n .on('mouseout', function (id) {\r\n if (config.legend_item_onmouseout) {\r\n config.legend_item_onmouseout.call($$, id);\r\n }\r\n else {\r\n $$.d3.select(this).classed(CLASS.legendItemFocused, false);\r\n $$.api.revert();\r\n }\r\n });\r\n l.append('text')\r\n .text(function (id) { return isDefined(config.data_names[id]) ? config.data_names[id] : id; })\r\n .each(function (id, i) { updatePositions(this, id, i); })\r\n .style(\"pointer-events\", \"none\")\r\n .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200)\r\n .attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendText);\r\n l.append('rect')\r\n .attr(\"class\", CLASS.legendItemEvent)\r\n .style('fill-opacity', 0)\r\n .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendRect : -200)\r\n .attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendRect);\r\n l.append('line')\r\n .attr('class', CLASS.legendItemTile)\r\n .style('stroke', $$.color)\r\n .style(\"pointer-events\", \"none\")\r\n .attr('x1', $$.isLegendRight || $$.isLegendInset ? x1ForLegendTile : -200)\r\n .attr('y1', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendTile)\r\n .attr('x2', $$.isLegendRight || $$.isLegendInset ? x2ForLegendTile : -200)\r\n .attr('y2', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendTile)\r\n .attr('stroke-width', config.legend_item_tile_height);\r\n\r\n // Set background for inset legend\r\n background = $$.legend.select('.' + CLASS.legendBackground + ' rect');\r\n if ($$.isLegendInset && maxWidth > 0 && background.size() === 0) {\r\n background = $$.legend.insert('g', '.' + CLASS.legendItem)\r\n .attr(\"class\", CLASS.legendBackground)\r\n .append('rect');\r\n }\r\n\r\n texts = $$.legend.selectAll('text')\r\n .data(targetIds)\r\n .text(function (id) { return isDefined(config.data_names[id]) ? config.data_names[id] : id; }) // MEMO: needed for update\r\n .each(function (id, i) { updatePositions(this, id, i); });\r\n (withTransition ? texts.transition() : texts)\r\n .attr('x', xForLegendText)\r\n .attr('y', yForLegendText);\r\n\r\n rects = $$.legend.selectAll('rect.' + CLASS.legendItemEvent)\r\n .data(targetIds);\r\n (withTransition ? rects.transition() : rects)\r\n .attr('width', function (id) { return widths[id]; })\r\n .attr('height', function (id) { return heights[id]; })\r\n .attr('x', xForLegendRect)\r\n .attr('y', yForLegendRect);\r\n\r\n tiles = $$.legend.selectAll('line.' + CLASS.legendItemTile)\r\n .data(targetIds);\r\n (withTransition ? tiles.transition() : tiles)\r\n .style('stroke', $$.color)\r\n .attr('x1', x1ForLegendTile)\r\n .attr('y1', yForLegendTile)\r\n .attr('x2', x2ForLegendTile)\r\n .attr('y2', yForLegendTile);\r\n\r\n if (background) {\r\n (withTransition ? background.transition() : background)\r\n .attr('height', $$.getLegendHeight() - 12)\r\n .attr('width', maxWidth * (step + 1) + 10);\r\n }\r\n\r\n // toggle legend state\r\n $$.legend.selectAll('.' + CLASS.legendItem)\r\n .classed(CLASS.legendItemHidden, function (id) { return !$$.isTargetToShow(id); });\r\n\r\n // Update all to reflect change of legend\r\n $$.updateLegendItemWidth(maxWidth);\r\n $$.updateLegendItemHeight(maxHeight);\r\n $$.updateLegendStep(step);\r\n // Update size and scale\r\n $$.updateSizes();\r\n $$.updateScales();\r\n $$.updateSvgSize();\r\n // Update g positions\r\n $$.transformAll(withTransitionForTransform, transitions);\r\n $$.legendHasRendered = true;\r\n };\r\n\r\n c3_chart_internal_fn.initTitle = function () {\r\n var $$ = this;\r\n $$.title = $$.svg.append(\"text\")\r\n .text($$.config.title_text)\r\n .attr(\"class\", $$.CLASS.title);\r\n };\r\n c3_chart_internal_fn.redrawTitle = function () {\r\n var $$ = this;\r\n $$.title\r\n .attr(\"x\", $$.xForTitle.bind($$))\r\n .attr(\"y\", $$.yForTitle.bind($$));\r\n };\r\n c3_chart_internal_fn.xForTitle = function () {\r\n var $$ = this, config = $$.config, position = config.title_position || 'left', x;\r\n if (position.indexOf('right') >= 0) {\r\n x = $$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width - config.title_padding.right;\r\n } else if (position.indexOf('center') >= 0) {\r\n x = ($$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width) / 2;\r\n } else { // left\r\n x = config.title_padding.left;\r\n }\r\n return x;\r\n };\r\n c3_chart_internal_fn.yForTitle = function () {\r\n var $$ = this;\r\n return $$.config.title_padding.top + $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).height;\r\n };\r\n c3_chart_internal_fn.getTitlePadding = function() {\r\n var $$ = this;\r\n return $$.yForTitle() + $$.config.title_padding.bottom;\r\n };\r\n\r\n function Axis(owner) {\r\n API.call(this, owner);\r\n }\r\n\r\n inherit(API, Axis);\r\n\r\n Axis.prototype.init = function init() {\r\n\r\n var $$ = this.owner, config = $$.config, main = $$.main;\r\n $$.axes.x = main.append(\"g\")\r\n .attr(\"class\", CLASS.axis + ' ' + CLASS.axisX)\r\n .attr(\"clip-path\", $$.clipPathForXAxis)\r\n .attr(\"transform\", $$.getTranslate('x'))\r\n .style(\"visibility\", config.axis_x_show ? 'visible' : 'hidden');\r\n $$.axes.x.append(\"text\")\r\n .attr(\"class\", CLASS.axisXLabel)\r\n .attr(\"transform\", config.axis_rotated ? \"rotate(-90)\" : \"\")\r\n .style(\"text-anchor\", this.textAnchorForXAxisLabel.bind(this));\r\n $$.axes.y = main.append(\"g\")\r\n .attr(\"class\", CLASS.axis + ' ' + CLASS.axisY)\r\n .attr(\"clip-path\", config.axis_y_inner ? \"\" : $$.clipPathForYAxis)\r\n .attr(\"transform\", $$.getTranslate('y'))\r\n .style(\"visibility\", config.axis_y_show ? 'visible' : 'hidden');\r\n $$.axes.y.append(\"text\")\r\n .attr(\"class\", CLASS.axisYLabel)\r\n .attr(\"transform\", config.axis_rotated ? \"\" : \"rotate(-90)\")\r\n .style(\"text-anchor\", this.textAnchorForYAxisLabel.bind(this));\r\n\r\n $$.axes.y2 = main.append(\"g\")\r\n .attr(\"class\", CLASS.axis + ' ' + CLASS.axisY2)\r\n // clip-path?\r\n .attr(\"transform\", $$.getTranslate('y2'))\r\n .style(\"visibility\", config.axis_y2_show ? 'visible' : 'hidden');\r\n $$.axes.y2.append(\"text\")\r\n .attr(\"class\", CLASS.axisY2Label)\r\n .attr(\"transform\", config.axis_rotated ? \"\" : \"rotate(-90)\")\r\n .style(\"text-anchor\", this.textAnchorForY2AxisLabel.bind(this));\r\n };\r\n Axis.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {\r\n var $$ = this.owner, config = $$.config,\r\n axisParams = {\r\n isCategory: $$.isCategorized(),\r\n withOuterTick: withOuterTick,\r\n tickMultiline: config.axis_x_tick_multiline,\r\n tickWidth: config.axis_x_tick_width,\r\n tickTextRotate: withoutRotateTickText ? 0 : config.axis_x_tick_rotate,\r\n withoutTransition: withoutTransition,\r\n },\r\n axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient);\r\n\r\n if ($$.isTimeSeries() && tickValues && typeof tickValues !== \"function\") {\r\n tickValues = tickValues.map(function (v) { return $$.parseDate(v); });\r\n }\r\n\r\n // Set tick\r\n axis.tickFormat(tickFormat).tickValues(tickValues);\r\n if ($$.isCategorized()) {\r\n axis.tickCentered(config.axis_x_tick_centered);\r\n if (isEmpty(config.axis_x_tick_culling)) {\r\n config.axis_x_tick_culling = false;\r\n }\r\n }\r\n\r\n return axis;\r\n };\r\n Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) {\r\n var $$ = this.owner, config = $$.config, tickValues;\r\n if (config.axis_x_tick_fit || config.axis_x_tick_count) {\r\n tickValues = this.generateTickValues($$.mapTargetsToUniqueXs(targets), config.axis_x_tick_count, $$.isTimeSeries());\r\n }\r\n if (axis) {\r\n axis.tickValues(tickValues);\r\n } else {\r\n $$.xAxis.tickValues(tickValues);\r\n $$.subXAxis.tickValues(tickValues);\r\n }\r\n return tickValues;\r\n };\r\n Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {\r\n var $$ = this.owner, config = $$.config,\r\n axisParams = {\r\n withOuterTick: withOuterTick,\r\n withoutTransition: withoutTransition,\r\n tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate\r\n },\r\n axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);\r\n if ($$.isTimeSeriesY()) {\r\n axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);\r\n } else {\r\n axis.tickValues(tickValues);\r\n }\r\n return axis;\r\n };\r\n Axis.prototype.getId = function getId(id) {\r\n var config = this.owner.config;\r\n return id in config.data_axes ? config.data_axes[id] : 'y';\r\n };\r\n Axis.prototype.getXAxisTickFormat = function getXAxisTickFormat() {\r\n var $$ = this.owner, config = $$.config,\r\n format = $$.isTimeSeries() ? $$.defaultAxisTimeFormat : $$.isCategorized() ? $$.categoryName : function (v) { return v < 0 ? v.toFixed(0) : v; };\r\n if (config.axis_x_tick_format) {\r\n if (isFunction(config.axis_x_tick_format)) {\r\n format = config.axis_x_tick_format;\r\n } else if ($$.isTimeSeries()) {\r\n format = function (date) {\r\n return date ? $$.axisTimeFormat(config.axis_x_tick_format)(date) : \"\";\r\n };\r\n }\r\n }\r\n return isFunction(format) ? function (v) { return format.call($$, v); } : format;\r\n };\r\n Axis.prototype.getTickValues = function getTickValues(tickValues, axis) {\r\n return tickValues ? tickValues : axis ? axis.tickValues() : undefined;\r\n };\r\n Axis.prototype.getXAxisTickValues = function getXAxisTickValues() {\r\n return this.getTickValues(this.owner.config.axis_x_tick_values, this.owner.xAxis);\r\n };\r\n Axis.prototype.getYAxisTickValues = function getYAxisTickValues() {\r\n return this.getTickValues(this.owner.config.axis_y_tick_values, this.owner.yAxis);\r\n };\r\n Axis.prototype.getY2AxisTickValues = function getY2AxisTickValues() {\r\n return this.getTickValues(this.owner.config.axis_y2_tick_values, this.owner.y2Axis);\r\n };\r\n Axis.prototype.getLabelOptionByAxisId = function getLabelOptionByAxisId(axisId) {\r\n var $$ = this.owner, config = $$.config, option;\r\n if (axisId === 'y') {\r\n option = config.axis_y_label;\r\n } else if (axisId === 'y2') {\r\n option = config.axis_y2_label;\r\n } else if (axisId === 'x') {\r\n option = config.axis_x_label;\r\n }\r\n return option;\r\n };\r\n Axis.prototype.getLabelText = function getLabelText(axisId) {\r\n var option = this.getLabelOptionByAxisId(axisId);\r\n return isString(option) ? option : option ? option.text : null;\r\n };\r\n Axis.prototype.setLabelText = function setLabelText(axisId, text) {\r\n var $$ = this.owner, config = $$.config,\r\n option = this.getLabelOptionByAxisId(axisId);\r\n if (isString(option)) {\r\n if (axisId === 'y') {\r\n config.axis_y_label = text;\r\n } else if (axisId === 'y2') {\r\n config.axis_y2_label = text;\r\n } else if (axisId === 'x') {\r\n config.axis_x_label = text;\r\n }\r\n } else if (option) {\r\n option.text = text;\r\n }\r\n };\r\n Axis.prototype.getLabelPosition = function getLabelPosition(axisId, defaultPosition) {\r\n var option = this.getLabelOptionByAxisId(axisId),\r\n position = (option && typeof option === 'object' && option.position) ? option.position : defaultPosition;\r\n return {\r\n isInner: position.indexOf('inner') >= 0,\r\n isOuter: position.indexOf('outer') >= 0,\r\n isLeft: position.indexOf('left') >= 0,\r\n isCenter: position.indexOf('center') >= 0,\r\n isRight: position.indexOf('right') >= 0,\r\n isTop: position.indexOf('top') >= 0,\r\n isMiddle: position.indexOf('middle') >= 0,\r\n isBottom: position.indexOf('bottom') >= 0\r\n };\r\n };\r\n Axis.prototype.getXAxisLabelPosition = function getXAxisLabelPosition() {\r\n return this.getLabelPosition('x', this.owner.config.axis_rotated ? 'inner-top' : 'inner-right');\r\n };\r\n Axis.prototype.getYAxisLabelPosition = function getYAxisLabelPosition() {\r\n return this.getLabelPosition('y', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top');\r\n };\r\n Axis.prototype.getY2AxisLabelPosition = function getY2AxisLabelPosition() {\r\n return this.getLabelPosition('y2', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top');\r\n };\r\n Axis.prototype.getLabelPositionById = function getLabelPositionById(id) {\r\n return id === 'y2' ? this.getY2AxisLabelPosition() : id === 'y' ? this.getYAxisLabelPosition() : this.getXAxisLabelPosition();\r\n };\r\n Axis.prototype.textForXAxisLabel = function textForXAxisLabel() {\r\n return this.getLabelText('x');\r\n };\r\n Axis.prototype.textForYAxisLabel = function textForYAxisLabel() {\r\n return this.getLabelText('y');\r\n };\r\n Axis.prototype.textForY2AxisLabel = function textForY2AxisLabel() {\r\n return this.getLabelText('y2');\r\n };\r\n Axis.prototype.xForAxisLabel = function xForAxisLabel(forHorizontal, position) {\r\n var $$ = this.owner;\r\n if (forHorizontal) {\r\n return position.isLeft ? 0 : position.isCenter ? $$.width / 2 : $$.width;\r\n } else {\r\n return position.isBottom ? -$$.height : position.isMiddle ? -$$.height / 2 : 0;\r\n }\r\n };\r\n Axis.prototype.dxForAxisLabel = function dxForAxisLabel(forHorizontal, position) {\r\n if (forHorizontal) {\r\n return position.isLeft ? \"0.5em\" : position.isRight ? \"-0.5em\" : \"0\";\r\n } else {\r\n return position.isTop ? \"-0.5em\" : position.isBottom ? \"0.5em\" : \"0\";\r\n }\r\n };\r\n Axis.prototype.textAnchorForAxisLabel = function textAnchorForAxisLabel(forHorizontal, position) {\r\n if (forHorizontal) {\r\n return position.isLeft ? 'start' : position.isCenter ? 'middle' : 'end';\r\n } else {\r\n return position.isBottom ? 'start' : position.isMiddle ? 'middle' : 'end';\r\n }\r\n };\r\n Axis.prototype.xForXAxisLabel = function xForXAxisLabel() {\r\n return this.xForAxisLabel(!this.owner.config.axis_rotated, this.getXAxisLabelPosition());\r\n };\r\n Axis.prototype.xForYAxisLabel = function xForYAxisLabel() {\r\n return this.xForAxisLabel(this.owner.config.axis_rotated, this.getYAxisLabelPosition());\r\n };\r\n Axis.prototype.xForY2AxisLabel = function xForY2AxisLabel() {\r\n return this.xForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition());\r\n };\r\n Axis.prototype.dxForXAxisLabel = function dxForXAxisLabel() {\r\n return this.dxForAxisLabel(!this.owner.config.axis_rotated, this.getXAxisLabelPosition());\r\n };\r\n Axis.prototype.dxForYAxisLabel = function dxForYAxisLabel() {\r\n return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getYAxisLabelPosition());\r\n };\r\n Axis.prototype.dxForY2AxisLabel = function dxForY2AxisLabel() {\r\n return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition());\r\n };\r\n Axis.prototype.dyForXAxisLabel = function dyForXAxisLabel() {\r\n var $$ = this.owner, config = $$.config,\r\n position = this.getXAxisLabelPosition();\r\n if (config.axis_rotated) {\r\n return position.isInner ? \"1.2em\" : -25 - this.getMaxTickWidth('x');\r\n } else {\r\n return position.isInner ? \"-0.5em\" : config.axis_x_height ? config.axis_x_height - 10 : \"3em\";\r\n }\r\n };\r\n Axis.prototype.dyForYAxisLabel = function dyForYAxisLabel() {\r\n var $$ = this.owner,\r\n position = this.getYAxisLabelPosition();\r\n if ($$.config.axis_rotated) {\r\n return position.isInner ? \"-0.5em\" : \"3em\";\r\n } else {\r\n return position.isInner ? \"1.2em\" : -10 - ($$.config.axis_y_inner ? 0 : (this.getMaxTickWidth('y') + 10));\r\n }\r\n };\r\n Axis.prototype.dyForY2AxisLabel = function dyForY2AxisLabel() {\r\n var $$ = this.owner,\r\n position = this.getY2AxisLabelPosition();\r\n if ($$.config.axis_rotated) {\r\n return position.isInner ? \"1.2em\" : \"-2.2em\";\r\n } else {\r\n return position.isInner ? \"-0.5em\" : 15 + ($$.config.axis_y2_inner ? 0 : (this.getMaxTickWidth('y2') + 15));\r\n }\r\n };\r\n Axis.prototype.textAnchorForXAxisLabel = function textAnchorForXAxisLabel() {\r\n var $$ = this.owner;\r\n return this.textAnchorForAxisLabel(!$$.config.axis_rotated, this.getXAxisLabelPosition());\r\n };\r\n Axis.prototype.textAnchorForYAxisLabel = function textAnchorForYAxisLabel() {\r\n var $$ = this.owner;\r\n return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getYAxisLabelPosition());\r\n };\r\n Axis.prototype.textAnchorForY2AxisLabel = function textAnchorForY2AxisLabel() {\r\n var $$ = this.owner;\r\n return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getY2AxisLabelPosition());\r\n };\r\n Axis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) {\r\n var $$ = this.owner, config = $$.config,\r\n maxWidth = 0, targetsToShow, scale, axis, dummy, svg;\r\n if (withoutRecompute && $$.currentMaxTickWidths[id]) {\r\n return $$.currentMaxTickWidths[id];\r\n }\r\n if ($$.svg) {\r\n targetsToShow = $$.filterTargetsToShow($$.data.targets);\r\n if (id === 'y') {\r\n scale = $$.y.copy().domain($$.getYDomain(targetsToShow, 'y'));\r\n axis = this.getYAxis(scale, $$.yOrient, config.axis_y_tick_format, $$.yAxisTickValues, false, true, true);\r\n } else if (id === 'y2') {\r\n scale = $$.y2.copy().domain($$.getYDomain(targetsToShow, 'y2'));\r\n axis = this.getYAxis(scale, $$.y2Orient, config.axis_y2_tick_format, $$.y2AxisTickValues, false, true, true);\r\n } else {\r\n scale = $$.x.copy().domain($$.getXDomain(targetsToShow));\r\n axis = this.getXAxis(scale, $$.xOrient, $$.xAxisTickFormat, $$.xAxisTickValues, false, true, true);\r\n this.updateXAxisTickValues(targetsToShow, axis);\r\n }\r\n dummy = $$.d3.select('body').append('div').classed('c3', true);\r\n svg = dummy.append(\"svg\").style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0),\r\n svg.append('g').call(axis).each(function () {\r\n $$.d3.select(this).selectAll('text').each(function () {\r\n var box = this.getBoundingClientRect();\r\n if (maxWidth < box.width) { maxWidth = box.width; }\r\n });\r\n dummy.remove();\r\n });\r\n }\r\n $$.currentMaxTickWidths[id] = maxWidth <= 0 ? $$.currentMaxTickWidths[id] : maxWidth;\r\n return $$.currentMaxTickWidths[id];\r\n };\r\n\r\n Axis.prototype.updateLabels = function updateLabels(withTransition) {\r\n var $$ = this.owner;\r\n var axisXLabel = $$.main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel),\r\n axisYLabel = $$.main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel),\r\n axisY2Label = $$.main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label);\r\n (withTransition ? axisXLabel.transition() : axisXLabel)\r\n .attr(\"x\", this.xForXAxisLabel.bind(this))\r\n .attr(\"dx\", this.dxForXAxisLabel.bind(this))\r\n .attr(\"dy\", this.dyForXAxisLabel.bind(this))\r\n .text(this.textForXAxisLabel.bind(this));\r\n (withTransition ? axisYLabel.transition() : axisYLabel)\r\n .attr(\"x\", this.xForYAxisLabel.bind(this))\r\n .attr(\"dx\", this.dxForYAxisLabel.bind(this))\r\n .attr(\"dy\", this.dyForYAxisLabel.bind(this))\r\n .text(this.textForYAxisLabel.bind(this));\r\n (withTransition ? axisY2Label.transition() : axisY2Label)\r\n .attr(\"x\", this.xForY2AxisLabel.bind(this))\r\n .attr(\"dx\", this.dxForY2AxisLabel.bind(this))\r\n .attr(\"dy\", this.dyForY2AxisLabel.bind(this))\r\n .text(this.textForY2AxisLabel.bind(this));\r\n };\r\n Axis.prototype.getPadding = function getPadding(padding, key, defaultValue, domainLength) {\r\n var p = typeof padding === 'number' ? padding : padding[key];\r\n if (!isValue(p)) {\r\n return defaultValue;\r\n }\r\n if (padding.unit === 'ratio') {\r\n return padding[key] * domainLength;\r\n }\r\n // assume padding is pixels if unit is not specified\r\n return this.convertPixelsToAxisPadding(p, domainLength);\r\n };\r\n Axis.prototype.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) {\r\n var $$ = this.owner,\r\n length = $$.config.axis_rotated ? $$.width : $$.height;\r\n return domainLength * (pixels / length);\r\n };\r\n Axis.prototype.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) {\r\n var tickValues = values, targetCount, start, end, count, interval, i, tickValue;\r\n if (tickCount) {\r\n targetCount = isFunction(tickCount) ? tickCount() : tickCount;\r\n // compute ticks according to tickCount\r\n if (targetCount === 1) {\r\n tickValues = [values[0]];\r\n } else if (targetCount === 2) {\r\n tickValues = [values[0], values[values.length - 1]];\r\n } else if (targetCount > 2) {\r\n count = targetCount - 2;\r\n start = values[0];\r\n end = values[values.length - 1];\r\n interval = (end - start) / (count + 1);\r\n // re-construct unique values\r\n tickValues = [start];\r\n for (i = 0; i < count; i++) {\r\n tickValue = +start + interval * (i + 1);\r\n tickValues.push(forTimeSeries ? new Date(tickValue) : tickValue);\r\n }\r\n tickValues.push(end);\r\n }\r\n }\r\n if (!forTimeSeries) { tickValues = tickValues.sort(function (a, b) { return a - b; }); }\r\n return tickValues;\r\n };\r\n Axis.prototype.generateTransitions = function generateTransitions(duration) {\r\n var $$ = this.owner, axes = $$.axes;\r\n return {\r\n axisX: duration ? axes.x.transition().duration(duration) : axes.x,\r\n axisY: duration ? axes.y.transition().duration(duration) : axes.y,\r\n axisY2: duration ? axes.y2.transition().duration(duration) : axes.y2,\r\n axisSubX: duration ? axes.subx.transition().duration(duration) : axes.subx\r\n };\r\n };\r\n Axis.prototype.redraw = function redraw(transitions, isHidden) {\r\n var $$ = this.owner;\r\n $$.axes.x.style(\"opacity\", isHidden ? 0 : 1);\r\n $$.axes.y.style(\"opacity\", isHidden ? 0 : 1);\r\n $$.axes.y2.style(\"opacity\", isHidden ? 0 : 1);\r\n $$.axes.subx.style(\"opacity\", isHidden ? 0 : 1);\r\n transitions.axisX.call($$.xAxis);\r\n transitions.axisY.call($$.yAxis);\r\n transitions.axisY2.call($$.y2Axis);\r\n transitions.axisSubX.call($$.subXAxis);\r\n };\r\n\r\n c3_chart_internal_fn.getClipPath = function (id) {\r\n var isIE9 = window.navigator.appVersion.toLowerCase().indexOf(\"msie 9.\") >= 0;\r\n return \"url(\" + (isIE9 ? \"\" : document.URL.split('#')[0]) + \"#\" + id + \")\";\r\n };\r\n c3_chart_internal_fn.appendClip = function (parent, id) {\r\n return parent.append(\"clipPath\").attr(\"id\", id).append(\"rect\");\r\n };\r\n c3_chart_internal_fn.getAxisClipX = function (forHorizontal) {\r\n // axis line width + padding for left\r\n var left = Math.max(30, this.margin.left);\r\n return forHorizontal ? -(1 + left) : -(left - 1);\r\n };\r\n c3_chart_internal_fn.getAxisClipY = function (forHorizontal) {\r\n return forHorizontal ? -20 : -this.margin.top;\r\n };\r\n c3_chart_internal_fn.getXAxisClipX = function () {\r\n var $$ = this;\r\n return $$.getAxisClipX(!$$.config.axis_rotated);\r\n };\r\n c3_chart_internal_fn.getXAxisClipY = function () {\r\n var $$ = this;\r\n return $$.getAxisClipY(!$$.config.axis_rotated);\r\n };\r\n c3_chart_internal_fn.getYAxisClipX = function () {\r\n var $$ = this;\r\n return $$.config.axis_y_inner ? -1 : $$.getAxisClipX($$.config.axis_rotated);\r\n };\r\n c3_chart_internal_fn.getYAxisClipY = function () {\r\n var $$ = this;\r\n return $$.getAxisClipY($$.config.axis_rotated);\r\n };\r\n c3_chart_internal_fn.getAxisClipWidth = function (forHorizontal) {\r\n var $$ = this,\r\n left = Math.max(30, $$.margin.left),\r\n right = Math.max(30, $$.margin.right);\r\n // width + axis line width + padding for left/right\r\n return forHorizontal ? $$.width + 2 + left + right : $$.margin.left + 20;\r\n };\r\n c3_chart_internal_fn.getAxisClipHeight = function (forHorizontal) {\r\n // less than 20 is not enough to show the axis label 'outer' without legend\r\n return (forHorizontal ? this.margin.bottom : (this.margin.top + this.height)) + 20;\r\n };\r\n c3_chart_internal_fn.getXAxisClipWidth = function () {\r\n var $$ = this;\r\n return $$.getAxisClipWidth(!$$.config.axis_rotated);\r\n };\r\n c3_chart_internal_fn.getXAxisClipHeight = function () {\r\n var $$ = this;\r\n return $$.getAxisClipHeight(!$$.config.axis_rotated);\r\n };\r\n c3_chart_internal_fn.getYAxisClipWidth = function () {\r\n var $$ = this;\r\n return $$.getAxisClipWidth($$.config.axis_rotated) + ($$.config.axis_y_inner ? 20 : 0);\r\n };\r\n c3_chart_internal_fn.getYAxisClipHeight = function () {\r\n var $$ = this;\r\n return $$.getAxisClipHeight($$.config.axis_rotated);\r\n };\r\n\r\n c3_chart_internal_fn.initPie = function () {\r\n var $$ = this, d3 = $$.d3, config = $$.config;\r\n $$.pie = d3.layout.pie().value(function (d) {\r\n return d.values.reduce(function (a, b) { return a + b.value; }, 0);\r\n });\r\n if (!config.data_order) {\r\n $$.pie.sort(null);\r\n }\r\n };\r\n\r\n c3_chart_internal_fn.updateRadius = function () {\r\n var $$ = this, config = $$.config,\r\n w = config.gauge_width || config.donut_width;\r\n $$.radiusExpanded = Math.min($$.arcWidth, $$.arcHeight) / 2;\r\n $$.radius = $$.radiusExpanded * 0.95;\r\n $$.innerRadiusRatio = w ? ($$.radius - w) / $$.radius : 0.6;\r\n $$.innerRadius = $$.hasType('donut') || $$.hasType('gauge') ? $$.radius * $$.innerRadiusRatio : 0;\r\n };\r\n\r\n c3_chart_internal_fn.updateArc = function () {\r\n var $$ = this;\r\n $$.svgArc = $$.getSvgArc();\r\n $$.svgArcExpanded = $$.getSvgArcExpanded();\r\n $$.svgArcExpandedSub = $$.getSvgArcExpanded(0.98);\r\n };\r\n\r\n c3_chart_internal_fn.updateAngle = function (d) {\r\n var $$ = this, config = $$.config,\r\n found = false, index = 0,\r\n gMin, gMax, gTic, gValue;\r\n\r\n if (!config) {\r\n return null;\r\n }\r\n\r\n $$.pie($$.filterTargetsToShow($$.data.targets)).forEach(function (t) {\r\n if (! found && t.data.id === d.data.id) {\r\n found = true;\r\n d = t;\r\n d.index = index;\r\n }\r\n index++;\r\n });\r\n if (isNaN(d.startAngle)) {\r\n d.startAngle = 0;\r\n }\r\n if (isNaN(d.endAngle)) {\r\n d.endAngle = d.startAngle;\r\n }\r\n if ($$.isGaugeType(d.data)) {\r\n gMin = config.gauge_min;\r\n gMax = config.gauge_max;\r\n gTic = (Math.PI) / (gMax - gMin);\r\n gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : (gMax - gMin);\r\n d.startAngle = -1 * (Math.PI / 2);\r\n d.endAngle = d.startAngle + gTic * gValue;\r\n }\r\n return found ? d : null;\r\n };\r\n\r\n c3_chart_internal_fn.getSvgArc = function () {\r\n var $$ = this,\r\n arc = $$.d3.svg.arc().outerRadius($$.radius).innerRadius($$.innerRadius),\r\n newArc = function (d, withoutUpdate) {\r\n var updated;\r\n if (withoutUpdate) { return arc(d); } // for interpolate\r\n updated = $$.updateAngle(d);\r\n return updated ? arc(updated) : \"M 0 0\";\r\n };\r\n // TODO: extends all function\r\n newArc.centroid = arc.centroid;\r\n return newArc;\r\n };\r\n\r\n c3_chart_internal_fn.getSvgArcExpanded = function (rate) {\r\n var $$ = this,\r\n arc = $$.d3.svg.arc().outerRadius($$.radiusExpanded * (rate ? rate : 1)).innerRadius($$.innerRadius);\r\n return function (d) {\r\n var updated = $$.updateAngle(d);\r\n return updated ? arc(updated) : \"M 0 0\";\r\n };\r\n };\r\n\r\n c3_chart_internal_fn.getArc = function (d, withoutUpdate, force) {\r\n return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : \"M 0 0\";\r\n };\r\n\r\n\r\n c3_chart_internal_fn.transformForArcLabel = function (d) {\r\n var $$ = this,\r\n updated = $$.updateAngle(d), c, x, y, h, ratio, translate = \"\";\r\n if (updated && !$$.hasType('gauge')) {\r\n c = this.svgArc.centroid(updated);\r\n x = isNaN(c[0]) ? 0 : c[0];\r\n y = isNaN(c[1]) ? 0 : c[1];\r\n h = Math.sqrt(x * x + y * y);\r\n // TODO: ratio should be an option?\r\n ratio = $$.radius && h ? (36 / $$.radius > 0.375 ? 1.175 - 36 / $$.radius : 0.8) * $$.radius / h : 0;\r\n translate = \"translate(\" + (x * ratio) + ',' + (y * ratio) + \")\";\r\n }\r\n return translate;\r\n };\r\n\r\n c3_chart_internal_fn.getArcRatio = function (d) {\r\n var $$ = this,\r\n whole = $$.hasType('gauge') ? Math.PI : (Math.PI * 2);\r\n return d ? (d.endAngle - d.startAngle) / whole : null;\r\n };\r\n\r\n c3_chart_internal_fn.convertToArcData = function (d) {\r\n return this.addName({\r\n id: d.data.id,\r\n value: d.value,\r\n ratio: this.getArcRatio(d),\r\n index: d.index\r\n });\r\n };\r\n\r\n c3_chart_internal_fn.textForArcLabel = function (d) {\r\n var $$ = this,\r\n updated, value, ratio, id, format;\r\n if (! $$.shouldShowArcLabel()) { return \"\"; }\r\n updated = $$.updateAngle(d);\r\n value = updated ? updated.value : null;\r\n ratio = $$.getArcRatio(updated);\r\n id = d.data.id;\r\n if (! $$.hasType('gauge') && ! $$.meetsArcLabelThreshold(ratio)) { return \"\"; }\r\n format = $$.getArcLabelFormat();\r\n return format ? format(value, ratio, id) : $$.defaultArcValueFormat(value, ratio);\r\n };\r\n\r\n c3_chart_internal_fn.expandArc = function (targetIds) {\r\n var $$ = this, interval;\r\n\r\n // MEMO: avoid to cancel transition\r\n if ($$.transiting) {\r\n interval = window.setInterval(function () {\r\n if (!$$.transiting) {\r\n window.clearInterval(interval);\r\n if ($$.legend.selectAll('.c3-legend-item-focused').size() > 0) {\r\n $$.expandArc(targetIds);\r\n }\r\n }\r\n }, 10);\r\n return;\r\n }\r\n\r\n targetIds = $$.mapToTargetIds(targetIds);\r\n\r\n $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS.chartArc)).each(function (d) {\r\n if (! $$.shouldExpand(d.data.id)) { return; }\r\n $$.d3.select(this).selectAll('path')\r\n .transition().duration($$.expandDuration(d.data.id))\r\n .attr(\"d\", $$.svgArcExpanded)\r\n .transition().duration($$.expandDuration(d.data.id) * 2)\r\n .attr(\"d\", $$.svgArcExpandedSub)\r\n .each(function (d) {\r\n if ($$.isDonutType(d.data)) {\r\n // callback here\r\n }\r\n });\r\n });\r\n };\r\n\r\n c3_chart_internal_fn.unexpandArc = function (targetIds) {\r\n var $$ = this;\r\n\r\n if ($$.transiting) { return; }\r\n\r\n targetIds = $$.mapToTargetIds(targetIds);\r\n\r\n $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS.chartArc)).selectAll('path')\r\n .transition().duration(function(d) {\r\n return $$.expandDuration(d.data.id);\r\n })\r\n .attr(\"d\", $$.svgArc);\r\n $$.svg.selectAll('.' + CLASS.arc)\r\n .style(\"opacity\", 1);\r\n };\r\n\r\n c3_chart_internal_fn.expandDuration = function (id) {\r\n var $$ = this, config = $$.config;\r\n\r\n if ($$.isDonutType(id)) {\r\n return config.donut_expand_duration;\r\n } else if ($$.isGaugeType(id)) {\r\n return config.gauge_expand_duration;\r\n } else if ($$.isPieType(id)) {\r\n return config.pie_expand_duration;\r\n } else {\r\n return 50;\r\n }\r\n\r\n };\r\n\r\n c3_chart_internal_fn.shouldExpand = function (id) {\r\n var $$ = this, config = $$.config;\r\n return ($$.isDonutType(id) && config.donut_expand) ||\r\n ($$.isGaugeType(id) && config.gauge_expand) ||\r\n ($$.isPieType(id) && config.pie_expand);\r\n };\r\n\r\n c3_chart_internal_fn.shouldShowArcLabel = function () {\r\n var $$ = this, config = $$.config, shouldShow = true;\r\n if ($$.hasType('donut')) {\r\n shouldShow = config.donut_label_show;\r\n } else if ($$.hasType('pie')) {\r\n shouldShow = config.pie_label_show;\r\n }\r\n // when gauge, always true\r\n return shouldShow;\r\n };\r\n\r\n c3_chart_internal_fn.meetsArcLabelThreshold = function (ratio) {\r\n var $$ = this, config = $$.config,\r\n threshold = $$.hasType('donut') ? config.donut_label_threshold : config.pie_label_threshold;\r\n return ratio >= threshold;\r\n };\r\n\r\n c3_chart_internal_fn.getArcLabelFormat = function () {\r\n var $$ = this, config = $$.config,\r\n format = config.pie_label_format;\r\n if ($$.hasType('gauge')) {\r\n format = config.gauge_label_format;\r\n } else if ($$.hasType('donut')) {\r\n format = config.donut_label_format;\r\n }\r\n return format;\r\n };\r\n\r\n c3_chart_internal_fn.getArcTitle = function () {\r\n var $$ = this;\r\n return $$.hasType('donut') ? $$.config.donut_title : \"\";\r\n };\r\n\r\n c3_chart_internal_fn.updateTargetsForArc = function (targets) {\r\n var $$ = this, main = $$.main,\r\n mainPieUpdate, mainPieEnter,\r\n classChartArc = $$.classChartArc.bind($$),\r\n classArcs = $$.classArcs.bind($$),\r\n classFocus = $$.classFocus.bind($$);\r\n mainPieUpdate = main.select('.' + CLASS.chartArcs).selectAll('.' + CLASS.chartArc)\r\n .data($$.pie(targets))\r\n .attr(\"class\", function (d) { return classChartArc(d) + classFocus(d.data); });\r\n mainPieEnter = mainPieUpdate.enter().append(\"g\")\r\n .attr(\"class\", classChartArc);\r\n mainPieEnter.append('g')\r\n .attr('class', classArcs);\r\n mainPieEnter.append(\"text\")\r\n .attr(\"dy\", $$.hasType('gauge') ? \"-.1em\" : \".35em\")\r\n .style(\"opacity\", 0)\r\n .style(\"text-anchor\", \"middle\")\r\n .style(\"pointer-events\", \"none\");\r\n // MEMO: can not keep same color..., but not bad to update color in redraw\r\n //mainPieUpdate.exit().remove();\r\n };\r\n\r\n c3_chart_internal_fn.initArc = function () {\r\n var $$ = this;\r\n $$.arcs = $$.main.select('.' + CLASS.chart).append(\"g\")\r\n .attr(\"class\", CLASS.chartArcs)\r\n .attr(\"transform\", $$.getTranslate('arc'));\r\n $$.arcs.append('text')\r\n .attr('class', CLASS.chartArcsTitle)\r\n .style(\"text-anchor\", \"middle\")\r\n .text($$.getArcTitle());\r\n };\r\n\r\n c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransform) {\r\n var $$ = this, d3 = $$.d3, config = $$.config, main = $$.main,\r\n mainArc;\r\n mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc)\r\n .data($$.arcData.bind($$));\r\n mainArc.enter().append('path')\r\n .attr(\"class\", $$.classArc.bind($$))\r\n .style(\"fill\", function (d) { return $$.color(d.data); })\r\n .style(\"cursor\", function (d) { return config.interaction_enabled && config.data_selection_isselectable(d) ? \"pointer\" : null; })\r\n .style(\"opacity\", 0)\r\n .each(function (d) {\r\n if ($$.isGaugeType(d.data)) {\r\n d.startAngle = d.endAngle = -1 * (Math.PI / 2);\r\n }\r\n this._current = d;\r\n });\r\n mainArc\r\n .attr(\"transform\", function (d) { return !$$.isGaugeType(d.data) && withTransform ? \"scale(0)\" : \"\"; })\r\n .style(\"opacity\", function (d) { return d === this._current ? 0 : 1; })\r\n .on('mouseover', config.interaction_enabled ? function (d) {\r\n var updated, arcData;\r\n if ($$.transiting) { // skip while transiting\r\n return;\r\n }\r\n updated = $$.updateAngle(d);\r\n if (updated) {\r\n arcData = $$.convertToArcData(updated);\r\n // transitions\r\n $$.expandArc(updated.data.id);\r\n $$.api.focus(updated.data.id);\r\n $$.toggleFocusLegend(updated.data.id, true);\r\n $$.config.data_onmouseover(arcData, this);\r\n }\r\n } : null)\r\n .on('mousemove', config.interaction_enabled ? function (d) {\r\n var updated = $$.updateAngle(d), arcData, selectedData;\r\n if (updated) {\r\n arcData = $$.convertToArcData(updated),\r\n selectedData = [arcData];\r\n $$.showTooltip(selectedData, this);\r\n }\r\n } : null)\r\n .on('mouseout', config.interaction_enabled ? function (d) {\r\n var updated, arcData;\r\n if ($$.transiting) { // skip while transiting\r\n return;\r\n }\r\n updated = $$.updateAngle(d);\r\n if (updated) {\r\n arcData = $$.convertToArcData(updated);\r\n // transitions\r\n $$.unexpandArc(updated.data.id);\r\n $$.api.revert();\r\n $$.revertLegend();\r\n $$.hideTooltip();\r\n $$.config.data_onmouseout(arcData, this);\r\n }\r\n } : null)\r\n .on('click', config.interaction_enabled ? function (d, i) {\r\n var updated = $$.updateAngle(d), arcData;\r\n if (updated) {\r\n arcData = $$.convertToArcData(updated);\r\n if ($$.toggleShape) {\r\n $$.toggleShape(this, arcData, i);\r\n }\r\n $$.config.data_onclick.call($$.api, arcData, this);\r\n }\r\n } : null)\r\n .each(function () { $$.transiting = true; })\r\n .transition().duration(duration)\r\n .attrTween(\"d\", function (d) {\r\n var updated = $$.updateAngle(d), interpolate;\r\n if (! updated) {\r\n return function () { return \"M 0 0\"; };\r\n }\r\n // if (this._current === d) {\r\n // this._current = {\r\n // startAngle: Math.PI*2,\r\n // endAngle: Math.PI*2,\r\n // };\r\n // }\r\n if (isNaN(this._current.startAngle)) {\r\n this._current.startAngle = 0;\r\n }\r\n if (isNaN(this._current.endAngle)) {\r\n this._current.endAngle = this._current.startAngle;\r\n }\r\n interpolate = d3.interpolate(this._current, updated);\r\n this._current = interpolate(0);\r\n return function (t) {\r\n var interpolated = interpolate(t);\r\n interpolated.data = d.data; // data.id will be updated by interporator\r\n return $$.getArc(interpolated, true);\r\n };\r\n })\r\n .attr(\"transform\", withTransform ? \"scale(1)\" : \"\")\r\n .style(\"fill\", function (d) {\r\n return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data.id);\r\n }) // Where gauge reading color would receive customization.\r\n .style(\"opacity\", 1)\r\n .call($$.endall, function () {\r\n $$.transiting = false;\r\n });\r\n mainArc.exit().transition().duration(durationForExit)\r\n .style('opacity', 0)\r\n .remove();\r\n main.selectAll('.' + CLASS.chartArc).select('text')\r\n .style(\"opacity\", 0)\r\n .attr('class', function (d) { return $$.isGaugeType(d.data) ? CLASS.gaugeValue : ''; })\r\n .text($$.textForArcLabel.bind($$))\r\n .attr(\"transform\", $$.transformForArcLabel.bind($$))\r\n .style('font-size', function (d) { return $$.isGaugeType(d.data) ? Math.round($$.radius / 5) + 'px' : ''; })\r\n .transition().duration(duration)\r\n .style(\"opacity\", function (d) { return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? 1 : 0; });\r\n main.select('.' + CLASS.chartArcsTitle)\r\n .style(\"opacity\", $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0);\r\n\r\n if ($$.hasType('gauge')) {\r\n $$.arcs.select('.' + CLASS.chartArcsBackground)\r\n .attr(\"d\", function () {\r\n var d = {\r\n data: [{value: config.gauge_max}],\r\n startAngle: -1 * (Math.PI / 2),\r\n endAngle: Math.PI / 2\r\n };\r\n return $$.getArc(d, true, true);\r\n });\r\n $$.arcs.select('.' + CLASS.chartArcsGaugeUnit)\r\n .attr(\"dy\", \".75em\")\r\n .text(config.gauge_label_show ? config.gauge_units : '');\r\n $$.arcs.select('.' + CLASS.chartArcsGaugeMin)\r\n .attr(\"dx\", -1 * ($$.innerRadius + (($$.radius - $$.innerRadius) / 2)) + \"px\")\r\n .attr(\"dy\", \"1.2em\")\r\n .text(config.gauge_label_show ? config.gauge_min : '');\r\n $$.arcs.select('.' + CLASS.chartArcsGaugeMax)\r\n .attr(\"dx\", $$.innerRadius + (($$.radius - $$.innerRadius) / 2) + \"px\")\r\n .attr(\"dy\", \"1.2em\")\r\n .text(config.gauge_label_show ? config.gauge_max : '');\r\n }\r\n };\r\n c3_chart_internal_fn.initGauge = function () {\r\n var arcs = this.arcs;\r\n if (this.hasType('gauge')) {\r\n arcs.append('path')\r\n .attr(\"class\", CLASS.chartArcsBackground);\r\n arcs.append(\"text\")\r\n .attr(\"class\", CLASS.chartArcsGaugeUnit)\r\n .style(\"text-anchor\", \"middle\")\r\n .style(\"pointer-events\", \"none\");\r\n arcs.append(\"text\")\r\n .attr(\"class\", CLASS.chartArcsGaugeMin)\r\n .style(\"text-anchor\", \"middle\")\r\n .style(\"pointer-events\", \"none\");\r\n arcs.append(\"text\")\r\n .attr(\"class\", CLASS.chartArcsGaugeMax)\r\n .style(\"text-anchor\", \"middle\")\r\n .style(\"pointer-events\", \"none\");\r\n }\r\n };\r\n c3_chart_internal_fn.getGaugeLabelHeight = function () {\r\n return this.config.gauge_label_show ? 20 : 0;\r\n };\r\n\r\n c3_chart_internal_fn.initRegion = function () {\r\n var $$ = this;\r\n $$.region = $$.main.append('g')\r\n .attr(\"clip-path\", $$.clipPath)\r\n .attr(\"class\", CLASS.regions);\r\n };\r\n c3_chart_internal_fn.updateRegion = function (duration) {\r\n var $$ = this, config = $$.config;\r\n\r\n // hide if arc type\r\n $$.region.style('visibility', $$.hasArcType() ? 'hidden' : 'visible');\r\n\r\n $$.mainRegion = $$.main.select('.' + CLASS.regions).selectAll('.' + CLASS.region)\r\n .data(config.regions);\r\n $$.mainRegion.enter().append('g')\r\n .attr('class', $$.classRegion.bind($$))\r\n .append('rect')\r\n .style(\"fill-opacity\", 0);\r\n $$.mainRegion.exit().transition().duration(duration)\r\n .style(\"opacity\", 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawRegion = function (withTransition) {\r\n var $$ = this,\r\n regions = $$.mainRegion.selectAll('rect'),\r\n x = $$.regionX.bind($$),\r\n y = $$.regionY.bind($$),\r\n w = $$.regionWidth.bind($$),\r\n h = $$.regionHeight.bind($$);\r\n return [\r\n (withTransition ? regions.transition() : regions)\r\n .attr(\"x\", x)\r\n .attr(\"y\", y)\r\n .attr(\"width\", w)\r\n .attr(\"height\", h)\r\n .style(\"fill-opacity\", function (d) { return isValue(d.opacity) ? d.opacity : 0.1; })\r\n ];\r\n };\r\n c3_chart_internal_fn.regionX = function (d) {\r\n var $$ = this, config = $$.config,\r\n xPos, yScale = d.axis === 'y' ? $$.y : $$.y2;\r\n if (d.axis === 'y' || d.axis === 'y2') {\r\n xPos = config.axis_rotated ? ('start' in d ? yScale(d.start) : 0) : 0;\r\n } else {\r\n xPos = config.axis_rotated ? 0 : ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0);\r\n }\r\n return xPos;\r\n };\r\n c3_chart_internal_fn.regionY = function (d) {\r\n var $$ = this, config = $$.config,\r\n yPos, yScale = d.axis === 'y' ? $$.y : $$.y2;\r\n if (d.axis === 'y' || d.axis === 'y2') {\r\n yPos = config.axis_rotated ? 0 : ('end' in d ? yScale(d.end) : 0);\r\n } else {\r\n yPos = config.axis_rotated ? ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0) : 0;\r\n }\r\n return yPos;\r\n };\r\n c3_chart_internal_fn.regionWidth = function (d) {\r\n var $$ = this, config = $$.config,\r\n start = $$.regionX(d), end, yScale = d.axis === 'y' ? $$.y : $$.y2;\r\n if (d.axis === 'y' || d.axis === 'y2') {\r\n end = config.axis_rotated ? ('end' in d ? yScale(d.end) : $$.width) : $$.width;\r\n } else {\r\n end = config.axis_rotated ? $$.width : ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.width);\r\n }\r\n return end < start ? 0 : end - start;\r\n };\r\n c3_chart_internal_fn.regionHeight = function (d) {\r\n var $$ = this, config = $$.config,\r\n start = this.regionY(d), end, yScale = d.axis === 'y' ? $$.y : $$.y2;\r\n if (d.axis === 'y' || d.axis === 'y2') {\r\n end = config.axis_rotated ? $$.height : ('start' in d ? yScale(d.start) : $$.height);\r\n } else {\r\n end = config.axis_rotated ? ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.height) : $$.height;\r\n }\r\n return end < start ? 0 : end - start;\r\n };\r\n c3_chart_internal_fn.isRegionOnX = function (d) {\r\n return !d.axis || d.axis === 'x';\r\n };\r\n\r\n c3_chart_internal_fn.drag = function (mouse) {\r\n var $$ = this, config = $$.config, main = $$.main, d3 = $$.d3;\r\n var sx, sy, mx, my, minX, maxX, minY, maxY;\r\n\r\n if ($$.hasArcType()) { return; }\r\n if (! config.data_selection_enabled) { return; } // do nothing if not selectable\r\n if (config.zoom_enabled && ! $$.zoom.altDomain) { return; } // skip if zoomable because of conflict drag dehavior\r\n if (!config.data_selection_multiple) { return; } // skip when single selection because drag is used for multiple selection\r\n\r\n sx = $$.dragStart[0];\r\n sy = $$.dragStart[1];\r\n mx = mouse[0];\r\n my = mouse[1];\r\n minX = Math.min(sx, mx);\r\n maxX = Math.max(sx, mx);\r\n minY = (config.data_selection_grouped) ? $$.margin.top : Math.min(sy, my);\r\n maxY = (config.data_selection_grouped) ? $$.height : Math.max(sy, my);\r\n\r\n main.select('.' + CLASS.dragarea)\r\n .attr('x', minX)\r\n .attr('y', minY)\r\n .attr('width', maxX - minX)\r\n .attr('height', maxY - minY);\r\n // TODO: binary search when multiple xs\r\n main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape)\r\n .filter(function (d) { return config.data_selection_isselectable(d); })\r\n .each(function (d, i) {\r\n var shape = d3.select(this),\r\n isSelected = shape.classed(CLASS.SELECTED),\r\n isIncluded = shape.classed(CLASS.INCLUDED),\r\n _x, _y, _w, _h, toggle, isWithin = false, box;\r\n if (shape.classed(CLASS.circle)) {\r\n _x = shape.attr(\"cx\") * 1;\r\n _y = shape.attr(\"cy\") * 1;\r\n toggle = $$.togglePoint;\r\n isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY;\r\n }\r\n else if (shape.classed(CLASS.bar)) {\r\n box = getPathBox(this);\r\n _x = box.x;\r\n _y = box.y;\r\n _w = box.width;\r\n _h = box.height;\r\n toggle = $$.togglePath;\r\n isWithin = !(maxX < _x || _x + _w < minX) && !(maxY < _y || _y + _h < minY);\r\n } else {\r\n // line/area selection not supported yet\r\n return;\r\n }\r\n if (isWithin ^ isIncluded) {\r\n shape.classed(CLASS.INCLUDED, !isIncluded);\r\n // TODO: included/unincluded callback here\r\n shape.classed(CLASS.SELECTED, !isSelected);\r\n toggle.call($$, !isSelected, shape, d, i);\r\n }\r\n });\r\n };\r\n\r\n c3_chart_internal_fn.dragstart = function (mouse) {\r\n var $$ = this, config = $$.config;\r\n if ($$.hasArcType()) { return; }\r\n if (! config.data_selection_enabled) { return; } // do nothing if not selectable\r\n $$.dragStart = mouse;\r\n $$.main.select('.' + CLASS.chart).append('rect')\r\n .attr('class', CLASS.dragarea)\r\n .style('opacity', 0.1);\r\n $$.dragging = true;\r\n };\r\n\r\n c3_chart_internal_fn.dragend = function () {\r\n var $$ = this, config = $$.config;\r\n if ($$.hasArcType()) { return; }\r\n if (! config.data_selection_enabled) { return; } // do nothing if not selectable\r\n $$.main.select('.' + CLASS.dragarea)\r\n .transition().duration(100)\r\n .style('opacity', 0)\r\n .remove();\r\n $$.main.selectAll('.' + CLASS.shape)\r\n .classed(CLASS.INCLUDED, false);\r\n $$.dragging = false;\r\n };\r\n\r\n c3_chart_internal_fn.selectPoint = function (target, d, i) {\r\n var $$ = this, config = $$.config,\r\n cx = (config.axis_rotated ? $$.circleY : $$.circleX).bind($$),\r\n cy = (config.axis_rotated ? $$.circleX : $$.circleY).bind($$),\r\n r = $$.pointSelectR.bind($$);\r\n config.data_onselected.call($$.api, d, target.node());\r\n // add selected-circle on low layer g\r\n $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i)\r\n .data([d])\r\n .enter().append('circle')\r\n .attr(\"class\", function () { return $$.generateClass(CLASS.selectedCircle, i); })\r\n .attr(\"cx\", cx)\r\n .attr(\"cy\", cy)\r\n .attr(\"stroke\", function () { return $$.color(d); })\r\n .attr(\"r\", function (d) { return $$.pointSelectR(d) * 1.4; })\r\n .transition().duration(100)\r\n .attr(\"r\", r);\r\n };\r\n c3_chart_internal_fn.unselectPoint = function (target, d, i) {\r\n var $$ = this;\r\n $$.config.data_onunselected.call($$.api, d, target.node());\r\n // remove selected-circle from low layer g\r\n $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i)\r\n .transition().duration(100).attr('r', 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.togglePoint = function (selected, target, d, i) {\r\n selected ? this.selectPoint(target, d, i) : this.unselectPoint(target, d, i);\r\n };\r\n c3_chart_internal_fn.selectPath = function (target, d) {\r\n var $$ = this;\r\n $$.config.data_onselected.call($$, d, target.node());\r\n target.transition().duration(100)\r\n .style(\"fill\", function () { return $$.d3.rgb($$.color(d)).brighter(0.75); });\r\n };\r\n c3_chart_internal_fn.unselectPath = function (target, d) {\r\n var $$ = this;\r\n $$.config.data_onunselected.call($$, d, target.node());\r\n target.transition().duration(100)\r\n .style(\"fill\", function () { return $$.color(d); });\r\n };\r\n c3_chart_internal_fn.togglePath = function (selected, target, d, i) {\r\n selected ? this.selectPath(target, d, i) : this.unselectPath(target, d, i);\r\n };\r\n c3_chart_internal_fn.getToggle = function (that, d) {\r\n var $$ = this, toggle;\r\n if (that.nodeName === 'circle') {\r\n if ($$.isStepType(d)) {\r\n // circle is hidden in step chart, so treat as within the click area\r\n toggle = function () {}; // TODO: how to select step chart?\r\n } else {\r\n toggle = $$.togglePoint;\r\n }\r\n }\r\n else if (that.nodeName === 'path') {\r\n toggle = $$.togglePath;\r\n }\r\n return toggle;\r\n };\r\n c3_chart_internal_fn.toggleShape = function (that, d, i) {\r\n var $$ = this, d3 = $$.d3, config = $$.config,\r\n shape = d3.select(that), isSelected = shape.classed(CLASS.SELECTED),\r\n toggle = $$.getToggle(that, d).bind($$);\r\n\r\n if (config.data_selection_enabled && config.data_selection_isselectable(d)) {\r\n if (!config.data_selection_multiple) {\r\n $$.main.selectAll('.' + CLASS.shapes + (config.data_selection_grouped ? $$.getTargetSelectorSuffix(d.id) : \"\")).selectAll('.' + CLASS.shape).each(function (d, i) {\r\n var shape = d3.select(this);\r\n if (shape.classed(CLASS.SELECTED)) { toggle(false, shape.classed(CLASS.SELECTED, false), d, i); }\r\n });\r\n }\r\n shape.classed(CLASS.SELECTED, !isSelected);\r\n toggle(!isSelected, shape, d, i);\r\n }\r\n };\r\n\r\n c3_chart_internal_fn.initBrush = function () {\r\n var $$ = this, d3 = $$.d3;\r\n $$.brush = d3.svg.brush().on(\"brush\", function () { $$.redrawForBrush(); });\r\n $$.brush.update = function () {\r\n if ($$.context) { $$.context.select('.' + CLASS.brush).call(this); }\r\n return this;\r\n };\r\n $$.brush.scale = function (scale) {\r\n return $$.config.axis_rotated ? this.y(scale) : this.x(scale);\r\n };\r\n };\r\n c3_chart_internal_fn.initSubchart = function () {\r\n var $$ = this, config = $$.config,\r\n context = $$.context = $$.svg.append(\"g\").attr(\"transform\", $$.getTranslate('context')),\r\n visibility = config.subchart_show ? 'visible' : 'hidden';\r\n\r\n context.style('visibility', visibility);\r\n\r\n // Define g for chart area\r\n context.append('g')\r\n .attr(\"clip-path\", $$.clipPathForSubchart)\r\n .attr('class', CLASS.chart);\r\n\r\n // Define g for bar chart area\r\n context.select('.' + CLASS.chart).append(\"g\")\r\n .attr(\"class\", CLASS.chartBars);\r\n\r\n // Define g for line chart area\r\n context.select('.' + CLASS.chart).append(\"g\")\r\n .attr(\"class\", CLASS.chartLines);\r\n\r\n // Add extent rect for Brush\r\n context.append(\"g\")\r\n .attr(\"clip-path\", $$.clipPath)\r\n .attr(\"class\", CLASS.brush)\r\n .call($$.brush);\r\n\r\n // ATTENTION: This must be called AFTER chart added\r\n // Add Axis\r\n $$.axes.subx = context.append(\"g\")\r\n .attr(\"class\", CLASS.axisX)\r\n .attr(\"transform\", $$.getTranslate('subx'))\r\n .attr(\"clip-path\", config.axis_rotated ? \"\" : $$.clipPathForXAxis)\r\n .style(\"visibility\", config.subchart_axis_x_show ? visibility : 'hidden');\r\n };\r\n c3_chart_internal_fn.updateTargetsForSubchart = function (targets) {\r\n var $$ = this, context = $$.context, config = $$.config,\r\n contextLineEnter, contextLineUpdate, contextBarEnter, contextBarUpdate,\r\n classChartBar = $$.classChartBar.bind($$),\r\n classBars = $$.classBars.bind($$),\r\n classChartLine = $$.classChartLine.bind($$),\r\n classLines = $$.classLines.bind($$),\r\n classAreas = $$.classAreas.bind($$);\r\n\r\n if (config.subchart_show) {\r\n //-- Bar --//\r\n contextBarUpdate = context.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar)\r\n .data(targets)\r\n .attr('class', classChartBar);\r\n contextBarEnter = contextBarUpdate.enter().append('g')\r\n .style('opacity', 0)\r\n .attr('class', classChartBar);\r\n // Bars for each data\r\n contextBarEnter.append('g')\r\n .attr(\"class\", classBars);\r\n\r\n //-- Line --//\r\n contextLineUpdate = context.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine)\r\n .data(targets)\r\n .attr('class', classChartLine);\r\n contextLineEnter = contextLineUpdate.enter().append('g')\r\n .style('opacity', 0)\r\n .attr('class', classChartLine);\r\n // Lines for each data\r\n contextLineEnter.append(\"g\")\r\n .attr(\"class\", classLines);\r\n // Area\r\n contextLineEnter.append(\"g\")\r\n .attr(\"class\", classAreas);\r\n\r\n //-- Brush --//\r\n context.selectAll('.' + CLASS.brush + ' rect')\r\n .attr(config.axis_rotated ? \"width\" : \"height\", config.axis_rotated ? $$.width2 : $$.height2);\r\n }\r\n };\r\n c3_chart_internal_fn.updateBarForSubchart = function (durationForExit) {\r\n var $$ = this;\r\n $$.contextBar = $$.context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar)\r\n .data($$.barData.bind($$));\r\n $$.contextBar.enter().append('path')\r\n .attr(\"class\", $$.classBar.bind($$))\r\n .style(\"stroke\", 'none')\r\n .style(\"fill\", $$.color);\r\n $$.contextBar\r\n .style(\"opacity\", $$.initialOpacity.bind($$));\r\n $$.contextBar.exit().transition().duration(durationForExit)\r\n .style('opacity', 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawBarForSubchart = function (drawBarOnSub, withTransition, duration) {\r\n (withTransition ? this.contextBar.transition(Math.random().toString()).duration(duration) : this.contextBar)\r\n .attr('d', drawBarOnSub)\r\n .style('opacity', 1);\r\n };\r\n c3_chart_internal_fn.updateLineForSubchart = function (durationForExit) {\r\n var $$ = this;\r\n $$.contextLine = $$.context.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line)\r\n .data($$.lineData.bind($$));\r\n $$.contextLine.enter().append('path')\r\n .attr('class', $$.classLine.bind($$))\r\n .style('stroke', $$.color);\r\n $$.contextLine\r\n .style(\"opacity\", $$.initialOpacity.bind($$));\r\n $$.contextLine.exit().transition().duration(durationForExit)\r\n .style('opacity', 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawLineForSubchart = function (drawLineOnSub, withTransition, duration) {\r\n (withTransition ? this.contextLine.transition(Math.random().toString()).duration(duration) : this.contextLine)\r\n .attr(\"d\", drawLineOnSub)\r\n .style('opacity', 1);\r\n };\r\n c3_chart_internal_fn.updateAreaForSubchart = function (durationForExit) {\r\n var $$ = this, d3 = $$.d3;\r\n $$.contextArea = $$.context.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)\r\n .data($$.lineData.bind($$));\r\n $$.contextArea.enter().append('path')\r\n .attr(\"class\", $$.classArea.bind($$))\r\n .style(\"fill\", $$.color)\r\n .style(\"opacity\", function () { $$.orgAreaOpacity = +d3.select(this).style('opacity'); return 0; });\r\n $$.contextArea\r\n .style(\"opacity\", 0);\r\n $$.contextArea.exit().transition().duration(durationForExit)\r\n .style('opacity', 0)\r\n .remove();\r\n };\r\n c3_chart_internal_fn.redrawAreaForSubchart = function (drawAreaOnSub, withTransition, duration) {\r\n (withTransition ? this.contextArea.transition(Math.random().toString()).duration(duration) : this.contextArea)\r\n .attr(\"d\", drawAreaOnSub)\r\n .style(\"fill\", this.color)\r\n .style(\"opacity\", this.orgAreaOpacity);\r\n };\r\n c3_chart_internal_fn.redrawSubchart = function (withSubchart, transitions, duration, durationForExit, areaIndices, barIndices, lineIndices) {\r\n var $$ = this, d3 = $$.d3, config = $$.config,\r\n drawAreaOnSub, drawBarOnSub, drawLineOnSub;\r\n\r\n $$.context.style('visibility', config.subchart_show ? 'visible' : 'hidden');\r\n\r\n // subchart\r\n if (config.subchart_show) {\r\n // reflect main chart to extent on subchart if zoomed\r\n if (d3.event && d3.event.type === 'zoom') {\r\n $$.brush.extent($$.x.orgDomain()).update();\r\n }\r\n // update subchart elements if needed\r\n if (withSubchart) {\r\n\r\n // extent rect\r\n if (!$$.brush.empty()) {\r\n $$.brush.extent($$.x.orgDomain()).update();\r\n }\r\n // setup drawer - MEMO: this must be called after axis updated\r\n drawAreaOnSub = $$.generateDrawArea(areaIndices, true);\r\n drawBarOnSub = $$.generateDrawBar(barIndices, true);\r\n drawLineOnSub = $$.generateDrawLine(lineIndices, true);\r\n\r\n $$.updateBarForSubchart(duration);\r\n $$.updateLineForSubchart(duration);\r\n $$.updateAreaForSubchart(duration);\r\n\r\n $$.redrawBarForSubchart(drawBarOnSub, duration, duration);\r\n $$.redrawLineForSubchart(drawLineOnSub, duration, duration);\r\n $$.redrawAreaForSubchart(drawAreaOnSub, duration, duration);\r\n }\r\n }\r\n };\r\n c3_chart_internal_fn.redrawForBrush = function () {\r\n var $$ = this, x = $$.x;\r\n $$.redraw({\r\n withTransition: false,\r\n withY: $$.config.zoom_rescale,\r\n withSubchart: false,\r\n withUpdateXDomain: true,\r\n withDimension: false\r\n });\r\n $$.config.subchart_onbrush.call($$.api, x.orgDomain());\r\n };\r\n c3_chart_internal_fn.transformContext = function (withTransition, transitions) {\r\n var $$ = this, subXAxis;\r\n if (transitions && transitions.axisSubX) {\r\n subXAxis = transitions.axisSubX;\r\n } else {\r\n subXAxis = $$.context.select('.' + CLASS.axisX);\r\n if (withTransition) { subXAxis = subXAxis.transition(); }\r\n }\r\n $$.context.attr(\"transform\", $$.getTranslate('context'));\r\n subXAxis.attr(\"transform\", $$.getTranslate('subx'));\r\n };\r\n c3_chart_internal_fn.getDefaultExtent = function () {\r\n var $$ = this, config = $$.config,\r\n extent = isFunction(config.axis_x_extent) ? config.axis_x_extent($$.getXDomain($$.data.targets)) : config.axis_x_extent;\r\n if ($$.isTimeSeries()) {\r\n extent = [$$.parseDate(extent[0]), $$.parseDate(extent[1])];\r\n }\r\n return extent;\r\n };\r\n\r\n c3_chart_internal_fn.initZoom = function () {\r\n var $$ = this, d3 = $$.d3, config = $$.config, startEvent;\r\n\r\n $$.zoom = d3.behavior.zoom()\r\n .on(\"zoomstart\", function () {\r\n startEvent = d3.event.sourceEvent;\r\n $$.zoom.altDomain = d3.event.sourceEvent.altKey ? $$.x.orgDomain() : null;\r\n config.zoom_onzoomstart.call($$.api, d3.event.sourceEvent);\r\n })\r\n .on(\"zoom\", function () {\r\n $$.redrawForZoom.call($$);\r\n })\r\n .on('zoomend', function () {\r\n var event = d3.event.sourceEvent;\r\n // if click, do nothing. otherwise, click interaction will be canceled.\r\n if (event && startEvent.clientX === event.clientX && startEvent.clientY === event.clientY) {\r\n return;\r\n }\r\n $$.redrawEventRect();\r\n $$.updateZoom();\r\n config.zoom_onzoomend.call($$.api, $$.x.orgDomain());\r\n });\r\n $$.zoom.scale = function (scale) {\r\n return config.axis_rotated ? this.y(scale) : this.x(scale);\r\n };\r\n $$.zoom.orgScaleExtent = function () {\r\n var extent = config.zoom_extent ? config.zoom_extent : [1, 10];\r\n return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])];\r\n };\r\n $$.zoom.updateScaleExtent = function () {\r\n var ratio = diffDomain($$.x.orgDomain()) / diffDomain($$.getZoomDomain()),\r\n extent = this.orgScaleExtent();\r\n this.scaleExtent([extent[0] * ratio, extent[1] * ratio]);\r\n return this;\r\n };\r\n };\r\n c3_chart_internal_fn.getZoomDomain = function () {\r\n var $$ = this, config = $$.config, d3 = $$.d3,\r\n min = d3.min([$$.orgXDomain[0], config.zoom_x_min]),\r\n max = d3.max([$$.orgXDomain[1], config.zoom_x_max]);\r\n return [min, max];\r\n };\r\n c3_chart_internal_fn.updateZoom = function () {\r\n var $$ = this, z = $$.config.zoom_enabled ? $$.zoom : function () {};\r\n $$.main.select('.' + CLASS.zoomRect).call(z).on(\"dblclick.zoom\", null);\r\n $$.main.selectAll('.' + CLASS.eventRect).call(z).on(\"dblclick.zoom\", null);\r\n };\r\n c3_chart_internal_fn.redrawForZoom = function () {\r\n var $$ = this, d3 = $$.d3, config = $$.config, zoom = $$.zoom, x = $$.x;\r\n if (!config.zoom_enabled) {\r\n return;\r\n }\r\n if ($$.filterTargetsToShow($$.data.targets).length === 0) {\r\n return;\r\n }\r\n if (d3.event.sourceEvent.type === 'mousemove' && zoom.altDomain) {\r\n x.domain(zoom.altDomain);\r\n zoom.scale(x).updateScaleExtent();\r\n return;\r\n }\r\n if ($$.isCategorized() && x.orgDomain()[0] === $$.orgXDomain[0]) {\r\n x.domain([$$.orgXDomain[0] - 1e-10, x.orgDomain()[1]]);\r\n }\r\n $$.redraw({\r\n withTransition: false,\r\n withY: config.zoom_rescale,\r\n withSubchart: false,\r\n withEventRect: false,\r\n withDimension: false\r\n });\r\n if (d3.event.sourceEvent.type === 'mousemove') {\r\n $$.cancelClick = true;\r\n }\r\n config.zoom_onzoom.call($$.api, x.orgDomain());\r\n };\r\n\r\n c3_chart_internal_fn.generateColor = function () {\r\n var $$ = this, config = $$.config, d3 = $$.d3,\r\n colors = config.data_colors,\r\n pattern = notEmpty(config.color_pattern) ? config.color_pattern : d3.scale.category10().range(),\r\n callback = config.data_color,\r\n ids = [];\r\n\r\n return function (d) {\r\n var id = d.id || (d.data && d.data.id) || d, color;\r\n\r\n // if callback function is provided\r\n if (colors[id] instanceof Function) {\r\n color = colors[id](d);\r\n }\r\n // if specified, choose that color\r\n else if (colors[id]) {\r\n color = colors[id];\r\n }\r\n // if not specified, choose from pattern\r\n else {\r\n if (ids.indexOf(id) < 0) { ids.push(id); }\r\n color = pattern[ids.indexOf(id) % pattern.length];\r\n colors[id] = color;\r\n }\r\n return callback instanceof Function ? callback(color, d) : color;\r\n };\r\n };\r\n c3_chart_internal_fn.generateLevelColor = function () {\r\n var $$ = this, config = $$.config,\r\n colors = config.color_pattern,\r\n threshold = config.color_threshold,\r\n asValue = threshold.unit === 'value',\r\n values = threshold.values && threshold.values.length ? threshold.values : [],\r\n max = threshold.max || 100;\r\n return notEmpty(config.color_threshold) ? function (value) {\r\n var i, v, color = colors[colors.length - 1];\r\n for (i = 0; i < values.length; i++) {\r\n v = asValue ? value : (value * 100 / max);\r\n if (v < values[i]) {\r\n color = colors[i];\r\n break;\r\n }\r\n }\r\n return color;\r\n } : null;\r\n };\r\n\r\n c3_chart_internal_fn.getYFormat = function (forArc) {\r\n var $$ = this,\r\n formatForY = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.yFormat,\r\n formatForY2 = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.y2Format;\r\n return function (v, ratio, id) {\r\n var format = $$.axis.getId(id) === 'y2' ? formatForY2 : formatForY;\r\n return format.call($$, v, ratio);\r\n };\r\n };\r\n c3_chart_internal_fn.yFormat = function (v) {\r\n var $$ = this, config = $$.config,\r\n format = config.axis_y_tick_format ? config.axis_y_tick_format : $$.defaultValueFormat;\r\n return format(v);\r\n };\r\n c3_chart_internal_fn.y2Format = function (v) {\r\n var $$ = this, config = $$.config,\r\n format = config.axis_y2_tick_format ? config.axis_y2_tick_format : $$.defaultValueFormat;\r\n return format(v);\r\n };\r\n c3_chart_internal_fn.defaultValueFormat = function (v) {\r\n return isValue(v) ? +v : \"\";\r\n };\r\n c3_chart_internal_fn.defaultArcValueFormat = function (v, ratio) {\r\n return (ratio * 100).toFixed(1) + '%';\r\n };\r\n c3_chart_internal_fn.dataLabelFormat = function (targetId) {\r\n var $$ = this, data_labels = $$.config.data_labels,\r\n format, defaultFormat = function (v) { return isValue(v) ? +v : \"\"; };\r\n // find format according to axis id\r\n if (typeof data_labels.format === 'function') {\r\n format = data_labels.format;\r\n } else if (typeof data_labels.format === 'object') {\r\n if (data_labels.format[targetId]) {\r\n format = data_labels.format[targetId] === true ? defaultFormat : data_labels.format[targetId];\r\n } else {\r\n format = function () { return ''; };\r\n }\r\n } else {\r\n format = defaultFormat;\r\n }\r\n return format;\r\n };\r\n\r\n c3_chart_internal_fn.hasCaches = function (ids) {\r\n for (var i = 0; i < ids.length; i++) {\r\n if (! (ids[i] in this.cache)) { return false; }\r\n }\r\n return true;\r\n };\r\n c3_chart_internal_fn.addCache = function (id, target) {\r\n this.cache[id] = this.cloneTarget(target);\r\n };\r\n c3_chart_internal_fn.getCaches = function (ids) {\r\n var targets = [], i;\r\n for (i = 0; i < ids.length; i++) {\r\n if (ids[i] in this.cache) { targets.push(this.cloneTarget(this.cache[ids[i]])); }\r\n }\r\n return targets;\r\n };\r\n\r\n var CLASS = c3_chart_internal_fn.CLASS = {\r\n target: 'c3-target',\r\n chart: 'c3-chart',\r\n chartLine: 'c3-chart-line',\r\n chartLines: 'c3-chart-lines',\r\n chartBar: 'c3-chart-bar',\r\n chartBars: 'c3-chart-bars',\r\n chartText: 'c3-chart-text',\r\n chartTexts: 'c3-chart-texts',\r\n chartArc: 'c3-chart-arc',\r\n chartArcs: 'c3-chart-arcs',\r\n chartArcsTitle: 'c3-chart-arcs-title',\r\n chartArcsBackground: 'c3-chart-arcs-background',\r\n chartArcsGaugeUnit: 'c3-chart-arcs-gauge-unit',\r\n chartArcsGaugeMax: 'c3-chart-arcs-gauge-max',\r\n chartArcsGaugeMin: 'c3-chart-arcs-gauge-min',\r\n selectedCircle: 'c3-selected-circle',\r\n selectedCircles: 'c3-selected-circles',\r\n eventRect: 'c3-event-rect',\r\n eventRects: 'c3-event-rects',\r\n eventRectsSingle: 'c3-event-rects-single',\r\n eventRectsMultiple: 'c3-event-rects-multiple',\r\n zoomRect: 'c3-zoom-rect',\r\n brush: 'c3-brush',\r\n focused: 'c3-focused',\r\n defocused: 'c3-defocused',\r\n region: 'c3-region',\r\n regions: 'c3-regions',\r\n title: 'c3-title',\r\n tooltipContainer: 'c3-tooltip-container',\r\n tooltip: 'c3-tooltip',\r\n tooltipName: 'c3-tooltip-name',\r\n shape: 'c3-shape',\r\n shapes: 'c3-shapes',\r\n line: 'c3-line',\r\n lines: 'c3-lines',\r\n bar: 'c3-bar',\r\n bars: 'c3-bars',\r\n circle: 'c3-circle',\r\n circles: 'c3-circles',\r\n arc: 'c3-arc',\r\n arcs: 'c3-arcs',\r\n area: 'c3-area',\r\n areas: 'c3-areas',\r\n empty: 'c3-empty',\r\n text: 'c3-text',\r\n texts: 'c3-texts',\r\n gaugeValue: 'c3-gauge-value',\r\n grid: 'c3-grid',\r\n gridLines: 'c3-grid-lines',\r\n xgrid: 'c3-xgrid',\r\n xgrids: 'c3-xgrids',\r\n xgridLine: 'c3-xgrid-line',\r\n xgridLines: 'c3-xgrid-lines',\r\n xgridFocus: 'c3-xgrid-focus',\r\n ygrid: 'c3-ygrid',\r\n ygrids: 'c3-ygrids',\r\n ygridLine: 'c3-ygrid-line',\r\n ygridLines: 'c3-ygrid-lines',\r\n axis: 'c3-axis',\r\n axisX: 'c3-axis-x',\r\n axisXLabel: 'c3-axis-x-label',\r\n axisY: 'c3-axis-y',\r\n axisYLabel: 'c3-axis-y-label',\r\n axisY2: 'c3-axis-y2',\r\n axisY2Label: 'c3-axis-y2-label',\r\n legendBackground: 'c3-legend-background',\r\n legendItem: 'c3-legend-item',\r\n legendItemEvent: 'c3-legend-item-event',\r\n legendItemTile: 'c3-legend-item-tile',\r\n legendItemHidden: 'c3-legend-item-hidden',\r\n legendItemFocused: 'c3-legend-item-focused',\r\n dragarea: 'c3-dragarea',\r\n EXPANDED: '_expanded_',\r\n SELECTED: '_selected_',\r\n INCLUDED: '_included_'\r\n };\r\n c3_chart_internal_fn.generateClass = function (prefix, targetId) {\r\n return \" \" + prefix + \" \" + prefix + this.getTargetSelectorSuffix(targetId);\r\n };\r\n c3_chart_internal_fn.classText = function (d) {\r\n return this.generateClass(CLASS.text, d.index);\r\n };\r\n c3_chart_internal_fn.classTexts = function (d) {\r\n return this.generateClass(CLASS.texts, d.id);\r\n };\r\n c3_chart_internal_fn.classShape = function (d) {\r\n return this.generateClass(CLASS.shape, d.index);\r\n };\r\n c3_chart_internal_fn.classShapes = function (d) {\r\n return this.generateClass(CLASS.shapes, d.id);\r\n };\r\n c3_chart_internal_fn.classLine = function (d) {\r\n return this.classShape(d) + this.generateClass(CLASS.line, d.id);\r\n };\r\n c3_chart_internal_fn.classLines = function (d) {\r\n return this.classShapes(d) + this.generateClass(CLASS.lines, d.id);\r\n };\r\n c3_chart_internal_fn.classCircle = function (d) {\r\n return this.classShape(d) + this.generateClass(CLASS.circle, d.index);\r\n };\r\n c3_chart_internal_fn.classCircles = function (d) {\r\n return this.classShapes(d) + this.generateClass(CLASS.circles, d.id);\r\n };\r\n c3_chart_internal_fn.classBar = function (d) {\r\n return this.classShape(d) + this.generateClass(CLASS.bar, d.index);\r\n };\r\n c3_chart_internal_fn.classBars = function (d) {\r\n return this.classShapes(d) + this.generateClass(CLASS.bars, d.id);\r\n };\r\n c3_chart_internal_fn.classArc = function (d) {\r\n return this.classShape(d.data) + this.generateClass(CLASS.arc, d.data.id);\r\n };\r\n c3_chart_internal_fn.classArcs = function (d) {\r\n return this.classShapes(d.data) + this.generateClass(CLASS.arcs, d.data.id);\r\n };\r\n c3_chart_internal_fn.classArea = function (d) {\r\n return this.classShape(d) + this.generateClass(CLASS.area, d.id);\r\n };\r\n c3_chart_internal_fn.classAreas = function (d) {\r\n return this.classShapes(d) + this.generateClass(CLASS.areas, d.id);\r\n };\r\n c3_chart_internal_fn.classRegion = function (d, i) {\r\n return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d['class'] : '');\r\n };\r\n c3_chart_internal_fn.classEvent = function (d) {\r\n return this.generateClass(CLASS.eventRect, d.index);\r\n };\r\n c3_chart_internal_fn.classTarget = function (id) {\r\n var $$ = this;\r\n var additionalClassSuffix = $$.config.data_classes[id], additionalClass = '';\r\n if (additionalClassSuffix) {\r\n additionalClass = ' ' + CLASS.target + '-' + additionalClassSuffix;\r\n }\r\n return $$.generateClass(CLASS.target, id) + additionalClass;\r\n };\r\n c3_chart_internal_fn.classFocus = function (d) {\r\n return this.classFocused(d) + this.classDefocused(d);\r\n };\r\n c3_chart_internal_fn.classFocused = function (d) {\r\n return ' ' + (this.focusedTargetIds.indexOf(d.id) >= 0 ? CLASS.focused : '');\r\n };\r\n c3_chart_internal_fn.classDefocused = function (d) {\r\n return ' ' + (this.defocusedTargetIds.indexOf(d.id) >= 0 ? CLASS.defocused : '');\r\n };\r\n c3_chart_internal_fn.classChartText = function (d) {\r\n return CLASS.chartText + this.classTarget(d.id);\r\n };\r\n c3_chart_internal_fn.classChartLine = function (d) {\r\n return CLASS.chartLine + this.classTarget(d.id);\r\n };\r\n c3_chart_internal_fn.classChartBar = function (d) {\r\n return CLASS.chartBar + this.classTarget(d.id);\r\n };\r\n c3_chart_internal_fn.classChartArc = function (d) {\r\n return CLASS.chartArc + this.classTarget(d.data.id);\r\n };\r\n c3_chart_internal_fn.getTargetSelectorSuffix = function (targetId) {\r\n return targetId || targetId === 0 ? ('-' + targetId).replace(/[\\s?!@#$%^&*()_=+,.<>'\":;\\[\\]\\/|~`{}\\\\]/g, '-') : '';\r\n };\r\n c3_chart_internal_fn.selectorTarget = function (id, prefix) {\r\n return (prefix || '') + '.' + CLASS.target + this.getTargetSelectorSuffix(id);\r\n };\r\n c3_chart_internal_fn.selectorTargets = function (ids, prefix) {\r\n var $$ = this;\r\n ids = ids || [];\r\n return ids.length ? ids.map(function (id) { return $$.selectorTarget(id, prefix); }) : null;\r\n };\r\n c3_chart_internal_fn.selectorLegend = function (id) {\r\n return '.' + CLASS.legendItem + this.getTargetSelectorSuffix(id);\r\n };\r\n c3_chart_internal_fn.selectorLegends = function (ids) {\r\n var $$ = this;\r\n return ids && ids.length ? ids.map(function (id) { return $$.selectorLegend(id); }) : null;\r\n };\r\n\r\n var isValue = c3_chart_internal_fn.isValue = function (v) {\r\n return v || v === 0;\r\n },\r\n isFunction = c3_chart_internal_fn.isFunction = function (o) {\r\n return typeof o === 'function';\r\n },\r\n isString = c3_chart_internal_fn.isString = function (o) {\r\n return typeof o === 'string';\r\n },\r\n isUndefined = c3_chart_internal_fn.isUndefined = function (v) {\r\n return typeof v === 'undefined';\r\n },\r\n isDefined = c3_chart_internal_fn.isDefined = function (v) {\r\n return typeof v !== 'undefined';\r\n },\r\n ceil10 = c3_chart_internal_fn.ceil10 = function (v) {\r\n return Math.ceil(v / 10) * 10;\r\n },\r\n asHalfPixel = c3_chart_internal_fn.asHalfPixel = function (n) {\r\n return Math.ceil(n) + 0.5;\r\n },\r\n diffDomain = c3_chart_internal_fn.diffDomain = function (d) {\r\n return d[1] - d[0];\r\n },\r\n isEmpty = c3_chart_internal_fn.isEmpty = function (o) {\r\n return typeof o === 'undefined' || o === null || (isString(o) && o.length === 0) || (typeof o === 'object' && Object.keys(o).length === 0);\r\n },\r\n notEmpty = c3_chart_internal_fn.notEmpty = function (o) {\r\n return !c3_chart_internal_fn.isEmpty(o);\r\n },\r\n getOption = c3_chart_internal_fn.getOption = function (options, key, defaultValue) {\r\n return isDefined(options[key]) ? options[key] : defaultValue;\r\n },\r\n hasValue = c3_chart_internal_fn.hasValue = function (dict, value) {\r\n var found = false;\r\n Object.keys(dict).forEach(function (key) {\r\n if (dict[key] === value) { found = true; }\r\n });\r\n return found;\r\n },\r\n getPathBox = c3_chart_internal_fn.getPathBox = function (path) {\r\n var box = path.getBoundingClientRect(),\r\n items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)],\r\n minX = items[0].x, minY = Math.min(items[0].y, items[1].y);\r\n return {x: minX, y: minY, width: box.width, height: box.height};\r\n };\r\n\r\n c3_chart_fn.focus = function (targetIds) {\r\n var $$ = this.internal, candidates;\r\n\r\n targetIds = $$.mapToTargetIds(targetIds);\r\n candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))),\r\n\r\n this.revert();\r\n this.defocus();\r\n candidates.classed(CLASS.focused, true).classed(CLASS.defocused, false);\r\n if ($$.hasArcType()) {\r\n $$.expandArc(targetIds);\r\n }\r\n $$.toggleFocusLegend(targetIds, true);\r\n\r\n $$.focusedTargetIds = targetIds;\r\n $$.defocusedTargetIds = $$.defocusedTargetIds.filter(function (id) {\r\n return targetIds.indexOf(id) < 0;\r\n });\r\n };\r\n\r\n c3_chart_fn.defocus = function (targetIds) {\r\n var $$ = this.internal, candidates;\r\n\r\n targetIds = $$.mapToTargetIds(targetIds);\r\n candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))),\r\n\r\n candidates.classed(CLASS.focused, false).classed(CLASS.defocused, true);\r\n if ($$.hasArcType()) {\r\n $$.unexpandArc(targetIds);\r\n }\r\n $$.toggleFocusLegend(targetIds, false);\r\n\r\n $$.focusedTargetIds = $$.focusedTargetIds.filter(function (id) {\r\n return targetIds.indexOf(id) < 0;\r\n });\r\n $$.defocusedTargetIds = targetIds;\r\n };\r\n\r\n c3_chart_fn.revert = function (targetIds) {\r\n var $$ = this.internal, candidates;\r\n\r\n targetIds = $$.mapToTargetIds(targetIds);\r\n candidates = $$.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets\r\n\r\n candidates.classed(CLASS.focused, false).classed(CLASS.defocused, false);\r\n if ($$.hasArcType()) {\r\n $$.unexpandArc(targetIds);\r\n }\r\n if ($$.config.legend_show) {\r\n $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));\r\n $$.legend.selectAll($$.selectorLegends(targetIds))\r\n .filter(function () {\r\n return $$.d3.select(this).classed(CLASS.legendItemFocused);\r\n })\r\n .classed(CLASS.legendItemFocused, false);\r\n }\r\n\r\n $$.focusedTargetIds = [];\r\n $$.defocusedTargetIds = [];\r\n };\r\n\r\n c3_chart_fn.show = function (targetIds, options) {\r\n var $$ = this.internal, targets;\r\n\r\n targetIds = $$.mapToTargetIds(targetIds);\r\n options = options || {};\r\n\r\n $$.removeHiddenTargetIds(targetIds);\r\n targets = $$.svg.selectAll($$.selectorTargets(targetIds));\r\n\r\n targets.transition()\r\n .style('opacity', 1, 'important')\r\n .call($$.endall, function () {\r\n targets.style('opacity', null).style('opacity', 1);\r\n });\r\n\r\n if (options.withLegend) {\r\n $$.showLegend(targetIds);\r\n }\r\n\r\n $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true});\r\n };\r\n\r\n c3_chart_fn.hide = function (targetIds, options) {\r\n var $$ = this.internal, targets;\r\n\r\n targetIds = $$.mapToTargetIds(targetIds);\r\n options = options || {};\r\n\r\n $$.addHiddenTargetIds(targetIds);\r\n targets = $$.svg.selectAll($$.selectorTargets(targetIds));\r\n\r\n targets.transition()\r\n .style('opacity', 0, 'important')\r\n .call($$.endall, function () {\r\n targets.style('opacity', null).style('opacity', 0);\r\n });\r\n\r\n if (options.withLegend) {\r\n $$.hideLegend(targetIds);\r\n }\r\n\r\n $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true});\r\n };\r\n\r\n c3_chart_fn.toggle = function (targetIds, options) {\r\n var that = this, $$ = this.internal;\r\n $$.mapToTargetIds(targetIds).forEach(function (targetId) {\r\n $$.isTargetToShow(targetId) ? that.hide(targetId, options) : that.show(targetId, options);\r\n });\r\n };\r\n\r\n c3_chart_fn.zoom = function (domain) {\r\n var $$ = this.internal;\r\n if (domain) {\r\n if ($$.isTimeSeries()) {\r\n domain = domain.map(function (x) { return $$.parseDate(x); });\r\n }\r\n $$.brush.extent(domain);\r\n $$.redraw({withUpdateXDomain: true, withY: $$.config.zoom_rescale});\r\n $$.config.zoom_onzoom.call(this, $$.x.orgDomain());\r\n }\r\n return $$.brush.extent();\r\n };\r\n c3_chart_fn.zoom.enable = function (enabled) {\r\n var $$ = this.internal;\r\n $$.config.zoom_enabled = enabled;\r\n $$.updateAndRedraw();\r\n };\r\n c3_chart_fn.unzoom = function () {\r\n var $$ = this.internal;\r\n $$.brush.clear().update();\r\n $$.redraw({withUpdateXDomain: true});\r\n };\r\n\r\n c3_chart_fn.zoom.max = function (max) {\r\n var $$ = this.internal, config = $$.config, d3 = $$.d3;\r\n if (max === 0 || max) {\r\n config.zoom_x_max = d3.max([$$.orgXDomain[1], max]);\r\n }\r\n else {\r\n return config.zoom_x_max;\r\n }\r\n };\r\n\r\n c3_chart_fn.zoom.min = function (min) {\r\n var $$ = this.internal, config = $$.config, d3 = $$.d3;\r\n if (min === 0 || min) {\r\n config.zoom_x_min = d3.min([$$.orgXDomain[0], min]);\r\n }\r\n else {\r\n return config.zoom_x_min;\r\n }\r\n };\r\n\r\n c3_chart_fn.zoom.range = function (range) {\r\n if (arguments.length) {\r\n if (isDefined(range.max)) { this.domain.max(range.max); }\r\n if (isDefined(range.min)) { this.domain.min(range.min); }\r\n } else {\r\n return {\r\n max: this.domain.max(),\r\n min: this.domain.min()\r\n };\r\n }\r\n };\r\n\r\n c3_chart_fn.load = function (args) {\r\n var $$ = this.internal, config = $$.config;\r\n // update xs if specified\r\n if (args.xs) {\r\n $$.addXs(args.xs);\r\n }\r\n // update names if exists\r\n if ('names' in args) {\r\n c3_chart_fn.data.names.bind(this)(args.names);\r\n }\r\n // update classes if exists\r\n if ('classes' in args) {\r\n Object.keys(args.classes).forEach(function (id) {\r\n config.data_classes[id] = args.classes[id];\r\n });\r\n }\r\n // update categories if exists\r\n if ('categories' in args && $$.isCategorized()) {\r\n config.axis_x_categories = args.categories;\r\n }\r\n // update axes if exists\r\n if ('axes' in args) {\r\n Object.keys(args.axes).forEach(function (id) {\r\n config.data_axes[id] = args.axes[id];\r\n });\r\n }\r\n // update colors if exists\r\n if ('colors' in args) {\r\n Object.keys(args.colors).forEach(function (id) {\r\n config.data_colors[id] = args.colors[id];\r\n });\r\n }\r\n // use cache if exists\r\n if ('cacheIds' in args && $$.hasCaches(args.cacheIds)) {\r\n $$.load($$.getCaches(args.cacheIds), args.done);\r\n return;\r\n }\r\n // unload if needed\r\n if ('unload' in args) {\r\n // TODO: do not unload if target will load (included in url/rows/columns)\r\n $$.unload($$.mapToTargetIds((typeof args.unload === 'boolean' && args.unload) ? null : args.unload), function () {\r\n $$.loadFromArgs(args);\r\n });\r\n } else {\r\n $$.loadFromArgs(args);\r\n }\r\n };\r\n\r\n c3_chart_fn.unload = function (args) {\r\n var $$ = this.internal;\r\n args = args || {};\r\n if (args instanceof Array) {\r\n args = {ids: args};\r\n } else if (typeof args === 'string') {\r\n args = {ids: [args]};\r\n }\r\n $$.unload($$.mapToTargetIds(args.ids), function () {\r\n $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true});\r\n if (args.done) { args.done(); }\r\n });\r\n };\r\n\r\n c3_chart_fn.flow = function (args) {\r\n var $$ = this.internal,\r\n targets, data, notfoundIds = [], orgDataCount = $$.getMaxDataCount(),\r\n dataCount, domain, baseTarget, baseValue, length = 0, tail = 0, diff, to;\r\n\r\n if (args.json) {\r\n data = $$.convertJsonToData(args.json, args.keys);\r\n }\r\n else if (args.rows) {\r\n data = $$.convertRowsToData(args.rows);\r\n }\r\n else if (args.columns) {\r\n data = $$.convertColumnsToData(args.columns);\r\n }\r\n else {\r\n return;\r\n }\r\n targets = $$.convertDataToTargets(data, true);\r\n\r\n // Update/Add data\r\n $$.data.targets.forEach(function (t) {\r\n var found = false, i, j;\r\n for (i = 0; i < targets.length; i++) {\r\n if (t.id === targets[i].id) {\r\n found = true;\r\n\r\n if (t.values[t.values.length - 1]) {\r\n tail = t.values[t.values.length - 1].index + 1;\r\n }\r\n length = targets[i].values.length;\r\n\r\n for (j = 0; j < length; j++) {\r\n targets[i].values[j].index = tail + j;\r\n if (!$$.isTimeSeries()) {\r\n targets[i].values[j].x = tail + j;\r\n }\r\n }\r\n t.values = t.values.concat(targets[i].values);\r\n\r\n targets.splice(i, 1);\r\n break;\r\n }\r\n }\r\n if (!found) { notfoundIds.push(t.id); }\r\n });\r\n\r\n // Append null for not found targets\r\n $$.data.targets.forEach(function (t) {\r\n var i, j;\r\n for (i = 0; i < notfoundIds.length; i++) {\r\n if (t.id === notfoundIds[i]) {\r\n tail = t.values[t.values.length - 1].index + 1;\r\n for (j = 0; j < length; j++) {\r\n t.values.push({\r\n id: t.id,\r\n index: tail + j,\r\n x: $$.isTimeSeries() ? $$.getOtherTargetX(tail + j) : tail + j,\r\n value: null\r\n });\r\n }\r\n }\r\n }\r\n });\r\n\r\n // Generate null values for new target\r\n if ($$.data.targets.length) {\r\n targets.forEach(function (t) {\r\n var i, missing = [];\r\n for (i = $$.data.targets[0].values[0].index; i < tail; i++) {\r\n missing.push({\r\n id: t.id,\r\n index: i,\r\n x: $$.isTimeSeries() ? $$.getOtherTargetX(i) : i,\r\n value: null\r\n });\r\n }\r\n t.values.forEach(function (v) {\r\n v.index += tail;\r\n if (!$$.isTimeSeries()) {\r\n v.x += tail;\r\n }\r\n });\r\n t.values = missing.concat(t.values);\r\n });\r\n }\r\n $$.data.targets = $$.data.targets.concat(targets); // add remained\r\n\r\n // check data count because behavior needs to change when it's only one\r\n dataCount = $$.getMaxDataCount();\r\n baseTarget = $$.data.targets[0];\r\n baseValue = baseTarget.values[0];\r\n\r\n // Update length to flow if needed\r\n if (isDefined(args.to)) {\r\n length = 0;\r\n to = $$.isTimeSeries() ? $$.parseDate(args.to) : args.to;\r\n baseTarget.values.forEach(function (v) {\r\n if (v.x < to) { length++; }\r\n });\r\n } else if (isDefined(args.length)) {\r\n length = args.length;\r\n }\r\n\r\n // If only one data, update the domain to flow from left edge of the chart\r\n if (!orgDataCount) {\r\n if ($$.isTimeSeries()) {\r\n if (baseTarget.values.length > 1) {\r\n diff = baseTarget.values[baseTarget.values.length - 1].x - baseValue.x;\r\n } else {\r\n diff = baseValue.x - $$.getXDomain($$.data.targets)[0];\r\n }\r\n } else {\r\n diff = 1;\r\n }\r\n domain = [baseValue.x - diff, baseValue.x];\r\n $$.updateXDomain(null, true, true, false, domain);\r\n } else if (orgDataCount === 1) {\r\n if ($$.isTimeSeries()) {\r\n diff = (baseTarget.values[baseTarget.values.length - 1].x - baseValue.x) / 2;\r\n domain = [new Date(+baseValue.x - diff), new Date(+baseValue.x + diff)];\r\n $$.updateXDomain(null, true, true, false, domain);\r\n }\r\n }\r\n\r\n // Set targets\r\n $$.updateTargets($$.data.targets);\r\n\r\n // Redraw with new targets\r\n $$.redraw({\r\n flow: {\r\n index: baseValue.index,\r\n length: length,\r\n duration: isValue(args.duration) ? args.duration : $$.config.transition_duration,\r\n done: args.done,\r\n orgDataCount: orgDataCount,\r\n },\r\n withLegend: true,\r\n withTransition: orgDataCount > 1,\r\n withTrimXDomain: false,\r\n withUpdateXAxis: true,\r\n });\r\n };\r\n\r\n c3_chart_internal_fn.generateFlow = function (args) {\r\n var $$ = this, config = $$.config, d3 = $$.d3;\r\n\r\n return function () {\r\n var targets = args.targets,\r\n flow = args.flow,\r\n drawBar = args.drawBar,\r\n drawLine = args.drawLine,\r\n drawArea = args.drawArea,\r\n cx = args.cx,\r\n cy = args.cy,\r\n xv = args.xv,\r\n xForText = args.xForText,\r\n yForText = args.yForText,\r\n duration = args.duration;\r\n\r\n var translateX, scaleX = 1, transform,\r\n flowIndex = flow.index,\r\n flowLength = flow.length,\r\n flowStart = $$.getValueOnIndex($$.data.targets[0].values, flowIndex),\r\n flowEnd = $$.getValueOnIndex($$.data.targets[0].values, flowIndex + flowLength),\r\n orgDomain = $$.x.domain(), domain,\r\n durationForFlow = flow.duration || duration,\r\n done = flow.done || function () {},\r\n wait = $$.generateWait();\r\n\r\n var xgrid = $$.xgrid || d3.selectAll([]),\r\n xgridLines = $$.xgridLines || d3.selectAll([]),\r\n mainRegion = $$.mainRegion || d3.selectAll([]),\r\n mainText = $$.mainText || d3.selectAll([]),\r\n mainBar = $$.mainBar || d3.selectAll([]),\r\n mainLine = $$.mainLine || d3.selectAll([]),\r\n mainArea = $$.mainArea || d3.selectAll([]),\r\n mainCircle = $$.mainCircle || d3.selectAll([]);\r\n\r\n // set flag\r\n $$.flowing = true;\r\n\r\n // remove head data after rendered\r\n $$.data.targets.forEach(function (d) {\r\n d.values.splice(0, flowLength);\r\n });\r\n\r\n // update x domain to generate axis elements for flow\r\n domain = $$.updateXDomain(targets, true, true);\r\n // update elements related to x scale\r\n if ($$.updateXGrid) { $$.updateXGrid(true); }\r\n\r\n // generate transform to flow\r\n if (!flow.orgDataCount) { // if empty\r\n if ($$.data.targets[0].values.length !== 1) {\r\n translateX = $$.x(orgDomain[0]) - $$.x(domain[0]);\r\n } else {\r\n if ($$.isTimeSeries()) {\r\n flowStart = $$.getValueOnIndex($$.data.targets[0].values, 0);\r\n flowEnd = $$.getValueOnIndex($$.data.targets[0].values, $$.data.targets[0].values.length - 1);\r\n translateX = $$.x(flowStart.x) - $$.x(flowEnd.x);\r\n } else {\r\n translateX = diffDomain(domain) / 2;\r\n }\r\n }\r\n } else if (flow.orgDataCount === 1 || flowStart.x === flowEnd.x) {\r\n translateX = $$.x(orgDomain[0]) - $$.x(domain[0]);\r\n } else {\r\n if ($$.isTimeSeries()) {\r\n translateX = ($$.x(orgDomain[0]) - $$.x(domain[0]));\r\n } else {\r\n translateX = ($$.x(flowStart.x) - $$.x(flowEnd.x));\r\n }\r\n }\r\n scaleX = (diffDomain(orgDomain) / diffDomain(domain));\r\n transform = 'translate(' + translateX + ',0) scale(' + scaleX + ',1)';\r\n\r\n $$.hideXGridFocus();\r\n\r\n d3.transition().ease('linear').duration(durationForFlow).each(function () {\r\n wait.add($$.axes.x.transition().call($$.xAxis));\r\n wait.add(mainBar.transition().attr('transform', transform));\r\n wait.add(mainLine.transition().attr('transform', transform));\r\n wait.add(mainArea.transition().attr('transform', transform));\r\n wait.add(mainCircle.transition().attr('transform', transform));\r\n wait.add(mainText.transition().attr('transform', transform));\r\n wait.add(mainRegion.filter($$.isRegionOnX).transition().attr('transform', transform));\r\n wait.add(xgrid.transition().attr('transform', transform));\r\n wait.add(xgridLines.transition().attr('transform', transform));\r\n })\r\n .call(wait, function () {\r\n var i, shapes = [], texts = [], eventRects = [];\r\n\r\n // remove flowed elements\r\n if (flowLength) {\r\n for (i = 0; i < flowLength; i++) {\r\n shapes.push('.' + CLASS.shape + '-' + (flowIndex + i));\r\n texts.push('.' + CLASS.text + '-' + (flowIndex + i));\r\n eventRects.push('.' + CLASS.eventRect + '-' + (flowIndex + i));\r\n }\r\n $$.svg.selectAll('.' + CLASS.shapes).selectAll(shapes).remove();\r\n $$.svg.selectAll('.' + CLASS.texts).selectAll(texts).remove();\r\n $$.svg.selectAll('.' + CLASS.eventRects).selectAll(eventRects).remove();\r\n $$.svg.select('.' + CLASS.xgrid).remove();\r\n }\r\n\r\n // draw again for removing flowed elements and reverting attr\r\n xgrid\r\n .attr('transform', null)\r\n .attr($$.xgridAttr);\r\n xgridLines\r\n .attr('transform', null);\r\n xgridLines.select('line')\r\n .attr(\"x1\", config.axis_rotated ? 0 : xv)\r\n .attr(\"x2\", config.axis_rotated ? $$.width : xv);\r\n xgridLines.select('text')\r\n .attr(\"x\", config.axis_rotated ? $$.width : 0)\r\n .attr(\"y\", xv);\r\n mainBar\r\n .attr('transform', null)\r\n .attr(\"d\", drawBar);\r\n mainLine\r\n .attr('transform', null)\r\n .attr(\"d\", drawLine);\r\n mainArea\r\n .attr('transform', null)\r\n .attr(\"d\", drawArea);\r\n mainCircle\r\n .attr('transform', null)\r\n .attr(\"cx\", cx)\r\n .attr(\"cy\", cy);\r\n mainText\r\n .attr('transform', null)\r\n .attr('x', xForText)\r\n .attr('y', yForText)\r\n .style('fill-opacity', $$.opacityForText.bind($$));\r\n mainRegion\r\n .attr('transform', null);\r\n mainRegion.select('rect').filter($$.isRegionOnX)\r\n .attr(\"x\", $$.regionX.bind($$))\r\n .attr(\"width\", $$.regionWidth.bind($$));\r\n\r\n if (config.interaction_enabled) {\r\n $$.redrawEventRect();\r\n }\r\n\r\n // callback for end of flow\r\n done();\r\n\r\n $$.flowing = false;\r\n });\r\n };\r\n };\r\n\r\n c3_chart_fn.selected = function (targetId) {\r\n var $$ = this.internal, d3 = $$.d3;\r\n return d3.merge(\r\n $$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape)\r\n .filter(function () { return d3.select(this).classed(CLASS.SELECTED); })\r\n .map(function (d) { return d.map(function (d) { var data = d.__data__; return data.data ? data.data : data; }); })\r\n );\r\n };\r\n c3_chart_fn.select = function (ids, indices, resetOther) {\r\n var $$ = this.internal, d3 = $$.d3, config = $$.config;\r\n if (! config.data_selection_enabled) { return; }\r\n $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) {\r\n var shape = d3.select(this), id = d.data ? d.data.id : d.id,\r\n toggle = $$.getToggle(this, d).bind($$),\r\n isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,\r\n isTargetIndex = !indices || indices.indexOf(i) >= 0,\r\n isSelected = shape.classed(CLASS.SELECTED);\r\n // line/area selection not supported yet\r\n if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) {\r\n return;\r\n }\r\n if (isTargetId && isTargetIndex) {\r\n if (config.data_selection_isselectable(d) && !isSelected) {\r\n toggle(true, shape.classed(CLASS.SELECTED, true), d, i);\r\n }\r\n } else if (isDefined(resetOther) && resetOther) {\r\n if (isSelected) {\r\n toggle(false, shape.classed(CLASS.SELECTED, false), d, i);\r\n }\r\n }\r\n });\r\n };\r\n c3_chart_fn.unselect = function (ids, indices) {\r\n var $$ = this.internal, d3 = $$.d3, config = $$.config;\r\n if (! config.data_selection_enabled) { return; }\r\n $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) {\r\n var shape = d3.select(this), id = d.data ? d.data.id : d.id,\r\n toggle = $$.getToggle(this, d).bind($$),\r\n isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,\r\n isTargetIndex = !indices || indices.indexOf(i) >= 0,\r\n isSelected = shape.classed(CLASS.SELECTED);\r\n // line/area selection not supported yet\r\n if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) {\r\n return;\r\n }\r\n if (isTargetId && isTargetIndex) {\r\n if (config.data_selection_isselectable(d)) {\r\n if (isSelected) {\r\n toggle(false, shape.classed(CLASS.SELECTED, false), d, i);\r\n }\r\n }\r\n }\r\n });\r\n };\r\n\r\n c3_chart_fn.transform = function (type, targetIds) {\r\n var $$ = this.internal,\r\n options = ['pie', 'donut'].indexOf(type) >= 0 ? {withTransform: true} : null;\r\n $$.transformTo(targetIds, type, options);\r\n };\r\n\r\n c3_chart_internal_fn.transformTo = function (targetIds, type, optionsForRedraw) {\r\n var $$ = this,\r\n withTransitionForAxis = !$$.hasArcType(),\r\n options = optionsForRedraw || {withTransitionForAxis: withTransitionForAxis};\r\n options.withTransitionForTransform = false;\r\n $$.transiting = false;\r\n $$.setTargetType(targetIds, type);\r\n $$.updateTargets($$.data.targets); // this is needed when transforming to arc\r\n $$.updateAndRedraw(options);\r\n };\r\n\r\n c3_chart_fn.groups = function (groups) {\r\n var $$ = this.internal, config = $$.config;\r\n if (isUndefined(groups)) { return config.data_groups; }\r\n config.data_groups = groups;\r\n $$.redraw();\r\n return config.data_groups;\r\n };\r\n\r\n c3_chart_fn.xgrids = function (grids) {\r\n var $$ = this.internal, config = $$.config;\r\n if (! grids) { return config.grid_x_lines; }\r\n config.grid_x_lines = grids;\r\n $$.redrawWithoutRescale();\r\n return config.grid_x_lines;\r\n };\r\n c3_chart_fn.xgrids.add = function (grids) {\r\n var $$ = this.internal;\r\n return this.xgrids($$.config.grid_x_lines.concat(grids ? grids : []));\r\n };\r\n c3_chart_fn.xgrids.remove = function (params) { // TODO: multiple\r\n var $$ = this.internal;\r\n $$.removeGridLines(params, true);\r\n };\r\n\r\n c3_chart_fn.ygrids = function (grids) {\r\n var $$ = this.internal, config = $$.config;\r\n if (! grids) { return config.grid_y_lines; }\r\n config.grid_y_lines = grids;\r\n $$.redrawWithoutRescale();\r\n return config.grid_y_lines;\r\n };\r\n c3_chart_fn.ygrids.add = function (grids) {\r\n var $$ = this.internal;\r\n return this.ygrids($$.config.grid_y_lines.concat(grids ? grids : []));\r\n };\r\n c3_chart_fn.ygrids.remove = function (params) { // TODO: multiple\r\n var $$ = this.internal;\r\n $$.removeGridLines(params, false);\r\n };\r\n\r\n c3_chart_fn.regions = function (regions) {\r\n var $$ = this.internal, config = $$.config;\r\n if (!regions) { return config.regions; }\r\n config.regions = regions;\r\n $$.redrawWithoutRescale();\r\n return config.regions;\r\n };\r\n c3_chart_fn.regions.add = function (regions) {\r\n var $$ = this.internal, config = $$.config;\r\n if (!regions) { return config.regions; }\r\n config.regions = config.regions.concat(regions);\r\n $$.redrawWithoutRescale();\r\n return config.regions;\r\n };\r\n c3_chart_fn.regions.remove = function (options) {\r\n var $$ = this.internal, config = $$.config,\r\n duration, classes, regions;\r\n\r\n options = options || {};\r\n duration = $$.getOption(options, \"duration\", config.transition_duration);\r\n classes = $$.getOption(options, \"classes\", [CLASS.region]);\r\n\r\n regions = $$.main.select('.' + CLASS.regions).selectAll(classes.map(function (c) { return '.' + c; }));\r\n (duration ? regions.transition().duration(duration) : regions)\r\n .style('opacity', 0)\r\n .remove();\r\n\r\n config.regions = config.regions.filter(function (region) {\r\n var found = false;\r\n if (!region['class']) {\r\n return true;\r\n }\r\n region['class'].split(' ').forEach(function (c) {\r\n if (classes.indexOf(c) >= 0) { found = true; }\r\n });\r\n return !found;\r\n });\r\n\r\n return config.regions;\r\n };\r\n\r\n c3_chart_fn.data = function (targetIds) {\r\n var targets = this.internal.data.targets;\r\n return typeof targetIds === 'undefined' ? targets : targets.filter(function (t) {\r\n return [].concat(targetIds).indexOf(t.id) >= 0;\r\n });\r\n };\r\n c3_chart_fn.data.shown = function (targetIds) {\r\n return this.internal.filterTargetsToShow(this.data(targetIds));\r\n };\r\n c3_chart_fn.data.values = function (targetId) {\r\n var targets, values = null;\r\n if (targetId) {\r\n targets = this.data(targetId);\r\n values = targets[0] ? targets[0].values.map(function (d) { return d.value; }) : null;\r\n }\r\n return values;\r\n };\r\n c3_chart_fn.data.names = function (names) {\r\n this.internal.clearLegendItemTextBoxCache();\r\n return this.internal.updateDataAttributes('names', names);\r\n };\r\n c3_chart_fn.data.colors = function (colors) {\r\n return this.internal.updateDataAttributes('colors', colors);\r\n };\r\n c3_chart_fn.data.axes = function (axes) {\r\n return this.internal.updateDataAttributes('axes', axes);\r\n };\r\n\r\n c3_chart_fn.category = function (i, category) {\r\n var $$ = this.internal, config = $$.config;\r\n if (arguments.length > 1) {\r\n config.axis_x_categories[i] = category;\r\n $$.redraw();\r\n }\r\n return config.axis_x_categories[i];\r\n };\r\n c3_chart_fn.categories = function (categories) {\r\n var $$ = this.internal, config = $$.config;\r\n if (!arguments.length) { return config.axis_x_categories; }\r\n config.axis_x_categories = categories;\r\n $$.redraw();\r\n return config.axis_x_categories;\r\n };\r\n\r\n // TODO: fix\r\n c3_chart_fn.color = function (id) {\r\n var $$ = this.internal;\r\n return $$.color(id); // more patterns\r\n };\r\n\r\n c3_chart_fn.x = function (x) {\r\n var $$ = this.internal;\r\n if (arguments.length) {\r\n $$.updateTargetX($$.data.targets, x);\r\n $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true});\r\n }\r\n return $$.data.xs;\r\n };\r\n c3_chart_fn.xs = function (xs) {\r\n var $$ = this.internal;\r\n if (arguments.length) {\r\n $$.updateTargetXs($$.data.targets, xs);\r\n $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true});\r\n }\r\n return $$.data.xs;\r\n };\r\n\r\n c3_chart_fn.axis = function () {};\r\n c3_chart_fn.axis.labels = function (labels) {\r\n var $$ = this.internal;\r\n if (arguments.length) {\r\n Object.keys(labels).forEach(function (axisId) {\r\n $$.axis.setLabelText(axisId, labels[axisId]);\r\n });\r\n $$.axis.updateLabels();\r\n }\r\n // TODO: return some values?\r\n };\r\n c3_chart_fn.axis.max = function (max) {\r\n var $$ = this.internal, config = $$.config;\r\n if (arguments.length) {\r\n if (typeof max === 'object') {\r\n if (isValue(max.x)) { config.axis_x_max = max.x; }\r\n if (isValue(max.y)) { config.axis_y_max = max.y; }\r\n if (isValue(max.y2)) { config.axis_y2_max = max.y2; }\r\n } else {\r\n config.axis_y_max = config.axis_y2_max = max;\r\n }\r\n $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true});\r\n } else {\r\n return {\r\n x: config.axis_x_max,\r\n y: config.axis_y_max,\r\n y2: config.axis_y2_max\r\n };\r\n }\r\n };\r\n c3_chart_fn.axis.min = function (min) {\r\n var $$ = this.internal, config = $$.config;\r\n if (arguments.length) {\r\n if (typeof min === 'object') {\r\n if (isValue(min.x)) { config.axis_x_min = min.x; }\r\n if (isValue(min.y)) { config.axis_y_min = min.y; }\r\n if (isValue(min.y2)) { config.axis_y2_min = min.y2; }\r\n } else {\r\n config.axis_y_min = config.axis_y2_min = min;\r\n }\r\n $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true});\r\n } else {\r\n return {\r\n x: config.axis_x_min,\r\n y: config.axis_y_min,\r\n y2: config.axis_y2_min\r\n };\r\n }\r\n };\r\n c3_chart_fn.axis.range = function (range) {\r\n if (arguments.length) {\r\n if (isDefined(range.max)) { this.axis.max(range.max); }\r\n if (isDefined(range.min)) { this.axis.min(range.min); }\r\n } else {\r\n return {\r\n max: this.axis.max(),\r\n min: this.axis.min()\r\n };\r\n }\r\n };\r\n\r\n c3_chart_fn.legend = function () {};\r\n c3_chart_fn.legend.show = function (targetIds) {\r\n var $$ = this.internal;\r\n $$.showLegend($$.mapToTargetIds(targetIds));\r\n $$.updateAndRedraw({withLegend: true});\r\n };\r\n c3_chart_fn.legend.hide = function (targetIds) {\r\n var $$ = this.internal;\r\n $$.hideLegend($$.mapToTargetIds(targetIds));\r\n $$.updateAndRedraw({withLegend: true});\r\n };\r\n\r\n c3_chart_fn.resize = function (size) {\r\n var $$ = this.internal, config = $$.config;\r\n config.size_width = size ? size.width : null;\r\n config.size_height = size ? size.height : null;\r\n this.flush();\r\n };\r\n\r\n c3_chart_fn.flush = function () {\r\n var $$ = this.internal;\r\n $$.updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false});\r\n };\r\n\r\n c3_chart_fn.destroy = function () {\r\n var $$ = this.internal;\r\n\r\n window.clearInterval($$.intervalForObserveInserted);\r\n\r\n if ($$.resizeTimeout !== undefined) {\r\n window.clearTimeout($$.resizeTimeout);\r\n }\r\n\r\n if (window.detachEvent) {\r\n window.detachEvent('onresize', $$.resizeFunction);\r\n } else if (window.removeEventListener) {\r\n window.removeEventListener('resize', $$.resizeFunction);\r\n } else {\r\n var wrapper = window.onresize;\r\n // check if no one else removed our wrapper and remove our resizeFunction from it\r\n if (wrapper && wrapper.add && wrapper.remove) {\r\n wrapper.remove($$.resizeFunction);\r\n }\r\n }\r\n\r\n $$.selectChart.classed('c3', false).html(\"\");\r\n\r\n // MEMO: this is needed because the reference of some elements will not be released, then memory leak will happen.\r\n Object.keys($$).forEach(function (key) {\r\n $$[key] = null;\r\n });\r\n\r\n return null;\r\n };\r\n\r\n c3_chart_fn.tooltip = function () {};\r\n c3_chart_fn.tooltip.show = function (args) {\r\n var $$ = this.internal, index, mouse;\r\n\r\n // determine mouse position on the chart\r\n if (args.mouse) {\r\n mouse = args.mouse;\r\n }\r\n\r\n // determine focus data\r\n if (args.data) {\r\n if ($$.isMultipleX()) {\r\n // if multiple xs, target point will be determined by mouse\r\n mouse = [$$.x(args.data.x), $$.getYScale(args.data.id)(args.data.value)];\r\n index = null;\r\n } else {\r\n // TODO: when tooltip_grouped = false\r\n index = isValue(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x);\r\n }\r\n }\r\n else if (typeof args.x !== 'undefined') {\r\n index = $$.getIndexByX(args.x);\r\n }\r\n else if (typeof args.index !== 'undefined') {\r\n index = args.index;\r\n }\r\n\r\n // emulate mouse events to show\r\n $$.dispatchEvent('mouseover', index, mouse);\r\n $$.dispatchEvent('mousemove', index, mouse);\r\n\r\n $$.config.tooltip_onshow.call($$, args.data);\r\n };\r\n c3_chart_fn.tooltip.hide = function () {\r\n // TODO: get target data by checking the state of focus\r\n this.internal.dispatchEvent('mouseout', 0);\r\n\r\n this.internal.config.tooltip_onhide.call(this);\r\n };\r\n\r\n // Features:\r\n // 1. category axis\r\n // 2. ceil values of translate/x/y to int for half pixel antialiasing\r\n // 3. multiline tick text\r\n var tickTextCharSize;\r\n function c3_axis(d3, params) {\r\n var scale = d3.scale.linear(), orient = \"bottom\", innerTickSize = 6, outerTickSize, tickPadding = 3, tickValues = null, tickFormat, tickArguments;\r\n\r\n var tickOffset = 0, tickCulling = true, tickCentered;\r\n\r\n params = params || {};\r\n outerTickSize = params.withOuterTick ? 6 : 0;\r\n\r\n function axisX(selection, x) {\r\n selection.attr(\"transform\", function (d) {\r\n return \"translate(\" + Math.ceil(x(d) + tickOffset) + \", 0)\";\r\n });\r\n }\r\n function axisY(selection, y) {\r\n selection.attr(\"transform\", function (d) {\r\n return \"translate(0,\" + Math.ceil(y(d)) + \")\";\r\n });\r\n }\r\n function scaleExtent(domain) {\r\n var start = domain[0], stop = domain[domain.length - 1];\r\n return start < stop ? [ start, stop ] : [ stop, start ];\r\n }\r\n function generateTicks(scale) {\r\n var i, domain, ticks = [];\r\n if (scale.ticks) {\r\n return scale.ticks.apply(scale, tickArguments);\r\n }\r\n domain = scale.domain();\r\n for (i = Math.ceil(domain[0]); i < domain[1]; i++) {\r\n ticks.push(i);\r\n }\r\n if (ticks.length > 0 && ticks[0] > 0) {\r\n ticks.unshift(ticks[0] - (ticks[1] - ticks[0]));\r\n }\r\n return ticks;\r\n }\r\n function copyScale() {\r\n var newScale = scale.copy(), domain;\r\n if (params.isCategory) {\r\n domain = scale.domain();\r\n newScale.domain([domain[0], domain[1] - 1]);\r\n }\r\n return newScale;\r\n }\r\n function textFormatted(v) {\r\n var formatted = tickFormat ? tickFormat(v) : v;\r\n return typeof formatted !== 'undefined' ? formatted : '';\r\n }\r\n function getSizeFor1Char(tick) {\r\n if (tickTextCharSize) {\r\n return tickTextCharSize;\r\n }\r\n var size = {\r\n h: 11.5,\r\n w: 5.5\r\n };\r\n tick.select('text').text(textFormatted).each(function (d) {\r\n var box = this.getBoundingClientRect(),\r\n text = textFormatted(d),\r\n h = box.height,\r\n w = text ? (box.width / text.length) : undefined;\r\n if (h && w) {\r\n size.h = h;\r\n size.w = w;\r\n }\r\n }).text('');\r\n tickTextCharSize = size;\r\n return size;\r\n }\r\n function transitionise(selection) {\r\n return params.withoutTransition ? selection : d3.transition(selection);\r\n }\r\n function axis(g) {\r\n g.each(function () {\r\n var g = axis.g = d3.select(this);\r\n\r\n var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = copyScale();\r\n\r\n var ticks = tickValues ? tickValues : generateTicks(scale1),\r\n tick = g.selectAll(\".tick\").data(ticks, scale1),\r\n tickEnter = tick.enter().insert(\"g\", \".domain\").attr(\"class\", \"tick\").style(\"opacity\", 1e-6),\r\n // MEMO: No exit transition. The reason is this transition affects max tick width calculation because old tick will be included in the ticks.\r\n tickExit = tick.exit().remove(),\r\n tickUpdate = transitionise(tick).style(\"opacity\", 1),\r\n tickTransform, tickX, tickY;\r\n\r\n var range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()),\r\n path = g.selectAll(\".domain\").data([ 0 ]),\r\n pathUpdate = (path.enter().append(\"path\").attr(\"class\", \"domain\"), transitionise(path));\r\n tickEnter.append(\"line\");\r\n tickEnter.append(\"text\");\r\n\r\n var lineEnter = tickEnter.select(\"line\"),\r\n lineUpdate = tickUpdate.select(\"line\"),\r\n textEnter = tickEnter.select(\"text\"),\r\n textUpdate = tickUpdate.select(\"text\");\r\n\r\n if (params.isCategory) {\r\n tickOffset = Math.ceil((scale1(1) - scale1(0)) / 2);\r\n tickX = tickCentered ? 0 : tickOffset;\r\n tickY = tickCentered ? tickOffset : 0;\r\n } else {\r\n tickOffset = tickX = 0;\r\n }\r\n\r\n var text, tspan, sizeFor1Char = getSizeFor1Char(g.select('.tick')), counts = [];\r\n var tickLength = Math.max(innerTickSize, 0) + tickPadding,\r\n isVertical = orient === 'left' || orient === 'right';\r\n\r\n // this should be called only when category axis\r\n function splitTickText(d, maxWidth) {\r\n var tickText = textFormatted(d),\r\n subtext, spaceIndex, textWidth, splitted = [];\r\n\r\n if (Object.prototype.toString.call(tickText) === \"[object Array]\") {\r\n return tickText;\r\n }\r\n\r\n if (!maxWidth || maxWidth <= 0) {\r\n maxWidth = isVertical ? 95 : params.isCategory ? (Math.ceil(scale1(ticks[1]) - scale1(ticks[0])) - 12) : 110;\r\n }\r\n\r\n function split(splitted, text) {\r\n spaceIndex = undefined;\r\n for (var i = 1; i < text.length; i++) {\r\n if (text.charAt(i) === ' ') {\r\n spaceIndex = i;\r\n }\r\n subtext = text.substr(0, i + 1);\r\n textWidth = sizeFor1Char.w * subtext.length;\r\n // if text width gets over tick width, split by space index or crrent index\r\n if (maxWidth < textWidth) {\r\n return split(\r\n splitted.concat(text.substr(0, spaceIndex ? spaceIndex : i)),\r\n text.slice(spaceIndex ? spaceIndex + 1 : i)\r\n );\r\n }\r\n }\r\n return splitted.concat(text);\r\n }\r\n\r\n return split(splitted, tickText + \"\");\r\n }\r\n\r\n function tspanDy(d, i) {\r\n var dy = sizeFor1Char.h;\r\n if (i === 0) {\r\n if (orient === 'left' || orient === 'right') {\r\n dy = -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3);\r\n } else {\r\n dy = \".71em\";\r\n }\r\n }\r\n return dy;\r\n }\r\n\r\n function tickSize(d) {\r\n var tickPosition = scale(d) + (tickCentered ? 0 : tickOffset);\r\n return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0;\r\n }\r\n\r\n text = tick.select(\"text\");\r\n tspan = text.selectAll('tspan')\r\n .data(function (d, i) {\r\n var splitted = params.tickMultiline ? splitTickText(d, params.tickWidth) : [].concat(textFormatted(d));\r\n counts[i] = splitted.length;\r\n return splitted.map(function (s) {\r\n return { index: i, splitted: s };\r\n });\r\n });\r\n tspan.enter().append('tspan');\r\n tspan.exit().remove();\r\n tspan.text(function (d) { return d.splitted; });\r\n\r\n var rotate = params.tickTextRotate;\r\n\r\n function textAnchorForText(rotate) {\r\n if (!rotate) {\r\n return 'middle';\r\n }\r\n return rotate > 0 ? \"start\" : \"end\";\r\n }\r\n function textTransform(rotate) {\r\n if (!rotate) {\r\n return '';\r\n }\r\n return \"rotate(\" + rotate + \")\";\r\n }\r\n function dxForText(rotate) {\r\n if (!rotate) {\r\n return 0;\r\n }\r\n return 8 * Math.sin(Math.PI * (rotate / 180));\r\n }\r\n function yForText(rotate) {\r\n if (!rotate) {\r\n return tickLength;\r\n }\r\n return 11.5 - 2.5 * (rotate / 15) * (rotate > 0 ? 1 : -1);\r\n }\r\n\r\n switch (orient) {\r\n case \"bottom\":\r\n {\r\n tickTransform = axisX;\r\n lineEnter.attr(\"y2\", innerTickSize);\r\n textEnter.attr(\"y\", tickLength);\r\n lineUpdate.attr(\"x1\", tickX).attr(\"x2\", tickX).attr(\"y2\", tickSize);\r\n textUpdate.attr(\"x\", 0).attr(\"y\", yForText(rotate))\r\n .style(\"text-anchor\", textAnchorForText(rotate))\r\n .attr(\"transform\", textTransform(rotate));\r\n tspan.attr('x', 0).attr(\"dy\", tspanDy).attr('dx', dxForText(rotate));\r\n pathUpdate.attr(\"d\", \"M\" + range[0] + \",\" + outerTickSize + \"V0H\" + range[1] + \"V\" + outerTickSize);\r\n break;\r\n }\r\n case \"top\":\r\n {\r\n // TODO: rotated tick text\r\n tickTransform = axisX;\r\n lineEnter.attr(\"y2\", -innerTickSize);\r\n textEnter.attr(\"y\", -tickLength);\r\n lineUpdate.attr(\"x2\", 0).attr(\"y2\", -innerTickSize);\r\n textUpdate.attr(\"x\", 0).attr(\"y\", -tickLength);\r\n text.style(\"text-anchor\", \"middle\");\r\n tspan.attr('x', 0).attr(\"dy\", \"0em\");\r\n pathUpdate.attr(\"d\", \"M\" + range[0] + \",\" + -outerTickSize + \"V0H\" + range[1] + \"V\" + -outerTickSize);\r\n break;\r\n }\r\n case \"left\":\r\n {\r\n tickTransform = axisY;\r\n lineEnter.attr(\"x2\", -innerTickSize);\r\n textEnter.attr(\"x\", -tickLength);\r\n lineUpdate.attr(\"x2\", -innerTickSize).attr(\"y1\", tickY).attr(\"y2\", tickY);\r\n textUpdate.attr(\"x\", -tickLength).attr(\"y\", tickOffset);\r\n text.style(\"text-anchor\", \"end\");\r\n tspan.attr('x', -tickLength).attr(\"dy\", tspanDy);\r\n pathUpdate.attr(\"d\", \"M\" + -outerTickSize + \",\" + range[0] + \"H0V\" + range[1] + \"H\" + -outerTickSize);\r\n break;\r\n }\r\n case \"right\":\r\n {\r\n tickTransform = axisY;\r\n lineEnter.attr(\"x2\", innerTickSize);\r\n textEnter.attr(\"x\", tickLength);\r\n lineUpdate.attr(\"x2\", innerTickSize).attr(\"y2\", 0);\r\n textUpdate.attr(\"x\", tickLength).attr(\"y\", 0);\r\n text.style(\"text-anchor\", \"start\");\r\n tspan.attr('x', tickLength).attr(\"dy\", tspanDy);\r\n pathUpdate.attr(\"d\", \"M\" + outerTickSize + \",\" + range[0] + \"H0V\" + range[1] + \"H\" + outerTickSize);\r\n break;\r\n }\r\n }\r\n if (scale1.rangeBand) {\r\n var x = scale1, dx = x.rangeBand() / 2;\r\n scale0 = scale1 = function (d) {\r\n return x(d) + dx;\r\n };\r\n } else if (scale0.rangeBand) {\r\n scale0 = scale1;\r\n } else {\r\n tickExit.call(tickTransform, scale1);\r\n }\r\n tickEnter.call(tickTransform, scale0);\r\n tickUpdate.call(tickTransform, scale1);\r\n });\r\n }\r\n axis.scale = function (x) {\r\n if (!arguments.length) { return scale; }\r\n scale = x;\r\n return axis;\r\n };\r\n axis.orient = function (x) {\r\n if (!arguments.length) { return orient; }\r\n orient = x in {top: 1, right: 1, bottom: 1, left: 1} ? x + \"\" : \"bottom\";\r\n return axis;\r\n };\r\n axis.tickFormat = function (format) {\r\n if (!arguments.length) { return tickFormat; }\r\n tickFormat = format;\r\n return axis;\r\n };\r\n axis.tickCentered = function (isCentered) {\r\n if (!arguments.length) { return tickCentered; }\r\n tickCentered = isCentered;\r\n return axis;\r\n };\r\n axis.tickOffset = function () {\r\n return tickOffset;\r\n };\r\n axis.tickInterval = function () {\r\n var interval, length;\r\n if (params.isCategory) {\r\n interval = tickOffset * 2;\r\n }\r\n else {\r\n length = axis.g.select('path.domain').node().getTotalLength() - outerTickSize * 2;\r\n interval = length / axis.g.selectAll('line').size();\r\n }\r\n return interval === Infinity ? 0 : interval;\r\n };\r\n axis.ticks = function () {\r\n if (!arguments.length) { return tickArguments; }\r\n tickArguments = arguments;\r\n return axis;\r\n };\r\n axis.tickCulling = function (culling) {\r\n if (!arguments.length) { return tickCulling; }\r\n tickCulling = culling;\r\n return axis;\r\n };\r\n axis.tickValues = function (x) {\r\n if (typeof x === 'function') {\r\n tickValues = function () {\r\n return x(scale.domain());\r\n };\r\n }\r\n else {\r\n if (!arguments.length) { return tickValues; }\r\n tickValues = x;\r\n }\r\n return axis;\r\n };\r\n return axis;\r\n }\r\n\r\n c3_chart_internal_fn.isSafari = function () {\r\n var ua = window.navigator.userAgent;\r\n return ua.indexOf('Safari') >= 0 && ua.indexOf('Chrome') < 0;\r\n };\r\n c3_chart_internal_fn.isChrome = function () {\r\n var ua = window.navigator.userAgent;\r\n return ua.indexOf('Chrome') >= 0;\r\n };\r\n\r\n // PhantomJS doesn't have support for Function.prototype.bind, which has caused confusion. Use\r\n // this polyfill to avoid the confusion.\r\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Polyfill\r\n\r\n if (!Function.prototype.bind) {\r\n Function.prototype.bind = function(oThis) {\r\n if (typeof this !== 'function') {\r\n // closest thing possible to the ECMAScript 5\r\n // internal IsCallable function\r\n throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');\r\n }\r\n\r\n var aArgs = Array.prototype.slice.call(arguments, 1),\r\n fToBind = this,\r\n fNOP = function() {},\r\n fBound = function() {\r\n return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));\r\n };\r\n\r\n fNOP.prototype = this.prototype;\r\n fBound.prototype = new fNOP();\r\n\r\n return fBound;\r\n };\r\n }\r\n\r\n if (true) {\r\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! d3 */ \"./src/public/js/vendor/d3/d3.min.js\")], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return c3; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\r\n } else {}\r\n\r\n})(window);\n\n//# sourceURL=webpack:///./src/public/js/vendor/c3/c3.js?");
+
+/***/ }),
+
+/***/ "./src/public/js/vendor/d3/d3.min.js":
+/*!*******************************************!*\
+ !*** ./src/public/js/vendor/d3/d3.min.js ***!
+ \*******************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;!function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:NaN}function r(n){return null===n?NaN:+n}function u(n){return!isNaN(n)}function i(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function a(n){return n.length}function o(n){for(var t=1;n*t%1;)t*=10;return t}function l(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function c(){this._=Object.create(null)}function s(n){return(n+=\"\")===xa||n[0]===ba?ba+n:n}function f(n){return(n+=\"\")[0]===ba?n.slice(1):n}function h(n){return s(n)in this._}function g(n){return(n=s(n))in this._&&delete this._[n]}function p(){var n=[];for(var t in this._)n.push(f(t));return n}function v(){var n=0;for(var t in this._)++n;return n}function d(){for(var n in this._)return!1;return!0}function m(){this._=Object.create(null)}function y(n){return n}function M(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function x(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=_a.length;r>e;++e){var u=_a[e]+t;if(u in n)return u}}function b(){}function _(){}function w(n){function t(){for(var t,r=e,u=-1,i=r.length;++ue;e++)for(var u,i=n[e],a=0,o=i.length;o>a;a++)(u=i[a])&&t(u,a,e);return n}function Z(n){return Sa(n,za),n}function V(n){var t,e;return function(r,u,i){var a,o=n[i].update,l=o.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(a=o[t])&&++t0&&(n=n.slice(0,o));var c=La.get(n);return c&&(n=c,l=B),o?t?u:r:t?b:i}function $(n,t){return function(e){var r=oa.event;oa.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{oa.event=r}}}function B(n,t){var e=$(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function W(e){var r=\".dragsuppress-\"+ ++Ta,u=\"click\"+r,i=oa.select(t(e)).on(\"touchmove\"+r,S).on(\"dragstart\"+r,S).on(\"selectstart\"+r,S);if(null==qa&&(qa=\"onselectstart\"in e?!1:x(e.style,\"userSelect\")),qa){var a=n(e).style,o=a[qa];a[qa]=\"none\"}return function(n){if(i.on(r,null),qa&&(a[qa]=o),n){var t=function(){i.on(u,null)};i.on(u,function(){S(),t()},!0),setTimeout(t,0)}}}function J(n,e){e.changedTouches&&(e=e.changedTouches[0]);var r=n.ownerSVGElement||n;if(r.createSVGPoint){var u=r.createSVGPoint();if(0>Ra){var i=t(n);if(i.scrollX||i.scrollY){r=oa.select(\"body\").append(\"svg\").style({position:\"absolute\",top:0,left:0,margin:0,padding:0,border:\"none\"},\"important\");var a=r[0][0].getScreenCTM();Ra=!(a.f||a.e),r.remove()}}return Ra?(u.x=e.pageX,u.y=e.pageY):(u.x=e.clientX,u.y=e.clientY),u=u.matrixTransform(n.getScreenCTM().inverse()),[u.x,u.y]}var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}function G(){return oa.event.changedTouches[0].identifier}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nn(n){return n>1?0:-1>n?ja:Math.acos(n)}function tn(n){return n>1?Ha:-1>n?-Ha:Math.asin(n)}function en(n){return((n=Math.exp(n))-1/n)/2}function rn(n){return((n=Math.exp(n))+1/n)/2}function un(n){return((n=Math.exp(2*n))-1)/(n+1)}function an(n){return(n=Math.sin(n/2))*n}function on(){}function ln(n,t,e){return this instanceof ln?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof ln?new ln(n.h,n.s,n.l):_n(\"\"+n,wn,ln):new ln(n,t,e)}function cn(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(a-i)*n/60:180>n?a:240>n?i+(a-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,a;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,a=.5>=e?e*(1+t):e+t-e*t,i=2*e-a,new yn(u(n+120),u(n),u(n-120))}function sn(n,t,e){return this instanceof sn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof sn?new sn(n.h,n.c,n.l):n instanceof hn?pn(n.l,n.a,n.b):pn((n=Sn((n=oa.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new sn(n,t,e)}function fn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new hn(e,Math.cos(n*=Oa)*t,Math.sin(n)*t)}function hn(n,t,e){return this instanceof hn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof hn?new hn(n.l,n.a,n.b):n instanceof sn?fn(n.h,n.c,n.l):Sn((n=yn(n)).r,n.g,n.b):new hn(n,t,e)}function gn(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=vn(u)*Ka,r=vn(r)*Qa,i=vn(i)*no,new yn(mn(3.2404542*u-1.5371385*r-.4985314*i),mn(-.969266*u+1.8760108*r+.041556*i),mn(.0556434*u-.2040259*r+1.0572252*i))}function pn(n,t,e){return n>0?new sn(Math.atan2(e,t)*Ia,Math.sqrt(t*t+e*e),n):new sn(NaN,NaN,n)}function vn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function dn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function mn(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function yn(n,t,e){return this instanceof yn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof yn?new yn(n.r,n.g,n.b):_n(\"\"+n,yn,cn):new yn(n,t,e)}function Mn(n){return new yn(n>>16,n>>8&255,255&n)}function xn(n){return Mn(n)+\"\"}function bn(n){return 16>n?\"0\"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function _n(n,t,e){var r,u,i,a=0,o=0,l=0;if(r=/([a-z]+)\\((.*)\\)/.exec(n=n.toLowerCase()))switch(u=r[2].split(\",\"),r[1]){case\"hsl\":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case\"rgb\":return t(Nn(u[0]),Nn(u[1]),Nn(u[2]))}return(i=ro.get(n))?t(i.r,i.g,i.b):(null==n||\"#\"!==n.charAt(0)||isNaN(i=parseInt(n.slice(1),16))||(4===n.length?(a=(3840&i)>>4,a=a>>4|a,o=240&i,o=o>>4|o,l=15&i,l=l<<4|l):7===n.length&&(a=(16711680&i)>>16,o=(65280&i)>>8,l=255&i)),t(a,o,l))}function wn(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),a=Math.max(n,t,e),o=a-i,l=(a+i)/2;return o?(u=.5>l?o/(a+i):o/(2-a-i),r=n==a?(t-e)/o+(e>t?6:0):t==a?(e-n)/o+2:(n-t)/o+4,r*=60):(r=NaN,u=l>0&&1>l?0:r),new ln(r,u,l)}function Sn(n,t,e){n=kn(n),t=kn(t),e=kn(e);var r=dn((.4124564*n+.3575761*t+.1804375*e)/Ka),u=dn((.2126729*n+.7151522*t+.072175*e)/Qa),i=dn((.0193339*n+.119192*t+.9503041*e)/no);return hn(116*u-16,500*(r-u),200*(u-i))}function kn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Nn(n){var t=parseFloat(n);return\"%\"===n.charAt(n.length-1)?Math.round(2.55*t):t}function En(n){return\"function\"==typeof n?n:function(){return n}}function An(n){return function(t,e,r){return 2===arguments.length&&\"function\"==typeof e&&(r=e,e=null),Cn(t,e,n,r)}}function Cn(n,t,e,r){function u(){var n,t=l.status;if(!t&&Ln(l)||t>=200&&300>t||304===t){try{n=e.call(i,l)}catch(r){return void a.error.call(i,r)}a.load.call(i,n)}else a.error.call(i,l)}var i={},a=oa.dispatch(\"beforesend\",\"progress\",\"load\",\"error\"),o={},l=new XMLHttpRequest,c=null;return!this.XDomainRequest||\"withCredentials\"in l||!/^(http(s)?:)?\\/\\//.test(n)||(l=new XDomainRequest),\"onload\"in l?l.onload=l.onerror=u:l.onreadystatechange=function(){l.readyState>3&&u()},l.onprogress=function(n){var t=oa.event;oa.event=n;try{a.progress.call(i,l)}finally{oa.event=t}},i.header=function(n,t){return n=(n+\"\").toLowerCase(),arguments.length<2?o[n]:(null==t?delete o[n]:o[n]=t+\"\",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+\"\",i):t},i.responseType=function(n){return arguments.length?(c=n,i):c},i.response=function(n){return e=n,i},[\"get\",\"post\"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ca(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&\"function\"==typeof r&&(u=r,r=null),l.open(e,n,!0),null==t||\"accept\"in o||(o.accept=t+\",*/*\"),l.setRequestHeader)for(var s in o)l.setRequestHeader(s,o[s]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=c&&(l.responseType=c),null!=u&&i.on(\"error\",u).on(\"load\",function(n){u(null,n)}),a.beforesend.call(i,l),l.send(null==r?null:r),i},i.abort=function(){return l.abort(),i},oa.rebind(i,a,\"on\"),null==r?i:i.get(zn(r))}function zn(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function Ln(n){var t=n.responseType;return t&&\"text\"!==t?n.response:n.responseText}function qn(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,n:null};return io?io.n=i:uo=i,io=i,ao||(oo=clearTimeout(oo),ao=1,lo(Tn)),i}function Tn(){var n=Rn(),t=Dn()-n;t>24?(isFinite(t)&&(clearTimeout(oo),oo=setTimeout(Tn,t)),ao=0):(ao=1,lo(Tn))}function Rn(){for(var n=Date.now(),t=uo;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Dn(){for(var n,t=uo,e=1/0;t;)t.c?(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Un(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r&&e?function(n,t){for(var u=n.length,i=[],a=0,o=r[0],l=0;u>0&&o>0&&(l+o+1>t&&(o=Math.max(1,t-l)),i.push(n.substring(u-=o,u+o)),!((l+=o+1)>t));)o=r[a=(a+1)%r.length];return i.reverse().join(e)}:y;return function(n){var e=so.exec(n),r=e[1]||\" \",a=e[2]||\">\",o=e[3]||\"-\",l=e[4]||\"\",c=e[5],s=+e[6],f=e[7],h=e[8],g=e[9],p=1,v=\"\",d=\"\",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(c||\"0\"===r&&\"=\"===a)&&(c=r=\"0\",a=\"=\"),g){case\"n\":f=!0,g=\"g\";break;case\"%\":p=100,d=\"%\",g=\"f\";break;case\"p\":p=100,d=\"%\",g=\"r\";break;case\"b\":case\"o\":case\"x\":case\"X\":\"#\"===l&&(v=\"0\"+g.toLowerCase());case\"c\":y=!1;case\"d\":m=!0,h=0;break;case\"s\":p=-1,g=\"r\"}\"$\"===l&&(v=u[0],d=u[1]),\"r\"!=g||h||(g=\"g\"),null!=h&&(\"g\"==g?h=Math.max(1,Math.min(21,h)):(\"e\"==g||\"f\"==g)&&(h=Math.max(0,Math.min(20,h)))),g=fo.get(g)||Fn;var M=c&&f;return function(n){var e=d;if(m&&n%1)return\"\";var u=0>n||0===n&&0>1/n?(n=-n,\"-\"):\"-\"===o?\"\":o;if(0>p){var l=oa.formatPrefix(n,h);n=l.scale(n),e=l.symbol+d}else n*=p;n=g(n,h);var x,b,_=n.lastIndexOf(\".\");if(0>_){var w=y?n.lastIndexOf(\"e\"):-1;0>w?(x=n,b=\"\"):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!c&&f&&(x=i(x,1/0));var S=v.length+x.length+b.length+(M?0:u.length),k=s>S?new Array(S=s-S+1).join(r):\"\";return M&&(x=i(k+x,k.length?s-b.length:1/0)),u+=v,n=x+b,(\"<\"===a?u+n+k:\">\"===a?k+u+n:\"^\"===a?k.substring(0,S>>=1)+u+n+k.substring(S):u+(M?n:k+n))+e}}}function Fn(n){return n+\"\"}function Hn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function On(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new go(e-1)),1),e}function i(n,e){return t(n=new go(+n),e),n}function a(n,r,i){var a=u(n),o=[];if(i>1)for(;r>a;)e(a)%i||o.push(new Date(+a)),t(a,1);else for(;r>a;)o.push(new Date(+a)),t(a,1);return o}function o(n,t,e){try{go=Hn;var r=new Hn;return r._=n,a(r,t,e)}finally{go=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=a;var l=n.utc=In(n);return l.floor=l,l.round=In(r),l.ceil=In(u),l.offset=In(i),l.range=o,n}function In(n){return function(t,e){try{go=Hn;var r=new Hn;return r._=t,n(r,e)._}finally{go=Date}}}function Yn(n){function t(n){function t(t){for(var e,u,i,a=[],o=-1,l=0;++oo;){if(r>=c)return-1;if(u=t.charCodeAt(o++),37===u){if(a=t.charAt(o++),i=C[a in vo?t.charAt(o++):a],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){N.lastIndex=0;var r=N.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,r){return e(n,A.c.toString(),t,r)}function l(n,t,r){return e(n,A.x.toString(),t,r)}function c(n,t,r){return e(n,A.X.toString(),t,r)}function s(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{go=Hn;var t=new go;return t._=n,r(t)}finally{go=Date}}var r=t(n);return e.parse=function(n){try{go=Hn;var t=r.parse(n);return t&&t._}finally{go=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ct;var M=oa.map(),x=Vn(v),b=Xn(v),_=Vn(d),w=Xn(d),S=Vn(m),k=Xn(m),N=Vn(y),E=Xn(y);p.forEach(function(n,t){M.set(n.toLowerCase(),t)});var A={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return Zn(n.getDate(),t,2)},e:function(n,t){return Zn(n.getDate(),t,2)},H:function(n,t){return Zn(n.getHours(),t,2)},I:function(n,t){return Zn(n.getHours()%12||12,t,2)},j:function(n,t){return Zn(1+ho.dayOfYear(n),t,3)},L:function(n,t){return Zn(n.getMilliseconds(),t,3)},m:function(n,t){return Zn(n.getMonth()+1,t,2)},M:function(n,t){return Zn(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return Zn(n.getSeconds(),t,2)},U:function(n,t){return Zn(ho.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Zn(ho.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return Zn(n.getFullYear()%100,t,2)},Y:function(n,t){return Zn(n.getFullYear()%1e4,t,4)},Z:ot,\"%\":function(){return\"%\"}},C={a:r,A:u,b:i,B:a,c:o,d:tt,e:tt,H:rt,I:rt,j:et,L:at,m:nt,M:ut,p:s,S:it,U:Bn,w:$n,W:Wn,x:l,X:c,y:Gn,Y:Jn,Z:Kn,\"%\":lt};return t}function Zn(n,t,e){var r=0>n?\"-\":\"\",u=(r?-n:n)+\"\",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function Vn(n){return new RegExp(\"^(?:\"+n.map(oa.requote).join(\"|\")+\")\",\"i\")}function Xn(n){for(var t=new c,e=-1,r=n.length;++e68?1900:2e3)}function nt(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function tt(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function et(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function rt(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ut(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function it(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function at(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function ot(n){var t=n.getTimezoneOffset(),e=t>0?\"-\":\"+\",r=Ma(t)/60|0,u=Ma(t)%60;return e+Zn(r,\"0\",2)+Zn(u,\"0\",2)}function lt(n,t,e){yo.lastIndex=0;var r=yo.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ct(n){for(var t=n.length,e=-1;++e=0?1:-1,o=a*e,l=Math.cos(t),c=Math.sin(t),s=i*c,f=u*l+s*Math.cos(o),h=s*a*Math.sin(o);So.add(Math.atan2(h,f)),r=n,u=l,i=c}var t,e,r,u,i;ko.point=function(a,o){ko.point=n,r=(t=a)*Oa,u=Math.cos(o=(e=o)*Oa/2+ja/4),i=Math.sin(o)},ko.lineEnd=function(){n(t,e)}}function dt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function mt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function yt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Mt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function xt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function bt(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function _t(n){return[Math.atan2(n[1],n[0]),tn(n[2])]}function wt(n,t){return Ma(n[0]-t[0])o;++o)u.point((e=n[o])[0],e[1]);return void u.lineEnd()}var l=new Tt(e,n,null,!0),c=new Tt(e,null,l,!1);l.o=c,i.push(l),a.push(c),l=new Tt(r,n,null,!1),c=new Tt(r,null,l,!0),l.o=c,i.push(l),a.push(c)}}),a.sort(t),qt(i),qt(a),i.length){for(var o=0,l=e,c=a.length;c>o;++o)a[o].e=l=!l;for(var s,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;s=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var o=0,c=s.length;c>o;++o)u.point((f=s[o])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){s=g.p.z;for(var o=s.length-1;o>=0;--o)u.point((f=s[o])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,s=g.z,p=!p}while(!g.v);u.lineEnd()}}}function qt(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r0){for(b||(i.polygonStart(),b=!0),i.lineStart();++a1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Dt))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:a,lineStart:l,lineEnd:c,polygonStart:function(){y.point=s,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=a,y.lineStart=l,y.lineEnd=c,g=oa.merge(g);var n=Ot(m,p);g.length?(b||(i.polygonStart(),b=!0),Lt(g,jt,n,e,i)):n&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},M=Pt(),x=t(M),b=!1;return y}}function Dt(n){return n.length>1}function Pt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:b,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function jt(n,t){return((n=n.x)[0]<0?n[1]-Ha-Da:Ha-n[1])-((t=t.x)[0]<0?t[1]-Ha-Da:Ha-t[1])}function Ut(n){var t,e=NaN,r=NaN,u=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(i,a){var o=i>0?ja:-ja,l=Ma(i-e);Ma(l-ja)0?Ha:-Ha),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(o,r),n.point(i,r),t=0):u!==o&&l>=ja&&(Ma(e-u)Da?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*a)):(t+r)/2}function Ht(n,t,e,r){var u;if(null==n)u=e*Ha,r.point(-ja,u),r.point(0,u),r.point(ja,u),r.point(ja,0),r.point(ja,-u),r.point(0,-u),r.point(-ja,-u),r.point(-ja,0),r.point(-ja,u);else if(Ma(n[0]-t[0])>Da){var i=n[0]o;++o){var c=t[o],s=c.length;if(s)for(var f=c[0],h=f[0],g=f[1]/2+ja/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===s&&(d=0),n=c[d];var m=n[0],y=n[1]/2+ja/4,M=Math.sin(y),x=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>ja,k=p*M;if(So.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),i+=S?b+_*Ua:b,S^h>=e^m>=e){var N=yt(dt(f),dt(n));bt(N);var E=yt(u,N);bt(E);var A=(S^b>=0?-1:1)*tn(E[2]);(r>A||r===A&&(N[0]||N[1]))&&(a+=S^b>=0?1:-1)}if(!d++)break;h=m,p=M,v=x,f=n}}return(-Da>i||Da>i&&0>So)^1&a}function It(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,l,c,s;return{lineStart:function(){c=l=!1,s=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=a?v?0:u(f,h):v?u(f+(0>f?ja:-ja),h):0;if(!e&&(c=l=v)&&n.lineStart(),v!==l&&(g=r(e,p),(wt(e,g)||wt(p,g))&&(p[0]+=Da,p[1]+=Da,v=t(p[0],p[1]))),v!==l)s=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(o&&e&&a^v){var m;d&i||!(m=r(p,e,!0))||(s=0,a?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&wt(e,p)||n.point(p[0],p[1]),e=p,l=v,i=d},lineEnd:function(){l&&n.lineEnd(),e=null},clean:function(){return s|(c&&l)<<1}}}function r(n,t,e){var r=dt(n),u=dt(t),a=[1,0,0],o=yt(r,u),l=mt(o,o),c=o[0],s=l-c*c;if(!s)return!e&&n;var f=i*l/s,h=-i*c/s,g=yt(a,o),p=xt(a,f),v=xt(o,h);Mt(p,v);var d=g,m=mt(p,d),y=mt(d,d),M=m*m-y*(mt(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=xt(d,(-m-x)/y);if(Mt(b,p),b=_t(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],N=t[1];w>S&&(_=w,w=S,S=_);var E=S-w,A=Ma(E-ja)E;if(!A&&k>N&&(_=k,k=N,N=_),C?A?k+N>0^b[1]<(Ma(b[0]-w)ja^(w<=b[0]&&b[0]<=S)){var z=xt(d,(-m+x)/y);return Mt(z,p),[b,_t(z)]}}}function u(t,e){var r=a?n:ja-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),a=i>0,o=Ma(i)>Da,l=ve(n,6*Oa);return Rt(t,e,l,a?[0,-n]:[-ja,n-ja])}function Yt(n,t,e,r){return function(u){var i,a=u.a,o=u.b,l=a.x,c=a.y,s=o.x,f=o.y,h=0,g=1,p=s-l,v=f-c;if(i=n-l,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-l,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-c,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-c,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:l+h*p,y:c+h*v}),1>g&&(u.b={x:l+g*p,y:c+g*v}),u}}}}}}function Zt(n,t,e,r){function u(r,u){return Ma(r[0]-n)0?0:3:Ma(r[0]-e)0?2:1:Ma(r[1]-t)0?1:0:u>0?3:2}function i(n,t){return a(n.x,t.x)}function a(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(o){function l(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,a=1,o=d[u],l=o.length,c=o[0];l>a;++a)i=o[a],c[1]<=r?i[1]>r&&Q(c,i,n)>0&&++t:i[1]<=r&&Q(c,i,n)<0&&--t,c=i;return 0!==t}function c(i,o,l,c){var s=0,f=0;if(null==i||(s=u(i,l))!==(f=u(o,l))||a(i,o)<0^l>0){do c.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+l+4)%4)!==f)}else c.point(o[0],o[1])}function s(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){s(n,t)&&o.point(n,t)}function h(){C.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=NaN}function g(){v&&(p(y,M),x&&w&&E.rejoin(),v.push(E.buffer())),C.point=f,w&&o.lineEnd()}function p(n,t){n=Math.max(-Fo,Math.min(Fo,n)),t=Math.max(-Fo,Math.min(Fo,t));var e=s(n,t);if(d&&m.push([n,t]),S)y=n,M=t,x=e,S=!1,e&&(o.lineStart(),o.point(n,t));else if(e&&w)o.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};A(r)?(w||(o.lineStart(),o.point(r.a.x,r.a.y)),o.point(r.b.x,r.b.y),e||o.lineEnd(),k=!1):e&&(o.lineStart(),o.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,M,x,b,_,w,S,k,N=o,E=Pt(),A=Yt(n,t,e,r),C={point:f,lineStart:h,lineEnd:g,polygonStart:function(){o=E,v=[],d=[],k=!0},polygonEnd:function(){o=N,v=oa.merge(v);var t=l([n,r]),e=k&&t,u=v.length;(e||u)&&(o.polygonStart(),e&&(o.lineStart(),c(null,null,1,o),o.lineEnd()),u&&Lt(v,i,t,c,o),o.polygonEnd()),v=d=m=null}};return C}}function Vt(n){var t=0,e=ja/3,r=oe(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*ja/180,e=n[1]*ja/180):[t/ja*180,e/ja*180]},u}function Xt(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),a-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),a=Math.sqrt(i)/u;return e.invert=function(n,t){var e=a-t;return[Math.atan2(n,e)/u,tn((i-(n*n+e*e)*u*u)/(2*u))]},e}function $t(){function n(n,t){Oo+=u*n-r*t,r=n,u=t}var t,e,r,u;Xo.point=function(i,a){Xo.point=n,t=r=i,e=u=a},Xo.lineEnd=function(){n(t,e)}}function Bt(n,t){Io>n&&(Io=n),n>Zo&&(Zo=n),Yo>t&&(Yo=t),t>Vo&&(Vo=t)}function Wt(){function n(n,t){a.push(\"M\",n,\",\",t,i)}function t(n,t){a.push(\"M\",n,\",\",t),o.point=e}function e(n,t){a.push(\"L\",n,\",\",t)}function r(){o.point=n}function u(){a.push(\"Z\")}var i=Jt(4.5),a=[],o={point:n,lineStart:function(){o.point=t},lineEnd:r,polygonStart:function(){o.lineEnd=u},polygonEnd:function(){o.lineEnd=r,o.point=n},pointRadius:function(n){return i=Jt(n),o},result:function(){if(a.length){var n=a.join(\"\");return a=[],n}}};return o}function Jt(n){return\"m0,\"+n+\"a\"+n+\",\"+n+\" 0 1,1 0,\"+-2*n+\"a\"+n+\",\"+n+\" 0 1,1 0,\"+2*n+\"z\"}function Gt(n,t){Ao+=n,Co+=t,++zo}function Kt(){function n(n,r){var u=n-t,i=r-e,a=Math.sqrt(u*u+i*i);Lo+=a*(t+n)/2,qo+=a*(e+r)/2,To+=a,Gt(t=n,e=r)}var t,e;Bo.point=function(r,u){Bo.point=n,Gt(t=r,e=u)}}function Qt(){Bo.point=Gt}function ne(){function n(n,t){var e=n-r,i=t-u,a=Math.sqrt(e*e+i*i);Lo+=a*(r+n)/2,qo+=a*(u+t)/2,To+=a,a=u*n-r*t,Ro+=a*(r+n),Do+=a*(u+t),Po+=3*a,Gt(r=n,u=t)}var t,e,r,u;Bo.point=function(i,a){Bo.point=n,Gt(t=r=i,e=u=a)},Bo.lineEnd=function(){n(t,e)}}function te(n){function t(t,e){n.moveTo(t+a,e),n.arc(t,e,a,0,Ua)}function e(t,e){n.moveTo(t,e),o.point=r}function r(t,e){n.lineTo(t,e)}function u(){o.point=t}function i(){n.closePath()}var a=4.5,o={point:t,lineStart:function(){o.point=e},lineEnd:u,polygonStart:function(){o.lineEnd=i},polygonEnd:function(){o.lineEnd=u,o.point=t},pointRadius:function(n){return a=n,o},result:b};return o}function ee(n){function t(n){return(o?r:e)(n)}function e(t){return ie(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=NaN,S.point=i,t.lineStart()}function i(e,r){var i=dt([e,r]),a=n(e,r);u(M,x,y,b,_,w,M=a[0],x=a[1],y=e,b=i[0],_=i[1],w=i[2],o,t),t.point(M,x)}function a(){S.point=e,t.lineEnd()}function l(){r(),S.point=c,S.lineEnd=s}function c(n,t){\r\ni(f=n,h=t),g=M,p=x,v=b,d=_,m=w,S.point=i}function s(){u(M,x,y,b,_,w,g,p,f,v,d,m,o,t),S.lineEnd=a,a()}var f,h,g,p,v,d,m,y,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:a,polygonStart:function(){t.polygonStart(),S.lineStart=l},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,o,l,c,s,f,h,g,p,v,d,m){var y=s-t,M=f-e,x=y*y+M*M;if(x>4*i&&d--){var b=o+g,_=l+p,w=c+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),N=Ma(Ma(w)-1)i||Ma((y*z+M*L)/x-.5)>.3||a>o*g+l*p+c*v)&&(u(t,e,r,o,l,c,A,C,N,b/=S,_/=S,w,d,m),m.point(A,C),u(A,C,N,b,_,w,s,f,h,g,p,v,d,m))}}var i=.5,a=Math.cos(30*Oa),o=16;return t.precision=function(n){return arguments.length?(o=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function re(n){var t=ee(function(t,e){return n([t*Ia,e*Ia])});return function(n){return le(t(n))}}function ue(n){this.stream=n}function ie(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ae(n){return oe(function(){return n})()}function oe(n){function t(n){return n=o(n[0]*Oa,n[1]*Oa),[n[0]*h+l,c-n[1]*h]}function e(n){return n=o.invert((n[0]-l)/h,(c-n[1])/h),n&&[n[0]*Ia,n[1]*Ia]}function r(){o=Ct(a=fe(m,M,x),i);var n=i(v,d);return l=g-n[0]*h,c=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,a,o,l,c,s,f=ee(function(n,t){return n=i(n,t),[n[0]*h+l,c-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,M=0,x=0,b=Uo,_=y,w=null,S=null;return t.stream=function(n){return s&&(s.valid=!1),s=le(b(a,f(_(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(b=null==n?(w=n,Uo):It((w=+n)*Oa),u()):w},t.clipExtent=function(n){return arguments.length?(S=n,_=n?Zt(n[0][0],n[0][1],n[1][0],n[1][1]):y,u()):S},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Oa,d=n[1]%360*Oa,r()):[v*Ia,d*Ia]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Oa,M=n[1]%360*Oa,x=n.length>2?n[2]%360*Oa:0,r()):[m*Ia,M*Ia,x*Ia]},oa.rebind(t,f,\"precision\"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function le(n){return ie(n,function(t,e){n.point(t*Oa,e*Oa)})}function ce(n,t){return[n,t]}function se(n,t){return[n>ja?n-Ua:-ja>n?n+Ua:n,t]}function fe(n,t,e){return n?t||e?Ct(ge(n),pe(t,e)):ge(n):t||e?pe(t,e):se}function he(n){return function(t,e){return t+=n,[t>ja?t-Ua:-ja>t?t+Ua:t,e]}}function ge(n){var t=he(n);return t.invert=he(-n),t}function pe(n,t){function e(n,t){var e=Math.cos(t),o=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),s=c*r+o*u;return[Math.atan2(l*i-s*a,o*r-c*u),tn(s*i+l*a)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),a=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),o=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),s=c*i-l*a;return[Math.atan2(l*i+c*a,o*r+s*u),tn(s*r-o*u)]},e}function ve(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,a,o){var l=a*t;null!=u?(u=de(e,u),i=de(e,i),(a>0?i>u:u>i)&&(u+=a*Ua)):(u=n+a*Ua,i=n-.5*l);for(var c,s=u;a>0?s>i:i>s;s-=l)o.point((c=_t([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],c[1])}}function de(n,t){var e=dt(t);e[0]-=n,bt(e);var r=nn(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Da)%(2*Math.PI)}function me(n,t,e){var r=oa.range(n,t-Da,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function ye(n,t,e){var r=oa.range(n,t-Da,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function Me(n){return n.source}function xe(n){return n.target}function be(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),a=Math.cos(r),o=Math.sin(r),l=u*Math.cos(n),c=u*Math.sin(n),s=a*Math.cos(e),f=a*Math.sin(e),h=2*Math.asin(Math.sqrt(an(r-t)+u*a*an(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*l+t*s,u=e*c+t*f,a=e*i+t*o;return[Math.atan2(u,r)*Ia,Math.atan2(a,Math.sqrt(r*r+u*u))*Ia]}:function(){return[n*Ia,t*Ia]};return p.distance=h,p}function _e(){function n(n,u){var i=Math.sin(u*=Oa),a=Math.cos(u),o=Ma((n*=Oa)-t),l=Math.cos(o);Wo+=Math.atan2(Math.sqrt((o=a*Math.sin(o))*o+(o=r*i-e*a*l)*o),e*i+r*a*l),t=n,e=i,r=a}var t,e,r;Jo.point=function(u,i){t=u*Oa,e=Math.sin(i*=Oa),r=Math.cos(i),Jo.point=n},Jo.lineEnd=function(){Jo.point=Jo.lineEnd=b}}function we(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),a=Math.cos(u);return[Math.atan2(n*i,r*a),Math.asin(r&&e*i/r)]},e}function Se(n,t){function e(n,t){a>0?-Ha+Da>t&&(t=-Ha+Da):t>Ha-Da&&(t=Ha-Da);var e=a/Math.pow(u(t),i);return[e*Math.sin(i*n),a-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(ja/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),a=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=a-t,r=K(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(a/r,1/i))-Ha]},e):Ne}function ke(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return Ma(u)u;u++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function qe(n,t){return n[0]-t[0]||n[1]-t[1]}function Te(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Re(n,t,e,r){var u=n[0],i=e[0],a=t[0]-u,o=r[0]-i,l=n[1],c=e[1],s=t[1]-l,f=r[1]-c,h=(o*(l-c)-f*(u-i))/(f*a-o*s);return[u+h*a,l+h*s]}function De(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Pe(){rr(this),this.edge=this.site=this.circle=null}function je(n){var t=ll.pop()||new Pe;return t.site=n,t}function Ue(n){Be(n),il.remove(n),ll.push(n),rr(n)}function Fe(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,a=n.N,o=[n];Ue(n);for(var l=i;l.circle&&Ma(e-l.circle.x)s;++s)c=o[s],l=o[s-1],nr(c.edge,l.site,c.site,u);l=o[0],c=o[f-1],c.edge=Ke(l.site,c.site,null,u),$e(l),$e(c)}function He(n){for(var t,e,r,u,i=n.x,a=n.y,o=il._;o;)if(r=Oe(o,a)-i,r>Da)o=o.L;else{if(u=i-Ie(o,a),!(u>Da)){r>-Da?(t=o.P,e=o):u>-Da?(t=o,e=o.N):t=e=o;break}if(!o.R){t=o;break}o=o.R}var l=je(n);if(il.insert(t,l),t||e){if(t===e)return Be(t),e=je(t.site),il.insert(l,e),l.edge=e.edge=Ke(t.site,l.site),$e(t),void $e(e);if(!e)return void(l.edge=Ke(t.site,l.site));Be(t),Be(e);var c=t.site,s=c.x,f=c.y,h=n.x-s,g=n.y-f,p=e.site,v=p.x-s,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,M=v*v+d*d,x={x:(d*y-g*M)/m+s,y:(h*M-v*y)/m+f};nr(e.edge,c,p,x),l.edge=Ke(c,n,null,x),e.edge=Ke(n,p,null,x),$e(t),$e(e)}}function Oe(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var a=n.P;if(!a)return-(1/0);e=a.site;var o=e.x,l=e.y,c=l-t;if(!c)return o;var s=o-r,f=1/i-1/c,h=s/c;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*c)-l+c/2+u-i/2)))/f+r:(r+o)/2}function Ie(n,t){var e=n.N;if(e)return Oe(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ye(n){this.site=n,this.edges=[]}function Ze(n){for(var t,e,r,u,i,a,o,l,c,s,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=ul,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(o=i.edges,l=o.length,a=0;l>a;)s=o[a].end(),r=s.x,u=s.y,c=o[++a%l].start(),t=c.x,e=c.y,(Ma(r-t)>Da||Ma(u-e)>Da)&&(o.splice(a,0,new tr(Qe(i.site,s,Ma(r-f)Da?{x:f,y:Ma(t-f)Da?{x:Ma(e-p)Da?{x:h,y:Ma(t-h)Da?{x:Ma(e-g)=-Pa)){var g=l*l+c*c,p=s*s+f*f,v=(f*g-c*p)/h,d=(l*p-s*g)/h,f=d+o,m=cl.pop()||new Xe;m.arc=n,m.site=u,m.x=v+a,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,M=ol._;M;)if(m.yd||d>=o)return;if(h>p){if(i){if(i.y>=c)return}else i={x:d,y:l};e={x:d,y:c}}else{if(i){if(i.yr||r>1)if(h>p){if(i){if(i.y>=c)return}else i={x:(l-u)/r,y:l};e={x:(c-u)/r,y:c}}else{if(i){if(i.yg){if(i){if(i.x>=o)return}else i={x:a,y:r*a+u};e={x:o,y:r*o+u}}else{if(i){if(i.xi||f>a||r>h||u>g)){if(p=n.point){var p,v=t-n.x,d=e-n.y,m=v*v+d*d;if(l>m){var y=Math.sqrt(l=m);r=t-y,u=e-y,i=t+y,a=e+y,o=p}}for(var M=n.nodes,x=.5*(s+h),b=.5*(f+g),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:c(n,s,f,x,b);break;case 1:c(n,x,f,h,b);break;case 2:c(n,s,b,x,g);break;case 3:c(n,x,b,h,g)}}}(n,r,u,i,a),o}function vr(n,t){n=oa.rgb(n),t=oa.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,a=t.g-r,o=t.b-u;return function(n){return\"#\"+bn(Math.round(e+i*n))+bn(Math.round(r+a*n))+bn(Math.round(u+o*n))}}function dr(n,t){var e,r={},u={};for(e in n)e in t?r[e]=Mr(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function mr(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function yr(n,t){var e,r,u,i=fl.lastIndex=hl.lastIndex=0,a=-1,o=[],l=[];for(n+=\"\",t+=\"\";(e=fl.exec(n))&&(r=hl.exec(t));)(u=r.index)>i&&(u=t.slice(i,u),o[a]?o[a]+=u:o[++a]=u),(e=e[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,l.push({i:a,x:mr(e,r)})),i=hl.lastIndex;return ir;++r)o[(e=l[r]).i]=e.x(n);return o.join(\"\")})}function Mr(n,t){for(var e,r=oa.interpolators.length;--r>=0&&!(e=oa.interpolators[r](n,t)););return e}function xr(n,t){var e,r=[],u=[],i=n.length,a=t.length,o=Math.min(n.length,t.length);for(e=0;o>e;++e)r.push(Mr(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;a>e;++e)u[e]=t[e];return function(n){for(e=0;o>e;++e)u[e]=r[e](n);return u}}function br(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function _r(n){return function(t){return 1-n(1-t)}}function wr(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function Sr(n){return n*n}function kr(n){return n*n*n}function Nr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Er(n){return function(t){return Math.pow(t,n)}}function Ar(n){return 1-Math.cos(n*Ha)}function Cr(n){return Math.pow(2,10*(n-1))}function zr(n){return 1-Math.sqrt(1-n*n)}function Lr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ua*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ua/t)}}function qr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Tr(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Rr(n,t){n=oa.hcl(n),t=oa.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,a=t.c-r,o=t.l-u;return isNaN(a)&&(a=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return fn(e+i*n,r+a*n,u+o*n)+\"\"}}function Dr(n,t){n=oa.hsl(n),t=oa.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,a=t.s-r,o=t.l-u;return isNaN(a)&&(a=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return cn(e+i*n,r+a*n,u+o*n)+\"\"}}function Pr(n,t){n=oa.lab(n),t=oa.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,a=t.a-r,o=t.b-u;return function(n){return gn(e+i*n,r+a*n,u+o*n)+\"\"}}function jr(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Ur(n){var t=[n.a,n.b],e=[n.c,n.d],r=Hr(t),u=Fr(t,e),i=Hr(Or(e,t,-u))||0;t[0]*e[1]180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Ir(e)+\"rotate(\",null,\")\")-2,x:mr(n,t)})):t&&e.push(Ir(e)+\"rotate(\"+t+\")\")}function Vr(n,t,e,r){n!==t?r.push({i:e.push(Ir(e)+\"skewX(\",null,\")\")-2,x:mr(n,t)}):t&&e.push(Ir(e)+\"skewX(\"+t+\")\")}function Xr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var u=e.push(Ir(e)+\"scale(\",null,\",\",null,\")\");r.push({i:u-4,x:mr(n[0],t[0])},{i:u-2,x:mr(n[1],t[1])})}else(1!==t[0]||1!==t[1])&&e.push(Ir(e)+\"scale(\"+t+\")\")}function $r(n,t){var e=[],r=[];return n=oa.transform(n),t=oa.transform(t),Yr(n.translate,t.translate,e,r),Zr(n.rotate,t.rotate,e,r),Vr(n.skew,t.skew,e,r),Xr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,u=-1,i=r.length;++u=0;)e.push(u[r])}function au(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,a=-1;++ae;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function mu(n){return n.reduce(yu,0)}function yu(n,t){return n+t[1]}function Mu(n,t){return xu(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function xu(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function bu(n){return[oa.min(n),oa.max(n)]}function _u(n,t){return n.value-t.value}function wu(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Su(n,t){n._pack_next=t,t._pack_prev=n}function ku(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function Nu(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(c=e.length)){var e,r,u,i,a,o,l,c,s=1/0,f=-(1/0),h=1/0,g=-(1/0);if(e.forEach(Eu),r=e[0],r.x=-r.r,r.y=0,t(r),c>1&&(u=e[1],u.x=u.r,u.y=0,t(u),c>2))for(i=e[2],zu(r,u,i),t(i),wu(r,i),r._pack_prev=i,wu(i,u),u=r._pack_next,a=3;c>a;a++){zu(r,u,i=e[a]);var p=0,v=1,d=1;for(o=u._pack_next;o!==u;o=o._pack_next,v++)if(ku(o,i)){p=1;break}if(1==p)for(l=r._pack_prev;l!==o._pack_prev&&!ku(l,i);l=l._pack_prev,d++);p?(d>v||v==d&&u.ra;a++)i=e[a],i.x-=m,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=M,e.forEach(Au)}}function Eu(n){n._pack_next=n._pack_prev=n}function Au(n){delete n._pack_next,delete n._pack_prev}function Cu(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,a=u.length;++i=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Pu(n,t,e){return n.a.parent===t.parent?n.a:e}function ju(n){return 1+oa.max(n,function(n){return n.y})}function Uu(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Fu(n){var t=n.children;return t&&t.length?Fu(t[0]):n}function Hu(n){var t,e=n.children;return e&&(t=e.length)?Hu(e[t-1]):n}function Ou(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Iu(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Yu(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Zu(n){return n.rangeExtent?n.rangeExtent():Yu(n.range())}function Vu(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Xu(n,t){var e,r=0,u=n.length-1,i=n[r],a=n[u];return i>a&&(e=r,r=u,u=e,e=i,i=a,a=e),n[r]=t.floor(i),n[u]=t.ceil(a),n}function $u(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:wl}function Bu(n,t,e,r){var u=[],i=[],a=0,o=Math.min(n.length,t.length)-1;for(n[o]2?Bu:Vu,l=r?Wr:Br;return a=u(n,t,l,e),o=u(t,n,l,Mr),i}function i(n){return a(n)}var a,o;return i.invert=function(n){return o(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(jr)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return Qu(n,t)},i.tickFormat=function(t,e){return ni(n,t,e)},i.nice=function(t){return Gu(n,t),u()},i.copy=function(){return Wu(n,t,e,r)},u()}function Ju(n,t){return oa.rebind(n,t,\"range\",\"rangeRound\",\"interpolate\",\"clamp\")}function Gu(n,t){return Xu(n,$u(Ku(n,t)[2])),Xu(n,$u(Ku(n,t)[2])),n}function Ku(n,t){null==t&&(t=10);var e=Yu(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Qu(n,t){return oa.range.apply(oa,Ku(n,t))}function ni(n,t,e){var r=Ku(n,t);if(e){var u=so.exec(e);if(u.shift(),\"s\"===u[8]){var i=oa.formatPrefix(Math.max(Ma(r[0]),Ma(r[1])));return u[7]||(u[7]=\".\"+ti(i.scale(r[2]))),u[8]=\"f\",e=oa.format(u.join(\"\")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]=\".\"+ei(u[8],r)),e=u.join(\"\")}else e=\",.\"+ti(r[2])+\"f\";return oa.format(e)}function ti(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function ei(n,t){var e=ti(t[2]);return n in Sl?Math.abs(e-ti(Math.max(Ma(t[0]),Ma(t[1]))))+ +(\"e\"!==n):e-2*(\"%\"===n)}function ri(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function a(t){return n(u(t))}return a.invert=function(t){return i(n.invert(t))},a.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),a):r},a.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),a):t},a.nice=function(){var t=Xu(r.map(u),e?Math:Nl);return n.domain(t),r=t.map(i),a},a.ticks=function(){var n=Yu(r),a=[],o=n[0],l=n[1],c=Math.floor(u(o)),s=Math.ceil(u(l)),f=t%1?2:t;if(isFinite(s-c)){if(e){for(;s>c;c++)for(var h=1;f>h;h++)a.push(i(c)*h);a.push(i(c))}else for(a.push(i(c));c++0;h--)a.push(i(c)*h);for(c=0;a[c]l;s--);a=a.slice(c,s)}return a},a.tickFormat=function(n,e){if(!arguments.length)return kl;arguments.length<2?e=kl:\"function\"!=typeof e&&(e=oa.format(e));var r=Math.max(1,t*n/a.ticks().length);return function(n){var a=n/i(Math.round(u(n)));return t-.5>a*t&&(a*=t),r>=a?e(n):\"\"}},a.copy=function(){return ri(n.copy(),t,e,r)},Ju(a,n)}function ui(n,t,e){function r(t){return n(u(t))}var u=ii(t),i=ii(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return Qu(e,n)},r.tickFormat=function(n,t){return ni(e,n,t)},r.nice=function(n){return r.domain(Gu(e,n))},r.exponent=function(a){return arguments.length?(u=ii(t=a),i=ii(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return ui(n.copy(),t,e)},Ju(r,n)}function ii(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function ai(n,t){function e(e){return i[((u.get(e)||(\"range\"===t.t?u.set(e,n.push(e)):NaN))-1)%i.length]}function r(t,e){return oa.range(n.length).map(function(n){return t+e*n})}var u,i,a;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new c;for(var i,a=-1,o=r.length;++ae?[NaN,NaN]:[e>0?o[e-1]:n[0],et?NaN:t/i+n,[t,t+1/i]},r.copy=function(){return li(n,t,e)},u()}function ci(n,t){function e(e){return e>=e?t[oa.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return ci(n,t)},e}function si(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Qu(n,t)},t.tickFormat=function(t,e){return ni(n,t,e)},t.copy=function(){return si(n)},t}function fi(){return 0}function hi(n){return n.innerRadius}function gi(n){return n.outerRadius}function pi(n){return n.startAngle}function vi(n){return n.endAngle}function di(n){return n&&n.padAngle}function mi(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function yi(n,t,e,r,u){var i=n[0]-t[0],a=n[1]-t[1],o=(u?r:-r)/Math.sqrt(i*i+a*a),l=o*a,c=-o*i,s=n[0]+l,f=n[1]+c,h=t[0]+l,g=t[1]+c,p=(s+h)/2,v=(f+g)/2,d=h-s,m=g-f,y=d*d+m*m,M=e-r,x=s*g-h*f,b=(0>m?-1:1)*Math.sqrt(Math.max(0,M*M*y-x*x)),_=(x*m-d*b)/y,w=(-x*d-m*b)/y,S=(x*m+d*b)/y,k=(-x*d+m*b)/y,N=_-p,E=w-v,A=S-p,C=k-v;return N*N+E*E>A*A+C*C&&(_=S,w=k),[[_-l,w-c],[_*e/M,w*e/M]]}function Mi(n){function t(t){function a(){c.push(\"M\",i(n(s),o))}for(var l,c=[],s=[],f=-1,h=t.length,g=En(e),p=En(r);++f1?n.join(\"L\"):n+\"Z\"}function bi(n){return n.join(\"L\")+\"Z\"}function _i(n){for(var t=0,e=n.length,r=n[0],u=[r[0],\",\",r[1]];++t1&&u.push(\"H\",r[0]),u.join(\"\")}function wi(n){for(var t=0,e=n.length,r=n[0],u=[r[0],\",\",r[1]];++t1){o=t[1],i=n[l],l++,r+=\"C\"+(u[0]+a[0])+\",\"+(u[1]+a[1])+\",\"+(i[0]-o[0])+\",\"+(i[1]-o[1])+\",\"+i[0]+\",\"+i[1];for(var c=2;c9&&(u=3*t/Math.sqrt(u),a[o]=u*e,a[o+1]=u*r));for(o=-1;++o<=l;)u=(n[Math.min(l,o+1)][0]-n[Math.max(0,o-1)][0])/(6*(1+a[o]*a[o])),i.push([u||0,a[o]*u||0]);return i}function Fi(n){return n.length<3?xi(n):n[0]+Ai(n,Ui(n))}function Hi(n){for(var t,e,r,u=-1,i=n.length;++u=t?a(n-t):void(s.c=a)}function a(e){var u=p.active,i=p[u];i&&(i.timer.c=null,i.timer.t=NaN,--p.count,delete p[u],i.event&&i.event.interrupt.call(n,n.__data__,i.index));for(var a in p)if(r>+a){var c=p[a];c.timer.c=null,c.timer.t=NaN,--p.count,delete p[a]}s.c=o,qn(function(){return s.c&&o(e||1)&&(s.c=null,s.t=NaN),1},0,l),p.active=r,v.event&&v.event.start.call(n,n.__data__,t),g=[],v.tween.forEach(function(e,r){(r=r.call(n,n.__data__,t))&&g.push(r)}),h=v.ease,f=v.duration}function o(u){for(var i=u/f,a=h(i),o=g.length;o>0;)g[--o].call(n,a);return i>=1?(v.event&&v.event.end.call(n,n.__data__,t),--p.count?delete p[r]:delete n[e],1):void 0}var l,s,f,h,g,p=n[e]||(n[e]={active:0,count:0}),v=p[r];v||(l=u.time,s=qn(i,0,l),v=p[r]={tween:new c,time:l,timer:s,delay:u.delay,duration:u.duration,ease:u.ease,index:t},u=null,++p.count)}function na(n,t,e){n.attr(\"transform\",function(n){var r=t(n);return\"translate(\"+(isFinite(r)?r:e(n))+\",0)\"})}function ta(n,t,e){n.attr(\"transform\",function(n){var r=t(n);return\"translate(0,\"+(isFinite(r)?r:e(n))+\")\"})}function ea(n){return n.toISOString()}function ra(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=oa.bisect(Gl,u);return i==Gl.length?[t.year,Ku(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Gl[i-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=ua(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=ua(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Yu(r.domain()),i=null==n?u(e,10):\"number\"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],ua(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return ra(n.copy(),t,e)},Ju(r,n)}function ua(n){return new Date(n)}function ia(n){return JSON.parse(n.responseText)}function aa(n){var t=sa.createRange();return t.selectNode(sa.body),t.createContextualFragment(n.responseText)}var oa={version:\"3.5.13\"},la=[].slice,ca=function(n){return la.call(n)},sa=this.document;if(sa)try{ca(sa.documentElement.childNodes)[0].nodeType}catch(fa){ca=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),sa)try{sa.createElement(\"DIV\").style.setProperty(\"opacity\",0,\"\")}catch(ha){var ga=this.Element.prototype,pa=ga.setAttribute,va=ga.setAttributeNS,da=this.CSSStyleDeclaration.prototype,ma=da.setProperty;ga.setAttribute=function(n,t){pa.call(this,n,t+\"\")},ga.setAttributeNS=function(n,t,e){va.call(this,n,t,e+\"\")},da.setProperty=function(n,t,e){ma.call(this,n,t+\"\",e)}}oa.ascending=e,oa.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:NaN},oa.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=r){e=r;break}for(;++ur&&(e=r)}else{for(;++u=r){e=r;break}for(;++ur&&(e=r)}return e},oa.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=r){e=r;break}for(;++ue&&(e=r)}else{for(;++u=r){e=r;break}for(;++ue&&(e=r)}return e},oa.extent=function(n,t){var e,r,u,i=-1,a=n.length;if(1===arguments.length){for(;++i=r){e=u=r;break}for(;++ir&&(e=r),r>u&&(u=r))}else{for(;++i=r){e=u=r;break}for(;++ir&&(e=r),r>u&&(u=r))}return[e,u]},oa.sum=function(n,t){var e,r=0,i=n.length,a=-1;if(1===arguments.length)for(;++a1?l/(s-1):void 0},oa.deviation=function(){var n=oa.variance.apply(this,arguments);return n?Math.sqrt(n):n};var ya=i(e);oa.bisectLeft=ya.left,oa.bisect=oa.bisectRight=ya.right,oa.bisector=function(n){return i(1===n.length?function(t,r){return e(n(t),r)}:n)},oa.shuffle=function(n,t,e){(i=arguments.length)<3&&(e=n.length,2>i&&(t=0));for(var r,u,i=e-t;i;)u=Math.random()*i--|0,r=n[i+t],n[i+t]=n[u+t],n[u+t]=r;return n},oa.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},oa.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},oa.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=oa.min(arguments,a),e=new Array(t);++n=0;)for(r=n[u],t=r.length;--t>=0;)e[--a]=r[t];return e};var Ma=Math.abs;oa.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e===1/0)throw new Error(\"infinite range\");var r,u=[],i=o(Ma(e)),a=-1;if(n*=i,t*=i,e*=i,0>e)for(;(r=n+e*++a)>t;)u.push(r/i);else for(;(r=n+e*++a)=i.length)return r?r.call(u,a):e?a.sort(e):a;for(var l,s,f,h,g=-1,p=a.length,v=i[o++],d=new c;++g
"),scrollStatusBox(),$("#wizard_"+type).find(".button_finish").removeClass("disabled")}(type,completedCount)})},accountsImporter.sendAccountData=function(type,addedUsers,updatedUsers){null!=socket&&socket.emit("$trudesk:accounts:import:"+type,{addedUsers,updatedUsers})},accountsImporter}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;__WEBPACK_AMD_DEFINE_ARRAY__=[__webpack_require__(0),__webpack_require__(76),__webpack_require__(4),__webpack_require__(18)],void 0===(__WEBPACK_AMD_DEFINE_RESULT__=function($,Shepherd,UIKit){var tour={};function advanceTourDelayed(){setTimeout(function(){tour.next()},300)}return(tour=new Shepherd.Tour({defaults:{classes:"shepherd-theme-square shepherd-theme-arrows"}})).addStep("welcome",{title:"Welcome!",text:'Welcome to the trudesk tour! I\'m going to guide you through the system and show you around a little.
You may choose to skip the tour if you do not require it. Simply press the skip button below.',buttons:[{text:"Lets Start",action:tour.next},{text:"Skip",classes:"uk-float-left",action:function(){var username=window.trudeskSessionService.getUser().username;$.ajax({url:"/api/v1/users/"+username+"/updatepreferences",method:"PUT",headers:{"Content-Type":"application/json"},data:JSON.stringify({preference:"tourCompleted",value:!0}),success:function(){tour.cancel()},error:function(error){console.error(error)}})}}],when:{show:function(){var overlay=$("#serverRestarting");overlay.css("z-index",999).removeClass("hide"),overlay.find("*").hide()},hide:function(){var overlay=$("#serverRestarting");overlay.animate({opacity:0},500,function(){overlay.css("z-index",9999).addClass("hide"),overlay.find("*").show()})}}}),tour.addStep("dashboard",{title:"Dashboard",text:"This is your dashboard screen. It will show you stats at a glance."}),tour.addStep("topbar",{title:"Top Nav",text:"This is your top nav. It has quick links to frequently used functions and notifications.",attachTo:".top-nav bottom"}),tour.addStep("addTicket",{title:"Quick Link - Add Ticket",text:" Add Ticket quick link will is the fastest way to submit and enter a ticket. Go ahead give it a push!",attachTo:".top-menu .tour-addTicket bottom",buttons:[],when:{show:function(){$(".tour-addTicket").on("click",advanceTourDelayed),$("button.uk-modal-close").attr("disabled",!0),$("button#submitNewTicket").attr("disabled",!0)},hide:function(){setTimeout(function(){$(".tour-addTicket").off("click",advanceTourDelayed)},5e3)}}}),tour.addStep("addTicketForm",{title:"Add Ticket Form",text:"The great ticket form. Use this to submit new request. Don't worry it's pretty simple. Remember, always try to be as detailed as possible.",attachTo:"#ticketCreateModal .uk-modal-dialog left",when:{hide:function(){UIKit.modal($("#ticketCreateModal")).hide()}}}),tour.addStep("messagesIcon",{title:"Messages Notification",text:"Here you will see your notification for chat messages sent by other users.",attachTo:".tour-messagesNotification bottom"}),tour.addStep("ticketNotifications",{title:"Ticket Notifications",text:"This is where you'll get notification updates about tickets.",attachTo:".tour-ticketNotifications bottom"}),tour.addStep("onlineUserListButton",{title:"Chat - User List",text:"Push this to open the user list to quickly send a message to any user.",attachTo:".tour-onlineUserListButton bottom",buttons:[],when:{show:function(){$(".tour-onlineUserListButton").on("click",function(){setTimeout(function(){tour.show("onlineUserList")},300)})},hide:function(){$(".tour-onlineUserListButton").off("click")}}}),tour.addStep("onlineUserList",{title:"Chat - User List",text:"There it is! Your user list. Lets move on!",when:{hide:function(){}}}),tour.addStep("sidebar_tickets",{title:"Tickets",text:"This is the core of trudesk. You'll find all your current and past tickets located here.",attachTo:".navTickets right",buttons:[],when:{show:function(){UIKit.offcanvas.hide(),$("#page-content").css({opacity:.5}),$(".navTickets").on("click",function(){tour.next()})}}}),tour.addStep("tickets_page",{title:"Tickets",text:"Here you will find all new, open, or pending tickets. If any tickets are overdue they will flash red.
Take a minute to review this screen and click next to proceed."}),tour.addStep("sidebar_messages",{title:"Messages",text:"This will take you to your messages. Messages are sent between users privately and securely.",attachTo:".navMessages right",buttons:[],when:{show:function(){$(".navMessages").on("click",function(){setTimeout(function(){tour.next()},1e3)})}}}),tour.addStep("message_list",{title:"Message List",text:"Here you will find your current active conversations. If there are no current conversation, you can start a conversation. We will view that next.",attachTo:"ul.message-items right"}),tour.addStep("start_conversation",{title:"Start New Conversation",text:"Simply click the (+) sign to start a new conversation with a user.",attachTo:"#convo-actions a right",buttons:[],when:{show:function(){$("#convo-actions a").on("click",function(){tour.next()})}}}),tour.addStep("all_user_list",{title:"User List",text:"Here you will find the same list as before, the all user list. Clicking on a user will start the conversation.",attachTo:"#new-convo-user-list right",when:{show:function(){$(".all-user-list *").css({"pointer-events":"none"})}}}),tour.on("complete",function(){}),tour.init=function(){tour.start()},tour}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;__WEBPACK_AMD_DEFINE_ARRAY__=[__webpack_require__(18)],void 0===(__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof(__WEBPACK_AMD_DEFINE_FACTORY__=function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){return void 0===t}function s(t){return"object"==typeof t}function h(t){var e=document.createElement("div");return e.innerHTML=t,e.children[0]}function l(t){if(s(t))return t.hasOwnProperty("element")&&t.hasOwnProperty("on")?t:null;var e=S.exec(t);if(!e)return null;var n=e[2];return"["===n[0]&&(n=n.substring(1,n.length-1)),{element:e[1],on:n}}function a(t,e){if(null===t||i(t))return t;if(s(t))return t;for(var n=t.split(" "),r={},o=e.length-1,h=n.length-1;h>=0;h--){if(0===o){r[e[o]]=n.slice(0,h+1).join(" ");break}r[e[o]]=n[h],o--}return r}var u=function(){function t(t,e){for(var n=0;n
Attach images by dragging & dropping or pasting from clipboard.
"),$el.siblings(".CodeMirror").addClass("hasFileDesc"),$el.siblings(".editor-statusbar").addClass("hasFileDesc").prepend(attachFileDiv)),$scope.openFilterTicketWindow=function(){openFilterTicketWindow.openWindow()},$scope.submitTicketForm=function(event){event.preventDefault();var socketId=socket.ui.socket.io.engine.id,data={},form=$("#createTicketForm"),issueField=form.find("textarea#issue");if(!(issueField.length<1)){var minIssueLength=SettingsService.getSettings().minIssueLength.value,$mdeError=null;if(issueField.val().lengthPlease enter a valid comment. Comments must contain at least '+minIssueLength+" characters.
Would you like to restart the server now?",function(){$http.get("/api/v1/admin/restart").success(function(){}).error(function(err){helpers.hideLoader(),$log.log("[trudesk:settings:mailerCheckSubmit] - Error: "+err.error),$log.error(err)})},{labels:{Ok:"Yes",Cancel:"No"},confirmButtonClass:"md-btn-primary"})},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.mailerCheckFormSubmit=function($event){$event.preventDefault();var mailerCheckTicketTypeValue=$("#mailerCheckTicketType option[selected]").val(),mailerCheckTicketPriorityValue=$("#mailerCheckTicketPriority option[selected]").val();$http.put("/api/v1/settings",[{name:"mailer:check:polling",value:6e4*$scope.mailerCheckPolling},{name:"mailer:check:host",value:$scope.mailerCheckHost},{name:"mailer:check:port",value:$scope.mailerCheckPort},{name:"mailer:check:username",value:$scope.mailerCheckUsername},{name:"mailer:check:password",value:$scope.mailerCheckPassword},{name:"mailer:check:ticketype",value:mailerCheckTicketTypeValue},{name:"mailer:check:ticketpriority",value:mailerCheckTicketPriorityValue},{name:"mailer:check:createaccount",value:$scope.mailerCheckCreateAccount},{name:"mailer:check:deletemessage",value:$scope.mailerCheckDeleteMessage}],{headers:{"Content-Type":"application/json"}}).then(function(){helpers.UI.showSnackbar("Mail Check Settings Saved",!1),UIkit.modal.confirm("Settings will take affect after server restart.
Would you like to restart the server now?",function(){$http.get("/api/v1/admin/restart").success(function(){}).error(function(err){helpers.hideLoader(),$log.log("[trudesk:settings:mailerCheckSubmit] - Error: "+err.error),$log.error(err)})},{labels:{Ok:"Yes",Cancel:"No"},confirmButtonClass:"md-btn-primary"})},function(err){helpers.UI.showSnackbar(err.data.error,!0),$log.error(err)})},$scope.savePrivacyPolicy=function($event){$event.preventDefault(),$http.put("/api/v1/settings",{name:"legal:privacypolicy",value:$scope.privacyPolicy},{headers:{"Content-Type":"application/json"}}).then(function(){helpers.UI.showSnackbar("Privacy Policy Updated",!1)},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.showTourChanged=function(){$scope.showTour=this.showTour,$http.put("/api/v1/settings",{name:"showTour:enable",value:$scope.showTour},{headers:{"Content-Type":"application/json"}}).then(function(){},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.showOverdueTicketsChanged=function(){$scope.showOverdueTickets=this.showOverdueTickets,$http.put("/api/v1/settings",{name:"showOverdueTickets:enable",value:$scope.showOverdueTickets},{headers:{"Content-Type":"application/json"}}).then(function(){},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.allowPublicTicketsChanged=function(){$scope.allowPublicTickets=this.allowPublicTickets,$http.put("/api/v1/settings",{name:"allowPublicTickets:enable",value:$scope.allowPublicTickets},{headers:{"Content-Type":"application/json"}}).then(function(){},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.saveMinSubjectLengthClick=function(){saveMinLength("ticket:minlength:subject",$scope.minSubjectLength)},$scope.saveMinIssueLengthClick=function(){saveMinLength("ticket:minlength:issue",$scope.minIssueLength)},$scope.allowUserRegistrationChanged=function(){$scope.allowUserRegistration=this.allowUserRegistration,$http.put("/api/v1/settings",{name:"allowUserRegistration:enable",value:$scope.allowUserRegistration},{headers:{"Content-Type":"application/json"}}).then(function(){},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.emailBetaChanged=function(){$scope.emailBeta=this.emailBeta,$http.put("/api/v1/settings",{name:"beta:email",value:$scope.emailBeta},{headers:{"Content-Type":"application/json"}}).then(function(){},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.showCreateTicketTypeWindow=function($event){$event.preventDefault();var createTicketTypeModal=$("#createTicketTypeModal");createTicketTypeModal.length>0&&UIkit.modal(createTicketTypeModal,{bgclose:!1}).show()},$scope.switchTicketType=function($event,animation){var $currentTarget=$($event.currentTarget);if(animation=!!angular.isUndefined(animation)||animation,$currentTarget){if($currentTarget.hasClass("active"))return!0;var key=$currentTarget.attr("data-key"),$keyWindow=$currentTarget.parent().parent().parent().find('div[data-ticket-type-id="'+key+'"]');$keyWindow&&($currentTarget.parent().find("li.active").removeClass("active"),$currentTarget.addClass("active"),$currentTarget.parent().parent().parent().find("div[data-ticket-type-id].active").velocity({opacity:animation?0:1},{duration:animation?250:1,complete:function(){$(this).removeClass("active").addClass("hide"),$keyWindow.velocity({opacity:1},{duration:animation?250:1,begin:function(){$keyWindow.removeClass("hide")},complete:function(){$keyWindow.addClass("active")}})}}))}},$scope.createTicketType=function(event){event.preventDefault();var form=$("#createTicketTypeForm");if(!form.isValid(null,null,!1))return!0;var typeName=form.find('input[name="typeName"]').val();if(!typeName||typeName.length<3)return!0;$http.post("/api/v1/tickets/types/create",{name:typeName},{headers:{"Content-Type":"application/json"}}).then(function(){helpers.UI.showSnackbar("Type: "+typeName+" created successfully",!1),History.pushState(null,null,"/settings/tickets/?refresh=true")},function(err){helpers.UI.showSnackbar("Unable to create ticket type. Check console",!0),$log.error(err)})},$scope.editTicketType=function($event){if(_.isNull($event.target)||_.isUndefined($event.target)||"label"===$event.target.tagName.toLowerCase()||"input"===$event.target.tagName.toLowerCase())return!0;var ticketTypeId=$event.currentTarget.dataset.tickettypeoid;if(!ticketTypeId)return!0;History.pushState(null,null,"/settings/tickettypes/"+ticketTypeId)},$scope.submitUpdateTicketType=function($event,typeId){$event.preventDefault();var $form=$($event.currentTarget);if($form){var typeName=$form.find("input#ticket-type-name-"+typeId).val();$http.put("/api/v1/tickets/types/"+typeId,{name:typeName},{headers:{"Content-Type":"application/json"}}).then(function(){helpers.UI.showSnackbar("Type: "+typeName+" updated successfully",!1),$('li[data-key="'+typeId+'"]').find("h3").text(typeName)},function(err){helpers.UI.showSnackbar(err,!0)})}},$scope.submitUpdateTemplateSubject=function($event,templateId){$event.preventDefault();var $form=$($event.currentTarget);if($form){var subject=$form.find("input").val();$http.put("/api/v1/settings/mailer/template/"+templateId,{subject},{headers:{"Content-Type":"application/json"}}).then(function(){helpers.UI.showSnackbar("Template subject updated successfully")},function(err){helpers.UI.showSnackbar(err,!0)})}},$scope.updateTicketType=function(typeId){if(!typeId||typeId.length<1)return helpers.UI.showSnackbar("Unable to get type id",!0),!0;var typeName=$("#editType_Name").val();$http.put("/api/v1/tickets/types/"+typeId,{name:typeName},{headers:{"Content-Type":"application/json"}}).then(function(){helpers.UI.showSnackbar("Type: "+typeName+" updated successfully",!1)},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.showDeleteTicketType=function(typeId,hasTickets){if(hasTickets){var delTicketTypeModal=$("#deleteTicketTypeModal-"+typeId);delTicketTypeModal.length>0?UIkit.modal(delTicketTypeModal,{bgclose:!1}).show():$log.log("Unable to locate modal window: #deleteTicketTypeModal"+typeId)}else $scope.submitDeleteTicketType(typeId,void 0)},$scope.submitDeleteTicketType=function(typeId,event){if(event&&event.preventDefault(),_.isUndefined(typeId)||typeId.length<1)return helpers.UI.showSnackbar("Unable to get type ID",!0),!0;var typeName=$("input#del_type_name-"+typeId).val(),newTypeId=$("form#deleteTicketTypeForm-"+typeId+' select[name="ticketType"]').val();if(!newTypeId||newTypeId.length<1)return helpers.UI.showSnackbar("Unable to get new ticket type. Aborting...",!0),!0;$http({method:"DELETE",url:"/api/v1/tickets/types/"+typeId,data:{newTypeId},headers:{"Content-Type":"application/json"}}).then(function(response){if(response.data.success)return helpers.UI.showSnackbar("Successfully removed ticket type: "+typeName,!1),History.pushState(null,null,"/settings/tickets/")},function(response){_.isUndefined(response.data.error.custom)?($log.error("[trudesk:settings:submitDeleteTicketType] Error -",response.data.error),helpers.UI.showSnackbar("Unable to remove ticket type. Check console.",!0)):($log.error("[trudesk:settings:submitDeleteTicketType] Error -",response.data.error),helpers.UI.showSnackbar(response.data.error.message,!0))})},$scope.editTagClicked=function(tagId,$event){$event&&$event.preventDefault();var $viewBox=$("#view-tag-"+tagId),$editBox=$("#edit-tag-"+tagId);$editBox.length>0&&$viewBox.length>0&&($viewBox.addClass("hide"),$editBox.removeClass("hide"))},$scope.cancelEditTagClicked=function(tagId,$event){$event&&$event.preventDefault();var $viewBox=$("#view-tag-"+tagId),$editBox=$("#edit-tag-"+tagId);$editBox.length>0&&$viewBox.length>0&&($event&&$($event.currentTarget).parents("form").trigger("reset"),$viewBox.removeClass("hide"),$editBox.addClass("hide"))},$scope.editPriority=function(pId,$event){$event.preventDefault();var $viewBox=$("#view-p-"+pId),$editBox=$("#edit-p-"+pId);$editBox.length>0&&$viewBox.length>0&&($editBox.find(".uk-color-button").css({background:$editBox.find('input[name="p-'+pId+'-htmlColor"]').val()}),$viewBox.addClass("hide"),$editBox.removeClass("hide"))},$scope.cancelEditPriority=function(pId,$event){$event&&$event.preventDefault();var $viewBox=$("#view-p-"+pId),$editBox=$("#edit-p-"+pId);$editBox.length>0&&$viewBox.length>0&&($event&&$($event.currentTarget).parents("form").trigger("reset"),$viewBox.removeClass("hide"),$editBox.addClass("hide"))},$scope.editTicketTypePriority=function(typeId,id,$event){$event.preventDefault();var $viewBox=$("#t-"+typeId+"-view-p-"+id),$editBox=$("#t-"+typeId+"-edit-p-"+id);$editBox.length>0&&$viewBox.length>0&&($editBox.find(".uk-color-button").css({background:$editBox.find('input[name="p-'+id+'-htmlColor"]').val()}),$viewBox.addClass("hide"),$editBox.removeClass("hide"))},$scope.cancelEditTicketTypePriority=function(typeId,id,$event){$event&&$event.preventDefault();var $viewBox=$("#t-"+typeId+"-view-p-"+id),$editBox=$("#t-"+typeId+"-edit-p-"+id);$editBox.length>0&&$viewBox.length>0&&($event&&$($event.currentTarget).parents("form").trigger("reset"),$viewBox.removeClass("hide"),$editBox.addClass("hide"))},$scope.showAddPriorityToType=function(typeId,$event){$event&&$event.preventDefault(),$http.get("/api/v1/tickets/type/"+typeId).success(function(response){if(response.success){var updatedType=response.type;$http.get("/api/v1/tickets/priorities").success(function(response){var priorities=response.priorities,$addPriorityToTypeModal=$("#addPriorityTicketType-"+typeId),$pLoop=$addPriorityToTypeModal.find(".priority-loop");$pLoop.empty();var html="";_.each(priorities,function(priority){_.some(updatedType.priorities,priority)?(html="",html+='
\n",priorityLoop.append(html),helpers.UI.selectize(),angular.injector(["ng","trudesk"]).invoke(["$compile","$rootScope",function($compile,$rootScope){var $scope=priorityLoop.scope();$compile(priorityLoop)($scope||$rootScope),$rootScope.$digest()}]),helpers.UI.showSnackbar("Priority Created.",!1);var createPriorityModal=$("#createPriorityModal");createPriorityModal.length>0&&UIkit.modal(createPriorityModal).hide()}).error(function(errorResponse){$log.error(errorResponse),helpers.UI.showSnackbar("Error: "+errorResponse.data.error,!0)})}},function(errorResponse){$log.error(errorResponse),helpers.UI.showSnackbar("Error: "+errorResponse.data.error,!0)})}},$scope.submitUpdatePriority=function($event){$event.preventDefault();var $form=$($event.currentTarget),priorityId=$form.attr("data-priority-id"),typeId=$form.parents("div[data-ticket-type-id]").attr("data-ticket-type-id");if($form&&priorityId){var $priorityNameInput=$form.find('input[name="p-'+priorityId+'-name"]'),$priorityHtmlColor=$form.find('input[name="p-'+priorityId+'-htmlColor"]'),$priorityOverdueIn=$form.find('input[name="p-'+priorityId+'-overdueIn"]'),priorityName=$priorityNameInput.val(),htmlColor=$priorityHtmlColor.val(),overdueIn=$priorityOverdueIn.val();$http.put("/api/v1/tickets/priority/"+priorityId,{name:priorityName,htmlColor,overdueIn},{headers:{"Content-Type":"application/json"}}).then(function(response){helpers.UI.showSnackbar("Priority updated successfully",!1);var $body=$("body");$body.find(".p-"+priorityId+"-name").css({color:htmlColor}).text(priorityName),$body.find(".p-"+priorityId+"-overdueIn").text(response.data.priority.durationFormatted),$body.find('input[name="p-'+priorityId+'-htmlColor"]').val(htmlColor),typeId?$scope.cancelEditTicketTypePriority(typeId,priorityId):$scope.cancelEditPriority(priorityId)},function(err){helpers.UI.showSnackbar(err,!0)})}},$scope.$watch("colorHeaderBG",function(){setApperanceColorBtn("#headerBGColorBtn",$scope.colorHeaderBG)}),$scope.$watch("colorHeaderPrimary",function(){setApperanceColorBtn("#headerPrimaryColorBtn",$scope.colorHeaderPrimary)}),$scope.$watch("colorPrimary",function(){setApperanceColorBtn("#primaryColorBtn",$scope.colorPrimary)}),$scope.$watch("colorSecondary",function(){setApperanceColorBtn("#secondaryColorBtn",$scope.colorSecondary)}),$scope.$watch("colorTertiary",function(){setApperanceColorBtn("#tertiaryColorBtn",$scope.colorTertiary)}),$scope.$watch("colorQuaternary",function(){setApperanceColorBtn("#quaternaryColorBtn",$scope.colorQuaternary)}),$scope.saveColorScheme=function($event){return $event.preventDefault(),"#"!==$scope.colorHeaderBG[0]?(helpers.UI.showSnackbar("Invalid Header BG Color",!0),!1):"#"!==$scope.colorHeaderPrimary[0]?(helpers.UI.showSnackbar("Invalid Header Primary Color",!0),!1):"#"!==$scope.colorPrimary[0]?(helpers.UI.showSnackbar("Invalid Primary Color",!0),!1):"#"!==$scope.colorSecondary[0]?(helpers.UI.showSnackbar("Invalid Secondary Color",!0),!1):"#"!==$scope.colorTertiary[0]?(helpers.UI.showSnackbar("Invalid Tertiary Color",!0),!1):"#"!==$scope.colorQuaternary[0]?(helpers.UI.showSnackbar("Invalid Quaternary Color",!0),!1):void $http.put("/api/v1/settings",[{name:"color:headerbg",value:$scope.colorHeaderBG},{name:"color:headerprimary",value:$scope.colorHeaderPrimary},{name:"color:primary",value:$scope.colorPrimary},{name:"color:secondary",value:$scope.colorSecondary},{name:"color:tertiary",value:$scope.colorTertiary},{name:"color:quaternary",value:$scope.colorQuaternary}],{headers:{"Content-Type":"application/json"}}).then(function(){$http.get("/api/v1/settings/buildsass").then(function(){helpers.UI.showSnackbar("Color Scheme Saved. Reloading...",!1),$timeout(function(){$window.location.reload()},1e3)},function(err){helpers.UI.showSnackbar(err,!0)})},function(err){helpers.UI.showSnackbar(err,!0)})},$scope.revertColor=function(model,defaultColor){$scope[model]=defaultColor},$scope.generateRandomColor=function(id,$event){$event.preventDefault();var $currentTarget=$($event.currentTarget);if($currentTarget.length>0){var color=function(){for(var color="#",i=0;i<6;i++)color+="0123456789ABCDEF"[Math.floor(16*Math.random())];return color}(),fgColor=getContrast(color.substring(1));$currentTarget.css({background:color,color:fgColor}),$currentTarget.next().find("input").val(color),$currentTarget.next().find("input").attr("ng-model")&&($scope[$currentTarget.next().find("input").attr("ng-model")]=color)}},$scope.editTag=function($event){if(_.isNull($event.target)||_.isUndefined($event.target)||"label"===$event.target.tagName.toLowerCase()||"input"===$event.target.tagName.toLowerCase())return!0;var id=$event.currentTarget.dataset.tagoid;if(!id)return!0;History.pushState(null,null,"/settings/tags/"+id)},$scope.submitUpdateTag=function($event){var $form=$($event.currentTarget),tagId=$form.attr("data-tag-id"),tagName=$form.find('input[name="tag-'+tagId+'-name"]').val();tagName.length<3?helpers.UI.showSnackbar("Invalid Tag Name",!0):$http.put("/api/v1/tags/"+tagId,{name:tagName},{headers:{"Content-Type":"application/json"}}).success(function(){helpers.UI.showSnackbar("Tag: "+tagName+" updated successfully",!1);var $h5=$("h5.tag-"+tagId+"-name");$h5.length>0&&$h5.text(tagName),$scope.cancelEditTagClicked(tagId,null)}).error(function(err){helpers.UI.showSnackbar(err.error)})},$scope.removeTagClicked=function(tagId){var tagName=$("#view-tag-"+tagId).find("h5").text();UIkit.modal.confirm("Really delete tag "+tagName+' This will remove the tag from all associated tickets!',function(){return $scope.deleteTag(tagId)},{labels:{Ok:"Yes",Cancel:"No"},confirmButtonClass:"md-btn-danger"})},$scope.deleteTag=function(tagId){if(_.isUndefined(tagId)||tagId.length<1)return helpers.UI.showSnackbar("Unable to get tag ID",!0),!0;var tagName=$("#view-tag-"+tagId).find("h5").text();$http({method:"DELETE",url:"/api/v1/tags/"+tagId}).then(function(response){if(response.data.success)return helpers.UI.showSnackbar("Successfully removed tag: "+tagName,!1),History.pushState(null,null,"/settings/tickets/?refresh="+(new Date).getTime())},function(response){$log.error("[trudesk:settings:deleteTag] Error - "+response.data.error),helpers.UI.showSnackbar("Unable to remove Tag. Check console.",!0)})}})}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;__WEBPACK_AMD_DEFINE_ARRAY__=[__webpack_require__(9),__webpack_require__(1),__webpack_require__(0),__webpack_require__(8),__webpack_require__(37),__webpack_require__(4)],void 0===(__WEBPACK_AMD_DEFINE_RESULT__=function(angular,_,$,helpers,socket,UIkit){return angular.module("trudesk.controllers.settings.backup",["ngSanitize"]).controller("BackupCtrl",function($scope,$http,$timeout,$log){$scope.init=function(){$timeout(function(){var progressbar,$backupUploadSelect,$uploadButton,bar,settings;progressbar=$("#backupUploadProgress"),$backupUploadSelect=$("#backup-upload-select"),$uploadButton=$backupUploadSelect.parent(),bar=progressbar.find(".uk-progress-bar"),settings={action:"/api/v1/backup/upload",allow:"*.zip",type:"json",loadstart:function(){bar.css("width","0%").text("0%"),progressbar.removeClass("hide"),$uploadButton.addClass("hide")},notallowed:function(){helpers.UI.showSnackbar("Invalid File Type. Please upload a Zip file.",!0)},error:function(err){$log.error(err),helpers.UI.showSnackbar("An unknown error occurred. Check Console",!0)},progress:function(percent){percent=Math.ceil(percent),bar.css("width",percent+"%").text(percent+"%")},allcomplete:function(response){$log.log(response),response.success||helpers.UI.showSnackbar(response.error,!0),bar.css("width","100%").text("100%"),$timeout(function(){progressbar.addClass("hide"),$uploadButton.removeClass("hide"),$scope.getBackups(),$backupUploadSelect.val(null),helpers.UI.playSound("success")},1500)}},UIkit.uploadSelect($backupUploadSelect,settings),$scope.checkTools(),$scope.getBackups(),$scope.getDeletedTickets()},0)},$scope.backupFiles=[],$scope.loadingTools=!0,$scope.checkTools=function(){$http.get("/api/v1/backup/hastools").then(function(res){$scope.hasTools=res.data&&res.data.success},function(){$scope.hasTools=!1}).then(function(){$scope.loadingTools=!1,$scope.showNoTools=!$scope.loading&&!$scope.hasTools})},$scope.getBackups=function(){$http.get("/api/v1/backups").then(function(res){res.data&&!0===res.data.success&&($scope.backupFiles=res.data.files)},function(err){$log.error(err)})},$scope.startbackup=function(e){var $button=$(e.currentTarget);$button.hide().parent().find(".uk-progress").removeClass("hide"),$http.post("/api/v1/backup").then(function(res){$log.log(res),$button.parent().find(".uk-progress").addClass("hide"),$button.show(),helpers.UI.showSnackbar("Backup completed successfully.",!1),helpers.UI.playSound("success"),$scope.getBackups()},function(err){helpers.UI.playSound("error"),helpers.UI.showSnackbar("Error: "+err,!0),$log.error(err)})},$scope.deleteBackup=function(idx){var file=$scope.backupFiles[idx];if(!file)return!1;var filename=file.filename;UIkit.modal.confirm('
Are you sure?
This action is permanent and will destroy the backup file: '+filename+"
",function(){$http.delete("/api/v1/backup/"+filename).then(function(res){$log.log(res),res.data&&res.data.success?($scope.getBackups(),helpers.UI.showSnackbar("Backup successfully deleted",!1)):helpers.UI.showSnackbar("Unable to delete backup",!0)},function(err){$log.error(err)})},{labels:{Ok:"Yes",Cancel:"No"},confirmButtonClass:"md-btn-danger"})},$scope.restoreFile=function(idx){var file=$scope.backupFiles[idx];if(!file)return!1;var filename=file.filename;UIkit.modal.confirm('
Are you sure?
This is a permanent action. All data will be wiped from the database and restored with the selected backup file: '+filename+'
Any users currently logged in will be presented with a blocking restore page. Preventing any further actions.Once complete all users are required to log in again.
This process may take a while depending on the size of the backup.
\n ',attributes:{class:"gjs-fonts gjs-f-divider"}}),a.add("text",{label:t.textBlkLabel,category:t.categoryLabel,attributes:{class:"gjs-fonts gjs-f-text"},content:{type:"text",content:"Insert your text here",style:{padding:"10px"},activeOnRender:1}}),a.add("text-sect",{label:t.textSectionBlkLabel,category:t.categoryLabel,content:'
Insert title here
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
"},scrollToTopOnError:!0,dateFormat:"yyyy-mm-dd",addValidClassOnAll:!1,decimalSeparator:".",inputParentClassOnError:"has-error",inputParentClassOnSuccess:"has-success",validateHiddenInputs:!1,inlineErrorMessageCallback:!1,submitErrorMessageCallback:!1}},validators:{},_events:{load:[],valid:[],invalid:[]},haltValidation:!1,isValidatingEntireForm:!1,addValidator:function(validator){var name=0===validator.name.indexOf("validate_")?validator.name:"validate_"+validator.name;void 0===validator.validateOnKeyUp&&(validator.validateOnKeyUp=!0),this.validators[name]=validator},warn:function(msg){"console"in window?"function"==typeof window.console.warn?window.console.warn(msg):"function"==typeof window.console.log&&window.console.log(msg):alert(msg)},getValue:function(query,$parent){var $inputs=$parent?$parent.find(query):query;if($inputs.length>0){var type=$inputs.eq(0).attr("type");return"radio"===type||"checkbox"===type?$inputs.filter(":checked").val():$inputs.val()}return!1},validateInput:function($elem,language,conf,$form,eventContext){conf=conf||$.formUtils.defaultConfig(),language=language||$.formUtils.LANG;var value=this.getValue($elem);$elem.valAttr("skipped",!1).one("beforeValidation",function(){($elem.attr("disabled")||!$elem.is(":visible")&&!conf.validateHiddenInputs)&&$elem.valAttr("skipped",1)}).trigger("beforeValidation",[value,conf,language]);var inputIsOptional="true"===$elem.valAttr("optional"),skipBecauseItsEmpty=!value&&inputIsOptional,validationRules=$elem.attr(conf.validationRuleAttribute),isValid=!0,errorMsg="",result={isValid:!0,shouldChangeDisplay:!0,errorMsg:""};if(!validationRules||skipBecauseItsEmpty||$elem.valAttr("skipped"))return result.shouldChangeDisplay=conf.addValidClassOnAll,result;var ignore=$elem.valAttr("ignore");return ignore&&$.each(ignore.split(""),function(i,char){value=value.replace(new RegExp("\\"+char),"")}),$.split(validationRules,function(rule){0!==rule.indexOf("validate_")&&(rule="validate_"+rule);var validator=$.formUtils.validators[rule];if(!validator)throw new Error('Using undefined validator "'+rule+'". Maybe you have forgotten to load the module that "'+rule+'" belongs to?');if("validate_checkbox_group"===rule&&($elem=$form.find('[name="'+$elem.attr("name")+'"]:eq(0)')),("keyup"!==eventContext||validator.validateOnKeyUp)&&(isValid=validator.validatorFunction(value,$elem,conf,language,$form)),!isValid)return errorMsg=$.formUtils.dialogs.resolveErrorMessage($elem,validator,rule,conf,language),!1}," "),!1===isValid?($elem.trigger("validation",!1),result.errorMsg=errorMsg,result.isValid=!1,result.shouldChangeDisplay=!0):null===isValid?result.shouldChangeDisplay=!1:($elem.trigger("validation",!0),result.shouldChangeDisplay=!0),"function"==typeof conf.onElementValidate&&null!==errorMsg&&conf.onElementValidate(result.isValid,$elem,$form,errorMsg),$elem.trigger("afterValidation",[result,eventContext]),result},parseDate:function(val,dateFormat,addMissingLeadingZeros){var matches,day,month,year,divider=dateFormat.replace(/[a-zA-Z]/gi,"").substring(0,1),regexp="^",formatParts=dateFormat.split(divider||null);if($.each(formatParts,function(i,part){regexp+=(i>0?"\\"+divider:"")+"(\\d{"+part.length+"})"}),regexp+="$",addMissingLeadingZeros){var newValueParts=[];$.each(val.split(divider),function(i,part){1===part.length&&(part="0"+part),newValueParts.push(part)}),val=newValueParts.join(divider)}if(null===(matches=val.match(new RegExp(regexp))))return!1;var findDateUnit=function(unit,formatParts,matches){for(var i=0;i28&&(year%4!=0||year%100==0&&year%400!=0)||2===month&&day>29&&(year%4==0||year%100!=0&&year%400==0)||month>12||0===month)&&!(this.isShortMonth(month)&&day>30||!this.isShortMonth(month)&&day>31||0===day)&&[year,month,day]},parseDateInt:function(val){return 0===val.indexOf("0")&&(val=val.replace("0","")),parseInt(val,10)},isShortMonth:function(m){return m%2==0&&m<7||m%2!=0&&m>7},lengthRestriction:function($inputElement,$maxLengthElement){var maxChars=parseInt($maxLengthElement.text(),10),charsLeft=0,countCharacters=function(){var numChars=$inputElement.val().length;if(numChars>maxChars){var currScrollTopPos=$inputElement.scrollTop();$inputElement.val($inputElement.val().substring(0,maxChars)),$inputElement.scrollTop(currScrollTopPos)}(charsLeft=maxChars-numChars)<0&&(charsLeft=0),$maxLengthElement.text(charsLeft)};$($inputElement).bind("keydown keyup keypress focus blur",countCharacters).bind("cut paste",function(){setTimeout(countCharacters,100)}),$(document).bind("ready",countCharacters)},numericRangeCheck:function(value,rangeAllowed){var range=$.split(rangeAllowed),minmax=parseInt(rangeAllowed.substr(3),10);return 1===range.length&&-1===rangeAllowed.indexOf("min")&&-1===rangeAllowed.indexOf("max")&&(range=[rangeAllowed,rangeAllowed]),2===range.length&&(valueparseInt(range[1],10))?["out",range[0],range[1]]:0===rangeAllowed.indexOf("min")&&valueminmax?["max",minmax]:["ok"]},_numSuggestionElements:0,_selectedSuggestion:null,_previousTypedVal:null,suggest:function($elem,suggestions,settings){var conf={css:{maxHeight:"150px",background:"#FFF",lineHeight:"150%",textDecoration:"underline",overflowX:"hidden",overflowY:"auto",border:"#CCC solid 1px",borderTop:"none",cursor:"pointer"},activeSuggestionCSS:{background:"#E9E9E9"}},setSuggsetionPosition=function($suggestionContainer,$input){var offset=$input.offset();$suggestionContainer.css({width:$input.outerWidth(),left:offset.left+"px",top:offset.top+$input.outerHeight()+"px"})};settings&&$.extend(conf,settings),conf.css.position="absolute",conf.css["z-index"]=9999,$elem.attr("autocomplete","off"),0===this._numSuggestionElements&&$win.bind("resize",function(){$(".jquery-form-suggestions").each(function(){var $container=$(this),suggestID=$container.attr("data-suggest-container");setSuggsetionPosition($container,$(".suggestions-"+suggestID).eq(0))})}),this._numSuggestionElements++;var onSelectSuggestion=function($el){var suggestionId=$el.valAttr("suggestion-nr");$.formUtils._selectedSuggestion=null,$.formUtils._previousTypedVal=null,$(".jquery-form-suggestion-"+suggestionId).fadeOut("fast")};return $elem.data("suggestions",suggestions).valAttr("suggestion-nr",this._numSuggestionElements).unbind("focus.suggest").bind("focus.suggest",function(){$(this).trigger("keyup"),$.formUtils._selectedSuggestion=null}).unbind("keyup.suggest").bind("keyup.suggest",function(){var $input=$(this),foundSuggestions=[],val=$.trim($input.val()).toLocaleLowerCase();if(val!==$.formUtils._previousTypedVal){$.formUtils._previousTypedVal=val;var hasTypedSuggestion=!1,suggestionId=$input.valAttr("suggestion-nr"),$suggestionContainer=$(".jquery-form-suggestion-"+suggestionId);if($suggestionContainer.scrollTop(0),""!==val){var findPartial=val.length>2;$.each($input.data("suggestions"),function(i,suggestion){var lowerCaseVal=suggestion.toLocaleLowerCase();if(lowerCaseVal===val)return foundSuggestions.push(""+suggestion+""),hasTypedSuggestion=!0,!1;(0===lowerCaseVal.indexOf(val)||findPartial&&lowerCaseVal.indexOf(val)>-1)&&foundSuggestions.push(suggestion.replace(new RegExp(val,"gi"),"$&"))})}hasTypedSuggestion||0===foundSuggestions.length&&$suggestionContainer.length>0?$suggestionContainer.hide():foundSuggestions.length>0&&0===$suggestionContainer.length?($suggestionContainer=$("").css(conf.css).appendTo("body"),$elem.addClass("suggestions-"+suggestionId),$suggestionContainer.attr("data-suggest-container",suggestionId).addClass("jquery-form-suggestions").addClass("jquery-form-suggestion-"+suggestionId)):foundSuggestions.length>0&&!$suggestionContainer.is(":visible")&&$suggestionContainer.show(),foundSuggestions.length>0&&val.length!==foundSuggestions[0].length&&(setSuggsetionPosition($suggestionContainer,$input),$suggestionContainer.html(""),$.each(foundSuggestions,function(i,text){$("").append(text).css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"5px"}).addClass("form-suggest-element").appendTo($suggestionContainer).click(function(){$input.focus(),$input.val($(this).text()),$input.trigger("change"),onSelectSuggestion($input)})}))}}).unbind("keydown.validation").bind("keydown.validation",function(e){var suggestionId,$suggestionContainer,code=e.keyCode?e.keyCode:e.which,$input=$(this);if(13===code&&null!==$.formUtils._selectedSuggestion){if(suggestionId=$input.valAttr("suggestion-nr"),($suggestionContainer=$(".jquery-form-suggestion-"+suggestionId)).length>0){var newText=$suggestionContainer.find("div").eq($.formUtils._selectedSuggestion).text();$input.val(newText),$input.trigger("change"),onSelectSuggestion($input),e.preventDefault()}}else{suggestionId=$input.valAttr("suggestion-nr");var $suggestions=($suggestionContainer=$(".jquery-form-suggestion-"+suggestionId)).children();if($suggestions.length>0&&$.inArray(code,[38,40])>-1){38===code?(null===$.formUtils._selectedSuggestion?$.formUtils._selectedSuggestion=$suggestions.length-1:$.formUtils._selectedSuggestion--,$.formUtils._selectedSuggestion<0&&($.formUtils._selectedSuggestion=$suggestions.length-1)):40===code&&(null===$.formUtils._selectedSuggestion?$.formUtils._selectedSuggestion=0:$.formUtils._selectedSuggestion++,$.formUtils._selectedSuggestion>$suggestions.length-1&&($.formUtils._selectedSuggestion=0));var containerInnerHeight=$suggestionContainer.innerHeight(),containerScrollTop=$suggestionContainer.scrollTop(),suggestionHeight=$suggestionContainer.children().eq(0).outerHeight(),activeSuggestionPosY=suggestionHeight*$.formUtils._selectedSuggestion;return(activeSuggestionPosYcontainerScrollTop+containerInnerHeight)&&$suggestionContainer.scrollTop(activeSuggestionPosY),$suggestions.removeClass("active-suggestion").css("background","none").eq($.formUtils._selectedSuggestion).addClass("active-suggestion").css(conf.activeSuggestionCSS),e.preventDefault(),!1}}}).unbind("blur.suggest").bind("blur.suggest",function(){onSelectSuggestion($(this))}),$elem},LANG:{errorTitle:"Form submission failed!",requiredField:"This is a required field",requiredFields:"You have not answered all required fields",badTime:"You have not given a correct time",badEmail:"You have not given a correct e-mail address",badTelephone:"You have not given a correct phone number",badSecurityAnswer:"You have not given a correct answer to the security question",badDate:"You have not given a correct date",lengthBadStart:"The input value must be between ",lengthBadEnd:" characters",lengthTooLongStart:"The input value is longer than ",lengthTooShortStart:"The input value is shorter than ",notConfirmed:"Input values could not be confirmed",badDomain:"Incorrect domain value",badUrl:"The input value is not a correct URL",badCustomVal:"The input value is incorrect",andSpaces:" and spaces ",badInt:"The input value was not a correct number",badSecurityNumber:"Your social security number was incorrect",badUKVatAnswer:"Incorrect UK VAT Number",badUKNin:"Incorrect UK NIN",badUKUtr:"Incorrect UK UTR Number",badStrength:"The password isn't strong enough",badNumberOfSelectedOptionsStart:"You have to choose at least ",badNumberOfSelectedOptionsEnd:" answers",badAlphaNumeric:"The input value can only contain alphanumeric characters ",badAlphaNumericExtra:" and ",wrongFileSize:"The file you are trying to upload is too large (max %s)",wrongFileType:"Only files of type %s is allowed",groupCheckedRangeStart:"Please choose between ",groupCheckedTooFewStart:"Please choose at least ",groupCheckedTooManyStart:"Please choose a maximum of ",groupCheckedEnd:" item(s)",badCreditCard:"The credit card number is not correct",badCVV:"The CVV number was not correct",wrongFileDim:"Incorrect image dimensions,",imageTooTall:"the image can not be taller than",imageTooWide:"the image can not be wider than",imageTooSmall:"the image was too small",min:"min",max:"max",imageRatioNotAccepted:"Image ratio is not be accepted",badBrazilTelephoneAnswer:"The phone number entered is invalid",badBrazilCEPAnswer:"The CEP entered is invalid",badBrazilCPFAnswer:"The CPF entered is invalid",badPlPesel:"The PESEL entered is invalid",badPlNip:"The NIP entered is invalid",badPlRegon:"The REGON entered is invalid",badreCaptcha:"Please confirm that you are not a bot"}})}(jQuery,window),($=jQuery).formUtils.addValidator({name:"email",validatorFunction:function(email){var emailParts=email.toLowerCase().split("@"),localPart=emailParts[0],domain=emailParts[1];if(localPart&&domain){if(0===localPart.indexOf('"')){var len=localPart.length;if((localPart=localPart.replace(/\"/g,"")).length!==len-2)return!1}return $.formUtils.validators.validate_domain.validatorFunction(emailParts[1])&&0!==localPart.indexOf(".")&&"."!==localPart.substring(localPart.length-1,localPart.length)&&-1===localPart.indexOf("..")&&!/[^\w\+\.\-\#\-\_\~\!\$\&\'\(\)\*\+\,\;\=\:]/.test(localPart)}return!1},errorMessage:"",errorMessageKey:"badEmail"}),$.formUtils.addValidator({name:"domain",validatorFunction:function(val){return val.length>0&&val.length<=253&&!/[^a-zA-Z0-9]/.test(val.slice(-2))&&!/[^a-zA-Z0-9]/.test(val.substr(0,1))&&!/[^a-zA-Z0-9\.\-]/.test(val)&&1===val.split("..").length&&val.split(".").length>1},errorMessage:"",errorMessageKey:"badDomain"}),$.formUtils.addValidator({name:"required",validatorFunction:function(val,$el,config,language,$form){switch($el.attr("type")){case"checkbox":return $el.is(":checked");case"radio":return $form.find('input[name="'+$el.attr("name")+'"]').filter(":checked").length>0;default:return""!==$.trim(val)}},errorMessage:"",errorMessageKey:function(config){return"top"===config.errorMessagePosition||"function"==typeof config.errorMessagePosition?"requiredFields":"requiredField"}}),$.formUtils.addValidator({name:"length",validatorFunction:function(val,$el,conf,lang){var lengthAllowed=$el.valAttr("length"),type=$el.attr("type");if(void 0===lengthAllowed)return alert('Please add attribute "data-validation-length" to '+$el[0].nodeName+" named "+$el.attr("name")),!0;var checkResult,len="file"===type&&void 0!==$el.get(0).files?$el.get(0).files.length:val.length,lengthCheckResults=$.formUtils.numericRangeCheck(len,lengthAllowed);switch(lengthCheckResults[0]){case"out":this.errorMessage=lang.lengthBadStart+lengthAllowed+lang.lengthBadEnd,checkResult=!1;break;case"min":this.errorMessage=lang.lengthTooShortStart+lengthCheckResults[1]+lang.lengthBadEnd,checkResult=!1;break;case"max":this.errorMessage=lang.lengthTooLongStart+lengthCheckResults[1]+lang.lengthBadEnd,checkResult=!1;break;default:checkResult=!0}return checkResult},errorMessage:"",errorMessageKey:""}),$.formUtils.addValidator({name:"url",validatorFunction:function(url){if(/^(https?|ftp):\/\/((((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])(\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])(\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|\[|\]|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(url)){var domain=url.split("://")[1],domainSlashPos=domain.indexOf("/");return domainSlashPos>-1&&(domain=domain.substr(0,domainSlashPos)),$.formUtils.validators.validate_domain.validatorFunction(domain)}return!1},errorMessage:"",errorMessageKey:"badUrl"}),$.formUtils.addValidator({name:"number",validatorFunction:function(val,$el,conf){if(""!==val){var begin,end,allowing=$el.valAttr("allowing")||"",decimalSeparator=$el.valAttr("decimal-separator")||conf.decimalSeparator,allowsRange=!1,steps=$el.valAttr("step")||"",allowsSteps=!1,sanitize=$el.attr("data-sanitize")||"",isFormattedWithNumeral=sanitize.match(/(^|[\s])numberFormat([\s]|$)/i);if(isFormattedWithNumeral){if(!window.numeral)throw new ReferenceError("The data-sanitize value numberFormat cannot be used without the numeral library. Please see Data Validation in http://www.formvalidator.net for more information.");val.length&&(val=String(numeral().unformat(val)))}if(-1===allowing.indexOf("number")&&(allowing+=",number"),-1===allowing.indexOf("negative")&&0===val.indexOf("-"))return!1;if(allowing.indexOf("range")>-1&&(begin=parseFloat(allowing.substring(allowing.indexOf("[")+1,allowing.indexOf(";"))),end=parseFloat(allowing.substring(allowing.indexOf(";")+1,allowing.indexOf("]"))),allowsRange=!0),""!==steps&&(allowsSteps=!0),","===decimalSeparator){if(val.indexOf(".")>-1)return!1;val=val.replace(",",".")}if(""===val.replace(/[0-9-]/g,"")&&(!allowsRange||val>=begin&&val<=end)&&(!allowsSteps||val%steps==0))return!0;if(allowing.indexOf("float")>-1&&null!==val.match(new RegExp("^([0-9-]+)\\.([0-9]+)$"))&&(!allowsRange||val>=begin&&val<=end)&&(!allowsSteps||val%steps==0))return!0}return!1},errorMessage:"",errorMessageKey:"badInt"}),$.formUtils.addValidator({name:"alphanumeric",validatorFunction:function(val,$el,conf,language){var additionalChars=$el.valAttr("allowing"),pattern="";if(additionalChars){pattern="^([a-zA-Z0-9"+additionalChars+"]+)$";var extra=additionalChars.replace(/\\/g,"");extra.indexOf(" ")>-1&&(extra=extra.replace(" ",""),extra+=language.andSpaces||$.formUtils.LANG.andSpaces),this.errorMessage=language.badAlphaNumeric+language.badAlphaNumericExtra+extra}else pattern="^([a-zA-Z0-9]+)$",this.errorMessage=language.badAlphaNumeric;return new RegExp(pattern).test(val)},errorMessage:"",errorMessageKey:""}),$.formUtils.addValidator({name:"custom",validatorFunction:function(val,$el){var regexp=new RegExp($el.valAttr("regexp"));return regexp.test(val)},errorMessage:"",errorMessageKey:"badCustomVal"}),$.formUtils.addValidator({name:"date",validatorFunction:function(date,$el,conf){var dateFormat=$el.valAttr("format")||conf.dateFormat||"yyyy-mm-dd",addMissingLeadingZeros="false"===$el.valAttr("require-leading-zero");return!1!==$.formUtils.parseDate(date,dateFormat,addMissingLeadingZeros)},errorMessage:"",errorMessageKey:"badDate"}),$.formUtils.addValidator({name:"checkbox_group",validatorFunction:function(val,$el,conf,lang,$form){var isValid=!0,elname=$el.attr("name"),$checkBoxes=$('input[type=checkbox][name^="'+elname+'"]',$form),checkedCount=$checkBoxes.filter(":checked").length,qtyAllowed=$el.valAttr("qty");if(void 0===qtyAllowed){var elementType=$el.get(0).nodeName;alert('Attribute "data-validation-qty" is missing from '+elementType+" named "+$el.attr("name"))}var qtyCheckResults=$.formUtils.numericRangeCheck(checkedCount,qtyAllowed);switch(qtyCheckResults[0]){case"out":this.errorMessage=lang.groupCheckedRangeStart+qtyAllowed+lang.groupCheckedEnd,isValid=!1;break;case"min":this.errorMessage=lang.groupCheckedTooFewStart+qtyCheckResults[1]+lang.groupCheckedEnd,isValid=!1;break;case"max":this.errorMessage=lang.groupCheckedTooManyStart+qtyCheckResults[1]+lang.groupCheckedEnd,isValid=!1;break;default:isValid=!0}if(!isValid){var _triggerOnBlur=function(){$checkBoxes.unbind("click",_triggerOnBlur),$checkBoxes.filter("*[data-validation]").validateInputOnBlur(lang,conf,!1,"blur")};$checkBoxes.bind("click",_triggerOnBlur)}return isValid}}),void $.formUtils.addValidator({name:"confirmation",validatorFunction:function(value,$el,config,language,$form){var password,passwordInputName=$el.valAttr("confirm")||$el.attr("name")+"_confirmation",$passwordInput=$form.find('[name="'+passwordInputName+'"]');if(!$passwordInput.length)return $.formUtils.warn('Password confirmation validator: could not find an input with name "'+passwordInputName+'"',!0),!1;if(password=$passwordInput.val(),config.validateOnBlur&&!$passwordInput[0].hasValidationCallback){$passwordInput[0].hasValidationCallback=!0;var keyUpCallback=function(){$el.validate()};$passwordInput.on("keyup",keyUpCallback),$form.one("formValidationSetup",function(){$passwordInput[0].hasValidationCallback=!1,$passwordInput.off("keyup",keyUpCallback)})}return value===password},errorMessage:"",errorMessageKey:"notConfirmed"});var jQuery,$}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)},function(module,exports,__webpack_require__){(function(__webpack_provided_window_dot_jQuery,jQuery){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__,a;/*! VelocityJS.org (1.2.3). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
-/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */!function(a){function b(a){var b=a.length,d=c.type(a);return"function"!==d&&!c.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===d||0===b||"number"==typeof b&&b>0&&b-1 in a))}if(!__webpack_provided_window_dot_jQuery){var c=function(a,b){return new c.fn.init(a,b)};c.isWindow=function(a){return null!=a&&a==a.window},c.type=function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?e[g.call(a)]||"object":typeof a},c.isArray=Array.isArray||function(a){return"array"===c.type(a)},c.isPlainObject=function(a){var b;if(!a||"object"!==c.type(a)||a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!f.call(a,"constructor")&&!f.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}for(b in a);return void 0===b||f.call(a,b)},c.each=function(a,c,d){var f=0,g=a.length,h=b(a);if(d){if(h)for(;g>f&&!1!==c.apply(a[f],d);f++);else for(f in a)if(!1===c.apply(a[f],d))break}else if(h)for(;g>f&&!1!==c.call(a[f],f,a[f]);f++);else for(f in a)if(!1===c.call(a[f],f,a[f]))break;return a},c.data=function(a,b,e){if(void 0===e){var g=(f=a[c.expando])&&d[f];if(void 0===b)return g;if(g&&b in g)return g[b]}else if(void 0!==b){var f=a[c.expando]||(a[c.expando]=++c.uuid);return d[f]=d[f]||{},d[f][b]=e,e}},c.removeData=function(a,b){var e=a[c.expando],f=e&&d[e];f&&c.each(b,function(a,b){delete f[b]})},c.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[i]||{},i++),"object"!=typeof h&&"function"!==c.type(h)&&(h={}),i===j&&(h=this,i--);j>i;i++)if(null!=(f=arguments[i]))for(e in f)a=h[e],h!==(d=f[e])&&(k&&d&&(c.isPlainObject(d)||(b=c.isArray(d)))?(b?(b=!1,g=a&&c.isArray(a)?a:[]):g=a&&c.isPlainObject(a)?a:{},h[e]=c.extend(k,g,d)):void 0!==d&&(h[e]=d));return h},c.queue=function(a,d,e){if(a){d=(d||"fx")+"queue";var g=c.data(a,d);return e?(!g||c.isArray(e)?g=c.data(a,d,function(a,c){var d=c||[];return null!=a&&(b(Object(a))?function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;)a[e++]=b[d++];if(c!=c)for(;void 0!==b[d];)a[e++]=b[d++];a.length=e}(d,"string"==typeof a?[a]:a):[].push.call(d,a)),d}(e)):g.push(e),g):g||[]}},c.dequeue=function(a,b){c.each(a.nodeType?[a]:a,function(a,d){b=b||"fx";var e=c.queue(d,b),f=e.shift();"inprogress"===f&&(f=e.shift()),f&&("fx"===b&&e.unshift("inprogress"),f.call(d,function(){c.dequeue(d,b)}))})},c.fn=c.prototype={init:function(a){if(a.nodeType)return this[0]=a,this;throw new Error("Not a DOM node.")},offset:function(){var b=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:b.top+(a.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:b.left+(a.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function a(){for(var a=this.offsetParent||document;a&&"html"===!a.nodeType.toLowerCase&&"static"===a.style.position;)a=a.offsetParent;return a||document}var b=this[0],a=a.apply(b),d=this.offset(),e=/^(?:body|html)$/i.test(a.nodeName)?{top:0,left:0}:c(a).offset();return d.top-=parseFloat(b.style.marginTop)||0,d.left-=parseFloat(b.style.marginLeft)||0,a.style&&(e.top+=parseFloat(a.style.borderTopWidth)||0,e.left+=parseFloat(a.style.borderLeftWidth)||0),{top:d.top-e.top,left:d.left-e.left}}};var d={};c.expando="velocity"+(new Date).getTime(),c.uuid=0;for(var e={},f=e.hasOwnProperty,g=e.toString,h="Boolean Number String Function Array Date RegExp Object Error".split(" "),i=0;ie;++e){var f=j(c,a,d);if(0===f)return c;c-=(i(c,a,d)-b)/f}return c}function m(b,c,e){var f,g,h=0;do{(f=i(g=c+(e-c)/2,a,d)-b)>0?e=g:c=g}while(Math.abs(f)>r&&++hb;++b)x[b]=i(b*u,a,d)}()}var p=4,q=.001,r=1e-7,s=10,t=11,u=1/(t-1),v="Float32Array"in b;if(4!==arguments.length)return!1;for(var w=0;4>w;++w)if("number"!=typeof arguments[w]||isNaN(arguments[w])||!isFinite(arguments[w]))return!1;a=Math.min(a,1),d=Math.min(d,1),a=Math.max(a,0),d=Math.max(d,0);var x=v?new Float32Array(t):new Array(t),y=!1,z=function(b){return y||o(),a===c&&d===e?b:0===b?0:1===b?1:i(function(b){for(var c=0,e=1,f=t-1;e!=f&&x[e]<=b;++e)c+=u;var h=c+(b-x[--e])/(x[e+1]-x[e])*u,i=j(h,a,d);return i>=q?k(b,h):0==i?h:m(b,c,c+u)}(b),c,e)};z.getControlPoints=function(){return[{x:a,y:c},{x:d,y:e}]};var A="generateBezier("+[a,c,d,e]+")";return z.toString=function(){return A},z}function j(a,b){var c=a;return p.isString(a)?t.Easings[a]||(c=!1):c=p.isArray(a)&&1===a.length?function(a){return function(b){return Math.round(b*a)*(1/a)}}.apply(null,a):p.isArray(a)&&2===a.length?u.apply(null,a.concat([b])):!(!p.isArray(a)||4!==a.length)&&i.apply(null,a),!1===c&&(c=t.Easings[t.defaults.easing]?t.defaults.easing:s),c}function k(a){if(a){var b=(new Date).getTime(),c=t.State.calls.length;c>1e4&&(t.State.calls=function(a){for(var b=-1,c=a?a.length:0,d=[];++bf;f++)if(t.State.calls[f]){var h=t.State.calls[f],i=h[0],j=h[2],n=h[3],o=!!n,q=null;n||(n=t.State.calls[f][3]=b-16);for(var r=Math.min((b-n)/j.duration,1),s=0,u=i.length;u>s;s++){var w=i[s],y=w.element;if(g(y)){var z=!1;if(j.display!==d&&null!==j.display&&"none"!==j.display){if("flex"===j.display){m.each(["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"],function(a,b){v.setPropertyValue(y,"display",b)})}v.setPropertyValue(y,"display",j.display)}for(var B in j.visibility!==d&&"hidden"!==j.visibility&&v.setPropertyValue(y,"visibility",j.visibility),w)if("element"!==B){var C,D=w[B],E=p.isString(D.easing)?t.Easings[D.easing]:D.easing;if(1===r)C=D.endValue;else{var F=D.endValue-D.startValue;if(C=D.startValue+F*E(r,j,F),!o&&C===D.currentValue)continue}if(D.currentValue=C,"tween"===B)q=C;else{if(v.Hooks.registered[B]){var G=v.Hooks.getRoot(B),H=g(y).rootPropertyValueCache[G];H&&(D.rootPropertyValue=H)}var I=v.setPropertyValue(y,B,D.currentValue+(0===parseFloat(C)?"":D.unitType),D.rootPropertyValue,D.scrollData);v.Hooks.registered[B]&&(g(y).rootPropertyValueCache[G]=v.Normalizations.registered[G]?v.Normalizations.registered[G]("extract",null,I[1]):I[1]),"transform"===I[0]&&(z=!0)}}j.mobileHA&&g(y).transformCache.translate3d===d&&(g(y).transformCache.translate3d="(0px, 0px, 0px)",z=!0),z&&v.flushTransformCache(y)}}j.display!==d&&"none"!==j.display&&(t.State.calls[f][2].display=!1),j.visibility!==d&&"hidden"!==j.visibility&&(t.State.calls[f][2].visibility=!1),j.progress&&j.progress.call(h[1],h[1],r,Math.max(0,n+j.duration-b),n,q),1===r&&l(f)}}t.State.isTicking&&x(k)}function l(a,b){if(!t.State.calls[a])return!1;for(var c=t.State.calls[a][0],e=t.State.calls[a][1],f=t.State.calls[a][2],h=t.State.calls[a][4],i=!1,j=0,k=c.length;k>j;j++){var l=c[j].element;if(b||f.loop||("none"===f.display&&v.setPropertyValue(l,"display",f.display),"hidden"===f.visibility&&v.setPropertyValue(l,"visibility",f.visibility)),!0!==f.loop&&(m.queue(l)[1]===d||!/\.velocityQueueEntryFlag/i.test(m.queue(l)[1]))&&g(l)){g(l).isAnimating=!1,g(l).rootPropertyValueCache={};var n=!1;m.each(v.Lists.transforms3D,function(a,b){var c=/^scale/.test(b)?1:0,e=g(l).transformCache[b];g(l).transformCache[b]!==d&&new RegExp("^\\("+c+"[^.]").test(e)&&(n=!0,delete g(l).transformCache[b])}),f.mobileHA&&(n=!0,delete g(l).transformCache.translate3d),n&&v.flushTransformCache(l),v.Values.removeClass(l,"velocity-animating")}if(!b&&f.complete&&!f.loop&&j===k-1)try{f.complete.call(e,e)}catch(o){setTimeout(function(){throw o},1)}h&&!0!==f.loop&&h(e),g(l)&&!0===f.loop&&!b&&(m.each(g(l).tweensContainer,function(a,b){/^rotate/.test(a)&&360===parseFloat(b.endValue)&&(b.endValue=0,b.startValue=360),/^backgroundPosition/.test(a)&&100===parseFloat(b.endValue)&&"%"===b.unitType&&(b.endValue=0,b.startValue=100)}),t(l,"reverse",{loop:!0,delay:f.delay})),!1!==f.queue&&m.dequeue(l,f.queue)}t.State.calls[a]=!1;for(var p=0,q=t.State.calls.length;q>p;p++)if(!1!==t.State.calls[p]){i=!0;break}!1===i&&(t.State.isTicking=!1,delete t.State.calls,t.State.calls=[])}var m,n=function(){if(c.documentMode)return c.documentMode;for(var a=7;a>4;a--){var b=c.createElement("div");if(b.innerHTML="\x3c!--[if IE "+a+"]>0)},isWrapped:function(a){return a&&(a.jquery||b.Zepto&&b.Zepto.zepto.isZ(a))},isSVG:function(a){return b.SVGElement&&a instanceof b.SVGElement},isEmptyObject:function(a){for(var b in a)return!1;return!0}},q=!1;if(a.fn&&a.fn.jquery?(m=a,q=!0):m=b.Velocity.Utilities,8>=n&&!q)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(!(7>=n)){var r=400,s="swing",t={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:b.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:c.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:m,Redirects:{},Easings:{},Promise:b.Promise,defaults:{queue:"",duration:r,easing:s,begin:d,complete:d,progress:d,display:d,visibility:d,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(a){m.data(a,"velocity",{isSVG:p.isSVG(a),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};b.pageYOffset!==d?(t.State.scrollAnchor=b,t.State.scrollPropertyLeft="pageXOffset",t.State.scrollPropertyTop="pageYOffset"):(t.State.scrollAnchor=c.documentElement||c.body.parentNode||c.body,t.State.scrollPropertyLeft="scrollLeft",t.State.scrollPropertyTop="scrollTop");var u=function(){function a(a){return-a.tension*a.x-a.friction*a.v}function b(b,c,d){var e={x:b.x+d.dx*c,v:b.v+d.dv*c,tension:b.tension,friction:b.friction};return{dx:e.v,dv:a(e)}}function c(c,d){var e={dx:c.v,dv:a(c)},f=b(c,.5*d,e),g=b(c,.5*d,f),h=b(c,d,g),i=1/6*(e.dx+2*(f.dx+g.dx)+h.dx),j=1/6*(e.dv+2*(f.dv+g.dv)+h.dv);return c.x=c.x+i*d,c.v=c.v+j*d,c}return function d(a,b,e){var f,g,h,i={x:-1,v:0,tension:null,friction:null},j=[0],k=0;for(a=parseFloat(a)||500,b=parseFloat(b)||20,e=e||null,i.tension=a,i.friction=b,(f=null!==e)?g=(k=d(a,b))/e*.016:g=.016;h=c(h||i,g),j.push(1+h.x),k+=16,Math.abs(h.x)>1e-4&&Math.abs(h.v)>1e-4;);return f?function(a){return j[a*(j.length-1)|0]}:k}}();t.Easings={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},spring:function(a){return 1-Math.cos(4.5*a*Math.PI)*Math.exp(6*-a)}},m.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(a,b){t.Easings[b[0]]=i.apply(null,b[1])});var v=t.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var a=0;a=n)switch(a){case"name":return"filter";case"extract":var d=c.toString().match(/alpha\(opacity=(.*)\)/i);return d?d[1]/100:1;case"inject":return b.style.zoom=1,parseFloat(c)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(c),10)+")"}else switch(a){case"name":return"opacity";case"extract":case"inject":return c}}},register:function(){9>=n||t.State.isGingerbread||(v.Lists.transformsBase=v.Lists.transformsBase.concat(v.Lists.transforms3D));for(var a=0;ae&&(e=1),f=!/(\d)$/i.test(e);break;case"skew":f=!/(deg|\d)$/i.test(e);break;case"rotate":f=!/(deg|\d)$/i.test(e)}return f||(g(c).transformCache[b]="("+e+")"),g(c).transformCache[b]}}}();for(a=0;a=n||3!==f.split(" ").length||(f+=" 1"),f;case"inject":return 8>=n?4===e.split(" ").length&&(e=e.split(/\s+/).slice(0,3).join(" ")):3===e.split(" ").length&&(e+=" 1"),(8>=n?"rgb":"rgba")+"("+e.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(a){return a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()})},SVGAttribute:function(a){var b="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(n||t.State.isAndroid&&!t.State.isChrome)&&(b+="|transform"),new RegExp("^("+b+")$","i").test(a)},prefixCheck:function(a){if(t.State.prefixMatches[a])return[t.State.prefixMatches[a],!0];for(var b=["","Webkit","Moz","ms","O"],c=0,d=b.length;d>c;c++){var e;if(e=0===c?a:b[c]+a.replace(/^\w/,function(a){return a.toUpperCase()}),p.isString(t.State.prefixElement.style[e]))return t.State.prefixMatches[a]=e,[e,!0]}return[a,!1]}},Values:{hexToRgb:function(a){var b;return a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,d){return b+b+c+c+d+d}),(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]:[0,0,0]},isCSSNullValue:function(a){return 0==a||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(a)},getUnitType:function(a){return/^(rotate|skew)/i.test(a)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(a)?"":"px"},getDisplayType:function(a){var b=a&&a.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(b)?"inline":/^(li)$/i.test(b)?"list-item":/^(tr)$/i.test(b)?"table-row":/^(table)$/i.test(b)?"table":/^(tbody)$/i.test(b)?"table-row-group":"block"},addClass:function(a,b){a.classList?a.classList.add(b):a.className+=(a.className.length?" ":"")+b},removeClass:function(a,b){a.classList?a.classList.remove(b):a.className=a.className.toString().replace(new RegExp("(^|\\s)"+b.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(a,c,e,f){function h(a,c){function e(){j&&v.setPropertyValue(a,"display","none")}var i=0;if(8>=n)i=m.css(a,c);else{var o,j=!1;if(/^(width|height)$/.test(c)&&0===v.getPropertyValue(a,"display")&&(j=!0,v.setPropertyValue(a,"display",v.Values.getDisplayType(a))),!f){if("height"===c&&"border-box"!==v.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var k=a.offsetHeight-(parseFloat(v.getPropertyValue(a,"borderTopWidth"))||0)-(parseFloat(v.getPropertyValue(a,"borderBottomWidth"))||0)-(parseFloat(v.getPropertyValue(a,"paddingTop"))||0)-(parseFloat(v.getPropertyValue(a,"paddingBottom"))||0);return e(),k}if("width"===c&&"border-box"!==v.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var l=a.offsetWidth-(parseFloat(v.getPropertyValue(a,"borderLeftWidth"))||0)-(parseFloat(v.getPropertyValue(a,"borderRightWidth"))||0)-(parseFloat(v.getPropertyValue(a,"paddingLeft"))||0)-(parseFloat(v.getPropertyValue(a,"paddingRight"))||0);return e(),l}}o=g(a)===d?b.getComputedStyle(a,null):g(a).computedStyle?g(a).computedStyle:g(a).computedStyle=b.getComputedStyle(a,null),"borderColor"===c&&(c="borderTopColor"),(""===(i=9===n&&"filter"===c?o.getPropertyValue(c):o[c])||null===i)&&(i=a.style[c]),e()}if("auto"===i&&/^(top|right|bottom|left)$/i.test(c)){var p=h(a,"position");("fixed"===p||"absolute"===p&&/top|left/i.test(c))&&(i=m(a).position()[c]+"px")}return i}var i;if(v.Hooks.registered[c]){var j=c,k=v.Hooks.getRoot(j);e===d&&(e=v.getPropertyValue(a,v.Names.prefixCheck(k)[0])),v.Normalizations.registered[k]&&(e=v.Normalizations.registered[k]("extract",a,e)),i=v.Hooks.extractValue(j,e)}else if(v.Normalizations.registered[c]){var l,o;"transform"!==(l=v.Normalizations.registered[c]("name",a))&&(o=h(a,v.Names.prefixCheck(l)[0]),v.Values.isCSSNullValue(o)&&v.Hooks.templates[c]&&(o=v.Hooks.templates[c][1])),i=v.Normalizations.registered[c]("extract",a,o)}if(!/^[\d-]/.test(i))if(g(a)&&g(a).isSVG&&v.Names.SVGAttribute(c))if(/^(height|width)$/i.test(c))try{i=a.getBBox()[c]}catch(p){i=0}else i=a.getAttribute(c);else i=h(a,v.Names.prefixCheck(c)[0]);return v.Values.isCSSNullValue(i)&&(i=0),t.debug>=2&&console.log("Get "+c+": "+i),i},setPropertyValue:function(a,c,d,e,f){var h=c;if("scroll"===c)f.container?f.container["scroll"+f.direction]=d:"Left"===f.direction?b.scrollTo(d,f.alternateValue):b.scrollTo(f.alternateValue,d);else if(v.Normalizations.registered[c]&&"transform"===v.Normalizations.registered[c]("name",a))v.Normalizations.registered[c]("inject",a,d),h="transform",d=g(a).transformCache[c];else{if(v.Hooks.registered[c]){var i=c,j=v.Hooks.getRoot(c);e=e||v.getPropertyValue(a,j),d=v.Hooks.injectValue(i,d,e),c=j}if(v.Normalizations.registered[c]&&(d=v.Normalizations.registered[c]("inject",a,d),c=v.Normalizations.registered[c]("name",a)),h=v.Names.prefixCheck(c)[0],8>=n)try{a.style[h]=d}catch(k){t.debug&&console.log("Browser does not support ["+d+"] for ["+h+"]")}else g(a)&&g(a).isSVG&&v.Names.SVGAttribute(c)?a.setAttribute(c,d):a.style[h]=d;t.debug>=2&&console.log("Set "+c+" ("+h+"): "+d)}return[h,d]},flushTransformCache:function(a){function b(b){return parseFloat(v.getPropertyValue(a,b))}var c="";if((n||t.State.isAndroid&&!t.State.isChrome)&&g(a).isSVG){var d={translate:[b("translateX"),b("translateY")],skewX:[b("skewX")],skewY:[b("skewY")],scale:1!==b("scale")?[b("scale"),b("scale")]:[b("scaleX"),b("scaleY")],rotate:[b("rotateZ"),0,0]};m.each(g(a).transformCache,function(a){/^translate/i.test(a)?a="translate":/^scale/i.test(a)?a="scale":/^rotate/i.test(a)&&(a="rotate"),d[a]&&(c+=a+"("+d[a].join(" ")+") ",delete d[a])})}else{var e,f;m.each(g(a).transformCache,function(b){return e=g(a).transformCache[b],"transformPerspective"===b?(f=e,!0):(9===n&&"rotateZ"===b&&(b="rotate"),void(c+=b+e+" "))}),f&&(c="perspective"+f+" "+c)}v.setPropertyValue(a,"transform",c)}};v.Hooks.register(),v.Normalizations.register(),t.hook=function(a,b,c){var e=d;return a=f(a),m.each(a,function(a,f){if(g(f)===d&&t.init(f),c===d)e===d&&(e=t.CSS.getPropertyValue(f,b));else{var h=t.CSS.setPropertyValue(f,b,c);"transform"===h[0]&&t.CSS.flushTransformCache(f),e=h}}),e};var w=function(){function a(){return h?B.promise||null:i}function e(){function a(){function a(a,b){var c=d,e=d,g=d;return p.isArray(a)?(c=a[0],!p.isArray(a[1])&&/^[\d-]/.test(a[1])||p.isFunction(a[1])||v.RegEx.isHex.test(a[1])?g=a[1]:(p.isString(a[1])&&!v.RegEx.isHex.test(a[1])||p.isArray(a[1]))&&(e=b?a[1]:j(a[1],h.duration),a[2]!==d&&(g=a[2]))):c=a,b||(e=e||h.easing),p.isFunction(c)&&(c=c.call(f,y,x)),p.isFunction(g)&&(g=g.call(f,y,x)),[c||0,e,g]}function l(a,b){var c,d;return d=(b||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(a){return c=a,""}),c||(c=v.Values.getUnitType(a)),[d,c]}function n(){var a={myParent:f.parentNode||c.body,position:v.getPropertyValue(f,"position"),fontSize:v.getPropertyValue(f,"fontSize")},d=a.position===I.lastPosition&&a.myParent===I.lastParent,e=a.fontSize===I.lastFontSize;I.lastParent=a.myParent,I.lastPosition=a.position,I.lastFontSize=a.fontSize;var h=100,i={};if(e&&d)i.emToPx=I.lastEmToPx,i.percentToPxWidth=I.lastPercentToPxWidth,i.percentToPxHeight=I.lastPercentToPxHeight;else{var j=g(f).isSVG?c.createElementNS("http://www.w3.org/2000/svg","rect"):c.createElement("div");t.init(j),a.myParent.appendChild(j),m.each(["overflow","overflowX","overflowY"],function(a,b){t.CSS.setPropertyValue(j,b,"hidden")}),t.CSS.setPropertyValue(j,"position",a.position),t.CSS.setPropertyValue(j,"fontSize",a.fontSize),t.CSS.setPropertyValue(j,"boxSizing","content-box"),m.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(a,b){t.CSS.setPropertyValue(j,b,h+"%")}),t.CSS.setPropertyValue(j,"paddingLeft",h+"em"),i.percentToPxWidth=I.lastPercentToPxWidth=(parseFloat(v.getPropertyValue(j,"width",null,!0))||1)/h,i.percentToPxHeight=I.lastPercentToPxHeight=(parseFloat(v.getPropertyValue(j,"height",null,!0))||1)/h,i.emToPx=I.lastEmToPx=(parseFloat(v.getPropertyValue(j,"paddingLeft"))||1)/h,a.myParent.removeChild(j)}return null===I.remToPx&&(I.remToPx=parseFloat(v.getPropertyValue(c.body,"fontSize"))||16),null===I.vwToPx&&(I.vwToPx=parseFloat(b.innerWidth)/100,I.vhToPx=parseFloat(b.innerHeight)/100),i.remToPx=I.remToPx,i.vwToPx=I.vwToPx,i.vhToPx=I.vhToPx,t.debug>=1&&console.log("Unit ratios: "+JSON.stringify(i),f),i}if(h.begin&&0===y)try{h.begin.call(o,o)}catch(r){setTimeout(function(){throw r},1)}if("scroll"===C){var u,w,z,A=/^x$/i.test(h.axis)?"Left":"Top",D=parseFloat(h.offset)||0;h.container?p.isWrapped(h.container)||p.isNode(h.container)?(h.container=h.container[0]||h.container,z=(u=h.container["scroll"+A])+m(f).position()[A.toLowerCase()]+D):h.container=null:(u=t.State.scrollAnchor[t.State["scrollProperty"+A]],w=t.State.scrollAnchor[t.State["scrollProperty"+("Left"===A?"Top":"Left")]],z=m(f).offset()[A.toLowerCase()]+D),i={scroll:{rootPropertyValue:!1,startValue:u,currentValue:u,endValue:z,unitType:"",easing:h.easing,scrollData:{container:h.container,direction:A,alternateValue:w}},element:f},t.debug&&console.log("tweensContainer (scroll): ",i.scroll,f)}else if("reverse"===C){if(!g(f).tweensContainer)return void m.dequeue(f,h.queue);"none"===g(f).opts.display&&(g(f).opts.display="auto"),"hidden"===g(f).opts.visibility&&(g(f).opts.visibility="visible"),g(f).opts.loop=!1,g(f).opts.begin=null,g(f).opts.complete=null,s.easing||delete h.easing,s.duration||delete h.duration,h=m.extend({},g(f).opts,h);var E=m.extend(!0,{},g(f).tweensContainer);for(var F in E)if("element"!==F){var G=E[F].startValue;E[F].startValue=E[F].currentValue=E[F].endValue,E[F].endValue=G,p.isEmptyObject(s)||(E[F].easing=h.easing),t.debug&&console.log("reverse tweensContainer ("+F+"): "+JSON.stringify(E[F]),f)}i=E}else if("start"===C){for(var H in g(f).tweensContainer&&!0===g(f).isAnimating&&(E=g(f).tweensContainer),m.each(q,function(b,c){if(RegExp("^"+v.Lists.colors.join("$|^")+"$").test(b)){var e=a(c,!0),f=e[0],g=e[1],h=e[2];if(v.RegEx.isHex.test(f)){for(var i=["Red","Green","Blue"],j=v.Values.hexToRgb(f),k=h?v.Values.hexToRgb(h):d,l=0;lL;L++){var M={delay:E.delay,progress:E.progress};L===K-1&&(M.display=E.display,M.visibility=E.visibility,M.complete=E.complete),w(o,"reverse",M)}return a()}};(t=m.extend(w,t)).animate=w;var x=b.requestAnimationFrame||o;return t.State.isMobile||c.hidden===d||c.addEventListener("visibilitychange",function(){c.hidden?(x=function(a){return setTimeout(function(){a(!0)},16)},k()):x=b.requestAnimationFrame||o}),a.Velocity=t,a!==b&&(a.fn.velocity=w,a.fn.velocity.defaults=t.defaults),m.each(["Down","Up"],function(a,b){t.Redirects["slide"+b]=function(a,c,e,f,g,h){var i=m.extend({},c),j=i.begin,k=i.complete,l={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},n={};i.display===d&&(i.display="Down"===b?"inline"===t.CSS.Values.getDisplayType(a)?"inline-block":"block":"none"),i.begin=function(){for(var c in j&&j.call(g,g),l){n[c]=a.style[c];var d=t.CSS.getPropertyValue(a,c);l[c]="Down"===b?[d,0]:[0,d]}n.overflow=a.style.overflow,a.style.overflow="hidden"},i.complete=function(){for(var b in n)a.style[b]=n[b];k&&k.call(g,g),h&&h.resolver(g)},t(a,l,i)}}),m.each(["In","Out"],function(a,b){t.Redirects["fade"+b]=function(a,c,e,f,g,h){var i=m.extend({},c),j={opacity:"In"===b?1:0},k=i.complete;i.complete=e!==f-1?i.begin=null:function(){k&&k.call(g,g),h&&h.resolver(g)},i.display===d&&(i.display="In"===b?"auto":"none"),t(this,j,i)}}),t}jQuery.fn.velocity=jQuery.fn.animate}(__webpack_provided_window_dot_jQuery||window.Zepto||window,window,document)},"object"==typeof module.exports?module.exports=a():void 0===(__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof(__WEBPACK_AMD_DEFINE_FACTORY__=a)?__WEBPACK_AMD_DEFINE_FACTORY__.call(exports,__webpack_require__,exports,module):__WEBPACK_AMD_DEFINE_FACTORY__)||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)}).call(this,__webpack_require__(0),__webpack_require__(0))},function(module,exports,__webpack_require__){(function(jQuery){var k,w,h,v,d,x,o,q,y;k=jQuery,w=document,h=Math,d=k.fn.peity=function(a,b){return y&&this.each(function(){var e=k(this),c=e.data("_peity");c?(a&&(c.type=a),k.extend(c.opts,b)):(c=new x(e,a,k.extend({},d.defaults[a],e.data("peity"),b)),e.change(function(){c.draw()}).data("_peity",c)),c.draw()}),this},o=(x=function(a,b,e){this.$el=a,this.type=b,this.opts=e}).prototype,q=o.svgElement=function(a,b){return k(w.createElementNS("http://www.w3.org/2000/svg",a)).attr(b)},y="createElementNS"in w&&q("svg",{})[0].createSVGRect,o.draw=function(){var a=this.opts;d.graphers[this.type].call(this,a),a.after&&a.after.call(this,a)},o.fill=function(){var a=this.opts.fill;return k.isFunction(a)?a:function(b,e){return a[e%a.length]}},o.prepare=function(a,b){return this.$svg||this.$el.hide().after(this.$svg=q("svg",{class:"peity"})),this.$svg.empty().data("peity",this).attr({height:b,width:a})},o.values=function(){return k.map(this.$el.text().split(this.opts.delimiter),function(a){return parseFloat(a)})},d.defaults={},d.graphers={},d.register=function(a,b,e){this.defaults[a]=b,this.graphers[a]=e},d.register("pie",{fill:["#ff9900","#fff4dd","#ffc66e"],radius:8},function(a){if(!a.delimiter){var b=this.$el.text().match(/[^0-9\.]/);a.delimiter=b?b[0]:","}b=k.map(this.values(),function(a){return 0i?n=s(h.min(e,0)):p=s(h.max(c,0)):o=1,0==(o=p-n)&&(o=1,0",{class:"ms-container"}),this.$selectableContainer=$("",{class:"ms-selectable"}),this.$selectionContainer=$("",{class:"ms-selection"}),this.$selectableUl=$("
'+item.comment+'