!function(){var e;e=function(){return function(){var e={195:function(e){e.exports=function(e){function t(e,t){this.highOrder=e,this.lowOrder=t}var n,i,o,a,s,r,l,d,c,u,p=[new t(1779033703,4089235720),new t(3144134277,2227873595),new t(1013904242,4271175723),new t(2773480762,1595750129),new t(1359893119,2917565137),new t(2600822924,725511199),new t(528734635,4215389547),new t(1541459225,327033209)],h=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)],f=new Array(64);function m(e,n){var i,o,a;return i=(65535&e.lowOrder)+(65535&n.lowOrder),a=(65535&(o=(e.lowOrder>>>16)+(n.lowOrder>>>16)+(i>>>16)))<<16|65535&i,i=(65535&e.highOrder)+(65535&n.highOrder)+(o>>>16),new t((65535&(o=(e.highOrder>>>16)+(n.highOrder>>>16)+(i>>>16)))<<16|65535&i,a)}function v(e,n,i,o){var a,s,r;return a=(65535&e.lowOrder)+(65535&n.lowOrder)+(65535&i.lowOrder)+(65535&o.lowOrder),r=(65535&(s=(e.lowOrder>>>16)+(n.lowOrder>>>16)+(i.lowOrder>>>16)+(o.lowOrder>>>16)+(a>>>16)))<<16|65535&a,a=(65535&e.highOrder)+(65535&n.highOrder)+(65535&i.highOrder)+(65535&o.highOrder)+(s>>>16),new t((65535&(s=(e.highOrder>>>16)+(n.highOrder>>>16)+(i.highOrder>>>16)+(o.highOrder>>>16)+(a>>>16)))<<16|65535&a,r)}function g(e,n,i,o,a){var s,r,l;return s=(65535&e.lowOrder)+(65535&n.lowOrder)+(65535&i.lowOrder)+(65535&o.lowOrder)+(65535&a.lowOrder),l=(65535&(r=(e.lowOrder>>>16)+(n.lowOrder>>>16)+(i.lowOrder>>>16)+(o.lowOrder>>>16)+(a.lowOrder>>>16)+(s>>>16)))<<16|65535&s,s=(65535&e.highOrder)+(65535&n.highOrder)+(65535&i.highOrder)+(65535&o.highOrder)+(65535&a.highOrder)+(r>>>16),new t((65535&(r=(e.highOrder>>>16)+(n.highOrder>>>16)+(i.highOrder>>>16)+(o.highOrder>>>16)+(a.highOrder>>>16)+(s>>>16)))<<16|65535&s,l)}function y(e,n,i){return new t(e.highOrder&n.highOrder^e.highOrder&i.highOrder^n.highOrder&i.highOrder,e.lowOrder&n.lowOrder^e.lowOrder&i.lowOrder^n.lowOrder&i.lowOrder)}function b(e,n,i){return new t(e.highOrder&n.highOrder^~e.highOrder&i.highOrder,e.lowOrder&n.lowOrder^~e.lowOrder&i.lowOrder)}function x(e,n){return n<=32?new t(e.highOrder>>>n|e.lowOrder<<32-n,e.lowOrder>>>n|e.highOrder<<32-n):new t(e.lowOrder>>>n|e.highOrder<<32-n,e.highOrder>>>n|e.lowOrder<<32-n)}function w(e){var n=x(e,28),i=x(e,34),o=x(e,39);return new t(n.highOrder^i.highOrder^o.highOrder,n.lowOrder^i.lowOrder^o.lowOrder)}function L(e){var n=x(e,14),i=x(e,18),o=x(e,41);return new t(n.highOrder^i.highOrder^o.highOrder,n.lowOrder^i.lowOrder^o.lowOrder)}function j(e){var n=x(e,1),i=x(e,8),o=E(e,7);return new t(n.highOrder^i.highOrder^o.highOrder,n.lowOrder^i.lowOrder^o.lowOrder)}function E(e,n){return n<=32?new t(e.highOrder>>>n,e.lowOrder>>>n|e.highOrder<<32-n):new t(0,e.highOrder<<32-n)}var C,T,k,A,M=8*(e=function(e){return unescape(encodeURIComponent(e))}(e)).length;(e=function(e){for(var t=[],n=8*e.length,i=0;i>5]|=(255&e.charCodeAt(i/8))<<24-i%32;return t}(e))[M>>5]|=128<<24-M%32,e[31+(M+128>>10<<5)]=M;for(var D=0;D>2]>>8*(3-a%4),i+=n.charAt(t>>4&15)+n.charAt(15&t);return i}(N)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var i={};return function(){"use strict";n.d(i,{default:function(){return Y}});var e,t,o,a,s={two:function(e){return 1==(e=""+e).length&&(e="0"+e),e},focus:function(e){if(e.innerText.length){var t=document.createRange(),n=window.getSelection(),i=e.childNodes[e.childNodes.length-1];t.setStart(i,i.length),t.collapse(!0),n.removeAllRanges(),n.addRange(t),e.scrollLeft=e.scrollWidth}},isNumeric:function(e){return"string"==typeof e&&(e=e.trim()),!isNaN(e)&&null!==e&&""!==e},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},getNode:function(){var e=document.getSelection().anchorNode;return e?3==e.nodeType?e.parentNode:e:null},hash:function(e){var t,n,i=0;if(0===e.length)return i;for(t=0;t32&&(i=(i<<5)-i+n,i|=0);return i},randomColor:function(e){var t=String("#"+Math.random().toString(16).slice(2,8).toUpperCase()).replace(/[^0-9a-f]/gi,"");t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);var n,i,o=[];for(i=0;i<3;i++)n=parseInt(t.substr(2*i,2),16),n=Math.round(Math.min(Math.max(0,n+-.25*n),255)).toString(16),o.push(("00"+n).substr(n.length));return 1==e?"#"+s.two(o[0].toString(16))+s.two(o[1].toString(16))+s.two(o[2].toString(16)):o},getWindowWidth:function(){var e=window,t=document,n=t.documentElement,i=t.getElementsByTagName("body")[0];return e.innerWidth||n.clientWidth||i.clientWidth},getWindowHeight:function(){var e=window,t=document,n=t.documentElement,i=t.getElementsByTagName("body")[0];return e.innerHeight||n.clientHeight||i.clientHeight},getPosition:function(e){if(e.changedTouches&&e.changedTouches[0])var t=e.changedTouches[0].pageX,n=e.changedTouches[0].pageY;else t=window.Event?e.pageX:e.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft),n=window.Event?e.pageY:e.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);return[t,n]},click:function(e){if(e.click)e.click();else{var t=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});e.dispatchEvent(t)}},findElement:function(e,t){var n=!1;return function e(i){i&&!n&&("function"==typeof t?n=t(i):"string"==typeof t&&i.classList&&i.classList.contains(t)&&(n=i)),i.parentNode&&!n&&e(i.parentNode)}(e),n}},r=s,l=(e={now:function(e,t){var n=null,i=null,o=null,a=null,s=null,l=null;return Array.isArray(e)?(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5]):(e||(e=new Date),n=e.getFullYear(),i=e.getMonth()+1,o=e.getDate(),a=e.getHours(),s=e.getMinutes(),l=e.getSeconds()),1==t?r.two(n)+"-"+r.two(i)+"-"+r.two(o):r.two(n)+"-"+r.two(i)+"-"+r.two(o)+" "+r.two(a)+":"+r.two(s)+":"+r.two(l)},toArray:function(e){var t=(n=e.split(-1!==e.indexOf("T")?"T":" "))[1],n=n[0].split("-"),i=parseInt(n[0]),o=parseInt(n[1]),a=parseInt(n[2]),s=0,r=0;return t&&(t=t.split(":"),s=parseInt(t[0]),r=parseInt(t[1])),[i,o,a,s,r,0]}},t=Date.UTC(1900,0,0),o=Date.UTC(1900,1,29),a=864e5,e.dateToNum=function(e){"string"==typeof e&&(e=new Date(e+" GMT+0"));var n=e.getTime();return n>=o&&(n+=a),(n-=t)/a},e.numToDate=function(n){var i=t+n*a;i>=o&&(i-=a);const s=new Date(i);var r=[s.getUTCFullYear(),s.getUTCMonth()+1,s.getUTCDate(),s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds()];return e.now(r)},e.weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],e.months=["January","February","March","April","May","June","July","August","September","October","November","December"],e.weekdaysShort=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],e.monthsShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],e),d=function(e){return"undefined"!=typeof document&&document.dictionary&&document.dictionary[e]||e},c={setDictionary:function(e){document.dictionary||(document.dictionary={});var t=null,n=null,i=Object.keys(e);for(n=0;n=0&&document.jsuitesComponents.splice(n,1)}}function p(e,t,n){if((e=e.split(".")).length){let i=this,o=null;for(;e.length>1;)if(o=e.shift(),i.hasOwnProperty(o))i=i[o];else{if(void 0===t)return;i[o]={},i=i[o]}if(o=e.shift(),void 0!==t)return!0===n?delete i[o]:i[o]=t,!0;if(i)return i[o]}return!1}function h(e,t){var n={options:{}},i={pointer:null,direction:null,ondragstart:null,ondragend:null,ondrop:null},o=null;for(var a in i)t&&t.hasOwnProperty(a)?n.options[a]=t[a]:n.options[a]=i[a];e.classList.add("jsorting"),e.addEventListener("dragstart",(function(t){var i=Array.prototype.indexOf.call(t.target.parentNode.children,t.target);o={element:t.target,o:i,d:i},t.target.style.opacity="0.25","function"==typeof n.options.ondragstart&&n.options.ondragstart(e,t.target,t)})),e.addEventListener("dragover",(function(e){if(e.preventDefault(),s(e.target)&&o&&"true"==e.target.getAttribute("draggable")&&o.element!=e.target){if(n.options.direction)t=e.target.clientWidth/2>e.offsetX;else var t=e.target.clientHeight/2>e.offsetY;t?e.target.parentNode.insertBefore(o.element,e.target):e.target.parentNode.insertBefore(o.element,e.target.nextSibling),o.d=Array.prototype.indexOf.call(e.target.parentNode.children,o.element)}})),e.addEventListener("dragleave",(function(e){e.preventDefault()})),e.addEventListener("dragend",(function(t){t.preventDefault(),o&&("function"==typeof n.options.ondragend&&n.options.ondragend(e,o.element,t),o.o=e.scrollHeight?t.loadDown()&&(a==e.scrollTop&&(e.scrollTop=e.scrollTop-e.clientHeight),o=!0):e.scrollTop<=e.clientHeight&&t.loadUp()&&(a==e.scrollTop&&(e.scrollTop=e.scrollTop+e.clientHeight),o=!0),n=setTimeout((function(){n=null}),t.timer),o&&"function"==typeof t.onupdate&&t.onupdate()}};return e.onscroll=function(e){i()},e.onwheel=function(e){i()},{}}var m=function(){var e=function(t,n){if(Array.isArray(t)){var i={instance:[],complete:n};if(t.length>0)for(var o=0;o=200&&c.status<300)if("json"===t.dataType)try{var n=JSON.parse(c.responseText);t.success&&"function"==typeof t.success&&t.success(n)}catch(e){t.error&&"function"==typeof t.error&&t.error(e,n)}else n="blob"===t.dataType?c.response:c.responseText,t.success&&"function"==typeof t.success&&t.success(n);else t.error&&"function"==typeof t.error&&t.error(c.responseText,c.status);if(e.queue&&e.queue.length>0&&e.send(e.queue.shift()),e.requests&&e.requests.length){var i=e.requests.indexOf(c);e.requests.splice(i,1),e.requests.length||t.complete&&"function"==typeof t.complete&&t.complete(n),t.group&&e.oncomplete&&"function"==typeof e.oncomplete[t.group]&&(e.pending(t.group)||(e.oncomplete[t.group](),e.oncomplete[t.group]=null)),t.multiple&&t.multiple.instance&&(i=t.multiple.instance.indexOf(c),t.multiple.instance.splice(i,1),t.multiple.instance.length||t.multiple.complete&&"function"==typeof t.multiple.complete&&t.multiple.complete(n))}},c.options=t,c.data=l,!0===t.queue&&e.requests.length>0?e.queue.push(c):e.send(c),c};return e.send=function(t){t.data?Array.isArray(t.data)?t.send(t.data.join("&")):t.send(t.data):t.send(),e.requests.push(t)},e.exists=function(e,t){var n=new XMLHttpRequest;n.open("HEAD",e,!1),n.send(),n.status&&t(n.status)},e.pending=function(t){var n=0,i=e.requests;if(i&&i.length)for(var o=0;o0&&setTimeout((function(){e.loading.hide()}),1e3*t)},e.loading.hide=function(){e.loading.element&&e.loading.element.parentNode&&document.body.removeChild(e.loading.element)},e.slideLeft=function(e,t,n){1==t?(e.classList.add("slide-left-in"),setTimeout((function(){e.classList.remove("slide-left-in"),"function"==typeof n&&n()}),400)):(e.classList.add("slide-left-out"),setTimeout((function(){e.classList.remove("slide-left-out"),"function"==typeof n&&n()}),400))},e.slideRight=function(e,t,n){!0===t?(e.classList.add("slide-right-in"),setTimeout((function(){e.classList.remove("slide-right-in"),"function"==typeof n&&n()}),400)):(e.classList.add("slide-right-out"),setTimeout((function(){e.classList.remove("slide-right-out"),"function"==typeof n&&n()}),400))},e.slideTop=function(e,t,n){!0===t?(e.classList.add("slide-top-in"),setTimeout((function(){e.classList.remove("slide-top-in"),"function"==typeof n&&n()}),400)):(e.classList.add("slide-top-out"),setTimeout((function(){e.classList.remove("slide-top-out"),"function"==typeof n&&n()}),400))},e.slideBottom=function(e,t,n){!0===t?(e.classList.add("slide-bottom-in"),setTimeout((function(){e.classList.remove("slide-bottom-in"),"function"==typeof n&&n()}),400)):(e.classList.add("slide-bottom-out"),setTimeout((function(){e.classList.remove("slide-bottom-out"),"function"==typeof n&&n()}),100))},e.fadeIn=function(e,t){e.style.display="",e.classList.add("fade-in"),setTimeout((function(){e.classList.remove("fade-in"),"function"==typeof t&&t()}),2e3)},e.fadeOut=function(e,t){e.classList.add("fade-out"),setTimeout((function(){e.style.display="none",e.classList.remove("fade-out"),"function"==typeof t&&t()}),1e3)},e}(),g=function(){var e={text:["@"],currency:["#(.{1})##0?(.{1}0+)?( ?;(.*)?)?","#"],percentage:["0{1}(.{1}0+)?%"],numeric:["0{1}(.{1}0+)?"],datetime:["YYYY","YYY","YY","MMMMM","MMMM","MMM","MM","DDDDD","DDDD","DDD","DD","DY","DAY","WD","D","Q","MONTH","MON","HH24","HH12","HH","\\[H\\]","H","AM/PM","MI","SS","MS","Y","M"],general:["A","0","[0-9a-zA-Z$]+","."]},t=function(){if(-1!==this.mask.toLowerCase().indexOf("[h]")){var e=0;this.date[4]&&(e=parseFloat(this.date[4]/60));var t=parseInt(this.date[3])+e;t/=24}else this.date[0]&&this.date[1]&&this.date[2]||!this.date[3]&&!this.date[4]?(this.date[0]&&this.date[1]&&!this.date[2]&&(this.date[2]=1),t=r.two(this.date[0])+"-"+r.two(this.date[1])+"-"+r.two(this.date[2]),(this.date[3]||this.date[4]||this.date[5])&&(t+=" "+r.two(this.date[3])+":"+r.two(this.date[4])+":"+r.two(this.date[5]))):t=r.two(this.date[3])+":"+r.two(this.date[4])+":"+r.two(this.date[5]);return t},n=function(){var e="";if(this.date[0]&&this.date[1]&&this.date[2]||!this.date[3]&&!this.date[4]){if(this.date[0]||this.date[1]||this.date[2]||this.date[3]||this.date[4]||this.date[5]){this.date[0]&&this.date[1]&&!this.date[2]&&(this.date[2]=1);var t=l.now(this.date);e=l.dateToNum(t),this.date[4]&&(e+=parseFloat(this.date[4]/60))}}else{if(-1!==this.mask.toLowerCase().indexOf("[h]"))e=parseInt(this.date[3]);else{let t=parseInt(this.date[3]);e=t<13&&-1!==this.values.indexOf("PM")?(t+12)%24:t%24}this.date[4]&&(e+=parseFloat(this.date[4]/60)),this.date[5]&&(e+=parseFloat(this.date[5]/3600)),e/=24}return isNaN(e)&&(e=""),e},i=function(e){return null===e||""===e||void 0===e},o=function(e){return"currency"===e||"percentage"===e||"numeric"===e},a=function(e){if(e&&Number(e)==e)return".";if(this.options.decimal)return this.options.decimal;if(this.locale){var t=Intl.NumberFormat(this.locale).format(1.1);return this.options.decimal=t[1]}return e||(e=this.mask),(t=new RegExp("0{1}(.{1})0+","ig").exec(e))&&t[1]&&1==t[1].length?(this.options.decimal=t[1],t[1]):((t=new RegExp("#{1}(.{1})#+","ig").exec(e))&&t[1]&&1==t[1].length?","===t[1]?this.options.decimal=".":this.options.decimal=",":this.options.decimal="1.1".toLocaleString().substring(1,2),this.options.decimal?this.options.decimal:null)},s=function(e,t){if(""==e)return"";t||(t=a.call(this));var n=(e=(""+e).split(t))[0].match(/[-]+/g);return n=!(!n||!n.length),e[0]=e[0].match(/[0-9]+/g),e[0]?(n&&e[0].unshift("-"),e[0]=e[0].join("")):n&&(e[0]="-"),e[0]||e[1]?(void 0!==e[1]&&(e[1]=e[1].match(/[0-9]+/g),e[1]?e[1]=e[1].join(""):e[1]=""),e):""},d=function(e,t){if(""===e)return"";var n=a.call(this),i=this.options;if(""===(e=s.call(this,e)))return"";var o=null;if(e[0]&&(o="percent"===i.style?parseFloat(e[0])/100:parseFloat(e[0]+".1")),("-"===e[0]||"-00"===e[0])&&!e[1]&&t&&"deleteContentBackward"==t.inputType)return"";var r=new Intl.NumberFormat(this.locale,i).format(o);if(r=r.split(n),"percent"===i.style&&-1!==r[0].indexOf("%")&&(r[0]=r[0].replace("%",""),r[2]="%"),void 0!==r[1]){var l=r[1].replace(/[0-9]*/g,"");l&&(r[2]=l)}return void 0!==e[1]?r[1]=n+e[1]:r[1]="",r.join("")},c=function(e,t){var n=h.call(e);if(n){var i=d.call(this,n,t),o=i.length-n.length,a=p.call(e)+o;h.call(e,i,a,!0)}},u=function(e){var t=s.call(this,e);return t?("-"===t[0]&&(t[0]="-0"),parseFloat(t.join("."))):null},p=function(e,t){if(void 0===e){if("DIV"==this.tagName){var n=0;return(s=window.getSelection())&&0!==s.rangeCount&&((o=(r=s.getRangeAt(0)).cloneRange()).selectNodeContents(this),o.setEnd(r.endContainer,r.endOffset),n=o.toString().length),n}return this.selectionStart}var i=h.call(this);if(t){for(var o=null,a=0;a=o&&(e=o+1)}if(e>i.length&&(e=i.length),e)if("DIV"==this.tagName){var s=window.getSelection(),r=document.createRange();this.childNodes[0]&&(r.setStart(this.childNodes[0],e),s.removeAllRanges(),s.addRange(r))}else this.selectionStart=e,this.selectionEnd=e},h=function(e,t,n){if("DIV"==this.tagName){if(void 0===e)return e=this.innerText,this.value&&this.value.length>e.length&&(e=this.value),e;this.innerText!==e&&(this.innerText=e,t&&p.call(this,t,n))}else{if(void 0===e)return this.value;this.value!==e&&(this.value=e,t&&p.call(this,t,n))}},f=l.weekdays,m=l.weekdaysShort,v=l.months,g=l.monthsShort,y={YEAR:function(e,t){var n=""+(new Date).getFullYear();void 0===this.values[this.index]&&(this.values[this.index]=""),parseInt(e)>=0&&parseInt(e)<=10&&this.values[this.index].length-1)this.values[this.index]+=e;else{for(var n=0,o=0,a=(this.values[this.index]+e).toLowerCase(),s=0;s1)this.values[this.index]+=e;else if(1==o){var r=t[n].length-this.values[this.index].length-1;return this.position+=r,this.values[this.index]=t[n],this.index++,n}}},MMM:function(e){var t=y.FIND.call(this,e,g);void 0!==t&&(this.date[1]=t+1)},MON:function(e){y.MMM.call(this,e)},MMMM:function(e){var t=y.FIND.call(this,e,v);void 0!==t&&(this.date[1]=t+1)},MONTH:function(e){y.MMMM.call(this,e)},MMMMM:function(e){i(this.values[this.index])&&(this.values[this.index]="");for(var t=(this.values[this.index]+e).toLowerCase(),n=0;n1&&parseInt(e)<10?(this.date[1]=this.values[this.index]="0"+e,this.index++):parseInt(e)<2&&(this.values[this.index]=e):(1==this.values[this.index]&&parseInt(e)<3||0==this.values[this.index]&&parseInt(e)>0&&parseInt(e)<10)&&(this.date[1]=this.values[this.index]+=e,this.index++)},M:function(e){var t=!1;if(parseInt(e)>=0&&parseInt(e)<10?i(this.values[this.index])?(this.values[this.index]=e,e>1&&(this.date[1]=this.values[this.index],this.index++)):1==this.values[this.index]&&parseInt(e)<3||0==this.values[this.index]&&parseInt(e)>0?(this.date[1]=this.values[this.index]+=e,this.index++):t=!0:t=!0,1==t){var n=parseInt(this.values[this.index]);n>0&&n<12&&(this.date[1]=this.values[this.index],this.index++,this.position--)}},D:function(e){var t=!1;if(parseInt(e)>=0&&parseInt(e)<10?i(this.values[this.index])?(this.values[this.index]=e,parseInt(e)>3&&(this.date[2]=this.values[this.index],this.index++)):3==this.values[this.index]&&parseInt(e)<2||1==this.values[this.index]||2==this.values[this.index]||0==this.values[this.index]&&parseInt(e)>0?(this.date[2]=this.values[this.index]+=e,this.index++):t=!0:t=!0,1==t){var n=parseInt(this.values[this.index]);n>0&&n<32&&(this.date[2]=this.values[this.index],this.index++,this.position--)}},DD:function(e){i(this.values[this.index])?parseInt(e)>3&&parseInt(e)<10?(this.date[2]=this.values[this.index]="0"+e,this.index++):parseInt(e)<10&&(this.values[this.index]=e):(3==this.values[this.index]&&parseInt(e)<2||(1==this.values[this.index]||2==this.values[this.index])&&parseInt(e)<10||0==this.values[this.index]&&parseInt(e)>0&&parseInt(e)<10)&&(this.date[2]=this.values[this.index]+=e,this.index++)},DDD:function(e){y.FIND.call(this,e,m)},DY:function(e){y.DDD.call(this,e)},DDDD:function(e){y.FIND.call(this,e,f)},DAY:function(e){y.DDDD.call(this,e)},HH12:function(e,t){i(this.values[this.index])?parseInt(e)>1&&parseInt(e)<10?(t&&(e=0+e),this.date[3]=this.values[this.index]=e,this.index++):parseInt(e)<10&&(this.values[this.index]=e):(1==this.values[this.index]&&parseInt(e)<3||this.values[this.index]<1&&parseInt(e)<10)&&(this.date[3]=this.values[this.index]+=e,this.index++)},HH24:function(e,t){parseInt(e)>=0&&parseInt(e)<10&&(null==this.values[this.index]||""==this.values[this.index]?parseInt(e)>2&&parseInt(e)<10?(t&&(e=0+e),this.date[3]=this.values[this.index]=e,this.index++):parseInt(e)<10&&(this.values[this.index]=e):(2==this.values[this.index]&&parseInt(e)<4||this.values[this.index]<2&&parseInt(e)<10)&&(t||"0"!==this.values[this.index]||(this.values[this.index]=""),this.date[3]=this.values[this.index]+=e,this.index++))},HH:function(e){y.HH24.call(this,e,1)},H:function(e){y.HH24.call(this,e,0)},"\\[H\\]":function(e){null==this.values[this.index]&&(this.values[this.index]=""),e.match(/[0-9]/g)?this.date[3]=this.values[this.index]+=e:this.values[this.index].match(/[0-9]/g)&&(this.date[3]=this.values[this.index],this.index++,this.position--)},N60:function(e,t){null==this.values[this.index]||""==this.values[this.index]?parseInt(e)>5&&parseInt(e)<10?(this.date[t]=this.values[this.index]="0"+e,this.index++):parseInt(e)<10&&(this.values[this.index]=e):parseInt(e)<10&&(this.date[t]=this.values[this.index]+=e,this.index++)},MI:function(e){y.N60.call(this,e,4)},SS:function(e){y.N60.call(this,e,5)},"AM/PM":function(e){void 0===this.values[this.index]&&(this.values[this.index]=""),""===this.values[this.index]?e.match(/a/i)&&this.date[3]<13?this.values[this.index]+="A":e.match(/p/i)&&(this.values[this.index]+="P"):"A"!==this.values[this.index]&&"P"!==this.values[this.index]||(this.values[this.index]+="M",this.index++)},WD:function(e){void 0===this.values[this.index]&&(this.values[this.index]=""),parseInt(e)>=0&&parseInt(e)<7&&(this.values[this.index]=e),1==this.values[this.index].length&&this.index++},"0{1}(.{1}0+)?":function(e){var t=a.call(this),n=!1;i(this.values[this.index])?this.values[this.index]="":"-"==this.values[this.index]&&(n=!0);var o=s.call(this,this.values[this.index],t);o&&(this.values[this.index]=o.join(t)),parseInt(e)>=0&&parseInt(e)<10?("0"==this.values[this.index]&&e>0?this.values[this.index]="":"-0"==this.values[this.index]&&e>0&&(this.values[this.index]="-"),("0"!=this.values[this.index]&&"-0"!=this.values[this.index]||e==t)&&(this.values[this.index]+=e)):t&&e==t?-1==this.values[this.index].indexOf(t)&&(this.values[this.index]||(this.values[this.index]="0"),this.values[this.index]+=e):"-"==e&&(n=!0),!0===n&&"-"!==this.values[this.index][0]&&(this.values[this.index]="-"+this.values[this.index])},"0{1}(.{1}0+)?%":function(e){y["0{1}(.{1}0+)?"].call(this,e),this.values[this.index].match(/[\-0-9]/g)?this.values[this.index]&&-1==this.values[this.index].indexOf("%")&&(this.values[this.index]+="%"):this.values[this.index]=""},"#(.{1})##0?(.{1}0+)?( ?;(.*)?)?":function(e){y["0{1}(.{1}0+)?"].call(this,e);var t=a.call(this),n=this.tokens[this.index].substr(1,1),i="-"===this.values[this.index][0],o=s.call(this,this.values[this.index],t);if(""!==o){var r=o[0].match(/[0-9]/g);if(r){for(var l=[],d=0,c=(r=r.join("")).length-1;c>=0;c--)l.push(r[c]),++d%3||l.push(n);l=l.reverse(),o[0]=l.join(""),o[0].substr(0,1)==n&&(o[0]=o[0].substr(1))}else o[0]="";this.values[this.index]=o.join(t),i&&(this.values[this.index]="-"+this.values[this.index])}},0:function(e){e.match(/[0-9]/g)&&(this.values[this.index]=e,this.index++)},"[0-9a-zA-Z$]+":function(e){i(this.values[this.index])&&(this.values[this.index]="");var t=this.tokens[this.index];t[this.values[this.index].length]==e?(this.values[this.index]+=e,this.values[this.index]==t&&this.index++):(this.values[this.index]=t,this.index++,e.match(/[\-0-9]/g)&&this.position--)},A:function(e){e.match(/[a-zA-Z]/gi)&&(this.values[this.index]=e,this.index++)},".":function(e){y["[0-9a-zA-Z$]+"].call(this,e)},"@":function(e){i(this.values[this.index])&&(this.values[this.index]=""),this.values[this.index]+=e}},b=function(t){if("general"==this.type)var n=[].concat(e.general);else n=[].concat(e.currency,e.datetime,e.percentage,e.numeric,e.text,e.general);var i=new RegExp(n.join("|"),"gi");return t.match(i)},x=function(t){if(this.type)n="text"==this.type?["text"]:"general"==this.type?["general"]:"datetime"==this.type?["numeric","datetime","general"]:["currency","percentage","numeric","general"];else var n=Object.keys(e);for(var i=0;i=0||t[n-2]&&t[n-2].indexOf("H")>=0||t[n+1]&&t[n+1].indexOf("S")>=0||t[n+2]&&t[n+2].indexOf("S")>=0)&&(t[n]="MI");return t},L=function(e){var t=x.call(this,e);if(t)var n=t.type;if(n){for(var i=0,a=b.call(this,e),s=0;s1&&(n="general")}return n},j=function(){"function"==typeof y[this.methods[this.index]]?(y[this.methods[this.index]].call(this,this.value[this.position]),this.position++):(this.values[this.index]=this.tokens[this.index],this.index++)},E=function(e,n,i){var s=null,l={input:null,value:null,options:{},values:[],index:0,position:0,date:[0,0,0,0,0,0],number:0};if("object"==typeof e){if(l.input=e.target,l.value=h.call(e.target),l.caret=p.call(e.target),(s=e.target.getAttribute("data-mask"))&&(l.mask=s),(s=e.target.getAttribute("data-type"))&&(l.type=s),e.target.mask?(e.target.mask.options&&(l.options=e.target.mask.options),e.target.mask.locale&&(l.locale=e.target.mask.locale)):(s=e.target.getAttribute("data-locale"))&&(l.locale=s,l.mask&&(l.options.style=l.mask)),e.target.attributes&&e.target.attributes.length)for(var f=0;f0)var C=l.caret+s;else C=l.caret;h.call(l.input,y,C,E)}}if(l.input){var T=null;if(o(l.type)){let e=h.call(l.input);l.number=u.call(l,e),T="percentage"==l.type&&-1!==e.indexOf("%")?l.number/100:l.number}else"datetime"==l.type&&(T=t.call(l),l.date[0]&&l.date[1]&&l.date[2]&&l.input.setAttribute("data-completed",!0));T&&l.input.setAttribute("data-value",T)}if(void 0!==y)return i?l:y}};return E.getType=L,E.prepare=function(e,t){return t||(t={}),b.call(t,e)},E.apply=function(e){var t=h.call(e.target);1==e.key.length&&(t+=e.key),h.call(e.target,E(t,e.target.getAttribute("data-mask")))},E.run=function(e,t,n){return E(e,{mask:t,decimal:n})},E.extract=function(e,t,o){if(i(e))return e;if("object"!=typeof t)return e;if((t=Object.assign({},t)).options||(t.options={}),!t.mask&&t.format&&(t.mask=t.format),t.mask){if(-1!==t.mask.indexOf(";")){var s=t.mask.split(";");t.mask=s[0]}t.mask=t.mask.replace(new RegExp(/\[h]/),"|h|"),t.mask=t.mask.replace(new RegExp(/\[.*?\]/),""),t.mask=t.mask.replace(new RegExp(/\|h\|/),"[h]")}a.call(t,t.mask);var l=null,d=null;if("percent"==t.type||"percent"==t.options.style?l="percentage":t.mask&&(l=L.call(t,t.mask)),"general"===l){var c=E(e,t,!0);d=e}else"datetime"===l?(e instanceof Date&&(e=E.getDateString(e,t.mask)),c=E(e,t,!0),d=r.isNumeric(e)?e:n.call(c)):(d=u.call(t,e),"percentage"===l&&-1!==e.indexOf("%")&&(d/=100),c=t);return c.value=d,!c.type&&l&&(c.type=l),o?c:d},E.render=function(e,t,n){if(i(e))return e;if("object"!=typeof t)return e;if((t=Object.assign({},t)).options||(t.options={}),!t.mask&&t.format&&(t.mask=t.format),t.mask){if(-1!==t.mask.indexOf(";")){var o=t.mask.split(";");n||(o[0]=o[0].replace(new RegExp(/_\)/g),""),o[0]=o[0].replace(new RegExp(/_\(/g),"")),t.mask=o[0]}t.mask=t.mask.replace(new RegExp(/\[h]/),"|h|"),t.mask=t.mask.replace(new RegExp(/\[.*?\]/),""),t.mask=t.mask.replace(new RegExp(/\|h\|/),"[h]")}var s=null;"percent"==t.type||"percent"==t.options.style?s="percentage":t.mask?s=L.call(t,t.mask):e instanceof Date&&(s="datetime");var r=!1;if("datetime"==s||"calendar"==t.type)(o=E.getDateString(e,t.mask))&&(e=o),t.mask&&n&&(r=!0);else if("percentage"==s&&(e*=100),"number"==typeof e){if(o=null,t.mask&&n&&-1===(""+e).indexOf("e")){var l=a.call(t,t.mask);-1!==t.mask.indexOf(l)?(l=(l=""+(l=t.mask.split(l))[1].match(/[0-9]+/g)).length,o=e.toFixed(l)):o=e.toFixed(0)}else if(t.locale&&n){if(l=(""+e).split("."),t.options){void 0===l[1]&&(l[1]="");var d=l[1].length;if(t.options.minimumFractionDigits>d)for(var c=0;c0)for(c=0;c3)for(e=""+e;e.length0&&Number(e)==e&&(n.values.join("")!==n.value||"numeric"==n.type)){var i=new Date(Math.round(86400*(e-25569)*1e3));return i.getFullYear()+"-"+r.two(i.getMonth())+"-"+r.two(i.getDate())+" 00:00:00"}var o=!1;return n.values.length===n.tokens.length&&n.values[n.values.length-1].length>=n.tokens[n.tokens.length-1].length&&(o=!0),n.date[0]&&n.date[1]&&(n.date[2]||o)?(n.date[2]||(n.date[2]=1),n.date[0]+"-"+r.two(n.date[1])+"-"+r.two(n.date[2])+" "+r.two(n.date[3])+":"+r.two(n.date[4])+":"+r.two(n.date[5])):""},E.getDateString=function(e,t){if(t||(t={}),t&&"object"==typeof t)var n=t.format;else n=t;if(n||(n="YYYY-MM-DD"),n.indexOf("[h]")>=0){var i=0;if(e&&r.isNumeric(e)&&(i=parseFloat(24*Number(e)),n.indexOf("mm")>=0)){if((p=(""+i).split("."))[1]){var o=60*parseFloat("0."+p[1]);o=parseFloat(o.toFixed(2))}else o=0;i=parseInt(p[0])+":"+r.two(o)}return i}e instanceof Date?e=l.now(e):e&&r.isNumeric(e)&&(e=l.numToDate(e));for(var a=new RegExp(["DAY","WD","DDDD","DDD","DD","D","Q","HH24","HH12","HH","H","AM/PM","MI","SS","MS","YYYY","YYY","YY","Y","MONTH","MON","MMMMM","MMMM","MMM","MM","M","."].join("|"),"gi"),s=n.match(a),d=0;d=0||s[d-2]&&s[d-2].toUpperCase().indexOf("H")>=0||s[d+1]&&s[d+1].toUpperCase().indexOf("S")>=0||s[d+2]&&s[d+2].toUpperCase().indexOf("S")>=0)&&(s[d]="mi");var c={tokens:s};if(e){var u=-1!==(o=""+e).indexOf("T")?"T":" ",p=0,h=0,f=0;if((o=o.split(u))[1]&&(h=(p=o[1].split(":"))[1]?p[1]:0,f=p[2]?p[2]:0,p=p[0]?p[0]:0),(o=o[0].split("-"))[0]&&o[1]&&o[2]&&o[0]>0&&o[1]>0&&o[1]<13&&o[2]>0&&o[2]<32){c.data=[o[0],o[1],o[2],p,h,f],c.value=[];var m=new Date(c.data[0],c.data[1]-1,c.data[2],c.data[3],c.data[4],c.data[5]),v=function(e){var t=this.tokens[e],n=t.toUpperCase(),i=null;"YYYY"===n?i=this.data[0]:"YYY"===n?i=this.data[0].substring(1,4):"YY"===n?i=this.data[0].substring(2,4):"Y"===n?i=this.data[0].substring(3,4):"MON"===t?i=l.months[m.getMonth()].substr(0,3).toUpperCase():"mon"===t?i=l.months[m.getMonth()].substr(0,3).toLowerCase():"MONTH"===t?i=l.months[m.getMonth()].toUpperCase():"month"===t?i=l.months[m.getMonth()].toLowerCase():"MMMMM"===n?i=l.months[m.getMonth()].substr(0,1):"MMMM"===n||"Month"===t?i=l.months[m.getMonth()]:"MMM"===n||"Mon"==t?i=l.months[m.getMonth()].substr(0,3):"MM"===n?i=r.two(this.data[1]):"M"===n?i=m.getMonth()+1:"DAY"===t?i=l.weekdays[m.getDay()].toUpperCase():"day"===t?i=l.weekdays[m.getDay()].toLowerCase():"DDDD"===n||"Day"==t?i=l.weekdays[m.getDay()]:"DDD"===n?i=l.weekdays[m.getDay()].substr(0,3):"DD"===n?i=r.two(this.data[2]):"D"===n?i=parseInt(this.data[2]):"Q"===n?i=Math.floor((m.getMonth()+3)/3):"HH24"===n||"HH"===n?((i=this.data[3])>12&&-1!==this.tokens.indexOf("am/pm")&&(i-=12),i=r.two(i)):"HH12"===n?i=this.data[3]>12?r.two(this.data[3]-12):r.two(this.data[3]):"H"===n?(i=this.data[3])>12&&-1!==this.tokens.indexOf("am/pm")&&(i-=12,i=r.two(i)):"MI"===n?i=r.two(this.data[4]):"SS"===n?i=r.two(this.data[5]):"MS"===n?i=m.getMilliseconds():"AM/PM"===n?i=this.data[3]>=12?"PM":"AM":"WD"===n&&(i=l.weekdays[m.getDay()]),this.value[e]=null===i?this.tokens[e]:i};for(d=0;d0&&(i.options.value=e.numToDate(i.options.value),i.options.dataType="numeric"),p.innerHTML=i.options.textReset,h.innerHTML=i.options.textDone,E.innerHTML=i.options.textUpdate,t.setAttribute("data-mask",i.options.format.toLowerCase()),!i.options.value&&i.options.today)var d=e.now();else d=i.options.value;return d&&(i.options.value=null,i.setValue(d)),i},open:function(n){if(!d.classList.contains("jcalendar-focus")&&!d.classList.contains("jcalendar-inline")){if(e.current=i,u(i,!0),i.getDays(),"year-month-picker"==i.options.type&&i.getMonths(),i.options.time&&(C.value=i.date[3],T.value=i.date[4]),d.classList.add("jcalendar-focus"),r.getWindowWidth()<800||i.options.fullscreen)d.classList.add("jcalendar-fullsize"),v.slideBottom(m,1);else{d.classList.remove("jcalendar-fullsize");var o=t.getBoundingClientRect(),a=m.getBoundingClientRect();if(i.options.position)f.style.position="fixed",window.innerHeight11?(i.date[0]=parseInt(i.date[0])+1,i.date[1]=1):i.date[1]=parseInt(i.date[1])+1,i.getDays())},setToday:function(){var e=(new Date).toISOString().substr(0,10);return i.setValue(e),e},setValue:function(n){n||(n=""+n);var o=n,a=i.options.value;if(a!=o){if(o){i.setLabel(o,i.options),(r=o.split(" "))[1]||(r[1]="00:00:00");var s=r[1].split(":"),r=r[0].split("-"),l=parseInt(r[0]),d=parseInt(r[1]),u=parseInt(r[2]),p=parseInt(s[0]),h=parseInt(s[1]);i.date=[l,d,u,p,h,0],n=i.setLabel(o,i.options);var f=e.now(new Date(l,d-1,u),!0);if(i.options.validRange){if(!i.options.validRange[0]||f>=i.options.validRange[0])var m=!0;else m=!1;if(!i.options.validRange[1]||f<=i.options.validRange[1])var v=!0;else v=!1;m&&v?(t.classList.remove("jcalendar_warning"),t.title=""):(t.classList.add("jcalendar_warning"),t.title=c.translate("Date outside the valid range"))}else t.classList.remove("jcalendar_warning"),t.title=""}else{i.date=null;n="";t.classList.remove("jcalendar_warning"),t.title=""}i.options.value=o,"function"==typeof i.options.onchange&&i.options.onchange(t,o,a),t.value!=n&&(t.value=n,"function"==typeof t.oninput&&t.oninput({type:"input",target:t,value:t.value}))}i.getDays(),"year-month-picker"==i.options.type&&i.getMonths()},getValue:function(){return i.date?i.options.time?r.two(i.date[0])+"-"+r.two(i.date[1])+"-"+r.two(i.date[2])+" "+r.two(i.date[3])+":"+r.two(i.date[4])+":"+r.two(0):r.two(i.date[0])+"-"+r.two(i.date[1])+"-"+r.two(i.date[2])+" "+r.two(0)+":"+r.two(0)+":"+r.two(0):""},update:function(e,t){if(e.classList.contains("jcalendar-disabled"));else{var n=d.querySelector(".jcalendar-selected");n&&n.classList.remove("jcalendar-selected"),e.classList.add("jcalendar-selected"),e.classList.contains("jcalendar-set-month")?(i.date[1]=t,i.date[2]=1):i.date[2]=e.innerText,i.options.time?(i.date[3]=C.value,i.date[4]=T.value):i.close(null,!0)}s()},reset:function(){i.setValue(""),i.date=null,i.close(!1,!1)},getDays:function(){i.options.mode="days";var t=new Date,n=i.date&&r.isNumeric(i.date[0])?i.date[0]:parseInt(t.getFullYear()),o=i.date&&r.isNumeric(i.date[1])?i.date[1]:parseInt(t.getMonth())+1,a=i.date&&r.isNumeric(i.date[2])?i.date[2]:parseInt(t.getDate()),l=i.date&&r.isNumeric(i.date[3])?i.date[3]:parseInt(t.getHours()),d=i.date&&r.isNumeric(i.date[4])?i.date[4]:parseInt(t.getMinutes());i.date=[n,o,a,l,d,0],g.innerHTML=n,y.innerHTML=i.options.months[o-1];var c=t.getMonth()==o-1&&t.getFullYear()==n,u=t.getDate(),p=(t=new Date(n,o,0,0,0)).getDate(),h=(t=new Date(n,o-1,0,0,0)).getDay()+1;h-=m=i.options.startingDay||0,x.innerHTML="",(w=document.createElement("tr")).setAttribute("align","center"),x.appendChild(w);for(var f=0;f<7;f++)(j=document.createElement("td")).classList.add("jcalendar-weekday"),j.innerHTML=i.options.weekdays[m].substr(0,1),w.appendChild(j),++m>6&&(m=0);for(var m=0,v=0,b=0;b<6;b++){var w;for((w=document.createElement("tr")).setAttribute("align","center"),w.style.height="34px",f=0;f<7;f++){var j;if((j=document.createElement("td")).classList.add("jcalendar-set-day"),m>=h&&m=i.options.validRange[0])var C=!0;else C=!1;if(!i.options.validRange[1]||E<=i.options.validRange[1])var T=!0;else T=!1;C&&T||j.classList.add("jcalendar-disabled")}}w.appendChild(j),m++}x.appendChild(w)}i.options.time?L.style.display="":L.style.display="none",s()},getMonths:function(){i.options.mode="months";var e=i.options.months,t=(i.options.value,new Date),n=parseInt(t.getFullYear()),o=parseInt(t.getMonth())+1,a=i.date&&r.isNumeric(i.date[0])?i.date[0]:n,l=i.date&&r.isNumeric(i.date[1])?i.date[1]:o;g.innerHTML=i.date[0],y.innerHTML=e[l-1];var d=document.createElement("table");d.setAttribute("width","100%");for(var c=null,u=0;u<12;u++){u%4||((c=document.createElement("tr")).setAttribute("align","center"),d.appendChild(c));var p=document.createElement("td");if(p.classList.add("jcalendar-set-month"),p.setAttribute("data-value",u+1),p.innerText=e[u],i.options.validRange){var h=a+"-"+r.two(u+1);if(!i.options.validRange[0]||h>=i.options.validRange[0].substr(0,7))var f=!0;else f=!1;if(!i.options.validRange[1]||h<=i.options.validRange[1].substr(0,7))var m=!0;else m=!1;f&&m||p.classList.add("jcalendar-disabled")}u+1==l&&p.classList.add("jcalendar-selected"),n==a&&u+1==o&&(p.style.fontWeight="bold"),c.appendChild(p)}x.innerHTML='',x.children[0].children[0].appendChild(d),s()},getYears:function(){i.options.mode="years";for(var e=new Date,t=e.getFullYear(),n=i.date&&r.isNumeric(i.date[0])?i.date[0]:parseInt(e.getFullYear()),o=[],a=0;a<25;a++)o[a]=parseInt(i.date[0])+(a-12);var l=document.createElement("table");for(l.setAttribute("width","100%"),a=0;a<25;a++){if(!(a%5)){var d=document.createElement("tr");d.setAttribute("align","center"),l.appendChild(d)}var c=document.createElement("td");c.classList.add("jcalendar-set-year"),c.innerText=o[a],n==o[a]&&c.classList.add("jcalendar-selected"),t==o[a]&&(c.style.fontWeight="bold"),d.appendChild(c)}x.innerHTML='',x.firstChild.firstChild.appendChild(l),s()},setLabel:function(t,n){return e.getDateString(t,n)},fromFormatted:function(t,n){return e.extractDateFromString(t,n)}},o=function(e){if(r.findElement(e.target,"jcalendar-container")){var t=e.target.className;if("jcalendar-prev"==t)i.prev();else if("jcalendar-next"==t)i.next();else if("jcalendar-month"==t)i.getMonths();else if("jcalendar-year"==t)i.getYears();else if("jcalendar-set-year"==t)i.date[0]=e.target.innerText,"year-month-picker"==i.options.type?i.getMonths():i.getDays();else if(e.target.classList.contains("jcalendar-set-month")){var n=parseInt(e.target.getAttribute("data-value"));"year-month-picker"==i.options.type?i.update(e.target,n):(i.date[1]=n,i.getDays())}else"jcalendar-confirm"==t||"jcalendar-update"==t||"jcalendar-close"==t?i.close(null,!0):"jcalendar-backdrop"==t?i.close(!1,!1):"jcalendar-reset"==t?i.reset():e.target.classList.contains("jcalendar-set-day")&&e.target.innerText&&i.update(e.target)}else i.close(!1,!1)},a=function(t){if(t.target.value&&t.target.value.length>3){var n=e.extractDateFromString(t.target.value,i.options.format);n&&i.setValue(n)}},s=function(){var e=d.querySelector(".jcalendar-selected");e&&e.classList.contains("jcalendar-disabled")?(E.setAttribute("disabled","disabled"),C.setAttribute("disabled","disabled"),T.setAttribute("disabled","disabled")):(E.removeAttribute("disabled"),C.removeAttribute("disabled"),T.removeAttribute("disabled")),"function"==typeof i.options.onupdate&&i.options.onupdate(t,i.getValue())},d=null,p=null,h=null,f=null,m=null,g=null,y=null,b=null,x=null,w=null,L=null,j=null,E=null,C=null,T=null;return function(){"INPUT"==t.tagName&&t.value&&(n.value=t.value),(p=document.createElement("div")).className="jcalendar-reset",(h=document.createElement("div")).className="jcalendar-confirm",(w=document.createElement("div")).className="jcalendar-controls",w.style.borderBottom="1px solid #ddd",w.appendChild(p),w.appendChild(h),(f=document.createElement("div")).className="jcalendar-container",(m=document.createElement("div")).className="jcalendar-content",f.appendChild(m),"DIV"==t.tagName?(d=t).classList.add("jcalendar-inline"):(m.appendChild(w),(d=document.createElement("div")).className="jcalendar"),d.classList.add("jcalendar-container"),d.appendChild(f);var s=document.createElement("div");s.className="jcalendar-table",m.appendChild(s);var l=document.createElement("td");l.setAttribute("colspan","2"),l.className="jcalendar-prev",(g=document.createElement("span")).className="jcalendar-year",(y=document.createElement("span")).className="jcalendar-month";var c=document.createElement("td");c.className="jcalendar-header",c.setAttribute("colspan","3"),c.appendChild(y),c.appendChild(g);var u=document.createElement("td");u.setAttribute("colspan","2"),u.className="jcalendar-next";var k=document.createElement("thead"),A=document.createElement("tr");A.appendChild(l),A.appendChild(c),A.appendChild(u),k.appendChild(A),b=document.createElement("table"),x=document.createElement("tbody"),b.setAttribute("cellpadding","0"),b.setAttribute("cellspacing","0"),b.appendChild(k),b.appendChild(x),s.appendChild(b),(C=document.createElement("select")).className="jcalendar-select",C.onchange=function(){i.date[3]=this.value,"function"==typeof i.options.onupdate&&i.options.onupdate(t,i.getValue())};for(var M=0;M<24;M++)(D=document.createElement("option")).value=M,D.innerHTML=r.two(M),C.appendChild(D);for((T=document.createElement("select")).className="jcalendar-select",T.onchange=function(){i.date[4]=this.value,"function"==typeof i.options.onupdate&&i.options.onupdate(t,i.getValue())},M=0;M<60;M++){var D;(D=document.createElement("option")).value=M,D.innerHTML=r.two(M),T.appendChild(D)}var O=document.createElement("div");O.className="jcalendar-controls",(L=document.createElement("div")).className="jcalendar-time",L.style.maxWidth="140px",L.appendChild(C),L.appendChild(T),(E=document.createElement("button")).setAttribute("type","button"),E.className="jcalendar-update",(j=document.createElement("div")).style.flexGrow="10",j.appendChild(E),O.appendChild(L),"INPUT"==t.tagName&&O.appendChild(j),m.appendChild(O);var N=document.createElement("div");N.className="jcalendar-backdrop",d.appendChild(N),t.addEventListener("keyup",a),d.addEventListener("swipeleft",(function(e){v.slideLeft(b,0,(function(){i.next(),v.slideRight(b,1)})),e.preventDefault(),e.stopPropagation()})),d.addEventListener("swiperight",(function(e){v.slideRight(b,0,(function(){i.prev(),v.slideLeft(b,1)})),e.preventDefault(),e.stopPropagation()})),"ontouchend"in document.documentElement==1?(d.addEventListener("touchend",o),t.addEventListener("touchend",i.open)):(d.addEventListener("mouseup",o),t.addEventListener("mouseup",i.open)),e.hasEvents||(e.hasEvents=!0,document.addEventListener("keydown",e.keydown)),i.setOptions(n),"INPUT"==t.tagName?(t.parentNode.insertBefore(d,t.nextSibling),t.setAttribute("autocomplete","off"),t.classList.add("jcalendar-input"),t.value=i.setLabel(i.getValue(),i.options)):(i.getDays(),i.options.time&&(C.value=i.date[3],T.value=i.date[4])),1==i.options.opened&&i.open(),0==i.options.controls&&f.classList.add("jcalendar-hide-controls"),t.change=i.setValue,t.val=function(e){if(void 0===e)return i.getValue();i.setValue(e)},t.calendar=d.calendar=i}(),i};return e.keydown=function(t){var n=null;(n=e.current)&&(13==t.which?n.close(!1,!0):27==t.which&&n.close(!1,!1))},e.prettify=function(e,t){t||(t={justNow:"Just now",xMinutesAgo:"{0}m ago",xHoursAgo:"{0}h ago",xDaysAgo:"{0}d ago",xWeeksAgo:"{0}w ago",xMonthsAgo:"{0} mon ago",xYearsAgo:"{0}y ago"}),-1===e.indexOf("GMT")&&-1===e.indexOf("Z")&&(e+=" GMT");var n=new Date,i=new Date(e),o=parseInt((n-i)/1e3/60);if(String.prototype.format=function(e){return this.replace("{0}",e)},0==o)var a=t.justNow;else a=o<90?t.xMinutesAgo.format(o):o<1440?t.xHoursAgo.format(Math.round(o/60)):o<20160?t.xDaysAgo.format(Math.round(o/1440)):o<43200?t.xWeeksAgo.format(Math.round(o/10080)):o<1036800?t.xMonthsAgo.format(Math.round(o/43200)):t.xYearsAgo.format(Math.round(o/525600));return a},e.prettifyAll=function(){for(var t=document.querySelectorAll(".prettydate"),n=0;n=n.headers.scrollWidth-n.headers.offsetWidth?s.classList.add("disabled"):s.classList.remove("disabled"),n.headers.scrollWidth<=n.headers.offsetWidth?(a.style.display="none",s.style.display="none"):(a.style.display="",s.style.display="")};if(n.setBorder=l,n.open=function(t){for(var i=null,o=0;o=s||d(a-1)}},n.selectIndex=function(e){var t=Array.prototype.indexOf.call(n.headers.children,e);return t>=0&&n.open(t),t},n.rename=function(e,t){t||(t=prompt("New title",n.headers.children[e].innerText)),n.headers.children[e].innerText=t,n.open(e)},n.create=function(t,i){if("function"==typeof n.options.onbeforecreate){var o=n.options.onbeforecreate(e);if(!1===o)return!1;t=o}var a=n.appendElement(t);return"function"==typeof n.options.oncreate&&n.options.oncreate(e,a),l(),a},n.remove=function(e){return n.deleteElement(e)},n.nextNumber=function(){for(var e=0,t=0;te&&(e=parseInt(i))}return e?e++:e=1,e},n.deleteElement=function(t){if(!n.headers.children[t])return!1;n.headers.removeChild(n.headers.children[t]),n.content.removeChild(n.content.children[t]),n.open(0),"function"==typeof n.options.ondelete&&n.options.ondelete(e,t)},n.appendElement=function(e,t){if(e||(e=prompt("Title?","")),e){var i=document.createElement("div");n.content.appendChild(i);var o=document.createElement("div");return o.innerHTML=e,o.content=i,n.headers.insertBefore(o,n.headers.lastChild),n.options.allowChangePosition&&o.setAttribute("draggable","true"),n.selectIndex(o),"function"==typeof t&&t(i,o),i}},n.getActive=function(){for(var e=0;et?n.content.insertBefore(n.content.children[e],n.content.children[t]):n.content.insertBefore(n.content.children[e],n.content.children[t].nextSibling),n.open(t),"function"==typeof n.options.onchangeposition&&n.options.onchangeposition(n.headers,e,t)},n.move=function(e,t){e>t?n.headers.insertBefore(n.headers.children[e],n.headers.children[t]):n.headers.insertBefore(n.headers.children[e],n.headers.children[t].nextSibling),n.updatePosition(e,t)},n.setBorder=l,n.init=function(){e.innerHTML="",n.headers=document.createElement("div"),n.content=document.createElement("div"),n.headers.classList.add("jtabs-headers"),n.content.classList.add("jtabs-content"),n.options.palette?e.classList.add("jtabs-modern"):e.classList.remove("jtabs-modern"),n.options.padding&&(n.content.style.padding=parseInt(n.options.padding)+"px");var t=document.createElement("div");t.className="jtabs-headers-container",t.appendChild(n.headers),n.options.maxWidth&&(t.style.maxWidth=parseInt(n.options.maxWidth)+"px");var i=document.createElement("div");if(i.className="jtabs-controls",i.setAttribute("draggable","false"),t.appendChild(i),"bottom"==n.options.position?(e.appendChild(n.content),e.appendChild(t)):(e.appendChild(t),e.appendChild(n.content)),1==n.options.allowCreate){var o=document.createElement("div");o.className="jtabs-add",o.onclick=function(){n.create()},i.appendChild(o)}(a=document.createElement("div")).className="jtabs-prev",a.onclick=function(){d(n.headers.scrollLeft-n.headers.offsetWidth)},i.appendChild(a),(s=document.createElement("div")).className="jtabs-next",s.onclick=function(){d(n.headers.scrollLeft+n.headers.offsetWidth)},i.appendChild(s);for(var l=0;ls&&(a.style.marginLeft=-1*(t.left+t.width-(s-20))+"px"),t.top+t.height>l&&(a.style.marginTop=-1*(t.top+t.height-(l-20))+"px")),"function"==typeof n.options.onopen&&n.options.onopen(e,n),c.setBorder(c.getActive()),n.options.value){var d=m(n.options.value);T.forEach((function(e,t){e.value=d[t],e.dispatchEvent(new Event("input"))}))}}},n.close=function(t){return i.classList.contains("jcolor-focus")&&(i.classList.remove("jcolor-focus"),o.style.display="",t||"function"!=typeof n.options.onclose||n.options.onclose(e,n),u(n,!1)),n.options.value},n.setValue=function(t){t||(t=""),t!=n.options.value&&(n.options.value=t,C=t,n.select(t),"function"==typeof n.options.onchange&&n.options.onchange(e,t,n),e.value!=n.options.value&&(e.value=n.options.value,"INPUT"===e.tagName&&(e.style.color=e.value,e.style.backgroundColor=e.value),"function"==typeof e.oninput&&e.oninput({type:"input",target:e,value:e.value})),1==n.options.closeOnChange&&n.close())},n.getValue=function(){return n.options.value};var p=function(e){var t=e.toString(16);return 1===t.length?"0"+t:t},h=function(e,t,n){return"#"+p(e)+p(t)+p(n)},f=function(e){return parseInt("0x"+e)},m=function(e){return[f(e.substr(1,2)),f(e.substr(3,2)),f(e.substr(5,2))]},g=function(){var e=document.createElement("div");e.className="jcolor-grid",n.values=[];var t=document.createElement("table");t.setAttribute("cellpadding","7"),t.setAttribute("cellspacing","0");for(var i=0;ia.width&&(s=a.width),r>a.height&&(r=a.height),t.style.left=s+"px",t.style.top=r+"px";var l=w.getImageData(s,r,1,1).data;C=h(l[0],l[1],l[2])}};return e.addEventListener("mousedown",(function(e){i(e.buttons,e.clientX,e.clientY)})),e.addEventListener("mousemove",(function(e){i(e.buttons,e.clientX,e.clientY)})),e.addEventListener("touchmove",(function(e){i(1,e.changedTouches[0].clientX,e.changedTouches[0].clientY)})),e},C="",T=[],k=function(){var e=document.createElement("div");e.className="jcolor-sliders";var t=document.createElement("div"),n=function(e){var n=document.createElement("div");n.className="jcolor-sliders-input-container";var i=document.createElement("label");i.innerText=e;var o=document.createElement("div");o.className="jcolor-sliders-input-subcontainer";var a=document.createElement("input");a.type="range",a.min=0,a.max=255,a.value=0,n.appendChild(i),o.appendChild(a);var s=document.createElement("div");return s.innerText=a.value,a.addEventListener("input",(function(){s.innerText=a.value})),o.appendChild(s),n.appendChild(o),t.appendChild(n),a};T=[n("Red"),n("Green"),n("Blue")],e.appendChild(t);var i=document.createElement("div");i.className="jcolor-sliders-final-color";var o=document.createElement("div");return o.style.visibility="hidden",o.innerText="a",i.appendChild(o),T.forEach((function(e){e.addEventListener("input",(function(){var e;e=h(parseInt(T[0].value),parseInt(T[1].value),parseInt(T[2].value)),o.innerText=e,o.style.color=e,o.style.removeProperty("visibility"),C=e,function(){if(""!==C)for(var e=0;e0&&n.setValue(C),n.close()):e.target.classList.contains("jcolor-backdrop")?n.close():n.open()})),e.addEventListener("mouseup",(function(e){n.open()})),window.addEventListener("resize",(function(){i.classList.contains("jcolor-focus")&&1==c.getActive()&&L()})),1==n.options.opened&&n.open(),e.change=n.setValue,e.val=function(e){if(void 0===e)return n.getValue();n.setValue(e)},e.color=n,i.color=n}(),n}var L=function(){var e=function(t,n){var i={type:"contextmenu",options:{}},o={items:null,onclick:null};for(var a in o)n&&n.hasOwnProperty(a)?i.options[a]=n[a]:i.options[a]=o[a];function s(e){if(!e.type||"line"!=e.type&&"divisor"!=e.type){d=document.createElement("div");var t=document.createElement("a");if(t.innerHTML=e.title,e.tooltip&&d.setAttribute("title",e.tooltip),e.icon&&d.setAttribute("data-icon",e.icon),e.id&&(d.id=e.id),e.disabled?d.className="jcontextmenu-disabled":e.onclick&&(d.method=e.onclick,d.addEventListener("mousedown",(function(e){e.preventDefault()})),d.addEventListener("mouseup",(function(e){this.method(this,e)}))),d.appendChild(t),e.submenu){var n=document.createElement("span");n.innerHTML="►",d.appendChild(n),d.classList.add("jcontexthassubmenu");var i=document.createElement("div");i.classList.add("jcontextmenu"),i.setAttribute("tabindex","900");for(var o=e.submenu,a=0;a0||t.children.length){if(n.target)if(n.changedTouches&&n.changedTouches[0])a=n.changedTouches[0].clientX,s=n.changedTouches[0].clientY;else var a=n.clientX,s=n.clientY;else a=n.x,s=n.y;var r=t.getBoundingClientRect();if(window.innerHeight0?t.style.left=a-r.width+"px":t.style.left="10px":t.style.left=a+"px"}},i.isOpened=function(){return!!t.classList.contains("jcontextmenu-focus")},i.close=function(){t.classList.contains("jcontextmenu-focus")&&t.classList.remove("jcontextmenu-focus"),u(i,!1)},i.create=function(e){t.innerHTML="";var n=function(){var e=document.createElement("div");e.classList.add("header"),e.addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation()}));var t=document.createElement("a");t.classList.add("title"),t.innerHTML=c.translate("Menu"),e.appendChild(t);var n=document.createElement("a");return n.classList.add("close"),n.innerHTML=c.translate("close"),n.addEventListener("click",(function(e){i.close()})),e.appendChild(n),e}();t.appendChild(n);for(var o=0;o0)for(o=0;o0&&x.appendChild(r)}if(t.length)for(o=0;o200&&(l=200),t=0;tn&&(o=i.items[s[r].indexValue])&&(a=o.element.innerText[0])&&e==(a=a.toLowerCase())){t=s[r].indexValue;break}i.setCursor(t)}}}else if(null==i.currentIndex||null==i.currentIndex)i.first();else{var l=i.items[i.currentIndex].element,d=l.nextElementSibling;d?(d.classList.contains("jdropdown-group")&&(d=d.lastChild.firstChild),t=d.indexValue):l.parentNode.classList.contains("jdropdown-group-items")&&((d=l.parentNode.parentNode.nextElementSibling)&&(d.classList.contains("jdropdown-group")?d=d.lastChild.firstChild:d.classList.contains("jdropdown-item")?t=d.indexValue:d=null),d&&(t=d.indexValue)),null!==t&&i.setCursor(t)}},i.prev=function(){var e=null;if(null===i.currentIndex)i.first();else{var t=i.items[i.currentIndex].element,n=t.previousElementSibling;n?(n.classList.contains("jdropdown-group")&&(n=n.lastChild.lastChild),e=n.indexValue):t.parentNode.classList.contains("jdropdown-group-items")&&((n=t.parentNode.parentNode.previousElementSibling)&&(n.classList.contains("jdropdown-group")?n=n.lastChild.lastChild:n.classList.contains("jdropdown-item")?e=n.indexValue:n=null),n&&(e=n.indexValue))}null!==e&&i.setCursor(e)},i.loadFirst=function(){if(i.results)var e=i.results;else e=i.items;var t=e.length||0;1==i.options.lazyLoading&&t>200&&(t=200),x.textContent="";for(var n=0;n200){t-=200,x.textContent="";for(var n=t;n0){for(var a=0;o>0&&t[o]&&a<200;)t[o].group?(t[o].group.parentNode||x.insertBefore(t[o].group,x.firstChild),t[o].group.lastChild.insertBefore(t[o].element,t[o].group.lastChild.firstChild)):x.insertBefore(t[o].element,x.firstChild),o--,a++;e=!0}return e},i.loadDown=function(){var e=!1;if(i.results)var t=i.results;else t=i.items;var n=x.querySelectorAll(".jdropdown-item"),o=n[n.length-1].indexValue;o=i.items[o];var a=t.indexOf(o)+1;if(a0&&n.prev(),t.preventDefault();else if(40==t.which)null==n.currentIndex?n.first():n.currentIndex+10)for(var i=0;i<7;i++)n.prev();t.preventDefault()}else if(34==t.which){if(null==n.currentIndex)n.first();else if(n.currentIndex+10&&(n.options.grid?(o.classList.add("jpicker-grid"),o.style.gridTemplateColumns="repeat("+n.options.grid+", 1fr)"):(o.classList.add("jpicker-columns"),o.style.width=n.options.width?n.options.width:36*n.options.columns+"px")),isNaN(parseInt(n.options.value))&&(n.options.value=0),function(){o.innerHTML="";for(var e=Object.keys(n.options.data),t=0;t'+n.options.content+"":n.getLabel(e,null),a(t)?(i.innerHTML="",i.appendChild(t)):i.innerHTML=t},n.open=function(){if(!e.classList.contains("jpicker-focus")){u(n,!0),e.classList.add("jpicker-focus"),e.focus();var t,a=0;o.style.marginLeft="";var s=i.getBoundingClientRect(),r=o.getBoundingClientRect();t=window.innerHeightwindow.innerWidth&&(a=-1*(10+r.left+r.width-window.innerWidth)),o.style.marginTop=parseInt(t)+"px",o.style.marginLeft=parseInt(a)+"px","function"==typeof n.options.onopen&&n.options.onopen(e,n)}},n.close=function(){e.classList.contains("jpicker-focus")&&(e.classList.remove("jpicker-focus"),u(n,!1),"function"==typeof n.options.onclose&&n.options.onclose(e,n))},e.classList.add("jpicker"),e.setAttribute("tabindex","900"),e.onmousedown=function(t){e.classList.contains("jpicker-focus")||n.open()},(i=document.createElement("div")).classList.add("jpicker-header"),(o=document.createElement("div")).classList.add("jpicker-content"),o.onclick=function(e){var t=r.findElement(e.target,"jpicker-item");t&&t.parentNode===o&&n.setValue(t.k,e)},e.appendChild(i),e.appendChild(o),e.value=t.value||0,n.setOptions(t),"function"==typeof n.options.onload&&n.options.onload(e,n),e.change=n.setValue,e.val=function(e){if(void 0===e)return n.getValue();n.setValue(e)},e.picker=n,n}function C(e,t){var n={type:"toolbar",options:{}},i={app:null,container:!1,badge:!1,title:!1,responsive:!1,maxWidth:null,bottom:!0,items:[]};for(var o in i)t&&t.hasOwnProperty(o)?n.options[o]=t[o]:n.options[o]=i[o];!e&&t.app&&t.app.el&&(e=document.createElement("div"),t.app.el.appendChild(e));var a=document.createElement("div");a.classList.add("jtoolbar-item"),a.classList.add("jtoolbar-arrow");var s=document.createElement("div");s.classList.add("jtoolbar-floating"),a.appendChild(s),n.selectItem=function(e){for(var t=l.children,n=0;nwindow.innerHeight||n.options.bottom?s.style.bottom="0":s.style.removeProperty("bottom"),s.style.right="0",a.children[0].focus(),u(n,!0)},n.close=function(){a.classList.remove("jtoolbar-arrow-selected"),u(n,!1)},n.refresh=function(){if(1==n.options.responsive){var t=e.parentNode.getBoundingClientRect();n.options.maxWidth||(n.options.maxWidth=t.width);var i=parseInt(n.options.maxWidth);for(a.parentNode&&a.parentNode.removeChild(a);s.firstChild;)l.appendChild(s.firstChild);if(i0&&l.appendChild(a)}},n.setReadonly=function(t){t=t?"add":"remove",e.classList[t]("jtoolbar-disabled")},e.onclick=function(e){var t=r.findElement(e.target,"jtoolbar-item");t&&n.selectItem(t),e.target.classList.contains("jtoolbar-arrow")&&n.open()},window.addEventListener("resize",(function(){n.refresh()})),e.classList.add("jtoolbar"),e.innerHTML="",1==n.options.container&&e.classList.add("jtoolbar-container");var l=document.createElement("div");return e.appendChild(l),n.options.app&&e.classList.add("jtoolbar-mobile"),n.create(n.options.items),e.toolbar=n,n}var T=function(){var e=function(t,n){var i={type:"editor",options:{}},o={url:null,value:"",snippet:null,toolbar:!0,toolbarOnTop:!1,remoteParser:null,placeholder:null,filterPaste:!0,dropZone:!0,dropAsSnippet:!1,acceptImages:!0,acceptFiles:!1,maxFileSize:5e6,allowImageResize:!0,maxHeight:null,height:null,focus:!1,onclick:null,onfocus:null,onblur:null,onload:null,onkeyup:null,onkeydown:null,onchange:null,extensions:null,type:null};for(var a in o)n&&n.hasOwnProperty(a)?i.options[a]=n[a]:i.options[a]=o[a];var s=null,l=null,d=[];i.el=t,"function"==typeof i.options.onclick&&(t.onclick=function(e){i.options.onclick(t,i,e)}),t.classList.add("jeditor-container");var c=document.createElement("div");c.className="jsnippet",c.setAttribute("contenteditable",!1);var u=document.createElement("div");if(u.className="jeditor-toolbar",i.editor=document.createElement("div"),i.editor.setAttribute("contenteditable",!0),i.editor.setAttribute("spellcheck",!1),i.editor.classList.add("jeditor"),i.options.placeholder&&i.editor.setAttribute("data-placeholder",i.options.placeholder),(i.options.maxHeight||i.options.height)&&(i.editor.style.overflowY="auto",i.options.maxHeight&&(i.editor.style.maxHeight=i.options.maxHeight),i.options.height&&(i.editor.style.height=i.options.height)),i.options.url)m({url:i.options.url,dataType:"html",success:function(t){i.editor.innerHTML=t,e.setCursor(i.editor,"initial"==i.options.focus)}});else if(i.options.value)i.editor.innerHTML=i.options.value;else for(var p=0;p4?4:t),t>4?e.setAttribute("data-total",t-4):e.removeAttribute("data-total")}};i.appendSnippet=function(e){c.innerHTML="";for(var t=["image","title","description","host","url"],n=0;n/g,"\n")).replace(/<\/div>/g,"\n")).replace(/<(?:.|\n)*?>/gm,""),u.content=l.trim(),H("getData",u)}else var u=i.editor.innerHTML;return u},i.reset=function(){i.editor.innerHTML="",c.innerHTML="",d=[]},i.addPdf=function(e){if("data"!=e.result.substr(0,4))console.error("Invalid source");else{var t=document.createElement("canvas");t.width=60,t.height=60;var n=new Image;t.getContext("2d").drawImage(n,0,0,t.width,t.height),t.toBlob((function(t){var n=document.createElement("img");n.src=window.URL.createObjectURL(t),n.title=e.name,n.className="jfile pdf",d[n.src]={file:n.src,extension:"pdf",content:e.result},document.execCommand("insertHtml",!1,n.outerHTML)}))}},i.addImage=function(e,t){if(e||(e=""),"data"==e.substr(0,4)||i.options.remoteParser){if("data"==e.substr(0,4))n=(n=(n=e.split(";"))[0].split("/"))[1];else{var n=e.substr(e.lastIndexOf(".")+1);e=i.options.remoteParser+e}var o=new Image;o.onload=function(){var e=document.createElement("canvas");e.width=o.width,e.height=o.height,e.getContext("2d").drawImage(o,0,0,e.width,e.height),e.toBlob((function(a){var s,r=document.createElement("img");r.src=window.URL.createObjectURL(a),r.classList.add("jfile"),r.setAttribute("tabindex","900"),r.setAttribute("width",o.width),r.setAttribute("height",o.height),d[r.src]={file:r.src,extension:n,content:e.toDataURL()},i.options.dropAsSnippet||t?(s=r,c.innerHTML||i.appendSnippet({}),c.children[0].appendChild(s),f(),d[r.src].snippet=!0):document.execCommand("insertHtml",!1,r.outerHTML),h()}))},o.src=e}else console.error("remoteParser not defined in your initialization")},i.addFile=function(e){for(var t=[],n=0;ni.options.maxFileSize)alert("The file is too big");else{var o=e[n].type.split("/");(o="image"==o[0]?1:"pdf"==o[1]?2:0)?(t[n]=new FileReader,t[n].index=n,t[n].type=o,t[n].name=e[n].name,t[n].date=e[n].lastModified,t[n].size=e[n].size,t[n].addEventListener("load",(function(e){2==e.target.type?1==i.options.acceptFiles&&i.addPdf(e.target):i.addImage(e.target.result)}),!1),t[n].readAsDataURL(e[n])):alert("The extension is not allowed")}},i.destroy=function(){i.editor.removeEventListener("mouseup",O),i.editor.removeEventListener("mousedown",N),i.editor.removeEventListener("mousemove",I),i.editor.removeEventListener("keyup",M),i.editor.removeEventListener("keydown",D),i.editor.removeEventListener("dragstart",L),i.editor.removeEventListener("dragenter",j),i.editor.removeEventListener("dragover",E),i.editor.removeEventListener("drop",T),i.editor.removeEventListener("paste",w),i.editor.removeEventListener("blur",k),i.editor.removeEventListener("focus",A),t.editor=null,t.classList.remove("jeditor-container"),u.remove(),c.remove(),i.editor.remove()},i.upload=function(){r.click(i.file)};var v=[HTMLUnknownElement,HTMLAudioElement,HTMLEmbedElement,HTMLIFrameElement,HTMLTextAreaElement,HTMLInputElement,HTMLScriptElement],g=["width","height","align","border","src","tabindex"],y=["color","font-weight","font-size","background","background-color","margin"],b=function(e){if(e.attributes&&e.attributes.length){var t=null,n=e.getAttribute("style");if(n){t=[];for(var o=n.split(";"),a=0;a=0){var r=s.shift();s=s.join(":"),t.push(r+":"+s)}}}"IMG"==e.tagName.toUpperCase()&&(i.options.acceptImages&&e.src?(e.setAttribute("tabindex","900"),i.addImage(e.src)):e.parentNode.removeChild(e));for(var l=[],d=0;d=0&&e.remove()},x=function(e){var t=window.getSelection(),n=document.createRange();n.selectNode(e),t.addRange(n)},w=function(e){if(1==i.options.filterPaste){if(e.clipboardData||e.originalEvent.clipboardData)var t=(e.originalEvent||e).clipboardData.getData("text/html"),n=(e.originalEvent||e).clipboardData.getData("text/plain"),o=(e.originalEvent||e).clipboardData.files;else window.clipboardData&&(t=window.clipboardData.getData("Html"),n=window.clipboardData.getData("Text"),o=window.clipboardData.files);if(o.length)i.addFile(o);else if(t){var a=function(e){e&&(e=e.replace(new RegExp("\x3c!--(.*?)--\x3e","gsi"),""));var t=(new DOMParser).parseFromString(e,"text/html");b(t);var n=document.createElement("span");return n.innerHTML=t.firstChild.innerHTML,n}(t);document.execCommand("insertHtml",!1,a.innerHTML)}else t=n.split("\r\n"),e.target.innerText?(t=t.map((function(e){return"
"+e+"
"})),document.execCommand("insertHtml",!1,t.join(""))):t.map((function(e){var t=document.createElement("div");t.innerText=e,i.editor.appendChild(t)}));e.preventDefault()}},L=function(e){l&&l.e&&e.preventDefault()},j=function(e){l||0==i.options.dropZone||(t.classList.add("jeditor-dragging"),e.preventDefault())},E=function(e){l||0==i.options.dropZone||(s&&clearTimeout(s),s=setTimeout((function(){t.classList.remove("jeditor-dragging")}),100),e.preventDefault())},T=function(e){if(l||0==i.options.dropZone);else{var n=null;document.caretRangeFromPoint?n=document.caretRangeFromPoint(e.clientX,e.clientY):e.rangeParent&&(n=document.createRange()).setStart(e.rangeParent,e.rangeOffset);var o=window.getSelection();o.removeAllRanges(),o.addRange(n),o.anchorNode.parentNode.focus();var a=(e.originalEvent||e).dataTransfer.getData("text/html"),s=(e.originalEvent||e).dataTransfer.getData("text/plain"),r=(e.originalEvent||e).dataTransfer.files;r.length?i.addFile(r):s&&function(e){var t=document.createElement("div");t.innerHTML=e;var n=t.querySelectorAll("img");if(n.length)for(var o=0;o
"),"function"==typeof i.options.onkeyup&&i.options.onkeyup(t,i,e)},D=function(e){if(H("onevent",e),"Delete"==e.key&&"IMG"==e.target.tagName){var n=e.target.parentNode;x(e.target),n.classList.contains("jsnippet-image")&&f()}"function"==typeof i.options.onkeydown&&i.options.onkeydown(t,i,e)},O=function(e){if(l&&l.e&&(l.e.classList.remove("resizing"),1==l.e.changed)){var t=l.e.cloneNode();t.width=parseInt(l.e.style.width)||l.e.getAttribute("width"),t.height=parseInt(l.e.style.height)||l.e.getAttribute("height"),l.e.style.width="",l.e.style.height="",x(l.e),document.execCommand("insertHtml",!1,t.outerHTML)}l=!1},N=function(e){var t=function(t){var n=t.getBoundingClientRect();n.width-(e.clientX-n.left)<40&&e.clientY-n.top<40&&(t.innerHTML="",t.remove())};if("IMG"==e.target.tagName)if(e.target.style.cursor){var n=e.target.getBoundingClientRect();l={e:e.target,x:e.clientX,y:e.clientY,w:n.width,h:n.height,d:e.target.style.cursor},e.target.getAttribute("width")||e.target.setAttribute("width",n.width),e.target.getAttribute("height")||e.target.setAttribute("height",n.height);var i=window.getSelection();if(i.rangeCount)for(var o=0;o'+e+""},onchange:function(e,t,n,i,o){document.execCommand("fontName",!1,i)}}),n.push({type:"select",content:"format_size",options:["x-small","small","medium","large","x-large"],render:function(e){return''+e+""},onchange:function(e,t,n,i,o){document.execCommand("fontSize",!1,parseInt(o)+1)}}),n.push({type:"select",options:["format_align_left","format_align_center","format_align_right","format_align_justify"],render:function(e){return''+e+""},onchange:function(e,t,n,i,o){document.execCommand(["JustifyLeft","justifyCenter","justifyRight","justifyFull"][o])}}),n.push({type:"divisor"}),n.push({content:"format_color_text",k:"color",onclick:t}),n.push({content:"format_color_fill",k:"background-color",onclick:t})),n.push({content:"format_bold",onclick:function(e,t,n){document.execCommand("bold"),document.queryCommandState("bold")?n.classList.add("selected"):n.classList.remove("selected")}}),n.push({content:"format_italic",onclick:function(e,t,n){document.execCommand("italic"),document.queryCommandState("italic")?n.classList.add("selected"):n.classList.remove("selected")}}),n.push({content:"format_underline",onclick:function(e,t,n){document.execCommand("underline"),document.queryCommandState("underline")?n.classList.add("selected"):n.classList.remove("selected")}}),n.push({type:"divisor"}),n.push({content:"format_list_bulleted",onclick:function(e,t,n){document.execCommand("insertUnorderedList"),document.queryCommandState("insertUnorderedList")?n.classList.add("selected"):n.classList.remove("selected")}}),n.push({content:"format_list_numbered",onclick:function(e,t,n){document.execCommand("insertOrderedList"),document.queryCommandState("insertOrderedList")?n.classList.add("selected"):n.classList.remove("selected")}}),n.push({content:"format_indent_increase",onclick:function(e,t,n){document.execCommand("indent",!0,null),document.queryCommandState("indent")?n.classList.add("selected"):n.classList.remove("selected")}}),n.push({content:"format_indent_decrease",onclick:function(){document.execCommand("outdent"),document.queryCommandState("outdent")?this.classList.add("selected"):this.classList.remove("selected")}}),e.options.toolbarOnTop&&(n.push({type:"divisor"}),n.push({content:"photo",onclick:function(){e.upload()}}),n.push({type:"select",content:"table_view",columns:8,grid:8,right:!0,options:["0x0","1x0","2x0","3x0","4x0","5x0","6x0","7x0","0x1","1x1","2x1","3x1","4x1","5x1","6x1","7x1","0x2","1x2","2x2","3x2","4x2","5x2","6x2","7x2","0x3","1x3","2x3","3x3","4x3","5x3","6x3","7x3","0x4","1x4","2x4","3x4","4x4","5x4","6x4","7x4","0x5","1x5","2x5","3x5","4x5","5x5","6x5","7x5","0x6","1x6","2x6","3x6","4x6","5x6","6x6","7x6","0x7","1x7","2x7","3x7","4x7","5x7","6x7","7x7"],render:function(e,t){t&&(t.onmouseover=this.onmouseover,e=e.split("x"),t.setAttribute("data-x",e[0]),t.setAttribute("data-y",e[1]));var n=document.createElement("div");return t.style.margin="1px",t.style.border="1px solid #ddd",n},onmouseover:function(e){for(var t=parseInt(e.target.getAttribute("data-x")),n=parseInt(e.target.getAttribute("data-y")),i=0;i=t[0]&&e<=t[1]},"not between":function(e,t){return et[1]},"<":function(e,t){return e":function(e,t){return e>t[0]},">=":function(e,t){return e>=t[0]},"=":function(e,t){return e==t[0]},"!=":function(e,t){return e!=t[0]}},n={"valid date":function(){return!0},"=":function(e,t){return e===t[0]},"!=":function(e,t){return e!==t[0]},"<":function(e,t){return e":function(e,t){return e>t[0]},">=":function(e,t){return e>=t[0]},between:function(e,t){return e>=t[0]&&e<=t[1]},"not between":function(e,t){return et[1]}},i={contains:function(e,t){return e.includes(t[0])},"not contains":function(e,t){return!e.includes(t[0])},"begins with":function(e,t){return e.startsWith(t[0])},"ends with":function(e,t){return e.endsWith(t[0])},"=":function(e,t){return e===t[0]},"!=":function(e,t){return e!==t[0]},"valid email":function(e){return new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/).test(e)},"valid url":function(e){return new RegExp(/(((https?:\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]+)/gi).test(e)}},o=function(e,t){return"function"==typeof o[t.type]?!(!t.allowBlank||""!==e)||o[t.type](e,t):null};o.url=function(){return!!new RegExp(/(((https?:\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]+)/gi).test(data)},o.email=function(e){var t=new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);return!(!e||!t.test(e))},o.required=function(e){return!!e.trim()},o.exist=function(e,t){return!!e.toString().trim()},o["not exist"]=function(e,t){return!e.toString().trim()},o.empty=function(e){return!e.toString().trim()},o.notEmpty=function(e){return!!e.toString().trim()},o.number=function(n,i){if(!e(n))return!1;if(!i||!i.criteria)return!0;if(!t[i.criteria])return!1;let o=i.value.map((function(e){return parseFloat(e)}));return t[i.criteria](n,o)},o.login=function(e){let t=new RegExp(/^[a-zA-Z0-9._-]+$/);return!(!e||!t.test(e))},o.list=function(e,t){let n,i=typeof e;return("string"===i||"number"===i)&&(n="string"==typeof t.value[0]?t.value[0].split(","):t.value[0],!!Array.isArray(n)&&n.findIndex((function(t){return t==e}))>-1)};const a=function(){let e=new Date;return e.setHours(0,0,0,0),e},s={"one year ago":function(){let e=a();return e.setFullYear(e.getFullYear()-1),e},"one month ago":function(){let e=a();return e.setMonth(e.getMonth()-1),e},"one week ago":function(){let e=a();return e.setDate(e.getDate()-7),e},yesterday:function(){let e=a();return e.setDate(e.getDate()-1),e},today:a,tomorrow:function(){let e=a();return e.setDate(e.getDate()+1),e}};return o.date=function(t,i){if(e(t)&&t>0&&t<1e6&&(t=l.numToDate(t)),"Invalid Date"==new Date(t))return!1;if(!i||!i.criteria)return!0;if(!n[i.criteria])return!1;let o=i.value.map((function(e){return"string"==typeof e&&s[e]?s[e]().getTime():new Date(e).getTime()}));return n[i.criteria](new Date(t).getTime(),o)},o.text=function(e,t){return"string"==typeof e&&(!t||!t.criteria||!!i[t.criteria]&&i[t.criteria](e,t.value))},o.textLength=function(e,t){return e=e.toString(),o.number(e.length,t)},o}(),M=function(){var e=function(t,n){var i={options:{}},o={url:null,message:"Are you sure? There are unsaved information in your form",ignore:!1,currentHash:null,submitButton:null,validations:null,onbeforeload:null,onload:null,onbeforesave:null,onsave:null,onbeforeremove:null,onremove:null,onerror:function(e,t){alert(t)}};for(var a in o)n&&n.hasOwnProperty(a)?i.options[a]=n[a]:i.options[a]=o[a];return i.options.validations||(i.options.validations={}),i.options.submitButton||(i.options.submitButton=t.querySelector("input[type=submit]")),i.options.submitButton&&i.options.url&&(i.options.submitButton.onclick=function(){i.save()}),i.options.validations.email||(i.options.validations.email=A.email),i.options.validations.length||(i.options.validations.length=A.length),i.options.validations.required||(i.options.validations.required=A.required),i.setUrl=function(e){i.options.url=e},i.load=function(){m({url:i.options.url,method:"GET",dataType:"json",queue:!0,success:function(n){if("function"==typeof i.options.onbeforeload){var o=i.options.onbeforeload(t,n);o&&(n=o)}e.setElements(t,n),"function"==typeof i.options.onload&&i.options.onload(t,n)}})},i.save=function(){var n=i.validate();if(n)i.options.onerror(t,n);else{var o=e.getElements(t,!0);if("function"==typeof i.options.onbeforesave&&!1===(o=i.options.onbeforesave(t,o)))return;m({url:i.options.url,method:"POST",dataType:"json",data:o,success:function(e){"function"==typeof i.options.onsave&&i.options.onsave(t,o,e)}})}},i.remove=function(){if("function"==typeof i.options.onbeforeremove&&!1===i.options.onbeforeremove(t,i))return!1;m({url:i.options.url,method:"DELETE",dataType:"json",success:function(e){"function"==typeof i.options.onremove&&i.options.onremove(t,i,e),i.reset()}})},i.validateElement=function(n){var o=!1,a=e.getValue(n),s=n.getAttribute("data-validation");return"function"!=typeof i.options.validations[s]||i.options.validations[s](a,n)?n.classList.contains("error")&&function(e){var n=!1;e.classList.remove("error"),e.removeAttribute("title");for(var o=t.querySelectorAll("input, select, textarea, div[name]"),a=0;a0&&e.join("
")},i.getError=function(){return!!i.validation()},i.setHash=function(){return i.getHash(e.getElements(t))},i.getHash=function(e){var t,n=0;if(0===e.length)return n;for(t=0;t800?v.fadeIn(o):v.slideTop(o,1)},t.hide=function(){r.getWindowWidth()>800?v.fadeOut(o,(function(){o.parentNode&&(o.parentNode.removeChild(o),g&&clearTimeout(g))})):v.slideTop(o,0,(function(){o.parentNode&&(o.parentNode.removeChild(o),g&&clearTimeout(g))}))},t.show(),1==t.options.autoHide)var g=setTimeout((function(){t.hide()}),t.options.timeout);return r.getWindowWidth()<800&&o.addEventListener("swipeup",(function(e){t.hide(),e.preventDefault(),e.stopPropagation()})),t};return e.isVisible=function(){var e=document.querySelector(".jnotification");return!(!e||!e.parentNode)},e}();function N(e,t){if(e.search)return e.search;var n=null,i=function(t){if("function"==typeof a.options.onsearch){var n=a.options.onsearch(a,t);n&&(t=n)}if(s.innerHTML="",t.length){e.style.display="block";for(var i=t.length<11?t.length:10,o=0;o=0)return!0}else for(var n in t)if((""+t[n]).toLowerCase().search(e.toLowerCase())>=0)return!0;return!1}(t)}));i(t)}else m({url:a.options.data+e,method:"GET",dataType:"json",success:function(e){i(e)}})}(e)}),500)};null===t.forceSelect&&(t.forceSelect=!0),a.options={data:t.data||null,input:t.input||null,searchByNode:t.searchByNode||null,onselect:t.onselect||null,forceSelect:t.forceSelect,onsearch:t.onsearch||null,onbeforesearch:t.onbeforesearch||null},a.selectIndex=function(e){var t=e.getAttribute("id"),n=e.getAttribute("data-text"),i=e.getAttribute("data-value"),o=e.children[0].src||"";"function"==typeof a.options.onselect&&a.options.onselect(a,n,i,t,o),a.close()},a.open=function(){e.style.display="block"},a.close=function(){o&&clearTimeout(o),a.terms="",s.innerHTML="",e.style.display=""},a.isOpened=function(){return!!e.style.display},a.keydown=function(e){a.isOpened()&&("Enter"==e.key?null!==n&&s.children[n]?(a.selectIndex(s.children[n]),e.preventDefault()):a.close():"ArrowUp"===e.key?(null!==n&&s.children[0]&&(s.children[n].classList.remove("selected"),a.options.forceSelect||0!==n?(n=Math.max(0,n-1),s.children[n].classList.add("selected")):n=null),e.preventDefault()):"ArrowDown"===e.key&&(null==n?n=-1:s.children[n].classList.remove("selected"),n<9&&s.children[n+1]&&n++,s.children[n].classList.add("selected"),e.preventDefault()))},a.keyup=function(e){if(!a.options.searchByNode&&a.options.input)if("DIV"===a.options.input.tagName)var t=a.options.input.innerText;else t=a.options.input.value;else{var n=r.getNode();n&&(t=n.innerText)}if("function"==typeof a.options.onbeforesearch){var i=a.options.onbeforesearch(a,t);if(i)t=i;else if(!1===i)return}a(t)},a.blur=function(e){a.close()},a.options.input&&(a.options.input.addEventListener("keyup",a.keyup),a.options.input.addEventListener("keydown",a.keydown),a.options.input.addEventListener("blur",a.blur));var s=document.createElement("div");return s.classList.add("jsearch_container"),s.onmousedown=function(e){if(e.target.classList.contains("jsearch_item"))var t=e.target;else t=e.target.parentNode;a.selectIndex(t),e.preventDefault()},e.appendChild(s),e.classList.add("jsearch"),e.search=a,a}function I(e,t){var n={options:{}},i={type:"image",extension:"*",input:!1,minWidth:!1,maxWidth:null,maxHeight:null,maxJpegSizeBytes:null,onchange:null,multiple:!1,remoteParser:null};for(var o in i)t&&t.hasOwnProperty(o)?n.options[o]=t[o]:n.options[o]=i[o];1==n.options.multiple&&e.setAttribute("data-multiple",!0),e.content=[],e.classList.add("jupload"),1==n.options.input&&e.classList.add("input"),n.add=function(t){if(0==n.options.multiple&&(e.content=[],e.innerText=""),"image"==n.options.type){var i=document.createElement("img");i.setAttribute("src",t.file),i.setAttribute("tabindex",-1),e.getAttribute("name")||(i.className="jfile",i.content=t),e.appendChild(i)}else{if(t.name)var o=t.name;else o=t.file;var a=document.createElement("div");a.innerText=o||n.options.type,a.classList.add("jupload-item"),a.setAttribute("tabindex",-1),e.appendChild(a)}t.content&&(t.file=r.guid()),e.content.push(t),"function"==typeof n.options.onchange&&n.options.onchange(e,t)},n.addFromFile=function(e){if(e.type.split("/")[0]==n.options.type){var t=new FileReader;t.addEventListener("load",(function(t){var i={file:t.srcElement.result,extension:e.name.substr(e.name.lastIndexOf(".")+1),name:e.name,size:e.size,lastmodified:e.lastModified,content:t.srcElement.result};n.add(i)})),t.readAsDataURL(e)}else alert(c.translate("This extension is not allowed"))},n.addFromUrl=function(e){if("data"==e.substr(0,4)||n.options.remoteParser)if("data"==e.substr(0,4))if((i=(i=e.split(";"))[0].split("/"))[0].replace("data:","")==n.options.type){var t={file:e,name:"",extension:i[1],content:e};n.add(t)}else alert(n.options.text.extensionNotAllowed);else{var i=e.substr(e.lastIndexOf(".")+1);e=n.options.remoteParser+e,m({url:e,type:"GET",dataType:"blob",success:function(e){}})}else console.error("remoteParser not defined in your initialization")};var a=n.options.type+"/"+n.options.extension,s=document.createElement("input");s.type="file",s.setAttribute("accept",a),s.onchange=function(){for(var e=0;e=0&&(e.content.splice(n,1),l.remove(),l=null)}})),e.addEventListener("drop",(function(t){t.preventDefault(),t.stopPropagation();var i=(t.originalEvent||t).dataTransfer.getData("text/html");if((t.originalEvent||t).dataTransfer.files.length)for(var o=0;o4&&e.setAttribute("data-total",i-4),e.setAttribute("data-number",i>4?4:i)}var o=document.createElement("div");if(o.classList.add("jslider-counter"),e.children.length>0)for(var a=0;an.currentImage.offsetWidth&&n.currentImage.classList.add("jslider-vertical"),l.children[0].innerText=n.currentImage.getAttribute("title")},n.open=function(){n.show(),"function"==typeof n.options.onopen&&n.options.onopen(e)},n.close=function(){e.classList.remove("jslider-focus"),e.classList.remove("jslider-left"),e.classList.remove("jslider-right"),n.options.grid&&e.classList.add("jslider-grid");for(var t=0;t=n.options.limit)},o=null,a=null;n.setOptions=function(t,i){var s={value:"",limit:null,search:null,placeholder:null,validation:null,onbeforepaste:null,onbeforechange:null,onlimit:null,onchange:null,onfocus:null,onblur:null,onload:null};for(var r in s)t&&t.hasOwnProperty(r)?n.options[r]=t[r]:void 0!==n.options[r]&&!0!==i||(n.options[r]=s[r]);return n.options.placeholder?e.setAttribute("data-placeholder",n.options.placeholder):e.removeAttribute("data-placeholder"),e.placeholder=n.options.placeholder,n.setValue(n.options.value),u(),n.options.search?a||(a=document.createElement("div"),e.parentNode.insertBefore(a,e.nextSibling),o=N(a,{data:n.options.search,onselect:function(e,t,i){n.selectIndex(t,i)}})):a&&(o=null,a.remove(),a=null),n},n.add=function(t,a){if("function"==typeof n.options.onbeforechange){var u=n.options.onbeforechange(e,n,n.options.value,t);if(!1===u)return!1;null!=u&&(t=u)}if(o&&o.close(),i())"function"==typeof n.options.onlimit?n.options.onlimit(n,n.options.limit):alert(c.translate("You reach the limit number of entries")+" "+n.options.limit);else{var p=r.getNode();if(!(p&&p.parentNode&&p.parentNode.classList.contains("jtags")&&p.nextSibling)||p.nextSibling.innerText&&p.nextSibling.innerText.trim()){if(e.lastChild&&(e.lastChild.innerText.trim()||e.removeChild(e.lastChild)),t&&"string"!=typeof t){for(var h=0;h<=t.length;h++)if(!i()){if(t[h]&&"string"!=typeof t[h])f=t[h].text,m=t[h].value;else var f=t[h]||"",m=null;v=l(f,m)}}else var v=l(t,t,p);d()}else v=p.nextSibling;a&&s(v)}},n.setLimit=function(t){for(n.options.limit=t,e.children.length;e.children.length>t;)e.removeChild(e.lastChild)},n.remove=function(t){t.parentNode.removeChild(t),e.children.length?d():n.add("",!0)},n.getData=function(){for(var t=[],n=0;n",d()},n.isValid=function(){for(var t=0,n=0;n1&&(i()?"function"==typeof n.options.onlimit&&n.options.onlimit(n,n.options.limit):n.add("",!0)),t.preventDefault()):"Enter"==t.key?o&&o.isOpened()||(window.getSelection().anchorOffset>1&&(i()||n.add("",!0)),t.preventDefault()):"Backspace"==t.key&&1==e.children.length&&window.getSelection().anchorOffset<1&&t.preventDefault(),o&&o.keydown(t),p()},v=function(e){if(39==e.which){var t=window.getSelection().anchorOffset;t>1&&t==f&&n.add("",!0)}else 13==e.which||38==e.which||40==e.which?e.preventDefault():o&&o.keyup(e);u()},g=function(t){if(t.clipboardData||t.originalEvent.clipboardData)var i=(t.originalEvent||t).clipboardData.getData("text/plain");else window.clipboardData&&(i=window.clipboardData.getData("Text"));var o=h(i);if("function"==typeof n.options.onbeforepaste){var a=n.options.onbeforepaste(e,n,o);if(!1===a)return t.preventDefault(),!1;a&&(o=a)}o.length>1?(n.add(o,!0),t.preventDefault()):o[0]&&(document.execCommand("insertText",!1,o[0]),t.preventDefault())},y=function(t){if(t.target.parentNode&&t.target.parentNode.classList.contains("jtags")&&(t.target.classList.contains("jtags_label")||t.target.classList.contains("jtags_error"))){var i=t.target.getBoundingClientRect();i.width-(t.clientX-i.left)<16&&n.remove(t.target)}t.target==e&&s()},b=function(){e.classList.contains("jtags-focus")||(e.children.length&&!n.getValue(e.children.length-1)||i()||l(""),"function"==typeof n.options.onfocus&&n.options.onfocus(e,n,n.getValue()),e.classList.add("jtags-focus"))},x=function(){if(e.classList.contains("jtags-focus")){o&&o.close();for(var t=0;t0)for(var n=0;n