function UploadManager(t){var e=this;e.dropContainer=t.dropContainer,e.inputField=t.inputField,e.cancelContainer=t.cancelContainer,e.uploadsQueue=[],e._xhrs=[],e.activeUploads=0,e.data=t.data,e.key=t.key,e.maxSimultaneousUploads=t.maxSimultaneousUploads||-1,e.onFileAdded=t.onFileAdded||noop,e.uploadUrl=t.uploadUrl,e.onFileAddedProxy=function(t){console.log("Event: onFileAdded, file: "+t.fileName),e.onFileAdded(t)},e.initialize()}function FileUpload(t){var e=this;e.file=t,e.fileName=t.name,e.fileSize=t.size,e.uploadSize=t.size,e.uploadedBytes=0,e.eventHandlers={},e.events={onProgress:function(t,n){var i=n/t*100;console.log("Event: upload onProgress, progress = "+i+", fileSize = "+t+", uploadedBytes = "+n),(e.eventHandlers.onProgress||noop)(i,t,n)},onStart:function(){console.log("Event: upload onStart"),(e.eventHandlers.onStart||noop)()},onAborted:function(){console.log("Event: upload onAborted"),(e.eventHandlers.onAborted||noop)()},onCompleted:function(n){console.log("Event: upload onCompleted, data = "+n),t=null,(e.eventHandlers.onCompleted||noop)(n)},onError:function(t){console.log("Event: upload error, message: "+t),(e.eventHandlers.onError||noop)(t)}}}function isMobile(t){t||(t={});let e=t.ua;if(e||"undefined"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&"string"==typeof e.headers["user-agent"]&&(e=e.headers["user-agent"]),"string"!=typeof e)return!1;let n=mobileRE.test(e)&&!notMobileRE.test(e)||!!t.tablet&&tabletRE.test(e);return!n&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf("Macintosh")&&-1!==e.indexOf("Safari")&&(n=!0),n}function __(t){return t}function escapeRegExp(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function difference(t,e,n=0,i=10){t=t||{},e=e||{};var s={};return n>i||_.uniq(Object.keys(t).concat(Object.keys(e))).forEach((function(r){if(r in t&&r in e)if(_.isObject(t[r])&&!_.isArray(t[r])&&_.isObject(e[r])&&!_.isArray(e[r])){var o=difference(t[r],e[r],n+1,i);_.isEmpty(o)||(s[r]=o)}else _.isEqual(t[r],e[r])||(s[r]=e[r]);else s[r]=e[r]})),s}function byteLength(t){for(var e=t.length,n=t.length-1;n>=0;n--){var i=t.charCodeAt(n);i>127&&i<=2047?e++:i>2047&&i<=65535&&(e+=2),i>=56320&&i<=57343&&n--}return e}function clone(t,e){if(!t)return t;var n=t.constructor.name;void 0===n&&(_.isArray(t)?n="Array":_.isNumber(t)?n="Number":_.isString(t)?n="String":_.isBoolean(t)?n="Boolean":_.isFunction(t)?n="Function":_.isObject(t)&&(n="Object"));var i,s=["Object","Number","String","Boolean","Array"];if(e&&s.push("Function"),n&&!_.contains(s,n))return console.log("no acceptedInstances",n,t),void console.trace();if("Array"==n)i=[],t.forEach((function(t,n){i[n]=clone(t,e)}));else if("Function"==n)i=t.bind({});else if("Object"==n)for(var r in i={},t)t.hasOwnProperty(r)&&(i[r]=clone(t[r],e));else i=t;return i}function underscored(t){return t.trim().replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function toCamelCase(t){return t.replace(/\s(.)/g,(function(t){return t.toUpperCase()})).replace(/\s/g,"").replace(/^(.)/,(function(t){return t.toUpperCase()}))}function isRetina(){if(window.matchMedia){var t=window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen  and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");return t&&t.matches||window.devicePixelRatio>1}}!function(t,e){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,(function(t,e){"use strict";function n(t,e,n){var i,s,r=(n=n||wt).createElement("script");if(r.text=t,e)for(i in kt)(s=e[i]||e.getAttribute&&e.getAttribute(i))&&r.setAttribute(i,s);n.head.appendChild(r).parentNode.removeChild(r)}function i(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?dt[ft.call(t)]||"object":typeof t}function s(t){var e=!!t&&"length"in t&&t.length,n=i(t);return!bt(t)&&!_t(t)&&("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function r(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}function o(t,e,n){return bt(e)?Ct.grep(t,(function(t,i){return!!e.call(t,i,t)!==n})):e.nodeType?Ct.grep(t,(function(t){return t===e!==n})):"string"!=typeof e?Ct.grep(t,(function(t){return ht.call(e,t)>-1!==n})):Ct.filter(e,t,n)}function a(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function l(t){var e={};return Ct.each(t.match(Nt)||[],(function(t,n){e[n]=!0})),e}function c(t){return t}function u(t){throw t}function p(t,e,n,i){var s;try{t&&bt(s=t.promise)?s.call(t).done(e).fail(n):t&&bt(s=t.then)?s.call(t,e,n):e.apply(void 0,[t].slice(i))}catch(t){n.apply(void 0,[t])}}function h(){wt.removeEventListener("DOMContentLoaded",h),t.removeEventListener("load",h),Ct.ready()}function d(t,e){return e.toUpperCase()}function f(t){return t.replace(Ft,"ms-").replace($t,d)}function m(){this.expando=Ct.expando+m.uid++}function g(t){return"true"===t||"false"!==t&&("null"===t?null:t===+t+""?+t:qt.test(t)?JSON.parse(t):t)}function v(t,e,n){var i;if(void 0===n&&1===t.nodeType)if(i="data-"+e.replace(Wt,"-$&").toLowerCase(),"string"==typeof(n=t.getAttribute(i))){try{n=g(n)}catch(t){}Ut.set(t,e,n)}else n=void 0;return n}function y(t,e,n,i){var s,r,o=20,a=i?function(){return i.cur()}:function(){return Ct.css(t,e,"")},l=a(),c=n&&n[3]||(Ct.cssNumber[e]?"":"px"),u=t.nodeType&&(Ct.cssNumber[e]||"px"!==c&&+l)&&Jt.exec(Ct.css(t,e));if(u&&u[3]!==c){for(l/=2,c=c||u[3],u=+l||1;o--;)Ct.style(t,e,u+c),(1-r)*(1-(r=a()/l||.5))<=0&&(o=0),u/=r;u*=2,Ct.style(t,e,u+c),n=n||[]}return n&&(u=+u||+l||0,s=n[1]?u+(n[1]+1)*n[2]:+n[2],i&&(i.unit=c,i.start=u,i.end=s)),s}function b(t){var e,n=t.ownerDocument,i=t.nodeName,s=Zt[i];return s||(e=n.body.appendChild(n.createElement(i)),s=Ct.css(e,"display"),e.parentNode.removeChild(e),"none"===s&&(s="block"),Zt[i]=s,s)}function _(t,e){for(var n,i,s=[],r=0,o=t.length;r<o;r++)(i=t[r]).style&&(n=i.style.display,e?("none"===n&&(s[r]=zt.get(i,"display")||null,s[r]||(i.style.display="")),""===i.style.display&&Xt(i)&&(s[r]=b(i))):"none"!==n&&(s[r]="none",zt.set(i,"display",n)));for(r=0;r<o;r++)null!=s[r]&&(t[r].style.display=s[r]);return t}function w(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&r(t,e)?Ct.merge([t],n):n}function k(t,e){for(var n=0,i=t.length;n<i;n++)zt.set(t[n],"globalEval",!e||zt.get(e[n],"globalEval"))}function A(t,e,n,s,r){for(var o,a,l,c,u,p,h=e.createDocumentFragment(),d=[],f=0,m=t.length;f<m;f++)if((o=t[f])||0===o)if("object"===i(o))Ct.merge(d,o.nodeType?[o]:o);else if(re.test(o)){for(a=a||h.appendChild(e.createElement("div")),l=(ne.exec(o)||["",""])[1].toLowerCase(),c=se[l]||se._default,a.innerHTML=c[1]+Ct.htmlPrefilter(o)+c[2],p=c[0];p--;)a=a.lastChild;Ct.merge(d,a.childNodes),(a=h.firstChild).textContent=""}else d.push(e.createTextNode(o));for(h.textContent="",f=0;o=d[f++];)if(s&&Ct.inArray(o,s)>-1)r&&r.push(o);else if(u=Kt(o),a=w(h.appendChild(o),"script"),u&&k(a),n)for(p=0;o=a[p++];)ie.test(o.type||"")&&n.push(o);return h}function C(){return!0}function T(){return!1}function S(t,e){return t===x()==("focus"===e)}function x(){try{return wt.activeElement}catch(t){}}function j(t,e,n,i,s,r){var o,a;if("object"==typeof e){for(a in"string"!=typeof n&&(i=i||n,n=void 0),e)j(t,a,n,i,e[a],r);return t}if(null==i&&null==s?(s=n,i=n=void 0):null==s&&("string"==typeof n?(s=i,i=void 0):(s=i,i=n,n=void 0)),!1===s)s=T;else if(!s)return t;return 1===r&&(o=s,s=function(t){return Ct().off(t),o.apply(this,arguments)},s.guid=o.guid||(o.guid=Ct.guid++)),t.each((function(){Ct.event.add(this,e,s,i,n)}))}function D(t,e,n){n?(zt.set(t,e,!1),Ct.event.add(t,e,{namespace:!1,handler:function(t){var i,s,r=zt.get(this,e);if(1&t.isTrigger&&this[e]){if(r.length)(Ct.event.special[e]||{}).delegateType&&t.stopPropagation();else if(r=ct.call(arguments),zt.set(this,e,r),i=n(this,e),this[e](),r!==(s=zt.get(this,e))||i?zt.set(this,e,!1):s={},r!==s)return t.stopImmediatePropagation(),t.preventDefault(),s&&s.value}else r.length&&(zt.set(this,e,{value:Ct.event.trigger(Ct.extend(r[0],Ct.Event.prototype),r.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===zt.get(t,e)&&Ct.event.add(t,e,C)}function P(t,e){return r(t,"table")&&r(11!==e.nodeType?e:e.firstChild,"tr")&&Ct(t).children("tbody")[0]||t}function E(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function I(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function O(t,e){var n,i,s,r,o,a;if(1===e.nodeType){if(zt.hasData(t)&&(a=zt.get(t).events))for(s in zt.remove(e,"handle events"),a)for(n=0,i=a[s].length;n<i;n++)Ct.event.add(e,s,a[s][n]);Ut.hasData(t)&&(r=Ut.access(t),o=Ct.extend({},r),Ut.set(e,o))}}function N(t,e){var n=e.nodeName.toLowerCase();"input"===n&&ee.test(t.type)?e.checked=t.checked:"input"!==n&&"textarea"!==n||(e.defaultValue=t.defaultValue)}function M(t,e,i,s){e=ut(e);var r,o,a,l,c,u,p=0,h=t.length,d=h-1,f=e[0],m=bt(f);if(m||h>1&&"string"==typeof f&&!yt.checkClone&&le.test(f))return t.each((function(n){var r=t.eq(n);m&&(e[0]=f.call(this,n,r.html())),M(r,e,i,s)}));if(h&&(o=(r=A(e,t[0].ownerDocument,!1,t,s)).firstChild,1===r.childNodes.length&&(r=o),o||s)){for(l=(a=Ct.map(w(r,"script"),E)).length;p<h;p++)c=r,p!==d&&(c=Ct.clone(c,!0,!0),l&&Ct.merge(a,w(c,"script"))),i.call(t[p],c,p);if(l)for(u=a[a.length-1].ownerDocument,Ct.map(a,I),p=0;p<l;p++)c=a[p],ie.test(c.type||"")&&!zt.access(c,"globalEval")&&Ct.contains(u,c)&&(c.src&&"module"!==(c.type||"").toLowerCase()?Ct._evalUrl&&!c.noModule&&Ct._evalUrl(c.src,{nonce:c.nonce||c.getAttribute("nonce")},u):n(c.textContent.replace(ce,""),c,u))}return t}function R(t,e,n){for(var i,s=e?Ct.filter(e,t):t,r=0;null!=(i=s[r]);r++)n||1!==i.nodeType||Ct.cleanData(w(i)),i.parentNode&&(n&&Kt(i)&&k(w(i,"script")),i.parentNode.removeChild(i));return t}function L(t,e,n){var i,s,r,o,a=t.style;return(n=n||pe(t))&&(""!==(o=n.getPropertyValue(e)||n[e])||Kt(t)||(o=Ct.style(t,e)),!yt.pixelBoxStyles()&&ue.test(o)&&de.test(e)&&(i=a.width,s=a.minWidth,r=a.maxWidth,a.minWidth=a.maxWidth=a.width=o,o=n.width,a.width=i,a.minWidth=s,a.maxWidth=r)),void 0!==o?o+"":o}function F(t,e){return{get:function(){if(!t())return(this.get=e).apply(this,arguments);delete this.get}}}function $(t){for(var e=t[0].toUpperCase()+t.slice(1),n=fe.length;n--;)if((t=fe[n]+e)in me)return t}function B(t){var e=Ct.cssProps[t]||ge[t];return e||(t in me?t:ge[t]=$(t)||t)}function z(t,e,n){var i=Jt.exec(e);return i?Math.max(0,i[2]-(n||0))+(i[3]||"px"):e}function U(t,e,n,i,s,r){var o="width"===e?1:0,a=0,l=0;if(n===(i?"border":"content"))return 0;for(;o<4;o+=2)"margin"===n&&(l+=Ct.css(t,n+Vt[o],!0,s)),i?("content"===n&&(l-=Ct.css(t,"padding"+Vt[o],!0,s)),"margin"!==n&&(l-=Ct.css(t,"border"+Vt[o]+"Width",!0,s))):(l+=Ct.css(t,"padding"+Vt[o],!0,s),"padding"!==n?l+=Ct.css(t,"border"+Vt[o]+"Width",!0,s):a+=Ct.css(t,"border"+Vt[o]+"Width",!0,s));return!i&&r>=0&&(l+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-r-l-a-.5))||0),l}function q(t,e,n){var i=pe(t),s=(!yt.boxSizingReliable()||n)&&"border-box"===Ct.css(t,"boxSizing",!1,i),o=s,a=L(t,e,i),l="offset"+e[0].toUpperCase()+e.slice(1);if(ue.test(a)){if(!n)return a;a="auto"}return(!yt.boxSizingReliable()&&s||!yt.reliableTrDimensions()&&r(t,"tr")||"auto"===a||!parseFloat(a)&&"inline"===Ct.css(t,"display",!1,i))&&t.getClientRects().length&&(s="border-box"===Ct.css(t,"boxSizing",!1,i),(o=l in t)&&(a=t[l])),(a=parseFloat(a)||0)+U(t,e,n||(s?"border":"content"),o,i,a)+"px"}function W(t,e,n,i,s){return new W.prototype.init(t,e,n,i,s)}function H(){ke&&(!1===wt.hidden&&t.requestAnimationFrame?t.requestAnimationFrame(H):t.setTimeout(H,Ct.fx.interval),Ct.fx.tick())}function J(){return t.setTimeout((function(){we=void 0})),we=Date.now()}function V(t,e){var n,i=0,s={height:t};for(e=e?1:0;i<4;i+=2-e)s["margin"+(n=Vt[i])]=s["padding"+n]=t;return e&&(s.opacity=s.width=t),s}function G(t,e,n){for(var i,s=(X.tweeners[e]||[]).concat(X.tweeners["*"]),r=0,o=s.length;r<o;r++)if(i=s[r].call(n,e,t))return i}function K(t,e,n){var i,s,r,o,a,l,c,u,p="width"in e||"height"in e,h=this,d={},f=t.style,m=t.nodeType&&Xt(t),g=zt.get(t,"fxshow");for(i in n.queue||(null==(o=Ct._queueHooks(t,"fx")).unqueued&&(o.unqueued=0,a=o.empty.fire,o.empty.fire=function(){o.unqueued||a()}),o.unqueued++,h.always((function(){h.always((function(){o.unqueued--,Ct.queue(t,"fx").length||o.empty.fire()}))}))),e)if(s=e[i],Ae.test(s)){if(delete e[i],r=r||"toggle"===s,s===(m?"hide":"show")){if("show"!==s||!g||void 0===g[i])continue;m=!0}d[i]=g&&g[i]||Ct.style(t,i)}if((l=!Ct.isEmptyObject(e))||!Ct.isEmptyObject(d))for(i in p&&1===t.nodeType&&(n.overflow=[f.overflow,f.overflowX,f.overflowY],null==(c=g&&g.display)&&(c=zt.get(t,"display")),"none"===(u=Ct.css(t,"display"))&&(c?u=c:(_([t],!0),c=t.style.display||c,u=Ct.css(t,"display"),_([t]))),("inline"===u||"inline-block"===u&&null!=c)&&"none"===Ct.css(t,"float")&&(l||(h.done((function(){f.display=c})),null==c&&(u=f.display,c="none"===u?"":u)),f.display="inline-block")),n.overflow&&(f.overflow="hidden",h.always((function(){f.overflow=n.overflow[0],f.overflowX=n.overflow[1],f.overflowY=n.overflow[2]}))),l=!1,d)l||(g?"hidden"in g&&(m=g.hidden):g=zt.access(t,"fxshow",{display:c}),r&&(g.hidden=!m),m&&_([t],!0),h.done((function(){for(i in m||_([t]),zt.remove(t,"fxshow"),d)Ct.style(t,i,d[i])}))),l=G(m?g[i]:0,i,h),i in g||(g[i]=l.start,m&&(l.end=l.start,l.start=0))}function Y(t,e){var n,i,s,r,o;for(n in t)if(s=e[i=f(n)],r=t[n],Array.isArray(r)&&(s=r[1],r=t[n]=r[0]),n!==i&&(t[i]=r,delete t[n]),(o=Ct.cssHooks[i])&&"expand"in o)for(n in r=o.expand(r),delete t[i],r)n in t||(t[n]=r[n],e[n]=s);else e[i]=s}function X(t,e,n){var i,s,r=0,o=X.prefilters.length,a=Ct.Deferred().always((function(){delete l.elem})),l=function(){if(s)return!1;for(var e=we||J(),n=Math.max(0,c.startTime+c.duration-e),i=1-(n/c.duration||0),r=0,o=c.tweens.length;r<o;r++)c.tweens[r].run(i);return a.notifyWith(t,[c,i,n]),i<1&&o?n:(o||a.notifyWith(t,[c,1,0]),a.resolveWith(t,[c]),!1)},c=a.promise({elem:t,props:Ct.extend({},e),opts:Ct.extend(!0,{specialEasing:{},easing:Ct.easing._default},n),originalProperties:e,originalOptions:n,startTime:we||J(),duration:n.duration,tweens:[],createTween:function(e,n){var i=Ct.Tween(t,c.opts,e,n,c.opts.specialEasing[e]||c.opts.easing);return c.tweens.push(i),i},stop:function(e){var n=0,i=e?c.tweens.length:0;if(s)return this;for(s=!0;n<i;n++)c.tweens[n].run(1);return e?(a.notifyWith(t,[c,1,0]),a.resolveWith(t,[c,e])):a.rejectWith(t,[c,e]),this}}),u=c.props;for(Y(u,c.opts.specialEasing);r<o;r++)if(i=X.prefilters[r].call(c,t,u,c.opts))return bt(i.stop)&&(Ct._queueHooks(c.elem,c.opts.queue).stop=i.stop.bind(i)),i;return Ct.map(u,G,c),bt(c.opts.start)&&c.opts.start.call(t,c),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always),Ct.fx.timer(Ct.extend(l,{elem:t,anim:c,queue:c.opts.queue})),c}function Z(t){return(t.match(Nt)||[]).join(" ")}function Q(t){return t.getAttribute&&t.getAttribute("class")||""}function tt(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(Nt)||[]}function et(t,e,n,s){var r;if(Array.isArray(e))Ct.each(e,(function(e,i){n||Me.test(t)?s(t,i):et(t+"["+("object"==typeof i&&null!=i?e:"")+"]",i,n,s)}));else if(n||"object"!==i(e))s(t,e);else for(r in e)et(t+"["+r+"]",e[r],n,s)}function nt(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var i,s=0,r=e.toLowerCase().match(Nt)||[];if(bt(n))for(;i=r[s++];)"+"===i[0]?(i=i.slice(1)||"*",(t[i]=t[i]||[]).unshift(n)):(t[i]=t[i]||[]).push(n)}}function it(t,e,n,i){function s(a){var l;return r[a]=!0,Ct.each(t[a]||[],(function(t,a){var c=a(e,n,i);return"string"!=typeof c||o||r[c]?o?!(l=c):void 0:(e.dataTypes.unshift(c),s(c),!1)})),l}var r={},o=t===Ve;return s(e.dataTypes[0])||!r["*"]&&s("*")}function st(t,e){var n,i,s=Ct.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((s[n]?t:i||(i={}))[n]=e[n]);return i&&Ct.extend(!0,t,i),t}function rt(t,e,n){for(var i,s,r,o,a=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){l.unshift(s);break}if(l[0]in n)r=l[0];else{for(s in n){if(!l[0]||t.converters[s+" "+l[0]]){r=s;break}o||(o=s)}r=r||o}if(r)return r!==l[0]&&l.unshift(r),n[r]}function ot(t,e,n,i){var s,r,o,a,l,c={},u=t.dataTypes.slice();if(u[1])for(o in t.converters)c[o.toLowerCase()]=t.converters[o];for(r=u.shift();r;)if(t.responseFields[r]&&(n[t.responseFields[r]]=e),!l&&i&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=r,r=u.shift())if("*"===r)r=l;else if("*"!==l&&l!==r){if(!(o=c[l+" "+r]||c["* "+r]))for(s in c)if((a=s.split(" "))[1]===r&&(o=c[l+" "+a[0]]||c["* "+a[0]])){!0===o?o=c[s]:!0!==c[s]&&(r=a[0],u.unshift(a[1]));break}if(!0!==o)if(o&&t.throws)e=o(e);else try{e=o(e)}catch(t){return{state:"parsererror",error:o?t:"No conversion from "+l+" to "+r}}}return{state:"success",data:e}}var at=[],lt=Object.getPrototypeOf,ct=at.slice,ut=at.flat?function(t){return at.flat.call(t)}:function(t){return at.concat.apply([],t)},pt=at.push,ht=at.indexOf,dt={},ft=dt.toString,mt=dt.hasOwnProperty,gt=mt.toString,vt=gt.call(Object),yt={},bt=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType&&"function"!=typeof t.item},_t=function(t){return null!=t&&t===t.window},wt=t.document,kt={type:!0,src:!0,nonce:!0,noModule:!0},At="3.6.0",Ct=function(t,e){return new Ct.fn.init(t,e)};Ct.fn=Ct.prototype={jquery:At,constructor:Ct,length:0,toArray:function(){return ct.call(this)},get:function(t){return null==t?ct.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=Ct.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return Ct.each(this,t)},map:function(t){return this.pushStack(Ct.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return this.pushStack(ct.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(Ct.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(Ct.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n<e?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:pt,sort:at.sort,splice:at.splice},Ct.extend=Ct.fn.extend=function(){var t,e,n,i,s,r,o=arguments[0]||{},a=1,l=arguments.length,c=!1;for("boolean"==typeof o&&(c=o,o=arguments[a]||{},a++),"object"==typeof o||bt(o)||(o={}),a===l&&(o=this,a--);a<l;a++)if(null!=(t=arguments[a]))for(e in t)i=t[e],"__proto__"!==e&&o!==i&&(c&&i&&(Ct.isPlainObject(i)||(s=Array.isArray(i)))?(n=o[e],r=s&&!Array.isArray(n)?[]:s||Ct.isPlainObject(n)?n:{},s=!1,o[e]=Ct.extend(c,r,i)):void 0!==i&&(o[e]=i));return o},Ct.extend({expando:"jQuery"+(At+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isPlainObject:function(t){var e,n;return!(!t||"[object Object]"!==ft.call(t))&&(!(e=lt(t))||"function"==typeof(n=mt.call(e,"constructor")&&e.constructor)&&gt.call(n)===vt)},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},globalEval:function(t,e,i){n(t,{nonce:e&&e.nonce},i)},each:function(t,e){var n,i=0;if(s(t))for(n=t.length;i<n&&!1!==e.call(t[i],i,t[i]);i++);else for(i in t)if(!1===e.call(t[i],i,t[i]))break;return t},makeArray:function(t,e){var n=e||[];return null!=t&&(s(Object(t))?Ct.merge(n,"string"==typeof t?[t]:t):pt.call(n,t)),n},inArray:function(t,e,n){return null==e?-1:ht.call(e,t,n)},merge:function(t,e){for(var n=+e.length,i=0,s=t.length;i<n;i++)t[s++]=e[i];return t.length=s,t},grep:function(t,e,n){for(var i=[],s=0,r=t.length,o=!n;s<r;s++)!e(t[s],s)!==o&&i.push(t[s]);return i},map:function(t,e,n){var i,r,o=0,a=[];if(s(t))for(i=t.length;o<i;o++)null!=(r=e(t[o],o,n))&&a.push(r);else for(o in t)null!=(r=e(t[o],o,n))&&a.push(r);return ut(a)},guid:1,support:yt}),"function"==typeof Symbol&&(Ct.fn[Symbol.iterator]=at[Symbol.iterator]),Ct.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),(function(t,e){dt["[object "+e+"]"]=e.toLowerCase()}));var Tt=function(t){function e(t,e,n,i){var s,r,o,a,l,c,u,h=e&&e.ownerDocument,f=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==f&&9!==f&&11!==f)return n;if(!i&&(I(e),e=e||O,M)){if(11!==f&&(l=bt.exec(t)))if(s=l[1]){if(9===f){if(!(o=e.getElementById(s)))return n;if(o.id===s)return n.push(o),n}else if(h&&(o=h.getElementById(s))&&$(e,o)&&o.id===s)return n.push(o),n}else{if(l[2])return Q.apply(n,e.getElementsByTagName(t)),n;if((s=l[3])&&k.getElementsByClassName&&e.getElementsByClassName)return Q.apply(n,e.getElementsByClassName(s)),n}if(k.qsa&&!V[t+" "]&&(!R||!R.test(t))&&(1!==f||"object"!==e.nodeName.toLowerCase())){if(u=t,h=e,1===f&&(pt.test(t)||ut.test(t))){for((h=_t.test(t)&&p(e.parentNode)||e)===e&&k.scope||((a=e.getAttribute("id"))?a=a.replace(At,Ct):e.setAttribute("id",a=B)),r=(c=S(t)).length;r--;)c[r]=(a?"#"+a:":scope")+" "+d(c[r]);u=c.join(",")}try{return Q.apply(n,h.querySelectorAll(u)),n}catch(e){V(t,!0)}finally{a===B&&e.removeAttribute("id")}}}return j(t.replace(lt,"$1"),e,n,i)}function n(){function t(n,i){return e.push(n+" ")>A.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function i(t){return t[B]=!0,t}function s(t){var e=O.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function r(t,e){for(var n=t.split("|"),i=n.length;i--;)A.attrHandle[n[i]]=e}function o(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function a(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function l(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function c(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&St(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function u(t){return i((function(e){return e=+e,i((function(n,i){for(var s,r=t([],n.length,e),o=r.length;o--;)n[s=r[o]]&&(n[s]=!(i[s]=n[s]))}))}))}function p(t){return t&&void 0!==t.getElementsByTagName&&t}function h(){}function d(t){for(var e=0,n=t.length,i="";e<n;e++)i+=t[e].value;return i}function f(t,e,n){var i=e.dir,s=e.next,r=s||i,o=n&&"parentNode"===r,a=q++;return e.first?function(e,n,s){for(;e=e[i];)if(1===e.nodeType||o)return t(e,n,s);return!1}:function(e,n,l){var c,u,p,h=[U,a];if(l){for(;e=e[i];)if((1===e.nodeType||o)&&t(e,n,l))return!0}else for(;e=e[i];)if(1===e.nodeType||o)if(u=(p=e[B]||(e[B]={}))[e.uniqueID]||(p[e.uniqueID]={}),s&&s===e.nodeName.toLowerCase())e=e[i]||e;else{if((c=u[r])&&c[0]===U&&c[1]===a)return h[2]=c[2];if(u[r]=h,h[2]=t(e,n,l))return!0}return!1}}function m(t){return t.length>1?function(e,n,i){for(var s=t.length;s--;)if(!t[s](e,n,i))return!1;return!0}:t[0]}function g(t,n,i){for(var s=0,r=n.length;s<r;s++)e(t,n[s],i);return i}function v(t,e,n,i,s){for(var r,o=[],a=0,l=t.length,c=null!=e;a<l;a++)(r=t[a])&&(n&&!n(r,i,s)||(o.push(r),c&&e.push(a)));return o}function y(t,e,n,s,r,o){return s&&!s[B]&&(s=y(s)),r&&!r[B]&&(r=y(r,o)),i((function(i,o,a,l){var c,u,p,h=[],d=[],f=o.length,m=i||g(e||"*",a.nodeType?[a]:a,[]),y=!t||!i&&e?m:v(m,h,t,a,l),b=n?r||(i?t:f||s)?[]:o:y;if(n&&n(y,b,a,l),s)for(c=v(b,d),s(c,[],a,l),u=c.length;u--;)(p=c[u])&&(b[d[u]]=!(y[d[u]]=p));if(i){if(r||t){if(r){for(c=[],u=b.length;u--;)(p=b[u])&&c.push(y[u]=p);r(null,b=[],c,l)}for(u=b.length;u--;)(p=b[u])&&(c=r?et(i,p):h[u])>-1&&(i[c]=!(o[c]=p))}}else b=v(b===o?b.splice(f,b.length):b),r?r(null,o,b,l):Q.apply(o,b)}))}function b(t){for(var e,n,i,s=t.length,r=A.relative[t[0].type],o=r||A.relative[" "],a=r?1:0,l=f((function(t){return t===e}),o,!0),c=f((function(t){return et(e,t)>-1}),o,!0),u=[function(t,n,i){var s=!r&&(i||n!==D)||((e=n).nodeType?l(t,n,i):c(t,n,i));return e=null,s}];a<s;a++)if(n=A.relative[t[a].type])u=[f(m(u),n)];else{if((n=A.filter[t[a].type].apply(null,t[a].matches))[B]){for(i=++a;i<s&&!A.relative[t[i].type];i++);return y(a>1&&m(u),a>1&&d(t.slice(0,a-1).concat({value:" "===t[a-2].type?"*":""})).replace(lt,"$1"),n,a<i&&b(t.slice(a,i)),i<s&&b(t=t.slice(i)),i<s&&d(t))}u.push(n)}return m(u)}function _(t,n){var s=n.length>0,r=t.length>0,o=function(i,o,a,l,c){var u,p,h,d=0,f="0",m=i&&[],g=[],y=D,b=i||r&&A.find.TAG("*",c),_=U+=null==y?1:Math.random()||.1,w=b.length;for(c&&(D=o==O||o||c);f!==w&&null!=(u=b[f]);f++){if(r&&u){for(p=0,o||u.ownerDocument==O||(I(u),a=!M);h=t[p++];)if(h(u,o||O,a)){l.push(u);break}c&&(U=_)}s&&((u=!h&&u)&&d--,i&&m.push(u))}if(d+=f,s&&f!==d){for(p=0;h=n[p++];)h(m,g,o,a);if(i){if(d>0)for(;f--;)m[f]||g[f]||(g[f]=X.call(l));g=v(g)}Q.apply(l,g),c&&!i&&g.length>0&&d+n.length>1&&e.uniqueSort(l)}return c&&(U=_,D=y),m};return s?i(o):o}var w,k,A,C,T,S,x,j,D,P,E,I,O,N,M,R,L,F,$,B="sizzle"+1*new Date,z=t.document,U=0,q=0,W=n(),H=n(),J=n(),V=n(),G=function(t,e){return t===e&&(E=!0),0},K={}.hasOwnProperty,Y=[],X=Y.pop,Z=Y.push,Q=Y.push,tt=Y.slice,et=function(t,e){for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1},nt="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",it="[\\x20\\t\\r\\n\\f]",st="(?:\\\\[\\da-fA-F]{1,6}"+it+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",rt="\\["+it+"*("+st+")(?:"+it+"*([*^$|!~]?=)"+it+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+st+"))|)"+it+"*\\]",ot=":("+st+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+rt+")*)|.*)\\)|)",at=new RegExp(it+"+","g"),lt=new RegExp("^"+it+"+|((?:^|[^\\\\])(?:\\\\.)*)"+it+"+$","g"),ct=new RegExp("^"+it+"*,"+it+"*"),ut=new RegExp("^"+it+"*([>+~]|"+it+")"+it+"*"),pt=new RegExp(it+"|>"),ht=new RegExp(ot),dt=new RegExp("^"+st+"$"),ft={ID:new RegExp("^#("+st+")"),CLASS:new RegExp("^\\.("+st+")"),TAG:new RegExp("^("+st+"|[*])"),ATTR:new RegExp("^"+rt),PSEUDO:new RegExp("^"+ot),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+it+"*(even|odd|(([+-]|)(\\d*)n|)"+it+"*(?:([+-]|)"+it+"*(\\d+)|))"+it+"*\\)|)","i"),bool:new RegExp("^(?:"+nt+")$","i"),needsContext:new RegExp("^"+it+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+it+"*((?:-\\d)?\\d*)"+it+"*\\)|)(?=[^-]|$)","i")},mt=/HTML$/i,gt=/^(?:input|select|textarea|button)$/i,vt=/^h\d$/i,yt=/^[^{]+\{\s*\[native \w/,bt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_t=/[+~]/,wt=new RegExp("\\\\[\\da-fA-F]{1,6}"+it+"?|\\\\([^\\r\\n\\f])","g"),kt=function(t,e){var n="0x"+t.slice(1)-65536;return e||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},At=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Ct=function(t,e){return e?"\0"===t?"\ufffd":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},Tt=function(){I()},St=f((function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{Q.apply(Y=tt.call(z.childNodes),z.childNodes),Y[z.childNodes.length].nodeType}catch(t){Q={apply:Y.length?function(t,e){Z.apply(t,tt.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}for(w in k=e.support={},T=e.isXML=function(t){var e=t&&t.namespaceURI,n=t&&(t.ownerDocument||t).documentElement;return!mt.test(e||n&&n.nodeName||"HTML")},I=e.setDocument=function(t){var e,n,i=t?t.ownerDocument||t:z;return i!=O&&9===i.nodeType&&i.documentElement?(N=(O=i).documentElement,M=!T(O),z!=O&&(n=O.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Tt,!1):n.attachEvent&&n.attachEvent("onunload",Tt)),k.scope=s((function(t){return N.appendChild(t).appendChild(O.createElement("div")),void 0!==t.querySelectorAll&&!t.querySelectorAll(":scope fieldset div").length})),k.attributes=s((function(t){return t.className="i",!t.getAttribute("className")})),k.getElementsByTagName=s((function(t){return t.appendChild(O.createComment("")),!t.getElementsByTagName("*").length})),k.getElementsByClassName=yt.test(O.getElementsByClassName),k.getById=s((function(t){return N.appendChild(t).id=B,!O.getElementsByName||!O.getElementsByName(B).length})),k.getById?(A.filter.ID=function(t){var e=t.replace(wt,kt);return function(t){return t.getAttribute("id")===e}},A.find.ID=function(t,e){if(void 0!==e.getElementById&&M){var n=e.getElementById(t);return n?[n]:[]}}):(A.filter.ID=function(t){var e=t.replace(wt,kt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},A.find.ID=function(t,e){if(void 0!==e.getElementById&&M){var n,i,s,r=e.getElementById(t);if(r){if((n=r.getAttributeNode("id"))&&n.value===t)return[r];for(s=e.getElementsByName(t),i=0;r=s[i++];)if((n=r.getAttributeNode("id"))&&n.value===t)return[r]}return[]}}),A.find.TAG=k.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):k.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,i=[],s=0,r=e.getElementsByTagName(t);if("*"===t){for(;n=r[s++];)1===n.nodeType&&i.push(n);return i}return r},A.find.CLASS=k.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&M)return e.getElementsByClassName(t)},L=[],R=[],(k.qsa=yt.test(O.querySelectorAll))&&(s((function(t){var e;N.appendChild(t).innerHTML="<a id='"+B+"'></a><select id='"+B+"-\r\\' msallowcapture=''><option selected=''></option></select>",t.querySelectorAll("[msallowcapture^='']").length&&R.push("[*^$]="+it+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||R.push("\\["+it+"*(?:value|"+nt+")"),t.querySelectorAll("[id~="+B+"-]").length||R.push("~="),(e=O.createElement("input")).setAttribute("name",""),t.appendChild(e),t.querySelectorAll("[name='']").length||R.push("\\["+it+"*name"+it+"*="+it+"*(?:''|\"\")"),t.querySelectorAll(":checked").length||R.push(":checked"),t.querySelectorAll("a#"+B+"+*").length||R.push(".#.+[+~]"),t.querySelectorAll("\\\f"),R.push("[\\r\\n\\f]")})),s((function(t){t.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var e=O.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&R.push("name"+it+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&R.push(":enabled",":disabled"),N.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&R.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),R.push(",.*:")}))),(k.matchesSelector=yt.test(F=N.matches||N.webkitMatchesSelector||N.mozMatchesSelector||N.oMatchesSelector||N.msMatchesSelector))&&s((function(t){k.disconnectedMatch=F.call(t,"*"),F.call(t,"[s!='']:x"),L.push("!=",ot)})),R=R.length&&new RegExp(R.join("|")),L=L.length&&new RegExp(L.join("|")),e=yt.test(N.compareDocumentPosition),$=e||yt.test(N.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},G=e?function(t,e){if(t===e)return E=!0,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n||(1&(n=(t.ownerDocument||t)==(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!k.sortDetached&&e.compareDocumentPosition(t)===n?t==O||t.ownerDocument==z&&$(z,t)?-1:e==O||e.ownerDocument==z&&$(z,e)?1:P?et(P,t)-et(P,e):0:4&n?-1:1)}:function(t,e){if(t===e)return E=!0,0;var n,i=0,s=t.parentNode,r=e.parentNode,a=[t],l=[e];if(!s||!r)return t==O?-1:e==O?1:s?-1:r?1:P?et(P,t)-et(P,e):0;if(s===r)return o(t,e);for(n=t;n=n.parentNode;)a.unshift(n);for(n=e;n=n.parentNode;)l.unshift(n);for(;a[i]===l[i];)i++;return i?o(a[i],l[i]):a[i]==z?-1:l[i]==z?1:0},O):O},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if(I(t),k.matchesSelector&&M&&!V[n+" "]&&(!L||!L.test(n))&&(!R||!R.test(n)))try{var i=F.call(t,n);if(i||k.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){V(n,!0)}return e(n,O,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!=O&&I(t),$(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!=O&&I(t);var n=A.attrHandle[e.toLowerCase()],i=n&&K.call(A.attrHandle,e.toLowerCase())?n(t,e,!M):void 0;return void 0!==i?i:k.attributes||!M?t.getAttribute(e):(i=t.getAttributeNode(e))&&i.specified?i.value:null},e.escape=function(t){return(t+"").replace(At,Ct)},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){
var e,n=[],i=0,s=0;if(E=!k.detectDuplicates,P=!k.sortStable&&t.slice(0),t.sort(G),E){for(;e=t[s++];)e===t[s]&&(i=n.push(s));for(;i--;)t.splice(n[i],1)}return P=null,t},C=e.getText=function(t){var e,n="",i=0,s=t.nodeType;if(s){if(1===s||9===s||11===s){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=C(t)}else if(3===s||4===s)return t.nodeValue}else for(;e=t[i++];)n+=C(e);return n},A=e.selectors={cacheLength:50,createPseudo:i,match:ft,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(wt,kt),t[3]=(t[3]||t[4]||t[5]||"").replace(wt,kt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return ft.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&ht.test(n)&&(e=S(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(wt,kt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=W[t+" "];return e||(e=new RegExp("(^|"+it+")"+t+"("+it+"|$)"))&&W(t,(function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")}))},ATTR:function(t,n,i){return function(s){var r=e.attr(s,t);return null==r?"!="===n:!n||(r+="","="===n?r===i:"!="===n?r!==i:"^="===n?i&&0===r.indexOf(i):"*="===n?i&&r.indexOf(i)>-1:"$="===n?i&&r.slice(-i.length)===i:"~="===n?(" "+r.replace(at," ")+" ").indexOf(i)>-1:"|="===n&&(r===i||r.slice(0,i.length+1)===i+"-"))}},CHILD:function(t,e,n,i,s){var r="nth"!==t.slice(0,3),o="last"!==t.slice(-4),a="of-type"===e;return 1===i&&0===s?function(t){return!!t.parentNode}:function(e,n,l){var c,u,p,h,d,f,m=r!==o?"nextSibling":"previousSibling",g=e.parentNode,v=a&&e.nodeName.toLowerCase(),y=!l&&!a,b=!1;if(g){if(r){for(;m;){for(h=e;h=h[m];)if(a?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;f=m="only"===t&&!f&&"nextSibling"}return!0}if(f=[o?g.firstChild:g.lastChild],o&&y){for(b=(d=(c=(u=(p=(h=g)[B]||(h[B]={}))[h.uniqueID]||(p[h.uniqueID]={}))[t]||[])[0]===U&&c[1])&&c[2],h=d&&g.childNodes[d];h=++d&&h&&h[m]||(b=d=0)||f.pop();)if(1===h.nodeType&&++b&&h===e){u[t]=[U,d,b];break}}else if(y&&(b=d=(c=(u=(p=(h=e)[B]||(h[B]={}))[h.uniqueID]||(p[h.uniqueID]={}))[t]||[])[0]===U&&c[1]),!1===b)for(;(h=++d&&h&&h[m]||(b=d=0)||f.pop())&&((a?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++b||(y&&((u=(p=h[B]||(h[B]={}))[h.uniqueID]||(p[h.uniqueID]={}))[t]=[U,b]),h!==e)););return(b-=s)===i||b%i==0&&b/i>=0}}},PSEUDO:function(t,n){var s,r=A.pseudos[t]||A.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return r[B]?r(n):r.length>1?(s=[t,t,"",n],A.setFilters.hasOwnProperty(t.toLowerCase())?i((function(t,e){for(var i,s=r(t,n),o=s.length;o--;)t[i=et(t,s[o])]=!(e[i]=s[o])})):function(t){return r(t,0,s)}):r}},pseudos:{not:i((function(t){var e=[],n=[],s=x(t.replace(lt,"$1"));return s[B]?i((function(t,e,n,i){for(var r,o=s(t,null,i,[]),a=t.length;a--;)(r=o[a])&&(t[a]=!(e[a]=r))})):function(t,i,r){return e[0]=t,s(e,null,r,n),e[0]=null,!n.pop()}})),has:i((function(t){return function(n){return e(t,n).length>0}})),contains:i((function(t){return t=t.replace(wt,kt),function(e){return(e.textContent||C(e)).indexOf(t)>-1}})),lang:i((function(t){return dt.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(wt,kt).toLowerCase(),function(e){var n;do{if(n=M?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===N},focus:function(t){return t===O.activeElement&&(!O.hasFocus||O.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:c(!1),disabled:c(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!A.pseudos.empty(t)},header:function(t){return vt.test(t.nodeName)},input:function(t){return gt.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:u((function(){return[0]})),last:u((function(t,e){return[e-1]})),eq:u((function(t,e,n){return[n<0?n+e:n]})),even:u((function(t,e){for(var n=0;n<e;n+=2)t.push(n);return t})),odd:u((function(t,e){for(var n=1;n<e;n+=2)t.push(n);return t})),lt:u((function(t,e,n){for(var i=n<0?n+e:n>e?e:n;--i>=0;)t.push(i);return t})),gt:u((function(t,e,n){for(var i=n<0?n+e:n;++i<e;)t.push(i);return t}))}},A.pseudos.nth=A.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})A.pseudos[w]=a(w);for(w in{submit:!0,reset:!0})A.pseudos[w]=l(w);return h.prototype=A.filters=A.pseudos,A.setFilters=new h,S=e.tokenize=function(t,n){var i,s,r,o,a,l,c,u=H[t+" "];if(u)return n?0:u.slice(0);for(a=t,l=[],c=A.preFilter;a;){for(o in i&&!(s=ct.exec(a))||(s&&(a=a.slice(s[0].length)||a),l.push(r=[])),i=!1,(s=ut.exec(a))&&(i=s.shift(),r.push({value:i,type:s[0].replace(lt," ")}),a=a.slice(i.length)),A.filter)!(s=ft[o].exec(a))||c[o]&&!(s=c[o](s))||(i=s.shift(),r.push({value:i,type:o,matches:s}),a=a.slice(i.length));if(!i)break}return n?a.length:a?e.error(t):H(t,l).slice(0)},x=e.compile=function(t,e){var n,i=[],s=[],r=J[t+" "];if(!r){for(e||(e=S(t)),n=e.length;n--;)(r=b(e[n]))[B]?i.push(r):s.push(r);(r=J(t,_(s,i))).selector=t}return r},j=e.select=function(t,e,n,i){var s,r,o,a,l,c="function"==typeof t&&t,u=!i&&S(t=c.selector||t);if(n=n||[],1===u.length){if((r=u[0]=u[0].slice(0)).length>2&&"ID"===(o=r[0]).type&&9===e.nodeType&&M&&A.relative[r[1].type]){if(!(e=(A.find.ID(o.matches[0].replace(wt,kt),e)||[])[0]))return n;c&&(e=e.parentNode),t=t.slice(r.shift().value.length)}for(s=ft.needsContext.test(t)?0:r.length;s--&&(o=r[s],!A.relative[a=o.type]);)if((l=A.find[a])&&(i=l(o.matches[0].replace(wt,kt),_t.test(r[0].type)&&p(e.parentNode)||e))){if(r.splice(s,1),!(t=i.length&&d(r)))return Q.apply(n,i),n;break}}return(c||x(t,u))(i,e,!M,n,!e||_t.test(t)&&p(e.parentNode)||e),n},k.sortStable=B.split("").sort(G).join("")===B,k.detectDuplicates=!!E,I(),k.sortDetached=s((function(t){return 1&t.compareDocumentPosition(O.createElement("fieldset"))})),s((function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")}))||r("type|href|height|width",(function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)})),k.attributes&&s((function(t){return t.innerHTML="<input/>",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")}))||r("value",(function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue})),s((function(t){return null==t.getAttribute("disabled")}))||r(nt,(function(t,e,n){var i;if(!n)return!0===t[e]?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.value:null})),e}(t);Ct.find=Tt,Ct.expr=Tt.selectors,Ct.expr[":"]=Ct.expr.pseudos,Ct.uniqueSort=Ct.unique=Tt.uniqueSort,Ct.text=Tt.getText,Ct.isXMLDoc=Tt.isXML,Ct.contains=Tt.contains,Ct.escapeSelector=Tt.escape;var St=function(t,e,n){for(var i=[],s=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(s&&Ct(t).is(n))break;i.push(t)}return i},xt=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},jt=Ct.expr.match.needsContext,Dt=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;Ct.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?Ct.find.matchesSelector(i,t)?[i]:[]:Ct.find.matches(t,Ct.grep(e,(function(t){return 1===t.nodeType})))},Ct.fn.extend({find:function(t){var e,n,i=this.length,s=this;if("string"!=typeof t)return this.pushStack(Ct(t).filter((function(){for(e=0;e<i;e++)if(Ct.contains(s[e],this))return!0})));for(n=this.pushStack([]),e=0;e<i;e++)Ct.find(t,s[e],n);return i>1?Ct.uniqueSort(n):n},filter:function(t){return this.pushStack(o(this,t||[],!1))},not:function(t){return this.pushStack(o(this,t||[],!0))},is:function(t){return!!o(this,"string"==typeof t&&jt.test(t)?Ct(t):t||[],!1).length}});var Pt,Et=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(Ct.fn.init=function(t,e,n){var i,s;if(!t)return this;if(n=n||Pt,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:Et.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof Ct?e[0]:e,Ct.merge(this,Ct.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:wt,!0)),Dt.test(i[1])&&Ct.isPlainObject(e))for(i in e)bt(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(s=wt.getElementById(i[2]))&&(this[0]=s,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):bt(t)?void 0!==n.ready?n.ready(t):t(Ct):Ct.makeArray(t,this)}).prototype=Ct.fn,Pt=Ct(wt);var It=/^(?:parents|prev(?:Until|All))/,Ot={children:!0,contents:!0,next:!0,prev:!0};Ct.fn.extend({has:function(t){var e=Ct(t,this),n=e.length;return this.filter((function(){for(var t=0;t<n;t++)if(Ct.contains(this,e[t]))return!0}))},closest:function(t,e){var n,i=0,s=this.length,r=[],o="string"!=typeof t&&Ct(t);if(!jt.test(t))for(;i<s;i++)for(n=this[i];n&&n!==e;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:1===n.nodeType&&Ct.find.matchesSelector(n,t))){r.push(n);break}return this.pushStack(r.length>1?Ct.uniqueSort(r):r)},index:function(t){return t?"string"==typeof t?ht.call(Ct(t),this[0]):ht.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(Ct.uniqueSort(Ct.merge(this.get(),Ct(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),Ct.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return St(t,"parentNode")},parentsUntil:function(t,e,n){return St(t,"parentNode",n)},next:function(t){return a(t,"nextSibling")},prev:function(t){return a(t,"previousSibling")},nextAll:function(t){return St(t,"nextSibling")},prevAll:function(t){return St(t,"previousSibling")},nextUntil:function(t,e,n){return St(t,"nextSibling",n)},prevUntil:function(t,e,n){return St(t,"previousSibling",n)},siblings:function(t){return xt((t.parentNode||{}).firstChild,t)},children:function(t){return xt(t.firstChild)},contents:function(t){return null!=t.contentDocument&&lt(t.contentDocument)?t.contentDocument:(r(t,"template")&&(t=t.content||t),Ct.merge([],t.childNodes))}},(function(t,e){Ct.fn[t]=function(n,i){var s=Ct.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(s=Ct.filter(i,s)),this.length>1&&(Ot[t]||Ct.uniqueSort(s),It.test(t)&&s.reverse()),this.pushStack(s)}}));var Nt=/[^\x20\t\r\n\f]+/g;Ct.Callbacks=function(t){t="string"==typeof t?l(t):Ct.extend({},t);var e,n,s,r,o=[],a=[],c=-1,u=function(){for(r=r||t.once,s=e=!0;a.length;c=-1)for(n=a.shift();++c<o.length;)!1===o[c].apply(n[0],n[1])&&t.stopOnFalse&&(c=o.length,n=!1);t.memory||(n=!1),e=!1,r&&(o=n?[]:"")},p={add:function(){return o&&(n&&!e&&(c=o.length-1,a.push(n)),function e(n){Ct.each(n,(function(n,s){bt(s)?t.unique&&p.has(s)||o.push(s):s&&s.length&&"string"!==i(s)&&e(s)}))}(arguments),n&&!e&&u()),this},remove:function(){return Ct.each(arguments,(function(t,e){for(var n;(n=Ct.inArray(e,o,n))>-1;)o.splice(n,1),n<=c&&c--})),this},has:function(t){return t?Ct.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return r=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return r=a=[],n||e||(o=n=""),this},locked:function(){return!!r},fireWith:function(t,n){return r||(n=[t,(n=n||[]).slice?n.slice():n],a.push(n),e||u()),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!s}};return p},Ct.extend({Deferred:function(e){var n=[["notify","progress",Ct.Callbacks("memory"),Ct.Callbacks("memory"),2],["resolve","done",Ct.Callbacks("once memory"),Ct.Callbacks("once memory"),0,"resolved"],["reject","fail",Ct.Callbacks("once memory"),Ct.Callbacks("once memory"),1,"rejected"]],i="pending",s={state:function(){return i},always:function(){return r.done(arguments).fail(arguments),this},catch:function(t){return s.then(null,t)},pipe:function(){var t=arguments;return Ct.Deferred((function(e){Ct.each(n,(function(n,i){var s=bt(t[i[4]])&&t[i[4]];r[i[1]]((function(){var t=s&&s.apply(this,arguments);t&&bt(t.promise)?t.promise().progress(e.notify).done(e.resolve).fail(e.reject):e[i[0]+"With"](this,s?[t]:arguments)}))})),t=null})).promise()},then:function(e,i,s){function r(e,n,i,s){return function(){var a=this,l=arguments,p=function(){var t,p;if(!(e<o)){if((t=i.apply(a,l))===n.promise())throw new TypeError("Thenable self-resolution");p=t&&("object"==typeof t||"function"==typeof t)&&t.then,bt(p)?s?p.call(t,r(o,n,c,s),r(o,n,u,s)):(o++,p.call(t,r(o,n,c,s),r(o,n,u,s),r(o,n,c,n.notifyWith))):(i!==c&&(a=void 0,l=[t]),(s||n.resolveWith)(a,l))}},h=s?p:function(){try{p()}catch(t){Ct.Deferred.exceptionHook&&Ct.Deferred.exceptionHook(t,h.stackTrace),e+1>=o&&(i!==u&&(a=void 0,l=[t]),n.rejectWith(a,l))}};e?h():(Ct.Deferred.getStackHook&&(h.stackTrace=Ct.Deferred.getStackHook()),t.setTimeout(h))}}var o=0;return Ct.Deferred((function(t){n[0][3].add(r(0,t,bt(s)?s:c,t.notifyWith)),n[1][3].add(r(0,t,bt(e)?e:c)),n[2][3].add(r(0,t,bt(i)?i:u))})).promise()},promise:function(t){return null!=t?Ct.extend(t,s):s}},r={};return Ct.each(n,(function(t,e){var o=e[2],a=e[5];s[e[1]]=o.add,a&&o.add((function(){i=a}),n[3-t][2].disable,n[3-t][3].disable,n[0][2].lock,n[0][3].lock),o.add(e[3].fire),r[e[0]]=function(){return r[e[0]+"With"](this===r?void 0:this,arguments),this},r[e[0]+"With"]=o.fireWith})),s.promise(r),e&&e.call(r,r),r},when:function(t){var e=arguments.length,n=e,i=Array(n),s=ct.call(arguments),r=Ct.Deferred(),o=function(t){return function(n){i[t]=this,s[t]=arguments.length>1?ct.call(arguments):n,--e||r.resolveWith(i,s)}};if(e<=1&&(p(t,r.done(o(n)).resolve,r.reject,!e),"pending"===r.state()||bt(s[n]&&s[n].then)))return r.then();for(;n--;)p(s[n],o(n),r.reject);return r.promise()}});var Mt=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;Ct.Deferred.exceptionHook=function(e,n){t.console&&t.console.warn&&e&&Mt.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,n)},Ct.readyException=function(e){t.setTimeout((function(){throw e}))};var Rt=Ct.Deferred();Ct.fn.ready=function(t){return Rt.then(t).catch((function(t){Ct.readyException(t)})),this},Ct.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--Ct.readyWait:Ct.isReady)||(Ct.isReady=!0,!0!==t&&--Ct.readyWait>0||Rt.resolveWith(wt,[Ct]))}}),Ct.ready.then=Rt.then,"complete"===wt.readyState||"loading"!==wt.readyState&&!wt.documentElement.doScroll?t.setTimeout(Ct.ready):(wt.addEventListener("DOMContentLoaded",h),t.addEventListener("load",h));var Lt=function(t,e,n,s,r,o,a){var l=0,c=t.length,u=null==n;if("object"===i(n))for(l in r=!0,n)Lt(t,e,l,n[l],!0,o,a);else if(void 0!==s&&(r=!0,bt(s)||(a=!0),u&&(a?(e.call(t,s),e=null):(u=e,e=function(t,e,n){return u.call(Ct(t),n)})),e))for(;l<c;l++)e(t[l],n,a?s:s.call(t[l],l,e(t[l],n)));return r?t:u?e.call(t):c?e(t[0],n):o},Ft=/^-ms-/,$t=/-([a-z])/g,Bt=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType};m.uid=1,m.prototype={cache:function(t){var e=t[this.expando];return e||(e={},Bt(t)&&(t.nodeType?t[this.expando]=e:Object.defineProperty(t,this.expando,{value:e,configurable:!0}))),e},set:function(t,e,n){var i,s=this.cache(t);if("string"==typeof e)s[f(e)]=n;else for(i in e)s[f(i)]=e[i];return s},get:function(t,e){return void 0===e?this.cache(t):t[this.expando]&&t[this.expando][f(e)]},access:function(t,e,n){return void 0===e||e&&"string"==typeof e&&void 0===n?this.get(t,e):(this.set(t,e,n),void 0!==n?n:e)},remove:function(t,e){var n,i=t[this.expando];if(void 0!==i){if(void 0!==e){n=(e=Array.isArray(e)?e.map(f):(e=f(e))in i?[e]:e.match(Nt)||[]).length;for(;n--;)delete i[e[n]]}(void 0===e||Ct.isEmptyObject(i))&&(t.nodeType?t[this.expando]=void 0:delete t[this.expando])}},hasData:function(t){var e=t[this.expando];return void 0!==e&&!Ct.isEmptyObject(e)}};var zt=new m,Ut=new m,qt=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Wt=/[A-Z]/g;Ct.extend({hasData:function(t){return Ut.hasData(t)||zt.hasData(t)},data:function(t,e,n){return Ut.access(t,e,n)},removeData:function(t,e){Ut.remove(t,e)},_data:function(t,e,n){return zt.access(t,e,n)},_removeData:function(t,e){zt.remove(t,e)}}),Ct.fn.extend({data:function(t,e){var n,i,s,r=this[0],o=r&&r.attributes;if(void 0===t){if(this.length&&(s=Ut.get(r),1===r.nodeType&&!zt.get(r,"hasDataAttrs"))){for(n=o.length;n--;)o[n]&&0===(i=o[n].name).indexOf("data-")&&(i=f(i.slice(5)),v(r,i,s[i]));zt.set(r,"hasDataAttrs",!0)}return s}return"object"==typeof t?this.each((function(){Ut.set(this,t)})):Lt(this,(function(e){var n;if(r&&void 0===e)return void 0!==(n=Ut.get(r,t))||void 0!==(n=v(r,t))?n:void 0;this.each((function(){Ut.set(this,t,e)}))}),null,e,arguments.length>1,null,!0)},removeData:function(t){return this.each((function(){Ut.remove(this,t)}))}}),Ct.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=zt.get(t,e),n&&(!i||Array.isArray(n)?i=zt.access(t,e,Ct.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=Ct.queue(t,e),i=n.length,s=n.shift(),r=Ct._queueHooks(t,e),o=function(){Ct.dequeue(t,e)};"inprogress"===s&&(s=n.shift(),i--),s&&("fx"===e&&n.unshift("inprogress"),delete r.stop,s.call(t,o,r)),!i&&r&&r.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return zt.get(t,n)||zt.access(t,n,{empty:Ct.Callbacks("once memory").add((function(){zt.remove(t,[e+"queue",n])}))})}}),Ct.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length<n?Ct.queue(this[0],t):void 0===e?this:this.each((function(){var n=Ct.queue(this,t,e);Ct._queueHooks(this,t),"fx"===t&&"inprogress"!==n[0]&&Ct.dequeue(this,t)}))},dequeue:function(t){return this.each((function(){Ct.dequeue(this,t)}))},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var n,i=1,s=Ct.Deferred(),r=this,o=this.length,a=function(){--i||s.resolveWith(r,[r])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";o--;)(n=zt.get(r[o],t+"queueHooks"))&&n.empty&&(i++,n.empty.add(a));return a(),s.promise(e)}});var Ht=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Jt=new RegExp("^(?:([+-])=|)("+Ht+")([a-z%]*)$","i"),Vt=["Top","Right","Bottom","Left"],Gt=wt.documentElement,Kt=function(t){return Ct.contains(t.ownerDocument,t)},Yt={composed:!0};Gt.getRootNode&&(Kt=function(t){return Ct.contains(t.ownerDocument,t)||t.getRootNode(Yt)===t.ownerDocument});var Xt=function(t,e){return"none"===(t=e||t).style.display||""===t.style.display&&Kt(t)&&"none"===Ct.css(t,"display")},Zt={};Ct.fn.extend({show:function(){return _(this,!0)},hide:function(){return _(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each((function(){Xt(this)?Ct(this).show():Ct(this).hide()}))}});var Qt,te,ee=/^(?:checkbox|radio)$/i,ne=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,ie=/^$|^module$|\/(?:java|ecma)script/i;Qt=wt.createDocumentFragment().appendChild(wt.createElement("div")),(te=wt.createElement("input")).setAttribute("type","radio"),te.setAttribute("checked","checked"),te.setAttribute("name","t"),Qt.appendChild(te),yt.checkClone=Qt.cloneNode(!0).cloneNode(!0).lastChild.checked,Qt.innerHTML="<textarea>x</textarea>",yt.noCloneChecked=!!Qt.cloneNode(!0).lastChild.defaultValue,Qt.innerHTML="<option></option>",yt.option=!!Qt.lastChild;var se={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};se.tbody=se.tfoot=se.colgroup=se.caption=se.thead,se.th=se.td,yt.option||(se.optgroup=se.option=[1,"<select multiple='multiple'>","</select>"]);var re=/<|&#?\w+;/,oe=/^([^.]*)(?:\.(.+)|)/;Ct.event={global:{},add:function(t,e,n,i,s){var r,o,a,l,c,u,p,h,d,f,m,g=zt.get(t);if(Bt(t))for(n.handler&&(n=(r=n).handler,s=r.selector),s&&Ct.find.matchesSelector(Gt,s),n.guid||(n.guid=Ct.guid++),(l=g.events)||(l=g.events=Object.create(null)),(o=g.handle)||(o=g.handle=function(e){return void 0!==Ct&&Ct.event.triggered!==e.type?Ct.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(Nt)||[""]).length;c--;)d=m=(a=oe.exec(e[c])||[])[1],f=(a[2]||"").split(".").sort(),d&&(p=Ct.event.special[d]||{},d=(s?p.delegateType:p.bindType)||d,p=Ct.event.special[d]||{},u=Ct.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:s,needsContext:s&&Ct.expr.match.needsContext.test(s),namespace:f.join(".")},r),(h=l[d])||((h=l[d]=[]).delegateCount=0,p.setup&&!1!==p.setup.call(t,i,f,o)||t.addEventListener&&t.addEventListener(d,o)),p.add&&(p.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),s?h.splice(h.delegateCount++,0,u):h.push(u),Ct.event.global[d]=!0)},remove:function(t,e,n,i,s){var r,o,a,l,c,u,p,h,d,f,m,g=zt.hasData(t)&&zt.get(t);if(g&&(l=g.events)){for(c=(e=(e||"").match(Nt)||[""]).length;c--;)if(d=m=(a=oe.exec(e[c])||[])[1],f=(a[2]||"").split(".").sort(),d){for(p=Ct.event.special[d]||{},h=l[d=(i?p.delegateType:p.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=r=h.length;r--;)u=h[r],!s&&m!==u.origType||n&&n.guid!==u.guid||a&&!a.test(u.namespace)||i&&i!==u.selector&&("**"!==i||!u.selector)||(h.splice(r,1),u.selector&&h.delegateCount--,p.remove&&p.remove.call(t,u));o&&!h.length&&(p.teardown&&!1!==p.teardown.call(t,f,g.handle)||Ct.removeEvent(t,d,g.handle),delete l[d])}else for(d in l)Ct.event.remove(t,d+e[c],n,i,!0);Ct.isEmptyObject(l)&&zt.remove(t,"handle events")}},dispatch:function(t){var e,n,i,s,r,o,a=new Array(arguments.length),l=Ct.event.fix(t),c=(zt.get(this,"events")||Object.create(null))[l.type]||[],u=Ct.event.special[l.type]||{};for(a[0]=l,e=1;e<arguments.length;e++)a[e]=arguments[e];if(l.delegateTarget=this,!u.preDispatch||!1!==u.preDispatch.call(this,l)){for(o=Ct.event.handlers.call(this,l,c),e=0;(s=o[e++])&&!l.isPropagationStopped();)for(l.currentTarget=s.elem,n=0;(r=s.handlers[n++])&&!l.isImmediatePropagationStopped();)l.rnamespace&&!1!==r.namespace&&!l.rnamespace.test(r.namespace)||(l.handleObj=r,l.data=r.data,void 0!==(i=((Ct.event.special[r.origType]||{}).handle||r.handler).apply(s.elem,a))&&!1===(l.result=i)&&(l.preventDefault(),l.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,l),l.result}},handlers:function(t,e){var n,i,s,r,o,a=[],l=e.delegateCount,c=t.target;if(l&&c.nodeType&&!("click"===t.type&&t.button>=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(r=[],o={},n=0;n<l;n++)void 0===o[s=(i=e[n]).selector+" "]&&(o[s]=i.needsContext?Ct(s,this).index(c)>-1:Ct.find(s,this,null,[c]).length),o[s]&&r.push(i);r.length&&a.push({elem:c,handlers:r})}return c=this,l<e.length&&a.push({elem:c,handlers:e.slice(l)}),a},addProp:function(t,e){Object.defineProperty(Ct.Event.prototype,t,{enumerable:!0,configurable:!0,get:bt(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(t){return t[Ct.expando]?t:new Ct.Event(t)},special:{load:{noBubble:!0},click:{setup:function(t){var e=this||t;return ee.test(e.type)&&e.click&&r(e,"input")&&D(e,"click",C),!1},trigger:function(t){var e=this||t;return ee.test(e.type)&&e.click&&r(e,"input")&&D(e,"click"),!0},_default:function(t){var e=t.target;return ee.test(e.type)&&e.click&&r(e,"input")&&zt.get(e,"click")||r(e,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}}},Ct.removeEvent=function(t,e,n){t.removeEventListener&&t.removeEventListener(e,n)},Ct.Event=function(t,e){if(!(this instanceof Ct.Event))return new Ct.Event(t,e);t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&!1===t.returnValue?C:T,this.target=t.target&&3===t.target.nodeType?t.target.parentNode:t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget):this.type=t,e&&Ct.extend(this,e),this.timeStamp=t&&t.timeStamp||Date.now(),this[Ct.expando]=!0},Ct.Event.prototype={constructor:Ct.Event,isDefaultPrevented:T,isPropagationStopped:T,isImmediatePropagationStopped:T,isSimulated:!1,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=C,t&&!this.isSimulated&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=C,t&&!this.isSimulated&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=C,t&&!this.isSimulated&&t.stopImmediatePropagation(),this.stopPropagation()}},Ct.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},Ct.event.addProp),Ct.each({focus:"focusin",blur:"focusout"},(function(t,e){Ct.event.special[t]={setup:function(){return D(this,t,S),!1},trigger:function(){return D(this,t),!0},_default:function(){return!0},delegateType:e}})),Ct.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},(function(t,e){Ct.event.special[t]={delegateType:e,bindType:e,handle:function(t){var n,i=this,s=t.relatedTarget,r=t.handleObj;return s&&(s===i||Ct.contains(i,s))||(t.type=r.origType,n=r.handler.apply(this,arguments),t.type=e),n}}})),Ct.fn.extend({on:function(t,e,n,i){return j(this,t,e,n,i)},one:function(t,e,n,i){return j(this,t,e,n,i,1)},off:function(t,e,n){var i,s;if(t&&t.preventDefault&&t.handleObj)return i=t.handleObj,Ct(t.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof t){for(s in t)this.off(s,e,t[s]);return this}return!1!==e&&"function"!=typeof e||(n=e,e=void 0),!1===n&&(n=T),this.each((function(){Ct.event.remove(this,t,n,e)}))}});var ae=/<script|<style|<link/i,le=/checked\s*(?:[^=]|=\s*.checked.)/i,ce=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;Ct.extend({htmlPrefilter:function(t){return t},clone:function(t,e,n){var i,s,r,o,a=t.cloneNode(!0),l=Kt(t);if(!(yt.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||Ct.isXMLDoc(t)))for(o=w(a),i=0,s=(r=w(t)).length;i<s;i++)N(r[i],o[i]);if(e)if(n)for(r=r||w(t),o=o||w(a),i=0,s=r.length;i<s;i++)O(r[i],o[i]);else O(t,a);return(o=w(a,"script")).length>0&&k(o,!l&&w(t,"script")),a},cleanData:function(t){for(var e,n,i,s=Ct.event.special,r=0;void 0!==(n=t[r]);r++)if(Bt(n)){if(e=n[zt.expando]){if(e.events)for(i in e.events)s[i]?Ct.event.remove(n,i):Ct.removeEvent(n,i,e.handle);n[zt.expando]=void 0}n[Ut.expando]&&(n[Ut.expando]=void 0)}}}),Ct.fn.extend({detach:function(t){return R(this,t,!0)},remove:function(t){return R(this,t)},text:function(t){return Lt(this,(function(t){return void 0===t?Ct.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)}))}),null,t,arguments.length)},append:function(){return M(this,arguments,(function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||P(this,t).appendChild(t)}))},prepend:function(){return M(this,arguments,(function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=P(this,t);e.insertBefore(t,e.firstChild)}}))},before:function(){return M(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this)}))},after:function(){return M(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)}))},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(Ct.cleanData(w(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map((function(){return Ct.clone(this,t,e)}))},html:function(t){return Lt(this,(function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!ae.test(t)&&!se[(ne.exec(t)||["",""])[1].toLowerCase()]){t=Ct.htmlPrefilter(t);try{for(;n<i;n++)1===(e=this[n]||{}).nodeType&&(Ct.cleanData(w(e,!1)),e.innerHTML=t);e=0}catch(t){}}e&&this.empty().append(t)}),null,t,arguments.length)},replaceWith:function(){var t=[];return M(this,arguments,(function(e){var n=this.parentNode;Ct.inArray(this,t)<0&&(Ct.cleanData(w(this)),n&&n.replaceChild(e,this))}),t)}}),Ct.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(t,e){Ct.fn[t]=function(t){for(var n,i=[],s=Ct(t),r=s.length-1,o=0;o<=r;o++)n=o===r?this:this.clone(!0),Ct(s[o])[e](n),pt.apply(i,n.get());return this.pushStack(i)}}));var ue=new RegExp("^("+Ht+")(?!px)[a-z%]+$","i"),pe=function(e){var n=e.ownerDocument.defaultView;return n&&n.opener||(n=t),n.getComputedStyle(e)},he=function(t,e,n){var i,s,r={};for(s in e)r[s]=t.style[s],t.style[s]=e[s];for(s in i=n.call(t),e)t.style[s]=r[s];return i},de=new RegExp(Vt.join("|"),"i");!function(){function e(){if(u){c.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",u.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",Gt.appendChild(c).appendChild(u);var e=t.getComputedStyle(u);i="1%"!==e.top,l=12===n(e.marginLeft),u.style.right="60%",o=36===n(e.right),s=36===n(e.width),u.style.position="absolute",r=12===n(u.offsetWidth/3),Gt.removeChild(c),u=null}}function n(t){return Math.round(parseFloat(t))}var i,s,r,o,a,l,c=wt.createElement("div"),u=wt.createElement("div");u.style&&(u.style.backgroundClip="content-box",u.cloneNode(!0).style.backgroundClip="",yt.clearCloneStyle="content-box"===u.style.backgroundClip,Ct.extend(yt,{boxSizingReliable:function(){return e(),s},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),i},reliableMarginLeft:function(){return e(),l},scrollboxSize:function(){return e(),r},reliableTrDimensions:function(){var e,n,i,s;return null==a&&(e=wt.createElement("table"),n=wt.createElement("tr"),i=wt.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",n.style.cssText="border:1px solid",n.style.height="1px",i.style.height="9px",i.style.display="block",Gt.appendChild(e).appendChild(n).appendChild(i),s=t.getComputedStyle(n),a=parseInt(s.height,10)+parseInt(s.borderTopWidth,10)+parseInt(s.borderBottomWidth,10)===n.offsetHeight,Gt.removeChild(e)),a}}))}();var fe=["Webkit","Moz","ms"],me=wt.createElement("div").style,ge={},ve=/^(none|table(?!-c[ea]).+)/,ye=/^--/,be={position:"absolute",visibility:"hidden",display:"block"},_e={letterSpacing:"0",fontWeight:"400"};Ct.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=L(t,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(t,e,n,i){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var s,r,o,a=f(e),l=ye.test(e),c=t.style;if(l||(e=B(a)),o=Ct.cssHooks[e]||Ct.cssHooks[a],void 0===n)return o&&"get"in o&&void 0!==(s=o.get(t,!1,i))?s:c[e];"string"===(r=typeof n)&&(s=Jt.exec(n))&&s[1]&&(n=y(t,e,s),r="number"),null!=n&&n==n&&("number"!==r||l||(n+=s&&s[3]||(Ct.cssNumber[a]?"":"px")),yt.clearCloneStyle||""!==n||0!==e.indexOf("background")||(c[e]="inherit"),o&&"set"in o&&void 0===(n=o.set(t,n,i))||(l?c.setProperty(e,n):c[e]=n))}},css:function(t,e,n,i){var s,r,o,a=f(e);return ye.test(e)||(e=B(a)),(o=Ct.cssHooks[e]||Ct.cssHooks[a])&&"get"in o&&(s=o.get(t,!0,n)),void 0===s&&(s=L(t,e,i)),"normal"===s&&e in _e&&(s=_e[e]),""===n||n?(r=parseFloat(s),!0===n||isFinite(r)?r||0:s):s}}),Ct.each(["height","width"],(function(t,e){Ct.cssHooks[e]={get:function(t,n,i){
if(n)return!ve.test(Ct.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?q(t,e,i):he(t,be,(function(){return q(t,e,i)}))},set:function(t,n,i){var s,r=pe(t),o=!yt.scrollboxSize()&&"absolute"===r.position,a=(o||i)&&"border-box"===Ct.css(t,"boxSizing",!1,r),l=i?U(t,e,i,a,r):0;return a&&o&&(l-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(r[e])-U(t,e,"border",!1,r)-.5)),l&&(s=Jt.exec(n))&&"px"!==(s[3]||"px")&&(t.style[e]=n,n=Ct.css(t,e)),z(t,n,l)}}})),Ct.cssHooks.marginLeft=F(yt.reliableMarginLeft,(function(t,e){if(e)return(parseFloat(L(t,"marginLeft"))||t.getBoundingClientRect().left-he(t,{marginLeft:0},(function(){return t.getBoundingClientRect().left})))+"px"})),Ct.each({margin:"",padding:"",border:"Width"},(function(t,e){Ct.cssHooks[t+e]={expand:function(n){for(var i=0,s={},r="string"==typeof n?n.split(" "):[n];i<4;i++)s[t+Vt[i]+e]=r[i]||r[i-2]||r[0];return s}},"margin"!==t&&(Ct.cssHooks[t+e].set=z)})),Ct.fn.extend({css:function(t,e){return Lt(this,(function(t,e,n){var i,s,r={},o=0;if(Array.isArray(e)){for(i=pe(t),s=e.length;o<s;o++)r[e[o]]=Ct.css(t,e[o],!1,i);return r}return void 0!==n?Ct.style(t,e,n):Ct.css(t,e)}),t,e,arguments.length>1)}}),Ct.Tween=W,W.prototype={constructor:W,init:function(t,e,n,i,s,r){this.elem=t,this.prop=n,this.easing=s||Ct.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=r||(Ct.cssNumber[n]?"":"px")},cur:function(){var t=W.propHooks[this.prop];return t&&t.get?t.get(this):W.propHooks._default.get(this)},run:function(t){var e,n=W.propHooks[this.prop];return this.options.duration?this.pos=e=Ct.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):W.propHooks._default.set(this),this}},W.prototype.init.prototype=W.prototype,W.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=Ct.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){Ct.fx.step[t.prop]?Ct.fx.step[t.prop](t):1!==t.elem.nodeType||!Ct.cssHooks[t.prop]&&null==t.elem.style[B(t.prop)]?t.elem[t.prop]=t.now:Ct.style(t.elem,t.prop,t.now+t.unit)}}},W.propHooks.scrollTop=W.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},Ct.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},Ct.fx=W.prototype.init,Ct.fx.step={};var we,ke,Ae=/^(?:toggle|show|hide)$/,Ce=/queueHooks$/;Ct.Animation=Ct.extend(X,{tweeners:{"*":[function(t,e){var n=this.createTween(t,e);return y(n.elem,t,Jt.exec(e),n),n}]},tweener:function(t,e){bt(t)?(e=t,t=["*"]):t=t.match(Nt);for(var n,i=0,s=t.length;i<s;i++)n=t[i],X.tweeners[n]=X.tweeners[n]||[],X.tweeners[n].unshift(e)},prefilters:[K],prefilter:function(t,e){e?X.prefilters.unshift(t):X.prefilters.push(t)}}),Ct.speed=function(t,e,n){var i=t&&"object"==typeof t?Ct.extend({},t):{complete:n||!n&&e||bt(t)&&t,duration:t,easing:n&&e||e&&!bt(e)&&e};return Ct.fx.off?i.duration=0:"number"!=typeof i.duration&&(i.duration in Ct.fx.speeds?i.duration=Ct.fx.speeds[i.duration]:i.duration=Ct.fx.speeds._default),null!=i.queue&&!0!==i.queue||(i.queue="fx"),i.old=i.complete,i.complete=function(){bt(i.old)&&i.old.call(this),i.queue&&Ct.dequeue(this,i.queue)},i},Ct.fn.extend({fadeTo:function(t,e,n,i){return this.filter(Xt).css("opacity",0).show().end().animate({opacity:e},t,n,i)},animate:function(t,e,n,i){var s=Ct.isEmptyObject(t),r=Ct.speed(e,n,i),o=function(){var e=X(this,Ct.extend({},t),r);(s||zt.get(this,"finish"))&&e.stop(!0)};return o.finish=o,s||!1===r.queue?this.each(o):this.queue(r.queue,o)},stop:function(t,e,n){var i=function(t){var e=t.stop;delete t.stop,e(n)};return"string"!=typeof t&&(n=e,e=t,t=void 0),e&&this.queue(t||"fx",[]),this.each((function(){var e=!0,s=null!=t&&t+"queueHooks",r=Ct.timers,o=zt.get(this);if(s)o[s]&&o[s].stop&&i(o[s]);else for(s in o)o[s]&&o[s].stop&&Ce.test(s)&&i(o[s]);for(s=r.length;s--;)r[s].elem!==this||null!=t&&r[s].queue!==t||(r[s].anim.stop(n),e=!1,r.splice(s,1));!e&&n||Ct.dequeue(this,t)}))},finish:function(t){return!1!==t&&(t=t||"fx"),this.each((function(){var e,n=zt.get(this),i=n[t+"queue"],s=n[t+"queueHooks"],r=Ct.timers,o=i?i.length:0;for(n.finish=!0,Ct.queue(this,t,[]),s&&s.stop&&s.stop.call(this,!0),e=r.length;e--;)r[e].elem===this&&r[e].queue===t&&(r[e].anim.stop(!0),r.splice(e,1));for(e=0;e<o;e++)i[e]&&i[e].finish&&i[e].finish.call(this);delete n.finish}))}}),Ct.each(["toggle","show","hide"],(function(t,e){var n=Ct.fn[e];Ct.fn[e]=function(t,i,s){return null==t||"boolean"==typeof t?n.apply(this,arguments):this.animate(V(e,!0),t,i,s)}})),Ct.each({slideDown:V("show"),slideUp:V("hide"),slideToggle:V("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(t,e){Ct.fn[t]=function(t,n,i){return this.animate(e,t,n,i)}})),Ct.timers=[],Ct.fx.tick=function(){var t,e=0,n=Ct.timers;for(we=Date.now();e<n.length;e++)(t=n[e])()||n[e]!==t||n.splice(e--,1);n.length||Ct.fx.stop(),we=void 0},Ct.fx.timer=function(t){Ct.timers.push(t),Ct.fx.start()},Ct.fx.interval=13,Ct.fx.start=function(){ke||(ke=!0,H())},Ct.fx.stop=function(){ke=null},Ct.fx.speeds={slow:600,fast:200,_default:400},Ct.fn.delay=function(e,n){return e=Ct.fx&&Ct.fx.speeds[e]||e,n=n||"fx",this.queue(n,(function(n,i){var s=t.setTimeout(n,e);i.stop=function(){t.clearTimeout(s)}}))},function(){var t=wt.createElement("input"),e=wt.createElement("select").appendChild(wt.createElement("option"));t.type="checkbox",yt.checkOn=""!==t.value,yt.optSelected=e.selected,(t=wt.createElement("input")).value="t",t.type="radio",yt.radioValue="t"===t.value}();var Te,Se=Ct.expr.attrHandle;Ct.fn.extend({attr:function(t,e){return Lt(this,Ct.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each((function(){Ct.removeAttr(this,t)}))}}),Ct.extend({attr:function(t,e,n){var i,s,r=t.nodeType;if(3!==r&&8!==r&&2!==r)return void 0===t.getAttribute?Ct.prop(t,e,n):(1===r&&Ct.isXMLDoc(t)||(s=Ct.attrHooks[e.toLowerCase()]||(Ct.expr.match.bool.test(e)?Te:void 0)),void 0!==n?null===n?void Ct.removeAttr(t,e):s&&"set"in s&&void 0!==(i=s.set(t,n,e))?i:(t.setAttribute(e,n+""),n):s&&"get"in s&&null!==(i=s.get(t,e))?i:null==(i=Ct.find.attr(t,e))?void 0:i)},attrHooks:{type:{set:function(t,e){if(!yt.radioValue&&"radio"===e&&r(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,i=0,s=e&&e.match(Nt);if(s&&1===t.nodeType)for(;n=s[i++];)t.removeAttribute(n)}}),Te={set:function(t,e,n){return!1===e?Ct.removeAttr(t,n):t.setAttribute(n,n),n}},Ct.each(Ct.expr.match.bool.source.match(/\w+/g),(function(t,e){var n=Se[e]||Ct.find.attr;Se[e]=function(t,e,i){var s,r,o=e.toLowerCase();return i||(r=Se[o],Se[o]=s,s=null!=n(t,e,i)?o:null,Se[o]=r),s}}));var xe=/^(?:input|select|textarea|button)$/i,je=/^(?:a|area)$/i;Ct.fn.extend({prop:function(t,e){return Lt(this,Ct.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each((function(){delete this[Ct.propFix[t]||t]}))}}),Ct.extend({prop:function(t,e,n){var i,s,r=t.nodeType;if(3!==r&&8!==r&&2!==r)return 1===r&&Ct.isXMLDoc(t)||(e=Ct.propFix[e]||e,s=Ct.propHooks[e]),void 0!==n?s&&"set"in s&&void 0!==(i=s.set(t,n,e))?i:t[e]=n:s&&"get"in s&&null!==(i=s.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=Ct.find.attr(t,"tabindex");return e?parseInt(e,10):xe.test(t.nodeName)||je.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),yt.optSelected||(Ct.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),Ct.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){Ct.propFix[this.toLowerCase()]=this})),Ct.fn.extend({addClass:function(t){var e,n,i,s,r,o,a,l=0;if(bt(t))return this.each((function(e){Ct(this).addClass(t.call(this,e,Q(this)))}));if((e=tt(t)).length)for(;n=this[l++];)if(s=Q(n),i=1===n.nodeType&&" "+Z(s)+" "){for(o=0;r=e[o++];)i.indexOf(" "+r+" ")<0&&(i+=r+" ");s!==(a=Z(i))&&n.setAttribute("class",a)}return this},removeClass:function(t){var e,n,i,s,r,o,a,l=0;if(bt(t))return this.each((function(e){Ct(this).removeClass(t.call(this,e,Q(this)))}));if(!arguments.length)return this.attr("class","");if((e=tt(t)).length)for(;n=this[l++];)if(s=Q(n),i=1===n.nodeType&&" "+Z(s)+" "){for(o=0;r=e[o++];)for(;i.indexOf(" "+r+" ")>-1;)i=i.replace(" "+r+" "," ");s!==(a=Z(i))&&n.setAttribute("class",a)}return this},toggleClass:function(t,e){var n=typeof t,i="string"===n||Array.isArray(t);return"boolean"==typeof e&&i?e?this.addClass(t):this.removeClass(t):bt(t)?this.each((function(n){Ct(this).toggleClass(t.call(this,n,Q(this),e),e)})):this.each((function(){var e,s,r,o;if(i)for(s=0,r=Ct(this),o=tt(t);e=o[s++];)r.hasClass(e)?r.removeClass(e):r.addClass(e);else void 0!==t&&"boolean"!==n||((e=Q(this))&&zt.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":zt.get(this,"__className__")||""))}))},hasClass:function(t){var e,n,i=0;for(e=" "+t+" ";n=this[i++];)if(1===n.nodeType&&(" "+Z(Q(n))+" ").indexOf(e)>-1)return!0;return!1}});var De=/\r/g;Ct.fn.extend({val:function(t){var e,n,i,s=this[0];return arguments.length?(i=bt(t),this.each((function(n){var s;1===this.nodeType&&(null==(s=i?t.call(this,n,Ct(this).val()):t)?s="":"number"==typeof s?s+="":Array.isArray(s)&&(s=Ct.map(s,(function(t){return null==t?"":t+""}))),(e=Ct.valHooks[this.type]||Ct.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,s,"value")||(this.value=s))}))):s?(e=Ct.valHooks[s.type]||Ct.valHooks[s.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(s,"value"))?n:"string"==typeof(n=s.value)?n.replace(De,""):null==n?"":n:void 0}}),Ct.extend({valHooks:{option:{get:function(t){var e=Ct.find.attr(t,"value");return null!=e?e:Z(Ct.text(t))}},select:{get:function(t){var e,n,i,s=t.options,o=t.selectedIndex,a="select-one"===t.type,l=a?null:[],c=a?o+1:s.length;for(i=o<0?c:a?o:0;i<c;i++)if(((n=s[i]).selected||i===o)&&!n.disabled&&(!n.parentNode.disabled||!r(n.parentNode,"optgroup"))){if(e=Ct(n).val(),a)return e;l.push(e)}return l},set:function(t,e){for(var n,i,s=t.options,r=Ct.makeArray(e),o=s.length;o--;)((i=s[o]).selected=Ct.inArray(Ct.valHooks.option.get(i),r)>-1)&&(n=!0);return n||(t.selectedIndex=-1),r}}}}),Ct.each(["radio","checkbox"],(function(){Ct.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=Ct.inArray(Ct(t).val(),e)>-1}},yt.checkOn||(Ct.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})})),yt.focusin="onfocusin"in t;var Pe=/^(?:focusinfocus|focusoutblur)$/,Ee=function(t){t.stopPropagation()};Ct.extend(Ct.event,{trigger:function(e,n,i,s){var r,o,a,l,c,u,p,h,d=[i||wt],f=mt.call(e,"type")?e.type:e,m=mt.call(e,"namespace")?e.namespace.split("."):[];if(o=h=a=i=i||wt,3!==i.nodeType&&8!==i.nodeType&&!Pe.test(f+Ct.event.triggered)&&(f.indexOf(".")>-1&&(m=f.split("."),f=m.shift(),m.sort()),c=f.indexOf(":")<0&&"on"+f,(e=e[Ct.expando]?e:new Ct.Event(f,"object"==typeof e&&e)).isTrigger=s?2:3,e.namespace=m.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),n=null==n?[e]:Ct.makeArray(n,[e]),p=Ct.event.special[f]||{},s||!p.trigger||!1!==p.trigger.apply(i,n))){if(!s&&!p.noBubble&&!_t(i)){for(l=p.delegateType||f,Pe.test(l+f)||(o=o.parentNode);o;o=o.parentNode)d.push(o),a=o;a===(i.ownerDocument||wt)&&d.push(a.defaultView||a.parentWindow||t)}for(r=0;(o=d[r++])&&!e.isPropagationStopped();)h=o,e.type=r>1?l:p.bindType||f,(u=(zt.get(o,"events")||Object.create(null))[e.type]&&zt.get(o,"handle"))&&u.apply(o,n),(u=c&&o[c])&&u.apply&&Bt(o)&&(e.result=u.apply(o,n),!1===e.result&&e.preventDefault());return e.type=f,s||e.isDefaultPrevented()||p._default&&!1!==p._default.apply(d.pop(),n)||!Bt(i)||c&&bt(i[f])&&!_t(i)&&((a=i[c])&&(i[c]=null),Ct.event.triggered=f,e.isPropagationStopped()&&h.addEventListener(f,Ee),i[f](),e.isPropagationStopped()&&h.removeEventListener(f,Ee),Ct.event.triggered=void 0,a&&(i[c]=a)),e.result}},simulate:function(t,e,n){var i=Ct.extend(new Ct.Event,n,{type:t,isSimulated:!0});Ct.event.trigger(i,null,e)}}),Ct.fn.extend({trigger:function(t,e){return this.each((function(){Ct.event.trigger(t,e,this)}))},triggerHandler:function(t,e){var n=this[0];if(n)return Ct.event.trigger(t,e,n,!0)}}),yt.focusin||Ct.each({focus:"focusin",blur:"focusout"},(function(t,e){var n=function(t){Ct.event.simulate(e,t.target,Ct.event.fix(t))};Ct.event.special[e]={setup:function(){var i=this.ownerDocument||this.document||this,s=zt.access(i,e);s||i.addEventListener(t,n,!0),zt.access(i,e,(s||0)+1)},teardown:function(){var i=this.ownerDocument||this.document||this,s=zt.access(i,e)-1;s?zt.access(i,e,s):(i.removeEventListener(t,n,!0),zt.remove(i,e))}}}));var Ie=t.location,Oe={guid:Date.now()},Ne=/\?/;Ct.parseXML=function(e){var n,i;if(!e||"string"!=typeof e)return null;try{n=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){}return i=n&&n.getElementsByTagName("parsererror")[0],n&&!i||Ct.error("Invalid XML: "+(i?Ct.map(i.childNodes,(function(t){return t.textContent})).join("\n"):e)),n};var Me=/\[\]$/,Re=/\r?\n/g,Le=/^(?:submit|button|image|reset|file)$/i,Fe=/^(?:input|select|textarea|keygen)/i;Ct.param=function(t,e){var n,i=[],s=function(t,e){var n=bt(e)?e():e;i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!Ct.isPlainObject(t))Ct.each(t,(function(){s(this.name,this.value)}));else for(n in t)et(n,t[n],e,s);return i.join("&")},Ct.fn.extend({serialize:function(){return Ct.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=Ct.prop(this,"elements");return t?Ct.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&!Ct(this).is(":disabled")&&Fe.test(this.nodeName)&&!Le.test(t)&&(this.checked||!ee.test(t))})).map((function(t,e){var n=Ct(this).val();return null==n?null:Array.isArray(n)?Ct.map(n,(function(t){return{name:e.name,value:t.replace(Re,"\r\n")}})):{name:e.name,value:n.replace(Re,"\r\n")}})).get()}});var $e=/%20/g,Be=/#.*$/,ze=/([?&])_=[^&]*/,Ue=/^(.*?):[ \t]*([^\r\n]*)$/gm,qe=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,We=/^(?:GET|HEAD)$/,He=/^\/\//,Je={},Ve={},Ge="*/".concat("*"),Ke=wt.createElement("a");Ke.href=Ie.href,Ct.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ie.href,type:"GET",isLocal:qe.test(Ie.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ge,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":Ct.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?st(st(t,Ct.ajaxSettings),e):st(Ct.ajaxSettings,t)},ajaxPrefilter:nt(Je),ajaxTransport:nt(Ve),ajax:function(e,n){function i(e,n,i,a){var c,h,d,_,w,k=n;u||(u=!0,l&&t.clearTimeout(l),s=void 0,o=a||"",A.readyState=e>0?4:0,c=e>=200&&e<300||304===e,i&&(_=rt(f,A,i)),!c&&Ct.inArray("script",f.dataTypes)>-1&&Ct.inArray("json",f.dataTypes)<0&&(f.converters["text script"]=function(){}),_=ot(f,_,A,c),c?(f.ifModified&&((w=A.getResponseHeader("Last-Modified"))&&(Ct.lastModified[r]=w),(w=A.getResponseHeader("etag"))&&(Ct.etag[r]=w)),204===e||"HEAD"===f.type?k="nocontent":304===e?k="notmodified":(k=_.state,h=_.data,c=!(d=_.error))):(d=k,!e&&k||(k="error",e<0&&(e=0))),A.status=e,A.statusText=(n||k)+"",c?v.resolveWith(m,[h,k,A]):v.rejectWith(m,[A,k,d]),A.statusCode(b),b=void 0,p&&g.trigger(c?"ajaxSuccess":"ajaxError",[A,f,c?h:d]),y.fireWith(m,[A,k]),p&&(g.trigger("ajaxComplete",[A,f]),--Ct.active||Ct.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=void 0),n=n||{};var s,r,o,a,l,c,u,p,h,d,f=Ct.ajaxSetup({},n),m=f.context||f,g=f.context&&(m.nodeType||m.jquery)?Ct(m):Ct.event,v=Ct.Deferred(),y=Ct.Callbacks("once memory"),b=f.statusCode||{},_={},w={},k="canceled",A={readyState:0,getResponseHeader:function(t){var e;if(u){if(!a)for(a={};e=Ue.exec(o);)a[e[1].toLowerCase()+" "]=(a[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=a[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return u?o:null},setRequestHeader:function(t,e){return null==u&&(t=w[t.toLowerCase()]=w[t.toLowerCase()]||t,_[t]=e),this},overrideMimeType:function(t){return null==u&&(f.mimeType=t),this},statusCode:function(t){var e;if(t)if(u)A.always(t[A.status]);else for(e in t)b[e]=[b[e],t[e]];return this},abort:function(t){var e=t||k;return s&&s.abort(e),i(0,e),this}};if(v.promise(A),f.url=((e||f.url||Ie.href)+"").replace(He,Ie.protocol+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(Nt)||[""],null==f.crossDomain){c=wt.createElement("a");try{c.href=f.url,c.href=c.href,f.crossDomain=Ke.protocol+"//"+Ke.host!=c.protocol+"//"+c.host}catch(t){f.crossDomain=!0}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=Ct.param(f.data,f.traditional)),it(Je,f,n,A),u)return A;for(h in(p=Ct.event&&f.global)&&0==Ct.active++&&Ct.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!We.test(f.type),r=f.url.replace(Be,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace($e,"+")):(d=f.url.slice(r.length),f.data&&(f.processData||"string"==typeof f.data)&&(r+=(Ne.test(r)?"&":"?")+f.data,delete f.data),!1===f.cache&&(r=r.replace(ze,"$1"),d=(Ne.test(r)?"&":"?")+"_="+Oe.guid+++d),f.url=r+d),f.ifModified&&(Ct.lastModified[r]&&A.setRequestHeader("If-Modified-Since",Ct.lastModified[r]),Ct.etag[r]&&A.setRequestHeader("If-None-Match",Ct.etag[r])),(f.data&&f.hasContent&&!1!==f.contentType||n.contentType)&&A.setRequestHeader("Content-Type",f.contentType),A.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Ge+"; q=0.01":""):f.accepts["*"]),f.headers)A.setRequestHeader(h,f.headers[h]);if(f.beforeSend&&(!1===f.beforeSend.call(m,A,f)||u))return A.abort();if(k="abort",y.add(f.complete),A.done(f.success),A.fail(f.error),s=it(Ve,f,n,A)){if(A.readyState=1,p&&g.trigger("ajaxSend",[A,f]),u)return A;f.async&&f.timeout>0&&(l=t.setTimeout((function(){A.abort("timeout")}),f.timeout));try{u=!1,s.send(_,i)}catch(t){if(u)throw t;i(-1,t)}}else i(-1,"No Transport");return A},getJSON:function(t,e,n){return Ct.get(t,e,n,"json")},getScript:function(t,e){return Ct.get(t,void 0,e,"script")}}),Ct.each(["get","post"],(function(t,e){Ct[e]=function(t,n,i,s){return bt(n)&&(s=s||i,i=n,n=void 0),Ct.ajax(Ct.extend({url:t,type:e,dataType:s,data:n,success:i},Ct.isPlainObject(t)&&t))}})),Ct.ajaxPrefilter((function(t){var e;for(e in t.headers)"content-type"===e.toLowerCase()&&(t.contentType=t.headers[e]||"")})),Ct._evalUrl=function(t,e,n){return Ct.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(t){Ct.globalEval(t,e,n)}})},Ct.fn.extend({wrapAll:function(t){var e;return this[0]&&(bt(t)&&(t=t.call(this[0])),e=Ct(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t})).append(this)),this},wrapInner:function(t){return bt(t)?this.each((function(e){Ct(this).wrapInner(t.call(this,e))})):this.each((function(){var e=Ct(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)}))},wrap:function(t){var e=bt(t);return this.each((function(n){Ct(this).wrapAll(e?t.call(this,n):t)}))},unwrap:function(t){return this.parent(t).not("body").each((function(){Ct(this).replaceWith(this.childNodes)})),this}}),Ct.expr.pseudos.hidden=function(t){return!Ct.expr.pseudos.visible(t)},Ct.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},Ct.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var Ye={0:200,1223:204},Xe=Ct.ajaxSettings.xhr();yt.cors=!!Xe&&"withCredentials"in Xe,yt.ajax=Xe=!!Xe,Ct.ajaxTransport((function(e){var n,i;if(yt.cors||Xe&&!e.crossDomain)return{send:function(s,r){var o,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||s["X-Requested-With"]||(s["X-Requested-With"]="XMLHttpRequest"),s)a.setRequestHeader(o,s[o]);n=function(t){return function(){n&&(n=i=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===t?a.abort():"error"===t?"number"!=typeof a.status?r(0,"error"):r(a.status,a.statusText):r(Ye[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=n(),i=a.onerror=a.ontimeout=n("error"),void 0!==a.onabort?a.onabort=i:a.onreadystatechange=function(){4===a.readyState&&t.setTimeout((function(){n&&i()}))},n=n("abort");try{a.send(e.hasContent&&e.data||null)}catch(t){if(n)throw t}},abort:function(){n&&n()}}})),Ct.ajaxPrefilter((function(t){t.crossDomain&&(t.contents.script=!1)})),Ct.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return Ct.globalEval(t),t}}}),Ct.ajaxPrefilter("script",(function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")})),Ct.ajaxTransport("script",(function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(i,s){e=Ct("<script>").attr(t.scriptAttrs||{}).prop({charset:t.scriptCharset,src:t.url}).on("load error",n=function(t){e.remove(),n=null,t&&s("error"===t.type?404:200,t.type)}),wt.head.appendChild(e[0])},abort:function(){n&&n()}}}));var Ze,Qe=[],tn=/(=)\?(?=&|$)|\?\?/;Ct.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Qe.pop()||Ct.expando+"_"+Oe.guid++;return this[t]=!0,t}}),Ct.ajaxPrefilter("json jsonp",(function(e,n,i){var s,r,o,a=!1!==e.jsonp&&(tn.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&tn.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return s=e.jsonpCallback=bt(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(tn,"$1"+s):!1!==e.jsonp&&(e.url+=(Ne.test(e.url)?"&":"?")+e.jsonp+"="+s),e.converters["script json"]=function(){return o||Ct.error(s+" was not called"),o[0]},e.dataTypes[0]="json",r=t[s],t[s]=function(){o=arguments},i.always((function(){void 0===r?Ct(t).removeProp(s):t[s]=r,e[s]&&(e.jsonpCallback=n.jsonpCallback,Qe.push(s)),o&&bt(r)&&r(o[0]),o=r=void 0})),"script"})),yt.createHTMLDocument=((Ze=wt.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ze.childNodes.length),Ct.parseHTML=function(t,e,n){return"string"!=typeof t?[]:("boolean"==typeof e&&(n=e,e=!1),e||(yt.createHTMLDocument?((i=(e=wt.implementation.createHTMLDocument("")).createElement("base")).href=wt.location.href,e.head.appendChild(i)):e=wt),r=!n&&[],(s=Dt.exec(t))?[e.createElement(s[1])]:(s=A([t],e,r),r&&r.length&&Ct(r).remove(),Ct.merge([],s.childNodes)));var i,s,r},Ct.fn.load=function(t,e,n){var i,s,r,o=this,a=t.indexOf(" ");return a>-1&&(i=Z(t.slice(a)),t=t.slice(0,a)),bt(e)?(n=e,e=void 0):e&&"object"==typeof e&&(s="POST"),o.length>0&&Ct.ajax({url:t,type:s||"GET",dataType:"html",data:e}).done((function(t){r=arguments,o.html(i?Ct("<div>").append(Ct.parseHTML(t)).find(i):t)})).always(n&&function(t,e){o.each((function(){n.apply(this,r||[t.responseText,e,t])}))}),this},Ct.expr.pseudos.animated=function(t){return Ct.grep(Ct.timers,(function(e){return t===e.elem})).length},Ct.offset={setOffset:function(t,e,n){var i,s,r,o,a,l,c=Ct.css(t,"position"),u=Ct(t),p={};"static"===c&&(t.style.position="relative"),a=u.offset(),r=Ct.css(t,"top"),l=Ct.css(t,"left"),("absolute"===c||"fixed"===c)&&(r+l).indexOf("auto")>-1?(o=(i=u.position()).top,s=i.left):(o=parseFloat(r)||0,s=parseFloat(l)||0),bt(e)&&(e=e.call(t,n,Ct.extend({},a))),null!=e.top&&(p.top=e.top-a.top+o),null!=e.left&&(p.left=e.left-a.left+s),"using"in e?e.using.call(t,p):u.css(p)}},Ct.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each((function(e){Ct.offset.setOffset(this,t,e)}));var e,n,i=this[0];return i?i.getClientRects().length?(e=i.getBoundingClientRect(),n=i.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var t,e,n,i=this[0],s={top:0,left:0};if("fixed"===Ct.css(i,"position"))e=i.getBoundingClientRect();else{for(e=this.offset(),n=i.ownerDocument,t=i.offsetParent||n.documentElement;t&&(t===n.body||t===n.documentElement)&&"static"===Ct.css(t,"position");)t=t.parentNode;t&&t!==i&&1===t.nodeType&&((s=Ct(t).offset()).top+=Ct.css(t,"borderTopWidth",!0),s.left+=Ct.css(t,"borderLeftWidth",!0))}return{top:e.top-s.top-Ct.css(i,"marginTop",!0),left:e.left-s.left-Ct.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var t=this.offsetParent;t&&"static"===Ct.css(t,"position");)t=t.offsetParent;return t||Gt}))}}),Ct.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(t,e){var n="pageYOffset"===e;Ct.fn[t]=function(i){return Lt(this,(function(t,i,s){var r;if(_t(t)?r=t:9===t.nodeType&&(r=t.defaultView),void 0===s)return r?r[e]:t[i];r?r.scrollTo(n?r.pageXOffset:s,n?s:r.pageYOffset):t[i]=s}),t,i,arguments.length)}})),Ct.each(["top","left"],(function(t,e){Ct.cssHooks[e]=F(yt.pixelPosition,(function(t,n){if(n)return n=L(t,e),ue.test(n)?Ct(t).position()[e]+"px":n}))})),Ct.each({Height:"height",Width:"width"},(function(t,e){Ct.each({padding:"inner"+t,content:e,"":"outer"+t},(function(n,i){Ct.fn[i]=function(s,r){var o=arguments.length&&(n||"boolean"!=typeof s),a=n||(!0===s||!0===r?"margin":"border");return Lt(this,(function(e,n,s){var r;return _t(e)?0===i.indexOf("outer")?e["inner"+t]:e.document.documentElement["client"+t]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+t],r["scroll"+t],e.body["offset"+t],r["offset"+t],r["client"+t])):void 0===s?Ct.css(e,n,a):Ct.style(e,n,s,a)}),e,o?s:void 0,o)}}))})),Ct.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(t,e){Ct.fn[e]=function(t){return this.on(e,t)}})),Ct.fn.extend({bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,i){return this.on(e,t,n,i)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)},hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),Ct.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(t,e){Ct.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}}));var en=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;Ct.proxy=function(t,e){var n,i,s;if("string"==typeof e&&(n=t[e],e=t,t=n),bt(t))return i=ct.call(arguments,2),s=function(){return t.apply(e||this,i.concat(ct.call(arguments)))},s.guid=t.guid=t.guid||Ct.guid++,s},Ct.holdReady=function(t){t?Ct.readyWait++:Ct.ready(!0)},Ct.isArray=Array.isArray,Ct.parseJSON=JSON.parse,Ct.nodeName=r,Ct.isFunction=bt,Ct.isWindow=_t,Ct.camelCase=f,Ct.type=i,Ct.now=Date.now,Ct.isNumeric=function(t){var e=Ct.type(t);return("number"===e||"string"===e)&&!isNaN(t-parseFloat(t))},Ct.trim=function(t){return null==t?"":(t+"").replace(en,"")},"function"==typeof define&&define.amd&&define("jquery",[],(function(){return Ct}));var nn=t.jQuery,sn=t.$;return Ct.noConflict=function(e){return t.$===Ct&&(t.$=sn),e&&t.jQuery===Ct&&(t.jQuery=nn),Ct},void 0===e&&(t.jQuery=t.$=Ct),Ct})),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}((function(t){function e(e,i){var s,r,o,a=e.nodeName.toLowerCase();return"area"===a?(r=(s=e.parentNode).name,!(!e.href||!r||"map"!==s.nodeName.toLowerCase())&&(!!(o=t("img[usemap='#"+r+"']")[0])&&n(o))):(/^(input|select|textarea|button|object)$/.test(a)?!e.disabled:"a"===a&&e.href||i)&&n(e)}function n(e){return t.expr.pseudos.visible(e)&&!t(e).parents().addBack().filter((function(){return"hidden"===t.css(this,"visibility")})).length}function i(t){return"function"==typeof t}var s,r,o,a;t.ui=t.ui||{},t.extend(t.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({scrollParent:function(e){var n=this.css("position"),i="absolute"===n,s=e?/(auto|scroll|hidden)/:/(auto|scroll)/,r=this.parents().filter((function(){var e=t(this);return(!i||"static"!==e.css("position"))&&s.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))})).eq(0);return"fixed"!==n&&r.length?r:t(this[0].ownerDocument||document)},uniqueId:(s=0,function(){return this.each((function(){this.id||(this.id="ui-id-"+ ++s)}))}),removeUniqueId:function(){return this.each((function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")}))}}),t.extend(t.expr.pseudos,{data:t.expr.createPseudo?t.expr.createPseudo((function(e){return function(n){return!!t.data(n,e)}})):function(e,n,i){return!!t.data(e,i[3])},focusable:function(n){return e(n,!isNaN(t.attr(n,"tabindex")))},tabbable:function(n){var i=t.attr(n,"tabindex"),s=isNaN(i);return(s||i>=0)&&e(n,!s)}}),t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],(function(e,n){function i(e,n,i,r){return t.each(s,(function(){n-=parseFloat(t.css(e,"padding"+this))||0,i&&(n-=parseFloat(t.css(e,"border"+this+"Width"))||0),r&&(n-=parseFloat(t.css(e,"margin"+this))||0)})),n}var s="Width"===n?["Left","Right"]:["Top","Bottom"],r=n.toLowerCase(),o={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+n]=function(e){return void 0===e?o["inner"+n].call(this):this.each((function(){t(this).css(r,i(this,e)+"px")}))},t.fn["outer"+n]=function(e,s){return"number"!=typeof e?o["outer"+n].call(this,e):this.each((function(){t(this).css(r,i(this,e,!0,s)+"px")}))}})),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=(r=t.fn.removeData,function(e){return arguments.length?r.call(this,t.camelCase(e)):r.call(this)})),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.fn.extend({focus:(a=t.fn.focus,function(e,n){return"number"==typeof e?this.each((function(){var i=this;setTimeout((function(){t(i).trigger("focus"),n&&n.call(i)}),e)})):a.apply(this,arguments)}),disableSelection:(o="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(o+".ui-disableSelection",(function(t){t.preventDefault()}))}),enableSelection:function(){return this.off(".ui-disableSelection")},zIndex:function(e){if(void 0!==e)return this.css("zIndex",e);if(this.length)for(var n,i,s=t(this[0]);s.length&&s[0]!==document;){if(("absolute"===(n=s.css("position"))||"relative"===n||"fixed"===n)&&(i=parseInt(s.css("zIndex"),10),!isNaN(i)&&0!==i))return i;s=s.parent()}return 0}}),t.ui.plugin={add:function(e,n,i){var s,r=t.ui[e].prototype;for(s in i)r.plugins[s]=r.plugins[s]||[],r.plugins[s].push([n,i[s]])},call:function(t,e,n,i){var s,r=t.plugins[e];if(r&&(i||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(s=0;s<r.length;s++)t.options[r[s][0]]&&r[s][1].apply(t.element,n)}};var l=0,c=Array.prototype.slice;t.cleanData=function(e){return function(n){var i,s,r;for(r=0;null!=(s=n[r]);r++)try{(i=t._data(s,"events"))&&i.remove&&t(s).triggerHandler("remove")}catch(t){}e(n)}}(t.cleanData),t.widget=function(e,n,s){var r,o,a,l,c={},u=e.split(".")[0];return e=e.split(".")[1],r=u+"-"+e,s||(s=n,n=t.Widget),t.expr.pseudos[r.toLowerCase()]=function(e){return!!t.data(e,r)},t[u]=t[u]||{},o=t[u][e],a=t[u][e]=function(t,e){if(!this._createWidget)return new a(t,e);arguments.length&&this._createWidget(t,e)},t.extend(a,o,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),(l=new n).options=t.widget.extend({},l.options),t.each(s,(function(t,e){var s,r;i(e)?c[t]=(s=function(){
return n.prototype[t].apply(this,arguments)},r=function(e){return n.prototype[t].apply(this,e)},function(){var t,n=this._super,i=this._superApply;return this._super=s,this._superApply=r,t=e.apply(this,arguments),this._super=n,this._superApply=i,t}):c[t]=e})),a.prototype=t.widget.extend(l,{widgetEventPrefix:o&&l.widgetEventPrefix||e},c,{constructor:a,namespace:u,widgetName:e,widgetFullName:r}),o?(t.each(o._childConstructors,(function(e,n){var i=n.prototype;t.widget(i.namespace+"."+i.widgetName,a,n._proto)})),delete o._childConstructors):n._childConstructors.push(a),t.widget.bridge(e,a),a},t.widget.extend=function(e){for(var n,i,s=c.call(arguments,1),r=0,o=s.length;r<o;r++)for(n in s[r])i=s[r][n],s[r].hasOwnProperty(n)&&void 0!==i&&(t.isPlainObject(i)?e[n]=t.isPlainObject(e[n])?t.widget.extend({},e[n],i):t.widget.extend({},i):e[n]=i);return e},t.widget.bridge=function(e,n){var s=n.prototype.widgetFullName||e;t.fn[e]=function(r){var o="string"==typeof r,a=c.call(arguments,1),l=this;return o?this.each((function(){var n,o=t.data(this,s);return"instance"===r?(l=o,!1):o?i(o[r])&&"_"!==r.charAt(0)?(n=o[r].apply(o,a))!==o&&void 0!==n?(l=n&&n.jquery?l.pushStack(n.get()):n,!1):void 0:t.error("no such method '"+r+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; attempted to call method '"+r+"'")})):(a.length&&(r=t.widget.extend.apply(null,[r].concat(a))),this.each((function(){var e=t.data(this,s);e?(e.option(r||{}),e._init&&e._init()):t.data(this,s,new n(r,this))}))),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,n){n=t(n||this.defaultElement||this)[0],this.element=t(n),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),n!==this&&(t.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===n&&this.destroy()}}),this.document=t(n.style?n.ownerDocument:n.document||n),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.off(this.eventNamespace).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().off(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.off(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(e,n){var i,s,r,o=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(o={},i=e.split("."),e=i.shift(),i.length){for(s=o[e]=t.widget.extend({},this.options[e]),r=0;r<i.length-1;r++)s[i[r]]=s[i[r]]||{},s=s[i[r]];if(e=i.pop(),1===arguments.length)return void 0===s[e]?null:s[e];s[e]=n}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];o[e]=n}return this._setOptions(o),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!e),e&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(e,n,i){var s,r=this;"boolean"!=typeof e&&(i=n,n=e,e=!1),i?(n=s=t(n),this.bindings=this.bindings.add(n)):(i=n,n=this.element,s=this.widget()),t.each(i,(function(i,o){function a(){if(e||!0!==r.options.disabled&&!t(this).hasClass("ui-state-disabled"))return("string"==typeof o?r[o]:o).apply(r,arguments)}"string"!=typeof o&&(a.guid=o.guid=o.guid||a.guid||t.guid++);var l=i.match(/^([\w:-]*)\s*(.*)$/),c=l[1]+r.eventNamespace,u=l[2];u?s.on(c,u,a):n.on(c,a)}))},_off:function(e,n){n=(n||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(n),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function n(){return("string"==typeof t?i[t]:t).apply(i,arguments)}var i=this;return setTimeout(n,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,n,s){var r,o,a=this.options[e];if(s=s||{},(n=t.Event(n)).type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),n.target=this.element[0],o=n.originalEvent)for(r in o)r in n||(n[r]=o[r]);return this.element.trigger(n,s),!(i(a)&&!1===a.apply(this.element[0],[n].concat(s))||n.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},(function(e,n){t.Widget.prototype["_"+e]=function(i,s,r){"string"==typeof s&&(s={effect:s});var o,a=s?!0===s||"number"==typeof s?n:s.effect||n:e;"number"==typeof(s=s||{})&&(s={duration:s}),o=!t.isEmptyObject(s),s.complete=r,s.delay&&i.delay(s.delay),o&&t.effects&&t.effects.effect[a]?i[e](s):a!==e&&i[a]?i[a](s.duration,s.easing,r):i.queue((function(n){t(this)[e](),r&&r.call(i[0]),n()}))}}));t.widget;var u=!1;t(document).on("mouseup",(function(){u=!1}));t.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,(function(t){return e._mouseDown(t)})).on("click."+this.widgetName,(function(n){if(!0===t.data(n.target,e.widgetName+".preventClickEvent"))return t.removeData(n.target,e.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1})),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!u){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var n=this,i=1===e.which,s=!("string"!=typeof this.options.cancel||!e.target.nodeName)&&t(e.target).closest(this.options.cancel).length;return!(i&&!s&&this._mouseCapture(e))||(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout((function(){n.mouseDelayMet=!0}),this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return n._mouseMove(t)},this._mouseUpDelegate=function(t){return n._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),u=!0,!0))}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(!e.which)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),u=!1,!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}});!function(){function e(t,e,n){return[parseFloat(t[0])*(d.test(t[0])?e/100:1),parseFloat(t[1])*(d.test(t[1])?n/100:1)]}function n(e,n){return parseInt(t.css(e,n),10)||0}function i(e){var n=e[0];return 9===n.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(n)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var s,r,o=Math.max,a=Math.abs,l=Math.round,c=/left|center|right/,u=/top|center|bottom/,p=/[\+\-]\d+(\.[\d]+)?%?/,h=/^\w+/,d=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==s)return s;var e,n,i=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),r=i.children()[0];return t("body").append(i),e=r.offsetWidth,i.css("overflow","scroll"),e===(n=r.offsetWidth)&&(n=i[0].clientWidth),i.remove(),s=e-n},getScrollInfo:function(e){var n=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),i=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),s="scroll"===n||"auto"===n&&e.width<e.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&e.height<e.element[0].scrollHeight?t.position.scrollbarWidth():0,height:s?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var n=t(e||window),i=t.isWindow(n[0]),s=!!n[0]&&9===n[0].nodeType;return{element:n,isWindow:i,isDocument:s,offset:!i&&!s?t(e).offset():{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:i||s?n.width():n.outerWidth(),height:i||s?n.height():n.outerHeight()}}},t.fn.position=function(s){if(!s||!s.of)return f.apply(this,arguments);s=t.extend({},s);var d,m,g,v,y,b,_=t(s.of),w=t.position.getWithinInfo(s.within),k=t.position.getScrollInfo(w),A=(s.collision||"flip").split(" "),C={};return b=i(_),_[0].preventDefault&&(s.at="left top"),m=b.width,g=b.height,v=b.offset,y=t.extend({},v),t.each(["my","at"],(function(){var t,e,n=(s[this]||"").split(" ");1===n.length&&(n=c.test(n[0])?n.concat(["center"]):u.test(n[0])?["center"].concat(n):["center","center"]),n[0]=c.test(n[0])?n[0]:"center",n[1]=u.test(n[1])?n[1]:"center",t=p.exec(n[0]),e=p.exec(n[1]),C[this]=[t?t[0]:0,e?e[0]:0],s[this]=[h.exec(n[0])[0],h.exec(n[1])[0]]})),1===A.length&&(A[1]=A[0]),"right"===s.at[0]?y.left+=m:"center"===s.at[0]&&(y.left+=m/2),"bottom"===s.at[1]?y.top+=g:"center"===s.at[1]&&(y.top+=g/2),d=e(C.at,m,g),y.left+=d[0],y.top+=d[1],this.each((function(){var i,c,u=t(this),p=u.outerWidth(),h=u.outerHeight(),f=n(this,"marginLeft"),b=n(this,"marginTop"),T=p+f+n(this,"marginRight")+k.width,S=h+b+n(this,"marginBottom")+k.height,x=t.extend({},y),j=e(C.my,u.outerWidth(),u.outerHeight());"right"===s.my[0]?x.left-=p:"center"===s.my[0]&&(x.left-=p/2),"bottom"===s.my[1]?x.top-=h:"center"===s.my[1]&&(x.top-=h/2),x.left+=j[0],x.top+=j[1],r||(x.left=l(x.left),x.top=l(x.top)),i={marginLeft:f,marginTop:b},t.each(["left","top"],(function(e,n){t.ui.position[A[e]]&&t.ui.position[A[e]][n](x,{targetWidth:m,targetHeight:g,elemWidth:p,elemHeight:h,collisionPosition:i,collisionWidth:T,collisionHeight:S,offset:[d[0]+j[0],d[1]+j[1]],my:s.my,at:s.at,within:w,elem:u})})),s.using&&(c=function(t){var e=v.left-x.left,n=e+m-p,i=v.top-x.top,r=i+g-h,l={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:x.left,top:x.top,width:p,height:h},horizontal:n<0?"left":e>0?"right":"center",vertical:r<0?"top":i>0?"bottom":"middle"};m<p&&a(e+n)<m&&(l.horizontal="center"),g<h&&a(i+r)<g&&(l.vertical="middle"),o(a(e),a(n))>o(a(i),a(r))?l.important="horizontal":l.important="vertical",s.using.call(this,t,l)}),u.offset(t.extend(x,{using:c}))}))},t.ui.position={fit:{left:function(t,e){var n,i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,r=i.width,a=t.left-e.collisionPosition.marginLeft,l=s-a,c=a+e.collisionWidth-r-s;e.collisionWidth>r?l>0&&c<=0?(n=t.left+l+e.collisionWidth-r-s,t.left+=l-n):t.left=c>0&&l<=0?s:l>c?s+r-e.collisionWidth:s:l>0?t.left+=l:c>0?t.left-=c:t.left=o(t.left-a,t.left)},top:function(t,e){var n,i=e.within,s=i.isWindow?i.scrollTop:i.offset.top,r=e.within.height,a=t.top-e.collisionPosition.marginTop,l=s-a,c=a+e.collisionHeight-r-s;e.collisionHeight>r?l>0&&c<=0?(n=t.top+l+e.collisionHeight-r-s,t.top+=l-n):t.top=c>0&&l<=0?s:l>c?s+r-e.collisionHeight:s:l>0?t.top+=l:c>0?t.top-=c:t.top=o(t.top-a,t.top)}},flip:{left:function(t,e){var n,i,s=e.within,r=s.offset.left+s.scrollLeft,o=s.width,l=s.isWindow?s.scrollLeft:s.offset.left,c=t.left-e.collisionPosition.marginLeft,u=c-l,p=c+e.collisionWidth-o-l,h="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,d="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];u<0?((n=t.left+h+d+f+e.collisionWidth-o-r)<0||n<a(u))&&(t.left+=h+d+f):p>0&&((i=t.left-e.collisionPosition.marginLeft+h+d+f-l)>0||a(i)<p)&&(t.left+=h+d+f)},top:function(t,e){var n,i,s=e.within,r=s.offset.top+s.scrollTop,o=s.height,l=s.isWindow?s.scrollTop:s.offset.top,c=t.top-e.collisionPosition.marginTop,u=c-l,p=c+e.collisionHeight-o-l,h="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,d="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,f=-2*e.offset[1];u<0?((i=t.top+h+d+f+e.collisionHeight-o-r)<0||i<a(u))&&(t.top+=h+d+f):p>0&&((n=t.top-e.collisionPosition.marginTop+h+d+f-l)>0||a(n)<p)&&(t.top+=h+d+f)}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,n,i,s,o,a=document.getElementsByTagName("body")[0],l=document.createElement("div");for(o in e=document.createElement(a?"div":"body"),i={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},a&&t.extend(i,{position:"absolute",left:"-1000px",top:"-1000px"}),i)e.style[o]=i[o];e.appendChild(l),(n=a||document.documentElement).insertBefore(e,n.firstChild),l.style.cssText="position: absolute; left: 10.7432222px;",s=t(l).offset().left,r=s>10&&s<11,e.innerHTML="",n.removeChild(e)}()}();t.ui.position;t.widget("ui.draggable",t.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(e){var n=this.options;return this._blurActiveElement(e),!(this.helper||n.disabled||t(e.target).closest(".ui-resizable-handle").length>0)&&(this.handle=this._getHandle(e),!!this.handle&&(this._blockFrames(!0===n.iframeFix?"iframe":n.iframeFix),!0))},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map((function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]}))},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var n=this.document[0];if(this.handleElement.is(e.target))try{n.activeElement&&"body"!==n.activeElement.nodeName.toLowerCase()&&t(n.activeElement).trigger("blur")}catch(t){}},_mouseStart:function(e){var n=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter((function(){return"fixed"===t(this).css("position")})).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),this._setContainment(),!1===this._trigger("start",e)?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._normalizeRightBottom(),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,n){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!n){var i=this._uiHash();if(!1===this._trigger("drag",e,i))return this._mouseUp({}),!1;this.position=i.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var n=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||!0===this.options.revert||i(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),(function(){!1!==n._trigger("stop",e)&&n._clear()})):!1!==this._trigger("stop",e)&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.focus(),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return!this.options.handle||!!t(e.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(e){var n=this.options,s=i(n.helper),r=s?t(n.helper.apply(this.element[0],[e])):"clone"===n.helper?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo("parent"===n.appendTo?this.element[0].parentNode:n.appendTo),s&&r[0]===this.element[0]&&this._setPositionRelative(),r[0]===this.element[0]||/(fixed|absolute)/.test(r.css("position"))||r.css("position","absolute"),r},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),Array.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),n=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==n&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,n,i,s=this.options,r=this.document[0];this.relativeContainer=null,s.containment?"window"!==s.containment?"document"!==s.containment?s.containment.constructor!==Array?("parent"===s.containment&&(s.containment=this.helper[0].parentNode),(i=(n=t(s.containment))[0])&&(e=/(scroll|auto)/.test(n.css("overflow")),this.containment=[(parseInt(n.css("borderLeftWidth"),10)||0)+(parseInt(n.css("paddingLeft"),10)||0),(parseInt(n.css("borderTopWidth"),10)||0)+(parseInt(n.css("paddingTop"),10)||0),(e?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(n.css("borderRightWidth"),10)||0)-(parseInt(n.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(n.css("borderBottomWidth"),10)||0)-(parseInt(n.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=n)):this.containment=s.containment:this.containment=[0,0,t(r).width()-this.helperProportions.width-this.margins.left,(t(r).height()||r.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||r.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=null},_convertPositionTo:function(t,e){e||(e=this.position);var n="absolute"===t?1:-1,i=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.offset.scroll.top:i?0:this.offset.scroll.top)*n,left:e.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.offset.scroll.left:i?0:this.offset.scroll.left)*n}},_generatePosition:function(t,e){var n,i,s,r,o=this.options,a=this._isRootNode(this.scrollParent[0]),l=t.pageX,c=t.pageY;return a&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(i=this.relativeContainer.offset(),n=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]):n=this.containment,t.pageX-this.offset.click.left<n[0]&&(l=n[0]+this.offset.click.left),t.pageY-this.offset.click.top<n[1]&&(c=n[1]+this.offset.click.top),t.pageX-this.offset.click.left>n[2]&&(l=n[2]+this.offset.click.left),t.pageY-this.offset.click.top>n[3]&&(c=n[3]+this.offset.click.top)),o.grid&&(s=o.grid[1]?this.originalPageY+Math.round((c-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,c=n?s-this.offset.click.top>=n[1]||s-this.offset.click.top>n[3]?s:s-this.offset.click.top>=n[1]?s-o.grid[1]:s+o.grid[1]:s,r=o.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,l=n?r-this.offset.click.left>=n[0]||r-this.offset.click.left>n[2]?r:r-this.offset.click.left>=n[0]?r-o.grid[0]:r+o.grid[0]:r),"y"===o.axis&&(l=this.originalPageX),"x"===o.axis&&(c=this.originalPageY)),{top:c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:a?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:a?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(e,n,i){return i=i||this._uiHash(),t.ui.plugin.call(this,e,[n,i,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),i.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,n,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,n,i){var s=t.extend({},n,{item:i.element});i.sortables=[],t(i.options.connectToSortable).each((function(){var n=t(this).sortable("instance");n&&!n.options.disabled&&(i.sortables.push(n),n.refreshPositions(),n._trigger("activate",e,s))}))},stop:function(e,n,i){var s=t.extend({},n,{item:i.element});i.cancelHelperRemoval=!1,t.each(i.sortables,(function(){var t=this;t.isOver?(t.isOver=0,i.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,s))}))},drag:function(e,n,i){t.each(i.sortables,(function(){var s=!1,r=this;r.positionAbs=i.positionAbs,r.helperProportions=i.helperProportions,r.offset.click=i.offset.click,r._intersectsWith(r.containerCache)&&(s=!0,t.each(i.sortables,(function(){return this.positionAbs=i.positionAbs,this.helperProportions=i.helperProportions,this.offset.click=i.offset.click,this!==r&&this._intersectsWith(this.containerCache)&&t.contains(r.element[0],this.element[0])&&(s=!1),s}))),s?(r.isOver||(r.isOver=1,i._parent=n.helper.parent(),r.currentItem=n.helper.appendTo(r.element).data("ui-sortable-item",!0),r.options._helper=r.options.helper,r.options.helper=function(){return n.helper[0]},e.target=r.currentItem[0],r._mouseCapture(e,!0),r._mouseStart(e,!0,!0),r.offset.click.top=i.offset.click.top,r.offset.click.left=i.offset.click.left,r.offset.parent.left-=i.offset.parent.left-r.offset.parent.left,r.offset.parent.top-=i.offset.parent.top-r.offset.parent.top,i._trigger("toSortable",e),i.dropped=r.element,t.each(i.sortables,(function(){this.refreshPositions()})),i.currentItem=i.element,r.fromOutside=i),r.currentItem&&(r._mouseDrag(e),n.position=r.position)):r.isOver&&(r.isOver=0,r.cancelHelperRemoval=!0,r.options._revert=r.options.revert,r.options.revert=!1,r._trigger("out",e,r._uiHash(r)),r._mouseStop(e,!0),r.options.revert=r.options._revert,r.options.helper=r.options._helper,r.placeholder&&r.placeholder.remove(),n.helper.appendTo(i._parent),i._refreshOffsets(e),n.position=i._generatePosition(e,!0),i._trigger("fromSortable",e),i.dropped=!1,t.each(i.sortables,(function(){this.refreshPositions()})))}))}}),t.ui.plugin.add("draggable","cursor",{start:function(e,n,i){var s=t("body"),r=i.options;s.css("cursor")&&(r._cursor=s.css("cursor")),s.css("cursor",r.cursor)},stop:function(e,n,i){var s=i.options;s._cursor&&t("body").css("cursor",s._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,n,i){var s=t(n.helper),r=i.options;s.css("opacity")&&(r._opacity=s.css("opacity")),s.css("opacity",r.opacity)},stop:function(e,n,i){var s=i.options;s._opacity&&t(n.helper).css("opacity",s._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,n){n.scrollParentNotHidden||(n.scrollParentNotHidden=n.helper.scrollParent(!1)),n.scrollParentNotHidden[0]!==n.document[0]&&"HTML"!==n.scrollParentNotHidden[0].tagName&&(n.overflowOffset=n.scrollParentNotHidden.offset())},drag:function(e,n,i){var s=i.options,r=!1,o=i.scrollParentNotHidden[0],a=i.document[0];o!==a&&"HTML"!==o.tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+o.offsetHeight-e.pageY<s.scrollSensitivity?o.scrollTop=r=o.scrollTop+s.scrollSpeed:e.pageY-i.overflowOffset.top<s.scrollSensitivity&&(o.scrollTop=r=o.scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+o.offsetWidth-e.pageX<s.scrollSensitivity?o.scrollLeft=r=o.scrollLeft+s.scrollSpeed:e.pageX-i.overflowOffset.left<s.scrollSensitivity&&(o.scrollLeft=r=o.scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(e.pageY-t(a).scrollTop()<s.scrollSensitivity?r=t(a).scrollTop(t(a).scrollTop()-s.scrollSpeed):t(window).height()-(e.pageY-t(a).scrollTop())<s.scrollSensitivity&&(r=t(a).scrollTop(t(a).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(e.pageX-t(a).scrollLeft()<s.scrollSensitivity?r=t(a).scrollLeft(t(a).scrollLeft()-s.scrollSpeed):t(window).width()-(e.pageX-t(a).scrollLeft())<s.scrollSensitivity&&(r=t(a).scrollLeft(t(a).scrollLeft()+s.scrollSpeed)))),!1!==r&&t.ui.ddmanager&&!s.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,n,i){var s=i.options;i.snapElements=[],t(s.snap.constructor!==String?s.snap.items||":data(ui-draggable)":s.snap).each((function(){var e=t(this),n=e.offset();this!==i.element[0]&&i.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:n.top,left:n.left})}))},drag:function(e,n,i){var s,r,o,a,l,c,u,p,h,d,f=i.options,m=f.snapTolerance,g=n.offset.left,v=g+i.helperProportions.width,y=n.offset.top,b=y+i.helperProportions.height;for(h=i.snapElements.length-1;h>=0;h--)c=(l=i.snapElements[h].left-i.margins.left)+i.snapElements[h].width,p=(u=i.snapElements[h].top-i.margins.top)+i.snapElements[h].height,v<l-m||g>c+m||b<u-m||y>p+m||!t.contains(i.snapElements[h].item.ownerDocument,i.snapElements[h].item)?(i.snapElements[h].snapping&&i.options.snap.release&&i.options.snap.release.call(i.element,e,t.extend(i._uiHash(),{snapItem:i.snapElements[h].item})),i.snapElements[h].snapping=!1):("inner"!==f.snapMode&&(s=Math.abs(u-b)<=m,r=Math.abs(p-y)<=m,o=Math.abs(l-v)<=m,a=Math.abs(c-g)<=m,s&&(n.position.top=i._convertPositionTo("relative",{top:u-i.helperProportions.height,left:0}).top),r&&(n.position.top=i._convertPositionTo("relative",{top:p,left:0}).top),o&&(n.position.left=i._convertPositionTo("relative",{top:0,left:l-i.helperProportions.width}).left),a&&(n.position.left=i._convertPositionTo("relative",{top:0,left:c}).left)),d=s||r||o||a,"outer"!==f.snapMode&&(s=Math.abs(u-y)<=m,r=Math.abs(p-b)<=m,o=Math.abs(l-g)<=m,a=Math.abs(c-v)<=m,s&&(n.position.top=i._convertPositionTo("relative",{top:u,left:0}).top),r&&(n.position.top=i._convertPositionTo("relative",{top:p-i.helperProportions.height,left:0}).top),o&&(n.position.left=i._convertPositionTo("relative",{top:0,left:l}).left),a&&(n.position.left=i._convertPositionTo("relative",{top:0,left:c-i.helperProportions.width}).left)),!i.snapElements[h].snapping&&(s||r||o||a||d)&&i.options.snap.snap&&i.options.snap.snap.call(i.element,e,t.extend(i._uiHash(),{snapItem:i.snapElements[h].item})),i.snapElements[h].snapping=s||r||o||a||d)}}),t.ui.plugin.add("draggable","stack",{start:function(e,n,i){
var s,r=i.options,o=t.makeArray(t(r.stack)).sort((function(e,n){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(n).css("zIndex"),10)||0)}));o.length&&(s=parseInt(t(o[0]).css("zIndex"),10)||0,t(o).each((function(e){t(this).css("zIndex",s+e)})),this.css("zIndex",s+o.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,n,i){var s=t(n.helper),r=i.options;s.css("zIndex")&&(r._zIndex=s.css("zIndex")),s.css("zIndex",r.zIndex)},stop:function(e,n,i){var s=i.options;s._zIndex&&t(n.helper).css("zIndex",s._zIndex)}});t.ui.draggable;t.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,e=this.options,n=e.accept;this.isover=!1,this.isout=!0,this.accept=i(n)?n:function(t){return t.is(n)},this.proportions=function(){if(!arguments.length)return t||(t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight});t=arguments[0]},this._addToManager(e.scope),e.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;e<t.length;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(e,n){if("accept"===e)this.accept=i(n)?n:function(t){return t.is(n)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(n)}this._super(e,n)},_activate:function(e){var n=t.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),n&&this._trigger("activate",e,this.ui(n))},_deactivate:function(e){var n=t.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),n&&this._trigger("deactivate",e,this.ui(n))},_over:function(e){var n=t.ui.ddmanager.current;n&&(n.currentItem||n.element)[0]!==this.element[0]&&this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",e,this.ui(n)))},_out:function(e){var n=t.ui.ddmanager.current;n&&(n.currentItem||n.element)[0]!==this.element[0]&&this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",e,this.ui(n)))},_drop:function(e,n){var i=n||t.ui.ddmanager.current,s=!1;return!(!i||(i.currentItem||i.element)[0]===this.element[0])&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each((function(){var n=t(this).droppable("instance");if(n.options.greedy&&!n.options.disabled&&n.options.scope===i.options.scope&&n.accept.call(n.element[0],i.currentItem||i.element)&&t.ui.intersect(i,t.extend(n,{offset:n.element.offset()}),n.options.tolerance,e))return s=!0,!1})),!s&&(!!this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",e,this.ui(i)),this.element)))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}}}),t.ui.intersect=function(){function t(t,e,n){return t>=e&&t<e+n}return function(e,n,i,s){if(!n.offset)return!1;var r=(e.positionAbs||e.position.absolute).left+e.margins.left,o=(e.positionAbs||e.position.absolute).top+e.margins.top,a=r+e.helperProportions.width,l=o+e.helperProportions.height,c=n.offset.left,u=n.offset.top,p=c+n.proportions().width,h=u+n.proportions().height;switch(i){case"fit":return c<=r&&a<=p&&u<=o&&l<=h;case"intersect":return c<r+e.helperProportions.width/2&&a-e.helperProportions.width/2<p&&u<o+e.helperProportions.height/2&&l-e.helperProportions.height/2<h;case"pointer":return t(s.pageY,u,n.proportions().height)&&t(s.pageX,c,n.proportions().width);case"touch":return(o>=u&&o<=h||l>=u&&l<=h||o<u&&l>h)&&(r>=c&&r<=p||a>=c&&a<=p||r<c&&a>p);default:return!1}}}(),t.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(e,n){var i,s,r=t.ui.ddmanager.droppables[e.options.scope]||[],o=n?n.type:null,a=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(i=0;i<r.length;i++)if(!(r[i].options.disabled||e&&!r[i].accept.call(r[i].element[0],e.currentItem||e.element))){for(s=0;s<a.length;s++)if(a[s]===r[i].element[0]){r[i].proportions().height=0;continue t}r[i].visible="none"!==r[i].element.css("display"),r[i].visible&&("mousedown"===o&&r[i]._activate.call(r[i],n),r[i].offset=r[i].element.offset(),r[i].proportions({width:r[i].element[0].offsetWidth,height:r[i].element[0].offsetHeight}))}},drop:function(e,n){var i=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),(function(){this.options&&(!this.options.disabled&&this.visible&&t.ui.intersect(e,this,this.options.tolerance,n)&&(i=this._drop.call(this,n)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,n)))})),i},dragStart:function(e,n){e.element.parentsUntil("body").on("scroll.droppable",(function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,n)}))},drag:function(e,n){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,n),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],(function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var i,s,r,o=t.ui.intersect(e,this,this.options.tolerance,n),a=!o&&this.isover?"isout":o&&!this.isover?"isover":null;a&&(this.options.greedy&&(s=this.options.scope,(r=this.element.parents(":data(ui-droppable)").filter((function(){return t(this).droppable("instance").options.scope===s}))).length&&((i=t(r[0]).droppable("instance")).greedyChild="isover"===a)),i&&"isover"===a&&(i.isover=!1,i.isout=!0,i._out.call(i,n)),this[a]=!0,this["isout"===a?"isover":"isout"]=!1,this["isover"===a?"_over":"_out"].call(this,n),i&&"isout"===a&&(i.isout=!1,i.isover=!0,i._over.call(i,n)))}}))},dragStop:function(e,n){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,n)}};t.ui.droppable,t.widget("ui.sortable",t.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,n){return t>=e&&t<e+n},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),t.each(this.items,(function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")}))},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,n){var i=null,s=!1,r=this;return!this.reverting&&(!this.options.disabled&&"static"!==this.options.type&&(this._refreshItems(e),t(e.target).parents().each((function(){if(t.data(this,r.widgetName+"-item")===r)return i=t(this),!1})),t.data(e.target,r.widgetName+"-item")===r&&(i=t(e.target)),!!i&&(!(this.options.handle&&!n&&(t(this.options.handle,i).find("*").addBack().each((function(){this===e.target&&(s=!0)})),!s))&&(this.currentItem=i,this._removeCurrentsFromItems(),!0))))},_mouseStart:function(e,n,i){var s,r,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(r=this.document.find("body"),this.storedCursor=r.css("cursor"),r.css("cursor",o.cursor),this.storedStylesheet=t("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(r)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;s>=0;s--)this.containers[s]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var n,i,s,r,o=this.options,a=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop+o.scrollSpeed:e.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft+o.scrollSpeed:e.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(e.pageY-this.document.scrollTop()<o.scrollSensitivity?a=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<o.scrollSensitivity&&(a=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),e.pageX-this.document.scrollLeft()<o.scrollSensitivity?a=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(a=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),!1!==a&&t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),n=this.items.length-1;n>=0;n--)if(s=(i=this.items[n]).item[0],(r=this._intersectsWithPointer(i))&&i.instance===this.currentContainer&&!(s===this.currentItem[0]||this.placeholder[1===r?"next":"prev"]()[0]===s||t.contains(this.placeholder[0],s)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],s))){if(this.direction=1===r?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;this._rearrange(e,i),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,n){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var i=this,s=this.placeholder.offset(),r=this.options.axis,o={};r&&"x"!==r||(o.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),r&&"y"!==r||(o.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(o,parseInt(this.options.revert,10)||500,(function(){i._clear(e)}))}else this._clear(e,n);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var n=this._getItemsAsjQuery(e&&e.connected),i=[];return e=e||{},t(n).each((function(){var n=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);n&&i.push((e.key||n[1]+"[]")+"="+(e.key&&e.expression?n[1]:n[2]))})),!i.length&&e.key&&i.push(e.key+"="),i.join("&")},toArray:function(e){var n=this._getItemsAsjQuery(e&&e.connected),i=[];return e=e||{},n.each((function(){i.push(t(e.item||this).attr(e.attribute||"id")||"")})),i},_intersectsWith:function(t){var e=this.positionAbs.left,n=e+this.helperProportions.width,i=this.positionAbs.top,s=i+this.helperProportions.height,r=t.left,o=r+t.width,a=t.top,l=a+t.height,c=this.offset.click.top,u=this.offset.click.left,p="x"===this.options.axis||i+c>a&&i+c<l,h="y"===this.options.axis||e+u>r&&e+u<o,d=p&&h;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?d:r<e+this.helperProportions.width/2&&n-this.helperProportions.width/2<o&&a<i+this.helperProportions.height/2&&s-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),i=e&&n,s=this._getDragVerticalDirection(),r=this._getDragHorizontalDirection();return!!i&&(this.floating?r&&"right"===r||"down"===s?2:1:s&&("down"===s?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),n=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),i=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return this.floating&&s?"right"===s&&n||"left"===s&&!n:i&&("down"===i&&e||"up"===i&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function n(){l.push(this)}var s,r,o,a,l=[],c=[],u=this._connectWith();if(u&&e)for(s=u.length-1;s>=0;s--)for(r=(o=t(u[s],this.document[0])).length-1;r>=0;r--)(a=t.data(o[r],this.widgetFullName))&&a!==this&&!a.options.disabled&&c.push([i(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(c.push([i(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=c.length-1;s>=0;s--)c[s][0].each(n);return t(l)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,(function(t){for(var n=0;n<e.length;n++)if(e[n]===t.item[0])return!1;return!0}))},_refreshItems:function(e){this.items=[],this.containers=[this];var n,s,r,o,a,l,c,u,p=this.items,h=[[i(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(n=d.length-1;n>=0;n--)for(s=(r=t(d[n],this.document[0])).length-1;s>=0;s--)(o=t.data(r[s],this.widgetFullName))&&o!==this&&!o.options.disabled&&(h.push([i(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(n=h.length-1;n>=0;n--)for(a=h[n][1],s=0,u=(l=h[n][0]).length;s<u;s++)(c=t(l[s])).data(this.widgetName+"-item",a),p.push({item:c,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){var n,i,s,r;for(this.floating=!!this.items.length&&("x"===this.options.axis||this._isFloating(this.items[0].item)),this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),n=this.items.length-1;n>=0;n--)(i=this.items[n]).instance!==this.currentContainer&&this.currentContainer&&i.item[0]!==this.currentItem[0]||(s=this.options.toleranceElement?t(this.options.toleranceElement,i.item):i.item,e||(i.width=s.outerWidth(),i.height=s.outerHeight()),r=s.offset(),i.left=r.left,i.top=r.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(n=this.containers.length-1;n>=0;n--)r=this.containers[n].element.offset(),this.containers[n].containerCache.left=r.left,this.containers[n].containerCache.top=r.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight();return this},_createPlaceholder:function(e){var n,i=(e=e||this).options;i.placeholder&&i.placeholder.constructor!==String||(n=i.placeholder,i.placeholder={element:function(){var i=e.currentItem[0].nodeName.toLowerCase(),s=t("<"+i+">",e.document[0]).addClass(n||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===i?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(s)):"tr"===i?e._createTrPlaceholder(e.currentItem,s):"img"===i&&s.attr("src",e.currentItem.attr("src")),n||s.css("visibility","hidden"),s},update:function(t,s){n&&!i.forcePlaceholderSize||(s.height()||s.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),s.width()||s.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(i.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),i.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,n){var i=this;e.children().each((function(){t("<td>&#160;</td>",i.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(n)}))},_contactContainers:function(e){var n,i,s,r,o,a,l,c,u,p,h=null,d=null;for(n=this.containers.length-1;n>=0;n--)if(!t.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(h&&t.contains(this.containers[n].element[0],h.element[0]))continue;h=this.containers[n],d=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",e,this._uiHash(this)),this.containers[n].containerCache.over=0);if(h)if(1===this.containers.length)this.containers[d].containerCache.over||(this.containers[d]._trigger("over",e,this._uiHash(this)),this.containers[d].containerCache.over=1);else{for(s=1e4,r=null,o=(u=h.floating||this._isFloating(this.currentItem))?"left":"top",a=u?"width":"height",p=u?"clientX":"clientY",i=this.items.length-1;i>=0;i--)t.contains(this.containers[d].element[0],this.items[i].item[0])&&this.items[i].item[0]!==this.currentItem[0]&&(l=this.items[i].item.offset()[o],c=!1,e[p]-l>this.items[i][a]/2&&(c=!0),Math.abs(e[p]-l)<s&&(s=Math.abs(e[p]-l),r=this.items[i],this.direction=c?"up":"down"));if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[d])return void(this.currentContainer.containerCache.over||(this.containers[d]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1));r?this._rearrange(e,r,null,!0):this._rearrange(e,null,this.containers[d].element,!0),this._trigger("change",e,this._uiHash()),this.containers[d]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[d],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",e,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(e){var n=this.options,s=i(n.helper)?t(n.helper.apply(this.element[0],[e,this.currentItem])):"clone"===n.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==n.appendTo?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),s[0].style.width&&!n.forceHelperSize||s.width(this.currentItem.width()),s[0].style.height&&!n.forceHelperSize||s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),Array.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,n,i,s=this.options;"parent"===s.containment&&(s.containment=this.helper[0].parentNode),"document"!==s.containment&&"window"!==s.containment||(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===s.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===s.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(s.containment)||(e=t(s.containment)[0],n=t(s.containment).offset(),i="hidden"!==t(e).css("overflow"),this.containment=[n.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,n.left+(i?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(i?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,n){n||(n=this.position);var i="absolute"===e?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,r=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():r?0:s.scrollTop())*i,left:n.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():r?0:s.scrollLeft())*i}},_generatePosition:function(e){var n,i,s=this.options,r=e.pageX,o=e.pageY,a="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(a[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(r=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(r=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),s.grid&&(n=this.originalPageY+Math.round((o-this.originalPageY)/s.grid[1])*s.grid[1],o=this.containment?n-this.offset.click.top>=this.containment[1]&&n-this.offset.click.top<=this.containment[3]?n:n-this.offset.click.top>=this.containment[1]?n-s.grid[1]:n+s.grid[1]:n,i=this.originalPageX+Math.round((r-this.originalPageX)/s.grid[0])*s.grid[0],r=this.containment?i-this.offset.click.left>=this.containment[0]&&i-this.offset.click.left<=this.containment[2]?i:i-this.offset.click.left>=this.containment[0]?i-s.grid[0]:i+s.grid[0]:i)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:a.scrollTop()),left:r-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:a.scrollLeft())}},_rearrange:function(t,e,n,i){n?n[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var s=this.counter;this._delay((function(){s===this.counter&&this.refreshPositions(!i)}))},_clear:function(t,e){function n(t,e,n){return function(i){n._trigger(t,i,e._uiHash(e))}}this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&s.push((function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))})),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push((function(t){this._trigger("update",t,this._uiHash())})),this!==this.currentContainer&&(e||(s.push((function(t){this._trigger("remove",t,this._uiHash())})),s.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)e||s.push(n("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(n("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i<s.length;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===t.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(e){var n=e||this;return{helper:n.helper,placeholder:n.placeholder||t([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:e?e.element:null}}}),t.widget("ui.accordion",{version:"1.11.4",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),e.collapsible||!1!==e.active&&null!=e.active||(e.active=0),this._processPanels(),e.active<0&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e=this.options.icons;e&&(t("<span>").addClass("ui-accordion-header-icon ui-icon "+e.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(e.header).addClass(e.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),
t=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),"disabled"===t&&(this.element.toggleClass("ui-state-disabled",!!e).attr("aria-disabled",e),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!e))):this._activate(e)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var n=t.ui.keyCode,i=this.headers.length,s=this.headers.index(e.target),r=!1;switch(e.keyCode){case n.RIGHT:case n.DOWN:r=this.headers[(s+1)%i];break;case n.LEFT:case n.UP:r=this.headers[(s-1+i)%i];break;case n.SPACE:case n.ENTER:this._eventHandler(e);break;case n.HOME:r=this.headers[0];break;case n.END:r=this.headers[i-1]}r&&(t(e.target).attr("tabIndex",-1),t(r).attr("tabIndex",0),r.focus(),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),!1===e.active&&!0===e.collapsible||!this.headers.length?(e.active=!1,this.active=t()):!1===e.active?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,n=this.options,i=n.heightStyle,s=this.element.parent();this.active=this._findActive(n.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each((function(){var e=t(this),n=e.uniqueId().attr("id"),i=e.next(),s=i.uniqueId().attr("id");e.attr("aria-controls",s),i.attr("aria-labelledby",n)})).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(n.event),"fill"===i?(e=s.height(),this.element.siblings(":visible").each((function(){var n=t(this),i=n.css("position");"absolute"!==i&&"fixed"!==i&&(e-=n.outerHeight(!0))})),this.headers.each((function(){e-=t(this).outerHeight(!0)})),this.headers.next().each((function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))})).css("overflow","auto")):"auto"===i&&(e=0,this.headers.next().each((function(){e=Math.max(e,t(this).css("height","").height())})).height(e))},_activate:function(e){var n=this._findActive(e)[0];n!==this.active[0]&&(n=n||this.active[0],this._eventHandler({target:n,currentTarget:n,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var n={keydown:"_keydown"};e&&t.each(e.split(" "),(function(t,e){n[e]="_eventHandler"})),this._off(this.headers.add(this.headers.next())),this._on(this.headers,n),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var n=this.options,i=this.active,s=t(e.currentTarget),r=s[0]===i[0],o=r&&n.collapsible,a=o?t():s.next(),l=i.next(),c={oldHeader:i,oldPanel:l,newHeader:o?t():s,newPanel:a};e.preventDefault(),r&&!n.collapsible||!1===this._trigger("beforeActivate",e,c)||(n.active=!o&&this.headers.index(s),this.active=r?t():s,this._toggle(c),i.removeClass("ui-accordion-header-active ui-state-active"),n.icons&&i.children(".ui-accordion-header-icon").removeClass(n.icons.activeHeader).addClass(n.icons.header),r||(s.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),n.icons&&s.children(".ui-accordion-header-icon").removeClass(n.icons.header).addClass(n.icons.activeHeader),s.next().addClass("ui-accordion-content-active")))},_toggle:function(e){var n=e.newPanel,i=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=n,this.prevHide=i,this.options.animate?this._animate(n,i,e):(i.hide(),n.show(),this._toggleComplete(e)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),n.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):n.length&&this.headers.filter((function(){return 0===parseInt(t(this).attr("tabIndex"),10)})).attr("tabIndex",-1),n.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,n){var i,s,r,o=this,a=0,l=t.css("box-sizing"),c=t.length&&(!e.length||t.index()<e.index()),u=this.options.animate||{},p=c&&u.down||u,h=function(){o._toggleComplete(n)};return"number"==typeof p&&(r=p),"string"==typeof p&&(s=p),s=s||p.easing||u.easing,r=r||p.duration||u.duration,e.length?t.length?(i=t.show().outerHeight(),e.animate(this.hideProps,{duration:r,easing:s,step:function(t,e){e.now=Math.round(t)}}),void t.hide().animate(this.showProps,{duration:r,easing:s,complete:h,step:function(t,n){n.now=Math.round(t),"height"!==n.prop?"content-box"===l&&(a+=n.now):"content"!==o.options.heightStyle&&(n.now=Math.round(i-e.outerHeight()-a),a=0)}})):e.animate(this.hideProps,r,s,h):t.animate(this.showProps,r,s,h)},_toggleComplete:function(t){var e=t.oldPanel;e.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var n=t(e.target);!this.mouseHandled&&n.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),n.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&t(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var n=t(e.currentTarget);n.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(e,n)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var n=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,n)},blur:function(e){this._delay((function(){t.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(e)}))},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each((function(){var e=t(this);e.data("ui-menu-submenu-carat")&&e.remove()})),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(e){var n,i,s,r,o=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:o=!1,i=this.previousFilter||"",s=String.fromCharCode(e.keyCode),r=!1,clearTimeout(this.filterTimer),s===i?r=!0:s=i+s,n=this._filterMenuItems(s),(n=r&&-1!==n.index(this.active.next())?this.active.nextAll(".ui-menu-item"):n).length||(s=String.fromCharCode(e.keyCode),n=this._filterMenuItems(s)),n.length?(this.focus(e,n),this.previousFilter=s,this.filterTimer=this._delay((function(){delete this.previousFilter}),1e3)):delete this.previousFilter}o&&e.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(t):this.select(t))},refresh:function(){var e,n=this,i=this.options.icons.submenu,s=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each((function(){var e=t(this),n=e.parent(),s=t("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);n.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",n.attr("id"))})),(e=s.add(this.element).find(this.options.items)).not(".ui-menu-item").each((function(){var e=t(this);n._isDivider(e)&&e.addClass("ui-widget-content ui-menu-divider")})),e.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),e.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){"icons"===t&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(e.submenu),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!e).attr("aria-disabled",e),this._super(t,e)},focus:function(t,e){var n,i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay((function(){this._close()}),this.delay),(n=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(n),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var n,i,s,r,o,a;this._hasScroll()&&(n=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,i=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,s=e.offset().top-this.activeMenu.offset().top-n-i,r=this.activeMenu.scrollTop(),o=this.activeMenu.height(),a=e.outerHeight(),s<0?this.activeMenu.scrollTop(r+s):s+a>o&&this.activeMenu.scrollTop(r+s-o+a))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",t,{item:this.active}))},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay((function(){this._close(),this._open(t)}),this.delay))},_open:function(e){var n=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(n)},collapseAll:function(e,n){clearTimeout(this.timer),this.timer=this._delay((function(){var i=n?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));i.length||(i=this.element),this._close(i),this.blur(e),this.activeMenu=i}),this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay((function(){this.focus(t,e)})))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,n){var i;this.active&&(i="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),i&&i.length&&this.active||(i=this.activeMenu.find(this.options.items)[e]()),this.focus(n,i)},nextPage:function(e){var n,i,s;this.active?this.isLastItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.height(),this.active.nextAll(".ui-menu-item").each((function(){return(n=t(this)).offset().top-i-s<0})),this.focus(e,n)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())):this.next(e)},previousPage:function(e){var n,i,s;this.active?this.isFirstItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.height(),this.active.prevAll(".ui-menu-item").each((function(){return(n=t(this)).offset().top-i+s>0})),this.focus(e,n)):this.focus(e,this.activeMenu.find(this.options.items).first())):this.next(e)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var n={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,n)},_filterMenuItems:function(e){var n=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),i=new RegExp("^"+n,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter((function(){return i.test(t(this).text().trim())}))}});t.widget("ui.autocomplete",{version:"1.11.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,n,i,s=this.element[0].nodeName.toLowerCase(),r="textarea"===s,o="input"===s;this.isMultiLine=!!r||!o&&this.element.prop("isContentEditable"),this.valueMethod=this.element[r||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(s){if(this.element.prop("readOnly"))return e=!0,i=!0,void(n=!0);e=!1,i=!1,n=!1;var r=t.ui.keyCode;switch(s.keyCode){case r.PAGE_UP:e=!0,this._move("previousPage",s);break;case r.PAGE_DOWN:e=!0,this._move("nextPage",s);break;case r.UP:e=!0,this._keyEvent("previous",s);break;case r.DOWN:e=!0,this._keyEvent("next",s);break;case r.ENTER:this.menu.active&&(e=!0,s.preventDefault(),this.menu.select(s));break;case r.TAB:this.menu.active&&this.menu.select(s);break;case r.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(s),s.preventDefault());break;default:n=!0,this._searchTimeout(s)}},keypress:function(i){if(e)return e=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||i.preventDefault());if(!n){var s=t.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:this._move("previousPage",i);break;case s.PAGE_DOWN:this._move("nextPage",i);break;case s.UP:this._keyEvent("previous",i);break;case s.DOWN:this._keyEvent("next",i)}}},input:function(t){if(i)return i=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(clearTimeout(this.searching),this.close(t),this._change(t))}}),this._initSource(),this.menu=t("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay((function(){delete this.cancelBlur}));var n=this.menu.element[0];t(e.target).closest(".ui-menu-item").length||this._delay((function(){var e=this;this.document.one("mousedown",(function(i){i.target===e.element[0]||i.target===n||t.contains(n,i.target)||e.close()}))}))},menufocus:function(e,n){var i,s;if(this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",(function(){t(e.target).trigger(e.originalEvent)}));s=n.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:s})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(s.value),(i=n.item.attr("aria-label")||s.value)&&i.trim().length&&(this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))},menuselect:function(t,e){var n=e.item.data("ui-autocomplete-item"),i=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.trigger("focus"),this.previous=i,this._delay((function(){this.previous=i,this.selectedItem=n}))),!1!==this._trigger("select",t,{item:n})&&this._value(n.value),this.term=this._value(),this.close(t),this.selectedItem=n}}),this.liveRegion=t("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,n,i=this;Array.isArray(this.options.source)?(e=this.options.source,this.source=function(n,i){i(t.ui.autocomplete.filter(e,n.term))}):"string"==typeof this.options.source?(n=this.options.source,this.source=function(e,s){i.xhr&&i.xhr.abort(),i.xhr=t.ajax({url:n,data:e,dataType:"json",success:function(t){s(t)},error:function(){s([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay((function(){var e=this.term===this._value(),n=this.menu.element.is(":visible"),i=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;e&&(!e||n||i)||(this.selectedItem=null,this.search(null,t))}),this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):!1!==this._trigger("search",e)?this._search(t):void 0},_search:function(t){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy((function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")}),this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,(function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})}))},_suggest:function(e){var n=this.menu.element.empty();this._renderMenu(n,e),this.isNewMenu=!0,this.menu.refresh(),n.show(),this._resizeMenu(),n.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,n){var i=this;t.each(n,(function(t,n){i._renderItemData(e,n)}))},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,n){return t("<li>").text(n.label).appendTo(e)},_move:function(t,e){if(this.menu.element.is(":visible"))return this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e);this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,n){var i=new RegExp(t.ui.autocomplete.escapeRegex(n),"i");return t.grep(e,(function(t){return i.test(t.label||t.value||t)}))}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var n;this._superApply(arguments),this.options.disabled||this.cancelSearch||(n=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(n).appendTo(this.liveRegion))}});t.ui.autocomplete})),function(){function t(t){function e(e,n,i,s,r,o){for(;r>=0&&r<o;r+=t){var a=s?s[r]:r;i=n(i,e[a],a,e)}return i}return function(n,i,s,r){i=b(i,r,4);var o=!S(n)&&y.keys(n),a=(o||n).length,l=t>0?0:a-1;return arguments.length<3&&(s=n[o?o[l]:l],l+=t),e(n,i,s,o,l,a)}}function e(t){return function(e,n,i){n=_(n,i);for(var s=T(e),r=t>0?0:s-1;r>=0&&r<s;r+=t)if(n(e[r],r,e))return r;return-1}}function n(t,e,n){return function(i,s,r){var o=0,a=T(i);if("number"==typeof r)t>0?o=r>=0?r:Math.max(r+a,o):a=r>=0?Math.min(r+1,a):r+a+1;else if(n&&r&&a)return i[r=n(i,s)]===s?r:-1;if(s!=s)return(r=e(u.call(i,o,a),y.isNaN))>=0?r+o:-1;for(r=t>0?o:a-1;r>=0&&r<a;r+=t)if(i[r]===s)return r;return-1}}function i(t,e){var n=E.length,i=t.constructor,s=y.isFunction(i)&&i.prototype||a,r="constructor";for(y.has(t,r)&&!y.contains(e,r)&&e.push(r);n--;)(r=E[n])in t&&t[r]!==s[r]&&!y.contains(e,r)&&e.push(r)}var s=this,r=s._,o=Array.prototype,a=Object.prototype,l=Function.prototype,c=o.push,u=o.slice,p=a.toString,h=a.hasOwnProperty,d=Array.isArray,f=Object.keys,m=l.bind,g=Object.create,v=function(){},y=function(t){return t instanceof y?t:this instanceof y?void(this._wrapped=t):new y(t)};"undefined"!=typeof exports?(void 0!==module&&module.exports&&(exports=module.exports=y),exports._=y):s._=y,y.VERSION="1.8.3";var b=function(t,e,n){if(void 0===e)return t;switch(null==n?3:n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,s){return t.call(e,n,i,s)};case 4:return function(n,i,s,r){return t.call(e,n,i,s,r)}}return function(){return t.apply(e,arguments)}},_=function(t,e,n){return null==t?y.identity:y.isFunction(t)?b(t,e,n):y.isObject(t)?y.matcher(t):y.property(t)};y.iteratee=function(t,e){return _(t,e,1/0)};var w=function(t,e){return function(n){var i=arguments.length;if(i<2||null==n)return n;for(var s=1;s<i;s++)for(var r=arguments[s],o=t(r),a=o.length,l=0;l<a;l++){var c=o[l];e&&void 0!==n[c]||(n[c]=r[c])}return n}},k=function(t){if(!y.isObject(t))return{};if(g)return g(t);v.prototype=t;var e=new v;return v.prototype=null,e},A=function(t){return function(e){return null==e?void 0:e[t]}},C=Math.pow(2,53)-1,T=A("length"),S=function(t){var e=T(t);return"number"==typeof e&&e>=0&&e<=C};y.each=y.forEach=function(t,e,n){var i,s;if(e=b(e,n),S(t))for(i=0,s=t.length;i<s;i++)e(t[i],i,t);else{var r=y.keys(t);for(i=0,s=r.length;i<s;i++)e(t[r[i]],r[i],t)}return t},y.map=y.collect=function(t,e,n){e=_(e,n);for(var i=!S(t)&&y.keys(t),s=(i||t).length,r=Array(s),o=0;o<s;o++){var a=i?i[o]:o;r[o]=e(t[a],a,t)}return r},y.reduce=y.foldl=y.inject=t(1),y.reduceRight=y.foldr=t(-1),y.find=y.detect=function(t,e,n){var i;if(void 0!==(i=S(t)?y.findIndex(t,e,n):y.findKey(t,e,n))&&-1!==i)return t[i]},y.filter=y.select=function(t,e,n){var i=[];return e=_(e,n),y.each(t,(function(t,n,s){e(t,n,s)&&i.push(t)})),i},y.reject=function(t,e,n){return y.filter(t,y.negate(_(e)),n)},y.every=y.all=function(t,e,n){e=_(e,n);for(var i=!S(t)&&y.keys(t),s=(i||t).length,r=0;r<s;r++){var o=i?i[r]:r;if(!e(t[o],o,t))return!1}return!0},y.some=y.any=function(t,e,n){e=_(e,n);for(var i=!S(t)&&y.keys(t),s=(i||t).length,r=0;r<s;r++){var o=i?i[r]:r;if(e(t[o],o,t))return!0}return!1},y.contains=y.includes=y.include=function(t,e,n,i){return S(t)||(t=y.values(t)),("number"!=typeof n||i)&&(n=0),y.indexOf(t,e,n)>=0},y.invoke=function(t,e){var n=u.call(arguments,2),i=y.isFunction(e);return y.map(t,(function(t){var s=i?e:t[e];return null==s?s:s.apply(t,n)}))},y.pluck=function(t,e){return y.map(t,y.property(e))},y.where=function(t,e){return y.filter(t,y.matcher(e))},y.findWhere=function(t,e){return y.find(t,y.matcher(e))},y.max=function(t,e,n){var i,s,r=-1/0,o=-1/0;if(null==e&&null!=t)for(var a=0,l=(t=S(t)?t:y.values(t)).length;a<l;a++)(i=t[a])>r&&(r=i);else e=_(e,n),y.each(t,(function(t,n,i){((s=e(t,n,i))>o||s===-1/0&&r===-1/0)&&(r=t,o=s)}));return r},y.min=function(t,e,n){var i,s,r=1/0,o=1/0;if(null==e&&null!=t)for(var a=0,l=(t=S(t)?t:y.values(t)).length;a<l;a++)(i=t[a])<r&&(r=i);else e=_(e,n),y.each(t,(function(t,n,i){((s=e(t,n,i))<o||s===1/0&&r===1/0)&&(r=t,o=s)}));return r},y.shuffle=function(t){for(var e,n=S(t)?t:y.values(t),i=n.length,s=Array(i),r=0;r<i;r++)(e=y.random(0,r))!==r&&(s[r]=s[e]),s[e]=n[r];return s},y.sample=function(t,e,n){return null==e||n?(S(t)||(t=y.values(t)),t[y.random(t.length-1)]):y.shuffle(t).slice(0,Math.max(0,e))},y.sortBy=function(t,e,n){return e=_(e,n),y.pluck(y.map(t,(function(t,n,i){return{value:t,index:n,criteria:e(t,n,i)}})).sort((function(t,e){var n=t.criteria,i=e.criteria;if(n!==i){if(n>i||void 0===n)return 1;if(n<i||void 0===i)return-1}return t.index-e.index})),"value")};var x=function(t){return function(e,n,i){var s={};return n=_(n,i),y.each(e,(function(i,r){var o=n(i,r,e);t(s,i,o)})),s}};y.groupBy=x((function(t,e,n){y.has(t,n)?t[n].push(e):t[n]=[e]})),y.indexBy=x((function(t,e,n){t[n]=e})),y.countBy=x((function(t,e,n){y.has(t,n)?t[n]++:t[n]=1})),y.toArray=function(t){return t?y.isArray(t)?u.call(t):S(t)?y.map(t,y.identity):y.values(t):[]},y.size=function(t){return null==t?0:S(t)?t.length:y.keys(t).length},y.partition=function(t,e,n){e=_(e,n);var i=[],s=[];return y.each(t,(function(t,n,r){(e(t,n,r)?i:s).push(t)})),[i,s]},y.first=y.head=y.take=function(t,e,n){if(null!=t)return null==e||n?t[0]:y.initial(t,t.length-e)},y.initial=function(t,e,n){return u.call(t,0,Math.max(0,t.length-(null==e||n?1:e)))},y.last=function(t,e,n){if(null!=t)return null==e||n?t[t.length-1]:y.rest(t,Math.max(0,t.length-e))},y.rest=y.tail=y.drop=function(t,e,n){return u.call(t,null==e||n?1:e)},y.compact=function(t){return y.filter(t,y.identity)};var j=function(t,e,n,i){for(var s=[],r=0,o=i||0,a=T(t);o<a;o++){var l=t[o];if(S(l)&&(y.isArray(l)||y.isArguments(l))){e||(l=j(l,e,n));var c=0,u=l.length;for(s.length+=u;c<u;)s[r++]=l[c++]}else n||(s[r++]=l)}return s};y.flatten=function(t,e){return j(t,e,!1)},y.without=function(t){return y.difference(t,u.call(arguments,1))},y.uniq=y.unique=function(t,e,n,i){y.isBoolean(e)||(i=n,n=e,e=!1),null!=n&&(n=_(n,i));for(var s=[],r=[],o=0,a=T(t);o<a;o++){var l=t[o],c=n?n(l,o,t):l;e?(o&&r===c||s.push(l),r=c):n?y.contains(r,c)||(r.push(c),s.push(l)):y.contains(s,l)||s.push(l)}return s},y.union=function(){return y.uniq(j(arguments,!0,!0))},y.intersection=function(t){for(var e=[],n=arguments.length,i=0,s=T(t);i<s;i++){var r=t[i];if(!y.contains(e,r)){for(var o=1;o<n&&y.contains(arguments[o],r);o++);o===n&&e.push(r)}}return e},y.difference=function(t){var e=j(arguments,!0,!0,1);return y.filter(t,(function(t){return!y.contains(e,t)}))},y.zip=function(){return y.unzip(arguments)},y.unzip=function(t){for(var e=t&&y.max(t,T).length||0,n=Array(e),i=0;i<e;i++)n[i]=y.pluck(t,i);return n},y.object=function(t,e){for(var n={},i=0,s=T(t);i<s;i++)e?n[t[i]]=e[i]:n[t[i][0]]=t[i][1];return n},y.findIndex=e(1),y.findLastIndex=e(-1),y.sortedIndex=function(t,e,n,i){for(var s=(n=_(n,i,1))(e),r=0,o=T(t);r<o;){var a=Math.floor((r+o)/2);n(t[a])<s?r=a+1:o=a}return r},y.indexOf=n(1,y.findIndex,y.sortedIndex),y.lastIndexOf=n(-1,y.findLastIndex),y.range=function(t,e,n){null==e&&(e=t||0,t=0),n=n||1;for(var i=Math.max(Math.ceil((e-t)/n),0),s=Array(i),r=0;r<i;r++,t+=n)s[r]=t;return s};var D=function(t,e,n,i,s){if(!(i instanceof e))return t.apply(n,s);var r=k(t.prototype),o=t.apply(r,s);return y.isObject(o)?o:r};y.bind=function(t,e){if(m&&t.bind===m)return m.apply(t,u.call(arguments,1));if(!y.isFunction(t))throw new TypeError("Bind must be called on a function");var n=u.call(arguments,2),i=function(){return D(t,i,e,this,n.concat(u.call(arguments)))};return i},y.partial=function(t){var e=u.call(arguments,1),n=function(){for(var i=0,s=e.length,r=Array(s),o=0;o<s;o++)r[o]=e[o]===y?arguments[i++]:e[o];for(;i<arguments.length;)r.push(arguments[i++]);return D(t,n,this,this,r)};return n},y.bindAll=function(t){var e,n,i=arguments.length;if(i<=1)throw new Error("bindAll must be passed function names");for(e=1;e<i;e++)t[n=arguments[e]]=y.bind(t[n],t);return t},y.memoize=function(t,e){var n=function(i){var s=n.cache,r=""+(e?e.apply(this,arguments):i);return y.has(s,r)||(s[r]=t.apply(this,arguments)),s[r]};return n.cache={},n},y.delay=function(t,e){var n=u.call(arguments,2);return setTimeout((function(){return t.apply(null,n)}),e)},y.defer=y.partial(y.delay,y,1),y.throttle=function(t,e,n){var i,s,r,o=null,a=0;n||(n={});var l=function(){a=!1===n.leading?0:y.now(),o=null,r=t.apply(i,s),o||(i=s=null)};return function(){var c=y.now();a||!1!==n.leading||(a=c);var u=e-(c-a);return i=this,s=arguments,u<=0||u>e?(o&&(clearTimeout(o),o=null),a=c,r=t.apply(i,s),o||(i=s=null)):o||!1===n.trailing||(o=setTimeout(l,u)),r}},y.debounce=function(t,e,n){var i,s,r,o,a,l=function(){var c=y.now()-o;c<e&&c>=0?i=setTimeout(l,e-c):(i=null,n||(a=t.apply(r,s),i||(r=s=null)))};return function(){r=this,s=arguments,o=y.now();var c=n&&!i;return i||(i=setTimeout(l,e)),c&&(a=t.apply(r,s),r=s=null),a}},y.wrap=function(t,e){return y.partial(e,t)},y.negate=function(t){return function(){return!t.apply(this,arguments)}},y.compose=function(){var t=arguments,e=t.length-1;return function(){
for(var n=e,i=t[e].apply(this,arguments);n--;)i=t[n].call(this,i);return i}},y.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},y.before=function(t,e){var n;return function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=null),n}},y.once=y.partial(y.before,2);var P=!{toString:null}.propertyIsEnumerable("toString"),E=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];y.keys=function(t){if(!y.isObject(t))return[];if(f)return f(t);var e=[];for(var n in t)y.has(t,n)&&e.push(n);return P&&i(t,e),e},y.allKeys=function(t){if(!y.isObject(t))return[];var e=[];for(var n in t)e.push(n);return P&&i(t,e),e},y.values=function(t){for(var e=y.keys(t),n=e.length,i=Array(n),s=0;s<n;s++)i[s]=t[e[s]];return i},y.mapObject=function(t,e,n){e=_(e,n);for(var i,s=y.keys(t),r=s.length,o={},a=0;a<r;a++)o[i=s[a]]=e(t[i],i,t);return o},y.pairs=function(t){for(var e=y.keys(t),n=e.length,i=Array(n),s=0;s<n;s++)i[s]=[e[s],t[e[s]]];return i},y.invert=function(t){for(var e={},n=y.keys(t),i=0,s=n.length;i<s;i++)e[t[n[i]]]=n[i];return e},y.functions=y.methods=function(t){var e=[];for(var n in t)y.isFunction(t[n])&&e.push(n);return e.sort()},y.extend=w(y.allKeys),y.extendOwn=y.assign=w(y.keys),y.findKey=function(t,e,n){e=_(e,n);for(var i,s=y.keys(t),r=0,o=s.length;r<o;r++)if(e(t[i=s[r]],i,t))return i},y.pick=function(t,e,n){var i,s,r={},o=t;if(null==o)return r;y.isFunction(e)?(s=y.allKeys(o),i=b(e,n)):(s=j(arguments,!1,!1,1),i=function(t,e,n){return e in n},o=Object(o));for(var a=0,l=s.length;a<l;a++){var c=s[a],u=o[c];i(u,c,o)&&(r[c]=u)}return r},y.omit=function(t,e,n){if(y.isFunction(e))e=y.negate(e);else{var i=y.map(j(arguments,!1,!1,1),String);e=function(t,e){return!y.contains(i,e)}}return y.pick(t,e,n)},y.defaults=w(y.allKeys,!0),y.create=function(t,e){var n=k(t);return e&&y.extendOwn(n,e),n},y.clone=function(t){return y.isObject(t)?y.isArray(t)?t.slice():y.extend({},t):t},y.tap=function(t,e){return e(t),t},y.isMatch=function(t,e){var n=y.keys(e),i=n.length;if(null==t)return!i;for(var s=Object(t),r=0;r<i;r++){var o=n[r];if(e[o]!==s[o]||!(o in s))return!1}return!0};var I=function(t,e,n,i){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof y&&(t=t._wrapped),e instanceof y&&(e=e._wrapped);var s=p.call(t);if(s!==p.call(e))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:0==+t?1/+t==1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e}var r="[object Array]"===s;if(!r){if("object"!=typeof t||"object"!=typeof e)return!1;var o=t.constructor,a=e.constructor;if(o!==a&&!(y.isFunction(o)&&o instanceof o&&y.isFunction(a)&&a instanceof a)&&"constructor"in t&&"constructor"in e)return!1}i=i||[];for(var l=(n=n||[]).length;l--;)if(n[l]===t)return i[l]===e;if(n.push(t),i.push(e),r){if((l=t.length)!==e.length)return!1;for(;l--;)if(!I(t[l],e[l],n,i))return!1}else{var c,u=y.keys(t);if(l=u.length,y.keys(e).length!==l)return!1;for(;l--;)if(c=u[l],!y.has(e,c)||!I(t[c],e[c],n,i))return!1}return n.pop(),i.pop(),!0};y.isEqual=function(t,e){return I(t,e)},y.isEmpty=function(t){return null==t||(S(t)&&(y.isArray(t)||y.isString(t)||y.isArguments(t))?0===t.length:0===y.keys(t).length)},y.isElement=function(t){return!(!t||1!==t.nodeType)},y.isArray=d||function(t){return"[object Array]"===p.call(t)},y.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},y.each(["Arguments","Function","String","Number","Date","RegExp","Error"],(function(t){y["is"+t]=function(e){return p.call(e)==="[object "+t+"]"}})),y.isArguments(arguments)||(y.isArguments=function(t){return y.has(t,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(y.isFunction=function(t){return"function"==typeof t||!1}),y.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},y.isNaN=function(t){return y.isNumber(t)&&t!==+t},y.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"===p.call(t)},y.isNull=function(t){return null===t},y.isUndefined=function(t){return void 0===t},y.has=function(t,e){return null!=t&&h.call(t,e)},y.noConflict=function(){return s._=r,this},y.identity=function(t){return t},y.constant=function(t){return function(){return t}},y.noop=function(){},y.property=A,y.propertyOf=function(t){return null==t?function(){}:function(e){return t[e]}},y.matcher=y.matches=function(t){return t=y.extendOwn({},t),function(e){return y.isMatch(e,t)}},y.times=function(t,e,n){var i=Array(Math.max(0,t));e=b(e,n,1);for(var s=0;s<t;s++)i[s]=e(s);return i},y.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},y.now=Date.now||function(){return(new Date).getTime()};var O={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},N=y.invert(O),M=function(t){var e=function(e){return t[e]},n="(?:"+y.keys(t).join("|")+")",i=RegExp(n),s=RegExp(n,"g");return function(t){return t=null==t?"":""+t,i.test(t)?t.replace(s,e):t}};y.escape=M(O),y.unescape=M(N),y.result=function(t,e,n){var i=null==t?void 0:t[e];return void 0===i&&(i=n),y.isFunction(i)?i.call(t):i};var R=0;y.uniqueId=function(t){var e=++R+"";return t?t+e:e},y.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,F={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},$=/\\|'|\r|\n|\u2028|\u2029/g,B=function(t){return"\\"+F[t]};y.template=function(t,e,n){!e&&n&&(e=n),e=y.defaults({},e,y.templateSettings);var i=RegExp([(e.escape||L).source,(e.interpolate||L).source,(e.evaluate||L).source].join("|")+"|$","g"),s=0,r="__p+='";t.replace(i,(function(e,n,i,o,a){return r+=t.slice(s,a).replace($,B),s=a+e.length,n?r+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":i?r+="'+\n((__t=("+i+"))==null?'':__t)+\n'":o&&(r+="';\n"+o+"\n__p+='"),e})),r+="';\n",e.variable||(r="with(obj||{}){\n"+r+"}\n"),r="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+r+"return __p;\n";try{var o=new Function(e.variable||"obj","_",r)}catch(t){throw t.source=r,t}var a=function(t){return o.call(this,t,y)},l=e.variable||"obj";return a.source="function("+l+"){\n"+r+"}",a},y.chain=function(t){var e=y(t);return e._chain=!0,e};var z=function(t,e){return t._chain?y(e).chain():e};y.mixin=function(t){y.each(y.functions(t),(function(e){var n=y[e]=t[e];y.prototype[e]=function(){var t=[this._wrapped];return c.apply(t,arguments),z(this,n.apply(y,t))}}))},y.mixin(y),y.each(["pop","push","reverse","shift","sort","splice","unshift"],(function(t){var e=o[t];y.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],z(this,n)}})),y.each(["concat","join","slice"],(function(t){var e=o[t];y.prototype[t]=function(){return z(this,e.apply(this._wrapped,arguments))}})),y.prototype.value=function(){return this._wrapped},y.prototype.valueOf=y.prototype.toJSON=y.prototype.value,y.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],(function(){return y}))}.call(this),function(t){function e(t){var e=t.length,i=n.type(t);return"function"!==i&&!n.isWindow(t)&&(!(1!==t.nodeType||!e)||("array"===i||0===e||"number"==typeof e&&e>0&&e-1 in t))}if(!t.jQuery){var n=function(t,e){return new n.fn.init(t,e)};n.isWindow=function(t){return null!=t&&t==t.window},n.type=function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?s[o.call(t)]||"object":typeof t},n.isArray=Array.isArray||function(t){return"array"===n.type(t)},n.isPlainObject=function(t){var e;if(!t||"object"!==n.type(t)||t.nodeType||n.isWindow(t))return!1;try{if(t.constructor&&!r.call(t,"constructor")&&!r.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}for(e in t);return void 0===e||r.call(t,e)},n.each=function(t,n,i){var s=0,r=t.length,o=e(t);if(i){if(o)for(;r>s&&!1!==n.apply(t[s],i);s++);else for(s in t)if(!1===n.apply(t[s],i))break}else if(o)for(;r>s&&!1!==n.call(t[s],s,t[s]);s++);else for(s in t)if(!1===n.call(t[s],s,t[s]))break;return t},n.data=function(t,e,s){if(void 0===s){var r=(o=t[n.expando])&&i[o];if(void 0===e)return r;if(r&&e in r)return r[e]}else if(void 0!==e){var o=t[n.expando]||(t[n.expando]=++n.uuid);return i[o]=i[o]||{},i[o][e]=s,s}},n.removeData=function(t,e){var s=t[n.expando],r=s&&i[s];r&&n.each(e,(function(t,e){delete r[e]}))},n.extend=function(){var t,e,i,s,r,o,a=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[l]||{},l++),"object"!=typeof a&&"function"!==n.type(a)&&(a={}),l===c&&(a=this,l--);c>l;l++)if(null!=(r=arguments[l]))for(s in r)t=a[s],a!==(i=r[s])&&(u&&i&&(n.isPlainObject(i)||(e=n.isArray(i)))?(e?(e=!1,o=t&&n.isArray(t)?t:[]):o=t&&n.isPlainObject(t)?t:{},a[s]=n.extend(u,o,i)):void 0!==i&&(a[s]=i));return a},n.queue=function(t,i,s){function r(t,n){var i=n||[];return null!=t&&(e(Object(t))?function(t,e){for(var n=+e.length,i=0,s=t.length;n>i;)t[s++]=e[i++];if(n!=n)for(;void 0!==e[i];)t[s++]=e[i++];t.length=s}(i,"string"==typeof t?[t]:t):[].push.call(i,t)),i}if(t){i=(i||"fx")+"queue";var o=n.data(t,i);return s?(!o||n.isArray(s)?o=n.data(t,i,r(s)):o.push(s),o):o||[]}},n.dequeue=function(t,e){n.each(t.nodeType?[t]:t,(function(t,i){e=e||"fx";var s=n.queue(i,e),r=s.shift();"inprogress"===r&&(r=s.shift()),r&&("fx"===e&&s.unshift("inprogress"),r.call(i,(function(){n.dequeue(i,e)})))}))},n.fn=n.prototype={init:function(t){if(t.nodeType)return this[0]=t,this;throw new Error("Not a DOM node.")},offset:function(){var e=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:e.top+(t.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:e.left+(t.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function t(){for(var t=this.offsetParent||document;t&&"html"===!t.nodeType.toLowerCase&&"static"===t.style.position;)t=t.offsetParent;return t||document}var e=this[0],t=t.apply(e),i=this.offset(),s=/^(?:body|html)$/i.test(t.nodeName)?{top:0,left:0}:n(t).offset();return i.top-=parseFloat(e.style.marginTop)||0,i.left-=parseFloat(e.style.marginLeft)||0,t.style&&(s.top+=parseFloat(t.style.borderTopWidth)||0,s.left+=parseFloat(t.style.borderLeftWidth)||0),{top:i.top-s.top,left:i.left-s.left}}};var i={};n.expando="velocity"+(new Date).getTime(),n.uuid=0;for(var s={},r=s.hasOwnProperty,o=s.toString,a="Boolean Number String Function Array Date RegExp Object Error".split(" "),l=0;l<a.length;l++)s["[object "+a[l]+"]"]=a[l].toLowerCase();n.fn.init.prototype=n.fn,t.Velocity={Utilities:n}}}(window),function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t():"function"==typeof define&&define.amd?define(t):t()}((function(){return function(t,e,n,i){function s(t){for(var e=-1,n=t?t.length:0,i=[];++e<n;){var s=t[e];s&&i.push(s)}return i}function r(t){return m.isWrapped(t)?t=[].slice.call(t):m.isNode(t)&&(t=[t]),t}function o(t){var e=h.data(t,"velocity");return null===e?i:e}function a(t){return function(e){return Math.round(e*t)*(1/t)}}function l(t,n,i,s){function r(t,e){return 1-3*e+3*t}function o(t,e){return 3*e-6*t}function a(t){return 3*t}function l(t,e,n){return((r(e,n)*t+o(e,n))*t+a(e))*t}function c(t,e,n){return 3*r(e,n)*t*t+2*o(e,n)*t+a(e)}function u(e,n){for(var s=0;m>s;++s){var r=c(n,t,i);if(0===r)return n;n-=(l(n,t,i)-e)/r}return n}function p(){for(var e=0;b>e;++e)A[e]=l(e*_,t,i)}function h(e,n,s){var r,o,a=0;do{(r=l(o=n+(s-n)/2,t,i)-e)>0?s=o:n=o}while(Math.abs(r)>v&&++a<y);return o}function d(e){for(var n=0,s=1,r=b-1;s!=r&&A[s]<=e;++s)n+=_;--s;var o=n+(e-A[s])/(A[s+1]-A[s])*_,a=c(o,t,i);return a>=g?u(e,o):0==a?o:h(e,n,n+_)}function f(){C=!0,(t!=n||i!=s)&&p()}var m=4,g=.001,v=1e-7,y=10,b=11,_=1/(b-1),w="Float32Array"in e;if(4!==arguments.length)return!1;for(var k=0;4>k;++k)if("number"!=typeof arguments[k]||isNaN(arguments[k])||!isFinite(arguments[k]))return!1;t=Math.min(t,1),i=Math.min(i,1),t=Math.max(t,0),i=Math.max(i,0);var A=w?new Float32Array(b):new Array(b),C=!1,T=function(e){return C||f(),t===n&&i===s?e:0===e?0:1===e?1:l(d(e),n,s)};T.getControlPoints=function(){return[{x:t,y:n},{x:i,y:s}]};var S="generateBezier("+[t,n,i,s]+")";return T.toString=function(){return S},T}function c(t,e){var n=t;return m.isString(t)?b.Easings[t]||(n=!1):n=m.isArray(t)&&1===t.length?a.apply(null,t):m.isArray(t)&&2===t.length?_.apply(null,t.concat([e])):!(!m.isArray(t)||4!==t.length)&&l.apply(null,t),!1===n&&(n=b.Easings[b.defaults.easing]?b.defaults.easing:y),n}function u(t){if(t){var e=(new Date).getTime(),n=b.State.calls.length;n>1e4&&(b.State.calls=s(b.State.calls));for(var r=0;n>r;r++)if(b.State.calls[r]){var a=b.State.calls[r],l=a[0],c=a[2],d=a[3],f=!!d,g=null;d||(d=b.State.calls[r][3]=e-16);for(var v=Math.min((e-d)/c.duration,1),y=0,_=l.length;_>y;y++){var k=l[y],C=k.element;if(o(C)){var T=!1;if(c.display!==i&&null!==c.display&&"none"!==c.display){if("flex"===c.display){var S=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];h.each(S,(function(t,e){w.setPropertyValue(C,"display",e)}))}w.setPropertyValue(C,"display",c.display)}for(var x in c.visibility!==i&&"hidden"!==c.visibility&&w.setPropertyValue(C,"visibility",c.visibility),k)if("element"!==x){var j,D=k[x],P=m.isString(D.easing)?b.Easings[D.easing]:D.easing;if(1===v)j=D.endValue;else{var E=D.endValue-D.startValue;if(j=D.startValue+E*P(v,c,E),!f&&j===D.currentValue)continue}if(D.currentValue=j,"tween"===x)g=j;else{if(w.Hooks.registered[x]){var I=w.Hooks.getRoot(x),O=o(C).rootPropertyValueCache[I];O&&(D.rootPropertyValue=O)}var N=w.setPropertyValue(C,x,D.currentValue+(0===parseFloat(j)?"":D.unitType),D.rootPropertyValue,D.scrollData);w.Hooks.registered[x]&&(o(C).rootPropertyValueCache[I]=w.Normalizations.registered[I]?w.Normalizations.registered[I]("extract",null,N[1]):N[1]),"transform"===N[0]&&(T=!0)}}c.mobileHA&&o(C).transformCache.translate3d===i&&(o(C).transformCache.translate3d="(0px, 0px, 0px)",T=!0),T&&w.flushTransformCache(C)}}c.display!==i&&"none"!==c.display&&(b.State.calls[r][2].display=!1),c.visibility!==i&&"hidden"!==c.visibility&&(b.State.calls[r][2].visibility=!1),c.progress&&c.progress.call(a[1],a[1],v,Math.max(0,d+c.duration-e),d,g),1===v&&p(r)}}b.State.isTicking&&A(u)}function p(t,e){if(!b.State.calls[t])return!1;for(var n=b.State.calls[t][0],s=b.State.calls[t][1],r=b.State.calls[t][2],a=b.State.calls[t][4],l=!1,c=0,u=n.length;u>c;c++){var p=n[c].element;if(e||r.loop||("none"===r.display&&w.setPropertyValue(p,"display",r.display),"hidden"===r.visibility&&w.setPropertyValue(p,"visibility",r.visibility)),!0!==r.loop&&(h.queue(p)[1]===i||!/\.velocityQueueEntryFlag/i.test(h.queue(p)[1]))&&o(p)){o(p).isAnimating=!1,o(p).rootPropertyValueCache={};var d=!1;h.each(w.Lists.transforms3D,(function(t,e){var n=/^scale/.test(e)?1:0,s=o(p).transformCache[e];o(p).transformCache[e]!==i&&new RegExp("^\\("+n+"[^.]").test(s)&&(d=!0,delete o(p).transformCache[e])})),r.mobileHA&&(d=!0,delete o(p).transformCache.translate3d),d&&w.flushTransformCache(p),w.Values.removeClass(p,"velocity-animating")}if(!e&&r.complete&&!r.loop&&c===u-1)try{r.complete.call(s,s)}catch(t){setTimeout((function(){throw t}),1)}a&&!0!==r.loop&&a(s),!0!==r.loop||e||(h.each(o(p).tweensContainer,(function(t,e){/^rotate/.test(t)&&360===parseFloat(e.endValue)&&(e.endValue=0,e.startValue=360),/^backgroundPosition/.test(t)&&100===parseFloat(e.endValue)&&"%"===e.unitType&&(e.endValue=0,e.startValue=100)})),b(p,"reverse",{loop:!0,delay:r.delay})),!1!==r.queue&&h.dequeue(p,r.queue)}b.State.calls[t]=!1;for(var f=0,m=b.State.calls.length;m>f;f++)if(!1!==b.State.calls[f]){l=!0;break}!1===l&&(b.State.isTicking=!1,delete b.State.calls,b.State.calls=[])}var h,d=function(){if(n.documentMode)return n.documentMode;for(var t=7;t>4;t--){var e=n.createElement("div");if(e.innerHTML="<!--[if IE "+t+"]><span></span><![endif]-->",e.getElementsByTagName("span").length)return e=null,t}return i}(),f=function(){var t=0;return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||function(e){var n,i=(new Date).getTime();return n=Math.max(0,16-(i-t)),t=i+n,setTimeout((function(){e(i+n)}),n)}}(),m={isString:function(t){return"string"==typeof t},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)},isNode:function(t){return t&&t.nodeType},isNodeList:function(t){return"object"==typeof t&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&t.length!==i&&(0===t.length||"object"==typeof t[0]&&t[0].nodeType>0)},isWrapped:function(t){return t&&(t.jquery||e.Zepto&&e.Zepto.zepto.isZ(t))},isSVG:function(t){return e.SVGElement&&t instanceof e.SVGElement},isEmptyObject:function(t){for(var e in t)return!1;return!0}},g=!1;if(t.fn&&t.fn.jquery?(h=t,g=!0):h=e.Velocity.Utilities,8>=d&&!g)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(!(7>=d)){var v=400,y="swing",b={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:e.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:n.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:h,Redirects:{},Easings:{},Promise:e.Promise,defaults:{queue:"",duration:v,easing:y,begin:i,complete:i,progress:i,display:i,visibility:i,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(t){h.data(t,"velocity",{isSVG:m.isSVG(t),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:1},debug:!1};e.pageYOffset!==i?(b.State.scrollAnchor=e,b.State.scrollPropertyLeft="pageXOffset",b.State.scrollPropertyTop="pageYOffset"):(b.State.scrollAnchor=n.documentElement||n.body.parentNode||n.body,b.State.scrollPropertyLeft="scrollLeft",b.State.scrollPropertyTop="scrollTop");var _=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,n,i){var s={x:e.x+i.dx*n,v:e.v+i.dv*n,tension:e.tension,friction:e.friction};return{dx:s.v,dv:t(s)}}function n(n,i){var s={dx:n.v,dv:t(n)},r=e(n,.5*i,s),o=e(n,.5*i,r),a=e(n,i,o),l=1/6*(s.dx+2*(r.dx+o.dx)+a.dx),c=1/6*(s.dv+2*(r.dv+o.dv)+a.dv);return n.x=n.x+l*i,n.v=n.v+c*i,n}return function t(e,i,s){var r,o,a,l={x:-1,v:0,tension:null,friction:null},c=[0],u=0,p=1e-4,h=.016;for(e=parseFloat(e)||500,i=parseFloat(i)||20,s=s||null,l.tension=e,l.friction=i,(r=null!==s)?o=(u=t(e,i))/s*h:o=h;a=n(a||l,o),c.push(1+a.x),u+=16,Math.abs(a.x)>p&&Math.abs(a.v)>p;);return r?function(t){return c[t*(c.length-1)|0]}:u}}();b.Easings={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},spring:function(t){return 1-Math.cos(4.5*t*Math.PI)*Math.exp(6*-t)}},h.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(t,e){b.Easings[e[0]]=l.apply(null,e[1])}));var w=b.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 t=0;t<w.Lists.colors.length;t++){var e="color"===w.Lists.colors[t]?"0 0 0 1":"255 255 255 1";w.Hooks.templates[w.Lists.colors[t]]=["Red Green Blue Alpha",e]}var n,i,s;if(d)for(n in w.Hooks.templates){s=(i=w.Hooks.templates[n])[0].split(" ");var r=i[1].match(w.RegEx.valueSplit);"Color"===s[0]&&(s.push(s.shift()),r.push(r.shift()),w.Hooks.templates[n]=[s.join(" "),r.join(" ")])}for(n in w.Hooks.templates)for(var t in s=(i=w.Hooks.templates[n])[0].split(" ")){var o=n+s[t],a=t;w.Hooks.registered[o]=[n,a]}},getRoot:function(t){var e=w.Hooks.registered[t];return e?e[0]:t},cleanRootPropertyValue:function(t,e){return w.RegEx.valueUnwrap.test(e)&&(e=e.match(w.RegEx.valueUnwrap)[1]),w.Values.isCSSNullValue(e)&&(e=w.Hooks.templates[t][1]),e},extractValue:function(t,e){var n=w.Hooks.registered[t];if(n){var i=n[0],s=n[1];return(e=w.Hooks.cleanRootPropertyValue(i,e)).toString().match(w.RegEx.valueSplit)[s]}return e},injectValue:function(t,e,n){var i=w.Hooks.registered[t];if(i){var s,r=i[0],o=i[1];return(s=(n=w.Hooks.cleanRootPropertyValue(r,n)).toString().match(w.RegEx.valueSplit))[o]=e,s.join(" ")}return n}},Normalizations:{registered:{clip:function(t,e,n){switch(t){case"name":return"clip";case"extract":var i;return w.RegEx.wrappedValueAlreadyExtracted.test(n)?i=n:i=(i=n.toString().match(w.RegEx.valueUnwrap))?i[1].replace(/,(\s+)?/g," "):n,i;case"inject":return"rect("+n+")"}},blur:function(t,e,n){switch(t){case"name":return b.State.isFirefox?"filter":"-webkit-filter";case"extract":var i=parseFloat(n);if(!i&&0!==i){var s=n.toString().match(/blur\(([0-9]+[A-z]+)\)/i);i=s?s[1]:0}return i;case"inject":return parseFloat(n)?"blur("+n+")":"none"}},opacity:function(t,e,n){if(8>=d)switch(t){case"name":return"filter";case"extract":var i=n.toString().match(/alpha\(opacity=(.*)\)/i);return i?i[1]/100:1;case"inject":return e.style.zoom=1,parseFloat(n)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(n),10)+")"}else switch(t){case"name":return"opacity";case"extract":case"inject":return n}}},register:function(){9>=d||b.State.isGingerbread||(w.Lists.transformsBase=w.Lists.transformsBase.concat(w.Lists.transforms3D));for(var t=0;t<w.Lists.transformsBase.length;t++)!function(){var e=w.Lists.transformsBase[t];w.Normalizations.registered[e]=function(t,n,s){switch(t){case"name":return"transform";case"extract":return o(n)===i||o(n).transformCache[e]===i?/^scale/i.test(e)?1:0:o(n).transformCache[e].replace(/[()]/g,"");case"inject":var r=!1;switch(e.substr(0,e.length-1)){case"translate":r=!/(%|px|em|rem|vw|vh|\d)$/i.test(s);break;case"scal":case"scale":b.State.isAndroid&&o(n).transformCache[e]===i&&1>s&&(s=1),r=!/(\d)$/i.test(s);break;case"skew":case"rotate":r=!/(deg|\d)$/i.test(s)}return r||(o(n).transformCache[e]="("+s+")"),o(n).transformCache[e]}}}();for(t=0;t<w.Lists.colors.length;t++)!function(){var e=w.Lists.colors[t];w.Normalizations.registered[e]=function(t,n,s){switch(t){case"name":return e;case"extract":var r;if(w.RegEx.wrappedValueAlreadyExtracted.test(s))r=s;else{var o,a={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+$/i.test(s)?o=a[s]!==i?a[s]:a.black:w.RegEx.isHex.test(s)?o="rgb("+w.Values.hexToRgb(s).join(" ")+")":/^rgba?\(/i.test(s)||(o=a.black),r=(o||s).toString().match(w.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return 8>=d||3!==r.split(" ").length||(r+=" 1"),r;case"inject":return 8>=d?4===s.split(" ").length&&(s=s.split(/\s+/).slice(0,3).join(" ")):3===s.split(" ").length&&(s+=" 1"),(8>=d?"rgb":"rgba")+"("+s.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(t){return t.replace(/-(\w)/g,(function(t,e){return e.toUpperCase()}))},SVGAttribute:function(t){var e="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(d||b.State.isAndroid&&!b.State.isChrome)&&(e+="|transform"),new RegExp("^("+e+")$","i").test(t)},prefixCheck:function(t){if(b.State.prefixMatches[t])return[b.State.prefixMatches[t],!0];for(var e=["","Webkit","Moz","ms","O"],n=0,i=e.length;i>n;n++){var s;if(s=0===n?t:e[n]+t.replace(/^\w/,(function(t){return t.toUpperCase()})),m.isString(b.State.prefixElement.style[s]))return b.State.prefixMatches[t]=s,[s,!0]}return[t,!1]}},Values:{hexToRgb:function(t){var e,n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return t=t.replace(n,(function(t,e,n,i){return e+e+n+n+i+i})),(e=i.exec(t))?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:[0,0,0]},isCSSNullValue:function(t){return 0==t||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(t)},getUnitType:function(t){return/^(rotate|skew)/i.test(t)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(t)?"":"px"},getDisplayType:function(t){var e=t&&t.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(e)?"inline":/^(li)$/i.test(e)?"list-item":/^(tr)$/i.test(e)?"table-row":/^(table)$/i.test(e)?"table":/^(tbody)$/i.test(e)?"table-row-group":"block"},addClass:function(t,e){t.classList?t.classList.add(e):t.className+=(t.className.length?" ":"")+e},removeClass:function(t,e){t.classList?t.classList.remove(e):t.className=t.className.toString().replace(new RegExp("(^|\\s)"+e.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(t,n,s,r){function a(t,n){function s(){u&&w.setPropertyValue(t,"display","none")}var l=0;if(8>=d)l=h.css(t,n);else{var c,u=!1;if(/^(width|height)$/.test(n)&&0===w.getPropertyValue(t,"display")&&(u=!0,w.setPropertyValue(t,"display",w.Values.getDisplayType(t))),!r){if("height"===n&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var p=t.offsetHeight-(parseFloat(w.getPropertyValue(t,"borderTopWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderBottomWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingTop"))||0)-(parseFloat(w.getPropertyValue(t,"paddingBottom"))||0);return s(),p}if("width"===n&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var f=t.offsetWidth-(parseFloat(w.getPropertyValue(t,"borderLeftWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderRightWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingLeft"))||0)-(parseFloat(w.getPropertyValue(t,"paddingRight"))||0);return s(),f}}c=o(t)===i?e.getComputedStyle(t,null):o(t).computedStyle?o(t).computedStyle:o(t).computedStyle=e.getComputedStyle(t,null),"borderColor"===n&&(n="borderTopColor"),(""===(l=9===d&&"filter"===n?c.getPropertyValue(n):c[n])||null===l)&&(l=t.style[n]),s()}if("auto"===l&&/^(top|right|bottom|left)$/i.test(n)){var m=a(t,"position");("fixed"===m||"absolute"===m&&/top|left/i.test(n))&&(l=h(t).position()[n]+"px")}return l}var l;if(w.Hooks.registered[n]){var c=n,u=w.Hooks.getRoot(c);s===i&&(s=w.getPropertyValue(t,w.Names.prefixCheck(u)[0])),w.Normalizations.registered[u]&&(s=w.Normalizations.registered[u]("extract",t,s)),l=w.Hooks.extractValue(c,s)}else if(w.Normalizations.registered[n]){var p,f;"transform"!==(p=w.Normalizations.registered[n]("name",t))&&(f=a(t,w.Names.prefixCheck(p)[0]),w.Values.isCSSNullValue(f)&&w.Hooks.templates[n]&&(f=w.Hooks.templates[n][1])),l=w.Normalizations.registered[n]("extract",t,f)}if(!/^[\d-]/.test(l))if(o(t)&&o(t).isSVG&&w.Names.SVGAttribute(n))if(/^(height|width)$/i.test(n))try{l=t.getBBox()[n]}catch(t){l=0}else l=t.getAttribute(n);else l=a(t,w.Names.prefixCheck(n)[0]);return w.Values.isCSSNullValue(l)&&(l=0),b.debug>=2&&console.log("Get "+n+": "+l),l},setPropertyValue:function(t,n,i,s,r){var a=n;if("scroll"===n)r.container?r.container["scroll"+r.direction]=i:"Left"===r.direction?e.scrollTo(i,r.alternateValue):e.scrollTo(r.alternateValue,i);else if(w.Normalizations.registered[n]&&"transform"===w.Normalizations.registered[n]("name",t))w.Normalizations.registered[n]("inject",t,i),a="transform",i=o(t).transformCache[n];else{if(w.Hooks.registered[n]){var l=n,c=w.Hooks.getRoot(n);s=s||w.getPropertyValue(t,c),i=w.Hooks.injectValue(l,i,s),n=c}if(w.Normalizations.registered[n]&&(i=w.Normalizations.registered[n]("inject",t,i),n=w.Normalizations.registered[n]("name",t)),a=w.Names.prefixCheck(n)[0],8>=d)try{t.style[a]=i}catch(t){b.debug&&console.log("Browser does not support ["+i+"] for ["+a+"]")}else o(t)&&o(t).isSVG&&w.Names.SVGAttribute(n)?t.setAttribute(n,i):t.style[a]=i;b.debug>=2&&console.log("Set "+n+" ("+a+"): "+i)}return[a,i]},flushTransformCache:function(t){function e(e){return parseFloat(w.getPropertyValue(t,e))}var n="";if((d||b.State.isAndroid&&!b.State.isChrome)&&o(t).isSVG){var i={translate:[e("translateX"),e("translateY")],skewX:[e("skewX")],skewY:[e("skewY")],scale:1!==e("scale")?[e("scale"),e("scale")]:[e("scaleX"),e("scaleY")],rotate:[e("rotateZ"),0,0]};h.each(o(t).transformCache,(function(t){/^translate/i.test(t)?t="translate":/^scale/i.test(t)?t="scale":/^rotate/i.test(t)&&(t="rotate"),i[t]&&(n+=t+"("+i[t].join(" ")+") ",delete i[t])}))}else{var s,r;h.each(o(t).transformCache,(function(e){return s=o(t).transformCache[e],"transformPerspective"===e?(r=s,!0):(9===d&&"rotateZ"===e&&(e="rotate"),void(n+=e+s+" "))})),r&&(n="perspective"+r+" "+n)}w.setPropertyValue(t,"transform",n)}};w.Hooks.register(),w.Normalizations.register(),b.hook=function(t,e,n){var s=i;return t=r(t),h.each(t,(function(t,r){if(o(r)===i&&b.init(r),n===i)s===i&&(s=b.CSS.getPropertyValue(r,e));else{var a=b.CSS.setPropertyValue(r,e,n);"transform"===a[0]&&b.CSS.flushTransformCache(r),s=a}})),s};var k=function(){function t(){return a?x.promise||null:l}function s(){function t(){function t(t,e){var n=i,s=i,o=i;return m.isArray(t)?(n=t[0],!m.isArray(t[1])&&/^[\d-]/.test(t[1])||m.isFunction(t[1])||w.RegEx.isHex.test(t[1])?o=t[1]:(m.isString(t[1])&&!w.RegEx.isHex.test(t[1])||m.isArray(t[1]))&&(s=e?t[1]:c(t[1],a.duration),t[2]!==i&&(o=t[2]))):n=t,e||(s=s||a.easing),m.isFunction(n)&&(n=n.call(r,C,A)),m.isFunction(o)&&(o=o.call(r,C,A)),[n||0,s,o]}function p(t,e){var n,i;return i=(e||"0").toString().toLowerCase().replace(/[%A-z]+$/,(function(t){return n=t,""})),n||(n=w.Values.getUnitType(t)),[i,n]}function d(){var t={myParent:r.parentNode||n.body,position:w.getPropertyValue(r,"position"),fontSize:w.getPropertyValue(r,"fontSize")},i=t.position===N.lastPosition&&t.myParent===N.lastParent,s=t.fontSize===N.lastFontSize;N.lastParent=t.myParent,N.lastPosition=t.position,N.lastFontSize=t.fontSize;var a=100,l={};if(s&&i)l.emToPx=N.lastEmToPx,l.percentToPxWidth=N.lastPercentToPxWidth,l.percentToPxHeight=N.lastPercentToPxHeight;else{var c=o(r).isSVG?n.createElementNS("http://www.w3.org/2000/svg","rect"):n.createElement("div");b.init(c),t.myParent.appendChild(c),h.each(["overflow","overflowX","overflowY"],(function(t,e){b.CSS.setPropertyValue(c,e,"hidden")})),b.CSS.setPropertyValue(c,"position",t.position),b.CSS.setPropertyValue(c,"fontSize",t.fontSize),b.CSS.setPropertyValue(c,"boxSizing","content-box"),h.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],(function(t,e){b.CSS.setPropertyValue(c,e,a+"%")})),b.CSS.setPropertyValue(c,"paddingLeft",a+"em"),l.percentToPxWidth=N.lastPercentToPxWidth=(parseFloat(w.getPropertyValue(c,"width",null,!0))||1)/a,l.percentToPxHeight=N.lastPercentToPxHeight=(parseFloat(w.getPropertyValue(c,"height",null,!0))||1)/a,l.emToPx=N.lastEmToPx=(parseFloat(w.getPropertyValue(c,"paddingLeft"))||1)/a,t.myParent.removeChild(c)}return null===N.remToPx&&(N.remToPx=parseFloat(w.getPropertyValue(n.body,"fontSize"))||16),null===N.vwToPx&&(N.vwToPx=parseFloat(e.innerWidth)/100,N.vhToPx=parseFloat(e.innerHeight)/100),l.remToPx=N.remToPx,l.vwToPx=N.vwToPx,l.vhToPx=N.vhToPx,b.debug>=1&&console.log("Unit ratios: "+JSON.stringify(l),r),l}if(a.begin&&0===C)try{a.begin.call(f,f)}catch(t){setTimeout((function(){throw t}),1)}if("scroll"===S){var v,_,k,T=/^x$/i.test(a.axis)?"Left":"Top",j=parseFloat(a.offset)||0;a.container?m.isWrapped(a.container)||m.isNode(a.container)?(a.container=a.container[0]||a.container,
k=(v=a.container["scroll"+T])+h(r).position()[T.toLowerCase()]+j):a.container=null:(v=b.State.scrollAnchor[b.State["scrollProperty"+T]],_=b.State.scrollAnchor[b.State["scrollProperty"+("Left"===T?"Top":"Left")]],k=h(r).offset()[T.toLowerCase()]+j),l={scroll:{rootPropertyValue:!1,startValue:v,currentValue:v,endValue:k,unitType:"",easing:a.easing,scrollData:{container:a.container,direction:T,alternateValue:_}},element:r},b.debug&&console.log("tweensContainer (scroll): ",l.scroll,r)}else if("reverse"===S){if(!o(r).tweensContainer)return void h.dequeue(r,a.queue);"none"===o(r).opts.display&&(o(r).opts.display="auto"),"hidden"===o(r).opts.visibility&&(o(r).opts.visibility="visible"),o(r).opts.loop=!1,o(r).opts.begin=null,o(r).opts.complete=null,y.easing||delete a.easing,y.duration||delete a.duration,a=h.extend({},o(r).opts,a);var D=h.extend(!0,{},o(r).tweensContainer);for(var P in D)if("element"!==P){var E=D[P].startValue;D[P].startValue=D[P].currentValue=D[P].endValue,D[P].endValue=E,m.isEmptyObject(y)||(D[P].easing=a.easing),b.debug&&console.log("reverse tweensContainer ("+P+"): "+JSON.stringify(D[P]),r)}l=D}else if("start"===S){for(var I in o(r).tweensContainer&&!0===o(r).isAnimating&&(D=o(r).tweensContainer),h.each(g,(function(e,n){if(RegExp("^"+w.Lists.colors.join("$|^")+"$").test(e)){var s=t(n,!0),r=s[0],o=s[1],a=s[2];if(w.RegEx.isHex.test(r)){for(var l=["Red","Green","Blue"],c=w.Values.hexToRgb(r),u=a?w.Values.hexToRgb(a):i,p=0;p<l.length;p++){var h=[c[p]];o&&h.push(o),u!==i&&h.push(u[p]),g[e+l[p]]=h}delete g[e]}}})),g){var O=t(g[I]),R=O[0],L=O[1],F=O[2];I=w.Names.camelCase(I);var $=w.Hooks.getRoot(I),B=!1;if(o(r).isSVG||"tween"===$||!1!==w.Names.prefixCheck($)[1]||w.Normalizations.registered[$]!==i){(a.display!==i&&null!==a.display&&"none"!==a.display||a.visibility!==i&&"hidden"!==a.visibility)&&/opacity|filter/.test(I)&&!F&&0!==R&&(F=0),a._cacheValues&&D&&D[I]?(F===i&&(F=D[I].endValue+D[I].unitType),B=o(r).rootPropertyValueCache[$]):w.Hooks.registered[I]?F===i?(B=w.getPropertyValue(r,$),F=w.getPropertyValue(r,I,B)):B=w.Hooks.templates[$][1]:F===i&&(F=w.getPropertyValue(r,I));var z,U,q,W=!1;if(F=(z=p(I,F))[0],q=z[1],R=(z=p(I,R))[0].replace(/^([+-\/*])=/,(function(t,e){return W=e,""})),U=z[1],F=parseFloat(F)||0,R=parseFloat(R)||0,"%"===U&&(/^(fontSize|lineHeight)$/.test(I)?(R/=100,U="em"):/^scale/.test(I)?(R/=100,U=""):/(Red|Green|Blue)$/i.test(I)&&(R=R/100*255,U="")),/[\/*]/.test(W))U=q;else if(q!==U&&0!==F)if(0===R)U=q;else{s=s||d();var H=/margin|padding|left|right|width|text|word|letter/i.test(I)||/X$/.test(I)||"x"===I?"x":"y";switch(q){case"%":F*="x"===H?s.percentToPxWidth:s.percentToPxHeight;break;case"px":break;default:F*=s[q+"ToPx"]}switch(U){case"%":F*=1/("x"===H?s.percentToPxWidth:s.percentToPxHeight);break;case"px":break;default:F*=1/s[U+"ToPx"]}}switch(W){case"+":R=F+R;break;case"-":R=F-R;break;case"*":R*=F;break;case"/":R=F/R}l[I]={rootPropertyValue:B,startValue:F,currentValue:F,endValue:R,unitType:U,easing:L},b.debug&&console.log("tweensContainer ("+I+"): "+JSON.stringify(l[I]),r)}else b.debug&&console.log("Skipping ["+$+"] due to a lack of browser support.")}l.element=r}l.element&&(w.Values.addClass(r,"velocity-animating"),M.push(l),""===a.queue&&(o(r).tweensContainer=l,o(r).opts=a),o(r).isAnimating=!0,C===A-1?(b.State.calls.push([M,f,a,null,x.resolver]),!1===b.State.isTicking&&(b.State.isTicking=!0,u())):C++)}var s,r=this,a=h.extend({},b.defaults,y),l={};switch(o(r)===i&&b.init(r),parseFloat(a.delay)&&!1!==a.queue&&h.queue(r,a.queue,(function(t){b.velocityQueueEntryFlag=!0,o(r).delayTimer={setTimeout:setTimeout(t,parseFloat(a.delay)),next:t}})),a.duration.toString().toLowerCase()){case"fast":a.duration=200;break;case"normal":a.duration=v;break;case"slow":a.duration=600;break;default:a.duration=parseFloat(a.duration)||1}!1!==b.mock&&(!0===b.mock?a.duration=a.delay=1:(a.duration*=parseFloat(b.mock)||1,a.delay*=parseFloat(b.mock)||1)),a.easing=c(a.easing,a.duration),a.begin&&!m.isFunction(a.begin)&&(a.begin=null),a.progress&&!m.isFunction(a.progress)&&(a.progress=null),a.complete&&!m.isFunction(a.complete)&&(a.complete=null),a.display!==i&&null!==a.display&&(a.display=a.display.toString().toLowerCase(),"auto"===a.display&&(a.display=b.CSS.Values.getDisplayType(r))),a.visibility!==i&&null!==a.visibility&&(a.visibility=a.visibility.toString().toLowerCase()),a.mobileHA=a.mobileHA&&b.State.isMobile&&!b.State.isGingerbread,!1===a.queue?a.delay?setTimeout(t,a.delay):t():h.queue(r,a.queue,(function(e,n){return!0===n?(x.promise&&x.resolver(f),!0):(b.velocityQueueEntryFlag=!0,void t(e))})),""!==a.queue&&"fx"!==a.queue||"inprogress"===h.queue(r)[0]||h.dequeue(r)}var a,l,d,f,g,y,_=arguments[0]&&(arguments[0].p||h.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||m.isString(arguments[0].properties));if(m.isWrapped(this)?(a=!1,d=0,f=this,l=this):(a=!0,d=1,f=_?arguments[0].elements||arguments[0].e:arguments[0]),f=r(f)){_?(g=arguments[0].properties||arguments[0].p,y=arguments[0].options||arguments[0].o):(g=arguments[d],y=arguments[d+1]);var A=f.length,C=0;if(!/^(stop|finish)$/i.test(g)&&!h.isPlainObject(y)){y={};for(var T=d+1;T<arguments.length;T++)m.isArray(arguments[T])||!/^(fast|normal|slow)$/i.test(arguments[T])&&!/^\d/.test(arguments[T])?m.isString(arguments[T])||m.isArray(arguments[T])?y.easing=arguments[T]:m.isFunction(arguments[T])&&(y.complete=arguments[T]):y.duration=arguments[T]}var S,x={promise:null,resolver:null,rejecter:null};switch(a&&b.Promise&&(x.promise=new b.Promise((function(t,e){x.resolver=t,x.rejecter=e}))),g){case"scroll":S="scroll";break;case"reverse":S="reverse";break;case"finish":case"stop":h.each(f,(function(t,e){o(e)&&o(e).delayTimer&&(clearTimeout(o(e).delayTimer.setTimeout),o(e).delayTimer.next&&o(e).delayTimer.next(),delete o(e).delayTimer)}));var j=[];return h.each(b.State.calls,(function(t,e){e&&h.each(e[1],(function(n,s){var r=y===i?"":y;return!0!==r&&e[2].queue!==r&&(y!==i||!1!==e[2].queue)||void h.each(f,(function(n,i){i===s&&((!0===y||m.isString(y))&&(h.each(h.queue(i,m.isString(y)?y:""),(function(t,e){m.isFunction(e)&&e(null,!0)})),h.queue(i,m.isString(y)?y:"",[])),"stop"===g?(o(i)&&o(i).tweensContainer&&!1!==r&&h.each(o(i).tweensContainer,(function(t,e){e.endValue=e.currentValue})),j.push(t)):"finish"===g&&(e[2].duration=1))}))}))})),"stop"===g&&(h.each(j,(function(t,e){p(e,!0)})),x.promise&&x.resolver(f)),t();default:if(!h.isPlainObject(g)||m.isEmptyObject(g)){if(m.isString(g)&&b.Redirects[g]){var D=(I=h.extend({},y)).duration,P=I.delay||0;return!0===I.backwards&&(f=h.extend(!0,[],f).reverse()),h.each(f,(function(t,e){parseFloat(I.stagger)?I.delay=P+parseFloat(I.stagger)*t:m.isFunction(I.stagger)&&(I.delay=P+I.stagger.call(e,t,A)),I.drag&&(I.duration=parseFloat(D)||(/^(callout|transition)/.test(g)?1e3:v),I.duration=Math.max(I.duration*(I.backwards?1-t/A:(t+1)/A),.75*I.duration,200)),b.Redirects[g].call(e,e,I||{},t,A,f,x.promise?x:i)})),t()}var E="Velocity: First argument ("+g+") was not a property map, a known action, or a registered redirect. Aborting.";return x.promise?x.rejecter(new Error(E)):console.log(E),t()}S="start"}var I,O,N={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},M=[];if(h.each(f,(function(t,e){m.isNode(e)&&s.call(e)})),(I=h.extend({},b.defaults,y)).loop=parseInt(I.loop),O=2*I.loop-1,I.loop)for(var R=0;O>R;R++){var L={delay:I.delay,progress:I.progress};R===O-1&&(L.display=I.display,L.visibility=I.visibility,L.complete=I.complete),k(f,"reverse",L)}return t()}};(b=h.extend(k,b)).animate=k;var A=e.requestAnimationFrame||f;return b.State.isMobile||n.hidden===i||n.addEventListener("visibilitychange",(function(){n.hidden?(A=function(t){return setTimeout((function(){t(!0)}),16)},u()):A=e.requestAnimationFrame||f})),t.Velocity=b,t!==e&&(t.fn.velocity=k,t.fn.velocity.defaults=b.defaults),h.each(["Down","Up"],(function(t,e){b.Redirects["slide"+e]=function(t,n,s,r,o,a){var l=h.extend({},n),c=l.begin,u=l.complete,p={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},d={};l.display===i&&(l.display="Down"===e?"inline"===b.CSS.Values.getDisplayType(t)?"inline-block":"block":"none"),l.begin=function(){for(var n in c&&c.call(o,o),p){d[n]=t.style[n];var i=b.CSS.getPropertyValue(t,n);p[n]="Down"===e?[i,0]:[0,i]}d.overflow=t.style.overflow,t.style.overflow="hidden"},l.complete=function(){for(var e in d)t.style[e]=d[e];u&&u.call(o,o),a&&a.resolver(o)},b(t,p,l)}})),h.each(["In","Out"],(function(t,e){b.Redirects["fade"+e]=function(t,n,s,r,o,a){var l=h.extend({},n),c={opacity:"In"===e?1:0},u=l.complete;l.complete=s!==r-1?l.begin=null:function(){u&&u.call(o,o),a&&a.resolver(o)},l.display===i&&(l.display="In"===e?"auto":"none"),b(this,c,l)}})),b}jQuery.fn.velocity=jQuery.fn.animate}(window.jQuery||window.Zepto||window,window,document)})),function(t){"function"==typeof require&&"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(["velocity"],t):t()}((function(){return function(t,e,n,i){function s(t,e){var n=[];return!(!t||!e)&&(o.each([t,e],(function(t,e){var i=[];o.each(e,(function(t,e){for(;e.toString().length<5;)e="0"+e;i.push(e)})),n.push(i.join(""))})),parseFloat(n[0])>parseFloat(n[1]))}if(t.Velocity&&t.Velocity.Utilities){var r=t.Velocity,o=r.Utilities;if(s({major:1,minor:1,patch:0},r.version)){var a="Velocity UI Pack: You need to update Velocity (jquery.velocity.js) to a newer version. Visit http://github.com/julianshapiro/velocity.";throw alert(a),new Error(a)}for(var l in r.RegisterEffect=r.RegisterUI=function(t,e){function n(t,e,n,i){var s,a=0;o.each(t.nodeType?[t]:t,(function(t,e){i&&(n+=t*i),s=e.parentNode,o.each(["height","paddingTop","paddingBottom","marginTop","marginBottom"],(function(t,n){a+=parseFloat(r.CSS.getPropertyValue(e,n))}))})),r.animate(s,{height:("In"===e?"+":"-")+"="+a},{queue:!1,easing:"ease-in-out",duration:n*("In"===e?.6:1)})}return r.Redirects[t]=function(s,a,l,c,u,p){var h=l===c-1;"function"==typeof e.defaultDuration?e.defaultDuration=e.defaultDuration.call(u,u):e.defaultDuration=parseFloat(e.defaultDuration);for(var d=0;d<e.calls.length;d++){var f=e.calls[d],m=f[0],g=a.duration||e.defaultDuration||1e3,v=f[1],y=f[2]||{},b={};if(b.duration=g*(v||1),b.queue=a.queue||"",b.easing=y.easing||"ease",b.delay=parseFloat(y.delay)||0,b._cacheValues=y._cacheValues||!0,0===d){if(b.delay+=parseFloat(a.delay)||0,0===l&&(b.begin=function(){a.begin&&a.begin.call(u,u);var e=t.match(/(In|Out)$/);e&&"In"===e[0]&&m.opacity!==i&&o.each(u.nodeType?[u]:u,(function(t,e){r.CSS.setPropertyValue(e,"opacity",0)})),a.animateParentHeight&&e&&n(u,e[0],g+b.delay,a.stagger)}),null!==a.display)if(a.display!==i&&"none"!==a.display)b.display=a.display;else if(/In$/.test(t)){var _=r.CSS.Values.getDisplayType(s);b.display="inline"===_?"inline-block":_}a.visibility&&"hidden"!==a.visibility&&(b.visibility=a.visibility)}if(d===e.calls.length-1){function w(){a.display!==i&&"none"!==a.display||!/Out$/.test(t)||o.each(u.nodeType?[u]:u,(function(t,e){r.CSS.setPropertyValue(e,"display","none")})),a.complete&&a.complete.call(u,u),p&&p.resolver(u||s)}b.complete=function(){if(e.reset){for(var t in e.reset){var n=e.reset[t];r.CSS.Hooks.registered[t]!==i||"string"!=typeof n&&"number"!=typeof n||(e.reset[t]=[e.reset[t],e.reset[t]])}var o={duration:0,queue:!1};h&&(o.complete=w),r.animate(s,e.reset,o)}else h&&w()},"hidden"===a.visibility&&(b.visibility=a.visibility)}r.animate(s,m,b)}},r},r.RegisterEffect.packagedEffects={"callout.bounce":{defaultDuration:550,calls:[[{translateY:-30},.25],[{translateY:0},.125],[{translateY:-15},.125],[{translateY:0},.25]]},"callout.shake":{defaultDuration:800,calls:[[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:0},.125]]},"callout.flash":{defaultDuration:1100,calls:[[{opacity:[0,"easeInOutQuad",1]},.25],[{opacity:[1,"easeInOutQuad"]},.25],[{opacity:[0,"easeInOutQuad"]},.25],[{opacity:[1,"easeInOutQuad"]},.25]]},"callout.pulse":{defaultDuration:825,calls:[[{scaleX:1.1,scaleY:1.1},.5,{easing:"easeInExpo"}],[{scaleX:1,scaleY:1},.5]]},"callout.swing":{defaultDuration:950,calls:[[{rotateZ:15},.2],[{rotateZ:-10},.2],[{rotateZ:5},.2],[{rotateZ:-5},.2],[{rotateZ:0},.2]]},"callout.tada":{defaultDuration:1e3,calls:[[{scaleX:.9,scaleY:.9,rotateZ:-3},.1],[{scaleX:1.1,scaleY:1.1,rotateZ:3},.1],[{scaleX:1.1,scaleY:1.1,rotateZ:-3},.1],["reverse",.125],["reverse",.125],["reverse",.125],["reverse",.125],["reverse",.125],[{scaleX:1,scaleY:1,rotateZ:0},.2]]},"transition.fadeIn":{defaultDuration:500,calls:[[{opacity:[1,0]}]]},"transition.fadeOut":{defaultDuration:500,calls:[[{opacity:[0,1]}]]},"transition.flipXIn":{defaultDuration:700,calls:[[{opacity:[1,0],transformPerspective:[800,800],rotateY:[0,-55]}]],reset:{transformPerspective:0}},"transition.flipXOut":{defaultDuration:700,calls:[[{opacity:[0,1],transformPerspective:[800,800],rotateY:55}]],reset:{transformPerspective:0,rotateY:0}},"transition.flipYIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],rotateX:[0,-45]}]],reset:{transformPerspective:0}},"transition.flipYOut":{defaultDuration:800,calls:[[{opacity:[0,1],transformPerspective:[800,800],rotateX:25}]],reset:{transformPerspective:0,rotateX:0}},"transition.flipBounceXIn":{defaultDuration:900,calls:[[{opacity:[.725,0],transformPerspective:[400,400],rotateY:[-10,90]},.5],[{opacity:.8,rotateY:10},.25],[{opacity:1,rotateY:0},.25]],reset:{transformPerspective:0}},"transition.flipBounceXOut":{defaultDuration:800,calls:[[{opacity:[.9,1],transformPerspective:[400,400],rotateY:-10},.5],[{opacity:0,rotateY:90},.5]],reset:{transformPerspective:0,rotateY:0}},"transition.flipBounceYIn":{defaultDuration:850,calls:[[{opacity:[.725,0],transformPerspective:[400,400],rotateX:[-10,90]},.5],[{opacity:.8,rotateX:10},.25],[{opacity:1,rotateX:0},.25]],reset:{transformPerspective:0}},"transition.flipBounceYOut":{defaultDuration:800,calls:[[{opacity:[.9,1],transformPerspective:[400,400],rotateX:-15},.5],[{opacity:0,rotateX:90},.5]],reset:{transformPerspective:0,rotateX:0}},"transition.swoopIn":{defaultDuration:850,calls:[[{opacity:[1,0],transformOriginX:["100%","50%"],transformOriginY:["100%","100%"],scaleX:[1,0],scaleY:[1,0],translateX:[0,-700],translateZ:0}]],reset:{transformOriginX:"50%",transformOriginY:"50%"}},"transition.swoopOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformOriginX:["50%","100%"],transformOriginY:["100%","100%"],scaleX:0,scaleY:0,translateX:-700,translateZ:0}]],reset:{transformOriginX:"50%",transformOriginY:"50%",scaleX:1,scaleY:1,translateX:0}},"transition.whirlIn":{defaultDuration:850,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,0],scaleY:[1,0],rotateY:[0,160]},1,{easing:"easeInOutSine"}]]},"transition.whirlOut":{defaultDuration:750,calls:[[{opacity:[0,"easeInOutQuint",1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:0,scaleY:0,rotateY:160},1,{easing:"swing"}]],reset:{scaleX:1,scaleY:1,rotateY:0}},"transition.shrinkIn":{defaultDuration:750,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,1.5],scaleY:[1,1.5],translateZ:0}]]},"transition.shrinkOut":{defaultDuration:600,calls:[[{opacity:[0,1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:1.3,scaleY:1.3,translateZ:0}]],reset:{scaleX:1,scaleY:1}},"transition.expandIn":{defaultDuration:700,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,.625],scaleY:[1,.625],translateZ:0}]]},"transition.expandOut":{defaultDuration:700,calls:[[{opacity:[0,1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:.5,scaleY:.5,translateZ:0}]],reset:{scaleX:1,scaleY:1}},"transition.bounceIn":{defaultDuration:800,calls:[[{opacity:[1,0],scaleX:[1.05,.3],scaleY:[1.05,.3]},.4],[{scaleX:.9,scaleY:.9,translateZ:0},.2],[{scaleX:1,scaleY:1},.5]]},"transition.bounceOut":{defaultDuration:800,calls:[[{scaleX:.95,scaleY:.95},.35],[{scaleX:1.1,scaleY:1.1,translateZ:0},.35],[{opacity:[0,1],scaleX:.3,scaleY:.3},.3]],reset:{scaleX:1,scaleY:1}},"transition.bounceUpIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateY:[-30,1e3]},.6,{easing:"easeOutCirc"}],[{translateY:10},.2],[{translateY:0},.2]]},"transition.bounceUpOut":{defaultDuration:1e3,calls:[[{translateY:20},.2],[{opacity:[0,"easeInCirc",1],translateY:-1e3},.8]],reset:{translateY:0}},"transition.bounceDownIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateY:[30,-1e3]},.6,{easing:"easeOutCirc"}],[{translateY:-10},.2],[{translateY:0},.2]]},"transition.bounceDownOut":{defaultDuration:1e3,calls:[[{translateY:-20},.2],[{opacity:[0,"easeInCirc",1],translateY:1e3},.8]],reset:{translateY:0}},"transition.bounceLeftIn":{defaultDuration:750,calls:[[{opacity:[1,0],translateX:[30,-1250]},.6,{easing:"easeOutCirc"}],[{translateX:-10},.2],[{translateX:0},.2]]},"transition.bounceLeftOut":{defaultDuration:750,calls:[[{translateX:30},.2],[{opacity:[0,"easeInCirc",1],translateX:-1250},.8]],reset:{translateX:0}},"transition.bounceRightIn":{defaultDuration:750,calls:[[{opacity:[1,0],translateX:[-30,1250]},.6,{easing:"easeOutCirc"}],[{translateX:10},.2],[{translateX:0},.2]]},"transition.bounceRightOut":{defaultDuration:750,calls:[[{translateX:-30},.2],[{opacity:[0,"easeInCirc",1],translateX:1250},.8]],reset:{translateX:0}},"transition.slideUpIn":{defaultDuration:900,calls:[[{opacity:[1,0],translateY:[0,20],translateZ:0}]]},"transition.slideUpOut":{defaultDuration:900,calls:[[{opacity:[0,1],translateY:-20,translateZ:0}]],reset:{translateY:0}},"transition.slideDownIn":{defaultDuration:900,calls:[[{opacity:[1,0],translateY:[0,-20],translateZ:0}]]},"transition.slideDownOut":{defaultDuration:900,calls:[[{opacity:[0,1],translateY:20,translateZ:0}]],reset:{translateY:0}},"transition.slideLeftIn":{defaultDuration:1e3,calls:[[{opacity:[1,0],translateX:[0,-20],translateZ:0}]]},"transition.slideLeftOut":{defaultDuration:1050,calls:[[{opacity:[0,1],translateX:-20,translateZ:0}]],reset:{translateX:0}},"transition.slideRightIn":{defaultDuration:1e3,calls:[[{opacity:[1,0],translateX:[0,20],translateZ:0}]]},"transition.slideRightOut":{defaultDuration:1050,calls:[[{opacity:[0,1],translateX:20,translateZ:0}]],reset:{translateX:0}},"transition.slideUpBigIn":{defaultDuration:850,calls:[[{opacity:[1,0],translateY:[0,75],translateZ:0}]]},"transition.slideUpBigOut":{defaultDuration:800,calls:[[{opacity:[0,1],translateY:-75,translateZ:0}]],reset:{translateY:0}},"transition.slideDownBigIn":{defaultDuration:850,calls:[[{opacity:[1,0],translateY:[0,-75],translateZ:0}]]},"transition.slideDownBigOut":{defaultDuration:800,calls:[[{opacity:[0,1],translateY:75,translateZ:0}]],reset:{translateY:0}},"transition.slideLeftBigIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateX:[0,-75],translateZ:0}]]},"transition.slideLeftBigOut":{defaultDuration:750,calls:[[{opacity:[0,1],translateX:-75,translateZ:0}]],reset:{translateX:0}},"transition.slideRightBigIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateX:[0,75],translateZ:0}]]},"transition.slideRightBigOut":{defaultDuration:750,calls:[[{opacity:[0,1],translateX:75,translateZ:0}]],reset:{translateX:0}},"transition.perspectiveUpIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:["100%","100%"],rotateX:[0,-180]}]]},"transition.perspectiveUpOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:["100%","100%"],rotateX:-180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateX:0}},"transition.perspectiveDownIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:[0,0],rotateX:[0,180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveDownOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:[0,0],rotateX:180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateX:0}},"transition.perspectiveLeftIn":{defaultDuration:950,calls:[[{opacity:[1,0],transformPerspective:[2e3,2e3],transformOriginX:[0,0],transformOriginY:[0,0],rotateY:[0,-180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveLeftOut":{defaultDuration:950,calls:[[{opacity:[0,1],transformPerspective:[2e3,2e3],transformOriginX:[0,0],transformOriginY:[0,0],rotateY:-180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateY:0}},"transition.perspectiveRightIn":{defaultDuration:950,calls:[[{opacity:[1,0],transformPerspective:[2e3,2e3],transformOriginX:["100%","100%"],transformOriginY:[0,0],rotateY:[0,180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveRightOut":{defaultDuration:950,calls:[[{opacity:[0,1],transformPerspective:[2e3,2e3],transformOriginX:["100%","100%"],transformOriginY:[0,0],rotateY:180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateY:0}}},r.RegisterEffect.packagedEffects)r.RegisterEffect(l,r.RegisterEffect.packagedEffects[l]);r.RunSequence=function(t){var e=o.extend(!0,[],t);e.length>1&&(o.each(e.reverse(),(function(t,n){var i=e[t+1];if(i){var s=n.options&&!1===n.options.sequenceQueue?"begin":"complete",a=i.options&&i.options[s],l={};l[s]=function(){var t=i.elements||i.e,e=t.nodeType?[t]:t;a&&a.call(e,e),r(n)},i.options=o.extend({},i.options,l)}})),e.reverse()),r(e[0])}}else e.console&&console.log("Velocity UI Pack: Velocity must be loaded first. Aborting.")}(window.jQuery||window.Zepto||window,window,document)})),function(){var t,e,n,i,s,r,o,a,l,c,u=[].slice,p=[].indexOf||function(t){for(var e=0,n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return-1},h=function(t,e){function n(){this.constructor=t}for(var i in e)d.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty,f=function(t,e){return function(){return t.apply(e,arguments)}};n={bind:function(t,e){var n,i,s,r,o;for(i=t.split(" "),this.hasOwnProperty("_callbacks")||this._callbacks||(this._callbacks={}),s=0,r=i.length;s<r;s++)o=i[s],(n=this._callbacks)[o]||(n[o]=[]),this._callbacks[o].push(e);return this},one:function(t,e){var n;return this.bind(t,n=function(){return this.unbind(t,n),e.apply(this,arguments)})},trigger:function(){var t,e,n,i,s,r;if(e=(t=1<=arguments.length?u.call(arguments,0):[]).shift(),s=null!=(r=this._callbacks)?r[e]:void 0){for(n=0,i=s.length;n<i&&!1!==s[n].apply(this,t);n++);return!0}},listenTo:function(t,e,n){return t.on(e,n),this.listeningTo||(this.listeningTo=[]),this.listeningTo.push({obj:t,ev:e,callback:n}),this},listenToOnce:function(t,e,n){var i,s;return s=this.listeningToOnce||(this.listeningToOnce=[]),t.on(e,i=function(){var r,o,a,l,c;for(o=-1,r=a=0,l=s.length;a<l;r=++a)(c=s[r]).obj===t&&c.ev===e&&c.callback===i&&(o=r);return t.off(e,i),-1!==o&&s.splice(o,1),n.apply(this,arguments)}),s.push({obj:t,ev:e,callback:i}),this},stopListening:function(t,e,n){var i,s,r,o,a,l,c,u,h,d,f,m,g,v,y,b,_,w;if(0===arguments.length){for(a=0,u=(b=[this.listeningTo,this.listeningToOnce]).length;a<u;a++)if(null!=(m=b[a])?m.length:void 0)for(l=0,h=m.length;l<h;l++)(g=m[l]).obj.off(g.ev,g.callback);this.listeningTo=void 0,this.listeningToOnce=void 0}else if(t)for(e=e?e.split(" "):[void 0],c=0,d=(_=[this.listeningTo,this.listeningToOnce]).length;c<d;c++)if(m=_[c])for(v=0,f=e.length;v<f;v++)for(s=e[v],o=y=w=m.length-1;w<=0?y<=0:y>=0;o=w<=0?++y:--y)(g=m[o])&&g.obj===t&&(n&&g.callback!==n||(s&&s!==g.ev?s&&(r=g.ev.split(" "),p.call(r,s)>=0&&(r=function(){var t,e,n;for(n=[],e=0,t=r.length;e<t;e++)(i=r[e])!==s&&n.push(i);return n}(),g.ev=r.join(" ").trim(),g.obj.off(s,g.callback))):(g.obj.off(g.ev,g.callback),-1!==o&&m.splice(o,1))));return this},unbind:function(t,e){var n,i,s,r,o,a,l,c,u;if(0===arguments.length)return this._callbacks={},this;if(!t)return this;for(s=0,o=(n=t.split(" ")).length;s<o;s++)if(c=n[s],l=null!=(u=this._callbacks)?u[c]:void 0)if(e){for(i=r=0,a=l.length;r<a;i=++r)if(l[i]===e){(l=l.slice()).splice(i,1),this._callbacks[c]=l;break}}else delete this._callbacks[c];return this}},n.on=n.bind,n.off=n.unbind,i={trace:!0,logPrefix:"(App)",log:function(){var t;if(t=1<=arguments.length?u.call(arguments,0):[],this.trace)return this.logPrefix&&t.unshift(this.logPrefix),null!=console&&"function"==typeof console.log&&console.log.apply(console,t),this}},c=["included","extended"],r=function(){function t(){"function"==typeof this.init&&this.init.apply(this,arguments)}return t.include=function(t){var e,n,i;if(!t)throw new Error("include(obj) requires obj");for(e in t)i=t[e],p.call(c,e)<0&&(this.prototype[e]=i);return null!=(n=t.included)&&n.apply(this),this},t.extend=function(t){var e,n,i;if(!t)throw new Error("extend(obj) requires obj");for(e in t)i=t[e],p.call(c,e)<0&&(this[e]=i);return null!=(n=t.extended)&&n.apply(this),this},t.proxy=function(t){return e=this,function(){return t.apply(e,arguments)};var e},t.prototype.proxy=function(t){return e=this,function(){return t.apply(e,arguments)};var e},t}(),s=function(e){function i(t){i.__super__.constructor.apply(this,arguments),null!=this.constructor.uuid&&"function"==typeof this.constructor.uuid?(this.cid=this.constructor.uuid(),this.id||(this.id=this.cid)):this.cid=(null!=t?t.cid:void 0)||this.constructor.uid("c-"),t&&this.load(t)}return h(i,e),i.extend(n),i.include(n),i.records=[],i.irecords={},i.attributes=[],i.configure=function(){var t,e;return e=arguments[0],t=2<=arguments.length?u.call(arguments,1):[],this.className=e,this.deleteAll(),t.length&&(this.attributes=t),this.attributes&&(this.attributes=l(this.attributes)),this.attributes||(this.attributes=[]),this.unbind(),this},i.toString=function(){return this.className+"("+this.attributes.join(", ")+")"},i.find=function(t,e){var n;return null==e&&(e=this.notFound),(null!=(n=this.irecords[t])?n.clone():void 0)||("function"==typeof e?e(t):void 0)},i.findAll=function(t,e){var n,i,s,r;for(r=[],i=0,s=t.length;i<s;i++)n=t[i],this.find(n,e)&&r.push(this.find(n));return r},i.notFound=function(){return null},i.exists=function(t){return Boolean(this.irecords[t])},i.addRecord=function(t,e){var n;return(n=this.irecords[t.id||t.cid])?n.refresh(t):(t.id||(t.id=t.cid),this.irecords[t.id]=this.irecords[t.cid]=t,void 0!==e?this.records.splice(e,0,t):this.records.push(t)),t},i.refresh=function(t,e){var n,i,s,r,o;for(null==e&&(e={}),e.clear&&this.deleteAll(),r=this.fromJSON(t),Array.isArray(r)||(r=[r]),n=0,i=r.length;n<i;n++)s=r[n],this.addRecord(s);return this.sort(),o=this.cloneArray(r),this.trigger("refresh",o,e),o},i.select=function(t){var e,n,i,s,r;for(r=[],e=0,n=(s=this.records).length;e<n;e++)t(i=s[e])&&r.push(i.clone());return r},i.findByAttribute=function(t,e){var n,i,s,r;for(n=0,i=(r=this.records).length;n<i;n++)if((s=r[n])[t]===e)return s.clone();return null},i.findAllByAttribute=function(t,e){return this.select((function(n){return n[t]===e}))},i.each=function(t){var e,n,i,s,r;for(r=[],e=0,n=(s=this.records).length;e<n;e++)i=s[e],r.push(t(i.clone()));return r},i.all=function(){return this.cloneArray(this.records)},i.slice=function(t,e){return null==t&&(t=0),this.cloneArray(this.records.slice(t,e))},i.first=function(t){var e;return null==t&&(t=1),t>1?this.cloneArray(this.records.slice(0,t)):null!=(e=this.records[0])?e.clone():void 0},i.last=function(t){var e;return"number"==typeof t?this.cloneArray(this.records.slice(-t)):null!=(e=this.records[this.records.length-1])?e.clone():void 0},i.count=function(){return this.records.length},i.deleteAll=function(){return this.records=[],this.irecords={}},i.destroyAll=function(t){var e,n,i,s,r;for(r=[],e=0,n=(s=this.records).length;e<n;e++)i=s[e],r.push(i.destroy(t));return r},i.update=function(t,e,n){return this.find(t).updateAttributes(e,n)},i.create=function(t,e){return new this(t).save(e)},i.destroy=function(t,e){var n;return null!=(n=this.find(t))?n.destroy(e):void 0},i.change=function(t){return"function"==typeof t?this.bind("change",t):this.trigger.apply(this,["change"].concat(u.call(arguments)))},i.fetch=function(t){return"function"==typeof t?this.bind("fetch",t):this.trigger.apply(this,["fetch"].concat(u.call(arguments)))},i.toJSON=function(){return this.records},i.beforeFromJSON=function(t){return t},i.fromJSON=function(t){var e,n,i,s;if(t){if("string"==typeof t&&(t=JSON.parse(t)),t=this.beforeFromJSON(t),Array.isArray(t)){for(i=[],e=0,n=t.length;e<n;e++)(s=t[e])instanceof this?i.push(s):i.push(new this(s));return i}return t instanceof this?t:new this(t)}},i.fromForm=function(){var t;return(t=new this).fromForm.apply(t,arguments)},i.sort=function(){return this.comparator&&this.records.sort(this.comparator),this},i.cloneArray=function(t){var e,n,i,s;for(i=[],e=0,n=t.length;e<n;e++)s=t[e],i.push(s.clone());return i},i.idCounter=0,i.uid=function(t){var e;return null==t&&(t=""),e=t+this.idCounter++,this.exists(e)&&(e=this.uid(t)),e},i.prototype.isNew=function(){return!this.exists()},i.prototype.isValid=function(){return!this.validate()},i.prototype.validate=function(){},i.prototype.load=function(t){var e,n;for(e in t.id&&(this.id=t.id),t)if(n=t[e],"function"==typeof this[e]){if("function"==typeof n)continue;this[e](n)}else this[e]=n;return this},i.prototype.attributes=function(){var t,e,n,i,s;for(s={},t=0,n=(i=this.constructor.attributes).length;t<n;t++)(e=i[t])in this&&("function"==typeof this[e]?s[e]=this[e]():s[e]=this[e]);return this.id&&(s.id=this.id),s},i.prototype.eql=function(t){return t&&t.constructor===this.constructor&&(t.cid===this.cid||t.id&&t.id===this.id)},i.prototype.save=function(t){var e,n;return null==t&&(t={}),!1!==t.validate&&(e=this.validate())?(this.trigger("error",this,e),!1):(this.trigger("beforeSave",this,t),n=this.isNew()?this.create(t):this.update(t),this.stripCloneAttrs(),this.trigger("save",n,t),n)},i.prototype.stripCloneAttrs=function(){var t,e;if(!this.hasOwnProperty("cid")){for(t in e=this)d.call(e,t)&&(e[t],p.call(this.constructor.attributes,t)>=0&&delete this[t]);return this}},i.prototype.updateAttribute=function(t,e,n){var i;return(i={})[t]=e,this.updateAttributes(i,n)},i.prototype.updateAttributes=function(t,e){return this.load(t),this.save(e)},i.prototype.changeID=function(t){var e;if(t!==this.id)return(e=this.constructor.irecords)[t]=e[this.id],this.cid!==this.id&&delete e[this.id],this.id=t},i.prototype.remove=function(t){var e,n,i,s,r;for(null==t&&(t={}),e=n=0,i=(r=this.constructor.records.slice(0)).length;n<i;e=++n)if(s=r[e],this.eql(s)){r.splice(e,1);break}if(this.constructor.records=r,t.clear)return delete this.constructor.irecords[this.id],delete this.constructor.irecords[this.cid]},i.prototype.destroy=function(t){return null==t&&(t={}),null==t.clear&&(t.clear=!0),this.trigger("beforeDestroy",this,t),this.remove(t),this.destroyed=!0,this.trigger("destroy",this,t),this.trigger("change",this,"destroy",t),this.listeningTo&&this.stopListening(),this.unbind(),this},i.prototype.dup=function(t){var e,n;return null==t&&(t=!0),e=this.attributes(),t?delete e.id:e.cid=this.cid,n=new this.constructor(e),t||this._callbacks&&(n._callbacks=this._callbacks),n},i.prototype.clone=function(){return a(this)},i.prototype.reload=function(){var t;return this.isNew()?this:(t=this.constructor.find(this.id),this.load(t.attributes()),t)},i.prototype.refresh=function(t){var e,n;return(t=this.constructor.fromJSON(t)).id&&this.id!==t.id&&this.changeID(t.id),this.constructor.irecords[this.id]?(this.constructor.irecords[this.id].load(t),this.trigger("refresh",this),this):(n=this.constructor.className,e=JSON.stringify(t),void console.log("Can't refresh not existing %s instance with ID %s and attributes %s. Possible race condition?",n,this.id,e))},i.prototype.toJSON=function(){return this.attributes()},i.prototype.toString=function(){return"<"+this.constructor.className+" ("+JSON.stringify(this)+")>"},i.prototype.fromForm=function(e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m;for(m={},i=0,a=(h=t(e).find("[type=checkbox]:not([value])")).length;i<a;i++)m[(n=h[i]).name]=t(n).prop("checked");for(s=0,l=(d=t(e).find('[type=checkbox][name$="[]"]')).length;s<l;s++)m[u=(n=d[s]).name.replace(/\[\]$/,"")]||(m[u]=[]),t(n).prop("checked")&&m[u].push(n.value);for(o=0,c=(f=t(e).serializeArray()).length;o<c;o++)m[p=(r=f[o]).name]||(m[p]=r.value);return this.load(m)},i.prototype.exists=function(){return this.constructor.exists(this.id)},i.prototype.update=function(t){var e,n
;return this.trigger("beforeUpdate",this,t),(n=this.constructor.irecords)[this.id].load(this.attributes()),this.constructor.sort(),(e=n[this.id].clone()).trigger("update",e,t),e.trigger("change",e,"update",t),e},i.prototype.create=function(t){var e,n;return this.trigger("beforeCreate",this,t),this.id||(this.id=this.cid),n=this.dup(!1),this.constructor.addRecord(n,t.idx),this.constructor.sort(),(e=n.clone()).trigger("create",e,t),e.trigger("change",e,"create",t),e},i.prototype.bind=function(){var t;return t=this.constructor.irecords[this.id]||this,n.bind.apply(t,arguments)},i.prototype.one=function(){var t;return t=this.constructor.irecords[this.id]||this,n.one.apply(t,arguments)},i.prototype.unbind=function(){var t;return t=this.constructor.irecords[this.id]||this,n.unbind.apply(t,arguments)},i.prototype.trigger=function(){var t;return n.trigger.apply(this,arguments),(t=this.constructor).trigger.apply(t,arguments)},i}(r),s.prototype.on=s.prototype.bind,s.prototype.off=s.prototype.unbind,e=function(e){function s(e){var n,i,r,o,a;for(i in this.release=f(this.release,this),this.options=e,o=this.options)a=o[i],this[i]=a;for(this.el||(this.el=document.createElement(this.tag)),this.el=t(this.el),this.className&&this.el.addClass(this.className),this.attributes&&this.el.attr(this.attributes),this.events||(this.events=this.constructor.events),this.elements||(this.elements=this.constructor.elements),n=this;r=n.constructor.__super__;)r.events&&(this.events=t.extend({},r.events,this.events)),r.elements&&(this.elements=t.extend({},r.elements,this.elements)),n=r;this.events&&this.delegateEvents(this.events),this.elements&&this.refreshElements(),s.__super__.constructor.apply(this,arguments)}return h(s,e),s.include(n),s.include(i),s.prototype.eventSplitter=/^(\S+)\s*(.*)$/,s.prototype.tag="div",s.prototype.release=function(){return this.trigger("release",this),this.el.remove(),this.unbind(),this.stopListening()},s.prototype.$=function(t){return this.el.find(t)},s.prototype.delegateEvents=function(t){var e,n,i,s,r,o;for(n in r=[],t){if("function"==typeof(s=t[n]))s=function(t){return function(e){return function(){return e.apply(t,arguments),!0}}}(this)(s);else{if(!this[s])throw new Error(s+" doesn't exist");s=function(t){return function(e){return function(){return t[e].apply(t,arguments),!0}}}(this)(s)}e=(i=n.match(this.eventSplitter))[1],""===(o=i[2])?r.push(this.el.on(e,s)):r.push(this.el.on(e,o,s))}return r},s.prototype.refreshElements=function(){var t,e,n,i;for(t in n=[],e=this.elements)i=e[t],n.push(this[i]=this.$(t));return n},s.prototype.delay=function(t,e){return setTimeout(this.proxy(t),e||0)},s.prototype.html=function(t){return this.el.html(t.el||t),this.refreshElements(),this.el},s.prototype.append=function(){var t,e,n;return e=1<=arguments.length?u.call(arguments,0):[],e=function(){var n,i,s;for(s=[],n=0,i=e.length;n<i;n++)t=e[n],s.push(t.el||t);return s}(),(n=this.el).append.apply(n,e),this.refreshElements(),this.el},s.prototype.appendTo=function(t){return this.el.appendTo(t.el||t),this.refreshElements(),this.el},s.prototype.prepend=function(){var t,e,n;return e=1<=arguments.length?u.call(arguments,0):[],e=function(){var n,i,s;for(s=[],n=0,i=e.length;n<i;n++)t=e[n],s.push(t.el||t);return s}(),(n=this.el).prepend.apply(n,e),this.refreshElements(),this.el},s.prototype.replace=function(e){var n,i,s;return"string"==typeof(e=e.el||e)&&(e=e.trim()),n=(s=[this.el,t((null!=(i=t.parseHTML(e))?i[0]:void 0)||e)])[0],this.el=s[1],n.replaceWith(this.el),this.delegateEvents(this.events),this.refreshElements(),this.el},s}(r),t=("undefined"!=typeof window&&null!==window?window.jQuery:void 0)||("undefined"!=typeof window&&null!==window?window.Zepto:void 0)||function(t){return t},a=Object.create||function(t){var e;return(e=function(){}).prototype=t,new e},l=function(t){return Array.prototype.slice.call(t,0)},o=this.Spine={},null!=module&&(module.exports=o),o.version="1.6.1",o.$=t,o.Events=n,o.Log=i,o.Module=r,o.Controller=e,o.Model=s,r.extend.call(o,n),r.create=r.sub=e.create=e.sub=s.sub=function(t,e){var n;return n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(this),t&&n.include(t),e&&n.extend(e),"function"==typeof n.unbind&&n.unbind(),n},s.setup=function(t,e){var n;return null==e&&(e=[]),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(this),n.configure.apply(n,[t].concat(u.call(e))),n},o.Class=r}.call(this),function(){var t,e,n,i,s,r,o,a,l,c,u,p=[].slice,h=function(t,e){return function(){return t.apply(e,arguments)}},d=function(t,e){function n(){this.constructor=t}for(var i in e)f.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},f={}.hasOwnProperty;u=this.Spine||require("spine"),t=u.$,a=u.Model,l=t({}),e={getURL:function(t){return null!=t.className?this.generateURL(t):this.generateURL(t,encodeURIComponent(t.id))},getCollectionURL:function(t){return this.generateURL(t)},getScope:function(t){return("function"==typeof t.scope?t.scope():void 0)||t.scope},getCollection:function(t){return t.url!==t.generateURL?"function"==typeof t.url?t.url():t.url:null!=t.className?t.className.toLowerCase()+"s":void 0},generateURL:function(){var t,n,i,s,r;return i=arguments[0],t=2<=arguments.length?p.call(arguments,1):[],n=e.getCollection(i)||e.getCollection(i.constructor),r=e.getScope(i)||e.getScope(i.constructor),t.unshift(n),t.unshift(r),0!==(s=(s=(s=t.join("/")).replace(/(\/\/)/g,"/")).replace(/^\/|\/$/g,"")).indexOf("../")?a.host+"/"+s:s},enabled:!0,disable:function(t){if(!this.enabled)return t();this.enabled=!1;try{return t()}catch(t){throw t}finally{this.enabled=!0}},queue:function(t){return t?l.queue(t):l.queue()},clearQueue:function(){return this.queue([])},config:{loadMethod:"GET",updateMethod:"PUT",createMethod:"POST",destroyMethod:"DELETE"}},n=function(){function n(){}return n.prototype.defaults={dataType:"json",processData:!1,headers:{"X-Requested-With":"XMLHttpRequest"}},n.prototype.queue=e.queue,n.prototype.ajax=function(e,n){return t.ajax(this.ajaxSettings(e,n))},n.prototype.ajaxQueue=function(n,i,s){var r,o,a,c,u,h;return o=null,r=t.Deferred(),c=r.promise(),e.enabled?(h=this.ajaxSettings(n,i),a=void 0!==h.parallel?h.parallel:"GET"===h.type,u=function(n){var i,c,u;if(null!=(null!=s?s.id:void 0)&&(null==h.url&&(h.url=e.getURL(s)),null!=(i=h.data)&&(i.id=s.id)),"string"!=typeof h.data&&!0!==h.processData&&(h.data=JSON.stringify(h.data)),u=function(){return r.resolve.apply(this,p.call(arguments).concat([h]))},c=function(){return r.reject.apply(this,p.call(arguments).concat([h]))},(o=t.ajax(h)).done(u),o.fail(c),o.then(n,n),a)return l.dequeue()},c.abort=function(e){var n;return o?o.abort(e):((n=t.inArray(u,this.queue()))>-1&&this.queue().splice(n,1),r.rejectWith(h.context||h,[c,e,""]),c)},this.queue(u),c):c},n.prototype.ajaxQueueOptions=function(t,n,i,s){var r;return null==n&&(n=null),null==i&&(i=e.config.loadMethod),null==s&&(s=null),r={type:t.method||i,url:t.url||n,parallel:t.parallel,failResponseNoTrigger:t.failResponseNoTrigger},s&&(r.data=s.toJSON(),r.contentType="application/json"),r},n.prototype.ajaxSettings=function(e,n){return t.extend({},this.defaults,n,e)},n}(),i=function(t){function n(t){this.model=t,this.failResponse=h(this.failResponse,this),this.recordsResponse=h(this.recordsResponse,this)}return d(n,t),n.prototype.find=function(t,n,i){var s;return null==i&&(i={}),s=new this.model({id:t}),this.ajaxQueue(n,this.ajaxQueueOptions(i,e.getURL(s))).done(this.recordsResponse(i)).fail(this.failResponse(i))},n.prototype.all=function(t,n){return null==n&&(n={}),this.ajaxQueue(t,this.ajaxQueueOptions(n,e.getURL(this.model))).done(this.recordsResponse(n)).fail(this.failResponse(n))},n.prototype.fetch=function(t,e){var n,i;return null==t&&(t={}),null==e&&(e={}),(n=t.id)?(delete t.id,this.find(n,t,e).done((i=this,function(t){return i.model.refresh(t,e)}))):this.all(t,e).done(function(t){return function(n){return t.model.refresh(n,e)}}(this))},n.prototype.recordsResponse=function(t){return e=this,function(n,i,s,r){var o;return e.model.trigger("ajaxSuccess",null,i,s,r),null!=(o=t.done)?o.call(e.model,r):void 0};var e},n.prototype.failResponse=function(t){return e=this,function(n,i,s,r){var o,a,l;return e.model.trigger("ajaxError",null,n,i,s,r),e.record.trigger("ajaxError",e.record,n,i,s,r),a=n.responseText,_.isEmpty(a)||(o=JSON.parse(a)),null!=(l=t.fail)?l.call(e.record,r,o):void 0};var e},n}(n),c=function(t){function n(t){this.record=t,this.failResponse=h(this.failResponse,this),this.recordResponse=h(this.recordResponse,this),this.model=this.record.constructor}return d(n,t),n.prototype.reload=function(t,e){return null==e&&(e={}),this.ajaxQueue(t,this.ajaxQueueOptions(e),this.record).done(this.recordResponse(e)).fail(this.failResponse(e))},n.prototype.create=function(t,n){return null==n&&(n={}),this.ajaxQueue(t,this.ajaxQueueOptions(n,e.getCollectionURL(this.record),e.config.createMethod,this.record)).done(this.recordResponse(n)).fail(this.failResponse(n))},n.prototype.update=function(t,n){return null==n&&(n={}),this.ajaxQueue(t,this.ajaxQueueOptions(n,null,e.config.updateMethod,this.record),this.record).done(this.recordResponse(n)).fail(this.failResponse(n))},n.prototype.destroy=function(t,n){return null==n&&(n={}),this.ajaxQueue(t,this.ajaxQueueOptions(n,null,e.config.destroyMethod),this.record).done(this.recordResponse(n)).fail(this.failResponse(n))},n.prototype.recordResponse=function(t){return e=this,function(n,i,s,r){var o;return null!=n&&Object.getOwnPropertyNames(n).length&&!e.record.destroyed&&e.record.refresh(n,{ajax:!1}),e.record.trigger("ajaxSuccess",e.record,e.model.fromJSON(n),i,s,r),null!=(o=t.done)?o.call(e.record,r):void 0};var e},n.prototype.failResponse=function(t){return e=this,function(n,i,s,r){var o,a,l;switch(r.type){case"POST":e.createFailed();break;case"DELETE":e.destroyFailed()}return e.record.trigger("ajaxError",e.record,n,i,s,r),a=n.responseText,_.isEmpty(a)||(o=JSON.parse(a)),null!=(l=t.fail)&&l.call(e.record,r,o),e.record.trigger("destroy",e.record)};var e},n.prototype.createFailed=function(){return this.record.remove({clear:!0})},n.prototype.destroyFailed=function(){return this.record.destroyed=!1,this.record.constructor.refresh(this.record)},n}(n),a.host="",r={include:function(){var t;return(t=1<=arguments.length?p.call(arguments,0):[]).unshift(encodeURIComponent(this.id)),e.generateURL.apply(e,[this].concat(p.call(t)))},extend:function(){var t;return t=1<=arguments.length?p.call(arguments,0):[],e.generateURL.apply(e,[this].concat(p.call(t)))}},o={ajax:function(){return new c(this)},generateURL:r.include,url:r.include},s={ajax:function(){return new i(this)},generateURL:r.extend,url:r.extend},a.Ajax={extended:function(){return this.fetch(this.ajaxFetch),this.change(this.ajaxChange),this.extend(s),this.include(o)},ajaxFetch:function(){var t;return(t=this.ajax()).fetch.apply(t,arguments)},ajaxChange:function(t,e,n){var i;if(null==n&&(n={}),!1!==n.ajax)return"function"==typeof(i=t.ajax())[e]?i[e](n.ajax,n):void 0}},a.Ajax.Methods={extended:function(){return this.extend(s),this.include(o)}},e.defaults=n.prototype.defaults,e.Base=n,e.Singleton=c,e.Collection=i,u.Ajax=e,null!=module&&(module.exports=e)}.call(this),function(){var t;(t=this.Spine||require("spine")).Model.Local={extended:function(){var t;t="spine"+(new Date).getTime();try{localStorage.setItem(t,t),localStorage.removeItem(t)}catch(t){return void t}return this.change(this.saveLocal),this.fetch(this.loadLocal)},saveLocal:function(){var t;return t=JSON.stringify(this),localStorage[this.className]=t},loadLocal:function(t){var e;return null==t&&(t={}),t.hasOwnProperty("clear")||(t.clear=!0),e=localStorage[this.className],this.refresh(e||[],t)}},null!=module&&(module.exports=t.Model.Local)}.call(this),function(){var t,e,n,i,s,r,o,a,l=function(t,e){function n(){this.constructor=t}for(var i in e)c.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty,u=[].slice;i=this.Spine||require("spine"),t=i.$,r=/^#*/,o=/:([\w\d]+)/g,a=/\*([\w\d]+)/g,s=/[-[\]{}()+?.,\\^$|#\s]/g,e=function(t){function e(t,e){var n;if(this.names=[],this.path=t,this.callback=e,"string"==typeof t){for(o.lastIndex=0;null!==(n=o.exec(t));)this.names.push(n[1]);for(a.lastIndex=0;null!==(n=a.exec(t));)this.names.push(n[1]);t=t.replace(s,"\\$&").replace(o,"([^/]*)").replace(a,"(.*?)"),this.route=new RegExp("^"+t+"$")}else this.route=t}return l(e,t),e.prototype.match=function(t,e){var i,s,r,o,a,l;if(null==e&&(e={}),!(o=this.route.exec(t)))return!1;if(e.match=o,l=o.slice(1),this.names.length)for(i=s=0,r=l.length;s<r;i=++s)a=l[i],e[this.names[i]]=a;return n.trigger("before",this),!1!==this.callback.call(null,e)},e}(i.Module),n=function(n){function s(){this.routes=[]}var o;return l(s,n),s.extend(i.Events),s.historySupport=null!=(null!=(o=window.history)?o.pushState:void 0),s.options={trigger:!0,history:!1,shim:!1,replace:!1,redirect:!1},s.routers=[],s.setup=function(e){if(null==e&&(e={}),this.options=t.extend({},this.options,e),this.options.history&&(this.history=this.historySupport&&this.options.history),!this.options.shim)return this.history?t(window).on("popstate",this.change):t(window).on("hashchange",this.change),this.change()},s.unbind=function(){var e;return e=i.Events.unbind.apply(this,arguments),arguments.length>0?e:this.options.shim?void 0:this.history?t(window).off("popstate",this.change):t(window).off("hashchange",this.change)},s.navigate=function(){var e,n,i,s;if(i={},"object"==typeof(n=(e=1<=arguments.length?u.call(arguments,0):[])[e.length-1])?i=e.pop():"boolean"==typeof n&&(i.trigger=e.pop()),i=t.extend({},this.options,i),s=e.join("/"),this.path!==s){if(this.path=s,i.trigger&&(this.trigger("navigate",this.path),!this.matchRoutes(this.path,i).length)){if("function"==typeof i.redirect)return i.redirect.apply(this,[this.path,i]);!0===i.redirect&&this.redirect(this.path)}return!!i.shim||(this.history&&i.replace?history.replaceState({},document.title,this.path):this.history?history.pushState({},document.title,this.path):window.location.hash=this.path)}},s.create=function(){var t;return t=new this,this.routers.push(t),t},s.add=function(t,e){return this.router.add(t,e)},s.prototype.add=function(t,n){var i,s,r;if("object"!=typeof t||t instanceof RegExp)return this.routes.push(new e(t,n));for(i in s=[],t)r=t[i],s.push(this.add(i,r));return s},s.prototype.destroy=function(){var t;return this.routes.length=0,this.constructor.routers=function(){var e,n,i,s;for(s=[],e=0,n=(i=this.constructor.routers).length;e<n;e++)(t=i[e])!==this&&s.push(t);return s}.call(this)},s.getPath=function(){var t;return this.history?"/"!==(t=window.location.pathname).substr(0,1)&&(t="/"+t):t=(t=window.location.hash).replace(r,""),t},s.getHost=function(){return window.location.protocol+"//"+window.location.host},s.change=function(){var t;if((t=s.getPath())!==s.path)return s.path=t,s.matchRoutes(s.path)},s.matchRoutes=function(t,e){var n,i,s,r,o;for(r=[],n=0,i=(o=this.routers.concat([this.router])).length;n<i;n++)(s=o[n].matchRoute(t,e))&&r.push(s);return r.length&&this.trigger("change",r,t),r},s.redirect=function(t){return window.location=t},s.prototype.matchRoute=function(t,e){var n,i,s,r;for(n=0,i=(s=this.routes).length;n<i;n++)if((r=s[n]).match(t,e))return r},s.prototype.trigger=function(){var t,e;return(t=1<=arguments.length?u.call(arguments,0):[]).splice(1,0,this),(e=this.constructor).trigger.apply(e,t)},s}(i.Module),n.router=new n,i.Controller.include({route:function(t,e){return this.router instanceof i.Route?this.router.add(t,this.proxy(e)):i.Route.add(t,this.proxy(e))},routes:function(t){var e,n,i;for(e in n=[],t)i=t[e],n.push(this.route(e,i));return n},navigate:function(){return i.Route.navigate.apply(i.Route,arguments)}}),n.Path=e,i.Route=n,null!=module&&(module.exports=n)}.call(this),function(t){t.color={},t.color.make=function(e,n,i,s){var r={};return r.r=e||0,r.g=n||0,r.b=i||0,r.a=null!=s?s:1,r.add=function(t,e){for(var n=0;n<t.length;++n)r[t.charAt(n)]+=e;return r.normalize()},r.scale=function(t,e){for(var n=0;n<t.length;++n)r[t.charAt(n)]*=e;return r.normalize()},r.toString=function(){return r.a>=1?"rgb("+[r.r,r.g,r.b].join(",")+")":"rgba("+[r.r,r.g,r.b,r.a].join(",")+")"},r.normalize=function(){function t(t,e,n){return e<t?t:e>n?n:e}return r.r=t(0,parseInt(r.r),255),r.g=t(0,parseInt(r.g),255),r.b=t(0,parseInt(r.b),255),r.a=t(0,r.a,1),r},r.clone=function(){return t.color.make(r.r,r.b,r.g,r.a)},r.normalize()},t.color.extract=function(e,n){var i;do{if(""!=(i=e.css(n).toLowerCase())&&"transparent"!=i)break;e=e.parent()}while(!t.nodeName(e.get(0),"body"));return"rgba(0, 0, 0, 0)"==i&&(i="transparent"),t.color.parse(i)},t.color.parse=function(n){var i,s=t.color.make;if(i=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(n))return s(parseInt(i[1],10),parseInt(i[2],10),parseInt(i[3],10));if(i=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(n))return s(parseInt(i[1],10),parseInt(i[2],10),parseInt(i[3],10),parseFloat(i[4]));if(i=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(n))return s(2.55*parseFloat(i[1]),2.55*parseFloat(i[2]),2.55*parseFloat(i[3]));if(i=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(n))return s(2.55*parseFloat(i[1]),2.55*parseFloat(i[2]),2.55*parseFloat(i[3]),parseFloat(i[4]));if(i=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(n))return s(parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16));if(i=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(n))return s(parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16),parseInt(i[3]+i[3],16));var r=t.trim(n).toLowerCase();return"transparent"==r?s(255,255,255,0):s((i=e[r]||[0,0,0])[0],i[1],i[2])};var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}}(jQuery),function(t){function e(e,s,r,o){function a(t){return"function"==typeof t}function l(t,e){e=[wt].concat(e);for(var n=0;n<t.length;++n)t[n].apply(this,e)}function c(){for(var e=0;e<o.length;++e){var n=o[e];n.init(wt),n.options&&t.extend(!0,at,n.options)}}function u(e){var n;for(t.extend(!0,at,e),null==at.xaxis.color&&(at.xaxis.color=at.grid.color),null==at.yaxis.color&&(at.yaxis.color=at.grid.color),null==at.xaxis.tickColor&&(at.xaxis.tickColor=at.grid.tickColor),null==at.yaxis.tickColor&&(at.yaxis.tickColor=at.grid.tickColor),null==at.grid.borderColor&&(at.grid.borderColor=at.grid.color),null==at.grid.tickColor&&(at.grid.tickColor=t.color.parse(at.grid.color).scale("a",.22).toString()),n=0;n<Math.max(1,at.xaxes.length);++n)at.xaxes[n]=t.extend(!0,{},at.xaxis,at.xaxes[n]);for(n=0;n<Math.max(1,at.yaxes.length);++n)at.yaxes[n]=t.extend(!0,{},at.yaxis,at.yaxes[n]);for(at.xaxis.noTicks&&null==at.xaxis.ticks&&(at.xaxis.ticks=at.xaxis.noTicks),at.yaxis.noTicks&&null==at.yaxis.ticks&&(at.yaxis.ticks=at.yaxis.noTicks),at.x2axis&&(at.xaxes[1]=t.extend(!0,{},at.xaxis,at.x2axis),at.xaxes[1].position="top"),at.y2axis&&(at.yaxes[1]=t.extend(!0,{},at.yaxis,at.y2axis),at.yaxes[1].position="right"),at.grid.coloredAreas&&(at.grid.markings=at.grid.coloredAreas),at.grid.coloredAreasColor&&(at.grid.markingsColor=at.grid.coloredAreasColor),at.lines&&t.extend(!0,at.series.lines,at.lines),at.points&&t.extend(!0,at.series.points,at.points),at.bars&&t.extend(!0,at.series.bars,at.bars),null!=at.shadowSize&&(at.series.shadowSize=at.shadowSize),n=0;n<at.xaxes.length;++n)v(dt,n+1).options=at.xaxes[n];for(n=0;n<at.yaxes.length;++n)v(ft,n+1).options=at.yaxes[n];for(var i in _t)at.hooks[i]&&at.hooks[i].length&&(_t[i]=_t[i].concat(at.hooks[i]));l(_t.processOptions,[at])}function p(t){ot=h(t),y(),b()}function h(e){for(var n=[],i=0;i<e.length;++i){var s=t.extend(!0,{},at.series);null!=e[i].data?(s.data=e[i].data,delete e[i].data,t.extend(!0,s,e[i]),e[i].data=s.data):s.data=e[i],n.push(s)}return n}function d(t,e){var n=t[e+"axis"];return"object"==typeof n&&(n=n.n),"number"!=typeof n&&(n=1),n}function f(){return t.grep(dt.concat(ft),(function(t){return t}))}function m(t){var e,n,i={};for(e=0;e<dt.length;++e)(n=dt[e])&&n.used&&(i["x"+n.n]=n.c2p(t.left));for(e=0;e<ft.length;++e)(n=ft[e])&&n.used&&(i["y"+n.n]=n.c2p(t.top));return void 0!==i.x1&&(i.x=i.x1),void 0!==i.y1&&(i.y=i.y1),i}function g(t){var e,n,i,s={};for(e=0;e<dt.length;++e)if((n=dt[e])&&n.used&&(null==t[i="x"+n.n]&&1==n.n&&(i="x"),null!=t[i])){s.left=n.p2c(t[i]);break}for(e=0;e<ft.length;++e)if((n=ft[e])&&n.used&&(null==t[i="y"+n.n]&&1==n.n&&(i="y"),null!=t[i])){s.top=n.p2c(t[i]);break}return s}function v(e,n){return e[n-1]||(e[n-1]={n:n,direction:e==dt?"x":"y",options:t.extend(!0,{},e==dt?at.xaxis:at.yaxis)}),e[n-1]}function y(){var e,n=ot.length,i=[],s=[];for(e=0;e<ot.length;++e){var r=ot[e].color;null!=r&&(--n,"number"==typeof r?s.push(r):i.push(t.color.parse(ot[e].color)))}for(e=0;e<s.length;++e)n=Math.max(n,s[e]+1);var o=[],a=0;for(e=0;o.length<n;){var l,c=a%2==1?-1:1;(l=at.colors.length==e?t.color.make(100,100,100):t.color.parse(at.colors[e])).scale("rgb",1+c*Math.ceil(a/2)*.2),o.push(l),++e>=at.colors.length&&(e=0,++a)}var u,p=0;for(e=0;e<ot.length;++e){if(null==(u=ot[e]).color?(u.color=o[p].toString(),++p):"number"==typeof u.color&&(u.color=o[u.color].toString()),null==u.lines.show){var h,f=!0;for(h in u)if(u[h]&&u[h].show){f=!1;break}f&&(u.lines.show=!0)}u.xaxis=v(dt,d(u,"x")),u.yaxis=v(ft,d(u,"y"))}}function b(){function e(t,e,n){e<t.datamin&&e!=-g&&(t.datamin=e),n>t.datamax&&n!=g&&(t.datamax=n)}var n,i,s,r,o,a,c,u,p,h,d=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=Number.MAX_VALUE;for(t.each(f(),(function(t,e){e.datamin=d,e.datamax=m,e.used=!1})),n=0;n<ot.length;++n)(o=ot[n]).datapoints={points:[]},l(_t.processRawData,[o,o.data,o.datapoints]);for(n=0;n<ot.length;++n){var v=(o=ot[n]).data,y=o.datapoints.format;if(y||((y=[]).push({x:!0,number:!0,required:!0}),y.push({y:!0,number:!0,required:!0}),(o.bars.show||o.lines.show&&o.lines.fill)&&(y.push({y:!0,number:!0,required:!1,defaultValue:0}),o.bars.horizontal&&(delete y[y.length-1].y,y[y.length-1].x=!0)),o.datapoints.format=y),null==o.datapoints.pointsize)for(o.datapoints.pointsize=y.length,c=o.datapoints.pointsize,a=o.datapoints.points,insertSteps=o.lines.show&&o.lines.steps,o.xaxis.used=o.yaxis.used=!0,i=s=0;i<v.length;++i,s+=c){var b=null==(h=v[i]);if(!b)for(r=0;r<c;++r)u=h[r],(p=y[r])&&(p.number&&null!=u&&(u=+u,isNaN(u)?u=null:u==1/0?u=g:u==-1/0&&(u=-g)),null==u&&(p.required&&(b=!0),null!=p.defaultValue&&(u=p.defaultValue))),a[s+r]=u;if(b)for(r=0;r<c;++r)null!=(u=a[s+r])&&((p=y[r]).x&&e(o.xaxis,u,u),p.y&&e(o.yaxis,u,u)),a[s+r]=null;else if(insertSteps&&s>0&&null!=a[s-c]&&a[s-c]!=a[s]&&a[s-c+1]!=a[s+1]){for(r=0;r<c;++r)a[s+c+r]=a[s+r];a[s+1]=a[s-c+1],s+=c}}}for(n=0;n<ot.length;++n)o=ot[n],l(_t.processDatapoints,[o,o.datapoints]);for(n=0;n<ot.length;++n){a=(o=ot[n]).datapoints.points,c=o.datapoints.pointsize;var _=d,w=d,k=m,A=m;for(i=0;i<a.length;i+=c)if(null!=a[i])for(r=0;r<c;++r)u=a[i+r],(p=y[r])&&u!=g&&u!=-g&&(p.x&&(u<_&&(_=u),u>k&&(k=u)),p.y&&(u<w&&(w=u),u>A&&(A=u)));if(o.bars.show){var C="left"==o.bars.align?0:-o.bars.barWidth/2;o.bars.horizontal?(w+=C,A+=C+o.bars.barWidth):(_+=C,k+=C+o.bars.barWidth)}e(o.xaxis,_,k),e(o.yaxis,w,A)}t.each(f(),(function(t,e){e.datamin==d&&(e.datamin=null),e.datamax==m&&(e.datamax=null)}))}function _(n,i){var s=document.createElement("canvas");return s.className=i,s.width=gt,s.height=vt,n||t(s).css({position:"absolute",left:0,top:0}),t(s).appendTo(e),s.getContext||(s=window.G_vmlCanvasManager.initElement(s)),s.getContext("2d").save(),s}function w(){if(gt=e.width(),vt=e.height(),gt<=0||vt<=0)throw"Invalid dimensions for plot, width = "+gt+", height = "+vt}function k(t){t.width!=gt&&(t.width=gt),t.height!=vt&&(t.height=vt);var e=t.getContext("2d");e.restore(),e.save()}function A(){var n,i=e.children("canvas.base"),s=e.children("canvas.overlay");0==i.length||0==s?(e.html(""),e.css({padding:0}),"static"==e.css("position")&&e.css("position","relative"),w(),lt=_(!0,"base"),ct=_(!1,"overlay"),n=!1):(lt=i.get(0),ct=s.get(0),n=!0),pt=lt.getContext("2d"),ht=ct.getContext("2d"),ut=t([ct,lt]),n&&(e.data("plot").shutdown(),wt.resize(),ht.clearRect(0,0,gt,vt),ut.off(),e.children().not([lt,ct]).remove()),e.data("plot",wt)}function C(){at.grid.hoverable&&(ut.on("mousemove",G),ut.on("mouseleave",K)),at.grid.clickable&&ut.on("click",Y),l(_t.bindEvents,[ut])}function T(){At&&clearTimeout(At),ut.off("mousemove",G),ut.off("mouseleave",K),ut.off("click",Y),l(_t.shutdown,[ut])}function S(t){function e(t){return t}var n,i,s=t.options.transform||e,r=t.options.inverseTransform;"x"==t.direction?(n=t.scale=yt/Math.abs(s(t.max)-s(t.min)),i=Math.min(s(t.max),s(t.min))):(n=-(n=t.scale=bt/Math.abs(s(t.max)-s(t.min))),i=Math.max(s(t.max),s(t.min))),t.p2c=s==e?function(t){return(t-i)*n}:function(t){return(s(t)-i)*n},t.c2p=r?function(t){return r(i+t/n)}:function(t){return i+t/n}}function x(n){function i(i,s){return t('<div style="position:absolute;top:-10000px;'+s+'font-size:smaller"><div class="'+n.direction+"Axis "+n.direction+n.n+'Axis">'+i.join("")+"</div></div>").appendTo(e)}var s,r,o,a=n.options,l=n.ticks||[],c=[],u=a.labelWidth,p=a.labelHeight;if("x"==n.direction){if(null==u&&(u=Math.floor(gt/(l.length>0?l.length:1))),null==p){for(c=[],s=0;s<l.length;++s)(r=l[s].label)&&c.push('<div class="tickLabel" style="float:left;width:'+u+'px">'+r+"</div>");c.length>0&&(c.push('<div style="clear:left"></div>'),p=(o=i(c,"width:10000px;")).height(),o.remove())}}else if(null==u||null==p){for(s=0;s<l.length;++s)(r=l[s].label)&&c.push('<div class="tickLabel">'+r+"</div>");c.length>0&&(o=i(c,""),null==u&&(u=o.children().width()),null==p&&(p=o.find("div.tickLabel").height()),o.remove())}null==u&&(u=0),null==p&&(p=0),n.labelWidth=u,n.labelHeight=p}function j(e){var n=e.labelWidth,i=e.labelHeight,s=e.options.position,r=e.options.tickLength,o=at.grid.axisMargin,a=at.grid.labelMargin,l="x"==e.direction?dt:ft,c=t.grep(l,(function(t){return t&&t.options.position==s&&t.reserveSpace}));t.inArray(e,c)==c.length-1&&(o=0),null==r&&(r="full");var u=t.grep(l,(function(t){return t&&t.reserveSpace})),p=0==t.inArray(e,u);p||"full"!=r||(r=5),isNaN(+r)||(a+=+r),"x"==e.direction?(i+=a,"bottom"==s?(mt.bottom+=i+o,e.box={top:vt-mt.bottom,height:i}):(e.box={top:mt.top+o,height:i},mt.top+=i+o)):(n+=a,"left"==s?(e.box={left:mt.left+o,width:n},mt.left+=n+o):(mt.right+=n+o,e.box={left:gt-mt.right,width:n})),e.position=s,e.tickLength=r,e.box.padding=a,e.innermost=p}function D(t){"x"==t.direction?(t.box.left=mt.left,t.box.width=yt):(t.box.top=mt.top,t.box.height=bt)}function P(){var e,n=f();if(t.each(n,(function(t,e){e.show=e.options.show,null==e.show&&(e.show=e.used),e.reserveSpace=e.show||e.options.reserveSpace,E(e)})),allocatedAxes=t.grep(n,(function(t){return t.reserveSpace})),mt.left=mt.right=mt.top=mt.bottom=0,at.grid.show){for(t.each(allocatedAxes,(function(t,e){I(e),O(e),N(e,e.ticks),x(e)})),e=allocatedAxes.length-1;e>=0;--e)j(allocatedAxes[e]);var i=at.grid.minBorderMargin;if(null==i)for(i=0,e=0;e<ot.length;++e)i=Math.max(i,ot[e].points.radius+ot[e].points.lineWidth/2);for(var s in mt)mt[s]+=at.grid.borderWidth,mt[s]=Math.max(i,mt[s])}yt=gt-mt.left-mt.right,bt=vt-mt.bottom-mt.top,t.each(n,(function(t,e){S(e)})),at.grid.show&&(t.each(allocatedAxes,(function(t,e){D(e)})),$()),J()}function E(t){var e=t.options,n=+(null!=e.min?e.min:t.datamin),i=+(null!=e.max?e.max:t.datamax),s=i-n;if(0==s){var r=0==i?1:.01;null==e.min&&(n-=r),null!=e.max&&null==e.min||(i+=r)}else{var o=e.autoscaleMargin;null!=o&&(null==e.min&&(n-=s*o)<0&&null!=t.datamin&&t.datamin>=0&&(n=0),null==e.max&&(i+=s*o)>0&&null!=t.datamax&&t.datamax<=0&&(i=0))}t.min=n,t.max=i}function I(e){var i,s=e.options;i="number"==typeof s.ticks&&s.ticks>0?s.ticks:.3*Math.sqrt("x"==e.direction?gt:vt);var r,o,l,c,u,p,h=(e.max-e.min)/i;if("time"==s.mode){var d={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:525949.2*60*1e3},f=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]],m=0;null!=s.minTickSize&&(m="number"==typeof s.tickSize?s.tickSize:s.minTickSize[0]*d[s.minTickSize[1]]);for(var g=0;g<f.length-1&&!(h<(f[g][0]*d[f[g][1]]+f[g+1][0]*d[f[g+1][1]])/2&&f[g][0]*d[f[g][1]]>=m);++g);r=f[g][0],"year"==(l=f[g][1])&&(u=Math.pow(10,Math.floor(Math.log(h/d.year)/Math.LN10)),r=(p=h/d.year/u)<1.5?1:p<3?2:p<7.5?5:10,r*=u),e.tickSize=s.tickSize||[r,l],o=function(t){var e=[],i=t.tickSize[0],s=t.tickSize[1],r=new Date(t.min),o=i*d[s];"second"==s&&r.setUTCSeconds(n(r.getUTCSeconds(),i)),"minute"==s&&r.setUTCMinutes(n(r.getUTCMinutes(),i)),"hour"==s&&r.setUTCHours(n(r.getUTCHours(),i)),"month"==s&&r.setUTCMonth(n(r.getUTCMonth(),i)),"year"==s&&r.setUTCFullYear(n(r.getUTCFullYear(),i)),r.setUTCMilliseconds(0),o>=d.minute&&r.setUTCSeconds(0),o>=d.hour&&r.setUTCMinutes(0),o>=d.day&&r.setUTCHours(0),o>=4*d.day&&r.setUTCDate(1),o>=d.year&&r.setUTCMonth(0);var a,l=0,c=Number.NaN;do{if(a=c,c=r.getTime(),e.push(c),"month"==s)if(i<1){r.setUTCDate(1);var u=r.getTime();r.setUTCMonth(r.getUTCMonth()+1);var p=r.getTime();r.setTime(c+l*d.hour+(p-u)*i),l=r.getUTCHours(),r.setUTCHours(0)}else r.setUTCMonth(r.getUTCMonth()+i);else"year"==s?r.setUTCFullYear(r.getUTCFullYear()+i):r.setTime(c+o)}while(c<t.max&&c!=a);return e},c=function(e,n){var i=new Date(e);if(null!=s.timeformat)return t.plot.formatDate(i,s.timeformat,s.monthNames);var r=n.tickSize[0]*d[n.tickSize[1]],o=n.max-n.min,a=s.twelveHourClock?" %p":"";return r<d.minute?fmt="%h:%M:%S"+a:r<d.day?o<2*d.day?fmt="%h:%M"+a:fmt="%b %d %h:%M"+a:r<d.month?fmt="%b %d":r<d.year?o<d.year?fmt="%b":fmt="%b %y":fmt="%y",t.plot.formatDate(i,fmt,s.monthNames)}}else{var v=s.tickDecimals,y=-Math.floor(Math.log(h)/Math.LN10);null!=v&&y>v&&(y=v),(p=h/(u=Math.pow(10,-y)))<1.5?r=1:p<3?(r=2,p>2.25&&(null==v||y+1<=v)&&(r=2.5,++y)):r=p<7.5?5:10,r*=u,null!=s.minTickSize&&r<s.minTickSize&&(r=s.minTickSize),e.tickDecimals=Math.max(0,null!=v?v:y),e.tickSize=s.tickSize||r,o=function(t){var e,i=[],s=n(t.min,t.tickSize),r=0,o=Number.NaN;do{e=o,o=s+r*t.tickSize,i.push(o),++r}while(o<t.max&&o!=e);return i},c=function(t,e){return t.toFixed(e.tickDecimals)}}if(null!=s.alignTicksWithAxis){var b=("x"==e.direction?dt:ft)[s.alignTicksWithAxis-1];if(b&&b.used&&b!=e){var _=o(e);if(_.length>0&&(null==s.min&&(e.min=Math.min(e.min,_[0])),null==s.max&&_.length>1&&(e.max=Math.max(e.max,_[_.length-1]))),o=function(t){var e,n,i=[];for(n=0;n<b.ticks.length;++n)e=(b.ticks[n].v-b.min)/(b.max-b.min),e=t.min+e*(t.max-t.min),i.push(e);return i},"time"!=e.mode&&null==s.tickDecimals){var w=Math.max(0,1-Math.floor(Math.log(h)/Math.LN10)),k=o(e);k.length>1&&/\..*0$/.test((k[1]-k[0]).toFixed(w))||(e.tickDecimals=w)}}}e.tickGenerator=o,a(s.tickFormatter)?e.tickFormatter=function(t,e){return""+s.tickFormatter(t,e)}:e.tickFormatter=c}function O(t){var e,n,i=t.options.ticks,s=[];for(null==i||"number"==typeof i&&i>0?s=t.tickGenerator(t):i&&(s=a(i)?i({min:t.min,max:t.max}):i),t.ticks=[],e=0;e<s.length;++e){var r=null,o=s[e];"object"==typeof o?(n=+o[0],o.length>1&&(r=o[1])):n=+o,null==r&&(r=t.tickFormatter(n,t)),isNaN(n)||t.ticks.push({v:n,label:r})}}function N(t,e){t.options.autoscaleMargin&&e.length>0&&(null==t.options.min&&(t.min=Math.min(t.min,e[0].v)),null==t.options.max&&e.length>1&&(t.max=Math.max(t.max,e[e.length-1].v)))}function M(){pt.clearRect(0,0,gt,vt);var t=at.grid;t.show&&t.backgroundColor&&L(),t.show&&!t.aboveData&&F();for(var e=0;e<ot.length;++e)l(_t.drawSeries,[pt,ot[e]]),B(ot[e]);l(_t.draw,[pt]),t.show&&t.aboveData&&F()}function R(t,e){var n,s,r,o,a=f();for(i=0;i<a.length;++i)if((n=a[i]).direction==e&&(t[o=e+n.n+"axis"]||1!=n.n||(o=e+"axis"),t[o])){
s=t[o].from,r=t[o].to;break}if(t[o]||(n="x"==e?dt[0]:ft[0],s=t[e+"1"],r=t[e+"2"]),null!=s&&null!=r&&s>r){var l=s;s=r,r=l}return{from:s,to:r,axis:n}}function L(){pt.save(),pt.translate(mt.left,mt.top),pt.fillStyle=rt(at.grid.backgroundColor,bt,0,"rgba(255, 255, 255, 0)"),pt.fillRect(0,0,yt,bt),pt.restore()}function F(){var e;pt.save(),pt.translate(mt.left,mt.top);var n=at.grid.markings;if(n){if(a(n))(o=wt.getAxes()).xmin=o.xaxis.min,o.xmax=o.xaxis.max,o.ymin=o.yaxis.min,o.ymax=o.yaxis.max,n=n(o);for(e=0;e<n.length;++e){var i=n[e],s=R(i,"x"),r=R(i,"y");null==s.from&&(s.from=s.axis.min),null==s.to&&(s.to=s.axis.max),null==r.from&&(r.from=r.axis.min),null==r.to&&(r.to=r.axis.max),s.to<s.axis.min||s.from>s.axis.max||r.to<r.axis.min||r.from>r.axis.max||(s.from=Math.max(s.from,s.axis.min),s.to=Math.min(s.to,s.axis.max),r.from=Math.max(r.from,r.axis.min),r.to=Math.min(r.to,r.axis.max),s.from==s.to&&r.from==r.to||(s.from=s.axis.p2c(s.from),s.to=s.axis.p2c(s.to),r.from=r.axis.p2c(r.from),r.to=r.axis.p2c(r.to),s.from==s.to||r.from==r.to?(pt.beginPath(),pt.strokeStyle=i.color||at.grid.markingsColor,pt.lineWidth=i.lineWidth||at.grid.markingsLineWidth,pt.moveTo(s.from,r.from),pt.lineTo(s.to,r.to),pt.stroke()):(pt.fillStyle=i.color||at.grid.markingsColor,pt.fillRect(s.from,r.to,s.to-s.from,r.from-r.to))))}}for(var o=f(),l=at.grid.borderWidth,c=0;c<o.length;++c){var u,p,h,d,m=o[c],g=m.box,v=m.tickLength;if(m.show&&0!=m.ticks.length){for(pt.strokeStyle=m.options.tickColor||t.color.parse(m.options.color).scale("a",.22).toString(),pt.lineWidth=1,"x"==m.direction?(u=0,p="full"==v?"top"==m.position?0:bt:g.top-mt.top+("top"==m.position?g.height:0)):(p=0,u="full"==v?"left"==m.position?0:yt:g.left-mt.left+("left"==m.position?g.width:0)),m.innermost||(pt.beginPath(),h=d=0,"x"==m.direction?h=yt:d=bt,1==pt.lineWidth&&(u=Math.floor(u)+.5,p=Math.floor(p)+.5),pt.moveTo(u,p),pt.lineTo(u+h,p+d),pt.stroke()),pt.beginPath(),e=0;e<m.ticks.length;++e){var y=m.ticks[e].v;h=d=0,y<m.min||y>m.max||"full"==v&&l>0&&(y==m.min||y==m.max)||("x"==m.direction?(u=m.p2c(y),d="full"==v?-bt:v,"top"==m.position&&(d=-d)):(p=m.p2c(y),h="full"==v?-yt:v,"left"==m.position&&(h=-h)),1==pt.lineWidth&&("x"==m.direction?u=Math.floor(u)+.5:p=Math.floor(p)+.5),pt.moveTo(u,p),pt.lineTo(u+h,p+d))}pt.stroke()}}l&&(pt.lineWidth=l,pt.strokeStyle=at.grid.borderColor,pt.strokeRect(-l/2,-l/2,yt+l,bt+l)),pt.restore()}function $(){e.find(".tickLabels").remove();for(var t=['<div class="tickLabels" style="font-size:smaller">'],n=f(),i=0;i<n.length;++i){var s=n[i],r=s.box;if(s.show){t.push('<div class="'+s.direction+"Axis "+s.direction+s.n+'Axis" style="color:'+s.options.color+'">');for(var o=0;o<s.ticks.length;++o){var a=s.ticks[o];if(!(!a.label||a.v<s.min||a.v>s.max)){var l,c={};"x"==s.direction?(l="center",c.left=Math.round(mt.left+s.p2c(a.v)-s.labelWidth/2),"bottom"==s.position?c.top=r.top+r.padding:c.bottom=vt-(r.top+r.height-r.padding)):(c.top=Math.round(mt.top+s.p2c(a.v)-s.labelHeight/2),"left"==s.position?(c.right=gt-(r.left+r.width-r.padding),l="right"):(c.left=r.left+r.padding,l="left")),c.width=s.labelWidth;var u=["position:absolute","white-space:nowrap","text-align:"+l];for(var p in c)u.push(p+":"+c[p]+"px");t.push('<div class="tickLabel" style="'+u.join(";")+'">'+a.label+"</div>")}}t.push("</div>")}}t.push("</div>"),e.append(t.join(""))}function B(t){t.lines.show&&z(t),t.bars.show&&W(t),t.points.show&&U(t)}function z(t){function e(t,e,n,i,s){var r=t.points,o=t.pointsize,a=null,l=null;pt.beginPath();for(var c=o;c<r.length;c+=o){var u=r[c-o],p=r[c-o+1],h=r[c],d=r[c+1];if(null!=u&&null!=h){if(p<=d&&p<s.min){if(d<s.min)continue;u=(s.min-p)/(d-p)*(h-u)+u,p=s.min}else if(d<=p&&d<s.min){if(p<s.min)continue;h=(s.min-p)/(d-p)*(h-u)+u,d=s.min}if(p>=d&&p>s.max){if(d>s.max)continue;u=(s.max-p)/(d-p)*(h-u)+u,p=s.max}else if(d>=p&&d>s.max){if(p>s.max)continue;h=(s.max-p)/(d-p)*(h-u)+u,d=s.max}if(u<=h&&u<i.min){if(h<i.min)continue;p=(i.min-u)/(h-u)*(d-p)+p,u=i.min}else if(h<=u&&h<i.min){if(u<i.min)continue;d=(i.min-u)/(h-u)*(d-p)+p,h=i.min}if(u>=h&&u>i.max){if(h>i.max)continue;p=(i.max-u)/(h-u)*(d-p)+p,u=i.max}else if(h>=u&&h>i.max){if(u>i.max)continue;d=(i.max-u)/(h-u)*(d-p)+p,h=i.max}u==a&&p==l||pt.moveTo(i.p2c(u)+e,s.p2c(p)+n),a=h,l=d,pt.lineTo(i.p2c(h)+e,s.p2c(d)+n)}}pt.stroke()}function n(t,e,n){for(var i=t.points,s=t.pointsize,r=Math.min(Math.max(0,n.min),n.max),o=0,a=!1,l=1,c=0,u=0;!(s>0&&o>i.length+s);){var p=i[(o+=s)-s],h=i[o-s+l],d=i[o],f=i[o+l];if(a){if(s>0&&null!=p&&null==d){u=o,s=-s,l=2;continue}if(s<0&&o==c+s){pt.fill(),a=!1,l=1,o=c=u+(s=-s);continue}}if(null!=p&&null!=d){if(p<=d&&p<e.min){if(d<e.min)continue;h=(e.min-p)/(d-p)*(f-h)+h,p=e.min}else if(d<=p&&d<e.min){if(p<e.min)continue;f=(e.min-p)/(d-p)*(f-h)+h,d=e.min}if(p>=d&&p>e.max){if(d>e.max)continue;h=(e.max-p)/(d-p)*(f-h)+h,p=e.max}else if(d>=p&&d>e.max){if(p>e.max)continue;f=(e.max-p)/(d-p)*(f-h)+h,d=e.max}if(a||(pt.beginPath(),pt.moveTo(e.p2c(p),n.p2c(r)),a=!0),h>=n.max&&f>=n.max)pt.lineTo(e.p2c(p),n.p2c(n.max)),pt.lineTo(e.p2c(d),n.p2c(n.max));else if(h<=n.min&&f<=n.min)pt.lineTo(e.p2c(p),n.p2c(n.min)),pt.lineTo(e.p2c(d),n.p2c(n.min));else{var m=p,g=d;h<=f&&h<n.min&&f>=n.min?(p=(n.min-h)/(f-h)*(d-p)+p,h=n.min):f<=h&&f<n.min&&h>=n.min&&(d=(n.min-h)/(f-h)*(d-p)+p,f=n.min),h>=f&&h>n.max&&f<=n.max?(p=(n.max-h)/(f-h)*(d-p)+p,h=n.max):f>=h&&f>n.max&&h<=n.max&&(d=(n.max-h)/(f-h)*(d-p)+p,f=n.max),p!=m&&pt.lineTo(e.p2c(m),n.p2c(h)),pt.lineTo(e.p2c(p),n.p2c(h)),pt.lineTo(e.p2c(d),n.p2c(f)),d!=g&&(pt.lineTo(e.p2c(d),n.p2c(f)),pt.lineTo(e.p2c(g),n.p2c(f)))}}}}pt.save(),pt.translate(mt.left,mt.top),pt.lineJoin="round";var i=t.lines.lineWidth,s=t.shadowSize;if(i>0&&s>0){pt.lineWidth=s,pt.strokeStyle="rgba(0,0,0,0.1)";var r=Math.PI/18;e(t.datapoints,Math.sin(r)*(i/2+s/2),Math.cos(r)*(i/2+s/2),t.xaxis,t.yaxis),pt.lineWidth=s/2,e(t.datapoints,Math.sin(r)*(i/2+s/4),Math.cos(r)*(i/2+s/4),t.xaxis,t.yaxis)}pt.lineWidth=i,pt.strokeStyle=t.color;var o=H(t.lines,t.color,0,bt);o&&(pt.fillStyle=o,n(t.datapoints,t.xaxis,t.yaxis)),i>0&&e(t.datapoints,0,0,t.xaxis,t.yaxis),pt.restore()}function U(t){function e(t,e,n,i,s,r,o,a){for(var l=t.points,c=t.pointsize,u=0;u<l.length;u+=c){var p=l[u],h=l[u+1];null==p||p<r.min||p>r.max||h<o.min||h>o.max||(pt.beginPath(),p=r.p2c(p),h=o.p2c(h)+i,"circle"==a?pt.arc(p,h,e,0,s?Math.PI:2*Math.PI,!1):a(pt,p,h,e,s),pt.closePath(),n&&(pt.fillStyle=n,pt.fill()),pt.stroke())}}pt.save(),pt.translate(mt.left,mt.top);var n=t.points.lineWidth,i=t.shadowSize,s=t.points.radius,r=t.points.symbol;if(n>0&&i>0){var o=i/2;pt.lineWidth=o,pt.strokeStyle="rgba(0,0,0,0.1)",e(t.datapoints,s,null,o+o/2,!0,t.xaxis,t.yaxis,r),pt.strokeStyle="rgba(0,0,0,0.2)",e(t.datapoints,s,null,o/2,!0,t.xaxis,t.yaxis,r)}pt.lineWidth=n,pt.strokeStyle=t.color,e(t.datapoints,s,H(t.points,t.color),0,!1,t.xaxis,t.yaxis,r),pt.restore()}function q(t,e,n,i,s,r,o,a,l,c,u,p){var h,d,f,m,g,v,y,b,_;u?(b=v=y=!0,g=!1,m=e+i,f=e+s,(d=t)<(h=n)&&(_=d,d=h,h=_,g=!0,v=!1)):(g=v=y=!0,b=!1,h=t+i,d=t+s,(m=e)<(f=n)&&(_=m,m=f,f=_,b=!0,y=!1)),d<a.min||h>a.max||m<l.min||f>l.max||(h<a.min&&(h=a.min,g=!1),d>a.max&&(d=a.max,v=!1),f<l.min&&(f=l.min,b=!1),m>l.max&&(m=l.max,y=!1),h=a.p2c(h),f=l.p2c(f),d=a.p2c(d),m=l.p2c(m),o&&(c.beginPath(),c.moveTo(h,f),c.lineTo(h,m),c.lineTo(d,m),c.lineTo(d,f),c.fillStyle=o(f,m),c.fill()),p>0&&(g||v||y||b)&&(c.beginPath(),c.moveTo(h,f+r),g?c.lineTo(h,m+r):c.moveTo(h,m+r),y?c.lineTo(d,m+r):c.moveTo(d,m+r),v?c.lineTo(d,f+r):c.moveTo(d,f+r),b?c.lineTo(h,f+r):c.moveTo(h,f+r),c.stroke()))}function W(t){function e(e,n,i,s,r,o,a){for(var l=e.points,c=e.pointsize,u=0;u<l.length;u+=c)null!=l[u]&&q(l[u],l[u+1],l[u+2],n,i,s,r,o,a,pt,t.bars.horizontal,t.bars.lineWidth)}pt.save(),pt.translate(mt.left,mt.top),pt.lineWidth=t.bars.lineWidth,pt.strokeStyle=t.color;var n="left"==t.bars.align?0:-t.bars.barWidth/2,i=t.bars.fill?function(e,n){return H(t.bars,t.color,e,n)}:null;e(t.datapoints,n,n+t.bars.barWidth,0,i,t.xaxis,t.yaxis),pt.restore()}function H(e,n,i,s){var r=e.fill;if(!r)return null;if(e.fillColor)return rt(e.fillColor,i,s,n);var o=t.color.parse(n);return o.a="number"==typeof r?r:.4,o.normalize(),o.toString()}function J(){if(e.find(".legend").remove(),at.legend.show){for(var n,i,s=[],r=!1,o=at.legend.labelFormatter,a=0;a<ot.length;++a)(i=(n=ot[a]).label)&&(a%at.legend.noColumns==0&&(r&&s.push("</tr>"),s.push("<tr>"),r=!0),o&&(i=o(i,n)),s.push('<td class="legendColorBox"><div style="border:1px solid '+at.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+n.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+i+"</td>"));if(r&&s.push("</tr>"),0!=s.length){var l='<table style="font-size:smaller;color:'+at.grid.color+'">'+s.join("")+"</table>";if(null!=at.legend.container)t(at.legend.container).html(l);else{var c="",u=at.legend.position,p=at.legend.margin;null==p[0]&&(p=[p,p]),"n"==u.charAt(0)?c+="top:"+(p[1]+mt.top)+"px;":"s"==u.charAt(0)&&(c+="bottom:"+(p[1]+mt.bottom)+"px;"),"e"==u.charAt(1)?c+="right:"+(p[0]+mt.right)+"px;":"w"==u.charAt(1)&&(c+="left:"+(p[0]+mt.left)+"px;");var h=t('<div class="legend">'+l.replace('style="','style="position:absolute;'+c+";")+"</div>").appendTo(e);if(0!=at.legend.backgroundOpacity){var d=at.legend.backgroundColor;null==d&&((d=(d=at.grid.backgroundColor)&&"string"==typeof d?t.color.parse(d):t.color.extract(h,"background-color")).a=1,d=d.toString());var f=h.children();t('<div style="position:absolute;width:'+f.width()+"px;height:"+f.height()+"px;"+c+"background-color:"+d+';"> </div>').prependTo(h).css("opacity",at.legend.backgroundOpacity)}}}}}function V(t,e,n){var i,s,r=at.grid.mouseActiveRadius,o=r*r+1,a=null;for(i=ot.length-1;i>=0;--i)if(n(ot[i])){var l=ot[i],c=l.xaxis,u=l.yaxis,p=l.datapoints.points,h=l.datapoints.pointsize,d=c.c2p(t),f=u.c2p(e),m=r/c.scale,g=r/u.scale;if(c.options.inverseTransform&&(m=Number.MAX_VALUE),u.options.inverseTransform&&(g=Number.MAX_VALUE),l.lines.show||l.points.show)for(s=0;s<p.length;s+=h){var v=p[s],y=p[s+1];if(null!=v&&!(v-d>m||v-d<-m||y-f>g||y-f<-g)){var b=Math.abs(c.p2c(v)-t),_=Math.abs(u.p2c(y)-e),w=b*b+_*_;w<o&&(o=w,a=[i,s/h])}}if(l.bars.show&&!a){var k="left"==l.bars.align?0:-l.bars.barWidth/2,A=k+l.bars.barWidth;for(s=0;s<p.length;s+=h){v=p[s],y=p[s+1];var C=p[s+2];null!=v&&((ot[i].bars.horizontal?d<=Math.max(C,v)&&d>=Math.min(C,v)&&f>=y+k&&f<=y+A:d>=v+k&&d<=v+A&&f>=Math.min(C,y)&&f<=Math.max(C,y))&&(a=[i,s/h]))}}}return a?(i=a[0],s=a[1],h=ot[i].datapoints.pointsize,{datapoint:ot[i].datapoints.points.slice(s*h,(s+1)*h),dataIndex:s,series:ot[i],seriesIndex:i}):null}function G(t){at.grid.hoverable&&X("plothover",t,(function(t){return 0!=t.hoverable}))}function K(t){at.grid.hoverable&&X("plothover",t,(function(){return!1}))}function Y(t){X("plotclick",t,(function(t){return 0!=t.clickable}))}function X(t,n,i){var s=ut.offset(),r=n.pageX-s.left-mt.left,o=n.pageY-s.top-mt.top,a=m({left:r,top:o});a.pageX=n.pageX,a.pageY=n.pageY;var l=V(r,o,i);if(l&&(l.pageX=parseInt(l.series.xaxis.p2c(l.datapoint[0])+s.left+mt.left),l.pageY=parseInt(l.series.yaxis.p2c(l.datapoint[1])+s.top+mt.top)),at.grid.autoHighlight){for(var c=0;c<kt.length;++c){var u=kt[c];u.auto!=t||l&&u.series==l.series&&u.point[0]==l.datapoint[0]&&u.point[1]==l.datapoint[1]||et(u.series,u.point)}l&&tt(l.series,l.datapoint,t)}e.trigger(t,[a,l])}function Z(){At||(At=setTimeout(Q,30))}function Q(){var t,e;for(At=null,ht.save(),ht.clearRect(0,0,gt,vt),ht.translate(mt.left,mt.top),t=0;t<kt.length;++t)(e=kt[t]).series.bars.show?st(e.series,e.point):it(e.series,e.point);ht.restore(),l(_t.drawOverlay,[ht])}function tt(t,e,n){if("number"==typeof t&&(t=ot[t]),"number"==typeof e){var i=t.datapoints.pointsize;e=t.datapoints.points.slice(i*e,i*(e+1))}var s=nt(t,e);-1==s?(kt.push({series:t,point:e,auto:n}),Z()):n||(kt[s].auto=!1)}function et(t,e){null==t&&null==e&&(kt=[],Z()),"number"==typeof t&&(t=ot[t]),"number"==typeof e&&(e=t.data[e]);var n=nt(t,e);-1!=n&&(kt.splice(n,1),Z())}function nt(t,e){for(var n=0;n<kt.length;++n){var i=kt[n];if(i.series==t&&i.point[0]==e[0]&&i.point[1]==e[1])return n}return-1}function it(e,n){var i=n[0],s=n[1],r=e.xaxis,o=e.yaxis;if(!(i<r.min||i>r.max||s<o.min||s>o.max)){var a=e.points.radius+e.points.lineWidth/2;ht.lineWidth=a,ht.strokeStyle=t.color.parse(e.color).scale("a",.5).toString();var l=1.5*a;i=r.p2c(i),s=o.p2c(s);ht.beginPath(),"circle"==e.points.symbol?ht.arc(i,s,l,0,2*Math.PI,!1):e.points.symbol(ht,i,s,l,!1),ht.closePath(),ht.stroke()}}function st(e,n){ht.lineWidth=e.bars.lineWidth,ht.strokeStyle=t.color.parse(e.color).scale("a",.5).toString();var i=t.color.parse(e.color).scale("a",.5).toString(),s="left"==e.bars.align?0:-e.bars.barWidth/2;q(n[0],n[1],n[2]||0,s,s+e.bars.barWidth,0,(function(){return i}),e.xaxis,e.yaxis,ht,e.bars.horizontal,e.bars.lineWidth)}function rt(e,n,i,s){if("string"==typeof e)return e;for(var r=pt.createLinearGradient(0,i,0,n),o=0,a=e.colors.length;o<a;++o){var l=e.colors[o];if("string"!=typeof l){var c=t.color.parse(s);null!=l.brightness&&(c=c.scale("rgb",l.brightness)),null!=l.opacity&&(c.a*=l.opacity),l=c.toString()}r.addColorStop(o/(a-1),l)}return r}var ot=[],at={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:!0,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:.85},xaxis:{show:null,position:"bottom",mode:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,twelveHourClock:!1},yaxis:{autoscaleMargin:.02,position:"left"},xaxes:[],yaxes:[],series:{points:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:2,fill:!1,fillColor:null,steps:!1},bars:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,align:"left",horizontal:!1},shadowSize:3},grid:{show:!0,aboveData:!1,color:"#545454",backgroundColor:null,borderColor:null,tickColor:null,labelMargin:5,axisMargin:8,borderWidth:2,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:!1,hoverable:!1,autoHighlight:!0,mouseActiveRadius:10},hooks:{}},lt=null,ct=null,ut=null,pt=null,ht=null,dt=[],ft=[],mt={left:0,right:0,top:0,bottom:0},gt=0,vt=0,yt=0,bt=0,_t={processOptions:[],processRawData:[],processDatapoints:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},wt=this;wt.setData=p,wt.setupGrid=P,wt.draw=M,wt.getPlaceholder=function(){return e},wt.getCanvas=function(){return lt},wt.getPlotOffset=function(){return mt},wt.width=function(){return yt},wt.height=function(){return bt},wt.offset=function(){var t=ut.offset();return t.left+=mt.left,t.top+=mt.top,t},wt.getData=function(){return ot},wt.getAxes=function(){var e={};return t.each(dt.concat(ft),(function(t,n){n&&(e[n.direction+(1!=n.n?n.n:"")+"axis"]=n)})),e},wt.getXAxes=function(){return dt},wt.getYAxes=function(){return ft},wt.c2p=m,wt.p2c=g,wt.getOptions=function(){return at},wt.highlight=tt,wt.unhighlight=et,wt.triggerRedrawOverlay=Z,wt.pointOffset=function(t){return{left:parseInt(dt[d(t,"x")-1].p2c(+t.x)+mt.left),top:parseInt(ft[d(t,"y")-1].p2c(+t.y)+mt.top)}},wt.shutdown=T,wt.resize=function(){w(),k(lt),k(ct)},wt.hooks=_t,c(wt),u(r),A(),p(s),P(),M(),C();var kt=[],At=null}function n(t,e){return e*Math.floor(t/e)}t.plot=function(n,i,s){return new e(t(n),i,s,t.plot.plugins)},t.plot.version="0.7",t.plot.plugins=[],t.plot.formatDate=function(t,e,n){var i=function(t){return 1==(t=""+t).length?"0"+t:t},s=[],r=!1,o=!1,a=t.getUTCHours(),l=a<12;null==n&&(n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),-1!=e.search(/%p|%P/)&&(a>12?a-=12:0==a&&(a=12));for(var c=0;c<e.length;++c){var u=e.charAt(c);if(r){switch(u){case"h":u=""+a;break;case"H":u=i(a);break;case"M":u=i(t.getUTCMinutes());break;case"S":u=i(t.getUTCSeconds());break;case"d":u=""+t.getUTCDate();break;case"m":u=""+(t.getUTCMonth()+1);break;case"y":u=""+t.getUTCFullYear();break;case"b":u=""+n[t.getUTCMonth()];break;case"p":u=l?"am":"pm";break;case"P":u=l?"AM":"PM";break;case"0":u="",o=!0}u&&o&&(u=i(u),o=!1),s.push(u),o||(r=!1)}else"%"==u?r=!0:s.push(u)}return s.join("")}}(jQuery),function(t){function e(e){function n(t){f.active&&(c(t),e.getPlaceholder().trigger("plotselecting",[r()]))}function i(e){1==e.which&&(document.body.focus(),void 0!==document.onselectstart&&null==m.onselectstart&&(m.onselectstart=document.onselectstart,document.onselectstart=function(){return!1}),void 0!==document.ondrag&&null==m.ondrag&&(m.ondrag=document.ondrag,document.ondrag=function(){return!1}),l(f.first,e),f.active=!0,g=function(t){s(t)},t(document).one("mouseup",g))}function s(t){return g=null,void 0!==document.onselectstart&&(document.onselectstart=m.onselectstart),void 0!==document.ondrag&&(document.ondrag=m.ondrag),f.active=!1,c(t),d()?o():(e.getPlaceholder().trigger("plotunselected",[]),e.getPlaceholder().trigger("plotselecting",[null])),!1}function r(){if(!d())return null;var n={},i=f.first,s=f.second;return t.each(e.getAxes(),(function(t,e){if(e.used){var r=e.c2p(i[e.direction]),o=e.c2p(s[e.direction]);n[t]={from:Math.min(r,o),to:Math.max(r,o)}}})),n}function o(){var t=r();e.getPlaceholder().trigger("plotselected",[t]),t.xaxis&&t.yaxis&&e.getPlaceholder().trigger("selected",[{x1:t.xaxis.from,y1:t.yaxis.from,x2:t.xaxis.to,y2:t.yaxis.to}])}function a(t,e,n){return e<t?t:e>n?n:e}function l(t,n){var i=e.getOptions(),s=e.getPlaceholder().offset(),r=e.getPlotOffset();t.x=a(0,n.pageX-s.left-r.left,e.width()),t.y=a(0,n.pageY-s.top-r.top,e.height()),"y"==i.selection.mode&&(t.x=t==f.first?0:e.width()),"x"==i.selection.mode&&(t.y=t==f.first?0:e.height())}function c(t){null!=t.pageX&&(l(f.second,t),d()?(f.show=!0,e.triggerRedrawOverlay()):u(!0))}function u(t){f.show&&(f.show=!1,e.triggerRedrawOverlay(),t||e.getPlaceholder().trigger("plotunselected",[]))}function p(t,n){var i,s,r,o,a=e.getAxes();for(var l in a)if((i=a[l]).direction==n&&(t[o=n+i.n+"axis"]||1!=i.n||(o=n+"axis"),t[o])){s=t[o].from,r=t[o].to;break}if(t[o]||(i="x"==n?e.getXAxes()[0]:e.getYAxes()[0],s=t[n+"1"],r=t[n+"2"]),null!=s&&null!=r&&s>r){var c=s;s=r,r=c}return{from:s,to:r,axis:i}}function h(t,n){var i,s=e.getOptions();"y"==s.selection.mode?(f.first.x=0,f.second.x=e.width()):(i=p(t,"x"),f.first.x=i.axis.p2c(i.from),f.second.x=i.axis.p2c(i.to)),"x"==s.selection.mode?(f.first.y=0,f.second.y=e.height()):(i=p(t,"y"),f.first.y=i.axis.p2c(i.from),f.second.y=i.axis.p2c(i.to)),f.show=!0,e.triggerRedrawOverlay(),!n&&d()&&o()}function d(){var t=5;return Math.abs(f.second.x-f.first.x)>=t&&Math.abs(f.second.y-f.first.y)>=t}var f={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},m={},g=null;e.clearSelection=u,e.setSelection=h,e.getSelection=r,e.hooks.bindEvents.push((function(t,e){null!=t.getOptions().selection.mode&&(e.on("mousemove",n),e.on("mousedown",i))})),e.hooks.drawOverlay.push((function(e,n){if(f.show&&d()){var i=e.getPlotOffset(),s=e.getOptions();n.save(),n.translate(i.left,i.top);var r=t.color.parse(s.selection.color);n.strokeStyle=r.scale("a",.8).toString(),n.lineWidth=1,n.lineJoin="round",n.fillStyle=r.scale("a",.4).toString();var o=Math.min(f.first.x,f.second.x),a=Math.min(f.first.y,f.second.y),l=Math.abs(f.second.x-f.first.x),c=Math.abs(f.second.y-f.first.y);n.fillRect(o,a,l,c),n.strokeRect(o,a,l,c),n.restore()}})),e.hooks.shutdown.push((function(e,s){s.off("mousemove",n),s.off("mousedown",i),g&&t(document).off("mouseup",g)}))}t.plot.plugins.push({init:e,options:{selection:{mode:null,color:"#e8cfac"}},name:"selection",version:"1.1"})}(jQuery),function(t){"use strict";function e(e){var n=e.attr("data-target");n||(n=(n=e.attr("href"))&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==n?t(document).find(n):null;return i&&i.length?i:e.parent()}function n(n){n&&3===n.which||(t(s).remove(),t(r).each((function(){var i=t(this),s=e(i),r={relatedTarget:this};s.hasClass("open")&&(n&&"click"==n.type&&/input|textarea/i.test(n.target.tagName)&&t.contains(s[0],n.target)||(s.trigger(n=t.Event("hide.bs.dropdown",r)),n.isDefaultPrevented()||(i.attr("aria-expanded","false"),s.removeClass("open").trigger(t.Event("hidden.bs.dropdown",r)))))})))}function i(e){return this.each((function(){var n=t(this),i=n.data("bs.dropdown");i||n.data("bs.dropdown",i=new o(this)),"string"==typeof e&&i[e].call(n)}))}var s=".dropdown-backdrop",r='[data-toggle="dropdown"]',o=function(e){t(e).on("click.bs.dropdown",this.toggle)};o.VERSION="3.4.1",o.prototype.toggle=function(i){var s=t(this);if(!s.is(".disabled, :disabled")){var r=e(s),o=r.hasClass("open");if(n(),!o){"ontouchstart"in document.documentElement&&!r.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",n);var a={relatedTarget:this};if(r.trigger(i=t.Event("show.bs.dropdown",a)),i.isDefaultPrevented())return;s.trigger("focus").attr("aria-expanded","true"),r.toggleClass("open").trigger(t.Event("shown.bs.dropdown",a))}return!1}},o.prototype.keydown=function(n){if(/(38|40|27|32)/.test(n.which)&&!/input|textarea/i.test(n.target.tagName)){var i=t(this);if(n.preventDefault(),n.stopPropagation(),!i.is(".disabled, :disabled")){var s=e(i),o=s.hasClass("open");if(!o&&27!=n.which||o&&27==n.which)return 27==n.which&&s.find(r).trigger("focus"),i.trigger("click");var a=" li:not(.disabled):visible a",l=s.find(".dropdown-menu"+a);if(l.length){var c=l.index(n.target);38==n.which&&c>0&&c--,40==n.which&&c<l.length-1&&c++,~c||(c=0),l.eq(c).trigger("focus")}}}};var a=t.fn.dropdown;t.fn.dropdown=i,t.fn.dropdown.Constructor=o,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=a,this},t(document).on("click.bs.dropdown.data-api",n).on("click.bs.dropdown.data-api",".dropdown form",(function(t){t.stopPropagation()})).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(t){"use strict";function e(e,n){var i=e.nodeName.toLowerCase();if(-1!==t.inArray(i,n))return-1===t.inArray(i,r)||Boolean(e.nodeValue.match(a)||e.nodeValue.match(l));for(var s=t(n).filter((function(t,e){return e instanceof RegExp})),o=0,c=s.length;o<c;o++)if(i.match(s[o]))return!0;return!1}function n(n,i,s){if(0===n.length)return n;if(s&&"function"==typeof s)return s(n);if(!document.implementation||!document.implementation.createHTMLDocument)return n;var r=document.implementation.createHTMLDocument("sanitization");r.body.innerHTML=n;for(var o=t.map(i,(function(t,e){return e})),a=t(r.body).find("*"),l=0,c=a.length;l<c;l++){var u=a[l],p=u.nodeName.toLowerCase();if(-1!==t.inArray(p,o))for(var h=t.map(u.attributes,(function(t){return t})),d=[].concat(i["*"]||[],i[p]||[]),f=0,m=h.length;f<m;f++)e(h[f],d)||u.removeAttribute(h[f].nodeName);else u.parentNode.removeChild(u)}return r.body.innerHTML}function i(e){return this.each((function(){var n=t(this),i=n.data("bs.tooltip"),s="object"==typeof e&&e;!i&&/destroy|hide/.test(e)||(i||n.data("bs.tooltip",i=new c(this,s)),"string"==typeof e&&i[e]())}))}var s=["sanitize","whiteList","sanitizeFn"],r=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],o={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},a=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i,c=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};c.VERSION="3.4.1",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:o},c.prototype.init=function(e,n,i){if(this.enabled=!0,this.type=e,this.$element=t(n),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&t(document).find(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var s=this.options.trigger.split(" "),r=s.length;r--;){var o=s[r];if("click"==o)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=o){var a="hover"==o?"mouseenter":"focusin",l="hover"==o?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(e){var i=this.$element.data();for(var r in i)i.hasOwnProperty(r)&&-1!==t.inArray(r,s)&&delete i[r];return(e=t.extend({},this.getDefaults(),i,e)).delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e.sanitize&&(e.template=n(e.template,e.whiteList,e.sanitizeFn)),e},c.prototype.getDelegateOptions=function(){var e={},n=this.getDefaults();return this._options&&t.each(this._options,(function(t,i){n[t]!=i&&(e[t]=i)})),e},c.prototype.enter=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusin"==e.type?"focus":"hover"]=!0),n.tip().hasClass("in")||"in"==n.hoverState)n.hoverState="in";else{if(clearTimeout(n.timeout),n.hoverState="in",!n.options.delay||!n.options.delay.show)return n.show();n.timeout=setTimeout((function(){"in"==n.hoverState&&n.show()}),n.options.delay.show)}},c.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},c.prototype.leave=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusout"==e.type?"focus":"hover"]=!1),!n.isInStateTrue()){if(clearTimeout(n.timeout),n.hoverState="out",!n.options.delay||!n.options.delay.hide)return n.hide();n.timeout=setTimeout((function(){"out"==n.hoverState&&n.hide()}),n.options.delay.hide)}},c.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var n=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!n)return;var i=this,s=this.tip(),r=this.getUID(this.type);this.setContent(),s.attr("id",r),this.$element.attr("aria-describedby",r),this.options.animation&&s.addClass("fade");var o="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,l=a.test(o);l&&(o=o.replace(a,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(o).data("bs."+this.type,this),this.options.container?s.appendTo(t(document).find(this.options.container)):s.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var u=this.getPosition(),p=s[0].offsetWidth,h=s[0].offsetHeight;if(l){var d=o,f=this.getPosition(this.$viewport);o="bottom"==o&&u.bottom+h>f.bottom?"top":"top"==o&&u.top-h<f.top?"bottom":"right"==o&&u.right+p>f.width?"left":"left"==o&&u.left-p<f.left?"right":o,s.removeClass(d).addClass(o)}var m=this.getCalculatedOffset(o,u,p,h);this.applyPlacement(m,o);var g=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};t.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",g).emulateTransitionEnd(c.TRANSITION_DURATION):g()}},c.prototype.applyPlacement=function(e,n){var i=this.tip(),s=i[0].offsetWidth,r=i[0].offsetHeight,o=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(a)&&(a=0),e.top+=o,e.left+=a,t.offset.setOffset(i[0],t.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),i.addClass("in");var l=i[0].offsetWidth,c=i[0].offsetHeight;"top"==n&&c!=r&&(e.top=e.top+r-c);var u=this.getViewportAdjustedDelta(n,e,l,c);u.left?e.left+=u.left:e.top+=u.top;var p=/top|bottom/.test(n),h=p?2*u.left-s+l:2*u.top-r+c,d=p?"offsetWidth":"offsetHeight";i.offset(e),this.replaceArrow(h,i[0][d],p)},c.prototype.replaceArrow=function(t,e,n){this.arrow().css(n?"left":"top",50*(1-t/e)+"%").css(n?"top":"left","")},c.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},c.prototype.hide=function(e){function n(){"in"!=i.hoverState&&s.detach(),i.$element&&i.$element.removeAttr("aria-describedby").trigger("hidden.bs."+i.type),e&&e()}var i=this,s=t(this.$tip),r=t.Event("hide.bs."+this.type);if(this.$element&&this.$element.trigger(r),!r.isDefaultPrevented())return s.removeClass("in"),this.hoverState=null,t.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",n).emulateTransitionEnd(c.TRANSITION_DURATION):n(),this},c.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(e){var n=(e=e||this.$element)[0],i="BODY"==n.tagName,s=n.getBoundingClientRect();null==s.width&&(s=t.extend({},s,{width:s.right-s.left,height:s.bottom-s.top}));var r=window.SVGElement&&n instanceof window.SVGElement,o=i?{top:0,left:0}:r?null:e.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},l=i?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},s,a,l,o)},c.prototype.getCalculatedOffset=function(t,e,n,i){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-n/2}:"top"==t?{top:e.top-i,left:e.left+e.width/2-n/2}:"left"==t?{top:e.top+e.height/2-i/2,left:e.left-n}:{top:e.top+e.height/2-i/2,left:e.left+e.width}},c.prototype.getViewportAdjustedDelta=function(t,e,n,i){var s={top:0,left:0};if(!this.$viewport)return s;var r=this.options.viewport&&this.options.viewport.padding||0,o=this.getPosition(this.$viewport);if(/right|left/.test(t)){var a=e.top-r-o.scroll,l=e.top+r-o.scroll+i;a<o.top?s.top=o.top-a:l>o.top+o.height&&(s.top=o.top+o.height-l)}else{var c=e.left-r,u=e.left+r+n;c<o.left?s.left=o.left-c:u>o.right&&(s.left=o.left+o.width-u)}return s},c.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},c.prototype.getUID=function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(e){var n=this;e&&((n=t(e.currentTarget).data("bs."+this.type))||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n))),e?(n.inState.click=!n.inState.click,n.isInStateTrue()?n.enter(n):n.leave(n)):n.tip().hasClass("in")?n.leave(n):n.enter(n)},c.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide((function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null}))},
c.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var u=t.fn.tooltip;t.fn.tooltip=i,t.fn.tooltip.Constructor=c,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=u,this}}(jQuery),function(t){"use strict";function e(e){return this.each((function(){var i=t(this),s=i.data("bs.popover"),r="object"==typeof e&&e;!s&&/destroy|hide/.test(e)||(s||i.data("bs.popover",s=new n(this,r)),"string"==typeof e&&s[e]())}))}var n=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");n.VERSION="3.4.1",n.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),n.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),n.prototype.constructor=n,n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),n=this.getContent();if(this.options.html){var i=typeof n;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===i&&(n=this.sanitizeHtml(n))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===i?"html":"append"](n)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(n);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},n.prototype.hasContent=function(){return this.getTitle()||this.getContent()},n.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var i=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=n,t.fn.popover.noConflict=function(){return t.fn.popover=i,this}}(jQuery);var originalLeave=$.fn.popover.Constructor.prototype.leave;$.fn.popover.Constructor.prototype.leave=function(t){var e,n,i=t instanceof this.constructor?t:$(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);originalLeave.call(this,t),t.currentTarget&&(e=$("body .popover"),n=i.timeout,e.one("mouseenter",(function(){clearTimeout(n),e.one("mouseleave",(function(){$.fn.popover.Constructor.prototype.leave.call(i,i)}))})))},$.fn.popover.Constructor.DEFAULTS.viewport.padding=10,$.fn.popover.Constructor.DEFAULTS.template='<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-body"><div class="popover-title"></div><div class="popover-content"></div></div></div>';var originalShow=$.fn.popover.Constructor.prototype.show;$.fn.popover.Constructor.prototype.show=function(){if(originalShow.call(this),this.$tip){var t=$(this.options.viewport.selector).height()-2*this.options.viewport.padding;this.$tip.find(".popover-body").css("maxHeight",t)}},function(t){"use strict";function e(e,i){return this.each((function(){var s=t(this),r=s.data("bs.modal"),o=t.extend({},n.DEFAULTS,s.data(),"object"==typeof e&&e);r||s.data("bs.modal",r=new n(this,o)),"string"==typeof e?r[e](i):o.show&&r.show(i)}))}var n=function(e,n){this.options=n,this.$body=t(n.container||document.body),this.$element=t(e),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,t.proxy((function(){this.$element.trigger("loaded.bs.modal")}),this))};n.VERSION="3.4.1",n.TRANSITION_DURATION=300,n.BACKDROP_TRANSITION_DURATION=150,n.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},n.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},n.prototype.show=function(e){var i=this,s=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(s),this.isShown||s.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',t.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",(function(){i.$element.one("mouseup.dismiss.bs.modal",(function(e){t(e.target).is(i.$element)&&(i.ignoreBackdropClick=!0)}))})),this.backdrop((function(){var s=t.support.transition&&i.$element.hasClass("fade");i.$element.parent().length||i.$element.appendTo(i.$body),i.$element.show().scrollTop(0),i.adjustDialog(),s&&i.$element[0].offsetWidth,i.$element.addClass("in"),i.enforceFocus();var r=t.Event("shown.bs.modal",{relatedTarget:e});s?i.$dialog.one("bsTransitionEnd",(function(){i.$element.trigger("focus").trigger(r)})).emulateTransitionEnd(n.TRANSITION_DURATION):i.$element.trigger("focus").trigger(r)})))},n.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),t(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),t.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",t.proxy(this.hideModal,this)).emulateTransitionEnd(n.TRANSITION_DURATION):this.hideModal())},n.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy((function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")}),this))},n.prototype.escape=function(){this.isShown&&this.options.keyboard?t(window).on("keydown.dismiss.bs.modal",t.proxy((function(e){27==e.which&&this.hide(),27==e.which&&(e=t.Event("dismiss.bs.modal"),this.$element.trigger(e))}),this)):this.isShown||t(window).off("keydown.dismiss.bs.modal")},n.prototype.resize=function(){this.isShown?t(window).on("resize.bs.modal",t.proxy(this.handleUpdate,this)):t(window).off("resize.bs.modal")},n.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop((function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")}))},n.prototype.remove=function(){this.$element.remove()},n.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},n.prototype.backdrop=function(e){var i=this,s=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var r=t.support.transition&&s;if(this.$backdrop=t(document.createElement("div")).addClass("modal-backdrop "+s),this.options.container&&this.$backdrop.addClass("modal-backdrop--local"),this.$backdrop.appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",t.proxy((function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())}),this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;r?this.$backdrop.one("bsTransitionEnd",e).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):e()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var o=function(){i.removeBackdrop(),e&&e()};t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",o).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):o()}else e&&e()},n.prototype.handleUpdate=function(){this.adjustDialog()},n.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight,e={left:this.$body.offset().left,top:Math.max(0,this.$body.offset().top),width:this.$body.width(),paddingLeft:!this.bodyIsOverflowing&&t&&this.scrollbarWidth>0?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t&&this.scrollbarWidth>0?this.scrollbarWidth:""};if("rtl"==App.i18n.dir()){e.right="auto";var n=e.paddingLeft;e.paddingLeft=e.paddingRight,e.paddingRight=n}this.$element.css(e)},n.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},n.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},n.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",e+n),t(this.fixedContent).each((function(e,i){var s=i.style.paddingRight,r=t(i).css("padding-right");t(i).data("padding-right",s).css("padding-right",parseFloat(r)+n+"px")})))},n.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),t(this.fixedContent).each((function(e,n){var i=t(n).data("padding-right");t(n).removeData("padding-right"),n.style.paddingRight=i||""}))},n.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var i=t.fn.modal;t.fn.modal=e,t.fn.modal.Constructor=n,t.fn.modal.noConflict=function(){return t.fn.modal=i,this},t(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',(function(n){var i=t(this),s=i.attr("href"),r=i.attr("data-target")||s&&s.replace(/.*(?=#[^\s]+$)/,""),o=t(document).find(r),a=o.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(s)&&s},o.data(),i.data());i.is("a")&&n.preventDefault(),o.one("show.bs.modal",(function(t){t.isDefaultPrevented()||o.one("hidden.bs.modal",(function(){i.is(":visible")&&i.trigger("focus")}))})),e.call(o,a,this)}))}(jQuery),function(t){"use strict";function e(e){return this.each((function(){var i=t(this),s=i.data("bs.tab");s||i.data("bs.tab",s=new n(this)),"string"==typeof e&&s[e]()}))}var n=function(e){this.element=t(e)};n.VERSION="3.4.1",n.TRANSITION_DURATION=150,n.prototype.show=function(){var e=this.element,n=e.closest("ul:not(.dropdown-menu)"),i=e.data("target");if(i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!e.parent("li").hasClass("active")){var s=n.find(".active:last a"),r=t.Event("hide.bs.tab",{relatedTarget:e[0]}),o=t.Event("show.bs.tab",{relatedTarget:s[0]});if(s.trigger(r),e.trigger(o),!o.isDefaultPrevented()&&!r.isDefaultPrevented()){var a=t(document).find(i);this.activate(e.closest("li"),n),this.activate(a,a.parent(),(function(){s.trigger({type:"hidden.bs.tab",relatedTarget:e[0]}),e.trigger({type:"shown.bs.tab",relatedTarget:s[0]})}))}}},n.prototype.activate=function(e,i,s){function r(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),e.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),a?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu").length&&e.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),s&&s()}var o=i.find("> .active"),a=s&&t.support.transition&&(o.length&&o.hasClass("fade")||!!i.find("> .fade").length);o.length&&a?o.one("bsTransitionEnd",r).emulateTransitionEnd(n.TRANSITION_DURATION):r(),o.removeClass("in")};var i=t.fn.tab;t.fn.tab=e,t.fn.tab.Constructor=n,t.fn.tab.noConflict=function(){return t.fn.tab=i,this};var s=function(n){n.preventDefault(),e.call(t(this),"show")};t(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',s).on("click.bs.tab.data-api",'[data-toggle="pill"]',s)}(jQuery),function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in e)if(void 0!==t.style[n])return{end:e[n]};return!1}t.fn.emulateTransitionEnd=function(e){var n=!1,i=this;return t(this).one("bsTransitionEnd",(function(){n=!0})),setTimeout((function(){n||t(i).trigger(t.support.transition.end)}),e),this},t((function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}})}))}(jQuery),function(t){"use strict";function e(e){return this.each((function(){var i=t(this),s=i.data("bs.button"),r="object"==typeof e&&e;s||i.data("bs.button",s=new n(this,r)),"toggle"==e?s.toggle():e&&s.setState(e)}))}var n=function(e,i){this.$element=t(e),this.options=t.extend({},n.DEFAULTS,i),this.isLoading=!1};n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(e){var n="disabled",i=this.$element,s=i.is("input")?"val":"html",r=i.data();e+="Text",null==r.resetText&&i.data("resetText",i[s]()),setTimeout(t.proxy((function(){i[s](null==r[e]?this.options[e]:r[e]),"loadingText"==e?(this.isLoading=!0,i.addClass(n).attr(n,n).prop(n,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(n).removeAttr(n).prop(n,!1))}),this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var n=this.$element.find("input");"radio"==n.prop("type")?(n.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==n.prop("type")&&(n.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),n.prop("checked",this.$element.hasClass("active")),t&&n.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active");t&&this.$element.toggleClass("active")};var i=t.fn.button;t.fn.button=e,t.fn.button.Constructor=n,t.fn.button.noConflict=function(){return t.fn.button=i,this},t(document).on("click.bs.button.data-api",'[data-toggle^="button"]',(function(n){var i=t(n.target).closest(".btn");e.call(i,"toggle"),t(n.target).is('input[type="radio"], input[type="checkbox"]')||(n.preventDefault(),i.is("input,button")?i.trigger("focus"):i.find("input:visible,button:visible").first().trigger("focus"))})).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',(function(e){t(e.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(e.type))}))}(jQuery),function(t){"use strict";function e(e){var n,i=e.attr("data-target")||(n=e.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"");return t(document).find(i)}function n(e){return this.each((function(){var n=t(this),s=n.data("bs.collapse"),r=t.extend({},i.DEFAULTS,n.data(),"object"==typeof e&&e);!s&&r.toggle&&/show|hide/.test(e)&&(r.toggle=!1),s||n.data("bs.collapse",s=new i(this,r)),"string"==typeof e&&s[e]()}))}var i=function(e,n){this.$element=t(e),this.options=t.extend({},i.DEFAULTS,n),this.$trigger=t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};i.VERSION="3.4.1",i.TRANSITION_DURATION=350,i.DEFAULTS={toggle:!0},i.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},i.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e,s=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(s&&s.length&&(e=s.data("bs.collapse"))&&e.transitioning)){var r=t.Event("show.bs.collapse");if(this.$element.trigger(r),!r.isDefaultPrevented()){s&&s.length&&(n.call(s,"hide"),e||s.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var a=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return a.call(this);var l=t.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",t.proxy(a,this)).emulateTransitionEnd(i.TRANSITION_DURATION)[o](this.$element[0][l])}}}},i.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var s=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!t.support.transition)return s.call(this);this.$element[n](0).one("bsTransitionEnd",t.proxy(s,this)).emulateTransitionEnd(i.TRANSITION_DURATION)}}},i.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},i.prototype.getParent=function(){return t(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(t.proxy((function(n,i){var s=t(i);this.addAriaAndCollapsedClass(e(s),s)}),this)).end()},i.prototype.addAriaAndCollapsedClass=function(t,e){var n=t.hasClass("in");t.attr("aria-expanded",n),e.toggleClass("collapsed",!n).attr("aria-expanded",n)};var s=t.fn.collapse;t.fn.collapse=n,t.fn.collapse.Constructor=i,t.fn.collapse.noConflict=function(){return t.fn.collapse=s,this},t(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',(function(i){var s=t(this);s.attr("data-target")||i.preventDefault();var r=e(s),o=r.data("bs.collapse")?"toggle":s.data();n.call(r,o)}))}(jQuery),function(t,e,n,i){"use strict";var s=function(e,n){this.widget="",this.$element=t(e),this.defaultTime=n.defaultTime,this.disableFocus=n.disableFocus,this.disableMousewheel=n.disableMousewheel,this.isOpen=n.isOpen,this.minuteStep=n.minuteStep,this.modalBackdrop=n.modalBackdrop,this.orientation=n.orientation,this.secondStep=n.secondStep,this.snapToStep=n.snapToStep,this.showInputs=n.showInputs,this.showMeridian=n.showMeridian,this.showSeconds=n.showSeconds,this.maxHours=n.maxHours,this.template=n.template,this.appendWidgetTo=n.appendWidgetTo,this.showWidgetOnAddonClick=n.showWidgetOnAddonClick,this._init()};s.prototype={constructor:s,_init:function(){var e=this;this.$element.hasClass("time--12")?this.showMeridian=!0:this.showMeridian&&this.$element.addClass("time--12"),this.showWidgetOnAddonClick&&(this.$element.parent().hasClass("input-append")||this.$element.parent().hasClass("input-prepend"))?(this.$element.parent(".input-append, .input-prepend").find(".add-on").on({"click.timepicker":t.proxy(this.showWidget,this)}),this.$element.on({"focus.timepicker":t.proxy(this.highlightUnit,this),"click.timepicker":t.proxy(this.highlightUnit,this),"keydown.timepicker":t.proxy(this.elementKeydown,this),"keyup.timepicker":t.proxy(this.elementKeyup,this),"blur.timepicker":t.proxy(this.blurElement,this),"mousewheel.timepicker DOMMouseScroll.timepicker":t.proxy(this.mousewheel,this)})):this.template?this.$element.on({"focus.timepicker":t.proxy(this.showWidget,this),"click.timepicker":t.proxy(this.showWidget,this),"blur.timepicker":t.proxy(this.blurElement,this),"mousewheel.timepicker DOMMouseScroll.timepicker":t.proxy(this.mousewheel,this)}):this.$element.on({"focus.timepicker":t.proxy(this.highlightUnit,this),"click.timepicker":t.proxy(this.highlightUnit,this),"keydown.timepicker":t.proxy(this.elementKeydown,this),"keyup.timepicker":t.proxy(this.elementKeyup,this),"blur.timepicker":t.proxy(this.blurElement,this),"mousewheel.timepicker DOMMouseScroll.timepicker":t.proxy(this.mousewheel,this)}),!1!==this.template?this.$widget=t(this.getTemplate()).on("click",t.proxy(this.widgetClick,this)):this.$widget=!1,this.showInputs&&!1!==this.$widget&&this.$widget.find("input").each((function(){t(this).on({"click.timepicker":function(){t(this).select()},"keydown.timepicker":t.proxy(e.widgetKeydown,e),"keyup.timepicker":t.proxy(e.widgetKeyup,e)})})),this.maxHours>23&&(this.showMeridian=!1),this.setDefaultTime(this.defaultTime)},blurElement:function(){this.highlightedUnit=null,this.updateFromElementVal()},clear:function(){this.hour="",this.minute="",this.second="",this.meridian="",this.$element.val("")},decrementHour:function(){if(this.showMeridian)if(1===this.hour)this.hour=12;else{if(12===this.hour)return this.hour--,this.toggleMeridian();if(0===this.hour)return this.hour=11,this.toggleMeridian();this.hour--}else this.hour<=0?this.hour=this.maxHours:this.hour--},decrementMinute:function(t){var e;(e=t?this.minute-t:this.minute-this.minuteStep)<0?(this.decrementHour(),this.minute=e+60):this.minute=e},decrementSecond:function(){var t=this.second-this.secondStep;t<0?(this.decrementMinute(!0),this.second=t+60):this.second=t},elementKeydown:function(e){switch(e.keyCode){case 9:case 27:this.updateFromElementVal();break;case 37:e.preventDefault(),this.highlightPrevUnit();break;case 38:switch(e.preventDefault(),this.highlightedUnit){case"hour":this.incrementHour(),this.highlightHour();break;case"minute":this.incrementMinute(),this.highlightMinute();break;case"second":this.incrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian()}this.update();break;case 39:e.preventDefault(),this.highlightNextUnit();break;case 40:switch(e.preventDefault(),this.highlightedUnit){case"hour":this.decrementHour(),this.highlightHour();break;case"minute":this.decrementMinute(),this.highlightMinute();break;case"second":this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian()}this.update();break;case 8:this.highlightedUnit=null;break;case 186:this.$element.val().length<=2&&(this.setTime(this.$element.val(),i,!0),this.$element.val(this.getTime()),this.highlightMinute(),e.preventDefault()),"hour"==this.highlightedUnit&&(setTimeout(t.proxy(this.highlightNextUnit,this),0),e.preventDefault());break;default:if(1===this.getCursorPosition())setTimeout(t.proxy(this.highlightMinute,this),50)}},elementKeyup:function(t){-1==[8,9,27,37,38,39,40].indexOf(t.keyCode)&&this.updateFromElementVal(!0)},getCursorPosition:function(){var t=this.$element.get(0);if("selectionStart"in t)return t.selectionStart;if(n.selection){t.focus();var e=n.selection.createRange(),i=n.selection.createRange().text.length;return e.moveStart("character",-t.value.length),e.text.length-i}},getTemplate:function(){var t,e,n,i,s,r;switch(this.showInputs?(e='<input type="text" class="timepicker-hour" maxlength="2"/>',n='<input type="text" class="timepicker-minute" maxlength="2"/>',i='<input type="text" class="timepicker-second" maxlength="2"/>',s='<input type="text" class="timepicker-meridian" maxlength="2"/>'):(e='<span class="timepicker-hour"></span>',n='<span class="timepicker-minute"></span>',i='<span class="timepicker-second"></span>',s='<span class="timepicker-meridian"></span>'),r='<table><tr><td><a href="#" data-action="incrementHour"><svg class="icon icon-arrow-up"><use xlink:href="#icon-arrow-up" /></svg>"></i></a></td><td class="separator">&nbsp;</td><td><a href="#" data-action="incrementMinute"><svg class="icon icon-arrow-up"><use xlink:href="#icon-arrow-up" /></svg>"></i></a></td>'+(this.showSeconds?'<td class="separator">&nbsp;</td><td><a href="#" data-action="incrementSecond"><svg class="icon icon-arrow-up"><use xlink:href="#icon-arrow-up" /></svg>"></i></a></td>':"")+(this.showMeridian?'<td class="separator">&nbsp;</td><td class="meridian-column"><a href="#" data-action="toggleMeridian"><svg class="icon icon-arrow-up"><use xlink:href="#icon-arrow-up" /></svg>"></i></a></td>':"")+"</tr><tr><td>"+e+'</td> <td class="separator">:</td><td>'+n+"</td> "+(this.showSeconds?'<td class="separator">:</td><td>'+i+"</td>":"")+(this.showMeridian?'<td class="separator">&nbsp;</td><td>'+s+"</td>":"")+'</tr><tr><td><a href="#" data-action="decrementHour"><svg class="icon icon-arrow-down"><use xlink:href="#icon-arrow-down" /></svg>"></i></a></td><td class="separator"></td><td><a href="#" data-action="decrementMinute"><svg class="icon icon-arrow-down"><use xlink:href="#icon-arrow-down" /></svg>"></i></a></td>'+(this.showSeconds?'<td class="separator">&nbsp;</td><td><a href="#" data-action="decrementSecond"><svg class="icon icon-arrow-down"><use xlink:href="#icon-arrow-down" /></svg>"></i></a></td>':"")+(this.showMeridian?'<td class="separator">&nbsp;</td><td><a href="#" data-action="toggleMeridian"><svg class="icon icon-arrow-down"><use xlink:href="#icon-arrow-down" /></svg>"></i></a></td>':"")+"</tr></table>",this.template){case"modal":t='<div class="timepicker-widget modal hide fade in" data-backdrop="'+(this.modalBackdrop?"true":"false")+'"><div class="modal-header"><a href="#" class="close" data-dismiss="modal">\xd7</a><h3>Pick a Time</h3></div><div class="modal-content">'+r+'</div><div class="modal-footer"><a href="#" class="btn btn-primary" data-dismiss="modal">OK</a></div></div>';break;case"dropdown":t='<div class="timepicker-widget dropdown-menu">'+r+"</div>"}return t},getTime:function(){return""===this.hour?"":(1===this.hour.toString().length?"0"+this.hour:this.hour)+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker"),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){setTimeout(t.proxy(this.highlightUnitDelayed,this),0)},highlightUnitDelayed:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},setSelectionRange:function(t,e){var n=this.$element.get(0);n.setSelectionRange&&setTimeout((function(){n.setSelectionRange(t,e)}),0)},highlightHour:function(){var t=this.$element.val().replace(/[^0-9\:]/g,"").split(":"),e=(t[0]?t[0].toString():t.toString()).toString().length;this.highlightedUnit="hour",this.setSelectionRange(0,e)},highlightMinute:function(){var t=this.$element.val().replace(/[^0-9\:]/g,"").split(":"),e=(t[0]?t[0].toString():t.toString()).toString().length;this.highlightedUnit="minute",this.setSelectionRange(e+1,e+3)},highlightSecond:function(){this.highlightedUnit="second",this.setSelectionRange(6,8)},highlightMeridian:function(){this.highlightedUnit="meridian",this.showSeconds?this.setSelectionRange(9,11):this.setSelectionRange(6,8)},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),s=10,r=t(e).width(),o=t(e).height(),a=t(e).scrollTop(),l=parseInt(this.$element.parents().filter((function(){})).first().css("z-index"),10)+10,c=this.component?this.component.parent().offset():this.$element.offset(),u=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),p=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),h=c.left,d=c.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.picker.addClass("datepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(h-=n-p)):(this.$widget.addClass("timepicker-orient-left"),c.left<0?h-=c.left-s:c.left+n>r&&(h=r-n-s));var f,m,g=this.orientation.y;"auto"===g&&(f=-a+c.top-i,m=a+o-(c.top+u+i),g=Math.max(f,m)===m?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+g),"top"===g?d+=u:d-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:d,left:h,zIndex:l})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),s=e.getSeconds(),r="AM";0!==s&&60===(s=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,s=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),r="PM"):r="AM"),this.hour=n,this.minute=i,this.second=s,this.meridian=r,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e,n){if(t){var i,s,r,o,a,l;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),a=t.getSeconds(),this.showMeridian&&(l="AM",r>12&&(l="PM",r%=12),12===r&&(l="PM"));else{if((i=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();r=(s=t.replace(/[^0-9\:]/g,"").split(":"))[0]?s[0].toString():s.toString();var c=this.maxHours.toString().length;if(this.explicitMode&&r.length>c&&r.length%2!=0)return void this.clear();o=s[1]?s[1].toString():"",a=s[2]?s[2].toString():"",r.length>4&&(a=r.slice(-2),r=r.slice(0,-2)),r.length>c&&(o=r.slice(-c),r=r.slice(0,-c)),o.length>2&&(a=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),a=parseInt(a,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(a)&&(a=0),a>59&&(a=59),o>59&&(o=59),r>this.maxHours&&(r=this.maxHours),this.showMeridian?(r>12&&(i=2,r-=12),i||(i=1),0===r&&(r=12),l=1===i?"AM":"PM"):r<12&&2===i?r+=12:r>this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===i)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(a,this.secondStep)):(this.minute=o,this.second=a),this.meridian=l,n||this.update(e)}else this.clear()},showWidget:function(){if(!this.isOpen&&!this.$element.is(":disabled")){this.$widget.appendTo(this.appendWidgetTo);var e=this;t(n).on("mousedown.timepicker, touchend.timepicker",(function(t){e.$element.parent().find(t.target).length||e.$widget.is(t.target)||e.$widget.find(t.target).length||e.hideWidget()})),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),
"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0}},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget();var e=this.hour;this.showMeridian&&("PM"==this.meridian&&e<12&&(e+=12),"AM"==this.meridian&&12==e&&(e=0)),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hoursAndMinutes:this.pad(e)+":"+this.pad(this.minute),hours:e,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},pad:function(t){return 1===t.toString().length?"0"+t:t},updateElement:function(){this.$element.val(this.getTime()).trigger("change")},updateFromElementVal:function(t){this.setTime(this.$element.val(),i,t)},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.timepicker-hour").val(t),this.$widget.find("input.timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.timepicker-meridian").val(this.meridian)):(this.$widget.find("span.timepicker-hour").text(t),this.$widget.find("span.timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.timepicker-hour").val()+":"+this.$widget.find("input.timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("timepicker-","");switch(e.keyCode){case 9:if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.keyCode||77===t.keyCode||80===t.keyCode||46===t.keyCode||8===t.keyCode||t.keyCode>=46&&t.keyCode<=57||t.keyCode>=96&&t.keyCode<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var i=t(this),r=i.data("timepicker"),o="object"==typeof e&&e;r||i.data("timepicker",r=new s(this,t.extend({},t.fn.timepicker.defaults,o,t(this).data()))),"string"==typeof e&&r[e].apply(r,n)}))},t.fn.timepicker.defaults={defaultTime:!1,disableFocus:!1,disableMousewheel:!0,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,showSeconds:!1,showInputs:!1,showMeridian:!1,template:!1,appendWidgetTo:"body",showWidgetOnAddonClick:!0,maxHours:23,snapToStep:!1},t.fn.timepicker.Constructor=s}(jQuery,window,document),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}((function(t,e){function n(){return new Date(Date.UTC.apply(Date,arguments))}function i(){var t=new Date;return n(t.getFullYear(),t.getMonth(),t.getDate())}function s(t,e){return t.getUTCFullYear()===e.getUTCFullYear()&&t.getUTCMonth()===e.getUTCMonth()&&t.getUTCDate()===e.getUTCDate()}function r(t){return function(){return this[t].apply(this,arguments)}}function o(t){return t&&!isNaN(t.getTime())}function a(e,n){function i(t,e){return e.toLowerCase()}var s=t(e).data(),r={},o=new RegExp("^"+n.toLowerCase()+"([A-Z])");for(var a in n=new RegExp("^"+n.toLowerCase()),s)n.test(a)&&(r[a.replace(o,i)]=s[a]);return r}function l(e){var n={};if(v[e]||(e=e.split("-")[0],v[e])){var i=v[e];return t.each(g,(function(t,e){e in i&&(n[e]=i[e])})),n}}var c,u=(c={get:function(t){return this.slice(t)[0]},contains:function(t){for(var e=t&&t.valueOf(),n=0,i=this.length;n<i;n++)if(this[n].valueOf()===e)return n;return-1},remove:function(t){this.splice(t,1)},replace:function(t){t&&(Array.isArray(t)||(t=[t]),this.clear(),this.push.apply(this,t))},clear:function(){this.length=0},copy:function(){var t=new u;return t.replace(this),t}},function(){var e=[];return e.push.apply(e,arguments),t.extend(e,c),e}),p=function(e,n){this._process_options(n),this.dates=new u,this.viewDate=this.o.defaultViewDate,this.focusDate=null,this.element=t(e),this.isInline=!1,this.isInput=this.element.is("input"),this.component=!!this.element.hasClass("date")&&this.element.find(".add-on, .input-group-addon, .btn"),this.hasInput=this.component&&this.element.find("input").length,this.component&&0===this.component.length&&(this.component=!1),this.picker=t(this.o.template||y.template),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("datepicker-inline").appendTo(this.element):this.picker.addClass("datepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("datepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("[colspan]").attr("colspan",(function(t,e){return parseInt(e)+1})),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.setDaysOfWeekHighlighted(this.o.daysOfWeekHighlighted),this.setDatesDisabled(this.o.datesDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};p.prototype={constructor:p,_process_options:function(s){this._o=t.extend({},this._o,s);var r=this.o=t.extend({},this._o),o=r.language;switch(v[o]||(o=o.split("-")[0],v[o]||(o=m.language)),r.language=o,r.startView){case 2:case"decade":r.startView=2;break;case 1:case"year":r.startView=1;break;default:r.startView=0}switch(r.minViewMode){case 1:case"months":r.minViewMode=1;break;case 2:case"years":r.minViewMode=2;break;default:r.minViewMode=0}switch(r.maxViewMode){case 0:case"days":r.maxViewMode=0;break;case 1:case"months":r.maxViewMode=1;break;default:r.maxViewMode=2}r.startView=Math.min(r.startView,r.maxViewMode),r.startView=Math.max(r.startView,r.minViewMode),!0!==r.multidate&&(r.multidate=Number(r.multidate)||!1,!1!==r.multidate&&(r.multidate=Math.max(0,r.multidate))),r.multidateSeparator=String(r.multidateSeparator),r.weekStart%=7,r.weekEnd=(r.weekStart+6)%7;var a=y.parseFormat(r.format);if(r.startDate!==-1/0&&(r.startDate?r.startDate instanceof Date?r.startDate=this._local_to_utc(this._zero_time(r.startDate)):r.startDate=y.parseDate(r.startDate,a,r.language):r.startDate=-1/0),r.endDate!==1/0&&(r.endDate?r.endDate instanceof Date?r.endDate=this._local_to_utc(this._zero_time(r.endDate)):r.endDate=y.parseDate(r.endDate,a,r.language):r.endDate=1/0),r.daysOfWeekDisabled=r.daysOfWeekDisabled||[],Array.isArray(r.daysOfWeekDisabled)||(r.daysOfWeekDisabled=r.daysOfWeekDisabled.split(/[,\s]*/)),r.daysOfWeekDisabled=t.map(r.daysOfWeekDisabled,(function(t){return parseInt(t,10)})),r.daysOfWeekHighlighted=r.daysOfWeekHighlighted||[],Array.isArray(r.daysOfWeekHighlighted)||(r.daysOfWeekHighlighted=r.daysOfWeekHighlighted.split(/[,\s]*/)),r.daysOfWeekHighlighted=t.map(r.daysOfWeekHighlighted,(function(t){return parseInt(t,10)})),r.datesDisabled=r.datesDisabled||[],!Array.isArray(r.datesDisabled)){var l=[];l.push(y.parseDate(r.datesDisabled,a,r.language)),r.datesDisabled=l}r.datesDisabled=t.map(r.datesDisabled,(function(t){return y.parseDate(t,a,r.language)}));var c=String(r.orientation).toLowerCase().split(/\s+/g),u=r.orientation.toLowerCase();if(c=t.grep(c,(function(t){return/^auto|left|right|top|bottom$/.test(t)})),r.orientation={x:"auto",y:"auto"},u&&"auto"!==u)if(1===c.length)switch(c[0]){case"top":case"bottom":r.orientation.y=c[0];break;case"left":case"right":r.orientation.x=c[0]}else u=t.grep(c,(function(t){return/^left|right$/.test(t)})),r.orientation.x=u[0]||"auto",u=t.grep(c,(function(t){return/^top|bottom$/.test(t)})),r.orientation.y=u[0]||"auto";else;if(r.defaultViewDate){var p=r.defaultViewDate.year||(new Date).getFullYear(),h=r.defaultViewDate.month||0,d=r.defaultViewDate.day||1;r.defaultViewDate=n(p,h,d)}else r.defaultViewDate=i();r.showOnFocus=r.showOnFocus===e||r.showOnFocus,r.zIndexOffset=r.zIndexOffset!==e?r.zIndexOffset:10},_events:[],_secondaryEvents:[],_applyEvents:function(t){for(var n,i,s,r=0;r<t.length;r++)n=t[r][0],2===t[r].length?(i=e,s=t[r][1]):3===t[r].length&&(i=t[r][1],s=t[r][2]),n.on(s,i)},_unapplyEvents:function(t){for(var n,i,s,r=0;r<t.length;r++)n=t[r][0],2===t[r].length?(s=e,i=t[r][1]):3===t[r].length&&(s=t[r][1],i=t[r][2]),n.off(i,s)},_buildEvents:function(){var e={keyup:t.proxy((function(e){-1===t.inArray(e.keyCode,[27,37,39,38,40,32,13,9])&&this.update()}),this),keydown:t.proxy(this.keydown,this),paste:t.proxy(this.paste,this)};!0===this.o.showOnFocus&&(e.focus=t.proxy(this.show,this)),this.isInput?this._events=[[this.element,e]]:this.component&&this.hasInput?this._events=[[this.element.find("input"),e],[this.component,{click:t.proxy(this.show,this)}]]:this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:t.proxy(this.show,this)}]],this._events.push([this.element,"*",{blur:t.proxy((function(t){this._focused_from=t.target}),this)}],[this.element,{blur:t.proxy((function(t){this._focused_from=t.target}),this)}]),this.o.immediateUpdates&&this._events.push([this.element,{"changeYear changeMonth":t.proxy((function(t){this.update(t.date)}),this)}]),this._secondaryEvents=[[this.picker,{click:t.proxy(this.click,this)}],[t(window),{resize:t.proxy(this.place,this)}],[t(document),{mousedown:t.proxy((function(t){this.element.is(t.target)||this.element.find(t.target).length||this.picker.is(t.target)||this.picker.find(t.target).length||this.picker.hasClass("datepicker-inline")||this.hide()}),this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(e,n){var i=n||this.dates.get(-1),s=this._utc_to_local(i);this.element.trigger({type:e,date:s,dates:t.map(this.dates,this._utc_to_local),format:t.proxy((function(t,e){0===arguments.length?(t=this.dates.length-1,e=this.o.format):"string"==typeof t&&(e=t,t=this.dates.length-1),e=e||this.o.format;var n=this.dates.get(t);return y.formatDate(n,e,this.o.language)}),this)})},show:function(){if(!this.element.attr("readonly")||!1!==this.o.enableOnReadonly)return this.isInline||this.picker.appendTo(this.o.container),this.place(),this.picker.show(),this._attachSecondaryEvents(),this._trigger("show"),(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&this.o.disableTouchKeyboard&&t(this.element).trigger("blur"),this},hide:function(){return this.isInline?this:this.picker.is(":visible")?(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue(),this._trigger("hide.bs.datepicker"),this):this},remove:function(){return this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().datepicker,this.isInput||delete this.element.data().date,this},paste:function(e){var n;if(e.originalEvent.clipboardData&&e.originalEvent.clipboardData.types&&-1!==t.inArray("text/plain",e.originalEvent.clipboardData.types))n=e.originalEvent.clipboardData.getData("text/plain");else{if(!window.clipboardData)return;n=window.clipboardData.getData("Text")}this.setDate(n),this.update(),e.preventDefault()},_utc_to_local:function(t){return t&&new Date(t.getTime()+6e4*t.getTimezoneOffset())},_local_to_utc:function(t){return t&&new Date(t.getTime()-6e4*t.getTimezoneOffset())},_zero_time:function(t){return t&&new Date(t.getFullYear(),t.getMonth(),t.getDate())},_zero_utc_time:function(t){return t&&new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()))},getDates:function(){return t.map(this.dates,this._utc_to_local)},getUTCDates:function(){return t.map(this.dates,(function(t){return new Date(t)}))},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){var t=this.dates.get(-1);return void 0!==t?new Date(t):null},clearDates:function(){var t;this.isInput?t=this.element:this.component&&(t=this.element.find("input")),t&&t.val(""),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()},setDates:function(){var t=Array.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,t),this._trigger("changeDate"),this.setValue(),this},setUTCDates:function(){var e=Array.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,t.map(e,this._utc_to_local)),this._trigger("changeDate"),this.setValue(),this},setDate:r("setDates"),setUTCDate:r("setUTCDates"),setValue:function(){var t=this.getFormattedDate();return this.isInput?this.element.val(t):this.component&&this.element.find("input").val(t),this},getFormattedDate:function(n){n===e&&(n=this.o.format);var i=this.o.language;return t.map(this.dates,(function(t){return y.formatDate(t,n,i)})).join(this.o.multidateSeparator)},setStartDate:function(t){return this._process_options({startDate:t}),this.update(),this.updateNavArrows(),this},setEndDate:function(t){return this._process_options({endDate:t}),this.update(),this.updateNavArrows(),this},setDaysOfWeekDisabled:function(t){return this._process_options({daysOfWeekDisabled:t}),this.update(),this.updateNavArrows(),this},setDaysOfWeekHighlighted:function(t){return this._process_options({daysOfWeekHighlighted:t}),this.update(),this},setDatesDisabled:function(t){this._process_options({datesDisabled:t}),this.update(),this.updateNavArrows()},place:function(){if(this.isInline)return this;var e=this.picker.outerWidth(),n=this.picker.outerHeight(),i=10,s=t(this.o.container),r=t(window).width(),o=s.scrollParent().scrollTop(),a=s.offset().top+s.height(),l=s.scrollParent().prop("scrollHeight"),c=s.offset(),u=[];this.element.parents().each((function(){var e=t(this).css("z-index");"auto"!==e&&0!==e&&u.push(parseInt(e))}));var p=Math.max.apply(Math,u)+this.o.zIndexOffset,h=this.component?this.component.parent().offset():this.element.offset(),d=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),f=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),m=h.left-c.left,g=h.top-c.top,v=s.width()-f-m;this.picker.removeClass("datepicker-orient-top datepicker-orient-bottom datepicker-orient-right datepicker-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("datepicker-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(m-=e-f),this.o.rtl&&(v-=e-f)):h.left<0?(this.picker.addClass("datepicker-orient-left"),m-=h.left-i):m+e>r?(this.picker.addClass("datepicker-orient-right"),m=h.left+f-e,v=0):this.picker.addClass("datepicker-orient-left");var y=this.o.orientation.y;if("auto"===y&&(y=l-a-o>n?"bottom":"top"),this.picker.addClass("datepicker-orient-"+y),"top"===y?g-=n+parseInt(this.picker.css("padding-top")):g+=d,this.o.rtl?this.picker.css({top:g,right:v,zIndex:p}):this.picker.css({top:g,left:m,zIndex:p}),!this.o.disableScroll){var b=this.picker.scrollParent(),_=(a=h.top+d+this.picker.outerHeight(),b.scrollTop()+b.height());a>_&&b.scrollTop(b.scrollTop()+(a-_)+10)}return this},_allow_update:!0,rerender:function(){return this.fill(),this.element.trigger("change"),this},update:function(){if(!this._allow_update)return this;var e=this.dates.copy(),n=[],i=!1;return arguments.length?(t.each(arguments,t.proxy((function(t,e){e instanceof Date&&(e=this._local_to_utc(e)),n.push(e)}),this)),i=!0):(n=(n=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val())&&this.o.multidate?n.split(this.o.multidateSeparator):[n],delete this.element.data().date),n=t.map(n,t.proxy((function(t){return y.parseDate(t,this.o.format,this.o.language)}),this)),n=t.grep(n,t.proxy((function(t){return t<this.o.startDate||t>this.o.endDate||!t}),this),!0),this.dates.replace(n),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate?this.viewDate=new Date(this.o.endDate):this.viewDate=this.o.defaultViewDate,i?this.setValue():n.length&&String(e)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&e.length&&this._trigger("clearDate"),this.fill(),this.element.trigger("change"),this},fillDow:function(){var t=this.o.weekStart,e="<tr>";for(this.o.calendarWeeks&&(e+='<th class="cw">&#160;</th>');t<this.o.weekStart+7;)e+='<th class="dow">'+v[this.o.language].daysMin[t++%7].substr(0,2)+"</th>";e+="</tr>",this.picker.find(".datepicker-days thead").append(e)},fillMonths:function(){for(var t="",e=0;e<12;)t+='<span class="month">'+v[this.o.language].monthsShort[e++]+"</span>";this.picker.find(".datepicker-months td").html(t)},setRange:function(e){e&&e.length?this.range=t.map(e,(function(t){return t.valueOf()})):delete this.range,this.fill()},getClassNames:function(e){var n=[],i=this.viewDate.getUTCFullYear(),r=this.viewDate.getUTCMonth(),o=new Date;return e.getUTCFullYear()<i||e.getUTCFullYear()===i&&e.getUTCMonth()<r?n.push("old"):(e.getUTCFullYear()>i||e.getUTCFullYear()===i&&e.getUTCMonth()>r)&&n.push("new"),this.focusDate&&e.valueOf()===this.focusDate.valueOf()&&n.push("focused"),this.o.todayHighlight&&e.getUTCFullYear()===o.getFullYear()&&e.getUTCMonth()===o.getMonth()&&e.getUTCDate()===o.getDate()&&n.push("today"),-1!==this.dates.contains(e)&&n.push("active"),(e.valueOf()<this.o.startDate||e.valueOf()>this.o.endDate||-1!==t.inArray(e.getUTCDay(),this.o.daysOfWeekDisabled))&&n.push("disabled"),-1!==t.inArray(e.getUTCDay(),this.o.daysOfWeekHighlighted)&&n.push("highlighted"),this.o.datesDisabled.length>0&&t.grep(this.o.datesDisabled,(function(t){return s(e,t)})).length>0&&n.push("disabled","disabled-date"),this.range&&(e>this.range[0]&&e<this.range[this.range.length-1]&&n.push("range"),-1!==t.inArray(e.valueOf(),this.range)&&n.push("selected"),e.valueOf()===this.range[0]&&n.push("range-start"),e.valueOf()===this.range[this.range.length-1]&&n.push("range-end")),n},fill:function(){var i,s=new Date(this.viewDate),r=s.getUTCFullYear(),o=s.getUTCMonth(),a=this.o.startDate!==-1/0?this.o.startDate.getUTCFullYear():-1/0,l=this.o.startDate!==-1/0?this.o.startDate.getUTCMonth():-1/0,c=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,u=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0,p=v[this.o.language].today||v.en.today||"",h=v[this.o.language].clear||v.en.clear||"",d=v[this.o.language].titleFormat||v.en.titleFormat;if(!isNaN(r)&&!isNaN(o)){this.picker.find(".datepicker-days thead .datepicker-switch").text(y.formatDate(new n(r,o),d,this.o.language)),this.picker.find("tfoot .today").text(p).toggleClass("hidden",0==this.o.todayBtn),this.picker.find("tfoot .clear").text(h).toggle(!1!==this.o.clearBtn),this.picker.find("thead .datepicker-title").text(this.o.title).toggle(""!==this.o.title),this.updateNavArrows(),this.fillMonths();var f=n(r,o-1,28),m=y.getDaysInMonth(f.getUTCFullYear(),f.getUTCMonth());f.setUTCDate(m),f.setUTCDate(m-(f.getUTCDay()-this.o.weekStart+7)%7);var g=new Date(f);f.getUTCFullYear()<100&&g.setUTCFullYear(f.getUTCFullYear()),g.setUTCDate(g.getUTCDate()+42),g=g.valueOf();for(var b,_=[];f.valueOf()<g;){if(f.getUTCDay()===this.o.weekStart&&(_.push("<tr>"),this.o.calendarWeeks)){var w=new Date(+f+(this.o.weekStart-f.getUTCDay()-7)%7*864e5),k=new Date(Number(w)+(11-w.getUTCDay())%7*864e5),A=new Date(Number(A=n(k.getUTCFullYear(),0,1))+(11-A.getUTCDay())%7*864e5),C=(k-A)/864e5/7+1;_.push('<td class="cw">'+C+"</td>")}if((b=this.getClassNames(f)).push("day"),this.o.beforeShowDay!==t.noop){var T=this.o.beforeShowDay(this._utc_to_local(f));T===e?T={}:"boolean"==typeof T?T={enabled:T}:"string"==typeof T&&(T={classes:T}),!1===T.enabled&&b.push("disabled"),T.classes&&(b=b.concat(T.classes.split(/\s+/))),T.tooltip&&(i=T.tooltip)}b=t.uniqueSort(b),_.push('<td class="'+b.join(" ")+'"'+(i?' title="'+i+'"':"")+">"+f.getUTCDate()+"</td>"),i=null,f.getUTCDay()===this.o.weekEnd&&_.push("</tr>"),f.setUTCDate(f.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(_.join(""));var S=this.picker.find(".datepicker-months").find(".datepicker-switch").text(this.o.maxViewMode<2?"Months":r).end().find("span").removeClass("active");if(t.each(this.dates,(function(t,e){e.getUTCFullYear()===r&&S.eq(e.getUTCMonth()).addClass("active")})),(r<a||r>c)&&S.addClass("disabled"),r===a&&S.slice(0,l).addClass("disabled"),r===c&&S.slice(u+1).addClass("disabled"),this.o.beforeShowMonth!==t.noop){var x=this;t.each(S,(function(e,n){if(!t(n).hasClass("disabled")){var i=new Date(r,e,1);!1===x.o.beforeShowMonth(i)&&t(n).addClass("disabled")}}))}_="",r=10*parseInt(r/10,10);var j=this.picker.find(".datepicker-years").find(".datepicker-switch").text(r+"-"+(r+9)).end().find("td");r-=1;for(var D,P=t.map(this.dates,(function(t){return t.getUTCFullYear()})),E=-1;E<11;E++){if(D=["year"],i=null,-1===E?D.push("old"):10===E&&D.push("new"),-1!==t.inArray(r,P)&&D.push("active"),(r<a||r>c)&&D.push("disabled"),this.o.beforeShowYear!==t.noop){var I=this.o.beforeShowYear(new Date(r,0,1));I===e?I={}:"boolean"==typeof I?I={enabled:I}:"string"==typeof I&&(I={classes:I}),!1===I.enabled&&D.push("disabled"),I.classes&&(D=D.concat(I.classes.split(/\s+/))),I.tooltip&&(i=I.tooltip)}_+='<span class="'+D.join(" ")+'"'+(i?' title="'+i+'"':"")+">"+r+"</span>",r+=1}j.html(_)}},updateNavArrows:function(){if(this._allow_update){var t=new Date(this.viewDate),e=t.getUTCFullYear(),n=t.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-1/0&&e<=this.o.startDate.getUTCFullYear()&&n<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&e>=this.o.endDate.getUTCFullYear()&&n>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:this.o.startDate!==-1/0&&e<=this.o.startDate.getUTCFullYear()||this.o.maxViewMode<2?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&e>=this.o.endDate.getUTCFullYear()||this.o.maxViewMode<2?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(e){e.preventDefault(),e.stopPropagation();var i,s,r,o=t(e.target).closest("td > div.datepicker-footer-buttons > div, span, td, th");if(1===o.length)switch(o[0].nodeName.toLowerCase()){case"th":switch(o[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":var a=y.modes[this.viewMode].navStep*("prev"===o[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,a),this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,a),1===this.viewMode&&this._trigger("changeYear",this.viewDate)}this.fill();break;case"today":c=n((c=new Date).getFullYear(),c.getMonth(),c.getDate(),0,0,0),this.showMode(-2);var l="linked"===this.o.todayBtn?null:"view";this._setDate(c,l);break;case"clear":this.clearDates()}break;case"div":switch(o[0].className){case"today":var c;c=n((c=new Date).getFullYear(),c.getMonth(),c.getDate(),0,0,0),this.showMode(-2);l="linked"===this.o.todayBtn?null:"view";this._setDate(c,l);break;case"clear":this.clearDates()}break;case"span":o.hasClass("disabled")||(this.viewDate.setUTCDate(1),o.hasClass("month")?(r=1,s=o.parent().find("span").index(o),i=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(s),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode?(this._setDate(n(i,s,r)),this.showMode()):this.showMode(-1)):(r=1,s=0,i=parseInt(o.text(),10)||0,this.viewDate.setUTCFullYear(i),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(n(i,s,r)),this.showMode(-1)),this.fill());break;case"td":o.hasClass("day")&&!o.hasClass("disabled")&&(r=parseInt(o.text(),10)||1,i=this.viewDate.getUTCFullYear(),s=this.viewDate.getUTCMonth(),o.hasClass("old")?0===s?(s=11,i-=1):s-=1:o.hasClass("new")&&(11===s?(s=0,i+=1):s+=1),this._setDate(n(i,s,r)))}this.picker.is(":visible")&&this._focused_from&&t(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(t){var e=this.dates.contains(t);if(t||this.dates.clear(),-1!==e?(!0===this.o.multidate||this.o.multidate>1||this.o.toggleActive)&&this.dates.remove(e):!1===this.o.multidate?(this.dates.clear(),this.dates.push(t)):this.dates.push(t),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(t,e){var n;e&&"date"!==e||this._toggle_multidate(t&&new Date(t)),e&&"view"!==e||(this.viewDate=t&&new Date(t)),this.fill(),this.setValue(),e&&"view"===e||this._trigger("changeDate"),this.isInput?n=this.element:this.component&&(n=this.element.find("input")),n&&n.trigger("change"),!this.o.autoclose||e&&"date"!==e||this.hide()},moveMonth:function(t,e){if(!o(t))return this.o.defaultViewDate;if(!e)return t;var n,i,s=new Date(t.valueOf()),r=s.getUTCDate(),a=s.getUTCMonth(),l=Math.abs(e);if(e=e>0?1:-1,1===l)i=-1===e?function(){return s.getUTCMonth()===a}:function(){return s.getUTCMonth()!==n},n=a+e,s.setUTCMonth(n),(n<0||n>11)&&(n=(n+12)%12);else{for(var c=0;c<l;c++)s=this.moveMonth(s,e);n=s.getUTCMonth(),s.setUTCDate(r),i=function(){return n!==s.getUTCMonth()}}for(;i();)s.setUTCDate(--r),s.setUTCMonth(n);return s},moveYear:function(t,e){return this.moveMonth(t,12*e)},dateWithinRange:function(t){return t>=this.o.startDate&&t<=this.o.endDate},keydown:function(t){if(this.picker.is(":visible")){var e,n,s,r,o=!1,a=this.focusDate||this.viewDate;switch(t.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),t.preventDefault(),t.stopPropagation();break;case 37:case 39:if(!this.o.keyboardNavigation)break;e=37===t.keyCode?-1:1,t.ctrlKey?(n=this.moveYear(this.dates.get(-1)||i(),e),s=this.moveYear(a,e),this._trigger("changeYear",this.viewDate)):t.shiftKey?(n=this.moveMonth(this.dates.get(-1)||i(),e),s=this.moveMonth(a,e),this._trigger("changeMonth",this.viewDate)):((n=new Date(this.dates.get(-1)||i())).setUTCDate(n.getUTCDate()+e),(s=new Date(a)).setUTCDate(a.getUTCDate()+e)),this.dateWithinRange(s)&&(this.focusDate=this.viewDate=s,this.setValue(),this.fill(),t.preventDefault());break;case 38:case 40:if(!this.o.keyboardNavigation)break;e=38===t.keyCode?-1:1,t.ctrlKey?(n=this.moveYear(this.dates.get(-1)||i(),e),s=this.moveYear(a,e),this._trigger("changeYear",this.viewDate)):t.shiftKey?(n=this.moveMonth(this.dates.get(-1)||i(),e),s=this.moveMonth(a,e),this._trigger("changeMonth",this.viewDate)):((n=new Date(this.dates.get(-1)||i())).setUTCDate(n.getUTCDate()+7*e),(s=new Date(a)).setUTCDate(a.getUTCDate()+7*e)),this.dateWithinRange(s)&&(this.focusDate=this.viewDate=s,this.setValue(),this.fill(),t.preventDefault());break;case 32:break;case 13:if(!this.o.forceParse)break;a=this.focusDate||this.dates.get(-1)||this.viewDate,this.o.keyboardNavigation&&(this._toggle_multidate(a),o=!0),this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(t.preventDefault(),"function"==typeof t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}if(o)this.dates.length?this._trigger("changeDate"):this._trigger("clearDate"),this.isInput?r=this.element:this.component&&(r=this.element.find("input")),r&&r.trigger("change")}else 40!==t.keyCode&&27!==t.keyCode||(this.show(),t.stopPropagation())},showMode:function(t){t&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(this.o.maxViewMode,this.viewMode+t))),this.picker.children("div").hide().filter(".datepicker-"+y.modes[this.viewMode].clsName).show(),this.updateNavArrows()}};var h=function(e,n){this.element=t(e),this.inputs=t.map(n.inputs,(function(t){return t.jquery?t[0]:t})),delete n.inputs,f.call(t(this.inputs),n).on("changeDate",t.proxy(this.dateUpdated,this)),this.pickers=t.map(this.inputs,(function(e){return t(e).data("datepicker")})),this.updateDates()};h.prototype={updateDates:function(){this.dates=t.map(this.pickers,(function(t){return t.getUTCDate()})),this.updateRanges()},updateRanges:function(){var e=t.map(this.dates,(function(t){return t.valueOf()}));t.each(this.pickers,(function(t,n){n.setRange(e)}))},dateUpdated:function(e){if(!this.updating){this.updating=!0;var n=t(e.target).data("datepicker");if(void 0!==n){var i=n.getUTCDate(),s=t.inArray(e.target,this.inputs),r=s-1,o=s+1,a=this.inputs.length;if(-1!==s){if(t.each(this.pickers,(function(t,e){e.getUTCDate()||e.setUTCDate(i)})),i<this.dates[r])for(;r>=0&&i<this.dates[r];)this.pickers[r--].setUTCDate(i);else if(i>this.dates[o])for(;o<a&&i>this.dates[o];)this.pickers[o++].setUTCDate(i);this.updateDates(),delete this.updating}}}},remove:function(){t.map(this.pickers,(function(t){t.remove()})),delete this.element.data().datepicker}};var d=t.fn.datepicker,f=function(n){var i,s=Array.apply(null,arguments);if(s.shift(),this.each((function(){var e=t(this),r=e.data("datepicker"),o="object"==typeof n&&n;if(!r){var c=a(this,"date"),u=l(t.extend({},m,c,o).language),d=t.extend({},m,u,c,o);if(e.hasClass("input-daterange")||d.inputs){var f={inputs:d.inputs||e.find("input").toArray()};e.data("datepicker",r=new h(this,t.extend(d,f)))}else e.data("datepicker",r=new p(this,d))}"string"==typeof n&&"function"==typeof r[n]&&(i=r[n].apply(r,s))})),i===e||i instanceof p||i instanceof h)return this;if(this.length>1)throw new Error("Using only allowed for the collection of a single element ("+n+" function)");return i};t.fn.datepicker=f;var m=t.fn.datepicker.defaults={autoclose:!1,beforeShowDay:t.noop,beforeShowMonth:t.noop,beforeShowYear:t.noop,calendarWeeks:!1,clearBtn:!1,toggleActive:!1,daysOfWeekDisabled:[],daysOfWeekHighlighted:[],datesDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,maxViewMode:2,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-1/0,startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0,disableTouchKeyboard:!1,enableOnReadonly:!0,container:"body",immediateUpdates:!1,title:""},g=t.fn.datepicker.locale_opts=["format","rtl","weekStart"];t.fn.datepicker.Constructor=p;var v=t.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear",titleFormat:"MM yyyy"}},y={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(t){return t%4==0&&t%100!=0||t%400==0},getDaysInMonth:function(t,e){return[31,y.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(t){if("function"==typeof t.toValue&&"function"==typeof t.toDisplay)return t;var e=t.replace(this.validParts,"\0").split("\0"),n=t.match(this.validParts);if(!e||!e.length||!n||0===n.length)throw new Error("Invalid date format.");return{separators:e,parts:n}},parseDate:function(i,s,r){function o(){
var t=this.slice(0,h[c].length),e=h[c].slice(0,t.length);return t.toLowerCase()===e.toLowerCase()}if(!i)return e;if(i instanceof Date)return i;if("string"==typeof s&&(s=y.parseFormat(s)),s.toValue)return s.toValue(i,s,r);var a,l,c,u=/([\-+]\d+)([dmwy])/,h=i.match(/([\-+]\d+)([dmwy])/g);if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(i)){for(i=new Date,c=0;c<h.length;c++)switch(a=u.exec(h[c]),l=parseInt(a[1]),a[2]){case"d":i.setUTCDate(i.getUTCDate()+l);break;case"m":i=p.prototype.moveMonth.call(p.prototype,i,l);break;case"w":i.setUTCDate(i.getUTCDate()+7*l);break;case"y":i=p.prototype.moveYear.call(p.prototype,i,l)}return n(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),0,0,0)}h=i&&i.match(this.nonpunctuation)||[],i=new Date;var d,f,m={},g=["yyyy","yy","M","MM","m","mm","d","dd"],b={yyyy:function(t,e){return t.setUTCFullYear(e)},yy:function(t,e){return t.setUTCFullYear(2e3+e)},m:function(t,e){if(isNaN(t))return t;for(e-=1;e<0;)e+=12;for(e%=12,t.setUTCMonth(e);t.getUTCMonth()!==e;)t.setUTCDate(t.getUTCDate()-1);return t},d:function(t,e){return t.setUTCDate(e)}};b.M=b.MM=b.mm=b.m,b.dd=b.d,i=n(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0);var _=s.parts.slice();if(h.length!==_.length&&(_=t(_).filter((function(e,n){return-1!==t.inArray(n,g)})).toArray()),h.length===_.length){var w,k,A;for(c=0,w=_.length;c<w;c++){if(d=parseInt(h[c],10),a=_[c],isNaN(d))switch(a){case"MM":f=t(v[r].months).filter(o),d=t.inArray(f[0],v[r].months)+1;break;case"M":f=t(v[r].monthsShort).filter(o),d=t.inArray(f[0],v[r].monthsShort)+1}m[a]=d}for(c=0;c<g.length;c++)(A=g[c])in m&&!isNaN(m[A])&&(k=new Date(i),b[A](k,m[A]),isNaN(k)||(i=k))}return i},formatDate:function(e,n,i){if(!e)return"";if("string"==typeof n&&(n=y.parseFormat(n)),n.toDisplay)return n.toDisplay(e,n,i);var s={d:e.getUTCDate(),D:v[i].daysShort[e.getUTCDay()],DD:v[i].days[e.getUTCDay()],m:e.getUTCMonth()+1,M:v[i].monthsShort[e.getUTCMonth()],MM:v[i].months[e.getUTCMonth()],yy:e.getUTCFullYear().toString().substring(2),yyyy:e.getUTCFullYear()};s.dd=(s.d<10?"0":"")+s.d,s.mm=(s.m<10?"0":"")+s.m,e=[];for(var r=t.extend([],n.separators),o=0,a=n.parts.length;o<=a;o++)r.length&&e.push(r.shift()),e.push(s[n.parts[o]]);return e.join("")},headTemplate:'<thead><tr><th colspan="7" class="datepicker-title"></th></tr><tr><th class="prev">&#171;</th><th colspan="5" class="datepicker-switch"></th><th class="next">&#187;</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};y.template='<div class="datepicker"><div class="datepicker-days"><table class=" table-condensed">'+y.headTemplate+"<tbody></tbody>"+y.footTemplate+'</table></div><div class="datepicker-months"><table class="table-condensed">'+y.headTemplate+y.contTemplate+y.footTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+y.headTemplate+y.contTemplate+y.footTemplate+"</table></div></div>",t.fn.datepicker.DPGlobal=y,t.fn.datepicker.noConflict=function(){return t.fn.datepicker=d,this},t.fn.datepicker.version="1.4.1-dev",t(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',(function(e){var n=t(this);n.data("datepicker")||(e.preventDefault(),f.call(n,"show"))})),t((function(){f.call(t('[data-provide="datepicker-inline"]'))}))})),function(t,e){"function"==typeof define&&define.amd?define(t):void 0!==module&&"object"==typeof exports?module.exports=t():e.rangy=t()}((function(){function t(t,e){var n=typeof t[e];return n==_||!(n!=b||!t[e])||"unknown"==n}function e(t,e){return!(typeof t[e]!=b||!t[e])}function n(t,e){return typeof t[e]!=w}function i(t){return function(e,n){for(var i=n.length;i--;)if(!t(e,n[i]))return!1;return!0}}function s(t){return t&&S(t,T)&&j(t,C)}function r(t){return e(t,"body")?t.body:t.getElementsByTagName("body")[0]}function o(e){typeof console!=w&&t(console,"log")&&console.log(e)}function a(t,e){E&&e?alert(t):o(t)}function l(t){O.initialized=!0,O.supported=!1,a("Rangy is not supported in this environment. Reason: "+t,O.config.alertOnFail)}function c(t){a("Rangy warning: "+t,O.config.alertOnWarn)}function u(t){return t.message||t.description||String(t)}function p(){if(E&&!O.initialized){var e,n=!1,i=!1;t(document,"createRange")&&(e=document.createRange(),S(e,A)&&j(e,k)&&(n=!0));var a,c=r(document);if(!c||"body"!=c.nodeName.toLowerCase())return void l("No body element found");if(c&&t(c,"createTextRange")&&(s(e=c.createTextRange())&&(i=!0)),!n&&!i)return void l("Neither Range nor TextRange are available");for(var p in O.initialized=!0,O.features={implementsDomRange:n,implementsTextRange:i},P)(a=P[p])instanceof d&&a.init(a,O);for(var h=0,f=N.length;f>h;++h)try{N[h](O)}catch(t){o("Rangy init listener threw an exception. Continuing. Detail: "+u(t))}}}function h(t){t=t||window,p();for(var e=0,n=M.length;n>e;++e)M[e](t)}function d(t,e,n){this.name=t,this.dependencies=e,this.initialized=!1,this.supported=!1,this.initializer=n}function f(t,e,n){var i=new d(t,e,(function(e){if(!e.initialized){e.initialized=!0;try{n(O,e),e.supported=!0}catch(e){o("Module '"+t+"' failed to load: "+u(e)),e.stack&&o(e.stack)}}}));return P[t]=i,i}function m(){}function g(){}var v,y,b="object",_="function",w="undefined",k=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],A=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],C=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],T=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],S=i(t),x=i(e),j=i(n),D=[].forEach?function(t,e){t.forEach(e)}:function(t,e){for(var n=0,i=t.length;i>n;++n)e(t[n],n)},P={},E=typeof window!=w&&typeof document!=w,I={isHostMethod:t,isHostObject:e,isHostProperty:n,areHostMethods:S,areHostObjects:x,areHostProperties:j,isTextRange:s,getBody:r,forEach:D},O={version:"1.3.0-beta.1",initialized:!1,isBrowser:E,supported:!0,util:I,features:{},modules:P,config:{alertOnFail:!0,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==w||rangyAutoInitialize}};O.fail=l,O.warn=c,!{}.hasOwnProperty?l("hasOwnProperty not supported"):(I.extend=v=function(t,e,n){var i,s;for(var r in e)e.hasOwnProperty(r)&&(i=t[r],s=e[r],n&&null!==i&&"object"==typeof i&&null!==s&&"object"==typeof s&&v(i,s,!0),t[r]=s);return e.hasOwnProperty("toString")&&(t.toString=e.toString),t},I.createOptions=function(t,e){var n={};return v(n,e),t&&v(n,t),n}),E||l("Rangy can only run in a browser"),function(){var t;if(E){var e=document.createElement("div");e.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(e.childNodes,0)[0].nodeType&&(t=function(t){return n.call(t,0)})}catch(t){}}t||(t=function(t){for(var e=[],n=0,i=t.length;i>n;++n)e[n]=t[n];return e}),I.toArray=t}(),E&&(t(document,"addEventListener")?y=function(t,e,n){t.addEventListener(e,n,!1)}:t(document,"attachEvent")?y=function(t,e,n){t.attachEvent("on"+e,n)}:l("Document does not have required addEventListener or attachEvent method"),I.addListener=y);var N=[];O.init=p,O.addInitListener=function(t){O.initialized?t(O):N.push(t)};var M=[];O.addShimListener=function(t){M.push(t)},E&&(O.shim=O.createMissingNativeApi=h),d.prototype={init:function(){for(var t,e,n=this.dependencies||[],i=0,s=n.length;s>i;++i){if(e=n[i],!((t=P[e])&&t instanceof d))throw new Error("required module '"+e+"' not found");if(t.init(),!t.supported)throw new Error("required module '"+e+"' not supported")}this.initializer(this)},fail:function(t){throw this.initialized=!0,this.supported=!1,new Error("Module '"+this.name+"' failed to load: "+t)},warn:function(t){O.warn("Module "+this.name+": "+t)},deprecationNotice:function(t,e){O.warn("DEPRECATED: "+t+" in module "+this.name+"is deprecated. Please use "+e+" instead")},createError:function(t){return new Error("Error in Rangy "+this.name+" module: "+t)}},O.createModule=function(t){var e,n;2==arguments.length?(e=arguments[1],n=[]):(e=arguments[2],n=arguments[1]);var i=f(t,n,e);O.initialized&&O.supported&&i.init()},O.createCoreModule=function(t,e,n){f(t,e,n)},O.RangePrototype=m,O.rangePrototype=new m,O.selectionPrototype=new g,O.createCoreModule("DomUtil",[],(function(t,e){function n(t){var e;return typeof t.namespaceURI==D||null===(e=t.namespaceURI)||"http://www.w3.org/1999/xhtml"==e}function i(t){var e=t.parentNode;return 1==e.nodeType?e:null}function s(t){for(var e=0;t=t.previousSibling;)++e;return e}function r(t){switch(t.nodeType){case 7:case 10:return 0;case 3:case 8:return t.length;default:return t.childNodes.length}}function o(t,e){var n,i=[];for(n=t;n;n=n.parentNode)i.push(n);for(n=e;n;n=n.parentNode)if(N(i,n))return n;return null}function a(t,e,n){for(var i=n?e:e.parentNode;i;){if(i===t)return!0;i=i.parentNode}return!1}function l(t,e){return a(t,e,!0)}function c(t,e,n){for(var i,s=n?t:t.parentNode;s;){if((i=s.parentNode)===e)return s;s=i}return null}function u(t){var e=t.nodeType;return 3==e||4==e||8==e}function p(t){if(!t)return!1;var e=t.nodeType;return 3==e||8==e}function h(t,e){var n=e.nextSibling,i=e.parentNode;return n?i.insertBefore(t,n):i.appendChild(t),t}function d(t,e,n){var i=t.cloneNode(!1);if(i.deleteData(0,e),t.deleteData(e,t.length-e),h(i,t),n)for(var r,o=0;r=n[o++];)r.node==t&&r.offset>e?(r.node=i,r.offset-=e):r.node==t.parentNode&&r.offset>s(t)&&++r.offset;return i}function f(t){if(9==t.nodeType)return t;if(typeof t.ownerDocument!=D)return t.ownerDocument;if(typeof t.document!=D)return t.document;if(t.parentNode)return f(t.parentNode);throw e.createError("getDocument: no document found for node")}function m(t){var n=f(t);if(typeof n.defaultView!=D)return n.defaultView;if(typeof n.parentWindow!=D)return n.parentWindow;throw e.createError("Cannot get a window object for node")}function g(t){if(typeof t.contentDocument!=D)return t.contentDocument;if(typeof t.contentWindow!=D)return t.contentWindow.document;throw e.createError("getIframeDocument: No Document object found for iframe element")}function v(t){if(typeof t.contentWindow!=D)return t.contentWindow;if(typeof t.contentDocument!=D)return t.contentDocument.defaultView;throw e.createError("getIframeWindow: No Window object found for iframe element")}function y(t){return t&&P.isHostMethod(t,"setTimeout")&&P.isHostObject(t,"document")}function b(t,e,n){var i;if(t?P.isHostProperty(t,"nodeType")?i=1==t.nodeType&&"iframe"==t.tagName.toLowerCase()?g(t):f(t):y(t)&&(i=t.document):i=document,!i)throw e.createError(n+"(): Parameter must be a Window object or DOM node");return i}function _(t){for(var e;e=t.parentNode;)t=e;return t}function w(t,n,i,r){var a,l,u,p,h;if(t==i)return n===r?0:r>n?-1:1;if(a=c(i,t,!0))return n<=s(a)?-1:1;if(a=c(t,i,!0))return s(a)<r?-1:1;if(!(l=o(t,i)))throw new Error("comparePoints error: nodes have no common ancestor");if((u=t===l?l:c(t,l,!0))===(p=i===l?l:c(i,l,!0)))throw e.createError("comparePoints got to case 4 and childA and childB are the same!");for(h=l.firstChild;h;){if(h===u)return-1;if(h===p)return 1;h=h.nextSibling}}function k(t){try{return t.parentNode,!1}catch(t){return!0}}function A(t){if(!t)return"[No node]";if(M&&k(t))return"[Broken node]";if(u(t))return'"'+t.data+'"';if(1==t.nodeType){var e=t.id?' id="'+t.id+'"':"";return"<"+t.nodeName+e+">[index:"+s(t)+",length:"+t.childNodes.length+"]["+(t.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return t.nodeName}function C(t){for(var e,n=f(t).createDocumentFragment();e=t.firstChild;)n.appendChild(e);return n}function T(t){this.root=t,this._next=t}function S(t){return new T(t)}function x(t,e){this.node=t,this.offset=e}function j(t){this.code=this[t],this.codeName=t,this.message="DOMException: "+this.codeName}var D="undefined",P=t.util;P.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||e.fail("document missing a Node creation method"),P.isHostMethod(document,"getElementsByTagName")||e.fail("document missing getElementsByTagName method");var E=document.createElement("div");P.areHostMethods(E,["insertBefore","appendChild","cloneNode"]||!P.areHostObjects(E,["previousSibling","nextSibling","childNodes","parentNode"]))||e.fail("Incomplete Element implementation"),P.isHostProperty(E,"innerHTML")||e.fail("Element is missing innerHTML property");var I=document.createTextNode("test");P.areHostMethods(I,["splitText","deleteData","insertData","appendData","cloneNode"]||!P.areHostObjects(E,["previousSibling","nextSibling","childNodes","parentNode"])||!P.areHostProperties(I,["data"]))||e.fail("Incomplete Text Node implementation");var O,N=function(t,e){for(var n=t.length;n--;)if(t[n]===e)return!0;return!1},M=!1;!function(){var e=document.createElement("b");e.innerHTML="1";var n=e.firstChild;e.innerHTML="<br />",M=k(n),t.features.crashyTextNodes=M}(),typeof window.getComputedStyle!=D?O=function(t,e){return m(t).getComputedStyle(t,null)[e]}:typeof document.documentElement.currentStyle!=D?O=function(t,e){return t.currentStyle[e]}:e.fail("No means of obtaining computed style properties found"),T.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var t,e,n=this._current=this._next;if(this._current)if(t=n.firstChild)this._next=t;else{for(e=null;n!==this.root&&!(e=n.nextSibling);)n=n.parentNode;this._next=e}return this._current},detach:function(){this._current=this._next=this.root=null}},x.prototype={equals:function(t){return!!t&&this.node===t.node&&this.offset==t.offset},inspect:function(){return"[DomPosition("+A(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},j.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},j.prototype.toString=function(){return this.message},t.dom={arrayContains:N,isHtmlNamespace:n,parentElement:i,getNodeIndex:s,getNodeLength:r,getCommonAncestor:o,isAncestorOf:a,isOrIsAncestorOf:l,getClosestAncestorIn:c,isCharacterDataNode:u,isTextOrCommentNode:p,insertAfter:h,splitDataNode:d,getDocument:f,getWindow:m,getIframeWindow:v,getIframeDocument:g,getBody:P.getBody,isWindow:y,getContentDocument:b,getRootContainer:_,comparePoints:w,isBrokenNode:k,inspectNode:A,getComputedStyleProperty:O,fragmentFromNodeChildren:C,createIterator:S,DomPosition:x},t.DOMException=j})),O.createCoreModule("DomRange",["DomUtil"],(function(t){function e(t,e){return 3!=t.nodeType&&(B(t,e.startContainer)||B(t,e.endContainer))}function n(t){return t.document||z(t.startContainer)}function i(t){return new R(t.parentNode,$(t))}function s(t){return new R(t.parentNode,$(t)+1)}function r(t,e,n){var i=11==t.nodeType?t.firstChild:t;return F(e)?n==e.length?N.insertAfter(t,e):e.parentNode.insertBefore(t,0==n?e:q(e,n)):n>=e.childNodes.length?e.appendChild(t):e.insertBefore(t,e.childNodes[n]),i}function o(t,e,i){if(C(t),C(e),n(e)!=n(t))throw new L("WRONG_DOCUMENT_ERR");var s=U(t.startContainer,t.startOffset,e.endContainer,e.endOffset),r=U(t.endContainer,t.endOffset,e.startContainer,e.startOffset);return i?0>=s&&r>=0:0>s&&r>0}function a(t){for(var e,i,s,r=n(t.range).createDocumentFragment();i=t.next();){if(e=t.isPartiallySelectedSubtree(),i=i.cloneNode(!e),e&&(s=t.getSubtreeIterator(),i.appendChild(a(s)),s.detach()),10==i.nodeType)throw new L("HIERARCHY_REQUEST_ERR");r.appendChild(i)}return r}function l(t,e,n){var i,s,r,o;for(n=n||{stop:!1};r=t.next();)if(t.isPartiallySelectedSubtree()){if(!1===e(r))return void(n.stop=!0);if(l(o=t.getSubtreeIterator(),e,n),o.detach(),n.stop)return}else for(i=N.createIterator(r);s=i.next();)if(!1===e(s))return void(n.stop=!0)}function c(t){for(var e;t.next();)t.isPartiallySelectedSubtree()?(c(e=t.getSubtreeIterator()),e.detach()):t.remove()}function u(t){for(var e,i,s=n(t.range).createDocumentFragment();e=t.next();){if(t.isPartiallySelectedSubtree()?(e=e.cloneNode(!1),i=t.getSubtreeIterator(),e.appendChild(u(i)),i.detach()):t.remove(),10==e.nodeType)throw new L("HIERARCHY_REQUEST_ERR");s.appendChild(e)}return s}function p(t,e,n){var i,s=!(!e||!e.length),r=!!n;s&&(i=new RegExp("^("+e.join("|")+")$"));var o=[];return l(new d(t,!1),(function(e){if(!(s&&!i.test(e.nodeType)||r&&!n(e))){var a=t.startContainer;if(e!=a||!F(a)||t.startOffset!=a.length){var l=t.endContainer;e==l&&F(l)&&0==t.endOffset||o.push(e)}}})),o}function h(t){return"["+(void 0===t.getName?"Range":t.getName())+"("+N.inspectNode(t.startContainer)+":"+t.startOffset+", "+N.inspectNode(t.endContainer)+":"+t.endOffset+")]"}function d(t,e){if(this.range=t,this.clonePartiallySelectedTextNodes=e,!t.collapsed){this.sc=t.startContainer,this.so=t.startOffset,this.ec=t.endContainer,this.eo=t.endOffset;var n=t.commonAncestorContainer;this.sc===this.ec&&F(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||F(this.sc)?W(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||F(this.ec)?W(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function f(t){return function(e,n){for(var i,s=n?e:e.parentNode;s;){if(i=s.nodeType,J(t,i))return s;s=s.parentNode}return null}}function m(t,e){if(nt(t,e))throw new L("INVALID_NODE_TYPE_ERR")}function g(t,e){if(!J(e,t.nodeType))throw new L("INVALID_NODE_TYPE_ERR")}function v(t,e){if(0>e||e>(F(t)?t.length:t.childNodes.length))throw new L("INDEX_SIZE_ERR")}function y(t,e){if(tt(t,!0)!==tt(e,!0))throw new L("WRONG_DOCUMENT_ERR")}function b(t){if(et(t,!0))throw new L("NO_MODIFICATION_ALLOWED_ERR")}function _(t,e){if(!t)throw new L(e)}function w(t){return G&&N.isBrokenNode(t)||!J(Y,t.nodeType)&&!tt(t,!0)}function k(t,e){return e<=(F(t)?t.length:t.childNodes.length)}function A(t){return!!t.startContainer&&!!t.endContainer&&!w(t.startContainer)&&!w(t.endContainer)&&k(t.startContainer,t.startOffset)&&k(t.endContainer,t.endOffset)}function C(t){if(!A(t))throw new Error("Range error: Range is no longer valid after DOM mutation ("+t.inspect()+")")}function T(t,e){C(t);var n=t.startContainer,i=t.startOffset,s=t.endContainer,r=t.endOffset,o=n===s;F(s)&&r>0&&r<s.length&&q(s,r,e),F(n)&&i>0&&i<n.length&&(n=q(n,i,e),o?(r-=i,s=n):s==n.parentNode&&r>=$(n)&&r++,i=0),t.setStartAndEnd(n,i,s,r)}function S(t){C(t);var e=t.commonAncestorContainer.parentNode.cloneNode(!1);return e.appendChild(t.cloneContents()),e.innerHTML}function x(t){t.START_TO_START=at,t.START_TO_END=lt,t.END_TO_END=ct,t.END_TO_START=ut,t.NODE_BEFORE=pt,t.NODE_AFTER=ht,t.NODE_BEFORE_AND_AFTER=dt,t.NODE_INSIDE=ft}function j(t){x(t),x(t.prototype)}function D(t,e){return function(){C(this);var n,i=this.startContainer,r=this.startOffset,o=this.commonAncestorContainer,a=new d(this,!0);i!==o&&(i=(n=s(W(i,o,!0))).node,r=n.offset),l(a,b),a.reset();var c=t(a);return a.detach(),e(this,i,r,i,r),c}}function P(n,r){function o(t,e){return function(n){g(n,K),g(V(n),Y);var r=(t?i:s)(n);(e?a:l)(this,r.node,r.offset)}}function a(t,e,n){var i=t.endContainer,s=t.endOffset;(e!==t.startContainer||n!==t.startOffset)&&((V(e)!=V(i)||1==U(e,n,i,s))&&(i=e,s=n),r(t,e,n,i,s))}function l(t,e,n){var i=t.startContainer,s=t.startOffset;(e!==t.endContainer||n!==t.endOffset)&&((V(e)!=V(i)||-1==U(e,n,i,s))&&(i=e,s=n),r(t,i,s,e,n))}var p=function(){};p.prototype=t.rangePrototype,n.prototype=new p,M.extend(n.prototype,{setStart:function(t,e){m(t,!0),v(t,e),a(this,t,e)},setEnd:function(t,e){m(t,!0),v(t,e),l(this,t,e)},setStartAndEnd:function(){var t=arguments,e=t[0],n=t[1],i=e,s=n;switch(t.length){case 3:s=t[2];break;case 4:i=t[2],s=t[3]}r(this,e,n,i,s)},setBoundary:function(t,e,n){this["set"+(n?"Start":"End")](t,e)},setStartBefore:o(!0,!0),setStartAfter:o(!1,!0),setEndBefore:o(!0,!1),setEndAfter:o(!1,!1),collapse:function(t){C(this),t?r(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):r(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(t){m(t,!0),r(this,t,0,t,H(t))},selectNode:function(t){m(t,!1),g(t,K);var e=i(t),n=s(t);r(this,e.node,e.offset,n.node,n.offset)},extractContents:D(u,r),deleteContents:D(c,r),canSurroundContents:function(){C(this),b(this.startContainer),b(this.endContainer);var t=new d(this,!0),n=t._first&&e(t._first,this)||t._last&&e(t._last,this);return t.detach(),!n},splitBoundaries:function(){T(this)},splitBoundariesPreservingPositions:function(t){T(this,t)},normalizeBoundaries:function(){C(this);var t=this.startContainer,e=this.startOffset,n=this.endContainer,i=this.endOffset,s=function(t){var e=t.nextSibling;e&&e.nodeType==t.nodeType&&(n=t,i=t.length,t.appendData(e.data),e.parentNode.removeChild(e))},o=function(s){var r=s.previousSibling;if(r&&r.nodeType==s.nodeType){t=s;var o=s.length;if(e=r.length,s.insertData(0,r.data),r.parentNode.removeChild(r),t==n)i+=e,n=t;else if(n==s.parentNode){var a=$(s);i==a?(n=s,i=o):i>a&&i--}}},a=!0;if(F(n))n.length==i&&s(n);else{if(i>0){var l=n.childNodes[i-1];l&&F(l)&&s(l)}a=!this.collapsed}if(a){if(F(t))0==e&&o(t);else if(e<t.childNodes.length){var c=t.childNodes[e];c&&F(c)&&o(c)}}else t=n,e=i;r(this,t,e,n,i)},collapseToPoint:function(t,e){m(t,!0),v(t,e),this.setStartAndEnd(t,e)}}),j(n)}function E(t){t.collapsed=t.startContainer===t.endContainer&&t.startOffset===t.endOffset,t.commonAncestorContainer=t.collapsed?t.startContainer:N.getCommonAncestor(t.startContainer,t.endContainer)}function I(t,e,n,i,s){t.startContainer=e,t.startOffset=n,t.endContainer=i,t.endOffset=s,t.document=N.getDocument(e),E(t)}function O(t){this.startContainer=t,this.startOffset=0,this.endContainer=t,this.endOffset=0,this.document=t,E(this)}var N=t.dom,M=t.util,R=N.DomPosition,L=t.DOMException,F=N.isCharacterDataNode,$=N.getNodeIndex,B=N.isOrIsAncestorOf,z=N.getDocument,U=N.comparePoints,q=N.splitDataNode,W=N.getClosestAncestorIn,H=N.getNodeLength,J=N.arrayContains,V=N.getRootContainer,G=t.features.crashyTextNodes;d.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var t=this._current=this._next;return t&&(this._next=t!==this._last?t.nextSibling:null,F(t)&&this.clonePartiallySelectedTextNodes&&(t===this.ec&&(t=t.cloneNode(!0)).deleteData(this.eo,t.length-this.eo),this._current===this.sc&&(t=t.cloneNode(!0)).deleteData(0,this.so))),t},remove:function(){var t,e,n=this._current;!F(n)||n!==this.sc&&n!==this.ec?n.parentNode&&n.parentNode.removeChild(n):(t=n===this.sc?this.so:0)!=(e=n===this.ec?this.eo:n.length)&&n.deleteData(t,e-t)},isPartiallySelectedSubtree:function(){return e(this._current,this.range)},getSubtreeIterator:function(){var t;if(this.isSingleCharacterDataNode)(t=this.range.cloneRange()).collapse(!1);else{t=new O(n(this.range));var e=this._current,i=e,s=0,r=e,o=H(e);B(e,this.sc)&&(i=this.sc,s=this.so),B(e,this.ec)&&(r=this.ec,o=this.eo),I(t,i,s,r,o)}return new d(t,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var K=[1,3,4,5,7,8,10],Y=[2,9,11],X=[5,6,10,12],Z=[1,3,4,5,7,8,10,11],Q=[1,3,4,5,7,8],tt=f([9,11]),et=f(X),nt=f([6,10,12]),it=document.createElement("style"),st=!1;try{it.innerHTML="<b>x</b>",st=3==it.firstChild.nodeType}catch(t){}t.features.htmlParsingConforms=st;var rt=st?function(t){var e=this.startContainer,n=z(e);if(!e)throw new L("INVALID_STATE_ERR");var i=null;return 1==e.nodeType?i=e:F(e)&&(i=N.parentElement(e)),(i=null===i||"HTML"==i.nodeName&&N.isHtmlNamespace(z(i).documentElement)&&N.isHtmlNamespace(i)?n.createElement("body"):i.cloneNode(!1)).innerHTML=t,N.fragmentFromNodeChildren(i)}:function(t){var e=n(this).createElement("body");return e.innerHTML=t,N.fragmentFromNodeChildren(e)},ot=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],at=0,lt=1,ct=2,ut=3,pt=0,ht=1,dt=2,ft=3;M.extend(t.rangePrototype,{compareBoundaryPoints:function(t,e){C(this),y(this.startContainer,e.startContainer);var n,i,s,r,o=t==ut||t==at?"start":"end",a=t==lt||t==at?"start":"end";return n=this[o+"Container"],i=this[o+"Offset"],s=e[a+"Container"],r=e[a+"Offset"],U(n,i,s,r)},insertNode:function(t){if(C(this),g(t,Z),b(this.startContainer),B(t,this.startContainer))throw new L("HIERARCHY_REQUEST_ERR");var e=r(t,this.startContainer,this.startOffset);this.setStartBefore(e)},cloneContents:function(){var t,e;if(C(this),this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&F(this.startContainer))return(t=this.startContainer.cloneNode(!0)).data=t.data.slice(this.startOffset,this.endOffset),(e=n(this).createDocumentFragment()).appendChild(t),e;var i=new d(this,!0);return t=a(i),i.detach(),t},canSurroundContents:function(){C(this),b(this.startContainer),b(this.endContainer);var t=new d(this,!0),n=t._first&&e(t._first,this)||t._last&&e(t._last,this);return t.detach(),!n},surroundContents:function(t){if(g(t,Q),!this.canSurroundContents())throw new L("INVALID_STATE_ERR");var e=this.extractContents();if(t.hasChildNodes())for(;t.lastChild;)t.removeChild(t.lastChild);r(t,this.startContainer,this.startOffset),t.appendChild(e),this.selectNode(t)},cloneRange:function(){C(this);for(var t,e=new O(n(this)),i=ot.length;i--;)e[t=ot[i]]=this[t];return e},toString:function(){C(this);var t=this.startContainer;if(t===this.endContainer&&F(t))return 3==t.nodeType||4==t.nodeType?t.data.slice(this.startOffset,this.endOffset):"";var e=[],n=new d(this,!0);return l(n,(function(t){(3==t.nodeType||4==t.nodeType)&&e.push(t.data)})),n.detach(),e.join("")},compareNode:function(t){C(this);var e=t.parentNode,n=$(t);if(!e)throw new L("NOT_FOUND_ERR");var i=this.comparePoint(e,n),s=this.comparePoint(e,n+1);return 0>i?s>0?dt:pt:s>0?ht:ft},comparePoint:function(t,e){return C(this),_(t,"HIERARCHY_REQUEST_ERR"),y(t,this.startContainer),U(t,e,this.startContainer,this.startOffset)<0?-1:U(t,e,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:rt,toHtml:function(){return S(this)},intersectsNode:function(t,e){if(C(this),_(t,"NOT_FOUND_ERR"),z(t)!==n(this))return!1;var i=t.parentNode,s=$(t);_(i,"NOT_FOUND_ERR");var r=U(i,s,this.endContainer,this.endOffset),o=U(i,s+1,this.startContainer,this.startOffset);return e?0>=r&&o>=0:0>r&&o>0},isPointInRange:function(t,e){return C(this),_(t,"HIERARCHY_REQUEST_ERR"),y(t,this.startContainer),U(t,e,this.startContainer,this.startOffset)>=0&&U(t,e,this.endContainer,this.endOffset)<=0},intersectsRange:function(t){return o(this,t,!1)},intersectsOrTouchesRange:function(t){return o(this,t,!0)},intersection:function(t){if(this.intersectsRange(t)){var e=U(this.startContainer,this.startOffset,t.startContainer,t.startOffset),n=U(this.endContainer,this.endOffset,t.endContainer,t.endOffset),i=this.cloneRange();return-1==e&&i.setStart(t.startContainer,t.startOffset),1==n&&i.setEnd(t.endContainer,t.endOffset),i}return null},union:function(t){if(this.intersectsOrTouchesRange(t)){var e=this.cloneRange();return-1==U(t.startContainer,t.startOffset,this.startContainer,this.startOffset)&&e.setStart(t.startContainer,t.startOffset),1==U(t.endContainer,t.endOffset,this.endContainer,this.endOffset)&&e.setEnd(t.endContainer,t.endOffset),e}throw new L("Ranges do not intersect")},containsNode:function(t,e){return e?this.intersectsNode(t,!1):this.compareNode(t)==ft},containsNodeContents:function(t){return this.comparePoint(t,0)>=0&&this.comparePoint(t,H(t))<=0},containsRange:function(t){var e=this.intersection(t);return null!==e&&t.equals(e)},containsNodeText:function(t){var e=this.cloneRange();e.selectNode(t);var n=e.getNodes([3]);if(n.length>0){e.setStart(n[0],0);var i=n.pop();return e.setEnd(i,i.length),this.containsRange(e)}return this.containsNodeContents(t)},getNodes:function(t,e){return C(this),p(this,t,e)},getDocument:function(){return n(this)},collapseBefore:function(t){this.setEndBefore(t),this.collapse(!1)},collapseAfter:function(t){this.setStartAfter(t),this.collapse(!0)},getBookmark:function(e){var i=n(this),s=t.createRange(i);e=e||N.getBody(i),s.selectNodeContents(e);var r=this.intersection(s),o=0,a=0;return r&&(s.setEnd(r.startContainer,r.startOffset),a=(o=s.toString().length)+r.toString().length),{start:o,end:a,containerNode:e}},moveToBookmark:function(t){var e=t.containerNode,n=0;this.setStart(e,0),this.collapse(!0);for(var i,s,r,o,a=[e],l=!1,c=!1;!c&&(i=a.pop());)if(3==i.nodeType)s=n+i.length,!l&&t.start>=n&&t.start<=s&&(this.setStart(i,t.start-n),l=!0),l&&t.end>=n&&t.end<=s&&(this.setEnd(i,t.end-n),c=!0),n=s;else for(r=(o=i.childNodes).length;r--;)a.push(o[r])},getName:function(){return"DomRange"},equals:function(t){return O.rangesEqual(this,t)},isValid:function(){return A(this)},inspect:function(){return h(this)},detach:function(){}}),P(O,I),M.extend(O,{rangeProperties:ot,RangeIterator:d,copyComparisonConstants:j,createPrototypeRange:P,inspect:h,toHtml:S,getRangeDocument:n,rangesEqual:function(t,e){return t.startContainer===e.startContainer&&t.startOffset===e.startOffset&&t.endContainer===e.endContainer&&t.endOffset===e.endOffset}}),t.DomRange=O})),O.createCoreModule("WrappedRange",["DomRange"],(function(t,e){var n,i,s=t.dom,r=t.util,o=s.DomPosition,a=t.DomRange,l=s.getBody,c=s.getContentDocument,u=s.isCharacterDataNode;if(t.features.implementsDomRange&&function(){function i(t){for(var e,n=h.length;n--;)t[e=h[n]]=t.nativeRange[e];t.collapsed=t.startContainer===t.endContainer&&t.startOffset===t.endOffset}function o(t,e,n,i,s){var r=t.startContainer!==e||t.startOffset!=n,o=t.endContainer!==i||t.endOffset!=s,a=!t.equals(t.nativeRange);(r||o||a)&&(t.setEnd(i,s),t.setStart(e,n))}var u,p,h=a.rangeProperties;n=function(t){if(!t)throw e.createError("WrappedRange: Range must be specified");this.nativeRange=t,i(this)},a.createPrototypeRange(n,o),(u=n.prototype).selectNode=function(t){this.nativeRange.selectNode(t),i(this)},u.cloneContents=function(){return this.nativeRange.cloneContents()},u.surroundContents=function(t){this.nativeRange.surroundContents(t),i(this)},u.collapse=function(t){this.nativeRange.collapse(t),i(this)},u.cloneRange=function(){return new n(this.nativeRange.cloneRange())},u.refresh=function(){i(this)},u.toString=function(){return this.nativeRange.toString()};var d=document.createTextNode("test");l(document).appendChild(d);var f=document.createRange();f.setStart(d,0),f.setEnd(d,0);try{f.setStart(d,1),u.setStart=function(t,e){this.nativeRange.setStart(t,e),i(this)},u.setEnd=function(t,e){this.nativeRange.setEnd(t,e),i(this)},p=function(t){return function(e){this.nativeRange[t](e),i(this)}}}catch(t){u.setStart=function(t,e){try{this.nativeRange.setStart(t,e)}catch(n){this.nativeRange.setEnd(t,e),this.nativeRange.setStart(t,e)}i(this)},u.setEnd=function(t,e){try{this.nativeRange.setEnd(t,e)}catch(n){this.nativeRange.setStart(t,e),this.nativeRange.setEnd(t,e)}i(this)},p=function(t,e){return function(n){try{this.nativeRange[t](n)}catch(i){this.nativeRange[e](n),this.nativeRange[t](n)}i(this)}}}u.setStartBefore=p("setStartBefore","setEndBefore"),u.setStartAfter=p("setStartAfter","setEndAfter"),u.setEndBefore=p("setEndBefore","setStartBefore"),u.setEndAfter=p("setEndAfter","setStartAfter"),u.selectNodeContents=function(t){this.setStartAndEnd(t,0,s.getNodeLength(t))},f.selectNodeContents(d),f.setEnd(d,3);var m=document.createRange();m.selectNodeContents(d),m.setEnd(d,4),m.setStart(d,2),u.compareBoundaryPoints=-1==f.compareBoundaryPoints(f.START_TO_END,m)&&1==f.compareBoundaryPoints(f.END_TO_START,m)?function(t,e){return t==(e=e.nativeRange||e).START_TO_END?t=e.END_TO_START:t==e.END_TO_START&&(t=e.START_TO_END),this.nativeRange.compareBoundaryPoints(t,e)}:function(t,e){return this.nativeRange.compareBoundaryPoints(t,e.nativeRange||e)};var g=document.createElement("div");g.innerHTML="123";var v=g.firstChild,y=l(document);y.appendChild(g),f.setStart(v,1),f.setEnd(v,2),f.deleteContents(),"13"==v.data&&(u.deleteContents=function(){this.nativeRange.deleteContents(),i(this)},u.extractContents=function(){var t=this.nativeRange.extractContents();return i(this),t}),y.removeChild(g),y=null,r.isHostMethod(f,"createContextualFragment")&&(u.createContextualFragment=function(t){return this.nativeRange.createContextualFragment(t)}),l(document).removeChild(d),u.getName=function(){return"WrappedRange"},t.WrappedRange=n,t.createNativeRange=function(t){return(t=c(t,e,"createNativeRange")).createRange()}}(),t.features.implementsTextRange){var p=function(t){var e=t.parentElement(),n=t.duplicate();n.collapse(!0);var i=n.parentElement();(n=t.duplicate()).collapse(!1)
;var r=n.parentElement(),o=i==r?i:s.getCommonAncestor(i,r);return o==e?o:s.getCommonAncestor(e,o)},h=function(t){return 0==t.compareEndPoints("StartToEnd",t)},d=function(t,e,n,i,r){var a=t.duplicate();a.collapse(n);var l=a.parentElement();if(s.isOrIsAncestorOf(e,l)||(l=e),!l.canHaveHTML){var c=new o(l.parentNode,s.getNodeIndex(l));return{boundaryPosition:c,nodeInfo:{nodeIndex:c.offset,containerElement:c.node}}}var p=s.getDocument(l).createElement("span");p.parentNode&&p.parentNode.removeChild(p);for(var h,d,f,m,g,v=n?"StartToStart":"StartToEnd",y=r&&r.containerElement==l?r.nodeIndex:0,b=l.childNodes.length,_=b,w=_;w==b?l.appendChild(p):l.insertBefore(p,l.childNodes[w]),a.moveToElementText(p),0!=(h=a.compareEndPoints(v,t))&&y!=_;){if(-1==h){if(_==y+1)break;y=w}else _=_==y+1?y:w;w=Math.floor((y+_)/2),l.removeChild(p)}if(g=p.nextSibling,-1==h&&g&&u(g)){var k;if(a.setEndPoint(n?"EndToStart":"EndToEnd",t),/[\r\n]/.test(g.data)){var A=a.duplicate(),C=A.text.replace(/\r\n/g,"\r").length;for(k=A.moveStart("character",C);-1==(h=A.compareEndPoints("StartToEnd",A));)k++,A.moveStart("character",1)}else k=a.text.length;m=new o(g,k)}else d=(i||!n)&&p.previousSibling,m=(f=(i||n)&&p.nextSibling)&&u(f)?new o(f,0):d&&u(d)?new o(d,d.data.length):new o(l,s.getNodeIndex(p));return p.parentNode.removeChild(p),{boundaryPosition:m,nodeInfo:{nodeIndex:w,containerElement:l}}},f=function(t,e){var n,i,r,o,a=t.offset,c=s.getDocument(t.node),p=l(c).createTextRange(),h=u(t.node);return h?i=(n=t.node).parentNode:(n=a<(o=t.node.childNodes).length?o[a]:null,i=t.node),(r=c.createElement("span")).innerHTML="&#feff;",n?i.insertBefore(r,n):i.appendChild(r),p.moveToElementText(r),p.collapse(!e),i.removeChild(r),h&&p[e?"moveStart":"moveEnd"]("character",a),p};i=function(t){this.textRange=t,this.refresh()},i.prototype=new a(document),i.prototype.refresh=function(){var t,e,n,i=p(this.textRange);h(this.textRange)?e=t=d(this.textRange,i,!0,!0).boundaryPosition:(t=(n=d(this.textRange,i,!0,!1)).boundaryPosition,e=d(this.textRange,i,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(t.node,t.offset),this.setEnd(e.node,e.offset)},i.prototype.getName=function(){return"WrappedTextRange"},a.copyComparisonConstants(i);var m=function(t){if(t.collapsed)return f(new o(t.startContainer,t.startOffset),!0);var e=f(new o(t.startContainer,t.startOffset),!0),n=f(new o(t.endContainer,t.endOffset),!1),i=l(a.getRangeDocument(t)).createTextRange();return i.setEndPoint("StartToStart",e),i.setEndPoint("EndToEnd",n),i};if(i.rangeToTextRange=m,i.prototype.toTextRange=function(){return m(this)},t.WrappedTextRange=i,!t.features.implementsDomRange||t.config.preferTextRange){var g=Function("return this;")();void 0===g.Range&&(g.Range=i),t.createNativeRange=function(t){return t=c(t,e,"createNativeRange"),l(t).createTextRange()},t.WrappedRange=i}}t.createRange=function(n){return n=c(n,e,"createRange"),new t.WrappedRange(t.createNativeRange(n))},t.createRangyRange=function(t){return t=c(t,e,"createRangyRange"),new a(t)},t.createIframeRange=function(n){return e.deprecationNotice("createIframeRange()","createRange(iframeEl)"),t.createRange(n)},t.createIframeRangyRange=function(n){return e.deprecationNotice("createIframeRangyRange()","createRangyRange(iframeEl)"),t.createRangyRange(n)},t.addShimListener((function(e){var n=e.document;void 0===n.createRange&&(n.createRange=function(){return t.createRange(n)}),n=e=null}))})),O.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(t,e){function n(t){return"string"==typeof t?/^backward(s)?$/i.test(t):!!t}function i(t,n){if(t){if(j.isWindow(t))return t;if(t instanceof v)return t.win;var i=j.getContentDocument(t,e,n);return j.getWindow(i)}return window}function s(t){return i(t,"getWinSelection").getSelection()}function r(t){return i(t,"getDocSelection").document.selection}function o(t){var e=!1;return t.anchorNode&&(e=1==j.comparePoints(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)),e}function a(t,e,n){var i=n?"end":"start",s=n?"start":"end";t.anchorNode=e[i+"Container"],t.anchorOffset=e[i+"Offset"],t.focusNode=e[s+"Container"],t.focusOffset=e[s+"Offset"]}function l(t){var e=t.nativeSelection;t.anchorNode=e.anchorNode,t.anchorOffset=e.anchorOffset,t.focusNode=e.focusNode,t.focusOffset=e.focusOffset}function c(t){t.anchorNode=t.focusNode=null,t.anchorOffset=t.focusOffset=0,t.rangeCount=0,t.isCollapsed=!0,t._ranges.length=0}function u(e){var n;return e instanceof E?((n=t.createNativeRange(e.getDocument())).setEnd(e.endContainer,e.endOffset),n.setStart(e.startContainer,e.startOffset)):e instanceof I?n=e.nativeRange:M.implementsDomRange&&e instanceof j.getWindow(e.startContainer).Range&&(n=e),n}function p(t){if(!t.length||1!=t[0].nodeType)return!1;for(var e=1,n=t.length;n>e;++e)if(!j.isAncestorOf(t[0],t[e]))return!1;return!0}function h(t){var n=t.getNodes();if(!p(n))throw e.createError("getSingleElementFromRange: range "+t.inspect()+" did not consist of a single element");return n[0]}function d(t){return!!t&&void 0!==t.text}function f(t,e){var n=new I(e);t._ranges=[n],a(t,n,!1),t.rangeCount=1,t.isCollapsed=n.collapsed}function m(e){if(e._ranges.length=0,"None"==e.docSelection.type)c(e);else{var n=e.docSelection.createRange();if(d(n))f(e,n);else{e.rangeCount=n.length;for(var i,s=L(n.item(0)),r=0;r<e.rangeCount;++r)(i=t.createRange(s)).selectNode(n.item(r)),e._ranges.push(i);e.isCollapsed=1==e.rangeCount&&e._ranges[0].collapsed,a(e,e._ranges[e.rangeCount-1],!1)}}}function g(t,n){for(var i=t.docSelection.createRange(),s=h(n),r=L(i.item(0)),o=F(r).createControlRange(),a=0,l=i.length;l>a;++a)o.add(i.item(a));try{o.add(s)}catch(t){throw e.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}o.select(),m(t)}function v(t,e,n){this.nativeSelection=t,this.docSelection=e,this._ranges=[],this.win=n,this.refresh()}function y(t){t.win=t.anchorNode=t.focusNode=t._ranges=null,t.rangeCount=t.anchorOffset=t.focusOffset=0,t.detached=!0}function b(t,e){for(var n,i,s=et.length;s--;)if(i=(n=et[s]).selection,"deleteAll"==e)y(i);else if(n.win==t)return"delete"==e?(et.splice(s,1),!0):i;return"deleteAll"==e&&(et.length=0),null}function _(t,n){for(var i,s=L(n[0].startContainer),r=F(s).createControlRange(),o=0,a=n.length;a>o;++o){i=h(n[o]);try{r.add(i)}catch(t){throw e.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),m(t)}function w(t,e){if(t.win.document!=L(e))throw new O("WRONG_DOCUMENT_ERR")}function k(e){return function(n,i){var s;this.rangeCount?(s=this.getRangeAt(0))["set"+(e?"Start":"End")](n,i):(s=t.createRange(this.win.document)).setStartAndEnd(n,i),this.setSingleRange(s,this.isBackward())}}function A(t){var e=[],n=new N(t.anchorNode,t.anchorOffset),i=new N(t.focusNode,t.focusOffset),s="function"==typeof t.getName?t.getName():"Selection";if(void 0!==t.rangeCount)for(var r=0,o=t.rangeCount;o>r;++r)e[r]=E.inspect(t.getRangeAt(r));return"["+s+"(Ranges: "+e.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}t.config.checkSelectionRanges=!0;var C,T,S="boolean",x="number",j=t.dom,D=t.util,P=D.isHostMethod,E=t.DomRange,I=t.WrappedRange,O=t.DOMException,N=j.DomPosition,M=t.features,R="Control",L=j.getDocument,F=j.getBody,$=E.rangesEqual,B=P(window,"getSelection"),z=D.isHostObject(document,"selection");M.implementsWinGetSelection=B,M.implementsDocSelection=z;var U=z&&(!B||t.config.preferTextRange);U?(C=r,t.isSelectionValid=function(t){var e=i(t,"isSelectionValid").document,n=e.selection;return"None"!=n.type||L(n.createRange().parentElement())==e}):B?(C=s,t.isSelectionValid=function(){return!0}):e.fail("Neither document.selection or window.getSelection() detected."),t.getNativeSelection=C;var q=C(),W=t.createNativeRange(document),H=F(document),J=D.areHostProperties(q,["anchorNode","focusNode","anchorOffset","focusOffset"]);M.selectionHasAnchorAndFocus=J;var V=P(q,"extend");M.selectionHasExtend=V;var G=typeof q.rangeCount==x;M.selectionHasRangeCount=G;var K=!1,Y=!0,X=V?function(e,n){var i=E.getRangeDocument(n),s=t.createRange(i);s.collapseToPoint(n.endContainer,n.endOffset),e.addRange(u(s)),e.extend(n.startContainer,n.startOffset)}:null;D.areHostMethods(q,["addRange","getRangeAt","removeAllRanges"])&&typeof q.rangeCount==x&&M.implementsDomRange&&function(){var e=window.getSelection();if(e){for(var n=e.rangeCount,i=n>1,s=[],r=o(e),a=0;n>a;++a)s[a]=e.getRangeAt(a);var l=F(document),c=l.appendChild(document.createElement("div"));c.contentEditable="false";var u=c.appendChild(document.createTextNode("\xa0\xa0\xa0")),p=document.createRange();if(p.setStart(u,1),p.collapse(!0),e.addRange(p),Y=1==e.rangeCount,e.removeAllRanges(),!i){var h=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(h&&parseInt(h[1])>=36)K=!1;else{var d=p.cloneRange();p.setStart(u,0),d.setEnd(u,3),d.setStart(u,2),e.addRange(p),e.addRange(d),K=2==e.rangeCount}}for(l.removeChild(c),e.removeAllRanges(),a=0;n>a;++a)0==a&&r?X?X(e,s[a]):(t.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),e.addRange(s[a])):e.addRange(s[a])}}(),M.selectionSupportsMultipleRanges=K,M.collapsedNonEditableSelectionsSupported=Y;var Z,Q,tt=!1;H&&P(H,"createControlRange")&&(Z=H.createControlRange(),D.areHostProperties(Z,["item","add"])&&(tt=!0)),M.implementsControlRange=tt,T=J?function(t){return t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset}:function(t){return!!t.rangeCount&&t.getRangeAt(t.rangeCount-1).collapsed},P(q,"getRangeAt")?Q=function(t,e){try{return t.getRangeAt(e)}catch(t){return null}}:J&&(Q=function(e){var n=L(e.anchorNode),i=t.createRange(n);return i.setStartAndEnd(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset),i.collapsed!==this.isCollapsed&&i.setStartAndEnd(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset),i}),v.prototype=t.selectionPrototype;var et=[],nt=function(t){if(t&&t instanceof v)return t.refresh(),t;var e=b(t=i(t,"getNativeSelection")),n=C(t),s=z?r(t):null;return e?(e.nativeSelection=n,e.docSelection=s,e.refresh()):(e=new v(n,s,t),et.push({win:t,selection:e})),e};t.getSelection=nt,t.getIframeSelection=function(n){return e.deprecationNotice("getIframeSelection()","getSelection(iframeEl)"),t.getSelection(j.getIframeWindow(n))};var it,st=v.prototype;if(!U&&J&&D.areHostMethods(q,["removeAllRanges","addRange"])){st.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),c(this)};var rt=function(t,e){X(t.nativeSelection,e),t.refresh()};st.addRange=G?function(e,i){if(tt&&z&&this.docSelection.type==R)g(this,e);else if(n(i)&&V)rt(this,e);else{var s;K?s=this.rangeCount:(this.removeAllRanges(),s=0);var r=u(e).cloneRange();try{this.nativeSelection.addRange(r)}catch(t){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==s+1){if(t.config.checkSelectionRanges){var o=Q(this.nativeSelection,this.rangeCount-1);o&&!$(o,e)&&(e=new I(o))}this._ranges[this.rangeCount-1]=e,a(this,e,ot(this.nativeSelection)),this.isCollapsed=T(this)}else this.refresh()}}:function(t,e){n(e)&&V?rt(this,t):(this.nativeSelection.addRange(u(t)),this.refresh())},st.setRanges=function(t){if(tt&&z&&t.length>1)_(this,t);else{this.removeAllRanges();for(var e=0,n=t.length;n>e;++e)this.addRange(t[e])}}}else{if(!(P(q,"empty")&&P(W,"select")&&tt&&U))return e.fail("No means of selecting a Range or TextRange was found"),!1;st.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var t;if(this.anchorNode)t=L(this.anchorNode);else if(this.docSelection.type==R){var e=this.docSelection.createRange();e.length&&(t=L(e.item(0)))}if(t)F(t).createTextRange().select(),this.docSelection.empty()}}catch(t){}c(this)},st.addRange=function(e){this.docSelection.type==R?g(this,e):(t.WrappedTextRange.rangeToTextRange(e).select(),this._ranges[0]=e,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,a(this,e,!1))},st.setRanges=function(t){this.removeAllRanges();var e=t.length;e>1?_(this,t):e&&this.addRange(t[0])}}if(st.getRangeAt=function(t){if(0>t||t>=this.rangeCount)throw new O("INDEX_SIZE_ERR");return this._ranges[t].cloneRange()},U)it=function(e){var n;t.isSelectionValid(e.win)?n=e.docSelection.createRange():(n=F(e.win.document).createTextRange()).collapse(!0),e.docSelection.type==R?m(e):d(n)?f(e,n):c(e)};else if(P(q,"getRangeAt")&&typeof q.rangeCount==x)it=function(e){if(tt&&z&&e.docSelection.type==R)m(e);else if(e._ranges.length=e.rangeCount=e.nativeSelection.rangeCount,e.rangeCount){for(var n=0,i=e.rangeCount;i>n;++n)e._ranges[n]=new t.WrappedRange(e.nativeSelection.getRangeAt(n));a(e,e._ranges[e.rangeCount-1],ot(e.nativeSelection)),e.isCollapsed=T(e)}else c(e)};else{if(!J||typeof q.isCollapsed!=S||typeof W.collapsed!=S||!M.implementsDomRange)return e.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;it=function(t){var e,n=t.nativeSelection;n.anchorNode?(e=Q(n,0),t._ranges=[e],t.rangeCount=1,l(t),t.isCollapsed=T(t)):c(t)}}st.refresh=function(t){var e=t?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if(it(this),t){var s=e.length;if(s!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;s--;)if(!$(e[s],this._ranges[s]))return!0;return!1}};var ot,at=function(t,e){var n=t.getAllRanges();t.removeAllRanges();for(var i=0,s=n.length;s>i;++i)$(e,n[i])||t.addRange(n[i]);t.rangeCount||c(t)};st.removeRange=tt&&z?function(t){if(this.docSelection.type==R){for(var e=this.docSelection.createRange(),n=h(t),i=L(e.item(0)),s=F(i).createControlRange(),r=!1,o=0,a=e.length;a>o;++o)e.item(o)!==n||r?s.add(e.item(o)):r=!0;s.select(),m(this)}else at(this,t)}:function(t){at(this,t)},!U&&J&&M.implementsDomRange?(ot=o,st.isBackward=function(){return ot(this)}):ot=st.isBackward=function(){return!1},st.isBackwards=st.isBackward,st.toString=function(){for(var t=[],e=0,n=this.rangeCount;n>e;++e)t[e]=""+this._ranges[e];return t.join("")},st.collapse=function(e,n){w(this,e);var i=t.createRange(e);i.collapseToPoint(e,n),this.setSingleRange(i),this.isCollapsed=!0},st.collapseToStart=function(){if(!this.rangeCount)throw new O("INVALID_STATE_ERR");var t=this._ranges[0];this.collapse(t.startContainer,t.startOffset)},st.collapseToEnd=function(){if(!this.rangeCount)throw new O("INVALID_STATE_ERR");var t=this._ranges[this.rangeCount-1];this.collapse(t.endContainer,t.endOffset)},st.selectAllChildren=function(e){w(this,e);var n=t.createRange(e);n.selectNodeContents(e),this.setSingleRange(n)},st.deleteFromDocument=function(){if(tt&&z&&this.docSelection.type==R){for(var t,e=this.docSelection.createRange();e.length;)t=e.item(0),e.remove(t),t.parentNode.removeChild(t);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var i=0,s=n.length;s>i;++i)n[i].deleteContents();this.addRange(n[s-1])}}},st.eachRange=function(t,e){for(var n=0,i=this._ranges.length;i>n;++n)if(t(this.getRangeAt(n)))return e},st.getAllRanges=function(){var t=[];return this.eachRange((function(e){t.push(e)})),t},st.setSingleRange=function(t,e){this.removeAllRanges(),this.addRange(t,e)},st.callMethodOnEachRange=function(t,e){var n=[];return this.eachRange((function(i){n.push(i[t].apply(i,e))})),n},st.setStart=k(!0),st.setEnd=k(!1),t.rangePrototype.select=function(t){nt(this.getDocument()).setSingleRange(this,t)},st.changeEachRange=function(t){var e=[],n=this.isBackward();this.eachRange((function(n){t(n),e.push(n)})),this.removeAllRanges(),n&&1==e.length?this.addRange(e[0],"backward"):this.setRanges(e)},st.containsNode=function(t,e){return this.eachRange((function(n){return n.containsNode(t,e)}),!0)||!1},st.getBookmark=function(t){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[t])}},st.moveToBookmark=function(e){for(var n,i,s=[],r=0;n=e.rangeBookmarks[r++];)(i=t.createRange(this.win)).moveToBookmark(n),s.push(i);e.backward?this.setSingleRange(s[0],"backward"):this.setRanges(s)},st.toHtml=function(){var t=[];return this.eachRange((function(e){t.push(E.toHtml(e))})),t.join("")},M.implementsTextRange&&(st.getNativeTextRange=function(){var n;if(n=this.docSelection){var i=n.createRange();if(d(i))return i;throw e.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return t.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw e.createError("getNativeTextRange: selection contains no range")}),st.getName=function(){return"WrappedSelection"},st.inspect=function(){return A(this)},st.detach=function(){b(this.win,"delete"),y(this)},v.detachAll=function(){b(null,"deleteAll")},v.inspect=A,v.isDirectionBackward=n,t.Selection=v,t.selectionPrototype=st,t.addShimListener((function(t){void 0===t.getSelection&&(t.getSelection=function(){return nt(t)}),t=null}))}));var R=!1,L=function(){R||(R=!0,!O.initialized&&O.config.autoInitialize&&p())};return E&&("complete"==document.readyState?L():(t(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",L,!1),y(window,"load",L))),O}),this),function(t,e){"function"==typeof define&&define.amd?define(["./rangy-core"],t):void 0!==module&&"object"==typeof exports?module.exports=t(require("rangy")):t(e.rangy)}((function(t){return t.createModule("ClassApplier",["WrappedSelection"],(function(t,e){function n(t,e){for(var n in t)if(t.hasOwnProperty(n)&&!1===e(n,t[n]))return!1;return!0}function s(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function r(t){return t&&t.split(/\s+/).sort().join(" ")}function o(t){return r(t.className)}function a(t,e){return o(t)==o(e)}function l(t,e){for(var n=e.split(/\s+/),i=0,r=n.length;r>i;++i)if(!I(t,s(n[i])))return!1;return!0}function c(t,e,n,i,s){var r=t.node,o=t.offset,a=r,l=o;r==i&&o>s&&++l,r!=e||o!=n&&o!=n+1||(a=i,l+=s-n),r==e&&o>n+1&&--l,t.node=a,t.offset=l}function u(t,e,n){t.node==e&&t.offset>n&&--t.offset}function p(t,e,n,i){-1==n&&(n=e.childNodes.length);var s=t.parentNode,r=M.getNodeIndex(t);$(i,(function(t){c(t,s,r,e,n)})),e.childNodes.length==n?e.appendChild(t):e.insertBefore(t,e.childNodes[n])}function h(t,e){var n=t.parentNode,i=M.getNodeIndex(t);$(e,(function(t){u(t,n,i)})),t.parentNode.removeChild(t)}function d(t,e,n,i,s){for(var r,o=[];r=t.firstChild;)p(r,e,n++,s),o.push(r);return i&&h(t,s),o}function f(t,e){return d(t,t.parentNode,M.getNodeIndex(t),!0,e)}function m(t,e){var n=t.cloneRange();n.selectNodeContents(e);var i=n.intersection(t);return""!=(i?i.toString():"")}function g(t){for(var e,n=t.getNodes([3]),i=0;(e=n[i])&&!m(t,e);)++i;for(var s=n.length-1;(e=n[s])&&!m(t,e);)--s;return n.slice(i,s+1)}function v(t,e){if(t.attributes.length!=e.attributes.length)return!1;for(var n,i,s,r=0,o=t.attributes.length;o>r;++r)if("class"!=(s=(n=t.attributes[r]).name)){if(null===n!=(null===(i=e.attributes.getNamedItem(s))))return!1;if(n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function y(t,e){for(var n,i=0,s=t.attributes.length;s>i;++i)if(n=t.attributes[i].name,(!e||!L(e,n))&&t.attributes[i].specified&&"class"!=n)return!0;return!1}function b(t){var e;return t&&1==t.nodeType&&((e=t.parentNode)&&9==e.nodeType&&"on"==e.designMode||U(t)&&!U(t.parentNode))}function _(t){return(U(t)||1!=t.nodeType&&U(t.parentNode))&&!b(t)}function w(t){return t&&1==t.nodeType&&!q.test(z(t,"display"))}function k(t){if(0==t.data.length)return!0;if(W.test(t.data))return!1;switch(z(t.parentNode,"whiteSpace")){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(t.data))return!1}return w(t.previousSibling)||w(t.nextSibling)}function A(t){var e,n,i=[];for(e=0;n=t[e++];)i.push(new R(n.startContainer,n.startOffset),new R(n.endContainer,n.endOffset));return i}function C(t,e){for(var n,i,s,r=0,o=t.length;o>r;++r)n=t[r],i=e[2*r],s=e[2*r+1],n.setStartAndEnd(i.node,i.offset,s.node,s.offset)}function T(t,e){return M.isCharacterDataNode(t)?0==e?!!t.previousSibling:e!=t.length||!!t.nextSibling:e>0&&e<t.childNodes.length}function S(t,n,i,s){var r,o,a=0==i;if(M.isAncestorOf(n,t))return t;if(M.isCharacterDataNode(n)){var l=M.getNodeIndex(n);if(0==i)i=l;else{if(i!=n.length)throw e.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+i+" in "+n.data);i=l+1}n=n.parentNode}if(T(n,i)){r=n.cloneNode(!1),o=n.parentNode,r.id&&r.removeAttribute("id");for(var c,u=0;c=n.childNodes[i];)p(c,r,u++,s);return p(r,o,M.getNodeIndex(n)+1,s),n==t?r:S(t,o,M.getNodeIndex(r),s)}if(t!=n){r=n.parentNode;var h=M.getNodeIndex(n);return a||h++,S(t,r,h,s)}return t}function x(t,e){return t.namespaceURI==e.namespaceURI&&t.tagName.toLowerCase()==e.tagName.toLowerCase()&&a(t,e)&&v(t,e)&&"inline"==z(t,"display")&&"inline"==z(e,"display")}function j(t){var e=t?"nextSibling":"previousSibling";return function(n,i){var s=n.parentNode,r=n[e];if(r){if(r&&3==r.nodeType)return r}else if(i&&((r=s[e])&&1==r.nodeType&&x(s,r))){var o=r[t?"firstChild":"lastChild"];if(o&&3==o.nodeType)return o}return null}}function D(t){this.isElementMerge=1==t.nodeType,this.textNodes=[];var e=this.isElementMerge?t.lastChild:t;e&&(this.textNodes[0]=e)}function P(t,e,i){var o,a,l,c,u=this;u.cssClass=u.className=t;var p=null,h={};if("object"==typeof e&&null!==e){for(void 0!==e.elementTagName&&(e.elementTagName=e.elementTagName.toLowerCase()),i=e.tagNames,p=e.elementProperties,h=e.elementAttributes,a=0;c=V[a++];)e.hasOwnProperty(c)&&(u[c]=e[c]);o=e.normalize}else o=e;u.normalize=void 0===o||o,u.attrExceptions=[];var d=document.createElement(u.elementTagName);u.elementProperties=u.copyPropertiesToElement(p,d,!0),n(h,(function(t){u.attrExceptions.push(t)})),u.elementAttributes=h,u.elementSortedClassName=u.elementProperties.hasOwnProperty("className")?r(u.elementProperties.className+" "+t):t,u.applyToAnyTagName=!1;var f=typeof i;if("string"==f)"*"==i?u.applyToAnyTagName=!0:u.tagNames=s(i.toLowerCase()).split(/\s*,\s*/);else if("object"==f&&"number"==typeof i.length)for(u.tagNames=[],a=0,l=i.length;l>a;++a)"*"==i[a]?u.applyToAnyTagName=!0:u.tagNames.push(i[a].toLowerCase());else u.tagNames=[u.elementTagName]}function E(t,e,n){return new P(t,e,n)}var I,O,N,M=t.dom,R=M.DomPosition,L=M.arrayContains,F=M.isHtmlNamespace,$=t.util.forEach,B="span";t.util.isHostObject(document.createElement("div"),"classList")?(I=function(t,e){return t.classList.contains(e)},O=function(t,e){return t.classList.add(e)},N=function(t,e){return t.classList.remove(e)}):(I=function(t,e){return t.className&&new RegExp("(?:^|\\s)"+e+"(?:\\s|$)").test(t.className)},O=function(t,e){t.className?I(t,e)||(t.className+=" "+e):t.className=e},N=function(){function t(t,e,n){return e&&n?" ":""}return function(e,n){e.className&&(e.className=e.className.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),t))}}());var z=M.getComputedStyleProperty,U="boolean"==typeof document.createElement("div").isContentEditable?function(t){return t&&1==t.nodeType&&t.isContentEditable}:function(t){return!(!t||1!=t.nodeType||"false"==t.contentEditable)&&("true"==t.contentEditable||U(t.parentNode))},q=/^inline(-block|-table)?$/i,W=/[^\r\n\t\f \u200B]/,H=j(!1),J=j(!0);D.prototype={doMerge:function(t){var e=this.textNodes,n=e[0];if(e.length>1){var i,s=M.getNodeIndex(n),r=[],o=0;$(e,(function(e,a){i=e.parentNode,a>0&&(i.removeChild(e),i.hasChildNodes()||i.parentNode.removeChild(i),t&&$(t,(function(t){t.node==e&&(t.node=n,t.offset+=o),t.node==i&&t.offset>s&&(--t.offset,t.offset==s+1&&len-1>a&&(t.node=n,t.offset=o))}))),r[a]=e.data,o+=e.data.length})),n.data=r.join("")}return n.data},getLength:function(){for(var t=this.textNodes.length,e=0;t--;)e+=this.textNodes[t].length;return e},toString:function(){var t=[];return $(this.textNodes,(function(e,n){t[n]="'"+e.data+"'"})),"[Merge("+t.join(",")+")]"}};var V=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],G={};P.prototype={elementTagName:B,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(t,e,n){var i,s,o,a,l,c,u={};for(var p in t)if(t.hasOwnProperty(p))if(a=t[p],l=e[p],"className"==p)O(e,a),O(e,this.className),e[p]=r(e[p]),n&&(u[p]=a);else if("style"==p){for(i in s=l,n&&(u[p]=o={}),t[p])t[p].hasOwnProperty(i)&&(s[i]=a[i],n&&(o[i]=s[i]));this.attrExceptions.push(p)}else e[p]=a,n&&(u[p]=e[p],c=G.hasOwnProperty(p)?G[p]:p,this.attrExceptions.push(c));return n?u:""},copyAttributesToElement:function(t,e){for(var n in t)t.hasOwnProperty(n)&&!/^class(?:Name)?$/i.test(n)&&e.setAttribute(n,t[n])},appliesToElement:function(t){return L(this.tagNames,t.tagName.toLowerCase())},getEmptyElements:function(t){var e=this;return t.getNodes([1],(function(t){return e.appliesToElement(t)&&!t.hasChildNodes()}))},hasClass:function(t){return 1==t.nodeType&&(this.applyToAnyTagName||this.appliesToElement(t))&&I(t,this.className)},getSelfOrAncestorWithClass:function(t){for(;t;){if(this.hasClass(t))return t;t=t.parentNode}return null},isModifiable:function(t){return!this.applyToEditableOnly||_(t)},isIgnorableWhiteSpaceNode:function(t){return this.ignoreWhiteSpace&&t&&3==t.nodeType&&k(t)},postApply:function(t,e,n,s){var r,o,a=t[0],l=t[t.length-1],c=[],u=a,p=l,h=0,d=l.length;$(t,(function(t){(o=H(t,!s))?(r||(r=new D(o),c.push(r)),r.textNodes.push(t),t===a&&(u=r.textNodes[0],h=u.length),t===l&&(p=r.textNodes[0],d=r.getLength())):r=null}));var f=J(l,!s);if(f&&(r||(r=new D(l),c.push(r)),r.textNodes.push(f)),c.length){for(i=0,len=c.length;len>i;++i)c[i].doMerge(n);e.setStartAndEnd(u,h,p,d)}},createContainer:function(t){var e=t.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,e,!1),this.copyAttributesToElement(this.elementAttributes,e),O(e,this.className),this.onElementCreate&&this.onElementCreate(e,this),e},elementHasProperties:function(t,e){var i=this;return n(e,(function(e,n){if("className"==e)return l(t,n);if("object"==typeof n){if(!i.elementHasProperties(t[e],n))return!1}else if(t[e]!==n)return!1}))},elementHasAttributes:function(t,e){return n(e,(function(e,n){return t.getAttribute(e)===n&&void 0}))},applyToTextNode:function(t){var e=t.parentNode;if(1==e.childNodes.length&&this.useExistingElements&&F(e)&&this.appliesToElement(e)&&this.elementHasProperties(e,this.elementProperties)&&this.elementHasAttributes(e,this.elementAttributes))O(e,this.className);else{var n=this.createContainer(M.getDocument(t));t.parentNode.insertBefore(n,t),n.appendChild(t)}},isRemovable:function(t){return F(t)&&t.tagName.toLowerCase()==this.elementTagName&&o(t)==this.elementSortedClassName&&this.elementHasProperties(t,this.elementProperties)&&!y(t,this.attrExceptions)&&this.elementHasAttributes(t,this.elementAttributes)&&this.isModifiable(t)},isEmptyContainer:function(t){var e=t.childNodes.length;return 1==t.nodeType&&this.isRemovable(t)&&(0==e||1==e&&this.isEmptyContainer(t.firstChild))},removeEmptyContainers:function(t){var e=this,n=t.getNodes([1],(function(t){return e.isEmptyContainer(t)})),i=[t],s=A(i);$(n,(function(t){h(t,s)})),C(i,s)},undoToTextNode:function(t,e,n,i){if(!e.containsNode(n)){var s=e.cloneRange();s.selectNode(n),s.isPointInRange(e.endContainer,e.endOffset)&&(S(n,e.endContainer,e.endOffset,i),e.setEndAfter(n)),s.isPointInRange(e.startContainer,e.startOffset)&&(n=S(n,e.startContainer,e.startOffset,i))}this.isRemovable(n)?f(n,i):N(n,this.className)},splitAncestorWithClass:function(t,e,n){var i=this.getSelfOrAncestorWithClass(t);i&&S(i,t,e,n)},undoToAncestor:function(t,e){this.isRemovable(t)?f(t,e):N(t,this.className)},applyToRange:function(t,e){var n=this,i=A((e=e||[])||[]);t.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(t);var s=g(t);if(s.length){$(s,(function(t){n.isIgnorableWhiteSpaceNode(t)||n.getSelfOrAncestorWithClass(t)||!n.isModifiable(t)||n.applyToTextNode(t,i)}));var r=s[s.length-1];t.setStartAndEnd(s[0],0,r,r.length),n.normalize&&n.postApply(s,t,i,!1),C(e,i)}var o=n.getEmptyElements(t);$(o,(function(t){O(t,n.className)}))},applyToRanges:function(t){for(var e=t.length;e--;)this.applyToRange(t[e],t);return t},applyToSelection:function(e){var n=t.getSelection(e);n.setRanges(this.applyToRanges(n.getAllRanges()))},undoToRange:function(t,e){var n=this,i=A(e=e||[]);t.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(t,i);var s,r,o=g(t),a=o[o.length-1];if(o.length){n.splitAncestorWithClass(t.endContainer,t.endOffset,i),n.splitAncestorWithClass(t.startContainer,t.startOffset,i);for(var l=0,c=o.length;c>l;++l)s=o[l],(r=n.getSelfOrAncestorWithClass(s))&&n.isModifiable(s)&&n.undoToAncestor(r,i);t.setStartAndEnd(o[0],0,a,a.length),n.normalize&&n.postApply(o,t,i,!0),C(e,i)}var u=n.getEmptyElements(t);$(u,(function(t){N(t,n.className)}))},undoToRanges:function(t){for(var e=t.length;e--;)this.undoToRange(t[e],t);return t},undoToSelection:function(e){var n=t.getSelection(e),i=t.getSelection(e).getAllRanges();this.undoToRanges(i),n.setRanges(i)},isAppliedToRange:function(t){if(t.collapsed||""==t.toString())return!!this.getSelfOrAncestorWithClass(t.commonAncestorContainer);var e=t.getNodes([3]);if(e.length)for(var n,i=0;n=e[i++];)if(!this.isIgnorableWhiteSpaceNode(n)&&m(t,n)&&this.isModifiable(n)&&!this.getSelfOrAncestorWithClass(n))return!1;return!0},isAppliedToRanges:function(t){var e=t.length;if(0==e)return!1;for(;e--;)if(!this.isAppliedToRange(t[e]))return!1;return!0},isAppliedToSelection:function(e){var n=t.getSelection(e);return this.isAppliedToRanges(n.getAllRanges())},toggleRange:function(t){this.isAppliedToRange(t)?this.undoToRange(t):this.applyToRange(t)},toggleSelection:function(t){this.isAppliedToSelection(t)?this.undoToSelection(t):this.applyToSelection(t)},getElementsWithClassIntersectingRange:function(t){var e=[],n=this;return t.getNodes([3],(function(t){var i=n.getSelfOrAncestorWithClass(t);i&&!L(e,i)&&e.push(i)})),e},detach:function(){}},P.util={hasClass:I,addClass:O,removeClass:N,hasSameClasses:a,hasAllClasses:l,replaceWithOwnChildren:f,elementsHaveSameNonClassAttributes:v,elementHasNonClassAttributes:y,splitNodeAt:S,isEditableElement:U,isEditingHost:b,isEditable:_},t.CssClassApplier=t.ClassApplier=P,t.createCssClassApplier=t.createClassApplier=E})),t}),this),function(t,e){"function"==typeof define&&define.amd?define(["./rangy-core"],t):void 0!==module&&"object"==typeof exports?module.exports=t(require("rangy")):t(e.rangy)}((function(t){return t.createModule("TextRange",["WrappedSelection"],(function(t,e){function n(t,e){function n(e,n,i){for(var s=t.slice(e,n),r={isWord:i,chars:s,toString:function(){return s.join("")}},o=0,l=s.length;l>o;++o)s[o].token=r;a.push(r)}for(var i,s,r,o=t.join(""),a=[],l=0;i=e.wordRegex.exec(o);){if(r=(s=i.index)+i[0].length,s>l&&n(l,s,!1),e.includeTrailingSpace)for(;Y.test(t[r]);)++r;n(s,r,!0),l=r}return l<t.length&&n(l,t.length,!1),a}function i(t){var e=t||"",n="string"==typeof e?e.split(""):e;return n.sort((function(t,e){return t.charCodeAt(0)-e.charCodeAt(0)})),n.join("").replace(/(.)\1+/g,"$1")}function s(t){var e,n;return t?(e=t.language||X,W(n={},rt[e]||rt[X]),W(n,t),n):rt[X]}function r(t,e){var n=H(t,e);return e.hasOwnProperty("wordOptions")&&(n.wordOptions=s(n.wordOptions)),e.hasOwnProperty("characterOptions")&&(n.characterOptions=H(n.characterOptions,it)),n}function o(t,e){var n=ut(t,"display",e),i=t.tagName.toLowerCase();return"block"==n&&nt&&pt.hasOwnProperty(i)?pt[i]:n}function a(t){for(var e=h(t),n=0,i=e.length;i>n;++n)if(1==e[n].nodeType&&"none"==o(e[n]))return!0;return!1}function l(t){var e;return 3==t.nodeType&&(e=t.parentNode)&&"hidden"==ut(e,"visibility")}function c(t){return t&&(1==t.nodeType&&!/^(inline(-block|-table)?|none)$/.test(o(t))||9==t.nodeType||11==t.nodeType)}function u(t){return U.isCharacterDataNode(t)||!/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i.test(t.nodeName)}function p(t){for(var e=[];t.parentNode;)e.unshift(t.parentNode),t=t.parentNode;return e}function h(t){return p(t).concat([t])}function d(t){for(;t&&!t.nextSibling;)t=t.parentNode;return t?t.nextSibling:null}function f(t,e){return!e&&t.hasChildNodes()?t.firstChild:d(t)}function m(t){var e=t.previousSibling;if(e){for(t=e;t.hasChildNodes();)t=t.lastChild;return t}var n=t.parentNode;return n&&1==n.nodeType?n:null}function g(t){if(!t||3!=t.nodeType)return!1;var e=t.data;if(""===e)return!0;var n=t.parentNode;if(!n||1!=n.nodeType)return!1;var i=ut(t.parentNode,"whiteSpace");return/^[\t\n\r ]+$/.test(e)&&/^(normal|nowrap)$/.test(i)||/^[\t\r ]+$/.test(e)&&"pre-line"==i}function v(t){return""===t.data||!!g(t)&&(!t.parentNode||!!a(t))}function y(t){var e=t.nodeType;return 7==e||8==e||a(t)||/^(script|style)$/i.test(t.nodeName)||l(t)||v(t)}function b(t,e){
var n=t.nodeType;return 7==n||8==n||1==n&&"none"==o(t,e)}function _(){this.store={}}function w(t,e,n){return function(i){var s=this.cache;if(s.hasOwnProperty(t))return s[t];0;var r=e.call(this,n?this[n]:this,i);return s[t]=r,r}}function k(t,e){this.node=t,this.session=e,this.cache=new _,this.positions=new _}function A(t,e){this.offset=e,this.nodeWrapper=t,this.node=t.node,this.session=t.session,this.cache=new _}function C(){return"[Position("+U.inspectNode(this.node)+":"+this.offset+")]"}function T(){return x(),At=new Ct}function S(){return At||T()}function x(){At&&At.detach(),At=null}function j(t,n,i,s){function r(){var t=null;return n?(t=a,l||(a=a.previousVisible(),l=!a||i&&a.equals(i))):l||(t=a=a.nextVisible(),l=!a||i&&a.equals(i)),l&&(a=null),t}i&&(n?y(i.node)&&(i=t.previousVisible()):y(i.node)&&(i=i.nextVisible()));var o,a=t,l=!1,c=!1;return{next:function(){if(c)return c=!1,o;for(var t;t=r();)if(t.getCharacter(s))return o=t,t;return null},rewind:function(){if(!o)throw e.createError("createCharacterIterator: cannot rewind. Only one position can be rewound.");c=!0},dispose:function(){t=i=null}}}function D(t,e,n){function i(t){for(var e,n,i=[],o=t?s:r,a=!1,l=!1;e=o.next();){if(n=e.character,K.test(n))l&&(l=!1,a=!0);else{if(a){o.rewind();break}l=!0}i.push(e)}return i}var s=j(t,!1,null,e),r=j(t,!0,null,e),o=n.tokenizer,a=i(!0),l=i(!1).reverse(),c=o(l.concat(a),n),u=a.length?c.slice(Tt(c,a[0].token)):[],p=l.length?c.slice(0,Tt(c,l.pop().token)+1):[];return{nextEndToken:function(){for(var t,e;1==u.length&&!(t=u[0]).isWord&&(e=i(!0)).length>0;)u=o(t.chars.concat(e),n);return u.shift()},previousStartToken:function(){for(var t,e;1==p.length&&!(t=p[0]).isWord&&(e=i(!1)).length>0;)p=o(e.reverse().concat(t.chars),n);return p.pop()},dispose:function(){s.dispose(),r.dispose(),u=p=null}}}function P(t,e,n,i,s){var r,o,a,l,c=0,u=t,p=Math.abs(n);if(0!==n){var h=0>n;switch(e){case B:for(o=j(t,h,null,i);(r=o.next())&&p>c;)++c,u=r;a=r,o.dispose();break;case z:for(var d=D(t,i,s),f=h?d.previousStartToken:d.nextEndToken;(l=f())&&p>c;)l.isWord&&(++c,u=h?l.chars[0]:l.chars[l.chars.length-1]);break;default:throw new Error("movePositionBy: unit '"+e+"' not implemented")}h?(u=u.previousVisible(),c=-c):u&&u.isLeadingSpace&&(e==z&&(a=(o=j(t,!1,null,i)).next(),o.dispose()),a&&(u=a.previousVisible()))}return{position:u,unitsMoved:c}}function E(t,e,n,i){var s=t.getRangeBoundaryPosition(e,!0),r=t.getRangeBoundaryPosition(e,!1);return j(i?r:s,!!i,i?s:r,n)}function I(t,e,n){for(var i,s=[],r=E(t,e,n);i=r.next();)s.push(i);return r.dispose(),s}function O(e,n,i){var s=t.createRange(e.node);return s.setStartAndEnd(e.node,e.offset,n.node,n.offset),!s.expand("word",{wordOptions:i})}function N(t,e,n,i,s){function r(t,e){var n=m[t].previousVisible(),i=m[e-1];return{startPos:n,endPos:i,valid:!s.wholeWordsOnly||O(n,i,s.wordOptions)}}for(var o,a,l,c,u,p,h=Z(s.direction),d=j(t,h,t.session.getRangeBoundaryPosition(i,h),s.characterOptions),f="",m=[],g=null;o=d.next();)if(a=o.character,n||s.caseSensitive||(a=a.toLowerCase()),h?(m.unshift(o),f=a+f):(m.push(o),f+=a),n){if(u=e.exec(f))if(c=(l=u.index)+u[0].length,p){if(!h&&c<f.length||h&&l>0){g=r(l,c);break}}else p=!0}else if(-1!=(l=f.indexOf(e))){g=r(l,l+e.length);break}return p&&(g=r(l,c)),d.dispose(),g}function M(t){return function(){var e=!!At,n=[S()].concat(q.toArray(arguments)),i=t.apply(this,n);return e||x(),i}}function R(t,e){return M((function(n,i,s,o){typeof s==$&&(s=i,i=B),o=r(o,at);var a=t;e&&(a=s>=0,this.collapse(!a));var l=P(n.getRangeBoundaryPosition(this,a),i,s,o.characterOptions,o.wordOptions),c=l.position;return this[a?"setStart":"setEnd"](c.node,c.offset),l.unitsMoved}))}function L(t){return M((function(e,n){for(var i,s=E(e,this,n=H(n,it),!t),r=0;(i=s.next())&&K.test(i.character);)++r;s.dispose();var o=r>0;return o&&this[t?"moveStart":"moveEnd"]("character",t?r:-r,{characterOptions:n}),o}))}function F(t){return M((function(e,n){var i=!1;return this.changeEachRange((function(e){i=e[t](n)||i})),i}))}var $="undefined",B="character",z="word",U=t.dom,q=t.util,W=q.extend,H=q.createOptions,J=U.getBody,V=/^[ \t\f\r\n]+$/,G=/^[ \t\f\r]+$/,K=/^[\t-\r \u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/,Y=/^[\t \u00A0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000]+$/,X="en",Z=t.Selection.isDirectionBackward,Q=!1,tt=!1,et=!0;!function(){var e=document.createElement("div");e.contentEditable="true",e.innerHTML="<p>1 </p><p></p>";var n=J(document),i=e.firstChild,s=t.getSelection();n.appendChild(e),s.collapse(i.lastChild,2),s.setStart(i.firstChild,0),1==(""+s).length,e.innerHTML="1 <br>",s.collapse(e,2),s.setStart(e.firstChild,0),Q=1==(""+s).length,e.innerHTML="1 <p>1</p>",s.collapse(e,2),s.setStart(e.firstChild,0),tt=1==(""+s).length,n.removeChild(e),s.removeAllRanges()}();var nt,it={includeBlockContentTrailingSpace:!0,includeSpaceBeforeBr:!0,includeSpaceBeforeBlock:!0,includePreLineTrailingSpace:!0,ignoreCharacters:""},st={includeBlockContentTrailingSpace:!et,includeSpaceBeforeBr:!Q,includeSpaceBeforeBlock:!tt,includePreLineTrailingSpace:!0},rt={en:{wordRegex:/[a-z0-9]+('[a-z0-9]+)*/gi,includeTrailingSpace:!1,tokenizer:n}},ot={caseSensitive:!1,withinRange:null,wholeWordsOnly:!1,wrap:!1,direction:"forward",wordOptions:null,characterOptions:null},at={wordOptions:null,characterOptions:null},lt={wordOptions:null,characterOptions:null,trim:!1,trimStart:!0,trimEnd:!0},ct={wordOptions:null,characterOptions:null,direction:"forward"},ut=U.getComputedStyleProperty;!function(){var t=document.createElement("table"),e=J(document);e.appendChild(t),nt="block"==ut(t,"display"),e.removeChild(t)}(),t.features.tableCssDisplayBlock=nt;var pt={table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell"};_.prototype={get:function(t){return this.store.hasOwnProperty(t)?this.store[t]:null},set:function(t,e){return this.store[t]=e}};var ht={getPosition:function(t){var e=this.positions;return e.get(t)||e.set(t,new A(this,t))},toString:function(){return"[NodeWrapper("+U.inspectNode(this.node)+")]"}};k.prototype=ht;var dt="EMPTY",ft="NON_SPACE",mt="UNCOLLAPSIBLE_SPACE",gt="COLLAPSIBLE_SPACE",vt="TRAILING_SPACE_BEFORE_BLOCK",yt="TRAILING_SPACE_IN_BLOCK",bt="TRAILING_SPACE_BEFORE_BR",_t="PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK",wt="TRAILING_LINE_BREAK_AFTER_BR";W(ht,{isCharacterDataNode:w("isCharacterDataNode",U.isCharacterDataNode,"node"),getNodeIndex:w("nodeIndex",U.getNodeIndex,"node"),getLength:w("nodeLength",U.getNodeLength,"node"),containsPositions:w("containsPositions",u,"node"),isWhitespace:w("isWhitespace",g,"node"),isCollapsedWhitespace:w("isCollapsedWhitespace",v,"node"),getComputedDisplay:w("computedDisplay",o,"node"),isCollapsed:w("collapsed",y,"node"),isIgnored:w("ignored",b,"node"),next:w("nextPos",f,"node"),previous:w("previous",m,"node"),getTextNodeInfo:w("textNodeInfo",(function(t){var e=null,n=!1,i=ut(t.parentNode,"whiteSpace"),s="pre-line"==i;return s?(e=G,n=!0):("normal"==i||"nowrap"==i)&&(e=V,n=!0),{node:t,text:t.data,spaceRegex:e,collapseSpaces:n,preLine:s}}),"node"),hasInnerText:w("hasInnerText",(function(t,e){for(var n=this.session,i=n.getPosition(t.parentNode,this.getNodeIndex()+1),s=n.getPosition(t,0),r=e?i:s,o=e?s:i;r!==o;){if(r.prepopulateChar(),r.isDefinitelyNonEmpty())return!0;r=e?r.previousVisible():r.nextVisible()}return!1}),"node"),isRenderedBlock:w("isRenderedBlock",(function(t){for(var e=t.getElementsByTagName("br"),n=0,i=e.length;i>n;++n)if(!y(e[n]))return!0;return this.hasInnerText()}),"node"),getTrailingSpace:w("trailingSpace",(function(t){if("br"==t.tagName.toLowerCase())return"";switch(this.getComputedDisplay()){case"inline":for(var e=t.lastChild;e;){if(!b(e))return 1==e.nodeType?this.session.getNodeWrapper(e).getTrailingSpace():"";e=e.previousSibling}break;case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":break;case"table-cell":return"\t";default:return this.isRenderedBlock(!0)?"\n":""}return""}),"node"),getLeadingSpace:w("leadingSpace",(function(){switch(this.getComputedDisplay()){case"inline":case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":case"table-cell":break;default:return this.isRenderedBlock(!1)?"\n":""}return""}),"node")});var kt={character:"",characterType:dt,isBr:!1,prepopulateChar:function(){var t=this;if(!t.prepopulatedChar){var e=t.node,n=t.offset,i="",s=dt,r=!1;if(n>0)if(3==e.nodeType){var o=e.data,a=o.charAt(n-1),l=t.nodeWrapper.getTextNodeInfo(),c=l.spaceRegex;l.collapseSpaces?c.test(a)?n>1&&c.test(o.charAt(n-2))||(l.preLine&&"\n"===o.charAt(n)?(i=" ",s=_t):(i=" ",s=gt)):(i=a,s=ft,r=!0):(i=a,s=mt,r=!0)}else{var u=e.childNodes[n-1];if(u&&1==u.nodeType&&!y(u)&&("br"==u.tagName.toLowerCase()?(i="\n",t.isBr=!0,s=gt,r=!1):t.checkForTrailingSpace=!0),!i){var p=e.childNodes[n];p&&1==p.nodeType&&!y(p)&&(t.checkForLeadingSpace=!0)}}t.prepopulatedChar=!0,t.character=i,t.characterType=s,t.isCharInvariant=r}},isDefinitelyNonEmpty:function(){var t=this.characterType;return t==ft||t==mt},resolveLeadingAndTrailingSpaces:function(){if(this.prepopulatedChar||this.prepopulateChar(),this.checkForTrailingSpace){var t=this.session.getNodeWrapper(this.node.childNodes[this.offset-1]).getTrailingSpace();t&&(this.isTrailingSpace=!0,this.character=t,this.characterType=gt),this.checkForTrailingSpace=!1}if(this.checkForLeadingSpace){var e=this.session.getNodeWrapper(this.node.childNodes[this.offset]).getLeadingSpace();e&&(this.isLeadingSpace=!0,this.character=e,this.characterType=gt),this.checkForLeadingSpace=!1}},getPrecedingUncollapsedPosition:function(t){for(var e=this;e=e.previousVisible();)if(""!==e.getCharacter(t))return e;return null},getCharacter:function(t){function e(){return h||(c=d.getPrecedingUncollapsedPosition(t),h=!0),c}this.resolveLeadingAndTrailingSpaces();var n=this.character,s=i(t.ignoreCharacters),r=""!==n&&s.indexOf(n)>-1;if(this.isCharInvariant)return r?"":n;var o=["character",t.includeSpaceBeforeBr,t.includeBlockContentTrailingSpace,t.includePreLineTrailingSpace,s].join("_"),a=this.cache.get(o);if(null!==a)return a;var l,c,u="",p=this.characterType==gt,h=!1,d=this;return p?(" "!=n||e()&&!c.isTrailingSpace&&"\n"!=c.character)&&("\n"==n&&this.isLeadingSpace?e()&&"\n"!=c.character&&(u="\n"):(l=this.nextUncollapsed())&&(l.isBr?this.type=bt:l.isTrailingSpace&&"\n"==l.character?this.type=yt:l.isLeadingSpace&&"\n"==l.character&&(this.type=vt),"\n"==l.character?(this.type!=bt||t.includeSpaceBeforeBr)&&(this.type!=vt||t.includeSpaceBeforeBlock)&&(this.type==yt&&l.isTrailingSpace&&!t.includeBlockContentTrailingSpace||(this.type!=_t||l.type!=ft||t.includePreLineTrailingSpace)&&("\n"==n?l.isTrailingSpace?this.isTrailingSpace||this.isBr&&(l.type=wt,e()&&c.isLeadingSpace&&"\n"==c.character&&(l.character="")):u="\n":" "==n&&(u=" "))):u=n)):"\n"==n&&(!(l=this.nextUncollapsed())||l.isTrailingSpace),s.indexOf(u)>-1&&(u=""),this.cache.set(o,u),u},equals:function(t){return!!t&&this.node===t.node&&this.offset===t.offset},inspect:C,toString:function(){return this.character}};A.prototype=kt,W(kt,{next:w("nextPos",(function(t){var e,n,i,s=t.nodeWrapper,r=t.node,o=t.offset,a=s.session;return r?(o==s.getLength()?n=(e=r.parentNode)?s.getNodeIndex()+1:0:s.isCharacterDataNode()?(e=r,n=o+1):(i=r.childNodes[o],a.getNodeWrapper(i).containsPositions()?(e=i,n=0):(e=r,n=o+1)),e?a.getPosition(e,n):null):null})),previous:w("previous",(function(t){var e,n,i,s=t.nodeWrapper,r=t.node,o=t.offset,a=s.session;return 0==o?n=(e=r.parentNode)?s.getNodeIndex():0:s.isCharacterDataNode()?(e=r,n=o-1):(i=r.childNodes[o-1],a.getNodeWrapper(i).containsPositions()?(e=i,n=U.getNodeLength(i)):(e=r,n=o-1)),e?a.getPosition(e,n):null})),nextVisible:w("nextVisible",(function(t){var e=t.next();if(!e)return null;var n=e.nodeWrapper,i=e.node,s=e;return n.isCollapsed()&&(s=n.session.getPosition(i.parentNode,n.getNodeIndex()+1)),s})),nextUncollapsed:w("nextUncollapsed",(function(t){for(var e=t;e=e.nextVisible();)if(e.resolveLeadingAndTrailingSpaces(),""!==e.character)return e;return null})),previousVisible:w("previousVisible",(function(t){var e=t.previous();if(!e)return null;var n=e.nodeWrapper,i=e.node,s=e;return n.isCollapsed()&&(s=n.session.getPosition(i.parentNode,n.getNodeIndex())),s}))});var At=null,Ct=function(){function t(t){var e=new _;return{get:function(n){var i=e.get(n[t]);if(i)for(var s,r=0;s=i[r++];)if(s.node===n)return s;return null},set:function(n){var i=n.node[t];(e.get(i)||e.set(i,[])).push(n)}}}function e(){this.initCaches()}var n=q.isHostProperty(document.documentElement,"uniqueID");return e.prototype={initCaches:function(){this.elementCache=n?function(){var t=new _;return{get:function(e){return t.get(e.uniqueID)},set:function(e){t.set(e.node.uniqueID,e)}}}():t("tagName"),this.textNodeCache=t("data"),this.otherNodeCache=t("nodeName")},getNodeWrapper:function(t){var e;switch(t.nodeType){case 1:e=this.elementCache;break;case 3:e=this.textNodeCache;break;default:e=this.otherNodeCache}var n=e.get(t);return n||(n=new k(t,this),e.set(n)),n},getPosition:function(t,e){return this.getNodeWrapper(t).getPosition(e)},getRangeBoundaryPosition:function(t,e){var n=e?"start":"end";return this.getPosition(t[n+"Container"],t[n+"Offset"])},detach:function(){this.elementCache=this.textNodeCache=this.otherNodeCache=null}},e}();W(U,{nextNode:f,previousNode:m});var Tt=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var n=0,i=t.length;i>n;++n)if(t[n]===e)return n;return-1};W(t.rangePrototype,{moveStart:R(!0,!1),moveEnd:R(!1,!1),move:R(!0,!0),trimStart:L(!0),trimEnd:L(!1),trim:M((function(t,e){var n=this.trimStart(e),i=this.trimEnd(e);return n||i})),expand:M((function(t,e,n){var i=!1,s=(n=r(n,lt)).characterOptions;if(e||(e=B),e==z){var o,a,l=n.wordOptions,c=t.getRangeBoundaryPosition(this,!0),u=t.getRangeBoundaryPosition(this,!1),p=D(c,s,l).nextEndToken(),h=p.chars[0].previousVisible();if(this.collapsed)o=p;else o=D(u,s,l).previousStartToken();return a=o.chars[o.chars.length-1],h.equals(c)||(this.setStart(h.node,h.offset),i=!0),a&&!a.equals(u)&&(this.setEnd(a.node,a.offset),i=!0),n.trim&&(n.trimStart&&(i=this.trimStart(s)||i),n.trimEnd&&(i=this.trimEnd(s)||i)),i}return this.moveEnd(B,1,n)})),text:M((function(t,e){return this.collapsed?"":I(t,this,H(e,it)).join("")})),selectCharacters:M((function(t,e,n,i,s){var r={characterOptions:s};e||(e=J(this.getDocument())),this.selectNodeContents(e),this.collapse(!0),this.moveStart("character",n,r),this.collapse(!0),this.moveEnd("character",i-n,r)})),toCharacterRange:M((function(t,e,n){e||(e=J(this.getDocument()));var i,s=e.parentNode,r=U.getNodeIndex(e),o=-1==U.comparePoints(this.startContainer,this.endContainer,s,r),a=this.cloneRange();return o?(a.setStartAndEnd(this.startContainer,this.startOffset,s,r),i=-a.text(n).length):(a.setStartAndEnd(s,r,this.startContainer,this.startOffset),i=a.text(n).length),{start:i,end:i+this.text(n).length}})),findText:M((function(e,n,i){(i=r(i,ot)).wholeWordsOnly&&(i.wordOptions.includeTrailingSpace=!1);var s=Z(i.direction),o=i.withinRange;o||(o=t.createRange()).selectNodeContents(this.getDocument());var a=n,l=!1;"string"==typeof a?i.caseSensitive||(a=a.toLowerCase()):l=!0;var c=e.getRangeBoundaryPosition(this,!s),u=o.comparePoint(c.node,c.offset);-1===u?c=e.getRangeBoundaryPosition(o,!0):1===u&&(c=e.getRangeBoundaryPosition(o,!1));for(var p,h=c,d=!1;;)if(p=N(h,a,l,o,i)){if(p.valid)return this.setStartAndEnd(p.startPos.node,p.startPos.offset,p.endPos.node,p.endPos.offset),!0;h=s?p.startPos:p.endPos}else{if(!i.wrap||d)return!1;o=o.cloneRange(),h=e.getRangeBoundaryPosition(o,!s),o.setBoundary(c.node,c.offset,s),d=!0}})),pasteHtml:function(t){if(this.deleteContents(),t){var e=this.createContextualFragment(t),n=e.lastChild;this.insertNode(e),this.collapseAfter(n)}}}),W(t.selectionPrototype,{expand:M((function(t,e,n){this.changeEachRange((function(t){t.expand(e,n)}))})),move:M((function(t,e,n,i){var s=0;if(this.focusNode){this.collapse(this.focusNode,this.focusOffset);var r=this.getRangeAt(0);i||(i={}),i.characterOptions=H(i.characterOptions,st),s=r.move(e,n,i),this.setSingleRange(r)}return s})),trimStart:F("trimStart"),trimEnd:F("trimEnd"),trim:F("trim"),selectCharacters:M((function(e,n,i,s,r,o){var a=t.createRange(n);a.selectCharacters(n,i,s,o),this.setSingleRange(a,r)})),saveCharacterRanges:M((function(t,e,n){for(var i=this.getAllRanges(),s=[],r=1==i.length&&this.isBackward(),o=0,a=i.length;a>o;++o)s[o]={characterRange:i[o].toCharacterRange(e,n),backward:r,characterOptions:n};return s})),restoreCharacterRanges:M((function(e,n,i){this.removeAllRanges();for(var s,r,o,a=0,l=i.length;l>a;++a)o=(r=i[a]).characterRange,(s=t.createRange(n)).selectCharacters(n,o.start,o.end,r.characterOptions),this.addRange(s,r.backward)})),text:M((function(t,e){for(var n=[],i=0,s=this.rangeCount;s>i;++i)n[i]=this.getRangeAt(i).text(e);return n.join("")}))}),t.innerText=function(e,n){var i=t.createRange(e);return i.selectNodeContents(e),i.text(n)},t.createWordIterator=function(t,e,n){var i=S();n=r(n,ct);var s=D(i.getPosition(t,e),n.characterOptions,n.wordOptions),o=Z(n.direction);return{next:function(){return o?s.previousStartToken():s.nextEndToken()},dispose:function(){s.dispose(),this.next=function(){}}}},t.noMutation=function(t){t(S()),x()},t.noMutation.createEntryPointFunction=M,t.textRange={isBlockNode:c,isCollapsedWhitespaceNode:v,createPosition:M((function(t,e,n){return t.getPosition(e,n)}))}})),t}),this),function(t,e){"function"==typeof define&&define.amd?define(["./rangy-core"],t):void 0!==module&&"object"==typeof exports?module.exports=t(require("rangy")):t(e.rangy)}((function(t){return t.createModule("Highlighter",["ClassApplier"],(function(t){function e(t,e){return t.characterRange.start-e.characterRange.start}function n(t,e){this.type=t,this.converterCreator=e}function i(t,e){f[t]=new n(t,e)}function s(t){var e=f[t];if(e instanceof n)return e.create();throw new Error("Highlighter type '"+t+"' is not valid")}function r(t,e){this.start=t,this.end=e}function o(t,e,n,i,s,r){s?(this.id=s,d=Math.max(d,s+1)):this.id=d++,this.characterRange=e,this.doc=t,this.classApplier=n,this.converter=i,this.containerElementId=r||null,this.applied=!1}function a(t,e){e=e||"textContent",this.doc=t||document,this.classAppliers={},this.highlights=[],this.converter=s(e)}var l=t.dom,c=l.arrayContains,u=l.getBody,p=t.util.createOptions,h=t.util.forEach,d=1,f={};n.prototype.create=function(){var t=this.converterCreator();return t.type=this.type,t},t.registerHighlighterType=i,r.prototype={intersects:function(t){return this.start<t.end&&this.end>t.start},isContiguousWith:function(t){return this.start==t.end||this.end==t.start},union:function(t){return new r(Math.min(this.start,t.start),Math.max(this.end,t.end))},intersection:function(t){return new r(Math.max(this.start,t.start),Math.min(this.end,t.end))},getComplements:function(t){var e=[];if(this.start>=t.start){if(this.end<=t.end)return[];e.push(new r(t.end,this.end))}else e.push(new r(this.start,Math.min(this.end,t.start))),this.end>t.end&&e.push(new r(t.end,this.end));return e},toString:function(){return"[CharacterRange("+this.start+", "+this.end+")]"}},r.fromCharacterRange=function(t){return new r(t.start,t.end)};var m={rangeToCharacterRange:function(t,e){var n=t.getBookmark(e);return new r(n.start,n.end)},characterRangeToRange:function(e,n,i){var s=t.createRange(e);return s.moveToBookmark({start:n.start,end:n.end,containerNode:i}),s},serializeSelection:function(t,e){for(var n=t.getAllRanges(),i=[],s=1==n.length&&t.isBackward(),r=0,o=n.length;o>r;++r)i[r]={characterRange:this.rangeToCharacterRange(n[r],e),backward:s};return i},restoreSelection:function(t,e,n){t.removeAllRanges();for(var i,s,r=t.win.document,o=0,a=e.length;a>o;++o)(s=e[o]).characterRange,i=this.characterRangeToRange(r,s.characterRange,n),t.addRange(i,s.backward)}};i("textContent",(function(){return m})),i("TextRange",function(){var e;return function(){if(!e){var n=t.modules.TextRange;if(!n)throw new Error("TextRange module is missing.");if(!n.supported)throw new Error("TextRange module is present but not supported.");e={rangeToCharacterRange:function(t,e){return r.fromCharacterRange(t.toCharacterRange(e))},characterRangeToRange:function(e,n,i){var s=t.createRange(e);return s.selectCharacters(i,n.start,n.end),s},serializeSelection:function(t,e){return t.saveCharacterRanges(e)},restoreSelection:function(t,e,n){t.restoreCharacterRanges(n,e)}}}return e}}()),o.prototype={getContainerElement:function(){return this.containerElementId?this.doc.getElementById(this.containerElementId):u(this.doc)},getRange:function(){return this.converter.characterRangeToRange(this.doc,this.characterRange,this.getContainerElement())},fromRange:function(t){this.characterRange=this.converter.rangeToCharacterRange(t,this.getContainerElement())},getText:function(){return this.getRange().toString()},containsElement:function(t){return this.getRange().containsNodeContents(t.firstChild)},unapply:function(){this.classApplier.undoToRange(this.getRange()),this.applied=!1},apply:function(){this.classApplier.applyToRange(this.getRange()),this.applied=!0},getHighlightElements:function(){return this.classApplier.getElementsWithClassIntersectingRange(this.getRange())},toString:function(){return"[Highlight(ID: "+this.id+", class: "+this.classApplier.className+", character range: "+this.characterRange.start+" - "+this.characterRange.end+")]"}},a.prototype={addClassApplier:function(t){this.classAppliers[t.className]=t},getHighlightForElement:function(t){for(var e=this.highlights,n=0,i=e.length;i>n;++n)if(e[n].containsElement(t))return e[n];return null},removeHighlights:function(t){for(var e,n=0,i=this.highlights.length;i>n;++n)e=this.highlights[n],c(t,e)&&(e.unapply(),this.highlights.splice(n--,1))},removeAllHighlights:function(){this.removeHighlights(this.highlights)},getIntersectingHighlights:function(t){var e=[],n=this.highlights;return h(t,(function(t){h(n,(function(n){t.intersectsRange(n.getRange())&&!c(e,n)&&e.push(n)}))})),e},highlightCharacterRanges:function(e,n,i){var s,a,l,c,u,d,f,m,g,v,y,b,_=this.highlights,w=this.converter,k=this.doc,A=[],C=e?this.classAppliers[e]:null,T=(i=p(i,{containerElementId:null,exclusive:!0})).containerElementId,S=i.exclusive;for(T&&((c=this.doc.getElementById(T))&&((u=t.createRange(this.doc)).selectNodeContents(c),d=new r(0,u.toString().length))),s=0,a=n.length;a>s;++s)if(f=n[s],y=[],d&&(f=f.intersection(d)),f.start!=f.end){for(l=0;l<_.length;++l)g=!1,T==_[l].containerElementId&&(m=_[l].characterRange,b=!(v=C==_[l].classApplier)&&S,(m.intersects(f)||m.isContiguousWith(f))&&(v||b)&&(b&&h(m.getComplements(f),(function(t){y.push(new o(k,t,_[l].classApplier,w,null,T))})),g=!0,v&&(f=m.union(f)))),g?(A.push(_[l]),_[l]=new o(k,m.union(f),C,w,null,T)):y.push(_[l]);C&&y.push(new o(k,f,C,w,null,T)),this.highlights=_=y}h(A,(function(t){t.unapply()}));var x=[];return h(_,(function(t){t.applied||(t.apply(),x.push(t))})),x},highlightRanges:function(e,n,i){var s,r=[],o=this.converter,a=(i=p(i,{containerElement:null,exclusive:!0})).containerElement,l=a?a.id:null;return a&&(s=t.createRange(a)).selectNodeContents(a),h(n,(function(t){var e=a?s.intersection(t):t;r.push(o.rangeToCharacterRange(e,a||u(t.getDocument())))})),this.highlightCharacterRanges(e,r,{containerElementId:l,exclusive:i.exclusive})},highlightSelection:function(e,n){var i=this.converter,s=!!e&&this.classAppliers[e],o=(n=p(n,{containerElementId:null,selection:t.getSelection(),exclusive:!0})).containerElementId,a=n.exclusive,l=n.selection,c=l.win.document,d=o?c.getElementById(o):u(c);if(!s&&!1!==e)throw new Error("No class applier found for class '"+e+"'");var f=i.serializeSelection(l,d),m=[];h(f,(function(t){m.push(r.fromCharacterRange(t.characterRange))}));var g=this.highlightCharacterRanges(e,m,{containerElementId:o,exclusive:a});return i.restoreSelection(l,f,d),g},unhighlightSelection:function(e){e=e||t.getSelection();var n=this.getIntersectingHighlights(e.getAllRanges());return this.removeHighlights(n),e.removeAllRanges(),n},getHighlightsInSelection:function(e){return e=e||t.getSelection(),this.getIntersectingHighlights(e.getAllRanges())},selectionOverlapsHighlight:function(t){return this.getHighlightsInSelection(t).length>0},serialize:function(t){var n=this.highlights;n.sort(e);var i=["type:"+this.converter.type];return t=p(t,{serializeHighlightText:!1}),h(n,(function(e){var n=e.characterRange,s=[n.start,n.end,e.id,e.classApplier.className,e.containerElementId];t.serializeHighlightText&&s.push(e.getText()),i.push(s.join("$"))})),i.join("|")},deserialize:function(t){var e,n,i,a=t.split("|"),l=[],c=a[0],p=!1;if(!c||!(e=/^type:(\w+)$/.exec(c)))throw new Error("Serialized highlights are invalid.");(n=e[1])!=this.converter.type&&(i=s(n),p=!0),a.shift();for(var h,d,f,m,g,v,y=a.length;y-- >0;){if(f=new r(+(v=a[y].split("$"))[0],+v[1]),g=(m=v[4]||null)?this.doc.getElementById(m):u(this.doc),p&&(f=this.converter.rangeToCharacterRange(i.characterRangeToRange(this.doc,f,g),g)),!(h=this.classAppliers[v[3]]))throw new Error("No class applier found for class '"+v[3]+"'");(d=new o(this.doc,f,h,this.converter,parseInt(v[2]),m)).apply(),l.push(d)}this.highlights=l}},t.Highlighter=a,t.createHighlighter=function(t,e){return new a(t,e)}})),t}),this),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=global.window&&global.window.$?t(global.window.$):function(e){if(!e.$&&!e.fn)throw new Error("Tokenfield requires a window object with jQuery or a jQuery instance");return t(e.$||e)}:t(jQuery,window)}((function(t,e){"use strict";var n=function(n,i){var s=this;this.$element=t(n),this.textDirection=this.$element.css("direction"),this.options=t.extend(!0,{},t.fn.tokenfield.defaults,{tokens:this.$element.val()},this.$element.data(),i),this._delimiters="string"==typeof this.options.delimiter?[this.options.delimiter]:this.options.delimiter,this._triggerKeys=t.map(this._delimiters,(function(t){return t.charCodeAt(0)})),this._firstDelimiter=this._delimiters[0];var r=t.inArray(" ",this._delimiters),o=t.inArray("-",this._delimiters);r>=0&&(this._delimiters[r]="\\s"),o>=0&&(delete this._delimiters[o],this._delimiters.unshift("-"));var a=["\\","$","[","{","^",".","|","?","*","+","(",")"];t.each(this._delimiters,(function(e,n){t.inArray(n,a)>=0&&(s._delimiters[e]="\\"+n)}));var l,c=e&&"function"==typeof e.getMatchedCSSRules?e.getMatchedCSSRules(n):null,u=n.style.width,p=this.$element.width();c&&t.each(c,(function(t,e){e.style.width&&(l=e.style.width)}));var h="rtl"===t("body").css("direction")?"right":"left",d={position:this.$element.css("position")};d[h]=this.$element.css(h),this.$element.data("original-styles",d).data("original-tabindex",this.$element.prop("tabindex")).css("position","absolute").css(h,"-10000px").prop("tabindex",-1),this.$wrapper=t('<div class="tokenfield form-control" />'),this.$element.hasClass("input-lg")&&this.$wrapper.addClass("input-lg"),this.$element.hasClass("input-sm")&&this.$wrapper.addClass("input-sm"),"rtl"===this.textDirection&&this.$wrapper.addClass("rtl");var f=this.$element.prop("id")||(new Date).getTime()+""+Math.floor(100*(1+Math.random()));this.$input=t('<input type="'+this.options.inputType+'" class="token-input" autocomplete="off" />').appendTo(this.$wrapper).prop("placeholder",this.$element.prop("placeholder")).prop("id",f+"-tokenfield").prop("tabindex",this.$element.data("original-tabindex"));var m=t('label[for="'+this.$element.prop("id")+'"]');if(m.length&&m.prop("for",this.$input.prop("id")),this.$copyHelper=t('<input type="text" />').css("position","absolute").css(h,"-10000px").prop("tabindex",-1).prependTo(this.$wrapper),u?this.$wrapper.css("width",u):l?this.$wrapper.css("width",l):this.$element.parents(".form-inline").length&&this.$wrapper.width(p),(this.$element.prop("disabled")||this.$element.parents("fieldset[disabled]").length)&&this.disable(),this.$element.prop("readonly")&&this.readonly(),this.$mirror=t('<span style="position:absolute; top:-999px; left:0; white-space:pre;"/>'),this.$input.css("min-width",this.options.minWidth+"px"),t.each(["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],(function(t,e){s.$mirror[0].style[e]=s.$input.css(e)})),this.$mirror.appendTo("body"),this.$wrapper.insertBefore(this.$element),this.$element.prependTo(this.$wrapper),this.update(),this.setTokens(this.options.tokens,!1,!this.$element.val()&&this.options.tokens),this.listen(),!t.isEmptyObject(this.options.autocomplete)){var g="rtl"===this.textDirection?"right":"left",v=t.extend({minLength:this.options.showAutocompleteOnFocus?0:null,position:{my:g+" top",at:g+" bottom",of:this.$wrapper}},this.options.autocomplete);this.$input.autocomplete(v)}if(!t.isEmptyObject(this.options.typeahead)){var y=this.options.typeahead,b={minLength:this.options.showAutocompleteOnFocus?0:null},_=Array.isArray(y)?y:[y,y];_[0]=t.extend({},b,_[0]),this.$input.typeahead.apply(this.$input,_),this.typeahead=!0}};n.prototype={constructor:n,createToken:function(e,n){var i=this;if(void 0===n&&(n=!0),(e="string"==typeof e?{value:e,label:e}:t.extend({},e)).value=e.value.toString().trim(),e.label=e.label&&e.label.length?e.label.trim():e.value,e.value.length&&e.label.length&&!(e.label.length<=this.options.minLength)&&!(this.options.limit&&this.getTokens().length>=this.options.limit)){var s=t.Event("tokenfield:createtoken",{attrs:e});if(this.$element.trigger(s),s.attrs&&!s.isDefaultPrevented()){var r=t('<div class="token" />').append('<span class="token-label" />').append('<a href="#" class="close" tabindex="-1">&times;</a>').data("attrs",e);this.$input.hasClass("tt-input")?this.$input.parent().before(r):this.$input.before(r),this.$input.css("width",this.options.minWidth+"px");var o=r.find(".token-label"),a=r.find(".close");o.text(e.label),r.on("mousedown",(function(){if(i._disabled||i._readonly)return!1;i.preventDeactivation=!0})).on("click",(function(t){return!i._disabled&&!i._readonly&&(i.preventDeactivation=!1,t.ctrlKey||t.metaKey?(t.preventDefault(),i.toggle(r)):void i.activate(r,t.shiftKey,t.shiftKey))})).on("dblclick",(function(){if(i._disabled||i._readonly||!i.options.allowEditing)return!1;i.edit(r)})),a.on("click",t.proxy(this.remove,this)),this.$element.trigger(t.Event("tokenfield:createdtoken",{attrs:e,relatedTarget:r.get(0)})),n&&this.$element.val(this.getTokensList()).trigger(t.Event("change",{initiator:"tokenfield"}));i=this;return setTimeout((function(){i.update()}),0),this.$element.get(0)}this.updateTokensOnEditDiscard(n)}},updateTokensOnEditDiscard:function(e){this.$input.data("edit")&&e&&this.$element.val(this.getTokensList()).trigger(t.Event("change",{initiator:"tokenfield"}))},setTokens:function(e,n,i){if(n||this.$wrapper.find(".token").remove(),e){void 0===i&&(i=!0),"string"==typeof e&&(e=this._delimiters.length?e.split(new RegExp("["+this._delimiters.join("")+"]")):[e]);var s=this;return t.each(e,(function(t,e){s.createToken(e,i)})),this.$element.get(0)}this.updateTokensOnEditDiscard(i)},getTokenData:function(e){var n=e.map((function(){return t(this).data("attrs")})).get();return 1==n.length&&(n=n[0]),n},getTokens:function(e){var n=this,i=[],s=e?".active":"";return this.$wrapper.find(".token"+s).each((function(){i.push(n.getTokenData(t(this)))})),i},getTokensList:function(e,n,i){var s=(e=e||this._firstDelimiter)+((n=null!=n?n:this.options.beautify)&&" "!==e?" ":"");return t.map(this.getTokens(i),(function(t){return t.value})).join(s)},getInput:function(){return this.$input.val()},setInput:function(t){this.$input.hasClass("tt-input")?this.$input.typeahead("val",t):this.$input.val(t)},listen:function(){var n=this;this.$element.on("change",t.proxy(this.change,this)),this.$wrapper.on("mousedown",t.proxy(this.focusInput,this)),this.$input.on("focus",t.proxy(this.focus,this)).on("blur",t.proxy(this.blur,this)).on("paste",t.proxy(this.paste,this)).on("keydown",t.proxy(this.keydown,this)).on("keypress",t.proxy(this.keypress,this)).on("keyup",t.proxy(this.keyup,this)),this.$copyHelper.on("focus",t.proxy(this.focus,this)).on("blur",t.proxy(this.blur,this)).on("keydown",t.proxy(this.keydown,this)).on("keyup",t.proxy(this.keyup,this)),this.$input.on("keypress",t.proxy(this.update,this)).on("keyup",t.proxy(this.update,this)),this.$input.on("autocompletecreate",(function(){var e=t(this).data("ui-autocomplete").menu.element,i=n.$wrapper.outerWidth()-parseInt(e.css("border-left-width"),10)-parseInt(e.css("border-right-width"),10);e.css("min-width",i+"px")})).on("autocompleteselect",(function(t,e){return n.createToken(e.item)&&(n.$input.val(""),n.$input.data("edit")&&n.unedit(!0)),!1
})).on("typeahead:selected typeahead:autocompleted",(function(t,e){n.createToken(e)&&(n.$input.typeahead("val",""),n.$input.data("edit")&&n.unedit(!0))})),t(e).on("resize",t.proxy(this.update,this))},keydown:function(e){function n(t){if(s.$input.is(document.activeElement)){if(s.$input.val().length>0)return;t+="All";var n=s.$input.hasClass("tt-input")?s.$input.parent()[t](".token:first"):s.$input[t](".token:first");if(!n.length)return;s.preventInputFocus=!0,s.preventDeactivation=!0,s.activate(n),e.preventDefault()}else s[t](e.shiftKey),e.preventDefault()}function i(n){if(e.shiftKey){if(s.$input.is(document.activeElement)){if(s.$input.val().length>0)return;var i=s.$input.hasClass("tt-input")?s.$input.parent()[n+"All"](".token:first"):s.$input[n+"All"](".token:first");if(!i.length)return;s.activate(i)}var r="prev"===n?"next":"prev",o="prev"===n?"first":"last";s.$firstActiveToken[r+"All"](".token").each((function(){s.deactivate(t(this))})),s.activate(s.$wrapper.find(".token:"+o),!0,!0),e.preventDefault()}}if(this.focused){var s=this;switch(e.keyCode){case 8:if(!this.$input.is(document.activeElement))break;this.lastInputValue=this.$input.val();break;case 37:n("rtl"===this.textDirection?"next":"prev");break;case 38:i("prev");break;case 39:n("rtl"===this.textDirection?"prev":"next");break;case 40:i("next");break;case 65:if(this.$input.val().length>0||!e.ctrlKey&&!e.metaKey)break;this.activateAll(),e.preventDefault();break;case 9:case 13:if(this.$input.data("ui-autocomplete")&&this.$input.data("ui-autocomplete").menu.element.find("li:has(a.ui-state-focus), li.ui-state-focus").length)break;if(this.$input.hasClass("tt-input")&&this.$wrapper.find(".tt-cursor").length)break;if(this.$input.hasClass("tt-input")&&this.$wrapper.find(".tt-hint").val()&&this.$wrapper.find(".tt-hint").val().length)break;if(this.$input.is(document.activeElement)&&this.$input.val().length||this.$input.data("edit"))return this.createTokensFromInput(e,this.$input.data("edit"));if(13===e.keyCode){if(!this.$copyHelper.is(document.activeElement)||1!==this.$wrapper.find(".token.active").length)break;if(!s.options.allowEditing)break;this.edit(this.$wrapper.find(".token.active"))}}this.lastKeyDown=e.keyCode}},keypress:function(e){if(-1!==t.inArray(e.which,this._triggerKeys)&&this.$input.is(document.activeElement))return this.$input.val()&&this.createTokensFromInput(e),!1},keyup:function(t){if(this.preventInputFocus=!1,this.focused){switch(t.keyCode){case 8:if(this.$input.is(document.activeElement)){if(this.$input.val().length||this.lastInputValue.length&&8===this.lastKeyDown)break;this.preventDeactivation=!0;var e=this.$input.hasClass("tt-input")?this.$input.parent().prevAll(".token:first"):this.$input.prevAll(".token:first");if(!e.length)break;this.activate(e)}else this.remove(t);break;case 46:this.remove(t,"next")}this.lastKeyUp=t.keyCode}},focus:function(){this.focused=!0,this.$wrapper.addClass("focus"),this.$input.is(document.activeElement)&&(this.$wrapper.find(".active").removeClass("active"),this.$firstActiveToken=null,this.options.showAutocompleteOnFocus&&this.search())},blur:function(t){this.focused=!1,this.$wrapper.removeClass("focus"),this.preventDeactivation||this.$element.is(document.activeElement)||(this.$wrapper.find(".active").removeClass("active"),this.$firstActiveToken=null),!this.preventCreateTokens&&(this.$input.data("edit")&&!this.$input.is(document.activeElement)||this.options.createTokensOnBlur)&&this.createTokensFromInput(t),this.preventDeactivation=!1,this.preventCreateTokens=!1},paste:function(t){var e=this;e.options.allowPasting&&setTimeout((function(){e.createTokensFromInput(t)}),1)},change:function(t){"tokenfield"!==t.initiator&&this.setTokens(this.$element.val())},createTokensFromInput:function(t,e){if(!(this.$input.val().length<this.options.minLength)){var n=this.getTokensList();return this.setTokens(this.$input.val(),!0),this.$input.data("edit")&&!this.$input.val()&&this.$element.val(this.getTokensList()),n==this.getTokensList()&&this.$input.val().length?!1:(this.setInput(""),this.$input.data("edit")&&this.unedit(e),!1)}},next:function(t){if(t){var e=this.$wrapper.find(".active:first");if(!(!e||!this.$firstActiveToken)&&e.index()<this.$firstActiveToken.index())return this.deactivate(e)}var n=this.$wrapper.find(".active:last").nextAll(".token:first");n.length?this.activate(n,t):this.$input.focus()},prev:function(t){if(t){var e=this.$wrapper.find(".active:last");if(!(!e||!this.$firstActiveToken)&&e.index()>this.$firstActiveToken.index())return this.deactivate(e)}var n=this.$wrapper.find(".active:first").prevAll(".token:first");n.length||(n=this.$wrapper.find(".token:first")),n.length||t?this.activate(n,t):this.$input.focus()},activate:function(e,n,i,s){if(e){if(void 0===s)s=!0;if(i)n=!0;if(this.$copyHelper.focus(),n||(this.$wrapper.find(".active").removeClass("active"),s?this.$firstActiveToken=e:delete this.$firstActiveToken),i&&this.$firstActiveToken){var r=this.$firstActiveToken.index()-2,o=e.index()-2,a=this;this.$wrapper.find(".token").slice(Math.min(r,o)+1,Math.max(r,o)).each((function(){a.activate(t(this),!0)}))}e.addClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select()}},activateAll:function(){var e=this;this.$wrapper.find(".token").each((function(n){e.activate(t(this),0!==n,!1,!1)}))},deactivate:function(t){t&&(t.removeClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select())},toggle:function(t){t&&(t.toggleClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select())},edit:function(e){if(e){var n=e.data("attrs"),i={attrs:n,relatedTarget:e.get(0)},s=t.Event("tokenfield:edittoken",i);if(this.$element.trigger(s),!s.isDefaultPrevented()){e.find(".token-label").text(n.value);var r=e.outerWidth(),o=this.$input.hasClass("tt-input")?this.$input.parent():this.$input;e.replaceWith(o),this.preventCreateTokens=!0,this.$input.val(n.value).select().data("edit",!0).width(r),this.update(),this.$element.trigger(t.Event("tokenfield:editedtoken",i))}}},unedit:function(t){if((this.$input.hasClass("tt-input")?this.$input.parent():this.$input).appendTo(this.$wrapper),this.$input.data("edit",!1),this.$mirror.text(""),this.update(),t){var e=this;setTimeout((function(){e.$input.focus()}),1)}},remove:function(e,n){if(!(this.$input.is(document.activeElement)||this._disabled||this._readonly)){var i="click"===e.type?t(e.target).closest(".token"):this.$wrapper.find(".token.active");if("click"!==e.type){if(!n)n="prev";if(this[n](),"prev"===n)var s=0===i.first().prevAll(".token:first").length}var r={attrs:this.getTokenData(i),relatedTarget:i.get(0)},o=t.Event("tokenfield:removetoken",r);if(this.$element.trigger(o),!o.isDefaultPrevented()){var a=t.Event("tokenfield:removedtoken",r),l=t.Event("change",{initiator:"tokenfield"});i.remove(),this.$element.val(this.getTokensList()).trigger(a).trigger(l),this.$wrapper.find(".token").length&&"click"!==e.type&&!s||this.$input.focus(),this.$input.css("width",this.options.minWidth+"px"),this.update(),e.preventDefault(),e.stopPropagation()}}},update:function(){var t=this.$input.val(),e=parseInt(this.$input.css("padding-left"),10)+parseInt(this.$input.css("padding-right"),10);if(this.$input.data("edit")){if(t||(t=this.$input.prop("placeholder")),t===this.$mirror.text())return;this.$mirror.text(t);var n=this.$mirror.width()+10;if(n>this.$wrapper.width())return this.$input.width(this.$wrapper.width());this.$input.width(n)}else{this.$input.width(this.options.minWidth);var i="rtl"===this.textDirection?this.$input.offset().left+this.$input.outerWidth()-this.$wrapper.offset().left-parseInt(this.$wrapper.css("padding-left"),10)-e-1:this.$wrapper.offset().left+this.$wrapper.width()+parseInt(this.$wrapper.css("padding-left"),10)-this.$input.offset().left-e;isNaN(i)?this.$input.width("100%"):this.$input.width(i)}},focusInput:function(e){if(!(t(e.target).closest(".token").length||t(e.target).closest(".token-input").length||t(e.target).closest(".tt-dropdown-menu").length)){var n=this;setTimeout((function(){n.$input.focus()}),0)}},search:function(){this.$input.data("ui-autocomplete")&&this.$input.autocomplete("search")},disable:function(){this.setProperty("disabled",!0)},enable:function(){this.setProperty("disabled",!1)},readonly:function(){this.setProperty("readonly",!0)},writeable:function(){this.setProperty("readonly",!1)},setProperty:function(t,e){this["_"+t]=e,this.$input.prop(t,e),this.$element.prop(t,e),this.$wrapper[e?"addClass":"removeClass"](t)},destroy:function(){this.$element.val(this.getTokensList()),this.$element.css(this.$element.data("original-styles")),this.$element.prop("tabindex",this.$element.data("original-tabindex"));var e=t('label[for="'+this.$input.prop("id")+'"]');return e.length&&e.prop("for",this.$element.prop("id")),this.$element.insertBefore(this.$wrapper),this.$element.removeData("original-styles").removeData("original-tabindex").removeData("bs.tokenfield"),this.$wrapper.remove(),this.$mirror.remove(),this.$element}};var i=t.fn.tokenfield;return t.fn.tokenfield=function(e,i){var s,r=[];Array.prototype.push.apply(r,arguments);var o=this.each((function(){var o=t(this),a=o.data("bs.tokenfield"),l="object"==typeof e&&e;"string"==typeof e&&a&&a[e]?(r.shift(),s=a[e].apply(a,r)):a||"string"==typeof e||i||(o.data("bs.tokenfield",a=new n(this,l)),o.trigger("tokenfield:initialize"))}));return void 0!==s?s:o},t.fn.tokenfield.defaults={minWidth:60,minLength:0,allowEditing:!0,allowPasting:!0,limit:0,autocomplete:{},typeahead:{},showAutocompleteOnFocus:!1,createTokensOnBlur:!1,delimiter:",",beautify:!0,inputType:"text"},t.fn.tokenfield.Constructor=n,t.fn.tokenfield.noConflict=function(){return t.fn.tokenfield=i,this},n})),function(t,e){"object"==typeof exports&&void 0!==module?e():"function"==typeof define&&define.amd?define(e):e()}(0,(function(){"use strict";function t(t){var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){return e.reject(n)}))}))}function e(t){return!(!t||void 0===t.length)}function n(){}function i(t){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(t,this)}function s(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,i._immediateFn((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var i;try{i=n(t._value)}catch(t){return void o(e.promise,t)}r(e.promise,i)}else(1===t._state?r:o)(e.promise,t._value)}))):t._deferreds.push(e)}function r(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void a(t);if("function"==typeof n)return void l(function(t,e){return function(){t.apply(e,arguments)}}(n,e),t)}t._state=1,t._value=e,a(t)}catch(e){o(t,e)}}function o(t,e){t._state=2,t._value=e,a(t)}function a(t){2===t._state&&0===t._deferreds.length&&i._immediateFn((function(){t._handled||i._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;n>e;e++)s(t,t._deferreds[e]);t._deferreds=null}function l(t,e){var n=!1;try{t((function(t){n||(n=!0,r(e,t))}),(function(t){n||(n=!0,o(e,t))}))}catch(t){if(n)return;n=!0,o(e,t)}}var c=setTimeout;i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var i=new this.constructor(n);return s(this,new function(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}(t,e,i)),i},i.prototype.finally=t,i.all=function(t){return new i((function(n,i){function s(t,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var a=e.then;if("function"==typeof a)return void a.call(e,(function(e){s(t,e)}),i)}r[t]=e,0==--o&&n(r)}catch(t){i(t)}}if(!e(t))return i(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(t);if(0===r.length)return n([]);for(var o=r.length,a=0;r.length>a;a++)s(a,r[a])}))},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i((function(e){e(t)}))},i.reject=function(t){return new i((function(e,n){n(t)}))},i.race=function(t){return new i((function(n,s){if(!e(t))return s(new TypeError("Promise.race accepts an array"));for(var r=0,o=t.length;o>r;r++)i.resolve(t[r]).then(n,s)}))},i._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){c(t,0)},i._unhandledRejectionFn=function(t){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var u=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in u?u.Promise.prototype.finally||(u.Promise.prototype.finally=t):u.Promise=i})),function(t,e){"object"==typeof exports&&void 0!==module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).clipboard={})}(this,(function(t){"use strict";function e(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))}function n(t,e){function n(n){return function(o){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,s&&(r=2&n[0]?s.return:n[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,n[1])).done)return r;switch(s=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,s=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){a.label=n[1];break}if(6===n[0]&&a.label<r[1]){a.label=r[1],r=n;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(n);break}r[2]&&a.ops.pop(),a.trys.pop();continue}n=e.call(t,a)}catch(t){n=[6,t],s=0}finally{i=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,o])}}var i,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o}function i(t){w(t)}function s(){return k}function r(){return"undefined"==typeof ClipboardEvent&&void 0!==M.clipboardData&&void 0!==M.clipboardData.setData}function o(){return e(this,void 0,void 0,(function(){var t;return n(this,(function(){if(""===(t=M.clipboardData.getData("Text")))throw new Error("Empty clipboard or could not read plain text from clipboard");return[2,t]}))}))}function a(t,e,n){for(var s in i("listener called"),t.success=!0,e){var r=e[s],o=n.clipboardData;o.setData(s,r),"text/plain"===s&&o.getData(s)!==r&&(i("setting text/plain failed"),t.success=!1)}n.preventDefault()}function l(t){var e=new R,n=a.bind(this,e,t);document.addEventListener("copy",n);try{document.execCommand("copy")}finally{document.removeEventListener("copy",n)}return e.success}function c(t,e){u(t);var n=l(e);return p(),n}function u(t){var e=document.getSelection();if(e){var n=document.createRange();n.selectNodeContents(t),e.removeAllRanges(),e.addRange(n)}}function p(){var t=document.getSelection();t&&t.removeAllRanges()}function h(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(){if(e="text/plain"in t,r()){if(!e)throw new Error("No `text/plain` value was specified.");if(n=t["text/plain"],M.clipboardData.setData("Text",n))return[2,!0];throw new Error("Copying failed, possibly because the user rejected it.")}var n;return l(t)?(i("regular execCopy worked"),[2,!0]):navigator.userAgent.indexOf("Edge")>-1?(i('UA "Edge" => assuming success'),[2,!0]):c(document.body,t)?(i("copyUsingTempSelection worked"),[2,!0]):function(t){var e=document.createElement("div");e.setAttribute("style","-webkit-user-select: text !important"),e.textContent="temporary element",document.body.appendChild(e);var n=c(e,t);return document.body.removeChild(e),n}(t)?(i("copyUsingTempElem worked"),[2,!0]):function(t){i("copyTextUsingDOM");var e=document.createElement("div");e.setAttribute("style","-webkit-user-select: text !important");var n=e;e.attachShadow&&(i("Using shadow DOM."),n=e.attachShadow({mode:"open"}));var s=document.createElement("span");s.innerText=t,n.appendChild(s),document.body.appendChild(e),u(s);var r=document.execCommand("copy");return p(),document.body.removeChild(e),r}(t["text/plain"])?(i("copyTextUsingDOM worked"),[2,!0]):[2,!1]}))}))}function d(){return e(this,void 0,void 0,(function(){return n(this,(function(){if(P)return i("Using `navigator.clipboard.readText()`."),[2,P()];if(r())return i("Reading text using IE strategy."),[2,o()];throw new Error("Read is not supported in your browser.")}))}))}function f(t,e){for(var n=0,i=t;n<i.length;n++)if(-1!==i[n].types.indexOf(e))return!0;return!1}function m(t,e){return new Blob([e],{type:t})}function g(t){return e(this,void 0,void 0,(function(){return n(this,(function(){return[2,new Promise((function(e,n){var i=new FileReader;i.addEventListener("load",(function(){var t=i.result;"string"==typeof t?e(t):n("could not convert blob to string")})),i.readAsText(t)}))]}))}))}function v(t){return e(this,void 0,void 0,(function(){var e,i,s,r,o,a,l;return n(this,(function(n){switch(n.label){case 0:e={},i=0,s=t.types,n.label=1;case 1:return i<s.length?(r=s[i],o=e,a=r,[4,t.getType(r)]):[3,4];case 2:o[a]=n.sent(),n.label=3;case 3:return i++,[3,1];case 4:return l={},t.presentationStyle&&(l.presentationStyle=t.presentationStyle),[2,new N(e,l)]}}))}))}function y(t){var e={};return e["text/plain"]=m(t,"text/plain"),new L(e)}function b(t,i){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,t.getType(i)];case 1:return[4,g(e.sent())];case 2:return[2,e.sent()]}}))}))}function _(t){return e(this,void 0,void 0,(function(){var e,i,s,r,o,a;return n(this,(function(n){switch(n.label){case 0:e={},i=0,s=t.types,n.label=1;case 1:return i<s.length?(r=s[i],o=e,a=r,[4,b(t,r)]):[3,4];case 2:o[a]=n.sent(),n.label=3;case 3:return i++,[3,1];case 4:return[2,e]}}))}))}var w=function(){},k=!0;(function(){(console.warn||console.log).apply(console,arguments)}).bind("[clipboard-polyfill]");var A,C,T,S,x="undefined"==typeof navigator?void 0:navigator,j=null==x?void 0:x.clipboard,D=null===(A=null==j?void 0:j.read)||void 0===A?void 0:A.bind(j),P=null===(C=null==j?void 0:j.readText)||void 0===C?void 0:C.bind(j),E=null===(T=null==j?void 0:j.write)||void 0===T?void 0:T.bind(j),I=null===(S=null==j?void 0:j.writeText)||void 0===S?void 0:S.bind(j),O="undefined"==typeof window?void 0:window,N=null==O?void 0:O.ClipboardItem,M=O,R=function(){this.success=!1},L=function(){function t(t,e){var n;for(var i in void 0===e&&(e={}),this.types=Object.keys(t),this._items={},t){var s=t[i];this._items[i]="string"==typeof s?m(i,s):s}this.presentationStyle=null!==(n=null==e?void 0:e.presentationStyle)&&void 0!==n?n:"unspecified"}return t.prototype.getType=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(){return[2,this._items[t]]}))}))},t}();t.ClipboardItem=L,t.read=function(){return e(this,void 0,void 0,(function(){var t;return n(this,(function(e){switch(e.label){case 0:return D?(i("Using `navigator.clipboard.read()`."),[2,D()]):(t=y,[4,d()]);case 1:return[2,[t.apply(void 0,[e.sent()])]]}}))}))},t.readText=d,t.setDebugLog=function(t){w=t},t.suppressWarnings=function(){k=!1},t.write=function(t){return e(this,void 0,void 0,(function(){var e,r,o,a;return n(this,(function(n){switch(n.label){case 0:return E&&N?(i("Using `navigator.clipboard.write()`."),[4,Promise.all(t.map(v))]):[3,5];case 1:e=n.sent(),n.label=2;case 2:return n.trys.push([2,4,,5]),[4,E(e)];case 3:return[2,n.sent()];case 4:if(r=n.sent(),!f(t,"text/plain")&&!f(t,"text/html"))throw r;return[3,5];case 5:return o=f(t,"text/plain"),s&&!o&&i("clipboard.write() was called without a `text/plain` data type. On some platforms, this may result in an empty clipboard. Call suppressWarnings() to suppress this warning."),a=h,[4,_(t[0])];case 6:if(!a.apply(void 0,[n.sent()]))throw new Error("write() failed");return[2]}}))}))},t.writeText=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(){if(I)return i("Using `navigator.clipboard.writeText()`."),[2,I(t)];if(!h(function(t){var e={};return e["text/plain"]=t,e}(t)))throw new Error("writeText() failed");return[2]}))}))},Object.defineProperty(t,"__esModule",{value:!0})})),function(t,e){"object"==typeof exports&&void 0!==module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).CodeMirror=e()}(this,(function(){"use strict";function t(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function e(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function n(t,n){return e(t).appendChild(n)}function i(t,e,n,i){var s=document.createElement(t);if(n&&(s.className=n),i&&(s.style.cssText=i),"string"==typeof e)s.appendChild(document.createTextNode(e));else if(e)for(var r=0;r<e.length;++r)s.appendChild(e[r]);return s}function s(t,e,n,s){var r=i(t,e,n,s);return r.setAttribute("role","presentation"),r}function r(t,e){if(3==e.nodeType&&(e=e.parentNode),t.contains)return t.contains(e);do{if(11==e.nodeType&&(e=e.host),e==t)return!0}while(e=e.parentNode)}function o(t){var e;try{e=t.activeElement}catch(n){e=t.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function a(e,n){var i=e.className;t(n).test(i)||(e.className+=(i?" ":"")+n)}function l(e,n){for(var i=e.split(" "),s=0;s<i.length;s++)i[s]&&!t(i[s]).test(n)&&(n+=" "+i[s]);return n}function c(t){return t.display.wrapper.ownerDocument}function u(t){return c(t).defaultView}function p(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function h(t,e,n){for(var i in e||(e={}),t)!t.hasOwnProperty(i)||!1===n&&e.hasOwnProperty(i)||(e[i]=t[i]);return e}function d(t,e,n,i,s){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);for(var r=i||0,o=s||0;;){var a=t.indexOf("\t",r);if(a<0||a>=e)return o+(e-r);o+=a-r,o+=n-o%n,r=a+1}}function f(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}function m(t,e,n){for(var i=0,s=0;;){var r=t.indexOf("\t",i);-1==r&&(r=t.length);var o=r-i;if(r==t.length||s+o>=e)return i+Math.min(o,e-s);if(s+=r-i,i=r+1,(s+=n-s%n)>=e)return i}}function g(t){for(;ta.length<=t;)ta.push(v(ta)+" ");return ta[t]}function v(t){return t[t.length-1]}function y(t,e){for(var n=[],i=0;i<t.length;i++)n[i]=e(t[i],i);return n}function b(t,e,n){for(var i=0,s=n(e);i<t.length&&n(t[i])<=s;)i++;t.splice(i,0,e)}function _(){}function w(t,e){var n;return Object.create?n=Object.create(t):(_.prototype=t,n=new _),e&&h(e,n),n}function k(t){return/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||ea.test(t))}function A(t,e){return e?!!(e.source.indexOf("\\w")>-1&&k(t))||e.test(t):k(t)}function C(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function T(t){return t.charCodeAt(0)>=768&&na.test(t)}function S(t,e,n){for(;(n<0?e>0:e<t.length)&&T(t.charAt(e));)e+=n;return e}function x(t,e,n){for(var i=e>n?-1:1;;){if(e==n)return e;var s=(e+n)/2,r=i<0?Math.ceil(s):Math.floor(s);if(r==e)return t(r)?e:n;t(r)?n=r:e=r+i}}function j(t,e,n,i){if(!t)return i(e,n,"ltr",0);for(var s=!1,r=0;r<t.length;++r){var o=t[r];(o.from<n&&o.to>e||e==n&&o.to==e)&&(i(Math.max(o.from,e),Math.min(o.to,n),1==o.level?"rtl":"ltr",r),s=!0)}s||i(e,n,"ltr")}function D(t,e,n){var i;ia=null;for(var s=0;s<t.length;++s){var r=t[s];if(r.from<e&&r.to>e)return s;r.to==e&&(r.from!=r.to&&"before"==n?i=s:ia=s),r.from==e&&(r.from!=r.to&&"before"!=n?i=s:ia=s)}return null!=i?i:ia}function P(t,e){var n=t.order;return null==n&&(n=t.order=sa(t.text,e)),n}function E(t,e){return t._handlers&&t._handlers[e]||ra}function I(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var i=t._handlers,s=i&&i[e];if(s){var r=f(s,n);r>-1&&(i[e]=s.slice(0,r).concat(s.slice(r+1)))}}}function O(t,e){var n=E(t,e);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),s=0;s<n.length;++s)n[s].apply(null,i)}function N(t,e,n){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),O(t,n||e.type,t,e),B(e)||e.codemirrorIgnore}function M(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),i=0;i<e.length;++i)-1==f(n,e[i])&&n.push(e[i])}function R(t,e){return E(t,e).length>0}function L(t){t.prototype.on=function(t,e){oa(this,t,e)},t.prototype.off=function(t,e){I(this,t,e)}}function F(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function $(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function B(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function z(t){F(t),$(t)}function U(t){return t.target||t.srcElement}function q(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),Lo&&t.ctrlKey&&1==e&&(e=3),e}function W(t){if(null==Vo){var e=i("span","\u200b");n(t,i("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Vo=e.offsetWidth<=1&&e.offsetHeight>2&&!(Co&&To<8))}var s=Vo?i("span","\u200b"):i("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px");return s.setAttribute("cm-text",""),s}function H(t){if(null!=Go)return Go;var i=n(t,document.createTextNode("A\u062eA")),s=zo(i,0,1).getBoundingClientRect(),r=zo(i,1,2).getBoundingClientRect();return e(t),!(!s||s.left==s.right)&&(Go=r.right-s.right<3)}function J(t){if(null!=pa)return pa;var e=n(t,i("span","x")),s=e.getBoundingClientRect(),r=zo(e,0,1).getBoundingClientRect();return pa=Math.abs(s.left-r.left)>1}function V(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),ha[t]=e}function G(t,e){da[t]=e}function K(t){if("string"==typeof t&&da.hasOwnProperty(t))t=da[t];else if(t&&"string"==typeof t.name&&da.hasOwnProperty(t.name)){var e=da[t.name];"string"==typeof e&&(e={name:e}),(t=w(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return K("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return K("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Y(t,e){e=K(e);var n=ha[e.name];if(!n)return Y(t,"text/plain");var i=n(t,e);if(fa.hasOwnProperty(e.name)){var s=fa[e.name];for(var r in s)s.hasOwnProperty(r)&&(i.hasOwnProperty(r)&&(i["_"+r]=i[r]),i[r]=s[r])}if(i.name=e.name,e.helperType&&(i.helperType=e.helperType),e.modeProps)for(var o in e.modeProps)i[o]=e.modeProps[o];return i}function X(t,e){h(e,fa.hasOwnProperty(t)?fa[t]:fa[t]={})}function Z(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var i in e){var s=e[i];s instanceof Array&&(s=s.concat([])),n[i]=s}return n}function Q(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function tt(t,e,n){return!t.startState||t.startState(e,n)}function et(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var i=0;;++i){var s=n.children[i],r=s.chunkSize();if(e<r){n=s;break}e-=r}return n.lines[e]}function nt(t,e,n){var i=[],s=e.line;return t.iter(e.line,n.line+1,(function(t){var r=t.text;s==n.line&&(r=r.slice(0,n.ch)),s==e.line&&(r=r.slice(e.ch)),i.push(r),++s})),i}function it(t,e,n){var i=[];return t.iter(e,n,(function(t){i.push(t.text)})),i}function st(t,e){var n=e-t.height;if(n)for(var i=t;i;i=i.parent)i.height+=n}function rt(t){if(null==t.parent)return null;for(var e=t.parent,n=f(e.lines,t),i=e.parent;i;e=i,i=i.parent)for(var s=0;i.children[s]!=e;++s)n+=i.children[s].chunkSize();return n+e.first}function ot(t,e){var n=t.first;t:do{for(var i=0;i<t.children.length;++i){var s=t.children[i],r=s.height;if(e<r){t=s;continue t}e-=r,n+=s.chunkSize()}return n}while(!t.lines);for(var o=0;o<t.lines.length;++o){var a=t.lines[o].height;if(e<a)break;e-=a}return n+o}function at(t,e){return e>=t.first&&e<t.first+t.size}function lt(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function ct(t,e,n){if(void 0===n&&(n=null),!(this instanceof ct))return new ct(t,e,n);this.line=t,this.ch=e,this.sticky=n}function ut(t,e){return t.line-e.line||t.ch-e.ch}function pt(t,e){return t.sticky==e.sticky&&0==ut(t,e)}function ht(t){return ct(t.line,t.ch)}function dt(t,e){return ut(t,e)<0?e:t}function ft(t,e){return ut(t,e)<0?t:e}function mt(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function gt(t,e){if(e.line<t.first)return ct(t.first,0);var n=t.first+t.size-1;return e.line>n?ct(n,et(t,n).text.length):vt(e,et(t,e.line).text.length)}function vt(t,e){var n=t.ch;return null==n||n>e?ct(t.line,e):n<0?ct(t.line,0):t}function yt(t,e){for(var n=[],i=0;i<e.length;i++)n[i]=gt(t,e[i]);return n}function bt(t,e,n,i){var s=[t.state.modeGen],r={};xt(t,e.text,t.doc.mode,n,(function(t,e){return s.push(t,e)}),r,i);for(var o=n.state,a=function(i){n.baseTokens=s;var a=t.state.overlays[i],l=1,c=0;n.state=!0,xt(t,e.text,a.mode,n,(function(t,e){for(var n=l;c<t;){var i=s[l];i>t&&s.splice(l,1,t,s[l+1],i),l+=2,c=Math.min(t,i)}if(e)if(a.opaque)s.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;n<l;n+=2){var r=s[n+1];s[n+1]=(r?r+" ":"")+"overlay "+e}}),r),n.state=o,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)a(l);return{styles:s,classes:r.bgClass||r.textClass?r:null}}function _t(t,e,n){if(!e.styles||e.styles[0]!=t.state.modeGen){var i=wt(t,rt(e)),s=e.text.length>t.options.maxHighlightLength&&Z(t.doc.mode,i.state),r=bt(t,e,i);s&&(i.state=s),e.stateAfter=i.save(!s),e.styles=r.styles,r.classes?e.styleClasses=r.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function wt(t,e,n){var i=t.doc,s=t.display;if(!i.mode.startState)return new va(i,!0,e);var r=jt(t,e,n),o=r>i.first&&et(i,r-1).stateAfter,a=o?va.fromSaved(i,o,r):new va(i,tt(i.mode),r);return i.iter(r,e,(function(n){kt(t,n.text,a);var i=a.line;n.stateAfter=i==e-1||i%5==0||i>=s.viewFrom&&i<s.viewTo?a.save():null,a.nextLine()})),n&&(i.modeFrontier=a.line),a}function kt(t,e,n,i){var s=t.doc.mode,r=new ma(e,t.options.tabSize,n);for(r.start=r.pos=i||0,""==e&&At(s,n.state);!r.eol();)Ct(s,r,n.state),r.start=r.pos}function At(t,e){if(t.blankLine)return t.blankLine(e);if(t.innerMode){var n=Q(t,e);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Ct(t,e,n,i){for(var s=0;s<10;s++){i&&(i[0]=Q(t,n).mode);var r=t.token(e,n);if(e.pos>e.start)return r}throw new Error("Mode "+t.name+" failed to advance stream.")}function Tt(t,e,n,i){var s,r,o=t.doc,a=o.mode,l=et(o,(e=gt(o,e)).line),c=wt(t,e.line,n),u=new ma(l.text,t.options.tabSize,c);for(i&&(r=[]);(i||u.pos<e.ch)&&!u.eol();)u.start=u.pos,s=Ct(a,u,c.state),i&&r.push(new ya(u,s,Z(o.mode,c.state)));return i?r:new ya(u,s,c.state)}function St(t,e){if(t)for(;;){var n=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;t=t.slice(0,n.index)+t.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";null==e[i]?e[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(e[i])||(e[i]+=" "+n[2])}return t}function xt(t,e,n,i,s,r,o){var a=n.flattenSpans;null==a&&(a=t.options.flattenSpans);var l,c=0,u=null,p=new ma(e,t.options.tabSize,i),h=t.options.addModeClass&&[null];for(""==e&&St(At(n,i.state),r);!p.eol();){if(p.pos>t.options.maxHighlightLength?(a=!1,o&&kt(t,e,i,p.pos),p.pos=e.length,l=null):l=St(Ct(n,p,i.state,h),r),h){var d=h[0].name;d&&(l="m-"+(l?d+" "+l:d))}if(!a||u!=l){for(;c<p.start;)s(c=Math.min(p.start,c+5e3),u);u=l}p.start=p.pos}for(;c<p.pos;){var f=Math.min(p.pos,c+5e3);s(f,u),c=f}}function jt(t,e,n){for(var i,s,r=t.doc,o=n?-1:e-(t.doc.mode.innerMode?1e3:100),a=e;a>o;--a){if(a<=r.first)return r.first;var l=et(r,a-1),c=l.stateAfter;if(c&&(!n||a+(c instanceof ga?c.lookAhead:0)<=r.modeFrontier))return a;var u=d(l.text,null,t.options.tabSize);(null==s||i>u)&&(s=a-1,i=u)}return s}function Dt(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontier<e-10)){for(var n=t.first,i=e-1;i>n;i--){var s=et(t,i).stateAfter;if(s&&(!(s instanceof ga)||i+s.lookAhead<e)){n=i+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,n)}}function Pt(){ba=!0}function Et(){_a=!0}function It(t,e,n){this.marker=t,this.from=e,this.to=n}function Ot(t,e){if(t)for(var n=0;n<t.length;++n){var i=t[n];if(i.marker==e)return i}}function Nt(t,e){
for(var n,i=0;i<t.length;++i)t[i]!=e&&(n||(n=[])).push(t[i]);return n}function Mt(t,e,n){var i=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));i&&t.markedSpans&&i.has(t.markedSpans)?t.markedSpans.push(e):(t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],i&&i.add(t.markedSpans)),e.marker.attachLine(t)}function Rt(t,e,n){var i;if(t)for(var s=0;s<t.length;++s){var r=t[s],o=r.marker;if(null==r.from||(o.inclusiveLeft?r.from<=e:r.from<e)||r.from==e&&"bookmark"==o.type&&(!n||!r.marker.insertLeft)){var a=null==r.to||(o.inclusiveRight?r.to>=e:r.to>e);(i||(i=[])).push(new It(o,r.from,a?null:r.to))}}return i}function Lt(t,e,n){var i;if(t)for(var s=0;s<t.length;++s){var r=t[s],o=r.marker;if(null==r.to||(o.inclusiveRight?r.to>=e:r.to>e)||r.from==e&&"bookmark"==o.type&&(!n||r.marker.insertLeft)){var a=null==r.from||(o.inclusiveLeft?r.from<=e:r.from<e);(i||(i=[])).push(new It(o,a?null:r.from-e,null==r.to?null:r.to-e))}}return i}function Ft(t,e){if(e.full)return null;var n=at(t,e.from.line)&&et(t,e.from.line).markedSpans,i=at(t,e.to.line)&&et(t,e.to.line).markedSpans;if(!n&&!i)return null;var s=e.from.ch,r=e.to.ch,o=0==ut(e.from,e.to),a=Rt(n,s,o),l=Lt(i,r,o),c=1==e.text.length,u=v(e.text).length+(c?s:0);if(a)for(var p=0;p<a.length;++p){var h=a[p];if(null==h.to){var d=Ot(l,h.marker);d?c&&(h.to=null==d.to?null:d.to+u):h.to=s}}if(l)for(var f=0;f<l.length;++f){var m=l[f];if(null!=m.to&&(m.to+=u),null==m.from)Ot(a,m.marker)||(m.from=u,c&&(a||(a=[])).push(m));else m.from+=u,c&&(a||(a=[])).push(m)}a&&(a=$t(a)),l&&l!=a&&(l=$t(l));var g=[a];if(!c){var y,b=e.text.length-2;if(b>0&&a)for(var _=0;_<a.length;++_)null==a[_].to&&(y||(y=[])).push(new It(a[_].marker,null,null));for(var w=0;w<b;++w)g.push(y);g.push(l)}return g}function $t(t){for(var e=0;e<t.length;++e){var n=t[e];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&t.splice(e--,1)}return t.length?t:null}function Bt(t,e,n){var i=null;if(t.iter(e.line,n.line+1,(function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var n=t.markedSpans[e].marker;!n.readOnly||i&&-1!=f(i,n)||(i||(i=[])).push(n)}})),!i)return null;for(var s=[{from:e,to:n}],r=0;r<i.length;++r)for(var o=i[r],a=o.find(0),l=0;l<s.length;++l){var c=s[l];if(!(ut(c.to,a.from)<0||ut(c.from,a.to)>0)){var u=[l,1],p=ut(c.from,a.from),h=ut(c.to,a.to);(p<0||!o.inclusiveLeft&&!p)&&u.push({from:c.from,to:a.from}),(h>0||!o.inclusiveRight&&!h)&&u.push({from:a.to,to:c.to}),s.splice.apply(s,u),l+=u.length-3}}return s}function zt(t){var e=t.markedSpans;if(e){for(var n=0;n<e.length;++n)e[n].marker.detachLine(t);t.markedSpans=null}}function Ut(t,e){if(e){for(var n=0;n<e.length;++n)e[n].marker.attachLine(t);t.markedSpans=e}}function qt(t){return t.inclusiveLeft?-1:0}function Wt(t){return t.inclusiveRight?1:0}function Ht(t,e){var n=t.lines.length-e.lines.length;if(0!=n)return n;var i=t.find(),s=e.find(),r=ut(i.from,s.from)||qt(t)-qt(e);if(r)return-r;var o=ut(i.to,s.to)||Wt(t)-Wt(e);return o||e.id-t.id}function Jt(t,e){var n,i=_a&&t.markedSpans;if(i)for(var s=void 0,r=0;r<i.length;++r)(s=i[r]).marker.collapsed&&null==(e?s.from:s.to)&&(!n||Ht(n,s.marker)<0)&&(n=s.marker);return n}function Vt(t){return Jt(t,!0)}function Gt(t){return Jt(t,!1)}function Kt(t,e){var n,i=_a&&t.markedSpans;if(i)for(var s=0;s<i.length;++s){var r=i[s];r.marker.collapsed&&(null==r.from||r.from<e)&&(null==r.to||r.to>e)&&(!n||Ht(n,r.marker)<0)&&(n=r.marker)}return n}function Yt(t,e,n,i,s){var r=et(t,e),o=_a&&r.markedSpans;if(o)for(var a=0;a<o.length;++a){var l=o[a];if(l.marker.collapsed){var c=l.marker.find(0),u=ut(c.from,n)||qt(l.marker)-qt(s),p=ut(c.to,i)||Wt(l.marker)-Wt(s);if(!(u>=0&&p<=0||u<=0&&p>=0)&&(u<=0&&(l.marker.inclusiveRight&&s.inclusiveLeft?ut(c.to,n)>=0:ut(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&s.inclusiveLeft?ut(c.from,i)<=0:ut(c.from,i)<0)))return!0}}}function Xt(t){for(var e;e=Vt(t);)t=e.find(-1,!0).line;return t}function Zt(t){for(var e;e=Gt(t);)t=e.find(1,!0).line;return t}function Qt(t){for(var e,n;e=Gt(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function te(t,e){var n=et(t,e),i=Xt(n);return n==i?e:rt(i)}function ee(t,e){if(e>t.lastLine())return e;var n,i=et(t,e);if(!ne(t,i))return e;for(;n=Gt(i);)i=n.find(1,!0).line;return rt(i)+1}function ne(t,e){var n=_a&&e.markedSpans;if(n)for(var i=void 0,s=0;s<n.length;++s)if((i=n[s]).marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&ie(t,e,i))return!0}}function ie(t,e,n){if(null==n.to){var i=n.marker.find(1,!0);return ie(t,i.line,Ot(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==e.text.length)return!0;for(var s=void 0,r=0;r<e.markedSpans.length;++r)if((s=e.markedSpans[r]).marker.collapsed&&!s.marker.widgetNode&&s.from==n.to&&(null==s.to||s.to!=n.from)&&(s.marker.inclusiveLeft||n.marker.inclusiveRight)&&ie(t,e,s))return!0}function se(t){for(var e=0,n=(t=Xt(t)).parent,i=0;i<n.lines.length;++i){var s=n.lines[i];if(s==t)break;e+=s.height}for(var r=n.parent;r;r=(n=r).parent)for(var o=0;o<r.children.length;++o){var a=r.children[o];if(a==n)break;e+=a.height}return e}function re(t){if(0==t.height)return 0;for(var e,n=t.text.length,i=t;e=Vt(i);){var s=e.find(0,!0);i=s.from.line,n+=s.from.ch-s.to.ch}for(i=t;e=Gt(i);){var r=e.find(0,!0);n-=i.text.length-r.from.ch,n+=(i=r.to.line).text.length-r.to.ch}return n}function oe(t){var e=t.display,n=t.doc;e.maxLine=et(n,n.first),e.maxLineLength=re(e.maxLine),e.maxLineChanged=!0,n.iter((function(t){var n=re(t);n>e.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)}))}function ae(t,e,n,i){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),zt(t),Ut(t,n);var s=i?i(t):1;s!=t.height&&st(t,s)}function le(t){t.parent=null,zt(t)}function ce(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?Ca:Aa;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function ue(t,e){var n=s("span",null,null,So?"padding-right: .1px":null),i={pre:s("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var r=0;r<=(e.rest?e.rest.length:0);r++){var o=r?e.rest[r-1]:e.line,a=void 0;i.pos=0,i.addToken=he,H(t.display.measure)&&(a=P(o,t.doc.direction))&&(i.addToken=fe(i.addToken,a)),i.map=[],ge(o,i,_t(t,o,e!=t.display.externalMeasured&&rt(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=l(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=l(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(W(t.display.measure))),0==r?(e.measure.map=i.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(i.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(So){var c=i.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return O(t,"renderLine",t,e.line,i.pre),i.pre.className&&(i.textClass=l(i.pre.className,i.textClass||"")),i}function pe(t){var e=i("span","\u2022","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function he(t,e,n,s,r,o,a){if(e){var l,c=t.splitSpaces?de(e,t.trailingSpace):e,u=t.cm.state.specialChars,p=!1;if(u.test(e)){l=document.createDocumentFragment();for(var h=0;;){u.lastIndex=h;var d=u.exec(e),f=d?d.index-h:e.length-h;if(f){var m=document.createTextNode(c.slice(h,h+f));Co&&To<9?l.appendChild(i("span",[m])):l.appendChild(m),t.map.push(t.pos,t.pos+f,m),t.col+=f,t.pos+=f}if(!d)break;h+=f+1;var v=void 0;if("\t"==d[0]){var y=t.cm.options.tabSize,b=y-t.col%y;(v=l.appendChild(i("span",g(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),t.col+=b}else"\r"==d[0]||"\n"==d[0]?((v=l.appendChild(i("span","\r"==d[0]?"\u240d":"\u2424","cm-invalidchar"))).setAttribute("cm-text",d[0]),t.col+=1):((v=t.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),Co&&To<9?l.appendChild(i("span",[v])):l.appendChild(v),t.col+=1);t.map.push(t.pos,t.pos+1,v),t.pos++}}else t.col+=e.length,l=document.createTextNode(c),t.map.push(t.pos,t.pos+e.length,l),Co&&To<9&&(p=!0),t.pos+=e.length;if(t.trailingSpace=32==c.charCodeAt(e.length-1),n||s||r||p||o||a){var _=n||"";s&&(_+=s),r&&(_+=r);var w=i("span",[l],_,o);if(a)for(var k in a)a.hasOwnProperty(k)&&"style"!=k&&"class"!=k&&w.setAttribute(k,a[k]);return t.content.appendChild(w)}t.content.appendChild(l)}}function de(t,e){if(t.length>1&&!/  /.test(t))return t;for(var n=e,i="",s=0;s<t.length;s++){var r=t.charAt(s);" "!=r||!n||s!=t.length-1&&32!=t.charCodeAt(s+1)||(r="\xa0"),i+=r,n=" "==r}return i}function fe(t,e){return function(n,i,s,r,o,a,l){s=s?s+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+i.length;;){for(var p=void 0,h=0;h<e.length&&!((p=e[h]).to>c&&p.from<=c);h++);if(p.to>=u)return t(n,i,s,r,o,a,l);t(n,i.slice(0,p.to-c),s,r,null,a,l),r=null,i=i.slice(p.to-c),c=p.to}}}function me(t,e,n,i){var s=!i&&n.widgetNode;s&&t.map.push(t.pos,t.pos+e,s),!i&&t.cm.display.input.needsContentAttribute&&(s||(s=t.content.appendChild(document.createElement("span"))),s.setAttribute("cm-marker",n.id)),s&&(t.cm.display.input.setUneditable(s),t.content.appendChild(s)),t.pos+=e,t.trailingSpace=!1}function ge(t,e,n){var i=t.markedSpans,s=t.text,r=0;if(i)for(var o,a,l,c,u,p,h,d=s.length,f=0,m=1,g="",v=0;;){if(v==f){l=c=u=a="",h=null,p=null,v=1/0;for(var y=[],b=void 0,_=0;_<i.length;++_){var w=i[_],k=w.marker;if("bookmark"==k.type&&w.from==f&&k.widgetNode)y.push(k);else if(w.from<=f&&(null==w.to||w.to>f||k.collapsed&&w.to==f&&w.from==f)){if(null!=w.to&&w.to!=f&&v>w.to&&(v=w.to,c=""),k.className&&(l+=" "+k.className),k.css&&(a=(a?a+";":"")+k.css),k.startStyle&&w.from==f&&(u+=" "+k.startStyle),k.endStyle&&w.to==v&&(b||(b=[])).push(k.endStyle,w.to),k.title&&((h||(h={})).title=k.title),k.attributes)for(var A in k.attributes)(h||(h={}))[A]=k.attributes[A];k.collapsed&&(!p||Ht(p.marker,k)<0)&&(p=w)}else w.from>f&&v>w.from&&(v=w.from)}if(b)for(var C=0;C<b.length;C+=2)b[C+1]==v&&(c+=" "+b[C]);if(!p||p.from==f)for(var T=0;T<y.length;++T)me(e,0,y[T]);if(p&&(p.from||0)==f){if(me(e,(null==p.to?d+1:p.to)-f,p.marker,null==p.from),null==p.to)return;p.to==f&&(p=!1)}}if(f>=d)break;for(var S=Math.min(d,v);;){if(g){var x=f+g.length;if(!p){var j=x>S?g.slice(0,S-f):g;e.addToken(e,j,o?o+l:l,u,f+j.length==v?c:"",a,h)}if(x>=S){g=g.slice(S-f),f=S;break}f=x,u=""}g=s.slice(r,r=n[m++]),o=ce(n[m++],e.cm.options)}}else for(var D=1;D<n.length;D+=2)e.addToken(e,s.slice(r,r=n[D]),ce(n[D+1],e.cm.options))}function ve(t,e,n){this.line=e,this.rest=Qt(e),this.size=this.rest?rt(v(this.rest))-n+1:1,this.node=this.text=null,this.hidden=ne(t,e)}function ye(t,e,n){for(var i,s=[],r=e;r<n;r=i){var o=new ve(t.doc,et(t.doc,r),r);i=r+o.size,s.push(o)}return s}function be(t){Ta?Ta.ops.push(t):t.ownsGroup=Ta={ops:[t],delayedCallbacks:[]}}function _e(t){var e=t.delayedCallbacks,n=0;do{for(;n<e.length;n++)e[n].call(null);for(var i=0;i<t.ops.length;i++){var s=t.ops[i];if(s.cursorActivityHandlers)for(;s.cursorActivityCalled<s.cursorActivityHandlers.length;)s.cursorActivityHandlers[s.cursorActivityCalled++].call(null,s.cm)}}while(n<e.length)}function we(t,e){var n=t.ownsGroup;if(n)try{_e(n)}finally{Ta=null,e(n)}}function ke(t,e){var n=E(t,e);if(n.length){var i,s=Array.prototype.slice.call(arguments,2);Ta?i=Ta.delayedCallbacks:Sa?i=Sa:(i=Sa=[],setTimeout(Ae,0));for(var r=function(t){i.push((function(){return n[t].apply(null,s)}))},o=0;o<n.length;++o)r(o)}}function Ae(){var t=Sa;Sa=null;for(var e=0;e<t.length;++e)t[e]()}function Ce(t,e,n,i){for(var s=0;s<e.changes.length;s++){var r=e.changes[s];"text"==r?je(t,e):"gutter"==r?Pe(t,e,n,i):"class"==r?De(t,e):"widget"==r&&Ee(t,e,i)}e.changes=null}function Te(t){return t.node==t.text&&(t.node=i("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),Co&&To<8&&(t.node.style.zIndex=2)),t.node}function Se(t,e){var n=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),e.background)n?e.background.className=n:(e.background.parentNode.removeChild(e.background),e.background=null);else if(n){var s=Te(e);e.background=s.insertBefore(i("div",null,n),s.firstChild),t.display.input.setUneditable(e.background)}}function xe(t,e){var n=t.display.externalMeasured;return n&&n.line==e.line?(t.display.externalMeasured=null,e.measure=n.measure,n.built):ue(t,e)}function je(t,e){var n=e.text.className,i=xe(t,e);e.text==e.node&&(e.node=i.pre),e.text.parentNode.replaceChild(i.pre,e.text),e.text=i.pre,i.bgClass!=e.bgClass||i.textClass!=e.textClass?(e.bgClass=i.bgClass,e.textClass=i.textClass,De(t,e)):n&&(e.text.className=n)}function De(t,e){Se(t,e),e.line.wrapClass?Te(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var n=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=n||""}function Pe(t,e,n,s){if(e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null),e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null),e.line.gutterClass){var r=Te(e);e.gutterBackground=i("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,"left: "+(t.options.fixedGutter?s.fixedPos:-s.gutterTotalWidth)+"px; width: "+s.gutterTotalWidth+"px"),t.display.input.setUneditable(e.gutterBackground),r.insertBefore(e.gutterBackground,e.text)}var o=e.line.gutterMarkers;if(t.options.lineNumbers||o){var a=Te(e),l=e.gutter=i("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?s.fixedPos:-s.gutterTotalWidth)+"px");if(l.setAttribute("aria-hidden","true"),t.display.input.setUneditable(l),a.insertBefore(l,e.text),e.line.gutterClass&&(l.className+=" "+e.line.gutterClass),!t.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(e.lineNumber=l.appendChild(i("div",lt(t.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+s.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),o)for(var c=0;c<t.display.gutterSpecs.length;++c){var u=t.display.gutterSpecs[c].className,p=o.hasOwnProperty(u)&&o[u];p&&l.appendChild(i("div",[p],"CodeMirror-gutter-elt","left: "+s.gutterLeft[u]+"px; width: "+s.gutterWidth[u]+"px"))}}}function Ee(e,n,i){n.alignable&&(n.alignable=null);for(var s=t("CodeMirror-linewidget"),r=n.node.firstChild,o=void 0;r;r=o)o=r.nextSibling,s.test(r.className)&&n.node.removeChild(r);Oe(e,n,i)}function Ie(t,e,n,i){var s=xe(t,e);return e.text=e.node=s.pre,s.bgClass&&(e.bgClass=s.bgClass),s.textClass&&(e.textClass=s.textClass),De(t,e),Pe(t,e,n,i),Oe(t,e,i),e.node}function Oe(t,e,n){if(Ne(t,e.line,e,n,!0),e.rest)for(var i=0;i<e.rest.length;i++)Ne(t,e.rest[i],e,n,!1)}function Ne(t,e,n,s,r){if(e.widgets)for(var o=Te(n),a=0,l=e.widgets;a<l.length;++a){var c=l[a],u=i("div",[c.node],"CodeMirror-linewidget"+(c.className?" "+c.className:""));c.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),Me(c,u,n,s),t.display.input.setUneditable(u),r&&c.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),ke(c,"redraw")}}function Me(t,e,n,i){if(t.noHScroll){(n.alignable||(n.alignable=[])).push(e);var s=i.wrapperWidth;e.style.left=i.fixedPos+"px",t.coverGutter||(s-=i.gutterTotalWidth,e.style.paddingLeft=i.gutterTotalWidth+"px"),e.style.width=s+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-i.gutterTotalWidth+"px"))}function Re(t){if(null!=t.height)return t.height;var e=t.doc.cm;if(!e)return 0;if(!r(document.body,t.node)){var s="position: relative;";t.coverGutter&&(s+="margin-left: -"+e.display.gutters.offsetWidth+"px;"),t.noHScroll&&(s+="width: "+e.display.wrapper.clientWidth+"px;"),n(e.display.measure,i("div",[t.node],null,s))}return t.height=t.node.parentNode.offsetHeight}function Le(t,e){for(var n=U(e);n!=t.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==t.sizer&&n!=t.mover)return!0}function Fe(t){return t.lineSpace.offsetTop}function $e(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Be(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=n(t.measure,i("pre","x","CodeMirror-line-like")),s=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,r={left:parseInt(s.paddingLeft),right:parseInt(s.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(t.cachedPaddingH=r),r}function ze(t){return Ko-t.display.nativeBarWidth}function Ue(t){return t.display.scroller.clientWidth-ze(t)-t.display.barWidth}function qe(t){return t.display.scroller.clientHeight-ze(t)-t.display.barHeight}function We(t,e,n){var i=t.options.lineWrapping,s=i&&Ue(t);if(!e.measure.heights||i&&e.measure.width!=s){var r=e.measure.heights=[];if(i){e.measure.width=s;for(var o=e.text.firstChild.getClientRects(),a=0;a<o.length-1;a++){var l=o[a],c=o[a+1];Math.abs(l.bottom-c.bottom)>2&&r.push((l.bottom+c.top)/2-n.top)}}r.push(n.bottom-n.top)}}function He(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(var i=0;i<t.rest.length;i++)if(t.rest[i]==e)return{map:t.measure.maps[i],cache:t.measure.caches[i]};for(var s=0;s<t.rest.length;s++)if(rt(t.rest[s])>n)return{map:t.measure.maps[s],cache:t.measure.caches[s],before:!0}}}function Je(t,e){var i=rt(e=Xt(e)),s=t.display.externalMeasured=new ve(t.doc,e,i);s.lineN=i;var r=s.built=ue(t,s);return s.text=r.pre,n(t.display.lineMeasure,r.pre),s}function Ve(t,e,n,i){return Ye(t,Ke(t,e),n,i)}function Ge(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[jn(t,e)];var n=t.display.externalMeasured;return n&&e>=n.lineN&&e<n.lineN+n.size?n:void 0}function Ke(t,e){var n=rt(e),i=Ge(t,n);i&&!i.text?i=null:i&&i.changes&&(Ce(t,i,n,An(t)),t.curOp.forceUpdate=!0),i||(i=Je(t,e));var s=He(i,e,n);return{line:e,view:i,rect:null,map:s.map,cache:s.cache,before:s.before,hasHeights:!1}}function Ye(t,e,n,i,s){e.before&&(n=-1);var r,o=n+(i||"");return e.cache.hasOwnProperty(o)?r=e.cache[o]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(We(t,e.view,e.rect),e.hasHeights=!0),(r=Qe(t,e,n,i)).bogus||(e.cache[o]=r)),{left:r.left,right:r.right,top:s?r.rtop:r.top,bottom:s?r.rbottom:r.bottom}}function Xe(t,e,n){for(var i,s,r,o,a,l,c=0;c<t.length;c+=3)if(a=t[c],l=t[c+1],e<a?(s=0,r=1,o="left"):e<l?r=(s=e-a)+1:(c==t.length-3||e==l&&t[c+3]>e)&&(s=(r=l-a)-1,e>=l&&(o="right")),null!=s){if(i=t[c+2],a==l&&n==(i.insertLeft?"left":"right")&&(o=n),"left"==n&&0==s)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)i=t[2+(c-=3)],o="left";if("right"==n&&s==l-a)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)i=t[(c+=3)+2],o="right";break}return{node:i,start:s,end:r,collapse:o,coverStart:a,coverEnd:l}}function Ze(t,e){var n=xa;if("left"==e)for(var i=0;i<t.length&&(n=t[i]).left==n.right;i++);else for(var s=t.length-1;s>=0&&(n=t[s]).left==n.right;s--);return n}function Qe(t,e,n,i){var s,r=Xe(e.map,n,i),o=r.node,a=r.start,l=r.end,c=r.collapse;if(3==o.nodeType){for(var u=0;u<4;u++){for(;a&&T(e.line.text.charAt(r.coverStart+a));)--a;for(;r.coverStart+l<r.coverEnd&&T(e.line.text.charAt(r.coverStart+l));)++l;if((s=Co&&To<9&&0==a&&l==r.coverEnd-r.coverStart?o.parentNode.getBoundingClientRect():Ze(zo(o,a,l).getClientRects(),i)).left||s.right||0==a)break;l=a,a-=1,c="right"}Co&&To<11&&(s=tn(t.display.measure,s))}else{var p;a>0&&(c=i="right"),s=t.options.lineWrapping&&(p=o.getClientRects()).length>1?p["right"==i?p.length-1:0]:o.getBoundingClientRect()}if(Co&&To<9&&!a&&(!s||!s.left&&!s.right)){var h=o.parentNode.getClientRects()[0];s=h?{left:h.left,right:h.left+kn(t.display),top:h.top,bottom:h.bottom}:xa}for(var d=s.top-e.rect.top,f=s.bottom-e.rect.top,m=(d+f)/2,g=e.view.measure.heights,v=0;v<g.length-1&&!(m<g[v]);v++);var y=v?g[v-1]:0,b=g[v],_={left:("right"==c?s.right:s.left)-e.rect.left,right:("left"==c?s.left:s.right)-e.rect.left,top:y,bottom:b};return s.left||s.right||(_.bogus=!0),t.options.singleCursorHeightPerLine||(_.rtop=d,_.rbottom=f),_}function tn(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!J(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*i,bottom:e.bottom*i}}function en(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function nn(t){t.display.externalMeasure=null,e(t.display.lineMeasure);for(var n=0;n<t.display.view.length;n++)en(t.display.view[n])}function sn(t){nn(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function rn(t){return jo&&Mo?-(t.body.getBoundingClientRect().left-parseInt(getComputedStyle(t.body).marginLeft)):t.defaultView.pageXOffset||(t.documentElement||t.body).scrollLeft}function on(t){return jo&&Mo?-(t.body.getBoundingClientRect().top-parseInt(getComputedStyle(t.body).marginTop)):t.defaultView.pageYOffset||(t.documentElement||t.body).scrollTop}function an(t){var e=Xt(t).widgets,n=0;if(e)for(var i=0;i<e.length;++i)e[i].above&&(n+=Re(e[i]));return n}function ln(t,e,n,i,s){if(!s){var r=an(e);n.top+=r,n.bottom+=r}if("line"==i)return n;i||(i="local");var o=se(e);if("local"==i?o+=Fe(t.display):o-=t.display.viewOffset,"page"==i||"window"==i){var a=t.display.lineSpace.getBoundingClientRect();o+=a.top+("window"==i?0:on(c(t)));var l=a.left+("window"==i?0:rn(c(t)));n.left+=l,n.right+=l}return n.top+=o,n.bottom+=o,n}function cn(t,e,n){if("div"==n)return e;var i=e.left,s=e.top;if("page"==n)i-=rn(c(t)),s-=on(c(t));else if("local"==n||!n){var r=t.display.sizer.getBoundingClientRect();i+=r.left,s+=r.top}var o=t.display.lineSpace.getBoundingClientRect();return{left:i-o.left,top:s-o.top}}function un(t,e,n,i,s){return i||(i=et(t.doc,e.line)),ln(t,i,Ve(t,i,e.ch,s),n)}function pn(t,e,n,i,s,r){function o(e,o){var a=Ye(t,s,e,o?"right":"left",r);return o?a.left=a.right:a.right=a.left,ln(t,i,a,n)}function a(t,e,n){return o(n?t-1:t,1==l[e].level!=n)}i=i||et(t.doc,e.line),s||(s=Ke(t,i));var l=P(i,t.doc.direction),c=e.ch,u=e.sticky;if(c>=i.text.length?(c=i.text.length,u="before"):c<=0&&(c=0,u="after"),!l)return o("before"==u?c-1:c,"before"==u);var p=D(l,c,u),h=ia,d=a(c,p,"before"==u);return null!=h&&(d.other=a(c,h,"before"!=u)),d}function hn(t,e){var n=0;e=gt(t.doc,e),t.options.lineWrapping||(n=kn(t.display)*e.ch);var i=et(t.doc,e.line),s=se(i)+Fe(t.display);return{left:n,right:n,top:s,bottom:s+i.height}}function dn(t,e,n,i,s){var r=ct(t,e,n);return r.xRel=s,i&&(r.outside=i),r}function fn(t,e,n){var i=t.doc;if((n+=t.display.viewOffset)<0)return dn(i.first,0,null,-1,-1);var s=ot(i,n),r=i.first+i.size-1;if(s>r)return dn(i.first+i.size-1,et(i,r).text.length,null,1,1);e<0&&(e=0);for(var o=et(i,s);;){var a=yn(t,o,s,e,n),l=Kt(o,a.ch+(a.xRel>0||a.outside>0?1:0));if(!l)return a;var c=l.find(1);if(c.line==s)return c;o=et(i,s=c.line)}}function mn(t,e,n,i){i-=an(e);var s=e.text.length,r=x((function(e){return Ye(t,n,e-1).bottom<=i}),s,0);return{begin:r,end:s=x((function(e){return Ye(t,n,e).top>i}),r,s)}}function gn(t,e,n,i){return n||(n=Ke(t,e)),mn(t,e,n,ln(t,e,Ye(t,n,i),"line").top)}function vn(t,e,n,i){return!(t.bottom<=n)&&(t.top>n||(i?t.left:t.right)>e)}function yn(t,e,n,i,s){s-=se(e);var r=Ke(t,e),o=an(e),a=0,l=e.text.length,c=!0,u=P(e,t.doc.direction);if(u){var p=(t.options.lineWrapping?_n:bn)(t,e,n,r,u,i,s);a=(c=1!=p.level)?p.from:p.to-1,l=c?p.to:p.from-1}var h,d,f=null,m=null,g=x((function(e){var n=Ye(t,r,e);return n.top+=o,n.bottom+=o,!!vn(n,i,s,!1)&&(n.top<=s&&n.left<=i&&(f=e,m=n),!0)}),a,l),v=!1;if(m){var y=i-m.left<m.right-i,b=y==c;g=f+(b?0:1),d=b?"after":"before",h=y?m.left:m.right}else{c||g!=l&&g!=a||g++,d=0==g?"after":g==e.text.length?"before":Ye(t,r,g-(c?1:0)).bottom+o<=s==c?"after":"before";var _=pn(t,ct(n,g,d),"line",e,r);h=_.left,v=s<_.top?-1:s>=_.bottom?1:0}return dn(n,g=S(e.text,g,1),d,v,i-h)}function bn(t,e,n,i,s,r,o){var a=x((function(a){var l=s[a],c=1!=l.level;return vn(pn(t,ct(n,c?l.to:l.from,c?"before":"after"),"line",e,i),r,o,!0)}),0,s.length-1),l=s[a];if(a>0){var c=1!=l.level,u=pn(t,ct(n,c?l.from:l.to,c?"after":"before"),"line",e,i);vn(u,r,o,!0)&&u.top>o&&(l=s[a-1])}return l}function _n(t,e,n,i,s,r,o){var a=mn(t,e,i,o),l=a.begin,c=a.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,p=null,h=0;h<s.length;h++){var d=s[h];if(!(d.from>=c||d.to<=l)){var f=Ye(t,i,1!=d.level?Math.min(c,d.to)-1:Math.max(l,d.from)).right,m=f<r?r-f+1e9:f-r;(!u||p>m)&&(u=d,p=m)}}return u||(u=s[s.length-1]),u.from<l&&(u={from:l,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function wn(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ka){ka=i("pre",null,"CodeMirror-line-like");for(var s=0;s<49;++s)ka.appendChild(document.createTextNode("x")),ka.appendChild(i("br"));ka.appendChild(document.createTextNode("x"))}n(t.measure,ka);var r=ka.offsetHeight/50;return r>3&&(t.cachedTextHeight=r),e(t.measure),r||1}function kn(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=i("span","xxxxxxxxxx"),s=i("pre",[e],"CodeMirror-line-like");n(t.measure,s);var r=e.getBoundingClientRect(),o=(r.right-r.left)/10;return o>2&&(t.cachedCharWidth=o),o||10}function An(t){for(var e=t.display,n={},i={},s=e.gutters.clientLeft,r=e.gutters.firstChild,o=0;r;r=r.nextSibling,++o){var a=t.display.gutterSpecs[o].className;n[a]=r.offsetLeft+r.clientLeft+s,i[a]=r.clientWidth}return{fixedPos:Cn(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:e.wrapper.clientWidth}}function Cn(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Tn(t){var e=wn(t.display),n=t.options.lineWrapping,i=n&&Math.max(5,t.display.scroller.clientWidth/kn(t.display)-3);return function(s){if(ne(t.doc,s))return 0;var r=0;if(s.widgets)for(var o=0;o<s.widgets.length;o++)s.widgets[o].height&&(r+=s.widgets[o].height);return n?r+(Math.ceil(s.text.length/i)||1)*e:r+e}}function Sn(t){var e=t.doc,n=Tn(t);e.iter((function(t){var e=n(t);e!=t.height&&st(t,e)}))}function xn(t,e,n,i){var s=t.display;if(!n&&"true"==U(e).getAttribute("cm-not-content"))return null;var r,o,a=s.lineSpace.getBoundingClientRect();try{r=e.clientX-a.left,o=e.clientY-a.top}catch(t){return null}var l,c=fn(t,r,o);if(i&&c.xRel>0&&(l=et(t.doc,c.line).text).length==c.ch){var u=d(l,l.length,t.options.tabSize)-l.length;c=ct(c.line,Math.max(0,Math.round((r-Be(t.display).left)/kn(t.display))-u))}return c}function jn(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,i=0;i<n.length;i++)if((e-=n[i].size)<0)return i}function Dn(t,e,n,i){null==e&&(e=t.doc.first),null==n&&(n=t.doc.first+t.doc.size),i||(i=0);var s=t.display;if(i&&n<s.viewTo&&(null==s.updateLineNumbers||s.updateLineNumbers>e)&&(s.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=s.viewTo)_a&&te(t.doc,e)<s.viewTo&&En(t);else if(n<=s.viewFrom)_a&&ee(t.doc,n+i)>s.viewFrom?En(t):(s.viewFrom+=i,s.viewTo+=i);else if(e<=s.viewFrom&&n>=s.viewTo)En(t);else if(e<=s.viewFrom){var r=In(t,n,n+i,1);r?(s.view=s.view.slice(r.index),s.viewFrom=r.lineN,s.viewTo+=i):En(t)}else if(n>=s.viewTo){var o=In(t,e,e,-1);o?(s.view=s.view.slice(0,o.index),s.viewTo=o.lineN):En(t)}else{var a=In(t,e,e,-1),l=In(t,n,n+i,1);a&&l?(s.view=s.view.slice(0,a.index).concat(ye(t,a.lineN,l.lineN)).concat(s.view.slice(l.index)),s.viewTo+=i):En(t)}var c=s.externalMeasured;c&&(n<c.lineN?c.lineN+=i:e<c.lineN+c.size&&(s.externalMeasured=null))}function Pn(t,e,n){t.curOp.viewChanged=!0;var i=t.display,s=t.display.externalMeasured;if(s&&e>=s.lineN&&e<s.lineN+s.size&&(i.externalMeasured=null),!(e<i.viewFrom||e>=i.viewTo)){var r=i.view[jn(t,e)];if(null!=r.node){var o=r.changes||(r.changes=[]);-1==f(o,n)&&o.push(n)}}}function En(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function In(t,e,n,i){var s,r=jn(t,e),o=t.display.view;if(!_a||n==t.doc.first+t.doc.size)return{index:r,lineN:n};for(var a=t.display.viewFrom,l=0;l<r;l++)a+=o[l].size;if(a!=e){if(i>0){if(r==o.length-1)return null;s=a+o[r].size-e,r++}else s=a-e;e+=s,n+=s}for(;te(t.doc,n)!=n;){if(r==(i<0?0:o.length-1))return null;n+=i*o[r-(i<0?1:0)].size,r+=i}return{index:r,lineN:n}}function On(t,e,n){var i=t.display;0==i.view.length||e>=i.viewTo||n<=i.viewFrom?(i.view=ye(t,e,n),i.viewFrom=e):(i.viewFrom>e?i.view=ye(t,e,i.viewFrom).concat(i.view):i.viewFrom<e&&(i.view=i.view.slice(jn(t,e))),i.viewFrom=e,i.viewTo<n?i.view=i.view.concat(ye(t,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,jn(t,n)))),i.viewTo=n}function Nn(t){for(var e=t.display.view,n=0,i=0;i<e.length;i++){var s=e[i];s.hidden||s.node&&!s.changes||++n}return n}function Mn(t){t.display.input.showSelection(t.display.input.prepareSelection())}function Rn(t,e){void 0===e&&(e=!0);var n=t.doc,i={},s=i.cursors=document.createDocumentFragment(),r=i.selection=document.createDocumentFragment(),o=t.options.$customCursor;o&&(e=!0);for(var a=0;a<n.sel.ranges.length;a++)if(e||a!=n.sel.primIndex){var l=n.sel.ranges[a];if(!(l.from().line>=t.display.viewTo||l.to().line<t.display.viewFrom)){var c=l.empty();if(o){var u=o(t,l);u&&Ln(t,u,s)}else(c||t.options.showCursorWhenSelecting)&&Ln(t,l.head,s);c||$n(t,l,r)}}return i}function Ln(t,e,n){var s=pn(t,e,"div",null,null,!t.options.singleCursorHeightPerLine),r=n.appendChild(i("div","\xa0","CodeMirror-cursor"));if(r.style.left=s.left+"px",r.style.top=s.top+"px",r.style.height=Math.max(0,s.bottom-s.top)*t.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(t.getWrapperElement().className)){var o=un(t,e,"div",null,null),a=o.right-o.left;r.style.width=(a>0?a:t.defaultCharWidth())+"px"}if(s.other){var l=n.appendChild(i("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=s.other.left+"px",l.style.top=s.other.top+"px",l.style.height=.85*(s.other.bottom-s.other.top)+"px"}}function Fn(t,e){return t.top-e.top||t.left-e.left}function $n(t,e,n){function s(t,e,n,s){e<0&&(e=0),e=Math.round(e),s=Math.round(s),l.appendChild(i("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n                             top: "+e+"px; width: "+(null==n?p-t:n)+"px;\n                             height: "+(s-e)+"px"))}function r(e,n,i){function r(n,i){return un(t,ct(e,n),"div",d,i)}function o(e,n,i){var s=gn(t,d,null,e),o="ltr"==n==("after"==i)?"left":"right";return r("after"==i?s.begin:s.end-(/\s/.test(d.text.charAt(s.end-1))?2:1),o)[o]}var l,c,d=et(a,e),f=d.text.length,m=P(d,a.direction);return j(m,n||0,null==i?f:i,(function(t,e,a,d){var g="ltr"==a,v=r(t,g?"left":"right"),y=r(e-1,g?"right":"left"),b=null==n&&0==t,_=null==i&&e==f,w=0==d,k=!m||d==m.length-1;if(y.top-v.top<=3){var A=(h?_:b)&&k,C=(h?b:_)&&w?u:(g?v:y).left,T=A?p:(g?y:v).right;s(C,v.top,T-C,v.bottom)}else{var S,x,j,D;g?(S=h&&b&&w?u:v.left,x=h?p:o(t,a,"before"),j=h?u:o(e,a,"after"),D=h&&_&&k?p:y.right):(S=h?o(t,a,"before"):u,x=!h&&b&&w?p:v.right,j=!h&&_&&k?u:y.left,D=h?o(e,a,"after"):p),s(S,v.top,x-S,v.bottom),v.bottom<y.top&&s(u,v.bottom,null,y.top),s(j,y.top,D-j,y.bottom)}(!l||Fn(v,l)<0)&&(l=v),Fn(y,l)<0&&(l=y),(!c||Fn(v,c)<0)&&(c=v),Fn(y,c)<0&&(c=y)})),{start:l,end:c}}var o=t.display,a=t.doc,l=document.createDocumentFragment(),c=Be(t.display),u=c.left,p=Math.max(o.sizerWidth,Ue(t)-o.sizer.offsetLeft)-c.right,h="ltr"==a.direction,d=e.from(),f=e.to();if(d.line==f.line)r(d.line,d.ch,f.ch);else{var m=et(a,d.line),g=et(a,f.line),v=Xt(m)==Xt(g),y=r(d.line,d.ch,v?m.text.length+1:null).end,b=r(f.line,v?0:null,f.ch).start;v&&(y.top<b.top-2?(s(y.right,y.top,null,y.bottom),s(u,b.top,b.left,b.bottom)):s(y.right,y.top,b.left-y.right,y.bottom)),y.bottom<b.top&&s(u,y.bottom,null,b.top)}n.appendChild(l)}function Bn(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var n=!0;e.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?e.blinker=setInterval((function(){t.hasFocus()||Wn(t),e.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function zn(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||qn(t))}function Un(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&Wn(t))}),100)}function qn(t,e){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(O(t,"focus",t,e),t.state.focused=!0,a(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),So&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),Bn(t))}function Wn(t,e){t.state.delayingBlurEvent||(t.state.focused&&(O(t,"blur",t,e),t.state.focused=!1,Wo(t.display.wrapper,"CodeMirror-focused")),
clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function Hn(t){for(var e=t.display,n=e.lineDiv.offsetTop,i=Math.max(0,e.scroller.getBoundingClientRect().top),s=e.lineDiv.getBoundingClientRect().top,r=0,o=0;o<e.view.length;o++){var a=e.view[o],l=t.options.lineWrapping,c=void 0,u=0;if(!a.hidden){if(s+=a.line.height,Co&&To<8){var p=a.node.offsetTop+a.node.offsetHeight;c=p-n,n=p}else{var h=a.node.getBoundingClientRect();c=h.bottom-h.top,!l&&a.text.firstChild&&(u=a.text.firstChild.getBoundingClientRect().right-h.left-1)}var d=a.line.height-c;if((d>.005||d<-.005)&&(s<i&&(r-=d),st(a.line,c),Jn(a.line),a.rest))for(var f=0;f<a.rest.length;f++)Jn(a.rest[f]);if(u>t.display.sizerWidth){var m=Math.ceil(u/kn(t.display));m>t.display.maxLineLength&&(t.display.maxLineLength=m,t.display.maxLine=a.line,t.display.maxLineChanged=!0)}}}Math.abs(r)>2&&(e.scroller.scrollTop+=r)}function Jn(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e){var n=t.widgets[e],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Vn(t,e,n){var i=n&&null!=n.top?Math.max(0,n.top):t.scroller.scrollTop;i=Math.floor(i-Fe(t));var s=n&&null!=n.bottom?n.bottom:i+t.wrapper.clientHeight,r=ot(e,i),o=ot(e,s);if(n&&n.ensure){var a=n.ensure.from.line,l=n.ensure.to.line;a<r?(r=a,o=ot(e,se(et(e,a))+t.wrapper.clientHeight)):Math.min(l,e.lastLine())>=o&&(r=ot(e,se(et(e,l))-t.wrapper.clientHeight),o=l)}return{from:r,to:Math.max(o,r+1)}}function Gn(t,e){if(!N(t,"scrollCursorIntoView")){var n=t.display,s=n.sizer.getBoundingClientRect(),r=null,o=n.wrapper.ownerDocument;if(e.top+s.top<0?r=!0:e.bottom+s.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(r=!1),null!=r&&!Oo){var a=i("div","\u200b",null,"position: absolute;\n                         top: "+(e.top-n.viewOffset-Fe(t.display))+"px;\n                         height: "+(e.bottom-e.top+ze(t)+n.barHeight)+"px;\n                         left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(a),a.scrollIntoView(r),t.display.lineSpace.removeChild(a)}}}function Kn(t,e,n,i){var s;null==i&&(i=0),t.options.lineWrapping||e!=n||(n="before"==e.sticky?ct(e.line,e.ch+1,"before"):e,e=e.ch?ct(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e);for(var r=0;r<5;r++){var o=!1,a=pn(t,e),l=n&&n!=e?pn(t,n):a,c=Xn(t,s={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-i,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+i}),u=t.doc.scrollTop,p=t.doc.scrollLeft;if(null!=c.scrollTop&&(si(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(o=!0)),null!=c.scrollLeft&&(oi(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-p)>1&&(o=!0)),!o)break}return s}function Yn(t,e){var n=Xn(t,e);null!=n.scrollTop&&si(t,n.scrollTop),null!=n.scrollLeft&&oi(t,n.scrollLeft)}function Xn(t,e){var n=t.display,i=wn(t.display);e.top<0&&(e.top=0);var s=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,r=qe(t),o={};e.bottom-e.top>r&&(e.bottom=e.top+r);var a=t.doc.height+$e(n),l=e.top<i,c=e.bottom>a-i;if(e.top<s)o.scrollTop=l?0:e.top;else if(e.bottom>s+r){var u=Math.min(e.top,(c?a:e.bottom)-r);u!=s&&(o.scrollTop=u)}var p=t.options.fixedGutter?0:n.gutters.offsetWidth,h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft-p,d=Ue(t)-n.gutters.offsetWidth,f=e.right-e.left>d;return f&&(e.right=e.left+d),e.left<10?o.scrollLeft=0:e.left<h?o.scrollLeft=Math.max(0,e.left+p-(f?0:10)):e.right>d+h-3&&(o.scrollLeft=e.right+(f?0:10)-d),o}function Zn(t,e){null!=e&&(ni(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Qn(t){ni(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function ti(t,e,n){null==e&&null==n||ni(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function ei(t,e){ni(t),t.curOp.scrollToPos=e}function ni(t){var e=t.curOp.scrollToPos;e&&(t.curOp.scrollToPos=null,ii(t,hn(t,e.from),hn(t,e.to),e.margin))}function ii(t,e,n,i){var s=Xn(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-i,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+i});ti(t,s.scrollLeft,s.scrollTop)}function si(t,e){Math.abs(t.doc.scrollTop-e)<2||(_o||Pi(t,{top:e}),ri(t,e,!0),_o&&Pi(t),Ai(t,100))}function ri(t,e,n){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function oi(t,e,n,i){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!i||(t.doc.scrollLeft=e,Ni(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function ai(t){var e=t.display,n=e.gutters.offsetWidth,i=Math.round(t.doc.height+$e(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+ze(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}function li(t,e){e||(e=ai(t));var n=t.display.barWidth,i=t.display.barHeight;ci(t,e);for(var s=0;s<4&&n!=t.display.barWidth||i!=t.display.barHeight;s++)n!=t.display.barWidth&&t.options.lineWrapping&&Hn(t),ci(t,ai(t)),n=t.display.barWidth,i=t.display.barHeight}function ci(t,e){var n=t.display,i=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}function ui(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Wo(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Pa[t.options.scrollbarStyle]((function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),oa(e,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),e.setAttribute("cm-not-content","true")}),(function(e,n){"horizontal"==n?oi(t,e):si(t,e)}),t),t.display.scrollbars.addClass&&a(t.display.wrapper,t.display.scrollbars.addClass)}function pi(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ea,markArrays:null},be(t.curOp)}function hi(t){var e=t.curOp;e&&we(e,(function(t){for(var e=0;e<t.ops.length;e++)t.ops[e].cm.curOp=null;di(t)}))}function di(t){for(var e=t.ops,n=0;n<e.length;n++)fi(e[n]);for(var i=0;i<e.length;i++)mi(e[i]);for(var s=0;s<e.length;s++)gi(e[s]);for(var r=0;r<e.length;r++)vi(e[r]);for(var o=0;o<e.length;o++)yi(e[o])}function fi(t){var e=t.cm,n=e.display;Ti(e),t.updateMaxLine&&oe(e),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new Ia(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function mi(t){t.updatedDisplay=t.mustUpdate&&ji(t.cm,t.update)}function gi(t){var e=t.cm,n=e.display;t.updatedDisplay&&Hn(e),t.barMeasure=ai(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Ve(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+ze(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Ue(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function vi(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&oi(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1);var n=t.focus&&t.focus==o(c(e));t.preparedSelection&&e.display.input.showSelection(t.preparedSelection,n),(t.updatedDisplay||t.startHeight!=e.doc.height)&&li(e,t.barMeasure),t.updatedDisplay&&Oi(e,t.barMeasure),t.selectionChanged&&Bn(e),e.state.focused&&t.updateInput&&e.display.input.reset(t.typing),n&&zn(t.cm)}function yi(t){var e=t.cm,n=e.display,i=e.doc;(t.updatedDisplay&&Di(e,t.update),null==n.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=t.scrollTop&&ri(e,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&oi(e,t.scrollLeft,!0,!0),t.scrollToPos)&&Gn(e,Kn(e,gt(i,t.scrollToPos.from),gt(i,t.scrollToPos.to),t.scrollToPos.margin));var s=t.maybeHiddenMarkers,r=t.maybeUnhiddenMarkers;if(s)for(var o=0;o<s.length;++o)s[o].lines.length||O(s[o],"hide");if(r)for(var a=0;a<r.length;++a)r[a].lines.length&&O(r[a],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=e.display.scroller.scrollTop),t.changeObjs&&O(e,"changes",e,t.changeObjs),t.update&&t.update.finish()}function bi(t,e){if(t.curOp)return e();pi(t);try{return e()}finally{hi(t)}}function _i(t,e){return function(){if(t.curOp)return e.apply(t,arguments);pi(t);try{return e.apply(t,arguments)}finally{hi(t)}}}function wi(t){return function(){if(this.curOp)return t.apply(this,arguments);pi(this);try{return t.apply(this,arguments)}finally{hi(this)}}}function ki(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);pi(e);try{return t.apply(this,arguments)}finally{hi(e)}}}function Ai(t,e){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(e,p(Ci,t))}function Ci(t){var e=t.doc;if(!(e.highlightFrontier>=t.display.viewTo)){var n=+new Date+t.options.workTime,i=wt(t,e.highlightFrontier),s=[];e.iter(i.line,Math.min(e.first+e.size,t.display.viewTo+500),(function(r){if(i.line>=t.display.viewFrom){var o=r.styles,a=r.text.length>t.options.maxHighlightLength?Z(e.mode,i.state):null,l=bt(t,r,i,!0);a&&(i.state=a),r.styles=l.styles;var c=r.styleClasses,u=l.classes;u?r.styleClasses=u:c&&(r.styleClasses=null);for(var p=!o||o.length!=r.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!p&&h<o.length;++h)p=o[h]!=r.styles[h];p&&s.push(i.line),r.stateAfter=i.save(),i.nextLine()}else r.text.length<=t.options.maxHighlightLength&&kt(t,r.text,i),r.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return Ai(t,t.options.workDelay),!0})),e.highlightFrontier=i.line,e.modeFrontier=Math.max(e.modeFrontier,i.line),s.length&&bi(t,(function(){for(var e=0;e<s.length;e++)Pn(t,s[e],"text")}))}}function Ti(t){var e=t.display;!e.scrollbarsClipped&&e.scroller.offsetWidth&&(e.nativeBarWidth=e.scroller.offsetWidth-e.scroller.clientWidth,e.heightForcer.style.height=ze(t)+"px",e.sizer.style.marginBottom=-e.nativeBarWidth+"px",e.sizer.style.borderRightWidth=ze(t)+"px",e.scrollbarsClipped=!0)}function Si(t){if(t.hasFocus())return null;var e=o(c(t));if(!e||!r(t.display.lineDiv,e))return null;var n={activeElt:e};if(window.getSelection){var i=u(t).getSelection();i.anchorNode&&i.extend&&r(t.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}function xi(t){if(t&&t.activeElt&&t.activeElt!=o(t.activeElt.ownerDocument)&&(t.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(t.activeElt.nodeName)&&t.anchorNode&&r(document.body,t.anchorNode)&&r(document.body,t.focusNode))){var e=t.activeElt.ownerDocument,n=e.defaultView.getSelection(),i=e.createRange();i.setEnd(t.anchorNode,t.anchorOffset),i.collapse(!1),n.removeAllRanges(),n.addRange(i),n.extend(t.focusNode,t.focusOffset)}}function ji(t,n){var i=t.display,s=t.doc;if(n.editorIsHidden)return En(t),!1;if(!n.force&&n.visible.from>=i.viewFrom&&n.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Nn(t))return!1;Mi(t)&&(En(t),n.dims=An(t));var r=s.first+s.size,o=Math.max(n.visible.from-t.options.viewportMargin,s.first),a=Math.min(r,n.visible.to+t.options.viewportMargin);i.viewFrom<o&&o-i.viewFrom<20&&(o=Math.max(s.first,i.viewFrom)),i.viewTo>a&&i.viewTo-a<20&&(a=Math.min(r,i.viewTo)),_a&&(o=te(t.doc,o),a=ee(t.doc,a));var l=o!=i.viewFrom||a!=i.viewTo||i.lastWrapHeight!=n.wrapperHeight||i.lastWrapWidth!=n.wrapperWidth;On(t,o,a),i.viewOffset=se(et(t.doc,i.viewFrom)),t.display.mover.style.top=i.viewOffset+"px";var c=Nn(t);if(!l&&0==c&&!n.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var u=Si(t);return c>4&&(i.lineDiv.style.display="none"),Ei(t,i.updateLineNumbers,n.dims),c>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,xi(u),e(i.cursorDiv),e(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,l&&(i.lastWrapHeight=n.wrapperHeight,i.lastWrapWidth=n.wrapperWidth,Ai(t,400)),i.updateLineNumbers=null,!0}function Di(t,e){for(var n=e.viewport,i=!0;;i=!1){if(i&&t.options.lineWrapping&&e.oldDisplayWidth!=Ue(t))i&&(e.visible=Vn(t.display,t.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(t.doc.height+$e(t.display)-qe(t),n.top)}),e.visible=Vn(t.display,t.doc,n),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!ji(t,e))break;Hn(t);var s=ai(t);Mn(t),li(t,s),Oi(t,s),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Pi(t,e){var n=new Ia(t,e);if(ji(t,n)){Hn(t),Di(t,n);var i=ai(t);Mn(t),li(t,i),Oi(t,i),n.finish()}}function Ei(t,n,i){function s(e){var n=e.nextSibling;return So&&Lo&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var r=t.display,o=t.options.lineNumbers,a=r.lineDiv,l=a.firstChild,c=r.view,u=r.viewFrom,p=0;p<c.length;p++){var h=c[p];if(h.hidden);else if(h.node&&h.node.parentNode==a){for(;l!=h.node;)l=s(l);var d=o&&null!=n&&n<=u&&h.lineNumber;h.changes&&(f(h.changes,"gutter")>-1&&(d=!1),Ce(t,h,u,i)),d&&(e(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(lt(t.options,u)))),l=h.node.nextSibling}else{var m=Ie(t,h,u,i);a.insertBefore(m,l)}u+=h.size}for(;l;)l=s(l)}function Ii(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px",ke(t,"gutterChanged",t)}function Oi(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+ze(t)+"px"}function Ni(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var i=Cn(e)-e.scroller.scrollLeft+t.doc.scrollLeft,s=e.gutters.offsetWidth,r=i+"px",o=0;o<n.length;o++)if(!n[o].hidden){t.options.fixedGutter&&(n[o].gutter&&(n[o].gutter.style.left=r),n[o].gutterBackground&&(n[o].gutterBackground.style.left=r));var a=n[o].alignable;if(a)for(var l=0;l<a.length;l++)a[l].style.left=r}t.options.fixedGutter&&(e.gutters.style.left=i+s+"px")}}function Mi(t){if(!t.options.lineNumbers)return!1;var e=t.doc,n=lt(t.options,e.first+e.size-1),s=t.display;if(n.length!=s.lineNumChars){var r=s.measure.appendChild(i("div",[i("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=r.firstChild.offsetWidth,a=r.offsetWidth-o;return s.lineGutter.style.width="",s.lineNumInnerWidth=Math.max(o,s.lineGutter.offsetWidth-a)+1,s.lineNumWidth=s.lineNumInnerWidth+a,s.lineNumChars=s.lineNumInnerWidth?n.length:-1,s.lineGutter.style.width=s.lineNumWidth+"px",Ii(t.display),!0}return!1}function Ri(t,e){for(var n=[],i=!1,s=0;s<t.length;s++){var r=t[s],o=null;if("string"!=typeof r&&(o=r.style,r=r.className),"CodeMirror-linenumbers"==r){if(!e)continue;i=!0}n.push({className:r,style:o})}return e&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Li(t){var n=t.gutters,s=t.gutterSpecs;e(n),t.lineGutter=null;for(var r=0;r<s.length;++r){var o=s[r],a=o.className,l=o.style,c=n.appendChild(i("div",null,"CodeMirror-gutter "+a));l&&(c.style.cssText=l),"CodeMirror-linenumbers"==a&&(t.lineGutter=c,c.style.width=(t.lineNumWidth||1)+"px")}n.style.display=s.length?"":"none",Ii(t)}function Fi(t){Li(t.display),Dn(t),Ni(t)}function $i(t,e,n,r){var o=this;this.input=n,o.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=i("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=s("div",null,"CodeMirror-code"),o.selectionDiv=i("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=i("div",null,"CodeMirror-cursors"),o.measure=i("div",null,"CodeMirror-measure"),o.lineMeasure=i("div",null,"CodeMirror-measure"),o.lineSpace=s("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var a=s("div",[o.lineSpace],"CodeMirror-lines");o.mover=i("div",[a],null,"position: relative"),o.sizer=i("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=i("div",null,null,"position: absolute; height: "+Ko+"px; width: 1px;"),o.gutters=i("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=i("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=i("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),jo&&Do>=105&&(o.wrapper.style.clipPath="inset(0px)"),o.wrapper.setAttribute("translate","no"),Co&&To<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),So||_o&&Ro||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=e.first,o.reportedViewFrom=o.reportedViewTo=e.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=Ri(r.gutters,r.lineNumbers),Li(o),n.init(o)}function Bi(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}}function zi(t){var e=Bi(t);return e.x*=Na,e.y*=Na,e}function Ui(t,e){jo&&102==Do&&(null==t.display.chromeScrollHack?t.display.sizer.style.pointerEvents="none":clearTimeout(t.display.chromeScrollHack),t.display.chromeScrollHack=setTimeout((function(){t.display.chromeScrollHack=null,t.display.sizer.style.pointerEvents=""}),100));var n=Bi(e),i=n.x,s=n.y,r=Na;0===e.deltaMode&&(i=e.deltaX,s=e.deltaY,r=1);var o=t.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,c=a.scrollHeight>a.clientHeight;if(i&&l||s&&c){if(s&&Lo&&So)t:for(var u=e.target,p=o.view;u!=a;u=u.parentNode)for(var h=0;h<p.length;h++)if(p[h].node==u){t.display.currentWheelTarget=u;break t}if(i&&!_o&&!Po&&null!=r)return s&&c&&si(t,Math.max(0,a.scrollTop+s*r)),oi(t,Math.max(0,a.scrollLeft+i*r)),(!s||s&&c)&&F(e),void(o.wheelStartX=null);if(s&&null!=r){var d=s*r,f=t.doc.scrollTop,m=f+o.wrapper.clientHeight;d<0?f=Math.max(0,f+d-50):m=Math.min(t.doc.height,m+d+50),Pi(t,{top:f,bottom:m})}Oa<20&&0!==e.deltaMode&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=i,o.wheelDY=s,setTimeout((function(){if(null!=o.wheelStartX){var t=a.scrollLeft-o.wheelStartX,e=a.scrollTop-o.wheelStartY,n=e&&o.wheelDY&&e/o.wheelDY||t&&o.wheelDX&&t/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Na=(Na*Oa+n)/(Oa+1),++Oa)}}),200)):(o.wheelDX+=i,o.wheelDY+=s))}}function qi(t,e,n){var i=t&&t.options.selectionsMayTouch,s=e[n];e.sort((function(t,e){return ut(t.from(),e.from())})),n=f(e,s);for(var r=1;r<e.length;r++){var o=e[r],a=e[r-1],l=ut(a.to(),o.from());if(i&&!o.empty()?l>0:l>=0){var c=ft(a.from(),o.from()),u=dt(a.to(),o.to()),p=a.empty()?o.from()==o.head:a.from()==a.head;r<=n&&--n,e.splice(--r,2,new Ra(p?u:c,p?c:u))}}return new Ma(e,n)}function Wi(t,e){return new Ma([new Ra(t,e||t)],0)}function Hi(t){return t.text?ct(t.from.line+t.text.length-1,v(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Ji(t,e){if(ut(t,e.from)<0)return t;if(ut(t,e.to)<=0)return Hi(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=Hi(e).ch-e.to.ch),ct(n,i)}function Vi(t,e){for(var n=[],i=0;i<t.sel.ranges.length;i++){var s=t.sel.ranges[i];n.push(new Ra(Ji(s.anchor,e),Ji(s.head,e)))}return qi(t.cm,n,t.sel.primIndex)}function Gi(t,e,n){return t.line==e.line?ct(n.line,t.ch-e.ch+n.ch):ct(n.line+(t.line-e.line),t.ch)}function Ki(t,e,n){for(var i=[],s=ct(t.first,0),r=s,o=0;o<e.length;o++){var a=e[o],l=Gi(a.from,s,r),c=Gi(Hi(a),s,r);if(s=a.to,r=c,"around"==n){var u=t.sel.ranges[o],p=ut(u.head,u.anchor)<0;i[o]=new Ra(p?c:l,p?l:c)}else i[o]=new Ra(l,l)}return new Ma(i,t.sel.primIndex)}function Yi(t){t.doc.mode=Y(t.options,t.doc.modeOption),Xi(t)}function Xi(t){t.doc.iter((function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)})),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,Ai(t,100),t.state.modeGen++,t.curOp&&Dn(t)}function Zi(t,e){return 0==e.from.ch&&0==e.to.ch&&""==v(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function Qi(t,e,n,i){function s(t){return n?n[t]:null}function r(t,n,s){ae(t,n,s,i),ke(t,"change",t,e)}function o(t,e){for(var n=[],r=t;r<e;++r)n.push(new wa(c[r],s(r),i));return n}var a=e.from,l=e.to,c=e.text,u=et(t,a.line),p=et(t,l.line),h=v(c),d=s(c.length-1),f=l.line-a.line;if(e.full)t.insert(0,o(0,c.length)),t.remove(c.length,t.size-c.length);else if(Zi(t,e)){var m=o(0,c.length-1);r(p,p.text,d),f&&t.remove(a.line,f),m.length&&t.insert(a.line,m)}else if(u==p)if(1==c.length)r(u,u.text.slice(0,a.ch)+h+u.text.slice(l.ch),d);else{var g=o(1,c.length-1);g.push(new wa(h+u.text.slice(l.ch),d,i)),r(u,u.text.slice(0,a.ch)+c[0],s(0)),t.insert(a.line+1,g)}else if(1==c.length)r(u,u.text.slice(0,a.ch)+c[0]+p.text.slice(l.ch),s(0)),t.remove(a.line+1,f);else{r(u,u.text.slice(0,a.ch)+c[0],s(0)),r(p,h+p.text.slice(l.ch),d);var y=o(1,c.length-1);f>1&&t.remove(a.line+1,f-1),t.insert(a.line+1,y)}ke(t,"change",t,e)}function ts(t,e,n){function i(t,s,r){if(t.linked)for(var o=0;o<t.linked.length;++o){var a=t.linked[o];if(a.doc!=s){var l=r&&a.sharedHist;n&&!l||(e(a.doc,l),i(a.doc,t,l))}}}i(t,null,!0)}function es(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,Sn(t),Yi(t),ns(t),t.options.direction=e.direction,t.options.lineWrapping||oe(t),t.options.mode=e.modeOption,Dn(t)}function ns(t){("rtl"==t.doc.direction?a:Wo)(t.display.lineDiv,"CodeMirror-rtl")}function is(t){bi(t,(function(){ns(t),Dn(t)}))}function ss(t){this.done=[],this.undone=[],this.undoDepth=t?t.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t?t.maxGeneration:1}function rs(t,e){var n={from:ht(e.from),to:Hi(e),text:nt(t,e.from,e.to)};return hs(t,n,e.from.line,e.to.line+1),ts(t,(function(t){return hs(t,n,e.from.line,e.to.line+1)}),!0),n}function os(t){for(;t.length;){if(!v(t).ranges)break;t.pop()}}function as(t,e){return e?(os(t.done),v(t.done)):t.done.length&&!v(t.done).ranges?v(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),v(t.done)):void 0}function ls(t,e,n,i){var s=t.history;s.undone.length=0;var r,o,a=+new Date;if((s.lastOp==i||s.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&s.lastModTime>a-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(r=as(s,s.lastOp==i)))o=v(r.changes),0==ut(e.from,e.to)&&0==ut(e.from,o.to)?o.to=Hi(e):r.changes.push(rs(t,e));else{var l=v(s.done);for(l&&l.ranges||ps(t.sel,s.done),r={changes:[rs(t,e)],generation:s.generation},s.done.push(r);s.done.length>s.undoDepth;)s.done.shift(),s.done[0].ranges||s.done.shift()}s.done.push(n),s.generation=++s.maxGeneration,s.lastModTime=s.lastSelTime=a,s.lastOp=s.lastSelOp=i,s.lastOrigin=s.lastSelOrigin=e.origin,o||O(t,"historyAdded")}function cs(t,e,n,i){var s=e.charAt(0);return"*"==s||"+"==s&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function us(t,e,n,i){var s=t.history,r=i&&i.origin;n==s.lastSelOp||r&&s.lastSelOrigin==r&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==r||cs(t,r,v(s.done),e))?s.done[s.done.length-1]=e:ps(e,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=r,s.lastSelOp=n,i&&!1!==i.clearRedo&&os(s.undone)}function ps(t,e){var n=v(e);n&&n.ranges&&n.equals(t)||e.push(t)}function hs(t,e,n,i){var s=e["spans_"+t.id],r=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,i),(function(n){n.markedSpans&&((s||(s=e["spans_"+t.id]={}))[r]=n.markedSpans),++r}))}function ds(t){if(!t)return null;for(var e,n=0;n<t.length;++n)t[n].marker.explicitlyCleared?e||(e=t.slice(0,n)):e&&e.push(t[n]);return e?e.length?e:null:t}function fs(t,e){var n=e["spans_"+t.id];if(!n)return null;for(var i=[],s=0;s<e.text.length;++s)i.push(ds(n[s]));return i}function ms(t,e){var n=fs(t,e),i=Ft(t,e);if(!n)return i;if(!i)return n;for(var s=0;s<n.length;++s){var r=n[s],o=i[s];if(r&&o)t:for(var a=0;a<o.length;++a){for(var l=o[a],c=0;c<r.length;++c)if(r[c].marker==l.marker)continue t;r.push(l)}else o&&(n[s]=o)}return n}function gs(t,e,n){for(var i=[],s=0;s<t.length;++s){var r=t[s];if(r.ranges)i.push(n?Ma.prototype.deepCopy.call(r):r);else{var o=r.changes,a=[];i.push({changes:a});for(var l=0;l<o.length;++l){var c=o[l],u=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),e)for(var p in c)(u=p.match(/^spans_(\d+)$/))&&f(e,Number(u[1]))>-1&&(v(a)[p]=c[p],delete c[p])}}}return i}function vs(t,e,n,i){if(i){var s=t.anchor;if(n){var r=ut(e,s)<0;r!=ut(n,s)<0?(s=e,e=n):r!=ut(e,n)<0&&(e=n)}return new Ra(s,e)}return new Ra(n||e,e)}function ys(t,e,n,i,s){null==s&&(s=t.cm&&(t.cm.display.shift||t.extend)),Cs(t,new Ma([vs(t.sel.primary(),e,n,s)],0),i)}function bs(t,e,n){for(var i=[],s=t.cm&&(t.cm.display.shift||t.extend),r=0;r<t.sel.ranges.length;r++)i[r]=vs(t.sel.ranges[r],e[r],null,s);Cs(t,qi(t.cm,i,t.sel.primIndex),n)}function _s(t,e,n,i){var s=t.sel.ranges.slice(0);s[e]=n,Cs(t,qi(t.cm,s,t.sel.primIndex),i)}function ws(t,e,n,i){Cs(t,Wi(e,n),i)}function ks(t,e,n){var i={ranges:e.ranges,update:function(e){this.ranges=[];for(var n=0;n<e.length;n++)this.ranges[n]=new Ra(gt(t,e[n].anchor),gt(t,e[n].head))},origin:n&&n.origin};return O(t,"beforeSelectionChange",t,i),t.cm&&O(t.cm,"beforeSelectionChange",t.cm,i),i.ranges!=e.ranges?qi(t.cm,i.ranges,i.ranges.length-1):e}function As(t,e,n){var i=t.history.done,s=v(i);s&&s.ranges?(i[i.length-1]=e,Ts(t,e,n)):Cs(t,e,n)}function Cs(t,e,n){Ts(t,e,n),us(t,t.sel,t.cm?t.cm.curOp.id:NaN,n)}function Ts(t,e,n){(R(t,"beforeSelectionChange")||t.cm&&R(t.cm,"beforeSelectionChange"))&&(e=ks(t,e,n));var i=n&&n.bias||(ut(e.primary().head,t.sel.primary().head)<0?-1:1);Ss(t,js(t,e,i,!0)),n&&!1===n.scroll||!t.cm||"nocursor"==t.cm.getOption("readOnly")||Qn(t.cm)}function Ss(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=1,t.cm.curOp.selectionChanged=!0,M(t.cm)),ke(t,"cursorActivity",t))}function xs(t){Ss(t,js(t,t.sel,null,!1))}function js(t,e,n,i){for(var s,r=0;r<e.ranges.length;r++){var o=e.ranges[r],a=e.ranges.length==t.sel.ranges.length&&t.sel.ranges[r],l=Ps(t,o.anchor,a&&a.anchor,n,i),c=o.head==o.anchor?l:Ps(t,o.head,a&&a.head,n,i);(s||l!=o.anchor||c!=o.head)&&(s||(s=e.ranges.slice(0,r)),s[r]=new Ra(l,c))}return s?qi(t.cm,s,e.primIndex):e}function Ds(t,e,n,i,s){var r=et(t,e.line);if(r.markedSpans)for(var o=0;o<r.markedSpans.length;++o){var a=r.markedSpans[o],l=a.marker,c="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,u="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==a.from||(c?a.from<=e.ch:a.from<e.ch))&&(null==a.to||(u?a.to>=e.ch:a.to>e.ch))){if(s&&(O(l,"beforeCursorEnter"),l.explicitlyCleared)){if(r.markedSpans){--o;continue}break}if(!l.atomic)continue;if(n){var p=l.find(i<0?1:-1),h=void 0;if((i<0?u:c)&&(p=Es(t,p,-i,p&&p.line==e.line?r:null)),p&&p.line==e.line&&(h=ut(p,n))&&(i<0?h<0:h>0))return Ds(t,p,e,i,s)}var d=l.find(i<0?-1:1);return(i<0?c:u)&&(d=Es(t,d,i,d.line==e.line?r:null)),d?Ds(t,d,e,i,s):null}}return e}function Ps(t,e,n,i,s){var r=i||1,o=Ds(t,e,n,r,s)||!s&&Ds(t,e,n,r,!0)||Ds(t,e,n,-r,s)||!s&&Ds(t,e,n,-r,!0);return o||(t.cantEdit=!0,ct(t.first,0))}function Es(t,e,n,i){return n<0&&0==e.ch?e.line>t.first?gt(t,ct(e.line-1)):null:n>0&&e.ch==(i||et(t,e.line)).text.length?e.line<t.first+t.size-1?ct(e.line+1,0):null:new ct(e.line,e.ch+n)}function Is(t){t.setSelection(ct(t.firstLine(),0),ct(t.lastLine()),Xo)}function Os(t,e,n){var i={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(e,n,s,r){e&&(i.from=gt(t,e)),n&&(i.to=gt(t,n)),s&&(i.text=s),void 0!==r&&(i.origin=r)}),O(t,"beforeChange",t,i),t.cm&&O(t.cm,"beforeChange",t.cm,i),i.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function Ns(t,e,n){if(t.cm){if(!t.cm.curOp)return _i(t.cm,Ns)(t,e,n);if(t.cm.state.suppressEdits)return}if(!(R(t,"beforeChange")||t.cm&&R(t.cm,"beforeChange"))||(e=Os(t,e,!0))){var i=ba&&!n&&Bt(t,e.from,e.to);if(i)for(var s=i.length-1;s>=0;--s)Ms(t,{from:i[s].from,to:i[s].to,text:s?[""]:e.text,origin:e.origin});else Ms(t,e)}}function Ms(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ut(e.from,e.to)){var n=Vi(t,e);ls(t,e,n,t.cm?t.cm.curOp.id:NaN),Fs(t,e,n,Ft(t,e));var i=[];ts(t,(function(t,n){n||-1!=f(i,t.history)||(qs(t.history,e),i.push(t.history)),Fs(t,e,null,Ft(t,e))}))}}function Rs(t,e,n){var i=t.cm&&t.cm.state.suppressEdits;if(!i||n){for(var s,r=t.history,o=t.sel,a="undo"==e?r.done:r.undone,l="undo"==e?r.undone:r.done,c=0;c<a.length&&(s=a[c],n?!s.ranges||s.equals(t.sel):s.ranges);c++);if(c!=a.length){for(r.lastOrigin=r.lastSelOrigin=null;;){if(!(s=a.pop()).ranges){if(i)return void a.push(s);break}if(ps(s,l),n&&!s.equals(t.sel))return void Cs(t,s,{clearRedo:!1});o=s}var u=[];ps(o,l),l.push({changes:u,generation:r.generation}),r.generation=s.generation||++r.maxGeneration;for(var p=R(t,"beforeChange")||t.cm&&R(t.cm,"beforeChange"),h=function(n){var i=s.changes[n];if(i.origin=e,p&&!Os(t,i,!1))return a.length=0,{};u.push(rs(t,i));var r=n?Vi(t,i):v(a);Fs(t,i,r,ms(t,i)),!n&&t.cm&&t.cm.scrollIntoView({from:i.from,to:Hi(i)});var o=[];ts(t,(function(t,e){e||-1!=f(o,t.history)||(qs(t.history,i),o.push(t.history)),Fs(t,i,null,ms(t,i))}))},d=s.changes.length-1;d>=0;--d){var m=h(d);if(m)return m.v}}}}function Ls(t,e){if(0!=e&&(t.first+=e,t.sel=new Ma(y(t.sel.ranges,(function(t){return new Ra(ct(t.anchor.line+e,t.anchor.ch),ct(t.head.line+e,t.head.ch))})),t.sel.primIndex),t.cm)){Dn(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,i=n.viewFrom;i<n.viewTo;i++)Pn(t.cm,i,"gutter")}}function Fs(t,e,n,i){if(t.cm&&!t.cm.curOp)return _i(t.cm,Fs)(t,e,n,i);if(e.to.line<t.first)Ls(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var s=e.text.length-1-(t.first-e.from.line);Ls(t,s),e={from:ct(t.first,0),to:ct(e.to.line+s,e.to.ch),text:[v(e.text)],origin:e.origin}}var r=t.lastLine();e.to.line>r&&(e={from:e.from,to:ct(r,et(t,r).text.length),text:[e.text[0]],origin:e.origin}),e.removed=nt(t,e.from,e.to),n||(n=Vi(t,e)),t.cm?$s(t.cm,e,i):Qi(t,e,i),Ts(t,n,Xo),t.cantEdit&&Ps(t,ct(t.firstLine(),0))&&(t.cantEdit=!1)}}function $s(t,e,n){var i=t.doc,s=t.display,r=e.from,o=e.to,a=!1,l=r.line;t.options.lineWrapping||(l=rt(Xt(et(i,r.line))),i.iter(l,o.line+1,(function(t){if(t==s.maxLine)return a=!0,!0}))),i.sel.contains(e.from,e.to)>-1&&M(t),Qi(i,e,n,Tn(t)),t.options.lineWrapping||(i.iter(l,r.line+e.text.length,(function(t){var e=re(t);e>s.maxLineLength&&(s.maxLine=t,s.maxLineLength=e,s.maxLineChanged=!0,a=!1)})),a&&(t.curOp.updateMaxLine=!0)),Dt(i,r.line),Ai(t,400);var c=e.text.length-(o.line-r.line)-1;e.full?Dn(t):r.line!=o.line||1!=e.text.length||Zi(t.doc,e)?Dn(t,r.line,o.line+1,c):Pn(t,r.line,"text");var u=R(t,"changes"),p=R(t,"change");if(p||u){var h={from:r,to:o,text:e.text,removed:e.removed,origin:e.origin}
;p&&ke(t,"change",t,h),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(h)}t.display.selForContextMenu=null}function Bs(t,e,n,i,s){var r;i||(i=n),ut(i,n)<0&&(n=(r=[i,n])[0],i=r[1]),"string"==typeof e&&(e=t.splitLines(e)),Ns(t,{from:n,to:i,text:e,origin:s})}function zs(t,e,n,i){n<t.line?t.line+=i:e<t.line&&(t.line=e,t.ch=0)}function Us(t,e,n,i){for(var s=0;s<t.length;++s){var r=t[s],o=!0;if(r.ranges){r.copied||((r=t[s]=r.deepCopy()).copied=!0);for(var a=0;a<r.ranges.length;a++)zs(r.ranges[a].anchor,e,n,i),zs(r.ranges[a].head,e,n,i)}else{for(var l=0;l<r.changes.length;++l){var c=r.changes[l];if(n<c.from.line)c.from=ct(c.from.line+i,c.from.ch),c.to=ct(c.to.line+i,c.to.ch);else if(e<=c.to.line){o=!1;break}}o||(t.splice(0,s+1),s=0)}}}function qs(t,e){var n=e.from.line,i=e.to.line,s=e.text.length-(i-n)-1;Us(t.done,n,i,s),Us(t.undone,n,i,s)}function Ws(t,e,n,i){var s=e,r=e;return"number"==typeof e?r=et(t,mt(t,e)):s=rt(e),null==s?null:(i(r,s)&&t.cm&&Pn(t.cm,s,n),r)}function Hs(t){this.lines=t,this.parent=null;for(var e=0,n=0;n<t.length;++n)t[n].parent=this,e+=t[n].height;this.height=e}function Js(t){this.children=t;for(var e=0,n=0,i=0;i<t.length;++i){var s=t[i];e+=s.chunkSize(),n+=s.height,s.parent=this}this.size=e,this.height=n,this.parent=null}function Vs(t,e,n){se(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&Zn(t,n)}function Gs(t,e,n,i){var s=new La(t,n,i),r=t.cm;return r&&s.noHScroll&&(r.display.alignWidgets=!0),Ws(t,e,"widget",(function(e){var n=e.widgets||(e.widgets=[]);if(null==s.insertAt?n.push(s):n.splice(Math.min(n.length,Math.max(0,s.insertAt)),0,s),s.line=e,r&&!ne(t,e)){var i=se(e)<t.scrollTop;st(e,e.height+Re(s)),i&&Zn(r,s.height),r.curOp.forceUpdate=!0}return!0})),r&&ke(r,"lineWidgetAdded",r,s,"number"==typeof e?e:rt(e)),s}function Ks(t,e,n,i,r){if(i&&i.shared)return Ys(t,e,n,i,r);if(t.cm&&!t.cm.curOp)return _i(t.cm,Ks)(t,e,n,i,r);var o=new $a(t,r),a=ut(e,n);if(i&&h(i,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=s("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Yt(t,e.line,e,n,o)||e.line!=n.line&&Yt(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Et()}o.addToHistory&&ls(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var l,c=e.line,u=t.cm;if(t.iter(c,n.line+1,(function(i){u&&o.collapsed&&!u.options.lineWrapping&&Xt(i)==u.display.maxLine&&(l=!0),o.collapsed&&c!=e.line&&st(i,0),Mt(i,new It(o,c==e.line?e.ch:null,c==n.line?n.ch:null),t.cm&&t.cm.curOp),++c})),o.collapsed&&t.iter(e.line,n.line+1,(function(e){ne(t,e)&&st(e,0)})),o.clearOnEnter&&oa(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Pt(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++Fa,o.atomic=!0),u){if(l&&(u.curOp.updateMaxLine=!0),o.collapsed)Dn(u,e.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var p=e.line;p<=n.line;p++)Pn(u,p,"text");o.atomic&&xs(u.doc),ke(u,"markerAdded",u,o)}return o}function Ys(t,e,n,i,s){(i=h(i)).shared=!1;var r=[Ks(t,e,n,i,s)],o=r[0],a=i.widgetNode;return ts(t,(function(t){a&&(i.widgetNode=a.cloneNode(!0)),r.push(Ks(t,gt(t,e),gt(t,n),i,s));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;o=v(r)})),new Ba(r,o)}function Xs(t){return t.findMarks(ct(t.first,0),t.clipPos(ct(t.lastLine())),(function(t){return t.parent}))}function Zs(t,e){for(var n=0;n<e.length;n++){var i=e[n],s=i.find(),r=t.clipPos(s.from),o=t.clipPos(s.to);if(ut(r,o)){var a=Ks(t,r,o,i.primary,i.primary.type);i.markers.push(a),a.parent=i}}}function Qs(t){for(var e=function(e){var n=t[e],i=[n.primary.doc];ts(n.primary.doc,(function(t){return i.push(t)}));for(var s=0;s<n.markers.length;s++){var r=n.markers[s];-1==f(i,r.doc)&&(r.parent=null,n.markers.splice(s--,1))}},n=0;n<t.length;n++)e(n)}function tr(t){var e=this;if(ir(e),!N(e,t)&&!Le(e.display,t)){F(t),Co&&(qa=+new Date);var n=xn(e,t,!0),i=t.dataTransfer.files;if(n&&!e.isReadOnly())if(i&&i.length&&window.FileReader&&window.File)for(var s=i.length,r=Array(s),o=0,a=function(){++o==s&&_i(e,(function(){var t={from:n=gt(e.doc,n),to:n,text:e.doc.splitLines(r.filter((function(t){return null!=t})).join(e.doc.lineSeparator())),origin:"paste"};Ns(e.doc,t),As(e.doc,Wi(gt(e.doc,n),gt(e.doc,Hi(t))))}))()},l=function(t,n){if(e.options.allowDropFileTypes&&-1==f(e.options.allowDropFileTypes,t.type))a();else{var i=new FileReader;i.onerror=function(){return a()},i.onload=function(){var t=i.result;/[\x00-\x08\x0e-\x1f]{2}/.test(t)||(r[n]=t),a()},i.readAsText(t)}},c=0;c<i.length;c++)l(i[c],c);else{if(e.state.draggingText&&e.doc.sel.contains(n)>-1)return e.state.draggingText(t),void setTimeout((function(){return e.display.input.focus()}),20);try{var u=t.dataTransfer.getData("Text");if(u){var p;if(e.state.draggingText&&!e.state.draggingText.copy&&(p=e.listSelections()),Ts(e.doc,Wi(n,n)),p)for(var h=0;h<p.length;++h)Bs(e.doc,"",p[h].anchor,p[h].head,"drag");e.replaceSelection(u,"around","paste"),e.display.input.focus()}}catch(t){}}}}function er(t,e){if(Co&&(!t.state.draggingText||+new Date-qa<100))z(e);else if(!N(t,e)&&!Le(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!Eo)){var n=i("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Po&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),Po&&n.parentNode.removeChild(n)}}function nr(t,e){var s=xn(t,e);if(s){var r=document.createDocumentFragment();Ln(t,s,r),t.display.dragCursor||(t.display.dragCursor=i("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),n(t.display.dragCursor,r)}}function ir(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function sr(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<e.length;i++){var s=e[i].CodeMirror;s&&n.push(s)}n.length&&n[0].operation((function(){for(var e=0;e<n.length;e++)t(n[e])}))}}function rr(){Wa||(or(),Wa=!0)}function or(){var t;oa(window,"resize",(function(){null==t&&(t=setTimeout((function(){t=null,sr(ar)}),100))})),oa(window,"blur",(function(){return sr(Wn)}))}function ar(t){var e=t.display;e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.scrollbarsClipped=!1,t.setSize()}function lr(t){var e,n,i,s,r=t.split(/-(?!$)/);t=r[r.length-1];for(var o=0;o<r.length-1;o++){var a=r[o];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))e=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);i=!0}}return e&&(t="Alt-"+t),n&&(t="Ctrl-"+t),s&&(t="Cmd-"+t),i&&(t="Shift-"+t),t}function cr(t){var e={};for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==i){delete t[n];continue}for(var s=y(n.split(" "),lr),r=0;r<s.length;r++){var o=void 0,a=void 0;r==s.length-1?(a=s.join(" "),o=i):(a=s.slice(0,r+1).join(" "),o="...");var l=e[a];if(l){if(l!=o)throw new Error("Inconsistent bindings for "+a)}else e[a]=o}delete t[n]}for(var c in e)t[c]=e[c];return t}function ur(t,e,n,i){var s=(e=fr(e)).call?e.call(t,i):e[t];if(!1===s)return"nothing";if("..."===s)return"multi";if(null!=s&&n(s))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return ur(t,e.fallthrough,n,i);for(var r=0;r<e.fallthrough.length;r++){var o=ur(t,e.fallthrough[r],n,i);if(o)return o}}}function pr(t){var e="string"==typeof t?t:Ha[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function hr(t,e,n){var i=t;return e.altKey&&"Alt"!=i&&(t="Alt-"+t),(Uo?e.metaKey:e.ctrlKey)&&"Ctrl"!=i&&(t="Ctrl-"+t),(Uo?e.ctrlKey:e.metaKey)&&"Mod"!=i&&(t="Cmd-"+t),!n&&e.shiftKey&&"Shift"!=i&&(t="Shift-"+t),t}function dr(t,e){if(Po&&34==t.keyCode&&t.char)return!1;var n=Ha[t.keyCode];return null!=n&&!t.altGraphKey&&(3==t.keyCode&&t.code&&(n=t.code),hr(n,t,e))}function fr(t){return"string"==typeof t?Ka[t]:t}function mr(t,e){for(var n=t.doc.sel.ranges,i=[],s=0;s<n.length;s++){for(var r=e(n[s]);i.length&&ut(r.from,v(i).to)<=0;){var o=i.pop();if(ut(o.from,r.from)<0){r.from=o.from;break}}i.push(r)}bi(t,(function(){for(var e=i.length-1;e>=0;e--)Bs(t.doc,"",i[e].from,i[e].to,"+delete");Qn(t)}))}function gr(t,e,n){var i=S(t.text,e+n,n);return i<0||i>t.text.length?null:i}function vr(t,e,n){var i=gr(t,e.ch,n);return null==i?null:new ct(e.line,i,n<0?"after":"before")}function yr(t,e,n,i,s){if(t){"rtl"==e.doc.direction&&(s=-s);var r=P(n,e.doc.direction);if(r){var o,a=s<0?v(r):r[0],l=s<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==e.doc.direction){var c=Ke(e,n);o=s<0?n.text.length-1:0;var u=Ye(e,c,o).top;o=x((function(t){return Ye(e,c,t).top==u}),s<0==(1==a.level)?a.from:a.to-1,o),"before"==l&&(o=gr(n,o,1))}else o=s<0?a.to:a.from;return new ct(i,o,l)}}return new ct(i,s<0?n.text.length:0,s<0?"before":"after")}function br(t,e,n,i){var s=P(e,t.doc.direction);if(!s)return vr(e,n,i);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var r=D(s,n.ch,n.sticky),o=s[r];if("ltr"==t.doc.direction&&o.level%2==0&&(i>0?o.to>n.ch:o.from<n.ch))return vr(e,n,i);var a,l=function(t,n){return gr(e,t instanceof ct?t.ch:t,n)},c=function(n){return t.options.lineWrapping?(a=a||Ke(t,e),gn(t,e,a,n)):{begin:0,end:e.text.length}},u=c("before"==n.sticky?l(n,-1):n.ch);if("rtl"==t.doc.direction||1==o.level){var p=1==o.level==i<0,h=l(n,p?1:-1);if(null!=h&&(p?h<=o.to&&h<=u.end:h>=o.from&&h>=u.begin)){var d=p?"before":"after";return new ct(n.line,h,d)}}var f=function(t,e,i){for(var r=function(t,e){return e?new ct(n.line,l(t,1),"before"):new ct(n.line,t,"after")};t>=0&&t<s.length;t+=e){var o=s[t],a=e>0==(1!=o.level),c=a?i.begin:l(i.end,-1);if(o.from<=c&&c<o.to)return r(c,a);if(c=a?o.from:l(o.to,-1),i.begin<=c&&c<i.end)return r(c,a)}},m=f(r+i,i,u);if(m)return m;var g=i>0?u.end:l(u.begin,-1);return null==g||i>0&&g==e.text.length||!(m=f(i>0?0:s.length-1,i,c(g)))?null:m}function _r(t,e){var n=et(t.doc,e),i=Xt(n);return i!=n&&(e=rt(i)),yr(!0,t,i,e,1)}function wr(t,e){var n=et(t.doc,e),i=Zt(n);return i!=n&&(e=rt(i)),yr(!0,t,n,e,-1)}function kr(t,e){var n=_r(t,e.line),i=et(t.doc,n.line),s=P(i,t.doc.direction);if(!s||0==s[0].level){var r=Math.max(n.ch,i.text.search(/\S/)),o=e.line==n.line&&e.ch<=r&&e.ch;return ct(n.line,o?0:r,n.sticky)}return n}function Ar(t,e,n){if("string"==typeof e&&!(e=Za[e]))return!1;t.display.input.ensurePolled();var i=t.display.shift,s=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),s=e(t)!=Yo}finally{t.display.shift=i,t.state.suppressEdits=!1}return s}function Cr(t,e,n){for(var i=0;i<t.state.keyMaps.length;i++){var s=ur(e,t.state.keyMaps[i],n,t);if(s)return s}return t.options.extraKeys&&ur(e,t.options.extraKeys,n,t)||ur(e,t.options.keyMap,n,t)}function Tr(t,e,n,i){var s=t.state.keySeq;if(s){if(pr(e))return"handled";if(/\'$/.test(e)?t.state.keySeq=null:Qa.set(50,(function(){t.state.keySeq==s&&(t.state.keySeq=null,t.display.input.reset())})),Sr(t,s+" "+e,n,i))return!0}return Sr(t,e,n,i)}function Sr(t,e,n,i){var s=Cr(t,e,i);return"multi"==s&&(t.state.keySeq=e),"handled"==s&&ke(t,"keyHandled",t,e,n),"handled"!=s&&"multi"!=s||(F(n),Bn(t)),!!s}function xr(t,e){var n=dr(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?Tr(t,"Shift-"+n,e,(function(e){return Ar(t,e,!0)}))||Tr(t,n,e,(function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Ar(t,e)})):Tr(t,n,e,(function(e){return Ar(t,e)})))}function jr(t,e,n){return Tr(t,"'"+n+"'",e,(function(e){return Ar(t,e,!0)}))}function Dr(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField()||(e.curOp.focus=o(c(e)),N(e,t)))){Co&&To<11&&27==t.keyCode&&(t.returnValue=!1);var n=t.keyCode;e.display.shift=16==n||t.shiftKey;var i=xr(e,t);Po&&(tl=i?n:null,i||88!=n||ua||!(Lo?t.metaKey:t.ctrlKey)||e.replaceSelection("",null,"cut")),_o&&!Lo&&!i&&46==n&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=n||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||Pr(e)}}function Pr(t){function e(t){18!=t.keyCode&&t.altKey||(Wo(n,"CodeMirror-crosshair"),I(document,"keyup",e),I(document,"mouseover",e))}var n=t.display.lineDiv;a(n,"CodeMirror-crosshair"),oa(document,"keyup",e),oa(document,"mouseover",e)}function Er(t){16==t.keyCode&&(this.doc.sel.shift=!1),N(this,t)}function Ir(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField()||Le(e.display,t)||N(e,t)||t.ctrlKey&&!t.altKey||Lo&&t.metaKey)){var n=t.keyCode,i=t.charCode;if(Po&&n==tl)return tl=null,void F(t);if(!Po||t.which&&!(t.which<10)||!xr(e,t)){var s=String.fromCharCode(null==i?n:i);"\b"!=s&&(jr(e,t,s)||e.display.input.onKeyPress(t))}}}function Or(t,e){var n=+new Date;return Xa&&Xa.compare(n,t,e)?(Ya=Xa=null,"triple"):Ya&&Ya.compare(n,t,e)?(Xa=new nl(n,t,e),Ya=null,"double"):(Ya=new nl(n,t,e),Xa=null,"single")}function Nr(t){var e=this,n=e.display;if(!(N(e,t)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=t.shiftKey,Le(n,t))So||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100));else if(!qr(e,t)){var i=xn(e,t),s=q(t),r=i?Or(i,s):"single";u(e).focus(),1==s&&e.state.selectingText&&e.state.selectingText(t),i&&Mr(e,s,i,r,t)||(1==s?i?Lr(e,i,r,t):U(t)==n.scroller&&F(t):2==s?(i&&ys(e.doc,i),setTimeout((function(){return n.input.focus()}),20)):3==s&&(qo?e.display.input.onContextMenu(t):Un(e)))}}function Mr(t,e,n,i,s){var r="Click";return"double"==i?r="Double"+r:"triple"==i&&(r="Triple"+r),Tr(t,hr(r=(1==e?"Left":2==e?"Middle":"Right")+r,s),s,(function(e){if("string"==typeof e&&(e=Za[e]),!e)return!1;var i=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i=e(t,n)!=Yo}finally{t.state.suppressEdits=!1}return i}))}function Rr(t,e,n){var i=t.getOption("configureMouse"),s=i?i(t,e,n):{};if(null==s.unit){var r=Fo?n.shiftKey&&n.metaKey:n.altKey;s.unit=r?"rectangle":"single"==e?"char":"double"==e?"word":"line"}return(null==s.extend||t.doc.extend)&&(s.extend=t.doc.extend||n.shiftKey),null==s.addNew&&(s.addNew=Lo?n.metaKey:n.ctrlKey),null==s.moveOnDrag&&(s.moveOnDrag=!(Lo?n.altKey:n.ctrlKey)),s}function Lr(t,e,n,i){Co?setTimeout(p(zn,t),0):t.curOp.focus=o(c(t));var s,r=Rr(t,n,i),a=t.doc.sel;t.options.dragDrop&&aa&&!t.isReadOnly()&&"single"==n&&(s=a.contains(e))>-1&&(ut((s=a.ranges[s]).from(),e)<0||e.xRel>0)&&(ut(s.to(),e)>0||e.xRel<0)?Fr(t,i,e,r):Br(t,i,e,r)}function Fr(t,e,n,i){var s=t.display,r=!1,o=_i(t,(function(e){So&&(s.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Un(t)),I(s.wrapper.ownerDocument,"mouseup",o),I(s.wrapper.ownerDocument,"mousemove",a),I(s.scroller,"dragstart",l),I(s.scroller,"drop",o),r||(F(e),i.addNew||ys(t.doc,n,null,null,i.extend),So&&!Eo||Co&&9==To?setTimeout((function(){s.wrapper.ownerDocument.body.focus({preventScroll:!0}),s.input.focus()}),20):s.input.focus())})),a=function(t){r=r||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},l=function(){return r=!0};So&&(s.scroller.draggable=!0),t.state.draggingText=o,o.copy=!i.moveOnDrag,oa(s.wrapper.ownerDocument,"mouseup",o),oa(s.wrapper.ownerDocument,"mousemove",a),oa(s.scroller,"dragstart",l),oa(s.scroller,"drop",o),t.state.delayingBlurEvent=!0,setTimeout((function(){return s.input.focus()}),20),s.scroller.dragDrop&&s.scroller.dragDrop()}function $r(t,e,n){if("char"==n)return new Ra(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new Ra(ct(e.line,0),gt(t.doc,ct(e.line+1,0)));var i=n(t,e);return new Ra(i.from,i.to)}function Br(t,e,n,i){function s(e){if(0!=ut(y,e))if(y=e,"rectangle"==i.unit){for(var s=[],r=t.options.tabSize,o=d(et(u,n.line).text,n.ch,r),a=d(et(u,e.line).text,e.ch,r),l=Math.min(o,a),c=Math.max(o,a),g=Math.min(n.line,e.line),v=Math.min(t.lastLine(),Math.max(n.line,e.line));g<=v;g++){var b=et(u,g).text,_=m(b,l,r);l==c?s.push(new Ra(ct(g,_),ct(g,_))):b.length>_&&s.push(new Ra(ct(g,_),ct(g,m(b,c,r))))}s.length||s.push(new Ra(n,n)),Cs(u,qi(t,f.ranges.slice(0,h).concat(s),h),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var w,k=p,A=$r(t,e,i.unit),C=k.anchor;ut(A.anchor,C)>0?(w=A.head,C=ft(k.from(),A.anchor)):(w=A.anchor,C=dt(k.to(),A.head));var T=f.ranges.slice(0);T[h]=zr(t,new Ra(gt(u,C),w)),Cs(u,qi(t,T,h),Zo)}}function r(e){var n=++_,a=xn(t,e,!0,"rectangle"==i.unit);if(a)if(0!=ut(a,y)){t.curOp.focus=o(c(t)),s(a);var p=Vn(l,u);(a.line>=p.to||a.line<p.from)&&setTimeout(_i(t,(function(){_==n&&r(e)})),150)}else{var h=e.clientY<b.top?-20:e.clientY>b.bottom?20:0;h&&setTimeout(_i(t,(function(){_==n&&(l.scroller.scrollTop+=h,r(e))})),50)}}function a(e){t.state.selectingText=!1,_=1/0,e&&(F(e),l.input.focus()),I(l.wrapper.ownerDocument,"mousemove",w),I(l.wrapper.ownerDocument,"mouseup",k),u.history.lastSelOrigin=null}Co&&Un(t);var l=t.display,u=t.doc;F(e);var p,h,f=u.sel,g=f.ranges;if(i.addNew&&!i.extend?(h=u.sel.contains(n),p=h>-1?g[h]:new Ra(n,n)):(p=u.sel.primary(),h=u.sel.primIndex),"rectangle"==i.unit)i.addNew||(p=new Ra(n,n)),n=xn(t,e,!0,!0),h=-1;else{var v=$r(t,n,i.unit);p=i.extend?vs(p,v.anchor,v.head,i.extend):v}i.addNew?-1==h?(h=g.length,Cs(u,qi(t,g.concat([p]),h),{scroll:!1,origin:"*mouse"})):g.length>1&&g[h].empty()&&"char"==i.unit&&!i.extend?(Cs(u,qi(t,g.slice(0,h).concat(g.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),f=u.sel):_s(u,h,p,Zo):(h=0,Cs(u,new Ma([p],0),Zo),f=u.sel);var y=n,b=l.wrapper.getBoundingClientRect(),_=0,w=_i(t,(function(t){0!==t.buttons&&q(t)?r(t):a(t)})),k=_i(t,a);t.state.selectingText=k,oa(l.wrapper.ownerDocument,"mousemove",w),oa(l.wrapper.ownerDocument,"mouseup",k)}function zr(t,e){var n=e.anchor,i=e.head,s=et(t.doc,n.line);if(0==ut(n,i)&&n.sticky==i.sticky)return e;var r=P(s);if(!r)return e;var o=D(r,n.ch,n.sticky),a=r[o];if(a.from!=n.ch&&a.to!=n.ch)return e;var l,c=o+(a.from==n.ch==(1!=a.level)?0:1);if(0==c||c==r.length)return e;if(i.line!=n.line)l=(i.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var u=D(r,i.ch,i.sticky),p=u-o||(i.ch-n.ch)*(1==a.level?-1:1);l=u==c-1||u==c?p<0:p>0}var h=r[c+(l?-1:0)],d=l==(1==h.level),f=d?h.from:h.to,m=d?"after":"before";return n.ch==f&&n.sticky==m?e:new Ra(new ct(n.line,f,m),i)}function Ur(t,e,n,i){var s,r;if(e.touches)s=e.touches[0].clientX,r=e.touches[0].clientY;else try{s=e.clientX,r=e.clientY}catch(t){return!1}if(s>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&F(e);var o=t.display,a=o.lineDiv.getBoundingClientRect();if(r>a.bottom||!R(t,n))return B(e);r-=a.top-o.viewOffset;for(var l=0;l<t.display.gutterSpecs.length;++l){var c=o.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=s)return O(t,n,t,ot(t.doc,r),t.display.gutterSpecs[l].className,e),B(e)}}function qr(t,e){return Ur(t,e,"gutterClick",!0)}function Wr(t,e){Le(t.display,e)||Hr(t,e)||N(t,e,"contextmenu")||qo||t.display.input.onContextMenu(e)}function Hr(t,e){return!!R(t,"gutterContextMenu")&&Ur(t,e,"gutterContextMenu",!1)}function Jr(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),sn(t)}function Vr(t){function e(e,i,s,r){t.defaults[e]=i,s&&(n[e]=r?function(t,e,n){n!=il&&s(t,e,n)}:s)}var n=t.optionHandlers;t.defineOption=e,t.Init=il,e("value","",(function(t,e){return t.setValue(e)}),!0),e("mode",null,(function(t,e){t.doc.modeOption=e,Yi(t)}),!0),e("indentUnit",2,Yi,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,(function(t){Xi(t),sn(t),Dn(t)}),!0),e("lineSeparator",null,(function(t,e){if(t.doc.lineSep=e,e){var n=[],i=t.doc.first;t.doc.iter((function(t){for(var s=0;;){var r=t.text.indexOf(e,s);if(-1==r)break;s=r+e.length,n.push(ct(i,r))}i++}));for(var s=n.length-1;s>=0;s--)Bs(t.doc,e,n[s],ct(n[s].line,n[s].ch+e.length))}})),e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,(function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=il&&t.refresh()})),e("specialCharPlaceholder",pe,(function(t){return t.refresh()}),!0),e("electricChars",!0),e("inputStyle",Ro?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),e("spellcheck",!1,(function(t,e){return t.getInputField().spellcheck=e}),!0),e("autocorrect",!1,(function(t,e){return t.getInputField().autocorrect=e}),!0),e("autocapitalize",!1,(function(t,e){return t.getInputField().autocapitalize=e}),!0),e("rtlMoveVisually",!$o),e("wholeLineUpdateBefore",!0),e("theme","default",(function(t){Jr(t),Fi(t)}),!0),e("keyMap","default",(function(t,e,n){var i=fr(e),s=n!=il&&fr(n);s&&s.detach&&s.detach(t,i),i.attach&&i.attach(t,s||null)})),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,Kr,!0),e("gutters",[],(function(t,e){t.display.gutterSpecs=Ri(e,t.options.lineNumbers),Fi(t)}),!0),e("fixedGutter",!0,(function(t,e){t.display.gutters.style.left=e?Cn(t.display)+"px":"0",t.refresh()}),!0),e("coverGutterNextToScrollbar",!1,(function(t){return li(t)}),!0),e("scrollbarStyle","native",(function(t){ui(t),li(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)}),!0),e("lineNumbers",!1,(function(t,e){t.display.gutterSpecs=Ri(t.options.gutters,e),Fi(t)}),!0),e("firstLineNumber",1,Fi,!0),e("lineNumberFormatter",(function(t){return t}),Fi,!0),e("showCursorWhenSelecting",!1,Mn,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("selectionsMayTouch",!1),e("readOnly",!1,(function(t,e){"nocursor"==e&&(Wn(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)})),e("screenReaderLabel",null,(function(t,e){e=""===e?null:e,t.display.input.screenReaderLabelChanged(e)})),e("disableInput",!1,(function(t,e){e||t.display.input.reset()}),!0),e("dragDrop",!0,Gr),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,Mn,!0),e("singleCursorHeightPerLine",!0,Mn,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Xi,!0),e("addModeClass",!1,Xi,!0),e("pollInterval",100),e("undoDepth",200,(function(t,e){return t.doc.history.undoDepth=e})),e("historyEventDelay",1250),e("viewportMargin",10,(function(t){return t.refresh()}),!0),e("maxHighlightLength",1e4,Xi,!0),e("moveInputWithCursor",!0,(function(t,e){e||t.display.input.resetPosition()})),e("tabindex",null,(function(t,e){return t.display.input.getField().tabIndex=e||""})),e("autofocus",null),e("direction","ltr",(function(t,e){return t.doc.setDirection(e)}),!0),e("phrases",null)}function Gr(t,e,n){if(!e!=!(n&&n!=il)){var i=t.display.dragFunctions,s=e?oa:I;s(t.display.scroller,"dragstart",i.start),s(t.display.scroller,"dragenter",i.enter),s(t.display.scroller,"dragover",i.over),s(t.display.scroller,"dragleave",i.leave),s(t.display.scroller,"drop",i.drop)}}function Kr(t){t.options.lineWrapping?(a(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(Wo(t.display.wrapper,"CodeMirror-wrap"),oe(t)),Sn(t),Dn(t),sn(t),setTimeout((function(){return li(t)}),100)}function Yr(t,e){var n=this;if(!(this instanceof Yr))return new Yr(t,e);this.options=e=e?h(e):{},h(sl,e,!1);var i=e.value;"string"==typeof i?i=new Ua(i,e.mode,null,e.lineSeparator,e.direction):e.mode&&(i.modeOption=e.mode),this.doc=i;var s=new Yr.inputStyles[e.inputStyle](this),r=this.display=new $i(t,i,s,e);for(var o in r.wrapper.CodeMirror=this,Jr(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ui(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Jo,keySeq:null,specialChars:null},e.autofocus&&!Ro&&r.input.focus(),Co&&To<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),Xr(this),rr(),pi(this),this.curOp.forceUpdate=!0,es(this,i),e.autofocus&&!Ro||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&qn(n)}),20):Wn(this),rl)rl.hasOwnProperty(o)&&rl[o](this,e[o],il);Mi(this),e.finishInit&&e.finishInit(this);for(var a=0;a<ol.length;++a)ol[a](this);hi(this),So&&e.lineWrapping&&"optimizelegibility"==getComputedStyle(r.lineDiv).textRendering&&(r.lineDiv.style.textRendering="auto")}function Xr(t){function e(){s.activeTouch&&(r=setTimeout((function(){return s.activeTouch=null}),1e3),(o=s.activeTouch).end=+new Date)}function n(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return e.radiusX<=1&&e.radiusY<=1}function i(t,e){if(null==e.left)return!0;var n=e.left-t.left,i=e.top-t.top;return n*n+i*i>400}var s=t.display;oa(s.scroller,"mousedown",_i(t,Nr)),oa(s.scroller,"dblclick",Co&&To<11?_i(t,(function(e){if(!N(t,e)){var n=xn(t,e);if(n&&!qr(t,e)&&!Le(t.display,e)){F(e);var i=t.findWordAt(n);ys(t.doc,i.anchor,i.head)}}})):function(e){return N(t,e)||F(e)}),oa(s.scroller,"contextmenu",(function(e){return Wr(t,e)})),oa(s.input.getField(),"contextmenu",(function(e){s.scroller.contains(e.target)||Wr(t,e)}));var r,o={end:0};oa(s.scroller,"touchstart",(function(e){if(!N(t,e)&&!n(e)&&!qr(t,e)){s.input.ensurePolled(),clearTimeout(r);var i=+new Date;s.activeTouch={start:i,moved:!1,prev:i-o.end<=300?o:null},1==e.touches.length&&(s.activeTouch.left=e.touches[0].pageX,s.activeTouch.top=e.touches[0].pageY)}})),oa(s.scroller,"touchmove",(function(){s.activeTouch&&(s.activeTouch.moved=!0)})),oa(s.scroller,"touchend",(function(n){var r=s.activeTouch;if(r&&!Le(s,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,a=t.coordsChar(s.activeTouch,"page");o=!r.prev||i(r,r.prev)?new Ra(a,a):!r.prev.prev||i(r,r.prev.prev)?t.findWordAt(a):new Ra(ct(a.line,0),gt(t.doc,ct(a.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),F(n)}e()})),oa(s.scroller,"touchcancel",e),oa(s.scroller,"scroll",(function(){s.scroller.clientHeight&&(si(t,s.scroller.scrollTop),oi(t,s.scroller.scrollLeft,!0),O(t,"scroll",t))})),oa(s.scroller,"mousewheel",(function(e){return Ui(t,e)})),oa(s.scroller,"DOMMouseScroll",(function(e){return Ui(t,e)})),oa(s.wrapper,"scroll",(function(){return s.wrapper.scrollTop=s.wrapper.scrollLeft=0})),s.dragFunctions={enter:function(e){N(t,e)||z(e)},over:function(e){N(t,e)||(nr(t,e),z(e))},start:function(e){return er(t,e)},drop:_i(t,tr),leave:function(e){N(t,e)||ir(t)}};var a=s.input.getField();oa(a,"keyup",(function(e){return Er.call(t,e)})),oa(a,"keydown",_i(t,Dr)),oa(a,"keypress",_i(t,Ir)),oa(a,"focus",(function(e){return qn(t,e)})),oa(a,"blur",(function(e){return Wn(t,e)}))}function Zr(t,e,n,i){var s,r=t.doc;null==n&&(n="add"),"smart"==n&&(r.mode.indent?s=wt(t,e).state:n="prev");var o=t.options.tabSize,a=et(r,e),l=d(a.text,null,o);a.stateAfter&&(a.stateAfter=null);var c,u=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==n&&((c=r.mode.indent(s,a.text.slice(u.length),a.text))==Yo||c>150)){if(!i)return;n="prev"}}else c=0,n="not";"prev"==n?c=e>r.first?d(et(r,e-1).text,null,o):0:"add"==n?c=l+t.options.indentUnit:"subtract"==n?c=l-t.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var p="",h=0;if(t.options.indentWithTabs)for(var f=Math.floor(c/o);f;--f)h+=o,p+="\t";if(h<c&&(p+=g(c-h)),p!=u)return Bs(r,p,ct(e,0),ct(e,u.length),"+input"),a.stateAfter=null,!0;for(var m=0;m<r.sel.ranges.length;m++){var v=r.sel.ranges[m];if(v.head.line==e&&v.head.ch<u.length){var y=ct(e,u.length);_s(r,m,new Ra(y,y));break}}}function Qr(t){al=t}function to(t,e,n,i,s){var r=t.doc;t.display.shift=!1,i||(i=r.sel);var o=+new Date-200,a="paste"==s||t.state.pasteIncoming>o,l=la(e),c=null;if(a&&i.ranges.length>1)if(al&&al.text.join("\n")==e){if(i.ranges.length%al.text.length==0){c=[];for(var u=0;u<al.text.length;u++)c.push(r.splitLines(al.text[u]))}}else l.length==i.ranges.length&&t.options.pasteLinesPerSelection&&(c=y(l,(function(t){return[t]})));for(var p=t.curOp.updateInput,h=i.ranges.length-1;h>=0;h--){var d=i.ranges[h],f=d.from(),m=d.to();d.empty()&&(n&&n>0?f=ct(f.line,f.ch-n):t.state.overwrite&&!a?m=ct(m.line,Math.min(et(r,m.line).text.length,m.ch+v(l).length)):a&&al&&al.lineWise&&al.text.join("\n")==l.join("\n")&&(f=m=ct(f.line,0)));var g={from:f,to:m,text:c?c[h%c.length]:l,origin:s||(a?"paste":t.state.cutIncoming>o?"cut":"+input")};Ns(t.doc,g),ke(t,"inputRead",t,g)}e&&!a&&no(t,e),Qn(t),t.curOp.updateInput<2&&(t.curOp.updateInput=p),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function eo(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||!e.hasFocus()||bi(e,(function(){return to(e,n,0,null,"paste")})),!0}function no(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,i=n.ranges.length-1;i>=0;i--){var s=n.ranges[i];if(!(s.head.ch>100||i&&n.ranges[i-1].head.line==s.head.line)){var r=t.getModeAt(s.head),o=!1;if(r.electricChars){for(var a=0;a<r.electricChars.length;a++)if(e.indexOf(r.electricChars.charAt(a))>-1){o=Zr(t,s.head.line,"smart");break}}else r.electricInput&&r.electricInput.test(et(t.doc,s.head.line).text.slice(0,s.head.ch))&&(o=Zr(t,s.head.line,"smart"));o&&ke(t,"electricInput",t,s.head.line)}}}function io(t){for(var e=[],n=[],i=0;i<t.doc.sel.ranges.length;i++){var s=t.doc.sel.ranges[i].head.line,r={anchor:ct(s,0),head:ct(s+1,0)};n.push(r),e.push(t.getRange(r.anchor,r.head))}return{text:e,ranges:n}}function so(t,e,n,i){t.setAttribute("autocorrect",n?"on":"off"),t.setAttribute("autocapitalize",i?"on":"off"),t.setAttribute("spellcheck",!!e)}function ro(){var t=i("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),e=i("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return So?t.style.width="1000px":t.setAttribute("wrap","off"),No&&(t.style.border="1px solid black"),e}function oo(t){var e=t.optionHandlers,n=t.helpers={};t.prototype={constructor:t,focus:function(){u(this).focus(),this.display.input.focus()},setOption:function(t,n){var i=this.options,s=i[t];i[t]==n&&"mode"!=t||(i[t]=n,e.hasOwnProperty(t)&&_i(this,e[t])(this,n,s),O(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](fr(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;n<e.length;++n)if(e[n]==t||e[n].name==t)return e.splice(n,1),!0},addOverlay:wi((function(e,n){var i=e.token?e:t.getMode(this.options,e);if(i.startState)throw new Error("Overlays may not be stateful.");b(this.state.overlays,{mode:i,modeSpec:e,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(t){return t.priority})),this.state.modeGen++,Dn(this)})),removeOverlay:wi((function(t){for(var e=this.state.overlays,n=0;n<e.length;++n){var i=e[n].modeSpec;if(i==t||"string"==typeof t&&i.name==t)return e.splice(n,1),this.state.modeGen++,void Dn(this)}})),indentLine:wi((function(t,e,n){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),at(this.doc,t)&&Zr(this,t,e,n)})),indentSelection:wi((function(t){for(var e=this.doc.sel.ranges,n=-1,i=0;i<e.length;i++){var s=e[i];if(s.empty())s.head.line>n&&(Zr(this,s.head.line,t,!0),n=s.head.line,i==this.doc.sel.primIndex&&Qn(this));else{var r=s.from(),o=s.to(),a=Math.max(n,r.line);n=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var l=a;l<n;++l)Zr(this,l,t);var c=this.doc.sel.ranges;0==r.ch&&e.length==c.length&&c[i].from().ch>0&&_s(this.doc,i,new Ra(r,c[i].to()),Xo)}}})),getTokenAt:function(t,e){return Tt(this,t,e)},getLineTokens:function(t,e){return Tt(this,ct(t),e,!0)},getTokenTypeAt:function(t){t=gt(this.doc,t);var e,n=_t(this,et(this.doc,t.line)),i=0,s=(n.length-1)/2,r=t.ch;if(0==r)e=n[2];else for(;;){var o=i+s>>1;if((o?n[2*o-1]:0)>=r)s=o;else{if(!(n[2*o+1]<r)){e=n[2*o+2];break}i=o+1}}var a=e?e.indexOf("overlay "):-1;return a<0?e:0==a?null:e.slice(0,a-1)},getModeAt:function(e){var n=this.doc.mode;return n.innerMode?t.innerMode(n,this.getTokenAt(e).state).mode:n},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var i=[];if(!n.hasOwnProperty(e))return i;var s=n[e],r=this.getModeAt(t);if("string"==typeof r[e])s[r[e]]&&i.push(s[r[e]]);else if(r[e])for(var o=0;o<r[e].length;o++){var a=s[r[e][o]];a&&i.push(a)}else r.helperType&&s[r.helperType]?i.push(s[r.helperType]):s[r.name]&&i.push(s[r.name]);for(var l=0;l<s._global.length;l++){var c=s._global[l];c.pred(r,this)&&-1==f(i,c.val)&&i.push(c.val)}return i},
getStateAfter:function(t,e){var n=this.doc;return wt(this,(t=mt(n,null==t?n.first+n.size-1:t))+1,e).state},cursorCoords:function(t,e){var n=this.doc.sel.primary();return pn(this,null==t?n.head:"object"==typeof t?gt(this.doc,t):t?n.from():n.to(),e||"page")},charCoords:function(t,e){return un(this,gt(this.doc,t),e||"page")},coordsChar:function(t,e){return fn(this,(t=cn(this,t,e||"page")).left,t.top)},lineAtHeight:function(t,e){return t=cn(this,{top:t,left:0},e||"page").top,ot(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e,n){var i,s=!1;if("number"==typeof t){var r=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>r&&(t=r,s=!0),i=et(this.doc,t)}else i=t;return ln(this,i,{top:0,left:0},e||"page",n||s).top+(s?this.doc.height-se(i):0)},defaultTextHeight:function(){return wn(this.display)},defaultCharWidth:function(){return kn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,i,s){var r=this.display,o=(t=pn(this,gt(this.doc,t))).bottom,a=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),r.sizer.appendChild(e),"over"==i)o=t.top;else if("above"==i||"near"==i){var l=Math.max(r.wrapper.clientHeight,this.doc.height),c=Math.max(r.sizer.clientWidth,r.lineSpace.clientWidth);("above"==i||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?o=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(o=t.bottom),a+e.offsetWidth>c&&(a=c-e.offsetWidth)}e.style.top=o+"px",e.style.left=e.style.right="","right"==s?(a=r.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==s?a=0:"middle"==s&&(a=(r.sizer.clientWidth-e.offsetWidth)/2),e.style.left=a+"px"),n&&Yn(this,{left:a,top:o,right:a+e.offsetWidth,bottom:o+e.offsetHeight})},triggerOnKeyDown:wi(Dr),triggerOnKeyPress:wi(Ir),triggerOnKeyUp:Er,triggerOnMouseDown:wi(Nr),execCommand:function(t){if(Za.hasOwnProperty(t))return Za[t].call(null,this)},triggerElectric:wi((function(t){no(this,t)})),findPosH:function(t,e,n,i){var s=1;e<0&&(s=-1,e=-e);for(var r=gt(this.doc,t),o=0;o<e&&!(r=ao(this.doc,r,s,n,i)).hitSide;++o);return r},moveH:wi((function(t,e){var n=this;this.extendSelectionsBy((function(i){return n.display.shift||n.doc.extend||i.empty()?ao(n.doc,i.head,t,e,n.options.rtlMoveVisually):t<0?i.from():i.to()}),Qo)})),deleteH:wi((function(t,e){var n=this.doc.sel,i=this.doc;n.somethingSelected()?i.replaceSelection("",null,"+delete"):mr(this,(function(n){var s=ao(i,n.head,t,e,!1);return t<0?{from:s,to:n.head}:{from:n.head,to:s}}))})),findPosV:function(t,e,n,i){var s=1,r=i;e<0&&(s=-1,e=-e);for(var o=gt(this.doc,t),a=0;a<e;++a){var l=pn(this,o,"div");if(null==r?r=l.left:l.left=r,(o=lo(this,l,s,n)).hitSide)break}return o},moveV:wi((function(t,e){var n=this,i=this.doc,s=[],r=!this.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy((function(o){if(r)return t<0?o.from():o.to();var a=pn(n,o.head,"div");null!=o.goalColumn&&(a.left=o.goalColumn),s.push(a.left);var l=lo(n,a,t,e);return"page"==e&&o==i.sel.primary()&&Zn(n,un(n,l,"div").top-a.top),l}),Qo),s.length)for(var o=0;o<i.sel.ranges.length;o++)i.sel.ranges[o].goalColumn=s[o]})),findWordAt:function(t){var e=et(this.doc,t.line).text,n=t.ch,i=t.ch;if(e){var s=this.getHelper(t,"wordChars");"before"!=t.sticky&&i!=e.length||!n?++i:--n;for(var r=e.charAt(n),o=A(r,s)?function(t){return A(t,s)}:/\s/.test(r)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!A(t)};n>0&&o(e.charAt(n-1));)--n;for(;i<e.length&&o(e.charAt(i));)++i}return new Ra(ct(t.line,n),ct(t.line,i))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?a(this.display.cursorDiv,"CodeMirror-overwrite"):Wo(this.display.cursorDiv,"CodeMirror-overwrite"),O(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==o(c(this))},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:wi((function(t,e){ti(this,t,e)})),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-ze(this)-this.display.barHeight,width:t.scrollWidth-ze(this)-this.display.barWidth,clientHeight:qe(this),clientWidth:Ue(this)}},scrollIntoView:wi((function(t,e){null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:ct(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line?ei(this,t):ii(this,t.from,t.to,t.margin)})),setSize:wi((function(t,e){var n=this,i=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=i(t)),null!=e&&(this.display.wrapper.style.height=i(e)),this.options.lineWrapping&&nn(this);var s=this.display.viewFrom;this.doc.iter(s,this.display.viewTo,(function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){Pn(n,s,"widget");break}++s})),this.curOp.forceUpdate=!0,O(this,"refresh",this)})),operation:function(t){return bi(this,t)},startOperation:function(){return pi(this)},endOperation:function(){return hi(this)},refresh:wi((function(){var t=this.display.cachedTextHeight;Dn(this),this.curOp.forceUpdate=!0,sn(this),ti(this,this.doc.scrollLeft,this.doc.scrollTop),Ii(this.display),(null==t||Math.abs(t-wn(this.display))>.5||this.options.lineWrapping)&&Sn(this),O(this,"refresh",this)})),swapDoc:wi((function(t){var e=this.doc;return e.cm=null,this.state.selectingText&&this.state.selectingText(),es(this,t),sn(this),this.display.input.reset(),ti(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,ke(this,"swapDoc",this,e),e})),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},L(t),t.registerHelper=function(e,i,s){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][i]=s},t.registerGlobalHelper=function(e,i,s,r){t.registerHelper(e,i,r),n[e]._global.push({pred:s,val:r})}}function ao(t,e,n,i,s){function r(){var n=e.line+u;return!(n<t.first||n>=t.first+t.size)&&(e=new ct(n,e.ch,e.sticky),c=et(t,n))}function o(o){var a;if("codepoint"==i){var l=c.text.charCodeAt(e.ch+(n>0?0:-1));if(isNaN(l))a=null;else{var p=n>0?l>=55296&&l<56320:l>=56320&&l<57343;a=new ct(e.line,Math.max(0,Math.min(c.text.length,e.ch+n*(p?2:1))),-n)}}else a=s?br(t.cm,c,e,n):vr(c,e,n);if(null==a){if(o||!r())return!1;e=yr(s,t.cm,c,e.line,u)}else e=a;return!0}var a=e,l=n,c=et(t,e.line),u=s&&"rtl"==t.direction?-n:n;if("char"==i||"codepoint"==i)o();else if("column"==i)o(!0);else if("word"==i||"group"==i)for(var p=null,h="group"==i,d=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;!(n<0)||o(!f);f=!1){var m=c.text.charAt(e.ch)||"\n",g=A(m,d)?"w":h&&"\n"==m?"n":!h||/\s/.test(m)?null:"p";if(!h||f||g||(g="s"),p&&p!=g){n<0&&(n=1,o(),e.sticky="after");break}if(g&&(p=g),n>0&&!o(!f))break}var v=Ps(t,e,a,l,!0);return pt(a,v)&&(v.hitSide=!0),v}function lo(t,e,n,i){var s,r,o=t.doc,a=e.left;if("page"==i){var l=Math.min(t.display.wrapper.clientHeight,u(t).innerHeight||o(t).documentElement.clientHeight),c=Math.max(l-.5*wn(t.display),3);s=(n>0?e.bottom:e.top)+n*c}else"line"==i&&(s=n>0?e.bottom+3:e.top-3);for(;(r=fn(t,a,s)).outside;){if(n<0?s<=0:s>=o.height){r.hitSide=!0;break}s+=5*n}return r}function co(t,e){var n=Ge(t,e.line);if(!n||n.hidden)return null;var i=et(t.doc,e.line),s=He(n,i,e.line),r=P(i,t.doc.direction),o="left";r&&(o=D(r,e.ch)%2?"right":"left");var a=Xe(s.map,e.ch,o);return a.offset="right"==a.collapse?a.end:a.start,a}function uo(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function po(t,e){return e&&(t.bad=!0),t}function ho(t,e,n,i,s){function r(t){return function(e){return e.id==t}}function o(){u&&(c+=p,h&&(c+=p),u=h=!1)}function a(t){t&&(o(),c+=t)}function l(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(n)return void a(n);var c,d=e.getAttribute("cm-marker");if(d){var f=t.findMarks(ct(i,0),ct(s+1,0),r(+d));return void(f.length&&(c=f[0].find(0))&&a(nt(t.doc,c.from,c.to).join(p)))}if("false"==e.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;m&&o();for(var g=0;g<e.childNodes.length;g++)l(e.childNodes[g]);/^(pre|p)$/i.test(e.nodeName)&&(h=!0),m&&(u=!0)}else 3==e.nodeType&&a(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(var c="",u=!1,p=t.doc.lineSeparator(),h=!1;l(e),e!=n;)e=e.nextSibling,h=!1;return c}function fo(t,e,n){var i;if(e==t.display.lineDiv){if(!(i=t.display.lineDiv.childNodes[n]))return po(t.clipPos(ct(t.display.viewTo-1)),!0);e=null,n=0}else for(i=e;;i=i.parentNode){if(!i||i==t.display.lineDiv)return null;if(i.parentNode&&i.parentNode==t.display.lineDiv)break}for(var s=0;s<t.display.view.length;s++){var r=t.display.view[s];if(r.node==i)return mo(r,e,n)}}function mo(t,e,n){function i(e,n,i){for(var s=-1;s<(p?p.length:0);s++)for(var r=s<0?u.map:p[s],o=0;o<r.length;o+=3){var a=r[o+2];if(a==e||a==n){var l=rt(s<0?t.line:t.rest[s]),c=r[o]+i;return(i<0||a!=e)&&(c=r[o+(i?1:0)]),ct(l,c)}}}var s=t.text.firstChild,o=!1;if(!e||!r(s,e))return po(ct(rt(t.line),0),!0);if(e==s&&(o=!0,e=s.childNodes[n],n=0,!e)){var a=t.rest?v(t.rest):t.line;return po(ct(rt(a),a.text.length),o)}var l=3==e.nodeType?e:null,c=e;for(l||1!=e.childNodes.length||3!=e.firstChild.nodeType||(l=e.firstChild,n&&(n=l.nodeValue.length));c.parentNode!=s;)c=c.parentNode;var u=t.measure,p=u.maps,h=i(l,c,n);if(h)return po(h,o);for(var d=c.nextSibling,f=l?l.nodeValue.length-n:0;d;d=d.nextSibling){if(h=i(d,d.firstChild,0))return po(ct(h.line,h.ch-f),o);f+=d.textContent.length}for(var m=c.previousSibling,g=n;m;m=m.previousSibling){if(h=i(m,m.firstChild,-1))return po(ct(h.line,h.ch+g),o);g+=m.textContent.length}}function go(t,e){function n(){t.value=l.getValue()}if((e=e?h(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var i=o(t.ownerDocument);e.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}var s;if(t.form&&(oa(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var r=t.form;s=r.submit;try{var a=r.submit=function(){n(),r.submit=s,r.submit(),r.submit=a}}catch(t){}}e.finishInit=function(i){i.save=n,i.getTextArea=function(){return t},i.toTextArea=function(){i.toTextArea=isNaN,n(),t.parentNode.removeChild(i.getWrapperElement()),t.style.display="",t.form&&(I(t.form,"submit",n),e.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=s))}},t.style.display="none";var l=Yr((function(e){return t.parentNode.insertBefore(e,t.nextSibling)}),e);return l}function vo(t){t.off=I,t.on=oa,t.wheelEventPixels=zi,t.Doc=Ua,t.splitLines=la,t.countColumn=d,t.findColumn=m,t.isWordChar=k,t.Pass=Yo,t.signal=O,t.Line=wa,t.changeEnd=Hi,t.scrollbarModel=Pa,t.Pos=ct,t.cmpPos=ut,t.modes=ha,t.mimeModes=da,t.resolveMode=K,t.getMode=Y,t.modeExtensions=fa,t.extendMode=X,t.copyState=Z,t.startState=tt,t.innerMode=Q,t.commands=Za,t.keyMap=Ka,t.keyName=dr,t.isModifierKey=pr,t.lookupKey=ur,t.normalizeKeyMap=cr,t.StringStream=ma,t.SharedTextMarker=Ba,t.TextMarker=$a,t.LineWidget=La,t.e_preventDefault=F,t.e_stopPropagation=$,t.e_stop=z,t.addClass=a,t.contains=r,t.rmClass=Wo,t.keyNames=Ha}var yo=navigator.userAgent,bo=navigator.platform,_o=/gecko\/\d/i.test(yo),wo=/MSIE \d/.test(yo),ko=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yo),Ao=/Edge\/(\d+)/.exec(yo),Co=wo||ko||Ao,To=Co&&(wo?document.documentMode||6:+(Ao||ko)[1]),So=!Ao&&/WebKit\//.test(yo),xo=So&&/Qt\/\d+\.\d+/.test(yo),jo=!Ao&&/Chrome\/(\d+)/.exec(yo),Do=jo&&+jo[1],Po=/Opera\//.test(yo),Eo=/Apple Computer/.test(navigator.vendor),Io=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(yo),Oo=/PhantomJS/.test(yo),No=Eo&&(/Mobile\/\w+/.test(yo)||navigator.maxTouchPoints>2),Mo=/Android/.test(yo),Ro=No||Mo||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(yo),Lo=No||/Mac/.test(bo),Fo=/\bCrOS\b/.test(yo),$o=/win/i.test(bo),Bo=Po&&yo.match(/Version\/(\d*\.\d*)/);Bo&&(Bo=Number(Bo[1])),Bo&&Bo>=15&&(Po=!1,So=!0);var zo,Uo=Lo&&(xo||Po&&(null==Bo||Bo<12.11)),qo=_o||Co&&To>=9,Wo=function(e,n){var i=e.className,s=t(n).exec(i);if(s){var r=i.slice(s.index+s[0].length);e.className=i.slice(0,s.index)+(r?s[1]+r:"")}};zo=document.createRange?function(t,e,n,i){var s=document.createRange();return s.setEnd(i||t,n),s.setStart(t,e),s}:function(t,e,n){var i=document.body.createTextRange();try{i.moveToElementText(t.parentNode)}catch(t){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",e),i};var Ho=function(t){t.select()};No?Ho=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:Co&&(Ho=function(t){try{t.select()}catch(t){}});var Jo=function(){this.id=null,this.f=null,this.time=0,this.handler=p(this.onTimeout,this)};Jo.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},Jo.prototype.set=function(t,e){this.f=e;var n=+new Date+t;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=n)};var Vo,Go,Ko=50,Yo={toString:function(){return"CodeMirror.Pass"}},Xo={scroll:!1},Zo={origin:"*mouse"},Qo={origin:"+move"},ta=[""],ea=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,na=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,ia=null,sa=function(){function t(t){return t<=247?n.charAt(t):1424<=t&&t<=1524?"R":1536<=t&&t<=1785?i.charAt(t-1536):1774<=t&&t<=2220?"r":8192<=t&&t<=8203?"w":8204==t?"b":"L"}function e(t,e,n){this.level=t,this.from=e,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",s=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;return function(n,i){var c="ltr"==i?"L":"R";if(0==n.length||"ltr"==i&&!s.test(n))return!1;for(var u=n.length,p=[],h=0;h<u;++h)p.push(t(n.charCodeAt(h)));for(var d=0,f=c;d<u;++d){var m=p[d];"m"==m?p[d]=f:f=m}for(var g=0,y=c;g<u;++g){var b=p[g];"1"==b&&"r"==y?p[g]="n":o.test(b)&&(y=b,"r"==b&&(p[g]="R"))}for(var _=1,w=p[0];_<u-1;++_){var k=p[_];"+"==k&&"1"==w&&"1"==p[_+1]?p[_]="1":","!=k||w!=p[_+1]||"1"!=w&&"n"!=w||(p[_]=w),w=k}for(var A=0;A<u;++A){var C=p[A];if(","==C)p[A]="N";else if("%"==C){var T=void 0;for(T=A+1;T<u&&"%"==p[T];++T);for(var S=A&&"!"==p[A-1]||T<u&&"1"==p[T]?"1":"N",x=A;x<T;++x)p[x]=S;A=T-1}}for(var j=0,D=c;j<u;++j){var P=p[j];"L"==D&&"1"==P?p[j]="L":o.test(P)&&(D=P)}for(var E=0;E<u;++E)if(r.test(p[E])){var I=void 0;for(I=E+1;I<u&&r.test(p[I]);++I);for(var O="L"==(E?p[E-1]:c),N=O==("L"==(I<u?p[I]:c))?O?"L":"R":c,M=E;M<I;++M)p[M]=N;E=I-1}for(var R,L=[],F=0;F<u;)if(a.test(p[F])){var $=F;for(++F;F<u&&a.test(p[F]);++F);L.push(new e(0,$,F))}else{var B=F,z=L.length,U="rtl"==i?1:0;for(++F;F<u&&"L"!=p[F];++F);for(var q=B;q<F;)if(l.test(p[q])){B<q&&(L.splice(z,0,new e(1,B,q)),z+=U);var W=q;for(++q;q<F&&l.test(p[q]);++q);L.splice(z,0,new e(2,W,q)),z+=U,B=q}else++q;B<F&&L.splice(z,0,new e(1,B,F))}return"ltr"==i&&(1==L[0].level&&(R=n.match(/^\s+/))&&(L[0].from=R[0].length,L.unshift(new e(0,0,R[0].length))),1==v(L).level&&(R=n.match(/\s+$/))&&(v(L).to-=R[0].length,L.push(new e(0,u-R[0].length,u)))),"rtl"==i?L.reverse():L}}(),ra=[],oa=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var i=t._handlers||(t._handlers={});i[e]=(i[e]||ra).concat(n)}},aa=function(){if(Co&&To<9)return!1;var t=i("div");return"draggable"in t||"dragDrop"in t}(),la=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],i=t.length;e<=i;){var s=t.indexOf("\n",e);-1==s&&(s=t.length);var r=t.slice(e,"\r"==t.charAt(s-1)?s-1:s),o=r.indexOf("\r");-1!=o?(n.push(r.slice(0,o)),e+=o+1):(n.push(r),e=s+1)}return n}:function(t){return t.split(/\r\n?|\n/)},ca=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},ua=function(){var t=i("div");return"oncopy"in t||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),pa=null,ha={},da={},fa={},ma=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};ma.prototype.eol=function(){return this.pos>=this.string.length},ma.prototype.sol=function(){return this.pos==this.lineStart},ma.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ma.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},ma.prototype.eat=function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t.test?t.test(e):t(e)))return++this.pos,e},ma.prototype.eatWhile=function(t){for(var e=this.pos;this.eat(t););return this.pos>e},ma.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},ma.prototype.skipToEnd=function(){this.pos=this.string.length},ma.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},ma.prototype.backUp=function(t){this.pos-=t},ma.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=d(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?d(this.string,this.lineStart,this.tabSize):0)},ma.prototype.indentation=function(){return d(this.string,null,this.tabSize)-(this.lineStart?d(this.string,this.lineStart,this.tabSize):0)},ma.prototype.match=function(t,e,n){if("string"!=typeof t){var i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}var s=function(t){return n?t.toLowerCase():t};if(s(this.string.substr(this.pos,t.length))==s(t))return!1!==e&&(this.pos+=t.length),!0},ma.prototype.current=function(){return this.string.slice(this.start,this.pos)},ma.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},ma.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},ma.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ga=function(t,e){this.state=t,this.lookAhead=e},va=function(t,e,n,i){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};va.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},va.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},va.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},va.fromSaved=function(t,e,n){return e instanceof ga?new va(t,Z(t.mode,e.state),n,e.lookAhead):new va(t,Z(t.mode,e),n)},va.prototype.save=function(t){var e=!1!==t?Z(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ga(e,this.maxLookAhead):e};var ya=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n},ba=!1,_a=!1,wa=function(t,e,n){this.text=t,Ut(this,e),this.height=n?n(this):1};wa.prototype.lineNo=function(){return rt(this)},L(wa);var ka,Aa={},Ca={},Ta=null,Sa=null,xa={left:0,right:0,top:0,bottom:0},ja=function(t,e,n){this.cm=n;var s=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");s.tabIndex=r.tabIndex=-1,t(s),t(r),oa(s,"scroll",(function(){s.clientHeight&&e(s.scrollTop,"vertical")})),oa(r,"scroll",(function(){r.clientWidth&&e(r.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,Co&&To<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ja.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?i+"px":"0";var s=t.viewHeight-(e?i:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+s)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=t.barLeft+"px";var r=t.viewWidth-t.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+r)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:e?i:0}},ja.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ja.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ja.prototype.zeroWidthHack=function(){var t=Lo&&!Io?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new Jo,this.disableVert=new Jo},ja.prototype.enableZeroWidthBar=function(t,e,n){function i(){var s=t.getBoundingClientRect();("vert"==n?document.elementFromPoint(s.right-1,(s.top+s.bottom)/2):document.elementFromPoint((s.right+s.left)/2,s.bottom-1))!=t?t.style.visibility="hidden":e.set(1e3,i)}t.style.visibility="",e.set(1e3,i)},ja.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Da=function(){};Da.prototype.update=function(){return{bottom:0,right:0}},Da.prototype.setScrollLeft=function(){},Da.prototype.setScrollTop=function(){},Da.prototype.clear=function(){};var Pa={native:ja,null:Da},Ea=0,Ia=function(t,e,n){var i=t.display;this.viewport=e,this.visible=Vn(i,t.doc,e),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Ue(t),this.force=n,this.dims=An(t),this.events=[]};Ia.prototype.signal=function(t,e){R(t,e)&&this.events.push(arguments)},Ia.prototype.finish=function(){for(var t=0;t<this.events.length;t++)O.apply(null,this.events[t])};var Oa=0,Na=null;Co?Na=-.53:_o?Na=15:jo?Na=-.7:Eo&&(Na=-1/3);var Ma=function(t,e){this.ranges=t,this.primIndex=e};Ma.prototype.primary=function(){return this.ranges[this.primIndex]},Ma.prototype.equals=function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var n=this.ranges[e],i=t.ranges[e];if(!pt(n.anchor,i.anchor)||!pt(n.head,i.head))return!1}return!0},Ma.prototype.deepCopy=function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new Ra(ht(this.ranges[e].anchor),ht(this.ranges[e].head));return new Ma(t,this.primIndex)},Ma.prototype.somethingSelected=function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},Ma.prototype.contains=function(t,e){e||(e=t);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(ut(e,i.from())>=0&&ut(t,i.to())<=0)return n}return-1};var Ra=function(t,e){this.anchor=t,this.head=e};Ra.prototype.from=function(){return ft(this.anchor,this.head)},Ra.prototype.to=function(){return dt(this.anchor,this.head)},Ra.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Hs.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=t,i=t+e;n<i;++n){var s=this.lines[n];this.height-=s.height,le(s),ke(s,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,n){this.height+=n,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var i=0;i<e.length;++i)e[i].parent=this},iterN:function(t,e,n){for(var i=t+e;t<i;++t)if(n(this.lines[t]))return!0}},Js.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var n=0;n<this.children.length;++n){var i=this.children[n],s=i.chunkSize();if(t<s){var r=Math.min(e,s-t),o=i.height;if(i.removeInner(t,r),this.height-=o-i.height,s==r&&(this.children.splice(n--,1),i.parent=null),0==(e-=r))break;t=0}else t-=s}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof Hs))){var a=[];this.collapse(a),this.children=[new Hs(a)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,n){this.size+=e.length,this.height+=n;for(var i=0;i<this.children.length;++i){var s=this.children[i],r=s.chunkSize();if(t<=r){if(s.insertInner(t,e,n),s.lines&&s.lines.length>50){for(var o=s.lines.length%25+25,a=o;a<s.lines.length;){var l=new Hs(s.lines.slice(a,a+=25));s.height-=l.height,this.children.splice(++i,0,l),l.parent=this}s.lines=s.lines.slice(0,o),this.maybeSpill()}break}t-=r}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=new Js(t.children.splice(t.children.length-5,5));if(t.parent){t.size-=e.size,t.height-=e.height;var n=f(t.parent.children,t);t.parent.children.splice(n+1,0,e)}else{var i=new Js(t.children);i.parent=t,t.children=[i,e],t=i}e.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var i=0;i<this.children.length;++i){var s=this.children[i],r=s.chunkSize();if(t<r){var o=Math.min(e,r-t);if(s.iterN(t,o,n))return!0;if(0==(e-=o))break;t=0}else t-=r}}};var La=function(t,e,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=t,this.node=e};La.prototype.clear=function(){var t=this.doc.cm,e=this.line.widgets,n=this.line,i=rt(n);if(null!=i&&e){for(var s=0;s<e.length;++s)e[s]==this&&e.splice(s--,1);e.length||(n.widgets=null);var r=Re(this);st(n,Math.max(0,n.height-r)),t&&(bi(t,(function(){Vs(t,n,-r),Pn(t,i,"widget")})),ke(t,"lineWidgetCleared",t,this,i))}},La.prototype.changed=function(){var t=this,e=this.height,n=this.doc.cm,i=this.line;this.height=null;var s=Re(this)-e;s&&(ne(this.doc,i)||st(i,i.height+s),n&&bi(n,(function(){n.curOp.forceUpdate=!0,Vs(n,i,s),ke(n,"lineWidgetChanged",n,t,rt(i))})))},L(La);var Fa=0,$a=function(t,e){this.lines=[],this.type=e,this.doc=t,this.id=++Fa};$a.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&pi(t),R(this,"clear")){var n=this.find();n&&ke(this,"clear",n.from,n.to)}for(var i=null,s=null,r=0;r<this.lines.length;++r){var o=this.lines[r],a=Ot(o.markedSpans,this);t&&!this.collapsed?Pn(t,rt(o),"text"):t&&(null!=a.to&&(s=rt(o)),null!=a.from&&(i=rt(o))),o.markedSpans=Nt(o.markedSpans,a),null==a.from&&this.collapsed&&!ne(this.doc,o)&&t&&st(o,wn(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var c=Xt(this.lines[l]),u=re(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&Dn(t,i,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&xs(t.doc)),t&&ke(t,"markerCleared",t,this,i,s),e&&hi(t),this.parent&&this.parent.clear()}},$a.prototype.find=function(t,e){var n,i;null==t&&"bookmark"==this.type&&(t=1);for(var s=0;s<this.lines.length;++s){var r=this.lines[s],o=Ot(r.markedSpans,this);if(null!=o.from&&(n=ct(e?r:rt(r),o.from),-1==t))return n;if(null!=o.to&&(i=ct(e?r:rt(r),o.to),1==t))return i}return n&&{from:n,to:i}},$a.prototype.changed=function(){var t=this,e=this.find(-1,!0),n=this,i=this.doc.cm;e&&i&&bi(i,(function(){var s=e.line,r=rt(e.line),o=Ge(i,r);if(o&&(en(o),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!ne(n.doc,s)&&null!=n.height){var a=n.height;n.height=null;var l=Re(n)-a;l&&st(s,s.height+l)}ke(i,"markerChanged",i,t)}))},$a.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=f(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},$a.prototype.detachLine=function(t){if(this.lines.splice(f(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},L($a);var Ba=function(t,e){this.markers=t,this.primary=e;for(var n=0;n<t.length;++n)t[n].parent=this};Ba.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();ke(this,"clear")}},Ba.prototype.find=function(t,e){return this.primary.find(t,e)},L(Ba);var za=0,Ua=function(t,e,n,i,s){if(!(this instanceof Ua))return new Ua(t,e,n,i,s);null==n&&(n=0),Js.call(this,[new Hs([new wa("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var r=ct(n,0);this.sel=Wi(r),this.history=new ss(null),this.id=++za,this.modeOption=e,this.lineSep=i,this.direction="rtl"==s?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),Qi(this,{from:r,to:r,text:t}),Cs(this,Wi(r),Xo)};Ua.prototype=w(Js.prototype,{constructor:Ua,iter:function(t,e,n){n?this.iterN(t-this.first,e-t,n):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var n=0,i=0;i<e.length;++i)n+=e[i].height;this.insertInner(t-this.first,e,n)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=it(this,this.first,this.first+this.size);return!1===t?e:e.join(t||this.lineSeparator())},setValue:ki((function(t){var e=ct(this.first,0),n=this.first+this.size-1;Ns(this,{from:e,to:ct(n,et(this,n).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&ti(this.cm,0,0),Cs(this,Wi(e),Xo)})),replaceRange:function(t,e,n,i){Bs(this,t,e=gt(this,e),n=n?gt(this,n):e,i)},getRange:function(t,e,n){var i=nt(this,gt(this,t),gt(this,e));return!1===n?i:""===n?i.join(""):i.join(n||this.lineSeparator())},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},
getLineHandle:function(t){if(at(this,t))return et(this,t)},getLineNumber:function(t){return rt(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=et(this,t)),Xt(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return gt(this,t)},getCursor:function(t){var e=this.sel.primary();return null==t||"head"==t?e.head:"anchor"==t?e.anchor:"end"==t||"to"==t||!1===t?e.to():e.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ki((function(t,e,n){ws(this,gt(this,"number"==typeof t?ct(t,e||0):t),null,n)})),setSelection:ki((function(t,e,n){ws(this,gt(this,t),gt(this,e||t),n)})),extendSelection:ki((function(t,e,n){ys(this,gt(this,t),e&&gt(this,e),n)})),extendSelections:ki((function(t,e){bs(this,yt(this,t),e)})),extendSelectionsBy:ki((function(t,e){bs(this,yt(this,y(this.sel.ranges,t)),e)})),setSelections:ki((function(t,e,n){if(t.length){for(var i=[],s=0;s<t.length;s++)i[s]=new Ra(gt(this,t[s].anchor),gt(this,t[s].head||t[s].anchor));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),Cs(this,qi(this.cm,i,e),n)}})),addSelection:ki((function(t,e,n){var i=this.sel.ranges.slice(0);i.push(new Ra(gt(this,t),gt(this,e||t))),Cs(this,qi(this.cm,i,i.length-1),n)})),getSelection:function(t){for(var e,n=this.sel.ranges,i=0;i<n.length;i++){var s=nt(this,n[i].from(),n[i].to());e=e?e.concat(s):s}return!1===t?e:e.join(t||this.lineSeparator())},getSelections:function(t){for(var e=[],n=this.sel.ranges,i=0;i<n.length;i++){var s=nt(this,n[i].from(),n[i].to());!1!==t&&(s=s.join(t||this.lineSeparator())),e[i]=s}return e},replaceSelection:function(t,e,n){for(var i=[],s=0;s<this.sel.ranges.length;s++)i[s]=t;this.replaceSelections(i,e,n||"+input")},replaceSelections:ki((function(t,e,n){for(var i=[],s=this.sel,r=0;r<s.ranges.length;r++){var o=s.ranges[r];i[r]={from:o.from(),to:o.to(),text:this.splitLines(t[r]),origin:n}}for(var a=e&&"end"!=e&&Ki(this,i,e),l=i.length-1;l>=0;l--)Ns(this,i[l]);a?As(this,a):this.cm&&Qn(this.cm)})),undo:ki((function(){Rs(this,"undo")})),redo:ki((function(){Rs(this,"redo")})),undoSelection:ki((function(){Rs(this,"undo",!0)})),redoSelection:ki((function(){Rs(this,"redo",!0)})),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,i=0;i<t.done.length;i++)t.done[i].ranges||++e;for(var s=0;s<t.undone.length;s++)t.undone[s].ranges||++n;return{undo:e,redo:n}},clearHistory:function(){var t=this;this.history=new ss(this.history),ts(this,(function(e){return e.history=t.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:gs(this.history.done),undone:gs(this.history.undone)}},setHistory:function(t){var e=this.history=new ss(this.history);e.done=gs(t.done.slice(0),null,!0),e.undone=gs(t.undone.slice(0),null,!0)},setGutterMarker:ki((function(t,e,n){return Ws(this,t,"gutter",(function(t){var i=t.gutterMarkers||(t.gutterMarkers={});return i[e]=n,!n&&C(i)&&(t.gutterMarkers=null),!0}))})),clearGutter:ki((function(t){var e=this;this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[t]&&Ws(e,n,"gutter",(function(){return n.gutterMarkers[t]=null,C(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(t){var e;if("number"==typeof t){if(!at(this,t))return null;if(e=t,!(t=et(this,t)))return null}else if(null==(e=rt(t)))return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:ki((function(e,n,i){return Ws(this,e,"gutter"==n?"gutter":"class",(function(e){var s="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[s]){if(t(i).test(e[s]))return!1;e[s]+=" "+i}else e[s]=i;return!0}))})),removeLineClass:ki((function(e,n,i){return Ws(this,e,"gutter"==n?"gutter":"class",(function(e){var s="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass",r=e[s];if(!r)return!1;if(null==i)e[s]=null;else{var o=r.match(t(i));if(!o)return!1;var a=o.index+o[0].length;e[s]=r.slice(0,o.index)+(o.index&&a!=r.length?" ":"")+r.slice(a)||null}return!0}))})),addLineWidget:ki((function(t,e,n){return Gs(this,t,e,n)})),removeLineWidget:function(t){t.clear()},markText:function(t,e,n){return Ks(this,gt(this,t),gt(this,e),n,n&&n.type||"range")},setBookmark:function(t,e){var n={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared,handleMouseEvents:e&&e.handleMouseEvents};return Ks(this,t=gt(this,t),t,n,"bookmark")},findMarksAt:function(t){var e=[],n=et(this,(t=gt(this,t)).line).markedSpans;if(n)for(var i=0;i<n.length;++i){var s=n[i];(null==s.from||s.from<=t.ch)&&(null==s.to||s.to>=t.ch)&&e.push(s.marker.parent||s.marker)}return e},findMarks:function(t,e,n){t=gt(this,t),e=gt(this,e);var i=[],s=t.line;return this.iter(t.line,e.line+1,(function(r){var o=r.markedSpans;if(o)for(var a=0;a<o.length;a++){var l=o[a];null!=l.to&&s==t.line&&t.ch>=l.to||null==l.from&&s!=t.line||null!=l.from&&s==e.line&&l.from>=e.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++s})),i},getAllMarks:function(){var t=[];return this.iter((function(e){var n=e.markedSpans;if(n)for(var i=0;i<n.length;++i)null!=n[i].from&&t.push(n[i].marker)})),t},posFromIndex:function(t){var e,n=this.first,i=this.lineSeparator().length;return this.iter((function(s){var r=s.text.length+i;if(r>t)return e=t,!0;t-=r,++n})),gt(this,ct(n,e))},indexFromPos:function(t){var e=(t=gt(this,t)).ch;if(t.line<this.first||t.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,t.line,(function(t){e+=t.text.length+n})),e},copy:function(t){var e=new Ua(it(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,n=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<n&&(n=t.to);var i=new Ua(it(this,e,n),t.mode||this.modeOption,e,this.lineSep,this.direction);return t.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:t.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],Zs(i,Xs(this)),i},unlinkDoc:function(t){if(t instanceof Yr&&(t=t.doc),this.linked)for(var e=0;e<this.linked.length;++e){if(this.linked[e].doc==t){this.linked.splice(e,1),t.unlinkDoc(this),Qs(Xs(this));break}}if(t.history==this.history){var n=[t.id];ts(t,(function(t){return n.push(t.id)}),!0),t.history=new ss(null),t.history.done=gs(this.history.done,n),t.history.undone=gs(this.history.undone,n)}},iterLinkedDocs:function(t){ts(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):la(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ki((function(t){"rtl"!=t&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter((function(t){return t.order=null})),this.cm&&is(this.cm))}))}),Ua.prototype.eachLine=Ua.prototype.iter;for(var qa=0,Wa=!1,Ha={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ja=0;Ja<10;Ja++)Ha[Ja+48]=Ha[Ja+96]=String(Ja);for(var Va=65;Va<=90;Va++)Ha[Va]=String.fromCharCode(Va);for(var Ga=1;Ga<=12;Ga++)Ha[Ga+111]=Ha[Ga+63235]="F"+Ga;var Ka={basic:{Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pcDefault:{"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},emacsy:{"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},macDefault:{"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]}};Ka.default=Lo?Ka.macDefault:Ka.pcDefault;var Ya,Xa,Za={selectAll:Is,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Xo)},killLine:function(t){return mr(t,(function(e){if(e.empty()){var n=et(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line<t.lastLine()?{from:e.head,to:ct(e.head.line+1,0)}:{from:e.head,to:ct(e.head.line,n)}}return{from:e.from(),to:e.to()}}))},deleteLine:function(t){return mr(t,(function(e){return{from:ct(e.from().line,0),to:gt(t.doc,ct(e.to().line+1,0))}}))},delLineLeft:function(t){return mr(t,(function(t){return{from:ct(t.from().line,0),to:t.from()}}))},delWrappedLineLeft:function(t){return mr(t,(function(e){var n=t.charCoords(e.head,"div").top+5;return{from:t.coordsChar({left:0,top:n},"div"),to:e.from()}}))},delWrappedLineRight:function(t){return mr(t,(function(e){var n=t.charCoords(e.head,"div").top+5,i=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:e.from(),to:i}}))},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(ct(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(ct(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy((function(e){return _r(t,e.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy((function(e){return kr(t,e.head)}),{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy((function(e){return wr(t,e.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")}),Qo)},goLineLeft:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")}),Qo)},goLineLeftSmart:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5,i=t.coordsChar({left:0,top:n},"div");return i.ch<t.getLine(i.line).search(/\S/)?kr(t,e.head):i}),Qo)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"codepoint")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var e=[],n=t.listSelections(),i=t.options.tabSize,s=0;s<n.length;s++){var r=n[s].from(),o=d(t.getLine(r.line),r.ch,i);e.push(g(i-o%i))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return bi(t,(function(){for(var e=t.listSelections(),n=[],i=0;i<e.length;i++)if(e[i].empty()){var s=e[i].head,r=et(t.doc,s.line).text;if(r)if(s.ch==r.length&&(s=new ct(s.line,s.ch-1)),s.ch>0)s=new ct(s.line,s.ch+1),t.replaceRange(r.charAt(s.ch-1)+r.charAt(s.ch-2),ct(s.line,s.ch-2),s,"+transpose");else if(s.line>t.doc.first){var o=et(t.doc,s.line-1).text;o&&(s=new ct(s.line,1),t.replaceRange(r.charAt(0)+t.doc.lineSeparator()+o.charAt(o.length-1),ct(s.line-1,o.length-1),s,"+transpose"))}n.push(new Ra(s,s))}t.setSelections(n)}))},newlineAndIndent:function(t){return bi(t,(function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var i=0;i<e.length;i++)t.indentLine(e[i].from().line,null,!0);Qn(t)}))},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}},Qa=new Jo,tl=null,el=400,nl=function(t,e,n){this.time=t,this.pos=e,this.button=n};nl.prototype.compare=function(t,e,n){return this.time+el>t&&0==ut(e,this.pos)&&n==this.button};var il={toString:function(){return"CodeMirror.Init"}},sl={},rl={};Yr.defaults=sl,Yr.optionHandlers=rl;var ol=[];Yr.defineInitHook=function(t){return ol.push(t)};var al=null,ll=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Jo,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ll.prototype.init=function(t){function e(t){for(var e=t.target;e;e=e.parentNode){if(e==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(e.className))break}return!1}function n(t){if(e(t)&&!N(r,t)){if(r.somethingSelected())Qr({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var n=io(r);Qr({lineWise:!0,text:n.text}),"cut"==t.type&&r.operation((function(){r.setSelections(n.ranges,0,Xo),r.replaceSelection("",null,"cut")}))}if(t.clipboardData){t.clipboardData.clearData();var i=al.text.join("\n");if(t.clipboardData.setData("Text",i),t.clipboardData.getData("Text")==i)return void t.preventDefault()}var l=ro(),c=l.firstChild;so(c),r.display.lineSpace.insertBefore(l,r.display.lineSpace.firstChild),c.value=al.text.join("\n");var u=o(a.ownerDocument);Ho(c),setTimeout((function(){r.display.lineSpace.removeChild(l),u.focus(),u==a&&s.showPrimarySelection()}),50)}}var i=this,s=this,r=s.cm,a=s.div=t.lineDiv;a.contentEditable=!0,so(a,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),oa(a,"paste",(function(t){!e(t)||N(r,t)||eo(t,r)||To<=11&&setTimeout(_i(r,(function(){return i.updateFromDOM()})),20)})),oa(a,"compositionstart",(function(t){i.composing={data:t.data,done:!1}})),oa(a,"compositionupdate",(function(t){i.composing||(i.composing={data:t.data,done:!1})})),oa(a,"compositionend",(function(t){i.composing&&(t.data!=i.composing.data&&i.readFromDOMSoon(),i.composing.done=!0)})),oa(a,"touchstart",(function(){return s.forceCompositionEnd()})),oa(a,"input",(function(){i.composing||i.readFromDOMSoon()})),oa(a,"copy",n),oa(a,"cut",n)},ll.prototype.screenReaderLabelChanged=function(t){t?this.div.setAttribute("aria-label",t):this.div.removeAttribute("aria-label")},ll.prototype.prepareSelection=function(){var t=Rn(this.cm,!1);return t.focus=o(this.div.ownerDocument)==this.div,t},ll.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},ll.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ll.prototype.showPrimarySelection=function(){var t=this.getSelection(),e=this.cm,n=e.doc.sel.primary(),i=n.from(),s=n.to();if(e.display.viewTo==e.display.viewFrom||i.line>=e.display.viewTo||s.line<e.display.viewFrom)t.removeAllRanges();else{var r=fo(e,t.anchorNode,t.anchorOffset),o=fo(e,t.focusNode,t.focusOffset);if(!r||r.bad||!o||o.bad||0!=ut(ft(r,o),i)||0!=ut(dt(r,o),s)){var a=e.display.view,l=i.line>=e.display.viewFrom&&co(e,i)||{node:a[0].measure.map[2],offset:0},c=s.line<e.display.viewTo&&co(e,s);if(!c){var u=a[a.length-1].measure,p=u.maps?u.maps[u.maps.length-1]:u.map;c={node:p[p.length-1],offset:p[p.length-2]-p[p.length-3]}}if(l&&c){var h,d=t.rangeCount&&t.getRangeAt(0);try{h=zo(l.node,l.offset,c.offset,c.node)}catch(t){}h&&(!_o&&e.state.focused?(t.collapse(l.node,l.offset),h.collapsed||(t.removeAllRanges(),t.addRange(h))):(t.removeAllRanges(),t.addRange(h)),d&&null==t.anchorNode?t.addRange(d):_o&&this.startGracePeriod()),this.rememberSelection()}else t.removeAllRanges()}}},ll.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation((function(){return t.cm.curOp.selectionChanged=!0}))}),20)},ll.prototype.showMultipleSelections=function(t){n(this.cm.display.cursorDiv,t.cursors),n(this.cm.display.selectionDiv,t.selection)},ll.prototype.rememberSelection=function(){var t=this.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},ll.prototype.selectionInEditor=function(){var t=this.getSelection();if(!t.rangeCount)return!1;var e=t.getRangeAt(0).commonAncestorContainer;return r(this.div,e)},ll.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&o(this.div.ownerDocument)==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},ll.prototype.blur=function(){this.div.blur()},ll.prototype.getField=function(){return this.div},ll.prototype.supportsTouch=function(){return!0},ll.prototype.receivedFocus=function(){function t(){n.cm.state.focused&&(n.pollSelection(),n.polling.set(n.cm.options.pollInterval,t))}var e=this,n=this;this.selectionInEditor()?setTimeout((function(){return e.pollSelection()}),20):bi(this.cm,(function(){return n.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,t)},ll.prototype.selectionChanged=function(){var t=this.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},ll.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=this.getSelection(),e=this.cm;if(Mo&&jo&&this.cm.display.gutterSpecs.length&&uo(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=fo(e,t.anchorNode,t.anchorOffset),i=fo(e,t.focusNode,t.focusOffset);n&&i&&bi(e,(function(){Cs(e.doc,Wi(n,i),Xo),(n.bad||i.bad)&&(e.curOp.selectionChanged=!0)}))}}},ll.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t,e,n,i=this.cm,s=i.display,r=i.doc.sel.primary(),o=r.from(),a=r.to();if(0==o.ch&&o.line>i.firstLine()&&(o=ct(o.line-1,et(i.doc,o.line-1).length)),a.ch==et(i.doc,a.line).text.length&&a.line<i.lastLine()&&(a=ct(a.line+1,0)),o.line<s.viewFrom||a.line>s.viewTo-1)return!1;o.line==s.viewFrom||0==(t=jn(i,o.line))?(e=rt(s.view[0].line),n=s.view[0].node):(e=rt(s.view[t].line),n=s.view[t-1].node.nextSibling);var l,c,u=jn(i,a.line);if(u==s.view.length-1?(l=s.viewTo-1,c=s.lineDiv.lastChild):(l=rt(s.view[u+1].line)-1,c=s.view[u+1].node.previousSibling),!n)return!1;for(var p=i.doc.splitLines(ho(i,n,c,e,l)),h=nt(i.doc,ct(e,0),ct(l,et(i.doc,l).text.length));p.length>1&&h.length>1;)if(v(p)==v(h))p.pop(),h.pop(),l--;else{if(p[0]!=h[0])break;p.shift(),h.shift(),e++}for(var d=0,f=0,m=p[0],g=h[0],y=Math.min(m.length,g.length);d<y&&m.charCodeAt(d)==g.charCodeAt(d);)++d;for(var b=v(p),_=v(h),w=Math.min(b.length-(1==p.length?d:0),_.length-(1==h.length?d:0));f<w&&b.charCodeAt(b.length-f-1)==_.charCodeAt(_.length-f-1);)++f;if(1==p.length&&1==h.length&&e==o.line)for(;d&&d>o.ch&&b.charCodeAt(b.length-f-1)==_.charCodeAt(_.length-f-1);)d--,f++;p[p.length-1]=b.slice(0,b.length-f).replace(/^\u200b+/,""),p[0]=p[0].slice(d).replace(/\u200b+$/,"");var k=ct(e,d),A=ct(l,h.length?v(h).length-f:0);return p.length>1||p[0]||ut(k,A)?(Bs(i.doc,p,k,A,"+input"),!0):void 0},ll.prototype.ensurePolled=function(){this.forceCompositionEnd()},ll.prototype.reset=function(){this.forceCompositionEnd()},ll.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ll.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()}),80))},ll.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||bi(this.cm,(function(){return Dn(t.cm)}))},ll.prototype.setUneditable=function(t){t.contentEditable="false"},ll.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||_i(this.cm,to)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},ll.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},ll.prototype.onContextMenu=function(){},ll.prototype.resetPosition=function(){},ll.prototype.needsContentAttribute=!0;var cl=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new Jo,this.hasSelection=!1,this.composing=null,this.resetting=!1};cl.prototype.init=function(t){function e(t){if(!N(s,t)){if(s.somethingSelected())Qr({lineWise:!1,text:s.getSelections()});else{if(!s.options.lineWiseCopyCut)return;var e=io(s);Qr({lineWise:!0,text:e.text}),"cut"==t.type?s.setSelections(e.ranges,null,Xo):(i.prevInput="",r.value=e.text.join("\n"),Ho(r))}"cut"==t.type&&(s.state.cutIncoming=+new Date)}}var n=this,i=this,s=this.cm;this.createField(t);var r=this.textarea;t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),No&&(r.style.width="0px"),oa(r,"input",(function(){Co&&To>=9&&n.hasSelection&&(n.hasSelection=null),i.poll()})),oa(r,"paste",(function(t){N(s,t)||eo(t,s)||(s.state.pasteIncoming=+new Date,i.fastPoll())})),oa(r,"cut",e),oa(r,"copy",e),oa(t.scroller,"paste",(function(e){if(!Le(t,e)&&!N(s,e)){if(!r.dispatchEvent)return s.state.pasteIncoming=+new Date,void i.focus();var n=new Event("paste");n.clipboardData=e.clipboardData,r.dispatchEvent(n)}})),oa(t.lineSpace,"selectstart",(function(e){Le(t,e)||F(e)})),oa(r,"compositionstart",(function(){var t=s.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:t,range:s.markText(t,s.getCursor("to"),{className:"CodeMirror-composing"})}})),oa(r,"compositionend",(function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)}))},cl.prototype.createField=function(){this.wrapper=ro(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;so(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},cl.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},cl.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,i=Rn(t);if(t.options.moveInputWithCursor){var s=pn(t,n.sel.primary().head,"div"),r=e.wrapper.getBoundingClientRect(),o=e.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,s.top+o.top-r.top)),i.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,s.left+o.left-r.left))}return i},cl.prototype.showSelection=function(t){var e=this.cm.display;n(e.cursorDiv,t.cursors),n(e.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},cl.prototype.reset=function(t){if(!(this.contextMenuPending||this.composing&&t)){var e=this.cm;if(this.resetting=!0,e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&Ho(this.textarea),Co&&To>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",Co&&To>=9&&(this.hasSelection=null));this.resetting=!1}},cl.prototype.getField=function(){return this.textarea},cl.prototype.supportsTouch=function(){return!1},cl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Ro||o(this.textarea.ownerDocument)!=this.textarea))try{this.textarea.focus()}catch(t){}},cl.prototype.blur=function(){this.textarea.blur()},cl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},cl.prototype.receivedFocus=function(){this.slowPoll()},cl.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){t.poll(),t.cm.state.focused&&t.slowPoll()}))},cl.prototype.fastPoll=function(){function t(){n.poll()||e?(n.pollingFast=!1,n.slowPoll()):(e=!0,n.polling.set(60,t))}var e=!1,n=this;n.pollingFast=!0,n.polling.set(20,t)},cl.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||this.resetting||!e.state.focused||ca(n)&&!i&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var s=n.value;if(s==i&&!e.somethingSelected())return!1;if(Co&&To>=9&&this.hasSelection===s||Lo&&/[\uf700-\uf7ff]/.test(s))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var r=s.charCodeAt(0);if(8203!=r||i||(i="\u200b"),8666==r)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(i.length,s.length);o<a&&i.charCodeAt(o)==s.charCodeAt(o);)++o;return bi(e,(function(){to(e,s.slice(o),i.length-o,null,t.composing?"*compose":null),s.length>1e3||s.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=s,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},cl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},cl.prototype.onKeyPress=function(){Co&&To>=9&&(this.hasSelection=null),this.fastPoll()},cl.prototype.onContextMenu=function(t){function e(){if(null!=o.selectionStart){var t=s.somethingSelected(),e="\u200b"+(t?o.value:"");o.value="\u21da",o.value=e,i.prevInput=t?"":"\u200b",o.selectionStart=1,o.selectionEnd=e.length,r.selForContextMenu=s.doc.sel}}function n(){if(i.contextMenuPending==n&&(i.contextMenuPending=!1,i.wrapper.style.cssText=p,o.style.cssText=u,Co&&To<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=l),null!=o.selectionStart)){(!Co||Co&&To<9)&&e();var t=0,a=function(){r.selForContextMenu==s.doc.sel&&0==o.selectionStart&&o.selectionEnd>0&&"\u200b"==i.prevInput?_i(s,Is)(s):t++<10?r.detectingSelectAll=setTimeout(a,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(a,200)}}var i=this,s=i.cm,r=s.display,o=i.textarea;i.contextMenuPending&&i.contextMenuPending();var a=xn(s,t),l=r.scroller.scrollTop;if(a&&!Po){s.options.resetSelectionOnContextMenu&&-1==s.doc.sel.contains(a)&&_i(s,Cs)(s.doc,Wi(a),Xo);var c,u=o.style.cssText,p=i.wrapper.style.cssText,h=i.wrapper.offsetParent.getBoundingClientRect();if(i.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(t.clientY-h.top-5)+"px; left: "+(t.clientX-h.left-5)+"px;\n      z-index: 1000; background: "+(Co?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",So&&(c=o.ownerDocument.defaultView.scrollY),r.input.focus(),So&&o.ownerDocument.defaultView.scrollTo(null,c),r.input.reset(),s.somethingSelected()||(o.value=i.prevInput=" "),i.contextMenuPending=n,r.selForContextMenu=s.doc.sel,clearTimeout(r.detectingSelectAll),Co&&To>=9&&e(),qo){z(t);var d=function(){I(window,"mouseup",d),setTimeout(n,20)};oa(window,"mouseup",d)}else setTimeout(n,50)}},cl.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},cl.prototype.setUneditable=function(){},cl.prototype.needsContentAttribute=!1,Vr(Yr),oo(Yr);var ul="iter insert remove copy getEditor constructor".split(" ");for(var pl in Ua.prototype)Ua.prototype.hasOwnProperty(pl)&&f(ul,pl)<0&&(Yr.prototype[pl]=function(t){return function(){return t.apply(this.doc,arguments)}}(Ua.prototype[pl]));return L(Ua),Yr.inputStyles={textarea:cl,contenteditable:ll},Yr.defineMode=function(t){Yr.defaults.mode||"null"==t||(Yr.defaults.mode=t),V.apply(this,arguments)},Yr.defineMIME=G,Yr.defineMode("null",(function(){return{token:function(t){return t.skipToEnd()}}})),Yr.defineMIME("text/plain","null"),Yr.defineExtension=function(t,e){Yr.prototype[t]=e},Yr.defineDocExtension=function(t,e){Ua.prototype[t]=e},Yr.fromTextArea=go,vo(Yr),Yr.version="5.65.12",Yr})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){"use strict";t.defineMode("javascript",(function(e,n){function i(t){for(var e,n=!1,i=!1;null!=(e=t.next());){if(!n){if("/"==e&&!i)return;"["==e?i=!0:i&&"]"==e&&(i=!1)}n=!n&&"\\"==e}}function s(t,e,n){return qt=t,Wt=n,e}function r(t,e){var n=t.next();if('"'==n||"'"==n)return e.tokenize=o(n),e.tokenize(t,e);if("."==n&&t.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return s("number","number");if("."==n&&t.match(".."))return s("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return s(n);if("="==n&&t.eat(">"))return s("=>","operator");if("0"==n&&t.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return s("number","number");if(/\d/.test(n))return t.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),s("number","number");if("/"==n)return t.eat("*")?(e.tokenize=a,a(t,e)):t.eat("/")?(t.skipToEnd(),s("comment","comment")):Ut(t,e,1)?(i(t),t.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),s("regexp","string-2")):(t.eat("="),s("operator","operator",t.current()));if("`"==n)return e.tokenize=l,l(t,e);if("#"==n&&"!"==t.peek())return t.skipToEnd(),s("meta","meta");if("#"==n&&t.eatWhile(Xt))return s("variable","property");if("<"==n&&t.match("!--")||"-"==n&&t.match("->")&&!/\S/.test(t.string.slice(0,t.start)))return t.skipToEnd(),s("comment","comment");if(Qt.test(n))return">"==n&&e.lexical&&">"==e.lexical.type||(t.eat("=")?"!"!=n&&"="!=n||t.eat("="):/[<>*+\-|&?]/.test(n)&&(t.eat(n),">"==n&&t.eat(n))),"?"==n&&t.eat(".")?s("."):s("operator","operator",t.current());if(Xt.test(n)){t.eatWhile(Xt);var r=t.current();if("."!=e.lastType){if(Zt.propertyIsEnumerable(r)){var c=Zt[r];return s(c.type,c.style,r)}
if("async"==r&&t.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return s("async","keyword",r)}return s("variable","variable",r)}}function o(t){return function(e,n){var i,o=!1;if(Vt&&"@"==e.peek()&&e.match(te))return n.tokenize=r,s("jsonld-keyword","meta");for(;null!=(i=e.next())&&(i!=t||o);)o=!o&&"\\"==i;return o||(n.tokenize=r),s("string","string")}}function a(t,e){for(var n,i=!1;n=t.next();){if("/"==n&&i){e.tokenize=r;break}i="*"==n}return s("comment","comment")}function l(t,e){for(var n,i=!1;null!=(n=t.next());){if(!i&&("`"==n||"$"==n&&t.eat("{"))){e.tokenize=r;break}i=!i&&"\\"==n}return s("quasi","string-2",t.current())}function c(t,e){e.fatArrowAt&&(e.fatArrowAt=null);var n=t.string.indexOf("=>",t.start);if(!(n<0)){if(Yt){var i=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(t.string.slice(t.start,n));i&&(n=i.index)}for(var s=0,r=!1,o=n-1;o>=0;--o){var a=t.string.charAt(o),l=ee.indexOf(a);if(l>=0&&l<3){if(!s){++o;break}if(0==--s){"("==a&&(r=!0);break}}else if(l>=3&&l<6)++s;else if(Xt.test(a))r=!0;else if(/["'\/`]/.test(a))for(;;--o){if(0==o)return;if(t.string.charAt(o-1)==a&&"\\"!=t.string.charAt(o-2)){o--;break}}else if(r&&!s){++o;break}}r&&!s&&(e.fatArrowAt=o)}}function u(t,e,n,i,s,r){this.indented=t,this.column=e,this.type=n,this.prev=s,this.info=r,null!=i&&(this.align=i)}function p(t,e){if(!Kt)return!1;for(var n=t.localVars;n;n=n.next)if(n.name==e)return!0;for(var i=t.context;i;i=i.prev)for(n=i.vars;n;n=n.next)if(n.name==e)return!0}function h(t,e,n,i,s){var r=t.cc;for(ie.state=t,ie.stream=s,ie.marked=null,ie.cc=r,ie.style=e,t.lexical.hasOwnProperty("align")||(t.lexical.align=!0);;){if((r.length?r.pop():Gt?D:x)(n,i)){for(;r.length&&r[r.length-1].lex;)r.pop()();return ie.marked?ie.marked:"variable"==n&&p(t,i)?"variable-2":e}}}function d(){for(var t=arguments.length-1;t>=0;t--)ie.cc.push(arguments[t])}function f(){return d.apply(null,arguments),!0}function m(t,e){for(var n=e;n;n=n.next)if(n.name==t)return!0;return!1}function g(t){var e=ie.state;if(ie.marked="def",Kt){if(e.context)if("var"==e.lexical.info&&e.context&&e.context.block){var i=v(t,e.context);if(null!=i)return void(e.context=i)}else if(!m(t,e.localVars))return void(e.localVars=new _(t,e.localVars));n.globalVars&&!m(t,e.globalVars)&&(e.globalVars=new _(t,e.globalVars))}}function v(t,e){if(e){if(e.block){var n=v(t,e.prev);return n?n==e.prev?e:new b(n,e.vars,!0):null}return m(t,e.vars)?e:new b(e.prev,new _(t,e.vars),!1)}return null}function y(t){return"public"==t||"private"==t||"protected"==t||"abstract"==t||"readonly"==t}function b(t,e,n){this.prev=t,this.vars=e,this.block=n}function _(t,e){this.name=t,this.next=e}function w(){ie.state.context=new b(ie.state.context,ie.state.localVars,!1),ie.state.localVars=se}function k(){ie.state.context=new b(ie.state.context,ie.state.localVars,!0),ie.state.localVars=null}function A(){ie.state.localVars=ie.state.context.vars,ie.state.context=ie.state.context.prev}function C(t,e){var n=function(){var n=ie.state,i=n.indented;if("stat"==n.lexical.type)i=n.lexical.indented;else for(var s=n.lexical;s&&")"==s.type&&s.align;s=s.prev)i=s.indented;n.lexical=new u(i,ie.stream.column(),t,null,n.lexical,e)};return n.lex=!0,n}function T(){var t=ie.state;t.lexical.prev&&(")"==t.lexical.type&&(t.indented=t.lexical.indented),t.lexical=t.lexical.prev)}function S(t){function e(n){return n==t?f():";"==t||"}"==n||")"==n||"]"==n?d():f(e)}return e}function x(t,e){return"var"==t?f(C("vardef",e),ht,S(";"),T):"keyword a"==t?f(C("form"),E,x,T):"keyword b"==t?f(C("form"),x,T):"keyword d"==t?ie.stream.match(/^\s*$/,!1)?f():f(C("stat"),O,S(";"),T):"debugger"==t?f(S(";")):"{"==t?f(C("}"),k,Y,T,A):";"==t?f():"if"==t?("else"==ie.state.lexical.info&&ie.state.cc[ie.state.cc.length-1]==T&&ie.state.cc.pop()(),f(C("form"),E,x,T,yt)):"function"==t?f(kt):"for"==t?f(C("form"),k,bt,x,A,T):"class"==t||Yt&&"interface"==e?(ie.marked="keyword",f(C("form","class"==t?t:e),xt,T)):"variable"==t?Yt&&"declare"==e?(ie.marked="keyword",f(x)):Yt&&("module"==e||"enum"==e||"type"==e)&&ie.stream.match(/^\s*\w/,!1)?(ie.marked="keyword","enum"==e?f($t):"type"==e?f(Ct,S("operator"),et,S(";")):f(C("form"),dt,S("{"),C("}"),Y,T,T)):Yt&&"namespace"==e?(ie.marked="keyword",f(C("form"),D,x,T)):Yt&&"abstract"==e?(ie.marked="keyword",f(x)):f(C("stat"),q):"switch"==t?f(C("form"),E,S("{"),C("}","switch"),k,Y,T,T,A):"case"==t?f(D,S(":")):"default"==t?f(S(":")):"catch"==t?f(C("form"),w,j,x,T,A):"export"==t?f(C("stat"),Et,T):"import"==t?f(C("stat"),Ot,T):"async"==t?f(x):"@"==e?f(D,x):d(C("stat"),D,S(";"),T)}function j(t){if("("==t)return f(Tt,S(")"))}function D(t,e){return I(t,e,!1)}function P(t,e){return I(t,e,!0)}function E(t){return"("!=t?d():f(C(")"),O,S(")"),T)}function I(t,e,n){if(ie.state.fatArrowAt==ie.stream.start){var i=n?$:F;if("("==t)return f(w,C(")"),G(Tt,")"),T,S("=>"),i,A);if("variable"==t)return d(w,dt,S("=>"),i,A)}var s=n?M:N;return ne.hasOwnProperty(t)?f(s):"function"==t?f(kt,s):"class"==t||Yt&&"interface"==e?(ie.marked="keyword",f(C("form"),St,T)):"keyword c"==t||"async"==t?f(n?P:D):"("==t?f(C(")"),O,S(")"),T,s):"operator"==t||"spread"==t?f(n?P:D):"["==t?f(C("]"),Ft,T,s):"{"==t?K(H,"}",null,s):"quasi"==t?d(R,s):"new"==t?f(B(n)):f()}function O(t){return t.match(/[;\}\)\],]/)?d():d(D)}function N(t,e){return","==t?f(O):M(t,e,!1)}function M(t,e,n){var i=0==n?N:M,s=0==n?D:P;return"=>"==t?f(w,n?$:F,A):"operator"==t?/\+\+|--/.test(e)||Yt&&"!"==e?f(i):Yt&&"<"==e&&ie.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?f(C(">"),G(et,">"),T,i):"?"==e?f(D,S(":"),s):f(s):"quasi"==t?d(R,i):";"!=t?"("==t?K(P,")","call",i):"."==t?f(W,i):"["==t?f(C("]"),O,S("]"),T,i):Yt&&"as"==e?(ie.marked="keyword",f(et,i)):"regexp"==t?(ie.state.lastType=ie.marked="operator",ie.stream.backUp(ie.stream.pos-ie.stream.start-1),f(s)):void 0:void 0}function R(t,e){return"quasi"!=t?d():"${"!=e.slice(e.length-2)?f(R):f(O,L)}function L(t){if("}"==t)return ie.marked="string-2",ie.state.tokenize=l,f(R)}function F(t){return c(ie.stream,ie.state),d("{"==t?x:D)}function $(t){return c(ie.stream,ie.state),d("{"==t?x:P)}function B(t){return function(e){return"."==e?f(t?U:z):"variable"==e&&Yt?f(ct,t?M:N):d(t?P:D)}}function z(t,e){if("target"==e)return ie.marked="keyword",f(N)}function U(t,e){if("target"==e)return ie.marked="keyword",f(M)}function q(t){return":"==t?f(T,x):d(N,S(";"),T)}function W(t){if("variable"==t)return ie.marked="property",f()}function H(t,e){return"async"==t?(ie.marked="property",f(H)):"variable"==t||"keyword"==ie.style?(ie.marked="property","get"==e||"set"==e?f(J):(Yt&&ie.state.fatArrowAt==ie.stream.start&&(n=ie.stream.match(/^\s*:\s*/,!1))&&(ie.state.fatArrowAt=ie.stream.pos+n[0].length),f(V))):"number"==t||"string"==t?(ie.marked=Vt?"property":ie.style+" property",f(V)):"jsonld-keyword"==t?f(V):Yt&&y(e)?(ie.marked="keyword",f(H)):"["==t?f(D,X,S("]"),V):"spread"==t?f(P,V):"*"==e?(ie.marked="keyword",f(H)):":"==t?d(V):void 0;var n}function J(t){return"variable"!=t?d(V):(ie.marked="property",f(kt))}function V(t){return":"==t?f(P):"("==t?d(kt):void 0}function G(t,e,n){function i(s,r){if(n?n.indexOf(s)>-1:","==s){var o=ie.state.lexical;return"call"==o.info&&(o.pos=(o.pos||0)+1),f((function(n,i){return n==e||i==e?d():d(t)}),i)}return s==e||r==e?f():n&&n.indexOf(";")>-1?d(t):f(S(e))}return function(n,s){return n==e||s==e?f():d(t,i)}}function K(t,e,n){for(var i=3;i<arguments.length;i++)ie.cc.push(arguments[i]);return f(C(e,n),G(t,e),T)}function Y(t){return"}"==t?f():d(x,Y)}function X(t,e){if(Yt){if(":"==t)return f(et);if("?"==e)return f(X)}}function Z(t,e){if(Yt&&(":"==t||"in"==e))return f(et)}function Q(t){if(Yt&&":"==t)return ie.stream.match(/^\s*\w+\s+is\b/,!1)?f(D,tt,et):f(et)}function tt(t,e){if("is"==e)return ie.marked="keyword",f()}function et(t,e){return"keyof"==e||"typeof"==e||"infer"==e||"readonly"==e?(ie.marked="keyword",f("typeof"==e?P:et)):"variable"==t||"void"==e?(ie.marked="type",f(lt)):"|"==e||"&"==e?f(et):"string"==t||"number"==t||"atom"==t?f(lt):"["==t?f(C("]"),G(et,"]",","),T,lt):"{"==t?f(C("}"),it,T,lt):"("==t?f(G(at,")"),nt,lt):"<"==t?f(G(et,">"),et):"quasi"==t?d(rt,lt):void 0}function nt(t){if("=>"==t)return f(et)}function it(t){return t.match(/[\}\)\]]/)?f():","==t||";"==t?f(it):d(st,it)}function st(t,e){return"variable"==t||"keyword"==ie.style?(ie.marked="property",f(st)):"?"==e||"number"==t||"string"==t?f(st):":"==t?f(et):"["==t?f(S("variable"),Z,S("]"),st):"("==t?d(At,st):t.match(/[;\}\)\],]/)?void 0:f()}function rt(t,e){return"quasi"!=t?d():"${"!=e.slice(e.length-2)?f(rt):f(et,ot)}function ot(t){if("}"==t)return ie.marked="string-2",ie.state.tokenize=l,f(rt)}function at(t,e){return"variable"==t&&ie.stream.match(/^\s*[?:]/,!1)||"?"==e?f(at):":"==t?f(et):"spread"==t?f(at):d(et)}function lt(t,e){return"<"==e?f(C(">"),G(et,">"),T,lt):"|"==e||"."==t||"&"==e?f(et):"["==t?f(et,S("]"),lt):"extends"==e||"implements"==e?(ie.marked="keyword",f(et)):"?"==e?f(et,S(":"),et):void 0}function ct(t,e){if("<"==e)return f(C(">"),G(et,">"),T,lt)}function ut(){return d(et,pt)}function pt(t,e){if("="==e)return f(et)}function ht(t,e){return"enum"==e?(ie.marked="keyword",f($t)):d(dt,X,gt,vt)}function dt(t,e){return Yt&&y(e)?(ie.marked="keyword",f(dt)):"variable"==t?(g(e),f()):"spread"==t?f(dt):"["==t?K(mt,"]"):"{"==t?K(ft,"}"):void 0}function ft(t,e){return"variable"!=t||ie.stream.match(/^\s*:/,!1)?("variable"==t&&(ie.marked="property"),"spread"==t?f(dt):"}"==t?d():"["==t?f(D,S("]"),S(":"),ft):f(S(":"),dt,gt)):(g(e),f(gt))}function mt(){return d(dt,gt)}function gt(t,e){if("="==e)return f(P)}function vt(t){if(","==t)return f(ht)}function yt(t,e){if("keyword b"==t&&"else"==e)return f(C("form","else"),x,T)}function bt(t,e){return"await"==e?f(bt):"("==t?f(C(")"),_t,T):void 0}function _t(t){return"var"==t?f(ht,wt):"variable"==t?f(wt):d(wt)}function wt(t,e){return")"==t?f():";"==t?f(wt):"in"==e||"of"==e?(ie.marked="keyword",f(D,wt)):d(D,wt)}function kt(t,e){return"*"==e?(ie.marked="keyword",f(kt)):"variable"==t?(g(e),f(kt)):"("==t?f(w,C(")"),G(Tt,")"),T,Q,x,A):Yt&&"<"==e?f(C(">"),G(ut,">"),T,kt):void 0}function At(t,e){return"*"==e?(ie.marked="keyword",f(At)):"variable"==t?(g(e),f(At)):"("==t?f(w,C(")"),G(Tt,")"),T,Q,A):Yt&&"<"==e?f(C(">"),G(ut,">"),T,At):void 0}function Ct(t,e){return"keyword"==t||"variable"==t?(ie.marked="type",f(Ct)):"<"==e?f(C(">"),G(ut,">"),T):void 0}function Tt(t,e){return"@"==e&&f(D,Tt),"spread"==t?f(Tt):Yt&&y(e)?(ie.marked="keyword",f(Tt)):Yt&&"this"==t?f(X,gt):d(dt,X,gt)}function St(t,e){return"variable"==t?xt(t,e):jt(t,e)}function xt(t,e){if("variable"==t)return g(e),f(jt)}function jt(t,e){return"<"==e?f(C(">"),G(ut,">"),T,jt):"extends"==e||"implements"==e||Yt&&","==t?("implements"==e&&(ie.marked="keyword"),f(Yt?et:D,jt)):"{"==t?f(C("}"),Dt,T):void 0}function Dt(t,e){return"async"==t||"variable"==t&&("static"==e||"get"==e||"set"==e||Yt&&y(e))&&ie.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1)?(ie.marked="keyword",f(Dt)):"variable"==t||"keyword"==ie.style?(ie.marked="property",f(Pt,Dt)):"number"==t||"string"==t?f(Pt,Dt):"["==t?f(D,X,S("]"),Pt,Dt):"*"==e?(ie.marked="keyword",f(Dt)):Yt&&"("==t?d(At,Dt):";"==t||","==t?f(Dt):"}"==t?f():"@"==e?f(D,Dt):void 0}function Pt(t,e){if("!"==e)return f(Pt);if("?"==e)return f(Pt);if(":"==t)return f(et,gt);if("="==e)return f(P);var n=ie.state.lexical.prev;return d(n&&"interface"==n.info?At:kt)}function Et(t,e){return"*"==e?(ie.marked="keyword",f(Lt,S(";"))):"default"==e?(ie.marked="keyword",f(D,S(";"))):"{"==t?f(G(It,"}"),Lt,S(";")):d(x)}function It(t,e){return"as"==e?(ie.marked="keyword",f(S("variable"))):"variable"==t?d(P,It):void 0}function Ot(t){return"string"==t?f():"("==t?d(D):"."==t?d(N):d(Nt,Mt,Lt)}function Nt(t,e){return"{"==t?K(Nt,"}"):("variable"==t&&g(e),"*"==e&&(ie.marked="keyword"),f(Rt))}function Mt(t){if(","==t)return f(Nt,Mt)}function Rt(t,e){if("as"==e)return ie.marked="keyword",f(Nt)}function Lt(t,e){if("from"==e)return ie.marked="keyword",f(D)}function Ft(t){return"]"==t?f():d(G(P,"]"))}function $t(){return d(C("form"),dt,S("{"),C("}"),G(Bt,"}"),T,T)}function Bt(){return d(dt,gt)}function zt(t,e){return"operator"==t.lastType||","==t.lastType||Qt.test(e.charAt(0))||/[,.]/.test(e.charAt(0))}function Ut(t,e,n){return e.tokenize==r&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(e.lastType)||"quasi"==e.lastType&&/\{\s*$/.test(t.string.slice(0,t.pos-(n||0)))}var qt,Wt,Ht=e.indentUnit,Jt=n.statementIndent,Vt=n.jsonld,Gt=n.json||Vt,Kt=!1!==n.trackScope,Yt=n.typescript,Xt=n.wordCharacters||/[\w$\xa1-\uffff]/,Zt=function(){function t(t){return{type:t,style:"keyword"}}var e=t("keyword a"),n=t("keyword b"),i=t("keyword c"),s=t("keyword d"),r=t("operator"),o={type:"atom",style:"atom"};return{if:t("if"),while:e,with:e,else:n,do:n,try:n,finally:n,return:s,break:s,continue:s,new:t("new"),delete:i,void:i,throw:i,debugger:t("debugger"),var:t("var"),const:t("var"),let:t("var"),function:t("function"),catch:t("catch"),for:t("for"),switch:t("switch"),case:t("case"),default:t("default"),in:r,typeof:r,instanceof:r,true:o,false:o,null:o,undefined:o,NaN:o,Infinity:o,this:t("this"),class:t("class"),super:t("atom"),yield:i,export:t("export"),import:t("import"),extends:i,await:i}}(),Qt=/[+\-*&%=<>!?|~^@]/,te=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,ee="([{}])",ne={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0},ie={state:null,column:null,marked:null,cc:null},se=new _("this",new _("arguments",null));return w.lex=k.lex=!0,A.lex=!0,T.lex=!0,{startState:function(t){var e={tokenize:r,lastType:"sof",cc:[],lexical:new u((t||0)-Ht,0,"block",!1),localVars:n.localVars,context:n.localVars&&new b(null,null,!1),indented:t||0};return n.globalVars&&"object"==typeof n.globalVars&&(e.globalVars=n.globalVars),e},token:function(t,e){if(t.sol()&&(e.lexical.hasOwnProperty("align")||(e.lexical.align=!1),e.indented=t.indentation(),c(t,e)),e.tokenize!=a&&t.eatSpace())return null;var n=e.tokenize(t,e);return"comment"==qt?n:(e.lastType="operator"!=qt||"++"!=Wt&&"--"!=Wt?qt:"incdec",h(e,n,qt,Wt,t))},indent:function(e,i){if(e.tokenize==a||e.tokenize==l)return t.Pass;if(e.tokenize!=r)return 0;var s,o=i&&i.charAt(0),c=e.lexical;if(!/^\s*else\b/.test(i))for(var u=e.cc.length-1;u>=0;--u){var p=e.cc[u];if(p==T)c=c.prev;else if(p!=yt&&p!=A)break}for(;("stat"==c.type||"form"==c.type)&&("}"==o||(s=e.cc[e.cc.length-1])&&(s==N||s==M)&&!/^[,\.=+\-*:?[\(]/.test(i));)c=c.prev;Jt&&")"==c.type&&"stat"==c.prev.type&&(c=c.prev);var h=c.type,d=o==h;return"vardef"==h?c.indented+("operator"==e.lastType||","==e.lastType?c.info.length+1:0):"form"==h&&"{"==o?c.indented:"form"==h?c.indented+Ht:"stat"==h?c.indented+(zt(e,i)?Jt||Ht:0):"switch"!=c.info||d||0==n.doubleIndentSwitch?c.align?c.column+(d?0:1):c.indented+(d?0:Ht):c.indented+(/^(?:case|default)\b/.test(i)?Ht:2*Ht)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Gt?null:"/*",blockCommentEnd:Gt?null:"*/",blockCommentContinue:Gt?null:" * ",lineComment:Gt?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Gt?"json":"javascript",jsonldMode:Vt,jsonMode:Gt,expressionAllowed:Ut,skipExpression:function(e){h(e,"atom","atom","true",new t.StringStream("",2,null))}}})),t.defineMode("json",(function(e,n){var i={token:function(t){var e;if(t.match("#{"))for(;null!=(e=t.next());)if("}"==e)return t.eat("}"),"json";for(;null!=t.next()&&!t.match("#{",!1););return null}};return t.overlayMode(t.getMode(e,n.backdrop||"application/json"),i)})),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/manifest+json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){function e(t,e){return"pairs"==e&&"string"==typeof t?t:"object"==typeof t&&null!=t[e]?t[e]:h[e]}function n(t){for(var e=0;e<t.length;e++){var n=t.charAt(e),s="'"+n+"'";f[s]||(f[s]=i(n))}}function i(t){return function(e){return c(e,t)}}function s(t){var e=t.state.closeBrackets;return!e||e.override?e:t.getModeAt(t.getCursor()).closeBrackets||e}function r(n){var i=s(n);if(!i||n.getOption("disableInput"))return t.Pass;for(var r=e(i,"pairs"),o=n.listSelections(),a=0;a<o.length;a++){if(!o[a].empty())return t.Pass;var l=u(n,o[a].head);if(!l||r.indexOf(l)%2!=0)return t.Pass}for(a=o.length-1;a>=0;a--){var c=o[a].head;n.replaceRange("",d(c.line,c.ch-1),d(c.line,c.ch+1),"+delete")}}function o(n){var i=s(n),r=i&&e(i,"explode");if(!r||n.getOption("disableInput"))return t.Pass;for(var o=n.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return t.Pass;var c=u(n,o[l].head);if(!c||r.indexOf(c)%2!=0)return t.Pass}n.operation((function(){var t=n.lineSeparator()||"\n";n.replaceSelection(t+t,null),a(n,-1),o=n.listSelections();for(var e=0;e<o.length;e++){var i=o[e].head.line;n.indentLine(i,null,!0),n.indentLine(i+1,null,!0)}}))}function a(t,e){for(var n=[],i=t.listSelections(),s=0,r=0;r<i.length;r++){var o=i[r];o.head==t.getCursor()&&(s=r);var a=o.head.ch||e>0?{line:o.head.line,ch:o.head.ch+e}:{line:o.head.line-1};n.push({anchor:a,head:a})}t.setSelections(n,s)}function l(e){var n=t.cmpPos(e.anchor,e.head)>0;return{anchor:new d(e.anchor.line,e.anchor.ch+(n?-1:1)),head:new d(e.head.line,e.head.ch+(n?1:-1))}}function c(n,i){var r=s(n);if(!r||n.getOption("disableInput"))return t.Pass;var o=e(r,"pairs"),c=o.indexOf(i);if(-1==c)return t.Pass;for(var u,h=e(r,"closeBefore"),f=e(r,"triples"),m=o.charAt(c+1)==i,g=n.listSelections(),v=c%2==0,y=0;y<g.length;y++){var b,_=g[y],w=_.head,k=n.getRange(w,d(w.line,w.ch+1));if(v&&!_.empty())b="surround";else if(!m&&v||k!=i)if(m&&w.ch>1&&f.indexOf(i)>=0&&n.getRange(d(w.line,w.ch-2),w)==i+i){if(w.ch>2&&/\bstring/.test(n.getTokenTypeAt(d(w.line,w.ch-2))))return t.Pass;b="addFour"}else if(m){var A=0==w.ch?" ":n.getRange(d(w.line,w.ch-1),w);if(t.isWordChar(k)||A==i||t.isWordChar(A))return t.Pass;b="both"}else{if(!v||!(0===k.length||/\s/.test(k)||h.indexOf(k)>-1))return t.Pass;b="both"}else b=m&&p(n,w)?"both":f.indexOf(i)>=0&&n.getRange(w,d(w.line,w.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=b)return t.Pass}else u=b}var C=c%2?o.charAt(c-1):i,T=c%2?i:o.charAt(c+1);n.operation((function(){if("skip"==u)a(n,1);else if("skipThree"==u)a(n,3);else if("surround"==u){for(var t=n.getSelections(),e=0;e<t.length;e++)t[e]=C+t[e]+T;n.replaceSelections(t,"around"),t=n.listSelections().slice();for(e=0;e<t.length;e++)t[e]=l(t[e]);n.setSelections(t)}else"both"==u?(n.replaceSelection(C+T,null),n.triggerElectric(C+T),a(n,-1)):"addFour"==u&&(n.replaceSelection(C+C+C+C,"before"),a(n,1))}))}function u(t,e){var n=t.getRange(d(e.line,e.ch-1),d(e.line,e.ch+1));return 2==n.length?n:null}function p(t,e){var n=t.getTokenAt(d(e.line,e.ch+1));return/\bstring/.test(n.type)&&n.start==e.ch&&(0==e.ch||!/\bstring/.test(t.getTokenTypeAt(e)))}var h={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},d=t.Pos;t.defineOption("autoCloseBrackets",!1,(function(i,s,r){r&&r!=t.Init&&(i.removeKeyMap(f),i.state.closeBrackets=null),s&&(n(e(s,"pairs")),i.state.closeBrackets=s,i.addKeyMap(f))}));var f={Backspace:r,Enter:o};n(h.pairs+"`")})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){function e(t){return t&&t.bracketRegex||/[(){}[\]]/}function n(t,n,s){var r=t.getLineHandle(n.line),o=n.ch-1,a=s&&s.afterCursor;null==a&&(a=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var u=e(s),p=!a&&o>=0&&u.test(r.text.charAt(o))&&c[r.text.charAt(o)]||u.test(r.text.charAt(o+1))&&c[r.text.charAt(++o)];if(!p)return null;var h=">"==p.charAt(1)?1:-1;if(s&&s.strict&&h>0!=(o==n.ch))return null;var d=t.getTokenTypeAt(l(n.line,o+1)),f=i(t,l(n.line,o+(h>0?1:0)),h,d,s);return null==f?null:{from:l(n.line,o),to:f&&f.pos,match:f&&f.ch==p.charAt(0),forward:h>0}}function i(t,n,i,s,r){for(var o=r&&r.maxScanLineLength||1e4,a=r&&r.maxScanLines||1e3,u=[],p=e(r),h=i>0?Math.min(n.line+a,t.lastLine()+1):Math.max(t.firstLine()-1,n.line-a),d=n.line;d!=h;d+=i){var f=t.getLine(d);if(f){var m=i>0?0:f.length-1,g=i>0?f.length:-1;if(!(f.length>o))for(d==n.line&&(m=n.ch-(i<0?1:0));m!=g;m+=i){var v=f.charAt(m);if(p.test(v)&&(void 0===s||(t.getTokenTypeAt(l(d,m+1))||"")==(s||""))){var y=c[v];if(y&&">"==y.charAt(1)==i>0)u.push(v);else{if(!u.length)return{pos:l(d,m),ch:v};u.pop()}}}}}return d-i!=(i>0?t.lastLine():t.firstLine())&&null}function s(t,e,i){for(var s=t.state.matchBrackets.maxHighlightLineLength||1e3,r=i&&i.highlightNonMatching,o=[],c=t.listSelections(),u=0;u<c.length;u++){var p=c[u].empty()&&n(t,c[u].head,i);if(p&&(p.match||!1!==r)&&t.getLine(p.from.line).length<=s){var h=p.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";o.push(t.markText(p.from,l(p.from.line,p.from.ch+1),{className:h})),p.to&&t.getLine(p.to.line).length<=s&&o.push(t.markText(p.to,l(p.to.line,p.to.ch+1),{className:h}))}}if(o.length){a&&t.state.focused&&t.focus();var d=function(){t.operation((function(){for(var t=0;t<o.length;t++)o[t].clear()}))};if(!e)return d;setTimeout(d,800)}}function r(t){t.operation((function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=s(t,!1,t.state.matchBrackets)}))}function o(t){t.state.matchBrackets&&t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null)}var a=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),l=t.Pos,c={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};t.defineOption("matchBrackets",!1,(function(e,n,i){i&&i!=t.Init&&(e.off("cursorActivity",r),e.off("focus",r),e.off("blur",o),o(e)),n&&(e.state.matchBrackets="object"==typeof n?n:{},e.on("cursorActivity",r),e.on("focus",r),e.on("blur",o))})),t.defineExtension("matchBrackets",(function(){s(this,!0)})),t.defineExtension("findMatchingBracket",(function(t,e,i){return(i||"boolean"==typeof e)&&(i?(i.strict=e,e=i):e=e?{strict:!0}:null),n(this,t,e)})),t.defineExtension("scanForBracket",(function(t,e,n,s){return i(this,t,e,n,s)}))})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){"use strict";function e(t,e){if(this.cm=t,this.options=e,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length,this.options.updateOnCursorActivity){var n=this;t.on("cursorActivity",this.activityFunc=function(){n.cursorActivity()})}}function n(t,e,n){var i=t.options.hintOptions,s={};for(var r in f)s[r]=f[r];if(i)for(var r in i)void 0!==i[r]&&(s[r]=i[r]);if(n)for(var r in n)void 0!==n[r]&&(s[r]=n[r]);return s.hint.resolve&&(s.hint=s.hint.resolve(t,e)),s}function i(t){return"string"==typeof t?t:t.text}function s(t,e){function n(t,n){var s;s="string"!=typeof n?function(t){return n(t,e)}:i.hasOwnProperty(n)?i[n]:n,r[t]=s}var i={Up:function(){e.moveFocus(-1)},Down:function(){e.moveFocus(1)},PageUp:function(){e.moveFocus(1-e.menuSize(),!0)},PageDown:function(){e.moveFocus(e.menuSize()-1,!0)},Home:function(){e.setFocus(0)},End:function(){e.setFocus(e.length-1)},Enter:e.pick,Tab:e.pick,Esc:e.close};/Mac/.test(navigator.platform)&&(i["Ctrl-P"]=function(){e.moveFocus(-1)},i["Ctrl-N"]=function(){e.moveFocus(1)});var s=t.options.customKeys,r=s?{}:i;if(s)for(var o in s)s.hasOwnProperty(o)&&n(o,s[o]);var a=t.options.extraKeys;if(a)for(var o in a)a.hasOwnProperty(o)&&n(o,a[o]);return r}function r(t,e){for(;e&&e!=t;){if("LI"===e.nodeName.toUpperCase()&&e.parentNode==t)return e;e=e.parentNode}}function o(e,n){this.id="cm-complete-"+Math.floor(Math.random(1e6)),this.completion=e,this.data=n,this.picked=!1;var o=this,a=e.cm,l=a.getInputField().ownerDocument,c=l.defaultView||l.parentWindow,h=this.hints=l.createElement("ul");h.setAttribute("role","listbox"),h.setAttribute("aria-expanded","true"),h.id=this.id;var d=e.cm.options.theme;h.className="CodeMirror-hints "+d,this.selectedHint=n.selectedHint||0;for(var f=n.list,m=0;m<f.length;++m){var g=h.appendChild(l.createElement("li")),v=f[m],y=u+(m!=this.selectedHint?"":" "+p);null!=v.className&&(y=v.className+" "+y),g.className=y,m==this.selectedHint&&g.setAttribute("aria-selected","true"),g.id=this.id+"-"+m,g.setAttribute("role","option"),v.render?v.render(g,n,v):g.appendChild(l.createTextNode(v.displayText||i(v))),g.hintId=m}var b=e.options.container||l.body,_=a.cursorCoords(e.options.alignWithWord?n.from:null),w=_.left,k=_.bottom,A=!0,C=0,T=0;if(b!==l.body){var S=-1!==["absolute","relative","fixed"].indexOf(c.getComputedStyle(b).position)?b:b.offsetParent,x=S.getBoundingClientRect(),j=l.body.getBoundingClientRect();C=x.left-j.left-S.scrollLeft,T=x.top-j.top-S.scrollTop}h.style.left=w-C+"px",h.style.top=k-T+"px";var D=c.innerWidth||Math.max(l.body.offsetWidth,l.documentElement.offsetWidth),P=c.innerHeight||Math.max(l.body.offsetHeight,l.documentElement.offsetHeight);b.appendChild(h),a.getInputField().setAttribute("aria-autocomplete","list"),a.getInputField().setAttribute("aria-owns",this.id),a.getInputField().setAttribute("aria-activedescendant",this.id+"-"+this.selectedHint);var E,I=e.options.moveOnOverlap?h.getBoundingClientRect():new DOMRect,O=!!e.options.paddingForScrollbar&&h.scrollHeight>h.clientHeight+1;if(setTimeout((function(){E=a.getScrollInfo()})),I.bottom-P>0){var N=I.bottom-I.top,M=I.top-(_.bottom-_.top)-2;P-I.top<M?(N>M&&(h.style.height=(N=M)+"px"),h.style.top=(k=_.top-N)+T+"px",A=!1):h.style.height=P-I.top-2+"px"}var R,L=I.right-D;if(O&&(L+=a.display.nativeBarWidth),L>0&&(I.right-I.left>D&&(h.style.width=D-5+"px",L-=I.right-I.left-D),h.style.left=(w=Math.max(_.left-L-C,0))+"px"),O)for(var F=h.firstChild;F;F=F.nextSibling)F.style.paddingRight=a.display.nativeBarWidth+"px";(a.addKeyMap(this.keyMap=s(e,{moveFocus:function(t,e){o.changeActive(o.selectedHint+t,e)},setFocus:function(t){o.changeActive(t)},menuSize:function(){return o.screenAmount()},length:f.length,close:function(){e.close()},pick:function(){o.pick()},data:n})),e.options.closeOnUnfocus)&&(a.on("blur",this.onBlur=function(){R=setTimeout((function(){e.close()}),100)}),a.on("focus",this.onFocus=function(){clearTimeout(R)}));a.on("scroll",this.onScroll=function(){var t=a.getScrollInfo(),n=a.getWrapperElement().getBoundingClientRect();E||(E=a.getScrollInfo());var i=k+E.top-t.top,s=i-(c.pageYOffset||(l.documentElement||l.body).scrollTop);if(A||(s+=h.offsetHeight),s<=n.top||s>=n.bottom)return e.close();h.style.top=i+"px",h.style.left=w+E.left-t.left+"px"}),t.on(h,"dblclick",(function(t){var e=r(h,t.target||t.srcElement);e&&null!=e.hintId&&(o.changeActive(e.hintId),o.pick())})),t.on(h,"click",(function(t){var n=r(h,t.target||t.srcElement);n&&null!=n.hintId&&(o.changeActive(n.hintId),e.options.completeOnSingleClick&&o.pick())})),t.on(h,"mousedown",(function(){setTimeout((function(){a.focus()}),20)}));var $=this.getSelectedHintRange();return 0===$.from&&0===$.to||this.scrollToActive(),t.signal(n,"select",f[this.selectedHint],h.childNodes[this.selectedHint]),!0}function a(t,e){if(!t.somethingSelected())return e;for(var n=[],i=0;i<e.length;i++)e[i].supportsSelection&&n.push(e[i]);return n}function l(t,e,n,i){if(t.async)t(e,i,n);else{var s=t(e,n);s&&s.then?s.then(i):i(s)}}function c(e,n){var i,s=e.getHelpers(n,"hint");if(s.length){var r=function(t,e,n){function i(s){if(s==r.length)return e(null);l(r[s],t,n,(function(t){t&&t.list.length>0?e(t):i(s+1)}))}var r=a(t,s);i(0)};return r.async=!0,r.supportsSelection=!0,r}return(i=e.getHelper(e.getCursor(),"hintWords"))?function(e){return t.hint.fromList(e,{words:i})}:t.hint.anyword?function(e,n){return t.hint.anyword(e,n)}:function(){}}var u="CodeMirror-hint",p="CodeMirror-hint-active";t.showHint=function(t,e,n){if(!e)return t.showHint(n);n&&n.async&&(e.async=!0);var i={hint:e};if(n)for(var s in n)i[s]=n[s];return t.showHint(i)},t.defineExtension("showHint",(function(i){i=n(this,this.getCursor("start"),i);var s=this.listSelections();if(!(s.length>1)){if(this.somethingSelected()){if(!i.hint.supportsSelection)return;for(var r=0;r<s.length;r++)if(s[r].head.line!=s[r].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var o=this.state.completionActive=new e(this,i);o.options.hint&&(t.signal(this,"startCompletion",this),o.update(!0))}})),t.defineExtension("closeHint",(function(){this.state.completionActive&&this.state.completionActive.close()}));var h=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},d=window.cancelAnimationFrame||clearTimeout;e.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.options.updateOnCursorActivity&&this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&t.signal(this.data,"close"),this.widget&&this.widget.close(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(e,n){var s=e.list[n],r=this;this.cm.operation((function(){s.hint?s.hint(r.cm,e,s):r.cm.replaceRange(i(s),s.from||e.from,s.to||e.to,"complete"),t.signal(e,"pick",s),r.cm.scrollIntoView()})),this.options.closeOnPick&&this.close()},cursorActivity:function(){this.debounce&&(d(this.debounce),this.debounce=0);var t=this.startPos;this.data&&(t=this.data.from);var e=this.cm.getCursor(),n=this.cm.getLine(e.line);if(e.line!=this.startPos.line||n.length-e.ch!=this.startLen-this.startPos.ch||e.ch<t.ch||this.cm.somethingSelected()||!e.ch||this.options.closeCharacters.test(n.charAt(e.ch-1)))this.close();else{var i=this;this.debounce=h((function(){i.update()})),this.widget&&this.widget.disable()}},update:function(t){if(null!=this.tick){var e=this,n=++this.tick;l(this.options.hint,this.cm,this.options,(function(i){e.tick==n&&e.finishUpdate(i,t)}))}},finishUpdate:function(e,n){this.data&&t.signal(this.data,"update");var i=this.widget&&this.widget.picked||n&&this.options.completeSingle;this.widget&&this.widget.close(),this.data=e,e&&e.list.length&&(i&&1==e.list.length?this.pick(e,0):(this.widget=new o(this,e),t.signal(e,"shown")))}},o.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode&&this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var t=this.completion.cm.getInputField();t.removeAttribute("aria-activedescendant"),t.removeAttribute("aria-owns");var e=this.completion.cm;this.completion.options.closeOnUnfocus&&(e.off("blur",this.onBlur),e.off("focus",this.onFocus)),e.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var t=this;this.keyMap={Enter:function(){t.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(e,n){if(e>=this.data.list.length?e=n?this.data.list.length-1:0:e<0&&(e=n?0:this.data.list.length-1),this.selectedHint!=e){var i=this.hints.childNodes[this.selectedHint];i&&(i.className=i.className.replace(" "+p,""),i.removeAttribute("aria-selected")),(i=this.hints.childNodes[this.selectedHint=e]).className+=" "+p,i.setAttribute("aria-selected","true"),this.completion.cm.getInputField().setAttribute("aria-activedescendant",i.id),this.scrollToActive(),t.signal(this.data,"select",this.data.list[this.selectedHint],i)}},scrollToActive:function(){var t=this.getSelectedHintRange(),e=this.hints.childNodes[t.from],n=this.hints.childNodes[t.to],i=this.hints.firstChild;e.offsetTop<this.hints.scrollTop?this.hints.scrollTop=e.offsetTop-i.offsetTop:n.offsetTop+n.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+i.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var t=this.completion.options.scrollMargin||0;return{
from:Math.max(0,this.selectedHint-t),to:Math.min(this.data.list.length-1,this.selectedHint+t)}}},t.registerHelper("hint","auto",{resolve:c}),t.registerHelper("hint","fromList",(function(e,n){var i,s=e.getCursor(),r=e.getTokenAt(s),o=t.Pos(s.line,r.start),a=s;r.start<s.ch&&/\w/.test(r.string.charAt(s.ch-r.start-1))?i=r.string.substr(0,s.ch-r.start):(i="",o=s);for(var l=[],c=0;c<n.words.length;c++){var u=n.words[c];u.slice(0,i.length)==i&&l.push(u)}if(l.length)return{list:l,from:o,to:a}})),t.commands.autocomplete=t.showHint;var f={hint:t.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};t.defineOption("hintOptions",null)})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){"use strict";t.overlayMode=function(e,n,i){return{startState:function(){return{base:t.startState(e),overlay:t.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(i){return{base:t.copyState(e,i.base),overlay:t.copyState(n,i.overlay),basePos:i.basePos,baseCur:null,overlayPos:i.overlayPos,overlayCur:null}},token:function(t,s){return(t!=s.streamSeen||Math.min(s.basePos,s.overlayPos)<t.start)&&(s.streamSeen=t,s.basePos=s.overlayPos=t.start),t.start==s.basePos&&(s.baseCur=e.token(t,s.base),s.basePos=t.pos),t.start==s.overlayPos&&(t.pos=t.start,s.overlayCur=n.token(t,s.overlay),s.overlayPos=t.pos),t.pos=Math.min(s.basePos,s.overlayPos),null==s.overlayCur?s.baseCur:null!=s.baseCur&&s.overlay.combineTokens||i&&null==s.overlay.combineTokens?s.baseCur+" "+s.overlayCur:s.overlayCur},indent:e.indent&&function(t,n,i){return e.indent(t.base,n,i)},electricChars:e.electricChars,innerMode:function(t){return{state:t.base,mode:e}},blankLine:function(t){var s,r;return e.blankLine&&(s=e.blankLine(t.base)),n.blankLine&&(r=n.blankLine(t.overlay)),null==r?s:i&&null!=s?s+" "+r:r}}}})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){"use strict";function e(e,n,i){function s(e){if(!r.parentNode)return t.off(document,"mousemove",s);r.style.top=Math.max(0,e.clientY-r.offsetHeight-5)+"px",r.style.left=e.clientX+5+"px"}var r=document.createElement("div");return r.className="CodeMirror-lint-tooltip cm-s-"+e.options.theme,r.appendChild(i.cloneNode(!0)),e.state.lint.options.selfContain?e.getWrapperElement().appendChild(r):document.body.appendChild(r),t.on(document,"mousemove",s),s(n),null!=r.style.opacity&&(r.style.opacity=1),r}function n(t){t.parentNode&&t.parentNode.removeChild(t)}function i(t){t.parentNode&&(null==t.style.opacity&&n(t),t.style.opacity=0,setTimeout((function(){n(t)}),600))}function s(n,s,r,o){function a(){t.off(o,"mouseout",a),l&&(i(l),l=null)}var l=e(n,s,r),c=setInterval((function(){if(l)for(var t=o;;t=t.parentNode){if(t&&11==t.nodeType&&(t=t.host),t==document.body)return;if(!t){a();break}}if(!l)return clearInterval(c)}),400);t.on(o,"mouseout",a)}function r(t,e,n){for(var i in this.marked=[],e instanceof Function&&(e={getAnnotations:e}),e&&!0!==e||(e={}),this.options={},this.linterOptions=e.options||{},_)this.options[i]=_[i];for(var i in e)_.hasOwnProperty(i)?null!=e[i]&&(this.options[i]=e[i]):e.options||(this.linterOptions[i]=e[i]);this.timeout=null,this.hasGutter=n,this.onMouseOver=function(e){v(t,e)},this.waitingFor=0}function o(t){var e=t.state.lint;e.hasGutter&&t.clearGutter(y),e.options.highlightLines&&a(t);for(var n=0;n<e.marked.length;++n)e.marked[n].clear();e.marked.length=0}function a(t){t.eachLine((function(e){var n=e.wrapClass&&/\bCodeMirror-lint-line-\w+\b/.exec(e.wrapClass);n&&t.removeLineClass(e,"wrap",n[0])}))}function l(e,n,i,r,o){var a=document.createElement("div"),l=a;return a.className="CodeMirror-lint-marker CodeMirror-lint-marker-"+i,r&&((l=a.appendChild(document.createElement("div"))).className="CodeMirror-lint-marker CodeMirror-lint-marker-multiple"),0!=o&&t.on(l,"mouseover",(function(t){s(e,t,n,l)})),a}function c(t,e){return"error"==t?t:e}function u(t){for(var e=[],n=0;n<t.length;++n){var i=t[n],s=i.from.line;(e[s]||(e[s]=[])).push(i)}return e}function p(t){var e=t.severity;e||(e="error");var n=document.createElement("div");return n.className="CodeMirror-lint-message CodeMirror-lint-message-"+e,void 0!==t.messageHTML?n.innerHTML=t.messageHTML:n.appendChild(document.createTextNode(t.message)),n}function h(e,n){function i(){r=-1,e.off("change",i)}var s=e.state.lint,r=++s.waitingFor;e.on("change",i),n(e.getValue(),(function(n,o){e.off("change",i),s.waitingFor==r&&(o&&n instanceof t&&(n=o),e.operation((function(){f(e,n)})))}),s.linterOptions,e)}function d(e){var n=e.state.lint;if(n){var i=n.options,s=i.getAnnotations||e.getHelper(t.Pos(0,0),"lint");if(s)if(i.async||s.async)h(e,s);else{var r=s(e.getValue(),n.linterOptions,e);if(!r)return;r.then?r.then((function(t){e.operation((function(){f(e,t)}))})):e.operation((function(){f(e,r)}))}}}function f(t,e){var n=t.state.lint;if(n){var i=n.options;o(t);for(var s=u(e),r=0;r<s.length;++r){var a=s[r];if(a){var h=[];a=a.filter((function(t){return!(h.indexOf(t.message)>-1)&&h.push(t.message)}));for(var d=null,f=n.hasGutter&&document.createDocumentFragment(),m=0;m<a.length;++m){var g=a[m],v=g.severity;v||(v="error"),d=c(d,v),i.formatAnnotation&&(g=i.formatAnnotation(g)),n.hasGutter&&f.appendChild(p(g)),g.to&&n.marked.push(t.markText(g.from,g.to,{className:"CodeMirror-lint-mark CodeMirror-lint-mark-"+v,__annotation:g}))}n.hasGutter&&t.setGutterMarker(r,y,l(t,f,d,s[r].length>1,i.tooltips)),i.highlightLines&&t.addLineClass(r,"wrap",b+d)}}i.onUpdateLinting&&i.onUpdateLinting(e,s,t)}}function m(t){var e=t.state.lint;e&&(clearTimeout(e.timeout),e.timeout=setTimeout((function(){d(t)}),e.options.delay))}function g(t,e,n){for(var i=n.target||n.srcElement,r=document.createDocumentFragment(),o=0;o<e.length;o++){var a=e[o];r.appendChild(p(a))}s(t,n,r,i)}function v(t,e){var n=e.target||e.srcElement;if(/\bCodeMirror-lint-mark-/.test(n.className)){for(var i=n.getBoundingClientRect(),s=(i.left+i.right)/2,r=(i.top+i.bottom)/2,o=t.findMarksAt(t.coordsChar({left:s,top:r},"client")),a=[],l=0;l<o.length;++l){var c=o[l].__annotation;c&&a.push(c)}a.length&&g(t,a,e)}}var y="CodeMirror-lint-markers",b="CodeMirror-lint-line-",_={highlightLines:!1,tooltips:!0,delay:500,lintOnChange:!0,getAnnotations:null,async:!1,selfContain:null,formatAnnotation:null,onUpdateLinting:null};t.defineOption("lint",!1,(function(e,n,i){if(i&&i!=t.Init&&(o(e),!1!==e.state.lint.options.lintOnChange&&e.off("change",m),t.off(e.getWrapperElement(),"mouseover",e.state.lint.onMouseOver),clearTimeout(e.state.lint.timeout),delete e.state.lint),n){for(var s=e.getOption("gutters"),a=!1,l=0;l<s.length;++l)s[l]==y&&(a=!0);var c=e.state.lint=new r(e,n,a);c.options.lintOnChange&&e.on("change",m),0!=c.options.tooltips&&"gutter"!=c.options.tooltips&&t.on(e.getWrapperElement(),"mouseover",c.onMouseOver),d(e)}})),t.defineExtension("performLint",(function(){d(this)}))})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){"use strict";t.registerHelper("lint","json",(function(e,n){var i=[];if(!window.jsonlint)return window.console&&window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run."),i;if(n.skipEmpty&&(null==e||null==e||""==e))return i;var s=window.jsonlint.parser||window.jsonlint;s.parseError=function(e,n){var s=n.loc;i.push({from:t.Pos(s.first_line-1,s.first_column),to:t.Pos(s.last_line-1,s.last_column),message:e})};try{s.parse(e)}catch(t){}return i}))})),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}((function(t){"use strict";function e(t){return"function"==typeof t}function n(t){return"number"==typeof t&&!isNaN(t)}function i(t){return void 0===t}function s(t,e){var i=[];return n(e)&&i.push(e),i.slice.apply(t,i)}function r(t,e){var n=s(arguments,2);return function(){return t.apply(e,n.concat(s(arguments)))}}function o(t){var e=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return e&&(e[1]!==m.protocol||e[2]!==m.hostname||e[3]!==m.port)}function a(t){var e="timestamp="+(new Date).getTime();return t+(-1===t.indexOf("?")?"?":"&")+e}function l(t,e){var n;if(t.naturalWidth)return e(t.naturalWidth,t.naturalHeight);(n=document.createElement("img")).onload=function(){e(this.width,this.height)},n.src=t.src}function c(t){var e=[],i=t.rotate,s=t.scaleX,r=t.scaleY;return n(i)&&e.push("rotate("+i+"deg)"),n(s)&&n(r)&&e.push("scale("+s+","+r+")"),e.length?e.join(" "):"none"}function u(t,e){var n,i,s=rt(t.degree)%180,r=(s>90?180-s:s)*Math.PI/180,o=ot(r),a=at(r),l=t.width,c=t.height,u=t.aspectRatio;return e?i=(n=l/(a+o/u))/u:(n=l*a+c*o,i=l*o+c*a),{width:n,height:i}}function p(e,i){var s,r,o,a=t("<canvas>")[0],l=a.getContext("2d"),c=0,p=0,h=i.naturalWidth,d=i.naturalHeight,f=i.rotate,m=i.scaleX,g=i.scaleY,v=n(m)&&n(g)&&(1!==m||1!==g),y=n(f)&&0!==f,b=y||v,_=h,w=d;return v&&(s=h/2,r=d/2),y&&(_=(o=u({width:h,height:d,degree:f})).width,w=o.height,s=o.width/2,r=o.height/2),a.width=_,a.height=w,b&&(c=-h/2,p=-d/2,l.save(),l.translate(s,r)),y&&l.rotate(f*Math.PI/180),v&&l.scale(m,g),l.drawImage(e,c,p,h,d),b&&l.restore(),a}function h(e,n){this.$element=t(e),this.options=t.extend({},h.DEFAULTS,t.isPlainObject(n)&&n),this.ready=!1,this.built=!1,this.complete=!1,this.rotated=!1,this.cropped=!1,this.disabled=!1,this.replaced=!1,this.isImg=!1,this.originalUrl="",this.canvas=null,this.cropBox=null,this.init()}var d=t(window),f=t(document),m=window.location,g="cropper",v="preview."+g,y="cropper-modal",b="cropper-hide",_="cropper-hidden",w="cropper-invisible",k="cropper-move",A="cropper-crop",C="cropper-disabled",T="cropper-bg",S="mousedown touchstart pointerdown MSPointerDown",x="mousemove touchmove pointermove MSPointerMove",j="mouseup touchend touchcancel pointerup pointercancel MSPointerUp MSPointerCancel",D="wheel mousewheel DOMMouseScroll",P="dblclick",E="load."+g,I="error."+g,O="resize."+g,N="build."+g,M="built."+g,R="cropstart."+g,L="cropmove."+g,F="cropend."+g,$="crop."+g,B="zoom."+g,z=/^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,U="e",q="w",W="s",H="n",J="se",V="sw",G="ne",K="nw",Y="all",X="crop",Z="move",Q="zoom",tt="none",et=e(t("<canvas>")[0].getContext),nt=Math.sqrt,it=Math.min,st=Math.max,rt=Math.abs,ot=Math.sin,at=Math.cos,lt=parseFloat,ct={};t.extend(ct,{init:function(){var t,e=this.$element;if(e.is("img")){if(this.isImg=!0,this.originalUrl=t=e.attr("src"),!t)return;t=e.prop("src")}else e.is("canvas")&&et&&(t=e[0].toDataURL());this.load(t)},trigger:function(e,n){var i=t.Event(e,n);return this.$element.trigger(i),i.isDefaultPrevented()},load:function(e){var n,i,s=this.options,r=this.$element,l="";e&&(this.url=e,r.one(N,s.build),this.trigger(N)||(s.checkImageOrigin&&o(e)&&(l=' crossOrigin="anonymous"',r.prop("crossOrigin")||(n=a(e))),this.$clone=i=t("<img"+l+' src="'+(n||e)+'">'),this.isImg?r[0].complete?this.start():r.one(E,t.proxy(this.start,this)):i.one(E,t.proxy(this.start,this)).one(I,t.proxy(this.stop,this)).addClass(b).insertAfter(r)))},start:function(){l(this.isImg?this.$element[0]:this.$clone[0],t.proxy((function(t,e){this.image={naturalWidth:t,naturalHeight:e,aspectRatio:t/e},this.ready=!0,this.build()}),this))},stop:function(){this.$clone.remove(),this.$clone=null}}),t.extend(ct,{build:function(){var e,n,i,s=this.options,r=this.$element,o=this.$clone;this.ready&&(this.built&&this.unbuild(),this.$container=r.parent(),this.$cropper=e=t(h.TEMPLATE),this.$canvas=e.find(".cropper-canvas").append(o),this.$dragBox=e.find(".cropper-drag-box"),this.$cropBox=n=e.find(".cropper-crop-box"),this.$viewBox=e.find(".cropper-view-box"),this.$face=i=n.find(".cropper-face"),r.addClass(_).after(e),this.isImg||o.removeClass(b),this.initPreview(),this.bind(),s.aspectRatio=lt(s.aspectRatio)||NaN,s.autoCrop?(this.cropped=!0,s.modal&&this.$dragBox.addClass(y)):n.addClass(_),s.guides||n.find(".cropper-dashed").addClass(_),s.center||n.find(".cropper-center").addClass(_),s.cropBoxMovable&&i.addClass(k).data("action",Y),s.highlight||i.addClass(w),s.background&&e.addClass(T),s.cropBoxResizable||n.find(".cropper-line, .cropper-point").addClass(_),this.setDragMode(s.dragCrop?X:s.movable?Z:tt),this.render(),this.built=!0,this.setData(s.data),r.one(M,s.built),setTimeout(t.proxy((function(){this.trigger(M),this.complete=!0}),this),0))},unbuild:function(){this.built&&(this.built=!1,this.initialImage=null,this.initialCanvas=null,this.initialCropBox=null,this.container=null,this.canvas=null,this.cropBox=null,this.unbind(),this.resetPreview(),this.$preview=null,this.$viewBox=null,this.$cropBox=null,this.$dragBox=null,this.$canvas=null,this.$container=null,this.$cropper.remove(),this.$cropper=null)}}),t.extend(ct,{render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.options,e=this.$element,n=this.$container,i=this.$cropper;i.addClass(_),e.removeClass(_),i.css(this.container={width:st(n.width(),lt(t.minContainerWidth)||200),height:st(n.height(),lt(t.minContainerHeight)||100)}),e.addClass(_),i.removeClass(_)},initCanvas:function(){var e=this.container,n=e.width,i=e.height,s=this.image,r=s.aspectRatio,o={aspectRatio:r,width:n,height:i};i*r>n?o.height=n/r:o.width=i*r,o.oldLeft=o.left=(n-o.width)/2,o.oldTop=o.top=(i-o.height)/2,this.canvas=o,this.limitCanvas(!0,!0),this.initialImage=t.extend({},s),this.initialCanvas=t.extend({},o)},limitCanvas:function(e,n){var i,s,r=this.options,o=r.strict,a=this.container,l=a.width,c=a.height,u=this.canvas,p=u.aspectRatio,h=this.cropBox,d=this.cropped&&h,f=this.initialCanvas||u,m=f.width,g=f.height;e&&(i=lt(r.minCanvasWidth)||0,s=lt(r.minCanvasHeight)||0,i?(o&&(i=st(d?h.width:m,i)),s=i/p):s?(o&&(s=st(d?h.height:g,s)),i=s*p):o&&(d?(i=h.width,(s=h.height)*p>i?i=s*p:s=i/p):(i=m,s=g)),t.extend(u,{minWidth:i,minHeight:s,maxWidth:1/0,maxHeight:1/0})),n&&(o?d?(u.minLeft=it(h.left,h.left+h.width-u.width),u.minTop=it(h.top,h.top+h.height-u.height),u.maxLeft=h.left,u.maxTop=h.top):(u.minLeft=it(0,l-u.width),u.minTop=it(0,c-u.height),u.maxLeft=st(0,l-u.width),u.maxTop=st(0,c-u.height)):(u.minLeft=-u.width,u.minTop=-u.height,u.maxLeft=l,u.maxTop=c))},renderCanvas:function(t){var e,n,i=this.options,s=this.canvas,r=this.image;this.rotated&&(this.rotated=!1,(e=(n=u({width:r.width,height:r.height,degree:r.rotate})).width/n.height)!==s.aspectRatio&&(s.left-=(n.width-s.width)/2,s.top-=(n.height-s.height)/2,s.width=n.width,s.height=n.height,s.aspectRatio=e,this.limitCanvas(!0,!1))),(s.width>s.maxWidth||s.width<s.minWidth)&&(s.left=s.oldLeft),(s.height>s.maxHeight||s.height<s.minHeight)&&(s.top=s.oldTop),s.width=it(st(s.width,s.minWidth),s.maxWidth),s.height=it(st(s.height,s.minHeight),s.maxHeight),this.limitCanvas(!1,!0),s.oldLeft=s.left=it(st(s.left,s.minLeft),s.maxLeft),s.oldTop=s.top=it(st(s.top,s.minTop),s.maxTop),this.$canvas.css({width:s.width,height:s.height,left:s.left,top:s.top}),this.renderImage(),this.cropped&&i.strict&&this.limitCropBox(!0,!0),t&&this.output()},renderImage:function(e){var n,i=this.canvas,s=this.image;s.rotate&&(n=u({width:i.width,height:i.height,degree:s.rotate,aspectRatio:s.aspectRatio},!0)),t.extend(s,n?{width:n.width,height:n.height,left:(i.width-n.width)/2,top:(i.height-n.height)/2}:{width:i.width,height:i.height,left:0,top:0}),this.$clone.css({width:s.width,height:s.height,marginLeft:s.left,marginTop:s.top,transform:c(s)}),e&&this.output()},initCropBox:function(){var e=this.options,n=this.canvas,i=e.aspectRatio,s=lt(e.autoCropArea)||.8,r={width:n.width,height:n.height};i&&(n.height*i>n.width?r.height=r.width/i:r.width=r.height*i),this.cropBox=r,this.limitCropBox(!0,!0),r.width=it(st(r.width,r.minWidth),r.maxWidth),r.height=it(st(r.height,r.minHeight),r.maxHeight),r.width=st(r.minWidth,r.width*s),r.height=st(r.minHeight,r.height*s),r.oldLeft=r.left=n.left+(n.width-r.width)/2,r.oldTop=r.top=n.top+(n.height-r.height)/2,this.initialCropBox=t.extend({},r)},limitCropBox:function(t,e){var n,i,s=this.options,r=s.strict,o=this.container,a=o.width,l=o.height,c=this.canvas,u=this.cropBox,p=s.aspectRatio;t&&(n=lt(s.minCropBoxWidth)||0,i=lt(s.minCropBoxHeight)||0,u.minWidth=it(a,n),u.minHeight=it(l,i),u.maxWidth=it(a,r?c.width:a),u.maxHeight=it(l,r?c.height:l),p&&(u.maxHeight*p>u.maxWidth?(u.minHeight=u.minWidth/p,u.maxHeight=u.maxWidth/p):(u.minWidth=u.minHeight*p,u.maxWidth=u.maxHeight*p)),u.minWidth=it(u.maxWidth,u.minWidth),u.minHeight=it(u.maxHeight,u.minHeight)),e&&(r?(u.minLeft=st(0,c.left),u.minTop=st(0,c.top),u.maxLeft=it(a,c.left+c.width)-u.width,u.maxTop=it(l,c.top+c.height)-u.height):(u.minLeft=0,u.minTop=0,u.maxLeft=a-u.width,u.maxTop=l-u.height))},renderCropBox:function(){var t=this.options,e=this.container,n=e.width,i=e.height,s=this.cropBox;(s.width>s.maxWidth||s.width<s.minWidth)&&(s.left=s.oldLeft),(s.height>s.maxHeight||s.height<s.minHeight)&&(s.top=s.oldTop),s.width=it(st(s.width,s.minWidth),s.maxWidth),s.height=it(st(s.height,s.minHeight),s.maxHeight),this.limitCropBox(!1,!0),s.oldLeft=s.left=it(st(s.left,s.minLeft),s.maxLeft),s.oldTop=s.top=it(st(s.top,s.minTop),s.maxTop),t.movable&&t.cropBoxMovable&&this.$face.data("action",s.width===n&&s.height===i?Z:Y),this.$cropBox.css({width:s.width,height:s.height,left:s.left,top:s.top}),this.cropped&&t.strict&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),this.complete?this.trigger($,this.getData()):this.built||this.$element.one(M,t.proxy((function(){this.trigger($,this.getData())}),this))}}),t.extend(ct,{initPreview:function(){var e=this.url;this.$preview=t(this.options.preview),this.$viewBox.html('<img src="'+e+'">'),this.$preview.each((function(){var n=t(this);n.data(v,{width:n.width(),height:n.height(),original:n.html()}),n.html('<img src="'+e+'" style="display:block;width:100%;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important">')}))},resetPreview:function(){this.$preview.each((function(){var e=t(this);e.html(e.data(v).original).removeData(v)}))},preview:function(){var e=this.image,n=this.canvas,i=this.cropBox,s=e.width,r=e.height,o=i.left-n.left-e.left,a=i.top-n.top-e.top;this.cropped&&!this.disabled&&(this.$viewBox.find("img").css({width:s,height:r,marginLeft:-o,marginTop:-a,transform:c(e)}),this.$preview.each((function(){var n=t(this),l=n.data(v),u=l.width/i.width,p=l.width,h=i.height*u;h>l.height&&(u=l.height/i.height,p=i.width*u,h=l.height),n.width(p).height(h).find("img").css({width:s*u,height:r*u,marginLeft:-o*u,marginTop:-a*u,transform:c(e)})})))}}),t.extend(ct,{bind:function(){var n=this.options,i=this.$element,s=this.$cropper;e(n.cropstart)&&i.on(R,n.cropstart),e(n.cropmove)&&i.on(L,n.cropmove),e(n.cropend)&&i.on(F,n.cropend),e(n.crop)&&i.on($,n.crop),e(n.zoom)&&i.on(B,n.zoom),s.on(S,t.proxy(this.cropStart,this)),n.zoomable&&n.mouseWheelZoom&&s.on(D,t.proxy(this.wheel,this)),n.doubleClickToggle&&s.on(P,t.proxy(this.dblclick,this)),f.on(x,this._cropMove=r(this.cropMove,this)).on(j,this._cropEnd=r(this.cropEnd,this)),n.responsive&&d.on(O,this._resize=r(this.resize,this))},unbind:function(){var t=this.options,n=this.$element,i=this.$cropper;e(t.cropstart)&&n.off(R,t.cropstart),e(t.cropmove)&&n.off(L,t.cropmove),e(t.cropend)&&n.off(F,t.cropend),e(t.crop)&&n.off($,t.crop),e(t.zoom)&&n.off(B,t.zoom),i.off(S,this.cropStart),t.zoomable&&t.mouseWheelZoom&&i.off(D,this.wheel),t.doubleClickToggle&&i.off(P,this.dblclick),f.off(x,this._cropMove).off(j,this._cropEnd),t.responsive&&d.off(O,this._resize)}}),t.extend(ct,{resize:function(){var e,n,i,s=this.$container,r=this.container;!this.disabled&&r&&(1===(i=s.width()/r.width)&&s.height()===r.height||(e=this.getCanvasData(),n=this.getCropBoxData(),this.render(),this.setCanvasData(t.each(e,(function(t,n){e[t]=n*i}))),this.setCropBoxData(t.each(n,(function(t,e){n[t]=e*i})))))},dblclick:function(){this.disabled||(this.$dragBox.hasClass(A)?this.setDragMode(Z):this.setDragMode(X))},wheel:function(t){var e=t.originalEvent,n=e,i=lt(this.options.wheelZoomRatio)||.1,s=1;this.disabled||(t.preventDefault(),n.deltaY?s=n.deltaY>0?1:-1:n.wheelDelta?s=-n.wheelDelta/120:n.detail&&(s=n.detail>0?1:-1),this.zoom(-s*i,e))},cropStart:function(e){var n,i,s=this.options,r=e.originalEvent,o=r&&r.touches,a=e;if(!this.disabled){if(o){if((n=o.length)>1){if(!s.zoomable||!s.touchDragZoom||2!==n)return;a=o[1],this.startX2=a.pageX,this.startY2=a.pageY,i=Q}a=o[0]}if(i=i||t(a.target).data("action"),z.test(i)){if(this.trigger(R,{originalEvent:r,action:i}))return;e.preventDefault(),this.action=i,this.cropping=!1,this.startX=a.pageX||r&&r.pageX,this.startY=a.pageY||r&&r.pageY,i===X&&(this.cropping=!0,this.$dragBox.addClass(y))}}},cropMove:function(t){var e,n=this.options,i=t.originalEvent,s=i&&i.touches,r=t,o=this.action;if(!this.disabled){if(s){if((e=s.length)>1){if(!n.zoomable||!n.touchDragZoom||2!==e)return;r=s[1],this.endX2=r.pageX,this.endY2=r.pageY}r=s[0]}if(o){if(this.trigger(L,{originalEvent:i,action:o}))return;t.preventDefault(),this.endX=r.pageX||i&&i.pageX,this.endY=r.pageY||i&&i.pageY,this.change(r.shiftKey,o===Q?i:null)}}},cropEnd:function(t){var e=t.originalEvent,n=this.action;this.disabled||n&&(t.preventDefault(),this.cropping&&(this.cropping=!1,this.$dragBox.toggleClass(y,this.cropped&&this.options.modal)),this.action="",this.trigger(F,{originalEvent:e,action:n}))}}),t.extend(ct,{change:function(t,e){var n,i,s,r,o,a,l,c=this.options,u=c.aspectRatio,p=this.action,h=this.container,d=this.canvas,f=this.cropBox,m=f.width,g=f.height,v=f.left,y=f.top,b=v+m,w=y+g,k=0,A=0,C=h.width,T=h.height,S=!0;switch(!u&&t&&(u=m&&g?m/g:1),c.strict&&(k=f.minLeft,A=f.minTop,C=k+it(h.width,d.width),T=A+it(h.height,d.height)),i={x:this.endX-this.startX,y:this.endY-this.startY},u&&(i.X=i.y*u,i.Y=i.x/u),p){case Y:v+=i.x,y+=i.y;break;case U:if(i.x>=0&&(b>=C||u&&(y<=A||w>=T))){S=!1;break}m+=i.x,u&&(g=m/u,y-=i.Y/2),m<0&&(p=q,m=0);break;case H:if(i.y<=0&&(y<=A||u&&(v<=k||b>=C))){S=!1;break}g-=i.y,y+=i.y,u&&(m=g*u,v+=i.X/2),g<0&&(p=W,g=0);break;case q:if(i.x<=0&&(v<=k||u&&(y<=A||w>=T))){S=!1;break}m-=i.x,v+=i.x,u&&(g=m/u,y+=i.Y/2),m<0&&(p=U,m=0);break;case W:if(i.y>=0&&(w>=T||u&&(v<=k||b>=C))){S=!1;break}g+=i.y,u&&(m=g*u,v-=i.X/2),g<0&&(p=H,g=0);break;case G:if(u){if(i.y<=0&&(y<=A||b>=C)){S=!1;break}g-=i.y,y+=i.y,m=g*u}else i.x>=0?b<C?m+=i.x:i.y<=0&&y<=A&&(S=!1):m+=i.x,i.y<=0?y>A&&(g-=i.y,y+=i.y):(g-=i.y,y+=i.y);m<0&&g<0?(p=V,g=0,m=0):m<0?(p=K,m=0):g<0&&(p=J,g=0);break;case K:if(u){if(i.y<=0&&(y<=A||v<=k)){S=!1;break}g-=i.y,y+=i.y,m=g*u,v+=i.X}else i.x<=0?v>k?(m-=i.x,v+=i.x):i.y<=0&&y<=A&&(S=!1):(m-=i.x,v+=i.x),i.y<=0?y>A&&(g-=i.y,y+=i.y):(g-=i.y,y+=i.y);m<0&&g<0?(p=J,g=0,m=0):m<0?(p=G,m=0):g<0&&(p=V,g=0);break;case V:if(u){if(i.x<=0&&(v<=k||w>=T)){S=!1;break}m-=i.x,v+=i.x,g=m/u}else i.x<=0?v>k?(m-=i.x,v+=i.x):i.y>=0&&w>=T&&(S=!1):(m-=i.x,v+=i.x),i.y>=0?w<T&&(g+=i.y):g+=i.y;m<0&&g<0?(p=G,g=0,m=0):m<0?(p=J,m=0):g<0&&(p=K,g=0);break;case J:if(u){if(i.x>=0&&(b>=C||w>=T)){S=!1;break}g=(m+=i.x)/u}else i.x>=0?b<C?m+=i.x:i.y>=0&&w>=T&&(S=!1):m+=i.x,i.y>=0?w<T&&(g+=i.y):g+=i.y;m<0&&g<0?(p=K,g=0,m=0):m<0?(p=V,m=0):g<0&&(p=G,g=0);break;case Z:this.move(i.x,i.y),S=!1;break;case Q:this.zoom((s=rt(this.startX-this.startX2),r=rt(this.startY-this.startY2),o=rt(this.endX-this.endX2),a=rt(this.endY-this.endY2),l=nt(s*s+r*r),(nt(o*o+a*a)-l)/l),e),this.startX2=this.endX2,this.startY2=this.endY2,S=!1;break;case X:i.x&&i.y&&(n=this.$cropper.offset(),v=this.startX-n.left,y=this.startY-n.top,m=f.minWidth,g=f.minHeight,i.x>0?i.y>0?p=J:(p=G,y-=g):i.y>0?(p=V,v-=m):(p=K,v-=m,y-=g),this.cropped||(this.cropped=!0,this.$cropBox.removeClass(_)))}S&&(f.width=m,f.height=g,f.left=v,f.top=y,this.action=p,this.renderCropBox()),this.startX=this.endX,this.startY=this.endY}}),t.extend(ct,{crop:function(){this.built&&!this.disabled&&(this.cropped||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&this.$dragBox.addClass(y),this.$cropBox.removeClass(_)),this.setCropBoxData(this.initialCropBox))},reset:function(){this.built&&!this.disabled&&(this.image=t.extend({},this.initialImage),this.canvas=t.extend({},this.initialCanvas),this.cropBox=t.extend({},this.initialCropBox),this.renderCanvas(),this.cropped&&this.renderCropBox())},clear:function(){this.cropped&&!this.disabled&&(t.extend(this.cropBox,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(),this.renderCanvas(),this.$dragBox.removeClass(y),this.$cropBox.addClass(_))},replace:function(t){!this.disabled&&t&&(this.isImg&&(this.replaced=!0,this.$element.attr("src",t)),this.options.data=null,this.load(t))},enable:function(){this.built&&(this.disabled=!1,this.$cropper.removeClass(C))},disable:function(){this.built&&(this.disabled=!0,this.$cropper.addClass(C))},destroy:function(){var t=this.$element;this.ready?(this.isImg&&this.replaced&&t.attr("src",this.originalUrl),this.unbuild(),t.removeClass(_)):this.isImg?t.off(E,this.start):this.$clone&&this.$clone.remove(),t.removeData(g)},move:function(t,e){var s=this.canvas;i(e)&&(e=t),t=lt(t),e=lt(e),this.built&&!this.disabled&&this.options.movable&&(s.left+=n(t)?t:0,s.top+=n(e)?e:0,this.renderCanvas(!0))},zoom:function(t,e){var n,i,s=this.canvas;if((t=lt(t))&&this.built&&!this.disabled&&this.options.zoomable){if(this.trigger(B,{originalEvent:e,ratio:t}))return;t=t<0?1/(1-t):1+t,n=s.width*t,i=s.height*t,s.left-=(n-s.width)/2,s.top-=(i-s.height)/2,s.width=n,s.height=i,this.renderCanvas(!0),this.setDragMode(Z)}},rotate:function(t){var e=this.image,n=e.rotate||0;t=lt(t)||0,this.built&&!this.disabled&&this.options.rotatable&&(e.rotate=(n+t)%360,this.rotated=!0,this.renderCanvas(!0))},scale:function(t,e){var s=this.image;i(e)&&(e=t),t=lt(t),e=lt(e),this.built&&!this.disabled&&this.options.scalable&&(s.scaleX=n(t)?t:1,s.scaleY=n(e)?e:1,this.renderImage(!0))},getData:function(e){var n,i,s=this.options,r=this.image,o=this.canvas,a=this.cropBox;return this.built&&this.cropped?(i={x:a.left-o.left,y:a.top-o.top,width:a.width,height:a.height},n=r.width/r.naturalWidth,t.each(i,(function(t,s){s/=n,i[t]=e?Math.round(s):s}))):i={x:0,y:0,width:0,height:0},s.rotatable&&(i.rotate=r.rotate||0),s.scalable&&(i.scaleX=r.scaleX||1,i.scaleY=r.scaleY||1),i},setData:function(i){var s,r=this.image,o=this.canvas,a={};e(i)&&(i=i.call(this.$element)),this.built&&!this.disabled&&t.isPlainObject(i)&&(n(i.rotate)&&i.rotate!==r.rotate&&this.options.rotatable&&(r.rotate=i.rotate,this.rotated=!0,this.renderCanvas(!0)),s=r.width/r.naturalWidth,n(i.x)&&(a.left=i.x*s+o.left),n(i.y)&&(a.top=i.y*s+o.top),n(i.width)&&(a.width=i.width*s),n(i.height)&&(a.height=i.height*s),this.setCropBoxData(a))},getContainerData:function(){return this.built?this.container:{}},getImageData:function(){return this.ready?this.image:{}},getCanvasData:function(){var t,e=this.canvas;return this.built&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCanvasData:function(i){var s=this.canvas,r=s.aspectRatio;e(i)&&(i=i.call(this.$element)),this.built&&!this.disabled&&t.isPlainObject(i)&&(n(i.left)&&(s.left=i.left),n(i.top)&&(s.top=i.top),n(i.width)?(s.width=i.width,s.height=i.width/r):n(i.height)&&(s.height=i.height,s.width=i.height*r),this.renderCanvas(!0))},getCropBoxData:function(){var t,e=this.cropBox;return this.built&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(i){var s,r,o=this.cropBox,a=this.options.aspectRatio;e(i)&&(i=i.call(this.$element)),this.built&&this.cropped&&!this.disabled&&t.isPlainObject(i)&&(n(i.left)&&(o.left=i.left),n(i.top)&&(o.top=i.top),n(i.width)&&i.width!==o.width&&(s=!0,o.width=i.width),n(i.height)&&i.height!==o.height&&(r=!0,o.height=i.height),a&&(s?o.height=o.width/a:r&&(o.width=o.height*a)),this.renderCropBox())},getCroppedCanvas:function(e){var n,i,s,r,o,a,l,c,u,h,d;if(this.built&&this.cropped&&et)return t.isPlainObject(e)||(e={}),d=this.getData(),n=d.width,i=d.height,c=n/i,t.isPlainObject(e)&&(o=e.width,a=e.height,o?(a=o/c,l=o/n):a&&(o=a*c,l=a/i)),s=o||n,r=a||i,(u=t("<canvas>")[0]).width=s,u.height=r,h=u.getContext("2d"),e.fillColor&&(h.fillStyle=e.fillColor,h.fillRect(0,0,s,r)),h.drawImage.apply(h,function(){var t,e,s,r,o,a,c=p(this.$clone[0],this.image),u=c.width,h=c.height,f=[c],m=d.x,g=d.y;return m<=-n||m>u?m=t=s=o=0:m<=0?(s=-m,t=o=it(u,n+(m=0))):m<=u&&(s=0,t=o=it(n,u-m)),t<=0||g<=-i||g>h?g=e=r=a=0:g<=0?(r=-g,e=a=it(h,i+(g=0))):g<=h&&(r=0,e=a=it(i,h-g)),f.push(m,g,t,e),l&&(s*=l,r*=l,o*=l,a*=l),o>0&&a>0&&f.push(s,r,o,a),f}.call(this)),u},setAspectRatio:function(t){var e=this.options;this.disabled||i(t)||(e.aspectRatio=lt(t)||NaN,this.built&&(this.initCropBox(),this.cropped&&this.renderCropBox()))},setDragMode:function(t){var e,n,i=this.options;this.ready&&!this.disabled&&(e=i.dragCrop&&t===X,n=i.movable&&t===Z,t=e||n?t:tt,this.$dragBox.data("action",t).toggleClass(A,e).toggleClass(k,n),i.cropBoxMovable||this.$face.data("action",t).toggleClass(A,e).toggleClass(k,n))}}),t.extend(h.prototype,ct),h.DEFAULTS={aspectRatio:NaN,data:null,preview:"",strict:!0,responsive:!0,checkImageOrigin:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,dragCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,mouseWheelZoom:!0,wheelZoomRatio:.1,touchDragZoom:!0,cropBoxMovable:!0,cropBoxResizable:!0,doubleClickToggle:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,build:null,built:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},h.setDefaults=function(e){t.extend(h.DEFAULTS,e)},h.TEMPLATE='<div class="cropper-container"><div class="cropper-canvas"></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-action="e"></span><span class="cropper-line line-n" data-action="n"></span><span class="cropper-line line-w" data-action="w"></span><span class="cropper-line line-s" data-action="s"></span><span class="cropper-point point-e" data-action="e"></span><span class="cropper-point point-n" data-action="n"></span><span class="cropper-point point-w" data-action="w"></span><span class="cropper-point point-s" data-action="s"></span><span class="cropper-point point-ne" data-action="ne"></span><span class="cropper-point point-nw" data-action="nw"></span><span class="cropper-point point-sw" data-action="sw"></span><span class="cropper-point point-se" data-action="se"></span></div></div>',h.other=t.fn.cropper,t.fn.cropper=function(n){var r,o=s(arguments,1);return this.each((function(){var i,s=t(this),a=s.data(g);if(!a){if(/destroy/.test(n))return;s.data(g,a=new h(this,n))}"string"==typeof n&&e(i=a[n])&&(r=i.apply(a,o))})),i(r)?this:r},t.fn.cropper.Constructor=h,t.fn.cropper.setDefaults=h.setDefaults,t.fn.cropper.noConflict=function(){return t.fn.cropper=h.other,this}})),function(t){function e(e,n){var i;return t.Notification?i=new t.Notification(e,{icon:y(n.icon)?n.icon:n.icon.x32,body:n.body||f,tag:n.tag||f}):t.webkitNotifications?(i=t.webkitNotifications.createNotification(n.icon,e,n.body)).show():navigator.mozNotification?(i=navigator.mozNotification.createNotification(e,n.body,n.icon)).show():t.external&&t.external.msIsSiteMode()&&(t.external.msSiteModeClearIconOverlay(),t.external.msSiteModeSetIconOverlay(y(n.icon)?n.icon:n.icon.x16,e),t.external.msSiteModeActivate(),i={ieVerification:g+1}),i}function n(e){return{close:function(){e&&(e.close?e.close():t.external&&t.external.msIsSiteMode()&&e.ieVerification===g&&t.external.msSiteModeClearIconOverlay())}}}function i(e){if(m){var n=v(e)?e:w;t.webkitNotifications&&t.webkitNotifications.checkPermission?t.webkitNotifications.requestPermission(n):t.Notification&&t.Notification.requestPermission&&t.Notification.requestPermission(n)}}function s(){var e
;if(m)return t.Notification&&t.Notification.permissionLevel?e=t.Notification.permissionLevel():t.webkitNotifications&&t.webkitNotifications.checkPermission?e=p[t.webkitNotifications.checkPermission()]:navigator.mozNotification?e=c:t.Notification&&t.Notification.permission?e=t.Notification.permission:t.external&&void 0!==t.external.msIsSiteMode()&&(e=t.external.msIsSiteMode()?c:l),e}function r(t){return t&&b(t)&&_(k,t),k}function o(){return!k.pageVisibility||(document.hidden||document.msHidden||document.mozHidden||document.webkitHidden)}function a(i,r){var a,l;return m&&o()&&y(i)&&r&&(y(r.icon)||b(r.icon))&&s()===c&&(a=e(i,r)),l=n(a),k.autoClose&&a&&!a.ieVerification&&a.addEventListener&&a.addEventListener("show",(function(){var e=l;t.setTimeout((function(){e.close()}),k.autoClose)})),l}var l="default",c="granted",u="denied",p=[c,l,u],h={pageVisibility:!0,autoClose:5e3},d={},f="",m=function(){var e=!1;try{e=!!(t.Notification||t.webkitNotifications||navigator.mozNotification||t.external&&void 0!==t.external.msIsSiteMode())}catch(t){}return e}(),g=Math.floor(10*Math.random()+1),v=function(t){return t&&t.constructor===Function},y=function(t){return t&&t.constructor===String},b=function(t){return t&&t.constructor===Object},_=function(t,e){var n,i;for(n in e)i=e[n],n in t&&(t[n]===i||n in d&&d[n]===i)||(t[n]=i);return t},w=function(){},k=h;t.notify={PERMISSION_DEFAULT:l,PERMISSION_GRANTED:c,PERMISSION_DENIED:u,isSupported:m,config:r,createNotification:a,permissionLevel:s,requestPermission:i},v(Object.freeze)&&Object.freeze(t.notify)}(window),function(t){"use strict";function e(t){function e(){return It<Ot}function n(){return Et[It]}function i(){return It}function s(t){It=t}function r(){It+=1}function o(){It=0,Ot=Et.length}function l(t,e){return{name:t,tokens:e||"",semantic:e||"",children:[]}}function c(t,e){var n;return null===e?null:((n=l(t)).tokens=e.tokens,n.semantic=e.semantic,n.children.push(e),n)}function u(t,e){return null!==e&&(t.tokens+=e.tokens,t.semantic+=e.semantic),t.children.push(e),t}function p(t){var i;return e()&&t(i=n())?(r(),l("token",i)):null}function h(t){return function(){return c("literal",p((function(e){return e===t})))}}function d(){var t=arguments;return function(){var e,n,r,o;for(o=i(),n=l("and"),e=0;e<t.length;e+=1){if(null===(r=t[e]()))return s(o),null;u(n,r)}return n}}function f(){var t=arguments;return function(){var e,n,r;for(r=i(),e=0;e<t.length;e+=1){if(null!==(n=t[e]()))return n;s(r)}return null}}function m(t){return function(){var e,n;return n=i(),null!==(e=t())?e:(s(n),l("opt"))}}function g(t){return function(){var e=t();return null!==e&&(e.semantic=""),e}}function v(t){return function(){var e=t();return null!==e&&e.semantic.length>0&&(e.semantic=" "),e}}function y(t,e){return function(){var n,r,o,a,c;for(a=i(),n=l("star"),o=0,c=void 0===e?0:e;null!==(r=t());)o+=1,u(n,r);return o>=c?n:(s(a),null)}}function b(t){return t.replace(/([ \t]|\r\n)+/g," ").replace(/^\s*/,"").replace(/\s*$/,"")}function _(t){return t.charCodeAt(0)>=128}function w(){return c("cr",h("\r")())}function k(){return c("crlf",d(w,T)())}function A(){return c("dquote",h('"')())}function C(){return c("htab",h("\t")())}function T(){return c("lf",h("\n")())}function S(){return c("sp",h(" ")())}function x(){return c("vchar",p((function(e){var n=e.charCodeAt(0),i=33<=n&&n<=126;return t.rfc6532&&(i=i||_(e)),i})))}function j(){return c("wsp",f(S,C)())}function D(){var t=c("quoted-pair",f(d(h("\\"),f(x,j)),ut)());return null===t?null:(t.semantic=t.semantic[1],t)}function P(){return c("fws",f(ht,d(m(d(y(j),g(k))),y(j,1)))())}function E(){return c("ctext",f((function(){return p((function(e){var n=e.charCodeAt(0),i=33<=n&&n<=39||42<=n&&n<=91||93<=n&&n<=126;return t.rfc6532&&(i=i||_(e)),i}))}),lt)())}function I(){return c("ccontent",f(E,D,O)())}function O(){return c("comment",d(h("("),y(d(m(P),I)),m(P),h(")"))())}function N(){return c("cfws",f(d(y(d(m(P),O),1),m(P)),P)())}function M(){return c("atext",p((function(e){var n="a"<=e&&e<="z"||"A"<=e&&e<="Z"||"0"<=e&&e<="9"||["!","#","$","%","&","'","*","+","-","/","=","?","^","_","`","{","|","}","~"].indexOf(e)>=0;return t.rfc6532&&(n=n||_(e)),n})))}function R(){return c("atom",d(v(m(N)),y(M,1),v(m(N)))())}function L(){var t,e;return null===(t=c("dot-atom-text",y(M,1)()))||null!==(e=y(d(h("."),y(M,1)))())&&u(t,e),t}function F(){return c("dot-atom",d(g(m(N)),L,g(m(N)))())}function $(){return c("qtext",f((function(){return p((function(e){var n=e.charCodeAt(0),i=33===n||35<=n&&n<=91||93<=n&&n<=126;return t.rfc6532&&(i=i||_(e)),i}))}),ct)())}function B(){return c("qcontent",f($,D)())}function z(){return c("quoted-string",d(g(m(N)),g(A),y(d(m(v(P)),B)),m(g(P)),g(A),g(m(N)))())}function U(){return c("word",f(R,z)())}function q(){return c("phrase",f(pt,y(U,1))())}function W(){return c("address",f(H,G)())}function H(){return c("mailbox",f(J,it)())}function J(){return c("name-addr",d(m(K),V)())}function V(){return c("angle-addr",f(d(g(m(N)),h("<"),it,h(">"),g(m(N))),dt)())}function G(){return c("group",d(K,h(":"),m(Z),h(";"),g(m(N)))())}function K(){return c("display-name",function(){var t=q();return null!==t&&(t.semantic=b(t.semantic)),t}())}function Y(){return c("mailbox-list",f(d(H,y(d(h(","),H))),gt)())}function X(){return c("address-list",f(d(W,y(d(h(","),W))),vt)())}function Z(){return c("group-list",f(Y,g(N),yt)())}function Q(){return c("local-part",f(bt,F,z)())}function tt(){return c("dtext",f((function(){return p((function(e){var n=e.charCodeAt(0),i=33<=n&&n<=90||94<=n&&n<=126;return t.rfc6532&&(i=i||_(e)),i}))}),wt)())}function et(){return c("domain-literal",d(g(m(N)),h("["),y(d(m(P),tt)),m(P),h("]"),g(m(N)))())}function nt(){return c("domain",function(){var e=f(_t,F,et)();return t.rejectTLD&&e&&e.semantic&&e.semantic.indexOf(".")<0?null:(e&&(e.semantic=e.semantic.replace(/\s+/g,"")),e)}())}function it(){return c("addr-spec",d(Q,h("@"),nt)())}function st(){return c("from",f(Y,X)())}function rt(){return c("sender",f(H,W)())}function ot(){return c("reply-to",X())}function at(){return t.strict?null:c("obs-NO-WS-CTL",p((function(t){var e=t.charCodeAt(0);return 1<=e&&e<=8||11===e||12===e||14<=e&&e<=31||127===e})))}function lt(){return t.strict?null:c("obs-ctext",at())}function ct(){return t.strict?null:c("obs-qtext",at())}function ut(){return t.strict?null:c("obs-qp",d(h("\\"),f(h("\0"),at,T,w))())}function pt(){return t.strict?null:c("obs-phrase",d(U,y(f(U,h("."),v(N))))())}function ht(){return t.strict?null:c("obs-FWS",y(d(g(m(k)),j),1)())}function dt(){return t.strict?null:c("obs-angle-addr",d(g(m(N)),h("<"),ft,it,h(">"),g(m(N)))())}function ft(){return t.strict?null:c("obs-route",d(mt,h(":"))())}function mt(){return t.strict?null:c("obs-domain-list",d(y(f(g(N),h(","))),h("@"),nt,y(d(h(","),g(m(N)),m(d(h("@"),nt)))))())}function gt(){return t.strict?null:c("obs-mbox-list",d(y(d(g(m(N)),h(","))),H,y(d(h(","),m(d(H,g(N))))))())}function vt(){return t.strict?null:c("obs-addr-list",d(y(d(g(m(N)),h(","))),W,y(d(h(","),m(d(W,g(N))))))())}function yt(){return t.strict?null:c("obs-group-list",d(y(d(g(m(N)),h(",")),1),g(m(N)))())}function bt(){return t.strict?null:c("obs-local-part",d(U,y(d(h("."),U)))())}function _t(){return t.strict?null:c("obs-domain",d(R,y(d(h("."),R)))())}function wt(){return t.strict?null:c("obs-dtext",f(at,D)())}function kt(t,e){var n,i,s;if(null==e)return null;for(i=[e];i.length>0;){if((s=i.pop()).name===t)return s;for(n=s.children.length-1;n>=0;n-=1)i.push(s.children[n])}return null}function At(t,e){var n,i,s,r;if(null==e)return null;for(i=[e],r=[];i.length>0;)for((s=i.pop()).name===t&&r.push(s),n=s.children.length-1;n>=0;n-=1)i.push(s.children[n]);return r}function Ct(t,e){var n,i,s,r,o;if(null==e)return null;for(i=[e],r=[],o={},n=0;n<t.length;n+=1)o[t[n]]=!0;for(;i.length>0;)if((s=i.pop()).name in o)r.push(s);else for(n=s.children.length-1;n>=0;n-=1)i.push(s.children[n]);return r}function Tt(e){var n,i,s,r,o;if(null===e)return null;for(n=[],i=Ct(["group","mailbox"],e),s=0;s<i.length;s+=1)"group"===(r=i[s]).name?n.push(St(r)):"mailbox"===r.name&&n.push(xt(r));return o={ast:e,addresses:n},t.simple&&(o=Dt(o)),t.oneResult?Pt(o):t.simple?o&&o.addresses:o}function St(t){var e,n=kt("display-name",t),i=[],s=Ct(["mailbox"],t);for(e=0;e<s.length;e+=1)i.push(xt(s[e]));return{node:t,parts:{name:n},type:t.name,name:jt(n),addresses:i}}function xt(t){var e=kt("display-name",t),n=kt("addr-spec",t),i=At("cfws",t),s=kt("local-part",n),r=kt("domain",n);return{node:t,parts:{name:e,address:n,local:s,domain:r,comments:i},type:t.name,name:jt(e),address:jt(n),local:jt(s),domain:jt(r),groupName:jt(t.groupName)}}function jt(t){return null!=t?t.semantic:null}function Dt(t){var e;if(t&&t.addresses)for(e=0;e<t.addresses.length;e+=1)delete t.addresses[e].node;return t}function Pt(e){return e?!t.partial&&e.addresses.length>1?null:e.addresses&&e.addresses[0]:null}var Et,It,Ot,Nt,Mt;if(null===(t=a(t,{})))return null;if(Et=t.input,Mt={address:W,"address-list":X,"angle-addr":V,from:st,group:G,mailbox:H,"mailbox-list":Y,"reply-to":ot,sender:rt}[t.startAt]||X,!t.strict){if(o(),t.strict=!0,Nt=Mt(Et),t.partial||!e())return Tt(Nt);t.strict=!1}return o(),Nt=Mt(Et),!t.partial&&e()?null:Tt(Nt)}function n(t){return e(a(t,{oneResult:!0,rfc6532:!0,simple:!0,startAt:"address-list"}))}function i(t){return e(a(t,{rfc6532:!0,simple:!0,startAt:"address-list"}))}function s(t){return e(a(t,{rfc6532:!0,simple:!0,startAt:"from"}))}function r(t){return e(a(t,{oneResult:!0,rfc6532:!0,simple:!0,startAt:"sender"}))}function o(t){return e(a(t,{rfc6532:!0,simple:!0,startAt:"reply-to"}))}function a(t,e){function n(t){return"[object String]"===Object.prototype.toString.call(t)}function i(t){return t===Object(t)}function s(t){return null==t}var r,o;if(n(t))t={input:t};else if(!i(t))return null;if(!n(t.input))return null;if(!e)return null;for(o in r={oneResult:!1,partial:!1,rejectTLD:!1,rfc6532:!1,simple:!1,startAt:"address-list",strict:!1})s(t[o])&&(t[o]=s(e[o])?r[o]:e[o]);return t}e.parseOneAddress=n,e.parseAddressList=i,e.parseFrom=s,e.parseSender=r,e.parseReplyTo=o,t.emailAddresses=e}(this),function(){function t(t){return!!t.exifdata}function e(t,e){e=e||t.match(/^data\:([^\;]+)\;base64,/im)[1]||"",t=t.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var n=atob(t),i=n.length,s=new ArrayBuffer(i),r=new Uint8Array(s),o=0;o<i;o++)r[o]=n.charCodeAt(o);return s}function i(t,e){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="blob",n.onload=function(){200!=this.status&&0!==this.status||e(this.response)},n.send()}function s(t,n){function s(e){var i=r(e),s=o(e);t.exifdata=i||{},t.iptcdata=s||{},n&&n.call(t)}if(t.src)if(/^data\:/i.test(t.src))s(e(t.src));else if(/^blob\:/i.test(t.src)){(l=new FileReader).onload=function(t){s(t.target.result)},i(t.src,(function(t){l.readAsArrayBuffer(t)}))}else{var a=new XMLHttpRequest;a.onload=function(){if(200!=this.status&&0!==this.status)throw"Could not load image";s(a.response),a=null},a.open("GET",t.src,!0),a.responseType="arraybuffer",a.send(null)}else if(window.FileReader&&(t instanceof window.Blob||t instanceof window.File)){var l;(l=new FileReader).onload=function(t){h&&console.log("Got file of length "+t.target.result.byteLength),s(t.target.result)},l.readAsArrayBuffer(t)}}function r(t){var e=new DataView(t);if(h&&console.log("Got file of length "+t.byteLength),255!=e.getUint8(0)||216!=e.getUint8(1))return h&&console.log("Not a valid JPEG"),!1;for(var n,i=2,s=t.byteLength;i<s;){if(255!=e.getUint8(i))return h&&console.log("Not a valid marker at offset "+i+", found: "+e.getUint8(i)),!1;if(n=e.getUint8(i+1),h&&console.log(n),225==n)return h&&console.log("Found 0xFFE1 marker"),p(e,i+4,e.getUint16(i+2)-2);i+=2+e.getUint16(i+2)}}function o(t){var e=new DataView(t);if(h&&console.log("Got file of length "+t.byteLength),255!=e.getUint8(0)||216!=e.getUint8(1))return h&&console.log("Not a valid JPEG"),!1;for(var n=2,i=t.byteLength,s=function(t,e){return 56===t.getUint8(e)&&66===t.getUint8(e+1)&&73===t.getUint8(e+2)&&77===t.getUint8(e+3)&&4===t.getUint8(e+4)&&4===t.getUint8(e+5)};n<i;){if(s(e,n)){var r=e.getUint8(n+7);return r%2!=0&&(r+=1),0===r&&(r=4),a(t,n+8+r,e.getUint16(n+6+r))}n++}}function a(t,e,n){for(var i,s,r,o,a=new DataView(t),l={},c=e;c<e+n;)28===a.getUint8(c)&&2===a.getUint8(c+1)&&(o=a.getUint8(c+2))in b&&((r=a.getInt16(c+3))+5,s=b[o],i=u(a,c+5,r),l.hasOwnProperty(s)?l[s]instanceof Array?l[s].push(i):l[s]=[l[s],i]:l[s]=i),c++;return l}function l(t,e,n,i,s){var r,o,a,l=t.getUint16(n,!s),u={};for(a=0;a<l;a++)r=n+12*a+2,!(o=i[t.getUint16(r,!s)])&&h&&console.log("Unknown tag: "+t.getUint16(r,!s)),u[o]=c(t,r,e,n,s);return u}function c(t,e,n,i,s){var r,o,a,l,c,p,h=t.getUint16(e+2,!s),d=t.getUint32(e+4,!s),f=t.getUint32(e+8,!s)+n;switch(h){case 1:case 7:if(1==d)return t.getUint8(e+8,!s);for(r=d>4?f:e+8,o=[],l=0;l<d;l++)o[l]=t.getUint8(r+l);return o;case 2:return u(t,r=d>4?f:e+8,d-1);case 3:if(1==d)return t.getUint16(e+8,!s);for(r=d>2?f:e+8,o=[],l=0;l<d;l++)o[l]=t.getUint16(r+2*l,!s);return o;case 4:if(1==d)return t.getUint32(e+8,!s);for(o=[],l=0;l<d;l++)o[l]=t.getUint32(f+4*l,!s);return o;case 5:if(1==d)return c=t.getUint32(f,!s),p=t.getUint32(f+4,!s),(a=new Number(c/p)).numerator=c,a.denominator=p,a;for(o=[],l=0;l<d;l++)c=t.getUint32(f+8*l,!s),p=t.getUint32(f+4+8*l,!s),o[l]=new Number(c/p),o[l].numerator=c,o[l].denominator=p;return o;case 9:if(1==d)return t.getInt32(e+8,!s);for(o=[],l=0;l<d;l++)o[l]=t.getInt32(f+4*l,!s);return o;case 10:if(1==d)return t.getInt32(f,!s)/t.getInt32(f+4,!s);for(o=[],l=0;l<d;l++)o[l]=t.getInt32(f+8*l,!s)/t.getInt32(f+4+8*l,!s);return o}}function u(t,e,i){var s="";for(n=e;n<e+i;n++)s+=String.fromCharCode(t.getUint8(n));return s}function p(t,e){if("Exif"!=u(t,e,4))return h&&console.log("Not valid EXIF data! "+u(t,e,4)),!1;var n,i,s,r,o,a=e+6;if(18761==t.getUint16(a))n=!1;else{if(19789!=t.getUint16(a))return h&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;n=!0}if(42!=t.getUint16(a+2,!n))return h&&console.log("Not valid TIFF data! (no 0x002A)"),!1;var c=t.getUint32(a+4,!n);if(c<8)return h&&console.log("Not valid TIFF data! (First offset less than 8)",t.getUint32(a+4,!n)),!1;if((i=l(t,a,a+c,g,n)).ExifIFDPointer)for(s in r=l(t,a,a+i.ExifIFDPointer,m,n)){switch(s){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":r[s]=y[s][r[s]];break;case"ExifVersion":case"FlashpixVersion":r[s]=String.fromCharCode(r[s][0],r[s][1],r[s][2],r[s][3]);break;case"ComponentsConfiguration":r[s]=y.Components[r[s][0]]+y.Components[r[s][1]]+y.Components[r[s][2]]+y.Components[r[s][3]]}i[s]=r[s]}if(i.GPSInfoIFDPointer)for(s in o=l(t,a,a+i.GPSInfoIFDPointer,v,n)){if("GPSVersionID"===s)o[s]=o[s][0]+"."+o[s][1]+"."+o[s][2]+"."+o[s][3];i[s]=o[s]}return i}var h=!1,d=this,f=function(t){return t instanceof f?t:this instanceof f?void(this.EXIFwrapped=t):new f(t)};"undefined"!=typeof exports?(void 0!==module&&module.exports&&(exports=module.exports=f),exports.EXIF=f):d.EXIF=f;var m=f.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},g=f.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},v=f.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},y=f.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}},b={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",105:"headline",116:"copyright",15:"category"};f.getData=function(e,n){return!((e instanceof Image||e instanceof HTMLImageElement)&&!e.complete)&&(t(e)?n&&n.call(e):s(e,n),!0)},f.getTag=function(e,n){if(t(e))return e.exifdata[n]},f.getAllTags=function(e){if(!t(e))return{};var n,i=e.exifdata,s={};for(n in i)i.hasOwnProperty(n)&&(s[n]=i[n]);return s},f.pretty=function(e){if(!t(e))return"";var n,i=e.exifdata,s="";for(n in i)i.hasOwnProperty(n)&&("object"==typeof i[n]?i[n]instanceof Number?s+=n+" : "+i[n]+" ["+i[n].numerator+"/"+i[n].denominator+"]\r\n":s+=n+" : ["+i[n].length+" values]\r\n":s+=n+" : "+i[n]+"\r\n");return s},f.readFromBinaryFile=function(t){return r(t)},"function"==typeof define&&define.amd&&define("exif-js",[],(function(){return f}))}.call(this),function(t){var e="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?t(exports):e&&(e.hljs=t({}),"function"==typeof define&&define.amd&&define([],(function(){return e.hljs})))}((function(t){function e(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n(t){return t.nodeName.toLowerCase()}function i(t,e){var n=t&&t.exec(e);return n&&0===n.index}function s(t){return S.test(t)}function r(t){var e,n,i,r,o=t.className+" ";if(o+=t.parentNode?t.parentNode.className:"",n=x.exec(o))return w(n[1])?n[1]:"no-highlight";for(e=0,i=(o=o.split(/\s+/)).length;i>e;e++)if(s(r=o[e])||w(r))return r}function o(t){var e,n={},i=Array.prototype.slice.call(arguments,1);for(e in t)n[e]=t[e];return i.forEach((function(t){for(e in t)n[e]=t[e]})),n}function a(t){var e=[];return function t(i,s){for(var r=i.firstChild;r;r=r.nextSibling)3===r.nodeType?s+=r.nodeValue.length:1===r.nodeType&&(e.push({event:"start",offset:s,node:r}),s=t(r,s),n(r).match(/br|hr|img|input/)||e.push({event:"stop",offset:s,node:r}));return s}(t,0),e}function l(t,i,s){function r(){return t.length&&i.length?t[0].offset!==i[0].offset?t[0].offset<i[0].offset?t:i:"start"===i[0].event?t:i:t.length?t:i}function o(t){function i(t){return" "+t.nodeName+'="'+e(t.value).replace('"',"&quot;")+'"'}u+="<"+n(t)+k.map.call(t.attributes,i).join("")+">"}function a(t){u+="</"+n(t)+">"}function l(t){("start"===t.event?o:a)(t.node)}for(var c=0,u="",p=[];t.length||i.length;){var h=r();if(u+=e(s.substring(c,h[0].offset)),c=h[0].offset,h===t){p.reverse().forEach(a);do{l(h.splice(0,1)[0]),h=r()}while(h===t&&h.length&&h[0].offset===c);p.reverse().forEach(o)}else"start"===h[0].event?p.push(h[0].node):p.pop(),l(h.splice(0,1)[0])}return u+e(s.substr(c))}function c(t){return t.v&&!t.cached_variants&&(t.cached_variants=t.v.map((function(e){return o(t,{v:null},e)}))),t.cached_variants||t.eW&&[o(t)]||[t]}function u(t){function e(t){return t&&t.source||t}function n(n,i){return new RegExp(e(n),"m"+(t.cI?"i":"")+(i?"g":""))}function i(s,r){if(!s.compiled){if(s.compiled=!0,s.k=s.k||s.bK,s.k){var o={},a=function(e,n){t.cI&&(n=n.toLowerCase()),n.split(" ").forEach((function(t){var n=t.split("|");o[n[0]]=[e,n[1]?Number(n[1]):1]}))};"string"==typeof s.k?a("keyword",s.k):A(s.k).forEach((function(t){a(t,s.k[t])})),s.k=o}s.lR=n(s.l||/\w+/,!0),r&&(s.bK&&(s.b="\\b("+s.bK.split(" ").join("|")+")\\b"),s.b||(s.b=/\B|\b/),s.bR=n(s.b),s.e||s.eW||(s.e=/\B|\b/),s.e&&(s.eR=n(s.e)),s.tE=e(s.e)||"",s.eW&&r.tE&&(s.tE+=(s.e?"|":"")+r.tE)),s.i&&(s.iR=n(s.i)),null==s.r&&(s.r=1),s.c||(s.c=[]),s.c=Array.prototype.concat.apply([],s.c.map((function(t){return c("self"===t?s:t)}))),s.c.forEach((function(t){i(t,s)})),s.starts&&i(s.starts,r);var l=s.c.map((function(t){return t.bK?"\\.?("+t.b+")\\.?":t.b})).concat([s.tE,s.i]).map(e).filter(Boolean);s.t=l.length?n(l.join("|"),!0):{exec:function(){return null}}}}i(t)}function p(t,n,s,r){function o(t,e){var n,s;for(n=0,s=e.c.length;s>n;n++)if(i(e.c[n].bR,t))return e.c[n]}function a(t,e){if(i(t.eR,e)){for(;t.endsParent&&t.parent;)t=t.parent;return t}return t.eW?a(t.parent,e):void 0}function l(t,e){return!s&&i(e.iR,t)}function c(t,e){var n=b.cI?e[0].toLowerCase():e[0];return t.k.hasOwnProperty(n)&&t.k[n]}function d(t,e,n,i){var s='<span class="'+(i?"":P.classPrefix);return(s+=t+'">')+e+(n?"":D)}function f(){var t,n,i,s;if(!k.k)return e(S);for(s="",n=0,k.lR.lastIndex=0,i=k.lR.exec(S);i;)s+=e(S.substring(n,i.index)),(t=c(k,i))?(x+=t[1],s+=d(t[0],e(i[0]))):s+=e(i[0]),n=k.lR.lastIndex,i=k.lR.exec(S);return s+e(S.substr(n))}function m(){var t="string"==typeof k.sL;if(t&&!C[k.sL])return e(S);var n=t?p(k.sL,S,!0,A[k.sL]):h(S,k.sL.length?k.sL:void 0);return k.r>0&&(x+=n.r),t&&(A[k.sL]=n.top),d(n.language,n.value,!1,!0)}function g(){T+=null!=k.sL?m():f(),S=""}function v(t){T+=t.cN?d(t.cN,"",!0):"",k=Object.create(t,{parent:{value:k}})}function y(t,e){if(S+=t,null==e)return g(),0;var n=o(e,k);if(n)return n.skip?S+=e:(n.eB&&(S+=e),g(),n.rB||n.eB||(S=e)),v(n,e),n.rB?0:e.length;var i=a(k,e);if(i){var s=k;s.skip?S+=e:(s.rE||s.eE||(S+=e),g(),s.eE&&(S=e));do{k.cN&&(T+=D),k.skip||(x+=k.r),k=k.parent}while(k!==i.parent);return i.starts&&v(i.starts,""),s.rE?0:e.length}if(l(e,k))throw new Error('Illegal lexeme "'+e+'" for mode "'+(k.cN||"<unnamed>")+'"');return S+=e,e.length||1}var b=w(t);if(!b)throw new Error('Unknown language: "'+t+'"');u(b);var _,k=r||b,A={},T="";for(_=k;_!==b;_=_.parent)_.cN&&(T=d(_.cN,"",!0)+T);var S="",x=0;try{for(var j,E,I=0;k.t.lastIndex=I,j=k.t.exec(n);)E=y(n.substring(I,j.index),j[0]),I=j.index+E;for(y(n.substr(I)),_=k;_.parent;_=_.parent)_.cN&&(T+=D);return{r:x,value:T,language:t,top:k}}catch(t){if(t.message&&-1!==t.message.indexOf("Illegal"))return{r:0,value:e(n)};throw t}}function h(t,n){n=n||P.languages||A(C);var i={r:0,value:e(t)},s=i;return n.filter(w).forEach((function(e){var n=p(e,t,!1);n.language=e,n.r>s.r&&(s=n),n.r>i.r&&(s=i,i=n)})),s.language&&(i.second_best=s),i}function d(t){return P.tabReplace||P.useBR?t.replace(j,(function(t,e){return P.useBR&&"\n"===t?"<br>":P.tabReplace?e.replace(/\t/g,P.tabReplace):""})):t}function f(t,e,n){var i=e?T[e]:n,s=[t.trim()];return t.match(/\bhljs\b/)||s.push("hljs"),-1===t.indexOf(i)&&s.push(i),s.join(" ").trim()}function m(t){var e,n,i,o,c,u=r(t);s(u)||(P.useBR?(e=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=t.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n"):e=t,c=e.textContent,i=u?p(u,c,!0):h(c),(n=a(e)).length&&((o=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=i.value,i.value=l(n,a(o),c)),i.value=d(i.value),t.innerHTML=i.value,t.className=f(t.className,u,i.language),t.result={language:i.language,re:i.r},i.second_best&&(t.second_best={language:i.second_best.language,re:i.second_best.r}))}function g(t){P=o(P,t)}function v(){if(!v.called){v.called=!0;var t=document.querySelectorAll("pre code");k.forEach.call(t,m)}}function y(){addEventListener("DOMContentLoaded",v,!1),addEventListener("load",v,!1)}function b(e,n){var i=C[e]=n(t);i.aliases&&i.aliases.forEach((function(t){T[t]=e}))}function _(){return A(C)}function w(t){return t=(t||"").toLowerCase(),C[t]||C[T[t]]}var k=[],A=Object.keys,C={},T={},S=/^(no-?highlight|plain|text)$/i,x=/\blang(?:uage)?-([\w-]+)\b/i,j=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,D="</span>",P={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};return t.highlight=p,t.highlightAuto=h,t.fixMarkup=d,t.highlightBlock=m,t.configure=g,t.initHighlighting=v,t.initHighlightingOnLoad=y,t.registerLanguage=b,t.listLanguages=_,t.getLanguage=w,t.inherit=o,t.IR="[a-zA-Z]\\w*",t.UIR="[a-zA-Z_]\\w*",t.NR="\\b\\d+(\\.\\d+)?",t.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",t.BNR="\\b(0b[01]+)",t.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",t.BE={b:"\\\\[\\s\\S]",r:0},t.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[t.BE]},t.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[t.BE]},t.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},t.C=function(e,n,i){var s=t.inherit({cN:"comment",b:e,e:n,c:[]},i||{});return s.c.push(t.PWM),s.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),s},t.CLCM=t.C("//","$"),t.CBCM=t.C("/\\*","\\*/"),t.HCM=t.C("#","$"),t.NM={cN:"number",b:t.NR,r:0},t.CNM={cN:"number",b:t.CNR,r:0},t.BNM={cN:"number",b:t.BNR,r:0},t.CSSNM={cN:"number",b:t.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},t.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[t.BE,{b:/\[/,e:/\]/,r:0,c:[t.BE]}]},t.TM={cN:"title",b:t.IR,r:0},t.UTM={cN:"title",b:t.UIR,r:0},t.METHOD_GUARD={b:"\\.\\s*"+t.UIR,r:0},t})),hljs.registerLanguage("ruby",(function(t){var e="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",n={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},i={cN:"doctag",b:"@[A-Za-z]+"},s={b:"#<",e:">"},r=[t.C("#","$",{c:[i]}),t.C("^\\=begin","^\\=end",{c:[i],r:10}),t.C("^__END__","\\n$")],o={cN:"subst",b:"#\\{",e:"}",k:n},a={cN:"string",c:[t.BE,o],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},l={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:n},c=[a,s,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[t.inherit(t.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+t.IR+"::)?"+t.IR}]}].concat(r)},{cN:"function",bK:"def",e:"$|;",c:[t.inherit(t.TM,{b:e}),l].concat(r)},{b:t.IR+"::"},{cN:"symbol",b:t.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[a,{b:e}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:n},{b:"("+t.RSR+"|unless)\\s*",k:"unless",c:[s,{cN:"regexp",c:[t.BE,o],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(r),r:0}].concat(r);o.c=c,l.c=c;var u=[{b:/^\s*=>/,starts:{e:"$",c:c}},{cN:"meta",b:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+>"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>"+")",starts:{e:"$",c:c}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:n,i:/\/\*/,c:r.concat(u).concat(c)}})),hljs.registerLanguage("bash",(function(t){var e={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},n={cN:"string",b:/"/,e:/"/,c:[t.BE,e,{cN:"variable",b:/\$\(/,e:/\)/,c:[t.BE]}]},i={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/\b-?[a-z\._]+\b/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[t.inherit(t.TM,{b:/\w[\w\d_]*/})],r:0},t.HCM,n,i,e]}})),hljs.registerLanguage("javascript",(function(t){var e="[A-Za-z$_][0-9A-Za-z$_]*",n={
keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},i={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:t.CNR}],r:0},s={cN:"subst",b:"\\$\\{",e:"\\}",k:n,c:[]},r={cN:"string",b:"`",e:"`",c:[t.BE,s]};s.c=[t.ASM,t.QSM,r,i,t.RM];var o=s.c.concat([t.CBCM,t.CLCM]);return{aliases:["js","jsx"],k:n,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},t.ASM,t.QSM,r,t.CLCM,t.CBCM,i,{b:/[{,]\s*/,r:0,c:[{b:e+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:e,r:0}]}]},{b:"("+t.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[t.CLCM,t.CBCM,t.RM,{cN:"function",b:"(\\(.*?\\)|"+e+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:e},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:n,c:o}]}]},{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[t.inherit(t.TM,{b:e}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:o}],i:/\[|%/},{b:/\$[(.]/},t.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},t.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}})),hljs.registerLanguage("css",(function(t){var e="[a-zA-Z-][a-zA-Z0-9_-]*",n={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[t.ASM,t.QSM]}]},t.CSSNM,t.QSM,t.ASM,t.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[t.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[t.ASM,t.QSM,t.CSSNM]}]},{cN:"selector-tag",b:e,r:0},{b:"{",e:"}",i:/\S/,c:[t.CBCM,n]}]}})),hljs.registerLanguage("xml",(function(t){var e={eW:!0,i:/</,r:0,c:[{cN:"attr",b:"[A-Za-z0-9\\._:-]+",r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},t.C("<!--","-->",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{name:"style"},c:[e],starts:{e:"</style>",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{name:"script"},c:[e],starts:{e:"</script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},e]}]}}));var module={},noop=function(){},console=window.console||{log:noop},supportsFileApi;FileUpload.prototype={on:function(t){this.eventHandlers=t}},UploadManager.prototype={initialize:function(){var t=this,e=t.dropContainer,n=t.inputField,i=t.cancelContainer,s=0,r=function(t){t.preventDefault(),t.stopPropagation(),s++,showDropZone(e)};onDragOver=function(t){t.dataTransfer.dropEffect="copy",t.preventDefault(),t.stopPropagation()},onDragLeave=function(t){t.preventDefault(),t.stopPropagation(),0==--s&&hideDropZone(e)},onDrop=function(n){s=0,n.preventDefault(),n.stopPropagation(),hideDropZone(e),t.processFiles(n.dataTransfer.files)},onDragEnd=function(t){s=0,t.preventDefault(),t.stopPropagation(),hideDropZone(e)},showDropZone=function(t){$(t).trigger("html5Upload.dropZone.show"),$(t).find(".article-content, .richtext").hasClass("is-dropTarget")||$(t).find(".article-content, .richtext").addClass("is-dropTarget")},hideDropZone=function(t){$(t).trigger("html5Upload.dropZone.hide"),$(t).find(".article-content, .richtext").hasClass("is-dropTarget")&&$(t).find(".article-content, .richtext").removeClass("is-dropTarget")},e&&(t.on(e,"dragleave",onDragLeave),t.on(e,"dragover",onDragOver),t.on(e,"dragenter",r),t.on(e,"dragend",onDragEnd),t.on(e,"drop",onDrop)),n&&t.on(n,"change",(function(){t.processFiles(this.files)})),i&&i.on("click",(function(){t.uploadCancel()}))},processFiles:function(t){console.log("Processing files: "+t.length);var e,n,i,s=this,r=t.length;for(i=0;i<r;i+=1){if(0===(e=t[i]).size){alert("Files with files size zero cannot be uploaded or multiple file uploads are not supported by your browser");break}n=new FileUpload(e),s.uploadFile(n)}},uploadCancel:function(){var t=this;_.each(t._xhrs,(function(t){t.abort()})),t._xhrs=[]},uploadFile:function(t){var e=this;if(e.onFileAdded(t),e.activeUploads===e.maxSimultaneousUploads)return console.log("Queue upload: "+t.fileName),void e.uploadsQueue.push(t);e.ajaxUpload(t)},ajaxUpload:function(t){var e,n,i,s,r=this,o=t.file,a=r.data,l=r.key||"file";if(console.log("Beging upload: "+t.fileName),r.activeUploads+=1,e=new window.XMLHttpRequest,r._xhrs.push(e),n=new window.FormData,i=o.name,e.open("POST",r.uploadUrl),App.Ajax&&App.Ajax.token&&e.setRequestHeader("X-CSRF-Token",App.Ajax.token()),e.upload.onloadstart=function(){console.log("Upload started: "+i),t.events.onStart()},e.upload.onprogress=function(e){e.lengthComputable&&t.events.onProgress(e.total,e.loaded)},e.onload=function(n){r.activeUploads-=1,200!==e.status?(console.log("Upload failed: "+i),t.events.onError(n.target.responseText)):(console.log("Upload completed: "+i),t.events.onCompleted(n.target.responseText)),r.uploadsQueue.length&&r.ajaxUpload(r.uploadsQueue.shift())},e.onabort=function(){console.log("Upload abort"),r.activeUploads-=1,t.events.onAborted(),r.uploadsQueue=[]},e.onerror=function(){console.log("Upload failed: ",t.fileName),t.events.onError("Upload failed: "+t.fileName)},a)for(s in a)a.hasOwnProperty(s)&&(console.log("Adding data: "+s+" = "+a[s]),n.append(s,a[s]));n.append(l,o),e.send(n)},on:function(t,e,n){t&&(t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n)}},module.fileApiSupported=function(){if("boolean"!=typeof supportsFileApi){var t=document.createElement("input");t.setAttribute("type","file"),supportsFileApi=!!t.files}return supportsFileApi},module.initialize=function(t){return new UploadManager(t)},window.html5Upload=module,module.exports=isMobile,module.exports.isMobile=isMobile,module.exports.default=isMobile;const mobileRE=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,notMobileRE=/CrOS/,tabletRE=/android|ipad|playbook|silk/i;!function(t,e,n){void 0!==module&&module.exports?module.exports=n():"function"==typeof define&&define.amd?define(n):e[t]=n()}("jquery-scrollto",this,(function(){var t,e;return t=window.jQuery||require("jquery"),t.propHooks.scrollTop=t.propHooks.scrollLeft={get:function(t,e){var n=null;return"HTML"!==t.tagName&&"BODY"!==t.tagName||("scrollLeft"===e?n=window.scrollX:"scrollTop"===e&&(n=window.scrollY)),null==n&&(n=t[e]),n}},t.Tween.propHooks.scrollTop=t.Tween.propHooks.scrollLeft={get:function(e){return t.propHooks.scrollTop.get(e.elem,e.prop)},set:function(t){"HTML"===t.elem.tagName||"BODY"===t.elem.tagName?(t.options.bodyScrollLeft=t.options.bodyScrollLeft||window.scrollX,t.options.bodyScrollTop=t.options.bodyScrollTop||window.scrollY,"scrollLeft"===t.prop?t.options.bodyScrollLeft=Math.round(t.now):"scrollTop"===t.prop&&(t.options.bodyScrollTop=Math.round(t.now)),window.scrollTo(t.options.bodyScrollLeft,t.options.bodyScrollTop)):t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},e={config:{duration:400,easing:"swing",callback:void 0,durationMode:"each",offsetTop:0,offsetLeft:0},configure:function(n){return t.extend(e.config,n||{}),this},scroll:function(n,i){var s,r,o,a,l,c,u,p,h,d,f,m,g,v,y;return r=(s=n.pop()).$container,o=s.$target,r.prop("tagName"),a=t("<span/>").css({position:"absolute",top:"0px",left:"0px"}),l=r.css("position"),r.css({position:"relative"}),a.appendTo(r),d=a.offset().top,f=o.offset().top-d-parseInt(i.offsetTop,10),m=a.offset().left,g=o.offset().left-m-parseInt(i.offsetLeft,10),c=r.prop("scrollTop"),u=r.prop("scrollLeft"),a.remove(),r.css({position:l}),v={},y=function(){return 0===n.length?"function"==typeof i.callback&&i.callback():e.scroll(n,i),!0},i.onlyIfOutside&&(p=c+r.height(),h=u+r.width(),c<f&&f<p&&(f=c),u<g&&g<h&&(g=u)),f!==c&&(v.scrollTop=f),g!==u&&(v.scrollLeft=g),r.prop("scrollHeight")===r.width()&&delete v.scrollTop,r.prop("scrollWidth")===r.width()&&delete v.scrollLeft,null!=v.scrollTop||null!=v.scrollLeft?r.animate(v,{duration:i.duration,easing:i.easing,complete:y}):y(),!0},fn:function(n){var i,s,r,o;i=[];var a=t(this);if(0===a.length)return this;for(s=t.extend({},e.config,n),o=(r=a.parent()).get(0);1===r.length&&o!==document.body&&o!==document;){var l,c;l="visible"!==r.css("overflow-y")&&o.scrollHeight!==o.clientHeight,c="visible"!==r.css("overflow-x")&&o.scrollWidth!==o.clientWidth,(l||c)&&(i.push({$container:r,$target:a}),a=r),o=(r=r.parent()).get(0)}return i.push({$container:t("html"),$target:a}),"all"===s.durationMode&&(s.duration/=i.length),e.scroll(i,s),this}},t.ScrollTo=t.ScrollTo||e,t.fn.ScrollTo=t.fn.ScrollTo||e.fn,e})),function(t){function e(e,s){this.element=e,this.$element=t(e),this.options=t.extend({},i,s),this._defaults=i,this._name=n,!this.options.placeholder&&this.$element.data("placeholder")&&(this.options.placeholder=this.$element.data("placeholder")),this.preventInput=!1,this.browserMagicKey=App.Browser.magicKey(),this.browserHotkeys=App.Browser.hotkeys(),this.init()}var n="ce",i={debug:!1,mode:"richtext",multiline:!0,imageWidth:"absolute",noImages:!1,allowKey:{8:!0,9:!0,16:!0,17:!0,18:!0,20:!0,37:!0,38:!0,39:!0,40:!0,91:!0,92:!0,224:!0},extraAllowKey:{65:!0,67:!0,86:!0,88:!0,90:!0},richTextFormatKey:{66:!0,73:!0,85:!0,83:!0}};e.prototype.init=function(){this.bindEvents(),this.$element.enableObjectResizingShim()},e.prototype.bindEvents=function(){this.$element.on("keydown",this.onKeydown.bind(this)),this.$element.on("paste",this.onPaste.bind(this)),this.$element.on("dragover",this.onDragover.bind(this)),this.$element.on("drop",this.onDrop.bind(this))},e.prototype.toggleBlock=function(e){sel=window.getSelection(),node=t(sel.anchorNode),node.is(e)||node.parent().is(e)||node.parent().parent().is(e)?document.execCommand("formatBlock",!1,"div"):document.execCommand("formatBlock",!1,e)},e.prototype.onKeydown=function(e){if(this.log("keydown",e.keyCode),this.preventInput)this.log("preventInput",this.preventInput);else{if(13===e.keyCode){if(!this.options.multiline)return void e.preventDefault();if(sel=window.getSelection(),sel&&(node=t(sel.anchorNode),node.closest("blockquote").length>0)){if(!node.is("div")&&node.parent().is("blockquote")&&node.text())return e.preventDefault(),document.execCommand("formatBlock",!1,"div"),void document.execCommand("insertParagraph");if(!e.shiftKey&&node&&(node.is("blockquote")||node.parent()&&node.parent().is("blockquote")||!node.text()))return e.preventDefault(),document.execCommand("insertParagraph"),void document.execCommand("outdent")}if(!e.shiftKey&&e.altKey&&!e.ctrlKey&&!e.metaKey)return e.preventDefault(),void this.paste("<br><br>")}var n=!1;if("cmd"==this.browserMagicKey?e.altKey||e.ctrlKey||!e.metaKey||(n=!0):e.altKey||!e.ctrlKey||e.metaKey||(n=!0),n&&this.options.richTextFormatKey[e.keyCode]){if(e.preventDefault(),66==e.keyCode)return document.execCommand("bold"),!0;if(73==e.keyCode)return document.execCommand("italic"),!0;if(85==e.keyCode)return document.execCommand("underline"),!0;if(83==e.keyCode)return document.execCommand("strikeThrough"),!0}var i=!1;if("ctrl+shift"==this.browserHotkeys?!e.altKey&&e.ctrlKey&&!e.metaKey&&e.shiftKey&&(i=!0):e.altKey&&e.ctrlKey&&!e.metaKey&&(i=!0),i&&(this.options.richTextFormatKey[e.keyCode]||49==e.keyCode||50==e.keyCode||51==e.keyCode||66==e.keyCode||70==e.keyCode||90==e.keyCode||70==e.keyCode||73==e.keyCode||75==e.keyCode||76==e.keyCode||85==e.keyCode||83==e.keyCode||88==e.keyCode||90==e.keyCode||89==e.keyCode)){if(e.preventDefault(),"textonly"===this.options.mode)return;if(49==e.keyCode&&this.toggleBlock("h1"),50==e.keyCode&&this.toggleBlock("h2"),51==e.keyCode&&this.toggleBlock("h3"),66==e.keyCode&&document.execCommand("bold"),70==e.keyCode&&document.execCommand("removeFormat"),73==e.keyCode&&document.execCommand("italic"),75==e.keyCode&&document.execCommand("insertOrderedList"),76==e.keyCode&&document.execCommand("insertUnorderedList"),85==e.keyCode&&document.execCommand("underline"),83==e.keyCode&&document.execCommand("strikeThrough"),88==e.keyCode&&document.execCommand("unlink"),89==e.keyCode){var s=App.Utils.htmlRemoveRichtext(this.$element.html());this.$element.html(s)}return 90==e.keyCode&&document.execCommand("insertHorizontalRule"),this.log("content editable richtext key",e.keyCode),!0}this.allowKey(e)||this.maxLengthOk(1)||e.preventDefault()}},e.prototype.getHtmlFromClipboard=function(t){try{return t.getData("text/html")}catch(t){return void console.log("Sorry, can't get html of clipboard because browser is not supporting it.")}},e.prototype.getTextFromClipboard=function(t){var e;try{return(e=t.getData("text/plain"))&&0!==e.length||(e=t.getData("text")),e}catch(t){return void console.log("Sorry, can't get text of clipboard because browser is not supporting it.")}},e.prototype.getClipboardData=function(t){var e;if(t.clipboardData)e=t.clipboardData;else if(window.clipboardData)e=window.clipboardData;else{if(!t.originalEvent.clipboardData)throw"No clipboardData support";e=t.originalEvent.clipboardData}return e},e.prototype.getClipboardDataImage=function(e){if(e.items&&e.items[0])return t.grep(e.items,(function(t){return"file"==t.kind&&("image/png"==t.type||"image/jpeg"==t.type)}))[0]},e.prototype.onPaste=function(e){var n,i,s,r,o;if(e.preventDefault(),this.log("paste"),n=this.getClipboardData(e),r=this.getHtmlFromClipboard(n),!App.Utils.clipboardHtmlIsWithText(r)&&(i=this.getClipboardDataImage(n))){if(this.options.noImages)return;this.log("paste image",i);var a=i.getAsFile(),l=new FileReader;return l.onload=t.proxy((function(e){var n=e.target.result,i=document.createElement("img");i.src=n,maxWidth=1e3,this.$element.width()>1e3&&(maxWidth=this.$element.width()),scaleFactor=2,insert=t.proxy((function(t,e){this.log("image inserted"),n=t,i="absolute"==this.options.imageWidth?'<img tabindex="0" style="width: '+e+'px; max-width: 100%;" src="'+n+'">':'<img tabindex="0" style="width: 100%; max-width: '+e+'px;" src="'+n+'">',this.paste(i)}),this),App.ImageService.resize(i.src,maxWidth,"auto",scaleFactor,"image/jpeg","auto",insert)}),this),l.readAsDataURL(a),!0}return r&&(o=App.Utils.clipboardHtmlInsertPreperation(r,this.options))?(this.log("insert html from clipboard",o),this.paste(o),App.Utils.htmlImage2DataUrlAsyncInline(this.$element),!0):!!(s=this.getTextFromClipboard(n))&&(o=App.Utils.text2html(s),this.maxLengthOk(o.length)?(o=App.Utils.removeEmptyLines(o),this.log("insert text from clipboard",o),this.paste(o),!0):void 0)},e.prototype.onDragover=function(t){t.stopPropagation(),t.preventDefault(),this.log("dragover")},e.prototype.onDrop=function(t){var e;if(t.stopPropagation(),t.preventDefault(),this.log("drop"),window.dataTransfer)e=window.dataTransfer;else{if(!t.originalEvent.dataTransfer)throw"No clipboardData support";e=t.originalEvent.dataTransfer}x=t.clientX,y=t.clientY;var n=e.files[0];if(n&&n.type.match("image.*")){var i=new FileReader;i.onload=function(t){var e=t.target.result,n=document.createElement("img");n.src=e,maxWidth=this.$element.width()||500,scaleFactor=2,insert=function(t,i){if(this.log("image inserted"),e=t,n="absolute"==this.options.imageWidth?'<img tabindex="0" style="width: '+i+'px; max-width: 100%;" src="'+e+'">':'<img tabindex="0" style="width: 100%; max-width: '+i+'px;" src="'+e+'">',document.caretPositionFromPoint){var s=document.caretPositionFromPoint(x,y);range=document.createRange(),range.setStart(s.offsetNode,s.offset),range.collapse(),range.insertNode(n)}else document.caretRangeFromPoint?(range=document.caretRangeFromPoint(x,y),range.insertNode(n)):console.log("could not find carat")},App.ImageService.resize(n.src,maxWidth,"auto",scaleFactor,"image/jpeg","auto",insert)},i.readAsDataURL(n)}},e.prototype.allowKey=function(t){return!!this.options.allowKey[t.keyCode]||!(!t.ctrlKey&&!t.metaKey||!this.options.extraAllowKey[t.keyCode])},e.prototype.maxLengthOk=function(e){if(!this.options.maxlength)return!0;var n=this.$element.text().length;if(e&&(n+=e),this.log("maxLengthOk",n,this.options.maxlength),n>this.options.maxlength){this.log("maxLengthOk, text too long");var i=this.$element.parent().parent();return i.hasClass("controls")?(i.addClass("has-error"),setTimeout(t.proxy((function(){i.removeClass("has-error")}),this),1e3),!1):(this.$element.addClass("invalid"),setTimeout(t.proxy((function(){this.$element.removeClass("invalid")}),this),1e3),!1)}return!0},e.prototype.value=function(){return"textonly"===this.options.mode?this.options.multiline?(text_plain=this.$element.text().trim(),text_plain&&""!=text_plain?this.$element.html():text_plain):this.$element.text().trim():(text_plain=this.$element.text().trim(),text_plain&&""!=text_plain||this.$element.find("img").get(0)?this.$element.html().trim():text_plain)},e.prototype.log=function(){App&&App.Log&&App.Log.debug("contenteditable",arguments),this.options.debug&&console.log(this._name,arguments)},e.prototype.paste=function(t){var e=!!window.MSInputMethodContext&&!!document.documentMode;if(document.selection&&document.selection.createRange)(n=document.selection.createRange()).pasteHTML&&n.pasteHTML(t);else if(e&&document.getSelection){var n=document.getSelection().getRangeAt(0),i=document.createElement("div");n.surroundContents(i),i.innerHTML=t}else document.execCommand("insertHTML",!1,t)},t.fn[n]=function(i){return this.each((function(){t.data(this,"plugin_"+n)||t.data(this,"plugin_"+n,new e(this,i))}))},t.fn.ceg=function(){var e=t.data(this[0],"plugin_"+n);if(e)return e.value()}}(jQuery),function(t){function e(e,n){this.element=e,this.$element=t(e),this.options=t.extend({},s,n),this._defaults=s,this._name=i,document.execCommand("enableObjectResizing",!1,!1),this.bindEvents()}function n(e){this.$element=e,this.isResizing=!1,this.$element.data("objectResizingEditor",this),this.$element.addClass("objectResizingEditorActive"),this.$element.wrap('<div class="enableObjectResizingShim" contenteditable="false"></div>');for(var n=0;n<4;n++)this.$element.before('<div class="enableObjectResizingShim-handle"></div>');t(document).one("click.objectResizingEditor",this.destroy.bind(this)),t(document).one("keydown.objectResizingEditor",this.onKeydown.bind(this)),this.$element.on("click.objectResizingEditor",this.stopPropagation.bind(this)),this.$element.parent().find(".enableObjectResizingShim-handle").on("mousedown",this.startResize.bind(this))}var i="enableObjectResizingShim",s={debug:!1};e.prototype.bindEvents=function(){this.$element.on("click","img",this.createEditor.bind(this)),this.$element.on("click",this.destroyEditors.bind(this))},e.prototype.createEditor=function(e){e.stopPropagation(),this.destroyEditors();var i=t(e.currentTarget);i.hasClass("objectResizingEditorActive")||new n(i)},e.prototype.destroyEditors=function(){this.$element.find("img.objectResizingEditorActive").each((function(e,n){$img=t(n),editor=$img.data("objectResizingEditor"),editor?editor.destroy():($img.removeClass("objectResizingEditorActive"),$img.siblings().remove(),$img.unwrap())}))},n.prototype.onKeydown=function(t){var e=this.$element.closest("[contenteditable=true]"),n=this.$element.parent().parent().prev();if(this.destroy(),8===t.keyCode)this.$element.remove(),t.preventDefault(),n[0]&&(range=document.createRange(),range.selectNode(n[0]),range.setStart(range.endContainer,range.endOffset),document.getSelection().removeAllRanges(),document.getSelection().addRange(range)),e.trigger("focus");else t.stopPropagation()},n.prototype.stopPropagation=function(t){t.stopPropagation()},n.prototype.destroy=function(){this.isResizing||(this.$element.off("click.objectResizingEditor"),t(document).off("click.objectResizingEditor"),t(document).off("keydown.objectResizingEditor"),this.$element.removeClass("objectResizingEditorActive"),this.$element.siblings().remove(),this.$element.unwrap())},n.prototype.startResize=function(e){e.preventDefault();var n=t(e.currentTarget),i=this.$element.closest('[contenteditable="true"]').width()||"";this.resizeCorner=n.index(),this.resizeDir=0==this.resizeCorner||3==this.resizeCorner?-1:1,this.startX=e.pageX,this.startWidth=this.$element.width(),this.$clone=this.$element.clone().css({width:"",height:"","max-width":i}).addClass("enableObjectResizingShim-clone enableObjectResizingShim-clone--"+this.resizeCorner),this.$element.after(this.$clone),this.isResizing=!0,t(document).on("mousemove.enableObjectResizing",this.resize.bind(this)),t(document).on("mouseup.enableObjectResizing",this.resizeEnd.bind(this))},n.prototype.resize=function(t){t.preventDefault(),t.stopPropagation();var e=t.pageX-this.startX;this.$clone.css("width",this.startWidth+this.resizeDir*e)},n.prototype.resizeEnd=function(){var e=this.$element.closest('[contenteditable="true"]').width(),n=this.$clone.width(),i=this.$clone.height(),s=this.$clone.get(0).naturalWidth;this.$clone.get(0).naturalHeight;e&&e<n+10&&(i="",n="",s&&(n=s/2)),t(document).off("mousemove.enableObjectResizing"),t(document).off("mouseup.enableObjectResizing"),this.$element.css({width:n,height:i,"max-width":"100%"}),this.$clone.remove(),setTimeout(function(){this.isResizing=!1}.bind(this))},t.fn[i]=function(n){return this.each((function(){t.data(this,"plugin_"+i)||t.data(this,"plugin_"+i,new e(this,n))}))}}(jQuery,window);var qq=qq||{},qq=function(t){"use strict";return{hide:function(){return t.style.display="none",this},attach:function(e,n){return t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,n),function(){qq(t).detach(e,n)}},detach:function(e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.attachEvent&&t.detachEvent("on"+e,n),this},contains:function(e){return t==e||(t.contains?t.contains(e):!!(8&e.compareDocumentPosition(t)))},insertBefore:function(e){return e.parentNode.insertBefore(t,e),this},remove:function(){return t.parentNode.removeChild(t),this},css:function(e){return null!=e.opacity&&"string"!=typeof t.style.opacity&&void 0!==t.filters&&(e.filter="alpha(opacity="+Math.round(100*e.opacity)+")"),qq.extend(t.style,e),this},hasClass:function(e){return new RegExp("(^| )"+e+"( |$)").test(t.className)},addClass:function(e){return qq(t).hasClass(e)||(t.className+=" "+e),this},removeClass:function(e){var n=new RegExp("(^| )"+e+"( |$)");return t.className=t.className.replace(n," ").replace(/^\s+|\s+$/g,""),this},getByClass:function(e){if(t.querySelectorAll)return t.querySelectorAll("."+e);for(var n=[],i=t.getElementsByTagName("*"),s=i.length,r=0;r<s;r++)qq(i[r]).hasClass(e)&&n.push(i[r]);return n},children:function(){for(var e=[],n=t.firstChild;n;)1==n.nodeType&&e.push(n),n=n.nextSibling;return e},setText:function(e){return t.innerText=e,t.textContent=e,this},clearText:function(){return qq(t).setText("")}}};qq.log=function(t,e){App&&App.Log&&App.Log.debug(this._name,arguments),window.console&&(e&&"info"!==e?window.console[e]?window.console[e](t):window.console.log("<"+e+"> "+t):window.console.log(t))},qq.isObject=function(t){"use strict";return null!==t&&t&&"object"==typeof t&&t.constructor===Object},qq.extend=function(t,e,n){"use strict";var i;for(i in e)e.hasOwnProperty(i)&&(n&&qq.isObject(e[i])?(void 0===t[i]&&(t[i]={}),qq.extend(t[i],e[i],!0)):t[i]=e[i])},qq.indexOf=function(t,e,n){if(t.indexOf)return t.indexOf(e,n);n=n||0;var i=t.length;for(n<0&&(n+=i);n<i;n++)if(n in t&&t[n]===e)return n;return-1},qq.getUniqueId=function(){var t=0;return function(){return t++}}(),qq.ie=function(){return-1!=navigator.userAgent.indexOf("MSIE")},qq.ie10=function(){return-1!=navigator.userAgent.indexOf("MSIE 10")},qq.safari=function(){return null!=navigator.vendor&&-1!=navigator.vendor.indexOf("Apple")},qq.chrome=function(){return null!=navigator.vendor&&-1!=navigator.vendor.indexOf("Google")},qq.firefox=function(){return-1!=navigator.userAgent.indexOf("Mozilla")&&null!=navigator.vendor&&""==navigator.vendor},qq.windows=function(){return"Win32"==navigator.platform},qq.preventDefault=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},qq.toElement=function(){var t=document.createElement("div");return function(e){t.innerHTML=e;var n=t.firstChild;return t.removeChild(n),n}}(),qq.obj2url=function(t,e,n){var i=[],s="&",r=function(t,n){var s=e?/\[\]$/.test(e)?e:e+"["+n+"]":n;"undefined"!=s&&"undefined"!=n&&i.push("object"==typeof t?qq.obj2url(t,s,!0):"[object Function]"===Object.prototype.toString.call(t)?encodeURIComponent(s)+"="+encodeURIComponent(t()):encodeURIComponent(s)+"="+encodeURIComponent(t))};if(!n&&e)s=/\?/.test(e)?/\?$/.test(e)?"":"&":"?",i.push(e),i.push(qq.obj2url(t));else if("[object Array]"===Object.prototype.toString.call(t)&&void 0!==t)for(var o=0,a=t.length;o<a;++o)r(t[o],o);else if(null!=t&&"object"==typeof t)for(var o in t)r(t[o],o);else i.push(encodeURIComponent(e)+"="+encodeURIComponent(t));return e?i.join(s):i.join(s).replace(/^&/,"").replace(/%20/g,"+")},qq.DisposeSupport={_disposers:[],dispose:function(){for(var t;t=this._disposers.shift();)t()},addDisposer:function(t){this._disposers.push(t)},_attach:function(){this.addDisposer(qq(arguments[0]).attach.apply(this,Array.prototype.slice.call(arguments,1)))}},qq.UploadButton=function(t){this._options={element:null,multiple:!1,acceptFiles:null,name:"file",onChange:function(){},hoverClass:"qq-upload-button-hover",focusClass:"qq-upload-button-focus"},qq.extend(this._options,t),qq.extend(this,qq.DisposeSupport),this._element=this._options.element,qq(this._element).css({position:"relative",overflow:"hidden",direction:"ltr"}),this._input=this._createInput()},qq.UploadButton.prototype={getInput:function(){return this._input},reset:function(){this._input.parentNode&&qq(this._input).remove(),qq(this._element).removeClass(this._options.focusClass),this._input=this._createInput()},_createInput:function(){var t=document.createElement("input");this._options.multiple&&t.setAttribute("multiple","multiple"),this._options.acceptFiles&&t.setAttribute("accept",this._options.acceptFiles),t.setAttribute("type","file"),t.setAttribute("name",this._options.name),qq(t).css({position:"absolute",right:0,top:0,fontFamily:"Arial",fontSize:"118px",margin:0,padding:0,cursor:"pointer",opacity:0}),this._element.appendChild(t);var e=this;return this._attach(t,"change",(function(){e._options.onChange(t)})),this._attach(t,"mouseover",(function(){qq(e._element).addClass(e._options.hoverClass)})),this._attach(t,"mouseout",(function(){qq(e._element).removeClass(e._options.hoverClass)})),this._attach(t,"focus",(function(){qq(e._element).addClass(e._options.focusClass)})),this._attach(t,"blur",(function(){qq(e._element).removeClass(e._options.focusClass)})),window.attachEvent&&t.setAttribute("tabIndex","-1"),t}},qq.FineUploaderBasic=function(t){this._options={debug:!1,button:null,multiple:!0,maxConnections:3,disableCancelForFormUploads:!1,autoUpload:!0,request:{endpoint:"/server/upload",params:{},customHeaders:{},forceMultipart:!1,inputName:"qqfile"},validation:{allowedExtensions:[],sizeLimit:0,minSizeLimit:0,stopOnFirstInvalidFile:!0},callbacks:{onSubmit:function(){},onComplete:function(){},onCancel:function(){},onUpload:function(){},onProgress:function(){},onError:function(){},onAutoRetry:function(){},onManualRetry:function(){},onValidate:function(){}},messages:{typeError:"{file} has an invalid extension. Valid extension(s): {extensions}.",sizeError:"{file} is too large, maximum file size is {sizeLimit}.",minSizeError:"{file} is too small, minimum file size is {minSizeLimit}.",emptyError:"{file} is empty, please select files again without it.",noFilesError:"No files to upload.",onLeave:"The files are being uploaded, if you leave now the upload will be cancelled."},retry:{enableAuto:!1,maxAutoAttempts:3,autoAttemptDelay:5,preventRetryResponseProperty:"preventRetry"}},qq.extend(this._options,t,!0),this._wrapCallbacks(),qq.extend(this,qq.DisposeSupport),this._filesInProgress=0,this._storedFileIds=[],this._autoRetries=[],this._retryTimeouts=[],this._preventRetries=[],this._handler=this._createUploadHandler(),this._options.button&&(this._button=this._createUploadButton(this._options.button)),this._preventLeaveInProgress()},qq.FineUploaderBasic.prototype={log:function(t,e){!this._options.debug||e&&"info"!==e?e&&"info"!==e&&qq.log("[FineUploader] "+t,e):qq.log("[FineUploader] "+t)},setParams:function(t){this._options.request.params=t},getInProgress:function(){return this._filesInProgress},uploadStoredFiles:function(){"use strict";for(;this._storedFileIds.length;)this._filesInProgress++,this._handler.upload(this._storedFileIds.shift(),this._options.request.params)},clearStoredFiles:function(){this._storedFileIds=[]},retry:function(t){return!!this._onBeforeManualRetry(t)&&(this._handler.retry(t),!0)},cancel:function(t){this._handler.cancel(t)},reset:function(){this.log("Resetting uploader..."),this._handler.reset(),this._filesInProgress=0,this._storedFileIds=[],this._autoRetries=[],this._retryTimeouts=[],this._preventRetries=[],this._button.reset()},_createUploadButton:function(t){var e=this,n=new qq.UploadButton({element:t,multiple:this._options.multiple&&qq.UploadHandlerXhr.isSupported(),acceptFiles:this._options.validation.acceptFiles,onChange:function(t){e._onInputChange(t)}});return this.addDisposer((function(){n.dispose()})),n},_createUploadHandler:function(){var t,e=this;return t=qq.UploadHandlerXhr.isSupported()?"UploadHandlerXhr":"UploadHandlerForm",new qq[t]({debug:this._options.debug,endpoint:this._options.request.endpoint,forceMultipart:this._options.request.forceMultipart,maxConnections:this._options.maxConnections,customHeaders:this._options.request.customHeaders,inputName:this._options.request.inputName,demoMode:this._options.demoMode,log:this.log,onProgress:function(t,n,i,s){e._onProgress(t,n,i,s),e._options.callbacks.onProgress(t,n,i,s)},onComplete:function(t,n,i,s){e._onComplete(t,n,i,s),e._options.callbacks.onComplete(t,n,i)},onCancel:function(t,n){e._onCancel(t,n),e._options.callbacks.onCancel(t,n)},onUpload:function(t,n,i){e._onUpload(t,n,i),e._options.callbacks.onUpload(t,n,i)},onAutoRetry:function(t,n,i,s){return e._preventRetries[t]=i[e._options.retry.preventRetryResponseProperty],!!e._shouldAutoRetry(t,n,i)&&(e._maybeParseAndSendUploadError(t,n,i,s),e._options.callbacks.onAutoRetry(t,n,e._autoRetries[t]+1),e._onBeforeAutoRetry(t,n),e._retryTimeouts[t]=setTimeout((function(){e._onAutoRetry(t,n,i)}),1e3*e._options.retry.autoAttemptDelay),!0)}})},_preventLeaveInProgress:function(){var t=this;this._attach(window,"beforeunload",(function(e){if(t._filesInProgress)return(e=e||window.event).returnValue=t._options.messages.onLeave,t._options.messages.onLeave}))},_onSubmit:function(){this._options.autoUpload&&this._filesInProgress++},_onProgress:function(){},_onComplete:function(t,e,n,i){this._filesInProgress--,this._maybeParseAndSendUploadError(t,e,n,i)},_onCancel:function(t){clearTimeout(this._retryTimeouts[t]);var e=qq.indexOf(this._storedFileIds,t);this._options.autoUpload||e<0?this._filesInProgress--:this._options.autoUpload||this._storedFileIds.splice(e,1)},_onUpload:function(){},_onInputChange:function(t){this._handler instanceof qq.UploadHandlerXhr?this._uploadFileList(t.files):this._validateFile(t)&&this._uploadFile(t),this._button.reset()},_onBeforeAutoRetry:function(t,e){this.log("Waiting "+this._options.retry.autoAttemptDelay+" seconds before retrying "+e+"...")},_onAutoRetry:function(t,e){this.log("Retrying "+e+"..."),
this._autoRetries[t]++,this._handler.retry(t)},_shouldAutoRetry:function(t){return!(this._preventRetries[t]||!this._options.retry.enableAuto)&&(void 0===this._autoRetries[t]&&(this._autoRetries[t]=0),this._autoRetries[t]<this._options.retry.maxAutoAttempts)},_onBeforeManualRetry:function(t){if(this._preventRetries[t])return this.log("Retries are forbidden for id "+t,"warn"),!1;if(this._handler.isValid(t)){var e=this._handler.getName(t);return!1!==this._options.callbacks.onManualRetry(t,e)&&(this.log("Retrying upload for '"+e+"' (id: "+t+")..."),this._filesInProgress++,!0)}return this.log("'"+t+"' is not a valid file ID","error"),!1},_maybeParseAndSendUploadError:function(t,e,n,i){if(!n.success)if(i&&200!==i.status&&!n.error)this._options.callbacks.onError(t,e,"XHR returned response code "+i.status);else{var s=n.error?n.error:"Upload failure reason unknown";this._options.callbacks.onError(t,e,s)}},_uploadFileList:function(t){var e,n,i;if((e=this._getValidationDescriptors(t)).length>1&&(i=!1===this._options.callbacks.onValidate(e)),!i)if(t.length>0){for(n=0;n<t.length;n++)if(this._validateFile(t[n]))this._uploadFile(t[n]);else if(this._options.validation.stopOnFirstInvalidFile)return}else this._error("noFilesError","")},_uploadFile:function(t){var e=this._handler.add(t),n=this._handler.getName(e);!1!==this._options.callbacks.onSubmit(e,n)&&(this._onSubmit(e,n),this._options.autoUpload?this._handler.upload(e,this._options.request.params):this._storeFileForLater(e))},_storeFileForLater:function(t){this._storedFileIds.push(t)},_validateFile:function(t){var e,n,i;return n=(e=this._getValidationDescriptor(t)).name,i=e.size,!1!==this._options.callbacks.onValidate([e])&&(this._isAllowedExtension(n)?0===i?(this._error("emptyError",n),!1):i&&this._options.validation.sizeLimit&&i>this._options.validation.sizeLimit?(this._error("sizeError",n),!1):!(i&&i<this._options.validation.minSizeLimit)||(this._error("minSizeError",n),!1):(this._error("typeError",n),!1))},_error:function(t,e){function n(t,e){i=i.replace(t,e)}var i=this._options.messages[t],s=this._options.validation.allowedExtensions.join(", ");return n("{file}",this._formatFileName(e)),n("{extensions}",s),n("{sizeLimit}",this._formatSize(this._options.validation.sizeLimit)),n("{minSizeLimit}",this._formatSize(this._options.validation.minSizeLimit)),this._options.callbacks.onError(null,e,i),i},_formatFileName:function(t){return t.length>33&&(t=t.slice(0,19)+"..."+t.slice(-13)),t},_isAllowedExtension:function(t){var e=-1!==t.indexOf(".")?t.replace(/.*[.]/,"").toLowerCase():"",n=this._options.validation.allowedExtensions;if(!n.length)return!0;for(var i=0;i<n.length;i++)if(n[i].toLowerCase()==e)return!0;return!1},_formatSize:function(t){var e=-1;do{t/=1024,e++}while(t>99);return Math.max(t,.1).toFixed(1)+["kB","MB","GB","TB","PB","EB"][e]},_wrapCallbacks:function(){var t,e;for(var n in t=this,e=function(e,n,i){try{return n.apply(t,i)}catch(n){t.log("Caught exception in '"+e+"' callback - "+n,"error")}},this._options.callbacks)!function(){var i=t._options.callbacks[n];t._options.callbacks[n]=function(){return e(n,i,arguments)}}()},_parseFileName:function(t){return t.value?t.value.replace(/.*(\/|\\)/,""):null!==t.fileName&&void 0!==t.fileName?t.fileName:t.name},_parseFileSize:function(t){var e;return t.value||(e=null!==t.fileSize&&void 0!==t.fileSize?t.fileSize:t.size),e},_getValidationDescriptor:function(t){var e,n,i;return i={},e=this._parseFileName(t),n=this._parseFileSize(t),i.name=e,n&&(i.size=n),i},_getValidationDescriptors:function(t){var e,n;for(n=[],e=0;e<t.length;e++)n.push(t[e]);return n}},qq.FineUploader=function(t){qq.FineUploaderBasic.apply(this,arguments),qq.extend(this._options,{element:null,listElement:null,dragAndDrop:{extraDropzones:[],hideDropzones:!0,disableDefaultDropzone:!1},text:{uploadButton:"Upload a file",cancelButton:"Cancel",retryButton:"Retry",failUpload:"Upload failed",dragZone:"Drop files here to upload",formatProgress:"{percent}% of {total_size}",waitingForResponse:"Processing..."},template:'<div class="qq-uploader">'+(this._options.dragAndDrop&&this._options.dragAndDrop.disableDefaultDropzone?"":'<div class="qq-upload-drop-area"><span>{dragZoneText}</span></div>')+(this._options.button?"":'<div class="qq-upload-button"><div>{uploadButtonText}</div></div>')+(this._options.listElement?"":'<ul class="qq-upload-list"></ul>')+"</div>",fileTemplate:'<li><div class="qq-progress-bar"></div><span class="qq-upload-spinner"></span><span class="qq-upload-finished"></span><span class="qq-upload-file"></span><span class="qq-upload-size"></span><a class="qq-upload-cancel" href="#">{cancelButtonText}</a><a class="qq-upload-retry" href="#">{retryButtonText}</a><span class="qq-upload-status-text">{statusText}</span></li>',classes:{button:"qq-upload-button",drop:"qq-upload-drop-area",dropActive:"qq-upload-drop-area-active",dropDisabled:"qq-upload-drop-area-disabled",list:"qq-upload-list",progressBar:"qq-progress-bar",file:"qq-upload-file",spinner:"qq-upload-spinner",finished:"qq-upload-finished",retrying:"qq-upload-retrying",retryable:"qq-upload-retryable",size:"qq-upload-size",cancel:"qq-upload-cancel",retry:"qq-upload-retry",statusText:"qq-upload-status-text",success:"qq-upload-success",fail:"qq-upload-fail",successIcon:null,failIcon:null},failedUploadTextDisplay:{mode:"default",maxChars:50,responseProperty:"error",enableTooltip:!0},messages:{tooManyFilesError:"You may only drop one file"},retry:{showAutoRetryNote:!0,autoRetryNote:"Retrying {retryNum}/{maxAuto}...",showButton:!1},showMessage:function(t){alert(t)}},!0),qq.extend(this._options,t,!0),this._wrapCallbacks(),this._options.template=this._options.template.replace(/\{dragZoneText\}/g,this._options.text.dragZone),this._options.template=this._options.template.replace(/\{uploadButtonText\}/g,this._options.text.uploadButton),this._options.fileTemplate=this._options.fileTemplate.replace(/\{cancelButtonText\}/g,this._options.text.cancelButton),this._options.fileTemplate=this._options.fileTemplate.replace(/\{retryButtonText\}/g,this._options.text.retryButton),this._options.fileTemplate=this._options.fileTemplate.replace(/\{statusText\}/g,""),this._element=this._options.element,this._element.innerHTML=this._options.template,this._listElement=this._options.listElement||this._find(this._element,"list"),this._classes=this._options.classes,this._button||(this._button=this._createUploadButton(this._find(this._element,"button"))),this._bindCancelAndRetryEvents(),this._setupDragDrop()},qq.extend(qq.FineUploader.prototype,qq.FineUploaderBasic.prototype),qq.extend(qq.FineUploader.prototype,{clearStoredFiles:function(){qq.FineUploaderBasic.prototype.clearStoredFiles.apply(this,arguments),this._listElement.innerHTML=""},addExtraDropzone:function(t){this._setupExtraDropzone(t)},removeExtraDropzone:function(t){var e=this._options.dragAndDrop.extraDropzones;for(var n in e)if(e[n]===t)return this._options.dragAndDrop.extraDropzones.splice(n,1)},getItemByFileId:function(t){for(var e=this._listElement.firstChild;e;){if(e.qqFileId==t)return e;e=e.nextSibling}},reset:function(){qq.FineUploaderBasic.prototype.reset.apply(this,arguments),this._element.innerHTML=this._options.template,this._listElement=this._options.listElement||this._find(this._element,"list"),this._options.button||(this._button=this._createUploadButton(this._find(this._element,"button"))),this._bindCancelAndRetryEvents(),this._setupDragDrop()},_leaving_document_out:function(t){return(qq.chrome()||qq.safari()&&qq.windows())&&0==t.clientX&&0==t.clientY||qq.firefox()&&!t.relatedTarget},_storeFileForLater:function(t){qq.FineUploaderBasic.prototype._storeFileForLater.apply(this,arguments);var e=this.getItemByFileId(t);qq(this._find(e,"spinner")).hide()},_find:function(t,e){var n=qq(t).getByClass(this._options.classes[e])[0];if(!n)throw new Error("element not found "+e);return n},_setupExtraDropzone:function(t){this._options.dragAndDrop.extraDropzones.push(t),this._setupDropzone(t)},_setupDropzone:function(t){var e=this,n=new qq.UploadDropZone({element:t,onEnter:function(n){qq(t).addClass(e._classes.dropActive),n.stopPropagation()},onLeave:function(){},onLeaveNotDescendants:function(){qq(t).removeClass(e._classes.dropActive)},onDrop:function(n){e._options.dragAndDrop.hideDropzones&&qq(t).hide(),qq(t).removeClass(e._classes.dropActive),n.dataTransfer.files.length>1&&!e._options.multiple?e._error("tooManyFilesError",""):e._uploadFileList(n.dataTransfer.files)}});this.addDisposer((function(){n.dispose()})),this._options.dragAndDrop.hideDropzones&&qq(t).hide()},_setupDragDrop:function(){var t,e;t=this,this._options.dragAndDrop.disableDefaultDropzone||(e=this._find(this._element,"drop"),this._options.dragAndDrop.extraDropzones.push(e));var n,i=this._options.dragAndDrop.extraDropzones;for(n=0;n<i.length;n++)this._setupDropzone(i[n]);this._options.dragAndDrop.disableDefaultDropzone||qq.ie()&&!qq.ie10()||this._attach(document,"dragenter",(function(){if(!qq(e).hasClass(t._classes.dropDisabled))for(e.style.display="block",n=0;n<i.length;n++)i[n].style.display="block"})),this._attach(document,"dragleave",(function(e){if(t._options.dragAndDrop.hideDropzones&&qq.FineUploader.prototype._leaving_document_out(e))for(n=0;n<i.length;n++)qq(i[n]).hide()})),qq(document).attach("drop",(function(e){if(t._options.dragAndDrop.hideDropzones)for(n=0;n<i.length;n++)qq(i[n]).hide();e.preventDefault()}))},_onSubmit:function(t,e){qq.FineUploaderBasic.prototype._onSubmit.apply(this,arguments),this._addToList(t,e)},_onProgress:function(t,e,n,i){var s,r,o,a,l,c;qq.FineUploaderBasic.prototype._onProgress.apply(this,arguments),s=this.getItemByFileId(t),r=this._find(s,"progressBar"),a=Math.round(n/i*100),n===i?(l=this._find(s,"cancel"),qq(l).hide(),qq(r).hide(),qq(this._find(s,"statusText")).setText(this._options.text.waitingForResponse),o=this._formatSize(i)):(o=this._formatProgress(n,i),qq(r).css({display:"block"})),qq(r).css({width:a+"%"}),c=this._find(s,"size"),qq(c).css({display:"inline"}),qq(c).setText(o)},_onComplete:function(t,e,n,i){qq.FineUploaderBasic.prototype._onComplete.apply(this,arguments);var s=this.getItemByFileId(t);qq(this._find(s,"statusText")).clearText(),qq(s).removeClass(this._classes.retrying),qq(this._find(s,"progressBar")).hide(),this._options.disableCancelForFormUploads&&!qq.UploadHandlerXhr.isSupported()||qq(this._find(s,"cancel")).hide(),qq(this._find(s,"spinner")).hide(),n.success?(qq(s).addClass(this._classes.success),this._classes.successIcon&&(this._find(s,"finished").style.display="inline-block",qq(s).addClass(this._classes.successIcon))):(qq(s).addClass(this._classes.fail),this._classes.failIcon&&(this._find(s,"finished").style.display="inline-block",qq(s).addClass(this._classes.failIcon)),this._options.retry.showButton&&!this._preventRetries[t]&&qq(s).addClass(this._classes.retryable),this._controlFailureTextDisplay(s,n))},_onUpload:function(t,e,n){qq.FineUploaderBasic.prototype._onUpload.apply(this,arguments);var i=this.getItemByFileId(t);this._showSpinner(i)},_onBeforeAutoRetry:function(t){var e,n,i,s,r,o;qq.FineUploaderBasic.prototype._onBeforeAutoRetry.apply(this,arguments),e=this.getItemByFileId(t),n=this._find(e,"progressBar"),this._showCancelLink(e),n.style.width=0,qq(n).hide(),this._options.retry.showAutoRetryNote&&(i=this._find(e,"statusText"),s=this._autoRetries[t]+1,r=this._options.retry.maxAutoAttempts,o=(o=this._options.retry.autoRetryNote.replace(/\{retryNum\}/g,s)).replace(/\{maxAuto\}/g,r),qq(i).setText(o),1===s&&qq(e).addClass(this._classes.retrying))},_onBeforeManualRetry:function(t){if(qq.FineUploaderBasic.prototype._onBeforeManualRetry.apply(this,arguments)){var e=this.getItemByFileId(t);return this._find(e,"progressBar").style.width=0,qq(e).removeClass(this._classes.fail),this._showSpinner(e),this._showCancelLink(e),!0}return!1},_addToList:function(t,e){var n=qq.toElement(this._options.fileTemplate);if(this._options.disableCancelForFormUploads&&!qq.UploadHandlerXhr.isSupported()){var i=this._find(n,"cancel");qq(i).remove()}n.qqFileId=t;var s=this._find(n,"file");qq(s).setText(this._formatFileName(e)),qq(this._find(n,"size")).hide(),this._options.multiple||this._clearList(),this._listElement.appendChild(n)},_clearList:function(){this._listElement.innerHTML="",this.clearStoredFiles()},_bindCancelAndRetryEvents:function(){var t=this,e=this._listElement;this._attach(e,"click",(function(e){var n=(e=e||window.event).target||e.srcElement;if(qq(n).hasClass(t._classes.cancel)||qq(n).hasClass(t._classes.retry)){qq.preventDefault(e);for(var i=n.parentNode;null==i.qqFileId;)i=n=n.parentNode;qq(n).hasClass(t._classes.cancel)?(t.cancel(i.qqFileId),qq(i).remove()):(qq(i).removeClass(t._classes.retryable),t.retry(i.qqFileId))}}))},_formatProgress:function(t,e){function n(t,e){i=i.replace(t,e)}var i=this._options.text.formatProgress;return n("{percent}",Math.round(t/e*100)),n("{total_size}",this._formatSize(e)),i},_controlFailureTextDisplay:function(t,e){var n,i,s,r,o;n=this._options.failedUploadTextDisplay.mode,i=this._options.failedUploadTextDisplay.maxChars,s=this._options.failedUploadTextDisplay.responseProperty,"custom"===n?((r=e[s])?r.length>i&&(o=r.substring(0,i)+"..."):(r=this._options.text.failUpload,this.log("'"+s+"' is not a valid property on the server response.","warn")),qq(this._find(t,"statusText")).setText(o||r),this._options.failedUploadTextDisplay.enableTooltip&&this._showTooltip(t,r)):"default"===n?qq(this._find(t,"statusText")).setText(this._options.text.failUpload):"none"!==n&&this.log("failedUploadTextDisplay.mode value of '"+n+"' is not valid","warn")},_showTooltip:function(t,e){t.title=e},_showSpinner:function(t){this._find(t,"spinner").style.display="inline-block"},_showCancelLink:function(t){this._options.disableCancelForFormUploads&&!qq.UploadHandlerXhr.isSupported()||(this._find(t,"cancel").style.display="inline")},_error:function(t,e){var n=qq.FineUploaderBasic.prototype._error.apply(this,arguments);this._options.showMessage(n)}}),qq.UploadDropZone=function(t){this._options={element:null,onEnter:function(){},onLeave:function(){},onLeaveNotDescendants:function(){},onDrop:function(){}},qq.extend(this._options,t),qq.extend(this,qq.DisposeSupport),this._element=this._options.element,this._disableDropOutside(),this._attachEvents()},qq.UploadDropZone.prototype={_dragover_should_be_canceled:function(){return qq.safari()||qq.firefox()&&qq.windows()},_disableDropOutside:function(){qq.UploadDropZone.dropOutsideDisabled||(this._dragover_should_be_canceled?qq(document).attach("dragover",(function(t){t.preventDefault()})):qq(document).attach("dragover",(function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="none",t.preventDefault())})),qq.UploadDropZone.dropOutsideDisabled=!0)},_attachEvents:function(){var t=this;t._attach(t._element,"dragover",(function(e){if(t._isValidFileDrag(e)){var n=qq.ie()?null:e.dataTransfer.effectAllowed;e.dataTransfer.dropEffect="move"==n||"linkMove"==n?"move":"copy",e.stopPropagation(),e.preventDefault()}})),t._attach(t._element,"dragenter",(function(e){t._isValidFileDrag(e)&&t._options.onEnter(e)})),t._attach(t._element,"dragleave",(function(e){if(t._isValidFileDrag(e)){t._options.onLeave(e);var n=document.elementFromPoint(e.clientX,e.clientY);qq(this).contains(n)||t._options.onLeaveNotDescendants(e)}})),t._attach(t._element,"drop",(function(e){t._isValidFileDrag(e)&&(e.preventDefault(),t._options.onDrop(e))}))},_isValidFileDrag:function(t){if(qq.ie()&&!qq.ie10())return!1;var e=t.dataTransfer,n=qq.safari(),i=!!qq.ie10()||"none"!=e.effectAllowed;return e&&i&&(e.files||!n&&e.types.contains&&e.types.contains("Files"))}},qq.UploadHandlerAbstract=function(t){this._options={debug:!1,endpoint:"/upload.php",maxConnections:999,log:function(){},onProgress:function(){},onComplete:function(){},onCancel:function(){},onUpload:function(){},onAutoRetry:function(){}},qq.extend(this._options,t),this._queue=[],this._params=[],this.log=this._options.log},qq.UploadHandlerAbstract.prototype={add:function(){},upload:function(t,e){var n=this._queue.push(t),i={};qq.extend(i,e),this._params[t]=i,n<=this._options.maxConnections&&this._upload(t,this._params[t])},retry:function(t){qq.indexOf(this._queue,t)>=0?this._upload(t,this._params[t]):this.upload(t,this._params[t])},cancel:function(t){this.log("Cancelling "+t),this._cancel(t),this._dequeue(t)},cancelAll:function(){for(var t=0;t<this._queue.length;t++)this._cancel(this._queue[t]);this._queue=[]},getName:function(){},getSize:function(){},getQueue:function(){return this._queue},reset:function(){this.log("Resetting upload handler"),this._queue=[],this._params=[]},_upload:function(){},_cancel:function(){},_dequeue:function(t){var e=qq.indexOf(this._queue,t);this._queue.splice(e,1);var n=this._options.maxConnections;if(this._queue.length>=n&&e<n){var i=this._queue[n-1];this._upload(i,this._params[i])}},isValid:function(){}},qq.UploadHandlerForm=function(t){qq.UploadHandlerAbstract.apply(this,arguments),this._inputs={},this._detach_load_events={}},qq.extend(qq.UploadHandlerForm.prototype,qq.UploadHandlerAbstract.prototype),qq.extend(qq.UploadHandlerForm.prototype,{add:function(t){t.setAttribute("name",this._options.inputName);var e="qq-upload-handler-iframe"+qq.getUniqueId();return this._inputs[e]=t,t.parentNode&&qq(t).remove(),e},getName:function(t){return this._inputs[t].value.replace(/.*(\/|\\)/,"")},isValid:function(t){return void 0!==this._inputs[t]},reset:function(){qq.UploadHandlerAbstract.prototype.reset.apply(this,arguments),this._inputs={},this._detach_load_events={}},_cancel:function(t){this._options.onCancel(t,this.getName(t)),delete this._inputs[t],delete this._detach_load_events[t];var e=document.getElementById(t);e&&(e.setAttribute("src","javascript:false;"),qq(e).remove())},_upload:function(t,e){this._options.onUpload(t,this.getName(t),!1);var n=this._inputs[t];if(!n)throw new Error("file with passed id was not added, or already uploaded or cancelled");var i=this.getName(t);e[this._options.inputName]=i;var s=this._createIframe(t),r=this._createForm(s,e);r.appendChild(n);var o=this;return this._attachLoadEvent(s,(function(){o.log("iframe loaded");var e=o._getIframeContentJSON(s);setTimeout((function(){o._detach_load_events[t](),delete o._detach_load_events[t],qq(s).remove()}),1),!e.success&&o._options.onAutoRetry(t,i,e)||(o._options.onComplete(t,i,e),o._dequeue(t))})),this.log("Sending upload request for "+t),r.submit(),qq(r).remove(),t},_attachLoadEvent:function(t,e){var n=this;this._detach_load_events[t.id]=qq(t).attach("load",(function(){if(n.log("Received response for "+t.id),t.parentNode){try{if(t.contentDocument&&t.contentDocument.body&&"false"==t.contentDocument.body.innerHTML)return}catch(t){n.log("Error when attempting to access iframe during handling of upload response ("+t+")","error")}e()}}))},_getIframeContentJSON:function(iframe){try{var doc=iframe.contentDocument?iframe.contentDocument:iframe.contentWindow.document,response,innerHTML=doc.body.innerHTML;this.log("converting iframe's innerHTML to JSON"),this.log("innerHTML = "+innerHTML),innerHTML&&innerHTML.match(/^<pre/i)&&(innerHTML=doc.body.firstChild.firstChild.nodeValue),response=eval("("+innerHTML+")")}catch(t){this.log("Error when attempting to parse form upload response ("+t+")","error"),response={success:!1}}return response},_createIframe:function(t){var e=qq.toElement('<iframe src="javascript:false;" name="'+t+'" />');return e.setAttribute("id",t),e.style.display="none",document.body.appendChild(e),e},_createForm:function(t,e){var n=this._options.demoMode?"GET":"POST",i=qq.toElement('<form method="'+n+'" enctype="multipart/form-data"></form>'),s=qq.obj2url(e,this._options.endpoint);return i.setAttribute("action",s),i.setAttribute("target",t.name),i.style.display="none",document.body.appendChild(i),i}}),qq.UploadHandlerXhr=function(t){qq.UploadHandlerAbstract.apply(this,arguments),this._files=[],this._xhrs=[],this._loaded=[]},qq.UploadHandlerXhr.isSupported=function(){var t=document.createElement("input");return t.type="file","multiple"in t&&"undefined"!=typeof File&&"undefined"!=typeof FormData&&void 0!==(new XMLHttpRequest).upload},qq.extend(qq.UploadHandlerXhr.prototype,qq.UploadHandlerAbstract.prototype),qq.extend(qq.UploadHandlerXhr.prototype,{add:function(t){if(!(t instanceof File))throw new Error("Passed obj in not a File (in qq.UploadHandlerXhr)");return this._files.push(t)-1},getName:function(t){var e=this._files[t];return null!==e.fileName&&void 0!==e.fileName?e.fileName:e.name},getSize:function(t){var e=this._files[t];return null!=e.fileSize?e.fileSize:e.size},getLoaded:function(t){return this._loaded[t]||0},isValid:function(t){return void 0!==this._files[t]},reset:function(){qq.UploadHandlerAbstract.prototype.reset.apply(this,arguments),this._files=[],this._xhrs=[],this._loaded=[]},_upload:function(t,e){this._options.onUpload(t,this.getName(t),!0);var n=this._files[t],i=this.getName(t);this.getSize(t);this._loaded[t]=0;var s=this._xhrs[t]=new XMLHttpRequest,r=this;s.upload.onprogress=function(e){e.lengthComputable&&(r._loaded[t]=e.loaded,r._options.onProgress(t,i,e.loaded,e.total))},s.onreadystatechange=function(){4==s.readyState&&r._onComplete(t,s)},(e=e||{})[this._options.inputName]=i;var o=qq.obj2url(e,this._options.endpoint),a=this._options.demoMode?"GET":"POST";if(s.open(a,o,!0),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.setRequestHeader("X-File-Name",encodeURIComponent(i)),s.setRequestHeader("Cache-Control","no-cache"),this._options.forceMultipart){var l=new FormData;l.append(this._options.inputName,n),n=l}else s.setRequestHeader("Content-Type","application/octet-stream"),s.setRequestHeader("X-Mime-Type",n.type);for(key in this._options.customHeaders)s.setRequestHeader(key,this._options.customHeaders[key]);this.log("Sending upload request for "+t),s.send(n)},_onComplete:function(id,xhr){"use strict";if(this._files[id]){var name=this.getName(id),size=this.getSize(id),response;this._options.onProgress(id,name,size,size),this.log("xhr - server response received for "+id),this.log("responseText = "+xhr.responseText);try{response="function"==typeof JSON.parse?JSON.parse(xhr.responseText):eval("("+xhr.responseText+")")}catch(t){this.log("Error when attempting to parse xhr response text ("+t+")","error"),response={}}(200===xhr.status&&response.success||!this._options.onAutoRetry(id,name,response,xhr))&&(this._options.onComplete(id,name,response,xhr),this._xhrs[id]=null,this._dequeue(id))}},_cancel:function(t){this._options.onCancel(t,this.getName(t)),this._files[t]=null,this._xhrs[t]&&(this._xhrs[t].abort(),this._xhrs[t]=null)}}),function(t){"use strict";var e,n,i,s,r,o,a,l,c,u;o=["uploaderType"],i=function(t){if(t){var i=l(t);a(i),"basic"===r("uploaderType")?e(new qq.FineUploaderBasic(i)):e(new qq.FineUploader(i))}return n},s=function(t,e){var i=n.data("fineuploader");if(!e)return void 0===i?null:i[t];void 0===i&&(i={}),i[t]=e,n.data("fineuploader",i)},e=function(t){return s("uploader",t)},r=function(t,e){return s(t,e)},a=function(e){var i=e.callbacks={};t.each((new qq.FineUploaderBasic)._options.callbacks,(function(t){var e,s;e=(e=/^on(\w+)/.exec(t)[1]).substring(0,1).toLowerCase()+e.substring(1),s=n,i[t]=function(){var t=Array.prototype.slice.call(arguments);return s.triggerHandler(e,t)}}))},l=function(e,i){var s,a;if(s=void 0===i?"basic"!==e.uploaderType?{element:n[0]}:{}:i,t.each(e,(function(e,n){t.inArray(e,o)>=0?r(e,n):n instanceof t?s[e]=n[0]:t.isPlainObject(n)?(s[e]={},l(n,s[e])):Array.isArray(n)?(a=[],t.each(n,(function(e,n){n instanceof t?t.merge(a,n):a.push(n)})),s[e]=a):s[e]=n})),void 0===i)return s},c=function(n){return"string"===t.type(n)&&!n.match(/^_/)&&void 0!==e()[n]},u=function(t){return e()[t].apply(e(),Array.prototype.slice.call(arguments,1))},t.fn.fineUploader=function(s){return n=this,e()&&c(s)?u.apply(this,arguments):"object"!=typeof s&&s?(t.error("Method "+s+" does not exist on jQuery.fineUploader"),this):i.apply(this,arguments)}}(jQuery),function(t){function e(e){if("string"==typeof e.data&&(e.data={keys:e.data}),e.data&&e.data.keys&&"string"==typeof e.data.keys){var n=e.handler,i=e.data.keys.toLowerCase().split(" ");e.handler=function(e){if(this===e.target||!(t.hotkeys.options.filterInputAcceptingElements&&t.hotkeys.textInputTypes.test(e.target.nodeName)||t.hotkeys.options.filterContentEditable&&t(e.target).attr("contenteditable")||t.hotkeys.options.filterTextInputs&&t.inArray(e.target.type,t.hotkeys.textAcceptingInputTypes)>-1)){var s="keypress"!==e.type&&t.hotkeys.specialKeys[e.which],r=String.fromCharCode(e.which).toLowerCase(),o="",a={};t.each(["alt","ctrl","shift"],(function(t,n){e[n+"Key"]&&s!==n&&(o+=n+"+")})),e.metaKey&&!e.ctrlKey&&"meta"!==s&&(o+="meta+"),e.metaKey&&"meta"!==s&&o.indexOf("alt+ctrl+shift+")>-1&&(o=o.replace("alt+ctrl+shift+","hyper+")),s?a[o+s]=!0:(a[o+r]=!0,a[o+t.hotkeys.shiftNums[r]]=!0,"shift+"===o&&(a[t.hotkeys.shiftNums[r]]=!0));for(var l=0,c=i.length;l<c;l++)if(a[i[l]])return n.apply(this,arguments)}}}}t.hotkeys={version:"0.2.0",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],textInputTypes:/textarea|input|select/i,options:{filterInputAcceptingElements:!1,filterTextInputs:!1,filterContentEditable:!1}},t.each(["keydown","keyup","keypress"],(function(){t.event.special[this]={add:e}}))}(jQuery||this.jQuery||window.jQuery),function(t,e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(t.jQuery)}(this,(function(t){"function"!=typeof Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e});var e={init:function(e){return this.options=t.extend({},t.noty.defaults,e),this.options.layout=this.options.custom?t.noty.layouts.inline:t.noty.layouts[this.options.layout],t.noty.themes[this.options.theme]?this.options.theme=t.noty.themes[this.options.theme]:e.themeClassName=this.options.theme,delete e.layout,delete e.theme,this.options=t.extend({},this.options,this.options.layout.options),this.options.id="noty_"+(new Date).getTime()*Math.floor(1e6*Math.random()),this.options=t.extend({},this.options,e),this._build(),this},_build:function(){var e=t('<div class="noty_bar noty_type_'+this.options.type+'"></div>').attr("id",this.options.id);if(e.append(this.options.template).find(".noty_text").html(this.options.text),this.$bar=null!==this.options.layout.parent.object?t(this.options.layout.parent.object).css(this.options.layout.parent.css).append(e):e,this.options.themeClassName&&this.$bar.addClass(this.options.themeClassName).addClass("noty_container_type_"+this.options.type),this.options.buttons){this.options.closeWith=[],this.options.timeout=!1;var n=t("<div/>").addClass("noty_buttons");null!==this.options.layout.parent.object?this.$bar.find(".noty_bar").append(n):this.$bar.append(n);var i=this;t.each(this.options.buttons,(function(e,n){var s=t("<button/>").addClass(n.addClass?n.addClass:"gray").html(n.text).attr("id",n.id?n.id:"button-"+e).attr("title",n.title).appendTo(i.$bar.find(".noty_buttons")).on("click",(function(t){"function"==typeof n.onClick&&n.onClick.call(s,i,t)}))}))}this.$message=this.$bar.find(".noty_message"),this.$closeButton=this.$bar.find(".noty_close"),this.$buttons=this.$bar.find(".noty_buttons"),t.noty.store[this.options.id]=this},show:function(){var e=this;return e.options.custom?e.options.custom.find(e.options.layout.container.selector).append(e.$bar):t(e.options.layout.container.selector).append(e.$bar),e.options.theme&&e.options.theme.style&&e.options.theme.style.apply(e),"function"===t.type(e.options.layout.css)?this.options.layout.css.apply(e.$bar):e.$bar.css(this.options.layout.css||{}),e.$bar.addClass(e.options.layout.addClass),e.options.layout.container.style.apply(t(e.options.layout.container.selector),[e.options.within]),e.showing=!0,e.options.theme&&e.options.theme.style&&e.options.theme.callback.onShow.apply(this),t.inArray("click",e.options.closeWith)>-1&&e.$bar.css("cursor","pointer").one("click",(function(t){e.stopPropagation(t),e.options.callback.onCloseClick&&e.options.callback.onCloseClick.apply(e),e.close()})),t.inArray("hover",e.options.closeWith)>-1&&e.$bar.one("mouseenter",(function(){e.close()})),t.inArray("button",e.options.closeWith)>-1&&e.$closeButton.one("click",(function(t){e.stopPropagation(t),e.close()})),-1==t.inArray("button",e.options.closeWith)&&e.$closeButton.remove(),e.options.callback.onShow&&e.options.callback.onShow.apply(e),"string"==typeof e.options.animation.open?(e.$bar.css("height",e.$bar.innerHeight()),e.$bar.on("click",(function(){e.wasClicked=!0})),e.$bar.show().addClass(e.options.animation.open).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",(function(){e.options.callback.afterShow&&e.options.callback.afterShow.apply(e),e.showing=!1,e.shown=!0,e.hasOwnProperty("wasClicked")&&(e.$bar.off("click",(function(){e.wasClicked=!0})),e.close())}))):e.$bar.animate(e.options.animation.open,e.options.animation.speed,e.options.animation.easing,(function(){e.options.callback.afterShow&&e.options.callback.afterShow.apply(e),e.showing=!1,e.shown=!0})),e.options.timeout&&e.$bar.delay(e.options.timeout).promise().done((function(){e.close()})),this},close:function(){if(!(this.closed||this.$bar&&this.$bar.hasClass("i-am-closing-now"))){var e=this;if(this.showing)e.$bar.queue((function(){e.close.apply(e)}));else{if(!this.shown&&!this.showing){var n=[];return t.each(t.noty.queue,(function(t,i){i.options.id!=e.options.id&&n.push(i)})),void(t.noty.queue=n)}e.$bar.addClass("i-am-closing-now"),e.options.callback.onClose&&e.options.callback.onClose.apply(e),"string"==typeof e.options.animation.close?e.$bar.addClass(e.options.animation.close).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",(function(){e.options.callback.afterClose&&e.options.callback.afterClose.apply(e),e.closeCleanUp()})):e.$bar.clearQueue().stop().animate(e.options.animation.close,e.options.animation.speed,e.options.animation.easing,(function(){e.options.callback.afterClose&&e.options.callback.afterClose.apply(e)})).promise().done((function(){e.closeCleanUp()}))}}},closeCleanUp:function(){var e=this;e.options.modal&&(t.notyRenderer.setModalCount(-1),0==t.notyRenderer.getModalCount()&&t(".noty_modal").fadeOut(e.options.animation.fadeSpeed,(function(){t(this).remove()}))),t.notyRenderer.setLayoutCountFor(e,-1),0==t.notyRenderer.getLayoutCountFor(e)&&t(e.options.layout.container.selector).remove(),void 0!==e.$bar&&null!==e.$bar&&("string"==typeof e.options.animation.close?(e.$bar.css("transition","all 100ms ease").css("border",0).css("margin",0).height(0),e.$bar.one("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",(function(){e.$bar.remove(),e.$bar=null,e.closed=!0,e.options.theme.callback&&e.options.theme.callback.onClose&&e.options.theme.callback.onClose.apply(e)}))):(e.$bar.remove(),e.$bar=null,e.closed=!0)),delete t.noty.store[e.options.id],e.options.theme.callback&&e.options.theme.callback.onClose&&e.options.theme.callback.onClose.apply(e),e.options.dismissQueue||(t.noty.ontap=!0,t.notyRenderer.render()),e.options.maxVisible>0&&e.options.dismissQueue&&t.notyRenderer.render()},setText:function(t){return this.closed||(this.options.text=t,this.$bar.find(".noty_text").html(t)),this},setType:function(t){return this.closed||(this.options.type=t,this.options.theme.style.apply(this),this.options.theme.callback.onShow.apply(this)),this},setTimeout:function(t){if(!this.closed){var e=this;this.options.timeout=t,e.$bar.delay(e.options.timeout).promise().done((function(){e.close()}))}return this},stopPropagation:function(t){void 0!==(t=t||window.event).stopPropagation?t.stopPropagation():t.cancelBubble=!0},closed:!1,showing:!1,shown:!1};t.notyRenderer={},t.notyRenderer.init=function(n){var i=Object.create(e).init(n);return i.options.killer&&t.noty.closeAll(),i.options.force?t.noty.queue.unshift(i):t.noty.queue.push(i),
t.notyRenderer.render(),"object"==t.noty.returns?i:i.options.id},t.notyRenderer.render=function(){var e=t.noty.queue[0];"object"===t.type(e)?e.options.dismissQueue?e.options.maxVisible>0?t(e.options.layout.container.selector+" > li").length<e.options.maxVisible&&t.notyRenderer.show(t.noty.queue.shift()):t.notyRenderer.show(t.noty.queue.shift()):t.noty.ontap&&(t.notyRenderer.show(t.noty.queue.shift()),t.noty.ontap=!1):t.noty.ontap=!0},t.notyRenderer.show=function(e){e.options.modal&&(t.notyRenderer.createModalFor(e),t.notyRenderer.setModalCount(1)),e.options.custom?0==e.options.custom.find(e.options.layout.container.selector).length?e.options.custom.append(t(e.options.layout.container.object).addClass("i-am-new")):e.options.custom.find(e.options.layout.container.selector).removeClass("i-am-new"):0==t(e.options.layout.container.selector).length?t("body").append(t(e.options.layout.container.object).addClass("i-am-new")):t(e.options.layout.container.selector).removeClass("i-am-new"),t.notyRenderer.setLayoutCountFor(e,1),e.show()},t.notyRenderer.createModalFor=function(e){if(0==t(".noty_modal").length){var n=t("<div/>").addClass("noty_modal").addClass(e.options.theme).data("noty_modal_count",0);e.options.theme.modal&&e.options.theme.modal.css&&n.css(e.options.theme.modal.css),n.prependTo(t("body")).fadeIn(e.options.animation.fadeSpeed),t.inArray("backdrop",e.options.closeWith)>-1&&n.on("click",(function(){t.noty.closeAll()}))}},t.notyRenderer.getLayoutCountFor=function(e){return t(e.options.layout.container.selector).data("noty_layout_count")||0},t.notyRenderer.setLayoutCountFor=function(e,n){return t(e.options.layout.container.selector).data("noty_layout_count",t.notyRenderer.getLayoutCountFor(e)+n)},t.notyRenderer.getModalCount=function(){return t(".noty_modal").data("noty_modal_count")||0},t.notyRenderer.setModalCount=function(e){return t(".noty_modal").data("noty_modal_count",t.notyRenderer.getModalCount()+e)},t.fn.noty=function(e){return e.custom=t(this),t.notyRenderer.init(e)},t.noty={},t.noty.queue=[],t.noty.ontap=!0,t.noty.layouts={},t.noty.themes={},t.noty.returns="object",t.noty.store={},t.noty.get=function(e){return!!t.noty.store.hasOwnProperty(e)&&t.noty.store[e]},t.noty.close=function(e){return!!t.noty.get(e)&&t.noty.get(e).close()},t.noty.setText=function(e,n){return!!t.noty.get(e)&&t.noty.get(e).setText(n)},t.noty.setType=function(e,n){return!!t.noty.get(e)&&t.noty.get(e).setType(n)},t.noty.clearQueue=function(){t.noty.queue=[]},t.noty.closeAll=function(){t.noty.clearQueue(),t.each(t.noty.store,(function(t,e){e.close()}))};var n=window.alert;return t.noty.consumeAlert=function(e){window.alert=function(n){e?e.text=n:e={text:n},t.notyRenderer.init(e)}},t.noty.stopConsumeAlert=function(){window.alert=n},t.noty.defaults={layout:"top",theme:"defaultTheme",type:"alert",text:"",dismissQueue:!0,template:'<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',animation:{open:{height:"toggle"},close:{height:"toggle"},easing:"swing",speed:500,fadeSpeed:"fast"},timeout:!1,force:!1,modal:!1,maxVisible:5,killer:!1,closeWith:["click"],callback:{onShow:function(){},afterShow:function(){},onClose:function(){},afterClose:function(){},onCloseClick:function(){}},buttons:!1},t(window).on("resize",(function(){t.each(t.noty.layouts,(function(e,n){n.container.style.apply(t(n.container.selector))}))})),window.noty=function(e){return t.notyRenderer.init(e)},t.noty.layouts.bottom={name:"bottom",options:{},container:{object:'<ul id="noty_bottom_layout_container" />',selector:"ul#noty_bottom_layout_container",style:function(){t(this).css({bottom:0,left:"5%",position:"fixed",width:"90%",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:9999999})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none"},addClass:""},t.noty.layouts.bottomCenter={name:"bottomCenter",options:{},container:{object:'<ul id="noty_bottomCenter_layout_container" />',selector:"ul#noty_bottomCenter_layout_container",style:function(){t(this).css({bottom:20,left:0,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),t(this).css({left:(t(window).width()-t(this).outerWidth(!1))/2+"px"})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},t.noty.layouts.bottomLeft={name:"bottomLeft",options:{},container:{object:'<ul id="noty_bottomLeft_layout_container" />',selector:"ul#noty_bottomLeft_layout_container",style:function(){t(this).css({bottom:20,left:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),window.innerWidth<600&&t(this).css({left:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},t.noty.layouts.bottomRight={name:"bottomRight",options:{},container:{object:'<ul id="noty_bottomRight_layout_container" />',selector:"ul#noty_bottomRight_layout_container",style:function(){t(this).css({bottom:20,right:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),window.innerWidth<600&&t(this).css({right:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},t.noty.layouts.center={name:"center",options:{},container:{object:'<ul id="noty_center_layout_container" />',selector:"ul#noty_center_layout_container",style:function(){t(this).css({position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});var e=t(this).clone().css({visibility:"hidden",display:"block",position:"absolute",top:0,left:0}).attr("id","dupe");t("body").append(e),e.find(".i-am-closing-now").remove(),e.find("li").css("display","block");var n=e.height();e.remove(),t(this).hasClass("i-am-new")?t(this).css({left:(t(window).width()-t(this).outerWidth(!1))/2+"px",top:(t(window).height()-n)/2+"px"}):t(this).animate({left:(t(window).width()-t(this).outerWidth(!1))/2+"px",top:(t(window).height()-n)/2+"px"},500)}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},t.noty.layouts.centerLeft={name:"centerLeft",options:{},container:{object:'<ul id="noty_centerLeft_layout_container" />',selector:"ul#noty_centerLeft_layout_container",style:function(){t(this).css({left:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});var e=t(this).clone().css({visibility:"hidden",display:"block",position:"absolute",top:0,left:0}).attr("id","dupe");t("body").append(e),e.find(".i-am-closing-now").remove(),e.find("li").css("display","block");var n=e.height();e.remove(),t(this).hasClass("i-am-new")?t(this).css({top:(t(window).height()-n)/2+"px"}):t(this).animate({top:(t(window).height()-n)/2+"px"},500),window.innerWidth<600&&t(this).css({left:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},t.noty.layouts.centerRight={name:"centerRight",options:{},container:{object:'<ul id="noty_centerRight_layout_container" />',selector:"ul#noty_centerRight_layout_container",style:function(){t(this).css({right:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});var e=t(this).clone().css({visibility:"hidden",display:"block",position:"absolute",top:0,left:0}).attr("id","dupe");t("body").append(e),e.find(".i-am-closing-now").remove(),e.find("li").css("display","block");var n=e.height();e.remove(),t(this).hasClass("i-am-new")?t(this).css({top:(t(window).height()-n)/2+"px"}):t(this).animate({top:(t(window).height()-n)/2+"px"},500),window.innerWidth<600&&t(this).css({right:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},t.noty.layouts.inline={name:"inline",options:{},container:{object:'<ul class="noty_inline_layout_container" />',selector:"ul.noty_inline_layout_container",style:function(){t(this).css({width:"100%",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:9999999})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none"},addClass:""},t.noty.layouts.top={name:"top",options:{},container:{object:'<ul id="noty_top_layout_container" />',selector:"ul#noty_top_layout_container",style:function(){t(this).css({top:0,left:"5%",position:"fixed",width:"90%",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:9999999})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none"},addClass:""},t.noty.layouts.topCenter={name:"topCenter",options:{},container:{object:'<ul id="noty_topCenter_layout_container" />',selector:"ul#noty_topCenter_layout_container",style:function(){t(this).css({top:20,left:0,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),t(this).css({left:(t(window).width()-t(this).outerWidth(!1))/2+"px"})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},t.noty.layouts.topLeft={name:"topLeft",options:{},container:{object:'<ul id="noty_topLeft_layout_container" />',selector:"ul#noty_topLeft_layout_container",style:function(){t(this).css({top:20,left:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),window.innerWidth<600&&t(this).css({left:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},t.noty.layouts.topRight={name:"topRight",options:{},container:{object:'<ul id="noty_topRight_layout_container" />',selector:"ul#noty_topRight_layout_container",style:function(){t(this).css({top:20,right:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),window.innerWidth<600&&t(this).css({right:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},window.noty})),function(t,e,n){function i(e,n){this.element=e,this.$element=t(e),this.options=t.extend({},u,n),this._defaults=u,this._name=c,this._fixedWidth=!0,this.collection=[],this.active=!1,this.buffer="",this.oldElementText="",t.data(e,"plugin_ce")&&(this.ce=t.data(e,"plugin_ce")),this.init()}function s(){}function r(t,e){return t.name&&t.name.match(e)||t.keywords&&t.keywords.match(e)}function o(t,e){return t.name<e.name?1:t.name>e.name?-1:0}function a(){}function l(){}var c="textmodule",u={debug:!1};i.prototype.init=function(){this.renderBase(),this.bindEvents()},i.prototype.bindEvents=function(){this.$element.on("keydown",this.onKeydown.bind(this)),this.$element.on("keyup",this.onKeyup.bind(this)),this.$element.on("input",this.onKeypress.bind(this)),this.$element.on("focus",this.onFocus.bind(this))},i.prototype.onFocus=function(){this.close()},i.prototype.onKeydown=function(t){if(this.oldElementText=this.$element.text(),this.isActive()){if(27===t.keyCode)return t.preventDefault(),t.stopPropagation(),void this.close();if(13===t.keyCode){t.preventDefault(),t.stopPropagation();var e=this.$widget.find(".dropdown-menu li.is-active")[0];return e||(e=this.$widget.find(".dropdown-menu li:hover")[0]),e||(e=this.$widget.find(".dropdown-menu li:first-child")[0]),void this.take(e)}if(37===t.keyCode||39===t.keyCode)return t.preventDefault(),void t.stopPropagation();if(38===t.keyCode||40===t.keyCode){t.preventDefault(),t.stopPropagation();var n=this.$widget.find(".dropdown-menu li.is-active");n.removeClass("is-active"),38==t.keyCode&&n.prev().length?n=n.prev():40==t.keyCode&&n.next().length&&(n=n.next()),n.addClass("is-active");var i=this.$widget.find(".dropdown-menu");if(!n.get(0))return;if(n.position().top<0)i.scrollTop(i.scrollTop()+n.position().top);else if(n.position().top+n.height()>i.height()){var s=n.position().top+n.height()-i.height();i.scrollTop(i.scrollTop()+s)}}}if(27===t.keyCode&&this.close(),8===t.keyCode&&!t.ctrlKey&&!t.metaKey&&this.buffer){var r=this.findTrigger(this.buffer);if(r&&r.trigger===this.buffer)return this.close(!0),void t.preventDefault();var o=this.buffer.length;this.buffer=this.buffer.substr(0,o-1),this.log("BS backspace",this.buffer),this.result(r)}},i.prototype.onKeyup=function(t){8!=t.keyCode||this.buffer||this.removeInvalidMentions()},i.prototype.onKeypress=function(t){if(this.log("BUFF",this.buffer,t.keyCode,String.fromCharCode(t.which)),t.originalEvent&&t.originalEvent.data){var e=t.originalEvent.data.charCodeAt(0);t.keyCode=t.which=e}if(this.isActive()&&t.keyCode===n){var i=this.oldElementText.indexOf(this.buffer),s=this.findTrigger(this.buffer);if(this.buffer&&-1!==i&&s)if(foundCurrentBuffer=this.$element.text().substr(i,this.buffer.length),this.$element.text().substr(i,s.trigger.length)!==s.trigger)this.close(!0);else if(foundCurrentBuffer!==this.buffer){for(var r=0,o=0;o<this.buffer.length;o++)if(this.buffer.charAt(o)!==foundCurrentBuffer.charAt(o)){r=o;break}this.buffer=this.buffer.substr(0,r),this.result(s)}}else if(!_.contains([16,37,38,39,40],t.keyCode))if(13!==t.keyCode){var a=String.fromCharCode(t.which);this.hasAvailableTriggers(this.buffer)&&(this.hasAvailableTriggers(this.buffer+a)?this.buffer=this.buffer+a:this.findTrigger(this.buffer)||(this.buffer="")),!this.buffer&&this.hasAvailableTriggers(a)&&(this.buffer=this.buffer+a),(s=this.findTrigger(this.buffer))&&(this.log("BUFF HINT",this.buffer,this.buffer.length,t.which,String.fromCharCode(t.which)),this.isActive()||this.open(),this.result(s))}else this.buffer=""},i.prototype.removeInvalidMentions=function(){this.$element.find("a[data-mention-user-id]").each((function(){if(""!=t(this).text())return!0;t(this).remove()}))},i.prototype.hasAvailableTriggers=function(t){return _.find(this.helpers,(function(e){var n=e.trigger;return n.substr(0,t.length)==t.substr(0,n.length)}))!=n},i.prototype.findTrigger=function(t){return _.find(this.helpers,(function(e){return e.trigger==t.substr(0,e.trigger.length)}))},i.prototype.renderBase=function(){this.$element.after('<div class="shortcut dropdown dropdown--actions"><ul class="dropdown-menu text-modules-box"></ul></div>'),this.$widget=this.$element.next(),this.$widget.on("mousedown","li",t.proxy(this.onEntryClick,this)),this.$widget.on("mouseenter","li",t.proxy(this.onMouseEnter,this))},i.prototype.movePosition=function(){if(this._position){var t=this.$element.outerHeight()+2,e=this.$widget.find("ul").height(),n="rtl"==document.dir,i=-(e+t)+this._position.top,s=this._position.left-6,r=this.$element.innerWidth(),o=this.$widget.find(".dropdown-menu").width();n&&(s=r-s),s+o>r&&(s=r-o);var a={top:i};a[n?"right":"left"]=s,this.$widget.css(a)}},i.prototype.updatePosition=function(){if(this.$widget.find(".dropdown-menu").scrollTop(300),this.$element.is(":visible")){var e='<span id="js-cursor-position"></span>';this.getFirstRange().cloneRange().pasteHtml(e),this._position=t("#js-cursor-position").position(),t("#js-cursor-position").remove(),this._position&&this.movePosition()}},i.prototype.open=function(){this.active=!0,this.updatePosition(),this.renderBase(),this.$widget.addClass("open"),t(e).on("click.textmodule",t.proxy(this.close,this))},i.prototype.close=function(n){this.$widget.removeClass("open"),n&&this.active&&this.cutInput(!0),this.buffer="",this.active=!1,this.$widget.remove(),t(e).off("click.textmodule")},i.prototype.isActive=function(){return this.active},i.prototype.paste=function(n){var i=!!e.MSInputMethodContext&&!!document.documentMode;if(document.selection&&document.selection.createRange)(s=document.selection.createRange()).pasteHTML&&s.pasteHTML(n);else if(i&&document.getSelection){var s=document.getSelection().getRangeAt(0),r=document.createElement("div");s.surroundContents(r),r.innerHTML=n}else{var o=rangy.getSelection();if(!o.rangeCount)return;(s=o.getRangeAt(0)).collapse(!1),t("<div>").append(n).contents().each((function(){s.insertNode(t(this).get(0)),s.collapseAfter(t(this).get(0))})),o.setSingleRange(s)}},i.prototype.cut=function(t){var e=this.getFirstRange();if(e){var n=e.cloneRange();start=e.startOffset-t.length,start<0&&(start=0),n.setStart(e.startContainer,start),n.setEnd(e.startContainer,e.startOffset),n.deleteContents()}},i.prototype.onMouseEnter=function(e){this.$widget.find(".is-active").removeClass("is-active"),t(e.currentTarget).addClass("is-active")},i.prototype.onEntryClick=function(t){t.preventDefault(),this.take(t.currentTarget)},i.prototype.take=function(t){if(t){var e=this.findTrigger(this.buffer);if(e){var n=this,i=this.$element.closest("form").find("[name=form_id]").val();e.renderValue(this,t,(function(t,e){n.cutInput(),n.paste(t),n.close(!0),App.Event.trigger("ui::ticket::addArticleAttachent",{attachments:e,form_id:i})}))}}else this.close(!0)},i.prototype.getFirstRange=function(){var t=rangy.getSelection();return t.rangeCount?t.getRangeAt(0):null},i.prototype.cutInput=function(){this.buffer&&this.$element.text()&&(this.cut(this.buffer),this.buffer="")},i.prototype.result=function(t){if(t){var e=this.buffer.substr(t.trigger.length,this.buffer.length);t.renderResults(this,e)}},i.prototype.emptyResultsContainer=function(){this.$widget.find("ul").empty()},i.prototype.appendResults=function(t){this.$widget.find("ul").append(t).scrollTop(9999),this.afterResultRendering()},i.prototype.afterResultRendering=function(){if(this._fixedWidth){var t=this.$widget.find("ul"),e=parseInt(t.css("min-width")),n=t.width();(!e||n>e)&&t.css("min-width",n+"px")}this.movePosition()},i.prototype.log=function(){App&&App.Log&&App.Log.debug(this._name,arguments),this.options.debug&&console.log(this._name,arguments)},t.fn[c]=function(e){return this.each((function(){t.data(this,"plugin_"+c)||t.data(this,"plugin_"+c,new i(this,e))}))},s.renderValue=function(e,n,i){var s=t(n).data("id"),r=_.find(e.collection,(function(t){return t.id==s}));r&&i(r.content,[])},s.renderResults=function(e,n){var i=new RegExp(n,"i"),s=new RegExp("\\b"+n+"\\b","i"),a=e.collection.filter((function(t){return r(t,i)&&!r(t,s)})),l=e.collection.filter((function(t){return r(t,s)}));a.sort(o),l.length&&(l.sort(o),a=a.concat(l)),e.emptyResultsContainer();var c=a.map((function(e,n,i){var s=t("<li>").attr("data-id",e.id).text(e.name).addClass("u-clickable u-textTruncate");return n==i.length-1&&s.addClass("is-active"),e.keywords&&s.append(t("<kbd>").text(e.keywords)),s}));e.appendResults(c)},s.trigger="::",a.renderValue=function(e,n,i){e.emptyResultsContainer();var s=t("<li>").text(App.i18n.translateInline("Please wait\u2026"));e.appendResults(s);var r=e.$element.closest("form").find("[name=form_id]").val();App.Ajax.request({id:"textmoduleKbAnswer",type:"GET",url:t(n).data("url"),success:function(e){App.Collection.loadAssets(e.assets);var s=App.KnowledgeBaseAnswerTranslation.find(t(n).data("id")),o=s.content().bodyWithPublicURLs();App.Ajax.request({id:"textmoduleKbAnswerAttachments",type:"POST",data:JSON.stringify({form_id:r}),url:s.parent().generateURL("/attachments/clone_to_form"),success:function(t){App.Utils.htmlImage2DataUrlAsync(o,(function(e){i(e,t.attachments)}))},error:function(){i("")}})},error:function(){i("")}})},a.renderResults=function(e,i){if(e.emptyResultsContainer(),e.searchCondition)if(i){s=t("<li>").text(App.i18n.translateInline("Loading\u2026"));e.appendResults(s),App.Delay.set((function(){App.Ajax.request({id:"textmoduleKbAnswer",type:"POST",url:App.Config.get("api_path")+"/knowledge_bases/search",data:JSON.stringify({query:i,flavor:"agent",index:"KnowledgeBase::Answer::Translation",url_type:"agent",highlight_enabled:!1,include_locale:!0}),processData:!0,success:function(i){e.emptyResultsContainer();var s=i.result.map((function(t){if(result=_.find(i.details,(function(e){return e.type==t.type&&e.id==t.id})))return{category:result.subtitle,name:result.title,value:t.id,url:result.url}})).filter((function(t){return t!=n})).map((function(e,n,i){var s=t("<li>").attr("data-id",e.value).attr("data-url",e.url).addClass("u-clickable u-textTruncate with-category");return s.append(t("<small>").text(e.category)),s.append("<br>"),s.append(t("<span>").text(e.name)),n==i.length-1&&s.addClass("is-active"),s}));0==s.length&&s.push(t("<li>").text(App.i18n.translateInline("No results found"))),e.appendResults(s)}})}),200,"textmoduleKbAnswerDelay","textmodule")}else{var s=t("<li>").text(App.i18n.translateInline("Start typing to search in Knowledge Base\u2026"));e.appendResults(s)}},a.trigger="??",l.renderValue=function(e,n,i){e.emptyResultsContainer();var s=t("<li>").text(App.i18n.translateInline("Please wait\u2026"));e.appendResults(s);e.$element.closest("form").find("[name=form_id]").val();var r=t(n).data("id"),o=App.User.find(r);if(!o)return i("");fqdn=App.Config.get("fqdn"),http_type=App.Config.get("http_type"),$replace=t("<a></a>",{href:http_type+"://"+fqdn+"/"+o.uiUrl(),"data-mention-user-id":r,text:o.firstname+" "+o.lastname}),i($replace[0].outerHTML)},l.renderResults=function(e,n){if(e.emptyResultsContainer(),e.searchCondition)if(n){i=t("<li>").text(App.i18n.translateInline("Loading\u2026"));e.appendResults(i),App.Delay.set((function(){items=[],e.searchCondition.group_id?App.Mention.searchUser(n,e.searchCondition.group_id,(function(n){e.emptyResultsContainer(),activeSet=!1,t.each(n.user_ids,(function(e,n){return user=App.User.find(n),!user||(!user.active||(item=t("<li>",{"data-id":n,text:user.firstname+" "+user.lastname+" <"+user.email+">"}),activeSet||(activeSet=!0,item.addClass("is-active")),void items.push(item)))})),0==items.length&&items.push(t("<li>").text(App.i18n.translateInline("No results found"))),e.appendResults(items)})):(e.emptyResultsContainer(),items.push(t("<li>").text(App.i18n.translateInline("Before you mention a user, please select a group."))),e.appendResults(items))}),200,"textmoduleMentionDelay","textmodule")}else{var i=t("<li>").text(App.i18n.translateInline("Start typing to search for users\u2026"));e.appendResults(i)}},l.trigger="@@",i.prototype.helpers=[s,a,l]}(jQuery,window),function(t){var e=t(window);t.fn.visible=function(t,n,i){if(!(this.length<1)){var s=this.length>1?this.eq(0):this,r=s.get(0),o=e.width(),a=e.height(),l=(i=i||"both",!0!==n||r.offsetWidth*r.offsetHeight);if("function"==typeof r.getBoundingClientRect){var c=r.getBoundingClientRect(),u=c.top>=0&&c.top<a,p=c.bottom>0&&c.bottom<=a,h=c.left>=0&&c.left<o,d=c.right>0&&c.right<=o,f=t?u||p:u&&p,m=t?h||d:h&&d;if("both"===i)return l&&f&&m;if("vertical"===i)return l&&f;if("horizontal"===i)return l&&m}else{var g=e.scrollTop(),v=g+a,y=e.scrollLeft(),b=y+o,_=s.offset(),w=_.top,k=w+s.height(),A=_.left,C=A+s.width(),T=!0===t?k:w,S=!0===t?w:k,x=!0===t?C:A,j=!0===t?A:C;if("both"===i)return!!l&&S<=v&&T>=g&&j<=b&&x>=y;if("vertical"===i)return!!l&&S<=v&&T>=g;if("horizontal"===i)return!!l&&j<=b&&x>=y}}}}(jQuery);var jsonlint=function(){var t={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(t,e,n,i,s,r){var o=r.length-1;switch(s){case 1:this.$=t.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(t);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=r[o-1];case 13:this.$={};break;case 14:case 19:this.$=r[o-1];break;case 15:this.$=[r[o-2],r[o]];break;case 16:this.$={},this.$[r[o][0]]=r[o][1];break;case 17:this.$=r[o-2],r[o-2][r[o][0]]=r[o][1];break;case 18:this.$=[];break;case 20:this.$=[r[o]];break;case 21:this.$=r[o-2],r[o-2].push(r[o])}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(t){throw new Error(t)},parse:function(t){function e(t){s.length=s.length-2*t,r.length=r.length-t,o.length=o.length-t}function n(){var t;return"number"!=typeof(t=i.lexer.lex()||1)&&(t=i.symbols_[t]||t),t}var i=this,s=[0],r=[null],o=[],a=this.table,l="",c=0,u=0,p=0,h=2,d=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var f=this.lexer.yylloc;o.push(f),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var m,g,v,y,b,_,w,k,A,C={};;){if(v=s[s.length-1],this.defaultActions[v]?y=this.defaultActions[v]:(null==m&&(m=n()),y=a[v]&&a[v][m]),void 0===y||!y.length||!y[0]){if(!p){for(_ in A=[],a[v])this.terminals_[_]&&_>2&&A.push("'"+this.terminals_[_]+"'");var T="";T=this.lexer.showPosition?"Parse error on line "+(c+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+this.terminals_[m]+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:this.lexer.match,token:this.terminals_[m]||m,line:this.lexer.yylineno,loc:f,expected:A})}if(3==p){if(m==d)throw new Error(T||"Parsing halted.");u=this.lexer.yyleng,l=this.lexer.yytext,c=this.lexer.yylineno,f=this.lexer.yylloc,m=n()}for(;!(h.toString()in a[v]);){if(0==v)throw new Error(T||"Parsing halted.");e(1),v=s[s.length-1]}g=m,m=h,y=a[v=s[s.length-1]]&&a[v][h],p=3}if(y[0]instanceof Array&&y.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+m);switch(y[0]){case 1:s.push(m),r.push(this.lexer.yytext),o.push(this.lexer.yylloc),s.push(y[1]),m=null,g?(m=g,g=null):(u=this.lexer.yyleng,l=this.lexer.yytext,c=this.lexer.yylineno,f=this.lexer.yylloc,p>0&&p--);break;case 2:if(w=this.productions_[y[1]][1],C.$=r[r.length-w],C._$={first_line:o[o.length-(w||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(w||1)].first_column,last_column:o[o.length-1].last_column},void 0!==(b=this.performAction.call(C,l,u,c,this.yy,y[1],r,o)))return b;w&&(s=s.slice(0,-1*w*2),r=r.slice(0,-1*w),o=o.slice(0,-1*w)),s.push(this.productions_[y[1]][0]),r.push(C.$),o.push(C._$),k=a[s[s.length-2]][s[s.length-1]],s.push(k);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parseError)throw new Error(t);this.yy.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.match+=t,this.matched+=t,t.match(/\n/)&&this.yylineno++,this._input=this._input.slice(1),t},unput:function(t){return this._input=t+this._input,this},more:function(){return this._more=!0,this},less:function(t){this._input=this.match.slice(t)+this._input},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,n,i,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),o=0;o<r.length&&(!(n=this._input.match(this.rules[r[o]]))||e&&!(n[0].length>e[0].length)||(e=n,i=o,this.options.flex));o++);return e?((s=e[0].match(/\n.*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-1:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,r[i],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:void this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,n){switch(n){case 0:break;case 1:return 6;case 2:return e.yytext=e.yytext.substr(1,e.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}};return t}();return t.lexer=e,t}();"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=jsonlint,exports.parse=function(){return jsonlint.parse.apply(jsonlint,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");if("undefined"!=typeof process)var e=require("fs").readFileSync(require("path").join(process.cwd(),t[1]),"utf8");else e=require("file").path(require("file").cwd()).join(t[1]).read({charset:"utf-8"});return exports.parser.parse(e)},void 0!==module&&require.main===module&&exports.main("undefined"!=typeof process?process.argv.slice(1):require("system").args));var linkify=function(t){"use strict";function e(t){this.j={},this.jr=[],this.jd=null,this.t=t}function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=w(),n=k(I),i=k(D),s=w(),r=k(M),o=[[wt,i],[yt,i],[bt,i],[_t,i]],a=function(){var t=k(D);return t.j={"-":s},t.jr=[].concat(o),t},l=function(t){var e=a();return e.t=t,e};x(e,[["'",k(J)],["{",k(L)],["[",k(F)],["<",k($)],["(",k(B)],["}",k(z)],["]",k(U)],[">",k(q)],[")",k(W)],["&",k(H)],["*",k(V)],["@",k(G)],["`",k(Y)],["^",k(X)],[":",k(Z)],[",",k(Q)],["$",k(tt)],[".",k(et)],["=",k(nt)],["!",k(it)],["-",k(st)],["%",k(rt)],["|",k(ot)],["+",k(at)],["#",k(lt)],["?",k(ct)],['"',k(ut)],["/",k(ht)],[";",k(pt)],["~",k(dt)],["_",k(ft)],["\\",k(K)]]),A(e,"\n",k(R)),C(e,kt,r),A(r,"\n",w()),C(r,kt,r);for(var c=0;c<vt.length;c++)j(e,vt[c],l(E),a);var u=a(),p=a(),h=a(),d=a();j(e,"file",u,a),j(e,"ftp",p,a),j(e,"http",h,a),j(e,"mailto",d,a);var f=a(),m=k(O),g=k(N);A(p,"s",f),A(p,":",m),A(h,"s",f),A(h,":",m),A(u,":",m),A(f,":",m),A(d,":",g);for(var v=a(),y=0;y<t.length;y++)j(e,t[y],v,a);return A(v,":",m),j(e,"localhost",l(P),a),C(e,wt,n),C(e,yt,i),C(e,bt,i),C(e,_t,i),C(n,wt,n),C(n,yt,i),C(n,bt,i),C(n,_t,i),A(n,"-",s),A(i,"-",s),A(s,"-",s),C(i,wt,i),C(i,yt,i),C(i,bt,i),C(i,_t,i),C(s,wt,i),C(s,yt,i),C(s,bt,i),C(s,_t,i),e.jd=k(mt),e}function i(t,e){for(var n=s(e.replace(/[A-Z]/g,(function(t){return t.toLowerCase()}))),i=n.length,r=[],o=0,a=0;a<i;){for(var l=t,c=null,u=0,p=null,h=-1,d=-1;a<i&&(c=T(l,n[a]));)(l=c).accepts()?(h=0,d=0,p=l):h>=0&&(h+=n[a].length,d++),
u+=n[a].length,o+=n[a].length,a++;o-=h,a-=d,u-=h,r.push({t:p.t,v:e.substr(o-u,u),s:o-u,e:o})}return r}function s(t){for(var e=[],n=t.length,i=0;i<n;){var s=t.charCodeAt(i),r=void 0,o=s<55296||s>56319||i+1===n||(r=t.charCodeAt(i+1))<56320||r>57343?t[i]:t.slice(i,i+2);e.push(o),i+=o.length}return e}function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t){t=t||{},this.defaultProtocol="defaultProtocol"in t?t.defaultProtocol:At.defaultProtocol,this.events="events"in t?t.events:At.events,this.format="format"in t?t.format:At.format,this.formatHref="formatHref"in t?t.formatHref:At.formatHref,this.nl2br="nl2br"in t?t.nl2br:At.nl2br,this.tagName="tagName"in t?t.tagName:At.tagName,this.target="target"in t?t.target:At.target,this.rel="rel"in t?t.rel:At.rel,this.validate="validate"in t?t.validate:At.validate,this.truncate="truncate"in t?t.truncate:At.truncate,this.className="className"in t?t.className:At.className,this.attributes=t.attributes||At.attributes,this.ignoreTags=[];for(var e=("ignoreTags"in t?t.ignoreTags:At.ignoreTags),n=0;n<e.length;n++)this.ignoreTags.push(e[n].toUpperCase())}function a(t){return t}function l(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=Object.create(t.prototype);for(var s in n)i[s]=n[s];return i.constructor=e,e.prototype=i,e}function c(){}function u(t,e){function n(e,n){this.t=t,this.v=e,this.tk=n}return l(c,n,e),n}function p(){var t=w(),e=w(),n=w(),i=w(),s=w(),r=w(),o=w(),a=k(Dt),l=w(),c=k(Dt),u=k(Dt),p=w(),h=w(),d=w(),f=w(),m=w(),g=k(Dt),v=k(Dt),y=k(Dt),b=k(Dt),_=w(),C=w(),T=w(),x=w(),j=w(),M=w(),gt=k(St),vt=w(),yt=k(St),bt=k(Tt),_t=w(),wt=w(),kt=w(),At=w(),Ct=k(jt);A(t,R,Ct),A(t,O,e),A(t,N,n),A(e,ht,i),A(i,ht,s),A(t,E,r),A(t,D,r),A(t,P,a),A(t,I,r),A(s,E,u),A(s,D,u),A(s,I,u),A(s,P,u),A(r,et,o),A(j,et,M),A(o,E,a),A(o,D,r),A(o,I,r),A(o,P,r),A(M,E,gt),A(M,D,j),A(M,I,j),A(M,P,j),A(a,et,o),A(gt,et,M),A(a,Z,l),A(a,ht,u),A(l,I,c),A(c,ht,u),A(gt,Z,vt),A(vt,I,yt);var xt=[H,V,G,K,Y,X,tt,D,nt,st,P,I,rt,ot,at,lt,O,ht,mt,dt,E,ft],Pt=[J,q,z,U,W,Z,Q,et,it,$,L,F,B,ct,ut,pt];A(u,L,h),A(u,F,d),A(u,$,f),A(u,B,m),A(p,L,h),A(p,F,d),A(p,$,f),A(p,B,m),A(h,z,u),A(d,U,u),A(f,q,u),A(m,W,u),A(g,z,u),A(v,U,u),A(y,q,u),A(b,W,u),A(_,z,u),A(C,U,u),A(T,q,u),A(x,W,u),S(h,xt,g),S(d,xt,v),S(f,xt,y),S(m,xt,b),S(h,Pt,_),S(d,Pt,C),S(f,Pt,T),S(m,Pt,x),S(g,xt,g),S(v,xt,v),S(y,xt,y),S(b,xt,b),S(g,Pt,g),S(v,Pt,v),S(y,Pt,y),S(b,Pt,b),S(_,xt,g),S(C,xt,v),S(T,xt,y),S(x,xt,b),S(_,Pt,_),S(C,Pt,C),S(T,Pt,T),S(x,Pt,x),S(u,xt,u),S(p,xt,u),S(u,Pt,p),S(p,Pt,p),A(n,E,bt),A(n,D,bt),A(n,I,bt),A(n,P,bt),S(bt,xt,bt),S(bt,Pt,_t),S(_t,xt,bt),S(_t,Pt,_t);var Et=[H,J,V,K,Y,X,z,tt,D,nt,st,I,L,rt,ot,at,lt,ct,ht,mt,dt,E,ft];return S(r,Et,wt),A(r,G,kt),S(a,Et,wt),A(a,G,kt),S(o,Et,wt),S(wt,Et,wt),A(wt,G,kt),A(wt,et,At),S(At,Et,wt),A(kt,E,j),A(kt,D,j),A(kt,I,j),A(kt,P,gt),t}function h(t,e,n){for(var i=n.length,s=0,r=[],o=[];s<i;){for(var a=t,l=null,c=null,u=0,p=null,h=-1;s<i&&!(l=T(a,n[s].t));)o.push(n[s++]);for(;s<i&&(c=l||T(a,n[s].t));)l=null,(a=c).accepts()?(h=0,p=a):h>=0&&h++,s++,u++;if(h<0)for(var f=s-u;f<s;f++)o.push(n[f]);else{o.length>0&&(r.push(d(xt,e,o)),o=[]),s-=h,u-=h;var m=p.t,g=n.slice(s-u,s);r.push(d(m,e,g))}}return o.length>0&&r.push(d(xt,e,o)),r}function d(t,e,n){var i=n[0].s,s=n[n.length-1].e;return new t(e.substr(i,s-i),n)}function f(){It.scanner=null,It.parser=null,It.pluginQueue=[],It.customProtocols=[],It.initialized=!1}function m(t,e){for(var n=0;n<It.pluginQueue.length;n++)if(t===It.pluginQueue[n][0])return Et('linkifyjs: plugin "'.concat(t,'" already registered - will be overwritten')),void(It.pluginQueue[n]=[t,e]);It.pluginQueue.push([t,e]),It.initialized&&Et('linkifyjs: already initialized - will not register plugin "'.concat(t,'" until you manually call linkify.init(). To avoid this warning, please register all plugins before invoking linkify the first time.'))}function g(t){if(It.initialized&&Et('linkifyjs: already initialized - will not register custom protocol "'.concat(t,'" until you manually call linkify.init(). To avoid this warning, please register all custom protocols before invoking linkify the first time.')),!/^[a-z-]+$/.test(t))throw Error("linkifyjs: protocols containing characters other than a-z or - (hyphen) are not supported");It.customProtocols.push(t)}function v(){It.scanner={start:n(It.customProtocols),tokens:gt},It.parser={start:p(),tokens:Pt};for(var t={createTokenClass:u},e=0;e<It.pluginQueue.length;e++)It.pluginQueue[e][1]({scanner:It.scanner,parser:It.parser,utils:t});It.initialized=!0}function y(t){return It.initialized||v(),h(It.parser.start,t,i(It.scanner.start,t))}function b(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=y(t),i=[],s=0;s<n.length;s++){var r=n[s];!r.isLink||e&&r.t!==e||i.push(r.toObject())}return i}function _(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=y(t);return 1===n.length&&n[0].isLink&&(!e||n[0].t===e)}e.prototype={accepts:function(){return!!this.t},tt:function(t,e){if(e&&e.j)return this.j[t]=e,e;var n=e,i=this.j[t];if(i)return n&&(i.t=n),i;i=w();var s=T(this,t);return s?(Object.assign(i.j,s.j),i.jr.append(s.jr),i.jr=s.jd,i.t=n||s.t):i.t=n,this.j[t]=i,i}};var w=function(){return new e},k=function(t){return new e(t)},A=function(t,e,n){t.j[e]||(t.j[e]=n)},C=function(t,e,n){t.jr.push([e,n])},T=function(t,e){var n=t.j[e];if(n)return n;for(var i=0;i<t.jr.length;i++){var s=t.jr[i][0],r=t.jr[i][1];if(s.test(e))return r}return t.jd},S=function(t,e,n){for(var i=0;i<e.length;i++)A(t,e[i],n)},x=function(t,e){for(var n=0;n<e.length;n++){var i=e[n][0],s=e[n][1];A(t,i,s)}},j=function(t,e,n,i){for(var s,r=0,o=e.length;r<o&&(s=t.j[e[r]]);)t=s,r++;if(r>=o)return[];for(;r<o-1;)s=i(),A(t,e[r],s),t=s,r++;A(t,e[o-1],n)},D="DOMAIN",P="LOCALHOST",E="TLD",I="NUM",O="PROTOCOL",N="MAILTO",M="WS",R="NL",L="OPENBRACE",F="OPENBRACKET",$="OPENANGLEBRACKET",B="OPENPAREN",z="CLOSEBRACE",U="CLOSEBRACKET",q="CLOSEANGLEBRACKET",W="CLOSEPAREN",H="AMPERSAND",J="APOSTROPHE",V="ASTERISK",G="AT",K="BACKSLASH",Y="BACKTICK",X="CARET",Z="COLON",Q="COMMA",tt="DOLLAR",et="DOT",nt="EQUALS",it="EXCLAMATION",st="HYPHEN",rt="PERCENT",ot="PIPE",at="PLUS",lt="POUND",ct="QUERY",ut="QUOTE",pt="SEMI",ht="SLASH",dt="TILDE",ft="UNDERSCORE",mt="SYM",gt=Object.freeze({__proto__:null,DOMAIN:D,LOCALHOST:P,TLD:E,NUM:I,PROTOCOL:O,MAILTO:N,WS:M,NL:R,OPENBRACE:L,OPENBRACKET:F,OPENANGLEBRACKET:$,OPENPAREN:B,CLOSEBRACE:z,CLOSEBRACKET:U,CLOSEANGLEBRACKET:q,CLOSEPAREN:W,AMPERSAND:H,APOSTROPHE:J,ASTERISK:V,AT:G,BACKSLASH:K,BACKTICK:Y,CARET:X,COLON:Z,COMMA:Q,DOLLAR:tt,DOT:et,EQUALS:nt,EXCLAMATION:it,HYPHEN:st,PERCENT:rt,PIPE:ot,PLUS:at,POUND:lt,QUERY:ct,QUOTE:ut,SEMI:pt,SLASH:ht,TILDE:dt,UNDERSCORE:ft,SYM:mt}),vt="aaa aarp abarth abb abbott abbvie abc able abogado abudhabi ac academy accenture accountant accountants aco actor ad adac ads adult ae aeg aero aetna af afamilycompany afl africa ag agakhan agency ai aig airbus airforce airtel akdn al alfaromeo alibaba alipay allfinanz allstate ally alsace alstom am amazon americanexpress americanfamily amex amfam amica amsterdam analytics android anquan anz ao aol apartments app apple aq aquarelle ar arab aramco archi army arpa art arte as asda asia associates at athleta attorney au auction audi audible audio auspost author auto autos avianca aw aws ax axa az azure ba baby baidu banamex bananarepublic band bank bar barcelona barclaycard barclays barefoot bargains baseball basketball bauhaus bayern bb bbc bbt bbva bcg bcn bd be beats beauty beer bentley berlin best bestbuy bet bf bg bh bharti bi bible bid bike bing bingo bio biz bj black blackfriday blockbuster blog bloomberg blue bm bms bmw bn bnpparibas bo boats boehringer bofa bom bond boo book booking bosch bostik boston bot boutique box br bradesco bridgestone broadway broker brother brussels bs bt budapest bugatti build builders business buy buzz bv bw by bz bzh ca cab cafe cal call calvinklein cam camera camp cancerresearch canon capetown capital capitalone car caravan cards care career careers cars casa case cash casino cat catering catholic cba cbn cbre cbs cc cd center ceo cern cf cfa cfd cg ch chanel channel charity chase chat cheap chintai christmas chrome church ci cipriani circle cisco citadel citi citic city cityeats ck cl claims cleaning click clinic clinique clothing cloud club clubmed cm cn co coach codes coffee college cologne com comcast commbank community company compare computer comsec condos construction consulting contact contractors cooking cookingchannel cool coop corsica country coupon coupons courses cpa cr credit creditcard creditunion cricket crown crs cruise cruises csc cu cuisinella cv cw cx cy cymru cyou cz dabur dad dance data date dating datsun day dclk dds de deal dealer deals degree delivery dell deloitte delta democrat dental dentist desi design dev dhl diamonds diet digital direct directory discount discover dish diy dj dk dm dnp do docs doctor dog domains dot download drive dtv dubai duck dunlop dupont durban dvag dvr dz earth eat ec eco edeka edu education ee eg email emerck energy engineer engineering enterprises epson equipment er ericsson erni es esq estate et etisalat eu eurovision eus events exchange expert exposed express extraspace fage fail fairwinds faith family fan fans farm farmers fashion fast fedex feedback ferrari ferrero fi fiat fidelity fido film final finance financial fire firestone firmdale fish fishing fit fitness fj fk flickr flights flir florist flowers fly fm fo foo food foodnetwork football ford forex forsale forum foundation fox fr free fresenius frl frogans frontdoor frontier ftr fujitsu fujixerox fun fund furniture futbol fyi ga gal gallery gallo gallup game games gap garden gay gb gbiz gd gdn ge gea gent genting george gf gg ggee gh gi gift gifts gives giving gl glade glass gle global globo gm gmail gmbh gmo gmx gn godaddy gold goldpoint golf goo goodyear goog google gop got gov gp gq gr grainger graphics gratis green gripe grocery group gs gt gu guardian gucci guge guide guitars guru gw gy hair hamburg hangout haus hbo hdfc hdfcbank health healthcare help helsinki here hermes hgtv hiphop hisamitsu hitachi hiv hk hkt hm hn hockey holdings holiday homedepot homegoods homes homesense honda horse hospital host hosting hot hoteles hotels hotmail house how hr hsbc ht hu hughes hyatt hyundai ibm icbc ice icu id ie ieee ifm ikano il im imamat imdb immo immobilien in inc industries infiniti info ing ink institute insurance insure int international intuit investments io ipiranga iq ir irish is ismaili ist istanbul it itau itv iveco jaguar java jcb je jeep jetzt jewelry jio jll jm jmp jnj jo jobs joburg jot joy jp jpmorgan jprs juegos juniper kaufen kddi ke kerryhotels kerrylogistics kerryproperties kfh kg kh ki kia kim kinder kindle kitchen kiwi km kn koeln komatsu kosher kp kpmg kpn kr krd kred kuokgroup kw ky kyoto kz la lacaixa lamborghini lamer lancaster lancia land landrover lanxess lasalle lat latino latrobe law lawyer lb lc lds lease leclerc lefrak legal lego lexus lgbt li lidl life lifeinsurance lifestyle lighting like lilly limited limo lincoln linde link lipsy live living lixil lk llc llp loan loans locker locus loft lol london lotte lotto love lpl lplfinancial lr ls lt ltd ltda lu lundbeck luxe luxury lv ly ma macys madrid maif maison makeup man management mango map market marketing markets marriott marshalls maserati mattel mba mc mckinsey md me med media meet melbourne meme memorial men menu merckmsd mg mh miami microsoft mil mini mint mit mitsubishi mk ml mlb mls mm mma mn mo mobi mobile moda moe moi mom monash money monster mormon mortgage moscow moto motorcycles mov movie mp mq mr ms msd mt mtn mtr mu museum mutual mv mw mx my mz na nab nagoya name nationwide natura navy nba nc ne nec net netbank netflix network neustar new news next nextdirect nexus nf nfl ng ngo nhk ni nico nike nikon ninja nissan nissay nl no nokia northwesternmutual norton now nowruz nowtv np nr nra nrw ntt nu nyc nz obi observer off office okinawa olayan olayangroup oldnavy ollo om omega one ong onl online onyourside ooo open oracle orange org organic origins osaka otsuka ott ovh pa page panasonic paris pars partners parts party passagens pay pccw pe pet pf pfizer pg ph pharmacy phd philips phone photo photography photos physio pics pictet pictures pid pin ping pink pioneer pizza pk pl place play playstation plumbing plus pm pn pnc pohl poker politie porn post pr pramerica praxi press prime pro prod productions prof progressive promo properties property protection pru prudential ps pt pub pw pwc py qa qpon quebec quest qvc racing radio raid re read realestate realtor realty recipes red redstone redumbrella rehab reise reisen reit reliance ren rent rentals repair report republican rest restaurant review reviews rexroth rich richardli ricoh ril rio rip rmit ro rocher rocks rodeo rogers room rs rsvp ru rugby ruhr run rw rwe ryukyu sa saarland safe safety sakura sale salon samsclub samsung sandvik sandvikcoromant sanofi sap sarl sas save saxo sb sbi sbs sc sca scb schaeffler schmidt scholarships school schule schwarz science scjohnson scot sd se search seat secure security seek select sener services ses seven sew sex sexy sfr sg sh shangrila sharp shaw shell shia shiksha shoes shop shopping shouji show showtime si silk sina singles site sj sk ski skin sky skype sl sling sm smart smile sn sncf so soccer social softbank software sohu solar solutions song sony soy spa space sport spot spreadbetting sr srl ss st stada staples star statebank statefarm stc stcgroup stockholm storage store stream studio study style su sucks supplies supply support surf surgery suzuki sv swatch swiftcover swiss sx sy sydney systems sz tab taipei talk taobao target tatamotors tatar tattoo tax taxi tc tci td tdk team tech technology tel temasek tennis teva tf tg th thd theater theatre tiaa tickets tienda tiffany tips tires tirol tj tjmaxx tjx tk tkmaxx tl tm tmall tn to today tokyo tools top toray toshiba total tours town toyota toys tr trade trading training travel travelchannel travelers travelersinsurance trust trv tt tube tui tunes tushu tv tvs tw tz ua ubank ubs ug uk unicom university uno uol ups us uy uz va vacations vana vanguard vc ve vegas ventures verisign versicherung vet vg vi viajes video vig viking villas vin vip virgin visa vision viva vivo vlaanderen vn vodka volkswagen volvo vote voting voto voyage vu vuelos wales walmart walter wang wanggou watch watches weather weatherchannel webcam weber website wed wedding weibo weir wf whoswho wien wiki williamhill win windows wine winners wme wolterskluwer woodside work works world wow ws wtc wtf xbox xerox xfinity xihuan xin xxx xyz yachts yahoo yamaxun yandex ye yodobashi yoga yokohama you youtube yt yun za zappos zara zero zip zm zone zuerich zw verm\xf6gensberater-ctb verm\xf6gensberatung-pwb \u03b5\u03bb \u03b5\u03c5 \u0431\u0433 \u0431\u0435\u043b \u0434\u0435\u0442\u0438 \u0435\u044e \u043a\u0430\u0442\u043e\u043b\u0438\u043a \u043a\u043e\u043c \u049b\u0430\u0437 \u043c\u043a\u0434 \u043c\u043e\u043d \u043c\u043e\u0441\u043a\u0432\u0430 \u043e\u043d\u043b\u0430\u0439\u043d \u043e\u0440\u0433 \u0440\u0443\u0441 \u0440\u0444 \u0441\u0430\u0439\u0442 \u0441\u0440\u0431 \u0443\u043a\u0440 \u10d2\u10d4 \u0570\u0561\u0575 \u05d9\u05e9\u05e8\u05d0\u05dc \u05e7\u05d5\u05dd \u0627\u0628\u0648\u0638\u0628\u064a \u0627\u062a\u0635\u0627\u0644\u0627\u062a \u0627\u0631\u0627\u0645\u0643\u0648 \u0627\u0644\u0627\u0631\u062f\u0646 \u0627\u0644\u0628\u062d\u0631\u064a\u0646 \u0627\u0644\u062c\u0632\u0627\u0626\u0631 \u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629 \u0627\u0644\u0639\u0644\u064a\u0627\u0646 \u0627\u0644\u0645\u063a\u0631\u0628 \u0627\u0645\u0627\u0631\u0627\u062a \u0627\u06cc\u0631\u0627\u0646 \u0628\u0627\u0631\u062a \u0628\u0627\u0632\u0627\u0631 \u0628\u06be\u0627\u0631\u062a \u0628\u064a\u062a\u0643 \u067e\u0627\u06a9\u0633\u062a\u0627\u0646 \u0680\u0627\u0631\u062a \u062a\u0648\u0646\u0633 \u0633\u0648\u062f\u0627\u0646 \u0633\u0648\u0631\u064a\u0629 \u0634\u0628\u0643\u0629 \u0639\u0631\u0627\u0642 \u0639\u0631\u0628 \u0639\u0645\u0627\u0646 \u0641\u0644\u0633\u0637\u064a\u0646 \u0642\u0637\u0631 \u0643\u0627\u062b\u0648\u0644\u064a\u0643 \u0643\u0648\u0645 \u0645\u0635\u0631 \u0645\u0644\u064a\u0633\u064a\u0627 \u0645\u0648\u0631\u064a\u062a\u0627\u0646\u064a\u0627 \u0645\u0648\u0642\u0639 \u0647\u0645\u0631\u0627\u0647 \u0915\u0949\u092e \u0928\u0947\u091f \u092d\u093e\u0930\u0924 \u092d\u093e\u0930\u0924\u092e\u094d \u092d\u093e\u0930\u094b\u0924 \u0938\u0902\u0917\u0920\u0928 \u09ac\u09be\u0982\u09b2\u09be \u09ad\u09be\u09b0\u09a4 \u09ad\u09be\u09f0\u09a4 \u0a2d\u0a3e\u0a30\u0a24 \u0aad\u0abe\u0ab0\u0aa4 \u0b2d\u0b3e\u0b30\u0b24 \u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe \u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8 \u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd \u0c2d\u0c3e\u0c30\u0c24\u0c4d \u0cad\u0cbe\u0cb0\u0ca4 \u0d2d\u0d3e\u0d30\u0d24\u0d02 \u0dbd\u0d82\u0d9a\u0dcf \u0e04\u0e2d\u0e21 \u0e44\u0e17\u0e22 \u0ea5\u0eb2\u0ea7 \ub2f7\ub137 \ub2f7\ucef4 \uc0bc\uc131 \ud55c\uad6d \u30a2\u30de\u30be\u30f3 \u30b0\u30fc\u30b0\u30eb \u30af\u30e9\u30a6\u30c9 \u30b3\u30e0 \u30b9\u30c8\u30a2 \u30bb\u30fc\u30eb \u30d5\u30a1\u30c3\u30b7\u30e7\u30f3 \u30dd\u30a4\u30f3\u30c8 \u307f\u3093\u306a \u4e16\u754c \u4e2d\u4fe1 \u4e2d\u56fd \u4e2d\u570b \u4e2d\u6587\u7f51 \u4e9a\u9a6c\u900a \u4f01\u4e1a \u4f5b\u5c71 \u4fe1\u606f \u5065\u5eb7 \u516b\u5366 \u516c\u53f8 \u516c\u76ca \u53f0\u6e7e \u53f0\u7063 \u5546\u57ce \u5546\u5e97 \u5546\u6807 \u5609\u91cc \u5609\u91cc\u5927\u9152\u5e97 \u5728\u7ebf \u5927\u4f17\u6c7d\u8f66 \u5927\u62ff \u5929\u4e3b\u6559 \u5a31\u4e50 \u5bb6\u96fb \u5e7f\u4e1c \u5fae\u535a \u6148\u5584 \u6211\u7231\u4f60 \u624b\u673a \u62db\u8058 \u653f\u52a1 \u653f\u5e9c \u65b0\u52a0\u5761 \u65b0\u95fb \u65f6\u5c1a \u66f8\u7c4d \u673a\u6784 \u6de1\u9a6c\u9521 \u6e38\u620f \u6fb3\u9580 \u70b9\u770b \u79fb\u52a8 \u7ec4\u7ec7\u673a\u6784 \u7f51\u5740 \u7f51\u5e97 \u7f51\u7ad9 \u7f51\u7edc \u8054\u901a \u8bfa\u57fa\u4e9a \u8c37\u6b4c \u8d2d\u7269 \u901a\u8ca9 \u96c6\u56e2 \u96fb\u8a0a\u76c8\u79d1 \u98de\u5229\u6d66 \u98df\u54c1 \u9910\u5385 \u9999\u683c\u91cc\u62c9 \u9999\u6e2f".split(" "),yt=/(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/,bt=/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDD-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC5\uDED0-\uDED9\uDEE0-\uDEE7\uDEF0-\uDEF6])/,_t=/\uFE0F/,wt=/\d/,kt=/\s/,At={defaultProtocol:"http",events:null,format:a,formatHref:a,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:0,className:null,attributes:null,ignoreTags:[]};o.prototype={resolve:function(t){var e=t.toHref(this.defaultProtocol);return{formatted:this.get("format",t.toString(),t),formattedHref:this.get("formatHref",e,t),tagName:this.get("tagName",e,t),className:this.get("className",e,t),target:this.get("target",e,t),rel:this.get("rel",e,t),events:this.getObject("events",e,t),attributes:this.getObject("attributes",e,t),truncate:this.get("truncate",e,t)}},check:function(t){return this.get("validate",t.toString(),t)},get:function(t,e,n){var i,s=this[t];if(!s)return s;switch(r(s)){case"function":return s(e,n.t);case"object":return"function"==typeof(i=n.t in s?s[n.t]:At[t])?i(e,n.t):i}return s},getObject:function(t,e,n){var i=this[t];return"function"==typeof i?i(e,n.t):i}};var Ct=Object.freeze({__proto__:null,defaults:At,Options:o});c.prototype={t:"token",isLink:!1,toString:function(){return this.v},toHref:function(){return this.toString()},startIndex:function(){return this.tk[0].s},endIndex:function(){return this.tk[this.tk.length-1].e},toObject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:At.defaultProtocol;return{type:this.t,value:this.v,isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}}};var Tt=u("email",{isLink:!0}),St=u("email",{isLink:!0,toHref:function(){return"mailto:"+this.toString()}}),xt=u("text"),jt=u("nl"),Dt=u("url",{isLink:!0,toHref:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:At.defaultProtocol,e=this.tk,n=!1,i=!1,s=[],r=0;e[r].t===O;)n=!0,s.push(e[r].v),r++;for(;e[r].t===ht;)i=!0,s.push(e[r].v),r++;for(;r<e.length;r++)s.push(e[r].v);return s=s.join(""),n||i||(s="".concat(t,"://").concat(s)),s},hasProtocol:function(){return this.tk[0].t===O}}),Pt=Object.freeze({__proto__:null,MultiToken:c,Base:c,createTokenClass:u,MailtoEmail:Tt,Email:St,Text:xt,Nl:jt,Url:Dt}),Et=void 0!==console&&console&&console.warn||function(){},It={scanner:null,parser:null,pluginQueue:[],customProtocols:[],initialized:!1};return t.Options=o,t.find=b,t.init=v,t.options=Ct,t.registerCustomProtocol=g,t.registerPlugin=m,t.reset=f,t.test=_,t.tokenize=y,Object.defineProperty(t,"__esModule",{value:!0}),t}({}),linkifyStr=function(t){"use strict";function e(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n(t){return t.replace(/"/g,"&quot;")}function i(t){if(!t)return"";var e=[];for(var i in t){var s=t[i]+"";e.push("".concat(i,'="').concat(n(s),'"'))}return e.join(" ")}function s(s){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r=new t.Options(r);for(var o=t.tokenize(s),a=[],l=0;l<o.length;l++){var c=o[l];if("nl"===c.t&&r.nl2br)a.push("<br>\n");else if(c.isLink&&r.check(c)){var u=r.resolve(c),p=u.formatted,h=u.formattedHref,d=u.tagName,f=u.className,m=u.target,g=u.rel,v=u.attributes,y=["<".concat(d,' href="').concat(n(h),'"')];f&&y.push(' class="'.concat(n(f),'"')),m&&y.push(' target="'.concat(n(m),'"')),g&&y.push(' rel="'.concat(n(g),'"')),v&&y.push(" ".concat(i(v))),y.push(">".concat(e(p),"</").concat(d,">")),a.push(y.join(""))}else a.push(e(c.toString()))}return a.join("")}return String.prototype.linkify||Object.defineProperty(String.prototype,"linkify",{writable:!1,value:function(t){return s(this,t)}}),s}(linkify),qrcodegen;(function(){function t(t){this.tokens=[],this.tokens.links={},this.options=t||c.defaults,this.rules=u.normal,this.options.gfm&&(this.options.tables?this.rules=u.tables:this.rules=u.gfm)}function e(t,e){if(this.options=e||c.defaults,this.links=t,this.rules=p.normal,this.renderer=this.options.renderer||new n,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=p.breaks:this.rules=p.gfm:this.options.pedantic&&(this.rules=p.pedantic)}function n(t){this.options=t||{}}function i(t){this.tokens=[],this.token=null,this.options=t||c.defaults,this.options.renderer=this.options.renderer||new n,this.renderer=this.options.renderer,this.renderer.options=this.options}function s(t,e){return t.replace(e?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function r(t){return t.replace(/&([#\w]+);/g,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}function o(t,e){return t=t.source,e=e||"",function n(i,s){return i?(s=(s=s.source||s).replace(/(^|[^\[])\^/g,"$1"),t=t.replace(i,s),n):new RegExp(t,e)}}function a(){}function l(t){for(var e,n,i=1;i<arguments.length;i++)for(n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function c(e,n,r){if(r||"function"==typeof n){r||(r=n,n=null);var o,a,u=(n=l({},c.defaults,n||{})).highlight,p=0;try{o=t.lex(e,n)}catch(t){return r(t)}a=o.length
;var h=function(t){if(t)return n.highlight=u,r(t);var e;try{e=i.parse(o,n)}catch(e){t=e}return n.highlight=u,t?r(t):r(null,e)};if(!u||u.length<3)return h();if(delete n.highlight,!a)return h();for(;p<o.length;p++)!function(t){"code"!==t.type?--a||h():u(t.text,t.lang,(function(e,n){return e?h(e):null==n||n===t.text?--a||h():(t.text=n,t.escaped=!0,void(--a||h()))}))}(o[p])}else try{return n&&(n=l({},c.defaults,n)),i.parse(t.lex(e,n),n)}catch(t){if(t.message+="\nPlease report this to https://github.com/chjj/marked.",(n||c.defaults).silent)return"<p>An error occured:</p><pre>"+s(t.message+"",!0)+"</pre>";throw t}}var u={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:a,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:a,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:a,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};u.item=o(u.item,"gm")(/bull/g,u.bullet)(),u.list=o(u.list)(/bull/g,u.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+u.def.source+")")(),u.blockquote=o(u.blockquote)("def",u.def)(),u._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",u.html=o(u.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,u._tag)(),u.paragraph=o(u.paragraph)("hr",u.hr)("heading",u.heading)("lheading",u.lheading)("blockquote",u.blockquote)("tag","<"+u._tag)("def",u.def)(),u.normal=l({},u),u.gfm=l({},u.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),u.gfm.paragraph=o(u.paragraph)("(?!","(?!"+u.gfm.fences.source.replace("\\1","\\2")+"|"+u.list.source.replace("\\1","\\3")+"|")(),u.tables=l({},u.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=u,t.lex=function(e,n){return new t(n).lex(e)},t.prototype.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(t,!0)},t.prototype.token=function(t,e,n){var i,s,r,o,a,l,c,p,h;for(t=t.replace(/^ +$/gm,"");t;)if((r=this.rules.newline.exec(t))&&(t=t.substring(r[0].length),r[0].length>1&&this.tokens.push({type:"space"})),r=this.rules.code.exec(t))t=t.substring(r[0].length),r=r[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?r:r.replace(/\n+$/,"")});else if(r=this.rules.fences.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"code",lang:r[2],text:r[3]||""});else if(r=this.rules.heading.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"heading",depth:r[1].length,text:r[2]});else if(e&&(r=this.rules.nptable.exec(t))){for(t=t.substring(r[0].length),l={type:"table",header:r[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:r[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:r[3].replace(/\n$/,"").split("\n")},p=0;p<l.align.length;p++)/^ *-+: *$/.test(l.align[p])?l.align[p]="right":/^ *:-+: *$/.test(l.align[p])?l.align[p]="center":/^ *:-+ *$/.test(l.align[p])?l.align[p]="left":l.align[p]=null;for(p=0;p<l.cells.length;p++)l.cells[p]=l.cells[p].split(/ *\| */);this.tokens.push(l)}else if(r=this.rules.lheading.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"heading",depth:"="===r[2]?1:2,text:r[1]});else if(r=this.rules.hr.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"hr"});else if(r=this.rules.blockquote.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"blockquote_start"}),r=r[0].replace(/^ *> ?/gm,""),this.token(r,e,!0),this.tokens.push({type:"blockquote_end"});else if(r=this.rules.list.exec(t)){for(t=t.substring(r[0].length),o=r[2],this.tokens.push({type:"list_start",ordered:o.length>1}),i=!1,h=(r=r[0].match(this.rules.item)).length,p=0;p<h;p++)c=(l=r[p]).length,~(l=l.replace(/^ *([*+-]|\d+\.) +/,"")).indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&p!==h-1&&(o===(a=u.bullet.exec(r[p+1])[0])||o.length>1&&a.length>1||(t=r.slice(p+1).join("\n")+t,p=h-1)),s=i||/\n\n(?!\s*$)/.test(l),p!==h-1&&(i="\n"===l.charAt(l.length-1),s||(s=i)),this.tokens.push({type:s?"loose_item_start":"list_item_start"}),this.token(l,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(r=this.rules.html.exec(t))t=t.substring(r[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===r[1]||"script"===r[1]||"style"===r[1]),text:r[0]});else if(!n&&e&&(r=this.rules.def.exec(t)))t=t.substring(r[0].length),this.tokens.links[r[1].toLowerCase()]={href:r[2],title:r[3]};else if(e&&(r=this.rules.table.exec(t))){for(t=t.substring(r[0].length),l={type:"table",header:r[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:r[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:r[3].replace(/(?: *\| *)?\n$/,"").split("\n")},p=0;p<l.align.length;p++)/^ *-+: *$/.test(l.align[p])?l.align[p]="right":/^ *:-+: *$/.test(l.align[p])?l.align[p]="center":/^ *:-+ *$/.test(l.align[p])?l.align[p]="left":l.align[p]=null;for(p=0;p<l.cells.length;p++)l.cells[p]=l.cells[p].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(e&&(r=this.rules.paragraph.exec(t)))t=t.substring(r[0].length),this.tokens.push({type:"paragraph",text:"\n"===r[1].charAt(r[1].length-1)?r[1].slice(0,-1):r[1]});else if(r=this.rules.text.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"text",text:r[0]});else if(t)throw new Error("Infinite loop on byte: "+t.charCodeAt(0));return this.tokens};var p={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:a,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:a,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};p.link=o(p.link)("inside",p._inside)("href",p._href)(),p.reflink=o(p.reflink)("inside",p._inside)(),p.normal=l({},p),p.pedantic=l({},p.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),p.gfm=l({},p.normal,{escape:o(p.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:o(p.text)("]|","~]|")("|","|https?://|")()}),p.breaks=l({},p.gfm,{br:o(p.br)("{2,}","*")(),text:o(p.gfm.text)("{2,}","*")()}),e.rules=p,e.output=function(t,n,i){return new e(n,i).output(t)},e.prototype.output=function(t){for(var e,n,i,r,o="";t;)if(r=this.rules.escape.exec(t))t=t.substring(r[0].length),o+=r[1];else if(r=this.rules.autolink.exec(t))t=t.substring(r[0].length),"@"===r[2]?(n=":"===r[1].charAt(6)?this.mangle(r[1].substring(7)):this.mangle(r[1]),i=this.mangle("mailto:")+n):i=n=s(r[1]),o+=this.renderer.link(i,null,n);else if(this.inLink||!(r=this.rules.url.exec(t))){if(r=this.rules.tag.exec(t))!this.inLink&&/^<a /i.test(r[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(r[0])&&(this.inLink=!1),t=t.substring(r[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):s(r[0]):r[0];else if(r=this.rules.link.exec(t))t=t.substring(r[0].length),this.inLink=!0,o+=this.outputLink(r,{href:r[2],title:r[3]}),this.inLink=!1;else if((r=this.rules.reflink.exec(t))||(r=this.rules.nolink.exec(t))){if(t=t.substring(r[0].length),e=(r[2]||r[1]).replace(/\s+/g," "),!(e=this.links[e.toLowerCase()])||!e.href){o+=r[0].charAt(0),t=r[0].substring(1)+t;continue}this.inLink=!0,o+=this.outputLink(r,e),this.inLink=!1}else if(r=this.rules.strong.exec(t))t=t.substring(r[0].length),o+=this.renderer.strong(this.output(r[2]||r[1]));else if(r=this.rules.em.exec(t))t=t.substring(r[0].length),o+=this.renderer.em(this.output(r[2]||r[1]));else if(r=this.rules.code.exec(t))t=t.substring(r[0].length),o+=this.renderer.codespan(s(r[2],!0));else if(r=this.rules.br.exec(t))t=t.substring(r[0].length),o+=this.renderer.br();else if(r=this.rules.del.exec(t))t=t.substring(r[0].length),o+=this.renderer.del(this.output(r[1]));else if(r=this.rules.text.exec(t))t=t.substring(r[0].length),o+=this.renderer.text(s(this.smartypants(r[0])));else if(t)throw new Error("Infinite loop on byte: "+t.charCodeAt(0))}else t=t.substring(r[0].length),i=n=s(r[1]),o+=this.renderer.link(i,null,n);return o},e.prototype.outputLink=function(t,e){var n=s(e.href),i=e.title?s(e.title):null;return"!"!==t[0].charAt(0)?this.renderer.link(n,i,this.output(t[1])):this.renderer.image(n,i,s(t[1]))},e.prototype.smartypants=function(t){return this.options.smartypants?t.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201c").replace(/"/g,"\u201d").replace(/\.{3}/g,"\u2026"):t},e.prototype.mangle=function(t){if(!this.options.mangle)return t;for(var e,n="",i=t.length,s=0;s<i;s++)e=t.charCodeAt(s),Math.random()>.5&&(e="x"+e.toString(16)),n+="&#"+e+";";return n},n.prototype.code=function(t,e,n){if(this.options.highlight){var i=this.options.highlight(t,e);null!=i&&i!==t&&(n=!0,t=i)}return e?'<pre><code class="'+this.options.langPrefix+s(e,!0)+'">'+(n?t:s(t,!0))+"\n</code></pre>\n":"<pre><code>"+(n?t:s(t,!0))+"\n</code></pre>"},n.prototype.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},n.prototype.html=function(t){return t},n.prototype.heading=function(t,e,n){return"<h"+e+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+t+"</h"+e+">\n"},n.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},n.prototype.list=function(t,e){var n=e?"ol":"ul";return"<"+n+">\n"+t+"</"+n+">\n"},n.prototype.listitem=function(t){return"<li>"+t+"</li>\n"},n.prototype.paragraph=function(t){return"<p>"+t+"</p>\n"},n.prototype.table=function(t,e){return"<table>\n<thead>\n"+t+"</thead>\n<tbody>\n"+e+"</tbody>\n</table>\n"},n.prototype.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},n.prototype.tablecell=function(t,e){var n=e.header?"th":"td";return(e.align?"<"+n+' style="text-align:'+e.align+'">':"<"+n+">")+t+"</"+n+">\n"},n.prototype.strong=function(t){return"<strong>"+t+"</strong>"},n.prototype.em=function(t){return"<em>"+t+"</em>"},n.prototype.codespan=function(t){return"<code>"+t+"</code>"},n.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},n.prototype.del=function(t){return"<del>"+t+"</del>"},n.prototype.link=function(t,e,n){if(this.options.sanitize){try{var i=decodeURIComponent(r(t)).replace(/[^\w:]/g,"").toLowerCase()}catch(t){return""}if(0===i.indexOf("javascript:")||0===i.indexOf("vbscript:"))return""}var s='<a href="'+t+'"';return e&&(s+=' title="'+e+'"'),s+=">"+n+"</a>"},n.prototype.image=function(t,e,n){var i='<img src="'+t+'" alt="'+n+'"';return e&&(i+=' title="'+e+'"'),i+=this.options.xhtml?"/>":">"},n.prototype.text=function(t){return t},i.parse=function(t,e,n){return new i(e,n).parse(t)},i.prototype.parse=function(t){this.inline=new e(t.links,this.options,this.renderer),this.tokens=t.reverse();for(var n="";this.next();)n+=this.tok();return n},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var t=this.token.text;"text"===this.peek().type;)t+="\n"+this.next().text;return this.inline.output(t)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var t,e,n,i,s="",r="";for(n="",t=0;t<this.token.header.length;t++)({header:!0,align:this.token.align[t]}),n+=this.renderer.tablecell(this.inline.output(this.token.header[t]),{header:!0,align:this.token.align[t]});for(s+=this.renderer.tablerow(n),t=0;t<this.token.cells.length;t++){for(e=this.token.cells[t],n="",i=0;i<e.length;i++)n+=this.renderer.tablecell(this.inline.output(e[i]),{header:!1,align:this.token.align[i]});r+=this.renderer.tablerow(n)}return this.renderer.table(s,r);case"blockquote_start":for(r="";"blockquote_end"!==this.next().type;)r+=this.tok();return this.renderer.blockquote(r);case"list_start":r="";for(var o=this.token.ordered;"list_end"!==this.next().type;)r+=this.tok();return this.renderer.list(r,o);case"list_item_start":for(r="";"list_item_end"!==this.next().type;)r+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(r);case"loose_item_start":for(r="";"list_item_end"!==this.next().type;)r+=this.tok();return this.renderer.listitem(r);case"html":var a=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(a);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},a.exec=a,c.options=c.setOptions=function(t){return l(c.defaults,t),c},c.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new n,xhtml:!1},c.Parser=i,c.parser=i.parse,c.Renderer=n,c.Lexer=t,c.lexer=t.lex,c.InlineLexer=e,c.inlineLexer=e.output,c.parse=c,void 0!==module&&"object"==typeof exports?module.exports=c:"function"==typeof define&&define.amd?define((function(){return c})):this.marked=c}).call(function(){return this||("undefined"!=typeof window?window:global)}()),window.Modernizr=function(t,e,n){function i(t){g.cssText=t}function s(t,e){return typeof t===e}function r(t,e){return!!~(""+t).indexOf(e)}function o(t,e){for(var i in t){var s=t[i];if(!r(s,"-")&&g[s]!==n)return"pfx"!=e||s}return!1}function a(t,e,i){for(var r in t){var o=e[t[r]];if(o!==n)return!1===i?t[r]:s(o,"function")?o.bind(i||e):o}return!1}function l(t,e,n){var i=t.charAt(0).toUpperCase()+t.slice(1),r=(t+" "+y.join(i+" ")+i).split(" ");return s(e,"string")||s(e,"undefined")?o(r,e):a(r=(t+" "+b.join(i+" ")+i).split(" "),e,n)}var c,u,p="2.8.3",h={},d=e.documentElement,f="modernizr",m=e.createElement(f),g=m.style,v=({}.toString,"Webkit Moz O ms"),y=v.split(" "),b=v.toLowerCase().split(" "),_={},w=[],k=w.slice,A={}.hasOwnProperty;for(var C in u=s(A,"undefined")||s(A.call,"undefined")?function(t,e){return e in t&&s(t.constructor.prototype[e],"undefined")}:function(t,e){return A.call(t,e)},Function.prototype.bind||(Function.prototype.bind=function(t){var e=this;if("function"!=typeof e)throw new TypeError;var n=k.call(arguments,1),i=function(){if(this instanceof i){var s=function(){};s.prototype=e.prototype;var r=new s,o=e.apply(r,n.concat(k.call(arguments)));return Object(o)===o?o:r}return e.apply(t,n.concat(k.call(arguments)))};return i}),_)u(_,C)&&(c=C.toLowerCase(),h[c]=_[C](),w.push((h[c]?"":"no-")+c));return h.addTest=function(t,e){if("object"==typeof t)for(var i in t)u(t,i)&&h.addTest(i,t[i]);else{if(t=t.toLowerCase(),h[t]!==n)return h;e="function"==typeof e?e():e,"undefined"!=typeof enableClasses&&enableClasses&&(d.className+=" "+(e?"":"no-")+t),h[t]=e}return h},i(""),m=null,h._version=p,h._domPrefixes=b,h._cssomPrefixes=y,h.testProp=function(t){return o([t])},h.testAllProps=l,h.prefixed=function(t,e,n){return e?l(t,e,n):l(t,"pfx")},h}(0,this.document),function(t){function e(t,e,n){if(e<0||e>31||t>>>e!=0)throw new RangeError("Value out of range");for(var i=e-1;i>=0;i--)n.push(t>>>i&1)}function n(t,e){return 0!=(t>>>e&1)}function i(t){if(!t)throw new Error("Assertion error")}var s=function(){function s(t,e,n,r){if(this.version=t,this.errorCorrectionLevel=e,this.modules=[],this.isFunction=[],t<s.MIN_VERSION||t>s.MAX_VERSION)throw new RangeError("Version value out of range");if(r<-1||r>7)throw new RangeError("Mask value out of range");this.size=4*t+17;for(var o=[],a=0;a<this.size;a++)o.push(!1);for(a=0;a<this.size;a++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();var l=this.addEccAndInterleave(n);if(this.drawCodewords(l),-1==r){var c=1e9;for(a=0;a<8;a++){this.applyMask(a),this.drawFormatBits(a);var u=this.getPenaltyScore();u<c&&(r=a,c=u),this.applyMask(a)}}i(0<=r&&r<=7),this.mask=r,this.applyMask(r),this.drawFormatBits(r),this.isFunction=[]}return s.encodeText=function(e,n){var i=t.QrSegment.makeSegments(e);return s.encodeSegments(i,n)},s.encodeBinary=function(e,n){var i=t.QrSegment.makeBytes(e);return s.encodeSegments([i],n)},s.encodeSegments=function(t,n,o,a,l,c){if(void 0===o&&(o=1),void 0===a&&(a=40),void 0===l&&(l=-1),void 0===c&&(c=!0),!(s.MIN_VERSION<=o&&o<=a&&a<=s.MAX_VERSION)||l<-1||l>7)throw new RangeError("Invalid value");var u,p;for(u=o;;u++){var h=8*s.getNumDataCodewords(u,n),d=r.getTotalBits(t,u);if(d<=h){p=d;break}if(u>=a)throw new RangeError("Data too long")}for(var f=0,m=[s.Ecc.MEDIUM,s.Ecc.QUARTILE,s.Ecc.HIGH];f<m.length;f++){var g=m[f];c&&p<=8*s.getNumDataCodewords(u,g)&&(n=g)}for(var v=[],y=0,b=t;y<b.length;y++){var _=b[y];e(_.mode.modeBits,4,v),e(_.numChars,_.mode.numCharCountBits(u),v);for(var w=0,k=_.getData();w<k.length;w++){var A=k[w];v.push(A)}}i(v.length==p);var C=8*s.getNumDataCodewords(u,n);i(v.length<=C),e(0,Math.min(4,C-v.length),v),e(0,(8-v.length%8)%8,v),i(v.length%8==0);for(var T=236;v.length<C;T^=253)e(T,8,v);for(var S=[];8*S.length<v.length;)S.push(0);return v.forEach((function(t,e){return S[e>>>3]|=t<<7-(7&e)})),new s(u,n,S,l)},s.prototype.getModule=function(t,e){return 0<=t&&t<this.size&&0<=e&&e<this.size&&this.modules[e][t]},s.prototype.drawFunctionPatterns=function(){for(var t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);var e=this.getAlignmentPatternPositions(),n=e.length;for(t=0;t<n;t++)for(var i=0;i<n;i++)0==t&&0==i||0==t&&i==n-1||t==n-1&&0==i||this.drawAlignmentPattern(e[t],e[i]);this.drawFormatBits(0),this.drawVersion()},s.prototype.drawFormatBits=function(t){for(var e=this.errorCorrectionLevel.formatBits<<3|t,s=e,r=0;r<10;r++)s=s<<1^1335*(s>>>9);var o=21522^(e<<10|s);i(o>>>15==0);for(r=0;r<=5;r++)this.setFunctionModule(8,r,n(o,r));this.setFunctionModule(8,7,n(o,6)),this.setFunctionModule(8,8,n(o,7)),this.setFunctionModule(7,8,n(o,8));for(r=9;r<15;r++)this.setFunctionModule(14-r,8,n(o,r));for(r=0;r<8;r++)this.setFunctionModule(this.size-1-r,8,n(o,r));for(r=8;r<15;r++)this.setFunctionModule(8,this.size-15+r,n(o,r));this.setFunctionModule(8,this.size-8,!0)},s.prototype.drawVersion=function(){if(!(this.version<7)){for(var t=this.version,e=0;e<12;e++)t=t<<1^7973*(t>>>11);var s=this.version<<12|t;i(s>>>18==0);for(e=0;e<18;e++){var r=n(s,e),o=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(o,a,r),this.setFunctionModule(a,o,r)}}},s.prototype.drawFinderPattern=function(t,e){for(var n=-4;n<=4;n++)for(var i=-4;i<=4;i++){var s=Math.max(Math.abs(i),Math.abs(n)),r=t+i,o=e+n;0<=r&&r<this.size&&0<=o&&o<this.size&&this.setFunctionModule(r,o,2!=s&&4!=s)}},s.prototype.drawAlignmentPattern=function(t,e){for(var n=-2;n<=2;n++)for(var i=-2;i<=2;i++)this.setFunctionModule(t+i,e+n,1!=Math.max(Math.abs(i),Math.abs(n)))},s.prototype.setFunctionModule=function(t,e,n){this.modules[e][t]=n,this.isFunction[e][t]=!0},s.prototype.addEccAndInterleave=function(t){var e=this.version,n=this.errorCorrectionLevel;if(t.length!=s.getNumDataCodewords(e,n))throw new RangeError("Invalid argument");for(var r=s.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e],o=s.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e],a=Math.floor(s.getNumRawDataModules(e)/8),l=r-a%r,c=Math.floor(a/r),u=[],p=s.reedSolomonComputeDivisor(o),h=0,d=0;h<r;h++){var f=t.slice(d,d+c-o+(h<l?0:1));d+=f.length;var m=s.reedSolomonComputeRemainder(f,p);h<l&&f.push(0),u.push(f.concat(m))}var g=[],v=function(t){u.forEach((function(e,n){(t!=c-o||n>=l)&&g.push(e[t])}))};for(h=0;h<u[0].length;h++)v(h);return i(g.length==a),g},s.prototype.drawCodewords=function(t){if(t.length!=Math.floor(s.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var e=0,r=this.size-1;r>=1;r-=2){6==r&&(r=5);for(var o=0;o<this.size;o++)for(var a=0;a<2;a++){var l=r-a,c=0==(r+1&2)?this.size-1-o:o;!this.isFunction[c][l]&&e<8*t.length&&(this.modules[c][l]=n(t[e>>>3],7-(7&e)),e++)}}i(e==8*t.length)},s.prototype.applyMask=function(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(var e=0;e<this.size;e++)for(var n=0;n<this.size;n++){var i=void 0;switch(t){case 0:i=(n+e)%2==0;break;case 1:i=e%2==0;break;case 2:i=n%3==0;break;case 3:i=(n+e)%3==0;break;case 4:i=(Math.floor(n/3)+Math.floor(e/2))%2==0;break;case 5:i=n*e%2+n*e%3==0;break;case 6:i=(n*e%2+n*e%3)%2==0;break;case 7:i=((n+e)%2+n*e%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[e][n]&&i&&(this.modules[e][n]=!this.modules[e][n])}},s.prototype.getPenaltyScore=function(){for(var t=0,e=0;e<this.size;e++){for(var n=!1,r=0,o=[0,0,0,0,0,0,0],a=0;a<this.size;a++)this.modules[e][a]==n?5==++r?t+=s.PENALTY_N1:r>5&&t++:(this.finderPenaltyAddHistory(r,o),n||(t+=this.finderPenaltyCountPatterns(o)*s.PENALTY_N3),n=this.modules[e][a],r=1);t+=this.finderPenaltyTerminateAndCount(n,r,o)*s.PENALTY_N3}for(a=0;a<this.size;a++){n=!1;var l=0;for(o=[0,0,0,0,0,0,0],e=0;e<this.size;e++)this.modules[e][a]==n?5==++l?t+=s.PENALTY_N1:l>5&&t++:(this.finderPenaltyAddHistory(l,o),n||(t+=this.finderPenaltyCountPatterns(o)*s.PENALTY_N3),n=this.modules[e][a],l=1);t+=this.finderPenaltyTerminateAndCount(n,l,o)*s.PENALTY_N3}for(e=0;e<this.size-1;e++)for(a=0;a<this.size-1;a++){var c=this.modules[e][a];c==this.modules[e][a+1]&&c==this.modules[e+1][a]&&c==this.modules[e+1][a+1]&&(t+=s.PENALTY_N2)}for(var u=0,p=0,h=this.modules;p<h.length;p++){u=h[p].reduce((function(t,e){return t+(e?1:0)}),u)}var d=this.size*this.size,f=Math.ceil(Math.abs(20*u-10*d)/d)-1;return i(0<=f&&f<=9),i(0<=(t+=f*s.PENALTY_N4)&&t<=2568888),t},s.prototype.getAlignmentPatternPositions=function(){if(1==this.version)return[];for(var t=Math.floor(this.version/7)+2,e=32==this.version?26:2*Math.ceil((4*this.version+4)/(2*t-2)),n=[6],i=this.size-7;n.length<t;i-=e)n.splice(1,0,i);return n},s.getNumRawDataModules=function(t){if(t<s.MIN_VERSION||t>s.MAX_VERSION)throw new RangeError("Version number out of range");var e=(16*t+128)*t+64;if(t>=2){var n=Math.floor(t/7)+2;e-=(25*n-10)*n-55,t>=7&&(e-=36)}return i(208<=e&&e<=29648),e},s.getNumDataCodewords=function(t,e){return Math.floor(s.getNumRawDataModules(t)/8)-s.ECC_CODEWORDS_PER_BLOCK[e.ordinal][t]*s.NUM_ERROR_CORRECTION_BLOCKS[e.ordinal][t]},s.reedSolomonComputeDivisor=function(t){if(t<1||t>255)throw new RangeError("Degree out of range");for(var e=[],n=0;n<t-1;n++)e.push(0);e.push(1);var i=1;for(n=0;n<t;n++){for(var r=0;r<e.length;r++)e[r]=s.reedSolomonMultiply(e[r],i),r+1<e.length&&(e[r]^=e[r+1]);i=s.reedSolomonMultiply(i,2)}return e},s.reedSolomonComputeRemainder=function(t,e){for(var n=e.map((function(){return 0})),i=function(t){var i=t^n.shift();n.push(0),e.forEach((function(t,e){return n[e]^=s.reedSolomonMultiply(t,i)}))},r=0,o=t;r<o.length;r++){i(o[r])}return n},s.reedSolomonMultiply=function(t,e){if(t>>>8!=0||e>>>8!=0)throw new RangeError("Byte out of range");for(var n=0,s=7;s>=0;s--)n=n<<1^285*(n>>>7),n^=(e>>>s&1)*t;return i(n>>>8==0),n},s.prototype.finderPenaltyCountPatterns=function(t){var e=t[1];i(e<=3*this.size);var n=e>0&&t[2]==e&&t[3]==3*e&&t[4]==e&&t[5]==e;return(n&&t[0]>=4*e&&t[6]>=e?1:0)+(n&&t[6]>=4*e&&t[0]>=e?1:0)},s.prototype.finderPenaltyTerminateAndCount=function(t,e,n){return t&&(this.finderPenaltyAddHistory(e,n),e=0),e+=this.size,this.finderPenaltyAddHistory(e,n),this.finderPenaltyCountPatterns(n)},s.prototype.finderPenaltyAddHistory=function(t,e){0==e[0]&&(t+=this.size),e.pop(),e.unshift(t)},s.MIN_VERSION=1,s.MAX_VERSION=40,s.PENALTY_N1=3,s.PENALTY_N2=3,s.PENALTY_N3=40,s.PENALTY_N4=10,s.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],s.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],s}();t.QrCode=s;var r=function(){function t(t,e,n){if(this.mode=t,this.numChars=e,this.bitData=n,e<0)throw new RangeError("Invalid argument");this.bitData=n.slice()}return t.makeBytes=function(n){for(var i=[],s=0,r=n;s<r.length;s++){e(r[s],8,i)}return new t(t.Mode.BYTE,n.length,i)},t.makeNumeric=function(n){if(!t.isNumeric(n))throw new RangeError("String contains non-numeric characters");for(var i=[],s=0;s<n.length;){var r=Math.min(n.length-s,3);e(parseInt(n.substr(s,r),10),3*r+1,i),s+=r}return new t(t.Mode.NUMERIC,n.length,i)},t.makeAlphanumeric=function(n){if(!t.isAlphanumeric(n))throw new RangeError("String contains unencodable characters in alphanumeric mode");var i,s=[];for(i=0;i+2<=n.length;i+=2){var r=45*t.ALPHANUMERIC_CHARSET.indexOf(n.charAt(i));e(r+=t.ALPHANUMERIC_CHARSET.indexOf(n.charAt(i+1)),11,s)}return i<n.length&&e(t.ALPHANUMERIC_CHARSET.indexOf(n.charAt(i)),6,s),new t(t.Mode.ALPHANUMERIC,n.length,s)},t.makeSegments=function(e){return""==e?[]:t.isNumeric(e)?[t.makeNumeric(e)]:t.isAlphanumeric(e)?[t.makeAlphanumeric(e)]:[t.makeBytes(t.toUtf8ByteArray(e))]},t.makeEci=function(n){var i=[];if(n<0)throw new RangeError("ECI assignment value out of range");if(n<128)e(n,8,i);else if(n<16384)e(2,2,i),e(n,14,i);else{if(!(n<1e6))throw new RangeError("ECI assignment value out of range");e(6,3,i),e(n,21,i)}return new t(t.Mode.ECI,0,i)},t.isNumeric=function(e){return t.NUMERIC_REGEX.test(e)},t.isAlphanumeric=function(e){return t.ALPHANUMERIC_REGEX.test(e)},t.prototype.getData=function(){return this.bitData.slice()},t.getTotalBits=function(t,e){for(var n=0,i=0,s=t;i<s.length;i++){var r=s[i],o=r.mode.numCharCountBits(e);if(r.numChars>=1<<o)return 1/0;n+=4+o+r.bitData.length}return n},t.toUtf8ByteArray=function(t){t=encodeURI(t);for(var e=[],n=0;n<t.length;n++)"%"!=t.charAt(n)?e.push(t.charCodeAt(n)):(e.push(parseInt(t.substr(n+1,2),16)),n+=2);return e},t.NUMERIC_REGEX=/^[0-9]*$/,t.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,t.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",t}();t.QrSegment=r}(qrcodegen||(qrcodegen={})),function(t){!function(t){var e=function(){function t(t,e){this.ordinal=t,this.formatBits=e}return t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),t}();t.Ecc=e}(t.QrCode||(t.QrCode={}))}(qrcodegen||(qrcodegen={})),function(t){!function(t){var e=function(){function t(t,e){this.modeBits=t,this.numBitsCharCount=e}return t.prototype.numCharCountBits=function(t){return this.numBitsCharCount[Math.floor((t+7)/17)]},t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),t}();t.Mode=e}(t.QrSegment||(t.QrSegment={}))}(qrcodegen||(qrcodegen={})),function(t,e){function n(n,c,u){var d=[],y=o(r((c=1==c?{entropy:!0}:c||{}).entropy?[n,l(t)]:null==n?a():n,3),d),b=new i(d),_=function(){for(var t=b.g(h),e=m,n=0;t<g;)t=(t+n)*p,e*=p,n=b.g(1);for(;t>=v;)t/=2,e/=2,n>>>=1;return(t+n)/e};return _.int32=function(){return 0|b.g(4)},_.quick=function(){return b.g(4)/4294967296},_.double=_,o(l(b.S),t),(c.pass||u||function(t,n,i,r){return r&&(r.S&&s(r,b),t.state=function(){return s(b,{})}),i?(e[f]=t,n):t})(_,y,"global"in c?c.global:this==e,c.state)}function i(t){var e,n=t.length,i=this,s=0,r=i.i=i.j=0,o=i.S=[];for(n||(t=[n++]);s<p;)o[s]=s++;for(s=0;s<p;s++)o[s]=o[r=y&r+t[s%n]+(e=o[s])],o[r]=e;(i.g=function(t){for(var e,n=0,s=i.i,r=i.j,o=i.S;t--;)e=o[s=y&s+1],n=n*p+o[y&(o[s]=o[r=y&r+e])+(o[r]=e)];return i.i=s,i.j=r,n})(p)}function s(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function r(t,e){var n,i=[],s=typeof t;if(e&&"object"==s)for(n in t)try{i.push(r(t[n],e-1))}catch(t){}return i.length?i:"string"==s?t:t+"\0"}function o(t,e){for(var n,i=t+"",s=0;s<i.length;)e[y&s]=y&(n^=19*e[y&s])+i.charCodeAt(s++);return l(e)}function a(){try{if(c)return l(c.randomBytes(p));var e=new Uint8Array(p);return(u.crypto||u.msCrypto).getRandomValues(e),l(e)}catch(e){var n=u.navigator,i=n&&n.plugins;return[+new Date,u,i,u.screen,l(t)]}}function l(t){return String.fromCharCode.apply(0,t)}var c,u=this,p=256,h=6,d=52,f="random",m=e.pow(p,h),g=e.pow(2,d),v=2*g,y=p-1;if(e["seed"+f]=n,o(e.random(),t),"object"==typeof module&&module.exports){module.exports=n;try{c=require("crypto")}catch(t){}}else"function"==typeof define&&define.amd&&define((function(){return n}))}([],Math),function(t){function e(t,i){if(i=i||{},(t=t||"")instanceof e)return t;if(!(this instanceof e))return new e(t,i);var s=n(t);this._originalInput=t,this._r=s.r,this._g=s.g,this._b=s.b,this._a=s.a,this._roundA=z(100*this._a)/100,this._format=i.format||s.format,this._gradientType=i.gradientType,this._r<1&&(this._r=z(this._r)),this._g<1&&(this._g=z(this._g)),this._b<1&&(this._b=z(this._b)),this._ok=s.ok,this._tc_id=B++}function n(t){var e={r:0,g:0,b:0},n=1,s=null,o=null,l=null,c=!1,u=!1;return"string"==typeof t&&(t=R(t)),"object"==typeof t&&(M(t.r)&&M(t.g)&&M(t.b)?(e=i(t.r,t.g,t.b),c=!0,u="%"===String(t.r).substr(-1)?"prgb":"rgb"):M(t.h)&&M(t.s)&&M(t.v)?(s=I(t.s),o=I(t.v),e=a(t.h,s,o),c=!0,u="hsv"):M(t.h)&&M(t.s)&&M(t.l)&&(s=I(t.s),l=I(t.l),e=r(t.h,s,l),c=!0,u="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=T(n),{ok:c,format:t.format||u,r:U(255,q(e.r,0)),g:U(255,q(e.g,0)),b:U(255,q(e.b,0)),a:n}}function i(t,e,n){return{r:255*S(t,255),g:255*S(e,255),b:255*S(n,255)}}function s(t,e,n){t=S(t,255),e=S(e,255),n=S(n,255);var i,s,r=q(t,e,n),o=U(t,e,n),a=(r+o)/2;if(r==o)i=s=0;else{var l=r-o;switch(s=a>.5?l/(2-r-o):l/(r+o),r){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return{h:i,s:s,l:a}}function r(t,e,n){function i(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var s,r,o;if(t=S(t,360),e=S(e,100),n=S(n,100),0===e)s=r=o=n;else{var a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;s=i(l,a,t+1/3),r=i(l,a,t),o=i(l,a,t-1/3)}return{r:255*s,g:255*r,b:255*o}}function o(t,e,n){t=S(t,255),e=S(e,255),n=S(n,255);var i,s,r=q(t,e,n),o=U(t,e,n),a=r,l=r-o;if(s=0===r?0:l/r,r==o)i=0;else{switch(r){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return{h:i,s:s,v:a}}function a(e,n,i){e=6*S(e,360),n=S(n,100),i=S(i,100);var s=t.floor(e),r=e-s,o=i*(1-n),a=i*(1-r*n),l=i*(1-(1-r)*n),c=s%6;return{r:255*[i,a,o,o,l,i][c],g:255*[l,i,i,a,o,o][c],b:255*[o,o,l,i,i,a][c]}}function l(t,e,n,i){var s=[E(z(t).toString(16)),E(z(e).toString(16)),E(z(n).toString(16))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0):s.join("")}function c(t,e,n,i,s){var r=[E(z(t).toString(16)),E(z(e).toString(16)),E(z(n).toString(16)),E(O(i))];return s&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)&&r[3].charAt(0)==r[3].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0)+r[3].charAt(0):r.join("")}function u(t,e,n,i){return[E(O(i)),E(z(t).toString(16)),E(z(e).toString(16)),E(z(n).toString(16))].join("")}function p(t,n){n=0===n?0:n||10;var i=e(t).toHsl();return i.s-=n/100,i.s=x(i.s),e(i)}function h(t,n){n=0===n?0:n||10;var i=e(t).toHsl()
;return i.s+=n/100,i.s=x(i.s),e(i)}function d(t){return e(t).desaturate(100)}function f(t,n){n=0===n?0:n||10;var i=e(t).toHsl();return i.l+=n/100,i.l=x(i.l),e(i)}function m(t,n){n=0===n?0:n||10;var i=e(t).toRgb();return i.r=q(0,U(255,i.r-z(-n/100*255))),i.g=q(0,U(255,i.g-z(-n/100*255))),i.b=q(0,U(255,i.b-z(-n/100*255))),e(i)}function g(t,n){n=0===n?0:n||10;var i=e(t).toHsl();return i.l-=n/100,i.l=x(i.l),e(i)}function v(t,n){var i=e(t).toHsl(),s=(i.h+n)%360;return i.h=s<0?360+s:s,e(i)}function y(t){var n=e(t).toHsl();return n.h=(n.h+180)%360,e(n)}function b(t){var n=e(t).toHsl(),i=n.h;return[e(t),e({h:(i+120)%360,s:n.s,l:n.l}),e({h:(i+240)%360,s:n.s,l:n.l})]}function _(t){var n=e(t).toHsl(),i=n.h;return[e(t),e({h:(i+90)%360,s:n.s,l:n.l}),e({h:(i+180)%360,s:n.s,l:n.l}),e({h:(i+270)%360,s:n.s,l:n.l})]}function w(t){var n=e(t).toHsl(),i=n.h;return[e(t),e({h:(i+72)%360,s:n.s,l:n.l}),e({h:(i+216)%360,s:n.s,l:n.l})]}function k(t,n,i){n=n||6,i=i||30;var s=e(t).toHsl(),r=360/i,o=[e(t)];for(s.h=(s.h-(r*n>>1)+720)%360;--n;)s.h=(s.h+r)%360,o.push(e(s));return o}function A(t,n){n=n||6;for(var i=e(t).toHsv(),s=i.h,r=i.s,o=i.v,a=[],l=1/n;n--;)a.push(e({h:s,s:r,v:o})),o=(o+l)%1;return a}function C(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function T(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function S(e,n){D(e)&&(e="100%");var i=P(e);return e=U(n,q(0,parseFloat(e))),i&&(e=parseInt(e*n,10)/100),t.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function x(t){return U(1,q(0,t))}function j(t){return parseInt(t,16)}function D(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function P(t){return"string"==typeof t&&-1!=t.indexOf("%")}function E(t){return 1==t.length?"0"+t:""+t}function I(t){return t<=1&&(t=100*t+"%"),t}function O(e){return t.round(255*parseFloat(e)).toString(16)}function N(t){return j(t)/255}function M(t){return!!Y.CSS_UNIT.exec(t)}function R(t){t=t.replace(F,"").replace($,"").toLowerCase();var e,n=!1;if(G[t])t=G[t],n=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(e=Y.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=Y.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=Y.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=Y.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=Y.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=Y.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=Y.hex8.exec(t))?{r:j(e[1]),g:j(e[2]),b:j(e[3]),a:N(e[4]),format:n?"name":"hex8"}:(e=Y.hex6.exec(t))?{r:j(e[1]),g:j(e[2]),b:j(e[3]),format:n?"name":"hex"}:(e=Y.hex4.exec(t))?{r:j(e[1]+""+e[1]),g:j(e[2]+""+e[2]),b:j(e[3]+""+e[3]),a:N(e[4]+""+e[4]),format:n?"name":"hex8"}:!!(e=Y.hex3.exec(t))&&{r:j(e[1]+""+e[1]),g:j(e[2]+""+e[2]),b:j(e[3]+""+e[3]),format:n?"name":"hex"}}function L(t){var e,n;return"AA"!==(e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==e&&(e="AA"),"small"!==(n=(t.size||"small").toLowerCase())&&"large"!==n&&(n="small"),{level:e,size:n}}var F=/^\s+/,$=/\s+$/,B=0,z=t.round,U=t.min,q=t.max,W=t.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var e,n,i,s=this.toRgb();return e=s.r/255,n=s.g/255,i=s.b/255,.2126*(e<=.03928?e/12.92:t.pow((e+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:t.pow((n+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:t.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=T(t),this._roundA=z(100*this._a)/100,this},toHsv:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=o(this._r,this._g,this._b),e=z(360*t.h),n=z(100*t.s),i=z(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+i+"%)":"hsva("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=s(this._r,this._g,this._b),e=z(360*t.h),n=z(100*t.s),i=z(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+i+"%)":"hsla("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return l(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return c(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:z(this._r),g:z(this._g),b:z(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+z(this._r)+", "+z(this._g)+", "+z(this._b)+")":"rgba("+z(this._r)+", "+z(this._g)+", "+z(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:z(100*S(this._r,255))+"%",g:z(100*S(this._g,255))+"%",b:z(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+z(100*S(this._r,255))+"%, "+z(100*S(this._g,255))+"%, "+z(100*S(this._b,255))+"%)":"rgba("+z(100*S(this._r,255))+"%, "+z(100*S(this._g,255))+"%, "+z(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(K[l(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var n="#"+u(this._r,this._g,this._b,this._a),i=n,s=this._gradientType?"GradientType = 1, ":"";if(t){var r=e(t);i="#"+u(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+s+"startColorstr="+n+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,i=this._a<1&&this._a>=0;return e||!i||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return e(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(g,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(h,arguments)},greyscale:function(){return this._applyModification(d,arguments)},spin:function(){return this._applyModification(v,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(w,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(_,arguments)}},e.fromRatio=function(t,n){if("object"==typeof t){var i={};for(var s in t)t.hasOwnProperty(s)&&(i[s]="a"===s?t[s]:I(t[s]));t=i}return e(t,n)},e.equals=function(t,n){return!(!t||!n)&&e(t).toRgbString()==e(n).toRgbString()},e.random=function(){return e.fromRatio({r:W(),g:W(),b:W()})},e.mix=function(t,n,i){i=0===i?0:i||50;var s=e(t).toRgb(),r=e(n).toRgb(),o=i/100;return e({r:(r.r-s.r)*o+s.r,g:(r.g-s.g)*o+s.g,b:(r.b-s.b)*o+s.b,a:(r.a-s.a)*o+s.a})},e.readability=function(n,i){var s=e(n),r=e(i);return(t.max(s.getLuminance(),r.getLuminance())+.05)/(t.min(s.getLuminance(),r.getLuminance())+.05)},e.isReadable=function(t,n,i){var s,r,o=e.readability(t,n);switch(r=!1,(s=L(i)).level+s.size){case"AAsmall":case"AAAlarge":r=o>=4.5;break;case"AAlarge":r=o>=3;break;case"AAAsmall":r=o>=7}return r},e.mostReadable=function(t,n,i){var s,r,o,a,l=null,c=0;r=(i=i||{}).includeFallbackColors,o=i.level,a=i.size;for(var u=0;u<n.length;u++)(s=e.readability(t,n[u]))>c&&(c=s,l=e(n[u]));return e.isReadable(t,l,{level:o,size:a})||!r?l:(i.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],i))};var H,J,V,G=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},K=e.hexNames=C(G),Y=(J="[\\s|\\(]+("+(H="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",V="[\\s|\\(]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",{CSS_UNIT:new RegExp(H),rgb:new RegExp("rgb"+J),rgba:new RegExp("rgba"+V),hsl:new RegExp("hsl"+J),hsla:new RegExp("hsla"+V),hsv:new RegExp("hsv"+J),hsva:new RegExp("hsva"+V),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});window.tinycolor=e}(Math),function(t,e){"use strict";var n="1.0.34",i="",s="?",r="function",o="undefined",a="object",l="string",c="major",u="model",p="name",h="type",d="vendor",f="version",m="architecture",g="console",v="mobile",y="tablet",b="smarttv",_="wearable",w="embedded",k=350,A="Amazon",C="Apple",T="ASUS",S="BlackBerry",x="Browser",j="Chrome",D="Firefox",P="Google",E="Huawei",I="LG",O="Microsoft",N="Motorola",M="Opera",R="Samsung",L="Sharp",F="Sony",$="Xiaomi",B="Zebra",z="Facebook",U="Chromium OS",q="Mac OS",W=function(t,e){var n={};for(var i in t)e[i]&&e[i].length%2==0?n[i]=e[i].concat(t[i]):n[i]=t[i];return n},H=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},J=function(t,e){return typeof t===l&&-1!==V(e).indexOf(V(t))},V=function(t){return t.toLowerCase()},G=function(t){return typeof t===l?t.replace(/[^\d\.]/g,i).split(".")[0]:e},K=function(t,e){if(typeof t===l)return t=t.replace(/^\s\s*/,i),typeof e===o?t:t.substring(0,k)},Y=function(t,n){for(var i,s,o,l,c,u,p=0;p<n.length&&!c;){var h=n[p],d=n[p+1];for(i=s=0;i<h.length&&!c&&h[i];)if(c=h[i++].exec(t))for(o=0;o<d.length;o++)u=c[++s],typeof(l=d[o])===a&&l.length>0?2===l.length?typeof l[1]==r?this[l[0]]=l[1].call(this,u):this[l[0]]=l[1]:3===l.length?typeof l[1]!==r||l[1].exec&&l[1].test?this[l[0]]=u?u.replace(l[1],l[2]):e:this[l[0]]=u?l[1].call(this,u,l[2]):e:4===l.length&&(this[l[0]]=u?l[3].call(this,u.replace(l[1],l[2])):e):this[l]=u||e;p+=2}},X=function(t,n){for(var i in n)if(typeof n[i]===a&&n[i].length>0){for(var r=0;r<n[i].length;r++)if(J(n[i][r],t))return i===s?e:i}else if(J(n[i],t))return i===s?e:i;return t},Z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Q={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,f],[/opios[\/ ]+([\w\.]+)/i],[f,[p,M+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[p,M]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[p,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[p,"UC"+x]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[p,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[p,"IE"]],[/yabrowser\/([\w\.]+)/i],[f,[p,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+x],f],[/\bfocus\/([\w\.]+)/i],[f,[p,D+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[p,M+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[p,M+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[p,"MIUI "+x]],[/fxios\/([-\w\.]+)/i],[f,[p,D]],[/\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+x]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1 "+x],f],[/(comodo_dragon)\/([\w\.]+)/i],[[p,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[p,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,z],f],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[p,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[p,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[p,j+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,j+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[p,"Android "+x]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[f,X,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[p,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[p,D+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[p,f],[/(cobalt)\/([\w\.]+)/i],[p,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,V]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,i,V]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,V]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[d,R],[h,y]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,R],[h,v]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[d,C],[h,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,C],[h,y]],[/(macintosh);/i],[u,[d,C]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,L],[h,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,E],[h,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,E],[h,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[d,$],[h,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,$],[h,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[d,"OPPO"],[h,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[h,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[d,"Realme"],[h,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[d,N],[h,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,N],[h,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,I],[h,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,I],[h,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[h,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[h,v]],[/(pixel c)\b/i],[u,[d,P],[h,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,P],[h,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[d,F],[h,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,F],[h,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[h,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,A],[h,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,A],[h,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[h,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,S],[h,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,T],[h,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,T],[h,v]],[/(nexus 9)/i],[u,[d,"HTC"],[h,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[h,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[h,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"Meizu"],[h,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,u,[h,v]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,u,[h,y]],[/(surface duo)/i],[u,[d,O],[h,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[h,v]],[/(u304aa)/i],[u,[d,"AT&T"],[h,v]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[h,v]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[h,y]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[h,y]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[h,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[h,y]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[h,y]],[/\b(k88) b/i],[u,[d,"ZTE"],[h,y]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[h,v]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[h,v]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[h,y]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[h,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[h,y]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[h,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[h,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[h,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[h,v]],[/\b(ph-1) /i],[u,[d,"Essential"],[h,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[h,y]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[h,y]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[h,y]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[h,y]],[/(sprint) (\w+)/i],[d,u,[h,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,O],[h,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,B],[h,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,B],[h,v]],[/smart-tv.+(samsung)/i],[d,[h,b]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,R],[h,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,I],[h,b]],[/(apple) ?tv/i],[d,[u,C+" TV"],[h,b]],[/crkey/i],[[u,j+"cast"],[d,P],[h,b]],[/droid.+aft(\w)( bui|\))/i],[u,[d,A],[h,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,L],[h,b]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,F],[h,b]],[/(mitv-\w{5}) bui/i],[u,[d,$],[h,b]],[/Hbbtv.*(technisat) (.*);/i],[d,u,[h,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[d,K],[u,K],[h,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[h,g]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[h,g]],[/(playstation [345portablevi]+)/i],[u,[d,F],[h,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,O],[h,g]],[/((pebble))app/i],[d,u,[h,_]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[d,C],[h,_]],[/droid.+; (glass) \d/i],[u,[d,P],[h,_]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,B],[h,_]],[/(quest( 2| pro)?)/i],[u,[d,z],[h,_]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[h,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[h,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[h,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[p,"Edge"+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[p,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[p,[f,X,Z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,"Windows"],[f,X,Z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,q],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,f],[/\(bb(10);/i],[f,[p,S]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[p,D+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[p,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[p,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[p,j+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[p,U],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,f],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[p,f]]},tt=function(n,s){if(typeof n===a&&(s=n,n=e),!(this instanceof tt))return new tt(n,s).getResult();var g=typeof t!==o&&t.navigator?t.navigator:e,b=n||(g&&g.userAgent?g.userAgent:i),_=g&&g.userAgentData?g.userAgentData:e,w=s?W(Q,s):Q;return this.getBrowser=function(){var t={};return t[p]=e,t[f]=e,Y.call(t,b,w.browser),t[c]=G(t[f]),g&&g.brave&&typeof g.brave.isBrave==r&&(t[p]="Brave"),t},this.getCPU=function(){var t={};return t[m]=e,Y.call(t,b,w.cpu),t},this.getDevice=function(){var t={};return t[d]=e,t[u]=e,t[h]=e,Y.call(t,b,w.device),!t[h]&&_&&_.mobile&&(t[h]=v),"Macintosh"==t[u]&&g&&typeof g.standalone!==o&&g.maxTouchPoints&&g.maxTouchPoints>2&&(t[u]="iPad",t[h]=y),t},this.getEngine=function(){var t={};return t[p]=e,t[f]=e,Y.call(t,b,w.engine),t},this.getOS=function(){var t={};return t[p]=e,t[f]=e,Y.call(t,b,w.os),!t[p]&&_&&"Unknown"!=_.platform&&(t[p]=_.platform.replace(/chrome os/i,U).replace(/macos/i,q)),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return b},this.setUA=function(t){return b=typeof t===l&&t.length>k?K(t,k):t,this},this.setUA(b),this};tt.VERSION=n,tt.BROWSER=H([p,f,c]),tt.CPU=H([m]),tt.DEVICE=H([u,d,h,g,v,b,y,_,w]),tt.ENGINE=tt.OS=H([p,f]),typeof exports!==o?(typeof module!==o&&module.exports&&(exports=module.exports=tt),exports.UAParser=tt):typeof define===r&&define.amd?define((function(){return tt})):typeof t!==o&&(t.UAParser=tt);var et=typeof t!==o&&(t.jQuery||t.Zepto);if(et&&!et.ua){var nt=new tt;et.ua=nt.getResult(),et.ua.get=function(){return nt.getUA()},et.ua.set=function(t){nt.setUA(t);var e=nt.getResult();for(var n in e)et.ua[n]=e[n]}}}("object"==typeof window?window:this),(()=>{function t(t){const e="==".slice(0,(4-t.length%4)%4),n=t.replace(/-/g,"+").replace(/_/g,"/")+e,i=atob(n),s=new ArrayBuffer(i.length),r=new Uint8Array(s);for(let t=0;t<i.length;t++)r[t]=i.charCodeAt(t);return s}function e(t){const e=new Uint8Array(t);let n="";for(const t of e)n+=String.fromCharCode(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function n(t,e,i){if(e===g)return i;if(e===v)return t(i);if(e instanceof Array)return i.map((i=>n(t,e[0],i)));if(e instanceof Object){const s={};for(const[r,o]of Object.entries(e)){if(o.derive){const t=o.derive(i);void 0!==t&&(i[r]=t)}if(r in i)null!=i[r]?s[r]=n(t,o.schema,i[r]):s[r]=null;else if(o.required)throw new Error(`Missing key: ${r}`)}return s}}function i(t,e){return{required:!0,schema:t,derive:e}}function s(t){return{required:!0,schema:t}}function r(t){return{required:!1,schema:t}}function o(e){return n(t,w,e)}function a(t){return n(e,k,t)}function l(t){return f(this,null,(function*(){return a(yield navigator.credentials.create(o(t)))}))}function c(e){return n(t,A,e)}function u(t){return n(e,C,t)}function p(t){return f(this,null,(function*(){return u(yield navigator.credentials.get(c(t)))}))}function h(){return!!(navigator.credentials&&navigator.credentials.create&&navigator.credentials.get&&window.PublicKeyCredential)}var d=Object.defineProperty,f=(t,e,n)=>new Promise(((i,s)=>{var r=t=>{try{a(n.next(t))}catch(t){s(t)}},o=t=>{try{a(n.throw(t))}catch(t){s(t)}},a=t=>t.done?i(t.value):Promise.resolve(t.value).then(r,o);a((n=n.apply(t,e)).next())})),m={};((t,e)=>{for(var n in e)d(t,n,{get:e[n],enumerable:!0})})(m,{create:()=>l,get:()=>p,schema:()=>T,supported:()=>h});var g="copy",v="convert",y={type:s(g),id:s(v),transports:r(g)},b={appid:r(g),appidExclude:r(g),credProps:r(g)},_={appid:r(g),appidExclude:r(g),credProps:r(g)},w={publicKey:s({rp:s(g),user:s({id:s(v),name:s(g),displayName:s(g)}),challenge:s(v),pubKeyCredParams:s(g),timeout:r(g),excludeCredentials:r([y]),authenticatorSelection:r(g),attestation:r(g),extensions:r(b)}),signal:r(g)},k={type:s(g),id:s(g),rawId:s(v),authenticatorAttachment:r(g),response:s({clientDataJSON:s(v),attestationObject:s(v),transports:i(g,(t=>{var e;return(null==(e=t.getTransports)?void 0:e.call(t))||[]}))}),clientExtensionResults:i(_,(t=>t.getClientExtensionResults()))},A={mediation:r(g),publicKey:s({challenge:s(v),timeout:r(g),rpId:r(g),allowCredentials:r([y]),userVerification:r(g),extensions:r(b)}),signal:r(g)},C={type:s(g),id:s(g),rawId:s(v),authenticatorAttachment:r(g),response:s({clientDataJSON:s(v),authenticatorData:s(v),signature:s(v),userHandle:s(v)}),clientExtensionResults:i(_,(t=>t.getClientExtensionResults()))},T={credentialCreationOptions:w,publicKeyCredentialWithAttestation:k,credentialRequestOptions:A,publicKeyCredentialWithAssertion:C};globalThis.webauthnJSON=m})(),window.word_filter=function(t){var e=t.html();e=(e=(e=(e=(e=e.replace(/<!--[\s\S]+?-->/gi,"")).replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,"")).replace(/<(\/?)s>/gi,"<$1strike>")).replace(/&nbsp;/gi," ")).replace(/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,(function(t,e){return e.length>0?e.replace(/./," ").slice(Math.floor(e.length/2)).split("").join("\xa0"):""})),t.html(e),$("p",t).each((function(){var t=$(this).attr("style"),e=/mso-list:\w+ \w+([0-9]+)/.exec(t);e&&$(this).data("_listLevel",parseInt(e[1],10))}));var n=0,i=null;return $("p",t).each((function(){var t=$(this).data("_listLevel");if(null!=t){var e=$(this).text(),s="<ul></ul>";if(/^\s*\w+\./.test(e)){var r=/([0-9])\./.exec(e);if(r){var o=parseInt(r[1],10);s=o>1?'<ol start="'+o+'"></ol>':"<ol></ol>"}else s="<ol></ol>"}if(t>n&&(0==n?($(this).before(s),i=$(this).prev()):i=$(s).appendTo(i)),t<n)for(var a=0;a<n-t;a++)i=i.parent();$("span:first",this).remove(),i.append("<li>"+$(this).html()+"</li>"),$(this).remove(),n=t}else n=0})),$("span",t).replaceWith((function(){return $(this).contents()})),$("span:empty",t).remove(),$("[class^='Mso']",t).removeAttr("class"),$("p:empty",t).remove(),t},function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.viewPrint=function(t,e,n,i){var s,r,o,a,l,c;return n||(n={},t.constructor.attributesGet&&(n=t.constructor.attributesGet())),s=n[e],l=t[e],c=void 0,s||(s=n[r=e+"_id"])&&t[e=r]&&(c=l,l=t[e]),l||(a=e.split("::"))[0]&&a[1]&&t[a[0]]&&(l=t[a[0]][a[1]]),
s?(c||"_id"===e.substr(e.length-3,e.length)&&t[o=e.substr(0,e.length-3)]&&(c=t[o]),this.viewPrintItem(l,s,c,i,t)):this.viewPrintItem(l)},n.viewPrintItem=function(t,e,i,s,r){var o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T;if(null==e&&(e={}),void 0===t)return"-";if(""===t)return"-";if(null===t)return"-";if("function"!=typeof t&&_.isObject(t)&&_.isEmpty(t))return"-";if(_.isArray(t)&&(_.isEmpty(t)||_.isEmpty(_.filter(t,(function(t){return""!==t})))))return"-";for(w="",h=[t],_.isArray(t)&&(h=t),l=!1,e.display_limit&&(h.length>e.display_limit&&(l=!0),h=h.slice(0,e.display_limit)),d=0,f=(v=h.sort()).length;d<f;d++)t=v[d],k=t,(e.relation||i)&&(t=i||n[e.relation].find(t)),(null!=r&&null!=(y=r.constructor)?y.has_parents:void 0)&&"name"===e.name&&(k=r.displayName()),p=!1,t&&"object"==typeof t&&(p=!0,k=t.displayNameLong?t.displayNameLong():t.displayName?t.displayName():_.isUndefined(t.name)?t.label:t.name),e.callback&&(k=e.callback(k,e)),u=!1,"textarea"===e.tag?(u=!0,k=n.Utils.text2html(k)):"richtext"===e.tag&&(u=!0),_.isEmpty(e.options)||(Array.isArray(e.options)?(g=_.find(e.options,(function(t){return t.value===k})))&&g.name&&(k=g.name):e.options[k]&&(k=e.options[k])),"boolean"===e.tag&&(!0===k?k="yes":!1===k&&(k="no")),"active"===e.tag&&(k=null!=(b=_.findWhere(n.UiElement.active.OPTIONS,{value:k}))?b.name:void 0),("active"===e.tag||e.translate||p&&t.translate&&t.translate())&&(u=!0,k=n.i18n.translateContent(k)),"date"===e.tag&&(u=!0,k=n.i18n.translateDate(k)),(m=this._placeholderReplacement(r,e,k,u))&&(k=m,u=!0),"input"!==e.tag||m?"datetime"===e.tag&&(u=!0,A=n.i18n.translateTimestamp(k),a=!1,(o=e.class||"").match("escalation")&&(a=!0),c="",s||(c=n.PrettyDate.humanTime(k,a)),T=A,C="",e.include_timezone&&(C=' timezone="'+n.Config.get("timezone_default_sanitized")+'"',T+=" "+n.Config.get("timezone_default_sanitized")),k='<time class="humanTimeFromNow '+o+'" datetime="'+k+'" title="'+T+'"'+C+">"+c+"</time>"):("tel"===e.type?k='<a href="'+n.Utils.phoneify(k)+'">'+n.Utils.htmlEscape(k)+"</a>":"url"!==e.type||m?u||(k=n.Utils.htmlEscape(k)):k=n.Utils.linkify(k),u=!0),u||"string"!=typeof k||(k=n.Utils.htmlEscape(k)),_.isEmpty(w)||(w+=", "),w+=k;return l&&(w+=", \u2026"),w},n._placeholderReplacement=function(t,e,i,s){var r,o;if(t&&e&&!_.isEmpty(e.linktemplate)&&t.constructor&&t.constructor.className&&!_.isEmpty(t[e.name]))return(r={attribute:e,session:n.Session.get(),config:n.Config.all()})[t.constructor.className.toLowerCase()]=t,o=i,s||(o=n.Utils.htmlEscape(o)),'<a href="'+n.Utils.replaceTags(e.linktemplate,r,!0)+'" target="_blank">'+o+"</a>"},n.view=function(t){return function(e){return null==e&&(e={}),JST["app/views/"+t](_.extend(e,n.ViewHelpers))}},n}(Spine.Controller),t.UiElement=function(){function t(){}return t}(),window.App=t}.call(this),function(){var t;App.Config=function(){function e(){}var n;return n=void 0,e.init=function(){return null!=n?n:n=new t},e.get=function(e,i){return void 0===n&&null==n&&(n=new t),n.get(e,i)},e.set=function(e,i,s){return void 0===n&&null==n&&(n=new t),n.set(e,i,s)},e.delete=function(e,i){return void 0===n&&null==n&&(n=new t),n.delete(e,i)},e.all=function(){return void 0===n&&null==n&&(n=new t),n.all()},e}(),t=function(){function t(){this.config={}}return t.prototype.get=function(t,e){if(e){if(!e in this.config)return;if(void 0===this.config[e])return;return this.config[e][t]}return this.config[t]},t.prototype.set=function(t,e,n){return n?(this.config[n]||(this.config[n]={}),this.config[n][t]=e):this.config[t]=e},t.prototype.delete=function(t,e){if(e){if(!this.config[e])return;return delete this.config[e][t]}return delete this.config[t]},t.prototype.all=function(){return this.config},t}()}.call(this),function(){var t;App.LocalStorage=function(){function e(){}var n;return n=void 0,e.set=function(e,i,s){return void 0===n&&null==n&&(n=new t),n.set(e,i,s)},e.get=function(e,i){return void 0===n&&null==n&&(n=new t),n.get(e,i)},e.delete=function(e,i){return void 0===n&&null==n&&(n=new t),n.delete(e,i)},e.clear=function(){return void 0===n&&null==n&&(n=new t),n.clear()},e.keys=function(e,i){return void 0===n&&null==n&&(n=new t),n.keys(e,i)},e.usage=function(){return void 0===n&&null==n&&(n=new t),n.usage()},e}(),t=function(){function t(){}return t.prototype.set=function(t,e,n){var i;try{return n&&(t="personal::"+n+"::"+t),localStorage.setItem(t,JSON.stringify(e))}catch(t){return i=t,App.Log.error("App.LocalStorage","Local storage error!",i)}},t.prototype.get=function(t,e){var n;if(e&&(t="personal::"+e+"::"+t),n=localStorage.getItem(t))return JSON.parse(n)},t.prototype.delete=function(t,e){return e&&(t="personal::"+e+"::"+t),localStorage.removeItem(t)},t.prototype.clear=function(){return localStorage.clear()},t.prototype.keys=function(t,e){var n,i,s;return n=Object.keys(window.localStorage),null===e&&null===t?n:(s="",e&&(s="personal::"+e+"::"),t&&(s+=t),i=new RegExp("^"+s),n.filter((function(t){return t.match(i)})))},t.prototype.usage=function(){var t,e,n;for(t in e="",window.localStorage)n=localStorage.getItem(t),_.isString(n)&&(e+=n);return byteLength(e)},t}()}.call(this),function(){var t,e,n=[].slice,i=function(t,e){return function(){return t.apply(e,arguments)}};e=void 0,App.LogInclude=function(){function i(){}return i.log=function(){var i,s,r;return s=arguments[0],i=2<=arguments.length?n.call(arguments,1):[],void 0===e&&null==e&&(e=new t),r=this.constructor.name,e.log(r,s,i)},i}(),App.Log=function(){function i(){}return i.debug=function(){var i,s;return s=arguments[0],i=2<=arguments.length?n.call(arguments,1):[],void 0===e&&null==e&&(e=new t),e.log(s,"debug",i)},i.notice=function(){var i,s;return s=arguments[0],i=2<=arguments.length?n.call(arguments,1):[],void 0===e&&null==e&&(e=new t),e.log(s,"notice",i)},i.error=function(){var i,s;return s=arguments[0],i=2<=arguments.length?n.call(arguments,1):[],void 0===e&&null==e&&(e=new t),e.log(s,"error",i)},i.config=function(n,i){return void 0===e&&null==e&&(e=new t),e.config(n,i)},i.timeTrack=function(n){return void 0===e&&null==e&&(e=new t),e.timeTrack(n)},i}(),t=function(){function t(){var t,e;this.timeTrack=i(this.timeTrack,this),this.yieldColor=i(this.yieldColor,this),this.moduleColorsMap={},this.currentConfig={},this.currentConfigReady={},window.localStorage&&(e=window.localStorage.getItem("log_config"))&&(this.currentConfig=JSON.parse(e),this.configReady()),this.colorSupport=!1,(t=App.Browser.detection()).browser&&("Chrome"===t.browser.name?this.colorSupport=!0:"Firefox"===t.browser.anem?t.browser.major>=31&&(this.colorSupport=!0):"Safari"===t.browser.name&&(this.colorSupport=!0))}return t.prototype.configReady=function(){var t,e,n,i;for(n in e=[],t=this.currentConfig)i=t[n],"module"===n||"content"===n?e.push(this.currentConfigReady[n]=new RegExp(i,"i")):e.push(this.currentConfigReady[n]=i);return e},t.prototype.config=function(t,e){return null==t&&(t=void 0),null==e&&(e=void 0),void 0===e?t?this.currentConfig[t]:this.currentConfig:(this.currentConfig[t]=e,this.configReady(),window.localStorage?window.localStorage.setItem("log_config",JSON.stringify(this.currentConfig)):void 0)},t.prototype.log=function(t,e,n){if("debug"===e){if(!this.currentConfigReady.module&&!this.currentConfigReady.content)return;if(this.currentConfigReady.module&&!t.match(this.currentConfigReady.module))return;if(this.currentConfigReady.content&&!n.toString().match(this.currentConfigReady.content))return}return this._log(t,e,n)},t.prototype._log=function(t,e,n){var i,s,r,o,a,l;return r=32,(s="App."+t+"("+e+")").length<r&&(s+=Array(r-s.length).join(" ")),s+="|",this.colorSupport?(s="%c"+s,this.moduleColorsMap[t]||(this.moduleColorsMap[t]=this.yieldColor()),i=[s,"color: hsl("+this.moduleColorsMap[t]+",99%,40%); font-weight: bold"].concat(n)):i=[s].concat(n),"error"===e?null!=(o=console.error)?o.apply(console,i):void 0:"debug"===e?null!=(a=console.debug)?a.apply(console,i):void 0:null!=(l=console.log)?l.apply(console,i):void 0},t.prototype.yieldColor=function(){var t;return this.hue||(this.hue=0),this.hue+=1,t=.618033988749895,this.hue+=t,this.hue=this.hue%1,360*this.hue},t.prototype.timeTrack=function(t){var e,n;return e=(new Date).getTime(),this.lastTime?(n=e-this.lastTime,this.lastTime=e,console.log("timeTrack start",t,n)):(this.lastTime=e,console.log("timeTrack start",t))},t}()}.call(this),function(){var t;App.QueueManager=function(){function e(){}var n;return n=void 0,e.init=function(){return null!=n?n:n=new t},e.add=function(e,i){return void 0===n&&null==n&&(n=new t),n.add(e,i)},e.pull=function(e){return void 0===n&&null==n&&(n=new t),n.pull(e)},e.all=function(e){return void 0===n&&null==n&&(n=new t),n.all(e)},e.run=function(e,i){return void 0===n&&null==n&&(n=new t),n.run(e,i)},e}(),t=function(){function t(){this.queues={},this.queueRunning={}}return t.prototype.add=function(t,e){return this.queues[t]||(this.queues[t]=[]),this.queues[t].push(e),!0},t.prototype.pull=function(t){if(this.queues[t])return this.queues[t].shift()},t.prototype.all=function(t){return this.queues[t]},t.prototype.run=function(t){var e;if(this.queues[t]&&!this.queueRunning[t]&&(e=this.queues[t],!_.isEmpty(e))){for(this.queueRunning[t]=!0;;)if(e.shift()(),!e[0]){this.queueRunning[t]=!1;break}return!0}},t}()}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Session=function(){function e(){}var n;return n=void 0,e.init=function(){return null==n&&(n=new t),n.clear()},e.get=function(e){return void 0===n&&null==n&&(n=new t),n.get(e)},e.set=function(e){return void 0===n&&null==n&&(n=new t),n.set(e)},e}(),t=function(t){function n(){this.clear()}return e(n,t),n.include(App.LogInclude),n.prototype.clear=function(){return this.user=void 0},n.prototype.get=function(t){var e;return t?null!=(e=this.user)?e[t]:void 0:this.user},n.prototype.set=function(t){return this.user=App.User.findNative(t)},n}(Spine.Module)}.call(this),function(){var t;App.SessionStorage=function(){function e(){}var n;return n=void 0,e.set=function(e,i){return void 0===n&&null==n&&(n=new t),n.set(e,i)},e.get=function(e){return void 0===n&&null==n&&(n=new t),n.get(e)},e.delete=function(e){return void 0===n&&null==n&&(n=new t),n.delete(e)},e.clear=function(){return void 0===n&&null==n&&(n=new t),n.clear()},e.list=function(){return void 0===n&&null==n&&(n=new t),n.list()},e.usage=function(){return void 0===n&&null==n&&(n=new t),n.usage()},e}(),t=function(){function t(){var t;App.Event.bind("clearStore",(t=this,function(){return t.clear()}))}return t.prototype.set=function(t,e){var n;try{return sessionStorage.setItem(t,JSON.stringify(e))}catch(i){return n=i,this.clear(),App.Log.error("App.SessionStorage","Session storage error!",n),sessionStorage.setItem(t,JSON.stringify(e))}},t.prototype.get=function(t){var e;if(e=sessionStorage.getItem(t))return JSON.parse(e)},t.prototype.delete=function(t){return sessionStorage.removeItem(t)},t.prototype.clear=function(){return sessionStorage.clear()},t.prototype.list=function(){return window.sessionStorage},t.prototype.usage=function(){var t,e,n;for(t in e="",window.sessionStorage)n=sessionStorage.getItem(t),_.isString(n)&&(e+=n);return byteLength(e)},t}()}.call(this),function(){var t;t={access:function(t){var e,n,i,s,r,o,a,l,c,u;for(o=App.Permission.findByAttribute("name","knowledge_base.reader"),r=App.Permission.findByAttribute("name","knowledge_base.editor"),a=function(){switch(this.constructor){case App.KnowledgeBaseAnswer:return this.category().permissions_effective;case App.KnowledgeBaseCategory:case App.KnowledgeBase:return this.permissions_effective}}.call(this),e="none",n=0,s=(l=App.User.current().role_ids).length;n<s;n++)if(u=l[n],i=_.findWhere(a,{role_id:u}))switch(i.access){case"editor":return"editor";case"reader":e="reader";break;case"none":t&&this.visiblePublicly(t)&&(e="reader")}else if(c=App.Role.find(u)){if(c.permission_ids.indexOf(r.id)>-1)return"editor";c.permission_ids.indexOf(o.id)>-1&&(e="reader")}return e}},App.KnowledgeBaseAccess={extended:function(){return this.include(t)}}}.call(this),function(){var t;t={contentSidebarActions:function(){var t,e;return e=[],("function"==typeof(t=this.constructor).canBePublished?t.canBePublished():void 0)&&e.push({iconName:"eye",name:"Visibility",action:"visibility",cssClass:"btn--success",disabled:this.isNew()}),(this instanceof App.KnowledgeBaseCategory||this instanceof App.KnowledgeBase)&&e.push({iconName:"lock",name:"Permissions",action:"permissions",cssClass:"btn--success",disabled:this.isNew()}),this instanceof App.KnowledgeBase||e.push({iconName:"trash",name:"Delete",action:"delete",cssClass:"btn--danger",disabled:this.isNew()}),e}},App.KnowledgeBaseActions={extended:function(){return this.include(t)}}}.call(this),function(){var t;t={canBePublished:function(){return!0},can_be_published_state:function(){var t;switch(t=(new Date).getTime(),!1){case!(this.date(this.archived_at)<t):return"archived";case!(this.date(this.published_at)<t):return"published";case!(this.date(this.internal_at)<t):return"internal";default:return"draft"}},can_be_published_by:function(t){var e;if(null==t&&(t=this.can_be_published_state()),"draft"!==t)return e=this[t+"_by_id"],App.User.find(e)},can_be_published_at:function(t){return null==t&&(t=this.can_be_published_state()),"draft"===t?this.created_at:this[t+"_at"]},can_be_published_internal_by:function(){if(this.is_internally_published_object())return App.User.find(this.internal_by_id||this.published_by_id)},can_be_published_internal_at:function(){if(this.is_internally_published_object())return this.internal_at||this.published_at},can_be_published_state_css:function(){return"state-"+this.can_be_published_state()},can_be_published_quick_actions:function(){switch(this.can_be_published_state()){case"published":return["archive"];case"internal":return["publish","archive"];case"draft":return["publish","internal"];default:return[]}},next_call_to_action:function(){switch(this.can_be_published_state()){case"archived":return["unarchive"];case"published":return["archive"];case"internal":return["publish","archive"];default:return["publish","internal"]}},can_be_published_publish_in_future:function(){return this.date(this.published_at)>(new Date).getTime()},can_be_published_archive_in_future:function(){return this.date(this.archived_at)>(new Date).getTime()},can_be_published_internal_in_future:function(){return this.date(this.internal_at)>(new Date).getTime()},is_internally_published_object:function(t){return null==t&&(t=this.can_be_published_state()),"internal"===t||"published"===t},is_internally_published:function(t){return!!this.is_internally_published_object()&&!!this.translation(t.id)},is_published:function(t){return"published"===this.can_be_published_state()&&!!this.translation(t.id)},date:function(t){if(t)return new Date(t).getTime()}},App.KnowledgeBaseCanBePublished={canBePublished:function(){return!0},extended:function(){return this.include(t)}}}.call(this),function(){var t;t={translations:function(){var t,e,n;return e=this.constructor.translatableClass(),t=this.constructor.translatableForeignKey(),e.all().filter((n=this,function(e){return e[t]===n.id}))},translation:function(t){return null==t?null:this.translations().filter((function(e){return e.kb_locale_id===t}))[0]},primaryTranslation:function(){var t;return t=this.knowledge_base().primaryKbLocale(),this.translation(t.id)},attributesIncludingTranslation:function(t){var e,n;return(e=this.attributes()).translation=null!=(n=this.translation(t))?n.attributes():void 0,e},attributesForRendering:function(t,e){var n;return null==e&&(e={}),n={id:this.id,url:this.uiUrl(t,e.action),title:this.guaranteedTitle(t.id),missingTranslation:void 0===this.translation(t.id)},this instanceof App.KnowledgeBase&&(n.icon="knowledge-base",n.title="",n.type="base"),this instanceof App.KnowledgeBaseCategory&&(n.iconFont=!0,n.icon=this.category_icon,n.count=this.countDeepAnswers(),n.state=this.visibilityState(t),n.type="category"),this instanceof App.KnowledgeBaseAnswer&&(n.icon="knowledge-base-answer",n.state=this.can_be_published_state(),n.tags=this.tags,n.type="answer"),n.icons={},n.missingTranslation&&(n.icons.danger=!0),n},writeMethod:function(){return this.id?"PATCH":"POST"},prepareNestedParams:function(t,e){var n,i;return this.baseParams&&(t=_.extendOwn(this.baseParams(),t)),i=t.translation,delete t.translation,(n=this.translation(e))?i.id=n.id:i.kb_locale_id=e,this.constructor.translatableClass().processAttributes&&(i=this.constructor.translatableClass().processAttributes(i)),t.translations_attributes=[i],t},objectActionName:function(){return(this.isNew()?"New":"Edit")+" "+this.objectName()},removeTranslations:function(t){var e,n,i,s,r;for(null==t&&(t={}),s=[],e=0,n=(i=this.translations()).length;e<n;e++)r=i[e],s.push(r.remove(t));return s},removeIncludingTranslations:function(t){return null==t&&(t={}),this.removeTranslations(t),this.remove(t)},guaranteedTranslation:function(t){return this.translation(t)||this.primaryTranslation()||this.translations()[0]},guaranteedTitle:function(t,e){var n;return null==e&&(e="-"),(null!=(n=this.guaranteedTranslation(t))?n.title:void 0)||e},translationBindlableObject:function(t){return this.translation(t)||this.constructor.translatableClass()}},App.KnowledgeBaseTranslatable={extended:function(){return this.include(t)}}}.call(this),function(){var t;t={parent:function(){throw"Please implement parent method, fetching parent object"},uiUrl:function(){var t;return t=App.KnowledgeBaseLocale.localeFor(this),this.parent().uiUrl(t)},fullyLoaded:function(){return!(this instanceof App.KnowledgeBaseAnswerTranslation)||null!==this.content()},defaultSearchResultAttributes:function(){return App.KnowledgeBaseLocale.localeFor(this),{display:this.title,id:this.id,url:this.uiUrl()}},searchResultAttributes:function(){return this.defaultSearchResultAttributes()}},App.KnowledgeBaseTranslationable={extended:function(){return this.include(t)}}}.call(this),function(){App.PermissionHelper={switchGroupPermission:function(t){return _.throttle((function(t){var e,n,i;return i=(e=$(t.target)).prop("checked"),$(t.target).is(":checkbox")||(i=!i),n="input[value=full]","full"===e.val()&&!0===i&&(n="input[value!=full]"),$(t.target).closest("tr").find(n).prop("checked",!1)}),300,{trailing:!1})(t)}}}.call(this),function(){var t,e=[].slice;t={initializePopovers:function(){var t,e;return this.el.on("remove",(e=this,function(){return e.removePopovers()})),this.initializeIntersectionObserver(),t=_.extend({},this.constructor.popoversDefaults,{parentController:this}),this.initializedPopovers=this.selectedPopovers().map((function(e){return new(0,App.Config.get(App.PopoverProvider.providersConfigKey)[e])(t)}))},initializeIntersectionObserver:function(){var t;if("function"==typeof IntersectionObserver&&(this.intersection_observer=new IntersectionObserver((t=this,function(e){return t.intersectionChanged(e)})),this.el[0]))return this.intersection_observer.observe(this.el[0])},intersectionChanged:function(t){var e,n,i,s,r;if(!t[t.length-1].isVisible&&this.initializedPopovers){for(r=[],e=0,n=(s=this.initializedPopovers).length;e<n;e++)i=s[e],r.push(i.hide());return r}},selectedPopovers:function(){var t;return this.constructor.allPopovers?(t=App.Config.get(App.PopoverProvider.providersConfigKey),Object.keys(t)):this.constructor.registeredPopovers||[]},buildPopovers:function(t){var e,n,i,s,r;for(r=[],e=0,n=(s=this.initializedPopovers).length;e<n;e++)i=s[e],r.push(i.build(t));return r},renderPopovers:function(t){if(null==t&&(t={}),!window.matchMedia("(pointer: coarse)").matches)return this.initializedPopovers||this.initializePopovers(),this.buildPopovers(t)},removePopovers:function(){var t,e,n;if(this.initializedPopovers){for(this.intersection_observer.disconnect(),t=0,e=(n=this.initializedPopovers).length;t<e;t++)n[t].clear();return this.initializedPopovers=void 0}},delayedRemoveAnyPopover:function(t){if(null==t&&(t=!1),t||"function"!=typeof IntersectionObserver)return this.delay(this.constructor.anyPopoversDestroy,100,"removePopovers")}},App.PopoverProvidable={registerPopovers:function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],this.allPopovers=void 0,this.registeredPopovers=t},registerAllPopovers:function(){return this.allPopovers=!0},anyPopoversDestroy:function(){return $(".popover:not(.popover--notifications,.popover--richtextpopover)").popover("destroy")},extended:function(){return this.include(t)}}}.call(this),function(){App.RenderScreen={renderScreenSuccess:function(t){return this.taskKey&&App.TaskManager.touch(this.taskKey),(t.el||this).html(App.view("generic/error/success")(t))},renderScreenError:function(t){return this.taskKey&&App.TaskManager.touch(this.taskKey),(t.el||this).html(App.view("generic/error/generic")(t))},renderScreenNotFound:function(t){return this.taskKey&&App.TaskManager.touch(this.taskKey),(t.el||this).html(App.view("generic/error/not_found")(t))},renderScreenUnauthorized:function(t){return this.taskKey&&App.TaskManager.touch(this.taskKey),(t.el||this).html(App.view("generic/error/unauthorized")(t))},renderScreenPlaceholder:function(t){if(this.taskKey&&App.TaskManager.touch(this.taskKey),(t.el||this).html(App.view("generic/error/placeholder")(t)),t.action&&t.actionCallback)return(t.el||this.el).find(".js-action").on("click",t.actionCallback)}}}.call(this),function(){App.SecurityOptions={securityOptionsShow:function(){return this.$(".js-securityOptions").removeClass("hide")},securityOptionsHide:function(){return this.$(".js-securityOptions").addClass("hide")},securityOptionsShown:function(){return!this.$(".js-securityOptions").hasClass("hide")},pgpSecurityEnabled:function(){return App.Config.get("pgp_integration")},smimeSecurityEnabled:function(){return App.Config.get("smime_integration")},securityEnabled:function(){return this.pgpSecurityEnabled()||this.smimeSecurityEnabled()},securityTypeShown:function(){return this.pgpSecurityEnabled()&&this.smimeSecurityEnabled()},updateSecurityTypeToolbar:function(){return this.securityTypeShown()?(this.$('.js-securityType[data-type="PGP"]').removeClass("btn--active"),this.$('.js-securityType[data-type="S/MIME"]').addClass("btn--active"),this.$(".js-securityType").show()):(this.$(".js-securityType").hide(),this.smimeSecurityEnabled()?this.$('.js-securityType[data-type="S/MIME"]').addClass("btn--active"):this.pgpSecurityEnabled()?this.$('.js-securityType[data-type="PGP"]').addClass("btn--active"):this.$(".js-securityType").removeClass("btn--active"))},paramsSecurity:function(){var t;return this.$(".js-securityOptions").hasClass("hide")?{}:((t={}).encryption||(t.encryption={}),t.sign||(t.sign={}),t.type=this.securityType(),this.$(".js-securityEncrypt").hasClass("btn--active")&&(t.encryption.success=!0),this.$(".js-securitySign").hasClass("btn--active")&&(t.sign.success=!0),t)},securityType:function(){return this.$(".js-securityType.btn--active").data("type")},securityTypeName:function(){var t;if(t=this.securityType())return"S/MIME"===t?"smime":"PGP"===t?"pgp":void 0},updateSecurityOptionsRemote:function(t,e,n){var i,s,r;if(this.securityEnabled()&&(s=this.securityTypeName()))return r=this,i=function(){return r.ajax({id:s+"-check-"+t,type:"POST",url:r.apiPath+"/integration/"+s,data:JSON.stringify({ticket:e,article:n}),processData:!0,success:function(t){var n,i,o,a,l;for(s in a={encryption:!0,sign:!0},o=App.Config.get(s+"_config"),n={default_sign:"sign",default_encryption:"encryption"})l=n[s],(null!=o&&null!=(i=o.group_id)?i[s]:void 0)&&e.group_id&&!1===o.group_id[s][e.group_id.toString()]&&(a[l]=!1);return r.$(".js-securityEncryptComment").attr("title",App.i18n.translateContent(t.encryption.comment||"",t.encryption.commentPlaceholders)),!0===t.encryption.success?(r.$(".js-securityEncrypt").attr("disabled",!1),a.encryption?r.$(".js-securityEncrypt").addClass("btn--active"):r.$(".js-securityEncrypt").removeClass("btn--active")):(r.$(".js-securityEncrypt").attr("disabled",!0),r.$(".js-securityEncrypt").removeClass("btn--active")),r.$(".js-securitySignComment").attr("title",App.i18n.translateContent(t.sign.comment||"",t.sign.commentPlaceholders)),!0===t.sign.success?(r.$(".js-securitySign").attr("disabled",!1),a.sign?r.$(".js-securitySign").addClass("btn--active"):r.$(".js-securitySign").removeClass("btn--active")):(r.$(".js-securitySign").attr("disabled",!0),r.$(".js-securitySign").removeClass("btn--active"))}})},this.delay(i,200,"security-check")},securityOptionsReset:function(){return this.$(".js-securityEncryptComment").removeAttr("title"),this.$(".js-securityEncrypt").attr("disabled",!0).removeClass("btn--active"),this.$(".js-securitySignComment").removeAttr("title"),this.$(".js-securitySign").attr("disabled",!0).removeClass("btn--active")}}}.call(this),function(){var t;t={ajax_mass_update:function(t,e){return this.ajax_mass("update",t,e)},ajax_mass_macro:function(t,e){return this.ajax_mass("macro",t,e)},ajax_mass:function(t,e,n){return this.startLoading(),this.ajax({id:"bulk_update",type:"POST",url:this.apiPath+"/tickets/mass_"+t,data:JSON.stringify(e),success:(i=this,function(t){return i.stopLoading(),App.Collection.loadAssets(t.assets),App.Event.trigger("overview:fetch"),App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent(__("Bulk action executed!"))}),"function"==typeof n?n():void 0}),error:function(t){return function(e,n,i){var s,r;if(t.stopLoading(),422===e.status)return s=e.responseJSON.error&&(r=App.Ticket.find(e.responseJSON.ticket_id))?App.i18n.translateContent(__("Ticket failed to save: %s"),r.title):i,new App.ErrorModal({head:__("Bulk action failed"),contentInline:s,container:t.el.closest(".content")})}}(this)});var i}},App.TicketMassUpdatable={extended:function(){return this.include(t)}}}.call(this),function(){App.TicketNavigable={taskOpenTicket:function(t,e){return t instanceof App.Ticket&&(t=t.id),this.taskLoadTicket(t),this.navigate(null!=e?e:"ticket/zoom/"+t)},taskLoadTicket:function(t){return App.TaskManager.execute({key:"Ticket-"+t,controller:"TicketZoom",params:{ticket_id:t,overview_id:this.overview_id},show:!0})},getNextTicketInOverview:function(){if(this.ticket&&this.overview_id)return App.Overview.find(this.overview_id).nextTicket(this.ticket)},openTicketInOverview:function(t){return t?(this.taskCloseTicket(),this.taskLoadTicket(t.id),void this.navigate("#ticket/zoom/"+t.id)):this.taskCloseTicket(!0)},taskOpenNextTicketInOverview:function(){var t;if(null!=this.overview_id&&null!=this.ticket)return(t=this.getNextTicketInOverview())?(this.taskCloseTicket(),void this.taskLoadTicket(t.id)):this.taskCloseTicket(!0);this.taskCloseTicket(!0)},taskCloseTicket:function(t){var e;if(null==t&&(t=!1),App.TaskManager.remove(this.taskKey),t){if(!(e=App.TaskManager.nextTaskUrl()))return this.navigate("#");this.navigate(e)}}}}.call(this),function(){App.TicketNotificationMatrix={renderNotificationMatrix:function(t){return App.UiElement.notification_matrix.render(t)[0].outerHTML},updatedNotificationMatrixValues:function(t){var e,n,i,s;for(n in i={},t)if(s=t[n],"matrix"===(e=n.split("."))[0])switch(i[e[1]]||(i[e[1]]={}),e[2]){case"criteria":i[e[1]][e[2]]||(i[e[1]][e[2]]={}),i[e[1]][e[2]][e[3]]="true"===s;break;case"channel":i[e[1]][e[2]]={email:"email"===s,online:!0}}return i}}}.call(this),function(){App.TicketNumberInput={removeTicketSelectionOnFocus:function(t,e){return t.on("focus",'[name="'+e+'"]',(function(t){return $(t.target).parents().find('[name="radio"]').prop("checked",!1)}))},stripTicketHookOnPaste:function(t,e){return t.on("paste",'[name="'+e+'"]',(n=this,function(t){var i;i=function(){if(t.target&&t.target.value)return $('[name="'+e+'"]').val(t.target.value.replace(App.Config.get("ticket_hook"),""))},n.delay(i,0)}));var n},updateTicketNumberOnRadioClick:function(t,e){return t.on("click",'[name="radio"]',(function(t){var n,i;if($(t.target).prop("checked"))return i=$(t.target).val(),n=App.Ticket.fullLocal(i),$(t.target).parents().find('[name="'+e+'"]').val(n.number)}))}}}.call(this),function(){App.TimeAccountingUnitMixin={timeAccountingUnitOptions:function(){return[{display:__("no unit"),value:""},{display:__("hour(s)"),value:"hour"},{display:__("quarter-hour(s)"),value:"quarter"},{display:__("minute(s)"),value:"minute"},{display:__("custom unit"),value:"custom"}]},timeAccountingDisplayUnit:function(){switch(this.Config.get("time_accounting_unit")){case"hour":return __("hour(s)");case"quarter":return __("quarter-hour(s)");case"minute":return __("minute(s)");case"custom":return this.Config.get("time_accounting_unit_custom")?this.Config.get("time_accounting_unit_custom"):null;default:return null}}}}.call(this),function(){App.ValidUsersForTicketSelectionMethods={validUsersForTicketSelection:function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m;for(r=$(".content.active .main .table").find('[name="bulk"]:checked'),f=_.map(r,(function(t){return $(t).val()})),d=_.map(App.Ticket.findAll(f),(function(t){return t.group_id})),m=this.usersInGroups(d),e=_.keys(null!=(a=this.formMeta)&&null!=(l=a.dependencies)?l.group_id:void 0),n=App.Group.findAll(e),i=_.sortBy(n,(function(t){return t.name})),s=0,o=n.length;s<o;s++)(t=n[s]).valid_users_count=(null!=(c=this.formMeta)&&null!=(u=c.dependencies)&&null!=(p=u.group_id)&&null!=(h=p[t.id])?h.owner_id.length:void 0)||0;return{users:m,groups:i}},usersInGroups:function(t){var e,n,i,s,r;return e=_.chain(null!=(i=this.formMeta)&&null!=(s=i.dependencies)?s.group_id:void 0).pick(t).values().map((function(t){return t.owner_id})).value(),n=_.intersection.apply(_,e),r=App.User.findAll(n),_.sortBy(r,(function(t){return t.firstname}))}}}.call(this),function(){var t=[].slice;App.ViewHelpers={P:function(t,e,n,i){return null==i&&(i=!1),App.viewPrint(t,e,n,i)},date:function(t){var e,n,i;return t?(i=new Date(t),e=App.Utils.formatTime(i.getDate(),2),n=App.Utils.formatTime(i.getMonth()+1,2),i.getFullYear()+"-"+n+"-"+e):""},datetime:function(t){var e,n,i,s,r,o;return t?(r=new Date(t),i=App.Utils.formatTime(r.getDate(),2),s=App.Utils.formatTime(r.getMonth()+1,2),o=r.getFullYear(),n=App.Utils.formatTime(r.getSeconds(),2),e=App.Utils.formatTime(r.getMinutes(),2),o+"-"+s+"-"+i+" "+App.Utils.formatTime(r.getHours(),2)+":"+e+":"+n):""},decimal:function(t,e){return null==e&&(e=2),App.Utils.decimal(t,e)},time_duration:function(t){var e,n,i;return t?isNaN(parseInt(t))?"":(e=~~parseInt(t/3600),(n=~~parseInt(t%3600/60))<10&&(n="0"+n),(i=parseInt(t%60))<10&&(i="0"+i),e>0?e+":"+n+":"+i:n+":"+i):""},time_duration_hh_mm:function(t){var e,n;return t?isNaN(parseInt(t))?"":((e=~~parseInt(t/60))<10&&(e="0"+e),(n=~~parseInt(t%60))<10&&(n="0"+n),e+":"+n):""},relative_time:function(t,e,n){var i,s;switch(null==n&&(n=!0),s=new Date,i=parseInt(t,10),e){case"minute":s.setMinutes(s.getMinutes()+i);break;case"hour":s.setHours(s.getHours()+i);break;case"day":s.setDate(s.getDate()+i);break;case"week":s.setDate(s.getDate()+7*i);break;case"month":s.setMonth(s.getMonth()+i);break;case"year":s.setFullYear(s.getFullYear()+i)}return n?s.toISOString():s.toISOString().substring(0,10)},M:function(t,e,n){var i,s,r,o;if(null==e&&(e=1),null==n&&(n=2),!t)return"";for(o="",n=t.length-n-1,s=i=0,r=t.length-1;0<=r?i<=r:i>=r;s=0<=r?++i:--i)o+=e<=s&&n>=s?"*":t[s];return o},T:function(){var e,n,i;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(i=App.i18n).translateContent.apply(i,[n].concat(t.call(e)))},Ti:function(){var e,n,i;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(i=App.i18n).translateInline.apply(i,[n].concat(t.call(e)))},Tp:function(){var e,n,i;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(i=App.i18n).translatePlain.apply(i,[n].concat(t.call(e)))},Tdate:function(){var e,n,i;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(i=App.i18n).translateDate.apply(i,[n].concat(t.call(e)))},Ttimestamp:function(){var e,n,i;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(i=App.i18n).translateTimestamp.apply(i,[n].concat(t.call(e)))},L:function(t){return t&&"string"==typeof t?App.Utils.linkify(t):t},C:function(t){return App.Config.get(t)},S:function(t){return App.Session.get(t)},V:function(t,e){return App.view(t)(e)},AddressLine:function(t){var e,n,i,s,r;if(!t)return"";if(!(i=emailAddresses.parseAddressList(t)))return App.Utils.htmlEscape(t);for(r="",e=0,s=i.length;e<s;e++)r&&(r+=", "),(n=i[e]).name&&(n.name=n.name.replace(",","").replace(";","").replace('"',"").replace("'",""),n.name.match(/\@|,|;|\^|\+|#|\xa7|\$|%|&|\/|\(|\)|=|\?|\*/)&&(n.name='"'+n.name+'"'),r=""+r+App.Utils.htmlEscape(n.name)+" "),n.address&&(r=r+' <span class="text-muted">&lt;'+App.Utils.htmlEscape(n.address)+"&gt</span>");return r},humanFileSize:function(t){return App.Utils.humanFileSize(t)},humanTime:function(t,e,n,i){var s
;return null==e&&(e=!1),null==n&&(n=""),null==i&&(i=!0),e&&(n+=" escalation"),s=' title="'+App.i18n.translateTimestamp(t)+'"',i||(s="",n+=" noTitle"),'<time class="humanTimeFromNow '+n+'" datetime="'+t+'"'+s+">"+App.PrettyDate.humanTime(t,e)+"</time>"},Icon:function(t,e){return null==e&&(e=""),App.Utils.icon(t,e)},fontIcon:function(t,e,n){return null==n&&(n=""),App.Utils.fontIcon(t,e,n)},RichText:function(t){return t?t.match(/@T\('/)?(t=t.replace(/@T\('(.+?)'\)/g,(function(t,e){return App.i18n.translateContent(e)})),marked(t)):App.i18n.translateContent(t):t},ContentOrMimeType:function(t){var e;return e=["Content-Type","content_type","Mime-Type","mime_type"],_.values(_.pick(null!=t?t.preferences:void 0,e))[0]},ContentTypeIcon:function(t){return{"image/jpeg":"file-image","image/jpg":"file-image","image/png":"file-image","image/svg":"file-image","image/gif":"file-image","application/pdf":"file-pdf","application/msword":"file-word","application/vnd.ms-word":"file-word","application/vnd.oasis.opendocument.text":"file-word","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"file-word","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"file-word","application/vnd.ms-excel":"file-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"file-excel","application/vnd.oasis.opendocument.spreadsheet":"file-excel","application/vnd.ms-powerpoint":"file-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation":"file-powerpoint","application/vnd.oasis.opendocument.presentation":"file-powerpoint","text/plain":"file-text","text/html":"file-code","application/json":"file-code","message/rfc822":"file-email","application/json":"file-code","text/plain":"file-text","text/rtf":"file-text","text/calendar":"file-calendar","application/gzip":"file-archive","application/zip":"file-archive"}[t=App.Utils.contentTypeCleanup(t)]},canDownload:function(t){return"application/pdf"!==(t=App.Utils.contentTypeCleanup(t))&&"text/html"!==t},canPreview:function(t){return!_.isEmpty(t)&&!!t.match(/image\/(png|jpg|jpeg|gif)/i)},unique_avatar:function(t,e,n){var i,s,r,o,a,l;return null==n&&(n=40),o=300*n/(i=40),s=226*n/i,a=(r=new Math.seedrandom(t))()*(o-n),l=r()*(s-n),App.view("avatar_unique")({x:a,y:l,initials:e})},iconWithModifier:function(t,e){return e.className||(e.className=""),e.addStateClass&&(e.className+=" state-"+t.state),App.view("knowledge_base/_icon_with_modifier")({item:t,className:e.className,iconset:e.iconset})},replacePlaceholder:function(t,e,n){return null==n&&(n=!1),App.Utils.replaceTags(t,e,n)},dir:function(t,e){return"ltr"===App.i18n.dir()?t:e}}}.call(this),function(){App.Config.set("api_path","api/v1"),App.Config.set("image_path","/assets/images")}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Model=function(e){function n(){n.__super__.constructor.apply(this,arguments)}return t(n,e),n.apiPath=App.Config.get("api_path"),n.allowedReplaceTagsFunctionMapping={},n.prototype.uiUrl=function(){return"#"},n.prototype.translate=function(){return App[this.constructor.className].configure_translate},n.prototype.objectDisplayName=function(){return this.constructor.className},n.prototype.displayName=function(){return this.name||"-"},n.prototype.icon=function(){return""},n.prototype.iconTitle=function(){return""},n.prototype.iconActivity=function(){return""},n.validate=function(t){var e,n,i,s,r,o,a,l,c;for(n in null==t&&(t={}),c=null!=t&&null!=(o=t.controllerForm)?o.screen:void 0,(null!=t&&null!=(a=t.controllerForm)?a.mixedAttributes:void 0)?i=null!=t&&null!=(l=t.controllerForm)?l.mixedAttributes:void 0:App[t.model]&&App[t.model].attributesGet?i=App[t.model].attributesGet(c):t.model.configure_attributes&&(i=App.Model.attributesGet(c,t.model.configure_attributes)),s={},i)if(!(e=i[n]).readonly){if(t.controllerForm&&t.controllerForm.attributeIsMandatory(e.name))if((r=e.name.split("::"))[0]&&!r[1])n in t.params&&!this._validate_is_empty(t.params[n])||(s[n]=__("is required"));else{if(!r[0]||!r[1]||r[2])throw"can't parse '"+e.name+"'";t.params[r[0]]&&r[1]in t.params[r[0]]&&!this._validate_is_empty(t.params[r[0]][r[1]])||(s[n]=__("is required"))}"password"===e.type&&t.params[n]&&n+"_confirm"in t.params&&t.params[n]!==t.params[n+"_confirm"]&&(s[n]="didn't match",s[n+"_confirm"]=""),"email"===e.type&&t.params[n]&&(t.params[n].match(/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i)||(s[n]="invalid"),t.params[n].match(/ /)&&(s[n]="invalid")),"datetime"===e.tag&&"invalid"===t.params[n]&&(s[n]="invalid"),"date"===e.tag&&"invalid"===t.params[n]&&(s[n]="invalid")}if((null!=t?t.controllerForm:void 0)&&App.FormHandlerCoreWorkflow.requestsRunning(t.controllerForm)&&(s._core_workflow={target:t.target,controllerForm:t.controllerForm}),!_.isEmpty(s))return s._core_workflow||App.Log.error("Model","validation failed",s),s},n._validate_is_empty=function(t){return""===t||(null===t||(void 0===t||(!0===_.isArray(t)&&0===t.length||!0===_.isArray(t)&&1===t.length&&""===t[0])))},n.attributesSet=function(t){var e,n,i,s,r,o,a,l,c,u,p;for(n=[],r=0,l=(i=App[this.className].configure_attributes).length;r<l;r++){for(p=i[r],s=!1,o=0,c=t.length;o<c;o++)if((e=t[o]).name===p.name){s=!0;break}s||n.push(p)}for(a=0,u=t.length;a<u;a++)e=t[a],App[this.className].attributes.push(e.name),n.push(e);return App[this.className].configure_attributes=n},n.attributesGet=function(t,e,n,i,s){var r,o,a,l,c,u,p,h,d,f,m,g;if(null==t&&(t=void 0),null==e&&(e=!1),null==n&&(n=!1),null==i&&(i=void 0),null==s&&(s=void 0),i||(i=this.className),!(e=clone(e||App[i].configure_attributes,!0)))return{};if(o={},t)for(c=0,d=e.length;c<d;c++)if((r=e[c])&&r.screen&&r.screen[t]&&!_.isEmpty(r.screen[t])&&(!0===r.screen[t].shown||void 0===r.screen[t].shown||App.FormHandlerCoreWorkflow.checkScreen(i,t))){for(u in m=r.screen[t])g=m[u],r[u]=g;o[r.name]=r}if((!t||_.isEmpty(o))&&!n)for(p=0,f=e.length;p<f;p++)o[(r=e[p]).name]=r;for(h in o)if(r=o[h],s&&(r.renderTarget=s),r.diff)switch(a=(new Date).getTime(),r.tag){case"date":l=new Date(a+3600*r.diff*1e3),r.default=App.i18n.convert(l,0,"yyyy-mm-dd");break;case"datetime":(l=new Date(a+60*r.diff*1e3)).setSeconds(0),l.setMilliseconds(0),r.default=l.toISOString()}return o},n.prototype.validate=function(t){return null==t&&(t={}),App.Model.validate({model:this.constructor.className,params:this,controllerForm:t.controllerForm,target:t.target})},n.prototype.isOnline=function(){return!!this.id&&("number"==typeof this.id||"c"!==this.id[0])},n.fullLocal=function(t){return this._fillUp(App[this.className].find(t))},n.full=function(t,e,n,i){var s,r,o,a,l;return null==e&&(e=!1),null==n&&(n=!1),null==i&&(i=!1),a=this.url+"/"+t+"?full=true",o=void 0,i&&(o=App[this.className].subscribeItem(t,e)),!n&&App[this.className].exists(t)?(s=App[this.className].find(t),s=this._fillUp(s),e&&e(s,"full"),o):(this.FULL_CALLBACK||(this.FULL_CALLBACK={}),this.FULL_CALLBACK[t]||(this.FULL_CALLBACK[t]={}),e&&(r=this.className+"-"+Math.floor(99999*Math.random()),this.FULL_CALLBACK[t][r]=e),this.FULL_FETCH||(this.FULL_FETCH={}),this.FULL_FETCH[t]||(this.FULL_FETCH[t]=!0,App.Log.debug("Model","fetch "+this.className+".find("+t+") from server",a),App.Ajax.request({type:"GET",url:a,processData:!0,success:(l=this,function(n){var i;if(l.FULL_FETCH[t]=!1,App.Log.debug("Model","got "+l.className+".find("+t+") from server",n),n.assets?App.Collection.loadAssets(n.assets,{targetModel:l.className}):App[l.className].refresh(n),l.FULL_CALLBACK[n.id]){for(r in i=l.FULL_CALLBACK[n.id])(e=i[r])(l._fillUp(App[l.className].find(n.id))),delete l.FULL_CALLBACK[n.id][r];if(_.isEmpty(l.FULL_CALLBACK[n.id]))return delete l.FULL_CALLBACK[n.id]}}),error:function(e){return function(n,i,s){return e.FULL_FETCH[t]=!1,App.Log.error("Model",i,s,a)}}(this)})),o)},n.subscribe=function(t,e){var n,i,s,r;return null==e&&(e={}),this.SUBSCRIPTION_COLLECTION||(this.SUBSCRIPTION_COLLECTION={},this.bind("refresh",(r=this,function(e){var n,i,s;for(n in _.isArray(e)||(e=[e]),App.Log.debug("Model","local collection refresh "+r.className,e),s=[],i=r.SUBSCRIPTION_COLLECTION)t=i[n],s.push(t(e,"refresh"));return s})),this.bind("change",function(e){return function(n,i){var s,r,o;if("destroy"!==i){for(s in _.isArray(n)||(n=[n]),App.Log.debug("Model","local collection change "+e.className,n),o=[],r=e.SUBSCRIPTION_COLLECTION)t=r[s],o.push(t(n,"change"));return o}}}(this)),this.bind("destroy",function(e){return function(n){var i,s,r;for(i in _.isArray(n)||(n=[n]),App.Log.debug("Model","local collection destroy "+e.className,n),r=[],s=e.SUBSCRIPTION_COLLECTION)t=s[i],r.push(t(n,"destroy"));return r}}(this)),i=this.className+":create "+this.className+":update "+this.className+":touch "+this.className+":destroy",App.Event.bind(i,function(e){return function(){if(!_.isEmpty(e.SUBSCRIPTION_COLLECTION))return App.Log.debug("Model","server notify collection change "+e.className),t=function(){return e.fetchFull((function(){}),{clear:!0})},App.Delay.set(t,200,"fullcollection-"+e.className,"model-"+e.className)}}(this),"Collection::Subscribe::"+this.className)),s=this.className+"-"+Math.floor(99999*Math.random()),this.SUBSCRIPTION_COLLECTION[s]=t,!0===e.initFetch&&(n=!0,!0!==e.clear&&!1!==e.clear||(n=e.clear),this.initFetchActives||0!==this.count()?t(this.all()):(this.initFetchActive=!0,this.one("refresh",function(e){return function(n){return e.initFetchActive=!1,t(n)}}(this)),this.fetchFull((function(){}),{clear:n}))),s},n.prototype.subscribe=function(t){return App[this.constructor.className].subscribeItem(this.id,t)},n.prototype.unsubscribe=function(t){return App[this.constructor.className].unsubscribeItem(this.id,t)},n.subscribeItem=function(t,e){var n,i,s;return this._subscribeItemBindDone||(this._subscribeItemBindDone=!0,this.bind("change",(s=this,function(t){var n,i,r,o,a;for(_.isArray(t)||(t=[t]),App.Log.debug("Model","local change "+s.className,t),a=[],n=0,o=t.length;n<o;n++)i=t[n],a.push(function(){var t,n;for(r in n=[],t=App[this.className].SUBSCRIPTION_ITEM[i.id])e=t[r],n.push(e(App[this.className]._fillUp(i),"change"));return n}.call(s));return a})),this.bind("destroy",function(t){return function(n){var i,s,r,o,a;for(_.isArray(n)||(n=[n]),App.Log.debug("Model","local destroy "+t.className,n),a=[],i=0,o=n.length;i<o;i++)s=n[i],a.push(function(){var t,n;for(r in n=[],t=App[this.className].SUBSCRIPTION_ITEM[s.id])e=t[r],n.push(e(App[this.className]._fillUp(s),"destroy"));return n}.call(t));return a}}(this)),this.changeTable={},this.bind("refresh",function(t){return function(n){var i,s,r,o,a;for(_.isArray(n)||(n=[n]),App.Log.debug("Model","local refresh "+t.className,n),a=[],i=0,o=n.length;i<o;i++)s=n[i],a.push(function(){var t,n;for(r in n=[],t=App[this.className].SUBSCRIPTION_ITEM[s.id])e=t[r],!this.changeTable[r]||this.changeTable[r]<s.updated_at?(this.changeTable[r]=s.updated_at,n.push(e(App[this.className]._fillUp(s),"refresh"))):n.push(void 0);return n}.call(t));return a}}(this)),n=this.className+":create "+this.className+":update "+this.className+":touch",App.Event.bind(n,function(t){return function(n){if(t.SUBSCRIPTION_ITEM&&t.SUBSCRIPTION_ITEM[n.id])return App.Log.debug("Model","server change on "+t.className+".find("+n.id+") "+n.updated_at),e=function(){var e;if(e=void 0,App[t.className].exists(n.id)&&(e=App[t.className].find(n.id)),!e||new Date(n.updated_at)>new Date(e.updated_at))return App.Log.debug("Model","request "+t.className+".find("+n.id+") from server"),t.full(n.id,!1,!0)},App.Delay.set(e,600,"full-"+n.id,"model-"+t.className)}}(this),"Item::Subscribe::"+this.className),n=this.className+":destroy",App.Event.bind(n,function(t){return function(n){var i;if(t.SUBSCRIPTION_ITEM&&t.SUBSCRIPTION_ITEM[n.id]&&App[t.className].exists(n.id))return i=App[t.className].find(n.id),App.Log.debug("Model","server delete on "+t.className+".find("+n.id+") "+n.updated_at),e=function(){return i.trigger("destroy",i)},App.Delay.set(e,500,"delete-"+n.id,"model-"+t.className)}}(this),"Item::SubscribeDelete::"+this.className)),this.SUBSCRIPTION_ITEM||(this.SUBSCRIPTION_ITEM={}),this.SUBSCRIPTION_ITEM[t]||(this.SUBSCRIPTION_ITEM[t]={}),i=this.className+"-"+Math.floor(99999*Math.random()),this.SUBSCRIPTION_ITEM[t][i]=e,i},n.unsubscribeItem=function(t,e){if(this.SUBSCRIPTION_ITEM&&this.SUBSCRIPTION_ITEM[t]&&this.SUBSCRIPTION_ITEM[t][e])return delete this.SUBSCRIPTION_ITEM[t][e]},n.unsubscribe=function(t){var e,n,i;if(this.SUBSCRIPTION_ITEM)for(e in i=this.SUBSCRIPTION_ITEM)(n=i[e])[t]&&delete n[t];if(this.SUBSCRIPTION_COLLECTION&&this.SUBSCRIPTION_COLLECTION[t])return delete this.SUBSCRIPTION_COLLECTION[t]},n.fetchFull=function(t,e){var n,i,s,r;if(null==e&&(e={}),s=this.url+"/?full=true",App.Log.debug("Model","fetchFull collection "+this.className,s),i=this.className+"::fetchFull",!1!==e.force||0===App[this.className].count()){if(t&&(n=function(e){return function(){return t(App[e.className].all())}}(this),App.QueueManager.add(i,n)),!(this.fetchFullActive&&this.fetchFullActive>(new Date).getTime()-500))return this.fetchFullActive=(new Date).getTime(),App.Ajax.request({type:"GET",url:s,processData:!0,success:function(t){return function(n){return t.fetchFullActive=!1,App.Log.debug("Model","got fetchFull collection "+t.className,n),e.clear&&App[t.className].deleteAll(),n.assets?(App.Collection.loadAssets(n.assets,{targetModel:t.className}),n.record_ids&&_.isEmpty(n.record_ids)&&App[t.className].trigger("refresh",[])):App[t.className].refresh(n),App.QueueManager.run(i)}}(this),error:function(t){return function(e,n,i){return t.fetchFullActive=!1,App.Log.error("Model",n,i,s)}}(this)})}else t&&(r=this,n=function(){return t(App[r.className].all(),"full")},App.QueueManager.add(i,n),App.QueueManager.run(i))},n.indexFull=function(t,e){var n,i,s,r,o,a,l;for(null==e&&(e={}),a=this.url+"?full=true",n=0,s=(o=["page","per_page","sort_by","order_by"]).length;n<s;n++)i=o[n],e[i]&&(a+="&"+i+"="+e[i]);return App.Log.debug("Model","indexFull collection "+this.className,a),r=this.className+"::indexFull",void 0===e.refresh&&(e.refresh=!0),App.Ajax.request({type:"GET",url:a,processData:!0,success:(l=this,function(n){var i,s;return App.Log.debug("Model","got indexFull collection "+l.className,n),s=n.record_ids,void 0===n.record_ids&&(s=n[l.className.toLowerCase()+"_ids"]),n.assets?(App.Collection.loadAssets(n.assets,{targetModel:l.className}),n.record_ids&&_.isEmpty(n.record_ids)&&e.refresh&&App[l.className].trigger("refresh",[])):e.refresh&&App[l.className].refresh(n),t&&(i=function(){var e,i,r,o;for(e=[],r=0,o=s.length;r<o;r++)i=s[r],e.push(App[l.className].find(i));return t(e,n)},App.QueueManager.add(r,i)),App.QueueManager.run(r)}),error:function(t){return function(e,n,i){return t.indexFullActive=!1,App.Log.error("Model",n,i,a)}}(this)})},n._bindsEmpty=function(){var t,e,n;if(this.SUBSCRIPTION_ITEM)for(t in n=this.SUBSCRIPTION_ITEM)if(e=n[t],!_.isEmpty(e))return!1;return!(this.SUBSCRIPTION_COLLECTION&&!_.isEmpty(this.SUBSCRIPTION_COLLECTION))},n._fillUp=function(t,e){var n,i,s,r,o,a;if(null==e&&(e=[]),!App[this.className].configure_attributes)return t;for(i=0,r=(o=App[this.className].configure_attributes).length;i<r;i++)(n=o[i]).relation&&(_.contains(e,this.className)||App[n.relation]&&(a=n.name.substr(0,n.name.length-3),"_id"===n.name.substr(n.name.length-3,n.name.length)&&t[n.name]&&(App[n.relation].exists(t[n.name])?(s=App[n.relation].findNative(t[n.name]),s=App[n.relation]._fillUp(s,e.concat(this.className)),t[a]=s):n.do_not_log||console.log("ERROR, cant find "+n.name+" App."+n.relation+".find("+t[n.name]+") for '"+t.constructor.className+"' "+t.displayName()))));return t},n.search=function(t){var e,n,i,s,r,o,a,l;if(e=this.all(),n=[],!t){for(i=0,a=e.length;i<a;i++)s=e[i],r=this.findNative(s.id),n.push(this._fillUp(r));return n}for(o=0,l=e.length;o<l;o++)s=e[o],r=this.findNative(s.id),n.push(this._fillUp(r));return t.filter&&(n=this._filter(n,t.filter)),t.filterExtended&&(n=this._filterExtended(n,t.filterExtended)),null!==t.sortBy&&(n=this._sortBy(n,t.sortBy,t.translate)),t.order&&(n=this._order(n,t.order)),n},n._sortByItem=function(t,e,n){var i;if(e||(e="displayName"),"displayName"===e){if(t.displayName)return i=t.displayName(),(n?App.i18n.translateInline(i):i).toLowerCase();e="name"}return void 0===t[e]||null===t[e]?"":t[e].toLowerCase?(i=t[e],(n?App.i18n.translateInline(i):i).toLowerCase()):t[e]},n._sortBy=function(t,e,n){return t.sort((i=this,function(t,s){var r,o;return r=i._sortByItem(t,e,n),o=i._sortByItem(s,e,n),r.localeCompare?r.localeCompare(o):r>o||null===r?1:r<o||null===o?-1:0}));var i},n._order=function(t,e){return"DESC"===e?t.reverse():t},n._filter=function(t,e){var n,i,s;for(i in e)s=e[i],n=s,_.isArray(n)||(n=[n]),t=_.filter(t,(function(t){var e,r,o;for(r=t[i],_.isArray(r)||(r=[r]),e=0,o=n.length;e<o;e++)if(s=n[e],_.contains(r,s))return t}));return t},n._filterExtended=function(t,e){return t=_.filter(t,(function(t){var n,i,s,r,o,a,l;for(i=0,r=e.length;i<r;i++){for(s in o=void 0,n=e[i])l=n[s],!1!==o&&(a=new RegExp(l,"i"),o=!(void 0===t[s]||null===t[s]||!t[s].match(a)));if(!0===o)return t}}))},n.prototype.activityMessage=function(t){if(t)return"Need own activityMessage() in model to generate text ("+this.objectDisplayName()+"/"+t.type+")."},n.lastUpdatedAt=function(){var t,e,n,i,s;for(t=0,n=(i=this.all()).length;t<n;t++)(e=i[t]).updated_at&&(s?e.updated_at>s&&(s=e.updated_at):s=e.updated_at);return s},n.updatedAt=function(t){if(this.irecords[t])return this.irecords[t].updated_at},n.findNative=function(t){return this.irecords[t]||("function"==typeof notFound?notFound(t):void 0)},n.tagGet=function(t,e,n){return App.Ajax.request({id:e,type:"GET",url:this.apiPath+"/tags",data:{object:this.serverClassName||this.className,o_id:t},processData:!0,success:function(t){return n(t)}})},n.tagAdd=function(t,e){return App.Ajax.request({type:"POST",url:this.apiPath+"/tags/add",data:JSON.stringify({object:this.serverClassName||this.className,o_id:t,item:e}),processData:!0})},n.tagRemove=function(t,e){return App.Ajax.request({type:"DELETE",url:this.apiPath+"/tags/remove",data:JSON.stringify({object:this.serverClassName||this.className,o_id:t,item:e}),processData:!0})},n.clearInMemory=function(){return App.Delay.clearLevel("model-"+this.className),this.resetCallbacks(),this.resetAttributes(),this.deleteAll()},n.updateAttributes=function(t){var e,n,i,s,r,o,a,l,c,u;for(_.isEmpty(this.org_configure_attributes)&&(this.org_configure_attributes=$.extend(!0,[],this.configure_attributes)),s=$.extend(!0,[],this.configure_attributes),e=[],o=0,c=t.length;o<c;o++){for(n=t[o],this.attributes.push(n.name),r=!1,a=l=0,u=s.length;l<u;a=++l)if((i=s[a]).name===n.name){e.push($.extend(!0,i,n)),s.splice(a,1),r=!0;break}r||e.push($.extend(!0,{},n))}return this.configure_attributes=$.extend(!0,[],e.concat(s))},n.prototype.replaceTagsFunctionCallback=function(t,e){var n,i;if((n=App[this.constructor.className].allowedReplaceTagsFunctionMapping[t])&&(i=n.function_name))return this[i].apply(this,e)},n.resetAttributes=function(){if(!_.isEmpty(this.org_configure_attributes))return this.configure_attributes=$.extend(!0,[],this.org_configure_attributes)},n.resetCallbacks=function(){if(this.SUBSCRIPTION_ITEM&&(this.SUBSCRIPTION_ITEM={}),this.SUBSCRIPTION_COLLECTION)return this.SUBSCRIPTION_COLLECTION={}},n}(Spine.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ActivityStream=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("ActivityStream","name"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/activity_steams",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Application=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Application","name","redirect_uri"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/applications",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"redirect_uri",display:__("Callback URL"),tag:"textarea",limit:250,null:!1,note:__("Use one line per URI")},{name:"clients",display:__("Clients"),tag:"input",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_overview=["name","redirect_uri","clients"],n.configure_delete=!0,n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Calendar=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Calendar","name","timezone","default","business_hours","ical_url","public_holidays"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/calendars",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"timezone",display:__("Time zone"),tag:"timezone",null:!1},{name:"business_hours",display:__("Business Hours"),tag:"business_hours",null:!0},{name:"ical_url",display:__("Holidays iCalendar Feed"),tag:"ical_feed",placeholder:"http://example.com/public_holidays.ical",null:!0},{name:"public_holidays",display:__("Holidays"),tag:"holiday_selector",null:!0},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.prototype.displayName=function(){return this.name+" - "+this.timezone},n.description=__('A **calendar** is needed to calculate escalations based on business hours and to send out escalation notifications.\n\nDefine a **"standard"** calendar which is valid system-wide. The escalation notifications will only be sent to your agents during the defined business hours.\n\nIf you have customers with different business hours, you can create multiple calendars. Tickets are linked to calendars using **SLAs**.'),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Channel=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Channel","adapter","area","options","group_id","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/channels",n.prototype.displayName=function(){var t;return t="",this.options&&(this.options.inbound&&(t+=this.options.inbound.options.user+"@"+this.options.inbound.options.host+" ("+this.options.inbound.adapter+")"),this.options.outbound&&this.options.outbound&&(""!==t&&(t+=" / "),this.options.outbound.options?t+=this.options.outbound.options.host+" ("+this.options.outbound.adapter+")":t+=" ("+this.options.outbound.adapter+")")),""===t&&(t="-"),t},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Chat=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Chat","name","active","public","max_queue","block_ip","allowed_websites","block_country","note"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/chats",n.countries={AF:"Afghanistan",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua And Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia",BA:"Bosnia And Herzegovina",BW:"Botswana",BV:"Bouvet Island",BR:"Brazil",IO:"British Indian Ocean Territory",BN:"Brunei Darussalam",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CV:"Cape Verde",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo",CD:"Congo, The Democratic Republic Of The",CK:"Cook Islands",CR:"Costa Rica",CI:"Cote D'ivoire",HR:"Croatia",CU:"Cuba",CY:"Cyprus",CZ:"Czech Republic",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",TP:"East Timor",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands (malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GN:"Guinea",GW:"Guinea-bissau",GY:"Guyana",HT:"Haiti",HM:"Heard Island And Mcdonald Islands",VA:"Holy See (vatican City State)",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran, Islamic Republic Of",IQ:"Iraq",IE:"Ireland",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JO:"Jordan",KZ:"Kazakstan",KE:"Kenya",KI:"Kiribati",KP:"Korea, Democratic People's Republic Of",KR:"Korea, Republic Of",KV:"Kosovo",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Lao People's Democratic Republic",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libyan Arab Jamahiriya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macau",MK:"Macedonia, The Former Yugoslav Republic Of",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia, Federated States Of",MD:"Moldova, Republic Of",MC:"Monaco",MN:"Mongolia",MS:"Montserrat",ME:"Montenegro",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",AN:"Netherlands Antilles",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestinian Territory, Occupied",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Reunion",RO:"Romania",RU:"Russian Federation",RW:"Rwanda",SH:"Saint Helena",KN:"Saint Kitts And Nevis",LC:"Saint Lucia",PM:"Saint Pierre And Miquelon",VC:"Saint Vincent And The Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome And Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia And The South Sandwich Islands",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard And Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syrian Arab Republic",TW:"Taiwan, Province Of China",TJ:"Tajikistan",TZ:"Tanzania, United Republic Of",TH:"Thailand",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad And Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks And Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States",UM:"United States Minor Outlying Islands",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela",VN:"Viet Nam",VG:"Virgin Islands, British",VI:"Virgin Islands, U.s.",WF:"Wallis And Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"note",display:__("Note"),tag:"textarea",limit:250,null:!0},{name:"max_queue",display:__("Max. clients on waitlist"),tag:"input",default:2},{name:"block_ip",display:__("Blocked IPs (separated by ;)"),tag:"input",default:"",null:!0},{name:"allowed_websites",display:__("Allow websites (separated by ;)"),tag:"input",default:"",null:!0},{name:"block_country",display:__("Blocked countries"),tag:"column_select",multiple:!0,null:!0,default:"",options:n.countries,seperator:";"},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ChatSession=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("ChatSession","name","note"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/chat_sessions",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"state",display:__("State"),readonly:1},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_overview=["name","state","created_at"],n.display_name=__("Chat Session"),n.prototype.uiUrl=function(){return"#customer_chat/session/"+this.id},n.prototype.searchResultAttributes=function(){var t;return t="",_.isEmpty(this.name)||(t=this.displayName()),{display:"#"+this.id+" "+t,id:this.id,class:"chat_session chat_session-popover",url:this.uiUrl(),icon:"chat"}},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.CoreWorkflow=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("CoreWorkflow","name","object","preferences","condition_saved","condition_selected","perform","stop_after_match","priority","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/core_workflows",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"object",display:__("Object"),tag:"select",null:!1,nulloption:!0,translate:!0},{name:"preferences::screen",display:__("Context"),tag:"multiselect",translate:!0,null:!0,nulloption:!0,multiple:!0},{name:"condition_selected",display:__("Selected conditions"),tag:"core_workflow_condition",disable_objects:["article"],null:!0,preview:!1},{name:"condition_saved",display:__("Saved conditions"),tag:"core_workflow_condition",disable_objects:["article"],null:!0,preview:!1},{name:"perform",display:__("Action"),tag:"core_workflow_perform",null:!0,preview:!1},{name:"stop_after_match",display:__("Stop after match"),tag:"boolean",null:!1,default:!1},{name:"priority",display:__("Priority"),tag:"integer",type:"text",limit:100,null:!1,default:500},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["name","priority"],n.description=__("Core Workflows are actions or constraints on selections in forms. Depending on an action, it is possible to hide or restrict fields or to change the obligation to fill them in."),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.CoreWorkflowCustomModule=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("CoreWorkflowCustomModule","name"),n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",null:!1}],n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty
;App.DataPrivacyTask=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("DataPrivacyTask","state","deletable_id","deletable_type","preferences"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/data_privacy_tasks",n.configure_attributes=[{name:"deletable_id",display:__("User"),tag:"autocompletion_ajax",relation:"User",do_not_log:!0},{name:"state",display:__("State"),tag:"input",readonly:1},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_overview=[],n.description=__("**Data Privacy** helps you to delete and verify the removal of existing data from the system.\n\nIt can be used to delete tickets, organizations, and users. The owner assignment will be unset in case the deleted user is an agent.\n\nData Privacy tasks will be executed every 10 minutes. The execution might take some additional time depending on the number of objects that will be deleted."),n.prototype.activityMessage=function(t){if(t&&t.created_by)return"create"===t.type?App.i18n.translateContent("%s created data privacy task to delete user ID |%s|",t.created_by.displayName(),t.objectNative.deletable_id):"update"===t.type?App.i18n.translateContent("%s updated data privacy task to delete user ID |%s|",t.created_by.displayName(),t.objectNative.deletable_id):"completed"===t.type?App.i18n.translateContent("%s completed data privacy task to delete user ID |%s|",t.created_by.displayName(),t.objectNative.deletable_id):"Unknow action for ("+this.objectDisplayName()+"/"+t.type+"), extend activityMessage() of model."},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.EmailAddress=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("EmailAddress","name","email","channel_id","note","active","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/email_addresses",n.prototype.displayName=function(){return this.name?this.name+" <"+this.email+">":this.email},n.filterChannel=function(t,e,n){var i;return"collection"!==e?t:(i=void 0,n&&n.channel_id&&App.Channel.exists(n.channel_id)&&(i=App.Channel.find(n.channel_id)),_.filter(t,(function(t){if(t)if(i){if(t.area===i.area)return t}else if("Google::Account"===t.area||"Microsoft365::Account"===t.area||"Email::Account"===t.area)return t})))},n.configure_attributes=[{name:"name",display:__("Display name"),tag:"input",type:"text",limit:250,null:!1},{name:"email",display:__("Email"),tag:"input",type:"email",limit:250,null:!1},{name:"channel_id",display:__("Channel"),tag:"select",multiple:!1,null:!0,relation:"Channel",nulloption:!0,filter:n.filterChannel,do_not_log:!0},{name:"note",display:__("Note"),tag:"textarea",note:__("Notes are visible to agents only, never to customers."),limit:250,null:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"active",display:__("Active"),tag:"active",readonly:1}],n.configure_overview=["name","email"],n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ExternalCredential=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("ExternalCredential","name","credentials"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/external_credentials",n}(App.Model)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Group=function(n){function i(){return this.displayName=t(this.displayName,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.configure("Group","name","name_last","assignment_timeout","follow_up_possible","follow_up_assignment","email_address_id","signature_id","note","active","shared_drafts","updated_at"),i.extend(Spine.Model.Ajax),i.url=i.apiPath+"/groups",i.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",maxlength:255,readonly:1},{name:"assignment_timeout",display:__("Assignment timeout"),tag:"input",note:__("Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend."),type:"text",limit:100,null:!0},{name:"follow_up_possible",display:__("Follow-up possible"),tag:"select",default:"yes",options:{yes:__("yes"),new_ticket:__("do not reopen ticket but create new ticket"),new_ticket_after_certain_time:__("do not reopen ticket after certain time but create new ticket")},null:!1,note:__("Follow-up for closed ticket possible or not."),translate:!0},{name:"reopen_time_in_days",display:__("Reopening time in days"),tag:"input",type:"integer",null:!0},{name:"follow_up_assignment",display:__("Assign follow-ups"),tag:"select",default:"yes",options:{true:"yes",false:"no"},null:!1,note:__("Assign follow-up to latest agent again."),translate:!0},{name:"email_address_id",display:__("Email"),tag:"select",multiple:!1,null:!0,relation:"EmailAddress",nulloption:!0,do_not_log:!0},{name:"signature_id",display:__("Signature"),tag:"select",multiple:!1,null:!0,relation:"Signature",nulloption:!0,do_not_log:!0,display_warn:!0,warn:__("This signature is inactive, it won't be included in the reply.")},{name:"note",display:__("Note"),tag:"textarea",note:__("Notes are visible to agents only, never to customers."),limit:250,null:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"shared_drafts",display:__("Shared Drafts"),tag:"active"}],i.configure_clone=!0,i.configure_overview=["name"],i.has_parents=!0,i.prototype.uiUrl=function(){return"#group/zoom/"+this.id},i.prototype.activityMessage=function(t){return"create"===t.type?App.i18n.translateContent("%s created group |%s|",t.created_by.displayName(),t.title):"update"===t.type?App.i18n.translateContent("%s updated group |%s|",t.created_by.displayName(),t.title):"Unknow action for ("+this.objectDisplayName()+"/"+t.type+"), extend activityMessage() of model."},i.prototype.avatar=function(t,e){return null==t&&(t=40),null==e&&(e=[]),t=parseInt(t,10),e.push("size-"+t),e.push("avatar--group-color-"+this.id%3),App.view("avatar_group")({cssClass:e.join(" ")})},i.accesses=function(){return{read:__("Read"),create:__("Create"),change:__("Change"),overview:__("Overview"),full:__("Full")}},i.prototype.signature_id_is_display_warning=function(t){return!App.Signature.find(t).active},i.prototype.all_children=function(){var t,e,n,i;for(i=[],t=[this];t.length>0;)n=_.map(t,(function(t){return t.id})),e=_.filter(App.Group.all(),(function(t){return _.contains(n,t.parent_id)})),i=i.concat(e),t=e;return i},i.prototype.displayName=function(){return(this.name||this.name_last||"-").replaceAll("::"," \u203a ")},i}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Job=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Job","name","object","timeplan","condition","perform","disable_notification","note","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/jobs",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"timeplan",display:__("When should the job run?"),tag:"timer",null:!0},{name:"object",display:__("Object"),tag:"select",null:!0,options:{Ticket:__("Ticket"),User:__("User"),Organization:__("Organization")},default:"Ticket",translate:!0},{name:"condition",display:__("Conditions for affected objects"),tag:"object_selector",null:!0,executionTime:!0,noCurrentUser:!0},{name:"perform",display:__("Execute changes on objects"),tag:"object_perform_action",null:!0,notification:!0,ticket_delete:!0,data_privacy_deletion_task:!0},{name:"disable_notification",display:__("Disable Notifications"),tag:"boolean",default:!0},{name:"note",display:__("Note"),tag:"textarea",note:__("Notes are visible to agents only, never to customers."),limit:250,null:!0},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"matching",display:__("Will process"),readonly:1},{name:"processed",display:__("Has processed"),readonly:1},{name:"last_run_at",display:__("Last run"),tag:"datetime",readonly:1,include_timezone:!0},{name:"next_run_at",display:__("Scheduled for"),tag:"datetime",readonly:1,include_timezone:!0},{name:"running",display:__("Running"),tag:"boolean",readonly:1},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["name","object","last_run_at","processed","next_run_at","matching"],n}(App.Model)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBase=function(n){function i(){return this.hasAssetsToLoad=t(this.hasAssetsToLoad,this),this.removeAssetsIfNeeded=t(this.removeAssetsIfNeeded,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.configure("KnowledgeBase","iconset","color_highlight","color_header","color_header_link","translation_ids","locale_ids","homepage_layout","category_layout","custom_address","show_feed_icon"),i.extend(Spine.Model.Ajax),i.extend(App.KnowledgeBaseActions),i.extend(App.KnowledgeBaseAccess),i.url=i.apiPath+"/knowledge_bases",i.manageUrl=i.apiPath+"/knowledge_bases/manage",i.prototype.manageUrl=function(t){return null==t&&(t=null),App.Utils.joinUrlComponents(this.constructor.manageUrl,this.id,t)},i.prototype.publicBaseUrl=function(t){var e;return null==t&&(t=void 0),e=null!=this.custom_address&&"/"!==this.custom_address[0]?["http://"+this.custom_address]:null!=this.custom_address?[App.Utils.baseUrl(),this.custom_address.substr(1,this.custom_address.length-1)]:[App.Utils.baseUrl(),"help"],t&&e.push(t.systemLocale().locale),App.Utils.joinUrlComponents(e)},i.prototype.privateFeedUrl=function(t,e){var n;return n=[App.Utils.baseUrl(),App.Config.get("api_path"),"knowledge_bases",this.id,t.systemLocale().locale,"feed"],App.Utils.joinUrlComponents(n)+"?token="+e},i.prototype.uiUrl=function(t,e){return null==e&&(e=void 0),App.Utils.joinUrlComponents(this.uiUrlComponent(),t.urlSuffix(),e)},i.prototype.uiUrlComponent=function(){return"#knowledge_base/"+this.id},i.prototype.categories=function(){return App.KnowledgeBaseCategory.all().filter((t=this,function(e){return e.knowledge_base_id===t.id}));var t},i.prototype.rootCategories=function(){return this.categories().filter((function(t){return null===t.parent_id})).sort((function(t,e){return t.position-e.position}))},i.prototype.kb_locales=function(){return App.KnowledgeBaseLocale.findAll(this.kb_locale_ids)},i.prototype.primaryKbLocale=function(){return this.kb_locales().filter((function(t){return t.primary}))[0]},i.prototype.knowledge_base=function(){return this},i.prototype.isEmpty=function(){return 0===this.rootCategories().length},i.translatableClass=function(){return App.KnowledgeBaseTranslation},i.translatableForeignKey=function(){return"knowledge_base_id"},i.extend(App.KnowledgeBaseTranslatable),i.prototype.remove=function(t){return null==t&&(t={}),this.rootCategories().forEach((function(e){return e.remove(t)})),this.removeTranslations(t),i.__super__.remove.apply(this,arguments)},i.prototype.objectName=function(){return __("Knowledge Base")},i.prototype.categoriesForDropdown=function(t){var e,n;return null==t&&(t={}),e=[],t.includeRoot&&e.push({value:null,name:">> Homepage <<"}),n=t.includeRoot?1:0,this.rootCategories().reduce((function(e,i){return e.concat(i.categoriesForDropdown({nested:n,kb_locale:t.kb_locale}))}),e)},i.prototype.visibleInternally=function(t){return this.active&&"none"!==this.access(t)},i.prototype.visiblePublicly=function(){return this.active},i.prototype.attributes=function(){var t;return(t=i.__super__.attributes.call(this)).kb_locales=this.kb_locales().map((function(t){return t.attributes()})),t},i.prototype.loadedAnswerIds=function(){return App.KnowledgeBaseAnswer.all().filter((t=this,function(e){return e.knowledge_base().id===t.id})).map((function(t){return t.id}));var t},i.prototype.loadedCategoryIds=function(){return App.KnowledgeBaseCategory.all().map((function(t){return t.id}))},i.prototype.removeAssetsIfNeeded=function(t){var e,n,i,s,r,o,a,l,c,u;for(c=_.difference(this.loadedAnswerIds(),t.answer_ids),u=_.difference(this.loadedAnswerIds(),t.category_ids),i=0,r=c.length;i<r;i++)e=c[i],null!=(a=App.KnowledgeBaseAnswer.find(e))&&a.remove({clear:!0});for(s=0,o=u.length;s<o;s++)n=u[s],null!=(l=App.KnowledgeBaseCategory.find(n))&&l.remove({clear:!0});return!_.isEmpty(c)||!_.isEmpty(u)},i.prototype.hasAssetsToLoad=function(t){var e,n;return e=_.difference(t.answer_ids,this.loadedAnswerIds()),n=_.difference(t.category_ids,this.loadedCategoryIds()),!_.isEmpty(e)||!_.isEmpty(n)},i.allKbModelNames=function(){return Object.keys(App).filter((function(t){var e;return t.match(/^KnowledgeBase/)&&(null!=(e=App[t])?e.prototype:void 0)instanceof App.Model}))},i.configure_attributes=[{name:"translation::title",model:"translation",display:__("Title"),tag:"input",null:!1,screen:{agent_edit:{shown:!0}}},{name:"translation::footer_note",model:"translation",display:__("Footer Note"),tag:"input",null:!1,screen:{agent_edit:{shown:!0}}},{name:"color_highlight",display:__("Icon & Link Color"),tag:"color",style:"block",null:!1,screen:{admin_style_color_highlight:{display:!1,horizontal:!0,shown:!0}}},{name:"color_header",display:__("Header Color"),tag:"color",style:"block",null:!1,screen:{admin_style_color_header:{display:!1,horizontal:!0,shown:!0}}},{name:"color_header_link",display:__("Header Link Color"),tag:"color",style:"block",null:!1,screen:{admin_style_color_header_link:{display:!1,horizontal:!0,shown:!0}}},{name:"show_feed_icon",display:__("Show Feed Icon"),tag:"boolean",style:"block",null:!1,screen:{admin_style_feed:{display:!1,horizontal:!0,shown:!0}}},{name:"iconset",display:__("Icon Set"),tag:"iconset_picker",style:"block",help:__("Every category in your knowledge base should be given a unique icon for maximum visual clarity. Each set below provides a wide range of icons to choose from, but beware: You can't mix and match different icons from different sets. Choose carefully!"),null:!1,screen:{admin_style_iconset:{shown:!0}}},{name:"kb_locales",display:__("Languages"),tag:"multi_locales",style:"block",null:!1,help:__("You can provide different versions of your knowledge base for different locales. Add a language below, then select it in the Knowledge Base Editor to add your translations."),screen:{admin_languages:{shown:!0},admin_create:{shown:!0}}},{name:"custom_address",display:__("Custom URL"),tag:"input",style:"block",null:!0,help:__('The default URL for your knowledge base is e.g. example.com or example.com/help. To serve it from a custom URL instead, enter the destination below (e.g., "/support", "example.com", or "example.com/support"). Then, follow the directions under "Web Server Configuration" to complete the process.'),screen:{admin_custom_address:{shown:!0}}}],i}(App.Model)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseAnswer=function(n){function i(){return this.visiblePublicly=t(this.visiblePublicly,this),this.visibleInternally=t(this.visibleInternally,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.configure("KnowledgeBaseAnswer","category_id","translation_ids","archived_at","internal_at","published_at","attachments"),i.extend(Spine.Model.Ajax),i.extend(App.KnowledgeBaseActions),i.extend(App.KnowledgeBaseCanBePublished),i.extend(App.KnowledgeBaseAccess),i.serverClassName="KnowledgeBase::Answer",i.prototype.url=function(){return this.knowledge_base().generateURL("answers")},i.prototype.uiUrl=function(t,e){return null==e&&(e=null),App.Utils.joinUrlComponents(this.knowledge_base().uiUrl(t),this.uiUrlComponent(),e)},i.prototype.uiUrlComponent=function(){return"answer/"+this.id},i.prototype.knowledge_base=function(){return App.KnowledgeBase.find(this.category().knowledge_base_id)},i.prototype.category=function(){return App.KnowledgeBaseCategory.find(this.category_id)},i.configure_attributes=[{name:"translation::title",model:"translation",display:__("Title"),tag:"input",grid_width:"1/2"}],i.prototype.configure_attributes=function(t){return null==t&&(t=void 0),[{name:"translation::title",model:"translation",display:__("Title"),tag:"input",grid_width:"1/2",null:!1,screen:{agent_create:{shown:!0}}},{name:"category_id",model:"answer",display:__("Category"),tag:"select",null:!1,options:this.knowledge_base().categoriesForDropdown({kb_locale:t}),grid_width:"1/2",screen:{agent_create:{tag:"input",type:"hidden",display:!1}}},{name:"translation::content::body",model:"translation",buttons:["link","link_answer","insert_image","embed_video"],display:__("Content"),tag:"richtext",null:!0}]},i.prototype.publicBaseUrl=function(t){return this.isNew()?null:App.Utils.joinUrlComponents([this.category().publicBaseUrl(t),this.id])},i.translatableClass=function(){return App.KnowledgeBaseAnswerTranslation},i.translatableForeignKey=function(){return"answer_id"},i.extend(App.KnowledgeBaseTranslatable),i.prototype.remove=function(t){return null==t&&(t={}),this.removeTranslations(t),i.__super__.remove.apply(this,arguments)},i.prototype.baseParams=function(){return{category_id:this.category_id}},i.prototype.category=function(){return App.KnowledgeBaseCategory.find(this.category_id)},i.prototype.objectName=function(){return"Answer"},i.prototype.visibleInternally=function(t){return this.is_internally_published(t)&&"none"!==this.access(t)||this.is_published(t)},i.prototype.visiblePublicly=function(t){return this.is_published(t)},i}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseAnswerTranslation=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseAnswerTranslation","title","preview","content","note","source","outdated","promoted","answer_id","locale_id","state_id"),n.extend(Spine.Model.Ajax),n.extend(App.KnowledgeBaseTranslationable),n.configure_attributes=[{name:"title",display:__("Name"),tag:"input",type:"text",limit:300,null:!1,info:!0},{name:"created_at",display:__("Created at"),tag:"datetime",readonly:1,info:!1},{name:"updated_at",display:__("Updated at"),tag:"datetime",readonly:1,info:!1}],n.prototype.url=function(){return this.parent().generateURL("translations")},n.prototype.uiUrl=function(t){return null==t&&(t=null),this.parent().uiUrl(App.KnowledgeBaseLocale.localeFor(this),t)},n.prototype.publicBaseUrl=function(){return this.parent().publicBaseUrl(App.KnowledgeBaseLocale.localeFor(this))},n.prototype.content=function(){return App.KnowledgeBaseAnswerTranslationContent.find(this.content_id)},n.prototype.displayName=function(){return this.title},n.prototype.parent=function(){return App.KnowledgeBaseAnswer.find(this.answer_id)},n.prototype.remove=function(t){var e;return null==t&&(t={}),null!=(e=this.content())&&e.remove(t),n.__super__.remove.apply(this,arguments)},n.prototype.attributes=function(){var t,e;return(t=n.__super__.attributes.apply(this,arguments)).content=null!=(e=this.content())?e.attributes():void 0,t},n.prototype.loadFull=function(t){var e;return e=this.parent().generateURL()+"?full=1&include_contents="+this.content_id,App.Ajax.request({url:e,success:function(e){return App.Collection.loadAssets(e.assets),t(!0)},error:function(e){var n;return t(!1),App.Event.trigger("notify",{type:"error",msg:(null!=(n=e.responseJSON)?n.error:void 0)||__("Loading failed.")})}})},n.processAttributes=function(t){var e;return(e=t.content)&&_.isObject(e)&&(delete t.content,t.content_attributes=e),t},n.prototype.searchResultAttributes=function(){return _.extend({},this.defaultSearchResultAttributes(),{class:"kb-answer-popover",icon:"knowledge-base"})},n.configure_overview=["title","updated_at"],n.display_name=__("Knowledge Base Answer"),n}(App.Model),App.KnowledgeBaseAnswerTranslationContent=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseAnswerTranslationContent","body"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/knowledge_base/translation/content",n.configure_attributes=[{name:"body",display:__("Body"),tag:"input"}],n.prototype.attributes=function(){var t;return(t=n.__super__.attributes.apply(this,arguments)).body={text:this.body,attachments:this.attachments},t},n.prototype.bodyTruncated=function(){var t;return(t=this.body.replace(/<([^>]+)>/g,"")).length<100?t:t.substring(0,100)+"..."},n.prototype.bodyWithPublicURLs=function(){var t,e,n,i,s,r;for(t=0,e=(r=(s=$("<div>"+this.body+"</div>")).find("a").addBack("a").toArray()).length;t<e;t++)if(n=r[t],"knowledge-base-answer"===$(n).attr("data-target-type"))(i=App.KnowledgeBaseAnswerTranslation.find($(n).attr("data-target-id")))?$(n).attr("href",i.publicBaseUrl()):$(n).attr("href","#");return s[0].innerHTML},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseAnswerTranslationState=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseAnswerTranslationState","name"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/knowledge_base/answer/translation/states",n}(App.Model)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseCategory=function(n){function i(){return this.visiblePublicly=t(this.visiblePublicly,this),this.visibleInternally=t(this.visibleInternally,this),this.findDeepAnswer=t(this.findDeepAnswer,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.configure("KnowledgeBaseCategory","category_icon","parent_id","child_ids","translation_ids"),i.extend(Spine.Model.Ajax),i.extend(App.KnowledgeBaseActions),i.extend(App.KnowledgeBaseAccess),i.prototype.url=function(){return this.knowledge_base().generateURL("categories")},i.prototype.uiUrl=function(t,e){return null==e&&(e=null),App.Utils.joinUrlComponents(this.knowledge_base().uiUrl(t),this.uiUrlComponent(),e)},i.prototype.uiUrlComponent=function(){return"category/"+this.id},i.prototype.knowledge_base=function(){return App.KnowledgeBase.find(this.knowledge_base_id)},i.prototype.isEmpty=function(){return 0===this.children().length&&0===this.answers().length},i.prototype.remove=function(t){return null==t&&(t={}),this.removeTranslations(t),this.children().forEach((function(e){return e.remove(t)})),this.answers().forEach((function(e){return e.remove(t)})),i.__super__.remove.apply(this,arguments)},i.prototype.categoriesForDropdown=function(t){var e,n;return n=Array.apply(null,{length:t.nested}).map((function(){return"- "})).join(""),e=[{value:this.id,name:n+this.guaranteedTitle(t.kb_locale.id)}],this.children().reduce((function(e,n){return e.concat(n.categoriesForDropdown({nested:t.nested+1,kb_locale:t.kb_locale}))}),e)},i.prototype.categoriesForSearch=function(t){var e,n;for(null==t&&(t={}),n=[this.guaranteedTitle(t.kb_locale.id)],e=this;e.parent();)n.push(e.parent().guaranteedTitle(t.kb_locale.id)),e=e.parent();return n=t.full||n.length<=2?n.reverse().join(" > "):(n=n.reverse())[0]+" > .. > "+n[n.length-1]},i.prototype.configure_attributes=function(t){return null==t&&(t=void 0),[{name:"category_icon",model:"category",display:__("Icon"),tag:"icon_picker",iconset:this.knowledge_base().iconset,grid_width:"1/5",null:!1,default:this.constructor.defaultIconFor(this.knowledge_base()),screen:{agent_create:{shown:!0}}},{name:"translation::title",model:"translation",display:__("Title"),tag:"input",grid_width:"4/5",null:!1,screen:{agent_create:{shown:!0}}},{name:"parent_id",model:"category",display:__("Parent"),tag:"select",null:!0,options:this.knowledge_base().categoriesForDropdown({includeRoot:!0,kb_locale:t}),grid_width:"1/2",screen:{agent_create:{tag:"input",type:"hidden",display:!1}}}]},i.prototype.publicBaseUrl=function(t){return this.isNew()?null:App.Utils.joinUrlComponents([this.knowledge_base().publicBaseUrl(t),this.id])},i.prototype.privateFeedUrl=function(t,e){var n;return n=[App.Utils.baseUrl(),App.Config.get("api_path"),"knowledge_bases",this.knowledge_base_id,"categories",this.id,t.systemLocale().locale,"feed"],App.Utils.joinUrlComponents(n)+"?token="+e},i.translatableClass=function(){return App.KnowledgeBaseCategoryTranslation},i.translatableForeignKey=function(){return"category_id"},i.extend(App.KnowledgeBaseTranslatable),i.prototype.baseParams=function(){return{parent_id:this.parent_id}},i.prototype.children=function(){return void 0===this.id?[]:App.KnowledgeBaseCategory.findAllByAttribute("parent_id",this.id).sort((function(t,e){return t.position-e.position}))},i.prototype.deepChildrenIds=function(){var t,e;return(e=(t=this.children()).map((function(t){return t.deepChildrenIds()}))).push(t.map((function(t){return t.id}))),_.flatten(e)},i.prototype.parent=function(){return App.KnowledgeBaseCategory.find(this.parent_id)},i.prototype.answers=function(){return App.KnowledgeBaseAnswer.findAllByAttribute("category_id",this.id).sort((function(t,e){return t.position-e.position}))},i.prototype.countDeepAnswers=function(){var t;return(t=this.deepChildrenIds()).push(this.id),App.KnowledgeBaseAnswer.records.filter((function(e){return _.contains(t,e.category_id)})).length},i.prototype.findDeepAnswer=function(t){var e,n;return null!=(e=_.find(App.KnowledgeBaseAnswer.records,(n=this,function(e){return e.category_id===n.id&&t(e)})))?e:_.find(App.KnowledgeBaseCategory.records,function(e){return function(n){return n.parent_id===e.id&&n.findDeepAnswer(t)}}(this))},i.prototype.visibilityState=function(t){return this.visiblePublicly(t)?"published":this.visibleInternally(t)?"internal":"draft"},i.prototype.visibleInternally=function(t){return null!=this.findDeepAnswer((function(e){return e.is_internally_published(t)}))},i.prototype.visiblePublicly=function(t){return null!=this.findDeepAnswer((function(e){return e.is_published(t)}))},i.prototype.objectName=function(){return"Category"},i.defaultIconFor=function(t){switch(null!=t?t.iconset:void 0){case"FontAwesome":return"f115";case"anticon":return"e662";case"material":return"e94d";case"ionicons":return"f139";case"Simple-Line-Icons":return"e039"}},i}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseCategoryPermission=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseCategoryPermission","access"),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseCategoryTranslation=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseCategoryTranslation","title","locale_id","category_id"),n.extend(Spine.Model.Ajax),n.extend(App.KnowledgeBaseTranslationable),n.url=n.apiPath+"/knowledge_base/category/translations",n.prototype.parent=function(){return App.KnowledgeBaseCategory.find(this.category_id)},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseLayout=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseLayout","name"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/knowledge_base/layouts",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseLocale=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseLocale","knowledge_base_id","system_locale_id","primary"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/knowledge_base/locales",n.prototype.systemLocale=function(){return App.Locale.find(this.system_locale_id)},n.prototype.urlSuffix=function(){return"locale/"+this.systemLocale().locale},n.localeFor=function(t){if(void 0===t.kb_locale_id)throw"This object doesn't have locale";return App.KnowledgeBaseLocale.find(t.kb_locale_id)},n.prototype.applyOntoPath=function(t){return t.replace(/\/locale\/([\w]{2}((-[\w]{4})?-[\w]{2})?)/,"/"+this.urlSuffix())},n.prototype.attributesForRendering=function(t,e){return null==e&&(e={}),{url:this.applyOntoPath(t),title:this.systemLocale().name}},n.detect=function(t){var e;return e=App.Locale.findByAttribute("locale",App.i18n.get(!0)),App.KnowledgeBaseLocale.all().filter((function(n){return n.knowledge_base_id===t.id&&n.system_locale_id===e.id})).pop()||t.primaryKbLocale()},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseMenuItem=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseMenuItem","kb_locale_id","position","title","url"),n.using_kb_locale=function(t){var e;return(e=this.findAllByAttribute("kb_locale_id",t.id)).sort((function(t,e){return t.position<e.position?-1:1})),e},n.using_kb_locale_location=function(t,e){var n;return(n=this.all().filter((function(n){return n.kb_locale_id===t.id&&n.location===e}))).sort((function(t,e){return t.position<e.position?-1:1})),n},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseTranslation=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("KnowledgeBaseTranslation","title","footer_note"),n.extend(Spine.Model.Ajax),n.extend(App.KnowledgeBaseTranslationable),n.url=n.apiPath+"/knowledge_base/translations",n.configure_attributes=[{name:"title",display:__("Title"),tag:"input"}],n.prototype.parent=function(){return App.KnowledgeBase.find(this.knowledge_base_id)},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.LdapSource=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("LdapSource","name","preferences","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/ldap_sources",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"active",display:__("Active"),
tag:"active",default:!0},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_delete=!0,n.configure_overview=["name"],n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Locale=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Locale","name","alias","locale"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/locales",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Macro=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Macro","name","perform","ux_flow_next_up","note","group_ids","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/macros",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",translate:!0,limit:100,null:!1},{name:"perform",display:__("Actions"),tag:"ticket_perform_action",null:!0},{name:"ux_flow_next_up",display:__("Once completed\u2026"),tag:"select",default:"none",translate:!0,options:{none:__("Stay on tab"),next_task:__("Close tab"),next_task_on_close:__("Close tab on ticket close"),next_from_overview:__("Advance to next ticket from overview")}},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"note",display:__("Note"),tag:"textarea",limit:250,null:!0},{name:"group_ids",display:__("Groups"),tag:"column_select",relation:"Group",null:!0,unsortable:!0,display_full_name:!0},{name:"active",display:__("Active"),tag:"active",default:!0}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["name","note","group_ids"],n.getList=function(){return App.Macro.search({filter:{active:!0},sortBy:"name",order:"ASC"})},n.description=__("Macros make it easy to automate common, multi-step tasks within Zammad.\n\nYou can use macros in Zammad to automate recurring sequences, saving time (and nerves). This allows a combined sequence of actions on the ticket to be executed with just one click."),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Mention=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Mention","mentionable_id","mentionable_type"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/mentions",n.configure_attributes=[{name:"user_id",display:__("User"),tag:"select",multiple:!1,limit:100,null:!0,relation:"User",width:"12%",edit:!0}],n.searchUser=function(t,e,n){var i,s;return s=App.Role.withPermissions("ticket.agent").map((function(t){return t.id})),(i={})[e]="read",App.Ajax.request({id:"mention_search_user",type:"GET",url:this.apiPath+"/users/search",data:{limit:10,query:t,role_ids:s,group_ids:i,full:!0},processData:!0,success:function(t){return t.assets&&App.Collection.loadAssets(t.assets,{targetModel:this.className}),n(t)}})},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ObjectManagerAttribute=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("ObjectManagerAttribute","name","object","display","active","editable","data_type","data_option","screens","position"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/object_manager_attributes",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"display",display:__("Display"),tag:"input",type:"text",limit:100,null:!1},{name:"object",display:__("Object"),tag:"input",readonly:1},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"data_type",display:__("Format"),tag:"object_manager_attribute",null:!1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"position",display:__("Position"),tag:"integer",type:"number",limit:100,null:!0}],n.selectorAttributesByObject=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f;for(d={},e=0,s=(u=this.all()).length;e<s;e++)(f=u[e]).object&&((t=$.extend(!0,{},f)).tag=t.data_type,t.data_option&&(t=Object.assign({},t,t.data_option)),d[a=t.object]||(d[a]=[]),d[t.object].push(t));for(n=0,r=(p=Object.keys(d)).length;n<r;n++)if(c=p[n],App[c]&&App[c].configure_attributes)for(l=_.map(d[c],(function(t){return t.name})),i=0,o=(h=App[c].configure_attributes).length;i<o;i++)f=h[i],_.contains(l,f.name)||d[c].push(_.clone(f));return d},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.OnlineNotification=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("OnlineNotification","name","seen"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/online_notifications",n.play=function(t){var e;if(t)(e=new Audio("assets/sounds/"+t)).play();else if(App.Session.get("preferences")&&App.OnlineNotification.soundEnabled()&&(!(e=App.Config.get("latest_online_notification_sond"))||e.ended))return t=App.OnlineNotification.soundFile(),e=new Audio("assets/sounds/"+t),App.Config.set("latest_online_notification_sond",e),e.play()},n.soundEnabled=function(){var t;return!!(t=App.Session.get("preferences"))&&(t.notification_sound||(t.notification_sound={}),void 0===t.notification_sound.enabled&&(t.notification_sound.enabled=!0),"false"!==t.notification_sound.enabled.toString())},n.soundFile=function(){var t,e;return t="Xylo.mp3",(e=App.Session.get("preferences"))&&e.notification_sound&&e.notification_sound.file?e.notification_sound.file:t},n.seen=function(t,e){var n,i,s,r,o;for(o=[],n=0,i=(r=App.OnlineNotification.all()).length;n<i;n++)(s=r[n]).object===t&&s.o_id.toString()===e.toString()&&!0!==s.seen?(s.seen=!0,o.push(s.save())):o.push(void 0);return o},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Organization=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Organization","name","shared","vip","note","active","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/organizations",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1,info:!0},{name:"shared",display:__("Shared organization"),tag:"boolean",note:__("Customers in the organization can view each other's items."),type:"boolean",default:!0,null:!1,info:!1},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1,info:!1},{name:"created_at",display:__("Created at"),tag:"datetime",readonly:1,info:!1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1,info:!1},{name:"updated_at",display:__("Updated at"),tag:"datetime",readonly:1,info:!1}],n.configure_clone=!0,n.configure_overview=["name","shared"],n.configure_preview=["name","shared","created_at"],n.description=__('Using **organizations** you can **group** customers. This has two main benefits:\n\n1. As an **agent** you don\'t just have an overview of the open tickets for one person but an **overview over their whole organization**.\n2. As a **customer** you can also check the **tickets which your colleagues created** and modify their tickets (if your organization is set to "shared", which can be defined per organization).'),n.prototype.uiUrl=function(){return"#organization/profile/"+this.id},n.prototype.icon=function(){return"organization"},n.prototype.members=function(t,e,n){var i,s,r;return i=this.member_ids.slice(t,e),s=_.filter(i,(function(t){return!App.User.findNative(t)})),r=function(){var t,e,n,s,r;for(r=[],t=0,e=i.length;t<e;t++)s=i[t],(n=App.User.fullLocal(s))&&r.push(n);return r},s.length<1?n(r()):App.Ajax.request({type:"POST",url:this.constructor.apiPath+"/users/search",data:JSON.stringify({query:"*",ids:s,limit:e,full:!0}),processData:!0,success:function(t){return App.Collection.loadAssets(t.assets),n(r())},error:function(){return n([])}})},n.prototype.searchResultAttributes=function(){var t,e;return t=["organization","organization-popover"],e="organization",!1===this.active&&(t.push("is-inactive"),e="inactive-"+e),{display:""+this.displayName(),id:this.id,class:t.join(" "),url:this.uiUrl(),icon:e}},n.prototype.activityMessage=function(t){if(t&&t.created_by)return"create"===t.type?App.i18n.translateContent("%s created organization |%s|",t.created_by.displayName(),t.title):"update"===t.type?App.i18n.translateContent("%s updated organization |%s|",t.created_by.displayName(),t.title):"Unknow action for ("+this.objectDisplayName()+"/"+t.type+"), extend activityMessage() of model."},n.prototype.isAccessibleBy=function(t){return!!t.permission("admin")||!!t.permission("ticket.agent")},n.prototype.avatar=function(t,e,n){var i;return null==t&&(t=40),null==e&&(e=""),null==n&&(n=!1),e&&(e+=" "),e+="size-"+(t=parseInt(t,10)),n&&(e+=" organization-popover"),i=' data-id="'+this.id+'"',App.view("avatar_organization")({active:this.active,cssClass:e,data:i,vip:this.vip})},n}(App.Model)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Overview=function(n){function i(){return this.prevTicket=t(this.prevTicket,this),this.nextTicket=t(this.nextTicket,this),this.indexOf=t(this.indexOf,this),this.tickets=t(this.tickets,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.configure("Overview","name","prio","condition","order","group_by","group_direction","view","user_ids","organization_shared","out_of_office","role_ids","active"),i.extend(Spine.Model.Ajax),i.url=i.apiPath+"/overviews",i.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",translate:!0,limit:100,null:!1},{name:"link",display:__("Link"),readonly:1},{name:"role_ids",display:__("Available for the following roles"),tag:"column_select",multiple:!0,null:!1,relation:"Role",translate:!0},{name:"user_ids",display:__("Restrict to only the following users"),tag:"column_select",multiple:!0,null:!0,relation:"User",sortBy:"firstname"},{name:"organization_shared",display:__("Only available for users with shared organizations"),tag:"select",options:{true:"yes",false:"no"},translate:!0,default:!1,null:!0},{name:"out_of_office",display:__("Only available for users which are absence replacements for other users."),tag:"select",options:{true:"yes",false:"no"},translate:!0,default:!1,null:!0},{name:"condition",display:__("Conditions for shown tickets"),tag:"ticket_selector",null:!1,out_of_office:!0},{name:"prio",display:__("Prio"),readonly:1},{name:"view::s",display:__("Attributes"),tag:"checkboxTicketAttributes",default:["number","title","state","created_at"],null:!1,translate:!0},{name:"order::by",display:__("Sorting by"),tag:"selectTicketAttributes",default:"created_at",null:!1,translate:!0},{name:"order::direction",display:__("Sorting order"),tag:"select",default:"DESC",null:!1,translate:!0,options:{ASC:__("ascending"),DESC:__("descending")}},{name:"group_by",display:__("Grouping by"),tag:"select",default:"",null:!0,nulloption:!0,translate:!0,options:{customer:"Customer",state:"State",priority:"Priority",group:"Group",owner:"Owner"}},{name:"group_direction",display:__("Grouping order"),tag:"select",default:"DESC",null:!1,translate:!0,options:{ASC:__("ascending"),DESC:__("descending")}},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],i.configure_delete=!0,i.configure_clone=!0,i.configure_overview=["name","link","role_ids"],i.description=__("You can create **overviews** for your agents and your customers. These have many purposes, such as serving as a to-do list for your agents.\n\nYou can also create overviews and limit them to specific agents or to groups of agents."),i.prototype.uiUrl=function(){return"#ticket/view/"+this.link},i.prototype.tickets=function(){return App.OverviewListCollection.get(this.link).tickets},i.prototype.indexOf=function(t){return isNaN(t)||(t=App.Ticket.find(t)),_.findIndex(this.tickets(),(function(e){return e.id===t.id}))},i.prototype.nextTicket=function(t){var e;return(e=this.indexOf(t))>=0?this.tickets()[e+1]:void 0},i.prototype.prevTicket=function(t){return this.tickets()[this.indexOf(t)-1]},i.groupByAttributes=function(){var t,e,n,i;for(n in e={},i=App.Ticket.attributesGet())t=i[n],n.match(/(_at|_no)$/)||"datetime"===t.tag||"number"===n||"tags"===n||(e[n=n.replace(/_(id|ids)$/,"")]=t.display);return e},i}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Permission=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Permission","name","note","active","preferences"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/permissions",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.PostmasterFilter=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("PostmasterFilter","name","channel","match","perform","note","active","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/postmaster_filters",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:250,null:!1},{name:"channel",display:__("Channel"),type:"input",readonly:1},{name:"match",display:__("Match all of the following"),tag:"postmaster_match"},{name:"perform",display:__("Perform actions"),tag:"postmaster_set",user_action:!1},{name:"note",display:__("Note"),tag:"textarea",limit:250,null:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_delete=!0,n.configure_overview=["name"],n.configure_clone=!0,n.on("create",(function(t){return t.channel="email"})),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.PreDefinedWebhook=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("PreDefinedWebhook","name","custom_payload","fields"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/webhooks/pre_defined",n.configure_translate=!0,n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.PublicLink=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("PublicLink","link","title","description","screen","new_tab","prio"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/public_links",n.configure_attributes=[{name:"link",display:__("Link"),tag:"input",type:"text",limit:500,null:!1,placeholder:"https://link"},{name:"title",display:__("Title"),tag:"input",type:"text",limit:200,null:!1},{name:"description",display:__("Description (shown as title tag for screen readers)"),tag:"input",type:"text",limit:200,null:!0},{name:"screen",display:__("Context"),tag:"multiselect",options:{login:__("Login Screen"),signup:__("Signup Screen"),password_reset:__("Forgot Password Screen")},default:["login"],null:!1,multiple:!0,translate:!0},{name:"new_tab",display:__("Open in new tab"),tag:"select",options:{true:__("yes"),false:__("no")},default:!0,null:!1,translate:!0},{name:"prio",display:__("Prio"),readonly:1}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["title","link","new_tab"],n.description=__("You can define links which are shown e.g. in the footer of Zammad's login screen. These have many purposes, such as displaying a data privacy page for all people using your Zammad instance."),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.RecentView=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("RecentView","name"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/recent_view",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ReportProfile=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("ReportProfile","name","condition","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/report_profiles",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"condition",display:__("Filter"),tag:"ticket_selector",null:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"active",display:__("Active"),tag:"active",default:!0}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["name"],n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Role=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Role","name","permission_ids","group_ids","default_at_signup","note","active","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/roles",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"permission_ids",display:__("Permissions"),tag:"permission",item_class:"checkbox",null:!0},{name:"group_ids",display:__("Group permissions"),tag:"group_permissions",item_class:"checkbox",null:!0},{name:"default_at_signup",display:__("Default at Signup"),tag:"boolean",default:!1,translate:!0},{name:"note",display:__("Note"),tag:"textarea",note:__("Notes are visible to agents only, never to customers."),limit:250,null:!0},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_clone=!0,n.configure_overview=["name","default_at_signup"],n.prototype.activityMessage=function(t){if(t&&t.created_by)return"create"===t.type?App.i18n.translateContent("%s created role |%s|",t.created_by.displayName(),t.title):"update"===t.type?App.i18n.translateContent("%s updated role |%s|",t.created_by.displayName(),t.title):"Unknow action for ("+this.objectDisplayName()+"/"+t.type+"), extend activityMessage() of model."},n._fillUp=function(t){var e,n,i,s,r;if(t.permission_ids)for(t.permissions=[],e=0,n=(r=t.permission_ids).length;e<n;e++)s=r[e],App.Permission.exists(s)&&(i=App.Permission.findNative(s),t.permissions.push(i));return t},n.withPermissions=function(t){return _.isArray(t)||(t=[t]),App.Role.all().filter((function(e){return _.any(t,(function(t){return e.hasPermission(t)}))}))},n.prototype.hasPermission=function(t){var e,n;return e=null!=(n=App.Permission.findByAttribute("name",t))?n.id:void 0,_.contains(this.permission_ids,e)},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Setting=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Setting","name","state_current"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/settings",n.get=function(t){var e;if(!(e=App.Setting.findByAttribute("name",t)))throw"No such setting '"+t+"' found!";return e.state_current.value},n.set=function(t,e,n){var i;if(null==n&&(n={}),!(i=App.Setting.findByAttribute("name",t)))throw"No such setting '"+t+"' found!";return i.state_current.value=e,n.done||(n.done=function(){if(n.notify&&App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent("Update successful."),timeout:2e3}),App.Setting.preferencesPost(this),n.doneLocal)return n.doneLocal(this)}),n.fail||(n.fail=function(t,e){if(App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent((null!=e?e.error_human:void 0)||(null!=e?e.error:void 0)||__("The setting could not be updated.")),timeout:3e3}),n.failLocal)return n.failLocal(this)}),i.frontend&&App.Config.set(t,e),i.save(n)},n.reset=function(t,e,n){var i;if(null==n&&(n={}),!(i=App.Setting.findByAttribute("name",t)))throw"No such setting '"+t+"' found!";return App.Ajax.request({type:"POST",url:this.url+"/reset/"+i.id,processData:!0,success:function(e){if(i.frontend&&App.Config.set(t,i.state_initial.value),e.assets?App.Collection.loadAssets(e.assets,{targetModel:this.className}):i.refresh(e),n.notify)return App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent("Reset successful."),timeout:2e3})},error:function(t,e,n){var i,s;return i=(null!=(s=t.responseJSON)?s.error:void 0)||e||n,App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent(i||__("The setting could not be reset.")),timeout:3e3})}})},n.preferencesPost=function(t){var e,n,i,s,r,o,a;if(t.preferences&&(t.preferences.render&&((e=t.preferences).trigger||(e.trigger=[]),t.preferences.trigger.push("ui:rerender")),!_.isEmpty(t.preferences.trigger))){for(s=t.preferences.trigger,_.isArray(t.preferences.trigger)||(s=[t.preferences.trigger]),n=0,a=[],r=0,o=s.length;r<o;r++)i=s[r],n+=1,a.push(function(t,e){var n;return n=function(){return App.Event.trigger(t)},App.Delay.set(n,300*e)}(i,n));return a}},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Signature=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Signature","name","body","note","active","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/signatures",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"body",display:__("Text"),tag:"richtext",limit:500,null:!0,plugins:[{controller:"WidgetPlaceholder",params:{objects:[{prefix:"ticket",object:"Ticket",display:__("Ticket")},{prefix:"user",object:"User",display:__("Current User")}]}}]},{name:"note",display:__("Note"),tag:"textarea",note:__("Notes are visible to agents only, never to customers."),limit:250,null:!0},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_overview=["name"],n.configure_clone=!0,n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Sla=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Sla","name","first_response_time","response_time","update_time","solution_time","condition","calendar_id"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/slas",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"condition",display:__("Ticket Selector"),tag:"ticket_selector",null:!1,note:__("Create rules that single out the tickets for the Service Level Agreement."),noCurrentUser:!0},{name:"calendar_id",display:__("Calendar"),tag:"select",relation:"Calendar",null:!1},{name:"sla_times",display:__("SLA Times"),tag:"sla_times",null:!0},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"first_response_time",skipRendering:!0},{name:"response_time",skipRendering:!0},{name:"update_time",skipRendering:!0},{name:"solution_time",skipRendering:!0}],n.configure_delete=!0,n.configure_overview=["name"],n.description=__("**Service Level Agreements**, abbreviated **SLAs**, help you to meet specific response times for your customers' requests. This way you can define goals such as answering every inquiry within eight hours. If you are at risk of missing this target, Zammad will alert you.\n\nYou can define targets for three different metrics: **response time** (time between the creation of a ticket and the first reaction of an agent), **update time** (time between a customer's request and an agent's reaction), and **solution time** (time between creating and closing a ticket).\n\nAny escalated tickets (i.e. tickets that have missed the defined target) are displayed in a separate view in your overviews. You can also configure **email notifications**."),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.SSLCertificate=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("SSLCertificate","name","active","certificate","note"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/ssl_certificates",n.configure_attributes=[],n.configure_overview=["subject"],n.configure_delete=!0,n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.StatsStore=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("StatsStore","name","state"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/stats_store",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Taskbar=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Taskbar","key","callback","state","params","prio","notify","active","attachments","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/taskbar",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Template=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Template","name","options","user_id","updated_at","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/templates",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"options",display:__("Actions"),tag:"ticket_perform_action",user_action:!1,article_body_cc_only:!0,no_richtext_uploads:!0,sender_type:!0,skip_unknown_attributes:!0,null:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"active",display:__("Active"),tag:"active",default:!0}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["name"],n.getList=function(){return App.Template.search({filter:{active:!0},sortBy:"name",order:"ASC"})},n.description=__("With templates it is possible to fill pre-filled tickets quickly and easily."),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TextModule=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TextModule","name","keywords","content","active","group_ids","user_id","updated_at","note"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/text_modules",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"keywords",display:__("Keywords"),tag:"input",type:"text",limit:100,null:!0},{name:"content",display:__("Content"),tag:"richtext",limit:2e3,null:!1,plugins:[{controller:"WidgetPlaceholder",params:{objects:[{prefix:"ticket",object:"Ticket",display:__("Ticket")},{prefix:"user",object:"User",display:__("Current User")}]}}],note:__('To select placeholders from a list, just enter "::".')},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"note",display:__("Note"),tag:"textarea",limit:250,null:!0},{name:"group_ids",display:__("Groups"),tag:"column_select",relation:"Group",null:!0,unsortable:!0,display_full_name:!0},{name:"active",display:__("Active"),tag:"active",default:!0}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["name","keywords","content","group_ids"],n.description=__('Create Text Modules to **spend less time writing responses**. Text Modules can include smart variables like the user\'s name or email address.\n\nExamples of snippets are:\n\n* Hello Mrs. #{ticket.customer.lastname},\n* Hello Mr. #{ticket.customer.lastname},\n* Hello #{ticket.customer.firstname},\n* My name is #{user.firstname},\n\nOf course, you can also use multi-line snippets.\n\nAvailable objects are:\n* ticket (e.g. ticket.state, ticket.group)\n* ticket.customer (e.g. ticket.customer.firstname, ticket.customer.lastname)\n* ticket.owner (e.g. ticket.owner.firstname, ticket.owner.lastname)\n* ticket.organization (e.g. ticket.organization.name)\n* user (e.g. user.firstname, user.email)\n\nTo select placeholders from a list, just enter "::".'),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Ticket=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Ticket","number","title","group_id","owner_id","customer_id","state_id","priority_id","article","tags","links","updated_at","preferences"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/tickets",n.configure_attributes=[{name:"number",display:"#",tag:"input",type:"text",limit:100,null:!0,readonly:1,width:"68px"},{name:"title",display:__("Title"),tag:"input",type:"text",limit:100,null:!1},{name:"customer_id",display:__("Customer"),tag:"input",type:"text",limit:100,null:!1,autocapitalize:!1,relation:"User"},{name:"organization_id",display:__("Organization"),tag:"select",
relation:"Organization"},{name:"group_id",display:__("Group"),tag:"tree_select",multiple:!1,limit:100,null:!1,relation:"Group",width:"10%",edit:!0},{name:"owner_id",display:__("Owner"),tag:"select",multiple:!1,limit:100,null:!0,relation:"User",width:"12%",edit:!0},{name:"state_id",display:__("State"),tag:"select",multiple:!1,null:!1,relation:"TicketState",default:"new",width:"12%",edit:!0,customer:!0},{name:"pending_time",display:__("Pending till"),tag:"datetime",null:!0,width:"130px"},{name:"priority_id",display:__("Priority"),tag:"select",multiple:!1,null:!1,relation:"TicketPriority",width:"54px",edit:!0,customer:!0},{name:"article_count",display:__("Article#"),readonly:1,width:"12%"},{name:"time_unit",display:__("Accounted Time"),readonly:1,width:"12%",tag:"float"},{name:"escalation_at",display:__("Escalation at"),tag:"datetime",null:!0,readonly:1,width:"110px",class:"escalation"},{name:"first_response_escalation_at",display:__("Escalation at (First Response Time)"),tag:"datetime",null:!0,readonly:1,width:"110px",class:"escalation"},{name:"update_escalation_at",display:__("Escalation at (Update Time)"),tag:"datetime",null:!0,readonly:1,width:"110px",class:"escalation"},{name:"close_escalation_at",display:__("Escalation at (Close Time)"),tag:"datetime",null:!0,readonly:1,width:"110px",class:"escalation"},{name:"last_contact_at",display:__("Last contact"),tag:"datetime",null:!0,readonly:1,width:"110px"},{name:"last_contact_agent_at",display:__("Last contact (agent)"),tag:"datetime",null:!0,readonly:1,width:"110px"},{name:"last_contact_customer_at",display:__("Last contact (customer)"),tag:"datetime",null:!0,readonly:1,width:"110px"},{name:"first_response_at",display:__("First response"),tag:"datetime",null:!0,readonly:1,width:"110px"},{name:"close_at",display:__("Closing time"),tag:"datetime",null:!0,readonly:1,width:"110px"},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created at"),tag:"datetime",width:"110px",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated at"),tag:"datetime",width:"110px",readonly:1}],n.prototype.uiUrl=function(){return"#ticket/zoom/"+this.id},n.prototype.priorityIcon=function(){var t;return(t=App.TicketPriority.findNative(this.priority_id))&&t.ui_icon&&t.ui_color?App.Utils.icon(t.ui_icon,"u-"+t.ui_color+"-color"):""},n.prototype.priorityClass=function(){var t;return(t=App.TicketPriority.findNative(this.priority_id))&&t.ui_color?"item--"+t.ui_color:""},n.prototype.rowClass=function(){return this.priorityClass()},n.prototype.getState=function(){var t,e,n;return n=App.TicketState.findNative(this.state_id),t="closed","new"===(e=App.TicketStateType.findNative(n.state_type_id)).name||"open"===e.name?(t="open",this.escalation_at&&new Date(Date.parse(this.escalation_at))<new Date&&(t="escalating")):"pending reminder"===e.name?(t="pending",this.pending_time&&new Date(Date.parse(this.pending_time))<new Date&&(t="open")):"pending action"===e.name&&(t="pending"),t},n.prototype.icon=function(){return"task-state"},n.prototype.iconClass=function(){return this.getState()},n.prototype.iconTitle=function(){var t;return t=App.TicketState.findNative(this.state_id),"pending reminder"===App.TicketStateType.findNative(t.state_type_id).name&&this.pending_time&&new Date(Date.parse(this.pending_time))<new Date?App.i18n.translateInline(t.displayName())+" - "+App.i18n.translateInline("reached"):this.escalation_at&&new Date(Date.parse(this.escalation_at))<new Date?App.i18n.translateInline(t.displayName())+" - "+App.i18n.translateInline("escalated"):App.i18n.translateInline(t.displayName())},n.prototype.iconTextClass=function(){return"task-state-"+this.getState()+"-color"},n.prototype.iconActivity=function(t){if(t)return this.owner_id===t.id?"important":""},n.prototype.searchResultAttributes=function(){return{display:"#"+this.number+" - "+this.title,id:this.id,class:"task-state-"+this.getState()+" ticket-popover",url:this.uiUrl(),icon:"task-state",iconClass:this.getState()}},n.prototype.activityMessage=function(t){if(t&&t.created_by)switch(t.type){case"create":return App.i18n.translateContent("%s created ticket |%s|",t.created_by.displayName(),t.title);case"update":return App.i18n.translateContent("%s updated ticket |%s|",t.created_by.displayName(),t.title);case"reminder_reached":return App.i18n.translateContent("Pending reminder reached for ticket |%s|",t.title);case"escalation":return App.i18n.translateContent("Ticket |%s| has escalated!",t.title);case"escalation_warning":return App.i18n.translateContent("Ticket |%s| will escalate soon!",t.title);case"update.merged_into":return App.i18n.translateContent("Ticket |%s| was merged into another ticket",t.title);case"update.received_merge":return App.i18n.translateContent("Another ticket was merged into ticket |%s|",t.title);default:return"Unknow action for ("+this.objectDisplayName()+"/"+t.type+"), extend activityMessage() of model."}},n.macro=function(t){var e,n,i,s,r,o,a,l,c,u,p;for(r in a=[],o=t.macro)s=o[r],"ticket"===(i=r.split("."))[0]?"tags"===i[1]?(u=s.value.split(/\s*,\s*/),a.push(function(){var e,n,i;for(i=[],e=0,n=u.length;e<n;e++)c=u[e],"remove"===s.operator?t.callback&&t.callback.tagRemove?i.push(t.callback.tagRemove(c)):i.push(this.tagRemove(t.ticket.id,c)):t.callback&&t.callback.tagAdd?i.push(t.callback.tagAdd(c)):i.push(this.tagAdd(t.ticket.id,c));return i}.call(this))):"pending_time"===i[1]&&"relative"===s.operator?a.push(t.ticket[i[1]]=App.ViewHelpers.relative_time(s.value,s.range)):("owner_id"===i[1]||"customer_id"===i[1])&&"current_user.id"===s.pre_condition?a.push(t.ticket[i[1]]=App.Session.get("id")):a.push(t.ticket[i[1]]=s.value):"article"===i[0]?(s.type_id||(p=App.TicketArticleType.findByAttribute("name",i[1]))&&(t.article.type_id=p.id),s.sender_id||(l=App.TicketArticleSender.findByAttribute("name","Agent"))&&(s.sender_id=l.id),s.from||(s.from=App.Session.get("login")),s.content_type||(t.article.content_type="text/html"),a.push(function(){var i;for(n in i=[],s)e=s[n],i.push(t.article[n]=e);return i}())):a.push(void 0);return a},n.prototype.editable=function(t){var e;return null==t&&(t="change"),null!=(e=App.User.current())&&(!!this.editableByCustomer(e)||this.userGroupAccess(t))},n.prototype.editableByCustomer=function(t){return"customer"===this.currentView()&&(!!this.userIsCustomer()||t.allOrganizationIds().includes(this.organization_id))},n.prototype.userGroupAccess=function(t){var e;return e=App.User.current(),this.isAccessibleByGroup(e,t)},n.prototype.userIsCustomer=function(){return App.User.current().id===this.customer_id},n.prototype.userIsOwner=function(){var t;return t=App.User.current(),this.isAccessibleByOwner(t)},n.prototype.currentView=function(){var t,e;return(null!=(t=App.User.current())?t.permission("ticket.agent"):void 0)&&this.userGroupAccess("read")?"agent":(null!=(e=App.User.current())?e.permission("ticket.customer"):void 0)?"customer":void 0},n.prototype.isAccessibleByOwner=function(t){return!!t&&t.id===this.owner_id},n.prototype.isAccessibleByGroup=function(t,e){var n,i,s;if(!t)return!1;if(n=t.allGroupIds(e),!this.group_id)return!1;for(i=0,s=n.length;i<s;i++)if(n[i].toString()===this.group_id.toString())return!0;return!1},n.prototype.isAccessibleBy=function(t,e){return!!t&&(!!t.permission("ticket.agent")&&(!!this.isAccessibleByOwner(t)||this.isAccessibleByGroup(t,e)))},n.prototype.attributes=function(){var t;return t=n.__super__.attributes.apply(this,arguments),this.shared_draft_id&&(t.shared_draft_id=this.shared_draft_id),t},n.prototype.displayName=function(){return this.title||"-"},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketArticle=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketArticle","from","to","cc","subject","body","content_type","ticket_id","type_id","sender_id","internal","in_reply_to","form_id","subtype","time_unit","accounted_time_type_id","preferences","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/ticket_articles",n.configure_attributes=[{name:"ticket_id",display:__("TicketID"),null:!1,readonly:1,searchable:!1},{name:"from",display:__("From"),tag:"input",type:"text",limit:100,null:!1},{name:"to",display:__("To"),tag:"input",type:"text",limit:100,null:!0},{name:"cc",display:__("CC"),tag:"input",type:"text",limit:100,null:!0},{name:"subject",display:__("Subject"),tag:"input",type:"text",limit:100,null:!0},{name:"body",display:__("Text"),tag:"textarea",rows:5,limit:100,null:!1,searchable:!0},{name:"type_id",display:__("Type"),tag:"select",multiple:!1,null:!1,relation:"TicketArticleType",default:""},{name:"sender_id",display:__("Sender"),tag:"select",multiple:!1,null:!1,relation:"TicketArticleSender",default:""},{name:"internal",display:__("Visibility"),tag:"radio",default:!1,null:!0,options:{true:"internal",false:"public"}},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1,searchable:!1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1,searchable:!1},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1,searchable:!1},{name:"origin_by_id",display:__("Origin By"),relation:"User",readonly:1}],n.prototype.uiUrl=function(){return"#ticket/zoom/"+this.ticket_id+"/"+this.id},n.prototype.objectDisplayName=function(){return"Article"},n.prototype.displayName=function(){var t;return this.subject?this.subject:(App.Ticket.exists(this.ticket_id)&&(t=App.Ticket.findNative(this.ticket_id)),t?t.title:"-")},n.prototype.iconActivity=function(t){if(t)return App.Ticket.findNative(this.ticket_id).owner_id===t.id?"important":""},n.prototype.activityMessage=function(t){if(t&&t.created_by)return"create"===t.type?App.i18n.translateContent("%s created article for |%s|",t.created_by.displayName(),t.title):"update"===t.type?App.i18n.translateContent("%s updated article for |%s|",t.created_by.displayName(),t.title):"Unknow action for ("+this.objectDisplayName()+"/"+t.type+"), extend activityMessage() of model."},n.contentAttachments=function(t){var e,n,i,s,r;if(!t)return[];if(!t.attachments)return[];for(n=[],i=0,s=(r=t.attachments).length;i<s;i++)(e=r[i])&&(!e.preferences||e.preferences&&!0!==e.preferences["original-format"])&&n.push(e);return n},n.prototype.attributes=function(){var t;return t=n.__super__.attributes.apply(this,arguments),this.shared_draft_id&&(t.shared_draft_id=this.shared_draft_id),t},n.prototype.recipientName=function(){var t,e,n,i,s,r;if(e=App.Config.get("ticket_define_email_from"),r=App.User.find(this.origin_by_id||this.created_by_id),s=App.Ticket.find(this.ticket_id),n=App.Group.find(s.group_id),t=App.EmailAddress.find(n.email_address_id))return i=App.Config.get("ticket_define_email_from_separator"),1!==r.id&&"SystemAddressName"!==e||!r.permission("ticket.agent")?"AgentNameSystemAddressName"===e&&r.permission("ticket.agent")?r.firstname+" "+r.lastname+" "+i+" "+t.name:r.firstname+" "+r.lastname:t.name},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketArticleSender=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketArticleSender","name","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/ticket_article_senders",n.configure_translate=!0,n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketArticleType=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketArticleType","name","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/ticket_article_types",n.configure_translate=!0,n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketPriority=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketPriority","name","note","active","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/ticket_priorities",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1,translate:!0},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1}],n.configure_translate=!0,n.configure_overview=["name"],n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketSharedDraftStart=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketSharedDraftStart","name","group_id"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/tickets/shared_drafts",n.needsLoading=!0,n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketSharedDraftZoom=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketSharedDraftZoom","ticket_id","new_article","ticket_attributes"),n.needsLoading=!1,n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketState=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketState","name","note","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/ticket_states",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1,translate:!0},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1},{name:"created_at",display:__("Created"),tag:"datetime",readonly:1}],n.configure_translate=!0,n.configure_overview=["name"],n.byCategory=function(t){var e,n,i,s,r,o;switch(t){case"open":o=["new","open","pending reminder","pending action"];break;case"pending_reminder":o=["pending reminder"];break;case"pending_action":o=["pending action"];break;case"pending":o=["pending reminder","pending action"];break;case"work_on":o=["new","open"];break;case"work_on_all":o=["new","open","pending reminder"];break;case"viewable":o=["new","open","pending reminder","pending action","closed","removed"];break;case"viewable_agent_new":o=["new","open","pending reminder","pending action","closed"];break;case"viewable_agent_edit":o=["open","pending reminder","pending action","closed"];break;case"viewable_customer_new":o=["new","closed"];break;case"viewable_customer_edit":o=["open","closed"];break;case"closed":o=["closed"];break;case"merged":o=["merged"];break;default:o=[]}for(s=[],e=0,n=(i=App.TicketState.all()).length;e<n;e++)r=i[e],_.contains(o,App.TicketStateType.find(r.state_type_id).name)&&s.push(r);return s},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketStateType=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketStateType","name","note","active","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/ticket_state_types",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TicketTimeAccountingType=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("TicketTimeAccountingType","name","note","active","updated_by","created_by"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/time_accounting/types",n.configure_translate=!0,n.configure_clone=!0,n.configure_set_as_default=!0,n.configure_unset_default=!0,n.configure_attributes=[{name:"name",display:__("Name"),tag:"input"},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"note",display:__("Note"),tag:"textarea",limit:250,null:!0}],n.configure_overview=["name"],n.description=__('**Activity Types** can be used to group the different ticket time accounting entries together. For example, entries that are relevant to a "Billing" type.\n\nWhen you enable the recording of the activity type, the users will be able to select a type from this list. Additionally, a column with an associated activity type will be rendered for an entry in the **Activity** table under the **Accounted Time** tab.'),n.is_default=function(t){return App.Setting.get("time_accounting_type_default")===t.id},n.set_as_default=function(t){return App.Setting.set("time_accounting_type_default",t.id,{notify:!0})},n.unset_default=function(t){if(App.Setting.get("time_accounting_type_default")===t.id)return App.Setting.set("time_accounting_type_default","",{notify:!0})},n.configure_set_as_default_marker_attribute="name",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Translation=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Translation","source","target","target_initial","locale"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/translations",n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Trigger=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Trigger","name","activator","execution_condition_mode","condition","perform","active","note"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/triggers",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1},{name:"activator",display:__("Activated by"),tag:"select",type:"text",limit:50,null:!0,options:{action:__("Action"),time:__("Time event")},note:__("Triggers activated by actions are executed whenever a ticket is created or updated, while triggers activated by time events are executed when certain times are reached (e.g. pending time, escalation)."),translate:!0},{name:"execution_condition_mode",display:__("Action execution"),tag:"radio",type:"text",limit:50,null:!0,options:[{value:"selective",name:__("Selective (default)"),note:__("When at least one field from conditions was updated or article was added and conditions match")},{value:"always",name:__("Always"),note:__("When conditions match")}]},{name:"condition",display:__("Conditions for affected objects"),tag:"ticket_selector",null:!1,preview:!1,action:!0,hasChanged:!0,executionTime:!0,hasReached:!0,hasRegexOperators:!0},{name:"perform",display:__("Execute changes on objects"),tag:"ticket_perform_action",null:!0,notification:!0,trigger:!0},{name:"note",display:__("Note"),tag:"textarea",limit:250,null:!0},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["name"],n.description=__("Every time a customer creates a new ticket, they automatically receive a confirmation email to assure them that their issue has been submitted successfully. This behavior is built into Zammad, but it\u2019s also highly customizable, and you can set up other automated actions just like it.\n\nMaybe you want to set a higher priority on any ticket with the word \u201curgent\u201d in the title. Maybe you want to avoid sending auto-reply emails to customers from certain organizations. Maybe you want mark a ticket as \u201cpending\u201d whenever someone adds an internal note to a ticket.\n\nWhatever it is, you can do it with triggers: actions that watch tickets for certain changes, and then fire off whenever those changes occur."),n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Twitter=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Twitter","name","channels"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/twitter",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:100,null:!1}],n.configure_delete=!0,n.configure_overview=["name"],n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.User=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("User","login","firstname","lastname","email","web","password","phone","fax","mobile","street","zip","city","country","organization_id","department","note","role_ids","group_ids","active","invite","signup","updated_at"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/users",n.configure_attributes=[{name:"login",display:__("Login"),tag:"input",type:"text",limit:100,null:!1,autocapitalize:!1,signup:!1,quick:!1,no_perform_changes:!0},{name:"firstname",display:__("First name"),tag:"input",type:"text",limit:100,null:!0,signup:!0,info:!0,invite_agent:!0,invite_customer:!0},{name:"lastname",display:__("Last name"),tag:"input",type:"text",limit:100,null:!0,signup:!0,info:!0,invite_agent:!0,invite_customer:!0},{name:"email",display:__("Email"),tag:"input",type:"email",limit:100,null:!0,signup:!0,info:!0,invite_agent:!0,invite_customer:!0},{name:"organization_id",display:__("Organization"),tag:"select",multiple:!1,nulloption:!0,null:!0,relation:"Organization",signup:!1,info:!0,invite_customer:!0,note:__("Attention! Changing the organization will update the user's most recent tickets to the new organization.")},{name:"group_ids",display:__("Group permissions"),tag:"group_permissions",item_class:"checkbox"},{name:"created_by_id",display:__("Created by"),relation:"User",readonly:1},{name:"created_at",display:__("Created at"),tag:"datetime",readonly:1},{name:"updated_by_id",display:__("Updated by"),relation:"User",readonly:1},{name:"updated_at",display:__("Updated at"),tag:"datetime",readonly:1}],n.configure_overview=["login","firstname","lastname","organization"],n.configure_preview=["login","firstname","lastname","organization","created_at"],n.allowedReplaceTagsFunctionMapping={avatar:{function_name:"avatar_image_tag",placeholder_display:__("Avatar"),placeholder_content:"avatar(60,60)"}},n.prototype.uiUrl=function(){return"#user/profile/"+this.id},n.prototype.icon=function(){return"user"},n.prototype.initials=function(){return this.firstname&&this.lastname&&this.firstname[0]&&this.lastname[0]?this.firstname[0]+this.lastname[0]:this.firstname&&this.firstname[0]&&!this.lastname?this.firstname[1]?this.firstname[0]+this.firstname[1]:this.firstname[0]:!this.firstname&&this.lastname&&this.lastname[0]?this.lastname[1]?this.lastname[0]+this.lastname[1]:this.lastname[0]:this.email?this.email[0]+this.email[1]:"??"},n.prototype.avatar=function(t,e,n,i,s,r){var o,a,l,c,u,p,h,d;return null==t&&(t=40),null==e&&(e=""),null==n&&(n=""),null==i&&(i=!1),null==r&&(r=void 0),o=40,n&&(n+=" "),n+="size-"+(t=parseInt(t,10)),!1===this.active&&(n+=" avatar--inactive"),this.isOutOfOffice()&&(n+=" avatar--vacation"),e&&(e=" data-placement='"+e+"'"),s?(u=!1,a=' data-avatar-id="'+s.id+'"'):"personal"===r?(u=!1,a=' data-id="'+this.id+'"'):(n+=" user-popover",a=' data-id="'+this.id+'"'),u=this.vip,"personal"===r?u=!1:n+=" user-popover",1===this.id?App.view("avatar_system")():!this.image||"none"===this.image||i?(p=300*t/o,l=226*t/o,h=(c=new Math.seedrandom(this.id))()*(p-t),d=c()*(l-t),App.view("avatar_unique")({data:a,cssClass:n,placement:e,vip:u,x:h,y:d,initials:this.initials()})):App.view("avatar")({data:a,cssClass:n,placement:e,vip:u,url:this.imageUrl(),initials:this.initials()})},n.prototype.avatar_image_tag=function(t,e){var n;if(null==t&&(t=60),null==e&&(e=60),n=this.imageUrl())return'<img src="'+n+'" width="'+t+'" height="'+e+'" data-user-avatar="true" />'},n.prototype.isOutOfOffice=function(){var t,e,n;return!0===this.out_of_office&&(!!(n=this.out_of_office_start_at)&&(!!(t=this.out_of_office_end_at)&&(n=new Date(Date.parse(n)),t=new Date(Date.parse(t)),(e=new Date((new Date).toDateString())).setDate(e.getDate()+1),n<=e&&t>=e)))},n.prototype.maxLoginFailedReached=function(){return this.login_failed>parseInt(App.Config.get("password_max_login_failed"))},n.prototype.imageUrl=function(){if(this.image)return this.constructor.apiPath+"/users/image/"+this.image},n._fillUp=function(t){var e,n,i,s,r,o,a,l,c,u,p;if(t.accounts)for(e in t.accounts)"twitter"===e&&(t.accounts[e].link="https://twitter.com/"+t.accounts[e].username),"facebook"===e&&(t.accounts[e].link="https://www.facebook.com/profile.php?id="+t.accounts[e].uid);if(t.organization_id&&(t.organization=App.Organization.findNative(t.organization_id)),t.role_ids)for(t.roles=[],s=0,o=(l=t.role_ids).length;s<o;s++)p=l[s],App.Role.exists(p)&&(u=App.Role.findNative(p),t.roles.push(u));if(t.group_ids)for(t.groups=[],r=0,a=(c=t.group_ids).length;r<a;r++)i=c[r],App.Group.exists(i)&&(n=App.Group.findNative(i),t.groups.push(n));return t},n.prototype.searchResultAttributes=function(){var t,e;return t=["user","user-popover"],e="user",!1===this.active&&(t.push("is-inactive"),e="inactive-"+e),{display:""+this.displayName(),id:this.id,class:t.join(" "),url:this.uiUrl(),icon:e}},n.prototype.activityMessage=function(t){var e;if(t&&t.created_by)return"create"===t.type?App.i18n.translateContent("%s created user |%s|",t.created_by.displayName(),t.title):"update"===t.type?App.i18n.translateContent("%s updated user |%s|",t.created_by.displayName(),t.title):"session started"===t.type?App.i18n.translateContent("%s started a new session",t.created_by.displayName()):"switch to"===t.type?(e=t.title,t.objectNative&&(e=t.objectNative.displayName()),App.i18n.translateContent("%s switched to |%s|!",t.created_by.displayName(),e)):"ended switch to"===t.type?(e=t.title,t.objectNative&&(e=t.objectNative.displayName()),App.i18n.translateContent("%s ended switch to |%s|!",t.created_by.displayName(),e)):"Unknow action for ("+this.objectDisplayName()+"/"+t.type+"), extend activityMessage() of model."},n.prototype.permission=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S,x,j,D;if(r=t,_.isArray(t)||(r=[t]),_.contains(r,"*"))return!0;for(n=0,a=r.length;n<a;n++)if(t=r[n],(b=App.Permission.findByAttribute("name",t))&&!1===b.active)return!1;for(A={},i=0,l=(C=this.role_ids).length;i<l;i++)if(D=C[i],!0===(j=App.Role.findNative(D)).active)for(s=0,c=(T=j.permission_ids).length;s<c;s++){if(w=T[s],!(b=App.Permission.findNative(w)))throw"No such permission for id "+w;!0===b.active&&(A[b.name]=!0)}for(o=0,u=r.length;o<u;o++){for(e=!1,m=0,p=(x=r[o].split("+")).length;m<p;m++){if(f=!1,v="","*"===(y=(S=x[m]).split("."))[y.length-1])for(k in A)!0===A[k]&&(d=S.length-1,k.substr(0,d)===S.substr(0,d)&&(f=!0));if(!f)for(g=0,h=y.length;g<h;g++)""!==v&&(v+="."),A[v+=y[g]]&&(f=!0);if(!f){e=!1;break}e=!0}if(e)return e}return!1},n.prototype.allGroupIds=function(t){var e,n,i,s,r,o,a,l,c,u;if(null==t&&(t="full"),e=[],c=this.group_ids)for(s in c)r=c[s],(_.include(r,t)||_.include(r,"full"))&&e.push(s);if(u=this.role_ids)for(n=0,i=u.length;n<i;n++)if(l=u[n],App.Role.exists(l)&&(a=App.Role.findNative(l)).group_ids)for(s in o=a.group_ids)r=o[s],(_.include(r,t)||_.include(r,"full"))&&e.push(s);return _.uniq(e)},n.outOfOfficeTextPlaceholder=function(){var t,e;return e=new Date,t=App.i18n.translateContent("Christmas holiday"),e.getMonth()<3?t=App.i18n.translateContent("Easter holiday"):e.getMonth()<9&&(t=App.i18n.translateContent("Summer holiday")),t},n.prototype.outOfOfficeText=function(){return _.isEmpty(this.preferences.out_of_office_text)?App.User.outOfOfficeTextPlaceholder():this.preferences.out_of_office_text},n.prototype.isAccessibleBy=function(t,e){return!!t.permission("admin")||this["is"+(e.charAt(0).toUpperCase()+e.slice(1))+"ableBy"](t)},n.prototype.isReadableBy=function(t){return!!this.ownAccount(t)||(!!t.permission("admin.*")||(!!t.permission("ticket.agent")||!!t.permission("ticket.customer")&&("function"==typeof this.sameOrganization?this.sameOrganization(t):void 0)))},n.prototype.isChangeableBy=function(t){return!!t.permission("admin.user")||!!t.permission("ticket.agent")&&(!this.permission(["admin.user","ticket.agent"])&&this.permission("ticket.customer"))},n.prototype.isDeleteableBy=function(t){return t.permission("admin.user")},n.prototype.ownAccount=function(t){return this.id===t.id},n.prototype.sameOrganization=function(t){return null!==this.organization_id&&(null!==t.organization_id&&this.isInOrganization(t.organization_id))},n.prototype.lifetimeCustomerTicketsCount=function(){return(this.preferences.tickets_closed||0)+(this.preferences.tickets_open||0)},n.prototype.isInOrganization=function(t){return _.contains(this.allOrganizationIds(),t)},n.prototype.allOrganizationIds=function(){var t;return t=[],this.organization_id&&t.push(this.organization_id),_.isArray(this.organization_ids)&&(t=t.concat(this.organization_ids)),_.uniq(t)},n.prototype.secondaryOrganizations=function(t,e,n){var i,s,r;return r=[],i=[],_.isArray(this.organization_ids)&&(r=this.organization_ids.slice(t,e),i=_.filter(r,(function(t){return!App.Organization.findNative(t)}))),s=function(){var t,e,n,i,s;for(s=[],t=0,e=r.length;t<e;t++)i=r[t],(n=App.Organization.fullLocal(i))&&s.push(n);return s},i.length<1?n(s()):App.Ajax.request({type:"POST",url:this.constructor.apiPath+"/organizations/search",data:JSON.stringify({query:"*",ids:i,limit:e,full:!0}),processData:!0,success:function(t){return App.Collection.loadAssets(t.assets),n(s())},error:function(){return n([])}})},n.current=App.Session.get,n.prototype.displayName=function(){var t;return _.isEmpty(this.firstname)||(t=this.firstname),_.isEmpty(this.lastname)||(_.isEmpty(t)?t="":t+=" ",t+=this.lastname),_.isEmpty(t)?this.email?this.email:this.phone?this.phone:this.login?this.login:"-":t},n.prototype.displayNameLong=function(){var t;return _.isEmpty(this.firstname)||(t=this.firstname),_.isEmpty(this.lastname)||(_.isEmpty(t)?t="":t+=" ",t+=this.lastname),_.isEmpty(t)||(_.isEmpty(this.organization)?_.isEmpty(this.department)||(t=t+" ("+this.department+")"):t="object"==typeof this.organization?t+" ("+this.organization.name+")":t+" ("+this.organization+")"),_.isEmpty(t)?this.email?this.email:this.phone?this.phone:this.login?this.login:"-":t},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UserOverviewSorting=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("UserOverviewSorting","user_id","overview_id","prio"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/user_overview_sortings",n.configure_attributes=[{name:"user_id",display:__("User"),tag:"select",multiple:!1,null:!1,relation:"User",translate:!0},{name:"overview_id",display:__("Overview"),tag:"select",multiple:!1,null:!1,relation:"Overview",translate:!0},{name:"prio",display:__("Prio"),readonly:1}],n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UserOverviewSortingOverview=function(e){function n(){
return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("UserOverviewSortingOverview","name"),n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",translate:!0,null:!1}],n.configure_overview=["name"],n.all=function(){return n.__super__.constructor.all.apply(this,arguments).sort(this.overviewSort)},n.overviewSort=function(t,e){var n,i,s,r,o,a,l;for(n=t.prio+9999,i=e.prio+9999,r=s=0,o=(a=App.UserOverviewSorting.all()).length;s<o;r=++s)(l=a[r]).overview_id===t.id&&(n=l.prio),l.overview_id===e.id&&(i=l.prio);return n-i},n}(App.Model)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Webhook=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Webhook","name","endpoint","signature_token","ssl_verify","basic_auth_username","basic_auth_password","pre_defined_webhook_type","customized_payload","custom_payload","note","preferences","active"),n.extend(Spine.Model.Ajax),n.url=n.apiPath+"/webhooks",n.configure_attributes=[{name:"name",display:__("Name"),tag:"input",type:"text",limit:250,null:!1},{name:"endpoint",display:__("Endpoint"),tag:"input",type:"text",limit:300,null:!1,placeholder:"https://target.example.com/webhook"},{name:"signature_token",display:__("HMAC SHA1 Signature Token"),tag:"input",type:"text",limit:100,null:!0},{name:"ssl_verify",display:__("SSL verification"),tag:"boolean",null:!0,translate:!0,options:{true:"yes",false:"no"},default:!0},{name:"basic_auth_username",display:__("HTTP Basic Authentication Username"),tag:"input",type:"text",limit:250,null:!0,item_class:"formGroup--halfSize"},{name:"basic_auth_password",display:__("HTTP Basic Authentication Password"),tag:"input",type:"text",limit:250,null:!0,item_class:"formGroup--halfSize"},{name:"customized_payload",display:__("Custom Payload"),tag:"switch",null:!0,label_class:"hidden"},{name:"custom_payload",display:__("Custom Payload"),tag:"code_editor",null:!0,collapsible:!0,label_class:"hidden",hint:__('To revert back to the default payload, simply turn off the "Custom Payload" switch above.')},{name:"note",display:__("Note"),tag:"textarea",null:!0,note:"",limit:250},{name:"active",display:__("Active"),tag:"active",default:!0},{name:"updated_at",display:__("Updated"),tag:"datetime",readonly:1}],n.configure_delete=!0,n.configure_clone=!0,n.configure_overview=["name","endpoint"],n.description=__("Webhooks make it easy to send information about events within Zammad to third-party systems via HTTP(S).\n\nYou can use webhooks in Zammad to send ticket, article, and attachment data whenever a trigger is performed. Just create and configure your webhook with an HTTP(S) endpoint and relevant security settings, then configure a trigger to perform it."),n.prototype.displayName=function(){return this.endpoint?!1===this.active?this.name+" ("+this.endpoint+") ("+App.i18n.translateInline("inactive")+")":this.name+" ("+this.endpoint+")":this.name},n}(App.Model)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Controller=function(n){function i(){var e;this.locationExecute=t(this.locationExecute,this),this.locationExecuteOrNavigate=t(this.locationExecuteOrNavigate,this),this.locationVerify=t(this.locationVerify,this),this.stopLoading=t(this.stopLoading,this),this.startLoading=t(this.startLoading,this),this.recentView=t(this.recentView,this),this.frontendTimeUpdateItem=t(this.frontendTimeUpdateItem,this),this.frontendTimeUpdateElement=t(this.frontendTimeUpdateElement,this),this.frontendTimeUpdate=t(this.frontendTimeUpdate,this),this.closeTab=t(this.closeTab,this),this.updateNavMenu=t(this.updateNavMenu,this),this.abortAjaxCalls=t(this.abortAjaxCalls,this),this.releaseController=t(this.releaseController,this),this.interval=t(this.interval,this),this.clearInterval=t(this.clearInterval,this),this.delay=t(this.delay,this),this.clearDelay=t(this.clearDelay,this),this.controllerUnbind=t(this.controllerUnbind,this),this.controllerBind=t(this.controllerBind,this),i.__super__.constructor.apply(this,arguments),this.controllerId="controller-"+(new Date).getTime()+"-"+Math.floor(999999*Math.random()),this.el.on("remove",this.releaseController),this.el.on("remove",this.release),this.Config=App.Config,this.Session=App.Session,this.apiPath=this.Config.get("api_path"),this.ajaxCalls=[],this.ajax=(e=this,function(t){var n;return n=App.Ajax.request(t),e.ajaxCalls.push(n)})}return e(i,n),i.include(App.LogInclude),i.include(App.RenderScreen),i.prototype.navigate=function(t,e){var n,s;return null==e&&(e={}),this.log("debug","navigate to '"+t+"'"),e.hideCurrentLocationFromHistory&&this.log("debug","navigate hide from history '"+e.hideCurrentLocationFromHistory+"'"),e.emptyEl&&this.el.empty(),e.removeEl&&this.el.remove(),e.hideCurrentLocationFromHistory&&window.history&&(s=(n=App.Config.get("History"))[n.length-2])&&window.history.replaceState(null,null,s),i.__super__.navigate.call(this,t)},i.prototype.preventDefault=function(t){return t.preventDefault()},i.prototype.controllerBind=function(t,e){return App.Event.bind(t,e,this.controllerId)},i.prototype.controllerUnbind=function(t,e){return App.Event.unbind(t,e,this.controllerId)},i.prototype.clearDelay=function(t){return App.Delay.clear(t,this.controllerId)},i.prototype.delay=function(t,e,n,i){return null==i&&(i=!1),App.Delay.set(t,e,n,this.controllerId,i)},i.prototype.clearInterval=function(t){return App.Interval.clear(t,this.controllerId)},i.prototype.interval=function(t,e,n,i){return null==i&&(i=!1),App.Interval.set(t,e,n,this.controllerId,i)},i.prototype.releaseController=function(){if(App.Event.unbindLevel(this.controllerId),App.Delay.clearLevel(this.controllerId),App.Interval.clearLevel(this.controllerId),this.abortAjaxCalls(),this.el)try{this.el.off(),this.el.empty()}catch(t){}return this.off(),this.unbind(),this.stopListening()},i.prototype.release=function(){},i.prototype.abortAjaxCalls=function(){var t,e,n,i,s;if(this.ajaxCalls){for(n=this.ajaxCalls,this.ajaxCalls=[],s=[],e=0,i=n.length;e<i;e++)t=n[e],s.push(App.Ajax.abort(t));return s}},i.prototype.title=function(t,e){var n,i;return null==e&&(e=!1),i=t,e&&(i=App.i18n.translatePlain(t)),n=this.Config.get("product_name")+" - "+i,document.title=n,App.Event.trigger("window-title-set",n)},i.prototype.copyToClipboardWithTooltip=function(t,e,n,i){var s;return clipboard.writeText(t),i||(e+=" > .ticketNumberCopy-icon"),(s=this.el.find(e).tooltip({trigger:"manual",placement:"bottom",container:n,title:function(){return App.i18n.translateContent("Copied!")}})).tooltip("show"),this.delay((function(){return s.tooltip("hide")}),1500),s},i.prototype.disconnectClient=function(){return App.Delay.reset(),App.Interval.reset(),App.WebSocket.close({force:!0})},i.prototype.notify=function(t){return App.Event.trigger("notify",t)},i.prototype.notifyDesktop=function(t){return App.Event.trigger("notifyDesktop",t)},i.prototype.navupdate=function(t,e){if(null==e&&(e=!1),e||"#clues"!==window.location.hash)return App.Event.trigger("navupdate",t)},i.prototype.updateNavMenu=function(){var t;return t=function(){return App.Event.trigger("menu:render")},this.delay(t,150)},i.prototype.closeTab=function(t,e){if(null==t&&(t=this.taskKey),null!=t)return App.TaskManager.remove(t),null==e&&(e=App.TaskManager.nextTaskUrl()||"#"),this.navigate(e)},i.prototype.scrollTo=function(t,e,n){var i;return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),i=function(){return window.scrollTo(t,e)},this.delay(i,n)},i.prototype.scrollToIfNeeded=function(t,e){if(null==e&&(e=!0),t&&t.get(0)&&(!0!==e||!t.visible(!0)))return t.get(0).scrollIntoView(e)},i.prototype.shake=function(t){var e,n;return n=function(t,e,i){var s,r;if(r=e.shift(),t.css("left",r+"px"),e.length>0)return setTimeout((function(){return n(t,e,i)}),i);try{return t.css("position","static")}catch(t){return s=t,console.log("error",s)}},e=(e=[15,30,15,0,-15,-30,-15,0]).concat(e.concat(e)),t.css("position","relative"),n(t,e,20)},i.prototype.formParam=function(t){return App.ControllerForm.params(t)},i.prototype.formDisable=function(t,e){return App.ControllerForm.disable(t,e)},i.prototype.formEnable=function(t,e){return App.ControllerForm.enable(t,e)},i.prototype.formValidate=function(t){return App.ControllerForm.validate(t)},i.prototype.queryParam=function(){var t,e,n,i,s;if(this.query){for(i={},t=0,e=(n=this.query.split(";")).length;t<e;t++)(s=n[t].match("(.+?)=(.*)"))&&s[1]&&(i[s[1]]=s[2]);return i}},i.prototype.humanFileSize=function(t){return App.Utils.humanFileSize(t)},i.prototype.humanTime=function(t,e,n){return null==n&&(n=!0),App.PrettyDate.humanTime(t,e,n)},i.prototype.userInfo=function(t){var e;return(e=t.el||$('[data-id="customer_info"]')).off(),new App.WidgetUser({el:e,user_id:t.user_id,callback:t.callback})},i.prototype.permissionCheckRedirect=function(t,e){if(null==e&&(e=!1),this.permissionCheck(t))return!0;throw this.requestedUrlToStore(),e&&App.TaskManager.remove(this.taskKey),this.navigate("#login"),"No permission for "+t},i.prototype.permissionCheck=function(t){var e;return null!=(e=App.User.current())?e.permission(t):void 0},i.prototype.authenticateCheckRedirect=function(){if(this.authenticateCheck())return!0;throw this.requestedUrlToStore(),this.navigate("#login"),"No exsisting session"},i.prototype.authenticateCheck=function(){return!!this.Session.get()},i.prototype.requestedUrlToStore=function(){var t;if((t=window.location.hash)&&"#"!==t&&"#login"!==t&&"#logout"!==t&&"#session_timeout"!==t&&"#keyboard_shortcuts"!==t)return this.requestedUrlRemember(t)},i.prototype.requestedUrlRemember=function(t){return App.SessionStorage.set("requested_url",t),App.Config.set("requested_url",t)},i.prototype.requestedUrlWas=function(){return App.SessionStorage.get("requested_url")||App.Config.get("requested_url")},i.prototype.frontendTimeUpdate=function(){var t,e;return e=this,t=function(){return e.frontendTimeUpdateElement($("#app"))},App.Interval.set(t,61e3,"frontendTimeUpdate","ui")},i.prototype.frontendTimeUpdateElement=function(t){var e;return e=this,t.find(".humanTimeFromNow").each((function(){var t;return t=$(this),e.frontendTimeUpdateItem(t,t.text())}))},i.prototype.frontendTimeUpdateItem=function(t,e){var n,i,s;if("null"!==(s=t.attr("datetime"))&&(i=this.humanTime(s,t.hasClass("escalation")))!==e)return n=App.i18n.translateTimestamp(s),t.attr("timezone")&&(n+=" "+t.attr("timezone")),t.hasClass("noTitle")||t.attr("title",n),t.html(i)},i.prototype.recentView=function(t,e){var n;return n={object:t,o_id:e},App.Ajax.request({id:"recent_view_"+t+"_"+e,type:"POST",url:this.Config.get("api_path")+"/recent_view",data:JSON.stringify(n),processData:!0})},i.prototype.prepareForObjectList=function(t){var e,n,i;for(e=0,i=t.length;e<i;e++)n=t[e],n=this.prepareForObjectListItem(n);return t},i.prototype.prepareForObjectListItem=function(t){var e;return t.link="",t.title="-",t.object=t.object.replace("::",""),App[t.object]&&App[t.object].exists(t.o_id)&&(e=App[t.object].findNative(t.o_id),t.objectNative=e,t.link=e.uiUrl(),t.title=e.displayName(),t.object_name=e.objectDisplayName(),t.cssIcon=e.iconActivity(this.Session.get())),t.created_by=App.User.findNative(t.created_by_id),t},i.prototype.stopPropagation=function(t){return t.stopPropagation()},i.prototype.preventDefaultAndStopPropagation=function(t){return t.preventDefault(),t.stopPropagation()},i.prototype.startLoading=function(t){var e,n;if(!this.initLoadingDone||t)return this.initLoadingDone=!0,this.stopLoading(),n=this,e=function(){return t?t.html(App.view("generic/page_loading")()):n.html(App.view("generic/page_loading")())},this.initLoadingDoneDelay=this.delay(e,1800)},i.prototype.stopLoading=function(){if(this.initLoadingDoneDelay)return this.clearDelay(this.initLoadingDoneDelay)},i.prototype.locationVerify=function(t){var e;if(e=$(t.currentTarget).attr("href"),this.log("debug","new location '"+e+"'"),e)return this.locationExecuteOrNavigate(e)},i.prototype.locationExecuteOrNavigate=function(t){var e;return e=Spine.Route.getPath(),this.log("debug","current location '"+e+"'"),t.replace(/#/,"")!==e?(this.log("debug","navigate to location '"+t+"'"),void this.navigate(t)):this.locationExecute(t)},i.prototype.locationExecute=function(t){return t=t.replace(/#/,""),this.log("debug","execute controller again for '"+t+"' because of same hash"),Spine.Route.matchRoutes(t)},i.prototype.logoUrl=function(){return"/api/v1/system_assets/product_logo/"+this.Config.get("product_logo")},i.prototype.selectAll=function(t){return t.currentTarget.focus(),t.currentTarget.select()},i.prototype.windowReload=function(t,e){if(t&&t.preventDefault(),$("#app").hide().attr("style","display: none!important"),e)return window.location=e,!0;if(window.location.reload)return window.location.reload(),!0;if(window.location.href)return window.location.href=window.location.href,!0;throw"Cant reload page!"},i}(Spine.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerGenericIndex=function(n){function i(){var e;this.description=t(this.description,this),this.clone=t(this.clone,this),this.new=t(this.new,this),this.edit=t(this.edit,this),this.renderObjects=t(this.renderObjects,this),this.render=t(this.render,this),this.paginate=t(this.paginate,this),this.release=t(this.release,this),this.hide=t(this.hide,this),this.show=t(this.show,this),i.__super__.constructor.apply(this,arguments),this.pageData.title&&this.title(this.pageData.title,!0),this.pageData.navupdate&&this.navupdate(this.pageData.navupdate),this.disableRender||(this.subscribeId=App[this.genericObject].subscribe(this.render)),App[this.genericObject].bind("ajaxError",(e=this,function(t,n){if(e.log("error","ajax",n.status),401===n.status)return e.log("error","ajax",t,n,n.status),e.navigate("login")})),this.render(),this.disableInitFetch||this.pageData.pagerAjax||App[this.genericObject].fetchFull((function(){}),{clear:!0})}return e(i,n),i.prototype.events={"click [data-type=edit]":"edit","click [data-type=new]":"new","click [data-type=payload]":"payload","click [data-type=import]":"import","click .js-description":"description"},i.prototype.show=function(){if(this.table)return this.table.show()},i.prototype.hide=function(){if(this.table)return this.table.hide()},i.prototype.release=function(){if(this.subscribeId)return App[this.genericObject].unsubscribe(this.subscribeId)},i.prototype.paginate=function(t){if(t!==this.pageData.pagerSelected)return this.pageData.pagerSelected=t,this.render()},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c;return this.pageData.pagerAjax?(e=l=(null!=(s=this.table)?s.customOrderBy:void 0)||(null!=(r=this.table)?r.orderBy:void 0)||this.defaultSortBy||"id",t=i=(null!=(o=this.table)?o.customOrderDirection:void 0)||(null!=(a=this.table)?a.orderDirection:void 0)||this.defaultOrder||"ASC","id"!==l&&(e=l+", id",t=i+", ASC"),this.startLoading(),void App[this.genericObject].indexFull((c=this,function(t,e){return c.pageData.pagerTotalCount=e.total_count,c.stopLoading(),c.renderObjects(t)}),{refresh:!1,sort_by:e,order_by:t,page:this.pageData.pagerSelected,per_page:this.pageData.pagerPerPage})):(n=App[this.genericObject].search({sortBy:this.defaultSortBy||"name",order:this.defaultOrder}),this.renderObjects(n))},i.prototype.renderObjects=function(t){var e,n,i;return this.ignoreObjectIDs&&(t=_.filter(t,(function(t){if(1!==t.id)return t}))),!this.table&&(i=!1,App[this.genericObject].description&&!_.isEmpty(t)&&(i=!0),this.html(App.view("generic/admin/index")({head:this.pageData.objects,notes:this.pageData.notes,buttons:this.pageData.buttons,menus:this.pageData.menus,subHead:this.pageData.subHead,showDescription:i})),_.isEmpty(t)&&App[this.genericObject].description)?(e=marked(App.i18n.translateContent(App[this.genericObject].description)),void this.$(".table-overview").html(e)):(n=_.extend({tableId:this.genericObject+"-generic-overview",el:this.$(".table-overview"),model:App[this.genericObject],objects:t,bindRow:{events:{click:this.edit}},container:this.container,explanation:this.pageData.explanation,groupBy:this.groupBy,dndCallback:this.dndCallback,cloneCallback:this.clone},this.pageData.tableExtend),this.pageData.pagerAjax&&(n=_.extend({pagerAjax:this.pageData.pagerAjax,pagerBaseUrl:this.pageData.pagerBaseUrl,pagerSelected:this.pageData.pagerSelected,pagerPerPage:this.pageData.pagerPerPage,pagerTotalCount:this.pageData.pagerTotalCount,sortRenderCallback:this.render},n)),this.table?this.table.update({objects:t,pagerSelected:this.pageData.pagerSelected,pagerTotalCount:this.pageData.pagerTotalCount}):this.table=new App.ControllerTable(n),this.pageData.logFacility?new App.HttpLog({el:this.$(".page-footer"),facility:this.pageData.logFacility}):void 0)},i.prototype.editControllerClass=function(){return App.ControllerGenericEdit},i.prototype.edit=function(t,e){var n,i;if(e.preventDefault(),n=this.editControllerClass(),i=App[this.genericObject].find(t),!this.editCallback)return new n({id:i.id,pageData:this.pageData,genericObject:this.genericObject,container:this.container,small:this.small,large:this.large,veryLarge:this.veryLarge,handlers:this.handlers,validateOnSubmit:this.validateOnSubmit,screen:this.editScreen});this.editCallback(i)},i.prototype.newControllerClass=function(){return App.ControllerGenericNew},i.prototype.new=function(t,e){return null!=t&&t.preventDefault(),new(this.newControllerClass())({item:e,pageData:this.pageData,genericObject:this.genericObject,container:this.container,small:this.small,large:this.large,veryLarge:this.veryLarge,handlers:this.handlers,validateOnSubmit:this.validateOnSubmit,screen:this.createScreen})},i.prototype.clone=function(t){return this.new(null,t)},i.prototype.payload=function(t){return t.preventDefault(),new App.WidgetPayloadExample({baseUrl:this.payloadExampleUrl,container:this.el.closest(".content")})},i.prototype.import=function(t){return t.preventDefault(),this.importCallback()},i.prototype.description=function(){return new App.ControllerGenericDescription({description:App[this.genericObject].description,container:this.container})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerModal=function(n){function i(){var e;(this.stopLoading=t(this.stopLoading,this),this.startLoading=t(this.startLoading,this),this.submit=t(this.submit,this),this.cancel=t(this.cancel,this),this.localOnCancel=t(this.localOnCancel,this),this.localOnClosed=t(this.localOnClosed,this),this.localOnClose=t(this.localOnClose,this),this.onShown=t(this.onShown,this),this.localOnShown=t(this.localOnShown,this),this.localOnShow=t(this.localOnShow,this),this.formParams=t(this.formParams,this),this.close=t(this.close,this),this.render=t(this.render,this),this.element=t(this.element,this),this.update=t(this.update,this),this.showDelayed=t(this.showDelayed,this),i.__super__.constructor.apply(this,arguments),this.showTryCount=0,!this.authenticateRequired||this.authenticateCheckRedirect())&&(this.controllerBind("ui:rerender",(e=this,function(){return e.update(),"modal"})),this.shown&&this.render())}return e(i,n),i.prototype.authenticateRequired=!1,i.prototype.backdrop=!0,i.prototype.keyboard=!0,i.prototype.large=!1,i.prototype.small=!1,i.prototype.veryLarge=!1,i.prototype.dynamicSize=!1,i.prototype.head="?",i.prototype.autoFocusOnFirstInput=!0,i.prototype.container=null,i.prototype.buttonClass="btn--success",i.prototype.centerButtons=[],i.prototype.leftButtons=[],i.prototype.buttonClose=!0,i.prototype.buttonCancel=!1,i.prototype.buttonCancelClass="btn--text btn--subtle",i.prototype.buttonSubmit=!0,i.prototype.includeForm=!0,i.prototype.headPrefix="",i.prototype.shown=!0,i.prototype.closeOnAnyClick=!1,i.prototype.initalFormParams={},i.prototype.initalFormParamsIgnore=!1,i.prototype.showTrySupport=!1,i.prototype.showTryMax=10,i.prototype.showTrydelay=1e3,i.prototype.events={"submit form":"submit","click .js-submit:not(.is-disabled)":"submit","click .js-cancel":"cancel","click .js-close":"cancel"},i.prototype.className="modal fade",i.prototype.showDelayed=function(){var t,e;return e=this,t=function(){return e.showTryCount+=1,e.render()},this.delay(t,this.showTrydelay)},i.prototype.modalAlreadyExists=function(){return $(".modal").length>0},i.prototype.content=function(){return"You need to implement a '@content()' method!"},i.prototype.update=function(){var t,e;return t=this.message?App.i18n.translateContent(this.message):this.contentInline?this.contentInline:this.content(),(e=$(App.view("modal")({head:this.head,headPrefix:this.headPrefix,message:this.message,detail:this.detail,buttonClose:this.buttonClose,buttonCancel:this.buttonCancel,buttonCancelClass:this.buttonCancelClass,buttonSubmit:this.buttonSubmit,buttonClass:this.buttonClass,centerButtons:this.centerButtons,leftButtons:this.leftButtons,includeForm:this.includeForm}))).find(".modal-body").html(t),this.initRenderingDone?this.$(".modal-dialog").empty().append(e[0].childNodes):(this.initRenderingDone=!0,this.html(e)),this.post()},i.prototype.post=function(){},i.prototype.element=function(){return this.el},i.prototype.render=function(){var t;if(!(!0===this.showTrySupport&&this.modalAlreadyExists()&&this.showTryCount<=this.showTryMax))return this.initalFormParamsIgnore=!1,!0===this.buttonSubmit&&(this.buttonSubmit="Submit"),!0===this.buttonCancel&&(this.buttonCancel=__("Cancel & Go Back")),this.update(),this.container&&this.el.addClass("modal--local"),this.dynamicSize&&this.el.addClass("modal--dynamicSize"),this.veryLarge&&this.el.addClass("modal--veryLarge"),this.large&&this.el.addClass("modal--large"),this.small&&this.el.addClass("modal--small"),this.el.on({"show.bs.modal":this.localOnShow,"shown.bs.modal":this.localOnShown,"hide.bs.modal":this.localOnClose,"hidden.bs.modal":this.localOnClosed,"dismiss.bs.modal":this.localOnCancel}).modal({keyboard:this.keyboard,show:!0,backdrop:this.backdrop,container:this.container}),this.closeOnAnyClick?this.el.on("click",(t=this,function(){return t.close()})):void 0;this.showDelayed()},i.prototype.close=function(t){return t&&t.preventDefault(),this.initalFormParamsIgnore=!0,this.el.modal("hide")},i.prototype.formParams=function(){return this.container?this.formParam(this.container.find(".modal form")):this.formParam(this.$(".modal form"))},i.prototype.showAlert=function(t,e){var n;return null==e&&(e="danger"),n=$("<div>").addClass("alert alert--"+e).text(t),this.$(".modal-alerts-container").html(n)},i.prototype.clearAlerts=function(){return this.$(".modal-alerts-container").empty()},i.prototype.localOnShow=function(t){return this.onShow(t)},i.prototype.onShow=function(){},i.prototype.localOnShown=function(t){return this.onShown(t),this.el.addClass("modal--ready")},i.prototype.onShown=function(){var t;return this.autoFocusOnFirstInput&&((t=this.$(".form-group").first()).get(0)||(t=this.el),t.find('input:not([disabled]):not([type="hidden"]):not(".btn"), select:not([disabled]), textarea:not([disabled])').first().trigger("focus")),this.initalFormParams=this.formParams()},i.prototype.localOnClose=function(t){var e;if(e=difference(this.initalFormParams,this.formParams()),!1!==this.initalFormParamsIgnore||_.isEmpty(e)||confirm(App.i18n.translateContent("The form content has been changed. Do you want to close it and lose your changes?")))return this.onClose(t);t.preventDefault()},i.prototype.onClose=function(){},i.prototype.localOnClosed=function(t){return this.onClosed(t),this.el.modal("remove")},i.prototype.onClosed=function(){},i.prototype.localOnCancel=function(t){return this.onCancel(t)},i.prototype.onCancel=function(){},i.prototype.cancel=function(t){return this.close(t),this.onCancel(t)},i.prototype.onSubmit=function(){},i.prototype.submit=function(t){return t.stopPropagation(),t.preventDefault(),this.clearAlerts(),this.onSubmit(t)},i.prototype.startLoading=function(){return this.$(".modal-body").addClass("hide"),this.$(".modal-loader").removeClass("hide")},i.prototype.stopLoading=function(){return this.$(".modal-body").removeClass("hide"),this.$(".modal-loader").addClass("hide")},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerConfirm=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Yes"),i.prototype.buttonClass="btn--success",i.prototype.head=__("Confirmation"),i.prototype.small=!0,i.prototype.content=function(){return App.i18n.translateContent(this.message)},i.prototype.onSubmit=function(){if(this.close(),this.callback)return this.callback()},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerConfirmDelete=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),this.highlightError=t(this.highlightError,this),this.isCheckWordMatching=t(this.isCheckWordMatching,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Delete"),i.prototype.buttonClass="btn--danger",i.prototype.head=__("Are you sure?"),i.prototype.safeWord=__("Delete"),i.prototype.fieldDisplay=void 0,i.prototype.small=!0,i.prototype.content=function(){return this.controller=new App.ControllerForm({model:{configure_attributes:[{name:"sure",display:this.fieldDisplay,null:!0,tag:"input",placeholder:App.i18n.translatePlain(this.safeWord).toUpperCase()}]},autofocus:!0}),this.controller.form},i.prototype.isCheckWordMatching=function(){return App.ControllerForm.params(this.el).sure===App.i18n.translatePlain(this.safeWord).toUpperCase()},i.prototype.highlightError=function(){return this.$("form").addClass("has-error")},i.prototype.onSubmit=function(){if(this.isCheckWordMatching())return this.formDisable(this.controller.el),this.callback(this);this.highlightError()},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerGenericDescription=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!1,i.prototype.buttonSubmit=__("Close"),i.prototype.head=__("Description"),i.prototype.content=function(){return marked(App.i18n.translateContent(this.description))},i.prototype.onSubmit=function(){return this.close()},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerGenericDestroyConfirm=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("delete"),i.prototype.buttonClass="btn--danger",i.prototype.head=__("Confirmation"),i.prototype.small=!0,i.prototype.content=function(){return App.i18n.translateContent("Do you really want to delete this object?")},i.prototype.onSubmit=function(){var t,e;return(t=this.options||{}).done=(e=this,function(){if(e.close(),e.callback)return e.callback()}),t.fail=function(t){return function(e,n){return t.log("errors"),t.showAlert(n.human_error||n.error)}}(this),this.item.destroy(t)},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerGenericEdit=function(n){function i(){return this.contentFormParams=t(this.contentFormParams,this),this.contentFormModel=t(this.contentFormModel,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.headPrefix="Edit",i.prototype.content=function(){return this.item=App[this.genericObject].find(this.id),this.head=this.pageData.head||this.pageData.object,this.controller=new App.ControllerForm({model:this.contentFormModel(),params:this.contentFormParams(),screen:this.screen||"edit",autofocus:!0,handlers:this.handlers}),this.controller.form},i.prototype.contentFormModel=function(){return App[this.genericObject]},i.prototype.contentFormParams=function(){return this.item},i.prototype.onSubmit=function(t){var e,n,i,s;return i=this.formParam(t.target),this.item.load(i),!((e=$(t.target).closest("form").get(0))&&e.reportValidity&&!e.reportValidity())&&(n=this.item.validate({controllerForm:this.controller}),this.validateOnSubmit&&(n=Object.assign({},n,this.validateOnSubmit(i))),_.isEmpty(n)?(this.formDisable(t),s=this,this.item.save({done:function(){var t;return s.callback&&(t=App[s.genericObject].fullLocal(this.id),s.callback(t)),s.close()},fail:function(e,n){return App[s.genericObject].fetch({id:this.id}),s.log("errors"),s.formEnable(t),s.controller.showAlert(n.error_human||n.error||__("The object could not be updated."))}})):(this.log("error",n),this.formValidate({form:t.target,errors:n}),!1))},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerErrorModal=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!1,i.prototype.buttonSubmit=__("Close"),i.prototype.head=__("Error"),i.prototype.showTrySupport=!0,i.prototype.content=function(){return this.message},i.prototype.onSubmit=function(){if(this.close(),this.callback)return this.callback()},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.GenericHistory=function(n){function i(){this.sortorder=t(this.sortorder,this),this.onShown=t(this.onShown,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments),this.reverse=!1,this.fetch()}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("User"),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!1,i.prototype.buttonSubmit=!1,i.prototype.head=__("History"),i.prototype.shown=!1,i.prototype.content=function(){var t,e,n;return e=this.reworkItems(this.items),(t=$(App.view("generic/history")({items:e}))).find('a[data-type="sortorder"]').on("click",(n=this,function(t){return t.preventDefault(),n.sortorder()})),t},i.prototype.onShown=function(){return this.renderPopovers()},i.prototype.sortorder=function(){return this.reverse=!this.reverse,this.update()},i.prototype.T=function(t){return App.i18n.translateInline(t)},i.prototype.sourceableTypeDisplayName=function(t){return{PostmasterFilter:__("Postmaster Filter"),Job:__("Scheduler")}[t]||t},i.prototype.reworkItems=function(t){
var e,n,i,s,r,o,a,l,c,u,p,h,d,f;for(u=[],c={},"_",void 0,o=void 0,i=0,a=(t=clone(t)).length;i<a;i++)"Ticket::Article"===(s=t[i]).object&&(s.object="Article"),"Ticket::SharedDraftZoom"===s.object&&(s.object="Draft"),n=new Date(s.created_at),r=new Date(new Date(o).getTime()+15e3),(_.isEmpty(c)||n>r)&&(o=s.created_at,_.isEmpty(c)||u.push(c),c={created_at:s.created_at,created_by:App.User.find(s.created_by_id),sources:[]}),(p=_.findWhere(c.sources,{sourceable_id:s.sourceable_id}))||(p={sourceable_id:s.sourceable_id,sourceable_type:this.sourceableTypeDisplayName(s.sourceable_type),sourceable_name:s.sourceable_name,users:[]},c.sources.push(p)),(h=_.findWhere(p.users,{id:s.created_by_id}))||(h={id:s.created_by_id,object:App.User.find(s.created_by_id),records:[]},p.users.push(h)),e="","notification"===s.type&&(e=App.i18n.translateContent("notification sent to '%s'",s.value_to)),"email"===s.type?e=App.i18n.translateContent("email sent to '%s'",s.value_to):"time_trigger_performed"===s.type?(l=function(){switch(s.value_from){case"reminder_reached":return __("trigger '%s' was performed because pending reminder was reached");case"escalation":return __("trigger '%s' was performed because ticket was escalated");case"escalation_warning":return __("trigger '%s' was performed because ticket will escalate soon")}}(),e=App.i18n.translateContent(l,s.sourceable_name)):"received_merge"===s.type?(f=(d=App.Ticket.find(s.id_from))?'<a href="#ticket/zoom/'+s.id_from+'">#'+d.number+"</a>":s.value_from,e=App.i18n.translatePlain("ticket %s was merged into this ticket",f)):"merged_into"===s.type?(f=(d=App.Ticket.find(s.id_to))?'<a href="#ticket/zoom/'+s.id_to+'">#'+d.number+"</a>":s.value_to,e=App.i18n.translatePlain("this ticket was merged into ticket %s",f)):(e=this.T(s.type)+" "+this.T(s.object)+" ",s.attribute&&(e+=""+this.translateItemAttribute(s),"User"===s.object&&"last_login"===s.attribute&&(s.value_from&&(s.value_from=App.i18n.translateTimestamp(s.value_from)),s.value_to&&(s.value_to=App.i18n.translateTimestamp(s.value_to)))),s.value_from&&(s.value_to&&(e+=" "+this.T("from")),e+=" '"+this.translateItemValue(s,s.value_from)+"'"),s.value_to?((s.value_from||"Mention"===s.object)&&(e+=" &rarr;"),e+=" '"+this.translateItemValue(s,s.value_to)+"'"):s.value_from&&(e+=" &rarr; '-'")),h.records.push(e);return _.isEmpty(c)||u.push(c),this.reverse&&(u=u.reverse()),u},i.prototype.translateItemValue=function(t,e){var n,i,s,r,o;return s=t.object,n=t.attribute,"Mention"===s?(r="-",e&&(o=App.User.find(e))&&(r=o.displayName()),r):"group"===n?e.replaceAll("::"," \u203a "):(i=this.objectAttribute(s,n))&&"datetime"===i.tag||/_(time|at)$/.test(n)?App.i18n.translateTimestamp(e):i&&!0===i.translate?this.T(e):App.Utils.htmlEscape(e)},i.prototype.translateItemAttribute=function(t){var e,n,i;return i=t.object,e=t.attribute,(n=this.objectAttribute(i,e))&&n.display?this.T(n.display):this.T(e)},i.prototype.objectAttribute=function(t,e){if(App[t]&&App[t].attributesGet())return App[t].attributesGet()[e+"_id"]||App[t].attributesGet()[e]},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerGenericNew=function(n){function i(){return this.contentFormParams=t(this.contentFormParams,this),this.contentFormModel=t(this.contentFormModel,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.headPrefix="New",i.prototype.showTrySupport=!0,i.prototype.content=function(){return this.head=this.pageData.head||this.pageData.object,this.controller=new App.ControllerForm({model:this.contentFormModel(),params:this.contentFormParams(),screen:this.screen||"create",autofocus:!0,handlers:this.handlers}),this.controller.form},i.prototype.contentFormModel=function(){return App[this.genericObject]},i.prototype.contentFormParams=function(){return this.item},i.prototype.onSubmit=function(t){var e,n,i,s,r;return s=this.formParam(t.target),(i=new App[this.genericObject]).load(s),!((e=$(t.target).closest("form").get(0))&&e.reportValidity&&!e.reportValidity())&&(n=i.validate({controllerForm:this.controller}),this.validateOnSubmit&&(n=Object.assign({},n,this.validateOnSubmit(s))),_.isEmpty(n)?(this.formDisable(t),r=this,i.save({done:function(){var t;return r.callback&&(t=App[r.genericObject].fullLocal(this.id),r.callback(t)),r.close()},fail:function(e,n){return r.log("errors",n),r.formEnable(t),r.controller.showAlert(n.error_human||n.error||__("The object could not be created."))}})):(this.log("error",n),this.formValidate({form:t.target,errors:n}),!1))},i}(App.ControllerModal)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ControllerAfterAuthModal=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.includeForm=!1,n.prototype.data={},n.prototype.logoutOnCancel=!0,n.prototype.backdrop="static",n.prototype.keyboard=!1,n.prototype.buttonClose=!1,n.prototype.buttonSubmit=!1,n.prototype.buttonCancel=__("Cancel"),n.prototype.onCancel=function(){if(this.logoutOnCancel)return App.Auth.logout()},n.prototype.fetchAfterAuth=function(){return this.ajax({id:"after_auth",type:"GET",url:this.apiPath+"/users/after_auth",success:function(t){if(App.Config.set("after_auth",t),!_.isEmpty(t))return new App["AfterAuth"+t.type]({data:t.data})}})},n}(App.ControllerModal)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ControllerAppContent=function(e){function n(t){this.requiredPermission&&this.permissionCheckRedirect(this.requiredPermission),App.TaskManager.hideAll(),t.el=t.appEl.find("#content"),t.el.removeClass("hide").removeClass("active"),t.el.get(0)||(t.appEl.append('<div id="content" class="content flex horizontal"></div>'),t.el=$("#content")),n.__super__.constructor.call(this,t)}return t(n,e),n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ControllerArticlePublicConfirm=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.head=__("Publish Article"),n.prototype.message=__('Do you really want to set the visibility of this article to "public"?'),n}(App.ControllerConfirm)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.CollectionController=function(n){function i(){var e;this.remove=t(this.remove,this),this.click=t(this.click,this),this.location=t(this.location,this),this.renderItem=t(this.renderItem,this),this.renderParts=t(this.renderParts,this),this.itemGet=t(this.itemGet,this),this.itemAttributes=t(this.itemAttributes,this),this.itemAttributesSet=t(this.itemAttributesSet,this),this.itemAttributesGet=t(this.itemAttributesGet,this),this.itemAttributesDelete=t(this.itemAttributesDelete,this),this.itemAttributesDiff=t(this.itemAttributesDiff,this),this.itemsAll=t(this.itemsAll,this),this.itemDestroy=t(this.itemDestroy,this),this.renderAll=t(this.renderAll,this),this.domChange=t(this.domChange,this),this.domRemove=t(this.domRemove,this),this.collectionSync=t(this.collectionSync,this),this.collectionOrderSet=t(this.collectionOrderSet,this),this.collectionOrderGet=t(this.collectionOrderGet,this),this.uIRunner=t(this.uIRunner,this),this.release=t(this.release,this),this.events||(this.events=this.constructor.events),this.observe||(this.observe=this.constructor.observe),this.currentItems={},this.renderList={},this.queue=[],this.queueRunning=!1,this.lastOrder=[],i.__super__.constructor.apply(this,arguments),this.queue.push(["renderAll"]),this.uIRunner(),this.model&&(this.subscribeId=App[this.model].subscribe(this.collectionSync)),this.globalRerender&&this.controllerBind("ui:rerender",(e=this,function(){return e.queue.push(["renderAll"]),e.uIRunner()})),this.controllerBind("auth:login",function(t){return function(){return t.queue.push(["renderAll"]),t.uIRunner()}}(this)),this.controllerBind("auth:logout",function(t){return function(){return t.queue.push(["renderAll"]),t.uIRunner()}}(this)),this.log("debug","Init @uniqKey",this.uniqKey),this.log("debug","Init @observe",this.observe),this.log("debug","Init @model",this.model)}return e(i,n),i.prototype.events={"click .js-remove":"remove","click .js-item":"click","click .js-locationVerify":"location"},i.prototype.observe={field1:!0,field2:!1},i.prototype.template="_need_to_be_defined_",i.prototype.uniqKey="id",i.prototype.model="_need_to_be_defined_",i.prototype.sortBy="name",i.prototype.order="ASC",i.prototype.insertPosition="after",i.prototype.globalRerender=!0,i.prototype.release=function(){if(this.subscribeId)return App[this.model].unsubscribe(this.subscribeId)},i.prototype.uIRunner=function(){var t,e;if(this.queue[0]&&!this.queueRunning){for(this.queueRunning=!0,e=[];;){if("domChange"===(t=this.queue.shift())[0]?this.domChange(t[1]):"domRemove"===t[0]?this.domRemove(t[1]):"change"===t[0]?this.collectionSync(t[1]):"destroy"===t[0]?this.collectionSync(t[1],"destroy"):"renderAll"===t[0]?this.renderAll():this.log("error","Unknown type "+t[0],t[1]),!this.queue[0]){this.onRenderEnd(),this.queueRunning=!1;break}e.push(void 0)}return e}},i.prototype.collectionOrderGet=function(){var t,e,n,i,s;for(s=[],e=0,i=(t=this.itemsAll()).length;e<i;e++)n=t[e],s.push(n[this.uniqKey]);return s},i.prototype.collectionOrderSet=function(t){return null==t&&(t=!1),t||(t=this.collectionOrderGet()),this.lastOrder=t},i.prototype.collectionSync=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k;if("destroy"===e){for(l=[],o=0,f=t.length;o<f;o++)c=t[o],l.push(c[this.uniqKey]);return this.queue.push(["domRemove",l]),void this.uIRunner()}if(_.isEmpty(this.renderList))return this.queue.push(["renderAll"]),void this.uIRunner();if(b=this.collectionOrderGet(),k=_.difference(this.lastOrder,b),n=_.difference(b,this.lastOrder),this.log("debug","collectionSync removedIds",k),this.log("debug","collectionSync addedIds",n),this.log("debug","collectionSync @lastOrder",this.lastOrder),this.log("debug","collectionSync newOrder",b),i=!1,!_.isEmpty(n)){for(d=[],u=0,m=(w=this.lastOrder).length;u<m;u++)a=w[u],_.contains(k,a)||d.push(a);if(this.log("debug","collectionSync lastOrderNew",d),r=App.Utils.diffPositionAdd(d,b),this.log("debug","collectionSync applyOrder",r),!r)return this.queue.push(["renderAll"]),void this.uIRunner();for(_.isEmpty(k)||(i=!0,this.queue.push(["domRemove",k]),this.uIRunner()),y=[],p=0,g=r.length;p<g;p++)s=r[p],(c=this.itemGet(s.id)).meta_position=s.position,y.push(c);this.queue.push(["domChange",y]),this.uIRunner()}for(i||_.isEmpty(k)||(this.queue.push(["domRemove",k]),this.uIRunner()),y=[],h=0,v=t.length;h<v;h++)c=t[h],_.contains(k,c.id)||_.contains(n,c.id)||y.push(c);return _.isEmpty(y)?void 0:(this.queue.push(["domChange",y]),this.uIRunner())},i.prototype.domRemove=function(t){var e,n,i;for(this.log("debug","domRemove",t),e=0,i=t.length;e<i;e++)n=t[e],this.itemAttributesDelete(n),this.renderList[n]&&(this.renderList[n].remove(),delete this.renderList[n]),this.onRemoved(n);return this.collectionOrderSet()},i.prototype.domChange=function(t){var e,n,i,s,r,o,a,l;for(this.log("debug","domChange items",t),this.log("debug","domChange @currentItems",this.currentItems),n=[],o=0,l=t.length;o<l;o++)if(a=t[o],this.log("debug","domChange|item",a),e=this.itemAttributes(a),i=this.itemAttributesGet(a[this.uniqKey])){for(r in this.log("debug","domChange|change",a),this.log("debug","domChange|change|observe attributes",this.observe),this.log("debug","domChange|change|current",i),this.log("debug","domChange|change|new",e),this.observe)if(this.log("debug","domChange|change|compare",r,i[r],e[r]),s=!_.isEqual(i[r],e[r]),this.log("debug","domChange|diff",s),s){n.push(a),this.itemAttributesSet(a[this.uniqKey],e);break}}else this.log("debug","domChange|add",a),n.push(a),this.itemAttributesSet(a[this.uniqKey],e);if(!_.isEmpty(n))return this.renderParts(n)},i.prototype.renderAll=function(){var t,e,n,i,s,r;for(i=this.itemsAll(),this.log("debug","renderAll",i),r=[],e=0,s=i.length;e<s;e++)n=i[e],t=this.itemAttributes(n),this.itemAttributesSet(n[this.uniqKey],t),r.push(this.renderItem(n,!1));return this.html(r),this.collectionOrderSet(),this.onRenderEnd()},i.prototype.itemDestroy=function(t){return App[this.model].destroy(t)},i.prototype.itemsAll=function(){return App[this.model].search({sortBy:this.sortBy,order:this.order})},i.prototype.itemAttributesDiff=function(t){var e,n,i,s;for(s in e=this.itemAttributes(t),n=this.itemAttributesGet(t[this.uniqKey]),this.observe)if(this.log("debug","itemAttributesDiff|compare",s,n[s],e[s]),i=!_.isEqual(n[s],e[s]))return this.log("debug","itemAttributesDiff|diff",i),!0;return!1},i.prototype.itemAttributesDelete=function(t){return delete this.currentItems[t]},i.prototype.itemAttributesGet=function(t){return this.currentItems[t]},i.prototype.itemAttributesSet=function(t,e){return this.currentItems[t]=e},i.prototype.itemAttributes=function(t){var e,n;for(n in e={},this.observe)e[n]=t[n];return e},i.prototype.itemGet=function(t){return App[this.model].find(t)},i.prototype.renderParts=function(t){var e,n,i;for(this.log("debug","renderParts",t),e=0,i=t.length;e<i;e++)n=t[e],this.renderList[n[this.uniqKey]]?this.renderItem(n,this.renderList[n[this.uniqKey]]):this.renderItem(n);return this.collectionOrderSet()},i.prototype.renderItem=function(t,e){var n,i,s,r;return this.prepareForObjectListItemSupport&&(t=this.prepareForObjectListItem(t)),this.log("debug","renderItem",t,this.template,e,this.renderList[t[this.uniqKey]]),i=$(App.view(this.template)({item:t})),this.onRenderItemEnd&&this.onRenderItemEnd(t,i),s=Object.keys(this.renderList).length,this.renderList[t[this.uniqKey]]=i,!1===e?i:e?e.replaceWith(i):(s>(r=t.meta_position)&&(r+=1),(n=this.el.find(".js-item:nth-child("+r+")")).get(0)?"before"===this.insertPosition?n.before(i):n.after(i):void this.el.append(i))},i.prototype.onRenderEnd=function(){},i.prototype.location=function(t){return this.locationVerify(t)},i.prototype.click=function(t){var e;return e=$(t.target).closest(".js-item").data("id"),this.onClick(e,t)},i.prototype.onClick=function(){},i.prototype.remove=function(t){var e;return t.preventDefault(),t.stopPropagation(),e=$(t.target).closest(".js-item").data("id"),this.onRemove(e,t),this.itemDestroy(e)},i.prototype.onRemove=function(){},i.prototype.onRemoved=function(){},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ControllerDrox=function(e){function n(t){n.__super__.constructor.apply(this,arguments),t.data&&(t.data.text||t.data.html)&&this.inline(t.data)}return t(n,e),n.prototype.inline=function(t){if(this.html(App.view("generic/drox")(t)),t.text&&this.$(".drox-body").text(t.text),t.html)return this.$(".drox-body").html(t.html)},n.prototype.template=function(t){var e,n;return n=$(App.view("generic/drox")(t)),e=App.view(t.file)(t.params),n.find(".drox-body").append(e),n},n}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerForm=function(n){function i(e){var n,s,r;for(n in this.formGen=t(this.formGen,this),this.html=t(this.html,this),this.hideAlert=t(this.hideAlert,this),this.showAlert=t(this.showAlert,this),this.dispatchHandlers=t(this.dispatchHandlers,this),i.__super__.constructor.apply(this,arguments),e)r=e[n],this[n]=r;if(this.flags={},this.handlers?this.handlers.unshift(App.FormHandlerCoreWorkflow.run):this.handlers=[App.FormHandlerCoreWorkflow.run],this.handlersConfig)for(n in s=this.handlersConfig)(r=s[n])&&r.run&&this.handlers.push(r.run);this.model||(this.model={}),this.attributes||(this.attributes=[]),this.idPrefix=Math.floor(999999*Math.random()).toString(),this.model.className&&(this.idPrefix=this.model.className+"_"+this.idPrefix),this.form||(this.form=this.formGen()),this.form.prepend('<div class="alert alert--danger js-danger js-alert hide" role="alert"></div>'),this.form.prepend('<div class="alert alert--success js-success hide" role="alert"></div>'),this.handlers.length&&this.dispatchHandlers(),this.el&&this.el.prepend(this.form),this.elReplace&&this.elReplace.html(this.form),this.form.on("input",this.hideAlert),this.finishForm=!0,this.form}return e(i,n),i.prototype.fullFormSubmitLabel=__("Submit"),i.prototype.fullFormSubmitAdditionalClasses="",i.prototype.fullFormButtonsContainerClass="",i.prototype.fullFormAdditionalButtons=[],i.prototype.runCoreWorkflow=function(t){var e,n;return n=App.ControllerForm.params(this.form),e=Math.floor(999999*Math.random()).toString(),App.FormHandlerCoreWorkflow.run(n,t,this.attributes,this.idPrefix,this.form,this,e)},i.prototype.dispatchHandlers=function(){var t,e,n,i,s,r,o,a;for(r=App.ControllerForm.params(this.form),e=Math.floor(999999*Math.random()).toString(),a=[],i=0,s=(o=this.attributes).length;i<s;i++)t=o[i],a.push(function(){var i,s,o,a;for(a=[],i=0,s=(o=this.handlers).length;i<s;i++)n=o[i],a.push(n(r,t,this.attributes,this.idPrefix,this.form,this,e));return a}.call(this));return a},i.prototype.showAlert=function(t){var e;return e=Array.isArray(t)?App.i18n.translateInline(t[0],t.slice(1)):App.i18n.translateInline(t),this.form.find(".alert--danger").first().removeClass("hide").html(e)},i.prototype.hideAlert=function(){return this.form.find(".alert--danger").addClass("hide").html()},i.prototype.html=function(){return this.form.html()},i.prototype.formGen=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v;if(App.Log.debug("ControllerForm","formGen",this.model.configure_attributes),l=this.noFieldset||this.grid?this.el:$("<fieldset></fieldset>"),_.isEmpty(this.model))return l;for(n in this.attributes=[],i=this.mixedAttributes?this.mixedAttributes:this.model.attributesGet?this.model.attributesGet(this.screen):App.Model.attributesGet(this.screen,this.model.configure_attributes,void 0,this.model.className))(t=i[n]).readonly||t.skipRendering||(this.filter&&!t.filter&&this.filter[n]&&(t.filter=this.filter[n]),this.attributes.push(t));for(e=0,u=0,d=(m=this.attributes).length;u<d;u++)t=m[u],e+=1,!0===this.isDisabled&&(t.disabled=!0),"email"===t.type&&(t.input_type="text"),p=this.formGenItem(t,this.idPrefix,l,e),t.renderTarget?p.appendTo(this.el.find(t.renderTarget)):p.appendTo(l),"password"===t.type&&(this.params&&t.name in this.params&&(t.value=this.params[t.name]),t.single||(t.display=App.i18n.translateContent("%s (confirm)",App.i18n.translateContent(t.display)),t.name=t.name+"_confirm",p=this.formGenItem(t,this.idPrefix,l,e),t.renderTarget?p.appendTo(this.el.find(t.renderTarget)):p.appendTo(l)));if(this.fullForm){for(this.formClass||(this.formClass=""),l=$("<form class='form "+this.formClass+"' autocomplete='off'>").prepend(l),o=$("<div class='form-buttons "+this.fullFormButtonsContainerClass+"'>"),h=0,f=(g=this.fullFormAdditionalButtons).length;h<f;h++)r=g[h],s=$("<button class='btn "+r.className+"'>").text(r.text),r.disabled&&s.prop("disabled",!0),o.append(s);$("<button type=submit class='btn "+this.fullFormSubmitAdditionalClasses+"' value=\""+this.fullFormSubmitLabel+'"></button>').text(App.i18n.translateContent(this.fullFormSubmitLabel)).appendTo(o),o.appendTo(l)}if(this.events)for(a in c=function(t,e){var n;return n=t.split(" "),l.find(n[1]).on(n[0],(function(t){return e(t)}))},v=this.events)c(a,v[a]);return l.find(".js-helpMessage").tooltip(),l},i.prototype.formGenItem=function(t,e,n,i){var s,r,o,a,l,c,u,p,h,d;if((s=clone(t,!0)).id=e+"_"+s.name,s.label_class=this.model.labelClass||s.label_class,this.autofocus&&1===i&&(s.autofocus="autofocus"),!0===s.required&&(s.null=!1),s.null?s.required="":s.required="required",void 0===s.autocapitalize||s.autocapitalize?s.autocapitalize="":s.autocapitalize='autocapitalize="off"',void 0===s.autocomplete?"hidden"===s.type?s.autocomplete="":s.autocomplete='autocomplete="off"':s.autocomplete='autocomplete="'+s.autocomplete+'"',void 0===s.value&&"default"in s&&!(null!=(h=this.params)?h.id:void 0)&&(s.value=s.default),this.params&&((u=s.name.split("::")).length>1&&void 0!==(r=u.reduce((function(t,e){return null!=t?t[e]:void 0}),this.params))&&(s.value=r),s.name in this.params&&(s.value=this.params[s.name])),"newValue"in s&&(s.value=s.newValue),App.Log.debug("ControllerForm","formGenItem-before",s),!App.UiElement[s.tag])throw"Invalid UiElement."+s.tag;return a=App.UiElement[s.tag].render(s,this.params,this),this.handlers&&(l=a,c="change",a.find(".richtext-content").length>0&&(l=a.find(".richtext-content"),c="blur"),l.on(c,(d=this,function(t,i){var r,o,a,l,c,u,p;for(d.lastChangedAttribute=s.name,c=App.ControllerForm.params(d.form),r=Math.floor(999999*Math.random()).toString(),p=[],a=0,l=(u=d.handlers).length;a<l;a++)o=u[a],_.isObject(i)&&i.skip_core_worfklow&&o===App.FormHandlerCoreWorkflow.run||p.push(o(c,s,d.attributes,e,n,d,r));return p}))),!s.display||s.transparent?a:(p={},!this.model.className||!this.params||"url"!==s.type&&_.isEmpty(s.linktemplate)||_.isEmpty(this.params[s.name])||((p={attribute:s,session:App.Session.get(),config:App.Config.all()})[this.model.className.toLowerCase()]=this.params),(o=$(App.view("generic/attribute")({attribute:s,item:"",bookmarkable:this.bookmarkable,placeholderObjects:p,className:this.model.className}))).find(".controls").prepend(a),s.hide&&this.hide(s.name,o),o)},i.prototype.getFlag=function(t){return this.flags[t]},i.prototype.setFlag=function(t,e){return this.flags[t]=e},i.findFieldByName=function(t,e){return e.find('[name="'+t+'"]')},i.findFieldByData=function(t,e){return e.find('[data-name="'+t+'"]')},i.findFieldByGroup=function(t,e){return e.data("attributeName")===t?e:e.find('.form-group[data-attribute-name="'+t+'"]')},i.fieldIsShown=function(t){return!t.closest(".form-group").hasClass("is-hidden")},i.fieldIsMandatory=function(t){return t.closest(".form-group").hasClass("is-required")},i.fieldIsRemoved=function(t){return t.closest(".form-group").hasClass("is-removed")},i.fieldIsReadonly=function(t){return t.closest(".form-group").hasClass("is-readonly")},i.prototype.attributeIsMandatory=function(t){var e,n;return(n=this.constructor.findFieldByName(t,this.form)).length>0?this.constructor.fieldIsMandatory(n):(e=this.constructor.findFieldByData(t,this.form)).length>0&&this.constructor.fieldIsMandatory(e)},i.prototype.show=function(t,e){var n,i,s,r;for(null==e&&(e=this.form),_.isArray(t)||(t=[t]),i=0,r=t.length;i<r;i++)s=t[i],(n=this.constructor.findFieldByGroup(s,e)).removeClass("hide"),n.removeClass("is-hidden"),n.removeClass("is-removed");if(e)return e.find(".has-error").removeClass("has-error"),e.find(".help-inline").html("")},i.prototype.hide=function(t,e,n){var i,s,r,o,a;for(null==e&&(e=this.form),null==n&&(n=!1),_.isArray(t)||(t=[t]),a=[],s=0,o=t.length;s<o;s++)r=t[s],(i=this.constructor.findFieldByGroup(r,e)).addClass("hide"),i.addClass("is-hidden"),n?a.push(i.addClass("is-removed")):a.push(void 0);return a},i.prototype.mandantory=function(t,e){var n,i,s,r,o,a;for(null==e&&(e=this.form),_.isArray(t)||(t=[t]),a=[],s=0,o=t.length;s<o;s++)r=t[s],i=this.constructor.findFieldByName(r,e),n=this.constructor.findFieldByData(r,e),this.constructor.fieldIsMandatory(i)||(i.attr("required",!0),i.closest(".form-group").find("label span").html("*"),i.closest(".form-group").addClass("is-required")),this.constructor.fieldIsMandatory(n)?a.push(void 0):(n.attr("required",!0),n.closest(".form-group").find("label span").html("*"),a.push(n.closest(".form-group").addClass("is-required")));return a},i.prototype.optional=function(t,e){var n,i,s,r,o,a;for(null==e&&(e=this.form),_.isArray(t)||(t=[t]),a=[],s=0,o=t.length;s<o;s++)r=t[s],i=this.constructor.findFieldByName(r,e),n=this.constructor.findFieldByData(r,e),this.constructor.fieldIsMandatory(i)&&(i.attr("required",!1),i.closest(".form-group").find("label span").html(""),i.closest(".form-group").removeClass("is-required")),this.constructor.fieldIsMandatory(n)?(n.attr("required",!1),n.closest(".form-group").find("label span").html(""),a.push(n.closest(".form-group").removeClass("is-required"))):a.push(void 0);return a},i.prototype.readonly=function(t,e){var n,i,s,r,o,a;for(null==e&&(e=this.form),_.isArray(t)||(t=[t]),a=[],s=0,o=t.length;s<o;s++)r=t[s],i=this.constructor.findFieldByName(r,e),n=this.constructor.findFieldByData(r,e),this.constructor.fieldIsReadonly(i)||(i.closest(".form-group").find("input, select, textarea, .form-control").attr("readonly",!0),i.closest(".form-group").find("input[type=file]").attr("disabled",!0),i.closest(".form-group").addClass("is-readonly")),this.constructor.fieldIsReadonly(n)?a.push(void 0):(n.closest(".form-group").find("input, select, textarea, .form-control").attr("readonly",!0),n.closest(".form-group").find("input[type=file]").attr("disabled",!0),a.push(n.closest(".form-group").addClass("is-readonly")));return a},i.prototype.changeable=function(t,e){var n,i,s,r,o,a;for(null==e&&(e=this.form),_.isArray(t)||(t=[t]),a=[],s=0,o=t.length;s<o;s++)r=t[s],i=this.constructor.findFieldByName(r,e),n=this.constructor.findFieldByData(r,e),this.constructor.fieldIsReadonly(i)&&(i.closest(".form-group").find("input, select, textarea, .form-control").attr("readonly",!1),i.closest(".form-group").find("input[type=file]").attr("disabled",!1),i.closest(".form-group").removeClass("is-readonly")),this.constructor.fieldIsReadonly(n)?(n.closest(".form-group").find("input, select, textarea, .form-control").attr("readonly",!1),n.closest(".form-group").find("input[type=file]").attr("disabled",!1),a.push(n.closest(".form-group").removeClass("is-readonly"))):a.push(void 0);return a},i.prototype.validate=function(t){return App.Model.validate({model:this.model,params:t,controllerForm:this})},i.params=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S,x;for(null==e&&(e=!1),b={},m=this.findForm(t),e&&m.find(".richtext.form-control").trigger("click"),l=0,d=(A=m.find("[contenteditable]")).length;l<d;l++)s=A[l],(g=$(s).data("name"))&&(b[g]=$(s).ceg());for(p=0,f=(n=m.serializeArrayWithType()).length;p<f;p++)u=n[p],o=this.findFieldByName(u.name,m),this.fieldIsRemoved(o)?delete b[u.name]:(o.get(0).hasAttribute("data-value")&&(u.value=o.get(0).getAttribute("data-value")),x=u.value,u.value&&(x=u.value.trim()),"boolean"===u.type&&(""===x?x=void 0:void 0===x?x=!1:"true"===x?x=!0:"false"===x&&(x=!1)),"integer"===u.type&&(x=""===x?null:parseInt(x)),void 0!==b[u.name]?"string"==typeof b[u.name]||"boolean"==typeof b[u.name]||"number"==typeof b[u.name]?b[u.name]=[b[u.name],x]:b[u.name].push(x):u.multiple?(b[u.name]=[],"string"==typeof x&&b[u.name].push(x)):b[u.name]=x);for(h in S={},m.find("input[type=checkbox]").each((function(){var t,e;return e=$(this).data("field-type"),t=$(this).prop("checked"),!(g=$(this).attr("name"))||t||g in b||(S[g]=g in S?[]:"boolean"!==e&&void 0),!0})),m.find("input[type=radio]").each((function(){var t,e;return e=$(this).data("field-type"),t=$(this).prop("checked"),!(g=$(this).attr("name"))||t||g in b||(S[g]="boolean"!==e&&void 0),!0})),S)x=S[h],h in b||(b[h]=x);for(h in b)if("{date}"===h.substr(0,6)){if(v=h.substr(6,h.length),m.find('[data-name="'+v+'"]').hasClass("is-removed"))b[v]=null;else if(b[h])try{if(T=new Date(Date.parse(b[h]+"T00:00:00Z")),a=function(t){return parseInt(t)<10&&(t="0"+t),t},"Invalid Date"===T)throw"Invalid Date "+b[h];b[v]=T.getUTCFullYear()+"-"+a(T.getUTCMonth()+1)+"-"+a(T.getUTCDate())}catch(t){r=t,b[v]="invalid "+b[h],console.log("ERR",r)}else b[v]=null;delete b[h]}else if("{datetime}"===h.substr(0,10)){if(v=h.substr(10,h.length),m.find('[data-name="'+v+'"]').hasClass("is-removed"))b[v]=null;else if(b[h])try{if("Invalid Datetime"===(T=new Date(Date.parse(b[h]))))throw"Invalid Datetime "+b[h];b[v]=T.toISOString().replace(/:\d\d\.\d\d\dZ$/,":00.000Z")}catch(t){r=t,b[v]="invalid "+b[h],console.log("ERR",r)}else b[v]=null;delete b[h]}else if("{json}"===h.substr(0,6)){if(v=h.substr(6),b[h])try{b[v]=JSON.parse(b[h])}catch(t){r=t,b[v]="invalid "+h,console.log("ERR",r)}else b[v]=null;delete b[h]}for(h in c={},b)if((w=h.split("::"))[0]&&void 0!==w[1]){if(void 0!==w[1]&&!c[w[0]]&&(c[w[0]]={},""===w[1])){delete b[h];continue}void 0===w[2]||c[w[0]][w[1]]||(c[w[0]][w[1]]={}),void 0===w[3]||c[w[0]][w[1]][w[2]]||(c[w[0]][w[1]][w[2]]={}),void 0!==w[3]?(c[w[0]][w[1]][w[2]][w[3]]=b[h],delete b[h]):void 0!==w[2]?(c[w[0]][w[1]][w[2]]=b[h],delete b[h]):void 0!==w[1]&&(c[w[0]][w[1]]=b[h],delete b[h])}for(h in c)b[h]=c[h];for(h in b)if("{business_hours}"===h.substr(0,16)){if(v=h.substr(16,h.length),m.find('[data-name="'+v+'"]').hasClass("is-removed"))b[v]=null;else if(b[h]){for(i in y={},C=b[h])if(x=C[i],y[i]={},y[i].active=!1,"true"===x.active&&(y[i].active=!0),y[i].timeframes=[],_.isArray(x.start))for(k in x.start)y[i].timeframes.push([x.start[k],x.end[k]]);else y[i].timeframes.push([x.start,x.end]);b[v]=y}else b[v]=void 0;delete b[h]}return App.Log.debug("ControllerForm","formParam",t,b),b},i.formId=function(){var t;return(t=(new Date).getTime()+Math.floor(99999*Math.random())).toString().substr(t.toString().length-9,9)},i.findForm=function(t){return t&&t.target&&(t=t.target),t instanceof jQuery||(t=$(t)),!0===t.is("form")?t:!0===t.find("form").is("form")?t.find("form"):!0===$(t).closest("form").is("form")?t.closest("form"):this.finishForm?(App.Log.error("ControllerForm","no form found!",t),t):t},i.disable=function(t,e){var n;return null==e&&(e="form"),(n=this.findForm(t))&&"form"===e?n.is("button, input, select, textarea, div, span")?(App.Log.debug("ControllerForm","disable item...",n),n.prop("readonly",!0),void n.prop("disabled",!0)):(App.Log.debug("ControllerForm","disable form...",n),n.find("button, input, select, textarea, .form-control").prop("readonly",!0),n.find("input[type=checkbox], input[type=radio], input[type=file]").prop("disabled",!0),n.find("button").prop("disabled",!0)):(App.Log.debug("ControllerForm","disable item...",t),t.prop("readonly",!0),t.prop("disabled",!0))},i.enable=function(t,e){var n;return null==e&&(e="form"),(n=this.findForm(t))&&"form"===e?n.is("button, input, select, textarea, div, span")?(App.Log.debug("ControllerForm","disable item...",n),n.prop("readonly",!1),void n.prop("disabled",!1)):(App.Log.debug("ControllerForm","enable form...",n),n.find("button, input, select, textarea, .form-control").prop("readonly",!1),n.find("input[type=checkbox], input[type=radio], input[type=file]").prop("disabled",!1),n.find("button").prop("disabled",!1)):(App.Log.debug("ControllerForm","enable item...",t),t.prop("readonly",!1),t.prop("disabled",!1))},i.validate=function(t){var e,n,i,s,r,o;if(!t.errors||1!==Object.keys(t.errors).length||void 0===t.errors._core_workflow){for(i in(s=this.findForm(t.form)).find(".has-error").removeClass("has-error"),s.find(".help-inline").html(""),o=t.errors)r=o[i],r=App.i18n.translatePlain(r),(e=s.find('[name="'+i+'"]').closest(".form-group")).addClass("has-error"),e.find(".help-inline").html(r),(n=s.find('[data-name="'+i+'"]').closest(".form-group")).addClass("has-error"),n.find(".help-inline").html(r),(e=s.find('[name="'+i+'"]').closest(".form-control")).trigger("validate"),(n=s.find('[data-name="'+i+'"]').closest(".form-control")).trigger("validate");return App.Delay.set((function(){var t;return null!=(t=s.find(".has-error").get(0))?t.scrollIntoView(!0):void 0}),200,"validate")}App.FormHandlerCoreWorkflow.delaySubmit(t.errors._core_workflow.controllerForm,t.errors._core_workflow.target||t.form)},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerFullPage=function(n){function i(e){
this.replaceWith=t(this.replaceWith,this),this.requiredPermission&&this.permissionCheckRedirect(this.requiredPermission),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.replaceWith=function(t){var e;return this.className&&this.appEl.find(">").not("."+this.className).remove(),this.forceRender&&this.appEl.find(">").filter("."+this.className).remove(),(e=this.appEl.find(">").filter("."+this.className)).get(0)?(this.el=e,e.html($(t).children())):(this.el=$(t),this.el.addClass(this.className),this.appEl.append(this.el),this.delegateEvents(this.events),this.refreshElements(),this.el.on("remove",this.releaseController),this.el.on("remove",this.release))},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerModalLoading=function(n){function i(){var e;this.hide=t(this.hide,this),this.localOnClosed=t(this.localOnClosed,this),this.showIcon=t(this.showIcon,this),this.hideIcon=t(this.hideIcon,this),this.update=t(this.update,this),i.__super__.constructor.apply(this,arguments),this.container&&this.el.addClass("modal--local"),this.render(),this.el.modal({keyboard:!1,show:!0,backdrop:"static",container:this.container}).on({"hidden.bs.modal":this.localOnClosed,"shown.bs.modal":(e=this,function(){return e.el.addClass("modal--ready")})})}return e(i,n),i.prototype.className="modal fade",i.prototype.showTrySupport=!0,i.prototype.render=function(){return this.html(App.view("generic/modal_loader")({head:this.head,message:App.i18n.translateContent(this.message)}))},i.prototype.update=function(t,e){return null==e&&(e=!0),e&&(t=App.i18n.translateContent(t)),this.$(".js-loading").html(t)},i.prototype.hideIcon=function(){return this.$(".js-loadingIcon").addClass("hide")},i.prototype.showIcon=function(){return this.$(".js-loadingIcon").removeClass("hide")},i.prototype.localOnClosed=function(){return this.el.remove()},i.prototype.hide=function(t){var e,n;if(n=this,e=function(){return n.el.modal("hide")},t)return App.Delay.set(e,1e3*t);e()},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerNavSidbar=function(n){function i(e){var n;this.currentPosition=t(this.currentPosition,this),this.setPosition=t(this.setPosition,this),this.executeController=t(this.executeController,this),this.selectedItem=t(this.selectedItem,this),this.groupsSorted=t(this.groupsSorted,this),this.updateNavigation=t(this.updateNavigation,this),this.render=t(this.render,this),this.hide=t(this.hide,this),this.show=t(this.show,this),i.__super__.constructor.apply(this,arguments),this.authenticateRequired&&this.authenticateCheckRedirect(),this.render(!0),this.controllerBind("ui:rerender",(n=this,function(){return n.render(!0),n.updateNavigation(!0,e)}))}return e(i,n),i.prototype.show=function(t){var e,n;if(null==t&&(t={}),this.navupdate(""),this.shown=!0,t)for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);if(this.updateNavigation(!1,t),this.activeController&&_.isFunction(this.activeController.show))return this.activeController.show(t)},i.prototype.hide=function(){if(this.shown=!1,this.activeController&&_.isFunction(this.activeController.hide))return this.activeController.hide()},i.prototype.render=function(t){var e,n;return null==t&&(t=!1),e=this.groupsSorted(),n=this.selectedItem(e),this.html(App.view("generic/navbar_level2/index")({className:this.configKey})),this.$(".sidebar").html(App.view("generic/navbar_level2/navbar")({groups:e,className:this.configKey,selectedItem:n}))},i.prototype.updateNavigation=function(t,e){var n,i;if(n=this.groupsSorted(),(i=this.selectedItem(n))&&(t||!this.lastTarget||i.target!==this.lastTarget))return this.lastTarget=i.target,this.$(".sidebar li").removeClass("active"),this.$('.sidebar li a[href="'+i.target+'"]').parent().addClass("active"),this.executeController(i,e)},i.prototype.groupsSorted=function(){var t,e,n,i,s,r,o,a,l;for(s in e=[],t=App.Config.get(this.configKey))if(!(i=t[s]).controller)if(i.permission)if(o=!1,"function"==typeof i.permission)(o=i.permission(this))&&e.push(i);else for(n=0,r=(l=i.permission).length;n<r;n++)a=l[n],!o&&this.permissionCheck(a)&&(o=!0,e.push(i));else e.push(i);return _.sortBy(e,(function(t){return t.prio}))},i.prototype.selectedItem=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C;for(n=0,u=t.length;n<u;n++){for(l in e=t[n],r=[],s=App.Config.get(this.configKey))if((i=s[l]).parent===e.target&&i.controller)if(i.permission)if(v=!1,"function"==typeof i.permission)(v=i.permission(this))&&r.push(i);else for(o=0,p=(w=i.permission).length;o<p;o++)b=w[o],!v&&this.permissionCheck(b)&&(v=!0,r.push(i));else r.push(i);e.items=_.sortBy(r,(function(t){return t.prio}))}for(C=void 0,a=0,h=t.length;a<h;a++)if((e=t[a]).items)for(c=0,d=(k=e.items).length;c<d;c++)(i=k[c]).target.match("/"+this.target+"$")?(i.active=!0,C=i):i.active=!1;if(!C)for(g=0,f=t.length;g<f&&(e=t[g],!C);g++)if(e.items)for(y=0,m=(A=e.items).length;y<m;y++){(i=A[y]).active=!0,C=i;break}return C},i.prototype.executeController=function(t,e){return this.activeController&&(this.activeController.el.remove(),this.activeController=void 0),this.$(".main").append("<div>"),this.activeController=new t.controller(_.extend(e,{el:this.$(".main div")}))},i.prototype.setPosition=function(t){if(!this.shown&&t)return t.main&&this.$(".main").scrollTop(t.main),t.sidebar?this.$(".sidebar").scrollTop(t.sidebar):void 0},i.prototype.currentPosition=function(){return{main:this.$(".main").scrollTop(),sidebar:this.$(".sidebar").scrollTop()}},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerObserver=function(n){function i(){var e;this.release=t(this.release,this),this.render=t(this.render,this),this.hasChanged=t(this.hasChanged,this),this.maybeRender=t(this.maybeRender,this),this.subscribe=t(this.subscribe,this),i.__super__.constructor.apply(this,arguments),this.log("debug","new",this.object_id,this.model),App[this.model].exists(this.object_id)?this.maybeRender(App[this.model].fullLocal(this.object_id)):App[this.model].full(this.object_id,this.maybeRender),this.globalRerender&&(this.rerenderCallback=(e=this,function(){return e.lastAttributes=void 0,e.maybeRender(App[e.model].fullLocal(e.object_id))}),this.controllerBind("ui:rerender",this.rerenderCallback))}return e(i,n),i.prototype.model="Ticket",i.prototype.template="tba",i.prototype.globalRerender=!0,i.prototype.lastAttributes=void 0,i.prototype.subscribe=function(t,e){return this.maybeRender(t,e)},i.prototype.maybeRender=function(t,e){return"remove"===e?(this.release(),void this.el.remove()):(this.log("debug","maybeRender",this.object_id,t,this.model),this.subscribeId||(this.subscribeId=t.subscribe(this.subscribe)),this.hasChanged(t)?this.render(t):void 0)},i.prototype.hasChanged=function(t){var e,n,i,s,r,o;if(e={},s=$.extend(!0,{},t),this.observe)for(i in r=this.observe)r[i]&&!_.isFunction(o)&&(e[i]=s[i]);if(this.observeNot)for(i in s)o=s[i],"cid"===i||this.observeNot[i]||_.isFunction(o)||(e[i]=o);return this.lastAttributes?(n=difference(e,this.lastAttributes),_.isEmpty(n)?(this.log("debug","maybeRender no diff, no rerender"),!1):(this.log("debug","maybeRender.diff",n,this.observe,this.model),this.lastAttributes=e,!0)):(this.lastAttributes=e,!0)},i.prototype.render=function(t){if(this.log("debug","render",this.template,t),this.html(App.view(this.template)({object:t})),this.renderPost)return this.renderPost(t)},i.prototype.release=function(){return this.log("debug","release",this.object_id,this.model,this.subscribeId),App[this.model].unsubscribe(this.subscribeId)},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerObserverActionRow=function(n){function i(){this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.render=function(t){var e,n,i,s,r;if(!_.isEmpty(t)){for(e=this.actions(t),this.html(App.view("generic/actions")({items:e,type:this.type})),r=[],n=0,s=e.length;n<s;n++)i=e[n],r.push(function(e){return function(n){return e.$('[data-type="'+n.name+'"]').on("click",(function(e){return e.preventDefault(),n.callback(t)}))}}(this)(i));return r}},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ControllerPermanent=function(e){function n(){this.requiredPermission&&this.permissionCheckRedirect(this.requiredPermission,!0),n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ControllerReorderModal=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.head=__("Drag to reorder"),n.prototype.content=function(){var t,e;return e=$(App.view("reorder_modal")()),t=new App.ControllerTable({pager:!1,baseColWidth:null,dndCallback:function(){return!0},overview:["title"],attribute_list:[{name:"title",display:__("Name")}],objects:this.items}),e.find(".js-table-container").html(t.el),e},n.prototype.onShown=function(){return n.__super__.onShown.apply(this,arguments),this.$(".js-submit").trigger("focus")},n.prototype.save=function(){var t,e;return t=this.$("tr.item").toArray().map((function(t){return parseInt(t.dataset.id)})),this.$(".alert").addClass("hidden"),this.formDisable(this.el),this.ajax({id:"reorder_save",type:"PATCH",data:JSON.stringify({ordered_ids:t}),url:this.url,processData:!0,success:(e=this,function(t){return App.Collection.loadAssets(t),App.Event.trigger("knowledge_base::sidebar::rerender"),e.close()}),error:function(t){return function(e){var n;return n=JSON.parse(e.responseText),t.$(".alert--danger").removeClass("hidden").text(n.error),t.formEnable(t.el)}}(this)})},n.prototype.onSubmit=function(){return n.__super__.onSubmit.apply(this,arguments),this.save()},n}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerSubContent=function(n){function i(){this.hide=t(this.hide,this),this.show=t(this.show,this),this.requiredPermission&&this.permissionCheckRedirect(this.requiredPermission),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.show=function(){if(this.genericController&&this.genericController.show&&this.genericController.show(),this.header)return this.title(this.header,!0)},i.prototype.hide=function(){if(this.genericController&&this.genericController.hide)return this.genericController.hide()},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty,i=[].slice;App.ControllerTable=function(n){function s(){var e,n,i,r,o;if(this.getBulkSelected=t(this.getBulkSelected,this),this.preferencesStoreKey=t(this.preferencesStoreKey,this),this.preferencesGet=t(this.preferencesGet,this),this.sortByColumn=t(this.sortByColumn,this),this.onColResizeEnd=t(this.onColResizeEnd,this),this.onColResizeMove=t(this.onColResizeMove,this),this.onColResizeStart=t(this.onColResizeStart,this),this.onResize=t(this.onResize,this),this.setHeaderWidths=t(this.setHeaderWidths,this),this.toggleActionDropdown=t(this.toggleActionDropdown,this),this.runAction=t(this.runAction,this),this.onActionButtonClicked=t(this.onActionButtonClicked,this),this.sortList=t(this.sortList,this),this.paginate=t(this.paginate,this),this.objectsOfPage=t(this.objectsOfPage,this),this.setMaxPage=t(this.setMaxPage,this),this.tableHeaders=t(this.tableHeaders,this),this.tableHeadersHasChanged=t(this.tableHeadersHasChanged,this),this.renderTableRow=t(this.renderTableRow,this),this.renderTableGroupByRow=t(this.renderTableGroupByRow,this),this.renderTableRows=t(this.renderTableRows,this),this.renderTableContainer=t(this.renderTableContainer,this),this.renderTableFull=t(this.renderTableFull,this),this.renderEmptyList=t(this.renderEmptyList,this),this.render=t(this.render,this),this.renderPagerStatic=t(this.renderPagerStatic,this),this.renderPagerAjax=t(this.renderPagerAjax,this),this.renderPager=t(this.renderPager,this),this.renderQueue=t(this.renderQueue,this),this.update=t(this.update,this),this.release=t(this.release,this),this.show=t(this.show,this),s.__super__.constructor.apply(this,arguments),this.model||(this.model={}),this.overviewAttributes||(this.overviewAttributes=this.overview||this.model.configure_overview||[]),this.attributesListRaw||(this.attributesListRaw=this.attribute_list||this.model.configure_attributes||{}),this.attributesList=App.Model.attributesGet(!1,this.attributesListRaw),this.destroy=_.isNull(this.destroy)||_.isUndefined(this.destroy)?this.model.configure_delete:this.destroy,this.clone=_.isNull(this.clone)||_.isUndefined(this.clone)?this.model.configure_clone:this.clone,this.setAsDefault=this.model.configure_set_as_default,this.unsetDefault=this.model.configure_unset_default,_.isEmpty(this.overviewAttributes))throw"overviewAttributes needed";if(_.isEmpty(this.attributesList))throw"attributesList needed";if(e={},this.tableId&&(e=this.preferencesGet()).order)for(n in i=e.order)o=i[n],this[n]=o;if(e.headerWidth)for(n in r=e.headerWidth)o=r[n],this.headerWidth[n]=o;this.availableWidth||(this.availableWidth=this.el.width(),0===this.availableWidth&&(this.availableWidth=this.minTableWidth)),this.renderQueue()}return e(s,n),s.prototype.minColWidth=30,s.prototype.baseColWidth=130,s.prototype.minTableWidth=612,s.prototype.checkBoxColWidth=30,s.prototype.radioColWidth=22,s.prototype.sortableColWidth=36,s.prototype.events={"click .js-sort":"sortByColumn","click .js-page":"paginate"},s.prototype.overviewAttributes=void 0,s.prototype.objects=[],s.prototype.checkbox=!1,s.prototype.radio=!1,s.prototype.renderState=void 0,s.prototype.groupBy=void 0,s.prototype.groupDirection=void 0,s.prototype.pagerEnabled=!0,s.prototype.pagerItemsPerPage=150,s.prototype.pagerShownPage=0,s.prototype.customActions=[],s.prototype.columnsLength=void 0,s.prototype.headers=void 0,s.prototype.headerWidth={},s.prototype.currentRows=[],s.prototype.orderDirection="ASC",s.prototype.orderBy=void 0,s.prototype.lastOrderDirection=void 0,s.prototype.lastOrderBy=void 0,s.prototype.lastOverview=void 0,s.prototype.customOrderDirection=void 0,s.prototype.customOrderBy=void 0,s.prototype.frontendTimeUpdateExecute=!0,s.prototype.bindCol={},s.prototype.bindRow={},s.prototype.show=function(){if(!0===this.windowIsResized)return this.windowIsResized=!1,this.onResize()},s.prototype.hide=function(){},s.prototype.release=function(){return $(window).off("resize.table",this.onResize)},s.prototype.update=function(t){var e,n;if(!0===t.sync){for(e in t)n=t[e],this[e]=n;return this.render()}return this.renderQueue(t)},s.prototype.renderQueue=function(t){var e,n;return n=this,e=function(){var e,i;for(e in t)i=t[e],n[e]=i;return n.render()},App.QueueManager.add("tableRender",e),App.QueueManager.run("tableRender")},s.prototype.renderPager=function(t,e){if(null==e&&(e=!1),this.pagerEnabled)return this.pagerAjax?this.renderPagerAjax(t,e):this.renderPagerStatic(t,e)},s.prototype.renderPagerAjax=function(t,e){var n,i;if(null==e&&(e=!1),!((i=parseInt((this.pagerTotalCount-1)/this.pagerPerPage))<1))return n=App.view("generic/table_pager")({page:this.pagerSelected-1,pages:i}),e?t.find(".js-pager").html(n):t.filter(".js-pager").html(n);e?t.find(".js-pager").html(""):t.filter(".js-pager").html("")},s.prototype.renderPagerStatic=function(t,e){var n,i;if(null==e&&(e=!1),!((i=parseInt((this.objects.length-1)/this.pagerItemsPerPage))<1))return n=App.view("generic/table_pager")({page:this.pagerShownPage,pages:i}),e?t.find(".js-pager").html(n):t.filter(".js-pager").html(n);e?t.find(".js-pager").html(""):t.filter(".js-pager").html("")},s.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g;if(this.setMaxPage(),this.pagerTotalCount&&this.renderPager(this.el,!0),void 0===this.renderState)return _.isEmpty(this.objects)?(this.renderState="emptyList",this.el.html(this.renderEmptyList()),$(window).on("resize.table",this.onResize),["emptyList.new"]):(this.renderState="List",this.renderTableFull(),$(window).on("resize.table",this.onResize),["fullRender.new"]);if("emptyList"===this.renderState&&!_.isEmpty(this.objects))return this.renderState="List",this.renderTableFull(),["fullRender"];if("emptyList"!==this.renderState&&_.isEmpty(this.objects))return this.renderState="emptyList",this.el.html(this.renderEmptyList()),["emptyList"];if(this.tableHeadersHasChanged())return this.renderTableFull(),["fullRender.overviewAttributesChanged"];if(c=this.renderTableRows(!0),m=_.difference(this.currentRows,c),e=_.difference(c,this.currentRows),this.log("debug","table newRows",c),this.log("debug","table removedRows",m),this.log("debug","table addedRows",e),(!_.isEmpty(e)||!_.isEmpty(m))&&e.length<10&&m.length<15&&m.length<c.length&&!_.isEmpty(c)){for(l=[],f=[],u=n=0,p=this.currentRows.length-1;0<=p?n<=p:n>=p;u=0<=p?++n:--n)_.contains(m,this.currentRows[u])?f.push(u):l.push(this.currentRows[u]);for(t=[],u=i=0,h=c.length-1;0<=h?i<=h:i>=h;u=0<=h?++i:--i)_.contains(e,c[u])&&(t.push(u),l.splice(u,0,c[u]));if(!0===this._isSame(c,l)){for(s=0,r=(d=f.reverse()).length;s<r;s++)u=d[s],this.$("tbody > tr:nth-child("+(u+1)+")").remove();for(a=0,o=t.length;a<o;a++)0===(u=t[a])?this.$("tbody tr:nth-child(1)").get(0)?this.$("tbody tr:nth-child(1)").before(l[u]):this.$("tbody").append(l[u]):this.$("tbody > tr:nth-child("+u+")").after(l[u]);return this.currentRows=l,this.log("debug","table.fullRender.contentRemoved",f,t),this.renderPager(this.el,!0),!0===this.frontendTimeUpdateExecute&&this.frontendTimeUpdateElement(this.el),["fullRender.contentRemoved",f,t]}}return c.length!==this.currentRows.length?(g=["fullRender.lenghtChanged",this.currentRows.length,c.length],this.renderTableFull(c),this.log("debug","table.fullRender.lenghtChanged",g),g):!0!==(g=this._isSame(c,this.currentRows))?(this.renderTableFull(c),this.log("debug","table.fullRender.contentChanged|row("+g+")"),["fullRender.contentChanged",g]):(this.log("debug","table.noChanges"),["noChanges"])},s.prototype.renderEmptyList=function(){return App.view("generic/admin/empty")({explanation:this.explanation})},s.prototype.renderTableFull=function(t,e){var n,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S;if(null==e&&(e={}),this.log("debug","table.renderTableFull",this.orderBy,this.orderDirection),this.tableHeaders(e),this.sortList(),n=this.getBulkSelected(),T=(r=this.renderTableContainer()).filter(".table"),t||(t=this.renderTableRows()),this.currentRows=clone(t),r.find(".js-tableBody").html(t),!0===this.frontendTimeUpdateExecute&&this.frontendTimeUpdateElement(r),this.renderPager(r),o={click:"pointer",dblclick:"pointer"},!_.isEmpty(this.bindCol))for(v in b=this.bindCol)if((f=b[v]).events){for(y=0,this.dndCallback&&(y+=1),this.checkbox&&(y+=1),d=!1,m=0,g=(w=this.headers).length;m<g;m++)h=w[m],d||(y+=1),h.name!==v&&h.name!==v+"_id"&&h.name!==v+"_bulkIds"||(d=!0);if(d)for(l in c=function(t,e,n){return o[e]&&t.find("tbody > tr > td:nth-child("+y+")").css("cursor",o[e]),t.on(e,"tbody > tr > td:nth-child("+y+")",(function(t){var e;return t.stopPropagation(),e=$(t.target).parents("tr").data("id"),n(e,t,t.currentTarget)}))},k=f.events)s=k[l],c(T,l,s)}if(!_.isEmpty(this.bindRow)&&this.bindRow.events)for(l in u=function(t,e,n){return o[e]&&t.find("tbody > tr").css("cursor",o[e]),t.on(e,"tbody > tr",(function(t){var e;return e=$(t.target).parents("tr").data("id"),n(e,t)}))},A=this.bindRow.events)s=A[l],u(T,l,s);if(this.bindCheckbox&&this.bindCheckbox.events)for(l in p=function(t,e,n){return t.on(e,'input[name="bulk"]',(function(t){var e,i;return t.stopPropagation(),i=$(t.currentTarget).parents("tr").data("id"),e=$(t.currentTarget).prop("checked"),n(i,e,t)}))},C=this.bindCheckbox.events)s=C[l],p(T,l,s);return this.tableId&&(T.on("mousedown touchstart",".js-col-resize",this.onColResizeStart),T.on("click",".js-col-resize",this.stopPropagation)),this.checkbox&&(T.on("click","tr > td:nth-child(1)",(function(t){return t.stopPropagation()})),T.on("change",'input[name="bulk_all"]',(S=this,function(t){var e,n,r,o,a;if(t.stopPropagation(),n=[],$(t.currentTarget).prop("checked")?$(t.currentTarget).parents("table").find('[name="bulk"]').each((function(){var t,e;if(!(t=$(this)).prop("checked"))return t.prop("checked",!0),e=t.parents("tr").data("id"),n.push([e,!0])})):$(t.currentTarget).parents("table").find('[name="bulk"]').each((function(){var t,e;if((t=$(this)).prop("checked"))return t.prop("checked",!1),e=t.parents("tr").data("id"),n.push([e,!1])})),S.bindCheckbox&&S.bindCheckbox.events&&!_.isEmpty(n)){if(!S.bindCheckbox.select_all){for(l in a=[],o=S.bindCheckbox.events)s=o[l],"click"===l||"change"===l?a.push(function(){var r,o,a;for(a=[],r=0,o=n.length;r<o;r++)e=n[r],a.push(s.apply(null,i.call(e).concat([t])));return a}()):a.push(void 0);return a}(r=S.bindCheckbox).select_all.apply(r,i.call(n[0]).concat([t]))}}))),this.dndCallback&&!App.Config.get("translation_inline")&&(a={tolerance:"pointer",distance:15,opacity:.6,forcePlaceholderSize:!0,items:"tr",helper:function(t,e){var n,i;return i=e.children(),(n=e.clone()).children().each((function(t){return $(this).width(i.eq(t).outerWidth())})),n},update:this.dndCallback},T.find("tbody").sortable(a)),this.el.html(r),this.setBulkSelected(n)},s.prototype.renderTableContainer=function(){return $(App.view("generic/table")({tableId:this.tableId,headers:this.headers,checkbox:this.checkbox,radio:this.radio,class:this.class,sortable:this.dndCallback}))},s.prototype.sortObjectKeys=function(t,e){var n;return n=Object.keys(t).sort(),"DESC"===e?n.reverse():n},s.prototype.renderTableRows=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b;for(null==t&&(t=!1),!0===t&&this.sortList(),m=0,this.headers.length,(this.checkbox||this.radio)&&0,"",i="",y=[],f=this.objectsOfPage(this.pagerShownPage),d=this.groupBy?_.groupBy(f,(b=this,function(t){return b.groupObjectName(t,b.groupBy,{excludeTags:["date","datetime"]})})):{"":f},r=0,l=(g=this.sortObjectKeys(d,this.groupDirection)).length;r<l;r++)for(o=0,c=(s=d[g[r]]).length;o<c;o++)if(h=[],p=s[o]){for(m++,this.groupBy&&i!==(n=this.groupObjectName(p,this.groupBy))&&(i=n,y.push(this.renderTableGroupByRow(p,m,n))),a=0,u=(v=this.actions).length;a<u;a++)(null==(e=v[a]).available||!0===e.available||"function"==typeof e.available&&!0===e.available(p))&&h.push(e);y.push(this.renderTableRow(p,m,h))}return y},s.prototype.renderTableGroupByRow=function(t,e,n){var i,s,r,o,a,l,c;if(s=void 0,!0===this.Config.get("ui_table_group_by_show_count")&&(i=this.groupBy,r=this.groupObjectName(t,this.groupBy),s=0,this.objects))for(o=0,a=(c=this.objects).length;o<a;o++)l=c[o],this.groupObjectName(l,i)===r&&(s+=1);return App.view("generic/table_row_group_by")({position:e,groupByName:n,groupByCount:s,columnsLength:this.columnsLength})},s.prototype.renderTableRow=function(t,e,n){return App.view("generic/table_row")({headers:this.headers,attributes:this.attributesList,checkbox:this.checkbox,radio:this.radio,callbacks:this.callbackAttributes,sortable:this.dndCallback,position:e,object:t,actions:n})},s.prototype.tableHeadersHasChanged=function(){return this.overviewAttributes!==this.lastOverview},s.prototype.tableHeaders=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A;if(null==t&&(t={}),f=this.customOrderBy||this.orderBy,m=this.customOrderDirection||this.orderDirection,this.headers&&this.lastOrderBy===f&&this.lastOrderDirection===m&&!this.tableHeadersHasChanged())return this.log("debug","table.Headers: same overviewAttributes just return headers",this.headers),["headers are the same",this.headers];for(this.lastOverview=this.overviewAttributes,this.headers=[],this.actions=[].concat(this.customActions),s=this.availableWidth,a=0,p=(g=this.overviewAttributes).length;a<p;a++)for(i in o=g[a],!1,v=this.attributesList)n=v[i],this.groupBy&&this.groupBy===o||(n.style||(n.style={}),i!==o&&i!==o+"_id"&&i!==o+"_ids"||(!0,t.skipHeadersResize||(this.headerWidth[n.name]?n.displayWidth=this.headerWidth[n.name]*s:n.width?(k=parseInt(n.width,10),w=n.width.match(/[px|%]+/)[0],n.displayWidth="%"===w?k/100*s:k):n.displayWidth=this.baseColWidth),this.headers.push(n)));if(this.callbackHeader)for(l=0,h=(y=this.callbackHeader).length;l<h;l++)r=y[l],this.headers=r(this.headers);if(this.autoAlignLastColumn){for(u=_.last(this.headers),c=0,d=(b=this.headers).length;c<d;c++)(e=b[c]).autoAligned&&(delete e.autoAligned,delete e.align);["datetime","date"].includes(null!=u?u.tag:void 0)&&_.isEmpty(u.align)&&(u.align="right",u.autoAligned=!0)}if(_.isEmpty(this.headers))throw"no headers found";return this.clone&&this.actions.push({name:"clone",display:__("Clone"),icon:"clipboard",class:"create  js-clone",callback:(A=this,function(t){if((o=A.model.find(t)).name="Clone: "+o.name,!A.cloneCallback)return new App.ControllerGenericNew({item:o,pageData:{object:o.constructor.className},callback:function(){return A.renderTableFull()},genericObject:o.constructor.className,container:A.container});A.cloneCallback(o)})}),this.destroy&&this.actions.push({name:"delete",display:__("Delete"),icon:"trash",class:"danger js-delete",callback:function(t){return function(e){return o=t.model.find(e),new App.ControllerGenericDestroyConfirm({item:o,container:t.container})}}(this)}),this.setAsDefault&&this.actions.push({name:"setAsDefault",icon:"reload",display:__("Set as default"),class:"js-set-as-default",available:function(t){return function(e){return!t.model.is_default(e)}}(this),callback:function(t){return function(e){return o=t.model.find(e),new App.ControllerConfirm({message:App.i18n.translatePlain('Are you sure you want to set "%s" as default?',o.name),item:o,container:t.container,callback:function(){return t.model.set_as_default(o)}})}}(this)}),this.unsetDefault&&this.actions.push({name:"unsetDefault",icon:"inactive-reload",display:__("Unset default"),class:"js-unset-default",available:function(t){return function(e){return t.model.is_default(e)}}(this),callback:function(t){return function(e){return o=t.model.find(e),new App.ControllerConfirm({message:App.i18n.translatePlain('Are you sure you want to unset "%s" as default?',o.name),item:o,container:t.container,callback:function(){return t.model.unset_default(o)}})}}(this)}),this.actions.length&&(this.headers.push({name:"action",display:__("Action"),width:"50px",displayWidth:50,align:"right",parentClass:"noTruncate no-padding",unresizable:!0,unsortable:!0}),this.bindCol.action={events:{click:this.toggleActionDropdown}}),this.calculateHeaderWidths(),this.storeHeaderWidths(),this.columnsLength=this.headers.length,(this.checkbox||this.radio)&&this.columnsLength++,this.log("debug","table.Headers: new headers",this.headers),["new headers",this.headers]},s.prototype.setMaxPage=function(){var t;if(this.pagerEnabled)return t=parseInt((this.objects.length-1)/this.pagerItemsPerPage),parseInt(this.pagerShownPage)>t?this.pagerShownPage=t:void 0},s.prototype.objectsOfPage=function(t){return null==t&&(t=0),this.pagerEnabled?(t=parseInt(t),this.objects.slice(t*this.pagerItemsPerPage,(t+1)*this.pagerItemsPerPage)):this.objects},s.prototype.paginate=function(t){var e,n,i;return t.stopPropagation(),e=$(t.currentTarget).attr("data-page"),this.pagerAjax?this.navigate(""+this.pagerBaseUrl+(parseInt(e)+1)):(i=this,n=function(){return i.pagerShownPage=e,i.renderTableFull()},App.QueueManager.add("tableRender",n),App.QueueManager.run("tableRender"))},s.prototype.sortList=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S;if(!(_.isEmpty(this.objects)||(y=this.customOrderBy||this.orderBy,b=this.customOrderDirection||this.orderDirection,this.log("debug","table.order",this.orderBy,this.orderDirection),this.log("debug","table.customOrder",this.customOrderBy,this.customOrderDirection),_.isEmpty(y)&&_.isEmpty(this.groupBy)||this.lastSortedobjects===this.objects&&this.lastOrderDirection===b&&this.lastOrderBy===y)))if(this.lastOrderDirection=b,this.lastOrderBy=y,this.pagerAjax)for(o=0,u=(w=this.headers).length;o<u;o++)(r=w[o]).name===y||r.name+"_id"===y||r.name===y+"_id"?r.sortOrderIcon="DESC"===b?["arrow-down","table-sort-arrow"]:["arrow-up","table-sort-arrow"]:r.sortOrderIcon=void 0;else{if(S=function(t,e){return _.sortBy(t,(function(t){var n;return null!=(n=e(t))&&""!==n?n:"\uffff"}))},g=(null!=(k=App[this.model])?k.configure_attributes:void 0)||[],y){for(a=0,p=(A=this.headers).length;a<p;a++)(r=A[a]).name===y||r.name+"_id"===y||r.name===y+"_id"?(f=S(this.objects,(function(t){var e,n,i;return t?r.translate?App.i18n.translateInline(t[r.name]):r.relation?t[r.name]&&(e=App[r.relation].findNative(t[r.name]))?(e.displayName&&(e=e.displayName().toLowerCase()),e.name&&(e=e.name.toLowerCase()),e):"":"float"===r.tag||"float"===(null!=(n=g[r.name])?n.tag:void 0)?parseFloat(t[r.name]):"integer"===r.tag||"integer"===(null!=(i=g[r.name])?i.tag:void 0)?parseInt(t[r.name]):t[r.name]:(console.log("Got empty object in order by with header _.sortBy"),"")})),"DESC"===b?(r.sortOrderIcon=["arrow-down","table-sort-arrow"],f=f.reverse()):r.sortOrderIcon=["arrow-up","table-sort-arrow"]):r.sortOrderIcon=void 0;if(!f)for(e in C=this.attributesList)t=C[e],e!==y&&e+"_id"!==y&&e!==y+"_id"||(f=_.sortBy(this.objects,(function(e){var n,i,s;return e?t.translate?App.i18n.translateInline(e[t.name]):t.relation?e[t.name]&&(n=App[t.relation].findNative(e[t.name]))?(n.displayName&&(n=n.displayName().toLowerCase()),n.name&&(n=n.name.toLowerCase()),n):"":"float"===t.tag||"float"===(null!=(i=g[t.name])?i.tag:void 0)?parseFloat(e[t.name]):"integer"===t.tag||"integer"===(null!=(s=g[t.name])?s.tag:void 0)?parseInt(e[t.name]):e[t.name]:(console.log("Got empty object in order by in attribute _.sortBy"),"")})),"DESC"===b&&(f=f.reverse()));f?this.objects=f:console.log("Unable to orderBy objects, no attribute found with name "+y)}if(this.groupBy){for(i={},c=0,h=(T=this.objects).length;c<h;c++)v=T[c],i[n=this.groupObjectName(v,this.groupBy)]||(i[n]=[]),i[n].push(v);for(l in s=[],i)s.push(l);for(s=s.sort(),"DESC"===this.groupDirection&&s.reverse(),f=[],m=0,d=s.length;m<d;m++)n=s[m],f=f.concat(i[n]),i[n]=[]}if(void 0!==f)return this.objects=f,this.lastSortedobjects=f}},s.prototype.groupObjectName=function(t,e,n){var i;if(null==e&&(e=void 0),null==n&&(n={}),i=t,e){if(e in t||(e+="_id"),n.excludeTags&&_.find(this.attributesList,(function(t){return t.name===e&&_.contains(n.excludeTags,t.tag)})))return t[e];i=App.viewPrint(t,e,this.attributesList)}return _.isEmpty(i)&&(i=""),i.displayName?i=i.displayName().toLowerCase():i.name&&(i=i.name.toLowerCase()),i},s.prototype.onActionButtonClicked=function(t){var e,n;return e=$(t.currentTarget).parents("tr").data("id"),n=t.currentTarget.getAttribute("data-table-action"),this.runAction(n,e,t)},s.prototype.runAction=function(t,e,n){return null==n&&(n=void 0),_.findWhere(this.actions,{name:t}).callback(e,n)},s.prototype.toggleActionDropdown=function(t,e,n){var i,s;if(e.stopPropagation(),(i=$(n).find(".js-table-action-menu")).length){if(i.dropdown("toggle"),i.prop("rendered"))return;return i.prop("rendered",!0),i.on("click.dropdown","[data-table-action]",this.onActionButtonClicked)}return s=$(n).find("[data-table-action]").attr("data-table-action"),this.runAction(s,t,e)},s.prototype.calculateHeaderWidths=function(){var t,e,n,i;if(this.tableId&&this.headers)return t=this.availableWidth,this.headers=_.map(this.headers,(function(t){return t.displayWidth=Math.floor(t.displayWidth),t
})),n=Math.ceil((this.getHeaderWidths()-t)/this.getShrinkableHeadersCount()),this.headers=_.map(this.headers,(i=this,function(t){return t.unresizable||(t.displayWidth=Math.max(i.minColWidth,t.displayWidth-n)),t})),(e=t-this.getHeaderWidths())>0&&e<10&&(this.headers[this.headers.length-1].displayWidth=this.headers[this.headers.length-1].displayWidth+e),!0},s.prototype.getShrinkableHeadersCount=function(){return _.reduce(this.headers,(function(t,e){return e.unresizable?t:t+1}),0)},s.prototype.getHeaderWidths=function(){var t;return t=_.reduce(this.headers,(function(t,e){return t+e.displayWidth}),0),this.checkbox&&(t+=this.checkBoxColWidth),this.radio&&(t+=this.radioColWidth),this.dndCallback&&(t+=this.sortableColWidth),t},s.prototype.setHeaderWidths=function(){var t;if(this.calculateHeaderWidths())return this.$(".js-tableHead").each((t=this,function(e,n){return n.style.width=t.headers[e].displayWidth+"px"})),this.storeHeaderWidths()},s.prototype.storeHeaderWidths=function(){var t,e,n,i,s;for(s={},e=0,n=(i=this.headers).length;e<n;e++)s[(t=i[e]).name]=t.displayWidth/this.availableWidth;return this.headerWidth=s,App.LocalStorage.set(this.preferencesStoreKey(),{headerWidth:s},this.Session.get("id"))},s.prototype.onResize=function(){var t,e,n;if(0!==(e=this.el.width()))return this.availableWidth=e,n=this,t=function(){var t;return t=function(){return n.availableWidth=n.el.width(),n.setHeaderWidths()},App.QueueManager.add("tableRender",t),App.QueueManager.run("tableRender")},this.delay(t,200,"table-resize-finish");this.windowIsResized=!0},s.prototype.stopPropagation=function(t){return t.stopPropagation()},s.prototype.getPageX=function(t){return t.originalEvent instanceof MouseEvent?t.pageX:t.targetTouches[0]?t.targetTouches[0].pageX:t.changedTouches[t.changedTouches.length-1].pageX},s.prototype.onColResizeStart=function(t){return this.resizeTargetLeft=$(t.currentTarget).parents("th"),this.resizeTargetRight=this.resizeTargetLeft.next(),this.resizeStartX=this.getPageX(t),this.resizeLeftStartWidth=this.resizeTargetLeft.width(),this.resizeRightStartWidth=this.resizeTargetRight.width(),$(document).on("mousemove.resizeCol touchmove.resizeCol",this.onColResizeMove),$(document).one("mouseup touchend",this.onColResizeEnd),this.tableWidth=this.el.width()},s.prototype.onColResizeMove=function(t){var e,n;return n=this.getPageX(t),e="rtl"===App.i18n.dir()?this.resizeStartX-n:n-this.resizeStartX,this.resizeLeftStartWidth+e<this.minColWidth&&(e=-(this.resizeLeftStartWidth-this.minColWidth)),this.resizeRightStartWidth-e<this.minColWidth&&(e=this.resizeRightStartWidth-this.minColWidth),this.resizeTargetLeft.width(this.resizeLeftStartWidth+e),this.resizeTargetRight.width(this.resizeRightStartWidth-e)},s.prototype.onColResizeEnd=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h;for($(document).off("mousemove.resizeCol touchmove.resizeCol"),c=this.resizeTargetLeft.parents("table").width(),s=this.resizeTargetLeft.outerWidth()/c,h=this.resizeTargetRight.outerWidth()/c,i=this.resizeTargetLeft.attr("data-column-key"),p=this.resizeTargetRight.attr("data-column-key"),this.preferencesStore("headerWidth",i,s),this.headerWidth[i]=s,e=0,r=(a=this.headers).length;e<r;e++)(t=a[e]).name===i&&(t.displayWidth=this.resizeTargetLeft.outerWidth());if(p){for(this.preferencesStore("headerWidth",p,h),this.headerWidth[p]=h,u=[],n=0,o=(l=this.headers).length;n<o;n++)(t=l[n]).name===p?u.push(t.displayWidth=this.resizeTargetRight.outerWidth()):u.push(void 0);return u}},s.prototype.sortByColumn=function(t){var e,n,i,s,r;if(e=$(t.currentTarget).closest("[data-column-key]").attr("data-column-key"),!this.model||!this.pagerAjax||this.attributesList[e])return n=this.customOrderBy||this.orderBy,i=this.customOrderDirection||this.orderDirection,n!==e?(n=e,i="ASC"):i="ASC"===i?"DESC":"ASC",this.orderBy=n,this.orderDirection=i,this.customOrderBy=n,this.customOrderDirection=i,this.preferencesStore("order","customOrderBy",this.orderBy),this.preferencesStore("order","customOrderDirection",this.orderDirection),this.sortClickCallback&&this.sortClickCallback(this),this.sortRenderCallback?App.QueueManager.add("tableRender",this.sortRenderCallback):(r=this,s=function(){return r.renderTableFull(!1,{skipHeadersResize:!0})},App.QueueManager.add("tableRender",s)),App.QueueManager.run("tableRender")},s.prototype.preferencesStore=function(t,e,n){var i;return(i=this.preferencesGet())[t]||(i[t]={}),i[t][e]||(i[t][e]={}),i[t][e]=n,App.LocalStorage.set(this.preferencesStoreKey(),i,this.Session.get("id"))},s.prototype.preferencesGet=function(){return App.LocalStorage.get(this.preferencesStoreKey(),this.Session.get("id"))||{}},s.prototype.preferencesStoreKey=function(){return"tablePrefs:"+this.tableId},s.prototype.getBulkSelected=function(){var t;return t=[],this.$('[name="bulk"]:checked').each((function(e,n){var i;return i=$(n).val(),t.push(i)})),t},s.prototype.setBulkSelected=function(t){return this.$('[name="bulk"]').each((function(e,n){var i,s,r,o;for(i=$(n).val(),o=[],s=0,r=t.length;s<r;s++)t[s]===i?o.push($(n).prop("checked",!0)):o.push(void 0);return o}))},s.prototype._isSame=function(t,e){var n,i,s;for(i=n=0,s=t.length-1;0<=s?n<=s:n>=s;i=0<=s?++n:--n)if(t[i]!==e[i])return i;return!0},s}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerTabs=function(n){function i(e){if(this.tabRemember=t(this.tabRemember,this),this.hide=t(this.hide,this),this.show=t(this.show,this),this.originParams=e,i.__super__.constructor.call(this,e),this.requiredPermission&&!this.permissionCheckRedirect(this.requiredPermission))throw"No permission for "+this.requiredPermission}return e(i,n),i.prototype.events={'click .nav-tabs [data-toggle="tab"]':"tabRemember"},i.prototype.show=function(){var t,e,n,i,s;if(this.controllerList){for(s=[],t=0,e=(i=this.controllerList).length;t<e;t++)(n=i[t])&&n.show?s.push(n.show()):s.push(void 0);return s}},i.prototype.hide=function(){var t,e,n,i,s;if(this.controllerList){for(s=[],t=0,e=(i=this.controllerList).length;t<e;t++)(n=i[t])&&n.hide?s.push(n.hide()):s.push(void 0);return s}},i.prototype.render=function(){var t,e,n,i,s;for(this.html(App.view("generic/tabs")({header:this.header,subHeader:this.subHeader,tabs:this.tabs,addTab:this.addTab,headerSwitchName:this.headerSwitchName,headerSwitchChecked:this.headerSwitchChecked})),t=0,e=(i=this.tabs).length;t<e;t++)s=i[t],this.$(".tab-content").append('<div class="tab-pane" id="'+s.target+'"></div>'),s.controller&&((n=s.params||{}).name=s.name,n.target=s.target,n.el=this.$("#"+s.target),this.controllerList||(this.controllerList=[]),this.controllerList.push(new s.controller(_.extend({},this.originParams,n))));if(!(this.tabs.length<=1))return this.lastActiveTab=this.Config.get("lastTab"),this.lastActiveTab&&this.$(".nav-tabs li a[href='"+this.lastActiveTab+"']")[0]?this.$(".nav-tabs li a[href='"+this.lastActiveTab+"']").tab("show"):this.$(".nav-tabs li:first a").tab("show");this.$(".tab-pane").addClass("active")},i.prototype.tabRemember=function(t){return this.lastActiveTab=$(t.target).attr("href"),this.Config.set("lastTab",this.lastActiveTab)},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.ControllerTechnicalErrorModal=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.head="StatusCode: "+status,n.prototype.contentCode="",n.prototype.buttonClose=!1,n.prototype.buttonSubmit="Ok",n.prototype.onSubmit=function(t){return this.close(t)},n.prototype.content=function(){return"<pre><code>"+this.contentCode+"</code></pre>"},n}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerWizardModal=function(n){function i(){var e;this.showInvalidField=t(this.showInvalidField,this),this.hide=t(this.hide,this),this.enable=t(this.enable,this),this.disable=t(this.disable,this),this.hideAlert=t(this.hideAlert,this),this.showAlert=t(this.showAlert,this),this.showSlide=t(this.showSlide,this),this.goToSlide=t(this.goToSlide,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("ui:rerender",(e=this,function(){return e.render(),"wizard"}))}return e(i,n),i.prototype.className="modal fade",i.prototype.goToSlide=function(t){var e;if(t.preventDefault(),e=$(t.target).data("slide"))return this.showSlide(e)},i.prototype.showSlide=function(t){return this.hideAlert(t),this.$(".setup.wizard").addClass("hide"),this.$(".setup.wizard."+t).removeClass("hide"),this.$(".setup.wizard."+t+" input, .setup.wizard."+t+" select").first().trigger("focus")},i.prototype.showAlert=function(t,e){return this.$("."+t).find(".alert").first().removeClass("hide").text(App.i18n.translatePlain(e))},i.prototype.hideAlert=function(t){return this.$("."+t).find(".alert").first().addClass("hide")},i.prototype.disable=function(t){return this.formDisable(t),this.$(".wizard-controls .btn").attr("disabled",!0)},i.prototype.enable=function(t){return this.formEnable(t),this.$(".wizard-controls .btn").attr("disabled",!1)},i.prototype.hide=function(t){return t.preventDefault(),this.el.modal("hide")},i.prototype.showInvalidField=function(t,e){var n,i;if(this.$("."+t).find(".form-group").removeClass("has-error"),e){for(n in i=[],e)e[n]?i.push(this.$("."+t).find('[name="options::'+n+'"]').closest(".form-group").addClass("has-error")):i.push(void 0);return i}},i.prototype.render=function(){},i}(App.ControllerFullPage)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerWizardFullScreen=function(n){function i(){return this.redirectToLogin=t(this.redirectToLogin,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.forceRender=!0,i.prototype.className="getstarted",i.prototype.redirectToLogin=function(){return App.Auth.loginCheck(),this.navigate("#",{removeEl:!0})},i}(App.ControllerWizardModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ChannelEmailFilter=function(n){function i(){this.edit=t(this.edit,this),this.new=t(this.new,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),App.PostmasterFilter.subscribe(this.render,{initFetch:!0})}return e(i,n),i.prototype.events={"click [data-type=new]":"new"},i.prototype.render=function(){var t,e,n;return t=App.PostmasterFilter.search({sortBy:"name"}),n=$('<div><div class="overview"></div><a data-type="new" class="btn btn--success">'+App.i18n.translateContent("New")+"</a></div>"),e=__("With filters you can e. g. dispatch new tickets into certain groups or set a certain priority for tickets of a VIP customer."),new App.ControllerTable({el:n.find(".overview"),model:App.PostmasterFilter,objects:t,bindRow:{events:{click:this.edit}},explanation:e}),this.html(n)},i.prototype.new=function(t){return t.preventDefault(),new App.ControllerGenericNew({pageData:{object:__("Postmaster Filter")},genericObject:"PostmasterFilter",container:this.el.closest(".content"),callback:this.load,large:!0})},i.prototype.edit=function(t,e){return e.preventDefault(),new App.ControllerGenericEdit({id:t,pageData:{object:__("Postmaster Filter")},genericObject:"PostmasterFilter",container:this.el.closest(".content"),callback:this.load,large:!0})},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.ChannelEmailSignature=function(i){function s(){this.edit=e(this.edit,this),this.new=e(this.new,this),this.render=e(this.render,this),s.__super__.constructor.apply(this,arguments),App.Signature.subscribe(this.render,{initFetch:!0})}return n(s,i),s.prototype.events={"click [data-type=new]":"new"},s.prototype.render=function(){var t,e,n;return t=App.Signature.search({sortBy:"name"}),n=$('<div><div class="overview"></div><a data-type="new" class="btn btn--success">'+App.i18n.translateContent("New")+"</a></div>"),e=__("You can define a separate signature for each group to use a different signature for each department.\n\nOnce you created a signature here, you will also need to edit the groups which should use it."),new App.ControllerTable({el:n.find(".overview"),model:App.Signature,objects:t,bindRow:{events:{click:this.edit}},explanation:e}),this.html(n)},s.prototype.new=function(e){return e.preventDefault(),new t({container:this.el.closest(".content")})},s.prototype.edit=function(e,n){var i;return n.preventDefault(),i=App.Signature.find(e),new t({object:i,container:this.el.closest(".content")})},s}(App.Controller),t=function(t){function i(){return this.onSubmit=e(this.onSubmit,this),this.content=e(this.content,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.head=__("Signature"),i.prototype.content=function(){return this.object?this.form=new App.ControllerForm({model:App.Signature,params:this.object,autofocus:!0}):this.form=new App.ControllerForm({model:App.Signature,autofocus:!0}),this.form.form},i.prototype.onSubmit=function(t){var e,n,i,s;return i=this.formParam(t.target),(n=this.object||new App.Signature).load(i),(e=this.form.validate(i))?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),n.save({done:(s=this,function(){return s.close()}),fail:function(e){return function(n,i){return e.log("errors",i),e.formEnable(t),e.form.showAlert(i.error_human||i.error||__("The object could not be created."))}}(this)}))},i}(App.ControllerModal)}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;t=function(t){function s(){this.updateParams=n(this.updateParams,this),this.toggleChatSetting=n(this.toggleChatSetting,this),this.toggleChat=n(this.toggleChat,this),this.onColorPicked=n(this.onColorPicked,this),this.renderDemoWebsite=n(this.renderDemoWebsite,this),this.updatePreview=n(this.updatePreview,this),this.selectBrowserSize=n(this.selectBrowserSize,this),this.render=n(this.render,this),this.load=n(this.load,this),s.__super__.constructor.apply(this,arguments),this.Session.get("email")&&(this.previewUrl="www."+this.Session.get("email").replace(/^.+?\@/,"")),this.load(),this.permanent={chatId:1},this.widgetDesignerPermanentParams={id:"id"},$(window).on("resize.chat-designer",this.resizeDemo)}return i(s,t),s.requiredPermission="admin.channel_chat",s.prototype.header=__("Chat"),s.prototype.events={"change .js-params":"updateParams","input .js-params":"updateParams","submit .js-demo-head":"onUrlSubmit","click .js-selectBrowserSize":"selectBrowserSize","click .js-swatch":"usePaletteColor","click .js-toggle-chat":"toggleChat","change .js-chatSetting input":"toggleChatSetting","click .js-eyedropper":"pickColor"},s.prototype.elements={".js-browser":"browser",".js-browserBody":"browserBody",".js-screenshot":"screenshot",".js-website":"website",".js-chat":"chat",".js-chatHeader":"chatHeader",".js-chat-welcome":"chatWelcome",".js-testurl-input":"urlInput",".js-backgroundColor":"chatBackground",".js-code":"code",".js-palette":"palette",".js-color":"colorField",".js-chatSetting input":"chatSetting",".js-eyedropper":"eyedropper"},s.prototype.apiOptions=[{name:"chatId",default:"1",type:"Number",description:__("Identifier of the chat topic.")},{name:"show",default:!0,type:"Boolean",description:__("Show the chat when ready.")},{name:"target",default:"$('body')",type:"jQuery Object",description:__("Where to append the chat to.")},{name:"host",default:"(Empty)",type:"String",description:__("If left empty, the host gets auto-detected - in this case %s. The auto-detection reads out the host from the <script> tag. If you don't include it via a <script> tag you need to specify the host."),descriptionSubstitute:window.location.origin},{name:"debug",default:!1,type:"Boolean",description:__("Enables console logging.")},{name:"title",default:"'<strong>Chat</strong> with us!'",type:"String",description:__("Welcome Title shown on the closed chat. Can contain HTML.")},{name:"fontSize",default:"undefined",type:"String",description:__("CSS font-size with a unit like 12px, 1.5em. If left undefined it inherits the font-size of the website.")},{name:"flat",default:"false",type:"Boolean",description:__("Removes the shadows for a flat look.")},{name:"buttonClass",default:"'open-zammad-chat'",type:"String",description:__("Add this class to a button on your page that should open the chat.")},{name:"inactiveClass",default:"'is-inactive'",type:"String",description:__("This class gets added to the button on initialization and will be removed once the chat connection is established.")},{name:"cssAutoload",default:"true",type:"Boolean",description:__("Automatically loads the chat.css file. If you want to use your own css, just set it to false.")},{name:"cssUrl",default:"undefined",type:"String",description:__("Location of an external chat.css file.")}],s.prototype.isOpen=!0,s.prototype.browserSize="desktop",s.prototype.previewUrl="",s.prototype.previewScale=1,s.prototype.load=function(){return this.startLoading(),this.ajax({id:"chat_index",type:"GET",url:this.apiPath+"/chats",processData:!0,success:(t=this,function(e){var n;return App.Collection.loadAssets(e.assets),(n=App.Chat.first())&&(t.permanent={chatId:n.id}),t.stopLoading(),t.render(e)})});var t},s.prototype.render=function(t){return null==t&&(t={}),this.html(App.view("channel/chat")({baseurl:window.location.origin,apiOptions:this.apiOptions,previewUrl:this.previewUrl,chatSetting:this.Config.get("chat")})),new e({el:this.$(".js-topics")}),this.code.each((function(t,e){return hljs.highlightBlock(e)})),this.updatePreview(),this.updateParams(),this.changeDemoWebsite(),$(window).on("resize.chat-designer",(n=this,function(){return n.updatePreview(!1)}));var n},s.prototype.release=function(){return $(window).off("resize.chat-designer"),this.website.off("click.eyedropper")},s.prototype.selectBrowserSize=function(t){var e;return(e=$(t.target).closest("[data-size]")).addClass("active").siblings().removeClass("active"),this.browserSize=e.attr("data-size"),this.updatePreview()},s.prototype.updatePreview=function(t){var e;switch(null==t&&(t=!0),this.chat.removeClass("is-fullscreen").toggleClass("no-transition",!t).css("transform","translateY("+this.getChatOffset()+"px)"),this.browser.attr("data-size",this.browserSize),this.previewScale=1,this.browserSize){case"mobile":return this.chat.addClass("is-fullscreen").css("transform","translateY("+this.getChatOffset(!0)+"px)");case"1:1":return this.previewScale=Math.max(1,1280/this.el.width()),this.website.css("transform","scale("+this.previewScale+")");case"desktop":return e=Math.min(1,this.el.width()/1280),this.website.css("transform",""),this.chat.css("transform","translateY("+this.getChatOffset()*e+"px) scale("+e+")")}},s.prototype.getChatOffset=function(t){return this.isOpen?0:t?this.browserBody.height()-this.chatHeader.outerHeight():this.chat.height()-this.chatHeader.outerHeight()},s.prototype.onUrlSubmit=function(t){return t&&t.preventDefault(),this.urlInput.trigger("focus"),this.changeDemoWebsite()},s.prototype.changeDemoWebsite=function(){if(""!==this.urlInput.val()&&this.urlInput.val()!==this.urlCache)return this.urlCache=this.urlInput.val(),this.url=this.urlCache,this.url.startsWith("http")||(this.url="http://"+this.url),this.urlInput.addClass("is-loading"),this.palette.empty(),this.screenshot.attr("src",""),$.ajax({url:"https://images.zammad.com/api/v1/webpage/combined",data:{url:this.url,count:20},success:this.renderDemoWebsite,dataType:"json"})},s.prototype.renderDemoWebsite=function(t){return this._screenshotSource=t.data_url,this.screenshot.attr("src",this._screenshotSource),this.renderPalette(t.palette),this.urlInput.removeClass("is-loading")},s.prototype.renderPalette=function(t){var e,n,i,s,r,o;for(t=_.map(t,tinycolor),t=_.filter(t,(function(t){return t.getLuminance()<.85})),n="",o=8,i=s=0,r=t.length;s<r&&(e=t[i],n+=App.view("channel/color_swatch")({color:e.toHexString()}),i!==o);i=++s);if(this.palette.html(n),t[0])return this.usePaletteColor(void 0,t[0].toHexString())},s.prototype.usePaletteColor=function(t,e){return t&&(e=$(t.currentTarget).attr("data-color")),this.colorField.val(e),this.updateParams()},s.prototype.pickColor=function(){if(this._screenshotSource)return this._pickingColor?(this._pickingColor=!1,this.website.off("click.eyedropper").removeClass("is-picking"),this.eyedropper.removeClass("is-active")):(this._pickingColor=!0,this.website.on("click.eyedropper",this.onColorPicked).addClass("is-picking"),this.eyedropper.addClass("is-active"))},s.prototype.onColorPicked=function(t){var e,n,i,s,r,o,a,l;return a=this.website.position().left,l=this.website.position().top,r=t.pageX-this.browserBody.offset().left,o=t.pageY-this.browserBody.offset().top,(i=new Image).src=this._screenshotSource,n=(e=document.createElement("canvas")).getContext("2d"),e.width=this.browserBody.width(),e.height=this.browserBody.height(),n.drawImage(i,a,l,this.website.width()*this.previewScale,this.website.width()*this.previewScale),s=n.getImageData(r,o,1,1).data,this.colorField.val("rgb("+s.slice(0,3).join(",")+")").trigger("change")},s.prototype.toggleChat=function(){return this.chat.toggleClass("is-open"),this.isOpen=this.chat.hasClass("is-open"),this.updatePreview()},s.prototype.toggleChatSetting=function(){var t;return t=this.chatSetting.prop("checked"),App.Setting.set("chat",t)},s.prototype.updateParams=function(){var t,e,n,i,s,r;if(i=function(t){return t.replace&&(t=t.replace("'","\\'").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")),t},n=this.formParam(this.$(".js-params")),parseInt(n.fontSize,10)>2&&this.chat.css("font-size",n.fontSize),this.chatBackground.css("background",n.background),"on"===n.flat?(this.chat.addClass("zammad-chat--flat"),n.flat=!0):this.chat.removeClass("zammad-chat--flat"),this.chatWelcome.html(n.title),this.updatePreview(!1),this.permanent)for(t in s=this.permanent)r=s[t],n[t]=r;for(t in e="",n)r=n[t],(_.isNumber(r)||_.isBoolean(r)||!_.isEmpty(r))&&(""!==e&&(e+=",\n"),!0===r||!1===r||_.isNumber(r)?e+="    "+t+": "+r:e+="    "+t+": '"+i(r)+"'");return this.$(".js-modal-params").html(e),this.code.each((function(t,e){return hljs.highlightBlock(e)}))},s}(App.ControllerSubContent),App.Config.set("Chat",{prio:4e3,name:__("Chat"),parent:"#channels",target:"#channels/chat",controller:t,permission:["admin.channel_chat"]},"NavBarAdmin"),e=function(t){function e(){this.remove=n(this.remove,this),this.edit=n(this.edit,this),this.new=n(this.new,this),this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return i(e,t),e.prototype.events={"click .js-add":"new","click .js-edit":"edit","click .js-remove":"remove"},e.prototype.render=function(){return this.html(App.view("channel/topics")({chats:App.Chat.all()}))},e.prototype.new=function(){return new App.ControllerGenericNew({pageData:{title:__("Chats"),object:__("Chat"),objects:__("Chats")},genericObject:"Chat",callback:this.render,container:this.el.closest(".content"),large:!0})},e.prototype.edit=function(t){var e;return t.preventDefault(),e=$(t.target).closest("tr").data("id"),new App.ControllerGenericEdit({id:e,genericObject:"Chat",pageData:{object:__("Chat")},container:this.el.closest(".content"),callback:this.render})},e.prototype.remove=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest("tr").data("id"),n=App.Chat.find(e),new App.ControllerGenericDestroyConfirm({item:n,container:this.el.closest(".content"),callback:this.render})},e}(App.Controller)}.call(this),function(){var t,e,n,i,s,r=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty,a=function(t,e){return function(){return t.apply(e,arguments)}};t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title(__("Email"),!0),this.tabs=[{name:__("Accounts"),target:"c-account",controller:e},{name:__("Filter"),target:"c-filter",controller:App.ChannelEmailFilter},{name:__("Signatures"),target:"c-signature",controller:App.ChannelEmailSignature},{name:__("Settings"),target:"c-setting",controller:App.SettingsArea,params:{area:"Email::Base"}}],this.render()}return r(n,t),n.requiredPermission="admin.channel_email",n.prototype.header=__("Email"),n}(App.ControllerTabs),e=function(t){function e(){this.migrateMicrosoft365Mail=a(this.migrateMicrosoft365Mail,this),this.migrateGoogleMail=a(this.migrateGoogleMail,this),this.editNotificationOutbound=a(this.editNotificationOutbound,this),this.emailAddressDelete=a(this.emailAddressDelete,this),this.emailAddressEdit=a(this.emailAddressEdit,this),this.emailAddressNew=a(this.emailAddressNew,this),this.groupChange=a(this.groupChange,this),this.enable=a(this.enable,this),this.disable=a(this.disable,this),this.delete=a(this.delete,this),this.editOutbound=a(this.editOutbound,this),this.editInbound=a(this.editInbound,this),this.wizard=a(this.wizard,this),this.render=a(this.render,this),this.load=a(this.load,this),e.__super__.constructor.apply(this,arguments),this.interval(this.load,3e4)}return r(e,t),e.prototype.events={"click .js-channelNew":"wizard","click .js-channelDelete":"delete","click .js-channelDisable":"disable","click .js-channelEnable":"enable","click .js-channelGroupChange":"groupChange","click .js-editInbound":"editInbound","click .js-editOutbound":"editOutbound","click .js-emailAddressNew":"emailAddressNew","click .js-emailAddressEdit":"emailAddressEdit","click .js-emailAddressDelete":"emailAddressDelete","click .js-editNotificationOutbound":"editNotificationOutbound","click .js-migrateGoogleMail":"migrateGoogleMail","click .js-migrateMicrosoft365Mail":"migrateMicrosoft365Mail"},e.prototype.load=function(){return this.startLoading(),this.ajax({id:"email_index",type:"GET",url:this.apiPath+"/channels_email",processData:!0,success:(t=this,function(e){return t.stopLoading(),App.Collection.loadAssets(e.assets),t.render(e)})});var t},e.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b;for(null==t&&(t={}),this.channelDriver=t.channel_driver,n=[],a=0,p=(v=t.account_channel_ids).length;a<p;a++)s=v[a],(e=App.Channel.fullLocal(s)).group_id?e.group=App.Group.find(e.group_id):e.group="-",n.push(e);for(l=0,h=n.length;l<h;l++)i=n[l],o=App.EmailAddress.search({filter:{channel_id:i.id}}),i.email_addresses=o;for(m=[],c=0,d=(y=t.not_used_email_address_ids).length;c<d;c++)r=y[c],m.push(App.EmailAddress.find(r));for(g=[],u=0,f=(b=t.notification_channel_ids).length;u<f;u++)s=b[u],g.push(App.Channel.find(s));return this.html(App.view("channel/email_account_overview")({account_channels:n,not_used_email_addresses:m,notification_channels:g,accounts_fixed:t.accounts_fixed,config:t.config}))},e.prototype.wizard=function(t){return t.preventDefault(),new n({container:this.el.closest(".content"),callback:this.load,channelDriver:this.channelDriver})},e.prototype.editInbound=function(t){var e,i,s;return t.preventDefault(),i=$(t.target).closest(".action").data("id"),e=App.Channel.find(i),s="js-inbound",new n({container:this.el.closest(".content"),slide:s,channel:e,callback:this.load,channelDriver:this.channelDriver})},e.prototype.editOutbound=function(t){var e,i,s;return t.preventDefault(),i=$(t.target).closest(".action").data("id"),e=App.Channel.find(i),s="js-outbound",new n({container:this.el.closest(".content"),slide:s,channel:e,callback:this.load,channelDriver:this.channelDriver})},e.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:(n=this,function(){return n.ajax({id:"email_delete",type:"DELETE",url:n.apiPath+"/channels_email",data:JSON.stringify({id:e}),processData:!0,success:function(){return n.load()}})}),container:this.el.closest(".content")})},e.prototype.disable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"email_disable",type:"POST",url:this.apiPath+"/channels_email_disable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},e.prototype.enable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"email_enable",type:"POST",url:this.apiPath+"/channels_email_enable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},e.prototype.groupChange=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),n=App.Channel.find(e),new i({container:this.el.closest(".content"),item:n,callback:this.load})},e.prototype.emailAddressNew=function(t){var e;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerGenericNew({pageData:{object:__("Email Address")},genericObject:"EmailAddress",container:this.el.closest(".content"),item:{channel_id:e},callback:this.load})},e.prototype.emailAddressEdit=function(t){var e;return t.preventDefault(),e=$(t.target).closest("li").data("id"),new App.ControllerGenericEdit({pageData:{object:__("Email Address")},genericObject:"EmailAddress",container:this.el.closest(".content"),id:e,callback:this.load})},e.prototype.emailAddressDelete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest("li").data("id"),n=App.EmailAddress.find(e),new App.ControllerGenericDestroyConfirm({item:n,container:this.el.closest(".content"),callback:this.load})},e.prototype.editNotificationOutbound=function(t){var e,n;return t.preventDefault(),n=$(t.target).closest(".action").data("id"),e=App.Channel.find(n),"js-outbound",new s({container:this.el.closest(".content"),channel:e,callback:this.load,channelDriver:this.channelDriver})},e.prototype.migrateGoogleMail=function(t){var e;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.navigate("#channels/google/"+e)},e.prototype.migrateMicrosoft365Mail=function(t){var e;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.navigate("#channels/microsoft365/"+e)},e}(App.Controller),i=function(t){function e(){return this.onSubmit=a(this.onSubmit,this),this.content=a(this.content,this),e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=!0,e.prototype.head=__("Channel"),e.prototype.content=function(){var t;return t=[{name:"group_id",display:__("Destination Group"),tag:"tree_select",null:!1,relation:"Group",nulloption:!0,filter:{active:!0}}],this.form=new App.ControllerForm({model:{configure_attributes:t,className:""},params:this.item}),this.form.form},e.prototype.onSubmit=function(t){var e,n,i;return n=this.formParam(t.target),(e=this.form.validate(n))?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),this.ajax({id:"channel_email_group",type:"POST",url:this.apiPath+"/channels_email_group/"+this.item.id,data:JSON.stringify(n),processData:!0,success:(i=this,function(){return i.callback(),i.close()}),error:function(e){return function(n){var i;return i=JSON.parse(n.responseText),e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(i.error||__("The changes could not be saved."))}}(this)}))},e}(App.ControllerModal),n=function(t){function e(){var t;this.hide=a(this.hide,this),this.verify=a(this.verify,this),this.probleOutbound=a(this.probleOutbound,this),this.probeInboundArchive=a(this.probeInboundArchive,this),
this.probeInboundMessagesFound=a(this.probeInboundMessagesFound,this),this.probeInbound=a(this.probeInbound,this),this.probeBasedOnIntro=a(this.probeBasedOnIntro,this),this.toggleOutboundAdapter=a(this.toggleOutboundAdapter,this),this.toggleInboundAdapter=a(this.toggleInboundAdapter,this),this.render=a(this.render,this),e.__super__.constructor.apply(this,arguments),this.account={inbound:{adapter:void 0,options:void 0},outbound:{adapter:void 0,options:void 0},meta:{}},this.channel&&(this.account={inbound:clone(this.channel.options.inbound),outbound:clone(this.channel.options.outbound),meta:{}},this.account.inbound.options&&this.account.inbound.options.password&&(this.inboundPassword=this.account.inbound.options.password,this.account.inbound.options.password=this.passwordPlaceholder),this.account.outbound.options&&this.account.outbound.options.password&&(this.outboundPassword=this.account.outbound.options.password,this.account.outbound.options.password=this.passwordPlaceholder)),this.container&&this.el.addClass("modal--local"),this.render(),this.channel&&this.$(".js-goToSlide[data-slide=js-intro]").addClass("hidden"),this.el.modal({keyboard:!0,show:!0,backdrop:!0,container:this.container}).on({"hidden.bs.modal":(t=this,function(){return t.callback&&t.callback(),t.el.remove()}),"shown.bs.modal":function(t){return function(){return t.el.addClass("modal--ready")}}(this)}),this.slide&&this.showSlide(this.slide)}return r(e,t),e.prototype.elements={".modal-body":"body"},e.prototype.events={"submit .js-intro":"probeBasedOnIntro","submit .js-inbound":"probeInbound","change .js-inbound [name=adapter]":"toggleInboundAdapter","change .js-outbound [name=adapter]":"toggleOutboundAdapter",'change [name="options::ssl"]':"toggleSslVerifyVisibility",'change [name="options::ssl_verify"]':"toggleSslVerifyAlert","submit .js-outbound":"probleOutbound","click  .js-goToSlide":"goToSlide","click  .js-expert":"probeBasedOnIntro","click  .js-close":"hide"},e.prototype.inboundPassword="",e.prototype.outboundPassword="",e.prototype.passwordPlaceholder="{{{{{{{{{{{{SECRTE_PASSWORD}}}}}}}}}}}}",e.prototype.render=function(){var t,e,n,i,s;return this.html(App.view("channel/email_account_wizard")()),this.showSlide("js-intro"),t=[{name:"realname",display:__("Organization & Department Name"),tag:"input",type:"text",limit:160,null:!1,placeholder:__("Organization Support"),autocomplete:"off"},{name:"email",display:__("Email"),tag:"input",type:"email",limit:120,null:!1,placeholder:"support@example.com",autocapitalize:!1,autocomplete:"off"},{name:"password",display:__("Password"),tag:"input",type:"password",limit:120,null:!1,autocapitalize:!1,autocomplete:"new-password",single:!0},{name:"group_id",display:__("Destination Group"),tag:"tree_select",null:!1,relation:"Group",nulloption:!0}],this.formMeta=new App.ControllerForm({el:this.$(".base-settings"),model:{configure_attributes:t,className:""},params:this.account.meta}),n=[{name:"adapter",display:__("Send Mails via"),tag:"select",multiple:!1,null:!1,options:this.channelDriver.email.outbound,translate:!0}],new App.ControllerForm({el:this.$(".base-outbound-type"),model:{configure_attributes:n,className:""},params:{adapter:this.account.outbound.adapter||"smtp"}}),this.toggleOutboundAdapter(),e=[{name:"adapter",display:__("Type"),tag:"select",multiple:!1,null:!1,options:this.channelDriver.email.inbound,translate:!0},{name:"options::host",display:__("Host"),tag:"input",type:"text",limit:120,null:!1,autocapitalize:!1},{name:"options::user",display:__("User"),tag:"input",type:"text",limit:120,null:!1,autocapitalize:!1,autocomplete:"off"},{name:"options::password",display:__("Password"),tag:"input",type:"password",limit:120,null:!1,autocapitalize:!1,autocomplete:"new-password",single:!0},{name:"options::ssl",display:__("SSL/STARTTLS"),tag:"select",null:!0,options:{off:__("No SSL"),ssl:__("SSL"),starttls:__("STARTTLS")},default:"ssl",translate:!0,item_class:"formGroup--halfSize"},{name:"options::ssl_verify",display:__("SSL verification"),tag:"boolean",default:!0,null:!0,translate:!0,item_class:"formGroup--halfSize"},{name:"options::port",display:__("Port"),tag:"input",type:"text",limit:6,null:!0,autocapitalize:!1,default:"993",item_class:"formGroup--halfSize"},{name:"options::folder",display:__("Folder"),tag:"input",type:"text",limit:120,null:!0,autocapitalize:!1,item_class:"formGroup--halfSize"},{name:"options::keep_on_server",display:__("Keep messages on server"),tag:"boolean",null:!0,options:{true:"yes",false:"no"},translate:!0,default:!1,item_class:"formGroup--halfSize"}],this.channel||(e=[{name:"options::realname",display:__("Organization & Department Name"),tag:"input",type:"text",limit:160,null:!1,placeholder:__("Organization Support"),autocomplete:"off"},{name:"options::email",display:__("Email"),tag:"input",type:"email",limit:120,null:!1,placeholder:"support@example.com",autocapitalize:!1,autocomplete:"off"},{name:"options::group_id",display:__("Destination Group"),tag:"select",null:!1,relation:"Group",nulloption:!0}].concat(e)),s=function(t,e,n,i,s,r){if(t)return"imap"===t.adapter?(r.show("options::folder"),void r.show("options::keep_on_server")):(r.hide("options::folder"),r.hide("options::keep_on_server"))},i=new App.ControllerForm({el:this.$(".base-inbound-settings"),model:{configure_attributes:e,className:""},params:this.account.inbound,handlers:[s]}),this.toggleInboundAdapter(),i.el.find("select[name='options::ssl']").off("change").on("change",(function(t){return"ssl"===$(t.target).val()?i.el.find("[name='options::port']").val("993"):"off"===$(t.target).val()?i.el.find("[name='options::port']").val("143"):void 0}))},e.prototype.toggleInboundAdapter=function(){var t,e,n;return t=(e=this.$(".base-inbound-settings")).find("select[name='adapter']"),n=e.find("select[name='options::ssl'] option[value='starttls']"),"imap"!==t.val()?n.remove():n.length<1?(n=$("<option/>").attr("value","starttls").text(__("STARTTLS")),e.find("select[name='options::ssl']").append(n)):void 0},e.prototype.toggleOutboundAdapter=function(){var t,e;if(t={options:{}},this.account.meta&&(t.options.user=this.account.meta.email,t.options.password=this.account.meta.password,t.options.folder=this.account.meta.folder,t.options.keep_on_server=this.account.meta.keep_on_server),this.$(".base-outbound-settings").html(""),"smtp"===this.$(".js-outbound [name=adapter]").val())return e=[{name:"options::host",display:__("Host"),tag:"input",type:"text",limit:120,null:!1,autocapitalize:!1,autofocus:!0},{name:"options::user",display:__("User"),tag:"input",type:"text",limit:120,null:!0,autocapitalize:!1,autocomplete:"off"},{name:"options::password",display:__("Password"),tag:"input",type:"password",limit:120,null:!0,autocapitalize:!1,autocomplete:"new-password",single:!0},{name:"options::port",display:__("Port"),tag:"input",type:"text",limit:6,null:!0,autocapitalize:!1,item_class:"formGroup--halfSize"},{name:"options::ssl_verify",display:__("SSL verification"),tag:"boolean",default:!0,null:!0,translate:!0,item_class:"formGroup--halfSize"}],this.form=new App.ControllerForm({el:this.$(".base-outbound-settings"),model:{configure_attributes:e,className:""},params:this.account.outbound})},e.prototype.toggleSslVerifyVisibility=function(t){var e,n,i;return n="off"!==(e=$(t.target)).val(),i=e.closest("form").find('[name="options::ssl_verify"]'),n?i.removeAttr("disabled"):i.attr("disabled","disabled"),this.toggleSslVerifyAlert({target:i},!n)},e.prototype.toggleSslVerifyAlert=function(t,e){var n,i;return n=$(t.target),i=!e&&"true"!==n.val(),n.closest(".modal-content").find(".js-sslVerifyAlert").toggleClass("hide",!i)},e.prototype.showSlide=function(t){var n,i;if(e.__super__.showSlide.apply(this,arguments),1===(i=(n=this.$("."+t)).find('[name="options::ssl_verify"]')).length&&"true"!==i.val())return n.find(".js-sslVerifyAlert").removeClass("hide")},e.prototype.probeBasedOnIntro=function(t){var e,n;return t.preventDefault(),e=this.formParam(t.target),this.account.meta=e,this.channel&&(e.channel_id=this.channel.id),$(t.currentTarget).hasClass("js-expert")?(this.showSlide("js-inbound"),this.$('.js-inbound [name="options::user"]').val(e.email),this.$('.js-inbound [name="options::password"]').val(e.password),this.$('.js-inbound [name="options::email"]').val(e.email),this.$('.js-inbound [name="options::realname"]').val(e.realname),void this.$('.js-inbound [name="options::group_id"]').val(e.group_id)):(this.disable(t),this.$(".js-probe .js-email").text(e.email),this.showSlide("js-probe"),this.ajax({id:"email_probe",type:"POST",url:this.apiPath+"/channels_email_probe",data:JSON.stringify(e),processData:!0,success:(n=this,function(e){var i,s,r;if("ok"===e.result){if(e.setting)for(i in s=e.setting)r=s[i],n.account[i]=r;e.content_messages&&e.content_messages>0&&(!n.account.inbound.options||!0!==n.account.inbound.options.keep_on_server)?(n.probeInboundMessagesFound(e,!0),n.probeInboundArchive(e)):n.verify(n.account)}else"duplicate"===e.result?(n.showSlide("js-intro"),n.showAlert("js-intro",__("Account already exists!"))):(n.showSlide("js-inbound"),n.showAlert("js-inbound",__("The server settings could not be automatically detected. Please configure them manually.")),n.$('.js-inbound [name="options::user"]').val(n.account.meta.email),n.$('.js-inbound [name="options::password"]').val(n.account.meta.password),n.$('.js-inbound [name="options::email"]').val(n.account.meta.email),n.$('.js-inbound [name="options::realname"]').val(n.account.meta.realname),n.$('.js-inbound [name="options::group_id"]').val(n.account.meta.group_id));return n.enable(t)}),error:function(e){return function(){return e.enable(t),e.showSlide("js-intro")}}(this)}))},e.prototype.probeInbound=function(t){var e,n;return t.preventDefault(),(e=this.formParam(t.target)).options&&e.options.password===this.passwordPlaceholder&&(e.options.password=this.inboundPassword),this.account.meta.realname=e.options.realname,this.account.meta.email=e.options.email,this.account.meta.group_id=e.options.group_id,this.channel&&(e.channel_id=this.channel.id),this.disable(t),this.showSlide("js-test"),this.ajax({id:"email_inbound",type:"POST",url:this.apiPath+"/channels_email_inbound",data:JSON.stringify(e),processData:!0,success:(n=this,function(i){return"ok"===i.result?(n.account.inbound=e,i.content_messages&&i.content_messages>0&&(!n.account.inbound.options||!0!==n.account.inbound.options.keep_on_server)?(n.probeInboundMessagesFound(i),n.probeInboundArchive(i)):n.showSlide("js-outbound"),n.channel||(n.account.inbound.options?(n.$('.js-outbound [name="options::host"]').val(n.account.inbound.options.host),n.$('.js-outbound [name="options::user"]').val(n.account.inbound.options.user),n.$('.js-outbound [name="options::password"]').val(n.account.inbound.options.password)):(n.$('.js-outbound [name="options::user"]').val(n.account.meta.email),n.$('.js-outbound [name="options::password"]').val(n.account.meta.password)))):(n.showSlide("js-inbound"),n.showAlert("js-inbound",i.message_human||i.message),n.showInvalidField("js-inbound",i.invalid_field)),n.enable(t)}),error:function(e){return function(n){var i;return i=JSON.parse(n.responseText),e.showSlide("js-inbound"),e.showAlert("js-inbound",i.message_human||i.message||i.error),e.showInvalidField("js-inbound",i.invalid_field),e.enable(t)}}(this)})},e.prototype.probeInboundMessagesFound=function(t,e){var n,i;return n=App.i18n.translateContent("We have already found %s email(s) in your mailbox. We will move them all from your mailbox into Zammad.",t.content_messages),this.$(".js-inbound-acknowledge .js-messageFound").html(n),e?(this.$(".js-inbound-acknowledge .js-back").attr("data-slide","js-intro"),this.$(".js-inbound-acknowledge .js-next").attr("data-slide",""),this.$(".js-inbound-acknowledge .js-next").off("click.verify").on("click.verify",(i=this,function(t){return t.preventDefault(),i.verify(i.account)}))):(this.$(".js-inbound-acknowledge .js-back").attr("data-slide","js-inbound"),this.$(".js-inbound-acknowledge .js-next").off("click.verify")),this.showSlide("js-inbound-acknowledge")},e.prototype.probeInboundArchive=function(t){var e,n,i;if(!0===t.archive_possible)return this.$(".js-archiveMessage").removeClass("hide"),n=App.i18n.translateContent('In addition, we have found emails in your mailbox that are older than %s weeks. You can import such emails as an "archive", which means that no notifications are sent and the tickets have the status "closed". However, you can find them in Zammad anytime using the search function.',t.archive_week_range),this.$(".js-inbound-acknowledge .js-archiveMessageCount").html(n),e=[{name:"archive",tag:"boolean",null:!0,default:!1,options:{true:"archive",false:"regular"},translate:!0}],new App.ControllerForm({elReplace:this.$(".js-importTypeSelect"),model:{configure_attributes:e,className:""},noFieldset:!0}),this.$(".js-importTypeSelect select[name=archive]").on("change",(i=this,function(t){var e,n,s;return s=$(t.target).val(),(e=i.account).inbound||(e.inbound={}),(n=i.account.inbound).options||(n.options={}),"true"===s?(i.account.inbound.options.archive=!0,i.account.inbound.options.archive_before=(new Date).toISOString()):(delete i.account.inbound.options.archive,delete i.account.inbound.options.archive_before)})),this.$(".js-importTypeSelect select[name=archive]").trigger("change");this.$(".js-archiveMessage").addClass("hide")},e.prototype.probleOutbound=function(t){var e,n,i;return t.preventDefault(),(n=this.formParam(t.target)).email=this.account.meta.email,n.options&&n.options.password===this.passwordPlaceholder&&(n.options.password=this.outboundPassword),!n.email&&this.channel&&(e=App.EmailAddress.search({filter:{channel_id:this.channel.id}}))&&e[0]&&(n.email=e[0].email),this.channel&&(n.channel_id=this.channel.id),this.disable(t),this.showSlide("js-test"),this.ajax({id:"email_outbound",type:"POST",url:this.apiPath+"/channels_email_outbound",data:JSON.stringify(n),processData:!0,success:(i=this,function(e){return"ok"===e.result?(i.account.outbound=n,i.verify(i.account)):(i.showSlide("js-outbound"),i.showAlert("js-outbound",e.message_human||e.message),i.showInvalidField("js-outbound",e.invalid_field)),i.enable(t)}),error:function(e){return function(n){var i;return i=JSON.parse(n.responseText),e.showSlide("js-outbound"),e.showAlert("js-outbound",i.message_human||i.message||i.error),e.showInvalidField("js-outbound",i.invalid_field),e.enable(t)}}(this)})},e.prototype.verify=function(t,e){var n,i;return null==e&&(e=0),this.showSlide("js-verify"),this.channel&&(t.channel_id=this.channel.id),t.meta.group_id?t.group_id=t.meta.group_id:this.channel.group_id&&(t.group_id=this.channel.group_id),!t.email&&this.channel&&(n=App.EmailAddress.search({filter:{channel_id:this.channel.id}}))&&n[0]&&(t.email=n[0].email),this.ajax({id:"email_verify",type:"POST",url:this.apiPath+"/channels_email_verify",data:JSON.stringify(t),processData:!0,success:(i=this,function(t){return"ok"===t.result?i.el.modal("hide"):"inbound"===t.source||"outbound"===t.source?(i.showSlide("js-"+t.source),i.showAlert("js-"+t.source,t.message_human||t.message),i.showInvalidField("js-"+t.source,t.invalid_field)):2===e?(i.showAlert("js-verify",t.message_human||t.message),i.delay((function(){return i.showSlide("js-intro"),i.showAlert("js-intro",__("Email sending and receiving could not be verified. Please check your settings."))}),2300)):(t.subject&&i.account&&(i.account.subject=t.subject),i.verify(i.account,e+1))}),error:function(t){return function(){return t.showSlide("js-intro"),t.showAlert("js-intro",__("Email sending and receiving could not be verified. Please check your settings."))}}(this)})},e.prototype.hide=function(t){return t.preventDefault(),this.el.modal("hide")},e}(App.ControllerWizardModal),s=function(t){function e(){var t;this.probleOutbound=a(this.probleOutbound,this),this.toggleOutboundAdapter=a(this.toggleOutboundAdapter,this),this.render=a(this.render,this),e.__super__.constructor.apply(this,arguments),this.account={inbound:{adapter:void 0,options:void 0},outbound:{adapter:void 0,options:void 0},meta:{}},this.channel&&(this.account={inbound:clone(this.channel.options.inbound),outbound:clone(this.channel.options.outbound)},this.account.inbound&&this.account.inbound.options&&this.account.inbound.options.password&&(this.inboundPassword=this.account.inbound.options.password,this.account.inbound.options.password=this.passwordPlaceholder),this.account.outbound&&this.account.outbound.options&&this.account.outbound.options.password&&(this.outboundPassword=this.account.outbound.options.password,this.account.outbound.options.password=this.passwordPlaceholder)),this.container&&this.el.addClass("modal--local"),this.render(),this.toggleSslVerifyAlert({target:this.el.find('[name="options::ssl_verify"]')}),this.el.modal({keyboard:!0,show:!0,backdrop:!0,container:this.container}).on({"show.bs.modal":this.onShow,"shown.bs.modal":(t=this,function(){if(t.el.addClass("modal--ready"),t.onShown)return t.onShown()}),"hidden.bs.modal":function(t){return function(){return t.callback&&t.callback(),t.el.remove()}}(this)}),this.slide&&this.showSlide(this.slide)}return r(e,t),e.prototype.elements={".modal-body":"body"},e.prototype.events={'change [name="options::ssl_verify"]':"toggleSslVerifyAlert","change .js-outbound [name=adapter]":"toggleOutboundAdapter","submit .js-outbound":"probleOutbound","click  .js-close":"hide"},e.prototype.inboundPassword="",e.prototype.outboundPassword="",e.prototype.passwordPlaceholder="{{{{{{{{{{{{SECRTE_PASSWORD}}}}}}}}}}}}",e.prototype.render=function(){var t;return this.html(App.view("channel/email_notification_wizard")()),this.showSlide("js-outbound"),t=[{name:"adapter",display:__("Send Mails via"),tag:"select",multiple:!1,null:!1,options:this.channelDriver.email.outbound,translate:!0}],new App.ControllerForm({el:this.$(".base-outbound-type"),model:{configure_attributes:t,className:""},params:{adapter:this.account.outbound.adapter||"sendmail"}}),this.toggleOutboundAdapter()},e.prototype.toggleOutboundAdapter=function(){var t;if(this.el.find(".base-outbound-settings").html(""),"smtp"===this.$(".js-outbound [name=adapter]").val())return t=[{name:"options::host",display:__("Host"),tag:"input",type:"text",limit:120,null:!1,autocapitalize:!1,autofocus:!0},{name:"options::user",display:__("User"),tag:"input",type:"text",limit:120,null:!0,autocapitalize:!1,autocomplete:"off"},{name:"options::password",display:__("Password"),tag:"input",type:"password",limit:120,null:!0,autocapitalize:!1,autocomplete:"new-password",single:!0},{name:"options::port",display:__("Port"),tag:"input",type:"text",limit:6,null:!0,autocapitalize:!1,item_class:"formGroup--halfSize"},{name:"options::ssl_verify",display:__("SSL verification"),tag:"boolean",default:!0,null:!0,translate:!0,item_class:"formGroup--halfSize"}],this.form=new App.ControllerForm({el:this.$(".base-outbound-settings"),model:{configure_attributes:t,className:""},params:this.account.outbound})},e.prototype.toggleSslVerifyAlert=function(t,e){var n,i;return n=$(t.target),i=!e&&"true"!==n.val(),n.closest(".modal-content").find(".js-sslVerifyAlert").toggleClass("hide",!i)},e.prototype.probleOutbound=function(t){var e,n;return t.preventDefault(),(e=this.formParam(t.target)).options&&e.options.password===this.passwordPlaceholder&&(e.options.password=this.outboundPassword),e.channel_id=this.channel.id,this.disable(t),this.showSlide("js-test"),this.ajax({id:"email_outbound",type:"POST",url:this.apiPath+"/channels_email_notification",data:JSON.stringify(e),processData:!0,success:(n=this,function(e){return"ok"===e.result?n.el.modal("hide"):(n.showSlide("js-outbound"),n.showAlert("js-outbound",e.message_human||e.message),n.showInvalidField("js-outbound",e.invalid_field)),n.enable(t)}),error:function(e){return function(n){var i;return i=JSON.parse(n.responseText),e.showSlide("js-outbound"),e.showAlert("js-outbound",i.message_human||i.message||i.error),e.showInvalidField("js-outbound",i.invalid_field),e.enable(t)}}(this)})},e}(App.ControllerWizardModal),App.Config.set("Email",{prio:3e3,name:__("Email"),parent:"#channels",target:"#channels/email",controller:t,permission:["admin.channel_email"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;n=function(n){function r(){this.enable=i(this.enable,this),this.disable=i(this.disable,this),this.delete=i(this.delete,this),this.edit=i(this.edit,this),this.configApp=i(this.configApp,this),this.show=i(this.show,this),this.render=i(this.render,this),this.load=i(this.load,this),r.__super__.constructor.apply(this,arguments),this.load()}return s(r,n),r.requiredPermission="admin.channel_facebook",r.prototype.header=__("Facebook"),r.prototype.events={"click .js-new":"new","click .js-edit":"edit","click .js-delete":"delete","click .js-disable":"disable","click .js-enable":"enable","click .js-configApp":"configApp"},r.prototype.load=function(){return this.startLoading(),this.ajax({id:"facebook_index",type:"GET",url:this.apiPath+"/channels_facebook",processData:!0,success:(t=this,function(e){return t.stopLoading(),App.Collection.loadAssets(e.assets),t.callbackUrl=e.callback_url,t.render(e)})});var t},r.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f;if(App.ExternalCredential.findByAttribute("name","facebook")){for(i=[],r=0,a=(h=t.channel_ids).length;r<a;r++){if(n=h[r],(e=App.Channel.find(n))&&e.options&&e.options.sync&&(s="-",e.options.sync||(e.options.sync={}),e.options&&e.options.pages))for(o=0,l=(d=e.options.pages).length;o<l;o++)for(p in c=d[o],s="-",f=e.options.sync.pages)u=f[p],c.id===p&&u.group_id&&(s=App.Group.find(u.group_id).displayName(),c.groupName=s);i.push(e)}return this.html(App.view("facebook/list")({channels:i})),this.channel_id?(this.edit(void 0,this.channel_id),this.channel_id=void 0):void 0}this.html(App.view("facebook/index")())},r.prototype.show=function(t){var e,n,i;for(e in n=[],t)i=t[e],"el"!==e&&"shown"!==e&&"match"!==e?n.push(this[e]=i):n.push(void 0);return n},r.prototype.configApp=function(){return new e({container:this.el.parents(".content"),callbackUrl:this.callbackUrl,load:this.load})},r.prototype.new=function(){return window.location.href=this.apiPath+"/external_credentials/facebook/link_account"},r.prototype.edit=function(e,n){var i;if(e&&(e.preventDefault(),n=$(e.target).closest(".action").data("id")),i=App.Channel.find(n))return new t({channel:i,container:this.el.parents(".content"),load:this.load});this.navigate("#channels/facebook")},r.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:(n=this,function(){return n.ajax({id:"facebook_delete",type:"DELETE",url:n.apiPath+"/channels_facebook",data:JSON.stringify({id:e}),processData:!0,success:function(){return n.load()}})}),container:this.el.closest(".content")})},r.prototype.disable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"facebook_disable",type:"POST",url:this.apiPath+"/channels_facebook_disable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r.prototype.enable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"facebook_enable",type:"POST",url:this.apiPath+"/channels_facebook_enable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r}(App.ControllerSubContent),e=function(t){function e(){return this.onSubmit=i(this.onSubmit,this),this.onClosed=i(this.onClosed,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.head=__("Connect Facebook App"),e.prototype.shown=!0,e.prototype.button="Connect",e.prototype.buttonCancel=!0,e.prototype.small=!0,e.prototype.content=function(){var t,e;return this.external_credential=App.ExternalCredential.findByAttribute("name","facebook"),(t=$(App.view("facebook/app_config")({external_credential:this.external_credential,callbackUrl:this.callbackUrl}))).find(".js-select").on("click",(e=this,function(t){return e.selectAll(t)})),t},e.prototype.onClosed=function(){if(this.isChanged)return this.isChanged=!1,this.load()},e.prototype.onSubmit=function(t){return this.formDisable(t),this.ajax({id:"facebook_app_verify",type:"POST",url:this.apiPath+"/external_credentials/facebook/app_verify",data:JSON.stringify(this.formParams()),processData:!0,success:(e=this,function(n){return n.attributes?(e.external_credential||(e.external_credential=new App.ExternalCredential),e.external_credential.load({name:"facebook",credentials:e.formParams()}),void e.external_credential.save({done:function(){return e.isChanged=!0,e.close()},fail:function(){return e.el.find(".alert").removeClass("hidden").text(__("The entry could not be created."))}})):(e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(n.error||__("App could not be verified.")))})});var e},e}(App.ControllerModal),t=function(t){function e(){return this.onSubmit=i(this.onSubmit,this),this.onClosed=i(this.onClosed,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.head=__("Facebook Account"),e.prototype.shown=!0,e.prototype.buttonCancel=!0,e.prototype.content=function(){var t,e,n,i,s,r,o,a,l,c;if(this.channel.options.sync||(this.channel.options.sync={}),this.channel.options.sync.pages||(this.channel.options.sync.pages={}),t=$(App.view("facebook/account_edit")({channel:this.channel})),e=function(t,e,n){var i;return i=App.UiElement.tree_select.render({name:n+"::group_id",multiple:!1,limit:100,null:!1,relation:"Group",nulloption:!0,value:t,class:"form-control--small"}),e.html(i)},this.channel.options.pages)for(n=0,i=(l=this.channel.options.pages).length;n<i;n++){for(a in s=l[n],r=!1,c=this.channel.options.sync.pages)o=c[a],s.id===a&&(r=!0,e(o.group_id,t.find(".js-groups[data-page-id="+s.id+"]"),"pages::"+s.id));r||e("",t.find(".js-groups[data-page-id="+s.id+"]"),"pages::"+s.id)}return t},e.prototype.onClosed=function(){if(this.isChanged)return this.isChanged=!1,this.load()},e.prototype.onSubmit=function(t){return this.formDisable(t),this.channel.options.sync=this.formParams(),this.ajax({id:"channel_facebook_update",type:"POST",url:this.apiPath+"/channels_facebook/"+this.channel.id,data:JSON.stringify(this.channel.attributes()),processData:!0,success:(e=this,function(){return e.isChanged=!0,e.close()}),error:function(e){return function(n){var i;return i=JSON.parse(n.responseText),e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(i.error||__("The changes could not be saved."))}}(this)});var e},e}(App.ControllerModal),App.Config.set("Facebook",{prio:5100,name:__("Facebook"),parent:"#channels",target:"#channels/facebook",controller:n,permission:["admin.channel_facebook"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.updateGroup=e(this.updateGroup,this),this.toggleFormSetting=e(this.toggleFormSetting,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),App.Setting.fetchFull(this.render,{force:!1})}return n(i,t),i.requiredPermission="admin.channel_formular",i.prototype.header=__("Form"),i.prototype.events={"change form.js-paramsDesigner":"updateParamsDesigner","keyup form.js-paramsDesigner":"updateParamsDesigner","change .js-formSetting input":"toggleFormSetting","change .js-paramsSetting select":"updateGroup"},i.prototype.elements={".js-code":"code",".js-paramsSetting":"paramsSetting",".js-formSetting input":"formSetting"},i.prototype.render=function(){var t,e,n,i,s;return s=App.Setting.get("form_ticket_create"),e=$(App.view("channel/form")({baseurl:window.location.origin,formSetting:s})),n=App.Setting.get("form_ticket_create_group_id"),i=App.UiElement.tree_select.render({name:"group_id",multiple:!1,null:!1,relation:"Group",nulloption:!1,value:n}),t=App.UiElement.richtext.render({name:"agreementMessage",buttons:["link"],null:!1,noImages:!0,id:"form-message-agreement",tag:"richtext",value:__("Accept Data Privacy Policy & Acceptable Use Policy")}),e.find(".js-groupSelector").html(i),e.find(".agreement-support-text").html(t),this.html(e),this.code.each((function(t,e){return hljs.highlightBlock(e)})),this.updateParamsDesigner()},i.prototype.updateParamsDesigner=function(){var t,e,n,i,s;for(t in i=function(t){return t.replace("'","\\'").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")},n=this.formParam(this.$(".js-paramsDesigner")),this.$("#agreementSupport").prop("checked")?this.$(".agreement-support-text").removeClass("hide"):(this.$(".agreement-support-text").addClass("hide"),delete n.agreementMessage),e="",n)s=n[t],_.isEmpty(s)||(""!==e&&(e+=",\n"),e+="true"===s||"false"===s?"    "+t+": "+s:"    "+t+": '"+i(s)+"'");return this.$(".js-modal-params").html(e),n.test=!0,n.modal?(this.$(".js-modal").removeClass("hide"),this.$(".js-inlineForm").addClass("hide"),this.$(".js-formInline").addClass("hide"),this.$(".js-formBtn").removeClass("hide"),this.$(".js-formBtn").ZammadForm(n),this.$(".js-formBtn").text("Feedback"),this.$(".js-formInline").toggleClass("no-css",!!n.noCSS)):(this.$(".js-modal").addClass("hide"),this.$(".js-inlineForm").removeClass("hide"),this.$(".js-formBtn").addClass("hide"),this.$(".js-formInline").removeClass("hide"),this.$(".js-formInline").ZammadForm(n),this.$(".js-formInline").toggleClass("no-css",!!n.noCSS))},i.prototype.toggleFormSetting=function(){var t;return t=this.formSetting.prop("checked"),App.Setting.set("form_ticket_create",t)},i.prototype.updateGroup=function(){var t;return t=this.paramsSetting.find("[name=group_id]").val(),App.Setting.set("form_ticket_create_group_id",t)},i}(App.ControllerSubContent),App.Config.set("Form",{prio:2e3,name:__("Form"),parent:"#channels",target:"#channels/form",controller:t,permission:["admin.channel_formular"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i,s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty,o=function(t,e){return function(){return t.apply(e,arguments)}};App.ChannelGoogle=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title(__("Google"),!0),this.tabs=[{name:__("Accounts"),target:"c-account",controller:e},{name:__("Filter"),target:"c-filter",controller:App.ChannelEmailFilter},{name:__("Signatures"),target:"c-signature",controller:App.ChannelEmailSignature},{name:__("Settings"),target:"c-setting",controller:App.SettingsArea,params:{area:"Email::Base"}}],this.render()}return s(n,t),n.requiredPermission="admin.channel_google",n.prototype.header=__("Google"),n}(App.ControllerTabs),e=function(e){function r(){this.emailAddressDelete=o(this.emailAddressDelete,this),this.emailAddressEdit=o(this.emailAddressEdit,this),this.emailAddressNew=o(this.emailAddressNew,this),this.groupChange=o(this.groupChange,this),this.rollbackMigration=o(this.rollbackMigration,this),this.editInbound=o(this.editInbound,this),this.enable=o(this.enable,this),this.disable=o(this.disable,this),this.reauthenticate=o(this.reauthenticate,this),this.delete=o(this.delete,this),this.configApp=o(this.configApp,this),this.show=o(this.show,this),this.render=o(this.render,this),this.load=o(this.load,this),r.__super__.constructor.apply(this,arguments),this.interval(this.load,3e4),this.load()}return s(r,e),r.requiredPermission="admin.channel_google",r.prototype.events={"click .js-new":"new","click .js-delete":"delete","click .js-reauthenticate":"reauthenticate","click .js-configApp":"configApp","click .js-disable":"disable","click .js-enable":"enable","click .js-channelGroupChange":"groupChange","click .js-editInbound":"editInbound","click .js-rollbackMigration":"rollbackMigration","click .js-emailAddressNew":"emailAddressNew","click .js-emailAddressEdit":"emailAddressEdit","click .js-emailAddressDelete":"emailAddressDelete"},r.prototype.load=function(t){return null==t&&(t=!1),t&&(this.channel_id=void 0,this.navigate("#channels/google")),this.startLoading(),this.ajax({id:"google_index",type:"GET",url:this.apiPath+"/channels_google",processData:!0,success:(e=this,function(t){return e.stopLoading(),App.Collection.loadAssets(t.assets),e.callbackUrl=t.callback_url,e.render(t)})});var e},r.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f
;if(!(o=App.ExternalCredential.findByAttribute("name","google")))return this.html(App.view("google/index")()),void(this.channel_id&&this.configApp());for(i=[],a=0,u=(d=t.channel_ids).length;a<u;a++)n=d[a],(e=App.Channel.find(n)).group_id?e.group=App.Group.find(e.group_id):e.group="-",r=App.EmailAddress.search({filter:{channel_id:e.id}}),e.email_addresses=r,i.push(e);if(!this.channel_id||!(l=App.Channel.find(this.channel_id))||"Google::Account"===l.area){for(h=[],c=0,p=(f=t.not_used_email_address_ids).length;c<p;c++)s=f[c],h.push(App.EmailAddress.find(s));return this.html(App.view("google/list")({channels:i,external_credential:o,not_used_email_addresses:h})),this.channel_id&&(l=App.Channel.find(this.channel_id))&&"Google::Account"===l.area&&l.options&&void 0===l.options.backup_imap_classic?(this.editInbound(void 0,this.channel_id,!0),this.channel_id=void 0):void 0}this.new()},r.prototype.show=function(t){var e,n,i;for(e in n=[],t)i=t[e],"el"!==e&&"shown"!==e&&"match"!==e?n.push(this[e]=i):n.push(void 0);return n},r.prototype.configApp=function(){return new t({container:this.el.parents(".content"),callbackUrl:this.callbackUrl,load:this.load})},r.prototype.new=function(){return window.location.href=this.apiPath+"/external_credentials/google/link_account"},r.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:(n=this,function(){return n.ajax({id:"google_delete",type:"DELETE",url:n.apiPath+"/channels_google",data:JSON.stringify({id:e}),processData:!0,success:function(){return n.load()}})}),container:this.el.closest(".content")})},r.prototype.reauthenticate=function(t){var e;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),window.location.href=this.apiPath+"/external_credentials/google/link_account?channel_id="+e},r.prototype.disable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"google_disable",type:"POST",url:this.apiPath+"/channels_google_disable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r.prototype.enable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"google_enable",type:"POST",url:this.apiPath+"/channels_google_enable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r.prototype.editInbound=function(t,e,n){var s;return e||(t.preventDefault(),e=$(t.target).closest(".action").data("id")),s=App.Channel.find(e),new i({container:this.el.closest(".content"),item:s,callback:this.load,set_active:n})},r.prototype.rollbackMigration=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"google_rollback_migration",type:"POST",url:this.apiPath+"/channels_google_rollback_migration",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load(),n.notify({type:"success",msg:__("Rollback of channel migration succeeded!")})}),error:function(t){return function(){return t.notify({type:"error",msg:__("Failed to roll back the migration of the channel!")})}}(this)})},r.prototype.groupChange=function(t){var e,i;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),i=App.Channel.find(e),new n({container:this.el.closest(".content"),item:i,callback:this.load})},r.prototype.emailAddressNew=function(t){var e;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerGenericNew({pageData:{object:__("Email Address")},genericObject:"EmailAddress",container:this.el.closest(".content"),item:{channel_id:e},callback:this.load})},r.prototype.emailAddressEdit=function(t){var e;return t.preventDefault(),e=$(t.target).closest("li").data("id"),new App.ControllerGenericEdit({pageData:{object:__("Email Address")},genericObject:"EmailAddress",container:this.el.closest(".content"),id:e,callback:this.load})},r.prototype.emailAddressDelete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest("li").data("id"),n=App.EmailAddress.find(e),new App.ControllerGenericDestroyConfirm({item:n,container:this.el.closest(".content"),callback:this.load})},r}(App.ControllerSubContent),i=function(t){function e(){return this.onSubmit=o(this.onSubmit,this),this.content=o(this.content,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=!0,e.prototype.head=__("Channel"),e.prototype.content=function(){var t;return t=[{name:"options::folder",display:__("Folder"),tag:"input",type:"text",limit:120,null:!0,autocapitalize:!1,placeholder:__("optional")},{name:"options::keep_on_server",display:__("Keep messages on server"),tag:"boolean",null:!0,options:{true:"yes",false:"no"},translate:!0,default:!1}],this.form=new App.ControllerForm({model:{configure_attributes:t,className:""},params:this.item.options.inbound}),this.form.form},e.prototype.onSubmit=function(t){var e,n,i;return this.startLoading(),n=this.formParam(t.target),(e=this.form.validate(n))?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),this.set_active&&(n.active=!0),this.ajax({id:"channel_email_inbound",type:"POST",url:this.apiPath+"/channels_google_inbound/"+this.item.id,data:JSON.stringify(n),processData:!0,success:(i=this,function(){return i.callback(!0),i.close()}),error:function(e){return function(n){var i;return e.stopLoading(),e.formEnable(t),i=n.responseJSON||{},e.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("The changes could not be saved.")),timeout:6e3})}}(this)}))},e}(App.ControllerModal),n=function(t){function e(){return this.onSubmit=o(this.onSubmit,this),this.content=o(this.content,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=!0,e.prototype.head=__("Channel"),e.prototype.content=function(){var t;return t=[{name:"group_id",display:__("Destination Group"),tag:"tree_select",null:!1,relation:"Group",nulloption:!0,filter:{active:!0}}],this.form=new App.ControllerForm({model:{configure_attributes:t,className:""},params:this.item}),this.form.form},e.prototype.onSubmit=function(t){var e,n,i;return n=this.formParam(t.target),(e=this.form.validate(n))?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),this.ajax({id:"channel_email_group",type:"POST",url:this.apiPath+"/channels_google_group/"+this.item.id,data:JSON.stringify(n),processData:!0,success:(i=this,function(){return i.callback(),i.close()}),error:function(e){return function(n){var i;return i=JSON.parse(n.responseText),e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(i.error||__("The changes could not be saved."))}}(this)}))},e}(App.ControllerModal),t=function(t){function e(){return this.onSubmit=o(this.onSubmit,this),this.onClosed=o(this.onClosed,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.head=__("Connect Google App"),e.prototype.shown=!0,e.prototype.button="Connect",e.prototype.buttonCancel=!0,e.prototype.small=!0,e.prototype.content=function(){var t,e;return this.external_credential=App.ExternalCredential.findByAttribute("name","google"),(t=$(App.view("google/app_config")({external_credential:this.external_credential,callbackUrl:this.callbackUrl}))).find(".js-select").on("click",(e=this,function(t){return e.selectAll(t)})),t},e.prototype.onClosed=function(){if(this.isChanged)return this.isChanged=!1,this.load()},e.prototype.onSubmit=function(t){return this.formDisable(t),this.ajax({id:"google_app_verify",type:"POST",url:this.apiPath+"/external_credentials/google/app_verify",data:JSON.stringify(this.formParams()),processData:!0,success:(e=this,function(n){return n.attributes?(e.external_credential||(e.external_credential=new App.ExternalCredential),e.external_credential.load({name:"google",credentials:n.attributes}),void e.external_credential.save({done:function(){return e.isChanged=!0,e.close()},fail:function(){return e.el.find(".alert").removeClass("hidden").text(__("The entry could not be created."))}})):(e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(n.error||__("App could not be verified.")))})});var e},e}(App.ControllerModal),App.Config.set("google",{prio:5e3,name:__("Google"),parent:"#channels",target:"#channels/google",controller:App.ChannelGoogle,permission:["admin.channel_google"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i,s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty,o=function(t,e){return function(){return t.apply(e,arguments)}};App.ChannelMicrosoft365=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title(__("Microsoft 365"),!0),this.tabs=[{name:__("Accounts"),target:"c-account",controller:e},{name:__("Filter"),target:"c-filter",controller:App.ChannelEmailFilter},{name:__("Signatures"),target:"c-signature",controller:App.ChannelEmailSignature},{name:__("Settings"),target:"c-setting",controller:App.SettingsArea,params:{area:"Email::Base"}}],this.render()}return s(n,t),n.requiredPermission="admin.channel_microsoft365",n.prototype.header=__("Microsoft 365"),n}(App.ControllerTabs),e=function(e){function r(){this.emailAddressDelete=o(this.emailAddressDelete,this),this.emailAddressEdit=o(this.emailAddressEdit,this),this.emailAddressNew=o(this.emailAddressNew,this),this.groupChange=o(this.groupChange,this),this.rollbackMigration=o(this.rollbackMigration,this),this.editInbound=o(this.editInbound,this),this.enable=o(this.enable,this),this.disable=o(this.disable,this),this.reauthenticate=o(this.reauthenticate,this),this.delete=o(this.delete,this),this.configApp=o(this.configApp,this),this.show=o(this.show,this),this.render=o(this.render,this),this.load=o(this.load,this),r.__super__.constructor.apply(this,arguments),this.interval(this.load,3e4),this.load()}return s(r,e),r.requiredPermission="admin.channel_microsoft365",r.prototype.events={"click .js-new":"new","click .js-admin-consent":"adminConsent","click .js-delete":"delete","click .js-reauthenticate":"reauthenticate","click .js-configApp":"configApp","click .js-disable":"disable","click .js-enable":"enable","click .js-channelGroupChange":"groupChange","click .js-editInbound":"editInbound","click .js-rollbackMigration":"rollbackMigration","click .js-emailAddressNew":"emailAddressNew","click .js-emailAddressEdit":"emailAddressEdit","click .js-emailAddressDelete":"emailAddressDelete"},r.prototype.load=function(t){return null==t&&(t=!1),t&&(this.channel_id=void 0,this.navigate("#channels/microsoft365")),this.startLoading(),this.ajax({id:"microsoft365_index",type:"GET",url:this.apiPath+"/channels_microsoft365",processData:!0,success:(e=this,function(t){return e.stopLoading(),App.Collection.loadAssets(t.assets),e.callbackUrl=t.callback_url,e.render(t)})});var e},r.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f;if(!(o=App.ExternalCredential.findByAttribute("name","microsoft365")))return this.html(App.view("microsoft365/index")()),void(this.channel_id&&this.configApp());for(i=[],a=0,u=(d=t.channel_ids).length;a<u;a++)n=d[a],(e=App.Channel.find(n)).group_id?e.group=App.Group.find(e.group_id):e.group="-",r=App.EmailAddress.search({filter:{channel_id:e.id}}),e.email_addresses=r,i.push(e);if(!this.channel_id||!(l=App.Channel.find(this.channel_id))||"Microsoft365::Account"===l.area){for(h=[],c=0,p=(f=t.not_used_email_address_ids).length;c<p;c++)s=f[c],h.push(App.EmailAddress.find(s));return this.html(App.view("microsoft365/list")({channels:i,external_credential:o,not_used_email_addresses:h})),this.channel_id&&(l=App.Channel.find(this.channel_id))&&"Microsoft365::Account"===l.area&&l.options&&void 0===l.options.backup_imap_classic&&(this.editInbound(void 0,this.channel_id,!0),this.channel_id=void 0),"AADSTS65004"===this.error_code&&(this.error_code=void 0,new App.AdminConsentInfo({container:this.container})),"user_mismatch"===this.error_code?(this.error_code=void 0,new App.UserMismatchInfo({container:this.container})):void 0}this.new()},r.prototype.show=function(t){var e,n,i;for(e in n=[],t)i=t[e],"el"!==e&&"shown"!==e&&"match"!==e?n.push(this[e]=i):n.push(void 0);return n},r.prototype.configApp=function(){return new t({container:this.el.parents(".content"),callbackUrl:this.callbackUrl,load:this.load})},r.prototype.new=function(){return window.location.href=this.apiPath+"/external_credentials/microsoft365/link_account"},r.prototype.adminConsent=function(){return window.location.href=this.apiPath+"/external_credentials/microsoft365/link_account?prompt=consent"},r.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:(n=this,function(){return n.ajax({id:"microsoft365_delete",type:"DELETE",url:n.apiPath+"/channels_microsoft365",data:JSON.stringify({id:e}),processData:!0,success:function(){return n.load()}})}),container:this.el.closest(".content")})},r.prototype.reauthenticate=function(t){var e;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),window.location.href=this.apiPath+"/external_credentials/microsoft365/link_account?channel_id="+e},r.prototype.disable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"microsoft365_disable",type:"POST",url:this.apiPath+"/channels_microsoft365_disable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r.prototype.enable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"microsoft365_enable",type:"POST",url:this.apiPath+"/channels_microsoft365_enable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r.prototype.editInbound=function(t,e,n){var s;return e||(t.preventDefault(),e=$(t.target).closest(".action").data("id")),s=App.Channel.find(e),new i({container:this.el.closest(".content"),item:s,callback:this.load,set_active:n})},r.prototype.rollbackMigration=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"microsoft365_rollback_migration",type:"POST",url:this.apiPath+"/channels_microsoft365_rollback_migration",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load(),n.notify({type:"success",msg:__("Rollback of channel migration succeeded!")})}),error:function(t){return function(){return t.notify({type:"error",msg:__("Failed to roll back the migration of the channel!")})}}(this)})},r.prototype.groupChange=function(t){var e,i;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),i=App.Channel.find(e),new n({container:this.el.closest(".content"),item:i,callback:this.load})},r.prototype.emailAddressNew=function(t){var e;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerGenericNew({pageData:{object:__("Email Address")},genericObject:"EmailAddress",container:this.el.closest(".content"),item:{channel_id:e},callback:this.load})},r.prototype.emailAddressEdit=function(t){var e;return t.preventDefault(),e=$(t.target).closest("li").data("id"),new App.ControllerGenericEdit({pageData:{object:__("Email Address")},genericObject:"EmailAddress",container:this.el.closest(".content"),id:e,callback:this.load})},r.prototype.emailAddressDelete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest("li").data("id"),n=App.EmailAddress.find(e),new App.ControllerGenericDestroyConfirm({item:n,container:this.el.closest(".content"),callback:this.load})},r}(App.ControllerSubContent),i=function(t){function e(){return this.onSubmit=o(this.onSubmit,this),this.content=o(this.content,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=!0,e.prototype.head=__("Channel"),e.prototype.content=function(){var t;return t=[{name:"options::folder",display:__("Folder"),tag:"input",type:"text",limit:120,null:!0,autocapitalize:!1},{name:"options::keep_on_server",display:__("Keep messages on server"),tag:"boolean",null:!0,options:{true:"yes",false:"no"},translate:!0,default:!1}],this.form=new App.ControllerForm({model:{configure_attributes:t,className:""},params:this.item.options.inbound}),this.form.form},e.prototype.onSubmit=function(t){var e,n,i;return this.startLoading(),n=this.formParam(t.target),(e=this.form.validate(n))?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),this.set_active&&(n.active=!0),this.ajax({id:"channel_email_inbound",type:"POST",url:this.apiPath+"/channels_microsoft365_inbound/"+this.item.id,data:JSON.stringify(n),processData:!0,success:(i=this,function(){return i.callback(!0),i.close()}),error:function(e){return function(n){var i;return e.stopLoading(),e.formEnable(t),i=n.responseJSON||{},e.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("The changes could not be saved.")),timeout:6e3})}}(this)}))},e}(App.ControllerModal),n=function(t){function e(){return this.onSubmit=o(this.onSubmit,this),this.content=o(this.content,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=!0,e.prototype.head=__("Channel"),e.prototype.content=function(){var t;return t=[{name:"group_id",display:__("Destination Group"),tag:"tree_select",null:!1,relation:"Group",nulloption:!0,filter:{active:!0}}],this.form=new App.ControllerForm({model:{configure_attributes:t,className:""},params:this.item}),this.form.form},e.prototype.onSubmit=function(t){var e,n,i;return n=this.formParam(t.target),(e=this.form.validate(n))?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),this.ajax({id:"channel_email_group",type:"POST",url:this.apiPath+"/channels_microsoft365_group/"+this.item.id,data:JSON.stringify(n),processData:!0,success:(i=this,function(){return i.callback(),i.close()}),error:function(e){return function(n){var i;return i=JSON.parse(n.responseText),e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(i.error||__("The changes could not be saved."))}}(this)}))},e}(App.ControllerModal),t=function(t){function e(){return this.onSubmit=o(this.onSubmit,this),this.onClosed=o(this.onClosed,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.head=__("Connect Microsoft 365 App"),e.prototype.shown=!0,e.prototype.button="Connect",e.prototype.buttonCancel=!0,e.prototype.small=!0,e.prototype.content=function(){var t,e;return this.external_credential=App.ExternalCredential.findByAttribute("name","microsoft365"),(t=$(App.view("microsoft365/app_config")({external_credential:this.external_credential,callbackUrl:this.callbackUrl}))).find(".js-select").on("click",(e=this,function(t){return e.selectAll(t)})),t},e.prototype.onClosed=function(){if(this.isChanged)return this.isChanged=!1,this.load()},e.prototype.onSubmit=function(t){return this.formDisable(t),this.ajax({id:"microsoft365_app_verify",type:"POST",url:this.apiPath+"/external_credentials/microsoft365/app_verify",data:JSON.stringify(this.formParams()),processData:!0,success:(e=this,function(n){return n.attributes?(e.external_credential||(e.external_credential=new App.ExternalCredential),e.external_credential.load({name:"microsoft365",credentials:n.attributes}),void e.external_credential.save({done:function(){return e.isChanged=!0,e.close()},fail:function(){return e.el.find(".alert").removeClass("hidden").text(__("The entry could not be created."))}})):(e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(n.error||__("App could not be verified.")))})});var e},e}(App.ControllerModal),App.AdminConsentInfo=function(t){function e(){return this.onSubmit=o(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.small=!0,e.prototype.buttonSubmit=__("Close"),e.prototype.head=__("Admin Consent"),e.prototype.content=function(){return App.view("microsoft365/admin_consent")()},e.prototype.onSubmit=function(){return this.close()},e}(App.ControllerModal),App.UserMismatchInfo=function(t){function e(){return this.onSubmit=o(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.small=!0,e.prototype.buttonSubmit=__("Close"),e.prototype.head=__("User Mismatch"),e.prototype.content=function(){return App.view("microsoft365/user_mismatch")()},e.prototype.onSubmit=function(){return this.close()},e}(App.ControllerModal),App.Config.set("microsoft365",{prio:5e3,name:__("Microsoft 365"),parent:"#channels",target:"#channels/microsoft365",controller:App.ChannelMicrosoft365,permission:["admin.channel_microsoft365"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i,s,r=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty,a=function(t,e){return function(){return t.apply(e,arguments)}};t=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.title(__("SMS"),!0),this.tabs=[{name:__("Accounts"),target:"c-account",controller:n}],this.render()}return r(e,t),e.requiredPermission="admin.channel_sms",e.prototype.header=__("SMS"),e}(App.ControllerTabs),n=function(t){function n(){this.editNotification=a(this.editNotification,this),this.enable=a(this.enable,this),this.disable=a(this.disable,this),this.delete=a(this.delete,this),this.change=a(this.change,this),this.render=a(this.render,this),this.load=a(this.load,this),n.__super__.constructor.apply(this,arguments),this.interval(this.load,3e4)}return r(n,t),n.prototype.events={"click .js-channelEdit":"change","click .js-channelDelete":"delete","click .js-channelDisable":"disable","click .js-channelEnable":"enable","click .js-editNotification":"editNotification"},n.prototype.load=function(){return this.startLoading(),this.ajax({id:"sms_index",type:"GET",url:this.apiPath+"/channels_sms",processData:!0,success:(t=this,function(e){return t.config=e.config,t.stopLoading(),App.Collection.loadAssets(e.assets),t.render(e)})});var t},n.prototype.render=function(t){var e,n,i,s,r,o,a,l;for(null==t&&(t={}),this.channelDriver=t.channel_driver,this.account_channels=[],i=0,r=(a=t.account_channel_ids).length;i<r;i++)n=a[i],(e=App.Channel.fullLocal(n)).group_id?e.group=App.Group.find(e.group_id):e.group="-",this.account_channels.push(e);for(this.notification_channels=[],s=0,o=(l=t.notification_channel_ids).length;s<o;s++)n=l[s],this.notification_channels.push(App.Channel.find(n));return this.html(App.view("channel/sms_account_overview")({account_channels:this.account_channels,notification_channels:this.notification_channels,config:this.config}))},n.prototype.change=function(t){var n,i;return t.preventDefault(),n=(i=$(t.target).closest(".action").data("id"))?App.Channel.find(i):new App.Channel({active:!0}),new e({container:this.el.closest(".content"),channel:n,callback:this.load,channelDriver:this.channelDriver,config:this.config})},n.prototype.delete=function(t){var e,n,i;return t.preventDefault(),n=$(t.target).closest(".action").data("id"),e=App.Channel.find(n),new App.ControllerGenericDestroyConfirm({item:e,options:{url:"/api/v1/channels_sms/"+e.id},container:this.el.closest(".content"),callback:(i=this,function(){return i.load()})})},n.prototype.disable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"sms_disable",type:"POST",url:this.apiPath+"/channels_sms_disable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},n.prototype.enable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"sms_enable",type:"POST",url:this.apiPath+"/channels_sms_enable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},n.prototype.editNotification=function(t){var e,n;return t.preventDefault(),n=$(t.target).closest(".action").data("id"),e=App.Channel.find(n),new i({container:this.el.closest(".content"),channel:e,callback:this.load,channelDriver:this.channelDriver,config:this.config})},n}(App.Controller),e=function(t){function e(){return this.onDelete=a(this.onDelete,this),e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.head=__("SMS Account"),e.prototype.buttonCancel=!0,e.prototype.centerButtons=[{text:__("Test"),className:"js-test"}],e.prototype.elements={form:"form",'select[name="options::adapter"]':"adapterSelect"},e.prototype.events={"click .js-test":"onTest"},e.prototype.content=function(){var t,e,n,i,s,r,o,a;for(e=$('<div><div class="js-channelAdapterSelector"></div><div class="js-channelWebhook"></div><div class="js-channelAdapterOptions"></div></div>'),s={},{},n=0,i=(r=this.config).length;n<i;n++)(t=r[n]).account&&(s[t.adapter]=t.name);return new App.ControllerForm({el:e.find(".js-channelAdapterSelector"),model:{configure_attributes:[{name:"options::adapter",display:__("Provider"),tag:"select",null:!1,options:s,nulloption:!0,translate:!0}],className:""},params:this.channel}),this.renderAdapterOptions(null!=(o=this.channel.options)?o.adapter:void 0,e),e.find('[name="options::adapter"]').on("change",(a=this,function(t){return a.renderAdapterOptions(t.target.value,e)})),e},e.prototype.renderAdapterOptions=function(t,e){var n,i,s,r,o,a,l,c,u,p,h;for(e.find(".js-channelWebhook").html(""),e.find(".js-channelAdapterOptions").html(""),s={},r=0,a=(u=this.config).length;r<a;r++)(i=u[r]).adapter===t&&i.account&&(s=i.account);if(!_.isEmpty(s)){if(_.isEmpty(this.channel.options)||_.isEmpty(this.channel.options.webhook_token))for((n=this.channel).options||(n.options={}),this.channel.options.webhook_token="?",o=0,l=s.length;o<l;o++)"options::webhook_token"===(c=s[o]).name&&(this.channel.options.webhook_token=c.default);return h=this.Config.get("http_type")+"://"+this.Config.get("fqdn")+"/api/v1/sms_webhook/"+(null!=(p=this.channel.options)?p.webhook_token:void 0),new App.ControllerForm({el:e.find(".js-channelWebhook"),model:{configure_attributes:[{name:"options::webhook",display:__("Webhook"),tag:"input",type:"text",limit:200,null:!1,default:h,disabled:!0}],className:""},params:this.channel}),new App.ControllerForm({el:e.find(".js-channelAdapterOptions"),model:{configure_attributes:s,className:""},params:this.channel})}},e.prototype.onDelete=function(){return!0===this.channel.isNew()?(this.close(),void this.callback()):new App.ControllerGenericDestroyConfirm({item:this.channel,options:{url:"/api/v1/channels_sms/"+this.channel.id},container:this.el.closest(".content"),callback:(t=this,function(){return t.close(),t.callback()})});var t},e.prototype.onSubmit=function(t){var e,n,i,s,r,o,a,l,c;if(t.preventDefault(),""!==this.adapterSelect.val()){for(i in this.formDisable(t),(e=this.channel).options||(e.options={}),o=this.formParam(this.el))if(c=o[i],"options"===i)for(s in c)r=c[s],(n=this.channel).options||(n.options={}),this.channel.options[s]=r;else this.channel[i]=c;return this.channel.area="Sms::Account",l="/api/v1/channels_sms",this.channel.isNew()||(l="/api/v1/channels_sms/"+this.channel.id),a=this,this.channel.save({url:l,done:function(){return a.formEnable(t),a.channel=App.Channel.find(this.id),a.close(),a.callback()},fail:function(e,n){return a.log("errors",n),a.formEnable(t),a.showAlert(n.error_human||n.error||__("The object could not be updated."))}})}this.onDelete()},e.prototype.onTest=function(t){return t.preventDefault(),new s({channel:this.formParam(this.el),container:this.el.closest(".content")})},e}(App.ControllerModal),i=function(t){function e(){return this.onDelete=a(this.onDelete,this),e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.head=__("SMS Notification"),e.prototype.buttonCancel=!0,e.prototype.centerButtons=[{text:__("Test"),className:"js-test"}],e.prototype.elements={form:"form",'select[name="options::adapter"]':"adapterSelect"},e.prototype.events={"click .js-test":"onTest"},e.prototype.content=function(){var t,e,n,i,s,r,o,a;for(e=$('<div><div class="js-channelAdapterSelector"></div><div class="js-channelAdapterOptions"></div></div>'),this.channel||(this.channel=new App.Channel({active:!0})),s={},{},n=0,i=(r=this.config).length;n<i;n++)(t=r[n]).notification&&(s[t.adapter]=t.name);return new App.ControllerForm({el:e.find(".js-channelAdapterSelector"),model:{configure_attributes:[{name:"options::adapter",display:__("Provider"),tag:"select",null:!1,options:s,nulloption:!0,translate:!0}],className:""},params:this.channel}),this.renderAdapterOptions(null!=(o=this.channel.options)?o.adapter:void 0,e),e.find('[name="options::adapter"]').on("change",(a=this,function(t){return a.renderAdapterOptions(t.target.value,e)})),e},e.prototype.renderAdapterOptions=function(t,e){var n,i,s,r,o;for(e.find(".js-channelAdapterOptions").html(""),i={},s=0,r=(o=this.config).length;s<r;s++)(n=o[s]).adapter===t&&n.notification&&(i=n.notification);if(!_.isEmpty(i))return new App.ControllerForm({el:e.find(".js-channelAdapterOptions"),model:{configure_attributes:i,className:""},params:this.channel})},e.prototype.onDelete=function(){return!0===this.channel.isNew()?(this.close(),void this.callback()):new App.ControllerGenericDestroyConfirm({item:this.channel,options:{url:"/api/v1/channels_sms/"+this.channel.id},container:this.el.closest(".content"),callback:(t=this,function(){return t.close(),t.callback()})});var t},e.prototype.onSubmit=function(t){var e,n,i,s,r,o;if(t.preventDefault(),""!==this.adapterSelect.val()){for(n in this.formDisable(t),(e=this.channel).options||(e.options={}),i=this.formParam(this.el))o=i[n],this.channel[n]=o;return this.channel.area="Sms::Notification",r="/api/v1/channels_sms",this.channel.isNew()||(r="/api/v1/channels_sms/"+this.channel.id),s=this,this.channel.save({url:r,done:function(){return s.formEnable(t),s.channel=App.Channel.find(this.id),s.close(),s.callback()},fail:function(e,n){return s.log("errors",n),s.formEnable(t),s.showAlert(n.error_human||n.error||__("The object could not be updated."))}})}this.onDelete()},e.prototype.onTest=function(t){return t.preventDefault(),new s({channel:this.formParam(this.el),container:this.el.closest(".content")})},e}(App.ControllerModal),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.head=__("Test SMS provider"),e.prototype.buttonCancel=!0,e.prototype.content=function(){return new App.ControllerForm({model:{configure_attributes:[{name:"recipient",display:__("Recipient"),tag:"input",null:!1},{name:"message",display:__("Message"),tag:"input",null:!1,default:__("Test message from Zammad")}],className:""}}).form},e.prototype.T=function(t){return App.i18n.translateInline(t)},e.prototype.submit=function(t){var n,i;return e.__super__.submit.call(this,t),this.el.find(".js-danger").addClass("hide"),this.el.find(".js-success").addClass("hide"),this.formDisable(this.el),n=_.extend(this.formParam(t.currentTarget),{options:this.channel.options}),this.ajax({type:"POST",url:this.apiPath+"/channels_sms/test",data:JSON.stringify(n),processData:!0,success:(i=this,function(t){var e;return i.formEnable(i.el),(e=t.error||t.error_human)?i.el.find(".js-danger").text(i.T(e)).removeClass("hide"):i.el.find(".js-success").text(i.T("SMS successfully sent")).removeClass("hide")}),error:function(t){return function(e){var n;return n=JSON.parse(e.responseText),t.formEnable(t.el),t.el.find(".js-danger").text(t.T(n.error||__("SMS test failed."))).removeClass("hide")}}(this)})},e}(App.ControllerModal),App.Config.set("SMS",{prio:3100,name:__("SMS"),parent:"#channels",target:"#channels/sms",controller:t,permission:["admin.channel_sms"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;n=function(n){function r(){this.enable=i(this.enable,this),this.disable=i(this.disable,this),this.delete=i(this.delete,this),this.edit=i(this.edit,this),this.new=i(this.new,this),this.render=i(this.render,this),this.load=i(this.load,this),r.__super__.constructor.apply(this,arguments),this.load()}return s(r,n),r.requiredPermission="admin.channel_telegram",r.prototype.events={
"click .js-new":"new","click .js-edit":"edit","click .js-delete":"delete","click .js-disable":"disable","click .js-enable":"enable"},r.prototype.load=function(){return this.startLoading(),this.ajax({id:"telegram_index",type:"GET",url:this.apiPath+"/channels_telegram",processData:!0,success:(t=this,function(e){return t.stopLoading(),App.Collection.loadAssets(e.assets),t.render(e)})});var t},r.prototype.render=function(t){var e,n,i,s,r,o,a;for(i=[],r=0,o=(a=t.channel_ids).length;r<o;r++)n=a[r],(e=App.Channel.find(n))&&e.options&&(s="-",e.group_id&&(s=App.Group.find(e.group_id).displayName()),e.options.groupName=s),i.push(e);return this.html(App.view("telegram/index")({channels:i}))},r.prototype.new=function(e){return e.preventDefault(),new t({container:this.el.parents(".content"),load:this.load})},r.prototype.edit=function(t){var n,i;return t.preventDefault(),i=$(t.target).closest(".action").data("id"),n=App.Channel.find(i),new e({channel:n,container:this.el.parents(".content"),load:this.load})},r.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:(n=this,function(){return n.ajax({id:"telegram_delete",type:"DELETE",url:n.apiPath+"/channels_telegram",data:JSON.stringify({id:e}),processData:!0,success:function(){return n.load()}})}),container:this.el.closest(".content")})},r.prototype.disable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"telegram_disable",type:"POST",url:this.apiPath+"/channels_telegram_disable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r.prototype.enable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"telegram_enable",type:"POST",url:this.apiPath+"/channels_telegram_enable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r}(App.ControllerSubContent),t=function(t){function e(){return this.onSubmit=i(this.onSubmit,this),this.onClosed=i(this.onClosed,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.head=__("Add Telegram Bot"),e.prototype.shown=!0,e.prototype.button="Add",e.prototype.buttonCancel=!0,e.prototype.small=!0,e.prototype.content=function(){var t,e,n;return e=function(t){return App.UiElement.tree_select.render({name:"group_id",multiple:!1,limit:100,null:!1,relation:"Group",nulloption:!0,value:t,class:"form-control--small"})},(t=$(App.view("telegram/bot_add")())).find(".js-select").on("click",(n=this,function(t){return n.selectAll(t)})),t.find(".js-messagesGroup").replaceWith(e(1)),t},e.prototype.onClosed=function(){if(this.isChanged)return this.isChanged=!1,this.load()},e.prototype.onSubmit=function(t){return this.formDisable(t),this.ajax({id:"telegram_app_verify",type:"POST",url:this.apiPath+"/channels_telegram",data:JSON.stringify(this.formParams()),processData:!0,success:(e=this,function(){return e.isChanged=!0,e.close()}),error:function(e){return function(n){var i,s;return i=JSON.parse(n.responseText),e.formEnable(t),s=App.i18n.translateContent(i.error||__("The Telegram bot could not be saved.")),e.el.find(".alert").removeClass("hidden").text(s)}}(this)});var e},e}(App.ControllerModal),e=function(t){function e(){return this.onSubmit=i(this.onSubmit,this),this.onClosed=i(this.onClosed,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.head=__("Telegram Account"),e.prototype.shown=!0,e.prototype.buttonCancel=!0,e.prototype.content=function(){var t,e;return e=function(t){return App.UiElement.tree_select.render({name:"group_id",multiple:!1,limit:100,null:!1,relation:"Group",nulloption:!0,value:t,class:"form-control--small"})},(t=$(App.view("telegram/bot_edit")({channel:this.channel}))).find(".js-messagesGroup").replaceWith(e(this.channel.group_id)),t},e.prototype.onClosed=function(){if(this.isChanged)return this.isChanged=!1,this.load()},e.prototype.onSubmit=function(t){var e,n;return this.formDisable(t),e=this.formParams(),this.channel.options=e,this.ajax({id:"channel_telegram_update",type:"PUT",url:this.apiPath+"/channels_telegram/"+this.channel.id,data:JSON.stringify(this.formParams()),processData:!0,success:(n=this,function(){return n.isChanged=!0,n.close()}),error:function(e){return function(n){var i,s;return i=JSON.parse(n.responseText),e.formEnable(t),s=App.i18n.translateContent(i.error||__("The changes could not be saved.")),e.el.find(".alert").removeClass("hidden").text(s)}}(this)})},e}(App.ControllerModal),App.Config.set("Telegram",{prio:5100,name:__("Telegram"),parent:"#channels",target:"#channels/telegram",controller:n,permission:["admin.channel_telegram"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;n=function(n){function r(){this.enable=i(this.enable,this),this.disable=i(this.disable,this),this.delete=i(this.delete,this),this.edit=i(this.edit,this),this.configApp=i(this.configApp,this),this.show=i(this.show,this),this.render=i(this.render,this),this.load=i(this.load,this),r.__super__.constructor.apply(this,arguments),this.load()}return s(r,n),r.requiredPermission="admin.channel_twitter",r.prototype.events={"click .js-new":"new","click .js-edit":"edit","click .js-delete":"delete","click .js-configApp":"configApp","click .js-disable":"disable","click .js-enable":"enable"},r.prototype.load=function(){return this.startLoading(),this.ajax({id:"twitter_index",type:"GET",url:this.apiPath+"/channels_twitter",processData:!0,success:(t=this,function(e){return t.stopLoading(),App.Collection.loadAssets(e.assets),t.callbackUrl=e.callback_url,t.render(e)})});var t},r.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h;if(r=App.ExternalCredential.findByAttribute("name","twitter")){for(i=[],o=0,l=(u=t.channel_ids).length;o<l;o++){if(n=u[o],(e=App.Channel.find(n))&&e.options&&e.options.sync&&e.options.sync.search)for(a=0,c=(p=e.options.sync.search).length;a<c;a++)s="-",(h=p[a]).group_id&&(s=App.Group.find(h.group_id).displayName()),h.groupName=s;e&&e.options&&e.options.sync&&e.options.sync.mentions&&(s="-",e.options.sync.mentions.group_id&&(s=App.Group.find(e.options.sync.mentions.group_id).displayName()),e.options.sync.mentions.groupName=s),e&&e.options&&e.options.sync&&e.options.sync.direct_messages&&(s="-",e.options.sync.direct_messages.group_id&&(s=App.Group.find(e.options.sync.direct_messages.group_id).displayName()),e.options.sync.direct_messages.groupName=s),i.push(e)}return this.html(App.view("twitter/list")({channels:i,external_credential:r})),this.channel_id?(this.edit(void 0,this.channel_id),this.channel_id=void 0):void 0}this.html(App.view("twitter/index")())},r.prototype.show=function(t){var e,n,i;for(e in n=[],t)i=t[e],"el"!==e&&"shown"!==e&&"match"!==e?n.push(this[e]=i):n.push(void 0);return n},r.prototype.configApp=function(){return new e({container:this.el.parents(".content"),callbackUrl:this.callbackUrl,load:this.load})},r.prototype.new=function(){return window.location.href=this.apiPath+"/external_credentials/twitter/link_account"},r.prototype.edit=function(e,n){var i;if(e&&(e.preventDefault(),n=$(e.target).closest(".action").data("id")),i=App.Channel.find(n))return new t({channel:i,container:this.el.parents(".content"),load:this.load});this.navigate("#channels/twitter")},r.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:(n=this,function(){return n.ajax({id:"twitter_delete",type:"DELETE",url:n.apiPath+"/channels_twitter",data:JSON.stringify({id:e}),processData:!0,success:function(){return n.load()}})}),container:this.el.closest(".content")})},r.prototype.disable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"twitter_disable",type:"POST",url:this.apiPath+"/channels_twitter_disable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r.prototype.enable=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),this.ajax({id:"twitter_enable",type:"POST",url:this.apiPath+"/channels_twitter_enable",data:JSON.stringify({id:e}),processData:!0,success:(n=this,function(){return n.load()})})},r}(App.ControllerSubContent),e=function(t){function e(){return this.onSubmit=i(this.onSubmit,this),this.onClosed=i(this.onClosed,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.head=__("Connect Twitter App"),e.prototype.shown=!0,e.prototype.button="Connect",e.prototype.buttonCancel=!0,e.prototype.small=!0,e.prototype.content=function(){var t,e;return this.external_credential=App.ExternalCredential.findByAttribute("name","twitter"),(t=$(App.view("twitter/app_config")({external_credential:this.external_credential,callbackUrl:this.callbackUrl}))).find(".js-select").on("click",(e=this,function(t){return e.selectAll(t)})),t},e.prototype.onClosed=function(){if(this.isChanged)return this.isChanged=!1,this.load()},e.prototype.onSubmit=function(t){return this.formDisable(t),this.ajax({id:"twitter_app_verify",type:"POST",url:this.apiPath+"/external_credentials/twitter/app_verify",data:JSON.stringify(this.formParams()),processData:!0,success:(e=this,function(n){return n.attributes?(e.external_credential||(e.external_credential=new App.ExternalCredential),e.external_credential.load({name:"twitter",credentials:n.attributes}),void e.external_credential.save({done:function(){return e.isChanged=!0,e.close()},fail:function(){return e.el.find(".alert").removeClass("hidden").text(__("The entry could not be created."))}})):(e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(n.error||__("App could not be verified.")))})});var e},e}(App.ControllerModal),t=function(t){function e(){return this.onSubmit=i(this.onSubmit,this),this.onClosed=i(this.onClosed,this),this.getParams=i(this.getParams,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.head=__("Twitter Account"),e.prototype.shown=!0,e.prototype.buttonCancel=!0,e.prototype.content=function(){var t,e,n,i,s,r;return e=$(App.view("twitter/account_edit")({channel:this.channel})),n=function(t,e){return App.UiElement.tree_select.render({name:e+"::group_id",multiple:!1,limit:100,null:!1,relation:"Group",nulloption:!0,value:t,class:"form-control--small"})},r=this,t=function(){var t;return t=r.getParams(),r.searchTerms=t.search||[],r.searchTerms.push({term:"",group_id:""}),s(),e.find('.js-searchTermList [name="search::term"]').last().trigger("focus")},i=function(t){return function(e){var n,i;return n=$(e.currentTarget).attr("data-index"),i=t.getParams(),t.searchTerms=i.search||[],t.searchTerms.splice(n,1),s()}}(this),s=function(t){return function(){var i,s,r,o,a,l,c;if(t.searchTerms){for(e.find(".js-searchTermList").empty(),l=[],i=r=0,o=(a=t.searchTerms).length;r<o;i=++r)s=a[i],e.find(".js-searchTermList").append(App.view("twitter/search_term")({term:s.term,index:i})),c=n(s.group_id,"search"),l.push(e.find('.js-termGroup[data-index="'+i+'"]').replaceWith(c));return l}}}(this),this.channel.options&&this.channel.options.sync&&this.channel.options.sync.search?this.searchTerms=this.channel.options.sync.search:this.searchTerms=[],s(),e.find(".js-searchTermAdd").on("click",t),e.find(".js-searchTermList").on("click",".js-searchTermRemove",i),e.find(".js-mentionsGroup").replaceWith(n(this.channel.options.sync.mentions.group_id,"mentions")),e.find(".js-directMessagesGroup").replaceWith(n(this.channel.options.sync.direct_messages.group_id,"direct_messages")),e},e.prototype.getParams=function(){var t,e,n,i,s,r,o;if(o=[],s=0,(i=this.formParams()).search)if(_.isArray(i.search.term))for(e=0,n=(r=i.search.term).length;e<n;e++)r[e],t={term:i.search.term[s],group_id:i.search.group_id[s]},o.push(t),s+=1;else o.push(i.search);return i.search=o,i.track_retweets?i.track_retweets=!0:i.track_retweets=!1,i},e.prototype.onClosed=function(){if(this.isChanged)return this.isChanged=!1,this.load()},e.prototype.onSubmit=function(t){return this.formDisable(t),this.channel.options.sync=this.getParams(),this.ajax({id:"channel_twitter_update",type:"POST",url:this.apiPath+"/channels_twitter/"+this.channel.id,data:JSON.stringify(this.channel.attributes()),processData:!0,success:(e=this,function(){return e.isChanged=!0,e.close()}),error:function(e){return function(n){var i;return i=JSON.parse(n.responseText),e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(i.error||__("The changes could not be saved."))}}(this)});var e},e}(App.ControllerModal),App.Config.set("Twitter",{prio:5e3,name:__("Twitter"),parent:"#channels",target:"#channels/twitter",controller:n,permission:["admin.channel_twitter"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title(__("Web"),!0),this.tabs=[{name:__("Settings"),target:"w-setting",controller:App.SettingsArea,params:{area:"CustomerWeb::Base"}}],this.render()}return e(n,t),n.requiredPermission="admin.channel_web",n.prototype.header=__("Web"),n}(App.ControllerTabs),App.Config.set("Web",{prio:1e3,name:__("Web"),parent:"#channels",target:"#channels/web",controller:t,permission:["admin.channel_web"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.DashboardActivityStream=function(n){function i(){this.onRenderEnd=t(this.onRenderEnd,this),this.itemsAll=t(this.itemsAll,this),this.itemGet=t(this.itemGet,this),this.load=t(this.load,this),this.fetch=t(this.fetch,this),i.__super__.constructor.apply(this,arguments),this.fetch(),this.controllerBind("activity_stream_rebuild",this.load)}return e(i,n),i.prototype.model=!1,i.prototype.template="dashboard/activity_stream_item",i.prototype.uniqKey="id",i.prototype.observe={updated_at:!0},i.prototype.prepareForObjectListItemSupport=!0,i.prototype.items=[],i.prototype.insertPosition="before",i.prototype.fetch=function(){var t,e;return(t=App.SessionStorage.get("activity_stream"))?this.load(t):this.ajax({id:"dashoard_activity_stream",type:"GET",url:this.apiPath+"/activity_stream?full=true",data:{limit:this.limit||8},processData:!0,success:(e=this,function(t){return e.load(t)})})},i.prototype.load=function(t){return App.SessionStorage.set("activity_stream",t),App.ActivityStream.refresh([],{clear:!0}),App.Collection.loadAssets(t.assets),this.items=App.ActivityStream.search({sortBy:"created_at",order:"DESC"}),this.collectionSync(this.items)},i.prototype.itemGet=function(t){var e,n,i,s;for(e=0,i=(s=this.items).length;e<i;e++)if(t===(n=s[e]).id)return n},i.prototype.itemDestroy=function(){},i.prototype.itemsAll=function(){return this.items||[]},i.prototype.onRenderEnd=function(){if(!_.isEmpty(this.items))return this.el.closest(".sidebar").find(".activity-description").addClass("hidden")},i.prototype.onRenderItemEnd=function(t,e){if(void 0!==App.Session.get())return new App.WidgetAvatar({el:e.find(".js-avatar"),object_id:t.created_by_id,size:40})},i}(App.CollectionController)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.DashboardFirstSteps=function(n){function i(){this.testTicket=t(this.testTicket,this),this.testTicketLoading=t(this.testTicketLoading,this),this.scrollIntoView=t(this.scrollIntoView,this),this.load=t(this.load,this),i.__super__.constructor.apply(this,arguments),this.interval(this.load,2e4)}return e(i,n),i.prototype.events={"click a":"scrollIntoView","click .js-testTicket":"testTicket","click .js-inviteAgent":"inviteAgent","click .js-inviteCustomer":"inviteCustomer"},i.prototype.load=function(){var t;if(!this.lastData||this.el.is(":visible"))return this.ajax({type:"GET",url:this.apiPath+"/first_steps",success:(t=this,function(e){if(!_.isEqual(t.lastData,e))return t.lastData=e,t.render(e)})})},i.prototype.render=function(t){return this.html(App.view("dashboard/first_steps")({data:t}))},i.prototype.scrollIntoView=function(t){var e,n,i;if((n=$(t.currentTarget).attr("href"))&&"#"!==n)return i=this,e=function(){var t;return t=$("[href='"+n+"']"),i.scrollToIfNeeded(t)},this.delay(e,40)},i.prototype.inviteAgent=function(t){return t.preventDefault(),new App.InviteUser({head:__("Invite Colleagues"),screen:"invite_agent"})},i.prototype.inviteCustomer=function(t){return t.preventDefault(),new App.InviteUser({head:__("Invite Customer"),screen:"invite_customer",signup:!0})},i.prototype.testTicketLoading=function(){var t,e,n;return e=App.view("dashboard/first_steps_test_ticket_loading")(),n=this,t=function(){return n.ajax({id:"test_ticket",type:"POST",url:n.apiPath+"/first_steps/test_ticket",processData:!0,success:function(t){var e,i,s;return App.Collection.loadAssets(t.assets),s=App.Ticket.fullLocal(t.ticket_id),i=App.Overview.fullLocal(t.overview_id),e=n.testTicketFinish({overviewName:App.i18n.translatePlain(i.name),overviewUrl:i.uiUrl(),ticketUrl:s.uiUrl(),ticketNumber:s.number}),$(".modal .modal-body").html(e)}})},this.delay(t,2800),e},i.prototype.testTicketFinish=function(t){return App.view("dashboard/first_steps_test_ticket_finish")(t)},i.prototype.testTicket=function(t){var e;return t.preventDefault(),e=new App.ControllerModal({head:__("Test Ticket"),content:this.testTicketLoading,shown:!0,buttonSubmit:!1,buttonCancel:!1,small:!0,closeOnAnyClick:!0,onSubmit:function(){return e.close()}})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.FirstStepsClues=function(n){function i(e){var n,s;this.hideWindow=t(this.hideWindow,this),this.showWindow=t(this.showWindow,this),this.showClue=t(this.showClue,this),this.render=t(this.render,this),this.close=t(this.close,this),this.previous=t(this.previous,this),this.next=t(this.next,this),n=$('<div class="js-modal--clue"></div>'),e.appEl.append(n),e.el=n,i.__super__.constructor.call(this,e),this.position=0,this.render(),this.controllerBind("ui:rerender",(s=this,function(){return s.render(),"clues"}))}return e(i,n),i.prototype.clues=[{container:".js-dashboardMenuItem",headline:__("Dashboard"),text:__("Here you see a quick overview of your and other agents' performance."),actions:["hover"]},{container:".search-holder",headline:__("Search"),text:__('Here you can search for tickets, customers, and organizations. Use the asterisk \xa7*\xa7 to find anything, e.g. \xa7smi*\xa7 or \xa7rosent*l\xa7. You also can use ||quotation marks|| for searching phrases: \xa7"some phrase"\xa7.'),actions:[]},{container:".user-menu .add",headline:__("Create"),text:__("Here you can create new tickets, customers and organizations (depending on your configured permissions)."),actions:["hover .navigation","hover .user-menu .add"]},{container:".user-menu .user .dropdown-menu",headline:__("Personal Settings"),text:__("Here you can sign out, change the frontend language, and see your last viewed items."),actions:["hover .navigation","click .user-menu .user .js-action","hover .user-menu .user"]},{container:".js-overviewsMenuItem",headline:__("Overviews"),text:__("Here you find your ticket overviews for open, assigned, and escalated tickets."),actions:["hover"]}],i.prototype.elements={".js-positionOrigin":"modalWindow",".js-backdrop":"backdrop"},i.prototype.events={click:"stopPropagation","click .js-next":"next","click .js-previous":"previous","click .js-close":"close"},i.prototype.stopPropagation=function(t){return t.stopPropagation()},i.prototype.next=function(t){return t.stopPropagation(),this.navigate(1)},i.prototype.previous=function(t){return t.stopPropagation(),this.navigate(-1)},i.prototype.close=function(){return this.cleanUp(),this.options.onComplete(),this.remove()},i.prototype.remove=function(){return this.el.remove()},i.prototype.navigate=function(t){return this.cleanUp((e=this,function(){return e.position+=t,e.position<e.clues.length?e.showClue():(e.options.onComplete(),e.remove())}));var e},i.prototype.cleanUp=function(t){return this.hideWindow((e=this,function(){var n,i;if(n=e.clues[e.position],(i=e.appEl.find(n.container)).removeClass("selected-clue"),n.actions&&e.perform(n.actions,i,"cleanup"),t)return t()}));var e},i.prototype.render=function(){return this.el.addClass("modal modal--clue"),this.html(App.view("dashboard/first_steps_clues")),this.backdrop.velocity({properties:{opacity:[1,0]},options:{duration:300,complete:this.showClue}})},i.prototype.showClue=function(){var t,e,n,i;return n=this.clues[this.position],(i=this.appEl.find(n.container)).addClass("selected-clue"),n.actions&&this.perform(n.actions,i,"show"),e={x:(t=this.getVisibleBoundingBox(i.get(0))).left+t.width/2,y:t.top+t.height/2},this.modalWindow.html(App.view("dashboard/first_steps_clues_content")({headline:n.headline,text:n.text,position:this.position,max:this.clues.length})),this.placeWindow(t),this.backdrop.velocity({properties:{translateX:e.x,translateY:e.y,translateZ:0},options:{duration:300,complete:this.showWindow}})},i.prototype.showWindow=function(){return this.modalWindow.velocity({properties:{scale:[1,.2],opacity:[1,0]},options:{duration:300,easing:[.34,1.61,.7,1],complete:(t=this,function(){return t.el.addClass("modal--clue-ready")})}});var t},i.prototype.hideWindow=function(t){return this.modalWindow.velocity({properties:{scale:[.2,1],opacity:0},options:{duration:200,complete:t}})},i.prototype.placeWindow=function(t){var e,n,i,s,r,o,a,l,c;return $.Velocity.hook(this.modalWindow,"scale",1),s=this.modalWindow.get(0).getBoundingClientRect(),a="",e=0,l=0,i=$(window).width(),n=$(window).height(),t.height>t.width&&window.matchMedia("(min-width: 768px)").matches?(t.right+s.width<=i?(e=t.right,a="right"):(e=t.left-s.width,a="left"),a&&(l=t.top+t.height/2-s.height/2)):(t.height<=t.width||!a)&&(t.top-s.height>=0?(l=t.top-s.height,a="above"):(l=t.bottom,a="below"),a&&(e=t.left+t.width/2-s.width/2)),e<0?(r=s.width/2+e,e=0):e+s.width>i&&(r=s.width/2+i-(e+s.width),e=i-s.width),l<0?(r=s.height/2+l,l=0):l+s.height>n&&(r=s.height/2+n-(l+s.height),l=n-s.height),c=this.getTransformOrigin(s,a),r&&(o="above"===a||"below"===a?"left":"top",this.modalWindow.find(".js-arrow").css(o,r),"above"===a||"below"===a?c.x=r:c.y=r),this.modalWindow.attr("data-position",a).css({left:e,top:l,transformOrigin:c.x+"px "+c.y+"px"})},i.prototype.getTransformOrigin=function(t,e){return{above:{x:t.width/2,y:t.height},below:{x:t.width/2,y:0},left:{x:t.width+this.transformOriginPadding,y:t.height/2},right:{x:-this.transformOriginPadding,y:t.height/2}}[e]},i.prototype.getVisibleBoundingBox=function(t){var e,n,i,s,r,o;for(i=t.querySelectorAll("*"),s={left:(e=t.getBoundingClientRect()).left,right:e.right,top:e.top,bottom:e.bottom},r=0,o=i.length;r<o;r++)n=i[r],!1!==getComputedStyle(n).position&&0!==(e=n.getBoundingClientRect()).width&&0!==e.height&&(e.left<s.left&&(s.left=e.left),e.top<s.top&&(s.top=e.top),e.right>s.right&&(s.right=e.right),e.bottom>s.bottom&&(s.bottom=e.bottom));return s.width=s.right-s.left,s.height=s.bottom-s.top,s},i.prototype.perform=function(t,e,n){var i,s,r,o,a,l;for(a=[],r=0,o=t.length;r<o;r++)switch((i=t[r]).indexOf(" ")<0?(s=i,l=e):(s=i.substr(0,i.indexOf(" ")),l=$(i.substr(i.indexOf(" ")+1))),s){case"click":a.push(l.trigger("click"));break;case"hover":this.appEl.find(".navigation .is-active").removeClass("is-active"),"show"===n?a.push(l.addClass("is-hovered")):a.push(l.removeClass("is-hovered"));break;default:a.push(void 0)}return a},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.DashboardStats=function(n){function i(){this.setupStatsWidgets=t(this.setupStatsWidgets,this),i.__super__.constructor.apply(this,arguments),this.setupStatsWidgets(),this.controllerBind("dashboard_stats_rebuild",this.setupStatsWidgets)}return e(i,n),i.prototype.setupStatsWidgets=function(){return this.setupStatsWidget("Stats","stats",this.el)},i.prototype.setupStatsWidget=function(t,e,n){var i,s,r,o,a,l,c;if(App.Event.trigger(e+":init"),a=App.Config.get(t))for(c=$.map(a,(function(t){return t})),s=0,r=(c=_.sortBy(c,(function(t){return t.prio}))).length;s<r;s++)if(l=c[s],this.permissionCheck(l.permission))try{n=this.el.find(".column."+l.className),o=$('<div class="column '+l.className+'"></div>'),n.get(0)?n.replaceWith(o):this.el.append(o),new l.controller({el:o,className:l.className}),this.$(".js-stat-help").tooltip()}catch(t){i=t,this.log("error","statsWidgets "+l+":",i)}return App.Event.trigger(e+":ready")},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerDashboardStatsBase=function(n){function i(){this.load=t(this.load,this),i.__super__.constructor.apply(this,arguments),this.load()}return e(i,n),i.prototype.load=function(){var t;return(t=App.StatsStore.first())?this.render(t.data):this.render()},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.render=function(t){var e,n,i,s,r;for(i in null==t&&(t={}),t.StatsTicketChannelDistribution||(t.StatsTicketChannelDistribution={channels:{1:{icon:"email",sender:"email",inbound:0,outbound:0,inbound_in_percent:0,outbound_in_percent:0},2:{icon:"phone",sender:"phone",inbound:0,outbound:0,inbound_in_percent:0,outbound_in_percent:0}}}),r=_.reduce(t.StatsTicketChannelDistribution.channels,(function(t,e){return t+e.inbound+e.outbound}),0),_.size(t.StatsTicketChannelDistribution.channels),s=t.StatsTicketChannelDistribution.channels)(e=s[i]).overal_percentage=Math.round((e.inbound+e.outbound)/r*100)||0;return t.StatsTicketChannelDistribution.description=__("How many of your tickets are coming from email, phone, Twitter, or Facebook? (Shows percentages for both inbound and outbound tickets.)"),n=App.view("dashboard/stats/ticket_channel_distribution")(t),this.$(".ticket_channel_distribution").length>0?this.$(".ticket_channel_distribution").html(n):this.el.append(n)},n}(App.ControllerDashboardStatsBase),App.Config.set("ticket_channel_distribution",{controller:t,permission:"ticket.agent",prio:300,className:"ticket_channel_distribution"},"Stats")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.render=function(t){var e;return null==t&&(t={}),t.StatsTicketEscalation||(t.StatsTicketEscalation={state:"supergood",own:0,total:0}),t.StatsTicketEscalation.description=__("How many escalated tickets do you have open? (Mr. Bubbles gets grumpy if you have too many\u2026)"),e=App.view("dashboard/stats/ticket_escalation")(t),this.$(".ticket_escalation").length>0?this.$(".ticket_escalation").html(e):this.el.append(e)},n}(App.ControllerDashboardStatsBase),App.Config.set("ticket_escalation",{controller:t,permission:"ticket.agent",prio:200,className:"ticket_escalation"},"Stats")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.render=function(t){var e;return null==t&&(t={}),t.StatsTicketInProcess||(t.StatsTicketInProcess={state:"supergood",percent:0,in_process:0,average_per_agent:0}),t.StatsTicketInProcess.description=__("What percentage of your tickets have you responded to, updated, or modified in some way today?"),e=App.view("dashboard/stats/ticket_in_process")(t),this.$(".ticket_in_process").length>0?this.$(".ticket_in_process").html(e):this.el.append(e)},n}(App.ControllerDashboardStatsBase),App.Config.set("ticket_in_process",{controller:t,permission:"ticket.agent",prio:500,className:"ticket_in_process"},"Stats")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.render=function(t){var e;return null==t&&(t={}),t.StatsTicketLoadMeasure||(t.StatsTicketLoadMeasure={state:"supergood",percent:0,own:0,total:0,average_per_agent:0}),t.StatsTicketLoadMeasure.description=__("Out of all open tickets (company-wide), how many are assigned to you?"),e=App.view("dashboard/stats/ticket_load_measure")(t),this.$(".ticket_load_measure").length>0?this.$(".ticket_load_measure").html(e):this.el.append(e)},n}(App.ControllerDashboardStatsBase),App.Config.set("ticket_load_measure",{controller:t,permission:"ticket.agent",prio:400,className:"ticket_load_measure"},"Stats")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.render=function(t){var e;return null==t&&(t={}),t.StatsTicketReopen||(t.StatsTicketReopen={state:"supergood",percent:0,average_per_agent:0}),t.StatsTicketReopen.description=__("How many of your tickets have been re-opened after being marked \u201cclosed\u201d?"),e=App.view("dashboard/stats/ticket_reopen")(t),this.$(".ticket_reopen").length>0?this.$(".ticket_reopen").html(e):this.el.append(e)},n}(App.ControllerDashboardStatsBase),App.Config.set("ticket_reopen",{controller:t,permission:"ticket.agent",prio:600,className:"ticket_reopen"},"Stats")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){return this.renderWidgetClockFace=e(this.renderWidgetClockFace,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.render=function(t){var e;if(null==t&&(t={}),t.StatsTicketWaitingTime||(t.StatsTicketWaitingTime={handling_time:0,average:0,state:"supergood",average_per_agent:0}),t.StatsTicketWaitingTime.description=__("How long did each customer have to wait, on average, to get a response from you today?"),e=App.view("dashboard/stats/ticket_waiting_time")(t),this.$(".ticket_waiting_time").length>0?this.$(".ticket_waiting_time").html(e):this.el.append(e),t.StatsTicketWaitingTime)return this.renderWidgetClockFace(t.StatsTicketWaitingTime.handling_time,t.StatsTicketWaitingTime.state,t.StatsTicketWaitingTime.percent)},i.prototype.renderWidgetClockFace=function(t,e,n){var i,s,r,o,a,l,c,u,p;for(l in a=window.devicePixelRatio||1,o=(r=this.el.find("canvas")).get(0).getContext("2d"),u=26,this.el.find(".time.stat-widget .stat-amount").text(t),r.attr("width",2*u*a),r.attr("height",2*u*a),o.scale(a,a),(c={}).supergood="#38AE6A",c.good="#A9AC41",c.ok="#FAAB00",c.bad="#F6820B",c.superbad="#F35910",c)if(p=c[l],e===l){s=p;break}return 0!==t&&(o.globalAlpha=.3),
o.fillStyle=s,o.beginPath(),o.arc(u,u,u,0,2*Math.PI,!0),o.closePath(),o.fill(),o.globalAlpha=1,o.beginPath(),o.moveTo(u,u),i=2*Math.PI*n,o.arc(u,u,u,-Math.PI/2,i-Math.PI/2,!1),o.lineTo(u,u),o.closePath(),o.fill()},i}(App.ControllerDashboardStatsBase),App.Config.set("ticket_waiting_time",{controller:t,permission:"ticket.agent",prio:100,className:"ticket_waiting_time"},"Stats")}.call(this),function(){App.Config.set("History",[]),App.Config.set("User",{prio:1e3,parent:"",callback:function(){var t;return(t={}).name=App.Session.get("login"),t},target:"#current_user",class:"user"},"NavBarRight"),App.Config.set("Admin",{prio:9e3,parent:"",name:__("Admin"),translate:!0,target:"#manage",icon:"cog",permission:["admin.*"]},"NavBarRight"),App.Config.set("New",{prio:2e4,parent:"",name:__("New"),translate:!0,target:"#new",class:"add",icon:"plus"},"NavBarRight"),App.Config.set("Misc",{prio:9e4,parent:"",name:__("Tools"),translate:!0,target:"#tools",child:!0,class:"tools"},"NavBar")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerIntegrationBase=function(n){function i(){this.render=t(this.render,this),this.switch=t(this.switch,this),i.__super__.constructor.apply(this,arguments),this.title(this.featureName,!0),this.initalRender=!0,App.Setting.fetchFull(this.render,{force:!1})}return e(i,n),i.prototype.events={"change .js-switch input":"switch"},i.prototype.featureIntegration="tbd_integration",i.prototype.featureName="Tbd",i.prototype.switch=function(){var t;return t=this.$(".js-switch input").prop("checked"),App.Setting.set(this.featureIntegration,t)},i.prototype.render=function(){if(this.initalRender)return this.html(App.view("integration/base")({header:this.featureName,description:this.description,feature:this.featureIntegration,featureEnabled:App.Setting.get(this.featureIntegration)})),this.initalRender=!1},i}(App.Controller)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function n(){return this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return s(n,t),n.prototype.featureIntegration="check_mk_integration",n.prototype.featureName=__("Checkmk"),n.prototype.featureConfig="check_mk_config",n.prototype.description=[[__("This service receives HTTP requests or emails from %s and creates tickets with host and service."),"Checkmk"],[__("If the host and service have recovered, the ticket can be closed automatically.")]],n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new App.SettingsForm({area:"Integration::CheckMK",el:this.$(".js-form")}),new e({el:this.$(".js-usage")}),new App.HttpLog({el:this.$(".js-log"),facility:"check_mk"})},n}(App.ControllerIntegrationBase),n=function(){function t(){}return t.current=function(){return App.Setting.get("check_mk_integration")},t}(),e=function(t){function e(){this.toogle=i(this.toogle,this),e.__super__.constructor.apply(this,arguments),this.render()}return s(e,t),e.prototype.events={"click .js-tabItem":"toogle","click .js-select":"selectAll"},e.prototype.render=function(){return this.html(App.view("integration/check_mk")()),this.$(".js-code").each((function(t,e){return hljs.highlightBlock(e)}))},e.prototype.toogle=function(t){var e;return e=$(t.target).data("tablist"),this.$(".js-tablistItem").addClass("hidden"),this.$(".js-"+e).removeClass("hidden")},e}(App.Controller),App.Config.set("IntegrationCheckMk",{name:__("Checkmk"),target:"#system/integration/check_mk",description:__("An open-source monitoring tool."),controller:t,state:n,permission:["admin.integration.check_mk"]},"NavBarIntegrations")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function n(){return this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return s(n,t),n.prototype.featureIntegration="clearbit_integration",n.prototype.featureName=__("Clearbit"),n.prototype.featureConfig="clearbit_config",n.prototype.description=[[__("Automatically enrich your customers and organizations with fresh, up-to-date intel. Map data directly to object fields.")]],n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new e({el:this.$(".js-form")}),new App.HttpLog({el:this.$(".js-log"),facility:"clearbit"})},n}(App.ControllerIntegrationBase),e=function(t){function e(){this.removeRow=i(this.removeRow,this),this.addOrganizationSync=i(this.addOrganizationSync,this),this.addUserSync=i(this.addUserSync,this),this.update=i(this.update,this),this.updateCurrentConfig=i(this.updateCurrentConfig,this),this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return s(e,t),e.prototype.events={"submit form":"update","click .js-userSync .js-add":"addUserSync","click .js-organizationSync .js-add":"addOrganizationSync","click .js-userSync .js-remove":"removeRow","click .js-organizationSync .js-remove":"removeRow"},e.prototype.currentConfig=function(){var t;return(t=clone(App.Setting.get("clearbit_config")))||(t={}),void 0===t.organization_autocreate&&(t.organization_autocreate=!0),void 0===t.organization_shared&&(t.organization_shared=!1),t.user_sync||(t.user_sync={"person.name.givenName":"user.firstname","person.name.familyName":"user.lastname","person.email":"user.email","person.bio":"user.note","company.url":"user.web","person.site":"user.web","company.location":"user.address","person.location":"user.address"}),t.organization_sync||(t.organization_sync={"company.legalName":"organization.name","company.name":"organization.name","company.description":"organization.note"}),t},e.prototype.setConfig=function(t){return App.Setting.set("clearbit_config",t,{notify:!0})},e.prototype.render=function(){var t,e,n,i,s;for(this.config||(this.config=this.currentConfig()),s=[{name:"api_key",display:__("API Key"),tag:"input",type:"text",limit:100,null:!1,placeholder:"...",note:__("Your API key.")},{name:"organization_autocreate",display:__("Auto create"),tag:"boolean",type:"boolean",null:!1,note:__("Create organizations automatically if record has one.")},{name:"organization_shared",display:__("Shared"),tag:"boolean",type:"boolean",null:!1,note:__("New organizations are shared.")}],this.html(App.view("integration/clearbit")({config:this.config,settings:s})),n=[],t=0,e=s.length;t<e;t++)(i=s[t]).display="",n.push(new App.ControllerForm({el:this.$("[data-name="+i.name+"]"),model:{configure_attributes:[i]},params:this.config}));return n},e.prototype.updateCurrentConfig=function(){var t,e,n;return e=this.config,t=this.cleanupInput,n=this.formParam(this.$("form")),e.api_key=n.api_key,e.organization_autocreate=n.organization_autocreate,e.organization_shared=n.organization_shared,e.user_sync={},this.$(".js-userSync .js-row").each((function(){var n,i,s;return i=$(this),s=t(i.find('input[name="source"]').val()),n=t(i.find('input[name="destination"]').val()),e.user_sync[s]=n})),e.organization_sync={},this.$(".js-organizationSync .js-row").each((function(){var n,i,s;return i=$(this),s=t(i.find('input[name="source"]').val()),n=t(i.find('input[name="destination"]').val()),e.organization_sync[s]=n})),this.config=e},e.prototype.update=function(t){return t.preventDefault(),this.updateCurrentConfig(),this.setConfig(this.config)},e.prototype.cleanupInput=function(t){return t?t.replace(/\s/g,"").trim():t},e.prototype.addUserSync=function(t){var e,n,i;if(t.preventDefault(),this.updateCurrentConfig(),n=$(t.currentTarget).closest("tr"),i=this.cleanupInput(n.find('input[name="source"]').val()),e=this.cleanupInput(n.find('input[name="destination"]').val()),!_.isEmpty(i)&&!_.isEmpty(e))return this.config.user_sync[i]=e,this.render()},e.prototype.addOrganizationSync=function(t){var e,n,i;if(t.preventDefault(),this.updateCurrentConfig(),n=$(t.currentTarget).closest("tr"),i=this.cleanupInput(n.find('input[name="source"]').val()),e=this.cleanupInput(n.find('input[name="destination"]').val()),!_.isEmpty(i)&&!_.isEmpty(e))return this.config.organization_sync[i]=e,this.render()},e.prototype.removeRow=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e}(App.Controller),n=function(){function t(){}return t.current=function(){return App.Setting.get("clearbit_integration")},t}(),App.Config.set("IntegrationClearbit",{name:__("Clearbit"),target:"#system/integration/clearbit",description:__("A powerful service to get more information about your customers."),controller:t,state:n,permission:["admin.integration.clearbit"]},"NavBarIntegrations")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function n(){return this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return s(n,t),n.prototype.featureIntegration="cti_integration",n.prototype.featureName=__("CTI (generic)"),n.prototype.featureConfig="cti_config",n.prototype.description=[[__("This service shows you contacts of incoming calls and a caller list in realtime.")],[__("Caller ID of outbound calls can be changed as well.")]],n.prototype.events={"click .js-select":"selectAll","change .js-switch input":"switch"},n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new e({el:this.$(".js-form")}),new App.HttpLog({el:this.$(".js-log"),facility:"cti"})},n}(App.ControllerIntegrationBase),e=function(t){function e(){this.removeNotifyMap=i(this.removeNotifyMap,this),this.removeOutboundRouting=i(this.removeOutboundRouting,this),this.removeInboundBlockCallerId=i(this.removeInboundBlockCallerId,this),this.addNotifyMap=i(this.addNotifyMap,this),this.addOutboundRouting=i(this.addOutboundRouting,this),this.addInboundBlockCallerId=i(this.addInboundBlockCallerId,this),this.update=i(this.update,this),this.updateCurrentConfig=i(this.updateCurrentConfig,this),this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return s(e,t),e.prototype.events={"submit form":"update","click .js-inboundBlockCallerId .js-add":"addInboundBlockCallerId","click .js-outboundRouting .js-add":"addOutboundRouting","click .js-notifyMap .js-addMap":"addNotifyMap","click .js-inboundBlockCallerId .js-remove":"removeInboundBlockCallerId","click .js-outboundRouting .js-remove":"removeOutboundRouting","click .js-notifyMap .js-removeMap":"removeNotifyMap"},e.prototype.currentConfig=function(){var t;return(t=App.Setting.get("cti_config")).outbound||(t.outbound={}),t.outbound.routing_table||(t.outbound.routing_table=[]),t.inbound||(t.inbound={}),t.inbound.block_caller_ids||(t.inbound.block_caller_ids=[]),t.notify_map||(t.notify_map=[]),t},e.prototype.setConfig=function(t){return App.Setting.set("cti_config",t,{notify:!0})},e.prototype.render=function(){var t,e,n,i,s,r;for(this.config=this.currentConfig(),this.html(App.view("integration/cti")({config:this.config,cti_token:App.Setting.get("cti_token")})),t=[{name:"user_ids",display:"",tag:"column_select",multiple:!0,null:!0,relation:"User",sortBy:"firstname"}],new App.ControllerForm({el:this.$(".js-userSelectorBlank"),model:{configure_attributes:t},params:{user_ids:[]},autofocus:!1}),t=[{name:"view_limit",display:"",tag:"select",null:!1,options:[{name:60,value:60},{name:120,value:120},{name:180,value:180},{name:240,value:240},{name:300,value:300}]}],new App.ControllerForm({el:this.$(".js-viewLimit"),model:{configure_attributes:t},params:{view_limit:this.config.view_limit},autofocus:!1}),s=[],e=0,n=(i=this.config.notify_map).length;e<n;e++)r=i[e],t=[{name:"user_ids",display:"",tag:"column_select",multiple:!0,null:!0,relation:"User",sortBy:"firstname"}],s.push(new App.ControllerForm({el:this.$("[name=queue][value='"+r.queue+"']").closest("tr").find(".js-userSelector"),model:{configure_attributes:t},params:{user_ids:r.user_ids},autofocus:!1}));return s},e.prototype.updateCurrentConfig=function(){var t,e,n,i;return e=this.config,t=this.cleanupInput,n=this.$("input[name=default_caller_id]").val(),e.outbound.default_caller_id=t(n),i=this.$("select[name=view_limit]").val(),e.view_limit=parseInt(i),e.outbound.routing_table=[],this.$(".js-outboundRouting .js-row").each((function(){var n,i,s;return i=t($(this).find('input[name="dest"]').val()),n=t($(this).find('input[name="caller_id"]').val()),s=$(this).find('input[name="note"]').val(),e.outbound.routing_table.push({dest:i,caller_id:n,note:s})})),e.inbound.block_caller_ids=[],this.$(".js-inboundBlockCallerId .js-row").each((function(){var n,i;return n=$(this).find('input[name="caller_id"]').val(),i=$(this).find('input[name="note"]').val(),e.inbound.block_caller_ids.push({caller_id:t(n),note:i})})),e.notify_map=[],this.$(".js-notifyMap .js-row").each((function(){var n,i;return n=$(this).find('input[name="queue"]').val(),i=$(this).find('select[name="user_ids"]').val(),e.notify_map.push({queue:t(n),user_ids:i})})),this.config=e},e.prototype.update=function(t){return t.preventDefault(),this.updateCurrentConfig(),this.setConfig(this.config)},e.prototype.cleanupInput=function(t){return t?t.replace(/\s/g,"").trim():t},e.prototype.addInboundBlockCallerId=function(t){var e,n,i;if(t.preventDefault(),this.updateCurrentConfig(),e=(n=$(t.currentTarget).closest("tr")).find('input[name="caller_id"]').val(),i=n.find('input[name="note"]').val(),!_.isEmpty(e)&&!_.isEmpty(i))return this.config.inbound.block_caller_ids.push({caller_id:this.cleanupInput(e),note:i}),this.render()},e.prototype.addOutboundRouting=function(t){var e,n,i,s;if(t.preventDefault(),this.updateCurrentConfig(),i=$(t.currentTarget).closest("tr"),n=this.cleanupInput(i.find('input[name="dest"]').val()),e=this.cleanupInput(i.find('input[name="caller_id"]').val()),s=i.find('input[name="note"]').val(),!(_.isEmpty(e)||_.isEmpty(n)||_.isEmpty(s)))return this.config.outbound.routing_table.push({dest:n,caller_id:e,note:s}),this.render()},e.prototype.addNotifyMap=function(t){var e,n,i,s,r,o;if(t.preventDefault(),this.updateCurrentConfig(),e=$(t.currentTarget).closest("tr"),s=this.cleanupInput(e.find('input[name="queue"]').val()),o=e.find('select[name="user_ids"]').val(),_.isEmpty(s))this.notify({type:"error",msg:App.i18n.translateContent("A queue is required!"),timeout:6e3});else{if(!_.isEmpty(o)){for(n=0,i=(r=this.config.notify_map).length;n<i;n++)if(r[n].queue===s)return void this.notify({type:"error",msg:App.i18n.translateContent("Queue already exists!"),timeout:6e3});return this.config.notify_map.push({queue:s,user_ids:o}),this.render()}this.notify({type:"error",msg:App.i18n.translateContent("A user is required!"),timeout:6e3})}},e.prototype.removeInboundBlockCallerId=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e.prototype.removeOutboundRouting=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e.prototype.removeNotifyMap=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e}(App.Controller),n=function(){function t(){}return t.current=function(){return App.Setting.get("cti_integration")},t}(),App.Config.set("IntegrationCti",{name:__("CTI (generic)"),target:"#system/integration/cti",description:__("Generic API to integrate VoIP service provider with real-time push."),controller:t,state:n},"NavBarIntegrations")}.call(this),function(){var t,e,n,i,s,r=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=function(t){function e(){this.switch=r(this.switch,this),this.render=r(this.render,this),e.__super__.constructor.apply(this,arguments),"1"===this.success_code?this.navigate("#system/integration/exchange"):"AADSTS65004"===this.error_code&&new App.AdminConsentInfo({container:this.container})}return o(e,t),e.prototype.featureIntegration="exchange_integration",e.prototype.featureName=__("Exchange"),e.prototype.featureConfig="exchange_config",e.prototype.description=[[__("This service enables Zammad to connect with your Exchange server.")]],e.prototype.events={"change .js-switch input":"switch"},e.prototype.render=function(){return e.__super__.render.apply(this,arguments),new i({el:this.$(".js-form")}),new App.HttpLog({el:this.$(".js-log"),facility:"EWS"})},e.prototype.switch=function(){var t,n;if(e.__super__.switch.apply(this,arguments),this.$(".js-switch input").prop("checked"))return n=this,t=function(){return n.ajax({id:"jobs_config",type:"POST",url:n.apiPath+"/integration/exchange/job_start",processData:!0,success:function(){return n.render(!0)}})},App.Delay.set(t,600,"job_start")},e}(App.ControllerIntegrationBase),i=function(n){function i(){this.activeDryRun=r(this.activeDryRun,this),this.lastResultShow=r(this.lastResultShow,this),this.lastResult=r(this.lastResult,this),this.startWizard=r(this.startWizard,this),this.startSync=r(this.startSync,this),this.reauthenticateApp=r(this.reauthenticateApp,this),this.deleteApp=r(this.deleteApp,this),this.configApp=r(this.configApp,this),this.loadExchangeData=r(this.loadExchangeData,this),this.render=r(this.render,this),this.show=r(this.show,this),this.setConfig=r(this.setConfig,this),i.__super__.constructor.apply(this,arguments),this.render(),this.lastResult(),this.activeDryRun(),this.controllerBind("exchange::load_exchange_data",this.loadExchangeData)}return o(i,n),i.prototype.elements={".js-lastImport":"lastImport",".js-wizard":"wizardButton"},i.prototype.events={"click .js-wizard":"startWizard","click .js-start-sync":"startSync","click .js-new-app":"newApp","click .js-delete-app":"deleteApp","click .js-reauthenticate-app":"reauthenticateApp","click .js-config-app":"configApp","click .js-admin-consent":"adminConsent","change .js-authentication-method":"changeAuthenticationMethod"},i.prototype.currentConfig=function(){return App.Setting.get("exchange_config")||{}},i.prototype.setConfig=function(t){return App.Setting.set("exchange_config",t,{notify:!0}),this.startSync()},i.prototype.show=function(t){var e,n,i;for(e in n=[],t)i=t[e],"el"!==e&&"shown"!==e&&"match"!==e?n.push(this[e]=i):n.push(void 0);return n},i.prototype.render=function(t){var e,n,i,s,r,o,a;if(null==t&&(t=!1),this.config=this.currentConfig(),i=[],!_.isEmpty(this.config.folders))for(s=0,r=(o=this.config.folders).length;s<r;s++)n=o[s],i.push(this.config.wizardData.backend_folders[n]);if(this.html(App.view("integration/exchange")({config:this.config,folders:i})),_.isEmpty(this.config)?(this.$(".js-notConfigured").removeClass("hide"),this.$(".js-summary").addClass("hide")):(this.$(".js-notConfigured").addClass("hide"),this.$(".js-summary").removeClass("hide")),this.interval(this.loadExchangeData,3e4),this.loadExchangeData(!0),t)return a=this,e=function(){return a.scrollToIfNeeded($(".content.active .page-header"))},this.delay(e,500)},i.prototype.loadExchangeData=function(t){var e;return null==t&&(t=!1),this.startLoading(),this.ajax({id:"exchange_index",type:"GET",url:this.apiPath+"/integration/exchange/index",processData:!0,success:(e=this,function(n){var i;return e.stopLoading(),App.Collection.loadAssets(n.assets),e.callbackUrl=n.callback_url,e.exchange_oauth=n.oauth,(i=App.ExternalCredential.findByAttribute("name","exchange"))?e.$(".js-oAuthContent").html($(App.view("exchange/token_information")({oauth:n.oauth,external_credential:i}))).removeClass("hide"):e.$(".js-oAuthContent").html($(App.view("exchange/oauth_intro")())).removeClass("hide"),e.setAuthenticationMethod(t)})}),!0},i.prototype.setAuthenticationMethod=function(t){var e;return e=this.el.find(".js-authentication-method").val()||"basic",t&&(e="basic",_.isEmpty(this.exchange_oauth)||(e="oauth")),this.el.find(".js-authentication-method").val(e).trigger("change")},i.prototype.changeAuthenticationMethod=function(){var t;return"basic"===(t=this.el.find(".js-authentication-method").val())?(this.el.find(".js-oAuthContent").addClass("hide"),this.wizardButton.prop("disabled",!1)):(this.el.find(".js-oAuthContent").removeClass("hide"),App.ExternalCredential.findByAttribute("name","exchange")?this.wizardButton.prop("disabled",!1):this.wizardButton.prop("disabled",!0)),this.currentAuthenticationMethod=t},i.prototype.configApp=function(){return new t({container:this.el.parents(".content"),callbackUrl:this.callbackUrl})},i.prototype.newApp=function(){return window.location.href=this.apiPath+"/external_credentials/exchange/link_account"},i.prototype.adminConsent=function(){return window.location.href=this.apiPath+"/external_credentials/exchange/link_account?prompt=consent"},i.prototype.deleteApp=function(t){var e;return t.preventDefault(),$(t.target).closest(".action").data("id"),new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:(e=this,function(){return e.ajax({id:"exchange_delete",type:"DELETE",url:e.apiPath+"/integration/exchange/oauth",success:function(){return e.render()}})}),container:this.el.closest(".content")})},i.prototype.reauthenticateApp=function(t){return t.preventDefault(),window.location.href=this.apiPath+"/external_credentials/exchange/link_account"},i.prototype.startSync=function(){return this.ajax({id:"jobs_config",type:"POST",url:this.apiPath+"/integration/exchange/job_start",processData:!0,success:(t=this,function(){return t.render(!0),t.lastResult()})});var t},i.prototype.startWizard=function(t){return t.preventDefault(),new e({container:this.el.closest(".content"),config:this.config,currentAuthenticationMethod:this.currentAuthenticationMethod,callback:(n=this,function(t){return n.setConfig(t)})});var n},i.prototype.lastResult=function(){return this.ajax({id:"jobs_start_index",type:"GET",url:this.apiPath+"/integration/exchange/job_start",processData:!0,success:(t=this,function(e){return _.isEmpty(e)||t.lastResultShowJob&&t.lastResultShowJob.updated_at===e.updated_at||(t.lastResultShowJob=e,t.lastResultShow(e),e.finished_at?t.wizardButton.prop("disabled",!1):t.wizardButton.prop("disabled",!0)),t.delay(t.lastResult,5e3)})});var t},i.prototype.lastResultShow=function(t){var e,n,i,s,r;if(!_.isEmpty(t)){for(s in t.result.roles||(t.result.roles={}),n=t.result.role_ids)r=n[s],i=App.Role.find(s),t.result.roles[i.displayName()]=r;return e=$(App.view("integration/exchange_last_import")({job:t})),this.lastImport.html(e)}this.lastImport.html("")},i.prototype.activeDryRun=function(){return this.ajax({id:"jobs_try_index",type:"GET",url:this.apiPath+"/integration/exchange/job_try",data:{finished:!1},processData:!0,success:(t=this,function(n){if(!_.isEmpty(n))return new e({container:t.el.closest(".content"),config:n.payload.params,start:"tryLoop",callback:function(e){return t.wizardButton.prop("disabled",!1),t.setConfig(e)}}),t.wizardButton.prop("disabled",!0)})});var t},i}(App.Controller),s=function(){function t(){}return t.current=function(){return App.Setting.get("exchange_integration")},t}(),e=function(t){function e(){var t;this.tryResult=r(this.tryResult,this),this.tryLoop=r(this.tryLoop,this),this.tryShow=r(this.tryShow,this),this.addUserMapping=r(this.addUserMapping,this),this.buildRowUserAttribute=r(this.buildRowUserAttribute,this),this.buildRowsUserMap=r(this.buildRowsUserMap,this),this.mappingChange=r(this.mappingChange,this),this.mappingShow=r(this.mappingShow,this),this.mapping=r(this.mapping,this),this.handleCertificateIssue=r(this.handleCertificateIssue,this),this.foldersShow=r(this.foldersShow,this),this.folders=r(this.folders,this),this.discover=r(this.discover,this),this.showSlideDiscover=r(this.showSlideDiscover,this),this.showDiscoverDetails=r(this.showDiscoverDetails,this),this.showSlide=r(this.showSlide,this),this.save=r(this.save,this),this.render=r(this.render,this),e.__super__.constructor.apply(this,arguments),this.wizardConfig=$.extend(!0,{},this.config),void 0!==this.currentAuthenticationMethod&&(this.wizardConfig.auth_type=this.currentAuthenticationMethod),this.container&&this.el.addClass("modal--local"),this.render(),this.el.modal({keyboard:!0,show:!0,backdrop:!0,container:this.container}).on({"show.bs.modal":this.onShow,"shown.bs.modal":(t=this,function(){return t.el.addClass("modal--ready"),t.onShown()}),"hidden.bs.modal":function(t){return function(){return t.el.remove()}}(this)}),this.slide&&this.showSlide(this.slide)}return o(e,t),e.prototype.slideMethod={"js-folders":"foldersShow","js-mapping":"mappingShow"},e.prototype.events={"submit form.js-discover":"discoverParams","submit form.js-discoverCertificateIssue":"discoverConfig","submit form.js-folders":"mapping","click .js-cancelSsl":"showSlideDiscover","click .js-mapping .js-submitTry":"mappingChange","click .js-try .js-submitSave":"save","click .js-close":"hide","click .js-remove":"removeRow","click .js-userMappingForm .js-add":"addUserMapping","click .js-goToSlide":"goToSlide"},e.prototype.elements={".modal-body":"body",".js-foldersSelect":"foldersSelect",".js-folders .js-submitTry":"foldersSelectSubmit",".js-userMappingForm":"userMappingForm",".js-expertForm":"expertForm"},e.prototype.render=function(){return this.ajax({id:"exchange_index",type:"GET",url:this.apiPath+"/integration/exchange/index",processData:!0,success:(t=this,function(e){if(t.exchange_oauth=e.oauth,t.html(App.view("integration/exchange_wizard")({exchange_oauth:t.exchange_oauth})),t.showDiscoverDetails(),t.presetAuthenticationMethod(),t.start)return t[t.start]()})});var t},e.prototype.save=function(t){return t.preventDefault(),this.callback(this.wizardConfig),this.hide(t)},e.prototype.showSlide=function(t){var n;return(n=this.slideMethod[t])&&this[n]&&this[n](!0),e.__super__.showSlide.apply(this,arguments)},e.prototype.showDiscoverDetails=function(){if(this.$('.js-discover input[name="endpoint"]').val(this.wizardConfig.endpoint),"basic"===this.wizardConfig.auth_type)return this.$('.js-discover input[name="user"]').val(this.wizardConfig.user),this.$('.js-discover input[name="password"]').val(this.wizardConfig.password)},e.prototype.showSlideDiscover=function(){return this.showSlide("js-discover")},e.prototype.discoverParams=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),this.wizardConfig.endpoint=e.endpoint,this.wizardConfig.disable_ssl_verify=e.disable_ssl_verify,"basic"===this.wizardConfig.auth_type&&(this.wizardConfig.user=e.user,this.wizardConfig.password=e.password),this.discover(e)},e.prototype.discoverConfig=function(t){return t.preventDefault(),this.discover(this.wizardConfig)},e.prototype.discover=function(t){return this.showSlide("js-connect"),this.ajax({id:"exchange_discover",type:"POST",url:this.apiPath+"/integration/exchange/autodiscover",data:JSON.stringify(t),processData:!0,success:(e=this,function(t){if("ok"===t.result||"oauth"===e.wizardConfig.auth_type)return e.folders();e.handleCertificateIssue({message:t.message,wizardClass:"js-discover"})}),error:function(t){return function(e){var n,i;return i=e.responseText,n={},_.isEmpty(i)||(n=JSON.parse(i)),t.showSlide("js-discover"),t.showAlert("js-discover",n.error||__("Server operation failed."))}}(this)});var e},e.prototype.folders=function(){return this.showSlide("js-analyze"),this.ajax({id:"exchange_folders",type:"POST",url:this.apiPath+"/integration/exchange/folders",data:JSON.stringify(this.wizardConfig),processData:!0,success:(t=this,function(e){if("ok"===e.result)return t.wizardConfig.wizardData={},t.wizardConfig.wizardData.backend_folders=e.folders||[],t.foldersShow();t.handleCertificateIssue({message:e.message,wizardClass:"js-discover"})}),error:function(t){return function(e){var n,i;return i=e.responseText,n={},_.isEmpty(i)||(n=JSON.parse(i)),t.showSlide("js-discover"),t.showAlert("js-discover",n.error||__("Server operation failed."))}}(this)});var t},e.prototype.foldersShow=function(t){if(t||this.showSlide("js-folders"),this.foldersSelect.html(this.createColumnSelection("folders",this.wizardConfig.wizardData.backend_folders,this.wizardConfig.folders)),this.wizardConfig.folders&&this.wizardConfig.folders.length>0)return this.foldersSelectSubmit.removeClass("is-disabled")},e.prototype.createColumnSelection=function(t,e,n){return App.UiElement.column_select.render({name:t,null:!1,nulloption:!1,options:e,value:n,onChange:(i=this,function(t){return _.isArray(t)&&t.length>0?i.foldersSelectSubmit.removeClass("is-disabled"):i.foldersSelectSubmit.addClass("is-disabled")})});var i},e.prototype.handleCertificateIssue=function(t){var e,n,i;return this.wizardConfig.disable_ssl_verify=1,-1===t.message.indexOf("certificate")?(this.showSlide(t.wizardClass),this.showAlert(t.wizardClass,t.message)):(n=t.wizardClass+"CertificateIssue",e=this.domainFromMessageOrEmail({message:t.message}),i=App.view("integration/exchange_certificate_issue")({wizardClass:n,domain:e}),this.$(".js-certificateIssuePlaceholder").html(i),this.showSlide(n))},e.prototype.domainFromMessageOrEmail=function(t){var e,n;return(n=t.message.match(/hostname[ ]\"([^\"]+)"/i))?n[1]:(e=this.wizardConfig.user.match(/@(.*)$/))?e[1]:this.wizardConfig.user},e.prototype.mapping=function(t){var e,n;return t.preventDefault(),e=this.formParam(t.target),this.wizardConfig.folders=e.folders,"string"==typeof this.wizardConfig.folders&&(this.wizardConfig.folders=[this.wizardConfig.folders]),this.showSlide("js-analyze"),this.ajax({id:"exchange_mapping",type:"POST",url:this.apiPath+"/integration/exchange/mapping",data:JSON.stringify(this.wizardConfig),processData:!0,success:(n=this,function(t){var e,i,s,r;if("ok"!==t.result)return n.showSlide("js-folders"),void n.showAlert("js-folders",t.message);for(i in e={},s=App.User.attributesGet())r=s[i],"login"!==i&&("input"!==r.tag&&"richtext"!==r.tag&&"textarea"!==r.tag||"password"===r.type||(e[i]=r.display||i));return n.wizardConfig.wizardData.attributes=e,n.wizardConfig.wizardData.backend_attributes=t.attributes,n.mappingShow()}),error:function(t){return function(e){var n,i;return i=e.responseText,n={},_.isEmpty(i)||(n=JSON.parse(i)),t.showSlide("js-folders"),t.showAlert("js-folders",n.error||__("Server operation failed."))}}(this)})},e.prototype.mappingShow=function(t){var e;return t||this.showSlide("js-mapping"),e=this.wizardConfig.attributes,_.isEmpty(e)&&(e={given_name:"firstname",surname:"lastname","email_addresses.emailaddress1":"email","phone_numbers.businessphone":"phone"}),this.userMappingForm.find("tbody tr.js-entry").remove(),this.userMappingForm.find("tbody tr").before(this.buildRowsUserMap(e))},e.prototype.mappingChange=function(t){var e,n,i,s,r,o,a,l,c;for(t.preventDefault(),e=this.formParam(this.userMappingForm),s=0,a=(l=["source","dest"]).length;s<a;s++)o=l[s],_.isArray(e[o])||(e[o]=[e[o]]);for(n={},i=r=0,c=e.source.length-1;0<=c?r<=c:r>=c;i=0<=c?++r:--r)e.source[i]&&e.dest[i]&&(n[e.source[i]]=e.dest[i]);return this.wizardConfig.attributes=n,this.tryShow()},e.prototype.buildRowsUserMap=function(t){var e,n,i;for(i in n=[],t)e=t[i],i in this.wizardConfig.wizardData.backend_attributes&&n.push(this.buildRowUserAttribute(i,e));return n},e.prototype.buildRowUserAttribute=function(t,e){var n;return(n=$(App.view("integration/exchange_user_attribute_row")())).find(".js-exchangeAttribute").html(this.createSelection("source",this.wizardConfig.wizardData.backend_attributes,t)),n.find(".js-userAttribute").html(this.createSelection("dest",this.wizardConfig.wizardData.attributes,e)),n},e.prototype.createSelection=function(t,e,n,i){return App.UiElement.searchable_select.render({name:t,multiple:!1,limit:100,null:!1,nulloption:!1,options:e,value:n,unknown:i,class:"form-control--small"})},e.prototype.removeRow=function(t){return t.preventDefault(),$(t.target).closest("tr").remove()},e.prototype.addUserMapping=function(t){return t.preventDefault(),this.userMappingForm.find("tbody tr").last().before(this.buildRowUserAttribute())},e.prototype.presetAuthenticationMethod=function(){var t,e;return e=!0,
"basic"===(t=this.wizardConfig.auth_type||"basic")?(this.el.find("table.basic-auth, p.basic-auth").removeClass("hide"),this.el.find('input[name="endpoint"]').val("")):"oauth"===t&&(e=!1,this.el.find("table.basic-auth, p.basic-auth").addClass("hide"),this.el.find('input[name="endpoint"]').val(this.el.find('input[name="endpoint"]').prop("placeholder"))),this.el.find("table.basic-auth input").prop("required",e)},e.prototype.tryShow=function(t){return t&&t.preventDefault(),this.showSlide("js-analyze"),this.ajax({id:"exchange_try",type:"POST",url:this.apiPath+"/integration/exchange/job_try",data:JSON.stringify(this.wizardConfig),processData:!0,success:(e=this,function(){return e.tryLoop()})});var e},e.prototype.tryLoop=function(){return this.showSlide("js-dry"),this.ajax({id:"jobs_try_index",type:"GET",url:this.apiPath+"/integration/exchange/job_try",data:{finished:!0},processData:!0,success:(t=this,function(e){return e.result&&(e.result.error||e.result.info)?(t.showSlide("js-error"),void t.showAlert("js-error",e.result.error||e.result.info)):(e.result&&_.keys(e.result).length>0&&(t.$(".js-preprogress").addClass("hide"),t.$(".js-analyzing").removeClass("hide"),t.$(".js-progress progress").attr("value",e.result.sum),t.$(".js-progress progress").attr("max",e.result.total)),e.finished_at?(t.$(".js-preprogress").removeClass("hide"),t.$(".js-analyzing").addClass("hide"),t.tryResult(e)):t.delay(t.tryLoop,4e3))})});var t},e.prototype.tryResult=function(t){var e;return this.showSlide("js-try"),e=$(App.view("integration/exchange_summary")({job:t})),this.el.find(".js-summary").html(e)},e}(App.ControllerWizardModal),t=function(t){function e(){return this.onSubmit=r(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.head=__("Connect Exchange App"),e.prototype.shown=!0,e.prototype.button="Connect",e.prototype.buttonCancel=!0,e.prototype.small=!0,e.prototype.content=function(){var t,e;return this.external_credential=App.ExternalCredential.findByAttribute("name","exchange"),(t=$(App.view("exchange/app_config")({external_credential:this.external_credential,callbackUrl:this.callbackUrl}))).find(".js-select").on("click",(e=this,function(t){return e.selectAll(t)})),t},e.prototype.onSubmit=function(t){return this.formDisable(t),this.ajax({id:"exchange_app_verify",type:"POST",url:this.apiPath+"/external_credentials/exchange/app_verify",data:JSON.stringify(this.formParams()),processData:!0,success:(e=this,function(n){return n.attributes?(e.external_credential||(e.external_credential=new App.ExternalCredential),e.external_credential.load({name:"exchange",credentials:n.attributes}),e.external_credential.save({done:function(){return e.close()},fail:function(){return e.el.find(".alert").removeClass("hidden").text(__("The entry could not be created."))}}),void App.Event.trigger("exchange::load_exchange_data")):(e.formEnable(t),e.el.find(".alert").removeClass("hidden").text(n.error||__("App could not be verified.")))})});var e},e}(App.ControllerModal),App.Config.set("IntegrationExchange",{name:__("Exchange"),target:"#system/integration/exchange",description:__("Exchange integration for contacts management."),controller:n,state:s,permission:["admin.integration.exchange"]},"NavBarIntegrations")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=function(e){function n(){return this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return s(n,e),n.prototype.featureIntegration="github_integration",n.prototype.featureName=__("GitHub"),n.prototype.featureConfig="github_config",n.prototype.description=[[__("This service allows you to connect %s with %s."),"GitHub","Zammad"]],n.prototype.events={"change .js-switch input":"switch"},n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new t({el:this.$(".js-form")})},n}(App.ControllerIntegrationBase),t=function(t){function e(){this.validateAndSave=i(this.validateAndSave,this),this.update=i(this.update,this),this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return s(e,t),e.prototype.events={"submit form":"update"},e.prototype.render=function(){var t;return t=App.Setting.get("github_config"),this.html(App.view("integration/github")({config:t}))},e.prototype.update=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),this.validateAndSave(e)},e.prototype.validateAndSave=function(t){return App.Ajax.request({id:"github",type:"POST",url:this.apiPath+"/integration/github/verify",data:JSON.stringify({api_token:t.api_token,endpoint:t.endpoint}),success:(e=this,function(n){if("failed"!==n.result)return App.Setting.set("github_config",t,{notify:!0});new App.ControllerErrorModal({message:n.message,container:e.el.closest(".content")})}),error:function(t,e){var n;if("abort"!==e)return n=t.responseJSON||{},App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("Saving failed."))})}});var e},e}(App.Controller),n=function(){function t(){}return t.current=function(){return App.Setting.get("github_integration")},t}(),App.Config.set("IntegrationGitHub",{name:__("GitHub"),target:"#system/integration/github",description:__("Link GitHub issues to your tickets."),controller:e,state:n},"NavBarIntegrations")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=function(e){function n(){return this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return s(n,e),n.prototype.featureIntegration="gitlab_integration",n.prototype.featureName=__("GitLab"),n.prototype.featureConfig="gitlab_config",n.prototype.description=[[__("This service allows you to connect %s with %s."),"GitLab","Zammad"]],n.prototype.events={"change .js-switch input":"switch"},n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new t({el:this.$(".js-form")})},n}(App.ControllerIntegrationBase),t=function(t){function e(){this.handleSslVerifyAlert=i(this.handleSslVerifyAlert,this),this.validateAndSave=i(this.validateAndSave,this),this.update=i(this.update,this),this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render(),this.handleSslVerifyAlert()}return s(e,t),e.prototype.elements={".js-sslVerifyAlert":"sslVerifyAlert"},e.prototype.events={"change .js-sslVerify select":"handleSslVerifyAlert","submit form":"update"},e.prototype.render=function(){var t,e,n;return t=App.Setting.get("gitlab_config"),n=App.UiElement.boolean.render({name:"verify_ssl",null:!1,default:!0,value:t.verify_ssl,class:"form-control form-control--small"}),(e=$(App.view("integration/gitlab")({config:t}))).find(".js-sslVerify").html(n),this.html(e)},e.prototype.update=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),this.validateAndSave(e)},e.prototype.validateAndSave=function(t){return App.Ajax.request({id:"gitlab",type:"POST",url:this.apiPath+"/integration/gitlab/verify",data:JSON.stringify({api_token:t.api_token,endpoint:t.endpoint,verify_ssl:t.verify_ssl}),success:(e=this,function(n){if("failed"!==n.result)return App.Setting.set("gitlab_config",t,{notify:!0});new App.ControllerErrorModal({message:n.message,container:e.el.closest(".content")})}),error:function(t,e){var n;if("abort"!==e)return n=t.responseJSON||{},App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("Saving failed."))})}});var e},e.prototype.handleSslVerifyAlert=function(){return this.formParam(this.el).verify_ssl?this.sslVerifyAlert.addClass("hide"):this.sslVerifyAlert.removeClass("hide")},e}(App.Controller),n=function(){function t(){}return t.current=function(){return App.Setting.get("gitlab_integration")},t}(),App.Config.set("IntegrationGitLab",{name:__("GitLab"),target:"#system/integration/gitlab",description:__("Link GitLab issues to your tickets."),controller:e,state:n},"NavBarIntegrations")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;t=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.featureIntegration="icinga_integration",e.prototype.featureName=__("Icinga"),e.prototype.featureConfig="icinga_config",e.prototype.description=[[__("This service receives emails from %s and creates tickets with host and service."),"Icinga"],[__("If the host and service have recovered, the ticket can be closed automatically.")]],e.prototype.render=function(){return e.__super__.render.apply(this,arguments),new App.SettingsForm({area:"Integration::Icinga",el:this.$(".js-form")})},e}(App.ControllerIntegrationBase),e=function(){function t(){}return t.current=function(){return App.Setting.get("icinga_integration")},t}(),App.Config.set("IntegrationIcinga",{name:__("Icinga"),target:"#system/integration/icinga",description:__("An open-source monitoring tool."),controller:t,state:e,permission:["admin.integration.icinga"]},"NavBarIntegrations")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=function(e){function n(){return this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return s(n,e),n.prototype.featureIntegration="idoit_integration",n.prototype.featureName="i-doit",n.prototype.featureConfig="idoit_config",n.prototype.description=[[__("This service allows you to connect %s with %s."),"i-doit","Zammad"]],n.prototype.events={"change .js-switch input":"switch"},n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new t({el:this.$(".js-form")}),new App.HttpLog({el:this.$(".js-log"),facility:"idoit"})},n}(App.ControllerIntegrationBase),t=function(t){function e(){this.handleSslVerifyAlert=i(this.handleSslVerifyAlert,this),this.validateAndSave=i(this.validateAndSave,this),this.update=i(this.update,this),this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render(),this.handleSslVerifyAlert()}return s(e,t),e.prototype.elements={".js-sslVerifyAlert":"sslVerifyAlert"},e.prototype.events={"change .js-sslVerify select":"handleSslVerifyAlert","submit form":"update"},e.prototype.currentConfig=function(){return App.Setting.get("idoit_config")},e.prototype.setConfig=function(t){return App.Setting.set("idoit_config",t,{notify:!0})},e.prototype.render=function(){var t,e;return this.config=this.currentConfig(),e=App.UiElement.boolean.render({name:"verify_ssl",null:!1,default:!0,value:this.config.verify_ssl,class:"form-control form-control--small"}),(t=$(App.view("integration/idoit")({config:this.config}))).find(".js-sslVerify").html(e),this.html(t)},e.prototype.update=function(t){return t.preventDefault(),this.config=this.formParam(t.target),this.validateAndSave()},e.prototype.validateAndSave=function(){return this.ajax({id:"idoit",type:"POST",url:this.apiPath+"/integration/idoit/verify",data:JSON.stringify({method:"cmdb.object_types",api_token:this.config.api_token,endpoint:this.config.endpoint,client_id:this.config.client_id,verify_ssl:this.config.verify_ssl}),success:(t=this,function(e){if("failed"!==e.result)return t.setConfig(t.config);new App.ErrorModal({message:e.message,container:t.el.closest(".content")})}),error:function(t){return function(e,n){var i;if("abort"!==n)return i=e.responseJSON||{},t.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("Saving failed."))})}}(this)});var t},e.prototype.handleSslVerifyAlert=function(){return this.formParam(this.el).verify_ssl?this.sslVerifyAlert.addClass("hide"):this.sslVerifyAlert.removeClass("hide")},e}(App.Controller),n=function(){function t(){}return t.current=function(){return App.Setting.get("idoit_integration")},t}(),App.Config.set("IntegrationIdoit",{name:"i-doit",target:"#system/integration/idoit",description:__("CMDB to document complex relations of your network components."),controller:e,state:n},"NavBarIntegrations")}.call(this),function(){var t,e,n,i,s,r,o=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var i in e)l.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=function(t){function e(){return this.switch=o(this.switch,this),this.render=o(this.render,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.featureIntegration="ldap_integration",e.prototype.featureName=__("LDAP"),e.prototype.description=[[__("Use this switch to start synchronization of your ldap sources.")],[__("If a user is found in two (or more) configured LDAP sources, the last synchronisation will win.")],[__("In order to be able to influence the desired behaviour in this regard, you can influence the order of the LDAP sources via drag & drop.")]],e.prototype.events={"change .js-switch input":"switch"},e.prototype.render=function(){var t;return e.__super__.render.apply(this,arguments),this.index&&this.index.releaseController(),this.index=new s({el:this.$(".js-list"),id:this.id,genericObject:"LdapSource",defaultSortBy:"prio",pageData:{home:"ldap",object:__("Source"),objects:__("Sources"),navupdate:"#system/integration/ldap",notes:[],buttons:[{name:__("New Source"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content"),veryLarge:!0,dndCallback:(t=this,function(e,n){var i,s,r,o,a,l;for(l=[],a=0,i=0,o=(r=t.$(".js-list").find("table > tbody > tr")).length;i<o;i++)n=r[i],a+=1,s=$(n).data("id"),l.push([s,a]);return t.ajax({id:"ldap_sources_prio",type:"POST",url:t.apiPath+"/ldap_sources_prio",processData:!0,data:JSON.stringify({prios:l})})})}),this.importResult&&this.importResult.releaseController(),this.importResult=new n({el:this.$(".js-state")}),this.httpLog&&this.httpLog.releaseController(),this.httpLog=new App.HttpLog({el:this.$(".js-log"),facility:"ldap"})},e.prototype.switch=function(){var t,n;if(e.__super__.switch.apply(this,arguments),this.$(".js-switch input").prop("checked"))return n=this,t=function(){return n.ajax({id:"jobs_config",type:"POST",url:n.apiPath+"/integration/ldap/job_start",processData:!0,success:function(){return n.render(!0)}})},App.Delay.set(t,600,"job_start")},e}(App.ControllerIntegrationBase),n=function(t){function e(){this.startSync=o(this.startSync,this),this.lastResultShow=o(this.lastResultShow,this),this.render=o(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return a(e,t),e.prototype.elements={".js-lastImport":"lastImport"},e.prototype.events={"click .js-start-sync":"startSync"},e.prototype.render=function(){var t;if(this.ajax({id:"jobs_start_index",type:"GET",url:this.apiPath+"/integration/ldap/job_start",processData:!0,success:(t=this,function(e){return _.isEmpty(e)||t.lastResultShowJob&&t.lastResultShowJob.updated_at===e.updated_at||(t.lastResultShowJob=e,t.lastResultShow(e),App.Event.trigger("LDAP::ImportJob::WizardState",!e.finished_at)),t.delay(t.render,5e3,"ImportResultRender")})}),this.renderBind||(this.renderBind=App.Event.bind("LDAP::ImportJob::Render",this.render)),!this.startSyncBind)return this.startSyncBind=App.Event.bind("LDAP::ImportJob::StartSync",this.startSync)},e.prototype.lastResultShow=function(t){var e,n,i,s;for(i in t.result.roles||(t.result.roles={}),e=t.result.role_ids)s=e[i],App.Role.exists(i)&&(n=App.Role.find(i),t.result.roles[n.displayName()]=s);return this.html(App.view("integration/ldap_last_import")({job:t}))},e.prototype.startSync=function(){return this.ajax({id:"jobs_config",type:"POST",url:this.apiPath+"/integration/ldap/job_start",processData:!0,success:(t=this,function(){return t.render()})});var t},e}(App.Controller),e=function(e){function n(){var t;this.activeDryRun=o(this.activeDryRun,this),this.startWizard=o(this.startWizard,this),this.render=o(this.render,this),this.setConfig=o(this.setConfig,this),this.hideIndex=o(this.hideIndex,this),n.__super__.constructor.apply(this,arguments),this.hideIndex(),this.render(),App.Event.bind("LDAP::ImportJob::WizardState",(t=this,function(e){return t.wizardButton.attr("disabled",e)})),App.Event.bind("LDAP::Form::Render",this.render),App.Event.trigger("LDAP::ImportJob::Render"),this.activeDryRun()}return a(n,e),n.prototype.elements={".js-wizard":"wizardButton"},n.prototype.events={"click .js-wizard":"startWizard","click .js-back":"showIndex"},n.prototype.hideIndex=function(t){return null==t&&(t=void 0),this.el.closest(".main").find(".page-content").children().each((function(){return!!$(this).hasClass("js-state")||($(this).hasClass("js-form")?$(this).removeClass("hidden"):$(this).addClass("hidden"))}))},n.prototype.showIndex=function(t){return null==t&&(t=void 0),t&&t.preventDefault(),this.el.closest(".main").find(".page-content").children().each((function(){return!!$(this).hasClass("js-state")||($(this).hasClass("js-form")?$(this).addClass("hidden"):$(this).removeClass("hidden"))}))},n.prototype.currentConfig=function(){var t;return(t=_.clone(this.item.preferences)).id=this.item.id,t.name=this.item.name,t.active=this.item.active,t},n.prototype.setConfig=function(t){return this.item.name=t.name,this.item.active=t.active,this.item.preferences=_.omit(t,["id","name","active"]),this.item.save({done:(e=this,function(){return e.showIndex(),App.Event.trigger("LDAP::ImportJob::StartSync"),App.Event.trigger("LDAP::Form::Render")})});var e},n.prototype.render=function(t){var e,n,i,s,r,o;for(r in null==t&&(t=!1),this.config=this.currentConfig(),i={},s=this.config.group_role_map)n=s[r],i[r]=n.map((function(t){return App.Role.exists(t)?App.Role.find(t).displayName():"?"})).join(", ");if("off"===this.config.ssl?this.config.ssl_humanized=__("No SSL"):"starttls"===this.config.ssl?this.config.ssl_humanized=__("STARTTLS"):this.config.ssl_humanized=__("SSL"),this.html(App.view("integration/ldap")({item:this.item,config:this.config,group_role_map:i})),_.isEmpty(this.config.host)?(this.$(".js-notConfigured").removeClass("hide"),this.$(".js-summary").addClass("hide")):(this.$(".js-notConfigured").addClass("hide"),this.$(".js-summary").removeClass("hide")),t)return o=this,e=function(){return o.scrollToIfNeeded($(".content.active .page-header"))},this.delay(e,500)},n.prototype.startWizard=function(e){return e.preventDefault(),new t({container:this.el.closest(".content"),config:this.config,callback:(n=this,function(t){return n.setConfig(t)})});var n},n.prototype.activeDryRun=function(){return this.ajax({id:"jobs_try_index",type:"GET",url:this.apiPath+"/integration/ldap/job_try",data:{finished:!1},processData:!0,success:(e=this,function(n){if(!_.isEmpty(n))return new t({container:e.el.closest(".content"),config:n.payload,start:"tryLoop",callback:function(t){return App.Event.trigger("LDAP::ImportJob::WizardState",!1),e.setConfig(t)}}),App.Event.trigger("LDAP::ImportJob::WizardState",!0)})});var e},n}(App.Controller),r=function(){function t(){}return t.current=function(){return App.Setting.get("ldap_integration")},t}(),t=function(t){function e(){var t;this.handleSslVerifyAlert=o(this.handleSslVerifyAlert,this),this.tryResult=o(this.tryResult,this),this.tryLoop=o(this.tryLoop,this),this.tryShow=o(this.tryShow,this),this.addGroupRoleMapping=o(this.addGroupRoleMapping,this),this.addUserMapping=o(this.addUserMapping,this),this.buildRowGroupRole=o(this.buildRowGroupRole,this),this.buildRowsGroupRole=o(this.buildRowsGroupRole,this),this.buildRowUserAttribute=o(this.buildRowUserAttribute,this),this.buildRowsUserMap=o(this.buildRowsUserMap,this),this.mappingChange=o(this.mappingChange,this),this.mappingShow=o(this.mappingShow,this),this.bindChange=o(this.bindChange,this),this.bindShow=o(this.bindShow,this),this.discover=o(this.discover,this),this.buildRowSslVerify=o(this.buildRowSslVerify,this),this.checkSslVerifyVisibility=o(this.checkSslVerifyVisibility,this),this.sslChange=o(this.sslChange,this),this.showSlide=o(this.showSlide,this),this.save=o(this.save,this),this.saveQuit=o(this.saveQuit,this),this.render=o(this.render,this),e.__super__.constructor.apply(this,arguments),this.wizardConfig=this.config||{},this.wizardData={},this.container&&this.el.addClass("modal--local"),this.render(),this.el.modal({keyboard:!0,show:!0,backdrop:!0,container:this.container}).on({"shown.bs.modal":(t=this,function(){return t.el.addClass("modal--ready")}),"hidden.bs.modal":function(t){return function(){return t.el.remove()}}(this)}),this.slide?this.showSlide(this.slide):this.checkSslVerifyVisibility(this.wizardConfig.ssl||"ssl"),this.start&&this[this.start]()}return a(e,t),e.prototype.slideMethod={"js-bind":"bindShow","js-mapping":"mappingShow"},e.prototype.events={"submit form.js-discover":"discover","submit form.js-bind":"bindChange","click .js-mapping .js-submitTry":"mappingChange","click .js-try .js-submitSave":"save","click .js-close":"hide","click .js-remove":"removeRow","click .js-userMappingForm .js-add":"addUserMapping","click .js-groupRoleForm .js-add":"addGroupRoleMapping","click .js-goToSlide":"goToSlide","click .js-saveQuit":"saveQuit","change .js-Ssl":"sslChange","input .js-hostUrl":"hostChange"},e.prototype.elements={".modal-body":"body",".js-userMappingForm":"userMappingForm",".js-groupRoleForm":"groupRoleForm",".js-expertForm":"expertForm",".js-sslVerifyAlert":"sslVerifyAlert"},e.prototype.render=function(){var t,e,n,i;return n=App.UiElement.input.render({name:"name",id:"name",display:__("Name"),tag:"input",type:"text",class:"form-control--small",required:"required",value:this.config.name})[0].outerHTML,t=App.UiElement.boolean.render({name:"active",display:__("Active"),tag:"active",value:this.config.active,required:"required",class:"form-control--small"})[0].outerHTML,e=App.UiElement.input.render({name:"host",id:"host",display:__("Host"),tag:"input",type:"text",class:"form-control--small js-hostUrl",required:"required",placeholder:"ldap.example.com",value:this.config.host,autocomplete:'autocomplete="off"'})[0].outerHTML,i=App.UiElement.select.render({name:"ssl",id:"ssl",multiple:!1,null:!1,options:{off:__("No SSL"),ssl:__("SSL"),starttls:__("STARTTLS")},value:this.config.ssl||"ssl",translate:!0,class:"form-control--small js-Ssl"})[0].outerHTML,this.html(App.view("integration/ldap_wizard")({newConnection:this.newConnection,nameHtml:n,activeHtml:t,hostHtml:e,sslHtml:i}))},e.prototype.saveQuit=function(t){var e,n;if(t.preventDefault(),!(e=$(t.target).closest("form").get(0))||!e.reportValidity||e.reportValidity())return n=this.formParam(t.target),this.wizardConfig.host=n.host,this.wizardConfig.ssl=n.ssl,this.wizardConfig.ssl_verify=n.ssl_verify,this.wizardConfig.name=n.name,this.wizardConfig.active=n.active,this.callback(this.wizardConfig),this.hide(t)},e.prototype.save=function(t){return t.preventDefault(),this.callback(this.wizardConfig),this.hide(t)},e.prototype.showSlide=function(t){var n;return(n=this.slideMethod[t])&&this[n]&&this[n](!0),e.__super__.showSlide.apply(this,arguments)},e.prototype.hostChange=function(t){var e,n,i,s;if(t.preventDefault(),n=(s=$(t.currentTarget).val().split("://"))[0],e=s[1],!_.isEmpty(n)&&!_.isEmpty(e)&&["ldap","ldaps"].includes(n))return i={ldap:"off",ldaps:"ssl"},$(".js-hostUrl").val(e),$(".js-Ssl").val(i[n]).trigger("change")},e.prototype.sslChange=function(t){return this.checkSslVerifyVisibility($(t.currentTarget).val())},e.prototype.checkSslVerifyVisibility=function(t){var e,n,i;return e=!0,"ssl"!==t&&"starttls"!==t||(e=!1),(i=(n=this.$(".js-discover .js-sslVerify")).length)&&e?(n.parent().remove(),this.sslVerifyAlert.addClass("hide")):i||e?void 0:(this.$(".js-Ssl").closest("tr").after(this.buildRowSslVerify()),this.handleSslVerifyAlert())},e.prototype.buildRowSslVerify=function(){var t,e,n;return t=$(App.view("integration/ldap_ssl_verify_row")()),n=!0,void 0!==this.wizardConfig.ssl_verify&&(n=this.wizardConfig.ssl_verify),(e=App.UiElement.boolean.render({name:"ssl_verify",null:!1,options:{true:"yes",false:"no"},default:n,translate:!0,class:"form-control form-control--small"})).on("change",this.handleSslVerifyAlert),t.find(".js-sslVerify").html(e),t},e.prototype.discover=function(t){var e,n,i;if(t.preventDefault(),!(e=$(t.target).closest("form").get(0))||!e.reportValidity||e.reportValidity())return this.showSlide("js-connect"),n=this.formParam(t.target),this.ajax({id:"ldap_discover",type:"POST",url:this.apiPath+"/integration/ldap/discover",data:JSON.stringify(n),processData:!0,success:(i=this,function(t){var e,s,r,o,a,l;if("ok"!==t.result)return i.showSlide("js-discover"),void i.showAlert("js-discover",t.message);if(_.isEmpty(t.error)||"disallow-bind-anon"!==t.error||(i.wizardConfig.disallow_bind_anon=!0),i.wizardConfig.host=n.host,i.wizardConfig.ssl=n.ssl,i.wizardConfig.ssl_verify=n.ssl_verify,i.wizardConfig.name=n.name,i.wizardConfig.active=n.active,o="",a={},!_.isEmpty(t.attributes)&&!_.isEmpty(t.attributes.namingcontexts))for(s=0,r=(l=t.attributes.namingcontexts).length;s<r;s++)a[e=l[s]]=e,""===o&&(o=e),o.length>e.length&&(o=e);return i.wizardConfig.options=a,i.wizardConfig.option=o,i.bindShow()}),error:function(t){return function(e){var n,i;return i=e.responseText,n={},_.isEmpty(i)||(n=JSON.parse(i)),t.showSlide("js-discover"),t.showAlert("js-discover",n.error||__("Server operation failed."))}}(this)})},e.prototype.bindShow=function(t){var e;return t||this.showSlide("js-bind"),this.wizardConfig.disallow_bind_anon?(e=App.UiElement.input.render({name:"base_dn",id:"base_dn",display:__("Base DN"),tag:"input",type:"text",class:"form-control--small js-baseDn",required:"required",placeholder:"",value:this.wizardConfig.base_dn,autocomplete:'autocomplete="off"'})[0].outerHTML,this.$(".js-bind .js-baseDn").html(e)):this.$(".js-bind .js-baseDn").html(this.createSelection("base_dn",this.wizardConfig.options,this.wizardConfig.base_dn||this.wizardConfig.option,!0)),this.$('.js-bind input[name="bind_user"]').val(this.wizardConfig.bind_user),this.$('.js-bind input[name="bind_pw"]').val(this.wizardConfig.bind_pw)},e.prototype.bindChange=function(t){var e,n;return t.preventDefault(),this.showSlide("js-analyze"),(e=this.formParam(t.target)).host=this.wizardConfig.host,e.ssl=this.wizardConfig.ssl,e.ssl_verify=this.wizardConfig.ssl_verify,this.ajax({id:"ldap_bind",type:"POST",url:this.apiPath+"/integration/ldap/bind",data:JSON.stringify(e),processData:!0,success:(n=this,function(t){var i,s,r,o,a,l,c,u,p,h,d,f,m;if("ok"!==t.result)return n.showSlide("js-bind"),void n.showAlert("js-bind",t.message);if(_.isEmpty(t.user_attributes))return n.showSlide("js-bind"),void n.showAlert("js-bind",__("User information could not be retrieved, please check your bind user permissions."));if(_.isEmpty(t.groups))return n.showSlide("js-bind"),void n.showAlert("js-bind",__("Group information could not be retrieved, please check your bind user permissions."));for(o in e)m=e[o],n.wizardConfig[o]=m;for(o in f={},c=App.User.attributesGet())"input"!==(m=c[o]).tag&&"richtext"!==m.tag&&"textarea"!==m.tag||"password"===m.type||(f[o]=m.display||o);for(d={},s=0,a=(u=App.Role.findAllByAttribute("active",!0)).length;s<a;s++)d[(h=u[s]).id]=h.displayName();for(n.wizardData={},n.wizardData.backend_user_attributes=t.user_attributes,n.wizardData.backend_groups=t.groups,n.wizardData.user_attributes=f,n.wizardData.roles=d,r=0,l=(p=["user_uid","user_filter","group_uid","group_filter"]).length;r<l;r++)o=p[r],null==(i=n.wizardConfig)[o]&&(i[o]=t[o]);return n.mappingShow()}),error:function(t){return function(e){var n,i;return i=e.responseText,n={},_.isEmpty(i)||(n=JSON.parse(i)),t.showSlide("js-bind"),t.showAlert("js-bind",n.error||__("Server operation failed."))}}(this)})},e.prototype.mappingShow=function(t){var e,n;return t||this.showSlide("js-mapping"),n=this.wizardConfig.user_attributes,_.isEmpty(n)&&(n={givenname:"firstname",sn:"lastname",mail:"email",samaccountname:"login",telephonenumber:"phone"}),this.userMappingForm.find("tbody tr.js-entry").remove(),this.userMappingForm.find("tbody tr").before(this.buildRowsUserMap(n)),this.groupRoleForm.find("tbody tr.js-entry").remove(),this.groupRoleForm.find("tbody tr").before(this.buildRowsGroupRole(this.wizardConfig.group_role_map)),this.$('.js-mapping input[name="user_filter"]').val(this.wizardConfig.user_filter),e={sigup_roles:App.i18n.translatePlain("Assign signup roles"),skip_sync:App.i18n.translatePlain("Don't synchronize")},this.$(".js-unassignedUsers").html(this.createSelection("unassigned_users",e,this.wizardConfig.unassigned_users||"sigup_roles"))},e.prototype.mappingChange=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y;for(t.preventDefault(),v=this.formParam(this.userMappingForm),r=0,u=(h=["source","dest"]).length;r<u;r++)l=h[r],_.isArray(v[l])||(v[l]=[v[l]]);for(y={},e=o=0,d=v.source.length-1;0<=d?o<=d:o>=d;e=0<=d?++o:--o)v.source[e]&&v.dest[e]&&(y[v.source[e]]=v.dest[e]);if(g=Object.keys(y).some((function(t){return"login"===y[t]})),this.wizardConfig.user_attributes=y,!g)return this.showSlide("js-mapping"),void this.showAlert("js-mapping",App.i18n.translatePlain("Attribute '%s' is required in the mapping","login"));for(i=this.formParam(this.groupRoleForm),a=0,p=(f=["source","dest"]).length;a<p;a++)l=f[a],_.isArray(i[l])||(i[l]=[i[l]]);for(s={},e=c=0,m=i.source.length-1;0<=m?c<=m:c>=m;e=0<=m?++c:--c)i.source[e]&&i.dest[e]&&(_.isArray(s[i.source[e]])||(s[i.source[e]]=[]),s[i.source[e]].push(i.dest[e]));return this.wizardConfig.group_role_map=s,n=this.formParam(this.expertForm),this.wizardConfig.user_filter=n.user_filter,this.wizardConfig.unassigned_users=n.unassigned_users,this.tryShow()},e.prototype.buildRowsUserMap=function(t){var e,n,i;for(i in n=[],t)e=t[i],n.push(this.buildRowUserAttribute(i,e));return n},e.prototype.buildRowUserAttribute=function(t,e){var n;return(n=$(App.view("integration/ldap_user_attribute_row")())).find(".js-ldapAttribute").html(this.createSelection("source",this.wizardData.backend_user_attributes,t,!0)),n.find(".js-userAttribute").html(this.createSelection("dest",this.wizardData.user_attributes,e)),n},e.prototype.buildRowsGroupRole=function(t){var e,n,i,s,r,o;for(o in i=[],t)for(s=0,r=(n=t[o]).length;s<r;s++)e=n[s],i.push(this.buildRowGroupRole(o,e));return i},e.prototype.buildRowGroupRole=function(t,e){var n;return(n=$(App.view("integration/ldap_group_role_row")())).find(".js-ldapList").html(this.createAutocompletion("source",this.wizardData.backend_groups,t)),n.find(".js-roleList").html(this.createSelection("dest",this.wizardData.roles,e)),n},e.prototype.createSelection=function(t,e,n,i){return App.UiElement.searchable_select.render({name:t,multiple:!1,limit:100,null:!1,nulloption:!1,options:e,value:n,unknown:i,class:"form-control--small"})},e.prototype.createAutocompletion=function(t,e,n){var i;return App.UiElement.autocompletion.render({id:""+t+Math.floor(999999*Math.random()).toString(),name:t,multiple:!1,null:!1,nulloption:!1,class:"form-control--small",minLengt:-1,value:n,source:function(t,n){var i,s,r,o,a,l,c;for(i=0,c=200,l=[],o=0,a=(s=Object.keys(e)).length;o<a;o++)if((r=s[o]).includes(t.term)){if(i>=c)break;l.push({id:r,label:r,value:r}),i++}return n(l)}},((i={})[t+"_autocompletion_value_shown"]=n,i))},e.prototype.removeRow=function(t){return t.preventDefault(),$(t.target).closest("tr").remove()},e.prototype.addUserMapping=function(t){return t.preventDefault(),this.userMappingForm.find("tbody tr").last().before(this.buildRowUserAttribute())},e.prototype.addGroupRoleMapping=function(t){return t.preventDefault(),this.groupRoleForm.find("tbody tr").last().before(this.buildRowGroupRole())},e.prototype.tryShow=function(t){return t&&t.preventDefault(),this.showSlide("js-analyze"),this.ajax({id:"ldap_try",type:"POST",url:this.apiPath+"/integration/ldap/job_try",data:JSON.stringify(this.wizardConfig),processData:!0,success:(e=this,function(){return e.tryLoop()})});var e},e.prototype.tryLoop=function(){return this.showSlide("js-dry"),this.ajax({id:"jobs_try_index",type:"GET",url:this.apiPath+"/integration/ldap/job_try",data:{finished:!0},processData:!0,success:(t=this,function(e){return e.result&&(e.result.error||e.result.info)?(t.showSlide("js-error"),
void t.showAlert("js-error",e.result.error||e.result.info)):(e.result&&e.result.total&&(t.$(".js-preprogress").addClass("hide"),t.$(".js-analyzing").removeClass("hide"),t.$(".js-progress progress").attr("value",e.result.sum),t.$(".js-progress progress").attr("max",e.result.total)),e.finished_at?(t.$(".js-preprogress").removeClass("hide"),t.$(".js-analyzing").addClass("hide"),void t.tryResult(e)):void t.delay(t.tryLoop,4e3))})});var t},e.prototype.tryResult=function(t){var e,n,i,s,r;for(s in t.result.roles||(t.result.roles={}),n=t.result.role_ids)r=n[s],App.Role.find(s)&&(i=App.Role.find(s),t.result.roles[i.displayName()]=r);return this.showSlide("js-try"),e=$(App.view("integration/ldap_summary")({job:t})),this.el.find(".js-summary").html(e)},e.prototype.handleSslVerifyAlert=function(){return this.formParam(this.el).ssl_verify?this.sslVerifyAlert.addClass("hide"):this.sslVerifyAlert.removeClass("hide")},e}(App.ControllerWizardModal),s=function(n){function i(){var t;this.edit=o(this.edit,this),i.__super__.constructor.apply(this,arguments),App.Event.bind("LdapSource:destroy",(t=this,function(e){if(t.ldapForm&&e.id===t.ldapForm.item.id)return t.ldapForm.releaseController()}))}return a(i,n),i.prototype.new=function(e){return e.preventDefault(),new t({container:this.el.closest(".content"),config:{},newConnection:!0,callback:function(t){return new App.LdapSource({name:t.name,active:t.active,preferences:_.omit(t,["id","name","active"])}).save({done:function(){return App.Event.trigger("LDAP::ImportJob::StartSync"),App.Event.trigger("LDAP::Form::Render")}})}})},i.prototype.edit=function(t,n){var i;return n.preventDefault(),i=App[this.genericObject].find(t),this.ldapForm&&this.ldapForm.releaseController(),this.ldapForm=new e({el:this.el.closest(".main").find(".js-form"),item:i})},i}(App.ControllerGenericIndex),App.Config.set("IntegrationLDAP",{name:__("LDAP"),target:"#system/integration/ldap",description:__("LDAP integration for user management."),controller:i,state:r,permission:["admin.integration.ldap"]},"NavBarIntegrations")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;t=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.featureIntegration="monit_integration",e.prototype.featureName=__("Monit"),e.prototype.featureConfig="monit_config",e.prototype.description=[[__("This service receives emails from %s and creates tickets with host and service."),"Monit"],[__("If the host and service have recovered, the ticket can be closed automatically.")]],e.prototype.render=function(){return e.__super__.render.apply(this,arguments),new App.SettingsForm({area:"Integration::Monit",el:this.$(".js-form")})},e}(App.ControllerIntegrationBase),e=function(){function t(){}return t.current=function(){return App.Setting.get("monit_integration")},t}(),App.Config.set("IntegrationMonit",{name:__("Monit"),target:"#system/integration/monit",description:__("An open-source monitoring tool."),controller:t,state:e,permission:["admin.integration.monit"]},"NavBarIntegrations")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;t=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.featureIntegration="nagios_integration",e.prototype.featureName=__("Nagios"),e.prototype.featureConfig="nagios_config",e.prototype.description=[[__("This service receives emails from %s and creates tickets with host and service."),"Nagios"],[__("If the host and service have recovered, the ticket can be closed automatically.")]],e.prototype.render=function(){return e.__super__.render.apply(this,arguments),new App.SettingsForm({area:"Integration::Nagios",el:this.$(".js-form")})},e}(App.ControllerIntegrationBase),e=function(){function t(){}return t.current=function(){return App.Setting.get("nagios_integration")},t}(),App.Config.set("IntegrationNagios",{name:__("Nagios"),target:"#system/integration/nagios",description:__("An open-source monitoring tool."),controller:t,state:e},"NavBarIntegrations")}.call(this),function(){var t,n,i,s,r,o,a=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function n(){this.constructor=t}for(var i in e)c.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;i=function(n){function i(){return this.checkStatus=a(this.checkStatus,this),this.render=a(this.render,this),i.__super__.constructor.apply(this,arguments)}return l(i,n),i.prototype.featureIntegration="pgp_integration",i.prototype.featureName=__("PGP"),i.prototype.featureConfig="pgp_config",i.prototype.description=[[__("Pretty Good Privacy (PGP) is an encryption program that can be used for signing, encrypting and decrypting messages and to increase the security of e-mail communication.")]],i.prototype.events={"change .js-switch input":"switch"},i.prototype.render=function(){return i.__super__.render.apply(this,arguments),new t({el:this.$(".js-form")}),new App.HttpLog({el:this.$(".js-log"),facility:"PGP"}),this.checkStatus()},i.prototype.checkStatus=function(){return this.ajax({id:"pgp-status",type:"GET",url:this.apiPath+"/integration/pgp/status",success:(t=this,function(e){if(!_.isEmpty(e.error))return $("<div>").addClass("alert alert--danger").text(e.error).insertAfter(t.$(".page-content > p"))}),error:function(t){return function(n){var i,s;return s=(i=n.responseJSON||{}).error_human||i.error||__("The import failed."),t.showAlert(App.i18n.translateContent(s)),t.formEnable(e)}}(this)});var t},i}(App.ControllerIntegrationBase),t=function(t){function e(){this.updateGroup=a(this.updateGroup,this),this.addKey=a(this.addKey,this),this.groupList=a(this.groupList,this),this.keysList=a(this.keysList,this),this.render=a(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return l(e,t),e.prototype.events={"click .js-addKey":"addKey","click .js-updateGroup":"updateGroup"},e.prototype.currentConfig=function(){return App.Setting.get("pgp_config")},e.prototype.setConfig=function(t){return App.Setting.set("pgp_config",t,{notify:!0})},e.prototype.render=function(){return this.config=this.currentConfig(),this.html(App.view("integration/pgp")({config:this.config})),this.keysList(),this.groupList()},e.prototype.keysList=function(){return this.list=new r({el:this.$(".js-keysList")})},e.prototype.groupList=function(){return new n({el:this.$(".js-groupList"),config:this.config})},e.prototype.addKey=function(){return new s({callback:(t=this,function(){return t.list.load()})});var t},e.prototype.updateGroup=function(t){var e;return e=App.ControllerForm.params(t),this.setConfig(e)},e}(App.Controller),s=function(t){function e(){return this.onSubmit=a(this.onSubmit,this),this.content=a(this.content,this),e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Add"),e.prototype.autoFocusOnFirstInput=!1,e.prototype.head=__("Add Public or Private Key"),e.prototype.large=!0,e.prototype.content=function(){var t;return t=[{name:"file",display:__("Upload key"),tag:"input",input_type:"file",null:!0},{name:"key",display:__("Paste key"),tag:"textarea",null:!0},{name:"passphrase",display:"Passphrase",tag:"input",input_type:"password",null:!0}],App.Config.get("pgp_recipient_alias_configuration")&&t.push({name:"domain_alias",display:__("Domain Alias"),tag:"input",null:!0,help:__("Enter a domain name that will be associated with this key, e.g. example.com.")}),this.controller=new App.ControllerForm({model:{configure_attributes:t}}),this.addOrLineToForm(this.controller.form),this.controller.form},e.prototype.addOrLineToForm=function(t){return $("<div>").addClass("form-field-group").insertAfter(t.find(".alert--danger")).append(t.find("[data-attribute-name=file],[data-attribute-name=key]")),$("<div>").addClass("or-divider").append($("<span>").text(App.i18n.translateContent(__("or")))).insertAfter(t.find("[data-attribute-name=file]"))},e.prototype.onSubmit=function(t){var e,n;return e=new FormData($(t.currentTarget).closest("form").get(0)),this.formDisable(t),this.ajax({id:"pgp-certificate-add",type:"POST",url:this.apiPath+"/integration/pgp/key",processData:!1,contentType:!1,cache:!1,data:e,success:(n=this,function(){return n.close(),n.callback()}),error:function(e){return function(n){var i,s;return s=(i=n.responseJSON||{}).error_human||i.error||__("The import failed."),e.showAlert(App.i18n.translateContent(s)),e.formEnable(t)}}(this)})},e}(App.ControllerModal),r=function(t){function e(){this.remove=a(this.remove,this),this.render=a(this.render,this),this.load=a(this.load,this),e.__super__.constructor.apply(this,arguments),this.load()}return l(e,t),e.prototype.events={"click .js-remove":"remove"},e.prototype.load=function(){return this.ajax({id:"pgp-list",type:"GET",url:this.apiPath+"/integration/pgp/key",success:(t=this,function(e){return t.render(e)}),error:function(t){return function(e,n){var i,s;if("abort"!==n)return s=(i=e.responseJSON||{}).error_human||i.error||__("Loading failed."),t.notify({type:"error",msg:App.i18n.translateContent(s)})}}(this)});var t},e.prototype.render=function(t){return this.html(App.view("integration/pgp_list")({keys:this.formatData(t)}))},e.prototype.formatData=function(t){return _.map(t,(function(t){return t.keygrip=_.reduce(t.fingerprint.match(/.{1,4}/g),(function(t,e,n){var i;return i="",n>0&&(i=5===n?"&nbsp;&nbsp;":" "),t+(i+e)}),""),t.expires_at&&(Date.parse(t.expires_at)<Date.now()?t.expires_at_css_class="label-danger":Date.parse(t.expires_at)<Date.now()+6048e5&&(t.expires_at_css_class="label-warning")),t}))},e.prototype.remove=function(t){var e,n;if(t.preventDefault(),e=$(t.currentTarget).parents("tr").data("id"))return new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:(n=this,function(){return n.ajax({id:"key_delete",type:"DELETE",url:n.apiPath+"/integration/pgp/key/"+e,success:function(){return n.load()},error:function(t,e){var i;if("abort"!==e)return i=t.responseJSON||{},n.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("Server operation failed."))})}})}),container:this.el.closest(".content")})},e}(App.Controller),n=function(t){function e(){this.render=a(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return l(e,t),e.prototype.render=function(){var t,e,n,i,s,r,o,a,l;for(e=App.Group.search({sortBy:"name",filter:{active:!0}}),this.html(App.view("integration/pgp_group")({groups:e})),s=[],n=0,i=e.length;n<i;n++)t=e[n],s.push(function(){var e,n,i;for(l in i=[],e={default_sign:"js-signDefault",default_encryption:"js-encryptionDefault"})a=e[l],r=!0,(null!=(n=this.config)?n.group_id:void 0)&&this.config.group_id[l]&&(r=this.config.group_id[l][t.id.toString()]),o=App.UiElement.boolean.render({name:"group_id::"+l+"::"+t.id,multiple:!1,null:!1,nulloption:!1,value:r,class:"form-control--small"}),i.push(this.$("[data-id="+t.id+"] ."+a).html(o));return i}.call(this));return s},e}(App.Controller),o=function(){function t(){}return t.current=function(){return App.Setting.get("pgp_integration")},t}(),App.Config.set("IntegrationPGP",{name:__("PGP"),target:"#system/integration/pgp",description:__("Pretty Good Privacy (PGP) enables you to send digitally signed and encrypted messages."),controller:i,state:o},"NavBarIntegrations")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=function(e){function n(){return this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return s(n,e),n.prototype.featureIntegration="placetel_integration",n.prototype.featureName=__("Placetel"),n.prototype.featureConfig="placetel_config",n.prototype.description=[[__("This service shows you contacts of incoming calls and a caller list in realtime.")],[__("Caller ID of outbound calls can be changed as well.")]],n.prototype.events={"click .js-select":"selectAll","change .js-switch input":"switch"},n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new t({el:this.$(".js-form")}),new App.HttpLog({el:this.$(".js-log"),facility:"placetel"})},n}(App.ControllerIntegrationBase),t=function(t){function e(){this.removeUserDeviceMap=i(this.removeUserDeviceMap,this),this.addUserDeviceMap=i(this.addUserDeviceMap,this),this.removeOutboundRouting=i(this.removeOutboundRouting,this),this.addOutboundRouting=i(this.addOutboundRouting,this),this.removeInboundBlockCallerId=i(this.removeInboundBlockCallerId,this),this.addInboundBlockCallerId=i(this.addInboundBlockCallerId,this),this.update=i(this.update,this),this.updateCurrentConfig=i(this.updateCurrentConfig,this),this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return s(e,t),e.prototype.events={"submit form":"update","click .js-inboundBlockCallerId .js-add":"addInboundBlockCallerId","click .js-inboundBlockCallerId .js-remove":"removeInboundBlockCallerId","click .js-outboundRouting .js-add":"addOutboundRouting","click .js-outboundRouting .js-remove":"removeOutboundRouting","click .js-userDeviceMap .js-add":"addUserDeviceMap","click .js-userDeviceMap .js-remove":"removeUserDeviceMap"},e.prototype.currentConfig=function(){var t;return(t=App.Setting.get("placetel_config")).outbound||(t.outbound={}),t.outbound.routing_table||(t.outbound.routing_table=[]),t.inbound||(t.inbound={}),t.inbound.block_caller_ids||(t.inbound.block_caller_ids=[]),t.user_device_map||(t.user_device_map=[]),t},e.prototype.setConfig=function(t){return App.Setting.set("placetel_config",t,{notify:!0})},e.prototype.render=function(){var t;return this.config=this.currentConfig(),this.html(App.view("integration/placetel")({config:this.config,placetel_token:App.Setting.get("placetel_token")})),t=[{name:"view_limit",display:"",tag:"select",null:!1,options:[{name:60,value:60},{name:120,value:120},{name:180,value:180},{name:240,value:240},{name:300,value:300}]}],new App.ControllerForm({el:this.$(".js-viewLimit"),model:{configure_attributes:t},params:{view_limit:this.config.view_limit},autofocus:!1})},e.prototype.updateCurrentConfig=function(){var t,e,n,i;return e=this.config,t=this.cleanupInput,e.api_token=t(this.$("input[name=api_token]").val()),n=this.$("input[name=default_caller_id]").val(),e.outbound.default_caller_id=t(n),i=this.$("select[name=view_limit]").val(),e.view_limit=parseInt(i),e.outbound.routing_table=[],this.$(".js-outboundRouting .js-row").each((function(){var n,i,s;return i=t($(this).find('input[name="dest"]').val()),n=t($(this).find('input[name="caller_id"]').val()),s=$(this).find('input[name="note"]').val(),e.outbound.routing_table.push({dest:i,caller_id:n,note:s})})),e.inbound.block_caller_ids=[],this.$(".js-inboundBlockCallerId .js-row").each((function(){var n,i;return n=$(this).find('input[name="caller_id"]').val(),i=$(this).find('input[name="note"]').val(),e.inbound.block_caller_ids.push({caller_id:t(n),note:i})})),e.user_device_map=[],this.$(".js-userDeviceMap .js-row").each((function(){var t,n;return t=$(this).find('input[name="device_id"]').val(),n=$(this).find('input[name="user_id"]').val(),e.user_device_map.push({device_id:t,user_id:n})})),this.config=e},e.prototype.update=function(t){return t.preventDefault(),this.updateCurrentConfig(),this.setConfig(this.config)},e.prototype.cleanupInput=function(t){return t?t.replace(/\s/g,"").trim():t},e.prototype.addInboundBlockCallerId=function(t){var e,n,i;if(t.preventDefault(),this.updateCurrentConfig(),e=(n=$(t.currentTarget).closest("tr")).find('input[name="caller_id"]').val(),i=n.find('input[name="note"]').val(),!_.isEmpty(e)&&!_.isEmpty(i))return this.config.inbound.block_caller_ids.push({caller_id:this.cleanupInput(e),note:i}),this.render()},e.prototype.removeInboundBlockCallerId=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e.prototype.addOutboundRouting=function(t){var e,n,i,s;if(t.preventDefault(),this.updateCurrentConfig(),i=$(t.currentTarget).closest("tr"),n=this.cleanupInput(i.find('input[name="dest"]').val()),e=this.cleanupInput(i.find('input[name="caller_id"]').val()),s=i.find('input[name="note"]').val(),!(_.isEmpty(e)||_.isEmpty(n)||_.isEmpty(s)))return this.config.outbound.routing_table.push({dest:n,caller_id:e,note:s}),this.render()},e.prototype.removeOutboundRouting=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e.prototype.addUserDeviceMap=function(t){var e,n,i;if(t.preventDefault(),this.updateCurrentConfig(),n=$(t.currentTarget).closest("tr"),i=this.cleanupInput(n.find('input[name="user_id"]').val()),e=this.cleanupInput(n.find('input[name="device_id"]').val()),!_.isEmpty(i)&&!_.isEmpty(e))return this.config.user_device_map.push({user_id:i,device_id:e}),this.render()},e.prototype.removeUserDeviceMap=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e}(App.Controller),n=function(){function t(){}return t.current=function(){return App.Setting.get("placetel_integration")},t}(),App.Config.set("IntegrationPlacetel",{name:__("Placetel"),target:"#system/integration/placetel",description:__("VoIP service provider with realtime push."),controller:e,state:n},"NavBarIntegrations")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=function(e){function n(){return this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return s(n,e),n.prototype.featureIntegration="sipgate_integration",n.prototype.featureName="sipgate.io",n.prototype.featureConfig="sipgate_config",n.prototype.description=[[__("This service shows you contacts of incoming calls and a caller list in realtime.")],[__("Caller ID of outbound calls can be changed as well.")]],n.prototype.events={"click .js-select":"selectAll","change .js-switch input":"switch"},n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new t({el:this.$(".js-form")}),new App.HttpLog({el:this.$(".js-log"),facility:"sipgate.io"})},n}(App.ControllerIntegrationBase),t=function(t){function e(){this.removeUserRemoteMap=i(this.removeUserRemoteMap,this),this.addUserRemoteMap=i(this.addUserRemoteMap,this),this.removeOutboundRouting=i(this.removeOutboundRouting,this),this.removeInboundBlockCallerId=i(this.removeInboundBlockCallerId,this),this.addOutboundRouting=i(this.addOutboundRouting,this),this.addInboundBlockCallerId=i(this.addInboundBlockCallerId,this),this.update=i(this.update,this),this.updateCurrentConfig=i(this.updateCurrentConfig,this),this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return s(e,t),e.prototype.events={"submit form":"update","click .js-inboundBlockCallerId .js-add":"addInboundBlockCallerId","click .js-outboundRouting .js-add":"addOutboundRouting","click .js-inboundBlockCallerId .js-remove":"removeInboundBlockCallerId","click .js-outboundRouting .js-remove":"removeOutboundRouting","click .js-userRemoteMap .js-add":"addUserRemoteMap","click .js-userRemoteMap .js-remove":"removeUserRemoteMap"},e.prototype.currentConfig=function(){var t;return(t=App.Setting.get("sipgate_config")).outbound||(t.outbound={}),t.outbound.routing_table||(t.outbound.routing_table=[]),t.inbound||(t.inbound={}),t.inbound.block_caller_ids||(t.inbound.block_caller_ids=[]),t.user_remote_map||(t.user_remote_map=[]),t},e.prototype.setConfig=function(t){return App.Setting.set("sipgate_config",t,{notify:!0})},e.prototype.render=function(){var t;return this.config=this.currentConfig(),this.html(App.view("integration/sipgate")({config:this.config,sipgate_token:App.Setting.get("sipgate_token")})),t=[{name:"view_limit",display:"",tag:"select",null:!1,options:[{name:60,value:60},{name:120,value:120},{name:180,value:180},{name:240,value:240},{name:300,value:300}]}],new App.ControllerForm({el:this.$(".js-viewLimit"),model:{configure_attributes:t},params:{view_limit:this.config.view_limit},autofocus:!1})},e.prototype.updateCurrentConfig=function(){var t,e,n,i;return e=this.config,t=this.cleanupInput,n=this.$("input[name=default_caller_id]").val(),e.outbound.default_caller_id=t(n),i=this.$("select[name=view_limit]").val(),e.view_limit=parseInt(i),e.outbound.routing_table=[],this.$(".js-outboundRouting .js-row").each((function(){var n,i,s;return i=t($(this).find('input[name="dest"]').val()),n=t($(this).find('input[name="caller_id"]').val()),s=$(this).find('input[name="note"]').val(),e.outbound.routing_table.push({dest:i,caller_id:n,note:s})})),e.inbound.block_caller_ids=[],this.$(".js-inboundBlockCallerId .js-row").each((function(){var n,i;return n=$(this).find('input[name="caller_id"]').val(),i=$(this).find('input[name="note"]').val(),e.inbound.block_caller_ids.push({caller_id:t(n),note:i})})),e.user_remote_map=[],this.$(".js-userRemoteMap .js-row").each((function(){var t,n;return t=$(this).find('input[name="remote_user_id"]').val(),n=$(this).find('input[name="user_id"]').val(),e.user_remote_map.push({remote_user_id:t,user_id:n})})),this.config=e},e.prototype.update=function(t){return t.preventDefault(),this.updateCurrentConfig(),this.setConfig(this.config)},e.prototype.cleanupInput=function(t){return t?t.replace(/\s/g,"").trim():t},e.prototype.addInboundBlockCallerId=function(t){var e,n,i;if(t.preventDefault(),this.updateCurrentConfig(),e=(n=$(t.currentTarget).closest("tr")).find('input[name="caller_id"]').val(),i=n.find('input[name="note"]').val(),!_.isEmpty(e)&&!_.isEmpty(i))return this.config.inbound.block_caller_ids.push({caller_id:this.cleanupInput(e),note:i}),this.render()},e.prototype.addOutboundRouting=function(t){var e,n,i,s;if(t.preventDefault(),this.updateCurrentConfig(),i=$(t.currentTarget).closest("tr"),n=this.cleanupInput(i.find('input[name="dest"]').val()),e=this.cleanupInput(i.find('input[name="caller_id"]').val()),s=i.find('input[name="note"]').val(),!(_.isEmpty(e)||_.isEmpty(n)||_.isEmpty(s)))return this.config.outbound.routing_table.push({dest:n,caller_id:e,note:s}),this.render()},e.prototype.removeInboundBlockCallerId=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e.prototype.removeOutboundRouting=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e.prototype.addUserRemoteMap=function(t){var e,n,i;if(t.preventDefault(),this.updateCurrentConfig(),e=$(t.currentTarget).closest("tr"),i=this.cleanupInput(e.find('input[name="user_id"]').val()),n=this.cleanupInput(e.find('input[name="remote_user_id"]').val()),!_.isEmpty(i)&&!_.isEmpty(n))return this.config.user_remote_map.push({user_id:i,remote_user_id:n}),this.render()},e.prototype.removeUserRemoteMap=function(t){return t.preventDefault(),this.updateCurrentConfig(),$(t.currentTarget).closest("tr").remove(),this.updateCurrentConfig()},e}(App.Controller),n=function(){function t(){}return t.current=function(){return App.Setting.get("sipgate_integration")},t}(),App.Config.set("IntegrationSipgate",{name:"sipgate.io",target:"#system/integration/sipgate",description:__("VoIP service provider with realtime push."),controller:e,state:n},"NavBarIntegrations")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;t=function(t){function e(){return this.update=n(this.update,this),this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.featureIntegration="slack_integration",e.prototype.featureName=__("Slack"),e.prototype.featureConfig="slack_config",e.prototype.description=[[__("This service sends notifications to your %s channel."),"Slack"],[__('To set up this service you need to create a new |"Incoming webhook"| in your %s integration panel and enter the webhook URL below.'),"Slack"]],e.prototype.events={"click .js-submit":"update","submit .js-form":"update","change .js-switch input":"switch"},e.prototype.render=function(){var t,n,i,s,r,o,a,l,c,u,p,h,d,f;for(e.__super__.render.apply(this,arguments),(p=App.Setting.get(this.featureConfig))&&p.items&&(p=p.items[0]||{}),u={create:__("1. Ticket Create"),update:__("2. Ticket Update"),reminder_reached:__("3. Ticket Reminder Reached"),escalation:__("4. Ticket Escalation"),escalation_warning:__("5. Ticket Escalation Warning")},d=[],s=0,a=(t=[{name:"types",display:__("Trigger"),tag:"checkbox",options:u,translate:!0,null:!1,class:"vertical",note:__("When notification is being sent.")},{name:"group_ids",display:__("Group"),tag:"select",relation:"Group",multiple:!0,null:!1,class:"form-control--small",note:__("Only for these groups.")},{name:"webhook",display:__("Webhook"),tag:"input",type:"url",limit:200,null:!1,class:"form-control--small",placeholder:"https://hooks.slack.com/services/..."},{name:"username",display:__("Username"),tag:"input",type:"text",limit:100,null:!1,class:"form-control--small",placeholder:"username"},{name:"channel",display:__("Channel"),tag:"input",type:"text",limit:100,null:!0,class:"form-control--small",placeholder:"#channel"},{name:"icon_url",display:__("Icon URL"),tag:"input",type:"url",limit:200,null:!0,class:"form-control--small",placeholder:"https://example.com/logo.png"}]).length;s<a;s++)h={options:{form:[r=t[s]]},name:r.name,description:r.note||"",title:r.display},d.push(h);for(i=$(App.view("settings/form")({settings:d})),o=0,l=d.length;o<l;o++)(n=(h=d[o]).options.form)[0].display="",f=p[h.name],(c={})[h.name]=f,new App.ControllerForm({el:i.find("[data-name="+h.name+"]"),model:{configure_attributes:n,className:""},params:c});return this.$(".js-form").html(i),new App.HttpLog({el:this.$(".js-log"),facility:"slack_webhook"})},e.prototype.update=function(t){var e;return t.preventDefault(),e={items:[this.formParam(t.target)]},App.Setting.set(this.featureConfig,e,{notify:!0})},e}(App.ControllerIntegrationBase),e=function(){function t(){}return t.current=function(){return App.Setting.get("slack_integration")},t}(),App.Config.set("IntegrationSlack",{name:__("Slack"),target:"#system/integration/slack",description:__("A team communication tool for the 21st century. Compatible with tools like %s."),descriptionSubstitute:__("Mattermost, RocketChat"),controller:t,state:e},"NavBarIntegrations")}.call(this),function(){var t,e,n,i,s,r,o,a=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function n(){this.constructor=t}for(var i in e)c.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;i=function(t){function n(){return this.render=a(this.render,this),n.__super__.constructor.apply(this,arguments)}return l(n,t),n.prototype.featureIntegration="smime_integration",n.prototype.featureName=__("S/MIME"),n.prototype.featureConfig="smime_config",n.prototype.description=[[__("S/MIME (Secure/Multipurpose Internet Mail Extensions) is a widely accepted method (or more precisely, a protocol) for sending digitally signed and encrypted messages.")]],n.prototype.events={"change .js-switch input":"switch"},n.prototype.render=function(){return n.__super__.render.apply(this,arguments),new e({el:this.$(".js-form")}),new App.HttpLog({el:this.$(".js-log"),facility:"S/MIME"})},n}(App.ControllerIntegrationBase),e=function(e){function i(){this.updateGroup=a(this.updateGroup,this),this.addPrivateKey=a(this.addPrivateKey,this),this.addCertificate=a(this.addCertificate,this),this.groupList=a(this.groupList,this),this.certList=a(this.certList,this),this.render=a(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return l(i,e),i.prototype.events={"click .js-addCertificate":"addCertificate","click .js-addPrivateKey":"addPrivateKey","click .js-updateGroup":"updateGroup"},i.prototype.currentConfig=function(){return App.Setting.get("smime_config")},i.prototype.setConfig=function(t){return App.Setting.set("smime_config",t,{notify:!0})},i.prototype.render=function(){return this.config=this.currentConfig(),this.html(App.view("integration/smime")({config:this.config})),this.certList(),this.groupList()},i.prototype.certList=function(){return this.list=new s({el:this.$(".js-certList")})},i.prototype.groupList=function(){return new n({el:this.$(".js-groupList"),config:this.config})},i.prototype.addCertificate=function(){return new t({callback:(e=this,function(){return e.list.load()})});var e},i.prototype.addPrivateKey=function(){return new r({callback:(t=this,function(){return t.list.load()})});var t},i.prototype.updateGroup=function(t){var e;return e=App.ControllerForm.params(t),this.setConfig(e)},i}(App.Controller),t=function(t){function e(){return this.onSubmit=a(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Add"),e.prototype.autoFocusOnFirstInput=!1,e.prototype.head=__("Add Certificate"),e.prototype.large=!0,e.prototype.content=function(){return $(App.view("integration/smime_certificate_add")({head:__("Add Certificate")}))},e.prototype.onSubmit=function(t){var e,n;return(e=new FormData($(t.currentTarget).closest("form").get(0))).set("try",!0),_.isEmpty(e.get("data"))&&e.delete("data"),this.formDisable(t),this.ajax({id:"smime-certificate-add",type:"POST",url:this.apiPath+"/integration/smime/certificate",processData:!1,contentType:!1,cache:!1,data:e,success:(n=this,function(){return n.close(),n.callback()}),error:function(t){return function(e){var n;return t.close(),n=e.responseJSON||{},t.notify({type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("The import failed.")),timeout:6e3})}}(this)})},e}(App.ControllerModal),r=function(t){function e(){return this.onSubmit=a(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Add"),e.prototype.autoFocusOnFirstInput=!1,e.prototype.head=__("Add Private Key"),e.prototype.large=!0,e.prototype.content=function(){return $(App.view("integration/smime_private_key_add")({head:__("Add Private Key")}))},e.prototype.onSubmit=function(t){var e,n;return(e=new FormData($(t.currentTarget).closest("form").get(0))).set("try",!0),_.isEmpty(e.get("data"))&&e.delete("data"),this.formDisable(t),this.ajax({id:"smime-private_key-add",type:"POST",url:this.apiPath+"/integration/smime/private_key",processData:!1,contentType:!1,cache:!1,data:e,success:(n=this,function(){return n.close(),n.callback()}),error:function(t){return function(e){var n;return t.close(),n=e.responseJSON||{},t.notify({type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("The import failed.")),timeout:6e3})}}(this)})},e}(App.ControllerModal),s=function(t){function e(){this.remove=a(this.remove,this),this.render=a(this.render,this),this.load=a(this.load,this),e.__super__.constructor.apply(this,arguments),this.load()}return l(e,t),e.prototype.events={"click .js-remove":"remove"},e.prototype.load=function(){return this.ajax({id:"smime-list",type:"GET",url:this.apiPath+"/integration/smime/certificate",success:(t=this,function(e){return t.render(e)}),error:function(t){return function(e,n){var i;if("abort"!==n)return i=e.responseJSON||{},t.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("Loading failed."))})}}(this)});var t},e.prototype.render=function(t){return this.html(App.view("integration/smime_list")({certs:t}))},e.prototype.remove=function(t){var e,n;if(t.preventDefault(),e=$(t.currentTarget).parents("tr").data("id"))return this.ajax({id:"smime-list",type:"DELETE",
url:this.apiPath+"/integration/smime/certificate",data:JSON.stringify({id:e}),success:(n=this,function(){return n.load()}),error:function(t){return function(e,n){var i;if("abort"!==n)return i=e.responseJSON||{},t.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("Server operation failed."))})}}(this)})},e}(App.Controller),n=function(t){function e(){this.render=a(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return l(e,t),e.prototype.render=function(){var t,e,n,i,s,r,o,a,l;for(e=App.Group.search({sortBy:"name",filter:{active:!0}}),this.html(App.view("integration/smime_group")({groups:e})),s=[],n=0,i=e.length;n<i;n++)t=e[n],s.push(function(){var e,n,i;for(l in i=[],e={default_sign:"js-signDefault",default_encryption:"js-encryptionDefault"})a=e[l],r=!0,(null!=(n=this.config)?n.group_id:void 0)&&this.config.group_id[l]&&(r=this.config.group_id[l][t.id.toString()]),o=App.UiElement.boolean.render({name:"group_id::"+l+"::"+t.id,multiple:!1,null:!1,nulloption:!1,value:r,class:"form-control--small"}),i.push(this.$("[data-id="+t.id+"] ."+a).html(o));return i}.call(this));return s},e}(App.Controller),o=function(){function t(){}return t.current=function(){return App.Setting.get("smime_integration")},t}(),App.Config.set("Integrationsmime",{name:__("S/MIME"),target:"#system/integration/smime",description:__("S/MIME enables you to send digitally signed and encrypted messages."),controller:i,state:o},"NavBarIntegrations")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title(__("Branding"),!0),this.tabs=[{name:__("Base"),target:"base",controller:App.SettingsArea,params:{area:"System::Branding"}}],this.render()}return e(n,t),n.requiredPermission="admin.branding",n.prototype.header=__("Branding"),n}(App.ControllerTabs),App.Config.set("SettingBranding",{prio:1200,parent:"#settings",name:__("Branding"),target:"#settings/branding",controller:t,permission:["admin.branding"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ManageKnowledgeBase=function(n){function i(){this.fetchAndRender=t(this.fetchAndRender,this),i.__super__.constructor.apply(this,arguments),this.render(),this.fetchAndRender()}return e(i,n),i.prototype.header=__("Knowledge Base"),i.prototype.headerSwitchName="kb-activate",i.prototype.events={"hidden.bs.tab li":"didHideTab","show.bs.tab li":"willShowTab","change .js-header-switch input":"didChangeHeaderSwitch"},i.prototype.elements={".js-header-switch input":"headerSwitchInput"},i.prototype.didHideTab=function(t){var e;return e=$(t.relatedTarget).attr("href"),this.$(e).trigger("hidden.bs.tab")},i.prototype.willShowTab=function(t){var e;return e=$(t.target).attr("href"),this.$(e).trigger("show.bs.tab")},i.prototype.tabs=[],i.prototype.fetchAndRender=function(){return this.startLoading(),this.ajax({id:"knowledge_bases_init_admin",type:"GET",url:this.apiPath+"/knowledge_bases/manage/init",processData:!0,success:(t=this,function(e){var n;return App.Collection.loadAssets(e),t.knowledge_base_id=null!=(n=App.KnowledgeBase.first())?n.id:void 0,t.stopLoading(),t.processLoaded()}),error:function(t){return function(){return t.knowledge_base_id=void 0,t.stopLoading()}}(this)});var t},i.prototype.clear=function(){return App.KnowledgeBase.find(this.knowledge_base_id).remove({clear:!0}),this.fetchAndRender()},i.prototype.processLoaded=function(){return this.knowledge_base_id?this.renderLoaded():this.renderNonExistant()},i.prototype.renderNonExistant=function(){return this.headerSwitchInput.attr("disabled",!0),this.tabs=[{name:__("Theme"),target:"style",controller:App.KnowledgeBaseNewController,params:{parentVC:this}}],this.render()},i.prototype.didChangeHeaderSwitch=function(){var t,e,n,i;return this.headerSwitchInput.prop("disabled",!0),t=(n=this.headerSwitchInput.prop("checked"))?"activate":"deactivate",e=App.KnowledgeBase.find(this.knowledge_base_id),this.ajax({id:"knowledge_bases_init_admin",type:"PATCH",url:e.manageUrl(t),processData:!0,success:(i=this,function(t){return App.Collection.loadAssets(t),i.processLoaded(),i.headerSwitchInput.prop("disabled",!1)}),error:function(t){return function(){return t.headerSwitchInput.prop("checked",!n),t.headerSwitchInput.prop("disabled",!1)}}(this)})},i.prototype.renderLoaded=function(){var t;return this.headerSwitchInput.attr("disabled",!1),t={knowledge_base_id:this.knowledge_base_id,parentVC:this},this.tabs=[{name:__("Theme"),target:"style",controller:App.KnowledgeBaseForm,params:_.extend({},t,{screen:"style",split:!0})},{name:__("Languages"),target:"languages",controller:App.KnowledgeBaseForm,params:_.extend({},t,{screen:"languages"})},{name:__("Public Menu"),target:"public_menu",controller:App.KnowledgeBasePublicMenuManager,params:_.extend({},t,{screen:"public_menu"})},{name:__("Delete"),target:"delete",controller:App.KnowledgeBaseDelete,params:t}],App.Config.get("system_online_service")||this.tabs.splice(-1,0,{name:__("Custom URL"),target:"custom_address",controller:App.KnowledgeBaseCustomAddressForm,params:_.extend({},t,{screen:"custom_address"})}),this.render(),this.headerSwitchInput.prop("checked",App.KnowledgeBase.find(this.knowledge_base_id).active)},i}(App.ControllerTabs),App.Config.set("KnowledgeBase",{prio:1e4,name:__("Knowledge Base"),parent:"#manage",target:"#manage/knowledge_base",controller:App.ManageKnowledgeBase,permission:["admin.knowledge_base"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title(__("Security"),!0),this.tabs=[{name:__("Base"),target:"base",controller:App.SettingsArea,params:{area:"Security::Base"}},{name:__("Password"),target:"password",controller:App.SettingsArea,params:{area:"Security::Password"}},{name:__("Two-factor Authentication"),target:"two_factor_auth",controller:App.SettingsArea,params:{area:"Security::TwoFactorAuthentication",subtitle:__("Two-factor Authentication Methods")}},{name:__("SSL Certificates"),target:"ssl",controller:App.SSLCertificateController},{name:__("Third-party Applications"),target:"third_party_auth",controller:App.SettingsArea,params:{area:"Security::ThirdPartyAuthentication"}}],this.render()}return e(n,t),n.requiredPermission="admin.security",n.prototype.header=__("Security"),n}(App.ControllerTabs),App.Config.set("SettingSecurity",{prio:1600,parent:"#settings",name:__("Security"),target:"#settings/security",controller:t,permission:["admin.security"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title(__("System"),!0),this.tabs=[],App.Config.get("system_online_service")||this.tabs.push({name:__("Base"),target:"base",controller:App.SettingsArea,params:{area:"System::Base"}}),this.tabs.push({name:__("Services"),target:"services",controller:App.SettingsArea,params:{area:"System::Services"}}),App.Config.get("system_online_service")||this.tabs.push({name:__("Storage"),target:"storage",controller:App.SettingsArea,params:{area:"System::Storage"}}),App.Config.get("system_online_service")||this.tabs.push({name:__("Network"),target:"network",controller:App.SettingsArea,params:{area:"System::Network"}}),this.tabs.push({name:__("Frontend"),target:"ui",controller:App.SettingsArea,params:{area:"System::UI"}}),this.render()}return e(n,t),n.requiredPermission="admin.setting_system",n.prototype.header=__("System"),n}(App.ControllerTabs),App.Config.set("SettingSystem",{prio:1400,parent:"#settings",name:__("System"),target:"#settings/system",controller:t,permission:["admin.setting_system"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title("Ticket",!0),this.tabs=[{name:__("Base"),target:"base",controller:App.SettingsArea,params:{area:"Ticket::Base"}},{name:__("Number"),target:"number",controller:App.SettingsArea,params:{area:"Ticket::Number"}},{name:__("Auto Assignment"),target:"auto_assignment",controller:App.SettingTicketAutoAssignment},{name:__("Notifications"),target:"notification",controller:App.SettingTicketNotifications},{name:__("Duplicate Detection"),target:"duplicate_detection",controller:App.SettingTicketDuplicateDetection}],this.render()}return e(n,t),n.requiredPermission="admin.ticket",n.prototype.header=__("Ticket"),n}(App.ControllerTabs),App.Config.set("SettingTicket",{prio:1700,parent:"#settings",name:__("Ticket"),target:"#settings/ticket",controller:t,permission:["admin.ticket"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingTicketAutoAssignment=function(n){function i(){this.setTicketAutoAssignment=t(this.setTicketAutoAssignment,this),this.setFilter=t(this.setFilter,this),this.render=t(this.render,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.Setting.subscribe(this.render,{initFetch:!0,clear:!1})}return e(i,n),i.requiredPermission="admin.ticket_auto_assignment",i.prototype.events={"change .js-ticketAutoAssignment input":"setTicketAutoAssignment","click .js-timeAccountingFilter":"setFilter","click .js-timeAccountingFilterReset":"resetFilter"},i.prototype.elements={".js-ticketAutoAssignment input":"ticketAutoAssignment"},i.prototype.release=function(){return App.Setting.unsubscribe(this.subscribeId)},i.prototype.render=function(){var t,e,n,i;return e=this.Config.get("ticket_auto_assignment")||!1,this.lastNewTagSetting=e,this.html(App.view("settings/ticket_auto_assignment")()),t=[{name:"condition",display:__("Conditions for affected objects"),tag:"ticket_selector",null:!1,preview:!1,action:!1,hasChanged:!1,article:!1,hasRegexOperators:!0}],n=App.Setting.get("ticket_auto_assignment_selector"),this.filter=new App.ControllerForm({el:this.$(".js-selector"),model:{configure_attributes:t},params:{condition:n.condition},autofocus:!0}),t=[{name:"user_ids",display:__("Excepted users"),tag:"column_select",multiple:!0,null:!0,relation:"User",sortBy:"firstname"}],i=App.Setting.get("ticket_auto_assignment_user_ids_ignore"),this.filter=new App.ControllerForm({el:this.$(".js-users"),model:{configure_attributes:t},params:{user_ids:i},autofocus:!1})},i.prototype.setFilter=function(t){var e;return t.preventDefault(),e=this.formParam(this.filter.form),App.Setting.set("ticket_auto_assignment_selector",{condition:e.condition},{notify:!0}),App.Setting.set("ticket_auto_assignment_user_ids_ignore",e.user_ids,{notify:!1})},i.prototype.resetFilter=function(t){return t.preventDefault(),App.Setting.set("ticket_auto_assignment_selector",{},{notify:!0}),App.Setting.set("ticket_auto_assignment_user_ids_ignore",[],{notify:!1})},i.prototype.setTicketAutoAssignment=function(){var t;return t=this.ticketAutoAssignment.prop("checked"),App.Setting.set("ticket_auto_assignment",t)},i}(App.ControllerSubContent)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingTicketDuplicateDetection=function(n){function i(){this.setTicketDuplicateDetection=t(this.setTicketDuplicateDetection,this),this.setFilter=t(this.setFilter,this),this.render=t(this.render,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.Setting.subscribe(this.render,{initFetch:!0,clear:!1})}return e(i,n),i.prototype.requiredPermission="admin.ticket_duplicate_detection",i.prototype.events={"change .js-ticketDuplicateDetection input":"setTicketDuplicateDetection","click .js-ticketDuplicateDetectionFilter":"setFilter","click .js-ticketDuplicateDetectionFilterReset":"resetFilter"},i.prototype.elements={".js-ticketDuplicateDetection input":"ticketDuplicateDetection"},i.prototype.release=function(){return App.Setting.unsubscribe(this.subscribeId)},i.prototype.render=function(){var t,e,n,i,s,r,o,a;for(n=this.Config.get("ticket_duplicate_detection")||!1,this.lastNewTagSetting=n,this.html(App.view("settings/ticket_duplicate_detection")()),r={},i=0,s=(o=App.Ticket.configure_attributes).length;i<s;i++)t=o[i],_.contains(["input","select","tree_select","user_autocompletion","boolean","date","datetime","integer"],t.tag)&&1!==t.readonly&&(r[t.name]=App.i18n.translateInline(t.display));return e=[{name:"attributes",display:__("Attributes to compare"),tag:"column_select",multiple:!0,null:!1,options:r,sortBy:"firstname"},{name:"title",display:__("Warning title"),tag:"input",null:!1},{name:"body",display:__("Warning message"),tag:"textarea",null:!1},{name:"role_ids",display:__("Available for the following roles"),tag:"column_select",multiple:!0,null:!1,relation:"Role",translate:!0},{name:"show_tickets",display:__("Show matching ticket(s) in the warning"),tag:"boolean",null:!1,default:!1},{name:"permission_level",display:__("Permission level for looking up tickets"),tag:"select",null:!1,options:{user:__("User"),system:__("System")},default:"user",translate:!0},{name:"ticket_search",display:__("Match tickets in following states"),tag:"select",null:!1,options:{all:__("All tickets"),open:__("Open tickets")},default:"all",translate:!0}],a=App.Setting.get("ticket_duplicate_detection_attributes"),this.filter=new App.ControllerForm({el:this.$(".js-attributes"),model:{configure_attributes:e},params:{attributes:a,title:this.Config.get("ticket_duplicate_detection_title"),body:this.Config.get("ticket_duplicate_detection_body"),role_ids:this.Config.get("ticket_duplicate_detection_role_ids"),show_tickets:this.Config.get("ticket_duplicate_detection_show_tickets"),permission_level:this.Config.get("ticket_duplicate_detection_permission_level"),ticket_search:this.Config.get("ticket_duplicate_detection_search")},autofocus:!1})},i.prototype.setFilter=function(t){var e,n;return t.preventDefault(),n=this.formParam(this.filter.form),e=this.filter.validate(n),_.isEmpty(e)?(App.Setting.set("ticket_duplicate_detection_attributes",n.attributes,{notify:!1}),App.Setting.set("ticket_duplicate_detection_title",n.title,{notify:!1}),App.Setting.set("ticket_duplicate_detection_body",n.body,{notify:!1}),App.Setting.set("ticket_duplicate_detection_role_ids",n.role_ids,{notify:!1}),App.Setting.set("ticket_duplicate_detection_show_tickets",n.show_tickets,{notify:!1}),App.Setting.set("ticket_duplicate_detection_permission_level",n.permission_level,{notify:!1}),App.Setting.set("ticket_duplicate_detection_search",n.ticket_search,{notify:!1})):(this.formValidate({form:t.target,errors:e}),!1)},i.prototype.resetFilter=function(t){return t.preventDefault(),App.Setting.set("ticket_duplicate_detection_attributes",[],{notify:!1})},i.prototype.setTicketDuplicateDetection=function(){var t;return t=this.ticketDuplicateDetection.prop("checked"),App.Setting.set("ticket_duplicate_detection",t)},i}(App.ControllerSubContent)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingTicketNotifications=function(n){function i(){this.applyDefaultNotificationsToAll=t(this.applyDefaultNotificationsToAll,this),this.resetDefaultNotifications=t(this.resetDefaultNotifications,this),this.saveDefaultNotifications=t(this.saveDefaultNotifications,this),this.render=t(this.render,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.Setting.subscribe(this.render,{initFetch:!0,clear:!1})}return e(i,n),i.include(App.TicketNotificationMatrix),i.requiredPermission="admin.ticket",i.prototype.events={"click .js-ticketDefaultNotifications":"saveDefaultNotifications","click .js-ticketDefaultNotificationsReset":"resetDefaultNotifications","click .js-ticketDefaultNotificationsApplyToAll":"applyDefaultNotificationsToAll"},i.prototype.release=function(){return App.Setting.unsubscribe(this.subscribeId)},i.prototype.render=function(){var t;return t=this.Config.get("ticket_agent_default_notifications")||{},this.html(App.view("settings/ticket_notifications")({matrixTableHTML:this.renderNotificationMatrix(t)}))},i.prototype.saveDefaultNotifications=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),App.Setting.set("ticket_agent_default_notifications",this.updatedNotificationMatrixValues(e),{notify:!0})},i.prototype.resetDefaultNotifications=function(t){return t.preventDefault(),new App.ControllerConfirm({message:__("Are you sure? The agent default notifications settings will be reset to the system default."),buttonClass:"btn--danger",callback:function(){return App.Setting.reset("ticket_agent_default_notifications",{notify:!0})},container:this.el.closest(".content")})},i.prototype.applyDefaultNotificationsToAll=function(t){return t.preventDefault(),this.applyDefaultNotificationsToAllModal=new App.ControllerConfirmDelete({fieldDisplay:__("Are you sure? Default notifications settings will be applied to all active agents. This operation may take some time."),safeWord:__("Confirm"),head:__("Confirmation"),buttonSubmit:__("Yes"),notificationCallback:function(){return this.close()},callback:function(){var t;return this.el.find(".js-cancel, .js-submit").hide(),this.startLoading(),App.Event.bind("ticket_agent_default_notifications_applied",(t=this,function(){return t.notificationCallback()}),"ticket_agent_default_notifications_applied"),this.ajax({id:"apply_ticket_agent_default_notifications_to_all",type:"POST",url:this.apiPath+"/settings/ticket_agent_default_notifications/apply_to_all"})},container:this.el.closest(".content"),release:function(){return i.__super__.applyDefaultNotificationsToAll.apply(this,arguments),App.Event.unbindLevel("ticket_agent_default_notifications_applied")}})},i}(App.ControllerSubContent)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t;n.__super__.constructor.apply(this,arguments),this.authenticateCheck()&&(t=App.Config.get("after_auth"),_.isEmpty(t)||new App["AfterAuth"+t.type]({data:t.data}))}return e(n,t),n}(App.Controller),App.Config.set("after_auth",t,"Plugins")}.call(this),function(){var t;t=function(){function t(){App.Event.bind("config_update",(function(t){return App.Config.set(t.name,t.value),App.Event.trigger("config_update_local",t)}))}return t.prototype.release=function(){return App.Event.unbind("config_update")},t}(),App.Config.set("app_config_update",t,"Plugins")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t,e;n.__super__.constructor.apply(this,arguments),e=this,t=function(){var t,n;if((n=App.Session.get("preferences"))&&_.isEmpty(n.locale))return t=App.i18n.get(),e.ajax({id:"i18n-set-user-"+t,type:"PUT",url:App.Config.get("api_path")+"/users/preferences",data:JSON.stringify({locale:t}),processData:!0})},void 0!==App.Session.get()&&this.delay(t,3500,"default_locale")}return e(n,t),n}(App.Controller),App.Config.set("default_locale",t,"Plugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.setTimezoneIfNeeded=e(this.setTimezoneIfNeeded,this),i.__super__.constructor.apply(this,arguments),this.delay(this.setTimezoneIfNeeded,8500,"default_timezone")}return n(i,t),i.prototype.setTimezoneIfNeeded=function(){var t,e;if(_.isEmpty(App.Config.get("timezone_default"))&&((t=App.i18n.detectBrowserTimezone())&&this.permissionCheck("admin.system")))return App.Setting.fetchFull((e=this,function(){return e.updateSetting(t)}),{force:!1})},i.prototype.updateSetting=function(t){return App.Setting.set("timezone_default",t)},i}(App.Controller),App.Config.set("default_timezone",t,"Plugins")}.call(this),function(){var t;t=function(){function t(){var t;App.Config.get("developer_mode")&&!1!==App.Log.config("banner")&&(t="|\n| Welcome Zammad Developer!\n| You can enable debugging with the following examples (value is a regex):\n|\n| App.Log.config('module', '(websocket|delay|interval)') // enable debugging for websocket, delay and interval class\n| App.Log.config('content', 'send')                      // enable debugging for messages which contain the string 'send'\n| App.Log.config('banner', false)                        // disable this banner\n|\n| App.Log.config()         // current settings\n| App.Log.config('banner') // current setting for banner\n|",console.log(t))}return t}(),App.Config.set("dev_banner",t,"Plugins")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t,e,i,s,r,o,a,l,c,u,p;window.require&&(r=window.require("electron"))&&(l=r.remote,o=r.ipcRenderer,n.__super__.constructor.apply(this,arguments),this.controllerBind("window-title-set",(function(t){return o.send("window-title-set",t)})),this.controllerBind("online_notification_counter",(function(t){return c(t)})),o.off("global-shortcut").on("global-shortcut",(function(t,e){return App.Event.trigger("global-shortcut",e)})),t=l.Menu,e=l.MenuItem,s=function(){var n;return(n=new t).append(new e({label:__("Cut"),role:"cut"})),n.append(new e({label:__("Copy"),role:"copy"})),n.append(new e({label:__("Paste"),role:"paste"})),n.append(new e({label:__("Select All"),role:"selectall"})),n},a=s(),window.addEventListener("contextmenu",(function(){return a.popup(l.getCurrentWindow()),!1})),i=function(t){var e,n,i,s;return s=16*(i=2),(e=document.createElement("canvas")).setAttribute("width",s),e.setAttribute("height",s),(n=e.getContext("2d")).fillStyle="#FF1744",n.beginPath(),n.arc(s/2,s/2,s/2,0,2*Math.PI),n.fill(),n.fillStyle="#ffffff",n.textAlign="center",n.textBaseline="middle",n.font=10*i+"px sans-serif",n.fillText(t,s/2,s/2,s),e.toDataURL()},p=function(t){var e;return e=function(e,n){return r.ipcRenderer.send("win32-overlay",{overlayDataURL:e,description:n,content:t})},""!==t?e(i(t.toString()),"You have unread messages ("+t+")"):e(null,__("You have no unread messages"))},u=function(t){return l.app.dock.setBadge(t)},c=function(t){return"win32"===process.platform?p(t):"darwin"===process.platform?u(t):void 0})}return e(n,t),n}(App.Controller),App.Config.set("aaa_electron_events",t,"Plugins")}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.GlobalSearchWidget=function(e){function n(){var t;n.__super__.constructor.apply(this,arguments),$("body").off("mousedown.globalsearch").on("mousedown.globalsearch",(t=this,function(e){return t.shiftHeldToogle(e),!0})),this.controllerBind("global:search:set",function(t){return function(e){var n,i,s,r,o;return r=e[0],n=e[1],(r=r.replace('"',"")).match(/\W/)&&(r='"'+r+'"'),o=n?n+":"+r:""+r,i=$("#global-search").val(),t.shiftHeld&&i?(i+=" AND ",i+=o):i=o,$("#global-search").val(i),s=function(){return $("#global-search").trigger("focus")},App.Delay.set(s,20,"global-search-delay")}}(this))}return t(n,e),!1,n.prototype.shiftHeldToogle=function(t){return this.shiftHeld=t.shiftKey},n.search=function(t,e){return App.Event.trigger("global:search:set",[t,e])},n}(App.Controller),App.Config.set("global_navigation",App.GlobalSearchWidget,"Plugins")}.call(this),function(){var t;t=function(){function t(){var t;App.Config.get("developer_mode")||(t="|  _____                                    _\n| / _  / __ _ _ __ ___  _ __ ___   __ _  __| |\n| \\// / / _` | '_ ` _ \\| '_ ` _ \\ / _` |/ _` |\n|  / //\\ (_| | | | | | | | | | | | (_| | (_| |\n| /____/\\__,_|_| |_| |_|_| |_| |_|\\__,_|\\__,_|\n|\n| Hi there, nice to meet you!\n|\n| Visit %chttps://zammad.com/jobs%c to learn about our current job openings.\n|\n| Your Zammad Team\n|",console.log(t,"text-decoration: underline;","text-decoration: none;"))}return t}(),App.Config.set("hello_banner",t,"Plugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.KeyboardShortcutModal=function(t){function i(){this.exists=e(this.exists,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("keyboard_shortcuts_close",this.close)}return n(i,t),i.prototype.authenticateRequired=!0,i.prototype.large=!0,i.prototype.head=__("Keyboard Shortcuts"),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!1,i.prototype.buttonSubmit=!1,i.prototype.content=function(){return App.view("keyboard_shortcuts")({areas:App.Config.get("keyboard_shortcuts"),magicKey:App.Browser.magicKey(),hotkeys:App.Browser.hotkeys().split("+").reverse()})},i.prototype.exists=function(){return this.el.parents("html").length>0},i.prototype.onClosed=function(){if("#keyboard_shortcuts"===window.location.hash)return window.history.back()},i}(App.ControllerModal),App.KeyboardShortcutWidget=function(t){function i(){var t;this.observerKeys=e(this.observerKeys,this),i.__super__.constructor.apply(this,arguments),this.observerKeys(),this.lastKey=void 0,$(document).on("keyup",(t=this,function(e){if(27===e.keyCode)return t.lastKey=void 0}))}return n(i,t),i.include(App.LogInclude),i.prototype.observerKeys=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d;for($(document).off("keydown.shortcuts"),u=App.Browser.hotkeys(),i=0,a=(e=App.Config.get("keyboard_shortcuts")).length;i<a;i++)for(r=0,l=(p=(t=e[i]).content).length;r<l;r++)for(h=(s=p[r]).shortcuts,n=function(t){return function(e){var n;if(n="",e.hotkeys&&(n+=u),e.key&&(""!==n&&(n+="+"),n+=e.key,e.callback))return t.log("debug","bind for",n),$(document).on("keydown.shortcuts",{keys:n},(function(i){if(!e.onlyOutsideInputs||!_.contains(["INPUT","TEXTAREA","SELECT"],document.activeElement.nodeName)&&"true"!==document.activeElement.getAttribute("contenteditable"))return i.preventDefault(),t.lastKey&&t.lastKey.modifier===n&&t.lastKey.time+5500>(new Date).getTime()?(t.lastKey.count+=1,t.lastKey.time=(new Date).getTime()):t.lastKey={modifier:n,count:1,time:(new Date).getTime()},e.callback(e,t.lastKey,n)}))}}(this),o=0,c=h.length;o<c;o++)n(d=h[o]);return this.controllerBind("global-shortcut",(function(n){var i,r,o;for(o=[],i=0,r=e.length;i<r;i++)t=e[i],o.push(function(){var e,i,r,o;for(o=[],i=0,e=(r=t.content).length;i<e;i++)s=r[i],o.push(function(){var t,e,i,r;for(r=[],e=0,t=(i=s.shortcuts).length;e<t;e++)(d=i[e]).globalEvent===n?r.push(d.callback(d)):r.push(void 0);return r}());return o}());return o}))},i}(App.Controller),App.Config.set("keyboard_shortcuts",App.KeyboardShortcutWidget,"Plugins"),App.Config.set("keyboard_shortcuts",[{headline:__("Navigation"),location:"left",content:[{where:__("Used anywhere"),shortcuts:[{key:"d",hotkeys:!0,description:__("Dashboard"),globalEvent:"dashboard",callback:function(){return $("#global-search").trigger("blur"),App.Event.trigger("keyboard_shortcuts_close"),window.location.hash="#dashboard"}},{key:"o",hotkeys:!0,description:__("Overviews"),globalEvent:"overview",callback:function(){return $("#global-search").trigger("blur"),App.Event.trigger("keyboard_shortcuts_close"),window.location.hash="#ticket/view"}},{key:"s",hotkeys:!0,description:__("Search"),globalEvent:"search",callback:function(){return App.Event.trigger("keyboard_shortcuts_close"),$("#global-search").trigger("focus")}},{key:"a",hotkeys:!0,description:__("Notifications"),globalEvent:"notification",callback:function(){return $("#global-search").trigger("blur"),App.Event.trigger("keyboard_shortcuts_close"),$("#navigation .js-toggleNotifications").trigger("click")}},{key:"n",hotkeys:!0,description:__("New Ticket"),globalEvent:"new-ticket",callback:function(){return $("#global-search").trigger("blur"),App.Event.trigger("keyboard_shortcuts_close"),window.location.hash="#ticket/create"}},{key:"e",hotkeys:!0,description:__("Logout"),globalEvent:"logout",callback:function(){return App.Event.trigger("keyboard_shortcuts_close"),window.location.hash="#logout"}},{key:"h",hotkeys:!0,description:__("List of shortcuts"),globalEvent:"list-of-shortcuts",callback:(t=this,function(){if("#keyboard_shortcuts"!==window.location.hash)return t.dialog&&t.dialog.exists()?(t.dialog.close(),void(t.dialog=!1)):t.dialog=new App.KeyboardShortcutModal;App.Event.trigger("keyboard_shortcuts_close")})},{key:"w",hotkeys:!0,description:__("Close current tab"),globalEvent:"close-current-tab",callback:function(){return App.Event.trigger("keyboard_shortcuts_close"),$("#navigation .tasks .is-active .js-close").trigger("click")}},{key:"tab",hotkeys:!0,description:__("Show next tab"),globalEvent:"next-in-tab",callback:function(){var t,e,n,i;return App.Event.trigger("keyboard_shortcuts_close"),i=function(t){if(t&&t.get(0))return t.get(0).scrollIntoView(!1)},(t=$("#navigation .tasks .is-active")).get(0)&&(e=t.next()).get(0)?(e.find("div").first().trigger("click"),void i(e)):(n=$("#navigation .tasks .task").first()).get(0)?(n.find("div").first().trigger("click"),i(n)):void 0}},{key:"shift+tab",hotkeys:!0,description:__("Show previous tab"),globalEvent:"previous-in-tab",callback:function(){var t,e,n,i;return App.Event.trigger("keyboard_shortcuts_close"),i=function(t){if(t&&t.get(0))return t.get(0).scrollIntoView(!0)},(t=$("#navigation .tasks .is-active")).get(0)&&(n=t.prev()).get(0)?(n.find("div").first().trigger("click"),void i(n)):(e=$("#navigation .tasks .task").last()).get(0)?(e.find("div").first().trigger("click"),i(e)):void 0}},{key:"return",hotkeys:!0,description:__("Confirm/submit dialog"),globalEvent:"submit",callback:function(){var t;App.Event.trigger("keyboard_shortcuts_close"),(t=$("body > div.modal")).get(0)||(t=$(".active.content > div.modal")).get(0)?t.find(".js-submit").trigger("click"):((t=$(".active.content .js-attributeBar .js-submit")).get(0)||(t=$(".active.content .js-submit")).get(0))&&t.first().trigger("click")}}]},{where:__("Used in lists (views and results)"),shortcuts:[{key:["\u25b2","\u25bc"],description:__("Move up and down")},{key:["\u25c0","\u25b6"],description:__("Move left and right")},{key:"enter",description:__("Select item")}]},{where:__("Used in object views"),shortcuts:[{key:".",hotkeys:!0,description:__("Copy current object number (e. g. Ticket#) to clipboard"),callback:function(t,e){var n,i,s,r;if(App.Event.trigger("keyboard_shortcuts_close"),i=$(".active.content .js-objectNumber").first().data("number")||"",!e||1!==e.count)return s=$(".active.content .js-objectTitle").first().text(),e&&2===e.count?(s&&(i+=": "+s),void clipboard.writeText(i)):(r=window.location.toString(),e&&3===e.count?(n=new window.ClipboardItem({"text/plain":new Blob([i+": "+s+"\n"+r],{type:"text/plain"}),"text/html":new Blob(['<a href="'+r+'">'+i+"</a>: "+s],{type:"text/html"})}),clipboard.write([n])):void 0);clipboard.writeText(i)}},{keyPrefix:"2x",key:".",hotkeys:!0,description:__("\u2026add object title")},{keyPrefix:"3x",key:".",
hotkeys:!0,description:__("\u2026add object link URL")}]}]},{headline:__("Translations"),location:"left",content:[{where:__("Used anywhere (admin only)"),shortcuts:[{admin:!0,key:"t",hotkeys:!0,description:__("Enable/disable inline translations"),globalEvent:"translation-mode"}]}]},{headline:__("Appearance"),location:"left",content:[{where:__("Used anywhere"),shortcuts:[{key:"d",hotkeys:!1,onlyOutsideInputs:!0,description:__("Toggle dark mode"),callback:function(){return App.Event.trigger("ui:theme:toggle-dark-mode")}}]}]},{headline:__("Tickets"),location:"right",content:[{where:__("Used when viewing a Ticket"),shortcuts:[{key:"m",hotkeys:!0,description:__("Open note box"),globalEvent:"article-note-open",callback:function(){return App.Event.trigger("keyboard_shortcuts_close"),$('.active.content .editControls .js-articleTypes [data-value="note"]').trigger("click"),$(".active.content .article-new .articleNewEdit-body").first().trigger("focus")}},{key:"g",hotkeys:!0,description:__("Reply to last article"),globalEvent:"article-reply",callback:function(){var t,e;if(App.Event.trigger("keyboard_shortcuts_close"),!(e=(t=$(".active.content .ticket-article .icon-reply").last()).parent().find(".icon-reply-all")).get(0))return t.trigger("click");e.trigger("click")}},{key:"j",hotkeys:!0,description:__("Set article to internal/public"),globalEvent:"article-internal-public",callback:function(){return App.Event.trigger("keyboard_shortcuts_close"),$(".active.content .editControls .js-selectInternalPublic").trigger("click")}},{key:"c",hotkeys:!0,description:__("Update as closed"),globalEvent:"task-update-close",callback:function(){if(App.Event.trigger("keyboard_shortcuts_close"),$(".active.content .edit").get(0))return $('.active.content .edit [name="state_id"]').val(4),$(".active.content .js-attributeBar .js-submit").first().trigger("click")}},{key:["\u25c0","\u25b6"],hotkeys:!0,description:__("Navigate through article")}]},{where:__("Used when composing a Ticket article"),shortcuts:[{key:"::",hotkeys:!1,description:__("Inserts text module"),globalEvent:"richtext-insert-text-module"},{key:"??",hotkeys:!1,description:__("Inserts knowledge base answer"),globalEvent:"richtext-insert-kb-answer"},{key:"@@",hotkeys:!1,description:__("Inserts a mention for a user"),globalEvent:"richtext-insert-mention-user"}]}]},{headline:__("Text editing"),location:"right",content:[{where:__("Used when composing a text"),shortcuts:[{key:"u",magicKey:!0,description:__("Format as _underlined_"),globalEvent:"richtext-underline"},{key:"b",magicKey:!0,description:__("Format as |bold|"),globalEvent:"richtext-bold"},{key:"i",magicKey:!0,description:__("Format as ||italic||"),globalEvent:"richtext-italic"},{key:"s",magicKey:!0,description:__("Format as //strikethrough//"),globalEvent:"richtext-strikethrough"},{key:"v",magicKey:!0,description:__("Paste from clipboard"),globalEvent:"clipboard-paste"},{key:"v",magicKey:!0,shiftKey:!0,description:__("Paste from clipboard (plain text)"),globalEvent:"clipboard-paste-plain-text"},{key:"f",hotkeys:!0,description:__("Removes the formatting"),globalEvent:"richtext-remove-formating"},{key:"y",hotkeys:!0,description:__("\u2026of whole text area"),globalEvent:"richtext-remove-formating-textarea"},{key:"z",hotkeys:!0,description:__("Inserts a horizontal rule"),globalEvent:"richtext-hr"},{key:"l",hotkeys:!0,description:__("Format as unordered list"),globalEvent:"richtext-ul"},{key:"k",hotkeys:!0,description:__("Format as ordered list"),globalEvent:"richtext-ol"},{key:"1",hotkeys:!0,description:__("Format as h1 heading"),globalEvent:"richtext-h1"},{key:"2",hotkeys:!0,description:__("Format as h2 heading"),globalEvent:"richtext-h2"},{key:"3",hotkeys:!0,description:__("Format as h3 heading"),globalEvent:"richtext-h3"},{key:"x",hotkeys:!0,description:__("Removes any hyperlink"),globalEvent:"richtext-remove-hyperlink"}]}]}])}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.checkAvailability=e(this.checkAvailability,this),this.maintanaceAppVersion=e(this.maintanaceAppVersion,this),this.maintanaceConfigChanged=e(this.maintanaceConfigChanged,this),this.maintanaceRestartManual=e(this.maintanaceRestartManual,this),this.maintanaceRestartAuto=e(this.maintanaceRestartAuto,this),this.maintanaceMode=e(this.maintanaceMode,this),this.showMessage=e(this.showMessage,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("maintenance",(t=this,function(e){if("message"===e.type&&t.showMessage(e),"mode"===e.type&&t.maintanaceMode(e),"app_version"===e.type&&t.maintanaceAppVersion(e),"config_changed"===e.type&&t.maintanaceConfigChanged(e),"restart_auto"===e.type&&t.maintanaceRestartAuto(e),"restart_manual"===e.type)return t.maintanaceRestartManual(e)}))}return n(i,t),i.prototype.serverRestarted=!1,i.prototype.showMessage=function(t){var e;return null==t&&(t={}),t.reload?(this.disconnectClient(),e=__("Continue session")):e=__("Close"),new App.SessionMessage({head:t.head,contentInline:t.message,small:!0,keyboard:!0,backdrop:!0,buttonClose:!0,buttonSubmit:e,forceReload:t.reload})},i.prototype.maintanaceMode=function(t){if(null==t&&(t={}),!0===t.on&&this.authenticateCheck())return this.navigate("#logout")},i.prototype.maintanaceRestartAuto=function(){if(!this.messageRestartAuto)return this.messageRestartAuto=new App.SessionMessage({head:App.i18n.translateContent("Zammad is restarting\u2026"),message:App.i18n.translateContent("Some system settings have changed, Zammad is restarting. Please wait until Zammad is back again."),keyboard:!1,backdrop:!1,buttonClose:!1,buttonSubmit:!1,small:!0,forceReload:!0}),this.disconnectClient(),this.checkAvailability()},i.prototype.maintanaceRestartManual=function(){if(!this.messageRestartManual)return this.messageRestartManual=new App.SessionMessage({head:App.i18n.translateInline("Zammad requires a restart!"),contentInline:App.i18n.translateInline('Some system settings have changed, please restart all Zammad processes! If you want to do this automatically, set environment variable APP_RESTART_CMD="/path/to/your_app_script.sh restart".'),keyboard:!1,backdrop:!1,buttonClose:!1,buttonSubmit:!1,small:!0,forceReload:!0}),this.disconnectClient(),this.checkAvailability()},i.prototype.maintanaceConfigChanged=function(){if(!this.messageConfigChanged)return this.messageConfigChanged=new App.SessionMessage({head:App.i18n.translateContent("Config has changed"),message:App.i18n.translateContent("The configuration of Zammad has changed, please reload your browser."),keyboard:!1,backdrop:!0,buttonClose:!1,buttonSubmit:__("Continue session"),forceReload:!0})},i.prototype.maintanaceAppVersion=function(t){var e,n;if(!this.messageAppVersion&&this.appVersion!==t.app_version)if(this.appVersion){if(this.appVersion=t.app_version,"true"===this.appVersion.split(":")[1])return n=this,e=function(){return n.messageAppVersion=new App.SessionMessage({head:App.i18n.translateContent("New Version"),message:App.i18n.translateContent("A new version of Zammad is available, please reload your browser."),keyboard:!1,backdrop:!0,buttonClose:!1,buttonSubmit:__("Continue session"),forceReload:!0})},this.delay(e,2e3)}else this.appVersion=t.app_version},i.prototype.checkAvailability=function(t){var e,n;return n=this,e=function(){return n.ajax({id:"check_availability",type:"get",url:n.apiPath+"/available",success:function(){if(!n.serverRestarted)return n.checkAvailability();n.windowReload()},error:function(){return n.serverRestarted=!0,n.checkAvailability(2e3)}})},null==t&&(t=1e3),this.delay(e,t)},i}(App.Controller),App.Config.set("maintenance",t,"Plugins")}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.MobileDetection=function(){function t(){}return t.isMobile=function(){return isMobile()},t.isForcingDesktopView=function(){return App.LocalStorage.get("forceDesktopApp",!1)},t.clearForceDesktopApp=function(){if(App.LocalStorage.get("forceDesktopApp",!1))return App.LocalStorage.delete("forceDesktopApp")},t.navigateToMobile=function(){var t;return t="/mobile",window.location.hash&&(t+="/"+window.location.hash),window.location.href=t},t.redirectToMobile=function(){return t.clearForceDesktopApp(),t.navigateToMobile()},t.autoRedirectToMobile=function(){if(t.isMobile()&&!t.isForcingDesktopView())return t.redirectToMobile()},t}(),App.MobileDetectionWorker=function(){function t(){}return t.prototype.clicked=function(){return App.MobileDetection.redirectToMobile()},t}(),App.MobileDetectionPlugin=function(e){function n(){n.__super__.constructor.apply(this,arguments),App.MobileDetection.autoRedirectToMobile(),this.delay(this.launchTaskManagerTask)}return t(n,e),n.prototype.launchTaskManagerTask=function(){return App.TaskManager.execute({key:"MobileDetection",controller:"MobileDetectionWorker",params:{},show:!1,persistent:!0})},n}(App.Controller),App.Config.set("mobile_detection",App.MobileDetectionPlugin,"Plugins"),(App.MobileDetection.isMobile()||App.LocalStorage.get("forceDesktopApp",!1))&&App.Config.set("Mobile",{prio:1500,parent:"#current_user",name:__("Continue to mobile"),translate:!0,target:"#",onclick:!0,key:"MobileDetection"},"NavBarRight")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.toggleClicked=e(this.toggleClicked,this),this.isCollapsed=e(this.isCollapsed,this),this.fetchRecentView=e(this.fetchRecentView,this),this.recentViewNavbarItemsRebuild=e(this.recentViewNavbarItemsRebuild,this),this.update=e(this.update,this),this.search=e(this.search,this),this.andClose=e(this.andClose,this),this.andEmpty=e(this.andEmpty,this),this.emptyAndCloseDelayed=e(this.emptyAndCloseDelayed,this),this.emptyAndClose=e(this.emptyAndClose,this),this.nudge=e(this.nudge,this),this.listNavigate=e(this.listNavigate,this),this.searchBlur=e(this.searchBlur,this),this.searchPaste=e(this.searchPaste,this),this.searchFocus=e(this.searchFocus,this),this.renderResult=e(this.renderResult,this),this.renderPersonal=e(this.renderPersonal,this),this.renderMenu=e(this.renderMenu,this),this.release=e(this.release,this),i.__super__.constructor.apply(this,arguments),this.render(),this.globalSearch=new App.GlobalSearch({render:this.renderResult}),this.controllerBind("ui:rerender",(t=this,function(){return t.renderMenu(),t.renderPersonal()})),this.controllerBind("menu:render",function(t){return function(){return t.renderMenu()}}(this)),this.controllerBind("personal:render",function(t){return function(){return t.renderPersonal()}}(this)),this.controllerBind("navupdate",function(t){return function(e){return t.update(e)}}(this)),this.controllerBind("RecentView::changed",function(t){return function(){return t.delay((function(){return t.fetchRecentView()}),1e3,"recent-view-changed")}}(this)),this.controllerBind("bell",function(t){return function(e){return"on"===e?(t.$(".bell").addClass("show"),App.Audio.play("https://www.sounddogs.com/previews/2193/mp3/219024_SOUNDDOGS__be.mp3"),t.delay((function(){return App.Event.trigger("bell","off")}),3e3)):t.$(".bell").removeClass("show")}}(this))}return n(i,t),i.extend(App.PopoverProvidable),i.registerAllPopovers(),i.prototype.elements={"#global-search":"searchInput",".search":"searchContainer",".js-global-search-result":"searchResult",".js-details-link":"searchDetails"},i.prototype.events={"click .js-toggleNotifications":"toggleNotifications","click .js-emptySearch":"emptyAndClose","submit form.search-holder":"preventDefault","dblclick form.search-holder .icon-magnifier":"openExtendedSearch","focus #global-search":"searchFocus","blur #global-search":"searchBlur","paste #global-search":"searchPaste","keyup #global-search":"listNavigate","click .js-global-search-result":"emptyAndCloseDelayed","click .js-details-link":"openExtendedSearch","change .js-menu .js-switch input":"switch","click .js-onclick":"click","click .js-navigation-toggle-button":"toggleClicked"},i.prototype.release=function(){if(this.notificationWidget)return this.notificationWidget.remove(),this.notificationWidget=void 0},i.prototype.renderMenu=function(){var t,e,n,i,s,r,o,a,l;for(t={},i=[],s=0,r=(n=this.getItems({navbar:this.Config.get("NavBar")})).length;s<r;s++)a=!0,void 0!==(e=n[s]).shown&&(a=e.shown),e.key&&(l=App.TaskManager.worker(e.key))&&(l.counter&&(e.counter=l.counter()),l.switch&&(e.switch=l.switch()),l.active&&l.active()&&(t[e.target]=!0),l.onclick&&(e.onclick=l.onclick()),l.accessoryIcon&&(e.accessoryIcon=l.accessoryIcon()),l.featureActive&&(a=!!l.featureActive())),a&&i.push(e);return n=i,o={},this.$(".open").children("a").each((function(t,e){var n;return n=$(e).attr("href"),o[n]=!0})),this.$(".js-menu").html(App.view("navigation/menu")({items:n,openTab:o,activeTab:t}))},i.prototype.click=function(t){var e;return this.preventDefaultAndStopPropagation(t),e=$(t.currentTarget).data("key"),App.TaskManager.worker(e).clicked(t)},i.prototype.switch=function(t){var e,n,i;if(n=$(t.target).prop("checked"),(e=$(t.target).closest(".menu-item").data("key"))&&(i=App.TaskManager.worker(e)))return i.switch(n)},i.prototype.renderPersonal=function(){var t,e,n,i,s;for(this.recentViewNavbarItemsRebuild(),n=0,i=(e=clone(this.getItems({navbar:this.Config.get("NavBarRight")}),!0)).length;n<i;n++)(t=e[n])&&t.child&&1===t.child.length&&(t.target=t.child[0].target,delete t.child);if(s={},this.$(".open").children("a").each((function(t,e){var n;return n=$(e).attr("href"),s[n]=!0})),this.$(".navbar-items-personal").html(App.view("navigation/personal")({items:e,openTab:s})),new App.DarkMode,App.Session.get("id"))return new App.WidgetAvatar({el:this.$(".js-avatar"),object_id:App.Session.get("id"),type:"personal"})},i.prototype.renderResult=function(t){var e;if(null==t&&(t=[]),this.removePopovers(),!_.isEmpty(t))return e=App.view("navigation/result")({result:t}),this.searchResult.html(e),this.renderPopovers();this.searchResult.html(App.view("navigation/no_result")())},i.prototype.render=function(){var t,e;if(e=App.Session.get(),!_.isEmpty(e))return t=$(App.view("navigation")({user:e})),this.taskbar=new App.TaskbarWidget({el:t.find(".tasks")}),this.el=t,this.appEl.find("#navigation").get(0)?(this.el=this.appEl.find("#navigation"),this.html(t)):(this.appEl.prepend(t),this.delegateEvents(this.events),this.refreshElements(),this.el.on("remove",this.releaseController),this.el.on("remove",this.release)),this.renderMenu(),this.renderPersonal(),this.notificationWidget&&this.notificationWidget.remove(),this.notificationWidget=new App.OnlineNotificationWidget,this.appEl.append(this.notificationWidget.el);this.appEl.find("#navigation").remove()},i.prototype.searchFocus=function(t){return this.clearDelay("emptyAndCloseDelayed"),this.query=void 0,this.search(10),App.PopoverProvidable.anyPopoversDestroy(),this.searchContainer.addClass("focused"),this.selectAll(t),$("#app").removeClass("navigation-collapsed"),this.el.addClass("is-not-collapsed")},i.prototype.searchPaste=function(){var t,e;return e=this,t=function(){return e.clearDelay("emptyAndCloseDelayed"),e.query=void 0,e.search(10),App.PopoverProvidable.anyPopoversDestroy(),e.searchContainer.addClass("focused")},this.delay(t,10,"searchFocus")},i.prototype.searchBlur=function(){var t,e;return e=this,t=function(){if(""===e.searchInput.val().trim())return e.emptyAndClose()},this.delay(t,100,"removeFocused")},i.prototype.listNavigate=function(t){var e;if(27!==t.keyCode)if(38!==t.keyCode){if(40!==t.keyCode)return 13===t.keyCode?(this.searchInput.trigger("blur"),void((e=this.$(".global-search-result .nav-tab.is-hover").attr("href"))?(this.navigate(e),this.emptyAndCloseDelayed()):this.openExtendedSearch())):this.search(0);this.nudge(t,1)}else this.nudge(t,-1);else this.emptyAndClose()},i.prototype.nudge=function(t,e){var n,i,s;if(this.searchContainer.hasClass("open"))return(n=this.searchResult.find(".nav-tab.is-hover")).get(0)||1!==e?(1===e?(i=n.closest("li").nextAll("li").not(".divider").first().find(".nav-tab")).get(0)&&(n.removeClass("is-hover").popover("hide"),i.addClass("is-hover").popover("show")):(s=n.closest("li").prevAll("li").not(".divider").first().find(".nav-tab")).get(0)?(n.removeClass("is-hover").popover("hide"),s.addClass("is-hover").popover("show")):(n.removeClass("is-hover").popover("hide"),this.searchDetails.addClass("is-hover")),i&&this.scrollToIfNeeded(i,!0),s?this.scrollToIfNeeded(s,!1):void 0):this.searchDetails.hasClass("is-hover")?(this.searchDetails.removeClass("is-hover"),void this.searchResult.find(".nav-tab").first().addClass("is-hover").popover("show")):void this.searchDetails.addClass("is-hover")},i.prototype.emptyAndClose=function(){return this.andClose(),this.andEmpty()},i.prototype.emptyAndCloseDelayed=function(){var t,e;return this.andClose(),e=this,t=function(){return e.andEmpty()},this.delay(t,6e4,"emptyAndCloseDelayed")},i.prototype.andEmpty=function(){return this.query="",this.searchInput.val("")},i.prototype.andClose=function(){return this.searchContainer.removeClass("focused filled open no-match loading"),this.globalSearch.close(),this.delayedRemoveAnyPopover(!0)},i.prototype.search=function(t){var e;if(e=this.searchInput.val().trim(),this.searchContainer.toggleClass("filled",!!e),this.query!==e){var n;if(this.query=e,0===t&&(t=500,e.length>2?t=350:e.length>4&&(t=200)),""!==e)return this.globalSearch.search({delay:t,query:this.query,callbackLongerAsExpected:(n=this,function(){return n.searchContainer.removeClass("open")}),callbackNoMatch:function(t){return function(){return t.searchContainer.addClass("no-match"),t.searchContainer.addClass("open")}}(this),callbackMatch:function(t){return function(){return t.searchContainer.removeClass("no-match"),t.searchContainer.addClass("open")}}(this),callbackStop:function(t){return function(){return t.searchContainer.removeClass("loading")}}(this),callbackStart:function(t){return function(){return t.searchContainer.addClass("loading")}}(this)});this.searchContainer.removeClass("open")}},i.prototype.filterNavbar=function(t,e){return null==e&&(e=null),_.filter(t,(n=this,function(t){var i,s,r;if("function"==typeof t.callback)for(s in i=t.callback()||{})r=i[s],t[s]=r;return(null==e&&!t.parent||t.parent===e)&&n.filterNavbarPermissionOk(t)&&n.filterNavbarSettingOk(t)}));var n},i.prototype.filterNavbarPermissionOk=function(t){return!t.permission||("function"==typeof t.permission?t.permission(this):_.any(t.permission,(e=this,function(t){return e.permissionCheck(t)})));var e},i.prototype.filterNavbarSettingOk=function(t){return!t.setting||_.any(t.setting,(e=this,function(t){return e.Config.get(t)}));var e},i.prototype.getItems=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d;for(h=_.values(t.navbar),p=[],n={},p=this.filterNavbar(h),r=0,l=h.length;r<l;r++)if((i=h[r]).parent&&!n[i.parent])for(n[i.parent]=this.filterNavbar(h,i.parent),o=0,c=p.length;o<c;o++)(s=p[o]).target===i.parent&&(d=this.getOrder(n[i.parent]),s.child=d);for(e=[],a=0,u=p.length;a<u;a++)(!(i=p[a]).child||i.child&&!_.isEmpty(i.child))&&e.push(i);return this.getOrder(e)},i.prototype.getOrder=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d;for(p={},r=0,l=t.length;r<l;r++)s=t[r],this.addPrioCount(p,s),p[s.prio]=s;for(i=[],o=0,c=(n=_.keys(p).sort(this.sortit)).length;o<c;o++)h=n[o],i.push(p[h]);for(e=!1,a=0,u=i.length;a<u;a++)"recentViewed"===(d=i[a]).type&&(e=!0),e&&"recentViewed"!==d.type&&(d.divider=!0,e=!1);return i},i.prototype.sortit=function(t,e){return t-e},i.prototype.addPrioCount=function(t,e){if(t[e.prio]&&(e.prio++,t[e.prio]))return this.addPrioCount(t,e)},i.prototype.update=function(t){var e,n;if(n=t,_.isObject(t)&&(n=t.url,e=t.type),"menu"===e?this.$(".js-menu .is-active").removeClass("is-active"):this.$(".is-active").removeClass("is-active"),n&&"#"!==n)return this.$('.js-menu [href="'+n+'"], .tasks [href="'+n+'"]').addClass("is-active")},i.prototype.recentViewNavbarItemsRebuild=function(){var t,e,n,i,s,r,o,a,l;for(r in t=this.Config.get("NavBarRight")||{})"#current_user"===t[r].parent&&"RecendViewed"===r.split("::")[0]&&delete t[r];if(this.Session.get()){for(i=App.RecentView.search({sortBy:"created_at",order:"DESC"}),l=80,s=0,o=(i=this.prepareForObjectList(i)).length;s<o;s++)n=i[s],e=!1,a=!1,80===l&&(e=!0,a=__("Recently viewed")),l++,t["RecendViewed::"+n.o_id+n.object+"-"+l]={prio:l,parent:"#current_user",name:App.i18n.translateInline(n.object)+" ("+n.title+")",target:n.link,divider:e,navheader:a,type:"recentViewed"};return this.Config.set("NavBarRight",t)}this.Config.set("NavBarRight",t)},i.prototype.fetchRecentView=function(){var t,e;return e=this,t=function(){return e.renderPersonal()},App.RecentView.fetchFull(t,{clear:!0})},i.prototype.toggleNotifications=function(t){return t.stopPropagation(),this.notificationWidget.toggle()},i.prototype.openExtendedSearch=function(t){var e;if(t&&t.preventDefault(),e=this.searchInput.val(),this.emptyAndClose(),!e)return this.navigate("#search");this.navigate("#search/"+encodeURIComponent(e))},i.prototype.isCollapsed=function(){return 50===this.el.width()},i.prototype.toggleClicked=function(t){var e;return this.preventDefaultAndStopPropagation(t),e=this.isCollapsed(),this.el.toggleClass("is-not-collapsed",e),$("#app").toggleClass("navigation-collapsed",!e)},i}(App.Controller),App.Config.set("aaa_navigation",t,"Plugins")}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Notify=function(e){function n(){var t;n.__super__.constructor.apply(this,arguments),this.controllerBind("notify",(t=this,function(e){return t.render(e)})),this.controllerBind("notify:removeall",function(t){return function(){return t.log("notify:removeall",t),t.destroyAll()}}(this)),this.controllerBind("notifyDesktop",function(t){return function(e){var n,i,s;if(window.Notification)return e.icon||(e.icon=t.logoUrl()),s=864e5,document.hasFocus()&&(s=4e3),t.desktopNotifyCounter+=1,n=t.desktopNotifyCounter,e.silent=!0,i=new window.Notification(e.title,e),t.desktopNotify[n]=i,t.log("debug","notifyDesktop",e,n),i.onclose=function(){return delete t.desktopNotify[n]},i.onclick=function(){if(window.focus(),t.log("debug","notifyDesktop.click",e),e.url&&t.locationExecuteOrNavigate(e.url),e.callback)return e.callback()},e.timeout||s?App.Delay.set((function(){return i.close()}),e.timeout||s):void 0}}(this)),void 0!==App.Session.get()&&window.Notification&&window.Notification.requestPermission(),$(window).on("focus",function(t){return function(){var e,n,i,s;for(e in s=[],i=t.desktopNotify)n=i[e],s.push(n.close());return s}}(this))}return t(n,e),n.prototype.desktopNotify={},n.prototype.desktopNotifyCounter=0,n.prototype.events={"click .alert":"destroy"},n.prototype.render=function(t){return $("#notify").get(0)||$("body").append('<div id="notify"></div>'),"info"===t.type&&(t.type="information"),"warning"===t.type&&(t.type="alert"),t.removeAll&&$.noty.closeAll(),t.link&&(t.msg='<a href="'+t.link+'">'+t.msg+"</a>"),$("#notify").noty({text:t.msg,type:t.type,template:App.view("notify")({type:t.type}),animation:{open:"animated fadeInDown",close:"animated fadeOutDown"},timeout:t.timeout||3800,closeWith:["click"]})},n.prototype.destroy=function(t){return t.preventDefault()},n.prototype.destroyAll=function(){return $.noty.closeAll()},n}(App.Controller),App.Config.set("notify",App.Notify,"Plugins")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t;n.__super__.constructor.apply(this,arguments),App.Event.bind("remote_task",(t=this,function(e){return console.log("remote_task",e),App.TaskManager.execute(e),t.navigate(e.url)}),"remote_task")}return e(n,t),n.prototype.serverRestarted=!1,n}(App.Controller),App.Config.set("remote_task",t,"Plugins")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t;n.__super__.constructor.apply(this,arguments),App.Event.bind("auth:session_invalid",(t=this,function(){return App.Auth._logout(!0,(function(){return t.navigate("#session_invalid")}))}))}return e(n,t),n.prototype.release=function(){return App.Event.unbind("auth:session_invalid")},n}(App.Controller),App.Config.set("session_invalid",t,"Plugins")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t;n.__super__.constructor.apply(this,arguments),this.controllerBind("ws:login",(function(){return App.WebSocket.send({event:"session_takeover",data:{taskbar_id:App.TaskManager.TaskbarId()}})})),this.controllerBind("session_takeover",(t=this,function(e){if(!t.error&&e.taskbar_id!==App.TaskManager.TaskbarId())return t.error=new App.SessionMessage({head:__("Session"),message:__("A new session was created with your account. This session will be stopped to prevent a conflict."),keyboard:!1,backdrop:!0,buttonClose:!1,buttonSubmit:__("Continue session"),forceReload:!0}),t.disconnectClient()}))}return e(n,t),n}(App.Controller),App.Config.set("session_taken_over",t,"Plugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.logoutWarningShow=e(this.logoutWarningShow,this),this.logoutWarningClose=e(this.logoutWarningClose,this),this.logoutWarningExists=e(this.logoutWarningExists,this),this.quitApp=e(this.quitApp,this),this.checkLogout=e(this.checkLogout,this),this.checkTimeout=e(this.checkTimeout,this),i.__super__.constructor.apply(this,arguments),this.lastEvent=this.currentTime(),$(document).off("keyup.session_timeout").on("keyup.session_timeout",this.checkTimeout),$(document).off("mousemove.session_timeout").on("mousemove.session_timeout",this.checkTimeout),this.controllerBind("config_update",this.checkTimeout),this.controllerBind("session_timeout",this.quitApp),this.interval(this.checkLogout,this.intervalCheck,"session_timeout")}return n(i,t),i.prototype.lastEvent=0,i.prototype.warningDialog=void 0,i.prototype.intervalCheck=5e3,i.prototype.showLogoutWarningBefore=-3e4,i.prototype.timeTillLogout=void 0,i.prototype.checkTimeout=function(){var t;if(!((t=this.currentTime())-2e3<this.lastEvent||(this.lastEvent=t,this.timeTillLogout&&this.timeTillLogout>2e4)))return this.checkLogout()},i.prototype.checkLogout=function(){var t;if(void 0!==App.Session.get()&&!((t=this.getTimeout())<1))if(this.timeTillLogout=this.currentTime()-(this.lastEvent+t),this.timeTillLogout<this.showLogoutWarningBefore){if(!this.logoutWarningExists())return;this.logoutWarningClose()}else{if(!(this.timeTillLogout<=0))return this.quitApp();this.logoutWarningShow()}},i.prototype.currentTime=function(){return(new Date).getTime()},i.prototype.quitApp=function(){var t;if(void 0!==App.Session.get())return this.logoutWarningClose(),App.Auth.logout(!1,(t=this,function(){return t.navigate("#session_timeout")}))},i.prototype.getTimeout=function(){var t,e,n,i,s;for(e in i=App.User.find(App.Session.get().id),n=-1,t=App.Config.get("session_timeout"))s=t[e],"default"!==e&&i.permission(e)&&(parseInt(s)<n||(n=parseInt(s)));return n<1&&(n=parseInt(t.default)),1e3*n},i.prototype.logoutWarningExists=function(){return!!this.warningDialog},i.prototype.logoutWarningClose=function(){return!!this.warningDialog&&(this.warningDialog.close(),this.warningDialog=void 0)},i.prototype.logoutWarningShow=function(){var t;if(!this.warningDialog)return this.warningDialog=new App.ControllerModal({head:__("Session"),message:__("Due to inactivity, you will be automatically logged out within the next 30 seconds."),keyboard:!0,backdrop:!0,buttonClose:!0,buttonSubmit:__("Continue session"),onSubmit:(t=this,function(){return t.lastEvent=t.currentTime(),t.checkLogout()})})},i.prototype.release=function(){return this.logoutWarningClose()},i}(App.Controller),App.Config.set("session_timeout",t,"Plugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.html=e(this.html,this),this.element=e(this.element,this),this.switchBack=e(this.switchBack,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("app:ready",(t=this,function(){return t.render()})),this.controllerBind("ui:rerender",function(t){return function(){return t.render()}}(this))}return n(i,t),i.prototype.className="switchBackToUser",i.prototype.render=function(){var t;if(App.Config.get("switch_back_to_possible")&&App.Session.get())return this.html(App.view("widget/switch_back_to_user")()),this.element().on("click",".js-close",(t=this,function(e){return t.switchBack(e)}));this.element().remove()},i.prototype.switchBack=function(t){return t.preventDefault(),this.disconnectClient(),$("#app").hide().attr("style","display: none!important"),this.delay((e=this,function(){return App.Auth._logout(!1),e.ajax({id:"user_switch_back",type:"GET",url:e.apiPath+"/sessions/switch_back",success:function(t){var n;return n=window.location.protocol+"//"+window.location.host+t.location,e.windowReload(void 0,n)}})}),800);var e},i.prototype.element=function(){return $("#"+this.key)},i.prototype.html=function(t){return $("#"+this.key).get(0)||$("#app").before('<div id="'+this.key+'" class="'+this.className+'"></div>'),$("#"+this.key).html(t)},i}(App.Controller),App.Config.set("switch_back_to_user",t,"Plugins")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Theme=function(n){function i(){var e;this.set=t(this.set,this),this.toggleDarkMode=t(this.toggleDarkMode,this),this.onMediaQueryChange=t(this.onMediaQueryChange,this),this.currentTheme=t(this.currentTheme,this),i.__super__.constructor.apply(this,arguments),window.location.href.includes("/tests_")||("function"==typeof(e=window.matchMedia("(prefers-color-scheme: dark)")).addEventListener&&e.addEventListener("change",this.onMediaQueryChange),this.controllerBind("ui:theme:set",this.set),this.controllerBind("ui:theme:toggle-dark-mode",this.toggleDarkMode),this.set({theme:this.currentTheme()}))}return e(i,n),i.prototype.auto=function(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},i.prototype.currentTheme=function(t){var e;switch(t||(t=null!=(e=App.Session.get("preferences"))?e.theme:void 0),t){case"dark":return"dark";case"light":return"light";default:return this.auto()}},i.prototype.onMediaQueryChange=function(){return this.set({theme:this.currentTheme()})},i.prototype.toggleDarkMode=function(){return this.set({theme:"dark"===document.documentElement.dataset.theme?"light":"dark",save:!0})},i.prototype.set=function(t){var e;return t.save&&(null!=(e=App.Session.get())?e.id:void 0)&&(App.Ajax.request({id:"preferences",type:"PUT",url:App.Config.get("api_path")+"/users/preferences",data:JSON.stringify({theme:t.theme}),processData:!0}),App.Event.trigger("ui:theme:saved",t)),document.documentElement.dataset.theme=this.currentTheme(t.theme),App.Event.trigger("ui:theme:changed",t)},i}(App.Controller),App.Config.set("theme",App.Theme,"Plugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.toogle=e(this.toogle,this),
this.rebind=e(this.rebind,this),i.__super__.constructor.apply(this,arguments),this.rebind(),this.controllerBind("auth",(t=this,function(){return t.rebind()})),this.controllerBind("i18n:inline_translation",function(t){return function(){return t.toogle()}}(this))}return n(i,t),i.prototype.rebind=function(){var t,e;if($(document).off("keydown.translation"),this.permissionCheck("admin.translation"))return t=App.Browser.hotkeys(),$(document).on("keydown.translation",(e=this,function(n){var i;if(i=!1,"ctrl+shift"===t?!n.altKey&&n.ctrlKey&&!n.metaKey&&n.shiftKey&&(i=!0):n.altKey&&n.ctrlKey&&!n.metaKey&&(i=!0),i&&84===n.keyCode)return n.preventDefault(),e.toogle()}))},i.prototype.toogle=function(){return this.active?($(".translation:focus").trigger("blur"),this.disable(),void(this.active=!1)):(this.enable(),this.active=!0)},i.prototype.enable=function(){var t;return t=App.i18n.meta(),!this.mapLoaded&&t&&t.mapToLoad&&(this.mapLoaded=!0,App.Translation.refresh(t.mapToLoad,{clear:!0})),App.Config.set("translation_inline",!0),this.observer=new MutationObserver((function(t){return t.forEach((function(t){return t.addedNodes.forEach((function(t){return $(t).find("span.translation").on("click.translation",(function(t){return t.stopPropagation(),!1})),$(t).find("span.translation").on("keydown.translation",(function(t){return t.stopPropagation(),!0}))})),t.removedNodes.forEach((function(t){return $(t).find("span.translation").off(".translation")}))}))})),this.observer.observe(document.body,{subtree:!0,childList:!0}),App.Event.trigger("ui:rerender"),$("body").on("focus.translation",".translation",(function(t){var e;return(e=$(t.target)).data("before",e.text()),e})).on("blur.translation",".translation",(function(t){var e,n,i,s,r;if((n=(e=$(t.target)).attr("title"))&&(r=e.text(),e.data("before")!==r))return App.Log.debug("translation_inline","translate update",r,"before",e.data),e.data("before",r),App.i18n.setMap(n,r),i=n.replace("'","\\'"),$(".translation[title='"+i+"']").text(r),(s=App.Translation.findByAttribute("source",n))?s.updateAttribute("target",r):((s=new App.Translation).load({locale:App.i18n.get(),source:n,target:r,target_initial:""}),s.save()),e}))},i.prototype.disable=function(){return this.observer.disconnect(),$("body").off(".translation"),App.Config.set("translation_inline",!1),App.Event.trigger("ui:rerender")},i}(App.Controller),App.Config.set("translation_inline",t,"Plugins")}.call(this),function(){var t,e,n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty,s=function(t,e){return function(){return t.apply(e,arguments)}};e=function(e){function i(){var e,n;i.__super__.constructor.apply(this,arguments),n=this,e=function(){var e,i;if(n.Config.get("system_init_done")&&"en"!==App.i18n.get(!0).substr(0,2)&&n.permissionCheck("admin.translation")&&!(window.location.hash.toString().match(/getting/)||(e=App.i18n.meta(),(i=parseInt(e.translated/(e.total/100)))>90)))return new t({percent:i})},this.controllerBind("i18n:language:change",function(t){return function(){return t.delay(e,2500,"translation_support")}}(this)),void 0!==App.Session.get()&&this.delay(e,2500,"translation_support")}return n(i,e),i}(App.Controller),App.Config.set("translation_support",e,"Plugins"),t=function(t){function e(){this.onSubmit=s(this.onSubmit,this),this.onCancel=s(this.onCancel,this),this.content=s(this.content,this),e.__super__.constructor.apply(this,arguments),App.LocalStorage.get("translation_support_no",this.Session.get("id"))||this.render()}return n(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=__("No Thanks!"),e.prototype.buttonSubmit=__("Complete translations"),e.prototype.head=__("Help to improve Zammad!"),e.prototype.shown=!1,e.prototype.content=function(){return App.view("translation/support")({percent:this.percent})},e.prototype.onCancel=function(){return App.LocalStorage.set("translation_support_no",!0,this.Session.get("id")),this.close()},e.prototype.onSubmit=function(){return this.navigate("#system/translation"),this.close()},e}(App.ControllerModal)}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;e=function(e){function s(){var e;this.verifyLater=n(this.verifyLater,this),s.__super__.constructor.apply(this,arguments),this.controllerBind("user_signup_verify",(function(e){return new t({user:e})})),null!=(e=App.User.current())&&this.verifyLater(e.id)}return i(s,e),s.prototype.verifyLater=function(t){var e,n;return n=this,e=function(){return n.verify(t)},this.delay(e,5e3,"user_signup_verify_dialog")},s.prototype.verify=function(e){var n;if(e&&App.User.exists(e)&&"signup"===(n=App.User.find(e)).source&&!0!==n.verified&&!((new Date).getTime()-Date.parse(n.created_at)<18e5))return new t({user:n})},s}(App.Controller),t=function(t){function e(){this.error=n(this.error,this),this.success=n(this.success,this),this.onSubmit=n(this.onSubmit,this),this.content=n(this.content,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.backdrop=!1,e.prototype.keyboard=!1,e.prototype.head=__("Account not verified"),e.prototype.small=!0,e.prototype.buttonClose=!1,e.prototype.buttonCancel=!1,e.prototype.buttonSubmit=__("Resend verification email"),e.prototype.content=function(){var t;return this.sent?(t=App.i18n.translateContent("We've sent an email to _%s_. Click the link in the email to verify your account.",this.user.email),t+="<br><br>",t+=App.i18n.translateContent("If you don't see the email, check other places it might be, like your junk, spam, social, or other folders.")):App.i18n.translateContent("Your account has not been verified. Please click on the link in the verification email.")},e.prototype.onSubmit=function(){return this.ajax({id:"email_verify_send",type:"POST",url:this.apiPath+"/users/email_verify_send",data:JSON.stringify({email:this.user.email}),processData:!0,success:this.success,error:this.error})},e.prototype.success=function(){return this.sent=!0,this.update()},e.prototype.error=function(){return this.contentInline=App.i18n.translateContent("Verification email could not be sent."),this.update()},e}(App.ControllerModal),App.Config.set("user_signup",e,"Plugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.render(),this.controllerBind("ui:theme:saved",this.render)}return n(i,t),i.requiredPermission="user_preferences.appearance",i.prototype.header=__("Appearance"),i.prototype.events={'change input[name="theme"]':"updateTheme"},i.prototype.render=function(t){return this.html(App.view("profile/appearance")({theme:(null!=t?t.theme:void 0)||App.Session.get("preferences").theme||"auto"}))},i.prototype.updateTheme=function(t){return this.preventDefaultAndStopPropagation(t),App.Event.trigger("ui:theme:set",{theme:t.target.value,save:!0})},i}(App.ControllerSubContent),App.Config.set("Appearance",{prio:900,name:__("Appearance"),parent:"#profile",target:"#profile/appearance",controller:t,permission:["user_preferences.appearance"]},"NavBarProfile")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;n=function(n){function r(){this.onUpload=i(this.onUpload,this),this.storeImage=i(this.storeImage,this),this.openCamera=i(this.openCamera,this),this.pick=i(this.pick,this),this.onDelete=i(this.onDelete,this),this.onSelect=i(this.onSelect,this),this.render=i(this.render,this),this.loadAvatarList=i(this.loadAvatarList,this),r.__super__.constructor.apply(this,arguments),this.avatars=[],this.loadAvatarList()}return s(r,n),r.requiredPermission="user_preferences.avatar",r.prototype.header=__("Avatar"),r.prototype.elements={".js-upload":"fileInput",".avatar-gallery":"avatarGallery"},r.prototype.events={"click .js-openCamera":"openCamera","change .js-upload":"onUpload","click .avatar":"onSelect","click .avatar-delete":"onDelete"},r.prototype.loadAvatarList=function(){return this.ajax({id:"avatar_list",type:"GET",url:this.apiPath+"/users/avatar",processData:!0,success:(t=this,function(e){return t.avatars=e.avatars,t.render()})});var t},r.prototype.hasGetUserMedia=function(){return!!(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia)},r.prototype.render=function(){return this.html(App.view("profile/avatar")({webcamSupport:this.hasGetUserMedia(),avatars:this.avatars})),this.$('.avatar[data-id="'+this.Session.get("id")+'"]').attr("data-id","").attr("data-avatar-id","0")},r.prototype.onSelect=function(t){return this.pick($(t.currentTarget))},r.prototype.onDelete=function(t){var e;if(t.stopPropagation(),confirm(App.i18n.translateInline("Delete Avatar?")))return e={id:$(t.currentTarget).parent(".avatar-holder").find(".avatar").data("avatar-id")},$(t.currentTarget).parent(".avatar-holder").remove(),this.pick(this.$(".avatar").last()),this.ajax({id:"avatar_delete",type:"DELETE",url:this.apiPath+"/users/avatar",data:JSON.stringify(e),processData:!0})},r.prototype.pick=function(t){var e,n;return this.$(".avatar").removeClass("is-active"),t.addClass("is-active"),e={id:t.data("avatar-id")},this.ajax({id:"avatar_set_default",type:"POST",url:this.apiPath+"/users/avatar/set",data:JSON.stringify(e),processData:!0,success:(n=this,function(){var t,e,i;return i=(t=n.$(".avatar.is-active")).attr("style"),t.text()?i+=";background-size:auto":i+=";background-size:cover",(e=$('.avatar[data-id="'+n.Session.get("id")+'"]')).attr("style",i),t.text()?(e.text(t.text()),e.addClass("avatar--unique")):(e.text(""),e.removeClass("avatar--unique"))})}),t},r.prototype.openCamera=function(){return new t({callback:this.storeImage})},r.prototype.storeImage=function(t,e){var n,i;return this.oldDataUrl=t,i=this,n=function(e){return i.ajax({id:"avatar_new",type:"POST",url:i.apiPath+"/users/avatar",data:JSON.stringify({avatar_full:i.oldDataUrl,avatar_resize:e}),processData:!0,success:function(e){var n;return n=$(App.view("profile/avatar-holder")({src:t,avatar:e.avatar})),i.avatarGallery.append(n),i.pick(n.find(".avatar"))}})},App.ImageService.resizeForAvatar(t,"auto",160,e,n)},r.prototype.onUpload=function(t){var n,i;return i=t.target.files[0],n=this.storeImage,EXIF.getData(i,(function(){var t,s;return t=this.exifdata.Orientation,(s=new FileReader).onload=function(s){return new e({imageSource:s.target.result,type:i.type,callback:n,orientation:t})},s.readAsDataURL(this)}))},r}(App.ControllerSubContent),App.Config.set("Avatar",{prio:1100,name:__("Avatar"),parent:"#profile",target:"#profile/avatar",controller:n,permission:["user_preferences.avatar"]},"NavBarProfile"),e=function(t){function e(){return this.onSubmit=i(this.onSubmit,this),this.initializeCropper=i(this.initializeCropper,this),this.onShown=i(this.onShown,this),this.orientateImage=i(this.orientateImage,this),this.post=i(this.post,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Save"),e.prototype.head=__("Crop Image"),e.prototype.elements={".imageCropper-image":"image",".imageCropper-holder":"holder"},e.prototype.content=function(){return App.view("profile/imageCropper")()},e.prototype.post=function(){var t,e,n;return this.size=256,t={1:0,3:180,6:90,8:-90},this.angle=t[this.orientation],void 0===this.angle&&(this.angle=0),n=this,e=function(t){var e;return 0!==n.angle?(n.isOrientating=!0,(e=new Image).addEventListener("load",n.orientateImage),e.src=t):n.image.attr({src:t})},App.ImageService.resize(this.imageSource,600,"auto",2,this.type,.9,e)},e.prototype.orientateImage=function(t){var e,n,i;if(i=t.currentTarget,n=(e=document.createElement("canvas")).getContext("2d"),180===this.angle?(e.width=i.width,e.height=i.height):(e.width=i.height,e.height=i.width),n.translate(e.width/2,e.height/2),n.rotate(this.angle*Math.PI/180),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),this.image.attr({src:e.toDataURL()}),this.isOrientating=!1,this.isShown)return this.initializeCropper()},e.prototype.onShown=function(){if(this.isShown=!0,!this.isOrientating)return this.initializeCropper()},e.prototype.initializeCropper=function(){return this.image.cropper({aspectRatio:1,guides:!1,autoCrop:!0,autoCropArea:1,minContainerWidth:500,minContainerHeight:300,preview:".imageCropper-preview"})},e.prototype.onSubmit=function(t){return this.formDisable(t),this.callback(this.image.cropper("getCroppedCanvas").toDataURL(),this.type),this.image.cropper("destroy"),this.close()},e}(App.ControllerModal),t=function(t){function e(){return this.stopStream=i(this.stopStream,this),this.onSubmit=i(this.onSubmit,this),this.onClose=i(this.onClose,this),this.updatePreview=i(this.updatePreview,this),this.setupPreview=i(this.setupPreview,this),this.onWebcamError=i(this.onWebcamError,this),this.onWebcamReady=i(this.onWebcamReady,this),this.shoot=i(this.shoot,this),this.onShootClick=i(this.onShootClick,this),this.post=i(this.post,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Save"),e.prototype.buttonClass="btn--success is-disabled",e.prototype.centerButtons=[{className:"btn--success js-shoot is-disabled",text:__("Shoot")}],e.prototype.head=__("Camera"),e.prototype.elements={".js-shoot":"shootButton",".js-submit":"submitButton",".camera-preview":"preview",".camera":"camera",video:"video"},e.prototype.events={"click .js-shoot:not(.is-disabled)":"onShootClick"},e.prototype.content=function(){return App.view("profile/camera")()},e.prototype.post=function(){return this.size=256,this.photoTaken=!1,this.backgroundColor="white",this.ctx=this.preview.get(0).getContext("2d"),Modernizr.prefixed("getUserMedia",navigator)({video:!0},this.onWebcamReady,this.onWebcamError),this.initializeCache()},e.prototype.onShootClick=function(){return this.photoTaken?(this.photoTaken=!1,this.submitButton.addClass("is-disabled"),this.shootButton.removeClass("btn--danger").addClass("btn--success").text(App.i18n.translateInline("Shoot")),this.updatePreview()):(this.shoot(),this.shootButton.removeClass("btn--success").addClass("btn--danger").text(App.i18n.translateInline("Discard")))},e.prototype.shoot=function(){return this.photoTaken=!0,this.submitButton.removeClass("is-disabled")},e.prototype.onWebcamReady=function(t){if(this.shootButton.removeClass("is-disabled"),!this.hidden){this.stream=t,this.video.on("canplay",this.setupPreview),this.video.on("playing",this.updatePreview);try{this.video.get(0).srcObject=t}catch(e){e,this.video.attr("src",window.URL.createObjectURL(t))}return this.video.get(0).play()}this.stopStream()},e.prototype.onWebcamError=function(t){var e;if(!this.hidden)return e={PermissionDeniedError:App.i18n.translateInline("You have to allow access to your webcam."),ConstraintNotSatisfiedError:App.i18n.translateInline("No camera found.")},alert(e[t.name]),this.close()},e.prototype.setupPreview=function(){return this.video.attr("height",this.size),this.preview.attr({width:this.size,height:this.size}),this.centerX=this.size/2,this.centerY=this.size/2,this.ctx.translate(this.centerX,this.centerY),this.ctx.scale(-1,1),this.ctx.strokeStyle=this.backgroundColor,this.ctx.lineWidth=2},e.prototype.updatePreview=function(){var t;try{return this.ctx.globalCompositeOperation="source-over",this.ctx.clearRect(0,0,this.size,this.size),this.ctx.beginPath(),this.ctx.arc(0,0,this.size/2,0,2*Math.PI,!1),this.ctx.closePath(),this.ctx.fill(),this.ctx.globalCompositeOperation="source-atop",this.ctx.drawImage(this.video.get(0),-this.video.width()/2,-this.size/2,this.video.width(),this.size),this.ctx.beginPath(),this.ctx.arc(0,0,this.size/2,0,2*Math.PI,!1),this.ctx.closePath(),this.ctx.stroke(),this.photoTaken?this.cacheScreenshot():requestAnimationFrame(this.updatePreview)}catch(e){if("NS_ERROR_NOT_AVAILABLE"===(t=e).name)return setTimeout(this.updatePreview,200);throw t}},e.prototype.initializeCache=function(){return this.cache=$("<canvas>"),this.cacheCtx=this.cache.get(0).getContext("2d")},e.prototype.cacheScreenshot=function(){var t;return this.video.attr({height:""}),t=Math.min(this.video.height(),this.video.width()),this.cache.attr({width:t,height:t}),this.cacheCtx.save(),this.cacheCtx.translate(t/2,t/2),this.cacheCtx.scale(-1,1),this.cacheCtx.drawImage(this.video.get(0),-this.video.width()/2,-this.video.height()/2,this.video.width(),this.video.height()),this.cacheCtx.restore(),this.video.attr({height:this.size})},e.prototype.onClose=function(){return this.stopStream(),this.hidden=!0},e.prototype.onSubmit=function(t){return this.formDisable(t),window.file=this.cache.get(0).toDataURL(),this.callback(this.cache.get(0).toDataURL()),this.close()},e.prototype.stopStream=function(){if(this.stream)return this.stream.getTracks&&this.stream.getTracks().forEach((function(t){return t.stop()})),this.stream.stop?this.stream.stop():void 0},e}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.error=e(this.error,this),this.success=e(this.success,this),this.onOptionsChange=e(this.onOptionsChange,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.translationTable={new_open:App.i18n.translatePlain("new & open"),pending:App.i18n.translatePlain("pending"),escalation:App.i18n.translatePlain("escalation")},this.render()}return n(i,t),i.requiredPermission="user_preferences.calendar+ticket.agent",i.prototype.header=__("Calendar"),i.prototype.elements={"input[type=checkbox]":"options",output:"output"},i.prototype.events={"change input[type=checkbox]":"onOptionsChange","click .js-select":"selectAll","click .js-showLink":"showLink"},i.prototype.render=function(){var t;return t=this.Session.get("preferences"),this.preferences=App.Config.get("defaults_calendar_subscriptions_tickets"),t.calendar_subscriptions&&t.calendar_subscriptions.tickets&&_.extend(this.preferences,t.calendar_subscriptions.tickets),this.html(App.view("profile/calendar_subscriptions")({baseurl:window.location.origin,preferences:this.preferences,translationTable:this.translationTable,api_access:App.Config.get("api_password_access")}))},i.prototype.showLink=function(t){return $(t.currentTarget).next().removeClass("is-hidden"),$(t.currentTarget).remove()},i.prototype.onOptionsChange=function(){var t,e,n,i,s,r;for(e in this.setAllPreferencesToFalse(),i=this.options.serializeArray())r=(s=(t=i[e]).name.split("/"))[0],n=s[1],r&&n?this.preferences[r][n]=!0:this.preferences[t.name]=!0;return this.store()},i.prototype.setAllPreferencesToFalse=function(){var t,e;for(e in this.preferences.alarm=!1,t=[],this.preferences)_.isObject(this.preferences)?(this.preferences[e].own=!1,t.push(this.preferences[e].not_assigned=!1)):t.push(void 0);return t},i.prototype.store=function(){var t;return t={calendar_subscriptions:{tickets:this.preferences}},this.ajax({id:"preferences",type:"PUT",url:this.apiPath+"/users/preferences",data:JSON.stringify(t),success:this.success,error:this.error})},i.prototype.success=function(){return App.User.full(App.Session.get("id"),(t=this,function(){return t.notify({type:"success",msg:App.i18n.translateContent("Update successful.")})}),!0);var t},i.prototype.error=function(t){var e;return this.render(),e=JSON.parse(t.responseText),this.notify({type:"error",msg:App.i18n.translateContent(e.message)})},i}(App.ControllerSubContent),App.Config.set("CalendarSubscriptions",{prio:3e3,name:__("Calendar"),parent:"#profile",target:"#profile/calendar_subscriptions",permission:["user_preferences.calendar+ticket.agent"],controller:t},"NavBarProfile")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.error=e(this.error,this),this.delete=e(this.delete,this),this.render=e(this.render,this),this.load=e(this.load,this),i.__super__.constructor.apply(this,arguments),this.load(),this.interval((t=this,function(){return t.load()}),62e3)}return n(i,t),i.requiredPermission="user_preferences.device",i.prototype.header=__("Devices"),i.prototype.events={"click [data-type=delete]":"delete"},i.prototype.load=function(t){return null==t&&(t=!1),this.ajax({id:"user_devices",type:"GET",url:this.apiPath+"/user_devices",success:(e=this,function(n){if(t||!e.lastestUpdated||!n||!n[0]||e.lastestUpdated.updated_at!==n[0].updated_at)return e.lastestUpdated=n[0],e.data=n,e.render()})});var e},i.prototype.render=function(){return this.html(App.view("profile/devices")({devices:this.data||[]}))},i.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest("div").data("device-id"),this.ajax({id:"user_devices_delete",type:"DELETE",url:this.apiPath+"/user_devices/"+e,processData:!0,success:(n=this,function(){return n.load(!0)}),error:this.error})},i.prototype.error=function(t){var e;return e=JSON.parse(t.responseText),this.notify({type:"error",msg:App.i18n.translateContent(e.message)})},i}(App.ControllerSubContent),App.Config.set("Devices",{prio:3100,name:__("Devices"),parent:"#profile",target:"#profile/devices",controller:t,permission:["user_preferences.device"]},"NavBarProfile")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.error=e(this.error,this),this.success=e(this.success,this),this.update=e(this.update,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return n(i,t),i.requiredPermission="user_preferences.language",i.prototype.header=__("Language"),i.prototype.events={"submit form":"update"},i.prototype.render=function(){var t,e,n,i,s,r,o;for(e=$(App.view("profile/language")()),o={},n=0,i=(r=App.Locale.all()).length;n<i;n++)o[(s=r[n]).locale]=s.name;return t=[{name:"locale",display:"",tag:"searchable_select",null:!1,class:"input",options:o,default:App.i18n.get()}],this.form=new App.ControllerForm({el:e.find(".js-language"),model:{configure_attributes:t},autofocus:!1}),this.html(e)},i.prototype.update=function(t){var e,n;return t.preventDefault(),n=this.formParam(t.target),(e=this.form.validate(n))?(this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),this.locale=n.locale,this.ajax({id:"preferences",type:"PUT",url:this.apiPath+"/users/preferences",data:JSON.stringify(n),processData:!0,success:this.success,error:this.error}))},i.prototype.success=function(){return App.User.full(App.Session.get("id"),(t=this,function(){return App.i18n.set(t.locale),App.Event.trigger("ui:rerender"),t.notify({type:"success",msg:App.i18n.translateContent("Update successful.")})}),!0);var t},i.prototype.error=function(t){var e;return this.render(),e=JSON.parse(t.responseText),this.notify({type:"error",msg:App.i18n.translateContent(e.message)})},i}(App.ControllerSubContent),App.Config.set("Language",{prio:1e3,name:__("Language"),parent:"#profile",target:"#profile/language",controller:t,permission:["user_preferences.language"]},"NavBarProfile")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.error=e(this.error,this),this.success=e(this.success,this),this.remove=e(this.remove,this),this.add=e(this.add,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return n(i,t),i.requiredPermission="user_preferences.linked_accounts",i.prototype.header=__("Linked Accounts"),i.prototype.events={"click .js-add":"add","click .js-remove":"remove"},i.prototype.render=function(){var t,e,n,i;for(n in e={},t=App.Config.get("auth_provider_all"))i=t[n],!0!==this.Config.get(i.config)&&"true"!==this.Config.get(i.config)||(e[n]=i);return this.html(App.view("profile/linked_accounts")({user:App.Session.get(),auth_providers:e}))},i.prototype.add=function(t){var e;return t.preventDefault(),e=$(t.target).data("key"),this.el.find(".js-addForm-"+e).submit()},i.prototype.remove=function(t){var e,n;return t.preventDefault(),e=$(t.target).data("provider"),n=$(t.target).data("uid"),this.ajax({id:"account",type:"DELETE",url:this.apiPath+"/users/account",data:JSON.stringify({provider:e,uid:n}),processData:!0,success:this.success,error:this.error})},i.prototype.success=function(){var t,e;return this.notify({type:"success",msg:App.i18n.translateContent("Update successful.")}),e=this,t=function(){return e.render()},App.User.full(this.Session.get("id"),t,!0)},i.prototype.error=function(t){var e;return this.render(),e=JSON.parse(t.responseText),this.notify({type:"error",msg:App.i18n.translateContent(e.message)})},i}(App.ControllerSubContent),App.Config.set("LinkedAccounts",{prio:4e3,name:__("Linked Accounts"),parent:"#profile",target:"#profile/linked",controller:t,permission:["user_preferences.linked_accounts"]},"NavBarProfile"),App.Config.set("auth_provider_all",{facebook:{url:"/auth/facebook",name:__("Facebook"),config:"auth_facebook",class:"facebook"},twitter:{url:"/auth/twitter",name:__("Twitter"),config:"auth_twitter",class:"twitter"},linkedin:{url:"/auth/linkedin",name:__("LinkedIn"),config:"auth_linkedin",class:"linkedin"},github:{url:"/auth/github",name:__("GitHub"),config:"auth_github",class:"github"},gitlab:{url:"/auth/gitlab",name:__("GitLab"),config:"auth_gitlab",class:"gitlab"},microsoft_office365:{url:"/auth/microsoft_office365",name:__("Microsoft"),config:"auth_microsoft_office365",class:"microsoft"},google_oauth2:{url:"/auth/google_oauth2",name:__("Google"),config:"auth_google_oauth2",class:"google"},weibo:{url:"/auth/weibo",name:__("Weibo"),config:"auth_weibo",class:"weibo"},saml:{url:"/auth/saml",name:__("SAML"),config:"auth_saml",class:"saml"},sso:{url:"/auth/sso",name:__("SSO"),config:"auth_sso",class:"sso"}})}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.didChangeGroupIds=e(this.didChangeGroupIds,this),this.didSwitchGroupsLimit=e(this.didSwitchGroupsLimit,this),this.previewSound=e(this.previewSound,this),this.error=e(this.error,this),this.success=e(this.success,this),this.reset=e(this.reset,this),this.update=e(this.update,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),App.User.full(App.Session.get().id,this.render,!0,!0)}return n(i,t),i.include(App.TicketNotificationMatrix),i.requiredPermission="user_preferences.notifications+ticket.agent",i.prototype.header=__("Notifications"),i.prototype.events={"submit form":"update","click .js-reset":"reset","change .js-notificationSound":"previewSound","change #profile-groups-limit":"didSwitchGroupsLimit","change input[name=group_ids]":"didChangeGroupIds"},i.prototype.elements={"#profile-groups-limit":"profileGroupsLimitInput",".profile-groups-limit-settings-inner":"groupsLimitSettings",".profile-groups-all-unchecked":"groupsAllUncheckedWarning"},i.prototype.sounds=[{name:"Bell",file:"Bell.mp3"},{name:"Kalimba",file:"Kalimba.mp3"},{name:"Marimba",file:"Marimba.mp3"},{name:"Peep",file:"Peep.mp3"},{name:"Plop",file:"Plop.mp3"},{name:"Ring",file:"Ring.mp3"},{name:"Space",file:"Space.mp3"},{name:"Wood",file:"Wood.mp3"},{name:"Xylo",file:"Xylo.mp3"}],i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d;if({create:{name:__("New Ticket")},update:{name:__("Ticket update")},reminder_reached:{name:__("Ticket reminder reached")},escalation:{name:__("Ticket escalation")}},t={group_ids:[],matrix:{}},(h=this.Session.get("preferences").notification_config)&&(t=$.extend(!0,{},t,h)),d=!0,h&&h.group_ids&&!_.isEmpty(h.group_ids)&&"-"!==h.group_ids[0]||(d=!1),s=[],i=App.User.find(this.Session.get("id")).allGroupIds())for(r=0,a=i.length;r<a;r++)n=i[r],e=App.Group.find(n),s.push(e),d||(t.group_ids||(t.group_ids=[]),t.group_ids.push(n.toString()));for(s=_.sortBy(s,(function(t){return t.name})),o=0,l=(c=this.sounds).length;o<l;o++)(p=c[o]).selected=null!=(u=p.file===App.OnlineNotification.soundFile())?u:{true:!1};return this.html(App.view("profile/notification")({matrixTableHTML:this.renderNotificationMatrix(t.matrix),groups:s,config:t,sounds:this.sounds,notificationSoundEnabled:App.OnlineNotification.soundEnabled(),user_group_config:d}))},i.prototype.update=function(t){var e,n;return t.preventDefault(),(n={}).notification_config={},e=this.formParam(t.target),n.notification_config.matrix=this.updatedNotificationMatrixValues(e),this.profileGroupsLimitInput.is(":checked")&&(n.notification_config.group_ids=e.group_ids,"object"!=typeof n.notification_config.group_ids&&(n.notification_config.group_ids=[n.notification_config.group_ids]),_.isEmpty(n.notification_config.group_ids)&&delete n.notification_config.group_ids),this.formDisable(t),n.notification_sound=e.notification_sound,n.notification_sound.enabled?n.notification_sound.enabled=!0:n.notification_sound.enabled=!1,this.ajax({id:"preferences",type:"PUT",url:this.apiPath+"/users/preferences",data:JSON.stringify(n),processData:!0,success:this.success,error:this.error})},i.prototype.reset=function(){return new App.ControllerConfirm({message:__("Are you sure? Your notifications settings will be reset to default."),buttonClass:"btn--danger",callback:(t=this,function(){return t.ajax({id:"preferences_notifications_reset",type:"POST",url:t.apiPath+"/users/preferences_notifications_reset",processData:!0,success:t.success})}),container:this.el.closest(".content")});var t},i.prototype.success=function(){return App.User.full(App.Session.get("id"),(t=this,function(){return App.Event.trigger("ui:rerender"),t.notify({type:"success",msg:App.i18n.translateContent("Update successful.")})}),!0);var t},i.prototype.error=function(t){var e;return this.render(),e=JSON.parse(t.responseText),this.notify({type:"error",msg:App.i18n.translateContent(e.message)})},i.prototype.previewSound=function(t){var e;if((e=this.formParam(t.target)).notification_sound&&e.notification_sound.file)return App.OnlineNotification.play(e.notification_sound.file)},i.prototype.didSwitchGroupsLimit=function(){return this.groupsLimitSettings.collapse("toggle")},i.prototype.didChangeGroupIds=function(){return this.groupsAllUncheckedWarning.toggleClass("hide",0!==this.el.find("input[name=group_ids]:checked").length)},i}(App.ControllerSubContent),App.Config.set("Notifications",{prio:2600,name:__("Notifications"),parent:"#profile",target:"#profile/notifications",permission:["user_preferences.notifications+ticket.agent"],controller:t},"NavBarProfile")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.error=e(this.error,this),this.success=e(this.success,this),this.store=e(this.store,this),this.submit=e(this.submit,this),this.disable=e(this.disable,this),this.enable=e(this.enable,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return n(i,t),i.requiredPermission="user_preferences.out_of_office+ticket.agent",i.prototype.header=__("Out of Office"),i.prototype.events={"submit form":"submit","click .js-disabled":"disable","click .js-enable":"enable"},
i.prototype.render=function(){var t,e,n,i,s;return s=this.Session.get(),this.localData||(this.localData={out_of_office:s.out_of_office,out_of_office_start_at:s.out_of_office_start_at,out_of_office_end_at:s.out_of_office_end_at,out_of_office_replacement_id:s.out_of_office_replacement_id,out_of_office_replacement_id_completion:s.preferences.out_of_office_replacement_id_completion,out_of_office_text:s.preferences.out_of_office_text}),i=$(App.view("profile/out_of_office")({user:s,localData:this.localData,placeholder:App.User.outOfOfficeTextPlaceholder()})),n=new App.ControllerForm({model:{configure_attributes:[{name:"out_of_office_start_at",display:"",tag:"date",past:!1,future:!0,null:!1}]},noFieldset:!0,params:this.localData}),i.find(".js-startDate").html(n.form),e=new App.ControllerForm({model:{configure_attributes:[{name:"out_of_office_end_at",display:"",tag:"date",past:!1,future:!0,null:!1}]},noFieldset:!0,params:this.localData}),i.find(".js-endDate").html(e.form),t=new App.ControllerForm({model:{configure_attributes:[{name:"out_of_office_replacement_id",display:"",relation:"User",tag:"user_autocompletion",autocapitalize:!1,multiple:!1,limit:30,minLengt:2,placeholder:__("Enter Person or Organization/Company"),null:!1,translate:!1,disableCreateObject:!0,value:this.localData,source:this.apiPath+"/users/search?full=true",sourceType:"POST",queryCallback:function(t){return JSON.stringify({query:t,permissions:["ticket.agent"]})}}]},noFieldset:!0,params:this.localData}),i.find(".js-recipientDropdown").html(t.form),!0===this.localData.out_of_office?i.find(".js-disabled").removeClass("is-disabled"):i.find(".js-disabled").addClass("is-disabled"),this.html(i)},i.prototype.enable=function(t){var e;return t.preventDefault(),(e=this.formParam(t.target)).out_of_office=!0,this.store(t,e)},i.prototype.disable=function(t){var e;return t.preventDefault(),(e=this.formParam(t.target)).out_of_office=!1,this.store(t,e)},i.prototype.submit=function(t,e){return t.preventDefault(),e=this.formParam(t.target),this.store(t,e)},i.prototype.store=function(t,e){var n,i;for(n in this.formDisable(t),e)i=e[n],this.localData[n]=i;return App.Ajax.request({id:"user_out_of_office",type:"PUT",url:this.apiPath+"/users/out_of_office",data:JSON.stringify(e),processData:!0,success:this.success,error:this.error})},i.prototype.success=function(t){return"ok"===t.message?(this.render(),this.notify({type:"success",msg:App.i18n.translateContent("Update successful."),timeout:1e3})):(t.notice?this.notify({type:"error",msg:App.i18n.translateContent(t.notice[0],t.notice[1]),removeAll:!0}):this.notify({type:"error",msg:__("Please contact your administrator."),removeAll:!0}),this.formEnable(this.$("form")))},i.prototype.error=function(t,e,n){var i,s;if(this.formEnable(this.$("form")),"abort"!==e)return i=JSON.parse(t.responseText),s=403===t.status||"Not authorized"===n?"\xbb "+App.i18n.translateInline("Not authorized")+" \xab":404===t.status||"Not Found"===n?"\xbb "+App.i18n.translateInline("Not Found")+" \xab":i.error?App.i18n.translateInline(i.error):"\xbb "+App.i18n.translateInline("Error")+" \xab",this.notify({type:"error",msg:App.i18n.translateContent(s),removeAll:!0})},i}(App.ControllerSubContent),App.Config.set("OutOfOffice",{prio:2800,name:__("Out of Office"),parent:"#profile",target:"#profile/out_of_office",permission:["user_preferences.out_of_office+ticket.agent"],controller:t},"NavBarProfile")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;e=function(e){function s(){this.fetch=n(this.fetch,this),s.__super__.constructor.apply(this,arguments),this.fetch()}return i(s,e),s.requiredPermission="user_preferences.overview_sorting",s.prototype.header=__("Order of Overviews"),s.prototype.fetch=function(){return this.ajax({type:"GET",url:App.Config.get("api_path")+"/user_overview_sortings",processData:!0,success:(t=this,function(e){return App.UserOverviewSortingOverview.refresh(e.overviews),App.UserOverviewSorting.refresh(e.overview_sortings),t.render(e)})});var t},s.prototype.render=function(){var e;return this.index||(this.index=new t({disableInitFetch:!0,el:this.el,id:this.id,genericObject:"UserOverviewSortingOverview",defaultSortBy:"prio",pageData:{home:"overviews",object:__("Order of Overviews"),objects:__("Order of Overviews"),navupdate:"#profile/overviews",subHead:!1,buttons:[{name:__("Reset overview order"),"data-type":"reset",class:"btn--danger"}]},container:this.el.closest(".content"),veryLarge:!0,dndCallback:(e=this,function(t,n){var i,s,r,o,a,l;for(l=[],a=0,i=0,o=(r=e.el.find("table > tbody > tr")).length;i<o;i++)n=r[i],a+=1,s=$(n).data("id"),l.push([s,a]);return e.ajax({id:"user_overview_sortings_prio",type:"POST",url:e.apiPath+"/user_overview_sortings_prio",processData:!0,data:JSON.stringify({prios:l}),success:e.fetch})})})),this.index.render()},s}(App.ControllerSubContent),t=function(t){function e(){return this.reset=n(this.reset,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.events={"click [data-type=reset]":"reset"},e.prototype.render=function(){var t;return t=App[this.genericObject].all(),this.renderObjects(t)},e.prototype.edit=function(){},e.prototype.reset=function(t){return t.preventDefault(),App.UserOverviewSorting.destroyAll(),this.notify({type:"success",msg:__("Personal overview order was reset.")}),this.render()},e}(App.ControllerGenericIndex),App.Config.set("Overviews",{prio:2900,name:__("Overviews"),parent:"#profile",target:"#profile/overviews",controller:e,permission:["user_preferences.overview_sorting"]},"NavBarProfile")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.twoFactorMethodGenerateRecoveryCodes=e(this.twoFactorMethodGenerateRecoveryCodes,this),this.twoFactorMethodDefault=e(this.twoFactorMethodDefault,this),this.error=e(this.error,this),this.success=e(this.success,this),this.update=e(this.update,this),this.render=e(this.render,this),this.load=e(this.load,this),this.preRender=e(this.preRender,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("config_update",(t=this,function(e){if(/^two_factor_authentication_method_/.test(e.name))return t.preRender()})),this.preRender()}return n(i,t),i.requiredPermission="user_preferences.password",i.prototype.header=__("Password & Authentication"),i.prototype.events={"submit form":"update","click .js-generate-recovery-codes":"twoFactorMethodGenerateRecoveryCodes",'click [data-type="setup"]':"twoFactorMethodSetup",'click [data-type="edit"]':"twoFactorMethodSetup",'click [data-type="remove"]':"twoFactorMethodRemove",'click [data-type="default"]':"twoFactorMethodDefault"},i.prototype.preRender=function(){var t;if(this.allowsTwoFactor())return this.load(),this.listenTo(App.User.current(),"two_factor_changed",(t=this,function(){return t.load()}));this.render()},i.prototype.load=function(){return this.startLoading(),this.ajax({id:"profile_two_factor",type:"GET",url:this.apiPath+"/users/two_factor_personal_configuration",processData:!0,success:(t=this,function(e){return t.stopLoading(),t.render(e)}),error:function(t){return function(){return t.stopLoading()}}(this)});var t},i.prototype.allowsChangePassword=function(){return App.Config.get("user_show_password_login")||this.permissionCheck("admin.*")},i.prototype.allowsTwoFactor=function(){return _.some(App.Config.all(),(function(t,e){return/^two_factor_authentication_method_/.test(e)&&t}))},i.prototype.render=function(t){var e,n;return null==t&&(t={}),n=$(App.view("profile/password")({allowsChangePassword:this.allowsChangePassword(),allowsTwoFactor:this.allowsTwoFactor(),hasConfiguredTwoFactor:_.any(t.enabled_authentication_methods,(function(t){return t.configured})),twoFactorMethods:this.transformTwoFactorMethods(t.enabled_authentication_methods),recoveryCodesEnabled:App.Config.get("two_factor_authentication_recovery_codes"),recoveryCodesExist:t.recovery_codes_exist})),e=[{name:"password_old",display:__("Current password"),tag:"input",type:"password",limit:100,null:!1,class:"input",single:!0},{name:"password_new",display:__("New password"),tag:"input",type:"password",limit:100,null:!1,class:"input"}],this.form=new App.ControllerForm({el:n.find(".password_item"),model:{configure_attributes:e},autofocus:!1}),this.html(n)},i.prototype.update=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),this.formDisable(t),e.password_new_confirm!==e.password_new?(this.formEnable(t),this.$("[name=password_new]").val(""),this.$("[name=password_new_confirm]").val(""),void this.notify({type:"error",msg:__("Can't update password, your entered passwords do not match. Please try again!"),removeAll:!0})):e.password_new?this.ajax({id:"password_reset",type:"POST",url:this.apiPath+"/users/password_change",data:JSON.stringify(e),processData:!0,success:this.success,error:this.error}):(this.formEnable(t),void this.notify({type:"error",msg:__("Please supply your new password!"),removeAll:!0}))},i.prototype.success=function(){return this.render(),this.notify({type:"success",msg:App.i18n.translateContent("Password changed successfully!")})},i.prototype.error=function(t){var e,n;if(422===t.status)return n=(e=t.responseJSON).notice?App.i18n.translateContent(e.notice[0],e.notice[1]):__("The password could not be set. Please contact your administrator."),this.notify({type:"error",msg:n,removeAll:!0}),this.formEnable(this.$("form"))},i.prototype.transformTwoFactorMethods=function(t){var e,n,i;if(_.isEmpty(t))return[];for(n=0,i=t.length;n<i;n++)(e=t[n]).details=App.TwoFactorMethods.methodByKey(e.method)||{},e.configured?(e.active_icon_class="checkmark",e.active_icon_parent_class="is-done"):e.active_icon_class="small-dot";return _.sortBy(t,(function(t){return t.details.order}))},i.prototype.twoFactorMethodSetup=function(t){var e,n;return t.preventDefault(),e=t.currentTarget.closest("[data-two-factor-key]").dataset.twoFactorKey,n=App.TwoFactorMethods.methodByKey(e),new App["TwoFactorConfigurationMethod"+n.identifier]({container:this.el.closest(".content"),successCallback:this.load})},i.prototype.twoFactorMethodRemove=function(t){var e,n;return t.preventDefault(),e=t.currentTarget.closest("tr").dataset.twoFactorKey,App.TwoFactorMethods.methodByKey(e),new App.TwoFactorConfigurationModalPasswordCheck({headPrefix:__("Remove two-factor authentication"),buttonSubmit:"Remove",successCallback:(n=this,function(){return n.ajax({id:"profile_two_factor_removal",type:"DELETE",url:n.apiPath+"/users/"+App.User.current().id+"/two_factor_remove_authentication_method",processData:!0,data:JSON.stringify({method:e}),success:function(){return n.notify({type:"success",msg:App.i18n.translateContent("Two-factor authentication method was removed."),removeAll:!0}),n.load()},error:function(t){var e,i;return i=(null!=(e=JSON.parse(t.responseText))?e.error:void 0)||__("Could not remove two-factor authentication method"),n.notify({type:"error",msg:App.i18n.translateContent(i),removeAll:!0})}})})})},i.prototype.twoFactorMethodDefault=function(t){return t.preventDefault(),this.ajax({id:"profile_two_factor_default_authentication_method",type:"POST",url:this.apiPath+"/users/two_factor_default_authentication_method",processData:!0,data:JSON.stringify({method:t.currentTarget.closest("tr").dataset.twoFactorKey}),success:(e=this,function(){return e.notify({type:"success",msg:App.i18n.translateContent("Two-factor authentication method was set as default."),removeAll:!0}),e.load()}),error:function(t){return function(e){var n,i;return i=(null!=(n=JSON.parse(e.responseText))?n.error:void 0)||__("Could not set two-factor authentication method as default"),t.notify({type:"error",msg:App.i18n.translateContent(i),removeAll:!0})}}(this)});var e},i.prototype.twoFactorMethodGenerateRecoveryCodes=function(t){return t.preventDefault(),new App.TwoFactorConfigurationMethodRecoveryCodes({container:this.el.closest(".content"),overrideHeadPrefix:__("Generate recovery codes"),successCallback:this.load})},i}(App.ControllerSubContent),App.Config.set("Password",{prio:2e3,name:__("Password & Authentication"),parent:"#profile",target:"#profile/password",controller:t,permission:function(t){var e,n;return e=App.Config.get("user_show_password_login")||t.permissionCheck("admin.*"),n=App.Config.get("two_factor_authentication_method_authenticator_app"),!(!e&&!n)&&t.permissionCheck("user_preferences.password")}},"NavBarProfile")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;e=function(e){function s(){var t;this.error=n(this.error,this),this.delete=n(this.delete,this),this.create=n(this.create,this),this.render=n(this.render,this),this.load=n(this.load,this),s.__super__.constructor.apply(this,arguments),this.load(),this.interval((t=this,function(){return t.load()}),62e3)}return i(s,e),s.requiredPermission="user_preferences.access_token",s.prototype.header=__("Token Access"),s.prototype.events={"click .js-delete":"delete","click .js-create":"create"},s.prototype.load=function(t){return null==t&&(t=!1),this.ajax({id:"user_access_token",type:"GET",url:this.apiPath+"/user_access_token",success:(e=this,function(n){var i;if(i=n.tokens,t||!e.lastestUpdated||!i||!i[0]||e.lastestUpdated.updated_at!==i[0].updated_at)return e.lastestUpdated=i[0],e.tokens=n.tokens,e.permissions=n.permissions,e.render()})});var e},s.prototype.render=function(){return this.html(App.view("profile/token_access")({tokens:this.tokens}))},s.prototype.create=function(e){return e.preventDefault(),new t({container:this.el.closest(".content"),permissions:this.permissions,load:this.load})},s.prototype.delete=function(t){var e,n,i;return t.preventDefault(),n=$(t.currentTarget).data("token-id"),i=this,e=function(){return i.ajax({id:"user_access_token_delete",type:"DELETE",url:i.apiPath+"/user_access_token/"+n,processData:!0,success:function(){return i.load(!0)},error:i.error})},new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:e,container:this.el.closest(".content")})},s.prototype.error=function(t){var e;return e=JSON.parse(t.responseText),this.notify({type:"error",msg:App.i18n.translateContent(e.message||e.error)})},s}(App.ControllerSubContent),t=function(t){function e(){return this.error=n(this.error,this),this.onClosed=n(this.onClosed,this),this.show=n(this.show,this),this.onSubmit=n(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.head=__("Add a Personal Access Token"),e.prototype.buttonSubmit=__("Create"),e.prototype.buttonCancel=!0,e.prototype.shown=!0,e.prototype.content=function(){var t,e;return t=$(App.view("profile/token_access_create")({permissions:this.permissions})),(e=App.UiElement.date.render({name:"expires_at"})).find(".js-datepicker").attr("id","token-expires-at"),t.find(".js-date").html(e),t},e.prototype.onSubmit=function(t){var e;if(t.preventDefault(),e=this.formParam(t.target),!_.isEmpty(e.permission))return _.isArray(e.permission)||(e.permission=[e.permission]),this.ajax({id:"user_access_token_create",type:"POST",url:this.apiPath+"/user_access_token",data:JSON.stringify(e),processData:!0,success:this.show,error:this.error});this.notify({type:"error",msg:App.i18n.translateContent("The required parameter 'permission' is missing.")})},e.prototype.show=function(t){return this.load(),this.newToken=t,this.close()},e.prototype.onClosed=function(){var t;if(this.newToken)return t=this,new App.ControllerModal({head:__("Your New Personal Access Token"),buttonSubmit:__("OK, I've copied my token"),content:function(){return App.view("profile/token_access_created")({token:t.newToken.token})},onShown:function(){return this.$(".js-select").on("click",t.selectAll)},onCancel:function(){return this.close()},onSubmit:function(){return this.close()},container:this.container})},e.prototype.error=function(t){var e;return e=JSON.parse(t.responseText),this.notify({type:"error",msg:App.i18n.translateContent(e.message||e.error)})},e}(App.ControllerModal),App.Config.set("Token Access",{prio:3200,name:__("Token Access"),parent:"#profile",target:"#profile/token_access",controller:e,permission:function(t){return!!App.Config.get("api_token_access")&&t.permissionCheck("user_preferences.access_token")}},"NavBarProfile")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsArea=function(n){function i(){this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),App.Setting.fetchFull(this.render,{force:!1})}return e(i,n),i.prototype.render=function(){var t,e,n,i,s,r,o;if(r=App.Setting.search({filter:{area:this.area}}),!App.Config.get("system_online_service")||(r=_.filter(r,(function(t){if(!(t.online_service||t.preferences&&t.preferences.online_service_disable))return t})),!_.isEmpty(r))){for(r=_.filter(r,(function(t){if(!t.preferences||!t.preferences.disabled)return t})),r=_.sortBy(r,(function(t){if(t.preferences)return t.preferences.prio})),t=[],this.subtitle&&((o=$("<h2/>")).append(App.i18n.translateContent(this.subtitle)),t.push(o)),e=0,i=r.length;e<i;e++)!0!==(s=r[e]).preferences.hidden&&(n=s.preferences.controller&&App[s.preferences.controller]?new App[s.preferences.controller]({setting:s}):new App.SettingsAreaItem({setting:s}),t.push(n.el));return this.html(t)}},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsAreaItem=function(n){function i(){this.update=t(this.update,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.template="settings/item",i.prototype.events={"submit form":"update"},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p;if(!this.setting.options)throw"No such options for "+this.setting.name;if(!this.setting.options.form)throw"No such options.form for "+this.setting.name;for(e=0,n=0,o=(c=this.setting.options.form).length;n<o;n++)i=c[n],e+=1;if(e>1)for(s=0,a=(u=this.setting.options.form).length;s<a;s++)(i=u[s]).default=this.setting.state_current.value[i.name];else i.default=this.setting.state_current.value;for(this.configure_attributes=this.setting.options.form,r=0,l=(p=this.configure_attributes).length;r<l;r++)"boolean"===(t=p[r]).tag&&(t.translate=!0);return this.html(App.view(this.template)({setting:this.setting})),new App.ControllerForm({el:this.el.find(".form-item"),model:{configure_attributes:this.configure_attributes,className:""},autofocus:!1})},i.prototype.update=function(t){var e,n,i,s,r,o,a,l;for(t.preventDefault(),this.formDisable(t),r=this.formParam(t.target),n=0,e=void 0,i=0,s=(o=this.setting.options.form).length;i<s;i++)n+=1,e=r[o[i].name];return a=void 0,a=n>1?r:e,App.Setting.set(this.setting.name,a,{doneLocal:(l=this,function(){return l.formEnable(t)}),failLocal:function(e){return function(){return e.formEnable(t)}}(this)})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsAreaItemDefaultLocale=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.render=function(){var t,e,n,i,s,r;for(r={},e=0,n=(s=App.Locale.all()).length;e<n;e++)r[(i=s[e]).locale]=i.name;return t=[{name:"locale_default",display:"",tag:"searchable_select",null:!1,class:"input",options:r,default:this.setting.state_current.value}],this.html(App.view(this.template)({setting:this.setting})),new App.ControllerForm({el:this.el.find(".form-item"),model:{configure_attributes:t,className:""},autofocus:!1})},i}(App.SettingsAreaItem)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsAreaItemDefaultTimezone=function(n){function i(){return this.fetchTimezones=t(this.fetchTimezones,this),this.localRender=t(this.localRender,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.result={},i.prototype.render=function(){return this.fetchTimezones()},i.prototype.localRender=function(t){var e,n,i,s,r;for(r in i={},s=t.timezones)(n=s[r]).toString().match(/(\+|\-)/)||(n="+"+n),i[r]=r+" (GMT"+n+")";return e=[{name:"timezone_default",display:"",tag:"searchable_select",null:!1,class:"input",options:i,default:this.setting.state_current.value}],this.html(App.view(this.template)({setting:this.setting})),new App.ControllerForm({el:this.el.find(".form-item"),model:{configure_attributes:e,className:""},autofocus:!1})},i.prototype.fetchTimezones=function(){return this.ajax({id:"calendar_timezones",type:"GET",url:this.apiPath+"/calendars/timezones",success:(t=this,function(e){return t.result=e,t.localRender(e)})});var t},i}(App.SettingsAreaItem)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsAreaLogo=function(n){function i(){this.submit=t(this.submit,this),this.onLogoPick=t(this.onLogoPick,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.elements={".logo-preview":"logoPreview"},i.prototype.events={"submit form":"submit","change .js-upload":"onLogoPick"},i.prototype.render=function(){var t;return(t=$(App.view("settings/logo")({setting:this.setting}))).find(".js-loginPreview").html(App.view("generic/login_preview")({logoUrl:this.logoUrl(),logoChange:!0,maintananceChange:!1})),this.html(t)},i.prototype.onLogoPick=function(t){var e,n,i,s;if((i=new FileReader).onload=(s=this,function(t){return s.logoPreview.attr("src",t.target.result)}),e=t.target.files[0])return n=8,e.size&&e.size>1048576*n?(App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent("File too big, max. %s MB allowed.",n),timeout:2e3}),void this.logoPreview.attr("src","")):i.readAsDataURL(e)},i.prototype.submit=function(t){var e,n;return t.preventDefault(),this.formDisable(t),this.params=this.formParam(t.target),this.params.logo=this.logoPreview.attr("src"),n=this,e=function(e){return n.params.logo_resize=e,n.ajax({id:"setting_image_"+n.setting.id,type:"PUT",url:n.apiPath+"/settings/image/"+n.setting.id,data:JSON.stringify(n.params),processData:!0,success:function(e){var i,s,r,o,a,l;if(n.formEnable(t),"ok"===e.result){for(App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent("Update successful."),timeout:2e3}),o=[],i=0,s=(r=e.settings).length;i<s;i++)a=r[i],l=App.Setting.get(a.name),o.push(App.Config.set(name,l));return o}return App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent(e.message),timeout:2e3})},fail:function(){return n.formEnable(t)}})},App.ImageService.resizeForApp(this.params.logo,this.logoPreview.width(),this.logoPreview.height(),e)},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsAreaProxy=function(n){function i(){this.testConnection=t(this.testConnection,this),this.update=t(this.update,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.events={"submit form":"update","click .js-submit":"update","click .js-test":"testConnection"},i.prototype.render=function(){return this.html(App.view("settings/proxy")({setting:App.Setting.findByAttribute("name","proxy"),proxy:App.Setting.get("proxy"),proxy_username:App.Setting.get("proxy_username"),proxy_password:App.Setting.get("proxy_password"),proxy_no:App.Setting.get("proxy_no")}))},i.prototype.update=function(t){var e;return t.preventDefault(),this.formDisable(t),e=this.formParam(t),App.Setting.set("proxy",e.proxy),App.Setting.set("proxy_username",e.proxy_username),App.Setting.set("proxy_password",e.proxy_password),App.Setting.set("proxy_no",e.proxy_no),this.formEnable(t),this.render()},i.prototype.testConnection=function(t){var e,n;return t.preventDefault(),e=this.formParam(t),this.ajax({id:"proxy_test",type:"POST",url:this.apiPath+"/proxy",data:JSON.stringify(e),processData:!0,success:(n=this,function(t){return"success"===t.result?(n.$(".js-test").addClass("hide"),n.$(".js-submit").removeClass("hide"),void App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent("Connection test successful"),timeout:2e3})):new App.ControllerConfirm({head:__("Error"),message:t.message,buttonClass:"btn--success",buttonCancel:!1,buttonSubmit:__("Close"),container:n.el.closest(".content")})})})},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.SettingsAreaStorageProvider=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.template="settings/storage_provider",n}(App.SettingsAreaItem)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsAreaSwitch=function(n){function i(){this.update=t(this.update,this),this.toggleSetting=t(this.toggleSetting,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.events={"change .js-setting input":"toggleSetting","submit form":"update"},i.prototype.elements={".js-setting input":"uiSetting"},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m;for(t=0,e=0,o=(p=this.setting.options.form).length;e<o;e++)n=p[e],t+=1;if(t>1)for(i=0,a=(h=this.setting.options.form).length;i<a;i++)(n=h[i]).default=this.setting.state_current.value[n.name];else n.default=this.setting.state_current.value;for(this.configure_attributes=this.setting.options.form,this.subSetting=[],s=0,l=(d=this.setting.preferences.sub).length;s<l;s++)u=d[s],this.subSetting.push(App.Setting.findByAttribute("name",u));for(this.html(App.view("settings/switch")({checked:App.Setting.get(this.setting.name),setting:this.setting,subSetting:this.subSetting})),m=[],r=0,c=(f=this.subSetting).length;r<c;r++)u=f[r],m.push(new App.ControllerForm({el:this.$(".form-item"),params:u.state_current.value,model:{configure_attributes:u.options.form,className:""},autofocus:!1}));return m},i.prototype.toggleSetting=function(){var t;return t=this.uiSetting.prop("checked"),App.Setting.set(this.setting.name,t)},i.prototype.update=function(t){var e,n,i,s,r,o,a,l,c,u;for(t.preventDefault(),this.formDisable(t),o=this.formParam(t.target),r=$(t.currentTarget).data("name"),n=0,e=void 0,i=0,s=(a=(l=App.Setting.findByAttribute("name",r)).options.form).length;i<s;i++)n+=1,e=o[a[i].name];return c=n>1?{value:o}:{value:e},l.state_current=c,u=this,l.save({done:function(){return u.formEnable(t),App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent("Update successful."),timeout:2e3}),App.Setting.preferencesPost(l)},fail:function(e,n){return u.formEnable(t),App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("The object could not be updated.")),timeout:3e3})}})},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.SettingsAreaTicketHookPosition=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.template="settings/ticket_hook_position",n}(App.SettingsAreaItem)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsAreaTicketNumber=function(n){function i(){this.update=t(this.update,this),this.paramsPreferences=t(this.paramsPreferences,this),this.showPreferences=t(this.showPreferences,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.events={"submit form":"update"},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,_,w;for(t=0,i=0,l=(f=this.setting.options.form).length;i<l;i++)s=f[i],t+=1;if(t>1)for(r=0,c=(m=this.setting.options.form).length;r<c;r++)(s=m[r]).default=this.setting.state_current.value[s.name];else s.default=this.setting.state_current.value;for(this.map={"Ticket::Number::Increment":"ticket_number_increment","Ticket::Number::Date":"ticket_number_date"},this.configure_attributes=this.setting.options.form,this.html(App.view("settings/ticket_number")({setting:this.setting})),w=this,y=function(t,e,n){if(w.attributes=n,"ticket_number"===e.name)return w.showPreferences(t.ticket_number)},b=function(t){return function(){var e,n,i,s,r,o,a,l,c,u,p;if(u=t.formParam(t.$(".js-form")),l=App.Config.get("ticket_hook")+"???","Ticket::Number::Increment"===u.ticket_number){if(c=t.paramsPreferences("Ticket::Number::Increment"),l=""+App.Config.get("ticket_hook")+App.Config.get("system_id"),e="1",c.min_size&&(a=parseInt(c.min_size)-(""+App.Config.get("system_id")).length,c.checksum&&(a-=1),a>1))for(o=2,p=a;2<=p?o<=p:o>=p;2<=p?++o:--o)e="0"+e;l+=e,c.checksum&&(l+="9")}else"Ticket::Number::Date"===u.ticket_number&&(c=t.paramsPreferences("Ticket::Number::Date"),i=(n=new Date).getDate(),s=n.getMonth()+1,r=n.getFullYear(),l=""+App.Config.get("ticket_hook")+r+s+i+App.Config.get("system_id")+"001",c.checksum&&(l+="9"));return t.$(".js-preview").text(l)}}(this),new App.ControllerForm({el:this.el.find(".js-form"),model:{configure_attributes:this.configure_attributes,className:""},autofocus:!1,handlers:[y,b]}),o=0,u=(d=this.setting.preferences.settings_included||["ticket_number_increment","ticket_number_date"]).length;o<u;o++){for(h=d[o],v=App.Setting.findByAttribute("name",h),_=App.Setting.get(h),e=$(App.view("settings/"+h)({setting:v})),a=0,p=(g=v.options.form).length;a<p;a++)"boolean"===(n=g[a]).tag&&(n.translate=!0);new App.ControllerForm({el:e.find(".js-formItem"),model:{configure_attributes:v.options.form,className:""},autofocus:!1,params:_,handlers:[b]}),this.$(".js-formPreferences").append(e)}return this.showPreferences(s.default)},i.prototype.showPreferences=function(t){return this.$(".js-formPreferencesItem").addClass("hidden"),this.$('.js-formPreferencesItem[data-backend="'+t+'"]').removeClass("hidden")},i.prototype.paramsPreferences=function(t){return this.formParam(this.$('.js-formPreferencesItem[data-backend="'+t+'"] form'))},i.prototype.update=function(t){var e,n,i,s,r;return t.preventDefault(),this.formDisable(this.$(".js-form")),(e=this.formParam(this.$(".js-form"))).ticket_number&&(n=this.paramsPreferences(e.ticket_number),(i=this.map[e.ticket_number])&&n&&App.Setting.set(i,n)),this.setting.state_current={value:e.ticket_number},s=this,this.setting.save({done:(r=this,function(){return s.formEnable(t),App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent("Update successful."),timeout:2e3}),
App.Setting.preferencesPost(r.setting)}),fail:function(e,n){return s.formEnable(t),App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("The object could not be updated.")),timeout:2e3})}})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SettingsForm=function(n){function i(){this.update=t(this.update,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),App.Setting.fetchFull(this.render,{force:!1})}return e(i,n),i.prototype.events={"submit form":"update"},i.prototype.render=function(){var t,e,n,i,s,r,o,a;if(o=App.Setting.search({filter:{area:this.area}}),!App.Config.get("system_online_service")||(o=_.filter(o,(function(t){if(!(t.online_service||t.preferences&&t.preferences.online_service_disable))return t})),!_.isEmpty(o))){for(o=_.filter(o,(function(t){if(!t.preferences||!t.preferences.disabled)return t})),o=_.sortBy(o,(function(t){if(t.preferences)return t.preferences.prio})),i=$(App.view("settings/form")({settings:o})),e=0,n=o.length;e<n;e++)t=(r=o[e]).options.form,a=App.Setting.get(r.name),(s={})[r.name]=a,new App.ControllerForm({el:i.find("[data-name="+r.name+"]"),model:{configure_attributes:t},params:s});return this.html(i)}},i.prototype.update=function(t){var e,n,i,s,r,o;for(n in t.preventDefault(),this.formDisable(t),i=this.formParam(t.target),r=this,e=0,s=[],i)o=i[n],App.Setting.findByAttribute("name",n)?(e+=1,s.push(App.Setting.set(n,o,{done:function(){return r.formEnable(t),0===(e-=1)&&App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent("Update successful."),timeout:2e3}),App.Setting.preferencesPost(this)},fail:function(t,e){return App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent(e.error_human||e.error||__("The object could not be updated.")),timeout:2e3})}}))):s.push(void 0);return s},i}(App.Controller)}.call(this),function(){App.UiElement.ApplicationUiElement=function(){function t(){}return t.sortOptions=function(t){var e,n,i,s,r,o,a,l;if(null!==t.sortBy&&!_.isEmpty(t.options)){if(!_.isArray(t.options)){for(e in s=[],r={},a=t.options)l=a[e].toString().toLowerCase(),s.push(l),r[l]=e;for(s=s.sort(),t.order&&"DESC"===t.order&&(s=s.reverse()),o=[],n=0,i=s.length;n<i;n++)e=s[n],o.push(r[e]);return t.options=o}t.order&&"DESC"===t.order&&(t.options=t.options.reverse())}},t.addNullOption=function(t){if(t.options&&t.nulloption)return _.isArray(t.options)?t.options.unshift({name:"-",value:""}):t.options[""]="-"},t.getConfigOptionListArray=function(t,e){var n,i,s,r;for(s=[],n=0,i=e.length;n<i;n++)r=e[n],t.translate&&(r.name=App.i18n.translatePlain(r.name),_.isEmpty(r.children)||(r.children=this.getConfigOptionListArray(t,r.children))),s.push(r);return s},t.getConfigOptionList=function(t,e){var n,i,s,r,o,a,l;if(null==e&&(e=!1),!_.isEmpty(t.options)){if(l=t.options,t.options=[],_.isArray(l))t.options=this.getConfigOptionListArray(t,l);else for(n=function(t){return l[t]&&l[t].toString?l[t].toString():""},i=0,r=(a=_.keys(l).sort((function(t,e){return n(t).localeCompare(n(e))}))).length;i<r;i++)s=a[i],o=l[s],t.translate&&(o=App.i18n.translatePlain(o)),t.options.push({name:o,value:s});return t.sortBy=null}},t.getConfigCustomSortOptionList=function(t){var e,n,i,s,r,o;if(!t.customsort||"on"!==t.customsort)return this.getConfigOptionList(t);if(!_.isEmpty(t.options)){if(o=t.options,t.options=[],_.isArray(o))t.options=this.getConfigOptionListArray(t,o);else for(e=0,s=(i=_.keys(o)).length;e<s;e++)r=o[n=i[e]],t.translate&&(r=App.i18n.translatePlain(r)),t.options.push({name:r,value:n});return t.sortBy=null}},t.getRelationOptionList=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m,g;if(!_.isEmpty(t.relation)&&App[t.relation]){if(t.options=[],h=[],t.filter)if(App.Log.debug("ControllerForm","_getRelationOptionList:filter",t.filter),"function"==typeof t.filter)App.Log.debug("ControllerForm","_getRelationOptionList:filter-function"),n=App[t.relation].search({sortBy:t.sortBy}),h=t.filter(n,"collection",e);else if(t.filter[t.name])for(i=t.filter[t.name],App.Log.debug("ControllerForm","_getRelationOptionList:filter-data",i),s=0,l=(m=App[t.relation].search({sortBy:t.sortBy})).length;s<l;s++)for(f=m[s],r=0,c=i.length;r<c;r++)o=i[r],f.id===o&&h.push(f);else if(t.filter&&_.isArray(t.filter)&&"select"===t.tag)for(App.Log.debug("ControllerForm","_getRelationOptionList:filter-array",t.filter),i=_.clone(t.filter),t.rejectNonExistentValues||!e[t.name]||_.contains(i,e[t.name])||i.push(e[t.name]),a=0,u=(g=App[t.relation].search({sortBy:t.sortBy,translate:t.translate})).length;a<u;a++)for(f=g[a],d=0,p=i.length;d<p;d++)o=i[d],(f.id===o||f.id&&o&&f.id.toString()===o.toString())&&h.push(f);else App.Log.debug("ControllerForm","_getRelationOptionList:filter-data no filter matched"),h=App[t.relation].search({sortBy:t.sortBy});else App.Log.debug("ControllerForm","_getRelationOptionList:filter-no filter defined"),h=App[t.relation].search({sortBy:t.sortBy});return t.translate=App[t.relation].configure_translate,App.Log.debug("ControllerForm","_getRelationOptionList",t,h),this.buildOptionList(h,t)}},t.buildOptionListRow=function(t,e){var n,i,s,r,o;if(s=!1,(n="active"in e)&&!e.active&&(s=this._selectedOptionsIsSelected(t.value,{name:e.name||"",value:e.id})),i=!1,this.isTreeRelation(t)&&(i=_.some(e.all_children(),(function(t){return t.active}))),e.active||!n||s||i)return r="?",this.isTreeRelation(t)?(r=e.name_last,t.display_full_name&&(r=e.displayName())):e.displayName?r=e.displayName():e.name&&(r=e.name),t.translate&&(r=App.i18n.translatePlain(r)),o={value:e.id,note:e.note,name:r,title:e.email?e.email:r},e.graphic&&(o.graphic=e.graphic,e.aspect_ratio&&(o.aspect_ratio=e.aspect_ratio)),o},t.buildOptionList=function(t,e){var n,i,s,r;for(i=0,s=t.length;i<s;i++)n=t[i],(r=this.buildOptionListRow(e,n))&&e.options.push(r);return e.sortBy=null},t.filterOption=function(t){if(t.filter&&!_.isEmpty(t.options))return"function"==typeof t.filter?(App.Log.debug("ControllerForm","_filterOption:filter-function"),t.options=t.filter(t.options,t)):(this.isTreeRelation(t)||!t.relation)&&t.filter&&_.isArray(t.filter)?this.filterOptionArray(t):void 0},t.filterOptionArray=function(t){var e,n,i,s,r,o,a,l;for(l=[],e=0,i=(o=t.options).length;e<i;e++)for(r=o[e],n=0,s=(a=t.filter).length;n<s;n++)a[n].toString()===r.value.toString()&&l.push(r);return t.options=l},t.selectedOptions=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d;if(t.options){for(n=0,r=(c=t.options).length;n<r;n++)l=c[n],this._selectedOptionsIsSelected(t.value,l)&&(l.selected="selected",l.checked="checked");if(!(null!=e?e.id:void 0)){for(d=!1,i=0,o=(u=t.options).length;i<o;i++)((l=u[i]).selected||l.checked)&&(d=!0);if(!d){for(h=[],s=0,a=(p=t.options).length;s<a;s++)l=p[s],this._selectedOptionsIsSelected(t.default,l)?(l.selected="selected",h.push(l.checked="checked")):h.push(void 0);return h}}}},t._selectedOptionsIsSelected=function(t,e){var n,i,s;if(_.isArray(t))for(n=0,i=t.length;n<i;n++)if(s=t[n],this._selectedOptionsIsSelectedItem(s,e))return!0;return!(null!=t&&"string"!=typeof t&&"number"!=typeof t&&"boolean"!=typeof t||!this._selectedOptionsIsSelectedItem(t,e))},t._selectedOptionsIsSelectedItem=function(t,e){var n,i,s;if(null==(s=t)&&(s=""),null==(i=e.value)&&(i=""),null==(n=e.name)&&(n=""),"string"==typeof s||"number"==typeof s||"boolean"==typeof s){if(i.toString()===s.toString()||n.toString()===s.toString())return!0}else if(s&&i&&_.include(s,i)||s&&n&&_.include(s,n))return!0;return!1},t.disabledOptions=function(t){var e,n,i,s,r;if(t.options&&_.isArray(t.options)){for(r=[],e=0,n=(s=t.options).length;e<n;e++)!0===(i=s[e]).disable?r.push(i.disabled="disabled"):r.push(i.disabled="");return r}},t.findOption=function(t,e){var n,i,s,r;if(_.isArray(t))for(n=0,i=t.length;n<i;n++){if((s=t[n]).value===e)return s;if(s.children&&(r=this.findOption(s.children,e)))return r}},t.addDeletedOptions=function(t){var e,n,i,s,r,o,a,l;if(_.isEmpty(t.relation)&&!t.rejectNonExistentValues&&(a=t.value)&&t.options){if(l=a,_.isArray(a)||(l=[a]),t.historical_options||(t.historical_options={}),_.isArray(t.options)){for(r=[],e=0,i=l.length;e<i;e++)(a=l[e])&&(this.findOption(t.options,a)||r.push(t.options.push({value:a,name:t.historical_options[a]||a})));return r}for(o=[],n=0,s=l.length;n<s;n++)(a=l[n])&&(t.options[a]||o.push(t.options[a]=t.historical_options[a]||a));return o}},t.isTreeRelation=function(t){return!!t.relation&&!!_.find(App[t.relation].configure_attributes,(function(t){return"parent_id"===t.name}))},t}()}.call(this),function(){App.UiElement.ApplicationAction=function(){function t(){}return t.defaults=function(t,e){var n,i,s,r,o,a,l,c,u,p;for(r in null==e&&(e={}),i=["ticket.state_id"],a={ticket:{name:__("Ticket"),model:"Ticket"},article:{name:__("Article"),model:t.article_body_cc_only?"TicketArticle":"Article"}},t.notification&&(a.notification={name:__("Notification"),model:"Notification"}),s={},a)if((o=a[r]).model&&App[o.model]){for(l=0,c=(u=App[o.model].configure_attributes).length;l<c;l++)if(p=u[l],!(t.article_body_cc_only&&"TicketArticle"===o.model&&"body"!==p.name&&"cc"!==p.name||t.no_dates&&("date"===p.tag||"datetime"===p.tag)||"password"===p.type||"_ids"===p.name.substr(p.name.length-4,4)||p.readonly)){switch((n=_.clone(p)).objectName=o.model,n.attributeName=n.name,t.no_richtext_uploads&&"richtext"===n.tag&&(n.upload=!1),n.tag){case"date":case"datetime":n.operator=["static","relative"];break;case"tag":n.operator=["add","remove"]}s[r+"."+n.name]=n}}else"notification"===r?(s[r+".email"]={name:"email",display:__("Email")},s[r+".sms"]={name:"sms",display:__("SMS")},s[r+".webhook"]={name:"webhook",display:__("Webhook")}):"article"===r&&(s[r+".note"]={name:"note",display:__("Note")});return t.ticket_delete&&(s["ticket.action"]={name:"action",display:__("Action"),tag:"select",null:!1,translate:!0,options:{delete:"Delete"}}),t.sender_type&&(s["ticket.formSenderType"]={name:"formSenderType",display:__("Sender Type"),tag:"select",null:!1,translate:!0,options:[{value:"phone-in",name:__("Inbound Call")},{value:"phone-out",name:__("Outbound Call")},{value:"email-out",name:__("Email")}]}),[i,a,s]},t.placeholder=function(t,e,n,i,s){var r,o;return r=$(App.view("generic/ticket_perform_action/row")({attribute:e})),o=this.buildAttributeSelector(t,i,s),r.find(".js-attributeSelector").prepend(o),r},t.render=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d;if(null==e&&(e={}),n=(p=this.defaults(t,e))[0],o=p[1],s=p[2],(l=$(App.view("generic/ticket_perform_action/index")({attribute:t}))).on("click",".js-rowActions .js-add",(d=this,function(n){var i,r;return i=$(n.target).closest(".js-filterElement"),r=d.placeholder(l,t,e,o,s),i.get(0)?i.after(r):l.append(r),r.find(".js-attributeSelector select").trigger("change"),d.updateAttributeSelectors(l)})),l.on("click",".js-rowActions .js-remove",function(t){return function(e){var n;if(!$(e.currentTarget).hasClass("is-disabled"))return n=$(e.target).closest(".js-filterElement"),t.removeAlerts(l,n),n.remove(),t.updateAttributeSelectors(l)}}(this)),l.on("change",".js-attributeSelector select",function(e){return function(n){var i,r;return r=(i=$(n.target).closest(".js-filterElement")).find(".js-attributeSelector option:selected").attr("value"),e.rebuildAttributeSelectors(l,i,r,s,{},t),e.updateAttributeSelectors(l),e.refreshAlerts(l,i,r,s,t)}}(this)),l.on("change",".js-operator select",function(e){return function(n){var i,r;return r=(i=$(n.target).closest(".js-filterElement")).find(".js-attributeSelector option:selected").attr("value"),e.buildOperator(l,i,r,s,{},t)}}(this)),l.on("change",".js-value select",function(e){return function(n){var i,r;return r=(i=$(n.target).closest(".js-filterElement")).find(".js-attributeSelector option:selected").attr("value"),e.refreshAlerts(l,i,r,s,t)}}(this)),_.isEmpty(e[t.name]))for(a=0,c=n.length;a<c;a++)r=n[a],i=this.placeholder(l,t,e,o,s),l.append(i),this.rebuildAttributeSelectors(l,i,r,s,{},t),this.refreshAlerts(l,i,r,s,t);else for(r in h=e[t.name])u=h[r],t.skip_unknown_attributes&&!_.includes(_.keys(s),r)||(i=this.placeholder(l,t,e,o,s),this.rebuildAttributeSelectors(l,i,r,s,u,t),l.append(i),this.refreshAlerts(l,i,r,s,t));return this.disableRemoveForOneAttribute(l),l},t.elementKeyGroup=function(t){return t.split(/\./)[0]},t.buildAttributeSelector=function(t,e,n){var i,s,r,o,a,l,c,u,p;for(o in u="",t.find(".js-attributeSelector select option").each((function(){if(!u&&!$(this).prop("disabled"))return u=$(this).val()})),p=$('<select class="form-control"></select>'),e)for(r in a=e[o],s=App.i18n.translateInline(a.name),p.closest("select").append('<optgroup label="'+s+'" class="js-'+o+'"></optgroup>'),l=p.find("optgroup.js-"+o),n)n[r],this.elementKeyGroup(r)===o&&(i=n[r],s=App.i18n.translateInline(i.display),c="",r===u&&(c='selected="selected"'),l.append('<option value="'+r+'" '+c+">"+s+"</option>"));return p},t.disableRemoveForOneAttribute=function(t){return t.find(".js-attributeSelector select").length>1?t.find(".js-remove").removeClass("is-disabled"):t.find(".js-remove").addClass("is-disabled")},t.updateAttributeSelectors=function(t){return t.find(".js-attributeSelector select option").prop("disabled",!1),t.find(".js-attributeSelector select").each((function(){var e;return e=$(this).val(),t.find('.js-attributeSelector select option[value="'+e+'"]').attr("disabled",!0)})),this.disableRemoveForOneAttribute(t)},t.rebuildAttributeSelectors=function(t,e,n,i,s,r){var o,a,l,c,u;return n&&e.find(".js-attributeSelector select").val(n),u=n.match(/^notification.([\w]+)$/),a=n.match(/^article.([\w]+)$/),_.isArray(u)&&(c=u[1])?(e.find(".js-setAttribute").html("").addClass("hide"),e.find(".js-setArticle").html("").addClass("hide"),this.buildNotificationArea(c,t,e,n,i,s,r)):!r.article_body_cc_only&&_.isArray(a)&&(o=a[1])?(e.find(".js-setAttribute").html("").addClass("hide"),e.find(".js-setNotification").html("").addClass("hide"),this.buildArticleArea(o,t,e,n,i,s,r)):(e.find(".js-setNotification").html("").addClass("hide"),e.find(".js-setArticle").html("").addClass("hide"),e.find(".js-setAttribute div").get(0)||(l=$(App.view("generic/ticket_perform_action/attribute_selector")({attribute:r,name:name,meta:s||{}})),e.find(".js-setAttribute").html(l).removeClass("hide"))),r.simple_attribute_selector?this.buildValue(t,e,n,i,s,r):this.buildOperator(t,e,n,i,s,r)},t.buildOperator=function(t,e,n,i,s,r){var o,a,l,c,u,p,h,d,f,m;if(a=e.find(".js-operator option:selected").attr("value"),s.operator||(s.operator=a),u=r.name+"::"+n+"::operator",m=$('<select class="form-control" name="'+u+'"></select>'),(o=i[n])&&o.operator?e.find(".js-operator").parent().removeClass("hide"):e.find(".js-operator").parent().addClass("hide"),o&&o.operator)for(l=0,c=(d=o.operator).length;l<c;l++)p=d[l],h=App.i18n.translateInline(p),f="",s.operator===p&&(f='selected="selected"'),m.append('<option value="'+p+'" '+f+">"+h+"</option>");return e.find(".js-operator select").replaceWith(m),this.buildPreCondition(t,e,n,i,s,r)},t.buildPreCondition=function(t,e,n,i,s,r){var o,a,l,c,u,p,h,d,f,m,g,v;if(e.find(".js-operator option:selected").attr("value"),l=e.find(".js-preCondition option:selected").attr("value"),s.pre_condition||(s.pre_condition=l),v=this,m=function(){return"specific"!==e.find(".js-preCondition option:selected").attr("value")?(e.find(".js-value select").html(""),e.find(".js-value").addClass("hide")):(e.find(".js-value").removeClass("hide"),v.buildValue(t,e,n,i,s,o))},u=(o=clone(r,!0)).name+"::"+n+"::value",h=!1,"User"===(null!=(a=i[n])?a.relation:void 0)&&(h="user",o.tag="user_autocompletion"),"Organization"===(null!=a?a.relation:void 0)&&(h="org",o.tag="autocompletion_ajax"),!h||!1===o.user_action)return e.find(".js-preCondition select").html(""),e.find(".js-preCondition").closest(".controls").addClass("hide"),m(),void this.buildValue(t,e,n,i,s,o);for(c in e.find(".js-preCondition").closest(".controls").removeClass("hide"),u=o.name+"::"+n+"::pre_condition",f=$('<select class="form-control" name="'+u+'" ></select>'),p={},"user"===h?(p={"current_user.id":App.i18n.translateInline("current user"),specific:App.i18n.translateInline("specific user")},!0===a.null&&(p.not_set=App.i18n.translateInline("unassign user"))):"org"===h&&(p={"current_user.organization_id":App.i18n.translateInline("current user organization"),specific:App.i18n.translateInline("specific organization")}),p)g=p[c],d="",c===s.pre_condition&&(d='selected="selected"'),f.append('<option value="'+c+'" '+d+">"+App.i18n.translateInline(g)+"</option>");return e.find(".js-preCondition").closest(".controls").removeClass("hide"),e.find(".js-preCondition select").replaceWith(f),e.find(".js-preCondition select").on("change",(function(){return m()})),this.buildValue(t,e,n,i,s,o),m()},t.buildValue=function(t,e,n,i,s,r){var o,a,l,c,u;return l=r.name+"::"+n+"::value","User"===(null!=(o=clone(i[n],!0))?o.relation:void 0)&&(o.tag="user_autocompletion",o.disableCreateObject=!0),"Organization"===(null!=o?o.relation:void 0)&&(o.tag="autocompletion_ajax"),a="",o&&App.UiElement[o.tag]&&(o.name=l,r.value&&r.value[n]&&(o.value=_.clone(r.value[n].value)),o.multiple=!1,o.default=void 0,o.nulloption=o.null,"multiselect"!==o.tag&&"multi_tree_select"!==o.tag||(o.multiple=!0),"checkbox"===o.tag&&(o.tag="select"),"datetime"===o.tag&&(o.validationContainer="self"),a=App.UiElement[o.tag].render(o,{})),c=[__("before (relative)"),__("within next (relative)"),__("within last (relative)"),__("after (relative)"),__("till (relative)"),__("from (relative)"),__("relative")],u=null!=s?s.operator:void 0,_.include(null!=o?o.operator:void 0,u)||(u=Array.isArray(null!=o?o.operator:void 0)?o.operator[0]:null),_.include(c,u)&&(o.name=r.name+"::"+n,r.value&&r.value[n]&&(o.value=_.clone(r.value[n])),a=App.UiElement.time_range.render(o,{})),e.find(".js-setAttribute > .flex > .js-value").removeClass("hide").html(a)},t.recpientVariables=function(){return{article_last_sender:__("Sender of last article"),ticket_owner:__("Owner"),ticket_customer:__("Customer"),ticket_agents:__("All agents")}},t.buildNotificationArea=function(t,e,n,i,s,r,o){var a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S,x,j,D,P,E;if(!n.find(".js-setNotification .js-body-"+t).get(0)){for(d in n.find(".js-setNotification").empty(),y=o.name+"::notification."+t,v="sms"===t?160:2e5,_.isArray(r.recipient)||(r.recipient=[r.recipient]),a=[],w=this.recpientVariables()){for(D=w[d],T=void 0,c=0,f=(k=r.recipient).length;c<f;c++)d===k[c]&&(T=!0);a.push({value:d,name:App.i18n.translatePlain(D),selected:T})}for(l=[],p=0,m=(A=App.User.all()).length;p<m;p++){for(d="userid_"+(j=A[p]).id,T=void 0,h=0,g=(C=r.recipient).length;h<g;h++)d===C[h]&&(T=!0);l.push({value:d,name:j.firstname+" "+j.lastname,selected:T})}return x=new App.ColumnSelect({attribute:{name:y+"::recipient",options:[{label:__("Variables"),group:a},{label:__("User"),group:l}]}}).element(),"webhook"===t?((b=$(App.view("generic/ticket_perform_action/webhook")({attribute:o,name:y,notificationType:t,meta:r||{}}))).find(".js-recipient select").replaceWith(x),E=0===App.Webhook.search({filter:{active:!0}}).length&&_.isEmpty(r.webhook_id)?App.view("generic/ticket_perform_action/webhook_not_available")({attribute:o}):App.UiElement.select.render({name:y+"::webhook_id",multiple:!1,null:!1,relation:"Webhook",value:r.webhook_id,translate:!1,nulloption:!0}),b.find(".js-webhooks").html(E)):((b=$(App.view("generic/ticket_perform_action/notification")({attribute:o,name:y,notificationType:t,meta:r||{}}))).find(".js-recipient select").replaceWith(x),P=App.UiElement.select.render({name:y+"::internal",multiple:!1,null:!1,options:{true:__("internal"),false:__("public")},value:r.internal||"false",translate:!0}),u=App.UiElement.select.render({name:y+"::include_attachments",multiple:!1,null:!1,options:{true:__("Yes"),false:__("No")},value:r.include_attachments||"false",translate:!0}),b.find(".js-internal").html(P),b.find(".js-include_attachments").html(u),b.find('.js-body div[contenteditable="true"]').ce({mode:"richtext",placeholder:__("message"),maxlength:v}),new App.WidgetPlaceholder({el:b.find('.js-body div[contenteditable="true"]').parent(),objects:[{prefix:"ticket",object:"Ticket",display:__("Ticket")},{prefix:"article",object:"TicketArticle",display:__("Article")},{prefix:"user",object:"User",display:__("Current User")}]})),n.find(".js-setNotification").html(b).removeClass("hide"),!0===App.Config.get("smime_integration")||!0===App.Config.get("pgp_integration")?(S=App.UiElement.select.render({name:y+"::sign",multiple:!1,options:{no:__("Do not sign email"),discard:__("Sign email (if not possible, discard notification)"),always:__("Sign email (if not possible, send notification anyway)")},value:r.sign,translate:!0}),n.find(".js-sign").html(S),S=App.UiElement.select.render({name:y+"::encryption",multiple:!1,options:{no:__("Do not encrypt email"),discard:__("Encrypt email (if not possible, discard notification)"),always:__("Encrypt email (if not possible, send notification anyway)")},value:r.encryption,translate:!0}),n.find(".js-encryption").html(S)):void 0}},t.buildArticleArea=function(t,e,n,i,s,r,o){var a,l,c;if(!n.find(".js-setArticle .js-body-"+t).get(0))return n.find(".js-setArticle").empty(),l=o.name+"::article."+t,c=App.UiElement.select.render({name:l+"::internal",multiple:!1,null:!1,label:__("Visibility"),options:{true:"internal",false:"public"},value:r.internal,translate:!0}),(a=$(App.view("generic/ticket_perform_action/article")({attribute:o,name:l,articleType:t,meta:r||{}}))).find(".js-internal").html(c),a.find('.js-body div[contenteditable="true"]').ce({mode:"richtext",placeholder:__("message"),maxlength:2e5}),new App.WidgetPlaceholder({el:a.find('.js-body div[contenteditable="true"]').parent(),objects:[{prefix:"ticket",object:"Ticket",display:__("Ticket")},{prefix:"article",object:"TicketArticle",display:__("Article")},{prefix:"user",object:"User",display:__("Current User")}]}),n.find(".js-setArticle").html(a).removeClass("hide")},t.refreshAlerts=function(e,n,i,s,r){var o,a,l,c,u,p;if(t.removeAlerts(e,n),(c=App.ControllerForm.params(n))&&(p=null!=(u=c[r.name])?u[i].value:void 0)&&(null!=(o=s[i].alerts)?o[p]:void 0)&&(l=o[p]))return n.data("id")||(a="elementRow-"+(new Date).getTime()+"-"+Math.floor(999999*Math.random()),n.data("id",a)),$("<div />").addClass("alert alert--warning js-alert").attr("role","alert").attr("data-element-row-id",n.data("id")).text(App.i18n.translatePlain(l)).prependTo(e)},t.removeAlerts=function(t,e){return t.find(".js-alert[data-element-row-id='"+e.data("id")+"']").remove()},t}()}.call(this),function(){App.UiElement.ApplicationSelector=function(){function t(){}return t.defaults=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m;for(o in null==t&&(t={}),null==e&&(e={}),s=["ticket.state_id"],l={ticket:{name:__("Ticket"),model:"Ticket"},article:{name:__("Article"),model:"TicketArticle"},customer:{name:__("Customer"),model:"User"},organization:{name:__("Organization"),model:"Organization"}},t.executionTime&&(l.execution_time={name:__("Execution Time")}),m={"^datetime$":[__("today"),__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)")],"^timestamp$":[__("today"),__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)")],"^date$":[__("today"),"before (absolute)","after (absolute)","before (relative)","after (relative)","within next (relative)","within last (relative)"],boolean$:[__("is"),__("is not")],integer$:[__("is"),__("is not")],"^radio$":[__("is"),__("is not")],"^select$":[__("is"),__("is not")],"^multiselect$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")],"^tree_select$":[__("is"),__("is not")],"^multi_tree_select$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")],"^autocompletion_ajax_external_data_source$":[__("is"),__("is not")],"^input$":[__("contains"),__("contains not"),__("is any of"),__("is none of"),__("starts with one of"),__("ends with one of")],"^richtext$":[__("contains"),__("contains not")],"^textarea$":[__("contains"),__("contains not")],"^tag$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")]},t.hasChanged&&(m={"^datetime$":[__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)"),__("has changed")],"^timestamp$":[__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)"),__("has changed")],"^date$":[__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)"),__("has changed")],boolean$:[__("is"),__("is not"),__("has changed")],integer$:[__("is"),__("is not"),__("has changed")],"^radio$":[__("is"),__("is not"),__("has changed")],"^select$":[__("is"),__("is not"),__("has changed")],"^multiselect$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")],"^tree_select$":[__("is"),__("is not"),__("has changed")],"^multi_tree_select$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")],"^autocompletion_ajax_external_data_source$":[__("is"),__("is not"),__("has changed")],"^input$":[__("contains"),__("contains not"),__("has changed"),__("is any of"),__("is none of"),__("starts with one of"),__("ends with one of")],"^richtext$":[__("contains"),__("contains not"),__("has changed")],"^textarea$":[__("contains"),__("contains not"),__("has changed")],"^tag$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")]}),t.hasRegexOperators&&App.Config.get("ticket_conditions_allow_regular_expression_operators")&&m["^input$"].push(__("matches regex"),__("does not match regex")),f={_id$:[__("is"),__("is not")],_ids$:[__("is"),__("is not")]},t.hasChanged&&(f={_id$:[__("is"),__("is not"),__("has changed")],_ids$:[__("is"),__("is not"),__("has changed")]}),r={},!1===t.article&&delete l.article,t.action&&(r["ticket.action"]={name:"action",display:__("Action"),tag:"select",null:!1,translate:!0,options:{create:__("created"),update:__("updated"),"update.merged_into":__("merged into"),"update.received_merge":__("received merge")},operator:[__("is"),__("is not")]}),l)if(a=l[o],"article"===o&&t.action&&(r["article.action"]={name:"action",display:__("Action"),tag:"select",null:!1,translate:!0,options:{create:"created"},operator:[__("is"),__("is not")]},r["article.time_accounting"]={name:"time_accounting",display:__("Time Accounting"),tag:"select",null:!1,translate:!0,options:{create:"created"},operator:[__("is set"),__("not set")]}),"execution_time"===o)t.executionTime&&(r["execution_time.calendar_id"]={name:"calendar_id",display:__("Calendar"),tag:"select",relation:"Calendar",null:!1,translate:!1,operator:[__("is in working time"),__("is not in working time")]});else for(c=0,u=(i=App.ObjectManagerAttribute.selectorAttributesByObject()[a.model]||[]).length;c<u;c++)if((n=i[c]).objectName=a.model,n.attributeName=n.name,"password"!==n.type&&"_ids"!==n.name.substr(n.name.length-4,4)&&!1!==n.searchable){for(d in n.default=void 0,"email"!==n.type&&"tel"!==n.type&&"url"!==n.type||(n.type="text"),"select"!==n.tag&&"autocompletion_ajax_external_data_source"!==n.tag||(n.multiple=!0),m)h=m[d],p=new RegExp(d,"i"),n.tag&&n.tag.match(p)&&(n.operator=h),r[o+"."+n.name]=n;for(d in f)h=f[d],p=new RegExp(d,"i"),n.name&&n.name.match(p)&&(n.operator=h),r[o+"."+n.name]=n}return t.hasReached&&["ticket.pending_time","ticket.escalation_at"].forEach((function(t){var e;return(e=clone(r[t].operator)).push(__("has reached")),"ticket.escalation_at"===t&&e.push(__("has reached warning")),r[t].operator=e})),t.out_of_office&&(r["ticket.out_of_office_replacement_id"]={name:"out_of_office_replacement_id",display:__("Out of office replacement"),tag:"autocompletion_ajax",relation:"User",null:!1,translate:!0,operator:[__("is"),__("is not")]}),["ticket.created_at","ticket.updated_at"].forEach((function(t){return r[t].operator=r[t].operator.filter((function(t){return"has changed"!==t}))})),r["ticket.mention_user_ids"]={name:"mention_user_ids",display:__("Subscribe"),tag:"autocompletion_ajax",relation:"User",null:!1,translate:!0,operator:[__("is"),__("is not")]},[s,l,r]},t.rowContainer=function(t,e,n){var i,s;return i=$(App.view("generic/application_selector_row")({attribute:n,pre_condition:this.HasPreCondition()})),s=this.buildAttributeSelector(t,e),i.find(".js-attributeSelector").prepend(s),i},t.emptyBody=function(t){return $(App.view("generic/application_selector_empty")({attribute:t}))},t.prepareParamValue=function(t,e,n,i){var s,r,o,a;for(s in o={},a=i[n.name])r=a[s],e[s]&&(o[s]=r);return o},t.render=function(t,e){var n;return null==e&&(e={}),n=$(App.view("generic/application_selector")({attribute:t})),this.renderItem(n,t,e)},t.renderItem=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d,f;if(i=(u=this.defaults(e,n))[0],o=u[1],s=u[2],t.off("click.application_selector",".js-add").on("click.application_selector",".js-add",(f=this,function(n){var i,r,a,l,c;for(l in i=$(n.target).closest(".js-filterElement"),a=void 0,s){if(s[l],f.hasDuplicateSelector()){a=l;break}if(!t.find('.js-attributeSelector [value="'+l+'"]:selected').get(0)){a=l;break}}if(a)return c=f.rowContainer(o,s,e),(r=t.find("div.horizontal-filter-body")).find("input.empty:hidden").length>0&&f.hasEmptySelectorAtStart()?r.parent().replaceWith(c):(i.after(c),c.find(".js-attributeSelector select").trigger("change")),f.rebuildAttributeSelectors(t,c,a,s,{},e),f.saveParams(t),!1!==e.preview?f.preview(t):void 0})),t.off("click.application_selector",".filter-control.js-remove").on("click.application_selector",".filter-control.js-remove",function(n){return function(i){if(!$(i.currentTarget).hasClass("is-disabled"))return n.hasEmptySelectorAtStart()?t.find(".filter-control.js-remove").length>1?$(i.target).closest(".js-filterElement").remove():$(i.target).closest(".js-filterElement").find("div.horizontal-filter-body").html(n.emptyBody(e)):$(i.target).closest(".js-filterElement").remove(),n.updateAttributeSelectors(t),n.saveParams(t),!1!==e.preview?n.preview(t):void 0}}(this)),c=this.prepareParamValue(t,s,e,n),_.isEmpty(c))if(this.hasEmptySelectorAtStart())(p=this.rowContainer(o,s,e)).find(".horizontal-filter-body").html(this.emptyBody(e)),t.filter(".js-filter").append(p);else for(a=0,l=i.length;a<l;a++)r=i[a],p=this.rowContainer(o,s,e),this.rebuildAttributeSelectors(t,p,r,s,{},e),t.filter(".js-filter").append(p);else this.renderParamValue(t,e,n,c);return t.off("change.application_selector",".js-attributeSelector select").on("change.application_selector",".js-attributeSelector select",function(n){return function(i){var o;if(o=$(i.target).closest(".js-filterElement"),r=o.find(".js-attributeSelector option:selected").attr("value"))return n.rebuildAttributeSelectors(t,o,r,s,{},e),n.updateAttributeSelectors(t),n.saveParams(t)}}(this)),t.off("change.application_selector",".js-operator select").on("change.application_selector",".js-operator select",function(n){return function(i){var o;if(o=$(i.target).closest(".js-filterElement"),r=o.find(".js-attributeSelector option:selected").attr("value"))return n.buildOperator(t,o,r,s,{},e),n.saveParams(t)}}(this)),t.off("change.application_selector",".js-preCondition select").on("change.application_selector",".js-preCondition select",function(e){return function(){return e.saveParams(t)}}(this)),t.off("change.application_selector keyup.application_selector",".js-value .form-control").on("change.application_selector keyup.application_selector",".js-value .form-control",function(e){return function(){return e.saveParams(t)}}(this)),!1!==e.preview&&(h=function(e){return function(){return e.preview(t)}}(this),d=function(){return t.find(".js-previewCounterContainer").addClass("hide"),t.find(".js-previewLoader").removeClass("hide"),App.Delay.set(h,600,"preview")},t.off("change.application_selector","select").on("change.application_selector","select",(function(){return d()})),t.off("change.application_selector keyup.application_selector","input").on("change.application_selector keyup.application_selector","input",(function(){return d()}))),
this.disableRemoveForOneAttribute(t),this.saveParams(t),!1!==e.preview&&this.preview(t),t},t.renderParamValue=function(t,e,n,i){var s,r,o,a,l,c,u;for(r in(l=this.defaults(e,n))[0],o=l[1],s=l[2],c=[],i)a=i[r],u=this.rowContainer(o,s,e),this.rebuildAttributeSelectors(t,u,r,s,a,e),c.push(t.filter(".js-filter").append(u));return c},t.saveParams=function(t){return this.params=App.ControllerForm.params(t)},t.preview=function(t){var e,n;return e=App.ControllerForm.params(t),App.Ajax.request({id:"application_selector",type:"POST",url:App.Config.get("api_path")+"/tickets/selector",data:JSON.stringify(e),processData:!0,success:(n=this,function(e){return App.Collection.loadAssets(e.assets),t.find(".js-previewCounterContainer").removeClass("hide"),t.find(".js-previewLoader").addClass("hide"),n.ticketTable(e.object_ids,e.object_count,t)})})},t.ticketTable=function(t,e,n){return n.find(".js-previewCounter").html(e),new App.TicketList({tableId:"ticket-selector",el:n.find(".js-previewTable"),ticket_ids:t})},t.showAlert=function(t,e,n){return n.filter(".js-alert").empty().append($("<strong></strong>").text(App.i18n.translateContent(t))).append("\xa0").append(App.i18n.translateContent(e)).removeClass("hidden")},t.hideAlert=function(t){return t.filter(".js-alert").addClass("hidden").empty()},t.buildAttributeSelector=function(t,e){var n,i,s,r,o,a,l,c;for(r in c=$('<select class="form-control"></select>'),t)for(s in a=t[r],o=r.replace(".","-"),i=App.i18n.translateInline(a.name),c.closest("select").append('<optgroup label="'+i+'" class="js-'+o+'"></optgroup>'),l=c.find("optgroup.js-"+o),e)e[s],s.split(/\./).slice(0,-1).join(".")===r&&(n=e[s]).operator&&(i=App.i18n.translateInline(n.display),l.append('<option value="'+s+'">'+i+"</option>"));return c},t.disableRemoveForOneAttribute=function(t){return this.hasEmptySelectorAtStart()?t.find("div.horizontal-filter-body input.empty:hidden").length>0&&t.find(".filter-control.js-remove").length<2?t.find(".filter-control.js-remove").addClass("is-disabled"):t.find(".filter-control.js-remove").removeClass("is-disabled"):t.find(".js-attributeSelector select").length>1?t.find(".filter-control.js-remove").removeClass("is-disabled"):t.find(".filter-control.js-remove").addClass("is-disabled")},t.updateAttributeSelectors=function(t){return this.hasDuplicateSelector()||(t.find(".js-attributeSelector select option").prop("disabled",!1),t.find(".js-attributeSelector select").each((function(){var e;return e=$(this).val(),t.find('.js-attributeSelector select option[value="'+e+'"]').attr("disabled",!0)}))),this.disableRemoveForOneAttribute(t)},t.rebuildAttributeSelectors=function(t,e,n,i,s,r){return n&&e.find(".js-attributeSelector select").val(n),this.buildOperator(t,e,n,i,s,r)},t.mapOperatorDisplayName=function(t){return t},t.buildOperator=function(t,e,n,i,s,r){var o,a,l,c,u,p,h,d,f,m,g,v,y,b,_,w,k;if(a=e.find(".js-operator option:selected").attr("value"),f=r.name+"::"+n+"::operator",!s.operator&&a&&(s.operator=a),k=$('<select class="form-control" name="'+f+'"></select>'),o=i[n],s.operator=this.migrateOperator(o,s.operator),o.operator){for(g=!1,l=0,p=(y=o.operator).length;l<p;l++)if(m=y[l],s.operator===m){g=!0;break}if(!g)for(c=0,h=(b=o.operator).length;c<h;c++){m=b[c],s.operator=m;break}for(u=0,d=(_=o.operator).length;u<d;u++)m=_[u],v=App.i18n.translateInline(this.mapOperatorDisplayName(m)),w="",(n.match(/^ticket/)||"has changed"!==m)&&(s.operator===m&&(w='selected="selected"'),k.append('<option value="'+m+'" '+w+">"+v+"</option>"))}return e.find(".js-operator select").replaceWith(k),this.HasPreCondition()?this.buildPreCondition(t,e,n,i,s,r):this.buildValue(t,e,n,i,s,r)},t.buildPreCondition=function(t,e,n,i,s,r){var o,a,l,c,u,p,h,d,f,m,g,v;if(e.find(".js-operator option:selected").attr("value"),l=e.find(".js-preCondition option:selected").attr("value"),s.pre_condition||(l?s.pre_condition=l:_.isEmpty(s.value)||(s.pre_condition="specific")),v=this,m=function(){return"specific"!==e.find(".js-preCondition option:selected").attr("value")?(e.find(".js-value select").html(""),e.find(".js-value").addClass("hide")):(e.find(".js-value").removeClass("hide"),v.buildValue(t,e,n,i,s,o))},u=(o=_.clone(r)).name+"::"+n+"::value",h=!1,"User"===(a=i[n]).relation&&(h="user",o.tag="user_autocompletion"),"Organization"===a.relation&&(h="org",o.tag="autocompletion_ajax"),!h)return e.find(".js-preCondition select").html(""),e.find(".js-preCondition").closest(".controls").addClass("hide"),m(),void this.buildValue(t,e,n,i,s,o);for(c in e.find(".js-preCondition").removeClass("hide"),u=o.name+"::"+n+"::pre_condition",f=$('<select class="form-control" name="'+u+'" ></select>'),p={},"user"===h?(!0!==r.noCurrentUser&&(p["current_user.id"]=App.i18n.translateInline("current user")),p.specific=App.i18n.translateInline("specific user"),!0!==r.noNotSet&&(p.not_set=App.i18n.translateInline("not set (not defined)"))):"org"===h&&(!0!==r.noCurrentUser&&(p["current_user.organization_id"]=App.i18n.translateInline("current user organization")),p.specific=App.i18n.translateInline("specific organization"),!0!==r.noNotSet&&(p.not_set=App.i18n.translateInline("not set (not defined)"))),p)g=p[c],d="",c===s.pre_condition&&(d='selected="selected"'),f.append('<option value="'+c+'" '+d+">"+App.i18n.translateInline(g)+"</option>");return e.find(".js-preCondition").closest(".controls").removeClass("hide"),e.find(".js-preCondition select").replaceWith(f),e.find(".js-preCondition select").off("change.application_selector").on("change.application_selector",(function(){return m()})),this.buildValue(t,e,n,i,s,o),m()},t.buildValueConfigValue=function(t,e,n,i,s,r){return _.clone(r.value[n].value)},t.buildValueName=function(t,e,n,i,s,r,o){return""+(o?"{"+o+"}":"")+r.name+"::"+n+"::value"},t.buildValue=function(t,e,n,i,s,r){var o,a,l,c;return o=i[n],"User"===(a=_.clone(o)).relation&&(a.tag="user_autocompletion"),"Organization"===a.relation&&(a.tag="autocompletion_ajax"),a.tag&&this.tokenfieldTagRegex()&&a.tag.match(this.tokenfieldTagRegex())&&_.contains(["is any of","is none of","starts with one of","ends with one of"],s.operator)&&(a.tag="tokenfield"),l="",a&&App.UiElement[a.tag]&&"today"!==s.operator&&(c=App.UiElement[a.tag].valueType,"multiple"in(a=this.buildValueConfigNameValue(a,t,e,n,i,s,r,c))&&(a=this.buildValueConfigMultiple(a,s)),"User"===a.relation&&(a.multiple=!1,a.nulloption=!1,a.guess=!1,a.disableCreateObject=!0),"Organization"===a.relation&&(a.multiple=!1,a.nulloption=!1,a.guess=!1),"checkbox"===a.tag&&(a.tag="select"),l=this.renderConfig(a,s)),"before (relative)"!==s.operator&&"within next (relative)"!==s.operator&&"within last (relative)"!==s.operator&&"after (relative)"!==s.operator&&"from (relative)"!==s.operator&&"till (relative)"!==s.operator||(a=this.buildValueConfigRelativeNameValue(a,t,e,n,i,s,r),l=App.UiElement.time_range.render(a,{})),e.find(".js-value").removeClass("hide").html(l),_.contains(["has reached","has reached warning","has changed","not set","is set"],s.operator)?(e.find(".js-value").addClass("hide"),e.find(".js-preCondition").closest(".controls").addClass("hide")):e.find(".js-value").removeClass("hide")},t.buildValueConfigNameValue=function(t,e,n,i,s,r,o,a){return t.name=this.buildValueName(e,n,i,s,r,o,a),o.value&&o.value[i]&&(t.value=this.buildValueConfigValue(e,n,i,s,r,o)),t},t.buildValueConfigRelativeNameValue=function(t,e,n,i,s,r,o){return t.name=o.name+"::"+i,o.value&&o.value[i]&&(t.value=_.clone(o.value[i])),t},t.renderConfig=function(t){var e;return e=t.tag+"_search",App.UiElement[e]?App.UiElement[e].render(t,{}):App.UiElement[t.tag].render(t,{})},t.buildValueConfigMultiple=function(t){return t.multiple=!0,t.nulloption=!1,t},t.humanText=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g;if(c=App.i18n.translateContent("No filter was configured."),_.isEmpty(t))return[c];for(e in(d=this.defaults())[0],d[1],s=d[2],f=[],t)if(a=t[e],u=e.split(/\./),a&&u[1]){if(p=a.operator,m=a.value,l=toCamelCase(u[0]),n=s[e],g=[],_.isArray(m))for(r=0,o=m.length;r<o;r++)i=m[r],h=this.humanTextLookup(n,i),g.push(h);else g.push(this.humanTextLookup(n,m));g.join&&(g=g.join(", ")),f.push(App.i18n.translateContent("Where")+" <b>"+App.i18n.translateContent(l)+" -> "+App.i18n.translateContent(n.display)+"</b> "+App.i18n.translateContent(p)+" <b>"+g+"</b>.")}return _.isEmpty(f)?[c]:f},t.humanTextLookup=function(t,e){var n;return App[t.relation]&&App[t.relation].exists(e)&&(n=App[t.relation].fullLocal(e))?n.displayName?App.i18n.translateContent(n.displayName()):valueHuman.push(App.i18n.translateContent(n.name)):e},t.HasPreCondition=function(){return!0},t.hasEmptySelectorAtStart=function(){return!1},t.hasDuplicateSelector=function(){return!1},t.coreWorkflowCustomModulesActive=function(){var t,e,n,i,s;for(t=!1,e=0,n=(i=App.CoreWorkflow.all()).length;e<n;e++)if((s=i[e]).changeable&&(s.condition_saved["custom.module"]||s.condition_selected["custom.module"]||s.perform["custom.module"])){t=!0;break}return t},t.tokenfieldTagRegex=function(){return new RegExp("^input$","i")},t.migrateOperator=function(t,e){if(t.tag&&this.tokenfieldTagRegex()&&t.tag.match(this.tokenfieldTagRegex()))switch(e){case"is":return"is any of";case"is not":return"is none of";case"starts with":return"starts with one of";case"ends with":return"ends with one of"}return e},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.ApplicationSelectorExpert=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.subclauseContainer=function(t,e){var n,i,s;return null==t&&(t=0),null==e&&(e="AND"),n=0===t,s=$(App.view("generic/application_selector_subclause")({level:t,is_first:n})),i=this.buildSubclauseSelector(e),s.find(".js-subclauseSelector").prepend(i),s},n.rowContainer=function(t,e,i,s){var r,o;return null==s&&(s=1),this.hasExpertConditions()&&this.isExpertMode?(r=$(App.view("generic/application_selector_row")({attribute:i,pre_condition:this.HasPreCondition(),has_expert_conditions:this.hasExpertConditions(),level:s})),o=this.buildAttributeSelector(t,e),r.find(".js-attributeSelector").prepend(o),r):n.__super__.constructor.rowContainer.apply(this,arguments)},n.prepareParamValue=function(t,e,n,i){var s,r,o,a;if(o={},!(null!=i?i[n.name]:void 0))return o;if(a=i[n.name],this.hasExpertConditions()&&this.isExpertMode)o=this.migrateSelector(a);else for(s in this.isSelectorIncompatible(a)&&this.showAlert(__("Caution!"),__("You disabled the expert mode. This will downgrade all expert conditions and can lead to data loss in your condition attributes. Please check your conditions before saving."),t),a=this.downgradeSelector(a))r=a[s],e[s]&&(o[s]=r);return n.value=o,o},n.migrateSelector=function(t){var e;return t.conditions?t:(e={operator:"AND",conditions:[]},_.each(_.keys(t),(function(n){return e.conditions.push(_.extend({name:n},t[n]))})),e)},n.isSelectorIncompatible=function(t){var e,n,i,s,r;if(!(null!=t?t.conditions:void 0))return!1;if("AND"!==t.operator)return!0;for(r={},n=0,i=(s=t.conditions).length;n<i;n++){if((e=s[n]).conditions)return!0;if(r[e.name])return!0;r[e.name]=!0}},n.downgradeSelector=function(t){var e,n,i,s,r;if(!t.conditions)return t;for(r={},n=0,i=(s=t.conditions).length;n<i;n++)(e=s[n]).conditions||e.name&&(r[e.name]=_.omit(e,"name"));return r},n.render=function(t,e){var n,i;return null==e&&(e={}),this.params=e,this.isExpertMode=this.hasExpertConditions()&&this.isSelectorIncompatible(this.params[t.name])||t.always_expert_mode,(n=$(App.view("generic/application_selector")({attribute:t,has_expert_conditions:this.hasExpertConditions(),is_expert_mode:this.isExpertMode}))).off("change.application_selector",".js-switch input").on("change.application_selector",".js-switch input",(i=this,function(e){var s,r,o;return o=$(e.target),s=function(){if(i.isExpertMode=r,n.find(".js-filterElement").remove(),i.renderItem(n,t,i.params),!1!==t.preview)return i.preview(n)},!(r=o.prop("checked"))&&i.isSelectorIncompatible(i.params[t.name])?new App.ControllerConfirm({head:__("Are you sure?"),message:__("Ticket selector contains expert conditions. If you turn off the expert mode, it can lead to data loss in your condition attributes."),buttonClass:"btn--danger",callback:s,onCancel:function(){return o.prop("checked",!0)},container:i.el,small:!0}):s()})),this.renderItem(n,t,this.params)},n.renderItem=function(t,e,i){var s,r,o,a,l,c,u,p,h,d,f,m,g;if(!this.hasExpertConditions()||!this.isExpertMode)return n.__super__.constructor.renderItem.apply(this,arguments);if(s=(p=this.defaults(e,i))[0],a=p[1],r=p[2],s.unshift("subclause"),t.off("click.application_selector",".js-add").on("click.application_selector",".js-add",(g=this,function(n){var s,o,l,c,u,p;for(c in s=$(n.target).closest(".js-filterElement"),u=g.getPreviousElementLevel(s),l=void 0,r){if(r[c],g.hasDuplicateSelector()){l=c;break}if(!t.find('.js-attributeSelector [value="'+c+'"]:selected').get(0)){l=c;break}}if(l)return p=g.rowContainer(a,r,e,u),(o=t.find("div.horizontal-filter-body")).find("input.empty:hidden").length>0&&g.hasEmptySelectorAtStart()?o.parent().replaceWith(p):(s.after(p),p.find(".js-attributeSelector select").trigger("change")),g.disableRemoveForOneAttribute(t),g.rebuildAttributeSelectors(t,p,l,r,{},e),g.toggleSubclauseDisableOnMaxLevels(t),g.saveParams(t,i,e),!1!==e.preview?g.preview(t):void 0})),t.off("click.application_selector",".filter-control.js-remove").on("click.application_selector",".filter-control.js-remove",function(n){return function(s){var r,o;if(!$(s.currentTarget).hasClass("is-disabled"))return(r=$(s.target).closest(".js-filterElement")).data("subclause")&&r.data("level")&&(o=r.data("level")+1,r.nextUntil((function(){return $(this).data("level")<o}),".js-filterElement").remove()),r.remove(),n.disableRemoveForOneAttribute(t),n.updateAttributeSelectors(t),n.saveParams(t,i,e),!1!==e.preview?n.preview(t):void 0}}(this)),t.off("click.application_selector",".js-subclause").on("click.application_selector",".js-subclause",function(n){return function(s){var r,o,a,l;if(!$(s.currentTarget).hasClass("is-disabled"))return r=$(s.target).closest(".js-filterElement"),a=n.getPreviousElementLevel(r),l=n.subclauseContainer(a),(o=t.find("div.horizontal-filter-body")).find("input.empty:hidden").length>0&&n.hasEmptySelectorAtStart()?o.parent().replaceWith(l):(r.after(l),l.find(".js-subclauseSelector select").trigger("change")),n.disableRemoveForOneAttribute(t),n.toggleSubclauseDisableOnMaxLevels(t),n.saveParams(t,i,e),!1!==e.preview?n.preview(t):void 0}}(this)),u=this.prepareParamValue(t,r,e,i),_.isEmpty(u))if(this.hasEmptySelectorAtStart())(h=this.rowContainer(a,r,e)).find(".horizontal-filter-body").html(this.emptyBody(e)),t.filter(".js-filter").append(h);else for(l=0,c=s.length;l<c;l++)"subclause"===(o=s[l])?(f=this.subclauseContainer(),t.filter(".js-filter").append(f)):(h=this.rowContainer(a,r,e),this.rebuildAttributeSelectors(t,h,o,r,{},e),t.filter(".js-filter").append(h));else this.renderExpertConditions(t,e,i,u);return t.off("change.application_selector",".js-subclauseSelector select").on("change.application_selector",".js-subclauseSelector select",function(n){return function(){return n.saveParams(t,i,e)}}(this)),t.off("change.application_selector",".js-attributeSelector select").on("change.application_selector",".js-attributeSelector select",function(n){return function(s){var a;if(a=$(s.target).closest(".js-filterElement"),o=a.find(".js-attributeSelector option:selected").attr("value"))return n.rebuildAttributeSelectors(t,a,o,r,{},e),n.updateAttributeSelectors(t),n.saveParams(t,i,e)}}(this)),t.off("change.application_selector",".js-operator select").on("change.application_selector",".js-operator select",function(n){return function(s){var a;if(a=$(s.target).closest(".js-filterElement"),o=a.find(".js-attributeSelector option:selected").attr("value"))return n.buildOperator(t,a,o,r,{},e),n.saveParams(t,i,e)}}(this)),t.off("change.application_selector",".js-preCondition select").on("change.application_selector",".js-preCondition select",function(n){return function(){return n.saveParams(t,i,e)}}(this)),t.off("change.application_selector keyup.application_selector",".js-value .form-control").on("change.application_selector keyup.application_selector",".js-value .form-control",function(n){return function(){return n.saveParams(t,i,e)}}(this)),!1!==e.preview&&(d=function(e){return function(){return e.preview(t)}}(this),m=function(){return t.find(".js-previewCounterContainer").addClass("hide"),t.find(".js-previewLoader").removeClass("hide"),App.Delay.set(d,600,"preview")},t.off("change.application_selector","select").on("change.application_selector","select",(function(){return m()})),t.off("change.application_selector keyup.application_selector","input").on("change.application_selector keyup.application_selector","input",(function(){return m()}))),this.disableRemoveForOneAttribute(t),this.toggleSubclauseDisableOnMaxLevels(t),this.saveParams(t,i,e),this.applySortable(t,e,i),!1!==e.preview&&this.preview(t),t},n.saveParams=function(t,e,i,s){return null==s&&(s=!1),this.hasExpertConditions()&&(this.isExpertMode||s)?this.params=this.buildExpertConditions(t,i):n.__super__.constructor.saveParams.apply(this,arguments)},n.applySortable=function(t,e,i){return t.filter(".js-filter").sortable({tolerance:"pointer",handle:".draggable",items:"> :not(.unsortable)",opacity:.75,helper:function(t,e){var n,i,s;return(i=$("<div></div>")).append(e.clone()),e.data("subclause")&&(s=e.data("level")+1,n=e.nextUntil((function(){return $(this).data("level")<s}),".js-filterElement").not(".ui-sortable-placeholder"),i.append(n.clone()),n.addClass("hidden")),i},start:function(t,e){var n,i;if(e.item.data("subclause"))return i=e.item.data("level")+1,n=e.item.nextUntil((function(){return $(this).data("level")<i}),".js-filterElement").not(".ui-sortable-placeholder"),e.item.data("children",n)},sort:function(t,e){var i,s,r,o,a,l,c;if((a=e.placeholder.prev(".js-filterElement:visible")).length||(a=e.item.prev(".js-filterElement:visible")),o=n.getPreviousElementLevel(a),i=1,s=(null!=(l=e.position)?l.left:void 0)-25,"rtl"===App.i18n.dir()&&(s=90-(null!=(c=e.position)?c.left:void 0)),s>0&&(i=Math.ceil(s/27)),o>i&&(o=i),e.placeholder.data("level",o).attr("data-level",o),e.item.data("new-level",o),!e.placeholder.data("height-set"))return r=0,e.helper.find(".js-filterElement").each((function(){return r+=$(this).outerHeight()})),e.placeholder.height(r-16).data("height-set",!0)},stop:function(s,r){var o,a,l,c,u,p,h,d,f,m,g,v;if(f=r.item.data("new-level")||n.getPreviousElementLevel(r.item.prev(".js-filterElement:visible")),m=r.item.data("level")-f,r.item.data("subclause")&&r.item.data("children")){for(p=r.item,c=0,h=(l=r.item.data("children")).length;c<h;c++)o=l[c],(o=$(o)).detach().insertAfter(p),p=o,a=o.data("level")-m,o.data("level",a).attr("data-level",a);l.removeClass("hidden"),r.item.removeData("children")}if(r.item.data("level",f).attr("data-level",f),r.item.removeData("new-level"),!r.item.data("subclause"))for(u=0,d=(v=r.item.nextUntil((function(){return $(this).data("level")<=f}),".js-filterElement")).length;u<d;u++)g=v[u],$(g).data("level",f).attr("data-level",f);if(n.disableRemoveForOneAttribute(t),n.toggleSubclauseDisableOnMaxLevels(t),n.saveParams(t,i,e,!0),!1!==e.preview)return n.preview(t)}})},n.getPreviousElementLevel=function(t){var e;return e=1,t.data("subclause")&&t.data("level")?e=t.data("level")+1:t.data("level")&&(e=t.data("level")),e},n.renderExpertConditions=function(t,e,n,i){return i.conditions||App.Log.error("App.UiElement.ticket_selector","Unexpected root subclause format",i),this.renderSubclause(t,e,n,i)},n.renderSubclause=function(t,e,n,i,s){var r,o,a,l,c;for(null==s&&(s=0),c=this.subclauseContainer(s,i.operator),t.filter(".js-filter").append(c),l=[],r=0,o=(a=i.conditions).length;r<o;r++)(i=a[r]).conditions?l.push(this.renderSubclause(t,e,n,i,s+1)):l.push(this.renderCondition(t,e,n,i,s+1));return l},n.renderCondition=function(t,e,n,i,s){var r,o,a,l;return(a=this.defaults(e,n))[0],o=a[1],(r=a[2])[i.name]||(i.name="ticket.number"),l=this.rowContainer(o,r,e,s),this.rebuildAttributeSelectors(t,l,i.name,r,i,e),t.filter(".js-filter").append(l)},n.disableRemoveForOneAttribute=function(t){var e,i,s,r,o,a,l,c;if(!this.hasExpertConditions()||!this.isExpertMode)return n.__super__.constructor.disableRemoveForOneAttribute.apply(this,arguments);for((e=t.find(".js-filterElement").not("[data-subclause]")).length>1?e.find(".filter-control.js-remove").removeClass("is-disabled"):e.find(".filter-control.js-remove").addClass("is-disabled"),a=[],i=0,s=(c=t.find(".js-filterElement[data-subclause][data-level]")).length;i<s;i++)l=c[i],l=$(l),r=l.data("level")+1,(o=l.nextUntil((function(){return $(this).data("level")<r}),".js-filterElement").not("[data-subclause]")).length&&e.length===o.length?a.push(l.find(".filter-control.js-remove").addClass("is-disabled")):a.push(l.find(".filter-control.js-remove").removeClass("is-disabled"));return a},n.toggleSubclauseDisableOnMaxLevels=function(t){var e;if(this.maxNestedLevels())return t.find(".js-subclause").each((e=this,function(t,n){var i,s;return s=(i=(n=$(n)).closest(".js-filterElement")).data("level")||0,i.data("subclause"),i.data("subclause")&&s>=e.maxNestedLevels()||s>e.maxNestedLevels()?n.addClass("is-disabled"):n.removeClass("is-disabled")}))},n.buildSubclauseSelector=function(t){var e;return(e=$('<select class="form-control"></select>')).closest("select").append('<option value="AND">'+App.i18n.translateInline("Match all (AND)")+"</option>"),e.closest("select").append('<option value="OR">'+App.i18n.translateInline("Match any (OR)")+"</option>"),e.closest("select").append('<option value="NOT">'+App.i18n.translateInline("Match none (NOT)")+"</option>"),e.val(t),e},n.buildOperator=function(t,e,i,s,r,o){var a,l,c,u,p,h,d,f,m,g,v,y,b,_,w,k;if(!this.hasExpertConditions()||!this.isExpertMode)return n.__super__.constructor.buildOperator.apply(this,arguments);if(l=e.find(".js-operator option:selected").attr("value"),!r.operator&&l&&(r.operator=l),k=$('<select class="form-control"></select>'),a=s[i],r.operator=this.migrateOperator(a,r.operator),a.operator){for(g=!1,c=0,h=(y=a.operator).length;c<h;c++)if(m=y[c],r.operator===m){g=!0;break}if(!g)for(u=0,d=(b=a.operator).length;u<d;u++){m=b[u],r.operator=m;break}for(p=0,f=(_=a.operator).length;p<f;p++)m=_[p],v=App.i18n.translateInline(this.mapOperatorDisplayName(m)),w="",(i.match(/^ticket/)||"has changed"!==m)&&(r.operator===m&&(w='selected="selected"'),k.append('<option value="'+m+'" '+w+">"+v+"</option>"))}return e.find(".js-operator select").replaceWith(k),this.HasPreCondition()?this.buildPreCondition(t,e,i,s,r,o):this.buildValue(t,e,i,s,r,o)},n.buildPreCondition=function(t,e,i,s,r,o){var a,l,c,u,p,h,d,f,m,g,v;if(!this.hasExpertConditions()||!this.isExpertMode)return n.__super__.constructor.buildPreCondition.apply(this,arguments);if(e.find(".js-operator option:selected").attr("value"),c=e.find(".js-preCondition option:selected").attr("value"),r.pre_condition||(r.pre_condition=c),v=this,m=function(){return"specific"!==e.find(".js-preCondition option:selected").attr("value")?(e.find(".js-value select").html(""),e.find(".js-value").addClass("hide")):(e.find(".js-value").removeClass("hide"),v.buildValue(t,e,i,s,r,a))},a=_.clone(o),h=!1,"User"===(l=s[i]).relation&&(h="user",a.tag="user_autocompletion"),"Organization"===l.relation&&(h="org",a.tag="autocompletion_ajax"),!h)return e.find(".js-preCondition select").html(""),e.find(".js-preCondition").closest(".controls").addClass("hide"),m(),void this.buildValue(t,e,i,s,r,a);for(u in e.find(".js-preCondition").removeClass("hide"),f=$('<select class="form-control"></select>'),p={},"user"===h?(!0!==o.noCurrentUser&&(p["current_user.id"]=App.i18n.translateInline("current user")),p.specific=App.i18n.translateInline("specific user"),p.not_set=App.i18n.translateInline("not set (not defined)")):"org"===h&&(!0!==o.noCurrentUser&&(p["current_user.organization_id"]=App.i18n.translateInline("current user organization")),p.specific=App.i18n.translateInline("specific organization"),p.not_set=App.i18n.translateInline("not set (not defined)")),p)g=p[u],d="",u===r.pre_condition&&(d='selected="selected"'),f.append('<option value="'+u+'" '+d+">"+App.i18n.translateInline(g)+"</option>");return e.find(".js-preCondition").closest(".controls").removeClass("hide"),e.find(".js-preCondition select").replaceWith(f),e.find(".js-preCondition select").off("change.application_selector").on("change.application_selector",(function(){return m()})),this.buildValue(t,e,i,s,r,a),m()},n.buildValueConfigNameValue=function(t,e,i,s,r,o,a,l){return this.hasExpertConditions()&&this.isExpertMode?(delete t.name,delete t.id,void 0!==o.value&&(t.value=o.value),t):n.__super__.constructor.buildValueConfigNameValue.apply(this,arguments)},n.buildValueConfigRelativeNameValue=function(t,e,i,s,r,o,a){return this.hasExpertConditions()&&this.isExpertMode?(t.value=o,t):n.__super__.constructor.buildValueConfigRelativeNameValue.apply(this,arguments)},n.buildExpertConditions=function(t,e){var n,i,s,r,o;if((i=t.find(".js-expertConditions input:hidden")).length||(i=$('<input type="hidden" name="{json}'+e.name+'">'),t.find(".js-expertConditions").append(i)),1===(n=t.find(".js-filterElement[data-subclause]").not("[data-level]")).length)return o=this.prepareSubclauseConditions(n.nextAll(),n),s=JSON.stringify(o),i.val(s),(r={})[""+e.name]=o,r;App.Log.error("App.UiElement.ticket_selector","Unexpected root subclause",n)},n.prepareSubclauseConditions=function(t,e){var n,i,s,r;return(s={}).operator=e.find(".js-subclauseSelector select").val(),i=e.data("level")?e.data("level")+1:1,n=t.filter('.js-filterElement[data-level="'+i+'"]'),s.conditions=[],n.length?(n.each((r=this,function(t,e){var n;return(e=$(e)).data("subclause")?(i=e.data("level")+1,n=e.nextUntil((function(){return $(this).data("level")<i}),".js-filterElement"),s.conditions.push(r.prepareSubclauseConditions(n,e))):s.conditions.push(r.prepareCondition(e))})),s):(App.Log.debug("App.UiElement.ticket_selector","Missing subclause conditions",e),s)},n.prepareCondition=function(t){var e,n,i,s,r,o,a,l,c,u,p,h;if(p={},!(e=t.find(".js-attributeSelector select")).length)return App.Log.error("App.UiElement.ticket_selector","Missing condition attribute selector",t),p;if(p.name=e.val(),(null!=(n=t.find(".js-operator select"))?n.val():void 0)&&(p.operator=t.find(".js-operator select").val()),(null!=(i=t.find(".js-preCondition select"))?i.val():void 0)&&(p.pre_condition=t.find(".js-preCondition select").val()),(null!=(s=t.find("select.js-range"))?s.val():void 0)&&(p.range=t.find("select.js-range").val()),null!=(r=t.find('input[type="hidden"]'))?r.val():void 0)p.value=t.find('input[type="hidden"]').val();else if(null!=(o=t.find("select.js-value"))?o.val():void 0)p.value=t.find("select.js-value").val();else if(null!=(a=t.find(".js-value .js-objectId"))?a.val():void 0)p.value=t.find(".js-value .js-objectId").val();else if(null!=(l=t.find(".js-value .js-shadow"))?l.val():void 0)p.value=t.find(".js-value .js-shadow").val();else if(t.find("[data-value]").length)if("json"===(h=t.find("[data-value]")).data("valueType"))try{p.value=JSON.parse(h.data("value"))}catch(t){App.Log.error("App.UiElement.ticket_selector","Invalid JSON value for a subfield",h)}else p.value=h.data("value");else(null!=(c=t.find(".js-value input.form-control"))?c.val():void 0)?p.value=t.find(".js-value input.form-control").val():(null!=(u=t.find(".js-value .form-control"))?u.val():void 0)&&(p.value=t.find(".js-value .form-control").val());return p},n.humanTextLevel=function(t,e){var n,i;return n="",e>0&&(n="\u2937 "),i=0,1===e?i=5:e>1&&(i=15*(e-1)+5),'<span style="margin-left: '+i+'px">'+n+t+"</span>"},n.humanText=function(t,e){var n,i,s,r,o,a,l,c,u;if(null==e&&(e=0),!t.conditions)return App.UiElement.ApplicationSelector.humanText(t);for((l=this.defaults())[0],l[1],l[2],a={AND:App.i18n.translateInline("Match all (AND)"),OR:App.i18n.translateInline("Match any (OR)"),NOT:App.i18n.translateInline("Match none (NOT)")},u=[this.humanTextLevel(a[t.operator],e)],s=0,r=(c=t.conditions).length;s<r;s++)n=c[s],_.isEmpty(n.conditions)?((i={})[n.name]=n,u.push(this.humanTextLevel(App.UiElement.ApplicationSelector.humanText(i),e+1))):u=u.concat(this.humanText(n,e+1));return o=App.i18n.translateContent("No filter was configured."),u.length<2?[o]:u},n.maxNestedLevels=function(){return 2},n.hasExpertConditions=function(){return App.Config.get("ticket_allow_expert_conditions")},n.hasDuplicateSelector=function(){return this.hasExpertConditions()&&this.isExpertMode},n}(App.UiElement.ApplicationSelector)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.ApplicationTreeSelect=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n;return(n=$.extend(!0,{},t)).multiple?n.multiple="multiple":n.multiple="",n.value&&n.filter&&(n.multiple?n.value=_.intersection(n.value,n.filter):_.contains(n.filter,n.value)||(n.value="")),this.addDeletedOptions(n,e),this.getConfigOptionList(n,e),this.getRelationOptionList(n,e),this.addNullOption(n,e),this.sortOptions(n,e),n.options&&this.optionsSelect(n.options,n.value),this.disabledOptions(n,e),this.filterOption(n,e),new App.SearchableSelect({attribute:n}).element()},n.optionsSelect=function(t,e){var n,i,s,r,o;if(t){for(o=[],i=0,s=t.length;i<s;i++)(null!=(r=(n=t[i]).value)?r.toString():void 0)===(null!=e?e.toString():void 0)&&(n.selected=!0),n.children?o.push(this.optionsSelect(n.children,e)):o.push(void 0);return o}},n.filterTreeOptions=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d,f,m;for(p=[],h=!1,a=o=0,c=n.length;o<c;a=++o){if(d=n[a],r=_.contains(t.filter,d.value.toString()),!t.null||d.value||h||(h=!0,r=!0),i=!1,d.value&&d.children&&d.children.length>0)if(this.isTreeRelation(t))s=_.map(App[t.relation].find(d.value).all_children(),(function(t){return t.id.toString()})),_.intersection(t.filter,s).length>0&&(i=!0);else for(l=0,u=(f=t.filter).length;l<u;l++)(m=f[l])&&m.startsWith(d.value+"::")&&(i=!0);if(i)d.inactive=!r,d.children=this.filterTreeOptions(t,e+1,d.children);else if(d.children=void 0,!r)continue;p.push(d)}return p},n.filterOptionArray=function(t){return t.options=this.filterTreeOptions(t,0,t.options)},n.buildOptionList=function(t,e){var i;return this.isTreeRelation(e)?(i=t.filter((function(t){return!t.parent_id})),e.options=this.buildOptionListTreeRelation(t,e,i),e.sortBy=null):n.__super__.constructor.buildOptionList.apply(this,arguments)},n.buildOptionListTreeRelation=function(t,e,n){var i,s,r,o,a,l;for(a=[],s=0,o=n.length;s<o;s++)r=n[s],(l=this.buildOptionListRow(e,r))&&(i=_.filter(t,(function(t){return t.parent_id===r.id})),(i=this.buildOptionListTreeRelation(t,e,i)).length>0&&(l.children=i),a.push(l));return a},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.active=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.OPTIONS=[{name:__("active"),value:!0},{name:__("inactive"),value:!1}],n.render=function(t,e){var n,i;return(n=$.extend(!0,{},t)).null=!1,n.translate=!0,n.options=$.extend(!0,[],this.OPTIONS),this.getConfigOptionList(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),(i=$(App.view("generic/select")({attribute:n}))).find("select").data("field-type","boolean"),i},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){App.UiElement.auth_provider=function(){function t(){}return t.render=function(t){var e,n,i,s;for(n in e=$.extend(!0,{},t),i=App.Config.get("auth_provider_all"))if((s=i[n]).config===e.provider){e.value=App.Config.get("http_type")+"://"+App.Config.get("fqdn")+s.url+"/callback";break}return $(App.view("generic/auth_provider")({attribute:e}))},t}()}.call(this),function(){App.UiElement.autocompletion=function(){function t(){}return t.render=function(t,e){var n,i,s,r;return null==e&&(e={}),i=$.extend(!0,{},t),e[i.name+"_autocompletion_value_shown"]&&(i.valueShown=e[i.name+"_autocompletion_value_shown"]),s=$(App.view("generic/autocompletion")({attribute:i})),r=this,n=function(){var t,n,s,o;if(n="#"+i.id,s="#"+i.id+"_autocompletion",r.callback=i.callback,r.callback&&i.value&&r.params&&r.callback(r.params),t=function(t,i){if($(n).val(i.id).trigger("change"),$(n+"_autocompletion_value_shown").val(i.value),
r.callback)return e=App.ControllerForm.params(form),r.callback(e)},"string"==typeof(o=i.source)&&(o=o.replace("#{@apiPath}",App.Config.get("api_path"))),$(s).autocomplete({source:o,minLength:i.minLengt||3,select:function(e,n){return t(e,n.item)}}),$(s).on("click",(function(){return $(this).autocomplete("search",$(s).val())})),i.value&&$(n).val(i.value),i.valueShown)return $(s).val(i.valueShown)},App.Delay.set(n,280,void 0,"form_autocompletion"),s},t}()}.call(this),function(){App.UiElement.autocompletion_ajax=function(){function t(){}return t.render=function(t,e,n){var i,s;return null==e&&(e={}),(e[t.name]||t.value)&&(i=App[t.relation].find(e[t.name]||t.value))&&(s=i.displayName()),new App.SearchableAjaxSelect({delegate:n,attribute:{value:e[t.name]||t.value,valueName:s,name:t.name,id:e.organization_id||t.id,placeholder:App.i18n.translateInline("Search\u2026"),limit:40,relation:t.relation,ajax:!0,multiple:t.multiple}}).element()},t}()}.call(this),function(){App.UiElement.autocompletion_ajax_customer_organization=function(){function t(){}return t.render=function(t,e,n){var i,s,r;return null==e&&(e={}),(e[(i=$.extend(!0,{},t)).name]||i.value)&&(s=App[i.relation].find(e[i.name]||i.value))&&(r=s.displayName()),new App.CustomerOrganizationAjaxSelect({delegate:n,attribute:{value:e[i.name]||i.value,valueName:r,name:i.name,id:e.organization_id||i.id,placeholder:App.i18n.translateInline("Search\u2026"),limit:40,relation:i.relation,ajax:!0,multiple:i.multiple,showArrowIcon:!0}}).element()},t}()}.call(this),function(){App.UiElement.autocompletion_ajax_external_data_source=function(){function t(){}return t.render=function(t,e,n){var i,s;return null==e&&(e={}),i=$.extend(!0,{},t),new App.ExternalDataSourceAjaxSelect({delegate:n,attribute:{value:e[i.name]||i.value,name:i.name,id:i.id,placeholder:App.i18n.translateInline("Search\u2026"),limit:40,relation:i.relation,ajax:!0,multiple:i.multiple,showArrowIcon:!0,attributeName:i.attributeName||i.name,objectName:i.objectName||(null!=n&&null!=(s=n.model)?s.className:void 0)}}).element()},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.autocompletion_ajax_search=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e,i){var s;return null==e&&(e={}),(s=$.extend(!0,{},t)).multiple=!0,n.__super__.constructor.render.call(this,s,e={},i)},n}(App.UiElement.autocompletion_ajax)}.call(this),function(){var t=[].slice;App.UiElement.basedate=function(){function e(){}return e.templateName=function(){throw"Must override in a subclass"},e.render=function(t){var e,n;return(e=$.extend(!0,{},t)).name&&(e.nameRaw=e.name,e.name="{"+this.templateName()+"}"+e.name),n=$(App.view("generic/"+this.templateName())({attribute:e})),$.fn.datepicker.defaults.template=App.view("generic/datepicker")(),$.fn.datepicker.dates.custom=this.buildCustomDates(),this.applyPickers(n,e),this.bindEvents(n,e),n},e.log=function(){var e,n,i;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(i=App.Log).debug.apply(i,["Ui.element."+this.templateName()+"."+n].concat(t.call(e)))},e.applyPickers=function(t,e){return t.find(".js-datepicker").datepicker({clearBtn:e.null,weekStart:1,autoclose:!0,todayBtn:"linked",todayHighlight:!0,format:App.i18n.timeFormat().FORMAT_DATE,rtl:"rtl"===App.i18n.dir(),container:t,language:"custom",orientation:e.orientation,disableScroll:e.disableScroll,calendarWeeks:App.Config.get("datepicker_show_calendar_weeks")}),this.setNewTimeInitial(t,e)},e.bindEvents=function(t,e){var n;return t.find("input").on("focus",(function(){return t.find(".js-datepicker").datepicker("rerender")})).on("keyup blur change",(n=this,function(){return n.setNewTime(t,e,0),n.validation(t,e,!0)})),t.on("validate",function(n){return function(){return n.validation(t,e)}}(this))},e.inputElement=function(t,e){return e.name?t.find('[name="'+e.name+'"]'):t.find('input[type="hidden"]')},e.setNewTime=function(t,e,n){var i;if(null==n&&(n=!1),i=this.currentInput(t,e)){if(this.validateInput(i))return this.inputElement(t,e).val(this.buildTimestamp(i));this.inputElement(t,e).val("")}},e.currentInput=function(t,e){var n,i,s,r;return(n=t.find(".js-datepicker").datepicker("getDate"))&&"Invalid Date"!==n.toString()?(this.log("setNewTime",n),r=n.getFullYear(),s=n.getMonth()+1,i=n.getDate(),[App.Utils.formatTime(r)+"-"+App.Utils.formatTime(s,2)+"-"+App.Utils.formatTime(i,2)]):(this.inputElement(t,e).val(""),!1)},e.validateInput=function(t){return""!==t[0]},e.buildTimestamp=function(){throw"Must override in a subclass"},e.dateSetter=function(){throw"Must override in a subclass"},e.setNewTimeInitial=function(t,e){var n,i;if(i=this.inputElement(t,e).val(),this.log("setNewTimeInitial",i),i)return n=new Date(Date.parse(i)),this.log("setNewTimeInitial",i,n),this.setTimestamp(t,n),t.find(".js-datepicker").datepicker("update");this.setNoTimestamp(t)},e.setNoTimestamp=function(){},e.setTimestamp=function(t,e){return t.find(".js-datepicker").datepicker(this.dateSetter(),e)},e.validation=function(t,e){var n,i,s,r,o;if("self"===e.validationContainer?t.find(".js-datepicker").removeClass("has-error"):(t.closest(".form-group").removeClass("has-error"),t.find(".has-error").removeClass("has-error"),t.find(".help-inline").html(""),t.closest(".form-group").find(".help-inline").html("")),n={},(o=this.inputElement(t,e).val())?new Date(Date.parse(o)):e.null||(n[e.name]="missing"),this.log("validation",n),!_.isEmpty(n)){if("self"===e.validationContainer)return t.find(".js-datepicker").addClass("has-error");for(s in i=t.closest(".form-group"),r=[],n)n[s],r.push(i.addClass("has-error"));return r}},e.buildCustomDates=function(){var t;return t={days:[__("Sunday"),__("Monday"),__("Tuesday"),__("Wednesday"),__("Thursday"),__("Friday"),__("Saturday")],daysMin:[__("Sun"),__("Mon"),__("Tue"),__("Wed"),__("Thu"),__("Fri"),__("Sat")],daysShort:[__("Sun"),__("Mon"),__("Tue"),__("Wed"),__("Thu"),__("Fri"),__("Sat")],months:[__("January"),__("February"),__("March"),__("April"),__("May"),__("June"),__("July"),__("August"),__("September"),__("October"),__("November"),__("December")],monthsShort:[__("Jan"),__("Feb"),__("Mar"),__("Apr"),__("May"),__("Jun"),__("Jul"),__("Aug"),__("Sep"),__("Oct"),__("Nov"),__("Dec")],today:__("today"),clear:__("clear")},App.i18n.translateDeepPlain(t)},e}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.boolean=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n,i;return n=$.extend(!0,{},t),_.isEmpty(n.options)?(n.options=[{name:__("yes"),value:!0},{name:__("no"),value:!1}],n.translate=!0):(_.isObject(n.options)&&_.every(_.values(n.options),(function(t){return/^(yes|no)$/i.test(t)}))||_.isArray(n.options)&&_.every(n.options,(function(t){return/^(yes|no)$/i.test(t.value)})))&&(n.translate=!0),this.getConfigOptionList(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),this.disabledOptions(n,e),this.filterOption(n,e),(i=$(App.view("generic/select")({attribute:n}))).find("select").data("field-type","boolean"),i},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){App.UiElement.business_hours=function(){function t(){}return t.render=function(t){var e,n;return(e=$.extend(!0,{},t)).nameRaw=e.name,e.name="{business_hours}"+e.name,e.value||(e.value={mon:{active:!0,timeframes:[["09:00","17:00"]]},tue:{active:!0,timeframes:[["09:00","17:00"]]},wed:{active:!0,timeframes:[["09:00","17:00"]]},thu:{active:!0,timeframes:[["09:00","17:00"]]},fri:{active:!0,timeframes:[["09:00","17:00"]]},sat:{active:!1,timeframes:[["10:00","14:00"]]},sun:{active:!1,timeframes:[["10:00","14:00"]]}}),(n=new App.BusinessHours({attribute:e,hours:e.value})).render(),n.el},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.checkbox=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n;return n=$.extend(!0,{},t),this.getConfigOptionList(n,e),this.getRelationOptionList(n,e),this.addNullOption(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),this.disabledOptions(n,e),this.filterOption(n,e),$(App.view("generic/checkbox")({attribute:n}))},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.checkboxTicketAttributes=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n,i,s,r,o,a;for(s in n=$.extend(!0,{},t),i=[],o=App.Ticket.attributesGet())"password"!==(a=o[s]).type&&"tag"!==a.type&&"tags"!==a.name&&(r=a.name,"_ids"===a.name.substr(a.name.length-4,4)?r=a.name.substr(0,a.name.length-4):"_id"===a.name.substr(a.name.length-3,3)&&(r=a.name.substr(0,a.name.length-3)),i.push({value:r,name:a.display}));return n.sortBy=null,n.item_class="checkbox",n.options=i,App.UiElement.checkbox.render(n,e)},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){App.UiElement.code_editor=function(){function t(){}return t.render=function(t){return new App.CodeEditor({attribute:t}).element()},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.color=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t){return new App.Color({attribute:t}).element()},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.column_select=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n;return(n=$.extend(!0,{},t)).multiple="multiple",this.getConfigOptionList(n,e),this.getRelationOptionList(n,e),this.addNullOption(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),this.disabledOptions(n,e),this.filterOption(n,e),new App.ColumnSelect({attribute:n}).element()},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.core_workflow_condition=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.defaults=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S,x,j,D;if(null==t&&(t={}),null==e&&(e={}),t.noNotSet=!0,o=[],this.hasEmptySelectorAtStart()||(o=["ticket.state_id"]),u={ticket:{name:__("Ticket"),model:"Ticket",model_show:["Ticket"]},article:{name:__("Article"),model:"TicketArticle",model_show:["Ticket"]},group:{name:__("Group"),model:"Group",model_show:["Group"]},user:{name:__("User"),model:"User",model_show:["User"]},customer:{name:__("Customer"),model:"User",model_show:["Ticket"]},organization:{name:__("Organization"),model:"Organization",model_show:["User","Organization"]},"customer.organization":{name:__("Organization"),model:"Organization",model_show:["Ticket"]},session:{name:__("Session"),model:"User",model_show:["Ticket","Group","User","Organization"]}},(j=this.coreWorkflowCustomModulesActive())&&(u.custom={name:__("Custom"),model_show:["Ticket","User","Organization","Sla"]}),s=e.object,void 0!==t.workflow_object&&(s=t.workflow_object),!_.isEmpty(s))for(f in u)r=u[f],_.contains(r.model_show,s)||delete u[f];if(t.disable_objects)for(p=0,m=(S=t.disable_objects).length;p<m;p++)delete u[f=S[p]];if(C={"^datetime$":[__("today"),__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)")],"^timestamp$":[__("today"),__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)")],"^date$":[__("today"),"before (absolute)","after (absolute)","before (relative)","after (relative)","within next (relative)","within last (relative)"],active$:[__("is")],boolean$:[__("is"),__("is not"),__("is set"),__("not set"),__("has changed"),__("changed to")],integer$:[__("is"),__("is not"),__("is set"),__("not set"),__("has changed"),__("changed to")],radio$:[__("is"),__("is not"),__("is set"),__("not set"),__("has changed"),__("changed to")],"^select$":[__("is"),__("is not"),__("is set"),__("not set"),__("has changed"),__("changed to")],"^multiselect$":[__("contains"),__("contains not"),__("contains all"),__("contains all not"),__("is set"),__("not set"),__("has changed"),__("changed to")],"^tree_select$":[__("is"),__("is not"),__("is set"),__("not set"),__("has changed"),__("changed to")],"^multi_tree_select$":[__("contains"),__("contains not"),__("contains all"),__("contains all not"),__("is set"),__("not set"),__("has changed"),__("changed to")],"^autocompletion_ajax_external_data_source$":[__("is"),__("is not"),__("is set"),__("not set"),__("has changed"),__("changed to")],"^input$":[__("is any of"),__("is none of"),__("starts with one of"),__("ends with one of"),__("matches regex"),__("does not match regex"),__("is set"),__("not set"),__("has changed"),__("changed to")],"^(textarea|richtext)$":[__("is"),__("is not"),__("starts with"),__("ends with"),__("matches regex"),__("does not match regex"),__("is set"),__("not set"),__("has changed"),__("changed to")],"^tag$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")]},A={_id$:[__("is"),__("is not"),__("is set"),__("not set"),__("has changed"),__("changed to")],_ids$:[__("is"),__("is not"),__("is set"),__("not set"),__("has changed"),__("changed to")]},t.disable_operators){for(f in C)D=C[f],C[f]=_.filter(D,(function(e){return!_.contains(t.disable_operators,e)}));for(f in A)D=A[f],A[f]=_.filter(D,(function(e){return!_.contains(t.disable_operators,e)}))}for(l in a={},u)if(c=u[l],"custom"!==l){for("session"===l&&(a["session.role_ids"]={name:"role_ids",display:__("Role"),tag:"select",relation:"Role",null:!1,operator:[__("is"),__("is not")],multiple:!0},a["session.group_ids_read"]={name:"group_ids_read",display:__("Group (read)"),tag:"select",relation:"Group",null:!1,operator:[__("is"),__("is not")],multiple:!0},a["session.group_ids_create"]={name:"group_ids_create",display:__("Group (create)"),tag:"select",relation:"Group",null:!1,operator:[__("is"),__("is not")],multiple:!0},a["session.group_ids_change"]={name:"group_ids_change",display:__("Group (change)"),tag:"select",relation:"Group",null:!1,operator:[__("is"),__("is not")],multiple:!0},a["session.group_ids_overview"]={name:"group_ids_overview",display:__("Group (overview)"),tag:"select",relation:"Group",null:!1,operator:[__("is"),__("is not")],multiple:!0},a["session.group_ids_full"]={name:"group_ids_full",display:__("Group (full)"),tag:"select",relation:"Group",null:!1,operator:[__("is"),__("is not")],multiple:!0},a["session.permission_ids"]={name:"permission_ids",display:__("Permissions"),tag:"select",relation:"Permission",null:!1,operator:[__("is"),__("is not")],multiple:!0}),d=0,v=(i=App.ObjectManagerAttribute.selectorAttributesByObject()[c.model]||[]).length;d<v;d++)if(n=i[d],("group"!==l||!_.contains(["name"],n.name))&&(n.objectName=c.model,n.attributeName=n.name,"password"!==n.type&&"_ids"!==n.name.substr(n.name.length-4,4)&&!1!==n.searchable)){for(k in n.default=void 0,"email"!==n.type&&"tel"!==n.type&&"url"!==n.type||(n.type="text"),(n.tag&&n.tag.match(/^(tree_)?select$/)||"autocompletion_ajax_external_data_source"===n.tag)&&(n.multiple=!0),C)w=C[k],b=new RegExp(k,"i"),n.tag&&n.tag.match(b)&&(n.operator=w),a[l+"."+n.name]=n;for(k in A)w=A[k],b=new RegExp(k,"i"),n.name&&n.name.match(b)&&(n.operator=w),a[l+"."+n.name]=n}}else{if(!j)continue;for(T={},h=0,g=(x=App.CoreWorkflowCustomModule.all()).length;h<g;h++)T[(y=x[h]).name]=y.name;a["custom.module"]={name:"module",display:__("Module"),tag:"select",multiple:!0,options:T,null:!1,operator:[__("match one module"),__("match all modules"),__("match no modules")]}}return a["ticket.mention_user_ids"]={name:"mention_user_ids",display:__("Subscribe"),tag:"autocompletion_ajax",relation:"User",null:!1,translate:!0,operator:[__("is"),__("is not")]},[o,u,a]},n.hasEmptySelectorAtStart=function(){return!0},n}(App.UiElement.ApplicationSelector)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.core_workflow_perform=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.defaults=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T;if(null==t&&(t={}),null==e&&(e={}),o=[],u={ticket:{name:"Ticket",model:"Ticket",model_show:["Ticket"]},group:{name:"Group",model:"Group",model_show:["Group"]},customer:{name:"Customer",model:"User",model_show:["User"]},organization:{name:"Organization",model:"Organization",model_show:["Organization"]}},(T=this.coreWorkflowCustomModulesActive())&&(u.custom={name:"Custom",model_show:["Ticket","User","Organization","Sla"]}),s=e.object,void 0!==t.workflow_object&&(s=t.workflow_object),!_.isEmpty(s))for(d in u)r=u[d],_.contains(r.model_show,s)||delete u[d];for(l in k={boolean$:["show","hide","remove","set_mandatory","set_optional","set_readonly","unset_readonly","add_option","remove_option","set_fixed_to"],integer$:["show","hide","remove","set_mandatory","set_optional","set_readonly","unset_readonly"],"^date":["show","hide","remove","set_mandatory","set_optional","set_readonly","unset_readonly"],"^(multi)?select$":["show","hide","remove","set_mandatory","set_optional","set_readonly","unset_readonly","add_option","remove_option","set_fixed_to","select","auto_select"],"^(multi_)?tree_select$":["show","hide","remove","set_mandatory","set_optional","set_readonly","unset_readonly","add_option","remove_option","set_fixed_to","select","auto_select"],"^(input|textarea)$":["show","hide","remove","set_mandatory","set_optional","set_readonly","unset_readonly","fill_in","fill_in_empty"],"^autocompletion_ajax_external_data_source$":["show","hide","remove","set_mandatory","set_optional","set_readonly","unset_readonly"]},w={_id$:["show","hide","set_mandatory","set_optional","set_readonly","unset_readonly","add_option","remove_option","set_fixed_to","select","auto_select"],_ids$:["show","hide","set_mandatory","set_optional","set_readonly","unset_readonly"],organization_id$:["show","hide","set_mandatory","set_optional","set_readonly","unset_readonly","add_option","remove_option"],owner_id$:["show","hide","set_mandatory","set_optional","set_readonly","unset_readonly","add_option","remove_option","select","auto_select"],title$:["set_readonly","unset_readonly","fill_in","fill_in_empty"],body$:["set_readonly","unset_readonly","fill_in","fill_in_empty"]},a={},u)if(c=u[l],"custom"!==l){for(i=App.ObjectManagerAttribute.selectorAttributesByObject()[c.model]||[],"Ticket"===c.model&&i.splice(_.findIndex(i,(function(t){return"title"===t.name}))+1,0,{name:"body",display:__("Text"),data_type:"richtext",tag:"richtext",rows:5,limit:100,null:!1}),h=0,m=i.length;h<m;h++)if(n=i[h],_.contains(["input","textarea","richtext","select","multiselect","integer","boolean","multi_tree_select","tree_select","autocompletion_ajax_external_data_source","date","datetime"],n.tag)&&!_.contains(["created_at","updated_at"],n.name)&&!("ticket"===l&&_.contains(["number","organization_id","escalation_at","first_response_escalation_at","update_escalation_at","close_escalation_at","last_contact_at","last_contact_agent_at","last_contact_customer_at","first_response_at","close_at"],n.name)||"group"===l&&_.contains(["name"],n.name)||"password"===n.type||"_ids"===n.name.substr(n.name.length-4,4)||!1===n.searchable)){for(b in n.default=void 0,"boolean"===n.tag&&(n.tag="select"),n.tag.match(/^(tree_)?select$/)&&(n.multiple=!0),"email"!==n.type&&"tel"!==n.type||(n.type="text"),k)y=k[b],v=new RegExp(b,"i"),n.tag&&n.tag.match(v)&&(n.operator=y),a[l+"."+n.name]=n;for(b in w)y=w[b],v=new RegExp(b,"i"),n.name&&n.name.match(v)&&(n.operator=y),a[l+"."+n.name]=n}}else{if(!T)continue;for(A={},p=0,f=(C=App.CoreWorkflowCustomModule.all()).length;p<f;p++)A[(g=C[p]).name]=g.name;a["custom.module"]={name:"module",display:__("Module"),tag:"select",multiple:!0,options:A,null:!1,operator:["execute"]}}return[o,u,a]},n.renderParamValue=function(t,e,n,i){var s,r,o,a,l,c,u,p,h;for(r in(u=this.defaults(e,n))[0],o=u[1],s=u[2],p=[],i)a=i[r],_.isArray(a.operator)||(a.operator=[a.operator]),p.push(function(){var n,i,u,p;for(p=[],n=0,i=(u=a.operator).length;n<i;n++)l=u[n],(c={}).operator=l,c[l]=a[l],h=this.rowContainer(o,s,e),this.rebuildAttributeSelectors(t,h,r,s,c,e),p.push(t.filter(".js-filter").append(h));return p}.call(this));return p},n.buildValueConfigValue=function(t,e,n,i,s,r){var o;return o=e.find(".js-operator option:selected").attr("value"),_.clone(r.value[n][o])},n.buildValueName=function(t,e,n,i,s,r,o){var a,l;return l=o?"{"+o+"}":"",a=e.find(".js-operator option:selected").attr("value"),""+l+r.name+"::"+n+"::"+a},n.buildValue=function(t,e,i,s,r,o){var a,l;if(a=e.find(".js-operator option:selected").attr("value"),l=this.buildValueName(t,e,i,s,r,o),_.contains(["add_option","remove_option","set_fixed_to","select","execute","fill_in","fill_in_empty"],a))return n.__super__.constructor.buildValue.call(this,t,e,i,s,r,o);e.find(".js-value").addClass("hide").html('<input type="hidden" name="'+l+'" value="true" />')},n.buildValueConfigMultiple=function(t,e){return _.contains(["add_option","remove_option","set_fixed_to","select"],e.operator)?(t.multiple=!0,t.data_type.match(/^(tree_)?select$/)&&"select"===e.operator&&(t.multiple=!1),t.nulloption=!0):(t.multiple=!1,t.nulloption=!1),t},n.renderConfig=function(t,e){var n;return _.contains(["add_option","remove_option","set_fixed_to"],e.operator)&&(n=t.tag+"_search",App.UiElement[n])?App.UiElement[n].render(t,{}):App.UiElement[t.tag].render(t,{})},n.mapOperatorDisplayName=function(t){return{show:__("show"),hide:__("hide"),add:__("add"),remove:__("remove"),set_mandatory:__("set mandatory"),set_optional:__("set optional"),set_readonly:__("set readonly"),unset_readonly:__("unset readonly"),add_option:__("add option"),remove_option:__("remove option"),set_fixed_to:__("set fixed to"),select:__("select"),auto_select:__("auto select"),fill_in:__("fill in"),fill_in_empty:__("fill in empty")}[t]||t},n.HasPreCondition=function(){return!1},n.hasEmptySelectorAtStart=function(){return!0},n.hasDuplicateSelector=function(){return!0},n.tokenfieldTagRegex=function(){return!1},n}(App.UiElement.ApplicationSelector)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.date=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.templateName=function(){return"date"},n.buildTimestamp=function(t){return t[0]},n.dateSetter=function(){return"setUTCDate"},n}(App.UiElement.basedate)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.datetime=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.templateName=function(){return"datetime"},n.applyPickers=function(t,e){return n.__super__.constructor.applyPickers.call(this,t,e),t.find(".js-timepicker").timepicker()},n.currentInput=function(t,e){var i;return i=n.__super__.constructor.currentInput.call(this,t,e),_.isArray(i)&&i.push(t.find(".js-timepicker").val()),i},n.validateInput=function(t){return""!==t[0]||""!==t[1]},n.setNoTimestamp=function(t){return t.find(".js-timepicker").val("08:00")},n.setTimestamp=function(t,e){var i,s,r;return n.__super__.constructor.setTimestamp.call(this,t,e),i=e.getHours(),s=e.getMinutes(),r=App.Utils.formatTime(i,2)+":"+App.Utils.formatTime(s,2),t.find(".js-timepicker").val(r)},n.buildTimestamp=function(t){var e,n;return n=t[0]+"T"+t[1]+":00.000Z",e=new Date(Date.parse(n)),isNaN(e)?"":(e.setMinutes(e.getMinutes()+e.getTimezoneOffset()),this.log("setNewTime",e.toString()),e.toISOString().replace(/\d\d\.\d\d\dZ$/,"00.000Z"))},n.dateSetter=function(){return"setDate"},n}(App.UiElement.basedate)}.call(this),function(){App.UiElement.datetime_search=function(){function t(){}return t.render=function(t){var e;return(e=$.extend(!0,{},t)).disable_feature=!0,e.null=!1,App.UiElement.datetime.render(e)},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.group_permissions=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n,i,s;return null==e&&(e={}),i=(n=App.Group.search({sortBy:"name"}).filter((function(t){return t.active}))).filter((function(t){return e.group_ids&&!_.isEmpty(e.group_ids[t.id])})),s=$(App.view("generic/user_permission_group")({params:e,groupsSelected:i,groupAccesses:App.Group.accesses()})),this.renderNewGroupDropdown(s,n),this.attachGroupsEvents(s,n),s.on("click",".checkbox-replacement",(function(t){return App.PermissionHelper.switchGroupPermission(t)})),s},n.renderNewGroupDropdown=function(t,e){var n,i,s;return s=t.find("tr[data-id]").toArray().map((function(t){return parseInt(t.dataset.id)})),n={value:"",nulloption:!0,null:!0,relation:"Group",filter:e.filter((function(t){return!_.include(s,t.id)})).map((function(t){return t.id.toString()}))},i=App.UiElement.ApplicationTreeSelect.render(n),t.find(".js-groupListItemAddNew").html(i),i.find(".js-shadow").trigger("change")},n.attachGroupsEvents=function(t,e){return t.on("click",".js-remove",(n=this,function(i){return n.onRemoveGroup(i,t,e)})).on("click",".js-add",function(n){return function(i){return n.onAddGroup(i,t,e)}}(this));var n},n.onRemoveGroup=function(t,e,n){return t.stopPropagation(),t.preventDefault(),t.target.closest("tr").remove(),this.renderNewGroupDropdown(e,n)},n.onAddGroup=function(t,e,n){var i,s,r,o;if(t.stopPropagation(),t.preventDefault(),s=parseInt(e.find(".js-shadow").val()),$(t.target.closest("tr")).find(".js-input").toggleClass("has-error",!s),s)return i=_.find(n,(function(t){return t.id===s})),o=e.find(".js-groupListShadowItemRow"),(r=o.clone().removeClass("hide js-groupListShadowItemRow").attr("data-id",i.id)).find("td:first-child").text(i.displayName()),$(t.target.closest("tr")).find(".js-groupListItem").each((function(t,e){var n,i;return n=e.checked,i=e.value,r.find(".js-groupListItem[value="+i+"]").prop("checked",n).attr("name","group_ids::"+s)})).prop("checked",!1),r.insertBefore(o),this.renderNewGroupDropdown(e,n)},n}(Spine.Module)}.call(this),function(){App.UiElement.holiday_selector=function(){function t(){}return t.render=function(t){var e,n,i,s,r,o,a,l,c;if(s={},t.value)for(s=t.value,r={},a=0,c=(o=_.keys(s).sort()).length;a<c;a++)r[i=o[a]]=s[i];return(l=$(App.view("calendar/holiday_selector")({attribute:t,days:r}))).find(".js-boolean").data("field-type","boolean"),e={name:t.name+"_date",disable_feature:!0,class:"form-control--small",validationContainer:"self"},n=App.UiElement.date.render(e),l.find(".js-datePicker").html(n),l.on("click",".js-active",(function(t){var e,n,i;return e=$(t.target).prop("checked"),i=$(t.target).closest("tr"),n=$(t.target).closest("tr").find(".js-summary"),e?(i.removeClass("is-inactive"),n.prop("readonly",!1),n.removeClass("is-disabled")):(i.addClass("is-inactive"),n.prop("readonly",!0),n.addClass("is-disabled"))})),l.on("click",".js-remove",(function(t){return $(t.target).closest("tr").remove()})),l.find(".js-summary").on("keydown",(function(t){if(13===t.which)return t.preventDefault(),l.find(".js-add").trigger("click")})),l.find(".js-add").on("click",(function(t){var e,n,i;if((e=$(t.target).closest("tr").find('[name="{date}public_holidays_date"]').val())&&(n=$(t.target).closest("tr").find(".js-summary").val())){if(!l.find("[data-date="+e+"]").get(0))return $(t.target).closest("tr").find(".js-summary").val(""),i=App.view("calendar/holiday_selector_placeholder")({placeholderDate:e,placeholderSummary:n,nameSummary:"public_holidays::"+e+"::summary",nameActive:"public_holidays::"+e+"::active"}),l.find(".settings-list-controlRow").before(i),l.find(".js-boolean").data("field-type","boolean");alert(App.i18n.translateInline("This entry already exists!"))}})),l},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.ical_feed=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t){var e,n,i,s,r,o,a;return e=App.Config.get("ical_feeds")||{},i=_.mapObject(e,(function(t){return App.i18n.translateContent(t)})),n=App.Utils.sortByValue(i),s=$(App.view("generic/ical_feed")({attribute:t,icalFeeds:n})),r=function(){if(!s.find(".js-checkList").prop("checked")&&s.find(".js-list").val())return s.find(".js-checkList").prop("checked",!0),s.find(".js-checkManual").prop("checked",!1)},o=function(){if(!s.find(".js-checkManual").prop("checked"))return s.find(".js-checkList").prop("checked",!1),s.find(".js-checkManual").prop("checked",!0)},a=function(t){return t||(t=s.find(".js-check:checked").attr("value")),"manual"===t?s.find(".js-shadow").val(s.find(".js-manual").val()):s.find(".js-shadow").val(s.find(".js-list").val())},e[t.value]?r():(o(),s.find(".js-manual").val(t.value)),s.find(".js-check").on("change",(function(){return a()})),s.find(".js-list").on("click change",(function(){return r(),a("list")})),s.find(".js-manual").on("keyup focus blur",(function(){return o(),a("manual")})),s},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.icon_picker=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t){return new App.IconPicker({attribute:t}).element()},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.iconset_picker=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t){return new App.IconsetPicker({attribute:t}).element()},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){App.UiElement.input=function(){function t(){}return t.render=function(t){return $(App.view("generic/input")({attribute:t}))},t}()}.call(this),function(){App.UiElement.integer=function(){function t(){}return t.render=function(t){var e,n;return(e=$.extend(!0,{},t)).type="number",e.step="1",(n=$(App.view("generic/input")({attribute:e}))).data("field-type","integer"),n},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.multi_locales=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e,n){var i;return new App.MultiLocales({attribute:t,object:null!=n&&null!=(i=n.parentController)?i.object():void 0}).el},n.prepareParams=function(t,e,n){var i
;if("string"==typeof n[t.name]&&(n[t.name]=[n[t.name]]),Array.isArray(n[t.name]))return i=e.find("[name="+t.name+"_primary_locale_id]:checked").val(),n[t.name+"_attributes"]=n[t.name].filter((function(t){return t})).map((function(t){var n,s,r;return n={system_locale_id:t,primary:t===i},(s=e.find(".js-primary input[value="+t+"]").closest("tr")).hasClass("settings-list--deleted")&&(n._destroy="1"),(r=s.data("kbLocaleId"))&&(n.id=parseInt(r)),n})),delete n[""+t.name],delete n[t.name+"_primary_locale_id"]},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.multi_tree_select=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){return $.extend(!0,{},t).multiple="multiple",n.__super__.constructor.render.apply(this,arguments)},n}(App.UiElement.ApplicationTreeSelect)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.multiselect=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e,n){var i;return null==n&&(n={}),(i=$.extend(!0,{},t)).multiple="multiple",i.class?i.class=i.class+" multiselect":i.class="multiselect",n.rejectNonExistentValues&&(i.rejectNonExistentValues=!0),this.addDeletedOptions(i,e),this.getConfigCustomSortOptionList(i),this.getRelationOptionList(i,e),this.addNullOption(i,e),this.sortOptions(i,e),this.selectedOptions(i,e),this.disabledOptions(i,e),this.filterOption(i,e),$(App.view("generic/select")({attribute:i}))},n._selectedOptionsIsSelected=function(t,e){var n,i,s;if(_.isArray(t))for(n=0,i=t.length;n<i;n++)if(s=t[n],this._selectedOptionsIsSelectedItem(s,e))return!0;return!1},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.multiselect_search=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n;return(n=$.extend(!0,{},t)).multiple="multiple",delete n.filter,this.getConfigOptionList(n,e),this.getRelationOptionList(n,e),this.addNullOption(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),this.disabledOptions(n,e),this.filterOption(n,e),$(App.view("generic/select")({attribute:n}))},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){App.UiElement.notification_matrix=function(){function t(){}return t.render=function(t){var e;return e={create:{name:__("New Ticket")},update:{name:__("Ticket update")},reminder_reached:{name:__("Ticket reminder reached")},escalation:{name:__("Ticket escalation")}},$(App.view("generic/notification_matrix")({matrixYAxe:e,values:t}))},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.object_manager_attribute=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n,i,s,r,o,a;return null==e&&(e={}),e.data_option_new&&!_.isEmpty(e.data_option_new)&&(e.data_option=e.data_option_new),/^(multi)?select$/.test(t.value)&&null!=e.data_option&&null!=e.data_option.options&&(e.data_option.mapped=this.mapDataOptions(e.data_option)),s=$(App.view("object_manager/attribute")({attribute:t})),a=this,o=function(n,i,s,r,o){var l,c,u;if(n.data_type)return c=$(App.view("object_manager/attribute/"+n.data_type)({attribute:t,params:e})),a[n.data_type](c,n,e,t),(u=o.closest(".js-data")).find(".js-dataMap").html(c),u.find(".js-dataScreens").html(a.dataScreens(t,n,e)),l=void 0,a[n.data_type+"_callback"]&&(l=a[n.data_type+"_callback"]),a.addDragAndDrop(u,l)},r=[{name:__("Text field"),value:"input"},{name:__("Textarea field"),value:"textarea"},{name:__("Boolean field"),value:"boolean"},{name:__("Integer field"),value:"integer"},{name:__("Date field"),value:"date"},{name:__("Date & time field"),value:"datetime"},{name:__("Single selection field"),value:"select"},{name:__("Multiple selection field"),value:"multiselect"},{name:__("Single tree selection field"),value:"tree_select"},{name:__("Multiple tree selection field"),value:"multi_tree_select"},{name:__("External data source field"),value:"autocompletion_ajax_external_data_source",filterCallback:function(){return App.Config.get("column_type_json_supported")}}],e.data_type&&(r=_.filter(r,(function(t){return t.value===e.data_type})),t.disabled=!0),i=function(t){return _.filter(t,(function(t){return"function"!=typeof t.filterCallback||t.filterCallback()}))},n=[{name:t.name,display:"",tag:"select",null:!1,options:r,translate:!0,default:"input",disabled:t.disabled,filter:i}],new App.ControllerForm({el:s.find(".js-dataType"),model:{configure_attributes:n},noFieldset:!0,handlers:[o],params:e}),s.find(".js-boolean").data("field-type","boolean"),s.find('.js-dataType [name="data_type"]').trigger("change"),s},n.dataScreens=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d,f,m;if(u=n.object,p={Ticket:{"ticket.customer":{create_middle:{shown:!0,required:!1},edit:{shown:!0,required:!1}},"ticket.agent":{create_middle:{shown:!0,required:!1},edit:{shown:!0,required:!1}}},User:{"ticket.customer":{create:{shown:!0,required:!1},view:{shown:!0},signup:{shown:!1,required:!1}},"ticket.agent":{create:{shown:!0,required:!1},edit:{shown:!0,required:!1},view:{shown:!0},invite_customer:{shown:!1,required:!1}},"admin.user":{create:{shown:!0,required:!1},edit:{shown:!0,required:!1},view:{shown:!0},invite_agent:{shown:!1,required:!1},invite_customer:{shown:!1,required:!1}}},Organization:{"ticket.customer":{view:{shown:!0}},"ticket.agent":{create:{shown:!0,required:!1},edit:{shown:!0,required:!1},view:{shown:!0}},"admin.organization":{create:{shown:!0,required:!1},edit:{shown:!0,required:!1},view:{shown:!0}}},Group:{"admin.group":{create:{shown:!0,required:!1},edit:{shown:!0,required:!1},view:{shown:!0}}}},a=!1,n&&!n.id&&(a=!0),r=p[u],a)for(d in r)for(f in m=r[d])for(c in h=m[f])o=h[c],n.screens||(n.screens={}),(i=n.screens)[f]||(i[f]={}),(s=n.screens[f])[d]||(s[d]={}),n.screens[f][d][c]=o;return(l=$(App.view("object_manager/screens")({attribute:t,data:p[u],params:n,init:a}))).find(".js-boolean").data("field-type","boolean"),l},n.addOptionTranslate=function(t,e){var n,i;return e.data_option||(e.data_option={}),void 0===e.data_option.translate&&(e.data_option.translate=!1),n=[{name:"data_option::translate",display:__("Translate field contents"),tag:"boolean",null:!0,default:!1}],i=new App.ControllerForm({model:{configure_attributes:n},noFieldset:!0,params:e}),t.find(".js-inputTranslate").html(i.form)},n.input=function(t,e,n){var i,s,r,o,a;return i=[{name:"data_option::default",display:__("Default"),tag:"input",type:"text",null:!0,default:""}],s=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::type",display:__("Type"),tag:"select",null:!1,default:"text",options:{text:__("Text"),tel:"Phone",email:"Email",url:"Url"},translate:!0}],a=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::maxlength",display:__("Max. length"),tag:"integer",null:!1,default:120}],o=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::linktemplate",display:__("Link template"),tag:"input",type:"text",null:!0,default:"",placeholder:__("https://example.com/?q=#{object.attribute_name} - use ticket, user or organization as object")}],r=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputDefault").html(s.form),t.find(".js-inputType").html(a.form),t.find(".js-inputMaxlength").html(o.form),t.find(".js-inputLinkTemplate").html(r.form),t.find("select[name='data_option::type']").on("change",(function(t){return"url"===$(t.target).val()?r.hide("data_option::linktemplate",void 0,!0):r.show("data_option::linktemplate")})),t.find("select[name='data_option::type']").trigger("change")},n.textarea=function(t,e,n){var i,s,r,o;return i=[{name:"data_option::default",display:__("Default"),tag:"input",type:"text",null:!0,default:""}],s=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::maxlength",display:__("Max. length"),tag:"integer",null:!1,default:500}],r=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::rows",display:__("Rows"),tag:"integer",null:!1,default:4}],o=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputDefault").html(s.form),t.find(".js-inputMaxlength").html(r.form),t.find(".js-inputRows").html(o.form)},n.datetime=function(t,e,n){var i,s,r,o;return i=[{name:"data_option::future",display:__("Allow future"),tag:"boolean",null:!1,default:!0}],r=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::past",display:__("Allow past"),tag:"boolean",null:!1,default:!0}],o=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::diff",display:__("Default time diff (minutes)"),tag:"integer",null:!0}],s=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-datetimeFuture").html(r.form),t.find(".js-datetimePast").html(o.form),t.find(".js-datetimeDiff").html(s.form)},n.date=function(t,e,n){var i,s;return i=[{name:"data_option::diff",display:__("Default time diff (hours)"),tag:"integer",null:!0}],s=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-dateDiff").html(s.form)},n.integer=function(t,e,n){var i,s,r,o;return i=[{name:"data_option::default",display:__("Default"),tag:"integer",null:!0,default:"",min:1}],s=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::min",display:__("Minimal"),tag:"integer",null:!1,default:0,min:-2147483647,max:2147483647}],o=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),i=[{name:"data_option::max",display:__("Maximal"),tag:"integer",null:!1,min:-2147483647,max:2147483647,default:999999999}],r=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-integerDefault").html(s.form),t.find(".js-integerMin").html(o.form),t.find(".js-integerMax").html(r.form)},n.select=function(t,e,n){var i,s,r;return t.find(".js-add").on("click",(function(e){var n,i,s,r,o;return i=(n=$(e.target).closest("tr")).find(".js-key").val(),o=n.find(".js-value").val(),n.find(".js-selected[value]").attr("value",i),r=n.find(".js-selected").prop("checked"),(s=t.find(".js-template").clone().removeClass("js-template")).find(".js-key").val(i),s.find(".js-value").val(o),s.find(".js-value[value]").attr("name","data_option::options::"+i),s.find(".js-selected").prop("checked",r),s.find(".js-selected").val(i),s.find(".js-selected").attr("name","data_option::default"),t.find(".js-Table tr").last().before(s),n.find(".js-key").val(""),n.find(".js-value").val(""),n.find(".js-selected").prop("checked",!1)})),t.on("change",".js-key",(function(t){var e;return e=$(t.target).val(),$(t.target).closest("tr").find(".js-value[name]").attr("name","data_option::options::"+e)})),t.on("click",".js-remove",(function(t){return $(t.target).closest("tr").remove()})),r=void 0,t.on("click",".js-selected",(function(t){var e,n;return e=$(t.target).prop("checked"),n=$(t.target).attr("value"),e&&r&&r===n?($(t.target).prop("checked",!1),void(r=!1)):r=n})),i=[{name:"data_option::linktemplate",display:__("Link template"),tag:"input",type:"text",null:!0,default:"",placeholder:"https://example.com/?q=#{ticket.attribute_name}"}],s=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputLinkTemplate").html(s.form),this.addOptionTranslate(t,n)},n.multiselect=function(t,e,n){var i,s,r;return t.find(".js-add").on("click",(function(e){var n,i,s,r,o;return i=(n=$(e.target).closest("tr")).find(".js-key").val(),o=n.find(".js-value").val(),n.find(".js-selected[value]").attr("value",i),r=n.find(".js-selected").prop("checked"),(s=t.find(".js-template").clone().removeClass("js-template")).find(".js-key").val(i),s.find(".js-value").val(o),s.find(".js-value[value]").attr("name","data_option::options::"+i),s.find(".js-selected").prop("checked",r),s.find(".js-selected").val(i),s.find(".js-selected").attr("name","data_option::default"),t.find(".js-Table tr").last().before(s),n.find(".js-key").val(""),n.find(".js-value").val(""),n.find(".js-selected").prop("checked",!1)})),t.on("change",".js-key",(function(t){var e;return e=$(t.target).val(),$(t.target).closest("tr").find(".js-value[name]").attr("name","data_option::options::"+e)})),t.on("click",".js-remove",(function(t){return $(t.target).closest("tr").remove()})),r=void 0,t.on("click",".js-selected",(function(t){var e,n;return e=$(t.target).prop("checked"),n=$(t.target).attr("value"),e&&r&&r===n?($(t.target).prop("checked",!1),void(r=!1)):r=n})),i=[{name:"data_option::linktemplate",display:"Link-Template",tag:"input",type:"text",null:!0,default:"",placeholder:"https://example.com/?q=#{ticket.attribute_name}"}],s=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputLinkTemplate").html(s.form),this.addOptionTranslate(t,n)},n.setRowLevel=function(t,e){var n;return(n=t.find("td:nth-child(1)")).css("padding-left",20*e+10+"px"),n.closest("tr").attr("level",e),t.find(".js-key").attr("level",e),t.find("td:nth-child(2)").first().css("padding-left",20*e+10+"px")},n.buildRow=function(t,e,n,i){var s,r,o,a,l,c;if(null==n&&(n=0),(o=t.find(".js-template").clone().removeClass("js-template")).find(".js-key").attr("level",n),o.find(".js-key").val(e.name),this.setRowLevel(o,n),5===n&&o.find(".js-addChild").addClass("hide"),i)i.after(o);else if(t.find(".js-treeTable").append(o),e.children){for(l=[],s=0,r=(a=e.children).length;s<r;s++)c=a[s],l.push(this.buildRow(t,c,n+1));return l}},n.findParent=function(t,e,n){var i;return(i=$(t).closest("tr")).nextAll().each((function(){return(parseInt($(this).find(".js-key").attr("level"))>e&&"first"===n||parseInt($(this).find(".js-key").attr("level"))>=e&&"last"===n)&&(i=$(this),!0)})),i},n.multi_tree_select=function(t,e,i,s){return n.tree_select(t,e,i,s)},n.multi_tree_select_callback=function(t,e){return n.tree_select_callback(t,e)},n.tree_select=function(t,e,n){var i,s,r,o,a,l,c,u;if(t.find("td.table-draggable").attr("title",App.i18n.translateInline("Use double click to change level of the row.")),n.data_option||(n.data_option={}),(i=n.data_option).options||(i.options=[]),_.isEmpty(n.data_option.options))this.buildRow(t,{});else for(o=0,a=(l=n.data_option.options).length;o<a;o++)s=l[o],this.buildRow(t,s);if(t.on("click",".js-addRow",(u=this,function(e){var n,i;return e.stopPropagation(),e.preventDefault(),i=parseInt($(e.currentTarget).closest("tr").find(".js-key").attr("level")),n=u.findParent(e.currentTarget,i,"first"),u.buildRow(t,{},i,n)})),t.on("click",".js-addChild",function(e){return function(n){var i,s;return n.stopPropagation(),n.preventDefault(),s=parseInt($(n.currentTarget).closest("tr").find(".js-key").attr("level"))+1,i=e.findParent(n.currentTarget,s,"last"),e.buildRow(t,{},s,i)}}(this)),t.on("click",".js-remove",function(e){return function(n){var i,s,r,o,a,l,c;for(n.stopPropagation(),n.preventDefault(),n.stopPro,i=$(n.target).closest("tr"),a=parseInt(i.find(".js-key").attr("level")),c=0,l=i,s=[i];(l=l.next()).get(0)&&!(parseInt(l.find(".js-key").attr("level"))<=a);)c+=1,s.push(l);if(0===c||confirm("Delete "+c+" sub elements?")){for(r=0,o=s.length;r<o;r++)(i=s[r]).remove();return e.ensureOneOption(t)}}}(this)),t.find(".js-addChild").length>0)return c=this.setRowLevel,r=this.fixUnalignedRows,t.on("dblclick",".icon-draggable",(function(){var e,n,i;return i=$(this).closest("tr"),e=parseInt(i.attr("level"))||0,n=parseInt(i.prev().attr("level"))||0,c(i,e+1<=n+1?e+1:0),r(t.find("tbody.table-sortable tr"))})),this.addOptionTranslate(t,n)},n.tree_select_callback=function(t,e){var i,s,r;return s=e.item.first(),r=parseInt(s.prev().attr("level"))||0,n.setRowLevel(s,r),i=s.closest("tbody").find("tr"),n.fixUnalignedRows(i)},n.fixUnalignedRows=function(t){var e,i;return i=n.setRowLevel,e=[0],t.each((function(){var t,n,s;return t=parseInt($(this).attr("level"))||0,s=$(this).prev(),n=parseInt(s.attr("level"))||0,0===s.length?i($(this),0):0===t||t===e[e.length-1]+1||_.contains(e,t)?(t<n&&(e=_.range(t+1)),_.contains(e,t)||e.push(t),!0):i($(this),Math.max(n,Math.min(n+1,t)))}))},n.boolean=function(t,e,n){var i;return i=void 0,t.on("click",".js-selected",(function(t){var e,n;return e=$(t.target).prop("checked"),n=$(t.target).attr("value"),e&&i&&i===n?($(t.target).prop("checked",!1),void(i=!1)):i=n})),this.addOptionTranslate(t,n)},n.autocompletion=function(t,e,n){var i,s,r,o;return o=[{name:"data_option::default",display:__("Default"),tag:"input",type:"text",null:!0,default:""}],i=new App.ControllerForm({model:{configure_attributes:o},noFieldset:!0,params:n}),o=[{name:"data_option::url",display:__("URL (AJAX endpoint)"),tag:"input",type:"url",null:!1,default:"",placeholder:"https://example.com/serials"}],r=new App.ControllerForm({model:{configure_attributes:o},noFieldset:!0,params:n}),o=[{name:"data_option::method",display:__("Method (AJAX endpoint)"),tag:"input",type:"url",null:!1,default:"",placeholder:__("GET")}],s=new App.ControllerForm({model:{configure_attributes:o},noFieldset:!0,params:n}),t.find(".js-autocompletionDefault").html(i.form),t.find(".js-autocompletionUrl").html(r.form),t.find(".js-autocompletionMethod").html(s.form)},n.autocompletion_ajax_external_data_source=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y;return i=[{name:"data_option::search_url",display:__("Search URL"),tag:"input",type:"text",null:!1,default:"",placeholder:"https://example.com/search?query=#{search.term}"}],m=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputSearchURL").html(m.form),i=[{name:"data_option::verify_ssl",display:__("SSL verification"),tag:"boolean",null:!0,default:!0,translate:!0}],u=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputSSLVerify").html(u.form),y=function(t){var e,n;return n="true"!==(e=$(t.target)).val(),e.closest(".js-dataOption").find(".js-sslVerifyAlert").toggleClass("hide",!n)},t.find('select[name="data_option::verify_ssl"]').off("change.toggleSslVerifyAlert").on("change.toggleSslVerifyAlert",y),y({target:t.find('select[name="data_option::verify_ssl"]')}),i=[{name:"data_option::http_auth_type",display:__("HTTP Authentication"),tag:"select",null:!0,nulloption:!0,default:"",options:{basic_auth:__("Basic Authentication"),bearer_token:__("Authentication Token")},translate:!0}],o=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputHTTPAuthType").html(o.form),i=[{name:"data_option::http_basic_auth_username",display:__("HTTP Basic Authentication username"),tag:"input",type:"text",null:!0,default:"",placeholder:""}],l=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputHTTPBasicAuthUsername").html(l.form),i=[{name:"data_option::http_basic_auth_password",display:__("HTTP Basic Authentication password"),tag:"input",type:"text",null:!0,default:"",placeholder:""}],a=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputHTTPBasicAuthPassword").html(a.form),i=[{name:"data_option::bearer_token_auth",display:__("HTTP Authentication token"),tag:"input",type:"text",null:!0,default:"",placeholder:""}],r=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputBearerTokenAuth").html(r.form),v=function(t){switch(t){case"basic_auth":return l.show("data_option::http_basic_auth_username"),a.show("data_option::http_basic_auth_password"),a.show("data_option::http_basic_auth_password_confirm"),r.hide("data_option::bearer_token_auth",void 0,!0);case"bearer_token":return l.hide("data_option::http_basic_auth_username",void 0,!0),a.hide("data_option::http_basic_auth_password",void 0,!0),a.hide("data_option::http_basic_auth_password_confirm",void 0,!0),r.show("data_option::bearer_token_auth");default:return l.hide("data_option::http_basic_auth_username",void 0,!0),a.hide("data_option::http_basic_auth_password",void 0,!0),a.hide("data_option::http_basic_auth_password_confirm",void 0,!0),r.hide("data_option::bearer_token_auth",void 0,!0)}},t.find("select[name='data_option::http_auth_type']").on("change",(function(t){var e;return e=$(t.target).val(),v(e)})),v(null!=n&&null!=(g=n.data_option)?g.http_auth_type:void 0),i=[{name:"data_option::search_result_list_key",display:__("Search result list key"),tag:"input",type:"text",null:!0,default:"",placeholder:""}],h=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputSearchResultListKey").html(h.form),i=[{name:"data_option::search_result_value_key",display:__("Search result value key"),tag:"input",type:"text",null:!0,default:"",placeholder:""}],d=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputSearchResultValueKey").html(d.form),i=[{name:"data_option::search_result_label_key",display:__("Search result label key"),tag:"input",type:"text",null:!0,default:"",placeholder:""}],p=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputSearchResultLabelKey").html(p.form),i=[{name:"data_option::linktemplate",display:__("Link template"),tag:"input",type:"text",null:!0,default:"",placeholder:"https://example.com/?q=#{ticket.attribute_name}"}],c=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0,params:n}),t.find(".js-inputLinkTemplate").html(c.form),i=[{id:"inputSearchTerm",name:"query",display:__("Preview"),tag:"input",type:"text",null:!0,default:"",placeholder:__("Search\u2026")}],f=new App.ControllerForm({model:{configure_attributes:i},noFieldset:!0}),t.find(".js-inputSearchTerm").html(f.form),s=_.debounce(this.previewExternalDataSource,300),t.off("input.previewExternalDataSource").on("input.previewExternalDataSource",(function(t){return s(t,n.object)}))},n.previewExternalDataSource=function(t,e){var i,s,r,o;if(s=$(t.target).closest(".js-dataMap"),n.resetExternalDataSourcePreview(s),null!=(o=(r=App.ControllerForm.params($(t.target).closest("form"))).query)?o.trim():void 0)return s.find(".js-previewInfo").addClass("hide"),s.find(".js-loading").removeClass("hide"),i=_.extend({},{data_option:r.data_option,query:r.query,limit:10}),App.Ajax.request({id:"previewExternalDataSource",type:"POST",url:App.Config.get("api_path")+"/external_data_source/preview",data:JSON.stringify(i),success:function(t){var n,i,o,a,l,c,u,p,h,d;if(i=t.data,a=t.parsed_items,c=t.response_body,h=t.success,o=t.error,s.find(".js-loading").addClass("hide"),c&&(n=[{id:"searchResultResponse",name:"search_result_response",display:__("Search result response"),tag:"code_editor",null:!0,disabled:!0,lineNumbers:!1,height:160,value:JSON.stringify(c,null,2)}],p=new App.ControllerForm({model:{configure_attributes:n},noFieldset:!0}),s.find(".js-searchResultResponse").html(p.form)),a&&(n=[{id:"searchResultList",name:"search_result_list",display:__("Search result list"),tag:"code_editor",null:!0,disabled:!0,lineNumbers:!1,height:160,value:JSON.stringify(a,null,2)}],u=new App.ControllerForm({model:{configure_attributes:n},noFieldset:!0}),s.find(".js-searchResultList").html(u.form)),i&&(d=$('<table class="settings-list settings-list--stretch"><thead><tr /></thead><tbody /></table>'),_.isEmpty(i)?($("<th />").text(App.i18n.translatePlain("No Entries")).appendTo(d.find("thead tr")),d.addClass("settings-list--placeholder"),s.find(".js-searchResultSample").html(d)):($("<th />").text(App.i18n.translatePlain("Value")).appendTo(d.find("thead tr")),$("<th />").text(App.i18n.translatePlain("Label")).appendTo(d.find("thead tr")),(null!=(l=r.data_option)?l.linktemplate:void 0)&&$("<th />").text(App.i18n.translatePlain("Link")).addClass("centered").appendTo(d.find("thead tr")),_.each(i,(function(t){var n,i,s,o,a,l,c,u,p,h,f;return f=$("<td />").addClass("search-result-value").text(t.value),c=$("<td />").addClass("search-result-label").text(t.label),(null!=(a=r.data_option)?a.linktemplate:void 0)?((i={user:App.Session.get(),config:App.Config.all()})[""+e.toLowerCase()]=((s={})[""+r.name]=t.value,s),o=i,n=App.Utils.replaceTags(null!=(l=r.data_option)?l.linktemplate:void 0,o),h=$('<svg class="icon icon-external"><use xlink:href="assets/images/icons.svg#icon-external" /></svg>'),p=$("<a />").addClass("settings-list-control").attr("href",n).attr("target","_blank").append(h),u=$("<td />").addClass("search-result-link settings-list-controls").append(p)):$("<span />").text(t.label),$("<tr />").attr("data-id",t.value).append(f).append(c).append(u).appendTo(d.find("tbody"))})),s.find(".js-searchResultSample").html(d))),!h)return s.find(".js-previewError").text(App.i18n.translatePlain(o)).removeClass("hide")},error:function(t,e,n){return s.find(".js-previewError").text(App.i18n.translatePlain("An error occurred: %s",n)).removeClass("hide"),s.find(".js-loading").addClass("hide")}})},n.resetExternalDataSourcePreview=function(t){return t.find(".js-searchResultResponse").empty(),t.find(".js-searchResultList").empty(),t.find(".js-searchResultSample").empty(),t.find(".js-previewError").addClass("hide"),t.find(".js-loading").addClass("hide"),t.find(".js-previewInfo").removeClass("hide")},n.addDragAndDrop=function(t,e){var n;return n={tolerance:"pointer",distance:15,opacity:.6,forcePlaceholderSize:!0,items:"tr.input-data-row",helper:function(t,e){var n,i;return i=e.children(),(n=e.clone()).children().each((function(t){return $(this).width(i.eq(t).outerWidth())})),n},stop:e},t.find("tbody.table-sortable").sortable(n)},n.mapDataOptions=function(t){var e,n,i;return i=t.options,e=t.customsort,n=_.isArray(i)?i.map((function(t){var e,n;return e=t.name,(n=t.value)&&n.toString||(n=""),e&&e.toString||(e=""),[n.toString(),e.toString()]})):_.map(i,(function(t,e){return e&&e.toString||(e=""),t&&t.toString||(t=""),[e.toString(),t.toString()]})),null!=e&&"on"===e?n:n.sort((function(t,e){return t[1].localeCompare(e[1])}))},n.ensureOneOption=function(t){if(!($(t).find("tbody tr").length>1))return this.buildRow(t,{})},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.object_perform_action=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.defaults=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f;switch(null==e&&(e={}),c={ticket:{name:__("Ticket"),model:"Ticket",model_show:["Ticket"]},article:{name:__("Article"),model:t.article_body_cc_only?"TicketArticle":"Article",model_show:["Ticket"]},user:{name:__("User"),model:"User",model_show:["User"]},organization:{name:__("Organization"),model:"Organization",model_show:["Organization"]}},t.notification&&(c.notification={name:__("Notification"),model:"Notification",model_show:["Ticket"]}),void 0===t.object_name&&(t.object_name=e.object||"Ticket"),r=[],t.object_name){case"Ticket":r.push("ticket.state_id");break;case"User":r.push("user.active");break;case"Organization":r.push("organization.active")}for(p in c)s=c[p],_.contains(s.model_show,t.object_name)||delete c[p];for(a in o={},c)if((l=c[a]).model&&App[l.model]){for(u=0,h=(d=App[l.model].configure_attributes).length;u<h;u++)if(!(f=d[u]).no_perform_changes&&!(t.article_body_cc_only&&"TicketArticle"===l.model&&"body"!==f.name&&"cc"!==f.name||t.no_dates&&("date"===f.tag||"datetime"===f.tag)||"password"===f.type||"_ids"===f.name.substr(f.name.length-4,4)||f.readonly)){switch((i=_.clone(f)).objectName=l.model,i.attributeName=i.name,t.no_richtext_uploads&&"richtext"===i.tag&&(i.upload=!1),i.tag){case"date":case"datetime":i.operator=["static","relative"];break;case"tag":i.operator=["add","remove"]}o[a+"."+i.name]=i}}else"notification"===a?(o[a+".email"]={name:"email",display:__("Email")},o[a+".sms"]={name:"sms",display:__("SMS")},o[a+".webhook"]={name:"webhook",display:__("Webhook")}):"article"===a&&(o[a+".note"]={name:"note",display:__("Note")});return"Ticket"===t.object_name&&(t.ticket_delete||t.data_privacy_deletion_task)&&(n={},t.ticket_delete&&(n.delete=__("Delete immediately")),t.data_privacy_deletion_task&&(n.data_privacy_deletion_task=__("Add a data privacy deletion task")),o["ticket.action"]={name:"action",display:__("Action"),tag:"select",null:!1,translate:!0,options:n,alerts:{delete:__("All affected tickets will be deleted immediately when this job is run, without a history entry. There is no rollback of this deletion possible."),data_privacy_deletion_task:__("All affected tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, tickets will be deleted and a history entry preserved. There is no rollback of this deletion possible.")}}),"User"===t.object_name&&t.data_privacy_deletion_task&&(o["user.action"]={name:"action",display:__("Action"),tag:"select",null:!1,translate:!0,options:{data_privacy_deletion_task:__("Add a data privacy deletion task")},alerts:{data_privacy_deletion_task:__("All affected users and their customer tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, users and tickets will be deleted and a history entry preserved. There is no rollback of this deletion possible.")}}),"Ticket"===t.object_name&&t.sender_type&&(o["ticket.formSenderType"]={name:"formSenderType",display:__("Sender Type"),tag:"select",null:!1,translate:!0,options:[{value:"phone-in",name:__("Inbound Call")},{value:"phone-out",name:__("Outbound Call")},{value:"email-out",name:__("Email")}]}),[r,c,o]},n}(App.UiElement.ApplicationAction)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.object_selector=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.defaults=function(t,e){var i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y;switch(null==t&&(t={}),null==e&&(e={}),u={ticket:{name:__("Ticket"),model:"Ticket",model_show:["Ticket"]},article:{name:__("Article"),model:"TicketArticle",model_show:["Ticket"]},customer:{name:__("Customer"),model:"User",model_show:["Ticket"]},user:{name:__("User"),model:"User",model_show:["User"]},ticket_customer:{name:__("Ticket Customer"),model_show:["User"]},ticket_owner:{name:__("Ticket Owner"),model_show:["User"]},organization:{name:__("Organization"),model:"Organization",model_show:["Ticket","User","Organization"]}},t.executionTime&&(u.execution_time={name:__("Execution Time"),model_show:["Ticket"]}),void 0===t.object_name&&(t.object_name=e.object||"Ticket"),o=[],t.object_name){case"Ticket":o.push("ticket.state_id");break;case"User":o.push("user.role_ids");break;case"Organization":o.push("organization.members_existing")}for(h in u)r=u[h],_.contains(r.model_show,t.object_name)||delete u[h];for(l in y={"^datetime$":[__("today"),__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)")],"^timestamp$":[__("today"),__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)")],"^date$":[__("today"),"before (absolute)","after (absolute)","before (relative)","after (relative)","within next (relative)","within last (relative)"],boolean$:[__("is"),__("is not")],integer$:[__("is"),__("is not")],"^radio$":[__("is"),__("is not")],"^select$":[__("is"),__("is not")],"^multiselect$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")],"^tree_select$":[__("is"),__("is not")],
"^multi_tree_select$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")],"^autocompletion_ajax_external_data_source$":[__("is"),__("is not")],"^input$":[__("contains"),__("contains not"),__("is any of"),__("is none of"),__("starts with one of"),__("ends with one of")],"^richtext$":[__("contains"),__("contains not")],"^textarea$":[__("contains"),__("contains not")],"^tag$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")]},t.hasChanged&&(y={"^datetime$":[__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)"),__("has changed")],"^timestamp$":[__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)"),__("has changed")],"^date$":[__("before (absolute)"),__("after (absolute)"),__("before (relative)"),__("after (relative)"),__("within next (relative)"),__("within last (relative)"),__("till (relative)"),__("from (relative)"),__("has changed")],boolean$:[__("is"),__("is not"),__("has changed")],integer$:[__("is"),__("is not"),__("has changed")],"^radio$":[__("is"),__("is not"),__("has changed")],"^select$":[__("is"),__("is not"),__("has changed")],"^multiselect$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")],"^tree_select$":[__("is"),__("is not"),__("has changed")],"^multi_tree_select$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")],"^autocompletion_ajax_external_data_source$":[__("is"),__("is not"),__("has changed")],"^input$":[__("contains"),__("contains not"),__("has changed"),__("is any of"),__("is none of"),__("starts with one of"),__("ends with one of")],"^richtext$":[__("contains"),__("contains not"),__("has changed")],"^textarea$":[__("contains"),__("contains not"),__("has changed")],"^tag$":[__("contains all"),__("contains one"),__("contains all not"),__("contains one not")]}),t.hasRegexOperators&&App.Config.get("ticket_conditions_allow_regular_expression_operators")&&y["^input$"].push(__("matches regex"),__("does not match regex")),v={_id$:[__("is"),__("is not")],_ids$:[__("is"),__("is not")]},t.hasChanged&&(v={_id$:[__("is"),__("is not"),__("has changed")],_ids$:[__("is"),__("is not"),__("has changed")]}),a={},!1===t.article&&delete u.article,"Ticket"===t.object_name&&t.action&&(a["ticket.action"]={name:"action",display:__("Action"),tag:"select",null:!1,translate:!0,options:{create:__("created"),update:__("updated"),"update.merged_into":__("merged into"),"update.received_merge":__("received merge")},operator:[__("is"),__("is not")]}),u)if(c=u[l],"article"===l&&t.action&&(a["article.action"]={name:"action",display:__("Action"),tag:"select",null:!1,translate:!0,options:{create:"created"},operator:[__("is"),__("is not")]},a["article.time_accounting"]={name:"time_accounting",display:__("Time Accounting"),tag:"select",null:!1,translate:!0,options:{create:"created"},operator:[__("is set"),__("not set")]}),"execution_time"===l)t.executionTime&&(a["execution_time.calendar_id"]={name:"calendar_id",display:__("Calendar"),tag:"select",relation:"Calendar",null:!1,translate:!1,operator:[__("is in working time"),__("is not in working time")]});else for(p=0,d=(s=App.ObjectManagerAttribute.selectorAttributesByObject()[c.model]||[]).length;p<d;p++)if((i=s[p]).objectName=c.model,i.attributeName=i.name,"password"!==i.type&&"_ids"!==i.name.substr(i.name.length-4,4)&&!1!==i.searchable){for(g in i.default=void 0,"email"!==i.type&&"tel"!==i.type&&"url"!==i.type||(i.type="text"),"select"!==i.tag&&"autocompletion_ajax_external_data_source"!==i.tag||(i.multiple=!0),y)m=y[g],f=new RegExp(g,"i"),i.tag&&i.tag.match(f)&&(i.operator=m),a[l+"."+i.name]=i;for(g in v)m=v[g],f=new RegExp(g,"i"),i.name&&i.name.match(f)&&(i.operator=m),a[l+"."+i.name]=i}return"Ticket"===t.object_name&&t.hasReached&&["ticket.pending_time","ticket.escalation_at"].forEach((function(t){var e;return(e=clone(a[t].operator)).push(__("has reached")),"ticket.escalation_at"===t&&e.push(__("has reached warning")),a[t].operator=e})),"Ticket"===t.object_name&&t.out_of_office&&(a["ticket.out_of_office_replacement_id"]={name:"out_of_office_replacement_id",display:__("Out of office replacement"),tag:"autocompletion_ajax",relation:"User",null:!1,translate:!0,operator:[__("is"),__("is not")]}),[n.objectKey(t.object_name)+".created_at",n.objectKey(t.object_name)+".updated_at"].forEach((function(t){return a[t].operator=a[t].operator.filter((function(t){return"has changed"!==t}))})),"Ticket"===t.object_name&&(a["ticket.mention_user_ids"]={name:"mention_user_ids",display:__("Subscribe"),tag:"autocompletion_ajax",relation:"User",null:!1,translate:!0,operator:[__("is"),__("is not")]}),"User"===t.object_name&&(a["user.role_ids"]={name:"role_ids",display:__("Role"),tag:"select",relation:"Role",null:!1,operator:[__("is"),__("is not")],multiple:!0},a["user.last_login"]={name:"last_login",display:__("Last login"),tag:"datetime",null:!1,operator:y["^datetime$"]},[{name:"last_contact_at",display:__("Last contact")},{name:"last_contact_agent_at",display:__("Last contact (agent)")},{name:"last_contact_customer_at",display:__("Last contact (customer)")},{name:"updated_at",display:__("Updated at")}].forEach((function(t){return a["ticket_customer."+t.name]={name:t.name,display:t.display,tag:"datetime",null:!1,operator:y["^datetime$"]}})),[{name:"existing",display:__("Existing tickets"),group:"ticket_customer"},{name:"open_existing",display:__("Existing tickets (open)"),group:"ticket_customer"},{name:"existing",display:__("Existing tickets"),group:"ticket_owner"},{name:"open_existing",display:__("Existing tickets (open)"),group:"ticket_owner"}].forEach((function(t){return a[t.group+"."+t.name]={name:t.name,display:t.display,tag:"boolean",operator:[__("is"),__("is not")]}}))),"Organization"===t.object_name&&(a["organization.members_existing"]={name:"members_existing",display:__("Existing members"),tag:"boolean",operator:[__("is"),__("is not")]}),[o,u,a]},n.objectKey=function(t){return t.toLowerCase()},n.render=function(t,e){return null==e&&(e={}),this.defaults(t,e),n.__super__.constructor.render.apply(this,arguments)},n.renderItem=function(t,e,i){return t.data("objectName",e.object_name).attr("data-object-name",e.object_name),n.__super__.constructor.renderItem.apply(this,arguments)},n.preview=function(t){var e,n,i;return n=App.ControllerForm.params(t),e=t.data("objectName"),App.Ajax.request({id:"application_selector",type:"POST",url:App[e].url+"/selector",data:JSON.stringify(n),processData:!0,success:(i=this,function(n){return App.Collection.loadAssets(n.assets),t.find(".js-previewCounterContainer").removeClass("hide"),t.find(".js-previewLoader").addClass("hide"),"Ticket"===e?i.ticketTable(n.object_ids,n.object_count,t):i.previewTable(e,n.object_ids,n.object_count,t)})})},n.previewTable=function(t,e,n,i){return i.find(".js-previewCounter").html(n),new App.PreviewList({tableId:"object-selector",el:i.find(".js-previewTable"),object_name:t,object_ids:e})},n}(App.UiElement.ApplicationSelectorExpert)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.permission=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n,i,s;return null==e&&(e={}),i=App.Permission.search({sortBy:"name"}),(n=$(App.view("generic/permission")({attribute:t,params:e,permissions:i}))).find("[name=permission_ids]").on("change",(s=this,function(t){return s.checkUncheck($(t.currentTarget),i,n)})).trigger("change"),n},n.checkUncheck=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d;if(i=t.prop("checked"),u=App.Permission.find(t.prop("value"))){if(!u.name.match(/\./))for(s=0,o=e.length;s<o;s++)l=e[s],h=new RegExp("^"+u.name),l.name.match(h)&&n.find("[name=permission_ids][value="+l.id+"]").closest(".js-subPermissionList").toggleClass("hide",i);if(i&&u.preferences.not){for(d=[],r=0,a=(p=u.preferences.not).length;r<a;r++)l=p[r],(c=App.Permission.findByAttribute("name",l))?d.push(n.find("[name=permission_ids][value="+c.id+"]").prop("checked",!1)):d.push(void 0);return d}}},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){App.UiElement.postmaster_match=function(){function t(){}return t.defaults=function(){return{general:{name:__("Basic Settings"),options:[{value:"from",name:__("From")},{value:"to",name:__("To")},{value:"cc",name:__("CC")},{value:"x-any-recipient",name:__("Any recipient")},{value:"subject",name:__("Subject")},{value:"body",name:__("Body")}]},expert:{name:__("Expert Settings"),options:[{value:"x-spam",name:"X-Spam"},{value:"x-spam-flag",name:"X-Spam-Flag"},{value:"x-spam-level",name:"X-Spam-Level"},{value:"x-spam-score",name:"X-Spam-Score"},{value:"x-spam-status",name:"X-Spam-Status"},{value:"x-dspam-result",name:"X-DSPAM-Result"},{value:"x-dspam-confidence",name:"X-DSPAM-Confidence"},{value:"x-dspam-probability",name:"X-DSPAM-Probability"},{value:"x-dspam-signature",name:"X-DSPAM-Signature"},{value:"importance",name:"Importance"},{value:"x-priority",name:"X-Priority"},{value:"organization",name:"Organization"},{value:"x-original-to",name:"X-Original-To"},{value:"delivered-to",name:"Delivered-To"},{value:"envelope-to",name:"Envelope-To"},{value:"return-path",name:"Return-Path"},{value:"mailing-list",name:"Mailing-List"},{value:"list-id",name:"List-Id"},{value:"list-unsubscribe",name:"List-Unsubscribe"},{value:"list-archive",name:"List-Archive"},{value:"message-id",name:"Message-Id"},{value:"in-reply-to",name:"In-Reply-To"},{value:"auto-submitted",name:"Auto-Submitted"},{value:"x-loop",name:"X-Loop"}]}}},t.render=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f;if(null==e&&(e={}),r=this.defaults(),p=this.buildAttributeSelector(r,t),(o=$(App.view("generic/postmaster_match")({attribute:t}))).find(".js-attributeSelector").prepend(p),o.find(".js-add").on("click",(function(t){var e,n;return n=(e=$(t.target).closest(".js-filterElement")).clone(!0),e.after(n),n.find(".js-attributeSelector select").trigger("change")})),o.find(".js-remove").on("click",(f=this,function(t){if(!$(t.currentTarget).hasClass("is-disabled"))return $(t.target).closest(".js-filterElement").remove(),f.rebuildAttributeSelectors(o)})),o.find(".js-attributeSelector select").on("change",function(n){return function(i){var s,a,l,c,u,p;return a=$(i.target).find("option:selected").attr("value"),l=(s=$(i.target).closest(".js-filterElement")).find(".js-operator select option:selected").attr("value"),p=null!=(c=e[t.name])&&null!=(u=c[a])?u.value:void 0,n.rebuildAttributeSelectors(o,s,a,t),n.rebuildOperater(o,s,a,r,l,t),n.buildValue(o,s,a,r,p,l,t)}}(this)),o.on("change",".js-operator select",function(n){return function(i){var s,a,l,c,u,p;return a=(s=$(i.target).closest(".js-filterElement")).find(".js-attributeSelector option:selected").attr("value"),l=$(i.target).find("option:selected").attr("value"),p=null!=(c=e[t.name])&&null!=(u=c[a])?u.value:void 0,n.buildValue(o,s,a,r,p,l,t)}}(this)),_.isEmpty(e[t.name]))o.find(".js-filterElement .js-attributeSelector select").trigger("change");else{for(a in h=!1,u=e[t.name])h=!0,c=(l=u[a]).operator,d=l.value,i=o.find(".js-filterElement").first(),s=o.find(".js-filterElement").last(),n=i.clone(!0),this.rebuildAttributeSelectors(o,n,a,t),this.rebuildOperater(o,n,a,r,c,t),this.buildValue(o,n,a,r,d,c,t),s.after(n);o.find(".js-attributeSelector select").trigger("change"),h&&o.find(".js-filterElement").first().remove()}return o},t.buildValue=function(t,e,n,i,s,r,o){var a,l;return a={name:o.name+"::"+n+"::value",tag:"input",type:"text",value:s},_.contains(["is any of","is none of","starts with one of","ends with one of"],r)&&(a.name="{json}"+a.name,a.tag="tokenfield"),l=App.UiElement[a.tag].render(a,{}),e.find(".js-value").html(l)},t.buildAttributeSelector=function(t){var e,n,i,s,r,o,a,l,c;for(i in c=$('<select class="form-control"></select>'),t)for(s=t[i],e=App.i18n.translateInline(s.name),c.closest("select").append('<optgroup label="'+e+'" class="js-'+i+'"></optgroup>'),a=c.find("optgroup.js-"+i),r=0,o=(l=s.options).length;r<o;r++)n=l[r],e=App.i18n.translateInline(n.name),a.append('<option value="'+n.value+'">'+e+"</option>");return c},t.rebuildAttributeSelectors=function(t,e,n){if(t.find(".js-attributeSelector select option").prop("disabled",!1),t.find(".js-attributeSelector select").each((function(){var e;return e=$(this).val(),t.find('.js-attributeSelector select option[value="'+e+'"]').attr("disabled",!0)})),t.find(".js-attributeSelector select").length>1?t.find(".js-remove").removeClass("is-disabled"):t.find(".js-remove").addClass("is-disabled"),n)return e.find(".js-attributeSelector select").val(n)},t.buildOperator=function(t,e,n,i,s,r){var o,a,l,c,u,p,h;for(h=$('<select class="form-control" name="'+r.name+"::"+n+'::operator"></select>'),o=0,a=(u=["contains","contains not","is any of","is none of","starts with one of","ends with one of","matches regex","does not match regex"]).length;o<a;o++)l=u[o],c=App.i18n.translateInline(l),p="",s===l&&(p='selected="selected"'),h.append('<option value="'+l+'" '+p+">"+c+"</option>");return h},t.rebuildOperater=function(t,e,n,i,s,r){var o,a;if(n&&(o=r.name+"::"+n+"::operator",!e.find('[name="'+o+'"]').get(0)))return a=this.buildOperator(t,e,n,i,s,r),e.find(".js-operator select").replaceWith(a)},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.postmaster_set=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.defaults=function(){var t,e,n,i,s,r,o,a,l,c;for(i in e=["x-zammad-ticket-state_id"],n={},r={ticket:{name:__("Ticket"),model:"Ticket"},article:{name:"Article"},expert:{name:"Expert"}})if((s=r[i]).model)for(o=0,a=(l=App[s.model].configure_attributes).length;o<a;o++)if("password"!==(c=l[o]).type&&"_ids"!==c.name.substr(c.name.length-4,4)&&!c.readonly){switch((t=_.clone(c)).tag){case"date":case"datetime":t.operator=["static","relative"];break;case"tag":t.operator=["add","remove"]}n["x-zammad-"+i+"-"+t.name]=t}return n["x-zammad-article-internal"]=_.clone(App.TicketArticle.attributesGet().internal),n["x-zammad-article-internal"].null=!1,n["x-zammad-article-type_id"]=_.clone(App.TicketArticle.attributesGet().type_id),n["x-zammad-article-sender_id"]=_.clone(App.TicketArticle.attributesGet().sender_id),n["x-zammad-ignore"]={name:"x-zammad-ignore",display:__("Ignore Message"),tag:"boolean",type:"boolean",null:!1},[e,r,n]},n.elementKeyGroup=function(t){return"x-zammad-ignore"===t?"expert":t.replace("x-zammad-","").split(/-/)[0]},n}(App.UiElement.ApplicationAction)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.radio=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.template_name="radio",n.render=function(t,e){var n;return n=$.extend(!0,{},t),this.getConfigOptionList(n,e),this.getRelationOptionList(n,e),this.addNullOption(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),this.disabledOptions(n,e),this.filterOption(n,e),$(App.view("generic/"+this.template_name)({attribute:n}))},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.radio_graphic=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.template_name="radio_graphic",n}(App.UiElement.radio)}.call(this),function(){App.UiElement.richtext=function(){function t(){}return t.render=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y;if(s=$.extend(!0,{},t),_.isObject(s.value)&&(s.attachments=s.value.attachments,s.value=s.value.text),(a=$(App.view("generic/richtext")({attribute:s,toolButtons:this.toolButtons}))).find("[contenteditable]").ce({mode:s.type,maxlength:s.maxlength,buttons:s.buttons,noImages:s.no_images}),a.find("a.btn--action[data-action]").on("click",(y=this,function(t){return y.toolButtonClicked(t,n)})),s.plugins)for(o=0,u=(f=s.plugins).length;o<u;o++)(e=(d=f[o]).params||{}).el=a.find("[contenteditable]").parent(),new App[d.controller](e);if(s.upload){if(i=[],a.append($(App.view("generic/attachment")({attribute:s}))),v=function(t){if(a.find(".attachments").append(App.view("generic/attachment_item")(t)),i.push(t),n.richTextUploadRenderCallback)return n.richTextUploadRenderCallback(s,i)},e&&e.attachments)for(l=0,p=(m=e.attachments).length;l<p;l++)r=m[l],v(r);if(s.attachments)for(c=0,h=(g=s.attachments).length;c<h;c++)r=g[c],v(r);App.Event.bind("ui::ticket::addArticleAttachent",(function(t){var e,n,i,s,o;if(e=a.closest("form").find("[name=form_id]").val(),t.form_id===e&&!_.isEmpty(t.attachments)){for(o=[],n=0,i=(s=t.attachments).length;n<i;n++)r=s[n],o.push(v(r));return o}}),n.form_id),a.find(".attachments").on("click",".js-delete",(function(t){var e,r,o;if(o=$(t.currentTarget).data("id"),i=_.filter(i,(function(t){if(t.id.toString()!==o.toString())return t})),n.richTextUploadDeleteCallback&&n.richTextUploadDeleteCallback(s,i),r=a.closest("form").find("[name=form_id]").val(),App.Ajax.request({type:"DELETE",url:App.Config.get("api_path")+"/upload_caches/"+r+"/items/"+o,processData:!1}),e=$(t.currentTarget).closest(".attachments"),$(t.currentTarget).closest(".attachment").remove(),0===e.find(".attachment").length)return e.empty()})),App.Delay.set((function(){return new App.Html5Upload({uploadUrl:App.Config.get("api_path")+"/attachments",dropContainer:a.closest("form"),cancelContainer:a.find(".js-cancel"),inputField:a.find("input"),data:{form_id:a.closest("form").find("[name=form_id]").val()},onFileStartCallback:function(){return a.find("[contenteditable]").trigger("fileUploadStart")},onFileCompletedCallback:function(t){return v(t.data),a.find("input").val(""),a.find("[contenteditable]").trigger("fileUploadStop",["completed"])},onFileAbortedCallback:function(){return a.find("input").val(""),a.find("[contenteditable]").trigger("fileUploadStop",["aborted"])},attachmentPlaceholder:a.find(".attachmentPlaceholder"),attachmentUpload:a.find(".attachmentUpload"),progressBar:a.find(".attachmentUpload-progressBar"),progressText:a.find(".js-percentage")}).render()}),100,void 0,"form_upload")}return a},t.toolButtonClicked=function(t,e){var n,i;return n=$(t.currentTarget).data("action"),null!=(i=this.toolButtons[n])?i.onClick(t,e):void 0},t.toolButtons={},t.additions={},t.allDirectionalSiblings=function(t,e,n){var i,s,r;if(null==n&&(n=null),null==t)return[];for(s=[],i=t;(r=App.UiElement.richtext.directionalSibling(i,e))&&(i=r,null==n||r!==n);)s.push(r);return s},t.directionalSibling=function(t,e){return e>0?t.nextSibling:t.previousSibling},t.buildParentsList=function(t,e){return $(t).parentsUntil(e).toArray()},t.buildParentsListWithSelf=function(t,e){var n;return(n=App.UiElement.richtext.buildParentsList(t,e)).unshift(t),n},t}()}.call(this),function(){App.UiElement.richtext.additions.RichTextToolButton=function(){function t(){}return t.icon=void 0,t.text=void 0,t.klass=function(){},t.pickExisting=function(){},t.initializeAttributes={},t.instantiateContent=function(t,e,n){var i;return(i=$.extend(!0,{},this.initializeAttributes)).event=t,i.selection=e,i.container=$(t.currentTarget).closest(".content"),i.delegate=n,new(this.klass())(i).el},t.popoverAttributes=function(t,e,n){var i;return{trigger:"manual",backdrop:!0,html:!0,animation:!1,delay:0,placement:"top",theme:"dark",content:this.instantiateContent(t,e,n),container:i=$(t.currentTarget).closest(".page-content .main").length?".page-content .main":$(t.currentTarget).closest(".content").attr("id")?"#"+$(t.currentTarget).closest(".content").attr("id")+" .page-content":".page-content",viewport:{selector:i,padding:10},template:'<div class="popover popover--has-horizontal-form popover--richtextpopover" role="tooltip"><div class="arrow"></div><h2 class="popover-title"></h2><div class="popover-content"></div></div>'}},t.closeOtherPopovers=function(t){return $(t.currentTarget).closest(".richtext-controls").find(".btn").toArray().filter((function(t){return $(t).attr("aria-describedby")})).forEach((function(t){return $(t).popover("hide")}))},t.selectionSnapshot=function(t){var e,n;return n=$(event.currentTarget).closest(".richtext.form-control").find("[contenteditable]"),(e=this.pickExisting(t,n))?{type:"existing",dom:$(e)}:"Range"===t.type&&$(t.anchorNode).closest("[contenteditable]",n)[0]?(t.getRangeAt(0),{type:"range",range:t.getRangeAt(0)}):$(t.anchorNode).closest("[contenteditable]",n)[0]&&!$(t.anchorNode).is("[contenteditable]")?{type:"caret",dom:$(t.anchorNode),offset:t.anchorOffset}:{type:"append",dom:n}},t.onClick=function(t,e){var n,i;if(t.stopPropagation(),t.preventDefault(),!$(t.currentTarget).attr("aria-describedby"))return this.closeOtherPopovers(t),$(t.currentTarget).closest(".richtext.form-control").find("[contenteditable]"),n=document.getSelection(),i=this.selectionSnapshot(n),n.removeAllRanges(),$(t.currentTarget).popover(this.popoverAttributes(t,i,e)).popover("show");$(t.currentTarget).popover("hide")},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.additions.RichTextToolButtonLink=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.pickLinkInSingleContainer=function(t,e){var n,i;return"A"===t.nodeName?t:(i=$(t).find("a")[0])?i:e&&(n=$(t).closest("a",e)[0])?n:null},n.pickLinkAt=function(t,e,n,i){var s,r,o,a,l,c,u,p;for(null==i&&(i=null),s=0,o=(u=App.UiElement.richtext.buildParentsListWithSelf(t,e)).length;s<o;s++){if("A"===(c=u[s]).nodeName)return c;for(r=0,a=(p=App.UiElement.richtext.allDirectionalSiblings(c,n,i)).length;r<a;r++)if(t=p[r],l=this.pickLinkInSingleContainer(t))return l}return null},n.pickExisting=function(t,e){var n,i,s,r,o,a,l;if(t.isCollapsed&&(r=$(t.anchorNode).closest("a")[0]))return r;if(t.isCollapsed)return null;if((o=t.getRangeAt(0)).startContainer===o.endContainer)return this.pickLinkInSingleContainer(o.startContainer,e);if(r=this.pickLinkAt(o.startContainer,o.commonAncestorContainer,1,o.endContainer))return r;if(l=App.UiElement.richtext.buildParentsList(o.startContainer,o.commonAncestorContainer).pop())for(i=0,s=(a=App.UiElement.richtext.allDirectionalSiblings(l,1,o.endContainer)).length;i<s;i++)if(n=a[i],r=this.pickLinkInSingleContainer(n))return r;return(r=this.pickLinkAt(o.endContainer,o.commonAncestorContainer,-1))?r:null},n}(App.UiElement.richtext.additions.RichTextToolButton)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.UiElement.richtext.additions.RichTextToolPopup=function(n){function i(e){var n,s,r,o,a;this.onClear=t(this.onClear,this),this.onClickingBackround=t(this.onClickingBackround,this),"existing"===e.selection.type?(e.selection.dom.attr("href"),o=this.labelExisting,n=[{className:"btn btn--danger js-clear",text:this.labelClear}]):o=this.labelNew,s={params:this.formParams(e),fullForm:!0,formClass:"form--horizontal",fullFormSubmitLabel:o,fullFormSubmitAdditionalClasses:"btn--create",fullFormAdditionalButtons:n,autofocus:!0,model:{configure_attributes:[]}},r=$.extend(!0,{},s,e),i.__super__.constructor.call(this,r),this.didInitialize(),$(this.event.currentTarget).on("hidden.bs.popover",(a=this,function(t){return a.willClose(t)})),$(document).on("click",this.onClickingBackround)}return e(i,n),i.prototype.events={"submit form":"onSubmit","click .js-clear":"onClear"},i.prototype.labelNew="Link",i.prototype.labelExisting="Update",i.prototype.labelClear="Remove",i.prototype.formParams=function(){},i.prototype.onClickingBackround=function(t){return!!this.el[0].contains(t.target)||(t.preventDefault(),t.stopPropagation(),$(this.event.currentTarget).popover("destroy"))},i.prototype.getAjaxAttributes=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.getAjaxAttributes?n.getAjaxAttributes(t,e):void 0},i.prototype.onClear=function(t){return t.preventDefault(),t.stopPropagation(),this.clear(),$(this.event.currentTarget).popover("hide")},i.prototype.clear=function(){},i.wrapElement=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,_,w,k,A,C,T,S,x,j;if(x=(j=App.UiElement.richtext.buildParentsList(e.range.startContainer,e.range.commonAncestorContainer).reverse()).shift()){for(b=s=x.cloneNode(!1),a=0,p=j.length;a<p;a++){for(n=(_=j[a]).cloneNode(!1),b.append(n),l=0,h=(w=App.UiElement.richtext.allDirectionalSiblings(_,1)).length;l<h;l++)r=w[l],b.append(r.cloneNode(!0));b=n}for(T=e.range.startContainer.cloneNode(!0).splitText(e.range.startOffset),b.append(T),t.append(s),c=0,d=(k=App.UiElement.richtext.allDirectionalSiblings(e.range.startContainer,1)).length;c<d;c++)r=k[c],b.append(r.cloneNode(!0))}else x=e.range.startContainer,T=e.range.startContainer.cloneNode(!0).splitText(e.range.startOffset),t.append(T);for(u=0,f=(A=App.UiElement.richtext.allDirectionalSiblings(x,1,e.range.endContainer)).length;u<f;u++)r=A[u],t.append(r.cloneNode(!0));if(S=(j=App.UiElement.richtext.buildParentsList(e.range.endContainer,e.range.commonAncestorContainer).reverse()).shift()){for(b=i=S.cloneNode(!1),v=0,m=j.length;v<m;v++){for(n=(_=j[v]).cloneNode(!1),b.append(n),y=0,g=(C=App.UiElement.richtext.allDirectionalSiblings(_,-1)).length;y<g;y++)r=C[y],b.prepend(r.cloneNode(!0));b=n}(o=e.range.endContainer.cloneNode(!0)).splitText(e.range.endOffset),b.append(o),t.append(i)}else(o=e.range.endContainer.cloneNode(!0)).splitText(e.range.endOffset),t.append(o);return document.getSelection().removeAllRanges(),document.getSelection().addRange(e.range),document.getSelection().deleteFromDocument(),document.getSelection().removeAllRanges(),t.insertAfter(x)},i.prototype.apply=function(t){return t()},i.prototype.onSubmit=function(t){return t.preventDefault(),this.apply((e=this,function(){return $(e.event.currentTarget).popover("destroy")}));var e},i.prototype.didInitialize=function(){var t,e;switch(this.selection.type){case"existing":return this.selection.dom.addClass("highlight-emulator");case"range":return t=$("<span>").addClass("highlight-emulator"),this.selection.range.startContainer===this.selection.range.endContainer?(this.selection.range.startContainer.splitText(this.selection.range.endOffset),e=this.selection.range.startContainer.splitText(this.selection.range.startOffset),$(e).wrap(t)):this.constructor.wrapElement(t,this.selection)}},i.prototype.willClose=function(){switch(this.selection.type){case"existing":this.selection.dom.removeClass("highlight-emulator");break;case"range":$(this.event.currentTarget).closest(".richtext.form-control").find("[contenteditable]").find("span.highlight-emulator").contents().unwrap()}return $(document).off("click",this.onClickingBackround),$(this.event.currentTarget).off("hidden.bs.popover")},i}(App.ControllerForm)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.toolButtons.embed_video=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.icon="cloud",n.text=__("Video"),n.klass=function(){return App.UiElement.richtext.additions.RichTextToolPopupVideo},n.initializeAttributes={model:{configure_attributes:[{name:"link",display:__("Link"),tag:"input",placeholder:__("YouTube or Vimeo address")}]}},n.pickExisting=function(t,e){var n,i,s,r,o,a,l,c,u;if(a=null,l=null,i=null,s=null,e[0].contains(t.anchorNode)){for((c=document.createTreeWalker(e[0])).currentNode=t.anchorNode;!a&&("#text"===c.currentNode.nodeName||"SPAN"===c.currentNode.nodeName)&&c.currentNode;)c.currentNode instanceof Text&&(r=c.currentNode.textContent.indexOf("(")),null!=r&&r>-1&&(a=c.currentNode,l=r),c.previousNode();for(c.currentNode=t.anchorNode;!i&&("#text"===c.currentNode.nodeName||"SPAN"===c.currentNode.nodeName)&&c.currentNode;)c.currentNode instanceof Text&&(r=c.currentNode.textContent.indexOf(")")),null!=r&&r>-1&&(c.currentNode!==t.anchorNode||r>l)&&(i=c.currentNode,s=r+1),c.nextNode();return a&&i?((o=document.createRange()).setStart(a,l),o.setEnd(i,s),n=o.cloneContents(),(u=document.createElement("span")).append(n),o.deleteContents(),o.insertNode(u),u):void 0}},n}(App.UiElement.richtext.additions.RichTextToolButton)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.toolButtons.insert_image=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.icon="web",n.text=__("Image"),n.klass=function(){return App.UiElement.richtext.additions.RichTextToolPopupImage},n.initializeAttributes={model:{configure_attributes:[{name:"link",display:__("Image"),tag:"input",type:"file"}]}},n.pickExisting=function(t,e){return e.find("img.objectResizingEditorActive")[0]},n}(App.UiElement.richtext.additions.RichTextToolButton)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.toolButtons.link_answer=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.icon="knowledge-base-answer",n.text=__("Link Answer"),n.klass=function(){return App.UiElement.richtext.additions.RichTextToolPopupAnswer},n.initializeAttributes={model:{configure_attributes:[{name:"link",display:__("Answer"),relation:"KnowledgeBaseAnswerTranslation",tag:"autocompletion_ajax"}]}},n}(App.UiElement.richtext.additions.RichTextToolButtonLink)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.toolButtons.link=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.icon="chain",n.text=__("Weblink"),n.klass=function(){return App.UiElement.richtext.additions.RichTextToolPopupLink},n.initializeAttributes={model:{configure_attributes:[{name:"link",display:__("Link"),tag:"input",placeholder:"http://"}]}},n}(App.UiElement.richtext.additions.RichTextToolButtonLink)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.additions.RichTextToolPopupAnswer=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.formParams=function(t){return{link:"existing"===t.selection.type&&"knowledge-base-answer"===t.selection.dom.attr("data-target-type")?t.selection.dom.attr("data-target-id"):void 0}},n.prototype.applyOnto=function(t,e,n){return null==n&&(n=null),t.attr("href",e.uiUrl("edit")).attr("data-target-id",e.id).attr("data-target-type","knowledge-base-answer"),null!=n&&t.text(n),t},n.prototype.apply=function(t){var e,n,i,s,r;if(e=this.el.find("input").val(),i=App.KnowledgeBaseAnswerTranslation.find(e)){switch(r=$(this.event.currentTarget).closest(".richtext.form-control").find("[contenteditable]"),this.selection.type){case"existing":this.applyOnto(this.selection.dom,i);break;case"append":n=$("<a>"),this.applyOnto(n,i,i.title),this.selection.dom.append(n);break;case"caret":n=$("<a>"),this.applyOnto(n,i,i.title),this.selection.dom[0].splitText?(this.selection.dom[0].splitText(this.selection.offset),n.insertAfter(this.selection.dom)):n.prependTo(this.selection.dom);break;case"range":s=r.find("span.highlight-emulator"),n=$("<a>"),this.applyOnto(n,i),s.wrap(n),s.contents()}return t()}},
n.prototype.clear=function(){if("existing"===this.selection.type)return $(this.selection.dom).contents().unwrap()},n}(App.UiElement.richtext.additions.RichTextToolPopup)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.additions.RichTextToolPopupImage=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.labelNew="Insert",n.prototype.labelExisting="Replace",n.prototype.apply=function(t){var e,n,i;return this.el.find("btn--create").attr("disabled",!0),e=this.el.find("input")[0].files[0],(n=new FileReader).addEventListener("load",(i=this,function(){return i.insertImage(n.result),t()}),!1),n.readAsDataURL(e)},n.prototype.applyOnto=function(t,e){return t.attr("src",e)},n.prototype.insertImage=function(t){var e,n,i;switch(i=$(this.event.currentTarget).closest(".richtext.form-control").find("[contenteditable]"),this.selection.type){case"existing":return this.applyOnto(this.selection.dom,t);case"append":return(e=$("<img>")[0]).src=t,e.style="width: 1000px; max-width: 100%;",this.selection.dom.append(e);case"caret":return(e=$("<img>")).attr("src",t),e.attr("style","width: 1000px; max-width: 100%;"),this.selection.dom[0]instanceof Text&&this.selection.dom[0].splitText(this.selection.offset),e.insertAfter(this.selection.dom);case"range":return(e=$("<img>")).attr("src",t),e.attr("style","width: 1000px; max-width: 100%;"),(n=i.find("span.highlight-emulator")).empty(),n.append(e)}},n.prototype.clear=function(){if("existing"===this.selection.type)return this.selection.dom.closest(".enableObjectResizingShim").remove(),this.selection.dom.remove()},n}(App.UiElement.richtext.additions.RichTextToolPopup)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.additions.RichTextToolPopupLink=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.formParams=function(t){return{link:"existing"===t.selection.type&&null==t.selection.dom.attr("data-target-type")?t.selection.dom.attr("href"):void 0}},n.prototype.applyOnto=function(t,e,n){return null==n&&(n=null),t.attr("href",e).removeAttr("data-target-id").removeAttr("data-target-type"),null!=n&&t.text(n),t},n.prototype.ensureProtocol=function(t){return t=t.trim(),this.isWithProtocol(t)||this.isRelativePath(t)||this.isMailto(t)?t:"http://"+t},n.prototype.apply=function(t){var e,n,i,s,r,o;switch(n=this.el.find("input").val(),o=this.ensureProtocol(n),r=$(this.event.currentTarget).closest(".richtext.form-control").find("[contenteditable]"),this.selection.type){case"existing":this.applyOnto(this.selection.dom,o);break;case"append":i=$('<a target="_blank">'),this.applyOnto(i,o,n),this.selection.dom.append(i);break;case"caret":i=$('<a target="_blank">'),this.applyOnto(i,o,n),"function"==typeof(e=this.selection.dom[0]).splitText&&e.splitText(this.selection.offset),i.insertAfter(this.selection.dom);break;case"range":s=r.find("span.highlight-emulator"),i=$('<a target="_blank">'),this.applyOnto(i,o),s.wrap(i),s.contents()}return t(),r.trigger("change")},n.prototype.clear=function(){if("existing"===this.selection.type)return $(this.selection.dom).contents().unwrap()},n.prototype.isWithProtocol=function(t){return/^\S+\:\/\//.test(t)},n.prototype.isMailto=function(t){return/^mailto\:\S+@\S/.test(t)},n.prototype.isRelativePath=function(t){return"/"===t[0]},n}(App.UiElement.richtext.additions.RichTextToolPopup)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.richtext.additions.RichTextToolPopupVideo=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.labelNew="Insert",n.prototype.labelExisting="Replace",n.regexps={youtube:[/youtube.com\/watch\?v=(\S[^:#?&\/]+)/,/youtu.be\/(\S[^:#?&\/]+)/,/youtube.com\/embed\/(\S[^:#?&\/]+)/],vimeo:[/vimeo.com\/([\w]+)/]},n.detectProviderAndId=function(t){var e,i,s,r,o,a,l;if(t)for(s in null,r=n.regexps)for(e=0,i=(a=r[s]).length;e<i;e++)if(o=a[e],l=t.match(o))return[s,l[1]]},n.urlToMarkup=function(t){var e;if(e=this.detectProviderAndId(t))return"( widget: video, provider: "+e[0]+", id: "+e[1]+" )"},n.prototype.apply=function(t){var e,n;if(e=this.el.find("input").val(),n=this.constructor.urlToMarkup(e))return this.insertVideo(n),t();new App.ControllerErrorModal({message:__("Invalid video URL")})},n.prototype.insertVideo=function(t){var e,n,i;switch(i=$(this.event.currentTarget).closest(".richtext.form-control").find("[contenteditable]"),this.selection.type){case"existing":return this.selection.dom.text(t);case"append":return e=document.createTextNode(t),this.selection.dom.append(e);case"caret":return e=document.createTextNode(t),this.selection.dom[0]instanceof Text&&this.selection.dom[0].splitText(this.selection.offset),$(e).insertAfter(this.selection.dom);case"range":return e=document.createTextNode(t),(n=i.find("span.highlight-emulator")).empty(),n.append(e)}},n}(App.UiElement.richtext.additions.RichTextToolPopup)}.call(this),function(){App.UiElement.richtext_search=function(){function t(){}return t.render=function(t){return $(App.view("generic/input")({attribute:t}))},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.searchable_select=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n;return(n=$.extend(!0,{},t)).multiple?n.multiple="multiple":n.multiple="",this.getConfigOptionList(n,e),this.getRelationOptionList(n,e),this.addNullOption(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),this.disabledOptions(n,e),this.filterOption(n,e),new App.SearchableSelect({attribute:n}).element()},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.select=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e,n){var i,s;return null==n&&(n={}),(i=$.extend(!0,{},t)).multiple?i.multiple="multiple":i.multiple="",n.rejectNonExistentValues&&(i.rejectNonExistentValues=!0),this.addDeletedOptions(i,e),this.getConfigCustomSortOptionList(i),this.getRelationOptionList(i,e),this.addNullOption(i,e),this.sortOptions(i,e),this.selectedOptions(i,e),this.disabledOptions(i,e),this.filterOption(i,e),s=$(App.view("generic/select")({attribute:i})),this.bindEventListeners(s,i,e),s},n.bindEventListeners=function(t,e,n){if(e.display_warn)return t.on("change",(i=this,function(s){return i.bindWarnDisplayListener(s.target.value,e,n,t)})),this.bindWarnDisplayListener(e.value,e,n,t);var i},n.bindWarnDisplayListener=function(t,e,n,i){var s;return s=this.shouldDisplayWarn(t,e,n),this.toggleDisplayWarn(s,e,i)},n.shouldDisplayWarn=function(t,e,n){var i;if(t&&n)return"function"==typeof n[i=e.name+"_is_display_warning"]?n[i](t):void 0},n.toggleDisplayWarn=function(t,e,n){var i;return t?(n.addClass("display-warn"),(i=$('<div class="alert alert--warning" role="alert"></div>')).html(e.warn),n.append(i)):(n.removeClass("display-warn"),void n.find(".alert--warning").remove())},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.selectTicketAttributes=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n,i,s,r,o,a;for(s in n=$.extend(!0,{},t),i=[],o=App.Ticket.attributesGet())"password"!==(a=o[s]).type&&"tag"!==a.type&&"tags"!==a.name&&(r=a.name,"_ids"===a.name.substr(a.name.length-4,4)?r=a.name.substr(0,a.name.length-4):"_id"===a.name.substr(a.name.length-3,3)&&(r=a.name.substr(0,a.name.length-3)),i.push({value:r,name:a.display}));return n.sortBy=null,n.options=i,App.UiElement.select.render(n,e)},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.select_search=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n;return(n=$.extend(!0,{},t)).multiple?n.multiple="multiple":n.multiple="",delete n.filter,this.getConfigOptionList(n,e),this.getRelationOptionList(n,e),this.addNullOption(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),this.disabledOptions(n,e),this.filterOption(n,e),$(App.view("generic/select")({attribute:n}))},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){App.UiElement.sla_times=function(){function t(){}return t.render=function(t,e){var n,i;return null==e&&(e={}),e.id||e.first_response_time||(e.first_response_time=120),(n=$(App.view("generic/sla_times")({attribute:t,first_response_time:e.first_response_time,response_time:e.response_time,update_time:e.update_time,solution_time:e.solution_time,first_response_time_in_text:this.toText(e.first_response_time),response_time_in_text:this.toText(e.response_time),update_time_in_text:this.toText(e.update_time),solution_time_in_text:this.toText(e.solution_time)}))).find(".js-timeConvertFrom").timepicker({maxHours:999}),n.find(".js-activateRow").on("change",(function(t){var e,n;return n=(e=$(t.target)).closest("tr"),e.prop("checked")?(n.addClass("is-active"),n.has(".js-updateTypeSelector").length>0&&0===n.has(".js-updateTypeSelector:checked").length?n.find(".js-updateTypeSelector:first").prop("checked",!0):void 0):(n.removeClass("is-active"),n.find(".js-timeConvertFrom").val(""),n.find(".js-timeConvertTo").val(""),n.find(".js-updateTypeSelector").attr("checked",!1),n.find(".help-inline").empty(),n.removeClass("has-error"))})),n.find(".js-timeConvertFrom").on("keyup focus blur",(i=this,function(t){var e,n,s;return n=(e=$(t.target)).val(),(s=e.closest("tr")).find(".js-activateRow").prop("checked",!0).trigger("change"),s.addClass("is-active"),s.find("[name='"+e.data("name")+"']").val(i.toMinutes(n)||"")})),n.find(".js-forward-click").on("click",(function(t){return $(t.currentTarget).closest("tr").find(".checkbox-replacement").trigger("click")})),n.find(".js-forward-radio").on("click",(function(t){var e;return(e=$(t.currentTarget).closest("p").find(".js-updateTypeSelector")).prop("checked",!0),e.trigger("change")})),n.find(".js-focus-input").on("click",(function(t){return $(t.currentTarget).find(".form-control:visible").trigger("focus")})),n.find(".js-timeConvertFrom").on("changeTime.timepicker",(function(t){if("00:00"===$(t.currentTarget).val())return $(t.currentTarget).val("")})),n.find(".js-updateTypeSelector").on("change",(function(t){var e,n;return(n=(e=$(t.target)).closest("tr")).find(".js-activateRow").prop("checked",!0),n.addClass("is-active"),n.find(".js-timeConvertFrom").addClass("hidden").val(""),n.find(".js-timeConvertTo").val(""),n.find("[data-name='"+e.val()+"_time']").removeClass("hidden")})),n.find(".js-timeConvertFrom").each((function(){var t,e;if(t=(e=$(this).closest("tr")).find(".js-activateRow"),$(this).val())return t.prop("checked",!0),e.addClass("is-active")})),n},t.toMinutes=function(t){var e,n;if(t=t.split(":"),e=parseInt(t[0]),n=parseInt(t[1]),NaN!==e&&NaN!==n&&(0!==e||0!==n))return 60*e+n},t.toText=function(t){var e,n;if(t=parseInt(t))return(n=t%60)<10&&(n="0"+n),(e=Math.floor(t/60))<10&&(e="0"+e),e+":"+n},t}()}.call(this),function(){App.UiElement.switch=function(){function t(){}return t.render=function(t){var e;return(e=$(App.view("generic/switch")({attribute:t}))).find("input").data("field-type","boolean"),e},t}()}.call(this),function(){App.UiElement.tag=function(){function t(){}return t.render=function(t){var e,n,i,s,r;return(n=$.extend(!0,{},t)).id||(n.id="tag-"+(new Date).getTime()+"-"+Math.floor(999999*Math.random())),i=$(App.view("generic/input")({attribute:n})),r=App.Config.get("api_path")+"/tag_search",s={},e=function(){return $("#"+n.id).tokenfield({createTokensOnBlur:!0,autocomplete:{source:r,minLength:1,response:function(t,e){var n,r,o,a;if(e&&e.content){for(a=[],n=0,r=(o=e.content).length;n<r;n++)i=o[n],a.push(s[i.value]=!0);return a}}}}).on("tokenfield:createtoken",(function(t){return!(!1===App.Config.get("tag_new")&&!s[t.attrs.value])||(t.preventDefault(),!1)})),$("#"+n.id).parent().css("height","auto")},App.Delay.set(e,500,void 0,"tags"),i},t}()}.call(this),function(){App.UiElement.textarea=function(){function t(){}return t.render=function(t){var e,n,i,s;return void 0===t.rows&&(t.rows=4),i=$(App.view("generic/textarea")({attribute:t})),t.collapsible&&(e="panel-collapse collapse",_.isEmpty(t.value)||(e+=" in"),i=$('<div id="collapse-'+t.id+'" class="'+e+'">').append(i)),t.upload&&(n="file-uploader-"+(new Date).getTime()+"-"+Math.floor(99999*Math.random()),i.append('<div class="file-uploader '+t.class+'" id="'+n+'"></div>'),s=function(){var t;if($("#"+n)[0])return t=i.closest("form").find("[name=form_id]").val(),$("#"+n).fineUploader({request:{endpoint:App.Config.get("api_path")+"/upload_caches/"+t},text:{uploadButton:App.Utils.icon("paperclip")},template:'<div class="qq-uploader"><pre class="btn qq-upload-icon qq-upload-drop-area"><span>{dragZoneText}</span></pre><div class="btn btn-default qq-upload-icon2 qq-upload-button pull-right" style="">{uploadButtonText}</div><ul class="qq-upload-list span5" style="margin-top: 10px;"></ul></div>',customHeaders:{"X-CSRF-Token":App.Ajax.token()},classes:{success:"",fail:""},debug:!1})},App.Delay.set(s,100,void 0,"form_upload")),i},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.ticket_duplicate_detection=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.warningVisible=!1,n.render=function(t,e){return null==e&&(e={}),this.el=$(App.view("generic/ticket_duplicate_detection")({attribute:t})),this.el.data("handleValue",this.handleValue),this.handleValue(e[t.name]),this.el},n.handleValue=function(t){return void 0!==t&&t.count?n.showWarning(t):n.hideWarning()},n.hideWarning=function(){if(this.warningVisible)return this.el.addClass("hide"),this.warningVisible=!1},n.showWarning=function(t){var e;return this.warning=$(App.view("generic/ticket_duplicate_detection/warning")({items:t.items||[]})),this.el.html(this.warning).removeClass("hide"),this.el.find(".js-collapse").collapse().removeClass("hide"),this.bindEvents(),this.warningVisible=!0,"Explorer"===(null!=(e=App.Browser.detection().browser)?e.name:void 0)?this.el.get(0).scrollIntoView(!0):this.el.get(0).scrollIntoView({behavior:"smooth"})},n.bindEvents=function(){var t;return this.el.find(".js-close").on("click",(t=this,function(e){return e.preventDefault(),t.hideWarning()})),this.el.find(".js-toggleCollapse").on("click",function(t){return function(e){return e.preventDefault(),t.toggleCollapse()}}(this))},n.toggleCollapse=function(){return this.el.find(".js-collapse").collapse("toggle"),this.seeMoreOpen?(this.label=App.i18n.translateContent("See more"),this.seeMoreOpen=!1):(this.label=App.i18n.translateContent("See less"),this.seeMoreOpen=!0),this.el.find(".js-toggleCollapse").html(this.label)},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.ticket_perform_action=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(App.UiElement.ApplicationAction)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.ticket_selector=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(App.UiElement.ApplicationSelectorExpert)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.ticket_selector_simple=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(App.UiElement.ApplicationSelector)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.time_accounting_condition=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.hasEmptySelectorAtStart=function(){return!1},n}(App.UiElement.core_workflow_condition)}.call(this),function(){App.UiElement.time_range=function(){function t(){}return t.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m;for(r in l={minute:__("Minute(s)"),hour:__("Hour(s)"),day:__("Day(s)"),week:__("Week(s)"),month:__("Month(s)"),year:__("Year(s)")},"date"===t.tag&&(delete l.minute,delete l.hour),l)d=l[r],l[r]=App.i18n.translateInline(d);return a="date"===t.tag?"day":"minute",t.value&&t.value.range&&(a=t.value.range),f={minute:function(){for(c=[],n=1;n<=120;n++)c.push(n);return c}.apply(this),hour:function(){for(u=[],i=1;i<=48;i++)u.push(i);return u}.apply(this),day:function(){for(p=[],s=1;s<=31;s++)p.push(s);return p}.apply(this),week:function(){for(h=[],o=1;o<=53;o++)h.push(o);return h}.apply(this),month:[1,2,3,4,5,6,7,8,9,10,11,12],year:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]},e=$(App.view("generic/time_range")({attribute:t,ranges:l})),this.localRenderPulldown(e.filter(".js-valueRangeSelector"),f[a],t),e.find("select.form-control.js-range").on("change",(m=this,function(e){var n,i;return a=$(e.currentTarget).val(),(i=$(e.currentTarget).closest(".js-filterElement").find(".js-valueRangeSelector"))&&(n=i.find("select").val()),m.localRenderPulldown(i,f[a],t,n)})),e},t.localRenderPulldown=function(t,e,n,i){var s,r,o,a,l;if(e&&t){for(l={},r=0,o=e.length;r<o;r++)l[(s=e[r]).toString()]=s.toString();return i||(i=n.value?n.value.value:1),a=App.view("generic/time_range_value_selector")({attribute:n,values:l,selected_value:i}),t.html(a)}},t}()}.call(this),function(){App.UiElement.timer=function(){function t(){}return t.render=function(t){var e,n,i,s,r,o;return e=$.extend(!0,{},t),n={Mon:__("Monday"),Tue:__("Tuesday"),Wed:__("Wednesday"),Thu:__("Thursday"),Fri:__("Friday"),Sat:__("Saturday"),Sun:__("Sunday")},i={0:"12 am",1:"1 am",2:"2 am",3:"3 am",4:"4 am",5:"5 am",6:"6 am",7:"7 am",8:"8 am",9:"9 am",10:"10 am",11:"11 am",12:"12 am",13:"1 pm",14:"2 pm",15:"3 pm",16:"4 pm",17:"5 pm",18:"6 pm",19:"7 pm",20:"8 pm",21:"9 pm",22:"10 pm",23:"11 pm"},i={0:"00",1:"01",2:"02",3:"03",4:"04",5:"05",6:"06",7:"07",8:"08",9:"09",10:"10",11:"11",12:"12",13:"13",14:"14",15:"15",16:"16",17:"17",18:"18",19:"19",20:"20",21:"21",22:"22",23:"23"},s={0:"00",10:"10",20:"20",30:"30",40:"40",50:"50"},e.value||(e.value={}),_.isEmpty(e.value.days)&&(e.value.days={Mon:!0}),_.isEmpty(e.value.hours)&&(e.value.hours={0:!0}),_.isEmpty(e.value.minutes)&&(e.value.minutes={0:!0}),(r=$(App.view("generic/timer")({attribute:e,days:n,hours:i,minutes:s}))).find(".js-boolean").data("field-type","boolean"),r.find(".select-value").on("click",(o=this,function(t){return o.select(t)})),this.createOutputString(r),r},t.select=function(e){var n,i;return(i=$(e.currentTarget)).hasClass("is-selected")?i.siblings(".is-selected").length>0&&(i.removeClass("is-selected"),i.next().val("false")):(i.addClass("is-selected"),i.next().val("true")),n=$(e.currentTarget).closest(".form-group"),t.createOutputString(n)},t.createOutputString=function(e){var n,i,s,r;return n=$.map(e.find("[data-type=day]").filter(".is-selected"),(function(t){return $(t).text()})),i=$.map(e.find("[data-type=hour]").filter(".is-selected"),(function(t){return $(t).text()})),s=$.map(e.find("[data-type=minute]").filter(".is-selected"),(function(t){return $(t).text()})),i=t.injectMinutes(i,s),n=t.joinItems(n),i=t.joinItems(i),r=App.Config.get("timezone_default_sanitized"),e.find(".js-timerResult").text(App.i18n.translateInline("Run every %s at %s in %s time",n,i,r))},t.injectMinutes=function(t,e){var n,i,s,r,o,a,l,c,u;for(l=[],s=0,o=t.length;s<o;s++)for(c=(i=t[s]).split(" "),i=c[0],u=c[1],r=0,a=e.length;r<a;r++)n=i+":"+e[r],u&&(n+=" "+u),l.push(n);return l},t.joinItems=function(t){switch(t.length){case 1:return t[0];case 2:return t[0]+" "+App.i18n.translateInline("and")+" "+t[1];default:return t.slice(0,-1).join(", ")+" "+App.i18n.translateInline("and")+" "+t[t.length-1]}},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.timezone=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){var n,i,s,r,o;for(r in(n=$.extend(!0,{},t)).options=[],o=App.Config.get("timezones"))(s=o[r])>0&&(s="+"+s),i={name:r+" (GMT"+s+")",value:r},n.options.push(i);return this.addNullOption(n,e),this.sortOptions(n,e),this.selectedOptions(n,e),n.tag="searchable_select",n.placeholder=App.i18n.translateInline("Enter time zone"),App.UiElement.searchable_select.render(n)},n}(App.UiElement.ApplicationUiElement)}.call(this),function(){App.UiElement.tokenfield=function(){function t(){}return t.valueType="json",t.render=function(t){var e,n,i,s,r;return(e=$.extend(!0,{},t)).id||(e.id="tokenfield-"+(new Date).getTime()+"-"+Math.floor(999999*Math.random())),i=$(App.view("generic/input")({attribute:e})).attr("data-value-type",this.valueType).data("value-type",this.valueType),_.isNull(e.value)&&_.isUndefined(e.value)||(_.isArray(e.value)||(e.value=[e.value]),s=this.setValue(i,e.value)),r=this,n=function(){return i.tokenfield({beautify:!1,createTokensOnBlur:!0,delimiter:"",tokens:s||[]}).on("tokenfield:createdtoken",(function(){return r.updateValue(i)})).on("tokenfield:editedtoken",(function(){return r.updateValue(i)})).on("tokenfield:removedtoken",(function(){return r.updateValue(i)})),i.parent().css("height","auto")},App.Delay.set(n,500,void 0,"token"),i},t.updateValue=function(e){var n;return n=e.tokenfield("getTokens"),t.setValue(e,n.map((function(t){return t.value}))),!0},t.setValue=function(t,e){var n;return n=JSON.stringify(e),t.attr("data-value",n).data("value",n),e},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.tree_select=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(App.UiElement.ApplicationTreeSelect)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UiElement.tree_select_search=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.render=function(t,e){return(t=$.extend(!0,{},t)).multiple=!0,t.nulloption=!0,n.__super__.constructor.render.apply(this,arguments)},n}(App.UiElement.multi_tree_select)}.call(this),function(){App.UiElement.user_autocompletion=function(){function t(){}return t.render=function(t,e){return null==e&&(e={}),new App.UserOrganizationAutocompletion({attribute:t,params:e}).element()},t}()}.call(this),function(){App.UiElement.user_autocompletion_search=function(){function t(){}return t.render=function(t,e){var n;return(n=$.extend(!0,{},t)).disableCreateObject=!0,n.multiple=!0,new App.UserOrganizationAutocompletion({attribute:n,params:e}).element()},t}()}.call(this),function(){App.UiElement.user_permission=function(){function t(){}return t.render=function(t,e){var n,i,s,r;return null==e&&(e={}),t.options={},s=(i=App.Role.search({sortBy:"name"}).filter((function(t){return t.active}))).filter((function(t){return _.include(e.role_ids,t.id)})).map((function(t){return t.id})),i=_.indexBy(i,"name"),i=_.sortBy(i,(function(t){return t.name})),(n=$(App.view("generic/user_permission")({attribute:t,roles:i,params:e,rolesSelected:s}))).find("[name=role_ids]").on("change",(r=this,function(t){return r.checkUncheck($(t.currentTarget),n)})).trigger("change"),n},t.checkUncheck=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f;if(n=t.prop("checked"),(h=t.prop("value"))&&(p=App.Role.find(h))){if(f=[],n&&p&&p.preferences&&p.preferences.not)for(i=0,r=(c=p.preferences.not).length;i<r;i++)if(l=c[i],(a=App.Role.findByAttribute("name",l))&&e.find("[name=role_ids][value="+a.id+"]").prop("checked")){if(!confirm(App.i18n.translateInline("Role %s is conflicting with role %s, do you want to continue?",p.name,a.name,a.name)))return void e.find("[name=role_ids][value="+h+"]").prop("checked",!1);e.localElement.prop("checked",!1),f.push(e.localElement)}for(u=[],s=0,o=f.length;s<o;s++)d=f[s],u.push(d.trigger("change"));return u}},t}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.success=e(this.success,this),i.__super__.constructor.apply(this,arguments),this.Config.get("user_show_password_login")||this.authenticateCheck()?this.navigate("#"):(this.title(__("Admin Password Login")),this.navupdate("#admin_password_auth"),this.render())}return n(i,t),i.prototype.events={"submit form":"submit","click .submit":"submit","click .retry":"retry"},i.prototype.forceRender=!0,i.prototype.className="admin_password_auth",i.prototype.render=function(t){var e;return e=[{name:"username",display:__("Enter your username or email address"),tag:"input",type:"text",limit:100,null:!1,class:"input span4"}],this.replaceWith(App.view("admin_password_auth/request")(t)),this.form=new App.ControllerForm({el:this.el.find(".js-adminPassword"),model:{configure_attributes:e},autofocus:!0})},i.prototype.retry=function(t){return t.preventDefault(),this.render()},i.prototype.submit=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),this.formDisable(t),this.ajax({id:"admin_password_auth",type:"POST",url:this.apiPath+"/users/admin_password_auth",data:JSON.stringify(e),processData:!0,success:this.success})},i.prototype.success=function(){return this.html(App.view("admin_password_auth/request_sent")())},i}(App.ControllerFullPage),App.Config.set("admin_password_auth",t,"Routes")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.AfterAuthTwoFactorConfiguration=function(n){function i(e){this.selectConfigurationMethod=t(this.selectConfigurationMethod,this),this.closeWithoutFade=t(this.closeWithoutFade,this),this.renderAvailableMethods=t(this.renderAvailableMethods,this),e.noFadeTransition&&(e.className="modal"),i.__super__.constructor.call(this,e)}return e(i,n),i.prototype.head=__("Set up two-factor authentication"),i.prototype.buttonCancel=__("Cancel & Sign out"),i.prototype.buttonSubmit=!1,i.prototype.events={"click .js-configuration-method":"selectConfigurationMethod"},i.prototype.content=function(){var t;return t=$(App.view("after_auth/two_factor_configuration")()),this.fetchAvailableMethods(),t},i.prototype.fetchAvailableMethods=function(){if(App.User.current())return this.ajax({id:"two_factor_enabled_authentication_methods",type:"GET",url:this.apiPath+"/users/"+App.User.current().id+"/two_factor_enabled_authentication_methods",success:this.renderAvailableMethods})},i.prototype.renderAvailableMethods=function(t){var e;return e=$(App.view("after_auth/two_factor_configuration/method_buttons")({enabledMethods:this.transformTwoFactorMethods(t)})),this.$(".two-factor-auth-method-buttons").html(e)},i.prototype.transformTwoFactorMethods=function(t){var e;return _.isEmpty(t)?[]:(e=function(t,e){var n;return(n=App.TwoFactorMethods.methodByKey(e.method))?(t.push(_.extend({},n,{disabled:e.configured})),t):t},_.reduce(t,e,[]))},i.prototype.closeWithoutFade=function(){return this.el.removeClass("fade"),this.close()},i.prototype.selectConfigurationMethod=function(t){var e,n;if(t.preventDefault(),this.closeWithoutFade(),e=$(t.currentTarget).data("method"),!_.isEmpty(e))return new App["TwoFactorConfigurationMethod"+e]({mode:"after_auth",successCallback:(n=this,function(){return n.fetchAfterAuth(),App.User.current().trigger("two_factor_changed")})})},i}(App.ControllerAfterAuthModal)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.TicketCreate=function(t){function i(t){var n;this.submitEnable=e(this.submitEnable,this),this.submitDisable=e(this.submitDisable,this),this.submit=e(this.submit,this),this.articleParams=e(this.articleParams,this),this.hasAttachments=e(this.hasAttachments,this),this.params=e(this.params,this),this.localUserInfoCallback=e(this.localUserInfoCallback,this),this.localUserInfo=e(this.localUserInfo,this),this.toggleTypeButton=e(this.toggleTypeButton,this),this.render=e(this.render,this),this.updateTaskManagerAttachments=e(this.updateTaskManagerAttachments,this),this.sharedDraftSaved=e(this.sharedDraftSaved,this),this.importDraftAttachments=e(this.importDraftAttachments,this),this.renderQueue=e(this.renderQueue,this),this.buildScreen=e(this.buildScreen,this),this.autosaveStart=e(this.autosaveStart,this),this.autosaveStop=e(this.autosaveStop,this),this.dirtyMonitorStop=e(this.dirtyMonitorStop,this),this.dirtyMonitorStart=e(this.dirtyMonitorStart,this),this.updateSecurityType=e(this.updateSecurityType,this),this.updateSecurityOptions=e(this.updateSecurityOptions,this),this.changed=e(this.changed,this),this.hide=e(this.hide,this),this.show=e(this.show,this),this.url=e(this.url,this),this.meta=e(this.meta,this),this.setFormTypeInUi=e(this.setFormTypeInUi,this),this.changeFormType=e(this.changeFormType,this),this.currentChannel=e(this.currentChannel,this),i.__super__.constructor.apply(this,arguments),this.sidebarState={},this.defaultType=this.Config.get("ui_ticket_create_default_type"),this.availableTypes=this.Config.get("ui_ticket_create_available_types")||[],_.isArray(this.availableTypes)||(this.availableTypes=[this.availableTypes]),_.contains(this.availableTypes,this.defaultType)||(this.defaultType=this.availableTypes[0]),this.formId=App.ControllerForm.formId(),this.queueKey="TicketCreate"+this.taskKey,this.articleAttributes=this.articleSenderTypeMap[this.currentChannel()],this.split="",this.ticket_id&&this.article_id&&(this.split="/"+this.ticket_id+"/"+this.article_id),this.ajax({type:"GET",url:this.apiPath+"/ticket_create",processData:!0,success:(n=this,function(e){return App.Collection.loadAssets(e.assets),n.formMeta=e.form_meta,n.buildScreen(t)})}),this.controllerBind("ui:rerender",function(t){return function(){if(t.authenticateCheck())return t.renderQueue(),t.tokanice()}}(this)),this.controllerBind("ui::ticket::sidebarRerender",function(t){return function(e){if(e.taskKey===t.taskKey&&t.sidebarWidget)return t.sidebarWidget.render(t.params())}}(this)),this.controllerBind("config_update",function(t){return function(e){if(/^(pgp|smime)_integration$/.test(e.name))return t.updateSecurityType(),t.updateSecurityOptions()}}(this))}return n(i,t),i.include(App.SecurityOptions),i.prototype.elements={
".tabsSidebar":"sidebar",".tabsSidebar-sidebarSpacer":"sidebarSpacer"},i.prototype.events={"click .type-tabs .tab":"changeFormType","submit form":"submit","click .form-controls .js-cancel":"cancel","click .js-active-toggle":"toggleButton","click .js-active-toggle-type":"toggleTypeButton"},i.prototype.types={"phone-in":{icon:"received-calls",label:__("Received Call")},"phone-out":{icon:"outbound-calls",label:__("Outbound Call")},"email-out":{icon:"email",label:__("Send Email")}},i.prototype.articleSenderTypeMap={"phone-in":{sender:"Customer",article:"phone",title:__("Inbound Call"),screen:"create_phone_in"},"phone-out":{sender:"Agent",article:"phone",title:__("Outbound Call"),screen:"create_phone_out"},"email-out":{sender:"Agent",article:"email",title:__("Email"),screen:"create_email_out"}},i.prototype.currentChannel=function(){var t;return t||(t=this.$(".type-tabs .tab.active").data("type")),t||(t=this.defaultType),t},i.prototype.changeFormType=function(t){var e;return e=$(t.currentTarget).data("type"),this.setFormTypeInUi(e),this.tokanice()},i.prototype.setFormTypeInUi=function(t){var e,n;return t||(t=this.currentChannel()),this.$(".type-tabs .tab").removeClass("active"),(e=this.$(".type-tabs .tab .icon")).addClass("gray"),e.removeClass("white"),this.$(".type-tabs .tab[data-type='"+t+"']").addClass("active"),this.articleAttributes=this.articleSenderTypeMap[t],this.$('[name="formSenderType"]').val(t),this.$('[name="group_id"]').trigger("change",{non_interactive:!0}),this.$('[name="cc"], [name="group_id"], [name="customer_id"]').on("change",(n=this,function(){return n.updateSecurityOptions()})),this.listenTo(App.Group,"refresh",function(t){return function(){return t.sidebarWidget.render(t.params())}}(this)),this.$('[name="group_id"]').bind("change",function(t){return function(){return t.sidebarWidget.render(t.params())}}(this)),this.updateSecurityType(t),this.updateSecurityOptions(),"email-out"===t?(this.$('[name="cc"]').closest(".form-group").removeClass("hide"),this.securityEnabled()&&this.securityOptionsShow()):(this.$('[name="cc"]').closest(".form-group").addClass("hide"),this.securityEnabled()&&this.securityOptionsHide()),this.$(".js-note").addClass("hide"),this.$(".js-note[data-type='"+t+"']").removeClass("hide"),App.TaskManager.touch(this.taskKey)},i.prototype.meta=function(){var t,e;return t="",this.articleAttributes&&(t=App.i18n.translateInline(this.articleAttributes.title)),(e=this.$("[name=title]").val())&&(t=t+": "+e),{url:this.url(),head:t,title:t,id:this.id,iconClass:"pen"}},i.prototype.url=function(){return"#ticket/create/id/"+this.id},i.prototype.show=function(){var t;if(this.navupdate("#ticket/create/id/"+this.id+this.split,{type:"menu"}),this.autosaveStart(),this.dirtyMonitorStart(),this.controllerBind("ticket_create_rerender",(t=this,function(e){return t.renderQueue(e)})),this.controllerBind("ticket_create_shared_draft_saved",this.sharedDraftSaved),this.controllerBind("ticket_create_import_draft_attachments",this.importDraftAttachments),window.matchMedia("(max-width: 767px)").matches)return this.sidebar.addClass("is-closed"),this.sidebarSpacer.addClass("is-closed")},i.prototype.hide=function(){return this.autosaveStop(),this.dirtyMonitorStop(),this.controllerUnbind("ticket_create_rerender"),this.controllerUnbind("ticket_create_shared_draft_saved"),this.controllerUnbind("ticket_create_import_draft_attachments")},i.prototype.changed=function(){var t,e;return!!this.hasAttachments()||(e=this.formParam(this.$(".ticket-create")),!(!(t=difference(this.formDefault,e))||_.isEmpty(t)))},i.prototype.updateSecurityOptions=function(t){var e;return null==t&&(t=!1),(e=this.params()).customer_id_completion&&(e.to=e.customer_id_completion),t&&this.securityOptionsReset(),this.updateSecurityOptionsRemote(this.taskKey,e,e)},i.prototype.updateSecurityType=function(t){if(null==t&&(t=this.currentChannel()),"email-out"===t)return this.updateSecurityTypeToolbar()},i.prototype.dirtyMonitorStart=function(){var t,e;return this.dirty={},e=this,t=function(t,n){var i,s,r;if(i=(s=t.target).getAttribute("name")||s.getAttribute("data-name")){if(!(_.isObject(n)&&n.non_interactive||"id"===i))return null!=(r="body"===i?s.textContent:s.value)&&r?e.dirty[i]=!0:e.dirty[i]&&delete e.dirty[i],e.log("debug","ticket create dirty monitor",i,r,e.dirty);e.log("debug","ticket create dirty monitor","non-interactive change",i)}else e.log("debug","ticket create dirty monitor","unknown field",s)},this.el.on("change.dirty paste.dirty input.dirty","form, .js-textarea",t)},i.prototype.dirtyMonitorStop=function(){return this.el.off("change.dirty paste.dirty input.dirty")},i.prototype.autosaveStop=function(){return this.clearDelay("ticket-create-form-update"),this.el.off("change.local blur.local keyup.local paste.local input.local")},i.prototype.autosaveStart=function(){var t,e,n;return this.autosaveLast||((t=App.TaskManager.get(this.taskKey))&&!t.state&&(t.state={}),this.autosaveLast=t.state||{}),n=this,e=function(){var t,e;if(t=n.formParam(n.$(".ticket-create")),!_.isEmpty(t))return e=difference(n.autosaveLast,t),!_.isEmpty(n.autosaveLast)&&_.isEmpty(e)||(n.autosaveLast=t,n.log("debug","form hash changed",e,t),App.TaskManager.update(n.taskKey,{state:t}),n.latestTitle===t.title)?void 0:(n.latestTitle=t.title,App.TaskManager.touch(n.taskKey))},this.el.on("change.local blur.local keyup.local paste.local input.local","form, .js-textarea",function(t){return function(){return t.delay(e,250,"ticket-create-form-update")}}(this)),this.delay(e,800,"ticket-create-form-update")},i.prototype.buildScreen=function(t){return _.isEmpty(t.ticket_id)&&_.isEmpty(t.article_id)?_.isEmpty(t.customer_id)?void this.renderQueue():void this.renderQueue({options:_.omit(t,"id")}):this.ajax({id:"ticket_split"+this.taskKey,type:"GET",url:this.apiPath+"/ticket_split",data:{ticket_id:t.ticket_id,article_id:t.article_id,form_id:this.formId},processData:!0,success:(e=this,function(n){var i,s;return App.Collection.loadAssets(n.assets),s=App.Ticket.find(t.ticket_id).attributes(),i=App.TicketArticle.find(t.article_id),s.owner_id=0,s.customer_id_completion=i.from,s.subject=i.subject||s.title,i.content_type.match(/\/html/)?s.body=i.body:s.body=App.Utils.text2html(i.body),s.attachments=n.attachments,e.renderQueue({options:s})})});var e},i.prototype.renderQueue=function(t){var e,n;if(null==t&&(t={}),n=this,e=function(){return n.render(t)},App.QueueManager.add(this.queueKey,e),this.formMeta||this.controllerFormCreateMiddle)return App.QueueManager.run(this.queueKey)},i.prototype.importDraftAttachments=function(t){return null==t&&(t={}),this.ajax({id:"import_attachments",type:"POST",url:this.apiPath+"/tickets/shared_drafts/"+t.shared_draft_id+"/import_attachments",data:JSON.stringify({form_id:this.formId}),processData:!0,success:function(e){return App.Event.trigger(t.callbackName,{success:!0,attachments:e.attachments})},error:function(){return App.Event.trigger(t.callbackName,{success:!1})}})},i.prototype.sharedDraftSaved=function(t){return this.el.find(".ticket-create input[name=shared_draft_id]").val(t.shared_draft_id)},i.prototype.updateTaskManagerAttachments=function(t,e){var n;if(n=App.TaskManager.get(this.taskKey),!_.isEmpty(n))return n.attachments=e,App.TaskManager.update(this.taskKey,n)},i.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d;if(null==t&&(t={}),r=this.prefilledParams||{},App.TaskManager.get(this.taskKey)&&!_.isEmpty(App.TaskManager.get(this.taskKey).state)&&((r=App.TaskManager.get(this.taskKey).state).attachments=App.TaskManager.get(this.taskKey).attachments,_.isEmpty(r.form_id)||(this.formId=r.form_id)),t&&!_.isEmpty(t.options))if(p=null,_.extend(r,_.pick(_.object(_.map(_.pairs(t.options),(function(t){var e,n,i,s,o,a,l;return o=t[0],a=t[1],n=o.split("."),e=n[1]||n[0],_.isObject(a)&&void 0!==a.value?(l=a.value,a.value_completion&&(r[e+"_completion"]=a.value_completion),"relative"===a.operator&&a.range&&(i="datetime"===(null!=(s=_.find(App.Ticket.configure_attributes,(function(t){return t.name===e})))?s.tag:void 0),l=App.ViewHelpers.relative_time(a.value,a.range,i)),"tags"===e&&(l=a)):l=a,[e,l]}))),(d=this,function(t,e){var n;if("tags"!==e){if(!(null!=(n=d.dirty)?n[e]:void 0))return!0}else p=t}))),(null!=(a=this.dirty)?a.tags:void 0)&&r.tags)if("remove"===(null!=p?p.operator:void 0))r.tags=_.difference(r.tags.split(", "),null!=p&&null!=(l=p.value)?l.split(", "):void 0).join(", ");else r.tags=_.uniq(_.union(r.tags.split(", "),null!=p&&null!=(c=p.value)?c.split(", "):void 0)).join(", ");else"remove"!==(null!=p?p.operator:void 0)&&(r.tags=null!=p?p.value:void 0);return _.isEmpty(r)||(this.formMeta=void 0),r.priority_id||(r.priority_id=null!=(u=App.TicketPriority.findByAttribute("default_create",!0))?u.id:void 0),this.html(App.view("agent_ticket_create")({head:__("New Ticket"),agent:this.permissionCheck("ticket.agent"),admin:this.permissionCheck("admin"),types:this.types,availableTypes:this.availableTypes,form_id:this.formId,shared_draft_id:t.shared_draft_id||r.shared_draft_id})),App.Ticket.configure_attributes.push({name:"cc",display:__("CC"),tag:"input",type:"text",maxlength:1e3,null:!0,screen:{create_top:{Agent:{null:!0}},create_middle:{},edit:{}}}),i=this.Config.get("TicketCreateFormHandler"),o={ticket_duplicate_detection:{name:"ticket_duplicate_detection",display:"ticket_duplicate_detection",tag:"ticket_duplicate_detection",label_class:"hidden",renderTarget:".ticket-form-top",null:!0}},h=App.Ticket.attributesGet("create_top",!1,!1,void 0,".ticket-form-top"),e=App.TicketArticle.attributesGet("create_top",!1,!1,void 0,".article-form-top"),s=App.Ticket.attributesGet("create_middle",!1,!1,void 0,".ticket-form-middle"),n=App.Ticket.attributesGet("create_bottom",!1,!1,void 0,".ticket-form-bottom"),this.controllerFormCreateMiddle=new App.ControllerForm({el:this.$(".ticket-create"),form_id:this.formId,model:App.Ticket,screen:"create_middle",mixedAttributes:Object.assign({},o,h,e,s,n),handlersConfig:i,formMeta:this.formMeta,params:r,noFieldset:!0,taskKey:this.taskKey,rejectNonExistentValues:!0,autofocus:!0,events:{"fileUploadStart .richtext":function(t){return function(){return t.submitDisable()}}(this),"fileUploadStop .richtext":function(t){return function(){return t.submitEnable()}}(this),"change [name=customer_id]":this.localUserInfo,"change [data-attribute-name=organization_id] .js-input":this.localUserInfo},richTextUploadRenderCallback:this.updateTaskManagerAttachments,richTextUploadDeleteCallback:this.updateTaskManagerAttachments,articleParamsCallback:this.articleParams}),App.Utils.htmlImage2DataUrlAsyncInline(this.$("[contenteditable=true]")),App.Ticket.configure_attributes.pop(),this.setFormTypeInUi(r.formSenderType),this.formDefault=this.formParam(this.$(".ticket-create")),this.textModule=new App.WidgetTextModule({el:this.$('[data-name="body"]').parent(),data:{config:App.Config.all(),user:App.Session.get(),ticket:this.formDefault},taskKey:this.taskKey}),$("#tags").tokenfield(),this.sidebarWidget=new App.TicketCreateSidebar({el:this.sidebar,params:this.formDefault,sidebarState:this.sidebarState,taskKey:this.taskKey,query:this.query}),(this.formDefault.customer_id||this.formDefault.organization_id)&&this.localUserInfo(void 0,this.formDefault),App.TaskManager.touch(this.taskKey),this.tokanice()},i.prototype.toggleButton=function(t){return this.$(t.currentTarget).toggleClass("btn--active")},i.prototype.toggleTypeButton=function(t){var e;if(!(e=this.$(t.currentTarget)).hasClass("btn--active"))return e.siblings().removeClass("btn--active"),this.toggleButton(t),this.updateSecurityOptions(!0)},i.prototype.tokanice=function(){return App.Utils.tokanice(".content.active input[name=cc]","email")},i.prototype.localUserInfo=function(t,e){var n,i;if((null==e&&(e={}),this.sidebarWidget)&&(t&&(e=App.ControllerForm.params($(t.target).closest("form"))),this.localUserInfoCustomerId!==e.customer_id||this.localUserInfoOrganizationId!==e.organization_id))return this.localUserInfoCustomerId=e.customer_id,this.localUserInfoOrganizationId=e.organization_id,i=this,n=function(){return e.organization_id?App.Organization.full(e.organization_id,(function(){return i.localUserInfoCallback(e)})):i.localUserInfoCallback(e)},function(){return e.customer_id?App.User.full(e.customer_id,n):n()}()},i.prototype.localUserInfoCallback=function(t){return t.customer=App.User.find(t.customer_id)||{},this.sidebarWidget.render(t),this.textModule.reload({config:App.Config.all(),user:App.Session.get(),ticket:t})},i.prototype.cancel=function(t){var e;return t.preventDefault(),e=App.TaskManager.worker(this.taskKey),App.Event.trigger("taskClose",[e.taskKey])},i.prototype.params=function(){return this.formParam(this.$(".main form"))},i.prototype.hasAttachments=function(){return this.$(".richtext .attachments .attachment").length>0},i.prototype.articleParams=function(){var t,e,n,i,s;return n=this.params(),i=App.TicketArticleSender.findByAttribute("name",this.articleAttributes.sender),s=App.TicketArticleType.findByAttribute("name",this.articleAttributes.article),e=void 0,n.group_id&&(e=App.Group.find(n.group_id)),t={},t="Customer"===i.name?{to:e&&e.name||"",from:n.customer_id_completion,cc:n.cc,subject:n.subject,body:n.body,type_id:s.id,sender_id:i.id,form_id:this.formId,content_type:"text/html"}:{from:e&&e.name||"",to:n.customer_id_completion,cc:n.cc,subject:n.subject,body:n.body,type_id:s.id,sender_id:i.id,form_id:this.formId,content_type:"text/html"},this.securityOptionsShown()&&(t.preferences||(t.preferences={}),t.preferences.security=this.paramsSecurity()),"email-out"!==this.currentChannel()&&delete t.cc,t},i.prototype.submit=function(t){var e,n,i,s,r,o;return t.preventDefault(),(s=this.params()).title||(s.title=s.subject),r=new App.Ticket,this.ticket_id&&(s.links={Ticket:{child:[this.ticket_id]}}),s.article=this.articleParams(),r.load(s),(e=new App.TicketArticle).load(s.article),n=r.validate({controllerForm:this.controllerFormCreateMiddle,target:t.target}),_.isEmpty(n)?!e.body||this.hasAttachments()||!(i=App.Utils.checkAttachmentReference(e.body))||confirm(App.i18n.translateContent("You used %s in the text but no attachment could be found. Do you want to continue?",i))?(this.sidebarWidget&&this.sidebarWidget.postParams&&this.sidebarWidget.postParams({ticket:r}),this.submitDisable(t),o=this,r.save({done:function(){if(App.Ticket.findNative(this.id).article=void 0,o.notify({type:"success",msg:App.i18n.translateInline("Ticket %s created!",this.number),link:"#ticket/zoom/"+this.id,timeout:4e3}),App.TaskManager.remove(o.taskKey),o.scrollTo(),o.sidebarWidget&&o.sidebarWidget.commit({ticket_id:this.id}),!this.editable("change"))return o.navigate("#");o.navigate("#ticket/zoom/"+this.id)},fail:function(e,n){return o.log("errors",n),o.submitEnable(t),o.notify({type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("The object could not be created.")),timeout:6e3})}})):void 0:(this.log("error",n),void this.formValidate({form:t.target,errors:n}))},i.prototype.submitDisable=function(t){if(!t)return this.formDisable(this.$(".js-submit"),"button");this.formDisable(t)},i.prototype.submitEnable=function(t){if(!t)return this.formEnable(this.$(".js-submit"),"button");this.formEnable(t)},i}(App.Controller),t=function(t){function e(t){var n,i,s;if(e.__super__.constructor.apply(this,arguments),!t.id)return s="",t.ticket_id&&t.article_id&&(s="/"+t.ticket_id+"/"+t.article_id),t.customer_id&&(s="/customer/"+t.customer_id),t.query&&(s="/query/"+t.query),i=Math.floor(99999*Math.random()),void this.navigate("#ticket/create/id/"+i+s);this.authenticateCheckRedirect(),n={ticket_id:t.ticket_id,article_id:t.article_id,type:t.type,customer_id:t.customer_id,query:t.query,id:t.id},App.TaskManager.execute({key:"TicketCreateScreen-"+t.id,controller:"TicketCreate",params:n,show:!0})}return n(e,t),e.requiredPermission="ticket.agent",e}(App.ControllerPermanent),App.Config.set("ticket/create",t,"Routes"),App.Config.set("ticket/create/",t,"Routes"),App.Config.set("ticket/create/id/:id",t,"Routes"),App.Config.set("ticket/create/customer/:customer_id",t,"Routes"),App.Config.set("ticket/create/id/:id/customer/:customer_id",t,"Routes"),App.Config.set("ticket/create/id/:id/query/:query",t,"Routes"),App.Config.set("ticket/create/:ticket_id/:article_id",t,"Routes"),App.Config.set("ticket/create/id/:id/:ticket_id/:article_id",t,"Routes"),App.Config.set("TicketCreate",{prio:8003,parent:"#new",name:__("New Ticket"),translate:!0,target:"#ticket/create",permission:["ticket.agent"],divider:!0},"NavBarRight")}.call(this),function(){var t;t=function(){function t(){}return t.run=function(t,e,n,i,s,r){var o,a,l,c,u;if(e&&"group_id"===e.name)return l=void 0,t.group_id&&(a=App.Group.find(t.group_id))&&a.signature_id&&(l=App.Signature.find(a.signature_id)),u=r.el.closest(".content").find('[name="formSenderType"]').val(),l&&l.active&&l.body&&"email-out"===u?(c=App.Utils.replaceTags(l.body,{user:App.Session.get(),config:App.Config.all()}),o=r.el.closest(".content").find("[data-name=body]"),!_.isEmpty(o)&&App.Utils.signatureCheck(o.html()||"",c)?(r.el.closest(".content").find('[data-signature="true"]').remove(),App.Utils.htmlLastLineEmpty(o)||o.append("<br><br>"),l=$('<div data-signature="true" data-signature-id="'+l.id+'">'+c+"</div>"),App.Utils.htmlStrip(l),o.append(l),r.el.closest(".content").find("[data-name=body]").replaceWith(o)):void 0):r.el.closest(".content").find('[data-name="body"]').find("[data-signature=true]").remove()},t}(),App.Config.set("200-ticketFormSignature",t,"TicketCreateFormHandler")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};App.TicketCreateSidebar=function(){function e(e){var n,i;for(n in this.render=t(this.render,this),this.postParams=t(this.postParams,this),this.commit=t(this.commit,this),this.reload=t(this.reload,this),e)i=e[n],this[n]=i;this.render()}return e.prototype.reload=function(t){var e,n,i,s;for(n in s=[],i=this.sidebarBackends)(e=i[n])&&e.reload?s.push(e.reload(t)):s.push(void 0);return s},e.prototype.commit=function(t){var e,n,i,s;for(n in s=[],i=this.sidebarBackends)(e=i[n])&&e.commit?s.push(e.commit(t)):s.push(void 0);return s},e.prototype.postParams=function(t){var e,n,i,s;for(n in s=[],i=this.sidebarBackends)(e=i[n])&&e.postParams?s.push(e.postParams(t)):s.push(void 0);return s},e.prototype.render=function(t){var e,n,i,s,r;for(t&&(this.params=t),this.sidebarBackends||(this.sidebarBackends={}),this.sidebarItems=[],r=App.Config.get("TicketCreateSidebar"),e=0,s=(i=_.keys(r).sort()).length;e<s;e++)n=i[e],this.sidebarBackends[n]&&this.sidebarBackends[n].reload?this.sidebarBackends[n].reload({params:this.params,query:this.query}):this.sidebarBackends[n]=new r[n]({params:this.params,query:this.query,taskGet:this.taskGet,taskKey:this.taskKey}),this.sidebarItems.push(this.sidebarBackends[n]);return this.sidebar&&this.sidebar.releaseController(),this.sidebar=new App.Sidebar({el:this.el,sidebarState:this.sidebarState,items:this.sidebarItems})},e}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){return this.editCustomer=e(this.editCustomer,this),this.showCustomer=e(this.showCustomer,this),this.badgeRenderLocal=e(this.badgeRenderLocal,this),this.badgeRender=e(this.badgeRender,this),this.metaBadge=e(this.metaBadge,this),this.sidebarItem=e(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.sidebarItem=function(){if(this.permissionCheck("ticket.agent")&&!_.isEmpty(this.params.customer_id))return this.item={name:"customer",badgeCallback:this.badgeRender,sidebarHead:__("Customer"),sidebarCallback:this.showCustomer,sidebarActions:[]},App.User.exists(this.params.customer_id)&&App.User.find(this.params.customer_id).isAccessibleBy(App.User.current(),"change")&&this.item.sidebarActions.push({title:__("Edit Customer"),name:"customer-edit",callback:this.editCustomer}),this.item},i.prototype.metaBadge=function(t){var e,n;return e="",n="",e=this.sidebarItemCounter(t),!0===this.Config.get("ui_sidebar_open_ticket_indicator_colored")&&(1===e&&(n="tabsSidebar-tab-count--warning"),e>1&&(n="tabsSidebar-tab-count--danger")),{name:"customer",icon:"person",counterPossible:!0,counter:e,cssClass:n}},i.prototype.badgeRender=function(t){var e;if(this.badgeEl=t,App.User.exists(this.params.customer_id))return e=App.User.find(this.params.customer_id),this.badgeRenderLocal(e)},i.prototype.badgeRenderLocal=function(t){return this.badgeEl.html(App.view("generic/sidebar_tabs_item")(this.metaBadge(t)))},i.prototype.sidebarItemCounter=function(t){var e;return e="",t&&t.preferences&&t.preferences.tickets_open&&(e=t.preferences.tickets_open),e},i.prototype.showCustomer=function(t){if(this.elSidebar=t,!_.isEmpty(this.params.customer_id))return new App.WidgetUser({el:this.elSidebar,user_id:this.params.customer_id,callback:this.badgeRenderLocal})},i.prototype.editCustomer=function(){return new App.ControllerGenericEdit({id:this.params.customer_id,genericObject:"User",screen:"edit",pageData:{title:__("Users"),object:__("User"),objects:__("Users")},container:this.elSidebar.closest(".content")})},i}(App.Controller),App.Config.set("200-Customer",t,"TicketCreateSidebar")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){return this.editOrganization=e(this.editOrganization,this),this.showOrganization=e(this.showOrganization,this),this.sidebarItem=e(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.sidebarItem=function(){var t,e;if(this.permissionCheck("ticket.agent")&&(this.organization_id=this.params.organization_id||(null!=(e=App.User.find(this.params.customer_id))?e.organization_id:void 0),this.organization_id))return this.item={name:"organization",badgeIcon:"group",sidebarHead:__("Organization"),sidebarCallback:this.showOrganization,sidebarActions:[]},this.organization_id&&App.Organization.exists(this.organization_id)&&(null!=(t=App.Organization.find(this.organization_id))?t.isAccessibleBy(App.User.current(),"change"):void 0)&&this.item.sidebarActions.push({title:__("Edit Organization"),name:"organization-edit",callback:this.editOrganization}),this.item},i.prototype.showOrganization=function(t){return this.elSidebar=t,new App.WidgetOrganization({el:this.elSidebar,organization_id:this.organization_id})},i.prototype.editOrganization=function(){return new App.ControllerGenericEdit({id:this.organization_id,genericObject:"Organization",pageData:{title:__("Organizations"),object:__("Organization"),objects:__("Organizations")},container:this.elSidebar.closest(".content")})},i}(App.Controller),App.Config.set("300-Organization",t,"TicketCreateSidebar")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){return this.showDrafts=e(this.showDrafts,this),this.sidebarItem=e(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.sidebarItem=function(){var t;if(this.permissionCheck("ticket.agent")&&(null!=(t=App.Group.find(this.params.group_id))?t.shared_drafts:void 0))return this.item={name:"shared_draft",badgeIcon:"note",sidebarHead:__("Shared Drafts"),sidebarActions:[],sidebarCallback:this.showDrafts},this.item},i.prototype.showDrafts=function(t){return this.el=t,new App.WidgetSharedDraft({el:t,taskKey:this.taskKey,group_id:this.params.group_id,active_draft_id:this.params.shared_draft_id})},i}(App.Controller),App.Config.set("110-SharedDraft",t,"TicketCreateSidebar")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){return this.showTemplates=e(this.showTemplates,this),this.sidebarItem=e(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.sidebarItem=function(){if(this.permissionCheck("ticket.agent"))return this.item={name:"template",badgeIcon:"templates",badgeCallback:this.badgeRender,sidebarHead:__("Templates"),sidebarActions:[],sidebarCallback:this.showTemplates},this.item},i.prototype.showTemplates=function(t){return this.el=t,new App.WidgetTemplate({el:t})},i}(App.Controller),App.Config.set("100-Template",t,"TicketCreateSidebar")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketMerge=function(n){function i(){this.onSubmit=t(this.onSubmit,this),this.content=t(this.content,this),this.onShown=t(this.onShown,this),i.__super__.constructor.apply(this,arguments),this.fetch()}return e(i,n),i.include(App.TicketNumberInput),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.head=__("Merge"),i.prototype.veryLarge=!0,i.prototype.shown=!1,i.prototype.fetch=function(){return this.ajax({id:"ticket_related",type:"GET",url:this.apiPath+"/ticket_related/"+this.ticket.id,processData:!0,success:(t=this,function(e){return App.Collection.loadAssets(e.assets),t.ticket_ids_by_customer=e.ticket_ids_by_customer,t.ticket_ids_recent_viewed=e.ticket_ids_recent_viewed,t.render()})});var t},i.prototype.onShown=function(t){var e,n;return i.__super__.onShown.apply(this,arguments),n=this,e=function(){if(n.tableCustomerTickets&&n.tableCustomerTickets.show(),n.tableRecentViewedTickets)return n.tableRecentViewedTickets.show()},this.delay(e,300)},i.prototype.content=function(){var t;return t=$(App.view("agent_ticket_merge")()),this.tableCustomerTickets=new App.TicketList({tableId:"ticket-merge-customer-tickets",el:t.find("#ticket-merge-customer-tickets"),ticket_ids:this.ticket_ids_by_customer,radio:!0}),this.tableRecentViewedTickets=new App.TicketList({tableId:"ticket-merge-recent-tickets",el:t.find("#ticket-merge-recent-tickets"),ticket_ids:this.ticket_ids_recent_viewed,radio:!0}),this.removeTicketSelectionOnFocus(t,"target_ticket_number"),this.stripTicketHookOnPaste(t,"target_ticket_number"),this.updateTicketNumberOnRadioClick(t,"target_ticket_number"),t},i.prototype.onSubmit=function(t){var e,n;return this.formDisable(t),(e=this.formParam(t.target)).target_ticket_number?this.ajax({id:"ticket_merge",type:"PUT",url:this.apiPath+"/ticket_merge/"+this.ticket.id+"/"+e.target_ticket_number,processData:!0,success:(n=this,function(e){return"success"===e.result?(App.Collection.load({type:"Ticket",data:[e.target_ticket]}),App.Collection.load({type:"Ticket",data:[e.source_ticket]}),n.close(),n.log("notice","nav...",App.Ticket.find(e.target_ticket.id)),n.navigate("#ticket/zoom/"+e.target_ticket.id),n.notify({type:"success",msg:App.i18n.translateContent("Ticket %s merged.",e.source_ticket.number),timeout:4e3}),App.TaskManager.remove("Ticket-"+e.source_ticket.id)):(n.notify({type:"error",msg:App.i18n.translateContent(e.message),timeout:6e3}),n.formEnable(t))}),error:function(e){return function(n){var i;return i=n.responseJSON||{},e.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("The tickets could not be merged.")),timeout:6e3}),e.formEnable(t)}}(this)}):(alert(App.i18n.translateInline("%s required!",App.Config.get("ticket_hook"))),void this.formEnable(t))},i}(App.ControllerModal)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(){this.appEdit=i(this.appEdit,this),this.togglePasswordAccess=i(this.togglePasswordAccess,this),this.toggleTokenAccess=i(this.toggleTokenAccess,this),this.release=i(this.release,this),this.render=i(this.render,this),r.__super__.constructor.apply(this,arguments),App.Setting.fetchFull(this.render,{force:!1})}return s(r,t),r.requiredPermission="admin.api",r.prototype.header=__("API"),r.prototype.events={"click .action":"action","change .js-TokenAccess input":"toggleTokenAccess","change .js-PasswordAccess input":"togglePasswordAccess","click .js-appNew":"appNew"},r.prototype.elements={".js-TokenAccess input":"TokenAccess",".js-PasswordAccess input":"PasswordAccess"},r.prototype.render=function(){var t,e,n;return t=App.Setting.search({filter:{area:"API::Base"}}),this.html(App.view("api")({settings:t})),this.subscribeApplicationId&&App.Setting.unsubscribe(this.subscribeApplicationId),n=this,(e=function(){var t,e,i;return t=function(t){var e;return e={name:"view",display:__("View")},t.splice(3,0,e),e={name:"token",display:__("Token")},t.splice(4,0,e),t},i=function(){return"X"},e=function(){return"X"},new App.ControllerTable({el:n.$(".js-appList"),model:App.Application,tableId:"applications",objects:App.Application.all(),bindRow:{events:{click:n.appEdit}},bindCol:{view:{events:{click:n.appView}},token:{events:{click:n.appToken}}},callbackHeader:[t],callbackAttributes:{view:[i],token:[e]}})})(),this.subscribeApplicationId=App.Application.subscribe(e,{initFetch:!0,clear:!0})},r.prototype.release=function(){if(this.subscribeApplicationId)return App.Application.unsubscribe(this.subscribeApplicationId)},r.prototype.action=function(t){var e,n,i;if(t.preventDefault(),n=$(t.target).parents("[data-id]").data("id"),"uninstall"===$(t.target).data("type")&&(e="DELETE"),e)return this.ajax({id:"packages",type:e,url:this.apiPath+"/packages",data:JSON.stringify({id:n}),processData:!1,success:(i=this,function(){return i.load()})})},r.prototype.toggleTokenAccess=function(){var t;return t=this.TokenAccess.prop("checked"),App.Setting.set("api_token_access",t)},r.prototype.togglePasswordAccess=function(){var t;return t=this.PasswordAccess.prop("checked"),App.Setting.set("api_password_access",t)},r.prototype.appToken=function(t,e){return e.preventDefault(),new n({app:App.Application.find(t)})},r.prototype.appView=function(t,n){return n.preventDefault(),new e({app:App.Application.find(t)})},r.prototype.appNew=function(t){return t.preventDefault(),new App.ControllerGenericNew({pageData:{object:__("Application")},genericObject:"Application",callback:(e=this,function(){return e.render()}),container:this.el.closest(".content")});var e},r.prototype.appEdit=function(t,e){var n,i;return e.preventDefault(),n=App.Application.find(t),new App.ControllerGenericEdit({id:n.id,pageData:{object:__("Application")},genericObject:"Application",callback:(i=this,function(){return i.render()}),container:this.el.closest(".content")})},r}(App.ControllerSubContent),e=function(t){function e(t){this.head=t.app.name,e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.headPrefix="App",e.prototype.buttonSubmit=!1,e.prototype.buttonCancel=!0,e.prototype.shown=!0,e.prototype.small=!0,e.prototype.events={"click .js-select":"selectAll"},e.prototype.content=function(){return'AppID: <input class="js-select" type="text" value="'+this.app.uid+'"> <br> Secret: <input class="js-select" type="text" value="'+this.app.secret+'">'},e}(App.ControllerModal),n=function(t){function e(t){this.onSubmit=i(this.onSubmit,this),this.head=t.app.name,e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.headPrefix=__("Generate Token"),e.prototype.buttonSubmit=__("Generate Token"),e.prototype.buttonCancel=!0,e.prototype.shown=!0,e.prototype.small=!0,e.prototype.events={"click .js-select":"selectAll"},e.prototype.content=function(){return""+App.i18n.translateContent("Generate Access Token for |%s|",App.Session.get().displayNameLong())},e.prototype.onSubmit=function(){return this.ajax({id:"application_token",type:"POST",url:this.apiPath+"/applications/token",processData:!0,data:JSON.stringify({id:this.app.id}),success:(t=this,function(e){return t.contentInline=App.i18n.translateContent("New Access Token is")+': <input class="js-select" type="text" value="'+e.token+'">',t.update(),t.$(".js-submit").remove()})});var t},e}(App.ControllerModal),App.Config.set("API",{prio:1200,name:__("API"),parent:"#system",
target:"#system/api",controller:t,permission:["admin.api"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.description=e(this.description,this),this.delete=e(this.delete,this),this.edit=e(this.edit,this),this.new=e(this.new,this),this.release=e(this.release,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.Calendar.subscribe(this.render),this.startLoading(),this.ajax({id:"calendar_index",type:"GET",url:this.apiPath+"/calendars_init",processData:!0,success:(t=this,function(e){return App.Config.set("ical_feeds",e.ical_feeds),App.Config.set("timezones",e.timezones),App.Collection.loadAssets(e.assets),t.stopLoading(),t.render()})})}return n(i,t),i.requiredPermission="admin.calendar",i.prototype.header=__("Calendars"),i.prototype.events={"click .js-new":"new","click .js-edit":"edit","click .js-delete":"delete","click .js-default":"default","click .js-description":"description"},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y;for(r=0,u=(e=App.Calendar.search({sortBy:"name"})).length;r<u;r++){for(t=e[r],a=0,p=(m=["mon","tue","wed","thu","fri","sat","sun"]).length;a<p;a++)n=m[a],t.business_hours[n]||(t.business_hours[n]={});for(n in g=t.business_hours)(d=g[n]).active||(d.active=!1),d.timeframes||(d.timeframes=[]);if(f={},t.public_holidays)for(s=(new Date).setTime((new Date).getTime()-432e6),y=(new Date).setTime((new Date).getTime()+6048e6),l=0,h=(c=Object.keys(t.public_holidays).reverse()).length;l<h;l++)n=c[l],(o=new Date(Date.parse(n+"T00:00:00Z")))<y&&o>s&&t.public_holidays[n]&&t.public_holidays[n].active&&(f[n]=t.public_holidays[n]);t.public_holidays_preview=App.Utils.sortByKey(f)}return v=!1,App.Calendar.description&&(_.isEmpty(e)?i=marked(App.Calendar.description):v=!0),this.html(App.view("calendar/index")({calendars:e,showDescription:v,description:i}))},i.prototype.release=function(){if(this.subscribeId)return App.Calendar.unsubscribe(this.subscribeId)},i.prototype.new=function(){return new App.ControllerGenericNew({pageData:{title:this.header,object:__("Calendar"),objects:__("Calendars")},genericObject:"Calendar",container:this.el.closest(".content"),large:!0})},i.prototype.edit=function(t){var e;return e=$(t.target).closest(".action").data("id"),new App.ControllerGenericEdit({id:e,pageData:{title:this.header,object:__("Calendar"),objects:__("Calendars")},genericObject:"Calendar",container:this.el.closest(".content"),large:!0})},i.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),n=App.Calendar.find(e),new App.ControllerGenericDestroyConfirm({item:n,container:this.el.closest(".content"),callback:this.load})},i.prototype.default=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),(n=App.Calendar.find(e)).default=!0,n.save()},i.prototype.description=function(){return new App.ControllerGenericDescription({description:App.Calendar.description,container:this.el.closest(".content")})},i}(App.ControllerSubContent),App.Config.set("Calendars",{prio:2400,name:__("Calendars"),parent:"#manage",target:"#manage/calendars",controller:t,permission:["admin.calendar"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;App.CustomerChat=function(e){function r(){var t,e;this.currentPosition=i(this.currentPosition,this),this.setPosition=i(this.setPosition,this),this.idleTimeoutStop=i(this.idleTimeoutStop,this),this.idleTimeoutStart=i(this.idleTimeoutStart,this),this.acceptChat=i(this.acceptChat,this),this.propagateLayoutChange=i(this.propagateLayoutChange,this),this.removeChat=i(this.removeChat,this),this.windowCount=i(this.windowCount,this),this.updateMeta=i(this.updateMeta,this),this.activeChatTopcis=i(this.activeChatTopcis,this),this.switch=i(this.switch,this),this.counter=i(this.counter,this),this.active=i(this.active,this),this.show=i(this.show,this),this.featureActive=i(this.featureActive,this),this.pushState=i(this.pushState,this),this.stopPushState=i(this.stopPushState,this),this.startPushState=i(this.startPushState,this),r.__super__.constructor.apply(this,arguments),this.popovers=[],this.chatWindows={},this.maxChatWindows=4,(t=this.Session.get("preferences"))&&t.chat&&t.chat.max_windows&&(this.maxChatWindows=parseInt(t.chat.max_windows)),this.pushStateIntervalOn=void 0,this.idleTimeout=parseInt(this.Config.get("chat_agent_idle_timeout")||120),this.messageCounter=0,this.meta={active:!1,waiting_chat_count:0,waiting_chat_count_by_chat:{},waiting_chat_session_list:[],waiting_chat_session_list_by_chat:{},running_chat_count:0,running_chat_session_list:[],active_agent_count:0,active_agent_ids:[]},this.render(),this.on("layout-has-changed",this.propagateLayoutChange),this.controllerBind("chat_status_agent",(e=this,function(t){if(t.assets&&App.Collection.loadAssets(t.assets),e.meta=t,e.updateMeta(),!0===t.active)return e.startPushState()})),this.controllerBind("chat_session_start",function(t){return function(e){if(e.session)return t.addChat(e.session)}}(this)),this.controllerBind("ws:login chat_agent_state",(function(){return App.WebSocket.send({event:"chat_status_agent"})})),App.WebSocket.send({event:"chat_status_agent"}),this.controllerBind("ui:rerender chat:rerender",function(t){return function(){var e,n;if(t.authenticateCheck()){for(n in e=t.chatWindows)e[n].el.remove();return t.chatWindows={},t.render(),App.WebSocket.send({event:"chat_status_agent"})}}}(this))}return s(r,e),r.prototype.events={"click .js-acceptChat":"acceptChat","click .js-settings":"settings"},r.prototype.elements={".js-acceptChat":"acceptChatElement",".js-badgeWaitingCustomers":"badgeWaitingCustomers",".js-totalInfo":"totalInfo",".js-badgeChattingCustomers":"badgeChattingCustomers",".js-badgeActiveAgents":"badgeActiveAgents",".chat-workspace":"workspace"},r.prototype.sounds={chat_new:new Audio("assets/sounds/chat_new.mp3")},r.prototype.startPushState=function(){if(!this.pushStateIntervalOn)return this.pushStateIntervalOn=!0,this.interval(this.pushState,55e3,"pushState")},r.prototype.stopPushState=function(){return this.pushStateIntervalOn=!1,this.clearInterval("pushState")},r.prototype.pushState=function(){return App.WebSocket.send({event:"chat_agent_state",data:{active:this.meta.active}})},r.prototype.featureActive=function(){return!!this.Config.get("chat")},r.prototype.render=function(){if(this.permissionCheck("chat.agent")){if(this.Config.get("chat"))return this.html(App.view("customer_chat/index")());this.renderScreenError({detail:__("Feature disabled!")})}else this.renderScreenUnauthorized({objectName:"Chat"})},r.prototype.chatSessionList=function(t){var e,n,i,s;for(t||(t=[]),i=0,s=t.length;i<s;i++)n=t[i],e=App.Chat.find(n.chat_id),n.name=e.displayName()+" [#"+n.id+"]",n.geo_data="",n.preferences&&n.preferences.geo_ip&&(n.preferences.geo_ip.country_name&&(n.geo_data+=n.preferences.geo_ip.country_name),n.preferences.geo_ip.city_name&&(n.geo_data+=" "+n.preferences.geo_ip.city_name)),n.user_id&&(n.user=App.User.find(n.user_id));return App.view("customer_chat/chat_list")({chat_sessions:t})},r.prototype.show=function(t){var e,n;if(this.title(__("Customer Chat"),!0),this.navupdate("#customer_chat"),t.session_id)return n=this,e=function(t){return n.addChat(t)},App.ChatSession.full(t.session_id,e),this.navigate("#customer_chat")},r.prototype.active=function(t){return void 0===t?this.shown:this.shown=t},r.prototype.counter=function(){var t,e,n,i;for(e in t=0,this.meta.waiting_chat_count&&(t+=this.meta.waiting_chat_count),this.lastWaitingChatCount!==t&&(this.switch()&&t>0&&void 0!==this.lastWaitingChatCount&&(this.sounds.chat_new.play(),this.notifyDesktop({title:t+" "+App.i18n.translateInline("Waiting Customers"),url:"#customer_chat"})),this.lastWaitingChatCount=t),n=this.chatWindows)(i=n[e])&&(t+=i.unreadMessages());return this.messageCounter=t},r.prototype.switch=function(t){var e,n;return null==t&&(t=void 0),void 0===t?this.meta.active:(this.meta.active=t,t?(this.startPushState(),n=this.Session.get("preferences"),App.Chat.first()&&!n||!n.chat||!n.chat.active||_.isEmpty(n.chat.active)?App.Chat.count()<2?(n.chat={},n.chat.active={},n.chat.active[App.Chat.first().id]="on",this.ajax({id:"preferences",type:"PUT",url:this.apiPath+"/users/preferences",data:JSON.stringify({chat:n.chat}),processData:!0,success:this.success,error:this.error})):(e=__("To be able to chat you need to select at least one chat topic from below!"),this.settings({errors:{settings:e},active:this.meta.active}),this.meta.active=!1,this.pushState()):void 0):(this.stopPushState(),this.pushState()))},r.prototype.activeChatTopcis=function(){var t,e,n,i,s,r;if(!(s=this.Session.get("preferences")))return[];if(!s.chat)return[];if(!s.chat.active)return[];for(e=[],n=0,i=(r=App.Chat.all()).length;n<i;n++)t=r[n],"on"!==s.chat.active[t.id]&&"on"!==s.chat.active[t.id.toString()]||e.push(t);return e},r.prototype.updateMeta=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m;for(i=0,a=(p=this.popovers).length;i<a;i++)p[i].popover("destroy");if(this.popovers=[],t=this.activeChatTopcis(),this.$(".js-header").html(App.view("customer_chat/chat_header")({chats:t})),this.refreshElements(),this.meta.waiting_chat_count&&this.maxChatWindows>this.windowCount()){if(this.acceptChatElement.not("[data-chat-id]").next().addBack().addClass("is-active pulsate-animation"),t.length>1)for(s=0,l=t.length;s<l;s++)e=t[s],this.meta.waiting_chat_count_by_chat[e.id]&&this.$(".js-header .js-acceptChat[data-chat-id="+e.id+"]").attr("disabled",!1).next().addBack().addClass("is-active pulsate-animation");this.idleTimeoutStart()}else this.acceptChatElement.next().addBack().removeClass("is-active pulsate-animation"),this.idleTimeoutStop();if(t.length>1)for(h=App.Chat.all(),m=this,n=function(t){return m.$(".js-header .js-waitingCustomers[data-chat-id="+t.id+"] .js-badgeWaitingCustomers").text(m.meta.waiting_chat_count_by_chat[t.id]),m.popovers.push(m.el.find(".js-waitingCustomers[data-chat-id="+t.id+"] .js-info").popover({trigger:"hover",html:!0,animation:!1,delay:0,placement:"bottom",container:"body",title:function(){return App.i18n.translateContent("Waiting Customers")},content:function(){return m.chatSessionList(m.meta.waiting_chat_session_list_by_chat[t.id])}}))},r=0,c=h.length;r<c;r++)n(e=h[r]);else this.badgeWaitingCustomers.text(this.meta.waiting_chat_count),this.popovers.push(this.el.find(".js-waitingCustomers .js-totalInfo").popover({trigger:"hover",html:!0,animation:!1,delay:0,placement:"bottom",container:"body",title:function(){return App.i18n.translateContent("Waiting Customers")},content:function(e){return function(){return e.chatSessionList(e.meta.waiting_chat_session_list_by_chat[t[0].id])}}(this)}));if(this.badgeChattingCustomers.text(this.meta.running_chat_count),this.badgeActiveAgents.text(this.meta.active_agent_count),this.meta.active_sessions)for(o=0,u=(d=this.meta.active_sessions).length;o<u;o++)f=d[o],this.addChat(f);return this.meta.active_sessions=!1,this.popovers.push(this.el.find(".js-chattingCustomers .js-info").popover({trigger:"hover",html:!0,animation:!1,delay:0,placement:"bottom",container:"body",title:function(){return App.i18n.translateContent("Chatting Customers")},content:function(t){return function(){return t.chatSessionList(t.meta.running_chat_session_list)}}(this)})),this.popovers.push(this.el.find(".js-activeAgents .js-info").popover({trigger:"hover",html:!0,animation:!1,delay:0,placement:"bottom",container:"body",title:function(){return App.i18n.translateContent("Active Agents")},content:function(t){return function(){var e,n,i,s,r;for(r=[],n=0,e=(i=t.meta.active_agent_ids).length;n<e;n++)s=i[n],r.push(App.User.find(s));return App.view("customer_chat/user_list")({users:r})}}(this)})),this.updateNavMenu()},r.prototype.addChat=function(e){var n;if(!this.chatWindows[e.session_id])return n=new t({session:e,removeCallback:this.removeChat,messageCallback:this.updateNavMenu}),this.workspace.append(n.el),n.render(),this.chatWindows[e.session_id]=n,1===this.windowCount()?n.focus():void 0},r.prototype.windowCount=function(){var t,e;for(t in e=0,this.chatWindows)e++;return e},r.prototype.removeChat=function(t){return delete this.chatWindows[t],this.updateMeta()},r.prototype.propagateLayoutChange=function(){var t,e,n,i;for(i in n=[],e=this.chatWindows)t=e[i],n.push(t.trigger("layout-changed"));return n},r.prototype.acceptChat=function(t){var e;if(!(this.windowCount()>=this.maxChatWindows))return e=$(t.currentTarget).attr("data-chat-id"),App.WebSocket.send({event:"chat_session_start",chat_id:e}),this.idleTimeoutStop()},r.prototype.settings=function(t){return null==t&&(t={}),new n({windowSpace:this,errors:t.errors,active:t.active})},r.prototype.idleTimeoutStart=function(){var t,e;if(!this.idleTimeoutId)return e=this,t=function(){return e.switch(!1),e.notify({type:"notice",msg:App.i18n.translateContent("Chat not answered, automatically set to offline.")})},this.idleTimeoutId=this.delay(t,1e3*this.idleTimeout)},r.prototype.idleTimeoutStop=function(){if(this.idleTimeoutId)return this.clearDelay(this.idleTimeoutId),this.idleTimeoutId=void 0},r.prototype.setPosition=function(t){return this.$(".main").scrollTop(t)},r.prototype.currentPosition=function(){return this.$(".main").scrollTop()},r}(App.Controller),t=function(t){function e(){var t;this.ticketCreate=i(this.ticketCreate,this),this.transfer=i(this.transfer,this),this.detectScrolledtoBottom=i(this.detectScrolledtoBottom,this),this.addTimestamp=i(this.addTimestamp,this),this.goOffline=i(this.goOffline,this),this.removeWritingLoader=i(this.removeWritingLoader,this),this.showWritingLoader=i(this.showWritingLoader,this),this.addMessage=i(this.addMessage,this),this.resetUnreadMessages=i(this.resetUnreadMessages,this),this.addUnreadMessages=i(this.addUnreadMessages,this),this.unreadMessages=i(this.unreadMessages,this),this.receiveMessage=i(this.receiveMessage,this),this.updateModified=i(this.updateModified,this),this.sendMessage=i(this.sendMessage,this),this.onKeydown=i(this.onKeydown,this),this.clearUnread=i(this.clearUnread,this),this.release=i(this.release,this),this.close=i(this.close,this),this.disconnect=i(this.disconnect,this),this.onTransitionend=i(this.onTransitionend,this),this.focus=i(this.focus,this),this.sendMetaForm=i(this.sendMetaForm,this),this.showMeta=i(this.showMeta,this),this.hideMeta=i(this.hideMeta,this),this.toggleMeta=i(this.toggleMeta,this),this.onLayoutChange=i(this.onLayoutChange,this),e.__super__.constructor.apply(this,arguments),this.showTimeEveryXMinutes=2,this.lastTimestamp,this.lastAddedType,this.isTyping=!1,this.isAgentTyping=!1,this.resetUnreadMessages(),this.scrolledToBottom=!0,this.scrollSnapTolerance=10,this.chat=App.Chat.find(this.session.chat_id),this.name=this.chat.displayName(),this.session&&!_.isEmpty(this.session.name)&&(this.name=this.session.name),this.on("layout-change",this.onLayoutChange),this.controllerBind("chat_session_typing",(t=this,function(e){if(e.session_id===t.session.session_id&&!e.self_written)return t.showWritingLoader()})),this.controllerBind("chat_session_message",function(t){return function(e){if(e.session_id===t.session.session_id&&!e.self_written)return t.receiveMessage(e.message.content)}}(this)),this.controllerBind("chat_session_notice",function(t){return function(e){if(e.session_id===t.session.session_id&&!e.self_written)return t.addNoticeMessage(e.message)}}(this)),this.controllerBind("chat_session_left",function(t){return function(e){if(e.session_id===t.session.session_id&&!e.self_written)return t.addStatusMessage("<strong>"+e.realname+"</strong> left the conversation"),t.goOffline()}}(this)),this.controllerBind("chat_session_closed",function(t){return function(e){if(e.session_id===t.session.session_id&&!e.self_written)return t.addStatusMessage("<strong>"+e.realname+"</strong> closed the conversation"),t.goOffline()}}(this)),this.controllerBind("chat_focus",function(t){return function(e){if(e.session_id===t.session.session_id)return t.focus()}}(this))}return s(e,t),e.prototype.className="chat-window",e.prototype.events={"keydown .js-customerChatInput":"onKeydown","focus .js-customerChatInput":"clearUnread",click:"clearUnread","click .js-send":"sendMessage","click .js-close":"close","click .js-disconnect":"disconnect","click .js-scrollHint":"onScrollHintClick","click .js-info":"toggleMeta","click .js-createTicket":"ticketCreate","click .js-transferChat":"transfer","click .chat-message img":"imageView","submit .js-metaForm":"sendMetaForm"},e.prototype.elements={".js-customerChatInput":"input",".js-status":"status",".js-close":"closeButton",".js-disconnect":"disconnectButton",".js-body":"body",".js-meta":"meta",".js-name":"metaName",".js-scrollHolder":"scrollHolder",".js-scrollHint":"scrollHint",".js-metaForm":"metaForm"},e.prototype.sounds={message:new Audio("assets/sounds/chat_message.mp3")},e.prototype.onLayoutChange=function(){return this.scrollToBottom()},e.prototype.toggleMeta=function(){return this.meta.hasClass("hidden")?this.showMeta():this.hideMeta()},e.prototype.hideMeta=function(){return this.body.removeClass("hidden"),this.meta.addClass("hidden"),this.sendMetaForm()},e.prototype.showMeta=function(){return this.body.addClass("hidden"),this.meta.removeClass("hidden")},e.prototype.sendMetaForm=function(t){var e;if(t&&t.preventDefault(),e=this.formParam(this.metaForm),App.WebSocket.send({event:"chat_session_update",data:{session_id:this.session.session_id,name:e.name,tags:e.tags}}),!_.isEmpty(e.name))return this.metaName.text(e.name)},e.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c;if(this.html(App.view("customer_chat/chat_window")({name:this.name,session:this.session,chats:App.Chat.all()})),this.el.one("transitionend",this.onTransitionend),this.scrollHolder.on("scroll",this.detectScrolledtoBottom),this.el.prop("offsetHeight"),this.el.addClass("is-open"),this.session){if(t=!0,"closed"===this.session.state&&(t=!1),this.session&&this.session.preferences&&this.session.preferences.url&&this.addNoticeMessage(this.session.preferences.url,void 0,t),this.session.messages)for(n=0,i=(c=this.session.messages).length;n<i;n++)(s=c[n]).created_by_id?this.addMessage(s.content,"agent",!1,t):this.addMessage(s.content,"customer",!1,t);t&&_.isEmpty(this.session.messages)&&(l=this.Session.get("preferences")).chat&&l.chat.phrase&&(o=l.chat.phrase[this.session.chat_id])&&(r=(a=o.split(";"))[_.random(0,a.length-1)],this.input.html(r),this.sendMessage(1600)),t||this.goOffline()}return new App.WidgetTextModule({el:this.input,data:{user:App.Session.get(),config:App.Config.all()}}),e=[{name:"name",display:__("Name"),tag:"input",null:!0},{name:"tags",display:__("Tags"),tag:"tag",null:!0}],new App.ControllerForm({el:this.$(".js-metaForm"),model:{configure_attributes:e,className:""},params:this.session})},e.prototype.focus=function(){return this.input.trigger("focus")},e.prototype.onTransitionend=function(t){return this.trigger("layout-has-changed"),t.data&&t.data.callback&&t.data.callback(),this.input.ce({mode:"richtext",multiline:!0,maxlength:4e4,imageWidth:"relative"})},e.prototype.disconnect=function(){return this.addStatusMessage("<strong>You</strong> left the conversation"),App.WebSocket.send({event:"chat_session_close",data:{session_id:this.session.session_id}}),this.goOffline()},e.prototype.close=function(){if(this.sendMetaForm(),this.el.one("transitionend",{callback:this.release},this.onTransitionend),this.el.removeClass("is-open"),this.removeCallback)return this.removeCallback(this.session.session_id)},e.prototype.release=function(){return this.trigger("closed"),this.el.remove()},e.prototype.clearUnread=function(){return this.$(".chat-message--new").removeClass("chat-message--new"),this.updateModified(!1),this.resetUnreadMessages()},e.prototype.onKeydown=function(t){var e,n,i,s,r;if(n=9,e=13,t.keyCode!==n&&t.keyCode!==e){if(this.isAgentTyping&&this.isAgentTyping>new Date((new Date).getTime()-1400))return;this.isAgentTyping=new Date,App.WebSocket.send({event:"chat_session_typing",data:{session_id:this.session.session_id}})}switch(t.keyCode){case n:if(s=(i=this.input.not('[disabled="disabled"]')).length,r=i.index(this.input),s>1)switch(r){case s-1:if(!t.shiftKey)return t.preventDefault(),i.eq(0).focus();break;case 0:if(t.shiftKey)return t.preventDefault(),i.eq(s-1).focus()}break;case e:if(!(t.shiftKey||t.altKey||t.ctrlKey||t.metaKey))return t.preventDefault(),this.sendMessage()}},e.prototype.sendMessage=function(t){var e,n,i;if((e=this.input.html())&&!this.el.hasClass("is-offline"))return i=this,n=function(){return App.WebSocket.send({event:"chat_session_message",data:{content:e,session_id:i.session.session_id}})},t?(App.WebSocket.send({event:"chat_session_typing",data:{session_id:this.session.session_id}}),this.delay(n,t)):n(),this.hideMeta(),this.addMessage(e,"agent"),this.input.html("")},e.prototype.updateModified=function(t){return this.status.toggleClass("is-modified",t)},e.prototype.receiveMessage=function(t){var e,n;if(e=this.input.is(":focus"),this.removeWritingLoader(),this.addMessage(t,"customer",!e),!e)return this.addUnreadMessages(),this.updateModified(!0),this.sounds.message.play(),this.notifyDesktop({title:this.name,body:App.Utils.html2text(t),url:"#customer_chat",callback:(n=this,function(){return App.Event.trigger("chat_focus",{session_id:n.session.session_id})})})},e.prototype.unreadMessages=function(){return this.unreadMessagesCounter},e.prototype.addUnreadMessages=function(){return this.messageCallback&&this.messageCallback(this.session.session_id),this.unreadMessagesCounter+=1},e.prototype.resetUnreadMessages=function(){return this.messageCallback&&this.messageCallback(this.session.session_id),this.unreadMessagesCounter=0},e.prototype.addMessage=function(t,e,n,i){return null==i&&(i=!0),i&&this.maybeAddTimestamp(),this.lastAddedType=e,this.body.append(App.view("customer_chat/chat_message")({message:t,sender:e,isNew:n,timestamp:Date.now()})),this.scrollToBottom({showHint:!0})},e.prototype.showWritingLoader=function(){return this.isTyping||(this.isTyping=!0,this.maybeAddTimestamp(),this.body.append(App.view("customer_chat/chat_loader")()),this.scrollToBottom()),this.delay(this.removeWritingLoader,2e3,"typing")},e.prototype.removeWritingLoader=function(){return this.isTyping=!1,this.$(".js-loader").remove()},e.prototype.goOffline=function(){return this.status.attr("data-status","offline"),this.disconnectButton.addClass("is-hidden"),this.closeButton.removeClass("is-hidden"),this.el.addClass("is-offline"),this.input.attr("disabled",!0),this.body.append(App.view("customer_chat/chat_footer")())},e.prototype.maybeAddTimestamp=function(){var t,e,n;if(n=Date.now(),!this.lastTimestamp||n-this.lastTimestamp>6e4*this.showTimeEveryXMinutes)return t=App.i18n.translateInline("today"),e=(new Date).toTimeString().substr(0,5),"timestamp"===this.lastAddedType?(this.updateLastTimestamp(t,e),this.lastTimestamp=n):(this.addTimestamp(t,e),this.lastTimestamp=n,this.lastAddedType="timestamp")},e.prototype.addTimestamp=function(t,e){return this.body.append(App.view("customer_chat/chat_timestamp")({label:t,time:e}))},e.prototype.updateLastTimestamp=function(t,e){return this.body.find(".js-timestamp").last().replaceWith(App.view("customer_chat/chat_timestamp")({label:t,time:e}))},e.prototype.addStatusMessage=function(t,e,n){return null==n&&(n=!0),n&&this.maybeAddTimestamp(),this.body.append(App.view("customer_chat/chat_status_message")({message:t,args:e})),this.scrollToBottom()},e.prototype.addNoticeMessage=function(t,e,n){return null==n&&(n=!0),n&&this.maybeAddTimestamp(),this.body.append(App.view("customer_chat/chat_notice_message")({message:t,args:e})),this.scrollToBottom()},e.prototype.imageView=function(t){return t.preventDefault(),t.stopPropagation(),new App.CustomerChatImageView({image_base64:$(t.target).get(0).src})},e.prototype.detectScrolledtoBottom=function(){var t;if(t=this.scrollHolder.scrollTop()+this.scrollHolder.outerHeight(),this.scrolledToBottom=Math.abs(t-this.scrollHolder.prop("scrollHeight"))<=this.scrollSnapTolerance,this.scrolledToBottom)return this.scrollHint.addClass("is-hidden")},e.prototype.showScrollHint=function(){return this.scrollHint.removeClass("is-hidden"),this.scrollHolder.scrollTop(this.scrollHolder.scrollTop()+this.scrollHint.outerHeight())},e.prototype.onScrollHintClick=function(){return this.scrollHolder.animate({scrollTop:this.scrollHolder.prop("scrollHeight")},300)},e.prototype.scrollToBottom=function(t){var e;return e=(null!=t?t:{showHint:!1}).showHint,this.scrolledToBottom?this.scrollHolder.scrollTop(this.scrollHolder.prop("scrollHeight")):e?this.showScrollHint():void 0},e.prototype.transfer=function(t){var e;return t.preventDefault(),e=$(t.currentTarget).attr("data-chat-id"),App.WebSocket.send({event:"chat_transfer",chat_id:e,session_id:this.session.id}),this.close()},e.prototype.ticketCreate=function(t){var e,n,i,s,r,o;return t.preventDefault(),s=Math.floor(99999*Math.random()),this.navigate("#ticket/create/id/"+s),n=App.Config.get("fqdn"),i=App.Config.get("http_type"),o="",(r=this.session)&&!r.uiUrl&&(r=new App.ChatSession(r)),r&&r.uiUrl&&(o=r.uiUrl()),e={id:s,prefilledParams:{body:i+"://"+n+"/"+o,title:__("Chat")}},App.TaskManager.execute({key:"TicketCreateScreen-"+s,controller:"TicketCreate",params:e,show:!0})},e}(App.Controller),n=function(t){function e(){return this.error=i(this.error,this),this.success=i(this.success,this),this.submit=i(this.submit,this),this.content=i(this.content,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=!0,e.prototype.head=__("Settings"),e.prototype.content=function(){var t;return(t=this.Session.get("preferences"))||(t={}),t.chat||(t.chat={}),t.chat.active||(t.chat.active={}),t.chat.phrase||(t.chat.phrase={}),t.chat.max_windows||(t.chat.max_windows=this.windowSpace.maxChatWindows),App.view("customer_chat/setting")({chats:App.Chat.all(),preferences:t,errors:this.errors||{}})},e.prototype.submit=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),this.formDisable(t),this.windowSpace.maxChatWindows=e.chat.max_windows,!e.chat||!_.isEmpty(e.chat.active)&&_.includes(_.values(e.chat.active),"on")||(this.active=!1),this.ajax({id:"preferences",type:"PUT",url:this.apiPath+"/users/preferences",data:JSON.stringify(e),processData:!0,success:this.success,error:this.error})},e.prototype.success=function(){return!0===this.active||!1===this.active?(this.windowSpace.meta.active=this.active,this.windowSpace.pushState()):App.WebSocket.send({event:"chat_status_agent"}),App.User.full(App.Session.get("id"),(t=this,function(){return t.close()}),!0);var t},e.prototype.error=function(t){var e;return e=JSON.parse(t.responseText),this.notify({type:"error",msg:App.i18n.translateContent(e.message)})},e}(App.ControllerModal),e=function(t){function e(t){var n;e.__super__.constructor.apply(this,arguments),n={session_id:t.session_id},App.TaskManager.execute({key:"CustomerChat",controller:"CustomerChat",params:n,show:!0,persistent:!0})}return s(e,t),e.requiredPermission="chat.agent",e}(App.ControllerPermanent),App.Config.set("customer_chat",e,"Routes"),App.Config.set("customer_chat/session/:session_id",e,"Routes"),App.Config.set("CustomerChat",{controller:"CustomerChat",permission:["chat.agent"]},"permanentTask"),App.Config.set("CustomerChat",{prio:1200,parent:"",name:__("Customer Chat"),target:"#customer_chat",key:"CustomerChat",shown:!1,permission:["chat.agent"],class:"chat"},"NavBar")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.clues=e(this.clues,this),i.__super__.constructor.apply(this,arguments),this.navupdate("#",!0),this.clues()}return n(i,t),i.prototype.clues=function(){return new App.FirstStepsClues({appEl:this.appEl,onComplete:(t=this,function(){return App.Ajax.request({id:"preferences",type:"PUT",url:t.apiPath+"/users/preferences",data:JSON.stringify({intro:!0}),processData:!0}),t.navigate("#")})});var t},i}(App.Controller),App.Config.set("clues",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.setAttributes(),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"CoreWorkflow",defaultSortBy:"priority, name",pageData:{home:"core_workflow",object:__("Workflow"),objects:__("Workflows"),pagerAjax:!0,pagerBaseUrl:"#manage/core_workflow/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#core_workflow",notes:[__("Core Workflows are actions or constraints on selections in forms. Depending on an action, it is possible to hide or restrict fields or to change the obligation to fill them in.")],buttons:[{name:__("New Workflow"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content"),veryLarge:!0,handlers:[App.FormHandlerAdminCoreWorkflow.run]})}return n(i,t),i.requiredPermission="admin.core_workflow",i.prototype.header=__("Core Workflows"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i.prototype.setAttributes=function(){var t,e,n,i,s,r;for(s=[],e=0,n=(i=App.CoreWorkflow.configure_attributes).length;e<n;e++)"object"===(t=i[e]).name?(t.options={},s.push(function(){var e,n,i,s;for(s=[],e=0,n=(i=App.FormHandlerCoreWorkflow.getObjects()).length;e<n;e++)r=i[e],s.push(t.options[r]=r);return s}())):"preferences::screen"===t.name?(t.options={},s.push(function(){var e,n,i,s;for(s=[],e=0,n=(i=App.FormHandlerCoreWorkflow.getScreens()).length;e<n;e++)r=i[e],s.push(t.options[r]=this.screen2displayName(r));return s}.call(this))):s.push(void 0);return s},i.prototype.screen2displayName=function(t){return{create:__("Creation mask"),create_middle:__("Creation mask"),edit:__("Edit mask"),overview_bulk:__("Overview bulk mask")}[t]||t},i}(App.ControllerSubContent),App.Config.set("CoreWorkflowObject",{prio:1750,parent:"#system",name:"Core Workflows",target:"#system/core_workflow",controller:t,permission:["admin.core_workflow"]},"NavBarAdmin")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;App.CTI=function(t){function s(){var t,e;this.currentPosition=n(this.currentPosition,this),this.setPosition=n(this.setPosition,this),this.switch=n(this.switch,this),this.counter=n(this.counter,this),this.active=n(this.active,this),this.show=n(this.show,this),this.newTicket=n(this.newTicket,this),this.done=n(this.done,this),this.doneAll=n(this.doneAll,this),this.featureActive=n(this.featureActive,this),this.ringingCalls=n(this.ringingCalls,this),s.__super__.constructor.apply(this,arguments),t=this.Session.get("preferences")||{},this.meta.active=t.cti||!1,this.load(),this.controllerBind("cti_list_push",(e=this,function(){var t;return t=function(){return e.load()},e.delay(t,500,"cti_list_push_render"),"cti_list_push"})),this.controllerBind("cti_event",function(t){return function(e){if("newCall"===e.state&&"in"===e.direction&&!0===t.switch())return document.hasFocus()||t.notify(e),"cti_event"}}(this)),this.controllerBind("menu:render",function(t){return function(){var e;if(!0===t.switch())return e=App.view("navigation/menu_cti_ringing")({item:t.ringingCalls()}),$(".js-phoneMenuItem").after(e),$(".call-widget").find(".js-newUser").on("click",(function(e){return t.newUser(e)})),$(".call-widget").find(".js-newTicket").on("click",(function(e){var n,i;return n=void 0,(i=$(e.currentTarget).data("user-id"))&&(n=App.User.find(i)),t.newTicket(n)}))}}(this)),this.controllerBind("auth",function(t){return function(){return t.meta.counter=0}}(this)),
this.controllerBind("cti:reload",function(t){return function(){return t.load(),"cti_reload"}}(this)),this.controllerBind("ui:rerender",function(t){return function(){return t.render(),"cti_rerender"}}(this)),this.controllerBind("ws:login",function(t){return function(){if(!t.initiallyLoaded)return t.initiallyLoaded=!0;t.load()}}(this))}return i(s,t),s.extend(App.PopoverProvidable),s.registerPopovers("User"),s.prototype.elements={".js-callerLog":"callerLog"},s.prototype.events={"click .js-check":"done","click .js-checkAll":"doneAll","click .js-newUser":"newUser"},s.prototype.list=[],s.prototype.backends=[],s.prototype.meta={active:!1,counter:0,state:{}},s.prototype.backendEnabled=!1,s.prototype.ringingCalls=function(){var t,e,n,i,s;for(i=[],t=0,e=(n=this.list).length;t<e;t++)"newCall"===(s=n[t]).state&&!1===s.done&&i.push(s);return i},s.prototype.load=function(){return this.ajax({id:"cti_log",type:"GET",url:this.apiPath+"/cti/log",success:(t=this,function(e){var n,i,s,r;if(e.assets&&App.Collection.loadAssets(e.assets),e.backends){for(t.backends=e.backends,n=!1,i=0,s=(r=t.backends).length;i<s;i++)r[i].enabled&&(n=!0);n!==t.backendEnabled&&(t.renderDone=!1),t.backendEnabled=n}if(e.list)return t.list=e.list,t.updateNavMenu(),t.renderDone?void t.renderCallerLog():t.render()})});var t},s.prototype.notify=function(t){var e,n;return e=App.i18n.translateContent("Call from %s for %s",t.from_comment||t.from,t.to_comment||t.to),n=App.Utils.html2text(e.replace(/<.+?>/g,'"')),this.notifyDesktop({url:"#cti",title:n})},s.prototype.featureActive=function(){return!!this.Config.get("sipgate_integration")||(!!this.Config.get("cti_integration")||!!this.Config.get("placetel_integration"))},s.prototype.render=function(){if(this.renderDone=!0,this.permissionCheck("cti.agent"))return this.backendEnabled?(this.html(App.view("cti/index")()),this.renderCallerLog()):(this.html(App.view("cti/not_configured")({backends:this.backends,isAdmin:this.permissionCheck("admin.integration")})),void this.updateNavMenu());this.renderScreenUnauthorized({objectName:"CTI"})},s.prototype.renderCallerLog=function(){var t,n,i,s,r;for(t=0,i=(r=this.list).length;t<i;t++)(n=r[t]).status_class="",n.disabled=!0,"newCall"===n.state?(n.state_human=__("ringing"),n.status_class="neutral"):"answer"===n.state?(n.state_human=__("connected"),n.status_class="ok"):"hangup"===n.state?(n.disabled=!1,n.state_human=function(){switch(n.comment){case"cancel":case"noAnswer":case"congestion":return __("not reached");case"busy":return __("busy");case"notFound":return __("does not exist");case"normalClearing":return"";default:return n.comment}}()):(n.state_human=n.state,n.comment&&(n.state_human+=", "+n.comment)),(Date.now()-Date.parse(n.created_at))/1e3/60>1&&(n.disabled=!1);return this.removePopovers(),(s=$(App.view("cti/caller_log")({list:this.list}))).find(".js-avatar").each((function(){var t;return t=$(this),new e({el:t,object_id:t.attr("data-id"),level:t.attr("data-level"),size:40})})),this.callerLog.html(s),this.updateNavMenu()},s.prototype.doneAll=function(){return this.logIds=$(".js-callerLog").map((function(){if(!$(this).find(".js-check").prop("checked"))return $(this).data("id")})).get(),this.ajax({type:"POST",url:this.apiPath+"/cti/done/bulk",data:JSON.stringify({ids:this.logIds})})},s.prototype.done=function(t){var e,n,i;return i=(n=$(t.currentTarget)).closest("tr").data("id"),e=n.prop("checked"),this.ajax({type:"POST",url:this.apiPath+"/cti/done/"+i,data:JSON.stringify({done:e}),queue:"cti_done_queue"})},s.prototype.newTicket=function(t){if(!t)return this.navigate("ticket/create");this.navigate("ticket/create/customer/"+t.id)},s.prototype.newUser=function(t){var e;return t.preventDefault(),e=$(t.currentTarget).data("phone"),new App.ControllerGenericNew({pageData:{title:__("Users"),home:"users",object:__("User"),objects:__("Users"),navupdate:"#users"},genericObject:"User",item:{phone:e},callback:this.ticketNew})},s.prototype.ticketNew=function(t){return this.navigate("#ticket/create/customer/"+t.id)},s.prototype.show=function(){return this.title(__("CTI"),!0),this.navupdate("#cti")},s.prototype.active=function(t){return void 0===t?this.shown:this.shown=t},s.prototype.counter=function(){var t,e,n,i;for(t=0,e=0,n=(i=this.list).length;e<n;e++)i[e].done||t++;return this.meta.counter=t},s.prototype.switch=function(t){return null==t&&(t=void 0),void 0===t?this.meta.active:(this.meta.active=t,this.ajax({id:"preferences",type:"PUT",url:this.apiPath+"/users/preferences",data:JSON.stringify({cti:t}),processData:!0}))},s.prototype.setPosition=function(t){return this.$(".main").scrollTop(t)},s.prototype.currentPosition=function(){return this.$(".main").scrollTop()},s}(App.Controller),e=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.extend(App.PopoverProvidable),e.registerPopovers("User"),e.prototype.model="User",e.prototype.observe={login:!0,firstname:!0,lastname:!0,organization_id:!0,email:!0,image:!0,vip:!0,out_of_office:!0,out_of_office_start_at:!0,out_of_office_end_at:!0,out_of_office_replacement_id:!0,active:!0},e.prototype.globalRerender=!1,e.prototype.render=function(t){var e;return e=["user-popover","u-textTruncate"],t.active||e.push("is-inactive"),this.html(App.view("cti/caller_log_avatar")({user:t,classes:e,level:this.level})),this.renderPopovers()},e}(App.ControllerObserver),t=function(t){function e(t){e.__super__.constructor.apply(this,arguments),App.TaskManager.execute({key:"CTI",controller:"CTI",params:{},show:!0,persistent:!0})}return i(e,t),e.requiredPermission="cti.agent",e}(App.ControllerPermanent),App.Config.set("cti",t,"Routes"),App.Config.set("CTI",{controller:"CTI",permission:["cti.agent"]},"permanentTask"),App.Config.set("CTI",{prio:1300,parent:"",name:__("Phone"),target:"#cti",key:"CTI",shown:!1,permission:["cti.agent"],class:"phone"},"NavBar")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.CustomerChatImageView=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!1,i.prototype.buttonSubmit="Download",i.prototype.buttonClass="btn--success",i.prototype.head="",i.prototype.dynamicSize=!0,i.prototype.content=function(){return'<div class="centered imagePreview"><img style="max-width: 100%; width: 1000px;" src="'+this.image_base64+'"></div>'},i.prototype.onSubmit=function(){var t;return(t=document.createElement("a")).href=this.image_base64,t.target="_blank",t.download="chat_message_image",t.click()},i}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(t){this.submitEnable=e(this.submitEnable,this),this.submitDisable=e(this.submitDisable,this),this.params=e(this.params,this),this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),this.sidebarState={},this.title(__("New Ticket")),this.form_id=App.ControllerForm.formId(),this.navupdate("#customer_ticket_new"),this.render()}return n(i,t),i.requiredPermission="ticket.customer",i.prototype.elements={".tabsSidebar":"sidebar",".tabsSidebar-sidebarSpacer":"sidebarSpacer"},i.prototype.events={"submit form":"submit","click .submit":"submit","click .cancel":"cancel"},i.prototype.show=function(){if(window.matchMedia("(max-width: 767px)").matches)return this.sidebar.addClass("is-closed"),this.sidebarSpacer.addClass("is-closed")},i.prototype.render=function(t){var e,n,i,s,r,o,a,l;if(null==t&&(t={}),this.Config.get("customer_ticket_create"))return i=t.options||{},s=this.Config.get("TicketCreateFormHandler"),this.html(App.view("customer_ticket_create")({head:__("New Ticket"),form_id:this.form_id})),o={ticket_duplicate_detection:{name:"ticket_duplicate_detection",display:"ticket_duplicate_detection",tag:"ticket_duplicate_detection",label_class:"hidden",renderTarget:".ticket-form-top",null:!0}},a=App.Ticket.attributesGet("create_top",!1,!0,void 0,".ticket-form-top"),e=App.TicketArticle.attributesGet("create_top",!1,!0,void 0,".article-form-top"),r=App.Ticket.attributesGet("create_middle",!1,!0,void 0,".ticket-form-middle"),n=App.Ticket.attributesGet("create_bottom",!1,!0,void 0,".ticket-form-bottom"),this.controllerFormCreateMiddle=new App.ControllerForm({el:this.el.find(".ticket-create"),form_id:this.form_id,model:App.Ticket,screen:"create_middle",mixedAttributes:Object.assign({},o,a,e,r,n),params:i,noFieldset:!0,handlersConfig:s,rejectNonExistentValues:!0,autofocus:!0,events:{"fileUploadStart .richtext":(l=this,function(){return l.submitDisable()}),"fileUploadStop .richtext":function(t){return function(){return t.submitEnable()}}(this)}}),this.$('[name="group_id"], [name="organization_id"]').bind("change",function(t){return function(){return t.sidebarWidget.render(t.params())}}(this)),this.sidebarWidget=new App.TicketCreateSidebar({el:this.sidebar,params:i,sidebarState:this.sidebarState});this.renderScreenError({detail:__("Your user role is not allowed to create new tickets. Please contact your administrator."),objectName:"Ticket"})},i.prototype.cancel=function(){return this.navigate("#")},i.prototype.params=function(){return this.formParam(this.$(".main form"))},i.prototype.submit=function(t){var e,n,i,s,r,o,a,l;return t.preventDefault(),(i=this.formParam(t.target)).customer_id=this.Session.get("id"),i.state_id||(r=App.TicketState.findByAttribute("default_create",!0),i.state_id=r.id),i.title||(i.title=i.subject),o=new App.Ticket,this.log("CustomerTicketCreate","notice","updateAttributes",i),s=App.TicketArticleSender.findByAttribute("name","Customer"),a=App.TicketArticleType.findByAttribute("name","web"),i.group_id&&(n=App.Group.find(i.group_id)),i.article={from:""+this.Session.get().displayName(),to:n&&n.name||"",subject:i.subject,body:i.body,type_id:a.id,sender_id:s.id,form_id:this.form_id,content_type:"text/html"},o.load(i),(new App.TicketArticle).load(i.article),e=o.validate({controllerForm:this.controllerFormCreateMiddle,target:t.target}),_.isEmpty(e)?(this.sidebarWidget&&this.sidebarWidget.postParams&&this.sidebarWidget.postParams({ticket:o}),this.submitDisable(t),l=this,o.save({done:function(){return l.sidebarWidget&&l.sidebarWidget.commit({ticket_id:this.id}),l.navigate("#ticket/zoom/"+this.id)},fail:function(e,n){return l.log("errors",n),l.submitEnable(t),l.notify({type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("The object could not be created.")),timeout:6e3})}})):(this.log("CustomerTicketCreate","error","can not create",e),this.formValidate({form:t.target,errors:e}))},i.prototype.submitDisable=function(t){if(!t)return this.formDisable(this.$(".js-submit"),"button");this.formDisable(t)},i.prototype.submitEnable=function(t){if(!t)return this.formEnable(this.$(".js-submit"),"button");this.formEnable(t)},i}(App.ControllerAppContent),App.Config.set("customer_ticket_new",t,"Routes"),App.Config.set("CustomerTicketNew",{prio:8003,parent:"#new",name:__("New Ticket"),translate:!0,target:"#customer_ticket_new",permission:function(t){return!t.permissionCheck("ticket.agent")&&t.permissionCheck("ticket.customer")},setting:["customer_ticket_create"],divider:!0},"NavBarRight")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SidebarCustomerDefault=function(n){function i(e){this.renderSidebar=t(this.renderSidebar,this),this.sidebarItem=t(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments),this.permissionCheck("ticket.agent")||this.permissionCheck("ticket.customer")&&this.render()}return e(i,n),i.prototype.sidebarItem=function(){if(!this.permissionCheck("ticket.agent")&&this.permissionCheck("ticket.customer"))return this.item={name:"sidebar_customer_default",badgeIcon:"info",sidebarHead:__("What can you do here?"),sidebarCallback:this.renderSidebar},this.item},i.prototype.renderSidebar=function(t){return t&&(this.el=t),this.render()},i.prototype.render=function(){return this.html(new App.ControllerDrox({data:{html:App.i18n.translateInline('The way to communicate with us is this thing called "ticket".')+" "+App.i18n.translateInline("Here you can create one.")}}))},i}(App.Controller),App.Config.set("1000-SidebarCustomerDefault",App.SidebarCustomerDefault,"TicketCreateSidebar")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.DarkMode=function(n){function i(){this.onUpdate=t(this.onUpdate,this),this.quickToggleChange=t(this.quickToggleChange,this),this.onMenuItemClick=t(this.onMenuItemClick,this),i.__super__.constructor.apply(this,arguments),this.quickToggle=$("#dark-mode-quick-switch"),this.quickToggleLabel=this.quickToggle.next("label"),this.quickToggleMenuItem=this.quickToggle.closest(".dropdown-menu-item--toggle").find("span.u-textTruncate"),this.quickToggleMenuItem.on("click",this.onMenuItemClick),this.quickToggleLabel.on("click",this.quickToggleChange),this.controllerBind("ui:theme:changed",this.onUpdate)}return e(i,n),i.prototype.currentTheme=function(){return this.quickToggle.prop("checked")?"dark":"light"},i.prototype.oppositeTheme=function(){return this.quickToggle.prop("checked")?"light":"dark"},i.prototype.onMenuItemClick=function(t){return t.stopPropagation(),this.quickToggleLabel.trigger("click")},i.prototype.quickToggleChange=function(t){return t.stopPropagation(),App.Event.trigger("ui:theme:set",{theme:this.oppositeTheme(),save:!0,toggleLoop:!0})},i.prototype.onUpdate=function(t){if(!0!==t.toggleLoop&&t.theme!==this.currentTheme())return this.quickToggle.prop("checked","dark"===t.theme)},i}(App.Controller),App.Config.set("DarkMode",{prio:1e3,parent:"#current_user",name:__("Dark Mode"),translate:!0,toggle:"dark-mode-quick",checked:function(){return"dark"===document.documentElement.dataset.theme},permission:["user_preferences.appearance"]},"NavBarRight")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.Dashboard=function(t){function i(){var t;(this.toggle=e(this.toggle,this),this.show=e(this.show,this),this.active=e(this.active,this),this.clues=e(this.clues,this),this.mayBeClues=e(this.mayBeClues,this),i.__super__.constructor.apply(this,arguments),this.permissionCheck("ticket.agent"))?(this.render(),this.controllerBind("ui:rerender",(t=this,function(){if(t.authenticateCheck())return t.render()})),this.mayBeClues()):this.clueAccess=!1}return n(i,t),i.prototype.clueAccess=!0,i.prototype.events={"click .tabs .tab":"toggle","click .js-intro":"clues"},i.prototype.render=function(){var t;return t=$(App.view("dashboard")({head:__("Dashboard"),isAdmin:this.permissionCheck("admin")})),new App.DashboardStats({el:t.find(".stat-widgets")}),new App.DashboardActivityStream({el:t.find(".js-activityContent"),limit:25}),new App.DashboardFirstSteps({el:t.find(".first-steps-widgets")}),this.html(t)},i.prototype.mayBeClues=function(){var t;if(!this.Config.get("after_auth")&&this.clueAccess&&this.shown&&!this.Config.get("switch_back_to_possible")&&(t=this.Session.get("preferences"),this.clueAccess=!1,!t.intro))return this.clues()},i.prototype.clues=function(t){return this.clueAccess=!1,t&&t.preventDefault(),this.navigate("#clues")},i.prototype.active=function(t){return void 0===t?this.shown:(this.shown=t,t?this.mayBeClues():void 0)},i.prototype.url=function(){return"#dashboard"},i.prototype.show=function(){if(!this.permissionCheck("ticket.customer")||this.permissionCheck("ticket.agent")){if(this.permissionCheck("ticket.customer")||this.permissionCheck("ticket.agent")||!this.permissionCheck("admin"))return this.title(__("Dashboard")),this.navupdate("#dashboard");this.navigate("#manage",{hideCurrentLocationFromHistory:!0})}else this.navigate("#ticket/view",{hideCurrentLocationFromHistory:!0})},i.prototype.changed=function(){return!1},i.prototype.toggle=function(t){var e;return this.$(".tabs .tab").removeClass("active"),$(t.target).addClass("active"),e=$(t.target).data("area"),this.$(".tab-content").addClass("hidden"),this.$(".tab-content."+e).removeClass("hidden")},i}(App.Controller),t=function(t){function e(t){e.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),App.TaskManager.execute({key:"Dashboard",controller:"Dashboard",params:{},show:!0,persistent:!0})}return n(e,t),e.requiredPermission=["*"],e}(App.ControllerPermanent),App.Config.set("dashboard",t,"Routes"),App.Config.set("Dashboard",{controller:"Dashboard",permission:["*"]},"permanentTask"),App.Config.set("Dashboard",{prio:100,parent:"",name:__("Dashboard"),target:"#dashboard",key:"Dashboard",permission:["ticket.agent"],class:"dashboard"},"NavBar")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;t=function(t){function s(){this.description=n(this.description,this),this.release=n(this.release,this),this.render=n(this.render,this),this.show=n(this.show,this),this.load=n(this.load,this),s.__super__.constructor.apply(this,arguments),this.load(),this.subscribeDataPrivacyTaskId=App.DataPrivacyTask.subscribe(this.render)}return i(s,t),s.requiredPermission="admin.data_privacy",s.prototype.header=__("Data Privacy"),s.prototype.events={"click .js-new":"new","click .js-description":"description","click .js-toggle-tickets":"toggleTickets"},s.prototype.load=function(){var t,e;return e=this,t=function(){return e.stopLoading(),e.render()},this.startLoading(),App.DataPrivacyTask.fetchFull(t,{clear:!0})},s.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return t.integration?(this.user_id=t.integration,void this.navigate("#system/data_privacy")):this.user_id?(this.new(!1,this.user_id),this.user_id=void 0):void 0},s.prototype.render=function(){var t,e,n,i,s,r,o;return r=App.DataPrivacyTask.search({filter:{state:"in process"},order:"DESC"}),o=App.view("data_privacy/tasks")({tasks:r}),i=App.DataPrivacyTask.search({filter:{state:"failed"},order:"DESC"}),s=App.view("data_privacy/tasks")({tasks:i}),t=App.DataPrivacyTask.search({filter:{state:"completed"},order:"DESC"}),e=App.view("data_privacy/tasks")({tasks:t}),n=marked(App.i18n.translateContent(App.DataPrivacyTask.description)),this.html(App.view("data_privacy/index")({taskCount:r.length+i.length+t.length,runningTaskCount:r.length,failedTaskCount:i.length,completedTaskCount:t.length,runningTasksHTML:o,failedTasksHTML:s,completedTasksHTML:e,description:n}))},s.prototype.release=function(){if(this.subscribeDataPrivacyTaskId)return App.DataPrivacyTask.unsubscribe(this.subscribeDataPrivacyTaskId)},s.prototype.new=function(t,n){return null==n&&(n=void 0),t&&t.preventDefault(),new e({pageData:{head:__("Deletion Task"),title:__("Deletion Task"),object:__("DataPrivacyTask"),objects:__("DataPrivacyTasks")},genericObject:"DataPrivacyTask",container:this.el.closest(".content"),callback:this.load,large:!0,handlers:[this.formHandler],item:{deletable_id:n}})},s.prototype.toggleTickets=function(t){var e,n,i,s,r,o;if(t.preventDefault(),n=$(t.target).data("id"),o=$(t.target).data("type"),e=$(t.target).hasClass("expanded"),n)return s="",r=__("See more"),e||(s=" expanded",r=__("See less")),i=clone(App.DataPrivacyTask.find(n).preferences[o]),e&&(i=i.slice(0,50)).push("..."),i=i.join(", "),$(t.target).closest("div.ticket-list").html(i+' <br><div class="btn btn--text js-toggle-tickets'+s+'" data-type="'+o+'" data-id="'+n+'">'+App.i18n.translateInline(r)+"</div>")},s.prototype.description=function(){return new App.ControllerGenericDescription({description:App.DataPrivacyTask.description,container:this.el.closest(".content")})},s.prototype.formHandler=function(t,e,n,i,s,r){var o,a,l;if(e&&((l=t.deletable_id)?$("body").find(".js-TaskNew").removeClass("hidden"):($("body").find(".js-TaskNew").addClass("hidden"),s.find(".js-preview").remove()),l))return o={condition:{"ticket.customer_id":{operator:"is",pre_condition:"specific",value:l}}},a={condition:{"ticket.owner_id":{operator:"is",pre_condition:"specific",value:l}}},App.Ajax.request({id:"ticket_selector",type:"POST",url:App.Config.get("api_path")+"/tickets/selector",data:JSON.stringify(o),processData:!0,success:function(t){return App.Collection.loadAssets(t.assets),App.Ajax.request({id:"ticket_selector",type:"POST",url:App.Config.get("api_path")+"/tickets/selector",data:JSON.stringify(a),processData:!0,success:function(n){var o,a,c,u,p,h;if(App.Collection.loadAssets(n.assets),o="",(h=App.User.find(l)).organization_id&&(a=App.Organization.find(h.organization_id))&&a.member_ids.length<2&&(e={name:"preferences::delete_organization",display:__("Delete organization?"),tag:"boolean",default:!0,translate:!0},o=r.formGenItem(e,i,s).html()),p={name:"preferences::sure",display:__("Are you sure?"),tag:"input",translate:!1,placeholder:App.i18n.translateInline("delete").toUpperCase()},u=r.formGenItem(p,i,s).html(),c=App.view("data_privacy/preview")({customer_count:t.object_count||0,owner_count:n.object_count||0,delete_organization_html:o,sure_html:u,user_id:l}),s.find(".js-preview").length<1?s.append(c):s.find(".js-preview").replaceWith(c),new App.TicketList({tableId:"ticket-selector",el:s.find(".js-previewTableCustomer"),ticket_ids:t.object_ids}),s.find(".js-previewTableOwner").length)return new App.TicketList({tableId:"ticket-selector",el:s.find(".js-previewTableOwner"),ticket_ids:n.object_ids})}})}})},s}(App.ControllerSubContent),e=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.buttonSubmit=__("Delete"),e.prototype.buttonClass="btn--danger js-TaskNew hidden",e.prototype.content=function(){return this.item.deletable_id?this.buttonClass="btn--danger js-TaskNew":this.buttonClass="btn--danger js-TaskNew hidden",e.__super__.content.apply(this,arguments)},e.prototype.onSubmit=function(t){var e,n,i,s;return(i=this.formParam(t.target)).deletable_type="User",(n=new App[this.genericObject]).load(i),e=n.validate(),i.preferences.sure!==App.i18n.translateInline("delete").toUpperCase()&&(e||(e={}),e["preferences::sure"]="invalid"),e?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),s=this,n.save({done:function(){var t;return s.callback&&(t=App[s.genericObject].fullLocal(this.id),s.callback(t)),s.close()},fail:function(e,n){return s.log("errors",n),s.formEnable(t),s.controller.showAlert(n.error_human||n.error||__("The object could not be created."))}}))},e}(App.ControllerGenericNew),App.Config.set("DataPrivacy",{prio:3600,name:__("Data Privacy"),parent:"#system",target:"#system/data_privacy",controller:t,permission:["admin.data_privacy"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t;if(n.__super__.constructor.apply(this,arguments),"/test"!==window.location.pathname.substr(0,5))if(this.Config.get("system_init_done")||!this.Config.get("import_mode"))if(this.Config.get("system_init_done")){if(t=this.requestedUrlWas())return this.requestedUrlRemember(""),this.log("notice","REDIRECT to '"+t+"'"),void this.navigate(t,{hideCurrentLocationFromHistory:!0});this.Config.get("default_controller")?this.navigate(this.Config.get("default_controller"),{hideCurrentLocationFromHistory:!0}):this.navigate("#dashboard",{hideCurrentLocationFromHistory:!0})}else this.navigate("#getting_started",{hideCurrentLocationFromHistory:!0});else this.navigate("#import",{hideCurrentLocationFromHistory:!0})}return e(n,t),n}(App.Controller),App.Config.set("",t,"Routes"),App.Config.set("/",t,"Routes")}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(){this.error=i(this.error,this),this.success=i(this.success,this),this.verifyCall=i(this.verifyCall,this),r.__super__.constructor.apply(this,arguments),this.verifyCall()}return s(r,t),r.prototype.verifyCall=function(){return this.ajax({id:"email_verify",type:"POST",url:this.apiPath+"/users/email_verify",data:JSON.stringify({token:this.token}),processData:!0,success:this.success,error:this.error})},r.prototype.success=function(){return new n({el:this.el,appEl:this.appEl})},r.prototype.error=function(){return new e({el:this.el,appEl:this.appEl})},r}(App.Controller),n=function(t){function e(){var t;this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render(),this.controllerBind("ui:rerender",(t=this,function(){return t.render()}))}return s(e,t),e.prototype.render=function(){var t,e;return this.renderScreenSuccess({detail:__("Woo hoo! Your email address has been verified!")}),e=this,t=function(){return e.navigate("#")},this.delay(t,2e3)},e}(App.ControllerAppContent),e=function(t){function e(){var t;this.render=i(this.render,this),e.__super__.constructor.apply(this,arguments),this.render(),this.controllerBind("ui:rerender",(t=this,function(){return t.render()}))}return s(e,t),e.prototype.render=function(){return this.renderScreenError({detail:__("Email could not be verified. Please contact your administrator.")})},e}(App.ControllerAppContent),App.Config.set("email_verify/:token",t,"Routes")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),!this.authenticateCheck()||this.permissionCheck("admin.wizard")?(this.title(__("Get Started")),this.Config.get("system_init_done")?this.navigate("#login"):this.Config.get("ImportPlugins")?this.fetch():this.navigate("getting_started/admin")):this.navigate("#")}return e(n,t),n.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.auto_wizard){if(!0!==e.import_mode)return t.render();t.navigate("#import/"+e.import_backend)}else t.renderAutoWizard()})});var t},n.prototype.render=function(){return this.replaceWith(App.view("getting_started/intro")())},n.prototype.renderAutoWizard=function(){return this.replaceWith(App.view("getting_started/auto_wizard_enabled")())},n}(App.ControllerWizardFullScreen),App.Config.set("getting_started",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.relogin=e(this.relogin,this),this.submit=e(this.submit,this),i.__super__.constructor.apply(this,arguments),!this.authenticateCheck()||this.permissionCheck("admin.wizard")?(this.title(__("Create Admin")),this.Config.get("system_init_done")?this.navigate("#login"):this.fetch()):this.navigate("#")}return n(i,t),i.prototype.events={"submit form":"submit"},i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode)return App.Collection.load({type:"Group",data:e.groups}),t.render();t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){return this.replaceWith(App.view("getting_started/admin")()),this.form=new App.ControllerForm({el:this.$(".js-admin-form"),model:App.User,screen:"signup",autofocus:!0})},i.prototype.submit=function(t){var e,n,i;return t.preventDefault(),this.formDisable(t),this.params=this.formParam(t.target),this.params.role_ids=[],(n=new App.User).load(this.params),(e=n.validate({controllerForm:this.form}))?(this.log("error new",e),Object.keys(e).forEach((function(t){return e[t]=null})),this.formValidate({form:t.target,errors:e}),this.formEnable(t),!1):(this.formValidate({form:t.target,errors:e}),n.save({done:(i=this,function(){return App.Auth.login({data:{username:i.params.email,password:i.params.password},success:i.relogin,error:function(){return App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent("The sign-in failed. Please contact the Support team."),timeout:2500})}}),i.Config.set("system_init_done",!0)}),fail:function(e){return function(n,i){return e.formEnable(t),e.form.showAlert(i.error_human||i.error||__("User could not be created."))}}(this)}))},i.prototype.relogin=function(t){return this.log("notice","relogin:success",t),App.Event.trigger("notify:removeall"),this.navigate("getting_started/base",{emptyEl:!0})},i}(App.ControllerWizardFullScreen),App.Config.set("getting_started/admin",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.submit=e(this.submit,this),i.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),this.title(__("Invite Agents")),this.fetch()}return n(i,t),i.prototype.events={"submit form":"submit"},i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode)return App.Collection.load({type:"Group",data:e.groups}),t.render();t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){var t;return this.replaceWith(App.view("getting_started/agent")()),this.el.find(".wizard-slide").addClass("wizard-slide--very-large"),t=App.Role.findByAttribute("name","Agent"),this.form=new App.ControllerForm({el:this.$(".js-agent-form"),model:App.User,screen:"invite_agent",params:{role_ids:[null!=t?t.id:void 0]},autofocus:!0})},i.prototype.submit=function(t){var e,n,i;return t.preventDefault(),this.formDisable(t),this.params=this.formParam(t.target),this.params.invite=!0,(n=new App.User).load(this.params),(e=n.validate({controllerForm:this.form}))?(this.log("error new",e),this.formValidate({form:t.target,errors:e}),this.formEnable(t),!1):n.save({done:(i=this,function(){return App.Event.trigger("notify",{type:"success",msg:App.i18n.translateContent("Invitation sent!"),timeout:3500}),i.render()}),fail:function(e){return function(n,i){return e.formEnable(t),e.form.showAlert(i.error_human||__("Can't create user!"))}}(this)})},i}(App.ControllerWizardFullScreen),App.Config.set("getting_started/agents",t,"Routes")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),!this.authenticateCheck()||this.permissionCheck("admin.wizard")?this.Config.get("system_init_done")?this.navigate("#login"):(this.title(__("Auto Wizard")),this.renderSplash(),this.fetch()):this.navigate("#")}return e(n,t),n.prototype.fetch=function(){var t,e;return t=this.apiPath+"/getting_started/auto_wizard",this.token&&(t+="/"+this.token),this.ajax({id:"auto_wizard",type:"GET",url:t,processData:!0,success:(e=this,function(t){if(!1!==t.auto_wizard)if(!0!==t.auto_wizard_success){if(!1!==t.auto_wizard_success)return e.redirectToLogin();t.message?e.renderFailed(t):e.renderToken()
}else e.delay(e.redirectToLogin,800);else e.redirectToLogin()})})},n.prototype.renderFailed=function(t){return this.replaceWith(App.view("getting_started/auto_wizard_failed")(t))},n.prototype.renderSplash=function(){return this.replaceWith(App.view("getting_started/auto_wizard_splash")())},n.prototype.renderToken=function(){return this.replaceWith(App.view("getting_started/auto_wizard_enabled")())},n}(App.ControllerWizardFullScreen),App.Config.set("getting_started/auto_wizard",t,"Routes"),App.Config.set("getting_started/auto_wizard/:token",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.showAlert=e(this.showAlert,this),this.hideAlerts=e(this.hideAlerts,this),this.submit=e(this.submit,this),this.onLogoPick=e(this.onLogoPick,this),i.__super__.constructor.apply(this,arguments),this.permissionCheck("admin.wizard")?(this.title(__("Configure Basic Settings")),this.fetch()):this.navigate("#")}return n(i,t),i.prototype.elements={".logo-preview":"logoPreview"},i.prototype.events={"submit form":"submit","change .js-upload":"onLogoPick"},i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){var n,i,s;if(!0!==e.import_mode){if(e.config)for(n in i=e.config)s=i[n],App.Config.set(n,s);return t.render()}t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){var t,e,n,i;return t=App.Config.get("fqdn"),e=App.Config.get("http_type"),i=t&&"zammad.example.com"!==t?e+"://"+t:window.location.origin,n=App.Config.get("organization"),this.replaceWith(App.view("getting_started/base")({url:i,logoUrl:this.logoUrl(),organization:n})),this.$("input, select").first().trigger("focus")},i.prototype.onLogoPick=function(t){var e,n,i,s;if((i=new FileReader).onload=(s=this,function(t){return s.logoPreview.attr("src",t.target.result)}),e=t.target.files[0],this.hideAlerts(),e)return n=8,e.size&&e.size>1048576*n?(this.showAlert("logo",App.i18n.translateInline("File too big, max. %s MB allowed.",n)),void this.logoPreview.attr("src","")):i.readAsDataURL(e)},i.prototype.submit=function(t){var e,n;return t.preventDefault(),this.hideAlerts(),this.disable(t),this.params=this.formParam(t.target),this.params.logo=this.logoPreview.attr("src"),this.params.locale_default=App.i18n.detectBrowserLocale(),this.params.timezone_default=App.i18n.detectBrowserTimezone(),n=this,e=function(e){return n.params.logo_resize=e,n.ajax({id:"getting_started_base",type:"POST",url:n.apiPath+"/getting_started/base",data:JSON.stringify(n.params),processData:!0,success:function(e){var i,s,r,o;if("ok"===e.result){for(i in s=e.settings)o=s[i],App.Config.set(i,o);return App.Config.get("system_online_service")?n.navigate("getting_started/channel/email_pre_configured",{emptyEl:!0}):n.navigate("getting_started/email_notification",{emptyEl:!0})}for(i in r=e.messages)o=r[i],n.showAlert(i,o);return n.enable(t)},fail:function(){return n.enable(t)}})},App.ImageService.resizeForApp(this.params.logo,this.logoPreview.width(),this.logoPreview.height(),e)},i.prototype.hideAlerts=function(){return this.$(".form-group").removeClass("has-error"),this.$(".alert").addClass("hide")},i.prototype.showAlert=function(t,e){return this.$("[name="+t+"]").closest(".form-group").addClass("has-error"),this.$("[name="+t+"]").closest(".form-group").find(".alert").removeClass("hide").text(App.i18n.translateInline(e))},i}(App.ControllerWizardFullScreen),App.Config.set("getting_started/base",t,"Routes")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.permissionCheck("admin.wizard")?(this.title(__("Connect Channels")),this.adapters=[{name:__("Email"),class:"email",link:"#getting_started/channel/email"}],this.fetch()):this.navigate("#")}return e(n,t),n.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode)return t.render();t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},n.prototype.render=function(){return this.replaceWith(App.view("getting_started/channel")({adapters:this.adapters}))},n}(App.ControllerWizardFullScreen),App.Config.set("getting_started/channel",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.verify=e(this.verify,this),this.probleOutbound=e(this.probleOutbound,this),this.probeInboundArchive=e(this.probeInboundArchive,this),this.probeInboundMessagesFound=e(this.probeInboundMessagesFound,this),this.probeInbound=e(this.probeInbound,this),this.probeBasedOnIntro=e(this.probeBasedOnIntro,this),this.toggleOutboundAdapter=e(this.toggleOutboundAdapter,this),this.toggleInboundAdapter=e(this.toggleInboundAdapter,this),i.__super__.constructor.apply(this,arguments),this.permissionCheck("admin.wizard")?(this.title(__("Email Account")),this.account={inbound:{},outbound:{},meta:{}},this.channelDriver={email:{inbound:{},outbound:{}}},this.fetch()):this.navigate("#")}return n(i,t),i.prototype.events={"submit .js-intro":"probeBasedOnIntro","submit .js-inbound":"probeInbound","change .js-inbound [name=adapter]":"toggleInboundAdapter","change .js-outbound [name=adapter]":"toggleOutboundAdapter",'change [name="options::ssl"]':"toggleSslVerifyVisibility",'change [name="options::port"]':"toggleSslVerifyVisibility",'change [name="options::ssl_verify"]':"toggleSslVerifyAlert","submit .js-outbound":"probleOutbound","click  .js-goToSlide":"goToSlide"},i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode)return t.channelDriver=e.channel_driver,t.render();t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){var t,e,n,i;return this.replaceWith(App.view("getting_started/email")()),this.showSlide("js-intro"),e=[{name:"adapter",display:__("Send Mails via"),tag:"select",multiple:!1,null:!1,options:this.channelDriver.email.outbound}],new App.ControllerForm({el:this.$(".base-outbound-type"),model:{configure_attributes:e,className:""},params:{adapter:this.account.outbound.adapter||"smtp"}}),this.toggleOutboundAdapter(),t=[{name:"adapter",display:__("Type"),tag:"select",multiple:!1,null:!1,options:this.channelDriver.email.inbound},{name:"options::host",display:__("Host"),tag:"input",type:"text",limit:120,null:!1,autocapitalize:!1},{name:"options::user",display:__("User"),tag:"input",type:"text",limit:120,null:!1,autocapitalize:!1,autocomplete:"off"},{name:"options::password",display:__("Password"),tag:"input",type:"password",limit:120,null:!1,autocapitalize:!1,autocomplete:"off",single:!0},{name:"options::ssl",display:__("SSL/STARTTLS"),tag:"select",null:!0,options:{off:__("No SSL"),ssl:__("SSL"),starttls:__("STARTTLS")},default:"ssl",translate:!0,item_class:"formGroup--halfSize"},{name:"options::ssl_verify",display:__("SSL verification"),tag:"boolean",default:!0,null:!0,translate:!0,item_class:"formGroup--halfSize"},{name:"options::port",display:__("Port"),tag:"input",type:"text",limit:6,null:!0,autocapitalize:!1,default:"993",item_class:"formGroup--halfSize"},{name:"options::folder",display:__("Folder"),tag:"input",type:"text",limit:120,null:!0,autocapitalize:!1,item_class:"formGroup--halfSize"},{name:"options::keep_on_server",display:__("Keep messages on server"),tag:"boolean",null:!0,options:{true:"yes",false:"no"},translate:!0,default:!1,item_class:"formGroup--halfSize"}],i=function(t,e,n,i,s,r){if(t)return"imap"===t.adapter?(r.show("options::folder"),void r.show("options::keep_on_server")):(r.hide("options::folder"),r.hide("options::keep_on_server"))},n=new App.ControllerForm({el:this.$(".base-inbound-settings"),model:{configure_attributes:t,className:""},params:this.account.inbound,handlers:[i]}),this.toggleInboundAdapter(),n.el.find("select[name='options::ssl']").off("change").on("change",(function(t){return"ssl"===$(t.target).val()?n.el.find("[name='options::port']").val("993"):"off"===$(t.target).val()?n.el.find("[name='options::port']").val("143"):void 0}))},i.prototype.toggleInboundAdapter=function(){var t,e,n;return t=(e=this.$(".base-inbound-settings")).find("select[name='adapter']"),n=e.find("select[name='options::ssl'] option[value='starttls']"),"imap"!==t.val()?n.remove():n.length<1?(n=$("<option/>").attr("value","starttls").text(__("STARTTLS")),e.find("select[name='options::ssl']").append(n)):void 0},i.prototype.toggleOutboundAdapter=function(){var t,e,n;if(t={options:{}},this.account.meta&&(t.options.user=this.account.meta.email,t.options.password=this.account.meta.password,t.options.folder=this.account.meta.folder,t.options.keep_on_server=this.account.meta.keep_on_server),this.$(".base-outbound-settings").html(""),"smtp"===this.$(".js-outbound [name=adapter]").val())return e=[{name:"options::host",display:__("Host"),tag:"input",type:"text",limit:120,null:!1,autocapitalize:!1,autofocus:!0},{name:"options::user",display:__("User"),tag:"input",type:"text",limit:120,null:!0,autocapitalize:!1,autocomplete:"off"},{name:"options::password",display:__("Password"),tag:"input",type:"password",limit:120,null:!0,autocapitalize:!1,autocomplete:"off",single:!0},{name:"options::port",display:__("Port"),tag:"input",type:"text",limit:6,null:!0,autocapitalize:!1,item_class:"formGroup--halfSize"},{name:"options::ssl_verify",display:__("SSL verification"),tag:"boolean",default:!0,null:!0,translate:!0,item_class:"formGroup--halfSize"}],this.form=new App.ControllerForm({el:this.$(".base-outbound-settings"),model:{configure_attributes:e,className:""},params:this.account.outbound}),this.form.el.find("select[name='options::ssl']").off("change").on("change",(n=this,function(t){return"ssl"===$(t.target).val()?n.form.el.find("[name='options::port']").val("465"):"starttls"===$(t.target).val()?n.form.el.find("[name='options::port']").val("587"):"off"===$(t.target).val()?n.form.el.find("[name='options::port']").val("25"):void 0}))},i.prototype.probeBasedOnIntro=function(t){var e,n;return t.preventDefault(),e=this.formParam(t.target),this.account.meta=e,this.disable(t),this.$(".js-probe .js-email").text(e.email),this.showSlide("js-probe"),this.ajax({id:"email_probe",type:"POST",url:this.apiPath+"/channels_email_probe",data:JSON.stringify(e),processData:!0,success:(n=this,function(e){var i,s,r;if("ok"===e.result){if(e.setting)for(i in s=e.setting)r=s[i],n.account[i]=r;e.content_messages&&e.content_messages>0&&(!n.account.inbound.options||!0!==n.account.inbound.options.keep_on_server)?(n.probeInboundMessagesFound(e,!0),n.probeInboundArchive(e)):n.verify(n.account)}else"duplicate"===e.result?(n.showSlide("js-intro"),n.showAlert("js-intro",__("Account already exists!"))):(n.showSlide("js-inbound"),n.showAlert("js-inbound",__("The server settings could not be automatically detected. Please configure them manually.")),n.$('.js-inbound [name="options::user"]').val(n.account.meta.email),n.$('.js-inbound [name="options::password"]').val(n.account.meta.password));return n.enable(t)}),fail:function(e){return function(){return e.enable(t),e.showSlide("js-intro")}}(this)})},i.prototype.probeInbound=function(t){var e,n;return t.preventDefault(),e=this.formParam(t.target),this.disable(t),this.showSlide("js-test"),this.ajax({id:"email_inbound",type:"POST",url:this.apiPath+"/channels_email_inbound",data:JSON.stringify(e),processData:!0,success:(n=this,function(i){return"ok"===i.result?(n.account.inbound=e,i.content_messages&&i.content_messages>0&&(!n.account.inbound.options||!0!==n.account.inbound.options.keep_on_server)?(n.probeInboundMessagesFound(i,!0),n.probeInboundArchive(i)):n.showSlide("js-outbound"),n.channel||(n.account.inbound.options?(n.$('.js-outbound [name="options::host"]').val(n.account.inbound.options.host),n.$('.js-outbound [name="options::user"]').val(n.account.inbound.options.user),n.$('.js-outbound [name="options::password"]').val(n.account.inbound.options.password)):(n.$('.js-outbound [name="options::user"]').val(n.account.meta.email),n.$('.js-outbound [name="options::password"]').val(n.account.meta.password)))):(n.showSlide("js-inbound"),n.showAlert("js-inbound",i.message_human||i.message),n.showInvalidField("js-inbound",i.invalid_field)),n.enable(t)}),fail:function(e){return function(){return e.showSlide("js-inbound"),e.showAlert("js-inbound",data.message_human||data.message),e.showInvalidField("js-inbound",data.invalid_field),e.enable(t)}}(this)})},i.prototype.probeInboundMessagesFound=function(t,e){var n,i;return n=App.i18n.translateContent("We have already found %s email(s) in your mailbox. We will move them all from your mailbox into Zammad.",t.content_messages),this.$(".js-inbound-acknowledge .js-messageFound").html(n),e?(this.$(".js-inbound-acknowledge .js-back").attr("data-slide","js-intro"),this.$(".js-inbound-acknowledge .js-next").attr("data-slide",""),this.$(".js-inbound-acknowledge .js-next").off("click.verify").on("click.verify",(i=this,function(t){return t.preventDefault(),i.verify(i.account)}))):(this.$(".js-inbound-acknowledge .js-back").attr("data-slide","js-inbound"),this.$(".js-inbound-acknowledge .js-next").off("click.verify")),this.showSlide("js-inbound-acknowledge")},i.prototype.probeInboundArchive=function(t){var e,n,i;if(!0===t.archive_possible)return this.$(".js-archiveMessage").removeClass("hide"),n=App.i18n.translateContent('In addition, we have found emails in your mailbox that are older than %s weeks. You can import such emails as an "archive", which means that no notifications are sent and the tickets have the status "closed". However, you can find them in Zammad anytime using the search function.',t.archive_week_range),this.$(".js-inbound-acknowledge .js-archiveMessageCount").html(n),e=[{name:"archive",tag:"boolean",null:!0,default:!1,options:{true:"archive",false:"regular"},translate:!0}],new App.ControllerForm({elReplace:this.$(".js-importTypeSelect"),model:{configure_attributes:e,className:""},noFieldset:!0}),this.$(".js-importTypeSelect select[name=archive]").on("change",(i=this,function(t){var e,n,s;return s=$(t.target).val(),(e=i.account).inbound||(e.inbound={}),(n=i.account.inbound).options||(n.options={}),"true"===s?(i.account.inbound.options.archive=!0,i.account.inbound.options.archive_before=(new Date).toISOString()):(delete i.account.inbound.options.archive,delete i.account.inbound.options.archive_before)})),this.$(".js-importTypeSelect select[name=archive]").trigger("change");this.$(".js-archiveMessage").addClass("hide")},i.prototype.probleOutbound=function(t){var e,n;return t.preventDefault(),(e=this.formParam(t.target)).email=this.account.meta.email,this.disable(t),this.showSlide("js-test"),this.ajax({id:"email_outbound",type:"POST",url:this.apiPath+"/channels_email_outbound",data:JSON.stringify(e),processData:!0,success:(n=this,function(i){return"ok"===i.result?(n.account.outbound=e,n.verify(n.account)):(n.showSlide("js-outbound"),n.showAlert("js-outbound",i.message_human||i.message),n.showInvalidField("js-outbound",i.invalid_field)),n.enable(t)}),fail:function(e){return function(){return e.showSlide("js-outbound"),e.showAlert("js-outbound",data.message_human||data.message),e.showInvalidField("js-outbound",data.invalid_field),e.enable(t)}}(this)})},i.prototype.verify=function(t,e){return null==e&&(e=0),this.showSlide("js-verify"),this.ajax({id:"email_verify",type:"POST",url:this.apiPath+"/channels_email_verify",data:JSON.stringify(t),processData:!0,success:(n=this,function(t){return"ok"===t.result?n.navigate("getting_started/agents",{emptyEl:!0}):"inbound"===t.source||"outbound"===t.source?(n.showSlide("js-"+t.source),n.showAlert("js-"+t.source,t.message_human||t.message),n.showInvalidField("js-"+t.source,t.invalid_field)):2===e?(n.showAlert("js-verify",t.message_human||t.message),n.delay((function(){return n.showSlide("js-intro"),n.showAlert("js-intro",__("Email sending and receiving could not be verified. Please check your settings."))}),2300)):(t.subject&&n.account&&(n.account.subject=t.subject),n.verify(n.account,e+1))}),fail:function(t){return function(){return t.showSlide("js-intro"),t.showAlert("js-intro",__("Email sending and receiving could not be verified. Please check your settings."))}}(this)});var n},i.prototype.toggleSslVerifyVisibility=function(t){var e,n,i;if("options::port"!==(e=$(t.target)).attr("name")||!e.closest("form").find('[name="options::ssl"]').length)return n="options::port"===e.attr("name")?""===e.val()||"465"===e.val()||"587"===e.val():"off"!==e.val(),i=e.closest("form").find('[name="options::ssl_verify"]'),n?i.removeAttr("disabled"):i.attr("disabled","disabled"),this.toggleSslVerifyAlert({target:i},!n)},i.prototype.toggleSslVerifyAlert=function(t,e){var n,i;return n=$(t.target),i=!e&&"true"!==n.val(),n.closest(".wizard-slide").find(".js-sslVerifyAlert").toggleClass("hide",!i)},i.prototype.showSlide=function(t){var e,n;if(i.__super__.showSlide.apply(this,arguments),1===(n=(e=this.$("."+t)).find('[name="options::ssl_verify"]')).length&&"true"!==n.val())return e.find(".js-sslVerifyAlert").removeClass("hide")},i}(App.ControllerWizardFullScreen),App.Config.set("getting_started/channel/email",t,"Routes")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.permissionCheck("admin.wizard")?(this.title(__("Connect Channels")),this.fetch()):this.navigate("#")}return e(n,t),n.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode)return t.render(e);t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},n.prototype.render=function(t){return this.replaceWith(App.view("getting_started/email_pre_configured")(t))},n}(App.ControllerWizardFullScreen),App.Config.set("getting_started/channel/email_pre_configured",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.submit=e(this.submit,this),this.toggleOutboundAdapter=e(this.toggleOutboundAdapter,this),this.render=e(this.render,this),this.fetch=e(this.fetch,this),i.__super__.constructor.apply(this,arguments),this.permissionCheck("admin.wizard")?(this.title(__("Email Notifications")),this.channelDriver={email:{inbound:{},outbound:{}}},this.fetch()):this.navigate("#")}return n(i,t),i.prototype.events={"change .js-outbound [name=adapter]":"toggleOutboundAdapter",'change [name="options::port"]':"toggleSslVerifyVisibility",'change [name="options::ssl_verify"]':"toggleSslVerifyAlert","submit .js-outbound":"submit"},i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode)return t.channelDriver=e.channel_driver,t.render();t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){var t;return this.replaceWith(App.view("getting_started/email_notification")()),t=[{name:"adapter",display:__("Send Mails via"),tag:"select",multiple:!1,null:!1,options:this.channelDriver.email.outbound,translate:!0}],new App.ControllerForm({el:this.$(".base-outbound-type"),model:{configure_attributes:t,className:""},params:{adapter:"sendmail"}}),this.toggleOutboundAdapter()},i.prototype.toggleOutboundAdapter=function(){var t;if(this.el.find(".base-outbound-settings").html(""),"smtp"===this.$(".js-outbound [name=adapter]").val())return t=[{name:"options::host",display:__("Host"),tag:"input",type:"text",limit:120,null:!1,autocapitalize:!1,autofocus:!0},{name:"options::user",display:__("User"),tag:"input",type:"text",limit:120,null:!0,autocapitalize:!1,autocomplete:"off"},{name:"options::password",display:__("Password"),tag:"input",type:"password",limit:120,null:!0,autocapitalize:!1,autocomplete:"off",single:!0},{name:"options::port",display:__("Port"),tag:"input",type:"text",limit:6,null:!0,autocapitalize:!1,item_class:"formGroup--halfSize"},{name:"options::ssl_verify",display:__("SSL verification"),tag:"boolean",default:!0,null:!0,translate:!0,item_class:"formGroup--halfSize"}],this.form=new App.ControllerForm({el:this.$(".base-outbound-settings"),model:{configure_attributes:t,className:""}})},i.prototype.submit=function(t){var e,n;return t.preventDefault(),e=this.formParam(t.target),this.disable(t),this.showSlide("js-test"),this.ajax({id:"email_notification",type:"POST",url:this.apiPath+"/channels_email_notification",data:JSON.stringify(e),processData:!0,success:(n=this,function(e){var i,s,r;if("ok"===e.result){for(i in s=e.settings)r=s[i],App.Config.set(i,r);return App.Config.get("system_online_service")?n.navigate("getting_started/channel/email_pre_configured",{emptyEl:!0}):n.navigate("getting_started/channel",{emptyEl:!0})}return n.showSlide("js-outbound"),n.showAlert("js-outbound",e.message_human||e.message),n.showInvalidField("js-outbound",e.invalid_field),n.enable(t)}),fail:function(e){return function(){return e.showSlide("js-outbound"),e.showAlert("js-outbound",data.message_human||data.message),e.showInvalidField("js-outbound",data.invalid_field),e.enable(t)}}(this)})},i.prototype.toggleSslVerifyVisibility=function(t){var e,n,i;return n=""===(e=$(t.target)).val()||"465"===e.val()||"587"===e.val(),i=e.closest("form").find('[name="options::ssl_verify"]'),n?i.removeAttr("disabled"):i.attr("disabled","disabled"),this.toggleSslVerifyAlert({target:i},!n)},i.prototype.toggleSslVerifyAlert=function(t,e){var n,i;return n=$(t.target),i=!e&&"true"!==n.val(),n.closest(".wizard-slide").find(".js-sslVerifyAlert").toggleClass("hide",!i)},i.prototype.showSlide=function(t){var e,n;if(i.__super__.showSlide.apply(this,arguments),1===(n=(e=this.$("."+t)).find('[name="options::ssl_verify"]')).length&&"true"!==n.val())return e.find(".js-sslVerifyAlert").removeClass("hide")},i}(App.ControllerWizardFullScreen),App.Config.set("getting_started/email_notification",t,"Routes")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),this.title(__("Setup Finished")),this.render()}return e(n,t),n.prototype.render=function(){var t;return this.replaceWith(App.view("getting_started/finish")()),this.delay((t=this,function(){return t.$(".setup.wizard").addClass("hide")}),2300),this.delay(function(t){return function(){return t.redirectToLogin()}}(this),4300)},n}(App.ControllerWizardFullScreen),App.Config.set("getting_started/finish",t,"Routes")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.GitIssueLinkModal=function(n){function i(e){this.onSubmit=t(this.onSubmit,this),this.placeholder=e.placeholder,this.head=e.head,i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.content=function(){return $(App.view("integration/git_issue_link_modal")({placeholder:this.placeholder}))},i.prototype.onSubmit=function(){var t,e;if(t=this.el.find(".js-result"),e=this.formParam(t),!_.isEmpty(e.link))return this.formDisable(t),this.callback(e.link,this)},i}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"Group",defaultSortBy:"name",pageData:{home:"groups",object:__("Group"),objects:__("Groups"),pagerAjax:!0,pagerBaseUrl:"#manage/groups/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#groups",notes:[__("Groups are \u2026")],buttons:[{name:__("New Group"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content")})}return n(i,t),i.requiredPermission="admin.group",i.prototype.header=__("Groups"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i}(App.ControllerSubContent),App.Config.set("Group",{prio:1500,name:__("Groups"),parent:"#manage",target:"#manage/groups",controller:t,permission:["admin.group"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.IdoitObjectSelector=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),this.renderResult=t(this.renderResult,this),this.search=t(this.search,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.head=__("i-doit"),i.prototype.lastSearchTermEmpty=!1,i.prototype.content=function(){var t;return this.ajax({id:"idoit-object-selector",type:"POST",url:this.apiPath+"/integration/idoit",data:JSON.stringify({method:"cmdb.object_types"}),success:(t=this,function(e){var n;return"failed"===e.result?(t.contentInline=e.message,void t.render()):(n=_.sortBy(e.response.result,"title"),t.contentInline=$(App.view("integration/idoit_object_selector")()),t.contentInline.find(".js-typeSelect").html(t.renderTypeSelector(n)),t.contentInline.on("change","input.js-shadow",(function(e){var n;return n=t.formParam(e.target),t.search(n)})),t.contentInline.on("keyup","input.js-searchField",(function(e){var n;return n=t.formParam(e.target),t.search(n)})),t.render(),t.$(".js-input").trigger("focus"))}),error:function(t){return function(e,n){if("abort"!==n)return t.contentInline=__("Content could not be loaded."),t.render()}}(this)}),""},i.prototype.search=function(t){return _.isEmpty(t.type)&&_.isEmpty(t.title)?(this.lastSearchTermEmpty=!0,void this.renderResult()):(_.isEmpty(t.type)&&delete t.type,_.isEmpty(t.title)?delete t.title:t.title="%"+t.title+"%",this.lastSearchTermEmpty=!1,this.ajax({id:"idoit-object-selector",type:"POST",url:this.apiPath+"/integration/idoit",data:JSON.stringify({method:"cmdb.objects",filter:t}),success:(e=this,function(t){if(!e.lastSearchTermEmpty)return e.renderResult(t.response.result)}),error:function(t){return function(e,n){if("abort"!==n)return t.contentInline=__("Content could not be loaded."),t.render()}}(this)}));var e},i.prototype.renderResult=function(t){var e;return e=App.view("integration/idoit_object_result")({items:t}),this.el.find(".js-result").html(e)},i.prototype.renderTypeSelector=function(t){var e,n,i,s;for(s={},e=0,i=t.length;e<i;e++)s[(n=t[e]).id]=n.title;return App.UiElement.searchable_select.render({name:"type",multiple:!1,limit:100,null:!1,nulloption:!1,options:s})},i.prototype.onSubmit=function(){var t,e,n;if(t=this.el.find(".js-result"),n=this.formParam(t),!_.isEmpty(n.object_id))return e=_.isArray(n.object_id)?n.object_id:[n.object_id],this.formDisable(t),this.callback(e,this)},i}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.title(__("Import")),this.fetch()}return e(n,t),n.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(t.Config.get("system_init_done"))t.navigate("#login");else{if(!0!==e.import_mode)return t.render();t.navigate("#import/"+e.import_backend,{emptyEl:!0})}})});var t},n.prototype.render=function(){var t;return t=App.Config.get("ImportPlugins"),this.replaceWith(App.view("import/index")({items:t}))},n}(App.ControllerWizardFullScreen),App.Config.set("import",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.updateMigration=e(this.updateMigration,this),this.startMigration=e(this.startMigration,this),this.showImportState=e(this.showImportState,this),this.showCredentials=e(this.showCredentials,this),this.updateApiToken=e(this.updateApiToken,this),this.updateUrl=e(this.updateUrl,this),i.__super__.constructor.apply(this,arguments),this.title(__("Import")),this.freshdeskDomain=".freshdesk.com",this.Config.get("system_init_done")?this.navigate("#login"):this.fetch()}return n(i,t),i.prototype.className="getstarted fit",i.prototype.elements={".input-feedback":"urlStatus","[data-target=freshdesk-credentials]":"nextEnterCredentials","[data-target=freshdesk-start-migration]":"nextStartMigration","#freshdesk-subdomain":"freshdeskSubdomain","#freshdesk-subdomain-addon":"freshdeskSubdomainAddon",".freshdesk-subdomain-error":"linkErrorMessage",".freshdesk-api-token-error":"apiTokenErrorMessage","#freshdesk-api-token":"freshdeskApiToken",".js-ticket-count-info":"ticketCountInfo"},i.prototype.updateMigrationDisplayLoop=0,i.prototype.events={"click .js-freshdesk-credentials":"showCredentials","click .js-migration-start":"startMigration","keyup #freshdesk-subdomain":"updateUrl","keyup #freshdesk-api-token":"updateApiToken"},i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode||"freshdesk"===e.import_backend)return t.render(),!0===e.import_mode?(t.showImportState(),t.updateMigration()):void 0;t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){return this.replaceWith(App.view("import/freshdesk")({freshdeskDomain:this.freshdeskDomain}))},i.prototype.updateUrl=function(){var t,e;return this.urlStatus.attr("data-state","loading"),this.freshdeskSubdomainAddon.attr("style","padding-right: 42px"),this.linkErrorMessage.text(""),e=this,t=function(){return e.ajax({id:"import_freshdesk_url",type:"POST",url:e.apiPath+"/import/freshdesk/url_check",data:JSON.stringify({url:"https://"+e.freshdeskSubdomain.val()+e.freshdeskDomain}),processData:!0,success:function(t){return"ok"===t.result?(e.urlStatus.attr("data-state","success"),e.linkErrorMessage.text(""),e.nextEnterCredentials.removeClass("hide")):(e.urlStatus.attr("data-state","error"),e.linkErrorMessage.text(t.message_human||t.message),e.nextEnterCredentials.addClass("hide"))}})},this.delay(t,700,"import_freshdesk_url")},i.prototype.updateApiToken=function(){var t,e;return this.urlStatus.attr("data-state","loading"),this.apiTokenErrorMessage.text(""),e=this,t=function(){return e.ajax({id:"import_freshdesk_api_token",type:"POST",url:e.apiPath+"/import/freshdesk/credentials_check",data:JSON.stringify({token:e.freshdeskApiToken.val()}),processData:!0,success:function(t){return"ok"===t.result?(e.urlStatus.attr("data-state","success"),e.apiTokenErrorMessage.text(""),
e.nextStartMigration.removeClass("hide")):(e.urlStatus.attr("data-state","error"),e.apiTokenErrorMessage.text(t.message_human||t.message),e.nextStartMigration.addClass("hide"))}})},this.delay(t,700,"import_freshdesk_api_token")},i.prototype.showCredentials=function(t){return t.preventDefault(),this.urlStatus.attr("data-state",""),this.$("[data-slide=freshdesk-subdomain]").toggleClass("hide"),this.$("[data-slide=freshdesk-credentials]").toggleClass("hide")},i.prototype.showImportState=function(){return this.$("[data-slide=freshdesk-subdomain]").addClass("hide"),this.$("[data-slide=freshdesk-credentials]").addClass("hide"),this.$("[data-slide=freshdesk-import]").removeClass("hide")},i.prototype.startMigration=function(t){return t.preventDefault(),this.showImportState(),this.ajax({id:"import_start",type:"POST",url:this.apiPath+"/import/freshdesk/import_start",processData:!0,success:(e=this,function(t){if("ok"===t.result)return e.delay(e.updateMigration,3e3)})});var e},i.prototype.updateMigration=function(){return this.updateMigrationDisplayLoop+=1,this.showImportState(),this.ajax({id:"import_status",type:"GET",url:this.apiPath+"/import/freshdesk/import_status",processData:!0,success:(t=this,function(e){var n,i,s,r;if(_.isEmpty(e.result)&&t.updateMigrationDisplayLoop>16)return t.$(".js-error").removeClass("hide"),void t.$(".js-error").html(App.i18n.translateContent("Background process did not start or has not finished! Please contact your support."));if(_.isEmpty(e.result.error)?t.$(".js-error").addClass("hide"):(t.$(".js-error").removeClass("hide"),t.$(".js-error").html(App.i18n.translateContent(e.result.error))),_.isEmpty(e.finished_at)||!_.isEmpty(e.result.error)){if(!_.isEmpty(e.result))for(i in s=e.result)(r=s[i]).sum>r.total&&(r.sum=r.total),(n=t.$(".js-"+i.toLowerCase())).find(".js-done").text(r.sum),n.find(".js-total").text(r.total),n.find("progress").attr("max",r.total),n.find("progress").attr("value",r.sum),r.total<=r.sum?n.addClass("is-done"):n.removeClass("is-done");return t.delay(t.updateMigration,5e3)}t.redirectToLogin()})});var t},i}(App.ControllerWizardFullScreen),App.Config.set("import/freshdesk",t,"Routes"),App.Config.set("freshdesk",{title:__("Freshdesk"),name:__("Freshdesk"),class:"js-freshdesk",url:"#import/freshdesk"},"ImportPlugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.updateMigration=e(this.updateMigration,this),this.startMigration=e(this.startMigration,this),this.showImportState=e(this.showImportState,this),this.showCredentials=e(this.showCredentials,this),this.updateCredentials=e(this.updateCredentials,this),this.updateUrl=e(this.updateUrl,this),i.__super__.constructor.apply(this,arguments),this.title("Import"),this.kayakoDomain=".kayako.com",this.Config.get("system_init_done")?this.navigate("#login"):this.fetch()}return n(i,t),i.prototype.className="getstarted fit",i.prototype.elements={".input-feedback":"urlStatus","[data-target=kayako-credentials]":"nextEnterCredentials","[data-target=kayako-start-migration]":"nextStartMigration","#kayako-subdomain":"kayakoSubdomain","#kayako-subdomain-addon":"kayakoSubdomainAddon",".kayako-subdomain-error":"linkErrorMessage",".kayako-password-error":"apiTokenErrorMessage","#kayako-email":"kayakoEmail","#kayako-password":"kayakoPassword",".js-ticket-count-info":"ticketCountInfo"},i.prototype.updateMigrationDisplayLoop=0,i.prototype.events={"click .js-kayako-credentials":"showCredentials","click .js-migration-start":"startMigration","keyup #kayako-subdomain":"updateUrl","keyup #kayako-password":"updateCredentials"},i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode||"kayako"===e.import_backend)return t.render(),!0===e.import_mode?(t.showImportState(),t.updateMigration()):void 0;t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){return this.replaceWith(App.view("import/kayako")({kayakoDomain:this.kayakoDomain}))},i.prototype.updateUrl=function(){var t,e;return this.urlStatus.attr("data-state","loading"),this.kayakoSubdomainAddon.attr("style","padding-right: 42px"),this.linkErrorMessage.text(""),e=this,t=function(){return e.ajax({id:"import_kayako_url",type:"POST",url:e.apiPath+"/import/kayako/url_check",data:JSON.stringify({url:"https://"+e.kayakoSubdomain.val()+e.kayakoDomain}),processData:!0,success:function(t){return"ok"===t.result?(e.urlStatus.attr("data-state","success"),e.linkErrorMessage.text(""),e.nextEnterCredentials.removeClass("hide")):(e.urlStatus.attr("data-state","error"),e.linkErrorMessage.text(t.message_human||t.message),e.nextEnterCredentials.addClass("hide"))}})},this.delay(t,700,"import_kayako_url")},i.prototype.updateCredentials=function(){var t,e;return this.urlStatus.attr("data-state","loading"),this.apiTokenErrorMessage.text(""),e=this,t=function(){return e.ajax({id:"import_kayako_api_token",type:"POST",url:e.apiPath+"/import/kayako/credentials_check",data:JSON.stringify({username:e.kayakoEmail.val(),password:e.kayakoPassword.val()}),processData:!0,success:function(t){return"ok"===t.result?(e.urlStatus.attr("data-state","success"),e.apiTokenErrorMessage.text(""),e.nextStartMigration.removeClass("hide")):(e.urlStatus.attr("data-state","error"),e.apiTokenErrorMessage.text(t.message_human||t.message),e.nextStartMigration.addClass("hide"))}})},this.delay(t,700,"import_kayako_api_token")},i.prototype.showCredentials=function(t){return t.preventDefault(),this.urlStatus.attr("data-state",""),this.$("[data-slide=kayako-subdomain]").toggleClass("hide"),this.$("[data-slide=kayako-credentials]").toggleClass("hide")},i.prototype.showImportState=function(){return this.$("[data-slide=kayako-subdomain]").addClass("hide"),this.$("[data-slide=kayako-credentials]").addClass("hide"),this.$("[data-slide=kayako-import]").removeClass("hide")},i.prototype.startMigration=function(t){return t.preventDefault(),this.showImportState(),this.ajax({id:"import_start",type:"POST",url:this.apiPath+"/import/kayako/import_start",processData:!0,success:(e=this,function(t){if("ok"===t.result)return e.delay(e.updateMigration,3e3)})});var e},i.prototype.updateMigration=function(){return this.updateMigrationDisplayLoop+=1,this.showImportState(),this.ajax({id:"import_status",type:"GET",url:this.apiPath+"/import/kayako/import_status",processData:!0,success:(t=this,function(e){var n,i,s,r;if(_.isEmpty(e.result)&&t.updateMigrationDisplayLoop>16)return t.$(".js-error").removeClass("hide"),void t.$(".js-error").html(App.i18n.translateContent("Background process did not start or has not finished! Please contact your support."));if(_.isEmpty(e.result.error)?t.$(".js-error").addClass("hide"):(t.$(".js-error").removeClass("hide"),t.$(".js-error").html(App.i18n.translateContent(e.result.error))),_.isEmpty(e.finished_at)||!_.isEmpty(e.result.error)){if(!_.isEmpty(e.result))for(i in s=e.result)(r=s[i]).sum>r.total&&(r.sum=r.total),(n=t.$(".js-"+i.toLowerCase())).find(".js-done").text(r.sum),n.find(".js-total").text(r.total),n.find("progress").attr("max",r.total),n.find("progress").attr("value",r.sum),r.total<=r.sum?n.addClass("is-done"):n.removeClass("is-done");return t.delay(t.updateMigration,5e3)}t.redirectToLogin()})});var t},i}(App.ControllerWizardFullScreen),App.Config.set("import/kayako",t,"Routes"),App.Config.set("kayako",{title:"Kayako",name:"Kayako",class:"js-kayako",url:"#import/kayako"},"ImportPlugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.updateMigration=e(this.updateMigration,this),this.startMigration=e(this.startMigration,this),this.checkMigration=e(this.checkMigration,this),this.updateUrl=e(this.updateUrl,this),this.showImportNotice=e(this.showImportNotice,this),this.showImportState=e(this.showImportState,this),this.showLink=e(this.showLink,this),this.startDownload=e(this.startDownload,this),i.__super__.constructor.apply(this,arguments),this.title(__("Import")),this.Config.get("system_init_done")?this.navigate("#login"):this.fetch()}return n(i,t),i.prototype.className="getstarted fit",i.prototype.elements={".input-feedback":"urlStatus",".js-migration-check":"nextStartMigration",".otrs-link-error":"linkErrorMessage"},i.prototype.events={"click .js-otrs-link":"showLink","click .js-download":"startDownload","click .js-migration-start":"startMigration","click .js-migration-check":"checkMigration","keyup #otrs-link":"updateUrl"},i.prototype.updateMigrationDisplayLoop=0,i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode||"otrs"===e.import_backend)return t.render(),!0===e.import_mode?(t.showImportState(),t.updateMigration()):void 0;t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){return this.replaceWith(App.view("import/otrs")())},i.prototype.startDownload=function(){return this.$(".js-otrs-link").removeClass("hide")},i.prototype.showLink=function(t){return t.preventDefault(),this.$("[data-slide=otrs-plugin]").toggleClass("hide"),this.$("[data-slide=otrs-link]").toggleClass("hide")},i.prototype.showImportState=function(){return this.$("[data-slide=otrs-plugin]").addClass("hide"),this.$("[data-slide=otrs-link]").addClass("hide"),this.$("[data-slide=otrs-import]").removeClass("hide"),this.$("[data-slide=otrs-import-notice]").addClass("hide")},i.prototype.showImportNotice=function(){return this.$("[data-slide=otrs-plugin]").addClass("hide"),this.$("[data-slide=otrs-link]").addClass("hide"),this.$("[data-slide=otrs-import]").addClass("hide"),this.$("[data-slide=otrs-import-notice]").removeClass("hide")},i.prototype.updateUrl=function(t){var e,n,i;return n=$(t.target).val(),this.urlStatus.attr("data-state","loading"),this.linkErrorMessage.text(""),i=this,e=function(){return i.ajax({id:"import_otrs_url",type:"POST",url:i.apiPath+"/import/otrs/url_check",data:JSON.stringify({url:n}),processData:!0,success:function(t){return"ok"===t.result?(i.urlStatus.attr("data-state","success"),i.linkErrorMessage.text(""),i.nextStartMigration.removeClass("hide")):(i.urlStatus.attr("data-state","error"),i.linkErrorMessage.text(t.message_human||t.message),i.nextStartMigration.addClass("hide"))}})},this.delay(e,700,"import_otrs_url")},i.prototype.checkMigration=function(t){return t.preventDefault(),this.ajax({id:"import_otrs_check",type:"POST",url:this.apiPath+"/import/otrs/import_check",processData:!0,success:(e=this,function(t){var n,i,s,r;if("ok"!==t.result){for(n=0,s=(r=t.issues).length;n<s;n++)i=r[n],e.$(".js-"+i).removeClass("hide");return e.showImportNotice()}e.startMigration()})});var e},i.prototype.startMigration=function(t){return t&&t.preventDefault(),this.showImportState(),this.ajax({id:"import_start",type:"POST",url:this.apiPath+"/import/otrs/import_start",processData:!0,success:(e=this,function(t){if("ok"===t.result)return e.delay(e.updateMigration,2e3)})});var e},i.prototype.updateMigration=function(){return this.updateMigrationDisplayLoop+=1,this.showImportState(),this.ajax({id:"import_status",type:"GET",url:this.apiPath+"/import/otrs/import_status",processData:!0,success:(t=this,function(e){var n,i,s,r;if("import_done"!==e.result){if("error"===e.result?(t.$(".js-error").removeClass("hide"),t.$(".js-error").html(App.i18n.translateContent(e.message))):t.$(".js-error").addClass("hide"),"not running"===e.message&&t.updateMigrationDisplayLoop>10)return t.$(".js-error").removeClass("hide"),void t.$(".js-error").html(App.i18n.translateContent("Background process did not start or has not finished! Please contact your support."));if("in_progress"===e.result)for(s in r=e.data)(i=r[s]).done>i.total&&(i.done=i.total),(n=t.$(".js-"+s.toLowerCase())).find(".js-done").text(i.done),n.find(".js-total").text(i.total),n.find("progress").attr("max",i.total),n.find("progress").attr("value",i.done),i.total<=i.done?n.addClass("is-done"):n.removeClass("is-done");return t.delay(t.updateMigration,6500)}window.location.reload()})});var t},i}(App.ControllerWizardFullScreen),App.Config.set("import/otrs",t,"Routes"),App.Config.set("otrs",{title:__("OTRS"),name:__("OTRS"),class:"js-otrs",url:"#import/otrs"},"ImportPlugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.updateMigration=e(this.updateMigration,this),this.startMigration=e(this.startMigration,this),this.showImportState=e(this.showImportState,this),this.showCredentials=e(this.showCredentials,this),this.updateApiToken=e(this.updateApiToken,this),this.updateUrl=e(this.updateUrl,this),i.__super__.constructor.apply(this,arguments),this.title(__("Import")),this.Config.get("system_init_done")?this.navigate("#login"):this.fetch()}return n(i,t),i.prototype.className="getstarted fit",i.prototype.elements={".input-feedback":"urlStatus","[data-target=zendesk-credentials]":"nextEnterCredentials","[data-target=zendesk-start-migration]":"nextStartMigration","#zendesk-url":"zendeskUrl",".js-zendeskUrlApiToken":"zendeskUrlApiToken",".zendesk-url-error":"linkErrorMessage",".zendesk-api-token-error":"apiTokenErrorMessage","#zendesk-email":"zendeskEmail","#zendesk-api-token":"zendeskApiToken",".js-ticket-count-info":"ticketCountInfo"},i.prototype.updateMigrationDisplayLoop=0,i.prototype.events={"click .js-zendesk-credentials":"showCredentials","click .js-migration-start":"startMigration","keyup #zendesk-url":"updateUrl","keyup #zendesk-api-token":"updateApiToken"},i.prototype.fetch=function(){return this.ajax({id:"getting_started",type:"GET",url:this.apiPath+"/getting_started",processData:!0,success:(t=this,function(e){if(!0!==e.import_mode||"zendesk"===e.import_backend)return t.render(),!0===e.import_mode?(t.showImportState(),t.updateMigration()):void 0;t.navigate("#import/"+e.import_backend,{emptyEl:!0})})});var t},i.prototype.render=function(){return this.replaceWith(App.view("import/zendesk")())},i.prototype.updateUrl=function(){var t,e;return this.urlStatus.attr("data-state","loading"),this.linkErrorMessage.text(""),e=this,t=function(){return e.ajax({id:"import_zendesk_url",type:"POST",url:e.apiPath+"/import/zendesk/url_check",data:JSON.stringify({url:e.zendeskUrl.val()}),processData:!0,success:function(t){return"ok"===t.result?(e.urlStatus.attr("data-state","success"),e.linkErrorMessage.text(""),e.nextEnterCredentials.removeClass("hide")):(e.urlStatus.attr("data-state","error"),e.linkErrorMessage.text(t.message_human||t.message),e.nextEnterCredentials.addClass("hide"))}})},this.delay(t,700,"import_zendesk_url")},i.prototype.updateApiToken=function(){var t,e;return this.urlStatus.attr("data-state","loading"),this.apiTokenErrorMessage.text(""),e=this,t=function(){return e.ajax({id:"import_zendesk_api_token",type:"POST",url:e.apiPath+"/import/zendesk/credentials_check",data:JSON.stringify({username:e.zendeskEmail.val(),token:e.zendeskApiToken.val()}),processData:!0,success:function(t){return"ok"===t.result?(e.urlStatus.attr("data-state","success"),e.apiTokenErrorMessage.text(""),e.nextStartMigration.removeClass("hide")):(e.urlStatus.attr("data-state","error"),e.apiTokenErrorMessage.text(t.message_human||t.message),e.nextStartMigration.addClass("hide"))}})},this.delay(t,700,"import_zendesk_api_token")},i.prototype.showCredentials=function(t){var e;return t.preventDefault(),this.urlStatus.attr("data-state",""),e=this.zendeskUrl.val()+"/agent/admin/api",this.zendeskUrlApiToken.attr("href",e.replace(/([^:])\/\/+/g,"$1/")),this.zendeskUrlApiToken.val("HERE"),this.$("[data-slide=zendesk-url]").toggleClass("hide"),this.$("[data-slide=zendesk-credentials]").toggleClass("hide")},i.prototype.showImportState=function(){return this.$("[data-slide=zendesk-url]").addClass("hide"),this.$("[data-slide=zendesk-credentials]").addClass("hide"),this.$("[data-slide=zendesk-import]").removeClass("hide")},i.prototype.startMigration=function(t){return t.preventDefault(),this.showImportState(),this.ajax({id:"import_start",type:"POST",url:this.apiPath+"/import/zendesk/import_start",processData:!0,success:(e=this,function(t){if("ok"===t.result)return e.delay(e.updateMigration,3e3)})});var e},i.prototype.updateMigration=function(){return this.updateMigrationDisplayLoop+=1,this.showImportState(),this.ajax({id:"import_status",type:"GET",url:this.apiPath+"/import/zendesk/import_status",processData:!0,success:(t=this,function(e){var n,i,s,r;if(_.isEmpty(e.result)&&t.updateMigrationDisplayLoop>16)return t.$(".js-error").removeClass("hide"),void t.$(".js-error").html(App.i18n.translateContent("Background process did not start or has not finished! Please contact your support."));if(_.isEmpty(e.result.error)?t.$(".js-error").addClass("hide"):(t.$(".js-error").removeClass("hide"),t.$(".js-error").html(App.i18n.translateContent(e.result.error))),_.isEmpty(e.finished_at)||!_.isEmpty(e.result.error)){if(!_.isEmpty(e.result))for(i in s=e.result)(r=s[i]).sum>r.total&&(r.sum=r.total),"Ticket"===i&&r.total>=1e3&&t.ticketCountInfo.removeClass("hide"),(n=t.$(".js-"+i.toLowerCase())).find(".js-done").text(r.sum),n.find(".js-total").text(r.total),n.find("progress").attr("max",r.total),n.find("progress").attr("value",r.sum),r.total<=r.sum?n.addClass("is-done"):n.removeClass("is-done");return t.delay(t.updateMigration,5e3)}t.redirectToLogin()})});var t},i}(App.ControllerWizardFullScreen),App.Config.set("import/zendesk",t,"Routes"),App.Config.set("zendesk",{title:__("Zendesk"),name:__("Zendesk"),class:"js-zendesk",url:"#import/zendesk"},"ImportPlugins")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.release=e(this.release,this),this.render=e(this.render,this),this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.integrationItems=App.Config.get("NavBarIntegrations"),this.subscribeId=App.Setting.subscribe(this.render,{initFetch:!0,clear:!1})}return n(i,t),i.requiredPermission="admin.integration",i.prototype.header=__("Integrations"),i.prototype.show=function(t){var e,n,i,s;if(!this.initRender||t.target||t.integration)if(this.target=t.target,this.integration=t.integration,this.initRender){if(this.integration){for(n in i=this.integrationItems)if((s=i[n]).target==="#system/"+t.target+"/"+t.integration){e=s;break}return this.configController&&this.configController.releaseController(),this.configController=new e.controller({el:this.el.find(".js-integration"),success_code:t.success_code,error_code:t.error_code})}t.noRender||this.render()}else this.requestedIntegration=!0},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l;if(!this.initRender||!this.integration){for(n in this.initRender=!0,e=[],o=this.integrationItems)if((l=o[n]).permission)for(s=!1,t=0,i=(a=l.permission).length;t<i;t++)r=a[t],!s&&this.permissionCheck(r)&&(s=!0,l.key=n,e.push(l));else l.key=n,e.push(l);if(e=_.sortBy(e,(function(t){return t.name})),this.html(App.view("integration/index")({head:__("Integrations"),integrations:e})),this.requestedIntegration)return this.show({target:this.target,integration:this.integration,success_code:this.success_code,error_code:this.error_code,noRender:!0}),this.requestedIntegration=void 0}},i.prototype.release=function(){if(this.subscribeId)return App.Setting.unsubscribe(this.subscribeId)},i}(App.ControllerSubContent),App.Config.set("Integration",{prio:1e3,name:__("Integrations"),parent:"#system",target:"#system/integration",controller:t,permission:["admin.integration"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"Job",defaultSortBy:"name",pageData:{home:"Jobs",object:__("Scheduler"),objects:__("Schedulers"),pagerAjax:!0,pagerBaseUrl:"#manage/job/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#Jobs",notes:[__("Schedulers are \u2026")],buttons:[{name:__("New Scheduler"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content"),veryLarge:!0,handlers:[App.FormHandlerAdminJobObjectName.run]})}return n(i,t),i.requiredPermission="admin.scheduler",i.prototype.header=__("Scheduler"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i}(App.ControllerSubContent),App.Config.set("Job",{prio:3400,name:__("Scheduler"),parent:"#manage",target:"#manage/job",controller:t,permission:["admin.scheduler"]},"NavBarAdmin")}.call(this),function(){App.FormHandlerAdminJobObjectName=function(){function t(){}return t.run=function(t,e,n,i,s,r){if("object"===e.name&&!r.FormHandlerAdminJobObjectNameDone)return r.FormHandlerAdminJobObjectNameDone=!0,$(s).find("select[name=object]").off("change.object_name").on("change.object_name",(function(t){var e,o,a,l,c,u;for(c=$(t.target).val(),u=[],o=0,a=n.length;o<a;o++)"condition"!==(e=n[o]).name&&"perform"!==e.name||(e.object_name=c,l=r.formGenItem(e,i,s),u.push(s.find('div.form-group[data-attribute-name="'+e.name+'"]').replaceWith(l)));return u}))},t}()}.call(this),function(){var t;t=function(){function t(){new App.KeyboardShortcutModal}return t}(),App.Config.set("keyboard_shortcuts",t,"Routes"),App.Config.set("KeyboardShortcuts",{prio:1700,parent:"#current_user",name:__("Keyboard Shortcuts"),translate:!0,target:"#keyboard_shortcuts",permission:["admin","ticket.agent"]},"NavBarRight")}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseAddForm=function(e){function n(t){var e,i;for(e in t)i=t[e],this[e]=i;this.head=this.object.objectActionName(),n.__super__.constructor.call(this,t)}return t(n,e),n.prototype.buttonSubmit=__("Create"),n.prototype.content=function(){var t;return t=this.parentController.kb_locale(),this.formController=new App.KnowledgeBaseFormController(this.object,t,"agent_create",$("<div>")),this.form=this.formController.form,this.formController.el},n.prototype.submit=function(t){var e;if(this.preventDefaultAndStopPropagation(t),this.formController.validateAndShowErrors())return(e=this.formController.paramsForSaving()).translations_attributes[0].content_attributes={body:""},this.parentController.coordinator.saveChanges(this.object,e,this)},n.prototype.showAlert=function(t){var e;return null!=(e=this.formController)?e.showAlert(t):void 0},n.prototype.didSaveCallback=function(t){var e;return e=this.object.constructor.find(t.id).uiUrl(this.parentController.kb_locale(),"edit"),this.parentController.navigate(e)},n}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseAgentController=function(n){function i(e){var n;this.visibilityMayHaveChanged=t(this.visibilityMayHaveChanged,this),this.checkUpdatesAction=t(this.checkUpdatesAction,this),this.access=t(this.access,this),this.render=t(this.render,this),this.loadInitial=t(this.loadInitial,this),this.fetchAndRender=t(this.fetchAndRender,this),this.show=t(this.show,this),this.renderAfterChangeLoaded=t(this.renderAfterChangeLoaded,this),this.loadChange=t(this.loadChange,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("config_update_local",(n=this,function(t){return n.configUpdated(t)})),this.listenTo(App.User.current(),"refresh",this.visibilityMayHaveChanged),App.Event.bind("kb_visibility_may_have_changed",this.visibilityMayHaveChanged),this.permissionCheck("knowledge_base.*")&&App.Config.get("kb_active")?this.updateNavMenu():App.Config.get("kb_active_publicly")&&this.loadInitial({},{success:function(t){return function(){return t.updateNavMenu()}}(this)})}return e(i,n),i.prototype.className="knowledge-base vertical",i.prototype.name=__("Knowledge Base"),i.prototype.elements={".js-body":"body",".js-navigation":"navigation",".js-sidebar":"sidebar"},i.prototype.configUpdated=function(t){if("kb_active"===t.name||"kb_active_publicly"===t.name)return this.updateNavMenu()},i.prototype.firstRunIfNeeded=function(){var t;if(!this.firstRunDone)return this.firstRunDone=!0,this.coordinator=new App.KnowledgeBaseEditorCoordinator({parentController:this}),this.fetchAndRender(),this.controllerBind("ui:rerender",(t=this,function(){var e;return t.render(!0),null!=(e=t.contentController)&&(e.url=null),t.lastParams.selectedSystemLocale=App.KnowledgeBaseLocale.detect(t.getKnowledgeBase()).systemLocale(),t.show(t.lastParams)})),this.controllerBind("kb_data_changed",function(t){return function(e){var n;return n="kb_pull_"+e.class+"_"+e.id,App.Delay.set((function(){return t.loadChange(e)}),1e3,n,"kb_data_changed_loading")}}(this)),this.listenTo(App.KnowledgeBase,"kb_data_change_loaded",this.renderAfterChangeLoaded),this.listenTo(App.KnowledgeBase,"kb_visibility_change_loaded",this.renderAfterChangeLoaded),this.checkForUpdates()},i.prototype.loadChange=function(t){var e,n,i,s;return i=t.url+"?full=true","KnowledgeBase::Answer"===t.class&&(e=null!=(n=App.KnowledgeBaseAnswer.find(t.id))?n.translations().map((function(t){var e;return null!=(e=t.content())?e.id:void 0})).filter((function(t){return void 0!==t})):void 0)&&0!==e.length&&(i+="&include_contents="+e.join(",")),this.ajax({id:"kb_pull_"+t.class+"_"+t.id,type:"GET",url:i,processData:!0,success:(s=this,function(t){return App.Collection.loadAssets(t.assets),s.notifyChangeLoaded()}),error:function(e){return function(i){var s,r;if(404===i.status)return s=t.class.replace(/::/g,""),(n=null!=(r=App[s])?r.find(t.id):void 0)?(n.remove({clear:!0}),e.notifyChangeLoaded()):void 0}}(this)})},i.prototype.objectVisibleInternally=function(t){return!!t&&(!(t instanceof App.KnowledgeBaseAnswer&&!t.exists())&&!(t instanceof App.KnowledgeBaseCategory&&!t.visibleInternally(this.kb_locale())))},i.prototype.notifyChangeLoaded=function(){return App.KnowledgeBase.trigger("kb_data_change_loaded")},i.prototype.notifyVisibilityChangeLoaded=function(){return App.KnowledgeBase.trigger("kb_visibility_change_loaded")},i.prototype.renderAfterChangeLoaded=function(){var t;if(this.displayingError&&(t=this.constructor.pickObjectUsing(this.lastParams,this),this.objectVisibleInternally(t)))return this.renderControllers(this.lastParams)},i.prototype.active=function(t){return void 0===t?this.shown:this.shown=t},i.prototype.featureActive=function(){return this.permissionCheck("knowledge_base.*")&&App.Config.get("kb_active")||App.Config.get("kb_active_publicly")&&null!=App.KnowledgeBase.first()},i.prototype.activeLocaleSuffix=function(){return this.kb_locale().urlSuffix()},i.prototype.requiredPermissionSuffix=function(t){return"edit"===t.action?"editor":"*"},i.prototype.show=function(t){var e,n,i;if(this.firstRunIfNeeded(),this.navupdate("#knowledge_base"),null!=(i=this.bodyModal)&&i.close(),this.bodyModal=null,this.permissionCheckRedirect("knowledge_base."+this.requiredPermissionSuffix(t)))if(this.loaded&&"editor"===this.requiredPermissionSuffix(t)&&"editor"!==this.access(t))this.navigate(t.match[0].replace(/\/edit$/,""),{hideCurrentLocationFromHistory:!0});else if(this.loaded&&this.rendered&&this.lastParams&&!t.knowledge_base_id&&this.contentController&&null!=this.kb_locale())this.navigate(this.lastParams.match[0],{hideCurrentLocationFromHistory:!0});else{if(this.contentController&&this.contentController.url===t.match[0])return this.title(this.lastTitle),void("function"==typeof(e=this.contentController).restoreVisibility&&e.restoreVisibility());if(this.rendered=!0,this.lastParams=t,!this.loaded||null!==t.selectedSystemLocale||!t.selectedSystemLocalePresent)return this.displayingError=!1,this.loaded?t.knowledge_base_id?this.renderControllers(t):(n=App.KnowledgeBase.all()[0])?this.navigate(n.uiUrl(App.KnowledgeBaseLocale.detect(n)),{hideCurrentLocationFromHistory:!0}):this.renderScreenErrorInContent(__("There was no Knowledge Base created.")):this.pendingParams=t;this.renderError()}},i.prototype.renderScreenErrorInContent=function(t){var e;return null!=(e=this.contentController)&&e.releaseController(),this.contentController=void 0,this.renderScreenError({detail:t,el:this.$(".page-content")}),this.displayingError=!0},i.prototype.renderControllers=function(t){var e,n,i,s,r,o;if((n=this.constructor.pickObjectUsing(t,this))&&(this.isEditor()||n.visibleInternally(this.kb_locale())))return o=n instanceof App.KnowledgeBase?"search"===t.action?App.i18n.translateInline("Search"):"":n.guaranteedTitle(this.kb_locale().id),this.updateTitle(o),e=this.contentControllerClass(t),null!=(i=this.contentController)&&i.releaseController(),this.contentController=this.buildUsing(e,t,n),null!=(s=this.navigationController)&&s.show(n,t.action),null!=(r=this.sidebarController)?r.show(n,t.action):void 0;this.renderNotFound()},i.prototype.updateTitle=function(t){var e,n,i;return e=(null!=(n=this.getKnowledgeBase())?n.guaranteedTitle(null!=(i=this.kb_locale())?i.id:void 0):void 0)||"",""!==t&&(e&&(e+=" - "),e+=t),this.title(e),this.lastTitle=e},i.prototype.contentControllerClass=function(t){return"search"===t.action?App.KnowledgeBaseSearchController:"edit"===t.action?App.KnowledgeBaseContentController:t.answer_id?App.KnowledgeBaseReaderController:App.KnowledgeBaseReaderListController},i.prototype.edit=!1,i.prototype.renderNotFound=function(){var t,e,n;return n=App.i18n.translateInline("Not Found"),this.updateTitle(n),null!=(t=this.navigationController)&&t.show(void 0,n),this.renderScreenErrorInContent(__("The page was not found")),null!=(e=this.sidebarController)?e.hide():void 0},i.prototype.renderNotAvailableAnymore=function(){return this.updateTitle(App.i18n.translateInline("Not Available")),this.renderScreenErrorInContent(__("The page is not available anymore"))},i.prototype.renderError=function(){var t,e,n,i;return null!=(e=this.bodyModal)&&e.close(),t=this.getKnowledgeBase(),i=null!=(n=this.constructor.pickObjectUsing(this.lastParams,this)||t)?n.uiUrl(t.primaryKbLocale(),this.lastParams.action):void 0,this.bodyModal=new App.ControllerModal({head:__("Locale not found"),contentInline:"<a href='"+i+"'>Open in primary locale</a>",buttonClose:!1,buttonSubmit:!1,backdrop:"static",keyboard:!1,container:this.el})},i.prototype.kb_locale=function(){var t,e;if(t=this.getKnowledgeBase())return this.lastParams.selectedSystemLocale?t.kb_locales().filter((e=this,function(t){return t.system_locale_id===e.lastParams.selectedSystemLocale.id}))[0]:void 0},i.prototype.getKnowledgeBase=function(){var t;return App.KnowledgeBase.find(null!=(t=this.lastParams)?t.knowledge_base_id:void 0)},i.prototype.fetchAndRender=function(){return this.fetch(!0,!0)},i.prototype.fetch=function(t,e,n){var i,s;return t&&this.startLoading(),i={answer_translation_content_ids:App.KnowledgeBaseAnswerTranslationContent.all().map((function(t){return t.id}))},this.loadInitial(i,{success:(s=this,function(){if(t&&s.stopLoading(),e&&s.processLoaded(),n)return s.notifyVisibilityChangeLoaded()}),error:function(e){return function(){if(t)return e.stopLoading()}}(this)})},i.prototype.loadInitial=function(t,e){return null==e&&(e={}),this.ajax({id:"knowledge_bases_init",type:"POST",url:this.apiPath+"/knowledge_bases/init",data:JSON.stringify(t),processData:!0,success:(n=this,function(t,i,s){return n.loaded=!0,n.loadKbData(t),"function"==typeof e.success?e.success(t,i,s):void 0}),error:function(t){return"function"==typeof e.error?e.error(t):void 0}
});var n},i.prototype.loadKbData=function(t){var e,n,i,s,r,o;for(App.Collection.loadAssets(t),o=[],n=0,s=(r=this.calculateIdsToDelete(t)).length;n<s;n++)e=r[n],o.push(function(){var t,n,s,r,o;for(o=[],t=0,n=(s=e.ids).length;t<n;t++)i=s[t],o.push(null!=(r=App[e.modelName].find(i))?r.remove({clear:!0}):void 0);return o}());return o},i.prototype.calculateIdsToDelete=function(t){return App.KnowledgeBase.allKbModelNames().map((function(e){var n;return t[e]?(n=Object.keys(t[e]),{modelName:e,ids:App[e].all().map((function(t){return t.id})).filter((function(t){return!_.includes(n,String(t))}))}):{ids:[]}}),{})},i.prototype.processLoaded=function(){if(this.render(!0),this.pendingParams)return this.show(this.pendingParams),this.pendingParams=void 0},i.prototype.render=function(t){return null==t&&(t=!1),this.html(App.view("knowledge_base/agent")()),this.navigationController=new App.KnowledgeBaseNavigation({el:this.$(".js-navigation"),parentController:this}),this.sidebarController=new App.KnowledgeBaseSidebar({el:this.$(".js-sidebar"),parentController:this})},i.prototype.access=function(t){var e;return null!=(e=this.constructor.pickObjectUsing(t,this))?e.access(this.kb_locale()):void 0},i.prototype.isEditor=function(){return"editor"===this.access(this.lastParams)},i.prototype.checkForUpdates=function(){return this.interval(this.checkUpdatesAction,6e5,"kb_interval_check")},i.prototype.checkUpdatesAction=function(){if(this.loaded)return this.fetch(!1,!1)},i.prototype.buildUsing=function(t,e,n){return new t({el:this.$(".page-content"),object:n,parentController:this,selectedSystemLocale:e.selectedSystemLocale,url:e.match[0]})},i.prototype.onclick=function(){return!(this.permissionCheck("knowledge_base.*")&&App.Config.get("kb_active"))&&App.Config.get("kb_active_publicly")&&null!=App.KnowledgeBase.first()},i.prototype.accessoryIcon=function(){if(this.onclick())return"external"},i.prototype.clicked=function(){return window.open(App.KnowledgeBase.first().publicBaseUrl(),"_blank")},i.prototype.visibilityMayHaveChanged=function(){var t,e;if(t=this.getKnowledgeBase())return this.ajax({id:"kb_pull_visibility",type:"GET",url:this.apiPath+"/knowledge_bases/visible_ids",processData:!0,success:(e=this,function(n){var i;if(i=t.removeAssetsIfNeeded(n),!t.hasAssetsToLoad(n))return i?e.notifyVisibilityChangeLoaded():void 0;e.fetch(!1,!1,!0)})})},i.pickObjectUsing=function(t,e){var n,i,s;if(s=e.getKnowledgeBase())return(n=t.answer_id)?App.KnowledgeBaseAnswer.find(n):(i=t.category_id)?App.KnowledgeBaseCategory.find(i):t.knowledge_base_id?s:void 0},i}(App.Controller),App.Config.set("KnowledgeBase",{controller:"KnowledgeBaseAgentController"},"permanentTask"),App.Config.set("KnowledgeBase",{prio:1150,parent:"",name:__("Knowledge Base"),target:"#knowledge_base",key:"KnowledgeBase",class:"knowledge-base",shown:!1},"NavBar")}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseForm=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.render()}return t(n,e),n.prototype.events={"submit form":"submit","hidden.bs.tab":"didHide"},n.prototype.additionalButtons=[],n.prototype.className="page-content",n.prototype.split=!1,n.prototype.didHide=function(){var t;return null!=(t=this.formControllers)?t.forEach((function(t){return t.hideAlert()})):void 0},n.prototype.buildFormController=function(t){var e;return e=this.split&&_.values(App.Model.attributesGet(t,App.KnowledgeBase.configure_attributes))[0].horizontal,new App.ControllerForm({screen:t,params:this.object().attributes(),model:App.KnowledgeBase,formClass:"settings-entry",fullForm:!e,fullFormSubmitAdditionalClasses:"btn--primary",fullFormButtonsContainerClass:"justify-end",fullFormAdditionalButtons:this.additionalButtons,parentController:this})},n.prototype.wrapFormElement=function(t){return t.fullForm?t.form:new App.KnowledgeBaseVerticalForm({form:t}).el},n.prototype.render=function(){var t,e,n;return t="admin_"+this.screen,e=this.split?_.flatten(App.KnowledgeBase.configure_attributes.map((function(t){return Object.keys(t.screen)}))).filter((function(e){return e.match(t)})):[t],this.formControllers=e.map((n=this,function(t){return n.buildFormController(t)})),this.html(this.formControllers.map(function(t){return function(e){return t.wrapFormElement(e)}}(this)))},n.prototype.object=function(){return App.KnowledgeBase.find(this.knowledge_base_id)},n.prototype.scrollTop=function(){return this.el.closest(".main").animate({scrollTop:0})},n.prototype.prepareParams=function(t,e){var n,i,s,r,o,a;for(r in a=[],o=App.KnowledgeBase.attributesGet(e))n=o[r],s=this.$("."+n.tag+"[data-attribute-name="+n.name+"]"),a.push("function"==typeof(i=App.UiElement[n.tag]).prepareParams?i.prepareParams(n,s,t):void 0);return a},n.prototype.submit=function(t){var e,n,i;return this.preventDefaultAndStopPropagation(t),e=this.formControllers.filter((function(e){return e.form[0]===t.currentTarget||t.currentTarget.contains(e.form[0])}))[0],n=this.formParam(e.form),this.prepareParams(n,e.screen),this.formDisable(this.el),e.hideAlert(),this.ajax({type:"PATCH",data:JSON.stringify(n),url:this.object().manageUrl()+"?full=true",success:(i=this,function(t){return App.Collection.loadAssets(t.assets),i.formEnable(i.el),i.scrollTop()}),error:function(t){return function(n){var i;return t.formEnable(t.el),e.showAlert((null!=(i=n.responseJSON)?i.error:void 0)||__("Changes could not be saved.")),t.scrollTop()}}(this)})},n}(App.Controller),App.KnowledgeBaseCustomAddressForm=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.events={"click .js-snippets":"openSnippetsModal"},n.prototype.elements={".js-snippets":"snippetsModalButton"},n.prototype.additionalButtons=[{className:"js-snippets",text:__("Web Server Configuration")}],n.prototype.formEnable=function(t){return n.__super__.formEnable.apply(this,arguments),this.updateSnippetsModalButton()},n.prototype.render=function(){return n.__super__.render.apply(this,arguments),this.updateSnippetsModalButton()},n.prototype.updateSnippetsModalButton=function(){var t,e;return e=(null!=(t=this.object().attributes().custom_address)?t.length:void 0)>0,this.snippetsModalButton.attr("disabled",!e)},n.prototype.openSnippetsModal=function(t){var e,n;return this.preventDefaultAndStopPropagation(t),(e=t.currentTarget).disabled=!0,this.ajax({id:"knowledge_bases_init_admin",type:"GET",url:this.object().manageUrl("server_snippets"),processData:!0,success:(n=this,function(t){return e.disabled=!1,new App.KnowledgeBaseServerSnippet({container:n.el.closest(".content"),snippets:t.snippets,address:t.address,address_type:t.address_type})}),error:function(t){return function(n){if(e.disabled=!1,422===n.status)return new App.ControllerErrorModal({message:n.responseJSON.error,container:t.el.closest(".content")})}}(this)})},n}(App.KnowledgeBaseForm)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseContentCanBePublishedDialog=function(n){function i(e){this.submitTiming=t(this.submitTiming,this),this.saveUpdate=t(this.saveUpdate,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.events={"click .scheduled-widget-delete":"clickedCancelTimer","submit form":"submitTiming"},i.prototype.head=__("Visibility"),i.prototype.includeForm=!1,i.prototype.buttonSubmit=!1,i.prototype.content=function(){return this.formController=new App.KnowledgeBaseContentCanBePublishedForm({object:this.object}),this.formController.form},i.prototype.saveUpdate=function(t,e){return null==e&&(e=null),this.clearAlerts(),this.formController.toggleDisabled(!0),this.ajax({id:"knowledge_base_can_be_published",type:"POST",data:JSON.stringify(t),url:this.object.generateURL("has_publishing_update"),processData:!0,success:(n=this,function(t){return App.Collection.load({type:"KnowledgeBaseAnswer",data:[t]}),"function"==typeof e&&e(),n.formController.toggleDisabled(!1)}),error:function(t){return function(e){var n;return t.formController.toggleDisabled(!1),t.showAlert((null!=(n=e.responseJSON)?n.error:void 0)||__("The changes could not be saved."))}}(this)});var n},i.prototype.clickedCancelTimer=function(t){var e,n,i;return(e={})[(i=$(t.currentTarget).closest(".scheduled-widget")).data("state")+"_at"]=null,n=e,this.saveUpdate(n,(function(){return i.remove()}))},i.prototype.submitTiming=function(t){var e,n,i,s,r,o,a,l,c,u;if(this.preventDefaultAndStopPropagation(t),(r={})[(e=this.formParams()).visibility+"_at"]="scheduled"===e.timing?e.scheduled:"--now--",a=r,(s=this.formController.states.indexOf(e.visibility))<(o=this.formController.states.indexOf(this.formController.params.visibility)))for(i=n=l=s+1,c=o;l<=c?n<=c:n>=c;i=l<=c?++n:--n)a[this.formController.states[i]+"_at"]=null;return this.saveUpdate(a,(u=this,function(){if("now"!==e.timing)return u.update(),u.initalFormParams=u.formParams();u.close()}))},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseContentCanBePublishedForm=function(n){function i(e){this.postRendering=t(this.postRendering,this),this.timingHandler=t(this.timingHandler,this),this.visibilityHandler=t(this.visibilityHandler,this),this.scheduledHandler=t(this.scheduledHandler,this),this.prepare(e),i.__super__.constructor.apply(this,arguments),this.postRendering(),this.visibilityRadios.trigger("change")}return e(i,n),i.prototype.elements={".js-datepicker":"datePicker","[name=visibility]":"visibilityRadios","[value=now]":"timingNow","[value=scheduled]":"timingScheduled"},i.prototype.prepare=function(t){return this.handlers=[this.timingHandler,this.visibilityHandler,this.scheduledHandler],this.params={visibility:t.object.can_be_published_state()}},i.prototype.scheduledHandler=function(t,e){if("scheduled"===e.name&&t.scheduled)return this.timingScheduled.prop("checked",!0)},i.prototype.visibilityHandler=function(t,e){var n,i;if("visibility"===e.name)return this.toggleDisabled(!1),(i=this.form.find(".scheduled-widget[data-state="+t.visibility+"]")).length>0&&!this.form.find(".controls--datetime input[data-item=date]").val()?(n=i.data("date"),this.datePicker.datepicker("setDate",n)):(this.datePicker.datepicker("clearDates"),this.timingNow.prop("checked",!0))},i.prototype.timingHandler=function(t,e){if("timing"===e.name&&"now"===t.timing&&t.scheduled)return this.datePicker.datepicker("clearDates")},i.prototype.postRendering=function(){var t,e,n,i,s,r,o,a,l,c;for(e in r=this.elements)this[r[e]]=this.form.find(e);for(this.timingScheduled.parent().addClass("additional-radio-controls").append(this.form.find('[data-name="scheduled"]')),this.form.find('[data-attribute-name="scheduled"]').remove(),this.datePicker.datepicker("setStartDate",new Date),s=new Date,a=[],t=0,i=(o=this.states).length;t<i;t++)l=o[t],this.object[l+"_at"]&&new Date(this.object[l+"_at"])>s?(n=this.form.find("input[value="+l+"]").closest("label"),c=new App.KnowledgeBaseScheduledWidget({object:this.object,state:l}),a.push(n.after(c.el))):a.push(void 0);return a},i.prototype.toggleDisabled=function(t){var e,n,i;return n=this.visibilityRadios.filter(":checked").val(),i=this.params.visibility===n,e=this.states.indexOf(this.params.visibility)>this.states.indexOf(n),this.form.find("[value=now], [type=submit]").attr("disabled",t||i),this.form.find("[value=scheduled], .controls--datetime input").attr("disabled",t||i||e),this.visibilityRadios.attr("disabled",t)},i.prototype.fullForm=!0,i.prototype.fullFormSubmitLabel=__("Update"),i.prototype.fullFormSubmitAdditionalClasses="btn--primary",i.prototype.states=[__("draft"),__("internal"),__("published"),__("archived")],i.prototype.model={configure_attributes:[{name:"visibility",display:__("Permissions"),tag:"radio",default:!1,options:[{value:"draft",name:__("Draft"),note:__("Only visible to editors")},{value:"internal",name:__("Internal"),note:__("Visible to readers & editors")},{value:"published",name:__("Public"),note:__("Visible to everyone")},{value:"archived",name:__("Archived")}]},{name:"timing",display:__("Timing"),tag:"radio",default:"now",options:[{value:"now",name:__("now")},{value:"scheduled",name:__("Schedule for")}]},{name:"scheduled",display:__("Date"),tag:"datetime",class:"form-control--small",null:!0}]},i}(App.ControllerForm)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseContentController=function(e){function n(){var t,e;if(n.__super__.constructor.apply(this,arguments),(t=this.object.translation(this.parentController.kb_locale().id))&&!t.fullyLoaded())return this.html(App.view("knowledge_base/content")(this)),this.startLoading(),void t.loadFull((e=this,function(t){if(e.stopLoading(),t)return e.initialize()}));this.initialize()}return t(n,e),n.prototype.elements={".js-form":"form",".js-discard":"discardButton",".js-submitContainer":"submitContainer"},n.prototype.events={"click .js-submit":"submit","click .js-discard":"discardChanges","submit .js-form":"submit","input .js-form":"showDiscardButton","click .js-submit-action":"submit"},n.prototype.initialize=function(){var t;return this.render(),this.listenTo(App.KnowledgeBase,"kb_data_change_loaded",(t=this,function(){return t.objectRefreshed(),!0})),this.listenTo(this.object,"refresh",function(t){return function(){return t.renderAvailabilityWidgets()}}(this))},n.prototype.render=function(){return this.html(App.view("knowledge_base/content")(this)),this.renderAvailabilityWidgets(),this.formController=this.buildFormController(this.form),this.startingParams=App.ControllerForm.params(this.formController.el)},n.prototype.buildFormController=function(t){return null==t&&(t=void 0),new App.KnowledgeBaseFormController(this.object,this.parentController.kb_locale(),"agent_edit",t)},n.prototype.remoteDidntChangeSinceStart=function(){var t;return t=this.buildFormController().rawParams(),App.KnowledgeBaseFormController.compareParams(t,this.startingParams)},n.prototype.objectRefreshed=function(){if(this.object.exists())if(this.renderAvailabilityWidgets(),this.remoteDidntChangeSinceStart())this.pendingRerender=!1;else{if(this.parentController.shown)return this.rerenderIfConfirmed();this.pendingRerender=!0}else this.parentController.renderNotAvailableAnymore()},n.prototype.rerenderIfConfirmed=function(){var t;if(t=App.i18n.translatePlain("Are you sure you want to reload? You have unsaved changes that will get lost"),confirm(t))return this.render()},n.prototype.renderAvailabilityWidgets=function(){var t,e;if("function"==typeof(t=this.object.constructor).canBePublished?t.canBePublished():void 0)return new App.WidgetButtonWithDropdown({el:this.submitContainer,mainActionLabel:__("Update"),actions:this.quickActions()}),e=App.view("knowledge_base/content_can_be_published_header_suffix")({object:this.object}),this.el.find(".js-published-header-suffix").replaceWith(e)},n.prototype.submit=function(t){var e,n;if(this.preventDefaultAndStopPropagation(t),this.formController.validateAndShowErrors()){var i;if(n=this.formController.paramsForSaving(),e=$(t.currentTarget).data("id"),!this.remoteDidntChangeSinceStart())return new App.ControllerConfirm({head:__("Content was changed since loading"),message:__("Your changes may override someone else's changes. Do you really want to save?"),buttonClass:"btn--danger",callback:(i=this,function(){return i.parentController.coordinator.saveChanges(i.object,n,i)})});this.parentController.coordinator.saveChanges(this.object,n,this,e)}},n.prototype.missingTranslation=function(){return void 0===this.object.translation(this.parentController.kb_locale().id)&&!this.object.isNew()},n.prototype.showDiscardButton=function(){return this.delay((t=this,function(){var e;return e=App.KnowledgeBaseFormController.compareParams(t.formController.rawParams(),t.startingParams),t.discardButton.toggleClass("hide",e)}),500,"check_unsaved_changes");var t},n.prototype.quickActions=function(){var t,e;return e=App.i18n.translatePlain("Update")+" & ",t=this.object.can_be_published_quick_actions(),[{id:"internal",name:e+App.i18n.translatePlain("Internal"),disabled:!_.includes(t,"internal")},{id:"publish",name:e+App.i18n.translatePlain("Publish"),disabled:!_.includes(t,"publish")},{id:"archive",name:e+App.i18n.translatePlain("Archive"),disabled:!_.includes(t,"archive")}]},n.prototype.discardChanges=function(){return this.render()},n.prototype.showAlert=function(t){var e;return null!=(e=this.formController)?e.showAlert(t):void 0},n.prototype.didSaveCallback=function(){return this.render(),App.Event.trigger("knowledge_base::sidebar::rerender"),App.Event.trigger("knowledge_base::navigation::rerender")},n.prototype.restoreVisibility=function(){var t;if(this.pendingRerender)return this.pendingRerender=!1,App.Delay.set((t=this,function(){return t.rerenderIfConfirmed()}))},n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseDelete=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.isTitleMatching=function(){var t;return t=this.object().guaranteedTitle(),this.formParam(this.el).title===t},n.prototype.submit=function(t){var e,n,i;if(this.preventDefaultAndStopPropagation(t),e=this.formControllers[0],this.isTitleMatching())return e.hideAlert(),n=new App.ControllerModalLoading({container:this.parentVC.el.closest(".content")}),this.ajax({id:"knowledge_bases",type:"DELETE",url:this.object().manageUrl(),processData:!0,success:(i=this,function(){return n.hide(),i.parentVC.clear()}),error:function(t){return function(i){var s;return e.showAlert((null!=(s=i.responseJSON)?s.error:void 0)||t.T("The request could not be processed.")),n.hide()}}(this)});e.showAlert(App.i18n.translateInline("Confirmation failed."))},n.prototype.buildFormController=function(){return new App.ControllerForm({fullForm:!0,formClass:"settings-entry",fullFormButtonsContainerClass:"justify-end",fullFormSubmitLabel:__("Delete Knowledge Base"),fullFormSubmitAdditionalClasses:"btn--danger",model:{configure_attributes:[{name:"title",model:"translation",style:"block",null:!0,display:__("Permanently Delete Knowledge Base"),help:'Deleting your knowledge base requires an additional verification step. To proceed, enter its name below ("'+this.object().guaranteedTitle()+'"). THIS ACTION CANNOT BE UNDONE.',tag:"input"}]}})},n}(App.KnowledgeBaseForm)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};App.KnowledgeBaseDeleteAction=function(){function e(e){var n,i;for(n in this.deleteOk=t(this.deleteOk,this),this.doDelete=t(this.doDelete,this),e)i=e[n],this[n]=i;this.object instanceof App.KnowledgeBaseCategory&&!this.object.isEmpty()?this.showCannotDelete(__("Cannot delete category"),__("Delete all child categories and answers, then try again.")):this.showConfirm()}return e.prototype.showConfirm=function(){var t,e;return t=this.parentController.kb_locale(),e=this.object.guaranteedTranslation(t.id),this.dialog=new App.ControllerConfirm({head:__("Delete"),message:App.i18n.translatePlain('Do you really want to delete "%s"?',null!=e?e.title:void 0),buttonClass:"btn--danger",callback:this.doDelete,container:this.parentController.el,onSubmit:function(){return this.formDisable(this.el),this.callback(this),this.dialog=null}})},e.prototype.showCannotDelete=function(t,e){var n,i;return n=new App.ControllerModal({head:t,contentInline:e,container:this.parentController.el,buttonClose:!0,buttonSubmit:__("Ok"),onSubmit:(i=this,function(){return n.close(),i.dialog=null})}),this.dialog=n},e.prototype.doDelete=function(t){return App.Ajax.request({type:"DELETE",url:this.object.generateURL()+"?full=true",success:(e=this,function(){return e.deleteOk(t)}),error:function(e){return function(n){return e.deleteFailure(t,n)}}(this)});var e},e.prototype.deleteOk=function(t){var e,n,i;return i=("function"==typeof(e=this.object).parent?e.parent():void 0)||("function"==typeof(n=this.object).category?n.category():void 0)||this.object.knowledge_base(),this.parentController.contentController.stopListening(),this.object.removeIncludingTranslations({clear:!0}),t.close(),this.parentController.navigate(i.uiUrl(this.parentController.kb_locale(),"edit"))},e.prototype.deleteFailure=function(t,e){var n;return t.formEnable(t.el),t.showAlert((null!=(n=e.responseJSON)?n.error:void 0)||__("Deletion failed."))},e.prototype.close=function(){var t;return null!=(t=this.dialog)?t.close():void 0},e}()}.call(this),function(){App.KnowledgeBaseEditorCoordinator=function(){function t(t){var e,n;for(e in t)n=t[e],this[e]=n}return t.prototype.clickedCanBePublished=function(t){return new App.KnowledgeBaseContentCanBePublishedDialog({object:t,container:this.parentController.el})},t.prototype.clickedDelete=function(t){return new App.KnowledgeBaseDeleteAction({object:t,parentController:this.parentController})},t.prototype.clickedPermissions=function(t){return new App.KnowledgeBasePermissionsDialog({object:t,container:this.parentController.el})},t.prototype.urlFor=function(t){return t.id?t.generateURL():t.url()},t.prototype.saveChanges=function(t,e,n,i){var s;return App.ControllerForm.disable(n.form),s=this.urlFor(t)+"?full=true",i&&(s+="&additional_action="+i),App.Ajax.request({type:t.writeMethod(),data:JSON.stringify(e),url:s,success:function(t){return App.Collection.loadAssets(t.assets),n.didSaveCallback(t)},error:function(t){return e=JSON.parse(t.responseText),App.ControllerForm.enable(n.form),n.showAlert(e.error||__("The changes could not be saved."))}})},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseFeedDialog=function(n){function i(e){this.content=t(this.content,this),this.load=t(this.load,this),this.clickedRenew=t(this.clickedRenew,this),this.clickedCopy=t(this.clickedCopy,this),i.__super__.constructor.apply(this,arguments),this.load()}return e(i,n),i.prototype.events={"click .js-renew":"clickedRenew","click .js-copy":"clickedCopy"},i.prototype.head=__("Knowledge Base Feed"),i.prototype.leftButtons=[{text:__("Renew Access Token"),className:"js-renew"}],i.prototype.buttonSubmit=!1,i.prototype.clickedCopy=function(t){var e;return t.preventDefault(),e=$(t.target).prev().attr("href"),this.copyToClipboardWithTooltip(e,t.target,".modal-body",!0)},i.prototype.clickedRenew=function(t){return t.preventDefault(),this.token=null,this.update(),this.$(".form-control-visible-readonly").removeClass("form-control-visible-readonly"),this.ajax({id:"knowledge_base_feed_token_renew",type:"patch",url:App.KnowledgeBase.generateURL("feed_tokens"),processData:!0,success:(e=this,function(t){return e.token=t.token,e.update()}),error:function(t){return function(e){var n;return t.showAlert((null!=(n=e.responseJSON)?n.error:void 0)||__("Changes could not be loaded."))}}(this)});var e},i.prototype.load=function(){return this.ajax({id:"knowledge_base_feed_token",type:"get",url:App.KnowledgeBase.generateURL("feed_tokens"),processData:!0,success:(t=this,function(e){return t.token=e.token,t.update()}),error:function(t){return function(e){var n;return t.showAlert((null!=(n=e.responseJSON)?n.error:void 0)||__("Changes could not be loaded."))}}(this)});var t},i.prototype.content=function(){var t;if(this.token)return t=function(){var t;switch(null!=(t=this.object)?t.constructor:void 0){case App.KnowledgeBaseAnswer:return this.object.category();case App.KnowledgeBaseCategory:return this.object;default:return null}}.call(this),App.view("knowledge_base/feed_dialog")({kb_url:this.kb.privateFeedUrl(this.kb_locale,this.token),kb_title:this.kb.guaranteedTitle(this.kb_locale),category_url:null!=t?t.privateFeedUrl(this.kb_locale,this.token):void 0,category_title:null!=t?t.guaranteedTitle(this.kb_locale):void 0})},i}(App.ControllerModal)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseFormController=function(e){function n(t,e,i,s){var r;this.object=t,this.kb_locale=e,(r=this.currentParams()).form_id=App.ControllerForm.formId(),n.__super__.constructor.call(this,{params:r,autofocus:null!==s,grid:!0,el:s||$("<form>"),screen:i,model:{configure_attributes:this.getAttrs()}})}return t(n,e),n.prototype.getAjaxAttributes=function(t,e){var n,i;return this.apiPath=App.Config.get("api_path"),e.url=this.apiPath+"/knowledge_bases/search",(n={}).query=t.input.val(),n.limit=t.options.attribute.limit,n.flavor="agent",n.knowledge_base_id=this.object.knowledge_base().id,n.exclude_ids=[null!=(i=this.object.translation(this.kb_locale.id))?i.id:void 0],n.index="KnowledgeBase::Answer::Translation",n.locale=this.kb_locale.systemLocale().locale,n.highlight_enabled=!1,e.data=JSON.stringify(n),e},n.prototype.currentParams=function(){return this.object.attributesIncludingTranslation(this.kb_locale.id)},n.prototype.rawParams=function(){return App.ControllerForm.params(this.el)},n.prototype.paramsForSaving=function(){return this.object.prepareNestedParams(this.rawParams(),this.kb_locale.id)},n.prototype.validateAndShowErrors=function(){var t;return t=this.validate(this.rawParams()),this.constructor.validate({errors:t,form:this.el}),!t},n.prototype.getAttrs=function(){var t,e;return(t=("function"==typeof(e=this.object).configure_attributes?e.configure_attributes(this.kb_locale):void 0)||this.object.constructor.configure_attributes).push({name:"form_id",tag:"input",type:"hidden"}),t},n.compareParams=function(t,e){var n,i,s;for(n=0,i=(s=[t,e]).length;n<i;n++)delete s[n].form_id;return _.isEqual(t,e)},n}(App.ControllerForm)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseReaderPagination=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.render()}return t(n,e),n.prototype.className="knowledge-base-article-nav",n.prototype.render=function(){var t,e,n,i,s,r,o;for(this.stopListening(),s=this.calculatePreviousAnswer(),n=this.calculateNextAnswer(),this.html(App.view("knowledge_base/_reader_pagination")({previousAnswer:null!=s?s.attributesForRendering(this.kb_locale):void 0,nextAnswer:null!=n?n.attributesForRendering(this.kb_locale):void 0})),o=[],t=0,e=(r=[this.object,s,n,this.object.category()]).length;t<e;t++)(i=r[t])?o.push(this.listenTo(i,"refresh",function(t){return function(){return t.render()}}(this))):o.push(void 0);return o},n.prototype.calculatePreviousAnswer=function(){return this.calculateSiblingAnswer(-1)},n.prototype.calculateNextAnswer=function(){return this.calculateSiblingAnswer(1)},n.prototype.calculateSiblingAnswer=function(t){var e,n,i,s,r,o;if(r=this.calculateSibling(this.object.category().answers(),this.object,t))return r;if(t<0&&(e=this.findlastAnswer(this.object.category())))return e;for(s=this.object;s;){if(n=(i=("function"==typeof s.category?s.category():void 0)||("function"==typeof s.parent?s.parent():void 0))?i.children():s.knowledge_base().rootCategories(),o=this.findAnswerInSiblingCategory(s,n,t))return o;s=i}return null},n.prototype.calculateSibling=function(t,e,n){return t[this.getIndexOf(t,e)+n]},n.prototype.getIndexOf=function(t,e){var n;return n=t.filter((function(t){return t.id===e.id}))[0],t.indexOf(n)},n.prototype.findlastAnswer=function(t,e){var n,i,s,r,o;if(null==e&&(e=!1),e&&(s=t.answers().slice(-1)[0]))return s;for(i=0,r=(o=t.children().reverse()).length;i<r;i++)if(t=o[i],n=this.findlastAnswer(t,!0))return n;return null},n.prototype.findFirstAnswer=function(t){var e,n,i,s;for(n=0,i=(s=t.children()).length;n<i;n++)if(t=s[n],e=this.findFirstAnswer(t))return e;return t.answers()[0]},n.prototype.findAnswerInSiblingCategory=function(t,e,n){var i,s,r,o,a;for(s=this.getIndexOf(e,t),o=0,a=(i=n<0?e.slice(0,s).reverse():e.slice(s+1)).length;o<a;o++)if(t=i[o],r=n<0?this.findlastAnswer(t,!0):this.findFirstAnswer(t))return r;return null},n}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseNavigation=function(n){function i(){var e;this.needsUpdate=t(this.needsUpdate,this),i.__super__.constructor.apply(this,arguments),this.render(),this.controllerBind("knowledge_base::navigation::rerender",(e=this,function(){return e.needsUpdate()})),this.listenTo(App.KnowledgeBase,"kb_data_change_loaded",this.needsUpdate),this.listenTo(App.KnowledgeBase,"kb_visibility_change_loaded",this.needsUpdate)}return e(i,n),i.extend(Spine.Events),i.prototype.events={"click .js-search":"clickedToggleSearch","click .js-feed":"clickedFeed"},i.prototype.elements={".js-edit":"editButton"},i.prototype.buildCrumbsForRendering=function(t,e,n){return"search"===n&&(n=null),e?t.filter((function(t){return null!=t})).map((i=this,function(t){return"string"==typeof t?{title:t}:(i.listenToChangesOn(t),t.attributesForRendering(e,{action:n}))})):[];var i},i.prototype.listenToChangesOn=function(t){var e,n;if(e=this.parentController.kb_locale())return this.stopListening(t,"refresh"),this.listenToOnce(t.translationBindlableObject(e.id),"refresh",(n=this,function(){return n.needsUpdate()}))},i.prototype.show=function(t,e){var n,i,s;if(this.savedAction=e,!this.dontRenderFor(t))return n=(s=this.calculateTitle(t,e))?[this.parentController.getKnowledgeBase(),s]:this.breadcrumbTo(t).reverse(),i=this.buildCrumbsForRendering(n,this.parentController.kb_locale(),e),this.render(i,t,e),this.savedParams=t},i.prototype.calculateTitle=function(t,e){return"search"===e?App.i18n.translateInline("Search"):t?void 0:App.i18n.translateInline("Not found")},i.prototype.dontRenderFor=function(t){return t instanceof App.Model&&(t.isNew()&&!t.isFresh)},i.prototype.needsUpdate=function(){return this.show(this.savedParams,this.savedAction)},i.prototype.selectedLocaleDisplay=function(){var t;return(null!=(t=this.parentController.kb_locale())?t.systemLocale().alias:void 0)||"-"},i.prototype.render=function(t,e,n){var i;if(null==t&&(t=[]),null==e&&(e=null),null==n&&(n=null),i=this.parentController.kb_locale())return this.html(App.view("knowledge_base/navigation")({crumbs:t,kbLocales:this.kbLocaleOptions(e,i,n),search:this.searchOptions(e,i,n),edit:this.editOptions(e,i,n),feed:this.feedOptions(e,i,n),externalUrl:this.externalUrl(e,i,n),iconset:this.parentController.getKnowledgeBase().iconset}))},i.prototype.kbLocaleOptions=function(t,e){return{selected:e,collection:this.kb_locales()}},i.prototype.searchOptions=function(t,e,n){var i,s,r;return{enabled:i="search"===n,url:!0===i?this.toggleSearchSource||(null!=(s=this.parentController.getKnowledgeBase())?s.uiUrl(e):void 0):null!=(r=this.parentController.getKnowledgeBase())?r.uiUrl(e,"search"):void 0}},i.prototype.editOptions=function(t,e,n){var i;return i="edit"===n,{url:null!=t?t.uiUrl(e,i?void 0:"edit"):void 0,enabled:i,available:this.parentController.isEditor()}},i.prototype.feedOptions=function(){return{available:this.parentController.getKnowledgeBase().show_feed_icon}},i.prototype.externalUrl=function(t,e,n){var i,s;if((!n||"edit"===n)&&((null!=t&&"function"==typeof t.visiblePublicly?t.visiblePublicly(e):void 0)||null!=(null!=t&&"function"==typeof t.translation?t.translation(null!=e?e.id:void 0):void 0)&&this.parentController.isEditor()))return s=t.constructor.className,i=e.systemLocale().locale,this.apiPath+"/knowledge_bases/preview/"+s+"/"+t.id+"/"+i},i.prototype.kb_locales=function(){var t;return t="#"+this.parentController.lastParams.match.input,
this.parentController.getKnowledgeBase().kb_locales().map((function(e){return e.attributesForRendering(t)}))},i.prototype.toggleSearchSource=void 0,i.prototype.clickedToggleSearch=function(){if("search"!==this.savedAction)return this.toggleSearchSource=location.hash},i.prototype.clickedFeed=function(){return new App.KnowledgeBaseFeedDialog({kb:this.parentController.getKnowledgeBase(),kb_locale:this.parentController.kb_locale(),object:this.savedParams})},i.prototype.breadcrumbTo=function(t){return t?function(){switch(t.constructor){case App.KnowledgeBaseAnswer:return this.breadcrumbToAnswer(t);case App.KnowledgeBaseCategory:return this.breadcrumbToCategory(t);case App.KnowledgeBase:return this.breadcrumbToKb(t)}}.call(this):[]},i.prototype.breadcrumbToAnswer=function(t){return[t].concat(this.breadcrumbToCategory(t.category()))},i.prototype.breadcrumbToCategory=function(t){var e,n;for(e=[t];n=(n||t).parent();)e=e.concat(n);return e.concat(this.breadcrumbToKb(t.knowledge_base()))},i.prototype.breadcrumbToKb=function(t){return[t]},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseNewController=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.render()}return t(n,e),n.prototype.events={"submit form":"submit"},n.prototype.render=function(){return this.formController=new App.ControllerForm({model:App.KnowledgeBase,screen:"admin_create",autofocus:!1,formClass:"settings-entry",fullForm:!0,fullFormSubmitLabel:__("Create Knowledge Base"),fullFormButtonsContainerClass:"justify-end",fullFormSubmitAdditionalClasses:"btn--success"}),this.el.html(this.formController.form)},n.prototype.prepareParams=function(t){var e,n,i,s,r,o;for(s in o=[],r=App.KnowledgeBase.attributesGet(this.formController.screen))e=r[s],i=this.$("."+e.tag+"[data-attribute-name="+e.name+"]"),o.push("function"==typeof(n=App.UiElement[e.tag]).prepareParams?n.prepareParams(e,i,t):void 0);return o},n.prototype.applyDefaults=function(t){return t.iconset="FontAwesome",t.color_highlight="#38ae6a",t.color_header="#f9fafb",t.color_header_link="hsl(206,8%,50%)",t.homepage_layout="grid",t.category_layout="grid"},n.prototype.submit=function(t){var e,n;return this.preventDefaultAndStopPropagation(t),e=this.formParam(this.el),this.prepareParams(e),this.applyDefaults(e),this.formDisable(this.el),this.ajax({type:"POST",data:JSON.stringify(e),url:App.KnowledgeBase.manageUrl,success:(n=this,function(){return n.parentVC.fetchAndRender()}),error:function(t){return function(e){var n;return t.formEnable(t.el),t.formController.showAlert((null!=(n=e.responseJSON)?n.error:void 0)||__("The Knowledge Base could not be created."))}}(this)})},n}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBasePermissionsDialog=function(n){function i(e){this.onSubmit=t(this.onSubmit,this),this.toggleDisabled=t(this.toggleDisabled,this),this.load=t(this.load,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments),this.load()}return e(i,n),i.prototype.events={"click td.u-clickable":"cellBackgroundClicked"},i.prototype.head="Permissions",i.prototype.includeForm=!0,i.prototype.buttonSubmit=!0,i.prototype.accessLevels={editor:"Editor",reader:"Reader",none:"None"},i.prototype.cellBackgroundClicked=function(t){var e;if(t.target===t.currentTarget)return t.preventDefault(),null!=(e=t.currentTarget.querySelector("input"))?e.click():void 0},i.prototype.data=null,i.prototype.content=function(){if(this.data)return App.view("knowledge_base/permissions_dialog")({accessLevels:this.accessLevels,params:this.loadedParams(this.data),roles:this.formRoles(this.data)})},i.prototype.loadedParams=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d;for(c=[],e=0,s=(p=t.permissions).length;e<s;e++)c[(u=p[e]).role_id]=u.access;for(n=0,r=(h=t.roles_editor).length;n<r;n++)c[a=h[n].id]||(c[a]="editor");for(i=0,o=(d=t.roles_reader).length;i<o;i++)c[l=d[i].id]||(c[l]="reader");return c},i.prototype.formRoles=function(t){var e;return t.roles_editor.forEach((e=this,function(n){return e.formRolesItem(n,"editor",t)})),t.roles_reader.forEach(function(e){return function(n){return e.formRolesItem(n,"reader",t)}}(this)),_.sortBy(t.roles_editor.concat(t.roles_reader),(function(t){return t.name}))},i.prototype.formRolesItem=function(t,e,n){var i;return t.accessLevel=e,t.limit=null!=(i=_.findWhere(n.inherited,{role_id:t.id}))?i.access:void 0,null!=t.limit?t.accessLevelIsDisabled={editor:"editor"!==t.limit,reader:"none"===t.limit,none:!1}:t.accessLevelIsDisabled={editor:"editor"!==t.accessLevel,reader:!1,none:!1}},i.prototype.load=function(){return this.ajax({id:"knowledge_base_permissions_get",type:"get",url:this.object.generateURL("permissions"),processData:!0,success:(t=this,function(e){return t.data=e,t.update()}),error:function(t){return function(e){var n;return t.showAlert((null!=(n=e.responseJSON)?n.error:void 0)||__("Changes could not be loaded."))}}(this)});var t},i.prototype.toggleDisabled=function(t){return this.el.find("input:not([data-permanently-disabled]), button").attr("disabled",t)},i.prototype.onSubmit=function(){var t,e;return this.clearAlerts(),this.toggleDisabled(!0),t={permissions_dialog:{permissions:this.formParams()}},this.ajax({id:"knowledge_base_permissions_patch",type:"PATCH",data:JSON.stringify(t),url:this.object.generateURL("permissions"),processData:!0,success:(e=this,function(){return e.close()}),error:function(t){return function(e){var n;return t.toggleDisabled(!1),t.showAlert((null!=(n=e.responseJSON)?n.error:void 0)||__("Changes could not be saved."))}}(this)})},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBasePublicMenuForm=function(n){function i(e){this.onError=t(this.onError,this),this.onSuccess=t(this.onSuccess,this),this.formParams=t(this.formParams,this),this.formItems=[],this.head=e.location.headline,i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.autoFocusOnFirstInput=!1,i.prototype.includeForm=!0,i.prototype.formParams=function(){return this.formItems.map((function(t){return t.buildData()}))},i.prototype.content=function(){var t;return this.formItems=App.KnowledgeBase.find(this.knowledge_base_id).kb_locales().map((t=this,function(e){var n;return n=App.KnowledgeBaseMenuItem.using_kb_locale_location(e,t.location.identifier),new App.KnowledgeBasePublicMenuFormItem({parent:t,knowledge_base_id:t.knowledge_base_id,location:t.location.identifier,kb_locale:e,menu_items:n})})),this.formItems.map((function(t){return t.el}))},i.prototype.hasError=function(){return this.formItems.map((function(t){return t.hasError()})).filter((function(t){return t})).pop()},i.prototype.onSubmit=function(t){var e,n;if(this.preventDefaultAndStopPropagation(t),!(e=this.hasError()))return this.clearAlerts(),this.formItems.forEach((function(t){return t.toggleUserInteraction(!1)})),n=App.KnowledgeBase.find(this.knowledge_base_id),this.ajax({id:"update_menu_items",type:"PATCH",url:n.manageUrl("update_menu_items"),data:JSON.stringify({menu_items_sets:this.formParams()}),processData:!0,success:this.onSuccess,error:this.onError});this.showAlert(e)},i.prototype.onSuccess=function(t){var e,n,i,s,r,o,a;for(n=0,s=(o=this.formItems).length;n<s;n++)for(e=o[n],i=0,r=(a=App.KnowledgeBaseMenuItem.using_kb_locale_location(e.kb_locale,e.location)).length;i<r;i++)a[i].remove({clear:!0});return App.Collection.loadAssets(t.assets),App.KnowledgeBaseMenuItem.trigger("kb_data_change_loaded"),this.close()},i.prototype.onError=function(t){var e;return this.showAlert((null!=(e=t.responseJSON)?e.error_human:void 0)||__("The changes could not be saved.")),this.formItems.forEach((function(t){return t.toggleUserInteraction(!0)}))},i}(App.ControllerModal)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBasePublicMenuFormItem=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.render()}return t(n,e),n.prototype.events={"click .js-add":"add","click .js-remove":"remove","input input":"input"},n.prototype.elements={".js-alert":"alert"},n.prototype.render=function(){return this.html(App.view("knowledge_base/public_menu_form_item")({rows:this.menu_items,title:this.kb_locale.systemLocale().name})),this.applySortable()},n.prototype.applySortable=function(){var t;return t={tolerance:"pointer",distance:15,opacity:.6,items:"tr.sortable",start:function(t,e){return e.placeholder.height(e.item.height())},helper:function(t,e){var n,i;return i=e.children(),(n=e).children().each((function(t){return $(this).width(i.eq(t).width())})),n},update:this.dndCallback,stop:function(t,e){return e.item.children().each((function(t,e){return e.style.width=""}))}},this.el.find("tbody").sortable(t)},n.prototype.toggleUserInteraction=function(t){return t?App.ControllerForm.enable(this.el):App.ControllerForm.disable(this.el),this.$(".js-remove, .js-add").attr("disabled",!t),this.el.find("tbody").sortable({disabled:!t})},n.prototype.buildData=function(){var t;return t=this.$("tr.sortable").toArray().map((function(t){return $(t)})).map((function(t){return{id:t.data("id"),title:t.find("input[data-name=title]").val(),url:t.find("input[data-name=url]").val(),new_tab:t.find("input[data-name=new_tab]").prop("checked"),_destroy:t.hasClass("js-deleted")}})),{kb_locale_id:this.kb_locale.id,location:this.location,menu_items:t}},n.prototype.input=function(){if(!this.hasError())return this.parent.clearAlerts()},n.prototype.add=function(){var t;return t=App.view("knowledge_base/public_menu_form_item_row")(),$(t).insertBefore(this.$("tr:has(.js-add)"))},n.prototype.remove=function(t){var e;return(e=$(t.currentTarget).closest("tr")).data("id")?(e.toggleClass("settings-list--deleted js-deleted"),e.find(".js-remove input").prop("checked",e.hasClass("settings-list--deleted")),e.find(".js-new-tab input").attr("disabled",e.hasClass("js-deleted"))):e.remove()},n.prototype.findEmptyFields=function(){return this.$("tr.sortable:not(.js-deleted)").find("input[data-name]").toArray().filter((function(t){return 0===$(t).val().length}))},n.prototype.hasError=function(){return 0!==this.findEmptyFields().length&&__("Please fill in all fields")},n}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBasePublicMenuManager=function(n){function i(){var e;this.edit=t(this.edit,this),i.__super__.constructor.apply(this,arguments),this.listenTo(App.KnowledgeBaseMenuItem,"kb_data_change_loaded",(e=this,function(){return e.render()}))}return e(i,n),i.prototype.events={"show.bs.tab":"willShow","click .js-edit":"edit"},i.prototype.willShow=function(){return this.render()},i.prototype.render=function(){var t;return t=App.KnowledgeBase.find(this.knowledge_base_id),this.html(App.view("knowledge_base/public_menu_manager")({locations:this.locations(),locales:t.kb_locales()}))},i.prototype.locations=function(){var t;return t=App.KnowledgeBase.find(this.knowledge_base_id),[{headline:__("Header Menu"),identifier:"header",color:t.color_header,color_link:t.color_header_link},{headline:__("Footer Menu"),identifier:"footer",color_link:"hsl(207,12%,50%)"}]},i.prototype.edit=function(t){var e,n;return this.preventDefaultAndStopPropagation(t),e=$(t.target).data("target-location"),n=_.find(this.locations(),(function(t){return t.identifier===e})),new App.KnowledgeBasePublicMenuForm({location:n,knowledge_base_id:this.knowledge_base_id,container:this.el.closest(".content")})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseReaderController=function(n){function i(){var e,n;if(this.renderLinkedTickets=t(this.renderLinkedTickets,this),i.__super__.constructor.apply(this,arguments),e=this.object.translation(this.parentController.kb_locale().id),this.html(App.view("knowledge_base/reader")({search_return_url:this.buildSearchReturnUrl()})),e&&!e.fullyLoaded())return this.startLoading(this.answerBody),void e.loadFull((n=this,function(t){if(n.stopLoading(),t)return n.initialize()}));this.initialize()}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("Ticket"),i.prototype.events={"click .js-tag":"searchTag"},i.prototype.elements={".js-answer-title":"answerTitle",".js-answer-body":"answerBody",".js-answer-pagination":"answerPagination",".js-answer-attachments":"answerAttachments",".js-answer-tags":"answerTags",".js-answer-linked-tickets":"answerLinkedTickets",".js-answer-meta":"answerMeta"},i.prototype.initialize=function(){return this.render()},i.prototype.render=function(){var t,e;if(this.stopListening(),t=this.parentController.kb_locale(),this.renderAnswer(this.object,t),this.object)return this.listenTo(App.KnowledgeBase,"kb_data_change_loaded",(e=this,function(){return e.renderAnswer(e.object,t)})),this.listenTo(App.KnowledgeBase,"kb_visibility_change_loaded",function(e){return function(){return e.renderAnswer(e.object,t,!0)}}(this))},i.prototype.renderAnswer=function(t,e,n){var i,s;if(t)if(t.exists()){if(s=new App.KnowledgeBaseReaderPagination({object:this.object,kb_locale:e}),this.answerPagination.html(s.el),!n){if(this.renderAttachments(t.attachments),this.renderTags(t.tags),this.fetchLinkedTickets(t.translation(e.id)),i=t.translation(e.id))return this.answerTitle.text(i.title),this.renderBody(i),this.answerMeta.html(App.view("knowledge_base/_reader_answer_meta")({answer:t,translation:i,isEditor:this.parentController.isEditor()})),this.renderPopovers();this.renderTranslationMissing(t)}}else this.parentController.renderNotAvailableAnymore();else this.parentController.renderNotFound()},i.prototype.renderBody=function(t){var e;return e=t.content().body,e=this.prepareLinks(e),e=this.prepareVideos(e),this.answerBody.html(e)},i.prototype.prepareLinks=function(t){var e,n,i,s,r;for(e=0,n=(r=(t=$($.parseHTML(t))).find("a").addBack("a").toArray()).length;e<n;e++)if(i=r[e],"knowledge-base-answer"===$(i).attr("data-target-type"))(s=App.KnowledgeBaseAnswerTranslation.find($(i).attr("data-target-id")))?$(i).attr("href",s.uiUrl()):$(i).attr("href","#");return $("<container>").append(t).html()},i.prototype.prepareVideos=function(t){return t.replace(/\(([\s]*)widget:([\s]*)video[\W]([\s\S])+?\)/g,(function(t){var e,n;return e=t.slice(1,-1).split(",").map((function(t){return t.split(":").map((function(t){return t.trim()}))})).reduce((function(t,e){return t[e[0]]=e[1],t}),{}),(n=function(){switch(e.provider){case"youtube":return"https://www.youtube.com/embed/"+e.id;case"vimeo":return"https://player.vimeo.com/video/"+e.id}}())?"<div class='videoWrapper'><iframe allowfullscreen id='"+e.provider+e.id+"' type='text/html' src='"+n+"' frameborder='0'></iframe></div>":t}))},i.prototype.renderAttachments=function(t){var e;return this.answerAttachments.html(App.view("generic/attachments")({attachments:t})),this.answerAttachments.on("click",".file-image .js-preview",(e=this,function(t){return e.imageView(t)})),this.answerAttachments.on("click",".file-calendar .js-preview",function(t){return function(e){return t.calendarView(e)}}(this))},i.prototype.imageView=function(t){return t.preventDefault(),t.stopPropagation(),new App.TicketZoomArticleImageView({image:$(t.target).get(0).outerHTML})},i.prototype.calendarView=function(t){var e;return t.preventDefault(),t.stopPropagation(),e=$(t.target).closest(".attachment.file-calendar"),new App.TicketZoomArticleCalendarView({calendar:e.get(0).outerHTML})},i.prototype.renderTags=function(t){return this.answerTags.html(App.view("knowledge_base/_reader_tags")({tags:t}))},i.prototype.fetchLinkedTickets=function(t){if(t){var e;if(!this.linkedTickets)return this.ajax({id:"kb_reader_links_"+t.id,type:"GET",url:this.apiPath+"/links",data:{link_object:"KnowledgeBase::Answer::Translation",link_object_value:t.id},processData:!0,success:(e=this,function(t){return App.Collection.loadAssets(t.assets),e.linkedTickets=t.links.map((function(t){return App[t.link_object].find(t.link_object_value)})),e.renderLinkedTickets(),e.renderPopovers()})});this.renderLinkedTickets()}},i.prototype.renderLinkedTickets=function(){return this.answerLinkedTickets.html(App.view("knowledge_base/_reader_linked_tickets")({tickets:this.linkedTickets}))},i.prototype.renderTranslationMissing=function(t){var e;if(this.parentController.isEditor())return this.renderScreenPlaceholder({icon:App.Utils.icon("mood-ok"),detail:__("Not available in selected language"),el:this.answerBody,action:__("Create a translation"),actionCallback:(e=this,function(){var n;return n=t.uiUrl(e.parentController.kb_locale(),"edit"),e.navigate(n)})});this.parentController.renderNotFound()},i.prototype.buildSearchReturnUrl=function(){if("search-return"===this.parentController.lastParams.action)return decodeURIComponent(this.parentController.lastParams.arguments)},i.prototype.searchTag=function(t){var e;return t.preventDefault(),e=$(t.currentTarget).text(),App.GlobalSearchWidget.search(e,"tags")},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseReaderListContainer=function(n){function i(){this.parentRefreshed=t(this.parentRefreshed,this),i.__super__.constructor.apply(this,arguments),this.render(),this.listenTo(App.KnowledgeBase,"kb_data_change_loaded",this.parentRefreshed),this.listenTo(App.KnowledgeBase,"kb_visibility_change_loaded",this.parentRefreshed)}return e(i,n),i.prototype.tag="ul",i.prototype.className="sections",i.prototype.parentRefreshed=function(){var t,e,n;if(t=this.children().map((function(t){return t.id})),e=this.el.children().toArray().map((function(t){return parseInt(t.dataset.id)})),!_.isEqual(t,e))return App.Delay.set((n=this,function(){return n.render()}),200,this.constructor.className+"_"+this.parent.constructor.className+":"+this.parent.id,"kb_category_refresh")},i.prototype.render=function(){var t,e,n,i,s;for(this.el.empty(),s=[],e=0,n=(i=this.children()).length;e<n;e++)t=i[e],s.push(this.el.append(new App.KnowledgeBaseReaderListItem({item:t,isEditor:this.isEditor,iconset:this.parent.knowledge_base().iconset,kb_locale:this.kb_locale,parentController:this}).el));return s},i}(App.Controller),App.KnowledgeBaseReaderListContainer.Answers=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.children=function(){var t,e;return this.parent instanceof App.KnowledgeBaseCategory?(t=this.parent.answers(),this.isEditor||(t=t.filter((e=this,function(t){return t.is_internally_published(e.kb_locale)}))),t):[]},n}(App.KnowledgeBaseReaderListContainer),App.KnowledgeBaseReaderListContainer.Categories=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.render=function(){return n.__super__.render.apply(this,arguments),this.el.addClass("sections--"+this.layout()),this.el[0].dataset.size=this.size()},n.prototype.children=function(){var t,e;return t=this.parent instanceof App.KnowledgeBase?this.parent.rootCategories():this.parent instanceof App.KnowledgeBaseCategory?this.parent.children():[],this.isEditor||(t=t.filter((e=this,function(t){return t.visibleInternally(e.kb_locale)}))),t},n.prototype.layout=function(){return this.parent instanceof App.KnowledgeBase?this.parent.knowledge_base().homepage_layout:this.parent.knowledge_base().category_layout},n.prototype.size=function(){return this.parent instanceof App.KnowledgeBase?"large":"medium"},n}(App.KnowledgeBaseReaderListContainer)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseReaderListController=function(n){function i(){var e;this.searchPanelDidEnd=t(this.searchPanelDidEnd,this),this.searchPanelWillStart=t(this.searchPanelWillStart,this),this.changeLoaded=t(this.changeLoaded,this),i.__super__.constructor.apply(this,arguments),this.render(),this.listenTo(App.KnowledgeBase,"kb_data_change_loaded",this.changeLoaded),this.listenTo(App.KnowledgeBase,"kb_visibility_may_have_changed",(e=this,function(){return e.changeLoaded(!0)}))}return e(i,n),i.prototype.changeLoaded=function(){if(this.objectVisibleInternally())return this.renderEmptinessState!==this.object.isEmpty()?this.render():void 0;this.parentController.renderNotAvailableAnymore()},i.prototype.elements={".js-readerListContainer":"container"},i.prototype.objectVisibleInternally=function(){return this.object.visibleInternally(this.parentController.kb_locale())},i.prototype.render=function(){var t,e;if(this.parentController.isEditor()||this.object&&this.object.exists()&&this.objectVisibleInternally()){var n;if(this.renderEmptinessState=this.object.isEmpty(),!this.object.isEmpty())return this.html(App.view("knowledge_base/reader_list")()),this.searchFieldPanel=new App.KnowledgeBaseSearchFieldPanel({el:this.$(".js-searchFieldContainer"),context:this.object,kb_locale:this.parentController.kb_locale(),return_path:this.object.uiUrl(this.parentController.kb_locale(),"search-inline"),willStart:this.searchPanelWillStart,didEnd:this.searchPanelDidEnd}),"search-inline"===this.parentController.lastParams.action&&this.searchFieldPanel.widget.startSearch(this.parentController.lastParams.arguments),t=this.parentController.isEditor(),e=this.parentController.kb_locale(),setTimeout(function(n){return function(){var i,s,r,o,a;for(a=[],i=0,r=(o=["Categories","Answers"]).length;i<r;i++)s=o[i],a.push(n.container.append(new App.KnowledgeBaseReaderListContainer[s]({parent:n.object,isEditor:t,kb_locale:e}).el));return a}}(this),100);this.renderScreenPlaceholder({icon:App.Utils.icon("mood-ok"),detail:__("This category is empty"),action:this.parentController.isEditor()?__("Start Editing"):void 0,actionCallback:(n=this,function(){var t;return t=n.object.uiUrl(n.parentController.kb_locale(),"edit"),n.navigate(t)})})}else this.parentController.renderNotFound()},i.prototype.searchPanelWillStart=function(){return this.container.addClass("hide")},i.prototype.searchPanelDidEnd=function(){return this.container.removeClass("hide")},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseReaderListItem=function(e){function n(){var t;n.__super__.constructor.apply(this,arguments),this.render(),this.el[0].dataset.id=this.item.id,this.listenTo(App.KnowledgeBase,"kb_data_change_loaded",(t=this,function(){return t.render()}))}return t(n,e),n.prototype.tag="li",n.prototype.className="section",n.prototype.render=function(){var t,e;null!==this.sort_order&&this.sort_order!==this.item.position&&App.Delay.set((e=this,function(){return e.parentController.parentRefreshed()}),1e3,"kb_reader_list_resort"),this.sort_order=this.item.position;try{t=this.item.attributesForRendering(this.kb_locale,{isEditor:this.isEditor})}catch(e){e,t={}}return this.el.prop("className").split(" ").filter((function(t){return t.match("kb-item--")})).forEach((function(t){return this.el.removeClass(t)})),this.el.addClass(t.className),this.html(App.view("knowledge_base/_reader_list_item")({item:t,iconset:this.iconset}))},n}(App.Controller)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(t){n.__super__.constructor.apply(this,arguments),t.locale&&(t.selectedSystemLocale=App.Locale.findByAttribute("locale",t.locale),t.selectedSystemLocalePresent=!0),this.authenticateCheckRedirect(),App.TaskManager.execute({key:"KnowledgeBase",controller:"KnowledgeBaseAgentController",params:t,show:!0,persistent:!0})}return e(n,t),n.requiredPermission="knowledge_base.*",n}(App.ControllerPermanent),["/category/:category_id","/answer/:answer_id",""].reduce((function(t,e){return t.concat([e,e+"/:action",e+"/:action/:arguments"])}),[]).forEach((function(e){var n;return n="knowledge_base/:knowledge_base_id/locale/:locale"+e,App.Config.set(n,t,"Routes")})),App.Config.set("knowledge_base",t,"Routes")}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseScheduledWidget=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.el.attr("data-state",this.state),this.el.data("date",this.getDate()),this.render()}return t(n,e),n.prototype.className="scheduled-widget",n.prototype.getDate=function(){var t;if(t=this.object[this.state+"_at"])return new Date(t)},n.prototype.render=function(){return this.html(App.view("knowledge_base/scheduled_widget")({timestamp:App.i18n.translateTimestamp(this.getDate()),state:this.state}))},n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseSearchController=function(e){function n(){var t;n.__super__.constructor.apply(this,arguments),this.html(App.view("knowledge_base/search")({knowledge_base:this.parentController.getKnowledgeBase(),kb_locale:this.parentController.kb_locale()})),this.searchFieldPanel=new App.KnowledgeBaseSearchFieldPanel({el:this.$(".js-searchFieldContainer"),context:this.parentController.getKnowledgeBase(),kb_locale:this.parentController.kb_locale(),return_path:this.parentController.getKnowledgeBase().uiUrl(this.parentController.kb_locale(),"search")}),this.parentController.lastParams.arguments&&(t=decodeURIComponent(this.parentController.lastParams.arguments),this.searchFieldPanel.widget.startSearch(t)),this.searchFieldPanel.widget.focus()}return t(n,e),n}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseSearchFieldPanel=function(n){function i(){this.renderResults=t(this.renderResults,this),this.renderError=t(this.renderError,this),this.widgetWillStartLoading=t(this.widgetWillStartLoading,this),this.widgetDidEnd=t(this.widgetDidEnd,this),this.widgetWillStart=t(this.widgetWillStart,this),this.clear=t(this.clear,this),i.__super__.constructor.apply(this,arguments),this.html(App.view("knowledge_base/search_field_panel")()),this.widget=new App.KnowledgeBaseSearchFieldWidget({el:this.$(".searchfield"),kb_locale:this.kb_locale,context:this.context,willStart:this.widgetWillStart,didEnd:this.widgetDidEnd,willStartLoading:this.widgetWillStartLoading,renderError:this.renderError,renderResults:this.renderResults})}return e(i,n),i.prototype.elements={".js-placeholderEmpty":"emptyPlaceholder",".js-placeholderError":"errorPlaceholder",".js-results":"resultsContainer"},i.prototype.context=void 0,i.prototype.kb_locale=null,i.prototype.willStart=null,i.prototype.didEnd=null,i.prototype.clear=function(){return this.resultsContainer.empty(),this.errorPlaceholder.addClass("hide"),this.emptyPlaceholder.addClass("hide")},i.prototype.widgetWillStart=function(){return"function"==typeof this.willStart?this.willStart():void 0},i.prototype.widgetDidEnd=function(){return this.clear(),"function"==typeof this.didEnd?this.didEnd():void 0},i.prototype.widgetWillStartLoading=function(){return this.clear()},i.prototype.renderError=function(t){return this.errorPlaceholder.removeClass("hide").find(".help-block--inner").text(App.i18n.translateInline(t))},i.prototype.renderResults=function(t,e){var n,i,s;if(this.clear(),0!==t.result.length)return i=this.buildReturnSuffix(e),n=App.Utils.joinUrlComponents(this.return_path,e),s=t.result.map((function(e,s){var r,o,a;return r=t.details[s],o=e.type.replace(/::/g,""),a=App[o].find(e.id),new App.KnowledgeBaseSearchItem({object:a,meta:e,details:r,pathSuffix:i,return_path:n})})).map((function(t){return t.el})),this.resultsContainer.append(s);this.emptyPlaceholder.removeClass("hide")},i.prototype.buildReturnSuffix=function(t){return encodeURIComponent(App.Utils.joinUrlComponents(this.return_path,t))},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseSearchFieldWidget=function(n){function i(){var e;this.onSuccess=t(this.onSuccess,this),this.onError=t(this.onError,this),i.__super__.constructor.apply(this,arguments),this.cache={},this.html(App.view("knowledge_base/search_field_widget")({placeholder_suffix:null!=(e=this.context)?e.guaranteedTitle(this.kb_locale.id):void 0}))}return e(i,n),i.prototype.className="searchfield",i.prototype.elements={".js-searchField":"searchField",".js-emptySearchButton":"emptySearchButton"},i.prototype.events={"input .js-searchField":"input","click .js-emptySearchButton":"clear"},i.prototype.isActive=!1,i.prototype.context=void 0,i.prototype.kb_locale=null,i.prototype.renderError=null,i.prototype.renderResults=null,i.prototype.willStartLoading=null,i.prototype.willStart=null,i.prototype.didEnd=null,i.prototype.clear=function(){return this.searchField.val(""),this.emptySearchButton.addClass("hide"),this.isActive=!1,"function"==typeof this.didEnd?this.didEnd():void 0},i.prototype.input=function(){var t,e;return t=this.searchField.val(),this.emptySearchButton.toggleClass("hide",0===t.length),""===t?(this.abortAjaxCalls(),this.isActive=!1,void("function"==typeof this.didEnd&&this.didEnd())):(this.isActive||(this.isActive=!0,"function"==typeof this.willStart&&this.willStart()),"function"==typeof this.willStartLoading&&this.willStartLoading(),this.searchField.addClass("loading"),this.delay((e=this,function(){return e.makeRequest(t)}),100,"makeRequest"))},i.prototype.data=function(t){var e;return e={query:t,flavor:"agent",knowledge_base_id:this.context.knowledge_base().id,locale:this.kb_locale.systemLocale().locale},this.context instanceof App.KnowledgeBaseCategory&&(e.scope_id=this.context.id),e},i.prototype.url=function(){return App.Utils.joinUrlComponents(App.KnowledgeBase.url,"search")},i.prototype.makeRequest=function(t){var e,n;if(!(e=this.cache[t]))return this.ajax({id:"kb_search_loading",type:"POST",url:this.url(),data:JSON.stringify(this.data(t)),success:(n=this,function(e){return n.cache[t]=e,n.onSuccess(e,t)}),error:this.onError});this.onSuccess(e)},i.prototype.onError=function(t){var e,n,i;if(0!==t.status)return this.searchField.removeClass("loading"),i=(null!=(e=t.responseJSON)?e.error_human:void 0)||(null!=(n=t.responseJSON)?n.errorr:void 0)||__("Loading failed."),this.renderError(i);0===this.ajaxCalls.length&&this.searchField.removeClass("loading")},i.prototype.onSuccess=function(t,e){return this.searchField.removeClass("loading"),App.Collection.loadAssets(t.assets),"function"==typeof this.renderResults?this.renderResults(t,e):void 0},i.prototype.focus=function(){return this.searchField.trigger("focus")},i.prototype.startSearch=function(t){return this.searchField.val(decodeURIComponent(t)).trigger("input")},i
}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseSearchItem=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.render()}return t(n,e),n.prototype.tag="li",n.prototype.className="section",n.prototype.events={"click a":"searchLinkClicked"},n.prototype.data=function(){var t,e,n;return t=this.object.parent().attributesForRendering(App.KnowledgeBaseLocale.localeFor(this.object)),(e=this.details||{}).url=(null!=(n=this.object)?n.uiUrl("search-return/"+this.pathSuffix):void 0)||"#",e.state=t.state,e.iconFont=t.iconFont,e},n.prototype.render=function(){return this.html(App.view("knowledge_base/search_item")({data:this.data(),iconset:this.object.parent().knowledge_base().iconset}))},n.prototype.searchLinkClicked=function(){if(null!=window.history&&null!=this.return_path)return window.history.replaceState(null,null,this.return_path)},n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseServerSnippet=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.head=__("Web Server Configuration"),n.prototype.className="modal modal-knowledge-base-server-snippet",n.prototype.buttonSubmit=!1,n.prototype.initalFormParamsIgnore=!0,n.prototype.servers=[{id:"nginx",name:"Nginx",active:!0},{id:"apache",name:"Apache"}],n.prototype.content=function(){var t,e,n,i;for(t=0,e=(n=this.servers).length;t<e;t++)(i=n[t]).snippet=this.snippets[i.id];return $(App.view("knowledge_base/server_snippet")({address_type:this.address_type,address:this.address,servers:this.servers}))},n}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseSidebar=function(n){function i(){var e;this.update=t(this.update,this),this.rerender=t(this.rerender,this),i.__super__.constructor.apply(this,arguments),this.renderedWidgets=[],this.show(),this.controllerBind("knowledge_base::sidebar::rerender",(e=this,function(){return e.rerender()})),this.listenTo(App.KnowledgeBase,"kb_data_change_loaded",function(t){return function(){return t.rerender(),!0}}(this))}return e(i,n),i.extend(Spine.Events),i.prototype.events={"click .js-content-actions-container a":"contentActionClicked"},i.prototype.rerender=function(){return this.delay((t=this,function(){return t.update()}),300,"rerender");var t},i.prototype.contentActionClicked=function(t){var e,n;return e=function(){switch(t.target.dataset.action){case"delete":return"clickedDelete";case"visibility":return"clickedCanBePublished";case"permissions":return"clickedPermissions"}}(),this.parentController.bodyModal="function"==typeof(n=this.parentController.coordinator)[e]?n[e](this.savedParams):void 0},i.prototype.update=function(){var t,e,n,i,s;for(s=[],e=0,n=(i=this.renderedWidgets).length;e<n;e++)t=i[e],s.push("function"==typeof t.updateIfNeeded?t.updateIfNeeded():void 0);return s},i.prototype.show=function(t,e){var n,i,s,r,o,a;if(i="edit"===e,this.el.toggleClass("hidden",!i),this.savedParams=t,this.savedAction=e,this.el.empty(),i){for(this.renderedWidgets=[],o=[],n=0,s=(r=this.getWidgets(t)).length;n<s;n++)a=new(0,r[n])({object:t,kb_locale:this.parentController.kb_locale(),parentController:this.parentController}),this.renderedWidgets.push(a),o.push(this.el.append(a.el));return o}},i.prototype.hide=function(){return this.el.addClass("hidden")},i.prototype.getWidgets=function(t){var e;return e=[App.KnowledgeBaseSidebarActions],(t instanceof App.KnowledgeBase||t instanceof App.KnowledgeBaseCategory)&&e.push(App.KnowledgeBaseSidebarCategories),t instanceof App.KnowledgeBaseCategory&&e.push(App.KnowledgeBaseSidebarAnswers),t instanceof App.KnowledgeBaseAnswer&&(e.push(App.KnowledgeBaseSidebarLinkedTickets),e.push(App.KnowledgeBaseSidebarAttachments),e.push(App.KnowledgeBaseSidebarTags)),e},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseSidebarGenericList=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.render()}return t(n,e),n.prototype.className="sidebar-block",n.prototype.events={"click .js-reorder":"openReorder","click .js-add":"openAdd"},n.prototype.render=function(){return this.html(App.view("knowledge_base/sidebar/generic_list")(this.templateOptions()))},n.prototype.templateOptions=function(){return{iconset:this.object.knowledge_base().iconset,items:this.items(),urlNew:this.urlNew(),enabled:!0,title:this.title,emptyNote:this.emptyNote}},n.prototype.openReorder=function(t){return t.preventDefault(),t.stopPropagation(),this.parentController.bodyModal=new App.ControllerReorderModal({container:this.parentController.body,items:this.items(),url:this.reorderSaveUrl()})},n.prototype.openAdd=function(t){var e;return t.preventDefault(),t.stopPropagation(),(e=this.newObject()).isFresh=!0,this.parentController.bodyModal=new App.KnowledgeBaseAddForm({object:e,container:this.parentController.body,parentController:this.parentController})},n.prototype.newObject=function(){},n.prototype.reorderSaveUrl=function(){},n.prototype.items=function(){},n.prototype.urlNew=function(){},n.prototype.updateIfNeeded=function(){return this.render()},n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseSidebarActions=function(e){function n(){var t,e,i;n.__super__.constructor.apply(this,arguments),e=(t=null!=(i=this.object)?i.contentSidebarActions(this.kb_locale):void 0)?App.view("knowledge_base/sidebar/actions")({actions:t}):"",this.html(e)}return t(n,e),n.prototype.className="sidebar-block",n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseSidebarAnswers=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.templateName="answers",n.prototype.title=__("Answers"),n.prototype.emptyNote=__("No answers"),n.prototype.urlNew=function(){return"#knowledge_base/"+this.object.knowledge_base().id+"/category/"+this.object.id+"/answers/new"},n.prototype.answers=function(){return this.object.answers()},n.prototype.items=function(){return this.answers().sort((function(t,e){return t.position-e.position})).map((t=this,function(e){return e.attributesForRendering(t.kb_locale,{action:"edit",isEditor:!0})}));var t},n.prototype.reorderSaveUrl=function(){return this.object.generateURL("reorder_answers")},n.prototype.newObject=function(){return new App.KnowledgeBaseAnswer({category_id:this.object.id})},n}(App.KnowledgeBaseSidebarGenericList)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.KnowledgeBaseSidebarAttachments=function(i){function s(){this.onProgress=e(this.onProgress,this),this.onCompleted=e(this.onCompleted,this),this.onAborted=e(this.onAborted,this),this.onStart=e(this.onStart,this),this.onFileAdded=e(this.onFileAdded,this),this.fetch=e(this.fetch,this),this.delete=e(this.delete,this),this.updateIfNeeded=e(this.updateIfNeeded,this),s.__super__.constructor.apply(this,arguments),this.render(),this.listenTo(this.object,"refresh",this.updateIfNeeded)}return n(s,i),s.prototype.className="sidebar-block",s.prototype.events={"click .js-delete":"delete","html5Upload.dropZone.show":"showDropZone","html5Upload.dropZone.hide":"hideDropZone"},s.prototype.elements={".attachmentUpload-progressBar":"progressBar",".js-percentage":"progressText",".attachmentPlaceholder":"attachmentPlaceholder",".attachmentUpload":"attachmentUpload",".js-cancel":"cancelContainer",input:"input",".dropContainer":"dropContainer"},s.prototype.updateIfNeeded=function(){return this.render()},s.prototype.render=function(){return this.html(App.view("knowledge_base/sidebar/attachments")({attachments:this.object.attachments})),html5Upload.initialize({uploadUrl:this.object.generateURL("attachments"),dropContainer:this.el.get(0),cancelContainer:this.cancelContainer,inputField:this.input.get(0),maxSimultaneousUploads:1,key:"file",onFileAdded:this.onFileAdded})},s.prototype.delete=function(e){var n,i;return e.preventDefault(),i=parseInt($(e.currentTarget).attr("data-object-id")),n=this.object.attachments.filter((function(t){return t.id===i}))[0],new t({container:this.container,answer:this.object,attachment:n,parentController:this})},s.prototype.fetch=function(){return this.ajax({id:"attachments_"+this.object.id+"_knowledge_base_answer",type:"GET",url:this.object.generateURL()+"?full=true",processData:!0,success:(t=this,function(e){return App.Collection.loadAssets(e.assets),t.render()})});var t},s.prototype.onFileAdded=function(t){return t.on({onStart:this.onStart,onAborted:this.onAborted,onCompleted:this.onCompleted,onProgress:this.onProgress})},s.prototype.onStart=function(){return this.attachmentPlaceholder.addClass("hide"),this.attachmentUpload.removeClass("hide"),this.cancelContainer.removeClass("hide")},s.prototype.onAborted=function(){return this.attachmentPlaceholder.removeClass("hide"),this.attachmentUpload.addClass("hide"),this.input.val("")},s.prototype.onCompleted=function(t){var e;return this.attachmentPlaceholder.removeClass("hide"),this.attachmentUpload.addClass("hide"),this.progressBar.width(parseInt(0)+"%"),this.progressText.text(""),this.input.val(""),e=JSON.parse(t),App.Collection.loadAssets(e)},s.prototype.onProgress=function(t){if(this.progressBar.width(parseInt(t)+"%"),this.progressText.text(parseInt(t)),parseInt(t)>=90)return this.cancelContainer.addClass("hide")},s.prototype.showDropZone=function(){if(!this.dropContainer.hasClass("is-dropTarget"))return this.dropContainer.addClass("is-dropTarget")},s.prototype.hideDropZone=function(){return this.dropContainer.removeClass("is-dropTarget")},s}(App.Controller),t=function(t){function i(){return this.error=e(this.error,this),this.success=e(this.success,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.buttonClass="btn--danger",i.prototype.content=function(){return App.i18n.translateContent('Do you really want to delete "%s"?',this.attachment.filename)},i.prototype.onSubmit=function(){return this.formDisable(this.el),this.ajax({id:"attachment_delete",type:"DELETE",url:this.answer.generateURL("attachments/"+this.attachment.id),processData:!0,success:this.success,error:this.error})},i.prototype.success=function(t){return this.close(),App.Collection.loadAssets(t),this.parentController.render()},i.prototype.error=function(t){var e;return this.formEnable(this.el),this.showAlert((null!=(e=t.responseJSON)?e.error:void 0)||__("The changes could not be saved."))},i}(App.ControllerConfirm)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseSidebarCategories=function(e){function n(){n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.templateName="categories",n.prototype.title=__("Categories"),n.prototype.emptyNote=__("No categories"),n.prototype.templateOptions=function(){var t;return(t=n.__super__.templateOptions.apply(this,arguments)).isRoot=this.object instanceof App.KnowledgeBase,t},n.prototype.urlNew=function(){var t;return t="#knowledge_base/"+this.object.knowledge_base().id+"/category/",this.object instanceof App.KnowledgeBaseCategory?t+(this.object.id+"/new"):this.object instanceof App.KnowledgeBase?t+"category/new":void 0},n.prototype.categories=function(){return this.object instanceof App.KnowledgeBaseCategory?this.object.children():this.object instanceof App.KnowledgeBase?this.object.rootCategories():[]},n.prototype.items=function(){return this.categories().sort((function(t,e){return t.position-e.position})).map((t=this,function(e){return e.attributesForRendering(t.kb_locale,{action:"edit",isEditor:!0})}));var t},n.prototype.reorderSaveUrl=function(){return this.object instanceof App.KnowledgeBaseCategory?this.object.generateURL("reorder_categories"):this.object.url()+"/categories/reorder_root_categories"},n.prototype.newObject=function(){var t;return t=this.object instanceof App.KnowledgeBaseCategory?this.object:void 0,new App.KnowledgeBaseCategory({parent_id:null!=t?t.id:void 0,knowledge_base_id:this.object.knowledge_base().id})},n}(App.KnowledgeBaseSidebarGenericList)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.KnowledgeBaseSidebarLinkedTickets=function(n){function i(){this.delete=t(this.delete,this),this.clickedAdd=t(this.clickedAdd,this),this.fetch=t(this.fetch,this),this.updateIfNeeded=t(this.updateIfNeeded,this),i.__super__.constructor.apply(this,arguments),this.fetch(),this.render(),this.listenTo(this.object,"refresh",this.updateIfNeeded)}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("Ticket"),i.prototype.className="sidebar-block sidebar-linked-tickets",i.prototype.events={"click .js-add":"clickedAdd","click .js-delete":"delete"},i.prototype.updateIfNeeded=function(){return this.fetch()},i.prototype.render=function(){var t,e;return t=null!=(e=this.localLinks)?e.map((function(t){return App[t.link_object].find(t.link_object_value)})):void 0,this.html(App.view("knowledge_base/sidebar/linked_tickets")({tickets:t,editable:!0})),this.renderPopovers()},i.prototype.fetch=function(){return this.ajax({id:"kb_links_"+this.object.id,type:"GET",url:this.apiPath+"/links",data:{link_object:"KnowledgeBase::Answer::Translation",link_object_value:this.object.translation(this.kb_locale.id).id},processData:!0,success:(t=this,function(e){return t.localLinks=e.links,App.Collection.loadAssets(e.assets),t.render()})});var t},i.prototype.clickedAdd=function(t){var e;return t.preventDefault(),new App.TicketLinkAdd({link_object:"KnowledgeBase::Answer::Translation",link_object_id:null!=(e=this.object.translation(this.kb_locale.id))?e.id:void 0,link_types:[["normal","Normal"]],object:this.object.translation(this.kb_locale.id),parent:this,container:this.el.closest(".content")})},i.prototype.delete=function(t){var e,n;return t.preventDefault(),e={link_type:$(t.currentTarget).data("link-type"),link_object_source:$(t.currentTarget).data("object"),link_object_source_value:$(t.currentTarget).data("object-id"),link_object_target:"KnowledgeBase::Answer::Translation",link_object_target_value:null!=(n=this.object.translation(this.kb_locale.id))?n.id:void 0},this.ajax({id:"links_remove_"+this.object.id+"_"+this.object_type,type:"DELETE",url:this.apiPath+"/links/remove",data:JSON.stringify(e),processData:!0,success:this.fetch})},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseSidebarTags=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.widget=new App.WidgetTag({el:this.el,templateName:"knowledge_base/sidebar/tags",object_type:"KnowledgeBaseAnswer",object:this.object,tags:this.object.tags,editable:!0})}return t(n,e),n.prototype.className="sidebar-block",n.prototype.updateIfNeeded=function(){return this.widget.reload(this.object.tags)},n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KnowledgeBaseVerticalForm=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.form.form.addClass("controls"),this.render()}return t(n,e),n.prototype.elements={".form-item":"container"},n.prototype.render=function(){var t,e;return e=this.form.attributes[0].name,t=_.find(App.Model.attributesGet(!1,this.form.model.configure_attributes),(function(t){return t.name===e})),this.html(App.view("knowledge_base/vertical_form")({attribute:t})),this.container.html(this.form.form)},n}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t,n,s;(this.error=e(this.error,this),this.success=e(this.success,this),this.release=e(this.release,this),i.__super__.constructor.apply(this,arguments),this.Config.get("system_init_done"))?this.Session.get()?this.navigate("#"):(t={},"#session_timeout"===window.location.hash&&(t={errorMessage:App.i18n.translateContent("Due to inactivity, you have been automatically logged out.")}),"#session_invalid"===window.location.hash&&(t={errorMessage:App.i18n.translateContent("The session is no longer valid. Please log in again.")}),this.title(__("Sign in")),!App.Config.get("user_show_password_login")&&this.password_auth_token?(n={token:this.password_auth_token},this.ajax({id:"admin_password_auth_verify",type:"POST",url:this.apiPath+"/users/admin_password_auth_verify",data:JSON.stringify(n),processData:!0,success:(s=this,function(e){return"ok"===e.message?(t.showAdminPasswordLogin=!0,t.username=e.user_login):t.showAdminPasswordLoginFailed=!0,s.render(t),s.navupdate("#login")})})):(this.render(t),this.navupdate("#login")),this.controllerBind("config_update_local",function(t){return function(e){if(e.name.match(/^maintenance/)||e.name.match(/^auth/)||"user_lost_password"===e.name||"user_create_account"===e.name||"product_name"===e.name||"product_logo"===e.name||"fqdn"===e.name||"user_show_password_login"===e.name)return t.render(),"rerender"}}(this)),this.controllerBind("ui:rerender",function(t){return function(){return t.render()}}(this)),this.publicLinksSubscribeId=App.PublicLink.subscribe(function(t){return function(){return t.render()}}(this))):this.navigate("#getting_started")}return n(i,t),i.prototype.events={"submit #login":"login","click .js-go-to-mobile":"goToMobile","click .js-try-another":"clickedTryAnotherTwoFactor","click .js-select-two-factor-method":"clickedAnotherTwoFactor"},i.prototype.className="login",i.prototype.release=function(){if(this.publicLinksSubscribeId)return App.PublicLink.unsubscribe(this.publicLinksSubscribeId)},i.prototype.render=function(t){var e,n,i,s,r;for(i in null==t&&(t={}),n=[],e=App.Config.get("auth_provider_all"))s=e[i],!0!==this.Config.get(s.config)&&"true"!==this.Config.get(s.config)||n.push(s);return r=App.PublicLink.search({filter:{screen:["login"]},sortBy:"prio"}),this.replaceWith(App.view("login")({item:t,logoUrl:this.logoUrl(),auth_providers:n,public_links:r,show_mobile_link:App.MobileDetection.isMobile()||App.MobileDetection.isForcingDesktopView()})),this.$('[name="username"]').val()?this.$('[name="password"]').trigger("focus"):this.$('[name="username"]').trigger("focus"),this.scrollTo()},i.prototype.renderTwoFactor=function(t){var e,n,i;return null==t&&(t={}),this.twoFactorMethod=t.twoFactorMethod,e=App.TwoFactorMethods.methodByKey(this.twoFactorMethod),i=(n=new App["TwoFactorLoginMethod"+e.identifier]({errorMessage:t.errorMessage,loginContext:this,method:e})).render(),this.el.find(".js-form").html(i.form),this.el.find(".js-footer").html(i.footer),this.el.find(".js-form").nextAll().remove(),n.postRender()},i.prototype.renderTwoFactorMethods=function(){var t,e;return t=_.filter(App.TwoFactorMethods.sortedMethods(),(e=this,function(t){return _.includes(e.twoFactorAvailableMethods,t.key)})),this.el.find(".js-form").html(App.view("widget/two_factor_login/try_another_method")({defaultTwoFactorMethod:this.defaultTwoFactorMethod,twoFactorMethods:t,twoFactorHasRecoveryCodes:this.twoFactorHasRecoveryCodes})),this.el.find(".js-footer").html(App.view("widget/two_factor_login/help_text")())},i.prototype.login=function(t){var e;return t.preventDefault(),t.stopPropagation(),this.formDisable(t),e=this.formParam(t.target),this.formPayload=_.pick(e,["username","password","remember_me"]),App.Auth.login({data:e,success:this.success,error:this.error})},i.prototype.success=function(){return this.log("notice","REDIRECT to -#/-"),this.navigate("#/")},i.prototype.error=function(t){var e,n,i,s,r;return i=t.responseText,n={},_.isEmpty(i)||(n=JSON.parse(i)),s=App.i18n.translateContent(n.error||"Could not process your request"),(e=n.two_factor_required)?(this.defaultTwoFactorMethod=e.default_two_factor_authentication_method,this.twoFactorAvailableMethods=e.available_two_factor_authentication_methods,this.twoFactorHasRecoveryCodes=e.recovery_codes_available,this.twoFactorAvailableAnotherMethod=e.available_two_factor_authentication_methods.length>1||e.recovery_codes_available&&e.available_two_factor_authentication_methods.length>0,void this.renderTwoFactor({twoFactorMethod:this.defaultTwoFactorMethod,twoFactorAvailableMethods:this.twoFactorAvailableMethods})):(this.twoFactorMethod?this.renderTwoFactor({twoFactorMethod:this.twoFactorMethod,errorMessage:s}):this.render({errorMessage:s}),this.delay((r=this,function(){return r.shake(r.$(".hero-unit"))}),600))},i.prototype.clickedTryAnotherTwoFactor=function(t){return this.preventDefaultAndStopPropagation(t),this.renderTwoFactorMethods()},i.prototype.clickedAnotherTwoFactor=function(t){var e;return this.preventDefaultAndStopPropagation(t),e=t.target.dataset.method,this.renderTwoFactor({twoFactorMethod:e,twoFactorAvailableMethods:this.twoFactorAvailableMethods})},i.prototype.goToMobile=function(t){return this.preventDefaultAndStopPropagation(t),App.MobileDetection.redirectToMobile()},i}(App.ControllerFullPage),App.Config.set("login",t,"Routes"),App.Config.set("login/admin/:password_auth_token",t,"Routes"),App.Config.set("session_timeout",t,"Routes"),App.Config.set("session_invalid",t,"Routes")}.call(this),function(){var t;t=function(){function t(){App.Auth.logout()}return t}(),App.Config.set("logout",t,"Routes"),App.Config.set("Logout",{prio:1800,parent:"#current_user",name:__("Sign out"),translate:!0,target:"#logout",divider:!0,iconClass:"signout"},"NavBarRight")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"Macro",defaultSortBy:"name",pageData:{home:"macros",object:__("Macro"),objects:__("Macros"),pagerAjax:!0,pagerBaseUrl:"#manage/macros/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#macros",notes:[__("Text modules are \u2026")],buttons:[{name:__("New Macro"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content")})}return n(i,t),i.requiredPermission="admin.macro",i.prototype.header=__("Macros"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i}(App.ControllerSubContent),App.Config.set("Macros",{prio:2310,name:__("Macros"),parent:"#manage",target:"#manage/macros",controller:t,permission:["admin.macro"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.updateMessage=e(this.updateMessage,this),this.setLogin=e(this.setLogin,this),this.setMode=e(this.setMode,this),this.render=e(this.render,this),this.release=e(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.Setting.subscribe(this.render,{initFetch:!0,clear:!1})}return n(i,t),i.requiredPermission="admin.maintenance",i.prototype.header=__("Maintenance"),i.prototype.events={"change .js-modeSetting input":"setMode","change .js-loginSetting input":"setLogin","blur .js-Login":"updateMessage","submit .js-Message":"sendMessage"},i.prototype.elements={".js-modeSetting input":"modeSetting",".js-loginSetting input":"loginSetting"},i.prototype.release=function(){return App.Setting.unsubscribe(this.subscribeId)},i.prototype.render=function(){var t;return(t=$(App.view("maintenance")())).find(".js-loginPreview").html(App.view("generic/login_preview")({logoUrl:this.logoUrl(),logoChange:!1,maintananceChange:!0})),t.find(".js-textarea").ce({mode:"richtext",multiline:!0,maxlength:2e4}),this.html(t)},i.prototype.setMode=function(){var t,e,n;return t=function(){return App.Setting.set("maintenance_mode",e,{done:function(){return App.WebSocket.send({event:"maintenance",data:{type:"mode",on:e}})}})},(e=this.modeSetting.prop("checked"))?(new App.ControllerConfirm({message:__("Are you sure?"),callback:t,onCancel:(n=this,function(){return n.modeSetting.prop("checked",!1)}),container:this.el.closest(".content")}),e):t()},i.prototype.setLogin=function(){var t;return t=this.loginSetting.prop("checked"),App.Setting.set("maintenance_login",t)},i.prototype.updateMessage=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),App.Setting.set("maintenance_login_message",e.message),this.notify({type:"success",msg:App.i18n.translateContent("Update successful."),removeAll:!0})},i.prototype.sendMessage=function(t){var e;return t.preventDefault(),(e=this.formParam(t.target)).type="message",App.WebSocket.send({event:"maintenance",data:e}),this.notify({type:"success",msg:App.i18n.translateContent("Sent successfully!"),removeAll:!0}),this.render()},i}(App.ControllerSubContent),App.Config.set("Maintenance",{prio:3600,name:__("Maintenance"),parent:"#system",target:"#system/maintenance",controller:t,permission:["admin.maintenance"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Manage=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.authenticateRequired=!0,n.prototype.configKey="NavBarAdmin",n}(App.ControllerNavSidbar),t=function(t){function n(t){n.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),App.TaskManager.execute({key:"Manage",controller:"Manage",params:t,show:!0,persistent:!0})}return e(n,t),n.requiredPermission=["admin.*"],n}(App.ControllerPermanent),App.Config.set("manage",t,"Routes"),App.Config.set("manage/:target",t,"Routes"),App.Config.set("manage/:target/:page",t,"Routes"),App.Config.set("settings/:target",t,"Routes"),App.Config.set("channels/:target",t,"Routes"),App.Config.set("channels/:target/error/:error_code",t,"Routes"),App.Config.set("channels/:target/:channel_id",t,"Routes"),App.Config.set("system/:target",t,"Routes"),App.Config.set("system/:target/:integration",t,"Routes"),App.Config.set("system/:target/:integration/error/:error_code",t,"Routes"),App.Config.set("system/:target/:integration/success/:success_code",t,"Routes"),App.Config.set("Manage",{prio:1e3,name:__("Manage"),target:"#manage",permission:["admin.*"]},"NavBarAdmin"),App.Config.set("Channels",{prio:2500,name:__("Channels"),target:"#channels",permission:["admin.*"]},"NavBarAdmin"),App.Config.set("Settings",{prio:7e3,name:__("Settings"),target:"#settings",permission:["admin.*"]},"NavBarAdmin"),App.Config.set("System",{prio:8e3,name:__("System"),target:"#system",permission:["admin.*"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.restartFailedJobs=e(this.restartFailedJobs,this),this.resetToken=e(this.resetToken,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.load(),this.interval((t=this,function(){return t.load()}),35e3)}return n(i,t),i.requiredPermission="admin.monitoring",i.prototype.header=__("Monitoring"),i.prototype.events={"click .js-resetToken":"resetToken","click .js-select":"selectAll","click .js-restartFailedJobs":"restartFailedJobs"},i.prototype.load=function(){return this.startLoading(),this.ajax({id:"health_check",type:"GET",url:this.apiPath+"/monitoring/health_check",success:(t=this,function(e){if(t.stopLoading(),!t.data||e.token!==t.data.token||e.healthy!==t.data.healthy||e.message!==t.data.message)return t.data=e,t.render()})});var t},i.prototype.render=function(){return this.html(App.view("monitoring")({data:this.data}))},i.prototype.resetToken=function(t){return t.preventDefault(),this.formDisable(t),this.ajax({id:"health_check_token",type:"POST",url:this.apiPath+"/monitoring/token",success:(e=this,function(){return e.load()})});var e},i.prototype.restartFailedJobs=function(t){return t.preventDefault(),this.ajax({id:"restart_failed_jobs_request",type:"POST",url:this.apiPath+"/monitoring/restart_failed_jobs",success:(e=this,function(){return e.load()})});var e},i}(App.ControllerSubContent),App.Config.set("Monitoring",{prio:3600,name:__("Monitoring"),parent:"#system",target:"#system/monitoring",controller:t,permission:["admin.monitoring"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i,s,r,o,a,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function n(){this.constructor=t}for(var i in e)u.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=function(t,e){var n,i,s;return s=[],n=[],i=[],$(t.target).closest(".modal").find(".js-treeTable .js-key").each((function(){var t,e,r,o,a,l,c,u,p;if(t=$(this),a=parseInt(t.attr("level")),o={name:l=t.val().trim()},0===a?s.push(o):n[a-1]?((e=n[a-1]).children||(e.children=[]),n[a-1].children.push(o)):console.log("ERROR",o),p=[],a>0)for(c=r=0,u=a-1;0<=u?r<=u:r>=u;c=0<=u?++r:--r)p.push(i[c]);return p.push(l),o.value=p.join("::"),n[a]=o,i=p})),s[0]&&(e.data_option||(e.data_option={}),e.data_option.options=s),e},r=function(t){return t.data_type&&"multiselect"===t.data_type?("string"==typeof t.data_option.default&&(t.data_option.default=new Array(t.data_option.default)),t):t},o=function(t){var e;if(e=t.find("select[name=data_type]").val(),/^((multi)?select|multi_tree_select)$/.test(e)||"boolean"===e)return t.find(".js-value, .js-valueTrue, .js-valueFalse").each((function(){var t,e;return!!(t=$(this)).val()||(t.hasClass("js-valueTrue")||t.hasClass("js-valueFalse")?t.val(t.attr("placeholder")):(e=t.closest("tr").find(".js-key").val(),t.val(e)))}))},s=function(t,e){var n,i;return i=t.target,e.data_option&&"on"===e.data_option.customsort?(n=[],$(i).closest(".modal").find("table.js-Table tr.input-data-row").each((function(){var t,e,i;return e=(t=$(this)).find("input.js-value").val().trim(),i=t.find("input.js-key").val().trim(),n.push({name:e,value:i})})),e.data_option.options=n,e):e},i=function(t){function n(){var t;this.build=l(this.build,this),n.__super__.constructor.apply(this,arguments),this.startLoading(),this.ajax({id:"object_manager_attributes_list",type:"GET",url:this.apiPath+"/object_manager_attributes_list",processData:!0,success:(t=this,function(e){return t.stopLoading(),t.build(e.objects)})})}return c(n,t),n.requiredPermission="admin.object",n.prototype.build=function(t){
return App.ObjectManagerAttribute.fetchFull((n=this,function(){var i,s,r,o;for(n.tabs=[],i=0,r=t.length;i<r;i++)s={name:o=t[i],target:"c-"+o,controller:e,params:{object:o}},n.tabs.push(s);return n.render()}));var n},n}(App.ControllerTabs),e=function(e){function i(){this.edit=l(this.edit,this),this.new=l(this.new,this),this.render=l(this.render,this),this.release=l(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.ObjectManagerAttribute.subscribe(this.render),this.render()}return c(i,e),i.prototype.header=__("Object Manager"),i.prototype.events={"click .js-delete":"destroy","click .js-new":"new","click .js-edit":"edit","click .js-discard":"discard","click .js-execute":"execute"},i.prototype.release=function(){if(this.subscribeId)return App.ObjectManagerAttribute.unsubscribe(this.subscribeId)},i.prototype.render=function(){var t,e,n,i,s,r;for(n=App.ObjectManagerAttribute.search({filter:{object:this.object},sortBy:"position"}),i=[],t=0,s=(r=App.ObjectManagerAttribute.search({sortBy:"object"})).length;t<s;t++)!0!==(e=r[t]).to_create&&!0!==e.to_delete&&!0!==e.to_migrate&&!0!==e.to_config||i.push(e);return this.html(App.view("object_manager/index")({head:this.object,items:n,itemsToChange:i}))},i.prototype.new=function(t){return t.preventDefault(),new n({pageData:{head:this.object,title:__("Attribute"),home:"object_manager",object:"ObjectManagerAttribute",objects:"ObjectManagerAttributes",navupdate:"#object_manager"},genericObject:"ObjectManagerAttribute",container:this.el.closest(".content"),item:{object:this.object}})},i.prototype.edit=function(e){var n;return e.preventDefault(),n=$(e.target).closest("tr").data("id"),new t({pageData:{head:this.object,title:__("Attribute"),home:"object_manager",object:"ObjectManagerAttribute",objects:"ObjectManagerAttributes",navupdate:"#object_manager"},genericObject:"ObjectManagerAttribute",container:this.el.closest(".content"),callback:this.render,id:n})},i.prototype.destroy=function(t){var e,n,i;return t.stopPropagation(),t.preventDefault(),e=$(t.target).closest("tr").data("id"),App.ObjectManagerAttribute.find(e),n=this,this.ajax({id:"object_manager_attributes/"+e,type:"DELETE",url:this.apiPath+"/object_manager_attributes/"+e,success:(i=this,function(){return i.render()}),error:function(t){return n.log("errors"),alert(t.responseJSON.error)}})},i.prototype.discard=function(t){return t.preventDefault(),this.ajax({id:"object_manager_attributes_discard_changes",type:"POST",url:this.apiPath+"/object_manager_attributes_discard_changes",success:(e=this,function(){return e.render()})});var e},i.prototype.execute=function(t){return t.preventDefault(),this.ajax({id:"object_manager_attributes_execute_migrations",type:"POST",url:this.apiPath+"/object_manager_attributes_execute_migrations",success:(e=this,function(){return e.render()})});var e},i}(App.ControllerSubContent),n=function(t){function e(){return this.onSubmit=l(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.onSubmit=function(t){var e,n,i,l,c,u;if(o(this.el),i=this.formParam(t.target),i=a(t,i),i=r(i),(i=s(t,i)).screens&&i.screens.create_middle)for(c in l=i.screens.create_middle)l[c].item_class="column";return i.object=this.pageData.head,(n=new App[this.genericObject]).load(i),(e=n.validate())?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),u=this,n.save({done:function(){var t;return u.callback&&(t=App[u.genericObject].fullLocal(this.id),u.callback(t)),u.close()},fail:function(e,n){return u.log("errors",n),u.formEnable(t),u.controller.showAlert(n.error_human||n.error||__("The object could not be created."))}}))},e}(App.ControllerGenericNew),t=function(t){function e(){return this.onSubmit=l(this.onSubmit,this),this.content=l(this.content,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.content=function(){var t,e,n,i;for(this.item=App[this.genericObject].find(this.id),this.head=this.pageData.head||this.pageData.object,n=0,i=(e=clone(App[this.genericObject].configure_attributes)).length;n<i;n++)"name"===(t=e[n]).name&&(t.disabled=!0);return this.controller=new App.ControllerForm({model:{configure_attributes:e},params:this.item,screen:this.screen||"edit",autofocus:!0}),this.controller.form},e.prototype.onSubmit=function(t){var e,n,i,l,c;if(o(this.el),n=this.formParam(t.target),n=a(t,n),n=r(n),(n=s(t,n)).screens&&n.screens.create_middle)for(l in i=n.screens.create_middle)i[l].item_class="column";return n.object=this.pageData.head,this.item.load(n),(e=this.item.validate({controllerForm:this.controller}))?(this.log("error",e),this.formValidate({form:t.target,errors:e}),!1):(this.formDisable(t),c=this,this.item.save({done:function(){var t;return c.callback&&(t=App[c.genericObject].fullLocal(this.id),c.callback(t)),c.close()},fail:function(e,n){return c.log("errors"),c.formEnable(t),c.controller.showAlert(n.error_human||n.error||__("The object could not be updated."))}}))},e}(App.ControllerGenericEdit),App.Config.set("SystemObject",{prio:1700,parent:"#system",name:__("Objects"),target:"#system/object_manager",controller:i,permission:["admin.object"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"Organization",importCallback:function(){return new App.Import({baseUrl:"/api/v1/organizations",container:this.el.closest(".content")})},defaultSortBy:"name",pageData:{home:"organizations",object:__("Organization"),objects:__("Organizations"),pagerAjax:!0,pagerBaseUrl:"#manage/organizations/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#organizations",notes:[__("Agent and customer users can be grouped into organizations.")],buttons:[{name:__("Import"),"data-type":"import",class:"btn"},{name:__("New Organization"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content")})}return n(i,t),i.requiredPermission="admin.organization",i.prototype.header=__("Organizations"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i}(App.ControllerSubContent),App.Config.set("Organization",{prio:2e3,name:__("Organizations"),parent:"#manage",target:"#manage/organizations",controller:t,permission:["admin.organization"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.OrganizationHistory=function(n){function i(){return this.fetch=t(this.fetch,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.fetch=function(){return this.ajax({id:"organization_history",type:"GET",url:this.apiPath+"/organizations/history/"+this.organization_id,success:(t=this,function(e){return App.Collection.loadAssets(e.assets),t.items=e.history,t.render()})});var t},i}(App.GenericHistory)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.OrganizationProfile=function(t){function i(t){this.currentPosition=e(this.currentPosition,this),this.setPosition=e(this.setPosition,this),this.render=e(this.render,this),this.show=e(this.show,this),this.url=e(this.url,this),this.meta=e(this.meta,this),i.__super__.constructor.apply(this,arguments),App.Organization.full(this.organization_id,this.render)}return n(i,t),i.prototype.meta=function(){var t,e,n;return e={url:this.url(),id:this.organization_id},App.Organization.exists(this.organization_id)&&(t=(n=App.Organization.find(this.organization_id)).icon(),!1===n.active&&(t="inactive-"+t),e.head=n.displayName(),e.title=n.displayName(),e.iconClass=t,e.active=n.active),e},i.prototype.url=function(){return"#organization/profile/"+this.organization_id},i.prototype.show=function(){return App.OnlineNotification.seen("Organization",this.organization_id),this.navupdate({url:"#",type:"menu"})},i.prototype.changed=function(){return!1},i.prototype.render=function(t){var e;return this.doNotLog||(this.doNotLog=1,this.recentView("Organization",this.organization_id)),e=$(App.view("organization_profile/index")({organization:t})),new App.OrganizationProfileOrganization({object_id:t.id,el:e.find(".js-name")}),new App.OrganizationProfileObject({el:e.find(".js-object-container"),object_id:t.id,taskKey:this.taskKey}),new App.OrganizationProfileActionRow({el:e.find(".js-action"),object_id:t.id}),new App.OrganizationProfileOrganizationAvatar({el:e.find(".js-organization-avatar"),object_id:t.id}),new App.TicketStats({el:e.find(".js-ticket-stats"),organization:t}),this.html(e),new App.UpdateTastbar({genericObject:t})},i.prototype.setPosition=function(t){return this.$(".profile").scrollTop(t)},i.prototype.currentPosition=function(){return this.$(".profile").scrollTop()},i}(App.Controller),t=function(t){function e(t){var n;e.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),n={organization_id:t.organization_id},App.TaskManager.execute({key:"Organization-"+this.organization_id,controller:"OrganizationProfile",params:n,show:!0})}return n(e,t),e.requiredPermission=["ticket.agent","admin.organization"],e}(App.ControllerPermanent),App.Config.set("organization/profile/:organization_id",t,"Routes")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.OrganizationProfileActionRow=function(n){function i(){return this.actions=t(this.actions,this),this.editOrganization=t(this.editOrganization,this),this.showHistory=t(this.showHistory,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="Organization",i.prototype.observe={member_ids:!0},i.prototype.showHistory=function(t){return new App.OrganizationHistory({organization_id:t.id,container:this.el.closest(".content")})},i.prototype.editOrganization=function(t){return new App.ControllerGenericEdit({id:t.id,genericObject:"Organization",screen:"edit",pageData:{title:__("Organizations"),object:__("Organization"),objects:__("Organizations")},container:this.el.closest(".content")})},i.prototype.actions=function(t){var e;return e=[{name:"history",title:__("History"),callback:this.showHistory}],t.isAccessibleBy(App.User.current(),"change")&&e.unshift({name:"edit",title:__("Edit"),callback:this.editOrganization}),e},i}(App.ControllerObserverActionRow)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.OrganizationProfileMember=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("User"),i.prototype.model="User",i.prototype.observe={firstname:!0,lastname:!0,login:!0,email:!0,active:!0,image:!0},i.prototype.globalRerender=!1,i.prototype.render=function(t){return this.html(App.view("organization_profile/member")({user:t})),this.renderPopovers()},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.OrganizationProfileObject=function(n){function i(){return this.update=t(this.update,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.memberLimit=10,i.prototype.model="Organization",i.prototype.observe={member_ids:!0},i.prototype.observeNot={cid:!0,created_at:!0,created_by_id:!0,updated_at:!0,updated_by_id:!0,preferences:!0,source:!0,image_source:!0},i.prototype.events={"click .js-showMoreMembers":"showMoreMembers","focusout [contenteditable]":"update"},i.prototype.showMoreMembers=function(t){return this.preventDefaultAndStopPropagation(t),this.memberLimit=100*(parseInt(this.memberLimit/100)+1),this.renderMembers()},i.prototype.renderMembers=function(){var t;return t=this.el,this.organization.members(0,this.memberLimit,(function(e){var n,i,s,r,o;for(r=[],i=0,s=e.length;i<s;i++)o=e[i],n=$("<div></div>"),new App.OrganizationProfileMember({object_id:o.id,el:n}),r.push(n);return t.find(".js-userList").html(r)})),this.organization.member_ids.length<=this.memberLimit?this.el.find(".js-showMoreMembers").parent().addClass("hidden"):this.el.find(".js-showMoreMembers").parent().removeClass("hidden")},i.prototype.render=function(t){var e,n,i,s,r,o,a;for(n in t&&(this.organization=t),App.TaskManager.touch(this.taskKey),o=[],a=App.Organization.attributesGet("view"))e=a[n],(r=(s=n).substr(0,s.length-3))in this.organization&&(s=r),"name"!==s&&e.shown&&(null!=this.organization[s]&&""!==this.organization[s]||"richtext"===e.tag)&&o.push(e);return i=$(App.view("organization_profile/object")({organization:this.organization,organizationData:o})),this.html(i),this.renderMembers(),this.$("[contenteditable]").ce({mode:"textonly",multiline:!0,maxlength:250})},i.prototype.update=function(t){var e,n,i,s;if(n=$(t.target).attr("data-name"),s=$(t.target).html(),(i=App.Organization.find(this.object_id))[n]!==s)return this.lastAttributes[n]=s,(e={})[n]=s,i.updateAttributes(e),this.log("debug","update",n,s,i)},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.OrganizationProfileOrganization=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="Organization",i.prototype.observe={name:!0},i.prototype.render=function(t){return this.html(App.Utils.htmlEscape(t.displayName()))},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.OrganizationProfileOrganizationAvatar=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="Organization",i.prototype.observe={active:!0,vip:!0},i.prototype.render=function(t){return this.html(t.avatar("80"))},i}(App.ControllerObserver)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t,e,i,s,r;for(n.__super__.constructor.apply(this,arguments),e=0,i=(s=App.Overview.configure_attributes).length;e<i;e++)"group_by"===(t=s[e]).name&&(t.options=App.Overview.groupByAttributes());this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"Overview",defaultSortBy:"prio",pageData:{home:"overviews",object:__("Overview"),objects:__("Overviews"),navupdate:"#overviews",notes:[__("Overviews are \u2026")],buttons:[{name:__("New Overview"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content"),veryLarge:!0,dndCallback:(r=this,function(t,e){var n,i,s,o,a,l;for(l=[],a=0,s=0,o=(i=r.el.find("table > tbody > tr")).length;s<o;s++)e=i[s],a+=1,n=$(e).data("id"),l.push([n,a]);return r.ajax({id:"overview_prio",type:"POST",url:r.apiPath+"/overviews_prio",processData:!0,data:JSON.stringify({prios:l})})})})}return e(n,t),n.requiredPermission="admin.overview",n.prototype.header=__("Overviews"),n}(App.ControllerSubContent),App.Config.set("Overview",{prio:2300,name:__("Overviews"),parent:"#manage",target:"#manage/overviews",controller:t,permission:["admin.overview"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.load()}return e(n,t),n.requiredPermission="admin.package",n.prototype.header=__("Packages"),n.prototype.elements={".js-fileUpload":"fileUpload",".js-submit":"packageSubmit"},n.prototype.events={"change .js-fileUpload":"selectFile",'click .package-action[data-type="uninstall"]':"action"},n.prototype.load=function(){return this.ajax({id:"packages",type:"GET",url:this.apiPath+"/packages",processData:!0,success:(t=this,function(e){return t.packages=e.packages,t.package_installation=e.package_installation,t.local_gemfiles=e.local_gemfiles,t.render()})});var t},n.prototype.render=function(){var t,e,n,i;for(t=0,n=(i=this.packages).length;t<n;t++)(e=i[t]).action=[],"installed"===e.state?e.action=["uninstall"]:"uninstalled"===e.state?e.action=["install"]:"deactivate"===e.state&&(e.action=["uninstall","activate"]);return this.html(App.view("package")({head:__("Dashboard"),packages:this.packages,package_installation:this.package_installation,local_gemfiles:this.local_gemfiles}))},n.prototype.action=function(t){var e,n;return t.preventDefault(),e=$(t.target).parents("[data-id]").data("id"),new App.ControllerConfirmDelete({fieldDisplay:App.i18n.translatePlain('There is no rollback of this deletion. If you are sure that you wish to proceed, please type "%s" into the input. All related data to this package will be lost.',App.i18n.translatePlain("Delete")),callback:(n=this,function(t){return n.ajax({id:"packages",type:"DELETE",url:n.apiPath+"/packages",data:JSON.stringify({id:e}),processData:!1,success:function(){return t.close(),n.load()}})})})},n.prototype.selectFile=function(){return _.isEmpty(this.fileUpload.val())?this.packageSubmit.prop("disabled",!0):this.packageSubmit.prop("disabled",!1)},n}(App.ControllerSubContent),App.Config.set("Packages",{prio:3700,name:__("Packages"),parent:"#system",target:"#system/package",controller:t,permission:["admin.package"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;(this.success=e(this.success,this),this.release=e(this.release,this),i.__super__.constructor.apply(this,arguments),this.Config.get("user_lost_password"))?this.authenticateCheck()?this.navigate("#"):(this.title(__("Reset Password")),this.navupdate("#password_reset"),this.publicLinksSubscribeId=App.PublicLink.subscribe((t=this,function(){return t.render()})),this.render()):this.navigate("#")}return n(i,t),i.prototype.events={"submit form":"submit","click .submit":"submit","click .retry":"retry"},i.prototype.forceRender=!0,i.prototype.className="reset_password",i.prototype.release=function(){if(this.publicLinksSubscribeId)return App.PublicLink.unsubscribe(this.publicLinksSubscribeId)},i.prototype.render=function(t){var e;return null==t&&(t={}),e=[{name:"username",display:__("Enter your username or email address"),tag:"input",type:"text",limit:100,null:!1,class:"input span4"}],t.public_links=App.PublicLink.search({filter:{screen:["password_reset"]},sortBy:"prio"}),this.replaceWith(App.view("password/reset")(t)),this.form=new App.ControllerForm({el:this.el.find(".js-password"),model:{configure_attributes:e},autofocus:!0})},i.prototype.retry=function(t){return t.preventDefault(),this.render()},i.prototype.submit=function(t){var e;return t.preventDefault(),e=this.formParam(t.target),this.formDisable(t),this.ajax({id:"password_reset",type:"POST",url:this.apiPath+"/users/password_reset",data:JSON.stringify(e),processData:!0,success:this.success})},i.prototype.success=function(){var t;return t=App.PublicLink.search({filter:{screen:["password_reset"]},sortBy:"prio"}),this.html(App.view("password/reset_sent")({public_links:t}))},i}(App.ControllerFullPage),App.Config.set("password_reset",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;(this.renderChanged=e(this.renderChanged,this),this.renderChange=e(this.renderChange,this),this.release=e(this.release,this),i.__super__.constructor.apply(this,arguments),this.Config.get("user_lost_password"))?this.authenticateCheck()?this.navigate("#"):(this.title(__("Reset Password")),this.navupdate("#password_reset_verify"),this.publicLinksSubscribeId=App.PublicLink.subscribe((t=this,function(){return t.verify_token()})),this.verify_token()):this.navigate("#")}return n(i,t),i.prototype.events={"submit form":"submit","click .submit":"submit"},i.prototype.forceRender=!0,i.prototype.className="reset_password",i.prototype.release=function(){if(this.publicLinksSubscribeId)return App.PublicLink.unsubscribe(this.publicLinksSubscribeId)},i.prototype.renderChange=function(t){var e,n;return n=App.PublicLink.search({filter:{screen:["password_reset"]},sortBy:"prio"}),"ok"===t.message?(e=[{name:"password",display:__("Password"),tag:"input",type:"password",limit:100,null:!1,class:"input"}],this.replaceWith(App.view("password/reset_change")({public_links:n})),new App.ControllerForm({el:this.el.find(".js-password"),model:{configure_attributes:e},autofocus:!0})):this.replaceWith(App.view("password/reset_failed")({head:__("Reset Password failed!"),message:__("Token is invalid!"),public_links:n}))},i.prototype.submit=function(t){var e;return t.preventDefault(),(e=this.formParam(t.target)).token=this.token,this.password=e.password,this.formDisable(t),e.password_confirm!==e.password?(this.formEnable(t),this.$("[name=password]").val(""),this.$("[name=password_confirm]").val(""),void this.notify({type:"error",msg:__("Can't update password, your entered passwords do not match. Please try again!"),removeAll:!0})):e.password?this.ajax({id:"password_reset_verify",type:"POST",url:this.apiPath+"/users/password_reset_verify",data:JSON.stringify(e),processData:!0,success:this.renderChanged}):(this.formEnable(t),void this.notify({type:"error",msg:__("Please supply your new password!"),removeAll:!0}))},i.prototype.renderChanged=function(t){return"ok"===t.message?App.Auth.login({data:{username:t.user_login,password:this.password},success:(e=this,function(){return App.Auth.loginCheck(),e.notify({type:"success",msg:__("Woo hoo! Your password has been changed!"),removeAll:!0}),e.navigate("#")}),error:function(t){return function(){return t.formEnable(t.$("form")),t.notify({type:"error",msg:__("Something went wrong. Please contact your administrator."),removeAll:!0})}}(this)}):(t.notice?this.notify({type:"error",msg:App.i18n.translateContent(t.notice[0],t.notice[1]),removeAll:!0}):this.notify({type:"error",msg:__("The password could not be set. Please contact your administrator."),removeAll:!0}),this.formEnable(this.$("form")));var e},i.prototype.verify_token=function(){var t;return t={token:this.token},this.ajax({id:"password_reset_verify",type:"POST",url:this.apiPath+"/users/password_reset_verify",data:JSON.stringify(t),processData:!0,success:this.renderChange})},i}(App.ControllerFullPage),App.Config.set("password_reset_verify/:token",t,"Routes")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Profile=function(t){function n(t){var e;n.__super__.constructor.apply(this,arguments),this.controllerBind("config_update",(e=this,function(n){if("api_token_access"===n.name)return e.render(!0),e.updateNavigation(!0,t)}))}return e(n,t),n.prototype.authenticateRequired=!0,n.prototype.configKey="NavBarProfile",n}(App.ControllerNavSidbar),t=function(t){function n(t){n.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),App.TaskManager.execute({key:"Profile",controller:"Profile",params:t,show:!0,persistent:!0})}return e(n,t),n.requiredPermission=["user_preferences.*"],n}(App.ControllerPermanent),App.Config.set("profile",t,"Routes"),App.Config.set("profile/:target",t,"Routes"),App.Config.set("Profile",{prio:1e3,name:__("Profile"),target:"#profile"},"NavBarProfile"),App.Config.set("Profile",{prio:1700,parent:"#current_user",name:__("Profile"),target:"#profile",permission:["user_preferences.*"],translate:!0},"NavBarRight")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t;n.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"PublicLink",defaultSortBy:"prio",pageData:{home:"public_links",object:__("Public Link"),objects:__("Public Links"),navupdate:"#public_links",notes:[__("Public Links are \u2026")],buttons:[{name:__("New Public Link"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content"),veryLarge:!0,dndCallback:(t=this,function(e,n){var i,s,r,o,a,l;for(l=[],a=0,i=0,o=(r=t.el.find("table > tbody > tr")).length;i<o;i++)n=r[i],a+=1,s=$(n).data("id"),l.push([s,a]);return t.ajax({id:"public_links_prio",type:"POST",url:t.apiPath+"/public_links_prio",processData:!0,data:JSON.stringify({prios:l})})})})}return e(n,t),n.requiredPermission="admin.public_link",n.prototype.header=__("Public Links"),n}(App.ControllerSubContent),App.Config.set("Public Links",{prio:3325,name:__("Public Links"),parent:"#manage",target:"#manage/public_links",controller:t,permission:["admin.public_links"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i,s,r,o=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var i in e)l.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;n=function(t){function n(){var t;this.render=o(this.render,this),this.storeParams=o(this.storeParams,this),this.getParams=o(this.getParams,this),n.__super__.constructor.apply(this,arguments),this.title(__("Reporting")),this.navupdate("#report"),this.startLoading(),this.ajax({type:"GET",url:this.apiPath+"/reports/config",processData:!0,success:(t=this,function(e){if(t.stopLoading(),!e.error)return t.config=e.config,App.Collection.load({type:"ReportProfile",data:e.profiles}),t.render();t.renderScreenError({detail:e.error,objectName:"Report"})})})}return a(n,t),n.requiredPermission="report",n.prototype.getParams=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v;if(this.params)return this.params;if(this.params={},h=App.SessionStorage.get("report::params"))return this.params=h,this.params;if(this.params.timeRange="year",i=(n=new Date).getDate(),s=n.getMonth()+1,o=n.getFullYear(),r=n.getWeek(),this.params.day=i,this.params.month=s,this.params.week=r,this.params.year=o,!this.params.metric)for(c in f=this.config.metric)(e=f[c]).default&&(this.params.metric=e.name);if(!this.params.backendSelected)for(c in this.params.backendSelected={},m=this.config.metric)for(a=0,u=(g=(e=m[c]).backend).length;a<u;a++)(t=g[a]).selected&&(this.params.backendSelected[t.name]=!0);if(!this.params.profileSelected)for(this.params.profileSelected={},l=0,p=(v=App.ReportProfile.all()).length;l<p;l++)d=v[l],_.isEmpty(this.params.profileSelected)&&(this.params.profileSelected[d.id]=!0);return this.params},n.prototype.storeParams=function(){return App.SessionStorage.set("report::params",this.params)},n.prototype.render=function(t){return null==t&&(t={}),this.params=this.getParams(),this.html(App.view("report/main")({params:this.params})),new r({el:this.el.find(".js-timeRangePicker"),params:this.params,ui:this}),new s({el:this.el.find(".js-timePicker"),params:this.params,ui:this}),new i({el:this.el.find(".js-aside"),config:this.config,params:this.params,ui:this}),new e({el:this.el,config:this.config,params:this.params,ui:this})},n}(App.ControllerAppContent),e=function(e){function n(){var t;this.draw=o(this.draw,this),this.render=o(this.render,this),this.update=o(this.update,this),n.__super__.constructor.apply(this,arguments),this.controllerBind("ui:report:rerender",(t=this,function(){return t.render()})),this.render()}return a(n,e),n.prototype.update=function(e){var n,i,s,r,o;for(i in n={},s=e.data)o=s[i],!0===this.params.backendSelected[i]&&(n[i]=o),this.ui.storeParams();if(this.lastParams||(this.lastParams={}),!this.lastParams||JSON.stringify(this.params)!==JSON.stringify(this.lastParams))return this.lastParams=$.extend(!0,{},this.params),this.draw(n),r=new Date,this.el.find("#download-chart").html(r.toString()),this.downloadWidget?this.downloadWidget.update({config:this.config,params:this.params,ui:this.ui}):this.downloadWidget=new t({el:this.el.find(".js-dataDownload"),config:this.config,params:this.params,ui:this.ui})},n.prototype.render=function(){var t,e,n;return e=this.apiPath+"/reports/generate",t=3e5,"year"===this.params.timeRange&&(t=3e5),"month"===this.params.timeRange&&(t=6e4),"week"===this.params.timeRange&&(t=5e4),"day"===this.params.timeRange&&(t=3e4),"realtime"===this.params.timeRange&&(t=1e4),this.ajax({id:"report_graph",type:"POST",url:e,data:JSON.stringify({metric:this.params.metric,year:this.params.year,month:this.params.month,week:this.params.week,day:this.params.day,timeRange:this.params.timeRange,profiles:this.params.profileSelected,backends:this.params.backendSelected}),processData:!0,error:(n=this,function(t){if(_.include([401,403,404,422,502],t.status))return n.bodyModal=new App.ControllerTechnicalErrorModal({head:__("The report could not be generated"),contentCode:t.responseJSON.error})}),success:function(e){return function(n){return e.update(n),e.delay(e.render,t,"report-update","page")}}(this)})},n.prototype.draw=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b;if(this.log("draw",t),$("#placeholder").empty(),b=[],"realtime"===this.params.timeRange)for(f=a=0;a<=59;f=++a)b.push([f,""]);else if("day"===this.params.timeRange)for(o=l=0;l<=23;o=++l)b.push([o,o]);else if("month"===this.params.timeRange)for(r=u=0;u<=30;r=++u)b.push([r,r+1]);else b="week"===this.params.timeRange?[[0,"Mon"],[1,"Tue"],[2,"Wed"],[3,"Thr"],[4,"Fri"],[5,"Sat"],[6,"Sun"]]:[[0,"Jan"],[1,"Feb"],[2,"Mar"],[3,"Apr"],[4,"May"],[5,"Jun"],[6,"Jul"],[7,"Aug"],[8,"Sep"],[9,"Oct"],[10,"Nov"],[11,"Dec"]];for(c in s=[],t){if(y=t[c],g=c,this.config.metric[this.params.metric])for(d=0,p=(v=this.config.metric[this.params.metric].backend).length;d<p;d++)(e=v[d]).name===c&&(g=e.display);for(n=[],i=0,m=0,h=b.length;m<h;m++)b[m],n.push([i,y[i]]),i+=1;s.push({data:n,label:App.i18n.translateInline(g)})}return $.plot($("#placeholder"),s,{yaxis:{min:0},xaxis:{ticks:b},legend:{labelBoxBorderColor:"var(--ghost-color)"},grid:{color:"var(--text-normal)",markingsColor:"var(--background-primary)"},series:{points:{fillColor:"var(--background-secondary)"}}})},n}(App.Controller),t=function(t){function e(t){this.tableUpdate=o(this.tableUpdate,this),this.tableRender=o(this.tableRender,this),this.render=o(this.render,this),this.update=o(this.update,this),this.selectBackend=o(this.selectBackend,this),t.el.off("click .js-dataDownloadBackendSelector"),e.__super__.constructor.apply(this,arguments),this.render()}return a(e,t),e.prototype.events={"click .js-dataDownloadBackendSelector":"selectBackend"},e.prototype.selectBackend=function(t){return t.preventDefault(),this.el.find(".js-dataDownloadBackendSelector").parent().removeClass("active"),
$(t.target).parent().addClass("active"),this.profileSelectedId=$(t.target).data("profile-id"),this.params.downloadBackendSelected=$(t.target).data("backend"),this.ui.storeParams(),this.table=!1,this.render()},e.prototype.update=function(){return this.render()},e.prototype.render=function(){var t,e,n,i,s,r,o,a,l;if(this.contentRendered||(this.contentRendered=!0,this.html(App.view("report/download_content")())),l=[],this.config.metric[this.params.metric]){for(n=0,s=(o=this.config.metric[this.params.metric].backend).length;n<s;n++)(t=o[n]).dataDownload&&!this.params.downloadBackendSelected&&(this.params.downloadBackendSelected=t.name);this.ui.storeParams()}for(i in r=[],a=this.params.profileSelected)a[i]&&(this.profileSelectedId||(this.profileSelectedId=i),r.push(App.ReportProfile.find(i)));return(e=App.view("report/download_header")({reports:l,profiles:r,downloadBackendSelected:this.params.downloadBackendSelected,metric:this.config.metric[this.params.metric]}))!==this.downloadHeaderHtml&&(this.el.find(".js-dataDownloadHeader").html(e),this.downloadHeaderHtml=e),this.tableUpdate()},e.prototype.tableRender=function(t,e){var n,i,s,r,o,a,l,c,u,p,h;if(_.isEmpty(t))return this.$(".js-dataDownloadButton").html(""),void this.$(".js-dataDownloadTable").html("");for(a in u=0,p=this.params.profileSelected)p[a]&&(u=a);return o=this.apiPath+"/reports/sets?sheet=true;metric="+this.params.metric+";year="+this.params.year+";month="+this.params.month+";week="+this.params.week+";day="+this.params.day+";timeRange="+this.params.timeRange+";profile_id="+u+";downloadBackendSelected="+this.params.downloadBackendSelected,this.$(".js-dataDownloadButton").html(App.view("report/download_button")({count:e,downloadUrl:o})),h=this,l=function(t){var e;return e=App.Ticket.findNative(t),h.navigate(e.uiUrl())},r=function(t,e,n){return n.title=e.title,t},s=function(t,e,n){return n.link=e.uiUrl(),t},i=function(t){var e;return e={name:"icon",display:"",parentClass:"noTruncate",translation:!1,width:"28px",displayWidth:28,unresizable:!0},t.unshift(0),t[0]=e,t},n=function(t,e,n){return t=" ",n.class=e.iconClass(),n.link="",n.title=e.iconTitle(),t},c={el:this.el.find(".js-dataDownloadTable"),model:App.Ticket,objects:t,overviewAttributes:["number","title","state","group","created_at"],bindRow:{events:{click:l}},callbackHeader:[i],callbackAttributes:{icon:[n],title:[s,r],number:[s,r]}},this.table?this.table.update({objects:t}):this.table=new App.ControllerTable(c)},e.prototype.tableUpdate=function(){return this.ajax({id:"report_download",type:"POST",url:this.apiPath+"/reports/sets",data:JSON.stringify({metric:this.params.metric,year:this.params.year,month:this.params.month,week:this.params.week,day:this.params.day,timeRange:this.params.timeRange,profiles:this.params.profileSelected,backends:this.params.backendSelected,downloadBackendSelected:this.params.downloadBackendSelected}),processData:!0,success:(t=this,function(e){var n,i,s,r,o,a;if(App.Collection.loadAssets(e.assets),a=[],e.ticket_ids)for(n=0,i=(r=e.ticket_ids).length;n<i;n++)s=r[n],o=App.Ticket.fullLocal(s),a.push(o);return t.tableRender(a,e.count)})});var t},e}(App.Controller),r=function(t){function e(){var t;this.select=o(this.select,this),this.render=o(this.render,this),e.__super__.constructor.apply(this,arguments),this.controllerBind("ui:report:rerender",(t=this,function(){return t.render()})),this.render()}return a(e,t),e.prototype.events={"click .js-timeRange":"select"},e.prototype.render=function(){return this.html(App.view("report/time_range_picker")()),this.el.find(".js-timeRange").removeClass("active"),this.el.find('.js-timeRange[data-type="'+this.ui.params.timeRange+'"]').addClass("active")},e.prototype.select=function(t){return t.preventDefault(),this.ui.params.timeRange=$(t.target).data("type"),App.Event.trigger("ui:report:rerender")},e}(App.Controller),s=function(t){function e(){var t;this.selectTimeYear=o(this.selectTimeYear,this),this.selectTimeWeek=o(this.selectTimeWeek,this),this.selectTimeMonth=o(this.selectTimeMonth,this),this.selectTimeDay=o(this.selectTimeDay,this),this.render=o(this.render,this),e.__super__.constructor.apply(this,arguments),this._timeSlotPicker(),this.controllerBind("ui:report:rerender",(t=this,function(){return t.render()})),this.render()}return a(e,t),e.prototype.events={"click .js-timePickerDay":"selectTimeDay","click .js-timePickerYear":"selectTimeYear","click .js-timePickerMonth":"selectTimeMonth","click .js-timePickerWeek":"selectTimeWeek"},e.prototype.render=function(){return this.html(App.view("report/time_picker")({params:this.ui.params,timeRangeDay:this.timeRangeDay,timeRangeMonth:this.timeRangeMonth,timeRangeWeek:this.timeRangeWeek,timeRangeYear:this.timeRangeYear})),this.el.find(".time-slot").removeClass("active"),this.el.find('.time-slot[data-type="'+this.ui.params.timeRange+'"]').addClass("active")},e.prototype.selectTimeDay=function(t){return t.preventDefault(),this.ui.params.day=$(t.target).data("type"),$(t.target).parent().parent().find("li").removeClass("active"),$(t.target).parent().addClass("active"),App.Event.trigger("ui:report:rerender"),this.ui.storeParams()},e.prototype.selectTimeMonth=function(t){return t.preventDefault(),this.ui.params.month=$(t.target).data("type"),$(t.target).parent().parent().find("li").removeClass("active"),$(t.target).parent().addClass("active"),App.Event.trigger("ui:report:rerender"),this.ui.storeParams()},e.prototype.selectTimeWeek=function(t){return t.preventDefault(),this.ui.params.week=$(t.target).data("type"),$(t.target).parent().parent().find("li").removeClass("active"),$(t.target).parent().addClass("active"),App.Event.trigger("ui:report:rerender"),this.ui.storeParams()},e.prototype.selectTimeYear=function(t){return t.preventDefault(),this.ui.params.year=$(t.target).data("type"),this._timeSlotPicker(),$(t.target).parent().parent().find("li").removeClass("active"),$(t.target).parent().addClass("active"),App.Event.trigger("ui:report:rerender"),this.ui.storeParams()},e.prototype._timeSlotPicker=function(){var t,e,n,i,s,r,o,a,l,c;for(this.timeRangeYear=[],t=e=r=(c=(new Date).getFullYear())-2,o=c;r<=o?e<=o:e>=o;t=r<=o?++e:--e)s={display:t,value:t},this.timeRangeYear.push(s);for(this.timeRangeMonth=[{display:__("Jan"),value:1},{display:__("Feb"),value:2},{display:__("Mar"),value:3},{display:__("Apr"),value:4},{display:__("May"),value:5},{display:__("Jun"),value:6},{display:__("Jul"),value:7},{display:__("Aug"),value:8},{display:__("Sep"),value:9},{display:__("Oct"),value:10},{display:__("Nov"),value:11},{display:__("Dec"),value:12}],this.timeRangeWeek=[],t=n=1,a=App.PrettyDate.getISOWeeks(this.ui.params.year);1<=a?n<=a:n>=a;t=1<=a?++n:--n)s={display:t,value:t},this.timeRangeWeek.push(s);for(this.timeRangeDay=[],l=[],t=i=1;i<=31;t=++i)s={display:t,value:t},l.push(this.timeRangeDay.push(s));return l},e}(App.Controller),i=function(t){function e(){this.selectBackend=o(this.selectBackend,this),this.selectProfile=o(this.selectProfile,this),this.selectMetric=o(this.selectMetric,this),this.render=o(this.render,this),e.__super__.constructor.apply(this,arguments),this.render()}return a(e,t),e.prototype.events={"click .js-profileSelector":"selectProfile","click .js-backendSelector":"selectBackend","click .panel-heading":"selectMetric"},e.prototype.render=function(){var t,e;return t=this.config.metric,e=App.ReportProfile.search({filter:{active:!0}}),this.html(App.view("report/sidebar")({metrics:t,params:this.params,profiles:e}))},e.prototype.selectMetric=function(t){var e;if(!$(t.target).closest(".panel").find(".collapse.in").get(0)&&(e=$(t.target).closest(".panel").data("metric"),this.params.metric!==e))return this.params.metric=e,App.Event.trigger("ui:report:rerender"),this.ui.storeParams()},e.prototype.selectProfile=function(t){var e,n,i;for(e in n=$(t.target).val(),i=this.params.profileSelected)i[e],delete this.params.profileSelected[e];return this.params.profileSelected[n]=!0,App.Event.trigger("ui:report:rerender"),this.ui.storeParams()},e.prototype.selectBackend=function(t){var e;return e=$(t.target).val(),$(t.target).prop("checked")?this.params.backendSelected[e]=!0:delete this.params.backendSelected[e],App.Event.trigger("ui:report:rerender"),this.ui.storeParams()},e}(App.Controller),App.Config.set("report",n,"Routes"),App.Config.set("Reporting",{prio:8e3,parent:"",name:__("Reporting"),translate:!0,target:"#report",icon:"report",permission:["report"]},"NavBarRight")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"ReportProfile",defaultSortBy:"name",pageData:{home:"report_profiles",object:__("Report Profile"),objects:__("Report Profiles"),pagerAjax:!0,pagerBaseUrl:"#manage/report_profiles/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#report_profiles",notes:[],buttons:[{name:__("New Profile"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content"),veryLarge:!0})}return n(i,t),i.requiredPermission="admin.report_profile",i.prototype.header=__("Report Profile"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i}(App.ControllerSubContent),App.Config.set("ReportProfile",{prio:8e3,name:__("Report Profiles"),parent:"#manage",target:"#manage/report_profiles",controller:t,permission:["admin.report_profile"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,veryLarge:!0,genericObject:"Role",defaultSortBy:"name",createScreen:"create",editScreen:"edit",pageData:{home:"roles",object:__("Role"),objects:__("Roles"),pagerAjax:!0,pagerBaseUrl:"#manage/roles/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#roles",notes:[__("Roles are \u2026")],buttons:[{name:__("New Role"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content")})}return n(i,t),i.requiredPermission="admin.role",i.prototype.header=__("Roles"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i}(App.ControllerSubContent),App.Config.set("Role",{prio:1600,name:__("Roles"),parent:"#manage",target:"#manage/roles",controller:t,permission:["admin.role"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty,s=[].indexOf||function(t){for(var e=0,n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return-1};App.Search=function(t){function i(){var t,n,s;this.saveOrderBy=e(this.saveOrderBy,this),this.getSavedOrderBy=e(this.getSavedOrderBy,this),this.shouldShowBulkForm=e(this.shouldShowBulkForm,this),this.updateTask=e(this.updateTask,this),this.renderTab=e(this.renderTab,this),this.showTab=e(this.showTab,this),this.renderResult=e(this.renderResult,this),this.search=e(this.search,this),this.empty=e(this.empty,this),this.listNavigate=e(this.listNavigate,this),this.show=e(this.show,this),this.meta=e(this.meta,this),i.__super__.constructor.apply(this,arguments),this.savedOrderBy={},(t=App.TaskManager.get(this.taskKey).state)&&t.query&&(this.query=t.query),App.TaskManager.touch(this.taskKey),this.globalSearch=new App.GlobalSearch({render:this.renderResult,limit:50}),this.render(),this.controllerBind("ui:rerender",(s=this,function(){return s.render()})),n=function(t){return function(e){return App.Collection.loadAssets(e.assets),t.formMeta=e.form_meta}}(this),this.bindId=App.TicketOverviewCollection.bind(n)}return n(i,t),i.extend(App.PopoverProvidable),i.extend(App.TicketMassUpdatable),i.prototype.elements={".js-search":"searchInput"},i.prototype.events={"click .js-emptySearch":"empty","submit form.search-holder":"preventDefault","keyup .js-search":"listNavigate","click .js-tab":"showTab","input .js-search":"updateFilledClass"},i.include(App.ValidUsersForTicketSelectionMethods),i.prototype.meta=function(){var t;return t=this.query||App.i18n.translateInline("Extended Search"),{url:this.url(),id:"",head:t,title:t,iconClass:"searchdetail"}},i.prototype.url=function(){return"#search"},i.prototype.show=function(t){if(this.table&&this.table.show(),this.navupdate({url:"#search",type:"menu"}),_.isEmpty(t.query))return this.query?this.search(500,!0):void 0;this.$(".js-search").val(t.query).trigger("keyup")},i.prototype.hide=function(){if(this.table)return this.table.hide()},i.prototype.changed=function(){},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l;for(t=App.TaskManager.get(this.taskKey).state,this.query||t&&t.query&&(this.query=t.query),this.model||(t&&t.model?this.model=t.model:this.model="Ticket"),this.tabs=[],n=0,i=(r=App.Config.get("models_searchable")).length;n<i;n++)s=(s=r[n]).replace(/::/g,""),a={name:(null!=(o=App[s])?o.display_name:void 0)||s,model:s,count:0,active:!1},this.model===s&&(a.active=!0),this.tabs.push(a);if(e=$(App.view("search/index")({query:this.query,tabs:this.tabs})),App.User.current().permission("ticket.agent")&&(this.controllerTicketBatch&&this.controllerTicketBatch.releaseController(),this.controllerTicketBatch=new App.TicketBatch({el:e.filter(".js-batch-overlay"),parent:this,parentEl:e,appEl:this.appEl,batchSuccess:(l=this,function(){return l.search(0,!0)})})),this.html(e),this.query)return this.search(500,!0)},i.prototype.listNavigate=function(t){if(27!==t.keyCode)return this.navigate("#search/"+encodeURIComponent(this.searchInput.val())),this.savedOrderBy={},this.search(0);this.empty()},i.prototype.empty=function(){return this.searchInput.val(""),this.query="",this.updateFilledClass(),this.updateTask(),this.delayedRemoveAnyPopover()},i.prototype.search=function(t,e){var n;if(null==e&&(e=!1),n=this.searchInput.val().trim(),!e){if(!n)return;if(n===this.query)return}return this.query=n,this.updateTask(),0===t&&(t=500,n.length>2?t=350:n.length>4&&(t=200)),this.globalSearch.search({delay:t,query:this.query,force:e})},i.prototype.renderResult=function(t){var e,n,i,s,r,o;for(null==t&&(t=[]),this.result=t,r=[],n=0,i=(s=this.tabs).length;n<i;n++)e=0,t[(o=s[n]).model]&&(e=t[o.model].length),this.model===o.model&&this.renderTab(o.model,t[o.model]||[]),r.push(this.$(".js-tab"+o.model+" .js-counter").text(e));return r},i.prototype.showTab=function(t){var e,n,i;return i=$(t.currentTarget).closest(".tabs"),n=$(t.currentTarget).data("tab-content"),i.find(".js-tab").removeClass("active"),$(t.currentTarget).addClass("active"),this.renderTab(n,(null!=(e=this.result)?e[n]:void 0)||[])},i.prototype.renderTab=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,_,w,k;for(this.model!==t&&(this.model=t,this.updateTask()),c=[],s=0,a=e.length;s<a;s++)r=e[s],h=App[t].fullLocal(r.id),c.push(h);if("Ticket"===t){for(k=this,f=function(t){var e;return e=App.Ticket.findNative(t),App.TaskManager.execute({key:"Ticket-"+e.id,controller:"TicketZoom",params:{ticket_id:e.id,overview_id:k.overview.id},show:!0}),k.navigate(e.uiUrl())},i=null!=(m=this.permissionCheck("ticket.agent"))?m:{true:!1},n=function(t){return function(e,n,i){var s,r,o,a,l;return t.shouldShowBulkForm()?(t.bulkForm.render(),t.bulkForm.show()):t.bulkForm.hide(),t.lastChecked&&i.shiftKey&&(s=$(i.currentTarget).parents(".item"),a=$(t.lastChecked).parents(".item"),o=s.parent().children(),s.index()>a.index()?(l=a.index(),r=s.index()):(l=s.index(),r=a.index()),o.slice(l+1,r).find('[name="bulk"]').prop("checked",(function(){return!this.checked}))),t.lastChecked=i.currentTarget,t.bulkForm.updateTicketIdsBulkForm(i)}}(this),_=[],o=0,l=e.length;o<l;o++)r=e[o],_.push(r.id);return p=this.$(".js-content"),this.table&&this.table.releaseController(),this.table=new App.TicketList({tableId:"find_"+t,el:p,columns:["number","title","customer","group","owner","created_at"],ticket_ids:_,radio:!1,checkbox:i,orderBy:null!=(g=this.getSavedOrderBy())?g.orderBy:void 0,orderDirection:null!=(v=this.getSavedOrderBy())?v.orderDirection:void 0,bindRow:{events:{click:f}},bindCheckbox:{events:{click:n},select_all:n},sortClickCallback:this.saveOrderBy}),w=function(t){return function(){var e;return e=function(){return t.search(0,!0)},t.delay(e,100)}}(this),this.bulkForm&&this.bulkForm.releaseController(),this.bulkForm=new App.TicketBulkForm({el:this.el.find(".bulkAction"),holder:p,view:this.view,batchSuccess:w,noSidebar:!0}),0!==(u=this.$(".js-content")).find('input[name="bulk"]:checked').length&&this.bulkForm.show(),u.on("change",'input[name="bulk"], input[name="bulk_all"]',function(t){return function(){return t.shouldShowBulkForm()?t.bulkForm.show():(t.bulkForm.hide(),t.bulkForm.reset())}}(this)),u.on("change",'[name="bulk"]',(function(){var t,e,n;return t=u.find('[name="bulk_all"]'),n=u.find('input[name="bulk"]:checked').length,e=u.find('input[name="bulk"]').length,0===n?(t.prop("indeterminate",!1),t.prop("checked",!1)):n===e?(t.prop("indeterminate",!1),t.prop("checked",!0)):(t.prop("checked",!1),t.prop("indeterminate",!0))}))}return d=function(t){return function(e){return h=App[t.model].fullLocal(e),t.navigate(h.uiUrl())}}(this),this.table&&this.table.releaseController(),this.table=new App.ControllerTable({orderBy:null!=(y=this.getSavedOrderBy())?y.orderBy:void 0,orderDirection:null!=(b=this.getSavedOrderBy())?b.orderDirection:void 0,tableId:"find_"+t,el:this.$(".js-content"),model:App[t],objects:c,bindRow:{events:{click:d}},sortClickCallback:this.saveOrderBy})},i.prototype.updateTask=function(){var t;if(t=App.TaskManager.get(this.taskKey).state)return t.query=this.query,t.model=this.model,App.TaskManager.update(this.taskKey,{state:t}),App.TaskManager.touch(this.taskKey)},i.prototype.updateFilledClass=function(){return this.searchInput.toggleClass("is-empty",!this.searchInput.val())},i.prototype.shouldShowBulkForm=function(){var t,e,n,i;return 0!==(e=this.$("table").find('input[name="bulk"]:checked')).length&&(i=_.map(e,(function(t){return $(t).val()})),n=_.map(App.Ticket.findAll(i),(function(t){return t.group_id})),n=_.uniq(n),t=App.User.find(this.Session.get("id")).allGroupIds("change"),t=_.map(t,(function(t){return parseInt(t,10)})),_.every(n,(function(e){return s.call(t,e)>=0})))},i.prototype.getSavedOrderBy=function(){return this.savedOrderBy[this.model]},i.prototype.saveOrderBy=function(t){if(t)return this.savedOrderBy[this.model]={orderBy:t.orderBy,orderDirection:t.orderDirection}},i}(App.Controller),t=function(t){function e(t){var n,i;e.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),i=void 0,_.isEmpty(t.query)||(i=decodeURIComponent(t.query)),n={query:i},App.TaskManager.execute({key:"Search",controller:"Search",params:n,show:!0})}return n(e,t),e.requiredPermission=["*"],e}(App.ControllerPermanent),App.Config.set("search",t,"Routes"),App.Config.set("search/:query",t,"Routes")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){var t;n.__super__.constructor.apply(this,arguments),this.load(),this.interval((t=this,function(){return t.load()}),45e3)}return e(n,t),n.requiredPermission="admin.session",n.prototype.header=__("Sessions"),n.prototype.events={"click .js-delete":"destroy"},n.prototype.load=function(){return this.startLoading(),this.ajax({id:"sessions",type:"GET",url:this.apiPath+"/sessions",success:(t=this,function(e){return t.stopLoading(),App.Collection.loadAssets(e.assets),t.sessions=e.sessions,t.render()})});var t},n.prototype.render=function(){var t,e,n,i;for(t=0,e=(n=this.sessions).length;t<e;t++)(i=n[t]).data&&i.data.user_id&&(i.data.user=App.User.find(i.data.user_id));return this.html(App.view("session")({sessions:this.sessions}))},n.prototype.destroy=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest("a").data("session-id"),this.ajax({id:"sessions/"+e,type:"DELETE",url:this.apiPath+"/sessions/"+e,success:(n=this,function(){return n.load()})})},n}(App.ControllerSubContent),App.Config.set("Session",{prio:3800,name:__("Sessions"),parent:"#system",target:"#system/sessions",controller:t,permission:["admin.session"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;(this.error=e(this.error,this),this.resend=e(this.resend,this),this.submit=e(this.submit,this),this.release=e(this.release,this),i.__super__.constructor.apply(this,arguments),this.Config.get("user_create_account"))?(this.title(__("Sign up")),this.navupdate("#signup"),this.publicLinksSubscribeId=App.PublicLink.subscribe((t=this,function(){return t.render()})),this.render()):this.navigate("#")}return n(i,t),i.prototype.events={"submit form":"submit","click .submit":"submit","click .js-submitResend":"resend","click .cancel":"cancel"},i.prototype.className="signup",i.prototype.release=function(){if(this.publicLinksSubscribeId)return App.PublicLink.unsubscribe(this.publicLinksSubscribeId)},i.prototype.render=function(){var t;return t=App.PublicLink.search({filter:{screen:["signup"]},sortBy:"prio"}),this.replaceWith(App.view("signup")({public_links:t})),this.form=new App.ControllerForm({el:this.el.find("form"),model:App.User,screen:"signup",autofocus:!0})},i.prototype.cancel=function(){return this.navigate("#login")},i.prototype.submit=function(t){var e,n,i;return t.preventDefault(),this.formDisable(t),this.params=this.formParam(t.target),!this.params.login&&this.params.email&&(this.params.login=this.params.email),this.params.signup=!0,this.params.role_ids=[],this.log("notice","updateAttributes",this.params),(n=new App.User).load(this.params),(e=n.validate({controllerForm:this.form}))?(this.log("error new",e),Object.keys(e).forEach((function(t){return e[t]=null})),this.formValidate({form:t.target,errors:e}),this.formEnable(t),!1):(this.formValidate({form:t.target,errors:e}),n.save({done:(i=this,function(){var t;return t=App.PublicLink.search({filter:{screen:["signup"]},sortBy:"prio"}),i.replaceWith(App.view("signup/verify")({email:i.params.email,public_links:t}))}),fail:function(e){return function(n,i){return e.formEnable(t),e.form.showAlert(i.error_human||i.error||__("User could not be created."))}}(this)}))},i.prototype.resend=function(t){return t.preventDefault(),this.formDisable(t),this.resendParams=this.formParam(t.target),this.ajax({id:"email_verify_send",type:"POST",url:this.apiPath+"/users/email_verify_send",data:JSON.stringify({email:this.resendParams.email}),processData:!0,success:(e=this,function(){return e.formEnable(t),e.notify({type:"success",msg:App.i18n.translateContent('Email sent to "%s". Please verify your email account.',e.params.email),removeAll:!0})}),error:this.error});var e},i.prototype.error=function(t){var e,n;return n=t.responseText,e={},_.isEmpty(n)||(e=JSON.parse(n)),this.notify({type:"error",msg:App.i18n.translateContent(e.error||"Could not process your request"),removeAll:!0})},i}(App.ControllerFullPage),App.Config.set("signup",t,"Routes")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t,n;this.description=e(this.description,this),this.delete=e(this.delete,this),this.release=e(this.release,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.subscribeCalendarId=App.Calendar.subscribe(this.render),this.subscribeSlaId=App.Sla.subscribe(this.render),n=this,t=function(){return n.stopLoading(),n.render()},this.startLoading(),App.Sla.fetchFull(t,{clear:!0})}return n(i,t),i.requiredPermission="admin.sla",i.prototype.header=__("SLAs"),i.prototype.events={"click .js-new":"new","click .js-edit":"edit","click .js-delete":"delete","click .js-description":"description"},i.prototype.render=function(){var t,e,n,i,s,r;for(e=0,n=(r=App.Sla.search({sortBy:"name"})).length;e<n;e++)(s=r[e]).rules=App.UiElement.ticket_selector.humanText(s.condition),s.calendar=App.Calendar.find(s.calendar_id);return i=!1,App.Sla.description&&(_.isEmpty(r)?t=marked(App.i18n.translateContent(App.Sla.description)):i=!0),this.html(App.view("sla/index")({slas:r,showDescription:i,description:t}))},i.prototype.release=function(){if(this.subscribeCalendarId&&App.Calendar.unsubscribe(this.subscribeCalendarId),this.subscribeSlaId)return App.Sla.unsubscribe(this.subscribeSlaId)},i.prototype.new=function(t){return t.preventDefault(),new App.ControllerGenericNew({pageData:{title:__("SLAs"),object:__("SLA"),objects:__("SLAs")},genericObject:"Sla",container:this.el.closest(".content"),callback:this.load,large:!0})},i.prototype.edit=function(t){var e;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),new App.ControllerGenericEdit({id:e,pageData:{title:__("SLAs"),object:__("SLA"),objects:__("SLAs")},genericObject:"Sla",callback:this.load,container:this.el.closest(".content"),large:!0})},i.prototype.delete=function(t){var e,n;return t.preventDefault(),e=$(t.target).closest(".action").data("id"),n=App.Sla.find(e),new App.ControllerGenericDestroyConfirm({item:n,container:this.el.closest(".content"),callback:this.load})},i.prototype.description=function(){return new App.ControllerGenericDescription({description:App.Sla.description,container:this.el.closest(".content")})},i}(App.ControllerSubContent),App.Config.set("Sla",{prio:2900,name:__("SLAs"),parent:"#manage",target:"#manage/slas",controller:t,permission:["admin.sla"]},"NavBarAdmin")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;App.SSLCertificateController=function(s){function r(){this.addCertificate=n(this.addCertificate,this),this.certList=n(this.certList,this),this.render=n(this.render,this),r.__super__.constructor.apply(this,arguments),this.render()}return i(r,s),r.prototype.events={"click .js-addCertificate":"addCertificate"},r.prototype.render=function(){return this.html(App.view("ssl_certificates")()),this.certList()},r.prototype.certList=function(){return this.list=new e({el:this.$(".js-certificatesList")})},r.prototype.addCertificate=function(){return new t({callback:(e=this,function(){return e.list.load()})});var e},r}(App.Controller),e=function(t){function e(){this.remove=n(this.remove,this),this.render=n(this.render,this),this.load=n(this.load,this),e.__super__.constructor.apply(this,arguments),this.load()}return i(e,t),e.prototype.events={"click .js-remove":"remove"},e.prototype.load=function(){return this.ajax({type:"GET",url:this.apiPath+"/ssl_certificates",success:(t=this,function(e){var n;return n=_.values(e.SSLCertificate),n=_.sortBy(n,(function(t){return t.subject})),t.render(n)}),error:function(t){return function(e,n){var i;if("abort"!==n)return i=e.responseJSON||{},t.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("Loading failed."))})}}(this)});var t},e.prototype.render=function(t){return this.html(App.view("ssl_certificates_list")({certificates:t}))},e.prototype.remove=function(t){var e,n;if(t.preventDefault(),e=$(t.currentTarget).parents("tr").data("id"))return new App.ControllerConfirm({message:__("Are you sure?"),container:this.el.closest(".content"),buttonClass:"btn--danger",callback:(n=this,function(){return n.ajax({type:"DELETE",url:n.apiPath+"/ssl_certificates/"+e,success:function(){return n.load()},error:function(t,e){var i;if("abort"!==e)return i=t.responseJSON||{},n.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("Server operation failed."))})}})})})},e}(App.Controller),t=function(t){function e(){return this.onSubmit=n(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Add"),e.prototype.autoFocusOnFirstInput=!1,e.prototype.head=__("Add Certificate"),e.prototype.large=!0,e.prototype.content=function(){return App.view("ssl_certificates_create")()},e.prototype.onSubmit=function(t){var e,n;return e=new FormData($(t.currentTarget).closest("form").get(0)),this.formDisable(t),this.clearAlerts(),this.ajax({type:"POST",url:this.apiPath+"/ssl_certificates",processData:!1,contentType:!1,cache:!1,data:e,success:(n=this,function(){return n.close(),n.callback()}),error:function(e){return function(n){var i,s,r;return e.formEnable(t),i=(null!=n&&null!=(s=n.responseJSON)?s.error_human:void 0)||(null!=n&&null!=(r=n.responseJSON)?r.error:void 0)||__("The import failed."),e.showAlert(App.i18n.translateContent(i))}}(this)})},e}(App.ControllerModal)}.call(this),function(){var t,e,n,i,s=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;i=function(t){function e(){this.create=s(this.create,this),this.setTagNew=s(this.setTagNew,this),this.render=s(this.render,this),this.release=s(this.release,this),e.__super__.constructor.apply(this,arguments),this.subscribeId=App.Setting.subscribe(this.render,{initFetch:!0,clear:!1})}return r(e,t),e.requiredPermission="admin.tag",e.prototype.header=__("Tags"),e.prototype.events={"change .js-newTagSetting input":"setTagNew","submit .js-create":"create"},e.prototype.elements={".js-newTagSetting input":"tagNewSetting"},e.prototype.release=function(){return App.Setting.unsubscribe(this.subscribeId)},e.prototype.render=function(){var t;if((t=this.Config.get("tag_new")||!0)!==this.lastNewTagSetting)return this.lastNewTagSetting=t,this.html(App.view("tag/index")()),new n({el:this.$(".js-Table")})},e.prototype.setTagNew=function(){var t;return t=this.tagNewSetting.prop("checked"),App.Setting.set("tag_new",t)},e.prototype.create=function(t){var e,i;if(t.preventDefault(),e=$(t.currentTarget).find("input[name]").val().trim())return this.ajax({type:"POST",url:this.apiPath+"/tag_list",data:JSON.stringify({name:e}),success:(i=this,function(){return i.html(App.view("tag/index")()),new n({el:i.$(".js-Table")})})})},e}(App.ControllerSubContent),n=function(n){function i(){this.edit=s(this.edit,this),this.render=s(this.render,this),this.load=s(this.load,this),i.__super__.constructor.apply(this,arguments),this.load()}return r(i,n),i.prototype.events={"click .js-delete":"destroy","click .js-edit":"edit","click .js-search":"search"},i.prototype.load=function(){return this.ajax({id:"tag_admin_list",type:"GET",url:this.apiPath+"/tag_list",processData:!0,success:(t=this,function(e){return t.render(e)})});var t},i.prototype.render=function(t){return this.html(App.view("tag/table")({list:t}))},i.prototype.edit=function(t){var n,i,s;return t.preventDefault(),i=(s=$(t.currentTarget).closest("tr")).find(".js-name").text(),n=s.data("id"),new e({id:n,name:i,callback:this.load})},i.prototype.destroy=function(e){var n,i;return e.preventDefault(),e.stopPropagation(),n=(i=$(e.currentTarget).closest("tr")).data("id"),new t({id:n,row:i})},i.prototype.search=function(t){var e;return t.preventDefault(),t.stopPropagation(),e=$(t.target).closest("tr").find(".js-name").text(),App.GlobalSearchWidget.search(e,"tags")},i}(App.Controller),e=function(t){function e(){return this.onSubmit=s(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Submit"),e.prototype.head=__("Edit"),e.prototype.small=!0,e.prototype.content=function(){
return App.view("tag/edit")({id:this.id,name:this.name})},e.prototype.onSubmit=function(t){var e,n;return t.preventDefault(),e=this.formParam(t.target),this.ajax({id:"tag_admin_list",type:"PUT",url:this.apiPath+"/tag_list/"+this.id,data:JSON.stringify({id:this.id,name:e.name}),success:(n=this,function(){return n.callback(),n.close()})})},e}(App.ControllerModal),t=function(t){function e(){return this.onSubmit=s(this.onSubmit,this),e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Yes"),e.prototype.buttonClass="btn--danger",e.prototype.head=__("Confirmation"),e.prototype.small=!0,e.prototype.content=function(){return App.i18n.translateContent("Do you really want to delete this object?")},e.prototype.onSubmit=function(){return this.ajax({id:"tag_admin_list",type:"DELETE",url:this.apiPath+"/tag_list/"+this.id,processData:!0,success:(t=this,function(){return t.row.remove(),t.close()})});var t},e}(App.ControllerModal),App.Config.set("Tags",{prio:2330,name:__("Tags"),parent:"#manage",target:"#manage/tags",controller:i,permission:["admin.tag"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.TaskbarWidget=function(i){function s(){var t,n;this.removeTask=e(this.removeTask,this),this.remove=e(this.remove,this),this.location=e(this.location,this),s.__super__.constructor.apply(this,arguments),App.Event.bind("Taskbar:destroy",(n=this,function(t){var e;if((e=App.Taskbar.find(t.id))&&e.key)return n.removeTask(e.key)}),"Collection::Subscribe::Taskbar"),t={tolerance:"pointer",distance:15,opacity:.6,forcePlaceholderSize:!0,items:"> a",update:function(t){return function(){var e,n,i,s,r,o;for(o=[],e=0,r=(i=t.el.find("> a")).length;e<r;e++){if(n=i[e],!(s=$(n).data("key")))throw"No such key attributes found for task item";o.push(s)}return App.TaskManager.reorder(o)}}(this)},this.el.sortable(t),this.controllerBind("taskInit",function(t){return function(){return t.queue.push(["renderAll"]),t.uIRunner()}}(this)),this.controllerBind("taskUpdate",function(t){return function(e){return t.queue.push(["change",e]),t.uIRunner()}}(this)),this.controllerBind("taskRemove",function(t){return function(e){return t.queue.push(["destroy",e]),t.uIRunner()}}(this)),this.controllerBind("taskCollectionOrderSet",function(t){return function(e){return t.collectionOrderSet(e)}}(this)),this.controllerBind("taskClose",function(t){return function(e){var n,i,s,r;for(s=[],n=0,i=e.length;n<i;n++)r=e[n],s.push(t.remove(null,r));return s}}(this))}return n(s,i),s.prototype.events={"click .js-close":"remove","click .js-locationVerify":"location"},s.prototype.model=!1,s.prototype.template="widget/task_item",s.prototype.uniqKey="key",s.prototype.observe={meta:!0,active:!0,notify:!0},s.prototype.itemGet=function(t){return App.TaskManager.get(t)},s.prototype.itemDestroy=function(t){return App.TaskManager.remove(t)},s.prototype.itemsAll=function(){return App.TaskManager.allWithMeta()},s.prototype.location=function(t){if($(t.currentTarget).hasClass("is-modified"))return this.locationVerify(t)},s.prototype.remove=function(e,n,i){var s;if(null==n&&(n=!1),null==i&&(i=!1),null!=e&&e.preventDefault(),null!=e&&e.stopPropagation(),n||(n=$(e.target).parents("a").data("key")),!n)throw"No such key attributes found for task item";if(s=App.TaskManager.worker(n),i||!s||!s.changed||!s.changed())return this.removeTask(n);new t({key:n,ui:this,event:e})},s.prototype.removeTask=function(t){var e,n,i,s,r,o,a;if(null==t&&(t=!1),t){for(n=App.TaskManager.get(t),e=!1,i=0,s=(a=App.TaskManager.all()).length;i<s;i++)o=a[i],n.active&&o.key===t&&(e=!0);if(App.TaskManager.remove(t),e){if(!(r=App.TaskManager.nextTaskUrl()))return this.navigate("#");this.navigate(r)}}},s}(App.CollectionController),t=function(t){function i(){return this.onSubmit=e(this.onSubmit,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Discard Changes"),i.prototype.buttonClass="btn--danger",i.prototype.head=__("Confirmation"),i.prototype.content=function(){return App.i18n.translateContent("Tab has changed, do you really want to close it?")},i.prototype.onSubmit=function(){return this.close(),this.ui.remove(this.event,this.key,!0)},i}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"Template",defaultSortBy:"name",pageData:{home:"templates",object:__("Template"),objects:__("Templates"),pagerAjax:!0,pagerBaseUrl:"#manage/templates/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#templates",notes:[__("Text modules are \u2026")],buttons:[{name:__("New Template"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content")})}return n(i,t),i.requiredPermission="admin.template",i.prototype.header=__("Templates"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i}(App.ControllerSubContent),App.Config.set("Templates",{prio:2320,name:__("Templates"),parent:"#manage",target:"#manage/templates",controller:t,permission:["admin.template"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TestController1=function(n){function i(){this.changed=t(this.changed,this),this.active=t(this.active,this),this.hide=t(this.hide,this),this.show=t(this.show,this),i.__super__.constructor.apply(this,arguments),this.showState=!1,this.hideState=!1,this.activeState=!1,this.changedState||(this.changedState=!1),this.render()}return e(i,n),i.prototype.meta=function(){return{}},i.prototype.show=function(){return this.showState=!0,this.render()},i.prototype.hide=function(){return this.hideState=!0,this.render()},i.prototype.active=function(t){return this.activeState=t,this.render()},i.prototype.changed=function(){return this.changedState},i.prototype.render=function(){return this.html("<div>some test controller message:'"+this.message+"',show:'"+this.showState+"',hide:'"+this.hideState+"',active:'"+this.activeState+"'</div>")},i.prototype.url=function(){return"#/some/url/"+this.message},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.genericController=new App.ControllerGenericIndex({el:this.el,id:this.id,genericObject:"TextModule",defaultSortBy:"name",importCallback:function(){return new App.Import({baseUrl:"/api/v1/text_modules",container:this.el.closest(".content"),deleteOption:!0})},pageData:{home:"text_modules",object:__("Text module"),objects:__("Text modules"),pagerAjax:!0,pagerBaseUrl:"#manage/text_modules/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#text_modules",notes:[__("Text modules are \u2026")],buttons:[{name:__("Import"),"data-type":"import",class:"btn"},{name:__("New text module"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content")})}return n(i,t),i.requiredPermission="admin.text_module",i.prototype.header=__("Text modules"),i.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},i}(App.ControllerSubContent),App.Config.set("TextModule",{prio:2300,name:__("Text modules"),parent:"#manage",target:"#manage/text_modules",controller:t,permission:["admin.text_module"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketCustomer=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.head=__("Change Customer"),i.prototype.content=function(){var t;return t={customer_id:{name:"customer_id",display:__("Customer"),tag:"user_autocompletion",null:!1,placeholder:__("Enter Person or Organization/Company"),minLengt:2,disableCreateObject:!1},organization_id:{name:"organization_id",display:__("Organization"),tag:"autocompletion_ajax_customer_organization",multiple:!1,null:!1,relation:"Organization",autocapitalize:!1,translate:!1}},this.controller=new App.ControllerForm({model:App.Ticket,mixedAttributes:t,screen:"edit",params:{id:this.ticket_id},autofocus:!0,handlersConfig:[App.TicketZoomFormHandlerMultiOrganization]}),this.controller.form},i.prototype.onSubmit=function(t){var e,n,i,s,r;return i=this.formParam(t.target),(s=App.Ticket.find(this.ticket_id)).customer_id=i.customer_id,s.organization_id=i.organization_id,n=s.validate({controllerForm:this.controller,target:t.target}),_.isEmpty(n)?(this.customer_id=i.customer_id,this.organization_id=i.organization_id,r=this,e=function(){return r.close(),(s=App.Ticket.find(r.ticket_id)).article=void 0,s.updateAttributes({customer_id:r.customer_id,organization_id:r.organization_id})},App.User.full(this.customer_id,e),this.organization_id?App.Organization.full(this.organization_id,e):void 0):(this.log("error",n),void this.formValidate({form:t.target,errors:n}))},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketHistory=function(n){function i(){return this.fetch=t(this.fetch,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.fetch=function(){return this.ajax({id:"ticket_history",type:"GET",url:this.apiPath+"/ticket_history/"+this.ticket_id,success:(t=this,function(e){return App.Collection.loadAssets(e.assets),t.items=e.history,t.render()})});var t},i}(App.GenericHistory)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketLinkAdd=function(n){function i(){this.onSubmit=t(this.onSubmit,this),this.content=t(this.content,this),this.fetch=t(this.fetch,this),i.__super__.constructor.apply(this,arguments),this.fetch()}return e(i,n),i.include(App.TicketNumberInput),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.head=__("Link"),i.prototype.shown=!1,i.prototype.url=function(){return this.object instanceof App.Ticket?this.apiPath+"/ticket_related/"+this.object.id:this.apiPath+"/ticket_recent"},i.prototype.fetch=function(){return this.ajax({id:"ticket_related",type:"GET",url:this.url(),processData:!0,success:(t=this,function(e){return App.Collection.loadAssets(e.assets),t.ticketIdsByCustomer=e.ticket_ids_by_customer,t.ticketIdsRecentViewed=e.ticket_ids_recent_viewed,t.render()})});var t},i.prototype.content=function(){var t;return t=$(App.view("link/ticket/add")({link_object:this.link_object,link_object_id:this.link_object_id,link_types:this.link_types,object:this.object,hasByCustomer:void 0!==this.ticketIdsByCustomer,hasRecentViewed:void 0!==this.ticketIdsRecentViewed})),this.ticketIdsByCustomer&&this.buildContentTable(t,this.ticketIdsByCustomer,"ticket-merge-customer-tickets"),this.ticketIdsRecentViewed&&this.buildContentTable(t,this.ticketIdsRecentViewed,"ticket-merge-recent-tickets"),this.removeTicketSelectionOnFocus(t,"ticket_number"),this.stripTicketHookOnPaste(t,"ticket_number"),this.updateTicketNumberOnRadioClick(t,"ticket_number"),t},i.prototype.buildContentTable=function(t,e,n){var i;return this.object instanceof App.Ticket&&(e=e.filter((i=this,function(t){return t!==i.object.id}))),new App.TicketList({tableId:n,el:t.find("#"+n),ticket_ids:e,radio:!0})},i.prototype.onSubmit=function(t){var e;if((e=this.formParam(t.target)).ticket_number){var n;if(e.link_type)return this.ajax({id:"links_add_"+this.object.id+"_"+this.object_type,type:"POST",url:this.apiPath+"/links/add",data:JSON.stringify({link_type:e.link_type,link_object_target:this.link_object,link_object_target_value:this.object.id,link_object_source:"Ticket",link_object_source_number:e.ticket_number}),processData:!0,success:(n=this,function(){return n.close(),n.parent.fetch()}),error:function(t){return function(e){var n,i;return i=e.responseText,n={},_.isEmpty(i)||(n=JSON.parse(i)),t.notify({type:"error",msg:App.i18n.translateContent(n.error),removeAll:!0})}}(this)});alert(__("The required parameter 'link_type' is missing."))}else alert(__("The required parameter 'ticket_number' is missing."))},i}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.TicketOverview=function(t){function i(){var t,n;this.listNavigate=e(this.listNavigate,this),this.keyboardOn=e(this.keyboardOn,this),this.release=e(this.release,this),this.currentPosition=e(this.currentPosition,this),this.setPosition=e(this.setPosition,this),this.hide=e(this.hide,this),this.show=e(this.show,this),this.url=e(this.url,this),this.active=e(this.active,this),i.__super__.constructor.apply(this,arguments),this.render(),n=this,t=function(t){return App.Collection.loadAssets(t.assets),n.formMeta=t.form_meta},this.bindId=App.TicketOverviewCollection.bind(t)}return n(i,t),i.extend(App.TicketMassUpdatable),i.include(App.ValidUsersForTicketSelectionMethods),i.prototype.className="overviews",i.prototype.activeFocus="nav",i.prototype.elements={".main":"mainContent"},i.prototype.render=function(){var t,e;return t=$(App.view("ticket_overview/index")()),this.navBarControllerVertical&&this.navBarControllerVertical.releaseController(),this.navBarControllerVertical=new App.TicketOverviewNavbar({el:t.find(".overview-header"),view:this.view,vertical:!0}),this.navBarController&&this.navBarController.releaseController(),this.navBarController=new App.TicketOverviewNavbar({el:t.filter(".sidebar"),view:this.view}),App.User.current().permission("ticket.agent")&&(this.controllerTicketBatch&&this.controllerTicketBatch.releaseController(),this.controllerTicketBatch=new App.TicketBatch({el:t.filter(".js-batch-overlay"),parent:this,parentEl:t,appEl:this.appEl,batchSuccess:(e=this,function(){return e.render()})})),this.contentController&&this.contentController.releaseController(),this.contentController=new App.TicketOverviewTable({el:t.find(".overview-table"),view:this.view,keyboardOn:this.keyboardOn,keyboardOff:this.keyboardOff}),this.html(t),this.$(".main").on("click",function(t){return function(){return t.activeFocus="overview"}}(this)),this.$(".sidebar").on("click",function(t){return function(){return t.activeFocus="nav"}}(this)),this.controllerBind("overview:fetch",function(t){return function(){var e;if(t.view)return e=function(){return App.OverviewListCollection.fetch(t.view)},t.delay(e,2800,"overview:fetch")}}(this))},i.prototype.active=function(t){return void 0===t?this.shown:this.shown=t},i.prototype.url=function(){return"#ticket/view/"+this.view},i.prototype.show=function(t){if(this.keyboardOn(),this.navupdate("#ticket/view"),this.view=t.view,this.view||!this.viewLast){if(this.navBarController&&this.navBarController.update({view:this.view,activeState:!0}),this.navBarControllerVertical&&this.navBarControllerVertical.update({view:this.view,activeState:!0}),this.viewLast!==this.view)return App.TicketOverviewCollection.fetch(),this.viewLast=this.view,this.contentController&&this.contentController.releaseController(),this.contentController=new App.TicketOverviewTable({el:this.$(".overview-table"),view:this.view,keyboardOn:this.keyboardOn,keyboardOff:this.keyboardOff});this.contentController&&this.contentController.show()}else this.navigate("#ticket/view/"+this.viewLast,{hideCurrentLocationFromHistory:!0})},i.prototype.hide=function(){if(this.keyboardOff(),this.navBarController&&this.navBarController.active(!1),this.navBarControllerVertical&&this.navBarControllerVertical.active(!1),this.contentController)return this.contentController.hide()},i.prototype.setPosition=function(t){return this.$(".main").scrollTop(t)},i.prototype.currentPosition=function(){return this.$(".main").scrollTop()},i.prototype.changed=function(){return!1},i.prototype.release=function(){return this.keyboardOff(),i.__super__.release.apply(this,arguments),App.TicketOverviewCollection.unbindById(this.bindId)},i.prototype.keyboardOn=function(){return $(window).off("keydown.overview_navigation"),$(window).on("keydown.overview_navigation",this.listNavigate)},i.prototype.keyboardOff=function(){return $(window).off("keydown.overview_navigation")},i.prototype.listNavigate=function(t){var e;if(!$(t.target).is("textarea, input, select"))if(38===t.keyCode)t.preventDefault(),this.nudge(t,-1);else if(40===t.keyCode)t.preventDefault(),this.nudge(t,1);else if(32===t.keyCode){if(t.preventDefault(),"overview"===this.activeFocus)return this.$(".table-overview table tbody tr.is-hover td.js-checkbox-field label input").first().trigger("click")}else{if(9===t.keyCode)return t.preventDefault(),"nav"===this.activeFocus?(this.activeFocus="overview",this.nudge(t,1)):this.activeFocus="nav";if(13===t.keyCode&&"overview"===this.activeFocus&&(e=this.$(".table-overview table tbody tr.is-hover a").first().attr("href")))return this.navigate(e)}},i.prototype.nudge=function(t,e){var n,i,s,r,o;if("overview"===this.activeFocus){if(!(n=(i=this.$(".table-overview table tbody")).find("tr.is-hover")).length)return void i.find("tr").first().addClass("is-hover");if(1===e?(r=n.next("tr")).length&&(n.removeClass("is-hover"),r.addClass("is-hover")):(o=n.prev("tr")).length&&(n.removeClass("is-hover"),o.addClass("is-hover")),r&&this.scrollToIfNeeded(r,!0),o)return this.scrollToIfNeeded(o,!0)}else{if(!(n=(i=this.$(".sidebar")).find("li.active")).length)return void((s=i.find("li a").first().attr("href"))&&this.navigate(s));if(1===e?(r=n.next("li")).length&&this.navigate(r.find("a").attr("href")):(o=n.prev("li")).length&&this.navigate(o.find("a").attr("href")),r&&this.scrollToIfNeeded(r,!0),o)return this.scrollToIfNeeded(o,!0)}},i}(App.Controller),t=function(t){function e(t){var n;e.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),n={view:t.view,appEl:t.appEl},App.TaskManager.execute({key:"TicketOverview",controller:"TicketOverview",params:n,show:!0,persistent:!0})}return n(e,t),e.requiredPermission=["ticket.agent","ticket.customer"],e}(App.ControllerPermanent),App.Config.set("ticket/view",t,"Routes"),App.Config.set("ticket/view/:view",t,"Routes"),App.Config.set("TicketOverview",{controller:"TicketOverview",permission:["ticket.agent","ticket.customer"]},"permanentTask"),App.Config.set("TicketOverview",{prio:1e3,parent:"",name:__("Overviews"),target:"#ticket/view",key:"TicketOverview",permission:["ticket.agent","ticket.customer"],class:"overviews"},"NavBar")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketOverviewNavbar=function(n){function i(){var e;this.render=t(this.render,this),this.active=t(this.active,this),this.autoFoldTabs=t(this.autoFoldTabs,this),this.release=t(this.release,this),this.activate=t(this.activate,this),this.onDropdownHide=t(this.onDropdownHide,this),this.onDropdownShow=t(this.onDropdownShow,this),i.__super__.constructor.apply(this,arguments),this.bindId=App.OverviewIndexCollection.bind(this.render),this.controllerBind("ui:rerender",(e=this,function(){return e.render(App.OverviewIndexCollection.get())})),this.vertical&&$(window).on("resize.navbar",this.autoFoldTabs)}return e(i,n),i.prototype.elements={".js-tabsHolder":"tabsHolder",".js-tabsClone":"clone",".js-tabClone":"tabClone",".js-tabs":"tabs",".js-tab":"tab",".js-dropdown":"dropdown",".js-toggle":"dropdownToggle",".js-dropdownItem":"dropdownItem"},i.prototype.events={"click .js-tab":"activate","click .js-dropdownItem":"navigateTo","hide.bs.dropdown":"onDropdownHide","show.bs.dropdown":"onDropdownShow"},i.prototype.navigateTo=function(t){return location.hash=$(t.currentTarget).attr("data-target")},i.prototype.onDropdownShow=function(){return this.dropdownToggle.addClass("active")},i.prototype.onDropdownHide=function(){return this.dropdownToggle.removeClass("active")},i.prototype.activate=function(t){return this.tab.removeClass("active"),$(t.currentTarget).addClass("active")},i.prototype.release=function(){return this.vertical&&$(window).off("resize.navbar",this.autoFoldTabs),App.OverviewIndexCollection.unbindById(this.bindId)},i.prototype.autoFoldTabs=function(){var t;if(t=App.OverviewIndexCollection.get()){for(App.UserOverviewSorting.count()?t.sort(App.UserOverviewSortingOverview.overviewSort):t.sort((function(t,e){return t.prio-e.prio})),this.html(App.view("agent_ticket_view/navbar"+(this.vertical?"_vertical":void 0))({items:t,isAgent:this.permissionCheck("ticket.agent")}));this.clone.width()>this.tabsHolder.width();)this.tabClone.not(".hide").last().addClass("hide"),this.tab.not(".hide").last().addClass("hide"),this.dropdownItem.filter(".hide").last().removeClass("hide");return 0===this.dropdownItem.not(".hide").length?(this.dropdown.remove(),this.dropdownToggle.remove()):void 0}},i.prototype.active=function(t){return this.activeState=t},i.prototype.update=function(t){var e,n;for(e in null==t&&(t={}),t)n=t[e],this[e]=n;return this.render(App.OverviewIndexCollection.get())},i.prototype.render=function(t){var e,n,i,s,r,o,a;if(t){if(e=this.el.closest(".content"),_.isArray(t)&&_.isEmpty(t))return e.find(".sidebar").addClass("hide"),e.find(".main").addClass("hide"),e.find(".js-error").removeClass("hide"),void this.renderScreenError({el:this.el.closest(".content").find(".js-error"),detail:__("Currently no overview is assigned to your roles. Please contact your administrator."),objectName:"Ticket"});if(e.find(".sidebar").removeClass("hide"),e.find(".main").removeClass("hide"),e.find(".js-error").addClass("hide"),this.vertical&&(t&&t.length<=1?this.el.addClass("hidden"):this.el.removeClass("hidden")),this.activeState&&this.view&&!this.vertical)for(n=0,r=t.length;n<r;n++)(i=t[n]).link===this.view&&this.title(i.name,!0);if(!this.view&&t&&t[0]&&t[0].link&&App.WebSocket.send({event:"ticket_overview_select",data:{view:t[0].link}}),this.activeState&&!this.view&&!this.vertical)return a=t[0].link,void this.navigate("#ticket/view/"+a,{hideCurrentLocationFromHistory:!0});for(s=0,o=t.length;s<o;s++)(i=t[s]).target="#ticket/view/"+i.link,i.link===this.view?(i.active=!0,i):i.active=!1;return App.UserOverviewSorting.count()?t.sort(App.UserOverviewSortingOverview.overviewSort):t.sort((function(t,e){return t.prio-e.prio})),this.html(App.view("agent_ticket_view/navbar"+(this.vertical?"_vertical":""))({items:t})),this.vertical?this.autoFoldTabs():void 0}},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketOverviewSettings=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),this.onClose=t(this.onClose,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.headPrefix="Edit",i.prototype.content=function(){return this.overview=App.Overview.find(this.overview_id),this.head=this.overview.name,this.configure_attributes_article=[],"d"===this.view_mode&&this.configure_attributes_article.push({name:"view::per_page",display:__("Items per page"),tag:"select",multiple:!1,null:!1,default:this.overview.view.per_page,options:{5:" 5",10:"10",15:"15",20:"20",25:"25"}}),this.configure_attributes_article.push({name:"view::"+this.view_mode,display:__("Attributes"),tag:"checkboxTicketAttributes",default:this.overview.view[this.view_mode],null:!1,translate:!0,sortBy:null},{name:"order::by",display:__("Sorting by"),tag:"selectTicketAttributes",default:this.overview.order.by,null:!1,translate:!0,sortBy:null},{name:"order::direction",display:__("Sorting order"),tag:"select",default:this.overview.order.direction,null:!1,translate:!0,options:{ASC:__("ascending"),DESC:__("descending")}},{name:"group_by",display:__("Grouping by"),tag:"select",default:this.overview.group_by,null:!0,nulloption:!0,translate:!0,options:App.Overview.groupByAttributes()},{name:"group_direction",display:__("Grouping order"),tag:"select",default:this.overview.group_direction,null:!1,translate:!0,options:{ASC:__("ascending"),DESC:__("descending")}}),new App.ControllerForm({model:{configure_attributes:this.configure_attributes_article},autofocus:!1}).form},i.prototype.onClose=function(){if(this.onCloseCallback)return this.onCloseCallback()},i.prototype.onSubmit=function(t){var e,n,i,s,r;for(e in n=this.formParam(t.target),this.reload_needed=!1,this.overview.order.by!==n.order.by&&(this.overview.order.by=n.order.by,this.reload_needed=!0),this.overview.order.direction!==n.order.direction&&(this.overview.order.direction=n.order.direction,this.reload_needed=!0),this.overview.group_direction!==n.group_direction&&(this.overview.group_direction=n.group_direction,this.reload_needed=!0),i=n.view)s=i[e],this.overview.view[e]=s;return this.overview.group_by=n.group_by,this.overview.save({done:(r=this,function(){return r.reload_needed?App.OverviewListCollection.fetch(r.overview.link):(App.OverviewIndexCollection.trigger(),App.OverviewListCollection.trigger(r.overview.link)),r.close()})})},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty,i=[].indexOf||function(t){for(var e=0,n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return-1};App.TicketOverviewTable=function(n){function s(){var e;this.settings=t(this.settings,this),this.viewmode=t(this.viewmode,this),this.shouldShowBulkForm=t(this.shouldShowBulkForm,this),this.renderCustomerNotTicketExistIfNeeded=t(this.renderCustomerNotTicketExistIfNeeded,this),this.render=t(this.render,this),this.updateTable=t(this.updateTable,this),this.update=t(this.update,this),this.release=t(this.release,this),this.hide=t(this.hide,this),this.show=t(this.show,this),s.__super__.constructor.apply(this,arguments),this.view&&(this.bindId=App.OverviewListCollection.bind(this.view,this.updateTable)),this.controllerBind("ui:rerender",(e=this,function(){if(e.authenticateCheck()&&e.view)return e.render(App.OverviewListCollection.get(e.view))}))}return e(s,n),s.extend(App.PopoverProvidable),s.registerPopovers("Organization","User"),s.prototype.events={"click [data-type=settings]":"settings","click [data-type=viewmode]":"viewmode"},s.prototype.show=function(){if(this.table)return this.table.show()},s.prototype.hide=function(){if(this.table)return this.table.hide()},s.prototype.release=function(){if(this.bindId)return App.OverviewListCollection.unbind(this.bindId)},s.prototype.update=function(t){var e,n;for(e in t)n=t[e],this[e]=n;if(this.view)return this.view?(this.bindId&&App.OverviewListCollection.unbind(this.bindId),this.bindId=App.OverviewListCollection.bind(this.view,this.updateTable)):void 0},s.prototype.updateTable=function(t){var e,n,i,s,r,o;if(this.table){if(i=t.overview,o=t.tickets,i||o){for(r=[],e=0,n=o.length;e<n;e++)s=o[e],r.push(App.Ticket.fullLocal(s.id));return this.overview=App.Overview.find(i.id),this.removePopovers(),this.table.update({overviewAttributes:this.convertOverviewAttributesToArray(this.overview.view.s),objects:r,groupBy:this.overview.group_by,groupDirection:this.overview.group_direction,orderBy:this.overview.order.by,orderDirection:this.overview.order.direction}),this.renderPopovers({doNotBind:!0})}}else this.render(t)},s.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,_,w,k,A,C;if(t&&(y=t.overview,A=t.tickets,y||A)){for(this.view_mode=App.LocalStorage.get("mode:"+this.view,this.Session.get("id"))||"s",App.WebSocket.send({event:"ticket_overview_select",data:{view:this.view}}),k=[],f=0,m=A.length;f<m;f++)w=A[f],k.push(App.Ticket.fullLocal(w.id));var T;if(!this.renderCustomerNotTicketExistIfNeeded(k))return this.overview=App.Overview.find(y.id),p=!1,h=!1,this.permissionCheck("admin.overview")&&(h=!0),this.permissionCheck("ticket.agent")&&(p=!0),C=[],this.permissionCheck("ticket.agent")&&(C=[{name:"S",type:"s",class:"s"===this.view_mode?"active":void 0},{name:"M",type:"m",class:"m"===this.view_mode?"active":void 0}]),d=App.view("agent_ticket_view/content")({overview:this.overview,view_modes:C,edit:h}),d=$(d),this.html(d),b="","m"===this.view_mode?(b=App.view("agent_ticket_view/detail")({overview:this.overview,objects:k,checkbox:p}),(b=$(b)).on("change",'[name="bulk_all"]',(function(t){return $(t.currentTarget).prop("checked")?$(t.currentTarget).closest("table").find('[name="bulk"]').prop("checked",!0):$(t.currentTarget).closest("table").find('[name="bulk"]').prop("checked",!1)})),this.$(".table-overview").append(b)):(T=this,v=function(t){if(w=App.Ticket.findNative(t))return App.TaskManager.execute({key:"Ticket-"+w.id,controller:"TicketZoom",params:{ticket_id:w.id,overview_id:T.overview.id},show:!0}),T.navigate(w.uiUrl())},c=function(t,e,n){return n.title=e.title,t},a=function(t,e,n){return n.link=e.uiUrl(),t},u=function(t,e,n){var i;return e?(i=void 0,"customer_id"===n.name&&(i=e.customer_id),"owner_id"===n.name&&(i=e.owner_id),i?(n.class="user-popover",n.data={id:i},t):t):t},l=function(t,e,n){return e&&e.organization_id?(n.class="organization-popover",n.data={id:e.organization_id},t):t},n=function(t){return function(e,n,i){var s,r,o,a,l;return t.shouldShowBulkForm()?(t.bulkForm.render(),t.bulkForm.show()):t.bulkForm.hide(),t.lastChecked&&i.shiftKey&&(s=$(i.currentTarget).parents(".item"),a=$(t.lastChecked).parents(".item"),o=s.parent().children(),s.index()>a.index()?(l=a.index(),r=s.index()):(l=s.index(),r=a.index()),o.slice(l+1,r).find('[name="bulk"]').prop("checked",(function(){return!this.checked}))),t.lastChecked=i.currentTarget,t.bulkForm.updateTicketIdsBulkForm(i)}}(this),function(t,e,n){var i;return" ",e.priority?n.title=e.priority():n.title=App.i18n.translateInline(null!=(i=App.TicketPriority.findNative(this.priority_id))?i.displayName():void 0),e.priorityIcon()},o=function(t){var e;return e={name:"icon_priority",display:"",translation:!1,width:"24px",displayWidth:24,unresizable:!0},t.unshift(0),t[0]=e,t},r=function(t,e,n){var i;return" ",i=App.TicketPriority.findNative(e.priority_id),n.title=App.i18n.translateInline(null!=i?i.name:void 0),e.priorityIcon()},i=[s=function(t){var e;return e={name:"icon",display:"",parentClass:"noTruncate",translation:!1,width:"28px",displayWidth:28,unresizable:!0},t.unshift(0),t[0]=e,t}],e={icon:[function(t,e,n){return t=" ",n.class=e.iconClass(),n.link="",n.title=e.iconTitle(),t}],customer_id:[u],organization_id:[l],owner_id:[u],title:[a,c],number:[a,c]},
!0===App.Config.get("ui_ticket_overview_priority_icon")&&(i=[s,o],e.icon_priority=[r]),_={tableId:"ticket_overview_"+this.overview.id,overview:this.convertOverviewAttributesToArray(this.overview.view.s),el:this.$(".table-overview"),model:App.Ticket,objects:k,checkbox:p,groupBy:this.overview.group_by,groupDirection:this.overview.group_direction,orderBy:this.overview.order.by,orderDirection:this.overview.order.direction,class:"table--light",bindRow:{events:{click:v}},callbackHeader:i,callbackAttributes:e,autoAlignLastColumn:!0,bindCheckbox:{events:{click:n},select_all:n}},0!==this.el.width()&&(this.elWidth=this.el.width()),this.elWidth&&(_.availableWidth=this.elWidth),this.table=new App.ControllerTable(_)),this.renderPopovers({doNotBind:!0}),this.bulkForm&&this.bulkForm.releaseController(),this.bulkForm=new App.TicketBulkForm({el:this.el.find(".bulkAction"),holder:this.el,view:this.view,batchSuccess:function(t){return function(){return t.render()}}(this)}),0!==(g=this.$(".table-overview")).find('input[name="bulk"]:checked').length&&this.bulkForm.show(),g.on("change",'input[name="bulk"], input[name="bulk_all"]',function(t){return function(){return t.shouldShowBulkForm()?t.bulkForm.show():(t.bulkForm.hide(),t.bulkForm.reset())}}(this)),g.on("change",'[name="bulk"]',(function(){var t,e,n;return t=g.find('[name="bulk_all"]'),n=g.find('input[name="bulk"]:checked').length,e=g.find('input[name="bulk"]').length,0===n?(t.prop("indeterminate",!1),t.prop("checked",!1)):n===e?(t.prop("indeterminate",!1),t.prop("checked",!0)):(t.prop("checked",!1),t.prop("indeterminate",!0))}))}},s.prototype.convertOverviewAttributesToArray=function(t){return Array.isArray(t)||(t=[t]),t},s.prototype.renderCustomerNotTicketExistIfNeeded=function(t){var e,n,i;if(n=App.User.current(),this.stopListening(n,"refresh"),!t[0]&&!this.permissionCheck("ticket.agent"))return e=n.lifetimeCustomerTicketsCount(),this.html(App.view("customer_not_ticket_exists")({has_any_tickets:e>0,is_allowed_to_create_ticket:this.Config.get("customer_ticket_create")})),0===e&&this.listenTo(n,"refresh",(i=this,function(){if(e!==n.lifetimeCustomerTicketsCount())return i.renderCustomerNotTicketExistIfNeeded([])})),!0},s.prototype.shouldShowBulkForm=function(){var t,e,n,s;return 0!==(e=this.$("table").find('input[name="bulk"]:checked')).length&&(s=_.map(e,(function(t){return $(t).val()})),n=_.map(App.Ticket.findAll(s),(function(t){return t.group_id})),n=_.uniq(n),t=App.User.find(this.Session.get("id")).allGroupIds("change"),t=_.map(t,(function(t){return parseInt(t,10)})),_.every(n,(function(e){return i.call(t,e)>=0})))},s.prototype.viewmode=function(t){return t.preventDefault(),this.view_mode=$(t.target).data("mode"),App.LocalStorage.set("mode:"+this.view,this.view_mode,this.Session.get("id")),this.fetch()},s.prototype.settings=function(t){return t.preventDefault(),this.keyboardOff(),new App.TicketOverviewSettings({overview_id:this.overview.id,view_mode:this.view_mode,container:this.el.closest(".content"),onCloseCallback:this.keyboardOn})},s}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.TicketSharedDraftModal=function(i){function s(){this.attachmentsImported=e(this.attachmentsImported,this),this.contentView=new t({shared_draft:arguments[0].shared_draft}),s.__super__.constructor.apply(this,arguments),this.shared_draft.constructor.needsLoading&&this.load(),this.controllerBind(this.importCallbackName(),this.attachmentsImported)}return n(s,i),s.prototype.head=__("Apply Shared Draft"),s.prototype.events={"click .js-delete":"onDelete"},s.prototype.buttonClose=!0,s.prototype.buttonCancel=!0,s.prototype.buttonSubmit="Apply",s.prototype.leftButtons=[{text:"Delete",className:"js-delete"}],s.prototype.content=function(){return this.contentView.el},s.prototype.importCallbackName=function(){return"import_attachments_done-"+this.controllerId},s.prototype.load=function(){return this.startLoading(),this.ajax({id:"shared_draft_"+this.shared_draft.id,type:"GET",url:this.apiPath+"/tickets/shared_drafts/"+this.shared_draft.id,processData:!0,success:(t=this,function(e){return App.Collection.loadAssets(e.assets),t.shared_draft_content=e.shared_draft_content,t.contentView.loadContent(t.shared_draft_content),t.stopLoading()}),error:function(t){return function(){return t.stopLoading()}}(this)});var t},s.prototype.onSubmit=function(){return this.hasChanges?new App.TicketSharedDraftOverwriteModal({head:__("Apply Draft"),message:__("There is existing content. Do you want to overwrite it?"),onSaveDraft:(t=this,function(){return t.disable(!0),t.applyAttachments()})}):(this.disable(!0),void this.applyAttachments());var t},s.prototype.attachmentsImported=function(t){if(t.success)return this.applyMeta(t),this.cancel();this.disable(!1)},s.prototype.disable=function(t){return this.el.find(".js-submit").attr("disabled",t)},s.prototype.applyAttachments=function(){switch(this.shared_draft.constructor){case App.TicketSharedDraftZoom:return App.Event.trigger("ui::ticket::import_draft_attachments",{shared_draft_id:this.shared_draft.id,ticket_id:this.parent.ticket_id,callbackName:this.importCallbackName()});case App.TicketSharedDraftStart:return App.Event.trigger("ticket_create_import_draft_attachments",{shared_draft_id:this.shared_draft.id,callbackName:this.importCallbackName()})}},s.prototype.applyMeta=function(t){var e,n;switch(this.shared_draft.constructor){case App.TicketSharedDraftZoom:return this.parent.$(".article-add"),n=this.shared_draft.new_article,App.Event.trigger("ui::ticket::setArticleType",{ticket:{id:this.parent.ticket_id},type:{name:n.type},article:n,nofocus:!0,shared_draft_id:this.shared_draft.id}),App.Event.trigger("ui::ticket::load",{ticket_id:this.parent.ticket_id,draft:this.shared_draft.ticket_attributes});case App.TicketSharedDraftStart:return(e=_.clone(this.shared_draft_content)).group_id=this.shared_draft.group_id,e.attachments=t.attachments,App.Event.trigger("ticket_create_rerender",{options:e,shared_draft_id:this.shared_draft.id})}},s.prototype.onDelete=function(t){var e;return t.preventDefault(),e=this,new App.ControllerModal({container:this.container,buttonClose:!0,buttonCancel:!0,buttonSubmit:__("Yes"),buttonClass:"btn--danger",head:__("Are you sure?"),small:!0,content:function(){return App.i18n.translateContent("Do you really want to delete this draft?")},onSubmit:function(){switch(this.startLoading(),e.shared_draft.constructor){case App.TicketSharedDraftZoom:return this.ajax({id:"ticket_shared_draft_delete",type:"DELETE",url:this.apiPath+"/tickets/"+e.parent.ticket_id+"/shared_draft",success:(t=this,function(){return t.stopLoading(),t.cancel(),e.cancel(),e.shared_draft.remove({clear:!0}),e.parent.draftFetched()})});case App.TicketSharedDraftStart:return this.ajax({id:"ticket_shared_draft_delete",type:"DELETE",url:this.apiPath+"/tickets/shared_drafts/"+e.shared_draft.id,success:function(t){return function(){return t.stopLoading(),t.cancel(),e.cancel(),e.shared_draft.remove({clear:!0}),e.parent.render()}}(this)})}var t}})},s}(App.ControllerModal),t=function(t){function i(){this.loadContent=e(this.loadContent,this),i.__super__.constructor.apply(this,arguments),this.render()}return n(i,t),i.prototype.body=function(){var t;switch(this.shared_draft.constructor){case App.TicketSharedDraftZoom:return this.shared_draft.new_article.body;case App.TicketSharedDraftStart:return null!=(t=this.shared_draft_content)?t.body:void 0}},i.prototype.author=function(){return App.User.find(this.shared_draft.updated_by_id)},i.prototype.timestamp=function(){return new Date(this.shared_draft.updated_at)},i.prototype.loadContent=function(t){return this.shared_draft_content=t,this.render()},i.prototype.render=function(){return this.html(App.view("ticket_shared_draft_modal")({body:this.body(),name:this.author().displayName(),timestamp:this.timestamp()})),new App.WidgetAvatar({el:this.$(".js-avatar"),object_id:this.shared_draft.updated_by_id,size:40})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketSharedDraftOverwriteModal=function(n){function i(){return this.post=t(this.post,this),this.showDraft=t(this.showDraft,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.head=__("Save Draft"),i.prototype.message=__("There is an existing draft. Do you want to overwrite it?"),i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Overwrite Draft"),i.prototype.buttonClass="btn--danger",i.prototype.onShowDraft=null,i.prototype.onSaveDraft=null,i.prototype.showDraft=function(t){return t.preventDefault(),this.cancel(),this.onShowDraft(t)},i.prototype.onSubmit=function(){return this.onSaveDraft(),this.close()},i.prototype.post=function(){var t;if(this.onShowDraft)return(t=$("<div class='btn'>"+App.Utils.icon("note")+" "+__("Show Draft")+"</div>")).click(this.showDraft),this.el.find(".modal-rightFooter").prepend(t)},i}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.TicketZoom=function(t){function i(t){var n,s,r;this.hideCopyTicketNumberTooltip=e(this.hideCopyTicketNumberTooltip,this),this.copyTicketNumber=e(this.copyTicketNumber,this),this.taskReset=e(this.taskReset,this),this.taskUpdateAll=e(this.taskUpdateAll,this),this.taskUpdateAttachments=e(this.taskUpdateAttachments,this),this.taskUpdate=e(this.taskUpdate,this),this.taskGet=e(this.taskGet,this),this.reset=e(this.reset,this),this.draft=e(this.draft,this),this.submitPost=e(this.submitPost,this),this.draftSaveToServer=e(this.draftSaveToServer,this),this.saveDraft=e(this.saveDraft,this),this.submit=e(this.submit,this),this.submitEnable=e(this.submitEnable,this),this.submitDisable=e(this.submitDisable,this),this.ticketParams=e(this.ticketParams,this),this.markFormDiff=e(this.markFormDiff,this),this.formCurrent=e(this.formCurrent,this),this.currentStore=e(this.currentStore,this),this.markForm=e(this.markForm,this),this.autosaveStart=e(this.autosaveStart,this),this.autosaveStop=e(this.autosaveStop,this),this.scrollToBottom=e(this.scrollToBottom,this),this.scrollToArticle=e(this.scrollToArticle,this),this.render=e(this.render,this),this.articleParams=e(this.articleParams,this),this.setPendingTimeReminderDelay=e(this.setPendingTimeReminderDelay,this),this.pendingTimeReminderReached=e(this.pendingTimeReminderReached,this),this.positionPageHeaderUpdate=e(this.positionPageHeaderUpdate,this),this.positionPageHeaderStop=e(this.positionPageHeaderStop,this),this.positionPageHeaderStart=e(this.positionPageHeaderStart,this),this.articleNavigate=e(this.articleNavigate,this),this.shortcutNavigationstop=e(this.shortcutNavigationstop,this),this.shortcutNavigationStart=e(this.shortcutNavigationStart,this),this.muteTask=e(this.muteTask,this),this.release=e(this.release,this),this.changed=e(this.changed,this),this.hide=e(this.hide,this),this.currentPosition=e(this.currentPosition,this),this.setPosition=e(this.setPosition,this),this.pagePosition=e(this.pagePosition,this),this.scrollToPosition=e(this.scrollToPosition,this),this.show=e(this.show,this),this.url=e(this.url,this),this.meta=e(this.meta,this),this.load=e(this.load,this),this.fetch=e(this.fetch,this),this.fetchMayBe=e(this.fetchMayBe,this),i.__super__.constructor.apply(this,arguments),this.formMeta=void 0,this.ticket_id=parseInt(t.ticket_id),this.article_id=t.article_id,this.sidebarState={},this.tooltipCopied=void 0,t.init?this.overview_id=void 0:this.overview_id=t.overview_id,this.key="ticket::"+this.ticket_id,(n=App.SessionStorage.get(this.key))&&this.load(n),r=this,s=function(){return r.fetch()},this.interval(s,18e5,"pull_check"),this.controllerBind("Ticket:update Ticket:touch",function(t){return function(e){if(e.id.toString()===t.ticket_id.toString())return t.fetchMayBe(e)}}(this)),this.controllerBind("ws:login",function(t){return function(){if(!t.initiallyFetched)return t.initiallyFetched=!0;t.fetch()}}(this)),this.controllerBind("ui::ticket::sidebarRerender",function(t){return function(e){if(e.taskKey===t.taskKey&&t.sidebarWidget)return t.sidebarWidget.render(t.formCurrent())}}(this))}return n(i,t),i.include(App.TicketNavigable),i.prototype.elements={".main":"main",".ticketZoom":"ticketZoom",".scrollPageHeader":"scrollPageHeader"},i.prototype.events={"click .js-submit":"submit","click .js-bookmark":"bookmark","click .js-reset":"reset","click .js-draft":"draft","click .main":"muteTask","click .ticket-number-copy-header > .ticketNumberCopy-icon":"copyTicketNumber"},i.prototype.fetchMayBe=function(t){var e,n;if(!(this.ticketUpdatedAtLastCall&&new Date(t.updated_at).getTime()<=new Date(this.ticketUpdatedAtLastCall).getTime()))return n=this,e=function(){return n.fetch()},this.delay(e,1e3,"ticket-zoom-"+this.ticket_id)},i.prototype.fetch=function(){var t,e;if(this.Session.get())return t=!1,this.initFetched||(t=!0),this.ajax({id:"ticket_zoom_"+this.ticket_id,type:"GET",url:this.apiPath+"/tickets/"+this.ticket_id+"?all=true&auto_assign=true",processData:!0,queue:t,success:(e=this,function(t){return e.load(t),App.SessionStorage.set(e.key,t)}),error:function(t){return function(e){var n,i,s;if(s=e.statusText,i=e.status,n=e.responseText,"abort"!==s){if(t.renderDone=!1,!t.ticketUpdatedAtLastCall||0!==i)return 403===i||"Not authorized"===s?(t.taskHead="\xbb "+App.i18n.translateInline("Not authorized")+" \xab",t.taskIconClass="diagonal-cross",t.renderScreenUnauthorized({objectName:"Ticket"})):404===i||"Not Found"===s?(t.taskHead="\xbb "+App.i18n.translateInline("Not Found")+" \xab",t.taskIconClass="diagonal-cross",t.renderScreenNotFound({objectName:"Ticket"})):(t.taskHead="\xbb "+App.i18n.translateInline("Error")+" \xab",t.taskIconClass="diagonal-cross",n||(n=__("General communication error, maybe internet is not available!")),t.renderScreenError({status:i,detail:n,objectName:"Ticket"}));console.log("network issues e. g. temp. no connection",i,s,n)}}}(this)})},i.prototype.load=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f;if(null==e&&(e=!1),a=t.assets.Ticket[this.ticket_id],f=null!=(c=this.ticket)?c.currentView():void 0,l=null!=(u=this.ticket)?u.userGroupAccess("read"):void 0,i=null!=(p=this.ticket)?p.userGroupAccess("change"):void 0,o=null!=(h=this.ticket)?h.userGroupAccess("full"):void 0,r=t.form_meta,!this.view||_.isEqual(this.formMeta.configure_attributes,r.configure_attributes)&&_.isEqual(this.formMeta.dependencies,r.dependencies)&&_.isEqual(this.formMeta.filter,r.filter)&&this.view===f&&this.readable===l&&this.changeable===i&&this.fullable===o||(this.renderDone=!1),d=this.ticketUpdatedAtLastCall&&new Date(a.updated_at).getTime()<=new Date(this.ticketUpdatedAtLastCall).getTime(),!this.renderDone||!d)return this.ticketUpdatedAtLastCall=a.updated_at,this.initFetched&&!d&&a.updated_by_id!==this.Session.get("id")&&App.TaskManager.notify(this.taskKey),this.initFetched=!0,this.doNotLog||(this.doNotLog=1,this.recentView("Ticket",this.ticket_id)),this.ticket_article_ids=t.ticket_article_ids,this.links=t.links,this.tags=t.tags,this.mentions=t.mentions,this.time_accountings=t.time_accountings,(s=App.TicketSharedDraftZoom.findByAttribute("ticket_id",this.ticket_id))&&s.remove({clear:!0}),App.Collection.loadAssets(t.assets,{targetModel:"Ticket"}),this.ticket=App.Ticket.fullLocal(this.ticket_id),this.ticket.article=void 0,this.view=this.ticket.currentView(),this.readable=this.ticket.userGroupAccess("read"),this.changeable=this.ticket.userGroupAccess("change"),this.fullable=this.ticket.userGroupAccess("full"),this.formMeta=t.form_meta,n=this.renderDone,this.render(e),n?App.Event.trigger("ui::ticket::load",t):void 0},i.prototype.meta=function(){var t,e;return t={url:this.url(),id:this.ticket_id},this.taskIconClass&&(t.iconClass=this.taskIconClass),this.taskHead&&(t.head=this.taskHead),this.ticket_id&&App.Ticket.exists(this.ticket_id)&&(e=App.Ticket.findNative(this.ticket_id),t.head=e.title,t.title="#"+e.number+" - "+e.title,t.class="task-state-"+e.getState(),t.type="task",t.iconTitle=e.iconTitle(),t.iconClass=e.iconClass()),t},i.prototype.url=function(){return"#ticket/zoom/"+this.ticket_id},i.prototype.show=function(t){if(this.navupdate({url:"#",type:"menu"}),App.OnlineNotification.seen("Ticket",this.ticket_id),window.matchMedia("(max-width: 767px)").matches&&(this.el.find(".tabsSidebar").addClass("is-closed"),this.el.find(".tabsSidebar-sidebarSpacer").addClass("is-closed")),this.activeState&&this.ticket_article_ids&&(this.shown=!1),this.activeState=!0,this.pagePosition(t),this.positionPageHeaderStart(),this.autosaveStart(),this.shortcutNavigationStart(),this.articleNew&&this.articleNew.show(),this.attributeBar)return this.attributeBar.start(),this.renderDone&&null!=t.overview_id&&this.overview_id!==t.overview_id?(this.overview_id=t.overview_id,this.renderOverviewNavigator(this.el)):void 0},i.prototype.scrollToPosition=function(t,e,n){var i,s;return s=this,i=function(){return"article"===t?(s.scrollToArticle(n),void s.positionPageHeaderUpdate()):(s.scrollToBottom(),s.positionPageHeaderUpdate())},this.delay(i,e,"scrollToPosition")},i.prototype.pagePosition=function(t){var e;if(null==t&&(t={}),!this.el.is(":hidden")&&("init"!==t.type||this.shown))return t.article_id?(e=t.article_id,t.article_id=void 0):this.pagePositionData&&(e=this.pagePositionData,this.pagePositionData=void 0),e&&e!==this.last_article_id?this.scrollToPosition("article",300,e):this.last_ticket_article_ids&&_.isEqual(_.sortBy(this.last_ticket_article_ids),_.sortBy(this.ticket_article_ids))?this.shown||(App.Event.trigger("ui::ticket::shown",{ticket_id:this.ticket_id}),this.scrollToPosition("bottom",50,e)):(App.Event.trigger("ui::ticket::shown",{ticket_id:this.ticket_id}),this.scrollToPosition("bottom",100,e)),this.shown=!0,this.last_ticket_article_ids=this.ticket_article_ids,this.last_article_id=e},i.prototype.setPosition=function(t){return this.$(".main").scrollTop(t)},i.prototype.currentPosition=function(){var t,e;return(t=this.$(".main .ticketZoom").offset())&&(e=t.top),Math.abs(e)},i.prototype.hide=function(){if(this.activeState=!1,this.shown&&$("body > .modal").modal("hide"),this.positionPageHeaderStop(),this.autosaveStop(),this.shortcutNavigationstop(),this.hideCopyTicketNumberTooltip(),this.attributeBar)return this.attributeBar.stop()},i.prototype.changed=function(){var t,e,n;return!!this.ticket&&(t=this.formCurrent(),e=this.currentStore(),!(!(n=this.formDiff(t,e))||_.isEmpty(n))&&(!_.isEmpty(n.ticket)||!_.isEmpty(n.article)))},i.prototype.release=function(){return this.autosaveStop(),this.positionPageHeaderStop()},i.prototype.muteTask=function(){return App.TaskManager.mute(this.taskKey)},i.prototype.shortcutNavigationStart=function(){var t,e;return this.articlePager={article_id:void 0},t="alt+ctrl+left",$(document).on("keydown.ticket_zoom"+this.ticket_id,t,(e=this,function(){return e.articleNavigate("ascending")})),t="alt+ctrl+right",$(document).on("keydown.ticket_zoom"+this.ticket_id,t,function(t){return function(){return t.articleNavigate("descending")}}(this))},i.prototype.shortcutNavigationstop=function(){return $(document).off("keydown.ticket_zoom"+this.ticket_id)},i.prototype.articleNavigate=function(t){var e,n,i,s,r;for(n=[],this.$(".ticket-article .ticket-article-item").each((function(t,e){var i,s,r;return s=(i=$(e)).data("id"),r=i.visible(!0),n.push({article_id:s,visible:r})})),"ascending"===t&&(n=n.reverse()),s=void 0,i=0,r=n.length;i<r;i++){if(e=n[i],s)return this.scrollToArticle(e.article_id),void(this.articlePager.article_id=e.article_id);this.articlePager.article_id?this.articlePager.article_id===e.article_id&&(s=e.article_id):e.visible&&(s=e.article_id)}},i.prototype.positionPageHeaderStart=function(){return this.positionPageHeaderUpdate(),this.main.on("scroll",this.positionPageHeaderUpdate)},i.prototype.positionPageHeaderStop=function(){return this.main.off("scroll",this.positionPageHeaderUpdate)},i.scrollHeaderPos=void 0,i.prototype.positionPageHeaderUpdate=function(){var t,e,n,i;if(t=this.scrollPageHeader.outerHeight(),n=this.main.prop("scrollHeight"),e=this.main.height(),i=this.main.scrollTop(),!n>e+t)this.scrollPageHeader.css("transform","translateY("+-t+"px)");else{if(i>t&&(i=t),i!==this.scrollHeaderPos)return this.scrollPageHeader.css("transform","translateY("+(i-t)+"px)"),this.scrollHeaderPos=i;this.hideCopyTicketNumberTooltip()}},i.prototype.pendingTimeReminderReached=function(){return App.TaskManager.touch(this.taskKey)},i.prototype.setPendingTimeReminderDelay=function(){var t,e,n,i;if("pending reminder"===(null!=(i=App.TicketStateType.find(null!=(e=this.ticket)&&null!=(n=e.state)?n.state_type_id:void 0))?i.name:void 0))return t=new Date(this.ticket.pending_time)-new Date,this.delay(this.pendingTimeReminderReached,t,"pendingTimeReminderDelay")},i.prototype.articleParams=function(){var t;return null!=(t=this.articleNew)?t.params():void 0},i.prototype.render=function(t){var e,n;return this.setPendingTimeReminderDelay(),App.TaskManager.touch(this.taskKey),this.renderDone||(this.renderDone=!0,this.autosaveLast={},this.scrollHeaderPos=void 0,e=$(App.view("ticket_zoom")({ticket:this.ticket,nav:this.nav,scrollbarWidth:App.Utils.getScrollBarWidth(),dir:App.i18n.dir()})),this.renderOverviewNavigator(e),new App.TicketZoomTitle({object_id:this.ticket_id,overview_id:this.overview_id,el:e.find(".js-ticketTitleContainer"),taskKey:this.taskKey}),new App.TicketZoomMeta({object_id:this.ticket_id,el:e.find(".js-ticketMetaContainer")}),this.attributeBar=new App.TicketZoomAttributeBar({ticket:this.ticket,el:e.find(".js-attributeBar"),overview_id:this.overview_id,macroCallback:this.submit,draftCallback:this.saveDraft,draftState:this.draftState(),taskKey:this.taskKey}),this.form_id=this.taskGet("article").form_id||App.ControllerForm.formId(),this.ticket.editable()&&(this.articleNew=new App.TicketZoomArticleNew({ticket:this.ticket,ticket_id:this.ticket_id,el:e.find(".article-new"),formMeta:this.formMeta,form_id:this.form_id,defaults:this.taskGet("article"),taskKey:this.taskKey,ui:this,richTextUploadStartCallback:this.submitDisable,richTextUploadRenderCallback:(n=this,function(t){return n.submitEnable(),n.taskUpdateAttachments("article",t),n.delay(n.markForm,250,"ticket-zoom-form-update")}),richTextUploadDeleteCallback:function(t){return function(e){return t.taskUpdateAttachments("article",e),t.delay(t.markForm,250,"ticket-zoom-form-update")}}(this)}),this.highlighter=new App.TicketZoomHighlighter({el:e.find(".js-highlighterContainer"),ticket:this.ticket,ticket_id:this.ticket_id})),new App.TicketZoomSetting({el:e.find(".js-settingContainer"),ticket_id:this.ticket_id}),this.articleView=new App.TicketZoomArticleView({ticket:this.ticket,el:e.find(".ticket-article"),ui:this,highlighter:this.highlighter,ticket_article_ids:this.ticket_article_ids,form_id:this.form_id}),new App.TicketCustomerAvatar({object_id:this.ticket_id,el:e.find(".ticketZoom-header")}),new App.TicketOrganizationAvatar({object_id:this.ticket_id,el:e.find(".ticketZoom-header")}),this.sidebarWidget=new App.TicketZoomSidebar({el:e,sidebarState:this.sidebarState,object_id:this.ticket_id,model:"Ticket",query:this.query,taskGet:this.taskGet,taskKey:this.taskKey,formMeta:this.formMeta,markForm:this.markForm,tags:this.tags,mentions:this.mentions,time_accountings:this.time_accountings,links:this.links,parent:this})),e?this.html(e):this.articleView.execute({ticket_article_ids:this.ticket_article_ids}),this.sidebarWidget&&this.sidebarWidget.reload({tags:this.tags,mentions:this.mentions,time_accountings:this.time_accountings,links:this.links}),this.initDone?t?void 0:this.pagePosition({type:"init"}):(this.article_id&&(this.pagePositionData=this.article_id),this.pagePosition({type:"init"}),this.positionPageHeaderStart(),void(this.initDone=!0))},i.prototype.scrollToArticle=function(t){var e,n;if(e=document.getElementById("article-"+t))return n=e.offsetTop-100,this.main.animate({scrollTop:n},100)},i.prototype.scrollToBottom=function(){var t;if(t=0,t+=this.$(".ticketZoom-controls").height(),t+=this.$(".ticketZoom-header").height(),t+=this.$(".ticket-article").height(),t+=this.$(".article-new").height(),!(this.$(".main").height()>t))return this.main.scrollTop(this.main.prop("scrollHeight"));this.main.scrollTop(0)},i.prototype.autosaveStop=function(){return this.clearDelay("ticket-zoom-form-update"),this.autosaveLast={},this.el.off("change.local blur.local keyup.local paste.local input.local")},i.prototype.autosaveStart=function(){var t;return this.el.on("change.local blur.local keyup.local paste.local input.local","form, .js-textarea",(t=this,function(){return t.delay(t.markForm,250,"ticket-zoom-form-update")})),this.delay(this.markForm,800,"ticket-zoom-form-update")},i.prototype.markForm=function(t){var e,n,i,s;if(this.autosaveLast||(this.autosaveLast=this.taskGet()),this.ticket&&this.ticket.editable()&&(e=this.formCurrent(),s=_.isEqual(e,this.autosaveLast),(t||!s)&&(this.autosaveLast=clone(e),n=this.currentStore(),i=this.formDiff(e,n),!_.isEmpty(i))))return this.setDefaultFollowUpState(i,n),this.markFormDiff(i),this.taskUpdateAll(i)},i.prototype.currentStore=function(){var t,e,n;if(this.ticket)return delete(e=this.ticket.attributes()).article,n=this.Config.get("ui_ticket_zoom_article_note_new_internal"),t={ticket:e,article:{to:"",cc:"",subject:"",type:"note",body:"",internal:"",in_reply_to:"",subtype:""}},"agent"===this.ticket.currentView()&&(t.article.internal=n),t},i.prototype.setDefaultFollowUpState=function(t,e){var n;return this.isDefaultFollowUpStateSet&&!t.article.body?(this.$(".sidebar select[name=state_id]").val(e.ticket.state_id).trigger("change"),void(this.isDefaultFollowUpStateSet=!1)):!t.article.body||t.ticket.state_id||"customer"!==this.ticket.currentView()||this.isDefaultFollowUpStateSet||this.ticket&&this.ticket.state_id&&(n=App.TicketState.findByAttribute("id",this.ticket.state_id))&&!0===n.default_create?void 0:(this.isDefaultFollowUpStateSet=!0,(n=App.TicketState.findByAttribute("default_follow_up",!0))&&this.$(".sidebar[data-tab=ticket] select[name=state_id]").val(n.id).trigger("change"),!0)},i.prototype.resetDefaultFollowUpState=function(){return this.isDefaultFollowUpStateSet=!1},i.prototype.formCurrent=function(){var t,e,n;return e={ticket:this.formParam(this.el.find(".edit")),article:(null!=(n=this.articleNew)?n.params():void 0)||{}},(t=this.$(".article-add .textBubble .attachments .attachment").length)>0?e.article.attachments=t:delete e.article.attachments,delete e.article.form_id,"customer"===this.ticket.currentView()&&(e.article.internal=""),e},i.prototype.formDiff=function(t,e){var n,i,s,r;if(e.ticket){if(!(r=this.el.find(".edit").attr("data-ticket-updated-at")))return;if(e.ticket.updated_at.toString()!==r)return;this.formDiffSimplifyEmptyValues(e)}return t.ticket&&this.formDiffSimplifyEmptyValues(t),(n=this.forRemoveMeta(App.Utils.formDiff(t.article,e.article))).type&&(n.internal=t.article.internal),i=_.keys(n),s=_.difference(i,["type","internal"]),_.isEmpty(s)&&(delete n.type,delete n.internal),{ticket:this.forRemoveMeta(App.Utils.formDiff(t.ticket,e.ticket)),article:n}},i.prototype.formDiffSimplifyEmptyValues=function(t){var e,n,i,s,r,o;for(e in s=[],n=t.ticket)null==(o=n[e])&&(t.ticket[e]=""),r=null!=(i=App.Ticket.configure_attributes.find((function(t){return t.name===e})))?i.tag:void 0,["multiselect","multi_tree_select"].includes(r)&&(_.isEmpty(o)||_.isEqual(o,[""]))?s.push(t.ticket[e]=""):s.push(void 0);return s},i.prototype.forRemoveMeta=function(t){var e,n,i;for(e in null==t&&(t={}),n={},t)i=t[e],e.match(/_completion$/)||(n[e]=i);return n},i.prototype.markFormDiff=function(t){var e,n,i,s,r,o,a,l;if(null==t&&(t={}),a=this.$(".edit"),l=this.$('.tabsSidebar-tab[data-tab="ticket"]'),o=this.$(".js-reset"),(i={}).ticket=this.forRemoveMeta(this.ticketParams()),i.article=this.forRemoveMeta(null!=(s=this.articleNew)?s.params():void 0),_.isEmpty(t.ticket)&&_.isEmpty(t.article))return l.removeClass("is-changed"),a.removeClass("form-changed"),a.find(".form-group").removeClass("is-changed"),o.addClass("hide");for(e in a.addClass("form-changed"),_.isEmpty(t.ticket)?l.removeClass("is-changed"):l.addClass("is-changed"),r=i.ticket)r[e],(n=this.$('.edit [name="'+e+'"]').parents(".form-group")).get(0)||(n=this.$('.edit [data-name="'+e+'"]').parents(".form-group")),e in t.ticket?n.hasClass("is-changed")||n.addClass("is-changed"):n.hasClass("is-changed")&&n.removeClass("is-changed");return o.removeClass("hide")},i.prototype.ticketParams=function(){return this.formParam(this.$(".edit"))},i.prototype.submitDisable=function(t){if(!t)return this.formDisable(this.$(".js-submitDropdown"));this.formDisable(t)},i.prototype.submitEnable=function(t){if(!t)return this.formEnable(this.$(".js-submitDropdown"));this.formEnable(t)},i.prototype.submit=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d;if(null==e&&(e={}),t.stopPropagation(),t.preventDefault(),this.submitDisable(t),this.articleNew.validate()){for(a in h=this.ticketParams(),i=this.articleParams(),(p=App.Ticket.fullLocal(this.ticket_id)).article=void 0,h)d=h[a],p[a]=d;var f;if(e.perform&&App.Ticket.macro({macro:e.perform,ticket:p,article:i,callback:{tagAdd:(f=this,function(t){if(f.sidebarWidget&&f.sidebarWidget.reload)return f.sidebarWidget.reload({tagAdd:t,source:"macro"})}),tagRemove:function(t){return function(e){if(t.sidebarWidget&&t.sidebarWidget.reload)return t.sidebarWidget.reload({tagRemove:e})}}(this)}}),"agent"===p.currentView()&&(p.owner_id||(p.owner_id=1)),_.isEmpty(p.title)&&(p.title="-"),this.autosaveStop(),!e.perform&&(r=this.$(".edit").parent().get(0))&&r.reportValidity&&!r.reportValidity())return this.submitEnable(t),void this.autosaveStart();if(s=null!=(l=this.sidebarWidget)&&null!=(c=l.get("100-TicketEdit"))&&null!=(u=c.edit)?u.controllerFormSidebarTicket:void 0,o=p.validate({controllerForm:s,target:t.target}))return this.log("error","update",o),this.formValidate({form:this.$(".edit"),errors:o,screen:"edit"}),this.submitEnable(t),void this.autosaveStart();if(i&&i.body){if((n=new App.TicketArticle).load(i),o=n.validate())return this.log("error","update article",o),this.formValidate({form:this.$(".article-add"),errors:o,screen:"edit"}),this.submitEnable(t),void this.autosaveStart();p.article=n}if(this.sidebarWidget&&this.sidebarWidget.postParams&&this.sidebarWidget.postParams({ticket:p}),p.article){if(s.getFlag("time_accounting"))return new App.TicketZoomTimeAccounting({container:this.el.closest(".content"),ticket:p,cancelCallback:function(e){return function(){return e.submitEnable(t)}}(this),submitCallback:function(n){return function(i){return p.article.time_unit=i.time_unit,p.article.accounted_time_type_id=i.accounted_time_type_id,n.submitPost(t,p,e)}}(this)});this.submitPost(t,p,e)}else this.submitPost(t,p,e)}else this.submitEnable(t)},i.prototype.saveDraft=function(t){var e,n,i,s,r,o,a,l;if(t.stopPropagation(),t.preventDefault(),(r={new_article:(null!=(o=this.articleNew)?o.params():void 0)||{},ticket_attributes:this.ticketParams()}).new_article.body=App.Utils.signatureRemoveByHtml(r.new_article.body),i=r.new_article.shared_draft_id,r.form_id=r.new_article.form_id,delete r.new_article.form_id,delete r.new_article.shared_draft_id,e=null!=(a=this.sharedDraft()),n=i===String(null!=a?a.id:void 0),s=e&&_.isEqual(a.new_article,r.new_article)&&_.isEqual(a.ticket_attributes,r.ticket_attributes),!e||n&&s)return this.draftSaveToServer(r);new App.TicketSharedDraftOverwriteModal({onShowDraft:this.draft,onSaveDraft:(l=this,function(){return l.draftSaveToServer(r)})})},i.prototype.draftSaveToServer=function(t){return this.draftSaving(),this.ajax({id:"ticket_shared_draft_update",type:"PUT",url:this.apiPath+"/tickets/"+this.ticket_id+"/shared_draft",processData:!0,data:JSON.stringify(t),success:(e=this,function(t){return App.Collection.loadAssets(t.assets),App.Event.trigger("ui::ticket::shared_draft_saved",{ticket_id:e.ticket_id,shared_draft_id:t.shared_draft_id}),e.draftFetched()}),error:function(t){return function(){return t.draftFetched()}}(this)});var e},i.prototype.submitPost=function(t,e,n){var i,s,r;return s=this.$(".js-secondaryActionButtonLabel").data("type"),n&&n.ux_flow_next_up&&(s=n.ux_flow_next_up),i=void 0,"closeNextInOverview"!==s&&"next_from_overview"!==s||(i=this.getNextTicketInOverview()),this.ajax({
id:"ticket_update_"+e.id,type:"PUT",url:App.Ticket.url+"/"+e.id+"?all=true",data:JSON.stringify(e.attributes()),processData:!0,success:(r=this,function(n){var o;if(e.article=void 0,r.reset(),r.load(n,!1,!0),r.sidebarWidget&&r.sidebarWidget.commit(),"closeNextInOverview"===s||"next_from_overview"===s)return r.openTicketInOverview(i),void App.Event.trigger("overview:fetch");if("closeTabOnTicketClose"===s||"next_task_on_close"===s){if(o=App.TicketState.find(e.state_id).state_type_id,"closed"===App.TicketStateType.find(o).name)return App.Event.trigger("overview:fetch"),void r.taskCloseTicket(!0)}else if("closeTab"===s||"next_task"===s)return App.Event.trigger("overview:fetch"),void r.taskCloseTicket(!0);return r.autosaveStart(),r.muteTask(),r.submitEnable(t),r.scrollToPosition("bottom",50)}),error:function(e){return function(n,i){var s;return s=void 0,n&&n.responseJSON&&n.responseJSON.error&&(s=n.responseJSON.error),App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent(i.error_human||i.error||s||__("Saving failed.")),timeout:2e3}),e.autosaveStart(),e.muteTask(),e.fetch(),e.submitEnable(t)}}(this)})},i.prototype.bookmark=function(t){return $(t.currentTarget).find(".bookmark.icon").toggleClass("filled")},i.prototype.draft=function(t){return t.preventDefault(),new App.TicketSharedDraftModal({container:this.el.closest(".content"),hasChanges:App.TaskManager.worker(this.taskKey).changed(),parent:this,shared_draft:this.sharedDraft()})},i.prototype.fetchDraft=function(){return this.ajax({id:"ticket_"+this.ticket_id+"_shared_draft",type:"GET",url:this.apiPath+"/tickets/"+this.ticket_id+"/shared_draft",processData:!0,success:(t=this,function(e){return App.Collection.loadAssets(e.assets),t.draftFetched()})});var t},i.prototype.draftSaving=function(){return this.updateDraftButton(!0,"saving")},i.prototype.updateDraftButton=function(t,e){var n;return(n=this.el.find(".js-draft")).toggleClass("hide",!t),n.find(".attributeBar-draft--available").toggleClass("hide","available"!==e),n.find(".attributeBar-draft--saving").toggleClass("hide","saving"!==e),n.attr("disabled","saving"===e),this.el.find(".js-dropdownActionSaveDraft").attr("disabled","saving"===e)},i.prototype.draftFetched=function(){return this.updateDraftButton(null!=this.sharedDraft(),"available")},i.prototype.draftState=function(){return null!=this.sharedDraft()},i.prototype.sharedDraft=function(){return App.TicketSharedDraftZoom.findByAttribute("ticket_id",this.ticket_id)},i.prototype.reset=function(t){return t&&t.preventDefault(),this.taskReset(),this.resetDefaultFollowUpState(),App.Ajax.request({type:"DELETE",url:App.Config.get("api_path")+"/upload_caches/"+this.form_id,processData:!1}),this.$(".js-reset").addClass("hide"),App.Event.trigger("ui::ticket::taskReset",{ticket_id:this.ticket_id}),this.$('.tabsSidebar-tab[data-tab="ticket"]').removeClass("is-changed")},i.prototype.taskGet=function(t){return App.TaskManager.get(this.taskKey)?(this.localTaskData=App.TaskManager.get(this.taskKey).state||{},_.isObject(this.localTaskData.article)&&_.isArray(App.TaskManager.get(this.taskKey).attachments)&&(this.localTaskData.article.attachments=App.TaskManager.get(this.taskKey).attachments),t?(this.localTaskData[t]||(this.localTaskData[t]={}),this.localTaskData[t]):(this.localTaskData||(this.localTaskData={}),this.localTaskData)):{}},i.prototype.taskUpdate=function(t,e){var n;return this.localTaskData[t]=e,n={state:this.localTaskData},_.isArray(e.attachments)&&(n.attachments=e.attachments),App.TaskManager.update(this.taskKey,n)},i.prototype.taskUpdateAttachments=function(t,e){var n;if(n=App.TaskManager.get(this.taskKey))return n.attachments=e,App.TaskManager.update(this.taskKey,n)},i.prototype.taskUpdateAll=function(t){var e;return this.localTaskData=t,this.localTaskData.article.form_id=this.form_id,e={state:this.localTaskData},_.isArray(t.attachments)&&(e.attachments=t.attachments),App.TaskManager.update(this.taskKey,e)},i.prototype.taskReset=function(){return this.form_id=App.ControllerForm.formId(),this.articleNew&&(this.articleNew.form_id=this.form_id,this.articleNew.render()),this.articleView.updateFormId(this.form_id),this.localTaskData={ticket:{},article:{}},App.TaskManager.update(this.taskKey,{state:this.localTaskData,attachments:[]})},i.prototype.renderOverviewNavigator=function(t){return new App.TicketZoomOverviewNavigator({el:t.find(".js-overviewNavigatorContainer"),ticket_id:this.ticket_id,overview_id:this.overview_id})},i.prototype.copyTicketNumber=function(){var t;if(t=this.el.find(".js-objectNumber").first().data("number")||"")return this.tooltipCopied=this.copyToClipboardWithTooltip(t,".ticket-number-copy-header","body")},i.prototype.hideCopyTicketNumberTooltip=function(){if(this.tooltipCopied)return this.tooltipCopied.tooltip("hide")},i}(App.Controller),t=function(t){function e(t){if(e.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),t.ticket_number)return this.byNumber(t);this.byTicketId(t)}return n(e,t),e.requiredPermission=["ticket.agent","ticket.customer"],e.prototype.byNumber=function(t){var e,n,i;return t.ticket_number?t.ticket_id?this.byTicketId(t):(e=t.ticket_number,delete t.ticket_number,(n=App.Ticket.findByAttribute("number",e))?this.navigate("ticket/zoom/"+n.id):App.Ajax.request({type:"POST",url:this.apiPath+"/tickets/search",processData:!0,data:JSON.stringify({condition:{"ticket.number":{operator:"is",value:e}},limit:1}),success:(i=this,function(e){return _.isEmpty(e.tickets)?i.byTicketId(t):i.navigate("ticket/zoom/"+e.tickets[0])}),error:function(e){return function(){return e.byTicketId(t)}}(this)})):this.byTicketId(t)},e.prototype.byTicketId=function(t){var e;return e={ticket_id:t.ticket_id,article_id:t.article_id,nav:t.nav,shown:!0},App.TaskManager.execute({key:"Ticket-"+this.ticket_id,controller:"TicketZoom",params:e,show:!0})},e}(App.ControllerPermanent),App.Config.set("ticket/zoom/number/:ticket_number",t,"Routes"),App.Config.set("ticket/zoom/:ticket_id",t,"Routes"),App.Config.set("ticket/zoom/:ticket_id/nav/:nav",t,"Routes"),App.Config.set("ticket/zoom/:ticket_id/:article_id",t,"Routes")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e,n,i){var s;return(s=this.isDeletable(t,e,n,i)).isDeletable?(t.push({name:__("delete"),type:"delete",icon:"trash",href:"#"}),s.timeout&&i.delay(i.render,s.timeout,"actions-rerender"),t):t},t.isDeletable=function(t,e,n,i){var s;return this.deletableForAgent(t,e,n,i)?this.hasDeletableTimeframe()?(s=this.deletableTimeout(t,e,n,i))<=0?{isDeletable:!1}:{isDeletable:!0,timeout:s}:{isDeletable:!0}:{isDeletable:!1}},t.deletableTimeframeSetting=function(){return App.Config.get("ui_ticket_zoom_article_delete_timeframe")},t.hasDeletableTimeframe=function(){return this.deletableTimeframeSetting()&&this.deletableTimeframeSetting()>0},t.deletableTimeout=function(t,e,n){return 1e3*this.deletableTimeframeSetting()-(Date.parse(new Date)-Date.parse(n.created_at))},t.deletableForAgent=function(t,e,n){var i;return!!e.editable()&&("customer"!==e.currentView()&&(n.created_by_id===(null!=(i=App.User.current())?i.id:void 0)&&!(n.type.communication&&!n.internal)))},t.perform=function(t,e,n,i,s){var r;return"delete"!==e||(r=function(){return(i=App.TicketArticle.find(i.id)).destroy({fail:function(t,e){return s.log("errors",e),s.notify({type:"error",msg:App.i18n.translateContent(e.error_human||e.error||__("Article could not be deleted.")),timeout:6e3})}})},new App.ControllerConfirm({message:__("Are you sure?"),buttonClass:"btn--danger",callback:r,container:s.el.closest(".content")})),!0},t}(),App.Config.set("900-Delete",t,"TicketZoomArticleAction")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.action=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d,f;if(!e.editable())return t;if("customer"===e.currentView())return t;if(!e.group.email_address_id)return t;if("email"===n.type.name||"web"===n.type.name){for(t.push({name:__("reply"),type:"emailReply",icon:"reply",href:"#"}),f=[],"Customer"===n.sender.name&&n.from&&(p=emailAddresses.parseAddressList(n.from))&&(f=f.concat(p)),n.to&&(p=emailAddresses.parseAddressList(n.to))&&(f=f.concat(p)),n.cc&&(p=emailAddresses.parseAddressList(n.cc))&&(f=f.concat(p)),c=App.EmailAddress.all(),i=[],d={},s=0,o=f.length;s<o;s++)if(h=f[s],!_.isEmpty(h.address)&&!d[u=h.address.toString().toLowerCase()]){for(d[u]=!0,l=!1,r=0,a=c.length;r<a;r++)u===c[r].email.toString().toLowerCase()&&(d[u]=!0,l=!0);l||i.push(h)}i.length>1&&t.push({name:__("reply all"),type:"emailReplyAll",icon:"reply-all",href:"#"}),t.push({name:__("forward"),type:"emailForward",icon:"forward",href:"#"})}return"Customer"===n.sender.name&&"phone"===n.type.name&&(t.push({name:__("reply"),type:"emailReply",icon:"reply",href:"#"}),t.push({name:__("forward"),type:"emailForward",icon:"forward",href:"#"})),"Agent"===n.sender.name&&"phone"===n.type.name&&(t.push({name:__("reply"),type:"emailReply",icon:"reply",href:"#"}),t.push({name:__("forward"),type:"emailForward",icon:"forward",href:"#"})),t},n.perform=function(t,e,n,i,s){return"emailReply"!==e&&"emailReplyAll"!==e&&"emailForward"!==e||("emailReply"===e?this.emailReply(!1,n,i,s):"emailReplyAll"===e?this.emailReply(!0,n,i,s):"emailForward"===e&&this.emailForward(n,i,s)),!0},n.emailReply=function(t,e,n,i){var s,r,o,a,l,c,u;return null==t&&(t=!1),u=App.TicketArticleType.find(n.type_id),r=App.User.find(n.created_by_id),a=App.EmailAddress.all(),i.scrollToCompose(),s=App.Utils.getRecipientArticle(e,n,r,u,a,t),i.Config.get("ui_ticket_zoom_article_email_subject")&&(_.isEmpty(n.subject)?s.subject=e.title:s.subject=n.subject),o=i.el.closest(".ticketZoom").find('.article-add [data-name="body"]').html()||"",c="bottom",this.hasUserSelectedContent(i)?(l=this.getSelectedContent(i),l=this.cleanUpHtmlSelection(l)):l="",!l&&n&&App.Config.get("ui_ticket_zoom_article_email_full_quote")&&(c="top",n.content_type.match("html")&&(l=App.Utils.textCleanup(n.body)),n.content_type.match("plain")&&(l=App.Utils.textCleanup(n.body),l=App.Utils.text2html(l))),l&&(o=(l="<div><br><br/></div><div><blockquote type='cite'>"+this.replyQuoteHeader(n)+l+"<br></blockquote></div><div><br></div>")+o),s.body=o,u=App.TicketArticleType.findByAttribute({name:"email"}),s.subtype="reply",App.Event.trigger("ui::ticket::setArticleType",{ticket:e,type:u,article:s,signaturePosition:c}),!0},n.cleanUpHtmlSelection=function(t){var e,n;return t&&(e=App.Utils.htmlCleanup(t).html())?e:!!(n=App.ClipBoard.getSelected("text"))&&App.Utils.text2html(n)},n.getSelectedContent=function(t){var e,n,i,s,r;if(s=window.getSelection().getRangeAt(0),i=t.el.closest(".ticket-article-item").attr("id"))return n=$("#"+i+" .richtext-content")[0],r=this.isInsideSelectionBoundary(s.startContainer,i),e=this.isInsideSelectionBoundary(s.endContainer,i),!r&&e?s.setStart(n,0):r&&!e?s.setEnd(n,n.childNodes.length):this.containsNode(n)&&(s.setStart(n,0),s.setEnd(n,n.childNodes.length)),App.ClipBoard.manuallyUpdateSelection(),App.ClipBoard.getSelected("html")},n.hasUserSelectedContent=function(t){var e,n,i,s;return(s=App.ClipBoard.getSelectedObject()).rangeCount>0&&((n=t.el.closest(".ticket-article-item"))?(e=n.attr("id"),i=s.getRangeAt(0),this.isInsideSelectionBoundary(i.startContainer,e)||this.isInsideSelectionBoundary(i.endContainer,e)||this.containsNode($("#"+e+" .richtext-content")[0])):void 0)},n.isInsideSelectionBoundary=function(t,e){var n;return(n=$(t).closest("#"+e+" .richtext-content"))&&"richtext-content"===n.attr("class")},n.containsNode=function(t){var e;return"function"==typeof(e=App.ClipBoard.getSelectedObject()).containsNode&&e.containsNode(t,!1)},n.date_format=function(t){var e,n;n={weekday:"long",month:"long",day:"numeric",year:"numeric"},e=App.i18n.get(!0);try{return new Date(t).toLocaleTimeString(e,n)}catch(e){return e,new Date(t).toLocaleTimeString("en-US",n)}},n.emailForward=function(t,e,n){var i,s,r,o,a;return n.scrollToCompose(),o="top",s="",e.content_type.match("html")&&(s=App.Utils.textCleanup(e.body)),e.content_type.match("plain")&&(s=App.Utils.textCleanup(e.body),s=App.Utils.text2html(s)),r=App.FullQuoteHeader.fullQuoteHeaderForward(e),s="<br/><div>---"+App.i18n.translateInline("Begin forwarded message")+':---<br/><br/></div><div><blockquote type="cite">'+r+s+"</blockquote></div><div><br></div>",(i={}).body=s,n.Config.get("ui_ticket_zoom_article_email_subject")&&(_.isEmpty(e.subject)?i.subject=t.title:i.subject=e.subject),a=App.TicketArticleType.findByAttribute({name:"email"}),i.subtype="forward",App.Event.trigger("ui::ticket::setArticleType",{ticket:t,type:a,article:i,signaturePosition:o,focus:"to"}),App.Ajax.request({id:"ticket_attachment_clone"+n.form_id,type:"POST",url:App.Config.get("api_path")+"/ticket_attachment_upload_clone_by_article/"+e.id,data:JSON.stringify({form_id:n.form_id}),processData:!0,success:function(i){if(!_.isEmpty(i.attachments))return App.Event.trigger("ui::ticket::addArticleAttachent",{ticket:t,article:e,attachments:i.attachments,form_id:n.form_id})}}),!0},n.articleTypes=function(t,e,n){var i;return"customer"===e.currentView()?t:e.group.email_address_id?(i=["to","cc","subject"],n.Config.get("ui_ticket_zoom_article_email_subject")||(i=["to","cc"]),t.push({name:"email",icon:"email",attributes:i,internal:!1,features:["attachment","security"]}),t):t},n.setArticleTypePre=function(t,e,n){"email"!==t&&n.$("[data-name=body] [data-signature=true]").remove()},n.setArticleTypePost=function(t,e,n,i){var s,r,o,a,l,c,u,p;if(o=(p=App.Ticket.fullLocal(e.id)).group_id,(u=App.TaskManager.get(n.taskKey))&&u.state&&u.state.ticket&&u.state.ticket.group_id&&(o=u.state.ticket.group_id),a=void 0,(r=App.Group.find(o))&&r.signature_id&&(a=App.Signature.find(r.signature_id)),"email"===t)return a&&a.active&&a.body&&((c=n.$("[data-signature=true]").data("signature-id"))&&c.toString()!==a.id.toString()&&n.$('[data-name=body] [data-signature="true"]').remove(),l=App.Utils.replaceTags(a.body,{user:App.Session.get(),ticket:p,config:App.Config.all()}),s=n.$("[data-name=body]"),App.Utils.signatureCheck(s.html()||"",l)&&(App.Utils.htmlLastLineEmpty(s)||s.append("<br><br>"),a=$('<div data-signature="true" data-signature-id="'+a.id+'">'+l+"</div>"),App.Utils.htmlStrip(a),"top"===i?(s.prepend(a),s.prepend("<br>")):s.append(a),n.$("[data-name=body]").replaceWith(s))),App.Utils.htmlImage2DataUrlAsyncInline(n.$("[contenteditable=true]"));n.$('[data-name=body] [data-signature="true"]').remove()},n.validation=function(t,e,n){return"email"!==t||(_.isEmpty(e.to)&&_.isEmpty(e.cc)?(new App.ControllerModal({head:__("Text missing"),buttonCancel:__("Cancel"),buttonCancelClass:"btn--danger",buttonSubmit:!1,message:__('Please provide a recipient in "TO" or "CC".'),shown:!0,small:!0,container:n.el.closest(".content")}),!1):!_.isEmpty(e.body)||(new App.ControllerModal({head:__("Text missing"),buttonCancel:__("Cancel"),buttonCancelClass:"btn--danger",buttonSubmit:!1,message:__("Text needed"),shown:!0,small:!0,container:n.el.closest(".content")}),!1))},n.replyQuoteHeader=function(t){var e,n;return App.Config.get("ui_ticket_zoom_article_email_full_quote_header")?(e=this.date_format(t.created_at),n=t.recipientName(),App.i18n.translateInline("On %s, %s wrote:",e,n)+"<br><br>"):""},n}(App.Controller),App.Config.set("200-EmailReply",t,"TicketZoomArticleAction")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e,n){return e.editable()?("customer"===e.currentView()||"facebook feed post"!==n.type.name&&"facebook feed comment"!==n.type.name||t.push({name:__("reply"),type:"facebookFeedReply",icon:"reply",href:"#"}),t):t},t.perform=function(t,e,n,i,s){var r;return"facebookFeedReply"!==e||(s.scrollToCompose(),e=App.TicketArticleType.findByAttribute("name","facebook feed comment"),r={to:"",cc:"",body:"",in_reply_to:""},App.Event.trigger("ui::ticket::setArticleType",{ticket:n,type:e,article:r})),!0},t.articleTypes=function(t,e){return"customer"===e.currentView()?t:e&&e.create_article_type_id?("facebook feed post"===App.TicketArticleType.find(e.create_article_type_id).name&&t.push({name:"facebook feed comment",icon:"facebook",attributes:[],internal:!1,features:[]}),t):t},t.params=function(t,e,n){return"facebook feed comment"===t&&(App.Utils.htmlRemoveRichtext(n.$("[data-name=body]"),!1),e.content_type="text/plain",e.body=App.Utils.html2text(e.body,!0)),e},t}(),App.Config.set("300-FacebookReply",t,"TicketZoomArticleAction")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e,n){return e.editable()?("customer"===e.currentView()||(!0===n.internal?t.push({name:__("set to public"),type:"public",icon:"lock-open"}):t.push({name:__("set to internal"),type:"internal",icon:"lock"})),t):t},t.perform=function(t,e,n,i,s){return"internal"!==e&&"public"!==e||("public"===e&&App.Config.get("ui_ticket_zoom_article_visibility_confirmation_dialog")?new App.ControllerArticlePublicConfirm({callback:(r=this,function(){return r.change(t,i,s)}),container:s.el.closest(".content")}):this.change(t,i,s)),!0;var r},t.change=function(t,e,n){var i;return i=!0,!0===e.internal&&(i=!1),n.lastAttributes.internal=i,e.updateAttributes({internal:i}),i?t.addClass("is-internal"):t.removeClass("is-internal"),n.render()},t}(),App.Config.set("100-Internal",t,"TicketZoomArticleAction")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e){return e.editable(),t},t.perform=function(){return!0},t.articleTypes=function(t,e,n){var i;return i=!1,"agent"===e.currentView()&&(i=n.Config.get("ui_ticket_zoom_article_note_new_internal")),t.push({name:__("note"),icon:"note",attributes:[],internal:i,features:["attachment"]}),t},t}(),App.Config.set("100-Note",t,"TicketZoomArticleAction")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e){return e.editable(),t},t.perform=function(){return!0},t.articleTypes=function(t,e){return"customer"===e.currentView()||t.push({name:__("phone"),icon:"phone",attributes:[],internal:!1,features:["attachment"]}),t},t}(),App.Config.set("100-PhoneReply",t,"TicketZoomArticleAction")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e,n){return e.editable()?("customer"===e.currentView()||"Customer"===n.sender.name&&"sms"===n.type.name&&t.push({name:__("reply"),type:"smsMessageReply",icon:"reply",href:"#"}),t):t},t.perform=function(t,e,n,i,s){var r;return"smsMessageReply"!==e||(s.scrollToCompose(),e=App.TicketArticleType.find(i.type_id),r={to:i.from,cc:"",body:"",in_reply_to:""},i.message_id&&(r.in_reply_to=i.message_id),r.body=s.el.closest(".ticketZoom").find('.article-add [data-name="body"]').html().trim()||"",App.Event.trigger("ui::ticket::setArticleType",{ticket:n,type:e,article:r,position:"end"})),!0},t.articleTypes=function(t,e){return"customer"===e.currentView()?t:e&&e.create_article_type_id?("sms"!==App.TicketArticleType.find(e.create_article_type_id).name||t.push({name:"sms",icon:"sms",attributes:["to"],internal:!1,features:["body:limit"],maxTextLength:160,warningTextLength:30}),t):t},t.setArticleTypePost=function(t,e,n){var i,s;if("telegram personal-message"===t)return s=n.$("[data-name=body]").html(),(i=App.Utils.htmlRemoveRichtext(s))&&i.html()!==s?n.$("[data-name=body]").html(i):void 0},t.params=function(t,e,n){return"sms"===t&&(App.Utils.htmlRemoveRichtext(n.$("[data-name=body]"),!1),e.content_type="text/plain",e.body=App.Utils.html2text(e.body,!0)),e},t}(),App.Config.set("300-SmsReply",t,"TicketZoomArticleAction")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e,n){return e.editable()?("customer"===e.currentView()||t.push({name:__("split"),type:"split",icon:"split",href:"#ticket/create/"+n.ticket_id+"/"+n.id}),t):t},t.perform=function(t,e,n,i,s){return"split"!==e||s.navigate("#ticket/create/"+i.ticket_id+"/"+i.id),!0},t}(),App.Config.set("700-Split",t,"TicketZoomArticleAction")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e,n){return e.editable()?("customer"===e.currentView()||"Customer"===n.sender.name&&"telegram personal-message"===n.type.name&&t.push({name:__("reply"),type:"telegramPersonalMessageReply",icon:"reply",href:"#"}),t):t},t.perform=function(t,e,n,i,s){var r;return"telegramPersonalMessageReply"!==e||(s.scrollToCompose(),e=App.TicketArticleType.find(i.type_id),r={to:"",cc:"",body:"",in_reply_to:""},i.message_id&&(r.in_reply_to=i.message_id),r.body=s.el.closest(".ticketZoom").find('.article-add [data-name="body"]').html().trim()||"",App.Event.trigger("ui::ticket::setArticleType",{ticket:n,type:e,article:r,position:"end"})),!0},t.articleTypes=function(t,e){return"customer"===e.currentView()?t:e&&e.create_article_type_id?("telegram personal-message"!==App.TicketArticleType.find(e.create_article_type_id).name||t.push({name:"telegram personal-message",icon:"telegram",attributes:[],internal:!1,features:["attachment"],maxTextLength:1e4,warningTextLength:5e3}),t):t},t.setArticleTypePost=function(t,e,n){var i,s;if("telegram personal-message"===t)return s=n.$("[data-name=body]").html(),(i=App.Utils.htmlRemoveRichtext(s))&&i.html()!==s?n.$("[data-name=body]").html(i):void 0},t.params=function(t,e,n){return"telegram personal-message"===t&&(App.Utils.htmlRemoveRichtext(n.$("[data-name=body]"),!1),e.content_type="text/plain",e.body=App.Utils.html2text(e.body,!0)),e},t}(),App.Config.set("300-TelegramReply",t,"TicketZoomArticleAction")}.call(this),function(){var t;t=function(){function t(){}return t.action=function(t,e,n){return e.editable()?("customer"===e.currentView()||("twitter status"===n.type.name&&t.push({name:__("reply"),type:"twitterStatusReply",icon:"reply",href:"#"}),"twitter direct-message"===n.type.name&&t.push({name:__("reply"),type:"twitterDirectMessageReply",icon:"reply",href:"#"})),t):t},t.perform=function(t,e,n,i,s){return"twitterStatusReply"!==e&&"twitterDirectMessageReply"!==e||("twitterStatusReply"===e?this.twitterStatusReply(n,i,s):"twitterDirectMessageReply"===e&&this.twitterDirectMessageReply(n,i,s)),!0},t.twitterStatusReply=function(t,e,n){var i,s,r,o,a,l,c,u,p,h;if(n.scrollToCompose(),h=App.TicketArticleType.find(e.type_id),i={to:"",cc:"",body:"",in_reply_to:""},e.message_id&&(i.in_reply_to=e.message_id),s=n.el.closest(".ticketZoom").find('.article-add [data-name="body"]').html().trim()||"",i.body=s,p=e.from,e.to&&(p&&(p+=", "),p+=e.to),p)for(u="",o=0,a=(c=p.split(",")).length;o<a;o++)(l=c[o])&&(l=l.trim().toLowerCase(),r=!1,s&&s.toLowerCase().match(l)&&(r=!0),l===("@"+t.preferences.channel_screen_name).toLowerCase()&&(r=!0),!1===r&&(""!==u&&(u+=" "),u+=l));return i.body=s?u+" "+s+"&nbsp;":u+"&nbsp;",App.Event.trigger("ui::ticket::setArticleType",{ticket:t,type:h,article:i,position:"end"})},t.twitterDirectMessageReply=function(t,e,n){var i,s,r,o;return o=App.TicketArticleType.find(e.type_id),r=App.TicketArticleSender.find(e.sender_id),s=App.User.find(e.created_by_id),n.scrollToCompose(),i={to:"",cc:"",body:"",in_reply_to:""},e.message_id&&(i.in_reply_to=e.message_id),"Agent"===r.name?i.to=e.to:i.to=e.from,!i.to&&s&&s.accounts&&(i.to=s.accounts.twitter.username||s.accounts.twitter.uid),App.Event.trigger("ui::ticket::setArticleType",{ticket:t,type:o,article:i})},t.articleTypes=function(t,e,n){var i,s;return"customer"===e.currentView()?t:e&&e.create_article_type_id?("twitter status"===(i=App.TicketArticleType.find(e.create_article_type_id).name)?(s=["body:limit","body:initials"],n.Config.get("ui_ticket_zoom_article_twitter_initials")||(s=["body:limit"]),t.push({name:"twitter status",icon:"twitter",attributes:[],internal:!1,features:s,maxTextLength:280,warningTextLength:30})):"twitter direct-message"===i&&(s=["body:limit","body:initials"],n.Config.get("ui_ticket_zoom_article_twitter_initials")||(s=["body:limit"]),t.push({name:"twitter direct-message",icon:"twitter",attributes:["to"],internal:!1,features:s,maxTextLength:1e4,warningTextLength:500})),t):t},t.validation=function(t,e,n){if("twitter status"===t&&n.maxTextLength-App.Utils.textLengthWithUrl(e.body)<0)return!1;if("twitter direct-message"===e.type){if(n.maxTextLength-App.Utils.textLengthWithUrl(e.body)<0)return!1;if(_.isEmpty(e.to))return new App.ControllerModal({head:__("Text missing"),buttonCancel:__("Cancel"),buttonCancelClass:"btn--danger",buttonSubmit:!1,message:__('Need recipient in "To".'),shown:!0,small:!0,container:n.el.closest(".content")}),!1}return!0},t.setArticleTypePost=function(t,e,n){var i,s;if("twitter status"===t||"twitter direct-message"===t)return s=n.$("[data-name=body]").html(),(i=App.Utils.htmlRemoveRichtext(s))&&i.html()!==s?n.$("[data-name=body]").html(i):void 0},t.params=function(t,e,n){return"twitter status"===t&&(App.Utils.htmlRemoveRichtext(n.$("[data-name=body]"),!1),e.content_type="text/plain",e.body=App.Utils.html2text(e.body,!0)),"twitter direct-message"===t&&(App.Utils.htmlRemoveRichtext(n.$("[data-name=body]"),!1),e.content_type="text/plain",e.body=App.Utils.html2text(e.body,!0)),e},t}(),App.Config.set("300-TwitterReply",t,"TicketZoomArticleAction")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomArticleActions=function(n){function i(){this.scrollToCompose=t(this.scrollToCompose,this),this.actionPerform=t(this.actionPerform,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.events={"click .js-ArticleAction":"actionPerform"},i.prototype.render=function(){var t;return(t=this.actionRow(this.ticket,this.article))?this.html(App.view("ticket_zoom/article_view_actions")({article:this.article,actions:t})):this.html("")},i.prototype.actionRow=function(t,e){var n,i,s,r,o,a;for(t=App.Ticket.fullLocal(t.id),e=App.TicketArticle.fullLocal(e.id),n=App.Config.get("TicketZoomArticleAction"),i=[],r=0,a=(o=_.keys(n).sort()).length;r<a;r++)(s=n[o[r]])&&(i=s.action(i,t,e,this));return i},i.prototype.actionPerform=function(t){var e,n,i,s,r,o,a,l,c;for(t.preventDefault(),i=$(t.target).closest(".ticket-article-item"),c=$(t.currentTarget).attr("data-type"),l=App.Ticket.fullLocal(this.ticket.id),n=App.TicketArticle.fullLocal(this.article.id),e=App.Config.get("TicketZoomArticleAction"),[],r=0,a=(o=_.keys(e).sort()).length;r<a;r++)if((s=e[o[r]])&&!s.perform(i,c,l,n,this))return},i.prototype.scrollToCompose=function(){return this.el.closest(".content").find(".article-add").ScrollTo()},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomArticleCalendarView=function(n){function i(){this.onSubmit=t(this.onSubmit,this),this.content=t(this.content,this),this.fetch=t(this.fetch,this),i.__super__.constructor.apply(this,arguments),this.fetch()}return e(i,n),i.prototype.shown=!1,i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit="Download",i.prototype.buttonClass="btn--success",i.prototype.head="",i.prototype.calendarPreview="",i.prototype.events={"submit form":"submit","click .js-cancel":"cancel","click .js-close":"cancel"},i.prototype.fetch=function(){var t,e,n;return e=$(this.calendar).data("preview-url"),t=$(this.calendar).data("id"),this.ajax({id:"calendar_preview_"+t,type:"GET",url:e+"&type=calendar",processData:!0,success:(n=this,function(t){return n.calendarPreview=App.view("generic/calender_preview")({events:t.events}),n.render()}),error:function(t){var e,n,i,s,r;if(s=t.statusText,i=t.responseText,"abort"!==s){try{r=(n=JSON.parse(i)).error_human||n.error}catch(t){}return r||(r=i),e=App.i18n.translateContent(r||"Could not process your request"),new App.ControllerTechnicalErrorModal({contentCode:e,head:App.i18n.translateContent("An error has occurred")})}}})},i.prototype.content=function(){return'<div class="justified vertical calendar-preview">'+this.calendarPreview+"</div>"},i.prototype.onSubmit=function(){var t;return t=""+$(this.calendar).attr("href"),window.open(t,"_blank")},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomArticleImageView=function(n){function i(){var e;this.onClosed=t(this.onClosed,this),this.onClose=t(this.onClose,this),this.onShow=t(this.onShow,this),this.onSubmit=t(this.onSubmit,this),this.nextLeft=t(this.nextLeft,this),this.nextRight=t(this.nextRight,this),i.__super__.constructor.apply(this,arguments),this.unbindAll(),$(document).on("keydown.image_preview",(e=this,function(t){return 39===t.keyCode?e.nextRight():37===t.keyCode?e.nextLeft():void 0}))}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Download"),i.prototype.buttonClass="btn--success",i.prototype.head="",i.prototype.dynamicSize=!0,i.prototype.nextElement=null,i.prototype.events={"submit form":"submit","click .js-cancel":"cancel","click .js-close":"cancel"},i.prototype.nextRight=function(){if(this.nextElement=this.parentElement.closest(".attachment").next(".attachment.attachment--preview"),0!==this.nextElement.length)return this.close()},i.prototype.nextLeft=function(){if(this.nextElement=this.parentElement.closest(".attachment").prev(".attachment.attachment--preview"),0!==this.nextElement.length)return this.close()},i.prototype.content=function(){return this.image=this.image.replace(/view=preview/,"view=inline"),'<div class="centered imagePreview">'+this.image+"</div>"},i.prototype.onSubmit=function(){var t;return this.image=this.image.replace(/(\?|)view=(preview|inline)/,""),t=$(this.image).attr("src")+"?disposition=attachment",window.open(t,"_blank")},i.prototype.onShow=function(){return this.el.attr("tabindex","-1"),$(".modal").focus()},i.prototype.onClose=function(){return this.unbindAll()},i.prototype.onClosed=function(){if(this.nextElement)return this.nextElement.find("img").trigger("click")},i.prototype.unbindAll=function(){return $(document).off("keydown.image_preview")},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomArticleNew=function(n){function i(){var e;this.sharedDraftSaved=t(this.sharedDraftSaved,this),this.importDraftAttachments=t(this.importDraftAttachments,this),this.bindAttachmentDelete=t(this.bindAttachmentDelete,this),this.renderAttachment=t(this.renderAttachment,this),this.onDragleave=t(this.onDragleave,this),this.onDragenter=t(this.onDragenter,this),this.closeTextarea=t(this.closeTextarea,this),this.openTextarea=t(this.openTextarea,this),this.updateInitials=t(this.updateInitials,this),this.blurTextarea=t(this.blurTextarea,this),this.updateLetterCount=t(this.updateLetterCount,this),this.setArticleTypePost=t(this.setArticleTypePost,this),this.updateSecurityType=t(this.updateSecurityType,this),this.updateSecurityOptions=t(this.updateSecurityOptions,this),this.setArticleTypePre=t(this.setArticleTypePre,this),this.setArticleInternal=t(this.setArticleInternal,this),this.hideSelectableArticleType=t(this.hideSelectableArticleType,this),this.selectArticleType=t(this.selectArticleType,this),this.showSelectableArticleType=t(this.showSelectableArticleType,this),this.validate=t(this.validate,this),this.params=t(this.params,this),this.release=t(this.release,this),this.setPossibleArticleTypes=t(this.setPossibleArticleTypes,this),i.__super__.constructor.apply(this,arguments),this.internalSelector=!1,this.type=this.defaults.type||"note",this.setPossibleArticleTypes(),"agent"===this.ticket.currentView()&&(this.internalSelector=!0),this.textareaHeight={open:148,closed:20},this.dragEventCounter=0,this.attachments=this.defaults.attachments||[],this.render(),this.controllerBind("ui::ticket::setArticleType",(e=this,function(t){var n,i,s;if(t.ticket.id.toString()===e.ticket_id.toString()){for(n in e.setArticleTypePre(t.type.name,t.signaturePosition),e.openTextarea(null,!0,!t.nofocus),i=t.article)switch(s=i[n],n){case"body":e.$('[data-name="'+n+'"]').html(s);break
;case"internal":e.setArticleInternal(s);break;default:e.$('[name="'+n+'"]').val(s).trigger("change")}if(e.$("[name=shared_draft_id]").val(t.shared_draft_id),e.setArticleTypePost(t.type.name,t.signaturePosition),t.focus)e.$('[name="'+t.focus+'"], [data-name="'+t.focus+'"]').trigger("focus").parent().find(".token-input").trigger("focus");else{if("end"!==t.position)return e.tokanice(t.type.name);e.placeCaretAtEnd(e.textarea.get(0))}}})),this.controllerBind("ui::ticket::import_draft_attachments",this.importDraftAttachments),this.controllerBind("ui::ticket::shared_draft_saved",this.sharedDraftSaved),this.controllerBind("ui::ticket::addArticleAttachent",function(t){return function(e){var n,i,s,r,o,a,l;if(((null!=(r=e.ticket)&&null!=(o=r.id)?o.toString():void 0)===t.ticket_id.toString()||e.form_id===t.form_id)&&!_.isEmpty(e.attachments)){for(l=[],i=0,s=(a=e.attachments).length;i<s;i++)n=a[i],l.push(t.renderAttachment(n));return l}}}(this)),this.controllerBind("ui::ticket::taskReset",function(t){return function(e){if(t.releaseGlobalClickEvents(),e.ticket_id.toString()===t.ticket_id.toString())return t.type="note",t.defaults={},t.attachments=[],t.render()}}(this)),this.controllerBind("ui:rerender",function(t){return function(){return t.adjustedTextarea=!1,t.defaults=t.ui.taskGet("article"),t.attachments=t.defaults.attachments||[],t.render()}}(this)),this.controllerBind("ui::ticket::updateSecurityOptions",function(t){return function(e){if(e.taskKey===t.taskKey)return t.updateSecurityType(),t.updateSecurityOptions()}}(this)),this.controllerBind("config_update",function(t){return function(e){if(/^(pgp|smime)_integration$/.test(e.name))return t.updateSecurityType(),t.updateSecurityOptions()}}(this))}return e(i,n),i.include(App.SecurityOptions),i.prototype.elements={".js-textarea":"textarea",".attachmentPlaceholder":"attachmentPlaceholder",".attachmentPlaceholder-inputHolder":"attachmentInputHolder",".attachmentPlaceholder-hint":"attachmentHint",".article-visibility-text-wrapper":"visibilityTextWrapper",".article-add":"articleNewEdit",".attachments":"attachmentsHolder",".attachmentUpload":"attachmentUpload",".attachmentUpload-progressBar":"progressBar",".js-percentage":"progressText",".js-cancel":"cancelContainer",".textBubble":"textBubble",".editControls-item":"editControlItem",".js-letterCount":"letterCount",".js-signature":"signature"},i.prototype.events={"click .js-toggleVisibility":"toggleVisibility","click .js-articleTypeItem":"selectArticleType","click .js-selectedArticleType":"showSelectableArticleType","click .js-mail-inputs":"stopPropagation","click .js-writeArea":"propagateOpenTextarea","click .list-entry-type div":"changeType","focus .js-textarea":"openTextarea","input .js-textarea":"updateLetterCount","blur .js-textarea":"blurTextarea","click .js-active-toggle":"toggleButton","click .js-active-toggle-type":"toggleTypeButton"},i.prototype.show=function(){return this.adjustTextarea()},i.prototype.adjustTextarea=function(){if(!this.adjustedTextarea)return this.adjustedTextarea=!0,this.tokanice(this.type),this.defaults.body||this.attachments.length>0||this.isIE10()?this.openTextarea(null,!0):void 0},i.prototype.tokanice=function(t){return null==t&&(t="email"),App.Utils.tokanice(".content.active .js-to, .js-cc, js-bcc",t)},i.prototype.setPossibleArticleTypes=function(){var t,e,n,i,s;for(this.articleTypes=[],s=[],e=0,n=(i=this.actions()).length;e<n;e++)(t=i[e])&&t.articleTypes?s.push(this.articleTypes=t.articleTypes(this.articleTypes,this.ticket,this)):s.push(void 0);return s},i.prototype.placeCaretAtEnd=function(t){var e,n,i;return t.focus(),void 0!==window.getSelection&&void 0!==document.createRange?((e=document.createRange()).selectNodeContents(t),e.collapse(!1),(n=window.getSelection()).removeAllRanges(),void n.addRange(e)):void 0!==document.body.createTextRange?((i=document.body.createTextRange()).moveToElementText(t),i.collapse(!1),i.select()):void 0},i.prototype.isIE10=function(){var t;return!!(t=App.Browser.detection()).browser&&("Explorer"===t.browser.name&&10===t.browser.major)},i.prototype.release=function(){return this.subscribeIdTextModule&&App.Ticket.unsubscribe(this.subscribeIdTextModule),this.releaseGlobalClickEvents()},i.prototype.releaseGlobalClickEvents=function(){return $(window).off("click.ticket-zoom-select-type"),$(window).off("click.ticket-zoom-textarea")},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l;if(this.releaseGlobalClickEvents(),a=App.Ticket.fullLocal(this.ticket_id),this.html(App.view("ticket_zoom/article_new")({ticket:a,articleTypes:this.articleTypes,article:this.defaults,form_id:this.form_id,isCustomer:"customer"===a.currentView(),internalSelector:this.internalSelector})),this.setArticleTypePre(this.type),this.setArticleTypePost(this.type),void 0!==this.defaults.internal&&this.setArticleInternal(this.defaults.internal),new App.WidgetAvatar({el:this.$(".js-avatar"),object_id:App.Session.get("id"),size:40,position:"right"}),this.tokanice(this.type),this.$('[data-name="body"]').ce({mode:"richtext",multiline:!0,maxlength:15e4}),new App.Html5Upload({uploadUrl:App.Config.get("api_path")+"/upload_caches/"+this.form_id,dropContainer:this.$(".article-add"),cancelContainer:this.cancelContainer,inputField:this.$(".article-attachment input"),onFileStartCallback:(l=this,function(){return"function"==typeof l.richTextUploadStartCallback?l.richTextUploadStartCallback():void 0}),onFileCompletedCallback:function(t){return function(e){return t.attachments.push(e.data),t.renderAttachment(e.data),t.$(".article-attachment input").val(""),"function"==typeof t.richTextUploadRenderCallback?t.richTextUploadRenderCallback(t.attachments):void 0}}(this),onFileAbortedCallback:function(t){return function(){return"function"==typeof t.richTextUploadRenderCallback?t.richTextUploadRenderCallback(t.attachments):void 0}}(this),attachmentPlaceholder:this.attachmentPlaceholder,attachmentUpload:this.attachmentUpload,progressBar:this.progressBar,progressText:this.progressText}).render(),this.bindAttachmentDelete(),"agent"===a.currentView()&&(null!=(s=this.textModule)&&s.releaseController(),this.textModule=new App.WidgetTextModule({el:this.$(".js-textarea").parent(),data:{ticket:a,user:App.Session.get(),config:App.Config.all()},taskKey:this.taskKey}),this.subscribeIdTextModule||(e=function(t){return function(e){return t.textModule.reload({ticket:e,user:App.Session.get(),config:App.Config.all()})}}(this),this.subscribeIdTextModule=a.subscribe(e))),_.isArray(this.attachments)){for(o=[],n=0,i=(r=this.attachments).length;n<i;n++)t=r[n],o.push(this.renderAttachment(t));return o}},i.prototype.params=function(){var t,e,n,i,s,r,o,a,l,c,u;for((o=this.formParam(this.$(".article-add"))).body&&(o.from=this.Session.get().displayName(),o.ticket_id=this.ticket_id,o.form_id=this.form_id,o.content_type="text/html","agent"===App.Ticket.find(this.ticket_id).currentView()?(c=App.TicketArticleSender.findByAttribute("name","Agent"),u=App.TicketArticleType.findByAttribute("name",o.type),o.sender_id=c.id,o.type_id=u.id):(c=App.TicketArticleSender.findByAttribute("name","Customer"),u=App.TicketArticleType.findByAttribute("name","web"),o.type_id=u.id,o.sender_id=c.id)),o.internal?o.internal=!0:o.internal=!1,n=0,s=(a=this.actions()).length;n<s;n++)(e=a[n])&&e.params&&(o=e.params(o.type,o,this));for(i=0,r=(l=this.articleTypes).length;i<r;i++)if((t=l[i]).name===this.type&&_.contains(t.features,"body:initials")){"text/html"===o.content_type?o.body=o.body+"</br>"+this.signature.text():o.body=o.body+"\n"+this.signature.text();break}return this.securityOptionsShown()&&(o.preferences||(o.preferences={}),o.preferences.security=this.paramsSecurity()),o},i.prototype.validate=function(){var t,e,n,i,s,r,o;if(r=this.params(),t=this.$(".article-add .textBubble .attachments .attachment").length,!r.body&&t>0)return new App.ControllerModal({head:__("Text missing"),buttonCancel:__("Cancel"),buttonCancelClass:"btn--danger",buttonSubmit:!1,message:__("Please enter a text."),shown:!0,small:!0,container:this.el.closest(".content")}),!1;if(r.body&&t<1&&(s=App.Utils.checkAttachmentReference(r.body))&&!confirm(App.i18n.translateContent("You used %s in the text but no attachment could be found. Do you want to continue?",s)))return!1;for(n=0,i=(o=this.actions()).length;n<i;n++)if((e=o[n])&&e.validation&&!e.validation(r.type,r,this))return!1;return!0},i.prototype.changeType=function(t){return $(t.target).addClass("active").siblings(".active").removeClass("active")},i.prototype.toggleVisibility=function(t){var e;return t.stopPropagation(),this.articleNewEdit.hasClass("is-public")?this.setArticleInternal(!0):App.Config.get("ui_ticket_zoom_article_visibility_confirmation_dialog")?new App.ControllerArticlePublicConfirm({callback:(e=this,function(){return e.setArticleInternal(!1)}),container:$(t.target).closest(".content")}):this.setArticleInternal(!1),this.textarea.trigger("change.local"),App.Event.trigger("ui::ticket::articleNew::change",{ticket_id:this.ticket.id})},i.prototype.showSelectableArticleType=function(t){return t.stopPropagation(),this.el.find(".js-articleTypes").removeClass("is-hidden"),$(window).on("click.ticket-zoom-select-type",this.hideSelectableArticleType)},i.prototype.selectArticleType=function(t){var e;return t.stopPropagation(),e=$(t.target).closest(".pop-selectable").data("value"),this.setArticleTypePre(e),this.hideSelectableArticleType(),this.setArticleTypePost(e),App.Event.trigger("ui::ticket::articleNew::change",{ticket_id:this.ticket.id}),$(window).off("click.ticket-zoom-select-type"),this.tokanice(e)},i.prototype.hideSelectableArticleType=function(){return this.el.find(".js-articleTypes").addClass("is-hidden")},i.prototype.setArticleInternal=function(t){var e,n;return this.articleNewEdit.toggleClass("is-public",!t).toggleClass("is-internal",t),n=this.type+"-"+(t?"internal":"public"),this.visibilityTextWrapper.find(".article-visibility-text").addClass("is-hidden").attr("aria-hidden",!0).filter("[data-type='"+n+"']").removeClass("is-hidden").removeAttr("aria-hidden"),e=t?"true":"",this.$("[name=internal]").val(e)},i.prototype.setArticleTypePre=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A;if(null==e&&(e="bottom"),A=this.isScrolledToBottom(),t!==this.type)for(r=0,c=(v=["to","cc","bcc","subject","in_reply_to"]).length;r<c;r++)a=v[r],this.$("[name="+a+"]").val("").trigger("change");for(this.type=t,this.$("[name=type]").val(t).trigger("change"),this.articleNewEdit.attr("data-type",t),this.$(".js-selectableTypes").addClass("hide").filter("[data-type='"+t+"']").removeClass("hide"),this.setPossibleArticleTypes(),s={},o=0,u=(y=this.articleTypes).length;o<u;o++)(i=y[o]).name===t&&(s=i);for(s&&(s.internal?this.setArticleInternal(!0):this.setArticleInternal(!1)),this.maxTextLength=void 0,this.warningTextLength=void 0,l=0,p=(b=this.articleTypes).length;l<p;l++)if((n=b[l]).name===t){for(this.$(".form-group").addClass("hide"),f=0,h=(w=n.attributes).length;f<h;f++)g=w[f],this.$("[name="+g+"]").closest(".form-group").removeClass("hide");for(this.$(".article-attachment, .attachments, .js-textSizeLimit").addClass("hide"),m=0,d=(k=n.features).length;m<d;m++)"attachment"===(g=k[m])&&this.$(".article-attachment, .attachments").removeClass("hide"),"body:initials"===g&&this.updateInitials(),"body:limit"===g&&(this.maxTextLength=n.maxTextLength,this.warningTextLength=n.warningTextLength,this.delay(this.updateLetterCount,600),this.$(".js-textSizeLimit").removeClass("hide")),"security"===g&&this.securityEnabled()&&(this.securityOptionsShow(),this.$(".js-to, .js-cc").on("change",function(t){return function(){return t.updateSecurityOptions()}}(this)),this.updateSecurityType(),this.updateSecurityOptions())}if(this.$("[data-name=body] img").each((function(t,e){var n,i,s,r;if(r=(n=$(e)).attr("src"),!_.isEmpty(r)&&!r.match(/^data:image/i))return(i=document.createElement("canvas")).width=e.width,i.height=e.height,i.getContext("2d").drawImage(e,0,0),s=i.toDataURL(),n.attr("src",s)})),A)return this.scrollToBottom()},i.prototype.updateSecurityOptions=function(t){return null==t&&(t=!1),t&&this.securityOptionsReset(),this.updateSecurityOptionsRemote(this.taskKey,this.ui.ticketParams(),this.params())},i.prototype.updateSecurityType=function(t){if(null==t&&(t=this.type),"email"===t)return this.updateSecurityTypeToolbar()},i.prototype.setArticleTypePost=function(t,e){var n,i,s,r,o;for(null==e&&(e="bottom"),o=[],n=0,i=(r=this.actions()).length;n<i;n++)(s=r[n])&&s.setArticleTypePost?o.push(s.setArticleTypePost(this.type,this.ticket,this,e)):o.push(void 0);return o},i.prototype.isScrolledToBottom=function(){return this.el.scrollParent().scrollTop()+this.el.scrollParent().height()===this.el.scrollParent().prop("scrollHeight")},i.prototype.scrollToBottom=function(){return this.el.scrollParent().scrollTop(this.el.scrollParent().prop("scrollHeight"))},i.prototype.propagateOpenTextarea=function(t){return t.stopPropagation(),this.textarea.trigger("focus")},i.prototype.updateLetterCount=function(){var t,e,n;if(this.maxTextLength&&this.warningTextLength)return e=this.params(),n=App.Utils.textLengthWithUrl(e.body),n=this.maxTextLength-n,t=function(){switch(!1){case!(n<0):return"label-danger";case!(n<this.warningTextLength):return"label-warning";default:return""}}.call(this),this.letterCount.text(n).removeClass("label-danger label-warning").addClass(t)},i.prototype.blurTextarea=function(){return App.Event.trigger("ui::ticket::articleNew::change",{ticket_id:this.ticket.id})},i.prototype.updateInitials=function(t){return void 0===t&&(t="/"+App.User.find(this.Session.get("id")).initials()),this.signature.text(t)},i.prototype.openTextarea=function(t,e,n){var i,s;if(t&&t.stopPropagation(),!this.articleNewEdit.hasClass("is-open"))return $(window).off("click.ticket-zoom-textarea"),i=300,e&&(i=0),this.articleNewEdit.addClass("is-open"),this.textarea.velocity({properties:{minHeight:this.textareaHeight.open-38+"px"},options:{duration:i,easing:"easeOutQuad",complete:(s=this,function(){if($(window).on("click.ticket-zoom-textarea",s.closeTextarea),n)return s.textarea.trigger("focus")})}}),this.textBubble.velocity({properties:{paddingBottom:28},options:{duration:i,easing:"easeOutQuad"}}),this.textarea.velocity("scroll",{container:this.textarea.scrollParent(),offset:99999,duration:300,easing:"easeOutQuad",queue:!1}),this.editControlItem.removeClass("is-hidden").velocity({properties:{opacity:[1,0],translateX:[0,20],translateZ:0},options:{duration:300,stagger:50,drag:!0}}),this.visibilityTextWrapper.velocity({properties:{opacity:1,height:"100%"},options:{duration:300,easing:"easeOutQuad"}}),this.attachmentPlaceholder.velocity({properties:{translateX:-this.attachmentInputHolder.position().left+"px"},options:{duration:i,easing:"easeOutQuad"}}),this.attachmentHint.velocity({properties:{opacity:0},options:{duration:i}})},i.prototype.closeTextarea=function(){if(!this.textarea.text().trim()&&!this.attachments.length&&!this.isIE10())return $(window).off("click.ticket-zoom-textarea"),this.textarea.velocity({properties:{minHeight:this.textareaHeight.closed+"px"},options:{duration:300,easing:"easeOutQuad",complete:(t=this,function(){return t.articleNewEdit.removeClass("is-open")})}}),this.textBubble.velocity({properties:{paddingBottom:10},options:{duration:300,easing:"easeOutQuad"}}),this.attachmentPlaceholder.velocity({properties:{translateX:0},options:{duration:300,easing:"easeOutQuad"}}),this.attachmentHint.velocity({properties:{opacity:1},options:{duration:300}}),this.editControlItem.velocity({properties:{opacity:[0,1],translateX:[20,0],translateZ:0},options:{duration:100,stagger:50,drag:!0,complete:function(t){return $(t).addClass("is-hidden")}}}),this.visibilityTextWrapper.velocity({properties:{opacity:0,height:0},options:{duration:300,easing:"easeOutQuad"}});var t},i.prototype.onDragenter=function(){return 0===this.dragEventCounter&&this.openTextarea(),this.dragEventCounter++,this.articleNewEdit.parent().addClass("is-dropTarget")},i.prototype.onDragleave=function(){if(this.dragEventCounter--,0===this.dragEventCounter)return this.articleNewEdit.parent().removeClass("is-dropTarget")},i.prototype.renderAttachment=function(t){return this.attachmentsHolder.append(App.view("generic/attachment_item")(t))},i.prototype.bindAttachmentDelete=function(){return this.attachmentsHolder.on("click",".js-delete",(t=this,function(e){var n,i;return i=$(e.currentTarget).data("id"),t.attachments=_.filter(t.attachments,(function(t){if(t.id.toString()!==i.toString())return t})),App.Ajax.request({type:"DELETE",url:App.Config.get("api_path")+"/upload_caches/"+t.form_id+"/items/"+i,processData:!1}),n=$(e.currentTarget).closest(".attachments"),$(e.currentTarget).closest(".attachment").remove(),0===n.find(".attachment").length&&n.empty(),"function"==typeof t.richTextUploadDeleteCallback?t.richTextUploadDeleteCallback(t.attachments):void 0}));var t},i.prototype.importDraftAttachments=function(t){var e;if(this.ticket.id===t.ticket_id)return this.ajax({id:"import_attachments",type:"POST",url:this.apiPath+"/tickets/"+this.ticket.id+"/shared_draft/import_attachments",data:JSON.stringify({form_id:this.form_id}),processData:!0,success:(e=this,function(n){return App.Event.trigger("ui::ticket::addArticleAttachent",{ticket:e.ticket,attachments:n.attachments,form_id:e.form_id}),App.Event.trigger(t.callbackName,{success:!0})}),error:function(){return App.Event.trigger(t.callbackName,{success:!1})}})},i.prototype.sharedDraftSaved=function(t){if(this.ticket.id===t.ticket_id)return this.el.find("input[name=shared_draft_id]").val(t.shared_draft_id)},i.prototype.actions=function(){var t,e,n,i,s,r;for(t=App.Config.get("TicketZoomArticleAction"),e=[],n=0,s=(i=_.keys(t).sort()).length;n<s;n++)(r=t[i[n]])&&e.push(r);return e},i.prototype.toggleButton=function(t){return this.$(t.currentTarget).toggleClass("btn--active")},i.prototype.toggleTypeButton=function(t){var e;if(!(e=this.$(t.currentTarget)).hasClass("btn--active"))return e.siblings().removeClass("btn--active"),this.toggleButton(t),this.updateSecurityOptions(!0)},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.TicketZoomArticleView=function(i){function s(){this.ticketArticleInsertByIndex=e(this.ticketArticleInsertByIndex,this),this.run=e(this.run,this),this.execute=e(this.execute,this),s.__super__.constructor.apply(this,arguments),this.articleController={},this.run()}return n(s,i),s.prototype.execute=function(t){return this.ticket_article_ids=t.ticket_article_ids,this.run()},s.prototype.run=function(){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g;for(e=[],a=l=0,u=(h=this.ticket_article_ids).length;l<u;a=++l)s=(g=h[a]).toString(),this.articleController[s]||(r=$("<div></div>"),this.articleController[s]=new t({ticket:this.ticket,object_id:g,el:r,ui:this.ui,highlighter:this.highlighter,form_id:this.form_id}),this.ticketArticleInsertByIndex(a,r)||e.push(r));for(n in this.el.append(e),m=[],d=this.articleController){for(i=d[n],o=!1,c=0,p=(f=this.ticket_article_ids).length;c<p;c++)f[c].toString()===n.toString()&&(o=!0);o?m.push(void 0):(i.remove(),m.push(delete this.articleController[n.toString()]))}return m},s.prototype.ticketArticleInsertByIndex=function(t,e){var n,i,s,r,o,a,l,c;if(!this.$(".ticket-article-item").length)return!1;for(s=r=a=t;a<=0?r<=0:r>=0;s=a<=0?++r:--r)if((i=this.ticket_article_ids[s])&&(n=this.$(".ticket-article-item[data-id="+i+"]")).length)return n.after(e),!0;for(s=o=l=t,c=this.ticket_article_ids.length-1;l<=c?o<=c:o>=c;s=l<=c?++o:--o)if((i=this.ticket_article_ids[s])&&(n=this.$(".ticket-article-item[data-id="+i+"]")).length)return n.before(e),!0;return!1},s.prototype.updateFormId=function(t){var e,n,i,s;for(e in this.form_id=t,i=[],n=this.articleController)s=n[e],i.push(s.updateFormId(t));return i},s}(App.Controller),t=function(t){function i(){var t;this.remove=e(this.remove,this),this.toggleMeta=e(this.toggleMeta,this),this.toggleMetaWithDelay=e(this.toggleMetaWithDelay,this),this.measureSeeMore=e(this.measureSeeMore,this),this.setSeeMore=e(this.setSeeMore,this),this.render=e(this.render,this),this.setHighlighter=e(this.setHighlighter,this),i.__super__.constructor.apply(this,arguments),this.seeMoreOpen=!1,this.controllerBind("ui::ticket::shown",(t=this,function(e){if(e.ticket_id.toString()===t.ticket.id.toString())return t.setHighlighter(),t.setSeeMore()}))}return n(i,t),i.prototype.model="TicketArticle",i.prototype.observe={from:!0,to:!0,cc:!0,subject:!0,body:!0,internal:!0,preferences:!0},i.prototype.elements={".textBubble-content":"textBubbleContent",".textBubble-content img":"textBubbleImages",".textBubble-overflowContainer":"textBubbleOverflowContainer"},i.prototype.events={"click .article-meta-permanent":"toggleMetaWithDelay","click .textBubble":"toggleMetaWithDelay","click .textBubble a":"stopPropagation","click .js-toggleFold":"toggleFold","click .richtext-content img":"imageView","click .attachments img":"imageView","click .file-calendar .js-preview":"calendarView","click .js-securityRetryProcess":"retrySecurityProcess"},i.prototype.setHighlighter=function(){var t,e;if(!this.el.is(":hidden"))return e=this,t=function(){if(e.highlighter)return e.highlighter.loadHighlights(e.object_id)},this.delay(t,200)},i.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h;if(this.el.addClass("ticket-article-item "+t.sender.name.toLowerCase()),this.el.attr("data-id",t.id),this.el.attr("id","article-"+t.id),t.internal?this.el.addClass("is-internal"):this.el.removeClass("is-internal"),u=clone(t.preferences.links)||[],"email"===t.type.name&&(c={name:__("Raw"),url:this.Config.get("api_path")+"/ticket_article_plain/"+t.id,target:"_blank"},u.push(c)),i=App.TicketArticle.contentAttachments(t),t.attachments)for(a=0,l=(p=t.attachments).length;a<l;a++)o="","text/html"!==(null!=(n=p[a])?n.preferences["Content-Type"]:void 0)&&(o="?disposition=attachment"),n.url=App.Config.get("api_path")+"/ticket_attachment/"+t.ticket_id+"/"+t.id+"/"+n.id+o,n.preview_url=App.Config.get("api_path")+"/ticket_attachment/"+t.ticket_id+"/"+t.id+"/"+n.id+"?view=preview",n&&n.preferences&&!0===n.preferences["original-format"]&&(c={url:App.Config.get("api_path")+"/ticket_attachment/"+t.ticket_id+"/"+t.id+"/"+n.id+"?disposition=attachment",name:__("Original Formatting"),target:"_blank"},u.push(c));if("text/html"===t.content_type?(s=t.body,t.preferences&&t.preferences.signature_detection?(h='<span class="js-signatureMarker"></span>',(s=(s=s.replace(h,"")).split("<br>")).splice(t.preferences.signature_detection,0,h),s=s.join("<br>")):s=App.Utils.signatureIdentifyByHtml(s),t.html=s):(r=App.Utils.text2html(t.body),t.html=App.Utils.signatureIdentifyByPlaintext(r),(t.html===r||t.preferences&&t.preferences.signature_detection<25)&&(h=!1,s=t.body,t.preferences&&t.preferences.signature_detection&&(h="########SIGNATURE########",(s=s.split("\n")).splice(t.preferences.signature_detection,0,h),s=s.join("\n")),h&&(s=App.Utils.textCleanup(s),t.html=App.Utils.text2html(s),t.html=t.html.replace(h,'<span class="js-signatureMarker"></span>')))),t.preferences.delivery_message)this.html(App.view("ticket_zoom/article_view_delivery_failed")({ticket:this.ticket,article:t,attachments:i,links:u}));else{var d;if("System"!==t.sender.name||"note"===t.type.name)return this.html(App.view("ticket_zoom/article_view")({ticket:this.ticket,article:t,attachments:App.view("generic/attachments")({attachments:i}),links:u})),new App.WidgetAvatar({el:this.$(".js-avatar"),object_id:t.origin_by_id||t.created_by_id,size:40}),this.articleActions=new App.TicketZoomArticleActions({el:this.$(".js-article-actions"),ticket:this.ticket,article:t,lastAttributes:this.lastAttributes,form_id:this.form_id}),this.shown=!1,d=this,e=function(){return d.setSeeMore()},this.delay(e,50),this.setHighlighter();this.html(App.view("ticket_zoom/article_view_system")({ticket:this.ticket,article:t,attachments:i,links:u}))}},i.prototype.setSeeMore=function(){var t;if(!this.el.is(":hidden")&&!this.shown)return this.shown=!0,this.textBubbleImages.each((t=this,function(e,n){if(!n.complete)return $(n).one("load",t.measureSeeMore)})),this.measureSeeMore()},i.prototype.measureSeeMore=function(){var t,e,n,i,s,r,o,a,l;return s=560,r=90,t=this.textBubbleContent,n=this.textBubbleOverflowContainer,this.seeMoreOpen?t.css("height","auto"):t.css("height",""),n.css("opacity",""),(l=t.find(".js-signatureMarker")).get(0)||(l=t.find("div [data-signature=true]")),(a=l.position())&&0===a.top&&(a=l.next("div, p, br").position()),e=t.height(),a&&(i=a.top),i&&i<s?((o=i+30)<r&&(o=r),t.attr("data-height",e+30),t.attr("data-height-origin",o),t.css("height",o+"px"),n.removeClass("hide")):e>s?(t.attr("data-height",e+30),t.attr("data-height-origin",s),o=this.seeMoreOpen?"auto":s+"px",t.css("height",o),n.toggleClass("is-open",this.seeMoreOpen).find(".js-toggleFold").html(this.label),n.removeClass("hide")):n.addClass("hide")},i.prototype.retrySecurityProcess=function(t){var e,n,i;return t.preventDefault(),t.stopPropagation(),n=$(t.target).closest(".ticket-article-item").data("id"),e=App.TicketArticle.find(n),this.ajax({id:"retrySecurityProcess",type:"POST",url:this.apiPath+"/ticket_articles/"+n+"/retry_security_process",processData:!0,success:(i=this,function(t){var n,s,r,o,a;for(a=[],r=0,o=t.length;r<o;r++)s=t[r],e.preferences.security.type===s.type&&(s.sign.success?i.notify({type:"success",msg:App.i18n.translateContent("The signature was successfully verified.")}):s.sign.comment&&(n=App.i18n.translateContent("Signature verification failed!")+" "+App.i18n.translateContent(s.sign.comment||"",s.sign.commentPlaceholders),i.notify({type:"error",msg:n,timeout:2e3})),s.encryption.success?a.push(i.notify({type:"success",msg:App.i18n.translateContent("Decryption was successful.")})):s.encryption.comment?(n=App.i18n.translateContent("Decryption failed!")+" "+App.i18n.translateContent(s.encryption.comment||"",s.encryption.commentPlaceholders),a.push(i.notify({type:"error",msg:n,timeout:2e3}))):a.push(void 0));return a}),error:function(t){return function(){return t.notify({type:"error",msg:App.i18n.translateContent("The retried security process failed!")})}}(this)})},i.prototype.stopPropagation=function(t){return t.stopPropagation()},i.prototype.toggleMetaWithDelay=function(t){var e,n;return n=300,e=$(t.target).closest(".ticket-article-item"),this.elementContainsSelection(e.get(0))?(this.stopPropagation(t),!1):this.lastClick&&+new Date-this.lastClick<n?clearTimeout(this.toggleMetaTimeout):(this.toggleMetaTimeout=setTimeout(this.toggleMeta,n,t),this.lastClick=+new Date)},i.prototype.toggleMeta=function(t){var e,n,i,s,r,o;return t.preventDefault(),e=300,o=(n=$(t.target).closest(".ticket-article-item")).find(".article-meta-clip.top"),s=n.find(".article-meta-clip.bottom"),r=n.find(".article-content-meta.top"),i=n.find(".article-content-meta.bottom"),this.elementContainsSelection(n.get(0))?(this.stopPropagation(t),!1):r.hasClass("hide")?(n.addClass("state--folde-out"),i.removeClass("hide"),r.removeClass("hide"),n.velocity("scroll",{container:n.scrollParent(),offset:-n.offset().top+r.outerHeight(),duration:e,easing:"easeOutQuad"}),r.velocity({properties:{translateY:[0,r.outerHeight()],opacity:[1,0]},options:{speed:e,easing:"easeOutQuad"}}),i.velocity({properties:{translateY:[0,-i.outerHeight()],opacity:[1,0]},options:{speed:e,easing:"easeOutQuad"}}),o.velocity({height:r.outerHeight()},e,"easeOutQuad"),s.velocity({height:i.outerHeight()},e,"easeOutQuad")):(n.removeClass("state--folde-out"),n.velocity("scroll",{container:n.scrollParent(),offset:-n.offset().top-r.outerHeight(),duration:e,easing:"easeOutQuad"}),r.velocity({properties:{translateY:0,opacity:[0,1]},options:{speed:e,easing:"easeOutQuad",complete:function(){return r.addClass("hide")}}}),i.velocity({properties:{translateY:[-i.outerHeight(),0],opacity:[0,1]},options:{speed:e,easing:"easeOutQuad",complete:function(){return i.addClass("hide")}}}),o.velocity({height:0},e,"easeOutQuad"),s.velocity({height:0},e,"easeOutQuad"))},i.prototype.toggleFold=function(t){var e,n,i;return t.preventDefault(),t.stopPropagation(),e=this.textBubbleContent,n=this.textBubbleOverflowContainer,this.seeMoreOpen?(this.label=App.i18n.translateContent("See more"),i=e.attr("data-height-origin"),this.seeMoreOpen=!1):(this.label=App.i18n.translateContent("See less"),i=e.attr("data-height"),this.seeMoreOpen=!0),n.toggleClass("is-open",this.seeMoreOpen).find(".js-toggleFold").html(this.label),e.velocity({properties:{height:i},options:{duration:300}})},i.prototype.isOrContains=function(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1},i.prototype.elementContainsSelection=function(t){var e,n,i,s;if((s=window.getSelection()).rangeCount>0&&s.toString()){for(e=n=0,i=s.rangeCount-1;0<=i?n<=i:n>=i;e=0<=i?++n:--n)if(!this.isOrContains(s.getRangeAt(e).commonAncestorContainer,t))return!1;return!0}return!1},i.prototype.remove=function(){return this.el.remove()},i.prototype.imageView=function(t){return(!t.target||!t.target.parentNode||"a"!==t.target.parentNode.nodeName.toLowerCase())&&(t.preventDefault(),t.stopPropagation(),new App.TicketZoomArticleImageView({image:$(t.target).get(0).outerHTML,parentElement:$(t.currentTarget)}))},i.prototype.calendarView=function(t){var e;return t.preventDefault(),t.stopPropagation(),e=$(t.target).closest(".attachment.file-calendar"),new App.TicketZoomArticleCalendarView({calendar:e.get(0).outerHTML})},i.prototype.updateFormId=function(t){var e;return null!=(e=this.articleActions)?e.form_id=t:void 0},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomAttributeBar=function(n){function i(){var e;this.chooseSecondaryAction=t(this.chooseSecondaryAction,this),this.onActionMacroMouseLeave=t(this.onActionMacroMouseLeave,this),this.onActionMacroMouseEnter=t(this.onActionMacroMouseEnter,this),this.saveDraft=t(this.saveDraft,this),this.performTicketMacro=t(this.performTicketMacro,this),this.closeMacroMenu=t(this.closeMacroMenu,this),this.openMacroMenu=t(this.openMacroMenu,this),this.toggleMacroMenu=t(this.toggleMacroMenu,this),this.checkMacroChanges=t(this.checkMacroChanges,this),this.stop=t(this.stop,this),this.start=t(this.start,this),this.render=t(this.render,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.Macro.subscribe(this.checkMacroChanges),this.render(),this.controllerBind("ui:rerender",(e=this,function(){return e.render()})),this.controllerBind("MacroPreconditionUpdate",function(t){return function(e){if(e.taskKey===t.taskKey)return t.searchCondition=e.params,t.render()}}(this)),this.controllerBind("ui::ticket::updateSharedDraft",function(t){return function(e){if(e.taskKey===t.taskKey)return t.render(e)}}(this)),this.listenTo(App.Group,"refresh",function(t){return function(e){var n,i;if(i=t.el.closest(".content").find("[name=group_id]").val(),(n=App.Group.find(i))&&e&&e.id===n.id&&t.sharedDraftsEnabled!==n.shared_drafts)return t.render({newGroupId:n.id})}}(this))}return e(i,n),i.prototype.elements={".js-submitDropdown":"buttonDropdown",".js-reset":"resetButton"},i.prototype.events={"mousedown .js-openDropdownMacro":"toggleMacroMenu","click .js-openDropdownMacro":"preventDefaultAndStopPropagation","mouseup .js-dropdownActionMacro":"performTicketMacro","mouseenter .js-dropdownActionMacro":"onActionMacroMouseEnter","mouseleave .js-dropdownActionMacro":"onActionMacroMouseLeave","mouseup .js-dropdownActionSaveDraft":"saveDraft","mouseenter .js-dropdownActionSaveDraft":"onActionMacroMouseEnter","mouseleave .js-dropdownActionSaveDraft":"onActionMacroMouseLeave","click .js-secondaryAction":"chooseSecondaryAction"},i.prototype.searchCondition={},i.prototype.getAction=function(){return App.Session.get().preferences.secondaryAction||App.Config.get("ticket_secondary_action")||"stayOnTab"},i.prototype.release=function(){return App.Macro.unsubscribe(this.subscribeId)},i.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f;if(null==t&&(t={}),u=!1,this.resetButton.get(0)&&!this.resetButton.hasClass("hide")&&this.ticket.editable()&&(u=!0),i=App.Group.find((null!=t?t.newGroupId:void 0)||this.ticket.group_id),n=App.TicketSharedDraftZoom.findByAttribute("ticket_id",this.ticket.id),e=App.User.current().allGroupIds("change"),h=(null!=i?i.shared_drafts:void 0)&&_.contains(e,String(i.id)),
p=(d=(null!=i?i.shared_drafts:void 0)&&_.contains(e,String(i.id)))&&null!=n&&this.ticket.editable(),this.sharedDraftsEnabled=d,c=App.Macro.getList(),this.macroLastUpdated=App.Macro.lastUpdatedAt(),this.possibleMacros=[],_.isEmpty(c)||"customer"===this.ticket.currentView())l=!0;else for(s=0,r=c.length;s<r;s++)a=c[s],(_.isEmpty(a.group_ids)||!this.searchCondition.group_id||_.includes(a.group_ids,parseInt(this.searchCondition.group_id)))&&this.possibleMacros.push(a);return o=$(App.view("ticket_zoom/attribute_bar")({ticket:this.ticket,macros:this.possibleMacros,macroDisabled:l,sharedButtonVisible:p,sharedDraftsDisabled:!d,overview_id:this.overview_id,resetButtonShown:u,sharedDraftButtonShown:h})),this.setSecondaryAction(this.getAction(),o),"agent"===this.ticket.currentView()&&(this.taskbarWatcher=new App.TaskbarWatcher({taskKey:this.taskKey,el:o.filter(".js-avatars")})),this.html(o),this.el.find(".js-draft").popover({trigger:"hover",container:"body",html:!0,animation:!1,delay:100,placement:"auto",sanitize:!1,content:(f=this,function(){var t,e,i,s;return n=App.TicketSharedDraftZoom.findByAttribute("ticket_id",null!=(e=f.ticket)?e.id:void 0),i=App.ViewHelpers.humanTime(null!=n?n.updated_at:void 0),t=null!=(s=App.User.find(null!=n?n.updated_by_id:void 0))?s.displayName():void 0,"<br>"+App.i18n.translatePlain("Last change %s %s by %s",i,"<br>",t)})})},i.prototype.start=function(){if(this.taskbarWatcher)return this.taskbarWatcher.start(),this.setSecondaryAction(this.getAction(),this.el)},i.prototype.stop=function(){if(this.taskbarWatcher)return this.taskbarWatcher.stop()},i.prototype.checkMacroChanges=function(){if(App.Macro.lastUpdatedAt()!==this.macroLastUpdated)return this.render()},i.prototype.toggleMacroMenu=function(){if(!this.buttonDropdown.hasClass("is-open"))return this.openMacroMenu();this.closeMacroMenu()},i.prototype.openMacroMenu=function(){return this.buttonDropdown.addClass("is-open"),$(document).on("click.buttonDropdown",this.closeMacroMenu)},i.prototype.closeMacroMenu=function(){return this.buttonDropdown.removeClass("is-open"),$(document).off("click.buttonDropdown")},i.prototype.performTicketMacro=function(t){var e,n;return n=$(t.currentTarget).data("id"),e=App.Macro.find(n),this.macroCallback(t,e),this.closeMacroMenu()},i.prototype.saveDraft=function(t){return this.draftCallback(t)},i.prototype.onActionMacroMouseEnter=function(t){return this.$(t.currentTarget).addClass("is-active")},i.prototype.onActionMacroMouseLeave=function(t){return this.$(t.currentTarget).removeClass("is-active")},i.prototype.chooseSecondaryAction=function(t){var e;return e=$(t.currentTarget).find(".js-secondaryActionLabel").data("type"),this.setSecondaryAction(e,this.el),this.setUserPreferencesSecondaryAction(e)},i.prototype.setSecondaryAction=function(t,e){var n,i;return 0===(n=e.find(".js-secondaryActionLabel[data-type="+t+"]")).length?this.setSecondaryAction("stayOnTab",e):(i=n.text(),e.find(".js-secondaryAction .js-selectedIcon.is-selected").removeClass("is-selected"),n.closest(".js-secondaryAction").find(".js-selectedIcon").addClass("is-selected"),e.find(".js-secondaryActionButtonLabel").text(i),e.find(".js-secondaryActionButtonLabel").data("type",t))},i.prototype.setUserPreferencesSecondaryAction=function(t){var e;if((e=App.Session.get()).preferences.secondaryAction!==t)return e.preferences.secondaryAction=t,this.ajax({id:"setUserPreferencesSecondaryAction",type:"PUT",url:App.Config.get("api_path")+"/users/preferences",data:JSON.stringify({secondaryAction:t}),processData:!0})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketCustomerAvatar=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="Ticket",i.prototype.observe={customer_id:!0},i.prototype.globalRerender=!1,i.prototype.render=function(t){return new App.WidgetAvatar({el:this.el.find(".js-avatar"),object_id:t.customer_id,size:50})},i}(App.ControllerObserver)}.call(this),function(){App.FormHandlerAdminCoreWorkflow=function(){function t(){}return t.run=function(t,e,n,i,s,r){if("object"===e.name&&!r.FormHandlerAdminCoreWorkflowDone)return r.FormHandlerAdminCoreWorkflowDone=!0,$(s).find("select[name=object]").off("change.core_workflow_conditions").on("change.change.core_workflow_conditions",(function(t){var o,a,l,c;for(c=[],o=0,a=n.length;o<a;o++)"condition_saved"!==(e=n[o]).name&&"condition_selected"!==e.name&&"perform"!==e.name||(e.workflow_object=$(t.target).val(),l=r.formGenItem(e,i,s),c.push(s.find('div.form-group[data-attribute-name="'+e.name+'"]').replaceWith(l)));return c}))},t}()}.call(this),function(){App.FormHandlerCoreWorkflow=function(){function FormHandlerCoreWorkflow(){}var articleParamsCache,coreWorkflowParams,coreWorkflowRequests,coreWorkflowRestrictions;return FormHandlerCoreWorkflow.DEBUG=!1,coreWorkflowParams={},coreWorkflowRequests={},coreWorkflowRestrictions={},articleParamsCache={},FormHandlerCoreWorkflow.getObjects=function(){return Object.keys(App.Config.get("core_workflow_config").execution)},FormHandlerCoreWorkflow.getScreens=function(){return _.uniq(_.flatten(Object.values(App.Config.get("core_workflow_config").execution)))},FormHandlerCoreWorkflow.checkScreen=function(t,e){var n,i,s;for(n in i=App.Config.get("core_workflow_config").execution)if(s=i[n],t===n&&_.contains(s,e))return!0;return!1},FormHandlerCoreWorkflow.getRequests=function(){return coreWorkflowRequests},FormHandlerCoreWorkflow.delaySubmit=function(t,e){var n,i;for(n in coreWorkflowRequests)if(i=coreWorkflowRequests[n],t.idPrefix===i.ui.idPrefix)return coreWorkflowRequests[n].triggerSubmit=e,!0;return App.FormHandlerCoreWorkflow.triggerSubmit(e)},FormHandlerCoreWorkflow.triggerSubmit=function(t){return"FORM"===$(t).get(0).tagName&&(t=$(t).find("button[type=submit], .btn--success").first()),$(t).trigger("click")},FormHandlerCoreWorkflow.requestsRunning=function(t){var e,n;for(e in coreWorkflowRequests)if(n=coreWorkflowRequests[e],t.idPrefix===n.ui.idPrefix)return!0;return!1},FormHandlerCoreWorkflow.screenValid=function(t){var e;return!!t.model&&(!!t.model.className&&(!!t.screen&&(void 0!==(e=App.Config.get("core_workflow_config").execution[t.model.className])&&!!_.contains(e,t.screen))))},FormHandlerCoreWorkflow.useWebSockets=function(){if(App.WebSocket.channel())return!App.Config.get("core_workflow_ajax_mode")},FormHandlerCoreWorkflow.restrictValuesAttributeCache=function(t,e){var n;return n={values:e},t.relation?(n.lastUpdatedAt=App[t.relation].lastUpdatedAt(),n):n},FormHandlerCoreWorkflow.restrictValues=function(t,e,n,i,s,r){var o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A;if(!_.isEmpty(r.restrict_values)){for(u in y=[],v=r.restrict_values)A=v[u],y.push(function(){var v,y,C,T,S,x;for(x=[],v=0,C=i.length;v<C;v++)if((o=i[v]).name===u&&(p=$.extend(!0,{},o),c=App.ControllerForm.findFieldByName(u,e),b=App.ControllerForm.fieldIsShown(c),h=App.ControllerForm.fieldIsMandatory(c),m=s[p.name],void 0!==r.select[p.name]&&(m=r.select[p.name],coreWorkflowParams[t][p.name]=m,delete coreWorkflowRestrictions[t]),(g=o.name.split("::")).length>1&&void 0!==(l=g.reduce((function(t,e){return null!=t?t[e]:void 0}),s))&&(m=l),!(null!=coreWorkflowRestrictions&&null!=(S=coreWorkflowRestrictions[t])?S[p.name]:void 0)||(a=App.FormHandlerCoreWorkflow.restrictValuesAttributeCache(o,A),!_.isEqual(coreWorkflowRestrictions[t][p.name],a)))){if(coreWorkflowRestrictions[t]||(coreWorkflowRestrictions[t]={}),coreWorkflowRestrictions[t][p.name]=App.FormHandlerCoreWorkflow.restrictValuesAttributeCache(o,A),k=!1,p.multiple)_.isArray(m)&&(m=_.intersection(m,A)).length>0&&(k=!0);else for(y=0,T=A.length;y<T;y++)if(null!=(w=A[y])&&null!=m&&w.toString()===m.toString()){k=!0;break}p.filter=A,k?(p.default=m,p.newValue=m):s.id?(f=App[n.model.className].find(s.id))&&f[p.name]&&(p.default=f[p.name],p.newValue=f[p.name]):p.newValue="",o.relation&&(p.rejectNonExistentValues=!0),n.params||(n.params={}),d=n.formGenItem(p,t,e),e.find('[name="'+u+'"]').closest(".form-group").find("[name!=''][name]").each((function(){var t;return t=$(this).attr("name"),$.each($._data(this,"events"),(function(e,n){return $.each(n,(function(e,n){var i,s;if(i=n.type,n.namespace.length>0&&(i=n.type+"."+n.namespace),(s=d.find("[name='"+t+"']")).length>0)return s.on(i,n.data,n.handler)}))}))})),e.find('[name="'+u+'"]').closest(".form-group").replaceWith(d),e.find('[name="'+u+'"]').closest(".form-group").find(".js-helpMessage").tooltip(),b?n.show(u,e):n.hide(u,e),h?n.mandantory(u,e):n.optional(u,e),void 0!==r.select[p.name]?x.push(e.find('[name="'+u+'"]').trigger("change",{skip_core_worfklow:!0})):x.push(void 0)}return x}());return y}},FormHandlerCoreWorkflow.fillIn=function(t,e,n,i,s,r){var o,a,l;if(!_.isEmpty(r)){for(o in l=[],r)r[o],(a=e.find('[name="'+o+'"], div[data-name="'+o+'"]')).hasClass("richtext-content")?a.html(r[o]):a.data("handleValue")?a.data("handleValue")(r[o]):a.val(r[o]),coreWorkflowParams[t][o]=r[o],l.push(a.trigger("change",{skip_core_worfklow:!0}));return l}},FormHandlerCoreWorkflow.changeVisibility=function(t,e,n){var i,s,r;if(!_.isEmpty(n)){for(i in s=[],n)"show"===(r=n[i])?s.push(e.show(i,t)):"hide"===r?s.push(e.hide(i,t)):"remove"===r?s.push(e.hide(i,t,!0)):s.push(void 0);return s}},FormHandlerCoreWorkflow.changeMandatory=function(t,e,n,i){var s,r;if(!_.isEmpty(n)){for(s in r=[],n)n[s]&&!_.contains(["hide","remove"],i[s])?r.push(e.mandantory(s,t)):r.push(e.optional(s,t));return r}},FormHandlerCoreWorkflow.changeReadonly=function(t,e,n){var i,s;if(!_.isEmpty(n)){for(i in s=[],n)n[i]?s.push(e.readonly(i,t)):s.push(e.changeable(i,t));return s}},FormHandlerCoreWorkflow.changeFlags=function(t,e,n){var i,s,r;if(!_.isEmpty(n)){for(i in s=[],n)r=n[i],s.push(e.setFlag(i,r));return s}},FormHandlerCoreWorkflow.executeEval=function(form,ui,data){var i,len,results,statement;if(!_.isEmpty(data)){for(results=[],i=0,len=data.length;i<len;i++)statement=data[i],results.push(eval(statement));return results}},FormHandlerCoreWorkflow.runCallbacks=function(t){var e,n,i,s,r,o;for(o=[],i=0,s=(n=(null!=t&&null!=(r=t.core_workflow)?r.callbacks:void 0)||[]).length;i<s;i++)e=n[i],o.push(e());return o},FormHandlerCoreWorkflow.runWorkflow=function(t,e,n,i,s,r){if(this.DEBUG&&console.time("runWorkflow/"+e+"/"+i.model.className+"/"+i.screen),App.Collection.loadAssets(t.assets),App.FormHandlerCoreWorkflow.restrictValues(e,n,i,s,r,t),App.FormHandlerCoreWorkflow.fillIn(e,n,i,s,r,t.fill_in),App.FormHandlerCoreWorkflow.changeVisibility(n,i,t.visibility),App.FormHandlerCoreWorkflow.changeMandatory(n,i,t.mandatory,t.visibility),App.FormHandlerCoreWorkflow.changeReadonly(n,i,t.readonly),App.FormHandlerCoreWorkflow.changeFlags(n,i,t.flags),App.FormHandlerCoreWorkflow.executeEval(n,i,t.eval),App.FormHandlerCoreWorkflow.runCallbacks(i),this.DEBUG)return console.timeEnd("runWorkflow/"+e+"/"+i.model.className+"/"+i.screen)},FormHandlerCoreWorkflow.runRequest=function(t){var e,n,i,s,r,o;if(coreWorkflowRequests[t.request_id])return r=coreWorkflowRequests[t.request_id].triggerSubmit,n=coreWorkflowRequests[t.request_id].classname,i=coreWorkflowRequests[t.request_id].form,o=coreWorkflowRequests[t.request_id].ui,e=coreWorkflowRequests[t.request_id].attributes,s=coreWorkflowRequests[t.request_id].params,App.FormHandlerCoreWorkflow.runWorkflow(t,n,i,o,e,s),delete coreWorkflowRequests[t.request_id],r?App.FormHandlerCoreWorkflow.triggerSubmit(r):void 0},FormHandlerCoreWorkflow.setHook=function(){if(!FormHandlerCoreWorkflow.hooked&&App.FormHandlerCoreWorkflow.useWebSockets())return FormHandlerCoreWorkflow.hooked=!0,App.Event.bind("core_workflow",(function(t){return FormHandlerCoreWorkflow.runRequest(t)}),"ws:core_workflow")},FormHandlerCoreWorkflow.getForm=function(t){return"FORM"!==t.get(0).tagName?t.closest("form"):$(t)},FormHandlerCoreWorkflow.cleanParams=function(t){var e;return delete(e=$.extend(!0,{},t)).customer_id_completion,delete e.body,delete e.formSenderType,e},FormHandlerCoreWorkflow.request=function(t,e,n,i,s){var r,o,a;return o="CoreWorkflow-"+Math.floor(999999*Math.random()).toString(),(coreWorkflowRequests={})[o]={classname:t,form:e,ui:n,attributes:i,params:s},r={event:"core_workflow",request_id:o,params:s,class_name:n.model.className,screen:n.screen},n.lastChangedAttribute&&(r.last_changed_attribute=n.lastChangedAttribute,n.lastChangedAttribute="-"),App.FormHandlerCoreWorkflow.useWebSockets()?App.WebSocket.send(r):n.ajax({id:"core_workflow-"+r.request_id,type:"POST",url:n.apiPath+"/core_workflows/perform",data:JSON.stringify(r),success:(a=this,function(t){return a.runRequest(t)}),error:function(){delete coreWorkflowRequests[o]}})},FormHandlerCoreWorkflow.article=function(t,e){var n;return articleParamsCache[e]?articleParamsCache[e]:((null!=(n=t.articleParamsCallback())?n.body:void 0)&&(n.body=App.Utils.html2text(n.body)),articleParamsCache[e]=n)},FormHandlerCoreWorkflow.run=function(t,e,n,i,s,r,o){var a,l;if(null==o&&(o="default"),!_.contains(["ticket_selector","core_workflow_condition","core_workflow_perform"],e.tag)&&App.FormHandlerCoreWorkflow.screenValid(r)&&(a=App.FormHandlerCoreWorkflow.cleanParams(t),r.articleParamsCallback&&(a.article=App.FormHandlerCoreWorkflow.article(r,o)),(null!=r&&null!=(l=r.params)?l.id:void 0)&&r.screen.match(/edit/)?a.id=r.params.id:delete a.id,!_.isEqual(coreWorkflowParams[i],a))){if(coreWorkflowParams[i]=a,!r.formMeta||!r.formMeta.core_workflow||r.lastChangedAttribute)return App.FormHandlerCoreWorkflow.setHook(),App.FormHandlerCoreWorkflow.request(i,s,r,n,a);App.FormHandlerCoreWorkflow.runWorkflow(r.formMeta.core_workflow,i,s,r,n,a)}},FormHandlerCoreWorkflow}()}.call(this),function(){var t;t=function(){function t(){}return t.run=function(t,e,n,i,s,r){if("group_id"===e.name)return App.Event.trigger("MacroPreconditionUpdate",{taskKey:r.taskKey,params:t})},t}(),App.Config.set("120-ticketFormMacro",t,"TicketZoomFormHandler")}.call(this),function(){App.TicketZoomFormHandlerMultiOrganization=function(){function t(){}return t.run=function(t,e,n,i,s,r){var o,a,l;if(("customer_id"===e.name||!r.permissionCheck("ticket.agent"))&&("title"===e.name||!r.permissionCheck("ticket.customer")||r.permissionCheck("ticket.agent"))&&(l=s.find("div[data-attribute-name=organization_id] .js-input")))return(o=r.permissionCheck("ticket.agent")?App.User.find(t.customer_id):App.Session.get())&&o.organization_ids.length>0&&o.organization_id&&(a=App.Organization.find(o.organization_id))?l.get(0).selectValue(a.id,a.name):void 0},t}(),App.Config.set("200-MultiOrganization",App.TicketZoomFormHandlerMultiOrganization,"TicketCreateFormHandler")}.call(this),function(){var t;t=function(){function t(){}return t.run=function(t,e,n,i,s,r){if("group_id"===e.name)return App.Event.trigger("ui::ticket::updateSecurityOptions",{taskKey:r.taskKey})},t}(),App.Config.set("140-ticketFormSecurityOptions",t,"TicketZoomFormHandler")}.call(this),function(){var t;t=function(){function t(){}return t.run=function(t,e,n,i,s,r){if("group_id"===e.name)return App.Event.trigger("ui::ticket::updateSharedDraft",{taskKey:r.taskKey,newGroupId:t.group_id})},t}(),App.Config.set("150-ticketFormSharedDraft",t,"TicketZoomFormHandler")}.call(this),function(){var t;t=function(){function t(){}return t.run=function(t,e,n,i,s,r){if("group_id"===e.name)return App.Event.trigger("TextModulePreconditionUpdate",{taskKey:r.taskKey,params:t})},t}(),App.Config.set("110-ticketFormTextModule",t,"TicketZoomFormHandler"),App.Config.set("110-ticketFormTextModule",t,"TicketCreateFormHandler")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomHighlighter=function(n){function i(){var e,n,s,r;if(this.toggleHighlightAtSelection=t(this.toggleHighlightAtSelection,this),this.updateSelectedArticle=t(this.updateSelectedArticle,this),this.onMouseUp=t(this.onMouseUp,this),this.onMouseDown=t(this.onMouseDown,this),this.pickColor=t(this.pickColor,this),this.toggleHighlight=t(this.toggleHighlight,this),this.refreshObserver=t(this.refreshObserver,this),this.highlightDisable=t(this.highlightDisable,this),this.highlightEnable=t(this.highlightEnable,this),this.restoreOriginalHighlight=t(this.restoreOriginalHighlight,this),this.storeOriginalHighlight=t(this.storeOriginalHighlight,this),this.highlighterInstance=t(this.highlighterInstance,this),i.__super__.constructor.apply(this,arguments),"agent"===this.ticket.currentView()){for(this.currentHighlights={},rangy.init(),this.highlighter=rangy.createHighlighter(document,"TextRange"),n=0,s=(r=this.colors).length;n<s;n++)e=r[n],this.addClassApplier(e);this.setColor(),this.render(),this.storeOriginalHighlight()}}return e(i,n),i.prototype.elements={".textBubble-content":"articles",".js-highlight-icon":"highlighterControl"},i.prototype.events={"click .js-highlight":"toggleHighlight","click .js-highlightColor":"pickColor"},i.prototype.colors=[{name:__("Yellow"),color:"#f7e7b2"},{name:__("Green"),color:"#bce7b6"},{name:__("Blue"),color:"#b3ddf9"},{name:__("Pink"),color:"#fea9c5"},{name:__("Purple"),color:"#eac5ee"}],i.prototype.activeColorIndex=0,i.prototype.highlightClassPrefix="highlight-",i.prototype.render=function(){return this.html(App.view("ticket_zoom/highlighter")({colors:this.colors,activeColorIndex:this.activeColorIndex}))},i.prototype.highlighterInstance=function(){return this.highlighter},i.prototype.storeOriginalHighlight=function(){return this.originalHighlight={fill:this.highlighterControl.css("fill"),opacity:this.highlighterControl.css("opacity")}},i.prototype.restoreOriginalHighlight=function(){if(this.originalHighlight)return this.highlighterControl.css("fill",this.originalHighlight.fill),this.highlighterControl.css("opacity",this.originalHighlight.opacity)},i.prototype.highlightEnable=function(){return this.isActive=!0,this.highlighterControl.css("opacity",1),this.highlighterControl.css("fill",this.activeColor),this.refreshObserver()},i.prototype.highlightDisable=function(){return this.isActive=!1,this.restoreOriginalHighlight(),this.el.closest(".content").find(".textBubble").removeAttr("data-highlightcolor"),this.refreshObserver()},i.prototype.refreshObserver=function(){var t;return(t=this.el.closest(".content").find(".textBubble-content")).off("mouseup",this.onMouseUp),t.on("mouseup",this.onMouseUp),t.off("mousedown",this.onMouseDown),t.on("mousedown",this.onMouseDown)},i.prototype.loadHighlights=function(t){var e;if("agent"===this.ticket.currentView()&&(e=App.TicketArticle.find(t)).preferences&&e.preferences.highlight&&!_.isEmpty(e.preferences.highlight)&&"type:TextRange"!==e.preferences.highlight&&this.currentHighlights[t]!==e.preferences.highlight)return this.currentHighlights[t]=e.preferences.highlight,this.highlighter.deserialize(e.preferences.highlight)},i.prototype.storeHighlights=function(t){var e,n,i,s,r,o,a,l;for(a="$article-content-"+t,l=[(r=(n=this.highlighter.serialize()).split("|")).shift()],i=0,o=r.length;i<o;i++)(s=r[i]).substr(s.length-a.length,s.length)===a&&l.push(s);return n=l.join("|"),(e=App.TicketArticle.find(t)).preferences.highlight=n,e.save()},i.prototype.addClassApplier=function(t){return this.highlighter.addClassApplier(rangy.createCssClassApplier(this.highlightClassPrefix+t.name))},i.prototype.setColor=function(){if(this.highlightClass=this.highlightClassPrefix+this.colors[this.activeColorIndex].name,this.activeColor=this.colors[this.activeColorIndex].color,this.isActive)return this.el.closest(".content").find(".textBubble").attr("data-highlightcolor",this.colors[this.activeColorIndex].name)},i.prototype.toggleHighlight=function(t){return this.mouseDownInside=!1,this.mouseUpInside=!1,this.isActive?($(t.currentTarget).removeClass("active"),this.highlightDisable()):(this.highlightEnable(),rangy.getSelection().isCollapsed?void 0:this.toggleHighlightAtSelection(this.content,this.article_id))},i.prototype.pickColor=function(t){return this.$(".js-highlightColor .is-selected").removeClass("is-selected"),$(t.currentTarget).find(".js-selectedIcon").addClass("is-selected"),this.activeColorIndex=$(t.currentTarget).attr("data-key"),this.setColor(),this.highlightEnable(),this.toggleHighlightAtSelection(this.content,this.article_id)},i.prototype.onMouseDown=function(t){return this.updateSelectedArticle(t)?this.mouseDownInside=!0:this.mouseDownInside=!1},i.prototype.onMouseUp=function(t){if(this.updateSelectedArticle(t)?this.mouseUpInside=!0:this.mouseUpInside=!1,this.mouseDownInside&&this.mouseUpInside&&this.isActive)return this.toggleHighlightAtSelection(this.content,this.article_id)},i.prototype.updateSelectedArticle=function(t){return this.content=$(t.currentTarget).closest(".textBubble-content"),this.article_id=this.content.data("id"),!!this.article_id||(this.content=$(t.currentTarget),this.article_id=this.content.data("id"),!!this.article_id)},i.prototype.toggleHighlightAtSelection=function(t,e){var n;if(t)return n=rangy.getSelection(),t.attr("data-highlightcolor",this.colors[this.activeColorIndex].name),this.highlighter.selectionOverlapsHighlight(n)?(this.highlighter.unhighlightSelection(),n.removeAllRanges(),this.highlightDisable(),void this.storeHighlights(e)):n&&n.rangeCount>0?(this.highlighter.highlightSelection(this.highlightClass,{selection:n,containerElementId:t.get(0).id}),n.removeAllRanges(),this.highlightDisable(),this.storeHighlights(e)):void 0},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomMeta=function(n){function i(){return this.copyTicketNumber=t(this.copyTicketNumber,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("Escalation"),i.prototype.events={"click .ticket-number-copy > .ticketNumberCopy-icon":"copyTicketNumber"},i.prototype.model="Ticket",i.prototype.observe={number:!0,created_at:!0,escalation_at:!0},i.prototype.render=function(t){return this.html(App.view("ticket_zoom/meta")({ticket:t,isCustomer:"customer"===t.currentView()})),this.renderPopovers()},i.prototype.copyTicketNumber=function(){var t;if(t=this.el.find(".js-objectNumber").first().data("number")||"")return this.copyToClipboardWithTooltip(t,".ticket-number-copy",".main")},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketOrganizationAvatar=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="Ticket",i.prototype.observe={organization_id:!0},i.prototype.globalRerender=!1,i.prototype.render=function(t){if(!_.isNull(t.organization_id)&&!_.isUndefined(t.organization_id))return new App.WidgetOrganizationAvatar({el:this.el.find(".js-avatar-organization"),object_id:t.organization_id,size:50})},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomOverviewNavigator=function(n){function i(){var e,n;(this.open=t(this.open,this),this.render=t(this.render,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.overview_id)&&(n=this,e=function(){return n.delay(n.render,2600,"overview-navigator")},this.overview=App.Overview.find(this.overview_id),this.bindId=App.OverviewListCollection.bind(this.overview.link,e,!1),this.render())}return e(i,n),i.include(App.TicketNavigable),i.prototype.events={"click a":"open"},i.prototype.release=function(){return App.OverviewListCollection.unbind(this.bindId)},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u;if(this.overview_id){if(a=App.OverviewListCollection.get(this.overview.link)){for(t=0,e=!1,i=!1,s=!1,n=0,r=(c=a.tickets).length;n<r;n++)if(u=c[n],t+=1,i=a.tickets[t],s=a.tickets[t-2],u.id===this.ticket_id){e=!0;break}if(e)return i&&(o=App.Ticket.find(i.id)),s&&(l=App.Ticket.find(s.id)),this.html(App.view("ticket_zoom/overview_navigator")({title:a.overview.name,total_count:a.count,current_position:t,next:o,previous:l}));this.html("")}}else this.html("")},i.prototype.open=function(t){var e,n,i;if(t.preventDefault(),null!=(e=(n=$(t.target)).data("id")))i=n.attr("href");else{if(null==(e=n.closest("a").data("id")))return;i=n.closest("a").attr("href")}return this.taskOpenTicket(e,i)},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty,i=function(t,e){return function(){return t.apply(e,arguments)}};App.TicketZoomSetting=function(n){function i(){i.__super__.constructor.apply(this,arguments),this.permissionCheck("admin")&&this.render()}return e(i,n),i.prototype.events={"click .js-setting":"show"},i.prototype.render=function(){return this.html(App.view("ticket_zoom/setting")())},i.prototype.show=function(){return new t},i}(App.Controller),t=function(t){function n(){this.post=i(this.post,this),this.render=i(this.render,this),n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.buttonClose=!0,n.prototype.buttonCancel=!0,n.prototype.buttonSubmit=!1,n.prototype.head=__("Settings"),n.prototype.render=function(){return n.__super__.render.apply(this,arguments)},n.prototype.post=function(){return new App.SettingsArea({area:"UI::TicketZoom",el:this.el.find(".modal-body")})},n.prototype.content=function(){return App.view("generic/page_loading")()},n}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomSidebar=function(n){function i(){return this.render=t(this.render,this),this.postParams=t(this.postParams,this),this.commit=t(this.commit,this),this.reload=t(this.reload,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="Ticket",i.prototype.observe={customer_id:!0,organization_id:!0},i.prototype.get=function(t){return this.sidebarBackends[t]},i.prototype.reload=function(t){var e,n,i,s;for(n in s=[],i=this.sidebarBackends)(e=i[n])&&e.reload?s.push(e.reload(t)):s.push(void 0);return s},i.prototype.commit=function(t){var e,n,i,s;for(n in s=[],i=this.sidebarBackends)(e=i[n])&&e.commit?s.push(e.commit(t)):s.push(void 0);return s},i.prototype.postParams=function(t){var e,n,i,s;for(n in s=[],i=this.sidebarBackends)(e=i[n])&&e.postParams?s.push(e.postParams(t)):s.push(void 0);return s},i.prototype.render=function(t){var e,n,i,s,r;for(this.sidebarBackends||(this.sidebarBackends={}),this.sidebarItems=[],r=App.Config.get("TicketZoomSidebar"),e=0,s=(i=_.keys(r).sort()).length;e<s;e++)n=i[e],this.sidebarBackends[n]&&this.sidebarBackends[n].reload?this.sidebarBackends[n].reload({params:this.params,query:this.query,formMeta:this.formMeta,markForm:this.markForm,tags:this.tags,mentions:this.mentions,time_accountings:this.time_accountings,links:this.links,parent:this.parent}):this.sidebarBackends[n]=new r[n]({ticket:t,query:this.query,taskGet:this.taskGet,taskKey:this.taskKey,formMeta:this.formMeta,markForm:this.markForm,tags:this.tags,mentions:this.mentions,time_accountings:this.time_accountings,links:this.links,parent:this.parent}),this.sidebarItems.push(this.sidebarBackends[n]);return this.sidebar&&this.sidebar.releaseController(),this.sidebar=new App.Sidebar({el:this.$(".tabsSidebar"),sidebarState:this.sidebarState,items:this.sidebarItems})},i}(App.ControllerObserver)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){var t;this.showObjects=e(this.showObjects,this),this.sidebarItem=e(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("ui::ticket::load",(t=this,function(e){if(e.ticket_id.toString()===t.ticket.id.toString()&&t.el)return t.showObjects(t.el)}))}return n(i,t),i.prototype.sidebarItem=function(){if(this.Config.get("ui_ticket_zoom_sidebar_article_attachments"))return this.item={name:"attachment",badgeIcon:"paperclip",sidebarHead:__("Attachments"),sidebarCallback:this.showObjects,sidebarActions:[]},this.item},i.prototype.showObjects=function(t){var e,n,i,s,r,o,a,l,c,u,p,h;if(this.el=t,!_.isEmpty(this.ticket)&&!_.isEmpty(this.ticket.article_ids)){for((i=_.clone(this.ticket.article_ids)).sort((function(t,e){return t-e})),h={},p=[],a=0,c=i.length;a<c;a++)if(n=i[a],App.TicketArticle.exists(n))for(e=App.TicketArticle.find(n),l=0,u=(r=App.TicketArticle.contentAttachments(e)).length;l<u;l++)h[(s=r[l]).store_file_id]||(h[s.store_file_id]=!0,p.push({attachment:s,article:e}));return p=p.reverse(),o=App.view("ticket_zoom/sidebar_article_attachment")({ticketAttachments:p}),this.el.html(o),this.el.find(".js-attachments img").click(this.imageView),this.el.find(".file-calendar .js-preview").click(this.calendarView)}this.el.html("<div>"+App.i18n.translateInline("none")+"</div>")},i.prototype.imageView=function(t){return t.preventDefault(),t.stopPropagation(),new App.TicketZoomArticleImageView({image:$(t.target).get(0).outerHTML})},i.prototype.calendarView=function(t){var e;return t.preventDefault(),t.stopPropagation(),e=$(t.target).closest(".attachment.file-calendar"),new App.TicketZoomArticleCalendarView({calendar:e.get(0).outerHTML})},i}(App.Controller),App.Config.set("900-ArticleAttachments",t,"TicketZoomSidebar")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){return this.changeCustomer=e(this.changeCustomer,this),this.editCustomer=e(this.editCustomer,this),this.showCustomer=e(this.showCustomer,this),this.badgeRenderLocal=e(this.badgeRenderLocal,this),this.badgeRender=e(this.badgeRender,this),this.metaBadge=e(this.metaBadge,this),this.sidebarItem=e(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.sidebarItem=function(){var t,e;if("agent"===this.ticket.currentView())return this.item={name:"customer",badgeCallback:this.badgeRender,sidebarHead:__("Customer"),sidebarCallback:this.showCustomer,sidebarActions:[]},this.ticket.editable()&&this.item.sidebarActions.push({title:__("Change Customer"),name:"customer-change",callback:this.changeCustomer}),this.ticket&&1===this.ticket.customer_id||(this.ticket.customer_id&&App.User.exists(this.ticket.customer_id)&&(null!=(t=App.User.find(this.ticket.customer_id))?t.isAccessibleBy(App.User.current(),"change"):void 0)&&this.item.sidebarActions.push({title:__("Edit Customer"),name:"customer-edit",callback:this.editCustomer}),this.permissionCheck("admin.data_privacy")&&this.item.sidebarActions.push({title:__("Delete Customer"),name:"customer-delete",callback:(e=this,function(){return e.navigate("#system/data_privacy/"+e.ticket.customer_id)})})),this.item},i.prototype.metaBadge=function(t){var e,n;return e="",n="",e=this.sidebarItemCounter(t),!0===this.Config.get("ui_sidebar_open_ticket_indicator_colored")&&(2===e?n="tabsSidebar-tab-count--warning":e>2&&(n="tabsSidebar-tab-count--danger")),{name:"customer",icon:"person",counterPossible:!0,counter:e,cssClass:n}},i.prototype.badgeRender=function(t){var e;if(this.badgeEl=t,App.User.exists(this.ticket.customer_id))return e=App.User.find(this.ticket.customer_id),this.badgeRenderLocal(e)},i.prototype.badgeRenderLocal=function(t){return this.badgeEl.html(App.view("generic/sidebar_tabs_item")(this.metaBadge(t)))},
i.prototype.sidebarItemCounter=function(t){var e;return e="",t&&t.preferences&&t.preferences.tickets_open&&(e=t.preferences.tickets_open),e},i.prototype.showCustomer=function(t){return this.elSidebar=t,new App.WidgetUser({el:this.elSidebar,user_id:this.ticket.customer_id,callback:this.badgeRenderLocal})},i.prototype.editCustomer=function(){return new App.ControllerGenericEdit({id:this.ticket.customer_id,genericObject:"User",screen:"edit",pageData:{title:__("Users"),object:__("User"),objects:__("Users")},container:this.elSidebar.closest(".content")})},i.prototype.changeCustomer=function(){return new App.TicketCustomer({ticket_id:this.ticket.id,container:this.elSidebar.closest(".content")})},i}(App.Controller),App.Config.set("200-Customer",t,"TicketZoomSidebar")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SidebarGitIssue=function(n){function i(){this.postParams=t(this.postParams,this),this.reload=t(this.reload,this),this.showError=t(this.showError,this),this.listIssues=t(this.listIssues,this),this.renderIssues=t(this.renderIssues,this),this.reloadIssues=t(this.reloadIssues,this),this.linkIssue=t(this.linkIssue,this),this.badgeRenderLocal=t(this.badgeRenderLocal,this),this.badgeRender=t(this.badgeRender,this),this.metaBadge=t(this.metaBadge,this),this.sidebarItem=t(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments),this.issueLinks=[],this.issueLinkData=[],this.providerIdentifier=this.provider.toLowerCase()}return e(i,n),i.prototype.provider="_need_to_be_defined_",i.prototype.urlPlaceholder="_need_to_be_defined_",i.prototype.sidebarItem=function(){var t,e;if(this.Config.get(this.providerIdentifier+"_integration")&&(e=this.ticket&&"agent"===this.ticket.currentView(),t=!this.ticket&&this.taskKey&&this.taskKey.match("TicketCreateScreen-"),e||t))return this.item={name:this.providerIdentifier,badgeCallback:this.badgeRender,sidebarHead:this.provider,sidebarCallback:this.reloadIssues,sidebarActions:[{title:__("Link issue"),name:"link-issue",callback:this.linkIssue}]},this.item},i.prototype.shown=function(){if(this.ticket)return this.listIssues()},i.prototype.metaBadge=function(){var t;return t="",t=this.issueLinks.length,{name:"customer",icon:this.providerIdentifier+"-logo",counterPossible:!0,counter:t}},i.prototype.badgeRender=function(t){return this.badgeEl=t,this.badgeRenderLocal()},i.prototype.badgeRenderLocal=function(){if(this.badgeEl)return this.badgeEl.html(App.view("generic/sidebar_tabs_item")(this.metaBadge()))},i.prototype.linkIssue=function(){return new App.GitIssueLinkModal({head:this.provider,placeholder:this.urlPlaceholder,taskKey:this.taskKey,container:this.el.closest(".content"),callback:(t=this,function(e,n){return t.getIssues({links:[e],success:function(i){return _.contains(t.issueLinks,e)||(t.issueLinks.push(i[0].url),t.issueLinkData=t.issueLinkData.concat(i)),t.ticket&&t.ticket.id?t.saveIssues({ticket_id:t.ticket.id,links:t.issueLinks,success:function(){return n.close(),t.renderIssues()},error:function(e){var i;return null==e&&(e=__("The issue could not be saved.")),n.showAlert(App.i18n.translatePlain(e)),i=n.el.find(".js-result"),t.formEnable(i)}}):(n.close(),t.renderIssues())},error:function(e){var i;return null==e&&(e=__("Loading failed.")),n.showAlert(App.i18n.translatePlain(e)),i=n.el.find(".js-result"),t.formEnable(i)}})})});var t},i.prototype.reloadIssues=function(t){var e,n,i,s;return t&&(this.el=t),this.ticket?(s=(null!=(e=this.ticket)&&null!=(n=e.preferences)&&null!=(i=n[this.providerIdentifier])?i.issue_links:void 0)||[],_.isEqual(this.issueLinks,s)?this.renderIssues():(this.issueLinks=s,this.listIssues(!0))):this.renderIssues()},i.prototype.renderIssues=function(){var t,e;if(!_.isEmpty(this.issueLinkData))return(t=$(App.view("ticket_zoom/sidebar_git_issue")({issues:this.issueLinkData}))).on("click",".js-delete",(e=this,function(t){var n;return t.preventDefault(),n=$(t.currentTarget).attr("data-issue-id"),e.deleteIssue(n)})),this.html(t),this.badgeRenderLocal();this.showEmpty()},i.prototype.listIssues=function(t){return null==t&&(t=!1),!t&&this.fetchFullActive&&this.fetchFullActive>(new Date).getTime()-5e3?this.renderIssues():(this.fetchFullActive=(new Date).getTime(),_.isEmpty(this.issueLinks)?this.renderIssues():this.getIssues({links:this.issueLinks,success:(e=this,function(t){return e.issueLinks=t.map((function(t){return t.url})),e.issueLinkData=t,e.renderIssues()}),error:function(t){return function(){return t.showError(App.i18n.translateInline("Loading failed."))}}(this)}));var e},i.prototype.getIssues=function(t){return this.ajax({id:this.providerIdentifier+"-"+this.taskKey,type:"POST",url:this.apiPath+"/integration/"+this.providerIdentifier,data:JSON.stringify({links:t.links}),success:function(e){return e.response?_.isEmpty(e.response)?t.error(__("Loading failed.")):t.success(e.response):t.error(e.message)},error:function(e,n){if("abort"!==n)return t.error()}})},i.prototype.saveIssues=function(t){return App.Ajax.request({id:this.providerIdentifier+"-update-"+t.ticket_id,type:"POST",url:this.apiPath+"/integration/"+this.providerIdentifier+"_ticket_update",data:JSON.stringify({ticket_id:t.ticket_id,issue_links:t.links}),success:function(e){return t.success(e)},error:function(e,n){if("abort"!==n)return t.error()}})},i.prototype.deleteIssue=function(t){return this.issueLinks=_.filter(this.issueLinks,(function(e){return e!==t})),this.issueLinkData=_.filter(this.issueLinkData,(function(e){return e.url!==t})),this.ticket&&this.ticket.id?this.saveIssues({ticket_id:this.ticket.id,links:this.issueLinks,success:(e=this,function(){return e.renderIssues()}),error:function(t){return function(e){return null==e&&(e=__("The issue could not be saved.")),t.showError(App.i18n.translateInline(e))}}(this)}):this.renderIssues();var e},i.prototype.showEmpty=function(){return this.html("<div>"+App.i18n.translateInline("No linked issues")+"</div>"),this.badgeRenderLocal()},i.prototype.showError=function(t){return this.html(App.i18n.translateInline(t))},i.prototype.reload=function(){return this.reloadIssues()},i.prototype.postParams=function(t){var e,n,i;if(t.ticket&&!t.ticket.created_at&&this.issueLinks&&!_.isEmpty(this.issueLinks))return(e=t.ticket).preferences||(e.preferences={}),(n=t.ticket.preferences)[i=this.providerIdentifier]||(n[i]={}),t.ticket.preferences[this.providerIdentifier].issue_links=this.issueLinks},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.provider="GitHub",n.prototype.urlPlaceholder="https://github.com/organization/repository/issues/42",n}(App.SidebarGitIssue),App.Config.set("500-GitHub",t,"TicketCreateSidebar"),App.Config.set("500-GitHub",t,"TicketZoomSidebar")}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.provider="GitLab",n.prototype.urlPlaceholder="https://git.example.com/group1/project1/-/issues/1",n}(App.SidebarGitIssue),App.Config.set("500-GitLab",t,"TicketCreateSidebar"),App.Config.set("500-GitLab",t,"TicketZoomSidebar")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){return this.updateTicket=e(this.updateTicket,this),this.postParams=e(this.postParams,this),this.delete=e(this.delete,this),this.reload=e(this.reload,this),this.showError=e(this.showError,this),this.showList=e(this.showList,this),this.showObjectsContent=e(this.showObjectsContent,this),this.showObjects=e(this.showObjects,this),this.changeObjects=e(this.changeObjects,this),this.sidebarItem=e(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.sidebarItem=function(){var t,e;if(this.Config.get("idoit_integration")&&(e=this.ticket&&"agent"===this.ticket.currentView(),t=!this.ticket&&this.taskKey&&this.taskKey.match("TicketCreateScreen-"),e||t))return this.item={name:"idoit",badgeIcon:"printer",sidebarHead:__("i-doit"),sidebarCallback:this.showObjects,sidebarActions:[{title:__("Change Objects"),name:"objects-change",callback:this.changeObjects}]},this.item},i.prototype.changeObjects=function(){return new App.IdoitObjectSelector({taskKey:this.taskKey,container:this.el.closest(".content"),callback:(t=this,function(e,n){return t.ticket&&t.ticket.id?(t.objectIds=t.objectIds.concat(e),void t.updateTicket(t.ticket.id,t.objectIds,(function(){return n.close(),t.showObjectsContent(e)}))):(n.close(),t.showObjectsContent(e))})});var t},i.prototype.showObjects=function(t){var e;return this.el=t,this.objectIds||(this.objectIds=[]),this.ticket&&this.ticket.preferences&&this.ticket.preferences.idoit&&this.ticket.preferences.idoit.object_ids&&(this.objectIds=this.ticket.preferences.idoit.object_ids),(e=this.queryParam())&&e.idoit_object_ids&&this.objectIds.push(e.idoit_object_ids),this.showObjectsContent()},i.prototype.showObjectsContent=function(t){var e;if(t&&(this.objectIds=this.objectIds.concat(t)),!_.isEmpty(this.objectIds))return this.ajax({id:"idoit-"+this.taskKey,type:"POST",url:this.apiPath+"/integration/idoit",data:JSON.stringify({method:"cmdb.objects",filter:{ids:this.objectIds}}),success:(e=this,function(t){if(!t.response)return e.showError(__("Loading failed."));e.showList(t.response.result)}),error:function(t){return function(e,n){if("abort"!==n)return t.showError(__("Loading failed."))}}(this)});this.html("<div>"+App.i18n.translateInline("none")+"</div>")},i.prototype.showList=function(t){var e,n;return(e=$(App.view("ticket_zoom/sidebar_idoit")({objects:t}))).on("click",".js-delete",(n=this,function(t){var e;return t.preventDefault(),e=$(t.currentTarget).attr("data-object-id"),n.delete(e)})),this.html(e)},i.prototype.showError=function(t){return this.html(App.i18n.translateInline(t))},i.prototype.reload=function(){return this.showObjectsContent()},i.prototype.delete=function(t){var e,n,i,s,r;for(s=[],e=0,n=(r=this.objectIds).length;e<n;e++)i=r[e],t.toString()!==i.toString()&&s.push(i);return this.objectIds=s,this.ticket&&this.ticket.id&&this.updateTicket(this.ticket.id,this.objectIds),this.showObjectsContent()},i.prototype.postParams=function(t){var e,n;if(t.ticket&&!t.ticket.created_at&&this.objectIds&&!_.isEmpty(this.objectIds))return(e=t.ticket).preferences||(e.preferences={}),(n=t.ticket.preferences).idoit||(n.idoit={}),t.ticket.preferences.idoit.object_ids=this.objectIds},i.prototype.updateTicket=function(t,e,n){return App.Ajax.request({id:"idoit-update-"+t,type:"POST",url:this.apiPath+"/integration/idoit_ticket_update",data:JSON.stringify({ticket_id:t,object_ids:e}),success:function(){if(n)return n(e)},error:(i=this,function(t,e,n){if("abort"!==e)return i.log("errors",n),i.notify({type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("The object could not be updated.")),timeout:6e3})})});var i},i}(App.Controller),App.Config.set("500-Idoit",t,"TicketCreateSidebar"),App.Config.set("500-Idoit",t,"TicketZoomSidebar")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){return this.editOrganization=e(this.editOrganization,this),this.showOrganization=e(this.showOrganization,this),this.sidebarItem=e(this.sidebarItem,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.sidebarItem=function(){var t,e;if(this.ticket.organization_id)return t=[],this.ticket.organization_id&&App.Organization.exists(this.ticket.organization_id)&&(null!=(e=App.Organization.find(this.ticket.organization_id))?e.isAccessibleBy(App.User.current(),"change"):void 0)&&(t=[{title:__("Edit Organization"),name:"organization-edit",callback:this.editOrganization}]),this.item={name:"organization",badgeIcon:"group",sidebarHead:__("Organization"),sidebarCallback:this.showOrganization,sidebarActions:t},this.item},i.prototype.showOrganization=function(t){return this.elSidebar=t,new App.WidgetOrganization({el:this.elSidebar,organization_id:this.ticket.organization_id})},i.prototype.editOrganization=function(){return new App.ControllerGenericEdit({id:this.ticket.organization_id,genericObject:"Organization",pageData:{title:__("Organizations"),object:__("Organization"),objects:__("Organizations")},container:this.elSidebar.closest(".content")})},i}(App.Controller),App.Config.set("300-Organization",t,"TicketZoomSidebar")}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;t=function(t){function e(t){var i;this.isDisabledByFollowupRules=n(this.isDisabledByFollowupRules,this),this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments),this.controllerBind("ui::ticket::load",(i=this,function(t){if(t.ticket_id.toString()===i.ticket.id.toString())return i.ticket=App.Ticket.find(i.ticket.id),t.form_meta&&(i.formMeta=t.form_meta),i.render(t.draft)})),this.render()}return i(e,t),e.prototype.render=function(t){var e,n,i,s;if(null==t&&(t={}),delete(e=this.ticket.attributes()).article,i=this.taskGet("ticket"),n=this.Config.get("TicketZoomFormHandler"),_.isEmpty(i)||(e=_.extend(e,i),this.formMeta.core_workflow=void 0),this.el.removeAttr("data-ticket-updated-at"),this.controllerFormSidebarTicket=new App.ControllerForm({elReplace:this.el,model:{className:"Ticket",configure_attributes:this.formMeta.configure_attributes||App.Ticket.configure_attributes},screen:"edit",handlersConfig:n,filter:this.formMeta.filter,formMeta:this.formMeta,params:_.extend(e,t),isDisabled:this.isDisabledByFollowupRules(e),taskKey:this.taskKey,core_workflow:{callbacks:[this.markForm]},articleParamsCallback:this.parent.articleParams}),this.el.attr("data-ticket-updated-at",e.updated_at),this.markForm(!0),!this.resetBind)return this.resetBind=!0,this.controllerBind("ui::ticket::articleNew::change",(s=this,function(t){if(t.ticket_id.toString()===s.ticket.id.toString())return s.controllerFormSidebarTicket.lastChangedAttribute="article",s.controllerFormSidebarTicket.runCoreWorkflow("article")})),this.controllerBind("ui::ticket::taskReset",function(t){return function(e){if(e.ticket_id.toString()===t.ticket.id.toString())return t.render()}}(this))},e.prototype.isDisabledByFollowupRules=function(t){var e,n,i;if(this.ticket.userGroupAccess("change"))return!1;if(e=App.Group.find(t.group_id),i=App.TicketState.find(t.state_id).name,n=!this.ticket.editable(),"closed"!==i)return n;switch(e.follow_up_possible){case"yes":return n;case"new_ticket":return!0;case"new_ticket_after_certain_time":return(new Date-Date.parse(this.ticket.last_close_at))/864e5>=e.reopen_time_in_days}},e}(App.Controller),e=function(e){function s(){var t;this.changeCustomer=n(this.changeCustomer,this),this.showTicketMerge=n(this.showTicketMerge,this),this.showTicketHistory=n(this.showTicketHistory,this),this.editTicket=n(this.editTicket,this),this.reload=n(this.reload,this),this.sidebarItem=n(this.sidebarItem,this),s.__super__.constructor.apply(this,arguments),this.controllerBind("config_update_local",(t=this,function(e){return t.configUpdated(e)}))}return i(s,e),s.prototype.configUpdated=function(t){if("kb_active"===t.name&&!t.value)return this.editTicket(this.el)},s.prototype.sidebarItem=function(){return this.item={name:"ticket",badgeIcon:"message",sidebarHead:__("Ticket"),sidebarCallback:this.editTicket},"agent"===this.ticket.currentView()&&(this.item.sidebarActions=[],this.item.sidebarActions.push({title:__("History"),name:"ticket-history",callback:this.showTicketHistory}),this.ticket.editable()&&(this.item.sidebarActions.push({title:__("Merge"),name:"ticket-merge",callback:this.showTicketMerge}),this.item.sidebarActions.push({title:__("Change Customer"),name:"customer-change",callback:this.changeCustomer}))),this.item},s.prototype.reload=function(t){if(this.tagWidget&&(t.tags&&this.tagWidget.reload(t.tags),t.mentions&&this.mentionWidget.reload(t.mentions),t.tagAdd&&this.tagWidget.add(t.tagAdd,t.source),t.tagRemove&&this.tagWidget.remove(t.tagRemove)),this.linkWidget&&t.links&&this.linkWidget.reload(t.links),this.linkKbAnswerWidget&&t.links&&this.linkKbAnswerWidget.reload(t.links),this.timeUnitWidget&&t.time_accountings)return this.timeUnitWidget.reload(t.time_accountings)},s.prototype.editTicket=function(e){var n;return this.el=e,n=$(App.view("ticket_zoom/sidebar_ticket")()),this.edit=new t({object_id:this.ticket.id,ticket:this.ticket,el:n.find(".edit"),taskGet:this.taskGet,formMeta:this.formMeta,markForm:this.markForm,taskKey:this.taskKey,parent:this.parent}),"agent"===this.ticket.currentView()&&(this.mentionWidget=new App.WidgetMention({el:n.filter(".js-subscriptions"),object:this.ticket,mentions:this.mentions}),this.tagWidget=new App.WidgetTag({el:n.filter(".js-tags"),object_type:"Ticket",object:this.ticket,tags:this.tags,editable:this.ticket.editable()}),this.linkWidget=new App.WidgetLink.Ticket({el:n.filter(".js-links"),object_type:"Ticket",object:this.ticket,links:this.links,editable:this.ticket.editable()}),this.permissionCheck("knowledge_base.*")&&App.Config.get("kb_active")&&(this.linkKbAnswerWidget=new App.WidgetLinkKbAnswer({el:n.filter(".js-linkKbAnswers"),object_type:"Ticket",object:this.ticket,links:this.links,editable:this.ticket.editable()})),this.timeUnitWidget=new App.TicketZoomTimeUnit({el:n.filter(".js-timeUnit"),object_id:this.ticket.id,time_accountings:this.time_accountings})),this.html(n)},s.prototype.showTicketHistory=function(){return new App.TicketHistory({ticket_id:this.ticket.id,container:this.el.closest(".content")})},s.prototype.showTicketMerge=function(){return new App.TicketMerge({ticket:this.ticket,taskKey:this.taskKey,container:this.el.closest(".content")})},s.prototype.changeCustomer=function(){return new App.TicketCustomer({ticket_id:this.ticket.id,container:this.el.closest(".content")})},s}(App.Controller),App.Config.set("100-TicketEdit",e,"TicketZoomSidebar")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TaskbarWatcher=function(n){function i(){this.stop=t(this.stop,this),this.start=t(this.start,this),this.renderWatcher=t(this.renderWatcher,this),this.renderOtherWatcher=t(this.renderOtherWatcher,this),this.renderSelfWatcher=t(this.renderSelfWatcher,this),this.render=t(this.render,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.TaskManager.preferencesSubscribe(this.taskKey,this.render),App.TaskManager.preferencesTrigger(this.taskKey)}return e(i,n),i.prototype.release=function(){if(this.subscribeId)return App.TaskManager.preferencesUnsubscribe(this.subscribeId)},i.prototype.render=function(t){var e,n,i,s,r,o,a,l,c;if(t&&t.tasks&&(e=App.Session.get("id"),this.markIdlePreferences(t,e),!_.isEqual(this.lastTasks,t.tasks))){for(this.lastTasks=clone(t.tasks),this.el.empty(),l=_.find(t.tasks,(function(t){return t.user_id===e})),n=_.filter(t.tasks,(function(t){return t.user_id!==e})),l&&(null!=(o=l.apps.mobile)?o.changed:void 0)&&this.renderSelfWatcher(l,n.length),a=[],i=s=0,r=n.length;s<r;i=++s)c=n[i],a.push(this.renderOtherWatcher(c,i!==n.length-1));return a}},i.prototype.markIdlePreferences=function(t,e){var n,i,s,r,o,a,l,c,u,p;for(i=0,a=(c=t.tasks).length;i<a;i++)if((p=c[i]).user_id!==e)for(s=0,l=(u=_.keys(p.apps)).length;s<l;s++)r=u[s],p.apps[r].last_contact&&(o=new Date(p.apps[r].last_contact),n=(new Date).getTime()-o.getTime(),p.apps[r].idle=n>3e5);return t},i.prototype.renderSelfWatcher=function(t,e){return this.renderWatcher(t,e,"mobile-edit","mobile")},i.prototype.renderOtherWatcher=function(t,e){var n,i,s,r,o;return s=(i=_.keys(t.apps)).length>1?new Date(t.apps.desktop.last_contact)>new Date(t.apps.mobile.last_contact)?"desktop":"mobile":i[0],(null!=(r=t.apps.desktop)?r.changed:void 0)||(null!=(o=t.apps.mobile)?o.changed:void 0)?n="pen":"mobile"===s&&(n="mobile"),this.renderWatcher(t,e,n,s)},i.prototype.renderWatcher=function(t,e,n,i){var s,r,o;if(r=[],t.apps[i].idle&&r.push("avatar--idle"),t.apps[i].changed?r.push("avatar--changed"):r.push("avatar--not-changed"),this.el.append('<div class="js-avatar"></div>'),e&&this.el.append('<div class="half-spacer"></div>'),s=new App.WidgetAvatar({el:this.el.find(".js-avatar").last(),object_id:t.user_id,size:40,cssClass:r.join(" ")}),n)return(o=$('<div class="avatar-status"></div>')).append(App.Utils.icon(n)),s.el.find(".avatar").append(o)},i.prototype.start=function(){return this.intervalId=this.interval((t=this,function(){return App.TaskManager.preferencesTrigger(t.taskKey)}),3e5,"ticket-watcher-interval");var t},i.prototype.stop=function(){if(this.intervalId)return this.clearInterval(this.intervalId)},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomTimeAccounting=function(n){function i(){var e;this.onSubmit=t(this.onSubmit,this),this.onCancel=t(this.onCancel,this),this.skip=t(this.skip,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("config_update",(e=this,function(t){if(/^time_accounting_unit/.test(t.name)&&/^time_accounting_type/.test(t.name))return e.render()})),this.subscribeId=App.TicketTimeAccountingType.subscribe(this.render,{initFetch:!0})}return e(i,n),i.include(App.TimeAccountingUnitMixin),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!1,i.prototype.buttonSubmit=__("Account Time"),i.prototype.buttonClass="btn--success",i.prototype.leftButtons=[{className:"js-skip",text:__("Skip")}],i.prototype.head=__("Time Accounting"),i.prototype.small=!0,i.prototype.events={"submit form":"submit","click .js-submit:not(.is-disabled)":"submit","click .js-cancel":"cancel","click .js-close":"cancel","click .js-skip":"skip"},i.prototype.release=function(){return App.TicketTimeAccountingType.unsubscribe(this.subscribeId)},i.prototype.content=function(){var t,e,n;return t=[{name:"time_unit",display:__("Accounted Time"),tag:"input",type:"text",null:!1,placeholder:__("Enter the time you want to record"),appendText:this.timeAccountingDisplayUnit()}],this.Config.get("time_accounting_types")&&(this.Config.get("time_accounting_type_default")&&(n=(e=App.TicketTimeAccountingType.find(this.Config.get("time_accounting_type_default"))).active&&e.id),t.push({name:"accounted_time_type_id",display:__("Activity Type"),tag:"select",relation:"TicketTimeAccountingType",null:!0,nulloption:!0,value:n})),this.form=new App.ControllerForm({model:{configure_attributes:t},autofocus:!0}),this.form.el},i.prototype.skip=function(t){if(this.submitCallback)return this.submitCallback({}),this.close(t)},i.prototype.onCancel=function(){if(this.cancelCallback)return this.cancelCallback()},i.prototype.onClose=function(){if(this.cancelCallback)return this.cancelCallback()},i.prototype.onSubmit=function(){var t,e;return e=this.formParams(),t=this.form.validate(e),_.isEmpty(t)?(e.time_unit=e.time_unit.replace(",","."),isNaN(parseFloat(e.time_unit))||/[A-z]|\s/.test(e.time_unit)?(t={time_unit:__("is not a number")},this.formValidate({form:this.form.el,errors:t}),!1):(this.close(),this.submitCallback?this.submitCallback(e):void 0)):(this.formValidate({form:this.form.el,errors:t}),!1)},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomTimeUnit=function(n){function i(){var e;this.render=t(this.render,this),this.reload=t(this.reload,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("config_update",(e=this,function(t){if(/^time_accounting_unit/.test(t.name))return e.rerenderCallback()})),this.showAllEntries=!1}return e(i,n),i.include(App.TimeAccountingUnitMixin),i.prototype.events={"click .js-showMoreEntries":"showMoreEntries"},i.prototype.reload=function(t){return this.time_accountings=t,this.render()},i.prototype.render=function(){var t,e,n;if("agent"===(n=App.Ticket.find(this.object_id)).currentView()&&n.time_unit)return e=(t=this.fetchEntries()).slice(0,3),this.showAllEntries&&(e=t),1===e.length&&e[0][0]===__("none")&&(e=[]),this.html(App.view("ticket_zoom/time_unit")({ticket:n,displayUnit:this.timeAccountingDisplayUnit(),list:e,showMore:t.length>3&&!this.showAllEntries}))},i.prototype.fetchEntries=function(){var t,e,n,i;return App.Config.get("time_accounting_types")&&(t=this.time_accountings)&&0!==t.length?(i=_.indexBy(App.TicketTimeAccountingType.all(),"id"),e=_.groupBy(t,(function(t){return t.type_id})),1===(n=_.map(e,(function(t,e){var n,s;return n=function(t,e){return t+parseFloat(e.time_unit)},[(null!=(s=i[e])?s.name:void 0)||__("None"),_.reduce(t,n,0)]}))).length&&"None"===n[0][0]?[]:_.sortBy(n,(function(t){return t[1]})).reverse()):[]},i.prototype.showMoreEntries=function(t){return this.preventDefaultAndStopPropagation(t),this.showAllEntries=!0,this.render()},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketZoomTitle=function(n){function i(){return this.update=t(this.update,this),this.renderPost=t(this.renderPost,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="Ticket",i.prototype.template="ticket_zoom/title",i.prototype.observe={title:!0},i.prototype.globalRerender=!1,i.prototype.events={"blur .js-objectTitle":"update"},i.prototype.renderPost=function(){return this.$(".js-objectTitle").ce({mode:"textonly",multiline:!1,maxlength:250})},i.prototype.update=function(t){var e,n;if((n=$(t.target).ceg()||"")!==this.lastAttributes.title)return(e=App.Ticket.find(this.object_id)).title=n,e.article=void 0,e.save(),App.TaskManager.mute(this.taskKey),App.TaskManager.touch(this.taskKey),App.Event.trigger("overview:fetch")},i}(App.ControllerObserver)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.release=e(this.release,this),this.renderHeader=e(this.renderHeader,this),this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments),this.tabs=[{name:__("Settings"),target:"settings",controller:App.TimeAccountingSettings},{name:__("Activity Types"),target:"types",controller:App.TimeAccountingTypes},{name:__("Accounted Time"),target:"accounted_time",controller:App.TimeAccountingAccountedTime}],this.subscribeId=App.Setting.subscribe(this.render,{initFetch:!0,clear:!1})}return n(i,t),i.requiredPermission="admin.time_accounting",i.prototype.header=__("Time Accounting"),i.prototype.headerSwitchName="time-accounting",i.prototype.events={"change .js-header-switch input":"didChangeHeaderSwitch","show.bs.tab li":"willShowTab"},i.prototype.elements={".js-header-switch input":"timeAccountingSetting"},i.prototype.render=function(){return i.__super__.render.apply(this,arguments),this.renderHeader()},i.prototype.renderHeader=function(){return this.timeAccountingSetting.prop("checked",App.Setting.get("time_accounting"))},i.prototype.didChangeHeaderSwitch=function(){var t;return t=this.timeAccountingSetting.prop("checked"),App.Setting.set("time_accounting",t)},i.prototype.release=function(){return App.Setting.unsubscribe(this.subscribeId)},i.prototype.willShowTab=function(t){var e;return e=$(t.target).attr("href"),this.$(e).trigger("show.bs.tab")},i}(App.ControllerTabs),App.Config.set("TimeAccounting",{prio:8500,name:__("Time Accounting"),parent:"#manage",target:"#manage/time_accounting",controller:t,permission:["admin.time_accounting"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.TimeAccountingAccountedTime=function(i){function s(){var t;this.setMonth=e(this.setMonth,this),this.setYear=e(this.setYear,this),this.willShow=e(this.willShow,this),this.render=e(this.render,this),s.__super__.constructor.apply(this,arguments),t=new Date,this.month||(this.month=t.getMonth()+1),this.year||(this.year=t.getFullYear())}return n(s,i),s.include(App.TimeAccountingUnitMixin),s.prototype.events={"click .js-timePickerYear":"setYear","click .js-timePickerMonth":"setMonth","show.bs.tab":"willShow"},s.prototype.tables={by_activity:".js-tableActivity",by_ticket:".js-tableTicket",by_customer:".js-tableCustomer",by_organization:".js-tableOrganization"},s.prototype.render=function(){var e,n,i,s,r,o,a,l,c;for(n in c=(new Date).getFullYear(),l=function(){r=[];for(var t=i=c-2;i<=c?t<=c:t>=c;i<=c?t++:t--)r.push(t);return r}.apply(this),a=[__("Jan"),__("Feb"),__("Mar"),__("Apr"),__("May"),__("Jun"),__("Jul"),__("Aug"),__("Sep"),__("Oct"),__("Nov"),__("Dec")],this.html(App.view("time_accounting/accounted_time")({month:this.month,year:this.year,timeRangeYear:l,timeRangeMonth:a,timeAccountingUnit:App.Setting.get("time_accounting_unit"),timeAccountingCustomUnit:App.Setting.get("time_accounting_unit_custom")})),o=[],s=this.tables)e=s[n],o.push(new t({identifier:n,el:this.$(e),year:this.year,month:this.month}));return o},s.prototype.willShow=function(){return this.render()},s.prototype.setYear=function(t){return t.preventDefault(),this.year=$(t.target).data("type"),this.render()},s.prototype.setMonth=function(t){return t.preventDefault(),this.month=$(t.target).data("type"),this.render()},s}(App.Controller),t=function(t){function i(){this.render=e(this.render,this),this.load=e(this.load,this),i.__super__.constructor.apply(this,arguments),this.load()}return n(i,t),i.prototype.load=function(){return this.ajax({id:this.identifier,type:"GET",url:this.apiPath+"/time_accounting/log/"+this.identifier+"/"+this.year+"/"+this.month+"?limit=21",processData:!0,success:(t=this,function(e){return t.render(e)})});var t},i.prototype.render=function(t){return this.html(App.view("time_accounting/"+this.identifier)({rows:t}))},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TimeAccountingSettings=function(n){function i(){this.saveSettings=t(this.saveSettings,this),this.changeTimeAccountingUnit=t(this.changeTimeAccountingUnit,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.include(App.TimeAccountingUnitMixin),i.prototype.events={"click .js-timeAccountingSettings":"saveSettings","click .js-timeAccountingSettingsReset":"resetSettings","change #timeAccountingUnit":"changeTimeAccountingUnit"},i.prototype.elements={"#timeAccountingUnit":"timeAccountingUnit","#timeAccountingCustomUnit":"timeAccountingCustomUnit"},i.prototype.render=function(){var t,e;return this.html(App.view("time_accounting/settings")({
timeAccountingUnit:App.Setting.get("time_accounting_unit"),timeAccountingCustomUnit:App.Setting.get("time_accounting_unit_custom"),timeUnits:this.timeAccountingUnitOptions()})),t=[{name:"condition",display:__("Conditions for affected objects"),tag:"time_accounting_condition",workflow_object:"Ticket",disable_operators:["has changed","changed to"],null:!1,preview:!1}],e=App.Setting.get("time_accounting_selector"),this.filter=new App.ControllerForm({el:this.$(".js-selector"),model:{configure_attributes:t},params:e,autofocus:!0})},i.prototype.changeTimeAccountingUnit=function(t){if(this.$("#timeAccountingCustomUnit").toggle("custom"===$(t.target).val()),"custom"===$(t.target).val())return this.$("#timeAccountingCustomUnit").focus()},i.prototype.saveSettings=function(t){var e,n,i;return t.preventDefault(),n=this.formParam(this.filter.form),i=this.timeAccountingUnit.val(),e=this.timeAccountingCustomUnit.val(),"custom"===i&&_.isEmpty(e)?i="":"custom"===i||_.isEmpty(e)||(e=""),App.Setting.set("time_accounting_selector",n),App.Setting.set("time_accounting_unit",i),App.Setting.set("time_accounting_unit_custom",e,{notify:!0})},i.prototype.resetSettings=function(t){return t.preventDefault(),App.Setting.set("time_accounting_selector",{}),App.Setting.set("time_accounting_unit",""),App.Setting.set("time_accounting_unit_custom","",{notify:!0})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TimeAccountingTypes=function(n){function i(){this.willShow=t(this.willShow,this),this.saveTypes=t(this.saveTypes,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.events={"click .js-timeAccountingTypes":"saveTypes","click .js-timeAccountingTypesReset":"resetTypes","show.bs.tab":"willShow"},i.prototype.elements={"#timeAccountingTypes":"timeAccountingTypes"},i.prototype.render=function(){var t,e;return t=$(App.view("time_accounting/types")()),e=App.UiElement.select.render({id:"timeAccountingTypes",multiple:!1,null:!1,options:{true:__("yes"),false:__("no")},value:this.Config.get("time_accounting_types")||!1,translate:!0}),t.find(".js-types").replaceWith(e),this.html(t)},i.prototype.saveTypes=function(t){var e;return t.preventDefault(),e="true"===this.timeAccountingTypes.val(),App.Setting.set("time_accounting_types",e,{notify:!0})},i.prototype.resetTypes=function(t){return t.preventDefault(),App.Setting.set("time_accounting_types",!1,{notify:!0})},i.prototype.willShow=function(){return this.genericController=new App.ControllerGenericIndex({genericObject:"TicketTimeAccountingType",container:this.el.closest(".content"),pageData:{home:"time_accounting_types",object:__("Activity Type"),objects:__("Activity Types"),navupdate:"#time_accounting_types",buttons:[{name:__("New Activity Type"),"data-type":"new",class:"btn--success"}]}}),this.$(".js-table-container").html(this.genericController.el)},i}(App.Controller)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(){var t;this.getAttributes=i(this.getAttributes,this),this.updateOnServer=i(this.updateOnServer,this),this.resetChanges=i(this.resetChanges,this),this.toggleAction=i(this.toggleAction,this),this.hideAction=i(this.hideAction,this),this.showAction=i(this.showAction,this),this.rerender=i(this.rerender,this),this.release=i(this.release,this),this.hide=i(this.hide,this),this.show=i(this.show,this),this.load=i(this.load,this),this.render=i(this.render,this),r.__super__.constructor.apply(this,arguments),this.locale=App.i18n.get(),this.render(),this.controllerBind("i18n:translation_update_todo",(t=this,function(){return t.load("i18n:translation_update_todo")})),this.controllerBind("i18n:translation_update_list",function(t){return function(){return t.load("i18n:translation_update_list")}}(this)),this.controllerBind("i18n:translation_update",function(t){return function(){return t.load()}}(this))}return s(r,t),r.requiredPermission="admin.translation",r.prototype.header=__("Translations"),r.prototype.events={"click .js-resetChanges":"resetChanges"},r.prototype.initialRenderingDone=!1,r.prototype.render=function(){var t,e,n,i,s;for(s=App.Locale.all(),t=this.locale,e=0,n=s.length;e<n;e++)(i=s[e]).locale===this.locale&&(t=i.name);return this.html(App.view("translation/index")({currentLanguage:t,inlineTranslationKey:App.Browser.hotkeys().split("+").reverse().join("+")+"+t"})),this.load("render")},r.prototype.load=function(t){return this.ajax({id:"translations_admin",type:"GET",url:this.apiPath+"/translations/admin/lang/"+this.locale,processData:!0,success:(i=this,function(s){var r,o,a,l;for(i.initialRenderingDone=!0,i.times=[],i.stringsNotTranslated=[],i.stringsTranslated=[],r=0,a=(l=s.list).length;r<a;r++)"FORMAT_DATE"===(o=l[r])[1]||"FORMAT_DATETIME"===o[1]?i.times.push(o):""===o[2]?i.stringsNotTranslated.push(o):i.stringsTranslated.push(o);return i.translationToDo&&"render"!==t||(i.translationToDo=new n({el:i.$(".js-ToDo"),locale:i.locale,updateOnServer:i.updateOnServer,getAttributes:i.getAttributes})),t&&"i18n:translation_update_todo"!==t&&"render"!==t||i.translationToDo.update({stringsNotTranslated:i.stringsNotTranslated,stringsTranslated:i.stringsTranslated,times:i.times}),i.translationList&&"render"!==t||(i.translationList=new e({el:i.$(".js-List"),locale:i.locale,updateOnServer:i.updateOnServer,getAttributes:i.getAttributes})),t&&"i18n:translation_update_list"!==t&&"render"!==t||i.translationList.update({stringsNotTranslated:i.stringsNotTranslated,stringsTranslated:i.stringsTranslated,times:i.times}),i.toggleAction()})});var i},r.prototype.show=function(){if(!1!==this.initialRenderingDone)return this.render()},r.prototype.hide=function(){return this.rerender()},r.prototype.release=function(){return this.rerender()},r.prototype.rerender=function(){var t;if(t=function(){return App.Event.trigger("ui:rerender")},this.translationList&&this.translationList.changes())return App.Delay.set(t,400)},r.prototype.showAction=function(){return this.$(".js-changes").removeClass("hidden")},r.prototype.hideAction=function(){return this.el.closest(".content").find(".js-changes").addClass("hidden")},r.prototype.toggleAction=function(){return this.$(".js-Reset:visible").length>0?this.showAction():this.hideAction()},r.prototype.resetChanges=function(){return this.loader=new App.ControllerModalLoading({head:__("Reset changes"),message:__("Resetting changes\u2026"),container:this.el.closest(".content")}),this.ajax({id:"translations",type:"POST",url:this.apiPath+"/translations/reset",data:JSON.stringify({locale:this.locale}),processData:!1,success:(t=this,function(){return App.Event.trigger("i18n:translation_update"),t.hideAction(),t.loader.hide()}),error:function(t){return function(){return t.loader.hide()}}(this)});var t},r.prototype.updateOnServer=function(t,e){var n,i,s;return App.i18n.get()===t.locale&&App.i18n.setMap(t.source,t.target),delete t.field,t.id?""===t.target?(n="DELETE",i=this.apiPath+"/translations/"+t.id):(n="PUT",i=this.apiPath+"/translations/"+t.id):(n="POST",i=this.apiPath+"/translations"),this.ajax({id:"translations",type:n,url:i,data:JSON.stringify(t),processData:!1,success:(s=this,function(){return e&&App.Event.trigger(e),s.toggleAction()})})},r.prototype.getAttributes=function(t){var e;return{id:(e=$(t.target).closest("tr").find(".js-Item")).data("id"),source:e.data("source"),initial:e.data("initial")||"",target:e.val(),locale:this.locale,field:e}},r}(App.ControllerSubContent),n=function(t){function e(){this.same=i(this.same,this),this.create=i(this.create,this),this.render=i(this.render,this),this.update=i(this.update,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.events={"click .js-create":"create","click .js-theSame":"same"},e.prototype.update=function(t){var e,n;for(e in t)n=t[e],this[e]=n;return this.render()},e.prototype.render=function(){if(!_.isEmpty(this.stringsNotTranslated))return this.html(App.view("translation/todo")({list:this.stringsNotTranslated}));this.html("")},e.prototype.create=function(t){var e;if(t.preventDefault(),(e=this.getAttributes(t)).target)return $(t.target).closest("tr").remove(),e.target_initial="",this.updateOnServer(e,"i18n:translation_update_list")},e.prototype.same=function(t){var e;return t.preventDefault(),this.hasChanges=!0,e=this.getAttributes(t),$(t.target).closest("tr").remove(),e.target_initial="",e.target=e.source,this.updateOnServer(e,"i18n:translation_update_list")},e}(App.Controller),e=function(t){function e(){this.updateRow=i(this.updateRow,this),this.changes=i(this.changes,this),this.render=i(this.render,this),this.update=i(this.update,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.hasChanges=!1,e.prototype.events={"blur .js-translated input":"updateItem","click .js-translated .js-Reset":"resetItem"},e.prototype.update=function(t){var e,n;for(e in t)n=t[e],this[e]=n;return this.render()},e.prototype.render=function(){if(!_.isEmpty(this.stringsTranslated)||!_.isEmpty(this.times))return this.html(App.view("translation/list")({times:this.times,strings:this.stringsTranslated}))},e.prototype.changes=function(){return this.hasChanges},e.prototype.resetItem=function(t){var e;return t.preventDefault(),this.hasChanges=!0,(e=this.getAttributes(t)).target=e.initial,this.updateOnServer(e,"i18n:translation_update")},e.prototype.updateItem=function(t){var e;if(t.preventDefault(),this.hasChanges=!0,(e=this.getAttributes(t)).target)return this.updateRow(e.id),this.updateOnServer(e)},e.prototype.updateRow=function(t){var e,n,i,s;return e=(n=this.$("[data-id="+t+"]")).val(),i=n.data("initial"),s=n.closest("tr").find(".js-Reset"),e!==i?(this.changesAvailable=!0,s.removeClass("hidden"),s.closest("tr").addClass("warning")):(s.addClass("hidden"),s.closest("tr").removeClass("warning"))},e}(App.Controller),App.Config.set("Translation",{prio:1800,parent:"#system",name:__("Translations"),target:"#system/translation",controller:t,permission:["admin.translation"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i,s,r=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;s=function(t){function e(){this.show=r(this.show,this),e.__super__.constructor.apply(this,arguments),this.genericController=new n({el:this.el,id:this.id,genericObject:"Trigger",defaultSortBy:"name",pageData:{home:"triggers",object:__("Trigger"),objects:__("Triggers"),pagerAjax:!0,pagerBaseUrl:"#manage/trigger/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#triggers",notes:[__("Triggers are \u2026")],buttons:[{name:__("New Trigger"),"data-type":"new",class:"btn--success"}]},container:this.el.closest(".content"),veryLarge:!0})}return o(e,t),e.requiredPermission="admin.trigger",e.prototype.header=__("Triggers"),e.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},e}(App.ControllerSubContent),n=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return o(n,t),n.prototype.newControllerClass=function(){return i},n.prototype.editControllerClass=function(){return e},n}(App.ControllerGenericIndex),t={events:{'change select[name="activator"]':"activatorChanged"},contentFormModel:function(){var t,e;return e=this.contentFormParams(),t=App[this.genericObject].configure_attributes,_.findWhere(t,{name:"execution_condition_mode"}).hide="action"!==e.activator,_.findWhere(t,{name:"condition"}).hasReached="time"===e.activator,_.findWhere(t,{name:"condition"}).action="action"===e.activator,{configure_attributes:t}},contentFormParams:function(){return this.intermediaryParams||this.item||{activator:"action",execution_condition_mode:"selective"}},activatorChanged:function(t){return t.preventDefault(),this.intermediaryParams=App.ControllerForm.params(this.el),this.update()}},e=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return o(n,e),n.include(t),n}(App.ControllerGenericEdit),i=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return o(n,e),n.include(t),n}(App.ControllerGenericNew),App.Config.set("Trigger",{prio:3300,name:__("Trigger"),parent:"#manage",target:"#manage/trigger",controller:s,permission:["admin.trigger"]},"NavBarAdmin")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){this.newUserAddedCallback=e(this.newUserAddedCallback,this),this.search=e(this.search,this),this.hide=e(this.hide,this),this.show=e(this.show,this),i.__super__.constructor.apply(this,arguments),this.render()}return n(i,t),i.requiredPermission="admin.user",i.prototype.header=__("Users"),i.prototype.elements={".js-search":"searchInput"},i.prototype.events={"click [data-type=new]":"new","click [data-type=import]":"import"},i.prototype.show=function(){if(i.__super__.show.apply(this,arguments),this.table)return this.table.show()},i.prototype.hide=function(){if(i.__super__.hide.apply(this,arguments),this.table)return this.table.hide()},i.prototype.render=function(){var t,e;return t=App.Role.findAllByAttribute("active",!0),t=_.sortBy(t,(function(t){return t.name.toLowerCase()})),this.html(App.view("user")({head:__("Users"),buttons:[{name:__("Import"),"data-type":"import",class:"btn"},{name:__("New User"),"data-type":"new",class:"btn--success"}],roles:t})),this.$(".tab").on("click",(e=this,function(t){var n;return t.preventDefault(),$(t.target).toggleClass("active"),n=e.searchInput.val().trim(),e.query=n,e.delay(e.search,220,"search")})),this.searchInput.on("keyup",function(t){return function(){var e;if((e=t.searchInput.val().trim())!==t.query)return t.query=e,t.delay(t.search,220,"search")}}(this)),this.controllerBind("User:create User:update User:touch User:destroy",function(t){return function(){return t.delay(t.search,220,"search")}}(this)),this.search()},i.prototype.renderResult=function(t){var e,n,i,s,r,o,a,l;for(null==t&&(t=[]),this.stopLoading(),l=this,function(t,e){return e.preventDefault(),e.stopPropagation(),l.disconnectClient(),$("#app").hide().attr("style","display: none!important"),l.delay((function(){return App.Auth._logout(!1),l.ajax({id:"user_switch",type:"GET",url:l.apiPath+"/sessions/switch/"+t,success:function(t){var e;return e=window.location.protocol+"//"+window.location.host+t.location,l.windowReload(void 0,e)}})}),800)},n=function(e){return function(n,i){var s,r,o;return i.preventDefault(),r=App.User.find(n),o=function(){return App.Group.fetch(),e.renderResult(t)},s=function(t,e,n,i,s){if(!App.Config.get("ticket_organization_reassignment"))return s.find('[name="organization_id"]').closest(".form-group").find(".help-message").addClass("hide")},r.secondaryOrganizations(0,1e3,(function(){return new App.ControllerGenericEdit({id:r.id,pageData:{title:__("Users"),home:"users",object:__("User"),objects:__("Users"),navupdate:"#users"},genericObject:"User",callback:o,container:e.el.closest(".content"),handlers:[s],screen:"edit",veryLarge:!0})}))}}(this),e=function(t,e,n){return n.prefixIcon=null,n.title=null,e.maxLoginFailedReached()&&(n.title=App.i18n.translateContent("This user is currently blocked because of too many failed login attempts."),n.prefixIcon="lock"),t},a=[],i=0,s=t.length;i<s;i++)o=t[i],r=App.User.find(o),a.push(r);return this.$(".table-overview").html(""),this.table=new App.ControllerTable({tableId:"users_admin_overview",el:this.$(".table-overview"),model:App.User,objects:a,class:"user-list",customActions:[{name:"switchTo",display:__("View from user's perspective"),icon:"switchView ",class:"create js-switchTo",callback:function(t){return function(e){return t.disconnectClient(),$("#app").hide().attr("style","display: none!important"),t.delay((function(){return App.Auth._logout(!1),t.ajax({id:"user_switch",type:"GET",url:t.apiPath+"/sessions/switch/"+e,success:function(e){var n;return n=window.location.protocol+"//"+window.location.host+e.location,t.windowReload(void 0,n)}})}),800)}}(this)},{name:"manageTwoFactor",display:__("Manage Two-Factor Authentication"),icon:"two-factor",class:"create js-manageTwoFactor",available:function(t){return!!(t.preferences&&t.preferences.two_factor_authentication&&t.preferences.two_factor_authentication.default)},callback:function(t){if(r=App.User.find(t))return new App.ControllerManageTwoFactor({user:r})}},{name:"delete",display:__("Delete"),icon:"trash",class:"delete",callback:function(t){return function(e){return t.navigate("#system/data_privacy/"+e)}}(this)},{name:"unlock",display:__("Unlock"),icon:"lock-open",class:"unlock",available:function(t){return t.maxLoginFailedReached()},callback:function(e){return function(n){return e.ajax({id:"user_unlock_"+n,type:"PUT",url:e.apiPath+"/users/unlock/"+n,success:function(){return App.User.full(n,(function(){return e.notify({type:"success",msg:App.i18n.translateContent("User successfully unlocked!")},e.renderResult(t))}),!0)}})}}(this)}],callbackAttributes:{login:[e]},bindRow:{events:{click:n}}})},i.prototype.search=function(){var t,e;return t=[],this.$(".tab.active").each((function(e,n){return t.push($(n).data("id"))})),this.startLoading(this.$(".table-overview")),App.Ajax.request({id:"search",type:"GET",url:this.apiPath+"/users/search?sort_by=created_at",data:{query:this.query||"*",limit:50,role_ids:t,full:!0},processData:!0,success:(e=this,function(t){return App.Collection.loadAssets(t.assets),e.renderResult(t.user_ids),e.stopLoading()}),done:function(t){return function(){return t.stopLoading()}}(this)})},i.prototype.new=function(t){return t.preventDefault(),new App.ControllerGenericNew({pageData:{title:__("Users"),home:"users",object:__("User"),objects:__("Users"),navupdate:"#users"},genericObject:"User",screen:"create",container:this.el.closest(".content"),callback:this.newUserAddedCallback,veryLarge:!0})},i.prototype.newUserAddedCallback=function(){return this.searchInput.val(""),this.query="",this.resetActiveTabs(),this.search()},i.prototype.resetActiveTabs=function(){return this.$(".tab.active").removeClass("active")},i.prototype.import=function(t){return t.preventDefault(),new App.Import({baseUrl:"/api/v1/users",container:this.el.closest(".content")})},i}(App.ControllerSubContent),App.Config.set("User",{prio:1e3,name:__("Users"),parent:"#manage",target:"#manage/users",controller:t,permission:["admin.user"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ControllerManageTwoFactor=function(n){function i(){this.load=t(this.load,this),i.__super__.constructor.apply(this,arguments),this.load()}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonSubmit=!1,i.prototype.head=__("Manage Two-Factor Authentication"),i.prototype.events={"click .js-remove":"remove","click .js-remove-all":"removeAll"},i.prototype.load=function(){return this.startLoading(),this.ajax({type:"GET",url:this.apiPath+"/users/"+this.user.id+"/two_factor_enabled_authentication_methods",success:(t=this,function(e){return t.stopLoading(),t.loaded=!0,t.user_methods=_.map(e,(function(t){return{name:App.TwoFactorMethods.methodByKey(t.method).label,value:t.method}})),t.update()}),error:function(t){return function(e){var n,i;return t.stopLoading(),i=(null!=(n=JSON.parse(e.responseText))?n.error:void 0)||__("Could not load the two-factor authentication configuration for this user."),t.showAlert(i)}}(this)});var t},i.prototype.content=function(){var t;if(this.loaded)return t=$(App.view("user/manage_two_factor")()),this.controller=new App.ControllerForm({el:t.find(".js-attributes"),model:{configure_attributes:[{name:"method",display:__("Remove a configured two-factor authentication method"),tag:"select",multiple:!1,limit:100,null:!1,nulloption:!0,translate:!0,options:this.user_methods}]},autofocus:!1}),t},i.prototype.remove=function(t){var e,n,i;return t.preventDefault(),n=this.formParam(t.target),e=this.controller.validate(n),_.isEmpty(e)?(this.formDisable(t),this.ajax({type:"DELETE",url:this.apiPath+"/users/"+this.user.id+"/two_factor_remove_authentication_method",data:JSON.stringify({method:n.method}),processData:!0,success:(i=this,function(){var t;return i.user.trigger("two_factor_changed"),t=App.TwoFactorMethods.methodByKey(n.method),i.notify({type:"success",msg:App.i18n.translatePlain('The two-factor authentication method "%s" was removed for this user.',App.i18n.translatePlain(t.label)),timeout:4e3}),i.close()}),error:function(e){return function(n){var i,s;return s=(null!=(i=JSON.parse(n.responseText))?i.error:void 0)||__("Could not remove the two-factor authentication method for this user."),e.showAlert(s),e.formEnable(t)}}(this)})):(this.formValidate({form:t.target,errors:e}),!1)},i.prototype.removeAll=function(t){return t.preventDefault(),this.formDisable(t),new App.ControllerConfirm({head:__("Confirmation"),message:__("Are you sure? The user will have to to reconfigure all two-factor authentication methods."),buttonClass:"btn--danger",onCancel:(e=this,function(){return e.formEnable(t)}),onClose:function(e){return function(){return e.formEnable(t)}}(this),callback:function(e){return function(){return e.ajax({type:"DELETE",url:e.apiPath+"/users/"+e.user.id+"/two_factor_remove_all_authentication_methods",success:function(){return e.user.trigger("two_factor_changed"),e.notify({type:"success",msg:App.i18n.translateInline("All two-factor authentication methods were removed for this user."),timeout:4e3}),e.close()},error:function(n){var i,s;return s=(null!=(i=JSON.parse(n.responseText))?i.error:void 0)||__("Could not remove all two-factor authentication methods for this user."),e.showAlert(s),e.formEnable(t)}})}}(this)});var e},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.UserHistory=function(n){function i(){return this.fetch=t(this.fetch,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.fetch=function(){return this.ajax({id:"user_history",type:"GET",url:this.apiPath+"/users/history/"+this.user_id,success:(t=this,function(e){return App.Collection.loadAssets(e.assets),t.items=e.history,t.render()})});var t},i}(App.GenericHistory)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.UserProfile=function(t){function i(t){this.currentPosition=e(this.currentPosition,this),this.setPosition=e(this.setPosition,this),this.render=e(this.render,this),this.show=e(this.show,this),this.url=e(this.url,this),this.meta=e(this.meta,this),i.__super__.constructor.apply(this,arguments),App.User.full(this.user_id,this.render)}return n(i,t),i.requiredPermission=["ticket.agent","admin.user"],i.prototype.meta=function(){var t,e,n;return e={url:this.url(),id:this.user_id},App.User.exists(this.user_id)&&(t=(n=App.User.find(this.user_id)).icon(),!1===n.active&&(t="inactive-"+t),e.head=n.displayName(),e.title=n.displayName(),e.iconClass=t,e.active=n.active),e},i.prototype.url=function(){return"#user/profile/"+this.user_id},i.prototype.show=function(){return App.OnlineNotification.seen("User",this.user_id),this.navupdate({url:"#",type:"menu"})},i.prototype.changed=function(){return!1},i.prototype.render=function(t){var e;return this.doNotLog||(this.doNotLog=1,this.recentView("User",this.user_id)),e=$(App.view("user_profile/index")({user:t})),new App.UserProfileUser({object_id:t.id,el:e.find(".js-profileName")}),new App.UserProfileObject({el:e.find(".js-object-container"),object_id:t.id,taskKey:this.taskKey}),new App.UserProfileActionRow({el:e.find(".js-action"),object_id:t.id}),new App.TicketStats({el:e.find(".js-ticket-stats"),user:t}),this.html(e),new App.UpdateTastbar({genericObject:t})},i.prototype.setPosition=function(t){return this.$(".profile").scrollTop(t)},i.prototype.currentPosition=function(){return this.$(".profile").scrollTop()},i}(App.Controller),t=function(t){function e(t){var n;e.__super__.constructor.apply(this,arguments),this.authenticateCheckRedirect(),n={user_id:t.user_id},App.TaskManager.execute({key:"User-"+this.user_id,controller:"UserProfile",params:n,show:!0})}return n(e,t),e.requiredPermission=["ticket.agent","admin.user"],e}(App.ControllerPermanent),App.Config.set("user/profile/:user_id",t,"Routes")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.UserProfileActionRow=function(n){function i(){return this.actions=t(this.actions,this),this.resendVerificationEmail=t(this.resendVerificationEmail,this),this.newTicket=t(this.newTicket,this),this.editUser=t(this.editUser,this),this.showHistory=t(this.showHistory,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="User",i.prototype.observe={verified:!0,source:!0,organization_id:!0},i.prototype.showHistory=function(t){return new App.UserHistory({user_id:t.id,container:this.el.closest(".content")})},i.prototype.editUser=function(t){var e,n;return e=function(t,e,n,i,s){if(!App.Config.get("ticket_organization_reassignment"))return s.find('[name="organization_id"]').closest(".form-group").find(".help-message").addClass("hide")},t.secondaryOrganizations(0,1e3,(n=this,function(){return new App.ControllerGenericEdit({id:t.id,genericObject:"User",screen:"edit",pageData:{title:__("Users"),object:__("User"),objects:__("Users")},container:n.el.closest(".content"),handlers:[e]})}))},i.prototype.newTicket=function(t){return this.navigate("ticket/create/customer/"+t.id)},i.prototype.resendVerificationEmail=function(t){return this.ajax({id:"email_verify_send",type:"POST",url:this.apiPath+"/users/email_verify_send",data:JSON.stringify({email:t.email}),processData:!0,success:(e=this,function(){return e.notify({type:"success",msg:App.i18n.translateContent('Email sent to "%s". Please let the user verify their email account.',t.email),removeAll:!0})}),error:function(e){return function(){return e.notify({type:"error",msg:App.i18n.translateContent('Failed to send email to "%s". Please contact an administrator.',t.email),removeAll:!0})}}(this)});var e},i.prototype.actions=function(t){var e,n;return e=[{name:"history",title:__("History"),callback:this.showHistory}],this.permissionCheck("ticket.agent")&&e.unshift({name:"ticket",title:__("New Ticket"),callback:this.newTicket}),t.isAccessibleBy(App.User.current(),"change")&&(e.unshift({name:"edit",title:__("Edit"),callback:this.editUser}),!0!==t.verified&&"signup"===t.source&&e.push({name:"resend_verification_email",title:__("Resend verification email"),callback:this.resendVerificationEmail})),this.permissionCheck("admin.data_privacy")&&e.push({title:__("Delete"),name:"delete",callback:(n=this,function(){return n.navigate("#system/data_privacy/"+t.id)})}),e},i}(App.ControllerObserverActionRow)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.UserProfileObject=function(n){function i(){return this.update=t(this.update,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.organizationLimit=3,i.prototype.model="User",i.prototype.observeNot={cid:!0,created_at:!0,created_by_id:!0,updated_at:!0,updated_by_id:!0,preferences:!0,password:!0,last_login:!0,login_failed:!0,source:!0,image_source:!0},i.prototype.events={"click .js-showMoreOrganizations a":"showMoreOrganizations","focusout [contenteditable]":"update"},i.prototype.render=function(t){var e,n,i,s,r,o;for(n in t&&(this.user=t),App.TaskManager.touch(this.taskKey),o=[],r=App.User.attributesGet("view"))e=r[n],(s=(i=n).substr(0,i.length-3))in t&&(i=s),"firstname"!==i&&"lastname"!==i&&"organization"!==i&&e.shown&&(null!=t[i]&&""!==t[i]||"richtext"===e.tag)&&o.push(e);return this.html(App.view("user_profile/object")({user:t,userData:o})),this.renderOrganizations(),this.$("[contenteditable]").ce({mode:"textonly",multiline:!0,maxlength:250})},i.prototype.showMoreOrganizations=function(t){return this.preventDefaultAndStopPropagation(t),this.organizationLimit=100*(parseInt(this.organizationLimit/100)+1),this.renderOrganizations()},i.prototype.renderOrganizations=function(){var t;return t=this.el,this.user.secondaryOrganizations(0,this.organizationLimit,(function(e){var n,i,s,r,o;for(o=[],i=0,s=e.length;i<s;i++)r=e[i],n=$("<li></li>"),new App.UserProfileOrganization({object_id:r.id,el:n}),o.push(n);return t.find(".js-organizationList li").not(".js-showMoreOrganizations").remove(),t.find(".js-organizationList").prepend(o)})),this.user.organization_ids&&this.user.organization_ids.length<this.organizationLimit?this.el.find(".js-showMoreOrganizations").addClass("hidden"):this.el.find(".js-showMoreOrganizations").removeClass("hidden")},i.prototype.update=function(t){var e,n,i,s;if(n=$(t.target).attr("data-name"),s=$(t.target).html(),(i=App.User.find(this.object_id))[n]!==s)return this.lastAttributes[n]=s,(e={})[n]=s,i.updateAttributes(e),this.log("debug","update",n,s,i)},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.UserProfileOrganization=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("Organization"),i.prototype.model="Organization",i.prototype.observe={name:!0},i.prototype.render=function(t){return this.html(App.view("user_profile/organization")({organization:t})),this.renderPopovers()},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.UserProfileUser=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="User",i.prototype.observe={firstname:!0,lastname:!0,organization_id:!0,image:!0},i.prototype.render=function(t){return t.organization_id?new App.UserProfileOrganization({object_id:t.organization_id,el:this.el.siblings(".js-organization")}):this.el.siblings(".js-organization").html(""),this.html(App.view("user_profile/name")({user:t}))},i}(App.ControllerObserver)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.load()}return e(n,t),n.requiredPermission="admin",n.prototype.header=__("Version"),n.prototype.load=function(){return this.startLoading(),this.ajax({id:"version",type:"GET",url:this.apiPath+"/version",success:(t=this,function(e){return t.stopLoading(),t.version=e.version,t.render()})});var t},n.prototype.render=function(){return this.html(App.view("version")({version:this.version}))},n
}(App.ControllerSubContent),App.Config.set("Version",{prio:3800,name:__("Version"),parent:"#system",target:"#system/version",controller:t,permission:["admin"]},"NavBarAdmin")}.call(this),function(){var t,e,n,i,s,r,o,a,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function n(){this.constructor=t}for(var i in e)u.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty,p=[].slice;n=function(e){function n(){this.newPreDefinedWebhook=l(this.newPreDefinedWebhook,this),this.choosePreDefinedWebhook=l(this.choosePreDefinedWebhook,this),this.customPayloadCollapseHandler=l(this.customPayloadCollapseHandler,this),this.show=l(this.show,this),n.__super__.constructor.apply(this,arguments),this.genericController=new o({el:this.el,id:this.id,genericObject:"Webhook",defaultSortBy:"name",pageData:{home:"webhooks",object:__("Webhook"),objects:__("Webhooks"),pagerAjax:!0,pagerBaseUrl:"#manage/webhook/",pagerSelected:this.page||1,pagerPerPage:150,navupdate:"#webhooks",notes:[__("Webhooks are \u2026")],buttons:[{name:__("Example Payload"),"data-type":"payload",class:"btn"},{name:__("New Webhook"),"data-type":"new",class:"btn--success",menu:[{name:__("Pre-defined Webhook"),"data-type":"predefined"}]}],logFacility:"webhook"},payloadExampleUrl:"/api/v1/webhooks/preview",container:this.el.closest(".content"),veryLarge:!0,handlers:[this.customPayloadCollapseHandler],validateOnSubmit:this.validateOnSubmit})}return c(n,e),n.requiredPermission="admin.webhook",n.prototype.header=__("Webhooks"),n.prototype.events={"click [data-type=predefined]":"choosePreDefinedWebhook"},n.prototype.show=function(t){var e,n;for(e in t)n=t[e],"el"!==e&&"shown"!==e&&"match"!==e&&(this[e]=n);return this.genericController.paginate(this.page||1)},n.prototype.disableSwitchCallback=function(){return $(this).parents("form").find('[data-attribute-name="customized_payload"] label').css("pointer-events","none")},n.prototype.enableSwitchCallback=function(){return $(this).parents("form").find('[data-attribute-name="customized_payload"] label').css("pointer-events","")},n.prototype.customPayloadCollapseHandler=function(t,e,n,i,s){var r;if("customized_payload"===e.name)return(r=s.find('[data-attribute-name="custom_payload"] .panel-collapse')).off("show.bs.collapse hide.bs.collapse",this.disableSwitchCallback).on("show.bs.collapse hide.bs.collapse",this.disableSwitchCallback),r.off("shown.bs.collapse hidden.bs.collapse",this.enableSwitchCallback).on("shown.bs.collapse hidden.bs.collapse",this.enableSwitchCallback),t.customized_payload?(r.collapse("show"),s.find('[data-attribute-name="custom_payload"]').css("margin-bottom","")):(r.collapse("hide"),s.find('[data-attribute-name="custom_payload"]').css("margin-bottom","0"))},n.prototype.validateOnSubmit=function(t){var e,n;if(!_.isEmpty(t.custom_payload)){e={},n=!1;try{_.isObject(JSON.parse(t.custom_payload))||(n=!0)}catch(t){t,n=!0}return n&&(e.custom_payload=__("Please enter a valid JSON string.")),e}},n.prototype.choosePreDefinedWebhook=function(e){return e.preventDefault(),new t({container:this.el.closest(".content"),callback:this.newPreDefinedWebhook})},n.prototype.newPreDefinedWebhook=function(t){return new i({genericObject:"Webhook",pageData:{object:__("Webhook")},container:this.el.closest(".content"),veryLarge:!0,handlers:[this.customPayloadCollapseHandler],validateOnSubmit:this.validateOnSubmit,preDefinedWebhook:t})},n}(App.ControllerSubContent),o=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return c(n,t),n.prototype.editControllerClass=function(){return e},n.prototype.newControllerClass=function(){return s},n}(App.ControllerGenericIndex),t=function(t){function e(){this.onSubmit=l(this.onSubmit,this),e.__super__.constructor.apply(this,arguments),App.PreDefinedWebhook.subscribe(this.render,{initFetch:!0})}return c(e,t),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!0,e.prototype.buttonSubmit=__("Next"),e.prototype.buttonClass="btn--primary",e.prototype.head=__("Pre-defined Webhook"),e.prototype.veryLarge=!0,e.prototype.shown=!1,e.prototype.content=function(){var t;return function(t){var e;return e=App.UiElement.select.render({id:"preDefinedWebhooks",name:"pre_defined_webhook_id",multiple:!1,limit:100,null:!1,relation:"PreDefinedWebhook",nulloption:!1}),t.html(e)}((t=$(App.view("pre_defined_webhook")())).find(".js-preDefinedWebhooks")),t},e.prototype.onSubmit=function(t){var e,n;return this.formDisable(t),e=this.formParam(t.target),n=App.PreDefinedWebhook.find(e.pre_defined_webhook_id),this.close(),this.callback(n)},e}(App.ControllerModal),r={field_prefix:"preferences::pre_defined_webhook",preDefinedWebhookAttributes:function(){var t,e;return t=$.extend(!0,{},this.preDefinedWebhook.fields),[{name:"pre_defined_webhook_type",display:__("Pre-defined Webhook"),null:!0,tag:"select",relation:"PreDefinedWebhook",value:this.preDefinedWebhook.id,disabled:!0}].concat(_.map(t,(e=this,function(t){return t.name=e.field_prefix+"::"+t.name,t})))},contentFormModel:function(){var t,e,n;return t=$.extend(!0,[],App[this.genericObject].configure_attributes),!this.preDefinedWebhook&&(null!=(n=this.item)?n.pre_defined_webhook_type:void 0)&&(this.preDefinedWebhook=App.PreDefinedWebhook.find(this.item.pre_defined_webhook_type)),this.preDefinedWebhook&&(-1!==(e=_.findIndex(t,(function(t){return"customized_payload"===t.name})))?t.splice.apply(t,[e,0].concat(p.call(this.preDefinedWebhookAttributes()))):t=t.concat(this.preDefinedWebhookAttributes())),{configure_attributes:t}}},a={events:{'change select[name="ssl_verify"]':"handleSslVerifyAlert"},handleSslVerifyAlert:function(){return this.sslVerifyAlert||(this.sslVerifyAlert=this.injectSslVerifyAlert()),this.formParam(this.el).ssl_verify?this.sslVerifyAlert.addClass("hide"):this.sslVerifyAlert.removeClass("hide")},injectSslVerifyAlert:function(){return $("<div />").attr("role","alert").addClass("alert").addClass("alert--warning").addClass("hide").text(App.i18n.translatePlain("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!")).appendTo(this.el.find(".modal-alerts-container"))}},i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.include(r),e.include(a),e.prototype.contentFormParams=function(){return{name:App.i18n.translatePlain(this.preDefinedWebhook.name),custom_payload:this.preDefinedWebhook.custom_payload,note:App.i18n.translatePlain("Pre-defined webhook for %s.",App.i18n.translatePlain(this.preDefinedWebhook.name))}},e}(App.ControllerGenericNew),e=function(t){function e(){e.__super__.constructor.apply(this,arguments),App.PreDefinedWebhook.subscribe(this.render,{initFetch:!0})}return c(e,t),e.include(r),e.include(a),e.prototype.shown=!1,e.prototype.render=function(){return e.__super__.render.apply(this,arguments),setTimeout((t=this,function(){return t.handleSslVerifyAlert()}),0);var t},e.prototype.contentFormParams=function(){var t;return $.extend(!0,this.item,{custom_payload:this.item.customized_payload?void 0:null!=(t=this.preDefinedWebhook)?t.custom_payload:void 0})},e}(App.ControllerGenericEdit),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.include(a),e}(App.ControllerGenericNew),App.Config.set("Webhook",{prio:3350,name:__("Webhook"),parent:"#manage",target:"#manage/webhook",controller:n,permission:["admin.webhook"]},"NavBarAdmin")}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.AnswerList=function(n){function i(){this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("Organization","User"),i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p;for(p=this,function(t){var e;return e=App.Ticket.findNative(t),p.navigate(e.uiUrl())},i=function(t,e,n){return n.title=e.title,"1111"},e=function(t,e,n){return n.link=e.uiUrl(),"22222"},s=function(t,e,n){var i;return e?(i=void 0,"customer_id"===n.name&&(i=e.customer_id),"owner_id"===n.name&&(i=e.owner_id),i?(n.class="user-popover",n.data={id:i},t):t):t},n=function(t,e,n){return e&&e.organization_id?(n.class="organization-popover",n.data={id:e.organization_id},t):t},t=function(t){var e;return e={name:"icon",display:"",parentClass:"noTruncate",translation:!1,width:"28px",displayWidth:28,unresizable:!0},t.unshift(0),t[0]=e,t},function(t,e,n){return t=" ",n.class=e.iconClass(),n.link="",n.title=e.iconTitle(),t},a=[],r=0,o=(l=this.ticket_ids).length;r<o;r++)u=l[r],c=App.KnowledgeBaseAnswer.fullLocal(u),a.push(c);return this.el.html(""),new App.ControllerTable({tableId:this.tableId,el:this.el,overview:this.columns||["id","translation::title","customer","group","created_at"],model:App.KnowledgeBaseAnswer,objects:a,callbackHeader:[t],callbackAttributes:{organization_id:[n],owner_id:[s],title:[e,i],number:[e,i]},radio:this.radio}),this.renderPopovers()},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetAvatar=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("User"),i.prototype.model="User",i.prototype.observe={login:!0,firstname:!0,lastname:!0,email:!0,image:!0,vip:!0,out_of_office:!0,out_of_office_start_at:!0,out_of_office_end_at:!0,out_of_office_replacement_id:!0,active:!0},i.prototype.globalRerender=!1,i.prototype.render=function(t){return this.html(t.avatar(this.size,this.position,this.cssClass,!1,!1,this.type)),this.renderPopovers()},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.WidgetButtonWithDropdown=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.render()}return t(n,e),n.prototype.elements={".dropdown-menu-accessories":"accessoriesContainer"},n.prototype.events={"click li":"clickedOption"},n.prototype.mainActionLabel=__("Submit"),n.prototype.mainActionIdentifier="js-submit",n.prototype.accessoryActionsIdentifier="js-submit-action",n.prototype.render=function(){return this.el.addClass("buttonDropdown dropdown dropup"),this.html(App.view("widget/button_with_dropdown")({mainActionIdentifier:this.mainActionIdentifier,accessoryActionsIdentifier:this.accessoryActionsIdentifier,mainActionLabel:this.mainActionLabel,actions:this.actions||[]}))},n.prototype.clickedOption=function(t){if(!t.currentTarget.hasAttribute("disabled"))return this.accessoriesContainer.trigger("blur");this.preventDefaultAndStopPropagation(t)},n}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ErrorModal=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!1,i.prototype.buttonSubmit=__("Close"),i.prototype.head=__("Error"),i.prototype.showTrySupport=!0,i.prototype.content=function(){return this.message},i.prototype.onSubmit=function(){if(this.close(),this.callback)return this.callback()},i}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.HttpLog=function(i){function s(){this.show=e(this.show,this),this.render=e(this.render,this),this.fetch=e(this.fetch,this),s.__super__.constructor.apply(this,arguments),this.fetch(),this.records=[]}return n(s,i),s.prototype.events={"click .js-record":"show"},s.prototype.fetch=function(){return this.ajax({id:"http_logs",type:"GET",url:this.apiPath+"/http_logs/"+this.facility,data:{limit:this.limit||50},processData:!0,success:(t=this,function(e){return(!t.records[0]||e[0]&&t.records[0]&&e[0].updated_at!==t.records[0].updated_at)&&(t.records=e,t.render()),t.delay(t.fetch,2e4)})});var t},s.prototype.render=function(){return this.html(App.view("widget/http_log")({records:this.records,description:this.description}))},s.prototype.show=function(e){var n,i,s,r,o;for(e.preventDefault(),r=$(e.currentTarget).data("id"),n=0,i=(o=this.records).length;n<i;n++)if(s=o[n],r.toString()===s.id.toString())return void new t({record:s,container:this.el.closest(".content")})},s}(App.Controller),t=function(t){function e(){e.__super__.constructor.apply(this,arguments)}return n(e,t),e.prototype.authenticateRequired=!0,e.prototype.large=!0,e.prototype.head=__("HTTP Log"),e.prototype.buttonClose=!0,e.prototype.buttonCancel=!1,e.prototype.buttonSubmit=!1,e.prototype.content=function(){return App.view("widget/http_log_show")({record:this.record})},e}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Import=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Import"),i.prototype.autoFocusOnFirstInput=!1,i.prototype.head=__("Import"),i.prototype.large=!0,i.prototype.templateDirectory="generic/object_import",i.prototype.baseUrl="/api/v1/text_modules",i.prototype.content=function(){var t,e;return t=$(App.view(this.templateDirectory+"/index")({head:__("Import"),import_example_url:this.baseUrl+"/import_example",deleteOption:this.deleteOption})),this.data&&(e=App.view(this.templateDirectory+"/result")(this.data),t.find(".js-error").html(e),e?t.find(".js-error").removeClass("hide"):t.find(".js-error").addClass("hide")),t},i.prototype.onSubmit=function(t){var e,n;return(e=new FormData($(t.currentTarget).closest("form").get(0))).set("try",!0),_.isEmpty(e.get("data"))&&e.delete("data"),this.formDisable(t),this.ajax({id:"csv_import",type:"POST",url:this.baseUrl+"/import",processData:!1,contentType:!1,cache:!1,data:e,success:(n=this,function(i){return"success"===i.result?(new App.ImportTryResult({container:n.el.closest(".content"),result:i,params:e,templateDirectory:n.templateDirectory,baseUrl:n.baseUrl}),void n.close()):(n.data=i,n.update(),n.formEnable(t))}),error:function(e){return function(n){var i;return i=n.responseJSON||{},e.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("The import failed.")),timeout:6e3}),e.formEnable(t)}}(this)})},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ImportResult=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Close"),i.prototype.autoFocusOnFirstInput=!1,i.prototype.head=__("Import"),i.prototype.large=!0,i.prototype.templateDirectory="generic/object_import/",i.prototype.content=function(){return $(App.view(this.templateDirectory+"/imported")({head:__("Imported"),result:this.result}))},i.prototype.onSubmit=function(){return this.close()},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ImportTryResult=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Yes, start real import."),i.prototype.autoFocusOnFirstInput=!1,i.prototype.head=__("Import"),i.prototype.large=!0,i.prototype.templateDirectory="generic/object_import/",i.prototype.baseUrl="/api/v1/text_modules",i.prototype.content=function(){var t,e;return t=$(App.view(this.templateDirectory+"/import_try")({head:__("Import"),import_example_url:this.baseUrl+"/import",result:this.result})),this.data&&(e=App.view(this.templateDirectory+"/result")(this.data),t.find(".js-error").html(e),e?t.find(".js-error").removeClass("hide"):t.find(".js-error").addClass("hide")),t},i.prototype.onSubmit=function(t){return this.params.set("try",!1),this.formDisable(t),this.ajax({id:"csv_import",type:"POST",url:this.baseUrl+"/import",processData:!1,contentType:!1,cache:!1,data:this.params,success:(e=this,function(n){return"success"===n.result?(new App.ImportResult({container:e.el.closest(".content"),result:n,params:e.params,templateDirectory:e.templateDirectory,baseUrl:e.baseUrl}),void e.close()):(e.data=n,e.update(),e.formEnable(t))}),error:function(e){return function(n){var i;return i=n.responseJSON||{},e.notify({type:"error",msg:App.i18n.translateContent(i.error_human||i.error||__("The import failed.")),timeout:6e3}),e.formEnable(t)}}(this)});var e},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.InviteUser=function(n){function i(){var e;this.submit=t(this.submit,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.container&&this.el.addClass("modal--local"),this.render(),this.el.modal({keyboard:!0,show:!0,backdrop:!0,container:this.container}).on({"hidden.bs.modal":(e=this,function(){return e.callback&&e.callback(),e.el.remove()}),"shown.bs.modal":function(t){return function(){return t.el.addClass("modal--ready")}}(this)})}return e(i,n),i.prototype.className="modal fade modal--large",i.prototype.events={"click  .js-close":"hide","submit .js-user":"submit","click  .js-goToSlide":"goToSlide"},i.prototype.render=function(){var t;return t=$(App.view("widget/invite_user")({head:this.head})),this.controller=new App.ControllerForm({el:t.find(".js-form"),model:App.User,screen:this.screen,autofocus:!0}),this.initRenderingDone?this.$(".modal-dialog").replaceWith(t):(this.initRenderingDone=!0,this.html(t))},i.prototype.submit=function(t){var e,n,i;return t.preventDefault(),this.showSlide("js-waiting"),this.formDisable(t),this.params=this.formParam(t.target),this.params.invite=!0,this.signup&&(this.params.role_ids=App.Role.search({filter:{active:!0,default_at_signup:!0}}).map((function(t){return t.id}))),(n=new App.User).load(this.params),(e=n.validate({controllerForm:this.controller}))?(this.log("error new",e),this.formValidate({form:t.target,errors:e}),this.formEnable(t),this.showSlide("js-user"),!1):n.save({done:(i=this,function(){return i.showSlide("js-success"),i.el.modal("hide")}),fail:function(e){return function(n,i){return e.formEnable(t),e.showSlide("js-user"),e.showAlert("js-user",i.error_human||i.error)}}(this)})},i}(App.ControllerWizardModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetLink=function(n){function i(){if(this.delete=t(this.delete,this),this.reload=t(this.reload,this),this.fetch=t(this.fetch,this),i.__super__.constructor.apply(this,arguments),this.links)return this.localLinks=_.clone(this.links),void this.render();this.fetch()}return e(i,n),i.extend(App.PopoverProvidable),i.popoversDefaults={position:"left"},i.prototype.events={"click .js-add":"add","click .js-delete":"delete"},i.prototype.fetch=function(){return this.ajax({id:"links_"+this.object.id+"_"+this.object_type,type:"GET",url:this.apiPath+"/links",data:{link_object:this.object_type,link_object_value:this.object.id},processData:!0,success:(t=this,function(e){return t.localLinks=e.links,App.Collection.loadAssets(e.assets),t.render()})});var t},i.prototype.reload=function(t){return this.localLinks=_.clone(t),this.render()},i.prototype.delete=function(t){var e,n,i,s,r,o;return t.preventDefault(),r=$(t.currentTarget).data("link-type"),e=$(t.currentTarget).data("object"),n=$(t.currentTarget).data("object-id"),i=this.object_type,s=this.object.id,this.ajax({id:"links_remove_"+this.object.id+"_"+this.object_type,type:"DELETE",url:this.apiPath+"/links/remove",data:JSON.stringify({link_type:r,link_object_source:e,link_object_source_value:n,link_object_target:i,link_object_target_value:s}),processData:!0,success:(o=this,function(){return o.fetch()}),error:function(t){return function(e){var n;return t.notify({type:"error",msg:App.i18n.translateContent((null!=(n=e.responseJSON)?n.error:void 0)||"Couldn't save changes"),removeAll:!0})}}(this)})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetLinkKbAnswer=function(n){function i(){return this.didBlur=t(this.didBlur,this),this.didSubmit=t(this.didSubmit,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.registerPopovers("KnowledgeBaseAnswer"),i.prototype.elements={".js-add":"addButton",".searchableSelect":"searchableSelect",".js-shadow":"shadowField",".js-input":"inputField"},i.prototype.events={"change .js-shadow":"didSubmit","blur .js-input":"didBlur"},i.prototype.getAjaxAttributes=function(t,e){var n;return this.apiPath=App.Config.get("api_path"),e.url=this.apiPath+"/knowledge_bases/search",(n={}).query=t.input.val(),n.limit=t.options.attribute.limit,n.flavor="agent",n.include_locale=!0,n.index="KnowledgeBase::Answer::Translation",n.highlight_enabled=!1,e.data=JSON.stringify(n),e},i.prototype.linksForRendering=function(){return this.localLinks.map((function(t){var e;if("KnowledgeBase::Answer::Translation"===t.link_object)if(e=App.KnowledgeBaseAnswerTranslation.fullLocal(t.link_object_value))return{title:e.title,id:e.id,url:e.uiUrl()}})).filter((function(t){return null!=t}))},i.prototype.render=function(){return this.html(App.view("link/kb_answer")({list:this.linksForRendering(),editable:this.editable})),this.renderPopovers(),this.el.append(new App.SearchableAjaxSelect({delegate:this,useAjaxDetails:!0,attribute:{id:"link_kb_answer",name:"input",placeholder:App.i18n.translateInline("Search\u2026"),limit:40,relation:"KnowledgeBaseAnswerTranslation",ajax:!0}}).element()),this.refreshElements(),this.searchableSelect.addClass("hidden")},i.prototype.didSubmit=function(){return this.clearDelay("hideField"),this.inputField.attr("disabled",!0),this.saveToServer(this.shadowField.val())},i.prototype.didBlur=function(){return this.delay((t=this,function(){return t.setInputVisible(!1)}),200,"hideField");var t},i.prototype.add=function(){return this.shadowField.val(""),this.inputField.attr("disabled",!1).val(""),this.setInputVisible(!0),this.inputField.trigger("focus")},i.prototype.setInputVisible=function(t){return this.searchableSelect.toggleClass("hidden",!t),this.addButton.toggleClass("hidden",t)},i.prototype.saveToServer=function(t){return this.ajax({id:"links_add_"+this.object.id+"_"+this.object_type,type:"POST",url:this.apiPath+"/links/add",data:JSON.stringify({link_type:"normal",link_object_target:"Ticket",link_object_target_value:this.object.id,link_object_source:"KnowledgeBase::Answer::Translation",link_object_source_number:t}),processData:!0,success:(e=this,function(){return e.fetch(),e.setInputVisible(!1)}),error:function(t){return function(e){var n;return t.setInputVisible(!1),t.notify({type:"error",msg:App.i18n.translateContent((null!=(n=e.responseJSON)?n.error:void 0)||"Couldn't save changes"),removeAll:!0})}}(this)});var e},i}(App.WidgetLink)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetLink.Ticket=function(n){function i(){return this.release=t(this.release,this),this.add=t(this.add,this),this.render=t(this.render,this),this.unsubscribeTickets=t(this.unsubscribeTickets,this),this.subscribeTicket=t(this.subscribeTicket,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.registerPopovers("Ticket"),i.prototype.subscribeTicket=function(t){var e,n;if(this.ticketSubscriberIDs||(this.ticketSubscriberIDs={}),!this.ticketSubscriberIDs[t.id])return e=t.subscribe((n=this,function(){return n.render(!0)})),this.ticketSubscriberIDs[t.id]=e},i.prototype.unsubscribeTickets=function(){var t,e,n,i;if(this.ticketSubscriberIDs){for(e in n=this.ticketSubscriberIDs)t=n[e],(i=App.Ticket.find(e))&&i.unsubscribe(t);return this.ticketSubscriberIDs={}}},i.prototype.render=function(t){var e,n,i,s,r,o,a;if(null==t&&(t=!1),t||!this.lastLocalLinks||!_.isEqual(this.lastLocalLinks,this.localLinks)){for(this.lastLocalLinks=_.clone(this.localLinks),this.unsubscribeTickets(),s={},e=0,i=(r=this.localLinks).length;e<i;e++)s[(n=r[e]).link_type]||(s[n.link_type]={tickets:[]}),"Ticket"===n.link_object&&("merged"===(o=App.Ticket.fullLocal(n.link_object_value)).state.name&&(o.css="merged"),s[n.link_type].tickets.push(o),this.subscribeTicket(o));for(a in s)0!==s[a].tickets.length&&(s[a].ticketList=App.view("generic/ticket_list")({tickets:s[a].tickets,object:"Ticket",linkType:a,editable:this.editable}));return this.html(App.view("link/ticket/list")({links:s,editable:this.editable})),this.renderPopovers()}},i.prototype.add=function(t){return t.preventDefault(),new App.TicketLinkAdd({link_object:this.object_type,link_object_id:this.object.id,link_types:[["normal",__("Normal")],["child",__("Child")],["parent",__("Parent")]],object:this.object,parent:this,container:this.el.closest(".content")})},i.prototype.release=function(){return i.__super__.release.apply(this,arguments),this.unsubscribeTickets()},i}(App.WidgetLink)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetMention=function(n){function i(){this.unsubscribe=t(this.unsubscribe,this),this.subscribe=t(this.subscribe,this),this.render=t(this.render,this),this.reload=t(this.reload,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.events={"click .js-subscribe":"subscribe","click .js-unsubscribe":"unsubscribe"},i.prototype.elements={".js-subscribe input[type=button]":"subscribeButton",".js-unsubscribe input[type=button]":"unsubscribeButton"},i.prototype.reload=function(t){return this.mentions=t,this.render()},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c;for(l=!1,o=[],t=1,n=0,s=(a=this.mentions).length;n<s;n++)i=a[n],(r=App.Mention.find(i))&&(c=App.User.find(r.user_id))&&c.active&&(r.user_id===App.Session.get().id&&(l=!0),t>10||(e="",r.access=!0,this.object.isAccessibleBy(c,"read")||(e="avatar--inactive",r.access=!1),r.avatar=c.avatar("30","",e),o.push(r),t++));return this.html(App.view("widget/mention")({subscribed:l,mentions:o}))},i.prototype.subscribe=function(t){var e,n;return t.preventDefault(),t.stopPropagation(),this.subscribeButton.prop("readonly",!0),this.subscribeButton.prop("disabled",!0),(e=new App.Mention).load({mentionable_type:"Ticket",mentionable_id:this.object.id,user_id:App.Session.get().id}),e.save({done:(n=this,function(){return n.subscribeButton.prop("readonly",!1),n.subscribeButton.prop("disabled",!1),$(t.currentTarget).addClass("hidden"),$(t.currentTarget).closest("form").find(".js-unsubscribe").removeClass("hidden")})})},i.prototype.unsubscribe=function(t){var e,n,i,s,r,o;for(t.preventDefault(),t.stopPropagation(),this.unsubscribeButton.prop("readonly",!0),this.unsubscribeButton.prop("disabled",!0),o=[],e=0,i=(r=this.mentions).length;e<i;e++)if(n=r[e],(s=App.Mention.find(n))&&s.user_id===App.Session.get().id){s.destroy({done:function(e){return function(){return e.unsubscribeButton.prop("readonly",!1),e.unsubscribeButton.prop("disabled",!1),$(t.currentTarget).addClass("hidden"),$(t.currentTarget).closest("form").find(".js-subscribe").removeClass("hidden")}}(this)});break}return o},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.OnlineNotificationWidget=function(n){function i(){var e;this.remove=t(this.remove,this),this.hide=t(this.hide,this),this.show=t(this.show,this),this.createContainer=t(this.createContainer,this),this.toggle=t(this.toggle,this),this.fetch=t(this.fetch,this),this.counterGen=t(this.counterGen,this),this.counterUpdate=t(this.counterUpdate,this),this.listNavigate=t(this.listNavigate,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("OnlineNotification::changed",(e=this,function(){return e.delay((function(){return e.fetch()}),2200,"online-notification-changed")})),this.ignoreInitLogin=!1,this.controllerBind("ws:login",function(t){return function(){return t.ignoreInitLogin&&t.delay((function(){return t.fetch()}),3200,"online-notification-changed"),t.ignoreInitLogin=!0}}(this)),this.controllerBind("auth",function(t){return function(e){e&&t.access()||t.counterUpdate(0)}}(this)),$(window).on("click.notifications",this.hide),this.createContainer(),this.controllerBind("ui:rerender",function(t){return function(){return t.createContainer(),"online_notification"}}(this))}return e(i,n),i.prototype.alreadyShown={},i.prototype.shown=!1,i.prototype.className="popover popover--notifications right js-notificationsContainer",i.prototype.attributes={role:"tooltip"},i.prototype.events={"click .js-mark":"markAllAsRead",click:"stopPropagation"},i.prototype.elements={".js-mark":"mark",".js-noNotifications":"noNotifications",".js-item":"item",".js-content":"content",".js-header":"header"},i.prototype.release=function(){return $(window).off("click.notifications"),$(window).off("keydown.notifications")},i.prototype.access=function(){return!!this.Session.get()},i.prototype.listNavigate=function(t){if(27===t.keyCode)this.hide();else if(38===t.keyCode)t.preventDefault(),this.nudge(t,-1);else if(40===t.keyCode)t.preventDefault(),this.nudge(t,1);else if(13===t.keyCode)return this.$(".js-item").filter(".is-hover").find(".js-locationVerify").trigger("click")},i.prototype.nudge=function(t,e){var n,i,s,r;if((n=(i=this.$(".js-item")).filter(".is-hover")).length)return 1===e?(s=n.next(".js-item")).length&&(n.removeClass("is-hover"),s.addClass("is-hover")):(r=n.prev(".js-item")).length&&(n.removeClass("is-hover"),r.addClass("is-hover")),s&&this.scrollToIfNeeded(s,!0),r?this.scrollToIfNeeded(r,!1):void 0;i.first().addClass("is-hover")},i.prototype.counterUpdate=function(t,e){if(null==e&&(e=!1),0===t&&(t=""),e||this.count!==t)return this.count=t,$(".js-notificationsCounter").text(t),App.Event.trigger("online_notification_counter",t.toString()),t?this.mark.removeClass("hide"):this.mark.addClass("hide")},i.prototype.counterGen=function(t){var e,n,i,s;for(null==t&&(t=!1),e=0,n=0,s=(i=App.OnlineNotification.all()).length;n<s;n++)i[n].seen||e++
;return this.counterUpdate(e,t),_.isEmpty(i)?(this.noNotifications.removeClass("hide"),this.el.addClass("is-empty")):(this.noNotifications.addClass("hide"),this.el.removeClass("is-empty"))},i.prototype.markAllAsRead=function(t){return t.preventDefault(),this.counterUpdate(0),this.ajax({id:"markAllAsRead",type:"POST",url:this.apiPath+"/online_notifications/mark_all_as_read",data:JSON.stringify(""),processData:!0,success:(e=this,function(){return e.fetch()})});var e},i.prototype.fetch=function(){var t,e;return e=this,t=function(t){var n,i,s;for(i=0,s=t.length;i<s;i++)n=t[i],App.TaskManager.touch(n.object+"-"+n.o_id);return e.fetchedData=!0},App.OnlineNotification.fetchFull(t,{clear:!0,force:!0})},i.prototype.toggle=function(){return this.shown?this.hide():this.show()},i.prototype.createContainer=function(){var t,e;if(this.Session.get()){if(t="",e=$(App.view("widget/online_notification")({count:t})),new App.OnlineNotificationContentWidget({el:e.find(".js-items"),container:this}),this.html(e),this.counterGen(!0),this.shown)return this.show()}else this.content.html("")},i.prototype.show=function(){if(this.access())return $(window).on("keydown.notifications",this.listNavigate),this.shown=!0,this.el.addClass("is-visible")},i.prototype.hide=function(){return $(window).off("keydown.notifications"),this.shown=!1,this.el.removeClass("is-visible")},i.prototype.stopPropagation=function(t){return t.stopPropagation()},i.prototype.remove=function(){return this.el.remove()},i}(App.Controller),App.OnlineNotificationContentWidget=function(n){function i(){return this.onClick=t(this.onClick,this),this.onRenderEnd=t(this.onRenderEnd,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.model="OnlineNotification",i.prototype.template="widget/online_notification_item",i.prototype.prepareForObjectListItemSupport=!0,i.prototype.observe={seen:!0},i.prototype.sortBy="created_at",i.prototype.order="DESC",i.prototype.alreadyShown={},i.prototype.insertPosition="before",i.prototype.globalRerender=!1,i.prototype.onRenderEnd=function(){var t,e,n,i,s,r;for(this.container.counterGen(),s=[],t=0,i=(n=App.OnlineNotification.search({sortBy:"created_at",order:"DESC"})).length;t<i;t++)e=n[t],this.alreadyShown[e.id]?s.push(void 0):(this.alreadyShown[e.id]=!0,e.seen?s.push(void 0):this.container.fetchedData?(r=(e=this.prepareForObjectListItem(e)).objectNative&&e.objectNative.activityMessage?e.objectNative.activityMessage(e):"Need objectNative in item "+e.object+".find("+e.o_id+")",r=App.Utils.html2text(r.replace(/<.+?>/g,'"')),this.notifyDesktop({url:e.link,title:r}),s.push(App.OnlineNotification.play())):s.push(void 0));return s},i.prototype.onClick=function(){return this.container.hide()},i}(App.CollectionController)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.WidgetOrganization=function(i){function s(){this.update=e(this.update,this),this.renderAgent=e(this.renderAgent,this),this.render=e(this.render,this),this.release=e(this.release,this),s.__super__.constructor.apply(this,arguments),this.subscribeId=App.Organization.full(this.organization_id,this.render,!1,!0)}return n(s,i),s.prototype.memberLimit=10,s.prototype.events={"click .js-showMoreMembers":"showMoreMembers","focusout [contenteditable]":"update"},s.prototype.release=function(){return App.Organization.unsubscribe(this.subscribeId)},s.prototype.showMoreMembers=function(t){return this.preventDefaultAndStopPropagation(t),this.memberLimit=100*(parseInt(this.memberLimit/100)+1),this.renderMembers()},s.prototype.renderMembers=function(){var e;return e=this.el,this.organization.members(0,this.memberLimit,(function(n){var i,s,r,o,a;for(o=[],s=0,r=n.length;s<r;s++)a=n[s],i=$("<div></div>"),new t({object_id:a.id,el:i}),o.push(i);return e.find(".js-userList").html(o)})),this.organization.member_ids.length<=this.memberLimit?this.el.find(".js-showMoreMembers").parent().addClass("hidden"):this.el.find(".js-showMoreMembers").parent().removeClass("hidden")},s.prototype.organizationData=function(){var t,e,n,i,s,r;for(e in s=[],r=App.Organization.attributesGet("view"))t=r[e],(i=(n=e).substr(0,n.length-3))in this.organization&&(n=i),"name"!==n&&t.shown&&(null!=this.organization[n]&&""!==this.organization[n]||"richtext"===t.tag)&&s.push(t);return s},s.prototype.render=function(t){return t?this.organization=t:this.organization||(this.organization=this.u),this.permissionCheck("ticket.agent")?this.renderAgent(t):this.renderCustomer(t)},s.prototype.renderCustomer=function(){var t;return t=this.organizationData(),this.html($(App.view("widget/organization")({organization:this.organization,organizationData:t,customer:!0})))},s.prototype.renderAgent=function(){var t,e;return e=this.organizationData(),t=$(App.view("widget/organization")({organization:this.organization,organizationData:e})),this.html(t),this.renderMembers(),this.$("[contenteditable]").ce({mode:"textonly",multiline:!0,maxlength:250})},s.prototype.update=function(t){var e,n,i,s;if(n=$(t.target).attr("data-name"),s=$(t.target).html(),(i=App.Organization.find(this.organization_id))[n]!==s)return(e={})[n]=s,i.updateAttributes(e),this.log("notice","update",n,s,i)},s}(App.Controller),t=function(t){function i(){return this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.extend(App.PopoverProvidable),i.registerPopovers("User"),i.prototype.model="User",i.prototype.observe={firstname:!0,lastname:!0,image:!0,active:!0},i.prototype.render=function(t){return this.html(App.view("organization_profile/member")({user:t,el:this.el})),this.renderPopovers()},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetOrganizationAvatar=function(n){function i(){return this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("Organization"),i.prototype.model="Organization",i.prototype.observe={name:!0,vip:!0,active:!0},i.prototype.globalRerender=!1,i.prototype.render=function(t){return this.html(t.avatar(this.size,this.cssClass,!0)),this.renderPopovers()},i}(App.ControllerObserver)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetPayloadExample=function(n){function i(){return this.load=t(this.load,this),this.content=t(this.content,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!1,i.prototype.head=__("Example Payload"),i.prototype.large=!0,i.prototype.content=function(){if(this.payloadExample)return this.payloadExample;this.load()},i.prototype.load=function(){return this.ajax({id:"example_payload",type:"get",url:this.baseUrl,processData:!1,contentType:"text/plain",dataType:"text",cache:!1,success:(t=this,function(e){return t.payloadExample=$(App.view("widget/payload_example")({payload:e})),t.update()}),error:function(t){return function(e){var n;return n=e.responseJSON||{},t.notify({type:"error",msg:App.i18n.translateContent(n.error_human||n.error||__("Loading failed.")),timeout:6e3})}}(this)});var t},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetPlaceholder=function(n){function i(){this.update=t(this.update,this),i.__super__.constructor.apply(this,arguments),this.data||(this.data={}),this.bindElements=[],this.selector?this.bindElements=this.$(this.selector).textmodule():this.el.attr("contenteditable")?this.bindElements=this.el.textmodule():this.bindElements=this.$("[contenteditable]").textmodule(),App.Setting.subscribe(this.update,{initFetch:!0})}return e(i,n),i.prototype.update=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S,x,j,D,P,E,I,O,N,M,R,L,F,B,z,U,q,W,H,J,V,G,K,Y,X,Z,Q;for(t=[],a={password:!0,active:!0},l={password:!0,active:!0,created_at:!0,updated_at:!0},o=0,f=(N=this.objects).length;o<f;o++){if(c=N[o],S={},App[c.object]&&App[c.object].configure_attributes){for(u=0,m=(M=App[c.object].configure_attributes).length;u<m;u++)a[(e=M[u]).name]||"_ids"===e.name.substr(e.name.length-4,e.name.length)||(S[e.name]=e);for(p=0,v=(R=_.keys(S).sort()).length;p<v;p++)if(e=S[D=R[p]],D="#{"+c.prefix+"."+e.name+"}",n="#{"+c.prefix+"."+e.name+"}",e.relation){if(X={name:"Name"},App[e.relation]&&App[e.relation].configure_attributes){for(Z={},X={},d=0,y=(L=App[e.relation].configure_attributes).length;d<y;d++)l[(Y=L[d]).name]||"_id"===Y.name.substr(Y.name.length-3,Y.name.length)||"_ids"===Y.name.substr(Y.name.length-4,Y.name.length)||(Z[Y.name]=Y);for(x=0,b=(F=_.keys(Z).sort()).length;x<b;x++)X[Q=F[x]]=Z[Q].display}for(h in W=c.prefix+"."+e.name.substr(0,e.name.length-3),X)i=X[h],D="#{"+W+"."+h+"}",n="#{"+W+"."+h+"}",t.push({id:D,keywords:D,name:App.i18n.translateInline(c.display)+" > "+App.i18n.translateInline(e.display)+" > "+App.i18n.translateInline(i),content:n});if(Object.keys(App[e.relation].allowedReplaceTagsFunctionMapping).length>0)for(j=0,w=(B=Object.values(App[e.relation].allowedReplaceTagsFunctionMapping)).length;j<w;j++)D="#{"+W+"."+(r=B[j]).placeholder_content+"}",n="#{"+W+"."+r.placeholder_content+"}",t.push({id:D,keywords:D,name:App.i18n.translateInline(c.display)+" > "+App.i18n.translateInline(e.display)+" > "+App.i18n.translateInline(r.placeholder_display),content:n})}else t.push({id:D,keywords:D,name:App.i18n.translateInline(c.display)+" > "+App.i18n.translateInline(e.display),content:n})}if(Object.keys(App[c.object].allowedReplaceTagsFunctionMapping).length>0)for(P=0,k=(z=Object.values(App[c.object].allowedReplaceTagsFunctionMapping)).length;P<k;P++)r=z[P],D="#{"+c.prefix+"."+r.placeholder_content+"}",n="#{"+c.prefix+"."+r.placeholder_content+"}",t.push({id:D,keywords:D,name:App.i18n.translateInline(c.display)+" > "+App.i18n.translateInline(r.placeholder_display),content:n})}for(J=[{display:__("Last Article"),name:"last_article"},{display:__("Last Internal Article"),name:"last_internal_article"},{display:__("Last External Article"),name:"last_external_article"},{display:__("Created Article"),name:"created_article"},{display:__("Created Internal Article"),name:"created_internal_article"},{display:__("Created External Article"),name:"created_external_article"}],E=0,A=t.length;E<A;E++)if((c=t[E]).name.startsWith("Article"))for(I=0,C=J.length;I<C;I++)H=J[I],t.push({name:c.name.replace("Article",App.i18n.translateInline(H.display)),content:c.content.replace("article",H.name),id:c.id.replace("article",H.name),keywords:c.keywords.replace("article",H.name)});for(t=_.filter(t,(function(t){return!t.name.startsWith("Article")})),O=0,T=(U=App.Setting.all()).length;O<T;O++)(K=U[O]).frontend&&K.preferences&&K.preferences.placeholder&&(D=App.i18n.translateInline("Config")+" > "+App.i18n.translateInline(K.title),n="#{config."+K.name+"}",t.push({id:K.name,keywords:K.name,name:D,content:n}));if(this.bindElements[0]){for(V=[],G=0,g=(q=this.bindElements).length;G<g;G++)s=q[G],$(s).data().plugin_textmodule?V.push($(s).data().plugin_textmodule.collection=t):V.push(void 0);return V}},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.PreviewList=function(n){function i(){this.render=t(this.render,this),this.hide=t(this.hide,this),this.show=t(this.show,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.orderBy=null,i.prototype.orderDirection=null,i.prototype.show=function(){if(this.table)return this.table.show()},i.prototype.hide=function(){if(this.table)return this.table.hide()},i.prototype.render=function(){var t,e,n,i,s,r,o,a;for(a=this,function(t){var e;return a.navigate(null!=(e=App[a.object_name].findNative(t))?e.uiUrl():void 0)},t={login:[e=function(t,e,n){return n.link=e.uiUrl(),t}],name:[e]},s=[],n=0,i=(o=this.object_ids).length;n<i;n++)r=o[n],s.push(App[this.object_name].fullLocal(r));return this.el.html(""),this.table=new App.ControllerTable({tableId:this.tableId,el:this.el,overview:App[this.object_name].configure_preview,model:App[this.object_name],objects:s,checkbox:this.checkbox,orderBy:this.orderBy,orderDirection:this.orderDirection,callbackAttributes:t,bindCheckbox:this.bindCheckbox,radio:this.radio,sortClickCallback:this.sortClickCallback,clone:!1})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SessionMessage=function(n){function i(){return this.onSubmit=t(this.onSubmit,this),this.onClose=t(this.onClose,this),this.onCancel=t(this.onCancel,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.showTrySupport=!0,i.prototype.onCancel=function(t){if(this.forceReload)return this.windowReload(t)},i.prototype.onClose=function(t){if(this.forceReload)return this.windowReload(t)},i.prototype.onSubmit=function(t){return this.forceReload?this.windowReload(t):this.close()},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetSharedDraft=function(n){function i(){this.release=t(this.release,this),this.success=t(this.success,this),this.load=t(this.load,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.load(),this.subscribeId=App.TicketSharedDraftStart.subscribe(this.render),this.render()}return e(i,n),i.prototype.events={"click .shared-draft-item":"clicked","click .js-create":"create","click .js-update":"update","input #shared_draft_name":"sharedDraftNameChanged"},i.prototype.elements={"#shared_draft_name":"sharedDraftNameInput"},i.prototype.render=function(){var t;return t=App.TicketSharedDraftStart.find(this.active_draft_id),this.html(App.view("widget/shared_draft")({shared_drafts:this.visibleDrafts(),active_draft:t}))},i.prototype.load=function(){return this.ajax({id:"shared_drafts_index",type:"GET",url:this.apiPath+"/tickets/shared_drafts",processData:!0,success:(t=this,function(e){return App.TicketSharedDraftStart.deleteAll(),App.Collection.loadAssets(e.assets),t.render()})});var t},i.prototype.visibleDrafts=function(){return App.TicketSharedDraftStart.findAllByAttribute("group_id",parseInt(this.group_id))},i.prototype.clicked=function(t){var e,n,i;return i=t.currentTarget.getAttribute("shared-draft-id"),e=App.TicketSharedDraftStart.find(i),n=App.TaskManager.worker(this.taskKey).changed(),new App.TicketSharedDraftModal({container:this.el.closest(".content"),shared_draft:e,hasChanges:n,parent:this})},i.prototype.getParams=function(){var t,e,n;return t=this.formParam(this.el.closest(".content").find(".ticket-create")),n=this.formParam(this.el),e=t.form_id,delete t.form_id,""!==n.name.trim()&&(t.body=App.Utils.signatureRemoveByHtml(t.body),JSON.stringify({name:n.name,group_id:t.group_id,form_id:e,content:t}))},i.prototype.success=function(t){return App.Collection.loadAssets(t.assets),App.Event.trigger("ticket_create_shared_draft_saved",{shared_draft_id:t.shared_draft_id}),this.render()},i.prototype.highlightError=function(){return this.sharedDraftNameInput.addClass("has-error").focus(),!1},i.prototype.sharedDraftNameChanged=function(){return this.sharedDraftNameInput.removeClass("has-error")},i.prototype.create=function(t){return this.onAction(t,{id:"shared_drafts_create",type:"POST",url:this.apiPath+"/tickets/shared_drafts"})},i.prototype.update=function(t){return this.onAction(t,{id:"shared_drafts_update",type:"PATCH",url:this.apiPath+"/tickets/shared_drafts/"+this.active_draft_id})},i.prototype.onAction=function(t,e){var n;return t.preventDefault(),(n=this.getParams())?this.ajax(_.extend(e,{data:n,success:this.success})):this.highlightError()},i.prototype.release=function(){return this.subscribeId&&App.TicketSharedDraftStart.unsubscribe(this.subscribeId),i.__super__.release.apply(this,arguments)},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.Sidebar=function(i){function s(){var t;this.toggleTabAction=e(this.toggleTabAction,this),this.toggleTab=e(this.toggleTab,this),this.showSidebar=e(this.showSidebar,this),this.toggleSidebar=e(this.toggleSidebar,this),this.badgeRenderLocal=e(this.badgeRenderLocal,this),this.badgeRender=e(this.badgeRender,this),this.render=e(this.render,this),s.__super__.constructor.apply(this,arguments),this.render(),this.name&&(t=this.name),!t&&this.sidebarState&&(t=this.sidebarState.active),t||(t=this.tabs.first().data("tab")),this.toggleTabAction(t)}return n(s,i),s.prototype.elements={".tabsSidebar-tab":"tabs",".sidebar":"sidebars"},s.prototype.events={"click .tabsSidebar-tab":"toggleTab","click .tabsSidebar-close":"toggleSidebar","click .sidebar-header .js-headline":"toggleDropdown"},s.prototype.render=function(){var e,n,i,s,r,o,a,l,c,u,p,h;for(r=[],n=0,l=(h=this.items).length;n<l;n++)(s=(i=h[n]).sidebarItem())&&r.push(s);for(p=$(App.view("generic/sidebar_tabs")({items:r,scrollbarWidth:App.Utils.getScrollBarWidth(),dir:App.i18n.dir()})),o=0,c=r.length;o<c;o++)i=r[o],e=p.find('.tabsSidebar-tab[data-tab="'+i.name+'"]'),i.badgeCallback?i.badgeCallback(e):this.badgeRender(e,i);for(a=0,u=r.length;a<u;a++)(i=r[a]).sidebarCallback&&(e=p.filter('.sidebar[data-tab="'+i.name+'"]'),i.sidebarCallback(e.find(".sidebar-content")),_.isEmpty(i.sidebarActions)||new t({el:e.find(".js-actions"),items:i.sidebarActions,type:"small"}));return this.html(p)},s.prototype.badgeRender=function(t,e){return this.badgeEl=t,this.badgeRenderLocal(e)},s.prototype.badgeRenderLocal=function(t){return this.badgeEl.html(App.view("generic/sidebar_tabs_item")({icon:t.badgeIcon}))},s.prototype.toggleDropdown=function(t){return t.stopPropagation(),$(t.currentTarget).next(".js-actions").find(".dropdown-toggle").dropdown("toggle")},s.prototype.toggleSidebar=function(){return this.el.parent().find(".tabsSidebar-sidebarSpacer").toggleClass("is-closed"),this.el.filter(".tabsSidebar").toggleClass("is-closed")},s.prototype.showSidebar=function(){return this.el.parent().find(".tabsSidebar-sidebarSpacer").removeClass("is-closed"),this.el.filter(".tabsSidebar").removeClass("is-closed")},s.prototype.toggleTab=function(t){var e;if(e=$(t.target).closest(".tabsSidebar-tab").data("tab"))return e===this.currentTab?this.toggleSidebar():this.toggleTabAction(e)},s.prototype.toggleTabAction=function(t){var e,n,i,s,r,o,a;if(t){for(this.tabs.removeClass("active"),"shared_draft"===t&&(n=_.find(this.items,(function(t){var e;return"shared_draft"===(null!=t&&null!=(e=t.item)?e.name:void 0)&&null!=t.sidebarItem()})),null==n&&(t="template",null!=(e=_.first(this.items,(function(t){return null!=t.sidebarItem()})))&&(e.shown=!0))),this.sidebarState&&(this.sidebarState.active=t),this.$(".tabsSidebar-tab[data-tab="+t+"]").addClass("active"),this.sidebars.addClass("hide"),this.$(".sidebar[data-tab="+t+"]").removeClass("hide"),this.currentTab=t,i=0,o=(a=this.items).length;i<o;i++)(r=(s=a[i]).sidebarItem())&&r.name&&r.name===this.currentTab&&s.shown&&s.shown();return this.showSidebar()}},s}(App.Controller),t=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.render()}return n(e,t),e.prototype.render=function(){var t,e,n,i,s;for(this.html(App.view("generic/actions")({items:this.items,type:this.type})),s=[],t=0,n=(i=this.items).length;t<n;t++)e=i[t],s.push(function(t){return function(e){return t.$('[data-type="'+e.name+'"]').on("click",(function(t){return t.preventDefault(),e.callback()}))}}(this)(e));return s},e}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetTag=function(n){function i(){if(this.remove=t(this.remove,this),this.onRemoveTag=t(this.onRemoveTag,this),this.addItem=t(this.addItem,this),this.add=t(this.add,this),this.onAddTag=t(this.onAddTag,this),this.hideAndAddInput=t(this.hideAndAddInput,this),this.showInput=t(this.showInput,this),this.render=t(this.render,this),this.reload=t(this.reload,this),this.fetch=t(this.fetch,this),this.addInput=t(this.addInput,this),i.__super__.constructor.apply(this,arguments),this.key="tags::"+this.object_type+"::"+this.object.id,this.tags)return this.localTags=_.clone(this.tags),void this.render();this.fetch()}return e(i,n),i.prototype.editMode=!1,i.prototype.pendingRefresh=!1,i.prototype.possibleTags={},i.prototype.templateName="widget/tag",i.prototype.elements={".js-newTagLabel":"newTagLabel",".js-newTagInput":"newTagInput"},i.prototype.events={"click .js-newTagLabel":"showInput","blur .js-newTagInput":"hideAndAddInput","keyup .js-newTagInput":"addInput","submit form":"onAddTag","click .js-delete":"onRemoveTag","click .js-tag":"searchTag"},i.prototype.addInput=function(t){if(9===t.keyCode)return this.hideAndAddInput()},i.prototype.fetch=function(){return this.pendingRefresh=!1,App[this.object_type].tagGet(this.object.id,this.key,(t=this,function(e){return t.localTags=e.tags,t.render()}));var t},i.prototype.reload=function(t){if(!this.editMode)return this.localTags=_.clone(t),this.render();this.pendingRefresh=!0},i.prototype.render=function(){var t,e;if(!this.lastLocalTags||!_.isEqual(this.lastLocalTags,this.localTags))return this.lastLocalTags=_.clone(this.localTags),this.html(App.view(this.templateName)({tags:this.localTags||[],editable:this.editable})),t=App.Config.get("api_path")+"/tag_search",this.$(".js-newTagInput").autocomplete({source:t,minLength:0,response:(e=this,function(t,n){var i,s,r,o,a;if(n&&n.content){for(a=[],i=0,r=(o=n.content).length;i<r;i++)s=o[i],a.push(e.possibleTags[s.value]=!0);return a}})})},i.prototype.showInput=function(t){return t.preventDefault(),this.newTagLabel.addClass("hide"),this.newTagInput.removeClass("hide").trigger("focus"),this.newTagInput.trigger(jQuery.Event("keydown")),this.editMode=!0},i.prototype.hideAndAddInput=function(){return this.newTagLabel.removeClass("hide"),this.newTagInput.addClass("hide"),this.onAddTag(),this.editMode=!1},i.prototype.onAddTag=function(t){var e;if(t&&t.preventDefault(),e=this.$('[name="new_tag"]').val().trim())return this.add(e);this.pendingRefresh&&this.fetch()},i.prototype.add=function(t,e){var n,i,s,r,o;for(null==e&&(e=""),o=[],n=0,s=(r=t.split(",")).length;n<s;n++)i=(i=r[n]).trim(),o.push(this.addItem(i,e));return o},i.prototype.addItem=function(t,e){if(null==e&&(e=""),_.contains(this.localTags,t))this.render();else if("macro"===e||!1!==App.Config.get("tag_new")||this.possibleTags[t])return this.localTags.push(t),this.render(),App[this.object_type].tagAdd(this.object.id,t)},i.prototype.onRemoveTag=function(t){var e;if(t.preventDefault(),e=$(t.target).parents("li").find(".js-tag").text())return this.remove(e)},i.prototype.remove=function(t){return this.localTags=_.filter(this.localTags,(function(e){if(e!==t)return e})),this.render(),App[this.object_type].tagRemove(this.object.id,t)},i.prototype.searchTag=function(t){var e;return t.preventDefault(),e=$(t.target).text(),App.GlobalSearchWidget.search(e,"tags")},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetTemplate=function(n){function i(){this.select=t(this.select,this),this.rerenderNeeded=t(this.rerenderNeeded,this),this.render=t(this.render,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=App.Template.subscribe(this.render,{initFetch:!0})}return e(i,n),i.prototype.events={"submit form":"select"},i.prototype.release=function(){return App.Template.unsubscribe(this.subscribeId)},i.prototype.render=function(){var t;if(this.rerenderNeeded())return this.configure_attributes=[{name:"id",display:"",tag:"select",multiple:!1,null:!0,nulloption:!0,relation:"Template",default:this.id}],t={},this.id&&App.Template.exists(this.id)&&(t=App.Template.find(this.id)),this.html(App.view("widget/template")({template:t})),this.controller=new App.ControllerForm({el:this.el.find("#form-template"),model:{configure_attributes:this.configure_attributes},autofocus:!1}),0===App.Template.all().length?this.showWelcome():this.showSelect()},i.prototype.rerenderNeeded=function(){var t,e;return e=!0,(t=App.Template.lastUpdatedAt())&&t===this.lastUpdatedAt&&(e=!1),this.lastUpdatedAt=t,e},i.prototype.showSelect=function(t){return t&&t.preventDefault(),this.el.find(".templates-select").show(),this.el.find(".templates-welcome").hide()},i.prototype.showWelcome=function(t){var e;return t&&t.preventDefault(),this.el.find(".templates-select").hide(),this.el.find(".templates-welcome").show(),(null!=(e=App.User.current())?e.permission("admin.template"):void 0)?(this.el.find(".js-createLink").show(),this.el.find(".js-createTextOnly").hide()):(this.el.find(".js-createTextOnly").show(),this.el.find(".js-createLink").hide())},i.prototype.select=function(t){var e,n;if(t.preventDefault(),(e=this.formParam(t.target)).id)return this.id=e.id,n=App.Template.find(e.id),App.Event.trigger("ticket_create_rerender",n)},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.WidgetTextModule=function(n){function i(){var e;this.update=t(this.update,this),this.currentCollection=t(this.currentCollection,this),this.reload=t(this.reload,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.searchCondition=this.data.ticket||{},this.bindElements=[],this.selector?this.bindElements=this.$(this.selector).textmodule():this.el.attr("contenteditable")?this.bindElements=this.el.textmodule():this.bindElements=this.$("[contenteditable]").textmodule(),this.update(),this.subscribeId=App.TextModule.subscribe(this.update,{initFetch:!0}),this.controllerBind("TextModulePreconditionUpdate",(e=this,function(t){if(t.taskKey===e.taskKey)return e.searchCondition=t.params,e.update()}))}return e(i,n),i.prototype.searchCondition={},i.prototype.release=function(){return App.TextModule.unsubscribe(this.subscribeId)},i.prototype.reload=function(t){if(t)return this.data=t,this.searchCondition=this.data.ticket,this.update()},i.prototype.currentCollection=function(){return this.all},i.prototype.update=function(){var t,e,n,i,s,r,o,a,l,c;for(t=App.TextModule.all(),this.all=[],i=0,o=t.length;i<o;i++)!0===(s=t[i]).active&&(_.isEmpty(s.group_ids)||!this.searchCondition.group_id||_.includes(s.group_ids,parseInt(this.searchCondition.group_id)))&&((e=s.attributes()).content=App.Utils.replaceTags(e.content,this.data),this.all.push(e));if(this.bindElements[0]){for(c=[],r=0,a=(l=this.bindElements).length;r<a;r++)n=l[r],$(n).data().plugin_textmodule&&($(n).data().plugin_textmodule.searchCondition=this.searchCondition,c.push($(n).data().plugin_textmodule.collection=this.all));return c}},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketBatch=function(n){function i(){this.blinkBatchEntry=t(this.blinkBatchEntry,this),this.highlightBatchEntry=t(this.highlightBatchEntry,this),this.highlightBatchEntryAtMousePosition=t(this.highlightBatchEntryAtMousePosition,this),this.showBatchAssignGroup=t(this.showBatchAssignGroup,this),this.controlBatchOverlay=t(this.controlBatchOverlay,this),this.endDragItem=t(this.endDragItem,this),this.dragItem=t(this.dragItem,this),this.startDragItem=t(this.startDragItem,this),this.renderOptionsMacros=t(this.renderOptionsMacros,this),this.renderOptionsGroups=t(this.renderOptionsGroups,this),this.renderOptions=t(this.renderOptions,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.controllerBind("ui:rerender",this.render),this.render()}return e(i,n),i.requiredPermission="ticket.agent",i.prototype.mouse={x:null,y:null},i.prototype.batchAnimationPaused=!1,i.prototype.elements={".js-batch-overlay-backdrop":"batchOverlayBackdrop",".js-batch-cancel":"batchCancel",".js-batch-macro-circle":"batchMacroCircle",".js-batch-assign-circle":"batchAssignCircle",".js-batch-assign":"batchAssign",".js-batch-assign-inner":"batchAssignInner",".js-batch-assign-group":"batchAssignGroup",".js-batch-assign-group-name":"batchAssignGroupName",".js-batch-assign-group-inner":"batchAssignGroupInner",".js-batch-macro":"batchMacro"},i.prototype.events={"mouseenter .js-batch-hover-target":"highlightBatchEntry","mouseleave .js-batch-hover-target":"unhighlightBatchEntry"},i.prototype.render=function(){return this.html(App.view("ticket_overview/batch_overlay")()),this.parentEl.off("mousedown.TicketBatch").on("mousedown.TicketBatch",".item",this.startDragItem)},i.prototype.renderOptions=function(){return this.renderOptionsGroups(),this.renderOptionsMacros()},i.prototype.renderOptionsGroups=function(){return this.batchAssignInner.html($(App.view("ticket_overview/batch_overlay_user_group")(this.parent.validUsersForTicketSelection())))},i.prototype.renderOptionsMacros=function(){var t,e,n;if(e=this.parentEl.find('[name="bulk"]:checked').toArray().map((function(t){return App.Ticket.find(t.value).group_id})),n=App.User.current().allGroupIds("change").map((function(t){return parseInt(t)})),_.isEmpty(_.difference(e,n))){if(t=App.Macro.getList().filter((function(t){return _.isEmpty(t.group_ids)||_.isEmpty(_.difference(e,t.group_ids))})),!_.isEmpty(t))return this.batchMacro.html($(App.view("ticket_overview/batch_overlay_macro")({macros:t})));this.batchMacro.html($(App.view("ticket_overview/batch_overlay_macro")({errorMessage:__("Selected tickets do not match any macros.")})))}else this.batchMacro.html($(App.view("ticket_overview/batch_overlay_macro")({errorMessage:__("You have no change permission or you are a customer for some of the selected tickets.")})))},i.prototype.startDragItem=function(t){var e;return t.preventDefault(),this.grabbedItem=$(t.currentTarget),e=this.grabbedItem.offset(),this.batchDragger=$(App.view("ticket_overview/batch_dragger")()),this.grabbedItemClone=this.grabbedItem.clone(),this.grabbedItemClone.data("offset",this.grabbedItem.offset()),this.grabbedItemClone.addClass("batch-dragger-item js-main-item"),this.batchDragger.append(this.grabbedItemClone),this.batchDragger.data({startX:t.pageX,startY:t.pageY,dx:Math.min(t.pageX-e.left,180),dy:t.pageY-e.top,moved:!1}),$(document).on("mousemove.item",this.dragItem),$(document).one("mouseup.item",this.endDragItem)},i.prototype.dragItem=function(t){var e,n,i,s,r,o,a;if(s=this.batchDragger.data(),r=3,o=t.pageX-s.dx,a=t.pageY-s.dy,i=t.pageY>s.startY?1:-1,!s.moved){if(!(Math.abs(t.pageY-s.startY)>r||Math.abs(t.pageX-s.startX)>r))return;this.batchDragger.data("moved",!0),this.el.addClass("u-no-userselect"),this.grabbedItemWasntChecked=!this.grabbedItem.find('[name="bulk"]').prop("checked"),
this.grabbedItem.find('[name="bulk"]').prop("checked",!0),this.grabbedItemClone.find('[name="bulk"]').prop("checked",!0),n=(e=this.el.find('[name="bulk"]:checked').parents(".item").not(this.grabbedItem)).clone(),this.draggedItems=this.grabbedItemClone.add(n),n.each((function(t){return $(this).data("offset",e.eq(t).offset())})),this.batchDragger.prepend(n.addClass("batch-dragger-item").get().reverse()),n.length&&this.batchDragger.find(".js-batch-dragger-count").text(this.draggedItems.length),this.renderOptions(),this.appEl.append(this.batchDragger),this.draggedItems.each((function(t,e){var n,i;return n=$(e).data("offset").left-$(e).offset().left-o,i=$(e).data("offset").top-$(e).offset().top-a,$.Velocity.hook(e,"translateX",n+"px"),$.Velocity.hook(e,"translateY",i+"px")})),this.alignDraggedItems(-i),this.mouseY=t.pageY,this.showBatchOverlay()}return t.preventDefault(),$.Velocity.hook(this.batchDragger,"translateX",o+"px"),$.Velocity.hook(this.batchDragger,"translateY",a+"px")},i.prototype.endDragItem=function(){var t,e;if($(document).off("mousemove.item"),$(document).off("mouseup.item"),t=this.batchDragger.data(),this.clearDelay("clear-hovered-batch-entry"),this.hoveredBatchEntry)return $.Velocity.hook(this.batchDragger,"transformOriginX",t.dx+"px"),$.Velocity.hook(this.batchDragger,"transformOriginY",t.dy+"px"),this.hoveredBatchEntry.velocity({properties:{scale:1.1},options:{duration:200,complete:(e=this,function(){if(e.hoveredBatchEntry)return e.hoveredBatchEntry.velocity("reverse",{duration:200,complete:function(){var t,n,i,s;if(e.hoveredBatchEntry)return t=e.hoveredBatchEntry.attr("data-action"),i=e.hoveredBatchEntry.attr("data-id"),n=e.hoveredBatchEntry.attr("data-group-id"),s=e.parentEl.find('[name="bulk"]:checked'),e.hoveredBatchEntry.removeAttr("style"),e.cleanUpDrag(!0),e.performBatchAction(s,t,i,n);e.cleanUpDrag()}});e.cleanUpDrag()})}}),this.batchDragger.velocity({properties:{scale:0},options:{duration:200}});this.cleanUpDrag()},i.prototype.cancelDrag=function(){return $(document).off("mousemove.item"),$(document).off("mouseup.item"),this.cleanUpDrag()},i.prototype.cleanUpDrag=function(t){if(this.hideBatchOverlay(),this.el.removeClass("u-no-userselect"),$(".batch-dragger").remove(),this.hoveredBatchEntry=null,this.grabbedItemWasntChecked&&this.grabbedItem.find('[name="bulk"]').prop("checked",!1),t)return this.el.find('[name="bulk"]:checked').prop("checked",!1),this.el.find('[name="bulk_all"]').prop("checked",!1)},i.prototype.alignDraggedItems=function(t){var e;return this.draggedItems.velocity({properties:{translateX:0,translateY:(e=this,function(n){return t*n*e.batchDragger.height()/2})},options:{easing:"ease-in-out",duration:300}}),this.batchDragger.find(".js-batch-dragger-count").velocity({properties:{translateY:t<0?0:8-this.batchDragger.height()},options:{easing:"ease-in-out",duration:300}})},i.prototype.performBatchAction=function(t,e,n,i){var s,r,o;switch(o=t.toArray().map((function(t){return $(t).val()})),e){case"macro":r="macro",s={ticket_ids:o,macro_id:n};break;case"user_assign":r="update",s={ticket_ids:o,attributes:{owner_id:n}},_.isEmpty(i)||(s.attributes.group_id=i);break;case"group_assign":r="update",s={ticket_ids:o,attributes:{group_id:n}}}return this.parent.ajax_mass(r,s,this.batchSuccess)},i.prototype.showBatchOverlay=function(){return this.el.addClass("is-visible"),$("html").css("overflow","hidden"),this.batchOverlayBackdrop.velocity({opacity:[1,0]},{duration:500}),this.batchMacroOffset=this.batchMacro.offset().top+this.batchMacro.outerHeight(),this.batchAssignOffset=this.batchAssign.offset().top,this.batchOverlayShown=!0,$(document).on("mousemove.batchoverlay",this.controlBatchOverlay)},i.prototype.hideBatchOverlay=function(){var t;if($(document).off("mousemove.batchoverlay"),this.batchOverlayShown=!1,this.batchOverlayBackdrop.velocity({opacity:[0,1]},{duration:300,queue:!1}),this.hideBatchCircles((t=this,function(){return t.el.removeClass("is-visible")})),$("html").css("overflow",""),this.batchAssignShown&&this.hideBatchAssign(),this.batchMacroShown&&this.hideBatchMacro(),this.batchAssignGroupShown)return this.hideBatchAssignGroup()},i.prototype.controlBatchOverlay=function(t){if(!this.batchAnimationPaused)if(this.mouse.x=t.pageX,this.mouse.y=t.pageY,this.batchAssignGroupShown&&void 0!==this.batchAssignGroupOffset)this.mouse.y<this.batchAssignGroupOffset&&(this.hideBatchAssignGroup(),this.batchAnimationPaused=!0);else switch(this.mouse.y<=this.batchMacroOffset?"top":this.mouse.y>this.batchMacroOffset&&this.mouse.y<=this.batchAssignOffset?"middle":"bottom"){case"top":if(!this.batchMacroShown)return this.hideBatchCircles(),this.showBatchMacro(),this.alignDraggedItems(1);break;case"middle":if(this.batchAssignShown&&this.hideBatchAssign(),this.batchMacroShown&&this.hideBatchMacro(),!this.batchCirclesShown)return this.showBatchCircles();break;case"bottom":if(!this.batchAssignShown)return this.hideBatchCircles(),this.showBatchAssign(),this.alignDraggedItems(-1)}},i.prototype.showBatchCircles=function(){return this.batchCirclesShown=!0,this.batchMacroCircle.velocity({properties:{translateY:[0,"-150%"],opacity:[1,0]},options:{easing:[1,-.55,.2,1.37],duration:500,visibility:"visible",delay:200}}),this.batchAssignCircle.velocity({properties:{translateY:[0,"150%"],opacity:[1,0]},options:{easing:[1,-.55,.2,1.37],duration:500,visibility:"visible",delay:200}})},i.prototype.hideBatchCircles=function(t){return this.batchMacroCircle.velocity({properties:{translateY:["-150%",0],opacity:[0,1]},options:{duration:300,visibility:"hidden",queue:!1}}),this.batchAssignCircle.velocity({properties:{translateY:["150%",0],opacity:[0,1]},options:{duration:300,complete:t,visibility:"hidden",queue:!1}}),this.batchCirclesShown=!1},i.prototype.showBatchAssign=function(){if(this.batchOverlayShown)return this.batchAssignShown=!0,this.batchCancel.css({top:0,bottom:this.batchAssign.height()}),this.batchAssign.velocity({properties:{translateY:[0,"100%"],opacity:[1,0]},options:{easing:[1,-.55,.2,1.37],duration:500,visibility:"visible",complete:this.highlightBatchEntryAtMousePosition}}),this.batchCancel.velocity({properties:{translateY:[0,"100%"],opacity:[1,0]},options:{easing:[1,-.55,.2,1.37],duration:500,visibility:"visible"}})},i.prototype.hideBatchAssign=function(){var t;return this.batchAssign.velocity({properties:{translateY:["100%",0],opacity:[0,1]},options:{duration:300,visibility:"hidden",queue:!1,complete:(t=this,function(){return $.Velocity.hook(t.batchAssign,"translateY","0%")})}}),this.batchCancel.velocity({properties:{translateY:["100%",0],opacity:[0,1]},options:{duration:300,visibility:"hidden",queue:!1}}),this.batchAssignShown=!1},i.prototype.showBatchAssignGroup=function(){var t,e,n;if(this.batchOverlayShown)return this.batchAssignGroupShown=!0,e=this.hoveredBatchEntry.attr("data-id"),t=App.Group.find(e),this.batchAssignGroupName.text(t.displayName()),this.batchAssignGroupInner.html($(App.view("ticket_overview/batch_overlay_user_group")({users:this.parent.usersInGroups([e]),groups:[],groupId:e}))),this.batchAssignGroupInner.height(this.batchAssignInner.height()),this.batchAssignGroup.velocity({properties:{translateY:[0,"100%"],opacity:[1,0]},options:{easing:[1,-.55,.2,1.37],duration:700,visibility:"visible",complete:(n=this,function(){return n.highlightBatchEntryAtMousePosition(),n.batchAssignGroupOffset=n.batchAssignGroup.offset().top})}})},i.prototype.hideBatchAssignGroup=function(){var t;return this.batchAssignGroup.velocity({properties:{translateY:["100%",0],opacity:[0,1]},options:{duration:300,visibility:"hidden",queue:!1,complete:(t=this,function(){return t.batchAssignGroupShown=!1,t.batchAssignGroupHovered=!1,setTimeout((function(){return t.batchAnimationPaused=!1}),1e3)})}}),this.batchAssignGroupOffset=void 0},i.prototype.showBatchMacro=function(){if(this.batchOverlayShown)return this.batchMacroShown=!0,this.batchCancel.css({bottom:0,top:this.batchMacro.height()}),this.batchMacro.velocity({properties:{translateY:[0,"-100%"],opacity:[1,0]},options:{easing:[1,-.55,.2,1.37],duration:500,visibility:"visible",complete:this.highlightBatchEntryAtMousePosition}}),this.batchCancel.velocity({properties:{translateY:[0,"-100%"],opacity:[1,0]},options:{easing:[1,-.55,.2,1.37],duration:500,visibility:"visible"}})},i.prototype.hideBatchMacro=function(){var t;return this.batchMacro.velocity({properties:{translateY:["-100%",0],opacity:[0,1]},options:{duration:300,visibility:"hidden",queue:!1,complete:(t=this,function(){return $.Velocity.hook(t.batchMacro,"translateY","0%")})}}),this.batchCancel.velocity({properties:{translateY:["-100%",0],opacity:[0,1]},options:{duration:300,visibility:"hidden",queue:!1}}),this.batchMacroShown=!1},i.prototype.highlightBatchEntryAtMousePosition=function(){var t;if((t=$(document.elementFromPoint(this.mouse.x,this.mouse.y)).closest(".js-batch-overlay-entry .avatar")).length)return this.hoveredBatchEntry=t.closest(".js-batch-overlay-entry").addClass("is-hovered")},i.prototype.highlightBatchEntry=function(t){if(this.clearDelay("clear-hovered-batch-entry"),this.hoveredBatchEntry=$(t.currentTarget).closest(".js-batch-overlay-entry").addClass("is-hovered"),"group_assign"===this.hoveredBatchEntry.attr("data-action"))return this.batchAssignGroupHintTimeout=setTimeout(this.blinkBatchEntry,800),this.batchAssignGroupTimeout=setTimeout(this.showBatchAssignGroup,900)},i.prototype.unhighlightBatchEntry=function(){var t,e;if(this.hoveredBatchEntry)return"group_assign"===this.hoveredBatchEntry.attr("data-action")&&(this.batchAssignGroupTimeout&&clearTimeout(this.batchAssignGroupTimeout),this.batchAssignGroupHintTimeout&&clearTimeout(this.batchAssignGroupHintTimeout)),this.hoveredBatchEntry.removeClass("is-hovered"),e=this,t=function(){return e.hoveredBatchEntry=null},this.delay(t,800,"clear-hovered-batch-entry")},i.prototype.blinkBatchEntry=function(){return this.hoveredBatchEntry.velocity({opacity:[.5,1]},{duration:120}).velocity({opacity:[1,.5]},{duration:60,delay:40}).velocity({opacity:[.5,1]},{duration:120}).velocity({opacity:[1,.5]},{duration:60,delay:40})},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketBulkForm=function(n){function i(){var e,n,s,r,o,a,l,c;if(this.submit=t(this.submit,this),this.removeSpaceForTableRows=t(this.removeSpaceForTableRows,this),this.makeSpaceForTableRows=t(this.makeSpaceForTableRows,this),this.hide=t(this.hide,this),this.show=t(this.show,this),this.cancel=t(this.cancel,this),this.reset=t(this.reset,this),this.confirm=t(this.confirm,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.permissionCheck("ticket.agent")){for(n in this.configure_attributes_ticket=[],c=["state_id","pending_time","priority_id","group_id","owner_id"],s=App.Ticket.attributesGet("edit"))e=s[n],_.contains(c,n)&&((o=clone(e)).nulloption=!0,o.default="",o.null=!0,"group_id"===o.name&&(o.direction="up"),this.configure_attributes_ticket.push(o));var u;a={name:"ticket_ids",display:!1,tag:"input",type:"hidden",limit:100,null:!1},this.configure_attributes_ticket.push(a),(l=_.findWhere(this.configure_attributes_ticket,{name:"pending_time"}))&&(l.orientation="top",l.disableScroll=!0),this.holder=this.options.holder,this.visible=!1,u=this,r=function(t){return App.Collection.loadAssets(t.assets),u.formMeta=t.form_meta,u.render()},this.bindId=App.TicketOverviewCollection.bind(r)}}return e(i,n),i.extend(App.TicketMassUpdatable),i.prototype.className="bulkAction hide",i.prototype.events={"submit form":"submit","click .js-submit":"submit","click .js-confirm":"confirm","click .js-cancel":"reset"},i.include(App.ValidUsersForTicketSelectionMethods),i.prototype.release=function(){return App.TicketOverviewCollection.unbind(this.bindId)},i.prototype.render=function(){var t;return this.el.css("right",App.Utils.getScrollBarWidth()),this.noSidebar&&this.el.addClass("no-sidebar"),this.html(App.view("agent_ticket_view/bulk")()),t=this.Config.get("TicketZoomFormHandler"),this.controllerFormBulk=new App.ControllerForm({el:this.$("#form-ticket-bulk"),model:{configure_attributes:this.configure_attributes_ticket,className:"Ticket",labelClass:"input-group-addon"},screen:"overview_bulk",handlersConfig:t,params:{},filter:this.formMeta.filter,formMeta:this.formMeta,noFieldset:!0}),this.controllerFormBulk.$('[data-attribute-name="group_id"] .controls').addClass("form-control"),new App.ControllerForm({el:this.$("#form-ticket-bulk-comment"),model:{configure_attributes:[{name:"body",display:__("Comment"),tag:"textarea",rows:4,null:!0,upload:!1,item_class:"flex"}],className:"Ticket",labelClass:"input-group-addon"},screen:"overview_bulk_comment",noFieldset:!0}),this.confirm_attributes=[{name:"type_id",display:__("Type"),tag:"select",multiple:!1,null:!0,relation:"TicketArticleType",filter:this.articleTypeFilter,default:"9",translate:!0,class:"medium"},{name:"internal",display:__("Visibility"),tag:"select",null:!0,options:{true:"internal",false:"public"},class:"medium",item_class:"",default:!1,translate:!0}],new App.ControllerForm({el:this.$("#form-ticket-bulk-typeVisibility"),model:{configure_attributes:this.confirm_attributes,className:"Ticket",labelClass:"input-group-addon"},screen:"overview_bulk_visibility",noFieldset:!0})},i.prototype.articleTypeFilter=function(t){var e,n,i;for(e=0,i=t.length;e<i;e++)if("note"===(n=t[e]).name)return[n];return t},i.prototype.confirm=function(){return this.$(".js-action-step").addClass("hide"),this.$(".js-confirm-step").removeClass("hide"),this.makeSpaceForTableRows(),setTimeout((t=this,function(){return t.$(".textarea.form-group textarea").trigger("focus")}),0);var t},i.prototype.reset=function(){if(this.cancel(),this.visible)return this.makeSpaceForTableRows()},i.prototype.cancel=function(){return this.$(".js-action-step").removeClass("hide"),this.$(".js-confirm-step").addClass("hide")},i.prototype.show=function(){return this.el.removeClass("hide"),this.visible=!0,this.makeSpaceForTableRows()},i.prototype.hide=function(){return this.el.addClass("hide"),this.visible=!1,this.removeSpaceForTableRows()},i.prototype.makeSpaceForTableRows=function(){var t,e,n;if(t=this.el.height(),e=(n=this.holder.scrollParent()).prop("scrollHeight")===n.scrollTop()+n.outerHeight(),this.holder.css("margin-bottom",t),e)return n.scrollTop(n.prop("scrollHeight")-n.outerHeight())},i.prototype.removeSpaceForTableRows=function(){return this.holder.css("margin-bottom",0)},i.prototype.ticketMergeParams=function(t){var e,n;for(e in n={},t)""!==t[e]&&null!==t[e]&&(n[e]=t[e]);return""!==t.group_id&&null!==t.group_id&&(n.owner_id=t.owner_id),n},i.prototype.submit=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f;if(t.preventDefault(),this.bulkCount=this.holder.find(".table").find('[name="bulk"]:checked').length,0!==this.bulkCount){for(o in d=[],this.holder.find(".table").find('[name="bulk"]:checked').each((function(t,e){var n;return n=$(e).val(),d.push(n)})),l=this.formParam(t.target))""!==(f=l[o])&&null!==f||delete l[o];for(r=0,a=d.length;r<a;r++)if(h=d[r],u=App.Ticket.find(h),p=this.ticketMergeParams(l),u.load(p),_.isEmpty(u.title)&&(u.title="-"),s=u.validate({controllerForm:this.controllerFormBulk})){for(o in this.log("error","update",s),i="",s)i+=o+": "+s[o];return this.formValidate({form:t.target,errors:s,screen:"edit"}),App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent("Bulk action stopped by error(s): %s!",i)}),void this.cancel()}return l.body&&(e=new App.TicketArticle,l.from=this.Session.get().displayName(),l.form_id=this.form_id,c=App.TicketArticleSender.findByAttribute("name","Agent"),App.TicketArticleType.find(l.type_id),l.sender_id=c.id,l.internal||(l.internal=!1),this.log("notice","update article",l,c),e.load(l),s=e.validate())?(this.log("error","update article",s),void this.formEnable(t)):(n={ticket_ids:d,attributes:l,article:null!=e?e.attributes():void 0},this.ajax_mass_update(n,(m=this,function(){return m.holder.find(".table").find('[name="bulk"]:checked').prop("checked",!1),m.batchSuccess(),m.hide()})));var m}App.Event.trigger("notify",{type:"error",msg:App.i18n.translateContent("At least one object must be selected.")})},i.prototype.updateTicketIdsBulkForm=function(t){var e,n;return e=$(t.target).closest("table").find('input[name="bulk"]:checked'),n=_.map(e,(function(t){return $(t).val()})),this.el.find("input[name=ticket_ids]").val(n.join(",")).trigger("change")},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketList=function(n){function i(){this.render=t(this.render,this),this.hide=t(this.hide,this),this.show=t(this.show,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("Organization","User"),i.prototype.orderBy=null,i.prototype.orderDirection=null,i.prototype.show=function(){if(this.table)return this.table.show()},i.prototype.hide=function(){if(this.table)return this.table.hide()},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d,f;for(f=this,function(t){var e;return e=App.Ticket.findNative(t),f.navigate(e.uiUrl())},s=function(t){var e;return e={name:"icon_priority",display:"",translation:!1,width:"22px",displayWidth:22,unresizable:!0},t.unshift(0),t[0]=e,t},i=function(t,e,n){var i;return" ",i=App.TicketPriority.findNative(e.priority_id),n.title=App.i18n.translateInline(null!=i?i.name:void 0),e.priorityIcon()},e=[n=function(t){var e;return e={name:"icon",display:"",parentClass:"noTruncate",translation:!1,width:"28px",displayWidth:28,unresizable:!0},t.unshift(0),t[0]=e,t}],t={icon:[function(t,e,n){return t=" ",n.class=e.iconClass(),n.link="",n.title=e.iconTitle(),t}],customer_id:[a=function(t,e,n){var i;return e?(i=void 0,"customer_id"===n.name&&(i=e.customer_id),"owner_id"===n.name&&(i=e.owner_id),i?(n.class="user-popover",n.data={id:i},t):t):t}],organization_id:[function(t,e,n){return e&&e.organization_id?(n.class="organization-popover",n.data={id:e.organization_id},t):t}],owner_id:[a],title:[r=function(t,e,n){return n.link=e.uiUrl(),t},o=function(t,e,n){return n.title=e.title,t}],number:[r,o]},!0===App.Config.get("ui_ticket_overview_priority_icon")&&(e=[n,s],t.icon_priority=[i]),u=[],l=0,c=(p=this.ticket_ids).length;l<c;l++)d=p[l],h=App.Ticket.fullLocal(d),u.push(h);return this.el.html(""),this.table=new App.ControllerTable({tableId:this.tableId,el:this.el,overview:this.columns||["number","title","customer","group","created_at"],model:App.Ticket,objects:u,checkbox:this.checkbox,orderBy:this.orderBy,orderDirection:this.orderDirection,callbackHeader:e,callbackAttributes:t,bindCheckbox:this.bindCheckbox,radio:this.radio,sortClickCallback:this.sortClickCallback}),this.renderPopovers()},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TicketStats=function(n){function i(){var e;(this.render=t(this.render,this),this.showUserTab=t(this.showUserTab,this),this.showOrgTab=t(this.showOrgTab,this),this.load=t(this.load,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.permissionCheck("ticket.agent"))&&(this.user?this.subscribeIdUser=App.User.full(this.user.id,this.load,!1,!0):this.organization&&(this.subscribeIdOrganization=App.Organization.full(this.organization.id,this.load,!1,!0)),this.controllerBind("ui:rerender",(e=this,function(){if(e.authenticateCheck())return e.render()})),this.controllerBind("Ticket:update",function(t){return function(e){var n,i,s,r,o,a,l,c,u;if(u=[],t.user?u=u.concat(null!=(s=t.data)&&null!=(r=s.user)?r.open_ids:void 0).concat(null!=(n=t.data)&&null!=(i=n.user)?i.closed_ids:void 0):t.organization&&(u=u.concat(null!=(l=t.data)&&null!=(c=l.organization)?c.open_ids:void 0).concat(null!=(o=t.data)&&null!=(a=o.organization)?a.closed_ids:void 0)),_.contains(u,e.id))return t.load()}}(this)))}return e(i,n),i.prototype.elements={".js-userTab":"userTabButton",".js-orgTab":"orgTabButton",".js-user":"userTab",".js-org":"orgTab"},i.prototype.events={"click .js-userTab":"showUserTab","click .js-orgTab":"showOrgTab"},i.prototype.release=function(){if(this.subscribeIdUser&&App.User.unsubscribe(this.subscribeIdUser),this.subscribeIdOrganization)return App.Organization.unsubscribe(this.subscribeIdOrganization)},i.prototype.load=function(t,e){var n,i,s;if(null==t&&(t=void 0),null==e&&(e=void 0),"change"!==e)return this.organization?(n="org_"+this.organization.id,i={organization_id:this.organization.id}):(n="user_"+this.user.id,i={user_id:this.user.id,organization_id:this.user.allOrganizationIds()}),this.ajax({id:"ticket_stats_"+n,type:"POST",url:this.apiPath+"/ticket_stats",data:JSON.stringify(i),processData:!0,success:(s=this,function(t){return App.Collection.loadAssets(t.assets),s.data=t,s.render(t)})})},i.prototype.showOrgTab=function(){return this.userTabButton.removeClass("active"),this.orgTabButton.addClass("active"),this.userTab.addClass("hide"),this.orgTab.removeClass("hide")},i.prototype.showUserTab=function(){return this.userTabButton.addClass("active"),this.orgTabButton.removeClass("active"),this.userTab.removeClass("hide"),this.orgTab.addClass("hide")},i.prototype.render=function(t){var e,n,i,s;if(t||(t=this.data),t)return s=0,t.user.open_ids&&t.user.closed_ids&&(s=t.user.open_ids.length+t.user.closed_ids.length),i=0,t.organization.open_ids&&t.organization.closed_ids&&(i=t.organization.open_ids.length+t.organization.closed_ids.length),this.html(App.view("widget/ticket_stats")({user:this.user,user_total:s,organization:this.organization,organization_total:i})),n=5,_.isEmpty(t.user)||(e="",0===t.user.open_ids.length&&t.user.closed_ids.length>0&&(e="mood icon supergood-color"),new App.TicketStatsList({el:this.$(".js-user-open-tickets"),user:this.user,head:__("Open Tickets"),iconClass:e,ticket_ids:t.user.open_ids,limit:n}),new App.TicketStatsList({el:this.$(".js-user-closed-tickets"),user:this.user,head:__("Closed Tickets"),ticket_ids:t.user.closed_ids,limit:n}),new App.TicketStatsFrequency({el:this.$(".js-user-frequency"),user:this.user,ticket_volume_by_year:t.user.volume_by_year})),_.isEmpty(t.organization)?void 0:(e="",0===t.organization.open_ids.length&&t.organization.closed_ids.length>0&&(e="mood icon supergood-color"),new App.TicketStatsList({el:this.$(".js-org-open-tickets"),user:this.user,head:__("Open Tickets"),iconClass:e,ticket_ids:t.organization.open_ids,limit:n}),new App.TicketStatsList({el:this.$(".js-org-closed-tickets"),user:this.user,head:__("Closed Tickets"),ticket_ids:t.organization.closed_ids,limit:n}),new App.TicketStatsFrequency({el:this.$(".js-org-frequency"),user:this.user,ticket_volume_by_year:t.organization.volume_by_year}))},i}(App.Controller),App.TicketStatsList=function(n){function i(){this.showAll=t(this.showAll,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.extend(App.PopoverProvidable),i.registerPopovers("Ticket"),i.prototype.events={"click .js-showAll":"showAll"},i.prototype.render=function(){var t,e,n,i,s,r,o,a;if(o=[],this.all)o=this.ticket_ids;else for(t=0,e=0,i=(s=this.ticket_ids).length;e<i;e++)r=s[e],(t+=1)<=this.limit&&o.push(r);return a=function(){var t,e,i;for(i=[],t=0,e=o.length;t<e;t++)n=o[t],i.push(App.Ticket.fullLocal(n));return i}(),this.html(App.view("widget/ticket_stats_list")({user:this.user,head:this.head,iconClass:this.iconClass,ticketList:App.view("generic/ticket_list")({tickets:a}),ticket_ids:this.ticket_ids,ticket_ids_show:o,limit:this.limit})),this.renderPopovers()},i.prototype.showAll=function(t){return t.preventDefault(),this.all=!0,this.render()},i}(App.Controller),App.TicketStatsFrequency=function(n){function i(){this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.render=function(){var t,e,n,i,s,r,o,a;for(r=0,t=0,i=(o=this.ticket_volume_by_year).length;t<i;t++)(e=o[t]).closed>r&&(r=e.closed),e.created>r&&(r=e.created);for(n=0,s=(a=this.ticket_volume_by_year).length;n<s;n++)(e=a[n]).created_in_percent=100/r*e.created,e.closed_in_percent=100/r*e.closed;return this.html(App.view("widget/ticket_stats_frequency")({ticket_volume_by_year:this.ticket_volume_by_year.reverse()}))},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TwoFactorConfigurationMethod=function(e){function n(t){var e;if(n.__super__.constructor.apply(this,arguments),e={container:t.container,successCallback:t.successCallback},"after_auth"===t.mode&&(this.passwordCheck=!1,e=_.extend({},e,{backdrop:"static",buttonClose:!1,buttonCancel:__("Go Back"),keyboard:!1,onCancel:function(){return new App.AfterAuthTwoFactorConfiguration({noFadeTransition:!0})}})),this.overrideHeadPrefix&&(e.overrideHeadPrefix=this.overrideHeadPrefix),this.passwordCheck)return new App.TwoFactorConfigurationModalPasswordCheck(_.extend({},e,{nextModalClass:this.methodModalClass}));new(this.methodModalClass())(_.extend({},e))}return t(n,e),n.prototype.passwordCheck=!0,n.prototype.overrideHeadPrefix=null,n.prototype.methodModalClass=function(){throw"You need to implement methodModalClass() method"},n}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TwoFactorConfigurationMethodAuthenticatorApp=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.methodModalClass=function(){return App.TwoFactorConfigurationModalAuthenticatorApp},n}(App.TwoFactorConfigurationMethod)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TwoFactorConfigurationMethodRecoveryCodes=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.methodModalClass=function(){return App.TwoFactorConfigurationModalRecoveryCodes},n}(App.TwoFactorConfigurationMethod)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TwoFactorConfigurationMethodSecurityKeys=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.methodModalClass=function(){return App.TwoFactorConfigurationModalSecurityKeys},n}(App.TwoFactorConfigurationMethod)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TwoFactorConfigurationModal=function(n){function i(e){this.finalizeConfigurationWizard=t(this.finalizeConfigurationWizard,this),this.next=t(this.next,this),this.closeWithFade=t(this.closeWithFade,this),e.overrideHeadPrefix&&(e.headPrefix=e.overrideHeadPrefix),i.__super__.constructor.call(this,e)}return e(i,n),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=__("Set Up"),i.prototype.buttonClass="btn--success",i.prototype.headPrefix=__("Set up two-factor authentication"),i.prototype.shown=!0,i.prototype.className="modal",i.prototype.closeWithFade=function(){return this.el.addClass("fade"),this.el.closest(".modal-backdrop").addClass("fade"),this.close()},i.prototype.nextModalClass=function(){throw"You need to implement nextModalClass() method"},i.prototype.next=function(t){return null==t&&(t={}),this.close(),t.container||(t.container=this.container),t.overrideHeadPrefix||(t.overrideHeadPrefix=this.overrideHeadPrefix),t.successCallback||(t.successCallback=this.successCallback),new(t.nextModalClass||this.nextModalClass())(_.extend({},t,{backdrop:this.backdrop,buttonClose:this.buttonClose,buttonCancel:this.buttonCancel,onCancel:this.onCancel}))},i.prototype.finalizeConfigurationWizard=function(t,e){var n;null==e&&(e={}),(n=null!=t?t.recovery_codes:void 0)?this.next(_.extend({},e,{prefetchedRecoveryCodes:n,nextModalClass:App.TwoFactorConfigurationModalRecoveryCodes})):(this.closeWithFade(),this.successCallback&&this.successCallback())},i.prototype.onSubmit=function(){if(this.notify({type:"success",msg:App.i18n.translateContent("Two-factor authentication method was set up successfully."),removeAll:!0}),this.successCallback)return this.successCallback()},i}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TwoFactorConfigurationModalAuthenticatorApp=function(n){function i(){this.onSubmit=t(this.onSubmit,this),this.fetchInitialConfiguration=t(this.fetchInitialConfiguration,this),this.method=App.Config.get("TwoFactorMethods").AuthenticatorApp,i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonSubmit=__("Set Up"),i.prototype.buttonClass="btn--success",i.prototype.head=__("Authenticator App"),i.prototype.content=function(){return!1},i.prototype.render=function(){var t,e;return i.__super__.render.apply(this,arguments),$(".modal .js-loading").removeClass("hide"),$(".modal .js-submit").prop("disabled",!0),e=this,t=function(t){var n,i,s,r;return e.config=t.configuration,i=$(App.view("widget/two_factor_configuration/authenticator_app")({config:e.config})),n=[{name:"payload",display:__("Security Code"),tag:"input",type:"text",limit:100,null:!1,class:"input",label_class:"hidden",placeholder:__("Security Code")}],e.payloadForm=new App.ControllerForm({el:i.find(".js-payload-form"),model:{configure_attributes:n}}),r=i.find(".js-qr-code-canvas"),s=qrcodegen.QrCode.encodeText(e.config.provisioning_uri,qrcodegen.QrCode.Ecc.MEDIUM),e.drawCanvas(s,6,1,"white","black",r.get(0)),r.on("click.authenticator_app",(function(){return i.find(".js-secret").show().on("click.authenticator_app",(function(){return $(this).hide()}))})),$(".modal .js-loading").addClass("hide"),$(".modal-body").html(i),$(".modal .js-submit").prop("disabled",!1),$('.modal input[name="payload"]').focus()},this.fetchInitialConfiguration(t)},i.prototype.fetchInitialConfiguration=function(t){return this.ajax({id:"two_factor_authentication_method_initiate_configuration",type:"GET",url:this.apiPath+"/users/two_factor_authentication_method_initiate_configuration/"+this.method.key,success:t})},i.prototype.onSubmit=function(t){var e,n,i,s;return i=this.formParam(t.target),n=this.payloadForm.validate(i),_.isEmpty(n)?(e=JSON.stringify({method:this.method.key,payload:i.payload,configuration:this.config}),this.formDisable(t),this.ajax({id:"two_factor_verify_configuration",type:"POST",url:this.apiPath+"/users/two_factor_verify_configuration",data:e,processData:!0,success:(s=this,function(e){if(!(null!=e?e.verified:void 0))return s.formValidate({form:t.target,errors:{payload:__("Invalid security code! Please try again with a new code.")}}),s.formEnable(t);s.finalizeConfigurationWizard(e)})})):(this.formValidate({form:t.target,errors:n}),!1)},i.prototype.drawCanvas=function(t,e,n,i,s,r){var o,a,l,c,u,p,h,d;if(e<=0||n<0)throw new RangeError("Value out of range");for(p=(t.size+2*n)*e,r.width=p,r.height=p,o=r.getContext("2d"),u=[],d=a=l=-n,c=t.size+n;l<=c?a<=c:a>=c;d=l<=c?++a:--a)u.push(function(){var r,a,l,c;for(c=[],h=r=a=-n,l=t.size+n;a<=l?r<=l:r>=l;h=a<=l?++r:--r)o.fillStyle=t.getModule(h,d)?s:i,c.push(o.fillRect((h+n)*e,(d+n)*e,e,e));return c}());return u},i}(App.TwoFactorConfigurationModal)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TwoFactorConfigurationModalPasswordCheck=function(e){function n(){
return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.buttonSubmit=__("Next"),n.prototype.buttonClass="btn--primary",n.prototype.head=__("Confirm Password"),n.prototype.content=function(){var t;return t=[{name:"password",display:__("Password"),tag:"input",type:"password",limit:100,null:!1,class:"input",single:!0}],this.form=new App.ControllerForm({model:{configure_attributes:t},autofocus:!0}),this.form.el},n.prototype.onSubmit=function(t){var e,n,i;return n=this.formParam(t.target),e=this.form.validate(n),_.isEmpty(e)?(this.formDisable(t),this.ajax({id:"password_check",type:"POST",url:this.apiPath+"/users/password_check",data:JSON.stringify(n),processData:!0,success:(i=this,function(e){if(!(null!=e?e.success:void 0))return i.formValidate({form:t.target,errors:{password:__("Current password is wrong!")}}),i.formEnable(t);i.successCallback&&!i.container?(i.close(),i.successCallback()):i.next()})})):(this.formValidate({form:t.target,errors:e}),!1)},n}(App.TwoFactorConfigurationModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TwoFactorConfigurationModalRecoveryCodes=function(n){function i(e){this.afterPrint=t(this.afterPrint,this),this.beforePrint=t(this.beforePrint,this),this.fetchRecoveryCodes=t(this.fetchRecoveryCodes,this),this.onClose=t(this.onClose,this),this.onSubmit=t(this.onSubmit,this),e.buttonCancel=!1,this.method=App.Config.get("TwoFactorMethods").RecoveryCodes,i.__super__.constructor.call(this,e),this.$(".js-print, .js-copy").removeClass("btn--text").removeClass("btn--subtle").addClass("btn--primary"),addEventListener("beforeprint",this.beforePrint),addEventListener("afterprint",this.afterPrint)}return e(i,n),i.prototype.buttonSubmit=__("OK, I've saved my recovery codes"),i.prototype.buttonClass="btn--success",i.prototype.leftButtons=[{className:"js-print",text:__("Print")},{className:"js-copy",text:__("Copy")}],i.prototype.head=__("Save Codes"),i.prototype.events={"click .js-print":"print","click .js-copy":"copy"},i.prototype.content=function(){return!1},i.prototype.onSubmit=function(){return this.closeWithFade()},i.prototype.onClose=function(){if(this.successCallback)return this.successCallback()},i.prototype.render=function(){if(i.__super__.render.apply(this,arguments),$(".modal .js-loading").removeClass("hide"),$(".modal .btn-success").addClass("hide"),!this.prefetchedRecoveryCodes)return this.fetchRecoveryCodes();this.didFetch(this.prefetchedRecoveryCodes)},i.prototype.fetchRecoveryCodes=function(){return this.ajax({id:"two_factor_authentication_method_configuration",type:"POST",url:this.apiPath+"/users/two_factor_recovery_codes_generate",success:this.didFetch})},i.prototype.didFetch=function(t){var e;return e=$(App.view("widget/two_factor_configuration/recovery_codes")({recovery_codes:t})),$(".modal .js-loading").addClass("hide"),$(".modal .btn-success").removeClass("hide"),$(".modal-body").html(e)},i.prototype.print=function(t){return t.preventDefault(),window.print()},i.prototype.release=function(){return i.__super__.release.apply(this,arguments),removeEventListener("beforeprint",this.beforePrint),removeEventListener("afterprint",this.afterPrint)},i.prototype.copy=function(t){var e;return t.preventDefault(),e=this.$("code").text(),this.copyToClipboardWithTooltip(e,t.target,".modal-body",!0)},i.prototype.beforePrint=function(){return this.originalHead=this.$(".modal-title").text(),this.$(".modal-title").text(this.head)},i.prototype.afterPrint=function(){return this.$(".modal-title").text(this.originalHead),this.originalHead=void 0},i}(App.TwoFactorConfigurationModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TwoFactorConfigurationModalSecurityKeys=function(n){function i(){return this.removeSecurityKey=t(this.removeSecurityKey,this),this.confirmRemoval=t(this.confirmRemoval,this),this.renderTable=t(this.renderTable,this),this.fetchExistingSecurityKeys=t(this.fetchExistingSecurityKeys,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonSubmit=__("Set Up"),i.prototype.buttonClass="btn--success",i.prototype.head=__("Security Keys"),i.prototype.content=function(){return!1},i.prototype.render=function(){var t,e;return i.__super__.render.apply(this,arguments),$(".modal .js-loading").removeClass("hide"),$(".modal .js-submit").prop("disabled",!0),e=this,t=function(t){var n,i;if(e.config=(null!=t?t.configuration:void 0)||{},e.credentials=(null!=(i=e.config)?i.credentials:void 0)||[],n=$(App.view("widget/two_factor_configuration/security_keys/index")()),$(".modal .js-loading").addClass("hide"),$(".modal-body").html(n),$(".modal .js-submit").prop("disabled",!1),e.credentials.length)return $(".modal-body").find(".js-table").html(e.renderTable().el)},this.fetchExistingSecurityKeys(t)},i.prototype.fetchExistingSecurityKeys=function(t){return this.ajax({id:"two_factor_authentication_method_configuration",type:"GET",url:this.apiPath+"/users/two_factor_authentication_method_configuration/security_keys",success:t,error:t})},i.prototype.renderTable=function(){return new App.ControllerTable({customActions:[{name:"remove",display:__("Remove"),icon:"trash",class:"btn--danger",callback:this.removeSecurityKey}],overview:["nickname","created_at"],attribute_list:[{name:"nickname",display:__("Name"),type:"text"},{name:"created_at",display:__("Created at"),tag:"datetime"}],objects:_.map(this.credentials,(function(t){return _.extend(t,{id:t.external_id})})),pagerEnabled:!1})},i.prototype.confirmRemoval=function(t){var e,n;return e=this.credentials.find((function(e){return e.external_id===t})),new App.ControllerConfirm({head:__("Are you sure?"),message:App.i18n.translatePlain('Security key "%s" will be removed.',e.nickname),buttonClass:"btn--danger",container:this.el.closest(".content"),small:!0,callback:(n=this,function(){return n.removeSecurityKey(t)})})},i.prototype.removeSecurityKey=function(t){var e,n;return _.extend({},this.config).credentials=_.filter(this.credentials,(function(e){return e.external_id!==t})),(e={configuration:_.extend({},this.config,{credentials:_.filter(this.credentials,(function(e){return e.external_id!==t}))})}).configuration.credentials.length||(e.configuration=null),this.ajax({id:"two_factor_authentication_method_configuration",type:"PUT",url:this.apiPath+"/users/two_factor_authentication_method_configuration/security_keys",data:JSON.stringify(e),processData:!0,success:(n=this,function(){return n.successCallback(),n.render()})})},i.prototype.nextModalClass=function(){return App.TwoFactorConfigurationModalSecurityKeyConfig},i.prototype.onSubmit=function(){return this.next({container:this.container,successCallback:this.successCallback})},i}(App.TwoFactorConfigurationModal),App.TwoFactorConfigurationModalSecurityKeyConfig=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.buttonSubmit=__("Next"),n.prototype.buttonClass="btn--primary",n.prototype.head=__("Security Key"),n.prototype.content=function(){return!1},n.prototype.render=function(){var t;return n.__super__.render.apply(this,arguments),t=[{name:"nickname",display:__("Name for this security key"),tag:"input",type:"text",limit:255,null:!1,class:"input"}],this.payloadForm=new App.ControllerForm({elReplace:$(".modal-body"),model:{configure_attributes:t}})},n.prototype.nextModalClass=function(){return App.TwoFactorConfigurationModalSecurityKeyRegister},n.prototype.onSubmit=function(t){var e,n;return n=this.formParam(t.target),e=this.payloadForm.validate(n),_.isEmpty(e)?this.next({container:this.container,nickname:n.nickname,successCallback:this.successCallback}):(this.formValidate({form:t.target,errors:e}),!1)},n}(App.TwoFactorConfigurationModal),App.TwoFactorConfigurationModalSecurityKeyRegister=function(n){function i(){this.onSubmit=t(this.onSubmit,this),this.hideError=t(this.hideError,this),this.showError=t(this.showError,this),this.fetchInitialConfiguration=t(this.fetchInitialConfiguration,this),this.method=App.Config.get("TwoFactorMethods").SecurityKeys,i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.buttonSubmit=__("Retry"),i.prototype.buttonClass="btn--primary hidden",i.prototype.head=__("Security Key"),i.prototype.content=function(){return!1},i.prototype.render=function(){var t,e;return i.__super__.render.apply(this,arguments),$(".modal .js-loading").removeClass("hide"),e=this,t=function(t){var n;return e.config=t.configuration,n=$(App.view("widget/two_factor_configuration/security_keys/register")()),$(".modal .js-loading").addClass("hide"),$(".modal-body").html(n),e.onSubmit()},this.fetchInitialConfiguration(t)},i.prototype.fetchInitialConfiguration=function(t){return this.ajax({id:"two_factor_authentication_method_initiate_configuration",type:"GET",url:this.apiPath+"/users/two_factor_authentication_method_initiate_configuration/"+this.method.key,success:t})},i.prototype.showError=function(t){return null==t&&(t=__("Security key setup failed.")),this.el.find(".main").hide(),this.showAlert(t),this.el.find(".js-submit").removeClass("hidden")},i.prototype.hideError=function(){return this.el.find(".js-submit").addClass("hidden"),this.clearAlerts(),this.el.find(".main").show()},i.prototype.onSubmit=function(){var t;if(this.hideError(),window.isSecureContext)return webauthnJSON.create({publicKey:this.config}).then((t=this,function(e){var n;return n=JSON.stringify({method:t.method.key,payload:{credential:e,challenge:t.config.challenge},configuration:_.extend({},t.config,{nickname:t.nickname,type:"registration"})}),t.ajax({id:"two_factor_verify_configuration",type:"POST",url:t.apiPath+"/users/two_factor_verify_configuration",data:n,processData:!0,success:function(e,n){if(!(null!=e?e.verified:void 0))return App.Log.error("TwoFactorConfigurationModalSecurityKeyRegister",e,n),t.showError();t.finalizeConfigurationWizard(e)}})})).catch(function(t){return function(e){return App.Log.error("TwoFactorConfigurationModalSecurityKeyRegister",e),t.showError()}}(this));this.showError(__("The application is not running in a secure context."))},i}(App.TwoFactorConfigurationModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TwoFactorLoginMethod=function(n){function i(){return this.fetchInitiateConfiguration=t(this.fetchInitiateConfiguration,this),this.postRender=t(this.postRender,this),this.renderFooter=t(this.renderFooter,this),this.renderForm=t(this.renderForm,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.initiate=!1,i.prototype.inputFieldLabel=__("Security Code"),i.prototype.render=function(t){return{form:this.renderForm(t),footer:this.renderFooter(t)}},i.prototype.renderForm=function(t){return null==t&&(t={}),App.view("widget/two_factor_login/security_code")({errorMessage:t.errorMessage||this.errorMessage,formPayload:this.loginContext.formPayload,inputFieldLabel:this.inputFieldLabel,twoFactorMethodDetails:this.method})},i.prototype.renderFooter=function(){return App.view("widget/two_factor_login/help_text")({twoFactorAvailableAnotherMethod:this.loginContext.twoFactorAvailableAnotherMethod})},i.prototype.postRender=function(){if(this.loginContext.el.find("#security_code").focus(),this.scrollTo(),this.initiate&&!this.errorMessage)return this.fetchInitiateConfiguration()},i.prototype.fetchInitiateConfiguration=function(){return this.ajax({id:"two_factor_initiate_authentication",type:"POST",data:JSON.stringify(this.loginContext.formPayload),processData:!0,url:this.apiPath+"/auth/two_factor_initiate_authentication/"+this.method.key,success:this.initiateCallback})},i.prototype.initiateCallback=function(){throw"You need to implement initiateCallback(data, xhr, status) method"},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TwoFactorLoginMethodAuthenticatorApp=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(App.TwoFactorLoginMethod)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.TwoFactorLoginMethodRecoveryCodes=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.inputFieldLabel=__("Recovery Code"),n}(App.TwoFactorLoginMethod)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.TwoFactorLoginMethodSecurityKeys=function(n){function i(){return this.retry=t(this.retry,this),this.showError=t(this.showError,this),this.verify=t(this.verify,this),this.initiateCallback=t(this.initiateCallback,this),this.renderForm=t(this.renderForm,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.initiate=!0,i.prototype.events={"click .js-retry":"retry"},i.prototype.renderForm=function(t){var e;return null==t&&(t={}),(e=$(App.view("widget/two_factor_login/security_keys")({errorMessage:t.errorMessage||this.errorMessage,formPayload:this.loginContext.formPayload,twoFactorMethodDetails:this.method}))).find(".js-retry").on("click",this.retry),e},i.prototype.initiateCallback=function(t){return this.config=t,this.verify()},i.prototype.verify=function(){var t;if(window.isSecureContext)return webauthnJSON.get({publicKey:this.config}).then((t=this,function(e){var n;return n=_.extend({},t.loginContext.formPayload,{two_factor_method:t.method.key,two_factor_payload:{credential:e,challenge:t.config.challenge}}),App.Auth.login({data:n,success:t.loginContext.success,error:t.loginContext.error})})).catch(function(t){return function(e){return App.Log.error("TwoFactorLoginMethodSecurityKeys",e),t.showError()}}(this));this.showError(__("The application is not running in a secure context."))},i.prototype.showError=function(t){return null==t&&(t=__("Security key verification failed.")),this.loginContext.el.find(".js-form").html(this.renderForm({errorMessage:t}))},i.prototype.retry=function(){return this.loginContext.renderTwoFactor({twoFactorMethod:this.method.key})},i}(App.TwoFactorLoginMethod)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.UpdateTastbar=function(n){function i(){this.update=t(this.update,this),this.release=t(this.release,this),i.__super__.constructor.apply(this,arguments),this.subscribeId=this.genericObject.subscribe(this.update)}return e(i,n),i.prototype.release=function(){return App[this.genericObject.constructor.className].unsubscribe(this.subscribeId)},i.prototype.update=function(){return App.TaskManager.touch(this.taskKey)},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.WidgetUser=function(i){function s(){this.update=e(this.update,this),this.render=e(this.render,this),this.release=e(this.release,this),s.__super__.constructor.apply(this,arguments),this.subscribeId=App.User.full(this.user_id,this.render,!1,!0)}return n(s,i),s.extend(App.PopoverProvidable),s.registerPopovers("UserTicket","Organization"),s.prototype.organizationLimit=3,s.prototype.events={"click .js-showMoreOrganizations a":"showMoreOrganizations","focusout [contenteditable]":"update"},s.prototype.release=function(){return App.User.unsubscribe(this.subscribeId)},s.prototype.getAdvancedSearchUrl=function(t,e){return"","/#search/customer_id:"+t+(e.length>1?' AND state.name:("'+e.join('" OR "')+'")':' AND state.name:"'+e[0]+'"')},s.prototype.render=function(t){var e,n,i,s,r,o,a,l,c,u,p;for(n in t&&(this.user=t),this.callback&&this.callback(t),p=[],a=App.User.attributesGet("view"))e=a[n],(o=(r=n).substr(0,r.length-3))in t&&(r=o),"firstname"!==r&&"lastname"!==r&&"organization"!==r&&e.shown&&(null!=t[r]&&""!==t[r]||"richtext"===e.tag)&&p.push(e);return t.preferences&&(s=[],t.preferences.tickets_open>0&&(c=App.TicketState.byCategory("open").map((function(t){return t.name})),i={url:this.getAdvancedSearchUrl(this.user_id,c),name:"open",count:t.preferences.tickets_open,title:__("Open Tickets"),class:"user-tickets",data:"open"},s.push(i)),t.preferences.tickets_closed>0&&(l=App.TicketState.byCategory("closed").map((function(t){return t.name})),i={url:this.getAdvancedSearchUrl(this.user_id,l),name:"closed",count:t.preferences.tickets_closed,title:__("Closed Tickets"),class:"user-tickets",data:"closed"},s.push(i)),s[0]&&(u={title:__("Tickets"),items:s},t.links=[],t.links.push(u))),this.html(App.view("widget/user")({header:__("Customer"),edit:!0,user:t,userData:p})),this.renderOrganizations(),this.$("[contenteditable]").ce({mode:"textonly",multiline:!0,maxlength:250}),this.refreshPopovers()},s.prototype.showMoreOrganizations=function(t){return this.preventDefaultAndStopPropagation(t),this.organizationLimit=100*(parseInt(this.organizationLimit/100)+1),this.renderOrganizations(),this.refreshPopovers()},s.prototype.renderOrganizations=function(){var e;return e=this.el,this.user.secondaryOrganizations(0,this.organizationLimit,(function(n){var i,s,r,o,a;for(a=[],s=0,r=n.length;s<r;s++)o=n[s],i=$("<li></li>"),new t({object_id:o.id,el:i}),a.push(i);return e.find(".js-organizationList li").not(".js-showMoreOrganizations").remove(),e.find(".js-organizationList").prepend(a)})),this.user.organization_ids&&this.user.organization_ids.length<this.organizationLimit?this.el.find(".js-showMoreOrganizations").addClass("hidden"):this.el.find(".js-showMoreOrganizations").removeClass("hidden")},s.prototype.refreshPopovers=function(){return this.renderPopovers({selector:".user-tickets",user_id:this.user.id})},s.prototype.update=function(t){var e,n,i,s;if(n=$(t.target).attr("data-name"),s=$(t.target).html(),(i=App.User.find(this.user_id))[n]!==s)return(e={})[n]=s,i.updateAttributes(e),this.log("notice","update",n,s,i)},s}(App.Controller),t=function(t){function i(){return this.render=e(this.render,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.model="Organization",i.prototype.observe={name:!0},i.prototype.render=function(t){return this.html(App.view("user_profile/organization")({organization:t}))},i}(App.ControllerObserver)}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/admin_password_auth/request"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="request_admin_password_auth fullscreen">\n  <div class="fullscreen-center">\n    <div class="hero-unit fullscreen-body">\n      <h2>'),e.push(this.T("Request password login for admin?")),e.push('<small></small></h2>\n      <form class="js-adminPasswordAuthForm">\n        <div class="js-adminPassword"></div>\n        <div class="form-controls">\n          <a class="btn btn--text btn--subtle js-cancel" href="#login">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n          <button class="btn btn--primary js-submit align-right">'),e.push(this.T("Submit")),e.push('</button>\n        </div>\n      </form>\n    </div>\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/admin_password_auth/request_sent"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="request_admin_password_auth fullscreen">\n  <div class="fullscreen-center">\n    <div class="hero-unit fullscreen-body">\n      <h2>'),e.push(this.T("We've sent admin password login instructions to your email address.")),e.push("<small></small></h2>\n      <p>"),e.push(this.T("If you don't receive instructions within a minute or two, check your email's spam and junk filters, or try resending your request.")),e.push('</p>\n      <div class="form-controls">\n        <a class="btn btn--text btn--subtle js-cancel" href="#login">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n        <button class="btn btn--primary retry align-right">'),e.push(this.T("again")),e.push('</button>\n      </div>\n    </div>\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/after_auth/two_factor_configuration"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="two-factor-auth">\n    <p>\n      '),e.push(this.T("You must protect your account with two-factor authentication.")),e.push("\n    </p>\n    <p>\n      "),e.push(this.T("Choose your preferred two-factor authentication method to set it up.")),e.push('\n    </p>\n    <div class="two-factor-auth-method-buttons">\n      <div class="loading icon"></div>\n    </div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/after_auth/two_factor_configuration/method_buttons"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(t=0,i=(r=this.enabledMethods).length;t<i;t++)s=r[t],e.push('\n  <div class="two-factor-auth-method">\n    <button class="btn btn--secondary js-configuration-method" type="button" data-method="'),e.push(n(s.identifier)),e.push('" '),s.disabled&&e.push("disabled"),e.push(">\n      "),e.push(this.Icon(s.icon)),e.push("\n      "),e.push(this.T(s.label)),e.push('\n    </button>\n    <p class="help-block text-center '),s.disabled&&e.push("is-disabled"),e.push('">'),e.push(n(s.helpMessage)),e.push("</p>\n  </div>\n");e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/agent_ticket_create"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a;if(e.push('<div class="tabsSidebar-holder flex">\n  <div class="main no-padding flex tabsSidebar-sidebarSpacer tabsSidebar-tabsSpacer">\n    <div class="newTicket">\n      <div class="box box--newTicket">\n        <div class="page-header">\n          <h1>'),e.push(this.T(this.head)),e.push('</h1>\n        </div>\n\n        <div class="page-content">\n          '),!_.isEmpty(this.availableTypes)&&this.availableTypes.length>1){for(e.push('\n            <ul class="tabs type-tabs">\n              '),t=0,i=(r=this.availableTypes).length;t<i;t++)a=r[t],e.push('\n                <li class="tab u-textTruncate" data-type="'),e.push(n(a)),e.push('">\n                  '),e.push(this.Icon(this.types[a].icon,"tab-icon")),e.push("\n                  "),e.push(this.T(this.types[a].label)),e.push("\n                </li>\n              ");e.push("\n            </ul>\n          ")}if(e.push("\n\n          "),!_.isEmpty(this.C("ui_ticket_create_notes"))){for(a in e.push("\n            "),o=this.C("ui_ticket_create_notes"))s=o[a],e.push('\n              <div class="alert alert--warning js-note" role="alert" data-type="'),e.push(n(a)),e.push('">'),e.push(this.T(s)),e.push("</div>\n            ");e.push("\n          ")}e.push('\n\n          <form role="form" class="ticket-create">\n            <input type="hidden" name="formSenderType"/>\n            <input type="hidden" name="shared_draft_id" value="'),e.push(n(this.shared_draft_id)),e.push('"/>\n            <input type="hidden" name="form_id" value="'),e.push(n(this.form_id)),e.push('"/>\n            <div class="ticket-form-top"></div>\n            <div class="form-group js-securityOptions hide">\n              <div class="formGroup-label">\n                <label for="">'),e.push(this.T("Security")),e.push('</label>\n              </div>\n              <div class="horizontal">\n                <div class="btn btn--action btn--split--first js-active-toggle-type js-securityType" data-type="PGP">'),e.push(n(this.T("PGP"))),e.push('</div>\n                <div class="btn btn--action btn--split--last js-active-toggle-type js-securityType" data-type="S/MIME">'),e.push(n(this.T("S/MIME"))),e.push('</div>\n                <div class="spacer js-securityType"></div>\n                <span class="js-securityEncryptComment">\n                  <div class="btn btn--action btn--split--first js-securityEncrypt js-active-toggle" disabled>'),e.push(this.Icon("lock-open","btn-inactive-icon")),e.push(this.Icon("lock","btn-active-icon")),e.push(this.T("Encrypt")),e.push('</div>\n                </span>\n                <span class="js-securitySignComment">\n                  <div class="btn btn--action btn--split--last js-securitySign js-active-toggle" disabled>'),e.push(this.Icon("not-signed","btn-inactive-icon")),e.push(this.Icon("signed","btn-active-icon")),e.push(this.T("Sign")),e.push('</div>\n                </span>\n              </div>\n            </div>\n            <div class="article-form-top"></div>\n            <div class="formset-inset">\n              <div class="ticket-form-middle horizontal two-columns"></div>\n              <div class="ticket-form-bottom"></div>\n            </div>\n\n            <div class="form-controls">\n              <a class="btn btn--text btn--subtle js-cancel" href="#/">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n              <button type="submit" class="btn btn--success js-submit align-right">'),e.push(this.T("Create")),e.push('</button>\n            </div>\n          </form>\n        </div>\n      </div>\n    </div>\n  </div>\n  <div class="tabsSidebar vertical"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/agent_ticket_merge"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<div>\n  <h4>"),e.push(this.T("Merge to Ticket#")),e.push('</h4>\n  <input type="text" name="target_ticket_number" class="form-control" value=""/>\n  <hr>\n  <h4>'),e.push(this.T("Recent Customer Tickets")),e.push('</h4>\n  <div id="ticket-merge-customer-tickets"></div>\n  <hr>\n  <h4>'),e.push(this.T("Recently Viewed Tickets")),e.push('</h4>\n  <div id="ticket-merge-recent-tickets"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/agent_ticket_view/bulk"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="update-box bulkAction-form" role="form">\n  <div class="bulkAction-firstStep js-action-step">\n    <div id="form-ticket-bulk" class="form-inline form-inline--enclosed flex"></div>\n    <div class="btn btn--primary js-confirm">'),e.push(this.T("Confirmation")),e.push('</div>\n  </div>\n  <div class="hide bulkAction-secondStep js-confirm-step">\n    <div id="form-ticket-bulk-comment" class="form-inline"></div>\n    <div class="bulkAction-secondStep-bottom">\n      <div id="form-ticket-bulk-typeVisibility" class="form-inline"></div>\n      <div class="bulkAction-controls">\n        <a class="btn btn--text btn--secondary js-cancel">'),e.push(this.T("Go Back")),e.push('</a>\n        <input type="submit" class="btn btn--primary js-submit" value="'),e.push(this.T("Update")),e.push('">\n      </div>\n    </div>\n  </div>\n</form>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/agent_ticket_view/content"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h2>'),e.push(this.T(this.overview.name)),e.push('</h2>\n  </div>\n  <div class="page-header-meta">\n    '),this.edit&&(e.push('\n      <div class="btn btn--action" data-type="settings">'),e.push(this.T("Options")),e.push("</div>\n    ")),e.push('\n  </div>\n</div>\n\n<div class="page-content">\n  <div class="table-overview"></div>\n</div>\n\n<div class="bulkAction hide"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/agent_ticket_view/detail"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<table class="table table-striped table-hover">\n  <tr>\n    <th class="" style="width: 24px;">\n      <input type="checkbox" value="" name="bulk_all"/>\n    </th>\n    <th></th>\n  </tr>\n'),t=0,i=(s=this.objects).length;t<i;t++)r=s[t],e.push('\n  <tr data-id="'),e.push(n(r.id)),e.push('">\n    <td>\n      <input type="checkbox" value="'),e.push(n(r.id)),e.push('" name="bulk"/>\n    </td>\n    <td>\n      '),e.push(r.customer.avatar("50","","userInfo-avatar")),e.push('\n      <h2 style="margin-top: 0px;"><a href="'),e.push(r.uiUrl()),e.push('" data-type="edit">'),
e.push(n(r.title||"-")),e.push('</a></h2>\n      <div class="horizontal">\n        <div class="vertical flex">\n          <table style="width: 100%;">\n            <tr>\n              <td style="width: 25%;"><label>'),e.push(this.T("Number")),e.push("</label></td><td> "),e.push(this.P(r,"number")),e.push("</td>\n            </tr>\n            <tr>\n              <td><label>"),e.push(this.T("State")),e.push("</label></td><td> "),e.push(this.P(r,"state")),e.push("</td>\n            </tr>\n            <tr>\n              <td><label>"),e.push(this.T("Group")),e.push("</label></td><td> "),e.push(this.P(r,"group")),e.push("</td>\n            </tr>\n            <tr>\n              <td><label>"),e.push(this.T("Customer")),e.push("</label></td><td> "),e.push(this.P(r,"customer")),e.push('</td>\n            </tr>\n          </table>\n        </div>\n        <div class="vertical flex">\n          <table style="width: 100%;">\n            <tr>\n              <td style="width: 25%;"><label>'),e.push(this.T("Created")),e.push("</label></td><td> "),e.push(this.P(r,"created_at")),e.push("</td>\n            </tr>\n            <tr>\n              <td><label>"),e.push(this.T("Priority")),e.push("</label></td><td> "),e.push(this.P(r,"priority")),e.push("</td>\n            </tr>\n            <tr>\n              <td><label>"),e.push(this.T("Owner")),e.push("</label></td><td> "),e.push(this.P(r,"owner")),e.push("</td>\n            </tr>\n            <tr>\n              <td><label>"),e.push(this.T("Organization")),e.push("</label></td><td> "),e.push(this.P(r,"organization")),e.push("</td>\n            </tr>\n          </table>\n        </div>\n      </div>\n    </td>\n  </tr>\n");e.push("\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/agent_ticket_view/navbar"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<ul class="nav nav-pills nav-stacked">\n  '),this.items){for(e.push("\n    "),t=0,s=(r=this.items).length;t<s;t++)i=r[t],e.push("\n      <li "),i.active&&e.push('class="active"'),e.push('>\n        <a class="horizontal center" href="'),e.push(n(i.target)),e.push('">\n          <span class="local u-textTruncate">'),e.push(this.T(i.name)),e.push('</span>\n          <span class="badge badge--text">'),e.push(n(i.count)),e.push("</span>\n        </a>\n      </li>\n    ");e.push("\n  ")}e.push("\n</ul>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/agent_ticket_view/navbar_vertical"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p;if(e.push('<div class="tabsHolder js-tabsHolder">\n  <div class="tabs tabs--inline tabs--big js-tabs">\n    '),this.items){for(e.push("\n      "),t=0,o=(c=this.items).length;t<o;t++)i=c[t],e.push('\n        <a class="tab js-tab'),i.active&&e.push(n(" active")),e.push('" href="'),e.push(n(i.target)),e.push('">\n          <span class="tab-name">'),e.push(this.T(i.name)),e.push('</span>\n          <span class="tab-badge">'),e.push(n(i.count)),e.push("</span>\n        </a>\n      ");for(e.push('\n      <div class="tab tab-dropdown js-toggle" data-toggle="dropdown">\n        '),e.push(this.Icon("dropdown-list")),e.push("\n        "),e.push(this.Icon("arrow-down","arrow")),e.push('\n      </div>\n      <ul class="dropdown dropdown--actions dropdown--wide dropdown-menu dropdown-menu-right js-dropdown" role="menu" aria-labelledby="userAction">\n        '),s=0,a=(u=this.items).length;s<a;s++)i=u[s],e.push('\n          <li class="js-dropdownItem hide'),i.active&&e.push(n(" active")),e.push('" role="presentation" data-target="'),e.push(n(i.target)),e.push('" role="menuitem" tabindex="-1">\n            <span class="flex u-textTruncate">'),e.push(this.T(i.name)),e.push('</span>\n            <span class="badge badge--text">'),e.push(n(i.count)),e.push("</span>\n        ");e.push("\n      </ul>\n    ")}if(e.push("\n  </div>\n</div>\n"),this.isAgent&&(e.push('\n<a class="btn btn--success btn--quad" href="#ticket/create">\n  '),e.push(this.Icon("plus")),e.push("\n</a>\n")),e.push("\n"),this.items){for(e.push('\n<div class="tabs tabs--inline tabs--big tabs-clone u-invisible js-tabsClone">\n  '),r=0,l=(p=this.items).length;r<l;r++)i=p[r],e.push('\n    <a class="tab js-tabClone'),i.active&&e.push(n(" active")),e.push('" href="'),e.push(n(i.target)),e.push('">\n      <span class="tab-name">'),e.push(this.T(i.name)),e.push('</span>\n      <span class="tab-badge">'),e.push(n(i.count)),e.push("</span>\n    </a>\n  ");e.push('\n  <div class="tab tab-dropdown js-toggle">\n    '),e.push(this.Icon("dropdown-list")),e.push("\n    "),e.push(this.Icon("arrow-down","arrow")),e.push("\n  </div>\n</div>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/agent_user_create"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form autocomplete="off">\n<div class="modal-dialog">\n  <div class="modal-content">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T(this.head)),e.push('</h1>\n    </div>\n    <div class="modal-body" id="form-user"></div>\n    <div class="modal-footer">\n      <a class="btn btn--text btn--subtle js-cancel" href="#/">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n      <button type="submit" class="btn btn--success js-submit align-right">'),e.push(this.T("Create")),e.push("</button>\n    </div>\n  </div>\n</div>\n</form>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/api"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header-title">\n  <h1>'),e.push(this.T("API")),e.push(" <small>"),e.push(this.T("Management")),e.push('</small></h1>\n</div>\n\n<div class="page-content">\n\n  <div class="page-header-title">\n    <div class="zammad-switch zammad-switch--small js-TokenAccess">\n       <input name="api_token_access" type="checkbox" id="api_token_access" '),App.Setting.get("api_token_access")&&e.push("checked"),e.push('>\n       <label for="api_token_access"></label>\n    </div>\n    <h2>'),e.push(this.T("Token Access")),e.push(" (HTTP Token Authentication)</h2>\n  </div>\n\n<p>"),e.push(this.T("Enable REST API using tokens (not username/email address and password). All users need to create their own access tokens in the user profile.")),e.push("</p>\n\n<p>"),e.push(this.T("Example:")),e.push('</p>\n\n<code>\ncurl -H "Authorization: Token token=YOUR_TOKEN" '),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push('/api/v1/groups\n</code>\n\n<hr>\n\n  <div class="page-header-title">\n    <div class="zammad-switch zammad-switch--small js-PasswordAccess">\n       <input name="api_password_access" type="checkbox" id="api_password_access" '),App.Setting.get("api_password_access")&&e.push("checked"),e.push('>\n       <label for="api_password_access"></label>\n    </div>\n    <h2>'),e.push(this.T("Password Access")),e.push(" (HTTP Basic Authentication)</h2>\n  </div>\n\n<p>"),e.push(this.T("Enable REST API access using the username/email address and password for the authentication user.")),e.push("</p>\n\n<p>"),e.push(this.T("Example:")),e.push("</p>\n\n<code>\ncurl -u "),e.push(n(this.S("email"))),e.push(":some_password "),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push('/api/v1/groups\n</code>\n\n<hr>\n\n  <div class="page-header-title">\n    <h2>'),e.push(this.T("Applications")),e.push(" (OAuth Authentication)</h2>\n    &nbsp;\n  </div>\n\n<p>"),e.push(this.T("Manage applications that can use Zammad as an OAuth provider and applications that you've authorized to use your account.")),e.push('</p>\n\n<div class="js-appList"></div>\n\n<button class="btn js-appNew">'),e.push(this.T("New Application")),e.push('</button>\n\n<br>\n<br>\n\n<div>\n  <table class="settings-list" style="width: 100%;">\n    <caption>'),e.push(this.T("OAuth URLs are:")),e.push('</caption>\n    <thead>\n      <tr>\n        <th width="40%">'),e.push(this.T("Action")),e.push('\n        <th width="60%">'),e.push(this.T("URL")),e.push("\n    </thead>\n    <tbody>\n      <tr>\n        <td>"),e.push(this.T("Requesting the Grant")),e.push("\n        <td>"),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push("/oauth/authorize\n      <tr>\n        <td>"),e.push(this.T("Getting an Access Token")),e.push("\n        <td>"),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push("/oauth/token\n    </tbody>\n  </table>\n</div>\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/avatar"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<span class="avatar '),e.push(this.cssClass),e.push('" style="background-image: url('),e.push(this.url),e.push(')"'),e.push(this.placement),e.push(this.data),e.push(' data-initials="'),e.push(this.initials),e.push('">\n  '),this.vip&&e.push(this.Icon("crown")),e.push("\n</span>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/avatar_group"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<span class="avatar avatar--group '),e.push(this.cssClass),e.push('">\n  '),e.push(this.Icon("team")),e.push("\n</span>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/avatar_organization"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<span class="avatar avatar--organization '),e.push(this.cssClass),e.push('" '),e.push(this.data),e.push(">\n  "),this.vip&&e.push(this.Icon("crown-silver")),e.push("\n  "),this.active?(e.push("\n    "),e.push(this.Icon("organization")),e.push("\n  ")):(e.push("\n    "),e.push(this.Icon("inactive-organization")),e.push("\n  ")),e.push("\n</span>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/avatar_system"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<span class="avatar '),e.push(this.cssClass),e.push('" style="background: white">\n  '),e.push(this.Icon("logo")),e.push("\n</span>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/avatar_unique"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<span class="avatar '),e.push(this.cssClass),e.push(' avatar--unique" style="background-position: -'),e.push(this.x),e.push("px -"),e.push(this.y),e.push('px;"'),e.push(this.placement),e.push(this.data),e.push(">\n  "),this.vip&&e.push(this.Icon("crown")),e.push("\n  "),e.push(n(this.initials)),e.push("\n</span>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/calendar/holiday_selector"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(t in e.push('<table class="settings-list">\n  <thead>\n    <tr>\n      <th>'),e.push(this.T("Active")),e.push("\n      <th>"),e.push(this.T("Date")),e.push('\n      <th style="width: 300px">'),e.push(this.T("Description")),e.push("\n      <th>"),e.push(this.T("Action")),e.push("\n  </thead>\n  <tbody>\n    "),s=this.days)i=s[t],e.push("\n    <tr "),i.active||e.push('class="is-inactive"'),e.push(' data-date="'),e.push(n(t)),e.push('">\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen">\n          <input type="checkbox" '),i.active&&e.push("checked"),e.push(' class="js-active js-boolean" name="public_holidays::'),e.push(n(t)),e.push('::active" value="true">\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n        </label>\n      <td>"),e.push(n(t)),e.push('\n      <td class="settings-list-control-cell"><input class="form-control form-control--small js-summary '),i.active||e.push("is-disabled"),e.push('" type="text" name="public_holidays::'),e.push(n(t)),e.push('::summary" value="'),e.push(n(i.summary)),e.push('" required/>\n      <td class="settings-list-row-control">\n        '),i.feed||(e.push('\n          <div class="btn btn--text js-remove">\n            '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n          </div>\n        ")),e.push("\n    ");e.push('\n\n    <tr class="settings-list-controlRow">\n      <td>\n      <td class="settings-list-control-cell js-datePicker">\n        <!-- not supported right now by ff\n        <input class="form-control form-control--small" type="date" placeholder="'),e.push(this.T("Date")),e.push('"/>\n        -->\n      <td class="settings-list-control-cell">\n        <input class="form-control form-control--small js-summary" type="text" placeholder="'),e.push(this.T("Description")),e.push('"/>\n      <td class="settings-list-row-control">\n        <div class="btn btn--text btn--create js-add">\n          '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("\n        </div>\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/calendar/holiday_selector_placeholder"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<tr class="" data-date="'),e.push(n(this.placeholderDate)),e.push('">\n  <td>\n    <label class="checkbox-replacement">\n      <input type="checkbox" checked class="js-active js-boolean" name="'),e.push(n(this.nameActive)),e.push('" value="true">\n      '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n      "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n    </label>\n  <td>"),e.push(this.Tdate(this.placeholderDate)),e.push('\n  <td class="settings-list-control-cell"><input class="form-control form-control--small js-summary" type="text" name="'),e.push(n(this.nameSummary)),e.push('" value="'),e.push(n(this.placeholderSummary)),e.push('" required/>\n  <td class="settings-list-row-control">\n    <div class="btn btn--text js-remove">\n      '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n    </div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/calendar/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S,x,j,D,P,E;for(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Calendar")),e.push(" <small>"),e.push(this.T("Management")),e.push('</small></h1>\n  </div>\n\n  <div class="page-header-meta">\n    '),this.showDescription&&(e.push('\n      <a class="btn js-description">'),e.push(this.T("Description")),e.push("</a>\n    ")),e.push('\n    <a class="btn btn--success js-new">'),e.push(this.T("New Calendar")),e.push('</a>\n  </div>\n</div>\n<div class="page-content">\n  '),_.isEmpty(this.calendars)&&(e.push('\n  <div class="page-description">\n    '),e.push(this.description),e.push("\n  </div>\n  ")),e.push("\n\n  "),r=0,c=(A=this.calendars).length;r<c;r++){if(t=A[r],e.push('\n  <div class="action" data-id="'),e.push(t.id),e.push('">\n    <div class="action-flow action-flow--row">\n      <div class="action-row">\n        <div class="action-flow action-flow--noWrap">\n          <h2>'),_.isEmpty(t.ical_url)||(e.push('<span title="'),e.push(this.Ti("Last sync at:")),e.push(" "),e.push(this.Ttimestamp(t.last_sync)),t.last_log&&(e.push(": "),e.push(n(t.last_log))),e.push('">\n            '),t.last_log?(e.push("\n              "),e.push(this.Icon("status","error inline")),e.push("\n            ")):(e.push("\n              "),e.push(this.Icon("status","ok inline")),e.push("\n            ")),e.push("</span>")),e.push(" "),e.push(n(t.name)),e.push("</h2>\n          "),t.default&&(e.push('\n            <div class="action-label">'),e.push(this.T("Default")),e.push("</div>\n          ")),e.push("\n        </div>\n      </div>\n      "),t.last_log&&(e.push('<div class="action-row"><div class="alert alert--danger">'),e.push(n(t.last_log)),e.push("</div></div>")),e.push('\n      <div class="action-row">\n        <div class="label">'),e.push(this.T("Time zone")),e.push("</div> "),e.push(n(t.timezone)),e.push('\n      </div>\n      <div class="action-block action-block--flex">\n        <div class="label">'),e.push(this.T("Business Hours")),e.push('</div>\n        <table class="table table-fluid">\n          <tr>\n            <td>'),e.push(this.T("Monday")),e.push("</td><td>"),!t.business_hours.mon.active||_.isEmpty(t.business_hours.mon.timeframes))e.push("-");else for(o=0,u=(C=t.business_hours.mon.timeframes).length;o<u;o++)i=C[o],e.push(n(i[0])),e.push("-"),e.push(n(i[1])),e.push(" </td><td>");if(e.push("</td>\n          </tr>\n          <tr>\n            <td>"),e.push(this.T("Tuesday")),e.push("</td><td>"),!t.business_hours.tue.active||_.isEmpty(t.business_hours.tue.timeframes))e.push("-");else for(a=0,p=(T=t.business_hours.tue.timeframes).length;a<p;a++)i=T[a],e.push(n(i[0])),e.push("-"),e.push(n(i[1])),e.push(" </td><td>");if(e.push("</td>\n          </tr>\n          <tr>\n            <td>"),e.push(this.T("Wednesday")),e.push("</td><td>"),!t.business_hours.wed.active||_.isEmpty(t.business_hours.wed.timeframes))e.push("-");else for(l=0,h=(S=t.business_hours.wed.timeframes).length;l<h;l++)i=S[l],e.push(n(i[0])),e.push("-"),e.push(n(i[1])),e.push(" </td><td>");if(e.push("</td>\n          </tr>\n          <tr>\n            <td>"),e.push(this.T("Thursday")),e.push("</td><td>"),!t.business_hours.thu.active||_.isEmpty(t.business_hours.thu.timeframes))e.push("-");else for(v=0,d=(x=t.business_hours.thu.timeframes).length;v<d;v++)i=x[v],e.push(n(i[0])),e.push("-"),e.push(n(i[1])),e.push(" </td><td>");if(e.push("</td>\n          </tr>\n          <tr>\n            <td>"),e.push(this.T("Friday")),e.push("</td><td>"),!t.business_hours.fri.active||_.isEmpty(t.business_hours.fri.timeframes))e.push("-");else for(b=0,f=(j=t.business_hours.fri.timeframes).length;b<f;b++)i=j[b],e.push(n(i[0])),e.push("-"),e.push(n(i[1])),e.push(" </td><td>");if(e.push("</td>\n          </tr>\n          <tr>\n            <td>"),e.push(this.T("Saturday")),e.push("</td><td>"),!t.business_hours.sat.active||_.isEmpty(t.business_hours.sat.timeframes))e.push("-");else for(w=0,m=(D=t.business_hours.sat.timeframes).length;w<m;w++)i=D[w],e.push(n(i[0])),e.push("-"),e.push(n(i[1])),e.push(" </td><td>");if(e.push("</td>\n          </tr>\n          <tr>\n            <td>"),e.push(this.T("Sunday")),e.push("</td><td>"),!t.business_hours.sun.active||_.isEmpty(t.business_hours.sun.timeframes))e.push("-");else for(k=0,g=(P=t.business_hours.sun.timeframes).length;k<g;k++)i=P[k],e.push(n(i[0])),e.push("-"),e.push(n(i[1])),e.push(" </td><td>");for(s in e.push('</td>\n          </tr>\n        </table>\n      </div>\n      <div class="action-block action-block--flex">\n        <div class="label">'),e.push(this.T("Holidays")),e.push('</div>\n        <table class="table">\n          '),_.isEmpty(t.public_holidays_preview)&&e.push("-"),e.push("\n          "),E=t.public_holidays_preview)y=E[s],e.push("\n            <tr "),y.active||e.push('class="is-inactive"'),e.push('>\n              <td style="width: 96px">'),e.push(this.Tdate(s,!0)),e.push("\n              <td>"),e.push(n(y.summary)),e.push("\n          ");e.push('\n        </table>\n      </div>\n    </div>\n    <div class="action-controls">\n      '),t.default?(e.push('\n        <div class="btn btn--danger btn--secondary is-disabled">'),e.push(this.T("Delete")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--danger btn--secondary js-delete">'),e.push(this.T("Delete")),e.push('</div>\n        <div class="btn btn--secondary js-default">'),e.push(this.T("Set as Default")),e.push("</div>\n      ")),e.push('\n      <div class="btn js-edit">'),e.push(this.T("Edit")),e.push("</div>\n    </div>\n  </div>\n  ")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/_header"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    '),this.params.hasSwitch&&e.push('\n      <div class="zammad-switch zammad-switch--small js-channelActive">\n         <input name="sms_channel_active" type="checkbox" id="sms_channel_active">\n         <label for="sms_channel_active"></label>\n      </div>\n    '),e.push("\n    <h1>"),e.push(this.T(this.params.header)),e.push(" <small></small></h1>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/chat"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <div class="zammad-switch zammad-switch--small js-chatSetting">\n       <input name="chat" type="checkbox" id="setting-chat" '),this.chatSetting&&e.push("checked"),e.push('>\n       <label for="setting-chat"></label>\n    </div>\n    <h1>'),e.push(this.T("Chat")),e.push('</h1>\n  </div>\n</div>\n<div class="page-content">\n  <p>'),e.push(this.T("You can create chat widgets for your web pages to allow visitors to chat with you.")),e.push("</p>\n\n  <h2>"),e.push(this.T("Topics")),e.push("</h2>\n  <p>"),e.push(this.T("You can create multiple chat topics.")),e.push('</p>\n  <div class="js-topics"></div>\n\n  <h2>'),e.push(this.T("Designer")),e.push('</h2>\n\n  <div class="form-group">\n    <label class="formGroup-label">'),e.push(this.T("Preview Width")),e.push('</label>\n    <div class="control">\n      <div class="tabs js-selectBrowserSize">\n        <div class="tab" data-size="mobile">'),e.push(this.T("Mobile")),e.push('</div>\n        <div class="tab" data-size="1:1">1:1</div>\n        <div class="tab active" data-size="desktop">'),e.push(this.T("Desktop")),e.push('</div>\n      </div>\n    </div>\n  </div>\n\n  <label for="preview-iframe" class="formGroup-label">'),e.push(this.T("Preview")),e.push('</label>\n  <div class="browser chat-demo js-browser" data-size="desktop">\n    <div class="browser-ratio">\n      <form class="browser-head js-demo-head" novalidate>\n        <div class="browser-input">\n          <input type="url" class="js-testurl-input" id="preview-iframe" value="'),e.push(n(this.previewUrl)),e.push('" placeholder="www.zammad.org">\n          <div class="loading icon small muted"></div>\n        </div>\n        <input type="submit" class="btn" value="'),e.push(this.Ti("Load")),e.push('">\n      </form>\n      <div class="browser-body js-browserBody">\n        <div class="browser-website js-website">\n          <img class="browser-website-background js-screenshot">\n        </div>\n        <style>@import "/assets/chat/chat.css";</style>\n        <div class="chat-demo-animationHolder">\n          <div class="js-chat zammad-chat zammad-chat-is-open zammad-chat-is-loaded zammad-chat-is-shown is-open">\n            <div class="zammad-chat-header js-toggle-chat js-backgroundColor js-chatHeader">\n              <div class="zammad-chat-header-controls">\n                <span class="zammad-chat-agent-status" data-status="online">'),e.push(this.T("Online")),e.push('</span>\n                <span class="zammad-chat-header-icon">\n                  <svg class="zammad-chat-header-icon-open" viewBox="0 0 13 7"><path d="M10.807 7l1.4-1.428-5-4.9L6.5-.02l-.7.7-4.9 4.9 1.414 1.413L6.5 2.886 10.807 7z" fill-rule="evenodd"></path></svg>\n                  <svg class="zammad-chat-header-icon-close" viewBox="0 0 13 13"><path d="m2.241.12l-2.121 2.121 4.243 4.243-4.243 4.243 2.121 2.121 4.243-4.243 4.243 4.243 2.121-2.121-4.243-4.243 4.243-4.243-2.121-2.121-4.243 4.243-4.243-4.243" fill-rule="evenodd"></path></svg>\n                </span>\n              </div>\n              <div class="zammad-chat-agent">\n                <img class="zammad-chat-agent-avatar" src="/assets/images/chat-demo-avatar.png">\n                <span class="zammad-chat-agent-sentence">\n                  <span class="zammad-chat-agent-name">'),e.push(this.T("John Smith")),e.push('</span>\n                </span>\n              </div>\n              <div class="zammad-chat-welcome zammad-chat-is-hidden">\n                <svg class="zammad-chat-icon" viewBox="0 0 24 24"><path d="M2 5C2 4 3 3 4 3h16c1 0 2 1 2 2v10C22 16 21 17 20 17H4C3 17 2 16 2 15V5zM12 17l6 4v-4h-6z" fill-rule="evenodd"></path></svg>\n                <span class="zammad-chat-welcome-text js-chat-welcome"><strong>Chat</strong> with us!</span>\n              </div>\n            </div>\n            <div class="zammad-chat-body">\n              <div class="zammad-chat-timestamp"><strong>'),e.push(this.T("today")),e.push('</strong> 14:45</div>\n              <div class="zammad-chat-message zammad-chat-message--customer">\n                <span class="zammad-chat-message-body js-backgroundColor">'),e.push(this.T("Hello! I need help with your product.")),e.push('</span>\n              </div>\n              <div class="zammad-chat-message zammad-chat-message--agent">\n                <span class="zammad-chat-message-body">'),e.push(this.T("Hi! Which one of our products?")),e.push('</span>\n              </div>\n            </div>\n            <form class="zammad-chat-controls">\n              <textarea class="zammad-chat-input" rows="1" placeholder="Ihre Nachricht..."></textarea>\n              <button type="submit" class="zammad-chat-button zammad-chat-send js-backgroundColor">'),e.push(this.T("Send")),e.push('</button>\n            </form>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n\n  <form class="js-params">\n    <fieldset>\n      <div class="input form-group formGroup--halfSize">\n        <div class="formGroup-label">\n          <label for="form-chat-title">'),e.push(this.T("Chat Title")),e.push('</label>\n        </div>\n        <div class="controls">\n          <input class="js-chatTitle" type="text" id="form-chat-title" name="title" placeholder="&lt;strong&gt;Chat&lt;/strong&gt; with us!">\n        </div>\n        <span class="help-block">'),e.push(this.T("Shown when the chat is closed.")),e.push('</span>\n      </div>\n      <div class="input form-group formGroup--halfSize">\n        <div class="formGroup-label">\n          <label for="form-chat-background">'),e.push(this.T("Background color")),e.push('</label>\n          <div class="align-right horizontal js-palette"></div>\n        </div>\n        <div class="controls controls--button">\n          <input class="js-color" type="text" id="form-chat-background" name="background">\n          <div class="controls-button js-eyedropper">\n            <div class="controls-button-inner u-clickable">\n              '),e.push(this.Icon("eyedropper")),e.push('\n            </div>\n          </div>\n        </div>\n        <span class="help-block">'),e.push(this.T("Can be in any CSS color format.")),e.push('</span>\n      </div>\n      <div class="input form-group formGroup--halfSize">\n        <div class="formGroup-label">\n          <label for="form-chat-fontsize">'),e.push(this.T("Font size")),e.push('</label>\n        </div>\n        <div class="controls">\n          <input type="text" id="form-chat-fontsize" name="fontSize" value="12px">\n        </div>\n        <span class="help-block">'),e.push(this.T("The default font size is 12px.")),e.push('</span>\n      </div>\n      <div class="switch form-group formGroup--halfSize">\n        <div class="formGroup-label">\n            <label for="form-chat-flat">'),e.push(this.T("Flat Design")),e.push('</label>\n          </div>\n        <div class="controls">\n          <div class="zammad-switch">\n             <input name="flat" type="checkbox" id="form-chat-flat">\n             <label for="form-chat-flat"></label>\n          </div>\n        </div>\n      </div>\n    </fieldset>\n  </form>\n\n  <hr>\n\n  <h2>'),e.push(this.T("Usage")),e.push("</h2>\n\n  <p>"),
e.push(marked(this.T("Insert the widget code into the source code of every page the chat shall be visible on. It should be placed at the end of the page's source code before the \xa7</body>\xa7 closing tag."))),e.push("</p>\n\n  <h3>"),e.push(this.T("Requirements")),e.push("</h3>\n  <p>"),e.push(this.T("Zammad Chat requires jQuery. If you don't already use it on your website, you can add it like this:")),e.push('</p>\n  <pre><code class="language-html js-code">&lt;script src="https://code.jquery.com/jquery-3.6.0.min.js"&gt;&lt;/script&gt;</code></pre>\n\n  <h3>'),e.push(this.T("Show chat automatically")),e.push(" ("),e.push(this.T("default")),e.push(")</h3>\n  <p>"),e.push(this.T("The chat will show up once the connection to the server got established and if there is an operator online to chat with.")),e.push('</p>\n\n  <pre><code class="language-html js-code">&lt;script src="'),e.push(n(this.baseurl)),e.push('/assets/chat/chat.min.js"&gt;&lt;/script&gt;\n&lt;script&gt;\n$(function() {\n  new ZammadChat({\n<span class="js-modal-params"></span>\n  });\n});\n&lt;/script&gt;</code></pre>\n\n  <h3>'),e.push(this.T("Manually open chat")),e.push("</h3>\n  <p>"),e.push(this.T("If you want to open the chat by clicking a button, set the option \xa7show\xa7 to \xa7false\xa7 and add the class \xa7open-zammad-chat\xa7 to the button.")),e.push('</p>\n  <pre><code class="language-html js-code">&lt;button class="open-zammad-chat"&gt;Chat with us&lt;/button&gt;\n\n&lt;script src="'),e.push(n(this.baseurl)),e.push('/assets/chat/chat.min.js"&gt;&lt;/script&gt;\n&lt;script&gt;\n$(function() {\n  new ZammadChat({\n<span class="js-modal-params"></span>,\n    show: false\n  });\n});\n&lt;/script&gt;</code></pre>\n\n  <h3>'),e.push(this.T("Why doesn't the chat show up?")),e.push("</h3>\n  <p>\n    "),e.push(this.T("There are several possible reasons why the chat won't show up:")),e.push("\n    <ol>\n      <li>"),e.push(this.T("The browser is outdated. It does not support WebSocket - the technology we use for the chat.")),e.push("\n      <li>"),e.push(this.T("There is no agent online.")),e.push("\n      <li>"),e.push(this.T("The chat is turned off.")),e.push("\n      <li>"),e.push(this.T("There are too many people in the chat queue.")),e.push("\n    </ol>\n    "),e.push(this.T("When you turn on debugging by setting the option \xa7debug\xa7 to \xa7true\xa7 the reason gets printed to the javascript console.")),e.push("\n  </p>\n\n  <hr>\n\n  <h3>"),e.push(this.T("Options")),e.push('</h3>\n\n  <table class="settings-list">\n    <thead>\n      <tr>\n        <th>'),e.push(this.T("Options")),e.push("\n        <th>"),e.push(this.T("Default")),e.push("\n        <th>"),e.push(this.T("Type")),e.push("\n        <th>"),e.push(this.T("Description")),e.push("\n    </thead>\n    <tbody>\n    "),t=0,i=(r=this.apiOptions).length;t<i;t++)s=r[t],e.push("\n      <tr>\n        <td>"),e.push(n(s.name)),e.push('\n        <td style="white-space: nowrap;"><code class="language-javascript js-code">'),e.push(n(s.default)),e.push('</code>\n        <td style="white-space: nowrap;"><code class="language-javascript js-code">'),e.push(n(s.type)),e.push("</code>\n        <td>"),e.push(this.T(s.description,s.descriptionSubstitute)),e.push("\n    ");e.push("\n    </tbody>\n  </table>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/color_swatch"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="color-swatch js-swatch" style="color: '),e.push(n(this.color)),e.push('" data-color="'),e.push(n(this.color)),e.push('"></div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/email_account_overview"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y;if(e.push("\n"),!_.isEmpty(this.accounts_fixed)){for(e.push("\n<h2>"),e.push(this.T("Fixed Email Accounts")),e.push('</h2>\n<div class="action">\n  <div class="action-flow">\n    <div class="action-block">\n      <ul>\n        '),s=0,l=(f=this.accounts_fixed).length;s<l;s++)i=f[s],e.push("\n          <li>"),e.push(n(i.name)),e.push(" &lt;"),e.push(n(i.email)),e.push("&gt;\n        ");e.push("\n      </ul>\n    </div>\n  </div>\n</div>\n")}if(e.push("\n\n<h2>"),e.push(this.T("Email Accounts")),e.push("</h2>\n\n"),!_.isEmpty(this.not_used_email_addresses)){for(e.push('\n<div class="action">\n  <div class="action-flow">\n    <div class="action-block">\n      '),e.push(this.T("Notice:")),e.push(" "),e.push(this.T("Unassigned email addresses, assign them to a channel or delete them.")),e.push('</h3>\n      <ul class="list">\n      '),r=0,c=(m=this.not_used_email_addresses).length;r<c;r++)i=m[r],e.push('\n        <li class="list-item" data-id="'),e.push(n(i.id)),e.push('">\n          <div class="list-item-name">\n            <a href="#" class="js-emailAddressEdit">'),e.push(n(i.name)),e.push(" &lt;"),e.push(n(i.email)),e.push('&gt;</a>\n          </div>\n          <div class="list-item-delete js-emailAddressDelete">\n            '),e.push(this.Icon("diagonal-cross")),e.push("\n          </div>\n      ");e.push("\n      </ul>\n    </div>\n  </div>\n</div>\n")}if(e.push("\n\n"),_.isEmpty(this.account_channels))e.push('\n  <table class="table table--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n");else{for(e.push("\n  "),o=0,u=(g=this.account_channels).length;o<u;o++){if(t=g[o],e.push('\n  <div class="action '),!0!==t.active&&e.push("is-inactive"),e.push('" data-id="'),e.push(t.id),e.push('">\n     '),!0===t.active&&t.options.inbound&&t.options.inbound.options&&"imap.gmail.com"===t.options.inbound.options.host&&t.options.outbound&&t.options.outbound.options&&"smtp.gmail.com"===t.options.outbound.options.host&&(e.push('\n    <div class="action-alert alert alert--danger alert--square horizontal centered" role="alert">\n      '),e.push(this.T("%s recommends using OAuth. %s announced it's going to drop Basic Authentication support in the future.","G Suite","Google")),e.push(' <div class="flex-spacer"></div><div class="double-spacer"></div><button class="btn js-migrateGoogleMail" type="button">'),e.push(this.T("Migrate now!")),e.push("</button>\n    </div>\n    ")),e.push("\n    "),!0===t.active&&t.options.inbound&&t.options.inbound.options&&"outlook.office365.com"===t.options.inbound.options.host&&t.options.outbound&&t.options.outbound.options&&"smtp.office365.com"===t.options.outbound.options.host&&(e.push('\n    <div class="action-alert alert alert--danger alert--square horizontal centered" role="alert">\n      '),e.push(this.T("%s recommends using OAuth. %s announced it's going to drop Basic Authentication support in the future.","Microsoft 365","Microsoft")),e.push(' <div class="flex-spacer"></div><div class="double-spacer"></div><button class="btn js-migrateMicrosoft365Mail" type="button">'),e.push(this.T("Migrate now!")),e.push("</button>\n    </div>\n    ")),e.push('\n    <div class="action-flow" style="width: 100%;">\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),e.push(this.Icon("status",t.status_in+" inline")),e.push(" "),e.push(this.T("Inbound")),e.push("</h3>\n          "),!1!==t.preferences.editable&&(e.push('\n            <div class="js-editInbound btn btn--text space-left">'),e.push(this.T("Edit")),e.push("</div>\n          ")),e.push('\n        </div>\n        <table class="key-value">\n          <tr>\n            <td>'),e.push(this.T("User")),e.push("\n            <td>"),e.push(n(t.options.inbound.options.user)),e.push("\n            "),t.options.inbound.options.folder&&(e.push("\n              ("),e.push(this.T("Folder:")),e.push(" "),e.push(n(t.options.inbound.options.folder)),e.push(")\n            ")),e.push("\n          <tr>\n            <td>"),e.push(this.T("Host")),e.push("\n            <td>"),e.push(n(t.options.inbound.options.host)),e.push("\n          <tr>\n            <td>"),e.push(this.T("Protocol")),e.push("\n            <td>"),e.push(n(t.options.inbound.adapter)),e.push("\n        </table>\n\n        "),_.isEmpty(t.last_log_in)||(e.push('\n        <div class="alert alert--danger">\n          '),e.push(n(t.last_log_in)),e.push("\n        </div>\n        ")),e.push("\n\n        <hr>\n\n        <h3>"),e.push(this.T("Destination Group")),e.push('</h3>\n        <a href="#" class="js-channelGroupChange '),!1===t.group.active&&e.push("alert alert--danger"),e.push('">\n          '),!1===t.group.active?(e.push("\n            "),e.push(this.T("%s is inactive, please select an active one.",this.P(t.group,"name"))),e.push("\n          ")):(e.push("\n            "),e.push(n(this.P(t.group,"name"))),e.push("\n          ")),e.push('\n        </a>\n      </div>\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),e.push(this.Icon("status",t.status_out+" inline")),e.push(" "),e.push(this.T("Outbound")),e.push("</h3>\n          "),!1!==t.preferences.editable&&(e.push('\n            <div class="js-editOutbound btn btn--text space-left">'),e.push(this.T("Edit")),e.push("</div>\n          ")),e.push('\n        </div>\n        <table class="key-value">\n        '),t.options.outbound&&t.options.outbound.options&&(e.push("\n          <tr>\n            <td>"),e.push(this.T("User")),e.push("\n            <td>"),e.push(n(t.options.outbound.options.user)),e.push("\n          <tr>\n            <td>"),e.push(this.T("Host")),e.push("\n            <td>"),e.push(n(t.options.outbound.options.host)),e.push("\n        ")),e.push("\n          <tr>\n            <td>"),e.push(this.T("Protocol")),e.push("\n            <td>"),e.push(n(t.options.outbound.adapter)),e.push("\n        </table>\n\n        "),_.isEmpty(t.last_log_out)||(e.push('\n        <div class="alert alert--danger">\n          '),e.push(n(t.last_log_out)),e.push("\n        </div>\n        ")),e.push("\n\n        <hr>\n\n        <h3>"),e.push(this.T("Email Address")),e.push('</h3>\n        <ul class="list">\n        '),_.isEmpty(t.email_addresses))e.push('\n          <li class="list-item">'),e.push(this.T("none")),e.push("\n        ");else{for(e.push("\n          "),a=0,p=(v=t.email_addresses).length;a<p;a++)i=v[a],e.push('\n            <li class="list-item" data-id="'),e.push(n(i.id)),e.push('">\n              <div class="list-item-name">'),e.push(n(i.email)),e.push('</div>\n              <div class="btn btn--text js-emailAddressEdit space-left space-right">'),e.push(this.T("Edit")),e.push("</div>\n              "),t.email_addresses.length>1&&(e.push('\n              <div class="list-item-delete js-emailAddressDelete">\n                '),e.push(this.Icon("diagonal-cross")),e.push("\n              </div>\n              ")),e.push("\n          ");e.push("\n        ")}e.push('\n        </ul>\n        <a class="text-muted js-emailAddressNew" href="#">+ '),e.push(this.T("Add")),e.push('</a>\n\n      </div>\n    </div>\n    <div class="action-controls">\n      '),!0===t.active?(e.push('\n        <div class="btn js-channelDisable">'),e.push(this.T("Disable")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--secondary js-channelEnable">'),e.push(this.T("Enable")),e.push("</div>\n      ")),e.push('\n      <div class="btn btn--danger btn--secondary js-channelDelete">'),e.push(this.T("Delete")),e.push("</div>\n    </div>\n  </div>\n  ")}e.push("\n")}if(e.push('\n\n<a class="btn btn--success js-channelNew">'),e.push(this.T("New")),e.push("</a>\n\n"),!_.isEmpty(this.notification_channels)&&!App.Config.get("system_online_service")){for(e.push("\n  <h2>"),e.push(this.T("Email Notification")),e.push("</h2>\n  "),d=0,h=(y=this.notification_channels).length;d<h;d++)t=y[d],e.push('\n    <div class="action" data-id="'),e.push(t.id),e.push('">\n      <div class="action-flow action-flow--row">\n        <div class="action-block action-block--flex">\n          <div class="horizontal">\n            <h3>'),e.push(this.Icon("status",t.status_out+" inline")),e.push(" "),e.push(this.T("Outbound")),e.push('</h3>\n            <div class="btn btn--text js-editNotificationOutbound space-left">'),e.push(this.T("Edit")),e.push('</div>\n          </div>\n\n          <table class="key-value">\n          '),t.options.outbound&&t.options.outbound.options&&(e.push("\n            <tr>\n              <td>"),e.push(this.T("User")),e.push("\n              <td>"),e.push(n(t.options.outbound.options.user)),e.push("\n            <tr>\n              <td>"),e.push(this.T("Host")),e.push("\n              <td>"),e.push(n(t.options.outbound.options.host)),e.push("\n          ")),e.push("\n            <tr>\n              <td>"),e.push(this.T("Protocol")),e.push("\n              <td>"),e.push(n(t.options.outbound.adapter)),e.push("\n          </table>\n\n          "),"error"===t.status_in&&(e.push('\n            <div class="alert alert--danger">'),e.push(n(t.last_log_in)),e.push("</div>\n          ")),e.push("\n          "),"error"===t.status_out&&(e.push('\n            <div class="alert alert--danger">'),e.push(n(t.last_log_out)),e.push("</div>\n          ")),e.push('\n        </div>\n        <div class="action-block action-block--flex">\n          <h3>'),e.push(this.T("Email Address")),e.push('</h3>\n          <ul class="list">\n            <li class="list-item">'),e.push(n(this.config.notification_sender)),e.push("\n          </ul>\n        </div>\n      </div>\n    </div>\n  ");e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/email_account_wizard"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="modal-dialog wizard">\n\n  <form class="modal-content setup wizard js-intro">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Account")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="base-settings"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n        <div class="modal-leftFooter">\n          <button class="btn btn--text btn--secondary align-left js-expert">'),e.push(this.T("Experts")),e.push('</button>\n        </div>\n        <div class="modal-rightFooter">\n          <button class="btn btn--primary align-right js-submit">'),e.push(this.T("Connect")),e.push('</button>\n        </div>\n    </div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-probe">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Account")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Testing")),e.push(' <span class="js-email"></span>\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-test">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Account")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Verifying\u2026")),e.push('\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-verify">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Account")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Verify sending and receiving")),e.push('\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-inbound">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Inbound")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n          '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n        </div>\n        <div class="base-inbound-settings"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n      <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-intro">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submit">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-inbound-acknowledge">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Inbound")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <p class="js-messageFound">'),e.push(this.T("We have already found %s email(s) in your mailbox. We will move them all from your mailbox into Zammad.","x")),e.push('</p>\n\n        <div class="js-archiveMessage">\n          <p class="js-archiveMessageCount">'),e.push(this.T('In addition, we have found emails in your mailbox that are older than %s weeks. You can import such emails as an "archive", which means that no notifications are sent and the tickets have the status "closed". However, you can find them in Zammad anytime using the search function.',"x")),e.push("</p>\n\n          <p>"),e.push(this.T("Should the emails from this mailbox be imported as an archive or as regular emails?")),e.push("</p>\n\n          <ul>\n            <li>"),e.push(this.T("Import as archive: |No notifications are sent|, the |tickets are closed|, and original timestamps are used. You can still find them in Zammad using the search.")),e.push("</li>\n            <li>"),e.push(this.T("Import as regular: |Notifications are sent| and the |tickets are open| - you can find the tickets in the overview of open tickets.")),e.push('</li>\n          </ul>\n\n          <p class="js-importType">\n            Import as: <span class="js-importTypeSelect"></span>\n          </p>\n        </div>\n        <div class="inbound-acknowledge-settings"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n      <a class="btn btn--text btn--secondary js-goToSlide js-back align-left" data-slide="js-inbound">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary js-goToSlide js-next align-right js-submit" data-slide="js-outbound">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-outbound">\n    <div class="modal-header">\n        <div class="modal-close js-close">\n          '),e.push(this.Icon("diagonal-cross")),e.push('\n        </div>\n        <h1 class="modal-title">'),e.push(this.T("Email Outbound")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n          '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n        </div>\n        <div class="base-outbound-type"></div>\n        <div class="base-outbound-settings"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n      <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-inbound">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submit">'),e.push(this.T("Continue")),e.push("</button>\n      </div>\n    </div>\n  </form>\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/email_notification_wizard"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="modal-dialog wizard">\n\n  <form class="modal-content setup wizard hide js-probe">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Notification")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Testing")),e.push(' <span class="js-email"></span>\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-test">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Notification")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Verifying\u2026")),e.push('\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard js-outbound">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Email Notification")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n          '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n        </div>\n        <div class="base-outbound-type"></div>\n        <div class="base-outbound-settings"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right">'),e.push(this.T("Continue")),e.push("</button>\n      </div>\n    </div>\n  </form>\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/form"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <div class="zammad-switch zammad-switch--small js-formSetting">\n       <input name="form_ticket_create" type="checkbox" id="setting-form" '),this.formSetting&&e.push("checked"),e.push('>\n       <label for="setting-form"></label>\n    </div>\n    <h1>'),e.push(this.T("Form")),e.push(' <small></small></h1>\n  </div>\n</div>\n<div class="page-content">\n  <p>'),e.push(this.T("With form you can add a form to your web page which directly generates a ticket for you.")),e.push("</p>\n\n  <h2>"),e.push(this.T("Settings")),e.push('</h2>\n  <form class="js-paramsSetting">\n    <fieldset>\n      <div class="input form-group formGroup--halfSize">\n        <div class="formGroup-label">\n          <label for="form-group">'),e.push(this.T("Group selection for Ticket creation")),e.push('</label>\n        </div>\n        <div class="controls js-groupSelector" id="from-group"></div>\n      </div>\n    </fieldset>\n  </form>\n\n  <h2>'),e.push(this.T("Designer")),e.push('</h2>\n  <form class="js-paramsDesigner">\n\n    <fieldset>\n      <div class="input form-group formGroup--halfSize">\n        <div class="formGroup-label">\n          <label for="form-message-title">'),e.push(this.T("Title of the form")),e.push('</label>\n        </div>\n        <div class="controls">\n          <input type="text" id="form-message-title" name="messageTitle" value="'),e.push(this.Ti("Feedback Form")),e.push('">\n        </div>\n      </div>\n      <div class="input form-group formGroup--halfSize">\n        <div class="formGroup-label">\n          <label for="form-message-submit">'),e.push(this.T("Name of form submit button")),e.push('</label>\n        </div>\n        <div class="controls">\n          <input type="text" id="form-message-submit" name="messageSubmit" value="'),e.push(this.Ti("Submit")),e.push('">\n        </div>\n      </div>\n      <div class="input form-group">\n        <div class="formGroup-label">\n          <label for="form-message-thank-you">'),e.push(this.T("Message after sending form")),e.push('</label>\n        </div>\n        <div class="controls">\n          <textarea type="text" id="form-message-thank-you" name="messageThankYou" rows="3">'),e.push(this.Ti("Thank you for your inquiry (#%s)! We'll contact you as soon as possible.")),e.push('</textarea>\n        </div>\n      </div>\n    </fieldset>\n\n    <br>\n\n    <table class="settings-list">\n      <thead>\n        <tr>\n          <th style="white-space: nowrap;">'),e.push(this.T("Options")),e.push('</th>\n        </tr>\n      </thead>\n      <tbody>\n        <tr>\n          <td>\n            <label class="inline-label">\n              <span class="checkbox-replacement checkbox-replacement--inline">\n                <input type="checkbox" name="debug" value="true">\n                '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n              </span>\n              "),e.push(this.T("Enable debugging for implementation.")),e.push('\n            </label>\n        <tr>\n          <td>\n            <label class="inline-label">\n              <span class="checkbox-replacement checkbox-replacement--inline">\n                <input type="checkbox" name="showTitle" value="true">\n                '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n              </span>\n              "),e.push(this.T("Show title in form.")),e.push('\n            </label>\n        <tr>\n          <td>\n            <label class="inline-label">\n              <span class="checkbox-replacement checkbox-replacement--inline">\n                <input type="checkbox" name="modal" value="true" checked>\n                '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n              </span>\n              "),e.push(this.T("Start modal dialog for form.")),e.push('\n            </label>\n        <tr>\n          <td>\n            <label class="inline-label">\n              <span class="checkbox-replacement checkbox-replacement--inline">\n                <input type="checkbox" name="noCSS" value="true">\n                '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n              </span>\n              "),e.push(this.T("Don't load CSS for form. You need to generate your own CSS for the form.")),e.push('\n            </label>\n        <tr>\n          <td>\n            <label class="inline-label">\n              <span class="checkbox-replacement checkbox-replacement--inline">\n                <input type="checkbox" name="attachmentSupport" value="true">\n                '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n              </span>\n              "),e.push(this.T("Add attachment option to upload.")),e.push('\n            </label>\n        <tr>\n          <td>\n            <div class="form-group">\n              <label class="inline-label">\n                <span class="checkbox-replacement checkbox-replacement--inline">\n                  <input type="checkbox" id="agreementSupport" value="true">\n                  '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                  "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n                </span>\n                "),e.push(this.T("Add agreement text before submit.")),e.push('\n              </label>\n              <div class="controls">\n                <div class="hide agreement-support-text richtext form-group">\n                  <textarea type="text" id="form-message-agreement" name="agreementMessage" rows="3">'),e.push(this.Ti("Accept Data Privacy Policy & Acceptable Use Policy")),e.push('</textarea>\n                </div>\n              </div>\n            </div>\n      </tbody>\n    </table>\n  </form>\n\n  <label class="formGroup-label">'),e.push(this.T("Preview")),e.push('</label>\n\n  <div class="browser js-browser">\n    <div class="browser-ratio">\n      <div class="browser-body js-browserBody">\n        <div class="browser-website centered vertical fit">\n          <div class="btn js-formBtn">'),e.push(this.T("Feedback")),e.push('</div>\n          <div class="js-formInline browser-inline-form"></div>\n        </div>\n      </div>\n    </div>\n  </div>\n  <h3>'),e.push(this.T("Requirements")),e.push("</h3>\n  <p>"),e.push(this.T("Zammad Forms requires jQuery. If you don't already use it on your website, you can add it like this:")),e.push('</p>\n  <pre><code class="language-html js-code">&lt;script src="https://code.jquery.com/jquery-3.6.0.min.js"&gt;&lt;/script&gt;</code></pre>\n\n  <p>'),
e.push(this.T("You need to add the following Javascript code snippet to your web page:")),e.push('</p>\n\n  <pre class="js-modal"><code class="language-html js-code js-paramsBlock">&lt;button id="zammad-feedback-form"&gt;Feedback&lt;/button&gt;\n\n&lt;script id="zammad_form_script" src="'),e.push(n(this.baseurl)),e.push('/assets/form/form.js"&gt;&lt;/script&gt;\n\n&lt;script&gt;\n$(function() {\n  $(\'#zammad-feedback-form\').ZammadForm({\n<span class="js-modal-params"></span>\n  });\n});\n&lt;/script&gt;</code></pre>\n</div>\n\n  <pre class="js-inlineForm"><code class="language-html js-code js-paramsBlock">&lt;div id="zammad-feedback-form"&gt;form will be placed in here&lt;/div&gt;\n\n&lt;script id="zammad_form_script" src="'),e.push(n(this.baseurl)),e.push('/assets/form/form.js"&gt;&lt;/script&gt;\n\n&lt;script&gt;\n$(function() {\n  $(\'#zammad-feedback-form\').ZammadForm({\n<span class="js-modal-params"></span>\n  });\n});\n&lt;/script&gt;</code></pre>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/sms_account_overview"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;if(e.push("<h2>"),e.push(this.T("SMS Accounts")),e.push("</h2>\n\n"),_.isEmpty(this.account_channels))e.push('\n  <table class="table table--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n");else{for(e.push("\n  "),i=0,r=(a=this.account_channels).length;i<r;i++)t=a[i],e.push('\n  <div class="action '),!0!==t.active&&e.push("is-inactive"),e.push('" data-id="'),e.push(t.id),e.push('">\n    <div class="action-flow" style="width: 100%;">\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),e.push(this.Icon("status",t.status_in+" inline")),e.push(" "),e.push(this.T("Inbound")),e.push("</h3>\n        </div>\n        "),_.isEmpty(t.last_log_in)||(e.push('\n        <div class="alert alert--danger">\n          '),e.push(n(t.last_log_in)),e.push("\n        </div>\n        ")),e.push('\n      </div>\n\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),e.push(this.Icon("status",t.status_out+" inline")),e.push(" "),e.push(this.T("Outbound")),e.push("</h3>\n        </div>\n        "),_.isEmpty(t.last_log_out)||(e.push('\n        <div class="alert alert--danger">\n          '),e.push(n(t.last_log_out)),e.push("\n        </div>\n        ")),e.push('\n\n      </div>\n    </div>\n\n    <div class="action-flow" style="width: 100%;">\n      <div class="action-block action-block--flex">\n        <table class="key-value">\n          <tr>\n            <td>'),e.push(this.T("Adapter")),e.push("\n            <td>"),e.push(n(t.options.adapter)),e.push("\n          <tr>\n            <td>"),e.push(this.T("Webhook")),e.push("\n            <td>"),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push("/api/v1/sms_webhook/"),e.push(n((null!=(l=t.options)?l.webhook_token:void 0)||"?")),e.push("\n          <tr>\n            <td>"),e.push(this.T("Account")),e.push("\n            <td>"),e.push(n(t.options.account_id)),e.push("\n          <tr>\n            <td>"),e.push(this.T("Token")),e.push("\n            <td>"),e.push(n(this.M(t.options.token,1,2))),e.push("\n          <tr>\n            <td>"),e.push(this.T("Sender")),e.push("\n            <td>"),e.push(n(t.options.sender)),e.push("\n          <tr>\n            <td>"),e.push(this.T("Group")),e.push('\n            <td>\n              <div href="#" class="js-channelEdit '),!1===t.group.active&&e.push("alert alert--danger"),e.push('">\n                '),!1===t.group.active?(e.push("\n                  "),e.push(this.T("%s is inactive, please select an active one.",this.P(t.group,"name"))),e.push("\n                ")):(e.push("\n                  "),e.push(n(this.P(t.group,"name"))),e.push("\n                ")),e.push('\n              </div>\n        </table>\n      </div>\n    </div>\n\n    <div class="action-controls">\n      <div class="btn btn--secondary js-channelEdit">'),e.push(this.T("Edit")),e.push("</div>\n      "),!0===t.active?(e.push('\n        <div class="btn btn--secondary js-channelDisable">'),e.push(this.T("Disable")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--secondary js-channelEnable">'),e.push(this.T("Enable")),e.push("</div>\n      ")),e.push('\n      <div class="btn btn--danger btn--secondary js-channelDelete">'),e.push(this.T("Delete")),e.push("</div>\n    </div>\n  </div>\n  ");e.push("\n")}if(e.push('\n\n<a class="btn btn--success js-channelEdit">'),e.push(this.T("New")),e.push("</a>\n\n<h2>"),e.push(this.T("SMS Notification")),e.push("</h2>\n"),_.isEmpty(this.notification_channels))e.push('\n  <table class="table table--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push('\n  </table>\n  <a class="btn btn--success js-editNotification">'),e.push(this.T("New")),e.push("</a>\n");else{for(e.push("\n  "),s=0,o=(c=this.notification_channels).length;s<o;s++)t=c[s],e.push('\n    <div class="action '),!0!==t.active&&e.push("is-inactive"),e.push('" data-id="'),e.push(t.id),e.push('">\n      <div class="action-flow action-flow--row">\n        <div class="action-block action-block--flex">\n          <div class="horizontal">\n            <h3>'),e.push(this.Icon("status",t.status_out+" inline")),e.push(" "),e.push(this.T("Outbound")),e.push("</h3>\n          </div>\n          "),"error"===t.status_in&&(e.push('\n            <div class="alert alert--danger">'),e.push(n(t.last_log_in)),e.push("</div>\n          ")),e.push("\n          "),"error"===t.status_out&&(e.push('\n            <div class="alert alert--danger">'),e.push(n(t.last_log_out)),e.push("</div>\n          ")),e.push('\n          <table class="key-value">\n          '),t.options&&(e.push("\n            <tr>\n              <td>"),e.push(this.T("Adapter")),e.push("\n              <td>"),e.push(n(t.options.adapter)),e.push("\n            <tr>\n              <td>"),e.push(this.T("Token")),e.push("\n              <td>"),e.push(n(this.M(t.options.token,1,2))),e.push("\n          ")),e.push("\n            <tr>\n              <td>"),e.push(this.T("Sender")),e.push("\n              <td>"),e.push(n(t.options.sender)),e.push('\n          </table>\n        </div>\n      </div>\n      <div class="action-controls">\n        <div class="btn btn--secondary js-editNotification">'),e.push(this.T("Edit")),e.push("</div>\n        "),!0===t.active?(e.push('\n          <div class="btn btn--secondary js-channelDisable">'),e.push(this.T("Disable")),e.push("</div>\n        ")):(e.push('\n          <div class="btn btn--secondary js-channelEnable">'),e.push(this.T("Enable")),e.push("</div>\n        ")),e.push('\n        <div class="btn btn--danger btn--secondary js-channelDelete">'),e.push(this.T("Delete")),e.push("</div>\n      </div>\n    </div>\n  ");e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/channel/topics"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<table class="settings-list">\n  <thead>\n    <tr>\n      <th style="white-space: nowrap;">'),e.push(this.T("Chat ID")),e.push('</th>\n      <th style="white-space: nowrap;">'),e.push(this.T("Name")),e.push('</th>\n      <th style="white-space: nowrap;">'),e.push(this.T("Note")),e.push('</th>\n      <th style="white-space: nowrap;">'),e.push(this.T("Max. clients on waitlist")),e.push('</th>\n      <th style="white-space: nowrap;">'),e.push(this.T("Delete")),e.push("</th>\n    </tr>\n  </thead>\n  <tbody>\n"),i=0,s=(r=this.chats).length;i<s;i++)t=r[i],e.push('\n    <tr data-id="'),e.push(n(t.id)),e.push('">\n      <td>\n        <label class="inline-label">\n          '),e.push(n(t.id)),e.push('\n        </label>\n      <td>\n        <label class="inline-label">\n          <a class="js-edit is-clickable">'),e.push(n(t.name)),e.push('</a>\n        </label>\n      <td>\n        <label class="inline-label">\n          '),e.push(n(t.note)),e.push('\n        </label>\n      <td>\n        <label class="inline-label">\n          '),e.push(n(t.max_queue)),e.push('\n        </label>\n      <td class="settings-list-row-control">\n        <div class="btn btn--text js-remove">\n          '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n        </div>\n");e.push('\n    <tr>\n      <td colspan="5" class="settings-list-action-cell js-add">\n        '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/cti/caller_log"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d;for(e.push('<table class="table table-striped table-hover">\n  <thead>\n    <tr>\n      <th style="width: 40px;">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen">\n          <input type="checkbox" class="js-checkAll">\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </label>\n      </th>\n      <th>\n        <div class="table-column-head">\n          '),e.push(this.T("From")),e.push('\n        </div>\n      </th>\n      <th>\n        <div class="table-column-head">\n          '),e.push(this.T("To")),e.push('\n        </div>\n      </th>\n      <!--<th style="width: 100px;">'),e.push(this.T("Queue")),e.push('</th>-->\n      <th style="width: 130px;">\n        <div class="table-column-head">\n          '),e.push(this.T("Status")),e.push('\n        </div>\n      </th>\n      <th style="width: 80px;">\n        <div class="table-column-head">\n          '),e.push(this.T("Waiting")),e.push('\n        </div>\n      </th>\n      <th style="width: 80px;">\n        <div class="table-column-head">\n          '),e.push(this.T("Duration")),e.push('\n        </div>\n      </th>\n      <th style="width: 170px;">\n        <div class="table-column-head">\n          '),e.push(this.T("Time")),e.push("\n        </div>\n      </th>\n    </tr>\n  </thead>\n  <tbody>\n    "),i=0,a=(u=this.list).length;i<a;i++){if(s=u[i],e.push('\n    <tr class="u-center js-callerLog '),s.done&&e.push(" is-grayed-out"),e.push('" data-id="'),e.push(s.id),e.push('">\n      <td class="table-checkbox u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen'),!0===s.disabled&&e.push(" is-disabled"),e.push('">\n          <input type="checkbox" class="js-check"'),s.done&&e.push(" checked"),!0===s.disabled&&e.push(" disabled"),e.push(">\n          "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n        </label>\n      </td>\n      <td>\n        "),d=!1,e.push("\n        "),s.preferences.from&&!_.isEmpty(s.preferences.from)){for(e.push("\n          "),r=0,l=(p=s.preferences.from).length;r<l;r++)t=p[r],e.push("\n            "),t.user_id&&App.User.exists(t.user_id)?(e.push("\n              "),d&&e.push('<div class="spacer"></div>'),e.push('\n              <div class="user-card">\n                <div class="js-avatar" data-id="'),e.push(t.user_id),e.push('" data-level="'),e.push(n(t.level)),e.push('"></div>\n                <a class="text-muted" href="'),e.push(App.Utils.phoneify(s.from_pretty)),e.push('">'),e.push(n(s.from_pretty)),e.push("</a>\n              </div>\n              "),d=!0,e.push("\n            ")):_.isEmpty(t.comment)||(e.push("\n              "),d=!0,e.push('\n              <div class="user-card">\n                '),e.push(this.unique_avatar(t.comment,t.comment.split(" ").map((function(t){return t[0]})).join(""))),e.push("\n                "),e.push(this.T("maybe:")),e.push(" "),e.push(n(t.comment)),e.push('<br>\n                <a class="text-muted" href="'),e.push(App.Utils.phoneify(s.from_pretty)),e.push('">'),e.push(n(s.from_pretty)),e.push("</a>\n              </div>\n            ")),e.push("\n          ");e.push("\n        ")}if(e.push("\n        "),d||_.isEmpty(s.from_comment)||(e.push("\n          "),d=!0,e.push('\n          <div class="user-card">\n            '),e.push(this.unique_avatar(s.from_comment,s.from_comment.split(" ").map((function(t){return t[0]})).join(""))),e.push("\n            "),e.push(n(s.from_comment)),e.push('<br>\n            <a class="text-muted" href="'),e.push(App.Utils.phoneify(s.from_pretty)),e.push('">'),e.push(n(s.from_pretty)),e.push("</a>\n          </div>\n        ")),e.push("\n        "),d||(e.push('\n          <div class="user-card">\n            '),e.push(this.unique_avatar(s.from_pretty||s.from,"??")),e.push("\n          "),_.isEmpty(s.from_pretty)?(e.push('\n            <a class="inherit-color" href="'),e.push(App.Utils.phoneify(s.from)),e.push('">'),e.push(n(s.from)),e.push("</a>\n          ")):(e.push('\n            <a class="inherit-color" href="'),e.push(App.Utils.phoneify(s.from_pretty)),e.push('">'),e.push(n(s.from_pretty)),e.push("</a>\n            "),"in"===s.direction&&(e.push('\n            <div class="btn btn--text btn--create no-padding js-newUser" href="#" data-phone="'),e.push(n(s.from_pretty)),e.push('">'),e.push(this.Icon("plus-small")),e.push(" <span>"),e.push(this.T("New User")),e.push("</div>\n            ")),e.push("\n          ")),e.push("\n          </div>\n        ")),e.push("\n      </td>\n      <td>\n        "),d=!1,e.push("\n        "),s.preferences.to&&!_.isEmpty(s.preferences.to)){for(e.push("\n          "),o=0,c=(h=s.preferences.to).length;o<c;o++)t=h[o],e.push("\n            "),t.user_id&&App.User.exists(t.user_id)?(e.push("\n              "),d=!0,e.push('\n              <div class="user-card">\n                <div class="js-avatar" data-id="'),e.push(t.user_id),e.push('" data-level="'),e.push(n(t.level)),e.push('"></div>\n                <a class="text-muted" href="'),e.push(App.Utils.phoneify(s.to_pretty)),e.push('">'),e.push(n(s.to_pretty)),e.push("</a>\n              </div>\n            ")):_.isEmpty(t.comment)||(e.push("\n              "),d=!0,e.push('\n              <div class="user-card">\n                '),e.push(this.unique_avatar(t.comment,t.comment.split(" ").map((function(t){return t[0]})).join(""))),e.push("\n                "),e.push(this.T("maybe:")),e.push(" "),e.push(n(t.comment)),e.push('<br>\n                <a class="text-muted" href="'),e.push(App.Utils.phoneify(s.to_pretty)),e.push('">'),e.push(n(s.to_pretty)),e.push("</a>\n              </div>\n            ")),e.push("\n          ");e.push("\n        ")}e.push("\n        "),d||_.isEmpty(s.to_comment)||(e.push("\n          "),d=!0,e.push('\n          <div class="user-card">\n            '),e.push(this.unique_avatar(s.to_comment,s.to_comment.split(" ").map((function(t){return t[0]})).join(""))),e.push("\n            "),e.push(n(s.to_comment)),e.push('<br>\n            <a class="text-muted" href="'),e.push(App.Utils.phoneify(s.to_pretty)),e.push('">'),e.push(n(s.to_pretty)),e.push("</a>\n          </div>\n        ")),e.push("\n        "),d||(e.push('\n          <div class="user-card">\n            '),"in"!==s.direction&&(e.push("\n              "),e.push(this.unique_avatar(s.to_pretty||s.to,"??")),e.push("\n            ")),e.push("\n          "),_.isEmpty(s.to_pretty)?(e.push('\n            <a class="inherit-color" href="'),e.push(App.Utils.phoneify(s.to)),e.push('">'),e.push(n(s.to)),e.push("</a>\n          ")):(e.push('\n            <a class="inherit-color" href="'),e.push(App.Utils.phoneify(s.to_pretty)),e.push('">'),e.push(n(s.to_pretty)),e.push("</a>\n            "),"out"===s.direction&&(e.push('\n            <div class="btn btn--text btn--create no-padding js-newUser" href="#" data-phone="'),e.push(n(s.to_pretty)),e.push('">'),e.push(this.Icon("plus-small")),e.push(" <span>"),e.push(this.T("New User")),e.push("</div>\n            ")),e.push("\n          ")),e.push("\n          </div>\n        ")),e.push('\n      </td>\n      <!--<td style="vertical-align: middle">'),e.push(n(s.queue)),e.push("</td>-->\n      <td>\n        "),s.state_human&&(e.push("\n        "),e.push(this.Icon("status",s.status_class+" inline")),e.push(" "),e.push(this.T(s.state_human)),e.push("\n        ")),e.push("\n      </td>\n      <td>"),e.push(n(this.time_duration(s.duration_waiting_time))),e.push("</td>\n      <td>"),e.push(n(this.time_duration(s.duration_talking_time))),e.push("</td>\n      <td>"),e.push(this.humanTime(s.created_at)),e.push("</td>\n    </tr>\n    ")}e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/cti/caller_log_avatar"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push(this.user.avatar()),e.push('\n<div class="'),e.push(n(this.classes.join(" "))),e.push('" data-id="'),e.push(this.user.id),e.push('">'),"known"!==this.level&&(e.push(this.T("maybe:")),e.push(" ")),e.push(n(this.user.displayNameLong())),e.push("</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/cti/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex">\n  <h1>'),e.push(this.T("Caller log")),e.push('</h1>\n  <div class="page-content js-callerLog"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/cti/not_configured"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="main flex fullscreenMessage">\n  <div>\n    <h1>'),e.push(this.T("Not configured")),e.push("</h1>\n    <p>"),e.push(this.T("Sorry, there is currently no CTI backend enabled.")),e.push("</p>\n    <p>"),e.push(this.T("We support:")),e.push('</p>\n    <div class="btn-group-vertical" role="group">\n    '),i=0,s=(r=this.backends).length;i<s;i++)t=r[i],e.push("\n      "),this.isAdmin&&(e.push('<a class="btn" href="'),e.push(t.url),e.push('">')),e.push(n(t.name)),this.isAdmin&&e.push("</a>"),e.push("\n    ");e.push("\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_footer"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="chat-footer">\n  <div class="btn btn--primary js-createTicket">'),e.push(this.T("Turn chat into ticket")),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_header"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="status-fields">\n  '),this.chats.length>1){for(e.push('\n  <div class="buttonDropdown dropdown">\n    <div class="status-field status-field--spacer js-acceptChat">\n      <span class="badge js-badgeWaitingCustomers"></span> '),e.push(this.T("Waiting Customers")),e.push(' \n    </div>\n    <div class="status-field status-field--arrow" data-toggle="dropdown">\n      '),e.push(this.Icon("arrow-down")),e.push('\n    </div>\n    <ul class="dropdown-menu" role="menu">\n      '),i=0,s=(r=this.chats).length;i<s;i++)t=r[i],e.push('\n      <li class="js-waitingCustomers js-acceptChat" disabled data-chat-id="'),e.push(n(t.id)),e.push('" role="menuitem">\n        <span class="badge js-badgeWaitingCustomers"></span> '),e.push(this.T("Waiting in %s",t.name)),e.push(' <span class="flex-spacer"></span>\n        <div class="status-badge js-info">\n          <div class="info-badge">'),e.push(this.Icon("info")),e.push("</div>\n        </div>\n      ");e.push("\n    </ul>\n  </div>\n  ")}else e.push('\n    <div class="status-field js-acceptChat js-waitingCustomers">\n      <span class="badge js-badgeWaitingCustomers"></span> '),e.push(this.T("Waiting Customers")),e.push(' \n      <div class="status-badge js-totalInfo">\n        <div class="info-badge">'),e.push(this.Icon("info")),e.push("</div>\n      </div>\n    </div>\n  ");e.push('\n  <div class="status-field js-chattingCustomers">\n    <span class="badge js-badgeChattingCustomers"></span> '),e.push(this.T("Chatting Customers")),e.push(' \n    <div class="status-badge js-info">\n      <div class="info-badge">'),e.push(this.Icon("info")),e.push('</div>\n    </div>\n  </div>\n  <div class="status-field js-activeAgents">\n    <span class="badge js-badgeActiveAgents"></span> '),e.push(this.T("Active Agents")),e.push(' \n    <div class="status-badge js-info">\n      <div class="info-badge">'),e.push(this.Icon("info")),e.push("</div>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push("<hr>\n"),_.isEmpty(this.chat_sessions))e.push("\n"),e.push(this.T("none")),e.push("\n");else{for(e.push("\n<ul>\n"),i=0,s=(r=this.chat_sessions).length;i<s;i++)t=r[i],e.push("\n  <li>"),e.push(n(t.name)),e.push(" "),t.geo_data&&(e.push("- "),e.push(n(t.geo_data))),e.push(" - "),t.user_id&&(e.push(n(t.user.displayName())),e.push(" -")),e.push(' <small class="">'),e.push(this.humanTime(t.created_at)),e.push("</small>\n");e.push("\n</ul>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_loader"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="chat-message chat-message--customer chat-message--loader js-loader">\n  <div class="chat-loader">\n    '),e.push(this.Icon("loading")),e.push("\n    "),e.push(this.Icon("loading")),e.push("\n    "),e.push(this.Icon("loading")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_message"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="chat-message chat-message--'),e.push(n(this.sender)),this.isNew&&e.push(n(" chat-message--new")),e.push('">'),e.push(this.message),e.push("</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_notice_message"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="chat-notice-message">'),e.push(n(this.message)),e.push("</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_status_message"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="chat-status-message">'),e.push(this.message),e.push("</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_timestamp"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="chat-timestamp js-timestamp"><span class="chat-timestamp-label">'),e.push(n(this.label)),e.push("</span> "),e.push(n(this.time)),e.push("</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/chat_window"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="chat-header">\n  <div class="chat-status js-status" data-status="online">\n    <div class="chat-status-holder">\n      '),e.push(this.Icon("status")),e.push("\n      "),e.push(this.Icon("status-modified-outer-circle")),e.push("\n      "),e.push(this.Icon("small-dot","icon-status-modified-inner-circle")),e.push('\n    </div>\n  </div>\n  <div class="chat-name">\n    <span class="js-name js-info u-clickable">'),e.push(n(this.name)),e.push("<span> #"),e.push(n(this.session.id)),e.push('\n  </div>\n  <div class="chat-disconnect js-disconnect">\n    <div class="btn btn--action btn--small">'),e.push(this.T("disconnect")),e.push('</div>\n  </div>\n  <div class="chat-close js-close is-hidden">\n    <div class="btn btn--action btn--small">'),e.push(this.T("close")),e.push('</div>\n  </div>\n</div>\n<div class="chat-scroll-hint js-scrollHint is-hidden">\n  '),e.push(this.Icon("chat")),e.push("\n  "),e.push(this.T("Scroll down to see new messages")),e.push('\n</div>\n<div class="chat-body-holder js-scrollHolder">\n  <div class="chat-body js-body"></div>\n  <div class="chat-body js-meta hidden">\n    '),this.session){for(e.push("\n    "),e.push(this.T("Transfer conversation to another chat:")),e.push("\n    <ul>\n      "),i=0,s=(r=this.chats).length;i<s;i++)t=r[i],e.push("\n        "),this.session.chat_id!==t.id&&(e.push('\n          <li><a data-chat-id="'),e.push(n(t.id)),e.push('" class="js-transferChat" href="#">'),e.push(t.name),e.push("</a>\n        ")),e.push("\n      ");e.push("\n    </ul>\n    <hr>\n    <ul>\n      <li>"),e.push(this.T("Created at:")),e.push(" "),e.push(this.Ttimestamp(this.session.created_at)),e.push("</li>\n      "),this.session&&this.session.preferences&&(e.push("\n        "),this.session.preferences.geo_ip&&(e.push("\n          <li>GeoIP: "),e.push(n(this.session.preferences.geo_ip.country_name)),e.push(" "),e.push(n(this.session.preferences.geo_ip.city_name)),e.push("</li>\n        ")),e.push("\n        "),this.session.preferences.remote_ip&&(e.push("\n          <li>IP: "),e.push(n(this.session.preferences.remote_ip)),e.push("</li>\n        ")),e.push("\n        "),this.session.preferences.dns_name&&(e.push("\n          <li>DNS: "),e.push(n(this.session.preferences.dns_name)),e.push("</li>\n        ")),e.push("\n      ")),e.push("\n    </ul>\n    ")}e.push('\n    <form class="js-metaForm" style="max-width: 200px; width: 100%;"></form>\n  </div>\n</div>\n<div class="chat-controls">\n  <div class="chat-input">\n    <div class="form-control form-control--small form-control--multiline js-customerChatInput" contenteditable="true"></div>\n  </div>\n  <div class="btn btn--primary btn--slim btn--small js-send">'),e.push(this.T("Send")),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="chat main">\n  <div class="page-header">\n      <div class="page-header-title">\n        <h1>'),e.push(this.T("Customer Chat")),e.push('</h1>\n      </div>\n      <div class="page-header-center js-header"></div>\n      <div class="page-header-meta">\n        <div class="btn btn--action js-settings">'),e.push(this.T("Settings")),e.push('</div>\n      </div>\n    </div>\n  <div class="chat-workspace"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/setting"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p;for(this.errors.settings&&(e.push('\n  <div class="alert alert--danger">'),e.push(this.T(this.errors.settings)),e.push("</div>\n")),e.push('\n<div class="select form-group">\n  <label for="chat_max_windows">'),e.push(this.T("Max. concurrent chats")),
e.push('</label>\n  <div class="u-positionOrigin">\n    <select id="chat_max_windows" class="form-control" name="chat::max_windows">\n      '),i=s=1;s<=20;i=++s)e.push('\n        <option value="'),e.push(i),e.push('" '),parseInt(this.preferences.chat.max_windows)===i&&e.push("selected"),e.push(">"),e.push(i),e.push("</option>\n      ");for(e.push("\n    </select>\n    "),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n  </div>\n</div>\n<div class="select form-group">\n  <label for="chat_alternative_name">'),e.push(this.T("Alternative name")),e.push('</label>\n  <div class="u-positionOrigin">\n    <input id="chat_alternative_name" class="form-control" name="chat::alternative_name" value="'),e.push(n(this.preferences.chat.alternative_name)),e.push('"/>\n  </div>\n</div>\n<div class="select form-group">\n  <label for="chat_avatar_state">'),e.push(this.T("Avatar")),e.push('</label>\n  <div class="u-positionOrigin">\n    <select id="chat_avatar_state" class="form-control" name="chat::avatar_state">\n      '),r=0,a=(c=["enabled","disabled"]).length;r<a;r++)p=c[r],e.push('\n        <option value="'),e.push(p),e.push('" '),this.preferences.chat.avatar_state===p&&e.push("selected"),e.push(">"),e.push(this.T(p)),e.push("</option>\n      ");for(e.push("\n    </select>\n    "),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n  </div>\n</div>\n<table class="settings-list settings-list--stretch">\n  <thead>\n    <tr>\n      <th>'),e.push(this.T("Topic")),e.push("\n      <th>"),e.push(this.T("Greeting")),e.push(" ("),e.push(this.T("Separate multiple values by ;")),e.push(")\n      <th>"),e.push(this.T("Enabled")),e.push("\n    </th></tr>\n  </thead>\n  <tbody>\n"),o=0,l=(u=this.chats).length;o<l;o++)t=u[o],e.push("\n    <tr>\n      <td>"),e.push(n(t.name)),e.push('\n      <td class="settings-list-control-cell"><label class="inline-label"><input name="chat::phrase::'),e.push(t.id),e.push('" value="'),e.push(n(this.preferences.chat.phrase[t.id])),e.push('" class="form-control form-control--small" placeholder="'),e.push(this.T("Hello, my name is %s, what can I do for you?",App.Session.get("firstname"))),e.push('"/></label>\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen">\n            <input type="checkbox" name="chat::active::'),e.push(t.id),e.push('" '),this.preferences.chat.active[t.id]&&e.push("checked"),e.push(">\n            "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n            "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n        </label>\n");e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_chat/user_list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push("<hr>\n"),_.isEmpty(this.users))e.push("\n"),e.push(this.T("none")),e.push("\n");else{for(e.push('\n<div class="userList">\n'),t=0,i=(s=this.users).length;t<i;t++)r=s[t],e.push('\n  <div class="userList-entry">\n    '),e.push(r.avatar("30")),e.push('\n    <span class="userList-name">\n      '),e.push(n(r.displayName())),e.push("\n    </span>\n  </div>\n");e.push("\n</div>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_not_ticket_exists"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="">\n  <h1>'),e.push(this.T("Welcome!")),e.push('<small></small></h1>\n  <div class="container">\n    <div class="row">\n      <div class="span12">\n        '),this.has_any_tickets?(e.push("\n          <p>"),e.push(this.T("You have no tickets to display in this overview.")),e.push("</p>\n        ")):(e.push("\n          "),this.is_allowed_to_create_ticket?(e.push("\n            <p>"),e.push(this.T("You have not created a ticket yet.")),e.push("</p>\n            <p>"),e.push(this.T('The way to communicate with us is this thing called "ticket".')),e.push("</p>\n            <p>"),e.push(this.T("Please click on the button below to create your first one.")),e.push('</p>\n\n            <p><a class="btn btn--primary" href="#customer_ticket_new">'),e.push(this.T("Create your first ticket")),e.push("</a></p>\n          ")):(e.push("\n            <p>"),e.push(this.T("You currently don't have any tickets.")),e.push("</p>\n          ")),e.push("\n        ")),e.push("\n      </div>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/customer_ticket_create"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="tabsSidebar-holder flex">\n  <div class="main no-padding flex tabsSidebar-sidebarSpacer tabsSidebar-tabsSpacer">\n    <div class="newTicket">\n      <div class="box box--newTicket">\n        <div class="page-header">\n          <h1>'),e.push(this.T("New Ticket")),e.push('</h1>\n        </div>\n\n        <div class="page-content">\n          <form role="form" class="ticket-create" autocomplete="off">\n            <input type="hidden" name="form_id" value="'),e.push(n(this.form_id)),e.push('"/>\n\n            <div class="ticket-form-top"></div>\n            <div class="article-form-top"></div>\n\n            <div class="formset-inset">\n              <div class="ticket-form-middle horizontal two-columns"></div>\n              <div class="ticket-form-bottom"></div>\n            </div>\n\n            <div class="form-controls">\n              <a class="btn btn--text btn--subtle js-cancel" href="#/">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n              <button type="submit" class="btn btn--success js-submit align-right">'),e.push(this.T("Create")),e.push('</button>\n            </div>\n          </form>\n        </div>\n      </div>\n    </div>\n  </div>\n  <div class="tabsSidebar vertical"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="dashboard main flex center">\n  <div class="tabs tabs--big">\n    <div class="tab active" data-area="stat-widgets">'),e.push(this.T("My Stats")),e.push('</div>\n    <div class="tab" data-area="first-steps-widgets">'),e.push(this.T("First Steps")),e.push('</div>\n  </div>\n  <div class="tab-content first-steps-widgets hidden"></div>\n  <div class="tab-content stat-widgets three-columns horizontal"></div>\n</div>\n<div class="sidebar optional">\n  <h2>'),e.push(this.T("Activity Stream")),e.push('</h2>\n  <div class="activity-description">\n    <p>'),e.push(this.T("Here you will find the latest activities of your system.")),e.push("</p>\n    <p>"),e.push(this.T("For example, recently changed tickets, users, or organizations.")),e.push('</p>\n  </div>\n  <div class="activity-entries js-activityContent">\n    <p>'),e.push(this.T("Here you will find the latest activities of your system.")),e.push("</p>\n    <p>"),e.push(this.T("For example, recently changed tickets, users, or organizations.")),e.push("</p>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/activity_stream_item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="js-item activity-entry">\n  <div class="activity-avatar js-avatar"></div>\n  <a href="'),e.push(this.item.link),e.push('" class="activity-body">\n    <span class="activity-message">\n      <span class="activity-text">\n        '),this.item.objectNative&&this.item.objectNative.activityMessage?(e.push("\n          "),e.push(this.item.objectNative.activityMessage(this.item)),e.push("\n        ")):(e.push("\n            Need objectNative in item "),e.push(n(this.item.object)),e.push(".find("),e.push(n(this.item.o_id)),e.push(")\n        ")),e.push("\n      </span>\n      "),e.push(this.humanTime(this.item.created_at,!1,"activity-time")),e.push('\n    </span>\n    <span class="activity-icon">\n      '),this.item.cssIcon&&(e.push("\n      "),e.push(this.Icon(this.item.cssIcon)),e.push("\n      ")),e.push("\n    </span>\n  </a>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/first_steps"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i,s,r,o,a,l;for(e.push('<div class="box box--paper">\n  '),n=0,r=(a=this.data).length;n<r;n++){for(t=a[n],e.push("\n  <h3>"),e.push(this.T(t.name)),e.push("</h3>\n    "),s=0,o=(l=t.items).length;s<o;s++)i=l[s],e.push('\n    <a class="todo '),i.checked&&e.push("is-done"),e.push(" "),i.class&&e.push(i.class),e.push('" href="'),e.push(i.location),e.push('">\n      '),i.checked?(e.push("\n        "),e.push(this.Icon("checkmark")),e.push("\n      ")):(e.push("\n        "),e.push(this.Icon("small-dot")),e.push("\n      ")),e.push("\n      "),e.push(this.T(i.name)),e.push("\n    </a>\n    ");e.push("\n  ")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/first_steps_clues"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="modal-backdrop js-backdrop"></div>\n<div class="modal-spacer js-positionOrigin"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/first_steps_clues_content"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="modal-content">\n  <div class="modal-arrow js-arrow"></div>\n  <div class="modal-close js-close">\n    '),e.push(this.Icon("diagonal-cross")),e.push('\n  </div>\n  <div class="modal-header">'),e.push(this.T(this.headline)),e.push('</div>\n  <div class="modal-body">'),e.push(this.T(this.text)),e.push('</div>\n  <div class="modal-controls">\n    <div class="modal-control">\n      <div class="'),0===this.position&&e.push("is-disabled "),e.push('btn btn--text js-previous">'),e.push(this.T("Previous")),e.push('</div>\n    </div>\n    <div class="modal-control clue-count">'),e.push(n(this.position+1)),e.push("/"),e.push(n(this.max)),e.push('</div>\n    <div class="modal-control">\n      '),this.position+1===this.max?(e.push('\n        <div class="btn btn--text js-next">'),e.push(this.T("Finish")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--text js-next">'),e.push(this.T("Next")),e.push("</div>\n      ")),e.push("\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/first_steps_test_ticket_finish"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>"),e.push(this.T('A test ticket has been created, you can find it in your overview "%s" %l.',this.overviewName,this.overviewUrl)),e.push('</p>\n<div class="centered">\n  <a class="btn btn--success flex" href="'),e.push(this.ticketUrl),e.push('">'),e.push(this.T("Open Ticket# %s",this.ticketNumber)),e.push("</a>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/first_steps_test_ticket_loading"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="wizard-body vertical justified">\n  <p class="wizard-loadingText">\n    <span class="loading icon"></span>\n  </p>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/stats/ticket_channel_distribution"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i;for(n in e.push('<div class="stat-widget vertical">\n  <div class="stat-title">\n    '),e.push(this.T("Channel Distribution")),e.push('\n    <div class="stat-icon-help js-stat-help" title="'),e.push(this.Ti(this.StatsTicketChannelDistribution.description)),e.push('" data-placement="left">\n      '),e.push(this.Icon("help")),e.push('\n    </div>\n  </div>\n  <div class="stat-graphic" data-columns="'),e.push(_.size(this.StatsTicketChannelDistribution.channels)),e.push('">\n    '),i=this.StatsTicketChannelDistribution.channels)t=i[n],e.push('\n      <div class="stats-row">\n        <div title="'),e.push(t.sender),e.push('">\n          '),e.push(this.Icon(t.icon,"stat-channel-icon")),e.push('\n        </div>\n        <div class="stat-bars">\n          <div class="stat-bar stat-bar--inbound" style="height: '),e.push(t.inbound_in_percent),e.push('%" title="'),e.push(this.Ti("Inbound:")),e.push(" "),e.push(t.inbound_in_percent),e.push("% ("),e.push(t.inbound),e.push(')"></div>\n          <div class="stat-bar stat-bar--outbound" style="height: '),e.push(t.outbound_in_percent),e.push('%" title="'),e.push(this.Ti("Outbound:")),e.push(" "),e.push(t.outbound_in_percent),e.push("% ("),e.push(t.outbound),e.push(')"></div>\n        </div>\n        <div class="stat-detail">'),e.push(t.overal_percentage),e.push('%</div>\n      </div>\n      <div class="stat-label"></div>\n    ');e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/stats/ticket_escalation"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="stat-widget vertical">\n  <div class="stat-title">\n    '),e.push(this.T("Mood")),e.push('\n    <div class="stat-icon-help js-stat-help" title="'),e.push(this.Ti(this.StatsTicketEscalation.description)),e.push('" data-placement="bottom">\n      '),e.push(this.Icon("help")),e.push('\n    </div>\n  </div>\n  <div class="stat-graphic">\n    '),e.push(this.Icon("mood-"+this.StatsTicketEscalation.state,"stat-icon mood-icon")),e.push('\n  </div>\n  <div class="stat-label">'),e.push(this.T("%s of my tickets escalated.",this.StatsTicketEscalation.own)),e.push('</div>\n  <div class="stat-detail">'),e.push(this.T("Total: %s",this.StatsTicketEscalation.total)),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/stats/ticket_in_process"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="stat-widget vertical">\n  <div class="stat-title">\n    '),e.push(this.T("My tickets in process")),e.push('\n    <div class="stat-icon-help js-stat-help" title="'),e.push(this.Ti(this.StatsTicketInProcess.description)),e.push('" data-placement="bottom">\n      '),e.push(this.Icon("help")),e.push('\n    </div>\n  </div>\n  <div class="stat-graphic">\n    '),e.push(this.Icon("in-process","in-process-icon "+this.StatsTicketInProcess.state+"-color")),e.push('\n  </div>\n  <div class="stat-label" title="'),e.push(this.T("%s of my tickets are currently in process.",this.StatsTicketInProcess.in_process)),e.push('">'),e.push(this.T("%s% are currently in process",this.StatsTicketInProcess.percent)),e.push('</div>\n  <div class="stat-detail">'),e.push(this.T("Average: %s%",this.StatsTicketInProcess.average_per_agent)),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/stats/ticket_load_measure"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i;for(e.push('<div class="stat-widget vertical">\n  <div class="stat-title">\n    '),e.push(this.T("Assigned")),e.push('\n    <div class="stat-icon-help js-stat-help" title="'),e.push(this.Ti(this.StatsTicketLoadMeasure.description)),e.push('" data-placement="bottom">\n      '),e.push(this.Icon("help")),e.push('\n    </div>\n  </div>\n  <div class="stat-graphic">\n    <div class="stat-tickets vertical reverse end">\n      '),i=parseInt(.16*this.StatsTicketLoadMeasure.percent),e.push("\n      "),t=1,n=i;1<=n?t<=n:t>=n;1<=n?++t:--t)e.push("\n        "),e.push(this.Icon("one-ticket","one-ticket "+this.StatsTicketLoadMeasure.state+"-color")),e.push("\n      ");e.push("\n    </div>\n    "),e.push(this.Icon("total-tickets","total-tickets")),e.push('\n  </div>\n\n  <div class="stat-label">'),e.push(this.T("Tickets assigned to me: %s of %s",this.StatsTicketLoadMeasure.own,this.StatsTicketLoadMeasure.total)),e.push('</div>\n  <div class="stat-detail">'),e.push(this.T("Average: %s",this.StatsTicketLoadMeasure.average_per_agent)),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/stats/ticket_reopen"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="stat-widget vertical">\n  <div class="stat-title">\n    '),e.push(this.T("Reopening rate")),e.push('\n    <div class="stat-icon-help js-stat-help" title="'),e.push(this.Ti(this.StatsTicketReopen.description)),e.push('" data-placement="left">\n      '),e.push(this.Icon("help")),e.push('\n    </div>\n  </div>\n  <div class="stat-graphic">\n    '),e.push(this.Icon("reopening","reopening-icon "+this.StatsTicketReopen.state+"-color")),e.push('\n  </div>\n  <div class="stat-label">'),e.push(this.T("%s% have been reopened",this.StatsTicketReopen.percent)),e.push('</div>\n  <div class="stat-detail">'),e.push(this.T("Average: %s%",this.StatsTicketReopen.average_per_agent)),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/dashboard/stats/ticket_waiting_time"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="time stat-widget vertical">\n  <div class="stat-title">\n    '),e.push(this.T("\u2205 Waiting time today")),e.push('\n    <div class="stat-icon-help js-stat-help" title="'),e.push(this.Ti(this.StatsTicketWaitingTime.description)),e.push('" data-placement="bottom">\n      '),e.push(this.Icon("help")),e.push('\n    </div>\n  </div>\n  <div class="stat-graphic">\n    <div class="stat-stopwatch centered">\n      '),e.push(this.Icon("stopwatch","stat-icon stopwatch-icon")),e.push('\n      <canvas class="stat-dial"></canvas>\n      <div class="stat-amount"></div>\n    </div>\n  </div>\n  <div class="stat-label">'),e.push(this.T("My handling time: %s minutes",this.StatsTicketWaitingTime.handling_time)),e.push('</div>\n  <div class="stat-detail">'),e.push(this.T("Average: %s minutes",this.StatsTicketWaitingTime.average_per_agent)),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/data_privacy/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Data Privacy")),e.push(" <small>"),e.push(this.T("Management")),e.push('</small></h1>\n  </div>\n\n  <div class="page-header-meta">\n    <a class="btn js-description">'),e.push(this.T("Description")),e.push('</a>\n    <a class="btn btn--success js-new">'),e.push(this.T("New Deletion Task")),e.push('</a>\n  </div>\n</div>\n\n<div class="page-content">\n'),this.taskCount<1?(e.push('\n  <div class="page-description">\n    '),e.push(this.description),e.push("\n  </div>\n  ")):(e.push("\n  "),this.runningTaskCount&&(e.push("\n  <h2>"),e.push(this.T("Running Tasks")),e.push("</h2>\n  "),e.push(this.runningTasksHTML),e.push("\n  ")),e.push("\n  "),this.failedTaskCount&&(e.push('\n  <div class="spacer"></div>\n  <h2>'),e.push(this.T("Failed Tasks")),e.push("</h2>\n  "),e.push(this.failedTasksHTML),e.push("\n  ")),e.push("\n  "),this.completedTaskCount&&(e.push('\n  <div class="spacer"></div>\n  <h2>'),e.push(this.T("Completed Tasks")),e.push("</h2>\n  "),e.push(this.completedTasksHTML),e.push("\n  ")),e.push("\n")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/data_privacy/preview"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="js-preview" data-userid="'),e.push(n(this.user_id)),e.push('">\n  <div class="form-group js-deleteOrganzation">\n    '),e.push(this.delete_organization_html),e.push('\n  </div>\n  <div class="form-group">\n      <h3>'),e.push(this.T("Preview customer tickets")),e.push(' <span class="subtitle js-previewCounterContainer">(<span class="js-previewCounter">'),e.push(n(this.customer_count)),e.push("</span> "),e.push(this.T("matches found")),e.push(")</span></h3>\n      <p>"),e.push(this.T("Customer tickets of the user will get deleted on execution of the task. No rollback possible.")),e.push('</p>\n      <div class="js-previewTableCustomer"></div>\n    '),this.owner_count>0&&(e.push("\n      <h3>"),e.push(this.T("Preview owner tickets")),e.push('<span class="subtitle js-previewCounterContainer"> <span class="u-highlight js-previewCounter">'),e.push(n(this.owner_count)),e.push("</span> "),e.push(this.T("matches found")),e.push("</span></h3>\n      <p>"),e.push(this.T("Owner tickets of the user will not get deleted. The owner will be mapped to the system user (ID 1).")),e.push('</p>\n      <div class="js-previewTableOwner"></div>\n    ')),e.push('\n  </div>\n  <div class="form-group js-sure">\n    <h3 class="danger-color">'),e.push(this.T("Warning")),e.push('</h3>\n    <p class="danger-color">'),e.push(this.T('There is no rollback of this deletion possible. If you are sure that you wish to proceed, please type "%s" into the input.',App.i18n.translatePlain("delete").toUpperCase())),e.push("</p>\n    "),e.push(this.sure_html),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/data_privacy/tasks"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(this.tasks.length>0){for(e.push("\n"),t=0,i=(s=this.tasks).length;t<i;t++)r=s[t],e.push('\n  <div class="action '),"completed"===r.state&&e.push("is-inactive"),e.push('" data-id="'),e.push(r.id),e.push('">\n    <div class="action-row">\n      <div class="action-flow action-flow--noWrap">\n        '),r.preferences.user?(e.push("\n          <h2>"),e.push(this.T("Delete User")),e.push("</h2>\n        ")):r.preferences.ticket&&(e.push("\n          <h2>"),e.push(this.T("Delete Ticket")),e.push("</h2>\n        ")),e.push('\n      </div>\n    </div>\n    <div class="action-flow action-flow--row">\n      <div class="action-block action-block--flex">\n        '),r.preferences.user?(e.push('\n          <div class="label">'),e.push(this.T("User (censored):")),e.push("</div>\n          "),e.push(n(r.preferences.user.firstname)),e.push(" "),e.push(n(r.preferences.user.lastname)),e.push(" ("),e.push(n(r.preferences.user.email)),e.push(")\n          "),r.preferences.delete_organization&&(e.push('\n          <br><br>\n          <div class="label">'),e.push(this.T("Deleted Organization:")),e.push("</div>\n          "),e.push(n(r.preferences.user.organization)),e.push("\n          ")),e.push("\n        ")):r.preferences.ticket&&(e.push('\n          <div class="label">'),e.push(this.T("Ticket (censored):")),e.push("</div>\n          "),e.push(n(r.preferences.ticket.title)),e.push("\n        ")),e.push('\n        <br><br>\n        <div class="label">'),e.push(this.T("Started")),e.push("</div>\n        "),e.push(this.humanTime(r.created_at)),e.push('\n        <br><br>\n        <div class="label">'),e.push(this.T("State")),e.push("</div>\n        "),r.state?e.push(n(this.T(r.state))):e.push(this.T("in process")),e.push("\n        "),r.preferences.error&&(e.push(" ("),e.push(n(r.preferences.error)),e.push(")")),e.push("\n      </div>\n      "),(r.preferences.user||r.preferences.ticket)&&(e.push('\n        <div class="action-block action-block--flex">\n        '),r.preferences.customer_tickets&&(e.push('\n          <div class="label">'),e.push(this.T("Deleted tickets (%s in total):",r.preferences.customer_tickets_count||r.preferences.customer_tickets.length)),e.push('</div>\n          <div class="ticket-list">\n          '),r.preferences.customer_tickets.length>0?(e.push("\n            "),e.push(n(r.preferences.customer_tickets.slice(0,50).join(", "))),r.preferences.customer_tickets.length>50&&(e.push(', ... <br><div href="#" class="btn btn--text js-toggle-tickets" data-type="customer_tickets" data-id="'),e.push(n(r.id)),e.push('">'),e.push(this.T("See more")),e.push("</div>")),e.push("\n          ")):e.push("\n            -\n          "),e.push("\n            </div>\n        ")),e.push("\n        <br><br>\n        "),r.preferences.owner_tickets&&(e.push('\n          <div class="label">'),e.push(this.T("Previously owned tickets (%s in total):",r.preferences.owner_tickets_count||r.preferences.owner_tickets.length)),e.push('</div>\n          <div class="ticket-list">\n          '),r.preferences.owner_tickets.length>0?(e.push("\n            "),e.push(n(r.preferences.owner_tickets.slice(0,50).join(", "))),r.preferences.owner_tickets.length>50&&(e.push(', ... <br><div href="#" class="btn btn--text js-toggle-tickets" data-type="owner_tickets" data-id="'),e.push(n(r.id)),e.push('">'),e.push(this.T("See more")),e.push("</div>")),e.push("\n          ")):e.push("\n            -\n          "),e.push("\n          </div>\n        ")),e.push("\n        </div>\n      ")),e.push("\n    </div>\n  </div>\n");e.push("\n")}else e.push('\n  <div class="action action--placeholder">\n    '),e.push(this.T("None")),e.push("\n  </div>\n");e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/exchange/admin_consent"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>\n  "),e.push(this.T("The admin consent request was sent to your administrator.")),e.push("<br>\n  "),e.push(this.T("Please wait until you received the notification email of the approval.")),e.push("<br><br>\n  "),e.push(this.T("After approval, please re-connect your Exchange account.")),e.push("<br>\n</p>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/exchange/app_config"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i;e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<p>\n  '),e.push(this.T("You can find a tutorial on how to manage an %s in our online documentation %l.","Exchange App","https://admin-docs.zammad.org/en/latest/system/integrations/exchange.html")),e.push("\n</p>\n<fieldset>\n  <h2>"),e.push(this.T("Enter your %s App Keys","Exchange")),
e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="client_id">'),e.push(this.T("Client ID")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="client_id" type="text" name="client_id" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.client_id)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="client_secret">'),e.push(this.T("Client Secret")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="client_secret" type="text" name="client_secret" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.client_secret)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="client_tenant">'),e.push(this.T("Tenant UUID/Name")),e.push('</label>\n    </div>\n    <div class="controls">\n      <input id="client_tenant" type="text" name="client_tenant" value="'),e.push(n(null!=(t=this.external_credential)&&null!=(i=t.credentials)?i.client_tenant:void 0)),e.push('" class="form-control" required autocomplete="off" placeholder="common">\n    </div>\n  </div>\n  <h2>'),e.push(this.T("Your callback URL")),e.push('</h2>\n  <div class="input form-group">\n    <div class="controls">\n      <input class="form-control js-select" readonly value="'),e.push(n(this.callbackUrl)),e.push('">\n    </div>\n  </div>\n</fieldset>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/exchange/oauth_intro"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <h2>'),e.push(this.T("OAuth Configuration")),e.push('</h2>\n</div>\n\n<div class="page-content">\n  <div class="page-description">\n    <p>'),e.push(this.T("You can connect %s with Zammad. But first, you will have to connect your Zammad with %s.","Microsoft 365 Accounts","Microsoft 365")),e.push('</p>\n    <div class="btn btn--success js-config-app">'),e.push(this.T("Connect Exchange App")),e.push("</div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/exchange/token_information"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <h2>'),e.push(this.T("OAuth Configuration")),e.push('</h2>\n\n  <div class="page-header-meta">\n    <a class="btn js-config-app">'),e.push(this.T("Configure App")),e.push("</a>\n  "),_.isEmpty(this.oauth)&&(e.push('\n    <a class="btn btn--success js-new-app">'),e.push(this.T("Add Account")),e.push('</a>\n    <a class="btn btn--success js-admin-consent">'),e.push(this.T("Request Admin Consent")),e.push("</a>\n  ")),e.push('\n  </div>\n</div>\n\n<div class="page-content">\n'),_.isEmpty(this.oauth)?(e.push('\n  <table class="table table--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n")):(e.push('\n  <div class="action">\n    <div class="action-flow" style="width: 100%;">\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),void 0===this.oauth.status||200===this.oauth.status?e.push(this.Icon("status","ok inline")):e.push(this.Icon("status","error inline")),e.push(" "),e.push(this.T("Configuration")),e.push('</h3>\n        </div>\n\n        <table class="key-value">\n          <tr>\n            <td>'),e.push(this.T("Client ID")),e.push("\n            <td>"),e.push(n(this.external_credential.credentials.client_id)),e.push("\n          <tr>\n            <td>"),e.push(this.T("Tenant UUID/Name")),e.push("\n            <td>"),e.push(n(this.external_credential.credentials.client_tenant)),e.push('\n        </table>\n      </div>\n    </div>\n\n    <div class="action-controls">\n      <div class="btn btn--danger btn--secondary js-delete-app">'),e.push(this.T("Delete")),e.push('</div>\n      <div class="btn btn--secondary js-reauthenticate-app">'),e.push(this.T("Reauthenticate")),e.push("</div>\n    </div>\n  </div>\n")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/facebook/account_edit"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<fieldset>\n\n  <h1>'),e.push(this.T("Pages")),e.push('</h1>\n  <p class="description">'),e.push(this.T("Choose the group to which page posts will get added.")),e.push('</p>\n  <div class="js-pages">\n    '),this.channel.options.pages){for(e.push("\n      "),t=0,i=(r=this.channel.options.pages).length;t<i;t++)s=r[t],e.push("\n        <h2>"),e.push(n(s.name)),e.push('</h2>\n        <div data-page-id="'),e.push(n(s.id)),e.push('" class="js-groups"></div>\n      ');e.push("\n    ")}e.push("\n  </div>\n\n</fieldset>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/facebook/app_config"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<p>\n  '),e.push(this.T("You can find a tutorial on how to manage a %s in our online documentation %l.","Facebook App","https://admin-docs.zammad.org/en/latest/channels/facebook.html")),e.push("\n</p>\n<fieldset>\n  <h2>"),e.push(this.T("Enter your %s App Keys","Facebook")),e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="application_id">'),e.push(this.T("Facebook APP ID")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="application_id" type="text" name="application_id" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.application_id)),e.push('" class="form-control" required autocomplete="off">\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="application_secret">'),e.push(this.T("Facebook App Secret")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="application_secret" type="text" name="application_secret" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.application_secret)),e.push('" class="form-control" required autocomplete="off">\n    </div>\n  </div>\n  <h2>'),e.push(this.T("Your callback URL")),e.push('</h2>\n  <div class="input form-group">\n    <div class="controls">\n      <input class="form-control js-select" readonly value="'),e.push(n(this.callbackUrl)),e.push('">\n    </div>\n  </div>\n</fieldset>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/facebook/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Facebook")),e.push(" <small>"),e.push(this.T("Accounts")),e.push('</small></h1>\n  </div>\n</div>\n\n<div class="page-content">\n  <div class="page-description">\n    <p>'),e.push(this.T("You can connect %s with Zammad. But first, you will have to connect your Zammad with %s.","Facebook Accounts","Facebook")),e.push('</p>\n    <div class="btn btn--success js-configApp">'),e.push(this.T("Connect Facebook App")),e.push("</div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/facebook/list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Facebook")),e.push(" <small>"),e.push(this.T("Accounts")),e.push('</small></h1>\n  </div>\n\n  <div class="page-header-meta">\n    <a class="btn js-configApp">'),e.push(this.T("Configure App")),e.push('</a>\n    <a class="btn btn--success js-new">'),e.push(this.T("Add Account")),e.push('</a>\n  </div>\n</div>\n\n<div class="page-content">\n'),i=0,r=(l=this.channels).length;i<r;i++){if(t=l[i],e.push('\n  <div class="action '),!0!==t.active&&e.push("is-inactive"),e.push('" data-id="'),e.push(n(t.id)),e.push('">\n    <div class="action-block action-row">\n      <h2>'),e.push(this.Icon("status","supergood-color inline")),e.push(" "),e.push(n(t.options.user.name)),e.push(' <span class="text-muted">'),e.push(n(t.options.user.id)),e.push('</span></h2>\n    </div>\n    <div class="action-flow action-flow--row">\n      <div class="action-block">\n        <h3>'),e.push(this.T("Pages")),e.push("</h3>\n        "),t.options.pages){for(e.push("\n          "),s=0,o=(c=t.options.pages).length;s<o;s++)a=c[s],e.push("\n            "),e.push(n(a.name)),e.push(" -> "),e.push(n(a.groupName)),e.push("<br>\n          ");e.push("\n        ")}e.push('\n      </div>\n    </div>\n    <div class="action-controls">\n      <div class="btn btn--danger btn--secondary js-delete">'),e.push(this.T("Delete")),e.push("</div>\n      "),!0===t.active?(e.push('\n        <div class="btn btn--secondary js-disable">'),e.push(this.T("Disable")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--secondary js-enable">'),e.push(this.T("Enable")),e.push("</div>\n      ")),e.push('\n      <div class="btn js-edit">'),e.push(this.T("Edit")),e.push("</div>\n    </div>\n  </div>\n")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/actions"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="dropdown dropdown--actions">\n  <div class="dropdown-toggle" id="userAction" data-toggle="dropdown">\n    '),"small"!==this.type&&(e.push("\n      "),e.push(this.Icon("cog","dropdown-icon")),e.push("\n      <label>"),e.push(this.T("Action")),e.push("</label>\n    ")),e.push("\n    "),e.push(this.Icon("arrow-down")),e.push('\n  </div>\n  <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="userAction">\n    '),t=0,s=(r=this.items).length;t<s;t++)i=r[t],e.push('\n      <li role="presentation" data-type="'),e.push(n(i.name)),e.push('"><a role="menuitem" tabindex="-1" href="#">'),e.push(this.T(i.title)),e.push("</a>\n    ");e.push("\n  </ul>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/admin/empty"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>"),e.push(this.T(this.explanation)),e.push('</p>\n\n<table class="table table--placeholder">\n  <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n</table>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/admin/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T(this.head)),(this.subHead||void 0===this.subHead)&&(e.push(" <small>"),e.push(this.T(this.subHead||"Management")),e.push("</small>")),e.push('</h1>\n  </div>\n  <div class="page-header-meta">\n    '),this.showDescription&&(e.push('\n      <a class="btn js-description">'),e.push(this.T("Description")),e.push("</a>\n    ")),e.push("\n    "),this.buttons){for(e.push("\n      "),i=0,o=(l=this.buttons).length;i<o;i++){if(t=l[i],e.push("\n        "),t.menu){for(e.push('\n          <div class="buttonDropdown dropdown">\n            <button data-type="'),e.push(n(t["data-type"])),e.push('" class="btn btn--split--first '),e.push(n(t.class)),e.push('" href="'),e.push(n(t.href)),e.push('">'),e.push(this.T(t.name)),e.push('</button>\n            <button class="btn btn--slim btn--split--last '),e.push(n(t.class)),e.push('" data-toggle="dropdown" data-bs-auto-close="outside">'),e.push(this.Icon("arrow-down")),e.push('</button>\n            <ul class="dropdown-menu dropdown-menu" role="menu" aria-labelledby="userAction">\n            '),r=0,a=(c=t.menu).length;r<a;r++)s=c[r],e.push('\n              <li class="'),e.push(n(s.class)),e.push('" role="menuitem" data-type="'),e.push(n(s["data-type"])),e.push('">'),e.push(this.T(s.name)),e.push("</li>\n            ");e.push("\n            </ul>\n          </div>\n        ")}else e.push('\n          <a data-type="'),e.push(n(t["data-type"])),e.push('" class="btn '),e.push(n(t.class)),e.push('" href="'),e.push(n(t.href)),e.push('">'),e.push(this.T(t.name)),e.push("</a>\n        ");e.push("\n      ")}e.push("\n    ")}e.push('\n  </div>\n</div>\n\n<div class="page-content">\n  <div class="table-overview"></div>\n</div>\n\n<div class="page-footer"></div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/admin_level2/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="sidebar">\n\n  <ul class="nav nav-pills nav-stacked">\n  '),this.menus){for(e.push("\n    "),t=0,i=(r=this.menus).length;t<i;t++)s=r[t],e.push('\n      <li class="'),e.push(n(s.class)),e.push('"><a href="'),e.push(n(this.page.nav)),e.push("/"),e.push(n(s.target)),e.push('" data-toggle="tabnav" data-target="'),e.push(n(s.target)),e.push('" >'),e.push(this.T(s.name)),e.push("</a></li>\n    ");e.push("\n  ")}e.push('\n  </ul>\n\n</div>\n<div class="main flex">\n\n  <div class="page-header">\n    <div class="page-header-title">\n      <h1>'),e.push(this.T(this.page.head)),e.push(" <small>"),e.push(this.T(this.page.sub_head)),e.push('</small></h1>\n    </div>\n  </div>\n  <div class="page-content">\n    <div class="nav-tab-content"></div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/application_selector"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="horizontal-filters-alert alert alert--danger js-alert hidden" role="alert"></div>\n<div class="horizontal-filters js-filter '),this.has_expert_conditions&&e.push("horizontal-filters--with-switch"),e.push('"></div>\n'),this.has_expert_conditions&&(e.push('\n<div class="horizontal-filters-switch">\n  <label>\n    '),e.push(this.T("Expert mode")),e.push('\n    <div class="zammad-switch zammad-switch--small js-switch">\n        <input type="checkbox" id="expert-mode-switch" '),this.is_expert_mode&&e.push("checked"),e.push('>\n        <label for="expert-mode-switch"></label>\n    </div>\n  </label>\n</div>\n')),e.push('\n<div class="js-preview '),!1===this.attribute.preview&&e.push("hide"),e.push('">\n  <h3>'),e.push(this.T("Preview")),e.push('<span class="subtitle js-previewCounterContainer hide"> (<span class="js-previewCounter">?</span> '),e.push(this.T("matches found")),e.push(')</span> <span class="tiny loading icon js-previewLoader hide" style="margin-left: 3px;"></span></h3>\n  <div class="js-previewTable"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/application_selector_empty"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<input type="hidden" class="empty" name="'),e.push(n(this.attribute.name)),e.push('::" value="" />\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/application_selector_row"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="horizontal-filter js-filterElement" '),this.has_expert_conditions&&(e.push('data-level="'),e.push(n(this.level)),e.push('"')),e.push(">\n"),this.has_expert_conditions&&(e.push('\n  <div class="draggable">'),e.push(this.Icon("draggable")),e.push("</div>\n")),e.push('\n  <div class="horizontal-filter-body">\n    <div class="controls">\n      <div class="u-positionOrigin js-attributeSelector">\n        '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n      </div>\n    </div>\n    <div class="controls">\n      <div class="u-positionOrigin js-operator">\n        <select></select>\n        '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push("\n      </div>\n    </div>\n  "),this.pre_condition&&(e.push('\n    <div class="controls">\n      <div class="u-positionOrigin js-preCondition">\n        <select></select>\n        '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push("\n      </div>\n    </div>\n  ")),e.push('\n    <div class="controls form-group js-value horizontal horizontal-filter-value"></div>\n  </div>\n  <div class="filter-controls">\n    <div class="filter-control filter-control-remove js-remove" title="'),e.push(this.Ti("Remove")),e.push('">\n      '),e.push(this.Icon("minus-small")),e.push("\n    </div>\n  "),this.has_expert_conditions?(e.push('\n    <div class="filter-control filter-control-add js-add" title="'),e.push(this.Ti("Add condition")),e.push('">\n      '),e.push(this.Icon("plus-small")),e.push('\n    </div>\n    <div class="filter-control filter-control-subclause js-subclause" title="'),e.push(this.Ti("Add subclause")),e.push('">\n      '),e.push(this.Icon("subclause-small")),e.push("\n    </div>\n  ")):(e.push('\n    <div class="filter-control filter-control-add js-add" title="'),e.push(this.Ti("Add")),e.push('">\n      '),e.push(this.Icon("plus-small")),e.push("\n    </div>\n  ")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/application_selector_subclause"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="horizontal-filter js-filterElement '),this.is_first&&e.push("unsortable"),e.push('" data-subclause="true" '),this.is_first||(e.push('data-level="'),e.push(n(this.level)),e.push('"')),e.push(">\n"),this.is_first?e.push('\n  <div class="js-expertConditions"></div>\n'):(e.push('\n  <div class="draggable">'),e.push(this.Icon("draggable")),e.push("</div>\n")),e.push('\n  <div class="horizontal-filter-body">\n    <div class="controls">\n      <div class="u-positionOrigin js-subclauseSelector">\n        '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n      </div>\n    </div>\n  </div>\n  <div class="filter-controls">\n    <div class="filter-control filter-control-remove '),this.is_first?e.push("is-disabled"):e.push("js-remove"),e.push('" title="'),e.push(this.Ti("Remove")),e.push('">\n      '),e.push(this.Icon("minus-small")),e.push('\n    </div>\n    <div class="filter-control filter-control-add js-add" title="'),e.push(this.Ti("Add condition")),e.push('">\n      '),e.push(this.Icon("plus-small")),e.push('\n    </div>\n    <div class="filter-control filter-control-subclause js-subclause" title="'),e.push(this.Ti("Add subclause")),e.push('">\n      '),e.push(this.Icon("subclause-small")),e.push("\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/attachment"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t;e.push('<div class="attachments"></div>\n<div class="article-attachment">\n  '),this.attribute.disabled||(e.push('\n  <div class="attachmentPlaceholder">\n    <span class="attachmentPlaceholder-inputHolder fileUpload">\n      '),t=_.uniqueId("fileUpload_"),e.push('\n      <input multiple="multiple" type="file" name="file" id="'),e.push(t),e.push('">\n      <label class="attachmentPlaceholder-label" for="'),e.push(t),e.push('">\n        '),e.push(this.T("select attachment\u2026")),e.push("\n      </label>\n    </span>\n  </div>\n  ")),e.push('\n  <div class="attachmentUpload hide">\n    <div class="horizontal">\n      <div class="u-highlight">\n        '),e.push(this.T("Uploading")),e.push(' (<span class="js-percentage">0</span>%) ...\n      </div>\n      <div class="attachmentUpload-cancel js-cancel">\n        '),e.push(this.Icon("diagonal-cross")),e.push(this.T("Cancel Upload")),e.push('\n      </div>\n    </div>\n    <div class="attachmentUpload-progressBar" style="width: 0%"></div>\n  </div>\n</div>\n<div class="fit dropArea">\n  <div class="dropArea-inner">\n    '),e.push(this.T("Drop files here")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/attachment_item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="attachment attachment--row">\n  <div class="attachment-name">'),e.push(n(this.filename)),e.push('</div>\n  <div class="attachment-size">'),e.push(n(this.humanFileSize(this.size))),e.push('</div>\n  <div class="attachment-delete js-delete" data-id="'),e.push(n(this.id)),e.push('">\n    '),e.push(this.Icon("diagonal-cross")),e.push(this.T("Delete File")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/attachments"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(!_.isEmpty(this.attachments)){for(e.push('\n  <div class="attachments attachments--list">\n    '),e.push(this.Icon("paperclip")),e.push('\n    <div class="attachments-title">'),e.push(this.attachments.length),e.push(" "),e.push(this.T("Attached Files")),e.push("</div>\n    "),s=0,r=(o=this.attachments).length;s<r;s++)t=o[s],e.push("\n      "),this.C("ui_ticket_zoom_attachments_preview")?(e.push("\n        "),i=this.ContentOrMimeType(t),e.push('\n        <a class="attachment attachment--preview '),this.ContentTypeIcon(i)&&e.push(this.ContentTypeIcon(i)),e.push('" href="'),e.push(n(t.url)),e.push('" data-type="attachment" data-preview-url="'),e.push(n(t.preview_url)),e.push('" data-id="'),e.push(n(t.id)),e.push('" '),this.canDownload(i)?e.push(" download"):e.push('target="_blank"'),e.push('>\n          <div class="attachment-icon js-preview">\n          '),t.preferences&&i&&this.ContentTypeIcon(i)?(e.push("\n            "),this.canPreview(i)?(e.push('\n              <img src="'),e.push(n(t.preview_url)),e.push('">\n            ')):(e.push("\n              "),e.push(this.Icon(this.ContentTypeIcon(i))),e.push("\n            ")),e.push("\n          ")):(e.push("\n            "),e.push(this.Icon("file-unknown")),e.push("\n          ")),e.push('\n          </div>\n          <div class="attachment-text">\n            <span class="attachment-name u-highlight">'),e.push(n(t.filename)),e.push('</span>\n            <div class="attachment-size">'),e.push(this.humanFileSize(t.size)),e.push("</div>\n          </div>\n          "),"file-calendar"===this.ContentTypeIcon(i)&&(e.push('\n            <div class="half-spacer"></div>\n            <button class="btn btn--action btn--small  js-preview" type="button">'),e.push(this.T("Preview")),e.push("</button>\n          ")),e.push("\n        </a>\n      ")):(e.push('\n        <div class="attachment attachment--row">\n          <a class="attachment-name u-highlight" href="'),e.push(n(t.url)),e.push('" data-type="attachment" '),this.canDownload(i)?e.push("download"):e.push('target="_blank"'),e.push(">"),e.push(n(t.filename)),e.push('</a>\n          <div class="attachment-size">'),e.push(this.humanFileSize(t.size)),e.push("</div>\n        </div>\n      ")),e.push("\n    ");e.push("\n  </div>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/attribute"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div data-attribute-name="'),e.push(n(this.attribute.name)),e.push('" class="'),e.push(n(this.attribute.tag)),e.push(" form-group"),"block"===this.attribute.style&&e.push(n(" form-group--block")),this.attribute.item_class&&e.push(n(" "+this.attribute.item_class)),this.attribute.null||e.push(n(" is-required")),!1===this.attribute.shown&&e.push(n(" is-hidden is-removed hide")),e.push('"'),this.attribute.grid_width&&e.push(n(" data-width="+this.attribute.grid_width)),e.push(">\n  "),"block"===this.attribute.style&&e.push("\n  <h2>\n  "),e.push('\n  <div class="formGroup-label">\n    '),this.attribute.collapsible&&(e.push('\n      <a data-toggle="collapse" href="#collapse-'),e.push(n(this.attribute.id)),e.push('"'),_.isEmpty(this.attribute.value)&&e.push(' class="collapsed"'),e.push(">\n    ")),e.push('\n    <label for="'),e.push(n(this.attribute.id)),e.push('"'),this.attribute.label_class&&(e.push(' class="'),e.push(n(this.attribute.label_class)),e.push('"')),e.push(">\n      "),this.attribute.collapsible&&(e.push("\n      "),e.push(this.Icon("arrow-right")),e.push("\n      "),e.push(this.Icon("arrow-down")),e.push("\n      ")),e.push("\n      "),e.push(this.T(this.attribute.display)),e.push("\n      <span>"),this.attribute.null||e.push("*"),e.push("</span>\n    </label>\n    "),this.attribute.collapsible&&e.push("</a>"),e.push("\n    "),e.push(this.item),e.push("\n    "),this.bookmarkable&&e.push('\n    <div class="align-right js-bookmark formGroup-bookmark">\n      <div class="filled bookmark icon"></div>\n    </div>\n    '),e.push("\n    "),this.attribute.note&&(e.push('\n    <div class="help-message js-helpMessage" title="'),e.push(this.Ti(this.attribute.note)),e.push('">\n      '),e.push(this.Icon("help")),e.push("\n    </div>\n    ")),e.push("\n  </div>\n  "),"block"===this.attribute.style&&(e.push('\n  </h2>\n  <p class="help-text">'),this.attribute.help&&e.push(this.T(this.attribute.help)),e.push(this.attribute.helpLink),e.push("</p>\n  ")),e.push('\n  <div class="controls '),"url"!==this.attribute.type&&_.isEmpty(this.attribute.linktemplate)||_.isEmpty(this.placeholderObjects)||e.push("controls--button ignore-readonly"),e.push('">\n    '),"url"!==this.attribute.type&&_.isEmpty(this.attribute.linktemplate)||_.isEmpty(this.placeholderObjects)||(e.push('\n    <a href="'),"url"===this.attribute.type?e.push(n(this.placeholderObjects[this.className.toLowerCase()][this.attribute.name])):e.push(this.replacePlaceholder(this.attribute.linktemplate,this.placeholderObjects,!0)),e.push('" class="controls-button" target="_blank" rel="nofollow">\n      <span class="controls-button-inner">'),e.push(this.Icon("external")),e.push("</span>\n    </a>\n    ")),e.push('\n    <span class="help-inline"></span>\n    '),"block"!==this.attribute.style&&(e.push('\n    <span class="help-block">'),this.attribute.help&&e.push(this.T(this.attribute.help)),e.push(this.attribute.helpLink),e.push("</span>\n    ")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),
this.JST["app/views/generic/auth_provider"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<input type="text" disabled="disabled" readonly="readonly" value="'),e.push(n(this.attribute.value)),e.push('" class="form-control" />\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/autocompletion"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<input id="'),e.push(n(this.attribute.id)),e.push('" type="hidden" name="'),e.push(n(this.attribute.name)),e.push('" value="'),e.push(n(this.attribute.value)),e.push('" '),e.push(n(this.attribute.required)),e.push(' />\n<input id="'),e.push(n(this.attribute.id)),e.push('_autocompletion" type="text" name="'),e.push(n(this.attribute.name)),e.push('_autocompletion" value="'),e.push(n(this.attribute.valueShown)),e.push('" class="form-control '),e.push(n(this.attribute.class)),e.push('" '),e.push(n(this.attribute.required)),e.push(" "),e.push(n(this.attribute.autofocus)),e.push(" "),e.push(this.attribute.autocapitalize),e.push(" "),this.attribute.placeholder&&(e.push('placeholder="'),e.push(this.Ti(this.attribute.placeholder)),e.push('"')),e.push(' autocomplete="off"/>\n<input id="'),e.push(n(this.attribute.id)),e.push('_autocompletion_value_shown" type="hidden" name="'),e.push(n(this.attribute.name)),e.push('_autocompletion_value_shown" value="'),e.push(n(this.attribute.valueShown)),e.push('"/>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/business_hours"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u;for(s in e.push("<thead>\n  <tr>\n    "),r=this.days)t=r[s],e.push('\n    <th style="text-align: center">\n      <label class="day-name u-textTruncate">\n        <span class="checkbox-replacement checkbox-replacement--inline">\n          <input class="js-toggle-day" name="'),e.push(n(this.attribute.name)),e.push("::"),e.push(s),e.push('::active" value="true" data-target="'),e.push(s),e.push('" type="checkbox"'),this.hours[s].active&&e.push(" checked"),e.push(">\n          "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </span>\n        <span class="label-text">'),e.push(t),e.push("</span>\n      </label>\n    ");for(e.push("\n</thead>\n<tbody>\n  "),u=i=0,o=this.maxTimeframes-1;0<=o?i<=o:i>=o;u=0<=o?++i:--i){for(s in e.push("\n  <tr>\n    "),a=this.days)t=a[s],e.push("\n      "),this.hours[s].timeframes[u]?(e.push('\n      <td data-day="'),e.push(s),e.push('" data-slot="'),e.push(u),e.push('" class="form-group day-time'),this.hours[s].active&&e.push(" is-active"),e.push('">\n        <label for="'),e.push(s),e.push('_start_time">'),e.push(this.T("From")),e.push('</label>\n        <input type="text" id="'),e.push(s),e.push('_start_time" name="'),e.push(n(this.attribute.name)),e.push("::"),e.push(s),e.push('::start" value="'),e.push(this.hours[s].timeframes[u][0]),e.push('" data-day="'),e.push(s),e.push('" data-slot="'),e.push(u),e.push('" data-i="0" class="form-control form-control--small time js-time">\n        <label for="'),e.push(s),e.push('_end_time">'),e.push(this.T("Till")),e.push('</label>\n        <input type="text" id="'),e.push(s),e.push('_end_time" name="'),e.push(n(this.attribute.name)),e.push("::"),e.push(s),e.push('::end" value="'),e.push(this.hours[s].timeframes[u][1]),e.push('" data-day="'),e.push(s),e.push('" data-slot="'),e.push(u),e.push('" data-i="1" class="form-control form-control--small time js-time">\n      ')):e.push('\n      <td class="empty-cell">\n      '),e.push("\n    ");e.push("\n  ")}if(e.push("\n\n  "),this.maxTimeframes>1){for(s in e.push("\n  <tr>\n    "),l=this.days)t=l[s],e.push("\n      "),this.hours[s].timeframes.length>1?(e.push('\n      <td data-day="'),e.push(s),e.push('" class="settings-list-action-cell js-remove-time'),this.hours[s].active&&e.push(" is-active"),e.push('">\n        '),e.push(this.Icon("minus-small")),e.push("\n      ")):e.push('\n      <td class="empty-cell">\n      '),e.push("\n    ");e.push("\n  ")}for(s in e.push("\n\n  <tr>\n    "),c=this.days)t=c[s],e.push('\n    <td data-day="'),e.push(s),e.push('" class="settings-list-action-cell js-add-time'),this.hours[s].active&&e.push(" is-active"),e.push('">\n      '),e.push(this.Icon("plus-small")),e.push("\n    ");e.push("\n</tbody>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/calender_preview"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;if(_.isEmpty(this.events))e.push("\n  <div>"),e.push(this.T("No Entries")),e.push("</div>\n");else{for(e.push("\n  "),s=0,o=(l=this.events).length;s<o;s++){if(i=l[s],e.push('\n    <article class="calendar-events">\n      <h2 class="title">'),e.push(n(i.title)),e.push("</h2>\n      "),_.isEmpty(i.location)||(e.push("\n        <h4>"),e.push(this.T("Location")),e.push("</h4>\n        <p>"),e.push(App.Utils.linkify(i.location)),e.push("</p>\n      ")),e.push('\n      <div class="event-row">\n        <div>\n          <h4>'),e.push(this.T("From")),e.push("</h4>\n          <p>"),e.push(this.datetime(i.start_date)),e.push("</p>\n        </div>\n        <div>\n          <h4>"),e.push(this.T("Till")),e.push("</h4>\n          <p>"),e.push(this.datetime(i.end_date)),e.push('</p>\n        </div>\n      </div>\n      <div class="event-row">\n        '),_.isEmpty(i.organizer)||(e.push("\n          <div>\n          <h4>"),e.push(this.T("Organizer")),e.push("</h4>\n          <p>"),e.push(n(i.organizer)),e.push("</p>\n          </div>\n        ")),e.push("\n        "),!_.isEmpty(i.attendees)){for(e.push("\n          <div>\n          <h4>"),e.push(this.T("Attendees")),e.push("</h4>\n          <ul>\n            "),r=0,a=(c=i.attendees).length;r<a;r++)t=c[r],e.push("\n              <li>"),e.push(t),e.push("</li>\n            ");e.push("\n          </ul>\n          </div>\n        ")}e.push("\n      </div>\n      "),_.isEmpty(i.description)||(e.push('\n        <section class="description">\n          <h4>Description</h4>\n          '),e.push(App.Utils.text2html(i.description)),e.push("\n        </section>\n      ")),e.push("\n    </article>\n    "),this.events.length>1&&e.push('\n      <div class="divider"></div>\n    '),e.push("\n  ")}e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/checkbox"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="'),e.push(n(this.attribute.class)),e.push(' checkbox checkbox--list">\n'),t=0,i=(s=this.attribute.options).length;t<i;t++)r=s[t],e.push('\n  <label class="checkbox-replacement'),r.disabled&&e.push(n(" is-disabled")),e.push(" "),e.push(n(r.class)),e.push('">\n    <input type="checkbox" value="'),e.push(n(r.value)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" '),e.push(n(r.checked)),e.push(" "),e.push(n(r.disabled)),e.push(" "),this.attribute.disabled&&e.push(" disabled"),e.push(">\n    "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n    "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n    <span class="label-text">'),e.push(n(r.name)),e.push("</span>\n    "),r.note&&(e.push('<span class="help-text">'),e.push(this.T(r.note)),e.push("</span>")),e.push("\n  </label>\n");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/code_editor"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<textarea id="'),e.push(n(this.attribute.id)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" class="form-control js-codeEditor '),e.push(n(this.attribute.class)),e.push('" '),e.push(n(this.attribute.required)),e.push(" "),this.attribute.disabled&&e.push(" disabled"),e.push(">"),e.push(n(this.attribute.value)),e.push('</textarea>\n<p class="help-text">'),this.attribute.hint&&(e.push(this.T(this.attribute.hint)),e.push("</p>\n"))}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/color"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="color controls controls--button dropdown-toggle" data-toggle="dropdown">\n  <input id="'),e.push(n(this.attribute.id)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" type="text" value="'),e.push(n(this.attribute.value)),e.push('" class="'),e.push(n(this.attribute.class)),e.push(' js-input" '),this.attribute.placeholder&&(e.push('placeholder="'),e.push(this.Ti(this.attribute.placeholder)),e.push('"')),e.push(" "),e.push(n(this.attribute.required)),e.push(" "),e.push(n(this.attribute.autofocus)),e.push(" "),e.push(this.attribute.autocapitalize),e.push(" "),e.push(this.attribute.autocomplete),e.push(" "),void 0!==this.attribute.min&&(e.push(' min="'),e.push(n(this.attribute.min)),e.push('"')),void 0!==this.attribute.max&&(e.push(' max="'),e.push(n(this.attribute.max)),e.push('"')),this.attribute.step&&(e.push(' step="'),e.push(n(this.attribute.step)),e.push('"')),this.attribute.disabled&&e.push(" disabled"),e.push('>\n  <div class="controls-button">\n   <div class="controls-button-inner">\n     <div class="color-field js-swatch" style="background-color: '),e.push(n(this.attribute.value)),e.push('"></div>\n   </div>\n  </div>\n</div>\n<div class="dropdown-menu dropdown-menu-left js-dropdown colorpicker">\n  <div class="colorpicker-hue-saturation js-colorpicker-hue-saturation">\n    <div class="colorpicker-saturation-gradient js-colorpicker-saturation-gradient" style="background-image: linear-gradient(transparent, hsl(0,0%,'),e.push(n(100*this.hsl[2])),e.push('%)"></div>\n    <div class="colorpicker-lightness-plane js-colorpicker-lightness-plane" style="background-color: hsla(0,0%,'),e.push(n(this.hsl[2]>.5?100:0)),e.push("%,"),e.push(n(2*Math.abs(this.hsl[2]-.5))),e.push(')"></div>\n    <div class="colorpicker-circle js-colorpicker-circle" style="left: '),e.push(n(100*this.hsl[0])),e.push("%; top: "),e.push(n(100-100*this.hsl[1])),e.push("%; border-color: "),e.push(n(this.hsl[2]>.5?"black":"white")),e.push('"></div>\n  </div>\n  <div class="colorpicker-lightness js-colorpicker-lightness">\n    <div class="colorpicker-hue-plane js-colorpicker-hue-plane" style="background-color: hsl('),e.push(n(360*this.hsl[0])),e.push(',100%,50%)">\n     <div class="colorpicker-hue-gradient"></div>\n    </div>\n    <div class="colorpicker-slider js-colorpicker-slider" style="top: '),e.push(n(100-100*this.hsl[2])),e.push('%">\n     <div class="colorpicker-slider-arrow colorpicker-slider-arrow--left"></div>\n     <div class="colorpicker-slider-arrow colorpicker-slider-arrow--right"></div>\n    </div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/column_select"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f,m;if(this.attribute.seperator)e.push('\n<input class="js-shadow hide" id="'),e.push(n(this.attribute.id)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" value="'),e.push(n(this.attribute.value)),e.push('">\n');else{for(e.push('\n<select\n  class="columnSelect-shadow js-shadow"\n  id="'),e.push(n(this.attribute.id)),e.push('"\n  name="'),e.push(n(this.attribute.name)),e.push('"\n  '),e.push(n(this.attribute.required)),e.push("\n  "),e.push(n(this.attribute.autofocus)),e.push('\n  value="'),e.push(n(this.attribute.value)),e.push('"\n  multiple\n  disabled\n>\n  '),t=0,o=(h=this.allOptions).length;t<o;t++)p=h[t],e.push('\n  <option value="'),e.push(n(p.value)),e.push('" '),p.selected&&e.push(n(" selected")),e.push(">"),e.push(n(p.name)),e.push("</option>\n  ");e.push("\n</select>\n")}for(e.push('\n<div class="columnSelect-column columnSelect-column--selected js-selected" data-name="'),e.push(n(this.attribute.name)),e.push('">\n  <div class="u-placeholder u-unselectable js-placeholder'),this.values.length&&e.push(n(" is-hidden")),e.push('">'),e.push(this.T("Nothing selected")),e.push("</div>\n  "),i=0,a=(d=this.allOptions).length;i<a;i++)p=d[i],e.push('\n  <div class="columnSelect-option js-remove js-option'),p.selected||e.push(n(" is-hidden")),e.push('" data-value="'),e.push(n(p.value)),e.push('" title="'),e.push(n(p.title||p.name)),e.push('">'),e.push(n(p.name)),e.push("</div>\n  ");for(e.push('\n</div>\n<div class="columnSelect-column columnSelect-column--sidebar" data-name="'),e.push(n(this.attribute.name)),e.push('">\n  '),this.allOptions.length>10&&(e.push('\n  <div class="columnSelect-search">\n    '),e.push(this.Icon("magnifier")),e.push('\n    <input class="js-search" autocomplete="off">\n    <div class="columnSelect-search-clear js-clear is-hidden">\n      '),e.push(this.Icon("diagonal-cross")),e.push("\n    </div>\n  </div>\n  ")),e.push('\n  <div class="columnSelect-pool js-pool">\n    '),s=0,l=(f=this.attribute.options).length;s<l;s++){if(p=f[s],e.push("\n      "),void 0!==p.group){for(e.push('\n        <div class="columnSelect-group-label" title="'),e.push(n(this.T(p.label))),e.push('">'),e.push(n(this.T(p.label))),e.push("</div>\n        "),r=0,c=(m=p.group).length;r<c;r++)u=m[r],e.push('\n        <div class="columnSelect-option js-select js-option'),u.selected&&e.push(n(" is-hidden")),e.push('" data-value="'),e.push(n(u.value)),e.push('" title="'),e.push(n(u.title||u.name)),e.push('">'),e.push(n(u.name)),e.push("</div>\n        ");e.push("\n      ")}else e.push('\n        <div class="columnSelect-option js-select js-option'),p.selected&&e.push(n(" is-hidden")),e.push('" data-value="'),e.push(n(p.value)),e.push('" title="'),e.push(n(p.title||p.name)),e.push('">'),e.push(n(p.name)),e.push("</div>\n      ");e.push("\n    ")}e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/content_one"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/content_two"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="sidebar"></div>\n<div class="main flex"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/content_two_title"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="sidebar">\n</div>\n<div class="main flex">\n  <div class="page-header">\n    <div class="page-header-title">\n      <h1>'),e.push(this.T(this.head)),e.push(" <small>"),e.push(this.T(this.sub_head)),e.push('</small></h1>\n    </div>\n  </div>\n  <div class="page-content"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/date"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="control controls--date" data-name="'),e.push(n(this.attribute.nameRaw)),e.push('">\n  <input type="hidden" value="'),e.push(n(this.attribute.value)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" '),this.attribute.disabled&&e.push(" disabled"),e.push('>\n  <input type="text" value="" class="form-control js-datepicker '),e.push(n(this.attribute.class)),e.push('" data-item="date" '),this.attribute.disabled&&e.push(" disabled"),e.push(">\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/datepicker"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="datepicker">\n    <div class="datepicker-days">\n        <table class=" table-condensed">\n            <thead>\n                <tr>\n                    <th colspan="7" class="datepicker-title"></th>\n                </tr>\n                <tr>\n                    <th class="prev">'),e.push(this.Icon("arrow-{start}")),e.push('</th>\n                    <th colspan="5" class="datepicker-switch"></th>\n                    <th class="next">'),e.push(this.Icon("arrow-{end}")),e.push('</th>\n                </tr>\n            </thead>\n        <tbody></tbody>\n        <tfoot>\n          <tr>\n            <td colspan="7">\n              <div class="datepicker-footer-buttons">\n                <div class="clear"></div>\n                <div class="today"></div>\n              </div>\n            </td>\n          </tr>\n        </tfoot>\n    </table>\n  </div>\n  <div class="datepicker-months">\n      <table class="table-condensed">\n          <thead>\n              <tr>\n                  <th colspan="7" class="datepicker-title"></th>\n              </tr>\n              <tr>\n                  <th class="prev">'),e.push(this.Icon("arrow-{start}")),e.push('</th>\n                  <th colspan="5" class="datepicker-switch"></th>\n                  <th class="next">'),e.push(this.Icon("arrow-{end}")),e.push('</th>\n              </tr>\n          </thead>\n          <tbody><tr><td colspan="7"></td></tr></tbody>\n          <tfoot>\n            <tr>\n              <td colspan="7">\n                <div class="datepicker-footer-buttons">\n                  <div class="clear"></div>\n                  <div class="today"></div>\n                </div>\n              </td>\n            </tr>\n          </tfoot>\n      </table>\n  </div>\n  <div class="datepicker-years">\n      <table class="table-condensed">\n          <thead>\n              <tr>\n                  <th colspan="7" class="datepicker-title"></th>\n              </tr>\n              <tr>\n                  <th class="prev">'),e.push(this.Icon("arrow-{start}")),e.push('</th>\n                  <th colspan="5" class="datepicker-switch"></th>\n                  <th class="next">'),e.push(this.Icon("arrow-{end}")),e.push('</th>\n              </tr>\n          </thead>\n          <tbody><tr><td colspan="7"></td></tr></tbody>\n          <tfoot>\n            <tr>\n              <td colspan="7">\n                <div class="datepicker-footer-buttons">\n                  <div class="clear"></div>\n                  <div class="today"></div>\n                </div>\n              </td>\n            </tr>\n          </tfoot>\n      </table>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/datetime"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="controls controls--datetime" '),this.attribute.nameRaw&&(e.push('data-name="'),e.push(n(this.attribute.nameRaw)),e.push('"')),e.push('>\n  <input type="hidden" value="'),e.push(n(this.attribute.value)),e.push('" '),this.attribute.name&&(e.push('name="'),e.push(n(this.attribute.name)),e.push('"')),e.push(" "),this.attribute.disabled&&e.push(" disabled"),e.push('>\n  <input type="text" value="" class="form-control flex-shrink-horizontal js-datepicker '),e.push(n(this.attribute.class)),e.push('" data-item="date" '),this.attribute.disabled&&e.push(" disabled"),e.push('>\n  <div class="controls-label">'),e.push(this.T("at")),e.push('</div>\n  <input type="text" value="" class="form-control time js-timepicker '),e.push(n(this.attribute.class)),e.push('" data-item="time" '),this.attribute.disabled&&e.push(" disabled"),e.push(">\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/drox"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="drox">\n'),(this.header||this.edit)&&(e.push('\n  <div class="drox-header">\n    <h2>\n      '),e.push(this.T(this.header)),e.push("\n      "),this.edit&&(e.push('\n      <a href="" data-type="edit" class="pull-right glyphicon glyphicon-edit" title="'),e.push(this.Ti("edit")),e.push('"></a>\n      ')),e.push("\n    </h2>\n  </div>\n")),e.push('\n  <div class="drox-body">\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/error/generic"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="fullscreenMessage">\n  '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n  <h2>"),void 0!==this.status&&(e.push(this.T("Status Code:")),e.push(" "),e.push(n(this.status)),e.push(". ")),e.push(this.T(this.detail)),e.push("</h2>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/error/not_found"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="flex fullscreenMessage">\n  '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n  <h2>"),e.push(this.T("Oops.. I'm sorry, but I can't find this %s.",this.objectName)),e.push("</h2>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/error/placeholder"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="fullscreenMessage fullscreenMessage--placeholder">\n  '),e.push(this.icon),e.push("\n  <h2>"),void 0!==this.status&&(e.push(this.T("Status Code:")),e.push(" "),e.push(n(this.status)),e.push(". ")),e.push(this.T(this.detail)),e.push("</h2>\n  "),this.action&&(e.push('\n  <div class="btn btn--action js-action">'),e.push(this.T(this.action)),e.push("</div>\n  ")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/error/success"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="fullscreenMessage">\n  '),e.push(this.Icon("checkmark")),e.push("\n  <h2>"),e.push(this.T(this.detail)),e.push("</h2>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/error/unauthorized"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="flex fullscreenMessage">\n  '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n  <h2>"),e.push(this.T("Oops.. I'm sorry, but you have insufficient rights to open this %s.",this.objectName)),e.push("</h2>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/history"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v;for(e.push('<div>\n<a href="#" data-type="sortorder">'),e.push(this.T("Change order")),e.push("</a>\n\n<hr>\n\n"),i=0,l=(h=this.items).length;i<l;i++){for(s=h[i],e.push("\n  <div>"),e.push(this.humanTime(s.created_at)),e.push('</div>\n  <div class="history-row-list">\n    '),r=0,c=(d=s.sources).length;r<c;r++){for(g=d[r],e.push("\n      "),o=0,u=(f=g.users).length;o<u;o++){for(v=f[o],e.push("\n        <span"),g.sourceable_name||1===v.id||(e.push(' class="user-popover" data-id="'),e.push(n(v.id)),e.push('"')),e.push(">\n        "),g.sourceable_name?(e.push("\n          "),e.push(n(this.T(g.sourceable_type))),e.push(": "),e.push(n(this.T(g.sourceable_name))),e.push("\n        ")):1===v.id?(e.push("\n          "),e.push(this.T("System")),e.push("\n        ")):(e.push("\n          "),e.push(n(v.object.displayName())),e.push("\n        ")),e.push("\n        </span>\n        <ul>\n          "),a=0,p=(m=v.records).length;a<p;a++)t=m[a],e.push("\n          <li>"),e.push(t),e.push("</li>\n          ");e.push("\n        </ul>\n     ")}e.push("\n    ")}e.push("\n  </div>\n  <hr>\n")}e.push("\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ical_feed"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(s in e.push('<div class="settings-row">\n  <label class="inline-label">\n    <span class="radio-replacement radio-replacement--inline">\n      <input type="radio" name="holiday-radio" value="list" class="js-check js-checkList">\n      '),e.push(this.Icon("radio","icon-unchecked")),e.push("\n      "),e.push(this.Icon("radio-checked","icon-checked")),e.push("\n    </span>\n    "),e.push(this.T("Subscribe to public holidays in")),e.push('\n  </label>\n  <div class="u-inlineBlock u-positionOrigin">\n    <select class="form-control form-control--small js-list">\n      <option value="">-</option>\n      '),i=this.icalFeeds)t=i[s],e.push('\n        <option value="'),e.push(n(s)),e.push('" '),this.attribute.value===s&&e.push("selected"),e.push(">"),e.push(this.T(t)),e.push("</option>\n      ");e.push("\n    </select>\n    "),e.push(this.Icon("arrow-down")),e.push('\n  </div>\n  <span class="text-small text-muted">('),e.push(this.T("iCalendar links from Google will get fetched once a day")),e.push(')</span>\n</div>\n\n<div class="settings-row">\n  <label class="inline-label">\n    <span class="radio-replacement radio-replacement--inline">\n      <input type="radio" name="holiday-radio" value="manual" class="js-check js-checkManual">\n      '),e.push(this.Icon("radio","icon-unchecked")),e.push("\n      "),e.push(this.Icon("radio-checked","icon-checked")),e.push("\n    </span>\n    "),e.push(this.T("Subscribe to iCalendar feed")),e.push('\n  </label>\n  <input class="form-control form-control--small form-control--inline js-manual" type="url" placeholder="'),e.push(n(this.attribute.placeholder)),e.push('">\n  <input type="hidden" class="js-shadow" name="'),e.push(n(this.attribute.name)),e.push('" value="'),e.push(n(this.attribute.value)),e.push('">\n</div>\n')}).call(this)}.call(t),t.safe=i,
t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/icon_picker"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="dropdown-toggle" data-toggle="dropdown">\n  <input id="'),e.push(n(this.attribute.id)),e.push('" class="form-control icon_picker-shadow js-shadow" name="'),e.push(n(this.attribute.name)),e.push('" value="'),e.push(n(this.value)),e.push('" '),e.push(n(this.attribute.required)),e.push('>\n  <div class="form-control icon js-input" data-font="'),e.push(n(this.attribute.iconset)),e.push('" tabindex="0">\n    '),e.push(n(this.value?String.fromCharCode("0x"+this.value):"")),e.push("\n  </div>\n  "),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n</div>\n<div class="dropdown-menu dropdown-menu-left js-dropdown">\n  <input type="search" class="dropdown-filter js-filter-icons" placeholder="'),e.push(this.T("Search\u2026")),e.push('">\n  <ul class="js-iconGrid dropdown-grid" role="menu"></ul>\n  <div class="dropdown-filter-placeholder">\n    <span class="js-noMatch">\xaf\\_(\u30c4)_/\xaf</span>\n    <span class="js-noMatch">(\u256f\xb0\u25a1\xb0\uff09\u256f \ufe35 \u253b\u2501\u253b</span>\n    <span class="js-noMatch">(\\/) (;,,;) (\\/)</span>\n    <span class="js-noMatch">(\u0ca0_\u0ca0)</span>\n    <span class="js-noMatch">\u03b5(\xb4\ufb41\ufe35\ufb41`)\u0437</span>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/iconset_picker"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(t in e.push('<input type="text" name="'),e.push(n(this.attribute.name)),e.push('" value="'),e.push(n(this.attribute.value)),e.push('">\n<div class="icon-sets">\n\t'),i=this.sets)s=i[t],e.push('\n\t<div class="icon-set js-set'),e.push(n(this.attribute.value===t?" is-active":void 0)),e.push('" data-family="'),e.push(n(t)),e.push('">\n\t\t<div class="icon-set-preview js-preview">\n\t\t\t<div class="loading icon small"></div>\n\t\t</div>\n\t\t<div class="icon-set-meta">\n\t\t\t<span class="icon-set-name">'),e.push(n(s.name)),e.push('</span>\n\t\t\t<span class="icon-set-version">'),e.push(n(s.version)),e.push('</span>\n\t\t\t<a href="'),e.push(n(s.website)),e.push('" target="_blank" class="icon-set-website">'),e.push(this.T("Website")),e.push("</a>\n\t\t</div>\n\t</div>\n\t");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/input"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){this.attribute.appendText&&e.push('<div class="horizontal">'),e.push('\n<input id="'),e.push(n(this.attribute.id)),e.push('" type="'),e.push(n(this.attribute.input_type||this.attribute.type)),e.push('" '),this.attribute.name&&(e.push('name="'),e.push(n(this.attribute.name)),e.push('"')),e.push(' value="'),e.push(n(this.attribute.value)),e.push('" class="form-control '),e.push(n(this.attribute.class)),e.push('" '),this.attribute.placeholder&&(e.push('placeholder="'),e.push(this.Ti(this.attribute.placeholder)),e.push('"')),e.push(" "),e.push(n(this.attribute.required)),e.push(" "),e.push(n(this.attribute.autofocus)),e.push(" "),e.push(this.attribute.autocapitalize),e.push(" "),e.push(this.attribute.autocomplete),e.push(" "),void 0!==this.attribute.min&&(e.push(' min="'),e.push(n(this.attribute.min)),e.push('"')),void 0!==this.attribute.max&&(e.push(' max="'),e.push(n(this.attribute.max)),e.push('"')),this.attribute.step&&(e.push(' step="'),e.push(n(this.attribute.step)),e.push('"')),this.attribute.maxlength&&(e.push(' maxlength="'),e.push(n(this.attribute.maxlength)),e.push('"')),this.attribute.disabled&&e.push(" disabled"),"email"===this.attribute.type&&(e.push(' pattern="(([^<>\\(\\)\\[\\]\\.,;:\\s@\\u0022]+(\\.[^<>\\(\\)\\[\\]\\.,;:\\s@\\u0022]+)*)|(\\u0022.+\\u0022))@(([^<>\\(\\)\\[\\]\\.,;:\\s@\\u0022]+\\.)+[^<>\\(\\)\\[\\]\\.,;:\\s@\\u0022]{2,})" title="'),e.push(this.Ti("Enter a valid email address.")),e.push('"')),e.push(" />\n"),this.attribute.appendText&&(e.push('\n  <div class="controls-label horizontal-filter-value u-textTruncate">'),e.push(this.T(this.attribute.appendText)),e.push("</div>\n</div>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/login_preview"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="login branding centered darkBackground vertical">\n  '),this.maintananceChange&&(e.push("\n    "),this.C("maintenance_mode")&&(e.push('\n      <div class="hero-unit alert alert--danger">'),e.push(this.T("Zammad is currently in maintenance mode. Only administrators can log in. Please wait until the maintenance window is over.")),e.push("</div>\n    ")),e.push("\n\n    "),this.logoChange&&!this.C("maintenance_login")||(e.push('\n    <form>\n      <div contenteditable="true" id="maintenance-message" data-name="message" class="hero-unit alert alert--success js-textarea js-Login" '),this.C("maintenance_login")||e.push('style="opacity: 0.5;"'),e.push(">\n      "),"This is a default maintenance message. Click here to change."===this.C("maintenance_login_message")?(e.push("\n        "),e.push(this.T(this.C("maintenance_login_message"))),e.push("\n      ")):(e.push("\n        "),e.push(this.C("maintenance_login_message")),e.push("\n      ")),e.push("\n      </div>\n    </form>\n    ")),e.push("\n  ")),e.push('\n\n  <div class="hero-unit">\n\n    '),this.logoChange?(e.push('\n      <img class="logo-preview" src="'),e.push(n(this.logoUrl)),e.push('">\n      <div class="logo-preview-placeholder">'),e.push(this.T("Your Logo")),e.push('</div>\n      <div class="centered">\n        <div class="btn btn--success fileUpload">'),e.push(this.T("Change")),e.push('<input type="file" class="js-upload" name="logo" accept="image/*"></div>\n      </div>\n    ')):(e.push('\n      <img class="company-logo" src="'),e.push(n(this.logoUrl)),e.push('">\n    ')),e.push('\n\n    <div class="form-group">\n      <label for="username">'),e.push(this.Ti("Username / email")),e.push('</label>\n      <input id="username" name="username" type="text" class="form-control" value="'),e.push(n(this.S("login"))),e.push('" autocapitalize="off" disabled="disabled"/>\n    </div>\n\n    <div class="form-group">\n      <label for="password">'),e.push(this.Ti("Password")),e.push('</label>\n      <input id="password" name="password" type="password" class="form-control" value="some_pass" disabled="disabled"/>\n    </div>\n\n    <div class="form-group">\n      <label><input name="remember_me" value="1" type="checkbox" disabled="disabled"/> '),e.push(this.T("Remember me")),e.push('</label>\n    </div>\n\n    <div class="form-controls">\n      <button class="btn btn--primary" type="submit" disabled="disabled">'),e.push(this.T("Sign in")),e.push("</button>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/modal_loader"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="modal-dialog wizard">\n\n  <form class="modal-content setup wizard">\n    <div class="modal-header">\n      <h1 class="modal-title">'),e.push(this.T(this.head)),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon js-loadingIcon"></span> <span class="js-loading">'),e.push(this.message),e.push(' </span>\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/multi_locales"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<table class="settings-list js-localeTable">\n  <thead>\n    <tr>\n      <th width="85%">'),e.push(this.T("Language")),e.push('\n      <th width="5%">'),e.push(this.T("Default")),e.push('\n      <th width="10%">'),e.push(this.T("Delete")),e.push("\n  </thead>\n  <tbody>\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/multi_locales_row"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i;e.push('<td class="settings-list-control-cell">\n  <div class="js-selectorContainer"></div>\n<td class="u-positionOrigin settings-list-controls">\n  <span class="js-primary radio-replacement radio-replacement--fullscreen">\n    <input type="radio" value="'),e.push(n(null!=(t=this.kb_locale)&&null!=(i=t.systemLocale())?i.id:void 0)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('_primary_locale_id">\n    '),e.push(this.Icon("radio","icon-unchecked")),e.push("\n    "),e.push(this.Icon("radio-checked","icon-checked")),e.push('\n  </span>\n<td class="u-positionOrigin settings-list-controls">\n  <span class="checkbox-replacement checkbox-replacement--fullscreen js-remove">\n    <input type="checkbox" name="showTitle" value="true">\n    '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n    "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n  </span>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/navbar_level2/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="sidebar '),e.push(n(this.className)),e.push('"></div>\n<div class="main flex"></div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/navbar_level2/navbar"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;if(this.groups){for(e.push("\n  "),i=0,o=(l=this.groups).length;i<o;i++){if(t=l[i],e.push("\n    "),!_.isEmpty(t.items)){if(e.push("\n      <h2>"),e.push(this.T(t.name)),e.push('</h2>\n      <ul class="nav nav-pills nav-stacked">\n      '),t.items){for(e.push("\n        "),r=0,a=(c=t.items).length;r<a;r++)s=c[r],e.push("\n          <li "),s.active&&e.push('class="active js-item"'),e.push('><a href="'),e.push(n(s.target)),e.push('">'),e.push(this.T(s.name)),e.push("</a></li>\n        ");e.push("\n      ")}e.push("\n      </ul>\n    ")}e.push("\n  ")}e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/notification_matrix"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l;if(e.push('<table class="settings-list">\n  <thead>\n    <tr>\n      <th>\n      <th width="16%" style="text-align: center;">'),e.push(this.T("My Tickets")),e.push('\n      <th width="16%" style="text-align: center;">'),e.push(this.T("Not Assigned")),e.push('*\n      <th width="16%" style="text-align: center;">'),e.push(this.T("Subscribed Tickets")),e.push('\n      <th width="16%" style="text-align: center;">'),e.push(this.T("All Tickets")),e.push('*\n      <th width="120px" class="settings-list-separator" style="text-align: center;">'),e.push(this.T("Also notify via email")),e.push("\n  </thead>\n  <tbody>\n  "),this.matrixYAxe){for(s in e.push("\n    "),r=this.matrixYAxe)l=r[s],e.push("\n    <tr>\n      <td>\n        "),e.push(this.T(l.name)),e.push("\n        "),i=null!=(o=this.values[s])?o.criteria:void 0,e.push("\n        "),t=null!=(a=this.values[s])?a.channel:void 0,e.push('\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen">\n          <input type="checkbox" name="matrix.'),e.push(n(s)),e.push('.criteria.owned_by_me" value="true"'),i&&i.owned_by_me&&e.push(" checked"),e.push(" />\n          "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </label>\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen">\n          <input type="checkbox" name="matrix.'),e.push(n(s)),e.push('.criteria.owned_by_nobody" value="true"'),i&&i.owned_by_nobody&&e.push(" checked"),e.push(" />\n          "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </label>\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen">\n          <input type="checkbox" name="matrix.'),e.push(n(s)),e.push('.criteria.subscribed" value="true"'),i&&i.subscribed&&e.push(" checked"),e.push(" />\n          "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </label>\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen">\n          <input type="checkbox" name="matrix.'),e.push(n(s)),e.push('.criteria.no" value="true"'),i&&i.no&&e.push(" checked"),e.push(" />\n          "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </label>\n      <td class="u-positionOrigin settings-list-separator">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen">\n          <input type="checkbox" name="matrix.'),e.push(n(s)),e.push('.channel" value="email"'),t&&t.email&&e.push(" checked"),e.push(" />\n          "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n        </label>\n    ");e.push("\n  ")}e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_import/import_try"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n<p class="alert alert--danger js-error hide"></p>\n\n<p>\n'),this.result.stats&&(e.push("\n  "),e.push(this.T("The test run was successful.")),e.push("\n  "),e.push(this.T("The following changes will be made:")),e.push("\n  <ul>\n  "),void 0!==this.result.stats.deleted&&(e.push("\n    <li>"),e.push(this.T("%s object(s) will be deleted.",this.result.stats.deleted)),e.push("</li>\n  ")),e.push("\n  "),void 0!==this.result.stats.created&&(e.push("\n    <li>"),e.push(this.T("%s object(s) will be created.",this.result.stats.created)),e.push("</li>\n  ")),e.push("\n  "),void 0!==this.result.stats.updated&&(e.push("\n    <li>"),e.push(this.T("%s object(s) will be updated.",this.result.stats.updated)),e.push("</li>\n  ")),e.push("\n")),e.push("\n</p>\n\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_import/imported"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push("<div>\n"),this.errors){for(e.push("\n  <ul>\n  "),i=0,s=(r=this.errors).length;i<s;i++)t=r[i],e.push("\n    <li>"),e.push(n(t)),e.push("\n  ");e.push("\n")}e.push('\n</div>\n\n<div>\n<p class="alert alert--danger js-error hide"></p>\n<p>\n'),this.result.stats&&(e.push("\n  "),e.push(this.T("The import was successful.")),e.push("\n  "),e.push(this.T("The following changes have been made:")),e.push("\n  <ul>\n  "),void 0!==this.result.stats.deleted&&(e.push("\n    <li>"),e.push(this.T("%s object(s) were deleted.",this.result.stats.deleted)),e.push("</li>\n  ")),e.push("\n  "),void 0!==this.result.stats.created&&(e.push("\n    <li>"),e.push(this.T("%s object(s) have been created.",this.result.stats.created)),e.push("</li>\n  ")),e.push("\n  "),void 0!==this.result.stats.updated&&(e.push("\n    <li>"),e.push(this.T("%s object(s) have been updated.",this.result.stats.updated)),e.push("</li>\n  ")),e.push("\n")),e.push("\n</p>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_import/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n<p class="alert alert--danger js-error hide"></p>\n\n<p>\n  '),e.push(this.T("Bulk import allows you to create and update many records at once.")),e.push("\n  "),e.push(this.T("The data must be in the comma separated values (CSV) format and saved as UTF-8. You can import a CSV file or paste the data directly into the text area.")),e.push("\n</p>\n\n<p>"),e.push(this.T("Alternatively, you can use the Zammad API to import data.")),e.push('</p>\n\n<h2><input checked="checked" disabled="disabled" type="checkbox" name="create" value="true"> '),e.push(this.T("Create new records")),e.push("</h2>\n"),e.push(this.T("Records that exist in the import data (but not in Zammad) will always be created.")),e.push('\n\n<h2><input checked="checked" disabled="disabled" type="checkbox" name="update" value="true"> '),e.push(this.T("Update existing records")),e.push("</h2>\n"),e.push(this.T("Update existing records with the attributes specified in the import data.")),e.push("\n\n"),!0===this.deleteOption&&(e.push('\n<h2><input type="checkbox" name="delete" value="true"> '),e.push(this.T("Delete records")),e.push("</h2>\n"),e.push(this.T("Delete all existing records first.")),e.push("\n")),e.push("\n\n<h2>"),e.push(this.T("Select CSV file")),e.push('</h2>\n<input name="file" type="file">\n\n<h2>'),e.push(this.T("Paste in CSV data")),e.push('</h2>\n<textarea cols="25" rows="6" name="data"></textarea>\n\n<p>'),e.push(this.T("Note:")),e.push(' <a href="'),e.push(this.import_example_url),e.push('" target="_blank">'),e.push(this.T("Example CSV file for download.")),e.push("</a></p>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_import/result"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push("<div>\n"),e.push(this.T("Result:")),e.push(" "),e.push(n(this.result)),e.push("\n"),this.errors){for(e.push("\n  <ul>\n  "),i=0,s=(r=this.errors).length;i<s;i++)t=r[i],e.push("\n    <li>"),e.push(n(t)),e.push("\n  ");e.push("\n")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_search/input"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="tokenfield form-control u-positionOrigin">\n  '),this.attribute.multiple){if(e.push('\n    <select multiple class="js-objectId hide" name="'),e.push(n(this.attribute.name)),e.push('" tabindex="-1">\n      '),this.attribute.value){for(e.push("\n        "),t=0,i=(r=this.attribute.value).length;t<i;t++)s=r[t],e.push('\n          <option value="'),e.push(n(s.value)),e.push('" selected>'),e.push(n(s.name)),e.push("</option>\n        ");e.push("\n      ")}e.push("\n    </select>\n    "),e.push(this.tokens),e.push("\n  ")}else e.push('\n    <input class="js-objectId" type="hidden" value="'),e.push(n(this.value)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" tabindex="-1">\n  ');e.push('\n  <input name="'),e.push(n(this.attribute.name)),e.push('_completion" class="user-select token-input js-objectSelect form-control" autocapitalize="off" placeholder="'),e.push(this.Ti(this.attribute.placeholder)),e.push('" autocomplete="off" '),e.push(n(this.attribute.autofocus)),e.push(' role="textbox" aria-autocomplete="list" value="'),e.push(n(this.name)),e.push('" aria-haspopup="true">\n  '),!0!==this.attribute.disableCreateObject&&e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n</div>\n\n<div class="dropdown-menu" aria-labelledby="customer_id">\n  <ul class="recipientList" role="menu"></ul>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_search/item_object"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<li class="recipientList-entry js-object'),!1===this.object.active&&e.push(" is-inactive"),e.push('" data-object-id="'),e.push(n(this.object.id)),e.push('">\n  <div class="recipientList-iconSpacer">\n    '),e.push(this.Icon(this.icon,"recipientList-icon")),e.push('\n  </div>\n  <div class="recipientList-name">\n    '),this.realname?(e.push("\n      "),e.push(n(this.realname)),e.push("\n    ")):(e.push("\n      "),e.push(n(this.object.displayName())),e.push("\n    ")),e.push("\n    "),this.object.organization&&(e.push('\n      <span class="recipientList-detail'),!1===this.object.organization.active&&e.push(" is-inactive"),e.push('">- '),e.push(n(this.object.organization.displayName())),e.push("</span>\n    ")),e.push("\n  </div>\n  "),!1===this.object.active&&(e.push('\n    <div class="recipientList-status">'),e.push(this.Ti("inactive")),e.push("</div>\n  ")),e.push("\n</li>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_search/item_organization"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<li class="recipientList-entry js-organization'),!1===this.organization.active&&e.push(" is-inactive"),e.push('" data-organization-id="'),e.push(this.organization.id),e.push('">\n  <div class="recipientList-iconSpacer">\n    '),!1===this.organization.active?(e.push("\n    "),e.push(this.Icon("inactive-organization","recipientList-icon")),e.push("\n    ")):(e.push("\n    "),e.push(this.Icon("organization","recipientList-icon")),e.push("\n    ")),e.push('\n  </div>\n  <div class="recipientList-name">\n    '),e.push(n(this.organization.displayName())),e.push('\n    <span class="recipientList-detail">- '),e.push(n(this.objectCount)),e.push(" "),e.push(this.T(this.objectSingels)),e.push("</span>\n  </div>\n  "),!1===this.organization.active&&(e.push('\n    <div class="recipientList-status">'),e.push(this.Ti("inactive")),e.push("</div>\n  ")),e.push("\n  "),e.push(this.Icon("arrow-right","recipientList-arrow")),e.push("\n</li>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_search/item_organization_members"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<ul class="recipientList-organizationMembers hide" organization-id="'),e.push(this.organization.id),e.push('">\n  <li class="recipientList-controls js-back">\n    <div class="btn btn--action btn--onDark">\n      '),e.push(this.Icon("arrow-left")),e.push('\n      <span class="btn-label">'),e.push(this.T("Back")),e.push('</span>\n    </div>\n\n  <li class="recipientList-controls js-showMoreMembers" organization-member-limit="10">\n    <div class="btn btn--action btn--onDark">\n      <span class="btn-label">'),e.push(this.T("show more")),e.push("</span>\n    </div>\n</ul>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/object_search/new_object"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<li class="recipientList-entry recipientList--new js-objectNew" data-object-id="new">\n  <div class="recipientList-iconSpacer">\n    '),e.push(this.Icon("plus","recipientList-icon")),e.push('\n  </div>\n  <div class="recipientList-name">\n    '),e.push(this.T(this.objectCreate)),e.push("\n  </div>\n</li>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/page_loading"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-loading">\n  <div class="small loading icon"></div>\n  <div class="page-loading-label">'),e.push(this.T("Loading\u2026")),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/permission"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="checkbox '),e.push(n(this.attribute.class)),e.push('">\n  '),t=0,i=(r=this.permissions).length;t<i;t++)s=r[t],e.push("\n    "),s.name.match(/\./)?(e.push('\n      <div class="checkbox-child js-subPermissionList">\n        <label class="inline-label checkbox-replacement">\n          <input type="checkbox" value="'),e.push(n(s.id)),e.push('" name="permission_ids" '),_.contains(this.params.permission_ids,s.id)&&e.push("checked"),e.push(" "),s.preferences.disabled&&e.push("disabled"),e.push(' data-permission-name="'),e.push(n(s.name)),e.push('"/>\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n          <span class="label-text">'),e.push(n(s.displayName().replace(/^.+?\./,""))),e.push('</span>\n          <span class="help-text">'),e.push(this.T(s.note,this.T(s.preferences.translations))),e.push("</span>\n        </label>\n      </div>\n    ")):(e.push('\n      <label class="inline-label checkbox-replacement">\n        <input type="checkbox" value="'),e.push(n(s.id)),e.push('" name="permission_ids" '),_.contains(this.params.permission_ids,s.id)&&e.push("checked"),e.push(" "),s.preferences.disabled&&e.push("disabled"),e.push(' data-permission-name="'),e.push(n(s.name)),e.push('"/>\n        '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n        "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        <span class="label-text">'),e.push(n(s.displayName())),e.push('</span>\n        <span class="help-text">'),e.push(this.T(s.note,this.T(s.preferences.translations))),e.push("</span>\n      </label>\n    ")),e.push("\n  ");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/postmaster_match"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){
return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="horizontal-filters">\n  <div class="horizontal-filter js-filterElement">\n    <div class="horizontal-filter-body">\n      <div class="controls">\n        <div class="u-positionOrigin js-attributeSelector">\n          '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n        </div>\n      </div>\n      <div class="controls">\n        <div class="u-positionOrigin js-operator">\n          <select></select>\n          '),e.push(this.Icon("arrow-down")),e.push('\n        </div>\n      </div>\n      <div class="controls js-value horizontal-filter-value"></div>\n    </div>\n    <div class="filter-controls">\n      <div class="filter-control filter-control-remove js-remove" title="'),e.push(this.T("Remote")),e.push('">\n        '),e.push(this.Icon("minus-small")),e.push('\n      </div>\n      <div class="filter-control filter-control-add js-add" title="'),e.push(this.T("Add")),e.push('">\n        '),e.push(this.Icon("plus-small")),e.push("\n      </div>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/postmaster_set"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="horizontal-filters"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/postmaster_set_row"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="horizontal-filter js-filterElement">\n  <div class="horizontal-filter-body">\n    <div class="controls">\n      <div class="u-positionOrigin js-attributeSelector">\n        '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n      </div>\n    </div>\n    <div class="controls">\n      <div class="u-positionOrigin js-operator">\n        <select></select>\n        '),e.push(this.Icon("arrow-down")),e.push('\n      </div>\n    </div>\n    <div class="controls js-value horizontal-filter-value"></div>\n  </div>\n  <div class="filter-controls">\n    <div class="filter-control filter-control-remove js-remove" title="'),e.push(this.T("Remote")),e.push('">\n      '),e.push(this.Icon("minus-small")),e.push('\n    </div>\n    <div class="filter-control filter-control-add js-add" title="'),e.push(this.T("Add")),e.push('">\n      '),e.push(this.Icon("plus-small")),e.push("\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/radio"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="'),e.push(n(this.attribute.class)),e.push(' radio radio--list">\n'),t=0,i=(s=this.attribute.options).length;t<i;t++)r=s[t],e.push('\n  <label class="inline-label radio-replacement'),r.disabled&&e.push(n(" is-disabled")),e.push('">\n    <input type="radio" value="'),e.push(n(r.value)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" '),e.push(n(r.checked)),e.push(" "),e.push(n(r.disabled)),e.push(" "),this.attribute.disabled&&e.push(" disabled"),e.push(">\n    "),e.push(this.Icon("radio","icon-unchecked")),e.push("\n    "),e.push(this.Icon("radio-checked","icon-checked")),e.push('\n    <span class="label-text">'),e.push(this.T(r.name)),e.push("</span>\n    "),r.note&&(e.push('<span class="help-text">'),e.push(this.T(r.note)),e.push("</span>")),e.push("\n  </label>\n");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/radio_graphic"]=function(t){t||(t={});var e,n=[],i=function(t){var i,s=n;return n=[],t.call(this),i=n.join(""),n=s,e(i)},s=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?o(t):""},r=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,e,r,o,a,l;for(l=this,e=function(t){return i((function(){return n.push("\n  "),n.push(l.Icon("radio","icon-unchecked")),n.push("\n  "),n.push(l.Icon("radio-checked","icon-checked")),n.push('\n  <span class="label-text">'),n.push(l.T(t.name)),n.push(" "),t.note&&(n.push('- <span class="help-text">'),n.push(l.T(t.note)),n.push("</span>")),n.push("</span>\n")}))},n.push('\n\n<div class="'),n.push(s(this.attribute.class)),n.push(' radio selections-container">\n  '),t=0,r=(o=this.attribute.options).length;t<r;t++)a=o[t],n.push('\n    <label class="inline-label radio-replacement">\n      <input type="radio" value="'),n.push(s(a.value)),n.push('" name="'),n.push(s(this.attribute.name)),n.push('" '),n.push(s(a.checked)),n.push('>\n      <span class="label-box">\n        <span class="radio-illustration"'),a.aspect_ratio&&(n.push(' style="padding-bottom: '),n.push(s(100/a.aspect_ratio)),n.push('%"')),n.push('>\n          <img src="/assets/images/graphics/'),n.push(s(a.graphic)),n.push('">\n        </span>\n        <span class="label-row">'),n.push(s(e(a))),n.push("</span>\n      </span>\n    </label>\n  ");n.push("\n</div>\n")}).call(this)}.call(t),t.safe=r,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/richtext"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="richtext form-control '),this.attribute.disabled&&e.push("is-disabled"),e.push(" "),this.attribute.readOnly&&e.push("is-readonly"),e.push('">\n\t'),this.attribute.buttons){for(e.push('\n    <div class="richtext-controls btn-group">\n      '),i=0,s=(r=this.attribute.buttons).length;i<s;i++)t=r[i],e.push('\n        <a class="btn btn--action btn--small" data-action="'),e.push(n(t)),e.push('">\n          '),e.push(this.Icon(this.toolButtons[t].icon)),e.push("\n          "),this.toolButtons[t].text&&(e.push("\n          <span>"),e.push(n(this.toolButtons[t].text)),e.push("</span>\n          ")),e.push("\n        </a>\n      ");e.push("\n    </div>\n\t")}e.push('\n  <div contenteditable="'),e.push(n(!this.attribute.disabled&&!this.attribute.readOnly)),e.push('" id="'),e.push(n(this.attribute.id)),e.push('" data-name="'),e.push(n(this.attribute.name)),e.push('" class="richtext-content '),e.push(n(this.attribute.class)),e.push('" dir="auto">'),e.push(this.attribute.value),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/searchable_select"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="dropdown-toggle'),this.attribute.multiple&&e.push(n(" tokenfield form-control")),e.push(" "),this.attribute.disabled&&e.push(" is-disabled"),e.push('" data-toggle="dropdown" data-name="'),e.push(n(this.attribute.nameRaw||this.attribute.name)),e.push('">\n  '),this.attribute.multiple){if(e.push("\n    "),"json"!==this.attribute.valueType){if(e.push('\n      <select multiple class="js-shadow hide" name="'),e.push(this.attribute.name),e.push('" tabindex="-1" '),this.attribute.disabled&&e.push(" disabled"),e.push(">\n        "),this.attribute.value){for(e.push("\n          "),t=0,i=(r=this.attribute.value).length;t<i;t++)s=r[t],e.push('\n            <option value="'),e.push(n(s.value)),e.push('" selected>'),e.push(n(s.name)),e.push("</option>\n          ");e.push("\n        ")}e.push("\n      </select>\n    ")}else e.push('\n      <input\n        class="searchableSelect-shadow form-control js-shadow"\n        '),this.attribute.id&&(e.push('id="'),e.push(n(this.attribute.id)),e.push('"')),e.push('\n        name="'),e.push(n(this.attribute.name)),e.push('"\n        '),e.push(n(this.attribute.autofocus)),e.push('\n        value="'),e.push(n(this.attribute.valueRaw||this.attribute.value)),e.push('"\n        tabindex="-1"\n        '),this.attribute.disabled&&e.push(" disabled"),e.push("\n      >\n    ");e.push("\n    "),e.push(this.tokens),e.push('\n    <input\n      class="searchableSelect-main token-input form-control js-input'),this.attribute.class&&e.push(n(" "+this.attribute.class)),e.push('"\n      placeholder="'),e.push(n(this.attribute.placeholder)),e.push('"\n      value\n      name="'),e.push(n(this.attribute.nameRaw||this.attribute.name)),e.push('_completion"\n      autocomplete="off"\n      '),this.attribute.disabled&&e.push(" disabled"),e.push("\n    >\n  ")}else e.push('\n    <input\n      class="searchableSelect-shadow form-control js-shadow"\n      '),this.attribute.id&&(e.push('id="'),e.push(n(this.attribute.id)),e.push('"')),e.push('\n      name="'),e.push(n(this.attribute.name)),e.push('"\n      '),e.push(n(this.attribute.autofocus)),e.push('\n      value="'),e.push(n(this.attribute.valueRaw||this.attribute.value)),e.push('"\n      tabindex="-1"\n      '),this.attribute.disabled&&e.push(" disabled"),e.push('\n    >\n    <input\n      class="searchableSelect-main '),this.attribute.ajax&&e.push("searchableSelect-main--with-clear-button"),e.push(" form-control js-input"),this.attribute.class&&e.push(n(" "+this.attribute.class)),e.push('"\n      placeholder="'),e.push(n(this.attribute.placeholder)),e.push('"\n      value="'),e.push(n(this.attribute.valueName)),e.push('"\n      title="'),e.push(n(this.attribute.displayName||this.attribute.valueName)),e.push('"\n      autocomplete="off"\n      '),this.attribute.disabled&&e.push(" disabled"),e.push("\n    >\n  ");e.push('\n  <div class="searchableSelect-autocomplete">\n    <span class="searchableSelect-autocomplete-invisible js-autocomplete-invisible"></span>\n    <span class="searchableSelect-autocomplete-visible js-autocomplete-visible"></span>\n  </div>\n  '),!this.attribute.ajax||this.attribute.multiple||this.attribute.disabled||(e.push('\n    <div role="button" title="'),e.push(n(this.T("Clear Selection"))),e.push('" tabindex="0" class="dropdown-clear '),this.attribute.showArrowIcon&&e.push("dropdown-clear--with-arrow-icon"),e.push(" js-clear "),this.attribute.value&&!_.isEmpty(this.attribute.value)||e.push("hide"),e.push('">\n      '),e.push(this.Icon("diagonal-cross")),e.push("\n    </div>\n  ")),e.push("\n  "),this.attribute.ajax&&!this.attribute.showArrowIcon||e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n  <div class="small loading icon"></div>\n</div>\n<div class="dropdown-menu dropdown-menu-left dropdown-menu--has-submenu js-dropdown">\n  <ul class="js-optionsList" role="menu">\n    '),e.push(this.options),e.push("\n  </ul>\n  "),e.push(this.submenus),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/searchable_select_option"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<li role="presentation" class="'),e.push(n(this.class)),e.push(" "),this.isSelected&&e.push("is-selected"),e.push(" "),!0===this.option.inactive&&e.push("has-inactive"),e.push('" data-value="'),e.push(n(this.option.value)),e.push('" data-display-name="'),e.push(n(this.option.displayName||this.option.name)),e.push('" title="'),e.push(n(this.option.name)),this.detail&&(e.push(" "),e.push(n(this.detail))),e.push('">\n  '),this.option.category&&(e.push("<small>"),e.push(n(this.option.category)),e.push("</small><br>")),e.push('\n  <span role="option" class="searchableSelect-option-text '),!0===this.option.inactive&&e.push("is-inactive"),e.push('" title="'),e.push(n(this.option.name)),this.detail&&(e.push(" "),e.push(n(this.detail))),e.push('">\n    '),e.push(n(this.option.name)),this.detail&&(e.push('<span class="dropdown-detail">'),e.push(n(this.detail)),e.push("</span>")),e.push("\n  </span>\n  "),this.option.children&&(e.push('\n  <span role="button" class="searchableSelect-option-arrow" title="'),e.push(n(this.T("Navigate to %s",this.option.name))),e.push('">\n    '),e.push(this.Icon("arrow-right","recipientList-arrow")),e.push("\n  </span>\n  ")),e.push("\n</li>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/searchable_select_submenu"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<ul class="dropdown-submenu js-optionsSubmenu" role="menu" data-parent-value="'),e.push(n(this.parentValue)),e.push('" hidden>\n  '),this.title&&(e.push('\n  <li role="button" class="dropdown-controls js-back" title="'),e.push(n(this.T("Go Back"))),e.push('">\n    '),e.push(this.Icon("arrow-left")),e.push('\n    <div class="dropdown-title">\n      '),e.push(n(this.title)),e.push("\n    </div>\n  </li>\n  ")),e.push("\n  "),e.push(this.options),e.push("\n</ul>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/select"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="controls controls--select">\n  <select '),this.attribute.id&&(e.push('id="'),e.push(n(this.attribute.id)),e.push('"')),e.push(' class="form-control'),this.attribute.class&&e.push(n(" "+this.attribute.class)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" '),e.push(n(this.attribute.multiple)),e.push(" "),e.push(n(this.attribute.required)),e.push(" "),e.push(n(this.attribute.autofocus)),e.push(" "),this.attribute.disabled&&e.push(" disabled"),e.push(">\n    "),this.attribute.options){for(e.push("\n      "),t=0,i=(s=this.attribute.options).length;t<i;t++)r=s[t],e.push('\n        <option value="'),e.push(n(r.value)),e.push('" '),e.push(n(r.selected)),e.push(" "),e.push(n(r.disabled)),e.push(">"),e.push(n(r.name)),e.push("</option>\n      ");e.push("\n    ")}e.push("\n  </select>\n  "),this.attribute.multiple||(e.push("\n    "),e.push(this.Icon("arrow-down")),e.push("\n  ")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/sidebar_tabs"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l;for(t=0,r=(a=this.items).length;t<r;t++)i=a[t],e.push('\n<div class="sidebar bottom-form-shadow flex hide" data-tab="'),e.push(n(i.name)),e.push('">\n  <div class="sidebar-header">\n    <h2 class="sidebar-header-headline js-headline">'),e.push(this.T(i.sidebarHead)),e.push('</h2>\n    <div class="sidebar-header-actions js-actions"></div>\n    <div class="tabsSidebar-close">\n      '),e.push(this.Icon("long-arrow-right")),e.push('\n    </div>\n  </div>\n  <hr>\n  <div class="sidebar-content"></div>\n</div>\n');for(e.push('\n<div class="tabsSidebar-tabs" style="'),e.push("rtl"===this.dir?"margin-right":"margin-left"),e.push(": -"),e.push(this.scrollbarWidth),e.push('px">\n'),s=0,o=(l=this.items).length;s<o;s++)i=l[s],e.push('\n  <div class="tabsSidebar-tab" data-tab="'),e.push(n(i.name)),e.push('"></div>\n');e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/sidebar_tabs_item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){!0===this.counterPossible&&this.counter&&this.counter>0&&(e.push('\n  <div class="tabsSidebar-tab-count js-tabCounter '),this.cssClass&&e.push(n(this.cssClass)),e.push('">'),e.push(n(this.counter)),e.push("</div>\n")),e.push("\n"),e.push(this.Icon(this.icon)),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/sla_times"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<table class="settings-list settings-list--toggleRow">\n  <thead>\n    <tr>\n      <th>'),e.push(this.T("Active")),e.push("\n      <th>"),e.push(this.T("Type")),e.push("\n      <th>"),e.push(this.T("Time")),e.push(' <span class="text-muted">'),e.push(this.T("in hours")),e.push('</span>\n  </thead>\n  <tbody>\n    <tr>\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out">\n          <input type="checkbox" class="js-activateRow" id="first_response_time" name="first_response_time_enabled">\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </label>\n      <td class="u-clickable js-forward-click">\n        <div>'),e.push(this.T("First Response Time")),e.push('</div>\n        <p class="subtle">'),e.push(this.T("Timeframe for the first response.")),e.push('</p>\n      <td class="u-clickable js-focus-input form-group">\n        <input type="hidden" name="first_response_time" value="'),e.push(n(this.first_response_time)),e.push('" class="js-timeConvertTo">\n        <input type="text" value="'),e.push(n(this.first_response_time_in_text)),e.push('" class="form-control form-control--small timeframe js-timeConvertFrom"  placeholder="hh:mm" name="first_response_time_in_text" data-name="first_response_time">\n\n    <tr>\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out">\n          <input type="checkbox" class="js-activateRow" id="update_time" name="update_time_enabled">\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </label>\n      <td>\n        <div class="u-clickable js-forward-click">\n          <div>'),e.push(this.T("Update Time")),e.push('</div>\n          <p class="subtle">'),e.push(this.T("Timeframe between agent updates or for an agent to respond.")),e.push('</p>\n        </div>\n\n        <p class="sla_radio_container js-forward-radio">\n          <label class="inline-label radio-replacement">\n            <input class="js-updateTypeSelector" type="radio" name="update_type" value="update" '),this.update_time&&e.push("checked"),e.push(">\n            "),e.push(this.Icon("radio","icon-unchecked")),e.push("\n            "),e.push(this.Icon("radio-checked","icon-checked")),e.push('\n            <span class="label-text">'),e.push(this.T("between agent updates")),e.push('</span>\n          </label>\n        </p>\n\n        <p class="sla_radio_container js-forward-radio u-clickable">\n          <label class="inline-label radio-replacement">\n            <input class="js-updateTypeSelector" type="radio" name="update_type" value="response" '),this.response_time&&e.push("checked"),e.push(">\n            "),e.push(this.Icon("radio","icon-unchecked")),e.push("\n            "),e.push(this.Icon("radio-checked","icon-checked")),e.push('\n            <span class="label-text">'),e.push(this.T("for an agent to respond")),e.push('</span>\n          </label>\n        </p>\n      <td class="form-group u-clickable js-focus-input u-clickable">\n        <span class="form-group">\n          <input type="hidden" name="update_time" value="'),e.push(n(this.update_time)),e.push('" class="js-timeConvertTo">\n          <input type="text" value="'),e.push(n(this.update_time_in_text)),e.push('" class="form-control form-control--small timeframe js-timeConvertFrom '),this.response_time&&e.push("hidden"),e.push('" placeholder="hh:mm" name="update_time_in_text" data-name="update_time">\n        </span>\n        <span class="form-group">\n          <input type="hidden" name="response_time" value="'),e.push(n(this.response_time)),e.push('" class="js-timeConvertTo">\n          <input type="text" value="'),e.push(n(this.response_time_in_text)),e.push('" class="form-control form-control--small timeframe js-timeConvertFrom '),this.response_time||e.push("hidden"),e.push('" placeholder="hh:mm" name="response_time_in_text" data-name="response_time">\n        </span>\n\n    <tr>\n      <td class="u-positionOrigin">\n        <label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out">\n          <input type="checkbox" id="solution_time" class="js-activateRow" name="solution_time_enabled">\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        </label>\n      <td class="u-clickable js-forward-click">\n        <div>'),e.push(this.T("Solution Time")),e.push('</div>\n        <p class="subtle">'),e.push(this.T("Timeframe for solving the problem.")),e.push('</p>\n      <td class="form-group u-clickable js-focus-input">\n        <input type="hidden" name="solution_time" value="'),e.push(n(this.solution_time)),e.push('" class="js-timeConvertTo">\n        <input type="text" value="'),e.push(n(this.solution_time_in_text)),e.push('" class="form-control form-control--small timeframe js-timeConvertFrom" placeholder="hh:mm" name="solution_time_in_text" data-name="solution_time">\n\n    </tr>\n  </tbody>\n</table>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/switch"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="'),e.push(n(this.attribute.class)),e.push(' horizontal-filters-switch horizontal-filters-switch--align-start">\n  <label>\n    '),e.push(this.T(this.attribute.display)),e.push('\n    <div class="zammad-switch zammad-switch--small js-switch">\n      <input name="'),e.push(n(this.attribute.name)),e.push('" type="checkbox" value="true" id="attribute-'),e.push(n(this.attribute.name)),e.push('" '),this.attribute.value&&e.push("checked"),e.push(" "),this.attribute.disabled&&e.push("disabled"),e.push('>\n      <label for="attribute-'),e.push(n(this.attribute.name)),e.push('"></label>\n    </div>\n  </label>\n  '),this.attribute.note&&(e.push('<span class="help-text">'),e.push(this.T(this.attribute.note)),e.push("</span>")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/table"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;for(e.push('<div class="js-pager"></div>\n<table class="table table-hover'),this.class&&(e.push(" "),e.push(n(this.class))),e.push('">\n  <thead>\n    <tr>\n    '),this.sortable&&e.push('\n      <th style="width: 36px" class="table-draggable"></th>\n    '),e.push("\n    "),this.checkbox&&(e.push('\n      <th style="width: 30px" class="table-checkbox">\n        <label class="checkbox-replacement">\n          <input type="checkbox" value="" name="bulk_all">\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n          "),e.push(this.Icon("checkbox-indeterminate","icon-indeterminate")),e.push("\n        </label>\n      </th>\n    ")),e.push("\n    "),this.radio&&e.push('\n      <th style="width: 30px" class="table-radio"></th>\n    '),e.push("\n    "),i=s=0,r=(o=this.headers).length;s<r;i=++s)t=o[i],e.push('\n      <th class="js-tableHead'),t.className&&(e.push(" "),e.push(n(t.className))),t.align&&(e.push(" align-"),e.push(n(t.align))),e.push('" style="'),t.displayWidth&&(e.push("width:"),e.push(n(t.displayWidth)),e.push("px")),e.push('" data-column-key="'),e.push(n(t.name)),e.push('">\n        <div class="table-column-head'),(this.sortable||t.unsortable)&&e.push(n(" table-column-head-unclickable")),!this.tableId||this.sortable||t.unsortable||e.push(n(" js-sort")),e.push('">\n          <div class="table-column-title">'),e.push(this.T(t.display)),e.push("</div>\n          "),this.sortable||(e.push('\n            <div class="table-column-sortIcon">'),t.sortOrderIcon&&e.push(this.Icon(t.sortOrderIcon[0],t.sortOrderIcon[1])),e.push("</div>\n          ")),e.push("\n        </div>\n        "),this.tableId&&!t.unresizable&&i<this.headers.length-1&&this.headers.length-1!==i&&this.headers[i+1]&&!this.headers[i+1].unresizable&&e.push('\n          <div class="table-col-resize js-col-resize"></div>\n        '),e.push("\n      </th>\n    ");e.push('\n    </tr>\n  </thead>\n  <tbody class="js-tableBody">'),e.push(this.tableBody),e.push('</tbody>\n</table>\n<div class="js-pager"></div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/table_pager"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(e.push('<div class="btn-group btn-group--full" role="group" aria-label="" style="margin-bottom: 5px;">\n  '),i=t=0,s=this.pages;0<=s?t<=s:t>=s;i=0<=s?++t:--t)e.push('\n    <div class="btn btn--text btn--large js-page'),this.page!==i&&this.page!==i.toString()||e.push(" is-selected"),e.push('" data-page="'),e.push(n(i)),e.push('">'),e.push(n(i+1)),e.push("</div>\n  ");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/table_row"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b;for(e.push('<tr class="item'),!1===this.object.active&&e.push(n(" is-inactive")),this.object.rowClass&&e.push(n(" "+this.object.rowClass())),e.push('" data-id="'),e.push(n(this.object.id)),e.push('">\n'),this.sortable&&(e.push('\n  <td class="table-draggable">'),e.push(this.Icon("draggable")),e.push("</td>\n")),e.push("\n"),this.checkbox&&(e.push('\n  <td class="table-checkbox js-checkbox-field">\n    <label class="checkbox-replacement">\n      <input type="checkbox" value="'),e.push(n(this.object.id)),e.push('" name="bulk">\n      '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n      "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n    </label>\n  </td>\n")),e.push("\n"),this.radio&&(e.push('\n  <td class="table-radio">\n    <label class="radio-replacement">\n      <input type="radio" value="'),e.push(n(this.object.id)),e.push('" name="radio">\n      '),e.push(this.Icon("radio","icon-unchecked")),e.push("\n      "),e.push(this.Icon("radio-checked","icon-checked")),e.push("\n    </label>\n  </td>\n")),e.push("\n"),c=0,h=(m=this.headers).length;c<h;c++){if(l=m[c],e.push("\n  "),b=this.P(this.object,l.name,this.attributes,!0),e.push("\n  "),this.callbacks){for(i in e.push("\n  "),g=this.callbacks){if(r=g[i],e.push("\n  "),i===l.name){for(e.push("\n  "),u=0,d=r.length;u<d;u++)s=r[u],e.push("\n  "),b=s(b,this.object,l,this.headers),e.push("\n  ");e.push("\n  ")}e.push("\n  ")}e.push("\n  ")}if(e.push('\n  <td class="'),l.parentClass&&e.push(n(l.parentClass)),e.push(" "),l.align&&(e.push(" align-"),e.push(n(l.align))),e.push('" '),l.title&&(e.push(' title="'),e.push(n(l.title)),e.push('"')),e.push(">\n    "),"icon"===l.name)e.push("\n      "),e.push(this.Icon("task-state",l.class)),e.push("\n    ");else if(l.icon)e.push("\n      "),e.push(this.Icon(l.icon)),e.push("\n    ");else if("action"===l.name){if(e.push("\n      "),this.actions.length>1){for(e.push('\n        <div class="dropdown dropdown--actions">\n          <div class="btn btn--table btn--text btn--secondary js-action" data-toggle="dropdown">\n            '),e.push(this.Icon("overflow-button")),e.push('\n          </div>\n          <ul class="dropdown-menu dropdown-menu-right js-table-action-menu" role="menu">\n            '),p=0,f=(v=this.actions).length;p<f;p++)t=v[p],e.push('\n            <li role="presentation" class="'),e.push(n(t.class)),e.push('" data-table-action="'),e.push(n(t.name)),e.push('">\n              <a role="menuitem" tabindex="-1">\n                <span class="dropdown-iconSpacer">\n                  '),e.push(this.Icon(t.icon)),e.push("\n                </span>\n                "),e.push(this.T(t.display)),e.push("\n              </a>\n            ");e.push("\n          </ul>\n        </div>\n      ")}else e.push('\n        <div class="btn btn--text btn--secondary '),
e.push(n(this.actions[0].class)),e.push('" title="'),e.push(n(this.actions[0].display)),e.push('" data-table-action="'),e.push(n(this.actions[0].name)),e.push('">\n          '),e.push(this.Icon(this.actions[0].icon)),e.push("\n        </div>\n      ");e.push("\n    ")}else{if(e.push("\n      "),l.link&&(e.push('\n        <a href="'),e.push(l.link),e.push('" '),l.target&&(e.push('target="'),e.push(n(l.target)),e.push('"')),e.push(">\n      ")),e.push("\n      "),l.raw)e.push("\n        "),e.push(l.raw),e.push("\n      ");else{if(e.push("\n        "),l.prefixIcon&&(e.push('\n          <span class="prefix-icon">'),e.push(this.Icon(l.prefixIcon)),e.push("</span>\n        ")),e.push("\n        "),l.class||l.data){if(e.push("\n        <span "),l.class&&(e.push('class="'),e.push(n(l.class)),e.push('"')),e.push(" "),l.data)for(a in y=l.data)o=y[a],e.push("data-"),e.push(a),e.push('="'),e.push(n(o)),e.push('" ');e.push(">\n        ")}e.push("\n        "),e.push(b),e.push("\n        "),this.object.constructor.configure_set_as_default&&l.name===this.object.constructor.configure_set_as_default_marker_attribute&&(e.push("\n          "),this.object.constructor.is_default(this.object)&&(e.push('\n            <span class="badge badge--primary">'),e.push(n(this.T("Default"))),e.push("</span>\n          ")),e.push("\n         ")),e.push("\n        "),(l.class||l.data)&&e.push("</span>"),e.push("\n      ")}e.push("\n      "),l.link&&e.push("</a>"),e.push("\n    ")}e.push("\n  </td>\n")}e.push("\n</tr>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/table_row_group_by"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<tr>\n  <td colspan="'),e.push(n(this.columnsLength)),e.push('"><b>'),e.push(this.groupByName),this.groupByCount&&(e.push(" ("),e.push(n(this.groupByCount)),e.push(")")),e.push("</b></td>\n</tr>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/tabs"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="page-header page-header--tabs">\n  <div class="page-header-title">\n    '),this.headerSwitchName&&(e.push('\n      <div class="zammad-switch zammad-switch--small js-header-switch" data-name="'),e.push(n(this.headerSwitchName)),e.push('">\n         <input name="'),e.push(n(this.headerSwitchName)),e.push('" type="checkbox" id="setting-'),e.push(n(this.headerSwitchName)),e.push('" '),this.headerSwitchChecked&&e.push("checked"),e.push('>\n         <label for="setting-'),e.push(n(this.headerSwitchName)),e.push('"></label>\n      </div>\n    ')),e.push("\n    <h1>"),e.push(this.T(this.header)),e.push(" <small>"),e.push(this.T(this.subHeader)),e.push("</small></h1>\n  </div>\n  "),this.addTab&&(e.push('\n  <div class="page-header-meta">\n    <div class="btn btn--success btn--quad">\n      '),e.push(this.Icon("plus")),e.push("\n    </div>\n  </div>\n  ")),e.push('\n</div>\n<div class="page-content">\n  '),this.tabs.length>1){for(e.push('\n    <ul class="nav nav-tabs" role="tablist">\n    '),t=0,i=(s=this.tabs).length;t<i;t++)r=s[t],e.push('\n      <li><a href="#'),e.push(n(r.target)),e.push('" role="tab" data-toggle="tab">'),e.push(this.T(r.name)),e.push("</a></li>\n    ");e.push("\n    </ul>\n  ")}e.push('\n  <div class="tab-content"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/textarea"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<textarea id="'),e.push(n(this.attribute.id)),e.push('" name="'),e.push(n(this.attribute.name)),e.push('" class="form-control '),e.push(n(this.attribute.class)),e.push('" rows="'),e.push(n(this.attribute.rows)),e.push('"'),this.attribute.maxlength&&(e.push(' maxlength="'),e.push(n(this.attribute.maxlength)),e.push('"')),e.push(" "),e.push(n(this.attribute.required)),e.push(" "),e.push(n(this.attribute.autofocus)),e.push(" "),this.attribute.disabled&&e.push(" disabled"),e.push(">"),e.push(n(this.attribute.value)),e.push("</textarea>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_duplicate_detection"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="alert alert--warning duplicate-ticket-detection hide" role="alert" data-name="'),e.push(n(this.attribute.name)),e.push('"></div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_duplicate_detection/warning"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h;if(e.push('<button type="button" class="close js-close" aria-label="'),e.push(n(this.T("Close"))),e.push('">\n  '),e.push(this.Icon("diagonal-cross")),e.push("\n</button>\n<h4>"),e.push(n(this.T(this.C("ticket_duplicate_detection_title")))),e.push("</h4>\n<p>"),e.push(n(this.T(this.C("ticket_duplicate_detection_body")))),e.push("</p>\n"),this.items.length){for(e.push("\n  <ul>\n    "),t=0,r=(l=this.items.slice(0,2)).length;t<r;t++)i=(c=l[t])[0],a=c[1],h=c[2],e.push('\n      <li>\n        <a href="#ticket/zoom/'),e.push(n(i)),e.push('">'),e.push(n(a)),e.push("</a> "),e.push(n(h)),e.push("\n      </li>\n    ");if(e.push("\n    "),this.items.length>2){for(e.push('\n      <div class="panel-collapse collapse in hide js-collapse">\n        '),s=0,o=(u=this.items.slice(2)).length;s<o;s++)i=(p=u[s])[0],a=p[1],h=p[2],e.push('\n          <li>\n            <a href="#ticket/zoom/'),e.push(n(i)),e.push('">'),e.push(n(a)),e.push("</a> "),e.push(n(h)),e.push("\n          </li>\n        ");e.push('\n      </div>\n      <div class="btn btn--text js-toggleCollapse">'),e.push(this.T("See more")),e.push("</div>\n    ")}e.push("\n  </ul>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a;for(e.push('<div class="tasks tasks--standalone">\n  '),t=s=0,r=(o=this.tickets).length;s<r;t=++s)a=o[t],e.push("\n  "),t===this.show_max&&(e.push("\n  "),i=_.uniqueId("show_all_"),e.push('\n  <div class="collapse" id="'),e.push(n(i)),e.push('">\n  ')),e.push('\n  <div class="task">\n    <div class="icon-holder" title="'),e.push(a.iconTitle()),e.push('">\n      '),e.push(this.Icon("task-state",a.iconClass())),e.push('\n    </div>\n    <div class="task-text">\n      <a class="name ticket-popover" data-id="'),e.push(a.id),e.push('" href="'),e.push(a.uiUrl()),e.push('">\n        '),this.show_id&&(e.push('\n          <span class="task-id">#'),e.push(n(a.number)),e.push("</span>\n        ")),e.push("\n        "),e.push(n(a.title||"-")),e.push("\n      </a>\n      "),e.push(this.humanTime(a.created_at,!1,"time")),e.push("\n    </div>\n    "),this.object&&this.editable&&(e.push('\n    <a class="list-item-delete js-delete" data-object="'),e.push(n(this.object)),e.push('" data-object-id="'),e.push(n(a.id)),e.push('" data-link-type="'),e.push(n(this.linkType||"normal")),e.push('" data-type="remove">\n      '),e.push(this.Icon("diagonal-cross")),e.push("\n    </a>\n    ")),e.push("\n  </div>\n  ");e.push("\n  "),this.tickets.length>this.show_max&&(e.push('\n  </div>\n  <div class="btn btn--text btn-show-all" role="button" data-toggle="collapse" data-target="#'),e.push(n(i)),e.push('" aria-expanded="false" aria-controls="'),e.push(n(i)),e.push('">\n    <div data-show="open">'),e.push(this.Icon("arrow-down")),e.push(" <span>"),e.push(this.T("Show all\u2026")),e.push('</span></div>\n    <div data-show="collapsed">'),e.push(this.Icon("arrow-up")),e.push(" <span>"),e.push(this.T("Show less")),e.push("</span></div>\n  </div>\n  ")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_perform_action/article"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Visibility")),e.push('</label>\n  </div>\n  <div class="js-internal"></div>\n</div>\n<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Subject")),e.push('</label>\n  </div>\n  <div class="controls js-subject">\n    <input type="text" name="'),e.push(n(this.name)),e.push('::subject" value="'),e.push(n(this.meta.subject)),e.push('" class="form-control" style="width: 100%;" placeholder="'),e.push(this.T("Subject")),e.push('">\n  </div>\n</div>\n<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Body")),e.push('</label>\n  </div>\n  <div class="controls js-body js-body-'),e.push(this.articleType),e.push('">\n    <div class="richtext form-control"><div contenteditable="true" data-name="'),e.push(n(this.name)),e.push('::body">'),e.push(this.meta.body),e.push("</div></div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_perform_action/attribute_selector"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="flex horizontal">\n  '),this.attribute.simple_attribute_selector||(e.push('\n  <div class="controls half-space-right flex-no-shrink">\n    <div class="u-positionOrigin js-operator">\n      <select></select>\n      '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n    </div>\n  </div>\n  <div class="controls half-space-right">\n    <div class="u-positionOrigin js-preCondition">\n      <select></select>\n      '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push("\n    </div>\n  </div>\n  ")),e.push('\n  <div class="controls js-value horizontal horizontal-filter-value"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_perform_action/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="horizontal-filters"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_perform_action/notification"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Visibility")),e.push('</label>\n  </div>\n  <div class="js-internal"></div>\n</div>\n<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Recipient")),e.push('</label>\n  </div>\n  <div class="controls js-recipient u-positionOrigin">\n    <select></select>\n  </div>\n</div>\n'),"email"===this.notificationType&&(e.push('\n<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Subject")),e.push('</label>\n  </div>\n  <div class="controls js-subject"><input type="text" name="'),e.push(n(this.name)),e.push('::subject" value="'),e.push(n(this.meta.subject)),e.push('" style="width: 100%;" placeholder="'),e.push(this.T("Subject")),e.push('" class="form-control"></div>\n</div>\n<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Include attachments of the article?")),e.push('</label>\n  </div>\n  <div class="js-include_attachments"></div>\n</div>\n')),e.push('\n<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Body")),e.push('</label>\n  </div>\n  <div class="controls js-body js-body-'),e.push(this.notificationType),e.push('">\n    <div class="richtext form-control">\n      <div contenteditable="true" data-name="'),e.push(n(this.name)),e.push('::body">'),e.push(this.meta.body),e.push('</div>\n    </div>\n  </div>\n  <div class="controls js-sign">\n  </div>\n  <div class="controls js-encryption">\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_perform_action/row"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="horizontal-filter js-filterElement">\n  <div class="horizontal-filter-body">\n    <div class="controls flex-no-shrink">\n      <div class="u-positionOrigin js-attributeSelector">\n        '),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push('\n      </div>\n    </div>\n    <div class="controls js-setAttribute horizontal span-width"></div>\n    <div class="horizontal-filter-group js-setNotification flex"></div>\n    <div class="horizontal-filter-group js-setArticle flex"></div>\n  </div>\n  <div class="filter-controls js-rowActions">\n    <div class="filter-control filter-control-remove js-remove" title="'),e.push(this.Ti("Remove")),e.push('">\n      '),e.push(this.Icon("minus-small")),e.push('\n    </div>\n    <div class="filter-control filter-control-add js-add" title="'),e.push(this.Ti("Add")),e.push('">\n      '),e.push(this.Icon("plus-small")),e.push("\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_perform_action/webhook"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="form-group">\n  <div class="formGroup-label">\n    <label>'),e.push(this.T("Webhooks")),e.push('</label>\n  </div>\n  <div class="controls js-webhooks"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/ticket_perform_action/webhook_not_available"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<div>"),e.push(this.T('No webhook available, please create a new one or activate an existing one at "Manage > Webhook"')),e.push("</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/time_range"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(t in e.push('<div class="controls u-positionOrigin js-valueRangeSelector"></div>\n<div class="half-spacer"></div>\n<div class="controls u-positionOrigin">\n  <select class="form-control js-range" '),this.attribute.name&&(e.push('name="'),e.push(n(this.attribute.name)),e.push('::range"')),e.push(">\n    "),i=this.ranges)s=i[t],e.push('\n      <option value="'),e.push(n(t)),e.push('" '),this.attribute.value&&this.attribute.value.range===t&&e.push("selected"),e.push(">"),e.push(s),e.push("</option>\n    ");e.push("\n  </select>\n  "),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/time_range_value_selector"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(t in e.push('<select class="form-control js-value" '),this.attribute.name&&(e.push('name="'),e.push(n(this.attribute.name)),e.push('::value"')),e.push(">\n  "),i=this.values)s=i[t],e.push('\n    <option value="'),e.push(n(t)),e.push('" '),this.selected_value&&this.selected_value.toString()===t.toString()&&e.push("selected"),e.push(">"),e.push(s),e.push("</option>\n  ");e.push("\n</select>\n"),e.push(this.Icon("arrow-down","dropdown-arrow")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/timeplan"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<div>\n  <label>"),e.push(this.T("Days")),e.push('\n    <div class="days"></div>\n  </label>\n  <label>'),e.push(this.T("Hours")),e.push('\n    <div class="hours"></div>\n  </label>\n  <label>'),e.push(this.T("Minutes")),e.push('\n    <div class="minutes"></div>\n  </label>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/timer"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u;for(t in e.push('<output class="timer-output">\n  <p class="js-timerResult"></p>\n</output>\n\n<div class="select-boxes">\n  <div class="select-box select-box--vertical js-day">\n    <div class="select-box-header">'),e.push(this.T("Day")),e.push("</div>\n    "),l=this.days)i=l[t],e.push('\n      <div data-type="day" class="select-value '),this.attribute.value.days[t]&&e.push("is-selected"),e.push('" data-value="'),e.push(t),e.push('">'),e.push(this.T(i)),e.push('</div>\n      <input type="hidden" class="js-boolean" name="'),e.push(n(this.attribute.name)),e.push("::days::"),e.push(t),e.push('" value="'),this.attribute.value.days[t]?e.push("true"):e.push("false"),e.push('">\n    ');for(s in e.push('\n  </div>\n  <div class="select-box select-box--four js-hour">\n    <div data-type="hour" class="select-box-header">'),e.push(this.T("Hour")),e.push("</div>\n    "),c=this.hours)r=c[s],e.push('\n      <div data-type="hour" class="select-value '),this.attribute.value.hours[s]&&e.push("is-selected"),e.push('" data-value="'),e.push(s),e.push('">'),e.push(r),e.push('</div>\n      <input type="hidden" class="js-boolean" name="'),e.push(n(this.attribute.name)),e.push("::hours::"),e.push(s),e.push('" value="'),this.attribute.value.hours[s]?e.push("true"):e.push("false"),e.push('">\n    ');for(o in e.push('\n  </div>\n  <div class="select-box select-box--vertical js-minute">\n    <div data-type="minute" class="select-box-header">'),e.push(this.T("Minute")),e.push("</div>\n    "),u=this.minutes)a=u[o],e.push('\n      <div data-type="minute" class="select-value '),this.attribute.value.minutes[o]&&e.push("is-selected"),e.push('" data-value="'),e.push(o),e.push('">'),e.push(a),e.push('</div>\n      <input type="hidden" class="js-boolean" name="'),e.push(n(this.attribute.name)),e.push("::minutes::"),e.push(o),e.push('" value="'),this.attribute.value.minutes[o]?e.push("true"):e.push("false"),e.push('">\n    ');e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/token"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="token" data-value="'),e.push(n(this.value)),e.push('"'),this.object||(e.push(' title="'),e.push(n(this.name.split("::").join(" \u203a ")||"-")),e.push('"')),e.push('>\n  <span class="token-label">'),e.push(n(this.name.split("::").join(" \u203a ")||"-")),e.push('</span>\n  <span class="token-close js-remove'),this.disabled&&e.push(" is-disabled"),e.push('">\xd7</span>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/user_permission"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="checkbox '),e.push(n(this.attribute.class)),e.push('">\n  '),t=0,i=(s=this.roles).length;t<i;t++)r=s[t],e.push('\n    <label class="inline-label checkbox-replacement">\n      <input type="checkbox" value="'),e.push(n(r.id)),e.push('" name="role_ids" '),_.include(this.rolesSelected,r.id)&&e.push("checked"),e.push("/>\n      "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n      "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n      <span class="label-text">'),e.push(this.Ti(r.displayName())),e.push("</span>\n      "),r.note&&(e.push('<span class="help-text">'),e.push(this.T(r.note)),e.push("</span>")),e.push("\n    </label>\n  ");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/generic/user_permission_group"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d;for(s in e.push('<table class="settings-list" style="width: 100%;">\n  <thead>\n    <th>'),e.push(this.T("Group")),e.push("\n    "),a=this.groupAccesses)d=a[s],e.push("\n      <th>"),e.push(this.T(d)),e.push("\n    ");for(e.push("\n    <th>"),e.push(this.T("Action")),e.push("\n  <tbody>\n  "),i=0,r=(l=this.groupsSelected).length;i<r;i++){for(s in t=l[i],e.push("\n    "),o=(null!=(c=this.params.group_ids)?c[t.id]:void 0)||[],e.push('\n    <tr data-id="'),e.push(n(t.id)),e.push('">\n      <td class="settings-list-middle">\n        '),e.push(n(this.P(t,"name"))),e.push("\n      "),u=this.groupAccesses)d=u[s],e.push('\n        <td class="settings-list-middle">\n          <label class="inline-label checkbox-replacement">\n            <input class="js-groupListItem" type="checkbox" value="'),e.push(n(s)),e.push('" name="group_ids::'),e.push(n(t.id)),e.push('" '),_.contains(o,s)&&e.push("checked"),e.push("/>\n            "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n            "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n          </label>\n      ");e.push('\n      <td class="js-groupListItemAction settings-list-middle">\n        <a class="btn btn--text btn--primary js-remove">\n          '),e.push(this.Icon("trash")),e.push("\n          "),e.push(n(this.T("Remove"))),e.push("\n        </a>\n    </tr>\n  ")}for(s in e.push('\n  <tr class="hide js-groupListShadowItemRow">\n    <td class="settings-list-middle">\n    '),p=this.groupAccesses)d=p[s],e.push('\n      <td class="settings-list-middle">\n        <label class="inline-label checkbox-replacement">\n          <input class="js-groupListItem" type="checkbox" value="'),e.push(n(s)),e.push('" name="group_ids::" />\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n        </label>\n    ");for(s in e.push('\n    <td class="js-groupListItemAction settings-list-middle">\n      <a class="btn btn--text btn--primary js-remove">\n        '),e.push(this.Icon("trash")),e.push("\n        "),e.push(n(this.T("Remove"))),e.push('\n      </a>\n  </tr>\n  <tr class="js-groupListNewItemRow">\n    <td class="js-groupListItemAddNew settings-list-middle">\n    '),h=this.groupAccesses)d=h[s],e.push('\n      <td class="settings-list-middle">\n        <label class="inline-label checkbox-replacement">\n          <input class="js-groupListItem" type="checkbox" value="'),e.push(n(s)),e.push('" />\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n        </label>\n    ");e.push('\n    <td class="js-groupListItemAction settings-list-middle">\n      <a class="btn btn--text btn--create js-add">\n        '),e.push(this.Icon("plus-small")),e.push("\n        "),e.push(n(this.T("Add"))),e.push("\n      </a>\n  </tr>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/admin"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <form class="setup wizard js-admin">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Administrator Account")),e.push('</h2>\n      <div class="wizard-body vertical justified js-admin-form"></div>\n      <div class="wizard-controls center">\n        <a class="btn btn--text btn--secondary" href="#getting_started">'),e.push(this.T("Go Back")),e.push('</a>\n        <button class="btn btn--success align-right">'),e.push(this.T("Create")),e.push("</button>\n      </div>\n    </div>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/agent"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <form class="setup wizard js-agent">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Invite Colleagues")),e.push('</h2>\n      <div class="wizard-body vertical justified js-agent-form"></div>\n      <div class="wizard-controls center">\n        <a class="btn btn--primary align-left" href="#getting_started/finish">'),e.push(this.T("Continue")),e.push('</a>\n        <button class="btn btn--success align-right">'),e.push(this.T("Invite")),e.push("</button>\n      </div>\n    </div>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/auto_wizard_enabled"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <div class="setup wizard">\n    <div class="wizard-slide">\n      <div class="wizard-body vertical centered">\n        '),e.push(this.T("The auto wizard is enabled. Please use the provided auto wizard url.")),e.push("\n      </div>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/auto_wizard_failed"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),
e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <div class="setup wizard">\n    <div class="wizard-slide">\n      <div class="wizard-body vertical centered">\n        '),e.push(this.T(this.message)),e.push("\n      </div>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/auto_wizard_splash"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/base"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <form class="setup wizard js-base">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Organization")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <fieldset>\n          <div class="form-group">\n            <label>'),e.push(this.T("Organization Name")),e.push('</label>\n            <div class="alert alert--danger hide" role="alert"></div>\n            <input class="form-control" name="organization" placeholder="'),e.push(this.Ti("Company Inc.")),e.push('" value="'),e.push(n(this.organization)),e.push('" required>\n          </div>\n          <div class="form-group">\n            <label>'),e.push(this.T("Logo")),e.push('</label>\n            <div class="alert alert--danger hide" role="alert"></div>\n            <img class="logo-preview" src="'),e.push(n(this.logoUrl)),e.push('">\n            <div class="logo-preview-placeholder">'),e.push(this.T("Your Logo")),e.push('</div>\n            <div class="btn btn--success fileUpload">'),e.push(this.T("Upload")),e.push('<input type="file" class="js-upload" name="logo" accept="image/*"></div>\n          </div>\n          '),this.C("system_online_service")||(e.push('\n          <div class="form-group">\n            <label>'),e.push(this.T("System URL")),e.push('</label>\n            <div class="alert alert--danger hide" role="alert"></div>\n            <input type="text" class="form-control" name="url" value="'),e.push(n(this.url)),e.push('" placeholder="http://zammad.example.com" required>\n            <p class="help-block">'),e.push(this.T("The URL to this installation of Zammad.")),e.push("</p>\n          </div>\n          ")),e.push('\n        </fieldset>\n      </div>\n      <div class="wizard-controls center">\n        <button class="btn btn--primary align-right">'),e.push(this.T("Next")),e.push("</button>\n      </div>\n    </div>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/channel"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <form class="setup wizard js-channel">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Connect Channels")),e.push('</h2>\n      <div class="wizard-body vertical center">\n        <p class="text-center">'),e.push(this.T("Set up the communication channels you want to use with your Zammad.")),e.push('</p>\n        <div class="wizard-buttonList vertical">\n\n          '),i=0,s=(r=this.adapters).length;i<s;i++)t=r[i],e.push('\n            <a href="'),e.push(n(t.link)),e.push('" class="btn auth_provider auth_provider--wide '),e.push(n(t.class)),e.push('">\n              <div class="'),e.push(n(t.class)),e.push(' provider_icon"></div>\n              <div class="provider_name">'),e.push(this.T(t.name)),e.push("</div>\n            </a>\n          ");e.push('\n\n        </div>\n      </div>\n      <div class="wizard-controls center">\n        <a class="btn btn--text btn--secondary" href="#getting_started/email_notification">'),e.push(this.T("Go Back")),e.push('</a>\n        <a class="btn align-right" href="#getting_started/finish">'),e.push(this.T("Skip")),e.push("</a>\n      </div>\n    </div>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/email"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n\n  <form class="setup wizard js-intro">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Email Account")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <fieldset>\n          <div class="form-group">\n            <label>'),e.push(this.T("Full Name")),e.push('</label>\n            <input type="text" class="form-control" value="" name="realname" placeholder="'),e.push(this.Ti("Organization Support")),e.push('" required autocomplete="off">\n          </div>\n          <div class="form-group">\n            <label>'),e.push(this.T("Email")),e.push('</label>\n            <input type="email" class="form-control" value="" name="email" placeholder="'),e.push(this.Ti("support@example.com")),e.push('" required autocomplete="off">\n          </div>\n          <div class="form-group">\n            <label>'),e.push(this.T("Password")),e.push('</label>\n            <input type="password" class="form-control" name="password" value="" required autocomplete="off">\n          </div>\n        </fieldset>\n      </div>\n      <div class="wizard-controls center">\n        <a class="btn btn--text btn--secondary" href="#getting_started/channel">'),e.push(this.T("Go Back")),e.push('</a>\n        <button class="btn btn--primary align-right">'),e.push(this.T("Connect")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="setup wizard hide js-probe">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Email Account")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Testing")),e.push(' <span class="js-email"></span>\n        </p>\n      </div>\n    </div>\n  </form>\n\n  <form class="setup wizard hide js-test">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Email Account")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Verifying\u2026")),e.push('\n        </p>\n      </div>\n    </div>\n  </form>\n\n  <form class="setup wizard hide js-verify">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Email Account")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Verify sending and receiving")),e.push('\n        </p>\n      </div>\n    </div>\n  </form>\n\n  <form class="setup wizard hide js-inbound">\n    <div class="wizard-slide wizard-slide--large">\n      <h2>'),e.push(this.T("Email Inbound")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n          '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n        </div>\n        <div class="base-inbound-settings"></div>\n      </div>\n      <div class="wizard-controls center">\n        <a class="btn btn--text btn--secondary js-goToSlide" data-slide="js-intro">'),e.push(this.T("Go Back")),e.push('</a>\n        <button class="btn btn--primary align-right">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="setup wizard hide js-inbound-acknowledge">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Email Inbound")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n          '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n        </div>\n        <p class="js-messageFound">'),e.push(this.T("We have already found %s email(s) in your mailbox. We will move them all from your mailbox into Zammad.","x")),e.push('</p>\n\n        <div class="js-archiveMessage">\n          <p class="js-archiveMessageCount">'),e.push(this.T('In addition, we have found emails in your mailbox that are older than %s weeks. You can import such emails as an "archive", which means that no notifications are sent and the tickets have the status "closed". However, you can find them in Zammad anytime using the search function.',"x")),e.push("</p>\n\n          <p>"),e.push(this.T("Should the emails from this mailbox be imported as an archive or as regular emails?")),e.push("</p>\n\n          <ul>\n            <li>"),e.push(this.T("Import as archive: |No notifications are sent|, the |tickets are closed|, and original timestamps are used. You can still find them in Zammad using the search.")),e.push("</li>\n            <li>"),e.push(this.T("Import as regular: |Notifications are sent| and the |tickets are open| - you can find the tickets in the overview of open tickets.")),e.push('</li>\n          </ul>\n\n          <p class="js-importType">\n            Import as: <span class="js-importTypeSelect"></span>\n          </p>\n        </div>\n        <div class="inbound-acknowledge-settings"></div>\n      </div>\n      <div class="wizard-controls center">\n        <a class="btn btn--text btn--secondary js-goToSlide js-back" data-slide="js-intro">'),e.push(this.T("Go Back")),e.push('</a>\n        <button class="btn btn--primary js-goToSlide js-next align-right" data-slide="js-outbound">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="setup wizard hide js-outbound">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Email Outbound")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n          '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n        </div>\n        <div class="base-outbound-type"></div>\n        <div class="base-outbound-settings"></div>\n      </div>\n      <div class="wizard-controls center">\n        <a class="btn btn--text btn--secondary js-goToSlide" data-slide="js-inbound">'),e.push(this.T("Go Back")),e.push('</a>\n        <button class="btn btn--primary align-right">'),e.push(this.T("Continue")),e.push("</button>\n      </div>\n    </div>\n  </form>\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/email_notification"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n\n  <form class="setup wizard js-outbound">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Email Notification")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n          '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n        </div>\n        <div class="base-outbound-type"></div>\n        <div class="base-outbound-settings"></div>\n      </div>\n      <div class="wizard-controls center">\n        <a class="btn btn--text btn--secondary" href="#getting_started/base">'),e.push(this.T("Go Back")),e.push('</a>\n        <a class="btn align-right" href="#getting_started/channel">'),e.push(this.T("Skip")),e.push('</a>\n        <button class="btn btn--primary align-right">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="setup wizard hide js-test">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Email Notification")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Verifying\u2026")),e.push("\n        </p>\n      </div>\n    </div>\n  </form>\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/email_pre_configured"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <form class="setup wizard js-channel">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Connect Channels")),e.push('</h2>\n      <div class="wizard-body vertical center">\n        <p class="text-center">'),e.push(this.T("Your Zammad has the following email address:")),e.push("</p>\n        "),this.addresses){for(e.push("\n          "),i=0,s=(r=this.addresses).length;i<s;i++)t=r[i],e.push("\n          <p>"),e.push(n(t.name)),e.push(" &lt;"),e.push(n(t.email)),e.push("&gt;</p>\n          ");e.push("\n        ")}e.push('\n        <p class="text-center">'),e.push(this.T("If you want to use additional email addresses, you can configure them later.")),e.push('</p>\n      </div>\n      <div class="wizard-controls center">\n        <a class="btn btn--text btn--secondary" href="#getting_started/base">'),e.push(this.T("Go Back")),e.push('</a>\n        <a class="btn align-right" href="#getting_started/finish">'),e.push(this.T("Finish")),e.push("</a>\n      </div>\n    </div>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/finish"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <form class="setup wizard">\n    <div class="wizard-slide">\n      <h2>'),e.push(this.T("Setup Finished")),e.push('</h2>\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span>'),e.push(this.T("Starting Zammad")),e.push("\n        </p>\n      </div>\n    </div>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/getting_started/intro"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <div class="setup wizard js-start">\n    <div class="wizard-slide">\n      <div class="wizard-body vertical centered">\n        <a class="btn btn--primary" href="#getting_started/admin">'),e.push(this.T("Set up a new system")),e.push('</a>\n      </div>\n      <div class="wizard-aside">\n        <span class="u-clickable u-highlight"><a href="#import">'),e.push(this.T("Or migrate from another system.")),e.push("</a></span>\n      </div>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/google/app_config"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<p>\n  '),e.push(this.T("You can find a tutorial on how to manage a %s in our online documentation %l.","Google App","https://admin-docs.zammad.org/en/latest/channels/google/index.html")),e.push("\n</p>\n<fieldset>\n  <h2>"),e.push(this.T("Enter your %s App Keys","Google")),e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="client_id">'),e.push(this.T("Google Client ID")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="client_id" type="text" name="client_id" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.client_id)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="client_secret">'),e.push(this.T("Google Client Secret")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="client_secret" type="text" name="client_secret" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.client_secret)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <h2>'),e.push(this.T("Your callback URL")),e.push('</h2>\n  <div class="input form-group">\n    <div class="controls">\n      <input class="form-control js-select" readonly value="'),e.push(n(this.callbackUrl)),e.push('">\n    </div>\n  </div>\n</fieldset>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/google/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Gmail")),e.push(" <small>"),e.push(this.T("Accounts")),e.push('</small></h1>\n  </div>\n</div>\n\n<div class="page-content">\n  <div class="page-description">\n    <p>'),e.push(this.T("You can connect %s with Zammad. But first, you will have to connect your Zammad with %s.","Google Accounts","Google")),e.push('</p>\n    <div class="btn btn--success js-configApp">'),e.push(this.T("Connect Google App")),e.push("</div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/google/list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Gmail")),e.push(" <small>"),e.push(this.T("Accounts")),e.push('</small></h1>\n  </div>\n\n  <div class="page-header-meta">\n    <a class="btn js-configApp">'),e.push(this.T("Configure App")),e.push('</a>\n    <a class="btn btn--success js-new">'),e.push(this.T("Add Account")),e.push("</a>\n  </div>\n</div>\n\n"),!_.isEmpty(this.not_used_email_addresses)){for(e.push('\n<div class="action">\n  <div class="action-flow">\n    <div class="action-block">\n      '),e.push(this.T("Notice:")),e.push(" "),e.push(this.T("Unassigned email addresses, assign them to a channel or delete them.")),e.push('</h3>\n      <ul class="list">\n      '),s=0,a=(u=this.not_used_email_addresses).length;s<a;s++)i=u[s],e.push('\n        <li class="list-item" data-id="'),e.push(n(i.id)),e.push('">\n          <div class="list-item-name">\n            <a href="#" class="js-emailAddressEdit">'),e.push(n(i.name)),e.push(" &lt;"),e.push(n(i.email)),e.push('&gt;</a>\n          </div>\n          <div class="list-item-delete js-emailAddressDelete">\n            '),e.push(this.Icon("diagonal-cross")),e.push("\n          </div>\n      ");e.push("\n      </ul>\n    </div>\n  </div>\n</div>\n")}for(e.push('\n\n<div class="page-content">\n'),_.isEmpty(this.channels)&&(e.push('\n  <table class="table table--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n")),e.push("\n"),r=0,l=(p=this.channels).length;r<l;r++){if(t=p[r],e.push('\n  <div class="action '),!0!==t.active&&e.push("is-inactive"),e.push('" data-id="'),e.push(n(t.id)),e.push('">\n    <div class="action-flow" style="width: 100%;">\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),e.push(this.Icon("status",t.status_in+" inline")),e.push(" "),e.push(this.T("Inbound")),e.push("</h3>\n          "),!1!==t.preferences.editable&&(e.push('\n            <div class="js-editInbound btn btn--text space-left">'),e.push(this.T("Edit")),e.push("</div>\n          ")),e.push("\n        </div>\n\n        "),_.isEmpty(t.last_log_in)||(e.push('\n        <div class="alert alert--danger">\n          '),e.push(n(t.last_log_in)),e.push("\n        </div>\n        ")),e.push("\n\n        <hr>\n\n        <h3>"),e.push(this.T("Destination Group")),e.push('</h3>\n        <a href="#" class="js-channelGroupChange '),!1===t.group.active&&e.push("alert alert--danger"),e.push('">\n          '),!1===t.group.active?(e.push("\n            "),e.push(this.T("%s is inactive, please select an active one.",this.P(t.group,"name"))),e.push("\n          ")):(e.push("\n            "),e.push(n(this.P(t.group,"name"))),e.push("\n          ")),e.push('\n        </a>\n      </div>\n\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),e.push(this.Icon("status",t.status_out+" inline")),e.push(" "),e.push(this.T("Outbound")),e.push("</h3>\n        </div>\n\n        "),_.isEmpty(t.last_log_out)||(e.push('\n        <div class="alert alert--danger">\n          '),e.push(n(t.last_log_out)),e.push("\n        </div>\n        ")),e.push("\n\n        <hr>\n\n        <h3>"),e.push(this.T("Email Address")),e.push('</h3>\n        <ul class="list">\n        '),_.isEmpty(t.email_addresses))e.push('\n          <li class="list-item">'),e.push(this.T("none")),e.push("\n        ");else{for(e.push("\n          "),o=0,c=(h=t.email_addresses).length;o<c;o++)i=h[o],e.push('\n            <li class="list-item" data-id="'),e.push(n(i.id)),e.push('">\n              <div class="list-item-name">'),e.push(n(i.email)),e.push('</div>\n              <div class="btn btn--text js-emailAddressEdit space-left space-right">'),e.push(this.T("Edit")),e.push("</div>\n              "),t.email_addresses.length>1&&(e.push('\n              <div class="list-item-delete js-emailAddressDelete">\n                '),e.push(this.Icon("diagonal-cross")),e.push("\n              </div>\n              ")),e.push("\n          ");e.push("\n        ")}e.push('\n        </ul>\n        <a class="text-muted js-emailAddressNew" href="#">+ '),e.push(this.T("Add")),e.push('</a>\n      </div>\n    </div>\n\n    <div class="action-controls">\n      '),t.options.backup_imap_classic&&(e.push('\n        <div class="btn js-rollbackMigration">'),e.push(this.T("Rollback migration")),e.push("</div>\n      ")),e.push("\n      "),!0===t.active?(e.push('\n        <div class="btn js-disable">'),e.push(this.T("Disable")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--secondary js-enable">'),e.push(this.T("Enable")),e.push("</div>\n      ")),e.push('\n      <div class="btn btn--danger btn--secondary js-delete">'),e.push(this.T("Delete")),e.push('</div>\n      <div class="btn btn--secondary js-reauthenticate">'),e.push(this.T("Reauthenticate")),e.push("</div>\n    </div>\n  </div>\n")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/import/freshdesk"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <div class="import wizard">\n    <div class="wizard-slide vertical" data-slide="freshdesk-subdomain">\n      <h2>'),e.push(this.T("%s URL","Freshdesk")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p>\n          '),e.push(this.T("Enter the Subdomain of your %s system","Freshdesk")),e.push(':\n        </p>\n        <div class="form-group">\n          <label for="freshdesk-subdomain">'),e.push(this.T("%s subdomain","Freshdesk")),e.push('</label>\n          <div class="u-positionOrigin">\n            <div class="input-group">\n              <input type="text" id="freshdesk-subdomain" class="form-control" placeholder="example" name="freshdesk-subdomain" aria-describedby="freshdesk-subdomain-addon">\n              <span class="input-group-addon" id="freshdesk-subdomain-addon">'),e.push(this.freshdeskDomain),e.push('</span>\n            </div>\n            <div class="input-feedback input-feedback--no-background centered">\n              <div class="small loading icon"></div>\n              '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n              "),e.push(this.Icon("checkmark")),e.push('\n            </div>\n          </div>\n          <div class="error freshdesk-subdomain-error"></div>\n        </div>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <div class="btn btn--primary align-right hide js-freshdesk-credentials" data-target="freshdesk-credentials">'),e.push(this.T("Enter credentials")),e.push('</div>\n      </div>\n    </div>\n\n    <div class="wizard-slide vertical hide" data-slide="freshdesk-credentials">\n      <h2>'),e.push(this.T("%s credentials","Freshdesk")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p>\n          <a class="js-freshdeskUrlApiToken" href="https://support.freshdesk.com/support/solutions/articles/215517-how-to-find-your-api-key" target="_blank">'),e.push(this.T("Enter your %s API token gained from your account profile settings.","Freshdesk")),e.push("</a>\n        </p>\n        <p>\n          "),e.push(this.T("Attention: These will be your login and password after the import is completed.")),e.push('\n        </p>\n        <div class="form-group">\n          <label for="freshdesk-api-token">'),e.push(this.T("API token")),e.push('</label>\n          <div class="u-positionOrigin">\n            <input type="text" id="freshdesk-api-token" class="form-control" placeholder="XYZ3133723421111" name="freshdesk-api-token">\n            <div class="input-feedback centered">\n              <div class="small loading icon"></div>\n              '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n              "),e.push(this.Icon("checkmark")),e.push('\n            </div>\n          </div>\n          <div class="error freshdesk-api-token-error"></div>\n        </div>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <div class="btn btn--primary align-right hide js-migration-start" data-target="freshdesk-start-migration">'),e.push(this.T("Migrate %s Data","Freshdesk")),e.push('</div>\n      </div>\n    </div>\n\n    <div class="wizard-slide vertical hide" data-slide="freshdesk-import">\n      <h2>'),e.push(this.T("%s Migration","Freshdesk")),e.push('</h2>\n      <div class="alert alert--danger hide js-error" role="alert"></div>\n      <div class="wizard-body flex vertical justified">\n        <table class="progressTable">\n          <tr class="js-groups">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Groups")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-organizations">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Organizations")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-users">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Users")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),
e.push('\n              </div>\n          </tr>\n          <tr class="js-tickets">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Tickets")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n        </table>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a href="#" class="btn btn--primary align-right hide js-finished">'),e.push(this.T("done")),e.push("</a>\n      </div>\n    </div>\n\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/import/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(i in e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <div class="import wizard">\n    <div class="wizard-slide vertical">\n      <h2>'),e.push(this.T("Import from")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n          '),s=this.items)t=s[i],e.push('\n            <a href="'),e.push(n(t.url)),e.push('" class="import-source centered '),e.push(n(t.class)),e.push('">\n              '),t.image?(e.push('\n                <img class="logo" src="'),e.push(n(this.C("image_path")+"/"+t.image)),e.push('" alt="'),e.push(n(t.name)),e.push('" height="37">\n              ')):(e.push("\n                "),e.push(n(t.name)),e.push(" (Beta)\n              ")),e.push("\n            </a>\n          ");e.push('\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#getting_started">'),e.push(this.T("Go Back")),e.push("</a>\n      </div>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/import/kayako"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <div class="import wizard">\n    <div class="wizard-slide vertical" data-slide="kayako-subdomain">\n      <h2>'),e.push(this.T("%s URL","Kayako")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p>\n          '),e.push(this.T("Enter the Subdomain of your %s system","Kayako")),e.push(':\n        </p>\n        <div class="form-group">\n          <label for="kayako-subdomain">'),e.push(this.T("%s subdomain","Kayako")),e.push('</label>\n          <div class="u-positionOrigin">\n            <div class="input-group">\n              <input type="text" id="kayako-subdomain" class="form-control" placeholder="example" name="kayako-subdomain" aria-describedby="kayako-subdomain-addon">\n              <span class="input-group-addon" id="kayako-subdomain-addon">'),e.push(this.kayakoDomain),e.push('</span>\n            </div>\n            <div class="input-feedback input-feedback--no-background centered">\n              <div class="small loading icon"></div>\n              '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n              "),e.push(this.Icon("checkmark")),e.push('\n            </div>\n          </div>\n          <div class="error kayako-subdomain-error"></div>\n        </div>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <div class="btn btn--primary align-right hide js-kayako-credentials" data-target="kayako-credentials">'),e.push(this.T("Enter credentials")),e.push('</div>\n      </div>\n    </div>\n\n    <div class="wizard-slide vertical hide" data-slide="kayako-credentials">\n      <h2>'),e.push(this.T("%s credentials","Kayako")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p>\n          '),e.push(this.T("Enter your email address and password from your %s account which should be used for the import.","Kayako")),e.push("\n        </p>\n        <p>\n          "),e.push(this.T("Attention: These will also be your login and password after the import is completed.")),e.push('\n        </p>\n        <div class="form-group">\n          <label for="kayako-email">'),e.push(this.T("Email")),e.push('</label>\n          <div class="u-positionOrigin">\n            <input type="email" id="kayako-email" class="form-control" placeholder="admin@example.com" name="kayako-email">\n          </div>\n          <label for="kayako-password">'),e.push(this.T("Password")),e.push('</label>\n          <div class="u-positionOrigin">\n            <input type="password" id="kayako-password" class="form-control" name="kayako-password">\n            <div class="input-feedback centered">\n              <div class="small loading icon"></div>\n              '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n              "),e.push(this.Icon("checkmark")),e.push('\n            </div>\n          </div>\n          <div class="error kayako-password-error"></div>\n        </div>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <div class="btn btn--primary align-right hide js-migration-start" data-target="kayako-start-migration">'),e.push(this.T("Migrate %s Data","Kayako")),e.push('</div>\n      </div>\n    </div>\n\n    <div class="wizard-slide vertical hide" data-slide="kayako-import">\n      <h2>'),e.push(this.T("%s Migration","Kayako")),e.push('</h2>\n      <div class="alert alert--danger hide js-error" role="alert"></div>\n      <div class="wizard-body flex vertical justified">\n        <table class="progressTable">\n          <tr class="js-groups">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Groups")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-organizations">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Organizations")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-users">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Users")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-tickets">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Tickets")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n        </table>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a href="#" class="btn btn--primary align-right hide js-finished">'),e.push(this.T("done")),e.push("</a>\n      </div>\n    </div>\n\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/import/otrs"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <div class="import wizard">\n    <div class="wizard-slide vertical" data-slide="otrs-plugin">\n      <h2>'),e.push(this.T("Download %s Migration Plugin","OTRS")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p>\n          '),e.push(this.T("Download and install the %s Migration Plugin on your %s instance.","OTRS","OTRS")),e.push(':\n        </p>\n        <a class="btn btn--primary btn--download js-download" target=_blank href="https://ftp.zammad.com/otrs-migrator-plugins/Znuny4OTRS-ZammadMigrator-6.0.7.opm" download>'),e.push(this.Icon("download")),e.push(" "),e.push(this.T("Migration Plugin for %s","OTRS 6")),e.push('</a>\n        <a class="btn btn--primary btn--download js-download" target=_blank href="https://ftp.zammad.com/otrs-migrator-plugins/Znuny4OTRS-ZammadMigrator-5.0.4.opm" download>'),e.push(this.Icon("download")),e.push(" "),e.push(this.T("Migration Plugin for %s","OTRS 5")),e.push('</a>\n        <a class="btn btn--primary btn--download js-download" target=_blank href="https://ftp.zammad.com/otrs-migrator-plugins/Znuny4OTRS-ZammadMigrator-4.1.12.opm" download>'),e.push(this.Icon("download")),e.push(" "),e.push(this.T("Migration Plugin for %s","OTRS 4")),e.push('</a>\n        <a class="btn btn--primary btn--download js-download" target=_blank href="https://ftp.zammad.com/otrs-migrator-plugins/Znuny4OTRS-ZammadMigrator-3.0.33.opm" download>'),e.push(this.Icon("download")),e.push(" "),e.push(this.T("Migration Plugin for %s","OTRS 3.3-3.1")),e.push('</a>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <div class="btn btn--primary align-right hide js-otrs-link">'),e.push(this.T("Next")),e.push('</div>\n      </div>\n    </div>\n    <div class="wizard-slide vertical hide" data-slide="otrs-link">\n      <h2>'),e.push(this.T("Link %s","OTRS")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p>\n          '),e.push(this.T("Enter the link provided by the plugin at the end of the installation to link the two systems")),e.push(':\n        </p>\n        <div class="form-group">\n          <label for="otrs-link">'),e.push(this.T("Link %s","OTRS")),e.push('</label>\n          <div class="u-positionOrigin">\n            <input type="url" id="otrs-link" class="form-control" placeholder="http://example.com/otrs/public.pl?Action=ZammadMigrator;Key=31337" name="url">\n            <div class="input-feedback centered">\n              <div class="small loading icon"></div>\n              '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n              "),e.push(this.Icon("checkmark")),e.push('\n            </div>\n          </div>\n          <div class="error otrs-link-error"></div>\n        </div>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <div class="btn btn--primary align-right hide js-migration-check">'),e.push(this.T("Migrate %s Data","OTRS")),e.push('</div>\n      </div>\n    </div>\n\n    <div class="wizard-slide vertical hide" data-slide="otrs-import">\n      <h2>'),e.push(this.T("%s Migration","OTRS")),e.push('</h2>\n      <div class="alert alert--danger hide js-error" role="alert"></div>\n      <div class="wizard-body flex vertical justified">\n        <table class="progressTable">\n          <tr class="js-config">\n            <td>\n            <td><span>'),e.push(this.T("Configuration")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress value="1"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-base">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Base Objects")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-user">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Users")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-ticket">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Tickets")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="134318" value="134318"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n        </table>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a href="#" class="btn btn--primary align-right hide js-finished">'),e.push(this.T("done")),e.push('</a>\n      </div>\n    </div>\n\n    <div class="wizard-slide vertical hide" data-slide="otrs-import-notice">\n      <h2>'),e.push(this.T("Notice")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p class="js-otrsProcesses hide">'),e.push(this.T("We detected OTRS BPM processes that can't get imported into Zammad since we currently don't support this kind of workflows.")),e.push('</p>\n        <p class="js-otrsDynamicFields hide">'),e.push(this.T("We found a lot of dynamic fields which are not common in Zammad, as we take a different approach to ticket attributes. Zammad also uses tags in addition to custom fields to classify tickets. This difference can create a new philosophy of your ticket attributes / tags compared to your current use of dynamic fields in OTRS.")),e.push('</p>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <a href="#" class="btn btn--primary align-right js-migration-start">'),e.push(this.T("Continue anyway")),e.push("</a>\n      </div>\n    </div>\n\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/import/zendesk"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex vertical centered darkBackground">\n  '),e.push(this.Icon("full-logo","wizard-logo")),e.push('\n  <div class="import wizard">\n    <div class="wizard-slide vertical" data-slide="zendesk-url">\n      <h2>'),e.push(this.T("%s URL","Zendesk")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p>\n          '),e.push(this.T("Enter the URL of your %s system","Zendesk")),e.push(':\n        </p>\n        <div class="form-group">\n          <label for="zendesk-url">'),e.push(this.T("%s URL","Zendesk")),e.push('</label>\n          <div class="u-positionOrigin">\n            <input type="url" id="zendesk-url" class="form-control" placeholder="https://example.zendesk.com/" name="zendesk-url">\n            <div class="input-feedback centered">\n              <div class="small loading icon"></div>\n              '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n              "),e.push(this.Icon("checkmark")),e.push('\n            </div>\n          </div>\n          <div class="error zendesk-url-error"></div>\n        </div>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <div class="btn btn--primary align-right hide js-zendesk-credentials" data-target="zendesk-credentials">'),e.push(this.T("Enter credentials")),e.push('</div>\n      </div>\n    </div>\n\n    <div class="wizard-slide vertical hide" data-slide="zendesk-credentials">\n      <h2>'),e.push(this.T("%s credentials","Zendesk")),e.push('</h2>\n      <div class="wizard-body flex vertical justified">\n        <p>\n          <a class="js-zendeskUrlApiToken" href="#" target="_blank">'),e.push(this.T("Enter your email address and the %s API token gained from your admin interface.","Zendesk")),e.push("</a>\n        </p>\n        <p>\n          "),e.push(this.T("Attention: These will be your login and password after the import is completed.")),e.push('\n        </p>\n        <div class="form-group">\n          <label for="zendesk-email">'),e.push(this.T("Email")),e.push('</label>\n          <div class="u-positionOrigin">\n            <input type="email" id="zendesk-email" class="form-control" placeholder="admin@example.com" name="zendesk-email">\n          </div>\n          <label for="zendesk-api-token">'),e.push(this.T("API token")),e.push('</label>\n          <div class="u-positionOrigin">\n            <input type="text" id="zendesk-api-token" class="form-control" placeholder="XYZ3133723421111" name="zendesk-api-token">\n            <div class="input-feedback centered">\n              <div class="small loading icon"></div>\n              '),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n              "),e.push(this.Icon("checkmark")),e.push('\n            </div>\n          </div>\n          <div class="error zendesk-api-token-error"></div>\n        </div>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a class="btn btn--text btn--secondary" href="#import">'),e.push(this.T("Go Back")),e.push('</a>\n        <div class="btn btn--primary align-right hide js-migration-start" data-target="zendesk-start-migration">'),e.push(this.T("Migrate %s Data","Zendesk")),e.push('</div>\n      </div>\n    </div>\n\n    <div class="wizard-slide vertical hide" data-slide="zendesk-import">\n      <h2>'),e.push(this.T("%s Migration","Zendesk")),e.push('</h2>\n      <div class="alert alert--danger hide js-error" role="alert"></div>\n      <div class="alert alert--info hide js-ticket-count-info" role="alert">'),e.push(this.T("There are more than 1000 tickets in the Zendesk system. Due to API rate limit restrictions we can't get the exact number of tickets yet and have to fetch them in batches of 1000. This might take some time, better grab a cup of coffee. The total number of tickets gets updated as soon as the currently known number is surpassed.")),e.push('</div>\n      <div class="wizard-body flex vertical justified">\n        <table class="progressTable">\n          <tr class="js-groups">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Groups")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-organizations">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Organizations")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-users">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Users")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n          <tr class="js-tickets">\n            <td><span class="js-done">-</span>/<span class="js-total">-</span>\n            <td><span>'),e.push(this.T("Tickets")),e.push('</span>\n            <td class="progressTable-progressCell">\n              <div class="horizontal center">\n                <div class="flex"><progress max="42" value="42"></progress></div>\n                '),e.push(this.Icon("checkmark")),e.push('\n              </div>\n          </tr>\n        </table>\n      </div>\n      <div class="wizard-controls horizontal center">\n        <a href="#" class="btn btn--primary align-right hide js-finished">'),e.push(this.T("done")),e.push("</a>\n      </div>\n    </div>\n\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/base"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i,s;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <div class="zammad-switch zammad-switch--small js-switch">\n       <input name="'),e.push(this.feature),e.push('" type="checkbox" id="setting-switch" '),this.featureEnabled&&e.push("checked"),e.push('>\n       <label for="setting-switch"></label>\n    </div>\n    <h1>'),e.push(this.T(this.header)),e.push('</h1>\n  </div>\n</div>\n<div class="page-content">\n  '),this.description){for(e.push("\n    "),t=0,i=(s=this.description).length;t<i;t++)n=s[t],e.push("\n      <p>"),e.push(this.T.apply(this,n)),e.push("</p>\n    ");e.push("\n  ")}e.push('\n  <div class="js-state"></div>\n  <div class="js-list"></div>\n  <div class="js-form"></div>\n  <div class="js-usage"></div>\n  <div class="js-log"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/check_mk"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<hr>\n\n<h2>"),e.push(this.T("Usage")),e.push("</h2>\n\n<p>"),e.push(this.T('To enable %s for sending HTTP requests to %s, you need to create a designated "notification rule" in %s.',"Checkmk","Zammad","Checkmk")),e.push('</p>\n\n<div class="settings-entry">\n  <table class="settings-list" style="width: 100%;">\n    <thead>\n      <tr>\n        <th width="20%">'),e.push(this.T("Type")),e.push('\n        <th width="80%">'),e.push(this.T("URL")),e.push('\n    </thead>\n    <tbody>\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("Endpoint")),e.push('\n        <td class="settings-list-control-cell">\n          <form>\n            <input type="url" class="form-control form-control--small js-select" readonly value="'),e.push(n(App.Config.get("http_type"))),e.push("://"),e.push(n(App.Config.get("fqdn"))),e.push("/api/v1/integration/check_mk/"),e.push(n(App.Setting.get("check_mk_token"))),e.push('">\n          </form>\n    </tbody>\n  </table>\n</div>\n\n<hr>\n\n<h2>'),e.push(this.T("Examples")),e.push("</h2>\n\n<p>"),e.push(this.T("You can use the following script to post the data to %s.","Zammad")),e.push('</p>\n\n<ul class="nav nav-tabs" role="tablist">\n  <li class="active"><a role="tab" data-toggle="tab" aria-expanded="true" class="js-tabItem" data-tablist="service">'),e.push(this.T("Service Notification")),e.push('</a></li>\n  <li><a role="tab" data-toggle="tab" class="js-tabItem" data-tablist="host">'),e.push(this.T("Host Notification")),e.push('</a></li>\n</ul>\n\n<div class="js-tablist settings-entry">\n  <div class="js-tablistItem js-service">\n    <p>'),e.push(this.T("Script can be located under: ||%s|| and needs to be executable.","/opt/omd/sites/{SITENAME}/local/share/check_mk/notifications/zammad-service")),e.push('</p>\n\n    <pre><code class="language-bash js-code hljs">#!/bin/bash\n\ncurl -X POST -F "event_id=$NOTIFY_SERVICEPROBLEMID" -F "host=$NOTIFY_HOSTNAME" -F "service=$NOTIFY_SERVICEDESC" -F "state=$NOTIFY_SERVICESTATE" -F "text=$NOTIFY_SERVICEOUTPUT" '),e.push(n(App.Config.get("http_type"))),e.push("://"),e.push(n(App.Config.get("fqdn"))),e.push("/api/v1/integration/check_mk/"),e.push(n(App.Setting.get("check_mk_token"))),e.push('</code></pre>\n  </div>\n\n  <div class="js-tablistItem js-host hidden">\n    <p>'),e.push(this.T("Script can be located under: ||%s|| and needs to be executable.","/opt/omd/sites/{SITENAME}/local/share/check_mk/notifications/zammad-host")),e.push('</p>\n\n    <pre><code class="language-bash js-code hljs">#!/bin/bash\n\ncurl -X POST -F "event_id=$NOTIFY_HOSTPROBLEMID" -F "host=$NOTIFY_HOSTNAME" -F "state=$NOTIFY_HOSTSTATE" -F "text=$NOTIFY_HOSTOUTPUT" '),e.push(n(App.Config.get("http_type"))),e.push("://"),e.push(n(App.Config.get("fqdn"))),e.push("/api/v1/integration/check_mk/"),e.push(n(App.Setting.get("check_mk_token"))),e.push("</code></pre>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/clearbit"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(e.push('<form>\n\n  <div class="settings-entry">\n    <table class="settings-list js-baseSync" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="15%">'),e.push(this.T("Title")),e.push('\n          <th width="50%">'),e.push(this.T("Value")),e.push('\n          <th width="35%">'),e.push(this.T("Description")),e.push("\n      </thead>\n      <tbody>\n"),i=0,s=(r=this.settings).length;i<s;i++)l=r[i],e.push("\n        <tr>\n          <td>"),e.push(this.T(l.display)),e.push('\n          <td data-name="'),e.push(l.name),e.push('">\n          <td><p class="help-text">'),e.push(this.RichText(l.note)),e.push("</p>\n");for(c in e.push("\n      </tbody>\n    </table>\n  </div>\n\n  <h2>"),e.push(this.T("Mapping")),e.push("</h2>\n\n  <p>"),e.push(this.T("What values of %s should be synced to users.","Clearbit")),e.push('</p>\n\n  <div class="settings-entry">\n    <table class="settings-list js-userSync" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="45%">'),e.push(this.T("Clearbit")),e.push('\n          <th width="45%">'),e.push(this.T("Zammad")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),o=this.config.user_sync)t=o[c],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="source" value="'),e.push(n(c)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="destination" value="'),e.push(n(t)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");for(c in e.push('\n        <tr class="js-new">\n          <td class="settings-list-control-cell"><input name="source" value="" placeholder="person.attribute" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="destination" value="" placeholder="user.attribute" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("</div>\n      </tbody>\n    </table>\n  </div>\n\n  <p>"),e.push(this.T("What values of %s should be synced to organization.","Clearbit")),e.push('</p>\n\n  <div class="settings-entry">\n    <table class="settings-list js-organizationSync" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="45%">'),e.push(this.T("Clearbit")),e.push('\n          <th width="45%">'),e.push(this.T("Zammad")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),a=this.config.organization_sync)t=a[c],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="source" value="'),e.push(n(c)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="destination" value="'),e.push(n(t)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");e.push('\n        <tr class="js-new">\n          <td class="settings-list-control-cell"><input name="source" value="" placeholder="company.attribute" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="destination" value="" placeholder="organization.attribute" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push('</div>\n      </tbody>\n    </table>\n  </div>\n  <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Save")),e.push("</button>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/cti"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p;for(e.push("<form>\n\n  <h2>"),e.push(this.T("Endpoint Settings")),e.push("</h2>\n\n  <p>"),
e.push(this.T("You need to configure the Zammad endpoints in the %s:","PBX")),e.push('<p>\n\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="20%">'),e.push(this.T("Type")),e.push('\n          <th width="80%">'),e.push(this.T("URL")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("Endpoint")),e.push('\n          <td class="settings-list-control-cell"><input type="url" class="form-control form-control--small js-select" readonly value="'),e.push(this.C("http_type")),e.push("://"),e.push(this.C("fqdn")),e.push("/api/v1/cti/"),e.push(n(this.cti_token)),e.push('">\n      </tbody>\n    </table>\n  </div>\n\n  <h2>'),e.push(this.T("Call Settings")),e.push("</h2>\n  <h3>"),e.push(this.T("Inbound")),e.push("</h3>\n\n  <p>"),e.push(this.T("Block caller IDs based on sender caller ID.")),e.push('\n\n  <div class="settings-entry">\n    <table class="settings-list js-inboundBlockCallerId" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="50%">'),e.push(this.T("Caller ID to block")),e.push('\n          <th width="40%">'),e.push(this.T("Note")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),t=0,r=(l=this.config.inbound.block_caller_ids).length;t<r;t++)p=l[t],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="caller_id" value="'),e.push(n(p.caller_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="'),e.push(n(p.note)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");for(e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="caller_id" value="" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="" placeholder="'),e.push(this.Ti("my own note")),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("</div>\n      </tbody>\n    </table>\n  </div>\n\n  <h3>"),e.push(this.T("Outbound")),e.push("</h3>\n\n  <p>"),e.push(this.T("Set caller ID of outbound calls based on destination caller ID.")),e.push('\n\n  <div class="settings-entry js-outboundRouting">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="30%">'),e.push(this.T("Destination caller ID")),e.push('\n          <th width="30%">'),e.push(this.T("Set outbound caller ID")),e.push('\n          <th width="30%">'),e.push(this.T("Note")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),i=0,o=(c=this.config.outbound.routing_table).length;i<o;i++)p=c[i],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="dest" value="'),e.push(n(p.dest)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="caller_id" value="'),e.push(n(p.caller_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="'),e.push(n(p.note)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");for(e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="dest" value="" placeholder="49* or 3230123456789" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="caller_id" value="" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="" placeholder="'),e.push(this.Ti("my own note")),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("</div>\n      </tbody>\n    </table>\n  </div>\n\n  <h2>"),e.push(this.T("Other Settings")),e.push('</h2>\n\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="50%">'),e.push(this.T("Value")),e.push('\n          <th width="50%">'),e.push(this.T("Description")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-control-cell"><input name="default_caller_id" value="'),e.push(n(this.config.outbound.default_caller_id)),e.push('" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control">'),e.push(this.T("Default caller ID for outbound calls.")),e.push('\n        <tr>\n          <td class="settings-list-control-cell js-viewLimit">\n          <td class="settings-list-row-control">'),e.push(this.T("Shown records in caller log.")),e.push("\n      </tbody>\n    </table>\n  </div>\n\n  <h2>"),e.push(this.T("Caller Log Filter")),e.push("</h2>\n\n  <p>"),e.push(this.T("Define queues or call destinations (whatever fits your PBX) and map your agents to it. By this, Zammad can support your agents by showing them only relevant call entries and notifications.")),e.push('</p>\n\n  <div class="settings-entry">\n    <table class="settings-list js-notifyMap" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="30%">'),e.push(this.T("Destination caller ID or queue")),e.push('\n          <th width="60%">'),e.push(this.T("Agents")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),s=0,a=(u=this.config.notify_map).length;s<a;s++)p=u[s],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="queue" value="'),e.push(n(p.queue)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell js-userSelector">\n          <td class="settings-list-row-control"><div class="btn btn--text js-removeMap">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="queue" value="" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell js-userSelectorBlank">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-addMap">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push('</div>\n      </tbody>\n    </table>\n  </div>\n\n  <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Save")),e.push("</button>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/exchange"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l;if(e.push('<div class="js-lastImport"></div>\n\n<div class="js-authenticationSwitch clearfix">\n  <h2>'),e.push(this.T("Authentication")),e.push("</h2>\n  <p>"),e.push(this.T("Please select the authentication method that should be used to establish the connection to your Exchange server.")),e.push('</p>\n\n  <div class="input formGroup--halfSize formGroup--standalone">\n    <div class="controls controls--select">\n      <select name="authentication_method" class="form-control js-authentication-method">\n        <option value="basic">'),e.push(this.T("Basic Authentication")),e.push('</option>\n        <option value="oauth">'),e.push(this.T("OAuth")),e.push("</option>\n      </select>\n      "),e.push(this.Icon("arrow-down")),e.push('\n    </div>\n  </div>\n</div>\n\n<div class="js-oAuthContent hide"></div>\n\n<div class="js-notConfigured">\n  <p>'),e.push(this.T("No %s configured.","Exchange")),e.push('</p>\n  <button type="submit" class="btn btn--primary js-wizard">'),e.push(this.T("Configure")),e.push('</button>\n</div>\n<div class="js-summary hide">\n  <h2>'),e.push(this.T("Settings")),e.push("</h2>\n"),this.config.disable_ssl_verify&&(e.push('\n  <div class="alert alert--warning" role="alert">\n    '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push("\n  </div>\n")),e.push('\n  <table class="settings-list" style="width: 100%;">\n    <thead>\n      <tr>\n        <th width="30%">'),e.push(this.T("Name")),e.push('\n        <th width="70%">'),e.push(this.T("Value")),e.push('\n    </thead>\n    <tbody>\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("Endpoint")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.endpoint)),e.push("\n    "),"oauth"!==this.config.auth_type&&(e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("User")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.user)),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("Password")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.M(this.config.password))),e.push("\n    ")),e.push("\n    "),this.config.disable_ssl_verify&&(e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("SSL verification")),e.push('\n        <td class="settings-list-row-control">'),e.push(this.T("no")),e.push("\n    ")),e.push("\n    </tbody>\n  </table>\n\n  <h2>"),e.push(this.T("Mapping")),e.push("</h2>\n\n  <h3>"),e.push(this.T("Folders")),e.push("</h3>\n  "),_.isEmpty(this.folders))e.push('\n    <table class="settings-list settings-list--stretch settings-list--placeholder">\n      <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n    </table>\n  ");else{for(e.push('\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th>'),e.push(this.T("Folder")),e.push("\n        "),i=0,r=(o=this.folders).length;i<r;i++)t=o[i],e.push('\n          <tr>\n            <td class="settings-list-row-control">'),e.push(n(t)),e.push("\n        ");e.push("\n      </thead>\n      <tbody>\n    </table>\n  ")}if(e.push("\n\n  <h3>"),e.push(this.T("User")),e.push("</h3>\n  "),_.isEmpty(this.config.attributes))e.push('\n    <table class="settings-list settings-list--stretch settings-list--placeholder">\n      <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n    </table>\n  ");else{for(s in e.push('\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="40%">'),e.push(this.T("Exchange")),e.push('\n          <th width="60%">'),e.push(this.T("Zammad")),e.push("\n        "),a=this.config.attributes)l=a[s],e.push('\n          <tr>\n            <td class="settings-list-row-control">'),e.push(n(s)),e.push('\n            <td class="settings-list-row-control">'),e.push(n(l)),e.push("\n        ");e.push("\n      </thead>\n      <tbody>\n    </table>\n  ")}e.push('\n\n  <button type="submit" class="btn btn--primary js-wizard">'),e.push(this.T("Change")),e.push("</button>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/exchange_certificate_issue"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="modal-content setup wizard hide '),e.push(n(this.wizardClass)),e.push('">\n  <div class="modal-header">\n    <div class="modal-close js-close">\n      '),e.push(this.Icon("diagonal-cross")),e.push('\n    </div>\n    <h1 class="modal-title">'),e.push(this.T("Your connection is not private")),e.push('</h1>\n  </div>\n  <div class="modal-body">\n    <div class="wizard-body vertical">\n      <p>'),e.push(this.T('The certificate of the domain |%s| could not be verified. This may allow hackers to steal your credentials. If you are sure that you are using a self-signed certificate, you can press "Proceed". Otherwise, please "Cancel".',this.domain)),e.push('</p>\n    </div>\n  </div>\n  <div class="modal-footer">\n    <div class="modal-leftFooter">\n      <button class="btn btn--text btn--danger btn--secondary js-submit">'),e.push(this.T("Proceed")),e.push('</button>\n    </div>\n    <div class="modal-rightFooter">\n      <a class="btn btn--primary align-right js-cancelSsl">'),e.push(this.T("Cancel")),e.push("</a>\n    </div>\n  </div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/exchange_last_import"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;if(e.push('<div class="box box--message">\n  <h2>'),e.push(this.T("Last sync")),e.push("</h2>\n  "),_.isEmpty(this.job.started_at))e.push("\n    "),this.job.result&&this.job.result.error?(e.push('\n        <div class="alert alert--danger" role="alert">'),e.push(this.T("An error occurred: %s",this.job.result.error)),e.push("</div>\n    ")):this.job.result&&this.job.result.info?(e.push('\n        <div class="alert alert--info" role="alert">'),e.push(this.T("Info: %s",this.job.result.info)),e.push("</div>\n    ")):(e.push("\n      <p>"),e.push(this.T("Job is waiting to get started\u2026")),e.push("</p>\n    ")),e.push("\n  ");else{if(e.push("\n    "),this.job.finished_at?(e.push("\n      <p>"),e.push(this.Ttimestamp(this.job.started_at)),e.push(" - "),e.push(this.Ttimestamp(this.job.finished_at)),e.push("</p>\n      "),this.job.result&&this.job.result.error?(e.push('\n        <div class="alert alert--danger" role="alert">'),e.push(this.T("An error occurred: %s",this.job.result.error)),e.push("</div>\n      ")):this.job.result&&this.job.result.info&&(e.push('\n        <div class="alert alert--info" role="alert">'),e.push(this.T("Info: %s",this.job.result.info)),e.push("</div>\n      ")),e.push("\n    ")):(e.push("\n      "),this.job.result&&this.job.result.error?(e.push("\n        <p>"),e.push(this.Ttimestamp(this.job.started_at)),e.push('</p>\n        <div class="alert alert--danger" role="alert">'),e.push(this.T("An error occurred: %s",this.job.result.error)),e.push("</div>\n      ")):this.job.result&&!this.job.result.sum?(e.push("\n        <p>"),e.push(this.Ttimestamp(this.job.started_at)),e.push(" - "),e.push(this.T("Counting entries. This may take a while.")),e.push("</p>\n      ")):(e.push("\n        <p>"),e.push(this.Ttimestamp(this.job.started_at)),e.push(" - "),e.push(this.T("Running\u2026")),e.push('</p>\n        <div class="flex">\n          <progress max="'),e.push(n(this.job.result.total)),e.push('" value="'),e.push(n(this.job.result.sum)),e.push('"></progress>\n        </div>\n      ')),e.push("\n    ")),e.push("\n    "),!_.isEmpty(this.job.result)&&this.job.result.sum){if(e.push("\n      <ul>\n        <li>"),e.push(this.T("%s user to %s user","Exchange","Zammad")),e.push(" ("),e.push(n(this.job.result.sum)),e.push("/"),e.push(n(this.job.result.total)),e.push("):\n          <ul>\n            <li>"),e.push(this.T("Users:")),e.push(" "),e.push(n(this.job.result.created)),e.push(" "),e.push(this.T("created")),e.push(", "),e.push(n(this.job.result.updated)),e.push(" "),e.push(this.T("updated")),e.push(", "),e.push(n(this.job.result.unchanged)),e.push(" "),e.push(this.T("untouched")),e.push(", "),e.push(n(this.job.result.skipped)),e.push(" "),e.push(this.T("skipped")),e.push(", "),e.push(n(this.job.result.failed)),e.push(" "),e.push(this.T("failed")),e.push("\n          </ul>\n          </li>\n          "),!_.isEmpty(this.job.result.folders)){for(t in e.push("\n            <li>"),e.push(this.T("%s folders","Exchange")),e.push(":\n              <ul>\n                "),i=this.job.result.folders)s=i[t],e.push("\n                  <li>"),e.push(t),e.push(": "),e.push(n(s.created)),e.push(" "),e.push(this.T("created")),e.push(", "),e.push(n(s.updated)),e.push(" "),e.push(this.T("updated")),e.push(", "),e.push(n(s.unchanged)),e.push(" "),e.push(this.T("untouched")),e.push(", "),e.push(n(s.failed)),e.push(" "),e.push(this.T("failed")),e.push("\n                ");e.push("\n              </ul>\n            </li>\n          ")}e.push("\n      </ul>\n    ")}e.push("\n    "),this.job.finished_at&&(e.push('\n      <button type="submit" class="btn btn--primary js-start-sync">'),e.push(this.T("Start new")),e.push("</button>\n    ")),e.push("\n  ")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/exchange_summary"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;if(e.push("<ul>\n  <li>"),e.push(this.T("%s user to %s user","Exchange","Zammad")),e.push(" ("),e.push(n(this.job.result.total)),e.push("):\n    <ul>\n      <li>"),e.push(this.T("Users:")),e.push(" "),e.push(n(this.job.result.created)),e.push(" "),e.push(this.T("created")),e.push(", "),e.push(n(this.job.result.updated)),e.push(" "),e.push(this.T("updated")),e.push(", "),e.push(n(this.job.result.unchanged)),e.push(" "),e.push(this.T("untouched")),e.push(", "),e.push(n(this.job.result.skipped)),e.push(" "),e.push(this.T("skipped")),e.push(", "),e.push(n(this.job.result.failed)),e.push(" "),e.push(this.T("failed")),e.push("\n    </ul>\n  </li>\n  "),!_.isEmpty(this.job.result.folders)){for(t in e.push("\n    <li>"),e.push(this.T("%s folders","Exchange")),e.push(":\n      <ul>\n        "),i=this.job.result.folders)s=i[t],e.push("\n          <li>"),e.push(t),e.push(": "),e.push(n(s.created)),e.push(" "),e.push(this.T("created")),e.push(", "),e.push(n(s.updated)),e.push(" "),e.push(this.T("updated")),e.push(", "),e.push(n(s.unchanged)),e.push(" "),e.push(this.T("untouched")),e.push(", "),e.push(n(s.failed)),e.push(" "),e.push(this.T("failed")),e.push("\n        ");e.push("\n      </ul>\n    </li>\n  ")}e.push("\n</ul>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/exchange_user_attribute_row"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<tr class="js-entry">\n  <td style="max-width: 240px" class="settings-list-control-cell js-exchangeAttribute">\n  <td class="settings-list-control-cell js-userAttribute">\n  <td class="settings-list-row-control">\n    <div class="btn btn--text js-remove">\n      '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n    </div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/exchange_wizard"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="modal-dialog">\n\n  <form class="modal-content setup wizard js-discover">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Exchange")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n\n        <p>'),e.push(this.T("Please enter the endpoint for accessing Exchange Web Services.")),e.push('</p>\n        <table class="settings-list" style="width: 100%;">\n          <thead>\n            <tr>\n              <th width="30%">'),e.push(this.T("Name")),e.push('\n              <th width="70%">'),e.push(this.T("Value")),e.push('\n          </thead>\n          <tbody>\n            <tr>\n              <td class="settings-list-row-control">'),e.push(this.T("Endpoint")),e.push('</td>\n              <td class="settings-list-control-cell"><input type="text" name="endpoint" class="form-control form-control--small" value="" placeholder="https://outlook.office365.com/EWS/Exchange.asmx" autocomplete="off" required></td>\n            </tr>\n          </tbody>\n        </table>\n\n        <p class="basic-auth hide">'),e.push(this.T("Please enter your Exchange credentials.")),e.push('</p>\n        <table class="settings-list basic-auth hide" style="width: 100%;">\n          <thead>\n            <tr>\n              <th width="30%">'),e.push(this.T("Name")),e.push('\n              <th width="70%">'),e.push(this.T("Value")),e.push('\n          </thead>\n          <tbody>\n            <tr>\n              <td class="settings-list-row-control">'),e.push(this.T("User")),e.push('</td>\n              <td class="settings-list-control-cell"><input type="text" name="user" class="form-control form-control--small js-user" value="" placeholder="user@your-exchange.tld" autocomplete="off"></td>\n            </tr>\n            <tr>\n              <td class="settings-list-row-control">'),e.push(this.T("Password")),e.push('</td>\n              <td class="settings-list-control-cell"><input type="password" name="password" class="form-control form-control--small js-password" value="" placeholder="" autocomplete="new-password"></td>\n            </tr>\n          </tbody>\n        </table>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submit">'),e.push(this.T("Connect")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <div class="js-certificateIssuePlaceholder"></div>\n\n  <form class="modal-content setup wizard hide js-connect">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Exchange")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Connecting \u2026")),e.push('\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-folders">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Exchange")),e.push(" "),e.push(this.T("Folders")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n\n        <div class="column_select form-group">\n            <div class="formGroup-label">\n                <label for="folders">'),e.push(this.T("Import %s","Folders")),e.push('</label>\n            </div>\n            <div class="controls js-foldersSelect">\n            </div>\n        </div>\n\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-discover">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submitTry is-disabled">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-analyze">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Exchange")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Analyzing structure\u2026")),e.push('\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <div class="modal-content setup wizard hide js-mapping">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Exchange")),e.push(" "),e.push(this.T("Mapping")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n\n        <h2>'),e.push(this.T("User")),e.push('</h2>\n        <form class="js-userMappingForm">\n          <table class="settings-list js-userAttributeMap" style="width: 100%;">\n            <colgroup>\n              <col width="240">\n              <col>\n              <col>\n            </colgroup>\n            <thead>\n              <tr>\n                <th>'),e.push(this.T("%s Attribute","Exchange")),e.push("\n                <th>"),e.push(this.T("%s Attribute","Zammad")),e.push("\n                <th>"),e.push(this.T("Action")),e.push('\n            </thead>\n            <tbody>\n              <tr>\n                <td class="settings-list-row-control" colspan="3">\n                  <div class="btn btn--text btn--create js-add">\n                    '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push('\n                  </div>\n            </tbody>\n          </table>\n        </form>\n\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-folders">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submitTry">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </div>\n\n  <form class="modal-content setup wizard hide js-dry">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Exchange")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="js-preprogress">\n          <p class="wizard-loadingText">\n            <span class="loading icon"></span>\n            '),e.push(this.T("Counting entries. This may take a while.")),e.push('\n          </p>\n        </div>\n        <div class="js-analyzing hide">\n          <p class="wizard-loadingText">\n            '),e.push(this.T("Analyzing entries with given configuration\u2026")),e.push('\n          </p>\n          <div class="centered js-progress">\n            <progress max="" value=""></progress>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <div class="modal-content setup wizard hide js-try">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Exchange")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <p>'),e.push(this.T("With your current configuration the following will happen:")),e.push('</p>\n        <div class="js-summary"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-mapping">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submitSave">'),e.push(this.T("Save configuration")),e.push('</button>\n      </div>\n    </div>\n  </div>\n\n  <form class="modal-content setup wizard hide js-error">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("Exchange")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right">'),e.push(this.T("Cancel")),e.push("</button>\n      </div>\n    </div>\n  </form>\n\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/git_issue_link_modal"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="flex horizontal js-result">\n  <input type="text" name="link" value="" autocomplete="off" placeholder="'),e.push(n(this.placeholder)),e.push('" class="form-control"/>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/github"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<form>\n  <h2>"),e.push(this.T("Settings")),e.push('</h2>\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="20%">'),e.push(this.T("Name")),e.push('\n          <th width="80%">'),e.push(this.T("Value")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-row-control">'),
e.push(this.T("Endpoint")),e.push(' *\n          <td class="settings-list-control-cell"><input type="text" class="form-control form-control--small" value="'),e.push(n(this.config.endpoint)),e.push('" placeholder="https://api.github.com/graphql" name="endpoint">\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("API token")),e.push(' *\n          <td class="settings-list-control-cell"><input type="password" class="form-control form-control--small" value="'),e.push(n(this.config.api_token)),e.push('" name="api_token">\n      </tbody>\n    </table>\n  </div>\n\n  <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Save")),e.push("</button>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/gitlab"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<form>\n  <h2>"),e.push(this.T("Settings")),e.push('</h2>\n  <div class="settings-entry">\n    <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n      '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n    </div>\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="20%">'),e.push(this.T("Name")),e.push('\n          <th width="80%">'),e.push(this.T("Value")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("Endpoint")),e.push(' *\n          <td class="settings-list-control-cell"><input type="text" class="form-control form-control--small" value="'),e.push(n(this.config.endpoint)),e.push('" placeholder="https://git.example.com/api/graphql" name="endpoint">\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("API token")),e.push(' *\n          <td class="settings-list-control-cell"><input type="password" class="form-control form-control--small" value="'),e.push(n(this.config.api_token)),e.push('" name="api_token">\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("SSL verification")),e.push('\n          <td class="settings-list-control-cell js-sslVerify">\n      </tbody>\n    </table>\n  </div>\n\n  <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Save")),e.push("</button>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/idoit"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<form>\n  <h2>"),e.push(this.T("Settings")),e.push('</h2>\n  <div class="settings-entry">\n    <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n      '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n    </div>\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="20%">'),e.push(this.T("Name")),e.push('\n          <th width="80%">'),e.push(this.T("Value")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("Endpoint")),e.push(' *\n          <td class="settings-list-control-cell"><input type="text" class="form-control form-control--small" value="'),e.push(n(this.config.endpoint)),e.push('" placeholder="https://idoit.example.com/i-doit/" name="endpoint">\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("API token")),e.push(' *\n          <td class="settings-list-control-cell"><input type="password" class="form-control form-control--small" value="'),e.push(n(this.config.api_token)),e.push('" name="api_token">\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("Client ID")),e.push('\n          <td class="settings-list-control-cell"><input type="text" class="form-control form-control--small" value="'),e.push(n(this.config.client_id)),e.push('" name="client_id">\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("SSL verification")),e.push('\n          <td class="settings-list-control-cell js-sslVerify">\n      </tbody>\n    </table>\n  </div>\n\n  <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Save")),e.push("</button>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/idoit_object_result"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push("<hr>\n"),_.isEmpty(this.items))e.push("\n  "),e.push(this.T("none")),e.push("\n");else{for(e.push('\n<table class="table">\n  <thead>\n    <th style="width: 30px"></th>\n    <th style="width: 100px">'),e.push(this.T("ID")),e.push("</th>\n    <th>"),e.push(this.T("Name")),e.push('</th>\n    <th style="width: 100px;">'),e.push(this.T("Status")),e.push("</th>\n  </thead>\n  <tbody>\n  "),t=0,s=(r=this.items).length;t<s;t++)i=r[t],e.push('\n    <tr>\n      <td class="noTruncate"><input type="checkbox" name="object_id" value="'),e.push(n(i.id)),e.push('"/></td>\n      <td title="'),e.push(n(i.id)),e.push('">'),e.push(n(i.id)),e.push('</td>\n      <td title="'),e.push(n(i.title)),e.push('"><a href="'),e.push(i.link),e.push('" target="_blank">'),e.push(n(i.title)),e.push("</a></td>\n      <td>"),e.push(n(i.cmdb_status_title)),e.push("</td>\n    </tr>\n  ");e.push("\n  </tbody>\n</table>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/idoit_object_selector"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="js-search flex horizontal">\n  <div class="controls controls--select js-typeSelect"></div>\n  <input type="text" name="title" value="" autocomplete="off" placeholder="'),e.push(this.Ti("Search")),e.push('" class="form-control js-searchField"/>\n</form>\n<form class="js-result"></form>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="js-integration">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T(this.head)),e.push('</h1>\n  </div>\n  <div class="page-content">\n    <table class="table table-striped table-hover">\n      <thead>\n        <tr>\n          <th style="width: 30px;"></th>\n          <th style="width: 30%;">'),e.push(this.T("Service")),e.push("</th>\n          <th>"),e.push(this.T("Description")),e.push("</th>\n        </tr>\n      </thead>\n      <tbody>\n      "),t=0,s=(r=this.integrations).length;t<s;t++)i=r[t],e.push('\n        <tr data-key="'),e.push(n(i.key)),e.push('">\n          <td class="noTruncate">\n            '),i.state.current()?(e.push("\n              "),e.push(this.Icon("status","ok inline")),e.push("\n            ")):(e.push("\n              "),e.push(this.Icon("status","inactive inline")),e.push("\n            ")),e.push('\n          </td>\n          <td><a href="'),e.push(i.target),e.push('">'),e.push(n(i.name)),e.push("</a></td>\n          <td>"),e.push(this.T(i.description,i.descriptionSubstitute)),e.push("\n        </tr>\n      ");e.push("\n      </tbody>\n    </table>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/ldap"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a;if(e.push('<div class="js-lastImport"></div>\n<div class="js-notConfigured">\n  <h5><a href="#" class="js-back">\u276e >'),e.push(this.T("Back to overview")),e.push("</a></h5>\n  <h2>"),e.push(this.T("Settings %s",this.item.name)),e.push("</h2>\n  <p>"),e.push(this.T("No configuration set.")),e.push('</p>\n  <button type="submit" class="btn btn--primary js-wizard">'),e.push(this.T("Configure")),e.push('</button>\n</div>\n<div class="js-summary hide">\n  <h5><a href="#" class="js-back">\u276e Back to overview</a></h5>\n  <h2>'),e.push(this.T("Settings %s",this.item.name)),e.push("</h2>\n"),"ssl"!==this.config.ssl&&"starttls"!==this.config.ssl||this.config.ssl_verify||(e.push('\n  <div class="alert alert--warning" role="alert">\n    '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push("\n  </div>\n")),e.push('\n  <table class="settings-list" style="width: 100%;">\n    <thead>\n      <tr>\n        <th width="30%">'),e.push(this.T("Name")),e.push('\n        <th width="70%">'),e.push(this.T("Value")),e.push('\n    </thead>\n    <tbody>\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("LDAP Host")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.host)),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("SSL/STARTTLS")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.T(this.config.ssl_humanized))),e.push("\n    "),"ssl"!==this.config.ssl&&"starttls"!==this.config.ssl||(e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("SSL verification")),e.push('\n        <td class="settings-list-row-control">'),this.config.ssl_verify?e.push(n(this.T("yes"))):e.push(n(this.T("no"))),e.push("\n    ")),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("Base DN")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.base_dn)),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("Bind User")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.bind_user)),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("Bind Password")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.M(this.config.bind_pw))),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("UID")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.user_uid)),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("User Filter")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.user_filter)),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("GID")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.group_uid)),e.push('\n      <tr>\n        <td class="settings-list-row-control">'),e.push(this.T("Group Filter")),e.push('\n        <td class="settings-list-row-control">'),e.push(n(this.config.group_filter)),e.push("\n    </tbody>\n  </table>\n\n  <h2>"),e.push(this.T("Mapping")),e.push("</h2>\n\n  <h3>"),e.push(this.T("User")),e.push("</h3>\n  "),_.isEmpty(this.config.user_attributes))e.push('\n    <table class="settings-list settings-list--stretch settings-list--placeholder">\n      <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n    </table>\n  ");else{for(i in e.push('\n    <table class="settings-list settings-list--stretch">\n      <thead>\n        <tr>\n          <th width="40%">'),e.push(this.T("LDAP")),e.push('\n          <th width="60%">'),e.push(this.T("Zammad")),e.push("\n        "),s=this.config.user_attributes)a=s[i],e.push('\n          <tr>\n            <td class="settings-list-row-control">'),e.push(n(i)),e.push('\n            <td class="settings-list-row-control">'),e.push(n(a)),e.push("\n        ");e.push("\n      </thead>\n      <tbody>\n    </table>\n  ")}if(e.push("\n\n  <h3>"),e.push(this.T("Role")),e.push("</h3>\n  "),_.isEmpty(this.group_role_map))e.push('\n    <table class="settings-list settings-list--stretch settings-list--placeholder">\n      <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n    </table>\n  ");else{for(o in e.push('\n    <table class="settings-list settings-list--stretch">\n      <thead>\n        <tr>\n          <th width="40%">'),e.push(this.T("LDAP")),e.push('\n          <th width="60%">'),e.push(this.T("Zammad")),e.push("\n      <tbody>\n        "),r=this.group_role_map)t=r[o],e.push('\n          <tr>\n            <td class="settings-list-row-control">'),e.push(n(o)),e.push('\n            <td class="settings-list-row-control">'),e.push(n(t)),e.push("\n        ");e.push("\n  ")}e.push('\n    </table>\n\n  <button type="submit" class="btn btn--primary js-wizard">'),e.push(this.T("Change")),e.push("</button>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/ldap_group_role_row"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<tr class="js-entry">\n  <td style="width: 60%" class="settings-list-control-cell js-ldapList">\n  <td style="width: 35%" class="settings-list-control-cell js-roleList">\n  <td class="settings-list-row-control">\n    <div class="btn btn--text js-remove">\n      '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n    </div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/ldap_last_import"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;if(e.push('<div class="box box--message">\n  <h2>'),e.push(this.T("Last sync")),e.push("</h2>\n  "),_.isEmpty(this.job.started_at))e.push("\n    "),this.job.result&&this.job.result.error?(e.push('\n        <div class="alert alert--danger" role="alert">'),e.push(this.T("An error occurred: %s",this.job.result.error)),e.push("</div>\n    ")):this.job.result&&this.job.result.info?(e.push('\n        <div class="alert alert--info" role="alert">'),e.push(this.T("Info: %s",this.job.result.info)),e.push("</div>\n    ")):(e.push("\n      <p>"),e.push(this.T("Job is waiting to get started\u2026")),e.push("</p>\n    ")),e.push("\n  ");else{if(e.push("\n    "),this.job.finished_at?(e.push("\n      <p>"),e.push(this.Ttimestamp(this.job.started_at)),e.push(" - "),e.push(this.Ttimestamp(this.job.finished_at)),e.push("</p>\n      "),this.job.result&&this.job.result.error?(e.push('\n        <div class="alert alert--danger" role="alert">'),e.push(this.T("An error occurred: %s",this.job.result.error)),e.push("</div>\n      ")):this.job.result&&this.job.result.info&&(e.push('\n        <div class="alert alert--info" role="alert">'),e.push(this.T("Info: %s",this.job.result.info)),e.push("</div>\n      ")),e.push("\n    ")):(e.push("\n      "),this.job.result&&this.job.result.error?(e.push("\n        <p>"),e.push(this.Ttimestamp(this.job.started_at)),e.push('</p>\n        <div class="alert alert--danger" role="alert">'),e.push(this.T("An error occurred: %s",this.job.result.error)),e.push("</div>\n      ")):this.job.result.sum?(e.push("\n        <p>"),e.push(this.Ttimestamp(this.job.started_at)),e.push(" - "),e.push(this.T("Running\u2026")),e.push('</p>\n        <div class="flex">\n          <progress max="'),e.push(n(this.job.result.total)),e.push('" value="'),e.push(n(this.job.result.sum)),e.push('"></progress>\n        </div>\n      ')):(e.push("\n        <p>"),e.push(this.Ttimestamp(this.job.started_at)),e.push(" - "),e.push(this.T("Counting entries. This may take a while.")),e.push("</p>\n      ")),e.push("\n    ")),e.push("\n    "),!_.isEmpty(this.job.result)&&this.job.result.sum){if(e.push("\n      <ul>\n        <li>"),e.push(this.T("%s user to %s user","LDAP","Zammad")),e.push(" ("),e.push(n(this.job.result.sum)),e.push("/"),e.push(n(this.job.result.total)),e.push("):\n          <ul>\n            <li>"),e.push(this.T("Users:")),e.push(" "),e.push(n(this.job.result.created)),e.push(" "),e.push(this.T("created")),e.push(", "),e.push(n(this.job.result.updated)),e.push(" "),e.push(this.T("updated")),e.push(", "),e.push(n(this.job.result.unchanged)),e.push(" "),e.push(this.T("untouched")),e.push(", "),e.push(n(this.job.result.skipped)),e.push(" "),e.push(this.T("skipped")),e.push(", "),e.push(n(this.job.result.failed)),e.push(" "),e.push(this.T("failed")),e.push(", "),e.push(n(this.job.result.deactivated)),e.push(" "),e.push(this.T("deactivated")),e.push("\n          </ul>\n        "),!_.isEmpty(this.job.result.roles)){for(s in e.push("\n          <li>"),e.push(this.T("%s groups to %s roles assignments","LDAP","Zammad")),e.push(":\n            <ul>\n              "),t=this.job.result.roles)i=t[s],e.push("\n                <li> "),e.push(this.T(s)),e.push(": "),e.push(n(i.created)),e.push(" "),e.push(this.T("created")),e.push(", "),e.push(n(i.updated)),e.push(" "),e.push(this.T("updated")),e.push(", "),e.push(n(i.unchanged)),e.push(" "),e.push(this.T("untouched")),e.push(", "),e.push(n(i.failed)),e.push(" "),e.push(this.T("failed")),e.push(", "),e.push(n(i.deactivated)),e.push(" "),e.push(this.T("deactivated")),e.push("\n              ");e.push("\n            </ul>\n        ")}e.push("\n      </ul>\n    ")}e.push("\n    "),this.job.finished_at&&(e.push('\n      <button type="submit" class="btn btn--primary js-start-sync">'),e.push(this.T("Start new")),e.push("</button>\n    ")),e.push("\n  ")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/ldap_ssl_verify_row"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<tr>\n  <td class="settings-list-row-control">'),e.push(this.T("SSL verification")),e.push('\n  <td class="settings-list-control-cell js-sslVerify">\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/ldap_summary"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;if(e.push("<ul>\n  <li>"),e.push(this.T("%s user to %s user","LDAP","Zammad")),e.push(" ("),e.push(n(this.job.result.sum)),e.push("):\n    <ul>\n      <li>"),e.push(this.T("Users:")),e.push(" "),e.push(n(this.job.result.created)),e.push(" "),e.push(this.T("created")),e.push(", "),e.push(n(this.job.result.updated)),e.push(" "),e.push(this.T("updated")),e.push(", "),e.push(n(this.job.result.unchanged)),e.push(" "),e.push(this.T("untouched")),e.push(", "),e.push(n(this.job.result.skipped)),e.push(" "),e.push(this.T("skipped")),e.push(", "),e.push(n(this.job.result.failed)),e.push(" "),e.push(this.T("failed")),e.push(", "),e.push(n(this.job.result.deactivated)),e.push(" "),e.push(this.T("deactivated")),e.push("\n    </ul>\n  </li>\n  "),!_.isEmpty(this.job.result.roles)){for(s in e.push("\n    <li>"),e.push(this.T("%s groups to %s roles assignments","LDAP","Zammad")),e.push(":\n      <ul>\n        "),t=this.job.result.roles)i=t[s],e.push("\n          <li>"),e.push(this.T(s)),e.push(": "),e.push(n(i.created)),e.push(" "),e.push(this.T("created")),e.push(", "),e.push(n(i.updated)),e.push(" "),e.push(this.T("updated")),e.push(", "),e.push(n(i.unchanged)),e.push(" "),e.push(this.T("untouched")),e.push(", "),e.push(n(i.failed)),e.push(" "),e.push(this.T("failed")),e.push(", "),e.push(n(i.deactivated)),e.push(" "),e.push(this.T("deactivated")),e.push("\n        ");e.push("\n      </ul>\n    </li>\n  ")}e.push("\n</ul>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/ldap_user_attribute_row"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<tr class="js-entry">\n  <td style="width: 60%" class="settings-list-control-cell js-ldapAttribute">\n  <td style="width: 35%" class="settings-list-control-cell js-userAttribute">\n  <td class="settings-list-row-control">\n    <div class="btn btn--text js-remove">\n      '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n    </div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/ldap_wizard"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="modal-dialog">\n\n  <form class="modal-content setup wizard js-discover">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("LDAP")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n          '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n        </div>\n        <table class="settings-list" style="width: 100%;">\n          <thead>\n            <tr>\n              <th width="30%">'),e.push(this.T("Name")),e.push('\n              <th width="70%">'),e.push(this.T("Value")),e.push('\n          </thead>\n          <tbody>\n            <tr>\n              <td class="settings-list-row-control">\n                '),e.push(this.T("Name")),e.push(' <span>*</span>\n              <td class="settings-list-control-cell">'),e.push(this.nameHtml),e.push('\n            <tr>\n              <td class="settings-list-row-control">\n                '),e.push(this.T("Host")),e.push(' <span>*</span>\n              <td class="settings-list-control-cell">'),e.push(this.hostHtml),e.push('\n            <tr>\n              <td class="settings-list-row-control">\n                '),e.push(this.T("SSL/STARTTLS")),e.push('\n                <td class="settings-list-control-cell">\n                  '),e.push(this.sslHtml),e.push('\n            <tr>\n              <td class="settings-list-row-control">'),e.push(this.T("Active")),e.push('\n              <td class="settings-list-control-cell">\n                '),e.push(this.activeHtml),e.push('\n          </tbody>\n        </table>\n      </div>\n    </div>\n    <div class="modal-footer">\n    '),this.newConnection||(e.push('\n      <div class="modal-leftFooter align-left">\n        <div class="btn  btn--primary align-left js-saveQuit">'),e.push(this.T("Save")),e.push("</div>\n      </div>\n    ")),e.push('\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submit">'),e.push(this.T("Connect")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-connect">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("LDAP")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Connecting \u2026")),e.push(' <span class="js-host"></span>\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-bind">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("LDAP")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <table class="settings-list" style="width: 100%;">\n          <thead>\n            <tr>\n              <th width="30%">'),e.push(this.T("Name")),e.push('\n              <th width="70%">'),e.push(this.T("Value")),e.push('\n          </thead>\n          <tbody>\n            <tr>\n              <td class="settings-list-row-control">'),e.push(this.T("Base DN")),e.push('\n              <td class="settings-list-control-cell js-baseDn">\n            <tr>\n              <td class="settings-list-row-control">'),e.push(this.T("Bind User")),e.push('\n              <td class="settings-list-control-cell"><input type="text" name="bind_user" class="form-control form-control--small" value="" placeholder="" autocomplete="off">\n            <tr>\n              <td class="settings-list-row-control">'),e.push(this.T("Bind Password")),e.push('\n              <td class="settings-list-control-cell"><input type="password" name="bind_pw" class="form-control form-control--small" value=""  autocomplete="new-password">\n          </tbody>\n        </table>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-discover">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submit">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-analyze">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("LDAP")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Analyzing structure\u2026")),e.push('\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-dry">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("LDAP")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="js-preprogress">\n          <p class="wizard-loadingText">\n            <span class="loading icon"></span>\n            '),e.push(this.T("Counting entries. This may take a while.")),e.push('\n          </p>\n        </div>\n        <div class="js-analyzing hide">\n          <p class="wizard-loadingText">\n            '),e.push(this.T("Analyzing entries with given configuration\u2026")),e.push('\n          </p>\n          <div class="centered js-progress">\n            <progress max="" value=""></progress>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <div class="modal-content setup wizard hide js-mapping">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("LDAP")),e.push(" "),e.push(this.T("Mapping")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n\n        <h2>'),e.push(this.T("User")),e.push('</h2>\n        <form class="js-userMappingForm">\n          <table class="settings-list js-userAttributeMap" style="width: 100%;">\n            <colgroup>\n              <col width="240">\n              <col>\n              <col>\n            </colgroup>\n            <thead>\n              <tr>\n                <th>'),e.push(this.T("%s Attribute","LDAP")),e.push("\n                <th>"),e.push(this.T("%s Attribute","Zammad")),e.push("\n                <th>"),e.push(this.T("Action")),e.push('\n            </thead>\n            <tbody>\n              <tr>\n                <td class="settings-list-row-control" colspan="3">\n                  <div class="btn btn--text btn--create js-add">\n                    '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("\n                  </div>\n            </tbody>\n          </table>\n        </form>\n\n        <h2>"),e.push(this.T("Roles")),e.push('</h2>\n        <form class="js-groupRoleForm">\n          <table class="settings-list js-groupRoleMap" style="width: 100%;">\n            <colgroup>\n              <col width="240">\n              <col>\n              <col>\n            </colgroup>\n            <thead>\n              <tr>\n                <th>'),e.push(this.T("%s Group","LDAP")),e.push("\n                <th>"),e.push(this.T("%s Role","Zammad")),e.push("\n                <th>"),e.push(this.T("Action")),
e.push('\n            </thead>\n            <tbody>\n              <tr>\n                <td class="settings-list-row-control" colspan="3">\n                  <div class="btn btn--text btn--create js-add">\n                    '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("\n                  </div>\n            </tbody>\n          </table>\n        </form>\n\n        <h2>"),e.push(this.T("Expert")),e.push('</h2>\n        <form class="js-expertForm">\n          <table class="settings-list js-expert" style="width: 100%;">\n            <thead>\n              <tr>\n                <th width="30%">'),e.push(this.T("Name")),e.push('\n                <th width="70%">'),e.push(this.T("Value")),e.push('\n            </thead>\n            <tbody>\n              <tr>\n                <td class="settings-list-row-control">'),e.push(this.T("User filter")),e.push('\n                <td class="settings-list-control-cell"><input type="text" name="user_filter" class="form-control form-control--small" value="" placeholder="" autocomplete="off">\n              <tr>\n                <td class="settings-list-row-control">'),e.push(this.T("Users without assigned LDAP groups")),e.push('\n                <td class="settings-list-control-cell js-unassignedUsers">\n            </tbody>\n          </table>\n        </form>\n\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-bind">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submitTry">'),e.push(this.T("Continue")),e.push('</button>\n      </div>\n    </div>\n  </div>\n\n  <div class="modal-content setup wizard hide js-try">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("LDAP")),e.push(" "),e.push(this.T("Configuration")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n        <p>'),e.push(this.T("With your current configuration the following will happen:")),e.push('</p>\n        <div class="js-summary"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-mapping">'),e.push(this.T("Go Back")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right js-submitSave">'),e.push(this.T("Save configuration")),e.push('</button>\n      </div>\n    </div>\n  </div>\n\n  <form class="modal-content setup wizard hide js-error">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T("LDAP")),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="alert alert--danger hide" role="alert"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right">'),e.push(this.T("Cancel")),e.push("</button>\n      </div>\n    </div>\n  </form>\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/pgp"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<form>\n  <h2>"),e.push(this.T("Public & Private Keys")),e.push('</h2>\n  <div class="settings-entry settings-entry--stretched js-keysList"></div>\n\n  <div class="btn btn--primary js-addKey">'),e.push(this.T("Add Key")),e.push("</div>\n\n  <hr>\n\n  <h2>"),e.push(this.T("Default Behavior")),e.push("</h2>\n  <p>"),e.push(this.T("Choose the default behavior of the PGP integration on per group basis. If signing or encrypting is not possible, the setting has no effect. Agents can always manually alter the behavior for each article.")),e.push('</p>\n  <div class="settings-entry settings-entry--stretched js-groupList"></div>\n  <div class="btn btn--primary js-updateGroup">'),e.push(this.T("Update")),e.push("</div>\n</form>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/pgp_group"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<table class="settings-list">\n  <thead>\n    <tr>\n      <th width="55%">'),e.push(this.T("Group")),e.push("\n      <th>"),e.push(this.T("Sign")),e.push("\n      <th>"),e.push(this.T("Encryption")),e.push("\n  </thead>\n  <tbody>\n  "),_.isEmpty(this.groups))e.push('\n  <tr>\n    <td colspan="6">\n      '),e.push(this.T("No Entries")),e.push("\n    </td>\n  </tr>\n  ");else{for(e.push("\n    "),i=0,s=(r=this.groups).length;i<s;i++)t=r[i],e.push('\n      <tr data-id="'),e.push(n(t.id)),e.push('">\n        <td>'),e.push(n(this.P(t,"name"))),e.push('\n        <td class="settings-list-control-cell js-signDefault">\n        <td class="settings-list-control-cell js-encryptionDefault">\n    ');e.push("\n  ")}e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/pgp_list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<table class="settings-list settings-list--stretch">\n  <thead>\n  '),_.isEmpty(this.keys))e.push('\n    <tr>\n      <th class="centered">\n        '),e.push(this.T("No Entries")),e.push("\n      </th>\n    </tr>\n  ");else{for(e.push("\n    <tr>\n      <th>"),e.push(this.T("Name")),e.push("\n      <th>"),e.push(this.T("Key ID")),e.push("\n    "),this.C("pgp_recipient_alias_configuration")&&(e.push("\n      <th>"),e.push(this.T("Domain Alias")),e.push("\n    ")),e.push("\n      <th>"),e.push(this.T("Fingerprint")),e.push("\n      <th>"),e.push(this.T("Created at")),e.push("\n      <th>"),e.push(this.T("Expires at")),e.push("\n      <th>"),e.push(this.T("Actions")),e.push("\n  <tbody>\n    "),t=0,s=(r=this.keys).length;t<s;t++)i=r[t],e.push('\n      <tr data-id="'),e.push(n(i.id)),e.push('">\n        <td>\n          '),e.push(n(i.name)),e.push("\n          "),i.secret&&(e.push("\n            <br><i>"),e.push(this.T("Including private key.")),e.push("</i>\n          ")),e.push("\n        <td>\n          0x"),e.push(n(i.fingerprint.substr(-16))),e.push("\n      "),this.C("pgp_recipient_alias_configuration")&&(e.push("\n        <td>\n          "),i.domain_alias?(e.push("\n           "),e.push(n(i.domain_alias.substr(2))),e.push("\n          ")):e.push("\n            -\n         "),e.push("\n      ")),e.push('\n        <td title="'),e.push(n(i.fingerprint)),e.push('">\n          '),e.push(i.keygrip),e.push("\n        <td>"),e.push(this.humanTime(i.created_at)),e.push("\n        <td>\n          "),i.expires_at?(e.push("\n           "),e.push(this.humanTime(i.expires_at,!1,i.expires_at_css_class)),e.push("\n          ")):e.push("\n            -\n         "),e.push('\n        <td>\n          <div class="dropdown dropdown--actions">\n            <div class="btn btn--table btn--text btn--secondary js-action" data-toggle="dropdown">\n              '),e.push(this.Icon("overflow-button")),e.push('\n            </div>\n            <ul class="dropdown-menu dropdown-menu-right js-table-action-menu" role="menu">\n            '),i.secret&&(e.push('\n              <li role="presentation" data-table-action="download-private">\n                <a href="'),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push("/api/v1/integration/pgp/key_download/"),e.push(n(i.id)),e.push('?secret=true" role="menuitem" tabindex="-1" download>\n                  <span class="dropdown-iconSpacer">\n                    '),e.push(this.Icon("download")),e.push("\n                  </span>\n                  "),e.push(this.T("Download Private Key")),e.push("\n                </a>\n              </li>\n            ")),e.push('\n              <li role="presentation" data-table-action="download-public">\n                <a href="'),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push("/api/v1/integration/pgp/key_download/"),e.push(n(i.id)),e.push('" role="menuitem" tabindex="-1" download>\n                  <span class="dropdown-iconSpacer">\n                    '),e.push(this.Icon("download")),e.push("\n                  </span>\n                  "),e.push(this.T("Download Public Key")),e.push('\n                </a>\n              </li>\n              <li role="presentation" class="danger js-remove" data-table-action="remove">\n                <span class="dropdown-iconSpacer">\n                  '),e.push(this.Icon("trash")),e.push("\n                </span>\n                "),e.push(this.T("Delete")),e.push("\n              </li>\n            </ul>\n          </div>\n        </td>\n    ");e.push("\n  ")}e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/placetel"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p;for(e.push("<form>\n\n  <h2>"),e.push(this.T("Endpoint Settings")),e.push("</h2>\n\n  <p>"),e.push(this.T("You need to configure the Zammad endpoints in the %s web interface:","Placetel")),e.push('<p>\n\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="20%">'),e.push(this.T("Type")),e.push('\n          <th width="80%">'),e.push(this.T("URL")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("Endpoint")),e.push('\n          <td class="settings-list-control-cell"><input type="url" class="form-control form-control--small js-select" readonly value="'),e.push(this.C("http_type")),e.push("://"),e.push(this.C("fqdn")),e.push("/api/v1/placetel/"),e.push(n(this.placetel_token)),e.push('">\n      </tbody>\n    </table>\n  </div>\n\n  <p>'),e.push(this.T("In order for Zammad to access %s, the %s API token must be stored here:","Placetel","Placetel")),e.push('<p>\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="20%">'),e.push(this.T("Type")),e.push('\n          <th width="80%">'),e.push(this.T("Content")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("API Token")),e.push('\n          <td class="settings-list-control-cell"><input type="input" class="form-control form-control--small js-select" value="'),e.push(n(this.config.api_token)),e.push('" name="api_token" placeholder="">\n      </tbody>\n    </table>\n  </div>\n\n  <h2>'),e.push(this.T("Call Settings")),e.push("</h2>\n  <h3>"),e.push(this.T("Inbound")),e.push("</h3>\n\n  <p>"),e.push(this.T("Block caller IDs based on sender caller ID.")),e.push('\n\n  <div class="settings-entry">\n    <table class="settings-list js-inboundBlockCallerId" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="50%">'),e.push(this.T("Caller ID to block")),e.push('\n          <th width="40%">'),e.push(this.T("Note")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),t=0,r=(l=this.config.inbound.block_caller_ids).length;t<r;t++)p=l[t],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="caller_id" value="'),e.push(n(p.caller_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="'),e.push(n(p.note)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");for(e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="caller_id" value="" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="" placeholder="'),e.push(this.Ti("my own note")),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("</div>\n      </tbody>\n    </table>\n  </div>\n<!-- disabled until api is supporting it\n  <h3>"),e.push(this.T("Outbound")),e.push("</h3>\n\n  <p>"),e.push(this.T("Set caller ID of outbound calls based on destination caller ID.")),e.push('\n\n  <div class="settings-entry js-outboundRouting">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="30%">'),e.push(this.T("Destination caller ID")),e.push('\n          <th width="30%">'),e.push(this.T("Set outbound caller ID")),e.push('\n          <th width="30%">'),e.push(this.T("Note")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),i=0,o=(c=this.config.outbound.routing_table).length;i<o;i++)p=c[i],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="dest" value="'),e.push(n(p.dest)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="caller_id" value="'),e.push(n(p.caller_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="'),e.push(n(p.note)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");for(e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="dest" value="" placeholder="49* or 3230123456789" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="caller_id" value="" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="" placeholder="'),e.push(this.Ti("my own note")),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("</div>\n      </tbody>\n    </table>\n  </div>\n-->\n\n  <h2>"),e.push(this.T("Other Settings")),e.push('</h2>\n\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="50%">'),e.push(this.T("Value")),e.push('\n          <th width="50%">'),e.push(this.T("Description")),e.push('\n      </thead>\n      <tbody>\n<!--\n        <tr>\n          <td class="settings-list-control-cell"><input name="default_caller_id" value="'),e.push(n(this.config.outbound.default_caller_id)),e.push('" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control">'),e.push(this.T("Default caller ID for outbound calls.")),e.push('\n-->\n        <tr>\n          <td class="settings-list-control-cell js-viewLimit">\n          <td class="settings-list-row-control">'),e.push(this.T("Shown records in caller log.")),e.push("\n      </tbody>\n    </table>\n  </div>\n\n  <h2>"),e.push(this.T("Phone Extension to Agent Mapping")),e.push("</h2>\n\n  <p>"),e.push(this.T("By mapping your agents' Placetel SIP users to their Zammad user accounts, Zammad can support your agents by opening either a new ticket dialogue or the user profile upon picking up a new call.")),e.push('\n\n  <div class="settings-entry">\n    <table class="settings-list js-userDeviceMap" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="45%">'),e.push(this.T("Placetel")),e.push("/"),e.push(this.T("Device")),e.push('\n          <th width="45%">'),e.push(this.T("Zammad")),e.push("/"),e.push(this.T("User")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),s=0,a=(u=this.config.user_device_map).length;s<a;s++)p=u[s],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="device_id" value="'),e.push(n(p.device_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="user_id" value="'),e.push(n(p.user_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="device_id" value="" placeholder="e. g. 777042617425@fpbx.de" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="user_id" value="" placeholder="'),e.push(this.Ti("e. g. user@example.com")),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push('</div>\n      </tbody>\n    </table>\n  </div>\n\n  <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Save")),e.push("</button>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/sipgate"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p;for(e.push("<form>\n\n  <h2>"),e.push(this.T("Endpoint Settings")),e.push("</h2>\n\n  <p>"),e.push(this.T("You need to configure the Zammad endpoints in the %s web interface:","Sipgate")),e.push('<p>\n\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="20%">'),e.push(this.T("Type")),e.push('\n          <th width="80%">'),e.push(this.T("URL")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("Inbound")),e.push('\n          <td class="settings-list-control-cell"><input type="url" class="form-control form-control--small js-select" readonly value="'),e.push(this.C("http_type")),e.push("://"),e.push(this.C("fqdn")),e.push("/api/v1/sipgate/"),e.push(n(this.sipgate_token)),e.push('/in">\n        <tr>\n          <td class="settings-list-row-control">'),e.push(this.T("Outbound")),e.push('\n          <td class="settings-list-control-cell"><input type="url" class="form-control form-control--small js-select" readonly value="'),e.push(this.C("http_type")),e.push("://"),e.push(this.C("fqdn")),e.push("/api/v1/sipgate/"),e.push(n(this.sipgate_token)),e.push('/out">\n      </tbody>\n    </table>\n  </div>\n\n  <h2>'),e.push(this.T("Call Settings")),e.push("</h2>\n  <h3>"),e.push(this.T("Inbound")),e.push("</h3>\n\n  <p>"),e.push(this.T("Block caller IDs based on sender caller ID.")),e.push('\n\n  <div class="settings-entry">\n    <table class="settings-list js-inboundBlockCallerId" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="50%">'),e.push(this.T("Caller ID to block")),e.push('\n          <th width="40%">'),e.push(this.T("Note")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),t=0,r=(l=this.config.inbound.block_caller_ids).length;t<r;t++)p=l[t],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="caller_id" value="'),e.push(n(p.caller_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="'),e.push(n(p.note)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");for(e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="caller_id" value="" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="" placeholder="'),e.push(this.Ti("my own note")),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("</div>\n      </tbody>\n    </table>\n  </div>\n\n  <h3>"),e.push(this.T("Outbound")),e.push("</h3>\n\n  <p>"),e.push(this.T("Set caller ID of outbound calls based on destination caller ID.")),e.push('\n\n  <div class="settings-entry js-outboundRouting">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="30%">'),e.push(this.T("Destination caller ID")),e.push('\n          <th width="30%">'),e.push(this.T("Set outbound caller ID")),e.push('\n          <th width="30%">'),e.push(this.T("Note")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),i=0,o=(c=this.config.outbound.routing_table).length;i<o;i++)p=c[i],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="dest" value="'),e.push(n(p.dest)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="caller_id" value="'),e.push(n(p.caller_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="'),e.push(n(p.note)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");for(e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="dest" value="" placeholder="49* or 3230123456789" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="caller_id" value="" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="note" value="" placeholder="'),e.push(this.Ti("my own note")),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("</div>\n      </tbody>\n    </table>\n  </div>\n\n  <h2>"),e.push(this.T("Other Settings")),e.push('</h2>\n\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="50%">'),e.push(this.T("Value")),e.push('\n          <th width="50%">'),e.push(this.T("Description")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-control-cell"><input name="default_caller_id" value="'),e.push(n(this.config.outbound.default_caller_id)),e.push('" placeholder="4930609854189" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control">'),e.push(this.T("Default caller ID for outbound calls.")),e.push('\n        <tr>\n          <td class="settings-list-control-cell js-viewLimit">\n          <td class="settings-list-row-control">'),e.push(this.T("Shown records in caller log.")),e.push("\n      </tbody>\n    </table>\n  </div>\n\n  <h2>"),e.push(this.T("Phone Extension to Agent Mapping")),e.push("</h2>\n\n  <p>"),e.push(this.T("By mapping your agents' sipgate users to their Zammad user accounts, Zammad can support your agents by opening either a new ticket dialogue or the user profile upon picking up a new call.")),e.push('\n\n  <div class="settings-entry">\n    <table class="settings-list js-userRemoteMap" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="45%">'),e.push(this.T("Sipgate")),e.push("/"),e.push(this.T("User")),e.push('\n          <th width="45%">'),e.push(this.T("Zammad")),e.push("/"),e.push(this.T("User")),e.push('\n          <th width="10%">'),e.push(this.T("Action")),e.push("\n      </thead>\n      <tbody>\n"),s=0,a=(u=this.config.user_remote_map).length;s<a;s++)p=u[s],e.push('\n        <tr class="js-row">\n          <td class="settings-list-control-cell"><input name="remote_user_id" value="'),e.push(n(p.remote_user_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="user_id" value="'),e.push(n(p.user_id)),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text js-remove">'),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("</div>\n");e.push('\n        <tr>\n          <td class="settings-list-control-cell"><input name="remote_user_id" value="" placeholder="e. g. W123" class="form-control form-control--small js-summary">\n          <td class="settings-list-control-cell"><input name="user_id" value="" placeholder="'),e.push(this.Ti("e. g. user@example.com")),e.push('" class="form-control form-control--small js-summary">\n          <td class="settings-list-row-control"><div class="btn btn--text btn--create js-add">'),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push('</div>\n      </tbody>\n    </table>\n  </div>\n\n  <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Save")),e.push("</button>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/smime"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<form>\n  <h2>"),e.push(this.T("Certificates & Private Keys")),e.push('</h2>\n  <div class="settings-entry settings-entry--stretched js-certList"></div>\n\n  <div class="btn btn--primary js-addCertificate">'),e.push(this.T("Add Certificate")),e.push('</div>\n  <div class="btn js-addPrivateKey">'),e.push(this.T("Add Private Key")),e.push("</div>\n\n  <hr>\n\n  <h2>"),e.push(this.T("Default Behavior")),e.push("</h2>\n  <p>"),e.push(this.T("Choose the default behavior of the S/MIME integration on per group basis. If signing or encrypting is not possible, the setting has no effect. Agents can always manually alter the behavior for each article.")),e.push('</p>\n  <div class="settings-entry settings-entry--stretched js-groupList"></div>\n  <div class="btn btn--primary js-updateGroup">'),e.push(this.T("Update")),e.push("</div>\n</form>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/smime_certificate_add"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n<p class="alert alert--danger js-error hide"></p>\n\n<div class="form-group">\n  <div class="formGroup-label">\n    <label for="certificate-upload">'),e.push(this.T("Upload Certificate")),e.push('</label>\n  </div>\n  <div class="controls">\n    <input name="file" type="file" id="certificate-upload">\n  </div>\n</div>\n\n<div class="or-divider">\n  <span>'),e.push(this.T("or")),e.push('</span>\n</div>\n\n<div class="form-group">\n  <div class="formGroup-label">\n    <label for="certificate-paste">'),e.push(this.T("Paste Certificate")),e.push('</label>\n  </div>\n  <div class="controls">\n    <textarea cols="25" rows="20" name="data" style="height: 200px;" id="certificate-paste"></textarea>\n  </div>\n</div>\n\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/smime_group"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<table class="settings-list">\n  <thead>\n    <tr>\n      <th width="55%">'),e.push(this.T("Group")),e.push("\n      <th>"),e.push(this.T("Sign")),e.push("\n      <th>"),e.push(this.T("Encryption")),e.push("\n  </thead>\n  <tbody>\n  "),_.isEmpty(this.groups))e.push('\n  <tr>\n    <td colspan="6">\n      '),e.push(this.T("No Entries")),e.push("\n    </td>\n  </tr>\n  ");else{for(e.push("\n    "),i=0,s=(r=this.groups).length;i<s;i++)t=r[i],e.push('\n      <tr data-id="'),e.push(n(t.id)),e.push('">\n        <td>'),e.push(n(this.P(t,"name"))),e.push('\n        <td class="settings-list-control-cell js-signDefault">\n        <td class="settings-list-control-cell js-encryptionDefault">\n    ');e.push("\n  ")}e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/smime_list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<table class="settings-list settings-list--stretch">\n  <thead>\n  '),_.isEmpty(this.certs))e.push('\n    <tr>\n      <th class="centered">\n        '),
e.push(this.T("No Entries")),e.push("\n      </th>\n    </tr>\n  ");else{for(e.push('\n    <tr>\n      <th width="55%">'),e.push(this.T("Subject")),e.push('\n      <th width="10%">'),e.push(this.T("Hash")),e.push('\n      <th width="10%">'),e.push(this.T("Fingerprint")),e.push('\n      <th width="10%">'),e.push(this.T("Created")),e.push('\n      <th width="10%">'),e.push(this.T("Expires")),e.push('\n      <th width="5%">'),e.push(this.T("Actions")),e.push("\n  </thead>\n  <tbody>\n    "),i=0,s=(r=this.certs).length;i<s;i++)t=r[i],e.push('\n      <tr data-id="'),e.push(n(t.id)),e.push('">\n        <td>'),e.push(n(t.subject)),e.push("\n          "),t.private_key&&(e.push("<br><i>"),e.push(this.T("Including private key.")),e.push("</i>")),e.push("\n        <td>"),e.push(n(t.doc_hash)),e.push('\n        <td title="'),e.push(n(t.fingerprint)),e.push('">'),e.push(n(t.fingerprint.substr(1,10))),e.push("...\n        <td>"),e.push(this.datetime(t.not_before_at)),e.push("\n        <td>"),e.push(this.datetime(t.not_after_at)),e.push('\n        <td>\n          <div class="dropdown dropdown--actions">\n            <div class="btn btn--table btn--text btn--secondary js-action" data-toggle="dropdown">\n              '),e.push(this.Icon("overflow-button")),e.push('\n            </div>\n            <ul class="dropdown-menu dropdown-menu-right js-table-action-menu" role="menu">\n            '),t.private_key&&(e.push('\n              <li role="presentation" data-table-action="download-private">\n                <a href="'),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push("/api/v1/integration/smime/private_key_download/"),e.push(n(t.id)),e.push('" role="menuitem" tabindex="-1" download>\n                <span class="dropdown-iconSpacer">\n                    '),e.push(this.Icon("download")),e.push("\n                  </span>\n                "),e.push(this.T("Download Private Key")),e.push("\n              </a>\n              </li>\n            ")),e.push('\n              <li role="presentation" data-table-action="download-public">\n                <a href="'),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push("/api/v1/integration/smime/certificate_download/"),e.push(n(t.id)),e.push('" role="menuitem" tabindex="-1" download>\n                  <span class="dropdown-iconSpacer">\n                    '),e.push(this.Icon("download")),e.push("\n                  </span>\n                  "),e.push(this.T("Download Certificate")),e.push('\n                </a>\n              </li>\n              <li role="presentation" class="danger js-remove" data-table-action="remove">\n                <span class="dropdown-iconSpacer">\n                  '),e.push(this.Icon("trash")),e.push("\n                </span>\n                "),e.push(this.T("Delete")),e.push("\n              </li>\n            </ul>\n          </div>\n        </td>\n    ");e.push("\n  ")}e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/integration/smime_private_key_add"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n<p class="alert alert--danger js-error hide"></p>\n\n<div class="form-field-group">\n  <div class="form-group">\n    <div class="formGroup-label">\n      <label for="key-upload">'),e.push(this.T("Upload Private Key")),e.push('</label>\n    </div>\n    <div class="controls">\n      <input name="file" type="file" id="key-upload">\n    </div>\n  </div>\n\n  <div class="or-divider">\n    <span>'),e.push(this.T("or")),e.push('</span>\n  </div>\n\n  <div class="form-group">\n    <div class="formGroup-label">\n      <label for="key-paste">'),e.push(this.T("Paste Private Key")),e.push('</label>\n    </div>\n    <div class="controls">\n      <textarea cols="25" rows="20" name="data" style="height: 200px;" id="key-paste"></textarea>\n    </div>\n  </div>\n</div>\n\n<div class="form-group">\n  <div class="formGroup-label">\n    <label for="key-secret">'),e.push(this.T("Enter Private Key Secret")),e.push('</label>\n  </div>\n  <div class="controls">\n    <input class="form-control" name="secret" type="password" id="key-secret">\n  </div>\n</div>\n\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/keyboard_shortcuts"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S,x,j,D,P;for(e.push('<div class="horizontal">\n  <div class="flex">\n'),i=0,c=(k=this.areas).length;i<c;i++){if(t=k[i],e.push("\n  "),"left"===t.location){for(e.push("\n    <h2>"),e.push(this.T(t.headline)),e.push("</h2>\n    "),r=0,u=(A=t.content).length;r<u;r++){for(s=A[r],e.push("\n      "),s.where&&(e.push("<p><i>"),e.push(this.T(s.where)),e.push("</i></p>")),e.push("\n      "),o=0,p=(C=s.shortcuts).length;o<p;o++){if(P=C[o],e.push("\n        "),P.hotkeys&&(e.push("\n          <kbd>"),e.push(this.hotkeys.join("</kbd> <kbd>")),e.push("</kbd>\n        ")),e.push("\n        "),P.keyPrefix&&(e.push("\n          "),e.push(n(P.keyPrefix)),e.push("\n        ")),e.push("\n        "),_.isArray(P.key)){for(e.push("\n          "),l=0,h=(T=P.key).length;l<h;l++)a=T[l],e.push("\n            <kbd>"),e.push(a),e.push("</kbd>\n          ");e.push("\n        ")}else e.push("\n          <kbd>"),e.push(P.key),e.push("</kbd>\n        ");e.push("\n        "),e.push(this.T(P.description)),e.push("<br>\n      ")}e.push("\n    ")}e.push("\n  ")}e.push("\n")}for(e.push('\n  </div>\n  <div class="flex">\n'),v=0,d=(S=this.areas).length;v<d;v++){if(t=S[v],e.push("\n  "),"right"===t.location){for(e.push("\n    <h2>"),e.push(this.T(t.headline)),e.push("</h2>\n    "),y=0,f=(x=t.content).length;y<f;y++){for(s=x[y],e.push("\n      "),s.where&&(e.push("<p><i>"),e.push(this.T(s.where)),e.push("</i></p>")),e.push("\n      "),b=0,m=(j=s.shortcuts).length;b<m;b++){if(P=j[b],e.push("\n        "),P.hotkeys?(e.push("\n          <kbd>"),e.push(this.hotkeys.join("</kbd> <kbd>")),e.push("</kbd>\n        ")):P.magicKey&&(e.push("\n          <kbd>"),e.push(n(this.magicKey)),e.push("</kbd>\n        ")),e.push("\n        "),P.shiftKey&&e.push("\n          <kbd>shift</kbd>\n        "),e.push("\n        "),P.keyPrefix&&(e.push("\n          "),e.push(n(P.keyPrefix)),e.push("\n        ")),e.push("\n        "),_.isArray(P.key)){for(e.push("\n          "),w=0,g=(D=P.key).length;w<g;w++)a=D[w],e.push("\n            <kbd>"),e.push(a),e.push("</kbd>\n          ");e.push("\n        ")}else e.push("\n          <kbd>"),e.push(P.key),e.push("</kbd>\n        ");e.push("\n        "),e.push(this.T(P.description)),e.push("<br>\n      ")}e.push("\n    ")}e.push("\n  ")}e.push("\n")}e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/_answer_attachments"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(this.attachments){for(e.push('\n<div class="knowledge-base-article-attachments">\n\t<h2>'),e.push(this.Ti("Attachments")),e.push('</h2>\n\t<ul class="knowledge-base-article-attachments-list">\n\t'),i=0,s=(r=this.attachments).length;i<s;i++)t=r[i],e.push('\n\t<li>\n\t\t<a class="btn" href="'),e.push(n(t.url)),e.push('" download>\n\t\t\t'),e.push(this.Icon("download")),e.push("\n\t\t\t<span>"),e.push(n(t.filename)),e.push("</span>\n\t\t</a>\n\t</li>\n\t");e.push("\n\t</ul>\n</div>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/_icon_with_modifier"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<span class="modified-icon '),e.push(n(this.className)),e.push('">\n  '),this.item.iconFont?(e.push("\n    "),e.push(this.fontIcon(this.item.icon,this.iconset,"section-inner-icon")),e.push("\n  ")):(e.push("\n    "),e.push(this.Icon(this.item.icon,"section-inner-icon")),e.push("\n  ")),e.push("\n  "),e.push(this.Icon(this.item.state+"-modifier","modified-icon-modifier")),e.push("\n</span>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/_reader_answer_meta"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i;this.isEditor&&(e.push("\n  <span>"),e.push(this.T(this.answer.can_be_published_state())),e.push("</span>\n")),e.push("\n\n"),this.answer.is_internally_published_object()&&(i=this.translation.updated_by_id)&&(e.push("\n  "),(n=App.User.find(i))&&(e.push("\n    <span>"),e.push(n.displayName()),e.push("</span>\n  ")),e.push("\n")),e.push("\n\n"),this.answer.is_internally_published_object()&&(t=Math.max(new Date(this.answer.can_be_published_internal_at()),new Date(this.translation.updated_at)))&&(e.push("\n  "),e.push(this.Tp("Published %s",this.humanTime(new Date(t).toISOString()))),e.push("\n")),e.push("\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/_reader_linked_tickets"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t;(null!=(t=this.tickets)?t.length:void 0)&&(e.push('\n  <div class="attachments attachments--list">\n    '),e.push(this.Icon("overviews")),e.push('\n    <div class="attachments-title">\n      '),e.push(this.T("Linked Tickets")),e.push(' <span class="badge">'),e.push(this.tickets.length),e.push("</span>\n    </div>\n    "),e.push(this.V("generic/ticket_list",{show_max:5,tickets:this.tickets})),e.push("\n  </div>\n")),e.push("\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/_reader_list_item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<a href="'),e.push(this.item.url),e.push('">\n  <span class="section-inner">\n    '),e.push(this.iconWithModifier(this.item,{className:"section-inner-icon-holder",iconset:this.iconset,addStateClass:!0})),e.push('\n    <span class="title">'),e.push(n(this.item.title)),e.push("</span>\n    "),"category"===this.item.type&&(e.push('\n      <span class="section-detail">'),e.push(n(this.T("Answers: %s",this.item.count))),e.push("</span>\n    ")),e.push("\n  </span>\n</a>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/_reader_pagination"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){this.previousAnswer&&(e.push('\n  <a href="'),e.push(this.previousAnswer.url),e.push('" class="knowledge-base-article-nav-link knowledge-base-article-nav-link--prev">\n    '),e.push(this.Icon("arrow-left")),e.push('\n    <div class="spacer"></div>\n    <span class="knowledge-base-article-nav-link-title">'),e.push(n(this.previousAnswer.title)),e.push("</span>\n  </a>\n")),e.push("\n\n"),this.nextAnswer&&(e.push('\n  <a href="'),e.push(this.nextAnswer.url),e.push('" class="knowledge-base-article-nav-link knowledge-base-article-nav-link--next">\n    <span class="knowledge-base-article-nav-link-title">'),e.push(n(this.nextAnswer.title)),e.push('</span>\n    <div class="spacer"></div>\n    '),e.push(this.Icon("arrow-right")),e.push("\n  </a>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/_reader_tags"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a;if(null!=(r=this.tags)?r.length:void 0){for(e.push('\n  <div class="attachments attachments--list">\n    '),e.push(this.Icon("hashtag")),e.push('\n    <div class="attachments-title">\n      '),e.push(this.T("Tags")),e.push('\n    </div>\n\n    <div class="knowledge-base-article-tags--container">\n      '),t=i=0,s=(o=this.tags).length;i<s;t=++i)a=o[t],e.push('\n        <a href="#" class="tag js-tag">'),e.push(n(a)),e.push("</a>\n      ");e.push("\n    </div>\n  </div>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/agent"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="knowledge-base-navigation js-navigation"></div>\n\n<div class="knowledge-base-body horizontal flex js-body">\n  <div class="js-sidebar sidebar knowledge-base-sidebar">\n  </div>\n\n  <div class="flex vertical page-content knowledge-base-main">\n  </div>\n\n  <div class="js-content">\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/content"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n;this.missingTranslation()&&(e.push('\n  <div class="js-alert alert alert--warning alert--square">'),e.push(this.T("No translation for this locale available")),e.push("</div>\n")),e.push('\n\n<div class="main flex vertical end">\n  <div class="page-header">\n    <div class="page-header-title">\n      <h2>'),e.push(this.T(this.object.objectActionName())),e.push("</h2>\n      "),("function"==typeof(t=this.object.constructor).canBePublished?t.canBePublished():void 0)&&(e.push("\n        "),e.push(this.V("knowledge_base/content_can_be_published_header_suffix",{object:this.object})),e.push("\n      ")),e.push('\n    </div>\n  </div>\n  <form class="form--grid js-form"></form>\n\n  <div class="horizontal">\n    <a class="btn btn js-discard hide">\n      '),e.push(this.T("Discard your unsaved changes.")),e.push("\n    </a>\n\n    "),("function"==typeof(n=this.object.constructor).canBePublished?n.canBePublished():void 0)?e.push('\n      <div class="js-submitContainer"></div>\n    '):(e.push('\n      <a class="btn btn--primary js-submit">\n        '),e.push(this.T("Update")),e.push("\n      </a>\n    ")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/content_can_be_published_header_suffix"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<span class="suffix js-published-header-suffix">\n  <span class="'),e.push(n(this.object.can_be_published_state_css())),e.push('"><span class="label-text">'),e.push(this.T(this.object.can_be_published_state())),e.push("</span></span>\n\n  "),this.object.can_be_published_internal_in_future()&&(e.push('\n    <span class="label-warning"><span class="label-text">'),e.push(this.T("Will be internal")),e.push(" "),e.push(this.humanTime(this.object.internal_at)),e.push("</span></span>\n  ")),e.push("\n\n  "),this.object.can_be_published_publish_in_future()&&(e.push('\n    <span class="label-warning"><span class="label-text">'),e.push(this.T("Will be published")),e.push(" "),e.push(this.humanTime(this.object.published_at)),e.push("</span></span>\n  ")),e.push("\n\n  "),this.object.can_be_published_archive_in_future()&&(e.push('\n    <span class="label-warning"><span class="label-text">'),e.push(this.T("Will be archived")),e.push(" "),e.push(this.humanTime(this.object.archived_at)),e.push("</span></span>\n  ")),e.push("\n</span>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/feed_dialog"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>\n  "),e.push(this.T("Internal Knowledge Base feed:")),e.push('\n  <br>\n  <a href="'),e.push(n(this.kb_url)),e.push('" target="_blank">'),e.push(n(this.kb_title)),e.push("</a>\n\n  "),e.push(this.Icon("clipboard","u-clickable js-copy")),e.push("\n</p>\n\n"),this.category_url&&(e.push("\n  <p>\n    "),e.push(this.T("This category including sub-categories feed:")),e.push('\n    <br>\n    <a href="'),e.push(n(this.category_url)),e.push('" target="_blank">'),e.push(n(this.category_title)),e.push("</a>\n\n    "),e.push(this.Icon("clipboard","u-clickable js-copy")),e.push("\n  </p>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/navigation"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u;for(e.push('<nav class="breadcrumbs">\n  '),t=0,r=(l=this.crumbs).length;t<r;t++)i=l[t],e.push('\n    <a class="breadcrumb" '),i.url&&(e.push('href="'),e.push(n(i.url))),e.push('">\n      '),i.icon&&(e.push("\n        "),e.push(this.iconWithModifier(i,{iconset:this.iconset})),e.push("\n      ")),e.push("\n\n      "),e.push(n(i.title)),e.push("\n    </a>\n  ");for(e.push('\n</nav>\n\n<div class="breadcrumbs-menu">\n  <a href="'),e.push(n(this.search.url)),e.push('"\n     class="btn btn--action btn--only-icon js-search '),this.search.enabled&&e.push("btn--active"),e.push('"\n     >\n    '),e.push(this.Icon("magnifier")),e.push('\n  </a>\n  <a href="'),e.push(n(this.externalUrl)),e.push('"\n     target=_blank\n     '),this.externalUrl||e.push("disabled"),e.push('\n     class="btn btn--action btn--only-icon"\n     >\n    '),e.push(this.Icon("external")),e.push("\n  </a>\n  "),this.feed.available&&(e.push('\n  <div\n     class="btn btn--action btn--only-icon js-feed"\n     >\n    '),e.push(this.Icon("rss")),e.push("\n  </div>\n  ")),e.push("\n  "),this.edit.available&&(e.push('\n    <a href="'),e.push(n(this.edit.url)),e.push('"\n      class="btn btn--action js-edit '),this.edit.enabled&&e.push("btn--active"),e.push('"\n      '),this.search.enabled&&e.push("disabled"),e.push("\n      >\n      "),e.push(this.T("Edit")),e.push("\n    </a>\n  ")),e.push('\n  <div class="btn btn--action btn--split--first js-pickedLanguage">'),e.push(n(null!=(c=this.kbLocales.selected)?c.systemLocale().locale:void 0)),e.push('</div>\n  <div class="dropdown dropdown--actions">\n    <div class="btn btn--action btn--split--last btn--slim btn--icon-only centered" data-toggle="dropdown" aria-expanded="false">\n      '),e.push(this.Icon("arrow-down")),e.push('\n    </div>\n    <ul class="dropdown-menu dropdown-menu-'),e.push(n(this.dir("right","left"))),e.push(' dropdown-menu-full-height" role="menu">\n      '),s=0,o=(u=this.kbLocales.collection).length;s<o;s++)a=u[s],e.push('\n        <li role="presentation">\n          <a href="'),e.push(n(a.url)),e.push('" role="menuitem" tabindex="-1">\n            '),e.push(n(a.title)),e.push("\n\n            "),a.id===this.kbLocales.selected.id&&(e.push('\n              <span class="dropdown-selectedSpacer is-selected">\n                '),e.push(this.Icon("checkmark")),e.push("\n              </span>\n            ")),e.push("\n          </a>\n        </li>\n      ");e.push("\n    </ul>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/permissions_dialog"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(i in e.push('<table class="settings-list settings-list--roles-permissions">\n  <thead>\n    <th>'),e.push(this.T("Role")),e.push("\n    "),r=this.accessLevels)c=r[i],e.push("\n      <th>"),e.push(this.T(c)),e.push("\n    ");for(e.push("\n  <tbody>\n"),t=0,s=(o=this.roles).length;t<s;t++){for(i in l=o[t],e.push("\n  <tr>\n    <td>\n      "),e.push(n(l.name)),e.push("\n\n    "),a=this.accessLevels)c=a[i],e.push('\n      <td class="settings-list-control-cell settings-list-radio-cell u-clickable">\n        <label class="inline-label radio-replacement">\n          <input\n            type="radio"\n            value="'),e.push(n(i)),e.push('"\n            name="'),e.push(n(l.id)),e.push('"\n            '),this.params[l.id]===i&&e.push("checked"),e.push("\n            "),l.accessLevelIsDisabled[i]&&e.push("\n              disabled\n              data-permanently-disabled\n            "),e.push("\n            />\n          "),e.push(this.Icon("radio","icon-unchecked")),e.push("\n          "),e.push(this.Icon("radio-checked","icon-checked")),e.push("\n        </label>\n    ");e.push("\n  </tr>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/public_menu_form_item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div data-kb-locale-id="'),e.push(n(this.kb_locale_id)),e.push('" class="settings-entry">\n  <h2>'),e.push(n(this.title)),e.push('</h2>\n\n  <div class="js-alert alert alert--danger hidden"></div>\n\n  <div class="form-group">\n    <table class="settings-list settings-list--stretch">\n      <thead>\n        <tr>\n          <th style="width: 36px" class="table-draggable">\n          <th style="width: 200px">\n            '),e.push(this.T("Title")),e.push("\n          <th>\n            "),e.push(this.T("URL")),e.push("\n          <th>\n            "),e.push(this.T("Target")),e.push('\n          <th style="width: 44px">\n            '),e.push(this.T("Delete")),e.push("\n      <tbody>\n        "),t=0,s=(r=this.rows).length;t<s;t++)i=r[t],e.push("\n          "),e.push(this.V("knowledge_base/public_menu_form_item_row",{item:i})),e.push("\n        ");e.push('\n        <tr>\n          <td>\n          <td class="settings-list-control-cell" colspan="4">\n            <a class="btn btn--text btn--create js-add">\n              '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push("\n            </a>\n    </table>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/public_menu_form_item_row"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;e.push('<tr class="sortable" '),this.item&&(e.push('data-id="'),e.push(n(this.item.id)),e.push('"')),e.push('>\n  <td class="table-draggable">'),e.push(this.Icon("draggable")),e.push('</td>\n  <td class="settings-list-control-cell">\n    <input class="form-control form-control--small" type="text" data-name="title" placeholder="Title" value="'),e.push(n(null!=(t=this.item)?t.title:void 0)),e.push('">\n  <td class="settings-list-control-cell">\n    <input class="form-control form-control--small" type="text" data-name="url" placeholder="http://url" value="'),e.push(n(null!=(i=this.item)?i.url:void 0)),e.push('">\n  <td class="settings-list-control-cell settings-list-checkbox-cell">\n    <label class="inline-label checkbox-replacement js-new-tab">\n      <input type="checkbox" value="1" data-name="new_tab" '),(null!=(s=this.item)?s.new_tab:void 0)&&e.push("checked"),e.push('>\n      <svg class="icon icon-checkbox icon-unchecked"><use xlink:href="assets/images/icons.svg#icon-checkbox"></use></svg>\n      <svg class="icon icon-checkbox-checked icon-checked"><use xlink:href="assets/images/icons.svg#icon-checkbox-checked"></use></svg>\n      <span class="label-text">'),e.push(this.T("New tab")),e.push('</span>\n    </label>\n\n  <td class="settings-list-controls u-positionOrigin">\n    <span class="checkbox-replacement checkbox-replacement--fullscreen js-remove">\n      <input type="checkbox" name="showTitle" value="true">\n      '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n      "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n    </span>\n</tr>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/public_menu_manager"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d;for(e.push("<h2>\n  "),e.push(this.T("Public Menu")),e.push('\n</h2>\n\n<p class="help-text">\n  '),e.push(this.T("Here you can add further links to your public FAQ page, which will be displayed either in the header or footer.")),e.push("\n</p>\n\n"),t=0,a=(h=this.locations).length;t<a;t++){for(u=h[t],e.push('\n  <div class="settings-entry kb-menu-settings-entry">\n    <h3>'),e.push(n(this.T(u.headline))),e.push("</h3>\n\n    "),s=0,l=(d=this.locales).length;s<l;s++){if(o=d[s],e.push('\n      <div class="kb-menu-preview">\n        <div class="label">'),e.push(n(o.systemLocale().name)),e.push('</div>\n\n        <div class="kb-menu-preview-container kb-menu-preview-container--'),e.push(n(u.identifier)),e.push('" style="background-color: '),e.push(n(u.color)),e.push("; color: "),e.push(n(u.color_link)),e.push(';">\n          '),p=App.KnowledgeBaseMenuItem.using_kb_locale_location(o,u.identifier),e.push("\n\n          "),0===p.length)e.push('\n            <span class="text-muted">'),e.push(n(this.T("Empty"))),e.push("</span>\n          ");else{for(e.push("\n            "),r=0,c=p.length;r<c;r++)i=p[r],e.push('\n              <a href="'),e.push(n(i.url)),e.push('" target="_blank">'),e.push(n(i.title)),e.push("</a>\n            ");e.push("\n          ")}e.push("\n        </div>\n      </div>\n    ")}e.push('\n\n    <a\n      class="btn btn--primary js-edit btn-manage-public-menu-edit"\n      href="#"\n      data-target-location="'),e.push(n(u.identifier)),e.push('"\n      data-target-locale="'),e.push(n(o.id)),e.push('">\n\n      '),e.push(n(this.T("Edit"))),e.push("\n    </a>\n  </div>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/reader"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="container">\n  <div class="knowledge-base-article">\n    '),this.search_return_url&&(e.push('\n      <a href="'),e.push(n(this.search_return_url)),e.push('" class="knowledge-base-article-nav-link knowledge-base-article-nav-link--prev">\n        '),e.push(this.Icon("arrow-left")),e.push('\n        <div class="spacer"></div>\n        <span class="knowledge-base-article-nav-link-title">'),e.push(this.T("Back to search results")),e.push("</span>\n      </a>\n    ")),e.push('\n\n    <h1 class="knowledge-base-article-header js-answer-title"></h1>\n\n    <small class="knowledge-base-article-meta js-answer-meta"></small>\n\n    <div class="knowledge-base-article-body">\n      <div class="knowledge-base-article-content richtext-content js-answer-body" dir="auto"></div>\n      <div class="knowledge-base-article-attachments js-answer-attachments"></div>\n      <div class="knowledge-base-article-linked-tickets js-answer-linked-tickets"></div>\n      <div class="knowledge-base-article-tags js-answer-tags"></div>\n    </div>\n\n    <div class="js-answer-pagination"></div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/reader_list"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t
;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="container">\n  <div class="js-searchFieldContainer"></div>\n  <div class="js-readerListContainer"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/scheduled_widget"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push(this.Icon("clock")),e.push('\n<div class="scheduled-widget-label">'),e.push(this.T("Scheduled for")),e.push(" "),e.push(this.timestamp),e.push('</div>\n<a class="btn btn--action btn--small scheduled-widget-delete js-delete">\n  '),e.push(this.Icon("diagonal-cross")),e.push("<span>"),e.push(this.T("Cancel")),e.push("\n</a>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/search"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="container">\n  <div class="js-searchFieldContainer"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/search_field_panel"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="searchfield"></div>\n\n<div class="js-placeholderEmpty help-block help-block--center hide">\n  '),e.push(this.Icon("mood-ok")),e.push("\n  <div class='help-block--inner'>"),e.push(this.T("Empty")),e.push('</div>\n</div>\n\n<div class="js-placeholderError help-block help-block--center hide">\n  '),e.push(this.Icon("mood-superbad")),e.push("\n  <div class='help-block--inner'></div>\n</div>\n\n<ul class=\"js-results sections sections--list\"></ul>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/search_field_widget"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<input class="js-searchField form-control" name="query" placeholder="'),e.push(this.Ti("Search")),e.push(" "),e.push(n(this.placeholder_suffix)),e.push('" type="search" autocomplete="off">\n'),e.push(this.Icon("magnifier")),e.push('\n<div class="search-loader">'),e.push(this.Icon("spinner-small")),e.push('</div>\n<a class="empty-search js-emptySearchButton">\n  '),e.push(this.Icon("diagonal-cross")),e.push("\n</a>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/search_item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<a href="'),e.push(n(this.data.url)),e.push('">\n  <span class="section-inner">\n    '),e.push(this.iconWithModifier(this.data,{className:"section-inner-icon-holder",iconset:this.iconset,addStateClass:!0})),e.push('\n    <span class="section-inner-text">\n      <span class="section-inner-title">'),e.push(this.data.title),e.push('</span>\n      <span class="section-inner-detail">\n        <span class="section-inner-date">'),e.push(this.humanTime(this.data.date)),e.push("</span> "),this.data.body&&(e.push('<span class="section-inner-body">'),e.push(this.data.body),e.push("</span>")),e.push("\n      </span>\n    </span>\n  </span>\n</a>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/server_snippet"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l;for(e.push('<div class="server-snippet">\n  <p>'),e.push(this.T("Configuration for %s",this.address_type)),e.push(" <strong>"),e.push(n(this.address)),e.push('</strong>:</p>\n  <ul class="nav nav-tabs" role="tablist">\n  '),t=0,s=(o=this.servers).length;t<s;t++)l=o[t],e.push("\n    <li"),l.active&&e.push(' class="active"'),e.push('><a href="#'),e.push(n(l.id)),e.push('" role="tab" data-toggle="tab">'),e.push(n(l.name)),e.push("</a>\n  ");for(e.push('\n  </ul>\n  <div class="tab-content">\n    '),i=0,r=(a=this.servers).length;i<r;i++)l=a[i],e.push('\n    <div class="tab-pane'),l.active&&e.push(n(" active")),e.push('" role="tabpanel" id="'),e.push(n(l.id)),e.push('">\n      <textarea class="form-control" rows="11" readonly>'),e.push(n(l.snippet)),e.push("</textarea>\n    </div>\n    ");e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/sidebar/actions"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(e.push('<div class="btn-list js-content-actions-container vertical start">\n  '),i=0,r=(l=this.actions).length;i<r;i++){if(t=l[i],e.push('\n    <a class="btn btn--text" data-action="'),e.push(n(t.action)),e.push('" '),e.push(n(t.disabled?"disabled":void 0)),e.push(">\n      "),t.iconName&&(e.push(" "),e.push(this.Icon(t.iconName)),e.push(" ")),e.push("\n      "),t.name instanceof Object){for(e.push("\n        "),s=0,o=(c=t.name).length;s<o;s++)a=c[s],e.push("\n          "),e.push(this.T(a)),e.push("\n        ");e.push("\n      ")}else e.push("\n        "),e.push(this.T(t.name)),e.push("\n      ");e.push("\n    </a>\n  ")}e.push("\n</div>\n\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/sidebar/attachments"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(e.push('<div class="sidebar-block-header">\n  <h2>'),e.push(this.T("Attachments")),e.push('</h2>\n</div>\n\n<div class="dropContainer">\n  '),this.attachments.length>0){for(e.push('\n    <ol class="list list--sidebar">\n      '),i=0,s=(r=this.attachments).length;i<s;i++)t=r[i],e.push('\n        <li class="list-item">\n          <a class="list-item-name" target=_blank href="'),e.push(n(t.url)),e.push('">\n            '),e.push(n(t.filename)),e.push('\n          </a>\n          <a class="list-item-delete js-delete" data-object-id="'),e.push(n(t.id)),e.push('" href="#">\n            '),e.push(this.Icon("diagonal-cross")),e.push("\n          </a>\n        </li>\n      ");e.push("\n    </ol>\n  ")}e.push('\n\n  <div class="attachmentUpload attachmentUpload--standalone hide">\n    <div class="horizontal">\n      <div class="u-highlight flex-space-after">\n        '),e.push(this.T("Uploading")),e.push(' (<span class="js-percentage">0</span>%) ...\n      </div>\n      <div class="attachmentUpload-cancel js-cancel">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n    </div>\n    <div class="attachmentUpload-progressBar" style="width: 0%"></div>\n  </div>\n\n  <div class="fileUpload btn btn--action btn--small">\n    '),e.push(this.Icon("plus-small")),e.push(" \n    "),o=_.uniqueId("fileUpload_"),e.push('\n    <input multiple="multiple" type="file" name="file" id="'),e.push(o),e.push('">\n    <label class="attachmentPlaceholder-label" for="'),e.push(o),e.push('">\n      <span>'),e.push(this.T("Add")),e.push('</span>\n    </label>\n  </div>\n\n  <div class="dropArea dropArea--small">\n    <div class="dropArea-inner">\n      '),e.push(this.T("Drop files here")),e.push("\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/sidebar/generic_list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a;if(e.push('<div class="sidebar-block-header">\n  <h2>'),e.push(this.T(this.title)),e.push('</h2>\n</div>\n\n<div class="btn-list horizontal">\n  <a href="#" class="btn btn--action btn--small btn--create js-add" '),this.enabled||e.push("disabled"),e.push(" >\n    "),e.push(this.Icon("plus-small")),e.push(" <span>"),e.push(this.T("Add")),e.push('</span>\n  </a>\n  <a href="#" class="js-reorder btn btn--action btn--small" '),this.enabled||e.push("disabled"),e.push(">\n    "),e.push(this.Icon("rearange")),e.push(" <span>"),e.push(this.T("Change order")),e.push('</span>\n  </a>\n</div>\n\n<ul class="kb-sidebar-block-content nav nav-pills nav-stacked">\n  '),this.items.length>0){for(e.push("\n    "),i=0,r=(o=this.items).length;i<r;i++){if(t=o[i],e.push('\n      <li>\n        <a href="'),e.push(n(t.url)),e.push('" class="'),e.push(n(t.className)),e.push('">\n          '),e.push(this.iconWithModifier(t,{className:"section-inner-icon-holder",iconset:this.iconset,addStateClass:!0})),e.push('\n          <span class="u-textTruncate">'),e.push(n(t.title)),e.push("</span>\n\n          "),t.icons){for(s in e.push('\n          <span class="flex-spacer"></span>\n            '),a=t.icons)a[s],e.push("\n              "),e.push(this.Icon(s)),e.push("\n            ");e.push("\n          ")}e.push("\n\n          "),null!==t.count&&(e.push('\n            <span class="badge badge--text">'),e.push(n(t.count)),e.push("</span>\n          ")),e.push("\n        </a>\n      </li>\n    ")}e.push("\n  ")}else e.push('\n    <li>\n      <span class="nav-pills-placeholder">'),e.push(this.T(this.emptyNote)),e.push("</span>\n    </li>\n  ");e.push("\n</ul>\n\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/sidebar/linked_tickets"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="sidebar-block-header">\n  <h2>'),e.push(this.T("Linked Tickets")),e.push("</h2>\n</div>\n\n"),e.push(this.V("generic/ticket_list",{show_max:5,tickets:this.tickets||[],object:"Ticket",editable:this.editable})),e.push('\n\n<a class="btn btn--action btn--small js-add" href="#">\n  '),e.push(this.Icon("plus-small")),e.push(" <span>"),e.push(this.T("Add")),e.push("</span>\n</a>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/sidebar/tags"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="sidebar-block-header">\n  <h2>'),e.push(this.T("Tags")),e.push("</h2>\n</div>\n\n"),this.tags.length>0){for(e.push('\n<ol class="list list--sidebar">\n  '),i=0,s=(r=this.tags).length;i<s;i++)t=r[i],e.push('\n    <li class="list-item" data-id="'),e.push(n(t)),e.push('">\n      <a class="list-item-name js-tag">'),e.push(n(t)),e.push('</a>\n      <div class="list-item-delete js-delete" data-type="remove">\n        '),e.push(this.Icon("diagonal-cross")),e.push("\n      </div>\n    </li>\n  ");e.push("\n</ol>\n")}e.push('\n\n<a class="sidebar-block-button text-muted js-newTagLabel" href="#">\n  + '),e.push(this.T("Add Tag")),e.push('\n</a>\n\n<form class="ui-front">\n  <input type="text" name="new_tag" class="hide js-newTagInput" autocomplete="off">\n</form>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/knowledge_base/vertical_form"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="settings-entry" id="'),e.push(n(this.attribute.name)),e.push('">\n  <h2>'),e.push(this.T(this.attribute.display)),e.push('</h2>\n  <p class="help-text">'),e.push(this.T(this.attribute.help)),e.push('</p>\n  <div class="horizontal end">\n    <div class="form-item flex '),e.push(n(this.attribute.tag)),e.push('"></div>\n    <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n  </div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/link/kb_answer"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push("<label>"),e.push(this.T("Related Answers")),e.push('</label>\n<ol class="tasks tasks--standalone">\n  '),t=0,s=(r=this.list).length;t<s;t++)i=r[t],e.push('\n    <li class="task">\n      <div class="icon-holder">\n      \t'),e.push(this.Icon("knowledge-base")),e.push('\n      </div>\n      <div class="task-text">\n        <a class="name kb-answer-popover" data-id="'),e.push(i.id),e.push('" href="'),e.push(i.url),e.push('">'),e.push(n(i.title)),e.push("</a>\n      </div>\n      "),this.editable&&(e.push('\n        <a class="list-item-delete js-delete" data-object="KnowledgeBase::Answer::Translation" data-object-id="'),e.push(n(i.id)),e.push('" data-link-type="normal">\n          '),e.push(this.Icon("diagonal-cross")),e.push("\n        </a>\n      ")),e.push("\n  ");e.push("\n</ol>\n"),this.editable&&(e.push('\n  <div class="text-muted js-add u-clickable">+ '),e.push(this.T("Link Related Answer")),e.push("</div>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/link/ticket/add"]=function(t){t||(t={});var e,n=[],i=function(t){var i,s=n;return n=[],t.call(this),i=n.join(""),n=s,e(i)},s=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?o(t):""},r=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,e,r,o;n.push("<fieldset>\n  "),e=function(){return i((function(){return n.push('\n    <input type="text" name="ticket_number" value="" required/>\n  ')}))},n.push("\n  "),r=function(){return i((function(){return n.push('\n    <input type="text" name="ticket_number" value="" class="form-control--inline form-control--small u-inlinePad" required/>\n  ')}))},n.push("\n  "),this.link_types.length>1?(n.push("\n    "),o=this,t=function(){return i((function(){var t,e,i,r;for(n.push('\n    <div class="u-inlineBlock u-positionOrigin u-inlinePad">\n      <select name="link_type" class="form-control form-control--small" required>\n        '),t=0,e=(r=o.link_types).length;t<e;t++)i=r[t],n.push('\n          <option value="'),n.push(s(i[0])),n.push('">'),n.push(o.T(i[1])),n.push("</option>\n        ");return n.push("\n      </select>\n      "),n.push(o.Icon("arrow-down")),n.push("\n    </div>\n    ")}))},n.push('\n    <div class="form-group">\n      '),n.push(App.i18n.translatePlain("Link %s %s as %s of Ticket# %s",this.T(this.link_object),r(),t(),this.object.number)),n.push("\n    </div>\n  ")):(n.push("\n    "),n.push(e()),n.push('\n    <input type="hidden" name="link_type" value="'),n.push(s(this.link_types[0][0])),n.push('"/>\n  ')),n.push("\n  </div>\n\n  "),this.hasByCustomer&&(n.push("\n    <hr>\n    <h4>"),n.push(this.T("Recent Customer Tickets")),n.push('</h4>\n    <div id="ticket-merge-customer-tickets"></div>\n  ')),n.push("\n\n  "),this.hasRecentViewed&&(n.push("\n    <hr>\n    <h4>"),n.push(this.T("Recently Viewed Tickets")),n.push('</h4>\n    <div id="ticket-merge-recent-tickets"></div>\n  ')),n.push("\n</fieldset>\n")}).call(this)}.call(t),t.safe=r,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/link/ticket/list"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t;for(t in e.push("<label>"),e.push(this.T("Links")),e.push("</label>\n"),this.links)e.push('\n<div class="ticketLinks">\n  <div class="list-title">'),e.push(this.T(t)),e.push("</div>\n  "),e.push(this.links[t].ticketList),e.push("\n</div>\n");e.push("\n"),this.editable&&(e.push('\n  <div class="text-muted u-clickable js-add">+ '),e.push(this.T("Add Link")),e.push("</div>\n")),e.push("\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/login"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d;if(e.push('<div class="login fullscreen">\n  <div class="fullscreen-center">\n    <div class="fullscreen-body">\n      <p>'),e.push(this.T("Log in to %s",this.C("fqdn"))),e.push("</p>\n\n      "),this.C("maintenance_mode")&&(e.push('\n        <div class="hero-unit alert alert--danger js-maintenanceMode">'),e.push(this.T("Zammad is currently in maintenance mode. Only administrators can log in. Please wait until the maintenance window is over.")),e.push("</div>\n      ")),e.push("\n      "),this.C("maintenance_login")&&this.C("maintenance_login_message")&&(e.push('\n        <div class="hero-unit alert alert--success js-maintenanceLogin">'),e.push(this.C("maintenance_login_message")),e.push("</div>\n      ")),e.push("\n\n      "),d=this.C("user_show_password_login")||_.isEmpty(this.auth_providers),e.push('\n\n      <div class="hero-unit">\n        <img class="company-logo" src="'),e.push(n(this.logoUrl)),e.push('" alt="'),e.push(n(this.C("product_name"))),e.push('">\n\n        '),this.item.showAdminPasswordLogin||d?(e.push('\n          <form id="login" class="js-form">\n            '),this.item.errorMessage&&(e.push('\n              <div class="alert alert--danger" role="alert">\n                '),e.push(n(this.item.errorMessage)),e.push("\n              </div>\n            ")),e.push('\n\n            <div class="form-group">\n              <div class="formGroup-label">\n                <label for="username">'),e.push(this.Ti("Username / email")),e.push('</label>\n              </div>\n              <input id="username" name="username" type="text" class="form-control" value="'),e.push(n(null!=(c=this.item.formPayload)?c.username:void 0)),e.push('" autocapitalize="off" />\n            </div>\n\n            <div class="form-group">\n              <div class="formGroup-label">\n                <label for="password">'),e.push(this.Ti("Password")),e.push('</label>\n              </div>\n              <input id="password" name="password" type="password" class="form-control" autocomplete="off"/>\n            </div>\n\n            <div class="form-group">\n              <label class="inline-label checkbox-replacement">\n                <input name="remember_me" value="1" type="checkbox">\n                '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n                <span class="label-text">'),e.push(this.T("Remember me")),e.push('</span>\n              </label>\n            </div>\n\n            <div class="form-controls">\n              <button class="btn btn--primary" type="submit">'),e.push(this.T("Sign in")),e.push("</button>\n\n              "),this.C("user_lost_password")&&(e.push('\n                <a href="#password_reset" class="btn btn--text btn--secondary align-center">'),e.push(this.T("Forgot password?")),e.push("</a>\n              ")),e.push("\n            </div>\n\n          </form>\n        ")):this.item.showAdminPasswordLoginFailed&&(e.push('\n          <form id="login">\n            <div class="alert alert--danger" role="alert">\n              '),e.push(this.T("The token for the admin password login is invalid.")),e.push("\n            </div>\n          </form>\n        ")),e.push("\n        "),!_.isEmpty(this.auth_providers)){for(e.push('\n          <div class="separator">\n            <span class="separator-text">\n              '),this.C("user_show_password_login")?(e.push("\n                "),e.push(this.T("or sign in using")),e.push("\n              ")):(e.push("\n                "),e.push(this.T("Sign in using")),e.push("\n              ")),e.push('\n            </span>\n          </div>\n\n          <div class="auth-providers">\n            '),i=0,r=(u=this.auth_providers).length;i<r;i++)t=u[i],e.push('\n              <form method="post" action="'),e.push(n(t.url)),e.push('">\n                <input type="hidden" name="authenticity_token" value="'),e.push(n(Spine.Ajax.defaults.headers["X-CSRF-Token"])),e.push('">\n                <button type="submit" class="auth-provider auth-provider--'),e.push(n(t.class)),e.push('">\n                  '),e.push(this.Icon(t.class+"-button","provider-icon")),e.push('\n                  <span class="provider-name">\n                    '),e.push(this.C(t.config+"_display_name")||this.T(t.name)),e.push("\n                  </span>\n                </button>\n              </form>\n            ");e.push("\n          </div>\n        ")}if(e.push('\n      </div>\n\n      <div class="js-footer">\n\n      '),d&&(e.push("\n        <p>\n          "),e.push(this.T("You're already registered with your email address if you've been in touch with our Support team.")),e.push("<br>\n          "),this.C("user_lost_password")&&(e.push("\n            "),e.push(this.T("You can request your password")),e.push(' <a href="#password_reset">'),e.push(this.T("here")),e.push("</a>.\n          ")),e.push("\n        </p>\n      ")),e.push("\n\n      "),d||(e.push("\n        <p>\n          "),e.push(this.T("If you have problems with the third-party login you can request a one-time password login as an admin.")),e.push('<br>\n          <a class="text-muted" href="#admin_password_auth">'),e.push(this.T("Request the password login here.")),e.push("</a>\n        </p>\n      ")),e.push("\n\n      "),h=this.C("user_create_account")&&d,e.push("\n      "),h||!_.isEmpty(this.public_links)){for(e.push("\n        <hr>\n        <p>\n          "),h&&(e.push('\n            <a href="#signup">'),e.push(this.T("Register as a new customer")),e.push("</a>\n          ")),e.push("\n          "),l=s=0,o=(p=this.public_links).length;s<o;l=++s)a=p[l],e.push("\n            "),(l>0||h)&&e.push(" | "),e.push('\n            <a href="'),e.push(n(a.link)),e.push('" title="'),a.description?e.push(n(a.description)):e.push(n(a.title)),e.push('"'),a.new_tab&&e.push(' target="_blank"'),e.push(">"),e.push(n(a.title)),e.push("</a>\n          ");e.push("\n        </p>\n      ")}e.push("\n      "),this.show_mobile_link&&(e.push('\n        <p>\n          <a href="#" class="align-center js-go-to-mobile">'),e.push(this.T("Continue to mobile")),e.push("</a>\n        </p>\n      ")),e.push('\n\n      </div>\n\n    </div>\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/maintenance"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Maintenance")),e.push('<small></small></h1>\n  </div>\n</div>\n<div class="page-content">\n\n  <div class="settings-entry">\n    <div class="page-header-title">\n      <div class="zammad-switch zammad-switch--small js-modeSetting">\n         <input name="chat" type="checkbox" id="setting-mode" '),this.C("maintenance_mode")&&e.push("checked"),e.push('>\n         <label for="setting-mode"></label>\n      </div>\n      <h2>'),e.push(this.T("Mode")),e.push("</h2>\n    </div>\n    <p>\u26a0 "),e.push(this.T("Enable or disable the maintenance mode of Zammad. If enabled, _all non-administrators get logged out_ and _only administrators can start a new session_.")),e.push('</p>\n  </div>\n\n  <div class="settings-entry">\n    <div class="page-header-title">\n      <div class="zammad-switch zammad-switch--small js-loginSetting">\n         <input name="chat" type="checkbox" id="setting-login" '),this.C("maintenance_login")&&e.push("checked"),e.push('>\n         <label for="setting-login"></label>\n      </div>\n      <h2>@'),e.push(this.T("Login")),e.push("</h2>\n    </div>\n    <p>"),e.push(this.T("Put a message on the login page. To change it, click on the text area below and change it in-line.")),e.push('</p>\n    <div class="js-loginPreview"></div>\n  </div>\n\n  <div class="settings-entry">\n    <h2>'),e.push(this.T("Message")),e.push("</h2>\n    <p>"),e.push(this.T("Send a message to all logged in users.")),e.push('</p>\n    <form class="js-Message">\n      <div class="form-group">\n        <label for="maintenance-title">'),e.push(this.T("Title")),e.push('</label>\n        <div class="controls">\n          <input type="text" id="maintenance-title" name="head" class="form-control" required>\n        </div>\n      </div>\n      <div class="form-group">\n        <label for="maintenance-message">'),e.push(this.T("Message")),e.push('</label>\n        <div class="controls">\n          <div contenteditable="true" id="maintenance-message" data-name="message" class="form-control form-control--multiline js-textarea richtext-content" dir="auto"></div>\n        </div>\n      </div>\n      <div class="form-group">\n        <label class="inline-label checkbox-replacement">\n          <input name="reload" type="checkbox" value="1">\n          '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n          <span class="label-text">'),e.push(this.T("Reload application")),e.push('</span>\n        </label>\n      </div>\n      <button class="btn btn--primary js-submit">'),e.push(this.T("Send to clients")),e.push("</button>\n    </form>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/microsoft365/admin_consent"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>\n  "),e.push(this.T("The admin consent request was sent to your administrator.")),e.push("<br>\n  "),e.push(this.T("Please wait until you received the notification email of the approval.")),e.push("<br><br>\n  "),e.push(this.T("After approval, please re-connect your Microsoft365 mailbox.")),e.push("<br>\n</p>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/microsoft365/app_config"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i;e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<p>\n  '),e.push(this.T("You can find a tutorial on how to manage a %s in our online documentation %l.","Microsoft 365 App","https://admin-docs.zammad.org/en/latest/channels/microsoft365/index.html")),e.push("\n</p>\n<fieldset>\n  <h2>"),e.push(this.T("Enter your %s App Keys","Microsoft 365")),e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="client_id">'),e.push(this.T("Client ID")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="client_id" type="text" name="client_id" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.client_id)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="client_secret">'),e.push(this.T("Client Secret")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="client_secret" type="text" name="client_secret" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.client_secret)),
e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="client_tenant">'),e.push(this.T("Tenant UUID/Name")),e.push('</label>\n    </div>\n    <div class="controls">\n      <input id="client_tenant" type="text" name="client_tenant" value="'),e.push(n(null!=(t=this.external_credential)&&null!=(i=t.credentials)?i.client_tenant:void 0)),e.push('" class="form-control" required autocomplete="off" placeholder="common">\n    </div>\n  </div>\n  <h2>'),e.push(this.T("Your callback URL")),e.push('</h2>\n  <div class="input form-group">\n    <div class="controls">\n      <input class="form-control js-select" readonly value="'),e.push(n(this.callbackUrl)),e.push('">\n    </div>\n  </div>\n</fieldset>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/microsoft365/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Microsoft 365")),e.push(" <small>"),e.push(this.T("Accounts")),e.push('</small></h1>\n  </div>\n</div>\n\n<div class="page-content">\n  <div class="page-description">\n    <p>'),e.push(this.T("You can connect %s with Zammad. But first, you will have to connect your Zammad with %s.","Microsoft 365 Accounts","Microsoft 365")),e.push('</p>\n    <div class="btn btn--success js-configApp">'),e.push(this.T("Connect Microsoft 365 App")),e.push("</div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/microsoft365/list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Microsoft 365")),e.push(" <small>"),e.push(this.T("Accounts")),e.push('</small></h1>\n  </div>\n\n  <div class="page-header-meta">\n    <a class="btn js-configApp">'),e.push(this.T("Configure App")),e.push('</a>\n    <a class="btn btn--success js-new">'),e.push(this.T("Add Account")),e.push('</a>\n    <a class="btn btn--success js-admin-consent">'),e.push(this.T("Request Admin Consent")),e.push("</a>\n  </div>\n</div>\n\n"),!_.isEmpty(this.not_used_email_addresses)){for(e.push('\n<div class="action">\n  <div class="action-flow">\n    <div class="action-block">\n      '),e.push(this.T("Notice:")),e.push(" "),e.push(this.T("Unassigned email addresses, assign them to a channel or delete them.")),e.push('</h3>\n      <ul class="list">\n      '),s=0,a=(u=this.not_used_email_addresses).length;s<a;s++)i=u[s],e.push('\n        <li class="list-item" data-id="'),e.push(n(i.id)),e.push('">\n          <div class="list-item-name">\n            <a href="#" class="js-emailAddressEdit">'),e.push(n(i.name)),e.push(" &lt;"),e.push(n(i.email)),e.push('&gt;</a>\n          </div>\n          <div class="list-item-delete js-emailAddressDelete">\n            '),e.push(this.Icon("diagonal-cross")),e.push("\n          </div>\n      ");e.push("\n      </ul>\n    </div>\n  </div>\n</div>\n")}for(e.push('\n\n<div class="page-content">\n'),_.isEmpty(this.channels)&&(e.push('\n  <table class="table table--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n")),e.push("\n"),r=0,l=(p=this.channels).length;r<l;r++){if(t=p[r],e.push('\n  <div class="action '),!0!==t.active&&e.push("is-inactive"),e.push('" data-id="'),e.push(n(t.id)),e.push('">\n    <div class="action-flow" style="width: 100%;">\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),e.push(this.Icon("status",t.status_in+" inline")),e.push(" "),e.push(this.T("Inbound")),e.push("</h3>\n          "),!1!==t.preferences.editable&&(e.push('\n            <div class="js-editInbound btn btn--text space-left">'),e.push(this.T("Edit")),e.push("</div>\n          ")),e.push("\n        </div>\n\n        "),_.isEmpty(t.last_log_in)||(e.push('\n        <div class="alert alert--danger">\n          '),e.push(n(t.last_log_in)),e.push("\n        </div>\n        ")),e.push("\n\n        <hr>\n\n        <h3>"),e.push(this.T("Destination Group")),e.push('</h3>\n        <a href="#" class="js-channelGroupChange '),!1===t.group.active&&e.push("alert alert--danger"),e.push('">\n          '),!1===t.group.active?(e.push("\n            "),e.push(this.T("%s is inactive, please select an active one.",this.P(t.group,"name"))),e.push("\n          ")):(e.push("\n            "),e.push(n(this.P(t.group,"name"))),e.push("\n          ")),e.push('\n        </a>\n      </div>\n\n      <div class="action-block action-block--flex">\n        <div class="horizontal">\n          <h3>'),e.push(this.Icon("status",t.status_out+" inline")),e.push(" "),e.push(this.T("Outbound")),e.push("</h3>\n        </div>\n\n        "),_.isEmpty(t.last_log_out)||(e.push('\n        <div class="alert alert--danger">\n          '),e.push(n(t.last_log_out)),e.push("\n        </div>\n        ")),e.push("\n\n        <hr>\n\n        <h3>"),e.push(this.T("Email Address")),e.push('</h3>\n        <ul class="list">\n        '),_.isEmpty(t.email_addresses))e.push('\n          <li class="list-item">'),e.push(this.T("none")),e.push("\n        ");else{for(e.push("\n          "),o=0,c=(h=t.email_addresses).length;o<c;o++)i=h[o],e.push('\n            <li class="list-item" data-id="'),e.push(n(i.id)),e.push('">\n              <div class="list-item-name">'),e.push(n(i.email)),e.push('</div>\n              <div class="btn btn--text js-emailAddressEdit space-left space-right">'),e.push(this.T("Edit")),e.push("</div>\n              "),t.email_addresses.length>1&&(e.push('\n              <div class="list-item-delete js-emailAddressDelete">\n                '),e.push(this.Icon("diagonal-cross")),e.push("\n              </div>\n              ")),e.push("\n          ");e.push("\n        ")}e.push('\n        </ul>\n        <a class="text-muted js-emailAddressNew" href="#">+ '),e.push(this.T("Add")),e.push('</a>\n      </div>\n    </div>\n\n    <div class="action-controls">\n      <div class="btn btn--danger btn--secondary js-delete">'),e.push(this.T("Delete")),e.push("</div>\n      "),t.options.backup_imap_classic&&(e.push('\n        <div class="btn btn--secondary js-rollbackMigration">'),e.push(this.T("Rollback migration")),e.push("</div>\n      ")),e.push("\n      "),!0===t.active?(e.push('\n        <div class="btn btn--secondary js-disable">'),e.push(this.T("Disable")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--secondary js-enable">'),e.push(this.T("Enable")),e.push("</div>\n      ")),e.push('\n      <div class="btn btn--secondary js-reauthenticate">'),e.push(this.T("Reauthenticate")),e.push("</div>\n    </div>\n  </div>\n")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/microsoft365/user_mismatch"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>\n  "),e.push(this.T("The entered user for reauthentication differs from the user that was used for setting up your Microsoft365 channel initially.")),e.push("<br><br>\n  "),e.push(this.T("To avoid fetching an incorrect Microsoft365 mailbox, the reauthentication process was aborted.")),e.push("<br><br>\n  "),e.push(this.T("Please start the reauthentication again and enter the correct credentials.")),e.push("\n</p>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/modal"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l;if(e.push('<div class="modal-dialog">\n  '),this.includeForm&&e.push('\n    <form autocomplete="off">\n  '),e.push('\n    <div class="modal-content">\n      <div class="modal-header'),this.head||e.push(n(" modal-header--empty")),e.push('">\n  '),this.buttonClose&&(e.push('\n        <div class="modal-close js-close">\n          '),e.push(this.Icon("diagonal-cross")),e.push("\n        </div>\n  ")),e.push("\n  "),this.head&&(e.push('\n        <h1 class="modal-title">'),this.headPrefix&&(e.push(this.T(this.headPrefix)),e.push(": ")),e.push(this.T(this.head)),e.push("</h1>\n  ")),e.push('\n      </div>\n      <div class="modal-alerts-container"></div>\n      <div class="modal-body">\n      '),e.push(this.content),e.push('\n      </div>\n      <div class="modal-loader js-loading hide">\n        <div class="loading icon"></div>\n      </div>\n      <div class="modal-footer">\n  '),this.buttonCancel||this.leftButtons){if(e.push('\n    <div class="modal-leftFooter align-left">\n      '),this.buttonCancel&&(e.push('\n        <a class="btn '),e.push(n(this.buttonCancelClass)),e.push(' js-cancel" href="#">'),e.push(this.T(this.buttonCancel)),e.push("</a>\n      ")),e.push("\n\n      "),this.leftButtons){for(e.push("\n        "),i=0,r=(a=this.leftButtons).length;i<r;i++)t=a[i],e.push('\n          <a class="btn btn--text btn--subtle '),e.push(n(t.className)),e.push('" href="#">'),e.push(this.T(t.text)),e.push("</a>\n        ");e.push("\n      ")}e.push("\n    </div>\n  ")}for(e.push("\n  "),s=0,o=(l=this.centerButtons).length;s<o;s++)t=l[s],e.push('\n        <div class="modal-centerFooter">\n          <div class="btn '),e.push(n(t.className)),e.push(' align-center">'),e.push(this.T(t.text)),e.push("</div>\n        </div>\n  ");e.push("\n  "),this.buttonSubmit&&(e.push('\n        <div class="modal-rightFooter">\n          <button type="submit" class="btn '),e.push(n(this.buttonClass)),e.push(' js-submit align-right">'),e.push(this.T(this.buttonSubmit)),e.push("</button>\n        </div>\n  ")),e.push("\n      </div>\n    </div>\n  "),this.includeForm&&e.push("\n    </form>\n  "),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/monitoring"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Monitoring")),e.push('<small></small></h1>\n  </div>\n</div>\n<div class="page-content">\n\n  <div class="settings-entry">\n    <div class="page-header-title">\n      <h2>'),e.push(this.T("Current Token")),e.push('</h2>\n    </div>\n    <p><input class="js-select js-token" type="text" value="'),e.push(n(this.data.token)),e.push('" readonly></p>\n    <button class="btn btn--primary js-resetToken">'),e.push(this.T("Reset")),e.push('</button>\n  </div>\n\n  <div class="settings-entry">\n    <div class="page-header-title">\n      <h2>'),e.push(this.T("Health Check")),e.push("</h2>\n    </div>\n    <p>"),e.push(this.T("Health information can be retrieved as JSON using:")),e.push('</p>\n    <input class="js-select js-url" type="text" value="'),e.push(this.C("http_type")),e.push("://"),e.push(this.C("fqdn")),e.push("/"),e.push(this.C("api_path")),e.push("/monitoring/health_check?token="),e.push(n(this.data.token)),e.push('" readonly></p>\n  </div>\n\n  <div class="settings-entry">\n    <div class="page-header-title">\n      <h2>'),_.isEmpty(this.data.issues)?e.push(this.Icon("status","ok inline")):e.push(this.Icon("status","error inline")),e.push(" "),e.push(this.T("Current Status")),e.push("</h2>\n    </div>\n    <ul>\n      "),_.isEmpty(this.data.issues))e.push("\n        <li>"),e.push(this.T("no issues")),e.push("\n      ");else{for(e.push("\n        "),t=0,s=(r=this.data.issues).length;t<s;t++)i=r[t],e.push("\n          <li>"),e.push(n(i)),e.push("\n        ");e.push("\n      ")}e.push("\n    </ul>\n    "),_.contains(this.data.actions,"restart_failed_jobs")&&(e.push('\n      <button class="btn btn--primary js-restartFailedJobs">'),e.push(this.T("Restart failed jobs")),e.push("</button>\n    ")),e.push("\n  </div>\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/navigation"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div id="navigation" class="navigation vertical">\n  <div class="search">\n    <form class="search-holder">\n      <input id="global-search" type="search" autocomplete="off">\n      '),e.push(this.Icon("magnifier")),e.push('\n      <div class="search-loader">'),e.push(this.Icon("spinner-small")),e.push('</div>\n      <div class="empty-search js-emptySearch">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n    </form>\n    <div class="logo js-toggleNotifications">\n      '),e.push(this.Icon("logo")),e.push('\n      <div class="activity-counter js-notificationsCounter"></div>\n    </div>\n    <div class="global-search-menu">\n      <a href="#search" class="global-search-detail-link nav-tab nav-tab--search js-details-link">\n        <div class="nav-tab-icon">\n          '),e.push(this.Icon("searchdetail")),e.push('\n        </div>\n        <div class="nav-tab-name flex u-textTruncate">\n          '),e.push(this.T("Show Search Details")),e.push("\n          "),e.push(this.Icon("long-arrow-right")),e.push('\n        </div>\n      </a>\n      <ul class="global-search-result js-global-search-result" role="menu"></ul>\n    </div>\n  </div>\n  <div class="menu js-menu"></div>\n  <div class="tasks tasks-navigation"></div>\n  '),_.isEmpty(this.user)||e.push('\n    <ul class="user-menu navbar-items-personal"></ul>\n  '),e.push('\n  <a class="menu-item menu-item-navigation-toggle-button js-navigation-toggle-button" href="#">\n    '),e.push(this.Icon("double-arrow-right")),e.push("\n    "),e.push(this.Icon("double-arrow-left")),e.push("\n  </a>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/navigation/menu"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l;for(t=0,r=(a=this.items).length;t<r;t++){if(i=a[t],e.push("\n  "),i.child){for(e.push('\n  <div class="dropdown'),this.openTab[i.target]&&e.push(" open"),e.push('">\n    <a href="'),e.push(n(i.target)),e.push('" class="menu-item js-'),e.push(i.class),e.push('MenuItem dropdown-toggle" data-toggle="dropdown">\n        '),e.push(this.Icon(i.class,"menu-item-icon")),e.push('\n        <span class="menu-item-name flex">\n          '),e.push(this.T(i.name)),e.push("\n        </span>\n        "),e.push(this.Icon("arrow-down","dropdown-icon")),e.push('\n    </a>\n    <ul class="dropdown-menu dropdown-menu--light">\n      '),s=0,o=(l=i.child).length;s<o;s++)i=l[s],e.push("\n        "),i.divider&&e.push('\n          <li class="divider"></li>\n        '),e.push("\n        "),i.navheader&&(e.push('\n          <li class="dropdown-header">'),e.push(this.T(i.navheader)),e.push("</li>\n        ")),e.push('\n        <li><a href="'),e.push(n(i.target)),e.push('">'),e.push(this.T(i.name)),void 0!==i.count&&(e.push('<span class="badge badge--text count">'),e.push(n(i.count)),e.push("</span>")),e.push("</a></li>\n      ");e.push("\n    </ul>\n  </div>\n  ")}else e.push('\n  <a class="menu-item js-'),e.push(i.class),e.push("MenuItem "),this.activeTab[i.target]&&e.push("is-active"),e.push(" "),i.onclick&&e.push("js-onclick"),e.push('" href="'),e.push(n(i.target)),e.push('" data-key="'),e.push(i.key),e.push('">\n    '),e.push(this.Icon(i.class,"menu-item-icon")),e.push('\n    <span class="menu-item-name">\n      '),e.push(this.T(i.name)),e.push("\n    </span>\n    "),void 0!==i.counter&&0!==i.counter&&(e.push('\n      <span class="counter badge badge--big">'),e.push(n(i.counter)),e.push("</span>\n    ")),e.push("\n    "),void 0!==i.switch&&(e.push('\n      <span class="zammad-switch zammad-switch--dark zammad-switch--small zammad-switch--green js-switch">\n         <input type="checkbox" id="'),e.push(i.class),e.push('-switch" '),i.switch&&e.push("checked"),e.push('>\n         <label for="'),e.push(i.class),e.push('-switch"></label>\n      </span>\n    ')),e.push("\n\n    "),i.accessoryIcon&&(e.push("\n      "),e.push(this.Icon(i.accessoryIcon,"accessory-icon")),e.push("\n    ")),e.push("\n  </a>\n  ");e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/navigation/menu_cti_ringing"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h;for(e.push('<div class="call-widgets">\n  '),s=0,a=(c=this.item).length;s<a;s++){if(r=c[s],e.push('\n    <div class="call-widget">\n      <div class="call-widget-header">\n        '),e.push(this.Icon("status","neutral")),e.push('\n        <div class="label">'),e.push(this.T("Inbound Call")),e.push('</div>\n        <!--\n        <div class="flex-spacer"></div>\n        <div class="btn btn--text js-remove" title="'),e.push(this.Ti("Remove")),e.push('">'),e.push(this.Icon("diagonal-cross")),e.push("</div>\n        -->\n      </div>\n      "),h=void 0,e.push("\n      "),p=!1,e.push("\n      "),r.preferences.from&&!_.isEmpty(r.preferences.from)){for(e.push("\n        "),o=0,l=(u=r.preferences.from).length;o<l;o++)t=u[o],e.push("\n          "),t.user_id&&App.User.exists(t.user_id)?(e.push("\n            "),h=App.User.fullLocal(t.user_id),e.push("\n            "),i=["user-popover","u-textTruncate"],e.push("\n            "),h.active||i.push("is-inactive"),e.push("\n            "),p&&e.push('<div class="spacer"></div>'),e.push('\n            <div class="user-card">\n              <a href="'),e.push(h.uiUrl()),e.push('">'),e.push(h.avatar()),e.push('</a>\n              <a href="'),e.push(h.uiUrl()),e.push('" class="inherit-color '),e.push(n(i.join(" "))),e.push('" data-id="'),e.push(h.id),e.push('">'),"known"!==t.level&&(e.push(this.T("maybe:")),e.push(" ")),e.push(n(h.displayNameLong())),e.push('</a>\n              <span class="text-muted">'),e.push(n(r.from_pretty)),e.push('</span>\n              <div class="btn btn--small btn--quad btn--create space-left js-newTicket" title="'),e.push(this.Ti("New Ticket")),e.push('" data-user-id="'),h&&e.push(h.id),e.push('">'),e.push(this.Icon("plus")),e.push("</div>\n            </div>\n            "),p=!0,e.push("\n          ")):_.isEmpty(t.comment)||(e.push("\n            "),p=!0,e.push('\n            <div class="user-card">\n              '),e.push(this.unique_avatar(t.comment,t.comment.split(" ").map((function(t){return t[0]})).join(""))),e.push("\n              "),e.push(this.T("maybe:")),e.push(" "),e.push(n(t.comment)),e.push('<br>\n              <span class="text-muted">'),e.push(n(r.from_pretty)),e.push('</span>\n              <div class="btn btn--small btn--quad btn--create space-left js-newTicket" title="'),e.push(this.Ti("New Ticket")),e.push('" data-user-id="'),h&&e.push(h.id),e.push('">'),e.push(this.Icon("plus")),e.push("</div>\n            </div>\n          ")),e.push("\n        ");e.push("\n      ")}e.push("\n      "),p||_.isEmpty(r.from_comment)||(e.push("\n        "),p=!0,e.push('\n        <div class="user-card">\n          '),e.push(this.unique_avatar(r.from_comment,r.from_comment.split(" ").map((function(t){return t[0]})).join(""))),e.push("\n          "),e.push(n(r.from_comment)),e.push('<br>\n          <span class="text-muted">'),e.push(n(r.from_pretty)),e.push('</span>\n          <div class="btn btn--small btn--quad btn--create space-left js-newTicket" title="'),e.push(this.Ti("New Ticket")),e.push('" data-user-id="'),h&&e.push(h.id),e.push('">'),e.push(this.Icon("plus")),e.push("</div>\n        </div>\n      ")),e.push("\n      "),p||(e.push('\n        <div class="user-card">\n          '),e.push(this.unique_avatar(r.from_pretty||r.from,"??")),e.push("\n        "),_.isEmpty(r.from_pretty)?(e.push('\n          <a class="inherit-color" href="'),e.push(App.Utils.phoneify(r.from)),e.push('">'),e.push(n(r.from)),e.push("</a>\n        ")):(e.push('\n          <a class="inherit-color" href="'),e.push(App.Utils.phoneify(r.from_pretty)),e.push('">'),e.push(n(r.from_pretty)),e.push("</a>\n          "),"in"===r.direction&&(e.push('\n          <div class="btn btn--text btn--create no-padding js-newUser" href="#" data-phone="'),e.push(n(r.from_pretty)),e.push('">'),e.push(this.Icon("plus-small")),e.push(" <span>"),e.push(this.T("New User")),e.push("</div>\n          ")),e.push("\n        ")),e.push('\n          <div class="btn btn--small btn--quad btn--create space-left js-newTicket" title="'),e.push(this.Ti("New Ticket")),e.push('" data-user-id="'),h&&e.push(h.id),e.push('">'),e.push(this.Icon("plus")),e.push("</div>\n        </div>\n      ")),e.push("\n    </div>\n  ")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/navigation/no_result"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<li class="global-search-detail-no-result alert alert--warning horizontal" role="alert">\n  '),e.push(this.Icon("mood-sad")),e.push("\n  <span>"),e.push(this.T("There is no match for your search.")),e.push("</span>\n</li>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/navigation/personal"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(t=0,o=(l=this.items).length;t<o;t++){if(s=l[t],e.push("\n  "),_.isEmpty(s.child))e.push('\n    <li class="settings'),e.push(n(s.class?" "+s.class:void 0)),e.push('">\n      <a class="list-button fit horizontal centered" href="'),e.push(n(s.target)),e.push('" title="'),e.push(this.Ti(s.name)),e.push('">\n        '),e.push(this.Icon(s.icon,"user-menu-icon")),e.push("\n      </a>\n    </li>\n  ");else{for(e.push('\n    <li class="'),s.class&&e.push(s.class),e.push(" dropup "),this.openTab[s.target]&&e.push("open"),e.push('">\n      <a class="list-button dropdown-toggle js-action" data-toggle="dropdown" href="'),e.push(n(s.target)),e.push('" title="'),s.translate?e.push(this.Ti(s.name)):e.push(n(s.name)),e.push('">\n        <span class="dropdown-nose"></span>\n        '),"user"===s.class?e.push('\n          <span class="js-avatar"></span>\n        '):(e.push("\n          "),e.push(this.Icon(s.icon,"user-menu-icon")),e.push("\n        ")),e.push('\n      </a>\n      <ul class="dropdown-menu dropdown-menu--light" role="menu">\n        '),i=r=0,a=(c=s.child).length;r<a;i=++r)s=c[i],e.push("\n          "),s.divider&&i>0&&e.push('\n            <li class="divider"></li>\n          '),e.push("\n          "),s.navheader&&(e.push('\n            <li class="dropdown-header">'),e.push(this.T(s.navheader)),e.push("</li>\n          ")),e.push("\n          <li"),s.toggle&&e.push(' class="dropdown-menu-item dropdown-menu-item--toggle"'),e.push(">\n            "),s.target?(e.push('\n            <a href="'),e.push(n(s.target)),e.push('" data-key="'),e.push(s.key),e.push('" class="horizontal center '),s.onclick&&e.push("js-onclick"),e.push('">\n            ')):e.push('\n            <div class="horizontal center">\n            '),e.push('\n              <span class="flex u-textTruncate">'),s.translate?e.push(this.T(s.name)):e.push(n(s.name)),e.push("</span>\n              "),void 0!==s.count&&(e.push('<span class="badge badge--text count">'),e.push(n(s.count)),e.push("</span>")),e.push("\n              "),s.iconClass&&e.push(this.Icon(s.iconClass)),e.push("\n              "),s.toggle&&(e.push('\n                <span class="zammad-switch zammad-switch--tiny">\n                   <input type="checkbox" id="'),e.push(s.toggle),e.push('-switch" '),s.checked&&s.checked()&&e.push("checked"),e.push('>\n                   <label for="'),e.push(s.toggle),e.push('-switch"></label>\n                </span>\n              ')),e.push("\n            "),s.target?e.push("\n            </a>\n            "):e.push("\n            </div>\n            "),e.push("\n          </li>\n        ");e.push("\n      </ul>\n    </li>\n  ")}e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/navigation/result"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l;for(t in l=this.result){for(o=l[t],e.push("\n  "),i&&o.length>0&&e.push(' <li class="divider"></li> '),e.push("\n  "),i=!0,e.push("\n  "),s=0,a=o.length;s<a;s++)r=o[s],e.push('\n    <li>\n      <a href="'),e.push(r.url),e.push('" class="nav-tab nav-tab--search '),e.push(n(r.class)),e.push('" data-id="'),e.push(n(r.id)),e.push('" data-popover-show-avatar="true">\n        <div class="nav-tab-icon">\n          '),e.push(this.Icon(r.icon,r.iconClass)),e.push('\n        </div>\n        <span class="nav-tab-name flex u-textTruncate">'),e.push(n(r.display)),e.push("</span>\n      </a>\n    </li>\n  ");e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/notify"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="noty_message">\n  '),"error"===this.type&&(e.push("\n    "),e.push(this.Icon("diagonal-cross","icon-error")),e.push("\n  ")),e.push("\n  "),"success"===this.type&&(e.push("\n    "),e.push(this.Icon("checkmark")),e.push("\n  ")),e.push('\n  <span class="noty_text"></span>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this);(function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="js-data">\n  <div class="js-dataType"></div>\n  <div class="js-dataMap" style="padding: 30px 0 0 30px;"></div>\n  <div class="" style="padding-bottom: 10px">'),e.push(this.T("Here you define which authorization has access to the attribute.")),e.push('</div>\n  <div class="js-dataScreens"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}).call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/autocompletion"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\nAuto-Vervollst\xe4ndigung\n  <div class="js-autocompletionDefault"></div>\n  <div class="js-autocompletionUrl"></div>\n  <div class="js-autocompletionMethod"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/autocompletion_ajax_external_data_source"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="js-dataOption">\n  <div class="alert alert--warning js-sslVerifyAlert hide" role="alert">\n    '),e.push(n(this.T("Turning off SSL verification is a security risk and should be used only temporary. Use this option at your own risk!"))),e.push('\n  </div>\n  <div class="js-inputSearchURL"></div>\n  <div class="js-inputSSLVerify"></div>\n  <div class="js-inputHTTPAuthType"></div>\n  <div class="form-group form-group--nested">\n    <div class="js-inputHTTPBasicAuthUsername"></div>\n    <div class="js-inputHTTPBasicAuthPassword"></div>\n    <div class="js-inputBearerTokenAuth"></div>\n  </div>\n  <div class="js-inputSearchResultListKey"></div>\n  <div class="js-inputSearchResultValueKey"></div>\n  <div class="js-inputSearchResultLabelKey"></div>\n  <div class="js-inputLinkTemplate"></div>\n</div>\n<div class="preview form-group form-group--wide">\n  <div class="js-inputSearchTerm"></div>\n  <div class="alert alert--info js-previewInfo js-alert" role="alert">\n    '),e.push(this.T("To trigger the preview, please enter some search term(s) above.")),e.push('\n  </div>\n  <div class="alert alert--danger js-previewError js-alert hide" role="alert"></div>\n  <div class="js-loading centered hide">\n    <div class="loading icon small"></div>\n  </div>\n  <div class="js-searchResultSample"></div>\n  <div class="form-group form-group--nested">\n    <div class="js-searchResultResponse"></div>\n    <div class="js-searchResultList"></div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/boolean"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape
;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="form-group">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th>'),e.push(this.T("Key")),e.push("\n          <th>"),e.push(this.T("Display")),e.push('\n          <th style="width: 30px">'),e.push(this.T("Default")),e.push('\n      </thead>\n      <tbody>\n        <tr>\n          <td class="settings-list-control-cell">\n            true\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-valueTrue" type="text" value="'),this.params.data_option&&this.params.data_option.options&&e.push(n(this.params.data_option.options[!0])),e.push('" name="data_option::options::true" placeholder="'),e.push(this.T("yes")),e.push('" required/>\n          <td class="settings-list-row-control">\n            <input class="js-selected js-boolean" type="radio" name="data_option::default" value="true" '),this.params.data_option&&!0===this.params.data_option.default&&e.push("checked"),e.push('/>\n        <tr>\n          <td class="settings-list-control-cell">\n            false\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-valueFalse" type="text" value="'),this.params.data_option&&this.params.data_option.options&&e.push(n(this.params.data_option.options[!1])),e.push('" name="data_option::options::false" placeholder="'),e.push(this.T("no")),e.push('" required/>\n          <td class="settings-list-row-control">\n            <input class="js-selected js-boolean" type="radio" name="data_option::default" value="false" '),this.params.data_option&&!1===this.params.data_option.default&&e.push("checked"),e.push('/>\n      </tbody>\n   </table>\n  </div>\n  <div class="js-inputTranslate"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/date"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="js-dateFuture"></div>\n  <div class="js-datePast"></div>\n  <div class="js-dateDiff"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/datetime"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="js-datetimeFuture"></div>\n  <div class="js-datetimePast"></div>\n  <div class="js-datetimeDiff"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/input"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="js-inputDefault"></div>\n  <div class="js-inputType"></div>\n  <div class="js-inputMaxlength"></div>\n  <div class="js-inputLinkTemplate"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/integer"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="js-integerDefault"></div>\n  <div class="js-integerMin"></div>\n  <div class="js-integerMax"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/multi_tree_select"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="form-group">\n    <table class="settings-list js-Table" style="width: 100%;">\n      <thead>\n        <tr>\n          <th style="width: 36px" class="table-draggable"></th>\n          <th>'),e.push(this.T("Key")),e.push('\n          <th style="width: 180px">'),e.push(this.T("Action")),e.push('\n        </tr>\n      </thead>\n      <tbody class="js-treeTable table-sortable"></tbody>\n    </table>\n    <table class="hidden">\n      <tbody>\n        <tr class="js-template input-data-row">\n          <td class="table-draggable">'),e.push(this.Icon("draggable")),e.push('</td>\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-key" type="text" value="" data-level="" required/>\n          <td class="settings-list-row-control">\n            <div class="btn btn--text js-remove" style="margin-left: -10px;">\n              '),e.push(this.Icon("trash")),e.push('\n            </div>\n            <div class="btn btn--text btn--create js-addChild" style="margin-left: -10px;">\n              '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("children")),e.push('\n            </div>\n            <div class="btn btn--text btn--create js-addRow" style="margin-left: -10px;">\n              '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("row")),e.push('\n            </div>\n        </tr>\n      </tbody>\n    </table>\n  </div>\n  <div class="js-inputTranslate"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/multiselect"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a;if(e.push('<div>\n  <div class="form-group">\n    <table class="settings-list js-Table" style="width: 100%;">\n      <thead>\n        <tr>\n          <th style="width: 36px" class="table-draggable"></th>\n          <th>'),e.push(this.T("Key")),e.push("\n          <th>"),e.push(this.T("Display")),e.push('\n          <th style="width: 30px">'),e.push(this.T("Default")),e.push('\n          <th style="width: 30px">'),e.push(this.T("Action")),e.push('\n      </thead>\n      <tbody class="table-sortable">\n        '),this.params.data_option&&this.params.data_option.mapped){for(e.push("\n          "),i=0,r=(o=this.params.data_option.mapped).length;i<r;i++)s=(a=o[i])[0],t=a[1],e.push('\n            <tr class="input-data-row">\n              <td class="table-draggable">'),e.push(this.Icon("draggable")),e.push('</td>\n              <td class="settings-list-control-cell">\n                <input class="form-control form-control--small js-key" type="text" value="'),e.push(n(s)),e.push('" required/>\n              </td>\n              <td class="settings-list-control-cell">\n                <input class="form-control form-control--small js-value" type="text" value="'),e.push(n(t)),e.push('" name="data_option::options::'),e.push(n(s)),e.push('" required/>\n              </td>\n              <td class="settings-list-row-control">\n                <input class="js-selected" type="checkbox" name="data_option::default" value="'),e.push(n(s)),e.push('" '),_.include(this.params.data_option.default,s)&&e.push("checked"),e.push('/>\n              </td>\n              <td class="settings-list-row-control">\n                <div class="btn btn--text js-remove">\n                  '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n                </div>\n              </td>\n          ");e.push("\n        ")}e.push('\n        <tr class="input-add-row">\n          <td class="settings-list-control-cell">\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-key" type="text" placeholder="'),e.push(this.T("Key")),e.push('"/>\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-value" type="text" placeholder="'),e.push(this.T("Display")),e.push('"/>\n          <td class="settings-list-row-control">\n            <input class="js-selected" type="checkbox"/>\n          <td class="settings-list-row-control">\n            <div class="btn btn--text btn--create js-add">\n              '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push('\n            </div>\n      </tbody>\n    </table>\n    <table class="hidden">\n      <tbody>\n        <tr class="js-template input-data-row">\n          <td class="table-draggable">'),e.push(this.Icon("draggable")),e.push('</td>\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-key" type="text" value="" required/>\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-value" type="text" value="" required/>\n          <td class="settings-list-row-control">\n            <input class="js-selected" type="checkbox" name="data_option::default"/>\n          <td class="settings-list-row-control">\n            <div class="btn btn--text js-remove">\n              '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push('\n            </div>\n    </table>\n  </div>\n  <div class="form-group">\n    <div class="checkbox checkbox--list">\n      <label class="checkbox-replacement">\n        <input type="checkbox" name="data_option::customsort" '),this.params.data_option&&this.params.data_option.customsort&&e.push("checked"),e.push("/>\n        "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n        "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        <span class="label-text">'),e.push(this.T("Use custom option sort")),e.push('</span>\n        <span class="help-text">'),e.push(this.T("Check this box if you want to customise how options are sorted. If the box is not checked, values are sorted in alphabetical order.")),e.push('</span>\n      </label>\n    </div>\n  </div>\n  <div class="js-inputLinkTemplate"></div>\n  <div class="js-inputTranslate"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/select"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a;if(e.push('<div>\n  <div class="form-group">\n    <table class="settings-list js-Table" style="width: 100%;">\n      <thead>\n        <tr>\n          <th style="width: 36px" class="table-draggable"></th>\n          <th>'),e.push(this.T("Key")),e.push("\n          <th>"),e.push(this.T("Display")),e.push('\n          <th style="width: 30px">'),e.push(this.T("Default")),e.push('\n          <th style="width: 30px">'),e.push(this.T("Action")),e.push('\n      </thead>\n      <tbody class="table-sortable">\n        '),this.params.data_option&&this.params.data_option.mapped){for(e.push("\n          "),i=0,r=(o=this.params.data_option.mapped).length;i<r;i++)s=(a=o[i])[0],t=a[1],e.push('\n          <tr class="input-data-row">\n            <td class="table-draggable">'),e.push(this.Icon("draggable")),e.push('</td>\n            <td class="settings-list-control-cell">\n              <input class="form-control form-control--small js-key" type="text" value="'),e.push(n(s)),e.push('" required/>\n            <td class="settings-list-control-cell">\n              <input class="form-control form-control--small js-value" type="text" value="'),e.push(n(t)),e.push('" name="data_option::options::'),e.push(n(s)),e.push('" required/>\n            <td class="settings-list-row-control">\n              <input class="js-selected" type="radio" name="data_option::default" value="'),e.push(n(s)),e.push('" '),this.params.data_option.default===s&&e.push("checked"),e.push('/>\n            <td class="settings-list-row-control">\n              <div class="btn btn--text js-remove">\n                '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n              </div>\n          ");e.push("\n        ")}e.push('\n        <tr class="input-add-row">\n          <td class="settings-list-control-cell">\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-key" type="text" placeholder="'),e.push(this.T("Key")),e.push('"/>\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-value" type="text" placeholder="'),e.push(this.T("Display")),e.push('"/>\n          <td class="settings-list-row-control">\n            <input class="js-selected" type="radio"/>\n          <td class="settings-list-row-control">\n            <div class="btn btn--text btn--create js-add">\n              '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("Add")),e.push('\n            </div>\n      </tbody>\n    </table>\n    <table class="hidden">\n      <tbody>\n        <tr class="js-template input-data-row">\n          <td class="table-draggable">'),e.push(this.Icon("draggable")),e.push('</td>\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-key" type="text" value="" required/>\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-value" type="text" value="" required/>\n          <td class="settings-list-row-control">\n            <input class="js-selected" type="radio" name="data_option::default"/>\n          <td class="settings-list-row-control">\n            <div class="btn btn--text js-remove">\n              '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push('\n            </div>\n    </table>\n  </div>\n  <div class="form-group">\n    <div class="checkbox checkbox--list">\n      <label class="checkbox-replacement">\n        <input type="checkbox" name="data_option::customsort" '),this.params.data_option&&this.params.data_option.customsort&&e.push("checked"),e.push("/>\n        "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n        "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        <span class="label-text">'),e.push(this.T("Use custom option sort")),e.push('</span>\n        <span class="help-text">'),e.push(this.T("Check this box if you want to customise how options are sorted. If the box is not checked, values are sorted in alphabetical order.")),e.push('</span>\n      </label>\n    </div>\n  </div>\n  <div class="js-inputLinkTemplate"></div>\n  <div class="js-inputTranslate"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/textarea"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="js-inputDefault"></div>\n  <div class="js-inputMaxlength"></div>\n  <div class="js-inputRows"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/attribute/tree_select"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="form-group">\n    <table class="settings-list js-Table" style="width: 100%;">\n      <thead>\n        <tr>\n          <th style="width: 36px" class="table-draggable"></th>\n          <th>'),e.push(this.T("Key")),e.push('\n          <th style="width: 180px">'),e.push(this.T("Action")),e.push('\n        </tr>\n      </thead>\n      <tbody class="js-treeTable table-sortable"></tbody>\n    </table>\n    <table class="hidden">\n      <tbody>\n        <tr class="js-template input-data-row">\n          <td class="table-draggable">'),e.push(this.Icon("draggable")),e.push('</td>\n          <td class="settings-list-control-cell">\n            <input class="form-control form-control--small js-key" type="text" value="" data-level="" required/>\n          <td class="settings-list-row-control">\n            <div class="btn btn--text js-remove" style="margin-left: -10px;">\n              '),e.push(this.Icon("trash")),e.push('\n            </div>\n            <div class="btn btn--text btn--create js-addChild" style="margin-left: -10px;">\n              '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("children")),e.push('\n            </div>\n            <div class="btn btn--text btn--create js-addRow" style="margin-left: -10px;">\n              '),e.push(this.Icon("plus-small")),e.push(" "),e.push(this.T("row")),e.push('\n            </div>\n        </tr>\n      </tbody>\n    </table>\n  </div>\n  <div class="js-inputTranslate"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T(this.head)),e.push(" <small>"),e.push(this.T("Object Manager")),e.push('</small></h1>\n  </div>\n  <div class="page-header-meta">\n  <!--\n    <a class="btn js-restore">'),e.push(this.T("Restore Defaults")),e.push('</a>\n  -->\n    <a class="btn btn--success js-new">'),e.push(this.T("New Attribute")),e.push('</a>\n  </div>\n</div>\n<div class="page-content">\n  '),!_.isEmpty(this.itemsToChange)){for(e.push('\n  <div class="box box--message">\n    <h2>'),e.push(this.T("Database Update Required")),e.push("</h2>\n    <p>\n      "),e.push(this.T("Changes were made that require a database update.")),e.push("\n      "),e.push(this.T("This might take some time during which the system can't be used.")),e.push("\n      "),e.push(this.T("Please execute database changes only in a maintenance window.")),e.push("\n    </p>\n    <p>\n      "),e.push(this.T("Changes")),e.push(":\n      <ul>\n      "),t=0,r=(a=this.itemsToChange).length;t<r;t++)i=a[t],e.push("\n        <li>\n          "),!0===i.to_create?(e.push("\n            "),e.push(this.T("Create:")),e.push(" "),e.push(n(i.object)),e.push("."),e.push(n(i.name)),e.push(" ("),e.push(n(i.data_type)),e.push(")\n          ")):!0===i.to_delete?(e.push("\n            "),e.push(this.T("Delete:")),e.push(" "),e.push(n(i.object)),e.push("."),e.push(n(i.name)),e.push(" ("),e.push(n(i.data_type)),e.push(")\n          ")):(i.to_migrate||!0===i.to_config)&&(e.push("\n            "),e.push(this.T("Changed:")),e.push(" "),e.push(n(i.object)),e.push("."),e.push(n(i.name)),e.push(" ("),e.push(n(i.data_type)),e.push(")\n          ")),e.push("\n      ");e.push('\n      </ul>\n    </p>\n    <div class="box-controls">\n      <div class="btn btn--text btn--secondary js-discard">'),e.push(this.T("Discard Changes")),e.push('</div>\n      <div class="btn btn--primary js-execute align-right">'),e.push(this.T("Update Database")),e.push("</div>\n    </div>\n  </div>\n  ")}for(e.push('\n<!--\n  <div class="box box--message">\n    <div class="box-progress">\n      <div class="box-progress-title">'),e.push(this.T("Updating Database")),e.push('</div>\n      <div class="box-progress-body">\n        <progress max="100" value="50"></progress>\n      </div>\n    </div>\n  </div>\n-->\n  <table class="table table-striped table-hover is-disabled">\n    <thead>\n      <tr>\n        <th class="">'),e.push(this.T("Display")),e.push('</th>\n        <th class="">'),e.push(this.T("Name")),e.push('</th>\n        <th class="" style="width: 200px;">'),e.push(this.T("Type")),e.push("</th>\n        <th>"),e.push(this.T("Position")),e.push('</th>\n        <th class="" style="width: 140px;">'),e.push(this.T("Action")),e.push("</th>\n      </tr>\n    </thead>\n    <tbody>\n      "),s=0,o=(l=this.items).length;s<o;s++)i=l[s],e.push('\n      <tr class="'),!1===i.editable?e.push("is-grayed-out u-notAllowed"):(!1===i.active&&e.push("is-inactive"),e.push(" js-edit u-clickable")),e.push('" data-id="'),e.push(i.id),e.push('">\n        <td>'),e.push(n(i.display)),e.push("</td>\n        <td>"),e.push(n(i.name)),e.push("</td>\n        <td>"),e.push(n(i.data_type)),e.push("</td>\n        <td>"),e.push(n(i.position)),e.push("</td>\n        <td>\n          "),!0===i.to_create?(e.push("\n            "),e.push(this.T("will be created")),e.push("\n          ")):!0===i.to_delete?(e.push("\n            "),e.push(this.T("will be deleted")),e.push("\n          ")):!0===i.to_migrate||!0===i.to_config?(e.push("\n            "),e.push(this.T("has changed")),e.push("\n          ")):i.editable&&(e.push("\n            "),i.deletable?(e.push('\n              <a href="#" class="js-delete" title="'),e.push(this.Ti("Delete")),e.push('">'),e.push(this.Icon("trash")),e.push("</a>\n            ")):(e.push('\n              <span class="is-disabled" title="'),e.push(n(i.not_deletable_reason)),e.push('">'),e.push(this.Icon("trash")),e.push("</span>\n            ")),e.push("\n          ")),e.push("\n        </td>\n      </tr>\n      ");e.push("\n    </tbody>\n  </table>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/object_manager/screens"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a;for(r in e.push('<div>\n  <table class="settings-list" style="width: 100%;">\n    <thead>\n      <tr>\n        <th>'),e.push(this.T("Permissions")),e.push("\n        <th>"),e.push(this.T("Screen")),e.push('\n        <th style="width: 50%;">'),e.push(this.T("Options")),e.push("\n    </thead>\n    <tbody>\n      "),s=this.data){for(o in a=s[r],e.push('\n        <tr>\n          <td class="settings-list-control-cell">\n            '),e.push(n(r)),e.push('\n          <td class="settings-list-control-cell">\n          <td class="settings-list-row-control">\n        '),a){for(t in i=a[o],e.push('\n        <tr>\n          <td class="settings-list-control-cell">\n          <td class="settings-list-control-cell">\n            '),e.push(n(o)),e.push('\n          <td class="settings-list-row-control">\n            '),i)i[t],e.push("\n              "),e.push(this.T(t)),e.push(': <input class="js-boolean" name="screens::'),e.push(n(o)),e.push("::"),e.push(n(r)),e.push("::"),e.push(n(t)),e.push('" type="checkbox" '),this.params&&this.params.screens&&this.params.screens[o]&&this.params.screens[o][r]&&!0===this.params.screens[o][r][t]&&e.push("checked"),e.push(' value="true">\n            ');e.push("\n        ")}e.push('\n        <tr>\n          <td class="settings-list-control-cell">\n          <td class="settings-list-control-cell small" colspan=2>\n            '),e.push(this.T("Not applicable to: merging, emails, form, Facebook, Telegram, Twitter, SMS")),e.push("\n      ")}e.push("\n    </tbody>\n  </table>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/organization_profile/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="profile">\n  <div class="profile-window">\n    <div class="profile-section vertical centered">\n      <div class="align-right profile-action js-action"></div>\n      <div class="js-organization-avatar"></div>\n      <h1 class="js-name"></h1>\n    </div>\n    <div class="js-object-container"></div>\n    <div class="profile-section js-ticket-stats"></div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/organization_profile/member"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="userList-entry">\n  '),e.push(this.user.avatar("40")),e.push('\n  <a href="'),e.push(this.user.uiUrl()),e.push('" class="userList-name user-popover" data-id="'),e.push(this.user.id),e.push('">'),e.push(n(this.user.displayName())),e.push("</a>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/organization_profile/object"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="profile-section">\n  <div class="profile-details horizontal wrap">\n    '),t=0,i=(s=this.organizationData).length;t<i;t++)r=s[t],e.push("\n      "),"richtext"===r.tag?(e.push('\n        <div class="profile-detailsEntry" style="width: 100%;">\n          <label>'),e.push(this.T(r.display)),e.push('</label>\n          <div contenteditable="true" data-name="'),e.push(n(r.name)),e.push('" data-type="update" data-placeholder="'),e.push(this.Ti("Add a Note")),e.push('">'),e.push(this.organization[r.name]),e.push("</div>\n        </div>\n      ")):(e.push('\n        <div class="profile-detailsEntry">\n          <label>'),e.push(this.T(r.display)),e.push("</label>\n          "),e.push(this.P(this.organization,r.name)),e.push("\n        </div>\n      ")),e.push("\n    ");e.push("\n  </div>\n</div>\n"),this.organization.member_ids&&(e.push('\n<div class="profile-section profile-memberSection">\n  <label>'),e.push(this.T("Members")),e.push('</label>\n  <div class="userList js-userList"></div>\n  <p class="hidden">\n    <a href="#" class="js-showMoreMembers">'),e.push(this.T("show more")),e.push("</a>\n  <p>\n</div>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/package"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(e.push('<div class="page-header-title">\n  <h1>'),e.push(this.T("Package")),e.push(" <small>"),e.push(this.T("Management")),e.push('</small></h1>\n</div>\n\n<div class="page-content">\n  <p>\n    '),e.push(this.T("The installation of packages comes with security implications, because arbitrary code will be executed in the context of the Zammad application.")),e.push("\n    <br>\n    "),e.push(this.T("Only packages from known, trusted, and verified sources should be installed.")),e.push("\n  </p>\n  <p>\n    "),e.push(this.T("After installing, updating, or uninstalling packages the following commands need to be executed on the server:")),e.push("\n    <ul>\n    "),this.package_installation?(e.push("\n      "),this.local_gemfiles&&e.push("\n      <li><code>root> zammad config:set BUNDLE_DEPLOYMENT=0</code></li>\n      <li><code>root> zammad run bundle config set --local deployment 'false'</code></li>\n      <li><code>root> zammad run bundle install</code></li>\n      "),e.push("\n      <li><code>root> zammad run rake zammad:package:migrate</code></strong></li>\n      <li><code>root> zammad run rake assets:precompile</code></strong></li>\n    ")):(e.push("\n      "),this.local_gemfiles&&e.push("\n      <li><code>zammad> bundle install</code></li>\n      "),e.push("\n      <li><code>zammad> rake zammad:package:migrate</code></strong></li>\n      <li><code>zammad> rake assets:precompile</code></strong></li>\n    ")),e.push('\n      <li><code>root> systemctl restart zammad</code></li>\n    </ul>\n  </p>\n  <!--\n  <ul class="nav nav-tabs nav-stacked">\n    <li class=""><a data-type="" >'),e.push(this.T("Installed")),e.push('</a></li>\n    <li class=""><a data-type="" >'),e.push(this.T("Store")),e.push('</a></li>\n  </ul>\n  -->\n  <p>\n    <form action="'),e.push(n(App.Config.get("api_path"))),e.push('/packages" method="post" enctype="multipart/form-data" class="horizontal center">\n      <input type="hidden" name="authenticity_token" value="'),e.push(n(App.Ajax.token())),e.push('"/>\n      <input type="file" name="file_upload" class="js-fileUpload" />\n      <button class="align-right btn btn--primary js-submit" type="submit" disabled="disabled">'),e.push(this.T("Install Package")),e.push('</button>\n    </form>\n  </p>\n\n  <table class="table table-striped table-hover">\n    <thead>\n      <tr>\n        <th>'),e.push(this.T("Name")),e.push("</th>\n        <th>"),e.push(this.T("Version")),e.push("</th>\n        <th>"),e.push(this.T("Vendor")),e.push("</th>\n        <th>"),e.push(this.T("State")),e.push("</th>\n        <th>"),e.push(this.T("Action")),e.push("</th>\n      </tr>\n    </thead>\n    <tbody>\n    "),i=0,o=(l=this.packages).length;i<o;i++){for(s=l[i],e.push('\n      <tr data-id="'),e.push(n(s.id)),e.push('">\n        <td>'),e.push(n(s.name)),e.push("</td>\n        <td>"),e.push(n(s.version)),e.push("</td>\n        <td>"),s.url&&(e.push('<a href="'),e.push(n(s.url)),e.push('" target="_blank">')),e.push(n(s.vendor)),s.url&&e.push("</a>"),e.push("</td>\n        <td>"),e.push(this.T(s.state)),e.push("</td>\n        <td>"),r=0,a=(c=s.action).length;r<a;r++)t=c[r],
e.push('<a href="#" class="package-action btn btn--action'),"uninstall"===t&&e.push(n(" btn--danger")),e.push('" data-type="'),e.push(n(t)),e.push('">'),e.push(this.T(t)),e.push("</a><br/>");e.push("</td>\n      </tr>\n    ")}e.push("\n    </tbody>\n  </table>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/password/reset"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(e.push('<div class="reset_password fullscreen">\n  <div class="fullscreen-center">\n    <div class="hero-unit fullscreen-body">\n      <h2>'),e.push(this.T("Forgot your password?")),e.push('<small></small></h2>\n      <form class="js-passwordForm">\n        <div class="js-password"></div>\n        <div class="form-controls">\n          <a class="btn btn--text btn--subtle js-cancel" href="#login">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n          <button class="btn btn--primary js-submit align-right">'),e.push(this.T("Submit")),e.push("</button>\n        </div>\n      </form>\n    </div>\n  "),!_.isEmpty(this.public_links)){for(e.push("\n    <p>\n      "),r=t=0,i=(o=this.public_links).length;t<i;r=++t)s=o[r],e.push("\n        "),r>0&&e.push(" | "),e.push('\n        <a href="'),e.push(n(s.link)),e.push('" title="'),s.description?e.push(n(s.description)):e.push(n(s.title)),e.push('"'),s.new_tab&&e.push(' target="_blank"'),e.push(">"),e.push(n(s.title)),e.push("</a>\n      ");e.push("\n    </p>\n  ")}e.push('\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/password/reset_change"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(e.push('<div class="fullHeight vertical center justified reset_password fit">\n  <div class="fullscreen-center">\n    <div class="hero-unit">\n      <h2>'),e.push(this.T("Choose your new password.")),e.push('</h2>\n      <form class="js-passwordForm">\n        <div class="js-password"></div>\n        <div class="form-controls">\n          <a class="btn btn--text btn--subtle js-cancel" href="#/">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n          <button class="btn btn--primary js-submit align-right">'),e.push(this.T("Submit")),e.push("</button>\n        </div>\n      </form>\n    </div>\n  "),!_.isEmpty(this.public_links)){for(e.push("\n    <p>\n      "),r=t=0,i=(o=this.public_links).length;t<i;r=++t)s=o[r],e.push("\n        "),r>0&&e.push(" | "),e.push('\n        <a href="'),e.push(n(s.link)),e.push('" title="'),s.description?e.push(n(s.description)):e.push(n(s.title)),e.push('"'),s.new_tab&&e.push(' target="_blank"'),e.push(">"),e.push(n(s.title)),e.push("</a>\n      ");e.push("\n    </p>\n  ")}e.push('\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/password/reset_failed"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(e.push('<div class="reset_password fullscreen">\n  <div class="fullscreen-center">\n    <div class="hero-unit fullscreen-body">\n      <h2>'),e.push(this.T(this.head)),e.push("</h2>\n      <p>"),e.push(this.message),e.push('</p>\n      <a href="#password_reset" class="btn btn--text btn--secondary retry">&raquo; '),e.push(this.T("try again")),e.push(" &laquo;</a>\n    </div>\n  "),!_.isEmpty(this.public_links)){for(e.push("\n    <p>\n      "),r=t=0,i=(o=this.public_links).length;t<i;r=++t)s=o[r],e.push("\n        "),r>0&&e.push(" | "),e.push('\n        <a href="'),e.push(n(s.link)),e.push('" title="'),s.description?e.push(n(s.description)):e.push(n(s.title)),e.push('"'),s.new_tab&&e.push(' target="_blank"'),e.push(">"),e.push(n(s.title)),e.push("</a>\n      ");e.push("\n    </p>\n  ")}e.push('\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/password/reset_sent"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(e.push('<div class="reset_password fullscreen">\n  <div class="fullscreen-center">\n    <div class="hero-unit fullscreen-body">\n      <h2>'),e.push(this.T("We've sent password reset instructions to your email address.")),e.push("<small></small></h2>\n      <p>"),e.push(this.T("If you don't receive instructions within a minute or two, check your email's spam and junk filters, or try resending your request.")),e.push('</p>\n      <div class="form-controls">\n        <a class="btn btn--text btn--subtle js-cancel" href="#login">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n        <button class="btn btn--primary retry align-right">'),e.push(this.T("again")),e.push("</button>\n      </div>\n    </div>\n  "),!_.isEmpty(this.public_links)){for(e.push("\n    <p>\n      "),r=t=0,i=(o=this.public_links).length;t<i;r=++t)s=o[r],e.push("\n        "),r>0&&e.push(" | "),e.push('\n        <a href="'),e.push(n(s.link)),e.push('" title="'),s.description?e.push(n(s.description)):e.push(n(s.title)),e.push('"'),s.new_tab&&e.push(' target="_blank"'),e.push(">"),e.push(n(s.title)),e.push("</a>\n      ");e.push("\n    </p>\n  ")}e.push('\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/escalation"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<hr/>\n<div class="horizontal two-columns">\n'),this.object.first_response_escalation_at&&(e.push('\n  <div class="column">\n    <label>'),e.push(this.T("First Response Time")),e.push('</label>\n    <div class="u-textTruncate">'),e.push(this.humanTime(this.object.first_response_escalation_at,!0)),e.push("</div>\n  </div>\n")),e.push("\n"),this.object.update_escalation_at&&(e.push('\n  <div class="column">\n    <label>'),e.push(this.T("Update Time")),e.push('</label>\n    <div class="u-textTruncate">'),e.push(this.humanTime(this.object.update_escalation_at,!0)),e.push("</div>\n  </div>\n")),e.push("\n"),this.object.close_escalation_at&&(e.push('\n  <div class="column">\n    <label>'),e.push(this.T("Solution Time")),e.push('</label>\n    <div class="u-textTruncate">'),e.push(this.humanTime(this.object.close_escalation_at,!0)),e.push("</div>\n  </div>\n")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/kb_generic"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;e.push(this.V("popover/single_object_generic",{object:this.object,attributes:this.attributes})),e.push("\n"),("function"==typeof(t=this.object).parent&&"function"==typeof(i=t.parent()).canBePublished?i.canBePublished():void 0)&&(e.push('\n  <div class="state-badge">\n    '),e.push(this.Icon("task-state",this.object.parent().can_be_published_state())),e.push('\n    <span class="'),e.push(n(this.object.parent().can_be_published_state_css())),e.push('">\n      '),e.push(this.T(this.object.parent().can_be_published_state())),e.push('\n    </span>\n  </div>\n\n  <hr>\n\n  <div class="popover-block">\n    <div class="horizontal two-columns">\n      <div class="column">\n        <label>'),e.push(this.T("Published at")),e.push("</label>\n        "),(s=this.object.parent().published_at)?(e.push("\n          "),e.push(this.humanTime(s,!1,"time","absolute")),e.push("\n        ")):e.push("\n          -\n        "),e.push('\n      </div>\n      <div class="column">\n        <label>'),e.push(this.T("Archived at")),e.push("</label>\n        "),(s=this.object.parent().archived_at)?(e.push("\n          "),e.push(this.humanTime(s,!1,"time","absolute")),e.push("\n        ")):e.push("\n          -\n        "),e.push('\n      </div>\n      <div class="column">\n        <label>'),e.push(this.T("Category")),e.push('</label>\n        <a href="'),e.push(n(this.object.parent().category().uiUrl(App.KnowledgeBaseLocale.find(this.object.kb_locale_id)))),e.push('" title="'),e.push(n(this.object.parent().category().categoriesForSearch({full:!0,kb_locale:App.KnowledgeBaseLocale.find(this.object.kb_locale_id)}))),e.push('">'),e.push(n(this.object.parent().category().guaranteedTitle(this.object.kb_locale_id))),e.push('</a>\n      </div>\n      <div class="column">\n        <label>'),e.push(this.T("Language")),e.push("</label>\n        "),e.push(n(App.KnowledgeBaseLocale.localeFor(this.object).systemLocale().name)),e.push("\n      </div>\n\n      "),_.isEmpty(this.object.parent().tags)||(e.push('\n        <div class="column">\n          <label>'),e.push(this.T("Tags")),e.push("</label>\n          "),e.push(n(this.object.parent().tags.map((function(t){return"#"+t})).join(" "))),e.push("\n        </div>\n      ")),e.push("\n    </div>\n  </div>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/organization"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push(this.V("popover/single_object_generic",{object:this.object,attributes:this.attributes})),e.push("\n\n"),this.object.member_ids&&(e.push('\n  <hr>\n  <div class="popover-block">\n    <label>'),e.push(this.T("Members")),e.push(" ("),e.push(n(this.object.member_ids.length)),e.push(')</label>\n    <ul class="organizationUserList js-organizationUserList"></ul>\n  </div>\n')),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/single_object_generic"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i,s,r,o;for(_.isEmpty(this.attributes)||e.push("\n  <hr>\n"),e.push("\n\n"),t=0,n=(i=this.attributes).length;t<n;t++)r=i[t],e.push("\n  "),o=this.object[r.name],e.push("\n  "),("boolean"!=(s=typeof o)&&"number"!==s||_.isUndefined(o)||_.isNull(o))&&_.isEmpty(o)||(e.push('\n    <div class="popover-block">\n      <label>'),e.push(this.T(r.display)),e.push("</label>\n      "),e.push(this.P(this.object,r.name)),e.push("\n    </div>\n  ")),e.push("\n");e.push("\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/ticket"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="state-badge">\n  '),e.push(this.Icon(this.object.icon(),this.object.iconClass())),e.push(' <span class="'),e.push(this.T(this.object.iconTextClass())),e.push('">'),e.push(this.object.iconTitle()),e.push('</span>\n</div>\n<hr>\n<div class="popover-block">\n  <label>'),e.push(this.T("Agent")),e.push('</label>\n  <div class="person">\n    '),e.push(n(this.object.owner.displayName())),e.push("\n    "),this.object.owner.organization&&(e.push('\n      <span class="organization">'),e.push(n(this.object.owner.organization.displayName())),e.push("</span>\n    ")),e.push('\n  </div>\n</div>\n<div class="popover-block">\n  <label>'),e.push(this.T("Customer")),e.push('</label>\n  <div class="person">\n    '),e.push(n(this.object.customer.displayName())),e.push("\n    "),this.object.customer.organization&&(e.push('\n      <span class="organization">'),e.push(n(this.object.customer.organization.displayName())),e.push("</span>\n    ")),e.push('\n  </div>\n</div>\n<hr>\n<div class="horizontal two-columns">\n  <div class="column">\n    <label>#</label>\n    <div class="u-textTruncate">'),e.push(this.P(this.object,"number")),e.push('</div>\n  </div>\n  <div class="column">\n    <label>'),e.push(this.T("Priority")),e.push('</label>\n    <div class="u-textTruncate">'),e.push(this.P(this.object,"priority")),e.push('</div>\n  </div>\n  <div class="column">\n    <label>'),e.push(this.T("Created")),e.push('</label>\n    <div class="u-textTruncate">'),e.push(this.P(this.object,"created_at")),e.push('</div>\n  </div>\n  <div class="column">\n    <label>'),e.push(this.T("Group")),e.push('</label>\n    <div class="u-textTruncate">'),e.push(this.P(this.object,"group")),e.push("</div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/title_generic"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){this.showAvatar&&(e.push('\n  <div class="popover-avatar">\n    '),e.push(this.object.avatar("40")),e.push("\n  </div>\n")),e.push('\n<div class="popover-headline">\n'),!1===this.object.active?(e.push('\n  <h2><span class="is-inactive">'),e.push(n(this.displayTitle)),e.push("</span></h2>\n")):(e.push("\n  <h2>"),e.push(n(this.displayTitle)),e.push("</h2>\n")),e.push("\n  "),this.additionalHeadlineTemplateName&&(e.push("\n    "),e.push(this.V(this.additionalHeadlineTemplateName,{object:this.object,attributes:this.attributes})),e.push("\n  ")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/user"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u;if(e.push(this.V("popover/single_object_generic",{object:this.object,attributes:this.attributes})),e.push("\n"),!_.isEmpty(this.object.accounts)){for(t in e.push('\n  <hr>\n  <div class="popover-block">\n    <label>'),e.push(this.T("Linked Accounts")),e.push("</label>\n    "),this.object.accounts)e.push('\n      <a href="'),e.push(n(this.object.accounts[t].link)),e.push('" target="_blank">'),e.push(n(t)),e.push("</a>\n    ");e.push("\n  </div>\n")}if(e.push("\n"),!_.isEmpty(this.object.links)){for(e.push("\n  <hr>\n  "),i=0,o=(c=this.object.links).length;i<o;i++){for(l=c[i],e.push('\n    <div class="popover-block">\n      <label>'),e.push(this.T(l.title)),e.push("</label>\n      "),r=0,a=(u=l.items).length;r<a;r++)s=u[r],e.push("\n        "),s.url?(e.push('\n          <a href="'),e.push(n(s.url)),e.push('" title="'),e.push(this.Ti(s.title)),e.push('" style="'),e.push(n(s.style)),e.push('" data-type="'),e.push(n(s.data)),e.push('" class="'),e.push(n(s.class)),e.push('" '),l.new_window&&e.push('target="_blank"'),e.push(">\n        ")):(e.push('\n          <span title="'),e.push(this.Ti(s.title)),e.push('" style="'),e.push(n(s.style)),e.push('" data-type="'),e.push(n(s.data)),e.push('" class="'),e.push(n(s.class)),e.push('">\n        ')),e.push("\n          "),e.push(this.T(s.name)),e.push(" "),void 0!==s.count&&(e.push('<span class="count">('),e.push(n(s.count)),e.push(")</span>")),e.push("\n        "),s.url?e.push("\n          </a>\n        "):e.push("\n          </span>\n        "),e.push("\n      ");e.push("\n    </div>\n  ")}e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/user_organization_headline"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){this.object.organization&&(e.push('\n<div class="user-organization'),!1===this.object.organization.active&&e.push(" is-inactive"),e.push('"><a href="'),e.push(this.object.organization.uiUrl()),e.push('">'),e.push(n(this.object.organization.displayName())),e.push("</a></div>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/popover/user_ticket_list"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push(this.ticketList),e.push("\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/pre_defined_webhook"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <fieldset>\n    <div class="input form-group">\n      <div class="formGroup-label">\n        <label for="preDefinedWebhooks">'),e.push(this.T("Pre-defined Webhook")),e.push('</label>\n      </div>\n      <div class="controls">\n        <div class="js-preDefinedWebhooks"></div>\n      </div>\n    </div>\n    <p class="help-text">\n      '),e.push(this.T("A webhook can be fired by triggers and schedulers, don't forget to define them!")),e.push('\n    </p>\n    <p class="help-text">\n      '),e.push(this.T("You can find a tutorial on how to manage a %s in our online documentation %l.","Webhook","https://admin-docs.zammad.org/en/latest/manage/webhook.html")),e.push("\n    </p>\n  </fieldset>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/appearance"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Appearance")),e.push('</h1>\n  </div>\n</div>\n<div class="page-content">\n  <form class="settings-entry horizontal end">\n    <div class="form-item js-theme flex">\n      <div class="form-group">\n        <div class="formGroup-label">\n          <label for="appearance">'),e.push(this.T("Theme")),e.push('</label>\n        </div>\n        <div class="controls">\n          <div class="radio">\n            <label class="inline-label radio-replacement u-clickable">\n              <input type="radio" value="dark" name="theme"'),"dark"===this.theme&&e.push(n(" checked")),e.push(">\n              "),e.push(this.Icon("radio","icon-unchecked")),e.push("\n              "),e.push(this.Icon("radio-checked","icon-checked")),e.push('\n              <span class="label-text">'),e.push(this.T("Dark")),e.push('</span>\n            </label>\n            <label class="inline-label radio-replacement u-clickable">\n              <input type="radio" value="light" name="theme"'),"light"===this.theme&&e.push(n(" checked")),e.push(">\n              "),e.push(this.Icon("radio","icon-unchecked")),e.push("\n              "),e.push(this.Icon("radio-checked","icon-checked")),e.push('\n              <span class="label-text">'),e.push(this.T("Light")),e.push('</span>\n            </label>\n            <label class="inline-label radio-replacement u-clickable">\n              <input type="radio" value="auto" name="theme"'),"auto"===this.theme&&e.push(n(" checked")),e.push(">\n              "),e.push(this.Icon("radio","icon-unchecked")),e.push("\n              "),e.push(this.Icon("radio-checked","icon-checked")),e.push('\n              <span class="label-text">'),e.push(this.T("Sync with computer")),e.push("</span>\n            </label>\n          </div>\n        </div>\n      </div>\n    </div>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/avatar-holder"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="avatar-holder">\n  <span class="avatar size-80" data-avatar-id="'),e.push(this.avatar.id),e.push('" style="background-image: url('),e.push(this.src),e.push(')"></span>\n  <div class="avatar-delete">\n    '),e.push(this.Icon("diagonal-cross")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/avatar"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i,s,r;for(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Avatar")),e.push('</h1>\n  </div>\n  <div class="page-header-meta">\n  '),this.webcamSupport&&(e.push('\n    <div class="btn btn--success js-openCamera">'),e.push(this.T("Camera")),e.push("</div>\n  ")),e.push('\n    <div class="btn btn--success fileUpload">'),e.push(this.T("Upload")),e.push('<input type="file" class="js-upload" accept="image/*"></div>\n  </div>\n</div>\n<div class="page-content avatar-gallery">\n  '),i=0,s=(r=this.avatars).length;i<s;i++)t=r[i],e.push('\n  <div class="avatar-holder">\n    '),t.initial?(e.push("\n      "),n="",e.push("\n      "),t.default&&(e.push("\n      "),n="is-active",e.push("\n      ")),e.push("\n      "),e.push(App.Session.get().avatar("80","",n,!0,t)),e.push("\n    ")):(e.push('\n      <span class="avatar size-80 '),t.default&&e.push("is-active"),e.push('" data-avatar-id="'),e.push(t.id),e.push('" style="background-image: url('),e.push(t.content),e.push(')"></span>\n      '),t.deletable&&(e.push('\n        <div class="avatar-delete">\n          '),e.push(this.Icon("diagonal-cross")),e.push("\n        </div>\n      ")),e.push("\n    ")),e.push("\n  </div>\n  ");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/calendar_subscriptions"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(s in e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Calendar")),e.push('</h1>\n  </div>\n</div>\n<div class="page-content">\n  <h2>'),e.push(this.T("Ticket Subscriptions")),e.push("</h2>\n\n  <p>"),e.push(this.T("See your tickets from within your favorite calendar by adding the following URL to your calendar app.")),e.push("</p>\n\n"),this.api_access||(e.push('\n  <div class="alert alert--warning" role="alert">'),e.push(this.T("REST API access using the username/email address and password is currently disabled. Please contact your administrator.")),e.push("</div>\n")),e.push('\n\n  <label for="calendar-subscription-url">'),e.push(this.T("URL")),e.push('</label>\n  <form class="form--flexibleWidth">\n    <div class="form-group">\n      <div class="controls">\n        <input type="url" class="form-control js-select" readonly value="'),e.push(n(this.baseurl)),e.push('/ical/tickets" id="calendar-subscription-url">\n      </div>\n    </div>\n  </form>\n\n  <h3>'),e.push(this.T("Subscription Settings")),e.push('</h3>\n  <div class="form-group">\n    <div class="formGroup-label">\n      <label for="notification-sound">'),e.push(this.T("Alarm")),e.push('</label>\n    </div>\n    <div class="controls">\n      <label class="checkbox-replacement inline-label">\n        <input type="checkbox" name="alarm" value="true" '),this.preferences.alarm&&e.push("checked"),e.push("/>\n        "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n        "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n        <span class="label-text">'),e.push(this.T("Add alarm to pending reminder and escalated tickets.")),e.push('</span>\n      </label>\n    </div>\n  </div>\n  <table class="settings-list">\n    <thead>\n      <tr>\n        <th style="white-space: nowrap;">'),e.push(this.T("Status Type")),e.push('\n        <th colspan="2">'),e.push(this.T("Options")),e.push('\n        <th width="100%">'),e.push(this.T("Direct URL")),e.push("\n      </tr>\n    </thead>\n    <tbody>\n      "),i=this.preferences)t=i[s],e.push("\n        "),_.isObject(t)&&(e.push("\n          <tr>\n            <td>\n              "),e.push(n(this.translationTable[s])),e.push('\n            <td>\n              <label class="inline-label checkbox-replacement">\n                <input type="checkbox" name="'),e.push(n(s)),e.push('/own"'),e.push(n(t.own?" checked":void 0)),e.push(">\n                "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n                <span class="label-text">'),e.push(this.T("My Tickets")),e.push('</span>\n              </label>\n            <td>\n              <label class="inline-label checkbox-replacement">\n                <input type="checkbox" name="'),e.push(n(s)),e.push('/not_assigned"'),e.push(n(t.not_assigned?" checked":void 0)),e.push(">\n                "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n                <span class="label-text">'),e.push(this.T("Not Assigned")),e.push('</span>\n              </label>\n            <td class="settings-list-control-cell">\n              <div class="btn btn--text js-showLink">'),e.push(this.T("Show")),e.push('</div>\n              <input class="form-control form-control--small js-select is-hidden" readonly value="'),e.push(this.baseurl),e.push("/ical/tickets/"),e.push(n(s)),e.push('">\n          </tr>\n        ')),e.push("\n      ");e.push("\n    </tbody>\n  </table>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/camera"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="camera">\n  <canvas class="camera-preview" height="256" width="256"></canvas>\n  <video></video>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/devices"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="page-header">\n  <div class="page-header-title"><h1>'),e.push(this.T("Devices")),e.push('</h1></div>\n</div>\n\n<form class="page-content">\n\n  <p>'),e.push(this.T("All computers and browsers that have access to your Zammad appear here.")),e.push('</p>\n\n  <table class="settings-list">\n    <thead>\n      <tr>\n        <th>'),e.push(this.T("Name")),e.push("</th>\n        <th>"),e.push(this.T("Location")),e.push("</th>\n        <th>"),e.push(this.T("Most recent activity")),e.push("</th>\n        <th>"),e.push(this.T("Remove")),e.push("</th>\n      </tr>\n    </thead>\n    <tbody>\n    "),i=0,s=(r=this.devices).length;i<s;i++)t=r[i],e.push("\n      <tr>\n        <td>"),e.push(n(t.name)),e.push("</td>\n        <td>"),
e.push(n(t.location)),e.push("</td>\n        <td>"),e.push(this.humanTime(t.updated_at)),e.push('</td>\n        <td class="settings-list-controls">\n          <div class="settings-list-control" href="#" data-device-id="'),e.push(t.id),e.push('" data-type="delete" title="'),e.push(this.Ti("Delete")),e.push('"'),t.current&&e.push("disabled"),e.push(">"),e.push(this.Icon("trash")),e.push("</div>\n          </div>\n      </tr>\n    ");e.push("\n    </tbody>\n  </table>\n\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/imageCropper"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="imageCropper vertical center">\n  <div class="horizontal justified center">\n    <p>'),e.push(this.T("Avatar")),e.push('</p>\n    <div class="imageCropper-preview"></div>\n    <p>'),e.push(this.T("Preview")),e.push('</p>\n  </div>\n  <div class="imageCropper-holder">\n    <img class="imageCropper-image">\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/language"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Language")),e.push('</h1>\n  </div>\n</div>\n<div class="page-content">\n  <p>'),e.push(this.T("Choose your language.")),e.push('</p>\n  <form class="settings-entry horizontal end">\n    <div class="form-item js-language flex"></div>\n    <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n  </form>\n  <p>"),e.push(this.T("Did you know? You can help translating %s at:","Zammad")),e.push(' <a href="https://translations.zammad.org" target="_blank">translations.zammad.org</a></p>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/linked_accounts"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s;for(t in e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Link Accounts")),e.push('</h1>\n  </div>\n</div>\n<div class="page-content">\n  <ul>\n    '),s=this.auth_providers)i=s[t],e.push("\n      <li> "),e.push(this.C(i.config+"_display_name")||this.T(i.name)),e.push("\n        "),this.user.accounts&&this.user.accounts[t]?(e.push('\n          "'),e.push(n(this.user.accounts[t].username)),e.push('" <a href="#" data-uid="'),e.push(n(this.user.accounts[t].uid)),e.push('" data-provider="'),e.push(n(t)),e.push('" class="js-remove">'),e.push(this.T("remove")),e.push("</a>\n        ")):(e.push('\n          <form method="post" class="hidden js-addForm-'),e.push(n(t)),e.push('" action="'),e.push(n(i.url)),e.push('">\n            <input type="hidden" name="authenticity_token" value="'),e.push(n(Spine.Ajax.defaults.headers["X-CSRF-Token"])),e.push('">\n          </form>\n\n          <a href="#" data-key="'),e.push(n(t)),e.push('" class="js-add">'),e.push(this.T("Add")),e.push("</a>\n        ")),e.push("\n      </li>\n    ");e.push("\n  </ul>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/notification"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;if(e.push('<div class="page-header">\n  <div class="page-header-title"><h1>'),e.push(this.T("Notifications")),e.push('</h1></div>\n</div>\n\n<form class="page-content form--flexibleWidth profile-settings-notifications-content">\n\n  <div class="settings-entry">\n    '),e.push(this.matrixTableHTML),e.push("\n  </div>\n\n  "),this.groups){for(e.push('\n    <div class="zammad-switch zammad-switch--small" data-name="profile-groups-limit">\n       <input type="checkbox" id="profile-groups-limit" '),this.user_group_config&&e.push(" checked "),e.push('>\n       <label for="profile-groups-limit"></label>\n    </div>\n    <h2>\n      '),e.push(this.T("Limit Groups")),e.push('\n    </h2>\n\n    <div class="settings-entry profile-groups-limit-settings">\n      <div class="profile-groups-limit-settings-inner collapse '),this.user_group_config&&e.push("in"),e.push('">\n        <div class="alert alert--warning profile-groups-all-unchecked hide" role="alert">\n          '),e.push(this.T("Disabling the notifications from all groups will turn off the limit. Instead, to disable the notifications use the settings above.")),e.push('\n        </div>\n\n        <table class="settings-list">\n          <thead>\n            <tr>\n              <th>'),e.push(this.T("Group")),e.push("\n              <th>"),e.push(this.T("Not Assigned")),e.push(" & "),e.push(this.T("All Tickets")),e.push("\n          </thead>\n          <tbody>\n          "),i=0,r=(a=this.groups).length;i<r;i++)t=a[i],e.push("\n            <tr>\n              <td>"),e.push(n(this.P(t,"name"))),e.push('\n              <td class="u-positionOrigin">\n                <label class="checkbox-replacement checkbox-replacement--fullscreen">\n                  <input type="checkbox" name="group_ids" value="'),e.push(n(t.id)),e.push('" '),_.include(this.config.group_ids,t.id.toString())&&e.push("checked"),e.push("/>\n                  "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                  "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n                </label>\n          ");e.push("\n          </tbody>\n        </table>\n      </div>\n    </div>\n  ")}for(e.push("\n\n  <h2>"),e.push(this.T("Sounds")),e.push('</h2>\n  <div class="form-group">\n    <div class="formGroup-label">\n      <label for="notification-sound">'),e.push(this.T("Notification Sound")),e.push('</label>\n    </div>\n    <div class="controls controls--select">\n      <select class="form-control js-notificationSound" id="notification-sound" name="notification_sound::file">\n        '),s=0,o=(l=this.sounds).length;s<o;s++)c=l[s],e.push('\n        <option value="'),e.push(n(c.file)),e.push('"'),c.selected&&e.push(n(" selected")),e.push(">"),e.push(n(c.name)),e.push("</option>\n        ");e.push("\n      </select>\n      "),e.push(this.Icon("arrow-down")),e.push('\n    </div>\n  </div>\n  <div class="form-group">\n    <label class="inline-label">\n      <span class="checkbox-replacement checkbox-replacement--inline">\n        <input type="checkbox" name="notification_sound::enabled" value="true" '),this.notificationSoundEnabled&&e.push(" checked"),e.push(' class="js-SoundEnableDisable">\n        '),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n        "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push("\n      </span>\n      "),e.push(this.T("Play user interface sound effects")),e.push('\n    </label>\n  </div>\n\n  <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push('</button>\n  <input type="button" class="btn btn--danger js-reset" value="'),e.push(this.T("Reset to default settings")),e.push('">\n</form>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/out_of_office"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title"><h1>'),e.push(this.T("Out of Office")),e.push('</h1></div>\n</div>\n\n<form class="action">\n  <div class="action-flow action-flow--row">\n    <div class="action-row">\n      <div class="action-flow action-flow--noWrap">\n        <h2><span class="action-form-status">\n            '),!0===this.localData.out_of_office?(e.push("\n              "),e.push(this.Icon("status","ok inline")),e.push("\n            ")):(e.push("\n              "),e.push(this.Icon("status","error inline")),e.push("\n            ")),e.push('</span> <input id="out_of_office_reason" name="out_of_office_text" class="form-control form-control--inline" type="text" placeholder="'),e.push(this.Ti("e.g.")),e.push(" "),e.push(this.Ti(this.placeholder)),e.push('" value="'),_.isEmpty(this.localData.out_of_office_text)||e.push(n(this.localData.out_of_office_text)),e.push('"></h2>\n      </div>\n    </div>\n    <div class="action-block action-block--flex">\n      <div class="label">'),e.push(this.T("From")),e.push('</div>\n      <div class="form-group js-startDate"></div>\n    </div>\n    <div class="action-block action-block--flex">\n      <div class="label">'),e.push(this.T("Till")),e.push('</div>\n      <div class="form-group js-endDate"></div>\n    </div>\n    <div class="action-row">\n      <label for="out_of_office_replacement">'),e.push(this.T("Replacement")),e.push('</label>\n      <div class="dropdown js-recipientDropdown"></div>\n    </div>\n    <div class="action-controls">\n      <div class="btn btn--danger js-disabled">'),e.push(this.Ti("Disable")),e.push('</div>\n      <div class="btn btn--create js-enable">'),e.push(this.Ti("Enable")),e.push("</div>\n    </div>\n  </div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/password"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Password & Authentication")),e.push("</h1>\n  </div>\n</div>\n\n"),this.allowsChangePassword&&(e.push("\n  <h2>"),e.push(this.T("Change Your Password")),e.push("</h2>\n  <p>"),e.push(this.T("Enter your current password, insert a new one and confirm it.")),e.push('</p>\n\n  <form class="settings-entry form--flexibleWidth">\n    <div class="password_item"></div>\n    <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n  </form>\n")),e.push("\n\n"),this.allowsChangePassword&&this.allowsTwoFactor&&e.push("\n  <hr>\n"),e.push("\n\n"),this.allowsTwoFactor){for(e.push("\n  <h2>"),e.push(this.T("Two-factor Authentication")),e.push("</h2>\n  <p>"),e.push(this.T("Here you can set up and manage two-factor authentication methods for your Zammad account.")),e.push('</p>\n\n  <div class="settings-list profile-two-factor">\n    <table>\n      <thead>\n        <tr>\n          <th>'),e.push(this.T("Active")),e.push("</th>\n          <th>"),e.push(this.T("Name")),e.push("</th>\n          <th>"),e.push(this.T("Description")),e.push("</th>\n          <th>"),e.push(this.T("Action")),e.push("</th>\n        </tr>\n      </thead>\n      <tbody>\n        "),i=0,s=(r=this.twoFactorMethods).length;i<s;i++)t=r[i],e.push('\n          <tr data-two-factor-key="'),e.push(n(t.method)),e.push('">\n            <td class="settings-list-controls"><div class="settings-list-control todo '),e.push(n(t.active_icon_parent_class)),e.push('">'),e.push(this.Icon(t.active_icon_class)),e.push('</div></td>\n            <td>\n              <div class="settings-list-wrapping-cell">\n                '),e.push(this.Icon(t.details.icon,"half-space-right")),e.push('\n                <span class="half-space-right">'),e.push(n(this.T(t.details.label))),e.push("</span>\n                "),t.configured&&t.default&&(e.push('\n                  <span class="badge badge--primary">'),e.push(n(this.T("Default"))),e.push("</span>\n                ")),e.push("\n              </div>\n            </td>\n            <td>"),e.push(this.T(t.details.description)),e.push('</td>\n            <td class="settings-list-controls">\n              <div class="settings-list-control dropdown dropdown--actions">\n                <div class="btn btn--table btn--text btn--secondary js-action" data-toggle="dropdown">\n                  '),e.push(this.Icon("overflow-button")),e.push('\n                </div>\n                <ul class="dropdown-menu dropdown-menu-right js-table-action-menu" role="menu">\n                  '),t.configured?(e.push("\n                    "),t.default||(e.push('\n                    <li role="presentation" data-type="default">\n                      <a role="menuitem" tabindex="-1">\n                        <span class="dropdown-iconSpacer">\n                          '),e.push(this.Icon("reload")),e.push("\n                        </span>\n                        "),e.push(n(this.T("Set as default"))),e.push("\n                      </a>\n                    </li>\n                    ")),e.push("\n                    "),t.details.editable&&(e.push('\n                      <li role="presentation" data-type="edit">\n                        <a role="menuitem" tabindex="-1">\n                          <span class="dropdown-iconSpacer">\n                            '),e.push(this.Icon("pen")),e.push("\n                          </span>\n                          "),e.push(n(this.T("Edit"))),e.push("\n                        </a>\n                      </li>\n                    ")),e.push('\n                    <li role="presentation" class="danger" data-type="remove">\n                      <a role="menuitem" tabindex="-1" href="#">\n                        <span class="dropdown-iconSpacer">\n                          '),e.push(this.Icon("trash")),e.push("\n                        </span>\n                        "),e.push(n(this.T("Remove"))),e.push("\n                      </a>\n                    </li>\n                  ")):(e.push('\n                    <li role="presentation" class="create" data-type="setup">\n                      <a role="menuitem" tabindex="-1" href="#">\n                        <span class="dropdown-iconSpacer">\n                          '),e.push(this.Icon("checkmark")),e.push("\n                        </span>\n                        "),e.push(n(this.T("Set Up"))),e.push("\n                      </a>\n                    </li>\n                  ")),e.push("\n                </ul>\n              </div>\n            </td>\n          </tr>\n        ");e.push("\n      </tbody>\n    </table>\n\n    "),this.hasConfiguredTwoFactor&&this.recoveryCodesEnabled&&(e.push('\n      <div class="recovery-codes">\n        <p>'),e.push(this.T("Recovery codes can be used to access your account in the event you lose access to other two-factor authentication methods.")),e.push("</p>\n        "),this.recoveryCodesExist&&(e.push("\n          <p>"),e.push(this.T("If you lose your recovery codes it's possible to generate new ones. This action is going to invalidate previous recovery codes.")),e.push("</p>\n        ")),e.push('\n\n        <a class="js-generate-recovery-codes btn btn--create settings-list--bottom-button">\n          '),this.recoveryCodesExist?(e.push("\n            "),e.push(n(this.T("Regenerate recovery codes"))),e.push("\n          ")):(e.push("\n            "),e.push(n(this.T("Generate recovery codes"))),e.push("\n          ")),e.push("\n        </a>\n      </div>\n    ")),e.push("\n  </div>\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/token_access"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="page-header">\n  <div class="page-header-title"><h1>'),e.push(this.T("Token Access")),e.push("</h1></div>\n</div>\n<p>"),e.push(this.T("You can generate a personal access token for each application you use that needs access to the Zammad API.")),e.push("</p>\n\n<h2>"),e.push(this.T("Add a Personal Access Token")),e.push("</h2>\n<p>"),e.push(this.T("Pick a name for the application, and we'll give you a unique token.")),e.push('</p>\n<a class="btn btn--primary js-create">'),e.push(this.T("Create")),e.push("</a>\n\n<hr>\n\n<h2>"),e.push(this.T("Personal Access Tokens")),e.push('</h2>\n<table class="settings-list js-tokenList">\n  <thead>\n    <tr>\n      <th>'),e.push(this.T("Name")),e.push("</th>\n      <th>"),e.push(this.T("Permissions")),e.push("</th>\n      <th>"),e.push(this.T("Created")),e.push("</th>\n      <th>"),e.push(this.T("Expires")),e.push("</th>\n      <th>"),e.push(this.T("Last used")),e.push("</th>\n      <th>"),e.push(this.T("Delete")),e.push("</th>\n    </tr>\n  </thead>\n  <tbody>\n  "),_.isEmpty(this.tokens))e.push('\n    <tr>\n      <td colspan="6">'),e.push(this.T("none")),e.push("\n  ");else{for(e.push("\n    "),t=0,i=(s=this.tokens).length;t<i;t++)r=s[t],e.push("\n      <tr>\n        <td>"),e.push(n(r.name)),e.push("</td>\n        <td>"),r.preferences&&r.preferences.permission&&e.push(n(r.preferences.permission.join(", "))),e.push("</td>\n        <td>"),e.push(this.humanTime(r.created_at)),e.push("</td>\n        <td>"),e.push(this.Tdate(r.expires_at)),e.push("</td>\n        <td>"),e.push(this.humanTime(r.last_used_at)),e.push('</td>\n        <td class="settings-list-controls">\n          <div class="settings-list-control js-delete" data-token-id="'),e.push(r.id),e.push('" title="'),e.push(this.Ti("Delete")),e.push('">'),e.push(this.Icon("trash")),e.push("</div>\n      </tr>\n    ");e.push("\n  ")}e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/token_access_create"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="input form-group">\n  <div class="formGroup-label">\n    <label for="token-name">'),e.push(this.T("Name")),e.push(' *</label>\n  </div>\n  <div class="controls"><input id="token-name" type="text" name="name" value="" class="form-control js-input" required></div>\n</div>\n\n<div class="input form-group">\n  <div class="formGroup-label">\n    <label for="token-expires-at">'),e.push(this.T("Expires")),e.push('</label>\n  </div>\n  <div class="controls js-date"></div>\n</div>\n\n<div class="permission form-group checkbox">\n  <div class="checkbox">\n  '),t=0,i=(r=this.permissions).length;t<i;t++)s=r[t],e.push("\n    "),s.name.match(/\./)?(e.push('\n      <div class="checkbox-child js-subPermissionList">\n        <label class="inline-label checkbox-replacement">\n          <input type="checkbox" value="'),e.push(n(s.name)),e.push('" name="permission" '),this.params&&_.contains(this.params.permissions,s.id)&&e.push("checked"),e.push(" "),s.preferences.disabled&&e.push("disabled"),e.push("/>\n          "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n          "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n          <span class="label-text">'),e.push(n(s.name.replace(/^.+?\./,""))),e.push('</span>\n          <span class="help-text">'),e.push(this.T(s.note,this.T(s.preferences.translations))),e.push("</span>\n        </label>\n      </div>\n    ")):(e.push('\n    <label class="inline-label checkbox-replacement">\n      <input type="checkbox" value="'),e.push(n(s.name)),e.push('" name="permission" '),this.params&&_.contains(this.params.permissions,s.id)&&e.push("checked"),e.push(" "),s.preferences.disabled&&e.push("disabled"),e.push("/>\n      "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n      "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n      <span class="label-text">'),e.push(n(s.name)),e.push('</span>\n      <span class="help-text">'),e.push(this.T(s.note,this.T(s.preferences.translations))),e.push("</span>\n    </label>\n    ")),e.push("\n  ");e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/profile/token_access_created"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>"),e.push(this.T("For security reasons, the API token is shown only once. You'll need to save it somewhere secure before continuing.")),e.push('</p>\n\n<form>\n  <div class="input form-group">\n    <div class="controls"><input type="text" value="'),e.push(n(this.token)),e.push('" class="form-control input js-select" readonly></div>\n  </div>\n</form>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/reorder_modal"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<div>\n  <div class='alert alert--danger hidden'></div>\n  <div class='js-table-container'></div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/report/download_button"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<a class="btn btn--action" href="'),e.push(this.downloadUrl),e.push('" target="_blank" data-type="attachment">'),e.push(this.Icon("download")),e.push("<span>"),e.push(this.T("Download %s record(s)",this.count)),e.push("</span></a>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/report/download_content"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="js-dataDownloadHeader"></div>\n  <div class="js-dataDownloadButton"></div>\n  <div class="spacer"></div>\n  <div class="js-dataDownloadTable"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/report/download_header"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(e.push('<ul class="nav nav-tabs">\n  '),i=0,r=(l=this.profiles).length;i<r;i++){for(a=l[i],e.push("\n    "),s=0,o=(c=this.metric.backend).length;s<o;s++)t=c[s],e.push("\n      "),t.dataDownload&&(e.push("\n      <li "),t.name===this.downloadBackendSelected&&e.push('class="is-active active"'),e.push('><a href="#" class="js-dataDownloadBackendSelector" data-toggle="tab" data-profile-id="'),e.push(n(a.id)),e.push('" data-backend="'),e.push(n(t.name)),e.push('">'),e.push(this.T(t.display)),e.push("</a></li>\n      ")),e.push("\n    ");e.push("\n  ")}e.push("\n</ul>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/report/main"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main flex reporting">\n\n  <div class="page-header">\n    <div class="page-header-title">\n      <h1>'),e.push(this.T("Reporting")),e.push(' <small></small></h1>\n    </div>\n  </div>\n\n  <div class="page-body page-body--two-column">\n    <div class="page-aside js-aside"></div>\n\n    <div class="page-main">\n      <div class="js-timeRangePicker"></div>\n      <div class="well">\n\n        <div id="placeholder" class="" style="height:350px;"></div>\n        <span class=" muted" id="download-chart" style="font-size: 8px;"></span>\n\n        <div class="js-timePicker"></div>\n        <div class="js-dataDownload"></div>\n      </div>\n    </div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/report/sidebar"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h;for(r in e.push('<div class="panel-group" id="accordion">\n  '),u=this.metrics){for(l=u[r],e.push('\n    <div class="panel panel-default" data-metric="'),e.push(n(l.name)),e.push('">\n      <a class="panel-heading" data-toggle="collapse" data-parent="#accordion" href="#collapse-'),e.push(n(l.name)),e.push('">\n        <span class="panel-title">\n          '),e.push(this.T(l.display)),e.push('\n        </span>\n      </a>\n      <div id="collapse-'),e.push(n(l.name)),e.push('" class="panel-collapse collapse '),l.name===this.params.metric&&e.push("in"),e.push('">\n        <div class="panel-body">\n          <ul class="type area_select">\n            '),i=0,o=(p=l.backend).length;i<o;i++)t=p[i],e.push('\n              <li>\n                <label class="inline-label checkbox-replacement">\n                  <input class="js-backendSelector" type="checkbox" value="'),e.push(n(t.name)),e.push('"'),this.params.backendSelected[t.name]&&e.push(" checked"),e.push(">\n                  "),e.push(this.Icon("checkbox","icon-unchecked")),e.push("\n                  "),e.push(this.Icon("checkbox-checked","icon-checked")),e.push('\n                  <span class="label-text">'),e.push(this.T(t.display)),e.push("</span>\n                </label>\n              </li>\n            ");e.push("\n          </ul>\n        </div>\n      </div>\n    </div>\n  ")}for(e.push("\n</div>\n\n<h3>"),e.push(this.T("Profiles")),e.push('</h3>\n<ul class="checkbox-list">\n  '),s=0,a=(h=this.profiles).length;s<a;s++)c=h[s],e.push('\n    <li>\n      <label class="inline-label radio-replacement">\n        <input class="js-profileSelector" type="radio" name="profile_id" value="'),e.push(n(c.id)),e.push('"'),this.params.profileSelected[c.id]&&e.push(" checked"),e.push(">\n        "),e.push(this.Icon("radio","icon-unchecked")),e.push("\n        "),e.push(this.Icon("radio-checked","icon-checked")),e.push('\n        <span class="label-text">'),e.push(n(c.name)),e.push("</span>\n      </label>\n    </li>\n  ");e.push("\n</ul>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/report/time_picker"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f;if(e.push('<div class="">\n  '),"day"===this.params.timeRange){for(e.push('\n    <div class="btn-group btn-group--full" role="group" aria-label="">\n      '),t=0,a=(p=this.timeRangeDay).length;t<a;t++)i=p[t],e.push('\n        <div class="btn btn--text btn--large js-timePickerDay'),this.params.day===i.value&&e.push(" is-selected"),e.push('" data-id="'),e.push(n(this.params.timeRange)),e.push('" data-type="'),e.push(n(i.value)),e.push('">'),e.push(n(i.display)),e.push("</div>\n      ");e.push("\n    </div>\n  ")}if(e.push("\n\n  "),"day"===this.params.timeRange||"month"===this.params.timeRange){for(e.push('\n    <div class="btn-group btn-group--full" role="group" aria-label="">\n      '),s=0,l=(h=this.timeRangeMonth).length;s<l;s++)i=h[s],e.push('\n        <div class="btn btn--text btn--large js-timePickerMonth'),this.params.month===i.value&&e.push(" is-selected"),e.push('" data-id="'),e.push(n(this.params.timeRange)),e.push('" data-type="'),e.push(n(i.value)),e.push('">'),e.push(n(this.T(i.display))),e.push("</div>\n      ");e.push("\n    </div>\n  ")}if(e.push("\n\n  "),"week"===this.params.timeRange){for(e.push('\n    <div class="btn-group btn-group--full" role="group" aria-label="">\n      '),r=0,c=(d=this.timeRangeWeek).length;r<c;r++)i=d[r],e.push('\n        <div class="btn btn--text btn--large js-timePickerWeek'),this.params.week===i.value&&e.push(" is-selected"),e.push('" data-id="'),e.push(n(this.params.timeRange)),e.push('" data-type="'),e.push(n(i.value)),e.push('">'),e.push(n(i.display)),e.push("</div>\n      ");e.push("\n    </div>\n  ")}if(e.push("\n\n  "),"realtime"!==this.params.timeRange){for(e.push('\n    <div class="btn-group btn-group--full" role="group" aria-label="">\n      '),o=0,u=(f=this.timeRangeYear).length;o<u;o++)i=f[o],e.push('\n        <div class="btn btn--text btn--large js-timePickerYear'),this.params.year===i.value&&e.push(" is-selected"),e.push('" data-id="'),e.push(n(this.params.timeRange)),e.push('" data-type="'),e.push(n(i.value)),e.push('">'),e.push(n(i.display)),e.push("</div>\n      ");e.push("\n    </div>\n  ")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/report/time_range_picker"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){
e.push('<div class="tabs">\n  <div class="tab js-timeRange active" data-type="year">'),e.push(this.T("Year")),e.push('</div>\n  <div class="tab js-timeRange" data-type="month">'),e.push(this.T("Month")),e.push('</div>\n  <div class="tab js-timeRange" data-type="week">'),e.push(this.T("Week")),e.push('</div>\n  <div class="tab js-timeRange" data-type="day">'),e.push(this.T("Day")),e.push('</div>\n  <div class="tab js-timeRange" data-type="realtime">'),e.push(this.T("Real-time")),e.push("</div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/search/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="flex main vertical">\n\n  <div class="detail-search">\n    <div class="detail-search-header">\n      <div class="searchfield">\n        <input class="js-search form-control'),e.push(n(this.query?void 0:" is-empty")),e.push('" name="query" placeholder="'),e.push(this.Ti('Find what you\'re looking for, e.g. "search phrase"')),e.push('" value="'),e.push(n(this.query)),e.push('" type="search" autocomplete="off">\n        '),e.push(this.Icon("magnifier")),e.push('\n        <div class="empty-search js-emptySearch">\n          '),e.push(this.Icon("diagonal-cross")),e.push('\n        </div>\n      </div>\n\n      <div class="tabs tabs-wide">\n        '),t=0,i=(s=this.tabs).length;t<i;t++)r=s[t],e.push('\n          <div data-tab-content="'),e.push(r.model),e.push('" class="tab js-tab js-tab'),e.push(r.model),r.active&&e.push(" active"),e.push('">\n            <span class="tab-name">'),e.push(this.T(r.name)),e.push('</span>\n            <span class="tab-badge js-counter">'),e.push(r.count),e.push("</span>\n          </div>\n        ");e.push('\n      </div>\n    </div>\n\n    <div class="js-content"></div>\n  </div>\n\n</div>\n\n<div class="bulkAction hide"></div>\n<div class="batch-overlay js-batch-overlay"></div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/session"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="page-header-title">\n  <h1>'),e.push(this.T("Sessions")),e.push('<small></small></h1>\n</div>\n<div class="page-content">\n  <table class="table table-striped table-hover">\n    <thead>\n      <tr>\n        <th>'),e.push(this.T("User")),e.push("</th>\n        <th>"),e.push(this.T("Browser")),e.push("</th>\n        <th>"),e.push(this.T("Location")),e.push("</th>\n        <th>"),e.push(this.T("Age")),e.push("</th>\n        <th>"),e.push(this.T("Update")),e.push("</th>\n        <th>"),e.push(this.T("Action")),e.push("</th>\n      </tr>\n    </thead>\n    <tbody>\n      "),t=0,i=(s=this.sessions).length;t<i;t++)r=s[t],e.push("\n      <tr>\n        <td>"),r.data.user&&e.push(n(r.data.user.displayName())),e.push('</td>\n        <td title="'),e.push(n(r.data.user_agent)),e.push('">'),e.push(n(r.data.user_agent)),e.push('</td>\n        <td title="'),e.push(n(r.data.remote_ip)),e.push('">'),r.data.geo&&r.data.geo.country_name?(e.push(n(r.data.geo.country_name)),e.push(" "),e.push(n(r.data.geo.city_name))):e.push(n(r.data.remote_ip)),e.push("</td>\n        <td>"),e.push(this.humanTime(r.created_at)),e.push("</td>\n        <td>"),e.push(this.humanTime(r.updated_at)),e.push('</td>\n        <td><a href="#" data-session-id="'),e.push(r.id),e.push('" class="js-delete" title="'),e.push(this.Ti("Delete")),e.push('">'),e.push(this.Icon("trash")),e.push("</a></td>\n      </tr>\n      ");e.push("\n    </tbody>\n  </table>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/form"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i,s;for(e.push('<form>\n  <div class="settings-entry">\n    <table class="settings-list" style="width: 100%;">\n      <thead>\n        <tr>\n          <th width="15%">'),e.push(this.T("Title")),e.push('\n          <th width="50%">'),e.push(this.T("Value")),e.push('\n          <th width="35%">'),e.push(this.T("Description")),e.push("\n      </thead>\n      <tbody>\n"),t=0,n=(i=this.settings).length;t<n;t++)s=i[t],e.push("\n        <tr>\n          <td>"),e.push(this.T(s.title)),e.push('\n          <td class="settings-list-control-cell" data-name="'),e.push(s.name),e.push('">\n          <td><p class="help-text">'),e.push(this.RichText(s.description)),e.push("</p>\n");e.push('\n      </tbody>\n    </table>\n  </div>\n  <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Submit")),e.push("</button>\n</form>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="settings-entry" id="'),e.push(n(this.setting.name)),e.push('">\n  <h2>'),e.push(this.T(this.setting.title)),e.push('</h2>\n  <p class="help-text">'),e.push(this.T(this.setting.description)),e.push('</p>\n  <div class="horizontal end">\n    <div class="form-item flex"></div>\n    <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n  </div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/logo"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="settings-entry" id="'),e.push(n(this.setting.name)),e.push('">\n  <h2>'),e.push(this.T(this.setting.title)),e.push("</h2>\n  <p>"),e.push(this.T(this.setting.description)),e.push('</p>\n  <div class="js-loginPreview"></div>\n  <div class="setting-controls">\n    <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n  </div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/proxy"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="settings-entry" id="'),e.push(n(this.setting.name)),e.push('">\n  <h2>'),e.push(this.T(this.setting.title)),e.push('</h2>\n  <p class="help-text">'),e.push(this.T("Proxy address")),e.push('</p>\n  <div class="horizontal end">\n    <div class="form-item flex">\n      <input type="text" name="proxy" value="'),e.push(n(this.proxy)),e.push('" placeholder="proxy.example.com:3128" class="form-control">\n    </div>\n  </div>\n  <p class="help-text">'),e.push(this.T("Username for proxy connection")),e.push('</p>\n  <div class="horizontal end">\n    <div class="form-item flex">\n      <input type="text" name="proxy_username" value="'),e.push(n(this.proxy_username)),e.push('" class="form-control">\n    </div>\n  </div>\n  <p class="help-text">'),e.push(this.T("Password for proxy connection")),e.push('</p>\n  <div class="horizontal end">\n    <div class="form-item flex">\n      <input type="password" name="proxy_password" value="'),e.push(n(this.proxy_password)),e.push('" class="form-control">\n    </div>\n  </div>\n  <p class="help-text">'),e.push(this.T("Do not use the proxy for the following hosts.")),e.push('</p>\n  <div class="horizontal end">\n    <div class="form-item flex">\n      <input type="text" name="proxy_no" value="'),e.push(n(this.proxy_no)),e.push('" placeholder="localhost,127.0.0.1" class="form-control">\n    </div>\n  </div>\n  <div class="horizontal justify-end form-controls">\n    <button class="btn btn js-test">'),e.push(this.T("Test Connection")),e.push('</button>\n    <button class="btn btn--primary js-submit hide">'),e.push(this.T("Submit")),e.push("</button>\n  <div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/storage_provider"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="settings-entry" id="'),e.push(n(this.setting.name)),e.push('">\n  <h2>'),e.push(this.T(this.setting.title)),e.push('</h2>\n  <p class="help-text">'),e.push(this.T("You can switch between the following backends for new attachments even on a system that is already in production without any loss of data.")),e.push('</p>\n  <dl class="help-text">\n    <dt>'),e.push(this.T("Filesystem")),e.push("<code>File</code></dt>\n    <dd>"),e.push(this.T("Attachments are stored in the filesystem.")),e.push("</dd>\n    <dt>"),e.push(this.T("Database")),e.push("<code>DB</code></dt>\n    <dd>"),e.push(this.T("Attachments are stored in the database.")),e.push("</dd>\n    <dt>"),e.push(this.T("Simple Storage Service (S3)")),e.push("<code>S3</code></dt>\n    <dd>"),e.push(this.T("Attachments are stored in a Simple Storage Service.")),e.push("<br />"),e.push(this.T("For more details, please check out our online documentation %l.","https://admin-docs.zammad.org/en/latest/settings/system/storage.html")),e.push('</dd>\n  </dl>\n  <p class="help-text">'),e.push(this.T("If you want to move already stored attachments from one backend to another, you need to execute the following via console.")),e.push('</p>\n  <code>\n  rails&gt; Store::File.move(SOURCE_STORAGE, TARGET_STORAGE)\n  </code>\n  <p class="help-text">'),e.push(this.T("Examples:")),e.push('</p>\n  <p class="help-text">'),e.push(this.T('Move all from "%s" to "%s":',"filesystem","database")),e.push("</p>\n  </p>\n  <code>\n  rails&gt; Store::File.move('File', 'DB')\n  </code>\n  <p class=\"help-text\">"),e.push(this.T('Move all from "%s" to "%s":',"database","simple storage")),e.push('</p>\n  </p>\n  <code>\n  rails&gt; Store::File.move(\'DB\', \'S3\')\n  </code>\n  <br>\n  <br>\n  <div class="horizontal end">\n    <div class="form-item flex"></div>\n    <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n  </div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/switch"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="settings-entry">\n  <div class="page-header">\n    <div class="page-header-title">\n      <div class="zammad-switch zammad-switch--small js-setting" data-name="'),e.push(n(this.setting.name)),e.push('">\n        <input name="'),e.push(n(this.setting.name)),e.push('" type="checkbox" id="setting-'),e.push(n(this.setting.name)),e.push('" '),this.checked&&e.push("checked"),e.push('>\n        <label for="setting-'),e.push(n(this.setting.name)),e.push('"></label>\n      </div>\n      <h1>'),e.push(this.T.apply(this,[this.setting.title].concat(this.setting.preferences.title_i18n))),e.push('</h1>\n    </div>\n  </div>\n  <div class="page-content">\n    <p class="help-text">'),e.push(this.T.apply(this,[this.setting.description].concat(this.setting.preferences.description_i18n))),e.push("</p>\n    "),t=0,i=(r=this.subSetting).length;t<i;t++)s=r[t],e.push('\n    <form class="settings-entry" data-name="'),e.push(n(s.name)),e.push('">\n      <div class="horizontal end">\n        <div class="form-item flex"></div>\n        <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n      </div>\n    </form>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/ticket_auto_assignment"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n      <div class="zammad-switch zammad-switch--small js-ticketAutoAssignment">\n         <input name="ticket_auto_assignment" type="checkbox" id="ticket_auto_assignment" '),this.C("ticket_auto_assignment")&&e.push("checked"),e.push('>\n         <label for="ticket_auto_assignment"></label>\n      </div>\n    <h1>'),e.push(this.T("Auto Assignment")),e.push('<small></small></h1>\n  </div>\n</div>\n<div class="page-content">\n  <form class="settings-entry">\n    <p>'),e.push(this.T("Enable automatic assignment the first time an agent opens a ticket.")),e.push("</p>\n    <p>"),e.push(this.T("Tickets are only assigned automatically if they do not already have an owner.")),e.push('</p>\n    <div class="js-selector"></div>\n    <p>'),e.push(this.T('Define an exception of "automatic assignment" for certain users (e.g. executives).')),e.push('</p>\n    <div class="js-users"></div>\n    <button type="submit" class="btn btn--primary js-timeAccountingFilter">'),e.push(this.T("Save")),e.push('</button>\n    <button type="submit" class="btn btn--danger js-timeAccountingFilterReset">'),e.push(this.T("Reset")),e.push("</button>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/ticket_duplicate_detection"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n      <div class="zammad-switch zammad-switch--small js-ticketDuplicateDetection">\n         <input name="ticket_duplicate_detection" type="checkbox" id="ticket_duplicate_detection" '),this.C("ticket_duplicate_detection")&&e.push("checked"),e.push('>\n         <label for="ticket_duplicate_detection"></label>\n      </div>\n    <h1>'),e.push(this.T("Detect Duplicate Ticket Creation")),e.push('<small></small></h1>\n  </div>\n</div>\n<div class="page-content">\n  <form class="settings-entry">\n    <p>'),e.push(this.T("Enables a warning to users during ticket creation if there is an existing ticket with the same attributes.")),e.push('</p>\n    <div class="js-attributes"></div>\n    <button type="submit" class="btn btn--primary js-ticketDuplicateDetectionFilter">'),e.push(this.T("Save")),e.push('</button>\n    <button type="submit" class="btn btn--danger js-ticketDuplicateDetectionFilterReset">'),e.push(this.T("Reset")),e.push("</button>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/ticket_hook_position"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form class="settings-entry" id="'),e.push(n(this.setting.name)),e.push('">\n  <h2>'),e.push(this.T(this.setting.title)),e.push('</h2>\n  <p class="help-text">'),e.push(this.T("The format of the subject.")),e.push("</p>\n  <ul>\n    <li>"),e.push(this.T("|Right| means |Some Subject [Ticket#12345]|")),e.push("\n    <li>"),e.push(this.T("|Left| means |[Ticket#12345] Some Subject|")),e.push("\n    <li>"),e.push(this.T("|None| means |Some Subject| (without ticket number), in which case it recognizes follow-ups based on email headers.")),e.push('\n  </ul>\n  <div class="horizontal end">\n    <div class="js-form form-item flex"></div>\n    <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n  </div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/ticket_notifications"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Default Notifications")),e.push('</h1>\n  </div>\n</div>\n<div class="page-content">\n  <form class="settings-entry">\n    '),e.push(this.matrixTableHTML),e.push('\n    <button type="submit" class="btn btn--primary js-ticketDefaultNotifications">'),e.push(this.T("Save")),e.push('</button>\n    <button type="submit" class="btn btn--secondary js-ticketDefaultNotificationsApplyToAll">'),e.push(this.T("Apply current defaults to all agents")),e.push('</button>\n    <button type="submit" class="btn btn--danger js-ticketDefaultNotificationsReset">'),e.push(this.T("Reset to default")),e.push("</button>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/ticket_number"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="settings-entry" id="'),e.push(n(this.setting.name)),e.push('">\n  <h2>'),e.push(this.T(this.setting.title)),e.push('</h2>\n  <p class="help-text">\n  '),e.push(this.T("Selects the ticket number generator module.")),e.push("\n  <ul>\n    <li>"),e.push(this.T('|Increment| increases the ticket number. The SystemID and the counter are used with "SystemID.Counter" format (e.g. 1010138, 1010139).')),e.push("\n    <li>"),e.push(this.T('With |Date| the ticket numbers will be generated by the current date, the SystemID, and the counter. The format will be "Year.Month.Day.SystemID.Counter" (e.g. 201206231010138, 201206231010139).')),e.push('\n  </ul>\n  <form class="js-form"></form>\n  <br>\n  <div class="js-formPreferences"></div>\n  <br>\n  <label class="formGroup-label">'),e.push(this.T("Preview")),e.push('</label>\n  <div class="js-preview"></div>\n  <br>\n  <form class="horizontal end">\n    <button type="submit" class="btn btn--primary">'),e.push(this.T("Submit")),e.push("</button>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/ticket_number_date"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="js-date js-formPreferencesItem hidden" data-backend="Ticket::Number::Date">\n  <label class="formGroup-label">'),e.push(this.T("Options")),e.push("</label>\n  <div>"),e.push(this.T('With Checksum, a checksum will be appended to the counter. The format looks like "%s" (e. g. %s).',"Year.Month.Day.SystemID.Counter.CheckSum","2012070110101520, 2012070110101535")),e.push('</div>\n  <br>\n  <form class="js-formItem"></form>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/settings/ticket_number_increment"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="js-increment js-formPreferencesItem hidden" data-backend="Ticket::Number::Increment">\n  <label class="formGroup-label">'),e.push(this.T("Options")),e.push("</label>\n  <div>"),e.push(this.T('With Checksum, a checksum will be appended to the counter. The format looks like "%s" (e. g. %s).',"SystemID.Counter.CheckSum","10101384, 10101392")),e.push('</div>\n  <br>\n  <form class="js-formItem"></form>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/signup"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(e.push('<div class="signup fullscreen">\n  <div class="fullscreen-center">\n    <div class="hero-unit fullscreen-body">\n      <h1>'),e.push(this.T("Join %s",this.C("product_name"))),e.push('</h1>\n      <form>\n        <div class="form-controls">\n          <a class="btn btn--text btn--subtle js-cancel" href="#login">'),e.push(this.T("Cancel & Go Back")),e.push('</a>\n          <button class="btn btn--primary js-submit align-right">'),e.push(this.T("Create my account")),e.push("</button>\n        </div>\n      </form>\n    </div>\n  "),!_.isEmpty(this.public_links)){for(e.push("\n    <p>\n      "),r=t=0,i=(o=this.public_links).length;t<i;r=++t)s=o[r],e.push("\n        "),r>0&&e.push(" | "),e.push('\n        <a href="'),e.push(n(s.link)),e.push('" title="'),s.description?e.push(n(s.description)):e.push(n(s.title)),e.push('"'),s.new_tab&&e.push(' target="_blank"'),e.push(">"),e.push(n(s.title)),e.push("</a>\n      ");e.push("\n    </p>\n  ")}e.push('\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/signup/verify"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(e.push('<div class="signup fullscreen">\n  <div class="fullscreen-center">\n    <div class="hero-unit fullscreen-body">\n      <h1>'),e.push(this.T("Registration successful!")),e.push("</h1>\n      <p>"),e.push(this.T('Thanks for joining. Email sent to "%s".',this.email)),e.push("</p>\n      <p>"),e.push(this.T("Please click on the link in the verification email.")),e.push(" "),e.push(this.T("If you don't see the email, check other places it might be, like your junk, spam, social, or other folders.")),e.push('</p>\n      <form>\n        <input type="hidden" name="email" value="'),e.push(n(this.email)),e.push('">\n        <div class="form-controls">\n          <a class="btn btn--text btn--subtle js-cancel" href="#login">'),e.push(this.T("Go Back")),e.push('</a>\n          <button class="btn btn--primary js-submitResend align-right">'),e.push(this.T("Resend verification email")),e.push("</button>\n        </div>\n      </form>\n    </div>\n  "),!_.isEmpty(this.public_links)){for(e.push("\n    <p>\n      "),r=t=0,i=(o=this.public_links).length;t<i;r=++t)s=o[r],e.push("\n        "),r>0&&e.push(" | "),e.push('\n        <a href="'),e.push(n(s.link)),e.push('" title="'),s.description?e.push(n(s.description)):e.push(n(s.title)),e.push('"'),s.new_tab&&e.push(' target="_blank"'),e.push(">"),e.push(n(s.title)),e.push("</a>\n      ");e.push("\n    </p>\n  ")}e.push('\n  </div>\n  <div class="poweredBy">\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logo")),e.push("</a>\n    "),e.push(this.T("Powered by")),e.push('\n    <a href="https://zammad.org" target="_blank">'),e.push(this.Icon("logotype","logotype")),e.push("</a>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/sla/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("SLA")),e.push(" <small>"),e.push(this.T("Management")),e.push('</small></h1>\n  </div>\n\n  <div class="page-header-meta">\n    '),this.showDescription&&(e.push('\n      <a class="btn js-description">'),e.push(this.T("Description")),e.push("</a>\n    ")),e.push('\n    <a class="btn btn--success js-new">'),e.push(this.T("New SLA")),e.push('</a>\n  </div>\n</div>\n\n<div class="page-content">\n  '),_.isEmpty(this.slas)&&(e.push('\n  <div class="page-description">\n    '),e.push(this.description),e.push("\n  </div>\n  ")),e.push("\n\n  "),t=0,s=(o=this.slas).length;t<s;t++){for(c=o[t],e.push('\n  <div class="action" data-id="'),e.push(c.id),e.push('">\n    <div class="action-flow action-flow--row">\n      <div class="action-row">\n        <h2>'),e.push(n(c.name)),e.push('</h2>\n      </div>\n      <div class="action-block action-block--flex">\n        <div class="label">'),e.push(this.T("Filter")),e.push("</div>\n        "),i=0,r=(a=c.rules).length;i<r;i++)l=a[i],e.push("\n          "),e.push(l),e.push("<br>\n        ");e.push("\n      </div>\n      "),e.push(this.Icon("arrow-right","action-flow-icon")),e.push('\n      <div class="action-block action-block--flex">\n        <div class="label">'),e.push(this.T("Escalation Times")),e.push("</div>\n        "),c.first_response_time&&(e.push("\n          "),e.push(this.time_duration_hh_mm(c.first_response_time)),e.push(" "),e.push(this.T("hours")),e.push(" - "),e.push(this.T("First Response Time")),e.push("\n        ")),e.push("\n        "),c.response_time&&(e.push("\n          <br>\n          "),e.push(this.time_duration_hh_mm(c.response_time)),e.push(" "),e.push(this.T("hours")),e.push(" - "),e.push(this.T("Update Time")),e.push(" ("),e.push(this.T("for an agent to respond")),e.push(")\n        ")),e.push("\n        "),c.update_time&&(e.push("\n          <br>\n          "),e.push(this.time_duration_hh_mm(c.update_time)),e.push(" "),e.push(this.T("hours")),e.push(" - "),e.push(this.T("Update Time")),e.push(" ("),e.push(this.T("between agent updates")),e.push(")\n        ")),e.push("\n        "),c.solution_time&&(e.push("\n          <br>\n          "),e.push(this.time_duration_hh_mm(c.solution_time)),e.push(" "),e.push(this.T("hours")),e.push(" - "),e.push(this.T("Solution Time")),e.push("\n        ")),e.push('\n        <br>\n      </div>\n    </div>\n    <div class="action-block">\n      <div class="label">'),e.push(this.T("Calendar")),e.push("</div>\n      "),e.push(n(c.calendar.displayName())),e.push('\n    </div>\n    <div class="action-controls">\n      <div class="sla-toggle btn btn--danger btn--secondary js-delete">'),e.push(this.T("Delete")),e.push('</div>\n      <div class="sla-edit btn js-edit">'),e.push(this.T("Edit")),e.push("</div>\n    </div>\n  </div>\n  ")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ssl_certificate_binary_or_text"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="form-group">\n  <div class="formGroup-label">\n    <label for="certificate-upload">'),e.push(this.T("Upload Certificate")),e.push('</label>\n  </div>\n  <div class="controls">\n    <input name="file" type="file" id="certificate-upload">\n  </div>\n</div>\n\n<div class="or-divider">\n  <span>'),e.push(this.T("or")),e.push('</span>\n</div>\n\n<div class="form-group">\n  <div class="formGroup-label">\n    <label for="certificate-paste">'),e.push(this.T("Paste Certificate")),e.push('</label>\n  </div>\n  <div class="controls">\n    <textarea cols="25" rows="20" name="certificate" style="height: 200px;" id="certificate-paste"></textarea>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ssl_certificates"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<form>\n  <h2>"),e.push(this.T("SSL Certificates")),e.push('</h2>\n  <div class="settings-entry settings-entry--stretched js-certificatesList"></div>\n\n  <div class="btn btn--primary js-addCertificate">'),e.push(this.T("Add SSL Certificate")),e.push("</div>\n</form>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ssl_certificates_create"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){
return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <p class="alert alert--danger js-error hide"></p>\n\n  <div class="form-group">\n    <div class="formGroup-label">\n      <label for="certificate-upload">'),e.push(this.T("Upload Certificate")),e.push('</label>\n    </div>\n    <div class="controls">\n      <input name="file" type="file" id="certificate-upload">\n    </div>\n  </div>\n\n  <div class="or-divider">\n    <span>'),e.push(this.T("or")),e.push('</span>\n  </div>\n\n  <div class="form-group">\n    <div class="formGroup-label">\n      <label for="certificate-paste">'),e.push(this.T("Paste Certificate")),e.push('</label>\n    </div>\n    <div class="controls">\n      <textarea cols="25" rows="20" name="certificate" style="height: 200px;" id="certificate-paste"></textarea>\n    </div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ssl_certificates_list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<table class="settings-list settings-list--stretch">\n  <thead>\n  '),_.isEmpty(this.certificates))e.push('\n    <tr>\n      <th class="centered">\n        '),e.push(this.T("No Entries")),e.push("\n      </th>\n    </tr>\n  ");else{for(e.push("\n    <tr>\n      <th>"),e.push(this.T("Subject")),e.push("\n      <th>"),e.push(this.T("Fingerprint")),e.push("\n      <th>"),e.push(this.T("CA")),e.push("\n      <th>"),e.push(this.T("Created")),e.push("\n      <th>"),e.push(this.T("Expires")),e.push("\n      <th>"),e.push(this.T("Actions")),e.push("\n  </thead>\n  <tbody>\n    "),i=0,s=(r=this.certificates).length;i<s;i++)t=r[i],e.push('\n      <tr data-id="'),e.push(n(t.id)),e.push('">\n        <td>'),e.push(n(t.subject)),e.push("\n        <td>"),e.push(n(t.fingerprint)),e.push('\n        <td class="u-breakNormal">'),t.ca?e.push(this.T("Yes")):e.push(this.T("No")),e.push('\n        <td class="u-breakWords">'),e.push(this.datetime(t.not_before)),e.push('\n        <td class="u-breakWords">'),e.push(this.datetime(t.not_after)),e.push('\n        <td>\n          <div class="dropdown dropdown--actions">\n            <div class="btn btn--table btn--text btn--secondary js-action" data-toggle="dropdown">\n              '),e.push(this.Icon("overflow-button")),e.push('\n            </div>\n            <ul class="dropdown-menu dropdown-menu-right js-table-action-menu" role="menu">\n              <li role="presentation" data-table-action="download-public">\n                <a href="'),e.push(n(this.C("http_type"))),e.push("://"),e.push(n(this.C("fqdn"))),e.push("/api/v1/ssl_certificates/"),e.push(n(t.id)),e.push('/download" role="menuitem" tabindex="-1" download>\n                  <span class="dropdown-iconSpacer">\n                    '),e.push(this.Icon("download")),e.push("\n                  </span>\n                  "),e.push(this.T("Download Certificate")),e.push('\n                </a>\n              </li>\n              <li role="presentation" class="danger js-remove" data-table-action="remove">\n                <span class="dropdown-iconSpacer">\n                  '),e.push(this.Icon("trash")),e.push("\n                </span>\n                "),e.push(this.T("Delete")),e.push("\n              </li>\n            </ul>\n          </div>\n        </td>\n    ");e.push("\n  ")}e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/tag/edit"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form>\n  <div class="form-item">\n    <input type="text" name="name" class="" value="'),e.push(n(this.name)),e.push('" autocomplete="off">\n  </div>\n</form>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/tag/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Tags")),e.push('<small></small></h1>\n  </div>\n</div>\n<div class="page-content">\n\n  <div class="settings-entry">\n    <div class="page-header-title">\n      <div class="zammad-switch zammad-switch--small js-newTagSetting">\n         <input name="tag-new" type="checkbox" id="tag-new" '),this.C("tag_new")&&e.push("checked"),e.push('>\n         <label for="tag-new"></label>\n      </div>\n      <h2>'),e.push(this.T("New Tags")),e.push("</h2>\n    </div>\n    <p>\u26a0 "),e.push(this.T("Allow users to add new tags.")),e.push('</p>\n  </div>\n\n  <div class="settings-entry vertical">\n    <h2>'),e.push(this.T("Manage Tags")),e.push('</h2>\n    <form class="horizontal form-group formGroup--halfSize js-create">\n      <div class="form-item">\n        <input type="text" name="name" class="" autocomplete="off">\n      </div>\n      <button type="submit" class="btn btn--primary js-submit">'),e.push(this.T("Add")),e.push('</button>\n    </form>\n    <div class="js-Table"></div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/tag/table"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<table class="table table-striped table-hover">\n  <thead>\n    <tr>\n      <th>'),e.push(this.T("Name")),e.push("</th>\n      <th>"),e.push(this.T("Count")),e.push("</th>\n      <th>"),e.push(this.T("Action")),e.push("</th>\n    </tr>\n  </thead>\n  <tbody>\n    "),t=0,s=(r=this.list).length;t<s;t++)i=r[t],e.push('\n    <tr data-id="'),e.push(n(i.id)),e.push('" class="js-edit u-clickable">\n      <td class="js-name">'),e.push(n(i.name)),e.push('</td>\n      <td class="js-search"><a href="#">'),e.push(n(i.count)),e.push('</a></td>\n      <td class="js-delete no-padding"><a class="btn btn--table btn--text btn--secondary" href="#" title="'),e.push(this.Ti("Delete")),e.push('">'),e.push(this.Icon("trash")),e.push("</a></td>\n    </tr>\n    ");e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/telegram/bot_add"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<p>\n  '),e.push(this.T("You can find a tutorial on how to manage a %s in our online documentation %l.","Telegram Bot","https://admin-docs.zammad.org/en/latest/channels/telegram.html")),e.push("\n</p>\n<fieldset>\n  <h2>"),e.push(this.T("Enter your %s App Keys","Telegram")),e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="api_token">'),e.push(this.T("%s API Token","Telegram")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="api_token" type="text" name="api_token" value="" class="form-control" required autocomplete="off">\n    </div>\n  </div>\n  <h2>'),e.push(this.T("Settings")),e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="welcome">'),e.push(this.T("Welcome message")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="welcome" type="text" name="welcome" value="" placeholder="'),e.push(this.Ti("Welcome! Feel free to ask me a question!")),e.push('" class="form-control" required autocomplete="off">\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="goodbye">'),e.push(this.T("Goodbye message")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="goodbye" type="text" name="goodbye" value="" placeholder="'),e.push(this.Ti("Have a nice day.")),e.push('" class="form-control" required autocomplete="off">\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="">'),e.push(this.T("Choose the group to which messages will get added.")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <div class="js-messagesGroup"></div>\n    </div>\n  </div>\n</fieldset>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/telegram/bot_edit"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<fieldset>\n  <h2>'),e.push(this.T("Enter your %s App Keys","Telegram")),e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="api_token">'),e.push(this.T("%s API Token","Telegram")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="api_token" type="text" name="api_token" value="'),e.push(n(this.channel.options.api_token)),e.push('" class="form-control" required autocomplete="off">\n    </div>\n  </div>\n  <h2>'),e.push(this.T("Settings")),e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="welcome">'),e.push(this.T("welcome message")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="welcome" type="text" name="welcome" value="'),e.push(n(this.channel.options.welcome)),e.push('" placeholder="'),e.push(this.Ti("Welcome! Feel free to ask me a question!")),e.push('" class="form-control" required autocomplete="off">\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="goodbye">'),e.push(this.T("Goodbye message")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="goodbye" type="text" name="goodbye" value="'),e.push(n(this.channel.options.goodbye)),e.push('" placeholder="'),e.push(this.Ti("Have a nice day.")),e.push('" class="form-control" required autocomplete="off">\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="">'),e.push(this.T("Choose the group to which messages will get added.")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <div class="js-messagesGroup"></div>\n    </div>\n  </div>\n</fieldset>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/telegram/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Telegram")),e.push(" <small>"),e.push(this.T("Bots")),e.push('</small></h1>\n  </div>\n\n  <div class="page-header-meta">\n    <a class="btn btn--success js-new">'),e.push(this.T("Add Bot")),e.push('</a>\n  </div>\n</div>\n\n<div class="page-content">\n\n'),_.isEmpty(this.channels))e.push('\n  <div class="page-description">\n    <p>'),e.push(this.T("You have no configured %s right now.","Telegram Bot")),e.push("</p>\n  </div>\n");else{for(e.push("\n\n"),i=0,s=(r=this.channels).length;i<s;i++)t=r[i],e.push('\n  <div class="action '),!0!==t.active&&e.push("is-inactive"),e.push('" data-id="'),e.push(n(t.id)),e.push('">\n    <div class="action-block action-row">\n      <h2>'),e.push(this.Icon("status","supergood-color inline")),e.push(" "),e.push(n(t.options.bot.first_name)),e.push(' <span class="text-muted">@'),e.push(n(t.options.bot.username)),e.push('</span></h2>\n    </div>\n    <div class="action-flow action-flow--row">\n      <div class="action-block">\n        <h3>'),e.push(this.T("Messages")),e.push("</h3>\n        @"),e.push(n(t.options.bot.username)),e.push("\n      </div>\n      "),e.push(this.Icon("arrow-right","action-flow-icon")),e.push('\n      <div class="action-block">\n        <h3>'),e.push(this.T("Group")),e.push("</h3>\n        "),t.options&&(e.push("\n          "),e.push(n(t.options.groupName)),e.push("\n        ")),e.push('\n      </div>\n    </div>\n    <div class="action-controls">\n      <div class="btn btn--danger btn--secondary js-delete">'),e.push(this.T("Delete")),e.push("</div>\n      "),!0===t.active?(e.push('\n        <div class="btn btn--secondary js-disable">'),e.push(this.T("Disable")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--secondary js-enable">'),e.push(this.T("Enable")),e.push("</div>\n      ")),e.push('\n      <div class="btn js-edit">'),e.push(this.T("Edit")),e.push("</div>\n    </div>\n  </div>\n");e.push("\n</div>\n")}}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_overview/batch_dragger"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="batch-dragger">\n\t<div class="batch-dragger-counter js-batch-dragger-count"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_overview/batch_overlay"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="batch-overlay-backdrop js-batch-overlay-backdrop"></div>\n<div class="batch-overlay-cancel js-batch-cancel">\n  '),e.push(this.T("drag here to cancel")),e.push('\n</div>\n<div class="batch-overlay-circle batch-overlay-circle--top js-batch-macro-circle">\n  <div class="batch-overlay-circle-label">'),e.push(this.T("run macro").split(" ").join("<br>")),e.push("</div>\n  "),e.push(this.Icon("arrow-up")),e.push('\n</div>\n<div class="batch-overlay-circle batch-overlay-circle--bottom js-batch-assign-circle">\n  '),e.push(this.Icon("arrow-down")),e.push('\n  <div class="batch-overlay-circle-label">'),e.push(this.T("assign tickets").split(" ").join("<br>")),e.push('</div>\n</div>\n<div class="batch-overlay-assign batch-overlay-box js-batch-assign">\n  <div class="batch-overlay-box-inner js-batch-assign-inner"></div>\n</div>\n<div class="batch-overlay-macro batch-overlay-box js-batch-macro"></div>\n<div class="batch-overlay-assign batch-overlay-assign-group batch-overlay-box js-batch-assign-group">\n  <div class="batch-overlay-assign-group-name js-batch-assign-group-name"></div>\n  <div class="batch-overlay-box-inner js-batch-assign-group-inner"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_overview/batch_overlay_macro"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;if(e.push('<div class="batch-overlay-box-inner">\n'),_.isEmpty(this.macros))e.push('\n  <div class="batch-overlay-macro-error-message">\n    '),e.push(n(this.T("No macros available."))),e.push("\n    "),this.errorMessage&&(e.push("\n      <br>\n      "),e.push(n(this.T(this.errorMessage))),e.push("\n    ")),e.push("\n  </div>\n");else{for(e.push("\n  "),i=this.macros.length>20,e.push("\n  "),t=0,s=(o=this.macros).length;t<s;t++)r=o[t],e.push('\n    <div class="batch-overlay-macro-entry js-batch-overlay-entry js-batch-hover-target '),i&&e.push("small"),e.push('" data-action="macro" data-id="'),e.push(n(r.id)),e.push('">\n      <div class="batch-overlay-macro-entry-name">'),e.push(n(r.name)),e.push("</div>\n    </div>\n  ");e.push("\n")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_overview/batch_overlay_user_group"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(i=0,r=(a=this.users).length;i<r;i++)c=a[i],e.push('\n<div class="batch-overlay-assign-entry js-batch-overlay-entry" data-action="user_assign" data-id="'),e.push(n(c.id)),e.push('" data-group-id="'),e.push(n(this.groupId)),e.push('">\n  <div class="js-batch-hover-target">'),e.push(c.avatar(80)),e.push('</div>\n  <div class="batch-overlay-assign-entry-name">'),e.push(c.displayName()),e.push("</div>\n</div>\n");for(e.push("\n"),s=0,o=(l=this.groups).length;s<o;s++)t=l[s],e.push('\n<div class="batch-overlay-assign-entry js-batch-overlay-entry" data-action="group_assign" data-id="'),e.push(n(t.id)),e.push('">\n\t<div class="js-batch-hover-target">'),e.push(t.avatar(80)),e.push('</div>\n  <div class="batch-overlay-assign-entry-name">'),e.push(this.P(t,"name")),e.push('</div>\n  <div class="batch-overlay-assign-entry-detail">'),e.push(this.T("%s people",t.valid_users_count)),e.push("</div>\n</div>\n");e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_overview/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="js-error hide fullscreenMessage"></div>\n<div class="sidebar"></div>\n<div class="main flex">\n  <div class="overview-header"></div>\n  <div class="overview-table"></div>\n</div>\n<div class="batch-overlay js-batch-overlay"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_shared_draft_modal"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div style="display:flex">\n  <div style="margin-right: 5em">\n    <label>'),e.push(this.T("Author")),e.push('</label>\n    <div style="display: flex; align-items: center;">\n      <span class="js-avatar" style="margin-right: 0.5em"></span>\n      '),e.push(n(this.name)),e.push("\n    </div>\n  </div>\n\n  <div>\n    <label>"),e.push(this.T("Last changed")),e.push("</label>\n    <div>\n      "),e.push(this.humanTime(this.timestamp)),e.push("\n    </div>\n  </div>\n</div>\n\n<hr>\n\n<label>"),e.push(this.T("Text")),e.push('</label>\n<div class="richtext-content" dir="auto">\n  '),e.push(this.body),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="tabsSidebar-holder">\n  <div class="scrollPageHeader tabsSidebar-sidebarSpacer" style="'),e.push("rtl"===this.dir?"left":"right"),e.push(": "),e.push(this.scrollbarWidth),e.push('px">\n    <small class="ticket-number-copy-header">\n      '),e.push(this.C("ticket_hook")),e.push('<span class="ticket-number">'),e.push(this.ticket.number),e.push('</span>\n      <svg class="icon icon-clipboard ticketNumberCopy-icon u-clickable">\n        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/images/icons.svg#icon-clipboard"></use>\n      </svg>\n    </small>\n    <div class="js-ticketTitleContainer ticket-title"></div>\n    <div class="js-highlighterContainer highlighter"></div>\n    <div class="js-overviewNavigatorContainer overview-navigator"></div>\n  </div>\n  <div class="main no-padding flex tabsSidebar-sidebarSpacer tabsSidebar-tabsSpacer">\n    <div class="ticketZoom">\n      <div class="ticketZoom-controls">\n        <div class="js-settingContainer"></div>\n        <div class="spacer"></div>\n        <div class="js-highlighterContainer highlighter"></div>\n        <div class="js-overviewNavigatorContainer overview-navigator"></div>\n      </div>\n      <div class="ticketZoom-header">\n        <div class="flex vertical center">\n          <div class="flex horizontal center">\n            <div class="zIndex-1 js-avatar"></div>\n            <div class="overlap-x-6 js-avatar-organization"></div>\n          </div>\n          <div class="js-ticketTitleContainer ticket-title"></div>\n          <div class="js-ticketMetaContainer"></div>\n        </div>\n      </div>\n      <div class="ticket-article"></div>\n      <div class="article-new"></div>\n    </div>\n  </div>\n\n  <div class="tabsSidebar tabsSidebar--attributeBarSpacer vertical"></div>\n\n  <div class="attributeBar">\n    <div class="attributeBar-inner js-attributeBar"></div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/article_new"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h;if(!_.isEmpty(this.C("ui_ticket_add_article_hint"))){for(r in e.push('\n<div class="article-visibility-text-wrapper">\n'),c=this.C("ui_ticket_add_article_hint"))l=c[r],e.push('\n  <div class="article-visibility-text alert alert--warning is-hidden" role="alert" aria-hidden="true" data-type="'),e.push(n(r)),e.push('">'),e.push(this.T(l)),e.push("</div>\n");e.push("\n</div>\n")}if(e.push('\n<form class="article-add '),this.article.internal?e.push("is-internal"):e.push("is-public"),e.push('" data-type="'),e.push(n(this.article.type)),e.push('">\n  <input type="hidden" name="type" value="'),e.push(n(this.article.type)),e.push('">\n  <input type="hidden" name="internal" value="'),e.push(n(this.article.internal)),e.push('">\n  <input type="hidden" name="form_id" value="'),e.push(n(this.form_id)),e.push('">\n  <input type="hidden" name="shared_draft_id" value="'),e.push(n(this.article.shared_draft_id)),e.push('">\n  <input type="hidden" name="subtype" value="'),e.push(n(this.article.subtype)),e.push('">\n  <input type="hidden" name="in_reply_to" value="'),e.push(n(this.article.in_reply_to)),e.push('">\n  <div class="editControls">\n    <div class="js-avatar"></div>\n    <div class="editControls-item is-hidden pop-select">\n      '),this.articleTypes.length>1){for(e.push('\n        <div class="editControls-iconHolder centered js-selectedArticleType">\n          '),i=0,o=(u=this.articleTypes).length;i<o;i++)t=u[i],e.push('\n          <div class="editControls-icon js-selectableTypes'),t.icon!==this.article.icon&&e.push(" hide"),e.push('" data-type="'),e.push(t.name),e.push('">\n          '),e.push(this.Icon(t.icon)),e.push("\n          </div>\n          ");for(e.push('\n        </div>\n        <div class="pop-selector is-hidden js-articleTypes">\n          '),s=0,a=(p=this.articleTypes).length;s<a;s++)t=p[s],e.push('\n          <div class="editControls-icon pop-selectable js-articleTypeItem" data-value="'),e.push(n(t.name)),e.push('">\n            '),e.push(this.Icon(t.icon,"pop-selectable-icon")),e.push("\n          </div>\n          ");e.push("\n        </div>\n      ")}e.push("\n    </div>\n    "),this.internalSelector&&(e.push('\n    <div class="editControls-item is-hidden js-toggleVisibility js-selectInternalPublic">\n      <div class="editControls-iconHolder">\n        <div class="editControls-icon icon-internal" title="'),e.push(this.Ti("set to public")),e.push('">\n          '),e.push(this.Icon("lock")),e.push('\n        </div>\n        <div class="editControls-icon icon-public" title="'),e.push(this.Ti("set to internal")),e.push('">\n          '),e.push(this.Icon("lock-open")),e.push("\n        </div>\n      </div>\n    </div>\n    ")),e.push('\n  </div>\n  <div class="article-content bubble-gap">\n    <div class="internal-border">\n      <div class="input form-group">\n        <div class="formGroup-label">\n          <label for="">'),e.push(this.T("To")),e.push('</label>\n        </div>\n        <div class="controls"><input type="text" name="to" value="'),e.push(n(this.article.to)),e.push('" class="form-control js-mail-inputs js-to" required="required"></div>\n      </div>\n      <div class="input form-group">\n        <div class="formGroup-label">\n          <label for="">'),e.push(this.T("CC")),e.push('</label>\n        </div>\n        <div class="controls"><input type="text" name="cc" value="'),e.push(n(this.article.cc)),e.push('" class="form-control js-mail-inputs js-cc"></div>\n      </div>\n      <div class="input form-group">\n        <div class="formGroup-label">\n          <label for="">'),e.push(this.T("Subject")),e.push('</label>\n        </div>\n        <div class="controls"><input type="text" name="subject" value="'),e.push(n(this.article.subject)),e.push('" class="form-control js-mail-inputs2 js-subject"></div>\n      </div>\n      <div class="form-group js-securityOptions">\n        <div class="formGroup-label">\n          <label for="">'),e.push(this.T("Security")),e.push('</label>\n        </div>\n        <div class="horizontal">\n          <div class="btn btn--action btn--split--first js-active-toggle-type js-securityType" data-type="PGP">'),e.push(n(this.T("PGP"))),e.push('</div>\n          <div class="btn btn--action btn--split--last js-active-toggle-type js-securityType" data-type="S/MIME">'),e.push(n(this.T("S/MIME"))),e.push('</div>\n          <div class="spacer js-securityType"></div>\n          <span class="js-securityEncryptComment">\n            <div class="btn btn--action btn--split--first js-securityEncrypt js-active-toggle" disabled>'),e.push(this.Icon("lock-open","btn-inactive-icon")),e.push(this.Icon("lock","btn-active-icon")),e.push(this.T("Encrypt")),e.push('</div>\n          </span>\n          <span class="js-securitySignComment">\n            <div class="btn btn--action btn--split--last js-securitySign js-active-toggle" disabled>'),e.push(this.Icon("not-signed","btn-inactive-icon")),e.push(this.Icon("signed","btn-active-icon")),e.push(this.T("Sign")),e.push('</div>\n          </span>\n        </div>\n      </div>\n\n      <div class="textBubble js-writeArea">\n        <div class="bubble-arrow"></div>\n        <div class="js-textarea richtext-content articleNewEdit-body" dir="auto" contenteditable="true" data-name="body">'),e.push(this.article.body),e.push('</div>\n        <!-- .textBubble grows with textarea (and expanding clone) -->\n        <div class="textBubble-footer js-textSizeLimit">\n          <div class="textBubble-signatur"><span class="js-signature"></span></div>\n          <div class="textBubble-letterCount js-letterCount"></div>\n        </div>\n        <div class="attachments"></div>\n        <div class="article-attachment">\n          <div class="attachmentPlaceholder">\n            <span class="attachmentPlaceholder-hint">'),e.push(this.T("Enter Note or")),e.push('</span>\n            <span class="attachmentPlaceholder-inputHolder fileUpload">\n              '),h=_.uniqueId("fileUpload_"),e.push('\n              <input multiple="multiple" type="file" name="file" id="'),e.push(h),e.push('">\n              <label class="attachmentPlaceholder-label" for="'),e.push(h),e.push('">\n                '),e.push(this.T("select attachment\u2026")),e.push('\n              </label>\n            </span>\n          </div>\n          <div class="attachmentUpload hide">\n            <div class="horizontal">\n              <div class="u-highlight">\n                '),e.push(this.T("Uploading")),e.push(' (<span class="js-percentage">0</span>%) ...\n              </div>\n              <div class="attachmentUpload-cancel js-cancel">\n                '),e.push(this.Icon("diagonal-cross")),e.push(this.T("Cancel Upload")),e.push('\n              </div>\n            </div>\n            <div class="attachmentUpload-progressBar" style="width: 0%"></div>\n          </div>\n        </div>\n        <div class="dropArea">\n          <div class="dropArea-inner">\n            '),e.push(this.T("Drop files here")),e.push("\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/article_view"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b,_,w,k;if(b=this.article.preferences.security,e.push("\n"),b&&(e.push("\n  "),s=!0===(null!=(u=b.encryption)?u.success:void 0),e.push("\n  "),w=!0===(null!=(p=b.sign)?p.success:void 0),e.push("\n  "),i=null!=(h=b.encryption)?h.comment:void 0,e.push("\n  "),_=null!=(d=b.sign)?d.comment:void 0,e.push("\n  "),r=!1===(null!=(f=b.encryption)?f.success:void 0)&&i,e.push("\n  "),k=!1===(null!=(m=b.sign)?m.success:void 0)&&_,e.push("\n")),
e.push('\n\n<div class="article-meta-clip top">\n  <div class="article-content-meta top hide">\n    <div class="article-meta top">\n    '),this.article.from&&(e.push('\n      <div class="horizontal article-meta-row">\n        <div class="article-meta-key u-textTruncate">'),e.push(this.T("From")),e.push('</div>\n        <div class="article-meta-value flex contain-text">'),e.push(this.AddressLine(this.article.from)),e.push("</div>\n      </div>\n    ")),e.push("\n    "),this.article.reply_to&&(e.push('\n      <div class="horizontal article-meta-row">\n        <div class="article-meta-key u-textTruncate">'),e.push(this.T("Reply-To")),e.push('</div>\n        <div class="article-meta-value flex contain-text">'),e.push(this.AddressLine(this.article.reply_to)),e.push("</div>\n      </div>\n    ")),e.push("\n    "),this.article.to&&(e.push('\n      <div class="horizontal article-meta-row">\n        <div class="article-meta-key u-textTruncate">'),e.push(this.T("To")),e.push('</div>\n        <div class="article-meta-value flex contain-text">'),e.push(this.AddressLine(this.article.to)),e.push("</div>\n      </div>\n    ")),e.push("\n    "),this.article.cc&&(e.push('\n      <div class="horizontal article-meta-row">\n        <div class="article-meta-key u-textTruncate">'),e.push(this.T("CC")),e.push('</div>\n        <div class="article-meta-value flex contain-text">'),e.push(this.AddressLine(this.article.cc)),e.push("</div>\n      </div>\n    ")),e.push("\n    "),this.article.subject&&(e.push('\n      <div class="horizontal article-meta-row">\n        <div class="article-meta-key u-textTruncate">'),e.push(this.T("Subject")),e.push('</div>\n        <div class="article-meta-value flex contain-text">'),e.push(n(this.article.subject)),e.push("</div>\n      </div>\n    ")),e.push("\n      "),(s||w||r||k)&&(e.push('\n        <div class="horizontal article-meta-row">\n          <div class="article-meta-key u-textTruncate">'),e.push(this.T("Security")),e.push('</div>\n          <div class="article-meta-value flex contain-text">\n            '),e.push(b.type),e.push(":\n            "),(s||r)&&(e.push('\n              <span title="'),e.push(this.Ti(i)),e.push('">\n                '),s?(e.push("\n                  "),e.push(this.Icon("lock","article-meta-icon")),e.push("\n                  "),e.push(this.T("Encrypted")),(w||k)&&e.push(","),e.push("\n                ")):(e.push("\n                  "),e.push(this.Icon("encryption-error","article-meta-icon")),e.push("\n                  "),e.push(this.T("Encryption error")),(w||k)&&e.push(","),e.push("\n                ")),e.push("\n              </span>\n            ")),e.push("\n            "),(w||k)&&(e.push('\n              <span title="'),e.push(this.Ti(_)),e.push('">\n                '),w?(e.push("\n                  "),e.push(this.Icon("signed","article-meta-icon")),e.push("\n                  "),e.push(this.T("Signed")),e.push("\n                ")):(e.push("\n                  "),e.push(this.Icon("not-signed","article-meta-icon")),e.push("\n                  "),e.push(this.T("Sign error")),e.push("\n                ")),e.push("\n              </span>\n            ")),e.push("\n          </div>\n        </div>\n      ")),e.push("\n    </div>\n  </div>\n</div>\n"),(s||w||r||k)&&(e.push('\n  <div class="article-meta-permanent">\n    '),r||k?(e.push('\n      <div class="alert alert--warning">\n        '),e.push(this.Icon("not-signed")),e.push(" "),e.push(this.T("Security Error")),e.push("\n        "),k&&(e.push('\n          <div class="alert-row">'),e.push(this.T("Sign:")),e.push(" "),e.push(this.T(null!=(g=b.sign)?g.comment:void 0)),e.push("</div>\n        ")),e.push("\n        "),r&&(e.push('\n          <div class="alert-row">'),e.push(this.T("Encryption:")),e.push(" "),e.push(this.T(null!=(v=b.encryption)?v.comment:void 0)),e.push("</div>\n        ")),e.push('\n        <div class="btn btn--action btn--small js-securityRetryProcess">'),e.push(this.T("Retry security process")),e.push("</div>\n      </div>\n    ")):(w||s)&&(e.push('\n      <div class="alert alert--blank horizontal">\n        '),s&&(e.push('\n          <span title="'),e.push(this.T("Encrypted")),e.push('">'),e.push(this.Icon("lock")),e.push("</span>\n        ")),e.push("\n        "),w&&(e.push('\n          <span title="'),e.push(this.T("Signed")),e.push('">'),e.push(this.Icon("signed")),e.push("</span>\n        ")),e.push("\n      </div>\n    ")),e.push("\n  </div>\n")),e.push('\n<div class="article-content">\n  '),"Agent"!==this.article.sender.name?(e.push("\n  "),"left",e.push("\n  ")):(e.push("\n  "),"right",e.push("\n  ")),e.push('\n  <div class="js-avatar"></div>\n  <div class="bubble-gap">\n    <div class="internal-border">\n      <div class="textBubble">\n        <div class="bubble-arrow"></div>\n        <div class="textBubble-content" id="article-content-'),e.push(n(this.article.id)),e.push('" data-id="'),e.push(n(this.article.id)),e.push('">\n          <div class="richtext-content" dir="auto">'),e.push(this.article.html),e.push('</div>\n          <div class="textBubble-overflowContainer hide">\n            <div class="btn btn--text js-toggleFold">'),e.push(this.T("See more")),e.push("</div>\n          </div>\n        </div>\n        "),e.push(this.attachments),e.push('\n      </div>\n    </div>\n  </div>\n</div>\n<div class="article-meta-clip bottom">\n  <div class="article-content-meta bottom hide">\n    <div class="article-meta bottom">\n      <div class="horizontal article-meta-row">\n        <div class="article-meta-key">'),e.push(this.T("Channel")),e.push('</div>\n        <div class="article-meta-value">\n          '),a=this.article.type.name.split(" "),e.push("\n          "),e.push(this.Icon(a[0],"article-meta-icon")),e.push("\n          "),e.push(this.T(this.article.type.name)),e.push('\n          <div class="article-meta-links">\n          '),this.links){for(e.push("\n            "),t=0,e.push("\n            "),o=0,l=(y=this.links).length;o<l;o++)c=y[o],e.push("\n              "),t>0&&e.push("|"),e.push('\n              <a class="text-muted" href="'),e.push(c.url),e.push('" target="'),e.push(c.target),e.push('">'),e.push(this.T(c.name)),e.push("</a>\n              "),t=1,e.push("\n            ");e.push("\n          ")}e.push('\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>\n\n<div class="js-article-actions"></div>\n\n<a href="'),e.push(this.C("http_type")),e.push("://"),e.push(this.C("fqdn")),e.push("/#ticket/zoom/"),e.push(this.article.ticket_id),e.push("/"),e.push(this.article.id),e.push('"><small class="task-subline">'),e.push(this.humanTime(this.article.created_at)),e.push("</small></a>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/article_view_actions"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="article-content article-actions horizontal">\n  '),i=0,s=(r=this.actions).length;i<s;i++)t=r[i],e.push('\n    <a href="'),e.push(n(t.href)),e.push('" data-type="'),e.push(n(t.type)),e.push('" class="article-action js-ArticleAction u-clickable'),t.class&&(e.push(" "),e.push(n(t.class))),e.push('">\n      '),e.push(this.Icon(t.icon,"article-action-icon")),e.push('<span class="article-action-name">'),e.push(this.T(t.name)),e.push("</span>\n    </a>\n  ");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/article_view_delivery_failed"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="article-meta-clip"></div>\n<div class="article-content">\n  <div class="small task-subline alert alert--warning">\n    '),e.push(this.T("Delivery failed:")),e.push(' "'),e.push(n(this.article.body)),e.push('"\n  </div>\n</div>\n<div class="article-meta-clip"></div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/article_view_system"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="small task-subline">\n"'),e.push(n(this.article.subject)),e.push('" -&gt; "'),e.push(n(this.article.to)),e.push('"\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/attribute_bar"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="attributeBar-avatars horizontal js-avatars hidden-xs"></div>\n\n<div class="attributeBar-draft-spacer hidden-xs"></div>\n\n<div class="attributeBar-draft '),this.sharedButtonVisible||e.push("hide"),e.push(' buttonDropdown btn js-draft align-left">\n  <span class="attributeBar-draft--available">\n    <span class="hidden-xs">\n      '),e.push(this.Icon("note")),e.push("\n      "),e.push(this.T("Draft available")),e.push('\n    </span>\n\n    <span class="visible-xs">\n      '),e.push(this.Icon("note")),e.push('\n    </span>\n  </span>\n\n  <span class="attributeBar-draft--saving hide">\n    '),e.push(this.Icon("reload")),e.push("\n    "),e.push(this.T("Sharing draft\u2026")),e.push('\n  </span>\n</div>\n\n<div class="flex"></div>\n\n<div class="attributeBar-reset buttonDropdown btn js-reset '),this.resetButtonShown||e.push("hide"),e.push('"><span>'),e.push(this.T("Discard your unsaved changes.")),e.push('</span></div>\n<div class="buttonDropdown dropdown dropdown--actions dropup'),this.ticket.editable()||e.push(" hide"),e.push('">\n  <div class="btn btn--text btn--icon--last" data-toggle="dropdown">\n    <span class="js-secondaryActionButtonLabel"></span> '),e.push(this.Icon("arrow-up")),e.push('\n  </div>\n  <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="secondaryAction">\n    <li class="js-secondaryAction" role="menuitem">\n      <span class="js-secondaryActionLabel" data-type="closeTab">'),e.push(this.T("Close tab")),e.push('</span>\n      <span class="dropdown-selectedSpacer js-selectedIcon">\n        '),e.push(this.Icon("checkmark")),e.push('\n      </span>\n    <li class="js-secondaryAction" role="menuitem">\n      <span class="js-secondaryActionLabel" data-type="closeTabOnTicketClose">'),e.push(this.T("Close tab on ticket close")),e.push('</span>\n      <span class="dropdown-selectedSpacer js-selectedIcon">\n        '),e.push(this.Icon("checkmark")),e.push("\n      </span>\n    "),this.overview_id&&(e.push('\n    <li class="js-secondaryAction" role="menuitem">\n      <span class="js-secondaryActionLabel" data-type="closeNextInOverview">'),e.push(this.T("Next in overview")),e.push('</span>\n      <span class="dropdown-selectedSpacer js-selectedIcon">\n        '),e.push(this.Icon("checkmark")),e.push("\n      </span>\n    ")),e.push('\n    <li class="js-secondaryAction" role="menuitem">\n      <span class="js-secondaryActionLabel" data-type="stayOnTab">'),e.push(this.T("Stay on tab")),e.push('</span>\n      <span class="dropdown-selectedSpacer js-selectedIcon">\n        '),e.push(this.Icon("checkmark")),e.push('\n      </span>\n  </ul>\n</div>\n<form class="buttonDropdown'),this.ticket.editable()||e.push(" hide"),e.push('">\n'),this.macroDisabled&&this.sharedDraftsDisabled)e.push('\n  <button class="btn btn--primary js-submit"><span>'),e.push(this.T("Update")),e.push("</span></button>\n");else{if(e.push('\n  <div class="buttonDropdown dropdown dropup js-submitDropdown">\n    <button class="btn btn--primary btn--split--first js-submit"><span>'),e.push(this.T("Update")),e.push('</span></button>\n    <button class="btn btn--primary btn--slim btn--only-icon btn--split--last js-openDropdownMacro">'),e.push(this.Icon("arrow-up")),e.push('</button>\n      <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="userAction">\n        '),this.sharedDraftsDisabled||(e.push('\n          <li class="dropdown-header" role="menuitem">'),e.push(this.T("Draft")),e.push('</li>\n          <li class="js-dropdownActionSaveDraft" role="menuitem">'),e.push(this.T("Save Draft")),e.push("</li>\n        ")),e.push("\n\n        "),!this.macroDisabled){for(e.push('\n          <li class="dropdown-header" role="menuitem">'),e.push(this.T("Macros")),e.push("</li>\n          "),t=0,i=(r=this.macros).length;t<i;t++)s=r[t],e.push('\n            <li class="js-dropdownActionMacro" role="menuitem" data-id="'),e.push(n(s.id)),e.push('">'),e.push(this.T(s.displayName())),e.push("\n          ");e.push("\n        ")}e.push("\n    </ul>\n  </div>\n")}e.push("\n</form>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/highlighter"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;for(e.push('<div class="btn btn--action btn--split--first js-highlight centered">\n  '),e.push(this.Icon("marker","js-highlight-icon")),e.push('\n</div>\n<div class="dropdown dropdown--actions">\n  <div class="btn btn--action btn--split--last btn--slim btn--icon-only centered" data-toggle="dropdown" aria-expanded="true">\n    '),e.push(this.Icon("arrow-down")),e.push('\n  </div>\n  <ul class="dropdown-menu dropdown-menu-right" role="menu">\n    '),i=s=0,r=(o=this.colors).length;s<r;i=++s)t=o[i],e.push('\n    <li role="presentation" class="dropdown-highlight-list">\n      <a role="menuitem" tabindex="-1" class="js-highlightColor" data-key="'),e.push(n(i)),e.push('">\n        <span class="dropdown-iconSpacer">\n          <span class="color-swatch icon" style="color: '),e.push(n(t.color)),e.push('"></span>\n        </span>\n        '),e.push(this.Ti(t.name)),e.push('\n        <span class="dropdown-selectedSpacer js-selectedIcon'),i===this.activeColorIndex&&e.push(n(" is-selected")),e.push('">\n          '),e.push(this.Icon("checkmark")),e.push("\n        </span>\n      </a>\n    ");e.push("\n  </ul>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/meta"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<small class="task-subline">\n  <span class="ticket-number-copy">\n    '),e.push(this.C("ticket_hook")),e.push('<span class="ticket-number js-objectNumber" data-number="'),e.push(this.C("ticket_hook")),e.push(n(this.ticket.number)),e.push('">'),e.push(n(this.ticket.number)),e.push('</span>\n    <svg class="icon icon-clipboard ticketNumberCopy-icon u-clickable">\n      <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/images/icons.svg#icon-clipboard"></use>\n    </svg>\n  </span>\n  - '),e.push(this.T("created")),e.push(" "),e.push(this.humanTime(this.ticket.created_at)),e.push("\n\n"),this.isCustomer||(e.push("\n  "),this.ticket.escalation_at&&(e.push(' - <span class="escalation-popover" data-id="'),e.push(n(this.ticket.id)),e.push('">'),e.push(this.T("escalation")),e.push(" "),e.push(this.humanTime(this.ticket.escalation_at,!0,"",!1))),e.push("</span>\n")),e.push("\n</small>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/overview_navigator"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="pagination-counter" title="'),e.push(this.Ti(this.title)),e.push('">\n  <span class="pagination-item-current">'),e.push(n(this.current_position)),e.push('</span>/<span class="pagination-total-items">'),e.push(n(this.total_count)),e.push('</span>\n</div>\n<div class="pagination horizontal">\n  <a class="btn btn--action btn--split--first'),this.previous||e.push(n(" is-disabled")),e.push('" href="'),this.previous&&e.push(this.previous.uiUrl()),e.push('"'),this.previous&&(e.push(' data-id="'),e.push(this.previous.id),e.push('"')),e.push(' title="'),e.push(this.Ti("Previous in overview")),e.push('">\n    '),this.previous?(e.push("\n      "),e.push(this.Icon("arrow-left")),e.push("\n    ")):(e.push("\n      "),e.push(this.Icon("arrow-left","arrow--disabled")),e.push("\n    ")),e.push('\n  </a>\n  <a class="btn btn--action btn--split--last'),this.next||e.push(n(" is-disabled")),e.push('" href="'),this.next&&e.push(this.next.uiUrl()),e.push('"'),this.next&&(e.push(' data-id="'),e.push(this.next.id),e.push('"')),e.push(' title="'),e.push(this.Ti("Next in overview")),e.push('">\n    '),this.next?(e.push("\n      "),e.push(this.Icon("arrow-right")),e.push("\n    ")):(e.push("\n      "),e.push(this.Icon("arrow-right","arrow--disabled")),e.push("\n    ")),e.push("\n  </a>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/setting"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="btn btn--action js-setting centered">\n  '),e.push(this.Icon("cog","dropdown-icon")),e.push("\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/sidebar_article_attachment"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;for(e.push('<div class="attachments-block js-attachments">\n  '),s=0,r=(o=this.ticketAttachments).length;s<r;s++)i=o[s],e.push("\n    "),t=this.ContentOrMimeType(i.attachment),e.push('\n    <a class="attachment attachment--preview  '),this.ContentTypeIcon(t)&&e.push(this.ContentTypeIcon(t)),e.push('" data-preview-url="'),e.push(n(i.attachment.preview_url)),e.push('" data-id="'),e.push(n(i.attachment.id)),e.push('" target="_blank" href="'),e.push(n(App.Config.get("api_path"))),e.push("/ticket_attachment/"),e.push(n(i.article.ticket_id)),e.push("/"),e.push(n(i.article.id)),e.push("/"),e.push(n(i.attachment.id)),e.push('?disposition=attachment" data-type="attachment"'),this.canDownload(t)&&e.push(" download"),e.push('>\n      <div class="attachment-icon">\n      '),t&&this.ContentTypeIcon(t)?(e.push("\n        "),this.canPreview(t)?(e.push('\n          <img src="'),e.push(n(App.Config.get("api_path"))),e.push("/ticket_attachment/"),e.push(n(i.article.ticket_id)),e.push("/"),e.push(n(i.article.id)),e.push("/"),e.push(n(i.attachment.id)),e.push('?view=preview">\n        ')):(e.push("\n          "),e.push(this.Icon(this.ContentTypeIcon(t))),e.push("\n        ")),e.push("\n      ")):(e.push("\n        "),e.push(this.Icon("file-unknown")),e.push("\n      ")),e.push('\n      </div>\n      <div class="attachment-text">\n        <span class="attachment-name u-highlight">'),e.push(n(i.attachment.filename)),e.push('</span>\n        <div class="attachment-size">'),e.push(this.humanTime(i.article.created_at)),e.push(" ("),e.push(this.humanFileSize(i.attachment.size)),e.push(")</div>\n      </div>\n      "),"file-calendar"===this.ContentTypeIcon(t)&&e.push('\n        <button class="btn js-preview" type="button">Preview</button>\n      '),e.push("\n    </a>\n  ");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/sidebar_git_issue"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;for(t=0,o=(l=this.issues).length;t<o;t++){if(i=l[t],e.push('\n  <div class="sidebar-git-issue-delete">\n    <span class="list-item-delete js-delete" data-issue-id="'),e.push(n(i.url)),e.push('" data-type="remove">\n      '),e.push(this.Icon("diagonal-cross")),e.push('\n    </span>\n  </div>\n  <div class="sidebar-git-issue-content">\n    <div class="sidebar-block">\n      <a href="'),e.push(i.url),e.push('" target="_blank">\n        <span class="icon-holder" title="'),e.push(n(this.T(i.icon_state))),e.push('">\n          '),e.push(this.Icon("task-state",i.icon_state)),e.push("\n        </span>\n        #"),e.push(n(i.id)),e.push(" "),e.push(n(i.title)),e.push("\n      </a>\n    </div>\n  "),i.milestone&&(e.push('\n    <div class="sidebar-block">\n      <label>'),e.push(this.T("Milestone")),e.push("</label>\n      "),e.push(n(this.T(i.milestone))),e.push("\n    </div>\n  ")),e.push("\n  "),i.assignees.length>0&&(e.push('\n    <div class="sidebar-block">\n      <label>'),e.push(this.T("Assignee")),e.push("</label>\n      "),e.push(n(i.assignees.join(", "))),e.push("\n    </div>\n  ")),e.push("\n  "),i.labels.length>0){for(e.push('\n    <div class="sidebar-block">\n      <label>'),e.push(this.T("Labels")),e.push("</label>\n      "),s=0,a=(c=i.labels).length;s<a;s++)r=c[s],e.push('<span class="badge" style="color: '),e.push(r.text_color),e.push("; background-color: "),e.push(r.color),e.push('">'),e.push(n(r.title)),e.push("</span> ");e.push("\n    </div>\n  ")}e.push('\n  </div>\n  <hr class="clearfix">\n')}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/sidebar_idoit"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(t=0,i=(r=this.objects).length;t<i;t++)s=r[t],e.push('\n  <div class="sidebar-block">\n    <label class="horizontal">\n      '),e.push(this.T("ID:")),e.push(" "),e.push(this.T(s.id)),e.push('\n      <div class="list-item-delete js-delete" data-object-id="'),e.push(n(s.id)),e.push('" data-type="remove">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n    </label>\n    <a href="'),e.push(s.link),e.push('" target="_blank">'),e.push(n(s.title)),e.push("<br></a>\n    "),e.push(this.T("Status:")),e.push(" "),e.push(n(s.cmdb_status_title)),e.push("<br>\n    "),e.push(this.T("Type:")),e.push(" "),e.push(n(s.type_title)),e.push("<br>\n  </div>\n");e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/sidebar_ticket"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<form>\n  <fieldset class="edit"></fieldset>\n</form>\n<div class="js-tags tags"></div>\n<div class="js-links links"></div>\n<div class="js-linkKbAnswers link_kb_answers"></div>\n<div class="js-timeUnit time-units"></div>\n<div class="js-subscriptions"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/time_unit"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push("<div>\n  <label>"),e.push(this.T("Accounted Time")),e.push('</label>\n  <div class="accounted-time-value-container">\n    <div class="accounted-time-value-row">\n      <div class="accounted-time-value-item">'),e.push(this.T("Total")),e.push('</div>\n      <div class="accounted-time-value-item">'),e.push(n(this.ticket.time_unit)),e.push("</div>\n      "),this.displayUnit&&(e.push('\n      <div class="accounted-time-value-item">\n        <span class="text-muted">'),e.push(this.T(this.displayUnit)),e.push("</span>\n      </div>\n      ")),e.push("\n    </div>\n    "),i=0,s=(r=this.list).length;i<s;i++)t=r[i],e.push('\n    <div class="accounted-time-value-row">\n      <div class="accounted-time-value-item" title="'),e.push(n(this.T(t[0]))),e.push('">'),e.push(n(this.T(t[0]))),e.push('</div>\n      <div class="accounted-time-value-item">'),e.push(n(parseFloat(t[1]).toFixed(1))),e.push("</div>\n      "),this.displayUnit&&(e.push('\n      <div class="accounted-time-value-item">\n        <span class="text-muted">'),e.push(this.T(this.displayUnit)),e.push("</span>\n      </div>\n      ")),e.push("\n    </div>\n    ");e.push("\n    "),this.showMore&&(e.push('\n    <div>\n      <a href="#" class="js-showMoreEntries">'),e.push(this.T("show more")),e.push("</a>\n    </div>\n    ")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/ticket_zoom/title"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div contenteditable="true" class="ticket-title-update js-objectTitle" data-placeholder="'),e.push(this.Ti("Enter Title\u2026")),e.push('">'),e.push(n(this.object.title||"-")),e.push("</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/time_accounting/accounted_time"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u;for(e.push('<div class="settings-entry--stretched">\n  <h2>'),e.push(this.T("Accounted Time")),e.push('</h2>\n  <div class="well">\n    <div class="btn-group btn-group--full" role="group" aria-label="">\n      '),s=0,o=(c=this.timeRangeYear).length;s<o;s++)i=c[s],e.push('\n        <div class="btn btn--text btn--large js-timePickerYear'),this.year===i&&e.push(" is-selected"),e.push('" data-type="'),e.push(n(i)),e.push('">'),e.push(n(i)),e.push("</div>\n      ");for(e.push('\n    </div>\n\n    <div class="btn-group btn-group--full" role="group" aria-label="">\n      '),t=r=0,a=(u=this.timeRangeMonth).length;r<a;t=++r)l=u[t],e.push('\n        <div class="btn btn--text btn--large js-timePickerMonth'),this.month===t+1&&e.push(" is-selected"),e.push('" data-type="'),e.push(n(t+1)),e.push('">'),e.push(n(this.T(l))),e.push("</div>\n      ");e.push("\n    </div>\n  </div>\n  <h3>"),e.push(this.T("Activity")),e.push(' <a href="'),e.push(this.C("api_path")),e.push("/time_accounting/log/by_activity/"),e.push(n(this.year)),e.push("/"),e.push(n(this.month)),e.push('?download=true" class="js-downloadByActivity btn btn--action" data-type="attachment">'),e.push(this.Icon("download")),e.push("<span>"),e.push(this.T("Download all records")),e.push('</span></a></h3>\n  <div class="js-tableActivity"></div>\n  <br>\n  <h3>'),e.push(this.T("Ticket")),e.push(' <a href="'),e.push(this.C("api_path")),e.push("/time_accounting/log/by_ticket/"),e.push(n(this.year)),e.push("/"),e.push(n(this.month)),e.push('?download=true" class="js-downloadByTicket btn btn--action" data-type="attachment">'),e.push(this.Icon("download")),e.push("<span>"),e.push(this.T("Download all records")),e.push('</a></span></h3>\n  <div class="js-tableTicket"></div>\n  <br>\n  <h3>'),e.push(this.T("Customer")),e.push(' <a href="'),e.push(this.C("api_path")),e.push("/time_accounting/log/by_customer/"),e.push(n(this.year)),e.push("/"),e.push(n(this.month)),e.push('?download=true" class="js-downloadByCustomer btn btn--action" data-type="attachment">'),e.push(this.Icon("download")),e.push("<span>"),e.push(this.T("Download all records")),e.push('</span></a></h3>\n  <div class="js-tableCustomer"></div>\n  <br>\n  <h3>'),e.push(this.T("Organization")),e.push(' <a href="'),e.push(this.C("api_path")),e.push("/time_accounting/log/by_organization/"),e.push(n(this.year)),e.push("/"),e.push(n(this.month)),e.push('?download=true" class="js-downloadByOrganization btn btn--action" data-type="attachment">'),e.push(this.Icon("download")),e.push("<span>"),e.push(this.T("Download all records")),e.push('</span></a></h3>\n  <div class="js-tableOrganization"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/time_accounting/by_activity"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(this.rows.length){for(e.push('\n<table class="table table-striped table-hover">\n  <thead>\n  <tr>\n    <th>'),e.push(this.T("Ticket#")),e.push("\n    <th>"),e.push(this.T("Title")),e.push("\n    <th>"),e.push(this.T("Customer")),e.push("\n    <th>"),e.push(this.T("Organization")),e.push("\n    <th>"),e.push(this.T("Agent")),e.push("\n    <th>"),e.push(this.T("Time Units")),e.push("\n    "),this.C("time_accounting_types")&&(e.push("\n      <th>"),
e.push(this.T("Activity Type")),e.push("\n    ")),e.push("\n    <th>"),e.push(this.T("Created At")),e.push("\n  </thead>\n  <tbody>\n  "),t=0,i=(s=this.rows.slice(-20)).length;t<i;t++)r=s[t],e.push('\n  <tr>\n    <td><a href="#ticket/zoom/'),e.push(r.ticket.id),e.push('">'),e.push(n(r.ticket.number)),e.push('</a>\n    <td title="'),e.push(n(r.ticket.title)),e.push('">'),e.push(n(r.ticket.title||"-")),e.push("\n    <td>"),e.push(n(r.customer)),e.push("\n    <td>"),e.push(n(r.organization)),e.push("\n    <td>"),e.push(n(r.agent)),e.push("\n    <td>"),e.push(n(r.time_unit)),e.push("\n    "),this.C("time_accounting_types")&&(e.push("\n      <td>"),e.push(n(r.type)),e.push("\n    ")),e.push("\n    <td>"),e.push(this.humanTime(r.ticket.created_at)),e.push("\n  ");e.push("\n  </tbody>\n</table>\n"),this.rows.length>20&&(e.push('\n  <p class="help-text">'),e.push(this.T("Only the 20 most recent records are displayed. Download to view the full list.")),e.push("</p>\n")),e.push("\n</div>\n")}else e.push('\n  <table class="settings-list settings-list--stretch settings-list--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n");e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/time_accounting/by_customer"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(this.rows.length){for(e.push('\n<table class="table table-striped table-hover">\n  <thead>\n  <tr>\n    <th>'),e.push(this.T("Customer")),e.push("\n    <th>"),e.push(this.T("Organization")),e.push("\n    <th>"),e.push(this.T("Time Units")),e.push("\n  </thead>\n  <tbody>\n  "),t=0,i=(s=this.rows.slice(-20)).length;t<i;t++)r=s[t],e.push('\n  <tr>\n    <td><a href="#user/profile/'),e.push(r.customer.id),e.push('">'),e.push(n(r.customer.email)),e.push("</a>\n    <td>"),r.organization&&e.push(n(r.organization.name)),e.push("\n    <td>"),e.push(n(r.time_unit)),e.push("\n  ");e.push("\n  </tbody>\n</table>\n"),this.rows.length>20&&(e.push('\n  <p class="help-text">'),e.push(this.T("Only the 20 most recent records are displayed. Download to view the full list.")),e.push("</p>\n")),e.push("\n</div>\n")}else e.push('\n  <table class="settings-list settings-list--stretch settings-list--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n");e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/time_accounting/by_organization"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(this.rows.length){for(e.push('\n<table class="table table-striped table-hover">\n  <thead>\n  <tr>\n    <th>'),e.push(this.T("Organization")),e.push("\n    <th>"),e.push(this.T("Time Units")),e.push("\n  </thead>\n  <tbody>\n  "),t=0,i=(s=this.rows.slice(-20)).length;t<i;t++)r=s[t],e.push('\n  <tr>\n    <td><a href="#organization/profile/'),e.push(r.organization.id),e.push('">'),e.push(n(r.organization.name)),e.push("</a>\n    <td>"),e.push(n(r.time_unit)),e.push("\n  ");e.push("\n  </tbody>\n</table>\n"),this.rows.length>20&&(e.push('\n  <p class="help-text">'),e.push(this.T("Only the 20 most recent records are displayed. Download to view the full list.")),e.push("</p>\n")),e.push("\n</div>\n")}else e.push('\n  <table class="settings-list settings-list--stretch settings-list--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n");e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/time_accounting/by_ticket"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(this.rows.length){for(e.push('\n<table class="table table-striped table-hover">\n  <thead>\n  <tr>\n    <th>'),e.push(this.T("Ticket#")),e.push("\n    <th>"),e.push(this.T("Title")),e.push("\n    <th>"),e.push(this.T("Customer")),e.push("\n    <th>"),e.push(this.T("Organization")),e.push("\n    <th>"),e.push(this.T("Agent")),e.push("\n    <th>"),e.push(this.T("Time Units")),e.push("\n    <th>"),e.push(this.T("Time Units Total")),e.push("\n    <th>"),e.push(this.T("Created At")),e.push("\n    <th>"),e.push(this.T("Closed At")),e.push("\n  </thead>\n  <tbody>\n  "),t=0,i=(s=this.rows.slice(-20)).length;t<i;t++)r=s[t],e.push('\n  <tr>\n    <td><a href="#ticket/zoom/'),e.push(r.ticket.id),e.push('">'),e.push(n(r.ticket.number)),e.push('</a>\n    <td title="'),e.push(n(r.ticket.title)),e.push('">'),e.push(n(r.ticket.title||"-")),e.push("\n    <td>"),e.push(n(r.customer)),e.push("\n    <td>"),e.push(n(r.organization)),e.push("\n    <td>"),e.push(n(r.agent)),e.push("\n    <td>"),e.push(n(r.time_unit)),e.push("\n    <td>"),e.push(n(r.ticket.time_unit)),e.push("\n    <td>"),e.push(this.humanTime(r.ticket.created_at)),e.push("\n    <td>"),e.push(this.humanTime(r.ticket.close_at)),e.push("\n  ");e.push("\n  </tbody>\n</table>\n"),this.rows.length>20&&(e.push('\n  <p class="help-text">'),e.push(this.T("Only the 20 most recent records are displayed. Download to view the full list.")),e.push("</p>\n")),e.push("\n</div>\n")}else e.push('\n  <table class="settings-list settings-list--stretch settings-list--placeholder">\n    <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n  </table>\n");e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/time_accounting/settings"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;if(e.push('<div class="settings-entry">\n  <div class="form-group">\n    <div class="page-header-title">\n      <h2>'),e.push(this.T("Selector")),e.push("</h2>\n    </div>\n    <p>"),e.push(this.T("Show time accounting dialog when updating matching tickets.")),e.push('</p>\n    <div class="js-selector"></div>\n  </div>\n\n  <div class="form-group">\n    <div class="page-header-title">\n      <h2>'),e.push(this.T("Unit")),e.push("</h2>\n    </div>\n    <p>"),e.push(this.T("Defines the unit to be shown next to the time accounting input field.")),e.push('</p>\n    <div class="formGroup-label">\n      <label for="timeAccountingUnit">'),e.push(this.T("Time accounting unit")),e.push('</label>\n    </div>\n    <div class="form-controls form-controls--inline">\n      <div class="controls controls--select">\n        <select id="timeAccountingUnit" class="form-control">\n          '),this.timeUnits){for(e.push("\n            "),t=0,i=(s=this.timeUnits).length;t<i;t++)r=s[t],e.push('\n              <option value="'),e.push(n(r.value)),e.push('" '),r.value===this.timeAccountingUnit&&e.push("selected"),e.push(">"),e.push(n(this.T(r.display))),e.push("</option>\n            ");e.push("\n          ")}e.push("\n        </select>\n        "),e.push(this.Icon("arrow-down")),e.push('\n      </div>\n      <div class="controls controls--grow">\n        <input id="timeAccountingCustomUnit" class="form-control" type="text" value="'),e.push(n(this.timeAccountingCustomUnit)),e.push('" style="'),"custom"!==this.timeAccountingUnit&&e.push("display: none"),e.push('">\n      </div>\n    </div>\n    <p class="help-text">'),e.push(this.T("The chosen unit will be used for display only and will not affect stored values.")),e.push('</p>\n  </div>\n\n  <div class="double-spacer"></div>\n\n  <button type="submit" class="btn btn--primary js-timeAccountingSettings">'),e.push(this.T("Save")),e.push('</button>\n  <button type="submit" class="btn btn--danger js-timeAccountingSettingsReset">'),e.push(this.T("Reset")),e.push("</button>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/time_accounting/types"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="settings-entry">\n  <div class="form-group">\n    <div class="page-header-title">\n      <h2>'),e.push(this.T("Activity Type")),e.push("</h2>\n    </div>\n    <p>"),e.push(this.T("Enable activity type selection. This would allow agents to select one of the types below when adding accounted time.")),e.push('</p>\n    <div class="js-types"></div>\n  </div>\n  <button type="submit" class="btn btn--primary js-timeAccountingTypes">'),e.push(this.T("Save")),e.push('</button>\n  <button type="submit" class="btn btn--danger js-timeAccountingTypesReset">'),e.push(this.T("Reset")),e.push('</button>\n</div>\n\n<div class="js-table-container"></div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/translation/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Translations")),e.push(" <small>"),e.push(n(this.currentLanguage)),e.push('</small></h1>\n  </div>\n  <div class="page-header-meta">\n    <a class="btn btn--danger hidden js-changes js-resetChanges">'),e.push(this.T("Reset changes")),e.push('</a>\n  </div>\n</div>\n<div class="page-content">\n\n  <div class="box box--message">\n    <h2>'),e.push(this.T("Contributing Translations")),e.push("</h2>\n    <p>"),e.push(this.T('Starting with Zammad 5.1, translations can be contributed exclusively via "translations.zammad.org" %l.',"https://translations.zammad.org")),e.push("</p>\n    <p>\n      "),e.push(this.T("While it will be no longer possible to directly push changed translations from Zammad, they can be contributed in a very convenient user interface based on Weblate.")),e.push('\n      </p>\n  </div>\n\n  <div class="box box--message">\n    <h2>'),e.push(this.T("Inline translation")),e.push("</h2>\n    <p>"),e.push(this.T('To make translations easier you can enable and disable the inline translation feature by pressing "%s".',this.inlineTranslationKey)),e.push("</p>\n    <p>"),e.push(this.T("Text with disabled inline translations looks like")),e.push('\u2002<button class="btn btn-primary">'),e.push(this.Ti("Some Text")),e.push("</button></p>\n    <p>"),e.push(this.T("Text with enabled inline translations looks like")),e.push('\u2002<button class="btn btn-primary"><span class="translation" contenteditable="true">'),e.push(this.Ti("Some Text")),e.push("</button></span></p>\n    <p>"),e.push(this.T("Just click into the highlighted area and update the words right there. Enjoy!")),e.push("</p>\n    <p>"),e.push(this.T("If you want to translate it via the translation table, just go ahead below.")),e.push('</p>\n  </div>\n\n  <div class="js-ToDo"></div>\n  <div class="js-List"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/translation/list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u;for(e.push("<h2>"),e.push(this.T("Date & Time")),e.push('</h2>\n<table class="translationOverview js-translated table table-striped table-hover">\n  <thead>\n    <tr>\n      <th class="translationOverview-source">'),e.push(this.T("Type")),e.push('</th>\n      <th class="translationOverview-target">'),e.push(this.T("Target")),e.push('</th>\n      <th class="translationOverview-initial">'),e.push(this.T("Original")),e.push('</th>\n      <th class="translationOverview-action">'),e.push(this.T("Action")),e.push("</th>\n    </tr>\n  </thead>\n  <tbody>\n  "),i=0,o=(l=this.times).length;i<o;i++)u=l[i],e.push("\n    "),t=!1,e.push("\n    "),u[2]!==u[3]&&(t=!0),e.push("\n    <tr "),t&&e.push('class="warning"'),e.push('>\n      <td title="'),e.push(n(u[1])),e.push('">'),e.push(n(u[1])),e.push('\n      <td class="translationOverview-itemContainer"><input class="js-Item translationOverview-item form-control" value="'),e.push(n(u[2])),e.push('" data-source="'),e.push(n(u[1])),e.push('" data-initial="'),e.push(n(u[3])),e.push('" data-id="'),e.push(n(u[0])),e.push('" data-format="'),e.push(n(u[4])),e.push('">\n      <td title="'),e.push(n(u[3])),e.push('">'),e.push(n(u[3])),e.push('\n      <td><a href="#" class="js-Reset btn btn--text'),t||e.push(" hidden"),e.push('">'),e.push(this.T("Reset")),e.push("</a>\n  ");for(e.push("\n  </tbody>\n</table>\n\n<h2>"),e.push(this.T("Words")),e.push('</h2>\n<table class="translationOverview js-translated table table-striped table-hover">\n  <thead>\n    <tr>\n      <th class="translationOverview-source">'),e.push(this.T("Source")),e.push('</th>\n      <th class="translationOverview-target">'),e.push(this.T("Target")),e.push('</th>\n      <th class="translationOverview-initial">'),e.push(this.T("Original")),e.push('</th>\n      <th class="translationOverview-action">'),e.push(this.T("Action")),e.push("</th>\n    </tr>\n  </thead>\n  <tbody>\n    "),r=0,a=(c=this.strings).length;r<a;r++)s=c[r],e.push("\n    "),t=!1,e.push("\n    "),s[2]!==s[3]&&(t=!0),e.push("\n    <tr "),t&&e.push('class="warning"'),e.push('>\n      <td class="noTruncate" title="'),e.push(n(s[1])),e.push('">'),e.push(n(s[1])),e.push('\n      <td class="translationOverview-itemContainer"><input class="js-Item translationOverview-item form-control" value="'),e.push(n(s[2])),e.push('" data-source="'),e.push(n(s[1])),e.push('" data-initial="'),e.push(n(s[3])),e.push('" data-id="'),e.push(n(s[0])),e.push('" data-format="'),e.push(n(s[4])),e.push('">\n      <td class="noTruncate" title="'),e.push(n(s[3])),e.push('">'),e.push(n(s[3])),e.push('\n      <td><a href="#" class="js-Reset btn btn--text'),t||e.push(" hidden"),e.push('">'),e.push(this.T("Reset")),e.push("</a>\n    ");e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/translation/support"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>\n  "),this.percent<80&&(e.push("\n    "),e.push(this.T("Only %s% of this language is already translated. Please help to improve Zammad and complete the translation.",this.percent)),e.push("\n  ")),e.push("\n  "),this.percent>=80&&(e.push("\n    "),e.push(this.T("Up to %s% of this language is already translated. Please help to make Zammad even better and complete the translation.",this.percent)),e.push("\n  ")),e.push("\n</p>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/translation/todo"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push("<h2>"),e.push(this.T("Words:")),e.push(" "),e.push(this.T("not translated")),e.push('</h2>\n<table class="translationOverview table table-striped table-hover">\n  <thead>\n    <tr>\n      <th class="translationOverview-source">'),e.push(this.T("Source")),e.push('</th>\n      <th class="translationOverview-target">'),e.push(this.T("Target")),e.push('</th>\n      <th class="translationOverview-action">'),e.push(this.T("Action")),e.push("</th>\n    </tr>\n  </thead>\n  <tbody>\n    "),t=0,s=(r=this.list).length;t<s;t++)i=r[t],e.push('\n    <tr>\n      <td title="'),e.push(n(i[1])),e.push('">'),e.push(n(i[1])),e.push('\n      <td class="translationOverview-itemContainer"><input class="js-Item translationOverview-item form-control" value="'),e.push(n(i[2])),e.push('" data-source="'),e.push(n(i[1])),e.push('" data-id="'),e.push(n(i[0])),e.push('">\n      <td><a href="#" class="js-create btn btn--text">'),e.push(this.T("Create")),e.push('</a> / <a href="#" class="js-theSame btn btn--text">'),e.push(this.T("is the same")),e.push("</a>\n    ");e.push("\n  </tbody>\n</table>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/twitter/account_edit"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<fieldset>\n\n  <h3>'),e.push(this.T("Search Terms")),e.push('</h3>\n  <p class="description">'),e.push(this.T("Tweets containing search terms are automatically turned into tickets.")),e.push('</p>\n\n  <table class="settings-list">\n    <thead>\n      <tr>\n        <th>'),e.push(this.T("Search Term")),e.push("\n        <th>"),e.push(this.T("Group")),e.push("\n        <th>"),e.push(this.T("Action")),e.push('\n    </thead>\n    <tbody class="js-searchTermList">\n      <tr>\n        <td colspan="3">\n          '),e.push(this.T("Empty")),e.push('\n    </tbody>\n    <tfoot>\n      <tr>\n        <td colspan="3" class="settings-list-action-cell js-searchTermAdd">\n          '),e.push(this.Icon("plus-small")),e.push("\n    </tfoot>\n  </table>\n\n  <h3>"),e.push(this.T("Mentions Group")),e.push('</h3>\n  <p class="description">'),e.push(this.T("Choose the group to which mentions will get added.")),e.push('</p>\n  <div class="js-mentionsGroup"></div>\n\n  <h3>'),e.push(this.T("Direct Messages Group")),e.push('</h3>\n  <p class="description">'),e.push(this.T("Choose the group to which direct messages will get added.")),e.push('</p>\n  <div class="js-directMessagesGroup"></div>\n\n  <h3>'),e.push(this.T("Retweets")),e.push('</h3>\n  <p class="description">'),e.push(this.T("Choose if retweets should also be converted to tickets.")),e.push('</p>\n  <input name="track_retweets" type="checkbox" id="setting-chat" value="true" '),this.channel.options.sync.track_retweets&&e.push("checked"),e.push("> "),e.push(this.T("Track retweets")),e.push('\n  <input name="webhook_id" type="hidden" value="'),e.push(this.channel.options.sync.webhook_id),e.push('">\n</fieldset>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/twitter/app_config"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="alert alert--danger hidden" role="alert"></div>\n<p>\n  '),e.push(this.T("You can find a tutorial on how to manage a %s in our online documentation %l.","Twitter App","https://admin-docs.zammad.org/en/latest/channels/twitter-x/twitter.html")),e.push("\n</p>\n<fieldset>\n  <h2>"),e.push(this.T("Enter your %s App Keys","Twitter")),e.push('</h2>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="consumer_key">'),e.push(this.T("Twitter Consumer Key")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="consumer_key" type="text" name="consumer_key" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.consumer_key)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="consumer_secret">'),e.push(this.T("Twitter Consumer Secret")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="consumer_secret" type="text" name="consumer_secret" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.consumer_secret)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="oauth_token">'),e.push(this.T("Twitter Access Token")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="oauth_token" type="text" name="oauth_token" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.oauth_token)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="oauth_token_secret">'),e.push(this.T("Twitter Access Token Secret")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="oauth_token_secret" type="text" name="oauth_token_secret" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.oauth_token_secret)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <div class="input form-group">\n    <div class="formGroup-label">\n      <label for="env">'),e.push(this.T("Twitter Dev environment label")),e.push(' <span>*</span></label>\n    </div>\n    <div class="controls">\n      <input id="env" type="text" name="env" value="'),this.external_credential&&this.external_credential.credentials&&e.push(n(this.external_credential.credentials.env)),e.push('" class="form-control" required autocomplete="off" >\n    </div>\n  </div>\n  <h2>'),e.push(this.T("Your callback URL")),e.push('</h2>\n  <div class="input form-group">\n    <div class="controls">\n      <input class="form-control js-select" readonly value="'),e.push(n(this.callbackUrl)),e.push('">\n    </div>\n  </div>\n</fieldset>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/twitter/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Twitter")),e.push(" <small>"),e.push(this.T("Accounts")),e.push('</small></h1>\n  </div>\n</div>\n\n<div class="page-content">\n  <div class="page-description">\n    <p>'),e.push(this.T("You can connect %s with Zammad. But first, you will have to connect your Zammad with %s.","Twitter Accounts","Twitter")),e.push('</p>\n    <div class="btn btn--success js-configApp">'),e.push(this.T("Connect Twitter App")),e.push("</div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/twitter/list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h;for(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T("Twitter")),e.push(" <small>"),e.push(this.T("Accounts")),e.push('</small></h1>\n  </div>\n\n  <div class="page-header-meta">\n    <a class="btn js-configApp">'),e.push(this.T("Configure App")),e.push('</a>\n    <a class="btn btn--success js-new">'),e.push(this.T("Add Account")),e.push("</a>\n  </div>\n</div>\n\n"),this.external_credential&&this.external_credential.credentials&&!this.external_credential.credentials.webhook_id&&(e.push('\n  <div class="alert alert--warning" role="alert">'),e.push(this.T("Your Twitter app is not using the Twitter Account Activity API yet and is therefore limited to search terms only. Please refer to the documentation %l on how to update your account.","https://zammad-admin-documentation.readthedocs.io/en/latest/channels-twitter.html")),e.push("</div>\n")),e.push('\n\n<div class="page-content">\n'),i=0,o=(c=this.channels).length;i<o;i++){if(t=c[i],e.push('\n  <div class="action '),!0!==t.active&&e.push("is-inactive"),e.push('" data-id="'),e.push(n(t.id)),e.push('">\n    <div class="action-block action-row">\n      <h2>'),e.push(this.Icon("status","supergood-color inline")),e.push(" "),e.push(n(t.options.user.name)),e.push(' <span class="text-muted">@'),e.push(n(t.options.user.screen_name)),e.push("</span></h2>\n    </div>\n\n    "),this.external_credential&&this.external_credential.credentials&&this.external_credential.credentials.webhook_id&&t.options&&t.options.subscribed_to_webhook_id!==this.external_credential.credentials.webhook_id&&(e.push('\n      <div class="alert alert--warning" role="alert">'),e.push(this.T('Your Twitter account is not using the Twitter Account Activity API yet and is therefore limited to search terms only. Please add/update the account again via "add account".')),e.push("</div>\n    ")),e.push('\n\n    <div class="action-flow action-flow--row">\n      <div class="action-block">\n        <h3>'),e.push(this.T("Search Terms")),e.push("</h3>\n        "),t.options.sync.search){for(e.push("\n          "),s=0,a=(u=t.options.sync.search).length;s<a;s++)h=u[s],e.push("\n            "),e.push(n(h.term)),e.push("<br>\n          ");e.push("\n        ")}if(e.push("\n      </div>\n      "),e.push(this.Icon("arrow-right","action-flow-icon")),e.push('\n      <div class="action-block">\n        <h3>'),e.push(this.T("Group")),e.push("</h3>\n        "),t.options.sync.search){for(e.push("\n          "),r=0,l=(p=t.options.sync.search).length;r<l;r++)h=p[r],e.push("\n            "),e.push(n(h.groupName)),e.push("<br>\n          ");e.push("\n        ")}e.push('\n      </div>\n    </div>\n    <div class="action-flow action-flow--row">\n      <div class="action-block">\n        <h3>'),e.push(this.T("Mentions")),e.push("</h3>\n        @"),e.push(n(t.options.user.screen_name)),e.push("\n      </div>\n      "),e.push(this.Icon("arrow-right","action-flow-icon")),e.push('\n      <div class="action-block">\n        <h3>'),e.push(this.T("Group")),e.push("</h3>\n        "),t.options.sync.mentions&&(e.push("\n          "),e.push(n(t.options.sync.mentions.groupName)),e.push("\n        ")),e.push('\n      </div>\n    </div>\n    <div class="action-flow action-flow--row">\n      <div class="action-block">\n        <h3>'),e.push(this.T("Direct Messages")),e.push("</h3>\n        @"),e.push(n(t.options.user.screen_name)),e.push("\n      </div>\n      "),e.push(this.Icon("arrow-right","action-flow-icon")),e.push('\n      <div class="action-block">\n        <h3>'),e.push(this.T("Group")),e.push("</h3>\n        "),t.options.sync.direct_messages&&(e.push("\n          "),e.push(n(t.options.sync.direct_messages.groupName)),e.push("\n        ")),e.push('\n      </div>\n    </div>\n    <div class="action-flow action-flow--row">\n      <div class="action-block">\n        <h3>'),e.push(this.T("Retweets")),e.push("</h3>\n        "),t.options.sync.track_retweets?(e.push("\n          "),e.push(this.T("Retweets are converted into tickets.")),e.push("\n          "),e.push(this.T("Conversion of retweets into tickets is turned off.")),e.push("\n        ")):e.push("\n        "),e.push('\n      </div>\n    </div>\n    <div class="action-controls">\n      <div class="btn btn--danger btn--secondary js-delete">'),e.push(this.T("Delete")),e.push("</div>\n      "),!0===t.active?(e.push('\n        <div class="btn btn--secondary js-disable">'),e.push(this.T("Disable")),e.push("</div>\n      ")):(e.push('\n        <div class="btn btn--secondary js-enable">'),e.push(this.T("Enable")),e.push("</div>\n      ")),e.push('\n      <div class="btn js-edit">'),e.push(this.T("Edit")),e.push("</div>\n    </div>\n  </div>\n")}e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/twitter/search_term"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<tr>\n  <td class="settings-list-control-cell"><input name="search::term" value="'),e.push(n(this.term)),e.push('" class="form-control form-control--small">\n  <td class="settings-list-control-cell"><div class="js-termGroup" data-index="'),e.push(n(this.index)),e.push('"></div>\n  <td class="settings-list-row-control">\n    <div class="btn btn--text js-searchTermRemove" data-index="'),e.push(n(this.index)),e.push('">\n      '),e.push(this.Icon("trash")),e.push(" "),e.push(this.T("Remove")),e.push("\n    </div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/user"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;if(e.push('<div class="page-header">\n  <div class="page-header-title">\n    <h1>'),e.push(this.T(this.head)),e.push(" <small>"),e.push(this.T("Management")),e.push('</small></h1>\n  </div>\n  <div class="page-header-meta">\n    '),this.buttons){for(e.push("\n    "),i=0,r=(a=this.buttons).length;i<r;i++)t=a[i],e.push('\n      <a data-type="'),e.push(n(t["data-type"])),e.push('" class="btn '),e.push(n(t.class)),e.push('">'),e.push(this.T(t.name)),e.push("</a>\n    ");e.push("\n    ")}
for(e.push('\n  </div>\n</div>\n<div class="page-content">\n  <div class="searchfield">\n    <input class="js-search form-control" name="search" placeholder="'),e.push(this.Ti("Search for users")),e.push('" type="search">\n    '),e.push(this.Icon("magnifier")),e.push('\n  </div>\n\n  <div class="userSearch horizontal">\n    <div class="userSearch-label">'),e.push(this.T("Roles:")),e.push('</div>\n    <div class="tabs tabs-wide">\n      '),s=0,o=(l=this.roles).length;s<o;s++)c=l[s],e.push('\n        <div class="tab" data-id="'),e.push(n(c.id)),e.push('">'),e.push(this.Ti(c.displayName())),e.push("</div>\n      ");e.push('\n    </div>\n  </div>\n\n  <div class="table-overview"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/user/manage_two_factor"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div>\n  <div class="js-attributes"></div>\n  <div class="form-controls">\n    <button type="submit" class="btn btn--secondary btn--danger js-remove-all">'),e.push(this.T("Remove all methods")),e.push('</button>\n    <button type="submit" class="btn btn--danger js-remove align-right">'),e.push(this.T("Remove method")),e.push("</button>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/user_profile/index"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="profile">\n  <div class="profile-window">\n    <div class="profile-section vertical centered">\n      <div class="align-right profile-action js-action"></div>\n      <div class="profile-name js-profileName text-center"></div>\n      <div class="profile-organization js-organization"></div>\n    </div>\n    <div class="profile-section js-object-container"></div>\n    <div class="profile-section js-ticket-stats"></div>\n  </div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/user_profile/name"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push(this.user.avatar("80","","avatar--not-linked")),e.push("\n<h1>"),e.push(n(this.user.displayName())),e.push("</h1>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/user_profile/object"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="profile-details horizontal wrap">\n  '),t=0,i=(s=this.userData).length;t<i;t++)r=s[t],e.push("\n    "),"richtext"===r.tag?(e.push('\n      <div class="profile-detailsEntry" style="width: 100%;">\n        <label>'),e.push(this.T(r.display)),e.push('</label>\n        <div contenteditable="true" data-name="'),e.push(n(r.name)),e.push('" data-type="update" data-placeholder="'),e.push(this.Ti("Add a Note")),e.push('">'),e.push(this.user[r.name]),e.push("</div>\n      </div>\n    ")):"organization_ids"===r.name?(e.push("\n      "),this.user[r.name]&&this.user[r.name].length>0&&(e.push('\n        <div class="profile-detailsEntry">\n          <label>'),e.push(this.T(r.display)),e.push('</label>\n          <ul class="js-organizationList">\n            <li class="hidden list-item-none js-showMoreOrganizations"><a href="#">'),e.push(this.T("show more")),e.push("</a></li>\n          </ul>\n        </div>\n      ")),e.push("\n    ")):(e.push('\n      <div class="profile-detailsEntry">\n        <label>'),e.push(this.T(r.display)),e.push("</label>\n        "),e.push(this.P(this.user,r.name)),e.push("\n      </div>\n    ")),e.push("\n  ");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/user_profile/organization"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<a href="'),e.push(this.organization.uiUrl()),e.push('" class="organization-popover" data-id="'),e.push(n(this.organization.id)),e.push('" data-popover-show-avatar="true">'),e.push(n(this.organization.displayName())),e.push("</a>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/version"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="page-header-title">\n  <h1>'),e.push(this.T("Version")),e.push('<small></small></h1>\n</div>\n<div class="page-content">\n  <p>\n    '),e.push(this.T("This is Zammad version %s",this.version)),e.push("\n  </p>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/button_with_dropdown"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<button class="btn btn--primary btn--split--first '),e.push(n(this.mainActionIdentifier)),e.push('">'),e.push(this.T(this.mainActionLabel)),e.push('</button>\n<span class="dropdown-menu-accessories" tabindex="1">\n  <button class="btn btn--primary btn--slim btn--only-icon btn--split--last">'),e.push(this.Icon("arrow-up")),e.push('</button>\n  <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="userAction">\n    '),i=0,s=(r=this.actions).length;i<s;i++)t=r[i],e.push('\n      <li\n        class="'),e.push(n(this.accessoryActionsIdentifier)),e.push('"\n        role="menuitem"\n        data-id="'),e.push(n(t.id)),e.push('"\n        '),t.disabled&&e.push("disabled"),e.push(">\n\n        "),e.push(this.T(t.name)),e.push("\n    ");e.push("\n  </ul>\n</span>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/http_log"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c;if(e.push("<hr>\n<h2>"),e.push(this.T("Recent Logs")),e.push("</h2>\n"),this.description){for(e.push("\n  "),t=0,r=(l=this.description).length;t<r;t++)i=l[t],e.push("\n    <p>"),e.push(this.T.apply(this,i)),e.push("</p>\n  ");e.push("\n")}if(e.push('\n<div class="settings-entry">\n'),this.records.length){for(e.push('\n  <table class="settings-list settings-list--stretch">\n    <thead>\n      <tr>\n        <th width="10%">'),e.push(this.T("Direction")),e.push("\n        <th>"),e.push(this.T("Request")),e.push('\n        <th width="25%">'),e.push(this.T("Created at")),e.push("\n    </thead>\n    <tbody>\n"),s=0,o=(c=this.records).length;s<o;s++)a=c[s],e.push('\n      <tr data-id="'),e.push(n(a.id)),e.push('" class="js-record">\n        <td>'),e.push(this.T(a.direction)),e.push('\n        <td><a href="#">'),e.push(n(a.status)),e.push(" "),e.push(n(a.method)),e.push(" "),e.push(n(a.url)),e.push("</a>\n        <td>"),e.push(this.humanTime(a.created_at)),e.push("\n");e.push("\n    </tbody>\n  </table>\n")}else e.push('\n<table class="settings-list settings-list--stretch settings-list--placeholder">\n  <thead><tr><th>'),e.push(this.T("No Entries")),e.push("\n</table>\n");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/http_log_show"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="settings-entry">\n  <table class="settings-list u-overflow-wrap" style="width: 100%;">\n    <tbody>\n      <tr>\n        <td width="20%">'),e.push(this.T("Direction")),e.push("\n        <td>"),e.push(this.T(this.record.direction)),e.push("\n      <tr>\n        <td>"),e.push(this.T("URL")),e.push("\n        <td>"),e.push(n(this.record.url)),e.push("\n      <tr>\n        <td>"),e.push(this.T("Method")),e.push("\n        <td>"),e.push(n(this.record.method)),e.push("\n      <tr>\n        <td>"),e.push(this.T("Status")),e.push("\n        <td>"),e.push(n(this.record.status)),e.push("\n      <tr>\n        <td>"),e.push(this.T("Request")),e.push("\n        <td>"),e.push(App.Utils.text2html(JSON.stringify(this.record.request.content))),e.push("\n      <tr>\n        <td>"),e.push(this.T("Response")),e.push("\n        <td>"),e.push(App.Utils.text2html(JSON.stringify(this.record.response.content))),e.push("\n      <tr>\n        <td>"),e.push(this.T("Created at")),e.push("\n        <td>"),e.push(this.datetime(this.record.created_at)),e.push("\n    </tbody>\n  </table>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/invite_user"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="modal-dialog">\n\n  <form class="modal-content setup wizard js-user">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T(this.head)),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <div class="js-form"></div>\n      </div>\n    </div>\n    <div class="modal-footer">\n      <div class="modal-rightFooter">\n      <a class="btn btn--text btn--secondary js-close" data-slide="js-inbound">'),e.push(this.T("Cancel")),e.push('</a>\n      </div>\n      <div class="modal-rightFooter">\n        <button class="btn btn--primary align-right">'),e.push(this.T("Invite")),e.push('</button>\n      </div>\n    </div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-waiting">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T(this.head)),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("Sending\u2026")),e.push('\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n  <form class="modal-content setup wizard hide js-success">\n    <div class="modal-header">\n      <div class="modal-close js-close">\n        '),e.push(this.Icon("diagonal-cross")),e.push('\n      </div>\n      <h1 class="modal-title">'),e.push(this.T(this.head)),e.push('</h1>\n    </div>\n    <div class="modal-body">\n      <div class="wizard-body vertical justified">\n        <p class="wizard-loadingText">\n          <span class="loading icon"></span> '),e.push(this.T("done")),e.push('\n        </p>\n      </div>\n    </div>\n    <div class="modal-footer"></div>\n  </form>\n\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/mention"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push("<label>"),e.push(this.T("Notifications")),e.push('</label>\n<form class="ui-front mentionWidget">\n  <div class="js-subscribe'),this.subscribed&&e.push(" hidden"),e.push('">\n    <input type="button" class="btn btn--fullWidth" name="subscribe" value="'),e.push(this.T("Subscribe")),e.push('">\n  </div>\n  <div class="js-unsubscribe'),this.subscribed||e.push(" hidden"),e.push('">\n    <input type="button" class="btn btn--fullWidth" name="unsubscribe" value="'),e.push(this.T("Unsubscribe")),e.push('">\n  </div>\n</form>\n<div class="controls-label">\n'),t=0,i=(r=this.mentions).length;t<i;t++)s=r[t],e.push('\n  <a href="#user/profile/'),e.push(n(s.user_id)),e.push('"'),s.access||(e.push(' title="'),e.push(this.T("This user has no access and will not receive notifications.")),e.push('"')),e.push(">"),e.push(s.avatar),e.push("</a>\n");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/online_notification"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="arrow js-arrow"></div>\n<div class="popover-notificationsHeader js-header">\n  <div class="popover-title">'),e.push(this.T("Notifications")),e.push(" <span class='popover-notificationsCounter js-notificationsCounter'>"),e.push(this.count),e.push('</span></div>\n  <a class="btn btn--text btn--subtle js-mark'),this.count||e.push(" hide"),e.push('">'),e.push(this.T("Mark all as read")),e.push('</a>\n</div>\n<div class="popover-content js-content">\n  <div class="activity-placeholder js-noNotifications">\n    '),e.push(this.T("No unread notifications for you. :)")),e.push('\n  </div>\n  <div class="js-items"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/online_notification_item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="js-item activity-entry activity-entry--removeable'),this.item.seen&&e.push(" is-inactive"),e.push('" data-id="'),e.push(this.item.id),e.push('">\n  <a class="activity-avatar user-popover" data-id="'),e.push(n(this.item.created_by_id)),e.push('" '),1!==this.item.created_by_id&&(e.push('href="'),e.push(this.item.created_by.uiUrl()),e.push('"')),e.push(">\n    "),e.push(this.item.created_by.avatar()),e.push('\n  </a>\n  <div class="activity-body">\n    <a class="activity-message js-locationVerify" href="'),e.push(this.item.link),e.push('">\n      <span class="activity-text">\n        '),this.item.objectNative&&this.item.objectNative.activityMessage?(e.push("\n          "),e.push(this.item.objectNative.activityMessage(this.item)),e.push("\n        ")):(e.push("\n          Need objectNative in item "),e.push(n(this.item.object)),e.push(".find("),e.push(n(this.item.o_id)),e.push(")\n        ")),e.push("\n      </span>\n      "),e.push(this.humanTime(this.item.created_at,!1,"activity-time")),e.push('\n    </a>\n    <div class="activity-remove js-remove">\n      <div class="activity-remove-icon-holder">\n        '),e.push(this.Icon("diagonal-cross")),e.push("\n      </div>\n    </div>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/organization"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<div class="sidebar-block">\n  '),!0!==this.customer&&(e.push('\n    <div class="organizationInfo-avatar">\n      <a href="'),e.push(this.organization.uiUrl()),e.push('">\n        '),e.push(this.organization.avatar("50")),e.push("\n      </a>\n    </div>\n  ")),e.push('\n    <h3 title="'),e.push(this.Ti("Name")),e.push('">'),e.push(n(this.organization.displayName())),e.push("</h3>\n</div>\n\n"),t=0,i=(s=this.organizationData).length;t<i;t++)r=s[t],e.push("\n  "),null==this.organization[r.name]&&"note"!==r.name||(e.push('\n    <div class="sidebar-block">\n    '),"richtext"!==r.tag?(e.push("\n      <label>"),e.push(this.T(r.display)),e.push("</label>\n      "),e.push(this.P(this.organization,r.name)),e.push("\n    ")):(e.push("\n      <label>"),e.push(this.T(r.display)),e.push('</label>\n      <div contenteditable="true" data-name="'),e.push(n(r.name)),e.push('" data-type="update-org" data-placeholder="'),e.push(this.Ti("Add a Note")),e.push('">'),e.push(this.organization[r.name]),e.push("</div>\n    ")),e.push("\n    </div>\n  ")),e.push("\n");e.push("\n\n"),this.organization.member_ids&&!0!==this.customer&&(e.push('\n<hr>\n<div class="sidebar-block">\n  <label>'),e.push(this.T("Members")),e.push('</label>\n  <div class="userList js-userList"></div>\n  <p class="hidden">\n    <a href="#" class="js-showMoreMembers">'),e.push(this.T("show more")),e.push("</a>\n  <p>\n</div>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/payload_example"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<div>\n  <p>\n    "),e.push(this.T("This is an example payload for your installation, including any custom objects. It is possible to further customize payload of each webhook.")),e.push("\n  </p>\n  <p>\n    "),e.push(this.T("You can find a tutorial on how to manage a %s in our online documentation %l.","Webhook","https://admin-docs.zammad.org/en/latest/manage/webhook.html")),e.push("\n  </p>\n  <h2>"),e.push(this.T("Header")),e.push("</h2>\n  <pre>\n  X-Zammad-Trigger:  Name of the Trigger\n  X-Zammad-Delivery: 6d600811-06a3-40af-aebd-a2d8213e85aa\n  X-Hub-Signature:   sha1=06007ef23c38e435f49091cdfa3c770b3d85d7be\n  </pre>\n  <h2>"),e.push(this.T("Body")),e.push("</h2>\n  <pre>"),e.push(n(this.payload)),e.push("</pre>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/shared_draft"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;for(e.push('<div class="shared-drafts-manage">\n  <form>\n    <div class="form-group">\n      <label class="" for="template_name">'),e.push(this.T("Create a shared draft")),e.push('</label>\n      <input type="text" name="name" id="shared_draft_name" class="form-control js-name"\n        placeholder="Name" value="'),e.push(n(null!=(r=this.active_draft)?r.name:void 0)),e.push('">\n    </div>\n    <div class="horizontal" style="justify-content: flex-end">\n      <button type="submit" class="btn btn--action js-update btn--primary '),e.push(n(null==this.active_draft?"hide":void 0)),e.push('">'),e.push(this.T("Update")),e.push('</button>\n      <button type="submit" class="btn btn--action js-create btn--create">'),e.push(this.T("Create")),e.push('</button>\n    </div>\n  </form>\n\n  <hr>\n\n  <div class="form-group">\n    <label class="" for="template_name">'),e.push(this.T("Select Shared Draft")),e.push("</label>\n  </div>\n\n  "),_.isEmpty(this.shared_drafts)&&(e.push('\n  <div class="text-placeholder">'),e.push(this.T("No drafts")),e.push("</div>\n  ")),e.push("\n\n  "),i=0,s=(o=this.shared_drafts).length;i<s;i++)t=o[i],e.push('\n    <div class="shared-draft-item" shared-draft-id="'),e.push(n(t.id)),e.push('">\n      <div class="u-highlight u-clickable">'),e.push(n(t.name)),e.push('</div>\n      <div class="text-muted" style="display: flex;flex-wrap:wrap;column-gap:0.2em">\n        <div>\n          '),e.push(n(App.User.find(t.updated_by_id).displayName())),e.push("\n          \u2e31\n        </div>\n        <div>\n          "),e.push(this.humanTime(t.updated_at)),e.push("\n        </div>\n      </div>\n    </div>\n  ");e.push("\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/switch_back_to_user"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push(this.Icon("switchView","switchBackToUser-icon")),e.push('\n<div class="switchBackToUser-text">'),e.push(this.T('Zammad looks like this for "%s"',this.S("firstname")+" "+this.S("lastname"))),e.push('</div>\n<div class="align-right horizontal center js-close u-clickable">\n  '),e.push(this.T("Back to my view")),e.push('\n  <div class="switchBackToUser-close">\n    '),e.push(this.Icon("diagonal-cross")),e.push("\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/tag"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push("<label>"),e.push(this.T("Tags")),e.push('</label>\n<ul class="list list--sidebar">\n  '),t=0,i=(s=this.tags).length;t<i;t++)r=s[t],e.push('\n  <li class="list-item">\n    <a href="#" class="list-item-name js-tag">'),e.push(n(r)),e.push("</a>\n    "),this.editable&&(e.push('\n      <div class="list-item-delete js-delete">\n        '),e.push(this.Icon("diagonal-cross")),e.push("\n      </div>\n    ")),e.push("\n  ");e.push("\n</ul>\n"),this.editable&&(e.push('\n <div class="text-muted js-newTagLabel u-clickable">+ '),e.push(this.T("Add Tag")),e.push('</div>\n <form class="ui-front">\n   <input type="text" name="new_tag" class="hide js-newTagInput" autocomplete="off">\n </form>\n')),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/task_item"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<a href="'),e.push(this.item.meta.url),e.push('" title="'),e.push(n(this.item.meta.title)),e.push('" class="nav-tab task js-item js-locationVerify '),e.push(n(this.item.meta.class)),this.item.active&&e.push(" is-active"),this.item.notify&&e.push(" is-modified"),e.push('" data-key="'),e.push(this.item.key),e.push('">\n  <div class="nav-tab-icon" title="'),e.push(this.Ti(this.item.meta.iconTitle)),e.push('">\n    '),"task"===this.item.meta.type?(e.push("\n      "),this.item.notify?(e.push("\n        "),e.push(this.Icon("small-dot","icon-status-modified-inner-circle icon-task-state "+this.item.meta.iconClass)),e.push("\n        "),e.push(this.Icon("status-modified-outer-circle","icon-task-state "+this.item.meta.iconClass)),e.push("\n      ")):(e.push("\n        "),e.push(this.Icon("task-state",this.item.meta.iconClass)),e.push("\n      ")),e.push("\n    ")):(e.push("\n      "),e.push(this.Icon(this.item.meta.iconClass)),e.push("\n    ")),e.push('\n  </div>\n  <div class="nav-tab-name u-textTruncate flex'),!1===this.item.meta.active&&e.push(" is-inactive"),e.push('">'),e.push(n(this.item.meta.head)),e.push('</div>\n  <div class="nav-tab-close js-close" title="'),e.push(this.Ti("close")),e.push('">\n    <div class="nav-tab-close-inner">\n      '),e.push(this.Icon("diagonal-cross")),e.push("\n    </div>\n  </div>\n</a>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/template"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="templates-select">\n  <form>\n    <div class="form-group">\n      <label class="" for="template_name">'),e.push(this.T("Select Template")),e.push('</label>\n      <div id="form-template"></div>\n    </div>\n    <div class="horizontal">\n      <button type="submit" class="btn btn--action align-right js-apply">'),e.push(this.T("Apply")),e.push('</button>\n    </div>\n  </form>\n</div>\n\n<div class="templates-welcome">\n  <p>'),e.push(this.T("No template created yet.")),e.push("</p>\n  <p>"),e.push(this.T("With templates you can pre-fill ticket attributes.")),e.push('</p>\n  <p>\n    <a class="js-createLink u-clickable" href="#manage/templates">'),e.push(this.T("Create a new template in the admin interface.")),e.push('</a>\n    <span class="js-createTextOnly">'),e.push(this.T("Create a new template in the admin interface.")),e.push("</span>\n  </p>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/text_module"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="well hide">\n<!--\n  <h3>'),e.push(this.T("Text Modules")),e.push("</h3>\n  "),e.push(this.T("Search")),e.push('\n  <br>\n-->\n  <input type="text" name="" id="text-module-search" class="span2" value="'),e.push(n(this.search)),e.push('" autocomplete="off"/>\n  <a href="#" class="close">&times;</a>\n  <br>\n  <div id="form-text-module" class="max-size-scroll"></div>\n  <!--<button type="submit" class="btn" data-type="text_module_edit">'),e.push(this.T("Edit")),e.push('</button>-->\n<!--\n  <button type="submit" class="btn" data-type="text_module_delete">'),e.push(this.T("Delete")),e.push("</button>\n-->\n<!--\n  "),e.push(this.T("Preview")),e.push('\n  <br>\n  <textarea id="text-module-preview-content" class="span2"></textarea>\n-->\n  <hr>\n  <form>\n    <label class="" for="text_module_name">'),e.push(this.T("Save as")),e.push('</label>\n    <input type="text" name="name" id="text_module_name" class="span2" value=""/>\n    <button type="submit" class="btn" data-type="save">'),e.push(this.T("Save")),e.push("</button>\n  </form>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/ticket_stats"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){this.user&&this.user.organization&&(e.push('\n  <div class="tabs tabs--big">\n    <div class="tab js-userTab active">'),e.push(this.T("Tickets of User")),e.push(" "),e.push("("+this.user_total+")"),e.push('</div>\n    <div class="tab js-orgTab">'),e.push(this.T("Tickets of Organization")),e.push(" "),e.push("("+this.organization_total+")"),e.push("</div>\n  </div>\n")),e.push('\n\n<div class="js-user '),!this.user&&this.organization&&e.push("hide"),e.push('">\n  <div class="profile-ticketLists">\n    <div class="profile-ticketList js-user-open-tickets"></div>\n    <div class="profile-ticketList js-user-closed-tickets"></div>\n  </div>\n\n  <div class="frequency stat-widget vertical js-user-frequency"></div>\n</div>\n\n<div class="js-org '),this.user&&e.push("hide"),e.push('">\n  <div class="profile-ticketLists">\n    <div class="profile-ticketList js-org-open-tickets"></div>\n    <div class="profile-ticketList js-org-closed-tickets"></div>\n  </div>\n\n  <div class="frequency stat-widget vertical js-org-frequency"></div>\n</div>\n')}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/ticket_stats_frequency"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,n,i,s;for(e.push('<div class="stat-title">'),e.push(this.T("Frequency")),e.push('</div>\n<div class="stat-graphic">\n  '),t=0,i=(s=this.ticket_volume_by_year).length;t<i;t++)n=s[t],e.push('\n    <div class="stats-row">\n      <div class="stat-bars">\n        <div class="stat-bar primary" style="height: '),e.push(n.closed_in_percent),
e.push('%"></div>\n        <div class="stat-bar secondary" style="height: '),e.push(n.created_in_percent),e.push('%"></div>\n      </div>\n      <div class="stat-label">'),e.push(this.T(n.text.substr(0,3))),e.push("</div>\n    </div>\n  ");e.push('\n</div>\n<div class="stat-legend">\n  <div class="stat-legendEntry primary">\n    <span class="primary stat-circle"></span>\n    <span class="stat-legend-label">'),e.push(this.T("Closed")),e.push('</span>\n  </div>\n  <div class="stat-legendEntry secondary">\n    <span class="secondary stat-circle"></span>\n    <span class="stat-legend-label">'),e.push(this.T("Created")),e.push("</span>\n  </div>\n</div>\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/ticket_stats_list"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<label>"),e.push(this.T(this.head)),e.push(" ("),e.push(n(this.ticket_ids.length)),e.push(")</label>\n"),this.ticket_ids.length?(e.push("\n  "),e.push(this.ticketList),e.push("\n")):(e.push('\n<div class="profile-ticketsPlaceholder vertical centered">\n  <div class="'),e.push(this.iconClass),e.push('"></div>\n  '),e.push(this.T("none")),e.push("\n</div>\n")),e.push("\n"),this.ticket_ids.length>this.ticket_ids_show.length&&(e.push('\n  <a href="#" class="js-showAll">'),e.push(this.T("Show all\u2026")),e.push("</a>\n")),e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/two_factor_configuration/authenticator_app"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="two-factor-auth flex">\n  <p>'),e.push(n(this.T("To set up Authenticator App for your account, follow the steps below:"))),e.push("</p>\n  <ol>\n    <li>\n      <p>"),e.push(n(this.T("Unless you already have it, install one of the following authenticator apps on your mobile device:"))),e.push('</p>\n      <ul>\n        <li>\n          <a href="https://support.google.com/accounts/answer/1066447" target="_blank">'),e.push(n(this.T("Google Authenticator"))),e.push('</a>\n        </li>\n        <li>\n          <a href="https://support.authy.com/hc/en-us/articles/115001945848-Installing-Authy-apps/" target="_blank">'),e.push(n(this.T("Authy"))),e.push('</a>\n        </li>\n        <li>\n          <p>\n            <a href="https://support.microsoft.com/en-us/account-billing/download-and-install-the-microsoft-authenticator-app-351498fc-850a-45da-b7b6-27e523b8702a" target="_blank">'),e.push(n(this.T("Microsoft Authenticator"))),e.push("</a>\n          </p>\n        </li>\n      </ul>\n    </li>\n    <li>\n      <p>"),e.push(n(this.T("Open your authenticator app and scan the QR code below:"))),e.push('</p>\n      <div class="authenticator-app">\n        <canvas class="qr-code-canvas js-qr-code-canvas" title="'),e.push(n(this.T("Show authenticator app secret"))),e.push('"></canvas>\n        <div class="secret js-secret" title="'),e.push(n(this.T("Hide authenticator app secret"))),e.push('" style="display: none;" aria-label="'),e.push(n(this.T("Authenticator app secret"))),e.push('">'),e.push(n(this.config.secret)),e.push("</div>\n      </p>\n    </li>\n    <li>\n      <p>"),e.push(n(this.T("Enter the security code generated by the authenticator app:"))),e.push('</p>\n      <p>\n        <div class="method-form js-payload-form"></div>\n      </p>\n    </li>\n    <li>\n      <p>'),e.push(n(this.T("Press the button below to finish the setup."))),e.push("</p>\n    </li>\n  </ol>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/two_factor_configuration/recovery_codes"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o;for(e.push('<div class="two-factor-auth flex">\n  <p>'),e.push(n(this.T("Please save your recovery codes listed below somewhere safe. You can use them to sign in if you lose access to another two-factor method:"))),e.push("</p>\n\n  <pre><code readonly>"),i=s=0,r=(o=this.recovery_codes).length;s<r;i=++s)t=o[i],e.push(n(t)),i===this.recovery_codes.length-1||(i%2?e.push("\n\n"):e.push("    "));e.push("</code></pre>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/two_factor_configuration/security_keys/index"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push("<p>"),e.push(n(this.T("Security keys are hardware or software credentials that can be used as your two-factor authentication method."))),e.push('</p>\n<div class="js-table"></div>\n<p>'),e.push(n(this.T("To register a new security key with your account, press the button below."))),e.push("</p>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/two_factor_configuration/security_keys/register"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<div class="main two-factor-auth flex">\n  <p class="text-center">'),e.push(n(this.T("Getting key information from the browser\u2026"))),e.push('</p>\n  <div class="loading icon"></div>\n</div>\n')}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/two_factor_login/help_text"]=function(t){t||(t={});var e=[],n=t.safe,i=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){this.twoFactorAvailableAnotherMethod?(e.push("\n  <p>\n    "),e.push(this.T("Having problems?")),e.push('\n    <a href="#" class="js-try-another">'),e.push(this.T("Try another method")),e.push("</a>\n  </p>\n")):(e.push("\n  <p>\n    "),e.push(this.T("Contact the administrator if you have any problems logging in.")),e.push("\n  </p>\n")),e.push("\n")}).call(this)}.call(t),t.safe=n,t.escape=i,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/two_factor_login/security_code"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<h3 class="text-center">\n  '),e.push(n(this.T(this.twoFactorMethodDetails.label))),e.push("\n</h3>\n\n"),this.errorMessage&&(e.push('\n  <div class="alert alert--danger" role="alert">\n    '),e.push(n(this.errorMessage)),e.push("\n  </div>\n")),e.push('\n\n<input name="username" type="hidden" value="'),e.push(n(this.formPayload.username)),e.push('" />\n<input name="password" type="hidden" value="'),e.push(n(this.formPayload.password)),e.push('" />\n<input name="remember_me" type="hidden" value="'),e.push(n(this.formPayload.remember_me)),e.push('" />\n<input name="two_factor_method" type="hidden" value="'),e.push(n(this.twoFactorMethodDetails.key)),e.push('" />\n\n<div class="form-group">\n  <div class="formGroup-label">\n    <label for="security_code">'),e.push(this.Ti(this.inputFieldLabel)),e.push('</label>\n  </div>\n  <input id="security_code" name="two_factor_payload" type="text" class="form-control" autocomplete="off"/>\n\n  <p class="help-text">'),e.push(n(this.T(this.twoFactorMethodDetails.helpMessage))),e.push('</p>\n</div>\n\n<div class="form-controls">\n  <button class="btn btn--primary" type="submit">'),e.push(this.T("Sign in")),e.push("</button>\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/two_factor_login/security_keys"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){e.push('<h3 class="text-center">\n  '),e.push(n(this.T(this.twoFactorMethodDetails.label))),e.push("\n</h3>\n\n"),this.errorMessage&&(e.push('\n  <div class="spacer"></div>\n  <div class="alert alert--danger" role="alert">\n    '),e.push(n(this.errorMessage)),e.push("\n  </div>\n")),e.push('\n\n<div class="form-controls">\n\n'),this.errorMessage?(e.push('\n  <p class="text-center">'),e.push(n(this.T("Try using your security key again."))),e.push('</p>\n  <button class="btn btn--primary js-retry" type="button">'),e.push(this.T("Retry")),e.push("</button>\n")):(e.push('\n  <input name="username" type="hidden" value="'),e.push(n(this.formPayload.username)),e.push('" />\n  <input name="password" type="hidden" value="'),e.push(n(this.formPayload.password)),e.push('" />\n  <input name="remember_me" type="hidden" value="'),e.push(n(this.formPayload.remember_me)),e.push('" />\n  <input name="two_factor_method" type="hidden" value="'),e.push(n(this.twoFactorMethodDetails.key)),e.push('" />\n\n  <div class="double-spacer"></div>\n  <p class="text-center">'),e.push(n(this.T("Verifying key information\u2026"))),e.push('</p>\n  <div class="double-spacer"></div>\n  <div class="centered">\n    <div class="loading icon"></div>\n  </div>\n  <div class="double-spacer"></div>\n')),e.push("\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/two_factor_login/try_another_method"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r;for(e.push('<h3 class="text-center">\n  '),e.push(n(this.T("Try Another Method"))),e.push('\n</h3>\n<div class="two-factor-auth">\n  <div class="two-factor-auth-method-buttons">\n  '),t=0,i=(r=this.twoFactorMethods).length;t<i;t++)s=r[t],e.push('\n    <div class="form-group">\n      <button class="btn btn--fullWidth js-select-two-factor-method '),this.defaultTwoFactorMethod===s.key&&e.push("btn--primary"),e.push('" type="button" data-method="'),e.push(n(s.key)),e.push('">\n        '),e.push(this.Icon(s.icon)),e.push("\n        "),e.push(this.T(s.label)),e.push('\n      </button>\n      <p class="help-block">'),e.push(n(this.T(s.description))),e.push("</p>\n    </div>\n  ");e.push("\n  </div>\n\n  "),this.twoFactorHasRecoveryCodes&&(e.push("\n    <p>\n      "),e.push(this.T("Or, use one of your")),e.push('\n      <a href="#" class="js-select-two-factor-method btn--text btn--secondary" data-method="recovery_codes">\n        '),e.push(this.T("recovery codes")),e.push("\n      </a>\n    </p>\n  ")),e.push("\n\n</div>\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["app/views/widget/user"]=function(t){t||(t={});var e=[],n=function(t){return t&&t.ecoSafe?t:void 0!==t&&null!=t?s(t):""},i=t.safe,s=t.escape;return t.safe=function(t){if(t&&t.ecoSafe)return t;void 0!==t&&null!=t||(t="");var e=new String(t);return e.ecoSafe=!0,e},s||(s=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){(function(){var t,i,s,r,o,a,l,c,u,p,h,d,f;for(e.push('<div class="sidebar-block">\n  <a href="#user/profile/'),e.push(this.user.id),e.push('">\n    '),e.push(this.user.avatar("50","","userInfo-avatar")),e.push('\n  </a>\n  <h3 title="'),e.push(this.Ti("Name")),e.push('">'),e.push(n(this.user.displayName())),e.push("</h3>\n  "),this.user.organization_id&&(e.push('\n    <a href="#organization/profile/'),e.push(this.user.organization_id),e.push('" class="organization-popover" data-id="'),e.push(n(this.user.organization_id)),e.push('" data-popover-show-avatar="true">'),e.push(this.P(this.user,"organization_id")),e.push("</a>\n  ")),e.push("\n</div>\n"),i=0,a=(p=this.userData).length;i<a;i++){if(f=p[i],e.push("\n  "),null!=this.user[f.name]||"note"===f.name){if(e.push("\n    "),"organization_ids"===f.name&&0===this.user[f.name].length)continue;e.push('\n    <div class="sidebar-block">\n    <label>'),e.push(this.T(f.display)),e.push("</label>\n    "),"organization_ids"===f.name?(e.push("\n      "),this.user[f.name]&&this.user[f.name].length>0&&(e.push('\n        <ul class="js-organizationList">\n          <li class="hidden list-item-none js-showMoreOrganizations"><a href="#">'),e.push(this.T("show more")),e.push("</a></li>\n        </ul>\n      ")),e.push("\n    ")):"richtext"!==f.tag?(e.push("\n      "),f.link?(e.push('<a href="'),e.push(f.link),e.push(n(this.user[f.name])),e.push('" target="_blank">'),e.push(this.P(this.user,f.name)),e.push("</a>\n    ")):(e.push("\n      "),e.push(this.P(this.user,f.name)),e.push("\n    ")),e.push("\n    ")):(e.push('\n      <div contenteditable="true" data-name="'),e.push(n(f.name)),e.push('" data-type="update" data-placeholder="'),e.push(this.Ti("Add a Note")),e.push('">'),e.push(this.user[f.name]),e.push("</div>\n    ")),e.push("\n    </div>\n  ")}e.push("\n")}if(e.push("\n"),!_.isEmpty(this.user.accounts)){for(t in e.push('\n  <div class="sidebar-block">\n    <label>'),e.push(this.T("Linked Accounts")),e.push("</label>\n  "),this.user.accounts)e.push('\n    <a href="'),e.push(n(this.user.accounts[t].link)),e.push('" target="_blank">'),e.push(n(t)),e.push("</a>\n  ");e.push("\n  </div>\n")}if(e.push("\n"),!_.isEmpty(this.user.links)){for(e.push("\n  "),r=0,l=(h=this.user.links).length;r<l;r++){for(u=h[r],e.push('\n  <div class="sidebar-block">\n    <label>'),e.push(this.T(u.title)),e.push("</label>\n"),o=0,c=(d=u.items).length;o<c;o++)s=d[o],e.push("\n  "),s.url?(e.push('\n    <a href="'),e.push(n(s.url)),e.push('" title="'),e.push(this.Ti(s.title)),e.push('" style="'),e.push(n(s.style)),e.push('" data-type="'),e.push(n(s.data)),e.push('" class="'),e.push(n(s.class)),e.push('" '),u.new_window&&e.push('target="_blank"'),e.push(">\n  ")):(e.push('\n    <span title="'),e.push(this.Ti(s.title)),e.push('" style="'),e.push(n(s.style)),e.push('" data-type="'),e.push(n(s.data)),e.push('" class="'),e.push(n(s.class)),e.push('">\n  ')),e.push("\n    "),e.push(this.T(s.name)),e.push(" "),void 0!==s.count&&(e.push('<span class="count">('),e.push(n(s.count)),e.push(")</span>")),e.push("\n  "),s.url?e.push("\n    </a>\n  "):e.push("\n    </span>\n  "),e.push("\n  </div>\n");e.push("\n  ")}e.push("\n")}e.push("\n")}).call(this)}.call(t),t.safe=i,t.escape=s,e.join("")}}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};App._CollectionSingletonBase=function(){function e(){var e,n;this.clear=t(this.clear,this),this.callback=t(this.callback,this),this.trigger=t(this.trigger,this),this.fetch=t(this.fetch,this),this.unbindById=t(this.unbindById,this),this.unbind=t(this.unbind,this),this.bind=t(this.bind,this),this.set=t(this.set,this),this.get=t(this.get,this),this.callbacks={},this.counter=0,this.key="collection-"+this.event,(e=App.SessionStorage.get(this.key))&&this.set(e),App.Event.bind(this.event,(n=this,function(t){return n.set(t),n.callback(t)})),App.Event.bind("auth:logout",function(t){return function(e){return t.clear(e)}}(this))}return e.prototype.event="to_be_defined",e.prototype.restEndpoint="/to_be_defined",e.prototype.get=function(){return this.collectionData},e.prototype.set=function(t){return App.SessionStorage.set("collection-"+this.event,t),this.collectionData=t},e.prototype.bind=function(t,e,n){var i;if(null==e&&(e=!0),null==n&&(n=!1),this.counter+=1,i=this.counter,e)if(void 0===this.collectionData)this.fetch();else if(t(this.collectionData),n)return;return this.callbacks[i]={callback:t,one:n},i},e.prototype.unbind=function(t){var e,n,i;for(e in i=[],n=this.callbacks)t===n[e].callback?i.push(delete this.callbacks[e]):i.push(void 0);return i},e.prototype.unbindById=function(t){return delete this.callbacks[t]},e.prototype.fetch=function(){var t;if(!this.fetchActive)return this.fetchActive=!0,App.Ajax.request({id:"collection-"+this.event,type:"GET",url:App.Config.get("api_path")+this.restEndpoint,processData:!0,success:(t=this,function(e){return t.fetchActive=!1,t.set(e),t.callback(e)}),error:function(t){return function(){return t.fetchActive=!1}}(this)})},e.prototype.trigger=function(){return this.callback(this.get())},e.prototype.callback=function(t){var e,n,i,s,r;for(i in r=[],s=this.callbacks)e=s[i],n=function(n){return function(){if(e.callback(t),e.one)return delete n.callbacks[i]}}(this),App.QueueManager.add(this.key,n),r.push(App.QueueManager.run(this.key));return r},e.prototype.clear=function(){return this.collectionData=void 0},e}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ObjectOrganizationAutocompletion=function(n){function i(e){this.hideOrganizationMembers=t(this.hideOrganizationMembers,this),this.showOrganizationMembers=t(this.showOrganizationMembers,this),this.emptyResultList=t(this.emptyResultList,this),this.searchObject=t(this.searchObject,this),this.onKeyUp=t(this.onKeyUp,this),this.build=t(this.build,this),this.buildObjectNew=t(this.buildObjectNew,this),this.buildObjectItem=t(this.buildObjectItem,this),this.buildOrganizationMembers=t(this.buildOrganizationMembers,this),this.navigateByKeyboard=t(this.navigateByKeyboard,this),this.removeToken=t(this.removeToken,this),this.removeThisToken=t(this.removeThisToken,this),this.createToken=t(this.createToken,this),this.executeCallback=t(this.executeCallback,this),this.selectObject=t(this.selectObject,this),this.onObjectClick=t(this.onObjectClick,this),this.resetObjectSelection=t(this.resetObjectSelection,this),this.onBlur=t(this.onBlur,this),this.focusInput=t(this.focusInput,this),this.onFocus=t(this.onFocus,this),this.close=t(this.close,this),this.open=t(this.open,this),this.element=t(this.element,this),i.__super__.constructor.apply(this,arguments),this.lazySearch=_.debounce(this.searchObject,200),this.key=Math.floor(999999*Math.random()).toString(),this.attribute.sourceType||(this.attribute.sourceType="GET"),this.attribute.source||(this.attribute.source=this.apiPath+"/search/user-organization"),this.build(),this.attribute.value&&this.callback&&this.callback(this.attribute.value)}return e(i,n),i.prototype.className="dropdown js-recipientDropdown",i.prototype.events={"hide.bs.dropdown .js-recipientDropdown":"hideOrganizationMembers","click .js-organization":"showOrganizationMembers","click .js-back":"hideOrganizationMembers","click .js-object":"onObjectClick","click .js-objectNew":"newObject","focus .js-objectSelect":"onFocus","input .js-objectSelect":"open","click .js-objectSelect":"stopPropagation","blur .js-objectSelect":"onBlur","click .form-control":"focusInput",click:"stopPropagation","change .js-objectId":"executeCallback","click .js-remove":"removeThisToken","click .js-showMoreMembers":"showMoreMembers"},i.prototype.elements={".recipientList":"recipientList",".js-objectSelect":"objectSelect",".js-objectId":"objectId",".form-control":"formControl"},i.prototype.templateObjectItem="generic/object_search/item_object",i.prototype.templateObjectNew="generic/object_search/new_object",i.prototype.templateOrganizationItem="generic/object_search/item_organization",i.prototype.templateOrganizationItemMembers="generic/object_search/item_organization_members",i.prototype.objectSingle="User",i.prototype.objectIcon="user",i.prototype.inactiveObjectIcon="inactive-user",i.prototype.objectSingels="People",i.prototype.objectCreate=__("Create new object"),i.prototype.referenceAttribute="member_ids",i.prototype.element=function(){return this.el},i.prototype.release=function(){return $(window).off("click.ObjectOrganizationAutocompletion")},i.prototype.open=function(){if(!this.el.hasClass("open"))return this.el.addClass("open"),$(window).on("click.ObjectOrganizationAutocompletion",this.close),$(window).on("keydown.ObjectOrganizationAutocompletion",this.navigateByKeyboard)},i.prototype.close=function(){return $(window).off("keydown.ObjectOrganizationAutocompletion"),this.el.removeClass("open"),$(window).off("click.ObjectOrganizationAutocompletion")},i.prototype.onFocus=function(){return this.formControl.addClass("focus"),this.open()},i.prototype.focusInput=function(){if(!this.formControl.hasClass("focus"))return this.objectSelect.trigger("focus")},i.prototype.onBlur=function(){var t,e;return e=this.objectSelect.val(),_.isEmpty(e)&&!this.attribute.multiple?this.objectId.val(""):!0===this.attribute.guess&&(t=this.objectId.val(),(_.isEmpty(t)||t.match(/^guess:/))&&(_.isEmpty(e)||this.objectId.val("guess:"+e))),this.formControl.removeClass("focus")},i.prototype.resetObjectSelection=function(){return this.objectId.val("").trigger("change")},i.prototype.onObjectClick=function(t){var e,n;return e=$(t.currentTarget).data("object-id"),n=$(t.currentTarget).find(".recipientList-name").text().trim(),this.selectObject(e,n),this.close()},i.prototype.selectObject=function(t,e){return this.attribute.multiple?this.addValueToObjectInput(e,t):(this.objectSelect.val(""),this.objectId.val(t).trigger("change"))},i.prototype.executeCallback=function(){var t,e,n;if(this.attribute.multiple?(this.currentObject&&this.createToken(this.currentObject),this.currentObject=null):(n=this.objectId.val())&&App[this.objectSingle].exists(n)&&(t=(e=App[this.objectSingle].find(n)).displayName(),e.email&&(t=App.Utils.buildEmailAddress(e.displayName(),e.email)),this.objectSelect.val(t)),this.callback)return this.callback(n)},i.prototype.createToken=function(t){var e,n;return e=t.name,n=t.value,this.objectSelect.before(App.view("generic/token")({name:e,value:n}))},i.prototype.removeThisToken=function(t){return this.removeToken($(t.currentTarget).parents(".token"))},i.prototype.removeToken=function(t){var e,n;if("last"===t){if(!(n=this.$(".token").last()).length)return}else n=t;return e=n.data("value"),this.objectId.find("[value="+e+"]").remove(),this.objectId.trigger("change"),n.remove()},i.prototype.navigateByKeyboard=function(t){var e,n,i,s;switch(t.keyCode){case 27:return this.recipientList.hasClass("is-shown")?this.objectSelect.val("").trigger("change"):void this.hideOrganizationMembers();case 8:if(""===this.objectSelect.val()&&this.objectSelect.is(t.target))return this.removeToken("last");break;case 9:return this.close();case 37:case 39:break;case 38:if(t.preventDefault(),this.recipientList.hasClass("is-shown"))return void(0===this.recipientList.find("li.is-active").length?this.recipientList.find("li").last().addClass("is-active"):0!==this.recipientList.find("li.is-active").prev().length&&this.recipientList.find("li.is-active").removeClass("is-active").prev().addClass("is-active"));0===(i=this.$(".recipientList-organizationMembers").not(".hide")).not(".hide").find("li.is-active").length?i.not(".hide").find("li").last().addClass("is-active"):0!==i.not(".hide").find("li.is-active").prev().length&&i.not(".hide").find("li.is-active").removeClass("is-active").prev().addClass("is-active");break;case 40:if(t.preventDefault(),this.recipientList.hasClass("is-shown"))return void(0===this.recipientList.find("li.is-active").length?this.recipientList.find("li").first().addClass("is-active"):0!==this.recipientList.find("li.is-active").next().length&&this.recipientList.find("li.is-active").removeClass("is-active").next().addClass("is-active"));0===(i=this.$(".recipientList-organizationMembers").not(".hide")).not(".hide").find("li.is-active").length?i.find("li").first().addClass("is-active"):0!==i.not(".hide").find("li.is-active").next().length&&i.not(".hide").find("li.is-active").removeClass("is-active").next().addClass("is-active");break;case 13:if(t.preventDefault(),t.stopPropagation(),!this.recipientList.hasClass("is-shown")){if((s=this.$(".recipientList-organizationMembers").not(".hide")).find(".js-back.is-active").get(0))return void this.hideOrganizationMembers();if(!(e=s.find("li.is-active").data("object-id")))return;return n=s.find("li.is-active .recipientList-name").text().trim(),this.selectObject(e,n),void(this.attribute.multiple||this.close())}if(e=this.recipientList.find("li.is-active").data("object-id"))return void("new"===e?this.newObject():(n=this.recipientList.find("li.is-active .recipientList-name").text().trim(),this.selectObject(e,n),this.attribute.multiple||this.close()));if(!this.recipientList.find("li.is-active").data("organization-id"))return;return this.showOrganizationMembers(void 0,this.recipientList.find("li.is-active"))}},i.prototype.addValueToObjectInput=function(t,e){if(this.objectSelect.val(""),this.currentObject={name:t,value:e},!this.objectId.val()||!this.objectId.val().includes(""+e))return this.objectId.append("<option value="+App.Utils.htmlEscape(this.currentObject.value)+" selected>"+App.Utils.htmlEscape(this.currentObject.name)+"</option>"),this.objectId.trigger("change")},i.prototype.buildOrganizationItem=function(t){var e;return e=0,t[this.referenceAttribute]&&(e=t[this.referenceAttribute].length),App.view(this.templateOrganizationItem)({organization:t,objectSingels:this.objectSingels,objectCount:e})},i.prototype.showMoreMembers=function(t){var e,n,i;return this.preventDefaultAndStopPropagation(t),i=(e=$(t.target).closest(".js-showMoreMembers")).attr("organization-member-limit"),n=25*(parseInt(i/25)+1),e.attr("organization-member-limit",n),this.renderMembers(e,i,n)},i.prototype.renderMembers=function(t,e,n){var i,s,r;return i=t.closest(".recipientList-organizationMembers").attr("organization-id"),(s=App.Organization.find(i)).members(e,n,(r=this,function(e){var n,i,s;for(n=0,i=e.length;n<i;n++)s=e[n],t.before(r.buildObjectItem(s));if(t.closest("ul").hasClass("is-shown"))return r.showOrganizationMembers(void 0,t.closest("ul"))})),s.member_ids.length<=n?t.addClass("hidden"):t.removeClass("hidden")},i.prototype.buildOrganizationMembers=function(t){var e;return e=$(App.view(this.templateOrganizationItemMembers)({organization:t})),this.renderMembers(e.find(".js-showMoreMembers"),0,10),e},i.prototype.buildObjectItem=function(t){var e;return e=this.objectIcon,!1===t.active&&this.inactiveObjectIcon&&(e=this.inactiveObjectIcon),App.view(this.templateObjectItem)({object:t,icon:e})},i.prototype.buildObjectNew=function(){return App.view(this.templateObjectNew)({objectCreate:this.objectCreate})},i.prototype.build=function(){var t,e,n,i,s,r,o,a,l,c,u;if(l="",n="",c="",this.attribute.multiple&&this.attribute.value){for("object"!=typeof this.attribute.value&&(this.attribute.value=[this.attribute.value]),u=[],t=0,e=(a=this.attribute.value).length;t<e;t++)s=a[t],App[this.objectSingle].exists(s)?(r=App[this.objectSingle].find(s).displayName(),o=s,u.push({name:r,value:o}),l+=App.view("generic/token")({name:r,value:o})):this.log("objectId doesn't exist",s);this.attribute.value=u}else(c=this.attribute.value)&&(App[this.objectSingle].exists(c)?(n=(i=App[this.objectSingle].find(c)).displayName(),i.email&&(n+=" <"+i.email+">")):this.params&&this.params[this.attribute.name+"_completion"]?n=this.params[this.attribute.name+"_completion"]:this.log("objectId doesn't exist",c));return this.html(App.view("generic/object_search/input")({attribute:this.attribute,value:c,tokens:l,name:n})),this.attribute.disableCreateObject||this.recipientList.append(this.buildObjectNew()),this.searchTerm="",this.objectSelect.on("keyup",this.onKeyUp)},i.prototype.onKeyUp=function(t){var e;if(e=$(t.target).val().trim(),this.searchTerm!==e)return this.searchTerm=e,this.hideOrganizationMembers(),_.isEmpty(e)?(this.emptyResultList(),this.attribute.disableCreateObject||this.recipientList.append(this.buildObjectNew()),void(this.attribute.multiple||this.resetObjectSelection())):e&&(!this.attribute.minLengt||this.attribute.minLengt<=e.length)?this.lazySearch(e):void 0},i.prototype.searchObject=function(t){var e,n;return e={query:t},this.attribute.queryCallback&&(e=this.attribute.queryCallback(t)),this.ajax({id:"searchObject"+this.key,type:this.attribute.sourceType,url:this.attribute.source,data:e,processData:!0,success:(n=this,function(t){var e,i,s,r,o,a,l,c,u,p;if(n.emptyResultList(),App.Collection.loadAssets(t.assets),t.user_ids)for(e=0,o=(u=t.user_ids).length;e<o;e++)i=u[e],l=App[n.objectSingle].fullLocal(i),n.recipientList.append(n.buildObjectItem(l));else{for(r=0,a=(p=t.result).length;r<a;r++)"Organization"===(s=p[r]).type?(c=App.Organization.fullLocal(s.id),n.recipientList.append(n.buildOrganizationItem(c)),c[n.referenceAttribute]&&n.$(".dropdown-menu").append(n.buildOrganizationMembers(c))):s.type===n.objectSingle&&(l=App[n.objectSingle].fullLocal(s.id),n.recipientList.append(n.buildObjectItem(l)));n.attribute.disableCreateObject||n.recipientList.append(n.buildObjectNew())}return n.recipientList.find(".js-object").first().addClass("is-active")})})},i.prototype.emptyResultList=function(){return this.recipientList.empty(),this.$(".recipientList-organizationMembers").remove()},i.prototype.showOrganizationMembers=function(t,e){var n,i;if(t&&(t.stopPropagation(),e=$(t.currentTarget)),n=e.data("organization-id")||e.attr("organization-id"),this.organizationList=this.$("[organization-id="+n+"]"),this.organizationList.get(0))return this.recipientList.removeClass("is-shown"),this.$(".recipientList-organizationMembers").addClass("is-shown"),$.Velocity.hook(this.organizationList,"translateX","100%"),this.organizationList.removeClass("hide"),this.organizationList.velocity({properties:{translateX:0},options:{duration:240}}),this.recipientList.velocity({properties:{translateX:"-100%"},options:{duration:240,complete:(i=this,function(){return i.recipientList.height(i.organizationList.height())})}})},i.prototype.hideOrganizationMembers=function(t){var e;if(t&&t.stopPropagation(),this.recipientList.addClass("is-shown"),this.$(".recipientList-organizationMembers").removeClass("is-shown"),this.organizationList)return this.recipientList.velocity({properties:{translateX:0},options:{duration:240}}),this.recipientList.height(""),this.organizationList.velocity({properties:{translateX:"100%"},options:{duration:240,complete:(e=this,function(){return e.organizationList.addClass("hide")})}})},i.prototype.newObject=function(t){if(t)return t.preventDefault()},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};App.Ajax=function(){function e(){}var n;return n=void 0,e.request=function(e){return void 0===n&&null==n&&(n=new t),n.request(e)},
e.abort=function(e){return void 0===n&&null==n&&(n=new t),n.abort(e)},e.abortAll=function(){return void 0===n&&null==n&&(n=new t),n.abortAll()},e.queue=function(){return void 0===n&&null==n&&(n=new t),n.queue()},e.current=function(){return void 0===n&&null==n&&(n=new t),n.current()},e.token=function(){return void 0===n&&null==n&&(n=new t),n.token()},e}(),t=function(){function t(t){var n;this.args=t,this._hide_spinner=e(this._hide_spinner,this),this._show_spinner=e(this._show_spinner,this),this.token=e(this.token,this),this.current=e(this.current,this),this.queue=e(this.queue,this),this.runNextInQueue=e(this.runNextInQueue,this),this.abortAll=e(this.abortAll,this),this.abort=e(this.abort,this),this.removeCurrentRequest=e(this.removeCurrentRequest,this),this.addCurrentRequest=e(this.addCurrentRequest,this),this.runNextInQueue(),$(document).on("ajaxSend",(n=this,function(){return n._show_spinner()})).on("ajaxComplete",function(t){return function(e,n){var i;if(t._hide_spinner(),i=n.getResponseHeader("CSRF-TOKEN"))return t.currentToken=i,t.defaults.headers["X-CSRF-Token"]=i,Spine.Ajax.defaults.headers["X-CSRF-Token"]=i}}(this)),$(document).on("ajaxError",(function(t,e,n){var i,s,r,o,a,l,c;if(!n.failResponseNoTrigger&&(c=e.status,i=e.responseText,c||i||(i=__("General communication error, maybe internet is not available!")),0!==c&&200!==c)){try{s=(a=JSON.parse(i)).error,r=a.error_human||s}catch(t){}if(r||(r=i),(null!=(l=App.Session.get())?l.id:void 0)&&(401===c||403===c&&s&&"Authentication required"===s)&&App.Event.trigger("auth:session_invalid"),401!==c&&403!==c&&404!==c&&422!==c&&502!==c)return o=App.Utils.htmlEscape(r),new App.ControllerTechnicalErrorModal({contentCode:o,head:"StatusCode: "+c})}}))}return t.prototype.defaults={contentType:"application/json",dataType:"json",processData:!1,headers:{"X-Requested-With":"XMLHttpRequest"},cache:!1,async:!0},t.prototype.currentToken=null,t.prototype.currentRequest={},t.prototype.queueList=[],t.prototype.queueRunning=!1,t.prototype.count=0,t.prototype.request=function(t){var e;return(e=$.extend({},this.defaults,t)).id?(this.abort(e.id),this.addCurrentRequest(e.id,e),e.id):(e.id="rand-"+(new Date).getTime()+"-"+Math.floor(99999*Math.random()),e.queue?(this.queueList.push(e),this.queueRunning||this.runNextInQueue()):this.addCurrentRequest(e.id,e),e.id)},t.prototype.addCurrentRequest=function(t,e,n){var i;if(e.complete=(i=this,function(){if(n&&(i.queueRunning=!1),i.removeCurrentRequest(t),n)return i.runNextInQueue()}),this.currentRequest[t]=$.ajax(e),!0!==e.async)return this.removeCurrentRequest(t)},t.prototype.removeCurrentRequest=function(t){return this.currentRequest[t]=void 0,delete this.currentRequest[t]},t.prototype.abort=function(t){return this.currentRequest[t]&&(this.currentRequest[t].abort(),this.currentRequest[t]=void 0,delete this.currentRequest[t]),this.queueList=_.filter(this.queueList,(function(e){if(e.id!==t)return e}))},t.prototype.abortAll=function(){var t,e,n;for(e in t=[],n=this.currentRequest)n[e],this.abort(e),t.push(e);return t},t.prototype.runNextInQueue=function(){var t;if(this.queueList&&this.queueList[0])return this.queueRunning=!0,t=this.queueList.shift(),this.addCurrentRequest(t.id,t,!0)},t.prototype.queue=function(){return this.queueList},t.prototype.current=function(){return this.currentRequest},t.prototype.token=function(){return this.currentToken},t.prototype._show_spinner=function(){return this.count++,$(".spinner").show()},t.prototype._hide_spinner=function(){return this.count--,0===this.count||"ajax"===App.WebSocket.channel()&&1===this.count?$(".spinner").hide():void 0},t}()}.call(this),function(){App.Audio=function(){function t(){}return t.play=function(t,e){var n,i;if(null==e&&(e=.1),window.Audio&&(n=new window.Audio).canPlayType&&("maybe"===(i=n.canPlayType("audio/mp3"))||"probably"===i))return $(n).prop("src",t),n.load(),n.preload="auto",n.volume=e,n.play()},t}()}.call(this),function(){App.Auth=function(){function t(){}return t.login=function(t){return App.Log.debug("Auth","login",t),t.data.fingerprint=App.Browser.fingerprint(),App.Ajax.request({id:"login",type:"POST",url:App.Config.get("api_path")+"/signin",data:JSON.stringify(t.data),success:(e=this,function(n,i,s){return e._login(n),t.success(n,i,s)}),error:function(e){return function(n,i,s){return e._loginError(),t.error(n,i,s)}}(this)});var e},t.loginCheck=function(t){var e,n;return e={fingerprint:App.Browser.fingerprint()},App.Log.debug("Auth","loginCheck"),App.Ajax.request({id:"login_check",async:!1,type:"POST",url:App.Config.get("api_path")+"/signshow",data:JSON.stringify(e),success:(n=this,function(e){if(n._login(e,"check"),t)return t()}),error:function(t){return function(){return t._loginError()}}(this)})},t.logout=function(t,e){var n,i;return null==t&&(t=!0),App.Log.debug("Auth","logout"),App.Ajax.abortAll(),i=this,n=function(){return Spine.Ajax.clearQueue(),App.Ajax.request({id:"logout",type:"DELETE",url:App.Config.get("api_path")+"/signout",success:function(n){return n&&n.url?location.replace(n.url):i._logout(t,e)},error:function(){return i._loginError()}})},Spine.Ajax.queue(n)},t._login=function(t,e){var n,i,s,r,o,a;if(App.Log.debug("Auth","_login:success",t),t.error){for(n in r=t.config)a=r[n],App.Config.set(n,a);return t.collections&&App.Collection.resetCollections(t.collections),App.Session.init(),this._updateModelAttributes(t.models),App.i18n.set(App.i18n.detectBrowserLocale()),App.Event.trigger("auth"),App.Event.trigger("auth:failed"),App.Event.trigger("ui:rerender"),!1}for(n in"check"!==e&&App.Event.trigger("clearStore"),this._updateModelAttributes(t.models),o=t.config)a=o[n],App.Config.set(n,a);return t.collections&&App.Collection.resetCollections(t.collections),t.assets&&App.Collection.loadAssets(t.assets),App.Session.set(t.session.id),App.Event.trigger("auth",t.session),App.Config.set("after_auth",t.after_auth),(s=App.Session.get("preferences"))&&s.locale&&(i=s.locale),i||(i=App.i18n.detectBrowserLocale()),App.i18n.set(i),App.Event.trigger("auth:login",t.session),App.Event.trigger("ui:rerender"),App.TaskManager.tasksInitial()},t._updateModelAttributes=function(t){var e,n,i;if(!_.isEmpty(t)){for(n in i=[],t)e=t[n],App[n]&&_.isFunction(App[n].updateAttributes)?i.push(App[n].updateAttributes(e)):i.push(void 0);return i}},t._logout=function(t,e){var n,i;for(n in null==t&&(t=!0),App.Log.debug("Auth","_logout"),App.TaskManager.reset(),App.Session.init(),App.Ajax.abortAll(),App.Config.set("after_auth",null),App)i=App[n],_.isFunction(i.clearInMemory)&&i.clearInMemory();if(App.Event.trigger("auth"),App.Event.trigger("auth:logout"),t&&this.loginCheck((function(){return window.location.href="#login",App.Event.trigger("ui:rerender")})),App.Event.trigger("clearStore"),e)return e()},t._loginError=function(){return App.Log.debug("Auth","_loginError:error"),App.Session.init(),App.Event.trigger("auth"),App.Event.trigger("auth:failed"),App.Event.trigger("ui:rerender"),App.Event.trigger("clearStore")},t}()}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Browser=function(){function e(){}return e.detection=function(){var t;return{browser:(t=new UAParser).getBrowser(),device:t.getDevice(),os:t.getOS()}},e.check=function(){var e,n;return n={Firefox:78,Chrome:83,Opera:69,Explorer:11,Safari:11},!((e=this.detection()).browser&&n[e.browser.name]&&e.browser.major<n[e.browser.name])||(new t({data:e,version:n[e.browser.name]}),App.Log.error("Browser","Browser not supported"),!1)},e.fingerprint=function(){var t,e,n,i,s;return(n=window.localStorage)&&(e=n.getItem("fingerprint")),e||(t=this.detection(),i=window.screen.availWidth+"x"+window.screen.availHeight+"/"+window.screen.pixelDepth,s=(new Date).toString().match(/\s\(.+?\)$/),e=function(t){return t.split("").reduce((function(t,e){return(t=(t<<5)-t+e.charCodeAt(0))&t}),0)}(""+t.browser.name+t.browser.major+t.os+i+s),n&&n.setItem("fingerprint",e),e)},e.magicKey=function(){return this.isMac()?"cmd":"ctrl"},e.hotkeys=function(){return this.isMac()?"alt+ctrl":"ctrl+shift"},e.isMac=function(){var t,e,n,i;if(e=null!=(t=this.detection())&&null!=(n=t.os)&&null!=(i=n.name)?i.toString():void 0)return e.match(/mac/i)},e}(),t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.buttonClose=!1,n.prototype.buttonCancel=!1,n.prototype.buttonSubmit=!1,n.prototype.backdrop=!1,n.prototype.keyboard=!1,n.prototype.head=__("Outdated Browser"),n.prototype.content=function(){return"Your Browser is not supported ("+this.data.browser.name+" "+this.data.browser.major+" on "+this.data.os.name+"). Please use a newer one (e. g. "+this.data.browser.name+" "+this.version+" or higher)."},n}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.BusinessHours=function(n){function i(){var e,n,s;for(e in this.validate=t(this.validate,this),this.toggleDay=t(this.toggleDay,this),this.removeTime=t(this.removeTime,this),this.addTime=t(this.addTime,this),this.onTimeChange=t(this.onTimeChange,this),this.updateMaxTimeframes=t(this.updateMaxTimeframes,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments),this.days={mon:App.i18n.translateInline("Monday"),tue:App.i18n.translateInline("Tuesday"),wed:App.i18n.translateInline("Wednesday"),thu:App.i18n.translateInline("Thursday"),fri:App.i18n.translateInline("Friday"),sat:App.i18n.translateInline("Saturday"),sun:App.i18n.translateInline("Sunday")},this.days)this.hours[e]||(this.hours[e]={});for(e in s=this.hours)(n=s[e]).active||(n.active=!1),n.timeframes||(n.timeframes=[])}return e(i,n),i.prototype.className="settings-list settings-list--fixed settings-list--stretch settings-list--toggleColumn",i.prototype.tag="table",i.prototype.events={"click .js-toggle-day":"toggleDay","click .js-add-time":"addTime","click .js-remove-time":"removeTime"},i.prototype.render=function(){var t;return this.updateMaxTimeframes(),t=App.view("generic/business_hours")({attribute:this.attribute,days:this.days,hours:this.options.hours,maxTimeframes:this.maxTimeframes}),this.html(t),this.$(".js-time").timepicker({showMeridian:!1}).on("changeTime.timepicker",this.onTimeChange),this.el.toggleClass("is-invalid",!this.validate())},i.prototype.updateMaxTimeframes=function(){var t;return t=_.max(this.hours,(function(t){return t.timeframes.length})),this.maxTimeframes=t.timeframes.length},i.prototype.onTimeChange=function(t){var e,n,i,s;return e=(i=this.$(t.currentTarget)).attr("data-day"),s=i.attr("data-slot"),n=i.attr("data-i"),this.options.hours[e].timeframes[s][n]=t.time.hoursAndMinutes,this.el.toggleClass("is-invalid",!this.validate())},i.prototype.addTime=function(t){var e;return e=this.$(t.currentTarget).attr("data-day"),this.options.hours[e].timeframes.push(["13:00","17:00"]),this.render()},i.prototype.removeTime=function(t){var e;return e=this.$(t.currentTarget).attr("data-day"),this.options.hours[e].timeframes.pop(),this.render()},i.prototype.toggleDay=function(t){var e,n;return n=(e=this.$(t.currentTarget)).attr("data-target"),this.options.hours[n].active=e.prop("checked"),this.$("[data-day="+n+"]").toggleClass("is-active",e.prop("checked")),this.el.toggleClass("is-invalid",!this.validate())},i.prototype.validate=function(){var t,e,n,i,s,r;for(t in i=this.options.hours){if(!(e=i[t]).active)break;if("00:00"===e.timeframes[0][0]&&"00:00"===e.timeframes[e.timeframes.length-1][1])return!0;for(r=n=0,s=e.timeframes.length-1;0<=s?n<=s:n>=s;r=0<=s?++n:--n){if(!this.earlier(e.timeframes[r][0],e.timeframes[r][1]))return!1;if(r>0&&!this.later(e.timeframes[r][0],e.timeframes[r-1][1]))return!1}}return!0},i.prototype.later=function(t,e){var n,i,s,r,o,a;return n=(o=t.split(":").map((function(t){return parseInt(t,10)})))[0],s=o[1],i=(a=e.split(":").map((function(t){return parseInt(t,10)})))[0],r=a[1],n>i||n===i&&s>r},i.prototype.earlier=function(t,e){var n,i,s,r,o,a;return n=(o=t.split(":").map((function(t){return parseInt(t,10)})))[0],s=o[1],i=(a=e.split(":").map((function(t){return parseInt(t,10)})))[0],r=a[1],n<i||n===i&&s<r},i}(Spine.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};App.ClipBoard=function(){function e(){}var n;return n=void 0,e.bind=function(e){return void 0===n&&null==n&&(n=new t),n.bind(e)},e.manuallyUpdateSelection=function(e){return void 0===n&&null==n&&(n=new t),n.manuallyUpdateSelection(e)},e.getSelected=function(e){return void 0===n&&null==n&&(n=new t),n.getSelected(e)},e.getSelectedObject=function(e){return void 0===n&&null==n&&(n=new t),n.getSelectedObject(e)},e.getSelectedLast=function(e){return void 0===n&&null==n&&(n=new t),n.getSelectedLast(e)},e.getPosition=function(e){return void 0===n&&null==n&&(n=new t),n.getPosition(e)},e.setPosition=function(e,i){return void 0===n&&null==n&&(n=new t),n.setPosition(e,i)},e.keycode=function(e){return void 0===n&&null==n&&(n=new t),n.keycode(e)},e}(),t=function(){function t(){this._updateSelection=e(this._updateSelection,this),this.selection={html:"",text:"",sel:null},this.selectionLast={html:"",text:"",sel:null}}return t.prototype.bind=function(t){var e;return $(t).on("mouseup",(e=this,function(){return e._updateSelection()})),$(t).on("keyup",function(t){return function(e){if(91===e.keyCode&&t._updateSelection(),37===e.keyCode||38===e.keyCode||39===e.keyCode||40===e.keyCode)return t._updateSelection()}}(this))},t.prototype._updateSelection=function(){var t,e,n,i,s;for(s=[],t=0,n=(i=["html","text","sel"]).length;t<n;t++)e=i[t],this.selection[e]=this._getSelected(e),this.selection[e]?s.push(this.selectionLast[e]=this.selection[e]):s.push(void 0);return s},t.prototype._getSelected=function(t){var e,n,i,s,r,o,a;if(a="",n="",window.getSelection?a=(o=window.getSelection()).toString():document.getSelection?a=(o=document.getSelection()).toString():document.selection&&(a=(o=document.selection.createRange()).text),"text"===t)return a?a.toString().trim():"";if(o&&o.rangeCount){for(e=document.createElement("div"),i=s=1,r=o.rangeCount;1<=r?s<=r:s>=r;i=1<=r?++s:--s)e.appendChild(o.getRangeAt(i-1).cloneContents());n=e.innerHTML}return"sel"!==t?n:o},t.prototype.manuallyUpdateSelection=function(){return this._updateSelection()},t.prototype.getSelected=function(t){return this.selection[t]},t.prototype.getSelectedObject=function(){return this.selection.sel},t.prototype.getSelectedLast=function(t){return this.selectionLast[t]},t.prototype.getPosition=function(t){var e,n;return n=0,t=document.getElementById(t),document.selection?(t.focus(),(e=document.selection.createRange()).moveStart("character",-t.value.length),n=e.text.length):(t.selectionStart||"0"===t.selectionStart)&&(n=t.selectionStart),n},t.prototype.setPosition=function(t,e){var n;return(t=document.getElementById(t)).setSelectionRange?(t.focus(),t.setSelectionRange(e,e)):t.createTextRange?((n=t.createTextRange()).collapse(!0),n.moveEnd("character",e),n.moveStart("character",e),n.select()):void 0},t.prototype.keycode=function(t){var e,n;for(e in n=this.keycodesTable())if(n[e].toString()===t.toString())return e},t.prototype.keycodesTable=function(){return{backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,space:32,pause_break:"19",caps_lock:"20",escape:"27",page_up:"33","page down":"34",end:"35",home:"36",left_arrow:"37",up_arrow:"38",right_arrow:"39",down_arrow:"40",insert:"45",delete:"46",0:"48",1:"49",2:"50",3:"51",4:"52",5:"53",6:"54",7:"55",8:"56",9:"57",a:"65",b:"66",c:"67",d:"68",e:"69",f:"70",g:"71",h:"72",i:"73",j:"74",k:"75",l:"76",m:"77",n:"78",o:"79",p:"80",q:"81",r:"82",s:"83",t:"84",u:"85",v:"86",w:"87",x:"88",y:"89",z:"90","left_window key":"91","right_window key":"92",select_key:"93","numpad 0":"96","numpad 1":"97","numpad 2":"98","numpad 3":"99","numpad 4":"100","numpad 5":"101","numpad 6":"102","numpad 7":"103","numpad 8":"104","numpad 9":"105",multiply:"106",add:"107",subtract:"109","decimal point":"110",divide:"111",f1:"112",f2:"113",f3:"114",f4:"115",f5:"116",f6:"117",f7:"118",f8:"119",f9:"120",f10:"121",f11:"122",f12:"123",num_lock:"144",scroll_lock:"145",semi_colon:"186",equal_sign:"187",comma:"188",dash:"189",period:"190",forward_slash:"191",grave_accent:"192",open_bracket:"219",backslash:"220",closebracket:"221",single_quote:"222"}},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.CodeEditor=function(n){function i(){this.release=t(this.release,this),this.onCollapseExpand=t(this.onCollapseExpand,this),this.update=t(this.update,this),this.initEditor=t(this.initEditor,this),this.editorOptions=t(this.editorOptions,this),this.mode=t(this.mode,this),this.hintOptions=t(this.hintOptions,this),this.fetchReplacements=t(this.fetchReplacements,this),this.renderHints=t(this.renderHints,this),this.element=t(this.element,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.elements={".js-codeEditor":"textarea"},i.prototype.events={"shown.bs.collapse":"onCollapseExpand"},i.prototype.render=function(){var t,e,n;return n=$(App.view("generic/code_editor")({attribute:this.attribute})),this.attribute.collapsible&&(t="panel-collapse collapse",_.isEmpty(this.attribute.value)||(t+=" in",e=!0),n=$('<div id="collapse-'+this.attribute.id+'" class="'+t+'">').append(n)),this.attribute.collapsible&&!e||App.Delay.set(this.initEditor,300,void 0,"init_code_editor"),this.html(n)},i.prototype.element=function(){return this.el},i.prototype.regTrigger=function(){return new RegExp("(?<=::|#{)([a-z0-9_.s]*)(}?)","g")},i.prototype.renderHints=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d,f,m,g,v;for(o=null,a=0,l=(p=Array.from(e.matchAll(this.regTrigger()))).length;a<l;a++)if(r=(g=(c=p[a]).index-2)+2+c[0].length,!(t.ch<g||t.ch>r)){c[2].length&&(i=!0),v=c[1].trim().toLowerCase();break}if(void 0!==v){if(h=new RegExp(escapeRegExp(v),"i"),d=new RegExp("\\b"+escapeRegExp(v)+"\\b","i"),u=function(t,e){return t.name&&t.name.match(e)||t.keywords&&t.keywords.match(e)},s=function(t,e){return t.name<e.name?1:t.name>e.name?-1:0},f=_.filter(this.replacements,(function(t){return u(t,h)&&!u(t,d)})),m=_.filter(this.replacements,(function(t){return u(t,d)})),f.sort(s),m.length&&(m.sort(s),f=f.concat(m)),f.length&&(!i||1!==f.length||f[0].text!=="#{"+v+"}"))return n(o={list:f,from:CodeMirror.Pos(t.line,g),to:CodeMirror.Pos(t.line,r)});n(o)}else n(o)},i.prototype.transformReplacements=function(t){return _.flatten(_.map(t,(function(t,e){return _.map(t,(function(t){return{text:"#{"+e+"."+t+"}",name:e+"."+t,keywords:e+"."+t,render:function(t,e,n){var i;return i=$("<kbd />").append(n.text),$(t).append(n.name).append(i)}}}))})))},i.prototype.fetchReplacements=function(t,e,n){var i,s,r;if(!this.replacements)return i=this.formParam($(this.el).parents("form")).pre_defined_webhook_type||"",s=this.apiPath+"/webhooks/payload/replacements",i&&(s+="?pre_defined_webhook_type="+i),this.ajax({id:"webhooks_replacements",type:"GET",url:s,processData:!0,success:(r=this,function(i){return r.replacements=r.transformReplacements(i),r.renderHints(t,e,n)})});this.renderHints(t,e,n)},i.prototype.hintOptions=function(){return{completeSingle:!1,hint:(t=this,function(e){return new Promise((function(n){var i,s;if(i=e.getCursor(),s=e.getLine(i.line),t.regTrigger().test(s))return t.fetchReplacements(i,s,n);n(null)}))})};var t},i.prototype.mode=function(){return this.attribute.mode||"json"},i.prototype.editorOptions=function(){return{autoCloseBrackets:!0,autofocus:this.attribute.autofocus,gutters:_.isUndefined(this.attribute.lineNumbers)||this.attribute.lineNumbers?["CodeMirror-lint-markers"]:[],hintOptions:this.hintOptions(),inputStyle:"contenteditable",lineNumbers:!!_.isUndefined(this.attribute.lineNumbers)||this.attribute.lineNumbers,lint:{skipEmpty:this.attribute.null},matchBrackets:!0,mode:this.mode(),readOnly:this.attribute.disabled,tabSize:2,theme:"zammad",value:this.textarea.val()}},i.prototype.initEditor=function(){var t,e;if(this.textarea.length)return e=this,t=function(t){return e.textarea.hide().after(t)},this.editor=CodeMirror(t,this.editorOptions()),this.attribute.height&&this.editor.setSize(null,this.attribute.height),this.editor.on("change",_.throttle(this.update,300)),this.editor.on("cursorActivity",function(t){return function(){return t.editor.showHint()}}(this))},i.prototype.update=function(t){return this.textarea.val(t.getValue())},i.prototype.onCollapseExpand=function(){if(!this.editor)return this.initEditor()},i.prototype.release=function(){if(this.editor)return this.editor.toTextArea(),this.editor=null},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Collection=function(){function e(){}var n;return n=void 0,e.init=function(){return n=new t},e.load=function(e){return void 0===n&&null==n&&(n=new t),n.load(e)},e.loadAssets=function(e,i){return void 0===n&&null==n&&(n=new t),n.loadAssets(e,i)},e.reset=function(e){return void 0===n&&null==n&&(n=new t),n.reset(e)},e.resetCollections=function(e){return void 0===n&&null==n&&(n=new t),n.resetCollections(e)},e}(),t=function(t){function n(t){var e;this.args=t,App.Event.bind("loadAssets",(e=this,function(t){if(t)return e.loadAssets(t);e.log("error","loadAssets:trigger, got no data, cant load assets")})),App.Event.bind("resetCollection",function(t){return function(e){if(e)return t.resetCollections(e);t.log("error","resetCollection:trigger, got no data, cant for collections")}}(this))}return e(n,t),n.include(App.LogInclude),n.prototype.resetCollections=function(t){var e,n,i;for(i in n=[],t)e=t[i],this.log("debug","resetCollection:trigger",i,e),n.push(this.reset({type:i,data:e}));return n},n.prototype.reset=function(t){var e;if(e=App[t.type])return e.refresh(t.data,{clear:!0});this.log("error","reset","no such collection "+t.type,t)},n.prototype.loadAssets=function(t,e){var n,i,s,r,o;if(null==e&&(e={}),!_.isEmpty(t)){for(o in s={},t)n=t[o],e.targetModel&&e.targetModel===o||(i=this.load({type:o,data:n,later:!0}),_.isEmpty(i)||(s[o]=i));for(o in s)n=s[o],App[o].refresh(n);if(e.targetModel){for(o in r=[],t)n=t[o],e.targetModel===o?r.push(this.load({type:o,data:n})):r.push(void 0);return r}}},n.prototype.load=function(t){var e,n,i,s,r,o,a;if(!_.isEmpty(t.data)){if(e=App[t.type]){if(_.isArray(t.data))return this.log("debug","refresh",t.data),void e.refresh(t.data);for(i in s=[],r=[],a=t.data)o=a[i],!t.refresh&&e&&(this.log("debug","refresh try",t.type,i),o.updated_at?(n=e.updatedAt(i))?n<o.updated_at&&(t.later?(r.push(o),this.log("debug","refresh newer later",t.type,i)):(s.push(o),this.log("debug","refresh newer",t.type,i))):(s.push(o),this.log("debug","refresh new no current updated_at",t.type,i)):(s.push(o),this.log("debug","refresh new",t.type,i)));return _.isEmpty(s)||e.refresh(s),r}this.log("error","reset","no such collection "+t.type,t)}},n}(Spine.Module)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Color=function(n){function i(){this.onLightnessMousemove=t(this.onLightnessMousemove,this),this.onHueSaturationMousemove=t(this.onHueSaturationMousemove,this),this.element=t(this.element,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.color=void 0,i.prototype.moving=void 0,i.prototype.elements={".js-input":"input",".js-swatch":"swatch",".js-colorpicker-hue-saturation":"hueSaturation",".js-colorpicker-lightness-plane":"lightnessPlane",".js-colorpicker-saturation-gradient":"saturationGradient",".js-colorpicker-circle":"circle",".js-colorpicker-lightness":"lightness",".js-colorpicker-hue-plane":"huePlane",".js-colorpicker-slider":"slider"},i.prototype.events={"input .js-input":"onInput","mousedown .js-colorpicker-hue-saturation":"onHueSaturationMousedown","mousedown .js-colorpicker-lightness":"onLightnessMousedown","click .js-dropdown":"stopPropagation"},i.prototype.stopPropagation=function(t){return t.stopPropagation()},i.prototype.element=function(){return this.el},i.prototype.render=function(){return this.color=new App.ColorObject(this.attribute.value),this.html(App.view("generic/color")({attribute:this.attribute,hsl:this.color.asHslArray()}))},i.prototype.onInput=function(){return this.color.updateWithString(this.input.val()),this.renderPicker(),this.updateSwatch(this.color.asString())},i.prototype.updateSwatch=function(t){return this.swatch.css("background-color",""),this.swatch.css("background-color",t)},i.prototype.onHueSaturationMousedown=function(t){return $(document).on("mousemove.colorpicker",this.onHueSaturationMousemove),$(document).on("mouseup.colorpicker",this.onMouseup),this.onHueSaturationMousemove(t)},i.prototype.onHueSaturationMousemove=function(t){var e;return e=this.hueSaturation.offset(),this.color.updateWithHslComponent(Math.max(0,Math.min(1,(t.pageX-e.left)/this.hueSaturation.width())),0),this.color.updateWithHslComponent(Math.max(0,Math.min(1,1-(t.pageY-e.top)/this.hueSaturation.height())),1),this.renderPicker(),this.renderPickerOutput()},i.prototype.onLightnessMousedown=function(t){return $(document).on("mousemove.colorpicker",this.onLightnessMousemove),$(document).on("mouseup.colorpicker",this.onMouseup),this.onLightnessMousemove(t)},i.prototype.onLightnessMousemove=function(t){var e;return e=this.lightness.offset(),this.color.updateWithHslComponent(Math.max(0,Math.min(1,1-(t.pageY-e.top)/this.lightness.height())),2),this.renderPicker(),this.renderPickerOutput()},i.prototype.onMouseup=function(){return $(document).off("mousemove.colorpicker"),$(document).off("mouseup.colorpicker")},i.prototype.renderPickerOutput=function(){var t;return t=this.color.asString(),this.updateSwatch(t),this.input.val(t)},i.prototype.renderPicker=function(){var t;return t=this.color.asHslArray(),this.lightnessPlane.css({"background-color":"hsla(0,0%,"+(t[2]>.5?100:0)+"%,"+2*Math.abs(t[2]-.5)+")"}),this.saturationGradient.css({"background-image":"linear-gradient(transparent, hsl(0, 0%, "+100*t[2]+"%))"}),this.circle.css({left:100*t[0]+"%",top:100-100*t[1]+"%",borderColor:t[2]>.5?"black":"white"}),this.huePlane.css({"background-color":"hsl("+360*t[0]+", 100%, 50%)"}),this.slider.css({top:100-100*t[2]+"%"})},i}(Spine.Controller)}.call(this),function(){App.ColorObject=function(){function t(t){this.original=t}return t.prototype.original=void 0,t.prototype.asHslArray=function(){return _.isArray(this.original)?this.original:this.constructor.anyToHslArray(this.original)},t.prototype.asString=function(){return _.isArray(this.original)?this.constructor.hslArrayToHslString(this.original):this.original},t.prototype.updateWithString=function(t){return this.original=t},t.prototype.updateWithHslComponent=function(t,e){return _.isArray(this.original)||(this.original=this.constructor.anyToHslArray(this.original)),this.original[e]=t},t.anyToRgb=function(t){var e,n;return(e=document.createElement("canvas")).width=e.height=1,(n=e.getContext("2d")).clearRect(0,0,1,1),n.fillStyle=t,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1).data},t.anyToHslArray=function(t){return this.rgbToHslArray(this.anyToRgb(t))},t.anyToHslString=function(t){return this.hslArrayToHslString(this.rgbToHslArray(this.anyToRgb(t)))},t.rgbToHslArray=function(t){var e,n,i,s,r,o,a,l,c;return t?(l=t[0]/255,i=t[1]/255,e=t[2]/255,o=Math.max(l,i,e),a=Math.min(l,i,e),r=(o+a)/2,o===a?s=c=0:(n=o-a,c=r>.5?n/(2-o-a):n/(o+a),s=function(){var t;switch(!1){case l!==o:return(i-e)/n+(null!=(t=i<e)?t:{6:0});case i!==o:return(e-l)/n+2;case e!==o:return(l-i)/n+4}}(),s/=6),[s,c,r]):[0,0,0]},t.hslArrayToHslString=function(t){return"hsl("+Math.round(360*t[0])+","+Math.round(100*t[1])+"%,"+Math.round(100*t[2])+"%)"},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ColumnSelect=function(n){function i(){var e;this.element=t(this.element,this),i.__super__.constructor.apply(this,arguments),this.render(),this.throttledRemove=_.throttle((e=this,function(){return e.remove(e.pickedValue)}),300,{trailing:!1}),this.throttledSelect=_.throttle(function(t){return function(){return t.select(t.pickedValue)}}(this),300,{trailing:!1}),this.attribute.onChange&&this.shadow.on("change",function(t){return function(){return t.attribute.onChange(t.shadow.val())}}(this))}return e(i,n),i.prototype.elements={".js-pool":"pool",".js-selected":"selected",".js-shadow":"shadow",".js-placeholder":"placeholder",".js-pool .js-option":"poolOptions",".js-selected .js-option":"selectedOptions",".js-search":"search",".js-clear":"clearButton"},i.prototype.events={"click .js-select":"onSelect","click .js-remove":"onRemove","input .js-search":"filter","click .js-clear":"clear","keydown .js-search":"onFilterKeydown"},i.prototype.className="form-control columnSelect",i.prototype.element=function(){return this.el},i.prototype.render=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h,d;if(!_.isEmpty(this.attribute.seperator))for(h=[],this.attribute.value?h=this.attribute.value.split(this.attribute.seperator):this.attribute.default&&(h=this.attribute.default.split(this.attribute.seperator)),e=0,s=h.length;e<s;e++)for(p=h[e],n=0,r=(c=this.options.attribute.options).length;n<r;n++)if(!0===(l=c[n]).group)for(i=0,o=(u=l.group).length;i<o;i++)(a=u[i]).value===p&&(a.selected=!0);else l.value===p&&(l.selected=!0);return this.values=[],t=[],_.each(this.options.attribute.options,(d=this,function(e){var n,i,s,r;if(void 0!==e.group){for(r=[],i=0,n=(s=e.group).length;i<n;i++)a=s[i],t.push(a),a.selected?r.push(d.values.push(a.value.toString())):r.push(void 0);return r}if(t.push(e),e.selected)return d.values.push(e.value.toString())})),this.html(App.view("generic/column_select")({attribute:this.options.attribute,allOptions:t,values:this.values}))},i.prototype.onSelect=function(t){return this.pickedValue=$(t.currentTarget).attr("data-value"),this.throttledSelect()},i.prototype.select=function(t){if(this.selected.find("[data-value='"+t+"']").removeClass("is-hidden"),this.pool.find("[data-value='"+t+"']").addClass("is-hidden"),this.values.push(t),_.isEmpty(this.attribute.seperator)?(this.shadow.val(this.values),this.shadow.trigger("change")):this.shadow.val(this.values.join(";")),this.placeholder.addClass("is-hidden"),this.search.val()&&0===this.poolOptions.not(".is-filtered").not(".is-hidden").length)return this.clear()},i.prototype.onRemove=function(t){return this.pickedValue=$(t.currentTarget).attr("data-value"),this.throttledRemove()},i.prototype.remove=function(t){if(this.pool.find("[data-value='"+t+"']").removeClass("is-hidden"),this.selected.find("[data-value='"+t+"']").addClass("is-hidden"),this.values.splice(this.values.indexOf(t),1),_.isEmpty(this.attribute.seperator)?(this.shadow.val(this.values),this.shadow.trigger("change")):this.shadow.val(this.values.join(";")),!this.values.length)return this.placeholder.removeClass("is-hidden")},i.prototype.filter=function(t){var e;return e=$(t.currentTarget).val(),this.poolOptions.each((function(t,n){if(!$(n).hasClass("is-hidden"))return $(n).text().toLowerCase().indexOf(e.toLowerCase())>-1?$(n).removeClass("is-filtered"):$(n).addClass("is-filtered")})),this.clearButton.toggleClass("is-hidden",0===e.length),this.pool.toggleClass("filter-active",0!==e.length)},i.prototype.clear=function(){return this.search.val(""),this.poolOptions.removeClass("is-filtered"),this.clearButton.addClass("is-hidden")},i.prototype.onFilterKeydown=function(t){var e;if(13===t.keyCode)return t.stopPropagation(),t.preventDefault(),(e=this.poolOptions.not(".is-filtered").not(".is-hidden").first())?this.select(e.attr("data-value")):void 0},i}(Spine.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty
;App.Delay=function(){function e(){}var n;return n=void 0,e.set=function(e,i,s,r,o){return void 0===n&&null==n&&(n=new t),n.set(e,i,s,r,o)},e.clear=function(e,i){return void 0===n&&null==n&&(n=new t),n.clear(e,i)},e.clearLevel=function(e){return void 0===n&&null==n&&(n=new t),n.clearLevel(e)},e.reset=function(){return void 0===n&&null==n&&(n=new t),n.reset()},e.count=function(){return void 0===n&&null==n&&(n=new _intervalSingleton),n.count()},e._all=function(){return void 0===n&&null==n&&(n=new t),n._all()},e}(),t=function(t){function i(){this._all=e(this._all,this),this.count=e(this.count,this),this.reset=e(this.reset,this),this.clearLevel=e(this.clearLevel,this),this.clear=e(this.clear,this),this.set=e(this.set,this),this.levelStack={}}return n(i,t),i.include(App.LogInclude),i.prototype.set=function(t,e,n,i,s){var r,o;return i||(i="_all"),n&&this.clear(n,i),n||(n=Math.floor(99999*Math.random())),this.log("debug","set",n,e,i,t,s),o=this,r=setTimeout((function(){return o.clear(n,i),s?(App.QueueManager.add("delay",t),App.QueueManager.run("delay")):t()}),e),this.levelStack[i]||(this.levelStack[i]={}),this.levelStack[i][n.toString()]={delay_id:r,timeout:e,level:i},n.toString()},i.prototype.clear=function(t,e){var n;if(e||(e="_all"),this.levelStack[e]&&(n=this.levelStack[e][t.toString()]))return this.log("debug","clear",n),clearTimeout(n.delay_id),delete this.levelStack[e][t.toString()],_.isEmpty(this.levelStack[e])?delete this.levelStack[e]:void 0},i.prototype.clearLevel=function(t){var e,n;if(this.levelStack[t]){for(e in n=this.levelStack[t])n[e],this.clear(e,t);return delete this.levelStack[t]}},i.prototype.reset=function(){var t,e,n,i;for(n in i=this.levelStack){for(e in t=i[n])t[e],this.clear(e,n);this.levelStack[n]={}}return!0},i.prototype.count=function(){var t,e,n,i;if(!this.levelStack)return 0;for(e in t=0,i=this.levelStack)n=i[e],t+=Object.keys(n).length;return t},i.prototype._all=function(){return this.levelStack},i}(Spine.Module)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Event=function(){function e(){}var n;return n=void 0,e.init=function(){return n=new t},e.bind=function(e,i,s){return void 0===n&&null==n&&(n=new t),n.bind(e,i,s,!1)},e.prototype.one=function(t,e,i){return this.bind(t,e,i,!0),n.bind(t,e,i,!0)},e.unbind=function(e,i,s){return void 0===n&&null==n&&(n=new t),n.unbind(e,i,s)},e.trigger=function(e,i){return void 0===n&&null==n&&(n=new t),n.trigger(e,i)},e.unbindLevel=function(e){return void 0===n&&null==n&&(n=new t),n.unbindLevel(e)},e.count=function(){return void 0===n&&null==n&&(n=new t),n.count()},e._allBindings=function(){return void 0===n&&null==n&&(n=new t),n._allBindings()},e}(),t=function(t){function n(){this.eventCurrent={}}return e(n,t),n.include(App.LogInclude),n.prototype.unbindLevel=function(t){var e,n,i,s;if(this.eventCurrent[t]){for(e=0,i=(s=this.eventCurrent[t]).length;e<i;e++)n=s[e],this.unbind(n.event,n.callback,t);return delete this.eventCurrent[t]}},n.prototype.bind=function(t,e,n,i){var s,r,o,a,l;for(null==i&&(i=!1),n||(n="_all"),this.eventCurrent[n]||(this.eventCurrent[n]=[]),l=[],o=0,a=(r=t.split(" ")).length;o<a;o++)s=r[o],this.eventCurrent[n].push({event:s,callback:e,one:!1}),i?l.push(this.log("debug","one",s,e)):l.push(this.log("debug","bind",s,e));return l},n.prototype.unbind=function(t,e,n){var i,s,r,o,a;for(n||(n="_all"),this.eventCurrent[n]||(this.eventCurrent[n]=[]),a=[],r=0,o=(s=t.split(" ")).length;r<o;r++)i=s[r],this.eventCurrent[n]=_.filter(this.eventCurrent[n],(function(t){if(e){if(t.event!==i&&t.callback!==e)return t}else if(t.event!==i)return t})),a.push(this.log("debug","unbind",i,e));return a},n.prototype.trigger=function(t,e){var n,i,s,r,o,a,l,c;for(a in r=t.split(" "),c=[],l=this.eventCurrent)n=l[a],c.push(function(){var t;for(o in t=[],n)i=n[o],t.push(function(){var t,n,o;for(o=[],t=0,n=r.length;t<n;t++)s=r[t],i.event===s?(i.callback(e),!0===i.one?o.push(this.unbind(s,i.callback,a)):o.push(void 0)):o.push(void 0);return o}.call(this));return t}.call(this));return c},n.prototype.count=function(){var t,e,n,i;if(!this.eventCurrent)return 0;for(e in t=0,i=this.eventCurrent)n=i[e],t+=Object.keys(n).length;return t},n.prototype._allBindings=function(){return this.eventCurrent},n}(Spine.Module)}.call(this),function(){App.FullQuoteHeader=function(){function t(){}return t.fullQuoteHeaderForward=function(t){var e,n,i,s;if(!App.Config.get("ui_ticket_zoom_article_email_full_quote_header"))return"";for(n in i=document.createElement("div"),e={Subject:t.subject,Date:App.i18n.translateTimestamp(t.created_at),From:this.fullQuoteHeaderForwardFrom(t),To:this.fullQuoteHeaderForwardTo(t),CC:this.fullQuoteHeaderForwardCC(t)})(s=e[n])&&i.append(App.i18n.translateContent(n),": ",s,document.createElement("br"));return i.append(document.createElement("br")),i.outerHTML},t.fullQuoteHeaderForwardFrom=function(t){var e;return e=t.origin_by_id||t.created_by_id,this.fullQuoteHeaderEnsurePrivacy(e)||this.fullQuoteHeaderEnsurePrivacy(t.from)||t.from},t.fullQuoteHeaderForwardTo=function(t){var e,n,i;return"email"===t.type.name||"web"===t.type.name?this.fullQuoteHeaderEnsureMultiPrivacy(t.to):"Customer"===t.sender.name&&"phone"===t.type.name?(e=null!=(n=App.Group.findByAttribute("name",t.to))?n.email_address_id:void 0)?App.EmailAddress.find(e).displayName():t.to:"Agent"===t.sender.name&&"phone"===t.type.name?(i=App.Ticket.find(t.ticket_id),this.fullQuoteHeaderEnsurePrivacy(i.customer_id)||this.fullQuoteHeaderEnsureMultiPrivacy(t.to)):t.to},t.fullQuoteHeaderForwardCC=function(t){return this.fullQuoteHeaderEnsureMultiPrivacy(t.cc)},t.fullQuoteHeaderEnsureMultiPrivacy=function(t){var e;if(t)return t.split(",").map((function(t){return t.trim()})).map((e=this,function(t){return e.fullQuoteHeaderEnsurePrivacy(t)||t})).join(", ")},t.fullQuoteHeaderEnsurePrivacyParseInput=function(t){var e;switch(typeof t){case"number":return App.User.find(t);case"string":if(e=this.fullQuoteHeaderExtractEmail(t))return App.User.findByAttribute("email",e);break;case"object":return t}},t.fullQuoteHeaderEnsurePrivacy=function(e){var n,i;if(i=t.fullQuoteHeaderEnsurePrivacyParseInput(e))return n=""+i.displayName(),!i.permission("ticket.agent")&&i.email&&(n=App.Utils.buildEmailAddress(i.displayName(),i.email)),n},t.fullQuoteHeaderExtractEmail=function(t){var e;if(e=t.match(/<?(\S+@\S[^>]+)(>?)/))return e[1]},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.GlobalSearch=function(n){function i(){this.close=t(this.close,this),this.renderTry=t(this.renderTry,this),this.ajaxStop=t(this.ajaxStop,this),this.ajaxStart=t(this.ajaxStart,this),this.search=t(this.search,this),i.__super__.constructor.apply(this,arguments),this.searchResultCache={},this.lastQuery=void 0,this.apiPath=App.Config.get("api_path"),this.ajaxId="search-"+Math.floor(999999*Math.random())}return e(i,n),i.prototype.ajaxCount=0,i.prototype.search=function(t){var e,n,i,s;return i=t.query,e=new Date,!t.force&&this.searchResultCache[i]&&this.searchResultCache[i].time>e.setSeconds(e.getSeconds()-20)?(this.ajaxRequestId&&App.Ajax.abort(this.ajaxRequestId),this.ajaxStart(t),this.renderTry(this.searchResultCache[i].result,i,t),s=this,n=function(){return s.ajaxStop(t)},void this.delay(n,700)):(n=function(e){return function(){return e.ajaxStart(t),n=function(){if(t.callbackLongerAsExpected)return t.callbackLongerAsExpected()},e.delay(n,1e4,"global-search-ajax-longer-as-expected"),e.ajaxRequestId=App.Ajax.request({id:e.ajaxId,type:"GET",url:e.apiPath+"/search",data:{query:i,limit:e.limit||10},processData:!0,success:function(n){var s,r,o,a,l,c,u,p,h;for(e.clearDelay("global-search-ajax-longer-as-expected"),App.Collection.loadAssets(n.assets),h=e.permissionCheck(App.Config.get("user/profile/:user_id","Routes").requiredPermission),c=e.permissionCheck(App.Config.get("organization/profile/:organization_id","Routes").requiredPermission),p={},s=0,l=(u=n.result).length;s<l;s++)("User"!==(r=u[s]).type||h)&&("Organization"!==r.type||c)&&(App[r.type]&&App[r.type].find?(p[r.type]||(p[r.type]=[]),(o=App[r.type].find(r.id)).searchResultAttributes?(a=o.searchResultAttributes(),p[r.type].push(a)):App.Log.error("_globalSearchSingleton","No such model "+r.type.toLocaleLowerCase()+".searchResultAttributes()")):App.Log.error("_globalSearchSingleton","No such model App."+r.type));return e.ajaxStop(t),e.renderTry(p,i,t)},error:function(){return e.clearDelay("global-search-ajax-longer-as-expected"),e.ajaxStop(t)}})}}(this),this.delay(n,t.delay||1,"global-search-ajax"))},i.prototype.ajaxStart=function(t){if(this.ajaxCount++,t.callbackStart)return t.callbackStart()},i.prototype.ajaxStop=function(t){if(this.ajaxCount--,0===this.ajaxCount&&t.callbackStop)return t.callbackStop()},i.prototype.renderTry=function(t,e,n){var i;if(e){if(_.isEmpty(t)?n.callbackNoMatch&&n.callbackNoMatch():n.callbackMatch&&n.callbackMatch(),!n.force&&this.lastQuery===e&&this.searchResultCache[e]&&(i=difference(this.searchResultCache[e].result,t),_.isEmpty(i)))return;this.lastQuery=e,this.searchResultCache[e]={result:t,time:new Date}}return this.render(t)},i.prototype.close=function(){return this.lastQuery=void 0},i}(App.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Html5Upload=function(n){function i(){return this.hideFileUploading=t(this.hideFileUploading,this),this.onFileError=t(this.onFileError,this),this.onFileAborted=t(this.onFileAborted,this),this.onFileCompleted=t(this.onFileCompleted,this),this.onFileProgress=t(this.onFileProgress,this),this.onFileStart=t(this.onFileStart,this),this.onFileAdded=t(this.onFileAdded,this),this.render=t(this.render,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.uploadUrl=null,i.prototype.maxSimultaneousUploads=1,i.prototype.key="File",i.prototype.data=null,i.prototype.onFileStartCallback=null,i.prototype.onFileCompletedCallback=null,i.prototype.onFileAbortedCallback=null,i.prototype.dropContainer=null,i.prototype.cancelContainer=null,i.prototype.inputField=null,i.prototype.attachmentPlaceholder=null,i.prototype.attachmentUpload=null,i.prototype.progressBar=null,i.prototype.progressText=null,i.prototype.render=function(){return html5Upload.initialize({uploadUrl:this.uploadUrl,dropContainer:this.dropContainer.get(0),cancelContainer:this.cancelContainer,inputField:this.inputField.get(0),maxSimultaneousUploads:this.maxSimultaneousUploads,key:this.key,data:this.data,onFileAdded:this.onFileAdded}),this.inputField.attr("data-initialized",!0)},i.prototype.onFileAdded=function(t){return t.on({onStart:this.onFileStart,onAborted:this.onFileAborted,onCompleted:this.onFileCompleted,onProgress:this.onFileProgress,onError:this.onFileError})},i.prototype.onFileStart=function(){return this.attachmentPlaceholder.addClass("hide"),this.attachmentUpload.removeClass("hide"),this.cancelContainer.removeClass("hide"),App.Log.debug("Html5Upload","upload start"),"function"==typeof this.onFileStartCallback?this.onFileStartCallback():void 0},i.prototype.onFileProgress=function(t){return t=parseInt(t),this.progressBar.width(t+"%"),this.progressText.text(t),t>=90&&this.cancelContainer.addClass("hide"),App.Log.debug("Html5Upload","uploadProgress ",t)},i.prototype.onFileCompleted=function(t){return t=JSON.parse(t),this.hideFileUploading(),"function"==typeof this.onFileCompletedCallback&&this.onFileCompletedCallback(t),App.Log.debug("Html5Upload","upload complete",t.data)},i.prototype.onFileAborted=function(){return this.hideFileUploading(),"function"==typeof this.onFileAbortedCallback&&this.onFileAbortedCallback(),App.Log.debug("Html5Upload","upload aborted")},i.prototype.onFileError=function(t){return this.hideFileUploading(),this.inputField.val(""),t&&(t=JSON.parse(t)),"function"==typeof this.callbackFileUploadStop&&this.callbackFileUploadStop(),new App.ControllerModal({head:__("Upload Failed"),buttonCancel:"Cancel",buttonCancelClass:"btn--danger",buttonSubmit:!1,message:t.error_human||t.error||__("The file could not be uploaded."),shown:!0,small:!0,container:this.inputField.closest(".content")}),App.Log.debug("Html5Upload","upload error")},i.prototype.hideFileUploading=function(){return this.attachmentPlaceholder.removeClass("hide"),this.attachmentUpload.addClass("hide"),this.progressBar.width("0%"),this.progressText.text("0")},i}(App.Controller)}.call(this),function(){var t,e=[].slice,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;App.i18n=function(){function n(){}var i;return i=void 0,n.init=function(e){return null!=i?i:i=new t(e)},n.translateDeep=function(){var n,s;return s=arguments[0],n=2<=arguments.length?e.call(arguments,1):[],void 0===i&&null==i&&(i=new t),i.translateDeep(s,n,!1)},n.translateDeepPlain=function(){var n,s;return s=arguments[0],n=2<=arguments.length?e.call(arguments,1):[],void 0===i&&null==i&&(i=new t),i.translateDeep(s,n,!0)},n.translateContent=function(){var n,s;return s=arguments[0],n=2<=arguments.length?e.call(arguments,1):[],void 0===i&&null==i&&(i=new t),i.translateContent(s,n)},n.translatePlain=function(){var n,s;return s=arguments[0],n=2<=arguments.length?e.call(arguments,1):[],void 0===i&&null==i&&(i=new t),i.translatePlain(s,n)},n.translateInline=function(){var n,s;return s=arguments[0],n=2<=arguments.length?e.call(arguments,1):[],void 0===i&&null==i&&(i=new t),i.translateInline(s,n)},n.translateTimestamp=function(e,n){return null==n&&(n=0),void 0===i&&null==i&&(i=new t),i.timestamp(e,n)},n.translateDate=function(e,n){return null==n&&(n=0),void 0===i&&null==i&&(i=new t),i.date(e,n)},n.dir=function(){return void 0===i&&null==i&&(i=new t),i.dir()},n.get=function(){return void 0===i&&null==i&&(i=new t),i.get()},n.set=function(e){return void 0===i&&null==i&&(i=new t),i.set(e)},n.setMap=function(e,n){return void 0===i&&null==i&&(i=new t),i.setMap(e,n)},n.meta=function(){return void 0===i&&null==i&&(i=new t),i.meta()},n.timeFormat=function(){return void 0===i&&null==i&&(i=new t),i.mapTime},n.detectBrowserLocale=function(){var t,e,n,i,s;if(window.navigator.languages)for(e=0,n=(s=window.navigator.languages).length;e<n;e++)if(t=s[e],i=this.findLocalLocale(t))return i;return window.navigator.language&&(i=this.findLocalLocale(window.navigator.language))||window.navigator.userLanguage&&(i=this.findLocalLocale(window.navigator.userLanguage))?i:"en-us"},n.findLocalLocale=function(t){var e,n,i,s,r,o,a,l,c;for(n=t.toLowerCase(),i=0,r=(l=App.Locale.all()).length;i<r;i++)if(n===(a=l[i]).locale.toLowerCase())return a.locale.toLowerCase();for(e=t.substr(0,2).toLowerCase(),s=0,o=(c=App.Locale.all()).length;s<o;s++)if(e===(a=c[s]).alias.toLowerCase())return a.locale.toLowerCase()},n.detectBrowserTimezone=function(){var t,e;if(window.Intl&&window.Intl.DateTimeFormat&&(t=Intl.DateTimeFormat())&&t.resolvedOptions&&(e=t.resolvedOptions())&&e.timeZone)return e.timeZone},n.convert=function(t,e,n){return i.convert(t,e,n)},n}(),t=function(t){function e(){this.timestamp=n(this.timestamp,this),this.date=n(this.date,this),this.setMap=n(this.setMap,this),this.meta=n(this.meta,this),this.translate=n(this.translate,this),this.translatePlain=n(this.translatePlain,this),this.translateContent=n(this.translateContent,this),this.translateDeep=n(this.translateDeep,this),this.translateInline=n(this.translateInline,this),this.mapTime={},this.mapString={},this.mapMeta={total:0,translated:0},this.dateFormat="yyyy-mm-dd",this.timestampFormat="yyyy-mm-dd HH:MM",this.dirToSet="ltr"}return i(e,t),e.include(App.LogInclude),e.prototype.dir=function(){return this.dirToSet},e.prototype.get=function(t){return null==t&&(t=!1),t&&!this.locale?"en-us":this.locale},e.prototype.set=function(t){var e,n,i,s,r,o,a,l,c,u;for(t=t.toLowerCase(),this.dirToSet="ltr",l=!1,e=0,s=(c=App.Locale.all()).length;e<s;e++)(a=c[e]).locale===t&&(t=a.locale,this.dirToSet=a.dir,l=!0);if(!l)for(n=0,r=c.length;n<r;n++)(a=c[n]).alias===t&&(t=a.locale,this.dirToSet=a.dir,l=!0);if(!l)for(t=t.substr(0,2),i=0,o=c.length;i<o;i++)(a=c[i]).alias===t&&(t=a.locale,this.dirToSet=a.dir,l=!0);if(t!==this.locale)return this.locale=t,$("html").prop("lang",t.substr(0,2)),$("html").prop("dir",this.dirToSet),this.mapString={},App.Ajax.request({id:"i18n-set-"+this.locale,type:"GET",url:App.Config.get("api_path")+"/translations/lang/"+this.locale,async:!1,success:(u=this,function(t){var e,n,i,s,r,o;for(u.mapMeta.total=t.total,i=[],s=0,n=(o=t.list).length;s<n;s++)"FORMAT_DATE"===(r=o[s])[1]||"FORMAT_DATETIME"===r[1]?u.mapTime[r[1]]=r[2]:(u.mapString[r[1]]=r[2],e={id:r[0],source:r[1],target:r[2],locale:u.locale},i.push(e));return u.mapMeta.translated=i.length,u.mapMeta.mapToLoad=i,App.Event.trigger("i18n:language:change")})})},e.prototype.translateInline=function(t,e){return t?this.translate(t,e,!0):t},e.prototype.translateDeep=function(t,e,n){return _.isArray(t)?_.map(t,(i=this,function(t){return i.translateDeep(t,e,n)})):_.isObject(t)?_.reduce(_.keys(t),function(i){return function(s,r){return s[r]=i.translateDeep(t[r],e,n),s}}(this),{}):n?this.translatePlain(t,e):this.translateInline(t,e);var i},e.prototype.translateContent=function(t,e){return t?App.Config.get("translation_inline")?'<span class="translation" contenteditable="true" title="'+App.Utils.htmlEscape(t)+'">'+App.Utils.htmlEscape(this.translate(t))+"</span>":this.translate(t,e,!0,!0):t},e.prototype.translatePlain=function(t,e){return this.translate(t,e)},e.prototype.translate=function(t,e,n,i){var s,r,o,a;if("string"!=typeof t&&t&&t.toString&&(t=t.toString()),void 0===t)return"";if(""===t)return"";if(void 0!==this.mapString[t]?(this._translated=!0,a=this.mapString[t]):(this._translated=!1,a=t),n&&(a=App.Utils.htmlEscape(a)),i&&(a=a.replace(/\|\|(.+?)\|\|/gm,"<i>$1</i>").replace(/\|(.+?)\|/gm,"<b>$1</b>").replace(/_(.+?)_/gm,"<u>$1</u>").replace(/\/\/(.+?)\/\//gm,"<del>$1</del>").replace(/\xa7(.+?)\xa7/gm,"<kbd>$1</kbd>")),e)for(r=0,o=e.length;r<o;r++)s=e[r],a=a.replace(/%(s|l)/,(function(t){return"%s"===t?n?App.Utils.htmlEscape(s):s:'<a href="'+s+'">\ud83d\udd17</a>'}));return i&&(a=a.replace(/\[(.+?)\]\((.+?)\)/gm,'<a href="$2" target="_blank">$1</a>')),this.log("debug","translate",t,e,a),a},e.prototype.meta=function(){return this.mapMeta},e.prototype.setMap=function(t,e){return"FORMAT_DATE"===t||"FORMAT_DATETIME"===t?""===e?delete this.mapTime[t]:this.mapTime[t]=e:""===e?delete this.mapString[t]:this.mapString[t]=e},e.prototype.date=function(t,e){return t?this.convert(t,e,this.mapTime.FORMAT_DATE||this.dateFormat):t},e.prototype.timestamp=function(t,e){return t?this.convert(t,e,this.mapTime.FORMAT_DATETIME||this.timestampFormat):t},e.prototype.convertUTC=function(t){var e,n,i,s,r,o;return o=(r=t.match(/\d+/g))[0],s=r[1],i=r[2],e=r[3],n=r[4],new Date(Date.UTC(o,s-1,i,e,n))},e.prototype.formatNumber=function(t,e){for(;t.toString().length<e;)t="0"+t;return t},e.prototype.convert=function(t,e,n){var i,s,r,o,a,l,c,u,p;return c=new Date(t),isNaN(c)&&t.match(/ UTC/)&&(c=this.convertUTC(t)),e&&(c=new Date(c.getTime()+6e4*c.getTimezoneOffset())),o=c.getDate(),l=c.getMonth()+1,u=c.getFullYear(),p=c.getYear()%100,r=c.getSeconds(),s=c.getMinutes(),(a=((i=c.getHours())+11)%12+1)<10&&(a=" "+a),n=n.replace(/dd/,this.formatNumber(o,2)).replace(/d/,o).replace(/mm/,this.formatNumber(l,2)).replace(/m/,l).replace(/yyyy/,u).replace(/yy/,p).replace(/SS/,this.formatNumber(r,2)).replace(/MM/,this.formatNumber(s,2)).replace(/HH/,this.formatNumber(i,2)).replace(/l/,a).replace(/P/,i>=12?"pm":"am")},e}(Spine.Module)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.IconPicker=function(n){function i(){var e;this.highlightItem=t(this.highlightItem,this),this.navigate=t(this.navigate,this),this.filterIcons=t(this.filterIcons,this),this.renderIcons=t(this.renderIcons,this),this.element=t(this.element,this),i.__super__.constructor.apply(this,arguments),this.throttledRenderIcons=_.throttle(this.renderIcons,300),this.render(),App.Utils.loadIconFont(this.attribute.iconset),App.Utils.loadIconFontInfo(this.attribute.iconset,(e=this,function(t){return e.library=t,e.renderIcons()}))}return e(i,n),i.prototype.library=null,i.prototype.empty=!1,i.prototype.columns=8,i.prototype.currentItem=null,i.prototype.events={"focus .js-input":"onFocus","input .js-filter-icons":"filterIcons","click .js-filter-icons":"stopPropagation","click .js-pick":"onIconClick","mouseenter .js-pick":"highlightItem","shown.bs.dropdown":"onPickerOpen","hidden.bs.dropdown":"onPickerClose","focus .js-shadow":"onShadowFocus"},i.prototype.elements={".js-iconGrid":"iconGrid",".js-noMatch":"noMatch",".js-shadow":"shadow",".js-input":"input",".js-filter-icons":"filter",".js-pick":"icons"},i.prototype.stopPropagation=function(t){return t.stopPropagation()},i.prototype.element=function(){return this.el},i.prototype.render=function(){return this.attribute.value,this.html(App.view("generic/icon_picker")({attribute:this.attribute,value:this.attribute.value}))},i.prototype.renderIcons=function(t){var e,n,i,s,r;return n=document.createDocumentFragment(),t&&(s=new RegExp(t,"i")),e=0,_.each(this.library,(r=this,function(i){if(!t||t&&(s.test(i.name)||i.filter&&_.some(i.filter,(function(t){return s.test(t)}))))return e++,n.appendChild($('<li class="icon js-pick" data-font="'+r.attribute.iconset+'" data-unicode="'+i.unicode+'">'+String.fromCharCode("0x"+i.unicode)+"</li>").get(0))})),e?(this.iconGrid.html(n),this.empty=!1,this.refreshElements()):(this.empty||((i=Math.floor(Math.random()*this.noMatch.length))===this.noMatch.filter(".is-active").index()&&(i=(i+1)%this.noMatch.length),this.noMatch.removeClass("is-active").eq(i).addClass("is-active")),this.empty=!0,this.iconGrid.empty())},i.prototype.filterIcons=function(t){return this.throttledRenderIcons(t.currentTarget.value)},i.prototype.onIconClick=function(t){return this.pick(t.currentTarget.getAttribute("data-unicode"))},i.prototype.pick=function(t){return this.shadow.val(t),this.input.text(String.fromCharCode("0x"+t)),this.el.closest("form").trigger("input")},i.prototype.onShadowFocus=function(){return this.input.trigger("focus")},i.prototype.onPickerOpen=function(){return this.filter.trigger("focus"),this.isOpen=!0},i.prototype.onPickerClose=function(){return this.isOpen=!1,this.filter.val(""),this.renderIcons(),$(document).off("keydown.icon_picker")},i.prototype.onFocus=function(){return $(document).on("keydown.icon_picker",this.navigate)},i.prototype.navigate=function(t){switch(t.keyCode){case 40:return this.nudge(t,0,1);case 38:return this.nudge(t,0,-1);case 39:return this.nudge(t,1);case 37:return this.nudge(t,-1);case 13:return this.onEnter(t);case 27:return this.onEscape()}},i.prototype.onEscape=function(){if(this.currentItem=null,this.isOpen)return this.toggle()},i.prototype.onEnter=function(){return this.isOpen?this.currentItem?(this.pick(this.currentItem.attr("data-unicode")),this.toggle()):void 0:this.toggle()},i.prototype.toggle=function(){return this.$('[data-toggle="dropdown"]').dropdown("toggle")},i.prototype.nudge=function(t,e,n){var i,s;if(t.preventDefault(),this.currentItem){if((s=this.currentItem.index())+(i=function(){switch(!1){case!(e>0):return 1;case!(e<0):return-1;case!(n>0):return this.columns;case!(n<0):return-this.columns}}.call(this))>=this.icons.length||s+i<0)return;s+=i,this.unhighlightCurrentItem()}else s=0;return this.currentItem=this.icons.eq(s),this.currentItem.addClass("is-active").get(0).scrollIntoView({behavior:"instant"})},i.prototype.highlightItem=function(t){return this.unhighlightCurrentItem(),this.currentItem=$(t.currentTarget),this.currentItem.addClass("is-active")},i.prototype.unhighlightCurrentItem=function(){if(this.currentItem)return this.currentItem.removeClass("is-active"),this.currentItem=null},i}(Spine.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.IconsetPicker=function(n){function i(){this.element=t(this.element,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.sets={FontAwesome:{name:__("Font Awesome"),version:"4.7",website:"https://fontawesome.com/v4.7.0/"},anticon:{name:__("Anticon"),version:"2.10",website:"https://2x.ant.design/components/icon/"},material:{name:__("Material"),version:"2.2.0",website:"https://material.io/icons/"},ionicons:{name:__("Ionicons"),version:"2.0.1",website:"https://ionicons.com/v2/"},"Simple-Line-Icons":{name:__("Simple Line Icons"),version:"0.0.1",website:"https://simplelineicons.github.io/"}},i.prototype.elements={".js-set":"setElements",input:"input"},i.prototype.events={"click .js-set":"pick"},i.prototype.element=function(){return this.el},i.prototype.render=function(){var t,e,n;for(t in this.html(App.view("generic/iconset_picker")({attribute:this.attribute,sets:this.sets})),n=[],e=this.sets)e[t],App.Utils.loadIconFont(t),n.push(App.Utils.loadIconFontInfo(t,this.initializePreview.bind(this,t)));return n},i.prototype.initializePreview=function(t,e){return this.sets[t].icons=e,this.renderPreview(t,e)},i.prototype.renderPreview=function(t){var e,n,i,s,r;for(e=document.createDocumentFragment(),i=_.shuffle(this.sets[t].icons),n=s=0,r=54;0<=r?s<=r:s>=r;n=0<=r?++s:--s)e.appendChild($('<i class="icon" data-font="'+t+'">'+String.fromCharCode("0x"+i[n].unicode)+"</i>").get(0));return this.el.find('[data-family="'+t+'"] .js-preview').html(e)},i.prototype.pick=function(t){var e;return e=$(t.currentTarget).attr("data-family"),this.input.val(e),this.setElements.removeClass("is-active"),t.currentTarget.classList.add("is-active")},i.prototype.flip=function(t){var e,n;return n=(e=$(t.currentTarget)).closest(".js-set").attr("data-family"),e.hasClass("do-flash")&&(e.removeClass("do-flash"),e.get(0).offsetWidth),e.text(String.fromCharCode("0x"+_.sample(this.sets[n].icons).unicode)),e.addClass("do-flash")},i}(Spine.Controller)}.call(this),function(){App.ImageService=function(){function t(){}return t.supported_types=["image/jpeg","image/png"],t.resizeForAvatar=function(e,n,i,s,r){return null==s&&(s=t.supported_types[0]),t.checkUrl(e)?r(e):t.resize(e,n,i,2,s,.7,r)},t.resizeForApp=function(e,n,i,s){return t.checkUrl(e)?s(e):t.resize(e,n,i,2,"image/png",.7,s)},t.resize=function(t,e,n,i,s,r,o,a){var l,c;return null==e&&(e="auto"),null==n&&(n="auto"),null==i&&(i=1),null==a&&(a=!0),(l=new Image).onload=(c=this,function(){var t,a,u,p,h;return u=l.width,a=l.height,console.log("ImageService","current size",u,a),console.log("ImageService","sizeFactor",i),"auto"===n&&"auto"===e&&(e=u,n=a),"auto"!==e&&e>u&&(e=u),"auto"!==n&&n>a&&(n=a),"auto"===n&&(n=a/(u/e)),"auto"===e&&(e=u/(a/n)),t=document.createElement("canvas"),h=!1,e<u&&e*i<u||n<a&&n*i<a?(h=!0,e*=i,n*=i,t.width=e,t.height=n,t.getContext("2d").drawImage(l,0,0,e,n)):(t.width=u,t.height=a,t.getContext("2d").drawImage(l,0,0,u,a)),"auto"===r&&(r=e<200&&n<200?1:e<400&&n<400?.9:e<600&&n<600?.8:e<900&&n<900?.7:.6),p=t.toDataURL(c.validateType(s),r),h?(console.log("ImageService","resize",e/i,n/i,r,.75*p.length/1024/1024,"in mb"),void o(p,e/i,n/i,!0)):(console.log("ImageService","no resize",e,n,r,.75*p.length/1024/1024,"in mb"),o(p,e,n,!1))}),l.src=t},t.checkUrl=function(t){return/\.svg$/i.test(t)},t.validateType=function(e){return-1===t.supported_types.indexOf(e)?t.supported_types[0]:e},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.Run=function(n){function i(){this.start=t(this.start,this),i.__super__.constructor.apply(this,arguments),this.el=$("#app"),App.Event.trigger("app:init"),App.Browser.check()&&($(".splash").hide(),App.Collection.init(),App.Auth.loginCheck(this.start))}return e(i,n),i.prototype.start=function(){return App.WebSocket.connect(),App.Plugin.init(this.el),App.Router.init(this.el),this.frontendTimeUpdate(),App.ClipBoard.bind(this.el),App.Event.trigger("app:ready")},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.Interval=function(){function e(){}var n;return n=void 0,e.set=function(e,i,s,r,o){return void 0===n&&null==n&&(n=new t),n.set(e,i,s,r,o)},e.clear=function(e,i){return void 0===n&&null==n&&(n=new t),n.clear(e,i)},e.clearLevel=function(e){return void 0===n&&null==n&&(n=new t),n.clearLevel(e)},e.reset=function(){return void 0===n&&null==n&&(n=new t),n.reset()},e.count=function(){return void 0===n&&null==n&&(n=new t),n.count()},e._all=function(){return void 0===n&&null==n&&(n=new t),n._all()},e}(),t=function(t){function i(){this._all=e(this._all,this),this.count=e(this.count,this),this.reset=e(this.reset,this),this.clearLevel=e(this.clearLevel,this),this.clear=e(this.clear,this),this.set=e(this.set,this),this.levelStack={}}return n(i,t),i.include(App.LogInclude),i.prototype.set=function(t,e,n,i,s){var r,o;return i||(i="_all"),n&&this.clear(n,i),n||(n=Math.floor(99999*Math.random())),this.log("debug","set",n,e,i,t,s),(o=function(){return s?(App.QueueManager.add("interval",t),App.QueueManager.run("interval")):t()})(),r=setInterval(o,e),this.levelStack[i]||(this.levelStack[i]={}),this.levelStack[i][n.toString()]={interval_id:r,timeout:e,level:i},n.toString()},i.prototype.clear=function(t,e){var n;if(e||(e="_all"),this.levelStack[e]&&(n=this.levelStack[e][t.toString()]))return this.log("debug","clear",n),clearInterval(n.interval_id),delete this.levelStack[e][t.toString()],_.isEmpty(this.levelStack[e])?delete this.levelStack[e]:void 0},i.prototype.clearLevel=function(t){var e,n;if(this.levelStack[t]){for(e in n=this.levelStack[t])n[e],this.clear(e,t);return delete this.levelStack[t]}},i.prototype.reset=function(){var t,e,n,i;for(n in i=this.levelStack){for(e in t=i[n])t[e],this.clear(e,n);this.levelStack[n]={}}return!0},i.prototype.count=function(){var t,e,n,i;if(!this.levelStack)return 0;for(e in t=0,i=this.levelStack)n=i[e],t+=Object.keys(n).length;return t},i.prototype._all=function(){return this.levelStack},i}(Spine.Module)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.MultiLocales=function(n){function i(){this.parentObjectUpdated=t(this.parentObjectUpdated,this),i.__super__.constructor.apply(this,arguments),this.multiple_rows_supported=App.Config.get("kb_multi_lingual_support"),this.rows=[],this.render(),this.object&&this.listenTo(this.object,"refresh",this.parentObjectUpdated)}return e(i,n),i.prototype.events={"click .js-remove":"remove","click .js-primary":"primary","change .js-shadow":"changeOnRow"},i.prototype.parentObjectUpdated=function(){return App.Delay.set((t=this,function(){return t.attribute.value=t.object.attributes()[t.attribute.name],t.render()}));var t},i.prototype.render=function(){var t,e,n,i;if(this.html(App.view("generic/multi_locales")({attribute:this.attribute,vc:this})),Array.isArray(this.attribute.value))for(t=0,e=(i=this.attribute.value).length;t<e;t++)n=i[t],this.appendRow(this.renderRow(n,1===this.attribute.value.length));if(this.multiple_rows_supported||!Array.isArray(this.attribute.value)||0===this.attribute.value.length)return this.appendRow(this.renderRow())},i.prototype.renderRow=function(t,e){var n,i;return null==e&&(e=!1),n=App.KnowledgeBaseLocale.find(null!=t?t.id:void 0),new App.MultiLocalesRow({attribute:this.attribute,kb_locale:n,
available_locales:this.selectableLocales(null!=n&&null!=(i=n.systemLocale())?i.id:void 0),solo:e})},i.prototype.selectableLocales=function(t){var e;return e=this.$(".js-shadow").toArray().map((function(t){return $(t).val()})).filter((function(e){return e&&e!==t})),App.Locale.all().filter((function(t){return!_.includes(e,String(t.id))}))},i.prototype.remove=function(t){var e,n,i;if(e=$(t.currentTarget).closest("tr")[0],!(null!=(i=_.find(this.rows,(function(t){return t.el[0]===e})))?i.primaryCheckbox.prop("checked"):void 0))return(null!=i&&null!=(n=i.kb_locale)?n.id:void 0)?i.toggleDelete():(i.el.remove(),this.rows.splice(this.rows.indexOf(i),1)),this.changeOnRow()},i.prototype.primary=function(t){var e;if(!(e=$(t.currentTarget).find("input")).attr("disabled"))return e.prop("checked",!0),this.changeOnRow()},i.prototype.changeOnRow=function(){var t,e,n,i,s,r,o,a;if(!this.hasEmptyRow()&&this.multiple_rows_supported&&this.appendRow(this.renderRow()),s=this.rows.filter((function(t){return t.selector.shadowInput.val()})),1===s.length)s[0].updateButtons(!0,!0);else for(t=0,n=s.length;t<n;t++)(a=s[t]).updateButtons(!1);for(o=[],e=0,i=(r=this.rows).length;e<i;e++)a=r[e],o.push(a.updateOptions(this.selectableLocales(a.selector.shadowInput.val())));return o},i.prototype.hasEmptyRow=function(){return this.$(".js-shadow").is((function(t,e){return!$(e).val()}))},i.prototype.appendRow=function(t){return this.rows.push(t),this.$("tbody").append(t.el)},i}(App.Controller)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.MultiLocalesRow=function(e){function n(){var t;n.__super__.constructor.apply(this,arguments),this.el.data("kbLocaleId",null!=(t=this.kb_locale)?t.id:void 0),this.render()}return t(n,e),n.prototype.tag="tr",n.prototype.elements={".js-primary input":"primaryCheckbox",".js-remove input":"removeButton",".js-selectorContainer":"selectorContainer"},n.prototype.events={"change .js-shadow":"change"},n.prototype.render=function(){var t,e,n,i;return this.html(App.view("generic/multi_locales_row")({attribute:this.attribute,kb_locale:this.kb_locale})),i=null!=(t=this.kb_locale)&&null!=(e=t.systemLocale())?e.id:void 0,this._updateButtons(i,this.solo,null!=(n=this.kb_locale)?n.primary:void 0),this.selector=this.localesSelectBuild(this.attribute.name,i,this.selectorContainer),this.updateOptions(this.available_locales)},n.prototype.localesSelectBuild=function(t,e,n){return new App.SearchableSelect({el:n,attribute:{name:t,value:e,null:!1,translate:!0,placeholder:App.i18n.translatePlain("Select locale\u2026"),options:[],class:"form-control--small"}})},n.prototype.updateOptions=function(t){var e,n;return n=this.selector.shadowInput.val(),(e=t.map((function(t){return{name:t.name,value:t.id,selected:t.id+""===n}}))).sort((function(t,e){return t.name.localeCompare(e.name)})),this.selector.attribute.options=e,this.selector.render()},n.prototype.updateButtons=function(t,e){return null==e&&(e=void 0),void 0===e&&(e=this.primaryCheckbox[0].checked),this._updateButtons(this.selector.shadowInput.val(),t,e)},n.prototype._updateButtons=function(t,e,n){var i;return i=this.el.hasClass("settings-list--deleted"),this.removeButton.attr("disabled",e||!t||n),this.removeButton.parent().toggleClass("is-disabled",e||!t||n),this.primaryCheckbox.attr("disabled",e||!t||i),this.primaryCheckbox.prop("checked",n)},n.prototype.change=function(){return this.primaryCheckbox.attr("value",this.selector.shadowInput.val())},n.prototype.toggleDelete=function(){return this.el.toggleClass("settings-list--deleted"),this.removeButton.prop("checked",this.el.hasClass("settings-list--deleted")),this.selector.el.toggleClass("u-unclickable")},n}(App.Controller)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.event="ticket_overview_index",n.prototype.restEndpoint="/ticket_overviews",n}(App._CollectionSingletonBase),App.OverviewIndexCollection=function(){function e(){}var n;return n=new t,e.get=function(){return n.get()},e.one=function(t,e){return null==e&&(e=!0),n.bind(t,e,!0)},e.bind=function(t,e){return null==e&&(e=!0),n.bind(t,e,!1)},e.unbind=function(t){return n.unbind(t)},e.unbindById=function(t){return n.unbindById(t)},e.trigger=function(){return n.trigger()},e.fetch=function(){return n.fetch()},e}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};t=function(){function t(){var t;this.clear=e(this.clear,this),this.callback=e(this.callback,this),this.trigger=e(this.trigger,this),this.fetch=e(this.fetch,this),this.overview={},this.callbacks={},this.fetchActive={},this.counter=0,App.Event.bind("ticket_overview_list",(t=this,function(e){return e.assets&&(App.Collection.loadAssets(e.assets),delete e.assets),t.overview[e.overview.view]||(t.overview[e.overview.view]={}),t.overview[e.overview.view]=e,t.callback(e.overview.view,e)})),App.Event.bind("auth:logout",function(t){return function(e){return t.clear(e)}}(this))}return t.prototype.get=function(t){return this.overview[t]},t.prototype.bind=function(t,e,n){return null==n&&(n=!0),this.counter+=1,this.callbacks[this.counter]={view:t,callback:e},n&&(void 0===this.overview[t]?this.fetch(t):this.callback(t,this.overview[t])),this.counter},t.prototype.unbind=function(t){return delete this.callbacks[t]},t.prototype.fetch=function(t){if(!t)throw"No view to fetch list!";var e;if(App.OverviewIndexCollection.fetch(),!this.fetchActive[t])return this.fetchActive[t]=!0,App.Ajax.request({id:"ticket_overview_"+t,type:"GET",url:App.Config.get("api_path")+"/ticket_overviews",data:{view:t},processData:!0,success:(e=this,function(n){return e.fetchActive[t]=!1,n.assets&&(App.Collection.loadAssets(n.assets),delete n.assets),n.index&&n.index.overview&&(e.overview[n.index.overview.view]=n.index),e.callback(t,n.index)}),error:function(e){return function(){return e.fetchActive[t]=!1}}(this)})},t.prototype.trigger=function(t){return this.callback(t,this.get(t))},t.prototype.callback=function(t,e){var n,i,s,r,o;for(i in o=[],r=this.callbacks)(s=r[i]).view===t?(n=function(){return s.callback(e)},App.QueueManager.add("ticket_overviews",n),o.push(App.QueueManager.run("ticket_overviews"))):o.push(void 0);return o},t.prototype.clear=function(){return this.overview={},this.callbacks={},this.fetchActive={},this.counter=0},t}(),App.OverviewListCollection=function(){function e(){}var n;return n=new t,e.get=function(e){return void 0===n&&null==n&&(n=new t),n.get(e)},e.bind=function(e,i,s){return void 0===n&&null==n&&(n=new t),n.bind(e,i,s)},e.unbind=function(e){return void 0===n&&null==n&&(n=new t),n.unbind(e)},e.fetch=function(e){return void 0===n&&null==n&&(n=new t),n.fetch(e)},e.trigger=function(e){return void 0===n&&null==n&&(n=new t),n.trigger(e)},e}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};App.Plugin=function(){function e(){}var n;return n=void 0,e.init=function(e){return void 0===n&&null==n&&(n=new t),n.init(e)},e}(),t=function(){function t(){this.setupAll=e(this.setupAll,this),this.init=e(this.init,this)}return t.prototype.backends={},t.prototype.el=void 0,t.prototype.init=function(t){return t&&(this.appEl=t),this.setupAll(),App.Event.bind("auth:login auth:logout",(e=this,function(){return e.setupAll()}));var e},t.prototype.setupAll=function(){var t,e,n;for(e in this.appEl.empty(),n=this.backend)(t=n[e]).release&&t.release(),t.releaseController&&t.releaseController();return this.backend={},this.setup("Plugins","plugin")},t.prototype.setup=function(t,e){var n,i,s,r,o,a,l;if(App.Event.trigger(e+":init"),a=App.Config.get(t))for(i=0,r=(l=Object.keys(a).sort()).length;i<r;i++){o=a[s=l[i]];try{this.backend[s]=new o({appEl:this.appEl,key:s})}catch(t){n=t,App.Log.error("plugin "+s+":",n)}}return App.Event.trigger(e+":ready")},t}()}.call(this),function(){App.PopoverProvider=function(){function t(t){if(null===t.parentController)throw"Parent controller needs to be set";this.params=_.extend({},this.constructor.defaults,t)}return t.selectorCssClassPrefix=null,t.templateName=null,t.titleTemplateName=null,t.permission="ticket.agent",t.providersConfigKey="PopoverProviders",t.registerProvider=function(t,e){return this.providers||(this.providers={}),this.providers[t]=e,App.Config.set(t,e,this.providersConfigKey)},t.defaults={position:"right",parentController:null},null,t.prototype.build=function(t){if(this.checkPermissions())return this.clear(this.popovers),t.doNotBind||this.bind(),this.popovers=this.buildPopovers()},t.prototype.checkPermissions=function(){return this.params.parentController.permissionCheck(this.constructor.permission)},t.prototype.cssClass=function(){return this.constructor.selectorCssClassPrefix+"-popover"},t.prototype.bind=function(){},t.prototype.buildPopovers=function(t){var e,n;return null==t&&(t={}),e=this,n=t.selector||"."+this.cssClass(),this.params.parentController.el.find(n).popover({trigger:"hover",container:"body",html:!0,sanitize:!1,animation:!1,delay:100,placement:"auto "+this.params.position,title:function(){return e.buildTitleFor(this,t)},content:function(){return e.buildContentFor(this,t)}})},t.prototype.clear=function(){if(this.popovers)return this.popovers.popover("destroy")},t.prototype.hide=function(){if(this.popovers)return this.popovers.popover("hide")},t.prototype.buildTitleFor=function(){return"title"},t.prototype.buildContentFor=function(){return"content"},t.prototype.buildHtmlTitle=function(t){return App.view("popover/"+this.constructor.titleTemplateName)(t)},t.prototype.buildHtmlContent=function(t){var e,n;return(e=$(App.view("popover/"+this.constructor.templateName)(t))).find(".humanTimeFromNow").each((n=this,function(){return n.params.parentController.frontendTimeUpdateItem($(n))})),e},t.prototype.displayTitleUsing=function(){throw"please override"},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.SingleObjectPopoverProvider=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.klass=null,n.ignoredAttributes=[],n.includeData=!0,n.templateName="single_object_generic",n.titleTemplateName="title_generic",n.additionalHeadlineTemplateName=null,n.prototype.fullCssSelector=function(){return"div."+this.cssClass()+", span."+this.cssClass()},n.prototype.bind=function(){return this.params.parentController.$(this.fullCssSelector()).on("click",(t=this,function(e){var n;if(n=t.getObject(e.target))return t.params.parentController.navigate(n.uiUrl())}));var t},n.prototype.getObject=function(t,e){var n;if(null==e&&(e=!1),n=this.objectIdFor(t))return e?this.constructor.klass.fullLocal(n):this.constructor.klass.find(n)},n.prototype.objectIdFor=function(t){return $(t).data("id")},n.prototype.showAvatar=function(t,e){return $(t).data("popover-show-avatar")&&e&&"function"==typeof e.avatar},n.prototype.buildTitleFor=function(t){var e,n;return e={object:n=this.getObject(t),displayTitle:this.displayTitleUsing(n),showAvatar:this.showAvatar(t,n)},this.constructor.additionalHeadlineTemplateName&&(e.additionalHeadlineTemplateName="popover/"+this.constructor.additionalHeadlineTemplateName),this.buildHtmlTitle(e)},n.prototype.buildContentFor=function(t){var e,n,i;return i=this.getObject(t,!0),n=this.constructor.ignoredAttributes,e=_.values(this.constructor.klass.attributesGet("view")).filter((function(t){var e,s;return(s=(e=t.name).substr(0,e.length-3))in i&&(e=s),!_.isUndefined(i[e])&&t.shown&&!_.include(n,e)})),this.buildHtmlContent({object:i,attributes:e})},n}(App.PopoverProvider)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.klass=App.Ticket,n.selectorCssClassPrefix="escalation",n.templateName="escalation",n.includeData=!1,n.prototype.displayTitleUsing=function(){return App.i18n.translateInline("Escalation Times")},n.prototype.buildContentFor=function(t){var e,n;return e=this.objectIdFor(t),n=this.constructor.klass.fullLocal(e),this.buildHtmlContent({object:n})},n}(App.SingleObjectPopoverProvider),App.PopoverProvider.registerProvider("Escalation",t)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.KbPopoverProvider=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.templateName="kb_generic",n.includeData=!1,n.prototype.displayTitleUsing=function(t){return t.title},n}(App.SingleObjectPopoverProvider)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.klass=App.KnowledgeBaseAnswerTranslation,n.selectorCssClassPrefix="kb-answer",n}(App.KbPopoverProvider),App.PopoverProvider.registerProvider("KnowledgeBaseAnswer",t)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.klass=App.KnowledgeBaseCategoryTranslation,n.selectorCssClassPrefix="kb-category",n}(App.KbPopoverProvider),App.PopoverProvider.registerProvider("KnowledgeBaseCategory",t)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.klass=App.KnowledgeBaseTranslation,n.selectorCssClassPrefix="kb",n}(App.KbPopoverProvider),App.PopoverProvider.registerProvider("KnowledgeBase",t)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.klass=App.Organization,n.selectorCssClassPrefix="organization",n.templateName="organization",n.ignoredAttributes=["name"],n.prototype.displayTitleUsing=function(t){return t.name},n.prototype.buildHtmlContent=function(t){var e;return e=n.__super__.buildHtmlContent.apply(this,arguments),t.object.members(0,10,(function(t){var n,i,s,r,o;for(r=[],i=0,s=t.length;i<s;i++)o=t[i],n=$('<li class="person"></li>'),!1===o.active&&n.addClass("is-inactive"),n.append(o.displayName()),r.push(n);return e.find(".js-organizationUserList").html(r)})),e},n}(App.SingleObjectPopoverProvider),App.PopoverProvider.registerProvider("Organization",t)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.klass=App.Ticket,n.selectorCssClassPrefix="ticket",n.templateName="ticket",n.includeData=!1,n.prototype.displayTitleUsing=function(t){return t.title},n}(App.SingleObjectPopoverProvider),App.PopoverProvider.registerProvider("Ticket",t)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.klass=App.User,n.selectorCssClassPrefix="user",n.templateName="user",n.ignoredAttributes=["firstname","lastname","organization"],n.additionalHeadlineTemplateName="user_organization_headline",n.prototype.displayTitleUsing=function(t){var e;return e=t.displayName(),t.isOutOfOffice()&&(e+=" ("+t.outOfOfficeText()+")"),e},n}(App.SingleObjectPopoverProvider),App.PopoverProvider.registerProvider("User",t)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.UserTicketPopoverProvider=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.templateName="user_ticket_list",n.prototype.fetch=function(t){return this.params.parentController.ajax({type:"GET",url:App.Config.get("api_path")+"/ticket_customer",data:{customer_id:t.user_id},processData:!0,success:(e=this,function(n){var i;return App.Collection.loadAssets(n.assets),i={open:n.ticket_ids_open,closed:n.ticket_ids_closed},e.callback({ticketsList:i,selector:t.selector})})});var e},n.prototype.build=function(t){if(this.checkPermissions())return this.fetch(t)},n.prototype.callback=function(t){return this.clear(this.popovers),this.popovers=this.buildPopovers(t)},n.prototype.buildTitleFor=function(t){return $(t).find('[title="*"]').val()},n.prototype.buildContentFor=function(t,e){var n,i;return i=$(t).filter("[data-type]").data("type"),n=(e.ticketsList[i]||[]).map((function(t){return App.Ticket.fullLocal(t)})),this.buildHtmlContent({tickets:n})},n}(App.PopoverProvider)}.call(this),function(){App.PrettyDate=function(){function t(){}return t.humanTime=function(t,e,n,i){var s,r,o,a,l,c,u,p,h,d;return null==n&&(n=!0),null==i&&(i=void 0),t?(a=((o=new Date)-(r=new Date(t)))/1e3,"",e&&(a>0&&"-",a>=0?p='class="label label-danger"':a>-3600&&(p='class="label label-warning"')),l="future",a>-1&&(l="past"),a.toString().match("-")&&(a=a.toString().replace("-",""),a=parseFloat(a)),a<60?App.i18n.translateInline("just now"):(void 0===i&&window.App&&window.App.Config&&(i=window.App.Config.get("pretty_date_format")),"timestamp"===i?(u=App.i18n.translateTimestamp(t),e&&(u="<span "+p+">"+u+"</span>"),u):"absolute"!==i||"past"!==l&&"future"!==l?"past"===l&&!e&&a>604800?App.i18n.translateDate(t):(u="",s=0,a>=86400&&(s++,u=(h=Math.floor(a/86400))+" "+(n?h>1||0===h?App.i18n.translateInline("days"):App.i18n.translateInline("day"):App.i18n.translateInline("d")),a-=86400*h,h>=9||a<3600||2===s)||a>=3600&&(s++,""!==u&&(u+=" "),u=u+(h=Math.floor(a/3600%24))+" "+(n?h>1||0===h?App.i18n.translateInline("hours"):App.i18n.translateInline("hour"):App.i18n.translateInline("h")),a-=3600*h,h>=9||a<60||2===s)?(u="past"===l?App.i18n.translateInline("%s ago",u):App.i18n.translateInline("in %s",u),e&&(u="<span "+p+">"+u+"</span>"),u):(""!==u&&(u+=" "),u=u+(h=Math.floor(a/60%60))+" "+(n?h>1||0===h?App.i18n.translateInline("minutes"):App.i18n.translateInline("minute"):App.i18n.translateInline("m")),u="past"===l?App.i18n.translateInline("%s ago",u):App.i18n.translateInline("in %s",u),e&&(u="<span "+p+">"+u+"</span>"),u)):(d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.getMonth()],u=a<518400?App.i18n.translateInline(d)+" "+r.getHours()+":"+this.s(r.getMinutes(),2):r.getYear()===o.getYear()?App.i18n.translateInline(d)+" "+r.getDate()+". "+App.i18n.translateInline(c)+" "+r.getHours()+":"+this.s(r.getMinutes(),2):App.i18n.translateInline(d)+" "+App.i18n.translateTimestamp(t),e&&(u="<span "+p+">"+u+"</span>"),u))):""},t.s=function(t,e){for(;t.toString().length<e;)t="0"+t;return t},t.getISOWeeks=function(t){var e,n;return e=new Date(t+"-01-01").getDay(),n=1===new Date(t+"-02-29").getMonth(),4===e||n&&3===e?53:52},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var s in n)e.call(n,s)&&(t[s]=n[s]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;App.Router=function(e){function n(t){var e,n,i,s;for(n in i=App.Config.get("Routes"),s=this,e=function(e,n){return s.route(e,(function(i){var s,r;return App.Log.debug("execute page controller",e,i),(r=App.Config.get("History"))[10]&&r.shift(),r.push(window.location.hash),s=function(i){var s;i.appEl=t;try{return new n(i)}catch(t){return s=t,App.Log.error("route "+e+":",s)}},s(i)}))},i)e(n,i[n]);Spine.Route.setup()}return t(n,e),n.init=function(t){return new App.Router(t)},n}(Spine.Controller)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SearchableSelect=function(n){function i(){this.onClearKeyDown=t(this.onClearKeyDown,this),this.clearValue=t(this.clearValue,this),this.toggleClear=t(this.toggleClear,this),this.dropupSetTopOffsetIfNeeded=t(this.dropupSetTopOffsetIfNeeded,this),this.highlightItem=t(this.highlightItem,this),this.onInput=t(this.onInput,this),this.removeToken=t(this.removeToken,this),this.removeThisToken=t(this.removeThisToken,this),this.createToken=t(this.createToken,this),this.updateAttributeOptionSelected=t(this.updateAttributeOptionSelected,this),this.onShadowChange=t(this.onShadowChange,this),this.selectValue=t(this.selectValue,this),this.resetSearch=t(this.resetSearch,this),this.navigate=t(this.navigate,this),this.toggle=t(this.toggle,this),this.onKeyUp=t(this.onKeyUp,this),this.resetAutocomplete=t(this.resetAutocomplete,this),this.onDropdownHidden=t(this.onDropdownHidden,this),this.onDropdownShown=t(this.onDropdownShown,this),this.onDropdownShow=t(this.onDropdownShow,this),this.renderAllOptions=t(this.renderAllOptions,this),this.renderOptions=t(this.renderOptions,this),this.updateAttributeOptionDisplayName=t(this.updateAttributeOptionDisplayName,this),this.renderElement=t(this.renderElement,this),this.element=t(this.element,this),i.__super__.constructor.apply(this,arguments),this.render()}return e(i,n),i.prototype.events={"input .js-input":"onInput","blur .js-input":"onBlur","focus .js-input":"onFocus","focus .js-shadow":"onShadowFocus","change .js-shadow":"onShadowChange","click .js-option":"selectItem","click .js-option .searchableSelect-option-text":"selectItem","click .js-enter .searchableSelect-option-text":"selectItem","click .searchableSelect-option-arrow":"navigateIn","click .js-back":"navigateOut","mouseenter .js-option":"highlightItem","mouseenter .js-enter":"highlightItem","mouseenter .js-back":"highlightItem","shown.bs.dropdown":"onDropdownShown","hidden.bs.dropdown":"onDropdownHidden","keyup .js-input":"onKeyUp","click .js-remove:not(.is-disabled)":"removeThisToken","show.bs.dropdown":"onDropdownShow","keydown .js-clear":"onClearKeyDown"},i.prototype.elements={".js-dropdown":"dropdown",".js-option, .js-enter":"optionItems",".js-input":"input",".js-shadow":"shadowInput",".js-optionsList":"optionsList",".js-optionsSubmenu":"optionsSubmenu",".js-autocomplete-invisible":"invisiblePart",".js-autocomplete-visible":"visiblePart",".js-clear":"clear"},i.prototype.className="searchableSelect controls dropdown dropdown--actions",i.prototype.element=function(){return this.el},i.prototype.render=function(){return this.renderElement()},i.prototype.renderElement=function(){var t,e,n,i,s,r,o,a,l,c,u,p,h;if(this.updateAttributeOptionDisplayName(this.attribute.options),this.updateAttributeValueName(),u="",this.attribute.multiple&&this.attribute.value&&"json"!==this.attribute.valueType){if(c=this.attribute.relation,"object"!=typeof this.attribute.value&&(this.attribute.value=[this.attribute.value]),h=[],e=this.attribute.disabled,c)for(n=0,s=(a=this.attribute.value).length;n<s;n++)t=a[n],App[c]&&App[c].exists(t)&&(o=App[c].find(t).displayName(),p=t,h.push({name:o,value:p}),u+=App.view("generic/token")({name:o,value:p,object:c,disabled:e}));else for(i=0,r=(l=this.attribute.value).length;i<r;i++)p=l[i],h.push({name:p,value:p}),u+=App.view("generic/token")({name:p,value:p,disabled:e});this.attribute.value=h}return this.html(App.view("generic/searchable_select")({attribute:this.attribute,options:this.renderAllOptions("",this.attribute.options,0),submenus:this.renderSubmenus(this.attribute.options),tokens:this.attribute.existingTokens||u})),this.input.get(0).selectValue=this.selectValue,this.currentMenu=this.findMenuContainingValue(this.attribute.value),this.level=this.getIndex(this.currentMenu),this.clear.on("click.searchable_select",this.clearValue)},i.prototype.renderSubmenus=function(t){var e,n,i,s;if(e="",t)for(n=0,i=t.length;n<i;n++)(s=t[n]).children&&(e+=App.view("generic/searchable_select_submenu")({options:this.renderOptions(s.children),parentValue:s.value,title:s.name}),this.hasSubmenu(s.children)&&(e+=this.renderSubmenus(s.children)));return e},i.prototype.updateAttributeOptionDisplayName=function(t,e){var n,i,s,r,o;if(null==e&&(e=[]),!_.isEmpty(t)){for(o=[],i=0,s=t.length;i<s;i++)r=t[i],(n=_.clone(e)).push(r.name),r.displayName=this.displayName(n),r.children?o.push(this.updateAttributeOptionDisplayName(r.children,n)):o.push(void 0);return o}},i.prototype.displayName=function(t){return t.join(" \u203a ")},i.prototype.updateAttributeValueName=function(){var t;return(t=this.findFirstSelection(this.attribute.options))?(this.attribute.valueName=t.name,this.attribute.value=t.value,this.attribute.displayName=t.displayName):this.attribute.unknown&&this.attribute.value?(this.attribute.valueName=this.attribute.value,this.attribute.displayName=this.attribute.valueName):this.hasSubmenu(this.attribute.options)?(this.attribute.valueName=this.getName(this.attribute.value,this.attribute.options),this.attribute.displayName=this.getDisplayName(this.attribute.value,this.attribute.options)):void 0},i.prototype.findFirstSelection=function(t){var e,n,i,s;if(t)for(e=0,n=t.length;e<n;e++){if((i=t[e]).selected)return i;if(i.children&&(s=this.findFirstSelection(i.children)))return s}},i.prototype.hasSubmenu=function(t){var e,n;if(!t)return!1;for(e=0,n=t.length;e<n;e++)if(t[e].children)return!0;return!1},i.prototype.getName=function(t,e){var n,i,s,r,o;for(n=0,i=e.length;n<i;n++){if((null!=(o=(r=e[n]).value)?o.toString():void 0)===(null!=t?t.toString():void 0))return r.name;if(r.children&&void 0!==(s=this.getName(t,r.children)))return s}},i.prototype.getDisplayName=function(t,e){var n,i,s,r,o;for(i=0,s=e.length;i<s;i++){if((null!=(o=(r=e[i]).value)?o.toString():void 0)===(null!=t?t.toString():void 0))return r.displayName;if(r.children&&void 0!==(n=this.getDisplayName(t,r.children)))return n}},i.prototype.renderOptions=function(t){var e,n,i,s,r,o;for(n="",i=0,s=t.length;i<s;i++)e="u-textTruncate",(r=t[i]).children?e+=" js-enter":e+=" js-option",r.category&&(e+=" with-category"),n+=App.view("generic/searchable_select_option")({class:e,isSelected:r.value.toString()===(null!=(o=this.attribute.value)?o.toString():void 0),option:r});return n},i.prototype.renderAllOptions=function(t,e,n){var i,s,r,o,a,l,c,u;if(r="",e)for(o=0,a=e.length;o<a;o++)i=(l=e[o]).children?"js-enter":"js-option",n&&n>0&&(i+=" is-hidden is-child"),r+=App.view("generic/searchable_select_option")({class:i,detail:t,isSelected:(null!=(c=l.value)?c.toString():void 0)===(null!=(u=this.attribute.value)?u.toString():void 0),option:l}),l.children&&(s=0===n?"\u2014":"\u203a",r+=this.renderAllOptions(t+" "+s+" "+l.name,l.children,n+1));return r},i.prototype.onDropdownShow=function(t){if(this.attribute.disabled)return t.preventDefault()},i.prototype.onDropdownShown=function(){return this.input.on("click",this.stopPropagation),this.dropupSetTopOffsetIfNeeded(),this.highlightFirst(),this.level>0&&this.showSubmenu(this.currentMenu),this.isOpen=!0,this.toggleClear()},i.prototype.onDropdownHidden=function(){return this.input.off("click",this.stopPropagation),this.unhighlightCurrentItem(),this.isOpen=!1,this.resetAutocomplete(),this.input.val()||this.attribute.multiple||(this.updateAttributeValueName(),this.input.val(this.attribute.valueName).attr("title",this.attribute.displayName)),this.input.trigger("change"),this.shadowInput.trigger("change"),this.toggleClear()},i.prototype.resetAutocomplete=function(){if(this.query&&this.query===this.input.val())return this.query="",this.input.val(this.query),this.filterByQuery(this.query)},i.prototype.onKeyUp=function(){if(""===this.input.val().trim()&&!this.attribute.multiple)return this.shadowInput.val("")},i.prototype.toggle=function(){return this.currentItem=null,this.$('[data-toggle="dropdown"]').dropdown("toggle")},i.prototype.stopPropagation=function(t){return t.stopPropagation()},i.prototype.navigate=function(t){switch(t.keyCode){case 40:return this.nudge(t,1);case 38:return this.nudge(t,-1);case 39:return this.autocompleteOrNavigateIn(t);case 37:return this.autocompleteOrNavigateOut(t);case 13:return this.onEnter(t);case 27:return this.onEscape(t);case 9:return this.onTab(t);case 8:if(""===this.input.val()&&this.input.is(t.target)&&this.attribute.multiple)return this.removeToken("last")}},i.prototype.onEscape=function(){if(this.isOpen)return event.stopPropagation(),this.toggle(),this.input.trigger("blur")},i.prototype.getCurrentOptions=function(){return this.currentMenu.find(".js-option, .js-enter, .js-back")},i.prototype.getOptionIndex=function(t,e){return t.find(".js-option, .js-enter").filter((function(t,n){return $(n).attr("data-value")===e})).index()},i.prototype.nudge=function(t,e){var n,i,s,r;return this.isOpen?(s=this.getCurrentOptions(),t.preventDefault(),r=s.not(".is-hidden"),i=s.filter(".is-active"),n=r.index(i),(n+=e)<0||n>r.length-1?void 0:(this.unhighlightCurrentItem(),this.currentItem=r.eq(n),this.currentItem.addClass("is-active"),this.currentItem.hasClass("js-enter")&&this.currentItem.addClass("is-highlighted"),this.clearAutocomplete())):this.toggle()},i.prototype.autocompleteOrNavigateIn=function(t){return this.currentItem&&this.currentItem.hasClass("js-enter")?this.navigateIn(t):this.fillWithAutocompleteSuggestion(t)},i.prototype.autocompleteOrNavigateOut=function(t){return 0!==this.level?this.navigateOut(t):this.fillWithAutocompleteSuggestion(t)},i.prototype.fillWithAutocompleteSuggestion=function(t){var e;if(this.suggestion)return e=39===t.keyCode?this.suggestion.length:this.invisiblePart.text().length+1,this.attribute.multiple?this.addValueToShadowInput(this.suggestion,this.suggestionValue):(this.input.val(this.suggestion).attr("title",this.suggestion),this.shadowInput.val(this.suggestionValue)),this.clearAutocomplete(),this.attribute.multiple||(this.toggle(),this.input.trigger("blur")),this.input.prop("selectionStart",e),this.input.prop("selectionEnd",e)},i.prototype.autocomplete=function(t,e){var n;return this.suggestion=e,this.suggestionValue=t,n=e.indexOf(this.query),this.query&&0===n?(this.invisiblePart.text(this.query),this.visiblePart.text(e.slice(this.query.length))):this.clearAutocomplete()},i.prototype.clearAutocomplete=function(){return this.suggestion=null,this.visiblePart.text(""),this.invisiblePart.text("")},i.prototype.resetSearch=function(){return this.input.val("").removeAttr("title"),this.onInput(null,!1)},i.prototype.selectValue=function(t,e,n){return this.resetSearch(),this.input.val(e).attr("title",n),this.shadowInput.val(t),this.attribute.valueName=e,this.attribute.value=t},i.prototype.selectItem=function(t){var e,n,i;if($(t.target).hasClass("is-inactive"))t.stopPropagation();else if(e=$(t.target).text().trim())return n=$(t.target).closest("li").data("value"),e=$(t.target).text().trim(),i=$(t.target).closest("li").data("displayName"),this.attribute.multiple?(t.stopPropagation(),this.addValueToShadowInput(e,n)):(this.selectValue(n,e,i),this.markSelected(n),this.toggleClear())},i.prototype.markSelected=function(t){return this.el.find("li").removeClass("is-selected"),this.el.find("li[data-value='"+jQuery.escapeSelector(t)+"']").addClass("is-selected")},i.prototype.navigateIn=function(t){return t.stopPropagation(),this.navigateDepth(1)},i.prototype.navigateOut=function(t){return t.stopPropagation(),this.navigateDepth(-1)},i.prototype.navigateDepth=function(t){var e,n;if(!this.animating&&this.currentItem)return t>0?(e=this.currentItem.attr("data-value"),
n=this.optionsSubmenu.filter((function(t,n){return $(n).attr("data-parent-value")===e}))):n=this.findMenuContainingValue(this.currentMenu.attr("data-parent-value")),this.animateToSubmenu(n,t),this.level+=t},i.prototype.animateToSubmenu=function(t,e){var n,i,s,r,o;return this.animating=!0,t.prop("hidden",!1),this.dropdown.height(Math.max(t.height(),this.currentMenu.height())),i=this.currentItem,this.currentMenu.data("current_item_index",this.currentItem.index()),s=t.data("current_item_index")||1,-1===e&&(r=this.currentMenu.attr("data-parent-value"),s=this.getOptionIndex(t,r)),this.currentItem=t.children().eq(s),this.currentItem.addClass("is-active"),t.velocity({properties:{translateX:[0,100*e+"%"]},options:{duration:240}}),"up"===this.attribute.direction&&((n=this.currentMenu.height()-t.height())>0?t.css("top",n):n<0&&(this.currentMenu.css("top",-1*n),this.dropdown.css("top","-"+t.height()+"px"))),this.currentMenu.velocity({properties:{translateX:[-100*e+"%",0]},options:{duration:240,complete:(o=this,function(){return"up"===o.attribute.direction&&t.css("top",0),i.removeClass("is-active"),i.hasClass("js-enter")&&i.removeClass("is-highlighted"),$.Velocity.hook(o.currentMenu,"translateX",""),o.currentMenu.prop("hidden",!0),o.dropdown.height(t.height()),o.currentMenu=t,o.animating=!1,o.dropupSetTopOffsetIfNeeded()})}})},i.prototype.showSubmenu=function(t){return this.currentMenu.prop("hidden",!0),t.prop("hidden",!1),this.dropdown.height(t.height())},i.prototype.findParentOptionByValue=function(t,e,n){var i,s,r,o;if(t)for(i=0,s=t.length;i<s;i++){if((null!=(o=(r=t[i]).value)?o.toString():void 0)===(null!=e?e.toString():void 0))return n;if(r.children)return this.findParentOptionByValue(r.children,e,r)}},i.prototype.findMenuContainingValue=function(t){var e;return this.attribute.options&&t&&(e=this.findParentOptionByValue(this.attribute.options,t))?this.optionsSubmenu.filter((function(t,n){return $(n).attr("data-parent-value")===e.value.toString()})):this.optionsList},i.prototype.getIndex=function(t){var e;return t&&(e=t.attr("data-parent-value"))?e.split("::").length:0},i.prototype.onTab=function(t){return this.isOpen?t.preventDefault():(this.input.off("click",this.stopPropagation),this.resetAutocomplete(),this.input.val()||this.attribute.multiple||(this.updateAttributeValueName(),this.input.val(this.attribute.valueName).attr("title",this.attribute.displayName)),void this.toggleClear())},i.prototype.onEnter=function(t){var e,n,i;if(this.currentItem&&this.currentItem.hasClass("js-back"))return this.navigateOut(t);if(this.clearAutocomplete(),this.isOpen){if(t.preventDefault(),this.currentItem||!this.attribute.unknown){if(this.currentItem.hasClass("has-inactive"))return;i=this.currentItem.children("span.searchableSelect-option-text").text().trim(),n=this.currentItem.attr("data-value"),e=this.currentItem.data("displayName"),this.attribute.multiple?this.addValueToShadowInput(i,n):(this.selectValue(n,i,e),this.markSelected(n),this.toggleClear()),this.currentItem.removeClass("is-active"),this.currentItem.hasClass("js-enter")&&this.currentItem.removeClass("is-highlighted"),this.currentItem=null}return this.input.trigger("change"),this.attribute.multiple?void 0:(this.toggle(),this.input.trigger("blur"))}""===this.shadowInput.val()?(t.preventDefault(),this.toggle()):(this.trigger("enter"),this.el.trigger("enter"))},i.prototype.onBlur=function(){return this.clearAutocomplete(),this.input.off("keydown.searchable_select")},i.prototype.onFocus=function(){return this.input.on("keydown.searchable_select",this.navigate),this.input.val("").removeAttr("title")},i.prototype.onShadowFocus=function(){return this.isOpen||this.toggle(),this.input.trigger("focus")},i.prototype.onShadowChange=function(){var t;return t=this.shadowInput.val(),this.attribute.multiple&&this.currentData&&(this.createToken(this.currentData),this.currentData=null),this.updateAttributeOptionSelected(this.attribute.options,t)},i.prototype.updateAttributeOptionSelected=function(t,e){var n,i,s,r;if(!_.isEmpty(t)){for(r=[],n=0,i=t.length;n<i;n++)s=t[n],this.attribute.multiple?s.selected=_.includes(e||[],s.value.toString()):s.selected=s.value.toString()===(null!=e?e.toString():void 0),s.children?r.push(this.updateAttributeOptionSelected(s.children,e)):r.push(void 0);return r}},i.prototype.createToken=function(t){var e,n,i;return n=t.name,i=t.value,e={},e=this.attribute.relation?{name:String(n),value:i,object:this.attribute.relation}:{name:String(i),value:i},this.input.before(App.view("generic/token")(e))},i.prototype.removeThisToken=function(t){return this.removeToken($(t.currentTarget).parents(".token"))},i.prototype.removeToken=function(t){var e,n;if("last"===t){if(!(n=this.$(".token").last()).length)return}else n=t;return e=n.data("value"),this.shadowInput.find('[value="'+e+'"]').remove(),this.shadowInput.trigger("change"),n.remove()},i.prototype.onInput=function(t,e){if(null==e&&(e=!0),!this.isOpen&&e&&this.toggle(),this.query=this.input.val(),this.filterByQuery(this.query),this.attribute.unknown&&!this.attribute.multiple)return this.shadowInput.val(this.query)},i.prototype.filterByQuery=function(t){var e;if(t=escapeRegExp(t),e=new RegExp(t.split(" ").join(".*"),"i"),this.optionsList.addClass("is-filtered"),this.optionItems.addClass("is-hidden").filter((function(){return this.textContent.match(e)})).removeClass("is-hidden"),t||this.optionItems.filter(".is-child").addClass("is-hidden"),this.attribute.unknown&&this.optionItems.length===this.optionItems.filter(".is-hidden").length?(this.optionItems.not(".is-child").removeClass("is-hidden"),this.unhighlightCurrentItem(),this.optionsList.removeClass("is-filtered")):this.highlightFirst(!0),this.isOpen)return this.dropupSetTopOffsetIfNeeded()},i.prototype.addValueToShadowInput=function(t,e){if(this.resetSearch(),this.attribute.multiple){if(this.shadowInput.val()&&this.shadowInput.val().includes(""+e))return;this.currentData={name:t,value:e}}else if(this.currentData={name:t,value:e},this.shadowInput.val()&&this.shadowInput.val().includes(""+e))return;return this.shadowInput.append($("<option/>").attr("selected",!0).attr("value",this.currentData.value).text(this.currentData.name)),this.onShadowChange()},i.prototype.highlightFirst=function(t){if(this.unhighlightCurrentItem(),this.currentItem=this.getCurrentOptions().not(".is-hidden").first(),this.currentItem.addClass("is-active"),t)return this.autocomplete(this.currentItem.attr("data-value"),this.currentItem.children("span.searchableSelect-option-text").text().trim())},i.prototype.highlightItem=function(t){return this.unhighlightCurrentItem(),this.currentItem=$(t.currentTarget),this.currentItem.addClass("is-active")},i.prototype.unhighlightCurrentItem=function(){if(this.currentItem)return this.currentItem.removeClass("is-active"),this.currentItem.hasClass("js-enter")&&this.currentItem.removeClass("is-highlighted"),this.currentItem=null},i.prototype.dropupSetTopOffsetIfNeeded=function(){if("up"===this.attribute.direction)return this.dropdown.css("top","-"+this.dropdown.find("ul:visible").height()+"px")},i.prototype.toggleClear=function(){return this.attribute.value&&!this.isOpen?this.clear.removeClass("hide"):this.clear.addClass("hide")},i.prototype.clearValue=function(){return event.stopPropagation(),this.selectValue("","",""),this.input.trigger("change"),this.shadowInput.trigger("change"),this.markSelected(""),this.toggleClear()},i.prototype.onClearKeyDown=function(t){switch(t.keyCode){case 13:case 32:return this.clearValue()}},i}(Spine.Controller)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.TaskManager=function(){function e(){}var n;return n=void 0,e.init=function(e){if(null==e&&(e={}),!e.force)return null!=n?n:n=new t(e);n=new t(e)},e.all=function(){return n?n.all():[]},e.allWithMeta=function(){return n?n.allWithMeta():[]},e.execute=function(t){if(n)return n.execute(t)},e.get=function(t){if(n)return n.get(t)},e.update=function(t,e){if(n)return n.update(t,e)},e.remove=function(t){if(n)return n.remove(t)},e.notify=function(t){if(n)return n.notify(t)},e.mute=function(t){if(n)return n.mute(t)},e.reorder=function(t){if(n)return n.reorder(t)},e.touch=function(t){if(n)return n.touch(t)},e.reset=function(){if(n)return n.reset()},e.tasksInitial=function(){return void 0===n&&null==n&&(n=new t),n.tasksInitial()},e.worker=function(t){if(n)return n.worker(t)},e.ensureWorker=function(t,e){if(n)return n.ensureWorker(t,e)},e.nextTaskUrl=function(){if(n)return n.nextTaskUrl()},e.TaskbarId=function(){if(n)return n.TaskbarId()},e.hideAll=function(){if(n)return n.showControllerHideOthers()},e.preferencesSubscribe=function(t,e){if(n)return n.preferencesSubscribe(t,e)},e.preferencesUnsubscribe=function(t){if(n)return n.preferencesUnsubscribe(t)},e.preferencesTrigger=function(t){if(n)return n.preferencesTrigger(t)},e.tasksAutoCleanupDelayTime=function(t){if(n)return t?n.tasksAutoCleanupDelayTime=t:n.tasksAutoCleanupDelayTime},e}(),t=function(t){function i(t){var n;null==t&&(t={}),this.preferencesTrigger=e(this.preferencesTrigger,this),this.preferencesUnsubscribe=e(this.preferencesUnsubscribe,this),this.preferencesSubscribe=e(this.preferencesSubscribe,this),this.tasksInitial=e(this.tasksInitial,this),this.tasksAutoCleanup=e(this.tasksAutoCleanup,this),this.tasksAutoCleanupDelay=e(this.tasksAutoCleanupDelay,this),this.taskUpdateLoop=e(this.taskUpdateLoop,this),this.taskUpdateTrigger=e(this.taskUpdateTrigger,this),this.TaskbarId=e(this.TaskbarId,this),this.nextTaskUrl=e(this.nextTaskUrl,this),this.reset=e(this.reset,this),this.release=e(this.release,this),this.reorder=e(this.reorder,this),this.mute=e(this.mute,this),this.notify=e(this.notify,this),this.remove=e(this.remove,this),this.update=e(this.update,this),this.getWithMeta=e(this.getWithMeta,this),this.get=e(this.get,this),this.hide=e(this.hide,this),this.show=e(this.show,this),this.showControllerHideOthers=e(this.showControllerHideOthers,this),this.startController=e(this.startController,this),this.ensureWorker=e(this.ensureWorker,this),i.__super__.constructor.apply(this,arguments),t.el?this.el=t.el:this.el=$("#app"),this.offlineModus=t.offlineModus,this.tasksInitial(),this.controllerBind("taskbar:preferences",(n=this,function(t){return n.tasksPreferences[t.key]=t.preferences,n.preferencesTrigger(t.key)}))}return n(i,t),i.extend(App.PopoverProvidable),i.include(App.LogInclude),i.prototype.init=function(){return this.domStore={},this.shownStore={},this.workers={},this.allTasksByKey={},this.tasksToUpdate={},this.tasksPreferences={},this.tasksPreferencesCallbacks={},this.tasksAutoCleanupDelayTime=12e3,this.activeTaskHistory=[],this.queue=[],this.queueRunning=!1},i.prototype.all=function(){var t,e,n,i;for(e in t=[],n=this.allTasksByKey)i=n[e],t.push(i);return _.sortBy(t,(function(t){return t.prio}))},i.prototype.allWithMeta=function(){var t,e,n,i;for(e=0,n=(t=this.all()).length;e<n;e++)i=t[e],i=this.getMeta(i);return t},i.prototype.getMeta=function(t){var e,n,i,s,r;if(i={url:"#",id:!1,iconClass:"loading",title:App.i18n.translateInline("Loading\u2026"),head:App.i18n.translateInline("Loading\u2026")},(r=App.TaskManager.worker(t.key))&&r.meta&&(e=r.meta(t)))for(n in e)s=e[n],i[n]=s;return t.meta=i,t},i.prototype.newPrio=function(){var t,e,n,i,s;for(n=1,t=0,e=(i=this.all()).length;t<e;t++)(s=i[t]).prio&&s.prio>n&&(n=s.prio);return++n},i.prototype.domID=function(t){return"content_permanent_"+t},i.prototype.worker=function(t){if(this.workers[t])return this.workers[t]},i.prototype.ensureWorker=function(t,e){var n,i;if(!(n=this.worker(t)))return this.one("TaskManager::"+t+"::WorkerStarted",(i=this,function(){return i.ensureWorker(t,e),!0}));e(n)},i.prototype.execute=function(t){return this.queue.push(t),this.run()},i.prototype.run=function(){var t,e,n;if(this.queue[0]&&!this.queueRunning){for(this.queueRunning=!0,n=[];;){e=this.queue.shift();try{this.executeSingel(e)}catch(n){t=n,this.log("error","executeSingel task:",e.key,t)}if(!this.queue[0]){this.queueRunning=!1;break}n.push(void 0)}return n}},i.prototype.executeSingel=function(t){var e,n,i,s,r;if(t.key=App.Utils.htmlAttributeCleanup(t.key),!t.init||!this.workers[t.key]){if(t.init&&(t.params.init=!0),t.params&&(t.show?t.params.shown=!0:delete t.params.shown),t.show&&this.activeTaskHistory.push(_.clone(t)),(s=this.get(t.key))||this.workers[t.key]||t.persistent||((s=new App.Taskbar).load({key:t.key,params:t.params,callback:t.controller,prio:this.newPrio(),notify:!1,active:t.show}),this.allTasksByKey[t.key]=s.attributes(),this.touch(t.key),r=this,this.tasksToUpdate[t.key]="inCreate",s.save({done:function(){var e,n;for(n in"inCreate"===r.tasksToUpdate[t.key]&&delete r.tasksToUpdate[t.key],r.allTasksByKey[t.key]=this.attributes(),r.tasksPreferences[t.key]=clone(this.preferences),r.preferencesTrigger(t.key),e=[],r.allTasks)r.allTasks[n]&&r.allTasks[n].key===this.key?(s=this.attributes(),e.push(r.allTasks[n]=s)):e.push(void 0);return e},fail:function(){if("inCreate"===r.tasksToUpdate[t.key])return delete r.tasksToUpdate[t.key]}})),t.show&&this.$("#content").remove(),t.show)for(n in i=this.allTasksByKey)s=i[n],n!==t.key?s.active&&(s.active=!1,this.taskUpdate(s)):(e=!1,s.active||(e=!0,s.active=!0),s.notify&&(e=!0,s.notify=!1),e&&this.taskUpdate(s));return this.startController(t)}},i.prototype.startController=function(t){var e,n,i,s;return this.log("debug","controller start try...",t),s=_.clone(t.params),e=this.domID(t.key),(n=this.domStore[e])?i=n.el:(i=$('<div id="'+e+'" class="content horizontal flex"></div>'),this.domStore[e]={el:i}),s.el=i,s.appEl=this.el,s.taskKey=t.key,t.show||(s.doNotLog=1),this.workers[t.key]||(this.workers[t.key]=new App[t.controller](s),App.Event.trigger("TaskManager::"+t.key+"::WorkerStarted")),t.show?this.showControllerHideOthers(t.key,s):this.hide(t.key),this.tasksAutoCleanupDelay()},i.prototype.showControllerHideOthers=function(t,e){var n,i;for(n in this.workers)n!==t&&!1!==this.shownStore[n]&&this.hide(n);for(n in this.$("#content").addClass("hide"),i=[],this.workers)n===t?i.push(this.show(n,e)):i.push(void 0);return i},i.prototype.show=function(t,e){var n,i,s;return n=this.workers[t],this.shownStore[t]=!0,this.preferencesTrigger(t),i=this.domID(t),s=this.domStore[i],!this.$("#"+i).get(0)&&s&&s.el?(this.frontendTimeUpdateElement(s.el),this.el.append(s.el),this.$("#"+i).removeClass("hide").addClass("active"),n&&s.position&&n.setPosition(s.position)):this.$("#"+i).removeClass("hide").addClass("active"),n&&(n.active&&_.isFunction(n.active)&&n.active(!0),n.show&&_.isFunction(n.show)&&n.show(e)),!0},i.prototype.hide=function(t){var e,n,i,s,r;return e=this.workers[t],this.shownStore[t]=!1,(s=this.$("#"+this.domID(t))).get(0)&&(n=this.domID(t),i=this.domStore[n],e&&_.isFunction(e.currentPosition)?(r=e.currentPosition(),i.position=r,s.addClass("hide").removeClass("active"),i.el=s.detach()):s.addClass("hide").removeClass("active")),!!e&&(e.active&&_.isFunction(e.active)&&e.active(!1),e.hide&&_.isFunction(e.hide)&&e.hide(),this.delayedRemoveAnyPopover(),!0)},i.prototype.get=function(t){return this.allTasksByKey[t]},i.prototype.getWithMeta=function(t){var e;if(e=this.get(t))return this.getMeta(e)},i.prototype.update=function(t,e){var n,i,s,r;if(!(s=this.get(t)))throw"No such task with '"+t+"' to update";for(n in e)r=e[n],s[n]=r;return i=!1,1===Object.keys(e).length&&e.state&&(i=!0),this.taskUpdate(s,i)},i.prototype.remove=function(t){var e;if(e=this.allTasksByKey[t],delete this.allTasksByKey[t],e)return App.Event.trigger("taskRemove",[e]),this.taskDestroy(e),this.release(t)},i.prototype.notify=function(t){var e;if(!(e=this.get(t)))throw"No such task with '"+t+"' to notify";if(!e.notify)return e.notify=!0,this.taskUpdate(e)},i.prototype.mute=function(t){var e;if(!(e=this.get(t)))throw"No such task with '"+t+"' to mute";if(e.notify)return e.notify=!1,this.taskUpdate(e)},i.prototype.reorder=function(t){var e,n,i,s,r;for(s=0,e=0,i=t.length;e<i;e++){if(n=t[e],!(r=this.get(n)))throw"No such task with '"+n+"' of order";s++,r.prio!==s&&(r.prio=s,this.taskUpdate(r,!0))}return App.Event.trigger("taskCollectionOrderSet",t)},i.prototype.release=function(t){var e,n,i;e=this.domID(t),(i=this.domStore[e])&&(i.el&&($("#app").append('<div id="'+e+'_trash" class="hide"></div>'),$("#app #"+e+"_trash").append(i.el).remove(),i.el=void 0),i=void 0),delete this.domStore[this.domID(t)],this.workers[t],delete this.workers[t],delete this.tasksPreferences[t];try{return(n=this.$("#"+this.domID(t))).html(""),n.remove()}catch(e){return this.log("notice","invalid key '"+t+"'")}},i.prototype.reset=function(){var t,e,n;for(t in App.Delay.clearLevel("task"),e=this.allTasksByKey)e[t],this.release(t);for(t in n=this.workers)n[t],this.release(t);return this.init(),App.Taskbar.deleteAll(),App.Event.trigger("taskInit")},i.prototype.nextTaskUrl=function(){for(var t,e,n,i;(e=this.activeTaskHistory.pop())&&e.key;)if((t=this.workers[e.key])&&t.url)return t.url();return!!((n=(i=this.all())[i.length-1])&&(t=this.workers[n.key])&&t.url)&&t.url()},i.prototype.TaskbarId=function(){return this.TaskbarIdInt||(this.TaskbarIdInt=Math.floor(99999999*Math.random())),this.TaskbarIdInt},i.prototype.taskUpdate=function(t,e){if(null==e&&(e=!1),this.log("debug","UPDATE task",t,e),"inCreate"!==this.tasksToUpdate[t.key]&&(this.tasksToUpdate[t.key]="toUpdate",this.taskUpdateTrigger(),!e))return this.touch(t.key)},i.prototype.touch=function(t){var e,n;return n=this,e=function(){var e;if(e=n.getWithMeta(t))return e.active&&e.meta&&n.title(e.meta.title),App.Event.trigger("taskUpdate",[e])},App.Delay.set(e,20,"task-"+t,void 0)},i.prototype.taskUpdateTrigger=function(){return App.Delay.set(this.taskUpdateLoop,2e3,"check_update_to_server_pending","task",!0)},i.prototype.taskUpdateLoop=function(){var t,e,n,i,s;if(!this.offlineModus){for(t in e=[],this.tasksToUpdate)if(t&&(n=this.get(t)))if("toUpdate"===this.tasksToUpdate[n.key]){if(this.tasksToUpdate[n.key]="inProgress",!(i=App.Taskbar.findByAttribute("key",n.key))){delete s.tasksToUpdate[this.key];continue}i.load(n),i.isOnline()?(s=this,e.push(i.save({done:function(){if("inProgress"===s.tasksToUpdate[this.key])return delete s.tasksToUpdate[this.key]},fail:function(){if(s.log("error","can't update task",this),"inProgress"===s.tasksToUpdate[this.key])return delete s.tasksToUpdate[this.key]}}))):e.push(void 0)}else e.push(void 0);return e}},i.prototype.taskDestroy=function(t){var e;if("inProgress"!==this.tasksToUpdate[t.key]&&"inCreate"!==this.tasksToUpdate[t.key]){if(delete this.tasksToUpdate[t.key],delete this.tasksPreferences[t.key],t.id&&App.Taskbar.exists(t.id))return App.Taskbar.destroy(t.id)}else App.Delay.set((e=this,function(){return e.taskDestroy(t)}),800,void 0,"task",!0)},i.prototype.tasksAutoCleanupDelay=function(){var t,e;return e=this,t=function(){return e.tasksAutoCleanup()},App.Delay.set(t,this.tasksAutoCleanupDelayTime,"task-autocleanup",void 0,!0)},i.prototype.tasksAutoCleanup=function(){var t,e,n,i,s,r,o,a,l;if(i=App.Config.get("ui_task_mananger_max_task_count"),l=this,(t=function(){return Object.keys(l.allTasksByKey).length})()>i){for(s=[],e=0,n=(o=this.offlineModus?this.all():App.Taskbar.search({sortBy:"updated_at",order:"ASC"})).length;e<n;e++)if(r=o[e],t()>i)if(r.active)s.push(void 0);else if(a=App.TaskManager.worker(r.key)){if(a.changed&&a.changed())continue;this.log("notice","More than the allowed maximum "+i+" tasks are open, closing the oldest untouched task "+r.key+" now."),s.push(this.remove(r.key))}else s.push(void 0);else s.push(void 0);return s}},i.prototype.tasksInitial=function(){var t,e,n,i,s,r,o,a,l,c,u;for(this.init(),n=0,s=(c=App.Taskbar.all()).length;n<s;n++)(a=c[n]).active=!1,this.allTasksByKey[a.key]=a.attributes(),this.tasksPreferences[a.key]=a.preferences;if(App.Event.trigger("taskbar:init"),l=0,r=App.Config.get("permanentTask"))for(i in r)(t=r[i]).permission&&!this.permissionCheck(t.permission)||(l+=1,function(t){return function(e,n,i){return App.Delay.set((function(){return t.execute({key:e,controller:n.controller,params:{},show:!1,persistent:!0,init:!0})}),350*i,void 0,"task",!0)}}(this)(i,t,l));for(i in o=this.allTasksByKey,u=this,e=function(t,e){return App.Delay.set((function(){return u.execute({key:t.key,controller:t.callback,params:t.params,show:!1,persistent:!1,init:!0})}),350*e,void 0,"task",!0)},o)e(a=o[i],l+=1);return App.Event.trigger("taskbar:ready")},i.prototype.preferencesSubscribe=function(t,e){var n;return this.tasksPreferencesCallbacks[t]||(this.tasksPreferencesCallbacks[t]={}),n=""+t+Math.floor(999999*Math.random()),this.tasksPreferencesCallbacks[t][n]=e,n},i.prototype.preferencesUnsubscribe=function(t){var e,n,i,s,r,o;if(this.tasksPreferencesCallbacks){for(e in n=this.tasksPreferencesCallbacks)for(r in o=n[e])o[r],r===t&&delete o[r];for(e in s=[],i=this.tasksPreferencesCallbacks)o=i[e],_.isEmpty(o)?s.push(delete this.tasksPreferencesCallbacks[e]):s.push(void 0);return s}},i.prototype.preferencesTrigger=function(t){var e,n,i,s;if(this.tasksPreferencesCallbacks[t]&&this.tasksPreferences[t]){for(s in i=[],n=this.tasksPreferencesCallbacks[t])e=n[s],i.push(e(this.tasksPreferences[t]));return i}},i}(App.Controller)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.event="ticket_overview_attributes",n.prototype.restEndpoint="/ticket_overview",n}(App._CollectionSingletonBase),App.TicketOverviewCollection=function(){function e(){}var n;return n=new t,e.get=function(){return n.get()},e.one=function(t,e){return null==e&&(e=!0),n.bind(t,e,!0)},e.bind=function(t,e){return null==e&&(e=!0),n.bind(t,e,!1)},e.unbind=function(t){return n.unbind(t)},e.unbindById=function(t){return n.unbindById(t)},e.trigger=function(){return n.trigger()},e.fetch=function(){return n.fetch()},e}()}.call(this),function(){App.TwoFactorMethods=function(){function t(){}return t.sortedMethods=function(){var t;return t=App.Config.get("TwoFactorMethods"),_.sortBy(t,(function(t){return t.order}))},t.methodByKey=function(t){return _.findWhere(App.Config.get("TwoFactorMethods"),{key:t})},t}()}.call(this),function(){App.Config.set("AuthenticatorApp",{key:"authenticator_app",identifier:"AuthenticatorApp",editable:!0,label:__("Authenticator App"),description:__("Get the security code from the authenticator app on your device."),helpMessage:__("Enter the code from your two-factor authenticator app."),icon:"mobile-code",order:2e3},"TwoFactorMethods")}.call(this),function(){App.Config.set("RecoveryCodes",{key:"recovery_codes",identifier:"RecoveryCodes",label:__("Recovery Codes"),description:__("Use one of your safely stored recovery codes."),helpMessage:__("Enter one of your unused recovery codes."),icon:"mobile-code",order:2e3},"TwoFactorMethods")}.call(this),function(){App.Config.set("SecurityKeys",{key:"security_keys",identifier:"SecurityKeys",editable:!0,label:__("Security Keys"),description:__("Complete the sign-in with your security key."),helpMessage:__("Complete the sign-in with your security key."),icon:"security-key",order:1e3},"TwoFactorMethods")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var s in e)i.call(e,s)&&(t[s]=e[s]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;App.UserOrganizationAutocompletion=function(i){function s(){return this.buildObjectItem=e(this.buildObjectItem,this),this.newObject=e(this.newObject,this),s.__super__.constructor.apply(this,arguments)}return n(s,i),s.prototype.objectSingle="User",s.prototype.objectIcon="user",s.prototype.inactiveObjectIcon="inactive-user",s.prototype.objectSingels="People",s.prototype.objectCreate=__("Create new Customer"),s.prototype.referenceAttribute="member_ids",s.prototype.newObject=function(e){return e&&e.preventDefault(),new t({parent:this,container:this.el.closest(".content")})},s.prototype.buildObjectItem=function(t){var e,n;return n=t.displayName(),this.Config.get("ui_user_organization_selector_with_email")&&!_.isEmpty(t.email)&&(n+=" <"+t.email+">"),e=this.objectIcon,!1===t.active&&this.inactiveObjectIcon&&(e=this.inactiveObjectIcon),App.view(this.templateObjectItem)({realname:n,object:t,icon:e})},s}(App.ObjectOrganizationAutocompletion),t=function(t){function i(){return this.onSubmit=e(this.onSubmit,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.buttonClose=!0,i.prototype.buttonCancel=!0,i.prototype.buttonSubmit=!0,i.prototype.head=__("User"),i.prototype.headPrefix="New",i.prototype.content=function(){return this.controller=new App.ControllerForm({model:App.User,screen:"create",autofocus:!0}),this.controller.form},i.prototype.onSubmit=function(t){var e,n,i,s,r,o;if(!(n=this.formParam(t.target)).login&&n.email&&(n.login=n.email),!n.role_ids||_.isEmpty(n.role_ids)){for(i in s=[],App.Role.all())i&&!0===i.active&&!0===i.default_at_signup&&s.push(i.id);n.role_ids=s}return this.log("notice","updateAttributes",n),(o=new App.User).load(n),(e=o.validate({controllerForm:this.controller}))?(this.log("error",e),void this.formValidate({form:t.target,errors:e})):(r=this,o.save({done:function(){var t;return t=function(t){return r.parent.el.find("[name=customer_id]").val(t.id).trigger("change"),r.parent.close(),r.close()},App.User.full(this.id,t,!0)},fail:function(e,n){return r.log("errors",n),r.formEnable(t),r.controller.showAlert(n.error_human||n.error||__("The object could not be created."))}}))},i}(App.ControllerModal)}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.templateName="user_ticket_list",n.prototype.fetch=function(t){return this.params.parentController.ajax({type:"GET",url:App.Config.get("api_path")+"/ticket_customer",data:{customer_id:t.user_id},processData:!0,success:(e=this,function(n){var i;return App.Collection.loadAssets(n.assets),i={open:n.ticket_ids_open,closed:n.ticket_ids_closed},e.callback({ticketsList:i,selector:t.selector})})});var e},n.prototype.build=function(t){if(this.checkPermissions())return this.fetch(t)},n.prototype.callback=function(t){return this.clear(this.popovers),this.popovers=this.buildPopovers(t)},n.prototype.buildTitleFor=function(t){return $(t).find('[title="*"]').val()},n.prototype.buildContentFor=function(t,e){var n,i;return i=$(t).filter("[data-type]").data("type"),n=(e.ticketsList[i]||[]).map((function(t){return App.Ticket.fullLocal(t)})),this.buildHtmlContent({ticketList:App.view("generic/ticket_list")({tickets:n,show_id:!0})})},n}(App.PopoverProvider),App.PopoverProvider.registerProvider("UserTicket",t)}.call(this),function(){var t=[].slice;App.Utils=function(){function e(){}return e.mapTagAttributes={FONT:["color"],SPAN:["style"],DIV:["style"],TABLE:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","sortable","summary","width","style"],TD:["abbr","align","axis","colspan","headers","rowspan","valign","width","style"],TH:["abbr","align","axis","colspan","headers","rowspan","scope","sorted","valign","width","style"],TR:["width","style"],A:["href","hreflang","name","rel"],IMG:["align","alt","border","height","src","srcset","width","style"]},e.mapCss={SPAN:["color"],DIV:["color"],TABLE:["background","background-color","color","font-size","vertical-align","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","text-align","border","border-top","border-right","border-bottom","border-left","border-collapse","border-style","border-spacing","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style"],TH:["background","background-color","color","font-size","vertical-align","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","text-align","border","border-top","border-right","border-bottom","border-left","border-collapse","border-style","border-spacing","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style"],TR:["background","background-color","color","font-size","vertical-align","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","text-align","border","border-top","border-right","border-bottom","border-left","border-collapse","border-style","border-spacing","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style"],TD:["background","background-color","color","font-size","vertical-align","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","text-align","border","border-top","border-right","border-bottom","border-left","border-collapse","border-style","border-spacing","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style"],IMG:["width","height"]},e.cssValuesBacklist={DIV:["color:white","color:black","color:#000","color:#000000","color:#fff","color:#ffffff","color:rgb(0,0,0)","color:#585856","color:rgb(88, 88, 86)","color:#b3b3b3","color:rgb(34, 34, 34)","color:rgb(219, 219, 220)"],SPAN:["color:white","color:black","color:#000","color:#000000","color:#fff","color:#ffffff","color:rgb(0,0,0)","color:#585856","color:rgb(88, 88, 86)","color:#b3b3b3","color:rgb(34, 34, 34)","color:rgb(219, 219, 220)"],TABLE:["font-size:0","font-size:0px","font-size:0em","font-size:0%","font-size:1px","font-size:1em","font-size:1%","font-size:2","font-size:2px","font-size:2em","font-size:2%","font-size:3","font-size:3px","font-size:3em","font-size:3%","display:none","visibility:hidden"],TH:["font-size:0","font-size:0px","font-size:0em","font-size:0%","font-size:1px","font-size:1em","font-size:1%","font-size:2","font-size:2px","font-size:2em","font-size:2%","font-size:3","font-size:3px","font-size:3em","font-size:3%","display:none","visibility:hidden"],TR:["font-size:0","font-size:0px","font-size:0em","font-size:0%","font-size:1","font-size:1px","font-size:1em","font-size:1%","font-size:2","font-size:2px","font-size:2em","font-size:2%","font-size:3","font-size:3px","font-size:3em","font-size:3%","display:none","visibility:hidden"],TD:["font-size:0","font-size:0px","font-size:0em","font-size:0%","font-size:1px","font-size:1em","font-size:1%","font-size:2","font-size:2px","font-size:2em","font-size:2%","font-size:3","font-size:3px","font-size:3em","font-size:3%","display:none","visibility:hidden"]},e.textCleanup=function(t){return t?t.trim().replace(/(\r\n|\n\r)/g,"\n").replace(/\r/g,"\n").replace(/[ ]\n/g,"\n").replace(/\n{3,20}/g,"\n\n"):""},e.text2html=function(t){return t=this.textCleanup(t),t=(t=(t=(t=this.linkify(t)).replace(/(\n\r|\r\n|\r)/g,"\n")).replace(/  /g," &nbsp;")).match(/\n/)?(t="<div>"+t.replace(/\n/g,"</div><div>")+"</div>").replace(/<div><\/div>/g,"<div><br></div>"):(t="<span>"+t.replace(/\n/g,"</span><span>")+"</span>").replace(/<span><\/span>/g,"<span><br></span>")},e.html2text=function(t,e){return t?e?(t=t.replace(/([A-z])\n([A-z])/gm,"$1 $2").replace(/\n|\r/g,"").replace(/<(br|hr)>/g,"\n").replace(/<(br|hr)\/>/g,"\n").replace(/<\/(div|p|blockquote|form|textarea|address|tr)>/g,"\n"),
$("<div>"+t+"</div>").text()):(t=(t=t.replace(/([A-z])\n([A-z])/gm,"$1 $2").replace(/>\n/g,">").replace(/\n|\r/g,"")).replace(/<(br|hr)>/g,"\n").replace(/<(br|hr)\/>/g,"\n").replace(/<(div)(|.+?)>/g,"").replace(/<(p|blockquote|form|textarea|address|tr)(|.+?)>/g,"\n").replace(/<\/(div|p|blockquote|form|textarea|address|tr)>/g,"\n"),$("<div>"+t+"</div>").text().trim().replace(/\n{3,20}/g,"\n\n")):t},e.linkify=function(t){return window.linkifyStr(t,{attributes:this._getLinkifyAttributes})},e._getLinkifyAttributes=function(t){var e;return e={title:t},/^https?:/.test(t)&&(e.target="_blank"),e},e.phoneify=function(t){return _.isEmpty(t)?t:"tel:"+(t=t.replace(/[^0-9,\+,#,\*]+/g,"").replace(/(.)\+/,"$1"))},e.wrap=function(t,e){var n,i,s,r,o,a,l,c,u,p,h,d;for(null==e&&(e=82),h="",n=0,s=0,o=(l=t.split(/\n/)).length;s<o;s++){for(n+=1,i=0,u=0,d="",r=0,a=(p=l[s].split(/\s/)).length;r<a;r++)i+=1,u+(c=p[r]).length>e&&(u=0,d=d.trim(),h+=d+="\n",d=""),u+=c.length,d+=c,i!==p.length&&(u+=1,d+=" ");h+=d,d="",n!==l.length&&(h+="\n")}return h},e.quote=function(t,e){return null==e&&(e=82),t=this.textCleanup(t),(t=this.wrap(t,e)).trim().replace(/^(.*)$/gm,(function(t){return t?"> "+t:">"}))},e.escapeRegExp=function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},e.htmlEscape=function(t){return t&&t.replace?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):t},e.htmlStrip=function(t){for(var e,n,i;(n=t.get(0))&&(e=n.firstChild)&&1===e.nodeType&&"BR"===e.tagName&&e.remove;)e.remove();for(i=[];(n=t.get(0))&&(e=n.lastChild)&&1===e.nodeType&&"BR"===e.tagName&&e.remove;)i.push(e.remove());return i},e.htmlLastLineEmpty=function(t){var e,n;return!!(n=t.get(0))&&(!!(e=n.lastChild)&&(1===e.nodeType&&"BR"===e.tagName))},e.htmlRemoveTags=function(t){return t=this._checkTypeOf(t),this._removeComments(t),this._removeWordMarkup(t),t.find("div, span, p, li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, fieldset, textarea, font, address, table, thead, tbody, tr, th, td, h1, h2, h3, h4, h5, h6").replaceWith((function(){return $(this).contents()})),t.find("div, span, p, li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, fieldset, textarea, font, table, thead, tbody, tr, th, td, h1, h2, h3, h4, h5, h6, br, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head").remove(),t},e.htmlRemoveRichtext=function(t,e){return null==e&&(e=!0),t?(t=this._checkTypeOf(t),this._removeComments(t),this._removeWordMarkup(t),t.find("li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, fieldset, textarea, font, address, table, thead, tbody, tr, th, td, h1, h2, h3, h4, h5, h6").replaceWith((function(){return $(this).contents()})),t.find("li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, fieldset, textarea, font, address, table, thead, tbody, tr, th, td, h1, h2, h3, h4, h5, h6, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head").remove(),this._removeAttributes(t,e),t):t},e.htmlCleanup=function(t,e){var n;return null==e&&(e=!1),t?(t=this._checkTypeOf(t),this._removeComments(t),this._removeWordMarkup(t),this._stripDoubleDomainAnchors(t),t.find("small, time, form, label").replaceWith((function(){return $(this).contents()})),e&&t.find("img").replaceWith((function(){return $(this).contents()})),n="div",t.find("textarea").each((function(){var t,e,i;return e=this.outerHTML,i=new RegExp("<"+this.tagName,"i"),t=e.replace(i,"<"+n),i=new RegExp("</"+this.tagName,"i"),t=t.replace(i,"</"+n),$(this).replaceWith(t)})),t.find("svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset").remove(),this._cleanAttributes(t),t):t},e._checkTypeOf=function(t){var e;if("string"!=typeof t)return t;try{return(e=$(t)).length>1?$("<div>"+t+"</div>"):e&&e.get(0)?e:$("<div>"+t+"</div>")}catch(e){return e,$("<div>"+t+"</div>")}},e._cleanAttribute=function(t){var e,n,i,s,r,o,a,l,c,u,p,h,d,f,m;if(t){if(this.mapTagAttributes[t.nodeName])for(s=0,l=(n=t.attributes).length;s<l;s++)(e=n[s])&&e.name&&!_.contains(this.mapTagAttributes[t.nodeName],e.name)&&t.removeAttribute(e.name);else this._removeAttribute(t);if(this.mapCss[t.nodeName]){for(m="",r=0,c=(i=t.style).length;r<c;r++)m+=(h=i[r])+":"+i[h]+";";if(m&&m.split){for(f="",a=0,u=(d=m.split(";")).length;a<u;a++)(h=(p=d[a]).split(":"))[0]&&h[0].trim&&(o=h[0].trim(),this.cssValuesBacklist[t.nodeName]&&_.contains(this.cssValuesBacklist[t.nodeName],p.toLowerCase())||!_.contains(this.mapCss[t.nodeName],o)||(f+=p+";"));return""!==f?t.setAttribute("style",f):t.removeAttribute("style")}}}},e._cleanAttributes=function(t,e){var n;return null==e&&(e=!0),e&&t.each((n=this,function(t,e){return n._cleanAttribute(e)})),t.find("*").each(function(t){return function(e,n){return t._cleanAttribute(n)}}(this)),t},e._removeAttribute=function(t){var e,n,i,s,r;if(t){for(e=$(t),i=0,s=(r=t.attributes).length;i<s;i++)(n=r[i])&&n.name&&t.removeAttribute(n.name);return e.removeAttr("style").removeAttr("class").removeAttr("lang").removeAttr("type").removeAttr("align").removeAttr("id").removeAttr("wrap").removeAttr("title").removeAttrs(/data-/)}},e._removeAttributes=function(t,e){var n;return null==e&&(e=!0),e&&t.each((n=this,function(t,e){return n._removeAttribute(e)})),t.find("*").each(function(t){return function(e,n){return t._removeAttribute(n)}}(this)),t},e._removeComments=function(t){return t.contents().each((function(){if(8===this.nodeType)return $(this).remove()})),t},e._removeWordMarkup=function(t){var e,n,i;return t.get(0)?(n=!1,e=t.get(0).outerHTML,i=new RegExp("<(/w|w):[A-Za-z]"),e.match(i)&&(n=!0,e=e.replace(i,"")),i=new RegExp("<(/o|o):[A-Za-z]"),e.match(i)&&(n=!0,e=e.replace(i,"")),n?window.word_filter(t):t):t},e._stripDoubleDomainAnchors=function(t){return t.find("a").each((function(){var t,e;if(null!=(e=$(this).attr("href")))return t=e.replace(/^https?:\/\/.*(?=(https?|#{config.http_type}):\/\/)/,""),e!==t?$(this).attr("href",t):void 0}))},e.signatureCheck=function(t,e){var n,i,s;return n=(n=$("<div>"+t+"</div>").text().trim()).replace(/(\n|\r|\t)/g,""),s=(s=$("<div>"+e+"</div>").text().trim()).replace(/(\n|\r|\t)/g,""),i=new RegExp(function(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}(s),"mi"),!n.match(i)},e.signatureIdentifyByPlaintext=function(t,e,n){var i,s,r,o,a,l,c,u,p,h,d,f,m,g;if(null==e&&(e=!1),null==n&&(n=!1),g=(m=this.html2text(t)).split("\n"),!e&&g.length<10&&m.length<300)return t;if(o=function(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")},i=function(t){return t.match(/(<|>|&)/)&&(t=t.replace(/(.+?)(<|>|&).+?$/,"$1").trim()),t},h=function(t,e){var n,i,s,r,o;for(r=0,n=0,i=t.length;n<i;n++)if(r+=1,(s=t[n])&&s.match(/^\s{0,10}--\s{0,10}$/))return o={line:s,lineCount:r,type:"separator"},void e.push(o)},h(g,r=[]),d=function(t,e){var n,s,r,o,a;for(o=0,n=0,s=t.length;n<s;n++){if(o+=1,(r=t[n])&&r.match(/^(Am)\s.{6,20}\s(um)\s.{3,10}\s(schrieb)\s.{1,250}:/))return a={line:i(r),lineCount:o,type:"thunderbird"},void e.push(a);if(r&&r.match(/^(On)\s.{6,20}\s.{3,10},\s.{1,250}(wrote):/))return a={line:i(r),lineCount:o,type:"thunderbird"},void e.push(a);if(r&&r.match(/^.{1,250}\s(wrote),\son\s.{3,20}:/))return a={line:i(r),lineCount:o,type:"thunderbird"},void e.push(a)}},d(g,r),l=function(t,e){var n,s,r,o,a;for(o=0,n=0,s=t.length;n<s;n++){if(o+=1,(r=t[n])&&r.match(/^(On)\s.{6,20}\s.{3,10}\s.{1,250}\s(wrote):/))return a={line:i(r),lineCount:o,type:"apple"},void e.push(a);if(r&&r.match(/^(Am)\s.{6,20}\s(um)\s.{3,10}\s(schrieb)\s.{1,250}:/))return a={line:i(r),lineCount:o,type:"apple"},void e.push(a)}},l(g,r),p=function(t,e){var n,s,r,o,a;for(o=0,n=0,s=t.length;n<s;n++)if(o+=1,(r=t[n])&&r.match(/^.{6,10}\s.{3,10}\s-\s.{1,250}\s(wrote|schrieb|a \xe9crit|escribi\xf3):/))return a={line:i(r),lineCount:o,type:"Otrs"},void e.push(a)},p(g,r),u=function(t,e){var n,i,s,r,o,a,l,c;for(a=0,i=void 0,n=0,c=5,s=0,r=t.length;s<r;s++)if(o=t[s],a+=1,i){if(o&&o.match(/^(Subject|Betreff|Objet)(\s|):\s.+?/))return l={line:i,lineCount:a,type:"Ms"},void e.push(l);a>n+c&&(i=void 0)}else o&&o.match(/^(From|Von|De)(\s|):\s.+?/)&&(i=o.replace(/\s{0,5}(\[|<).+?(\]|>)/g,""),n=a)},u(g,r),f=function(t,e){var n,s,r,o,a;for(o=0,n=0,s=t.length;n<s;n++)if(o+=1,(r=t[n])&&r.match(/^.{1,250}\s(wrote|schrieb|a \xe9crit|escribi\xf3):/))return a={line:i(r),lineCount:o,type:"Word14"},void e.push(a)},f(g,r),c=function(t,e){var n,s,r,o,a;for(o=0,n=0,s=t.length;n<s;n++)if(o+=1,(r=t[n])&&r.match(/.{1,250}\s(wrote|schrieb|a \xe9crit|escribi\xf3)\s.{1,250}:/))return a={line:i(r),lineCount:o,type:"gmail"},void e.push(a)},c(g,r),s='<span class="js-signatureMarker"></span>',!r||!r[0]||n){if(a=new RegExp('(<div data-signature="true" data-signature-id=".{1,5}">)'),t.match(a))return t.replace(a,s+"$1");if(a=new RegExp('(<div data-signature-id=".{1,5}" data-signature="true">)'),t.match(a))return t.replace(a,s+"$1")}return(r&&r[0]||(a=new RegExp('(<blockquote type="cite">)'),!t.match(a)))&&(r&&r[0]||(a=new RegExp('(<blockquote class="(ecxgmail_quote|gmail_quote)">)'),!t.match(a)))?r&&r[0]?"separator"===(r=_.sortBy(r,"lineCount"))[0].type?(a=new RegExp(">(s{0,10}"+o(App.Utils.htmlEscape(r[0].line))+")s{0,10}<"),t.replace(a,">"+s+"$1<")):(a=new RegExp(">(s{0,10}"+o(App.Utils.htmlEscape(r[0].line))+")"),t.replace(a,">"+s+"$1")):t:t.replace(a,s+"$1")},e.isMicrosoftOffice=function(t){var e;return e=new RegExp("-----(Urspr\xfcngliche Nachricht|Original Message|Mensaje original|Message d'origine|Messaggio originale|\u90ae\u4ef6\u539f\u4ef6|\u539f\u59cb\u90f5\u4ef6)-----"),t.match(e)},e.signatureIdentifyByHtml=function(t){var e,n,i;return this.isMicrosoftOffice(t)?this.signatureIdentifyByPlaintext(t):1===(e=$(App.Utils.safeParseHtml(t))).length&&(null!=(n=$(e[0]))&&null!=(i=n.children())?i.length:void 0)?(e[0].innerHTML=this.signatureIdentifyByHtmlHelper(e[0].innerHTML),e[0].outerHTML):this.signatureIdentifyByHtmlHelper(t)},e.signatureRemoveByHtml=function(t){var e,n;return(n=document.createElement("container-element")).innerHTML=t,e=[],n.querySelectorAll("div[data-signature]").forEach((function(t){var n,i;for(n=t;"BR"===(null!=n&&null!=(i=n.previousSibling)?i.nodeName:void 0);)e.push(n.previousSibling),n=n.previousSibling;return t.remove()})),e.forEach((function(t){return t.remove()})),n.innerHTML},e.signatureIdentifyByHtmlHelper=function(t,e){var n,i,s,r,o,a,l,c;null==e&&(e=!1),s=[],i=[],c=[],r=function(t){var e;return"BLOCKQUOTE"===(e=(t=$(t)).prop("tagName"))||(!("DIV"!==e||!t.data("signature")&&"yahoo_quoted"!==t.prop("class"))||_.some(t.children(),(function(t){return r(t)})))};try{n=$("<div/>").html(t)}catch(e){e,n=$("<div/>").html("<div>"+t+"</div>")}return n.find("div:first:contains('CAUTION:')").length>0?t:(n.contents().each((function(t,e){var n;if(n=$(e).text(),e.nodeType===Node.TEXT_NODE){if(c.push($("<div>").text(n).html()),n.trim().length)return i.push(t)}else if(e.nodeType===Node.ELEMENT_NODE){if(c.push(e.outerHTML),r(e))return s.push(t);if(n.trim().length)return i.push(t)}})),l=_.max(i||0),(s=_.filter(s,(function(t){return t>=l}))).length?(o=_.min(s),a='<span class="js-signatureMarker"></span>',c.splice(o,0,a),c.join("")):t)},e.replaceTags=function(t,e,n){return null==n&&(n=!1),t.replace(/#\{\s{0,2}(.+?)\s{0,2}\}/g,(function(t,i){var s,r,o,a,l,c,u,p,h,d,f,m,g,v,y,b;for(d=(i=i.replace(/<.+?>/g,"")).split(/\./),o=e,a=void 0,c=0,p=d.length;c<p;c++)if(h=d[c],"object"==typeof o&&h in o)a=o,o=o[h];else{if("object"!=typeof o||"string"!=typeof h||!(m=h.match(/(?<functionName>\w+)\((?<params>.*?)\)/))){o="";break}if(a=o,l=(v=m.groups).functionName,g=v.params.split(",").map((function(t){return t.trim()})),"replaceTagsFunctionCallback"in a)return a.replaceTagsFunctionCallback(l,g)||"";o=""}return b=void 0,"function"==typeof o?b=o():null!=o&&o.toString?(u=d[d.length-2],(r=(null!=a&&null!=(y=a.constructor)?y.className:void 0)||u.charAt(0).toUpperCase()+u.slice(1))&&App[r]&&(null!=(f=App[r])?f.attributesGet:void 0)&&(null!=(s=f.attributesGet())?s[h]:void 0)&&("datetime"===s[h].tag?b=App.i18n.translateTimestamp(o):"date"===s[h].tag?b=App.i18n.translateDate(o):"autocompletion_ajax_external_data_source"===s[h].tag&&(b=o.value)),b||(b=o.toString())):b="",""===b&&(b="-"),n&&(b=encodeURIComponent(b)),b}))},e.removeEmptyLines=function(t){return t.replace(/^\s*[\r\n]/gm,"")},e.htmlAttributeCleanup=function(t){return t.replace(/((?![-a-zA-Z0-9_]+).|\n|\r|\t)/gm,"")},e.formDiff=function(t,e){var n,i;return i=clone(t),this._formDiffNormalizer(i),n=clone(e),this._formDiffNormalizer(n),this._formDiffChanges(i,n)},e._formDiffChanges=function(t,e,n){var i,s,r,o,a;for(i in null==n&&(n={}),t)(s=t[i])!==e[i]&&(_.isArray(s)&&_.isArray(e[i])?(o=_.difference(s,e[i]),a=_.difference(e[i],s),r=o.concat(a),_.isEmpty(r)||(n[i]=r)):_.isObject(s)&&_.isObject(e[i])?this._formDataStructureField(s)||this._formDataStructureField(e[i])?!_.isEqual(s,e[i])&&(n[i]=s):n=this._formDiffChanges(s,e[i],n):_.isObject(s)&&_.isEmpty(s)&&void 0===e[i]||_.isObject(s)&&_.isEmpty(s)&&void 0===e[i]||""===s&&null==e[i]||(n[i]=s));return n},e._formDiffNormalizer=function(t){var e,n,i,s,r,o;if(void 0!==t){if(_.isArray(t)){for(r=[],e=n=0,s=t.length;0<=s?n<s:n>s;e=0<=s?++n:--n)r.push(t[e]=this._formDiffNormalizer(t[e]));return r}if(_.isObject(t)){for(i in o=[],t)t[i],_.isArray(t[i])||_.isObject(t[i])?o.push(this._formDiffNormalizer(t[i])):o.push(t[i]=this._formDiffNormalizerItem(i,t[i]));return o}return this._formDiffNormalizerItem("",t)}},e._formDiffNormalizerItem=function(t,e){return"owner_id"===t&&"1"===e.toString()?e="":"number"==typeof e?e=e.toString():null===e&&(e=void 0),e},e._formDataStructureField=function(t){var e;return e=Object.keys(t),_.includes(e,"value")&&_.includes(e,"label")},e.checkAttachmentReference=function(t){var e,n,i,s,r,o,a,l;if(!t)return!1;for((a=$("<div>"+t+"</div>")).find("blockquote").remove(),o=a.text(),i=0,s=(r=[__("Attachment"),__("attachment"),__("Attached"),__("attached"),__("Enclosed"),__("enclosed"),__("Enclosure"),__("enclosure")]).length;i<s;i++){if(l=r[i],n=new RegExp("\\W"+l+"\\W","i"),o.match(n))return l;if(e=App.i18n.translateContent(l),n=new RegExp("\\W"+e+"\\W","i"),o.match(n))return e}return!1},e.humanFileSize=function(t){return t>1048576?t=Math.round(10*t/1048576)/10+" MB":t>1024?t=Math.round(t/1024)+" KB":t+=" Bytes",t},e.decimal=function(t,e){var n,i;return null==e&&(e=2),null==t?"":(t.toString&&(t=t.toString()),""===t||t.match(/[A-z]/)?t:(n=function(t,e){for(;t.toString().length<e;)t+="0";return t},(i=t.match(/^(.+?)\.(.+?)$/))&&i[2]?e-i[2].length>0?i[1]+"."+n(i[2],e):i[1]+"."+i[2].substr(0,e):t+"."+n(0,e)))},e.sortByValue=function(t,e){var n,i,s,r,o,a,l,c,u;for(s in null==e&&(e="ASC"),n=[],i={},t)u=(c=t[s]).toString().toLowerCase(),n.push(u),i[u]=[s,c];for(n=n.sort((function(t,e){return t.localeCompare(e)})),"DESC"===e&&(n=n.reverse()),a={},r=0,o=n.length;r<o;r++)a[(l=i[s=n[r]])[0]]=l[1];return a},e.sortByKey=function(t,e){var n,i,s,r,o,a;for(i in null==e&&(e="ASC"),n=[],t)t[i],s=i.toString?i.toString().toLowerCase():i,n.push(s);for(n=n.sort(),"DESC"===e&&(n=n.reverse()),a={},r=0,o=n.length;r<o;r++)a[i=n[r]]=t[i];return a},e.formatTime=function(t,e){if(void 0===t)return"";if(null===t)return"";for(t.toString&&(t=t.toString());t.length<e;)t="0"+t;return t},e.icon=function(t,e){var n,i,s,r;if(null==e&&(e=""),t){if(n={ltr:{start:"left",end:"right"},rtl:{start:"right",end:"left"}},t.indexOf("{")>0)for(i in s=n[App.i18n.dir()])r=s[i],t=t.replace("{"+i+"}",r);return'<svg class="icon icon-'+t+" "+e+'"><use xlink:href="'+(window.svgPolyfill?"":"assets/images/icons.svg")+"#icon-"+t+'" /></svg>'}},e.fontIcon=function(t,e,n){return null==n&&(n=""),this.loadIconFont(e),'<i class="icon '+n+'" data-font="'+e+'">'+String.fromCharCode("0x"+t)+"</i>"},e.loadIconFont=function(t){var e;if(!$('[data-icon-font="'+t+'"]').length)return e="@font-face {\n  font-family: '"+t+"';\n  src: url('"+("assets/icon-fonts/"+t+".woff")+"');\n  font-weight: normal;\n  font-style: normal;\n}\n\n[data-font=\""+t+"\"] {\n  font-family: '"+t+"';\n}",$('<style data-icon-font="'+t+'">').appendTo("head").text(e)},e.loadIconFontInfo=function(t,e){return $.getJSON("assets/icon-fonts/"+t+".json",(function(t){return e(t.icons)}))},e.getScrollBarWidth=function(){var t,e;return t=$("<div>").css({visibility:"hidden",width:100,overflow:"scroll"}).appendTo("body"),e=$("<div>").css({width:"100%"}).appendTo(t).outerWidth(),t.remove(),100-e},e.diffPositionAdd=function(t,e){var n,i;return i=function(t,e,n){var s,r,o,a,l;for(r in e)if(t[r]!==e[r]){if(a=parseInt(r),_.contains(t,e[r]))return!1;for(o in t.splice(a,0,e[r]),l=0,t)if(e[o]===e[r]){l=parseInt(o);break}s={position:l,id:e[r]},n.push(s),i(t,e,n)}return!0},!!i(t,e,n=[])&&n},e.textLengthWithUrl=function(t,e){var n;return null==e&&(e=23),t?(n=Array(e+1).join("X"),(t=t.replace(/http(s|):\/\/[-A-Za-z0-9+&@#\/%?=~_\|!:,.;]+[-A-Za-z0-9+&@#\/%=~_|]/gim,n)).length):0},e.parseAddressListLocal=function(t){var e,n,i,s,r,o,a,l,c;if(l=emailAddresses.parseAddressList(t),c=[],!_.isEmpty(l)){for(e=0,i=l.length;e<i;e++)(a=l[e])&&a.address&&c.push(a.address);return c}if(_.isEmpty(l)&&t.match("@"))for(o=/(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,n=0,s=(l=t.split(",")).length;n<s;n++)(a=l[n])&&a.match("@")&&(r=a.match(o))&&r[0]&&c.push(r[0]);return c},e.contentTypeCleanup=function(t){return t?t=t.replace(/^(.+?\/.+?)(\b|\s).+?$/,"$1"):t},e.getRecipientArticle=function(t,e,n,i,s,r){var o,a,l,c,u,p,h,d,f,m,g,v,y,b,w,k,A,C,T,S,x;if(null==s&&(s=[]),l={to:"",cc:"",body:"",in_reply_to:""},e.message_id&&(l.in_reply_to=e.message_id),"phone"===i.name)return"Agent"===e.sender.name?(null!=(A=e.to)?A.match(/@/):void 0)&&(l.to=App.Utils.parseAddressListLocal(e.to).join(", ")):(null!=(C=e.from)?C.match(/@/):void 0)&&(l.to=App.Utils.parseAddressListLocal(e.from).join(", ")),(l.to&&!l.to.match(/@/)||!l.to)&&(l.to=t.customer.email),l;if("email"===i.name||"web"===i.name){for(v=[],p=0,f=s.length;p<f;p++)(a=s[p])&&!_.isEmpty(a.email)&&v.push(a.email.toString().toLowerCase());if(u=function(t){return!_.isEmpty(t)&&_.contains(v,t.toString().toLowerCase())},c=void 0,n&&n.email&&(c=n.email.toLowerCase()),S=!1,!_.isEmpty(e.from)&&(x=App.Utils.parseAddressListLocal(e.from)))for(h=0,m=x.length;h<m;h++)(T=x[h])&&T.match("@")&&(S=u(T));if(w=!1,!_.isEmpty(e.to)&&(k=App.Utils.parseAddressListLocal(e.to))&&k[0])for(d=0,g=k.length;d<g&&(y=k[d],!0!==(w=u(y)));d++);S?l.to=e.reply_to||e.to:"Agent"===e.sender.name&&c&&e.from&&e.from.toString().toLowerCase().match(c)&&!w?l.to=e.to:(e.reply_to?l.to=e.reply_to:l.to=e.from,l.to&&!l.to.match(/@/)&&(l.to=e.created_by.email)),b={},o=function(t,e){return k=(k=App.Utils.parseAddressListLocal(t)).map((function(t){return t.toString().toLowerCase()})),k=_.reject(k,(function(t){return _.isEmpty(t)})),k=_.reject(k,(function(t){return u(t)})),k=_.reject(k,(function(t){return b[t]})),k=_.each(k,(function(t){return b[t]=!0})),_.isEmpty(e)||k.push(e),(k=k.map((function(t){return t.replace(/'(\S+@\S+\.\S+)'/,"$1")}))).join(", ")},l.to&&(l.to=o(l.to)),r&&(e.from&&(l.to=o(e.from,l.to)),e.to&&(l.to=o(e.to,l.to)),e.cc&&(l.cc=o(e.cc,l.cc)))}return l},e.tokanice=function(t,e){var n,i;return i=App.Config.get("api_path")+"/users/search",n=function(){return $(t).tokenfield({createTokensOnBlur:!0,autocomplete:{source:i,minLength:2,create:function(){return $(this).data("ui-autocomplete")._renderItem=function(t,e){var n,i;return i=App.Utils.htmlEscape(e.label),n="",e.inactive&&(i+='<span style="float: right;">'+App.i18n.translateContent("inactive")+"</span>",n="is-inactive"),$("<li>").addClass(n).append(i).appendTo(t)}}}}).on("tokenfield:createtoken",(function(t){var n;return"email"===e&&!t.attrs.value.match(/@/)||t.attrs.value.match(/\s/)?(t.preventDefault(),!1):((n=t.attrs).label||(n.label=t.attrs.value),!0)}))},App.Delay.set(n,500,void 0,"tags")},e.htmlImage2DataUrl=function(t){return t&&t.match(/<img/i)?((t=this._checkTypeOf("<div>"+t+"</div>")).find("img").each((function(){var t,e;if(null!=(e=$(this).attr("src"))&&!e.match(/^(data|cid):/i))return t=App.Utils._htmlImage2DataUrl(this),$(this).attr("src",t)})),t.get(0).innerHTML):t},e._htmlImage2DataUrl=function(t,e){var n,i,s;null==e&&(e={}),(n=document.createElement("canvas")).width=t.width,n.height=t.height,n.getContext("2d").drawImage(t,0,0,t.width,t.height);try{return i=n.toDataURL(App.Utils.getMimeTypeFromFilename(t.alt)),e.success&&e.success(t,i),i}catch(n){s=n,App.Log.notice("Utils","Can't insert image from "+t.src,s),e.fail&&e.fail(t)}},e.htmlImage2DataUrlAsyncInline=function(t,e){return null==e&&(e={}),t.find("img").each((function(){var t,n;if(null!=(n=(t=$(this)).attr("src"))&&!n.match(/^(data|cid):/i))return App.Utils._htmlImage2DataUrlAsync(this,{success:function(n,i){if(t.attr("src",i),t.css("max-width","100%"),e.success)return e.success(t,i)},fail:function(n){if(t.remove(),e.fail)return e.fail(n)}})}))},e.htmlImage2DataUrlAsync=function(t,e){var n,i,s;return s=this._checkTypeOf("<div>"+t+"</div>"),i=s.find("img").toArray().filter((function(t){return!t.src.match(/^(data|cid):/i)})),(n=function(){var t;return(t=i.pop())?App.Utils._htmlImage2DataUrlAsync(t,{success:function(e,i){return $(t).attr("src",i),n()},fail:function(){return $(t).remove(),n()}}):e(s[0].innerHTML)})()},e._htmlImage2DataUrlAsync=function(t,e){var n;return null==e&&(e={}),(n=new Image).crossOrigin="anonymous",n.onload=function(){return App.Utils._htmlImage2DataUrl(n,e)},n.onerror=function(){if(App.Log.notice("Utils","Image could not be loaded from "+t.src),e.fail)return e.fail(t)},n.alt=t.alt,n.src=t.src},e.baseUrl=function(){var t,e;return t=App.Config.get("fqdn"),e=App.Config.get("http_type"),t&&"zammad.example.com"!==t?e+"://"+t:window.location.origin},e.joinUrlComponents=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],Array.isArray(e[0])&&(e=e[0]),e.filter((function(t){return null!=t})).join("/")},e.clipboardHtmlIsWithText=function(t){var e;return!!t&&(!(!(e=jQuery(jQuery.parseHTML(t)))||!e.text)&&0!==e.text().trim().length)},e.clipboardHtmlInsertPreperation=function(t,e){var n,i,s,r;return!(i=(n="textonly"===e.mode?e.multiline?App.Utils.htmlRemoveRichtext(t):App.Utils.htmlRemoveTags(t):App.Utils.htmlCleanup(t,e.noImages)).html())&&n&&n.text&&n.text()&&(i=App.Utils.text2html(n.text())),i&&""!==i||((s=jQuery(jQuery.parseHTML(t)))&&(r=s.text().trim()),r&&(i=App.Utils.text2html(r))),i},e.safeParseHtml=function(t){try{return $.parseHTML(t)}catch(e){return e,$.parseHTML("<div>"+t+"</div>")[0].childNodes}},e.getMimeTypeFromFilename=function(t){return(null!=t?t.match(/\.(jpe?g)$/i):void 0)?"image/jpeg":"image/png"},e.buildEmailAddress=function(t,e){return t&&null!=t?(!/^[\w ']*$/.test(t)&&/^[\x00-\x7F\xA0-\xFF]*$/.test(t)&&(t='"'+t.replace(/([\\"])/g,"\\$1")+'"'),t+" <"+e+">"):e},e}()}.call(this),function(){var t,e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;App.WebSocket=function(){function t(){}var n;return n=void 0,t.connect=function(){return void 0===n&&null==n&&(n=new e),n},t.close=function(t){return void 0===n&&null==n&&(n=new e),n.close(t)},t.send=function(t){return void 0===n&&null==n&&(n=new e),n.send(t)},t.auth=function(t){return void 0===n&&null==n&&(n=new e),n.auth(t)},t.channel=function(){return void 0===n&&null==n&&(n=new e),n.channel()},t.support=function(){return void 0===n&&null==n&&(n=new e),n.support()},t.queue=function(){return void 0===n&&null==n&&(n=new e),n.queue},t}(),e=function(e){function s(t){var e;this.args=t,this._ajaxReceive=n(this._ajaxReceive,this),this._ajaxSendQueue=n(this._ajaxSendQueue,this),this._ajaxSend=n(this._ajaxSend,this),this._ajaxInit=n(this._ajaxInit,this),this._receiveMessage=n(this._receiveMessage,this),this.connect=n(this.connect,this),this.ping=n(this.ping,this),this.close=n(this.close,this),this.auth=n(this.auth,this),this.send=n(this.send,this),s.__super__.constructor.apply(this,arguments),this.backend=this.Config.get("websocket_backend")||"websocket",App.Event.bind("auth",(e=this,function(){return e.auth()}),"ws"),App.Event.bind("ws:send",function(t){return function(e){return t.send(e)}}(this),"ws"),this.connect(),$(document).on("visibilitychange",function(t){return function(){if(t.log("debug","visibilitychange"),!document.hidden&&t.connectionEstablished)return t.log("debug","ping"),t.ping()}}(this))}return i(s,e),s.include(App.LogInclude),s.prototype.queue=[],s.prototype.supported=!0,s.prototype.connectionKeepDown=!1,s.prototype.connectionEstablished=!1,s.prototype.connectionWasEstablished=!1,s.prototype.tryToConnect=!1,s.prototype.backend=void 0,s.prototype.backend_port="",s.prototype.client_id=void 0,s.prototype.error=!1,s.prototype.channel=function(){if(this.connectionEstablished)return this.backend},s.prototype.support=function(){return this.supported},s.prototype.send=function(t){var e;return"ajax"===this.backend?this._ajaxSend(t):1!==this.ws.readyState?this.queue.push(t):(e=JSON.stringify(t),this.ws.send(e))},s.prototype.auth=function(t){if(this.supported)return t={event:"login",session_id:App.Config.get("session_id"),fingerprint:App.Browser.fingerprint()},this.send(t)},s.prototype.close=function(t){if(null==t&&(t={}),t.force&&(this.connectionKeepDown=!0),"ajax"!==this.backend)return this.ws.close()},s.prototype.ping=function(){var t,e;if("ajax"!==this.backend)return this.log("debug","send websocket ping"),this.send({event:"ping"}),App.Delay.clear("websocket-ping-check","ws"),e=this,t=function(){return e.log("debug","no websocket ping response, reconnect..."),e.close()},App.Delay.set(t,9e4,"websocket-ping-check","ws")},s.prototype.pong=function(){if("ajax"!==this.backend)return this.log("debug","received websocket pong"),App.Delay.set(this.ping,6e4,"websocket-pong","ws")},s.prototype.connect=function(){var e,n,i;return window.WebSocket?(n="ws://","https:"===window.location.protocol&&(n="wss://"),"websocket"===this.backend?(e="",window.location.port&&""!==window.location.port&&(e=":"+window.location.port),this.ws=new window.WebSocket(""+n+window.location.hostname+e+"/ws")):"websocketPort"===this.backend?(this.backend_port=App.Config.get("websocket_port")||"6042",this.ws=new window.WebSocket(""+n+window.location.hostname+":"+this.backend_port+"/")):this._ajaxInit(),this.ws.onopen=(i=this,function(){var t,n,s,r;for(i.backend_port&&(e=":"+i.backend_port),i.log("debug","new websocket ("+i.channel()+e+") connection open"),i.connectionEstablished=!0,i.connectionWasEstablished=!0,App.Delay.clear("websocket-no-connection-try-reconnect-message","ws"),i.error&&(i.error.close(),i.error=!1,i.tryToConnect=!1),i.auth(),t=0,s=(r=i.queue).length;t<s;t++)n=r[t],i.log("debug","empty ws queue",n),i.send(n);return i.queue=[],App.Delay.set(i.ping,6e4,"websocket-send-ping-to-heck-connection","ws")}),this.ws.onmessage=function(t){return function(e){var n;return n=JSON.parse(e.data),t.log("debug","ws:onmessage",n),t._receiveMessage(n)}}(this),this.ws.onclose=function(n){return function(){var i;if(n.log("debug","close websocket connection"),!n.connectionKeepDown){if(n.connectionEstablished&&(n.connectionEstablished=!1),!n.connectionWasEstablished){if("websocket"===n.backend)return n.log("debug","no websocket connection on /ws, use :port/"),n.backend="websocketPort",void n.connect();if("websocketPort"===n.backend)return n.backend_port&&(e=":"+n.backend_port),n.log("debug","no websocket connection on port "+e+", use ajax long polling as fallback"),n.backend="ajax",void n.connect()}return n.error||(i=function(){return n.error=new t},n.tryToConnect||App.Delay.set(i,7e3,"websocket-no-connection-try-reconnect-message","ws"),n.tryToConnect=!0),App.Delay.set(n.connect,4500,"websocket-try-reconnect-after-x-sec","ws")}}}(this),this.ws.onerror=function(t){return function(e){if(t.log("debug","ws:onerror",e),t.connectionEstablished)return t.connectionEstablished=!1}}(this)):(this.supported=!1,this.backend="ajax",this.log("debug","no support of websocket, use ajax long polling"),void this._ajaxInit())},s.prototype._receiveMessage=function(t){var e,n,i,s;for(null==t&&(t=[]),s=[],e=0,i=t.length;e<i;e++)n=t[e],this.log("debug","onmessage",n),"pong"===n.event&&this.pong(),n.event?(this.log("debug","onmessage event: "+n.event),s.push(App.Event.trigger(n.event,n.data))):s.push(void 0);return s},s.prototype._ajaxInit=function(t){var e;if(null==t&&(t={}),!this._ajaxInitDone||t.force)return App.Ajax.request({id:"ws-login",type:"POST",url:this.Config.get("api_path")+"/message_send",data:JSON.stringify({data:{event:"login"}}),processData:!1,queue:!1,success:(e=this,function(t){return t.client_id&&(e.log("debug","ajax:new client_id",t.client_id),e.client_id=t.client_id,e._ajaxReceive(),e._ajaxSendQueue()),e._ajaxInitDone=!0}),error:function(t){return function(){var e;return t._ajaxInitDone=!0,e=function(){return t._ajaxInit({force:!0})},App.Delay.set(e,1e4,"_ajaxInit-reconnect-on-error","ws")}}(this)})},s.prototype._ajaxSend=function(t){return this.log("debug","ajax:sendmessage",t),this.client_id&&void 0!==this.client_id&&this._ajaxInitDone?(this.queue.push(t),this._ajaxSendQueue()):(this._ajaxInit(),this.queue.push(t))},s.prototype._ajaxSendQueue=function(){var t,e;for(e=[];!_.isEmpty(this.queue);)t=this.queue.shift(),e.push(App.Ajax.request({type:"POST",url:this.Config.get("api_path")+"/message_send",data:JSON.stringify({client_id:this.client_id,data:t}),processData:!1,queue:!0,success:function(t){return function(e){if(e&&e.error)return t.client_id=void 0,t._ajaxInit({force:!0})}}(this),error:function(t){return function(){return t.client_id=void 0,t._ajaxInit({force:!0})}}(this)}));return e},s.prototype._ajaxReceive=function(){var t;if(this.client_id&&!0!==this._ajaxReceiveWorking)return this._ajaxReceiveWorking=!0,App.Ajax.request({id:"message_receive",type:"POST",url:this.Config.get("api_path")+"/message_receive",data:JSON.stringify({client_id:this.client_id}),processData:!1,success:(t=this,function(e){return t.log("debug","ajax:onmessage",e),t._receiveMessage(e),e&&e.error&&(t.client_id=void 0,t._ajaxInit({force:!0})),t._ajaxReceiveWorking=!1,t._ajaxReceive()}),error:function(t){return function(){return t.client_id=void 0,t._ajaxInit({force:!0}),t._ajaxReceiveWorking=!1}}(this)})},s}(App.Controller),t=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.buttonClose=!1,e.prototype.buttonCancel=!1,e.prototype.buttonSubmit=!1,e.prototype.backdrop="static",e.prototype.keyboard=!1,e.prototype.head=__("Lost network connection!"),e.prototype.content=function(){return App.i18n.translateInline("Trying to reconnect\u2026")},e}(App.ControllerModal)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.SearchableAjaxSelect=function(n){function i(){this.showLoader=t(this.showLoader,this),this.renderResponse=t(this.renderResponse,this),this.onInput=t(this.onInput,this),this.hideLoader=t(this.hideLoader,this),this.ajaxAttributes=t(this.ajaxAttributes,this),this.cacheKey=t(this.cacheKey,this),this.objectString=t(this.objectString,this),i.__super__.constructor.apply(this,arguments),this.searchResultCache={}}return e(i,n),i.prototype.render=function(){var t;return _.isEmpty(this.attribute.value)||this.attribute.multiple||(_.isArray(this.attribute.options)||(this.attribute.options=[]),this.attribute.relation?App[this.attribute.relation]&&App[this.attribute.relation].exists(this.attribute.value)&&(t=App[this.attribute.relation].find(this.attribute.value).displayName(),this.attribute.options.push({value:this.attribute.value,name:t,selected:!0})):this.attribute.options.push({value:this.attribute.value,name:this.attribute.valueName||this.attribute.value,selected:!0})),i.__super__.render.apply(this,arguments)},i.prototype.objectString=function(){return underscored(this.options.attribute.relation)},i.prototype.cacheKey=function(){return this.objectString()+"+"+this.input.val()},i.prototype.ajaxAttributes=function(){var t,e,n,i;return e=this.objectString(),n=this.input.val(),t=this.cacheKey(),{id:this.options.attribute.id,type:"POST",url:App.Config.get("api_path")+"/search/"+e,data:JSON.stringify({query:n,
limit:this.options.attribute.limit}),processData:!0,success:(i=this,function(e){return i.searchResultCache[t]=e,i.renderResponse(e,n)}),error:function(t){return function(){return t.hideLoader()}}(this)}},i.prototype.hideLoader=function(){return clearTimeout(this.loaderTimeoutId),this.loaderTimeoutId=void 0,this.el.removeClass("is-loading")},i.prototype.onInput=function(t){var e,n,s,r,o;return i.__super__.onInput.apply(this,arguments),s=this.input.val(),n=this.cacheKey(),this.searchResultCache[n]?(App.Ajax.abort(this.options.attribute.id),void this.renderResponse(this.searchResultCache[n],s)):(this.loaderTimeoutId||(this.loaderTimeoutId=setTimeout(this.showLoader,1e3)),e=this.ajaxAttributes(),(null!=(r=this.delegate)?r.getAjaxAttributes:void 0)&&(e=null!=(o=this.delegate)&&"function"==typeof o.getAjaxAttributes?o.getAjaxAttributes(this,e):void 0),App.Ajax.request(e))},i.prototype.renderResponse=function(t){var e,n;return this.hideLoader(),App.Collection.loadAssets(t.assets),e=t.result.map((n=this,function(e){return n.useAjaxDetails?n.renderResponseItemAjax(e,t):n.renderResponseItem(e)})).filter((function(t){return null!=t})),this.optionsList.html(this.renderOptions(e)),this.refreshElements()},i.prototype.renderResponseItemAjax=function(t,e){var n,i;if(n=void 0,"KnowledgeBase::Answer::Translation"===(i=_.find(e.details,(function(e){return e.type===t.type&&e.id===t.id}))).type&&i.subtitle&&(n=i.subtitle),i)return{category:n,name:i.title,value:t.id}},i.prototype.renderResponseItem=function(t){var e,n;if(e=null!=(n=App[t.type.replace(/::/g,"")])?n.find(t.id):void 0)return{name:e instanceof App.Ticket?"#"+e.number+" - "+e.title:e.displayName(),value:e.id,inactive:!1===e.active}},i.prototype.showLoader=function(){return this.el.addClass("is-loading")},i}(App.SearchableSelect)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.CustomerOrganizationAjaxSelect=function(n){function i(){return this.ajaxAttributes=t(this.ajaxAttributes,this),this.cacheKey=t(this.cacheKey,this),i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.cacheKey=function(){var t;return(t=this.el.closest("form").find("input[name=customer_id]").val())?i.__super__.cacheKey.apply(this,arguments)+"-customer-"+t:i.__super__.cacheKey.apply(this,arguments)},i.prototype.ajaxAttributes=function(){var t,e,n;return t=this.el.closest("form").find("input[name=customer_id]").val(),App.Session.get().permission("ticket.customer")&&!App.Session.get().permission("ticket.agent")&&(t=App.Session.get().id),t&&(n=App.User.find(t))?n.allOrganizationIds().length<1?i.__super__.ajaxAttributes.apply(this,arguments):((e=i.__super__.ajaxAttributes.apply(this,arguments)).data=JSON.stringify({query:this.input.val()+"*",limit:this.options.attribute.limit,ids:n.allOrganizationIds()}),e):i.__super__.ajaxAttributes.apply(this,arguments)},i}(App.SearchableAjaxSelect)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var s in e)n.call(e,s)&&(t[s]=e[s]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;App.ExternalDataSourceAjaxSelect=function(n){function i(){this.clearValue=t(this.clearValue,this),this.toggleClear=t(this.toggleClear,this),this.onInput=t(this.onInput,this),this.removeToken=t(this.removeToken,this),this.createToken=t(this.createToken,this),this.addValueToShadowInput=t(this.addValueToShadowInput,this),this.onKeyUp=t(this.onKeyUp,this),this.selectValue=t(this.selectValue,this),this.setShadowValue=t(this.setShadowValue,this),this.getShadowValue=t(this.getShadowValue,this),this.ajaxAttributes=t(this.ajaxAttributes,this),this.cacheKey=t(this.cacheKey,this),this.updateAttributeValueName=t(this.updateAttributeValueName,this),i.__super__.constructor.apply(this,arguments),this.searchResultCache=App.ExternalDataSourceAjaxSelect.TEST_SEARCH_RESULT_CACHE||{}}return e(i,n),i.prototype.render=function(){var t,e,n,i;if(this.attribute.valueType="json",this.attribute.name&&(this.attribute.nameRaw=this.attribute.name,this.attribute.name="{"+this.attribute.valueType+"}"+this.attribute.name),_.isEmpty(this.attribute.value))this.attribute.value={},this.attribute.multiple&&(this.attribute.value=[]);else if(this.attribute.multiple)for(this.attribute.existingTokens="",this.attribute.options=_.map(this.attribute.value,(function(t){return{value:t.value,name:t.label,selected:!0}})),t=0,e=(i=this.attribute.options).length;t<e;t++)n=i[t],this.attribute.existingTokens+=App.view("generic/token")(n);else this.attribute.options=[_.extend({},{value:this.attribute.value.value,name:this.attribute.value.label,selected:!0})];return this.attribute.valueRaw=JSON.stringify(this.attribute.value),this.renderElement()},i.prototype.renderOptions=function(t){return t.forEach((function(t){return t.value=JSON.stringify([t.value])})),i.__super__.renderOptions.call(this,t)},i.prototype.updateAttributeValueName=function(){var t;if(!this.shadowInput.length||!_.isEmpty(this.getShadowValue()))return(t=this.findFirstSelection(this.attribute.options))?this.attribute.valueName=t.name:this.attribute.unknown&&this.attribute.value?this.attribute.valueName=this.attribute.value.label:this.hasSubmenu(this.attribute.options)?this.attribute.valueName=this.getName(this.attribute.value,this.attribute.options):void 0;this.attribute.valueName=""},i.prototype.cacheKey=function(){return this.options.attribute.objectName+"+"+(this.options.attribute.attributeName||this.options.attribute.nameRaw)+"+"+this.input.val()},i.prototype.ajaxAttributes=function(){var t,e,n,i,s,r,o;return e=this.options.attribute.objectName,t=this.options.attribute.attributeName||this.options.attribute.nameRaw,i=this.input.val(),r={},(n=(null!=(s=this.delegate.params)?s.id:void 0)?this.delegate.params:App.ControllerForm.params(this.delegate.form)).id&&(r[this.delegate.model.className.toLowerCase()+"_id"]=n.id),n.customer_id&&(r.customer_id=n.customer_id),{id:this.options.attribute.id,type:"GET",url:App.Config.get("api_path")+"/external_data_source/"+e+"/"+t,data:{query:i,limit:this.options.attribute.limit,search_context:r},processData:!0,success:(o=this,function(t){return o.searchResultCache[o.cacheKey()]=t,o.renderResponse(t,i)}),error:function(t){return function(){return t.hideLoader()}}(this)}},i.prototype.renderResponseItem=function(t){return{name:t.label,value:t.value}},i.prototype.getShadowValue=function(){try{return JSON.parse(this.shadowInput.val())}catch(t){return App.Log.debug("App.ExternalDataSourceAjaxSelect","getShadowValue",this.shadowInput.val()),this.attribute.multiple?[]:{}}},i.prototype.setShadowValue=function(t){return _.isArray(null!=t?t.value:void 0)&&(t.value=t.value[0]),this.shadowInput.val(JSON.stringify(t)).trigger("change")},i.prototype.selectValue=function(t,e,n){if(n=e,i.__super__.selectValue.apply(this,arguments),""!==t||""!==e)return this.setShadowValue({value:t,label:e});this.setShadowValue({})},i.prototype.onKeyUp=function(){if(""===this.input.val().trim()&&!this.attribute.multiple)return this.setShadowValue({})},i.prototype.addValueToShadowInput=function(t,e){var n,i;if(this.input.val("").removeAttr("title"),n=_.isArray(e)?e[0]:e,i=[],_.isEmpty(this.getShadowValue())||(i=this.getShadowValue(),!_.find(i,(function(t){return""+t.value==""+n}))))return this.currentData={label:t,value:n},i.push(this.currentData),this.setShadowValue(i),this.onShadowChange()},i.prototype.onShadowChange=function(){var t,e,n,i,s;if(s=this.getShadowValue(),s=this.attribute.multiple?_.map(s,(function(t){return t.value})):s.value,this.attribute.multiple&&this.currentData&&(this.createToken(this.currentData),this.currentData=null),Array.isArray(this.attribute.options)){for(t=0,e=(i=this.attribute.options).length;t<e;t++)n=i[t],this.attribute.multiple?n.selected=_.includes(s||[],n.value.toString()):n.selected=n.value.toString()===(null!=s?s.toString():void 0);if(n.children)return this.updateAttributeOptionSelected(n.children,s)}},i.prototype.createToken=function(t){var e,n;return e=t.label,n=t.value,this.input.before(App.view("generic/token")({name:String(e),value:n}))},i.prototype.onEnter=function(t){var e,n;if(this.currentItem&&this.currentItem.hasClass("js-back"))return this.navigateOut(t);if(this.clearAutocomplete(),this.isOpen){if(t.preventDefault(),this.currentItem||!this.attribute.unknown){if(this.currentItem.hasClass("has-inactive"))return;n=this.currentItem.children("span.searchableSelect-option-text").text().trim(),e=this.currentItem.attr("data-value"),this.attribute.multiple?this.addValueToShadowInput(n,e):(this.input.val(n).title(n),this.setShadowValue({value:e,label:n})),this.currentItem.removeClass("is-active"),this.currentItem.hasClass("js-enter")&&this.currentItem.removeClass("is-highlighted"),this.currentItem=null}return this.input.trigger("change"),this.attribute.multiple?void 0:(this.toggle(),this.input.trigger("blur"))}_.isEmpty(this.getShadowValue())?(t.preventDefault(),this.toggle()):(this.trigger("enter"),this.el.trigger("enter"))},i.prototype.removeToken=function(t){var e,n;if("last"===t){if(!(n=this.$(".token").last()).length)return}else n=t;return e=n.data("value"),this.setShadowValue(_.filter(this.getShadowValue(),(function(t){return""+t.value!=""+e}))),n.remove()},i.prototype.onInput=function(t,e){if(null==e&&(e=!0),i.__super__.onInput.apply(this,arguments),this.attribute.unknown&&!this.attribute.multiple)return this.setShadowValue({value:this.query,label:this.query})},i.prototype.toggleClear=function(){return _.isEmpty(this.getShadowValue())||this.isOpen?this.clear.addClass("hide"):this.clear.removeClass("hide")},i.prototype.clearValue=function(){return event.stopPropagation(),this.selectValue("","",""),this.input.trigger("change"),this.markSelected(""),this.toggleClear()},i}(App.SearchableAjaxSelect)}.call(this),window.console||(window.console={}),console.log||(console.log=function(){}),Date.prototype.getWeek=function(){var t=new Date(this.getFullYear(),0,1);return Math.ceil(((this-t)/864e5+t.getDay()+1)/7)},jQuery.event.special.remove={remove:function(t){t.handler&&t.handler()}},$("body").on("click",".checkbox-replacement, .radio-replacement",(function(t){$(t.currentTarget).find("input").addClass("is-active")})),$("body").on("blur",".checkbox-replacement input, .radio-replacement input",(function(){$(this).removeClass("is-active")})),jQuery.fn.removeAttrs=function(t){return this.each((function(){var e=$(this);$.each(this.attributes,(function(n,i){i&&i.specified&&t.test(i.name)&&e.removeAttr(i.name)}))}))},jQuery.fn.extend({serializeArrayWithType:function(){var t=/\r?\n/g,e=/^(?:submit|button|image|reset|file)$/i,n=/^(?:input|select|textarea|keygen)/i,i=/^(?:checkbox|radio)$/i;return this.map((function(){var t=$(this).find("*").filter(":input");return t?jQuery.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&n.test(this.nodeName)&&!e.test(t)&&(this.checked||!i.test(t))})).map((function(e,n){var i,s=jQuery(this),r=s.val(),o=s.data("field-type"),a=s.prop("multiple");return!0===a&&"object"==typeof r&&0==r.length&&(r=null),i=null==r?s.prop("multiple")?{name:n.name,value:null,type:o,multiple:a}:null:Array.isArray(r)||a?jQuery.map(r,(function(e){return{name:n.name,value:e.replace(t,"\r\n"),type:o,multiple:a}})):{name:n.name,value:r.replace(t,"\r\n"),type:o,multiple:a},i})).get()}}),jQuery.event.special.touchstart={setup:function(t,e,n){this.addEventListener("touchstart",n,{passive:!e.includes("noPreventDefault")})}},jQuery.event.special.touchmove={setup:function(t,e,n){this.addEventListener("touchmove",n,{passive:!e.includes("noPreventDefault")})}},jQuery.event.special.wheel={setup:function(t,e,n){this.addEventListener("wheel",n,{passive:!0})}},jQuery.event.special.mousewheel={setup:function(t,e,n){this.addEventListener("mousewheel",n,{passive:!0})}},new App.Run;